@symbo.ls/scratch 2.11.522 → 3.0.1
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 +13 -20
- package/dist/cjs/index.js +192 -382
- package/dist/cjs/set.js +132 -282
- package/dist/cjs/system/color.js +61 -142
- package/dist/cjs/system/document.js +28 -84
- package/dist/cjs/system/font.js +29 -88
- package/dist/cjs/system/index.js +135 -285
- package/dist/cjs/system/reset.js +35 -98
- package/dist/cjs/system/shadow.js +77 -173
- package/dist/cjs/system/spacing.js +41 -112
- package/dist/cjs/system/svg.js +34 -94
- package/dist/cjs/system/theme.js +74 -168
- package/dist/cjs/system/timing.js +33 -96
- package/dist/cjs/system/typography.js +41 -110
- package/dist/cjs/transforms/index.js +112 -228
- package/dist/cjs/utils/color.js +22 -85
- package/dist/cjs/utils/font.js +3 -6
- package/dist/cjs/utils/index.js +66 -154
- package/dist/cjs/utils/sequence.js +33 -57
- package/dist/cjs/utils/sprite.js +13 -20
- package/dist/cjs/utils/theme.js +3 -6
- package/dist/cjs/utils/var.js +27 -45
- package/package.json +3 -3
- package/src/system/svg.js +1 -1
- package/src/transforms/index.js +9 -2
- package/src/utils/color.js +1 -2
package/dist/cjs/utils/color.js
CHANGED
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
2
|
var __defProp = Object.defineProperty;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __commonJS = (cb, mod) => function __require() {
|
|
9
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
10
|
-
};
|
|
11
6
|
var __export = (target, all) => {
|
|
12
7
|
for (var name in all)
|
|
13
8
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -20,52 +15,8 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
20
15
|
}
|
|
21
16
|
return to;
|
|
22
17
|
};
|
|
23
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
24
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
25
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
26
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
27
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
28
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
29
|
-
mod
|
|
30
|
-
));
|
|
31
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
32
19
|
|
|
33
|
-
// ../../node_modules/@domql/globals/dist/cjs/index.js
|
|
34
|
-
var require_cjs = __commonJS({
|
|
35
|
-
"../../node_modules/@domql/globals/dist/cjs/index.js"(exports, module2) {
|
|
36
|
-
"use strict";
|
|
37
|
-
var __defProp2 = Object.defineProperty;
|
|
38
|
-
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
39
|
-
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
40
|
-
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
41
|
-
var __export2 = (target, all) => {
|
|
42
|
-
for (var name in all)
|
|
43
|
-
__defProp2(target, name, { get: all[name], enumerable: true });
|
|
44
|
-
};
|
|
45
|
-
var __copyProps2 = (to, from, except, desc) => {
|
|
46
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
47
|
-
for (let key of __getOwnPropNames2(from))
|
|
48
|
-
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
49
|
-
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
50
|
-
}
|
|
51
|
-
return to;
|
|
52
|
-
};
|
|
53
|
-
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
54
|
-
var globals_exports = {};
|
|
55
|
-
__export2(globals_exports, {
|
|
56
|
-
document: () => document4,
|
|
57
|
-
global: () => global,
|
|
58
|
-
self: () => self,
|
|
59
|
-
window: () => window4
|
|
60
|
-
});
|
|
61
|
-
module2.exports = __toCommonJS2(globals_exports);
|
|
62
|
-
var global = globalThis;
|
|
63
|
-
var self = globalThis;
|
|
64
|
-
var window4 = globalThis;
|
|
65
|
-
var document4 = window4.document;
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
|
|
69
20
|
// src/utils/color.js
|
|
70
21
|
var color_exports = {};
|
|
71
22
|
__export(color_exports, {
|
|
@@ -86,26 +37,23 @@ __export(color_exports, {
|
|
|
86
37
|
rgbToHex: () => rgbToHex
|
|
87
38
|
});
|
|
88
39
|
module.exports = __toCommonJS(color_exports);
|
|
89
|
-
var import_globals4 = __toESM(require_cjs(), 1);
|
|
90
40
|
|
|
91
|
-
//
|
|
41
|
+
// node_modules/@domql/utils/dist/esm/globals.js
|
|
92
42
|
var window2 = globalThis;
|
|
93
43
|
var document2 = window2.document;
|
|
94
44
|
|
|
95
|
-
//
|
|
45
|
+
// node_modules/@domql/utils/dist/esm/types.js
|
|
96
46
|
var isString = (arg) => typeof arg === "string";
|
|
97
47
|
var isNumber = (arg) => typeof arg === "number";
|
|
98
48
|
|
|
99
|
-
//
|
|
49
|
+
// node_modules/@domql/utils/dist/esm/cookie.js
|
|
100
50
|
var isMobile = (() => typeof navigator === "undefined" ? false : /Mobi/.test(navigator.userAgent))();
|
|
101
51
|
|
|
102
52
|
// src/utils/color.js
|
|
103
53
|
var ENV = "development";
|
|
104
54
|
var colorStringToRgbaArray = (color) => {
|
|
105
|
-
if (color === "")
|
|
106
|
-
|
|
107
|
-
if (color.toLowerCase() === "transparent")
|
|
108
|
-
return [0, 0, 0, 0];
|
|
55
|
+
if (color === "") return [0, 0, 0, 0];
|
|
56
|
+
if (color.toLowerCase() === "transparent") return [0, 0, 0, 0];
|
|
109
57
|
if (color[0] === "#") {
|
|
110
58
|
if (color.length < 7) {
|
|
111
59
|
color = "#" + color[1] + color[1] + color[2] + color[2] + color[3] + color[3] + (color.length > 4 ? color[4] + color[4] : "");
|
|
@@ -118,26 +66,25 @@ var colorStringToRgbaArray = (color) => {
|
|
|
118
66
|
];
|
|
119
67
|
}
|
|
120
68
|
if (color.indexOf("rgb") === -1) {
|
|
121
|
-
if (
|
|
122
|
-
const elem =
|
|
69
|
+
if (document2 && window2) {
|
|
70
|
+
const elem = document2.body.appendChild(document2.createElement("fictum"));
|
|
123
71
|
const flag = "rgb(1, 2, 3)";
|
|
124
72
|
elem.style.color = flag;
|
|
125
73
|
if (elem.style.color !== flag) {
|
|
126
|
-
|
|
74
|
+
document2.body.removeChild(elem);
|
|
127
75
|
return;
|
|
128
76
|
}
|
|
129
77
|
elem.style.color = color;
|
|
130
78
|
if (elem.style.color === flag || elem.style.color === "") {
|
|
131
|
-
|
|
79
|
+
document2.body.removeChild(elem);
|
|
132
80
|
return [0, 0, 0, 0];
|
|
133
81
|
}
|
|
134
|
-
color =
|
|
135
|
-
|
|
82
|
+
color = window2.getComputedStyle(elem).color;
|
|
83
|
+
document2.body.removeChild(elem);
|
|
136
84
|
}
|
|
137
85
|
}
|
|
138
86
|
if (color.indexOf("rgb") === 0) {
|
|
139
|
-
if (color.indexOf("rgba") === -1)
|
|
140
|
-
color = `${color}, 1`;
|
|
87
|
+
if (color.indexOf("rgba") === -1) color = `${color}, 1`;
|
|
141
88
|
return color.match(/[\.\d]+/g).map((a) => +a);
|
|
142
89
|
}
|
|
143
90
|
return [0, 0, 0, 0];
|
|
@@ -194,20 +141,14 @@ var hslToRgb = (h, s, l, a = s * Math.min(l, 1 - l), f = (n, k = (n + h / 30) %
|
|
|
194
141
|
var getColorShade = (col, amt) => {
|
|
195
142
|
const num = parseInt(col, 16);
|
|
196
143
|
let r = (num >> 16) + amt;
|
|
197
|
-
if (r > 255)
|
|
198
|
-
|
|
199
|
-
else if (r < 0)
|
|
200
|
-
r = 0;
|
|
144
|
+
if (r > 255) r = 255;
|
|
145
|
+
else if (r < 0) r = 0;
|
|
201
146
|
let b = (num >> 8 & 255) + amt;
|
|
202
|
-
if (b > 255)
|
|
203
|
-
|
|
204
|
-
else if (b < 0)
|
|
205
|
-
b = 0;
|
|
147
|
+
if (b > 255) b = 255;
|
|
148
|
+
else if (b < 0) b = 0;
|
|
206
149
|
let g = (num & 255) + amt;
|
|
207
|
-
if (g > 255)
|
|
208
|
-
|
|
209
|
-
else if (g < 0)
|
|
210
|
-
g = 0;
|
|
150
|
+
if (g > 255) g = 255;
|
|
151
|
+
else if (g < 0) g = 0;
|
|
211
152
|
return ((g | b << 8 | r << 16) + 16777216).toString(16).slice(1);
|
|
212
153
|
};
|
|
213
154
|
var mixTwoRgba = (colorA, colorB, range = 0.5) => {
|
|
@@ -223,20 +164,16 @@ var mixTwoRgba = (colorA, colorB, range = 0.5) => {
|
|
|
223
164
|
var opacify = (color, opacity) => {
|
|
224
165
|
const arr = colorStringToRgbaArray(color);
|
|
225
166
|
if (!arr) {
|
|
226
|
-
if (ENV === "test" || ENV === "development")
|
|
227
|
-
console.warn(color + " color is not rgba");
|
|
167
|
+
if (ENV === "test" || ENV === "development") console.warn(color + " color is not rgba");
|
|
228
168
|
return;
|
|
229
169
|
}
|
|
230
170
|
arr[3] = opacity;
|
|
231
171
|
return `rgba(${arr})`;
|
|
232
172
|
};
|
|
233
173
|
var getRgbTone = (rgb, tone) => {
|
|
234
|
-
if (isString(rgb) && rgb.includes("rgb"))
|
|
235
|
-
|
|
236
|
-
if (
|
|
237
|
-
rgb = rgb.split(",").map((v) => parseFloat(v.trim()));
|
|
238
|
-
if (isNumber(tone))
|
|
239
|
-
tone += "";
|
|
174
|
+
if (isString(rgb) && rgb.includes("rgb")) rgb = colorStringToRgbaArray(rgb).join(", ");
|
|
175
|
+
if (isString(rgb)) rgb = rgb.split(",").map((v) => parseFloat(v.trim()));
|
|
176
|
+
if (isNumber(tone)) tone += "";
|
|
240
177
|
const toHex = rgbArrayToHex(rgb);
|
|
241
178
|
const abs = tone.slice(0, 1);
|
|
242
179
|
if (abs === "-" || abs === "+") {
|
package/dist/cjs/utils/font.js
CHANGED
|
@@ -32,10 +32,8 @@ __export(font_exports, {
|
|
|
32
32
|
});
|
|
33
33
|
module.exports = __toCommonJS(font_exports);
|
|
34
34
|
var getDefaultOrFirstKey = (LIBRARY, key) => {
|
|
35
|
-
if (LIBRARY[key])
|
|
36
|
-
|
|
37
|
-
if (LIBRARY.default)
|
|
38
|
-
return LIBRARY[LIBRARY.default].value;
|
|
35
|
+
if (LIBRARY[key]) return LIBRARY[key].value;
|
|
36
|
+
if (LIBRARY.default) return LIBRARY[LIBRARY.default].value;
|
|
39
37
|
const hasValue = Object.keys(LIBRARY)[0];
|
|
40
38
|
return hasValue && LIBRARY[hasValue] && LIBRARY[hasValue].value;
|
|
41
39
|
};
|
|
@@ -62,8 +60,7 @@ var getFontFace = (LIBRARY) => {
|
|
|
62
60
|
};
|
|
63
61
|
var getFontFaceEachString = (name, weights) => {
|
|
64
62
|
const isArr = weights[0];
|
|
65
|
-
if (isArr)
|
|
66
|
-
return getFontFaceEach(name, weights).map(setInCustomFontMedia);
|
|
63
|
+
if (isArr) return getFontFaceEach(name, weights).map(setInCustomFontMedia);
|
|
67
64
|
return setCustomFontMedia(name, weights.url);
|
|
68
65
|
};
|
|
69
66
|
var getFontFaceString = (LIBRARY) => {
|
package/dist/cjs/utils/index.js
CHANGED
|
@@ -30,44 +30,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
30
30
|
));
|
|
31
31
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
32
32
|
|
|
33
|
-
// ../../node_modules/@domql/globals/dist/cjs/index.js
|
|
34
|
-
var require_cjs = __commonJS({
|
|
35
|
-
"../../node_modules/@domql/globals/dist/cjs/index.js"(exports, module2) {
|
|
36
|
-
"use strict";
|
|
37
|
-
var __defProp3 = Object.defineProperty;
|
|
38
|
-
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
39
|
-
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
40
|
-
var __hasOwnProp3 = Object.prototype.hasOwnProperty;
|
|
41
|
-
var __export2 = (target, all) => {
|
|
42
|
-
for (var name in all)
|
|
43
|
-
__defProp3(target, name, { get: all[name], enumerable: true });
|
|
44
|
-
};
|
|
45
|
-
var __copyProps2 = (to, from, except, desc) => {
|
|
46
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
47
|
-
for (let key of __getOwnPropNames2(from))
|
|
48
|
-
if (!__hasOwnProp3.call(to, key) && key !== except)
|
|
49
|
-
__defProp3(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
50
|
-
}
|
|
51
|
-
return to;
|
|
52
|
-
};
|
|
53
|
-
var __toCommonJS2 = (mod) => __copyProps2(__defProp3({}, "__esModule", { value: true }), mod);
|
|
54
|
-
var globals_exports = {};
|
|
55
|
-
__export2(globals_exports, {
|
|
56
|
-
document: () => document4,
|
|
57
|
-
global: () => global,
|
|
58
|
-
self: () => self,
|
|
59
|
-
window: () => window4
|
|
60
|
-
});
|
|
61
|
-
module2.exports = __toCommonJS2(globals_exports);
|
|
62
|
-
var global = globalThis;
|
|
63
|
-
var self = globalThis;
|
|
64
|
-
var window4 = globalThis;
|
|
65
|
-
var document4 = window4.document;
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
|
|
69
33
|
// ../utils/dist/cjs/index.js
|
|
70
|
-
var
|
|
34
|
+
var require_cjs = __commonJS({
|
|
71
35
|
"../utils/dist/cjs/index.js"(exports, module2) {
|
|
72
36
|
"use strict";
|
|
73
37
|
var __defProp3 = Object.defineProperty;
|
|
@@ -87,8 +51,8 @@ var require_cjs2 = __commonJS({
|
|
|
87
51
|
return to;
|
|
88
52
|
};
|
|
89
53
|
var __toCommonJS2 = (mod) => __copyProps2(__defProp3({}, "__esModule", { value: true }), mod);
|
|
90
|
-
var
|
|
91
|
-
__export2(
|
|
54
|
+
var index_exports = {};
|
|
55
|
+
__export2(index_exports, {
|
|
92
56
|
arrayzeValue: () => arrayzeValue,
|
|
93
57
|
copyJavaScriptToClipboard: () => copyJavaScriptToClipboard,
|
|
94
58
|
copyStringToClipboard: () => copyStringToClipboard,
|
|
@@ -109,12 +73,11 @@ var require_cjs2 = __commonJS({
|
|
|
109
73
|
toTitleCase: () => toTitleCase,
|
|
110
74
|
toggleFullscreen: () => toggleFullscreen
|
|
111
75
|
});
|
|
112
|
-
module2.exports = __toCommonJS2(
|
|
76
|
+
module2.exports = __toCommonJS2(index_exports);
|
|
113
77
|
var window22 = globalThis;
|
|
114
78
|
var document22 = window22.document;
|
|
115
79
|
var isObject2 = (arg) => {
|
|
116
|
-
if (arg === null)
|
|
117
|
-
return false;
|
|
80
|
+
if (arg === null) return false;
|
|
118
81
|
return typeof arg === "object" && arg.constructor === Object;
|
|
119
82
|
};
|
|
120
83
|
var isString2 = (arg) => typeof arg === "string";
|
|
@@ -139,13 +102,11 @@ var require_cjs2 = __commonJS({
|
|
|
139
102
|
};
|
|
140
103
|
var findClosestNumberInFactory = (val, factory) => {
|
|
141
104
|
val = parseFloat(val);
|
|
142
|
-
if (isObject2(factory))
|
|
143
|
-
factory = Object.values(factory);
|
|
105
|
+
if (isObject2(factory)) factory = Object.values(factory);
|
|
144
106
|
return findClosestNumber(val, factory);
|
|
145
107
|
};
|
|
146
108
|
var formatDate = (timestamp) => {
|
|
147
|
-
if (!timestamp)
|
|
148
|
-
return "";
|
|
109
|
+
if (!timestamp) return "";
|
|
149
110
|
const d = new Date(timestamp);
|
|
150
111
|
const ye = new Intl.DateTimeFormat("en", { year: "numeric" }).format(d);
|
|
151
112
|
const mo = new Intl.DateTimeFormat("en", { month: "short" }).format(d);
|
|
@@ -212,8 +173,7 @@ var require_cjs2 = __commonJS({
|
|
|
212
173
|
scriptEle.type = type;
|
|
213
174
|
scriptEle.text = xhr.responseText;
|
|
214
175
|
doc.body.appendChild(scriptEle);
|
|
215
|
-
if (typeof fallback === "function")
|
|
216
|
-
fallback();
|
|
176
|
+
if (typeof fallback === "function") fallback();
|
|
217
177
|
} else {
|
|
218
178
|
throw new Error(`Failed to load the script ${FILE_URL}`);
|
|
219
179
|
}
|
|
@@ -281,20 +241,15 @@ var require_cjs2 = __commonJS({
|
|
|
281
241
|
);
|
|
282
242
|
var toDashCase2 = (val) => val.replace(/[^a-zA-Z0-9]/g, " ").trim().toLowerCase().replace(/\s+/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "");
|
|
283
243
|
var toDescriptionCase = (str = "") => {
|
|
284
|
-
if (typeof str !== "string")
|
|
285
|
-
return;
|
|
244
|
+
if (typeof str !== "string") return;
|
|
286
245
|
const result = str.replace(/([A-Z])/g, " $1");
|
|
287
246
|
return result.charAt(0).toUpperCase() + result.slice(1);
|
|
288
247
|
};
|
|
289
248
|
var arrayzeValue = (val) => {
|
|
290
|
-
if (isArray2(val))
|
|
291
|
-
|
|
292
|
-
if (
|
|
293
|
-
|
|
294
|
-
if (isObject2(val))
|
|
295
|
-
return Object.values(val);
|
|
296
|
-
if (isNumber2(val))
|
|
297
|
-
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];
|
|
298
253
|
};
|
|
299
254
|
}
|
|
300
255
|
});
|
|
@@ -354,39 +309,35 @@ var isScalingUnit = (unit) => {
|
|
|
354
309
|
return unit === "em" || unit === "rem" || unit === "vw" || unit === "vh" || unit === "vmax" || unit === "vmin";
|
|
355
310
|
};
|
|
356
311
|
|
|
357
|
-
//
|
|
358
|
-
var import_globals4 = __toESM(require_cjs(), 1);
|
|
359
|
-
|
|
360
|
-
// ../../node_modules/@domql/utils/dist/esm/globals.js
|
|
312
|
+
// node_modules/@domql/utils/dist/esm/globals.js
|
|
361
313
|
var window2 = globalThis;
|
|
362
314
|
var document2 = window2.document;
|
|
363
315
|
|
|
364
|
-
//
|
|
316
|
+
// node_modules/@domql/utils/dist/esm/node.js
|
|
365
317
|
var isDOMNode = (obj) => {
|
|
366
318
|
return typeof window2 !== "undefined" && (obj instanceof window2.Node || obj instanceof window2.Window || obj === window2 || obj === document);
|
|
367
319
|
};
|
|
368
320
|
|
|
369
|
-
//
|
|
321
|
+
// node_modules/@domql/utils/dist/esm/types.js
|
|
370
322
|
var isString = (arg) => typeof arg === "string";
|
|
371
323
|
var isNumber = (arg) => typeof arg === "number";
|
|
372
324
|
var isFunction = (arg) => typeof arg === "function";
|
|
373
325
|
var isNull = (arg) => arg === null;
|
|
374
326
|
var isArray = (arg) => Array.isArray(arg);
|
|
375
327
|
var isObjectLike = (arg) => {
|
|
376
|
-
if (arg === null)
|
|
377
|
-
return false;
|
|
328
|
+
if (arg === null) return false;
|
|
378
329
|
return typeof arg === "object";
|
|
379
330
|
};
|
|
380
331
|
var isUndefined = (arg) => {
|
|
381
332
|
return arg === void 0;
|
|
382
333
|
};
|
|
383
334
|
|
|
384
|
-
//
|
|
335
|
+
// node_modules/@domql/utils/dist/esm/array.js
|
|
385
336
|
var mergeArray = (arr, exclude = []) => {
|
|
386
337
|
return arr.reduce((a, c) => deepMerge(a, deepClone(c, { exclude }), exclude), {});
|
|
387
338
|
};
|
|
388
339
|
|
|
389
|
-
//
|
|
340
|
+
// node_modules/@domql/utils/dist/esm/object.js
|
|
390
341
|
var __defProp2 = Object.defineProperty;
|
|
391
342
|
var __defProps = Object.defineProperties;
|
|
392
343
|
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
@@ -409,8 +360,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
409
360
|
var deepMerge = (element, extend, excludeFrom = []) => {
|
|
410
361
|
for (const e in extend) {
|
|
411
362
|
const hasOwnProperty2 = Object.prototype.hasOwnProperty.call(extend, e);
|
|
412
|
-
if (!hasOwnProperty2 || excludeFrom.includes(e) || e.startsWith("__"))
|
|
413
|
-
continue;
|
|
363
|
+
if (!hasOwnProperty2 || excludeFrom.includes(e) || e.startsWith("__")) continue;
|
|
414
364
|
const elementProp = element[e];
|
|
415
365
|
const extendProp = extend[e];
|
|
416
366
|
if (isObjectLike(elementProp) && isObjectLike(extendProp)) {
|
|
@@ -439,13 +389,10 @@ var deepClone = (obj, options = {}) => {
|
|
|
439
389
|
const clone2 = targetWindow ? isArray(obj) ? new targetWindow.Array() : new targetWindow.Object() : isArray(obj) ? [] : {};
|
|
440
390
|
visited.set(obj, clone2);
|
|
441
391
|
for (const key in obj) {
|
|
442
|
-
if (!Object.prototype.hasOwnProperty.call(obj, key))
|
|
443
|
-
|
|
444
|
-
if (exclude.includes(key) || key.startsWith("__") || key === "__proto__")
|
|
445
|
-
continue;
|
|
392
|
+
if (!Object.prototype.hasOwnProperty.call(obj, key)) continue;
|
|
393
|
+
if (exclude.includes(key) || key.startsWith("__") || key === "__proto__") continue;
|
|
446
394
|
const value = obj[key];
|
|
447
|
-
if (cleanUndefined && isUndefined(value) || cleanNull && isNull(value))
|
|
448
|
-
continue;
|
|
395
|
+
if (cleanUndefined && isUndefined(value) || cleanNull && isNull(value)) continue;
|
|
449
396
|
if (isDOMNode(value)) {
|
|
450
397
|
clone2[key] = value;
|
|
451
398
|
continue;
|
|
@@ -469,16 +416,14 @@ var deepClone = (obj, options = {}) => {
|
|
|
469
416
|
return clone2;
|
|
470
417
|
};
|
|
471
418
|
|
|
472
|
-
//
|
|
419
|
+
// node_modules/@domql/utils/dist/esm/cookie.js
|
|
473
420
|
var isMobile = (() => typeof navigator === "undefined" ? false : /Mobi/.test(navigator.userAgent))();
|
|
474
421
|
|
|
475
422
|
// src/utils/color.js
|
|
476
423
|
var ENV = "development";
|
|
477
424
|
var colorStringToRgbaArray = (color) => {
|
|
478
|
-
if (color === "")
|
|
479
|
-
|
|
480
|
-
if (color.toLowerCase() === "transparent")
|
|
481
|
-
return [0, 0, 0, 0];
|
|
425
|
+
if (color === "") return [0, 0, 0, 0];
|
|
426
|
+
if (color.toLowerCase() === "transparent") return [0, 0, 0, 0];
|
|
482
427
|
if (color[0] === "#") {
|
|
483
428
|
if (color.length < 7) {
|
|
484
429
|
color = "#" + color[1] + color[1] + color[2] + color[2] + color[3] + color[3] + (color.length > 4 ? color[4] + color[4] : "");
|
|
@@ -491,26 +436,25 @@ var colorStringToRgbaArray = (color) => {
|
|
|
491
436
|
];
|
|
492
437
|
}
|
|
493
438
|
if (color.indexOf("rgb") === -1) {
|
|
494
|
-
if (
|
|
495
|
-
const elem =
|
|
439
|
+
if (document2 && window2) {
|
|
440
|
+
const elem = document2.body.appendChild(document2.createElement("fictum"));
|
|
496
441
|
const flag = "rgb(1, 2, 3)";
|
|
497
442
|
elem.style.color = flag;
|
|
498
443
|
if (elem.style.color !== flag) {
|
|
499
|
-
|
|
444
|
+
document2.body.removeChild(elem);
|
|
500
445
|
return;
|
|
501
446
|
}
|
|
502
447
|
elem.style.color = color;
|
|
503
448
|
if (elem.style.color === flag || elem.style.color === "") {
|
|
504
|
-
|
|
449
|
+
document2.body.removeChild(elem);
|
|
505
450
|
return [0, 0, 0, 0];
|
|
506
451
|
}
|
|
507
|
-
color =
|
|
508
|
-
|
|
452
|
+
color = window2.getComputedStyle(elem).color;
|
|
453
|
+
document2.body.removeChild(elem);
|
|
509
454
|
}
|
|
510
455
|
}
|
|
511
456
|
if (color.indexOf("rgb") === 0) {
|
|
512
|
-
if (color.indexOf("rgba") === -1)
|
|
513
|
-
color = `${color}, 1`;
|
|
457
|
+
if (color.indexOf("rgba") === -1) color = `${color}, 1`;
|
|
514
458
|
return color.match(/[\.\d]+/g).map((a) => +a);
|
|
515
459
|
}
|
|
516
460
|
return [0, 0, 0, 0];
|
|
@@ -567,20 +511,14 @@ var hslToRgb = (h, s, l, a = s * Math.min(l, 1 - l), f = (n, k = (n + h / 30) %
|
|
|
567
511
|
var getColorShade = (col, amt) => {
|
|
568
512
|
const num = parseInt(col, 16);
|
|
569
513
|
let r = (num >> 16) + amt;
|
|
570
|
-
if (r > 255)
|
|
571
|
-
|
|
572
|
-
else if (r < 0)
|
|
573
|
-
r = 0;
|
|
514
|
+
if (r > 255) r = 255;
|
|
515
|
+
else if (r < 0) r = 0;
|
|
574
516
|
let b = (num >> 8 & 255) + amt;
|
|
575
|
-
if (b > 255)
|
|
576
|
-
|
|
577
|
-
else if (b < 0)
|
|
578
|
-
b = 0;
|
|
517
|
+
if (b > 255) b = 255;
|
|
518
|
+
else if (b < 0) b = 0;
|
|
579
519
|
let g = (num & 255) + amt;
|
|
580
|
-
if (g > 255)
|
|
581
|
-
|
|
582
|
-
else if (g < 0)
|
|
583
|
-
g = 0;
|
|
520
|
+
if (g > 255) g = 255;
|
|
521
|
+
else if (g < 0) g = 0;
|
|
584
522
|
return ((g | b << 8 | r << 16) + 16777216).toString(16).slice(1);
|
|
585
523
|
};
|
|
586
524
|
var mixTwoRgba = (colorA, colorB, range = 0.5) => {
|
|
@@ -596,20 +534,16 @@ var mixTwoRgba = (colorA, colorB, range = 0.5) => {
|
|
|
596
534
|
var opacify = (color, opacity) => {
|
|
597
535
|
const arr = colorStringToRgbaArray(color);
|
|
598
536
|
if (!arr) {
|
|
599
|
-
if (ENV === "test" || ENV === "development")
|
|
600
|
-
console.warn(color + " color is not rgba");
|
|
537
|
+
if (ENV === "test" || ENV === "development") console.warn(color + " color is not rgba");
|
|
601
538
|
return;
|
|
602
539
|
}
|
|
603
540
|
arr[3] = opacity;
|
|
604
541
|
return `rgba(${arr})`;
|
|
605
542
|
};
|
|
606
543
|
var getRgbTone = (rgb, tone) => {
|
|
607
|
-
if (isString(rgb) && rgb.includes("rgb"))
|
|
608
|
-
|
|
609
|
-
if (
|
|
610
|
-
rgb = rgb.split(",").map((v) => parseFloat(v.trim()));
|
|
611
|
-
if (isNumber(tone))
|
|
612
|
-
tone += "";
|
|
544
|
+
if (isString(rgb) && rgb.includes("rgb")) rgb = colorStringToRgbaArray(rgb).join(", ");
|
|
545
|
+
if (isString(rgb)) rgb = rgb.split(",").map((v) => parseFloat(v.trim()));
|
|
546
|
+
if (isNumber(tone)) tone += "";
|
|
613
547
|
const toHex = rgbArrayToHex(rgb);
|
|
614
548
|
const abs = tone.slice(0, 1);
|
|
615
549
|
if (abs === "-" || abs === "+") {
|
|
@@ -626,21 +560,16 @@ var getRgbTone = (rgb, tone) => {
|
|
|
626
560
|
|
|
627
561
|
// src/utils/theme.js
|
|
628
562
|
var returnSubThemeOrDefault = (orig, theme) => {
|
|
629
|
-
if (!orig)
|
|
630
|
-
|
|
631
|
-
if (orig
|
|
632
|
-
return orig.themes[theme];
|
|
633
|
-
if (orig[theme])
|
|
634
|
-
return [orig, orig[theme]];
|
|
563
|
+
if (!orig) return;
|
|
564
|
+
if (orig.themes && orig.themes[theme]) return orig.themes[theme];
|
|
565
|
+
if (orig[theme]) return [orig, orig[theme]];
|
|
635
566
|
return orig;
|
|
636
567
|
};
|
|
637
568
|
|
|
638
569
|
// src/utils/font.js
|
|
639
570
|
var getDefaultOrFirstKey = (LIBRARY, key) => {
|
|
640
|
-
if (LIBRARY[key])
|
|
641
|
-
|
|
642
|
-
if (LIBRARY.default)
|
|
643
|
-
return LIBRARY[LIBRARY.default].value;
|
|
571
|
+
if (LIBRARY[key]) return LIBRARY[key].value;
|
|
572
|
+
if (LIBRARY.default) return LIBRARY[LIBRARY.default].value;
|
|
644
573
|
const hasValue = Object.keys(LIBRARY)[0];
|
|
645
574
|
return hasValue && LIBRARY[hasValue] && LIBRARY[hasValue].value;
|
|
646
575
|
};
|
|
@@ -667,8 +596,7 @@ var getFontFace = (LIBRARY) => {
|
|
|
667
596
|
};
|
|
668
597
|
var getFontFaceEachString = (name, weights) => {
|
|
669
598
|
const isArr = weights[0];
|
|
670
|
-
if (isArr)
|
|
671
|
-
return getFontFaceEach(name, weights).map(setInCustomFontMedia);
|
|
599
|
+
if (isArr) return getFontFaceEach(name, weights).map(setInCustomFontMedia);
|
|
672
600
|
return setCustomFontMedia(name, weights.url);
|
|
673
601
|
};
|
|
674
602
|
var getFontFaceString = (LIBRARY) => {
|
|
@@ -677,7 +605,7 @@ var getFontFaceString = (LIBRARY) => {
|
|
|
677
605
|
};
|
|
678
606
|
|
|
679
607
|
// src/utils/sequence.js
|
|
680
|
-
var import_utils4 = __toESM(
|
|
608
|
+
var import_utils4 = __toESM(require_cjs(), 1);
|
|
681
609
|
|
|
682
610
|
// src/defaultConfig/index.js
|
|
683
611
|
var defaultConfig_exports = {};
|
|
@@ -946,8 +874,7 @@ var setSequenceValue = (props, sequenceProps) => {
|
|
|
946
874
|
var setScalingVar = (key, sequenceProps) => {
|
|
947
875
|
const { base, type, unit } = sequenceProps;
|
|
948
876
|
const defaultVal = (isScalingUnit(unit) ? 1 : base) + unit;
|
|
949
|
-
if (key === 0)
|
|
950
|
-
return defaultVal;
|
|
877
|
+
if (key === 0) return defaultVal;
|
|
951
878
|
const prefix = "--" + (type && type.replace(".", "-"));
|
|
952
879
|
const ratioVar = `${prefix}-ratio`;
|
|
953
880
|
if (key > 0) {
|
|
@@ -984,10 +911,8 @@ var generateSubSequence = (props, sequenceProps) => {
|
|
|
984
911
|
const diffRounded = ~~next - ~~value;
|
|
985
912
|
let arr;
|
|
986
913
|
const [first, middle, second] = getSubratioDifference(value, ratio);
|
|
987
|
-
if (diffRounded > 16)
|
|
988
|
-
|
|
989
|
-
else
|
|
990
|
-
arr = [first, second];
|
|
914
|
+
if (diffRounded > 16) arr = [first, middle, second];
|
|
915
|
+
else arr = [first, second];
|
|
991
916
|
arr.forEach((v, k) => {
|
|
992
917
|
const scaling = ~~(v / base * 1e3) / 1e3;
|
|
993
918
|
const newVar = variable + (k + 1);
|
|
@@ -1029,8 +954,7 @@ var generateSequence = (sequenceProps) => {
|
|
|
1029
954
|
index: key
|
|
1030
955
|
};
|
|
1031
956
|
setSequenceValue(props, sequenceProps);
|
|
1032
|
-
if (subSequence)
|
|
1033
|
-
generateSubSequence(props, sequenceProps);
|
|
957
|
+
if (subSequence) generateSubSequence(props, sequenceProps);
|
|
1034
958
|
}
|
|
1035
959
|
return sequenceProps;
|
|
1036
960
|
};
|
|
@@ -1076,13 +1000,11 @@ var getSequenceValue = (value = "A", sequenceProps) => {
|
|
|
1076
1000
|
unit = UNIT2.default,
|
|
1077
1001
|
useVariable
|
|
1078
1002
|
} = sequenceProps;
|
|
1079
|
-
if (isString(value) && value.slice(0, 2) === "--")
|
|
1080
|
-
return `var(${value})`;
|
|
1003
|
+
if (isString(value) && value.slice(0, 2) === "--") return `var(${value})`;
|
|
1081
1004
|
const prefix = `--${(0, import_utils4.toDashCase)(sequenceProps.type.replace(".", "-"))}-`;
|
|
1082
1005
|
const startsWithDashOrLetterRegex = /^-?[a-zA-Z]/i;
|
|
1083
1006
|
const startsWithDashOrLetter = startsWithDashOrLetterRegex.test(value);
|
|
1084
|
-
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)
|
|
1085
|
-
return value;
|
|
1007
|
+
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;
|
|
1086
1008
|
const letterVal = value.toUpperCase();
|
|
1087
1009
|
const isNegative = letterVal.slice(0, 1) === "-" ? "-" : "";
|
|
1088
1010
|
let absValue = isNegative ? letterVal.slice(1) : letterVal;
|
|
@@ -1106,8 +1028,7 @@ var getSequenceValue = (value = "A", sequenceProps) => {
|
|
|
1106
1028
|
return isNegative ? `calc((${joint}) * -1)` : `calc(${joint})`;
|
|
1107
1029
|
}
|
|
1108
1030
|
if (!sequence[absValue] && absValue.length === 2) {
|
|
1109
|
-
if (CONFIG2.verbose)
|
|
1110
|
-
console.warn(absValue, "- value is not found because `subSequence` is set to false");
|
|
1031
|
+
if (CONFIG2.verbose) console.warn(absValue, "- value is not found because `subSequence` is set to false");
|
|
1111
1032
|
absValue = absValue.slice(0, 1);
|
|
1112
1033
|
}
|
|
1113
1034
|
if (useVariable || CONFIG2.useVariable) {
|
|
@@ -1115,8 +1036,7 @@ var getSequenceValue = (value = "A", sequenceProps) => {
|
|
|
1115
1036
|
return isNegative ? `calc(${varValue2} * -1)` : varValue2;
|
|
1116
1037
|
}
|
|
1117
1038
|
const sequenceItem = sequence ? sequence[absValue] : null;
|
|
1118
|
-
if (!sequenceItem)
|
|
1119
|
-
return console.warn("can't find", sequence, absValue);
|
|
1039
|
+
if (!sequenceItem) return console.warn("can't find", sequence, absValue);
|
|
1120
1040
|
if (unit === "ms" || unit === "s") {
|
|
1121
1041
|
return isNegative + sequenceItem.val + unit;
|
|
1122
1042
|
}
|
|
@@ -1125,12 +1045,10 @@ var getSequenceValue = (value = "A", sequenceProps) => {
|
|
|
1125
1045
|
var getSequenceValuePropertyPair = (value, propertyName, sequenceProps) => {
|
|
1126
1046
|
if (typeof value !== "string") {
|
|
1127
1047
|
const CONFIG2 = getActiveConfig();
|
|
1128
|
-
if (CONFIG2.verbose)
|
|
1129
|
-
console.warn(propertyName, value, "is not a string");
|
|
1048
|
+
if (CONFIG2.verbose) console.warn(propertyName, value, "is not a string");
|
|
1130
1049
|
return { [propertyName]: value };
|
|
1131
1050
|
}
|
|
1132
|
-
if (value === "-" || value === "")
|
|
1133
|
-
return {};
|
|
1051
|
+
if (value === "-" || value === "") return {};
|
|
1134
1052
|
return { [propertyName]: getSequenceValue(value, sequenceProps) };
|
|
1135
1053
|
};
|
|
1136
1054
|
var findHeadingLetter = (h1Matches, index) => numToLetterMap[h1Matches - index];
|
|
@@ -1198,23 +1116,19 @@ var applyMediaSequenceVars = (FACTORY2, media, options = {}) => {
|
|
|
1198
1116
|
const { mediaRegenerate } = FACTORY2;
|
|
1199
1117
|
const { sequence, scales } = FACTORY2[media];
|
|
1200
1118
|
const query = MEDIA2[mediaName];
|
|
1201
|
-
if (!query && CONFIG2.verbose)
|
|
1202
|
-
console.warn("Can't find media query ", query);
|
|
1119
|
+
if (!query && CONFIG2.verbose) console.warn("Can't find media query ", query);
|
|
1203
1120
|
if (!mediaRegenerate) {
|
|
1204
1121
|
let underMediaQuery = CSS_VARS2[`@media ${query}`];
|
|
1205
|
-
if (!underMediaQuery)
|
|
1206
|
-
underMediaQuery = CSS_VARS2[`@media ${query}`] = {};
|
|
1122
|
+
if (!underMediaQuery) underMediaQuery = CSS_VARS2[`@media ${query}`] = {};
|
|
1207
1123
|
applySequenceGlobalVars(underMediaQuery, FACTORY2[media], options);
|
|
1208
1124
|
return;
|
|
1209
1125
|
}
|
|
1210
1126
|
for (const key in sequence) {
|
|
1211
1127
|
const item = sequence[key];
|
|
1212
1128
|
const value = (isScalingUnit(unit) ? scales[key] : sequence[key].val) + unit;
|
|
1213
|
-
if (!query && CONFIG2.verbose)
|
|
1214
|
-
console.warn("Can't find query ", query);
|
|
1129
|
+
if (!query && CONFIG2.verbose) console.warn("Can't find query ", query);
|
|
1215
1130
|
let underMediaQuery = CSS_VARS2[`@media ${query}`];
|
|
1216
|
-
if (!underMediaQuery)
|
|
1217
|
-
underMediaQuery = CSS_VARS2[`@media ${query}`] = {};
|
|
1131
|
+
if (!underMediaQuery) underMediaQuery = CSS_VARS2[`@media ${query}`] = {};
|
|
1218
1132
|
underMediaQuery[item.variable] = `var(${item.variable + "_" + mediaName})`;
|
|
1219
1133
|
CSS_VARS2[item.variable + "_" + mediaName] = value;
|
|
1220
1134
|
}
|
|
@@ -1225,10 +1139,8 @@ var generateSprite = (icons) => {
|
|
|
1225
1139
|
const CONFIG2 = getActiveConfig();
|
|
1226
1140
|
let sprite = "";
|
|
1227
1141
|
for (const key in icons) {
|
|
1228
|
-
if (CONFIG2.__svg_cache[key])
|
|
1229
|
-
|
|
1230
|
-
else
|
|
1231
|
-
CONFIG2.__svg_cache[key] = true;
|
|
1142
|
+
if (CONFIG2.__svg_cache[key]) continue;
|
|
1143
|
+
else CONFIG2.__svg_cache[key] = true;
|
|
1232
1144
|
sprite += icons[key];
|
|
1233
1145
|
}
|
|
1234
1146
|
return sprite;
|