@kbach/react 0.5.37 → 0.5.40

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/index.d.mts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import React__default, { ReactNode, ComponentType, ForwardRefExoticComponent } from 'react';
3
- import { T as ThemeColors, a as ThemeConfig, P as ParsedClass, R as ResolvedStyle, S as StyleValue, F as FrameworkConfig, b as ResolvedConfig, c as ThemeMode } from './types-CV5vXnSH.mjs';
4
- export { d as PluginAPI } from './types-CV5vXnSH.mjs';
3
+ import { T as ThemeColors, a as ThemeConfig, P as ParsedClass, R as ResolvedStyle, S as StyleValue, F as FrameworkConfig, b as ResolvedConfig, c as ThemeMode } from './types-D-24rbXu.mjs';
4
+ export { d as PluginAPI } from './types-D-24rbXu.mjs';
5
5
 
6
6
  declare const defaultColors: ThemeColors;
7
7
  declare const defaultTheme: ThemeConfig;
@@ -9,10 +9,8 @@ declare const defaultTheme: ThemeConfig;
9
9
  declare function parseClass(className: string): ParsedClass | null;
10
10
  /**
11
11
  * Split a class string into tokens. Whitespace at bracket depth > 0 is STRIPPED
12
- * (not just skipped as a delimiter) so that arbitrary values like rgb(41, 172, 15)
13
- * become valid CSS class name tokens: bg-[rgb(41,172,15)].
14
- * Spaces inside brackets are illegal in HTML class attributes and would cause the
15
- * browser to split the class into multiple broken tokens.
12
+ * (not just skipped) so that arbitrary values like rgb(41, 172, 15) become valid
13
+ * CSS class name tokens: bg-[rgb(41,172,15)].
16
14
  */
17
15
  declare function splitClassTokens(classString: string): string[];
18
16
  /**
@@ -26,25 +24,17 @@ declare function parseClasses(classString: string): ParsedClass[];
26
24
  /**
27
25
  * Resolve a class string to a ResolvedStyle object.
28
26
  *
29
- * The result groups styles by modifier key:
30
- * - 'base' → always-applied styles
31
- * - 'dark' → dark-mode styles
32
- * - 'hover' → hover styles
33
- * - 'dark:hover' → combined dark + hover
34
- * - etc.
35
- *
36
- * Results are cached — repeated calls with the same string are O(1).
27
+ * Results are cached per (theme, classString, darkMode) — repeated calls with
28
+ * the same arguments are O(1). Different theme objects each get their own
29
+ * cache so concurrent ThemeProviders with different configs are always correct.
37
30
  */
38
31
  declare function resolve(classString: string, theme: ThemeConfig, darkMode?: 'attribute' | 'class' | 'media'): ResolvedStyle;
39
32
  /**
40
- * Flatten a ResolvedStyle into a single StyleValue for the given runtime state.
33
+ * Flatten a ResolvedStyle into a single StyleValue for the current runtime state.
41
34
  * Used by useStyles() and styled().
42
35
  *
43
- * @param resolved Output of resolve()
44
- * @param isDark Whether dark mode is currently active
45
- * @param state Interaction state flags
46
- * @param breakpoints Active breakpoint names (sm, md, lg, xl, 2xl). On web,
47
- * pass an empty Set — CSS @media rules handle responsive.
36
+ * The sort step is memoized per resolved object reference (#6) — when resolve()
37
+ * returns a cached object, getSortedEntries() is O(1) on all subsequent calls.
48
38
  */
49
39
  declare function flatten(resolved: ResolvedStyle, isDark: boolean, state?: {
50
40
  hover?: boolean;
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import React__default, { ReactNode, ComponentType, ForwardRefExoticComponent } from 'react';
3
- import { T as ThemeColors, a as ThemeConfig, P as ParsedClass, R as ResolvedStyle, S as StyleValue, F as FrameworkConfig, b as ResolvedConfig, c as ThemeMode } from './types-CV5vXnSH.js';
4
- export { d as PluginAPI } from './types-CV5vXnSH.js';
3
+ import { T as ThemeColors, a as ThemeConfig, P as ParsedClass, R as ResolvedStyle, S as StyleValue, F as FrameworkConfig, b as ResolvedConfig, c as ThemeMode } from './types-D-24rbXu.js';
4
+ export { d as PluginAPI } from './types-D-24rbXu.js';
5
5
 
6
6
  declare const defaultColors: ThemeColors;
7
7
  declare const defaultTheme: ThemeConfig;
@@ -9,10 +9,8 @@ declare const defaultTheme: ThemeConfig;
9
9
  declare function parseClass(className: string): ParsedClass | null;
10
10
  /**
11
11
  * Split a class string into tokens. Whitespace at bracket depth > 0 is STRIPPED
12
- * (not just skipped as a delimiter) so that arbitrary values like rgb(41, 172, 15)
13
- * become valid CSS class name tokens: bg-[rgb(41,172,15)].
14
- * Spaces inside brackets are illegal in HTML class attributes and would cause the
15
- * browser to split the class into multiple broken tokens.
12
+ * (not just skipped) so that arbitrary values like rgb(41, 172, 15) become valid
13
+ * CSS class name tokens: bg-[rgb(41,172,15)].
16
14
  */
17
15
  declare function splitClassTokens(classString: string): string[];
18
16
  /**
@@ -26,25 +24,17 @@ declare function parseClasses(classString: string): ParsedClass[];
26
24
  /**
27
25
  * Resolve a class string to a ResolvedStyle object.
28
26
  *
29
- * The result groups styles by modifier key:
30
- * - 'base' → always-applied styles
31
- * - 'dark' → dark-mode styles
32
- * - 'hover' → hover styles
33
- * - 'dark:hover' → combined dark + hover
34
- * - etc.
35
- *
36
- * Results are cached — repeated calls with the same string are O(1).
27
+ * Results are cached per (theme, classString, darkMode) — repeated calls with
28
+ * the same arguments are O(1). Different theme objects each get their own
29
+ * cache so concurrent ThemeProviders with different configs are always correct.
37
30
  */
38
31
  declare function resolve(classString: string, theme: ThemeConfig, darkMode?: 'attribute' | 'class' | 'media'): ResolvedStyle;
39
32
  /**
40
- * Flatten a ResolvedStyle into a single StyleValue for the given runtime state.
33
+ * Flatten a ResolvedStyle into a single StyleValue for the current runtime state.
41
34
  * Used by useStyles() and styled().
42
35
  *
43
- * @param resolved Output of resolve()
44
- * @param isDark Whether dark mode is currently active
45
- * @param state Interaction state flags
46
- * @param breakpoints Active breakpoint names (sm, md, lg, xl, 2xl). On web,
47
- * pass an empty Set — CSS @media rules handle responsive.
36
+ * The sort step is memoized per resolved object reference (#6) — when resolve()
37
+ * returns a cached object, getSortedEntries() is O(1) on all subsequent calls.
48
38
  */
49
39
  declare function flatten(resolved: ResolvedStyle, isDark: boolean, state?: {
50
40
  hover?: boolean;