@codeleap/styles 7.0.0 → 7.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. package/dist/classes/Cacher.js +170 -0
  2. package/dist/classes/Cacher.js.map +1 -0
  3. package/dist/classes/StaleControl.js +105 -0
  4. package/dist/classes/StaleControl.js.map +1 -0
  5. package/dist/classes/StyleCache.js +95 -0
  6. package/dist/classes/StyleCache.js.map +1 -0
  7. package/dist/classes/StylePersistor.js +58 -0
  8. package/dist/classes/StylePersistor.js.map +1 -0
  9. package/dist/classes/StyleRegistry.js +474 -0
  10. package/dist/classes/StyleRegistry.js.map +1 -0
  11. package/dist/classes/index.js +19 -0
  12. package/dist/classes/index.js.map +1 -0
  13. package/dist/constants.js +27 -0
  14. package/dist/constants.js.map +1 -0
  15. package/dist/hooks/index.js +21 -0
  16. package/dist/hooks/index.js.map +1 -0
  17. package/dist/hooks/useCompositionStyles.js +30 -0
  18. package/dist/hooks/useCompositionStyles.js.map +1 -0
  19. package/dist/hooks/useNestedStylesByKey.js +20 -0
  20. package/dist/hooks/useNestedStylesByKey.js.map +1 -0
  21. package/dist/hooks/useStyleObserver.js +26 -0
  22. package/dist/hooks/useStyleObserver.js.map +1 -0
  23. package/dist/hooks/useTheme.js +28 -0
  24. package/dist/hooks/useTheme.js.map +1 -0
  25. package/dist/index.js +28 -0
  26. package/dist/index.js.map +1 -0
  27. package/dist/lib/calc.js +48 -0
  28. package/dist/lib/calc.js.map +1 -0
  29. package/dist/lib/createStyles.js +63 -0
  30. package/dist/lib/createStyles.js.map +1 -0
  31. package/dist/lib/createTheme.js +147 -0
  32. package/dist/lib/createTheme.js.map +1 -0
  33. package/dist/lib/cssVariables.js +79 -0
  34. package/dist/lib/cssVariables.js.map +1 -0
  35. package/dist/lib/index.js +18 -0
  36. package/dist/lib/index.js.map +1 -0
  37. package/dist/theme/generateColorScheme.js +41 -0
  38. package/dist/theme/generateColorScheme.js.map +1 -0
  39. package/dist/theme/index.js +20 -0
  40. package/dist/theme/index.js.map +1 -0
  41. package/dist/theme/themeStore.d.ts +4 -4
  42. package/dist/theme/themeStore.d.ts.map +1 -1
  43. package/dist/theme/themeStore.js +143 -0
  44. package/dist/theme/themeStore.js.map +1 -0
  45. package/dist/theme/validateTheme.js +36 -0
  46. package/dist/theme/validateTheme.js.map +1 -0
  47. package/dist/tools/colors.js +147 -0
  48. package/dist/tools/colors.js.map +1 -0
  49. package/dist/tools/deepClone.js +14 -0
  50. package/dist/tools/deepClone.js.map +1 -0
  51. package/dist/tools/deepmerge.js +20 -0
  52. package/dist/tools/deepmerge.js.map +1 -0
  53. package/dist/tools/hashKey.js +20 -0
  54. package/dist/tools/hashKey.js.map +1 -0
  55. package/dist/tools/index.js +46 -0
  56. package/dist/tools/index.js.map +1 -0
  57. package/dist/tools/minifier.js +39 -0
  58. package/dist/tools/minifier.js.map +1 -0
  59. package/dist/tools/multiplierProperty.js +12 -0
  60. package/dist/tools/multiplierProperty.js.map +1 -0
  61. package/dist/types/cache.js +3 -0
  62. package/dist/types/cache.js.map +1 -0
  63. package/dist/types/component.js +3 -0
  64. package/dist/types/component.js.map +1 -0
  65. package/dist/types/core.js +4 -0
  66. package/dist/types/core.js.map +1 -0
  67. package/dist/types/icon.js +4 -0
  68. package/dist/types/icon.js.map +1 -0
  69. package/dist/types/index.js +22 -0
  70. package/dist/types/index.js.map +1 -0
  71. package/dist/types/spacing.js +31 -0
  72. package/dist/types/spacing.js.map +1 -0
  73. package/dist/types/store.js +3 -0
  74. package/dist/types/store.js.map +1 -0
  75. package/dist/types/style.js +3 -0
  76. package/dist/types/style.js.map +1 -0
  77. package/dist/types/theme.js +3 -0
  78. package/dist/types/theme.js.map +1 -0
  79. package/dist/utils.js +105 -0
  80. package/dist/utils.js.map +1 -0
  81. package/dist/variants/borderCreator.js +30 -0
  82. package/dist/variants/borderCreator.js.map +1 -0
  83. package/dist/variants/createAppVariants.js +20 -0
  84. package/dist/variants/createAppVariants.js.map +1 -0
  85. package/dist/variants/defaultVariants.js +140 -0
  86. package/dist/variants/defaultVariants.js.map +1 -0
  87. package/dist/variants/dynamicVariants.js +93 -0
  88. package/dist/variants/dynamicVariants.js.map +1 -0
  89. package/dist/variants/index.js +23 -0
  90. package/dist/variants/index.js.map +1 -0
  91. package/dist/variants/mediaQuery.js +59 -0
  92. package/dist/variants/mediaQuery.js.map +1 -0
  93. package/dist/variants/spacing.js +84 -0
  94. package/dist/variants/spacing.js.map +1 -0
  95. package/package.json +3 -3
@@ -0,0 +1,143 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.themeStoreComputed = exports.themeStore = exports.ThemeStore = void 0;
4
+ const nanostores_1 = require("nanostores");
5
+ /**
6
+ * Global theme store that manages application theme, color schemes, and variants.
7
+ * Uses nanostores for reactive state management.
8
+ */
9
+ class ThemeStore {
10
+ constructor() {
11
+ this.alternateColorsSchemeStore = (0, nanostores_1.map)({});
12
+ this.colorSchemeStore = (0, nanostores_1.atom)(null);
13
+ this.themeStore = (0, nanostores_1.atom)(null);
14
+ this.variantsStore = (0, nanostores_1.map)({});
15
+ }
16
+ /**
17
+ * Gets the current theme.
18
+ * @returns {ITheme | null} Current theme or null if not set
19
+ */
20
+ get theme() {
21
+ return this.themeStore.get();
22
+ }
23
+ /**
24
+ * Gets the current theme with typed interface.
25
+ * @returns {AppTheme<Theme>} Current theme cast to AppTheme type
26
+ */
27
+ get themeTyped() {
28
+ const theme = this.themeStore.get();
29
+ return theme ? theme : null;
30
+ }
31
+ /**
32
+ * Gets the current color scheme name.
33
+ * @returns {string | null} Current color scheme name or null if not set
34
+ */
35
+ get colorScheme() {
36
+ return this.colorSchemeStore.get();
37
+ }
38
+ /**
39
+ * Gets the current variants configuration.
40
+ * @returns {IAppVariants} Current variants object
41
+ */
42
+ get variants() {
43
+ return this.variantsStore.get();
44
+ }
45
+ /**
46
+ * Gets all alternate color schemes.
47
+ * @returns {{ [key: string]: ColorMap }} Object containing all alternate color schemes
48
+ */
49
+ get alternateColorsScheme() {
50
+ var _a;
51
+ return (_a = this.alternateColorsSchemeStore.get()) !== null && _a !== void 0 ? _a : {};
52
+ }
53
+ /**
54
+ * Sets the variants configuration.
55
+ * @template T
56
+ * @param {T} variants - Variants configuration to set
57
+ */
58
+ setVariants(variants) {
59
+ this.variantsStore.set(variants);
60
+ }
61
+ /**
62
+ * Sets the current color scheme.
63
+ * @param {string} colorScheme - Color scheme name to set
64
+ */
65
+ setColorScheme(colorScheme) {
66
+ this.colorSchemeStore.set(colorScheme);
67
+ }
68
+ /**
69
+ * Sets the current theme.
70
+ * @param {ITheme} theme - Theme object to set
71
+ */
72
+ setTheme(theme) {
73
+ this.themeStore.set(theme);
74
+ }
75
+ /**
76
+ * Sets all alternate color schemes.
77
+ * @param {{ [key: string]: ColorMap }} colors - Object containing color schemes
78
+ */
79
+ setAlternateColorsScheme(colors) {
80
+ this.alternateColorsSchemeStore.set(colors);
81
+ }
82
+ /**
83
+ * Gets the base color scheme colors (first available scheme).
84
+ * @private
85
+ * @returns {ColorMap} Base color scheme colors
86
+ */
87
+ getBaseSchemeColors() {
88
+ var _a, _b;
89
+ const alternateColors = (_a = this.alternateColorsScheme) !== null && _a !== void 0 ? _a : {};
90
+ const colorSchemeKeys = Object.keys(alternateColors);
91
+ if (colorSchemeKeys.length === 0) {
92
+ return {};
93
+ }
94
+ return (_b = alternateColors[colorSchemeKeys[0]]) !== null && _b !== void 0 ? _b : {};
95
+ }
96
+ /**
97
+ * Injects a new color scheme, merging with base scheme colors.
98
+ * @param {string} name - Name of the color scheme
99
+ * @param {ColorMap} colors - Color map to inject
100
+ * @returns {{ [key: string]: ColorMap }} Updated alternate colors object
101
+ */
102
+ injectColorScheme(name, colors) {
103
+ var _a;
104
+ const baseSchemeColors = this.getBaseSchemeColors();
105
+ const currentAlternateColors = (_a = this.alternateColorsScheme) !== null && _a !== void 0 ? _a : {};
106
+ const alternateColors = Object.assign(Object.assign({}, currentAlternateColors), { [name]: Object.assign(Object.assign({}, baseSchemeColors), colors) });
107
+ this.setAlternateColorsScheme(alternateColors);
108
+ return alternateColors;
109
+ }
110
+ /**
111
+ * Removes a color scheme by name.
112
+ * @param {string} name - Name of the color scheme to remove
113
+ * @returns {{ [key: string]: ColorMap }} Updated alternate colors object
114
+ */
115
+ ejectColorScheme(name) {
116
+ var _a;
117
+ const currentAlternateColors = (_a = this.alternateColorsScheme) !== null && _a !== void 0 ? _a : {};
118
+ if (name in currentAlternateColors) {
119
+ delete currentAlternateColors[name];
120
+ }
121
+ this.setAlternateColorsScheme(currentAlternateColors);
122
+ return currentAlternateColors;
123
+ }
124
+ }
125
+ exports.ThemeStore = ThemeStore;
126
+ /**
127
+ * Global theme store instance.
128
+ */
129
+ exports.themeStore = new ThemeStore();
130
+ /**
131
+ * Derived nanostores `computed` that combines `themeStore` and `colorSchemeStore`
132
+ * into a single `ThemeState` atom. Components subscribe to this via `useTheme`
133
+ * so they re-render only when either the theme object or the active color scheme
134
+ * changes — not on every `ThemeStore` method call.
135
+ */
136
+ exports.themeStoreComputed = (0, nanostores_1.computed)([
137
+ exports.themeStore.themeStore,
138
+ exports.themeStore.colorSchemeStore,
139
+ ], (theme, colorScheme) => ({
140
+ theme: theme,
141
+ colorScheme,
142
+ }));
143
+ //# sourceMappingURL=themeStore.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"themeStore.js","sourceRoot":"","sources":["../../src/theme/themeStore.ts"],"names":[],"mappings":";;;AACA,2CAAgD;AAUhD;;;GAGG;AACH,MAAa,UAAU;IAAvB;QACmB,+BAA0B,GAAG,IAAA,gBAAG,EAA8B,EAAE,CAAC,CAAA;QAElE,qBAAgB,GAAG,IAAA,iBAAI,EAAgB,IAAI,CAAC,CAAA;QAE5C,eAAU,GAAG,IAAA,iBAAI,EAAgB,IAAI,CAAC,CAAA;QAEtC,kBAAa,GAAG,IAAA,gBAAG,EAAe,EAAkB,CAAC,CAAA;IAoIvE,CAAC;IAl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 exports.validateTheme = validateTheme;
4
+ /**
5
+ * Validates and normalizes a theme object.
6
+ * Ensures all alternate color schemes include the same keys as `colors`,
7
+ * and merges `baseColors` into `colors` and `alternateColors`.
8
+ *
9
+ * @template T extends Theme
10
+ * @param {T} theme - The theme to validate.
11
+ * @throws {Error} If an alternate scheme is missing a required color.
12
+ * @returns {T & {
13
+ * alternateColors: Record<string, Record<string, string>>,
14
+ * colors: Record<string, string>
15
+ * }} The validated theme with merged colors.
16
+ */
17
+ function validateTheme(theme) {
18
+ const baseColors = theme.baseColors;
19
+ const colors = theme.colors;
20
+ const alternateColors = theme.alternateColors;
21
+ const requiredColors = Object.keys(colors);
22
+ const mergedAlternateColors = {};
23
+ if (alternateColors) {
24
+ for (const [colorSchemeName, colorSchemeColors] of Object.entries(alternateColors)) {
25
+ const colorSchemeColorNames = Object.keys(colorSchemeColors);
26
+ for (const requiredColor of requiredColors) {
27
+ if (!colorSchemeColorNames.includes(requiredColor)) {
28
+ throw new Error(`Alternate color scheme ${colorSchemeName} is missing color ${requiredColor}`);
29
+ }
30
+ }
31
+ mergedAlternateColors[colorSchemeName] = Object.assign(Object.assign({}, baseColors), colorSchemeColors);
32
+ }
33
+ }
34
+ return Object.assign(Object.assign({}, theme), { alternateColors: mergedAlternateColors, colors: Object.assign(Object.assign({}, baseColors), colors) });
35
+ }
36
+ //# sourceMappingURL=validateTheme.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validateTheme.js","sourceRoot":"","sources":["../../src/theme/validateTheme.ts"],"names":[],"mappings":";;AAeA,sCAoCC;AAjDD;;;;;;;;;;;;GAYG;AACH,SAAgB,aAAa,CAAkB,KAAQ;IACrD,MAAM,UAAU,GAAG,KAAK,CAAC,UAAU,CAAA;IAEnC,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAA;IAE3B,MAAM,eAAe,GAAG,KAAK,CAAC,eAAe,CAAA;IAE7C,MAAM,cAAc,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IAE1C,MAAM,qBAAqB,GAAwB,EAAE,CAAA;IAErD,IAAI,eAAe,EAAE,CAAC;QACpB,KAAK,MAAM,CAAC,eAAe,EAAE,iBAAiB,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,eAAe,CAAC,EAAE,CAAC;YACnF,MAAM,qBAAqB,GAAG,MAAM,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAA;YAE5D,KAAK,MAAM,aAAa,IAAI,cAAc,EAAE,CAAC;gBAC3C,IAAI,CAAC,qBAAqB,CAAC,QAAQ,CAAC,aAAa,CAAC,EAAE,CAAC;oBACnD,MAAM,IAAI,KAAK,CAAC,0BAA0B,eAAe,qBAAqB,aAAa,EAAE,CAAC,CAAA;gBAChG,CAAC;YACH,CAAC;YAED,qBAAqB,CAAC,eAAe,CAAC,mCACjC,UAAU,GACV,iBAAiB,CACrB,CAAA;QACH,CAAC;IACH,CAAC;IAED,uCACK,KAAK,KACR,eAAe,EAAE,qBAAqB,EACtC,MAAM,kCACD,UAAU,GACV,MAAM,KAEZ;AACH,CAAC"}
@@ -0,0 +1,147 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.hexToHSL = hexToHSL;
4
+ exports.hslToHex = hslToHex;
5
+ exports.hexToRGB = hexToRGB;
6
+ exports.hslToRGB = hslToRGB;
7
+ exports.rgbToHSL = rgbToHSL;
8
+ exports.getLuminance = getLuminance;
9
+ exports.getTextColor = getTextColor;
10
+ /**
11
+ * Expects a 7-character hex string (`#rrggbb`). Shorter forms (3-char, no hash) are
12
+ * not handled and will produce NaN channels. Returns h in [0, 360], s and l in [0, 100],
13
+ * all rounded to integers via `Math.round`.
14
+ */
15
+ function hexToHSL(hex) {
16
+ const r = parseInt(hex.slice(1, 3), 16) / 255;
17
+ const g = parseInt(hex.slice(3, 5), 16) / 255;
18
+ const b = parseInt(hex.slice(5, 7), 16) / 255;
19
+ const max = Math.max(r, g, b), min = Math.min(r, g, b);
20
+ let h = 0, s = 0, l = (max + min) / 2;
21
+ if (max !== min) {
22
+ const d = max - min;
23
+ s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
24
+ switch (max) {
25
+ case r:
26
+ h = (g - b) / d + (g < b ? 6 : 0);
27
+ break;
28
+ case g:
29
+ h = (b - r) / d + 2;
30
+ break;
31
+ case b:
32
+ h = (r - g) / d + 4;
33
+ break;
34
+ }
35
+ h /= 6;
36
+ }
37
+ return {
38
+ h: Math.round(h * 360),
39
+ s: Math.round(s * 100),
40
+ l: Math.round(l * 100),
41
+ };
42
+ }
43
+ /**
44
+ * Uses the HSL-to-RGB CSS Color 4 formula (single-pass, no separate hue helper).
45
+ * Inputs h in [0, 360], s and l in [0, 100]; channels are clamped implicitly by
46
+ * `Math.min`/`Math.max`. Each channel is individually rounded before hex encoding,
47
+ * so the round-trip `hexToHSL → hslToHex` may differ by ±1 in the last hex digit.
48
+ */
49
+ function hslToHex(h, s, l) {
50
+ s /= 100;
51
+ l /= 100;
52
+ const k = (n) => (n + h / 30) % 12;
53
+ const a = s * Math.min(l, 1 - l);
54
+ const f = (n) => Math.round(255 * (l - a * Math.max(-1, Math.min(k(n) - 3, Math.min(9 - k(n), 1)))));
55
+ return `#${[f(0), f(8), f(4)].map(x => x.toString(16).padStart(2, '0')).join('')}`;
56
+ }
57
+ /**
58
+ * Parses only the 6-digit `#rrggbb` form via `parseInt(..., 16)`.
59
+ * No alpha channel is extracted. Channels are returned as integers in [0, 255].
60
+ */
61
+ function hexToRGB(hex) {
62
+ const r = parseInt(hex.slice(1, 3), 16);
63
+ const g = parseInt(hex.slice(3, 5), 16);
64
+ const b = parseInt(hex.slice(5, 7), 16);
65
+ return { r, g, b };
66
+ }
67
+ /**
68
+ * Shares the same formula as `hslToHex` but returns separate integer r/g/b channels
69
+ * instead of a hex string. Useful when you need numeric channels for `rgba(...)` output.
70
+ * Input ranges: h [0, 360], s [0, 100], l [0, 100].
71
+ */
72
+ function hslToRGB(h, s, l) {
73
+ s /= 100;
74
+ l /= 100;
75
+ const k = (n) => (n + h / 30) % 12;
76
+ const a = s * Math.min(l, 1 - l);
77
+ const f = (n) => Math.round(255 * (l - a * Math.max(-1, Math.min(k(n) - 3, Math.min(9 - k(n), 1)))));
78
+ return {
79
+ r: f(0),
80
+ g: f(8),
81
+ b: f(4),
82
+ };
83
+ }
84
+ /**
85
+ * Inverse of `hslToRGB`. Normalises each channel from [0, 255] to [0, 1] before
86
+ * computing. When max === min (achromatic), hue is fixed at 0. All output values are
87
+ * rounded, so the round-trip `hslToRGB → rgbToHSL` is not guaranteed to be lossless.
88
+ */
89
+ function rgbToHSL(rgb) {
90
+ const r = rgb.r / 255;
91
+ const g = rgb.g / 255;
92
+ const b = rgb.b / 255;
93
+ const max = Math.max(r, g, b);
94
+ const min = Math.min(r, g, b);
95
+ let h = 0;
96
+ let s = 0;
97
+ const l = (max + min) / 2;
98
+ if (max !== min) {
99
+ const d = max - min;
100
+ s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
101
+ switch (max) {
102
+ case r:
103
+ h = (g - b) / d + (g < b ? 6 : 0);
104
+ break;
105
+ case g:
106
+ h = (b - r) / d + 2;
107
+ break;
108
+ case b:
109
+ h = (r - g) / d + 4;
110
+ break;
111
+ }
112
+ h /= 6;
113
+ }
114
+ return {
115
+ h: Math.round(h * 360),
116
+ s: Math.round(s * 100),
117
+ l: Math.round(l * 100)
118
+ };
119
+ }
120
+ /**
121
+ * Implements WCAG 2.x relative luminance (https://www.w3.org/TR/WCAG20/#relativeluminancedef).
122
+ * Channels are linearised with the sRGB transfer function: values ≤ 0.03928 use
123
+ * the linear segment (C / 12.92); values above use the gamma curve ((C + 0.055) / 1.055)^2.4.
124
+ * The luminance coefficients are 0.2126 R + 0.7152 G + 0.0722 B, reflecting the
125
+ * eye's greater sensitivity to green. Returns a value in [0, 1].
126
+ */
127
+ function getLuminance({ r, g, b }) {
128
+ const [R, G, B] = [r, g, b].map(c => {
129
+ const channel = c / 255;
130
+ return channel <= 0.03928
131
+ ? channel / 12.92
132
+ : Math.pow((channel + 0.055) / 1.055, 2.4);
133
+ });
134
+ return 0.2126 * R + 0.7152 * G + 0.0722 * B;
135
+ }
136
+ /**
137
+ * Uses a luminance threshold of **0.5** (not the WCAG 4.5:1 contrast ratio) to pick
138
+ * between two text colours. Backgrounds with luminance > 0.5 are treated as light and
139
+ * receive `darkColor`; all others receive `lightColor`. This is a perceptual shortcut —
140
+ * use explicit contrast-ratio checks for accessibility-critical situations.
141
+ */
142
+ function getTextColor(backgroundHex, darkColor = 'black', lightColor = 'white') {
143
+ const rgb = hexToRGB(backgroundHex);
144
+ const luminance = getLuminance(rgb);
145
+ return luminance > 0.5 ? darkColor : lightColor;
146
+ }
147
+ //# sourceMappingURL=colors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"colors.js","sourceRoot":"","sources":["../../src/tools/colors.ts"],"names":[],"mappings":";;AAKA,4BAwBC;AAQD,4BASC;AAMD,4BAKC;AAOD,4BAaC;AAOD,4BAmCC;AASD,oCASC;AAQD,oCAIC;AArJD;;;;GAIG;AACH,SAAgB,QAAQ,CAAC,GAAW;IAClC,MAAM,CAAC,GAAG,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,CAAA;IAC7C,MAAM,CAAC,GAAG,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,CAAA;IAC7C,MAAM,CAAC,GAAG,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,CAAA;IAE7C,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAA;I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AgB,YAAY,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAuC;IAC3E,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE;QAClC,MAAM,OAAO,GAAG,CAAC,GAAG,GAAG,CAAA;QACvB,OAAO,OAAO,IAAI,OAAO;YACvB,CAAC,CAAC,OAAO,GAAG,KAAK;YACjB,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,GAAG,KAAK,CAAC,GAAG,KAAK,EAAE,GAAG,CAAC,CAAA;IAC9C,CAAC,CAAC,CAAA;IAEF,OAAO,MAAM,GAAG,CAAC,GAAG,MAAM,GAAG,CAAC,GAAG,MAAM,GAAG,CAAC,CAAA;AAC7C,CAAC;AAED;;;;;GAKG;AACH,SAAgB,YAAY,CAAC,aAAqB,EAAE,SAAS,GAAG,OAAO,EAAE,UAAU,GAAG,OAAO;IAC3F,MAAM,GAAG,GAAG,QAAQ,CAAC,aAAa,CAAC,CAAA;IACnC,MAAM,SAAS,GAAG,YAAY,CAAC,GAAG,CAAC,CAAA;IACnC,OAAO,SAAS,GAAG,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU,CAAA;AACjD,CAAC"}
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.deepClone = void 0;
7
+ const rfdc_1 = __importDefault(require("rfdc"));
8
+ /**
9
+ * rfdc clone function configured with default options (no circular-reference support,
10
+ * proto: false). Does not handle `Date`, `RegExp`, or `Buffer` fields — they are copied
11
+ * by reference. Use only on plain style/theme objects.
12
+ */
13
+ exports.deepClone = (0, rfdc_1.default)();
14
+ //# sourceMappingURL=deepClone.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deepClone.js","sourceRoot":"","sources":["../../src/tools/deepClone.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAuB;AAEvB;;;;GAIG;AACU,QAAA,SAAS,GAAG,IAAA,cAAI,GAAE,CAAA"}
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.deepmerge = void 0;
7
+ /**
8
+ * Re-exports `@fastify/deepmerge`'s factory function. Call it once with options
9
+ * (e.g., `deepmerge({ all: true })`) to obtain a variadic merge function.
10
+ * Passing `{ all: true }` merges arrays by index rather than concatenating them —
11
+ * this is the mode used throughout the style registry for variant merging.
12
+ * The returned merger is not idempotent: source properties always overwrite target.
13
+ *
14
+ * @example
15
+ * const merge = deepmerge({ all: true })
16
+ * const result = merge(base, override1, override2)
17
+ */
18
+ var deepmerge_1 = require("@fastify/deepmerge");
19
+ Object.defineProperty(exports, "deepmerge", { enumerable: true, get: function () { return __importDefault(deepmerge_1).default; } });
20
+ //# sourceMappingURL=deepmerge.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deepmerge.js","sourceRoot":"","sources":["../../src/tools/deepmerge.ts"],"names":[],"mappings":";;;;;;AAAA;;;;;;;;;;GAUG;AACH,gDAAyD;AAAhD,uHAAA,OAAO,OAAa"}
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ var _a;
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.hashKey = void 0;
5
+ const js_sha256_1 = require("js-sha256");
6
+ const styleKey = '@styles-version';
7
+ const version = (_a = require('../../package.json')) === null || _a === void 0 ? void 0 : _a.version;
8
+ /**
9
+ * Mutates the input array by appending `{ '@styles-version': <pkg.version> }` before
10
+ * hashing — meaning callers must not rely on the array being unchanged after the call.
11
+ * The version injection ensures any cache key computed against an older package version
12
+ * is automatically invalid after a library upgrade.
13
+ */
14
+ const hashKey = (value) => {
15
+ value.push({ [styleKey]: version });
16
+ const str = JSON.stringify(value);
17
+ return (0, js_sha256_1.sha256)(str);
18
+ };
19
+ exports.hashKey = hashKey;
20
+ //# sourceMappingURL=hashKey.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hashKey.js","sourceRoot":"","sources":["../../src/tools/hashKey.ts"],"names":[],"mappings":";;;;AAAA,yCAAkC;AAElC,MAAM,QAAQ,GAAG,iBAAiB,CAAA;AAClC,MAAM,OAAO,GAAG,MAAA,OAAO,CAAC,oBAAoB,CAAC,0CAAE,OAAO,CAAA;AAEtD;;;;;GAKG;AACI,MAAM,OAAO,GAAG,CAAC,KAAiB,EAAU,EAAE;IACnD,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC,CAAA;IAEnC,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAA;IAEjC,OAAO,IAAA,kBAAM,EAAC,GAAG,CAAC,CAAA;AACpB,CAAC,CAAA;AANY,QAAA,OAAO,WAMnB"}
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
36
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.colorTools = void 0;
40
+ exports.colorTools = __importStar(require("./colors"));
41
+ __exportStar(require("./hashKey"), exports);
42
+ __exportStar(require("./minifier"), exports);
43
+ __exportStar(require("./multiplierProperty"), exports);
44
+ __exportStar(require("./deepClone"), exports);
45
+ __exportStar(require("./deepmerge"), exports);
46
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uDAAsC;AACtC,4CAAyB;AACzB,6CAA0B;AAC1B,uDAAoC;AACpC,8CAA2B;AAC3B,8CAA2B"}
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.minifier = void 0;
4
+ exports.compress = compress;
5
+ exports.decompress = decompress;
6
+ const lz_string_1 = require("lz-string");
7
+ /**
8
+ * Serialises `value` with `JSON.stringify` then LZ-compresses to a Base64 string.
9
+ * Returns the value unchanged (without throwing) when it is falsy, so callers
10
+ * do not need to guard against `null`/`undefined`/`''` inputs.
11
+ * Non-serialisable values (functions, `undefined` inside objects, circular refs)
12
+ * will be silently dropped by `JSON.stringify`.
13
+ */
14
+ function compress(value) {
15
+ if (!value)
16
+ return value;
17
+ return (0, lz_string_1.compressToBase64)(JSON.stringify(value));
18
+ }
19
+ /**
20
+ * Reverses `compress`: LZ-decompresses the Base64 string then parses the JSON.
21
+ * Returns the value unchanged when falsy. Will throw if `value` is a non-empty
22
+ * string that is not valid LZ-Base64, or if the decompressed payload is not
23
+ * valid JSON — callers should guard accordingly.
24
+ */
25
+ function decompress(value) {
26
+ if (!value)
27
+ return value;
28
+ const decoded = (0, lz_string_1.decompressFromBase64)(value);
29
+ return JSON.parse(decoded);
30
+ }
31
+ /**
32
+ * Convenience namespace so callsites can import a single symbol and call
33
+ * `minifier.compress` / `minifier.decompress` without named imports.
34
+ */
35
+ exports.minifier = {
36
+ compress,
37
+ decompress,
38
+ };
39
+ //# sourceMappingURL=minifier.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"minifier.js","sourceRoot":"","sources":["../../src/tools/minifier.ts"],"names":[],"mappings":";;;AASA,4BAIC;AAQD,gCAMC;AA3BD,yCAAkE;AAElE;;;;;;GAMG;AACH,SAAgB,QAAQ,CAAC,KAAU;IACjC,IAAI,CAAC,KAAK;QAAE,OAAO,KAAK,CAAA;IAExB,OAAO,IAAA,4BAAgB,EAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAA;AAChD,CAAC;AAED;;;;;GAKG;AACH,SAAgB,UAAU,CAAC,KAAU;IACnC,IAAI,CAAC,KAAK;QAAE,OAAO,KAAK,CAAA;IAExB,MAAM,OAAO,GAAG,IAAA,gCAAoB,EAAC,KAAK,CAAC,CAAA;IAE3C,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;AAC5B,CAAC;AAED;;;GAGG;AACU,QAAA,QAAQ,GAAG;IACtB,QAAQ;IACR,UAAU;CACX,CAAA"}
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.multiplierProperty = multiplierProperty;
4
+ function multiplierProperty(base, property) {
5
+ return (multiplier) => {
6
+ const value = base * Number(multiplier);
7
+ return {
8
+ [property]: value,
9
+ };
10
+ };
11
+ }
12
+ //# sourceMappingURL=multiplierProperty.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"multiplierProperty.js","sourceRoot":"","sources":["../../src/tools/multiplierProperty.ts"],"names":[],"mappings":";;AACA,gDAWC;AAXD,SAAgB,kBAAkB,CAChC,IAAY,EACZ,QAAW;IAEX,OAAO,CAAC,UAA2B,EAAE,EAAE;QACrC,MAAM,KAAK,GAAG,IAAI,GAAG,MAAM,CAAC,UAAU,CAAC,CAAA;QAEvC,OAAO;YACL,CAAC,QAAQ,CAAC,EAAE,KAAK;SAClB,CAAA;IACH,CAAC,CAAA;AACH,CAAC"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=cache.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cache.js","sourceRoot":"","sources":["../../src/types/cache.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"component.js","sourceRoot":"","sources":["../../src/types/component.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ /* eslint-disable @typescript-eslint/no-empty-interface */
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ //# sourceMappingURL=core.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"core.js","sourceRoot":"","sources":["../../src/types/core.ts"],"names":[],"mappings":";AAAA,0DAA0D"}
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ /* eslint-disable @typescript-eslint/no-empty-interface */
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ //# sourceMappingURL=icon.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"icon.js","sourceRoot":"","sources":["../../src/types/icon.ts"],"names":[],"mappings":";AAAA,0DAA0D"}
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./core"), exports);
18
+ __exportStar(require("./style"), exports);
19
+ __exportStar(require("./theme"), exports);
20
+ __exportStar(require("./icon"), exports);
21
+ __exportStar(require("./component"), exports);
22
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yCAAsB;AACtB,0CAAuB;AACvB,0CAAuB;AACvB,yCAAsB;AACtB,8CAA2B"}
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.spacingShortVariants = exports.spacingVariants = void 0;
4
+ /**
5
+ * Long-form spacing direction suffixes used with `margin` and `padding`.
6
+ * The empty string `''` represents the un-suffixed property (e.g., `padding`).
7
+ */
8
+ exports.spacingVariants = [
9
+ 'Vertical',
10
+ 'Horizontal',
11
+ 'Bottom',
12
+ 'Top',
13
+ 'Left',
14
+ 'Right',
15
+ '',
16
+ ];
17
+ /**
18
+ * Short-form spacing direction suffixes used with `m` and `p`.
19
+ * Maps to the long-form via `shortPositionMap` inside `spacingFactory`.
20
+ * The empty string `''` represents the un-suffixed property (e.g., `p`).
21
+ */
22
+ exports.spacingShortVariants = [
23
+ 'y',
24
+ 'x',
25
+ 'b',
26
+ 't',
27
+ 'l',
28
+ 'r',
29
+ '',
30
+ ];
31
+ //# sourceMappingURL=spacing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spacing.js","sourceRoot":"","sources":["../../src/types/spacing.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACU,QAAA,eAAe,GAAG;IAC7B,UAAU;IACV,YAAY;IACZ,QAAQ;IACR,KAAK;IACL,MAAM;IACN,OAAO;IACP,EAAE;CACM,CAAA;AAEV;;;;GAIG;AACU,QAAA,oBAAoB,GAAG;IAClC,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,EAAE;CACM,CAAA"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=store.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"store.js","sourceRoot":"","sources":["../../src/types/store.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=style.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"style.js","sourceRoot":"","sources":["../../src/types/style.ts"],"names":[],"mappings":""}