@symbo.ls/scratch 2.11.523 → 3.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/factory.js +106 -51
- package/dist/cjs/index.js +366 -423
- package/dist/cjs/set.js +304 -321
- package/dist/cjs/system/color.js +231 -181
- package/dist/cjs/system/document.js +198 -121
- package/dist/cjs/system/font.js +199 -127
- package/dist/cjs/system/index.js +308 -325
- package/dist/cjs/system/reset.js +205 -135
- package/dist/cjs/system/shadow.js +247 -212
- package/dist/cjs/system/spacing.js +215 -153
- package/dist/cjs/system/svg.js +203 -132
- package/dist/cjs/system/theme.js +243 -206
- package/dist/cjs/system/timing.js +206 -138
- package/dist/cjs/system/typography.js +212 -148
- package/dist/cjs/transforms/index.js +285 -268
- package/dist/cjs/utils/color.js +93 -85
- package/dist/cjs/utils/font.js +3 -6
- package/dist/cjs/utils/index.js +236 -193
- package/dist/cjs/utils/sequence.js +206 -99
- package/dist/cjs/utils/sprite.js +106 -51
- package/dist/cjs/utils/theme.js +3 -6
- package/dist/cjs/utils/var.js +196 -83
- package/package.json +4 -4
- package/src/system/svg.js +1 -1
- package/src/transforms/index.js +9 -2
- package/src/utils/color.js +1 -2
- package/src/utils/sequence.js +1 -1
|
@@ -34,25 +34,25 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
34
34
|
var require_cjs = __commonJS({
|
|
35
35
|
"../utils/dist/cjs/index.js"(exports, module2) {
|
|
36
36
|
"use strict";
|
|
37
|
-
var
|
|
37
|
+
var __defProp2 = Object.defineProperty;
|
|
38
38
|
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
39
39
|
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
40
|
-
var
|
|
40
|
+
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
41
41
|
var __export2 = (target, all) => {
|
|
42
42
|
for (var name in all)
|
|
43
|
-
|
|
43
|
+
__defProp2(target, name, { get: all[name], enumerable: true });
|
|
44
44
|
};
|
|
45
45
|
var __copyProps2 = (to, from, except, desc) => {
|
|
46
46
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
47
47
|
for (let key of __getOwnPropNames2(from))
|
|
48
|
-
if (!
|
|
49
|
-
|
|
48
|
+
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
49
|
+
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
50
50
|
}
|
|
51
51
|
return to;
|
|
52
52
|
};
|
|
53
|
-
var __toCommonJS2 = (mod) => __copyProps2(
|
|
54
|
-
var
|
|
55
|
-
__export2(
|
|
53
|
+
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
54
|
+
var index_exports = {};
|
|
55
|
+
__export2(index_exports, {
|
|
56
56
|
arrayzeValue: () => arrayzeValue,
|
|
57
57
|
copyJavaScriptToClipboard: () => copyJavaScriptToClipboard,
|
|
58
58
|
copyStringToClipboard: () => copyStringToClipboard,
|
|
@@ -73,17 +73,85 @@ var require_cjs = __commonJS({
|
|
|
73
73
|
toTitleCase: () => toTitleCase,
|
|
74
74
|
toggleFullscreen: () => toggleFullscreen
|
|
75
75
|
});
|
|
76
|
-
module2.exports = __toCommonJS2(
|
|
76
|
+
module2.exports = __toCommonJS2(index_exports);
|
|
77
77
|
var window22 = globalThis;
|
|
78
78
|
var document22 = window22.document;
|
|
79
79
|
var isObject2 = (arg) => {
|
|
80
|
-
if (arg === null)
|
|
81
|
-
return false;
|
|
80
|
+
if (arg === null) return false;
|
|
82
81
|
return typeof arg === "object" && arg.constructor === Object;
|
|
83
82
|
};
|
|
84
83
|
var isString2 = (arg) => typeof arg === "string";
|
|
85
84
|
var isNumber2 = (arg) => typeof arg === "number";
|
|
86
85
|
var isArray2 = (arg) => Array.isArray(arg);
|
|
86
|
+
var STATE_METHODS2 = [
|
|
87
|
+
"update",
|
|
88
|
+
"parse",
|
|
89
|
+
"clean",
|
|
90
|
+
"create",
|
|
91
|
+
"destroy",
|
|
92
|
+
"add",
|
|
93
|
+
"toggle",
|
|
94
|
+
"remove",
|
|
95
|
+
"apply",
|
|
96
|
+
"set",
|
|
97
|
+
"reset",
|
|
98
|
+
"replace",
|
|
99
|
+
"quietReplace",
|
|
100
|
+
"quietUpdate",
|
|
101
|
+
"applyReplace",
|
|
102
|
+
"applyFunction",
|
|
103
|
+
"keys",
|
|
104
|
+
"values",
|
|
105
|
+
"ref",
|
|
106
|
+
"rootUpdate",
|
|
107
|
+
"parentUpdate",
|
|
108
|
+
"parent",
|
|
109
|
+
"__element",
|
|
110
|
+
"__depends",
|
|
111
|
+
"__ref",
|
|
112
|
+
"__children",
|
|
113
|
+
"root",
|
|
114
|
+
"setByPath",
|
|
115
|
+
"setPathCollection",
|
|
116
|
+
"removeByPath",
|
|
117
|
+
"removePathCollection",
|
|
118
|
+
"getByPath"
|
|
119
|
+
];
|
|
120
|
+
var PROPS_METHODS2 = ["update", "__element"];
|
|
121
|
+
var METHODS2 = [
|
|
122
|
+
"set",
|
|
123
|
+
"reset",
|
|
124
|
+
"update",
|
|
125
|
+
"remove",
|
|
126
|
+
"updateContent",
|
|
127
|
+
"removeContent",
|
|
128
|
+
"lookup",
|
|
129
|
+
"lookdown",
|
|
130
|
+
"lookdownAll",
|
|
131
|
+
"getRef",
|
|
132
|
+
"getPath",
|
|
133
|
+
"setNodeStyles",
|
|
134
|
+
"spotByPath",
|
|
135
|
+
"keys",
|
|
136
|
+
"parse",
|
|
137
|
+
"setProps",
|
|
138
|
+
"parseDeep",
|
|
139
|
+
"variables",
|
|
140
|
+
"if",
|
|
141
|
+
"log",
|
|
142
|
+
"verbose",
|
|
143
|
+
"warn",
|
|
144
|
+
"error",
|
|
145
|
+
"call",
|
|
146
|
+
"nextElement",
|
|
147
|
+
"previousElement"
|
|
148
|
+
];
|
|
149
|
+
var METHODS_EXL2 = [
|
|
150
|
+
...["node", "context", "extends", "__element", "__ref"],
|
|
151
|
+
...METHODS2,
|
|
152
|
+
...STATE_METHODS2,
|
|
153
|
+
...PROPS_METHODS2
|
|
154
|
+
];
|
|
87
155
|
var isMobile2 = (() => typeof navigator === "undefined" ? false : /Mobi/.test(navigator.userAgent))();
|
|
88
156
|
async function toggleFullscreen(opts) {
|
|
89
157
|
if (!document.fullscreenElement) {
|
|
@@ -103,13 +171,11 @@ var require_cjs = __commonJS({
|
|
|
103
171
|
};
|
|
104
172
|
var findClosestNumberInFactory = (val, factory) => {
|
|
105
173
|
val = parseFloat(val);
|
|
106
|
-
if (isObject2(factory))
|
|
107
|
-
factory = Object.values(factory);
|
|
174
|
+
if (isObject2(factory)) factory = Object.values(factory);
|
|
108
175
|
return findClosestNumber(val, factory);
|
|
109
176
|
};
|
|
110
177
|
var formatDate = (timestamp) => {
|
|
111
|
-
if (!timestamp)
|
|
112
|
-
return "";
|
|
178
|
+
if (!timestamp) return "";
|
|
113
179
|
const d = new Date(timestamp);
|
|
114
180
|
const ye = new Intl.DateTimeFormat("en", { year: "numeric" }).format(d);
|
|
115
181
|
const mo = new Intl.DateTimeFormat("en", { month: "short" }).format(d);
|
|
@@ -176,8 +242,7 @@ var require_cjs = __commonJS({
|
|
|
176
242
|
scriptEle.type = type;
|
|
177
243
|
scriptEle.text = xhr.responseText;
|
|
178
244
|
doc.body.appendChild(scriptEle);
|
|
179
|
-
if (typeof fallback === "function")
|
|
180
|
-
fallback();
|
|
245
|
+
if (typeof fallback === "function") fallback();
|
|
181
246
|
} else {
|
|
182
247
|
throw new Error(`Failed to load the script ${FILE_URL}`);
|
|
183
248
|
}
|
|
@@ -245,60 +310,19 @@ var require_cjs = __commonJS({
|
|
|
245
310
|
);
|
|
246
311
|
var toDashCase2 = (val) => val.replace(/[^a-zA-Z0-9]/g, " ").trim().toLowerCase().replace(/\s+/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "");
|
|
247
312
|
var toDescriptionCase = (str = "") => {
|
|
248
|
-
if (typeof str !== "string")
|
|
249
|
-
return;
|
|
313
|
+
if (typeof str !== "string") return;
|
|
250
314
|
const result = str.replace(/([A-Z])/g, " $1");
|
|
251
315
|
return result.charAt(0).toUpperCase() + result.slice(1);
|
|
252
316
|
};
|
|
253
317
|
var arrayzeValue = (val) => {
|
|
254
|
-
if (isArray2(val))
|
|
255
|
-
|
|
256
|
-
if (
|
|
257
|
-
|
|
258
|
-
if (isObject2(val))
|
|
259
|
-
return Object.values(val);
|
|
260
|
-
if (isNumber2(val))
|
|
261
|
-
return [val];
|
|
318
|
+
if (isArray2(val)) return val;
|
|
319
|
+
if (isString2(val)) return val.split(" ");
|
|
320
|
+
if (isObject2(val)) return Object.values(val);
|
|
321
|
+
if (isNumber2(val)) return [val];
|
|
262
322
|
};
|
|
263
323
|
}
|
|
264
324
|
});
|
|
265
325
|
|
|
266
|
-
// ../../node_modules/@domql/globals/dist/cjs/index.js
|
|
267
|
-
var require_cjs2 = __commonJS({
|
|
268
|
-
"../../node_modules/@domql/globals/dist/cjs/index.js"(exports, module2) {
|
|
269
|
-
"use strict";
|
|
270
|
-
var __defProp3 = Object.defineProperty;
|
|
271
|
-
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
272
|
-
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
273
|
-
var __hasOwnProp3 = Object.prototype.hasOwnProperty;
|
|
274
|
-
var __export2 = (target, all) => {
|
|
275
|
-
for (var name in all)
|
|
276
|
-
__defProp3(target, name, { get: all[name], enumerable: true });
|
|
277
|
-
};
|
|
278
|
-
var __copyProps2 = (to, from, except, desc) => {
|
|
279
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
280
|
-
for (let key of __getOwnPropNames2(from))
|
|
281
|
-
if (!__hasOwnProp3.call(to, key) && key !== except)
|
|
282
|
-
__defProp3(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
283
|
-
}
|
|
284
|
-
return to;
|
|
285
|
-
};
|
|
286
|
-
var __toCommonJS2 = (mod) => __copyProps2(__defProp3({}, "__esModule", { value: true }), mod);
|
|
287
|
-
var globals_exports = {};
|
|
288
|
-
__export2(globals_exports, {
|
|
289
|
-
document: () => document4,
|
|
290
|
-
global: () => global,
|
|
291
|
-
self: () => self,
|
|
292
|
-
window: () => window4
|
|
293
|
-
});
|
|
294
|
-
module2.exports = __toCommonJS2(globals_exports);
|
|
295
|
-
var global = globalThis;
|
|
296
|
-
var self = globalThis;
|
|
297
|
-
var window4 = globalThis;
|
|
298
|
-
var document4 = window4.document;
|
|
299
|
-
}
|
|
300
|
-
});
|
|
301
|
-
|
|
302
326
|
// src/system/timing.js
|
|
303
327
|
var timing_exports = {};
|
|
304
328
|
__export(timing_exports, {
|
|
@@ -307,61 +331,116 @@ __export(timing_exports, {
|
|
|
307
331
|
getTimingFunction: () => getTimingFunction
|
|
308
332
|
});
|
|
309
333
|
module.exports = __toCommonJS(timing_exports);
|
|
310
|
-
var
|
|
334
|
+
var import_utils9 = __toESM(require_cjs(), 1);
|
|
311
335
|
|
|
312
|
-
// ../../node_modules/@domql/utils/
|
|
336
|
+
// ../../node_modules/@domql/utils/globals.js
|
|
313
337
|
var window2 = globalThis;
|
|
314
338
|
var document2 = window2.document;
|
|
315
339
|
|
|
316
|
-
// ../../node_modules/@domql/utils/
|
|
340
|
+
// ../../node_modules/@domql/utils/node.js
|
|
317
341
|
var isDOMNode = (obj) => {
|
|
318
342
|
return typeof window2 !== "undefined" && (obj instanceof window2.Node || obj instanceof window2.Window || obj === window2 || obj === document);
|
|
319
343
|
};
|
|
320
344
|
|
|
321
|
-
// ../../node_modules/@domql/utils/
|
|
345
|
+
// ../../node_modules/@domql/utils/types.js
|
|
322
346
|
var isString = (arg) => typeof arg === "string";
|
|
323
347
|
var isFunction = (arg) => typeof arg === "function";
|
|
324
348
|
var isNull = (arg) => arg === null;
|
|
325
349
|
var isArray = (arg) => Array.isArray(arg);
|
|
326
350
|
var isObjectLike = (arg) => {
|
|
327
|
-
if (arg === null)
|
|
328
|
-
return false;
|
|
351
|
+
if (arg === null) return false;
|
|
329
352
|
return typeof arg === "object";
|
|
330
353
|
};
|
|
331
354
|
var isUndefined = (arg) => {
|
|
332
355
|
return arg === void 0;
|
|
333
356
|
};
|
|
334
357
|
|
|
335
|
-
// ../../node_modules/@domql/utils/
|
|
336
|
-
var
|
|
337
|
-
return arr.reduce(
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
var __defProp2 = Object.defineProperty;
|
|
342
|
-
var __defProps = Object.defineProperties;
|
|
343
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
344
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
345
|
-
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
346
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
347
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
348
|
-
var __spreadValues = (a, b) => {
|
|
349
|
-
for (var prop in b || (b = {}))
|
|
350
|
-
if (__hasOwnProp2.call(b, prop))
|
|
351
|
-
__defNormalProp(a, prop, b[prop]);
|
|
352
|
-
if (__getOwnPropSymbols)
|
|
353
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
354
|
-
if (__propIsEnum.call(b, prop))
|
|
355
|
-
__defNormalProp(a, prop, b[prop]);
|
|
356
|
-
}
|
|
357
|
-
return a;
|
|
358
|
+
// ../../node_modules/@domql/utils/array.js
|
|
359
|
+
var unstackArrayOfObjects = (arr, exclude = []) => {
|
|
360
|
+
return arr.reduce(
|
|
361
|
+
(a, c) => deepMerge(a, deepClone(c, { exclude }), exclude),
|
|
362
|
+
{}
|
|
363
|
+
);
|
|
358
364
|
};
|
|
359
|
-
|
|
360
|
-
|
|
365
|
+
|
|
366
|
+
// ../../node_modules/@domql/utils/keys.js
|
|
367
|
+
var STATE_METHODS = [
|
|
368
|
+
"update",
|
|
369
|
+
"parse",
|
|
370
|
+
"clean",
|
|
371
|
+
"create",
|
|
372
|
+
"destroy",
|
|
373
|
+
"add",
|
|
374
|
+
"toggle",
|
|
375
|
+
"remove",
|
|
376
|
+
"apply",
|
|
377
|
+
"set",
|
|
378
|
+
"reset",
|
|
379
|
+
"replace",
|
|
380
|
+
"quietReplace",
|
|
381
|
+
"quietUpdate",
|
|
382
|
+
"applyReplace",
|
|
383
|
+
"applyFunction",
|
|
384
|
+
"keys",
|
|
385
|
+
"values",
|
|
386
|
+
"ref",
|
|
387
|
+
"rootUpdate",
|
|
388
|
+
"parentUpdate",
|
|
389
|
+
"parent",
|
|
390
|
+
"__element",
|
|
391
|
+
"__depends",
|
|
392
|
+
"__ref",
|
|
393
|
+
"__children",
|
|
394
|
+
"root",
|
|
395
|
+
"setByPath",
|
|
396
|
+
"setPathCollection",
|
|
397
|
+
"removeByPath",
|
|
398
|
+
"removePathCollection",
|
|
399
|
+
"getByPath"
|
|
400
|
+
];
|
|
401
|
+
var PROPS_METHODS = ["update", "__element"];
|
|
402
|
+
var METHODS = [
|
|
403
|
+
"set",
|
|
404
|
+
"reset",
|
|
405
|
+
"update",
|
|
406
|
+
"remove",
|
|
407
|
+
"updateContent",
|
|
408
|
+
"removeContent",
|
|
409
|
+
"lookup",
|
|
410
|
+
"lookdown",
|
|
411
|
+
"lookdownAll",
|
|
412
|
+
"getRef",
|
|
413
|
+
"getPath",
|
|
414
|
+
"setNodeStyles",
|
|
415
|
+
"spotByPath",
|
|
416
|
+
"keys",
|
|
417
|
+
"parse",
|
|
418
|
+
"setProps",
|
|
419
|
+
"parseDeep",
|
|
420
|
+
"variables",
|
|
421
|
+
"if",
|
|
422
|
+
"log",
|
|
423
|
+
"verbose",
|
|
424
|
+
"warn",
|
|
425
|
+
"error",
|
|
426
|
+
"call",
|
|
427
|
+
"nextElement",
|
|
428
|
+
"previousElement"
|
|
429
|
+
];
|
|
430
|
+
var METHODS_EXL = [
|
|
431
|
+
...["node", "context", "extends", "__element", "__ref"],
|
|
432
|
+
...METHODS,
|
|
433
|
+
...STATE_METHODS,
|
|
434
|
+
...PROPS_METHODS
|
|
435
|
+
];
|
|
436
|
+
|
|
437
|
+
// ../../node_modules/@domql/utils/object.js
|
|
438
|
+
var deepMerge = (element, extend, excludeFrom = METHODS_EXL) => {
|
|
361
439
|
for (const e in extend) {
|
|
362
|
-
const
|
|
363
|
-
if (!
|
|
440
|
+
const hasOwnProperty = Object.prototype.hasOwnProperty.call(extend, e);
|
|
441
|
+
if (!hasOwnProperty || excludeFrom.includes(e) || e.startsWith("__")) {
|
|
364
442
|
continue;
|
|
443
|
+
}
|
|
365
444
|
const elementProp = element[e];
|
|
366
445
|
const extendProp = extend[e];
|
|
367
446
|
if (isObjectLike(elementProp) && isObjectLike(extendProp)) {
|
|
@@ -379,7 +458,7 @@ var deepClone = (obj, options = {}) => {
|
|
|
379
458
|
cleanNull = false,
|
|
380
459
|
window: targetWindow,
|
|
381
460
|
visited = /* @__PURE__ */ new WeakMap(),
|
|
382
|
-
|
|
461
|
+
handleExtends = false
|
|
383
462
|
} = options;
|
|
384
463
|
if (!isObjectLike(obj) || isDOMNode(obj)) {
|
|
385
464
|
return obj;
|
|
@@ -387,40 +466,42 @@ var deepClone = (obj, options = {}) => {
|
|
|
387
466
|
if (visited.has(obj)) {
|
|
388
467
|
return visited.get(obj);
|
|
389
468
|
}
|
|
390
|
-
const
|
|
391
|
-
visited.set(obj,
|
|
469
|
+
const clone = targetWindow ? isArray(obj) ? new targetWindow.Array() : new targetWindow.Object() : isArray(obj) ? [] : {};
|
|
470
|
+
visited.set(obj, clone);
|
|
392
471
|
for (const key in obj) {
|
|
393
|
-
if (!Object.prototype.hasOwnProperty.call(obj, key))
|
|
394
|
-
|
|
395
|
-
if (exclude.includes(key) || key.startsWith("__") || key === "__proto__")
|
|
472
|
+
if (!Object.prototype.hasOwnProperty.call(obj, key)) continue;
|
|
473
|
+
if (exclude.includes(key) || key.startsWith("__") || key === "__proto__") {
|
|
396
474
|
continue;
|
|
475
|
+
}
|
|
397
476
|
const value = obj[key];
|
|
398
|
-
if (cleanUndefined && isUndefined(value) || cleanNull && isNull(value))
|
|
477
|
+
if (cleanUndefined && isUndefined(value) || cleanNull && isNull(value)) {
|
|
399
478
|
continue;
|
|
479
|
+
}
|
|
400
480
|
if (isDOMNode(value)) {
|
|
401
|
-
|
|
481
|
+
clone[key] = value;
|
|
402
482
|
continue;
|
|
403
483
|
}
|
|
404
|
-
if (
|
|
405
|
-
|
|
484
|
+
if (handleExtends && key === "extends" && isArray(value)) {
|
|
485
|
+
clone[key] = unstackArrayOfObjects(value, exclude);
|
|
406
486
|
continue;
|
|
407
487
|
}
|
|
408
488
|
if (isFunction(value) && targetWindow) {
|
|
409
|
-
|
|
489
|
+
clone[key] = targetWindow.eval("(" + value.toString() + ")");
|
|
410
490
|
continue;
|
|
411
491
|
}
|
|
412
492
|
if (isObjectLike(value)) {
|
|
413
|
-
|
|
493
|
+
clone[key] = deepClone(value, {
|
|
494
|
+
...options,
|
|
414
495
|
visited
|
|
415
|
-
})
|
|
496
|
+
});
|
|
416
497
|
} else {
|
|
417
|
-
|
|
498
|
+
clone[key] = value;
|
|
418
499
|
}
|
|
419
500
|
}
|
|
420
|
-
return
|
|
501
|
+
return clone;
|
|
421
502
|
};
|
|
422
503
|
|
|
423
|
-
// ../../node_modules/@domql/utils/
|
|
504
|
+
// ../../node_modules/@domql/utils/cookie.js
|
|
424
505
|
var isMobile = (() => typeof navigator === "undefined" ? false : /Mobi/.test(navigator.userAgent))();
|
|
425
506
|
|
|
426
507
|
// src/defaultConfig/index.js
|
|
@@ -649,11 +730,8 @@ var isScalingUnit = (unit) => {
|
|
|
649
730
|
return unit === "em" || unit === "rem" || unit === "vw" || unit === "vh" || unit === "vmax" || unit === "vmin";
|
|
650
731
|
};
|
|
651
732
|
|
|
652
|
-
// src/utils/color.js
|
|
653
|
-
var import_globals4 = __toESM(require_cjs2(), 1);
|
|
654
|
-
|
|
655
733
|
// src/utils/sequence.js
|
|
656
|
-
var
|
|
734
|
+
var import_utils6 = __toESM(require_cjs(), 1);
|
|
657
735
|
var numToLetterMap = {
|
|
658
736
|
"-6": "U",
|
|
659
737
|
"-5": "V",
|
|
@@ -699,8 +777,7 @@ var setSequenceValue = (props, sequenceProps) => {
|
|
|
699
777
|
var setScalingVar = (key, sequenceProps) => {
|
|
700
778
|
const { base, type, unit } = sequenceProps;
|
|
701
779
|
const defaultVal = (isScalingUnit(unit) ? 1 : base) + unit;
|
|
702
|
-
if (key === 0)
|
|
703
|
-
return defaultVal;
|
|
780
|
+
if (key === 0) return defaultVal;
|
|
704
781
|
const prefix = "--" + (type && type.replace(".", "-"));
|
|
705
782
|
const ratioVar = `${prefix}-ratio`;
|
|
706
783
|
if (key > 0) {
|
|
@@ -737,10 +814,8 @@ var generateSubSequence = (props, sequenceProps) => {
|
|
|
737
814
|
const diffRounded = ~~next - ~~value;
|
|
738
815
|
let arr;
|
|
739
816
|
const [first, middle, second] = getSubratioDifference(value, ratio);
|
|
740
|
-
if (diffRounded > 16)
|
|
741
|
-
|
|
742
|
-
else
|
|
743
|
-
arr = [first, second];
|
|
817
|
+
if (diffRounded > 16) arr = [first, middle, second];
|
|
818
|
+
else arr = [first, second];
|
|
744
819
|
arr.forEach((v, k) => {
|
|
745
820
|
const scaling = ~~(v / base * 1e3) / 1e3;
|
|
746
821
|
const newVar = variable + (k + 1);
|
|
@@ -782,8 +857,7 @@ var generateSequence = (sequenceProps) => {
|
|
|
782
857
|
index: key
|
|
783
858
|
};
|
|
784
859
|
setSequenceValue(props, sequenceProps);
|
|
785
|
-
if (subSequence)
|
|
786
|
-
generateSubSequence(props, sequenceProps);
|
|
860
|
+
if (subSequence) generateSubSequence(props, sequenceProps);
|
|
787
861
|
}
|
|
788
862
|
return sequenceProps;
|
|
789
863
|
};
|
|
@@ -795,13 +869,11 @@ var getSequenceValue = (value = "A", sequenceProps) => {
|
|
|
795
869
|
unit = UNIT2.default,
|
|
796
870
|
useVariable
|
|
797
871
|
} = sequenceProps;
|
|
798
|
-
if (isString(value) && value.slice(0, 2) === "--")
|
|
799
|
-
|
|
800
|
-
const prefix = `--${(0, import_utils4.toDashCase)(sequenceProps.type.replace(".", "-"))}-`;
|
|
872
|
+
if (isString(value) && value.slice(0, 2) === "--") return `var(${value})`;
|
|
873
|
+
const prefix = `--${(0, import_utils6.toDashCase)(sequenceProps.type.replace(".", "-"))}-`;
|
|
801
874
|
const startsWithDashOrLetterRegex = /^-?[a-zA-Z]/i;
|
|
802
875
|
const startsWithDashOrLetter = startsWithDashOrLetterRegex.test(value);
|
|
803
|
-
if (value === "none" || value === "auto" || value === "unset" || value === "inherit" || value === "fit-content" || value === "min-content" || value === "max-content" || value.includes("calc") || value.includes("var") || !startsWithDashOrLetter)
|
|
804
|
-
return value;
|
|
876
|
+
if (value === "none" || value === "auto" || value === "unset" || value === "inherit" || value === "fit-content" || value === "min-content" || value === "max-content" || value.includes("calc") || value.includes("var") || !startsWithDashOrLetter) return value;
|
|
805
877
|
const letterVal = value.toUpperCase();
|
|
806
878
|
const isNegative = letterVal.slice(0, 1) === "-" ? "-" : "";
|
|
807
879
|
let absValue = isNegative ? letterVal.slice(1) : letterVal;
|
|
@@ -825,8 +897,7 @@ var getSequenceValue = (value = "A", sequenceProps) => {
|
|
|
825
897
|
return isNegative ? `calc((${joint}) * -1)` : `calc(${joint})`;
|
|
826
898
|
}
|
|
827
899
|
if (!sequence[absValue] && absValue.length === 2) {
|
|
828
|
-
if (CONFIG2.verbose)
|
|
829
|
-
console.warn(absValue, "- value is not found because `subSequence` is set to false");
|
|
900
|
+
if (CONFIG2.verbose) console.warn(absValue, "- value is not found because `subSequence` is set to false");
|
|
830
901
|
absValue = absValue.slice(0, 1);
|
|
831
902
|
}
|
|
832
903
|
if (useVariable || CONFIG2.useVariable) {
|
|
@@ -834,8 +905,7 @@ var getSequenceValue = (value = "A", sequenceProps) => {
|
|
|
834
905
|
return isNegative ? `calc(${varValue2} * -1)` : varValue2;
|
|
835
906
|
}
|
|
836
907
|
const sequenceItem = sequence ? sequence[absValue] : null;
|
|
837
|
-
if (!sequenceItem)
|
|
838
|
-
return console.warn("can't find", sequence, absValue);
|
|
908
|
+
if (!sequenceItem) return console.warn("can't find", sequence, absValue);
|
|
839
909
|
if (unit === "ms" || unit === "s") {
|
|
840
910
|
return isNegative + sequenceItem.val + unit;
|
|
841
911
|
}
|
|
@@ -844,12 +914,10 @@ var getSequenceValue = (value = "A", sequenceProps) => {
|
|
|
844
914
|
var getSequenceValuePropertyPair = (value, propertyName, sequenceProps) => {
|
|
845
915
|
if (typeof value !== "string") {
|
|
846
916
|
const CONFIG2 = getActiveConfig();
|
|
847
|
-
if (CONFIG2.verbose)
|
|
848
|
-
console.warn(propertyName, value, "is not a string");
|
|
917
|
+
if (CONFIG2.verbose) console.warn(propertyName, value, "is not a string");
|
|
849
918
|
return { [propertyName]: value };
|
|
850
919
|
}
|
|
851
|
-
if (value === "-" || value === "")
|
|
852
|
-
return {};
|
|
920
|
+
if (value === "-" || value === "") return {};
|
|
853
921
|
return { [propertyName]: getSequenceValue(value, sequenceProps) };
|
|
854
922
|
};
|
|
855
923
|
|
|
@@ -904,7 +972,7 @@ var applyTimingSequence = () => {
|
|
|
904
972
|
var getTimingFunction = (value) => {
|
|
905
973
|
const CONFIG2 = getActiveConfig();
|
|
906
974
|
const { TIMING: TIMING2 } = CONFIG2;
|
|
907
|
-
return TIMING2[value] || TIMING2[(0,
|
|
975
|
+
return TIMING2[value] || TIMING2[(0, import_utils9.toCamelCase)(value)] || value;
|
|
908
976
|
};
|
|
909
977
|
var getTimingByKey = (value, property = "timing") => {
|
|
910
978
|
const CONFIG2 = getActiveConfig();
|