@codeleap/styles 6.3.0 → 7.0.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.
Files changed (138) hide show
  1. package/dist/classes/Cacher.d.ts +87 -0
  2. package/dist/classes/Cacher.d.ts.map +1 -0
  3. package/dist/classes/StaleControl.d.ts +65 -0
  4. package/dist/classes/StaleControl.d.ts.map +1 -0
  5. package/dist/classes/StyleCache.d.ts +63 -0
  6. package/dist/classes/StyleCache.d.ts.map +1 -0
  7. package/dist/classes/StylePersistor.d.ts +52 -0
  8. package/dist/classes/StylePersistor.d.ts.map +1 -0
  9. package/dist/classes/StyleRegistry.d.ts +108 -0
  10. package/dist/classes/StyleRegistry.d.ts.map +1 -0
  11. package/dist/classes/index.d.ts +3 -0
  12. package/dist/classes/index.d.ts.map +1 -0
  13. package/dist/constants.d.ts +22 -0
  14. package/dist/constants.d.ts.map +1 -0
  15. package/dist/hooks/index.d.ts +5 -0
  16. package/dist/hooks/index.d.ts.map +1 -0
  17. package/dist/hooks/useCompositionStyles.d.ts +12 -0
  18. package/dist/hooks/useCompositionStyles.d.ts.map +1 -0
  19. package/dist/hooks/useNestedStylesByKey.d.ts +11 -0
  20. package/dist/hooks/useNestedStylesByKey.d.ts.map +1 -0
  21. package/dist/hooks/useStyleObserver.d.ts +9 -0
  22. package/dist/hooks/useStyleObserver.d.ts.map +1 -0
  23. package/dist/hooks/useTheme.d.ts +19 -0
  24. package/dist/hooks/useTheme.d.ts.map +1 -0
  25. package/dist/index.d.ts +12 -0
  26. package/dist/index.d.ts.map +1 -0
  27. package/dist/lib/calc.d.ts +27 -0
  28. package/dist/lib/calc.d.ts.map +1 -0
  29. package/dist/lib/createStyles.d.ts +30 -0
  30. package/dist/lib/createStyles.d.ts.map +1 -0
  31. package/dist/lib/createTheme.d.ts +28 -0
  32. package/dist/lib/createTheme.d.ts.map +1 -0
  33. package/dist/lib/cssVariables.d.ts +35 -0
  34. package/dist/lib/cssVariables.d.ts.map +1 -0
  35. package/dist/lib/index.d.ts +5 -0
  36. package/dist/lib/index.d.ts.map +1 -0
  37. package/dist/theme/generateColorScheme.d.ts +22 -0
  38. package/dist/theme/generateColorScheme.d.ts.map +1 -0
  39. package/dist/theme/index.d.ts +4 -0
  40. package/dist/theme/index.d.ts.map +1 -0
  41. package/dist/theme/themeStore.d.ts +106 -0
  42. package/dist/theme/themeStore.d.ts.map +1 -0
  43. package/dist/theme/validateTheme.d.ts +19 -0
  44. package/dist/theme/validateTheme.d.ts.map +1 -0
  45. package/dist/tools/colors.d.ts +70 -0
  46. package/dist/tools/colors.d.ts.map +1 -0
  47. package/dist/tools/deepClone.d.ts +7 -0
  48. package/dist/tools/deepClone.d.ts.map +1 -0
  49. package/dist/tools/deepmerge.d.ts +13 -0
  50. package/dist/tools/deepmerge.d.ts.map +1 -0
  51. package/dist/tools/hashKey.d.ts +8 -0
  52. package/dist/tools/hashKey.d.ts.map +1 -0
  53. package/dist/tools/index.d.ts +7 -0
  54. package/dist/tools/index.d.ts.map +1 -0
  55. package/dist/tools/minifier.d.ts +24 -0
  56. package/dist/tools/minifier.d.ts.map +1 -0
  57. package/dist/tools/multiplierProperty.d.ts +4 -0
  58. package/dist/tools/multiplierProperty.d.ts.map +1 -0
  59. package/dist/types/cache.d.ts +12 -0
  60. package/dist/types/cache.d.ts.map +1 -0
  61. package/dist/types/component.d.ts +58 -0
  62. package/dist/types/component.d.ts.map +1 -0
  63. package/dist/types/core.d.ts +77 -0
  64. package/dist/types/core.d.ts.map +1 -0
  65. package/dist/types/icon.d.ts +15 -0
  66. package/dist/types/icon.d.ts.map +1 -0
  67. package/dist/types/index.d.ts +6 -0
  68. package/dist/types/index.d.ts.map +1 -0
  69. package/dist/types/spacing.d.ts +28 -0
  70. package/dist/types/spacing.d.ts.map +1 -0
  71. package/dist/types/store.d.ts +12 -0
  72. package/dist/types/store.d.ts.map +1 -0
  73. package/dist/types/style.d.ts +42 -0
  74. package/dist/types/style.d.ts.map +1 -0
  75. package/dist/types/theme.d.ts +109 -0
  76. package/dist/types/theme.d.ts.map +1 -0
  77. package/dist/utils.d.ts +40 -0
  78. package/dist/utils.d.ts.map +1 -0
  79. package/dist/variants/borderCreator.d.ts +22 -0
  80. package/dist/variants/borderCreator.d.ts.map +1 -0
  81. package/dist/variants/createAppVariants.d.ts +18 -0
  82. package/dist/variants/createAppVariants.d.ts.map +1 -0
  83. package/dist/variants/defaultVariants.d.ts +140 -0
  84. package/dist/variants/defaultVariants.d.ts.map +1 -0
  85. package/dist/variants/dynamicVariants.d.ts +43 -0
  86. package/dist/variants/dynamicVariants.d.ts.map +1 -0
  87. package/dist/variants/index.d.ts +7 -0
  88. package/dist/variants/index.d.ts.map +1 -0
  89. package/dist/variants/mediaQuery.d.ts +30 -0
  90. package/dist/variants/mediaQuery.d.ts.map +1 -0
  91. package/dist/variants/spacing.d.ts +26 -0
  92. package/dist/variants/spacing.d.ts.map +1 -0
  93. package/package.json +19 -5
  94. package/src/classes/Cacher.ts +9 -9
  95. package/src/classes/StaleControl.ts +1 -1
  96. package/src/classes/StyleCache.ts +9 -3
  97. package/src/classes/StylePersistor.ts +11 -0
  98. package/src/classes/StyleRegistry.ts +124 -43
  99. package/src/classes/tests/StyleRegistry.spec.ts +169 -0
  100. package/src/constants.ts +14 -0
  101. package/src/hooks/useCompositionStyles.ts +9 -7
  102. package/src/hooks/useNestedStylesByKey.ts +8 -0
  103. package/src/hooks/useStyleObserver.ts +6 -5
  104. package/src/hooks/useTheme.ts +14 -0
  105. package/src/lib/calc.ts +13 -0
  106. package/src/lib/createStyles.ts +35 -4
  107. package/src/lib/createTheme.ts +74 -25
  108. package/src/lib/cssVariables.ts +74 -0
  109. package/src/lib/index.ts +2 -1
  110. package/src/lib/tests/createStyles.spec.ts +80 -23
  111. package/src/lib/tests/createStylesWithContext.spec.ts +108 -0
  112. package/src/tests/theme.ts +6 -2
  113. package/src/theme/generateColorScheme.ts +13 -10
  114. package/src/theme/tests/themeStore.spec.ts +38 -37
  115. package/src/theme/themeStore.ts +10 -7
  116. package/src/theme/validateTheme.ts +1 -1
  117. package/src/tools/colors.ts +24 -36
  118. package/src/tools/deepClone.ts +3 -5
  119. package/src/tools/deepmerge.ts +8 -6
  120. package/src/tools/hashKey.ts +4 -5
  121. package/src/tools/minifier.ts +11 -12
  122. package/src/tools/tests/deepClone.spec.ts +2 -2
  123. package/src/types/cache.ts +10 -0
  124. package/src/types/component.ts +41 -5
  125. package/src/types/core.ts +66 -6
  126. package/src/types/icon.ts +11 -0
  127. package/src/types/spacing.ts +21 -0
  128. package/src/types/store.ts +6 -0
  129. package/src/types/style.ts +37 -10
  130. package/src/types/theme.ts +37 -1
  131. package/src/utils.ts +34 -4
  132. package/src/variants/borderCreator.ts +14 -5
  133. package/src/variants/createAppVariants.ts +11 -0
  134. package/src/variants/defaultVariants.ts +28 -8
  135. package/src/variants/dynamicVariants.ts +76 -18
  136. package/src/variants/mediaQuery.ts +18 -0
  137. package/src/variants/spacing.ts +15 -1
  138. package/package.json.bak +0 -30
@@ -0,0 +1 @@
1
+ {"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/types/store.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,GAAG,GAAG,IAAI,CAAA;IACrC,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,KAAK,IAAI,CAAA;IAC3C,UAAU,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;CACnC"}
@@ -0,0 +1,42 @@
1
+ import { DynamicVariants } from '../variants/dynamicVariants';
2
+ import { DefaultVariants } from '../variants/defaultVariants';
3
+ import { IAppVariants, IBreakpoints, ICSS, IEffects, ITheme } from './core';
4
+ import { Multiplier, Spacing } from './spacing';
5
+ type Inset = `top:${Multiplier}` | `bottom:${Multiplier}` | `left:${Multiplier}` | `right:${Multiplier}`;
6
+ /**
7
+ * Union of all built-in variant string literals accepted anywhere a style variant
8
+ * name is valid: spacing shorthands, inset offsets, dynamic token variants (color,
9
+ * border, cursor, etc.), the static `defaultVariants` keys, app-defined variants,
10
+ * and named effect tokens.
11
+ */
12
+ export type CommonVariants = Spacing | Inset | DynamicVariants | keyof DefaultVariants | keyof IAppVariants | `effect:${keyof IEffects}`;
13
+ type StyleAtom<Composition extends string = string, Variants = string, HasBreakpoints = string, HasComposition = string> = ICSS | Variants | CommonVariants | boolean | null | undefined | '' | (HasBreakpoints extends string ? {
14
+ 'breakpoints': Partial<Record<keyof IBreakpoints, StyleAtom<Composition, Variants, boolean, string> | StyleAtom<Composition, Variants, boolean, string>[]>>;
15
+ } : null) | (HasComposition extends string ? Partial<Record<Composition, StyleAtom<Composition, Variants, boolean, boolean> | StyleAtom<Composition, Variants, boolean, boolean>[]>> : null) | Array<Variants | ICSS | Partial<Record<Composition, StyleAtom<Composition, Variants, boolean, boolean> | StyleAtom<Composition, Variants, boolean, boolean>[]>>>;
16
+ /**
17
+ * The value accepted by any component's `style` prop. Supports:
18
+ * - A raw `ICSS` object applied to the root element.
19
+ * - A variant string (or array of strings) resolved through the registry.
20
+ * - A composition object mapping sub-element names to their own `StyleAtom`.
21
+ * - A `{ breakpoints: { [key]: StyleAtom } }` object for responsive overrides.
22
+ * - An array mixing any of the above — processed left-to-right, last write wins.
23
+ */
24
+ export type StyleProp<Composition extends string = string, Variants = string> = StyleAtom<Composition, Variants> | StyleAtom<Composition, Variants>[];
25
+ /**
26
+ * Loosely typed variant stylesheet — a record mapping variant names to their style
27
+ * definitions. Used as the input to `createStyles` and `registerVariants`.
28
+ */
29
+ export type VariantStyleSheet = Record<string, any>;
30
+ /** Alias for `StyleProp<T>` scoped to a specific set of composition keys. */
31
+ export type StyledProp<T extends string> = StyleProp<T>;
32
+ /**
33
+ * Post-processing function that receives the merged theme and fully resolved variant
34
+ * styles and returns a (potentially transformed) style record. Useful for injecting
35
+ * cross-variant logic such as conditional overrides that depend on multiple variant
36
+ * states simultaneously.
37
+ */
38
+ export type StyleAggregator<T extends string = any> = (theme: ITheme, style: Record<T, ICSS>) => Record<T, ICSS>;
39
+ /** Typed record mapping composition/element keys to their resolved `ICSS` values. */
40
+ export type StyleRecord<K extends string> = Record<K, ICSS>;
41
+ export {};
42
+ //# sourceMappingURL=style.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../../src/types/style.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAA;AAE7D,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAA;AAC7D,OAAO,EAAa,YAAY,EAAE,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AACtF,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAE/C,KAAK,KAAK,GACN,OAAO,UAAU,EAAE,GACnB,UAAU,UAAU,EAAE,GACtB,QAAQ,UAAU,EAAE,GACpB,SAAS,UAAU,EAAE,CAAA;AAEzB;;;;;GAKG;AACH,MAAM,MAAM,cAAc,GACxB,OAAO,GACP,KAAK,GACL,eAAe,GACf,MAAM,eAAe,GACrB,MAAM,YAAY,GAClB,UAAU,MAAM,QAAQ,EAAE,CAAA;AAE5B,KAAK,SAAS,CAAC,WAAW,SAAS,MAAM,GAAG,MAAM,EAAE,QAAQ,GAAG,MAAM,EAAE,cAAc,GAAG,MAAM,EAAE,cAAc,GAAG,MAAM,IACrH,IAAI,GACJ,QAAQ,GACR,cAAc,GACd,OAAO,GACP,IAAI,GACJ,SAAS,GACT,EAAE,GAEF,CAAC,cAAc,SAAS,MAAM,GAAG;IAC/B,aAAa,EAAE,OAAO,CACpB,MAAM,CAAC,MAAM,YAAY,EACvB,SAAS,CAAC,WAAW,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,CAAC,GACjD,SAAS,CAAC,WAAW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MAAM,CAAC,CAAC,EAAE,IAAI,CAAC,CAAA"}
@@ -0,0 +1,109 @@
1
+ import { BorderCreator } from '../variants/borderCreator';
2
+ import { MediaQueries } from '../variants/mediaQuery';
3
+ import type { DefaultVariants } from '../variants/defaultVariants';
4
+ import { MultiplierFunction, Spacings } from '../variants/spacing';
5
+ import { ICSS, IEffect } from './core';
6
+ type AnyMap = {
7
+ [key: string]: any;
8
+ };
9
+ /**
10
+ * Flat or nested color token map passed to `createTheme`.
11
+ * This type is intentionally empty so that `validateTheme` and the CSS-var
12
+ * machinery can accept any shape; strong typing comes via `IColors` augmentation.
13
+ */
14
+ export type ColorMap = {};
15
+ /**
16
+ * Maps breakpoint names to pixel widths. Used by `createMediaQueries` to generate
17
+ * `@media screen and (min/max-width: <N>px)` strings. Breakpoints not in this map
18
+ * fall back to `Infinity` (treated as unbounded).
19
+ */
20
+ type BreakpointMap = {
21
+ [key: string]: number;
22
+ };
23
+ /** Map of named effect tokens (shadows, filters, etc.) to their effect shapes. */
24
+ type EffectsMap = {
25
+ [key: string]: IEffect;
26
+ };
27
+ /**
28
+ * The full spacing API attached to every `AppTheme`. Combines the long-form
29
+ * (`margin`, `padding` with variant suffixes) and short-form (`m`, `p`) factories,
30
+ * plus `gap`. Each property is a `MultiplierFunction` that scales by `baseSpacing`.
31
+ */
32
+ export type SpacingMap = Spacings<'margin'> & Spacings<'padding'> & Spacings<'m', string> & Spacings<'p', string> & {
33
+ gap: MultiplierFunction;
34
+ };
35
+ /**
36
+ * Position-offset functions (`top`, `bottom`, `left`, `right`) attached to `AppTheme`.
37
+ * Each function multiplies its argument by `baseSpacing` and returns an `ICSS` object.
38
+ */
39
+ export type InsetMap = {
40
+ bottom: MultiplierFunction;
41
+ top: MultiplierFunction;
42
+ left: MultiplierFunction;
43
+ right: MultiplierFunction;
44
+ };
45
+ /**
46
+ * Raw theme definition passed to `createTheme`. After processing, the resolved object
47
+ * is an `AppTheme<T>` with additional runtime methods (`setColorScheme`, `spacing`, etc.).
48
+ *
49
+ * - `baseColors` — primitive palette tokens merged into both `colors` and every alternate scheme.
50
+ * - `colors` — semantic/alias tokens for the default color scheme.
51
+ * - `alternateColors` — named overrides; each must supply all keys present in `colors`.
52
+ * - `baseSpacing` — the multiplier used by spacing/inset factories (default: 1).
53
+ * - `isBrowser` — when `true`, enables CSS custom-property mode for colors and browser-only styles.
54
+ */
55
+ export type Theme = {
56
+ baseColors: ColorMap;
57
+ colors: ColorMap;
58
+ alternateColors?: {
59
+ [key: string]: ColorMap;
60
+ };
61
+ breakpoints?: BreakpointMap;
62
+ baseSpacing?: number;
63
+ presets?: AnyMap;
64
+ radius?: AnyMap;
65
+ stroke?: AnyMap;
66
+ size?: AnyMap;
67
+ effects?: EffectsMap;
68
+ typography: AnyMap;
69
+ icons: AnyMap;
70
+ values?: AnyMap;
71
+ isBrowser?: boolean;
72
+ };
73
+ /** The reserved name for the primary (non-alternate) color scheme. */
74
+ export type DefaultColorSchemeName = 'default';
75
+ /** Union of `'default'` and all keys defined in `T['alternateColors']`. */
76
+ export type ColorScheme<T extends Theme = Theme> = DefaultColorSchemeName | keyof T['alternateColors'];
77
+ type PredefinedThemeDerivedValues<T extends Theme> = {
78
+ baseColors: T['baseColors'];
79
+ colors: T['colors'];
80
+ breakpoints: T['breakpoints'];
81
+ presets: DefaultVariants & T['presets'];
82
+ radius: T['radius'];
83
+ stroke: T['stroke'];
84
+ size: T['size'];
85
+ effects: T['effects'];
86
+ typography: T['typography'];
87
+ icons: T['icons'];
88
+ values: T['values'];
89
+ };
90
+ type PredefinedAppTheme<T extends Theme> = PredefinedThemeDerivedValues<T> & {
91
+ setColorScheme: (colorScheme: string) => void;
92
+ currentColorScheme: () => ColorScheme<T>;
93
+ injectColorScheme: (name: string, colorMap: ColorMap) => void;
94
+ ejectColorScheme: (name: string) => void;
95
+ getCssVariables: (schemeName?: string) => Record<string, string>;
96
+ currentSchemeColors: T['colors'];
97
+ spacing: SpacingMap;
98
+ media: MediaQueries;
99
+ border: BorderCreator;
100
+ inset: InsetMap;
101
+ baseSpacing: number;
102
+ value: (multiplier: number) => number;
103
+ sized: (size: number | string) => ICSS;
104
+ };
105
+ export type AppTheme<T extends Theme> = PredefinedAppTheme<T> & {
106
+ [P in Exclude<keyof T, keyof PredefinedThemeDerivedValues<T>>]: T[P];
107
+ };
108
+ export {};
109
+ //# sourceMappingURL=theme.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../src/types/theme.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA;AACrD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAA;AAClE,OAAO,EAAE,kBAAkB,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAClE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAA;AAEtC,KAAK,MAAM,GAAG;IACZ,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CACnB,CAAA;AAED;;;;GAIG;AACH,MAAM,MAAM,QAAQ,GAAG,EAEtB,CAAA;AAED;;;;GAIG;AACH,KAAK,aAAa,GAAG;IACnB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;CACtB,CAAA;AAED,kFAAkF;AAClF,KAAK,UAAU,GAAG;IAChB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CACvB,CAAA;AAED;;;;GAIG;AACH,MAAM,MAAM,UAAU,GACpB,QAAQ,CAAC,QAAQ,CAAC,GAClB,QAAQ,CAAC,SAAS,CAAC,GACnB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC,GACrB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC,GACrB;IACE,GAAG,EAAE,kBAAkB,CAAA;CACxB,CAAA;AAEH;;;GAGG;AACH,MAAM,MAAM,QAAQ,GACl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C,EAAE,MAAM,4BAA4B,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CACrE,CAAA"}
@@ -0,0 +1,40 @@
1
+ import { ICSS, StyledProp } from './types';
2
+ /**
3
+ * Uppercases (or lowercases when `reverse = true`) the first character of a string.
4
+ * Returns the input unchanged when it is falsy or empty.
5
+ */
6
+ export declare function capitalize(str: string, reverse?: boolean): string;
7
+ /**
8
+ * Complete list of CSS/RN spacing-related property names that the style registry treats
9
+ * specially (resolved via the spacing factory rather than passed through as raw ICSS).
10
+ * Built eagerly at module load time by iterating `spacingVariants` and `spacingShortVariants`.
11
+ */
12
+ export declare const spacingKeys: string[];
13
+ /** Returns `true` if `key` is one of the pre-built spacing property names. */
14
+ export declare function isSpacingKey(key: string): boolean;
15
+ /**
16
+ * Extracts all entries whose key starts with `match`, stripping the prefix and
17
+ * lowercasing the first character of the remainder. Used by composition hooks to
18
+ * slice a flat `{ wrapperText: ..., wrapperIcon: ... }` record into a nested
19
+ * `{ text: ..., icon: ... }` map for a single composition element.
20
+ */
21
+ export declare function getNestedStylesByKey<T extends string>(match: string, styles: Partial<Record<T, ICSS>>): Record<string, any>;
22
+ /**
23
+ * Merges an array of style objects into one using `@fastify/deepmerge` with `all: true`.
24
+ * Falsy entries are filtered out before merging. Later entries overwrite earlier ones.
25
+ */
26
+ export declare const mergeStyles: (styles: Array<any>) => {};
27
+ /**
28
+ * Style property names that collide with CSS keywords and must not be treated as
29
+ * composition-element prefixes by the registry. Without this list, a style object
30
+ * like `{ textAlign: 'center' }` would be misidentified as a composition key starting
31
+ * with `text`.
32
+ */
33
+ export declare const ignoredStyleKeys: string[];
34
+ /**
35
+ * Flattens nested arrays of `StyledProp` into a single flat array. Useful when
36
+ * assembling the final `style` prop from multiple sources (e.g., variant defaults
37
+ * plus overrides), without losing the order-dependent merge semantics of `StyleProp`.
38
+ */
39
+ export declare const concatStyles: <T extends string>(styles: Array<StyledProp<T>>) => StyledProp<T>;
40
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAI1C;;;GAGG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,UAAQ,UAItD;AAED;;;;GAIG;AACH,eAAO,MAAM,WAAW,UAMvB,CAAA;AAcD,8EAA8E;AAC9E,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,WAIvC;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,uBAWrG;AAED;;;GAGG;AACH,eAAO,MAAM,WAAW,GAAI,QAAQ,KAAK,CAAC,GAAG,CAAC,OAI7C,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,UAQ5B,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,YAAY,GAAI,CAAC,SAAS,MAAM,EAAE,QAAQ,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,KAAG,UAAU,CAAC,CAAC,CAYzF,CAAA"}
@@ -0,0 +1,22 @@
1
+ import { IColors, ICSS } from '../types';
2
+ import { borderDirection } from './dynamicVariants';
3
+ /** Arguments for `borderCreator`. */
4
+ type BorderCreatorArgs = {
5
+ color: keyof IColors | (string & {});
6
+ width?: number | string;
7
+ directions?: typeof borderDirection[number][];
8
+ style?: "dashed" | "dotted" | "double" | "groove" | "hidden" | "inset" | "none" | "outset" | "ridge" | "solid";
9
+ };
10
+ /** Function signature of the `border` helper attached to `AppTheme`. */
11
+ export type BorderCreator = (args: BorderCreatorArgs) => ICSS;
12
+ /**
13
+ * Resolves `color` from `theme.colors` (falls back to the raw string if not found),
14
+ * then emits `border{Direction}Color`, `border{Direction}Width`, and — on web only —
15
+ * `border{Direction}Style` for each requested direction.
16
+ * Defaults: all four sides, width 1, style `'solid'`.
17
+ * `borderStyle` is omitted on React Native because RN requires it on individual sides
18
+ * and `isBrowser` guards that path.
19
+ */
20
+ export declare const borderCreator: BorderCreator;
21
+ export {};
22
+ //# sourceMappingURL=borderCreator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"borderCreator.d.ts","sourceRoot":"","sources":["../../src/variants/borderCreator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAA;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAInD,qCAAqC;AACrC,KAAK,iBAAiB,GAAG;IACvB,KAAK,EAAE,MAAM,OAAO,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAA;IACpC,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACvB,UAAU,CAAC,EAAE,OAAO,eAAe,CAAC,MAAM,CAAC,EAAE,CAAA;IAC7C,KAAK,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,GAAG,OAAO,CAAC;CAChH,CAAA;AAED,wEAAwE;AACxE,MAAM,MAAM,aAAa,GAAG,CAAC,IAAI,EAAE,iBAAiB,KAAK,IAAI,CAAA;AAE7D;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa,EAAE,aAuB3B,CAAA"}
@@ -0,0 +1,18 @@
1
+ import { ICSS, ITheme } from '../types';
2
+ type AppVariantsMap = {
3
+ [x: string]: ICSS | ((theme: ITheme) => ICSS);
4
+ };
5
+ /**
6
+ * Registers app-specific style variants with the global `themeStore`.
7
+ * Call this once during app initialisation (before any component mounts) with the
8
+ * variants object that extends the base variant set. The variants are merged into
9
+ * `commonVariants` when `CodeleapStyleRegistry` initialises.
10
+ *
11
+ * Each entry can be either a static `ICSS` object (applied unconditionally) or a
12
+ * function `(theme: ITheme) => ICSS` (resolved lazily using the current theme).
13
+ *
14
+ * @returns The same `variants` object — useful for typing augmentation of `IAppVariants`.
15
+ */
16
+ export declare function createAppVariants<T extends AppVariantsMap>(variants: T): T;
17
+ export {};
18
+ //# sourceMappingURL=createAppVariants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createAppVariants.d.ts","sourceRoot":"","sources":["../../src/variants/createAppVariants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAGvC,KAAK,cAAc,GAAG;IACpB,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,CAAC,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC,CAAA;CAC9C,CAAA;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,cAAc,EAAE,QAAQ,EAAE,CAAC,KAItE"}
@@ -0,0 +1,140 @@
1
+ import { ICSS } from '../types';
2
+ /**
3
+ * Static built-in style variants available to every component without any registration.
4
+ * These are merged as the lowest-priority layer in `commonVariants`, so app-defined
5
+ * variants and dynamic variants can override them.
6
+ *
7
+ * Notable entries:
8
+ * - `grow` — sets `flex: 1` (not `display: flex`; use `row`/`column` for flex containers).
9
+ * - `inset` — shorthand for `{ top:0, bottom:0, left:0, right:0 }` (useful with `absolute`).
10
+ * - `insetX` / `insetY` — pin to horizontal or vertical edges only.
11
+ * - `centerChildren` — centers children via `alignItems`/`justifyContent`; requires a flex container.
12
+ * - `'visibility:hidden'` / `'display:none'` — use quoted keys in style arrays.
13
+ */
14
+ export declare const defaultVariants: {
15
+ readonly block: {
16
+ readonly display: "block";
17
+ };
18
+ readonly grow: {
19
+ readonly flex: 1;
20
+ };
21
+ readonly absolute: {
22
+ readonly position: "absolute";
23
+ };
24
+ readonly relative: {
25
+ readonly position: "relative";
26
+ };
27
+ readonly fixed: {
28
+ readonly position: "fixed";
29
+ };
30
+ readonly sticky: {
31
+ readonly position: "sticky";
32
+ };
33
+ readonly insetX: {
34
+ readonly left: 0;
35
+ readonly right: 0;
36
+ };
37
+ readonly insetY: {
38
+ readonly top: 0;
39
+ readonly bottom: 0;
40
+ };
41
+ readonly full: {
42
+ readonly width: "100%";
43
+ readonly height: "100%";
44
+ };
45
+ readonly noWrap: {
46
+ readonly whiteSpace: "nowrap";
47
+ };
48
+ readonly fullWidth: {
49
+ readonly width: "100%";
50
+ };
51
+ readonly fullHeight: {
52
+ readonly height: "100%";
53
+ };
54
+ readonly inset: {
55
+ readonly top: 0;
56
+ readonly bottom: 0;
57
+ readonly left: 0;
58
+ readonly right: 0;
59
+ };
60
+ readonly centerRow: {
61
+ readonly display: "flex";
62
+ readonly flexDirection: "row";
63
+ readonly alignItems: "center";
64
+ };
65
+ readonly row: {
66
+ readonly display: "flex";
67
+ readonly flexDirection: "row";
68
+ };
69
+ readonly column: {
70
+ readonly display: "flex";
71
+ readonly flexDirection: "column";
72
+ };
73
+ readonly centerChildren: {
74
+ readonly alignItems: "center";
75
+ readonly justifyContent: "center";
76
+ };
77
+ readonly alignStart: {
78
+ readonly alignItems: "flex-start";
79
+ };
80
+ readonly alignEnd: {
81
+ readonly alignItems: "flex-end";
82
+ };
83
+ readonly alignCenter: {
84
+ readonly alignItems: "center";
85
+ };
86
+ readonly alignStretch: {
87
+ readonly alignItems: "stretch";
88
+ };
89
+ readonly alignSelfCenter: {
90
+ readonly alignSelf: "center";
91
+ };
92
+ readonly alignSelfStart: {
93
+ readonly alignSelf: "flex-start";
94
+ };
95
+ readonly alignSelfStretch: {
96
+ readonly alignSelf: "stretch";
97
+ };
98
+ readonly alignSelfEnd: {
99
+ readonly alignSelf: "flex-end";
100
+ };
101
+ readonly justifyStart: {
102
+ readonly justifyContent: "flex-start";
103
+ };
104
+ readonly justifyEnd: {
105
+ readonly justifyContent: "flex-end";
106
+ };
107
+ readonly justifyCenter: {
108
+ readonly justifyContent: "center";
109
+ };
110
+ readonly justifySpaceBetween: {
111
+ readonly justifyContent: "space-between";
112
+ };
113
+ readonly justifySpaceAround: {
114
+ readonly justifyContent: "space-around";
115
+ };
116
+ readonly textRight: {
117
+ readonly textAlign: "right";
118
+ };
119
+ readonly textLeft: {
120
+ readonly textAlign: "left";
121
+ };
122
+ readonly textCenter: {
123
+ readonly textAlign: "center";
124
+ };
125
+ readonly flexWrap: {
126
+ readonly flexWrap: "wrap";
127
+ };
128
+ readonly 'visibility:hidden': {
129
+ readonly visibility: "hidden";
130
+ };
131
+ readonly 'visibility:visible': {
132
+ readonly visibility: "visible";
133
+ };
134
+ readonly 'display:none': {
135
+ readonly display: "none";
136
+ };
137
+ };
138
+ /** Typed record mapping every built-in variant name to an `ICSS` value. */
139
+ export type DefaultVariants = Record<keyof typeof defaultVariants, ICSS>;
140
+ //# sourceMappingURL=defaultVariants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"defaultVariants.d.ts","sourceRoot":"","sources":["../../src/variants/defaultVariants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAA;AAE/B;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4HlB,CAAA;AAEV,2EAA2E;AAC3E,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,OAAO,eAAe,EAAE,IAAI,CAAC,CAAA"}
@@ -0,0 +1,43 @@
1
+ import { IBorderRadius, IColors, ISizes } from '../types';
2
+ /** Callback shape for a variant that receives a raw value and returns a style fragment. */
3
+ export type VariantFunction = (value: any) => any;
4
+ /** CSS properties that accept a color token: `backgroundColor` and `color`. */
5
+ export declare const colorVariants: readonly ["backgroundColor", "color"];
6
+ /** Horizontal border directions used when generating per-corner radius variants. */
7
+ export declare const borderXDirection: readonly ["left", "right"];
8
+ /** Vertical border directions used when generating per-corner radius variants. */
9
+ export declare const borderYDirection: readonly ["bottom", "top"];
10
+ /** All four border directions plus the un-suffixed (all-sides) form. */
11
+ export declare const borderDirection: readonly ["bottom", "top", "left", "right", ""];
12
+ /** Border sub-properties generated for each direction. */
13
+ export declare const borderProperties: readonly ["color", "radius", "width"];
14
+ /** CSS cursor values surfaced as `cursor:<value>` style variants. */
15
+ export declare const cursorTypes: readonly ["not-allowed", "help", "pointer", "wait", ""];
16
+ /** Numeric value or the empty-string terminator used in `scale:` variant templates. */
17
+ export type Value = number | '';
18
+ type MatchKeysByValue<T extends Record<string, any>, Values> = {
19
+ [K in keyof T]: T[K] extends Values ? K : never;
20
+ }[keyof T];
21
+ type Color = MatchKeysByValue<IColors, string>;
22
+ type Sizes = keyof ISizes;
23
+ /**
24
+ * Union of all parametric variant strings resolved at runtime by looking up the
25
+ * provided value in the theme. Examples: `"color:primary"`, `"bg:neutral"`,
26
+ * `"borderRadius:sm"`, `"cursor:pointer"`, `"scale:0.95"`, `"size:icon"`.
27
+ * The part before `:` is the variant name; the part after is the token key or raw value.
28
+ */
29
+ export type DynamicVariants = `color:${Color}` | `border${Capitalize<typeof borderDirection[number]>}Width:${keyof IBorderRadius}` | `border${Capitalize<typeof borderDirection[number]>}Color:${Color}` | `borderRadius:${keyof IBorderRadius}` | `border${Capitalize<typeof borderYDirection[number]>}${Capitalize<typeof borderXDirection[number]>}Radius:${keyof IBorderRadius}` | `border${Capitalize<typeof borderYDirection[number]>}Radius:${keyof IBorderRadius}` | `border${Capitalize<typeof borderXDirection[number]>}Radius:${keyof IBorderRadius}` | `cursor:${typeof cursorTypes[number]}` | `bg:${Color}` | `br:${keyof IBorderRadius}` | `scale:${Value}` | `size:${Sizes}`;
30
+ /**
31
+ * Builds the dynamic variant registry object at module initialisation time.
32
+ * Each entry is a function `(theme, value) => ICSS` keyed by the variant name
33
+ * (the part before `:` in the variant string). The registry is consumed by
34
+ * `CodeleapStyleRegistry.computeCommonVariantStyle`.
35
+ */
36
+ export declare const createDynamicVariants: () => Record<string, any>;
37
+ /**
38
+ * Pre-built dynamic variant registry used by the `CodeleapStyleRegistry`.
39
+ * Created once at module load; re-creation would lose the closed-over variant map.
40
+ */
41
+ export declare const dynamicVariants: Record<string, any>;
42
+ export {};
43
+ //# sourceMappingURL=dynamicVariants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dynamicVariants.d.ts","sourceRoot":"","sources":["../../src/variants/dynamicVariants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,OAAO,EAAY,MAAM,EAAU,MAAM,UAAU,CAAA;AAG3E,2FAA2F;AAC3F,MAAM,MAAM,eAAe,GAAG,CAAC,KAAK,EAAE,GAAG,KAAK,GAAG,CAAA;AAEjD,+EAA+E;AAC/E,eAAO,MAAM,aAAa,uCAAwC,CAAA;AAElE,oFAAoF;AACpF,eAAO,MAAM,gBAAgB,4BAA6B,CAAA;AAC1D,kFAAkF;AAClF,eAAO,MAAM,gBAAgB,4BAA6B,CAAA;AAC1D,wEAAwE;AACxE,eAAO,MAAM,eAAe,iDAA0D,CAAA;AACtF,0DAA0D;AAC1D,eAAO,MAAM,gBAAgB,uCAAwC,CAAA;AAErE,qEAAqE;AACrE,eAAO,MAAM,WAAW,yDAMd,CAAA;AAEV,uFAAuF;AACvF,MAAM,MAAM,KAAK,GACb,MAAM,GACN,EAAE,CAAA;AAEN,KAAK,gBAAgB,CACnB,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC7B,MAAM,IACJ;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,MAAM,GAAG,CAAC,GAAG,KAAK;CAAE,CAAC,MAAM,CAAC,CAAC,CAAA;AAKhE,KAAK,KAAK,GAAG,gBAAgB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAA;AAE9C,KAAK,KAAK,GAAG,MAAM,MAAM,CAAA;AAEzB;;;;;GAKG;AACH,MAAM,MAAM,eAAe,GACzB,SAAS,KAAK,EAAE,GAChB,SAAS,UAAU,CAAC,OAAO,eAAe,CAAC,MAAM,CAAC,CAAC,SAAS,MAAM,aAAa,EAAE,GACjF,SAAS,UAAU,CAAC,OAAO,eAAe,CAAC,MAAM,CAAC,CAAC,SAAS,KAAK,EAAE,GACnE,gBAAgB,MAAM,aAAa,EAAE,GACrC,SAAS,UAAU,CAAC,OAAO,gBAAgB,CAAC,MAAM,CAAC,CAAC,GAAG,UAAU,CAAC,OAAO,gBAAgB,CAAC,MAAM,CAAC,CAAC,UAAU,MAAM,aAAa,EAAE,GACjI,SAAS,UAAU,CAAC,OAAO,gBAAgB,CAAC,MAAM,CAAC,CAAC,UAAU,MAAM,aAAa,EAAE,GACnF,SAAS,UAAU,CAAC,OAAO,gBAAgB,CAAC,MAAM,CAAC,CAAC,UAAU,MAAM,aAAa,EAAE,GACnF,UAAU,OAAO,WAAW,CAAC,MAAM,CAAC,EAAE,GACtC,MAAM,KAAK,EAAE,GACb,MAAM,MAAM,aAAa,EAAE,GAC3B,SAAS,KAAK,EAAE,GAChB,QAAQ,KAAK,EAAE,CAAA;AAEjB;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,2BA8EjC,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,eAAe,qBAA0B,CAAA"}
@@ -0,0 +1,7 @@
1
+ export * from './borderCreator';
2
+ export * from './createAppVariants';
3
+ export * from './defaultVariants';
4
+ export * from './dynamicVariants';
5
+ export * from './mediaQuery';
6
+ export * from './spacing';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/variants/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAA;AAC/B,cAAc,qBAAqB,CAAA;AACnC,cAAc,mBAAmB,CAAA;AACjC,cAAc,mBAAmB,CAAA;AACjC,cAAc,cAAc,CAAA;AAC5B,cAAc,WAAW,CAAA"}
@@ -0,0 +1,30 @@
1
+ import { Breakpoint } from '../types';
2
+ /**
3
+ * The four directional media-query helpers. Each returns a complete `@media` string
4
+ * that can be used as a nested style key.
5
+ * - `up` — `min-width` (at and above the breakpoint).
6
+ * - `down` — `max-width` (at and below the breakpoint).
7
+ * - `is` — exact match (`min-width` AND `max-width` at the same value).
8
+ * - `not` — negated exact match.
9
+ */
10
+ export type Queries = {
11
+ up: (breakpoint: string) => string;
12
+ down: (breakpoint: Breakpoint) => string;
13
+ is: (breakpoint: string) => string;
14
+ not: (breakpoint: string) => string;
15
+ };
16
+ /**
17
+ * Extends `Queries` with `renderToPlatformQuery`, which inverts the query direction
18
+ * for React Native's platform-query rendering: `up` becomes `down`, `is` becomes `not`,
19
+ * etc. This is how responsive styles declared for web are translated to RN media conditions.
20
+ */
21
+ export type MediaQueries = Queries & {
22
+ renderToPlatformQuery: (props: Record<keyof Queries, any>) => string;
23
+ };
24
+ /**
25
+ * Produces a `MediaQueries` object bound to the provided `breakpoints` map.
26
+ * Unknown breakpoints (not in the map) fall back to `Infinity`, making `up(unknown)`
27
+ * match all widths and `down(unknown)` match none.
28
+ */
29
+ export declare function createMediaQueries<T extends any>(breakpoints: T): MediaQueries;
30
+ //# sourceMappingURL=mediaQuery.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mediaQuery.d.ts","sourceRoot":"","sources":["../../src/variants/mediaQuery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAErC;;;;;;;GAOG;AACH,MAAM,MAAM,OAAO,GAAG;IACpB,EAAE,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,MAAM,CAAA;IAClC,IAAI,EAAE,CAAC,UAAU,EAAE,UAAU,KAAK,MAAM,CAAA;IACxC,EAAE,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,MAAM,CAAA;IAClC,GAAG,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,MAAM,CAAA;CACpC,CAAA;AAED;;;;GAIG;AACH,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG;IACnC,qBAAqB,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,OAAO,EAAE,GAAG,CAAC,KAAK,MAAM,CAAA;CACrE,CAAA;AAUD;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,SAAS,GAAG,EAAE,WAAW,EAAE,CAAC,GAAG,YAAY,CAgD9E"}
@@ -0,0 +1,26 @@
1
+ import { ICSS } from '../types';
2
+ import { SpacingVariants, SpacingShortVariants } from '../types/spacing';
3
+ /** Function returned by a spacing factory entry; accepts a multiplier and returns a style fragment. */
4
+ export type MultiplierFunction = (multiplier: number | string) => ICSS;
5
+ /**
6
+ * Typed shape of the spacing object produced by `spacingFactory` for a given property.
7
+ * When `S` is `boolean`, the direction variants are long-form (`SpacingVariants`);
8
+ * when `S` is `string`, they are short-form (`SpacingShortVariants`).
9
+ */
10
+ export type Spacings<T extends string, S = boolean> = {
11
+ [Property in (S extends boolean ? SpacingVariants : SpacingShortVariants) as `${T}${string & Property}`]: MultiplierFunction;
12
+ } & {
13
+ [Property in T]: (multiplier: number) => ICSS;
14
+ } & {
15
+ value: (multiplier: number) => number;
16
+ };
17
+ /**
18
+ * Builds a spacing variant map for a CSS property (`'padding'`, `'margin'`, `'p'`, `'m'`).
19
+ * Each key in the returned object is a callable that multiplies its argument by `base`.
20
+ * Passing `isShort = true` uses single-letter direction suffixes and maps them to their
21
+ * long-form equivalents before producing the CSS property name.
22
+ * The `'Horizontal'` and `'Vertical'` (or `'x'`/`'y'`) directions expand to two
23
+ * properties each; the empty-string direction produces all four sides at once.
24
+ */
25
+ export declare function spacingFactory<T extends string>(base: number, spacingProperty: T, isShort?: boolean): any;
26
+ //# sourceMappingURL=spacing.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spacing.d.ts","sourceRoot":"","sources":["../../src/variants/spacing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAA;AAC/B,OAAO,EAAyC,eAAe,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAA;AAE/G,uGAAuG;AACvG,MAAM,MAAM,kBAAkB,GAAG,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,KAAK,IAAI,CAAA;AAEtE;;;;GAIG;AACH,MAAM,MAAM,QAAQ,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,GAAG,OAAO,IAAI;KACnD,QAAQ,IAAI,CAAC,CAAC,SAAS,OAAO,GAAG,eAAe,GAAG,oBAAoB,CAAC,IAAI,GAAG,CAAC,GAAG,MAAM,GAAG,QAAQ,EAAE,GAAG,kBAAkB;CAC7H,GAAG;KACC,QAAQ,IAAI,CAAC,GAAG,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI;CAC9C,GAAG;IACF,KAAK,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,MAAM,CAAA;CACtC,CAAA;AAsBH;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,CAAC,SAAS,MAAM,EAC7C,IAAI,EAAE,MAAM,EACZ,eAAe,EAAE,CAAC,EAClB,OAAO,GAAE,OAAe,GACvB,GAAG,CA0DL"}
package/package.json CHANGED
@@ -1,7 +1,20 @@
1
1
  {
2
2
  "name": "@codeleap/styles",
3
- "version": "6.3.0",
3
+ "version": "7.0.0",
4
4
  "main": "src/index.ts",
5
+ "types": "dist/index.d.ts",
6
+ "exports": {
7
+ ".": {
8
+ "source": "./src/index.ts",
9
+ "types": "./dist/index.d.ts",
10
+ "import": "./dist/index.js",
11
+ "default": "./dist/index.js"
12
+ }
13
+ },
14
+ "files": [
15
+ "dist",
16
+ "src"
17
+ ],
5
18
  "license": "UNLICENSED",
6
19
  "repository": {
7
20
  "url": "https://github.com/codeleap-uk/internal-libs-monorepo.git",
@@ -9,11 +22,12 @@
9
22
  "directory": "packages/styles"
10
23
  },
11
24
  "devDependencies": {
12
- "@codeleap/config": "6.3.0",
25
+ "@codeleap/config": "7.0.0",
13
26
  "ts-node-dev": "^1.1.8"
14
27
  },
15
28
  "scripts": {
16
- "build": "echo 'No build needed'"
29
+ "build": "tsc --build tsconfig.build.json",
30
+ "typecheck": "bun tsc --noEmit -p ./tsconfig.json"
17
31
  },
18
32
  "peerDependencies": {
19
33
  "react": "19.1.0",
@@ -24,7 +38,7 @@
24
38
  "@nanostores/react": "1.0.0",
25
39
  "js-sha256": "0.11.1",
26
40
  "lz-string": "1.5.0",
27
- "nanostores": "1.0.1",
41
+ "nanostores": "1.3.0",
28
42
  "rfdc": "1.4.1"
29
43
  }
30
- }
44
+ }
@@ -26,7 +26,7 @@ export class Cache<T extends any = any> {
26
26
  cache: Record<string, T> = {}
27
27
 
28
28
  /** Debounce timer for batch persistence */
29
- private persistTimer: NodeJS.Timer | null = null
29
+ private persistTimer: ReturnType<typeof setTimeout> | null = null
30
30
 
31
31
  /** Debounce delay in milliseconds */
32
32
  private persistDelay: number = 4500
@@ -55,7 +55,7 @@ export class Cache<T extends any = any> {
55
55
  */
56
56
  constructor(
57
57
  public registryName: CacheType,
58
- private storage: StateStorage = null,
58
+ private storage: StateStorage | null | undefined = undefined,
59
59
  public persistCache: boolean = !!storage,
60
60
  ) {
61
61
  if (!persistCache || !StyleConstants.STORE_CACHE_ENABLED) return
@@ -155,8 +155,8 @@ export class Cache<T extends any = any> {
155
155
  loadStorage() {
156
156
  if (!this.persistCache) return { persistedStaleTime: generateStaleTime(), persistedCache: {} }
157
157
 
158
- const persistedStaleTime = this.storage.getItem(this.persistKeyStaleTime)
159
- const persistedCache = this.storage.getItem(this.persistKeyCache)
158
+ const persistedStaleTime = this.storage!.getItem(this.persistKeyStaleTime)
159
+ const persistedCache = this.storage!.getItem(this.persistKeyCache)
160
160
 
161
161
  return {
162
162
  persistedStaleTime: !persistedStaleTime ? generateStaleTime() : new Date(persistedStaleTime),
@@ -170,19 +170,19 @@ export class Cache<T extends any = any> {
170
170
  clearStorage() {
171
171
  if (!this.persistCache) return
172
172
 
173
- this.storage.removeItem(this.persistKeyStaleTime)
174
- this.storage.removeItem(this.persistKeyCache)
173
+ this.storage!.removeItem(this.persistKeyStaleTime)
174
+ this.storage!.removeItem(this.persistKeyCache)
175
175
  }
176
176
 
177
177
  /**
178
178
  * Stores cache data to persistent storage
179
179
  * @param {Record<string, T>} [cache=null] - Cache data to store (uses current cache if not provided)
180
180
  */
181
- storeCache(cache: Record<string, T> = null) {
181
+ storeCache(cache: Record<string, T> | undefined = undefined) {
182
182
  if (!this.persistCache) return
183
183
 
184
184
  const value = cache ?? this.cache
185
- this.storage.setItem(this.persistKeyCache, value)
185
+ this.storage!.setItem(this.persistKeyCache, value)
186
186
  }
187
187
 
188
188
  /**
@@ -193,6 +193,6 @@ export class Cache<T extends any = any> {
193
193
  if (!this.persistCache) return
194
194
 
195
195
  const value = staleTime.toISOString()
196
- this.storage.setItem(this.persistKeyStaleTime, value)
196
+ this.storage!.setItem(this.persistKeyStaleTime, value)
197
197
  }
198
198
  }