@codeleap/styles 6.2.3 → 6.8.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/classes/Cacher.d.ts +87 -0
- package/dist/classes/Cacher.d.ts.map +1 -0
- package/dist/classes/StaleControl.d.ts +65 -0
- package/dist/classes/StaleControl.d.ts.map +1 -0
- package/dist/classes/StyleCache.d.ts +63 -0
- package/dist/classes/StyleCache.d.ts.map +1 -0
- package/dist/classes/StylePersistor.d.ts +52 -0
- package/dist/classes/StylePersistor.d.ts.map +1 -0
- package/dist/classes/StyleRegistry.d.ts +108 -0
- package/dist/classes/StyleRegistry.d.ts.map +1 -0
- package/dist/classes/index.d.ts +3 -0
- package/dist/classes/index.d.ts.map +1 -0
- package/dist/constants.d.ts +22 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/hooks/index.d.ts +5 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/useCompositionStyles.d.ts +12 -0
- package/dist/hooks/useCompositionStyles.d.ts.map +1 -0
- package/dist/hooks/useNestedStylesByKey.d.ts +11 -0
- package/dist/hooks/useNestedStylesByKey.d.ts.map +1 -0
- package/dist/hooks/useStyleObserver.d.ts +9 -0
- package/dist/hooks/useStyleObserver.d.ts.map +1 -0
- package/dist/hooks/useTheme.d.ts +19 -0
- package/dist/hooks/useTheme.d.ts.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/lib/calc.d.ts +27 -0
- package/dist/lib/calc.d.ts.map +1 -0
- package/dist/lib/createStyles.d.ts +30 -0
- package/dist/lib/createStyles.d.ts.map +1 -0
- package/dist/lib/createTheme.d.ts +28 -0
- package/dist/lib/createTheme.d.ts.map +1 -0
- package/dist/lib/cssVariables.d.ts +35 -0
- package/dist/lib/cssVariables.d.ts.map +1 -0
- package/dist/lib/index.d.ts +5 -0
- package/dist/lib/index.d.ts.map +1 -0
- package/dist/theme/generateColorScheme.d.ts +22 -0
- package/dist/theme/generateColorScheme.d.ts.map +1 -0
- package/dist/theme/index.d.ts +4 -0
- package/dist/theme/index.d.ts.map +1 -0
- package/dist/theme/themeStore.d.ts +106 -0
- package/dist/theme/themeStore.d.ts.map +1 -0
- package/dist/theme/validateTheme.d.ts +19 -0
- package/dist/theme/validateTheme.d.ts.map +1 -0
- package/dist/tools/colors.d.ts +70 -0
- package/dist/tools/colors.d.ts.map +1 -0
- package/dist/tools/deepClone.d.ts +7 -0
- package/dist/tools/deepClone.d.ts.map +1 -0
- package/dist/tools/deepmerge.d.ts +13 -0
- package/dist/tools/deepmerge.d.ts.map +1 -0
- package/dist/tools/hashKey.d.ts +8 -0
- package/dist/tools/hashKey.d.ts.map +1 -0
- package/dist/tools/index.d.ts +7 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/minifier.d.ts +24 -0
- package/dist/tools/minifier.d.ts.map +1 -0
- package/dist/tools/multiplierProperty.d.ts +4 -0
- package/dist/tools/multiplierProperty.d.ts.map +1 -0
- package/dist/types/cache.d.ts +12 -0
- package/dist/types/cache.d.ts.map +1 -0
- package/dist/types/component.d.ts +58 -0
- package/dist/types/component.d.ts.map +1 -0
- package/dist/types/core.d.ts +77 -0
- package/dist/types/core.d.ts.map +1 -0
- package/dist/types/icon.d.ts +15 -0
- package/dist/types/icon.d.ts.map +1 -0
- package/dist/types/index.d.ts +6 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/spacing.d.ts +28 -0
- package/dist/types/spacing.d.ts.map +1 -0
- package/dist/types/store.d.ts +12 -0
- package/dist/types/store.d.ts.map +1 -0
- package/dist/types/style.d.ts +42 -0
- package/dist/types/style.d.ts.map +1 -0
- package/dist/types/theme.d.ts +109 -0
- package/dist/types/theme.d.ts.map +1 -0
- package/dist/utils.d.ts +40 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/variants/borderCreator.d.ts +22 -0
- package/dist/variants/borderCreator.d.ts.map +1 -0
- package/dist/variants/createAppVariants.d.ts +18 -0
- package/dist/variants/createAppVariants.d.ts.map +1 -0
- package/dist/variants/defaultVariants.d.ts +140 -0
- package/dist/variants/defaultVariants.d.ts.map +1 -0
- package/dist/variants/dynamicVariants.d.ts +43 -0
- package/dist/variants/dynamicVariants.d.ts.map +1 -0
- package/dist/variants/index.d.ts +7 -0
- package/dist/variants/index.d.ts.map +1 -0
- package/dist/variants/mediaQuery.d.ts +30 -0
- package/dist/variants/mediaQuery.d.ts.map +1 -0
- package/dist/variants/spacing.d.ts +26 -0
- package/dist/variants/spacing.d.ts.map +1 -0
- package/package.json +19 -5
- package/src/classes/Cacher.ts +9 -9
- package/src/classes/StaleControl.ts +1 -1
- package/src/classes/StyleCache.ts +9 -3
- package/src/classes/StylePersistor.ts +11 -0
- package/src/classes/StyleRegistry.ts +124 -43
- package/src/classes/tests/StyleRegistry.spec.ts +169 -0
- package/src/constants.ts +14 -0
- package/src/hooks/useCompositionStyles.ts +9 -7
- package/src/hooks/useNestedStylesByKey.ts +8 -0
- package/src/hooks/useStyleObserver.ts +6 -5
- package/src/hooks/useTheme.ts +14 -0
- package/src/lib/calc.ts +13 -0
- package/src/lib/createStyles.ts +35 -4
- package/src/lib/createTheme.ts +74 -25
- package/src/lib/cssVariables.ts +74 -0
- package/src/lib/index.ts +2 -1
- package/src/lib/tests/createStyles.spec.ts +80 -23
- package/src/lib/tests/createStylesWithContext.spec.ts +108 -0
- package/src/tests/theme.ts +6 -2
- package/src/theme/generateColorScheme.ts +13 -10
- package/src/theme/tests/themeStore.spec.ts +72 -71
- package/src/theme/themeStore.ts +10 -7
- package/src/theme/validateTheme.ts +1 -1
- package/src/tools/colors.ts +24 -36
- package/src/tools/deepClone.ts +3 -5
- package/src/tools/deepmerge.ts +8 -6
- package/src/tools/hashKey.ts +4 -5
- package/src/tools/minifier.ts +11 -12
- package/src/tools/tests/deepClone.spec.ts +2 -2
- package/src/types/cache.ts +10 -0
- package/src/types/component.ts +41 -5
- package/src/types/core.ts +66 -6
- package/src/types/icon.ts +11 -0
- package/src/types/spacing.ts +21 -0
- package/src/types/store.ts +6 -0
- package/src/types/style.ts +37 -10
- package/src/types/theme.ts +37 -1
- package/src/utils.ts +34 -4
- package/src/variants/borderCreator.ts +14 -5
- package/src/variants/createAppVariants.ts +11 -0
- package/src/variants/defaultVariants.ts +28 -8
- package/src/variants/dynamicVariants.ts +76 -18
- package/src/variants/mediaQuery.ts +18 -0
- package/src/variants/spacing.ts +15 -1
- package/package.json.bak +0 -30
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CSS custom-property prefix used for all codeleap design-token variables.
|
|
3
|
+
* Color tokens are injected as `--cl-<tokenPath>` on `:root` (or a scheme-specific
|
|
4
|
+
* `[data-color-scheme]` selector). Changing this value after tokens are injected
|
|
5
|
+
* will break existing CSS that references `var(--cl-*)`.
|
|
6
|
+
*/
|
|
7
|
+
export declare const CSS_VAR_PREFIX = "--cl-";
|
|
8
|
+
/**
|
|
9
|
+
* Storage key used to persist the active color scheme name in an uncompressed format
|
|
10
|
+
* (plain string, not LZ-encoded). Stored separately so a lightweight inline script
|
|
11
|
+
* can read it before React hydrates and set `data-color-scheme` on `<html>` to prevent
|
|
12
|
+
* a flash of the wrong color scheme (FOUC).
|
|
13
|
+
*/
|
|
14
|
+
export declare const DOM_COLOR_SCHEME_KEY = "@styles.dom.colorScheme";
|
|
15
|
+
/**
|
|
16
|
+
* Recursively flattens a nested color token object into a flat map of CSS custom-property
|
|
17
|
+
* names to their values. Nesting levels are joined with `-` (e.g., `{ primary: { solid: '#fff' } }`
|
|
18
|
+
* → `{ '--cl-primary-solid': '#fff' }`). Non-string leaf values are silently skipped.
|
|
19
|
+
*/
|
|
20
|
+
export declare function flattenColorMap(obj: Record<string, any>, path?: string, prefix?: string): Record<string, string>;
|
|
21
|
+
/**
|
|
22
|
+
* Recursively replaces every string leaf in `obj` with a `var(--cl-<path>)` reference,
|
|
23
|
+
* preserving the original object shape. Used on web to replace raw color values with
|
|
24
|
+
* CSS variable references so that color-scheme switching via `data-color-scheme` CSS
|
|
25
|
+
* selectors works without JavaScript re-renders.
|
|
26
|
+
*/
|
|
27
|
+
export declare function buildCssVarProxy<T>(obj: T, path?: string, prefix?: string): T;
|
|
28
|
+
/**
|
|
29
|
+
* Sets or removes `data-color-scheme` on `document.documentElement` to trigger the
|
|
30
|
+
* matching CSS selector that applies alternate-scheme custom-property overrides.
|
|
31
|
+
* The `'default'` scheme removes the attribute entirely so the `:root` base variables
|
|
32
|
+
* apply. No-ops on non-browser environments (SSR, React Native).
|
|
33
|
+
*/
|
|
34
|
+
export declare function applyColorSchemeToDOM(colorScheme: string): void;
|
|
35
|
+
//# sourceMappingURL=cssVariables.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cssVariables.d.ts","sourceRoot":"","sources":["../../src/lib/cssVariables.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,eAAO,MAAM,cAAc,UAAU,CAAA;AAErC;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,4BAA4B,CAAA;AAE7D;;;;GAIG;AACH,wBAAgB,eAAe,CAC7B,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACxB,IAAI,SAAK,EACT,MAAM,SAAiB,GACtB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAWxB;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,IAAI,SAAK,EAAE,MAAM,SAAiB,GAAG,CAAC,CAcjF;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,WAAW,EAAE,MAAM,QAOxD"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { createStyles, createStylesWithContext, CONTEXT_FACTORY_SYMBOL } from './createStyles';
|
|
2
|
+
export { createTheme } from './createTheme';
|
|
3
|
+
export { calc } from './calc';
|
|
4
|
+
export { flattenColorMap, buildCssVarProxy, applyColorSchemeToDOM, CSS_VAR_PREFIX, DOM_COLOR_SCHEME_KEY } from './cssVariables';
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lib/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAA;AAC9F,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAC7B,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAA"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
declare const defaultLightnessMap: {
|
|
2
|
+
[k: string]: number;
|
|
3
|
+
};
|
|
4
|
+
declare const defaultAlphasMap: {
|
|
5
|
+
[k: string]: number;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Derives a 20-token color ramp from a single anchor hex color.
|
|
9
|
+
*
|
|
10
|
+
* Produces two groups of tokens:
|
|
11
|
+
* - **10 solid tokens** (`{prefix}Solid100` … `{prefix}Solid1000`) — vary the lightness
|
|
12
|
+
* of the anchor's hue/saturation from ~95 L (lightest) to ~10 L (darkest).
|
|
13
|
+
* - **10 transparent tokens** (`{prefix}Transparent100` … `{prefix}Transparent1000`) —
|
|
14
|
+
* keep the anchor's exact RGB channels but increase alpha from 0.05 to 0.90.
|
|
15
|
+
*
|
|
16
|
+
* Default lightness steps: `[95, 85, 75, 60, 45, 30, 27, 21, 16, 10]`.
|
|
17
|
+
* Default alpha steps: `[0.05, 0.10, …, 0.90]`.
|
|
18
|
+
* Both can be overridden by passing custom maps (step → value).
|
|
19
|
+
*/
|
|
20
|
+
export declare function generateColorScheme(anchorHex: string, prefix?: string, lightnesses?: typeof defaultLightnessMap, alphas?: typeof defaultAlphasMap): Record<string, string>;
|
|
21
|
+
export {};
|
|
22
|
+
//# sourceMappingURL=generateColorScheme.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generateColorScheme.d.ts","sourceRoot":"","sources":["../../src/theme/generateColorScheme.ts"],"names":[],"mappings":"AAKA,QAAA,MAAM,mBAAmB;;CAKxB,CAAA;AAID,QAAA,MAAM,gBAAgB;;CAKrB,CAAA;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,mBAAmB,CACjC,SAAS,EAAE,MAAM,EACjB,MAAM,SAAY,EAClB,WAAW,GAAC,OAAO,mBAAyC,EAC5D,MAAM,GAAE,OAAO,gBAAmC,GACjD,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAgBxB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/theme/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,uBAAuB,CAAA"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { AppTheme, ColorMap, IAppVariants, ITheme, Theme } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Theme state interface containing theme and color scheme information.
|
|
4
|
+
*/
|
|
5
|
+
export type ThemeState = {
|
|
6
|
+
theme: ITheme | null;
|
|
7
|
+
colorScheme: string | null;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Global theme store that manages application theme, color schemes, and variants.
|
|
11
|
+
* Uses nanostores for reactive state management.
|
|
12
|
+
*/
|
|
13
|
+
export declare class ThemeStore {
|
|
14
|
+
private readonly alternateColorsSchemeStore;
|
|
15
|
+
readonly colorSchemeStore: import("nanostores").PreinitializedWritableAtom<string | null> & object;
|
|
16
|
+
readonly themeStore: import("nanostores").PreinitializedWritableAtom<ITheme | null> & object;
|
|
17
|
+
readonly variantsStore: import("nanostores").PreinitializedMapStore<IAppVariants> & object;
|
|
18
|
+
/**
|
|
19
|
+
* Gets the current theme.
|
|
20
|
+
* @returns {ITheme | null} Current theme or null if not set
|
|
21
|
+
*/
|
|
22
|
+
get theme(): ITheme | null;
|
|
23
|
+
/**
|
|
24
|
+
* Gets the current theme with typed interface.
|
|
25
|
+
* @returns {AppTheme<Theme>} Current theme cast to AppTheme type
|
|
26
|
+
*/
|
|
27
|
+
get themeTyped(): AppTheme<Theme> | null;
|
|
28
|
+
/**
|
|
29
|
+
* Gets the current color scheme name.
|
|
30
|
+
* @returns {string | null} Current color scheme name or null if not set
|
|
31
|
+
*/
|
|
32
|
+
get colorScheme(): string | null;
|
|
33
|
+
/**
|
|
34
|
+
* Gets the current variants configuration.
|
|
35
|
+
* @returns {IAppVariants} Current variants object
|
|
36
|
+
*/
|
|
37
|
+
get variants(): IAppVariants;
|
|
38
|
+
/**
|
|
39
|
+
* Gets all alternate color schemes.
|
|
40
|
+
* @returns {{ [key: string]: ColorMap }} Object containing all alternate color schemes
|
|
41
|
+
*/
|
|
42
|
+
get alternateColorsScheme(): {
|
|
43
|
+
[key: string]: ColorMap;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Sets the variants configuration.
|
|
47
|
+
* @template T
|
|
48
|
+
* @param {T} variants - Variants configuration to set
|
|
49
|
+
*/
|
|
50
|
+
setVariants<T>(variants: T): void;
|
|
51
|
+
/**
|
|
52
|
+
* Sets the current color scheme.
|
|
53
|
+
* @param {string} colorScheme - Color scheme name to set
|
|
54
|
+
*/
|
|
55
|
+
setColorScheme(colorScheme: string): void;
|
|
56
|
+
/**
|
|
57
|
+
* Sets the current theme.
|
|
58
|
+
* @param {ITheme} theme - Theme object to set
|
|
59
|
+
*/
|
|
60
|
+
setTheme(theme: ITheme): void;
|
|
61
|
+
/**
|
|
62
|
+
* Sets all alternate color schemes.
|
|
63
|
+
* @param {{ [key: string]: ColorMap }} colors - Object containing color schemes
|
|
64
|
+
*/
|
|
65
|
+
setAlternateColorsScheme(colors: {
|
|
66
|
+
[key: string]: ColorMap;
|
|
67
|
+
}): void;
|
|
68
|
+
/**
|
|
69
|
+
* Gets the base color scheme colors (first available scheme).
|
|
70
|
+
* @private
|
|
71
|
+
* @returns {ColorMap} Base color scheme colors
|
|
72
|
+
*/
|
|
73
|
+
private getBaseSchemeColors;
|
|
74
|
+
/**
|
|
75
|
+
* Injects a new color scheme, merging with base scheme colors.
|
|
76
|
+
* @param {string} name - Name of the color scheme
|
|
77
|
+
* @param {ColorMap} colors - Color map to inject
|
|
78
|
+
* @returns {{ [key: string]: ColorMap }} Updated alternate colors object
|
|
79
|
+
*/
|
|
80
|
+
injectColorScheme(name: string, colors: ColorMap): {
|
|
81
|
+
[x: string]: ColorMap;
|
|
82
|
+
};
|
|
83
|
+
/**
|
|
84
|
+
* Removes a color scheme by name.
|
|
85
|
+
* @param {string} name - Name of the color scheme to remove
|
|
86
|
+
* @returns {{ [key: string]: ColorMap }} Updated alternate colors object
|
|
87
|
+
*/
|
|
88
|
+
ejectColorScheme(name: string): {
|
|
89
|
+
[key: string]: ColorMap;
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Global theme store instance.
|
|
94
|
+
*/
|
|
95
|
+
export declare const themeStore: ThemeStore;
|
|
96
|
+
/**
|
|
97
|
+
* Derived nanostores `computed` that combines `themeStore` and `colorSchemeStore`
|
|
98
|
+
* into a single `ThemeState` atom. Components subscribe to this via `useTheme`
|
|
99
|
+
* so they re-render only when either the theme object or the active color scheme
|
|
100
|
+
* changes — not on every `ThemeStore` method call.
|
|
101
|
+
*/
|
|
102
|
+
export declare const themeStoreComputed: import("nanostores").ReadableAtom<{
|
|
103
|
+
theme: AppTheme<Theme>;
|
|
104
|
+
colorScheme: string | null;
|
|
105
|
+
}>;
|
|
106
|
+
//# sourceMappingURL=themeStore.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"themeStore.d.ts","sourceRoot":"","sources":["../../src/theme/themeStore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AAG1E;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;CAC3B,CAAA;AAED;;;GAGG;AACH,qBAAa,UAAU;IACrB,OAAO,CAAC,QAAQ,CAAC,0BAA0B,CAAuC;IAElF,SAAgB,gBAAgB,0EAA4B;IAE5D,SAAgB,UAAU,0EAA4B;IAEtD,SAAgB,aAAa,qEAAwC;IAErE;;;OAGG;IACH,IAAI,KAAK,kBAER;IAED;;;OAGG;IACH,IAAI,UAAU,2BAGb;IAED;;;OAGG;IACH,IAAI,WAAW,kBAEd;IAED;;;OAGG;IACH,IAAI,QAAQ,iBAEX;IAED;;;OAGG;IACH,IAAI,qBAAqB;;MAExB;IAED;;;;OAIG;IACH,WAAW,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC;IAI1B;;;OAGG;IACH,cAAc,CAAC,WAAW,EAAE,MAAM;IAIlC;;;OAGG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM;IAItB;;;OAGG;IACH,wBAAwB,CAAC,MAAM,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,QAAQ,CAAA;KAAE;IAI5D;;;;OAIG;IACH,OAAO,CAAC,mBAAmB;IAW3B;;;;;OAKG;IACH,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ;;;IAkBhD;;;;OAIG;IACH,gBAAgB,CAAC,IAAI,EAAC,MAAM;;;CAW7B;AAED;;GAEG;AACH,eAAO,MAAM,UAAU,YAAmB,CAAA;AAE1C;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB;WAIF,QAAQ,CAAC,KAAK,CAAC;;EAEzC,CAAA"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Theme } from '../types/theme';
|
|
2
|
+
/**
|
|
3
|
+
* Validates and normalizes a theme object.
|
|
4
|
+
* Ensures all alternate color schemes include the same keys as `colors`,
|
|
5
|
+
* and merges `baseColors` into `colors` and `alternateColors`.
|
|
6
|
+
*
|
|
7
|
+
* @template T extends Theme
|
|
8
|
+
* @param {T} theme - The theme to validate.
|
|
9
|
+
* @throws {Error} If an alternate scheme is missing a required color.
|
|
10
|
+
* @returns {T & {
|
|
11
|
+
* alternateColors: Record<string, Record<string, string>>,
|
|
12
|
+
* colors: Record<string, string>
|
|
13
|
+
* }} The validated theme with merged colors.
|
|
14
|
+
*/
|
|
15
|
+
export declare function validateTheme<T extends Theme>(theme: T): T & {
|
|
16
|
+
alternateColors: Record<string, any>;
|
|
17
|
+
colors: {};
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=validateTheme.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validateTheme.d.ts","sourceRoot":"","sources":["../../src/theme/validateTheme.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAEtC;;;;;;;;;;;;GAYG;AACH,wBAAgB,aAAa,CAAC,CAAC,SAAS,KAAK,EAAE,KAAK,EAAE,CAAC;;;EAoCtD"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Expects a 7-character hex string (`#rrggbb`). Shorter forms (3-char, no hash) are
|
|
3
|
+
* not handled and will produce NaN channels. Returns h in [0, 360], s and l in [0, 100],
|
|
4
|
+
* all rounded to integers via `Math.round`.
|
|
5
|
+
*/
|
|
6
|
+
export declare function hexToHSL(hex: string): {
|
|
7
|
+
h: number;
|
|
8
|
+
s: number;
|
|
9
|
+
l: number;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Uses the HSL-to-RGB CSS Color 4 formula (single-pass, no separate hue helper).
|
|
13
|
+
* Inputs h in [0, 360], s and l in [0, 100]; channels are clamped implicitly by
|
|
14
|
+
* `Math.min`/`Math.max`. Each channel is individually rounded before hex encoding,
|
|
15
|
+
* so the round-trip `hexToHSL → hslToHex` may differ by ±1 in the last hex digit.
|
|
16
|
+
*/
|
|
17
|
+
export declare function hslToHex(h: number, s: number, l: number): string;
|
|
18
|
+
/**
|
|
19
|
+
* Parses only the 6-digit `#rrggbb` form via `parseInt(..., 16)`.
|
|
20
|
+
* No alpha channel is extracted. Channels are returned as integers in [0, 255].
|
|
21
|
+
*/
|
|
22
|
+
export declare function hexToRGB(hex: string): {
|
|
23
|
+
r: number;
|
|
24
|
+
g: number;
|
|
25
|
+
b: number;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Shares the same formula as `hslToHex` but returns separate integer r/g/b channels
|
|
29
|
+
* instead of a hex string. Useful when you need numeric channels for `rgba(...)` output.
|
|
30
|
+
* Input ranges: h [0, 360], s [0, 100], l [0, 100].
|
|
31
|
+
*/
|
|
32
|
+
export declare function hslToRGB(h: number, s: number, l: number): {
|
|
33
|
+
r: number;
|
|
34
|
+
g: number;
|
|
35
|
+
b: number;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Inverse of `hslToRGB`. Normalises each channel from [0, 255] to [0, 1] before
|
|
39
|
+
* computing. When max === min (achromatic), hue is fixed at 0. All output values are
|
|
40
|
+
* rounded, so the round-trip `hslToRGB → rgbToHSL` is not guaranteed to be lossless.
|
|
41
|
+
*/
|
|
42
|
+
export declare function rgbToHSL(rgb: {
|
|
43
|
+
r: number;
|
|
44
|
+
g: number;
|
|
45
|
+
b: number;
|
|
46
|
+
}): {
|
|
47
|
+
h: number;
|
|
48
|
+
s: number;
|
|
49
|
+
l: number;
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* Implements WCAG 2.x relative luminance (https://www.w3.org/TR/WCAG20/#relativeluminancedef).
|
|
53
|
+
* Channels are linearised with the sRGB transfer function: values ≤ 0.03928 use
|
|
54
|
+
* the linear segment (C / 12.92); values above use the gamma curve ((C + 0.055) / 1.055)^2.4.
|
|
55
|
+
* The luminance coefficients are 0.2126 R + 0.7152 G + 0.0722 B, reflecting the
|
|
56
|
+
* eye's greater sensitivity to green. Returns a value in [0, 1].
|
|
57
|
+
*/
|
|
58
|
+
export declare function getLuminance({ r, g, b }: {
|
|
59
|
+
r: number;
|
|
60
|
+
g: number;
|
|
61
|
+
b: number;
|
|
62
|
+
}): number;
|
|
63
|
+
/**
|
|
64
|
+
* Uses a luminance threshold of **0.5** (not the WCAG 4.5:1 contrast ratio) to pick
|
|
65
|
+
* between two text colours. Backgrounds with luminance > 0.5 are treated as light and
|
|
66
|
+
* receive `darkColor`; all others receive `lightColor`. This is a perceptual shortcut —
|
|
67
|
+
* use explicit contrast-ratio checks for accessibility-critical situations.
|
|
68
|
+
*/
|
|
69
|
+
export declare function getTextColor(backgroundHex: string, darkColor?: string, lightColor?: string): string;
|
|
70
|
+
//# sourceMappingURL=colors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"colors.d.ts","sourceRoot":"","sources":["../../src/tools/colors.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM;;;;EAwBnC;AAED;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAShE;AAED;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM;;;;EAKnC;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM;;;;EAavD;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,CAmCtG;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CASrF;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,aAAa,EAAE,MAAM,EAAE,SAAS,SAAU,EAAE,UAAU,SAAU,GAAG,MAAM,CAIrG"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* rfdc clone function configured with default options (no circular-reference support,
|
|
3
|
+
* proto: false). Does not handle `Date`, `RegExp`, or `Buffer` fields — they are copied
|
|
4
|
+
* by reference. Use only on plain style/theme objects.
|
|
5
|
+
*/
|
|
6
|
+
export declare const deepClone: <T>(input: T) => T;
|
|
7
|
+
//# sourceMappingURL=deepClone.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deepClone.d.ts","sourceRoot":"","sources":["../../src/tools/deepClone.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,eAAO,MAAM,SAAS,oBAAS,CAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Re-exports `@fastify/deepmerge`'s factory function. Call it once with options
|
|
3
|
+
* (e.g., `deepmerge({ all: true })`) to obtain a variadic merge function.
|
|
4
|
+
* Passing `{ all: true }` merges arrays by index rather than concatenating them —
|
|
5
|
+
* this is the mode used throughout the style registry for variant merging.
|
|
6
|
+
* The returned merger is not idempotent: source properties always overwrite target.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* const merge = deepmerge({ all: true })
|
|
10
|
+
* const result = merge(base, override1, override2)
|
|
11
|
+
*/
|
|
12
|
+
export { default as deepmerge } from '@fastify/deepmerge';
|
|
13
|
+
//# sourceMappingURL=deepmerge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deepmerge.d.ts","sourceRoot":"","sources":["../../src/tools/deepmerge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,oBAAoB,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mutates the input array by appending `{ '@styles-version': <pkg.version> }` before
|
|
3
|
+
* hashing — meaning callers must not rely on the array being unchanged after the call.
|
|
4
|
+
* The version injection ensures any cache key computed against an older package version
|
|
5
|
+
* is automatically invalid after a library upgrade.
|
|
6
|
+
*/
|
|
7
|
+
export declare const hashKey: (value: Array<any>) => string;
|
|
8
|
+
//# sourceMappingURL=hashKey.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hashKey.d.ts","sourceRoot":"","sources":["../../src/tools/hashKey.ts"],"names":[],"mappings":"AAKA;;;;;GAKG;AACH,eAAO,MAAM,OAAO,GAAI,OAAO,KAAK,CAAC,GAAG,CAAC,KAAG,MAM3C,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,UAAU,MAAM,UAAU,CAAA;AACtC,cAAc,WAAW,CAAA;AACzB,cAAc,YAAY,CAAA;AAC1B,cAAc,sBAAsB,CAAA;AACpC,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Serialises `value` with `JSON.stringify` then LZ-compresses to a Base64 string.
|
|
3
|
+
* Returns the value unchanged (without throwing) when it is falsy, so callers
|
|
4
|
+
* do not need to guard against `null`/`undefined`/`''` inputs.
|
|
5
|
+
* Non-serialisable values (functions, `undefined` inside objects, circular refs)
|
|
6
|
+
* will be silently dropped by `JSON.stringify`.
|
|
7
|
+
*/
|
|
8
|
+
export declare function compress(value: any): any;
|
|
9
|
+
/**
|
|
10
|
+
* Reverses `compress`: LZ-decompresses the Base64 string then parses the JSON.
|
|
11
|
+
* Returns the value unchanged when falsy. Will throw if `value` is a non-empty
|
|
12
|
+
* string that is not valid LZ-Base64, or if the decompressed payload is not
|
|
13
|
+
* valid JSON — callers should guard accordingly.
|
|
14
|
+
*/
|
|
15
|
+
export declare function decompress(value: any): any;
|
|
16
|
+
/**
|
|
17
|
+
* Convenience namespace so callsites can import a single symbol and call
|
|
18
|
+
* `minifier.compress` / `minifier.decompress` without named imports.
|
|
19
|
+
*/
|
|
20
|
+
export declare const minifier: {
|
|
21
|
+
compress: typeof compress;
|
|
22
|
+
decompress: typeof decompress;
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=minifier.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"minifier.d.ts","sourceRoot":"","sources":["../../src/tools/minifier.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,GAAG,GAAG,GAAG,CAIxC;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,GAAG,GAAG,GAAG,CAM1C;AAED;;;GAGG;AACH,eAAO,MAAM,QAAQ;;;CAGpB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"multiplierProperty.d.ts","sourceRoot":"","sources":["../../src/tools/multiplierProperty.ts"],"names":[],"mappings":"AACA,wBAAgB,kBAAkB,CAAC,CAAC,SAAS,MAAM,EACjD,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,CAAC,IAEH,YAAY,MAAM,GAAG,MAAM;IAI/B,CAAC,QAAQ,CAAC,SAAO;EAGtB"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Discriminant union identifying the six cache buckets managed by `StyleCache`.
|
|
3
|
+
* Each bucket stores a different stage of the style-resolution pipeline:
|
|
4
|
+
* - `variants` — per-component variant merge results (persisted)
|
|
5
|
+
* - `common` — shared/common variant lookups (persisted)
|
|
6
|
+
* - `components` — final merged component output (persisted)
|
|
7
|
+
* - `styles` — `createStyles` call results (in-memory)
|
|
8
|
+
* - `compositions` — composition style resolution (in-memory)
|
|
9
|
+
* - `responsive` — responsive breakpoint style resolution (in-memory)
|
|
10
|
+
*/
|
|
11
|
+
export type CacheType = 'variants' | 'common' | 'styles' | 'compositions' | 'responsive' | 'components';
|
|
12
|
+
//# sourceMappingURL=cache.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../src/types/cache.ts"],"names":[],"mappings":"AACA;;;;;;;;;GASG;AACH,MAAM,MAAM,SAAS,GAAG,UAAU,GAAG,QAAQ,GAAG,QAAQ,GAAG,cAAc,GAAG,YAAY,GAAG,YAAY,CAAA"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { AnyRecord, IJSX } from './core';
|
|
2
|
+
import { StyleProp, VariantStyleSheet } from './style';
|
|
3
|
+
import { JSX } from 'react';
|
|
4
|
+
/**
|
|
5
|
+
* Injects a typed `style` prop onto a component based on the composition keys
|
|
6
|
+
* inferred from the variant stylesheet. Primarily used when a component's style
|
|
7
|
+
* prop shape must mirror its variant composition keys exactly.
|
|
8
|
+
*/
|
|
9
|
+
export type StyledProps<VariantStyles extends AnyRecord> = {
|
|
10
|
+
style?: StyleProp<VariantStyles[keyof VariantStyles] extends Partial<Record<infer K, any>> ? K extends string ? K : never : never, keyof VariantStyles>;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Merges external `Props` with variant-aware `style`. If `Props` already declares a
|
|
14
|
+
* `style` prop whose inner composition type can be inferred, that composition is
|
|
15
|
+
* preserved; otherwise the composition is derived from `VariantStyles`.
|
|
16
|
+
*/
|
|
17
|
+
export type PropsWithVariants<Props extends AnyRecord, VariantStyles extends AnyRecord> = Omit<Props, 'style'> & {
|
|
18
|
+
style?: StyleProp<Extract<keyof Props, 'style'> extends never ? VariantStyles[keyof VariantStyles] : (Props['style'] extends StyleProp<infer C> ? C : VariantStyles[keyof VariantStyles]), keyof VariantStyles>;
|
|
19
|
+
};
|
|
20
|
+
/** Unconstrained function type used for variant callbacks and other callbacks. */
|
|
21
|
+
export type AnyFunction = (...args: any[]) => any;
|
|
22
|
+
/** Resolved props type for a component that has been bound to a variant stylesheet. */
|
|
23
|
+
export type StyledComponentProps<Props extends AnyRecord, VariantStyles extends AnyRecord> = PropsWithVariants<Props, VariantStyles>;
|
|
24
|
+
/**
|
|
25
|
+
* A component function that accepts variant-aware style props, plus the registry
|
|
26
|
+
* metadata fields (`styleRegistryName`, `elements`, `rootElement`) used by the
|
|
27
|
+
* `CodeleapStyleRegistry` to resolve composition and responsive styles.
|
|
28
|
+
*/
|
|
29
|
+
export type StyledComponent<VariantStyles extends AnyRecord, Props extends AnyRecord = AnyRecord> = ((props: StyledComponentProps<Props, VariantStyles>) => IJSX) & {
|
|
30
|
+
styleRegistryName?: string;
|
|
31
|
+
elements?: string[];
|
|
32
|
+
rootElement?: string;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Static attributes attached to every component created by the style system.
|
|
36
|
+
* `withVariantTypes` narrows the component's style prop to a specific variant stylesheet
|
|
37
|
+
* without changing the runtime behaviour — it is a TypeScript-only helper.
|
|
38
|
+
*/
|
|
39
|
+
export type GenericStyledComponentAttributes<Props extends AnyRecord> = {
|
|
40
|
+
styleRegistryName?: string;
|
|
41
|
+
withVariantTypes?: <VariantStyles extends VariantStyleSheet>(variants: VariantStyles) => StyledComponent<VariantStyles, Props>;
|
|
42
|
+
elements?: string[];
|
|
43
|
+
rootElement?: string;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* A component that hasn't been bound to a specific variant stylesheet yet but carries
|
|
47
|
+
* the registry metadata needed for the style system to work at runtime.
|
|
48
|
+
*/
|
|
49
|
+
export type GenericStyledComponent<Props extends AnyRecord> = ((props: Props) => IJSX) & GenericStyledComponentAttributes<Props>;
|
|
50
|
+
/** Escape-hatch alias for `GenericStyledComponent<any>` used in registry maps. */
|
|
51
|
+
export type AnyStyledComponent = GenericStyledComponent<any>;
|
|
52
|
+
/** Component function type that optionally accepts `defaultProps` — mirrors React's pattern. */
|
|
53
|
+
export type ComponentWithDefaultProps<P> = ((props: P) => JSX.Element) & {
|
|
54
|
+
defaultProps?: Partial<P>;
|
|
55
|
+
};
|
|
56
|
+
/** Combines `ComponentWithDefaultProps` with the style-registry metadata attributes. */
|
|
57
|
+
export type StyledComponentWithProps<Props extends AnyRecord> = ComponentWithDefaultProps<Props> & GenericStyledComponentAttributes<Props>;
|
|
58
|
+
//# sourceMappingURL=component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../src/types/component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAQ,IAAI,EAAE,MAAM,QAAQ,CAAA;AAC9C,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AACtD,OAAc,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA;AAElC;;;;GAIG;AACH,MAAM,MAAM,WAAW,CAAC,aAAa,SAAS,SAAS,IAAI;IACzD,KAAK,CAAC,EAAE,SAAS,CAChB,aAAa,CAAC,MAAM,aAAa,CAAC,SAAS,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,GAAG,CAAC,CAAC,GAAG,CAAC,SAAS,MAAM,GAAG,CAAC,GAAG,KAAK,GAAG,KAAK,EAC9G,MAAM,aAAa,CACpB,CAAA;CACF,CAAA;AAED;;;;GAIG;AACH,MAAM,MAAM,iBAAiB,CAAC,KAAK,SAAS,SAAS,EAAE,aAAa,SAAS,SAAS,IAAI,IAAI,CAAC,KAAK,EAAE,OAAO,CAAC,GAAG;IAC/G,KAAK,CAAC,EAAE,SAAS,CACf,OAAO,CAAC,MAAM,KAAK,EAAE,OAAO,CAAC,SAAS,KAAK,GAAG,aAAa,CAAC,MAAM,aAAa,CAAC,GAAG,CACjF,KAAK,CAAC,OAAO,CAAC,SAAS,SAAS,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,aAAa,CAAC,MAAM,aAAa,CAAC,CACnF,EACD,MAAM,aAAa,CACpB,CAAA;CACF,CAAA;AAED,kFAAkF;AAClF,MAAM,MAAM,WAAW,GAAG,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAA;AAEjD,uFAAuF;AACvF,MAAM,MAAM,oBAAoB,CAAC,KAAK,SAAS,SAAS,EAAE,aAAa,SAAS,SAAS,IAAI,iBAAiB,CAAC,KAAK,EAAE,aAAa,CAAC,CAAA;AAEpI;;;;GAIG;AACH,MAAM,MAAM,eAAe,CAAC,aAAa,SAAS,SAAS,EAAE,KAAK,SAAS,SAAS,GAAG,SAAS,IAAI,CAClG,CAAC,KAAK,EAAE,oBAAoB,CAAC,KAAK,EAAE,aAAa,CAAC,KAAK,IAAI,CAC5D,GAAG;IACF,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;IACnB,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB,CAAA;AAED;;;;GAIG;AACH,MAAM,MAAM,gCAAgC,CAAC,KAAK,SAAS,SAAS,IAAI;IACtE,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,gBAAgB,CAAC,EAAE,CAAC,aAAa,SAAS,iBAAiB,EAAE,QAAQ,EAAE,aAAa,KAAK,eAAe,CAAC,aAAa,EAAE,KAAK,CAAC,CAAA;IAC9H,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;IACnB,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB,CAAA;AAED;;;GAGG;AACH,MAAM,MAAM,sBAAsB,CAChC,KAAK,SAAS,SAAS,IACrB,CAAC,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC,GAAG,gCAAgC,CAAC,KAAK,CAAC,CAAA;AAEtE,kFAAkF;AAClF,MAAM,MAAM,kBAAkB,GAAG,sBAAsB,CAAC,GAAG,CAAC,CAAA;AAE5D,gGAAgG;AAChG,MAAM,MAAM,yBAAyB,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,CAAC,KAAK,GAAG,CAAC,OAAO,CAAC,GAAG;IAAE,YAAY,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,CAAA;CAAE,CAAA;AAEtG,wFAAwF;AACxF,MAAM,MAAM,wBAAwB,CAAC,KAAK,SAAS,SAAS,IAAI,yBAAyB,CAAC,KAAK,CAAC,GAAG,gCAAgC,CAAC,KAAK,CAAC,CAAA"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Declaration-merging target for the app's CSS/style property bag.
|
|
3
|
+
* Platform packages (`@codeleap/web`, `@codeleap/mobile`) augment this interface
|
|
4
|
+
* with the actual CSS or React Native style properties they support.
|
|
5
|
+
*/
|
|
6
|
+
export interface ICSS {
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Declaration-merging target for the resolved `AppTheme` object available at runtime.
|
|
10
|
+
* Consumer apps augment this so that `useTheme()` returns a fully typed theme without
|
|
11
|
+
* explicit generics at every callsite.
|
|
12
|
+
*/
|
|
13
|
+
export interface ITheme {
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Declaration-merging target for the JSX element type used by the platform.
|
|
17
|
+
* Web augments this with `React.ReactElement`; mobile augments with React Native's
|
|
18
|
+
* equivalent. Allows cross-platform component return types to be typed correctly.
|
|
19
|
+
*/
|
|
20
|
+
export interface IJSX {
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Declaration-merging target for the app's named breakpoint map.
|
|
24
|
+
* Augment with `{ sm: unknown; md: unknown; lg: unknown }` (or your own breakpoints)
|
|
25
|
+
* so that `Breakpoint` and the responsive style API become fully typed.
|
|
26
|
+
*/
|
|
27
|
+
export interface IBreakpoints {
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Declaration-merging target for the app's color token map.
|
|
31
|
+
* Augment with the flattened color keys from your theme (e.g., `{ primary: string }`)
|
|
32
|
+
* so that `color:`, `bg:`, and `borderColor:` variants are narrowed to valid tokens.
|
|
33
|
+
*/
|
|
34
|
+
export interface IColors {
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Declaration-merging target for the app's border-radius token map.
|
|
38
|
+
* Augment with keys from `theme.radius` so that `borderRadius:` and `br:` variants
|
|
39
|
+
* accept only the defined radius tokens.
|
|
40
|
+
*/
|
|
41
|
+
export interface IBorderRadius {
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Declaration-merging target for app-defined style variants registered via
|
|
45
|
+
* `createAppVariants`. Augment so that custom variant names are accepted by `StyleProp`.
|
|
46
|
+
*/
|
|
47
|
+
export interface IAppVariants {
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Declaration-merging target for the app's named size tokens (from `theme.size`).
|
|
51
|
+
* Augment so that the `size:` dynamic variant is narrowed to valid size keys.
|
|
52
|
+
*/
|
|
53
|
+
export interface ISizes {
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Declaration-merging target for a single effect object (e.g., a shadow or filter
|
|
57
|
+
* definition). Shape is platform-specific; augmented by platform packages.
|
|
58
|
+
*/
|
|
59
|
+
export interface IEffect {
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Declaration-merging target for the named effects map (`theme.effects`).
|
|
63
|
+
* Augment with `{ shadow: IEffect; ... }` so that `effect:` variants are narrowed.
|
|
64
|
+
*/
|
|
65
|
+
export interface IEffects {
|
|
66
|
+
}
|
|
67
|
+
/** Convenience alias for an unconstrained key-value record. */
|
|
68
|
+
export type AnyRecord = Record<string, any>;
|
|
69
|
+
/** Union of all breakpoint names defined via `IBreakpoints` augmentation. */
|
|
70
|
+
export type Breakpoint = keyof IBreakpoints;
|
|
71
|
+
/**
|
|
72
|
+
* Runtime context passed to context-aware style factories created with
|
|
73
|
+
* `createStylesWithContext`. Keys are feature flags or numeric state values
|
|
74
|
+
* (e.g., `{ isDisabled: true, tabIndex: 2 }`).
|
|
75
|
+
*/
|
|
76
|
+
export type ComponentContext = Record<string, boolean | number>;
|
|
77
|
+
//# sourceMappingURL=core.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../src/types/core.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,WAAW,IAAI;CAEpB;AAED;;;;GAIG;AACH,MAAM,WAAW,MAAM;CAEtB;AAED;;;;GAIG;AACH,MAAM,WAAW,IAAI;CAEpB;AAED;;;;GAIG;AACH,MAAM,WAAW,YAAY;CAE5B;AAED;;;;GAIG;AACH,MAAM,WAAW,OAAO;CAEvB;AAED;;;;GAIG;AACH,MAAM,WAAW,aAAa;CAE7B;AAED;;;GAGG;AACH,MAAM,WAAW,YAAY;CAE5B;AAED;;;GAGG;AACH,MAAM,WAAW,MAAM;CAEtB;AAED;;;GAGG;AACH,MAAM,WAAW,OAAO;CAEvB;AAED;;;GAGG;AACH,MAAM,WAAW,QAAQ;CAExB;AAED,+DAA+D;AAC/D,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;AAE3C,6EAA6E;AAC7E,MAAM,MAAM,UAAU,GAAG,MAAM,YAAY,CAAA;AAE3C;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,GAAC,MAAM,CAAC,CAAA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Declaration-merging target for the app's named icon set.
|
|
3
|
+
* Augment with `{ arrowLeft: unknown; close: unknown; ... }` to produce a typed
|
|
4
|
+
* `AppIcon` union. Shapes are platform-defined; only the keys matter for typing.
|
|
5
|
+
*/
|
|
6
|
+
export interface AppIcons {
|
|
7
|
+
}
|
|
8
|
+
/** Union of all named icon keys declared in `AppIcons`. Resolves to `never` if not augmented. */
|
|
9
|
+
export type AppIcon = keyof AppIcons;
|
|
10
|
+
/**
|
|
11
|
+
* Accepted value for any `icon` prop: either a named `AppIcon` key or an inline
|
|
12
|
+
* URL in the form `url:<href>` (e.g., `"url:https://example.com/icon.svg"`).
|
|
13
|
+
*/
|
|
14
|
+
export type IconProp = AppIcon | `url:${string}`;
|
|
15
|
+
//# sourceMappingURL=icon.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"icon.d.ts","sourceRoot":"","sources":["../../src/types/icon.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,WAAW,QAAQ;CAExB;AAED,iGAAiG;AACjG,MAAM,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAA;AAEpC;;;GAGG;AACH,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,OAAO,MAAM,EAAE,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAA;AACtB,cAAc,SAAS,CAAA;AACvB,cAAc,SAAS,CAAA;AACvB,cAAc,QAAQ,CAAA;AACtB,cAAc,aAAa,CAAA"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Long-form spacing direction suffixes used with `margin` and `padding`.
|
|
3
|
+
* The empty string `''` represents the un-suffixed property (e.g., `padding`).
|
|
4
|
+
*/
|
|
5
|
+
export declare const spacingVariants: readonly ["Vertical", "Horizontal", "Bottom", "Top", "Left", "Right", ""];
|
|
6
|
+
/**
|
|
7
|
+
* Short-form spacing direction suffixes used with `m` and `p`.
|
|
8
|
+
* Maps to the long-form via `shortPositionMap` inside `spacingFactory`.
|
|
9
|
+
* The empty string `''` represents the un-suffixed property (e.g., `p`).
|
|
10
|
+
*/
|
|
11
|
+
export declare const spacingShortVariants: readonly ["y", "x", "b", "t", "l", "r", ""];
|
|
12
|
+
/** Union of all long-form direction suffixes (e.g., `'Vertical'`, `''`). */
|
|
13
|
+
export type SpacingVariants = typeof spacingVariants[number];
|
|
14
|
+
/** Union of all short-form direction suffixes (e.g., `'x'`, `''`). */
|
|
15
|
+
export type SpacingShortVariants = typeof spacingShortVariants[number];
|
|
16
|
+
/**
|
|
17
|
+
* Valid multiplier values for spacing and inset variant strings.
|
|
18
|
+
* `'auto'` maps to the CSS `auto` keyword; a number is scaled by `baseSpacing`;
|
|
19
|
+
* `''` is the empty-string terminator used in template literal unions.
|
|
20
|
+
*/
|
|
21
|
+
export type Multiplier = 'auto' | number | '';
|
|
22
|
+
/**
|
|
23
|
+
* All valid spacing variant strings accepted by `StyleProp`.
|
|
24
|
+
* Examples: `"paddingVertical:2"`, `"mt:1"`, `"gap:auto"`.
|
|
25
|
+
* The numeric part is multiplied by `baseSpacing` at resolution time.
|
|
26
|
+
*/
|
|
27
|
+
export type Spacing = `padding${SpacingVariants}:${Multiplier}` | `margin${SpacingVariants}:${Multiplier}` | `p${SpacingShortVariants}:${Multiplier}` | `m${SpacingShortVariants}:${Multiplier}` | `gap:${Multiplier}`;
|
|
28
|
+
//# sourceMappingURL=spacing.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spacing.d.ts","sourceRoot":"","sources":["../../src/types/spacing.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,eAAe,2EAQlB,CAAA;AAEV;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,6CAQvB,CAAA;AAEV,4EAA4E;AAC5E,MAAM,MAAM,eAAe,GAAG,OAAO,eAAe,CAAC,MAAM,CAAC,CAAA;AAE5D,sEAAsE;AACtE,MAAM,MAAM,oBAAoB,GAAG,OAAO,oBAAoB,CAAC,MAAM,CAAC,CAAA;AAEtE;;;;GAIG;AACH,MAAM,MAAM,UAAU,GAClB,MAAM,GACN,MAAM,GACN,EAAE,CAAA;AAEN;;;;GAIG;AACH,MAAM,MAAM,OAAO,GACf,UAAU,eAAe,IAAI,UAAU,EAAE,GACzC,SAAS,eAAe,IAAI,UAAU,EAAE,GACxC,IAAI,oBAAoB,IAAI,UAAU,EAAE,GACxC,IAAI,oBAAoB,IAAI,UAAU,EAAE,GACxC,OAAO,UAAU,EAAE,CAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Minimal key-value storage contract used by `StylePersistor` and `Cache`.
|
|
3
|
+
* Designed to be implemented by any synchronous store (e.g., MMKV, AsyncStorage
|
|
4
|
+
* adapters, or `localStorage` wrappers). `getItem` must return `null` (not `undefined`)
|
|
5
|
+
* when the key is absent — callers use `?? null` guards based on that assumption.
|
|
6
|
+
*/
|
|
7
|
+
export interface StateStorage {
|
|
8
|
+
getItem: (name: string) => any | null;
|
|
9
|
+
setItem: (name: string, value: any) => void;
|
|
10
|
+
removeItem: (name: string) => void;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=store.d.ts.map
|