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