Skip to content

Commit 7766a4c

Browse files
authoredJun 30, 2021
chore: update deps & typedoc config
1 parent 43c82d6 commit 7766a4c

File tree

5 files changed

+1181
-1282
lines changed

5 files changed

+1181
-1282
lines changed
 

‎gulpfile.js

+4-18
Original file line numberDiff line numberDiff line change
@@ -167,14 +167,7 @@ tasks({
167167
}),
168168

169169
// Minify
170-
terser({
171-
keep_fnames: false, // change to true here
172-
toplevel: true,
173-
compress: {
174-
dead_code: true,
175-
},
176-
ecma: 5,
177-
}),
170+
terser(),
178171

179172
size({ gzip: true, showFiles: true, showTotal: false })
180173
],
@@ -222,14 +215,7 @@ tasks({
222215
}),
223216

224217
// Minify
225-
terser({
226-
keep_fnames: false, // change to true here
227-
toplevel: true,
228-
compress: {
229-
dead_code: true,
230-
},
231-
ecma: 5,
232-
}),
218+
terser(),
233219
size({ gzip: true, showFiles: true, showTotal: false })
234220
],
235221
dest: jsFolder, // Output
@@ -303,8 +289,8 @@ task("watch", async () => {
303289
}
304290
);
305291

306-
watch(`${pugFolder}/**/*.pug`, series("html", "css", "reload"));
307-
watch([`${sassFolder}/**/*.scss`, `./tailwind.cjs`], series("css"));
292+
watch(`${pugFolder}/**/*.pug`, series("html", "reload"));
293+
watch([`${sassFolder}/**/*.scss`, `${pugFolder}/**/*.pug`, `./tailwind.cjs`], series("css"));
308294
watch(
309295
[
310296
`${tsFolder}/**/*.ts`,

‎package.json

+15-14
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@
3737
}
3838
},
3939
"dependencies": {
40+
"@okikio/animate": "workspace:^2.2.0",
41+
"@okikio/manager": "workspace:^2.1.7",
4042
"@okikio/native": "workspace:*",
4143
"polymorph-js": "^1.0.2"
4244
},
@@ -45,20 +47,19 @@
4547
"@commitlint/cli": "^12.1.4",
4648
"@commitlint/config-conventional": "^12.1.4",
4749
"@csstools/postcss-sass": "^4.0.0",
48-
"@strictsoftware/typedoc-plugin-monorepo": "^0.4.2",
4950
"autoprefixer": "^10.2.6",
50-
"browser-sync": "^2.26.14",
51+
"browser-sync": "^2.27.3",
5152
"chalk": "^4.1.1",
52-
"chokidar": "^3.5.1",
53+
"chokidar": "^3.5.2",
5354
"commitizen": "^4.2.4",
5455
"del": "^6.0.0",
55-
"del-cli": "^3.0.1",
56-
"esbuild": "^0.12.6",
56+
"del-cli": "^4.0.0",
57+
"esbuild": "^0.12.12",
5758
"gulp": "^4.0.2",
58-
"gulp-esbuild": "^0.8.1",
59+
"gulp-esbuild": "^0.8.2",
5960
"gulp-plumber": "^1.2.1",
6061
"gulp-postcss": "^9.0.0",
61-
"gulp-pug": "^4.0.1",
62+
"gulp-pug": "^5.0.0",
6263
"gulp-rename": "^2.0.0",
6364
"gulp-size": "^4.0.1",
6465
"gulp-terser": "^2.0.1",
@@ -67,15 +68,15 @@
6768
"husky": "^6.0.0",
6869
"lerna-changelog": "^1.0.1",
6970
"path-to-regexp": "^6.2.0",
70-
"pnpm": "^6.7.1",
71-
"postcss": "^8.3.0",
71+
"pnpm": "^6.9.1",
72+
"postcss": "^8.3.5",
7273
"postcss-csso": "^5.0.1",
73-
"postcss-scss": "^3.0.5",
74+
"postcss-scss": "^4.0.0",
7475
"pretty-bytes": "^5.6.0",
75-
"sass": "^1.34.1",
76-
"tailwindcss": "^2.1.4",
77-
"typedoc": "^0.20.36",
78-
"typescript": "~4.2.4",
76+
"sass": "^1.35.1",
77+
"tailwindcss": "^2.2.4",
78+
"typedoc": "^0.21.2",
79+
"typescript": "~4.3.4",
7980
"ultra-runner": "^3.10.5"
8081
}
8182
}

‎pnpm-lock.yaml

+1,047-1,129
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎repl.js

+113-109
Original file line numberDiff line numberDiff line change
@@ -73,43 +73,27 @@ export const CSSArrValue = (arr, unit) => {
7373
}
7474

7575

76-
/**
77-
* Creates the transform property text
78-
*/
79-
export const createTransformProperty = (arr) => {
80-
let result = "";
81-
let len = TransformFunctionNames.length;
82-
for (let i = 0; i < len; i++) {
83-
let name = TransformFunctionNames[i];
84-
let value = arr[i];
85-
if (isValid(value))
86-
result += `${name}(${Array.isArray(value) ? value.join(", ") : value}) `;
87-
}
88-
89-
return result.trim();
90-
}
91-
92-
export const TransformFunctionNames = [
93-
"translate",
94-
"translate3d",
95-
"translateX",
96-
"translateY",
97-
"translateZ",
98-
"rotate",
99-
"rotate3d",
100-
"rotateX",
101-
"rotateY",
102-
"rotateZ",
103-
"scale",
104-
"scale3d",
105-
"scaleX",
106-
"scaleY",
107-
"scaleZ",
108-
"skew",
109-
"skewX",
110-
"skewY",
111-
"perspective"
112-
];
76+
// export const TransformFunctionNames = [
77+
// "translate",
78+
// "translate3d",
79+
// "translateX",
80+
// "translateY",
81+
// "translateZ",
82+
// "rotate",
83+
// "rotate3d",
84+
// "rotateX",
85+
// "rotateY",
86+
// "rotateZ",
87+
// "scale",
88+
// "scale3d",
89+
// "scaleX",
90+
// "scaleY",
91+
// "scaleZ",
92+
// "skew",
93+
// "skewX",
94+
// "skewY",
95+
// "perspective"
96+
// ];
11397

11498
export const UnitLessCSSValue = CSSValue(UnitLess);
11599
export const UnitPXCSSValue = CSSValue(UnitPX);
@@ -122,6 +106,14 @@ export const camelCase = (str) => {
122106
let result = `${str}`.replace(/-([a-z])/g, (_, letter) => letter.toUpperCase());
123107
return result;
124108
}
109+
110+
/** Convert a camelCase string to a dash-separated string {@link camelCase} */
111+
export const convertToDash = (str) => {
112+
str = str.replace(/([A-Z])/g, letter => `-${letter.toLowerCase()}`);
113+
114+
// Remove first dash
115+
return ( str.charAt( 0 ) == '-' ) ? str.substr(1) : str;
116+
}
125117
/**
126118
* Acts like array.map(...) but for functions
127119
*/
@@ -153,79 +145,96 @@ export const ParseCSSProperties = (obj) => {
153145
}
154146

155147
/** Common CSS Property names with the units "px" as an acceptable value */
156-
export const CSSPXDataType = ["margin", "padding", "size", "width", "height", "left", "right", "top", "bottom", "radius", "gap", "basis", "inset", "outline-offset", "perspective", "thickness", "position", "distance", "spacing"].join("|");
148+
export const CSSPXDataType = ["margin", "padding", "size", "width", "height", "left", "right", "top", "bottom", "radius", "gap", "basis", "inset", "outline-offset", "perspective", "thickness", "position", "distance", "spacing"].map(camelCase).join("|");
157149

158150
/** Convert the {@link CSSPXDataType} array, to a Regular Expression */
159151
export const RegExpCSSPXDataType = new RegExp(CSSPXDataType, "gi");
160152

153+
/**
154+
* Return a copy of the object without the keys specified in the keys argument
155+
*
156+
* @param keys - arrays of keys to remove from the object
157+
* @param obj - the object in question
158+
* @returns
159+
* a copy of the object without certain key
160+
*/
161+
export const omit = (keys, obj) => {
162+
let arr = [...keys];
163+
let rest = { ...obj };
164+
while (arr.length) {
165+
let { [arr.pop()]: omitted, ...remaining } = rest;
166+
rest = remaining;
167+
}
168+
return rest;
169+
}
170+
export const TransformFunctions = {
171+
"translate": value => CSSArrValue(value, UnitPX),
172+
"translate3d": value => CSSArrValue(value, UnitPX),
173+
"translateX": value => UnitPXCSSValue(value),
174+
"translateY": value => UnitPXCSSValue(value),
175+
"translateZ": value => UnitPXCSSValue(value),
176+
177+
"rotate": value => CSSArrValue(value, UnitDEG),
178+
"rotate3d": value => CSSArrValue(value, UnitLess),
179+
"rotateX": value => UnitDEGCSSValue(value),
180+
"rotateY": value => UnitDEGCSSValue(value),
181+
"rotateZ": value => UnitDEGCSSValue(value),
182+
183+
"scale": value => CSSArrValue(value, UnitLess),
184+
"scale3d": value => CSSArrValue(value, UnitLess),
185+
"scaleX": value => UnitLessCSSValue(value),
186+
"scaleY": value => UnitLessCSSValue(value),
187+
"scaleZ": value => UnitLessCSSValue(value),
188+
189+
"skew": value => CSSArrValue(value, UnitDEG),
190+
"skewX": value => UnitDEGCSSValue(value),
191+
"skewY": value => UnitDEGCSSValue(value),
192+
193+
"perspective": value => UnitPXCSSValue(value),
194+
};
195+
196+
/**
197+
* Creates the transform property text
198+
*/
199+
export const createTransformProperty = (transformFnNames, arr) => {
200+
let result = "";
201+
let len = transformFnNames.length;
202+
for (let i = 0; i < len; i++) {
203+
let name = transformFnNames[i];
204+
let value = arr[i];
205+
if (isValid(value))
206+
result += `${name}(${Array.isArray(value) ? value.join(", ") : value}) `;
207+
}
208+
209+
return result.trim();
210+
}
211+
export const TransformFunctionNames = Object.keys(TransformFunctions);
212+
161213
/** Converts values to strings */
162214
export const toStr = (input) => `` + input;
163215
export const ParseTransformableCSSProperties = (properties) => {
164-
let {
165-
perspective,
166-
rotate,
167-
rotate3d,
168-
rotateX,
169-
rotateY,
170-
rotateZ,
171-
translate,
172-
translate3d,
173-
translateX,
174-
translateY,
175-
translateZ,
176-
scale,
177-
scale3d,
178-
scaleX,
179-
scaleY,
180-
scaleZ,
181-
skew,
182-
skewX,
183-
skewY,
184-
...rest
185-
186-
// Convert dash seperated strings to camelCase strings
187-
} = ParseCSSProperties(properties);
188-
189-
translate = CSSArrValue(translate, UnitPX);
190-
translate3d = CSSArrValue(translate3d, UnitPX);
191-
translateX = UnitPXCSSValue(translateX);
192-
translateY = UnitPXCSSValue(translateY);
193-
translateZ = UnitPXCSSValue(translateZ);
194-
195-
rotate = CSSArrValue(rotate, UnitDEG);
196-
rotate3d = CSSArrValue(rotate3d, UnitLess);
197-
rotateX = UnitDEGCSSValue(rotateX);
198-
rotateY = UnitDEGCSSValue(rotateY);
199-
rotateZ = UnitDEGCSSValue(rotateZ);
200-
201-
scale = CSSArrValue(scale, UnitLess);
202-
scale3d = CSSArrValue(scale3d, UnitLess);
203-
scaleX = UnitLessCSSValue(scaleX);
204-
scaleY = UnitLessCSSValue(scaleY);
205-
scaleZ = UnitLessCSSValue(scaleZ);
206-
207-
skew = CSSArrValue(skew, UnitDEG);
208-
skewX = UnitDEGCSSValue(skewX);
209-
skewY = UnitDEGCSSValue(skewY);
210-
211-
perspective = UnitPXCSSValue(perspective);
212-
213-
let transform = transpose(
214-
translate, translate3d, translateX, translateY, translateZ,
215-
rotate, rotate3d, rotateX, rotateY, rotateZ,
216-
scale, scale3d, scaleX, scaleY, scaleZ,
217-
skew, skewX, skewY,
218-
perspective
219-
).filter(isValid).map(createTransformProperty);
216+
// Convert dash seperated strings to camelCase strings
217+
let AllCSSProperties = ParseCSSProperties(properties);
218+
219+
let rest = omit(TransformFunctionNames, AllCSSProperties);
220+
221+
// Adds support for ordered transforms
222+
let transformFunctionNames = Object.keys(AllCSSProperties)
223+
.filter(key => TransformFunctionNames.includes(key));
224+
let transformFunctionValues = transformFunctionNames.map((key) => TransformFunctions[key](AllCSSProperties[key]));
225+
226+
let transform = transpose(...transformFunctionValues)
227+
.filter(isValid)
228+
.map(arr => createTransformProperty(transformFunctionNames, arr));
220229

221230
// Wrap non array CSS property values in an array
222231
rest = mapObject(rest, (value, key) => {
223232
let unit;
224233

225234
// If key doesn't have the word color in it, try to add the default "px" or "deg" to it
226-
if (!/color/gi.test(key)) {
227-
let isAngle = /rotate/gi.test(key);
228-
let isLength = new RegExp(CSSPXDataType, "gi").test(key);
235+
if (!/color/i.test(key)) {
236+
let isAngle = /rotate/i.test(key);
237+
let isLength = new RegExp(CSSPXDataType, "i").test(key);
229238

230239
// There is an intresting bug that occurs if you test a string againt the same instance of a Regular Expression
231240
// where the answer will be different every test
@@ -252,10 +261,10 @@ export const ParseTransformableCSSProperties = (properties) => {
252261

253262
let x = ParseTransformableCSSProperties({
254263
// It will automatically add the "px" units for you, or you can write a string with the units you want
255-
translate3d: ["0, 5", 0],
264+
translateY: ["20, 90", "100", 5], // Note: this will actually result in an error, make sure to pay attention to where you are putting strings and commas
256265
translate: "25, 35, 60%",
266+
translate3d: ["0, 5", 0],
257267
// translateX: -1,
258-
translateY: ["20, 90", "100", 5], // Note: this will actually result in an error, make sure to pay attention to where you are putting strings and commas
259268
// translateZ: 0,
260269
// perspective: 0,
261270
// opacity: 0,
@@ -267,6 +276,7 @@ let x = ParseTransformableCSSProperties({
267276
rotateC: "5,6",
268277
// "offset-size": 5,
269278
inset: "5px",
279+
"outline-offset":90,
270280
"offset-rotate": "10, 20",
271281
margin: "5 5"
272282
// rotate3d: [
@@ -368,15 +378,15 @@ export const ParseTransformableCSSKeyframes = (keyframes) => {
368378
perspective
369379
];
370380
}).map(([rest, ...transformFunctions]) => {
371-
let transform = createTransformProperty(transformFunctions);
381+
let transform = createTransformProperty(TransformFunctionNames, transformFunctions);
372382
let unit;
373383

374384
// Wrap non array CSS property values in an array
375385
rest = mapObject(rest, (value, key) => {
376386
// If key doesn't have the word color in it, try to add the default "px" or "deg" to it
377-
if (!/color/gi.test(key)) {
378-
let isAngle = /rotate/gi.test(key);
379-
let isLength = new RegExp(CSSPXDataType, "gi").test(key);
387+
if (!/color/i.test(key)) {
388+
let isAngle = /rotate/i.test(key);
389+
let isLength = new RegExp(CSSPXDataType, "i").test(key);
380390

381391
// There is an intresting bug that occurs if you test a string againt the same instance of a Regular Expression
382392
// where the answer will be different every test
@@ -451,9 +461,3 @@ console.log(ParseTransformableCSSKeyframes([
451461
// const mySet = new Set([1,2,3,4]);
452462
// [...mySet].reduce()
453463
// console.timeEnd("Test");
454-
455-
456-
457-
458-
459-
// console.log(camelCase("-a-stroke"))

‎typedoc.json

+2-12
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,11 @@
11
{
2-
"entryPoints": [
3-
"packages/native/src/api.ts",
4-
"packages/animate/src/api.ts",
5-
"packages/emitter/src/api.ts",
6-
"packages/manager/src/api.ts"
7-
],
8-
"external-modulemap": ".*/packages/([\\w\\-_]+)/",
92
"exclude": [
103
"**/test.ts",
114
"**/node_modules/**",
125
"**/*.d.ts",
136
"**/@types/*.d.ts"
147
],
15-
"tsconfig": "./tsconfig.json",
16-
"readme": "none",
17-
"includeVersion": false,
18-
"theme": "default",
19-
"name": "native",
8+
"packages": ".",
9+
"name": "The Native Initiative",
2010
"out": "docs"
2111
}

0 commit comments

Comments
 (0)
Please sign in to comment.