@symbo.ls/scratch 2.11.94 → 2.11.131
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/package.json +2 -2
- package/src/defaultConfig/index.js +1 -0
- package/src/defaultConfig/templates.js +3 -0
- package/LICENSE +0 -21
- package/dist/cjs/defaultConfig/animation.js +0 -26
- package/dist/cjs/defaultConfig/cases.js +0 -26
- package/dist/cjs/defaultConfig/color.js +0 -28
- package/dist/cjs/defaultConfig/document.js +0 -26
- package/dist/cjs/defaultConfig/font-family.js +0 -34
- package/dist/cjs/defaultConfig/font.js +0 -26
- package/dist/cjs/defaultConfig/icons.js +0 -26
- package/dist/cjs/defaultConfig/index.js +0 -217
- package/dist/cjs/defaultConfig/media.js +0 -51
- package/dist/cjs/defaultConfig/responsive.js +0 -50
- package/dist/cjs/defaultConfig/sequence.js +0 -51
- package/dist/cjs/defaultConfig/spacing.js +0 -85
- package/dist/cjs/defaultConfig/svg.js +0 -28
- package/dist/cjs/defaultConfig/theme.js +0 -26
- package/dist/cjs/defaultConfig/timing.js +0 -67
- package/dist/cjs/defaultConfig/typography.js +0 -71
- package/dist/cjs/defaultConfig/unit.js +0 -28
- package/dist/cjs/factory.js +0 -1331
- package/dist/cjs/index.js +0 -2911
- package/dist/cjs/package.json +0 -4
- package/dist/cjs/set.js +0 -2281
- package/dist/cjs/system/color.js +0 -1564
- package/dist/cjs/system/document.js +0 -1357
- package/dist/cjs/system/font.js +0 -1397
- package/dist/cjs/system/index.js +0 -2469
- package/dist/cjs/system/reset.js +0 -1466
- package/dist/cjs/system/spacing.js +0 -1641
- package/dist/cjs/system/svg.js +0 -1468
- package/dist/cjs/system/theme.js +0 -1652
- package/dist/cjs/system/timing.js +0 -1554
- package/dist/cjs/system/typography.js +0 -1607
- package/dist/cjs/tests/index.js +0 -30
- package/dist/cjs/transforms/index.js +0 -1830
- package/dist/cjs/utils/color.js +0 -1256
- package/dist/cjs/utils/font.js +0 -72
- package/dist/cjs/utils/index.js +0 -1830
- package/dist/cjs/utils/sequence.js +0 -1500
- package/dist/cjs/utils/sprite.js +0 -1375
- package/dist/cjs/utils/theme.js +0 -34
- package/dist/cjs/utils/var.js +0 -1356
package/dist/cjs/utils/index.js
DELETED
|
@@ -1,1830 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
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
|
-
var __export = (target, all) => {
|
|
12
|
-
for (var name in all)
|
|
13
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
14
|
-
};
|
|
15
|
-
var __copyProps = (to, from, except, desc) => {
|
|
16
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
17
|
-
for (let key of __getOwnPropNames(from))
|
|
18
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
19
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
20
|
-
}
|
|
21
|
-
return to;
|
|
22
|
-
};
|
|
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
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
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 __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: () => document3,
|
|
57
|
-
global: () => global,
|
|
58
|
-
self: () => self,
|
|
59
|
-
window: () => window2
|
|
60
|
-
});
|
|
61
|
-
module2.exports = __toCommonJS2(globals_exports);
|
|
62
|
-
var global = globalThis;
|
|
63
|
-
var self = globalThis;
|
|
64
|
-
var window2 = globalThis;
|
|
65
|
-
var document3 = window2.document;
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
// ../../node_modules/@domql/key/dist/cjs/index.js
|
|
70
|
-
var require_cjs2 = __commonJS({
|
|
71
|
-
"../../node_modules/@domql/key/dist/cjs/index.js"(exports, module2) {
|
|
72
|
-
"use strict";
|
|
73
|
-
var __defProp2 = Object.defineProperty;
|
|
74
|
-
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
75
|
-
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
76
|
-
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
77
|
-
var __export2 = (target, all) => {
|
|
78
|
-
for (var name in all)
|
|
79
|
-
__defProp2(target, name, { get: all[name], enumerable: true });
|
|
80
|
-
};
|
|
81
|
-
var __copyProps2 = (to, from, except, desc) => {
|
|
82
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
83
|
-
for (let key of __getOwnPropNames2(from))
|
|
84
|
-
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
85
|
-
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
86
|
-
}
|
|
87
|
-
return to;
|
|
88
|
-
};
|
|
89
|
-
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
90
|
-
var key_exports = {};
|
|
91
|
-
__export2(key_exports, {
|
|
92
|
-
createKey: () => createKey,
|
|
93
|
-
createSnapshotId: () => createSnapshotId
|
|
94
|
-
});
|
|
95
|
-
module2.exports = __toCommonJS2(key_exports);
|
|
96
|
-
var createKey = function() {
|
|
97
|
-
let index = 0;
|
|
98
|
-
function newId() {
|
|
99
|
-
index++;
|
|
100
|
-
return index;
|
|
101
|
-
}
|
|
102
|
-
return newId;
|
|
103
|
-
}();
|
|
104
|
-
var createSnapshotId = createKey;
|
|
105
|
-
}
|
|
106
|
-
});
|
|
107
|
-
|
|
108
|
-
// ../../node_modules/@domql/tags/dist/cjs/htmlTags.js
|
|
109
|
-
var require_htmlTags = __commonJS({
|
|
110
|
-
"../../node_modules/@domql/tags/dist/cjs/htmlTags.js"(exports, module2) {
|
|
111
|
-
"use strict";
|
|
112
|
-
var __defProp2 = Object.defineProperty;
|
|
113
|
-
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
114
|
-
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
115
|
-
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
116
|
-
var __export2 = (target, all) => {
|
|
117
|
-
for (var name in all)
|
|
118
|
-
__defProp2(target, name, { get: all[name], enumerable: true });
|
|
119
|
-
};
|
|
120
|
-
var __copyProps2 = (to, from, except, desc) => {
|
|
121
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
122
|
-
for (let key of __getOwnPropNames2(from))
|
|
123
|
-
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
124
|
-
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
125
|
-
}
|
|
126
|
-
return to;
|
|
127
|
-
};
|
|
128
|
-
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
129
|
-
var htmlTags_exports = {};
|
|
130
|
-
__export2(htmlTags_exports, {
|
|
131
|
-
HTML_TAGS: () => HTML_TAGS
|
|
132
|
-
});
|
|
133
|
-
module2.exports = __toCommonJS2(htmlTags_exports);
|
|
134
|
-
var HTML_TAGS = {
|
|
135
|
-
root: [
|
|
136
|
-
"body",
|
|
137
|
-
"html"
|
|
138
|
-
],
|
|
139
|
-
head: [
|
|
140
|
-
"title",
|
|
141
|
-
"base",
|
|
142
|
-
"meta",
|
|
143
|
-
"style"
|
|
144
|
-
],
|
|
145
|
-
body: [
|
|
146
|
-
"string",
|
|
147
|
-
"fragment",
|
|
148
|
-
"a",
|
|
149
|
-
"abbr",
|
|
150
|
-
"acronym",
|
|
151
|
-
"address",
|
|
152
|
-
"applet",
|
|
153
|
-
"area",
|
|
154
|
-
"article",
|
|
155
|
-
"aside",
|
|
156
|
-
"audio",
|
|
157
|
-
"b",
|
|
158
|
-
"basefont",
|
|
159
|
-
"bdi",
|
|
160
|
-
"bdo",
|
|
161
|
-
"big",
|
|
162
|
-
"blockquote",
|
|
163
|
-
"br",
|
|
164
|
-
"button",
|
|
165
|
-
"canvas",
|
|
166
|
-
"caption",
|
|
167
|
-
"center",
|
|
168
|
-
"cite",
|
|
169
|
-
"code",
|
|
170
|
-
"col",
|
|
171
|
-
"colgroup",
|
|
172
|
-
"data",
|
|
173
|
-
"datalist",
|
|
174
|
-
"dd",
|
|
175
|
-
"del",
|
|
176
|
-
"details",
|
|
177
|
-
"dfn",
|
|
178
|
-
"dialog",
|
|
179
|
-
"dir",
|
|
180
|
-
"div",
|
|
181
|
-
"dl",
|
|
182
|
-
"dt",
|
|
183
|
-
"em",
|
|
184
|
-
"embed",
|
|
185
|
-
"fieldset",
|
|
186
|
-
"figcaption",
|
|
187
|
-
"figure",
|
|
188
|
-
"font",
|
|
189
|
-
"footer",
|
|
190
|
-
"form",
|
|
191
|
-
"frame",
|
|
192
|
-
"frameset",
|
|
193
|
-
"h1",
|
|
194
|
-
"h2",
|
|
195
|
-
"h3",
|
|
196
|
-
"h4",
|
|
197
|
-
"h5",
|
|
198
|
-
"h6",
|
|
199
|
-
"head",
|
|
200
|
-
"header",
|
|
201
|
-
"hr",
|
|
202
|
-
"i",
|
|
203
|
-
"iframe",
|
|
204
|
-
"img",
|
|
205
|
-
"input",
|
|
206
|
-
"ins",
|
|
207
|
-
"kbd",
|
|
208
|
-
"label",
|
|
209
|
-
"legend",
|
|
210
|
-
"li",
|
|
211
|
-
"link",
|
|
212
|
-
"main",
|
|
213
|
-
"map",
|
|
214
|
-
"mark",
|
|
215
|
-
"meter",
|
|
216
|
-
"nav",
|
|
217
|
-
"noframes",
|
|
218
|
-
"noscript",
|
|
219
|
-
"object",
|
|
220
|
-
"ol",
|
|
221
|
-
"optgroup",
|
|
222
|
-
"option",
|
|
223
|
-
"output",
|
|
224
|
-
"p",
|
|
225
|
-
"param",
|
|
226
|
-
"picture",
|
|
227
|
-
"pre",
|
|
228
|
-
"progress",
|
|
229
|
-
"q",
|
|
230
|
-
"rp",
|
|
231
|
-
"rt",
|
|
232
|
-
"ruby",
|
|
233
|
-
"s",
|
|
234
|
-
"samp",
|
|
235
|
-
"script",
|
|
236
|
-
"section",
|
|
237
|
-
"select",
|
|
238
|
-
"small",
|
|
239
|
-
"source",
|
|
240
|
-
"span",
|
|
241
|
-
"strike",
|
|
242
|
-
"strong",
|
|
243
|
-
"sub",
|
|
244
|
-
"summary",
|
|
245
|
-
"sup",
|
|
246
|
-
"table",
|
|
247
|
-
"tbody",
|
|
248
|
-
"td",
|
|
249
|
-
"template",
|
|
250
|
-
"textarea",
|
|
251
|
-
"tfoot",
|
|
252
|
-
"th",
|
|
253
|
-
"thead",
|
|
254
|
-
"time",
|
|
255
|
-
"tr",
|
|
256
|
-
"track",
|
|
257
|
-
"tt",
|
|
258
|
-
"u",
|
|
259
|
-
"ul",
|
|
260
|
-
"var",
|
|
261
|
-
"video",
|
|
262
|
-
"wbr",
|
|
263
|
-
// SVG
|
|
264
|
-
"svg",
|
|
265
|
-
"path"
|
|
266
|
-
]
|
|
267
|
-
};
|
|
268
|
-
}
|
|
269
|
-
});
|
|
270
|
-
|
|
271
|
-
// ../../node_modules/@domql/tags/dist/cjs/index.js
|
|
272
|
-
var require_cjs3 = __commonJS({
|
|
273
|
-
"../../node_modules/@domql/tags/dist/cjs/index.js"(exports, module2) {
|
|
274
|
-
"use strict";
|
|
275
|
-
var __defProp2 = Object.defineProperty;
|
|
276
|
-
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
277
|
-
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
278
|
-
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
279
|
-
var __copyProps2 = (to, from, except, desc) => {
|
|
280
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
281
|
-
for (let key of __getOwnPropNames2(from))
|
|
282
|
-
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
283
|
-
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
284
|
-
}
|
|
285
|
-
return to;
|
|
286
|
-
};
|
|
287
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps2(target, mod, "default"), secondTarget && __copyProps2(secondTarget, mod, "default"));
|
|
288
|
-
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
289
|
-
var tags_exports = {};
|
|
290
|
-
module2.exports = __toCommonJS2(tags_exports);
|
|
291
|
-
__reExport(tags_exports, require_htmlTags(), module2.exports);
|
|
292
|
-
}
|
|
293
|
-
});
|
|
294
|
-
|
|
295
|
-
// ../../node_modules/@domql/utils/dist/cjs/node.js
|
|
296
|
-
var require_node = __commonJS({
|
|
297
|
-
"../../node_modules/@domql/utils/dist/cjs/node.js"(exports, module2) {
|
|
298
|
-
"use strict";
|
|
299
|
-
var __defProp2 = Object.defineProperty;
|
|
300
|
-
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
301
|
-
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
302
|
-
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
303
|
-
var __export2 = (target, all) => {
|
|
304
|
-
for (var name in all)
|
|
305
|
-
__defProp2(target, name, { get: all[name], enumerable: true });
|
|
306
|
-
};
|
|
307
|
-
var __copyProps2 = (to, from, except, desc) => {
|
|
308
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
309
|
-
for (let key of __getOwnPropNames2(from))
|
|
310
|
-
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
311
|
-
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
312
|
-
}
|
|
313
|
-
return to;
|
|
314
|
-
};
|
|
315
|
-
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
316
|
-
var node_exports = {};
|
|
317
|
-
__export2(node_exports, {
|
|
318
|
-
isHtmlElement: () => isHtmlElement,
|
|
319
|
-
isNode: () => isNode
|
|
320
|
-
});
|
|
321
|
-
module2.exports = __toCommonJS2(node_exports);
|
|
322
|
-
var import_globals2 = require_cjs();
|
|
323
|
-
var isNode = (obj) => {
|
|
324
|
-
return (typeof Node === "object" ? obj instanceof import_globals2.window.Node : obj && typeof obj === "object" && typeof obj.nodeType === "number" && typeof obj.nodeName === "string") || false;
|
|
325
|
-
};
|
|
326
|
-
var isHtmlElement = (obj) => {
|
|
327
|
-
return (typeof HTMLElement === "object" ? obj instanceof import_globals2.window.HTMLElement : obj && typeof obj === "object" && obj !== null && obj.nodeType === 1 && typeof obj.nodeName === "string") || false;
|
|
328
|
-
};
|
|
329
|
-
}
|
|
330
|
-
});
|
|
331
|
-
|
|
332
|
-
// ../../node_modules/@domql/utils/dist/cjs/types.js
|
|
333
|
-
var require_types = __commonJS({
|
|
334
|
-
"../../node_modules/@domql/utils/dist/cjs/types.js"(exports, module2) {
|
|
335
|
-
"use strict";
|
|
336
|
-
var __defProp2 = Object.defineProperty;
|
|
337
|
-
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
338
|
-
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
339
|
-
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
340
|
-
var __export2 = (target, all) => {
|
|
341
|
-
for (var name in all)
|
|
342
|
-
__defProp2(target, name, { get: all[name], enumerable: true });
|
|
343
|
-
};
|
|
344
|
-
var __copyProps2 = (to, from, except, desc) => {
|
|
345
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
346
|
-
for (let key of __getOwnPropNames2(from))
|
|
347
|
-
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
348
|
-
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
349
|
-
}
|
|
350
|
-
return to;
|
|
351
|
-
};
|
|
352
|
-
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
353
|
-
var types_exports = {};
|
|
354
|
-
__export2(types_exports, {
|
|
355
|
-
TYPES: () => TYPES,
|
|
356
|
-
is: () => is,
|
|
357
|
-
isArray: () => isArray4,
|
|
358
|
-
isBoolean: () => isBoolean,
|
|
359
|
-
isDefined: () => isDefined2,
|
|
360
|
-
isFunction: () => isFunction,
|
|
361
|
-
isNot: () => isNot,
|
|
362
|
-
isNull: () => isNull,
|
|
363
|
-
isNumber: () => isNumber2,
|
|
364
|
-
isObject: () => isObject4,
|
|
365
|
-
isObjectLike: () => isObjectLike2,
|
|
366
|
-
isString: () => isString5,
|
|
367
|
-
isUndefined: () => isUndefined,
|
|
368
|
-
isValidHtmlTag: () => isValidHtmlTag
|
|
369
|
-
});
|
|
370
|
-
module2.exports = __toCommonJS2(types_exports);
|
|
371
|
-
var import_tags = require_cjs3();
|
|
372
|
-
var import_node = require_node();
|
|
373
|
-
var isValidHtmlTag = (arg) => import_tags.HTML_TAGS.body.includes(arg);
|
|
374
|
-
var isObject4 = (arg) => {
|
|
375
|
-
if (arg === null)
|
|
376
|
-
return false;
|
|
377
|
-
return typeof arg === "object" && arg.constructor === Object;
|
|
378
|
-
};
|
|
379
|
-
var isString5 = (arg) => typeof arg === "string";
|
|
380
|
-
var isNumber2 = (arg) => typeof arg === "number";
|
|
381
|
-
var isFunction = (arg) => typeof arg === "function";
|
|
382
|
-
var isBoolean = (arg) => arg === true || arg === false;
|
|
383
|
-
var isNull = (arg) => arg === null;
|
|
384
|
-
var isArray4 = (arg) => Array.isArray(arg);
|
|
385
|
-
var isObjectLike2 = (arg) => {
|
|
386
|
-
if (arg === null)
|
|
387
|
-
return false;
|
|
388
|
-
return typeof arg === "object";
|
|
389
|
-
};
|
|
390
|
-
var isDefined2 = (arg) => {
|
|
391
|
-
return isObject4(arg) || isObjectLike2(arg) || isString5(arg) || isNumber2(arg) || isFunction(arg) || isArray4(arg) || isObjectLike2(arg) || isBoolean(arg) || isNull(arg);
|
|
392
|
-
};
|
|
393
|
-
var isUndefined = (arg) => {
|
|
394
|
-
return arg === void 0;
|
|
395
|
-
};
|
|
396
|
-
var TYPES = {
|
|
397
|
-
boolean: isBoolean,
|
|
398
|
-
array: isArray4,
|
|
399
|
-
object: isObject4,
|
|
400
|
-
string: isString5,
|
|
401
|
-
number: isNumber2,
|
|
402
|
-
null: isNull,
|
|
403
|
-
function: isFunction,
|
|
404
|
-
objectLike: isObjectLike2,
|
|
405
|
-
node: import_node.isNode,
|
|
406
|
-
htmlElement: import_node.isHtmlElement,
|
|
407
|
-
defined: isDefined2
|
|
408
|
-
};
|
|
409
|
-
var is = (arg) => {
|
|
410
|
-
return (...args) => {
|
|
411
|
-
return args.map((val) => TYPES[val](arg)).filter((v) => v).length > 0;
|
|
412
|
-
};
|
|
413
|
-
};
|
|
414
|
-
var isNot = (arg) => {
|
|
415
|
-
return (...args) => {
|
|
416
|
-
return args.map((val) => TYPES[val](arg)).filter((v) => v).length === 0;
|
|
417
|
-
};
|
|
418
|
-
};
|
|
419
|
-
}
|
|
420
|
-
});
|
|
421
|
-
|
|
422
|
-
// ../../node_modules/@domql/utils/dist/cjs/array.js
|
|
423
|
-
var require_array = __commonJS({
|
|
424
|
-
"../../node_modules/@domql/utils/dist/cjs/array.js"(exports, module2) {
|
|
425
|
-
"use strict";
|
|
426
|
-
var __defProp2 = Object.defineProperty;
|
|
427
|
-
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
428
|
-
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
429
|
-
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
430
|
-
var __export2 = (target, all) => {
|
|
431
|
-
for (var name in all)
|
|
432
|
-
__defProp2(target, name, { get: all[name], enumerable: true });
|
|
433
|
-
};
|
|
434
|
-
var __copyProps2 = (to, from, except, desc) => {
|
|
435
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
436
|
-
for (let key of __getOwnPropNames2(from))
|
|
437
|
-
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
438
|
-
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
439
|
-
}
|
|
440
|
-
return to;
|
|
441
|
-
};
|
|
442
|
-
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
443
|
-
var array_exports = {};
|
|
444
|
-
__export2(array_exports, {
|
|
445
|
-
arrayContainsOtherArray: () => arrayContainsOtherArray,
|
|
446
|
-
createNestedObject: () => createNestedObject,
|
|
447
|
-
cutArrayAfterValue: () => cutArrayAfterValue,
|
|
448
|
-
cutArrayBeforeValue: () => cutArrayBeforeValue,
|
|
449
|
-
joinArrays: () => joinArrays,
|
|
450
|
-
mergeAndCloneIfArray: () => mergeAndCloneIfArray,
|
|
451
|
-
mergeArray: () => mergeArray,
|
|
452
|
-
removeFromArray: () => removeFromArray,
|
|
453
|
-
swapItemsInArray: () => swapItemsInArray
|
|
454
|
-
});
|
|
455
|
-
module2.exports = __toCommonJS2(array_exports);
|
|
456
|
-
var import_object = require_object();
|
|
457
|
-
var import_types = require_types();
|
|
458
|
-
var arrayContainsOtherArray = (arr1, arr2) => {
|
|
459
|
-
return arr2.every((val) => arr1.includes(val));
|
|
460
|
-
};
|
|
461
|
-
var removeFromArray = (arr, index) => {
|
|
462
|
-
if ((0, import_types.isString)(index))
|
|
463
|
-
index = parseInt(index);
|
|
464
|
-
if ((0, import_types.isNumber)(index)) {
|
|
465
|
-
if (index < 0 || index >= arr.length || isNaN(index)) {
|
|
466
|
-
throw new Error("Invalid index");
|
|
467
|
-
}
|
|
468
|
-
arr.splice(index, 1);
|
|
469
|
-
} else if ((0, import_types.isArray)(index)) {
|
|
470
|
-
index.forEach((idx) => removeFromArray(arr, idx));
|
|
471
|
-
} else {
|
|
472
|
-
throw new Error("Invalid index");
|
|
473
|
-
}
|
|
474
|
-
return arr;
|
|
475
|
-
};
|
|
476
|
-
var swapItemsInArray = (arr, i, j) => {
|
|
477
|
-
[arr[i], arr[j]] = [arr[j], arr[i]];
|
|
478
|
-
};
|
|
479
|
-
var joinArrays = (...arrays) => {
|
|
480
|
-
return [].concat(...arrays);
|
|
481
|
-
};
|
|
482
|
-
var mergeArray = (arr, excludeFrom = []) => {
|
|
483
|
-
return arr.reduce((a, c) => (0, import_object.deepMerge)(a, (0, import_object.deepClone)(c, excludeFrom), excludeFrom), {});
|
|
484
|
-
};
|
|
485
|
-
var mergeAndCloneIfArray = (obj) => {
|
|
486
|
-
return (0, import_types.isArray)(obj) ? mergeArray(obj) : (0, import_object.deepClone)(obj);
|
|
487
|
-
};
|
|
488
|
-
var cutArrayBeforeValue = (arr, value) => {
|
|
489
|
-
const index = arr.indexOf(value);
|
|
490
|
-
if (index !== -1) {
|
|
491
|
-
return arr.slice(0, index);
|
|
492
|
-
}
|
|
493
|
-
return arr;
|
|
494
|
-
};
|
|
495
|
-
var cutArrayAfterValue = (arr, value) => {
|
|
496
|
-
const index = arr.indexOf(value);
|
|
497
|
-
if (index !== -1) {
|
|
498
|
-
return arr.slice(index + 1);
|
|
499
|
-
}
|
|
500
|
-
return arr;
|
|
501
|
-
};
|
|
502
|
-
var createNestedObject = (arr, lastValue) => {
|
|
503
|
-
let nestedObject = {};
|
|
504
|
-
if (arr.length === 0) {
|
|
505
|
-
return lastValue;
|
|
506
|
-
}
|
|
507
|
-
arr.reduce((obj, value, index) => {
|
|
508
|
-
if (!obj[value]) {
|
|
509
|
-
obj[value] = {};
|
|
510
|
-
}
|
|
511
|
-
if (index === arr.length - 1 && lastValue) {
|
|
512
|
-
obj[value] = lastValue;
|
|
513
|
-
}
|
|
514
|
-
return obj[value];
|
|
515
|
-
}, nestedObject);
|
|
516
|
-
return nestedObject;
|
|
517
|
-
};
|
|
518
|
-
}
|
|
519
|
-
});
|
|
520
|
-
|
|
521
|
-
// ../../node_modules/@domql/utils/dist/cjs/string.js
|
|
522
|
-
var require_string = __commonJS({
|
|
523
|
-
"../../node_modules/@domql/utils/dist/cjs/string.js"(exports, module2) {
|
|
524
|
-
"use strict";
|
|
525
|
-
var __defProp2 = Object.defineProperty;
|
|
526
|
-
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
527
|
-
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
528
|
-
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
529
|
-
var __export2 = (target, all) => {
|
|
530
|
-
for (var name in all)
|
|
531
|
-
__defProp2(target, name, { get: all[name], enumerable: true });
|
|
532
|
-
};
|
|
533
|
-
var __copyProps2 = (to, from, except, desc) => {
|
|
534
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
535
|
-
for (let key of __getOwnPropNames2(from))
|
|
536
|
-
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
537
|
-
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
538
|
-
}
|
|
539
|
-
return to;
|
|
540
|
-
};
|
|
541
|
-
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
542
|
-
var string_exports = {};
|
|
543
|
-
__export2(string_exports, {
|
|
544
|
-
stringIncludesAny: () => stringIncludesAny
|
|
545
|
-
});
|
|
546
|
-
module2.exports = __toCommonJS2(string_exports);
|
|
547
|
-
var stringIncludesAny = (str, characters) => {
|
|
548
|
-
for (const char of characters) {
|
|
549
|
-
if (str.includes(char)) {
|
|
550
|
-
return true;
|
|
551
|
-
}
|
|
552
|
-
}
|
|
553
|
-
return false;
|
|
554
|
-
};
|
|
555
|
-
}
|
|
556
|
-
});
|
|
557
|
-
|
|
558
|
-
// ../../node_modules/@domql/utils/dist/cjs/object.js
|
|
559
|
-
var require_object = __commonJS({
|
|
560
|
-
"../../node_modules/@domql/utils/dist/cjs/object.js"(exports, module2) {
|
|
561
|
-
"use strict";
|
|
562
|
-
var __defProp2 = Object.defineProperty;
|
|
563
|
-
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
564
|
-
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
565
|
-
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
566
|
-
var __export2 = (target, all) => {
|
|
567
|
-
for (var name in all)
|
|
568
|
-
__defProp2(target, name, { get: all[name], enumerable: true });
|
|
569
|
-
};
|
|
570
|
-
var __copyProps2 = (to, from, except, desc) => {
|
|
571
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
572
|
-
for (let key of __getOwnPropNames2(from))
|
|
573
|
-
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
574
|
-
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
575
|
-
}
|
|
576
|
-
return to;
|
|
577
|
-
};
|
|
578
|
-
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
579
|
-
var object_exports = {};
|
|
580
|
-
__export2(object_exports, {
|
|
581
|
-
clone: () => clone,
|
|
582
|
-
deepClone: () => deepClone2,
|
|
583
|
-
deepCloneExclude: () => deepCloneExclude,
|
|
584
|
-
deepDestringify: () => deepDestringify,
|
|
585
|
-
deepMerge: () => deepMerge2,
|
|
586
|
-
deepStringify: () => deepStringify,
|
|
587
|
-
detachFunctionsFromObject: () => detachFunctionsFromObject,
|
|
588
|
-
diff: () => diff,
|
|
589
|
-
diffArrays: () => diffArrays,
|
|
590
|
-
diffObjects: () => diffObjects,
|
|
591
|
-
exec: () => exec,
|
|
592
|
-
flattenRecursive: () => flattenRecursive,
|
|
593
|
-
isEqualDeep: () => isEqualDeep,
|
|
594
|
-
map: () => map,
|
|
595
|
-
merge: () => merge,
|
|
596
|
-
mergeArrayExclude: () => mergeArrayExclude,
|
|
597
|
-
mergeIfExisted: () => mergeIfExisted,
|
|
598
|
-
objectToString: () => objectToString,
|
|
599
|
-
overwrite: () => overwrite,
|
|
600
|
-
overwriteDeep: () => overwriteDeep,
|
|
601
|
-
overwriteShallow: () => overwriteShallow,
|
|
602
|
-
removeFromObject: () => removeFromObject,
|
|
603
|
-
stringToObject: () => stringToObject
|
|
604
|
-
});
|
|
605
|
-
module2.exports = __toCommonJS2(object_exports);
|
|
606
|
-
var import_globals2 = require_cjs();
|
|
607
|
-
var import_types = require_types();
|
|
608
|
-
var import_array = require_array();
|
|
609
|
-
var import_string = require_string();
|
|
610
|
-
var exec = (param, element, state, context) => {
|
|
611
|
-
if ((0, import_types.isFunction)(param)) {
|
|
612
|
-
return param(
|
|
613
|
-
element,
|
|
614
|
-
state || element.state,
|
|
615
|
-
context || element.context
|
|
616
|
-
);
|
|
617
|
-
}
|
|
618
|
-
return param;
|
|
619
|
-
};
|
|
620
|
-
var map = (obj, extention, element) => {
|
|
621
|
-
for (const e in extention) {
|
|
622
|
-
obj[e] = exec(extention[e], element);
|
|
623
|
-
}
|
|
624
|
-
};
|
|
625
|
-
var merge = (element, obj, excludeFrom = []) => {
|
|
626
|
-
for (const e in obj) {
|
|
627
|
-
if (excludeFrom.includes(e) || e.startsWith("__"))
|
|
628
|
-
continue;
|
|
629
|
-
const elementProp = element[e];
|
|
630
|
-
const objProp = obj[e];
|
|
631
|
-
if (elementProp === void 0) {
|
|
632
|
-
element[e] = objProp;
|
|
633
|
-
}
|
|
634
|
-
}
|
|
635
|
-
return element;
|
|
636
|
-
};
|
|
637
|
-
var deepMerge2 = (element, extend, excludeFrom = []) => {
|
|
638
|
-
for (const e in extend) {
|
|
639
|
-
if (excludeFrom.includes(e) || e.startsWith("__"))
|
|
640
|
-
continue;
|
|
641
|
-
const elementProp = element[e];
|
|
642
|
-
const extendProp = extend[e];
|
|
643
|
-
if ((0, import_types.isObjectLike)(elementProp) && (0, import_types.isObjectLike)(extendProp)) {
|
|
644
|
-
deepMerge2(elementProp, extendProp);
|
|
645
|
-
} else if (elementProp === void 0) {
|
|
646
|
-
element[e] = extendProp;
|
|
647
|
-
}
|
|
648
|
-
}
|
|
649
|
-
return element;
|
|
650
|
-
};
|
|
651
|
-
var clone = (obj, excludeFrom = []) => {
|
|
652
|
-
const o = {};
|
|
653
|
-
for (const prop in obj) {
|
|
654
|
-
if (excludeFrom.includes(prop) || prop.startsWith("__"))
|
|
655
|
-
continue;
|
|
656
|
-
o[prop] = obj[prop];
|
|
657
|
-
}
|
|
658
|
-
return o;
|
|
659
|
-
};
|
|
660
|
-
var deepCloneExclude = (obj, excludeFrom = []) => {
|
|
661
|
-
if ((0, import_types.isArray)(obj)) {
|
|
662
|
-
return obj.map((x) => deepCloneExclude(x, excludeFrom));
|
|
663
|
-
}
|
|
664
|
-
const o = {};
|
|
665
|
-
for (const k in obj) {
|
|
666
|
-
if (excludeFrom.includes(k) || k.startsWith("__"))
|
|
667
|
-
continue;
|
|
668
|
-
let v = obj[k];
|
|
669
|
-
if (k === "extend" && (0, import_types.isArray)(v)) {
|
|
670
|
-
v = mergeArrayExclude(v, excludeFrom);
|
|
671
|
-
}
|
|
672
|
-
if ((0, import_types.isArray)(v)) {
|
|
673
|
-
o[k] = v.map((x) => deepCloneExclude(x, excludeFrom));
|
|
674
|
-
} else if ((0, import_types.isObject)(v)) {
|
|
675
|
-
o[k] = deepCloneExclude(v, excludeFrom);
|
|
676
|
-
} else
|
|
677
|
-
o[k] = v;
|
|
678
|
-
}
|
|
679
|
-
return o;
|
|
680
|
-
};
|
|
681
|
-
var mergeArrayExclude = (arr, excl = []) => {
|
|
682
|
-
return arr.reduce((acc, curr) => deepMerge2(acc, deepCloneExclude(curr, excl)), {});
|
|
683
|
-
};
|
|
684
|
-
var deepClone2 = (obj, excludeFrom = []) => {
|
|
685
|
-
const o = (0, import_types.isArray)(obj) ? [] : {};
|
|
686
|
-
for (const prop in obj) {
|
|
687
|
-
if (excludeFrom.includes(prop) || prop.startsWith("__"))
|
|
688
|
-
continue;
|
|
689
|
-
let objProp = obj[prop];
|
|
690
|
-
if (prop === "extend" && (0, import_types.isArray)(objProp)) {
|
|
691
|
-
objProp = (0, import_array.mergeArray)(objProp);
|
|
692
|
-
}
|
|
693
|
-
if ((0, import_types.isObjectLike)(objProp)) {
|
|
694
|
-
o[prop] = deepClone2(objProp, excludeFrom);
|
|
695
|
-
} else
|
|
696
|
-
o[prop] = objProp;
|
|
697
|
-
}
|
|
698
|
-
return o;
|
|
699
|
-
};
|
|
700
|
-
var deepStringify = (obj, stringified = {}) => {
|
|
701
|
-
for (const prop in obj) {
|
|
702
|
-
const objProp = obj[prop];
|
|
703
|
-
if ((0, import_types.isFunction)(objProp)) {
|
|
704
|
-
stringified[prop] = objProp.toString();
|
|
705
|
-
} else if ((0, import_types.isObject)(objProp)) {
|
|
706
|
-
stringified[prop] = {};
|
|
707
|
-
deepStringify(objProp, stringified[prop]);
|
|
708
|
-
} else if ((0, import_types.isArray)(objProp)) {
|
|
709
|
-
stringified[prop] = [];
|
|
710
|
-
objProp.forEach((v, i) => {
|
|
711
|
-
if ((0, import_types.isObject)(v)) {
|
|
712
|
-
stringified[prop][i] = {};
|
|
713
|
-
deepStringify(v, stringified[prop][i]);
|
|
714
|
-
} else if ((0, import_types.isFunction)(v)) {
|
|
715
|
-
stringified[prop][i] = v.toString();
|
|
716
|
-
} else {
|
|
717
|
-
stringified[prop][i] = v;
|
|
718
|
-
}
|
|
719
|
-
});
|
|
720
|
-
} else {
|
|
721
|
-
stringified[prop] = objProp;
|
|
722
|
-
}
|
|
723
|
-
}
|
|
724
|
-
return stringified;
|
|
725
|
-
};
|
|
726
|
-
var objectToString = (obj, indent = 0) => {
|
|
727
|
-
const spaces = " ".repeat(indent);
|
|
728
|
-
let str = "{\n";
|
|
729
|
-
for (const [key, value] of Object.entries(obj)) {
|
|
730
|
-
const keyAllowdChars = (0, import_string.stringIncludesAny)(key, ["-", ":", "@", ".", "!"]);
|
|
731
|
-
const stringedKey = keyAllowdChars ? `'${key}'` : key;
|
|
732
|
-
str += `${spaces} ${stringedKey}: `;
|
|
733
|
-
if ((0, import_types.isArray)(value)) {
|
|
734
|
-
str += "[\n";
|
|
735
|
-
for (const element of value) {
|
|
736
|
-
if ((0, import_types.isObject)(element) && element !== null) {
|
|
737
|
-
str += `${spaces} ${objectToString(element, indent + 2)},
|
|
738
|
-
`;
|
|
739
|
-
} else if ((0, import_types.isString)(element)) {
|
|
740
|
-
str += `${spaces} '${element}',
|
|
741
|
-
`;
|
|
742
|
-
} else {
|
|
743
|
-
str += `${spaces} ${element},
|
|
744
|
-
`;
|
|
745
|
-
}
|
|
746
|
-
}
|
|
747
|
-
str += `${spaces} ]`;
|
|
748
|
-
} else if ((0, import_types.isObject)(value)) {
|
|
749
|
-
str += objectToString(value, indent + 1);
|
|
750
|
-
} else if ((0, import_types.isString)(value)) {
|
|
751
|
-
str += (0, import_string.stringIncludesAny)(value, ["\n", "'"]) ? `\`${value}\`` : `'${value}'`;
|
|
752
|
-
} else {
|
|
753
|
-
str += value;
|
|
754
|
-
}
|
|
755
|
-
str += ",\n";
|
|
756
|
-
}
|
|
757
|
-
str += `${spaces}}`;
|
|
758
|
-
return str;
|
|
759
|
-
};
|
|
760
|
-
var detachFunctionsFromObject = (obj, detached = {}) => {
|
|
761
|
-
for (const prop in obj) {
|
|
762
|
-
const objProp = obj[prop];
|
|
763
|
-
if ((0, import_types.isFunction)(objProp))
|
|
764
|
-
continue;
|
|
765
|
-
else if ((0, import_types.isObject)(objProp)) {
|
|
766
|
-
detached[prop] = {};
|
|
767
|
-
deepStringify(objProp, detached[prop]);
|
|
768
|
-
} else if ((0, import_types.isArray)(objProp)) {
|
|
769
|
-
detached[prop] = [];
|
|
770
|
-
objProp.forEach((v, i) => {
|
|
771
|
-
if ((0, import_types.isFunction)(v))
|
|
772
|
-
return;
|
|
773
|
-
if ((0, import_types.isObject)(v)) {
|
|
774
|
-
detached[prop][i] = {};
|
|
775
|
-
detachFunctionsFromObject(v, detached[prop][i]);
|
|
776
|
-
} else {
|
|
777
|
-
detached[prop][i] = v;
|
|
778
|
-
}
|
|
779
|
-
});
|
|
780
|
-
} else {
|
|
781
|
-
detached[prop] = objProp;
|
|
782
|
-
}
|
|
783
|
-
}
|
|
784
|
-
return detached;
|
|
785
|
-
};
|
|
786
|
-
var deepDestringify = (obj, stringified = {}) => {
|
|
787
|
-
for (const prop in obj) {
|
|
788
|
-
const objProp = obj[prop];
|
|
789
|
-
if ((0, import_types.isString)(objProp)) {
|
|
790
|
-
if (objProp.includes("=>") || objProp.includes("function") || objProp.startsWith("(")) {
|
|
791
|
-
try {
|
|
792
|
-
const evalProp = import_globals2.window.eval(`(${objProp})`);
|
|
793
|
-
stringified[prop] = evalProp;
|
|
794
|
-
} catch (e) {
|
|
795
|
-
if (e)
|
|
796
|
-
stringified[prop] = objProp;
|
|
797
|
-
}
|
|
798
|
-
} else {
|
|
799
|
-
stringified[prop] = objProp;
|
|
800
|
-
}
|
|
801
|
-
} else if ((0, import_types.isArray)(objProp)) {
|
|
802
|
-
stringified[prop] = [];
|
|
803
|
-
objProp.forEach((arrProp) => {
|
|
804
|
-
if ((0, import_types.isString)(arrProp)) {
|
|
805
|
-
if (arrProp.includes("=>") || arrProp.includes("function") || arrProp.startsWith("(")) {
|
|
806
|
-
try {
|
|
807
|
-
const evalProp = import_globals2.window.eval(`(${arrProp})`);
|
|
808
|
-
stringified[prop].push(evalProp);
|
|
809
|
-
} catch (e) {
|
|
810
|
-
if (e)
|
|
811
|
-
stringified[prop].push(arrProp);
|
|
812
|
-
}
|
|
813
|
-
} else {
|
|
814
|
-
stringified[prop].push(arrProp);
|
|
815
|
-
}
|
|
816
|
-
} else if ((0, import_types.isObject)(arrProp)) {
|
|
817
|
-
stringified[prop].push(deepDestringify(arrProp));
|
|
818
|
-
} else {
|
|
819
|
-
stringified[prop].push(arrProp);
|
|
820
|
-
}
|
|
821
|
-
});
|
|
822
|
-
} else if ((0, import_types.isObject)(objProp)) {
|
|
823
|
-
stringified[prop] = deepDestringify(objProp, stringified[prop]);
|
|
824
|
-
} else {
|
|
825
|
-
stringified[prop] = objProp;
|
|
826
|
-
}
|
|
827
|
-
}
|
|
828
|
-
return stringified;
|
|
829
|
-
};
|
|
830
|
-
var stringToObject = (str) => {
|
|
831
|
-
let obj;
|
|
832
|
-
try {
|
|
833
|
-
obj = import_globals2.window.eval("(" + str + ")");
|
|
834
|
-
} catch (e) {
|
|
835
|
-
console.warn(e);
|
|
836
|
-
}
|
|
837
|
-
if (obj)
|
|
838
|
-
return obj;
|
|
839
|
-
};
|
|
840
|
-
var diffObjects = (original, objToDiff, cache) => {
|
|
841
|
-
for (const e in objToDiff) {
|
|
842
|
-
if (e === "ref")
|
|
843
|
-
continue;
|
|
844
|
-
const originalProp = original[e];
|
|
845
|
-
const objToDiffProp = objToDiff[e];
|
|
846
|
-
if ((0, import_types.isObject)(originalProp) && (0, import_types.isObject)(objToDiffProp)) {
|
|
847
|
-
cache[e] = {};
|
|
848
|
-
diff(originalProp, objToDiffProp, cache[e]);
|
|
849
|
-
} else if (objToDiffProp !== void 0) {
|
|
850
|
-
cache[e] = objToDiffProp;
|
|
851
|
-
}
|
|
852
|
-
}
|
|
853
|
-
return cache;
|
|
854
|
-
};
|
|
855
|
-
var diffArrays = (original, objToDiff, cache) => {
|
|
856
|
-
if (original.length !== objToDiff.length) {
|
|
857
|
-
cache = objToDiff;
|
|
858
|
-
} else {
|
|
859
|
-
const diffArr = [];
|
|
860
|
-
for (let i = 0; i < original.length; i++) {
|
|
861
|
-
const diffObj = diff(original[i], objToDiff[i]);
|
|
862
|
-
if (Object.keys(diffObj).length > 0) {
|
|
863
|
-
diffArr.push(diffObj);
|
|
864
|
-
}
|
|
865
|
-
}
|
|
866
|
-
if (diffArr.length > 0) {
|
|
867
|
-
cache = diffArr;
|
|
868
|
-
}
|
|
869
|
-
}
|
|
870
|
-
return cache;
|
|
871
|
-
};
|
|
872
|
-
var diff = (original, objToDiff, cache = {}) => {
|
|
873
|
-
if ((0, import_types.isArray)(original) && (0, import_types.isArray)(objToDiff)) {
|
|
874
|
-
cache = [];
|
|
875
|
-
diffArrays(original, objToDiff, cache);
|
|
876
|
-
} else {
|
|
877
|
-
diffObjects(original, objToDiff, cache);
|
|
878
|
-
}
|
|
879
|
-
return cache;
|
|
880
|
-
};
|
|
881
|
-
var overwrite = (element, params, excludeFrom = []) => {
|
|
882
|
-
const { ref } = element;
|
|
883
|
-
const changes = {};
|
|
884
|
-
for (const e in params) {
|
|
885
|
-
if (excludeFrom.includes(e) || e.startsWith("__"))
|
|
886
|
-
continue;
|
|
887
|
-
const elementProp = element[e];
|
|
888
|
-
const paramsProp = params[e];
|
|
889
|
-
if (paramsProp) {
|
|
890
|
-
ref.__cache[e] = changes[e] = elementProp;
|
|
891
|
-
ref[e] = paramsProp;
|
|
892
|
-
}
|
|
893
|
-
}
|
|
894
|
-
return changes;
|
|
895
|
-
};
|
|
896
|
-
var overwriteShallow = (obj, params, excludeFrom = []) => {
|
|
897
|
-
for (const e in params) {
|
|
898
|
-
if (excludeFrom.includes(e) || e.startsWith("__"))
|
|
899
|
-
continue;
|
|
900
|
-
obj[e] = params[e];
|
|
901
|
-
}
|
|
902
|
-
return obj;
|
|
903
|
-
};
|
|
904
|
-
var overwriteDeep = (obj, params, excludeFrom = []) => {
|
|
905
|
-
for (const e in params) {
|
|
906
|
-
if (excludeFrom.includes(e) || e.startsWith("__"))
|
|
907
|
-
continue;
|
|
908
|
-
const objProp = obj[e];
|
|
909
|
-
const paramsProp = params[e];
|
|
910
|
-
if ((0, import_types.isObjectLike)(objProp) && (0, import_types.isObjectLike)(paramsProp)) {
|
|
911
|
-
overwriteDeep(objProp, paramsProp);
|
|
912
|
-
} else if (paramsProp !== void 0) {
|
|
913
|
-
obj[e] = paramsProp;
|
|
914
|
-
}
|
|
915
|
-
}
|
|
916
|
-
return obj;
|
|
917
|
-
};
|
|
918
|
-
var mergeIfExisted = (a, b) => {
|
|
919
|
-
if ((0, import_types.isObjectLike)(a) && (0, import_types.isObjectLike)(b))
|
|
920
|
-
return deepMerge2(a, b);
|
|
921
|
-
return a || b;
|
|
922
|
-
};
|
|
923
|
-
var flattenRecursive = (param, prop, stack = []) => {
|
|
924
|
-
const objectized = (0, import_array.mergeAndCloneIfArray)(param);
|
|
925
|
-
stack.push(objectized);
|
|
926
|
-
const extendOfExtend = objectized[prop];
|
|
927
|
-
if (extendOfExtend)
|
|
928
|
-
flattenRecursive(extendOfExtend, prop, stack);
|
|
929
|
-
delete objectized[prop];
|
|
930
|
-
return stack;
|
|
931
|
-
};
|
|
932
|
-
var isEqualDeep = (param, element) => {
|
|
933
|
-
if (param === element)
|
|
934
|
-
return true;
|
|
935
|
-
if (!param || !element)
|
|
936
|
-
return false;
|
|
937
|
-
for (const prop in param) {
|
|
938
|
-
const paramProp = param[prop];
|
|
939
|
-
const elementProp = element[prop];
|
|
940
|
-
if ((0, import_types.isObjectLike)(paramProp)) {
|
|
941
|
-
const isEqual = isEqualDeep(paramProp, elementProp);
|
|
942
|
-
if (!isEqual)
|
|
943
|
-
return false;
|
|
944
|
-
} else {
|
|
945
|
-
const isEqual = paramProp === elementProp;
|
|
946
|
-
if (!isEqual)
|
|
947
|
-
return false;
|
|
948
|
-
}
|
|
949
|
-
}
|
|
950
|
-
return true;
|
|
951
|
-
};
|
|
952
|
-
var removeFromObject = (obj, props) => {
|
|
953
|
-
if (props === void 0 || props === null)
|
|
954
|
-
return obj;
|
|
955
|
-
if ((0, import_types.is)(props)("string", "number")) {
|
|
956
|
-
delete obj[props];
|
|
957
|
-
} else if ((0, import_types.isArray)(props)) {
|
|
958
|
-
props.forEach((prop) => delete obj[prop]);
|
|
959
|
-
} else {
|
|
960
|
-
throw new Error("Invalid input: props must be a string or an array of strings");
|
|
961
|
-
}
|
|
962
|
-
return obj;
|
|
963
|
-
};
|
|
964
|
-
}
|
|
965
|
-
});
|
|
966
|
-
|
|
967
|
-
// ../../node_modules/@domql/utils/dist/cjs/function.js
|
|
968
|
-
var require_function = __commonJS({
|
|
969
|
-
"../../node_modules/@domql/utils/dist/cjs/function.js"(exports, module2) {
|
|
970
|
-
"use strict";
|
|
971
|
-
var __defProp2 = Object.defineProperty;
|
|
972
|
-
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
973
|
-
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
974
|
-
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
975
|
-
var __export2 = (target, all) => {
|
|
976
|
-
for (var name in all)
|
|
977
|
-
__defProp2(target, name, { get: all[name], enumerable: true });
|
|
978
|
-
};
|
|
979
|
-
var __copyProps2 = (to, from, except, desc) => {
|
|
980
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
981
|
-
for (let key of __getOwnPropNames2(from))
|
|
982
|
-
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
983
|
-
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
984
|
-
}
|
|
985
|
-
return to;
|
|
986
|
-
};
|
|
987
|
-
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
988
|
-
var function_exports = {};
|
|
989
|
-
__export2(function_exports, {
|
|
990
|
-
debounce: () => debounce,
|
|
991
|
-
memoize: () => memoize
|
|
992
|
-
});
|
|
993
|
-
module2.exports = __toCommonJS2(function_exports);
|
|
994
|
-
var debounce = (element, func, timeout = 300) => {
|
|
995
|
-
let timer;
|
|
996
|
-
return (...args) => {
|
|
997
|
-
clearTimeout(timer);
|
|
998
|
-
timer = setTimeout(() => {
|
|
999
|
-
func.apply(element, args);
|
|
1000
|
-
}, timeout);
|
|
1001
|
-
};
|
|
1002
|
-
};
|
|
1003
|
-
var memoize = (fn) => {
|
|
1004
|
-
const cache = {};
|
|
1005
|
-
return (...args) => {
|
|
1006
|
-
const n = args[0];
|
|
1007
|
-
if (n in cache) {
|
|
1008
|
-
return cache[n];
|
|
1009
|
-
} else {
|
|
1010
|
-
const result = fn(n);
|
|
1011
|
-
cache[n] = result;
|
|
1012
|
-
return result;
|
|
1013
|
-
}
|
|
1014
|
-
};
|
|
1015
|
-
};
|
|
1016
|
-
}
|
|
1017
|
-
});
|
|
1018
|
-
|
|
1019
|
-
// ../../node_modules/@domql/utils/dist/cjs/log.js
|
|
1020
|
-
var require_log = __commonJS({
|
|
1021
|
-
"../../node_modules/@domql/utils/dist/cjs/log.js"(exports, module2) {
|
|
1022
|
-
"use strict";
|
|
1023
|
-
var __defProp2 = Object.defineProperty;
|
|
1024
|
-
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
1025
|
-
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
1026
|
-
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
1027
|
-
var __export2 = (target, all) => {
|
|
1028
|
-
for (var name in all)
|
|
1029
|
-
__defProp2(target, name, { get: all[name], enumerable: true });
|
|
1030
|
-
};
|
|
1031
|
-
var __copyProps2 = (to, from, except, desc) => {
|
|
1032
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
1033
|
-
for (let key of __getOwnPropNames2(from))
|
|
1034
|
-
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
1035
|
-
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
1036
|
-
}
|
|
1037
|
-
return to;
|
|
1038
|
-
};
|
|
1039
|
-
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
1040
|
-
var log_exports = {};
|
|
1041
|
-
__export2(log_exports, {
|
|
1042
|
-
logGroupIf: () => logGroupIf,
|
|
1043
|
-
logIf: () => logIf
|
|
1044
|
-
});
|
|
1045
|
-
module2.exports = __toCommonJS2(log_exports);
|
|
1046
|
-
var logIf = (bool, ...arg) => {
|
|
1047
|
-
if (bool)
|
|
1048
|
-
arg.map((v) => console.log(v));
|
|
1049
|
-
};
|
|
1050
|
-
var logGroupIf = (bool, key, ...arg) => {
|
|
1051
|
-
if (bool) {
|
|
1052
|
-
console.group(key);
|
|
1053
|
-
arg.map((v) => console.log(v));
|
|
1054
|
-
console.groupEnd(key);
|
|
1055
|
-
}
|
|
1056
|
-
};
|
|
1057
|
-
}
|
|
1058
|
-
});
|
|
1059
|
-
|
|
1060
|
-
// ../../node_modules/@domql/utils/dist/cjs/index.js
|
|
1061
|
-
var require_cjs4 = __commonJS({
|
|
1062
|
-
"../../node_modules/@domql/utils/dist/cjs/index.js"(exports, module2) {
|
|
1063
|
-
"use strict";
|
|
1064
|
-
var __defProp2 = Object.defineProperty;
|
|
1065
|
-
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
1066
|
-
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
1067
|
-
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
1068
|
-
var __copyProps2 = (to, from, except, desc) => {
|
|
1069
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
1070
|
-
for (let key of __getOwnPropNames2(from))
|
|
1071
|
-
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
1072
|
-
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
1073
|
-
}
|
|
1074
|
-
return to;
|
|
1075
|
-
};
|
|
1076
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps2(target, mod, "default"), secondTarget && __copyProps2(secondTarget, mod, "default"));
|
|
1077
|
-
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
1078
|
-
var utils_exports2 = {};
|
|
1079
|
-
module2.exports = __toCommonJS2(utils_exports2);
|
|
1080
|
-
__reExport(utils_exports2, require_cjs2(), module2.exports);
|
|
1081
|
-
__reExport(utils_exports2, require_types(), module2.exports);
|
|
1082
|
-
__reExport(utils_exports2, require_object(), module2.exports);
|
|
1083
|
-
__reExport(utils_exports2, require_function(), module2.exports);
|
|
1084
|
-
__reExport(utils_exports2, require_array(), module2.exports);
|
|
1085
|
-
__reExport(utils_exports2, require_node(), module2.exports);
|
|
1086
|
-
__reExport(utils_exports2, require_log(), module2.exports);
|
|
1087
|
-
__reExport(utils_exports2, require_string(), module2.exports);
|
|
1088
|
-
}
|
|
1089
|
-
});
|
|
1090
|
-
|
|
1091
|
-
// src/utils/index.js
|
|
1092
|
-
var utils_exports = {};
|
|
1093
|
-
__export(utils_exports, {
|
|
1094
|
-
applySequenceVars: () => applySequenceVars,
|
|
1095
|
-
changeLightness: () => changeLightness,
|
|
1096
|
-
colorStringToRgbaArray: () => colorStringToRgbaArray,
|
|
1097
|
-
convertSvgToSymbol: () => convertSvgToSymbol,
|
|
1098
|
-
findHeadingLetter: () => findHeadingLetter,
|
|
1099
|
-
findHeadings: () => findHeadings,
|
|
1100
|
-
generateSequence: () => generateSequence,
|
|
1101
|
-
generateSprite: () => generateSprite,
|
|
1102
|
-
generateSubSequence: () => generateSubSequence,
|
|
1103
|
-
getColorShade: () => getColorShade,
|
|
1104
|
-
getDefaultOrFirstKey: () => getDefaultOrFirstKey,
|
|
1105
|
-
getFontFace: () => getFontFace,
|
|
1106
|
-
getFontFaceEach: () => getFontFaceEach,
|
|
1107
|
-
getFontFaceEachString: () => getFontFaceEachString,
|
|
1108
|
-
getFontFaceString: () => getFontFaceString,
|
|
1109
|
-
getFontFormat: () => getFontFormat,
|
|
1110
|
-
getRgbTone: () => getRgbTone,
|
|
1111
|
-
getSequenceValue: () => getSequenceValue,
|
|
1112
|
-
getSequenceValuePropertyPair: () => getSequenceValuePropertyPair,
|
|
1113
|
-
hexToRgb: () => hexToRgb,
|
|
1114
|
-
hexToRgbArray: () => hexToRgbArray,
|
|
1115
|
-
hexToRgba: () => hexToRgba,
|
|
1116
|
-
hslToRgb: () => hslToRgb,
|
|
1117
|
-
mixTwoColors: () => mixTwoColors,
|
|
1118
|
-
mixTwoRgb: () => mixTwoRgb,
|
|
1119
|
-
mixTwoRgba: () => mixTwoRgba,
|
|
1120
|
-
numToLetterMap: () => numToLetterMap,
|
|
1121
|
-
opacify: () => opacify,
|
|
1122
|
-
returnSubThemeOrDefault: () => returnSubThemeOrDefault,
|
|
1123
|
-
rgbArrayToHex: () => rgbArrayToHex,
|
|
1124
|
-
rgbToHSL: () => rgbToHSL,
|
|
1125
|
-
rgbToHex: () => rgbToHex,
|
|
1126
|
-
setCustomFont: () => setCustomFont,
|
|
1127
|
-
setCustomFontMedia: () => setCustomFontMedia,
|
|
1128
|
-
setInCustomFontMedia: () => setInCustomFontMedia,
|
|
1129
|
-
setVariables: () => setVariables
|
|
1130
|
-
});
|
|
1131
|
-
module.exports = __toCommonJS(utils_exports);
|
|
1132
|
-
|
|
1133
|
-
// src/utils/color.js
|
|
1134
|
-
var import_globals = __toESM(require_cjs(), 1);
|
|
1135
|
-
var import_utils = __toESM(require_cjs4(), 1);
|
|
1136
|
-
var ENV = "development";
|
|
1137
|
-
var colorStringToRgbaArray = (color) => {
|
|
1138
|
-
if (color === "")
|
|
1139
|
-
return;
|
|
1140
|
-
if (color.toLowerCase() === "transparent")
|
|
1141
|
-
return [0, 0, 0, 0];
|
|
1142
|
-
if (color[0] === "#") {
|
|
1143
|
-
if (color.length < 7) {
|
|
1144
|
-
color = "#" + color[1] + color[1] + color[2] + color[2] + color[3] + color[3] + (color.length > 4 ? color[4] + color[4] : "");
|
|
1145
|
-
}
|
|
1146
|
-
return [
|
|
1147
|
-
parseInt(color.substr(1, 2), 16),
|
|
1148
|
-
parseInt(color.substr(3, 2), 16),
|
|
1149
|
-
parseInt(color.substr(5, 2), 16),
|
|
1150
|
-
color.length > 7 ? parseInt(color.substr(7, 2), 16) / 255 : 1
|
|
1151
|
-
];
|
|
1152
|
-
}
|
|
1153
|
-
if (color.indexOf("rgb") === -1) {
|
|
1154
|
-
if (import_globals.document && import_globals.window) {
|
|
1155
|
-
const elem = import_globals.document.body.appendChild(import_globals.document.createElement("fictum"));
|
|
1156
|
-
const flag = "rgb(1, 2, 3)";
|
|
1157
|
-
elem.style.color = flag;
|
|
1158
|
-
if (elem.style.color !== flag)
|
|
1159
|
-
return;
|
|
1160
|
-
elem.style.color = color;
|
|
1161
|
-
if (elem.style.color === flag || elem.style.color === "")
|
|
1162
|
-
return;
|
|
1163
|
-
color = import_globals.window.getComputedStyle(elem).color;
|
|
1164
|
-
import_globals.document.body.removeChild(elem);
|
|
1165
|
-
}
|
|
1166
|
-
}
|
|
1167
|
-
if (color.indexOf("rgb") === 0) {
|
|
1168
|
-
if (color.indexOf("rgba") === -1)
|
|
1169
|
-
color = `${color}, 1`;
|
|
1170
|
-
return color.match(/[\.\d]+/g).map((a) => +a);
|
|
1171
|
-
}
|
|
1172
|
-
return [];
|
|
1173
|
-
};
|
|
1174
|
-
var mixTwoColors = (colorA, colorB, range = 0.5) => {
|
|
1175
|
-
colorA = colorStringToRgbaArray(colorA);
|
|
1176
|
-
colorB = colorStringToRgbaArray(colorB);
|
|
1177
|
-
return mixTwoRgba(colorA, colorB, range);
|
|
1178
|
-
};
|
|
1179
|
-
var hexToRgb = (hex, alpha = 1) => {
|
|
1180
|
-
const [r, g, b] = hex.match(/\w\w/g).map((x) => parseInt(x, 16));
|
|
1181
|
-
return `rgb(${r},${g},${b})`;
|
|
1182
|
-
};
|
|
1183
|
-
var hexToRgbArray = (hex, alpha = 1) => {
|
|
1184
|
-
const [r, g, b] = hex.match(/\w\w/g).map((x) => parseInt(x, 16));
|
|
1185
|
-
return [r, g, b];
|
|
1186
|
-
};
|
|
1187
|
-
var rgbToHex = (r, g, b) => {
|
|
1188
|
-
return "#" + (1 << 24 | r << 16 | g << 8 | b).toString(16).slice(1);
|
|
1189
|
-
};
|
|
1190
|
-
var rgbArrayToHex = ([r, g, b]) => {
|
|
1191
|
-
return ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1);
|
|
1192
|
-
};
|
|
1193
|
-
var hexToRgba = (hex, alpha = 1) => {
|
|
1194
|
-
const [r, g, b] = hex.match(/\w\w/g).map((x) => parseInt(x, 16));
|
|
1195
|
-
return `rgba(${r},${g},${b},${alpha})`;
|
|
1196
|
-
};
|
|
1197
|
-
var mixTwoRgb = (colorA, colorB, range = 0.5) => {
|
|
1198
|
-
const arr = [];
|
|
1199
|
-
for (let i = 0; i < 3; i++) {
|
|
1200
|
-
arr[i] = ~~(colorA[i] + (colorB[i] - colorA[i]) * range);
|
|
1201
|
-
}
|
|
1202
|
-
return `rgb(${arr})`;
|
|
1203
|
-
};
|
|
1204
|
-
var changeLightness = (delta, hsl) => {
|
|
1205
|
-
const [hue, saturation, lightness] = hsl;
|
|
1206
|
-
const newLightness = Math.max(
|
|
1207
|
-
0,
|
|
1208
|
-
Math.min(100, lightness + parseFloat(delta))
|
|
1209
|
-
);
|
|
1210
|
-
return [hue, saturation, newLightness];
|
|
1211
|
-
};
|
|
1212
|
-
var rgbToHSL = (r, g, b) => {
|
|
1213
|
-
const a = Math.max(r, g, b);
|
|
1214
|
-
const n = a - Math.min(r, g, b);
|
|
1215
|
-
const f = 1 - Math.abs(a + a - n - 1);
|
|
1216
|
-
const h = n && (a == r ? (g - b) / n : a == g ? 2 + (b - r) / n : 4 + (r - g) / n);
|
|
1217
|
-
return [60 * (h < 0 ? h + 6 : h), f ? n / f : 0, (a + a - n) / 2];
|
|
1218
|
-
};
|
|
1219
|
-
var hslToRgb = (h, s, l, a = s * Math.min(l, 1 - l), f = (n, k = (n + h / 30) % 12) => l - a * Math.max(
|
|
1220
|
-
Math.min(k - 3, 9 - k, 1),
|
|
1221
|
-
-1
|
|
1222
|
-
)) => [f(0), f(8), f(4)];
|
|
1223
|
-
var getColorShade = (col, amt) => {
|
|
1224
|
-
const num = parseInt(col, 16);
|
|
1225
|
-
let r = (num >> 16) + amt;
|
|
1226
|
-
if (r > 255)
|
|
1227
|
-
r = 255;
|
|
1228
|
-
else if (r < 0)
|
|
1229
|
-
r = 0;
|
|
1230
|
-
let b = (num >> 8 & 255) + amt;
|
|
1231
|
-
if (b > 255)
|
|
1232
|
-
b = 255;
|
|
1233
|
-
else if (b < 0)
|
|
1234
|
-
b = 0;
|
|
1235
|
-
let g = (num & 255) + amt;
|
|
1236
|
-
if (g > 255)
|
|
1237
|
-
g = 255;
|
|
1238
|
-
else if (g < 0)
|
|
1239
|
-
g = 0;
|
|
1240
|
-
return ((g | b << 8 | r << 16) + 16777216).toString(16).slice(1);
|
|
1241
|
-
};
|
|
1242
|
-
var mixTwoRgba = (colorA, colorB, range = 0.5) => {
|
|
1243
|
-
const arr = [];
|
|
1244
|
-
for (let i = 0; i < 4; i++) {
|
|
1245
|
-
const round = i === 3 ? (x) => x : Math.round;
|
|
1246
|
-
arr[i] = round(
|
|
1247
|
-
colorA[i] + (colorB[i] - colorA[i]) * range
|
|
1248
|
-
);
|
|
1249
|
-
}
|
|
1250
|
-
return `rgba(${arr})`;
|
|
1251
|
-
};
|
|
1252
|
-
var opacify = (color, opacity) => {
|
|
1253
|
-
const arr = colorStringToRgbaArray(color);
|
|
1254
|
-
if (!arr) {
|
|
1255
|
-
if (ENV === "test" || ENV === "development")
|
|
1256
|
-
console.warn(color + "color is not rgba");
|
|
1257
|
-
return;
|
|
1258
|
-
}
|
|
1259
|
-
arr[3] = opacity;
|
|
1260
|
-
return `rgba(${arr})`;
|
|
1261
|
-
};
|
|
1262
|
-
var getRgbTone = (rgb, tone) => {
|
|
1263
|
-
if ((0, import_utils.isString)(rgb))
|
|
1264
|
-
rgb = rgb.split(", ").map((v) => parseFloat(v));
|
|
1265
|
-
if ((0, import_utils.isNumber)(tone))
|
|
1266
|
-
tone += "";
|
|
1267
|
-
const toHex = rgbArrayToHex(rgb);
|
|
1268
|
-
const abs = tone.slice(0, 1);
|
|
1269
|
-
if (abs === "-" || abs === "+") {
|
|
1270
|
-
const colorShade = getColorShade(toHex, parseFloat(tone));
|
|
1271
|
-
return hexToRgbArray(colorShade).join(", ");
|
|
1272
|
-
} else {
|
|
1273
|
-
const [r, g, b] = rgb;
|
|
1274
|
-
const hsl = rgbToHSL(r, g, b);
|
|
1275
|
-
const [h, s, l] = hsl;
|
|
1276
|
-
const newRgb = hslToRgb(h, s, parseFloat(tone) / 100 * 255);
|
|
1277
|
-
return newRgb;
|
|
1278
|
-
}
|
|
1279
|
-
};
|
|
1280
|
-
|
|
1281
|
-
// src/utils/theme.js
|
|
1282
|
-
var returnSubThemeOrDefault = (orig, theme) => {
|
|
1283
|
-
if (!orig)
|
|
1284
|
-
return;
|
|
1285
|
-
if (orig.themes && orig.themes[theme])
|
|
1286
|
-
return orig.themes[theme];
|
|
1287
|
-
if (orig[theme])
|
|
1288
|
-
return [orig, orig[theme]];
|
|
1289
|
-
return orig;
|
|
1290
|
-
};
|
|
1291
|
-
|
|
1292
|
-
// src/utils/font.js
|
|
1293
|
-
var getDefaultOrFirstKey = (LIBRARY, key) => {
|
|
1294
|
-
if (LIBRARY[key])
|
|
1295
|
-
return LIBRARY[key].value;
|
|
1296
|
-
if (LIBRARY.default)
|
|
1297
|
-
return LIBRARY[LIBRARY.default].value;
|
|
1298
|
-
const hasValue = Object.keys(LIBRARY)[0];
|
|
1299
|
-
return hasValue && LIBRARY[hasValue] && LIBRARY[hasValue].value;
|
|
1300
|
-
};
|
|
1301
|
-
var getFontFormat = (url) => url.split(/[#?]/)[0].split(".").pop().trim();
|
|
1302
|
-
var setInCustomFontMedia = (str) => `@font-face { ${str} }`;
|
|
1303
|
-
var setCustomFont = (name, url, weight) => `
|
|
1304
|
-
font-family: '${name}';
|
|
1305
|
-
font-style: normal;
|
|
1306
|
-
${weight && `font-weight: ${weight};`}
|
|
1307
|
-
src: url('${url}') format('${getFontFormat(url)}');`;
|
|
1308
|
-
var setCustomFontMedia = (name, url, weight) => `@font-face {
|
|
1309
|
-
${setCustomFont(name, url, weight)}
|
|
1310
|
-
}`;
|
|
1311
|
-
var getFontFaceEach = (name, weights) => {
|
|
1312
|
-
const keys = Object.keys(weights);
|
|
1313
|
-
return keys.map((key) => {
|
|
1314
|
-
const { url, fontWeight } = weights[key];
|
|
1315
|
-
return setCustomFont(name, url, fontWeight);
|
|
1316
|
-
});
|
|
1317
|
-
};
|
|
1318
|
-
var getFontFace = (LIBRARY) => {
|
|
1319
|
-
const keys = Object.keys(LIBRARY);
|
|
1320
|
-
return keys.map((key) => getFontFaceEach(key, LIBRARY[key].value));
|
|
1321
|
-
};
|
|
1322
|
-
var getFontFaceEachString = (name, weights) => {
|
|
1323
|
-
const isArr = weights[0];
|
|
1324
|
-
if (isArr)
|
|
1325
|
-
return getFontFaceEach(name, weights).map(setInCustomFontMedia);
|
|
1326
|
-
return setCustomFontMedia(name, weights.url);
|
|
1327
|
-
};
|
|
1328
|
-
var getFontFaceString = (LIBRARY) => {
|
|
1329
|
-
const keys = Object.keys(LIBRARY);
|
|
1330
|
-
return keys.map((key) => getFontFaceEachString(key, LIBRARY[key].value));
|
|
1331
|
-
};
|
|
1332
|
-
|
|
1333
|
-
// src/utils/sequence.js
|
|
1334
|
-
var import_utils5 = __toESM(require_cjs4(), 1);
|
|
1335
|
-
|
|
1336
|
-
// ../utils/src/index.js
|
|
1337
|
-
var import_utils3 = __toESM(require_cjs4());
|
|
1338
|
-
|
|
1339
|
-
// ../utils/src/scaling.js
|
|
1340
|
-
var import_utils2 = __toESM(require_cjs4());
|
|
1341
|
-
|
|
1342
|
-
// ../utils/src/index.js
|
|
1343
|
-
var toDashCase = (val) => val.replace(/[^a-zA-Z0-9]/g, " ").trim().toLowerCase().replace(/\s+/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "");
|
|
1344
|
-
|
|
1345
|
-
// src/factory.js
|
|
1346
|
-
var import_utils4 = __toESM(require_cjs4(), 1);
|
|
1347
|
-
|
|
1348
|
-
// src/defaultConfig/index.js
|
|
1349
|
-
var defaultConfig_exports = {};
|
|
1350
|
-
__export(defaultConfig_exports, {
|
|
1351
|
-
ANIMATION: () => ANIMATION,
|
|
1352
|
-
BREAKPOINTS: () => BREAKPOINTS,
|
|
1353
|
-
CASES: () => CASES,
|
|
1354
|
-
COLOR: () => COLOR,
|
|
1355
|
-
DEVICES: () => DEVICES,
|
|
1356
|
-
DOCUMENT: () => DOCUMENT,
|
|
1357
|
-
FONT: () => FONT,
|
|
1358
|
-
FONT_FACE: () => FONT_FACE,
|
|
1359
|
-
FONT_FAMILY: () => FONT_FAMILY,
|
|
1360
|
-
FONT_FAMILY_TYPES: () => FONT_FAMILY_TYPES,
|
|
1361
|
-
GRADIENT: () => GRADIENT,
|
|
1362
|
-
ICONS: () => ICONS,
|
|
1363
|
-
MEDIA: () => MEDIA,
|
|
1364
|
-
RESET: () => RESET,
|
|
1365
|
-
SEQUENCE: () => SEQUENCE,
|
|
1366
|
-
SPACING: () => SPACING,
|
|
1367
|
-
SVG: () => SVG,
|
|
1368
|
-
SVG_DATA: () => SVG_DATA,
|
|
1369
|
-
THEME: () => THEME,
|
|
1370
|
-
TIMING: () => TIMING,
|
|
1371
|
-
TYPOGRAPHY: () => TYPOGRAPHY,
|
|
1372
|
-
UNIT: () => UNIT
|
|
1373
|
-
});
|
|
1374
|
-
|
|
1375
|
-
// src/defaultConfig/sequence.js
|
|
1376
|
-
var SEQUENCE = {
|
|
1377
|
-
"minor-second": 1.067,
|
|
1378
|
-
"major-second": 1.125,
|
|
1379
|
-
"minor-third": 1.2,
|
|
1380
|
-
"major-third": 1.25,
|
|
1381
|
-
"perfect-fourth": 1.333,
|
|
1382
|
-
"augmented-fourth": 1.414,
|
|
1383
|
-
"perfect-fifth": 1.5,
|
|
1384
|
-
"minor-sixth": 1.6,
|
|
1385
|
-
phi: 1.618,
|
|
1386
|
-
// golden-ratio
|
|
1387
|
-
"major-sixth": 1.667,
|
|
1388
|
-
"square-root-3": 1.732,
|
|
1389
|
-
// theodorus
|
|
1390
|
-
"minor-seventh": 1.778,
|
|
1391
|
-
"major-seventh": 1.875,
|
|
1392
|
-
octave: 2,
|
|
1393
|
-
"square-root-5": 2.23,
|
|
1394
|
-
// pythagoras
|
|
1395
|
-
"major-tenth": 2.5,
|
|
1396
|
-
"major-eleventh": 2.667,
|
|
1397
|
-
"major-twelfth": 3,
|
|
1398
|
-
pi: 3.14,
|
|
1399
|
-
// archimedes
|
|
1400
|
-
"double-octave": 4
|
|
1401
|
-
};
|
|
1402
|
-
|
|
1403
|
-
// src/defaultConfig/unit.js
|
|
1404
|
-
var UNIT = {
|
|
1405
|
-
default: "em"
|
|
1406
|
-
};
|
|
1407
|
-
|
|
1408
|
-
// src/defaultConfig/typography.js
|
|
1409
|
-
var defaultProps = {
|
|
1410
|
-
browserDefault: 16,
|
|
1411
|
-
base: 16,
|
|
1412
|
-
type: "font-size",
|
|
1413
|
-
ratio: SEQUENCE["minor-third"],
|
|
1414
|
-
range: [-3, 12],
|
|
1415
|
-
h1Matches: 6,
|
|
1416
|
-
lineHeight: 1.5,
|
|
1417
|
-
subSequence: true,
|
|
1418
|
-
unit: "em",
|
|
1419
|
-
templates: {},
|
|
1420
|
-
sequence: {},
|
|
1421
|
-
scales: {},
|
|
1422
|
-
vars: {}
|
|
1423
|
-
};
|
|
1424
|
-
var TYPOGRAPHY = defaultProps;
|
|
1425
|
-
|
|
1426
|
-
// src/defaultConfig/font.js
|
|
1427
|
-
var FONT = {};
|
|
1428
|
-
|
|
1429
|
-
// src/defaultConfig/font-family.js
|
|
1430
|
-
var FONT_FAMILY = {};
|
|
1431
|
-
var FONT_FAMILY_TYPES = {
|
|
1432
|
-
"sans-serif": "Helvetica, Arial, sans-serif, --system-default",
|
|
1433
|
-
serif: "Times New Roman, Georgia, serif, --system-default",
|
|
1434
|
-
monospace: "Courier New, monospace, --system-default"
|
|
1435
|
-
};
|
|
1436
|
-
var FONT_FACE = {};
|
|
1437
|
-
|
|
1438
|
-
// src/defaultConfig/media.js
|
|
1439
|
-
var MEDIA = {
|
|
1440
|
-
tv: "(min-width: 2780px)",
|
|
1441
|
-
screenL: "(max-width: 1920px)",
|
|
1442
|
-
"screenL<": "(min-width: 1920px)",
|
|
1443
|
-
screenM: "(max-width: 1680px)",
|
|
1444
|
-
"screenM<": "(min-width: 1680px)",
|
|
1445
|
-
screenS: "(max-width: 1440px)",
|
|
1446
|
-
"screenS<": "(min-width: 1440px)",
|
|
1447
|
-
tabletL: "(max-width: 1366px)",
|
|
1448
|
-
"tabletL<": "(min-width: 1366px)",
|
|
1449
|
-
tabletM: "(max-width: 1280px)",
|
|
1450
|
-
"tabletM<": "(min-width: 1280px)",
|
|
1451
|
-
tabletS: "(max-width: 1024px)",
|
|
1452
|
-
"tabletS<": "(min-width: 1024px)",
|
|
1453
|
-
mobileL: "(max-width: 768px)",
|
|
1454
|
-
"mobileL<": "(min-width: 768px)",
|
|
1455
|
-
mobileM: "(max-width: 560px)",
|
|
1456
|
-
"mobileM<": "(min-width: 560px)",
|
|
1457
|
-
mobileS: "(max-width: 480px)",
|
|
1458
|
-
"mobileS<": "(min-width: 480px)",
|
|
1459
|
-
mobileXS: "(max-width: 375px)",
|
|
1460
|
-
"mobileXS<": "(min-width: 375px)",
|
|
1461
|
-
light: "(prefers-color-scheme: light)",
|
|
1462
|
-
dark: "(prefers-color-scheme: dark)",
|
|
1463
|
-
print: "print"
|
|
1464
|
-
};
|
|
1465
|
-
|
|
1466
|
-
// src/defaultConfig/spacing.js
|
|
1467
|
-
var defaultProps2 = {
|
|
1468
|
-
base: TYPOGRAPHY.base,
|
|
1469
|
-
type: "spacing",
|
|
1470
|
-
ratio: SEQUENCE.phi,
|
|
1471
|
-
range: [-5, 15],
|
|
1472
|
-
subSequence: true,
|
|
1473
|
-
unit: "em",
|
|
1474
|
-
sequence: {},
|
|
1475
|
-
scales: {},
|
|
1476
|
-
vars: {}
|
|
1477
|
-
};
|
|
1478
|
-
var SPACING = defaultProps2;
|
|
1479
|
-
|
|
1480
|
-
// src/defaultConfig/color.js
|
|
1481
|
-
var COLOR = {};
|
|
1482
|
-
var GRADIENT = {};
|
|
1483
|
-
|
|
1484
|
-
// src/defaultConfig/theme.js
|
|
1485
|
-
var THEME = {};
|
|
1486
|
-
|
|
1487
|
-
// src/defaultConfig/icons.js
|
|
1488
|
-
var ICONS = {};
|
|
1489
|
-
|
|
1490
|
-
// src/defaultConfig/timing.js
|
|
1491
|
-
var defaultProps3 = {
|
|
1492
|
-
default: 150,
|
|
1493
|
-
base: 150,
|
|
1494
|
-
type: "timing",
|
|
1495
|
-
ratio: SEQUENCE["perfect-fourth"],
|
|
1496
|
-
range: [-3, 12],
|
|
1497
|
-
unit: "ms",
|
|
1498
|
-
sequence: {},
|
|
1499
|
-
scales: {},
|
|
1500
|
-
vars: {}
|
|
1501
|
-
};
|
|
1502
|
-
var TIMING = defaultProps3;
|
|
1503
|
-
|
|
1504
|
-
// src/defaultConfig/document.js
|
|
1505
|
-
var DOCUMENT = {};
|
|
1506
|
-
|
|
1507
|
-
// src/defaultConfig/responsive.js
|
|
1508
|
-
var BREAKPOINTS = {
|
|
1509
|
-
screenL: 1920,
|
|
1510
|
-
screenM: 1680,
|
|
1511
|
-
screenS: 1440,
|
|
1512
|
-
tabletL: 1366,
|
|
1513
|
-
tabletM: 1280,
|
|
1514
|
-
tabletS: 1024,
|
|
1515
|
-
mobileL: 768,
|
|
1516
|
-
mobileM: 560,
|
|
1517
|
-
mobileS: 480,
|
|
1518
|
-
mobileXS: 375
|
|
1519
|
-
};
|
|
1520
|
-
var DEVICES = {
|
|
1521
|
-
screenL: [1920, 1024],
|
|
1522
|
-
screenM: [1680, 1024],
|
|
1523
|
-
screenS: [1440, 978],
|
|
1524
|
-
tabletL: [1366, 926],
|
|
1525
|
-
tabletM: [1280, 768],
|
|
1526
|
-
tabletS: [1024, 768],
|
|
1527
|
-
mobileL: [768, 375],
|
|
1528
|
-
mobileM: [560, 768],
|
|
1529
|
-
mobileS: [480, 768],
|
|
1530
|
-
mobileXS: [375, 768]
|
|
1531
|
-
};
|
|
1532
|
-
|
|
1533
|
-
// src/defaultConfig/cases.js
|
|
1534
|
-
var CASES = {};
|
|
1535
|
-
|
|
1536
|
-
// src/defaultConfig/animation.js
|
|
1537
|
-
var ANIMATION = {};
|
|
1538
|
-
|
|
1539
|
-
// src/defaultConfig/svg.js
|
|
1540
|
-
var SVG = {};
|
|
1541
|
-
var SVG_DATA = {};
|
|
1542
|
-
|
|
1543
|
-
// src/defaultConfig/index.js
|
|
1544
|
-
var RESET = {};
|
|
1545
|
-
|
|
1546
|
-
// src/factory.js
|
|
1547
|
-
var CSS_VARS = {};
|
|
1548
|
-
var CONFIG = {
|
|
1549
|
-
verbose: false,
|
|
1550
|
-
useVariable: true,
|
|
1551
|
-
useReset: true,
|
|
1552
|
-
CSS_VARS,
|
|
1553
|
-
...defaultConfig_exports
|
|
1554
|
-
};
|
|
1555
|
-
var cachedConfig = (0, import_utils4.deepClone)(CONFIG);
|
|
1556
|
-
var FACTORY = {
|
|
1557
|
-
active: "0",
|
|
1558
|
-
0: CONFIG
|
|
1559
|
-
};
|
|
1560
|
-
var getActiveConfig = (def) => {
|
|
1561
|
-
return FACTORY[def || FACTORY.active];
|
|
1562
|
-
};
|
|
1563
|
-
|
|
1564
|
-
// src/utils/sequence.js
|
|
1565
|
-
var numToLetterMap = {
|
|
1566
|
-
"-6": "U",
|
|
1567
|
-
"-5": "V",
|
|
1568
|
-
"-4": "W",
|
|
1569
|
-
"-3": "X",
|
|
1570
|
-
"-2": "Y",
|
|
1571
|
-
"-1": "Z",
|
|
1572
|
-
0: "A",
|
|
1573
|
-
1: "B",
|
|
1574
|
-
2: "C",
|
|
1575
|
-
3: "D",
|
|
1576
|
-
4: "E",
|
|
1577
|
-
5: "F",
|
|
1578
|
-
6: "G",
|
|
1579
|
-
7: "H",
|
|
1580
|
-
8: "I",
|
|
1581
|
-
9: "J",
|
|
1582
|
-
10: "K",
|
|
1583
|
-
11: "L",
|
|
1584
|
-
12: "M",
|
|
1585
|
-
13: "N",
|
|
1586
|
-
14: "O",
|
|
1587
|
-
15: "P",
|
|
1588
|
-
16: "Q",
|
|
1589
|
-
17: "R",
|
|
1590
|
-
18: "S",
|
|
1591
|
-
19: "T"
|
|
1592
|
-
};
|
|
1593
|
-
var setSequenceValue = (props, sequenceProps) => {
|
|
1594
|
-
const { key, variable, value, scaling, index } = props;
|
|
1595
|
-
sequenceProps.sequence[key] = {
|
|
1596
|
-
key,
|
|
1597
|
-
decimal: ~~(value * 100) / 100,
|
|
1598
|
-
val: ~~value,
|
|
1599
|
-
scaling,
|
|
1600
|
-
index,
|
|
1601
|
-
variable
|
|
1602
|
-
};
|
|
1603
|
-
sequenceProps.scales[key] = scaling;
|
|
1604
|
-
sequenceProps.vars[variable] = scaling + sequenceProps.unit;
|
|
1605
|
-
};
|
|
1606
|
-
var generateSubSequence = (props, sequenceProps) => {
|
|
1607
|
-
const { key, base, value, ratio, variable, index } = props;
|
|
1608
|
-
const next = value * ratio;
|
|
1609
|
-
const diff = next - value;
|
|
1610
|
-
const smallscale = diff / 1.618;
|
|
1611
|
-
const valueRounded = ~~value;
|
|
1612
|
-
const nextRounded = ~~next;
|
|
1613
|
-
const diffRounded = nextRounded - valueRounded;
|
|
1614
|
-
let arr = [];
|
|
1615
|
-
const first = next - smallscale;
|
|
1616
|
-
const second = value + smallscale;
|
|
1617
|
-
const middle = (first + second) / 2;
|
|
1618
|
-
if (diffRounded > 16)
|
|
1619
|
-
arr = [first, middle, second];
|
|
1620
|
-
else
|
|
1621
|
-
arr = [first, second];
|
|
1622
|
-
arr.map((v, k) => {
|
|
1623
|
-
const scaling = ~~(v / base * 1e3) / 1e3;
|
|
1624
|
-
const newVar = variable + (k + 1);
|
|
1625
|
-
const props2 = {
|
|
1626
|
-
key: key + (k + 1),
|
|
1627
|
-
variable: newVar,
|
|
1628
|
-
value: v,
|
|
1629
|
-
scaling,
|
|
1630
|
-
index: index + (k + 1) / 10
|
|
1631
|
-
};
|
|
1632
|
-
return setSequenceValue(props2, sequenceProps);
|
|
1633
|
-
});
|
|
1634
|
-
};
|
|
1635
|
-
var switchSequenceOnNegative = (key, base, ratio) => {
|
|
1636
|
-
return base * Math.pow(ratio, key);
|
|
1637
|
-
};
|
|
1638
|
-
var generateSequence = (sequenceProps) => {
|
|
1639
|
-
const { type, base, ratio, range, subSequence } = sequenceProps;
|
|
1640
|
-
const n = Math.abs(range[0]) + Math.abs(range[1]);
|
|
1641
|
-
const prefix = "--" + (type && type.replace(".", "-")) + "-";
|
|
1642
|
-
for (let i = 0; i <= n; i++) {
|
|
1643
|
-
const key = range[1] - i;
|
|
1644
|
-
const letterKey = numToLetterMap[key];
|
|
1645
|
-
const value = switchSequenceOnNegative(key, base, ratio);
|
|
1646
|
-
const scaling = ~~(value / base * 100) / 100;
|
|
1647
|
-
const variable = prefix + letterKey;
|
|
1648
|
-
const props = {
|
|
1649
|
-
key: letterKey,
|
|
1650
|
-
variable,
|
|
1651
|
-
value,
|
|
1652
|
-
base,
|
|
1653
|
-
scaling,
|
|
1654
|
-
ratio,
|
|
1655
|
-
index: key
|
|
1656
|
-
};
|
|
1657
|
-
setSequenceValue(props, sequenceProps);
|
|
1658
|
-
if (subSequence)
|
|
1659
|
-
generateSubSequence(props, sequenceProps);
|
|
1660
|
-
}
|
|
1661
|
-
return sequenceProps;
|
|
1662
|
-
};
|
|
1663
|
-
var getSequenceValue = (value = "A", sequenceProps) => {
|
|
1664
|
-
const CONFIG2 = getActiveConfig();
|
|
1665
|
-
const { UNIT: UNIT2 } = CONFIG2;
|
|
1666
|
-
const {
|
|
1667
|
-
sequence,
|
|
1668
|
-
unit = UNIT2.default,
|
|
1669
|
-
useVariable
|
|
1670
|
-
} = sequenceProps;
|
|
1671
|
-
if ((0, import_utils5.isString)(value) && value.slice(0, 2) === "--")
|
|
1672
|
-
return `var(${value})`;
|
|
1673
|
-
const prefix = `--${toDashCase(sequenceProps.type.replace(".", "-"))}-`;
|
|
1674
|
-
const startsWithDashOrLetterRegex = /^-?[a-zA-Z]/i;
|
|
1675
|
-
const startsWithDashOrLetter = startsWithDashOrLetterRegex.test(value);
|
|
1676
|
-
if (value === "none" || value === "auto" || value === "unset" || value === "inherit" || value === "fit-content" || value === "min-content" || value === "max-content" || value.includes("calc") || !startsWithDashOrLetter)
|
|
1677
|
-
return value;
|
|
1678
|
-
const letterVal = value.toUpperCase();
|
|
1679
|
-
const isNegative = letterVal.slice(0, 1) === "-" ? "-" : "";
|
|
1680
|
-
let absValue = isNegative ? letterVal.slice(1) : letterVal;
|
|
1681
|
-
let mediaName = "";
|
|
1682
|
-
if (absValue.includes("-")) {
|
|
1683
|
-
mediaName = "-" + absValue.split("-")[1].toLowerCase();
|
|
1684
|
-
absValue = absValue.split("-")[0];
|
|
1685
|
-
}
|
|
1686
|
-
const varValue = (v) => `var(${prefix}${v}${mediaName})`;
|
|
1687
|
-
if (absValue.includes("+")) {
|
|
1688
|
-
const args = absValue.split("+");
|
|
1689
|
-
const [first, second] = args;
|
|
1690
|
-
const joint = `${varValue(first)} + ${varValue(second)}`;
|
|
1691
|
-
return isNegative ? `calc((${joint}) * -1)` : `calc(${joint})`;
|
|
1692
|
-
} else if (absValue.includes("-")) {
|
|
1693
|
-
const args = absValue.split("-");
|
|
1694
|
-
const [first, second] = args;
|
|
1695
|
-
const joint = `${varValue(first)} - ${varValue(second)}`;
|
|
1696
|
-
return isNegative ? `calc((${joint}) * -1)` : `calc(${joint})`;
|
|
1697
|
-
}
|
|
1698
|
-
if (!sequence[absValue] && absValue.length === 2) {
|
|
1699
|
-
if (CONFIG2.verbose)
|
|
1700
|
-
console.warn(absValue, "- value is not found because `subSequence` is set to false");
|
|
1701
|
-
absValue = absValue.slice(0, 1);
|
|
1702
|
-
}
|
|
1703
|
-
if (useVariable || CONFIG2.useVariable) {
|
|
1704
|
-
const varValue2 = `var(${prefix}${absValue}${mediaName})`;
|
|
1705
|
-
return isNegative ? `calc(${varValue2} * -1)` : varValue2;
|
|
1706
|
-
}
|
|
1707
|
-
const sequenceItem = sequence ? sequence[absValue] : null;
|
|
1708
|
-
if (!sequenceItem)
|
|
1709
|
-
return console.warn("can't find", sequence, absValue);
|
|
1710
|
-
if (unit === "ms" || unit === "s") {
|
|
1711
|
-
return isNegative + sequenceItem.val + unit;
|
|
1712
|
-
}
|
|
1713
|
-
return isNegative + sequenceItem.scaling + unit;
|
|
1714
|
-
};
|
|
1715
|
-
var getSequenceValuePropertyPair = (value, propertyName, sequenceProps) => {
|
|
1716
|
-
if (typeof value !== "string") {
|
|
1717
|
-
console.warn(propertyName, value, "is not a string");
|
|
1718
|
-
return {};
|
|
1719
|
-
}
|
|
1720
|
-
if (value === "-" || value === "")
|
|
1721
|
-
return {};
|
|
1722
|
-
return { [propertyName]: getSequenceValue(value, sequenceProps) };
|
|
1723
|
-
};
|
|
1724
|
-
var findHeadingLetter = (h1Matches, index) => numToLetterMap[h1Matches - index];
|
|
1725
|
-
var findHeadings = (propertyNames) => {
|
|
1726
|
-
const { h1Matches, sequence } = propertyNames;
|
|
1727
|
-
return new Array(6).fill(null).map((_, i) => {
|
|
1728
|
-
const findLetter = findHeadingLetter(h1Matches, i);
|
|
1729
|
-
return sequence[findLetter];
|
|
1730
|
-
});
|
|
1731
|
-
};
|
|
1732
|
-
|
|
1733
|
-
// src/utils/var.js
|
|
1734
|
-
var import_utils7 = __toESM(require_cjs4(), 1);
|
|
1735
|
-
var setVariables = (result, key) => {
|
|
1736
|
-
const CONFIG2 = getActiveConfig();
|
|
1737
|
-
const { CSS_VARS: CSS_VARS2 } = CONFIG2;
|
|
1738
|
-
if ((0, import_utils7.isObjectLike)(result.value)) {
|
|
1739
|
-
} else {
|
|
1740
|
-
CSS_VARS2[result.var] = result.value;
|
|
1741
|
-
}
|
|
1742
|
-
};
|
|
1743
|
-
var applySequenceVars = (props, mediaName, options = {}) => {
|
|
1744
|
-
const CONFIG2 = getActiveConfig();
|
|
1745
|
-
const { UNIT: UNIT2, MEDIA: MEDIA2, TIMING: TIMING2, CSS_VARS: CSS_VARS2 } = CONFIG2;
|
|
1746
|
-
const unit = props.unit || UNIT2.default;
|
|
1747
|
-
const { sequence, scales } = props;
|
|
1748
|
-
for (const key in sequence) {
|
|
1749
|
-
const item = sequence[key];
|
|
1750
|
-
const value = (props.type === TIMING2.type ? sequence[key].val : scales[key]) + unit;
|
|
1751
|
-
if (mediaName) {
|
|
1752
|
-
const query = MEDIA2[mediaName];
|
|
1753
|
-
if (!query) {
|
|
1754
|
-
if (CONFIG2.verbose)
|
|
1755
|
-
console.warn("Can't find query ", query);
|
|
1756
|
-
}
|
|
1757
|
-
let underMediaQuery = CSS_VARS2[`@media ${query}`];
|
|
1758
|
-
if (!underMediaQuery)
|
|
1759
|
-
underMediaQuery = CSS_VARS2[`@media ${query}`] = {};
|
|
1760
|
-
underMediaQuery[item.variable] = `var(${item.variable + "-" + mediaName})`;
|
|
1761
|
-
CSS_VARS2[item.variable + "-" + mediaName] = value;
|
|
1762
|
-
} else {
|
|
1763
|
-
if (options.useDefault === false) {
|
|
1764
|
-
CSS_VARS2[item.variable] = value;
|
|
1765
|
-
} else {
|
|
1766
|
-
CSS_VARS2[item.variable + "-default"] = value;
|
|
1767
|
-
CSS_VARS2[item.variable] = `var(${item.variable + "-default"})`;
|
|
1768
|
-
}
|
|
1769
|
-
}
|
|
1770
|
-
}
|
|
1771
|
-
};
|
|
1772
|
-
|
|
1773
|
-
// src/utils/sprite.js
|
|
1774
|
-
var import_utils8 = __toESM(require_cjs4(), 1);
|
|
1775
|
-
var generateSprite = (icons) => {
|
|
1776
|
-
const CONFIG2 = getActiveConfig();
|
|
1777
|
-
let sprite = "";
|
|
1778
|
-
for (const key in icons) {
|
|
1779
|
-
if (CONFIG2.__svg_cache[key])
|
|
1780
|
-
continue;
|
|
1781
|
-
else
|
|
1782
|
-
CONFIG2.__svg_cache[key] = true;
|
|
1783
|
-
sprite += icons[key];
|
|
1784
|
-
}
|
|
1785
|
-
return sprite;
|
|
1786
|
-
};
|
|
1787
|
-
var parseRootAttributes = (htmlString) => {
|
|
1788
|
-
if (!(0, import_utils8.isString)(htmlString)) {
|
|
1789
|
-
return console.warn(`parseRootAttributes: ${htmlString} is not a string`);
|
|
1790
|
-
}
|
|
1791
|
-
const match = htmlString.match(/<svg\s+(.*?)>/);
|
|
1792
|
-
if (!match || !match[1]) {
|
|
1793
|
-
return {};
|
|
1794
|
-
}
|
|
1795
|
-
const attrString = match[1];
|
|
1796
|
-
const attrs = attrString.match(/(\S+)=["']?((?:.(?!["']?\s+(?:\S+)=|\s*\/?[>"']))+.)["']?/gm);
|
|
1797
|
-
return attrs.reduce((acc, attr) => {
|
|
1798
|
-
const [key, value] = attr.split("=");
|
|
1799
|
-
acc[key] = value.replace(/['"]/g, "");
|
|
1800
|
-
return acc;
|
|
1801
|
-
}, {});
|
|
1802
|
-
};
|
|
1803
|
-
var replaceIdsAndUrls = (code, key) => {
|
|
1804
|
-
const idRegex = /id="([^"]*)"/;
|
|
1805
|
-
const urlRegex = /url\(#([^)]*)\)/g;
|
|
1806
|
-
const matches = code.match(/id="([^"]*)"/g);
|
|
1807
|
-
let replacedCode = code;
|
|
1808
|
-
if ((0, import_utils8.isArray)(matches)) {
|
|
1809
|
-
matches.forEach(() => {
|
|
1810
|
-
const randomKey = Math.floor(Math.random() * 1e5);
|
|
1811
|
-
replacedCode = code.replace(idRegex, `id="${key}-${randomKey}"`).replace(urlRegex, `url(#${key}-${randomKey})`);
|
|
1812
|
-
});
|
|
1813
|
-
}
|
|
1814
|
-
return replacedCode;
|
|
1815
|
-
};
|
|
1816
|
-
var convertSvgToSymbol = (key, code) => {
|
|
1817
|
-
const extractAttrs = parseRootAttributes(code);
|
|
1818
|
-
const { width, height } = extractAttrs;
|
|
1819
|
-
const viewBox = extractAttrs.viewBox || `0 0 ${width || 24} ${height || 24}`;
|
|
1820
|
-
const xmlns = "http://www.w3.org/2000/svg";
|
|
1821
|
-
const replacedCode = replaceIdsAndUrls(code, key);
|
|
1822
|
-
let symbol = replacedCode.replace(
|
|
1823
|
-
"<svg",
|
|
1824
|
-
`<symbol id="${key}" xmlns="${xmlns}" viewBox="${viewBox}"`
|
|
1825
|
-
);
|
|
1826
|
-
symbol = symbol.replace(/width="[^"]*"/, "");
|
|
1827
|
-
symbol = symbol.replace(/height="[^"]*"/, "");
|
|
1828
|
-
symbol = symbol.replace("</svg", "</symbol");
|
|
1829
|
-
return symbol;
|
|
1830
|
-
};
|