@symbo.ls/scratch 2.10.223 → 2.10.225
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/defaultConfig/animation.js +3 -1
- package/dist/cjs/defaultConfig/cases.js +3 -1
- package/dist/cjs/defaultConfig/color.js +4 -8
- package/dist/cjs/defaultConfig/document.js +3 -1
- package/dist/cjs/defaultConfig/font-family.js +5 -9
- package/dist/cjs/defaultConfig/font.js +3 -10
- package/dist/cjs/defaultConfig/icons.js +3 -1
- package/dist/cjs/defaultConfig/index.js +184 -19
- package/dist/cjs/defaultConfig/media.js +3 -1
- package/dist/cjs/defaultConfig/responsive.js +4 -2
- package/dist/cjs/defaultConfig/sequence.js +3 -1
- package/dist/cjs/defaultConfig/spacing.js +53 -6
- package/dist/cjs/defaultConfig/svg.js +4 -2
- package/dist/cjs/defaultConfig/theme.js +3 -13
- package/dist/cjs/defaultConfig/timing.js +35 -4
- package/dist/cjs/defaultConfig/typography.js +35 -4
- package/dist/cjs/defaultConfig/unit.js +3 -1
- package/dist/cjs/factory.js +999 -10
- package/dist/cjs/index.js +2462 -6
- package/dist/cjs/set.js +2172 -46
- package/dist/cjs/system/color.js +1162 -44
- package/dist/cjs/system/document.js +1062 -11
- package/dist/cjs/system/font.js +1093 -17
- package/dist/cjs/system/index.js +2136 -10
- package/dist/cjs/system/reset.js +1131 -20
- package/dist/cjs/system/spacing.js +1274 -33
- package/dist/cjs/system/svg.js +1104 -25
- package/dist/cjs/system/theme.js +1187 -68
- package/dist/cjs/system/timing.js +1255 -19
- package/dist/cjs/system/typography.js +1270 -28
- package/dist/cjs/tests/index.js +4 -2
- package/dist/cjs/utils/color.js +68 -16
- package/dist/cjs/utils/font.js +11 -9
- package/dist/cjs/utils/index.js +1508 -7
- package/dist/cjs/utils/sequence.js +1051 -19
- package/dist/cjs/utils/sprite.js +815 -4
- package/dist/cjs/utils/theme.js +3 -1
- package/dist/cjs/utils/var.js +1044 -21
- package/package.json +3 -3
- package/src/index.js +4 -0
- package/src/set.js +0 -2
- package/src/utils/color.js +3 -0
package/dist/cjs/set.js
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
5
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
|
+
};
|
|
6
11
|
var __export = (target, all) => {
|
|
7
12
|
for (var name in all)
|
|
8
13
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -15,35 +20,2157 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
20
|
}
|
|
16
21
|
return to;
|
|
17
22
|
};
|
|
18
|
-
var
|
|
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
|
+
));
|
|
19
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: () => isFunction2,
|
|
285
|
+
isHtmlElement: () => isHtmlElement,
|
|
286
|
+
isNode: () => isNode,
|
|
287
|
+
isNot: () => isNot,
|
|
288
|
+
isNull: () => isNull,
|
|
289
|
+
isNumber: () => isNumber,
|
|
290
|
+
isObject: () => isObject6,
|
|
291
|
+
isObjectLike: () => isObjectLike3,
|
|
292
|
+
isString: () => isString7,
|
|
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 isString7 = (arg) => typeof arg === "string";
|
|
306
|
+
var isNumber = (arg) => typeof arg === "number";
|
|
307
|
+
var isFunction2 = (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) || isString7(arg) || isNumber(arg) || isFunction2(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: isString7,
|
|
333
|
+
number: isNumber,
|
|
334
|
+
null: isNull,
|
|
335
|
+
function: isFunction2,
|
|
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
|
+
diff: () => diff,
|
|
384
|
+
exec: () => exec,
|
|
385
|
+
flattenRecursive: () => flattenRecursive,
|
|
386
|
+
isEqualDeep: () => isEqualDeep,
|
|
387
|
+
map: () => map,
|
|
388
|
+
merge: () => merge5,
|
|
389
|
+
mergeAndCloneIfArray: () => mergeAndCloneIfArray,
|
|
390
|
+
mergeArray: () => mergeArray,
|
|
391
|
+
mergeArrayExclude: () => mergeArrayExclude,
|
|
392
|
+
mergeIfExisted: () => mergeIfExisted,
|
|
393
|
+
overwrite: () => overwrite,
|
|
394
|
+
overwriteDeep: () => overwriteDeep,
|
|
395
|
+
overwriteObj: () => overwriteObj
|
|
396
|
+
});
|
|
397
|
+
module2.exports = __toCommonJS2(object_exports);
|
|
398
|
+
var import_globals3 = require_cjs();
|
|
399
|
+
var import_types = require_types();
|
|
400
|
+
var exec = (param, element, state, context) => {
|
|
401
|
+
if ((0, import_types.isFunction)(param)) {
|
|
402
|
+
return param(
|
|
403
|
+
element,
|
|
404
|
+
state || element.state,
|
|
405
|
+
context || element.context
|
|
406
|
+
);
|
|
407
|
+
}
|
|
408
|
+
return param;
|
|
409
|
+
};
|
|
410
|
+
var map = (obj, extention, element) => {
|
|
411
|
+
for (const e in extention) {
|
|
412
|
+
obj[e] = exec(extention[e], element);
|
|
413
|
+
}
|
|
414
|
+
};
|
|
415
|
+
var merge5 = (element, obj) => {
|
|
416
|
+
for (const e in obj) {
|
|
417
|
+
const elementProp = element[e];
|
|
418
|
+
const objProp = obj[e];
|
|
419
|
+
if (elementProp === void 0) {
|
|
420
|
+
element[e] = objProp;
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
return element;
|
|
424
|
+
};
|
|
425
|
+
var deepMerge2 = (element, extend) => {
|
|
426
|
+
for (const e in extend) {
|
|
427
|
+
const extendProp = extend[e];
|
|
428
|
+
if (e === "parent" || e === "props")
|
|
429
|
+
continue;
|
|
430
|
+
if (element[e] === void 0) {
|
|
431
|
+
element[e] = extendProp;
|
|
432
|
+
} else if ((0, import_types.isObjectLike)(element[e]) && (0, import_types.isObjectLike)(extendProp)) {
|
|
433
|
+
deepMerge2(element[e], extendProp);
|
|
434
|
+
} else {
|
|
435
|
+
element[e] = extendProp;
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
return element;
|
|
439
|
+
};
|
|
440
|
+
var clone = (obj) => {
|
|
441
|
+
const o = {};
|
|
442
|
+
for (const prop in obj) {
|
|
443
|
+
if (prop === "node")
|
|
444
|
+
continue;
|
|
445
|
+
o[prop] = obj[prop];
|
|
446
|
+
}
|
|
447
|
+
return o;
|
|
448
|
+
};
|
|
449
|
+
var deepCloneExclude = (obj, exclude = []) => {
|
|
450
|
+
if ((0, import_types.isArray)(obj)) {
|
|
451
|
+
return obj.map((x) => deepCloneExclude(x, exclude));
|
|
452
|
+
}
|
|
453
|
+
const o = {};
|
|
454
|
+
for (const k in obj) {
|
|
455
|
+
if (exclude.indexOf(k) > -1)
|
|
456
|
+
continue;
|
|
457
|
+
let v = obj[k];
|
|
458
|
+
if (k === "extend" && (0, import_types.isArray)(v)) {
|
|
459
|
+
v = mergeArrayExclude(v, exclude);
|
|
460
|
+
}
|
|
461
|
+
if ((0, import_types.isArray)(v)) {
|
|
462
|
+
o[k] = v.map((x) => deepCloneExclude(x, exclude));
|
|
463
|
+
} else if ((0, import_types.isObject)(v)) {
|
|
464
|
+
o[k] = deepCloneExclude(v, exclude);
|
|
465
|
+
} else
|
|
466
|
+
o[k] = v;
|
|
467
|
+
}
|
|
468
|
+
return o;
|
|
469
|
+
};
|
|
470
|
+
var mergeArrayExclude = (arr, excl = []) => {
|
|
471
|
+
return arr.reduce((acc, curr) => deepMerge2(acc, deepCloneExclude(curr, excl)), {});
|
|
472
|
+
};
|
|
473
|
+
var deepClone2 = (obj) => {
|
|
474
|
+
if ((0, import_types.isArray)(obj)) {
|
|
475
|
+
return obj.map(deepClone2);
|
|
476
|
+
}
|
|
477
|
+
const o = {};
|
|
478
|
+
for (const prop in obj) {
|
|
479
|
+
let objProp = obj[prop];
|
|
480
|
+
if (prop === "extend" && (0, import_types.isArray)(objProp)) {
|
|
481
|
+
objProp = mergeArray(objProp);
|
|
482
|
+
}
|
|
483
|
+
if ((0, import_types.isArray)(objProp)) {
|
|
484
|
+
o[prop] = objProp.map((v) => (0, import_types.isObject)(v) ? deepClone2(v) : v);
|
|
485
|
+
} else if ((0, import_types.isObject)(objProp)) {
|
|
486
|
+
o[prop] = deepClone2(objProp);
|
|
487
|
+
} else
|
|
488
|
+
o[prop] = objProp;
|
|
489
|
+
}
|
|
490
|
+
return o;
|
|
491
|
+
};
|
|
492
|
+
var deepStringify = (obj, stringified = {}) => {
|
|
493
|
+
for (const prop in obj) {
|
|
494
|
+
const objProp = obj[prop];
|
|
495
|
+
if ((0, import_types.isFunction)(objProp)) {
|
|
496
|
+
stringified[prop] = objProp.toString();
|
|
497
|
+
} else if ((0, import_types.isObject)(objProp)) {
|
|
498
|
+
stringified[prop] = {};
|
|
499
|
+
deepStringify(objProp, stringified[prop]);
|
|
500
|
+
} else if ((0, import_types.isArray)(objProp)) {
|
|
501
|
+
stringified[prop] = [];
|
|
502
|
+
objProp.forEach((v, i) => {
|
|
503
|
+
if ((0, import_types.isObject)(v)) {
|
|
504
|
+
stringified[prop][i] = {};
|
|
505
|
+
deepStringify(v, stringified[prop][i]);
|
|
506
|
+
} else if ((0, import_types.isFunction)(v)) {
|
|
507
|
+
stringified[prop][i] = v.toString();
|
|
508
|
+
} else {
|
|
509
|
+
stringified[prop][i] = v;
|
|
510
|
+
}
|
|
511
|
+
});
|
|
512
|
+
} else {
|
|
513
|
+
stringified[prop] = objProp;
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
return stringified;
|
|
517
|
+
};
|
|
518
|
+
var deepDestringify = (obj, stringified = {}) => {
|
|
519
|
+
for (const prop in obj) {
|
|
520
|
+
const objProp = obj[prop];
|
|
521
|
+
if ((0, import_types.isString)(objProp)) {
|
|
522
|
+
if (objProp.includes("=>") || objProp.includes("function") || objProp.startsWith("(")) {
|
|
523
|
+
try {
|
|
524
|
+
const evalProp = import_globals3.window.eval(`(${objProp})`);
|
|
525
|
+
stringified[prop] = evalProp;
|
|
526
|
+
} catch (e) {
|
|
527
|
+
if (e)
|
|
528
|
+
stringified[prop] = objProp;
|
|
529
|
+
}
|
|
530
|
+
} else {
|
|
531
|
+
stringified[prop] = objProp;
|
|
532
|
+
}
|
|
533
|
+
} else if ((0, import_types.isArray)(objProp)) {
|
|
534
|
+
stringified[prop] = [];
|
|
535
|
+
objProp.forEach((arrProp) => {
|
|
536
|
+
if ((0, import_types.isString)(arrProp)) {
|
|
537
|
+
if (arrProp.includes("=>") || arrProp.includes("function") || arrProp.startsWith("(")) {
|
|
538
|
+
try {
|
|
539
|
+
const evalProp = import_globals3.window.eval(`(${arrProp})`);
|
|
540
|
+
stringified[prop].push(evalProp);
|
|
541
|
+
} catch (e) {
|
|
542
|
+
if (e)
|
|
543
|
+
stringified[prop].push(arrProp);
|
|
544
|
+
}
|
|
545
|
+
} else {
|
|
546
|
+
stringified[prop].push(arrProp);
|
|
547
|
+
}
|
|
548
|
+
} else if ((0, import_types.isObject)(arrProp)) {
|
|
549
|
+
stringified[prop].push(deepDestringify(arrProp));
|
|
550
|
+
} else {
|
|
551
|
+
stringified[prop].push(arrProp);
|
|
552
|
+
}
|
|
553
|
+
});
|
|
554
|
+
} else if ((0, import_types.isObject)(objProp)) {
|
|
555
|
+
stringified[prop] = deepDestringify(objProp, stringified[prop]);
|
|
556
|
+
} else {
|
|
557
|
+
stringified[prop] = objProp;
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
return stringified;
|
|
561
|
+
};
|
|
562
|
+
var overwrite = (element, params, options) => {
|
|
563
|
+
const { ref } = element;
|
|
564
|
+
const changes = {};
|
|
565
|
+
for (const e in params) {
|
|
566
|
+
if (e === "props")
|
|
567
|
+
continue;
|
|
568
|
+
const elementProp = element[e];
|
|
569
|
+
const paramsProp = params[e];
|
|
570
|
+
if (paramsProp) {
|
|
571
|
+
ref.__cache[e] = changes[e] = elementProp;
|
|
572
|
+
ref[e] = paramsProp;
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
return changes;
|
|
576
|
+
};
|
|
577
|
+
var diff = (obj, original, cache) => {
|
|
578
|
+
const changes = cache || {};
|
|
579
|
+
for (const e in obj) {
|
|
580
|
+
if (e === "ref")
|
|
581
|
+
continue;
|
|
582
|
+
const originalProp = original[e];
|
|
583
|
+
const objProp = obj[e];
|
|
584
|
+
if ((0, import_types.isObjectLike)(originalProp) && (0, import_types.isObjectLike)(objProp)) {
|
|
585
|
+
changes[e] = {};
|
|
586
|
+
diff(originalProp, objProp, changes[e]);
|
|
587
|
+
} else if (objProp !== void 0) {
|
|
588
|
+
changes[e] = objProp;
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
return changes;
|
|
592
|
+
};
|
|
593
|
+
var overwriteObj = (params, obj) => {
|
|
594
|
+
const changes = {};
|
|
595
|
+
for (const e in params) {
|
|
596
|
+
const objProp = obj[e];
|
|
597
|
+
const paramsProp = params[e];
|
|
598
|
+
if (paramsProp) {
|
|
599
|
+
obj[e] = changes[e] = objProp;
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
return changes;
|
|
603
|
+
};
|
|
604
|
+
var overwriteDeep = (params, obj) => {
|
|
605
|
+
for (const e in params) {
|
|
606
|
+
const objProp = obj[e];
|
|
607
|
+
const paramsProp = params[e];
|
|
608
|
+
if ((0, import_types.isObjectLike)(objProp) && (0, import_types.isObjectLike)(paramsProp)) {
|
|
609
|
+
overwriteDeep(paramsProp, objProp);
|
|
610
|
+
} else if (paramsProp !== void 0) {
|
|
611
|
+
obj[e] = paramsProp;
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
return obj;
|
|
615
|
+
};
|
|
616
|
+
var mergeIfExisted = (a, b) => {
|
|
617
|
+
if ((0, import_types.isObjectLike)(a) && (0, import_types.isObjectLike)(b))
|
|
618
|
+
return deepMerge2(a, b);
|
|
619
|
+
return a || b;
|
|
620
|
+
};
|
|
621
|
+
var mergeArray = (arr) => {
|
|
622
|
+
return arr.reduce((a, c) => deepMerge2(a, deepClone2(c)), {});
|
|
623
|
+
};
|
|
624
|
+
var mergeAndCloneIfArray = (obj) => {
|
|
625
|
+
return (0, import_types.isArray)(obj) ? mergeArray(obj) : deepClone2(obj);
|
|
626
|
+
};
|
|
627
|
+
var flattenRecursive = (param, prop, stack = []) => {
|
|
628
|
+
const objectized = mergeAndCloneIfArray(param);
|
|
629
|
+
stack.push(objectized);
|
|
630
|
+
const extendOfExtend = objectized[prop];
|
|
631
|
+
if (extendOfExtend)
|
|
632
|
+
flattenRecursive(extendOfExtend, prop, stack);
|
|
633
|
+
delete objectized[prop];
|
|
634
|
+
return stack;
|
|
635
|
+
};
|
|
636
|
+
var isEqualDeep = (param, element) => {
|
|
637
|
+
if (param === element)
|
|
638
|
+
return true;
|
|
639
|
+
if (!param || !element)
|
|
640
|
+
return false;
|
|
641
|
+
for (const prop in param) {
|
|
642
|
+
const paramProp = param[prop];
|
|
643
|
+
const elementProp = element[prop];
|
|
644
|
+
if ((0, import_types.isObjectLike)(paramProp)) {
|
|
645
|
+
const isEqual = isEqualDeep(paramProp, elementProp);
|
|
646
|
+
if (!isEqual)
|
|
647
|
+
return false;
|
|
648
|
+
} else {
|
|
649
|
+
const isEqual = paramProp === elementProp;
|
|
650
|
+
if (!isEqual)
|
|
651
|
+
return false;
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
return true;
|
|
655
|
+
};
|
|
656
|
+
}
|
|
657
|
+
});
|
|
658
|
+
|
|
659
|
+
// ../../node_modules/@domql/utils/dist/cjs/function.js
|
|
660
|
+
var require_function = __commonJS({
|
|
661
|
+
"../../node_modules/@domql/utils/dist/cjs/function.js"(exports, module2) {
|
|
662
|
+
"use strict";
|
|
663
|
+
var __defProp2 = Object.defineProperty;
|
|
664
|
+
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
665
|
+
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
666
|
+
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
667
|
+
var __export2 = (target, all) => {
|
|
668
|
+
for (var name in all)
|
|
669
|
+
__defProp2(target, name, { get: all[name], enumerable: true });
|
|
670
|
+
};
|
|
671
|
+
var __copyProps2 = (to, from, except, desc) => {
|
|
672
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
673
|
+
for (let key of __getOwnPropNames2(from))
|
|
674
|
+
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
675
|
+
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
676
|
+
}
|
|
677
|
+
return to;
|
|
678
|
+
};
|
|
679
|
+
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
680
|
+
var function_exports = {};
|
|
681
|
+
__export2(function_exports, {
|
|
682
|
+
debounce: () => debounce,
|
|
683
|
+
memoize: () => memoize
|
|
684
|
+
});
|
|
685
|
+
module2.exports = __toCommonJS2(function_exports);
|
|
686
|
+
var debounce = (element, func, timeout = 300) => {
|
|
687
|
+
let timer;
|
|
688
|
+
return (...args) => {
|
|
689
|
+
clearTimeout(timer);
|
|
690
|
+
timer = setTimeout(() => {
|
|
691
|
+
func.apply(element, args);
|
|
692
|
+
}, timeout);
|
|
693
|
+
};
|
|
694
|
+
};
|
|
695
|
+
var memoize = (fn) => {
|
|
696
|
+
const cache = {};
|
|
697
|
+
return (...args) => {
|
|
698
|
+
const n = args[0];
|
|
699
|
+
if (n in cache) {
|
|
700
|
+
return cache[n];
|
|
701
|
+
} else {
|
|
702
|
+
const result = fn(n);
|
|
703
|
+
cache[n] = result;
|
|
704
|
+
return result;
|
|
705
|
+
}
|
|
706
|
+
};
|
|
707
|
+
};
|
|
708
|
+
}
|
|
709
|
+
});
|
|
710
|
+
|
|
711
|
+
// ../../node_modules/@domql/utils/dist/cjs/array.js
|
|
712
|
+
var require_array = __commonJS({
|
|
713
|
+
"../../node_modules/@domql/utils/dist/cjs/array.js"() {
|
|
714
|
+
"use strict";
|
|
715
|
+
}
|
|
716
|
+
});
|
|
717
|
+
|
|
718
|
+
// ../../node_modules/@domql/utils/dist/cjs/node.js
|
|
719
|
+
var require_node = __commonJS({
|
|
720
|
+
"../../node_modules/@domql/utils/dist/cjs/node.js"(exports, module2) {
|
|
721
|
+
"use strict";
|
|
722
|
+
var __defProp2 = Object.defineProperty;
|
|
723
|
+
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
724
|
+
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
725
|
+
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
726
|
+
var __export2 = (target, all) => {
|
|
727
|
+
for (var name in all)
|
|
728
|
+
__defProp2(target, name, { get: all[name], enumerable: true });
|
|
729
|
+
};
|
|
730
|
+
var __copyProps2 = (to, from, except, desc) => {
|
|
731
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
732
|
+
for (let key of __getOwnPropNames2(from))
|
|
733
|
+
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
734
|
+
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
735
|
+
}
|
|
736
|
+
return to;
|
|
737
|
+
};
|
|
738
|
+
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
739
|
+
var node_exports = {};
|
|
740
|
+
__export2(node_exports, {
|
|
741
|
+
cleanWithNode: () => cleanWithNode,
|
|
742
|
+
createID: () => createID,
|
|
743
|
+
createSnapshotId: () => createSnapshotId
|
|
744
|
+
});
|
|
745
|
+
module2.exports = __toCommonJS2(node_exports);
|
|
746
|
+
var cleanWithNode = (extend) => delete extend.node && extend;
|
|
747
|
+
var createID = function() {
|
|
748
|
+
let index = 0;
|
|
749
|
+
function newId() {
|
|
750
|
+
index++;
|
|
751
|
+
return index;
|
|
752
|
+
}
|
|
753
|
+
return newId;
|
|
754
|
+
}();
|
|
755
|
+
var createSnapshotId = createID;
|
|
756
|
+
}
|
|
757
|
+
});
|
|
758
|
+
|
|
759
|
+
// ../../node_modules/@domql/utils/dist/cjs/log.js
|
|
760
|
+
var require_log = __commonJS({
|
|
761
|
+
"../../node_modules/@domql/utils/dist/cjs/log.js"(exports, module2) {
|
|
762
|
+
"use strict";
|
|
763
|
+
var __defProp2 = Object.defineProperty;
|
|
764
|
+
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
765
|
+
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
766
|
+
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
767
|
+
var __export2 = (target, all) => {
|
|
768
|
+
for (var name in all)
|
|
769
|
+
__defProp2(target, name, { get: all[name], enumerable: true });
|
|
770
|
+
};
|
|
771
|
+
var __copyProps2 = (to, from, except, desc) => {
|
|
772
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
773
|
+
for (let key of __getOwnPropNames2(from))
|
|
774
|
+
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
775
|
+
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
776
|
+
}
|
|
777
|
+
return to;
|
|
778
|
+
};
|
|
779
|
+
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
780
|
+
var log_exports = {};
|
|
781
|
+
__export2(log_exports, {
|
|
782
|
+
logGroupIf: () => logGroupIf,
|
|
783
|
+
logIf: () => logIf
|
|
784
|
+
});
|
|
785
|
+
module2.exports = __toCommonJS2(log_exports);
|
|
786
|
+
var logIf = (bool, ...arg) => {
|
|
787
|
+
if (bool)
|
|
788
|
+
arg.map((v) => console.log(v));
|
|
789
|
+
};
|
|
790
|
+
var logGroupIf = (bool, key, ...arg) => {
|
|
791
|
+
if (bool) {
|
|
792
|
+
console.group(key);
|
|
793
|
+
arg.map((v) => console.log(v));
|
|
794
|
+
console.groupEnd(key);
|
|
795
|
+
}
|
|
796
|
+
};
|
|
797
|
+
}
|
|
798
|
+
});
|
|
799
|
+
|
|
800
|
+
// ../../node_modules/@domql/utils/dist/cjs/index.js
|
|
801
|
+
var require_cjs3 = __commonJS({
|
|
802
|
+
"../../node_modules/@domql/utils/dist/cjs/index.js"(exports, module2) {
|
|
803
|
+
"use strict";
|
|
804
|
+
var __defProp2 = Object.defineProperty;
|
|
805
|
+
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
806
|
+
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
807
|
+
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
808
|
+
var __copyProps2 = (to, from, except, desc) => {
|
|
809
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
810
|
+
for (let key of __getOwnPropNames2(from))
|
|
811
|
+
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
812
|
+
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
813
|
+
}
|
|
814
|
+
return to;
|
|
815
|
+
};
|
|
816
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps2(target, mod, "default"), secondTarget && __copyProps2(secondTarget, mod, "default"));
|
|
817
|
+
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
818
|
+
var utils_exports = {};
|
|
819
|
+
module2.exports = __toCommonJS2(utils_exports);
|
|
820
|
+
__reExport(utils_exports, require_types(), module2.exports);
|
|
821
|
+
__reExport(utils_exports, require_object(), module2.exports);
|
|
822
|
+
__reExport(utils_exports, require_function(), module2.exports);
|
|
823
|
+
__reExport(utils_exports, require_array(), module2.exports);
|
|
824
|
+
__reExport(utils_exports, require_node(), module2.exports);
|
|
825
|
+
__reExport(utils_exports, require_log(), module2.exports);
|
|
826
|
+
}
|
|
827
|
+
});
|
|
828
|
+
|
|
829
|
+
// src/set.js
|
|
20
830
|
var set_exports = {};
|
|
21
831
|
__export(set_exports, {
|
|
22
832
|
VALUE_TRANSFORMERS: () => VALUE_TRANSFORMERS,
|
|
833
|
+
appendIconsSprite: () => appendIconsSprite,
|
|
834
|
+
appendSVGSprite: () => appendSVGSprite,
|
|
835
|
+
applyDocument: () => applyDocument,
|
|
836
|
+
applyHeadings: () => applyHeadings,
|
|
837
|
+
applyReset: () => applyReset,
|
|
838
|
+
applySpacingSequence: () => applySpacingSequence,
|
|
839
|
+
applyTimingSequence: () => applyTimingSequence,
|
|
840
|
+
applyTypographySequence: () => applyTypographySequence,
|
|
841
|
+
getColor: () => getColor,
|
|
842
|
+
getFontFamily: () => getFontFamily,
|
|
843
|
+
getFontSizeByKey: () => getFontSizeByKey,
|
|
844
|
+
getMediaColor: () => getMediaColor,
|
|
845
|
+
getMediaTheme: () => getMediaTheme,
|
|
846
|
+
getSpacingBasedOnRatio: () => getSpacingBasedOnRatio,
|
|
847
|
+
getSpacingByKey: () => getSpacingByKey,
|
|
848
|
+
getTheme: () => getTheme,
|
|
849
|
+
getTimingByKey: () => getTimingByKey,
|
|
850
|
+
getTimingFunction: () => getTimingFunction,
|
|
851
|
+
runThroughMedia: () => runThroughMedia,
|
|
23
852
|
set: () => set,
|
|
853
|
+
setColor: () => setColor,
|
|
24
854
|
setEach: () => setEach,
|
|
855
|
+
setFont: () => setFont,
|
|
856
|
+
setFontFamily: () => setFontFamily,
|
|
857
|
+
setGradient: () => setGradient,
|
|
858
|
+
setIcon: () => setIcon,
|
|
859
|
+
setMediaTheme: () => setMediaTheme,
|
|
860
|
+
setSVG: () => setSVG,
|
|
861
|
+
setTheme: () => setTheme,
|
|
25
862
|
setValue: () => setValue
|
|
26
863
|
});
|
|
27
864
|
module.exports = __toCommonJS(set_exports);
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
var import_utils =
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
865
|
+
|
|
866
|
+
// src/factory.js
|
|
867
|
+
var import_utils = __toESM(require_cjs3(), 1);
|
|
868
|
+
|
|
869
|
+
// src/defaultConfig/index.js
|
|
870
|
+
var defaultConfig_exports = {};
|
|
871
|
+
__export(defaultConfig_exports, {
|
|
872
|
+
ANIMATION: () => ANIMATION,
|
|
873
|
+
BREAKPOINTS: () => BREAKPOINTS,
|
|
874
|
+
CASES: () => CASES,
|
|
875
|
+
COLOR: () => COLOR,
|
|
876
|
+
DEVICES: () => DEVICES,
|
|
877
|
+
DOCUMENT: () => DOCUMENT,
|
|
878
|
+
FONT: () => FONT,
|
|
879
|
+
FONT_FACE: () => FONT_FACE,
|
|
880
|
+
FONT_FAMILY: () => FONT_FAMILY,
|
|
881
|
+
FONT_FAMILY_TYPES: () => FONT_FAMILY_TYPES,
|
|
882
|
+
GRADIENT: () => GRADIENT,
|
|
883
|
+
ICONS: () => ICONS,
|
|
884
|
+
MEDIA: () => MEDIA,
|
|
885
|
+
RESET: () => RESET,
|
|
886
|
+
SEQUENCE: () => SEQUENCE,
|
|
887
|
+
SPACING: () => SPACING,
|
|
888
|
+
SVG: () => SVG,
|
|
889
|
+
SVG_DATA: () => SVG_DATA,
|
|
890
|
+
THEME: () => THEME,
|
|
891
|
+
TIMING: () => TIMING,
|
|
892
|
+
TYPOGRAPHY: () => TYPOGRAPHY,
|
|
893
|
+
UNIT: () => UNIT
|
|
894
|
+
});
|
|
895
|
+
|
|
896
|
+
// src/defaultConfig/sequence.js
|
|
897
|
+
var SEQUENCE = {
|
|
898
|
+
"minor-second": 1.067,
|
|
899
|
+
"major-second": 1.125,
|
|
900
|
+
"minor-third": 1.2,
|
|
901
|
+
"major-third": 1.25,
|
|
902
|
+
"perfect-fourth": 1.333,
|
|
903
|
+
"augmented-fourth": 1.414,
|
|
904
|
+
"perfect-fifth": 1.5,
|
|
905
|
+
"minor-sixth": 1.6,
|
|
906
|
+
phi: 1.618,
|
|
907
|
+
// golden-ratio
|
|
908
|
+
"major-sixth": 1.667,
|
|
909
|
+
"square-root-3": 1.732,
|
|
910
|
+
// theodorus
|
|
911
|
+
"minor-seventh": 1.778,
|
|
912
|
+
"major-seventh": 1.875,
|
|
913
|
+
octave: 2,
|
|
914
|
+
"square-root-5": 2.23,
|
|
915
|
+
// pythagoras
|
|
916
|
+
"major-tenth": 2.5,
|
|
917
|
+
"major-eleventh": 2.667,
|
|
918
|
+
"major-twelfth": 3,
|
|
919
|
+
pi: 3.14,
|
|
920
|
+
// archimedes
|
|
921
|
+
"double-octave": 4
|
|
922
|
+
};
|
|
923
|
+
|
|
924
|
+
// src/defaultConfig/unit.js
|
|
925
|
+
var UNIT = {
|
|
926
|
+
default: "em"
|
|
927
|
+
};
|
|
928
|
+
|
|
929
|
+
// src/defaultConfig/typography.js
|
|
930
|
+
var defaultProps = {
|
|
931
|
+
browserDefault: 16,
|
|
932
|
+
base: 16,
|
|
933
|
+
type: "font-size",
|
|
934
|
+
ratio: SEQUENCE["minor-third"],
|
|
935
|
+
range: [-3, 12],
|
|
936
|
+
h1Matches: 6,
|
|
937
|
+
lineHeight: 1.5,
|
|
938
|
+
unit: "em",
|
|
939
|
+
templates: {},
|
|
940
|
+
sequence: {},
|
|
941
|
+
scales: {},
|
|
942
|
+
vars: {}
|
|
943
|
+
};
|
|
944
|
+
var TYPOGRAPHY = defaultProps;
|
|
945
|
+
|
|
946
|
+
// src/defaultConfig/font.js
|
|
947
|
+
var FONT = {};
|
|
948
|
+
|
|
949
|
+
// src/defaultConfig/font-family.js
|
|
950
|
+
var FONT_FAMILY = {};
|
|
951
|
+
var FONT_FAMILY_TYPES = {
|
|
952
|
+
"sans-serif": "Helvetica, Arial, sans-serif, --system-default",
|
|
953
|
+
serif: "Times New Roman, Georgia, serif, --system-default",
|
|
954
|
+
monospace: "Courier New, monospace, --system-default"
|
|
955
|
+
};
|
|
956
|
+
var FONT_FACE = {};
|
|
957
|
+
|
|
958
|
+
// src/defaultConfig/media.js
|
|
959
|
+
var MEDIA = {
|
|
960
|
+
tv: "(min-width: 2780px)",
|
|
961
|
+
screenL: "(max-width: 1920px)",
|
|
962
|
+
screenM: "(max-width: 1680px)",
|
|
963
|
+
screenS: "(max-width: 1440px)",
|
|
964
|
+
tabletL: "(max-width: 1366px)",
|
|
965
|
+
tabletM: "(max-width: 1280px)",
|
|
966
|
+
tabletS: "(max-width: 1024px)",
|
|
967
|
+
mobileL: "(max-width: 768px)",
|
|
968
|
+
mobileM: "(max-width: 560px)",
|
|
969
|
+
mobileS: "(max-width: 480px)",
|
|
970
|
+
mobileXS: "(max-width: 375px)",
|
|
971
|
+
light: "(prefers-color-scheme: light)",
|
|
972
|
+
dark: "(prefers-color-scheme: dark)",
|
|
973
|
+
print: "print"
|
|
974
|
+
};
|
|
975
|
+
|
|
976
|
+
// src/defaultConfig/spacing.js
|
|
977
|
+
var defaultProps2 = {
|
|
978
|
+
base: TYPOGRAPHY.base,
|
|
979
|
+
type: "spacing",
|
|
980
|
+
ratio: SEQUENCE.phi,
|
|
981
|
+
range: [-5, 15],
|
|
982
|
+
subSequence: true,
|
|
983
|
+
unit: "em",
|
|
984
|
+
sequence: {},
|
|
985
|
+
scales: {},
|
|
986
|
+
vars: {}
|
|
987
|
+
};
|
|
988
|
+
var SPACING = defaultProps2;
|
|
989
|
+
|
|
990
|
+
// src/defaultConfig/color.js
|
|
991
|
+
var COLOR = {};
|
|
992
|
+
var GRADIENT = {};
|
|
993
|
+
|
|
994
|
+
// src/defaultConfig/theme.js
|
|
995
|
+
var THEME = {};
|
|
996
|
+
|
|
997
|
+
// src/defaultConfig/icons.js
|
|
998
|
+
var ICONS = {};
|
|
999
|
+
|
|
1000
|
+
// src/defaultConfig/timing.js
|
|
1001
|
+
var defaultProps3 = {
|
|
1002
|
+
default: 150,
|
|
1003
|
+
base: 150,
|
|
1004
|
+
type: "timing",
|
|
1005
|
+
ratio: SEQUENCE["perfect-fourth"],
|
|
1006
|
+
range: [-3, 12],
|
|
1007
|
+
unit: "ms",
|
|
1008
|
+
sequence: {},
|
|
1009
|
+
scales: {},
|
|
1010
|
+
vars: {}
|
|
1011
|
+
};
|
|
1012
|
+
var TIMING = defaultProps3;
|
|
1013
|
+
|
|
1014
|
+
// src/defaultConfig/document.js
|
|
1015
|
+
var DOCUMENT = {};
|
|
1016
|
+
|
|
1017
|
+
// src/defaultConfig/responsive.js
|
|
1018
|
+
var BREAKPOINTS = {
|
|
1019
|
+
screenL: 1920,
|
|
1020
|
+
screenM: 1680,
|
|
1021
|
+
screenS: 1440,
|
|
1022
|
+
tabletL: 1366,
|
|
1023
|
+
tabletM: 1280,
|
|
1024
|
+
tabletS: 1024,
|
|
1025
|
+
mobileL: 768,
|
|
1026
|
+
mobileM: 560,
|
|
1027
|
+
mobileS: 480,
|
|
1028
|
+
mobileXS: 375
|
|
1029
|
+
};
|
|
1030
|
+
var DEVICES = {
|
|
1031
|
+
screenL: [1920, 1024],
|
|
1032
|
+
screenM: [1680, 1024],
|
|
1033
|
+
screenS: [1440, 978],
|
|
1034
|
+
tabletL: [1366, 926],
|
|
1035
|
+
tabletM: [1280, 768],
|
|
1036
|
+
tabletS: [1024, 768],
|
|
1037
|
+
mobileL: [768, 375],
|
|
1038
|
+
mobileM: [560, 768],
|
|
1039
|
+
mobileS: [480, 768],
|
|
1040
|
+
mobileXS: [375, 768]
|
|
1041
|
+
};
|
|
1042
|
+
|
|
1043
|
+
// src/defaultConfig/cases.js
|
|
1044
|
+
var CASES = {};
|
|
1045
|
+
|
|
1046
|
+
// src/defaultConfig/animation.js
|
|
1047
|
+
var ANIMATION = {};
|
|
1048
|
+
|
|
1049
|
+
// src/defaultConfig/svg.js
|
|
1050
|
+
var SVG = {};
|
|
1051
|
+
var SVG_DATA = {};
|
|
1052
|
+
|
|
1053
|
+
// src/defaultConfig/index.js
|
|
1054
|
+
var RESET = {};
|
|
1055
|
+
|
|
1056
|
+
// src/factory.js
|
|
1057
|
+
var CSS_VARS = {};
|
|
1058
|
+
var CONFIG = {
|
|
1059
|
+
verbose: false,
|
|
1060
|
+
useVariable: true,
|
|
1061
|
+
useReset: true,
|
|
1062
|
+
CSS_VARS,
|
|
1063
|
+
...defaultConfig_exports
|
|
1064
|
+
};
|
|
1065
|
+
var cachedConfig = (0, import_utils.deepClone)(CONFIG);
|
|
1066
|
+
var FACTORY = {
|
|
1067
|
+
active: "0",
|
|
1068
|
+
0: CONFIG
|
|
1069
|
+
};
|
|
1070
|
+
var getActiveConfig = (def) => {
|
|
1071
|
+
if ((0, import_utils.isDefined)(def) && !FACTORY[def]) {
|
|
1072
|
+
FACTORY[def] = (0, import_utils.deepClone)(cachedConfig);
|
|
1073
|
+
return FACTORY[def];
|
|
1074
|
+
}
|
|
1075
|
+
return FACTORY[def || FACTORY.active];
|
|
1076
|
+
};
|
|
1077
|
+
|
|
1078
|
+
// src/system/color.js
|
|
1079
|
+
var import_utils8 = __toESM(require_cjs3(), 1);
|
|
1080
|
+
|
|
1081
|
+
// src/utils/color.js
|
|
1082
|
+
var import_globals = __toESM(require_cjs(), 1);
|
|
1083
|
+
var colorStringToRgbaArray = (color) => {
|
|
1084
|
+
if (color === "")
|
|
1085
|
+
return;
|
|
1086
|
+
if (color.toLowerCase() === "transparent")
|
|
1087
|
+
return [0, 0, 0, 0];
|
|
1088
|
+
if (color[0] === "#") {
|
|
1089
|
+
if (color.length < 7) {
|
|
1090
|
+
color = "#" + color[1] + color[1] + color[2] + color[2] + color[3] + color[3] + (color.length > 4 ? color[4] + color[4] : "");
|
|
1091
|
+
}
|
|
1092
|
+
return [
|
|
1093
|
+
parseInt(color.substr(1, 2), 16),
|
|
1094
|
+
parseInt(color.substr(3, 2), 16),
|
|
1095
|
+
parseInt(color.substr(5, 2), 16),
|
|
1096
|
+
color.length > 7 ? parseInt(color.substr(7, 2), 16) / 255 : 1
|
|
1097
|
+
];
|
|
1098
|
+
}
|
|
1099
|
+
if (color.indexOf("rgb") === -1) {
|
|
1100
|
+
if (import_globals.document && import_globals.window) {
|
|
1101
|
+
const elem = import_globals.document.body.appendChild(import_globals.document.createElement("fictum"));
|
|
1102
|
+
const flag = "rgb(1, 2, 3)";
|
|
1103
|
+
elem.style.color = flag;
|
|
1104
|
+
if (elem.style.color !== flag)
|
|
1105
|
+
return;
|
|
1106
|
+
elem.style.color = color;
|
|
1107
|
+
if (elem.style.color === flag || elem.style.color === "")
|
|
1108
|
+
return;
|
|
1109
|
+
color = import_globals.window.getComputedStyle(elem).color;
|
|
1110
|
+
import_globals.document.body.removeChild(elem);
|
|
1111
|
+
} else
|
|
1112
|
+
console.warn("Color conversion failed, no document or window object found");
|
|
1113
|
+
}
|
|
1114
|
+
if (color.indexOf("rgb") === 0) {
|
|
1115
|
+
if (color.indexOf("rgba") === -1)
|
|
1116
|
+
color = `${color}, 1`;
|
|
1117
|
+
return color.match(/[\.\d]+/g).map((a) => +a);
|
|
1118
|
+
}
|
|
1119
|
+
return [];
|
|
1120
|
+
};
|
|
1121
|
+
var hexToRgbArray = (hex, alpha = 1) => {
|
|
1122
|
+
const [r, g, b] = hex.match(/\w\w/g).map((x) => parseInt(x, 16));
|
|
1123
|
+
return [r, g, b];
|
|
1124
|
+
};
|
|
1125
|
+
var rgbArrayToHex = ([r, g, b]) => {
|
|
1126
|
+
return ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1);
|
|
1127
|
+
};
|
|
1128
|
+
var rgbToHSL = (r, g, b) => {
|
|
1129
|
+
const a = Math.max(r, g, b);
|
|
1130
|
+
const n = a - Math.min(r, g, b);
|
|
1131
|
+
const f = 1 - Math.abs(a + a - n - 1);
|
|
1132
|
+
const h = n && (a == r ? (g - b) / n : a == g ? 2 + (b - r) / n : 4 + (r - g) / n);
|
|
1133
|
+
return [60 * (h < 0 ? h + 6 : h), f ? n / f : 0, (a + a - n) / 2];
|
|
1134
|
+
};
|
|
1135
|
+
var hslToRgb = (h, s, l, a = s * Math.min(l, 1 - l), f = (n, k = (n + h / 30) % 12) => l - a * Math.max(
|
|
1136
|
+
Math.min(k - 3, 9 - k, 1),
|
|
1137
|
+
-1
|
|
1138
|
+
)) => [f(0), f(8), f(4)];
|
|
1139
|
+
var getColorShade = (col, amt) => {
|
|
1140
|
+
const num = parseInt(col, 16);
|
|
1141
|
+
let r = (num >> 16) + amt;
|
|
1142
|
+
if (r > 255)
|
|
1143
|
+
r = 255;
|
|
1144
|
+
else if (r < 0)
|
|
1145
|
+
r = 0;
|
|
1146
|
+
let b = (num >> 8 & 255) + amt;
|
|
1147
|
+
if (b > 255)
|
|
1148
|
+
b = 255;
|
|
1149
|
+
else if (b < 0)
|
|
1150
|
+
b = 0;
|
|
1151
|
+
let g = (num & 255) + amt;
|
|
1152
|
+
if (g > 255)
|
|
1153
|
+
g = 255;
|
|
1154
|
+
else if (g < 0)
|
|
1155
|
+
g = 0;
|
|
1156
|
+
return (g | b << 8 | r << 16).toString(16);
|
|
1157
|
+
};
|
|
1158
|
+
|
|
1159
|
+
// src/utils/font.js
|
|
1160
|
+
var getDefaultOrFirstKey = (LIBRARY, key) => {
|
|
1161
|
+
if (LIBRARY[key])
|
|
1162
|
+
return LIBRARY[key].value;
|
|
1163
|
+
if (LIBRARY.default)
|
|
1164
|
+
return LIBRARY[LIBRARY.default].value;
|
|
1165
|
+
const hasValue = Object.keys(LIBRARY)[0];
|
|
1166
|
+
return hasValue && LIBRARY[hasValue] && LIBRARY[hasValue].value;
|
|
1167
|
+
};
|
|
1168
|
+
var getFontFormat = (url) => url.split(/[#?]/)[0].split(".").pop().trim();
|
|
1169
|
+
var setCustomFont = (name, url, weight) => `
|
|
1170
|
+
font-family: '${name}';
|
|
1171
|
+
font-style: normal;
|
|
1172
|
+
${weight && `font-weight: ${weight};`}
|
|
1173
|
+
src: url('${url}') format('${getFontFormat(url)}');`;
|
|
1174
|
+
var setCustomFontMedia = (name, url, weight) => `@font-face {
|
|
1175
|
+
${setCustomFont(name, url, weight)}
|
|
1176
|
+
}`;
|
|
1177
|
+
var getFontFaceEach = (name, weights) => {
|
|
1178
|
+
const keys = Object.keys(weights);
|
|
1179
|
+
return keys.map((key) => {
|
|
1180
|
+
const { url, fontWeight } = weights[key];
|
|
1181
|
+
return setCustomFont(name, url, fontWeight);
|
|
1182
|
+
});
|
|
1183
|
+
};
|
|
1184
|
+
|
|
1185
|
+
// src/utils/sequence.js
|
|
1186
|
+
var import_utils4 = __toESM(require_cjs3(), 1);
|
|
1187
|
+
|
|
1188
|
+
// ../utils/src/index.js
|
|
1189
|
+
var import_utils3 = __toESM(require_cjs3());
|
|
1190
|
+
|
|
1191
|
+
// ../utils/src/scaling.js
|
|
1192
|
+
var import_utils2 = __toESM(require_cjs3());
|
|
1193
|
+
|
|
1194
|
+
// ../utils/src/index.js
|
|
1195
|
+
var toCamelCase = (str) => {
|
|
1196
|
+
return str.replace(/(?:^\w|[A-Z]|\b\w)/g, function(word, index) {
|
|
1197
|
+
return index === 0 ? word.toLowerCase() : word.toUpperCase();
|
|
1198
|
+
}).replaceAll(/\s+/g, "");
|
|
1199
|
+
};
|
|
1200
|
+
var toDashCase = (val) => val.replace(/[A-Z]/g, (match, offset) => (offset > 0 ? "-" : "") + match.toLowerCase()).replace(".", "-");
|
|
1201
|
+
var arrayzeValue = (val) => {
|
|
1202
|
+
if ((0, import_utils3.isString)(val))
|
|
1203
|
+
return val.split(" ");
|
|
1204
|
+
if ((0, import_utils3.isObject)(val))
|
|
1205
|
+
return Object.keys(val).map((v) => val[v]);
|
|
1206
|
+
if ((0, import_utils3.isArray)(val))
|
|
1207
|
+
return val;
|
|
1208
|
+
};
|
|
1209
|
+
|
|
1210
|
+
// src/utils/sequence.js
|
|
1211
|
+
var numToLetterMap = {
|
|
1212
|
+
"-6": "U",
|
|
1213
|
+
"-5": "V",
|
|
1214
|
+
"-4": "W",
|
|
1215
|
+
"-3": "X",
|
|
1216
|
+
"-2": "Y",
|
|
1217
|
+
"-1": "Z",
|
|
1218
|
+
0: "A",
|
|
1219
|
+
1: "B",
|
|
1220
|
+
2: "C",
|
|
1221
|
+
3: "D",
|
|
1222
|
+
4: "E",
|
|
1223
|
+
5: "F",
|
|
1224
|
+
6: "G",
|
|
1225
|
+
7: "H",
|
|
1226
|
+
8: "I",
|
|
1227
|
+
9: "J",
|
|
1228
|
+
10: "K",
|
|
1229
|
+
11: "L",
|
|
1230
|
+
12: "M",
|
|
1231
|
+
13: "N",
|
|
1232
|
+
14: "O",
|
|
1233
|
+
15: "P",
|
|
1234
|
+
16: "Q",
|
|
1235
|
+
17: "R",
|
|
1236
|
+
18: "S",
|
|
1237
|
+
19: "T"
|
|
1238
|
+
};
|
|
1239
|
+
var setSequenceValue = (props, sequenceProps) => {
|
|
1240
|
+
const { key, variable, value, scaling, index } = props;
|
|
1241
|
+
sequenceProps.sequence[key] = {
|
|
1242
|
+
key,
|
|
1243
|
+
decimal: ~~(value * 100) / 100,
|
|
1244
|
+
val: ~~value,
|
|
1245
|
+
scaling,
|
|
1246
|
+
index,
|
|
1247
|
+
variable
|
|
1248
|
+
};
|
|
1249
|
+
sequenceProps.scales[key] = scaling;
|
|
1250
|
+
sequenceProps.vars[variable] = scaling + sequenceProps.unit;
|
|
1251
|
+
};
|
|
1252
|
+
var generateSubSequence = (props, sequenceProps) => {
|
|
1253
|
+
const { key, base, value, ratio, variable, index } = props;
|
|
1254
|
+
const next = value * ratio;
|
|
1255
|
+
const diff = next - value;
|
|
1256
|
+
const smallscale = diff / 1.618;
|
|
1257
|
+
const valueRounded = ~~value;
|
|
1258
|
+
const nextRounded = ~~next;
|
|
1259
|
+
const diffRounded = nextRounded - valueRounded;
|
|
1260
|
+
let arr = [];
|
|
1261
|
+
const first = next - smallscale;
|
|
1262
|
+
const second = value + smallscale;
|
|
1263
|
+
const middle = (first + second) / 2;
|
|
1264
|
+
if (diffRounded > 16)
|
|
1265
|
+
arr = [first, middle, second];
|
|
1266
|
+
else
|
|
1267
|
+
arr = [first, second];
|
|
1268
|
+
arr.map((v, k) => {
|
|
1269
|
+
const scaling = ~~(v / base * 1e3) / 1e3;
|
|
1270
|
+
const newVar = variable + (k + 1);
|
|
1271
|
+
const props2 = {
|
|
1272
|
+
key: key + (k + 1),
|
|
1273
|
+
variable: newVar,
|
|
1274
|
+
value: v,
|
|
1275
|
+
scaling,
|
|
1276
|
+
index: index + (k + 1) / 10
|
|
1277
|
+
};
|
|
1278
|
+
return setSequenceValue(props2, sequenceProps);
|
|
1279
|
+
});
|
|
1280
|
+
};
|
|
1281
|
+
var switchSequenceOnNegative = (key, base, ratio) => {
|
|
1282
|
+
return base * Math.pow(ratio, key);
|
|
1283
|
+
};
|
|
1284
|
+
var generateSequence = (sequenceProps) => {
|
|
1285
|
+
const { type, base, ratio, range, subSequence } = sequenceProps;
|
|
1286
|
+
const n = Math.abs(range[0]) + Math.abs(range[1]);
|
|
1287
|
+
const prefix = "--" + (type && type.replace(".", "-")) + "-";
|
|
1288
|
+
for (let i = 0; i <= n; i++) {
|
|
1289
|
+
const key = range[1] - i;
|
|
1290
|
+
const letterKey = numToLetterMap[key];
|
|
1291
|
+
const value = switchSequenceOnNegative(key, base, ratio);
|
|
1292
|
+
const scaling = ~~(value / base * 100) / 100;
|
|
1293
|
+
const variable = prefix + letterKey;
|
|
1294
|
+
const props = {
|
|
1295
|
+
key: letterKey,
|
|
1296
|
+
variable,
|
|
1297
|
+
value,
|
|
1298
|
+
base,
|
|
1299
|
+
scaling,
|
|
1300
|
+
ratio,
|
|
1301
|
+
index: key
|
|
1302
|
+
};
|
|
1303
|
+
setSequenceValue(props, sequenceProps);
|
|
1304
|
+
if (subSequence)
|
|
1305
|
+
generateSubSequence(props, sequenceProps);
|
|
1306
|
+
}
|
|
1307
|
+
return sequenceProps;
|
|
1308
|
+
};
|
|
1309
|
+
var getSequenceValue = (value = "A", sequenceProps) => {
|
|
1310
|
+
const CONFIG2 = getActiveConfig();
|
|
1311
|
+
const { UNIT: UNIT2 } = CONFIG2;
|
|
1312
|
+
const {
|
|
1313
|
+
sequence,
|
|
1314
|
+
unit = UNIT2.default,
|
|
1315
|
+
useVariable
|
|
1316
|
+
} = sequenceProps;
|
|
1317
|
+
if ((0, import_utils4.isString)(value) && value.slice(0, 2) === "--")
|
|
1318
|
+
return `var(${value})`;
|
|
1319
|
+
const prefix = `--${toDashCase(sequenceProps.type.replace(".", "-"))}-`;
|
|
1320
|
+
const startsWithDashOrLetterRegex = /^-?[a-zA-Z]/i;
|
|
1321
|
+
const startsWithDashOrLetter = startsWithDashOrLetterRegex.test(value);
|
|
1322
|
+
if (value === "none" || value === "auto" || value === "unset" || value === "inherit" || value === "fit-content" || value === "min-content" || value === "max-content" || value.includes("calc") || !startsWithDashOrLetter)
|
|
1323
|
+
return value;
|
|
1324
|
+
const letterVal = value.toUpperCase();
|
|
1325
|
+
const isNegative = letterVal.slice(0, 1) === "-" ? "-" : "";
|
|
1326
|
+
let absValue = isNegative ? letterVal.slice(1) : letterVal;
|
|
1327
|
+
let mediaName = "";
|
|
1328
|
+
if (absValue.includes("-")) {
|
|
1329
|
+
mediaName = "-" + absValue.split("-")[1].toLowerCase();
|
|
1330
|
+
absValue = absValue.split("-")[0];
|
|
1331
|
+
}
|
|
1332
|
+
const varValue = (v) => `var(${prefix}${v}${mediaName})`;
|
|
1333
|
+
if (absValue.includes("+")) {
|
|
1334
|
+
const args = absValue.split("+");
|
|
1335
|
+
const [first, second] = args;
|
|
1336
|
+
const joint = `${varValue(first)} + ${varValue(second)}`;
|
|
1337
|
+
return isNegative ? `calc((${joint}) * -1)` : `calc(${joint})`;
|
|
1338
|
+
} else if (absValue.includes("-")) {
|
|
1339
|
+
const args = absValue.split("-");
|
|
1340
|
+
const [first, second] = args;
|
|
1341
|
+
const joint = `${varValue(first)} - ${varValue(second)}`;
|
|
1342
|
+
return isNegative ? `calc((${joint}) * -1)` : `calc(${joint})`;
|
|
1343
|
+
}
|
|
1344
|
+
if (!sequence[absValue] && absValue.length === 2) {
|
|
1345
|
+
if (CONFIG2.verbose)
|
|
1346
|
+
console.warn(absValue, "- value is not found because `subSequence` is set to false");
|
|
1347
|
+
absValue = absValue.slice(0, 1);
|
|
1348
|
+
}
|
|
1349
|
+
if (useVariable || CONFIG2.useVariable) {
|
|
1350
|
+
const varValue2 = `var(${prefix}${absValue}${mediaName})`;
|
|
1351
|
+
return isNegative ? `calc(${varValue2} * -1)` : varValue2;
|
|
1352
|
+
}
|
|
1353
|
+
const sequenceItem = sequence ? sequence[absValue] : null;
|
|
1354
|
+
if (!sequenceItem)
|
|
1355
|
+
return console.warn("can't find", sequence, absValue);
|
|
1356
|
+
if (unit === "ms" || unit === "s") {
|
|
1357
|
+
return isNegative + sequenceItem.val + unit;
|
|
1358
|
+
}
|
|
1359
|
+
return isNegative + sequenceItem.scaling + unit;
|
|
1360
|
+
};
|
|
1361
|
+
var getSequenceValuePropertyPair = (value, propertyName, sequenceProps) => {
|
|
1362
|
+
if (typeof value !== "string") {
|
|
1363
|
+
console.warn(propertyName, value, "is not a string");
|
|
1364
|
+
return {};
|
|
1365
|
+
}
|
|
1366
|
+
if (value === "-" || value === "")
|
|
1367
|
+
return {};
|
|
1368
|
+
return { [propertyName]: getSequenceValue(value, sequenceProps) };
|
|
1369
|
+
};
|
|
1370
|
+
var findHeadingLetter = (h1Matches, index) => numToLetterMap[h1Matches - index];
|
|
1371
|
+
var findHeadings = (propertyNames) => {
|
|
1372
|
+
const { h1Matches, sequence } = propertyNames;
|
|
1373
|
+
return new Array(6).fill(null).map((_, i) => {
|
|
1374
|
+
const findLetter = findHeadingLetter(h1Matches, i);
|
|
1375
|
+
return sequence[findLetter];
|
|
1376
|
+
});
|
|
1377
|
+
};
|
|
1378
|
+
|
|
1379
|
+
// src/utils/var.js
|
|
1380
|
+
var import_utils6 = __toESM(require_cjs3(), 1);
|
|
1381
|
+
var applySequenceVars = (props, mediaName, options = {}) => {
|
|
1382
|
+
const CONFIG2 = getActiveConfig();
|
|
1383
|
+
const { UNIT: UNIT2, MEDIA: MEDIA2, TIMING: TIMING2, CSS_VARS: CSS_VARS2 } = CONFIG2;
|
|
1384
|
+
const unit = props.unit || UNIT2.default;
|
|
1385
|
+
const { sequence, scales } = props;
|
|
1386
|
+
for (const key in sequence) {
|
|
1387
|
+
const item = sequence[key];
|
|
1388
|
+
const value = (props.type === TIMING2.type ? sequence[key].val : scales[key]) + unit;
|
|
1389
|
+
if (mediaName) {
|
|
1390
|
+
const query = MEDIA2[mediaName];
|
|
1391
|
+
if (!query) {
|
|
1392
|
+
if (CONFIG2.verbose)
|
|
1393
|
+
console.warn("Can't find query ", query);
|
|
1394
|
+
}
|
|
1395
|
+
let underMediaQuery = CSS_VARS2[`@media ${query}`];
|
|
1396
|
+
if (!underMediaQuery)
|
|
1397
|
+
underMediaQuery = CSS_VARS2[`@media ${query}`] = {};
|
|
1398
|
+
underMediaQuery[item.variable] = `var(${item.variable + "-" + mediaName})`;
|
|
1399
|
+
CSS_VARS2[item.variable + "-" + mediaName] = value;
|
|
1400
|
+
} else {
|
|
1401
|
+
if (options.useDefault === false) {
|
|
1402
|
+
CSS_VARS2[item.variable] = value;
|
|
1403
|
+
} else {
|
|
1404
|
+
CSS_VARS2[item.variable + "-default"] = value;
|
|
1405
|
+
CSS_VARS2[item.variable] = `var(${item.variable + "-default"})`;
|
|
1406
|
+
}
|
|
1407
|
+
}
|
|
1408
|
+
}
|
|
1409
|
+
};
|
|
1410
|
+
|
|
1411
|
+
// src/utils/sprite.js
|
|
1412
|
+
var import_utils7 = __toESM(require_cjs3(), 1);
|
|
1413
|
+
var generateSprite = (icons) => {
|
|
1414
|
+
let sprite = '<svg aria-hidden="true" width="0" height="0" style="position:absolute">';
|
|
1415
|
+
for (let key in icons) {
|
|
1416
|
+
sprite += icons[key];
|
|
1417
|
+
}
|
|
1418
|
+
sprite += "</svg>";
|
|
1419
|
+
return sprite;
|
|
1420
|
+
};
|
|
1421
|
+
var parseRootAttributes = (htmlString) => {
|
|
1422
|
+
if (!(0, import_utils7.isString)(htmlString)) {
|
|
1423
|
+
return console.warn(`parseRootAttributes: ${htmlString} is not a string`);
|
|
1424
|
+
}
|
|
1425
|
+
let match = htmlString.match(/<svg\s+(.*?)>/);
|
|
1426
|
+
if (!match || !match[1]) {
|
|
1427
|
+
return {};
|
|
1428
|
+
}
|
|
1429
|
+
let attrString = match[1];
|
|
1430
|
+
let attrs = attrString.match(/(\S+)=["']?((?:.(?!["']?\s+(?:\S+)=|\s*\/?[>"']))+.)["']?/gm);
|
|
1431
|
+
return attrs.reduce((acc, attr) => {
|
|
1432
|
+
let [key, value] = attr.split("=");
|
|
1433
|
+
acc[key] = value.replace(/['"]/g, "");
|
|
1434
|
+
return acc;
|
|
1435
|
+
}, {});
|
|
1436
|
+
};
|
|
1437
|
+
var convertSvgToSymbol = (key, code) => {
|
|
1438
|
+
const extractAttrs = parseRootAttributes(code);
|
|
1439
|
+
const { width, height } = extractAttrs;
|
|
1440
|
+
const viewBox = extractAttrs.viewBox || `0 0 ${width || 24} ${height || 24}`;
|
|
1441
|
+
const xmlns = "http://www.w3.org/2000/svg";
|
|
1442
|
+
let symbol = code.replace(
|
|
1443
|
+
"<svg",
|
|
1444
|
+
`<symbol id="${key}" xmlns="${xmlns}" viewBox="${viewBox}"`
|
|
1445
|
+
);
|
|
1446
|
+
symbol = symbol.replace(/width="[^\"]*/, "");
|
|
1447
|
+
symbol = symbol.replace(/height="[^\"]*/, "");
|
|
1448
|
+
symbol = symbol.replace("</svg", "</symbol");
|
|
1449
|
+
return symbol;
|
|
1450
|
+
};
|
|
1451
|
+
|
|
1452
|
+
// src/system/color.js
|
|
1453
|
+
var getColor = (value, key) => {
|
|
1454
|
+
const CONFIG2 = getActiveConfig();
|
|
1455
|
+
if (!(0, import_utils8.isString)(value)) {
|
|
1456
|
+
if (CONFIG2.verbose)
|
|
1457
|
+
console.warn(value, "- type for color is not valid");
|
|
1458
|
+
return;
|
|
1459
|
+
}
|
|
1460
|
+
if (value.slice(0, 2) === "--")
|
|
1461
|
+
return `var(${value})`;
|
|
1462
|
+
if (key && value[key])
|
|
1463
|
+
value = value[key];
|
|
1464
|
+
const [name, alpha, tone] = (0, import_utils8.isArray)(value) ? value : value.split(" ");
|
|
1465
|
+
const { COLOR: COLOR2, GRADIENT: GRADIENT2 } = CONFIG2;
|
|
1466
|
+
let val = COLOR2[name] || GRADIENT2[name];
|
|
1467
|
+
if (!val) {
|
|
1468
|
+
if (CONFIG2.verbose)
|
|
1469
|
+
console.warn("Can't find color ", name);
|
|
1470
|
+
return value;
|
|
1471
|
+
}
|
|
1472
|
+
if (key) {
|
|
1473
|
+
if (val[key])
|
|
1474
|
+
val = val[key];
|
|
1475
|
+
else if (CONFIG2.verbose)
|
|
1476
|
+
console.warn(value, " - does not have ", key);
|
|
1477
|
+
}
|
|
1478
|
+
let rgb = val.rgb;
|
|
1479
|
+
if (rgb) {
|
|
1480
|
+
if (tone) {
|
|
1481
|
+
if (!val[tone]) {
|
|
1482
|
+
const toHex = rgbArrayToHex(rgb.split(", ").map((v) => parseFloat(v)));
|
|
1483
|
+
if (tone.slice(0, 1) === "-" || tone.slice(0, 1) === "+") {
|
|
1484
|
+
rgb = hexToRgbArray(getColorShade(toHex, parseFloat(tone))).join(", ");
|
|
1485
|
+
} else {
|
|
1486
|
+
const [r, g, b] = [...rgb.split(", ").map((v) => parseInt(v))];
|
|
1487
|
+
const hsl = rgbToHSL(r, g, b);
|
|
1488
|
+
const [h, s, l] = hsl;
|
|
1489
|
+
const newRgb = hslToRgb(h, s, parseFloat(tone) / 100 * 255);
|
|
1490
|
+
rgb = newRgb;
|
|
1491
|
+
}
|
|
1492
|
+
val[tone] = { rgb, var: `${val.var}-${tone}` };
|
|
1493
|
+
} else
|
|
1494
|
+
rgb = val[tone].rgb;
|
|
1495
|
+
}
|
|
1496
|
+
if (alpha)
|
|
1497
|
+
return `rgba(${rgb}, ${alpha})`;
|
|
1498
|
+
return CONFIG2.useVariable ? `var(${val.var})` : `rgb(${rgb})`;
|
|
1499
|
+
} else
|
|
1500
|
+
return CONFIG2.useVariable ? `var(${val.var})` : val.value;
|
|
1501
|
+
};
|
|
1502
|
+
var getMediaColor = (value, property, globalTheme) => {
|
|
1503
|
+
const CONFIG2 = getActiveConfig();
|
|
1504
|
+
if (!globalTheme)
|
|
1505
|
+
globalTheme = CONFIG2.globalTheme;
|
|
1506
|
+
if (!(0, import_utils8.isString)(value)) {
|
|
1507
|
+
if (CONFIG2.verbose)
|
|
1508
|
+
console.warn(value, "- type for color is not valid");
|
|
1509
|
+
return;
|
|
1510
|
+
}
|
|
1511
|
+
if (value.slice(0, 2) === "--")
|
|
1512
|
+
return { [property]: `var(${value})` };
|
|
1513
|
+
const [name] = (0, import_utils8.isArray)(value) ? value : value.split(" ");
|
|
1514
|
+
const { COLOR: COLOR2, GRADIENT: GRADIENT2 } = CONFIG2;
|
|
1515
|
+
const val = COLOR2[name] || GRADIENT2[name];
|
|
1516
|
+
const isObj = (0, import_utils8.isObject)(val);
|
|
1517
|
+
if (isObj && val.value)
|
|
1518
|
+
return { [property]: getColor(value, globalTheme) };
|
|
1519
|
+
else if (isObj) {
|
|
1520
|
+
if (globalTheme)
|
|
1521
|
+
return { [property]: getColor(value, `@${globalTheme}`) };
|
|
1522
|
+
else {
|
|
1523
|
+
const obj = {};
|
|
1524
|
+
for (const mediaName in val) {
|
|
1525
|
+
const query = CONFIG2.MEDIA[mediaName.slice(1)];
|
|
1526
|
+
const media = `@media screen and ${query}`;
|
|
1527
|
+
obj[media] = { [property]: getColor(value, mediaName) };
|
|
1528
|
+
}
|
|
1529
|
+
return obj;
|
|
1530
|
+
}
|
|
1531
|
+
} else {
|
|
1532
|
+
if (CONFIG2.verbose)
|
|
1533
|
+
console.warn("Can't find color", value);
|
|
1534
|
+
return { [property]: value };
|
|
1535
|
+
}
|
|
1536
|
+
};
|
|
1537
|
+
var setColor = (val, key, suffix) => {
|
|
1538
|
+
const CONFIG2 = getActiveConfig();
|
|
1539
|
+
if ((0, import_utils8.isString)(val) && val.slice(0, 2) === "--")
|
|
1540
|
+
val = getColor(val.slice(2));
|
|
1541
|
+
if ((0, import_utils8.isArray)(val)) {
|
|
1542
|
+
return {
|
|
1543
|
+
"@light": setColor(val[0], key, "light"),
|
|
1544
|
+
"@dark": setColor(val[1], key, "dark")
|
|
1545
|
+
};
|
|
1546
|
+
}
|
|
1547
|
+
if ((0, import_utils8.isObject)(val)) {
|
|
1548
|
+
const obj = {};
|
|
1549
|
+
for (const variant in val)
|
|
1550
|
+
obj[variant] = setColor(val[variant], key, variant.slice(0, 1) === "@" ? variant.slice(1) : variant);
|
|
1551
|
+
return obj;
|
|
1552
|
+
}
|
|
1553
|
+
const CSSVar = `--color-${key}` + (suffix ? `-${suffix}` : "");
|
|
1554
|
+
const [r, g, b, a = 1] = colorStringToRgbaArray(val.value || val);
|
|
1555
|
+
const alpha = parseFloat(a.toFixed(2));
|
|
1556
|
+
const rgb = `${r}, ${g}, ${b}`;
|
|
1557
|
+
const value = `rgba(${rgb}, ${alpha})`;
|
|
1558
|
+
if (CONFIG2.useVariable) {
|
|
1559
|
+
CONFIG2.CSS_VARS[CSSVar] = value;
|
|
1560
|
+
}
|
|
1561
|
+
return {
|
|
1562
|
+
var: CSSVar,
|
|
1563
|
+
rgb,
|
|
1564
|
+
alpha,
|
|
1565
|
+
value
|
|
1566
|
+
};
|
|
1567
|
+
};
|
|
1568
|
+
var setGradient = (val, key, suffix) => {
|
|
1569
|
+
const CONFIG2 = getActiveConfig();
|
|
1570
|
+
if ((0, import_utils8.isString)(val) && val.slice(0, 2) === "--")
|
|
1571
|
+
val = getColor(val.slice(2));
|
|
1572
|
+
if ((0, import_utils8.isArray)(val)) {
|
|
1573
|
+
return {
|
|
1574
|
+
"@light": setGradient(val[0], key, "light"),
|
|
1575
|
+
"@dark": setGradient(val[0], key, "dark")
|
|
1576
|
+
};
|
|
1577
|
+
}
|
|
1578
|
+
if ((0, import_utils8.isObject)(val)) {
|
|
1579
|
+
const obj = {};
|
|
1580
|
+
for (const variant in val)
|
|
1581
|
+
obj[variant] = setGradient(val[variant], key, variant.slice(0, 1) === "@" ? variant.slice(1) : variant);
|
|
1582
|
+
return obj;
|
|
1583
|
+
}
|
|
1584
|
+
const CSSVar = `--gradient-${key}` + (suffix ? `-${suffix}` : "");
|
|
1585
|
+
if (CONFIG2.useVariable) {
|
|
1586
|
+
CONFIG2.CSS_VARS[CSSVar] = val.value || val;
|
|
1587
|
+
}
|
|
1588
|
+
return {
|
|
1589
|
+
var: CSSVar,
|
|
1590
|
+
value: val.value || val
|
|
1591
|
+
};
|
|
1592
|
+
};
|
|
1593
|
+
|
|
1594
|
+
// src/system/theme.js
|
|
1595
|
+
var import_utils10 = __toESM(require_cjs3(), 1);
|
|
1596
|
+
var setThemeValue = (theme) => {
|
|
1597
|
+
const value = {};
|
|
1598
|
+
const { state, media, helpers, ...rest } = theme;
|
|
1599
|
+
const keys = Object.keys(rest);
|
|
1600
|
+
keys.map((key) => {
|
|
1601
|
+
const conditions = ["color", "Color", "background", "border"];
|
|
1602
|
+
const isColor = conditions.some((k) => key.includes(k));
|
|
1603
|
+
return value[key] = isColor ? getColor(theme[key]) : theme[key];
|
|
1604
|
+
});
|
|
1605
|
+
return value;
|
|
1606
|
+
};
|
|
1607
|
+
var getThemeValue = (theme) => {
|
|
1608
|
+
if (theme.value)
|
|
1609
|
+
return theme.value;
|
|
1610
|
+
theme.value = setThemeValue(theme);
|
|
1611
|
+
return theme.value;
|
|
1612
|
+
};
|
|
1613
|
+
var getTheme = (value, modifier) => {
|
|
1614
|
+
const CONFIG2 = getActiveConfig();
|
|
1615
|
+
if (CONFIG2.useVariable)
|
|
1616
|
+
return getMediaTheme(value, modifier);
|
|
1617
|
+
const { THEME: THEME2 } = CONFIG2;
|
|
1618
|
+
if ((0, import_utils10.isString)(value)) {
|
|
1619
|
+
const [theme, subtheme] = value.split(" ");
|
|
1620
|
+
const isOurTheme = THEME2[theme];
|
|
1621
|
+
if (isOurTheme) {
|
|
1622
|
+
if (!subtheme && !modifier)
|
|
1623
|
+
return getThemeValue(isOurTheme);
|
|
1624
|
+
value = [theme, subtheme || modifier];
|
|
1625
|
+
}
|
|
1626
|
+
}
|
|
1627
|
+
if ((0, import_utils10.isObjectLike)(value) && value[1]) {
|
|
1628
|
+
const themeName = value[0];
|
|
1629
|
+
const subThemeName = value[1];
|
|
1630
|
+
const { helpers, media, state } = THEME2[themeName];
|
|
1631
|
+
if (media && media[subThemeName])
|
|
1632
|
+
return getThemeValue(media[subThemeName]);
|
|
1633
|
+
if (helpers && helpers[subThemeName])
|
|
1634
|
+
return getThemeValue(helpers[subThemeName]);
|
|
1635
|
+
if (state && state[subThemeName])
|
|
1636
|
+
return getThemeValue(state[subThemeName]);
|
|
1637
|
+
} else if ((0, import_utils10.isObject)(value))
|
|
1638
|
+
return setThemeValue(value);
|
|
1639
|
+
};
|
|
1640
|
+
var setInverseTheme = (theme, variant, value) => {
|
|
1641
|
+
if ((0, import_utils10.isObject)(variant)) {
|
|
1642
|
+
theme.variants.inverse.value = setThemeValue(variant);
|
|
1643
|
+
} else if (variant === true) {
|
|
1644
|
+
const { color, background } = value;
|
|
1645
|
+
theme.variants.inverse = {
|
|
1646
|
+
value: {
|
|
1647
|
+
color: background,
|
|
1648
|
+
background: color
|
|
1649
|
+
}
|
|
1650
|
+
};
|
|
1651
|
+
}
|
|
1652
|
+
};
|
|
1653
|
+
var setPseudo = (theme, key, variant, themeValue) => {
|
|
1654
|
+
const result = getTheme(variant);
|
|
1655
|
+
themeValue[`&:${key}`] = result;
|
|
1656
|
+
if ((0, import_utils10.isObject)(variant) && !variant.value)
|
|
1657
|
+
variant.value = result;
|
|
1658
|
+
};
|
|
1659
|
+
var setSelectors = (theme, value) => {
|
|
1660
|
+
const { state } = theme;
|
|
1661
|
+
if (!state)
|
|
1662
|
+
return;
|
|
1663
|
+
const keys = Object.keys(state);
|
|
1664
|
+
keys.map((key) => {
|
|
1665
|
+
const variant = state[key];
|
|
1666
|
+
setPseudo(theme, key, variant, value);
|
|
1667
|
+
return theme;
|
|
1668
|
+
});
|
|
1669
|
+
return theme;
|
|
1670
|
+
};
|
|
1671
|
+
var setPrefersScheme = (theme, key, variant, themeValue) => {
|
|
1672
|
+
const result = getTheme(variant);
|
|
1673
|
+
themeValue[`@media (prefers-color-scheme: ${key})`] = result;
|
|
1674
|
+
if ((0, import_utils10.isObject)(variant) && !variant.value)
|
|
1675
|
+
variant.value = result;
|
|
1676
|
+
};
|
|
1677
|
+
var setMedia = (theme, value) => {
|
|
1678
|
+
const { media } = theme;
|
|
1679
|
+
if (!media)
|
|
1680
|
+
return;
|
|
1681
|
+
const keys = Object.keys(media);
|
|
1682
|
+
keys.map((key) => {
|
|
1683
|
+
const variant = media[key];
|
|
1684
|
+
if (key === "dark" || key === "light")
|
|
1685
|
+
setPrefersScheme(theme, key, variant, value);
|
|
1686
|
+
if (key === "inverse")
|
|
1687
|
+
setInverseTheme(theme, variant, value);
|
|
1688
|
+
return theme;
|
|
1689
|
+
});
|
|
1690
|
+
return theme;
|
|
1691
|
+
};
|
|
1692
|
+
var setHelpers = (theme, value) => {
|
|
1693
|
+
const CONFIG2 = getActiveConfig();
|
|
1694
|
+
const { helpers } = theme;
|
|
1695
|
+
if (!helpers)
|
|
1696
|
+
return;
|
|
1697
|
+
const keys = Object.keys(helpers);
|
|
1698
|
+
keys.map((key) => {
|
|
1699
|
+
const helper = helpers[key];
|
|
1700
|
+
if ((0, import_utils10.isString)(helper))
|
|
1701
|
+
helpers[key] = CONFIG2.THEME[helper];
|
|
1702
|
+
else
|
|
1703
|
+
getThemeValue(helpers[key]);
|
|
1704
|
+
return theme;
|
|
1705
|
+
});
|
|
1706
|
+
return theme;
|
|
1707
|
+
};
|
|
1708
|
+
var setTheme = (val, key) => {
|
|
1709
|
+
const CONFIG2 = getActiveConfig();
|
|
1710
|
+
if (CONFIG2.useVariable)
|
|
1711
|
+
return setMediaTheme(val, key);
|
|
1712
|
+
const { state, media, helpers } = val;
|
|
1713
|
+
const value = setThemeValue(val, key);
|
|
1714
|
+
const CSSvar = `--theme-${key}`;
|
|
1715
|
+
setSelectors(val, value);
|
|
1716
|
+
setMedia(val, value);
|
|
1717
|
+
setHelpers(val, value);
|
|
1718
|
+
return { var: CSSvar, value, state, media, helpers };
|
|
1719
|
+
};
|
|
1720
|
+
var setMediaTheme = (val, key, suffix, prefers) => {
|
|
1721
|
+
const CONFIG2 = getActiveConfig();
|
|
1722
|
+
const { CSS_VARS: CSS_VARS2 } = CONFIG2;
|
|
1723
|
+
const theme = { value: val };
|
|
1724
|
+
if ((0, import_utils10.isObjectLike)(val)) {
|
|
1725
|
+
for (const param in val) {
|
|
1726
|
+
const symb = param.slice(0, 1);
|
|
1727
|
+
const value = val[param];
|
|
1728
|
+
if (symb === "@" || symb === ":" || symb === ".") {
|
|
1729
|
+
const hasPrefers = symb === "@" && param;
|
|
1730
|
+
theme[param] = setMediaTheme(value, key, param, prefers || hasPrefers);
|
|
1731
|
+
} else {
|
|
1732
|
+
const color = getColor(value, prefers);
|
|
1733
|
+
const metaSuffixes = [...new Set([prefers, suffix].filter((v) => v).map((v) => v.slice(1)))];
|
|
1734
|
+
const varmetaSuffixName = metaSuffixes.length ? "-" + metaSuffixes.join("-") : "";
|
|
1735
|
+
const CSSVar = `--theme-${key}${varmetaSuffixName}-${param}`;
|
|
1736
|
+
if (CONFIG2.useVariable) {
|
|
1737
|
+
CSS_VARS2[CSSVar] = color;
|
|
1738
|
+
theme[param] = `var(${CSSVar})`;
|
|
1739
|
+
} else {
|
|
1740
|
+
theme[param] = color;
|
|
1741
|
+
}
|
|
1742
|
+
theme[`.${param}`] = { [param]: theme[param] };
|
|
1743
|
+
}
|
|
1744
|
+
}
|
|
1745
|
+
if (theme["background"] || theme["color"] || theme["backgroundColor"]) {
|
|
1746
|
+
theme[".inversed"] = {
|
|
1747
|
+
color: theme["background"] || theme["backgroundColor"],
|
|
1748
|
+
background: theme["color"]
|
|
1749
|
+
};
|
|
1750
|
+
}
|
|
1751
|
+
}
|
|
1752
|
+
if ((0, import_utils10.isString)(val) && val.slice(0, 2) === "--") {
|
|
1753
|
+
const { THEME: THEME2 } = CONFIG2;
|
|
1754
|
+
const value = THEME2[val.slice(2)];
|
|
1755
|
+
const getReferenced = getMediaTheme(value, prefers);
|
|
1756
|
+
return getReferenced;
|
|
1757
|
+
}
|
|
1758
|
+
return theme;
|
|
1759
|
+
};
|
|
1760
|
+
var recursiveTheme = (val) => {
|
|
1761
|
+
const CONFIG2 = getActiveConfig();
|
|
1762
|
+
const obj = {};
|
|
1763
|
+
for (const param in val) {
|
|
1764
|
+
const symb = param.slice(0, 1);
|
|
1765
|
+
if ((0, import_utils10.isObjectLike)(val[param])) {
|
|
1766
|
+
if (symb === "@") {
|
|
1767
|
+
const query = CONFIG2.MEDIA[param.slice(1)];
|
|
1768
|
+
const media = `@media screen and ${query}`;
|
|
1769
|
+
obj[media] = recursiveTheme(val[param]);
|
|
1770
|
+
} else if (symb === ":") {
|
|
1771
|
+
obj[`&${param}`] = recursiveTheme(val[param]);
|
|
1772
|
+
}
|
|
1773
|
+
} else
|
|
1774
|
+
obj[param] = val[param];
|
|
1775
|
+
}
|
|
1776
|
+
return obj;
|
|
1777
|
+
};
|
|
1778
|
+
var findModifierFromArray = (val, modifierArray) => {
|
|
1779
|
+
const currentMod = modifierArray.shift();
|
|
1780
|
+
if (val[currentMod])
|
|
1781
|
+
return findModifierFromArray(val[currentMod], modifierArray);
|
|
1782
|
+
return val;
|
|
1783
|
+
};
|
|
1784
|
+
var findModifier = (val, modifier) => {
|
|
1785
|
+
if ((0, import_utils10.isArray)(modifier))
|
|
1786
|
+
return findModifierFromArray(val, modifier);
|
|
1787
|
+
else if ((0, import_utils10.isString)(modifier) && val[modifier])
|
|
1788
|
+
return val[modifier];
|
|
1789
|
+
else
|
|
1790
|
+
return val;
|
|
1791
|
+
};
|
|
1792
|
+
var getMediaTheme = (val, mod) => {
|
|
1793
|
+
const CONFIG2 = getActiveConfig();
|
|
1794
|
+
if ((0, import_utils10.isString)(val) && val.slice(0, 2) === "--")
|
|
1795
|
+
val = getMediaTheme(val.slice(2));
|
|
1796
|
+
if (!val || !(0, import_utils10.isString)(val)) {
|
|
1797
|
+
if (CONFIG2.verbose)
|
|
1798
|
+
console.warn(val, "- theme is not string");
|
|
1799
|
+
return;
|
|
1800
|
+
}
|
|
1801
|
+
const [name, ...modifier] = (0, import_utils10.isArray)(val) ? val : val.split(" ");
|
|
1802
|
+
let value = CONFIG2.THEME[name];
|
|
1803
|
+
if (value && (modifier || mod)) {
|
|
1804
|
+
value = findModifier(value, modifier.length ? modifier : mod);
|
|
1805
|
+
}
|
|
1806
|
+
const r = recursiveTheme(value);
|
|
1807
|
+
return r;
|
|
1808
|
+
};
|
|
1809
|
+
|
|
1810
|
+
// src/system/font.js
|
|
1811
|
+
var import_utils11 = __toESM(require_cjs3(), 1);
|
|
1812
|
+
var setFont = (val, key) => {
|
|
1813
|
+
const CSSvar = `--font-${key}`;
|
|
1814
|
+
const fontFace = val[0] ? getFontFaceEach(key, val) : setCustomFontMedia(key, val.url);
|
|
1815
|
+
return { var: CSSvar, value: val, fontFace };
|
|
1816
|
+
};
|
|
1817
|
+
var getFontFamily = (key, factory) => {
|
|
1818
|
+
const CONFIG2 = getActiveConfig();
|
|
1819
|
+
const { FONT_FAMILY: FONT_FAMILY2 } = CONFIG2;
|
|
1820
|
+
return getDefaultOrFirstKey(factory || FONT_FAMILY2, key);
|
|
1821
|
+
};
|
|
1822
|
+
var setFontFamily = (val, key) => {
|
|
1823
|
+
const CONFIG2 = getActiveConfig();
|
|
1824
|
+
const { FONT_FAMILY: FONT_FAMILY2, FONT_FAMILY_TYPES: FONT_FAMILY_TYPES2 } = CONFIG2;
|
|
1825
|
+
let { value, type } = val;
|
|
1826
|
+
if (val.isDefault)
|
|
1827
|
+
FONT_FAMILY2.default = key;
|
|
1828
|
+
if ((0, import_utils11.isObject)(value))
|
|
1829
|
+
value = arrayzeValue(value);
|
|
1830
|
+
const CSSvar = `--font-family-${key}`;
|
|
1831
|
+
const str = `${value.join(", ")}, ${FONT_FAMILY_TYPES2[type]}`;
|
|
1832
|
+
return { var: CSSvar, value: str, arr: value, type };
|
|
1833
|
+
};
|
|
1834
|
+
|
|
1835
|
+
// src/system/typography.js
|
|
1836
|
+
var import_utils14 = __toESM(require_cjs3(), 1);
|
|
1837
|
+
var runThroughMedia = (props) => {
|
|
1838
|
+
const CONFIG2 = getActiveConfig();
|
|
1839
|
+
const { TYPOGRAPHY: TYPOGRAPHY2, MEDIA: MEDIA2 } = CONFIG2;
|
|
1840
|
+
for (const prop in props) {
|
|
1841
|
+
const mediaProps = props[prop];
|
|
1842
|
+
if (prop.slice(0, 1) === "@") {
|
|
1843
|
+
const { type, base, ratio, range, subSequence, h1Matches, unit } = props;
|
|
1844
|
+
(0, import_utils14.merge)(mediaProps, {
|
|
1845
|
+
type,
|
|
1846
|
+
base,
|
|
1847
|
+
ratio,
|
|
1848
|
+
range,
|
|
1849
|
+
subSequence,
|
|
1850
|
+
h1Matches,
|
|
1851
|
+
unit,
|
|
1852
|
+
sequence: {},
|
|
1853
|
+
scales: {},
|
|
1854
|
+
templates: {},
|
|
1855
|
+
vars: {}
|
|
1856
|
+
});
|
|
1857
|
+
generateSequence(mediaProps);
|
|
1858
|
+
const mediaName = prop.slice(1);
|
|
1859
|
+
applySequenceVars(mediaProps, mediaName);
|
|
1860
|
+
const query = MEDIA2[mediaName];
|
|
1861
|
+
TYPOGRAPHY2.templates[`@media screen and ${query}`] = {
|
|
1862
|
+
fontSize: mediaProps.base / TYPOGRAPHY2.browserDefault + unit
|
|
1863
|
+
};
|
|
1864
|
+
}
|
|
1865
|
+
}
|
|
1866
|
+
};
|
|
1867
|
+
var applyHeadings = (props) => {
|
|
1868
|
+
const CONFIG2 = getActiveConfig();
|
|
1869
|
+
if (props.h1Matches) {
|
|
1870
|
+
const unit = props.unit;
|
|
1871
|
+
const HEADINGS = findHeadings(props);
|
|
1872
|
+
const { templates } = props;
|
|
1873
|
+
for (const k in HEADINGS) {
|
|
1874
|
+
const headerName = `h${parseInt(k) + 1}`;
|
|
1875
|
+
const headerStyle = templates[headerName];
|
|
1876
|
+
templates[headerName] = {
|
|
1877
|
+
fontSize: CONFIG2.useVariable ? `var(${HEADINGS[k].variable})` : `${HEADINGS[k].scaling}${unit}`,
|
|
1878
|
+
margin: headerStyle ? headerStyle.margin : 0,
|
|
1879
|
+
lineHeight: headerStyle ? headerStyle.lineHeight : props.lineHeight,
|
|
1880
|
+
letterSpacing: headerStyle ? headerStyle.letterSpacing : props.letterSpacing,
|
|
1881
|
+
fontWeight: headerStyle ? headerStyle.fontWeight : 900 - k * 100
|
|
1882
|
+
};
|
|
1883
|
+
}
|
|
1884
|
+
}
|
|
1885
|
+
};
|
|
1886
|
+
var applyTypographySequence = () => {
|
|
1887
|
+
const CONFIG2 = getActiveConfig();
|
|
1888
|
+
const { TYPOGRAPHY: TYPOGRAPHY2 } = CONFIG2;
|
|
1889
|
+
generateSequence(TYPOGRAPHY2);
|
|
1890
|
+
applyHeadings(TYPOGRAPHY2);
|
|
1891
|
+
applySequenceVars(TYPOGRAPHY2);
|
|
1892
|
+
runThroughMedia(TYPOGRAPHY2);
|
|
1893
|
+
};
|
|
1894
|
+
var getFontSizeByKey = (value) => {
|
|
1895
|
+
const CONFIG2 = getActiveConfig();
|
|
1896
|
+
const { TYPOGRAPHY: TYPOGRAPHY2 } = CONFIG2;
|
|
1897
|
+
return getSequenceValuePropertyPair(
|
|
1898
|
+
value,
|
|
1899
|
+
"fontSize",
|
|
1900
|
+
TYPOGRAPHY2
|
|
1901
|
+
);
|
|
1902
|
+
};
|
|
1903
|
+
|
|
1904
|
+
// src/system/spacing.js
|
|
1905
|
+
var import_utils17 = __toESM(require_cjs3(), 1);
|
|
1906
|
+
var runThroughMedia2 = (sequenceProps) => {
|
|
1907
|
+
for (const prop in sequenceProps) {
|
|
1908
|
+
const mediaProps = sequenceProps[prop];
|
|
1909
|
+
if (prop.slice(0, 1) === "@") {
|
|
1910
|
+
const { type, base, ratio, range, subSequence, h1Matches, unit } = sequenceProps;
|
|
1911
|
+
(0, import_utils17.merge)(mediaProps, {
|
|
1912
|
+
type,
|
|
1913
|
+
base,
|
|
1914
|
+
ratio,
|
|
1915
|
+
range,
|
|
1916
|
+
subSequence,
|
|
1917
|
+
h1Matches,
|
|
1918
|
+
unit,
|
|
1919
|
+
sequence: {},
|
|
1920
|
+
scales: {},
|
|
1921
|
+
templates: {},
|
|
1922
|
+
vars: {}
|
|
1923
|
+
});
|
|
1924
|
+
generateSequence(mediaProps);
|
|
1925
|
+
const mediaName = prop.slice(1);
|
|
1926
|
+
applySequenceVars(mediaProps, mediaName);
|
|
1927
|
+
}
|
|
1928
|
+
}
|
|
1929
|
+
};
|
|
1930
|
+
var applySpacingSequence = () => {
|
|
1931
|
+
const CONFIG2 = getActiveConfig();
|
|
1932
|
+
const { SPACING: SPACING2 } = CONFIG2;
|
|
1933
|
+
generateSequence(SPACING2);
|
|
1934
|
+
applySequenceVars(SPACING2);
|
|
1935
|
+
runThroughMedia2(SPACING2);
|
|
1936
|
+
};
|
|
1937
|
+
var getSequence = (sequenceProps) => {
|
|
1938
|
+
const CONFIG2 = getActiveConfig();
|
|
1939
|
+
const { SPACING: SPACING2 } = CONFIG2;
|
|
1940
|
+
if (!sequenceProps)
|
|
1941
|
+
return SPACING2;
|
|
1942
|
+
const hasGenerated = Object.keys(sequenceProps.sequence).length > 0;
|
|
1943
|
+
return hasGenerated ? sequenceProps : generateSequence(sequenceProps);
|
|
1944
|
+
};
|
|
1945
|
+
var getSpacingByKey = (value, propertyName = "padding", sequenceProps) => {
|
|
1946
|
+
const sequence = getSequence(sequenceProps);
|
|
1947
|
+
const stack = arrayzeValue(value);
|
|
1948
|
+
if (!stack)
|
|
1949
|
+
return;
|
|
1950
|
+
if ((0, import_utils17.isString)(value) && value.includes("calc")) {
|
|
1951
|
+
return { [propertyName]: value };
|
|
1952
|
+
}
|
|
1953
|
+
if (stack.length > 1) {
|
|
1954
|
+
let suffix = "";
|
|
1955
|
+
if (propertyName === "borderWidth") {
|
|
1956
|
+
propertyName = "border";
|
|
1957
|
+
suffix = "Width";
|
|
1958
|
+
}
|
|
1959
|
+
const directions = {
|
|
1960
|
+
2: ["Block", "Inline"],
|
|
1961
|
+
3: ["BlockStart", "Inline", "BlockEnd"],
|
|
1962
|
+
4: ["BlockStart", "InlineEnd", "BlockEnd", "InlineStart"]
|
|
1963
|
+
};
|
|
1964
|
+
const wrapSequenceValueByDirection = (direction, i) => getSequenceValuePropertyPair(
|
|
1965
|
+
stack[i],
|
|
1966
|
+
propertyName + direction + suffix,
|
|
1967
|
+
sequence
|
|
1968
|
+
);
|
|
1969
|
+
return directions[stack.length].map((dir, key) => wrapSequenceValueByDirection(dir, key));
|
|
1970
|
+
}
|
|
1971
|
+
return getSequenceValuePropertyPair(
|
|
1972
|
+
value,
|
|
1973
|
+
propertyName,
|
|
1974
|
+
sequence
|
|
1975
|
+
);
|
|
1976
|
+
};
|
|
1977
|
+
var getSpacingBasedOnRatio = (props, propertyName, val) => {
|
|
1978
|
+
const CONFIG2 = getActiveConfig();
|
|
1979
|
+
const { SPACING: SPACING2 } = CONFIG2;
|
|
1980
|
+
const { spacingRatio, unit } = props;
|
|
1981
|
+
const value = val || props[propertyName];
|
|
1982
|
+
if (spacingRatio) {
|
|
1983
|
+
let sequenceProps = SPACING2[spacingRatio];
|
|
1984
|
+
if (!sequenceProps) {
|
|
1985
|
+
const { type, base, range, subSequence } = SPACING2;
|
|
1986
|
+
sequenceProps = SPACING2[spacingRatio] = (0, import_utils17.merge)({
|
|
1987
|
+
ratio: spacingRatio,
|
|
1988
|
+
type: type + "-" + spacingRatio,
|
|
1989
|
+
unit,
|
|
1990
|
+
sequence: {},
|
|
1991
|
+
scales: {},
|
|
1992
|
+
templates: {},
|
|
1993
|
+
vars: {}
|
|
1994
|
+
}, {
|
|
1995
|
+
base,
|
|
1996
|
+
range,
|
|
1997
|
+
subSequence,
|
|
1998
|
+
ratio: SPACING2.ratio,
|
|
1999
|
+
unit: SPACING2.unit
|
|
2000
|
+
});
|
|
2001
|
+
}
|
|
2002
|
+
applySequenceVars(sequenceProps, null, { useDefault: false });
|
|
2003
|
+
return getSpacingByKey(value, propertyName, sequenceProps);
|
|
2004
|
+
}
|
|
2005
|
+
return getSpacingByKey(value, propertyName);
|
|
2006
|
+
};
|
|
2007
|
+
|
|
2008
|
+
// src/system/timing.js
|
|
2009
|
+
var applyTimingSequence = () => {
|
|
2010
|
+
const CONFIG2 = getActiveConfig();
|
|
2011
|
+
const { TIMING: TIMING2 } = CONFIG2;
|
|
2012
|
+
generateSequence(TIMING2);
|
|
2013
|
+
applySequenceVars(TIMING2);
|
|
2014
|
+
};
|
|
2015
|
+
var getTimingFunction = (value) => {
|
|
2016
|
+
const CONFIG2 = getActiveConfig();
|
|
2017
|
+
const { TIMING: TIMING2 } = CONFIG2;
|
|
2018
|
+
return TIMING2[value] || TIMING2[toCamelCase(value)] || value;
|
|
2019
|
+
};
|
|
2020
|
+
var getTimingByKey = (value, property = "timing") => {
|
|
2021
|
+
const CONFIG2 = getActiveConfig();
|
|
2022
|
+
const { TIMING: TIMING2 } = CONFIG2;
|
|
2023
|
+
return getSequenceValuePropertyPair(
|
|
2024
|
+
value,
|
|
2025
|
+
property,
|
|
2026
|
+
TIMING2
|
|
2027
|
+
);
|
|
2028
|
+
};
|
|
2029
|
+
|
|
2030
|
+
// src/system/document.js
|
|
2031
|
+
var import_utils21 = __toESM(require_cjs3(), 1);
|
|
2032
|
+
var applyDocument = () => {
|
|
2033
|
+
const CONFIG2 = getActiveConfig();
|
|
2034
|
+
const { DOCUMENT: DOCUMENT2, FONT_FAMILY: FONT_FAMILY2, THEME: THEME2, TYPOGRAPHY: TYPOGRAPHY2 } = CONFIG2;
|
|
2035
|
+
return (0, import_utils21.merge)(DOCUMENT2, {
|
|
2036
|
+
theme: THEME2.document,
|
|
2037
|
+
fontFamily: getDefaultOrFirstKey(FONT_FAMILY2),
|
|
2038
|
+
fontSize: TYPOGRAPHY2.base,
|
|
2039
|
+
lineHeight: TYPOGRAPHY2.lineHeight
|
|
2040
|
+
});
|
|
2041
|
+
};
|
|
2042
|
+
|
|
2043
|
+
// src/system/svg.js
|
|
2044
|
+
var import_globals2 = __toESM(require_cjs(), 1);
|
|
2045
|
+
var DEF_OPTIONS = {
|
|
2046
|
+
document: import_globals2.document
|
|
2047
|
+
};
|
|
2048
|
+
var setSVG = (val, key) => {
|
|
2049
|
+
if (!val) {
|
|
2050
|
+
if (CONFIG2.verbose)
|
|
2051
|
+
console.warn("setSVG: val is not defined", key);
|
|
2052
|
+
return;
|
|
2053
|
+
}
|
|
2054
|
+
const CONFIG2 = getActiveConfig();
|
|
2055
|
+
if (CONFIG2.useSvgSprite) {
|
|
2056
|
+
return convertSvgToSymbol(key, val);
|
|
2057
|
+
}
|
|
2058
|
+
return val;
|
|
2059
|
+
};
|
|
2060
|
+
var appendSVGSprite = (LIBRARY, options = DEF_OPTIONS) => {
|
|
2061
|
+
const CONFIG2 = getActiveConfig();
|
|
2062
|
+
const doc = options.document || import_globals2.document;
|
|
2063
|
+
const lib = Object.keys(LIBRARY).length ? {} : CONFIG2.SVG;
|
|
2064
|
+
for (let key in LIBRARY)
|
|
2065
|
+
lib[key] = CONFIG2.SVG[key];
|
|
2066
|
+
const SVGsprite = generateSprite(lib);
|
|
2067
|
+
if (!doc) {
|
|
2068
|
+
console.warn("To append SVG sprites it should be run in browser environment");
|
|
2069
|
+
return SVGsprite;
|
|
2070
|
+
}
|
|
2071
|
+
const svgSpriteDOM = doc.createElement("template");
|
|
2072
|
+
svgSpriteDOM.innerHTML = SVGsprite;
|
|
2073
|
+
doc.body.appendChild(svgSpriteDOM.content);
|
|
2074
|
+
};
|
|
2075
|
+
var setIcon = (val, key) => {
|
|
2076
|
+
const CONFIG2 = getActiveConfig();
|
|
2077
|
+
if (CONFIG2.useIconSprite) {
|
|
2078
|
+
return setSVG(val, key);
|
|
2079
|
+
}
|
|
2080
|
+
return val;
|
|
2081
|
+
};
|
|
2082
|
+
var appendIconsSprite = (LIBRARY, options = DEF_OPTIONS) => {
|
|
2083
|
+
const CONFIG2 = getActiveConfig();
|
|
2084
|
+
const doc = options.document || import_globals2.document;
|
|
2085
|
+
const lib = Object.keys(LIBRARY).length ? {} : CONFIG2.ICONS;
|
|
2086
|
+
for (let key in LIBRARY)
|
|
2087
|
+
lib[key] = CONFIG2.ICONS[key];
|
|
2088
|
+
const SVGsprite = generateSprite(lib);
|
|
2089
|
+
if (!doc) {
|
|
2090
|
+
console.warn("To append SVG Icon sprites it should be run in browser environment");
|
|
2091
|
+
return SVGsprite;
|
|
2092
|
+
}
|
|
2093
|
+
const iconsSpriteDOM = doc.createElement("template");
|
|
2094
|
+
iconsSpriteDOM.innerHTML = SVGsprite;
|
|
2095
|
+
doc.body.appendChild(iconsSpriteDOM.content);
|
|
2096
|
+
};
|
|
2097
|
+
|
|
2098
|
+
// src/system/reset.js
|
|
2099
|
+
var import_utils24 = __toESM(require_cjs3(), 1);
|
|
2100
|
+
var applyReset = (reset = {}) => {
|
|
2101
|
+
const CONFIG2 = getActiveConfig();
|
|
2102
|
+
const { CSS_VARS: CSS_VARS2, RESET: RESET2, TYPOGRAPHY: TYPOGRAPHY2, DOCUMENT: DOCUMENT2 } = CONFIG2;
|
|
2103
|
+
if (RESET2) {
|
|
2104
|
+
if (RESET2[":root"]) {
|
|
2105
|
+
const configReset = RESET2;
|
|
2106
|
+
const configTemplates = TYPOGRAPHY2.templates;
|
|
2107
|
+
configReset.body = {
|
|
2108
|
+
...getMediaTheme("document", `@${CONFIG2.globalTheme}`),
|
|
2109
|
+
...configTemplates.body
|
|
2110
|
+
};
|
|
2111
|
+
configReset.h1 = configTemplates.h1;
|
|
2112
|
+
configReset.h2 = configTemplates.h2;
|
|
2113
|
+
configReset.h3 = configTemplates.h3;
|
|
2114
|
+
configReset.h4 = configTemplates.h4;
|
|
2115
|
+
configReset.h5 = configTemplates.h5;
|
|
2116
|
+
configReset.h6 = configTemplates.h6;
|
|
2117
|
+
}
|
|
2118
|
+
const { body, ...templates } = TYPOGRAPHY2.templates;
|
|
2119
|
+
return (0, import_utils24.deepMerge)((0, import_utils24.merge)(RESET2, reset), {
|
|
2120
|
+
html: {
|
|
2121
|
+
position: "absolute",
|
|
2122
|
+
// overflow: 'hidden',
|
|
2123
|
+
width: "100%",
|
|
2124
|
+
height: "100%",
|
|
2125
|
+
top: "0",
|
|
2126
|
+
left: "0",
|
|
2127
|
+
margin: "0",
|
|
2128
|
+
WebkitFontSmoothing: "antialiased",
|
|
2129
|
+
transform: "translate3d(0, 0, 1px)",
|
|
2130
|
+
scrollBehavior: "smooth",
|
|
2131
|
+
fontSize: TYPOGRAPHY2.browserDefault + "px",
|
|
2132
|
+
...CONFIG2.useDocumentTheme ? getMediaTheme("document", `@${CONFIG2.globalTheme}`) : {},
|
|
2133
|
+
fontFamily: DOCUMENT2.fontFamily,
|
|
2134
|
+
lineHeight: DOCUMENT2.lineHeight
|
|
2135
|
+
},
|
|
2136
|
+
body: {
|
|
2137
|
+
boxSizing: "border-box",
|
|
2138
|
+
height: "100%",
|
|
2139
|
+
margin: 0,
|
|
2140
|
+
fontFamily: DOCUMENT2.fontFamily,
|
|
2141
|
+
fontSize: TYPOGRAPHY2.base / TYPOGRAPHY2.browserDefault + CONFIG2.UNIT.default,
|
|
2142
|
+
...templates,
|
|
2143
|
+
...body
|
|
2144
|
+
},
|
|
2145
|
+
// form elements
|
|
2146
|
+
fieldset: {
|
|
2147
|
+
border: 0,
|
|
2148
|
+
padding: 0,
|
|
2149
|
+
margin: 0
|
|
2150
|
+
},
|
|
2151
|
+
"select, input": {
|
|
2152
|
+
fontFamily: DOCUMENT2.fontFamily
|
|
2153
|
+
}
|
|
2154
|
+
});
|
|
2155
|
+
}
|
|
2156
|
+
};
|
|
2157
|
+
|
|
2158
|
+
// src/set.js
|
|
2159
|
+
var import_utils25 = __toESM(require_cjs3(), 1);
|
|
2160
|
+
var setCases = (val, key) => {
|
|
2161
|
+
if ((0, import_utils25.isFunction)(val))
|
|
35
2162
|
return val();
|
|
36
2163
|
return val;
|
|
37
2164
|
};
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
color:
|
|
41
|
-
gradient:
|
|
42
|
-
font:
|
|
43
|
-
font_family:
|
|
44
|
-
theme:
|
|
45
|
-
icons:
|
|
46
|
-
svg:
|
|
2165
|
+
var setSameValue = (val, key) => val;
|
|
2166
|
+
var VALUE_TRANSFORMERS = {
|
|
2167
|
+
color: setColor,
|
|
2168
|
+
gradient: setGradient,
|
|
2169
|
+
font: setFont,
|
|
2170
|
+
font_family: setFontFamily,
|
|
2171
|
+
theme: setTheme,
|
|
2172
|
+
icons: setIcon,
|
|
2173
|
+
svg: setSVG,
|
|
47
2174
|
svg_data: setSameValue,
|
|
48
2175
|
typography: setSameValue,
|
|
49
2176
|
cases: setCases,
|
|
@@ -54,28 +2181,28 @@ const VALUE_TRANSFORMERS = {
|
|
|
54
2181
|
unit: setSameValue,
|
|
55
2182
|
animation: setSameValue
|
|
56
2183
|
};
|
|
57
|
-
|
|
58
|
-
const
|
|
2184
|
+
var setValue = (FACTORY_NAME, value, key) => {
|
|
2185
|
+
const CONFIG2 = getActiveConfig();
|
|
59
2186
|
const factoryName = FACTORY_NAME.toLowerCase();
|
|
60
|
-
const FACTORY2 =
|
|
2187
|
+
const FACTORY2 = CONFIG2[FACTORY_NAME];
|
|
61
2188
|
if (VALUE_TRANSFORMERS[factoryName]) {
|
|
62
2189
|
const result = VALUE_TRANSFORMERS[factoryName](value, key);
|
|
63
2190
|
FACTORY2[key] = result;
|
|
64
2191
|
return FACTORY2;
|
|
65
2192
|
}
|
|
66
|
-
if (
|
|
2193
|
+
if (CONFIG2.verbose)
|
|
67
2194
|
console.warn("Can not find", factoryName, "method in scratch");
|
|
68
2195
|
};
|
|
69
|
-
|
|
70
|
-
const
|
|
2196
|
+
var setEach = (factoryName, props) => {
|
|
2197
|
+
const CONFIG2 = getActiveConfig();
|
|
71
2198
|
const FACTORY_NAME = factoryName.toUpperCase();
|
|
72
2199
|
const keys = Object.keys(props);
|
|
73
2200
|
keys.map((key) => setValue(FACTORY_NAME, props[key], key));
|
|
74
|
-
return
|
|
2201
|
+
return CONFIG2[FACTORY_NAME];
|
|
75
2202
|
};
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
let
|
|
2203
|
+
var SET_OPTIONS = {};
|
|
2204
|
+
var set = (recivedConfig, options = SET_OPTIONS) => {
|
|
2205
|
+
let CONFIG2 = getActiveConfig();
|
|
79
2206
|
const {
|
|
80
2207
|
version,
|
|
81
2208
|
verbose,
|
|
@@ -89,34 +2216,33 @@ const set = (recivedConfig, options = SET_OPTIONS) => {
|
|
|
89
2216
|
...config
|
|
90
2217
|
} = recivedConfig;
|
|
91
2218
|
if (options.newConfig) {
|
|
92
|
-
|
|
93
|
-
|
|
2219
|
+
FACTORY["active"] = options.newConfig;
|
|
2220
|
+
CONFIG2 = getActiveConfig(options.newConfig);
|
|
94
2221
|
}
|
|
95
2222
|
if (verbose !== void 0)
|
|
96
|
-
|
|
2223
|
+
CONFIG2.verbose = verbose;
|
|
97
2224
|
if (useVariable !== void 0)
|
|
98
|
-
|
|
2225
|
+
CONFIG2.useVariable = useVariable;
|
|
99
2226
|
if (useReset !== void 0)
|
|
100
|
-
|
|
2227
|
+
CONFIG2.useReset = useReset;
|
|
101
2228
|
if (useFontImport !== void 0)
|
|
102
|
-
|
|
2229
|
+
CONFIG2.useFontImport = useFontImport;
|
|
103
2230
|
if (useSvgSprite !== void 0)
|
|
104
|
-
|
|
2231
|
+
CONFIG2.useSvgSprite = useSvgSprite;
|
|
105
2232
|
if (useIconSprite !== void 0)
|
|
106
|
-
|
|
2233
|
+
CONFIG2.useIconSprite = useIconSprite;
|
|
107
2234
|
if (useDocumentTheme !== void 0)
|
|
108
|
-
|
|
2235
|
+
CONFIG2.useDocumentTheme = useDocumentTheme;
|
|
109
2236
|
if (globalTheme !== void 0)
|
|
110
|
-
|
|
111
|
-
if (
|
|
112
|
-
console.log(
|
|
2237
|
+
CONFIG2.globalTheme = globalTheme;
|
|
2238
|
+
if (CONFIG2.verbose)
|
|
2239
|
+
console.log(CONFIG2);
|
|
113
2240
|
const keys = Object.keys(config);
|
|
114
2241
|
keys.map((key) => setEach(key, config[key]));
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
return CONFIG;
|
|
2242
|
+
applyTypographySequence();
|
|
2243
|
+
applySpacingSequence();
|
|
2244
|
+
applyTimingSequence();
|
|
2245
|
+
applyDocument();
|
|
2246
|
+
applyReset();
|
|
2247
|
+
return CONFIG2;
|
|
122
2248
|
};
|