@symbo.ls/scratch 2.27.0 → 2.27.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/factory.js +5 -8
- package/dist/cjs/index.js +177 -347
- package/dist/cjs/set.js +126 -241
- package/dist/cjs/system/color.js +53 -87
- package/dist/cjs/system/document.js +25 -29
- package/dist/cjs/system/font.js +29 -37
- package/dist/cjs/system/index.js +126 -244
- package/dist/cjs/system/reset.js +32 -43
- package/dist/cjs/system/shadow.js +68 -117
- package/dist/cjs/system/spacing.js +40 -59
- package/dist/cjs/system/svg.js +31 -42
- package/dist/cjs/system/theme.js +66 -113
- package/dist/cjs/system/timing.js +33 -45
- package/dist/cjs/system/typography.js +42 -73
- package/dist/cjs/transforms/index.js +91 -163
- package/dist/cjs/utils/color.js +21 -36
- package/dist/cjs/utils/font.js +3 -6
- package/dist/cjs/utils/index.js +62 -110
- package/dist/cjs/utils/sequence.js +25 -45
- package/dist/cjs/utils/sprite.js +15 -13
- package/dist/cjs/utils/theme.js +3 -6
- package/dist/cjs/utils/var.js +19 -33
- package/package.json +7 -7
- package/src/system/typography.js +12 -20
- package/src/utils/color.js +42 -31
- package/src/utils/sprite.js +12 -8
package/dist/cjs/system/reset.js
CHANGED
|
@@ -51,8 +51,8 @@ var require_cjs = __commonJS({
|
|
|
51
51
|
return to;
|
|
52
52
|
};
|
|
53
53
|
var __toCommonJS2 = (mod) => __copyProps2(__defProp3({}, "__esModule", { value: true }), mod);
|
|
54
|
-
var
|
|
55
|
-
__export2(
|
|
54
|
+
var index_exports = {};
|
|
55
|
+
__export2(index_exports, {
|
|
56
56
|
arrayzeValue: () => arrayzeValue,
|
|
57
57
|
copyJavaScriptToClipboard: () => copyJavaScriptToClipboard,
|
|
58
58
|
copyStringToClipboard: () => copyStringToClipboard,
|
|
@@ -73,12 +73,11 @@ var require_cjs = __commonJS({
|
|
|
73
73
|
toTitleCase: () => toTitleCase,
|
|
74
74
|
toggleFullscreen: () => toggleFullscreen
|
|
75
75
|
});
|
|
76
|
-
module2.exports = __toCommonJS2(
|
|
76
|
+
module2.exports = __toCommonJS2(index_exports);
|
|
77
77
|
var window22 = globalThis;
|
|
78
78
|
var document22 = window22.document;
|
|
79
79
|
var isObject2 = (arg) => {
|
|
80
|
-
if (arg === null)
|
|
81
|
-
return false;
|
|
80
|
+
if (arg === null) return false;
|
|
82
81
|
return typeof arg === "object" && arg.constructor === Object;
|
|
83
82
|
};
|
|
84
83
|
var isString2 = (arg) => typeof arg === "string";
|
|
@@ -103,13 +102,11 @@ var require_cjs = __commonJS({
|
|
|
103
102
|
};
|
|
104
103
|
var findClosestNumberInFactory = (val, factory) => {
|
|
105
104
|
val = parseFloat(val);
|
|
106
|
-
if (isObject2(factory))
|
|
107
|
-
factory = Object.values(factory);
|
|
105
|
+
if (isObject2(factory)) factory = Object.values(factory);
|
|
108
106
|
return findClosestNumber(val, factory);
|
|
109
107
|
};
|
|
110
108
|
var formatDate = (timestamp) => {
|
|
111
|
-
if (!timestamp)
|
|
112
|
-
return "";
|
|
109
|
+
if (!timestamp) return "";
|
|
113
110
|
const d = new Date(timestamp);
|
|
114
111
|
const ye = new Intl.DateTimeFormat("en", { year: "numeric" }).format(d);
|
|
115
112
|
const mo = new Intl.DateTimeFormat("en", { month: "short" }).format(d);
|
|
@@ -176,8 +173,7 @@ var require_cjs = __commonJS({
|
|
|
176
173
|
scriptEle.type = type;
|
|
177
174
|
scriptEle.text = xhr.responseText;
|
|
178
175
|
doc.body.appendChild(scriptEle);
|
|
179
|
-
if (typeof fallback === "function")
|
|
180
|
-
fallback();
|
|
176
|
+
if (typeof fallback === "function") fallback();
|
|
181
177
|
} else {
|
|
182
178
|
throw new Error(`Failed to load the script ${FILE_URL}`);
|
|
183
179
|
}
|
|
@@ -245,20 +241,15 @@ var require_cjs = __commonJS({
|
|
|
245
241
|
);
|
|
246
242
|
var toDashCase2 = (val) => val.replace(/[^a-zA-Z0-9]/g, " ").trim().toLowerCase().replace(/\s+/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "");
|
|
247
243
|
var toDescriptionCase = (str = "") => {
|
|
248
|
-
if (typeof str !== "string")
|
|
249
|
-
return;
|
|
244
|
+
if (typeof str !== "string") return;
|
|
250
245
|
const result = str.replace(/([A-Z])/g, " $1");
|
|
251
246
|
return result.charAt(0).toUpperCase() + result.slice(1);
|
|
252
247
|
};
|
|
253
248
|
var arrayzeValue = (val) => {
|
|
254
|
-
if (isArray2(val))
|
|
255
|
-
|
|
256
|
-
if (
|
|
257
|
-
|
|
258
|
-
if (isObject2(val))
|
|
259
|
-
return Object.values(val);
|
|
260
|
-
if (isNumber2(val))
|
|
261
|
-
return [val];
|
|
249
|
+
if (isArray2(val)) return val;
|
|
250
|
+
if (isString2(val)) return val.split(" ");
|
|
251
|
+
if (isObject2(val)) return Object.values(val);
|
|
252
|
+
if (isNumber2(val)) return [val];
|
|
262
253
|
};
|
|
263
254
|
}
|
|
264
255
|
});
|
|
@@ -270,6 +261,11 @@ __export(reset_exports, {
|
|
|
270
261
|
});
|
|
271
262
|
module.exports = __toCommonJS(reset_exports);
|
|
272
263
|
|
|
264
|
+
// ../../../domql/packages/utils/dist/esm/env.js
|
|
265
|
+
var NODE_ENV = "development";
|
|
266
|
+
var isProduction = (env = NODE_ENV) => env === "production";
|
|
267
|
+
var isNotProduction = (env = NODE_ENV) => !isProduction(env);
|
|
268
|
+
|
|
273
269
|
// ../../../domql/packages/utils/dist/esm/globals.js
|
|
274
270
|
var window2 = globalThis;
|
|
275
271
|
var document2 = window2.document;
|
|
@@ -285,8 +281,7 @@ var isFunction = (arg) => typeof arg === "function";
|
|
|
285
281
|
var isNull = (arg) => arg === null;
|
|
286
282
|
var isArray = (arg) => Array.isArray(arg);
|
|
287
283
|
var isObjectLike = (arg) => {
|
|
288
|
-
if (arg === null)
|
|
289
|
-
return false;
|
|
284
|
+
if (arg === null) return false;
|
|
290
285
|
return typeof arg === "object";
|
|
291
286
|
};
|
|
292
287
|
var isUndefined = (arg) => {
|
|
@@ -367,8 +362,7 @@ var deepClone = (obj, options = {}) => {
|
|
|
367
362
|
const clone2 = targetWindow ? isArray(obj) ? new targetWindow.Array() : new targetWindow.Object() : isArray(obj) ? [] : {};
|
|
368
363
|
visited.set(obj, clone2);
|
|
369
364
|
for (const key in obj) {
|
|
370
|
-
if (!Object.prototype.hasOwnProperty.call(obj, key))
|
|
371
|
-
continue;
|
|
365
|
+
if (!Object.prototype.hasOwnProperty.call(obj, key)) continue;
|
|
372
366
|
if (exclude.includes(key) || key.startsWith("__") || key === "__proto__")
|
|
373
367
|
continue;
|
|
374
368
|
const value = obj[key];
|
|
@@ -402,14 +396,11 @@ var overwriteDeep = (obj, params, opts = {}, visited = /* @__PURE__ */ new WeakM
|
|
|
402
396
|
if (!isObjectLike(obj) || !isObjectLike(params) || isDOMNode(obj) || isDOMNode(params)) {
|
|
403
397
|
return params;
|
|
404
398
|
}
|
|
405
|
-
if (visited.has(obj))
|
|
406
|
-
return visited.get(obj);
|
|
399
|
+
if (visited.has(obj)) return visited.get(obj);
|
|
407
400
|
visited.set(obj, obj);
|
|
408
401
|
for (const e in params) {
|
|
409
|
-
if (!Object.hasOwnProperty.call(params, e))
|
|
410
|
-
|
|
411
|
-
if (excl.includes(e) || forcedExclude && e.startsWith("__"))
|
|
412
|
-
continue;
|
|
402
|
+
if (!Object.hasOwnProperty.call(params, e)) continue;
|
|
403
|
+
if (excl.includes(e) || forcedExclude && e.startsWith("__")) continue;
|
|
413
404
|
const objProp = obj[e];
|
|
414
405
|
const paramsProp = params[e];
|
|
415
406
|
if (isDOMNode(paramsProp)) {
|
|
@@ -650,6 +641,9 @@ var getActiveConfig = (def) => {
|
|
|
650
641
|
// src/utils/sequence.js
|
|
651
642
|
var import_utils4 = __toESM(require_cjs(), 1);
|
|
652
643
|
|
|
644
|
+
// src/utils/sprite.js
|
|
645
|
+
var isDev = isNotProduction();
|
|
646
|
+
|
|
653
647
|
// src/system/theme.js
|
|
654
648
|
var recursiveTheme = (val) => {
|
|
655
649
|
const CONFIG2 = getActiveConfig();
|
|
@@ -664,24 +658,19 @@ var recursiveTheme = (val) => {
|
|
|
664
658
|
} else if (symb === ":") {
|
|
665
659
|
obj[`&${param}`] = recursiveTheme(val[param]);
|
|
666
660
|
}
|
|
667
|
-
} else
|
|
668
|
-
obj[param] = val[param];
|
|
661
|
+
} else obj[param] = val[param];
|
|
669
662
|
}
|
|
670
663
|
return obj;
|
|
671
664
|
};
|
|
672
665
|
var findModifierFromArray = (val, modifierArray) => {
|
|
673
666
|
const currentMod = modifierArray.shift();
|
|
674
|
-
if (val[currentMod])
|
|
675
|
-
return findModifierFromArray(val[currentMod], modifierArray);
|
|
667
|
+
if (val[currentMod]) return findModifierFromArray(val[currentMod], modifierArray);
|
|
676
668
|
return val;
|
|
677
669
|
};
|
|
678
670
|
var findModifier = (val, modifier) => {
|
|
679
|
-
if (isArray(modifier))
|
|
680
|
-
|
|
681
|
-
else
|
|
682
|
-
return val[modifier];
|
|
683
|
-
else
|
|
684
|
-
return val;
|
|
671
|
+
if (isArray(modifier)) return findModifierFromArray(val, modifier);
|
|
672
|
+
else if (isString(modifier) && val[modifier]) return val[modifier];
|
|
673
|
+
else return val;
|
|
685
674
|
};
|
|
686
675
|
var getMediaTheme = (value, modifier) => {
|
|
687
676
|
const activeConfig = getActiveConfig();
|
|
@@ -724,8 +713,7 @@ var applyReset = (reset = {}) => {
|
|
|
724
713
|
}
|
|
725
714
|
const { body, ...templates } = TYPOGRAPHY2.templates;
|
|
726
715
|
const globalTheme = CONFIG2.useDocumentTheme ? getMediaTheme("document", `@${CONFIG2.globalTheme}`) : {};
|
|
727
|
-
if (RESET2.html)
|
|
728
|
-
overwriteDeep(RESET2.html, globalTheme);
|
|
716
|
+
if (RESET2.html) overwriteDeep(RESET2.html, globalTheme);
|
|
729
717
|
return deepMerge(merge(RESET2, reset), {
|
|
730
718
|
html: {
|
|
731
719
|
position: "absolute",
|
|
@@ -763,3 +751,4 @@ var applyReset = (reset = {}) => {
|
|
|
763
751
|
});
|
|
764
752
|
}
|
|
765
753
|
};
|
|
754
|
+
// @preserve-env
|
|
@@ -51,8 +51,8 @@ var require_cjs = __commonJS({
|
|
|
51
51
|
return to;
|
|
52
52
|
};
|
|
53
53
|
var __toCommonJS2 = (mod) => __copyProps2(__defProp3({}, "__esModule", { value: true }), mod);
|
|
54
|
-
var
|
|
55
|
-
__export2(
|
|
54
|
+
var index_exports = {};
|
|
55
|
+
__export2(index_exports, {
|
|
56
56
|
arrayzeValue: () => arrayzeValue2,
|
|
57
57
|
copyJavaScriptToClipboard: () => copyJavaScriptToClipboard,
|
|
58
58
|
copyStringToClipboard: () => copyStringToClipboard,
|
|
@@ -73,12 +73,11 @@ var require_cjs = __commonJS({
|
|
|
73
73
|
toTitleCase: () => toTitleCase,
|
|
74
74
|
toggleFullscreen: () => toggleFullscreen
|
|
75
75
|
});
|
|
76
|
-
module2.exports = __toCommonJS2(
|
|
76
|
+
module2.exports = __toCommonJS2(index_exports);
|
|
77
77
|
var window22 = globalThis;
|
|
78
78
|
var document22 = window22.document;
|
|
79
79
|
var isObject2 = (arg) => {
|
|
80
|
-
if (arg === null)
|
|
81
|
-
return false;
|
|
80
|
+
if (arg === null) return false;
|
|
82
81
|
return typeof arg === "object" && arg.constructor === Object;
|
|
83
82
|
};
|
|
84
83
|
var isString2 = (arg) => typeof arg === "string";
|
|
@@ -103,13 +102,11 @@ var require_cjs = __commonJS({
|
|
|
103
102
|
};
|
|
104
103
|
var findClosestNumberInFactory = (val, factory) => {
|
|
105
104
|
val = parseFloat(val);
|
|
106
|
-
if (isObject2(factory))
|
|
107
|
-
factory = Object.values(factory);
|
|
105
|
+
if (isObject2(factory)) factory = Object.values(factory);
|
|
108
106
|
return findClosestNumber(val, factory);
|
|
109
107
|
};
|
|
110
108
|
var formatDate = (timestamp) => {
|
|
111
|
-
if (!timestamp)
|
|
112
|
-
return "";
|
|
109
|
+
if (!timestamp) return "";
|
|
113
110
|
const d = new Date(timestamp);
|
|
114
111
|
const ye = new Intl.DateTimeFormat("en", { year: "numeric" }).format(d);
|
|
115
112
|
const mo = new Intl.DateTimeFormat("en", { month: "short" }).format(d);
|
|
@@ -176,8 +173,7 @@ var require_cjs = __commonJS({
|
|
|
176
173
|
scriptEle.type = type;
|
|
177
174
|
scriptEle.text = xhr.responseText;
|
|
178
175
|
doc.body.appendChild(scriptEle);
|
|
179
|
-
if (typeof fallback === "function")
|
|
180
|
-
fallback();
|
|
176
|
+
if (typeof fallback === "function") fallback();
|
|
181
177
|
} else {
|
|
182
178
|
throw new Error(`Failed to load the script ${FILE_URL}`);
|
|
183
179
|
}
|
|
@@ -245,20 +241,15 @@ var require_cjs = __commonJS({
|
|
|
245
241
|
);
|
|
246
242
|
var toDashCase2 = (val) => val.replace(/[^a-zA-Z0-9]/g, " ").trim().toLowerCase().replace(/\s+/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "");
|
|
247
243
|
var toDescriptionCase = (str = "") => {
|
|
248
|
-
if (typeof str !== "string")
|
|
249
|
-
return;
|
|
244
|
+
if (typeof str !== "string") return;
|
|
250
245
|
const result = str.replace(/([A-Z])/g, " $1");
|
|
251
246
|
return result.charAt(0).toUpperCase() + result.slice(1);
|
|
252
247
|
};
|
|
253
248
|
var arrayzeValue2 = (val) => {
|
|
254
|
-
if (isArray2(val))
|
|
255
|
-
|
|
256
|
-
if (
|
|
257
|
-
|
|
258
|
-
if (isObject2(val))
|
|
259
|
-
return Object.values(val);
|
|
260
|
-
if (isNumber2(val))
|
|
261
|
-
return [val];
|
|
249
|
+
if (isArray2(val)) return val;
|
|
250
|
+
if (isString2(val)) return val.split(" ");
|
|
251
|
+
if (isObject2(val)) return Object.values(val);
|
|
252
|
+
if (isNumber2(val)) return [val];
|
|
262
253
|
};
|
|
263
254
|
}
|
|
264
255
|
});
|
|
@@ -271,6 +262,11 @@ __export(shadow_exports, {
|
|
|
271
262
|
});
|
|
272
263
|
module.exports = __toCommonJS(shadow_exports);
|
|
273
264
|
|
|
265
|
+
// ../../../domql/packages/utils/dist/esm/env.js
|
|
266
|
+
var NODE_ENV = "development";
|
|
267
|
+
var isProduction = (env = NODE_ENV) => env === "production";
|
|
268
|
+
var isNotProduction = (env = NODE_ENV) => !isProduction(env);
|
|
269
|
+
|
|
274
270
|
// ../../../domql/packages/utils/dist/esm/globals.js
|
|
275
271
|
var window2 = globalThis;
|
|
276
272
|
var document2 = window2.document;
|
|
@@ -282,8 +278,7 @@ var isDOMNode = (obj) => {
|
|
|
282
278
|
|
|
283
279
|
// ../../../domql/packages/utils/dist/esm/types.js
|
|
284
280
|
var isObject = (arg) => {
|
|
285
|
-
if (arg === null)
|
|
286
|
-
return false;
|
|
281
|
+
if (arg === null) return false;
|
|
287
282
|
return typeof arg === "object" && arg.constructor === Object;
|
|
288
283
|
};
|
|
289
284
|
var isString = (arg) => typeof arg === "string";
|
|
@@ -292,8 +287,7 @@ var isFunction = (arg) => typeof arg === "function";
|
|
|
292
287
|
var isNull = (arg) => arg === null;
|
|
293
288
|
var isArray = (arg) => Array.isArray(arg);
|
|
294
289
|
var isObjectLike = (arg) => {
|
|
295
|
-
if (arg === null)
|
|
296
|
-
return false;
|
|
290
|
+
if (arg === null) return false;
|
|
297
291
|
return typeof arg === "object";
|
|
298
292
|
};
|
|
299
293
|
var isUndefined = (arg) => {
|
|
@@ -361,8 +355,7 @@ var deepClone = (obj, options = {}) => {
|
|
|
361
355
|
const clone2 = targetWindow ? isArray(obj) ? new targetWindow.Array() : new targetWindow.Object() : isArray(obj) ? [] : {};
|
|
362
356
|
visited.set(obj, clone2);
|
|
363
357
|
for (const key in obj) {
|
|
364
|
-
if (!Object.prototype.hasOwnProperty.call(obj, key))
|
|
365
|
-
continue;
|
|
358
|
+
if (!Object.prototype.hasOwnProperty.call(obj, key)) continue;
|
|
366
359
|
if (exclude.includes(key) || key.startsWith("__") || key === "__proto__")
|
|
367
360
|
continue;
|
|
368
361
|
const value = obj[key];
|
|
@@ -622,10 +615,8 @@ var isScalingUnit = (unit) => {
|
|
|
622
615
|
|
|
623
616
|
// src/utils/color.js
|
|
624
617
|
var colorStringToRgbaArray = (color) => {
|
|
625
|
-
if (color === "")
|
|
626
|
-
|
|
627
|
-
if (color.toLowerCase() === "transparent")
|
|
628
|
-
return [0, 0, 0, 0];
|
|
618
|
+
if (color === "") return [0, 0, 0, 0];
|
|
619
|
+
if (color.toLowerCase() === "transparent") return [0, 0, 0, 0];
|
|
629
620
|
if (color[0] === "#") {
|
|
630
621
|
if (color.length < 7) {
|
|
631
622
|
color = "#" + color[1] + color[1] + color[2] + color[2] + color[3] + color[3] + (color.length > 4 ? color[4] + color[4] : "");
|
|
@@ -656,8 +647,7 @@ var colorStringToRgbaArray = (color) => {
|
|
|
656
647
|
}
|
|
657
648
|
}
|
|
658
649
|
if (color.indexOf("rgb") === 0) {
|
|
659
|
-
if (color.indexOf("rgba") === -1)
|
|
660
|
-
color = `${color}, 1`;
|
|
650
|
+
if (color.indexOf("rgba") === -1) color = `${color}, 1`;
|
|
661
651
|
return color.match(/[\.\d]+/g).map((a) => +a);
|
|
662
652
|
}
|
|
663
653
|
return [0, 0, 0, 0];
|
|
@@ -676,36 +666,25 @@ var rgbToHSL = (r, g, b) => {
|
|
|
676
666
|
const h = n && (a == r ? (g - b) / n : a == g ? 2 + (b - r) / n : 4 + (r - g) / n);
|
|
677
667
|
return [60 * (h < 0 ? h + 6 : h), f ? n / f : 0, (a + a - n) / 2];
|
|
678
668
|
};
|
|
679
|
-
var hslToRgb = (h, s, l, a = s * Math.min(l, 1 - l), f = (n, k = (n + h / 30) % 12) => l - a * Math.max(
|
|
680
|
-
Math.min(k - 3, 9 - k, 1),
|
|
681
|
-
-1
|
|
682
|
-
)) => [f(0), f(8), f(4)];
|
|
669
|
+
var hslToRgb = (h, s, l, a = s * Math.min(l, 1 - l), f = (n, k = (n + h / 30) % 12) => l - a * Math.max(Math.min(k - 3, 9 - k, 1), -1)) => [f(0), f(8), f(4)];
|
|
683
670
|
var getColorShade = (col, amt) => {
|
|
684
671
|
const num = parseInt(col, 16);
|
|
685
672
|
let r = (num >> 16) + amt;
|
|
686
|
-
if (r > 255)
|
|
687
|
-
|
|
688
|
-
else if (r < 0)
|
|
689
|
-
r = 0;
|
|
673
|
+
if (r > 255) r = 255;
|
|
674
|
+
else if (r < 0) r = 0;
|
|
690
675
|
let b = (num >> 8 & 255) + amt;
|
|
691
|
-
if (b > 255)
|
|
692
|
-
|
|
693
|
-
else if (b < 0)
|
|
694
|
-
b = 0;
|
|
676
|
+
if (b > 255) b = 255;
|
|
677
|
+
else if (b < 0) b = 0;
|
|
695
678
|
let g = (num & 255) + amt;
|
|
696
|
-
if (g > 255)
|
|
697
|
-
|
|
698
|
-
else if (g < 0)
|
|
699
|
-
g = 0;
|
|
679
|
+
if (g > 255) g = 255;
|
|
680
|
+
else if (g < 0) g = 0;
|
|
700
681
|
return ((g | b << 8 | r << 16) + 16777216).toString(16).slice(1);
|
|
701
682
|
};
|
|
702
683
|
var getRgbTone = (rgb, tone) => {
|
|
703
684
|
if (isString(rgb) && rgb.includes("rgb"))
|
|
704
685
|
rgb = colorStringToRgbaArray(rgb).join(", ");
|
|
705
|
-
if (isString(rgb))
|
|
706
|
-
|
|
707
|
-
if (isNumber(tone))
|
|
708
|
-
tone += "";
|
|
686
|
+
if (isString(rgb)) rgb = rgb.split(",").map((v) => parseFloat(v.trim()));
|
|
687
|
+
if (isNumber(tone)) tone += "";
|
|
709
688
|
const toHex = rgbArrayToHex(rgb);
|
|
710
689
|
const abs = tone.slice(0, 1);
|
|
711
690
|
if (abs === "-" || abs === "+") {
|
|
@@ -767,8 +746,7 @@ var setSequenceValue = (props, sequenceProps) => {
|
|
|
767
746
|
var setScalingVar = (key, sequenceProps) => {
|
|
768
747
|
const { base, type, unit } = sequenceProps;
|
|
769
748
|
const defaultVal = (isScalingUnit(unit) ? 1 : base) + unit;
|
|
770
|
-
if (key === 0)
|
|
771
|
-
return defaultVal;
|
|
749
|
+
if (key === 0) return defaultVal;
|
|
772
750
|
const prefix = "--" + (type && type.replace(".", "-"));
|
|
773
751
|
const ratioVar = `${prefix}-ratio`;
|
|
774
752
|
if (key > 0) {
|
|
@@ -802,10 +780,8 @@ var generateSubSequence = (props, sequenceProps) => {
|
|
|
802
780
|
const diffRounded = ~~next - ~~value;
|
|
803
781
|
let arr;
|
|
804
782
|
const [first, middle, second] = getSubratioDifference(value, ratio);
|
|
805
|
-
if (diffRounded > 16)
|
|
806
|
-
|
|
807
|
-
else
|
|
808
|
-
arr = [first, second];
|
|
783
|
+
if (diffRounded > 16) arr = [first, middle, second];
|
|
784
|
+
else arr = [first, second];
|
|
809
785
|
arr.forEach((v, k) => {
|
|
810
786
|
const scaling = ~~(v / base * 1e3) / 1e3;
|
|
811
787
|
const newVar = variable + (k + 1);
|
|
@@ -847,8 +823,7 @@ var generateSequence = (sequenceProps) => {
|
|
|
847
823
|
index: key
|
|
848
824
|
};
|
|
849
825
|
setSequenceValue(props, sequenceProps);
|
|
850
|
-
if (subSequence)
|
|
851
|
-
generateSubSequence(props, sequenceProps);
|
|
826
|
+
if (subSequence) generateSubSequence(props, sequenceProps);
|
|
852
827
|
}
|
|
853
828
|
return sequenceProps;
|
|
854
829
|
};
|
|
@@ -860,13 +835,11 @@ var getSequenceValue = (value = "A", sequenceProps) => {
|
|
|
860
835
|
unit = UNIT2.default,
|
|
861
836
|
useVariable
|
|
862
837
|
} = sequenceProps;
|
|
863
|
-
if (isString(value) && value.slice(0, 2) === "--")
|
|
864
|
-
return `var(${value})`;
|
|
838
|
+
if (isString(value) && value.slice(0, 2) === "--") return `var(${value})`;
|
|
865
839
|
const prefix = `--${(0, import_utils4.toDashCase)(sequenceProps.type.replace(".", "-"))}-`;
|
|
866
840
|
const startsWithDashOrLetterRegex = /^-?[a-zA-Z]/i;
|
|
867
841
|
const startsWithDashOrLetter = startsWithDashOrLetterRegex.test(value);
|
|
868
|
-
if (value === "none" || value === "auto" || value === "unset" || value === "inherit" || value === "fit-content" || value === "min-content" || value === "max-content" || value.includes("calc") || value.includes("var") || !startsWithDashOrLetter)
|
|
869
|
-
return value;
|
|
842
|
+
if (value === "none" || value === "auto" || value === "unset" || value === "inherit" || value === "fit-content" || value === "min-content" || value === "max-content" || value.includes("calc") || value.includes("var") || !startsWithDashOrLetter) return value;
|
|
870
843
|
const letterVal = value.toUpperCase();
|
|
871
844
|
const isNegative = letterVal.slice(0, 1) === "-" ? "-" : "";
|
|
872
845
|
let absValue = isNegative ? letterVal.slice(1) : letterVal;
|
|
@@ -890,8 +863,7 @@ var getSequenceValue = (value = "A", sequenceProps) => {
|
|
|
890
863
|
return isNegative ? `calc((${joint}) * -1)` : `calc(${joint})`;
|
|
891
864
|
}
|
|
892
865
|
if (!sequence[absValue] && absValue.length === 2) {
|
|
893
|
-
if (CONFIG2.verbose)
|
|
894
|
-
console.warn(absValue, "- value is not found because `subSequence` is set to false");
|
|
866
|
+
if (CONFIG2.verbose) console.warn(absValue, "- value is not found because `subSequence` is set to false");
|
|
895
867
|
absValue = absValue.slice(0, 1);
|
|
896
868
|
}
|
|
897
869
|
if (useVariable || CONFIG2.useVariable) {
|
|
@@ -899,8 +871,7 @@ var getSequenceValue = (value = "A", sequenceProps) => {
|
|
|
899
871
|
return isNegative ? `calc(${varValue2} * -1)` : varValue2;
|
|
900
872
|
}
|
|
901
873
|
const sequenceItem = sequence ? sequence[absValue] : null;
|
|
902
|
-
if (!sequenceItem)
|
|
903
|
-
return console.warn("can't find", sequence, absValue);
|
|
874
|
+
if (!sequenceItem) return console.warn("can't find", sequence, absValue);
|
|
904
875
|
if (unit === "ms" || unit === "s") {
|
|
905
876
|
return isNegative + sequenceItem.val + unit;
|
|
906
877
|
}
|
|
@@ -909,40 +880,35 @@ var getSequenceValue = (value = "A", sequenceProps) => {
|
|
|
909
880
|
var getSequenceValuePropertyPair = (value, propertyName, sequenceProps) => {
|
|
910
881
|
if (typeof value !== "string") {
|
|
911
882
|
const CONFIG2 = getActiveConfig();
|
|
912
|
-
if (CONFIG2.verbose)
|
|
913
|
-
console.warn(propertyName, value, "is not a string");
|
|
883
|
+
if (CONFIG2.verbose) console.warn(propertyName, value, "is not a string");
|
|
914
884
|
return { [propertyName]: value };
|
|
915
885
|
}
|
|
916
|
-
if (value === "-" || value === "")
|
|
917
|
-
return {};
|
|
886
|
+
if (value === "-" || value === "") return {};
|
|
918
887
|
return { [propertyName]: getSequenceValue(value, sequenceProps) };
|
|
919
888
|
};
|
|
920
889
|
|
|
890
|
+
// src/utils/sprite.js
|
|
891
|
+
var isDev = isNotProduction();
|
|
892
|
+
|
|
921
893
|
// src/system/color.js
|
|
922
894
|
var getColor = (value, key, config) => {
|
|
923
895
|
const CONFIG2 = config || getActiveConfig();
|
|
924
896
|
if (!isString(value)) {
|
|
925
|
-
if (CONFIG2.verbose)
|
|
926
|
-
console.warn(value, "- type for color is not valid");
|
|
897
|
+
if (CONFIG2.verbose) console.warn(value, "- type for color is not valid");
|
|
927
898
|
return;
|
|
928
899
|
}
|
|
929
|
-
if (value.slice(0, 2) === "--")
|
|
930
|
-
|
|
931
|
-
if (key && value[key])
|
|
932
|
-
value = value[key];
|
|
900
|
+
if (value.slice(0, 2) === "--") return `var(${value})`;
|
|
901
|
+
if (key && value[key]) value = value[key];
|
|
933
902
|
const [name, alpha, tone] = isArray(value) ? value : value.split(" ");
|
|
934
903
|
const { COLOR: COLOR2, GRADIENT: GRADIENT2 } = CONFIG2;
|
|
935
904
|
let val = COLOR2[name] || GRADIENT2[name];
|
|
936
905
|
if (!val) {
|
|
937
|
-
if (CONFIG2.verbose)
|
|
938
|
-
console.warn("Can't find color ", name);
|
|
906
|
+
if (CONFIG2.verbose) console.warn("Can't find color ", name);
|
|
939
907
|
return value;
|
|
940
908
|
}
|
|
941
909
|
if (key) {
|
|
942
|
-
if (val[key])
|
|
943
|
-
|
|
944
|
-
else if (CONFIG2.verbose)
|
|
945
|
-
console.warn(value, " - does not have ", key);
|
|
910
|
+
if (val[key]) val = val[key];
|
|
911
|
+
else if (CONFIG2.verbose) console.warn(value, " - does not have ", key);
|
|
946
912
|
}
|
|
947
913
|
let rgb = val.rgb;
|
|
948
914
|
if (!rgb) {
|
|
@@ -952,10 +918,8 @@ var getColor = (value, key, config) => {
|
|
|
952
918
|
rgb = getRgbTone(rgb, tone);
|
|
953
919
|
val[tone] = { rgb, var: `${val.var}-${tone}` };
|
|
954
920
|
}
|
|
955
|
-
if (val[tone])
|
|
956
|
-
|
|
957
|
-
if (alpha)
|
|
958
|
-
return `rgba(${rgb}, ${alpha})`;
|
|
921
|
+
if (val[tone]) rgb = val[tone].rgb;
|
|
922
|
+
if (alpha) return `rgba(${rgb}, ${alpha})`;
|
|
959
923
|
return CONFIG2.useVariable ? `var(${val.var})` : `rgb(${rgb})`;
|
|
960
924
|
};
|
|
961
925
|
|
|
@@ -964,8 +928,7 @@ var import_utils9 = __toESM(require_cjs(), 1);
|
|
|
964
928
|
var getSequence = (sequenceProps) => {
|
|
965
929
|
const CONFIG2 = getActiveConfig();
|
|
966
930
|
const { SPACING: SPACING2 } = CONFIG2;
|
|
967
|
-
if (!sequenceProps)
|
|
968
|
-
return SPACING2;
|
|
931
|
+
if (!sequenceProps) return SPACING2;
|
|
969
932
|
const hasGenerated = Object.keys(sequenceProps.sequence).length > 0;
|
|
970
933
|
return hasGenerated ? sequenceProps : generateSequence(sequenceProps);
|
|
971
934
|
};
|
|
@@ -975,8 +938,7 @@ var getSpacingByKey = (value, propertyName = "padding", sequenceProps) => {
|
|
|
975
938
|
return { [propertyName]: value };
|
|
976
939
|
}
|
|
977
940
|
const stack = (0, import_utils9.arrayzeValue)(value);
|
|
978
|
-
if (!isArray(stack))
|
|
979
|
-
return;
|
|
941
|
+
if (!isArray(stack)) return;
|
|
980
942
|
if (stack.length > 1) {
|
|
981
943
|
let suffix = "";
|
|
982
944
|
if (propertyName === "borderWidth") {
|
|
@@ -1025,15 +987,11 @@ var setShadow = (value, key, suffix, prefers) => {
|
|
|
1025
987
|
if (isString(value) && value.includes(",")) {
|
|
1026
988
|
value = value.split(",").map((v) => {
|
|
1027
989
|
v = v.trim();
|
|
1028
|
-
if (v.startsWith("--"))
|
|
1029
|
-
|
|
1030
|
-
if (
|
|
1031
|
-
return getColor(v);
|
|
1032
|
-
if (v.includes("px") || v.slice(-2) === "em")
|
|
1033
|
-
return v;
|
|
990
|
+
if (v.startsWith("--")) return `var(${v})`;
|
|
991
|
+
if (getColor(v).length > 2) return getColor(v);
|
|
992
|
+
if (v.includes("px") || v.slice(-2) === "em") return v;
|
|
1034
993
|
const arr = v.split(" ");
|
|
1035
|
-
if (!arr.length)
|
|
1036
|
-
return v;
|
|
994
|
+
if (!arr.length) return v;
|
|
1037
995
|
return arr.map((v2) => getSpacingByKey(v2, "shadow").shadow).join(" ");
|
|
1038
996
|
}).join(" ");
|
|
1039
997
|
}
|
|
@@ -1048,32 +1006,25 @@ var setShadow = (value, key, suffix, prefers) => {
|
|
|
1048
1006
|
};
|
|
1049
1007
|
var getShadow = (value, globalTheme) => {
|
|
1050
1008
|
const CONFIG2 = getActiveConfig();
|
|
1051
|
-
if (!globalTheme)
|
|
1052
|
-
globalTheme = CONFIG2.globalTheme;
|
|
1009
|
+
if (!globalTheme) globalTheme = CONFIG2.globalTheme;
|
|
1053
1010
|
if (!isString(value)) {
|
|
1054
|
-
if (CONFIG2.verbose)
|
|
1055
|
-
console.warn(value, "- type for color is not valid");
|
|
1011
|
+
if (CONFIG2.verbose) console.warn(value, "- type for color is not valid");
|
|
1056
1012
|
return;
|
|
1057
1013
|
}
|
|
1058
|
-
if (value.slice(0, 2) === "--")
|
|
1059
|
-
return `var(${value})`;
|
|
1014
|
+
if (value.slice(0, 2) === "--") return `var(${value})`;
|
|
1060
1015
|
const [name] = isArray(value) ? value : value.split(" ");
|
|
1061
1016
|
const { SHADOW: SHADOW2 } = CONFIG2;
|
|
1062
1017
|
const val = SHADOW2[name];
|
|
1063
1018
|
const isObj = isObject(val);
|
|
1064
1019
|
if (!val) {
|
|
1065
|
-
if (CONFIG2.verbose)
|
|
1066
|
-
console.warn("Can't find color ", name);
|
|
1020
|
+
if (CONFIG2.verbose) console.warn("Can't find color ", name);
|
|
1067
1021
|
return value;
|
|
1068
1022
|
}
|
|
1069
1023
|
if (globalTheme) {
|
|
1070
|
-
if (val[globalTheme])
|
|
1071
|
-
|
|
1072
|
-
else if (CONFIG2.verbose)
|
|
1073
|
-
console.warn(value, " - does not have ", globalTheme);
|
|
1024
|
+
if (val[globalTheme]) return val[globalTheme].value;
|
|
1025
|
+
else if (CONFIG2.verbose) console.warn(value, " - does not have ", globalTheme);
|
|
1074
1026
|
}
|
|
1075
|
-
if (isObj && val.value)
|
|
1076
|
-
return val.value;
|
|
1027
|
+
if (isObj && val.value) return val.value;
|
|
1077
1028
|
if (isObj) {
|
|
1078
1029
|
const obj = {};
|
|
1079
1030
|
for (const mediaName in val) {
|
|
@@ -1083,7 +1034,7 @@ var getShadow = (value, globalTheme) => {
|
|
|
1083
1034
|
}
|
|
1084
1035
|
return obj;
|
|
1085
1036
|
}
|
|
1086
|
-
if (CONFIG2.verbose)
|
|
1087
|
-
console.warn("Can't find color", value);
|
|
1037
|
+
if (CONFIG2.verbose) console.warn("Can't find color", value);
|
|
1088
1038
|
return value;
|
|
1089
1039
|
};
|
|
1040
|
+
// @preserve-env
|