@symbo.ls/scratch 3.6.8 → 3.7.0
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 +2 -2
- package/dist/cjs/defaultConfig/cases.js +2 -2
- package/dist/cjs/defaultConfig/color.js +4 -4
- package/dist/cjs/defaultConfig/document.js +2 -2
- package/dist/cjs/defaultConfig/font-family.js +6 -6
- package/dist/cjs/defaultConfig/font.js +2 -2
- package/dist/cjs/defaultConfig/grid.js +2 -2
- package/dist/cjs/defaultConfig/icons.js +4 -4
- package/dist/cjs/defaultConfig/index.js +2 -2
- package/dist/cjs/defaultConfig/media.js +2 -2
- package/dist/cjs/defaultConfig/responsive.js +4 -4
- package/dist/cjs/defaultConfig/sequence.js +2 -2
- package/dist/cjs/defaultConfig/shadow.js +2 -7
- package/dist/cjs/defaultConfig/spacing.js +4 -4
- package/dist/cjs/defaultConfig/svg.js +4 -4
- package/dist/cjs/defaultConfig/templates.js +2 -2
- package/dist/cjs/defaultConfig/theme.js +2 -2
- package/dist/cjs/defaultConfig/timing.js +3 -3
- package/dist/cjs/defaultConfig/typography.js +3 -3
- package/dist/cjs/defaultConfig/unit.js +2 -2
- package/dist/cjs/factory.js +6 -0
- package/dist/cjs/set.js +8 -4
- package/dist/cjs/system/color.js +4 -4
- package/dist/cjs/system/document.js +1 -1
- package/dist/cjs/system/font.js +2 -2
- package/dist/cjs/system/reset.js +2 -2
- package/dist/cjs/system/shadow.js +2 -2
- package/dist/cjs/system/spacing.js +3 -3
- package/dist/cjs/system/svg.js +5 -5
- package/dist/cjs/system/theme.js +4 -4
- package/dist/cjs/system/timing.js +3 -3
- package/dist/cjs/system/typography.js +3 -3
- package/dist/cjs/transforms/index.js +1 -1
- package/dist/cjs/utils/sequence.js +1 -1
- package/dist/cjs/utils/var.js +3 -3
- package/dist/esm/defaultConfig/animation.js +2 -2
- package/dist/esm/defaultConfig/cases.js +2 -2
- package/dist/esm/defaultConfig/color.js +4 -4
- package/dist/esm/defaultConfig/document.js +2 -2
- package/dist/esm/defaultConfig/font-family.js +6 -6
- package/dist/esm/defaultConfig/font.js +2 -2
- package/dist/esm/defaultConfig/grid.js +2 -2
- package/dist/esm/defaultConfig/icons.js +4 -4
- package/dist/esm/defaultConfig/index.js +2 -2
- package/dist/esm/defaultConfig/media.js +2 -2
- package/dist/esm/defaultConfig/responsive.js +4 -4
- package/dist/esm/defaultConfig/sequence.js +2 -2
- package/dist/esm/defaultConfig/shadow.js +2 -7
- package/dist/esm/defaultConfig/spacing.js +6 -6
- package/dist/esm/defaultConfig/svg.js +4 -4
- package/dist/esm/defaultConfig/templates.js +2 -2
- package/dist/esm/defaultConfig/theme.js +2 -2
- package/dist/esm/defaultConfig/timing.js +4 -4
- package/dist/esm/defaultConfig/typography.js +4 -4
- package/dist/esm/defaultConfig/unit.js +2 -2
- package/dist/esm/factory.js +6 -0
- package/dist/esm/set.js +8 -4
- package/dist/esm/system/color.js +4 -4
- package/dist/esm/system/document.js +1 -1
- package/dist/esm/system/font.js +2 -2
- package/dist/esm/system/reset.js +2 -2
- package/dist/esm/system/shadow.js +2 -2
- package/dist/esm/system/spacing.js +3 -3
- package/dist/esm/system/svg.js +5 -5
- package/dist/esm/system/theme.js +4 -4
- package/dist/esm/system/timing.js +3 -3
- package/dist/esm/system/typography.js +3 -3
- package/dist/esm/transforms/index.js +1 -1
- package/dist/esm/utils/sequence.js +1 -1
- package/dist/esm/utils/var.js +3 -3
- package/dist/iife/index.js +335 -325
- package/package.json +3 -3
- package/src/defaultConfig/animation.js +1 -1
- package/src/defaultConfig/cases.js +1 -1
- package/src/defaultConfig/color.js +2 -2
- package/src/defaultConfig/document.js +1 -1
- package/src/defaultConfig/font-family.js +3 -3
- package/src/defaultConfig/font.js +1 -1
- package/src/defaultConfig/grid.js +1 -1
- package/src/defaultConfig/icons.js +2 -2
- package/src/defaultConfig/index.js +1 -1
- package/src/defaultConfig/media.js +1 -1
- package/src/defaultConfig/responsive.js +2 -2
- package/src/defaultConfig/sequence.js +1 -1
- package/src/defaultConfig/shadow.js +1 -6
- package/src/defaultConfig/spacing.js +5 -5
- package/src/defaultConfig/svg.js +2 -2
- package/src/defaultConfig/templates.js +1 -1
- package/src/defaultConfig/theme.js +1 -1
- package/src/defaultConfig/timing.js +3 -3
- package/src/defaultConfig/typography.js +3 -3
- package/src/defaultConfig/unit.js +1 -1
- package/src/factory.js +10 -2
- package/src/set.js +8 -4
- package/src/system/color.js +4 -4
- package/src/system/document.js +1 -1
- package/src/system/font.js +2 -2
- package/src/system/reset.js +2 -2
- package/src/system/shadow.js +2 -2
- package/src/system/spacing.js +3 -3
- package/src/system/svg.js +5 -5
- package/src/system/theme.js +6 -4
- package/src/system/timing.js +3 -3
- package/src/system/typography.js +3 -3
- package/src/transforms/index.js +1 -1
- package/src/utils/sequence.js +1 -1
- package/src/utils/var.js +3 -3
package/dist/iife/index.js
CHANGED
|
@@ -445,41 +445,16 @@ var SmblsScratch = (() => {
|
|
|
445
445
|
// src/index.js
|
|
446
446
|
var index_exports = {};
|
|
447
447
|
__export(index_exports, {
|
|
448
|
-
ANIMATION: () => ANIMATION,
|
|
449
|
-
BREAKPOINTS: () => BREAKPOINTS,
|
|
450
|
-
CASES: () => CASES,
|
|
451
448
|
CLASS: () => CLASS,
|
|
452
|
-
COLOR: () => COLOR,
|
|
453
449
|
CONFIG: () => CONFIG,
|
|
454
450
|
CSS_MEDIA_VARS: () => CSS_MEDIA_VARS,
|
|
455
451
|
CSS_NATIVE_COLOR_REGEX: () => CSS_NATIVE_COLOR_REGEX,
|
|
456
452
|
CSS_UNITS: () => CSS_UNITS,
|
|
457
453
|
CSS_VARS: () => CSS_VARS,
|
|
458
|
-
DEVICES: () => DEVICES,
|
|
459
|
-
DOCUMENT: () => DOCUMENT,
|
|
460
454
|
FACTORY: () => FACTORY,
|
|
461
|
-
FONT: () => FONT,
|
|
462
|
-
FONT_FACE: () => FONT_FACE,
|
|
463
|
-
FONT_FAMILY: () => FONT_FAMILY,
|
|
464
|
-
FONT_FAMILY_TYPES: () => FONT_FAMILY_TYPES,
|
|
465
|
-
GRADIENT: () => GRADIENT,
|
|
466
|
-
GRID: () => GRID,
|
|
467
|
-
ICONS: () => ICONS,
|
|
468
|
-
MEDIA: () => MEDIA,
|
|
469
|
-
RESET: () => RESET,
|
|
470
|
-
SEMANTIC_ICONS: () => SEMANTIC_ICONS,
|
|
471
|
-
SEQUENCE: () => SEQUENCE,
|
|
472
|
-
SHADOW: () => SHADOW,
|
|
473
|
-
SPACING: () => SPACING,
|
|
474
|
-
SVG: () => SVG,
|
|
475
|
-
SVG_DATA: () => SVG_DATA,
|
|
476
|
-
TEMPLATES: () => TEMPLATES,
|
|
477
|
-
THEME: () => THEME,
|
|
478
|
-
TIMING: () => TIMING,
|
|
479
|
-
TYPOGRAPHY: () => TYPOGRAPHY,
|
|
480
|
-
UNIT: () => UNIT,
|
|
481
455
|
VALUE_TRANSFORMERS: () => VALUE_TRANSFORMERS,
|
|
482
456
|
activateConfig: () => activateConfig,
|
|
457
|
+
animation: () => animation,
|
|
483
458
|
appendSVGSprite: () => appendSVGSprite,
|
|
484
459
|
appendSvgIconsSprite: () => appendSvgIconsSprite,
|
|
485
460
|
applyDocument: () => applyDocument,
|
|
@@ -491,12 +466,21 @@ var SmblsScratch = (() => {
|
|
|
491
466
|
applySpacingSequence: () => applySpacingSequence,
|
|
492
467
|
applyTimingSequence: () => applyTimingSequence,
|
|
493
468
|
applyTypographySequence: () => applyTypographySequence,
|
|
469
|
+
breakpoints: () => breakpoints,
|
|
470
|
+
cases: () => cases,
|
|
494
471
|
changeLightness: () => changeLightness,
|
|
495
472
|
checkIfBoxSize: () => checkIfBoxSize,
|
|
473
|
+
color: () => color,
|
|
496
474
|
colorStringToRgbaArray: () => colorStringToRgbaArray,
|
|
497
475
|
convertSvgToSymbol: () => convertSvgToSymbol,
|
|
476
|
+
devices: () => devices,
|
|
477
|
+
document: () => document3,
|
|
498
478
|
findHeadingLetter: () => findHeadingLetter,
|
|
499
479
|
findHeadings: () => findHeadings,
|
|
480
|
+
font: () => font,
|
|
481
|
+
font_face: () => font_face,
|
|
482
|
+
font_family: () => font_family,
|
|
483
|
+
font_family_types: () => font_family_types,
|
|
500
484
|
generateSequence: () => generateSequence,
|
|
501
485
|
generateSequencePosition: () => generateSequencePosition,
|
|
502
486
|
generateSprite: () => generateSprite,
|
|
@@ -527,20 +511,25 @@ var SmblsScratch = (() => {
|
|
|
527
511
|
getTheme: () => getTheme,
|
|
528
512
|
getTimingByKey: () => getTimingByKey,
|
|
529
513
|
getTimingFunction: () => getTimingFunction,
|
|
514
|
+
gradient: () => gradient,
|
|
515
|
+
grid: () => grid,
|
|
530
516
|
hexToRgb: () => hexToRgb,
|
|
531
517
|
hexToRgbArray: () => hexToRgbArray,
|
|
532
518
|
hexToRgba: () => hexToRgba,
|
|
533
519
|
hslToRgb: () => hslToRgb,
|
|
520
|
+
icons: () => icons,
|
|
534
521
|
isCSSVar: () => isCSSVar,
|
|
535
522
|
isGoogleFontsUrl: () => isGoogleFontsUrl,
|
|
536
523
|
isResolvedColor: () => isResolvedColor,
|
|
537
524
|
isScalingUnit: () => isScalingUnit,
|
|
525
|
+
media: () => media,
|
|
538
526
|
mixTwoColors: () => mixTwoColors,
|
|
539
527
|
mixTwoRgb: () => mixTwoRgb,
|
|
540
528
|
mixTwoRgba: () => mixTwoRgba,
|
|
541
529
|
numToLetterMap: () => numToLetterMap,
|
|
542
530
|
opacify: () => opacify,
|
|
543
531
|
parseColorToken: () => parseColorToken,
|
|
532
|
+
reset: () => reset,
|
|
544
533
|
resolveColorsInGradient: () => resolveColorsInGradient,
|
|
545
534
|
resolveFileUrl: () => resolveFileUrl,
|
|
546
535
|
returnSubThemeOrDefault: () => returnSubThemeOrDefault,
|
|
@@ -550,6 +539,8 @@ var SmblsScratch = (() => {
|
|
|
550
539
|
runThroughMedia: () => runThroughMedia,
|
|
551
540
|
scratchSystem: () => system_exports,
|
|
552
541
|
scratchUtils: () => utils_exports,
|
|
542
|
+
semantic_icons: () => semantic_icons,
|
|
543
|
+
sequence: () => sequence,
|
|
553
544
|
set: () => set,
|
|
554
545
|
setActiveConfig: () => setActiveConfig,
|
|
555
546
|
setColor: () => setColor,
|
|
@@ -570,9 +561,16 @@ var SmblsScratch = (() => {
|
|
|
570
561
|
setTheme: () => setTheme,
|
|
571
562
|
setValue: () => setValue,
|
|
572
563
|
setVariables: () => setVariables,
|
|
564
|
+
shadow: () => shadow,
|
|
565
|
+
spacing: () => spacing,
|
|
573
566
|
splitSpacedValue: () => splitSpacedValue,
|
|
574
567
|
splitTopLevelCommas: () => splitTopLevelCommas,
|
|
575
568
|
splitTransition: () => splitTransition,
|
|
569
|
+
svg: () => svg,
|
|
570
|
+
svg_data: () => svg_data,
|
|
571
|
+
templates: () => templates,
|
|
572
|
+
theme: () => theme,
|
|
573
|
+
timing: () => timing,
|
|
576
574
|
transformBackgroundImage: () => transformBackgroundImage,
|
|
577
575
|
transformBorder: () => transformBorder,
|
|
578
576
|
transformBorderRadius: () => transformBorderRadius,
|
|
@@ -583,7 +581,9 @@ var SmblsScratch = (() => {
|
|
|
583
581
|
transformSizeRatio: () => transformSizeRatio,
|
|
584
582
|
transformTextStroke: () => transformTextStroke,
|
|
585
583
|
transformTransition: () => transformTransition,
|
|
586
|
-
transfromGap: () => transfromGap
|
|
584
|
+
transfromGap: () => transfromGap,
|
|
585
|
+
typography: () => typography,
|
|
586
|
+
unit: () => unit
|
|
587
587
|
});
|
|
588
588
|
|
|
589
589
|
// src/utils/index.js
|
|
@@ -647,8 +647,8 @@ var SmblsScratch = (() => {
|
|
|
647
647
|
});
|
|
648
648
|
|
|
649
649
|
// src/utils/unit.js
|
|
650
|
-
var isScalingUnit = (
|
|
651
|
-
return
|
|
650
|
+
var isScalingUnit = (unit2) => {
|
|
651
|
+
return unit2 === "em" || unit2 === "rem" || unit2 === "vw" || unit2 === "vh" || unit2 === "vmax" || unit2 === "vmin";
|
|
652
652
|
};
|
|
653
653
|
var CSS_UNITS = [
|
|
654
654
|
// Absolute
|
|
@@ -705,21 +705,21 @@ var SmblsScratch = (() => {
|
|
|
705
705
|
|
|
706
706
|
// src/utils/color.js
|
|
707
707
|
init_esm();
|
|
708
|
-
var colorStringToRgbaArray = (
|
|
709
|
-
if (
|
|
710
|
-
if (
|
|
711
|
-
if (
|
|
712
|
-
if (
|
|
713
|
-
|
|
708
|
+
var colorStringToRgbaArray = (color2) => {
|
|
709
|
+
if (color2 === "") return [0, 0, 0, 0];
|
|
710
|
+
if (color2.toLowerCase() === "transparent") return [0, 0, 0, 0];
|
|
711
|
+
if (color2[0] === "#") {
|
|
712
|
+
if (color2.length < 7) {
|
|
713
|
+
color2 = "#" + color2[1] + color2[1] + color2[2] + color2[2] + color2[3] + color2[3] + (color2.length > 4 ? color2[4] + color2[4] : "");
|
|
714
714
|
}
|
|
715
715
|
return [
|
|
716
|
-
parseInt(
|
|
717
|
-
parseInt(
|
|
718
|
-
parseInt(
|
|
719
|
-
|
|
716
|
+
parseInt(color2.substr(1, 2), 16),
|
|
717
|
+
parseInt(color2.substr(3, 2), 16),
|
|
718
|
+
parseInt(color2.substr(5, 2), 16),
|
|
719
|
+
color2.length > 7 ? parseInt(color2.substr(7, 2), 16) / 255 : 1
|
|
720
720
|
];
|
|
721
721
|
}
|
|
722
|
-
if (
|
|
722
|
+
if (color2.indexOf("rgb") === -1) {
|
|
723
723
|
if (document2 && window2) {
|
|
724
724
|
const elem = document2.body.appendChild(document2.createElement("fictum"));
|
|
725
725
|
const flag = "rgb(1, 2, 3)";
|
|
@@ -728,18 +728,18 @@ var SmblsScratch = (() => {
|
|
|
728
728
|
document2.body.removeChild(elem);
|
|
729
729
|
return;
|
|
730
730
|
}
|
|
731
|
-
elem.style.color =
|
|
731
|
+
elem.style.color = color2;
|
|
732
732
|
if (elem.style.color === flag || elem.style.color === "") {
|
|
733
733
|
document2.body.removeChild(elem);
|
|
734
734
|
return [0, 0, 0, 0];
|
|
735
735
|
}
|
|
736
|
-
|
|
736
|
+
color2 = window2.getComputedStyle(elem).color;
|
|
737
737
|
document2.body.removeChild(elem);
|
|
738
738
|
}
|
|
739
739
|
}
|
|
740
|
-
if (
|
|
741
|
-
if (
|
|
742
|
-
return
|
|
740
|
+
if (color2.indexOf("rgb") === 0) {
|
|
741
|
+
if (color2.indexOf("rgba") === -1) color2 = `${color2}, 1`;
|
|
742
|
+
return color2.match(/[\.\d]+/g).map((a) => +a);
|
|
743
743
|
}
|
|
744
744
|
return [0, 0, 0, 0];
|
|
745
745
|
};
|
|
@@ -807,10 +807,10 @@ var SmblsScratch = (() => {
|
|
|
807
807
|
}
|
|
808
808
|
return `rgba(${arr})`;
|
|
809
809
|
};
|
|
810
|
-
var opacify = (
|
|
811
|
-
const arr = colorStringToRgbaArray(
|
|
810
|
+
var opacify = (color2, opacity) => {
|
|
811
|
+
const arr = colorStringToRgbaArray(color2);
|
|
812
812
|
if (!arr) {
|
|
813
|
-
if (isNotProduction()) console.warn(
|
|
813
|
+
if (isNotProduction()) console.warn(color2 + " color is not rgba");
|
|
814
814
|
return;
|
|
815
815
|
}
|
|
816
816
|
arr[3] = opacity;
|
|
@@ -870,10 +870,10 @@ var SmblsScratch = (() => {
|
|
|
870
870
|
};
|
|
871
871
|
|
|
872
872
|
// src/utils/theme.js
|
|
873
|
-
var returnSubThemeOrDefault = (orig,
|
|
873
|
+
var returnSubThemeOrDefault = (orig, theme2) => {
|
|
874
874
|
if (!orig) return;
|
|
875
|
-
if (orig.themes && orig.themes[
|
|
876
|
-
if (orig[
|
|
875
|
+
if (orig.themes && orig.themes[theme2]) return orig.themes[theme2];
|
|
876
|
+
if (orig[theme2]) return [orig, orig[theme2]];
|
|
877
877
|
return orig;
|
|
878
878
|
};
|
|
879
879
|
|
|
@@ -973,37 +973,37 @@ var SmblsScratch = (() => {
|
|
|
973
973
|
// src/defaultConfig/index.js
|
|
974
974
|
var defaultConfig_exports = {};
|
|
975
975
|
__export(defaultConfig_exports, {
|
|
976
|
-
ANIMATION: () => ANIMATION,
|
|
977
|
-
BREAKPOINTS: () => BREAKPOINTS,
|
|
978
|
-
CASES: () => CASES,
|
|
979
976
|
CLASS: () => CLASS,
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
977
|
+
animation: () => animation,
|
|
978
|
+
breakpoints: () => breakpoints,
|
|
979
|
+
cases: () => cases,
|
|
980
|
+
color: () => color,
|
|
981
|
+
devices: () => devices,
|
|
982
|
+
document: () => document3,
|
|
983
|
+
font: () => font,
|
|
984
|
+
font_face: () => font_face,
|
|
985
|
+
font_family: () => font_family,
|
|
986
|
+
font_family_types: () => font_family_types,
|
|
987
|
+
gradient: () => gradient,
|
|
988
|
+
grid: () => grid,
|
|
989
|
+
icons: () => icons,
|
|
990
|
+
media: () => media,
|
|
991
|
+
reset: () => reset,
|
|
992
|
+
semantic_icons: () => semantic_icons,
|
|
993
|
+
sequence: () => sequence,
|
|
994
|
+
shadow: () => shadow,
|
|
995
|
+
spacing: () => spacing,
|
|
996
|
+
svg: () => svg,
|
|
997
|
+
svg_data: () => svg_data,
|
|
998
|
+
templates: () => templates,
|
|
999
|
+
theme: () => theme,
|
|
1000
|
+
timing: () => timing,
|
|
1001
|
+
typography: () => typography,
|
|
1002
|
+
unit: () => unit
|
|
1003
1003
|
});
|
|
1004
1004
|
|
|
1005
1005
|
// src/defaultConfig/sequence.js
|
|
1006
|
-
var
|
|
1006
|
+
var sequence = {
|
|
1007
1007
|
"minor-second": 1.067,
|
|
1008
1008
|
"major-second": 1.125,
|
|
1009
1009
|
"minor-third": 1.2,
|
|
@@ -1031,7 +1031,7 @@ var SmblsScratch = (() => {
|
|
|
1031
1031
|
};
|
|
1032
1032
|
|
|
1033
1033
|
// src/defaultConfig/unit.js
|
|
1034
|
-
var
|
|
1034
|
+
var unit = {
|
|
1035
1035
|
default: "em"
|
|
1036
1036
|
};
|
|
1037
1037
|
|
|
@@ -1040,7 +1040,7 @@ var SmblsScratch = (() => {
|
|
|
1040
1040
|
browserDefault: 16,
|
|
1041
1041
|
base: 16,
|
|
1042
1042
|
type: "font-size",
|
|
1043
|
-
ratio:
|
|
1043
|
+
ratio: sequence["minor-third"],
|
|
1044
1044
|
range: [-3, 12],
|
|
1045
1045
|
h1Matches: 6,
|
|
1046
1046
|
lineHeight: 1.5,
|
|
@@ -1052,22 +1052,22 @@ var SmblsScratch = (() => {
|
|
|
1052
1052
|
scales: {},
|
|
1053
1053
|
vars: {}
|
|
1054
1054
|
};
|
|
1055
|
-
var
|
|
1055
|
+
var typography = defaultProps;
|
|
1056
1056
|
|
|
1057
1057
|
// src/defaultConfig/font.js
|
|
1058
|
-
var
|
|
1058
|
+
var font = {};
|
|
1059
1059
|
|
|
1060
1060
|
// src/defaultConfig/font-family.js
|
|
1061
|
-
var
|
|
1062
|
-
var
|
|
1061
|
+
var font_family = {};
|
|
1062
|
+
var font_family_types = {
|
|
1063
1063
|
"sans-serif": "Helvetica, Arial, sans-serif, --system-default",
|
|
1064
1064
|
serif: "Times New Roman, Georgia, serif, --system-default",
|
|
1065
1065
|
monospace: "Courier New, monospace, --system-default"
|
|
1066
1066
|
};
|
|
1067
|
-
var
|
|
1067
|
+
var font_face = {};
|
|
1068
1068
|
|
|
1069
1069
|
// src/defaultConfig/media.js
|
|
1070
|
-
var
|
|
1070
|
+
var media = {
|
|
1071
1071
|
tv: "(min-width: 2780px)",
|
|
1072
1072
|
light: "(prefers-color-scheme: light)",
|
|
1073
1073
|
dark: "(prefers-color-scheme: dark)",
|
|
@@ -1076,9 +1076,9 @@ var SmblsScratch = (() => {
|
|
|
1076
1076
|
|
|
1077
1077
|
// src/defaultConfig/spacing.js
|
|
1078
1078
|
var defaultProps2 = {
|
|
1079
|
-
base:
|
|
1079
|
+
base: typography.base,
|
|
1080
1080
|
type: "spacing",
|
|
1081
|
-
ratio:
|
|
1081
|
+
ratio: sequence.phi,
|
|
1082
1082
|
range: [-5, 15],
|
|
1083
1083
|
subSequence: true,
|
|
1084
1084
|
mediaRegenerate: false,
|
|
@@ -1087,28 +1087,28 @@ var SmblsScratch = (() => {
|
|
|
1087
1087
|
scales: {},
|
|
1088
1088
|
vars: {}
|
|
1089
1089
|
};
|
|
1090
|
-
var
|
|
1090
|
+
var spacing = defaultProps2;
|
|
1091
1091
|
|
|
1092
1092
|
// src/defaultConfig/color.js
|
|
1093
|
-
var
|
|
1094
|
-
var
|
|
1093
|
+
var color = {};
|
|
1094
|
+
var gradient = {};
|
|
1095
1095
|
|
|
1096
1096
|
// src/defaultConfig/theme.js
|
|
1097
|
-
var
|
|
1097
|
+
var theme = {};
|
|
1098
1098
|
|
|
1099
1099
|
// src/defaultConfig/shadow.js
|
|
1100
|
-
var
|
|
1100
|
+
var shadow = {};
|
|
1101
1101
|
|
|
1102
1102
|
// src/defaultConfig/icons.js
|
|
1103
|
-
var
|
|
1104
|
-
var
|
|
1103
|
+
var icons = {};
|
|
1104
|
+
var semantic_icons = {};
|
|
1105
1105
|
|
|
1106
1106
|
// src/defaultConfig/timing.js
|
|
1107
1107
|
var defaultProps3 = {
|
|
1108
1108
|
default: 150,
|
|
1109
1109
|
base: 150,
|
|
1110
1110
|
type: "timing",
|
|
1111
|
-
ratio:
|
|
1111
|
+
ratio: sequence["perfect-fourth"],
|
|
1112
1112
|
range: [-3, 12],
|
|
1113
1113
|
mediaRegenerate: false,
|
|
1114
1114
|
unit: "ms",
|
|
@@ -1116,13 +1116,13 @@ var SmblsScratch = (() => {
|
|
|
1116
1116
|
scales: {},
|
|
1117
1117
|
vars: {}
|
|
1118
1118
|
};
|
|
1119
|
-
var
|
|
1119
|
+
var timing = defaultProps3;
|
|
1120
1120
|
|
|
1121
1121
|
// src/defaultConfig/document.js
|
|
1122
|
-
var
|
|
1122
|
+
var document3 = {};
|
|
1123
1123
|
|
|
1124
1124
|
// src/defaultConfig/responsive.js
|
|
1125
|
-
var
|
|
1125
|
+
var breakpoints = {
|
|
1126
1126
|
screenL: 1920,
|
|
1127
1127
|
screenM: 1680,
|
|
1128
1128
|
screenS: 1440,
|
|
@@ -1134,7 +1134,7 @@ var SmblsScratch = (() => {
|
|
|
1134
1134
|
mobileS: 480,
|
|
1135
1135
|
mobileXS: 375
|
|
1136
1136
|
};
|
|
1137
|
-
var
|
|
1137
|
+
var devices = {
|
|
1138
1138
|
screenXXL: [2560, 1440],
|
|
1139
1139
|
screenXL: [2240, 1260],
|
|
1140
1140
|
screenL: [1920, 1024],
|
|
@@ -1150,38 +1150,44 @@ var SmblsScratch = (() => {
|
|
|
1150
1150
|
};
|
|
1151
1151
|
|
|
1152
1152
|
// src/defaultConfig/cases.js
|
|
1153
|
-
var
|
|
1153
|
+
var cases = {};
|
|
1154
1154
|
|
|
1155
1155
|
// src/defaultConfig/animation.js
|
|
1156
|
-
var
|
|
1156
|
+
var animation = {};
|
|
1157
1157
|
|
|
1158
1158
|
// src/defaultConfig/svg.js
|
|
1159
|
-
var
|
|
1160
|
-
var
|
|
1159
|
+
var svg = {};
|
|
1160
|
+
var svg_data = {};
|
|
1161
1161
|
|
|
1162
1162
|
// src/defaultConfig/templates.js
|
|
1163
|
-
var
|
|
1163
|
+
var templates = {};
|
|
1164
1164
|
|
|
1165
1165
|
// src/defaultConfig/grid.js
|
|
1166
1166
|
var defaultProps4 = {};
|
|
1167
|
-
var
|
|
1167
|
+
var grid = defaultProps4;
|
|
1168
1168
|
|
|
1169
1169
|
// src/defaultConfig/class.js
|
|
1170
1170
|
var defaultProps5 = {};
|
|
1171
1171
|
var CLASS = defaultProps5;
|
|
1172
1172
|
|
|
1173
1173
|
// src/defaultConfig/index.js
|
|
1174
|
-
var
|
|
1174
|
+
var reset = {};
|
|
1175
1175
|
|
|
1176
1176
|
// src/factory.js
|
|
1177
1177
|
var CSS_VARS = {};
|
|
1178
1178
|
var CSS_MEDIA_VARS = {};
|
|
1179
1179
|
var _CONF = defaultConfig_exports;
|
|
1180
1180
|
var _confLower = {};
|
|
1181
|
+
var toCamel = (s) => s.replace(/_([a-z])/g, (_, c) => c.toUpperCase());
|
|
1182
|
+
var toUpper = (s) => s.replace(/([A-Z])/g, "_$1").toUpperCase();
|
|
1181
1183
|
for (const key in _CONF) {
|
|
1182
1184
|
const lower = key.toLowerCase();
|
|
1183
1185
|
_confLower[lower] = _CONF[key];
|
|
1186
|
+
const camel = toCamel(lower);
|
|
1187
|
+
if (camel !== lower) _confLower[camel] = _CONF[key];
|
|
1184
1188
|
if (lower !== key) _confLower[key] = _CONF[key];
|
|
1189
|
+
const upper = toUpper(key);
|
|
1190
|
+
if (upper !== key) _confLower[upper] = _CONF[key];
|
|
1185
1191
|
}
|
|
1186
1192
|
var CONFIG = {
|
|
1187
1193
|
verbose: false,
|
|
@@ -1263,8 +1269,8 @@ var SmblsScratch = (() => {
|
|
|
1263
1269
|
return [prefix, value];
|
|
1264
1270
|
};
|
|
1265
1271
|
var setScalingVar = (key, sequenceProps) => {
|
|
1266
|
-
const { base, type, unit } = sequenceProps;
|
|
1267
|
-
const defaultVal = (isScalingUnit(
|
|
1272
|
+
const { base, type, unit: unit2 } = sequenceProps;
|
|
1273
|
+
const defaultVal = (isScalingUnit(unit2) ? 1 : base) + unit2;
|
|
1268
1274
|
if (key === 0) return defaultVal;
|
|
1269
1275
|
const prefix = "--" + (type && type.replace(".", "-"));
|
|
1270
1276
|
const ratioVar = `${prefix}-ratio`;
|
|
@@ -1393,12 +1399,12 @@ var SmblsScratch = (() => {
|
|
|
1393
1399
|
};
|
|
1394
1400
|
var getSequenceValue = (value = "A", sequenceProps) => {
|
|
1395
1401
|
const CONFIG2 = getActiveConfig();
|
|
1396
|
-
const {
|
|
1402
|
+
const { unit: UNIT } = CONFIG2;
|
|
1397
1403
|
if (isString(value) && isCSSVar(value)) return `var(${value})`;
|
|
1398
|
-
const { sequence, unit =
|
|
1404
|
+
const { sequence: sequence2, unit: unit2 = UNIT.default, useVariable } = sequenceProps;
|
|
1399
1405
|
const startsWithDashOrLetterRegex = /^-?[a-zA-Z]/i;
|
|
1400
1406
|
const startsWithDashOrLetter = startsWithDashOrLetterRegex.test(value);
|
|
1401
|
-
const hasUnits = CSS_UNITS.some((
|
|
1407
|
+
const hasUnits = CSS_UNITS.some((unit3) => value.includes(unit3));
|
|
1402
1408
|
if (hasUnits || !startsWithDashOrLetter) return value;
|
|
1403
1409
|
const skipArr = [
|
|
1404
1410
|
"none",
|
|
@@ -1436,7 +1442,7 @@ var SmblsScratch = (() => {
|
|
|
1436
1442
|
const joint = `${varValue(first)} - ${varValue(second)}`;
|
|
1437
1443
|
return isNegative ? `calc((${joint}) * -1)` : `calc(${joint})`;
|
|
1438
1444
|
}
|
|
1439
|
-
if (!
|
|
1445
|
+
if (!sequence2[absValue] && absValue.length === 2) {
|
|
1440
1446
|
if (CONFIG2.verbose)
|
|
1441
1447
|
console.warn(
|
|
1442
1448
|
absValue,
|
|
@@ -1448,12 +1454,12 @@ var SmblsScratch = (() => {
|
|
|
1448
1454
|
const varValue2 = `var(${prefix}${absValue}${mediaName})`;
|
|
1449
1455
|
return isNegative ? `calc(${varValue2} * -1)` : varValue2;
|
|
1450
1456
|
}
|
|
1451
|
-
const sequenceItem =
|
|
1452
|
-
if (!sequenceItem) return console.warn("can't find",
|
|
1453
|
-
if (
|
|
1454
|
-
return isNegative + sequenceItem.val +
|
|
1457
|
+
const sequenceItem = sequence2 ? sequence2[absValue] : null;
|
|
1458
|
+
if (!sequenceItem) return console.warn("can't find", sequence2, absValue);
|
|
1459
|
+
if (unit2 === "ms" || unit2 === "s") {
|
|
1460
|
+
return isNegative + sequenceItem.val + unit2;
|
|
1455
1461
|
}
|
|
1456
|
-
return isNegative + sequenceItem.scaling +
|
|
1462
|
+
return isNegative + sequenceItem.scaling + unit2;
|
|
1457
1463
|
};
|
|
1458
1464
|
var getSequenceValueBySymbols = (value, sequenceProps) => {
|
|
1459
1465
|
const mathArr = ["+", "-", "*", "/", ","].filter(
|
|
@@ -1490,10 +1496,10 @@ var SmblsScratch = (() => {
|
|
|
1490
1496
|
};
|
|
1491
1497
|
var findHeadingLetter = (h1Matches, index) => numToLetterMap[h1Matches - index];
|
|
1492
1498
|
var findHeadings = (propertyNames) => {
|
|
1493
|
-
const { h1Matches, sequence } = propertyNames;
|
|
1499
|
+
const { h1Matches, sequence: sequence2 } = propertyNames;
|
|
1494
1500
|
return new Array(6).fill(null).map((_, i) => {
|
|
1495
1501
|
const findLetter = findHeadingLetter(h1Matches, i);
|
|
1496
|
-
return
|
|
1502
|
+
return sequence2[findLetter];
|
|
1497
1503
|
});
|
|
1498
1504
|
};
|
|
1499
1505
|
|
|
@@ -1509,12 +1515,12 @@ var SmblsScratch = (() => {
|
|
|
1509
1515
|
};
|
|
1510
1516
|
var applySequenceGlobalVars = (vars, obj, options) => {
|
|
1511
1517
|
const CONFIG2 = getActiveConfig();
|
|
1512
|
-
const {
|
|
1513
|
-
const
|
|
1518
|
+
const { unit: UNIT } = CONFIG2;
|
|
1519
|
+
const unit2 = obj.unit || UNIT.default;
|
|
1514
1520
|
const { base, ratio, type } = obj;
|
|
1515
1521
|
const prefix = "--" + (type && type.replace(".", "-"));
|
|
1516
1522
|
vars[`${prefix}-base`] = base;
|
|
1517
|
-
vars[`${prefix}-unit`] =
|
|
1523
|
+
vars[`${prefix}-unit`] = unit2;
|
|
1518
1524
|
const ratioVar = `${prefix}-ratio`;
|
|
1519
1525
|
vars[ratioVar] = ratio;
|
|
1520
1526
|
const [first, middle, second] = getSubratio(base, ratio);
|
|
@@ -1524,15 +1530,15 @@ var SmblsScratch = (() => {
|
|
|
1524
1530
|
};
|
|
1525
1531
|
var applySequenceVars = (FACTORY2, options = {}) => {
|
|
1526
1532
|
const CONFIG2 = getActiveConfig();
|
|
1527
|
-
const {
|
|
1528
|
-
const
|
|
1529
|
-
const { mediaRegenerate, sequence, scales } = FACTORY2;
|
|
1533
|
+
const { unit: UNIT, timing: TIMING, CSS_VARS: CSS_VARS2 } = CONFIG2;
|
|
1534
|
+
const unit2 = FACTORY2.unit || UNIT.default;
|
|
1535
|
+
const { mediaRegenerate, sequence: sequence2, scales } = FACTORY2;
|
|
1530
1536
|
if (!mediaRegenerate) {
|
|
1531
1537
|
applySequenceGlobalVars(CSS_VARS2, FACTORY2, options);
|
|
1532
1538
|
}
|
|
1533
|
-
for (const key in
|
|
1534
|
-
const item =
|
|
1535
|
-
const value = (FACTORY2.type ===
|
|
1539
|
+
for (const key in sequence2) {
|
|
1540
|
+
const item = sequence2[key];
|
|
1541
|
+
const value = (FACTORY2.type === TIMING.type ? sequence2[key].val : scales[key]) + unit2;
|
|
1536
1542
|
if (!mediaRegenerate) {
|
|
1537
1543
|
CSS_VARS2[item.variable + "_default"] = value;
|
|
1538
1544
|
CSS_VARS2[item.variable] = item.scalingVariable;
|
|
@@ -1546,24 +1552,24 @@ var SmblsScratch = (() => {
|
|
|
1546
1552
|
}
|
|
1547
1553
|
}
|
|
1548
1554
|
};
|
|
1549
|
-
var applyMediaSequenceVars = (FACTORY2,
|
|
1555
|
+
var applyMediaSequenceVars = (FACTORY2, media2, options = {}) => {
|
|
1550
1556
|
const CONFIG2 = getActiveConfig();
|
|
1551
|
-
const {
|
|
1552
|
-
const mediaName =
|
|
1553
|
-
const
|
|
1557
|
+
const { unit: UNIT, media: MEDIA, CSS_VARS: CSS_VARS2 } = CONFIG2;
|
|
1558
|
+
const mediaName = media2.slice(1);
|
|
1559
|
+
const unit2 = FACTORY2.unit || UNIT.default;
|
|
1554
1560
|
const { mediaRegenerate } = FACTORY2;
|
|
1555
|
-
const { sequence, scales } = FACTORY2[
|
|
1556
|
-
const query =
|
|
1561
|
+
const { sequence: sequence2, scales } = FACTORY2[media2];
|
|
1562
|
+
const query = MEDIA[mediaName];
|
|
1557
1563
|
if (!query && CONFIG2.verbose) console.warn("Can't find media query ", query);
|
|
1558
1564
|
if (!mediaRegenerate) {
|
|
1559
1565
|
let underMediaQuery = CSS_VARS2[`@media ${query}`];
|
|
1560
1566
|
if (!underMediaQuery) underMediaQuery = CSS_VARS2[`@media ${query}`] = {};
|
|
1561
|
-
applySequenceGlobalVars(underMediaQuery, FACTORY2[
|
|
1567
|
+
applySequenceGlobalVars(underMediaQuery, FACTORY2[media2], options);
|
|
1562
1568
|
return;
|
|
1563
1569
|
}
|
|
1564
|
-
for (const key in
|
|
1565
|
-
const item =
|
|
1566
|
-
const value = (isScalingUnit(
|
|
1570
|
+
for (const key in sequence2) {
|
|
1571
|
+
const item = sequence2[key];
|
|
1572
|
+
const value = (isScalingUnit(unit2) ? scales[key] : sequence2[key].val) + unit2;
|
|
1567
1573
|
if (!query && CONFIG2.verbose) console.warn("Can't find query ", query);
|
|
1568
1574
|
let underMediaQuery = CSS_VARS2[`@media ${query}`];
|
|
1569
1575
|
if (!underMediaQuery) underMediaQuery = CSS_VARS2[`@media ${query}`] = {};
|
|
@@ -1575,13 +1581,13 @@ var SmblsScratch = (() => {
|
|
|
1575
1581
|
// src/utils/sprite.js
|
|
1576
1582
|
init_esm();
|
|
1577
1583
|
var isDev = isNotProduction();
|
|
1578
|
-
var generateSprite = (
|
|
1584
|
+
var generateSprite = (icons2) => {
|
|
1579
1585
|
const CONFIG2 = getActiveConfig();
|
|
1580
1586
|
let sprite = "";
|
|
1581
|
-
for (const key in
|
|
1587
|
+
for (const key in icons2) {
|
|
1582
1588
|
if (CONFIG2.__svg_cache[key]) continue;
|
|
1583
1589
|
else CONFIG2.__svg_cache[key] = true;
|
|
1584
|
-
sprite +=
|
|
1590
|
+
sprite += icons2[key];
|
|
1585
1591
|
}
|
|
1586
1592
|
return sprite;
|
|
1587
1593
|
};
|
|
@@ -1692,8 +1698,8 @@ var SmblsScratch = (() => {
|
|
|
1692
1698
|
alpha = parsed.alpha;
|
|
1693
1699
|
tone = parsed.tone;
|
|
1694
1700
|
}
|
|
1695
|
-
const {
|
|
1696
|
-
let val =
|
|
1701
|
+
const { color: COLOR, gradient: GRADIENT } = CONFIG2;
|
|
1702
|
+
let val = COLOR[name] || GRADIENT[name];
|
|
1697
1703
|
if (!val) {
|
|
1698
1704
|
if (CONFIG2.verbose) console.warn("Can't find color ", name);
|
|
1699
1705
|
return value;
|
|
@@ -1733,8 +1739,8 @@ var SmblsScratch = (() => {
|
|
|
1733
1739
|
if (parsed.cssVar) return `var(${parsed.cssVar})`;
|
|
1734
1740
|
name = parsed.name;
|
|
1735
1741
|
}
|
|
1736
|
-
const {
|
|
1737
|
-
const val =
|
|
1742
|
+
const { color: COLOR, gradient: GRADIENT } = CONFIG2;
|
|
1743
|
+
const val = COLOR[name] || GRADIENT[name];
|
|
1738
1744
|
const isObj = isObject(val);
|
|
1739
1745
|
if (isObj && val.value) return getColor(value, `@${globalTheme}`, config);
|
|
1740
1746
|
else if (isObj) {
|
|
@@ -1742,9 +1748,9 @@ var SmblsScratch = (() => {
|
|
|
1742
1748
|
else {
|
|
1743
1749
|
const obj = {};
|
|
1744
1750
|
for (const mediaName in val) {
|
|
1745
|
-
const query = CONFIG2.
|
|
1746
|
-
const
|
|
1747
|
-
obj[
|
|
1751
|
+
const query = CONFIG2.media[mediaName.slice(1)];
|
|
1752
|
+
const media2 = "@media " + (query === "print" ? `${query}` : `screen and ${query}`);
|
|
1753
|
+
obj[media2] = getColor(value, mediaName, config);
|
|
1748
1754
|
}
|
|
1749
1755
|
return obj;
|
|
1750
1756
|
}
|
|
@@ -1760,7 +1766,7 @@ var SmblsScratch = (() => {
|
|
|
1760
1766
|
val = getColor(rawRef);
|
|
1761
1767
|
if (!(val.includes("rgb") || val.includes("var") || val.includes("#"))) {
|
|
1762
1768
|
const parts = rawRef.split(" ");
|
|
1763
|
-
const refColor = CONFIG2.
|
|
1769
|
+
const refColor = CONFIG2.color[parts[0]];
|
|
1764
1770
|
if (refColor && refColor.value) {
|
|
1765
1771
|
let rgb2 = refColor.rgb;
|
|
1766
1772
|
const alpha2 = parts[1] !== void 0 ? parts[1] : "1";
|
|
@@ -1849,112 +1855,112 @@ var SmblsScratch = (() => {
|
|
|
1849
1855
|
|
|
1850
1856
|
// src/system/theme.js
|
|
1851
1857
|
init_esm();
|
|
1852
|
-
var setThemeValue = (
|
|
1858
|
+
var setThemeValue = (theme2) => {
|
|
1853
1859
|
const value = {};
|
|
1854
|
-
const { state, media, helpers, ...rest } =
|
|
1860
|
+
const { state, media: media2, helpers, ...rest } = theme2;
|
|
1855
1861
|
const keys = Object.keys(rest);
|
|
1856
1862
|
keys.map((key) => {
|
|
1857
1863
|
const conditions = ["color", "Color", "background", "border"];
|
|
1858
1864
|
const isColor = conditions.some((k) => key.includes(k));
|
|
1859
|
-
return value[key] = isColor ? getColor(
|
|
1865
|
+
return value[key] = isColor ? getColor(theme2[key]) : theme2[key];
|
|
1860
1866
|
});
|
|
1861
1867
|
return value;
|
|
1862
1868
|
};
|
|
1863
|
-
var getThemeValue = (
|
|
1864
|
-
if (
|
|
1865
|
-
|
|
1866
|
-
return
|
|
1869
|
+
var getThemeValue = (theme2) => {
|
|
1870
|
+
if (theme2.value) return theme2.value;
|
|
1871
|
+
theme2.value = setThemeValue(theme2);
|
|
1872
|
+
return theme2.value;
|
|
1867
1873
|
};
|
|
1868
1874
|
var getTheme = (value, modifier) => {
|
|
1869
1875
|
const CONFIG2 = getActiveConfig();
|
|
1870
1876
|
if (CONFIG2.useVariable) return getMediaTheme(value, modifier);
|
|
1871
|
-
const
|
|
1877
|
+
const THEME = CONFIG2.theme;
|
|
1872
1878
|
if (isString(value)) {
|
|
1873
|
-
const [
|
|
1874
|
-
const isOurTheme =
|
|
1879
|
+
const [theme2, subtheme] = value.split(" ");
|
|
1880
|
+
const isOurTheme = THEME[theme2];
|
|
1875
1881
|
if (isOurTheme) {
|
|
1876
1882
|
if (!subtheme && !modifier) return getThemeValue(isOurTheme);
|
|
1877
|
-
value = [
|
|
1883
|
+
value = [theme2, subtheme || modifier];
|
|
1878
1884
|
}
|
|
1879
1885
|
}
|
|
1880
1886
|
if (isObjectLike(value) && value[1]) {
|
|
1881
1887
|
const themeName = value[0];
|
|
1882
1888
|
const subThemeName = value[1];
|
|
1883
|
-
const { helpers, media, state } =
|
|
1884
|
-
if (
|
|
1889
|
+
const { helpers, media: media2, state } = THEME[themeName];
|
|
1890
|
+
if (media2 && media2[subThemeName]) return getThemeValue(media2[subThemeName]);
|
|
1885
1891
|
if (helpers && helpers[subThemeName]) return getThemeValue(helpers[subThemeName]);
|
|
1886
1892
|
if (state && state[subThemeName]) return getThemeValue(state[subThemeName]);
|
|
1887
1893
|
} else if (isObject(value)) return setThemeValue(value);
|
|
1888
1894
|
};
|
|
1889
|
-
var setInverseTheme = (
|
|
1895
|
+
var setInverseTheme = (theme2, variant, value) => {
|
|
1890
1896
|
if (isObject(variant)) {
|
|
1891
|
-
|
|
1897
|
+
theme2.variants.inverse.value = setThemeValue(variant);
|
|
1892
1898
|
} else if (variant === true) {
|
|
1893
|
-
const { color, background } = value;
|
|
1894
|
-
|
|
1899
|
+
const { color: color2, background } = value;
|
|
1900
|
+
theme2.variants.inverse = {
|
|
1895
1901
|
value: {
|
|
1896
1902
|
color: background,
|
|
1897
|
-
background:
|
|
1903
|
+
background: color2
|
|
1898
1904
|
}
|
|
1899
1905
|
};
|
|
1900
1906
|
}
|
|
1901
1907
|
};
|
|
1902
|
-
var setPseudo = (
|
|
1908
|
+
var setPseudo = (theme2, key, variant, themeValue) => {
|
|
1903
1909
|
const result = getTheme(variant);
|
|
1904
1910
|
themeValue[`&:${key}`] = result;
|
|
1905
1911
|
if (isObject(variant) && !variant.value) variant.value = result;
|
|
1906
1912
|
};
|
|
1907
|
-
var setSelectors = (
|
|
1908
|
-
const { state } =
|
|
1913
|
+
var setSelectors = (theme2, value) => {
|
|
1914
|
+
const { state } = theme2;
|
|
1909
1915
|
if (!state) return;
|
|
1910
1916
|
const keys = Object.keys(state);
|
|
1911
1917
|
keys.map((key) => {
|
|
1912
1918
|
const variant = state[key];
|
|
1913
|
-
setPseudo(
|
|
1914
|
-
return
|
|
1919
|
+
setPseudo(theme2, key, variant, value);
|
|
1920
|
+
return theme2;
|
|
1915
1921
|
});
|
|
1916
|
-
return
|
|
1922
|
+
return theme2;
|
|
1917
1923
|
};
|
|
1918
|
-
var setPrefersScheme = (
|
|
1924
|
+
var setPrefersScheme = (theme2, key, variant, themeValue) => {
|
|
1919
1925
|
const result = getTheme(variant);
|
|
1920
1926
|
themeValue[`@media (prefers-color-scheme: ${key})`] = result;
|
|
1921
1927
|
if (isObject(variant) && !variant.value) variant.value = result;
|
|
1922
1928
|
};
|
|
1923
|
-
var setMedia = (
|
|
1924
|
-
const { media } =
|
|
1925
|
-
if (!
|
|
1926
|
-
const keys = Object.keys(
|
|
1929
|
+
var setMedia = (theme2, value) => {
|
|
1930
|
+
const { media: media2 } = theme2;
|
|
1931
|
+
if (!media2) return;
|
|
1932
|
+
const keys = Object.keys(media2);
|
|
1927
1933
|
keys.map((key) => {
|
|
1928
|
-
const variant =
|
|
1929
|
-
if (key === "dark" || key === "light") setPrefersScheme(
|
|
1930
|
-
if (key === "inverse") setInverseTheme(
|
|
1931
|
-
return
|
|
1934
|
+
const variant = media2[key];
|
|
1935
|
+
if (key === "dark" || key === "light") setPrefersScheme(theme2, key, variant, value);
|
|
1936
|
+
if (key === "inverse") setInverseTheme(theme2, variant, value);
|
|
1937
|
+
return theme2;
|
|
1932
1938
|
});
|
|
1933
|
-
return
|
|
1939
|
+
return theme2;
|
|
1934
1940
|
};
|
|
1935
|
-
var setHelpers = (
|
|
1941
|
+
var setHelpers = (theme2, value) => {
|
|
1936
1942
|
const CONFIG2 = getActiveConfig();
|
|
1937
|
-
const { helpers } =
|
|
1943
|
+
const { helpers } = theme2;
|
|
1938
1944
|
if (!helpers) return;
|
|
1939
1945
|
const keys = Object.keys(helpers);
|
|
1940
1946
|
keys.map((key) => {
|
|
1941
1947
|
const helper = helpers[key];
|
|
1942
|
-
if (isString(helper)) helpers[key] = CONFIG2.
|
|
1948
|
+
if (isString(helper)) helpers[key] = CONFIG2.theme[helper];
|
|
1943
1949
|
else getThemeValue(helpers[key]);
|
|
1944
|
-
return
|
|
1950
|
+
return theme2;
|
|
1945
1951
|
});
|
|
1946
|
-
return
|
|
1952
|
+
return theme2;
|
|
1947
1953
|
};
|
|
1948
1954
|
var setTheme = (val, key) => {
|
|
1949
1955
|
const CONFIG2 = getActiveConfig();
|
|
1950
1956
|
if (CONFIG2.useVariable) return setMediaTheme(val, key);
|
|
1951
|
-
const { state, media, helpers } = val;
|
|
1957
|
+
const { state, media: media2, helpers } = val;
|
|
1952
1958
|
const value = setThemeValue(val, key);
|
|
1953
1959
|
const CSSvar = `--theme-${key}`;
|
|
1954
1960
|
setSelectors(val, value);
|
|
1955
1961
|
setMedia(val, value);
|
|
1956
1962
|
setHelpers(val, value);
|
|
1957
|
-
return { var: CSSvar, value, state, media, helpers };
|
|
1963
|
+
return { var: CSSvar, value, state, media: media2, helpers };
|
|
1958
1964
|
};
|
|
1959
1965
|
var generateAutoVars = (schemes, varPrefix, CONFIG2) => {
|
|
1960
1966
|
const { CSS_VARS: CSS_VARS2 } = CONFIG2;
|
|
@@ -1989,23 +1995,23 @@ var SmblsScratch = (() => {
|
|
|
1989
1995
|
for (const scheme in schemes) {
|
|
1990
1996
|
const val = schemes[scheme]?.[param];
|
|
1991
1997
|
if (val === void 0) continue;
|
|
1992
|
-
const
|
|
1993
|
-
if (
|
|
1998
|
+
const color2 = getColor(val, `@${scheme}`);
|
|
1999
|
+
if (color2 === void 0) continue;
|
|
1994
2000
|
const selector = `[data-theme="${scheme}"]`;
|
|
1995
2001
|
if (!MEDIA_VARS[selector]) MEDIA_VARS[selector] = {};
|
|
1996
|
-
MEDIA_VARS[selector][autoVar] =
|
|
2002
|
+
MEDIA_VARS[selector][autoVar] = color2;
|
|
1997
2003
|
if (scheme === "dark" || scheme === "light") {
|
|
1998
2004
|
const mq = `@media (prefers-color-scheme: ${scheme})`;
|
|
1999
2005
|
if (!MEDIA_VARS[mq]) MEDIA_VARS[mq] = {};
|
|
2000
|
-
MEDIA_VARS[mq][autoVar] =
|
|
2006
|
+
MEDIA_VARS[mq][autoVar] = color2;
|
|
2001
2007
|
}
|
|
2002
2008
|
}
|
|
2003
2009
|
} else {
|
|
2004
2010
|
const forced = String(globalTheme).replace(/^'|'$/g, "");
|
|
2005
2011
|
const source = schemes[forced]?.[param];
|
|
2006
2012
|
if (source !== void 0) {
|
|
2007
|
-
const
|
|
2008
|
-
if (
|
|
2013
|
+
const color2 = getColor(source, `@${forced}`);
|
|
2014
|
+
if (color2 !== void 0) CSS_VARS2[autoVar] = color2;
|
|
2009
2015
|
}
|
|
2010
2016
|
}
|
|
2011
2017
|
result[param] = `var(${autoVar})`;
|
|
@@ -2023,7 +2029,7 @@ var SmblsScratch = (() => {
|
|
|
2023
2029
|
var setMediaTheme = (val, key, suffix, prefers) => {
|
|
2024
2030
|
const CONFIG2 = getActiveConfig();
|
|
2025
2031
|
const { CSS_VARS: CSS_VARS2 } = CONFIG2;
|
|
2026
|
-
const
|
|
2032
|
+
const theme2 = { value: val };
|
|
2027
2033
|
const isTopLevel = !suffix && !prefers;
|
|
2028
2034
|
if (isObjectLike(val)) {
|
|
2029
2035
|
if (isTopLevel && CONFIG2.useVariable) {
|
|
@@ -2035,7 +2041,7 @@ var SmblsScratch = (() => {
|
|
|
2035
2041
|
}
|
|
2036
2042
|
if (Object.keys(schemes).length) {
|
|
2037
2043
|
const autoResult = generateAutoVars(schemes, key, CONFIG2);
|
|
2038
|
-
Object.assign(
|
|
2044
|
+
Object.assign(theme2, autoResult);
|
|
2039
2045
|
}
|
|
2040
2046
|
}
|
|
2041
2047
|
for (const param in val) {
|
|
@@ -2043,35 +2049,35 @@ var SmblsScratch = (() => {
|
|
|
2043
2049
|
const value = val[param];
|
|
2044
2050
|
if (symb === "@" || symb === ":" || symb === ".") {
|
|
2045
2051
|
const hasPrefers = symb === "@" && param;
|
|
2046
|
-
|
|
2052
|
+
theme2[param] = setMediaTheme(value, key, param, prefers || hasPrefers);
|
|
2047
2053
|
} else if (!isTopLevel) {
|
|
2048
|
-
const
|
|
2054
|
+
const color2 = getColor(value, prefers);
|
|
2049
2055
|
const metaSuffixes = [...new Set([prefers, suffix].filter((v) => v).map((v) => v.slice(1)))];
|
|
2050
2056
|
const varmetaSuffixName = metaSuffixes.length ? "-" + metaSuffixes.join("-") : "";
|
|
2051
2057
|
const CSSVar = `--theme-${key}${varmetaSuffixName}-${param}`;
|
|
2052
2058
|
if (CONFIG2.useVariable) {
|
|
2053
|
-
if (CONFIG2.useThemeSuffixedVars) CSS_VARS2[CSSVar] =
|
|
2054
|
-
|
|
2059
|
+
if (CONFIG2.useThemeSuffixedVars) CSS_VARS2[CSSVar] = color2;
|
|
2060
|
+
theme2[param] = `var(${CSSVar})`;
|
|
2055
2061
|
} else {
|
|
2056
|
-
|
|
2062
|
+
theme2[param] = color2;
|
|
2057
2063
|
}
|
|
2058
|
-
|
|
2064
|
+
theme2[`.${param}`] = { [param]: theme2[param] };
|
|
2059
2065
|
}
|
|
2060
2066
|
}
|
|
2061
|
-
if (!
|
|
2062
|
-
|
|
2063
|
-
color:
|
|
2064
|
-
background:
|
|
2067
|
+
if (!theme2[".inversed"] && (theme2.background || theme2.color || theme2.backgroundColor)) {
|
|
2068
|
+
theme2[".inversed"] = {
|
|
2069
|
+
color: theme2.background || theme2.backgroundColor,
|
|
2070
|
+
background: theme2.color
|
|
2065
2071
|
};
|
|
2066
2072
|
}
|
|
2067
2073
|
}
|
|
2068
2074
|
if (isString(val) && isCSSVar(val)) {
|
|
2069
|
-
const
|
|
2070
|
-
const value =
|
|
2075
|
+
const THEME = CONFIG2.theme;
|
|
2076
|
+
const value = THEME[val.slice(2)];
|
|
2071
2077
|
const getReferenced = getMediaTheme(value, prefers);
|
|
2072
2078
|
return getReferenced;
|
|
2073
2079
|
}
|
|
2074
|
-
return
|
|
2080
|
+
return theme2;
|
|
2075
2081
|
};
|
|
2076
2082
|
var recursiveTheme = (val) => {
|
|
2077
2083
|
const CONFIG2 = getActiveConfig();
|
|
@@ -2110,7 +2116,7 @@ var SmblsScratch = (() => {
|
|
|
2110
2116
|
return;
|
|
2111
2117
|
}
|
|
2112
2118
|
const [themeName, ...themeModifiers] = isArray(value) ? value : value.split(" ");
|
|
2113
|
-
let themeValue = activeConfig.
|
|
2119
|
+
let themeValue = activeConfig.theme[themeName];
|
|
2114
2120
|
if (themeValue && themeModifiers.length) {
|
|
2115
2121
|
themeValue = findModifier(themeValue, themeModifiers);
|
|
2116
2122
|
} else if (themeValue && modifier) {
|
|
@@ -2147,17 +2153,17 @@ var SmblsScratch = (() => {
|
|
|
2147
2153
|
};
|
|
2148
2154
|
var getFontFamily = (key, factory) => {
|
|
2149
2155
|
const CONFIG2 = getActiveConfig();
|
|
2150
|
-
const {
|
|
2151
|
-
return getDefaultOrFirstKey(factory ||
|
|
2156
|
+
const { font_family: FONT_FAMILY } = CONFIG2;
|
|
2157
|
+
return getDefaultOrFirstKey(factory || FONT_FAMILY, key);
|
|
2152
2158
|
};
|
|
2153
2159
|
var setFontFamily = (val, key) => {
|
|
2154
2160
|
const CONFIG2 = getActiveConfig();
|
|
2155
|
-
const {
|
|
2161
|
+
const { font_family: FONT_FAMILY, font_family_types: FONT_FAMILY_TYPES } = CONFIG2;
|
|
2156
2162
|
let { value, type } = val;
|
|
2157
|
-
if (val.isDefault)
|
|
2163
|
+
if (val.isDefault) FONT_FAMILY.default = key;
|
|
2158
2164
|
if (isObject(value)) value = arrayzeValue(value);
|
|
2159
2165
|
const CSSvar = `--font-family-${key}`;
|
|
2160
|
-
const str = `${value.join(", ")}, ${
|
|
2166
|
+
const str = `${value.join(", ")}, ${FONT_FAMILY_TYPES[type]}`;
|
|
2161
2167
|
return { var: CSSvar, value: str, arr: value, type };
|
|
2162
2168
|
};
|
|
2163
2169
|
|
|
@@ -2165,14 +2171,14 @@ var SmblsScratch = (() => {
|
|
|
2165
2171
|
init_esm();
|
|
2166
2172
|
var runThroughMedia = (FACTORY2) => {
|
|
2167
2173
|
const CONFIG2 = getActiveConfig();
|
|
2168
|
-
const {
|
|
2174
|
+
const { typography: TYPOGRAPHY, media: MEDIA } = CONFIG2;
|
|
2169
2175
|
for (const prop in FACTORY2) {
|
|
2170
2176
|
const isPropMedia = prop.slice(0, 1) === "@";
|
|
2171
2177
|
const mediaValue = FACTORY2[prop];
|
|
2172
2178
|
if (!isPropMedia) continue;
|
|
2173
2179
|
const { mediaRegenerate } = FACTORY2;
|
|
2174
2180
|
const mediaName = prop.slice(1);
|
|
2175
|
-
const { type, base, ratio, range, subSequence, h1Matches, unit } = FACTORY2;
|
|
2181
|
+
const { type, base, ratio, range, subSequence, h1Matches, unit: unit2 } = FACTORY2;
|
|
2176
2182
|
merge(mediaValue, {
|
|
2177
2183
|
type,
|
|
2178
2184
|
base,
|
|
@@ -2180,12 +2186,12 @@ var SmblsScratch = (() => {
|
|
|
2180
2186
|
range,
|
|
2181
2187
|
subSequence,
|
|
2182
2188
|
h1Matches,
|
|
2183
|
-
unit
|
|
2189
|
+
unit: unit2
|
|
2184
2190
|
});
|
|
2185
|
-
const query =
|
|
2186
|
-
const
|
|
2187
|
-
|
|
2188
|
-
fontSize: mediaValue.base /
|
|
2191
|
+
const query = MEDIA[mediaName];
|
|
2192
|
+
const media2 = "@media " + (query === "print" ? `${query}` : `screen and ${query}`);
|
|
2193
|
+
TYPOGRAPHY.templates[media2] = {
|
|
2194
|
+
fontSize: mediaValue.base / TYPOGRAPHY.browserDefault + unit2
|
|
2189
2195
|
};
|
|
2190
2196
|
if (!mediaRegenerate) {
|
|
2191
2197
|
applyMediaSequenceVars(FACTORY2, prop);
|
|
@@ -2204,14 +2210,14 @@ var SmblsScratch = (() => {
|
|
|
2204
2210
|
var applyHeadings = (props) => {
|
|
2205
2211
|
const CONFIG2 = getActiveConfig();
|
|
2206
2212
|
if (props.h1Matches) {
|
|
2207
|
-
const
|
|
2213
|
+
const unit2 = props.unit;
|
|
2208
2214
|
const HEADINGS = findHeadings(props);
|
|
2209
|
-
const { templates } = props;
|
|
2215
|
+
const { templates: templates2 } = props;
|
|
2210
2216
|
for (const k in HEADINGS) {
|
|
2211
2217
|
const headerName = `h${parseInt(k) + 1}`;
|
|
2212
|
-
const headerStyle =
|
|
2213
|
-
|
|
2214
|
-
fontSize: CONFIG2.useVariable ? `var(${HEADINGS[k]?.variable})` : `${HEADINGS[k]?.scaling}${
|
|
2218
|
+
const headerStyle = templates2[headerName];
|
|
2219
|
+
templates2[headerName] = {
|
|
2220
|
+
fontSize: CONFIG2.useVariable ? `var(${HEADINGS[k]?.variable})` : `${HEADINGS[k]?.scaling}${unit2}`,
|
|
2215
2221
|
margin: headerStyle ? headerStyle.margin : 0,
|
|
2216
2222
|
lineHeight: headerStyle ? headerStyle.lineHeight : props.lineHeight,
|
|
2217
2223
|
letterSpacing: headerStyle ? headerStyle.letterSpacing : props.letterSpacing,
|
|
@@ -2222,16 +2228,16 @@ var SmblsScratch = (() => {
|
|
|
2222
2228
|
};
|
|
2223
2229
|
var applyTypographySequence = () => {
|
|
2224
2230
|
const CONFIG2 = getActiveConfig();
|
|
2225
|
-
const {
|
|
2226
|
-
generateSequence(
|
|
2227
|
-
applyHeadings(
|
|
2228
|
-
applySequenceVars(
|
|
2229
|
-
runThroughMedia(
|
|
2231
|
+
const { typography: TYPOGRAPHY } = CONFIG2;
|
|
2232
|
+
generateSequence(TYPOGRAPHY);
|
|
2233
|
+
applyHeadings(TYPOGRAPHY);
|
|
2234
|
+
applySequenceVars(TYPOGRAPHY);
|
|
2235
|
+
runThroughMedia(TYPOGRAPHY);
|
|
2230
2236
|
};
|
|
2231
2237
|
var getFontSizeByKey = (value) => {
|
|
2232
2238
|
const CONFIG2 = getActiveConfig();
|
|
2233
|
-
const {
|
|
2234
|
-
return getSequenceValuePropertyPair(value, "fontSize",
|
|
2239
|
+
const { typography: TYPOGRAPHY } = CONFIG2;
|
|
2240
|
+
return getSequenceValuePropertyPair(value, "fontSize", TYPOGRAPHY);
|
|
2235
2241
|
};
|
|
2236
2242
|
|
|
2237
2243
|
// src/system/spacing.js
|
|
@@ -2241,7 +2247,7 @@ var SmblsScratch = (() => {
|
|
|
2241
2247
|
const mediaProps = FACTORY2[prop];
|
|
2242
2248
|
const isMediaName = prop.slice(0, 1) === "@";
|
|
2243
2249
|
if (!isMediaName) continue;
|
|
2244
|
-
const { type, base, ratio, range, subSequence, h1Matches, unit } = FACTORY2;
|
|
2250
|
+
const { type, base, ratio, range, subSequence, h1Matches, unit: unit2 } = FACTORY2;
|
|
2245
2251
|
merge(mediaProps, {
|
|
2246
2252
|
type,
|
|
2247
2253
|
base,
|
|
@@ -2249,7 +2255,7 @@ var SmblsScratch = (() => {
|
|
|
2249
2255
|
range,
|
|
2250
2256
|
subSequence,
|
|
2251
2257
|
h1Matches,
|
|
2252
|
-
unit,
|
|
2258
|
+
unit: unit2,
|
|
2253
2259
|
sequence: {},
|
|
2254
2260
|
scales: {},
|
|
2255
2261
|
templates: {},
|
|
@@ -2267,20 +2273,20 @@ var SmblsScratch = (() => {
|
|
|
2267
2273
|
};
|
|
2268
2274
|
var applySpacingSequence = () => {
|
|
2269
2275
|
const CONFIG2 = getActiveConfig();
|
|
2270
|
-
const {
|
|
2271
|
-
generateSequence(
|
|
2272
|
-
applySequenceVars(
|
|
2273
|
-
runThroughMedia2(
|
|
2276
|
+
const { spacing: SPACING } = CONFIG2;
|
|
2277
|
+
generateSequence(SPACING);
|
|
2278
|
+
applySequenceVars(SPACING);
|
|
2279
|
+
runThroughMedia2(SPACING);
|
|
2274
2280
|
};
|
|
2275
2281
|
var getSequence = (sequenceProps) => {
|
|
2276
2282
|
const CONFIG2 = getActiveConfig();
|
|
2277
|
-
const {
|
|
2278
|
-
if (!sequenceProps || !sequenceProps.sequence) return
|
|
2283
|
+
const { spacing: SPACING } = CONFIG2;
|
|
2284
|
+
if (!sequenceProps || !sequenceProps.sequence) return SPACING;
|
|
2279
2285
|
const hasGenerated = Object.keys(sequenceProps.sequence).length > 0;
|
|
2280
2286
|
return hasGenerated ? sequenceProps : generateSequence(sequenceProps);
|
|
2281
2287
|
};
|
|
2282
2288
|
var getSpacingByKey = (value, propertyName = "padding", sequenceProps, fnPrefix) => {
|
|
2283
|
-
const
|
|
2289
|
+
const sequence2 = getSequence(sequenceProps);
|
|
2284
2290
|
if (isString(value)) {
|
|
2285
2291
|
if (!fnPrefix && value.includes("(")) {
|
|
2286
2292
|
const fnArray = getFnPrefixAndValue(value);
|
|
@@ -2304,18 +2310,18 @@ var SmblsScratch = (() => {
|
|
|
2304
2310
|
const wrapSequenceValueByDirection = (direction, i) => getSequenceValuePropertyPair(
|
|
2305
2311
|
stack[i],
|
|
2306
2312
|
propertyName + direction + suffix,
|
|
2307
|
-
|
|
2313
|
+
sequence2,
|
|
2308
2314
|
fnPrefix
|
|
2309
2315
|
);
|
|
2310
2316
|
return directions[stack.length].map(
|
|
2311
2317
|
(dir, key) => wrapSequenceValueByDirection(dir, key)
|
|
2312
2318
|
);
|
|
2313
2319
|
}
|
|
2314
|
-
return getSequenceValuePropertyPair(value, propertyName,
|
|
2320
|
+
return getSequenceValuePropertyPair(value, propertyName, sequence2, fnPrefix);
|
|
2315
2321
|
};
|
|
2316
2322
|
var getSpacingBasedOnRatio = (props, propertyName, val, fnPrefix) => {
|
|
2317
2323
|
const CONFIG2 = getActiveConfig();
|
|
2318
|
-
const {
|
|
2324
|
+
const { spacing: SPACING } = CONFIG2;
|
|
2319
2325
|
let value = val || props[propertyName];
|
|
2320
2326
|
if (!fnPrefix && isString(value) && value.includes("(")) {
|
|
2321
2327
|
const fnArr = getFnPrefixAndValue(value);
|
|
@@ -2326,12 +2332,12 @@ var SmblsScratch = (() => {
|
|
|
2326
2332
|
const sequenceProps = applyCustomSequence(props);
|
|
2327
2333
|
return getSpacingByKey(value, propertyName, sequenceProps, fnPrefix);
|
|
2328
2334
|
}
|
|
2329
|
-
return getSpacingByKey(value, propertyName,
|
|
2335
|
+
return getSpacingByKey(value, propertyName, SPACING, fnPrefix);
|
|
2330
2336
|
};
|
|
2331
2337
|
var splitSpacedValue = (val) => {
|
|
2332
2338
|
const addDefault = (v) => {
|
|
2333
2339
|
const isSymbol = ["+", "-", "*", "/"].includes(v);
|
|
2334
|
-
const hasUnits = CSS_UNITS.some((
|
|
2340
|
+
const hasUnits = CSS_UNITS.some((unit2) => val.includes(unit2));
|
|
2335
2341
|
if (isSymbol || hasUnits) return v;
|
|
2336
2342
|
const isSingleLetter = v.length < 3 && /[A-Z]/.test(v);
|
|
2337
2343
|
if (isSingleLetter) return v + "_default";
|
|
@@ -2362,18 +2368,18 @@ var SmblsScratch = (() => {
|
|
|
2362
2368
|
return obj;
|
|
2363
2369
|
}
|
|
2364
2370
|
if (isString(value) && !CSS_NATIVE_COLOR_REGEX.test(value)) {
|
|
2365
|
-
value = splitTopLevelCommas(value).map((
|
|
2366
|
-
|
|
2367
|
-
return
|
|
2371
|
+
value = splitTopLevelCommas(value).map((shadow2) => {
|
|
2372
|
+
shadow2 = shadow2.trim();
|
|
2373
|
+
return shadow2.split(/\s+/).map((v) => {
|
|
2368
2374
|
v = v.trim();
|
|
2369
2375
|
if (!v) return "";
|
|
2370
2376
|
if (v.startsWith("--")) return `var(${v})`;
|
|
2371
|
-
const
|
|
2372
|
-
if (isResolvedColor(
|
|
2377
|
+
const color2 = getColor(v);
|
|
2378
|
+
if (isResolvedColor(color2)) return color2;
|
|
2373
2379
|
if (/^\d/.test(v) || v === "0" || v.includes("px") || v.slice(-2) === "em") return v;
|
|
2374
2380
|
if (v === "inset" || v === "none") return v;
|
|
2375
|
-
const
|
|
2376
|
-
if (
|
|
2381
|
+
const spacing2 = getSpacingByKey(v, "shadow");
|
|
2382
|
+
if (spacing2 && spacing2.shadow) return spacing2.shadow;
|
|
2377
2383
|
return v;
|
|
2378
2384
|
}).join(" ");
|
|
2379
2385
|
}).join(", ");
|
|
@@ -2396,8 +2402,8 @@ var SmblsScratch = (() => {
|
|
|
2396
2402
|
}
|
|
2397
2403
|
if (isCSSVar(value)) return `var(${value})`;
|
|
2398
2404
|
const [name] = isArray(value) ? value : value.split(" ");
|
|
2399
|
-
const
|
|
2400
|
-
const val =
|
|
2405
|
+
const SHADOW = CONFIG2.shadow;
|
|
2406
|
+
const val = SHADOW[name];
|
|
2401
2407
|
const isObj = isObject(val);
|
|
2402
2408
|
if (!val) {
|
|
2403
2409
|
if (CONFIG2.verbose) console.warn("Can't find color ", name);
|
|
@@ -2411,9 +2417,9 @@ var SmblsScratch = (() => {
|
|
|
2411
2417
|
if (isObj) {
|
|
2412
2418
|
const obj = {};
|
|
2413
2419
|
for (const mediaName in val) {
|
|
2414
|
-
const query = CONFIG2.
|
|
2415
|
-
const
|
|
2416
|
-
obj[
|
|
2420
|
+
const query = CONFIG2.media[mediaName.slice(1)];
|
|
2421
|
+
const media2 = "@media " + (query === "print" ? `${query}` : `screen and ${query}`);
|
|
2422
|
+
obj[media2] = val.value;
|
|
2417
2423
|
}
|
|
2418
2424
|
return obj;
|
|
2419
2425
|
}
|
|
@@ -2424,22 +2430,22 @@ var SmblsScratch = (() => {
|
|
|
2424
2430
|
// src/system/timing.js
|
|
2425
2431
|
var applyTimingSequence = () => {
|
|
2426
2432
|
const CONFIG2 = getActiveConfig();
|
|
2427
|
-
const {
|
|
2428
|
-
generateSequence(
|
|
2429
|
-
applySequenceVars(
|
|
2433
|
+
const { timing: TIMING } = CONFIG2;
|
|
2434
|
+
generateSequence(TIMING);
|
|
2435
|
+
applySequenceVars(TIMING);
|
|
2430
2436
|
};
|
|
2431
2437
|
var getTimingFunction = (value) => {
|
|
2432
2438
|
const CONFIG2 = getActiveConfig();
|
|
2433
|
-
const {
|
|
2434
|
-
return
|
|
2439
|
+
const { timing: TIMING } = CONFIG2;
|
|
2440
|
+
return TIMING[value] || TIMING[toCamelCase(value)] || value;
|
|
2435
2441
|
};
|
|
2436
2442
|
var getTimingByKey = (value, property = "timing") => {
|
|
2437
2443
|
const CONFIG2 = getActiveConfig();
|
|
2438
|
-
const {
|
|
2444
|
+
const { timing: TIMING } = CONFIG2;
|
|
2439
2445
|
return getSequenceValuePropertyPair(
|
|
2440
2446
|
value,
|
|
2441
2447
|
property,
|
|
2442
|
-
|
|
2448
|
+
TIMING
|
|
2443
2449
|
);
|
|
2444
2450
|
};
|
|
2445
2451
|
|
|
@@ -2447,12 +2453,12 @@ var SmblsScratch = (() => {
|
|
|
2447
2453
|
init_esm();
|
|
2448
2454
|
var applyDocument = () => {
|
|
2449
2455
|
const CONFIG2 = getActiveConfig();
|
|
2450
|
-
const {
|
|
2451
|
-
return merge(
|
|
2452
|
-
theme:
|
|
2453
|
-
fontFamily: getDefaultOrFirstKey(
|
|
2454
|
-
fontSize:
|
|
2455
|
-
lineHeight:
|
|
2456
|
+
const { document: DOCUMENT, font_family: FONT_FAMILY, theme: THEME, typography: TYPOGRAPHY } = CONFIG2;
|
|
2457
|
+
return merge(DOCUMENT, {
|
|
2458
|
+
theme: THEME.document,
|
|
2459
|
+
fontFamily: getDefaultOrFirstKey(FONT_FAMILY),
|
|
2460
|
+
fontSize: TYPOGRAPHY.base,
|
|
2461
|
+
lineHeight: TYPOGRAPHY.lineHeight
|
|
2456
2462
|
});
|
|
2457
2463
|
};
|
|
2458
2464
|
|
|
@@ -2474,21 +2480,21 @@ var SmblsScratch = (() => {
|
|
|
2474
2480
|
};
|
|
2475
2481
|
var appendSVGSprite = (LIBRARY, options = DEF_OPTIONS) => {
|
|
2476
2482
|
const CONFIG2 = getActiveConfig();
|
|
2477
|
-
const lib = Object.keys(LIBRARY).length ? {} : CONFIG2.
|
|
2478
|
-
for (const key in LIBRARY) lib[key] = CONFIG2.
|
|
2483
|
+
const lib = Object.keys(LIBRARY).length ? {} : CONFIG2.svg;
|
|
2484
|
+
for (const key in LIBRARY) lib[key] = CONFIG2.svg[key];
|
|
2479
2485
|
appendSVG(lib, options);
|
|
2480
2486
|
};
|
|
2481
2487
|
var setSvgIcon = (val, key) => {
|
|
2482
2488
|
const CONFIG2 = getActiveConfig();
|
|
2483
|
-
if (CONFIG2.useIconSprite && !CONFIG2.
|
|
2489
|
+
if (CONFIG2.useIconSprite && !CONFIG2.semantic_icons?.[key]) {
|
|
2484
2490
|
return setSVG(val, key);
|
|
2485
2491
|
}
|
|
2486
2492
|
return val;
|
|
2487
2493
|
};
|
|
2488
2494
|
var appendSvgIconsSprite = (LIBRARY, options = DEF_OPTIONS) => {
|
|
2489
2495
|
const CONFIG2 = getActiveConfig();
|
|
2490
|
-
const lib = Object.keys(LIBRARY).length ? {} : CONFIG2.
|
|
2491
|
-
for (const key in LIBRARY) lib[key] = CONFIG2.
|
|
2496
|
+
const lib = Object.keys(LIBRARY).length ? {} : CONFIG2.icons;
|
|
2497
|
+
for (const key in LIBRARY) lib[key] = CONFIG2.icons[key];
|
|
2492
2498
|
appendSVG(lib, options);
|
|
2493
2499
|
};
|
|
2494
2500
|
var createSVGSpriteElement = (options = { isRoot: true }) => {
|
|
@@ -2529,13 +2535,13 @@ var SmblsScratch = (() => {
|
|
|
2529
2535
|
|
|
2530
2536
|
// src/system/reset.js
|
|
2531
2537
|
init_esm();
|
|
2532
|
-
var applyReset = (
|
|
2538
|
+
var applyReset = (reset2 = {}) => {
|
|
2533
2539
|
const CONFIG2 = getActiveConfig();
|
|
2534
|
-
const {
|
|
2535
|
-
if (
|
|
2536
|
-
if (
|
|
2537
|
-
const configReset =
|
|
2538
|
-
const configTemplates =
|
|
2540
|
+
const { reset: RESET, typography: TYPOGRAPHY, document: DOCUMENT } = CONFIG2;
|
|
2541
|
+
if (RESET) {
|
|
2542
|
+
if (RESET[":root"]) {
|
|
2543
|
+
const configReset = RESET;
|
|
2544
|
+
const configTemplates = TYPOGRAPHY.templates;
|
|
2539
2545
|
configReset.body = {
|
|
2540
2546
|
...CONFIG2.useDocumentTheme ? getMediaTheme("document") : {},
|
|
2541
2547
|
...configTemplates.body
|
|
@@ -2547,10 +2553,10 @@ var SmblsScratch = (() => {
|
|
|
2547
2553
|
configReset.h5 = configTemplates.h5;
|
|
2548
2554
|
configReset.h6 = configTemplates.h6;
|
|
2549
2555
|
}
|
|
2550
|
-
const { body, ...
|
|
2556
|
+
const { body, ...templates2 } = TYPOGRAPHY.templates;
|
|
2551
2557
|
const globalTheme = CONFIG2.useDocumentTheme ? getMediaTheme("document") : {};
|
|
2552
|
-
if (
|
|
2553
|
-
return deepMerge(merge(
|
|
2558
|
+
if (RESET.html) overwriteDeep(RESET.html, globalTheme);
|
|
2559
|
+
return deepMerge(merge(RESET, reset2), {
|
|
2554
2560
|
html: {
|
|
2555
2561
|
position: "absolute",
|
|
2556
2562
|
// overflow: 'hidden',
|
|
@@ -2562,17 +2568,17 @@ var SmblsScratch = (() => {
|
|
|
2562
2568
|
WebkitFontSmoothing: "subpixel-antialiased",
|
|
2563
2569
|
scrollBehavior: "smooth",
|
|
2564
2570
|
...globalTheme,
|
|
2565
|
-
fontSize:
|
|
2566
|
-
fontFamily:
|
|
2567
|
-
lineHeight:
|
|
2571
|
+
fontSize: TYPOGRAPHY.browserDefault + "px",
|
|
2572
|
+
fontFamily: DOCUMENT.fontFamily,
|
|
2573
|
+
lineHeight: DOCUMENT.lineHeight
|
|
2568
2574
|
},
|
|
2569
2575
|
body: {
|
|
2570
2576
|
boxSizing: "border-box",
|
|
2571
2577
|
height: "100%",
|
|
2572
2578
|
margin: 0,
|
|
2573
|
-
fontFamily:
|
|
2574
|
-
fontSize:
|
|
2575
|
-
...
|
|
2579
|
+
fontFamily: DOCUMENT.fontFamily,
|
|
2580
|
+
fontSize: TYPOGRAPHY.base / TYPOGRAPHY.browserDefault + CONFIG2.unit.default,
|
|
2581
|
+
...templates2,
|
|
2576
2582
|
...body
|
|
2577
2583
|
},
|
|
2578
2584
|
a: {
|
|
@@ -2585,7 +2591,7 @@ var SmblsScratch = (() => {
|
|
|
2585
2591
|
margin: 0
|
|
2586
2592
|
},
|
|
2587
2593
|
"select, input": {
|
|
2588
|
-
fontFamily:
|
|
2594
|
+
fontFamily: DOCUMENT.fontFamily
|
|
2589
2595
|
}
|
|
2590
2596
|
});
|
|
2591
2597
|
}
|
|
@@ -2634,10 +2640,10 @@ var SmblsScratch = (() => {
|
|
|
2634
2640
|
if (isCSSVar(v)) return `var(${v})`;
|
|
2635
2641
|
if (isBorderStyle(v)) return v;
|
|
2636
2642
|
if (/^\d/.test(v) || v === "0") return v;
|
|
2637
|
-
const
|
|
2638
|
-
if (isResolvedColor(
|
|
2639
|
-
const
|
|
2640
|
-
if (
|
|
2643
|
+
const color2 = getColor(v);
|
|
2644
|
+
if (isResolvedColor(color2)) return color2;
|
|
2645
|
+
const spacing2 = getSpacingByKey(v, "border");
|
|
2646
|
+
if (spacing2 && spacing2.border) return spacing2.border;
|
|
2641
2647
|
return v;
|
|
2642
2648
|
}).join(" ");
|
|
2643
2649
|
};
|
|
@@ -2648,24 +2654,24 @@ var SmblsScratch = (() => {
|
|
|
2648
2654
|
if (!v) return "";
|
|
2649
2655
|
if (isCSSVar(v)) return `var(${v})`;
|
|
2650
2656
|
if (/^\d/.test(v) || v.includes("px") || v === "0") return v;
|
|
2651
|
-
const
|
|
2652
|
-
if (isResolvedColor(
|
|
2657
|
+
const color2 = getColor(v);
|
|
2658
|
+
if (isResolvedColor(color2)) return color2;
|
|
2653
2659
|
return v;
|
|
2654
2660
|
}).join(" ");
|
|
2655
2661
|
};
|
|
2656
2662
|
var transformShadow = (sh, globalTheme) => getShadow(sh, globalTheme);
|
|
2657
2663
|
var transformBoxShadow = (shadows, globalTheme) => {
|
|
2658
2664
|
if (CSS_NATIVE_COLOR_REGEX.test(shadows)) return shadows;
|
|
2659
|
-
return splitTopLevelCommas(shadows).map((
|
|
2660
|
-
|
|
2661
|
-
if (!
|
|
2662
|
-
return
|
|
2665
|
+
return splitTopLevelCommas(shadows).map((shadow2) => {
|
|
2666
|
+
shadow2 = shadow2.trim();
|
|
2667
|
+
if (!shadow2) return "";
|
|
2668
|
+
return shadow2.split(/\s+/).map((v) => {
|
|
2663
2669
|
v = v.trim();
|
|
2664
2670
|
if (!v) return "";
|
|
2665
2671
|
if (isCSSVar(v)) return `var(${v})`;
|
|
2666
2672
|
if (v === "inset" || v === "none") return v;
|
|
2667
|
-
const
|
|
2668
|
-
if (isResolvedColor(
|
|
2673
|
+
const color2 = getColor(v);
|
|
2674
|
+
if (isResolvedColor(color2)) {
|
|
2669
2675
|
const mediaColor = getMediaColor(v, globalTheme);
|
|
2670
2676
|
if (isObject(mediaColor))
|
|
2671
2677
|
return Object.values(mediaColor).filter(
|
|
@@ -2674,17 +2680,17 @@ var SmblsScratch = (() => {
|
|
|
2674
2680
|
return mediaColor;
|
|
2675
2681
|
}
|
|
2676
2682
|
if (/^\d/.test(v) || v === "0" || v.includes("px") || v.slice(-2) === "em") return v;
|
|
2677
|
-
const
|
|
2678
|
-
if (
|
|
2683
|
+
const spacing2 = getSpacingByKey(v, "shadow");
|
|
2684
|
+
if (spacing2 && spacing2.shadow) return spacing2.shadow;
|
|
2679
2685
|
return v;
|
|
2680
2686
|
}).join(" ");
|
|
2681
2687
|
}).join(", ");
|
|
2682
2688
|
};
|
|
2683
|
-
var resolveColorsInGradient = (
|
|
2684
|
-
const parenStart =
|
|
2685
|
-
if (parenStart === -1) return
|
|
2686
|
-
const prefix =
|
|
2687
|
-
const inner =
|
|
2689
|
+
var resolveColorsInGradient = (gradient2, globalTheme) => {
|
|
2690
|
+
const parenStart = gradient2.indexOf("(");
|
|
2691
|
+
if (parenStart === -1) return gradient2;
|
|
2692
|
+
const prefix = gradient2.slice(0, parenStart + 1);
|
|
2693
|
+
const inner = gradient2.slice(parenStart + 1, gradient2.lastIndexOf(")"));
|
|
2688
2694
|
const suffix = ")";
|
|
2689
2695
|
const segments = splitTopLevelCommas(inner);
|
|
2690
2696
|
const resolved = segments.map((segment) => {
|
|
@@ -2696,8 +2702,8 @@ var SmblsScratch = (() => {
|
|
|
2696
2702
|
if (GRADIENT_KEYWORDS.has(token)) return token;
|
|
2697
2703
|
if (token === "transparent") return token;
|
|
2698
2704
|
if (CSS_NATIVE_COLOR_REGEX.test(token)) return token;
|
|
2699
|
-
const
|
|
2700
|
-
if (isResolvedColor(
|
|
2705
|
+
const color2 = getColor(token);
|
|
2706
|
+
if (isResolvedColor(color2)) return color2;
|
|
2701
2707
|
return token;
|
|
2702
2708
|
}).join(" ");
|
|
2703
2709
|
});
|
|
@@ -2709,7 +2715,7 @@ var SmblsScratch = (() => {
|
|
|
2709
2715
|
if (isCSSVar(v)) return `var(${v})`;
|
|
2710
2716
|
if (v.includes("url")) return v;
|
|
2711
2717
|
if (v.includes("gradient")) return resolveColorsInGradient(v, globalTheme);
|
|
2712
|
-
else if (CONFIG2.
|
|
2718
|
+
else if (CONFIG2.gradient[backgroundImage]) {
|
|
2713
2719
|
return {
|
|
2714
2720
|
backgroundImage: getMediaColor(
|
|
2715
2721
|
backgroundImage,
|
|
@@ -2786,9 +2792,11 @@ var SmblsScratch = (() => {
|
|
|
2786
2792
|
gradient: setGradient,
|
|
2787
2793
|
font: setFont,
|
|
2788
2794
|
font_family: setFontFamily,
|
|
2795
|
+
fontfamily: setFontFamily,
|
|
2789
2796
|
theme: setTheme,
|
|
2790
2797
|
icons: setSvgIcon,
|
|
2791
2798
|
semantic_icons: setSameValue,
|
|
2799
|
+
semanticicons: setSameValue,
|
|
2792
2800
|
svg: setSVG,
|
|
2793
2801
|
svg_data: setSameValue,
|
|
2794
2802
|
typography: setSameValue,
|
|
@@ -2845,8 +2853,9 @@ var SmblsScratch = (() => {
|
|
|
2845
2853
|
globalTheme,
|
|
2846
2854
|
useDocumentTheme,
|
|
2847
2855
|
useDefaultConfig,
|
|
2848
|
-
|
|
2849
|
-
|
|
2856
|
+
semanticIcons,
|
|
2857
|
+
SEMANTIC_ICONS,
|
|
2858
|
+
semantic_icons: semantic_icons2,
|
|
2850
2859
|
files,
|
|
2851
2860
|
...config
|
|
2852
2861
|
} = recivedConfig;
|
|
@@ -2864,9 +2873,10 @@ var SmblsScratch = (() => {
|
|
|
2864
2873
|
if (globalTheme !== void 0) CONFIG2.globalTheme = globalTheme;
|
|
2865
2874
|
if (recivedConfig.useThemeSuffixedVars !== void 0) CONFIG2.useThemeSuffixedVars = recivedConfig.useThemeSuffixedVars;
|
|
2866
2875
|
if (useDefaultConfig !== void 0) CONFIG2.useDefaultConfig = useDefaultConfig;
|
|
2867
|
-
const _semanticIcons =
|
|
2876
|
+
const _semanticIcons = semanticIcons || SEMANTIC_ICONS || semantic_icons2;
|
|
2868
2877
|
if (_semanticIcons !== void 0) {
|
|
2869
2878
|
CONFIG2.semantic_icons = _semanticIcons;
|
|
2879
|
+
CONFIG2.semanticIcons = CONFIG2.semantic_icons;
|
|
2870
2880
|
CONFIG2.SEMANTIC_ICONS = CONFIG2.semantic_icons;
|
|
2871
2881
|
}
|
|
2872
2882
|
if (CONFIG2.verbose) console.log(CONFIG2);
|
|
@@ -2884,21 +2894,21 @@ var SmblsScratch = (() => {
|
|
|
2884
2894
|
if (lower !== key && keySet.has(lower)) return;
|
|
2885
2895
|
return setEach(key, config[key]);
|
|
2886
2896
|
});
|
|
2887
|
-
if (config.
|
|
2897
|
+
if (config.typography || config.TYPOGRAPHY) {
|
|
2888
2898
|
try {
|
|
2889
2899
|
applyTypographySequence();
|
|
2890
2900
|
} catch (e) {
|
|
2891
2901
|
if (CONFIG2.verbose) console.warn("Error applying typography sequence", e);
|
|
2892
2902
|
}
|
|
2893
2903
|
}
|
|
2894
|
-
if (config.
|
|
2904
|
+
if (config.spacing || config.SPACING) {
|
|
2895
2905
|
try {
|
|
2896
2906
|
applySpacingSequence();
|
|
2897
2907
|
} catch (e) {
|
|
2898
2908
|
if (CONFIG2.verbose) console.warn("Error applying spacing sequence", e);
|
|
2899
2909
|
}
|
|
2900
2910
|
}
|
|
2901
|
-
if (config.
|
|
2911
|
+
if (config.timing || config.TIMING) {
|
|
2902
2912
|
try {
|
|
2903
2913
|
applyTimingSequence();
|
|
2904
2914
|
} catch (e) {
|