@symbo.ls/scratch 2.10.261 → 2.10.271
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 +16 -17
- package/dist/cjs/index.js +60 -40
- package/dist/cjs/set.js +23 -19
- package/dist/cjs/system/color.js +10 -14
- package/dist/cjs/system/document.js +10 -14
- package/dist/cjs/system/font.js +10 -14
- package/dist/cjs/system/index.js +51 -35
- package/dist/cjs/system/reset.js +11 -15
- package/dist/cjs/system/spacing.js +10 -14
- package/dist/cjs/system/svg.js +50 -34
- package/dist/cjs/system/theme.js +10 -14
- package/dist/cjs/system/timing.js +10 -14
- package/dist/cjs/system/typography.js +10 -14
- package/dist/cjs/transforms/index.js +10 -14
- package/dist/cjs/utils/index.js +18 -18
- package/dist/cjs/utils/sequence.js +10 -14
- package/dist/cjs/utils/sprite.js +248 -24
- package/dist/cjs/utils/var.js +10 -14
- package/package.json +2 -2
- package/src/factory.js +11 -8
- package/src/set.js +4 -3
- package/src/system/reset.js +1 -1
- package/src/system/svg.js +37 -17
- package/src/utils/sprite.js +8 -6
package/dist/cjs/factory.js
CHANGED
|
@@ -287,7 +287,7 @@ var require_types = __commonJS({
|
|
|
287
287
|
isNot: () => isNot,
|
|
288
288
|
isNull: () => isNull,
|
|
289
289
|
isNumber: () => isNumber,
|
|
290
|
-
isObject: () =>
|
|
290
|
+
isObject: () => isObject2,
|
|
291
291
|
isObjectLike: () => isObjectLike,
|
|
292
292
|
isString: () => isString,
|
|
293
293
|
isUndefined: () => isUndefined,
|
|
@@ -297,7 +297,7 @@ var require_types = __commonJS({
|
|
|
297
297
|
var import_globals = require_cjs();
|
|
298
298
|
var import_tags = require_cjs2();
|
|
299
299
|
var isValidHtmlTag = (arg) => import_tags.HTML_TAGS.body.indexOf(arg);
|
|
300
|
-
var
|
|
300
|
+
var isObject2 = (arg) => {
|
|
301
301
|
if (arg === null)
|
|
302
302
|
return false;
|
|
303
303
|
return typeof arg === "object" && arg.constructor === Object;
|
|
@@ -320,7 +320,7 @@ var require_types = __commonJS({
|
|
|
320
320
|
return typeof import_globals.window.HTMLElement === "object" ? obj instanceof import_globals.window.HTMLElement : obj && typeof obj === "object" && obj !== null && obj.nodeType === 1 && typeof obj.nodeName === "string";
|
|
321
321
|
};
|
|
322
322
|
var isDefined2 = (arg) => {
|
|
323
|
-
return
|
|
323
|
+
return isObject2(arg) || isObjectLike(arg) || isString(arg) || isNumber(arg) || isFunction(arg) || isArray(arg) || isObjectLike(arg) || isBoolean(arg) || isNull(arg);
|
|
324
324
|
};
|
|
325
325
|
var isUndefined = (arg) => {
|
|
326
326
|
return arg === void 0;
|
|
@@ -328,7 +328,7 @@ var require_types = __commonJS({
|
|
|
328
328
|
var TYPES = {
|
|
329
329
|
boolean: isBoolean,
|
|
330
330
|
array: isArray,
|
|
331
|
-
object:
|
|
331
|
+
object: isObject2,
|
|
332
332
|
string: isString,
|
|
333
333
|
number: isNumber,
|
|
334
334
|
null: isNull,
|
|
@@ -378,7 +378,7 @@ var require_object = __commonJS({
|
|
|
378
378
|
deepClone: () => deepClone2,
|
|
379
379
|
deepCloneExclude: () => deepCloneExclude,
|
|
380
380
|
deepDestringify: () => deepDestringify,
|
|
381
|
-
deepMerge: () =>
|
|
381
|
+
deepMerge: () => deepMerge2,
|
|
382
382
|
deepStringify: () => deepStringify,
|
|
383
383
|
detachFunctionsFromObject: () => detachFunctionsFromObject,
|
|
384
384
|
diff: () => diff,
|
|
@@ -423,7 +423,7 @@ var require_object = __commonJS({
|
|
|
423
423
|
}
|
|
424
424
|
return element;
|
|
425
425
|
};
|
|
426
|
-
var
|
|
426
|
+
var deepMerge2 = (element, extend) => {
|
|
427
427
|
for (const e in extend) {
|
|
428
428
|
const extendProp = extend[e];
|
|
429
429
|
if (e === "parent" || e === "props")
|
|
@@ -431,7 +431,7 @@ var require_object = __commonJS({
|
|
|
431
431
|
if (element[e] === void 0) {
|
|
432
432
|
element[e] = extendProp;
|
|
433
433
|
} else if ((0, import_types.isObjectLike)(element[e]) && (0, import_types.isObjectLike)(extendProp)) {
|
|
434
|
-
|
|
434
|
+
deepMerge2(element[e], extendProp);
|
|
435
435
|
} else {
|
|
436
436
|
element[e] = extendProp;
|
|
437
437
|
}
|
|
@@ -469,7 +469,7 @@ var require_object = __commonJS({
|
|
|
469
469
|
return o;
|
|
470
470
|
};
|
|
471
471
|
var mergeArrayExclude = (arr, excl = []) => {
|
|
472
|
-
return arr.reduce((acc, curr) =>
|
|
472
|
+
return arr.reduce((acc, curr) => deepMerge2(acc, deepCloneExclude(curr, excl)), {});
|
|
473
473
|
};
|
|
474
474
|
var deepClone2 = (obj) => {
|
|
475
475
|
if ((0, import_types.isArray)(obj)) {
|
|
@@ -642,11 +642,11 @@ var require_object = __commonJS({
|
|
|
642
642
|
};
|
|
643
643
|
var mergeIfExisted = (a, b) => {
|
|
644
644
|
if ((0, import_types.isObjectLike)(a) && (0, import_types.isObjectLike)(b))
|
|
645
|
-
return
|
|
645
|
+
return deepMerge2(a, b);
|
|
646
646
|
return a || b;
|
|
647
647
|
};
|
|
648
648
|
var mergeArray = (arr) => {
|
|
649
|
-
return arr.reduce((a, c) =>
|
|
649
|
+
return arr.reduce((a, c) => deepMerge2(a, deepClone2(c)), {});
|
|
650
650
|
};
|
|
651
651
|
var mergeAndCloneIfArray = (obj) => {
|
|
652
652
|
return (0, import_types.isArray)(obj) ? mergeArray(obj) : deepClone2(obj);
|
|
@@ -1084,13 +1084,12 @@ var activateConfig = (def) => {
|
|
|
1084
1084
|
return FACTORY[def || FACTORY.active];
|
|
1085
1085
|
};
|
|
1086
1086
|
var getActiveConfig = (def) => {
|
|
1087
|
-
if ((0, import_utils.isDefined)(def) && !FACTORY[def]) {
|
|
1088
|
-
FACTORY[def] = (0, import_utils.deepClone)(cachedConfig);
|
|
1089
|
-
return FACTORY[def];
|
|
1090
|
-
}
|
|
1091
1087
|
return FACTORY[def || FACTORY.active];
|
|
1092
1088
|
};
|
|
1093
|
-
var setActiveConfig = (
|
|
1094
|
-
|
|
1095
|
-
|
|
1089
|
+
var setActiveConfig = (newConfig) => {
|
|
1090
|
+
if (!(0, import_utils.isObject)(newConfig))
|
|
1091
|
+
return;
|
|
1092
|
+
FACTORY.active = "1";
|
|
1093
|
+
FACTORY["1"] = (0, import_utils.deepMerge)(newConfig, (0, import_utils.deepClone)(cachedConfig));
|
|
1094
|
+
return newConfig;
|
|
1096
1095
|
};
|
package/dist/cjs/index.js
CHANGED
|
@@ -287,7 +287,7 @@ var require_types = __commonJS({
|
|
|
287
287
|
isNot: () => isNot,
|
|
288
288
|
isNull: () => isNull,
|
|
289
289
|
isNumber: () => isNumber,
|
|
290
|
-
isObject: () =>
|
|
290
|
+
isObject: () => isObject7,
|
|
291
291
|
isObjectLike: () => isObjectLike3,
|
|
292
292
|
isString: () => isString8,
|
|
293
293
|
isUndefined: () => isUndefined,
|
|
@@ -297,7 +297,7 @@ var require_types = __commonJS({
|
|
|
297
297
|
var import_globals3 = require_cjs();
|
|
298
298
|
var import_tags = require_cjs2();
|
|
299
299
|
var isValidHtmlTag = (arg) => import_tags.HTML_TAGS.body.indexOf(arg);
|
|
300
|
-
var
|
|
300
|
+
var isObject7 = (arg) => {
|
|
301
301
|
if (arg === null)
|
|
302
302
|
return false;
|
|
303
303
|
return typeof arg === "object" && arg.constructor === Object;
|
|
@@ -320,7 +320,7 @@ var require_types = __commonJS({
|
|
|
320
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
321
|
};
|
|
322
322
|
var isDefined2 = (arg) => {
|
|
323
|
-
return
|
|
323
|
+
return isObject7(arg) || isObjectLike3(arg) || isString8(arg) || isNumber(arg) || isFunction2(arg) || isArray5(arg) || isObjectLike3(arg) || isBoolean(arg) || isNull(arg);
|
|
324
324
|
};
|
|
325
325
|
var isUndefined = (arg) => {
|
|
326
326
|
return arg === void 0;
|
|
@@ -328,7 +328,7 @@ var require_types = __commonJS({
|
|
|
328
328
|
var TYPES = {
|
|
329
329
|
boolean: isBoolean,
|
|
330
330
|
array: isArray5,
|
|
331
|
-
object:
|
|
331
|
+
object: isObject7,
|
|
332
332
|
string: isString8,
|
|
333
333
|
number: isNumber,
|
|
334
334
|
null: isNull,
|
|
@@ -378,7 +378,7 @@ var require_object = __commonJS({
|
|
|
378
378
|
deepClone: () => deepClone2,
|
|
379
379
|
deepCloneExclude: () => deepCloneExclude,
|
|
380
380
|
deepDestringify: () => deepDestringify,
|
|
381
|
-
deepMerge: () =>
|
|
381
|
+
deepMerge: () => deepMerge3,
|
|
382
382
|
deepStringify: () => deepStringify,
|
|
383
383
|
detachFunctionsFromObject: () => detachFunctionsFromObject,
|
|
384
384
|
diff: () => diff,
|
|
@@ -423,7 +423,7 @@ var require_object = __commonJS({
|
|
|
423
423
|
}
|
|
424
424
|
return element;
|
|
425
425
|
};
|
|
426
|
-
var
|
|
426
|
+
var deepMerge3 = (element, extend) => {
|
|
427
427
|
for (const e in extend) {
|
|
428
428
|
const extendProp = extend[e];
|
|
429
429
|
if (e === "parent" || e === "props")
|
|
@@ -431,7 +431,7 @@ var require_object = __commonJS({
|
|
|
431
431
|
if (element[e] === void 0) {
|
|
432
432
|
element[e] = extendProp;
|
|
433
433
|
} else if ((0, import_types.isObjectLike)(element[e]) && (0, import_types.isObjectLike)(extendProp)) {
|
|
434
|
-
|
|
434
|
+
deepMerge3(element[e], extendProp);
|
|
435
435
|
} else {
|
|
436
436
|
element[e] = extendProp;
|
|
437
437
|
}
|
|
@@ -469,7 +469,7 @@ var require_object = __commonJS({
|
|
|
469
469
|
return o;
|
|
470
470
|
};
|
|
471
471
|
var mergeArrayExclude = (arr, excl = []) => {
|
|
472
|
-
return arr.reduce((acc, curr) =>
|
|
472
|
+
return arr.reduce((acc, curr) => deepMerge3(acc, deepCloneExclude(curr, excl)), {});
|
|
473
473
|
};
|
|
474
474
|
var deepClone2 = (obj) => {
|
|
475
475
|
if ((0, import_types.isArray)(obj)) {
|
|
@@ -642,11 +642,11 @@ var require_object = __commonJS({
|
|
|
642
642
|
};
|
|
643
643
|
var mergeIfExisted = (a, b) => {
|
|
644
644
|
if ((0, import_types.isObjectLike)(a) && (0, import_types.isObjectLike)(b))
|
|
645
|
-
return
|
|
645
|
+
return deepMerge3(a, b);
|
|
646
646
|
return a || b;
|
|
647
647
|
};
|
|
648
648
|
var mergeArray = (arr) => {
|
|
649
|
-
return arr.reduce((a, c) =>
|
|
649
|
+
return arr.reduce((a, c) => deepMerge3(a, deepClone2(c)), {});
|
|
650
650
|
};
|
|
651
651
|
var mergeAndCloneIfArray = (obj) => {
|
|
652
652
|
return (0, import_types.isArray)(obj) ? mergeArray(obj) : deepClone2(obj);
|
|
@@ -1430,15 +1430,14 @@ var activateConfig = (def) => {
|
|
|
1430
1430
|
return FACTORY[def || FACTORY.active];
|
|
1431
1431
|
};
|
|
1432
1432
|
var getActiveConfig = (def) => {
|
|
1433
|
-
if ((0, import_utils3.isDefined)(def) && !FACTORY[def]) {
|
|
1434
|
-
FACTORY[def] = (0, import_utils3.deepClone)(cachedConfig);
|
|
1435
|
-
return FACTORY[def];
|
|
1436
|
-
}
|
|
1437
1433
|
return FACTORY[def || FACTORY.active];
|
|
1438
1434
|
};
|
|
1439
|
-
var setActiveConfig = (
|
|
1440
|
-
|
|
1441
|
-
|
|
1435
|
+
var setActiveConfig = (newConfig) => {
|
|
1436
|
+
if (!(0, import_utils3.isObject)(newConfig))
|
|
1437
|
+
return;
|
|
1438
|
+
FACTORY.active = "1";
|
|
1439
|
+
FACTORY["1"] = (0, import_utils3.deepMerge)(newConfig, (0, import_utils3.deepClone)(cachedConfig));
|
|
1440
|
+
return newConfig;
|
|
1442
1441
|
};
|
|
1443
1442
|
|
|
1444
1443
|
// src/utils/sequence.js
|
|
@@ -1653,11 +1652,15 @@ var applySequenceVars = (props, mediaName, options = {}) => {
|
|
|
1653
1652
|
// src/utils/sprite.js
|
|
1654
1653
|
var import_utils7 = __toESM(require_cjs3(), 1);
|
|
1655
1654
|
var generateSprite = (icons) => {
|
|
1656
|
-
|
|
1655
|
+
const CONFIG2 = getActiveConfig();
|
|
1656
|
+
let sprite = "";
|
|
1657
1657
|
for (const key in icons) {
|
|
1658
|
+
if (CONFIG2.__svg_cache[key])
|
|
1659
|
+
continue;
|
|
1660
|
+
else
|
|
1661
|
+
CONFIG2.__svg_cache[key] = true;
|
|
1658
1662
|
sprite += icons[key];
|
|
1659
1663
|
}
|
|
1660
|
-
sprite += "</svg>";
|
|
1661
1664
|
return sprite;
|
|
1662
1665
|
};
|
|
1663
1666
|
var parseRootAttributes = (htmlString) => {
|
|
@@ -1685,8 +1688,8 @@ var convertSvgToSymbol = (key, code) => {
|
|
|
1685
1688
|
"<svg",
|
|
1686
1689
|
`<symbol id="${key}" xmlns="${xmlns}" viewBox="${viewBox}"`
|
|
1687
1690
|
);
|
|
1688
|
-
symbol = symbol.replace(/width="[^"]
|
|
1689
|
-
symbol = symbol.replace(/height="[^"]
|
|
1691
|
+
symbol = symbol.replace(/width="[^"]*"/, "");
|
|
1692
|
+
symbol = symbol.replace(/height="[^"]*"/, "");
|
|
1690
1693
|
symbol = symbol.replace("</svg", "</symbol");
|
|
1691
1694
|
return symbol;
|
|
1692
1695
|
};
|
|
@@ -2337,18 +2340,10 @@ var setSVG = (val, key) => {
|
|
|
2337
2340
|
};
|
|
2338
2341
|
var appendSVGSprite = (LIBRARY, options = DEF_OPTIONS) => {
|
|
2339
2342
|
const CONFIG2 = getActiveConfig();
|
|
2340
|
-
const doc = options.document || import_globals2.document;
|
|
2341
2343
|
const lib = Object.keys(LIBRARY).length ? {} : CONFIG2.SVG;
|
|
2342
2344
|
for (const key in LIBRARY)
|
|
2343
2345
|
lib[key] = CONFIG2.SVG[key];
|
|
2344
|
-
|
|
2345
|
-
if (!doc) {
|
|
2346
|
-
console.warn("To append SVG sprites it should be run in browser environment");
|
|
2347
|
-
return SVGsprite;
|
|
2348
|
-
}
|
|
2349
|
-
const svgSpriteDOM = doc.createElement("template");
|
|
2350
|
-
svgSpriteDOM.innerHTML = SVGsprite;
|
|
2351
|
-
doc.body.appendChild(svgSpriteDOM.content);
|
|
2346
|
+
appendSVG(lib, options);
|
|
2352
2347
|
};
|
|
2353
2348
|
var setIcon = (val, key) => {
|
|
2354
2349
|
const CONFIG2 = getActiveConfig();
|
|
@@ -2359,18 +2354,42 @@ var setIcon = (val, key) => {
|
|
|
2359
2354
|
};
|
|
2360
2355
|
var appendIconsSprite = (LIBRARY, options = DEF_OPTIONS) => {
|
|
2361
2356
|
const CONFIG2 = getActiveConfig();
|
|
2362
|
-
const doc = options.document || import_globals2.document;
|
|
2363
2357
|
const lib = Object.keys(LIBRARY).length ? {} : CONFIG2.ICONS;
|
|
2364
2358
|
for (const key in LIBRARY)
|
|
2365
2359
|
lib[key] = CONFIG2.ICONS[key];
|
|
2366
|
-
|
|
2360
|
+
appendSVG(lib, options);
|
|
2361
|
+
};
|
|
2362
|
+
var createSVGSpriteElement = (options = { isRoot: true }) => {
|
|
2363
|
+
const svgElem = import_globals2.document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
2364
|
+
if (options.isRoot) {
|
|
2365
|
+
svgElem.setAttribute("aria-hidden", "true");
|
|
2366
|
+
svgElem.setAttribute("width", "0");
|
|
2367
|
+
svgElem.setAttribute("height", "0");
|
|
2368
|
+
svgElem.setAttribute("style", "position:absolute");
|
|
2369
|
+
svgElem.setAttribute("id", "svgSprite");
|
|
2370
|
+
}
|
|
2371
|
+
return svgElem;
|
|
2372
|
+
};
|
|
2373
|
+
var appendSVG = (lib, options = DEF_OPTIONS) => {
|
|
2374
|
+
const CONFIG2 = getActiveConfig();
|
|
2375
|
+
const doc = options.document || import_globals2.document;
|
|
2367
2376
|
if (!doc) {
|
|
2368
|
-
|
|
2369
|
-
|
|
2377
|
+
if (CONFIG2.verbose) {
|
|
2378
|
+
console.warn("To append SVG sprites it should be run in browser environment");
|
|
2379
|
+
}
|
|
2380
|
+
return generateSprite(lib);
|
|
2381
|
+
}
|
|
2382
|
+
const exists = doc.querySelector("#svgSprite");
|
|
2383
|
+
const SVGsprite = generateSprite(lib);
|
|
2384
|
+
if (exists) {
|
|
2385
|
+
const tempSVG = createSVGSpriteElement({ isRoot: false });
|
|
2386
|
+
tempSVG.innerHTML = SVGsprite;
|
|
2387
|
+
exists.append(...tempSVG.children);
|
|
2388
|
+
} else {
|
|
2389
|
+
const svgSpriteDOM = createSVGSpriteElement();
|
|
2390
|
+
svgSpriteDOM.innerHTML = SVGsprite;
|
|
2391
|
+
doc.body.prepend(svgSpriteDOM);
|
|
2370
2392
|
}
|
|
2371
|
-
const iconsSpriteDOM = doc.createElement("template");
|
|
2372
|
-
iconsSpriteDOM.innerHTML = SVGsprite;
|
|
2373
|
-
doc.body.appendChild(iconsSpriteDOM.content);
|
|
2374
2393
|
};
|
|
2375
2394
|
|
|
2376
2395
|
// src/system/reset.js
|
|
@@ -2383,7 +2402,7 @@ var applyReset = (reset = {}) => {
|
|
|
2383
2402
|
const configReset = RESET2;
|
|
2384
2403
|
const configTemplates = TYPOGRAPHY2.templates;
|
|
2385
2404
|
configReset.body = {
|
|
2386
|
-
...getMediaTheme("document", `@${CONFIG2.globalTheme}`),
|
|
2405
|
+
...CONFIG2.useDocumentTheme ? getMediaTheme("document", `@${CONFIG2.globalTheme}`) : {},
|
|
2387
2406
|
...configTemplates.body
|
|
2388
2407
|
};
|
|
2389
2408
|
configReset.h1 = configTemplates.h1;
|
|
@@ -2594,8 +2613,7 @@ var set = (recivedConfig, options = SET_OPTIONS) => {
|
|
|
2594
2613
|
...config
|
|
2595
2614
|
} = recivedConfig;
|
|
2596
2615
|
if (options.newConfig) {
|
|
2597
|
-
|
|
2598
|
-
CONFIG2 = getActiveConfig(options.newConfig);
|
|
2616
|
+
CONFIG2 = setActiveConfig(options.newConfig);
|
|
2599
2617
|
}
|
|
2600
2618
|
if (verbose !== void 0)
|
|
2601
2619
|
CONFIG2.verbose = verbose;
|
|
@@ -2615,6 +2633,8 @@ var set = (recivedConfig, options = SET_OPTIONS) => {
|
|
|
2615
2633
|
CONFIG2.globalTheme = globalTheme;
|
|
2616
2634
|
if (CONFIG2.verbose)
|
|
2617
2635
|
console.log(CONFIG2);
|
|
2636
|
+
if (!CONFIG2.__svg_cache)
|
|
2637
|
+
CONFIG2.__svg_cache = {};
|
|
2618
2638
|
const keys = Object.keys(config);
|
|
2619
2639
|
keys.map((key) => setEach(key, config[key]));
|
|
2620
2640
|
applyTypographySequence();
|
package/dist/cjs/set.js
CHANGED
|
@@ -287,7 +287,7 @@ var require_types = __commonJS({
|
|
|
287
287
|
isNot: () => isNot,
|
|
288
288
|
isNull: () => isNull,
|
|
289
289
|
isNumber: () => isNumber,
|
|
290
|
-
isObject: () =>
|
|
290
|
+
isObject: () => isObject7,
|
|
291
291
|
isObjectLike: () => isObjectLike3,
|
|
292
292
|
isString: () => isString7,
|
|
293
293
|
isUndefined: () => isUndefined,
|
|
@@ -297,7 +297,7 @@ var require_types = __commonJS({
|
|
|
297
297
|
var import_globals3 = require_cjs();
|
|
298
298
|
var import_tags = require_cjs2();
|
|
299
299
|
var isValidHtmlTag = (arg) => import_tags.HTML_TAGS.body.indexOf(arg);
|
|
300
|
-
var
|
|
300
|
+
var isObject7 = (arg) => {
|
|
301
301
|
if (arg === null)
|
|
302
302
|
return false;
|
|
303
303
|
return typeof arg === "object" && arg.constructor === Object;
|
|
@@ -320,7 +320,7 @@ var require_types = __commonJS({
|
|
|
320
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
321
|
};
|
|
322
322
|
var isDefined2 = (arg) => {
|
|
323
|
-
return
|
|
323
|
+
return isObject7(arg) || isObjectLike3(arg) || isString7(arg) || isNumber(arg) || isFunction2(arg) || isArray5(arg) || isObjectLike3(arg) || isBoolean(arg) || isNull(arg);
|
|
324
324
|
};
|
|
325
325
|
var isUndefined = (arg) => {
|
|
326
326
|
return arg === void 0;
|
|
@@ -328,7 +328,7 @@ var require_types = __commonJS({
|
|
|
328
328
|
var TYPES = {
|
|
329
329
|
boolean: isBoolean,
|
|
330
330
|
array: isArray5,
|
|
331
|
-
object:
|
|
331
|
+
object: isObject7,
|
|
332
332
|
string: isString7,
|
|
333
333
|
number: isNumber,
|
|
334
334
|
null: isNull,
|
|
@@ -378,7 +378,7 @@ var require_object = __commonJS({
|
|
|
378
378
|
deepClone: () => deepClone2,
|
|
379
379
|
deepCloneExclude: () => deepCloneExclude,
|
|
380
380
|
deepDestringify: () => deepDestringify,
|
|
381
|
-
deepMerge: () =>
|
|
381
|
+
deepMerge: () => deepMerge3,
|
|
382
382
|
deepStringify: () => deepStringify,
|
|
383
383
|
detachFunctionsFromObject: () => detachFunctionsFromObject,
|
|
384
384
|
diff: () => diff,
|
|
@@ -423,7 +423,7 @@ var require_object = __commonJS({
|
|
|
423
423
|
}
|
|
424
424
|
return element;
|
|
425
425
|
};
|
|
426
|
-
var
|
|
426
|
+
var deepMerge3 = (element, extend) => {
|
|
427
427
|
for (const e in extend) {
|
|
428
428
|
const extendProp = extend[e];
|
|
429
429
|
if (e === "parent" || e === "props")
|
|
@@ -431,7 +431,7 @@ var require_object = __commonJS({
|
|
|
431
431
|
if (element[e] === void 0) {
|
|
432
432
|
element[e] = extendProp;
|
|
433
433
|
} else if ((0, import_types.isObjectLike)(element[e]) && (0, import_types.isObjectLike)(extendProp)) {
|
|
434
|
-
|
|
434
|
+
deepMerge3(element[e], extendProp);
|
|
435
435
|
} else {
|
|
436
436
|
element[e] = extendProp;
|
|
437
437
|
}
|
|
@@ -469,7 +469,7 @@ var require_object = __commonJS({
|
|
|
469
469
|
return o;
|
|
470
470
|
};
|
|
471
471
|
var mergeArrayExclude = (arr, excl = []) => {
|
|
472
|
-
return arr.reduce((acc, curr) =>
|
|
472
|
+
return arr.reduce((acc, curr) => deepMerge3(acc, deepCloneExclude(curr, excl)), {});
|
|
473
473
|
};
|
|
474
474
|
var deepClone2 = (obj) => {
|
|
475
475
|
if ((0, import_types.isArray)(obj)) {
|
|
@@ -642,11 +642,11 @@ var require_object = __commonJS({
|
|
|
642
642
|
};
|
|
643
643
|
var mergeIfExisted = (a, b) => {
|
|
644
644
|
if ((0, import_types.isObjectLike)(a) && (0, import_types.isObjectLike)(b))
|
|
645
|
-
return
|
|
645
|
+
return deepMerge3(a, b);
|
|
646
646
|
return a || b;
|
|
647
647
|
};
|
|
648
648
|
var mergeArray = (arr) => {
|
|
649
|
-
return arr.reduce((a, c) =>
|
|
649
|
+
return arr.reduce((a, c) => deepMerge3(a, deepClone2(c)), {});
|
|
650
650
|
};
|
|
651
651
|
var mergeAndCloneIfArray = (obj) => {
|
|
652
652
|
return (0, import_types.isArray)(obj) ? mergeArray(obj) : deepClone2(obj);
|
|
@@ -1078,12 +1078,15 @@ var FACTORY = {
|
|
|
1078
1078
|
0: CONFIG
|
|
1079
1079
|
};
|
|
1080
1080
|
var getActiveConfig = (def) => {
|
|
1081
|
-
if ((0, import_utils.isDefined)(def) && !FACTORY[def]) {
|
|
1082
|
-
FACTORY[def] = (0, import_utils.deepClone)(cachedConfig);
|
|
1083
|
-
return FACTORY[def];
|
|
1084
|
-
}
|
|
1085
1081
|
return FACTORY[def || FACTORY.active];
|
|
1086
1082
|
};
|
|
1083
|
+
var setActiveConfig = (newConfig) => {
|
|
1084
|
+
if (!(0, import_utils.isObject)(newConfig))
|
|
1085
|
+
return;
|
|
1086
|
+
FACTORY.active = "1";
|
|
1087
|
+
FACTORY["1"] = (0, import_utils.deepMerge)(newConfig, (0, import_utils.deepClone)(cachedConfig));
|
|
1088
|
+
return newConfig;
|
|
1089
|
+
};
|
|
1087
1090
|
|
|
1088
1091
|
// src/system/color.js
|
|
1089
1092
|
var import_utils8 = __toESM(require_cjs3(), 1);
|
|
@@ -1377,8 +1380,8 @@ var convertSvgToSymbol = (key, code) => {
|
|
|
1377
1380
|
"<svg",
|
|
1378
1381
|
`<symbol id="${key}" xmlns="${xmlns}" viewBox="${viewBox}"`
|
|
1379
1382
|
);
|
|
1380
|
-
symbol = symbol.replace(/width="[^"]
|
|
1381
|
-
symbol = symbol.replace(/height="[^"]
|
|
1383
|
+
symbol = symbol.replace(/width="[^"]*"/, "");
|
|
1384
|
+
symbol = symbol.replace(/height="[^"]*"/, "");
|
|
1382
1385
|
symbol = symbol.replace("</svg", "</symbol");
|
|
1383
1386
|
return symbol;
|
|
1384
1387
|
};
|
|
@@ -1876,7 +1879,7 @@ var applyReset = (reset = {}) => {
|
|
|
1876
1879
|
const configReset = RESET2;
|
|
1877
1880
|
const configTemplates = TYPOGRAPHY2.templates;
|
|
1878
1881
|
configReset.body = {
|
|
1879
|
-
...getMediaTheme("document", `@${CONFIG2.globalTheme}`),
|
|
1882
|
+
...CONFIG2.useDocumentTheme ? getMediaTheme("document", `@${CONFIG2.globalTheme}`) : {},
|
|
1880
1883
|
...configTemplates.body
|
|
1881
1884
|
};
|
|
1882
1885
|
configReset.h1 = configTemplates.h1;
|
|
@@ -1986,8 +1989,7 @@ var set = (recivedConfig, options = SET_OPTIONS) => {
|
|
|
1986
1989
|
...config
|
|
1987
1990
|
} = recivedConfig;
|
|
1988
1991
|
if (options.newConfig) {
|
|
1989
|
-
|
|
1990
|
-
CONFIG2 = getActiveConfig(options.newConfig);
|
|
1992
|
+
CONFIG2 = setActiveConfig(options.newConfig);
|
|
1991
1993
|
}
|
|
1992
1994
|
if (verbose !== void 0)
|
|
1993
1995
|
CONFIG2.verbose = verbose;
|
|
@@ -2007,6 +2009,8 @@ var set = (recivedConfig, options = SET_OPTIONS) => {
|
|
|
2007
2009
|
CONFIG2.globalTheme = globalTheme;
|
|
2008
2010
|
if (CONFIG2.verbose)
|
|
2009
2011
|
console.log(CONFIG2);
|
|
2012
|
+
if (!CONFIG2.__svg_cache)
|
|
2013
|
+
CONFIG2.__svg_cache = {};
|
|
2010
2014
|
const keys = Object.keys(config);
|
|
2011
2015
|
keys.map((key) => setEach(key, config[key]));
|
|
2012
2016
|
applyTypographySequence();
|
package/dist/cjs/system/color.js
CHANGED
|
@@ -287,7 +287,7 @@ var require_types = __commonJS({
|
|
|
287
287
|
isNot: () => isNot,
|
|
288
288
|
isNull: () => isNull,
|
|
289
289
|
isNumber: () => isNumber,
|
|
290
|
-
isObject: () =>
|
|
290
|
+
isObject: () => isObject5,
|
|
291
291
|
isObjectLike: () => isObjectLike2,
|
|
292
292
|
isString: () => isString5,
|
|
293
293
|
isUndefined: () => isUndefined,
|
|
@@ -297,7 +297,7 @@ var require_types = __commonJS({
|
|
|
297
297
|
var import_globals2 = require_cjs();
|
|
298
298
|
var import_tags = require_cjs2();
|
|
299
299
|
var isValidHtmlTag = (arg) => import_tags.HTML_TAGS.body.indexOf(arg);
|
|
300
|
-
var
|
|
300
|
+
var isObject5 = (arg) => {
|
|
301
301
|
if (arg === null)
|
|
302
302
|
return false;
|
|
303
303
|
return typeof arg === "object" && arg.constructor === Object;
|
|
@@ -320,7 +320,7 @@ var require_types = __commonJS({
|
|
|
320
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
321
|
};
|
|
322
322
|
var isDefined2 = (arg) => {
|
|
323
|
-
return
|
|
323
|
+
return isObject5(arg) || isObjectLike2(arg) || isString5(arg) || isNumber(arg) || isFunction(arg) || isArray4(arg) || isObjectLike2(arg) || isBoolean(arg) || isNull(arg);
|
|
324
324
|
};
|
|
325
325
|
var isUndefined = (arg) => {
|
|
326
326
|
return arg === void 0;
|
|
@@ -328,7 +328,7 @@ var require_types = __commonJS({
|
|
|
328
328
|
var TYPES = {
|
|
329
329
|
boolean: isBoolean,
|
|
330
330
|
array: isArray4,
|
|
331
|
-
object:
|
|
331
|
+
object: isObject5,
|
|
332
332
|
string: isString5,
|
|
333
333
|
number: isNumber,
|
|
334
334
|
null: isNull,
|
|
@@ -378,7 +378,7 @@ var require_object = __commonJS({
|
|
|
378
378
|
deepClone: () => deepClone2,
|
|
379
379
|
deepCloneExclude: () => deepCloneExclude,
|
|
380
380
|
deepDestringify: () => deepDestringify,
|
|
381
|
-
deepMerge: () =>
|
|
381
|
+
deepMerge: () => deepMerge2,
|
|
382
382
|
deepStringify: () => deepStringify,
|
|
383
383
|
detachFunctionsFromObject: () => detachFunctionsFromObject,
|
|
384
384
|
diff: () => diff,
|
|
@@ -423,7 +423,7 @@ var require_object = __commonJS({
|
|
|
423
423
|
}
|
|
424
424
|
return element;
|
|
425
425
|
};
|
|
426
|
-
var
|
|
426
|
+
var deepMerge2 = (element, extend) => {
|
|
427
427
|
for (const e in extend) {
|
|
428
428
|
const extendProp = extend[e];
|
|
429
429
|
if (e === "parent" || e === "props")
|
|
@@ -431,7 +431,7 @@ var require_object = __commonJS({
|
|
|
431
431
|
if (element[e] === void 0) {
|
|
432
432
|
element[e] = extendProp;
|
|
433
433
|
} else if ((0, import_types.isObjectLike)(element[e]) && (0, import_types.isObjectLike)(extendProp)) {
|
|
434
|
-
|
|
434
|
+
deepMerge2(element[e], extendProp);
|
|
435
435
|
} else {
|
|
436
436
|
element[e] = extendProp;
|
|
437
437
|
}
|
|
@@ -469,7 +469,7 @@ var require_object = __commonJS({
|
|
|
469
469
|
return o;
|
|
470
470
|
};
|
|
471
471
|
var mergeArrayExclude = (arr, excl = []) => {
|
|
472
|
-
return arr.reduce((acc, curr) =>
|
|
472
|
+
return arr.reduce((acc, curr) => deepMerge2(acc, deepCloneExclude(curr, excl)), {});
|
|
473
473
|
};
|
|
474
474
|
var deepClone2 = (obj) => {
|
|
475
475
|
if ((0, import_types.isArray)(obj)) {
|
|
@@ -642,11 +642,11 @@ var require_object = __commonJS({
|
|
|
642
642
|
};
|
|
643
643
|
var mergeIfExisted = (a, b) => {
|
|
644
644
|
if ((0, import_types.isObjectLike)(a) && (0, import_types.isObjectLike)(b))
|
|
645
|
-
return
|
|
645
|
+
return deepMerge2(a, b);
|
|
646
646
|
return a || b;
|
|
647
647
|
};
|
|
648
648
|
var mergeArray = (arr) => {
|
|
649
|
-
return arr.reduce((a, c) =>
|
|
649
|
+
return arr.reduce((a, c) => deepMerge2(a, deepClone2(c)), {});
|
|
650
650
|
};
|
|
651
651
|
var mergeAndCloneIfArray = (obj) => {
|
|
652
652
|
return (0, import_types.isArray)(obj) ? mergeArray(obj) : deepClone2(obj);
|
|
@@ -1078,10 +1078,6 @@ var FACTORY = {
|
|
|
1078
1078
|
0: CONFIG
|
|
1079
1079
|
};
|
|
1080
1080
|
var getActiveConfig = (def) => {
|
|
1081
|
-
if ((0, import_utils.isDefined)(def) && !FACTORY[def]) {
|
|
1082
|
-
FACTORY[def] = (0, import_utils.deepClone)(cachedConfig);
|
|
1083
|
-
return FACTORY[def];
|
|
1084
|
-
}
|
|
1085
1081
|
return FACTORY[def || FACTORY.active];
|
|
1086
1082
|
};
|
|
1087
1083
|
|
|
@@ -287,7 +287,7 @@ var require_types = __commonJS({
|
|
|
287
287
|
isNot: () => isNot,
|
|
288
288
|
isNull: () => isNull,
|
|
289
289
|
isNumber: () => isNumber,
|
|
290
|
-
isObject: () =>
|
|
290
|
+
isObject: () => isObject4,
|
|
291
291
|
isObjectLike: () => isObjectLike2,
|
|
292
292
|
isString: () => isString4,
|
|
293
293
|
isUndefined: () => isUndefined,
|
|
@@ -297,7 +297,7 @@ var require_types = __commonJS({
|
|
|
297
297
|
var import_globals2 = require_cjs();
|
|
298
298
|
var import_tags = require_cjs2();
|
|
299
299
|
var isValidHtmlTag = (arg) => import_tags.HTML_TAGS.body.indexOf(arg);
|
|
300
|
-
var
|
|
300
|
+
var isObject4 = (arg) => {
|
|
301
301
|
if (arg === null)
|
|
302
302
|
return false;
|
|
303
303
|
return typeof arg === "object" && arg.constructor === Object;
|
|
@@ -320,7 +320,7 @@ var require_types = __commonJS({
|
|
|
320
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
321
|
};
|
|
322
322
|
var isDefined2 = (arg) => {
|
|
323
|
-
return
|
|
323
|
+
return isObject4(arg) || isObjectLike2(arg) || isString4(arg) || isNumber(arg) || isFunction(arg) || isArray3(arg) || isObjectLike2(arg) || isBoolean(arg) || isNull(arg);
|
|
324
324
|
};
|
|
325
325
|
var isUndefined = (arg) => {
|
|
326
326
|
return arg === void 0;
|
|
@@ -328,7 +328,7 @@ var require_types = __commonJS({
|
|
|
328
328
|
var TYPES = {
|
|
329
329
|
boolean: isBoolean,
|
|
330
330
|
array: isArray3,
|
|
331
|
-
object:
|
|
331
|
+
object: isObject4,
|
|
332
332
|
string: isString4,
|
|
333
333
|
number: isNumber,
|
|
334
334
|
null: isNull,
|
|
@@ -378,7 +378,7 @@ var require_object = __commonJS({
|
|
|
378
378
|
deepClone: () => deepClone2,
|
|
379
379
|
deepCloneExclude: () => deepCloneExclude,
|
|
380
380
|
deepDestringify: () => deepDestringify,
|
|
381
|
-
deepMerge: () =>
|
|
381
|
+
deepMerge: () => deepMerge2,
|
|
382
382
|
deepStringify: () => deepStringify,
|
|
383
383
|
detachFunctionsFromObject: () => detachFunctionsFromObject,
|
|
384
384
|
diff: () => diff,
|
|
@@ -423,7 +423,7 @@ var require_object = __commonJS({
|
|
|
423
423
|
}
|
|
424
424
|
return element;
|
|
425
425
|
};
|
|
426
|
-
var
|
|
426
|
+
var deepMerge2 = (element, extend) => {
|
|
427
427
|
for (const e in extend) {
|
|
428
428
|
const extendProp = extend[e];
|
|
429
429
|
if (e === "parent" || e === "props")
|
|
@@ -431,7 +431,7 @@ var require_object = __commonJS({
|
|
|
431
431
|
if (element[e] === void 0) {
|
|
432
432
|
element[e] = extendProp;
|
|
433
433
|
} else if ((0, import_types.isObjectLike)(element[e]) && (0, import_types.isObjectLike)(extendProp)) {
|
|
434
|
-
|
|
434
|
+
deepMerge2(element[e], extendProp);
|
|
435
435
|
} else {
|
|
436
436
|
element[e] = extendProp;
|
|
437
437
|
}
|
|
@@ -469,7 +469,7 @@ var require_object = __commonJS({
|
|
|
469
469
|
return o;
|
|
470
470
|
};
|
|
471
471
|
var mergeArrayExclude = (arr, excl = []) => {
|
|
472
|
-
return arr.reduce((acc, curr) =>
|
|
472
|
+
return arr.reduce((acc, curr) => deepMerge2(acc, deepCloneExclude(curr, excl)), {});
|
|
473
473
|
};
|
|
474
474
|
var deepClone2 = (obj) => {
|
|
475
475
|
if ((0, import_types.isArray)(obj)) {
|
|
@@ -642,11 +642,11 @@ var require_object = __commonJS({
|
|
|
642
642
|
};
|
|
643
643
|
var mergeIfExisted = (a, b) => {
|
|
644
644
|
if ((0, import_types.isObjectLike)(a) && (0, import_types.isObjectLike)(b))
|
|
645
|
-
return
|
|
645
|
+
return deepMerge2(a, b);
|
|
646
646
|
return a || b;
|
|
647
647
|
};
|
|
648
648
|
var mergeArray = (arr) => {
|
|
649
|
-
return arr.reduce((a, c) =>
|
|
649
|
+
return arr.reduce((a, c) => deepMerge2(a, deepClone2(c)), {});
|
|
650
650
|
};
|
|
651
651
|
var mergeAndCloneIfArray = (obj) => {
|
|
652
652
|
return (0, import_types.isArray)(obj) ? mergeArray(obj) : deepClone2(obj);
|
|
@@ -1076,10 +1076,6 @@ var FACTORY = {
|
|
|
1076
1076
|
0: CONFIG
|
|
1077
1077
|
};
|
|
1078
1078
|
var getActiveConfig = (def) => {
|
|
1079
|
-
if ((0, import_utils.isDefined)(def) && !FACTORY[def]) {
|
|
1080
|
-
FACTORY[def] = (0, import_utils.deepClone)(cachedConfig);
|
|
1081
|
-
return FACTORY[def];
|
|
1082
|
-
}
|
|
1083
1079
|
return FACTORY[def || FACTORY.active];
|
|
1084
1080
|
};
|
|
1085
1081
|
|