@symbo.ls/scratch 2.10.253 → 2.10.257
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 -3
- package/dist/cjs/index.js +109 -18
- package/dist/cjs/set.js +24 -11
- package/dist/cjs/system/color.js +24 -11
- package/dist/cjs/system/document.js +13 -3
- package/dist/cjs/system/font.js +13 -3
- package/dist/cjs/system/index.js +24 -11
- package/dist/cjs/system/reset.js +13 -3
- package/dist/cjs/system/spacing.js +13 -3
- package/dist/cjs/system/svg.js +13 -3
- package/dist/cjs/system/theme.js +18 -5
- package/dist/cjs/system/timing.js +13 -3
- package/dist/cjs/system/typography.js +13 -3
- package/dist/cjs/transforms/index.js +1540 -0
- package/dist/cjs/utils/index.js +13 -3
- package/dist/cjs/utils/sequence.js +13 -3
- package/dist/cjs/utils/sprite.js +13 -3
- package/dist/cjs/utils/var.js +13 -3
- package/package.json +2 -2
- package/src/index.js +1 -0
- package/src/system/color.js +11 -8
- package/src/transforms/index.js +70 -0
|
@@ -0,0 +1,1540 @@
|
|
|
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: () => document4,
|
|
57
|
+
global: () => global,
|
|
58
|
+
self: () => self,
|
|
59
|
+
window: () => window3
|
|
60
|
+
});
|
|
61
|
+
module2.exports = __toCommonJS2(globals_exports);
|
|
62
|
+
var global = globalThis;
|
|
63
|
+
var self = globalThis;
|
|
64
|
+
var window3 = globalThis;
|
|
65
|
+
var document4 = window3.document;
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
// ../../node_modules/@domql/tags/dist/cjs/htmlTags.js
|
|
70
|
+
var require_htmlTags = __commonJS({
|
|
71
|
+
"../../node_modules/@domql/tags/dist/cjs/htmlTags.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 htmlTags_exports = {};
|
|
91
|
+
__export2(htmlTags_exports, {
|
|
92
|
+
HTML_TAGS: () => HTML_TAGS
|
|
93
|
+
});
|
|
94
|
+
module2.exports = __toCommonJS2(htmlTags_exports);
|
|
95
|
+
var HTML_TAGS = {
|
|
96
|
+
root: [
|
|
97
|
+
"body",
|
|
98
|
+
"html"
|
|
99
|
+
],
|
|
100
|
+
head: [
|
|
101
|
+
"title",
|
|
102
|
+
"base",
|
|
103
|
+
"meta",
|
|
104
|
+
"style"
|
|
105
|
+
],
|
|
106
|
+
body: [
|
|
107
|
+
"string",
|
|
108
|
+
"fragment",
|
|
109
|
+
"a",
|
|
110
|
+
"abbr",
|
|
111
|
+
"acronym",
|
|
112
|
+
"address",
|
|
113
|
+
"applet",
|
|
114
|
+
"area",
|
|
115
|
+
"article",
|
|
116
|
+
"aside",
|
|
117
|
+
"audio",
|
|
118
|
+
"b",
|
|
119
|
+
"basefont",
|
|
120
|
+
"bdi",
|
|
121
|
+
"bdo",
|
|
122
|
+
"big",
|
|
123
|
+
"blockquote",
|
|
124
|
+
"br",
|
|
125
|
+
"button",
|
|
126
|
+
"canvas",
|
|
127
|
+
"caption",
|
|
128
|
+
"center",
|
|
129
|
+
"cite",
|
|
130
|
+
"code",
|
|
131
|
+
"col",
|
|
132
|
+
"colgroup",
|
|
133
|
+
"data",
|
|
134
|
+
"datalist",
|
|
135
|
+
"dd",
|
|
136
|
+
"del",
|
|
137
|
+
"details",
|
|
138
|
+
"dfn",
|
|
139
|
+
"dialog",
|
|
140
|
+
"dir",
|
|
141
|
+
"div",
|
|
142
|
+
"dl",
|
|
143
|
+
"dt",
|
|
144
|
+
"em",
|
|
145
|
+
"embed",
|
|
146
|
+
"fieldset",
|
|
147
|
+
"figcaption",
|
|
148
|
+
"figure",
|
|
149
|
+
"font",
|
|
150
|
+
"footer",
|
|
151
|
+
"form",
|
|
152
|
+
"frame",
|
|
153
|
+
"frameset",
|
|
154
|
+
"h1",
|
|
155
|
+
"h2",
|
|
156
|
+
"h3",
|
|
157
|
+
"h4",
|
|
158
|
+
"h5",
|
|
159
|
+
"h6",
|
|
160
|
+
"head",
|
|
161
|
+
"header",
|
|
162
|
+
"hr",
|
|
163
|
+
"i",
|
|
164
|
+
"iframe",
|
|
165
|
+
"img",
|
|
166
|
+
"input",
|
|
167
|
+
"ins",
|
|
168
|
+
"kbd",
|
|
169
|
+
"label",
|
|
170
|
+
"legend",
|
|
171
|
+
"li",
|
|
172
|
+
"link",
|
|
173
|
+
"main",
|
|
174
|
+
"map",
|
|
175
|
+
"mark",
|
|
176
|
+
"meter",
|
|
177
|
+
"nav",
|
|
178
|
+
"noframes",
|
|
179
|
+
"noscript",
|
|
180
|
+
"object",
|
|
181
|
+
"ol",
|
|
182
|
+
"optgroup",
|
|
183
|
+
"option",
|
|
184
|
+
"output",
|
|
185
|
+
"p",
|
|
186
|
+
"param",
|
|
187
|
+
"picture",
|
|
188
|
+
"pre",
|
|
189
|
+
"progress",
|
|
190
|
+
"q",
|
|
191
|
+
"rp",
|
|
192
|
+
"rt",
|
|
193
|
+
"ruby",
|
|
194
|
+
"s",
|
|
195
|
+
"samp",
|
|
196
|
+
"script",
|
|
197
|
+
"section",
|
|
198
|
+
"select",
|
|
199
|
+
"small",
|
|
200
|
+
"source",
|
|
201
|
+
"span",
|
|
202
|
+
"strike",
|
|
203
|
+
"strong",
|
|
204
|
+
"sub",
|
|
205
|
+
"summary",
|
|
206
|
+
"sup",
|
|
207
|
+
"table",
|
|
208
|
+
"tbody",
|
|
209
|
+
"td",
|
|
210
|
+
"template",
|
|
211
|
+
"textarea",
|
|
212
|
+
"tfoot",
|
|
213
|
+
"th",
|
|
214
|
+
"thead",
|
|
215
|
+
"time",
|
|
216
|
+
"tr",
|
|
217
|
+
"track",
|
|
218
|
+
"tt",
|
|
219
|
+
"u",
|
|
220
|
+
"ul",
|
|
221
|
+
"var",
|
|
222
|
+
"video",
|
|
223
|
+
"wbr",
|
|
224
|
+
// SVG
|
|
225
|
+
"svg",
|
|
226
|
+
"path"
|
|
227
|
+
]
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
});
|
|
231
|
+
|
|
232
|
+
// ../../node_modules/@domql/tags/dist/cjs/index.js
|
|
233
|
+
var require_cjs2 = __commonJS({
|
|
234
|
+
"../../node_modules/@domql/tags/dist/cjs/index.js"(exports, module2) {
|
|
235
|
+
"use strict";
|
|
236
|
+
var __defProp2 = Object.defineProperty;
|
|
237
|
+
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
238
|
+
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
239
|
+
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
240
|
+
var __copyProps2 = (to, from, except, desc) => {
|
|
241
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
242
|
+
for (let key of __getOwnPropNames2(from))
|
|
243
|
+
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
244
|
+
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
245
|
+
}
|
|
246
|
+
return to;
|
|
247
|
+
};
|
|
248
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps2(target, mod, "default"), secondTarget && __copyProps2(secondTarget, mod, "default"));
|
|
249
|
+
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
250
|
+
var tags_exports = {};
|
|
251
|
+
module2.exports = __toCommonJS2(tags_exports);
|
|
252
|
+
__reExport(tags_exports, require_htmlTags(), module2.exports);
|
|
253
|
+
}
|
|
254
|
+
});
|
|
255
|
+
|
|
256
|
+
// ../../node_modules/@domql/utils/dist/cjs/types.js
|
|
257
|
+
var require_types = __commonJS({
|
|
258
|
+
"../../node_modules/@domql/utils/dist/cjs/types.js"(exports, module2) {
|
|
259
|
+
"use strict";
|
|
260
|
+
var __defProp2 = Object.defineProperty;
|
|
261
|
+
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
262
|
+
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
263
|
+
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
264
|
+
var __export2 = (target, all) => {
|
|
265
|
+
for (var name in all)
|
|
266
|
+
__defProp2(target, name, { get: all[name], enumerable: true });
|
|
267
|
+
};
|
|
268
|
+
var __copyProps2 = (to, from, except, desc) => {
|
|
269
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
270
|
+
for (let key of __getOwnPropNames2(from))
|
|
271
|
+
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
272
|
+
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
273
|
+
}
|
|
274
|
+
return to;
|
|
275
|
+
};
|
|
276
|
+
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
277
|
+
var types_exports = {};
|
|
278
|
+
__export2(types_exports, {
|
|
279
|
+
TYPES: () => TYPES,
|
|
280
|
+
is: () => is,
|
|
281
|
+
isArray: () => isArray5,
|
|
282
|
+
isBoolean: () => isBoolean,
|
|
283
|
+
isDefined: () => isDefined2,
|
|
284
|
+
isFunction: () => isFunction,
|
|
285
|
+
isHtmlElement: () => isHtmlElement,
|
|
286
|
+
isNode: () => isNode,
|
|
287
|
+
isNot: () => isNot,
|
|
288
|
+
isNull: () => isNull,
|
|
289
|
+
isNumber: () => isNumber,
|
|
290
|
+
isObject: () => isObject6,
|
|
291
|
+
isObjectLike: () => isObjectLike3,
|
|
292
|
+
isString: () => isString8,
|
|
293
|
+
isUndefined: () => isUndefined,
|
|
294
|
+
isValidHtmlTag: () => isValidHtmlTag
|
|
295
|
+
});
|
|
296
|
+
module2.exports = __toCommonJS2(types_exports);
|
|
297
|
+
var import_globals3 = require_cjs();
|
|
298
|
+
var import_tags = require_cjs2();
|
|
299
|
+
var isValidHtmlTag = (arg) => import_tags.HTML_TAGS.body.indexOf(arg);
|
|
300
|
+
var isObject6 = (arg) => {
|
|
301
|
+
if (arg === null)
|
|
302
|
+
return false;
|
|
303
|
+
return typeof arg === "object" && arg.constructor === Object;
|
|
304
|
+
};
|
|
305
|
+
var isString8 = (arg) => typeof arg === "string";
|
|
306
|
+
var isNumber = (arg) => typeof arg === "number";
|
|
307
|
+
var isFunction = (arg) => typeof arg === "function";
|
|
308
|
+
var isBoolean = (arg) => arg === true || arg === false;
|
|
309
|
+
var isNull = (arg) => arg === null;
|
|
310
|
+
var isArray5 = (arg) => Array.isArray(arg);
|
|
311
|
+
var isObjectLike3 = (arg) => {
|
|
312
|
+
if (arg === null)
|
|
313
|
+
return false;
|
|
314
|
+
return typeof arg === "object";
|
|
315
|
+
};
|
|
316
|
+
var isNode = (obj) => {
|
|
317
|
+
return typeof import_globals3.window.Node === "object" ? obj instanceof import_globals3.window.Node : obj && typeof obj === "object" && typeof obj.nodeType === "number" && typeof obj.nodeName === "string";
|
|
318
|
+
};
|
|
319
|
+
var isHtmlElement = (obj) => {
|
|
320
|
+
return typeof import_globals3.window.HTMLElement === "object" ? obj instanceof import_globals3.window.HTMLElement : obj && typeof obj === "object" && obj !== null && obj.nodeType === 1 && typeof obj.nodeName === "string";
|
|
321
|
+
};
|
|
322
|
+
var isDefined2 = (arg) => {
|
|
323
|
+
return isObject6(arg) || isObjectLike3(arg) || isString8(arg) || isNumber(arg) || isFunction(arg) || isArray5(arg) || isObjectLike3(arg) || isBoolean(arg) || isNull(arg);
|
|
324
|
+
};
|
|
325
|
+
var isUndefined = (arg) => {
|
|
326
|
+
return arg === void 0;
|
|
327
|
+
};
|
|
328
|
+
var TYPES = {
|
|
329
|
+
boolean: isBoolean,
|
|
330
|
+
array: isArray5,
|
|
331
|
+
object: isObject6,
|
|
332
|
+
string: isString8,
|
|
333
|
+
number: isNumber,
|
|
334
|
+
null: isNull,
|
|
335
|
+
function: isFunction,
|
|
336
|
+
objectLike: isObjectLike3,
|
|
337
|
+
node: isNode,
|
|
338
|
+
htmlElement: isHtmlElement,
|
|
339
|
+
defined: isDefined2
|
|
340
|
+
};
|
|
341
|
+
var is = (arg) => {
|
|
342
|
+
return (...args) => {
|
|
343
|
+
return args.map((val) => TYPES[val](arg)).filter((v) => v).length > 0;
|
|
344
|
+
};
|
|
345
|
+
};
|
|
346
|
+
var isNot = (arg) => {
|
|
347
|
+
return (...args) => {
|
|
348
|
+
return args.map((val) => TYPES[val](arg)).filter((v) => v).length === 0;
|
|
349
|
+
};
|
|
350
|
+
};
|
|
351
|
+
}
|
|
352
|
+
});
|
|
353
|
+
|
|
354
|
+
// ../../node_modules/@domql/utils/dist/cjs/object.js
|
|
355
|
+
var require_object = __commonJS({
|
|
356
|
+
"../../node_modules/@domql/utils/dist/cjs/object.js"(exports, module2) {
|
|
357
|
+
"use strict";
|
|
358
|
+
var __defProp2 = Object.defineProperty;
|
|
359
|
+
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
360
|
+
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
361
|
+
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
362
|
+
var __export2 = (target, all) => {
|
|
363
|
+
for (var name in all)
|
|
364
|
+
__defProp2(target, name, { get: all[name], enumerable: true });
|
|
365
|
+
};
|
|
366
|
+
var __copyProps2 = (to, from, except, desc) => {
|
|
367
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
368
|
+
for (let key of __getOwnPropNames2(from))
|
|
369
|
+
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
370
|
+
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
371
|
+
}
|
|
372
|
+
return to;
|
|
373
|
+
};
|
|
374
|
+
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
375
|
+
var object_exports = {};
|
|
376
|
+
__export2(object_exports, {
|
|
377
|
+
clone: () => clone,
|
|
378
|
+
deepClone: () => deepClone2,
|
|
379
|
+
deepCloneExclude: () => deepCloneExclude,
|
|
380
|
+
deepDestringify: () => deepDestringify,
|
|
381
|
+
deepMerge: () => deepMerge2,
|
|
382
|
+
deepStringify: () => deepStringify,
|
|
383
|
+
detachFunctionsFromObject: () => detachFunctionsFromObject,
|
|
384
|
+
diff: () => diff,
|
|
385
|
+
exec: () => exec,
|
|
386
|
+
flattenRecursive: () => flattenRecursive,
|
|
387
|
+
isEqualDeep: () => isEqualDeep,
|
|
388
|
+
map: () => map,
|
|
389
|
+
merge: () => merge5,
|
|
390
|
+
mergeAndCloneIfArray: () => mergeAndCloneIfArray,
|
|
391
|
+
mergeArray: () => mergeArray,
|
|
392
|
+
mergeArrayExclude: () => mergeArrayExclude,
|
|
393
|
+
mergeIfExisted: () => mergeIfExisted,
|
|
394
|
+
overwrite: () => overwrite,
|
|
395
|
+
overwriteDeep: () => overwriteDeep,
|
|
396
|
+
overwriteObj: () => overwriteObj
|
|
397
|
+
});
|
|
398
|
+
module2.exports = __toCommonJS2(object_exports);
|
|
399
|
+
var import_globals3 = require_cjs();
|
|
400
|
+
var import_types = require_types();
|
|
401
|
+
var exec = (param, element, state, context) => {
|
|
402
|
+
if ((0, import_types.isFunction)(param)) {
|
|
403
|
+
return param(
|
|
404
|
+
element,
|
|
405
|
+
state || element.state,
|
|
406
|
+
context || element.context
|
|
407
|
+
);
|
|
408
|
+
}
|
|
409
|
+
return param;
|
|
410
|
+
};
|
|
411
|
+
var map = (obj, extention, element) => {
|
|
412
|
+
for (const e in extention) {
|
|
413
|
+
obj[e] = exec(extention[e], element);
|
|
414
|
+
}
|
|
415
|
+
};
|
|
416
|
+
var merge5 = (element, obj) => {
|
|
417
|
+
for (const e in obj) {
|
|
418
|
+
const elementProp = element[e];
|
|
419
|
+
const objProp = obj[e];
|
|
420
|
+
if (elementProp === void 0) {
|
|
421
|
+
element[e] = objProp;
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
return element;
|
|
425
|
+
};
|
|
426
|
+
var deepMerge2 = (element, extend) => {
|
|
427
|
+
for (const e in extend) {
|
|
428
|
+
const extendProp = extend[e];
|
|
429
|
+
if (e === "parent" || e === "props")
|
|
430
|
+
continue;
|
|
431
|
+
if (element[e] === void 0) {
|
|
432
|
+
element[e] = extendProp;
|
|
433
|
+
} else if ((0, import_types.isObjectLike)(element[e]) && (0, import_types.isObjectLike)(extendProp)) {
|
|
434
|
+
deepMerge2(element[e], extendProp);
|
|
435
|
+
} else {
|
|
436
|
+
element[e] = extendProp;
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
return element;
|
|
440
|
+
};
|
|
441
|
+
var clone = (obj) => {
|
|
442
|
+
const o = {};
|
|
443
|
+
for (const prop in obj) {
|
|
444
|
+
if (prop === "node")
|
|
445
|
+
continue;
|
|
446
|
+
o[prop] = obj[prop];
|
|
447
|
+
}
|
|
448
|
+
return o;
|
|
449
|
+
};
|
|
450
|
+
var deepCloneExclude = (obj, exclude = []) => {
|
|
451
|
+
if ((0, import_types.isArray)(obj)) {
|
|
452
|
+
return obj.map((x) => deepCloneExclude(x, exclude));
|
|
453
|
+
}
|
|
454
|
+
const o = {};
|
|
455
|
+
for (const k in obj) {
|
|
456
|
+
if (exclude.indexOf(k) > -1)
|
|
457
|
+
continue;
|
|
458
|
+
let v = obj[k];
|
|
459
|
+
if (k === "extend" && (0, import_types.isArray)(v)) {
|
|
460
|
+
v = mergeArrayExclude(v, exclude);
|
|
461
|
+
}
|
|
462
|
+
if ((0, import_types.isArray)(v)) {
|
|
463
|
+
o[k] = v.map((x) => deepCloneExclude(x, exclude));
|
|
464
|
+
} else if ((0, import_types.isObject)(v)) {
|
|
465
|
+
o[k] = deepCloneExclude(v, exclude);
|
|
466
|
+
} else
|
|
467
|
+
o[k] = v;
|
|
468
|
+
}
|
|
469
|
+
return o;
|
|
470
|
+
};
|
|
471
|
+
var mergeArrayExclude = (arr, excl = []) => {
|
|
472
|
+
return arr.reduce((acc, curr) => deepMerge2(acc, deepCloneExclude(curr, excl)), {});
|
|
473
|
+
};
|
|
474
|
+
var deepClone2 = (obj) => {
|
|
475
|
+
if ((0, import_types.isArray)(obj)) {
|
|
476
|
+
return obj.map(deepClone2);
|
|
477
|
+
}
|
|
478
|
+
const o = {};
|
|
479
|
+
for (const prop in obj) {
|
|
480
|
+
let objProp = obj[prop];
|
|
481
|
+
if (prop === "extend" && (0, import_types.isArray)(objProp)) {
|
|
482
|
+
objProp = mergeArray(objProp);
|
|
483
|
+
}
|
|
484
|
+
if ((0, import_types.isArray)(objProp)) {
|
|
485
|
+
o[prop] = objProp.map((v) => (0, import_types.isObject)(v) ? deepClone2(v) : v);
|
|
486
|
+
} else if ((0, import_types.isObject)(objProp)) {
|
|
487
|
+
o[prop] = deepClone2(objProp);
|
|
488
|
+
} else
|
|
489
|
+
o[prop] = objProp;
|
|
490
|
+
}
|
|
491
|
+
return o;
|
|
492
|
+
};
|
|
493
|
+
var deepStringify = (obj, stringified = {}) => {
|
|
494
|
+
for (const prop in obj) {
|
|
495
|
+
const objProp = obj[prop];
|
|
496
|
+
if ((0, import_types.isFunction)(objProp)) {
|
|
497
|
+
stringified[prop] = objProp.toString();
|
|
498
|
+
} else if ((0, import_types.isObject)(objProp)) {
|
|
499
|
+
stringified[prop] = {};
|
|
500
|
+
deepStringify(objProp, stringified[prop]);
|
|
501
|
+
} else if ((0, import_types.isArray)(objProp)) {
|
|
502
|
+
stringified[prop] = [];
|
|
503
|
+
objProp.forEach((v, i) => {
|
|
504
|
+
if ((0, import_types.isObject)(v)) {
|
|
505
|
+
stringified[prop][i] = {};
|
|
506
|
+
deepStringify(v, stringified[prop][i]);
|
|
507
|
+
} else if ((0, import_types.isFunction)(v)) {
|
|
508
|
+
stringified[prop][i] = v.toString();
|
|
509
|
+
} else {
|
|
510
|
+
stringified[prop][i] = v;
|
|
511
|
+
}
|
|
512
|
+
});
|
|
513
|
+
} else {
|
|
514
|
+
stringified[prop] = objProp;
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
return stringified;
|
|
518
|
+
};
|
|
519
|
+
var detachFunctionsFromObject = (obj, detached = {}) => {
|
|
520
|
+
for (const prop in obj) {
|
|
521
|
+
const objProp = obj[prop];
|
|
522
|
+
if ((0, import_types.isFunction)(objProp))
|
|
523
|
+
continue;
|
|
524
|
+
else if ((0, import_types.isObject)(objProp)) {
|
|
525
|
+
detached[prop] = {};
|
|
526
|
+
deepStringify(objProp, detached[prop]);
|
|
527
|
+
} else if ((0, import_types.isArray)(objProp)) {
|
|
528
|
+
detached[prop] = [];
|
|
529
|
+
objProp.forEach((v, i) => {
|
|
530
|
+
if ((0, import_types.isFunction)(v))
|
|
531
|
+
return;
|
|
532
|
+
if ((0, import_types.isObject)(v)) {
|
|
533
|
+
detached[prop][i] = {};
|
|
534
|
+
detachFunctionsFromObject(v, detached[prop][i]);
|
|
535
|
+
} else {
|
|
536
|
+
detached[prop][i] = v;
|
|
537
|
+
}
|
|
538
|
+
});
|
|
539
|
+
} else {
|
|
540
|
+
detached[prop] = objProp;
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
return detached;
|
|
544
|
+
};
|
|
545
|
+
var deepDestringify = (obj, stringified = {}) => {
|
|
546
|
+
for (const prop in obj) {
|
|
547
|
+
const objProp = obj[prop];
|
|
548
|
+
if ((0, import_types.isString)(objProp)) {
|
|
549
|
+
if (objProp.includes("=>") || objProp.includes("function") || objProp.startsWith("(")) {
|
|
550
|
+
try {
|
|
551
|
+
const evalProp = import_globals3.window.eval(`(${objProp})`);
|
|
552
|
+
stringified[prop] = evalProp;
|
|
553
|
+
} catch (e) {
|
|
554
|
+
if (e)
|
|
555
|
+
stringified[prop] = objProp;
|
|
556
|
+
}
|
|
557
|
+
} else {
|
|
558
|
+
stringified[prop] = objProp;
|
|
559
|
+
}
|
|
560
|
+
} else if ((0, import_types.isArray)(objProp)) {
|
|
561
|
+
stringified[prop] = [];
|
|
562
|
+
objProp.forEach((arrProp) => {
|
|
563
|
+
if ((0, import_types.isString)(arrProp)) {
|
|
564
|
+
if (arrProp.includes("=>") || arrProp.includes("function") || arrProp.startsWith("(")) {
|
|
565
|
+
try {
|
|
566
|
+
const evalProp = import_globals3.window.eval(`(${arrProp})`);
|
|
567
|
+
stringified[prop].push(evalProp);
|
|
568
|
+
} catch (e) {
|
|
569
|
+
if (e)
|
|
570
|
+
stringified[prop].push(arrProp);
|
|
571
|
+
}
|
|
572
|
+
} else {
|
|
573
|
+
stringified[prop].push(arrProp);
|
|
574
|
+
}
|
|
575
|
+
} else if ((0, import_types.isObject)(arrProp)) {
|
|
576
|
+
stringified[prop].push(deepDestringify(arrProp));
|
|
577
|
+
} else {
|
|
578
|
+
stringified[prop].push(arrProp);
|
|
579
|
+
}
|
|
580
|
+
});
|
|
581
|
+
} else if ((0, import_types.isObject)(objProp)) {
|
|
582
|
+
stringified[prop] = deepDestringify(objProp, stringified[prop]);
|
|
583
|
+
} else {
|
|
584
|
+
stringified[prop] = objProp;
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
return stringified;
|
|
588
|
+
};
|
|
589
|
+
var overwrite = (element, params, options) => {
|
|
590
|
+
const { ref } = element;
|
|
591
|
+
const changes = {};
|
|
592
|
+
for (const e in params) {
|
|
593
|
+
if (e === "props")
|
|
594
|
+
continue;
|
|
595
|
+
const elementProp = element[e];
|
|
596
|
+
const paramsProp = params[e];
|
|
597
|
+
if (paramsProp) {
|
|
598
|
+
ref.__cache[e] = changes[e] = elementProp;
|
|
599
|
+
ref[e] = paramsProp;
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
return changes;
|
|
603
|
+
};
|
|
604
|
+
var diff = (obj, original, cache) => {
|
|
605
|
+
const changes = cache || {};
|
|
606
|
+
for (const e in obj) {
|
|
607
|
+
if (e === "ref")
|
|
608
|
+
continue;
|
|
609
|
+
const originalProp = original[e];
|
|
610
|
+
const objProp = obj[e];
|
|
611
|
+
if ((0, import_types.isObjectLike)(originalProp) && (0, import_types.isObjectLike)(objProp)) {
|
|
612
|
+
changes[e] = {};
|
|
613
|
+
diff(originalProp, objProp, changes[e]);
|
|
614
|
+
} else if (objProp !== void 0) {
|
|
615
|
+
changes[e] = objProp;
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
return changes;
|
|
619
|
+
};
|
|
620
|
+
var overwriteObj = (params, obj) => {
|
|
621
|
+
const changes = {};
|
|
622
|
+
for (const e in params) {
|
|
623
|
+
const objProp = obj[e];
|
|
624
|
+
const paramsProp = params[e];
|
|
625
|
+
if (paramsProp) {
|
|
626
|
+
obj[e] = changes[e] = objProp;
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
return changes;
|
|
630
|
+
};
|
|
631
|
+
var overwriteDeep = (params, obj) => {
|
|
632
|
+
for (const e in params) {
|
|
633
|
+
const objProp = obj[e];
|
|
634
|
+
const paramsProp = params[e];
|
|
635
|
+
if ((0, import_types.isObjectLike)(objProp) && (0, import_types.isObjectLike)(paramsProp)) {
|
|
636
|
+
overwriteDeep(paramsProp, objProp);
|
|
637
|
+
} else if (paramsProp !== void 0) {
|
|
638
|
+
obj[e] = paramsProp;
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
return obj;
|
|
642
|
+
};
|
|
643
|
+
var mergeIfExisted = (a, b) => {
|
|
644
|
+
if ((0, import_types.isObjectLike)(a) && (0, import_types.isObjectLike)(b))
|
|
645
|
+
return deepMerge2(a, b);
|
|
646
|
+
return a || b;
|
|
647
|
+
};
|
|
648
|
+
var mergeArray = (arr) => {
|
|
649
|
+
return arr.reduce((a, c) => deepMerge2(a, deepClone2(c)), {});
|
|
650
|
+
};
|
|
651
|
+
var mergeAndCloneIfArray = (obj) => {
|
|
652
|
+
return (0, import_types.isArray)(obj) ? mergeArray(obj) : deepClone2(obj);
|
|
653
|
+
};
|
|
654
|
+
var flattenRecursive = (param, prop, stack = []) => {
|
|
655
|
+
const objectized = mergeAndCloneIfArray(param);
|
|
656
|
+
stack.push(objectized);
|
|
657
|
+
const extendOfExtend = objectized[prop];
|
|
658
|
+
if (extendOfExtend)
|
|
659
|
+
flattenRecursive(extendOfExtend, prop, stack);
|
|
660
|
+
delete objectized[prop];
|
|
661
|
+
return stack;
|
|
662
|
+
};
|
|
663
|
+
var isEqualDeep = (param, element) => {
|
|
664
|
+
if (param === element)
|
|
665
|
+
return true;
|
|
666
|
+
if (!param || !element)
|
|
667
|
+
return false;
|
|
668
|
+
for (const prop in param) {
|
|
669
|
+
const paramProp = param[prop];
|
|
670
|
+
const elementProp = element[prop];
|
|
671
|
+
if ((0, import_types.isObjectLike)(paramProp)) {
|
|
672
|
+
const isEqual = isEqualDeep(paramProp, elementProp);
|
|
673
|
+
if (!isEqual)
|
|
674
|
+
return false;
|
|
675
|
+
} else {
|
|
676
|
+
const isEqual = paramProp === elementProp;
|
|
677
|
+
if (!isEqual)
|
|
678
|
+
return false;
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
return true;
|
|
682
|
+
};
|
|
683
|
+
}
|
|
684
|
+
});
|
|
685
|
+
|
|
686
|
+
// ../../node_modules/@domql/utils/dist/cjs/function.js
|
|
687
|
+
var require_function = __commonJS({
|
|
688
|
+
"../../node_modules/@domql/utils/dist/cjs/function.js"(exports, module2) {
|
|
689
|
+
"use strict";
|
|
690
|
+
var __defProp2 = Object.defineProperty;
|
|
691
|
+
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
692
|
+
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
693
|
+
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
694
|
+
var __export2 = (target, all) => {
|
|
695
|
+
for (var name in all)
|
|
696
|
+
__defProp2(target, name, { get: all[name], enumerable: true });
|
|
697
|
+
};
|
|
698
|
+
var __copyProps2 = (to, from, except, desc) => {
|
|
699
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
700
|
+
for (let key of __getOwnPropNames2(from))
|
|
701
|
+
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
702
|
+
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
703
|
+
}
|
|
704
|
+
return to;
|
|
705
|
+
};
|
|
706
|
+
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
707
|
+
var function_exports = {};
|
|
708
|
+
__export2(function_exports, {
|
|
709
|
+
debounce: () => debounce,
|
|
710
|
+
memoize: () => memoize
|
|
711
|
+
});
|
|
712
|
+
module2.exports = __toCommonJS2(function_exports);
|
|
713
|
+
var debounce = (element, func, timeout = 300) => {
|
|
714
|
+
let timer;
|
|
715
|
+
return (...args) => {
|
|
716
|
+
clearTimeout(timer);
|
|
717
|
+
timer = setTimeout(() => {
|
|
718
|
+
func.apply(element, args);
|
|
719
|
+
}, timeout);
|
|
720
|
+
};
|
|
721
|
+
};
|
|
722
|
+
var memoize = (fn) => {
|
|
723
|
+
const cache = {};
|
|
724
|
+
return (...args) => {
|
|
725
|
+
const n = args[0];
|
|
726
|
+
if (n in cache) {
|
|
727
|
+
return cache[n];
|
|
728
|
+
} else {
|
|
729
|
+
const result = fn(n);
|
|
730
|
+
cache[n] = result;
|
|
731
|
+
return result;
|
|
732
|
+
}
|
|
733
|
+
};
|
|
734
|
+
};
|
|
735
|
+
}
|
|
736
|
+
});
|
|
737
|
+
|
|
738
|
+
// ../../node_modules/@domql/utils/dist/cjs/array.js
|
|
739
|
+
var require_array = __commonJS({
|
|
740
|
+
"../../node_modules/@domql/utils/dist/cjs/array.js"() {
|
|
741
|
+
"use strict";
|
|
742
|
+
}
|
|
743
|
+
});
|
|
744
|
+
|
|
745
|
+
// ../../node_modules/@domql/utils/dist/cjs/node.js
|
|
746
|
+
var require_node = __commonJS({
|
|
747
|
+
"../../node_modules/@domql/utils/dist/cjs/node.js"(exports, module2) {
|
|
748
|
+
"use strict";
|
|
749
|
+
var __defProp2 = Object.defineProperty;
|
|
750
|
+
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
751
|
+
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
752
|
+
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
753
|
+
var __export2 = (target, all) => {
|
|
754
|
+
for (var name in all)
|
|
755
|
+
__defProp2(target, name, { get: all[name], enumerable: true });
|
|
756
|
+
};
|
|
757
|
+
var __copyProps2 = (to, from, except, desc) => {
|
|
758
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
759
|
+
for (let key of __getOwnPropNames2(from))
|
|
760
|
+
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
761
|
+
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
762
|
+
}
|
|
763
|
+
return to;
|
|
764
|
+
};
|
|
765
|
+
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
766
|
+
var node_exports = {};
|
|
767
|
+
__export2(node_exports, {
|
|
768
|
+
cleanWithNode: () => cleanWithNode,
|
|
769
|
+
createID: () => createID,
|
|
770
|
+
createSnapshotId: () => createSnapshotId
|
|
771
|
+
});
|
|
772
|
+
module2.exports = __toCommonJS2(node_exports);
|
|
773
|
+
var cleanWithNode = (extend) => delete extend.node && extend;
|
|
774
|
+
var createID = function() {
|
|
775
|
+
let index = 0;
|
|
776
|
+
function newId() {
|
|
777
|
+
index++;
|
|
778
|
+
return index;
|
|
779
|
+
}
|
|
780
|
+
return newId;
|
|
781
|
+
}();
|
|
782
|
+
var createSnapshotId = createID;
|
|
783
|
+
}
|
|
784
|
+
});
|
|
785
|
+
|
|
786
|
+
// ../../node_modules/@domql/utils/dist/cjs/log.js
|
|
787
|
+
var require_log = __commonJS({
|
|
788
|
+
"../../node_modules/@domql/utils/dist/cjs/log.js"(exports, module2) {
|
|
789
|
+
"use strict";
|
|
790
|
+
var __defProp2 = Object.defineProperty;
|
|
791
|
+
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
792
|
+
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
793
|
+
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
794
|
+
var __export2 = (target, all) => {
|
|
795
|
+
for (var name in all)
|
|
796
|
+
__defProp2(target, name, { get: all[name], enumerable: true });
|
|
797
|
+
};
|
|
798
|
+
var __copyProps2 = (to, from, except, desc) => {
|
|
799
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
800
|
+
for (let key of __getOwnPropNames2(from))
|
|
801
|
+
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
802
|
+
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
803
|
+
}
|
|
804
|
+
return to;
|
|
805
|
+
};
|
|
806
|
+
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
807
|
+
var log_exports = {};
|
|
808
|
+
__export2(log_exports, {
|
|
809
|
+
logGroupIf: () => logGroupIf,
|
|
810
|
+
logIf: () => logIf
|
|
811
|
+
});
|
|
812
|
+
module2.exports = __toCommonJS2(log_exports);
|
|
813
|
+
var logIf = (bool, ...arg) => {
|
|
814
|
+
if (bool)
|
|
815
|
+
arg.map((v) => console.log(v));
|
|
816
|
+
};
|
|
817
|
+
var logGroupIf = (bool, key, ...arg) => {
|
|
818
|
+
if (bool) {
|
|
819
|
+
console.group(key);
|
|
820
|
+
arg.map((v) => console.log(v));
|
|
821
|
+
console.groupEnd(key);
|
|
822
|
+
}
|
|
823
|
+
};
|
|
824
|
+
}
|
|
825
|
+
});
|
|
826
|
+
|
|
827
|
+
// ../../node_modules/@domql/utils/dist/cjs/index.js
|
|
828
|
+
var require_cjs3 = __commonJS({
|
|
829
|
+
"../../node_modules/@domql/utils/dist/cjs/index.js"(exports, module2) {
|
|
830
|
+
"use strict";
|
|
831
|
+
var __defProp2 = Object.defineProperty;
|
|
832
|
+
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
833
|
+
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
834
|
+
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
835
|
+
var __copyProps2 = (to, from, except, desc) => {
|
|
836
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
837
|
+
for (let key of __getOwnPropNames2(from))
|
|
838
|
+
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
839
|
+
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
840
|
+
}
|
|
841
|
+
return to;
|
|
842
|
+
};
|
|
843
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps2(target, mod, "default"), secondTarget && __copyProps2(secondTarget, mod, "default"));
|
|
844
|
+
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
845
|
+
var utils_exports = {};
|
|
846
|
+
module2.exports = __toCommonJS2(utils_exports);
|
|
847
|
+
__reExport(utils_exports, require_types(), module2.exports);
|
|
848
|
+
__reExport(utils_exports, require_object(), module2.exports);
|
|
849
|
+
__reExport(utils_exports, require_function(), module2.exports);
|
|
850
|
+
__reExport(utils_exports, require_array(), module2.exports);
|
|
851
|
+
__reExport(utils_exports, require_node(), module2.exports);
|
|
852
|
+
__reExport(utils_exports, require_log(), module2.exports);
|
|
853
|
+
}
|
|
854
|
+
});
|
|
855
|
+
|
|
856
|
+
// src/transforms/index.js
|
|
857
|
+
var transforms_exports = {};
|
|
858
|
+
__export(transforms_exports, {
|
|
859
|
+
transformBackgroundImage: () => transformBackgroundImage,
|
|
860
|
+
transformBorder: () => transformBorder,
|
|
861
|
+
transformShadow: () => transformShadow,
|
|
862
|
+
transformTextStroke: () => transformTextStroke,
|
|
863
|
+
transfromGap: () => transfromGap
|
|
864
|
+
});
|
|
865
|
+
module.exports = __toCommonJS(transforms_exports);
|
|
866
|
+
var import_utils25 = __toESM(require_cjs3(), 1);
|
|
867
|
+
|
|
868
|
+
// src/factory.js
|
|
869
|
+
var import_utils = __toESM(require_cjs3(), 1);
|
|
870
|
+
|
|
871
|
+
// src/defaultConfig/index.js
|
|
872
|
+
var defaultConfig_exports = {};
|
|
873
|
+
__export(defaultConfig_exports, {
|
|
874
|
+
ANIMATION: () => ANIMATION,
|
|
875
|
+
BREAKPOINTS: () => BREAKPOINTS,
|
|
876
|
+
CASES: () => CASES,
|
|
877
|
+
COLOR: () => COLOR,
|
|
878
|
+
DEVICES: () => DEVICES,
|
|
879
|
+
DOCUMENT: () => DOCUMENT,
|
|
880
|
+
FONT: () => FONT,
|
|
881
|
+
FONT_FACE: () => FONT_FACE,
|
|
882
|
+
FONT_FAMILY: () => FONT_FAMILY,
|
|
883
|
+
FONT_FAMILY_TYPES: () => FONT_FAMILY_TYPES,
|
|
884
|
+
GRADIENT: () => GRADIENT,
|
|
885
|
+
ICONS: () => ICONS,
|
|
886
|
+
MEDIA: () => MEDIA,
|
|
887
|
+
RESET: () => RESET,
|
|
888
|
+
SEQUENCE: () => SEQUENCE,
|
|
889
|
+
SPACING: () => SPACING,
|
|
890
|
+
SVG: () => SVG,
|
|
891
|
+
SVG_DATA: () => SVG_DATA,
|
|
892
|
+
THEME: () => THEME,
|
|
893
|
+
TIMING: () => TIMING,
|
|
894
|
+
TYPOGRAPHY: () => TYPOGRAPHY,
|
|
895
|
+
UNIT: () => UNIT
|
|
896
|
+
});
|
|
897
|
+
|
|
898
|
+
// src/defaultConfig/sequence.js
|
|
899
|
+
var SEQUENCE = {
|
|
900
|
+
"minor-second": 1.067,
|
|
901
|
+
"major-second": 1.125,
|
|
902
|
+
"minor-third": 1.2,
|
|
903
|
+
"major-third": 1.25,
|
|
904
|
+
"perfect-fourth": 1.333,
|
|
905
|
+
"augmented-fourth": 1.414,
|
|
906
|
+
"perfect-fifth": 1.5,
|
|
907
|
+
"minor-sixth": 1.6,
|
|
908
|
+
phi: 1.618,
|
|
909
|
+
// golden-ratio
|
|
910
|
+
"major-sixth": 1.667,
|
|
911
|
+
"square-root-3": 1.732,
|
|
912
|
+
// theodorus
|
|
913
|
+
"minor-seventh": 1.778,
|
|
914
|
+
"major-seventh": 1.875,
|
|
915
|
+
octave: 2,
|
|
916
|
+
"square-root-5": 2.23,
|
|
917
|
+
// pythagoras
|
|
918
|
+
"major-tenth": 2.5,
|
|
919
|
+
"major-eleventh": 2.667,
|
|
920
|
+
"major-twelfth": 3,
|
|
921
|
+
pi: 3.14,
|
|
922
|
+
// archimedes
|
|
923
|
+
"double-octave": 4
|
|
924
|
+
};
|
|
925
|
+
|
|
926
|
+
// src/defaultConfig/unit.js
|
|
927
|
+
var UNIT = {
|
|
928
|
+
default: "em"
|
|
929
|
+
};
|
|
930
|
+
|
|
931
|
+
// src/defaultConfig/typography.js
|
|
932
|
+
var defaultProps = {
|
|
933
|
+
browserDefault: 16,
|
|
934
|
+
base: 16,
|
|
935
|
+
type: "font-size",
|
|
936
|
+
ratio: SEQUENCE["minor-third"],
|
|
937
|
+
range: [-3, 12],
|
|
938
|
+
h1Matches: 6,
|
|
939
|
+
lineHeight: 1.5,
|
|
940
|
+
unit: "em",
|
|
941
|
+
templates: {},
|
|
942
|
+
sequence: {},
|
|
943
|
+
scales: {},
|
|
944
|
+
vars: {}
|
|
945
|
+
};
|
|
946
|
+
var TYPOGRAPHY = defaultProps;
|
|
947
|
+
|
|
948
|
+
// src/defaultConfig/font.js
|
|
949
|
+
var FONT = {};
|
|
950
|
+
|
|
951
|
+
// src/defaultConfig/font-family.js
|
|
952
|
+
var FONT_FAMILY = {};
|
|
953
|
+
var FONT_FAMILY_TYPES = {
|
|
954
|
+
"sans-serif": "Helvetica, Arial, sans-serif, --system-default",
|
|
955
|
+
serif: "Times New Roman, Georgia, serif, --system-default",
|
|
956
|
+
monospace: "Courier New, monospace, --system-default"
|
|
957
|
+
};
|
|
958
|
+
var FONT_FACE = {};
|
|
959
|
+
|
|
960
|
+
// src/defaultConfig/media.js
|
|
961
|
+
var MEDIA = {
|
|
962
|
+
tv: "(min-width: 2780px)",
|
|
963
|
+
screenL: "(max-width: 1920px)",
|
|
964
|
+
"screenL<": "(min-width: 1920px)",
|
|
965
|
+
screenM: "(max-width: 1680px)",
|
|
966
|
+
"screenM<": "(min-width: 1680px)",
|
|
967
|
+
screenS: "(max-width: 1440px)",
|
|
968
|
+
"screenS<": "(min-width: 1440px)",
|
|
969
|
+
tabletL: "(max-width: 1366px)",
|
|
970
|
+
"tabletL<": "(min-width: 1366px)",
|
|
971
|
+
tabletM: "(max-width: 1280px)",
|
|
972
|
+
"tabletM<": "(min-width: 1280px)",
|
|
973
|
+
tabletS: "(max-width: 1024px)",
|
|
974
|
+
"tabletS<": "(min-width: 1024px)",
|
|
975
|
+
mobileL: "(max-width: 768px)",
|
|
976
|
+
"mobileL<": "(min-width: 768px)",
|
|
977
|
+
mobileM: "(max-width: 560px)",
|
|
978
|
+
"mobileM<": "(min-width: 560px)",
|
|
979
|
+
mobileS: "(max-width: 480px)",
|
|
980
|
+
"mobileS<": "(min-width: 480px)",
|
|
981
|
+
mobileXS: "(max-width: 375px)",
|
|
982
|
+
"mobileXS<": "(min-width: 375px)",
|
|
983
|
+
light: "(prefers-color-scheme: light)",
|
|
984
|
+
dark: "(prefers-color-scheme: dark)",
|
|
985
|
+
print: "print"
|
|
986
|
+
};
|
|
987
|
+
|
|
988
|
+
// src/defaultConfig/spacing.js
|
|
989
|
+
var defaultProps2 = {
|
|
990
|
+
base: TYPOGRAPHY.base,
|
|
991
|
+
type: "spacing",
|
|
992
|
+
ratio: SEQUENCE.phi,
|
|
993
|
+
range: [-5, 15],
|
|
994
|
+
subSequence: true,
|
|
995
|
+
unit: "em",
|
|
996
|
+
sequence: {},
|
|
997
|
+
scales: {},
|
|
998
|
+
vars: {}
|
|
999
|
+
};
|
|
1000
|
+
var SPACING = defaultProps2;
|
|
1001
|
+
|
|
1002
|
+
// src/defaultConfig/color.js
|
|
1003
|
+
var COLOR = {};
|
|
1004
|
+
var GRADIENT = {};
|
|
1005
|
+
|
|
1006
|
+
// src/defaultConfig/theme.js
|
|
1007
|
+
var THEME = {};
|
|
1008
|
+
|
|
1009
|
+
// src/defaultConfig/icons.js
|
|
1010
|
+
var ICONS = {};
|
|
1011
|
+
|
|
1012
|
+
// src/defaultConfig/timing.js
|
|
1013
|
+
var defaultProps3 = {
|
|
1014
|
+
default: 150,
|
|
1015
|
+
base: 150,
|
|
1016
|
+
type: "timing",
|
|
1017
|
+
ratio: SEQUENCE["perfect-fourth"],
|
|
1018
|
+
range: [-3, 12],
|
|
1019
|
+
unit: "ms",
|
|
1020
|
+
sequence: {},
|
|
1021
|
+
scales: {},
|
|
1022
|
+
vars: {}
|
|
1023
|
+
};
|
|
1024
|
+
var TIMING = defaultProps3;
|
|
1025
|
+
|
|
1026
|
+
// src/defaultConfig/document.js
|
|
1027
|
+
var DOCUMENT = {};
|
|
1028
|
+
|
|
1029
|
+
// src/defaultConfig/responsive.js
|
|
1030
|
+
var BREAKPOINTS = {
|
|
1031
|
+
screenL: 1920,
|
|
1032
|
+
screenM: 1680,
|
|
1033
|
+
screenS: 1440,
|
|
1034
|
+
tabletL: 1366,
|
|
1035
|
+
tabletM: 1280,
|
|
1036
|
+
tabletS: 1024,
|
|
1037
|
+
mobileL: 768,
|
|
1038
|
+
mobileM: 560,
|
|
1039
|
+
mobileS: 480,
|
|
1040
|
+
mobileXS: 375
|
|
1041
|
+
};
|
|
1042
|
+
var DEVICES = {
|
|
1043
|
+
screenL: [1920, 1024],
|
|
1044
|
+
screenM: [1680, 1024],
|
|
1045
|
+
screenS: [1440, 978],
|
|
1046
|
+
tabletL: [1366, 926],
|
|
1047
|
+
tabletM: [1280, 768],
|
|
1048
|
+
tabletS: [1024, 768],
|
|
1049
|
+
mobileL: [768, 375],
|
|
1050
|
+
mobileM: [560, 768],
|
|
1051
|
+
mobileS: [480, 768],
|
|
1052
|
+
mobileXS: [375, 768]
|
|
1053
|
+
};
|
|
1054
|
+
|
|
1055
|
+
// src/defaultConfig/cases.js
|
|
1056
|
+
var CASES = {};
|
|
1057
|
+
|
|
1058
|
+
// src/defaultConfig/animation.js
|
|
1059
|
+
var ANIMATION = {};
|
|
1060
|
+
|
|
1061
|
+
// src/defaultConfig/svg.js
|
|
1062
|
+
var SVG = {};
|
|
1063
|
+
var SVG_DATA = {};
|
|
1064
|
+
|
|
1065
|
+
// src/defaultConfig/index.js
|
|
1066
|
+
var RESET = {};
|
|
1067
|
+
|
|
1068
|
+
// src/factory.js
|
|
1069
|
+
var CSS_VARS = {};
|
|
1070
|
+
var CONFIG = {
|
|
1071
|
+
verbose: false,
|
|
1072
|
+
useVariable: true,
|
|
1073
|
+
useReset: true,
|
|
1074
|
+
CSS_VARS,
|
|
1075
|
+
...defaultConfig_exports
|
|
1076
|
+
};
|
|
1077
|
+
var cachedConfig = (0, import_utils.deepClone)(CONFIG);
|
|
1078
|
+
var FACTORY = {
|
|
1079
|
+
active: "0",
|
|
1080
|
+
0: CONFIG
|
|
1081
|
+
};
|
|
1082
|
+
var getActiveConfig = (def) => {
|
|
1083
|
+
if ((0, import_utils.isDefined)(def) && !FACTORY[def]) {
|
|
1084
|
+
FACTORY[def] = (0, import_utils.deepClone)(cachedConfig);
|
|
1085
|
+
return FACTORY[def];
|
|
1086
|
+
}
|
|
1087
|
+
return FACTORY[def || FACTORY.active];
|
|
1088
|
+
};
|
|
1089
|
+
|
|
1090
|
+
// src/system/color.js
|
|
1091
|
+
var import_utils8 = __toESM(require_cjs3(), 1);
|
|
1092
|
+
|
|
1093
|
+
// src/utils/color.js
|
|
1094
|
+
var import_globals = __toESM(require_cjs(), 1);
|
|
1095
|
+
var hexToRgbArray = (hex, alpha = 1) => {
|
|
1096
|
+
const [r, g, b] = hex.match(/\w\w/g).map((x) => parseInt(x, 16));
|
|
1097
|
+
return [r, g, b];
|
|
1098
|
+
};
|
|
1099
|
+
var rgbArrayToHex = ([r, g, b]) => {
|
|
1100
|
+
return ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1);
|
|
1101
|
+
};
|
|
1102
|
+
var rgbToHSL = (r, g, b) => {
|
|
1103
|
+
const a = Math.max(r, g, b);
|
|
1104
|
+
const n = a - Math.min(r, g, b);
|
|
1105
|
+
const f = 1 - Math.abs(a + a - n - 1);
|
|
1106
|
+
const h = n && (a == r ? (g - b) / n : a == g ? 2 + (b - r) / n : 4 + (r - g) / n);
|
|
1107
|
+
return [60 * (h < 0 ? h + 6 : h), f ? n / f : 0, (a + a - n) / 2];
|
|
1108
|
+
};
|
|
1109
|
+
var hslToRgb = (h, s, l, a = s * Math.min(l, 1 - l), f = (n, k = (n + h / 30) % 12) => l - a * Math.max(
|
|
1110
|
+
Math.min(k - 3, 9 - k, 1),
|
|
1111
|
+
-1
|
|
1112
|
+
)) => [f(0), f(8), f(4)];
|
|
1113
|
+
var getColorShade = (col, amt) => {
|
|
1114
|
+
const num = parseInt(col, 16);
|
|
1115
|
+
let r = (num >> 16) + amt;
|
|
1116
|
+
if (r > 255)
|
|
1117
|
+
r = 255;
|
|
1118
|
+
else if (r < 0)
|
|
1119
|
+
r = 0;
|
|
1120
|
+
let b = (num >> 8 & 255) + amt;
|
|
1121
|
+
if (b > 255)
|
|
1122
|
+
b = 255;
|
|
1123
|
+
else if (b < 0)
|
|
1124
|
+
b = 0;
|
|
1125
|
+
let g = (num & 255) + amt;
|
|
1126
|
+
if (g > 255)
|
|
1127
|
+
g = 255;
|
|
1128
|
+
else if (g < 0)
|
|
1129
|
+
g = 0;
|
|
1130
|
+
return (g | b << 8 | r << 16).toString(16);
|
|
1131
|
+
};
|
|
1132
|
+
|
|
1133
|
+
// src/utils/sequence.js
|
|
1134
|
+
var import_utils4 = __toESM(require_cjs3(), 1);
|
|
1135
|
+
|
|
1136
|
+
// ../utils/src/index.js
|
|
1137
|
+
var import_utils3 = __toESM(require_cjs3());
|
|
1138
|
+
|
|
1139
|
+
// ../utils/src/scaling.js
|
|
1140
|
+
var import_utils2 = __toESM(require_cjs3());
|
|
1141
|
+
|
|
1142
|
+
// ../utils/src/index.js
|
|
1143
|
+
var toDashCase = (val) => val.replace(/[A-Z]/g, (match, offset) => (offset > 0 ? "-" : "") + match.toLowerCase()).replace(".", "-");
|
|
1144
|
+
var arrayzeValue = (val) => {
|
|
1145
|
+
if ((0, import_utils3.isString)(val))
|
|
1146
|
+
return val.split(" ");
|
|
1147
|
+
if ((0, import_utils3.isObject)(val))
|
|
1148
|
+
return Object.keys(val).map((v) => val[v]);
|
|
1149
|
+
if ((0, import_utils3.isArray)(val))
|
|
1150
|
+
return val;
|
|
1151
|
+
};
|
|
1152
|
+
|
|
1153
|
+
// src/utils/sequence.js
|
|
1154
|
+
var numToLetterMap = {
|
|
1155
|
+
"-6": "U",
|
|
1156
|
+
"-5": "V",
|
|
1157
|
+
"-4": "W",
|
|
1158
|
+
"-3": "X",
|
|
1159
|
+
"-2": "Y",
|
|
1160
|
+
"-1": "Z",
|
|
1161
|
+
0: "A",
|
|
1162
|
+
1: "B",
|
|
1163
|
+
2: "C",
|
|
1164
|
+
3: "D",
|
|
1165
|
+
4: "E",
|
|
1166
|
+
5: "F",
|
|
1167
|
+
6: "G",
|
|
1168
|
+
7: "H",
|
|
1169
|
+
8: "I",
|
|
1170
|
+
9: "J",
|
|
1171
|
+
10: "K",
|
|
1172
|
+
11: "L",
|
|
1173
|
+
12: "M",
|
|
1174
|
+
13: "N",
|
|
1175
|
+
14: "O",
|
|
1176
|
+
15: "P",
|
|
1177
|
+
16: "Q",
|
|
1178
|
+
17: "R",
|
|
1179
|
+
18: "S",
|
|
1180
|
+
19: "T"
|
|
1181
|
+
};
|
|
1182
|
+
var setSequenceValue = (props, sequenceProps) => {
|
|
1183
|
+
const { key, variable, value, scaling, index } = props;
|
|
1184
|
+
sequenceProps.sequence[key] = {
|
|
1185
|
+
key,
|
|
1186
|
+
decimal: ~~(value * 100) / 100,
|
|
1187
|
+
val: ~~value,
|
|
1188
|
+
scaling,
|
|
1189
|
+
index,
|
|
1190
|
+
variable
|
|
1191
|
+
};
|
|
1192
|
+
sequenceProps.scales[key] = scaling;
|
|
1193
|
+
sequenceProps.vars[variable] = scaling + sequenceProps.unit;
|
|
1194
|
+
};
|
|
1195
|
+
var generateSubSequence = (props, sequenceProps) => {
|
|
1196
|
+
const { key, base, value, ratio, variable, index } = props;
|
|
1197
|
+
const next = value * ratio;
|
|
1198
|
+
const diff = next - value;
|
|
1199
|
+
const smallscale = diff / 1.618;
|
|
1200
|
+
const valueRounded = ~~value;
|
|
1201
|
+
const nextRounded = ~~next;
|
|
1202
|
+
const diffRounded = nextRounded - valueRounded;
|
|
1203
|
+
let arr = [];
|
|
1204
|
+
const first = next - smallscale;
|
|
1205
|
+
const second = value + smallscale;
|
|
1206
|
+
const middle = (first + second) / 2;
|
|
1207
|
+
if (diffRounded > 16)
|
|
1208
|
+
arr = [first, middle, second];
|
|
1209
|
+
else
|
|
1210
|
+
arr = [first, second];
|
|
1211
|
+
arr.map((v, k) => {
|
|
1212
|
+
const scaling = ~~(v / base * 1e3) / 1e3;
|
|
1213
|
+
const newVar = variable + (k + 1);
|
|
1214
|
+
const props2 = {
|
|
1215
|
+
key: key + (k + 1),
|
|
1216
|
+
variable: newVar,
|
|
1217
|
+
value: v,
|
|
1218
|
+
scaling,
|
|
1219
|
+
index: index + (k + 1) / 10
|
|
1220
|
+
};
|
|
1221
|
+
return setSequenceValue(props2, sequenceProps);
|
|
1222
|
+
});
|
|
1223
|
+
};
|
|
1224
|
+
var switchSequenceOnNegative = (key, base, ratio) => {
|
|
1225
|
+
return base * Math.pow(ratio, key);
|
|
1226
|
+
};
|
|
1227
|
+
var generateSequence = (sequenceProps) => {
|
|
1228
|
+
const { type, base, ratio, range, subSequence } = sequenceProps;
|
|
1229
|
+
const n = Math.abs(range[0]) + Math.abs(range[1]);
|
|
1230
|
+
const prefix = "--" + (type && type.replace(".", "-")) + "-";
|
|
1231
|
+
for (let i = 0; i <= n; i++) {
|
|
1232
|
+
const key = range[1] - i;
|
|
1233
|
+
const letterKey = numToLetterMap[key];
|
|
1234
|
+
const value = switchSequenceOnNegative(key, base, ratio);
|
|
1235
|
+
const scaling = ~~(value / base * 100) / 100;
|
|
1236
|
+
const variable = prefix + letterKey;
|
|
1237
|
+
const props = {
|
|
1238
|
+
key: letterKey,
|
|
1239
|
+
variable,
|
|
1240
|
+
value,
|
|
1241
|
+
base,
|
|
1242
|
+
scaling,
|
|
1243
|
+
ratio,
|
|
1244
|
+
index: key
|
|
1245
|
+
};
|
|
1246
|
+
setSequenceValue(props, sequenceProps);
|
|
1247
|
+
if (subSequence)
|
|
1248
|
+
generateSubSequence(props, sequenceProps);
|
|
1249
|
+
}
|
|
1250
|
+
return sequenceProps;
|
|
1251
|
+
};
|
|
1252
|
+
var getSequenceValue = (value = "A", sequenceProps) => {
|
|
1253
|
+
const CONFIG2 = getActiveConfig();
|
|
1254
|
+
const { UNIT: UNIT2 } = CONFIG2;
|
|
1255
|
+
const {
|
|
1256
|
+
sequence,
|
|
1257
|
+
unit = UNIT2.default,
|
|
1258
|
+
useVariable
|
|
1259
|
+
} = sequenceProps;
|
|
1260
|
+
if ((0, import_utils4.isString)(value) && value.slice(0, 2) === "--")
|
|
1261
|
+
return `var(${value})`;
|
|
1262
|
+
const prefix = `--${toDashCase(sequenceProps.type.replace(".", "-"))}-`;
|
|
1263
|
+
const startsWithDashOrLetterRegex = /^-?[a-zA-Z]/i;
|
|
1264
|
+
const startsWithDashOrLetter = startsWithDashOrLetterRegex.test(value);
|
|
1265
|
+
if (value === "none" || value === "auto" || value === "unset" || value === "inherit" || value === "fit-content" || value === "min-content" || value === "max-content" || value.includes("calc") || !startsWithDashOrLetter)
|
|
1266
|
+
return value;
|
|
1267
|
+
const letterVal = value.toUpperCase();
|
|
1268
|
+
const isNegative = letterVal.slice(0, 1) === "-" ? "-" : "";
|
|
1269
|
+
let absValue = isNegative ? letterVal.slice(1) : letterVal;
|
|
1270
|
+
let mediaName = "";
|
|
1271
|
+
if (absValue.includes("-")) {
|
|
1272
|
+
mediaName = "-" + absValue.split("-")[1].toLowerCase();
|
|
1273
|
+
absValue = absValue.split("-")[0];
|
|
1274
|
+
}
|
|
1275
|
+
const varValue = (v) => `var(${prefix}${v}${mediaName})`;
|
|
1276
|
+
if (absValue.includes("+")) {
|
|
1277
|
+
const args = absValue.split("+");
|
|
1278
|
+
const [first, second] = args;
|
|
1279
|
+
const joint = `${varValue(first)} + ${varValue(second)}`;
|
|
1280
|
+
return isNegative ? `calc((${joint}) * -1)` : `calc(${joint})`;
|
|
1281
|
+
} else if (absValue.includes("-")) {
|
|
1282
|
+
const args = absValue.split("-");
|
|
1283
|
+
const [first, second] = args;
|
|
1284
|
+
const joint = `${varValue(first)} - ${varValue(second)}`;
|
|
1285
|
+
return isNegative ? `calc((${joint}) * -1)` : `calc(${joint})`;
|
|
1286
|
+
}
|
|
1287
|
+
if (!sequence[absValue] && absValue.length === 2) {
|
|
1288
|
+
if (CONFIG2.verbose)
|
|
1289
|
+
console.warn(absValue, "- value is not found because `subSequence` is set to false");
|
|
1290
|
+
absValue = absValue.slice(0, 1);
|
|
1291
|
+
}
|
|
1292
|
+
if (useVariable || CONFIG2.useVariable) {
|
|
1293
|
+
const varValue2 = `var(${prefix}${absValue}${mediaName})`;
|
|
1294
|
+
return isNegative ? `calc(${varValue2} * -1)` : varValue2;
|
|
1295
|
+
}
|
|
1296
|
+
const sequenceItem = sequence ? sequence[absValue] : null;
|
|
1297
|
+
if (!sequenceItem)
|
|
1298
|
+
return console.warn("can't find", sequence, absValue);
|
|
1299
|
+
if (unit === "ms" || unit === "s") {
|
|
1300
|
+
return isNegative + sequenceItem.val + unit;
|
|
1301
|
+
}
|
|
1302
|
+
return isNegative + sequenceItem.scaling + unit;
|
|
1303
|
+
};
|
|
1304
|
+
var getSequenceValuePropertyPair = (value, propertyName, sequenceProps) => {
|
|
1305
|
+
if (typeof value !== "string") {
|
|
1306
|
+
console.warn(propertyName, value, "is not a string");
|
|
1307
|
+
return {};
|
|
1308
|
+
}
|
|
1309
|
+
if (value === "-" || value === "")
|
|
1310
|
+
return {};
|
|
1311
|
+
return { [propertyName]: getSequenceValue(value, sequenceProps) };
|
|
1312
|
+
};
|
|
1313
|
+
|
|
1314
|
+
// src/utils/var.js
|
|
1315
|
+
var import_utils6 = __toESM(require_cjs3(), 1);
|
|
1316
|
+
|
|
1317
|
+
// src/utils/sprite.js
|
|
1318
|
+
var import_utils7 = __toESM(require_cjs3(), 1);
|
|
1319
|
+
|
|
1320
|
+
// src/system/color.js
|
|
1321
|
+
var getColor = (value, key) => {
|
|
1322
|
+
const CONFIG2 = getActiveConfig();
|
|
1323
|
+
if (!(0, import_utils8.isString)(value)) {
|
|
1324
|
+
if (CONFIG2.verbose)
|
|
1325
|
+
console.warn(value, "- type for color is not valid");
|
|
1326
|
+
return;
|
|
1327
|
+
}
|
|
1328
|
+
if (value.slice(0, 2) === "--")
|
|
1329
|
+
return `var(${value})`;
|
|
1330
|
+
if (key && value[key])
|
|
1331
|
+
value = value[key];
|
|
1332
|
+
const [name, alpha, tone] = (0, import_utils8.isArray)(value) ? value : value.split(" ");
|
|
1333
|
+
const { COLOR: COLOR2, GRADIENT: GRADIENT2 } = CONFIG2;
|
|
1334
|
+
let val = COLOR2[name] || GRADIENT2[name];
|
|
1335
|
+
if (!val) {
|
|
1336
|
+
if (CONFIG2.verbose)
|
|
1337
|
+
console.warn("Can't find color ", name);
|
|
1338
|
+
return value;
|
|
1339
|
+
}
|
|
1340
|
+
if (key) {
|
|
1341
|
+
if (val[key])
|
|
1342
|
+
val = val[key];
|
|
1343
|
+
else if (CONFIG2.verbose)
|
|
1344
|
+
console.warn(value, " - does not have ", key);
|
|
1345
|
+
}
|
|
1346
|
+
let rgb = val.rgb;
|
|
1347
|
+
if (rgb) {
|
|
1348
|
+
if (tone) {
|
|
1349
|
+
if (!val[tone]) {
|
|
1350
|
+
const toHex = rgbArrayToHex(rgb.split(", ").map((v) => parseFloat(v)));
|
|
1351
|
+
const abs = tone.slice(0, 1);
|
|
1352
|
+
if (abs === "-" || abs === "+") {
|
|
1353
|
+
rgb = hexToRgbArray(
|
|
1354
|
+
getColorShade(toHex, parseFloat(tone))
|
|
1355
|
+
).join(", ");
|
|
1356
|
+
} else {
|
|
1357
|
+
const [r, g, b] = [...rgb.split(", ").map((v) => parseInt(v))];
|
|
1358
|
+
const hsl = rgbToHSL(r, g, b);
|
|
1359
|
+
const [h, s, l] = hsl;
|
|
1360
|
+
const newRgb = hslToRgb(h, s, parseFloat(tone) / 100 * 255);
|
|
1361
|
+
rgb = newRgb;
|
|
1362
|
+
}
|
|
1363
|
+
val[tone] = { rgb, var: `${val.var}-${tone}` };
|
|
1364
|
+
} else
|
|
1365
|
+
rgb = val[tone].rgb;
|
|
1366
|
+
}
|
|
1367
|
+
if (alpha)
|
|
1368
|
+
return `rgba(${rgb}, ${alpha})`;
|
|
1369
|
+
return CONFIG2.useVariable ? `var(${val.var})` : `rgb(${rgb})`;
|
|
1370
|
+
} else
|
|
1371
|
+
return CONFIG2.useVariable ? `var(${val.var})` : val.value;
|
|
1372
|
+
};
|
|
1373
|
+
var getMediaColor = (value, globalTheme) => {
|
|
1374
|
+
const CONFIG2 = getActiveConfig();
|
|
1375
|
+
if (!globalTheme)
|
|
1376
|
+
globalTheme = CONFIG2.globalTheme;
|
|
1377
|
+
if (!(0, import_utils8.isString)(value)) {
|
|
1378
|
+
if (CONFIG2.verbose)
|
|
1379
|
+
console.warn(value, "- type for color is not valid");
|
|
1380
|
+
return;
|
|
1381
|
+
}
|
|
1382
|
+
if (value.slice(0, 2) === "--")
|
|
1383
|
+
return `var(${value})`;
|
|
1384
|
+
const [name] = (0, import_utils8.isArray)(value) ? value : value.split(" ");
|
|
1385
|
+
const { COLOR: COLOR2, GRADIENT: GRADIENT2 } = CONFIG2;
|
|
1386
|
+
const val = COLOR2[name] || GRADIENT2[name];
|
|
1387
|
+
const isObj = (0, import_utils8.isObject)(val);
|
|
1388
|
+
if (isObj && val.value)
|
|
1389
|
+
return getColor(value, `@${globalTheme}`);
|
|
1390
|
+
else if (isObj) {
|
|
1391
|
+
if (globalTheme)
|
|
1392
|
+
return getColor(value, `@${globalTheme}`);
|
|
1393
|
+
else {
|
|
1394
|
+
const obj = {};
|
|
1395
|
+
for (const mediaName in val) {
|
|
1396
|
+
const query = CONFIG2.MEDIA[mediaName.slice(1)];
|
|
1397
|
+
const media = `@media screen and ${query}`;
|
|
1398
|
+
obj[media] = getColor(value, mediaName);
|
|
1399
|
+
}
|
|
1400
|
+
return obj;
|
|
1401
|
+
}
|
|
1402
|
+
} else {
|
|
1403
|
+
if (CONFIG2.verbose)
|
|
1404
|
+
console.warn("Can't find color", value);
|
|
1405
|
+
return value;
|
|
1406
|
+
}
|
|
1407
|
+
};
|
|
1408
|
+
|
|
1409
|
+
// src/system/theme.js
|
|
1410
|
+
var import_utils10 = __toESM(require_cjs3(), 1);
|
|
1411
|
+
|
|
1412
|
+
// src/system/font.js
|
|
1413
|
+
var import_utils11 = __toESM(require_cjs3(), 1);
|
|
1414
|
+
|
|
1415
|
+
// src/system/typography.js
|
|
1416
|
+
var import_utils14 = __toESM(require_cjs3(), 1);
|
|
1417
|
+
|
|
1418
|
+
// src/system/spacing.js
|
|
1419
|
+
var import_utils17 = __toESM(require_cjs3(), 1);
|
|
1420
|
+
var getSequence = (sequenceProps) => {
|
|
1421
|
+
const CONFIG2 = getActiveConfig();
|
|
1422
|
+
const { SPACING: SPACING2 } = CONFIG2;
|
|
1423
|
+
if (!sequenceProps)
|
|
1424
|
+
return SPACING2;
|
|
1425
|
+
const hasGenerated = Object.keys(sequenceProps.sequence).length > 0;
|
|
1426
|
+
return hasGenerated ? sequenceProps : generateSequence(sequenceProps);
|
|
1427
|
+
};
|
|
1428
|
+
var getSpacingByKey = (value, propertyName = "padding", sequenceProps) => {
|
|
1429
|
+
const sequence = getSequence(sequenceProps);
|
|
1430
|
+
const stack = arrayzeValue(value);
|
|
1431
|
+
if (!stack)
|
|
1432
|
+
return;
|
|
1433
|
+
if ((0, import_utils17.isString)(value) && value.includes("calc")) {
|
|
1434
|
+
return { [propertyName]: value };
|
|
1435
|
+
}
|
|
1436
|
+
if (stack.length > 1) {
|
|
1437
|
+
let suffix = "";
|
|
1438
|
+
if (propertyName === "borderWidth") {
|
|
1439
|
+
propertyName = "border";
|
|
1440
|
+
suffix = "Width";
|
|
1441
|
+
}
|
|
1442
|
+
const directions = {
|
|
1443
|
+
2: ["Block", "Inline"],
|
|
1444
|
+
3: ["BlockStart", "Inline", "BlockEnd"],
|
|
1445
|
+
4: ["BlockStart", "InlineEnd", "BlockEnd", "InlineStart"]
|
|
1446
|
+
};
|
|
1447
|
+
const wrapSequenceValueByDirection = (direction, i) => getSequenceValuePropertyPair(
|
|
1448
|
+
stack[i],
|
|
1449
|
+
propertyName + direction + suffix,
|
|
1450
|
+
sequence
|
|
1451
|
+
);
|
|
1452
|
+
return directions[stack.length].map((dir, key) => wrapSequenceValueByDirection(dir, key));
|
|
1453
|
+
}
|
|
1454
|
+
return getSequenceValuePropertyPair(
|
|
1455
|
+
value,
|
|
1456
|
+
propertyName,
|
|
1457
|
+
sequence
|
|
1458
|
+
);
|
|
1459
|
+
};
|
|
1460
|
+
|
|
1461
|
+
// src/system/document.js
|
|
1462
|
+
var import_utils21 = __toESM(require_cjs3(), 1);
|
|
1463
|
+
|
|
1464
|
+
// src/system/svg.js
|
|
1465
|
+
var import_globals2 = __toESM(require_cjs(), 1);
|
|
1466
|
+
|
|
1467
|
+
// src/system/reset.js
|
|
1468
|
+
var import_utils24 = __toESM(require_cjs3(), 1);
|
|
1469
|
+
|
|
1470
|
+
// src/transforms/index.js
|
|
1471
|
+
var isBorderStyle = (str) => [
|
|
1472
|
+
"none",
|
|
1473
|
+
"hidden",
|
|
1474
|
+
"dotted",
|
|
1475
|
+
"dashed",
|
|
1476
|
+
"solid",
|
|
1477
|
+
"double",
|
|
1478
|
+
"groove",
|
|
1479
|
+
"ridge",
|
|
1480
|
+
"inset",
|
|
1481
|
+
"outset",
|
|
1482
|
+
"initial"
|
|
1483
|
+
].some((v) => str.includes(v));
|
|
1484
|
+
var transformBorder = (border) => {
|
|
1485
|
+
const arr = border.split(", ");
|
|
1486
|
+
return arr.map((v) => {
|
|
1487
|
+
v = v.trim();
|
|
1488
|
+
if (v.slice(0, 2) === "--")
|
|
1489
|
+
return `var(${v})`;
|
|
1490
|
+
else if (isBorderStyle(v))
|
|
1491
|
+
return v || "solid";
|
|
1492
|
+
else if (v.slice(-2) === "px" || v.slice(-2) === "em")
|
|
1493
|
+
return v;
|
|
1494
|
+
else if (getColor(v).length > 2)
|
|
1495
|
+
return getColor(v);
|
|
1496
|
+
return getSpacingByKey(v, "border").border;
|
|
1497
|
+
}).join(" ");
|
|
1498
|
+
};
|
|
1499
|
+
var transformTextStroke = (stroke) => {
|
|
1500
|
+
return stroke.split(", ").map((v) => {
|
|
1501
|
+
if (v.slice(0, 2) === "--")
|
|
1502
|
+
return `var(${v})`;
|
|
1503
|
+
if (v.includes("px"))
|
|
1504
|
+
return v;
|
|
1505
|
+
else if (getColor(v))
|
|
1506
|
+
return getColor(v);
|
|
1507
|
+
}).join(" ");
|
|
1508
|
+
};
|
|
1509
|
+
var transformShadow = (shadows) => shadows.split("|").map((shadow) => {
|
|
1510
|
+
return shadow.split(", ").map((v) => {
|
|
1511
|
+
v = v.trim();
|
|
1512
|
+
if (v.slice(0, 2) === "--")
|
|
1513
|
+
return `var(${v})`;
|
|
1514
|
+
if (getColor(v).length > 2)
|
|
1515
|
+
return getColor(v);
|
|
1516
|
+
if (v.includes("px") || v.slice(-2) === "em")
|
|
1517
|
+
return v;
|
|
1518
|
+
const arr = v.split(" ");
|
|
1519
|
+
if (!arr.length)
|
|
1520
|
+
return v;
|
|
1521
|
+
return arr.map((v2) => getSpacingByKey(v2, "shadow").shadow).join(" ");
|
|
1522
|
+
}).join(" ");
|
|
1523
|
+
}).join(",");
|
|
1524
|
+
var transformBackgroundImage = (backgroundImage, globalTheme) => {
|
|
1525
|
+
const CONFIG2 = getActiveConfig();
|
|
1526
|
+
return backgroundImage.split(", ").map((v) => {
|
|
1527
|
+
if (v.slice(0, 2) === "--")
|
|
1528
|
+
return `var(${v})`;
|
|
1529
|
+
if (v.includes("url") || v.includes("gradient"))
|
|
1530
|
+
return v;
|
|
1531
|
+
else if (CONFIG2.GRADIENT[backgroundImage]) {
|
|
1532
|
+
return {
|
|
1533
|
+
backgroundImage: getMediaColor(backgroundImage, globalTheme || CONFIG2.globalTheme)
|
|
1534
|
+
};
|
|
1535
|
+
} else if (v.includes("/") || v.includes("http"))
|
|
1536
|
+
return `url(${v})`;
|
|
1537
|
+
return v;
|
|
1538
|
+
}).join(" ");
|
|
1539
|
+
};
|
|
1540
|
+
var transfromGap = (gap) => (0, import_utils25.isString)(gap) && gap.split(" ").map((v) => getSpacingByKey(v, "gap").gap).join(" ");
|