@symbo.ls/scratch 2.27.0 → 2.27.11
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 -345
- package/dist/cjs/set.js +126 -240
- package/dist/cjs/system/color.js +54 -87
- package/dist/cjs/system/document.js +26 -29
- package/dist/cjs/system/font.js +30 -37
- package/dist/cjs/system/index.js +126 -243
- package/dist/cjs/system/reset.js +33 -43
- package/dist/cjs/system/shadow.js +69 -117
- package/dist/cjs/system/spacing.js +41 -59
- package/dist/cjs/system/svg.js +31 -41
- package/dist/cjs/system/theme.js +67 -113
- package/dist/cjs/system/timing.js +34 -45
- package/dist/cjs/system/typography.js +43 -73
- package/dist/cjs/transforms/index.js +92 -163
- package/dist/cjs/utils/color.js +21 -35
- package/dist/cjs/utils/font.js +3 -6
- package/dist/cjs/utils/index.js +62 -108
- package/dist/cjs/utils/sequence.js +25 -45
- package/dist/cjs/utils/sprite.js +15 -12
- 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 -30
- package/src/utils/sprite.js +12 -7
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,10 @@ 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 ENV = "development";
|
|
646
|
+
var isDev = isNotProduction(ENV);
|
|
647
|
+
|
|
653
648
|
// src/system/theme.js
|
|
654
649
|
var recursiveTheme = (val) => {
|
|
655
650
|
const CONFIG2 = getActiveConfig();
|
|
@@ -664,24 +659,19 @@ var recursiveTheme = (val) => {
|
|
|
664
659
|
} else if (symb === ":") {
|
|
665
660
|
obj[`&${param}`] = recursiveTheme(val[param]);
|
|
666
661
|
}
|
|
667
|
-
} else
|
|
668
|
-
obj[param] = val[param];
|
|
662
|
+
} else obj[param] = val[param];
|
|
669
663
|
}
|
|
670
664
|
return obj;
|
|
671
665
|
};
|
|
672
666
|
var findModifierFromArray = (val, modifierArray) => {
|
|
673
667
|
const currentMod = modifierArray.shift();
|
|
674
|
-
if (val[currentMod])
|
|
675
|
-
return findModifierFromArray(val[currentMod], modifierArray);
|
|
668
|
+
if (val[currentMod]) return findModifierFromArray(val[currentMod], modifierArray);
|
|
676
669
|
return val;
|
|
677
670
|
};
|
|
678
671
|
var findModifier = (val, modifier) => {
|
|
679
|
-
if (isArray(modifier))
|
|
680
|
-
|
|
681
|
-
else
|
|
682
|
-
return val[modifier];
|
|
683
|
-
else
|
|
684
|
-
return val;
|
|
672
|
+
if (isArray(modifier)) return findModifierFromArray(val, modifier);
|
|
673
|
+
else if (isString(modifier) && val[modifier]) return val[modifier];
|
|
674
|
+
else return val;
|
|
685
675
|
};
|
|
686
676
|
var getMediaTheme = (value, modifier) => {
|
|
687
677
|
const activeConfig = getActiveConfig();
|
|
@@ -724,8 +714,7 @@ var applyReset = (reset = {}) => {
|
|
|
724
714
|
}
|
|
725
715
|
const { body, ...templates } = TYPOGRAPHY2.templates;
|
|
726
716
|
const globalTheme = CONFIG2.useDocumentTheme ? getMediaTheme("document", `@${CONFIG2.globalTheme}`) : {};
|
|
727
|
-
if (RESET2.html)
|
|
728
|
-
overwriteDeep(RESET2.html, globalTheme);
|
|
717
|
+
if (RESET2.html) overwriteDeep(RESET2.html, globalTheme);
|
|
729
718
|
return deepMerge(merge(RESET2, reset), {
|
|
730
719
|
html: {
|
|
731
720
|
position: "absolute",
|
|
@@ -763,3 +752,4 @@ var applyReset = (reset = {}) => {
|
|
|
763
752
|
});
|
|
764
753
|
}
|
|
765
754
|
};
|
|
755
|
+
// @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,36 @@ 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 ENV = "development";
|
|
892
|
+
var isDev = isNotProduction(ENV);
|
|
893
|
+
|
|
921
894
|
// src/system/color.js
|
|
922
895
|
var getColor = (value, key, config) => {
|
|
923
896
|
const CONFIG2 = config || getActiveConfig();
|
|
924
897
|
if (!isString(value)) {
|
|
925
|
-
if (CONFIG2.verbose)
|
|
926
|
-
console.warn(value, "- type for color is not valid");
|
|
898
|
+
if (CONFIG2.verbose) console.warn(value, "- type for color is not valid");
|
|
927
899
|
return;
|
|
928
900
|
}
|
|
929
|
-
if (value.slice(0, 2) === "--")
|
|
930
|
-
|
|
931
|
-
if (key && value[key])
|
|
932
|
-
value = value[key];
|
|
901
|
+
if (value.slice(0, 2) === "--") return `var(${value})`;
|
|
902
|
+
if (key && value[key]) value = value[key];
|
|
933
903
|
const [name, alpha, tone] = isArray(value) ? value : value.split(" ");
|
|
934
904
|
const { COLOR: COLOR2, GRADIENT: GRADIENT2 } = CONFIG2;
|
|
935
905
|
let val = COLOR2[name] || GRADIENT2[name];
|
|
936
906
|
if (!val) {
|
|
937
|
-
if (CONFIG2.verbose)
|
|
938
|
-
console.warn("Can't find color ", name);
|
|
907
|
+
if (CONFIG2.verbose) console.warn("Can't find color ", name);
|
|
939
908
|
return value;
|
|
940
909
|
}
|
|
941
910
|
if (key) {
|
|
942
|
-
if (val[key])
|
|
943
|
-
|
|
944
|
-
else if (CONFIG2.verbose)
|
|
945
|
-
console.warn(value, " - does not have ", key);
|
|
911
|
+
if (val[key]) val = val[key];
|
|
912
|
+
else if (CONFIG2.verbose) console.warn(value, " - does not have ", key);
|
|
946
913
|
}
|
|
947
914
|
let rgb = val.rgb;
|
|
948
915
|
if (!rgb) {
|
|
@@ -952,10 +919,8 @@ var getColor = (value, key, config) => {
|
|
|
952
919
|
rgb = getRgbTone(rgb, tone);
|
|
953
920
|
val[tone] = { rgb, var: `${val.var}-${tone}` };
|
|
954
921
|
}
|
|
955
|
-
if (val[tone])
|
|
956
|
-
|
|
957
|
-
if (alpha)
|
|
958
|
-
return `rgba(${rgb}, ${alpha})`;
|
|
922
|
+
if (val[tone]) rgb = val[tone].rgb;
|
|
923
|
+
if (alpha) return `rgba(${rgb}, ${alpha})`;
|
|
959
924
|
return CONFIG2.useVariable ? `var(${val.var})` : `rgb(${rgb})`;
|
|
960
925
|
};
|
|
961
926
|
|
|
@@ -964,8 +929,7 @@ var import_utils9 = __toESM(require_cjs(), 1);
|
|
|
964
929
|
var getSequence = (sequenceProps) => {
|
|
965
930
|
const CONFIG2 = getActiveConfig();
|
|
966
931
|
const { SPACING: SPACING2 } = CONFIG2;
|
|
967
|
-
if (!sequenceProps)
|
|
968
|
-
return SPACING2;
|
|
932
|
+
if (!sequenceProps) return SPACING2;
|
|
969
933
|
const hasGenerated = Object.keys(sequenceProps.sequence).length > 0;
|
|
970
934
|
return hasGenerated ? sequenceProps : generateSequence(sequenceProps);
|
|
971
935
|
};
|
|
@@ -975,8 +939,7 @@ var getSpacingByKey = (value, propertyName = "padding", sequenceProps) => {
|
|
|
975
939
|
return { [propertyName]: value };
|
|
976
940
|
}
|
|
977
941
|
const stack = (0, import_utils9.arrayzeValue)(value);
|
|
978
|
-
if (!isArray(stack))
|
|
979
|
-
return;
|
|
942
|
+
if (!isArray(stack)) return;
|
|
980
943
|
if (stack.length > 1) {
|
|
981
944
|
let suffix = "";
|
|
982
945
|
if (propertyName === "borderWidth") {
|
|
@@ -1025,15 +988,11 @@ var setShadow = (value, key, suffix, prefers) => {
|
|
|
1025
988
|
if (isString(value) && value.includes(",")) {
|
|
1026
989
|
value = value.split(",").map((v) => {
|
|
1027
990
|
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;
|
|
991
|
+
if (v.startsWith("--")) return `var(${v})`;
|
|
992
|
+
if (getColor(v).length > 2) return getColor(v);
|
|
993
|
+
if (v.includes("px") || v.slice(-2) === "em") return v;
|
|
1034
994
|
const arr = v.split(" ");
|
|
1035
|
-
if (!arr.length)
|
|
1036
|
-
return v;
|
|
995
|
+
if (!arr.length) return v;
|
|
1037
996
|
return arr.map((v2) => getSpacingByKey(v2, "shadow").shadow).join(" ");
|
|
1038
997
|
}).join(" ");
|
|
1039
998
|
}
|
|
@@ -1048,32 +1007,25 @@ var setShadow = (value, key, suffix, prefers) => {
|
|
|
1048
1007
|
};
|
|
1049
1008
|
var getShadow = (value, globalTheme) => {
|
|
1050
1009
|
const CONFIG2 = getActiveConfig();
|
|
1051
|
-
if (!globalTheme)
|
|
1052
|
-
globalTheme = CONFIG2.globalTheme;
|
|
1010
|
+
if (!globalTheme) globalTheme = CONFIG2.globalTheme;
|
|
1053
1011
|
if (!isString(value)) {
|
|
1054
|
-
if (CONFIG2.verbose)
|
|
1055
|
-
console.warn(value, "- type for color is not valid");
|
|
1012
|
+
if (CONFIG2.verbose) console.warn(value, "- type for color is not valid");
|
|
1056
1013
|
return;
|
|
1057
1014
|
}
|
|
1058
|
-
if (value.slice(0, 2) === "--")
|
|
1059
|
-
return `var(${value})`;
|
|
1015
|
+
if (value.slice(0, 2) === "--") return `var(${value})`;
|
|
1060
1016
|
const [name] = isArray(value) ? value : value.split(" ");
|
|
1061
1017
|
const { SHADOW: SHADOW2 } = CONFIG2;
|
|
1062
1018
|
const val = SHADOW2[name];
|
|
1063
1019
|
const isObj = isObject(val);
|
|
1064
1020
|
if (!val) {
|
|
1065
|
-
if (CONFIG2.verbose)
|
|
1066
|
-
console.warn("Can't find color ", name);
|
|
1021
|
+
if (CONFIG2.verbose) console.warn("Can't find color ", name);
|
|
1067
1022
|
return value;
|
|
1068
1023
|
}
|
|
1069
1024
|
if (globalTheme) {
|
|
1070
|
-
if (val[globalTheme])
|
|
1071
|
-
|
|
1072
|
-
else if (CONFIG2.verbose)
|
|
1073
|
-
console.warn(value, " - does not have ", globalTheme);
|
|
1025
|
+
if (val[globalTheme]) return val[globalTheme].value;
|
|
1026
|
+
else if (CONFIG2.verbose) console.warn(value, " - does not have ", globalTheme);
|
|
1074
1027
|
}
|
|
1075
|
-
if (isObj && val.value)
|
|
1076
|
-
return val.value;
|
|
1028
|
+
if (isObj && val.value) return val.value;
|
|
1077
1029
|
if (isObj) {
|
|
1078
1030
|
const obj = {};
|
|
1079
1031
|
for (const mediaName in val) {
|
|
@@ -1083,7 +1035,7 @@ var getShadow = (value, globalTheme) => {
|
|
|
1083
1035
|
}
|
|
1084
1036
|
return obj;
|
|
1085
1037
|
}
|
|
1086
|
-
if (CONFIG2.verbose)
|
|
1087
|
-
console.warn("Can't find color", value);
|
|
1038
|
+
if (CONFIG2.verbose) console.warn("Can't find color", value);
|
|
1088
1039
|
return value;
|
|
1089
1040
|
};
|
|
1041
|
+
// @preserve-env
|