@kbach/react 0.3.2 → 0.3.3

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.
@@ -1801,9 +1801,6 @@ function clearPluginUtilities() {
1801
1801
  function getPluginStandaloneMap() {
1802
1802
  return PLUGIN_STANDALONE;
1803
1803
  }
1804
- function getPluginResolverMap() {
1805
- return PLUGIN_RESOLVERS;
1806
- }
1807
1804
 
1808
1805
  // src/core/cache.ts
1809
1806
  var LRUCache = class {
@@ -2118,7 +2115,6 @@ function buildConfig(userConfig) {
2118
2115
  }
2119
2116
  function makePluginAPI(theme) {
2120
2117
  const standalone = getPluginStandaloneMap();
2121
- const resolvers = getPluginResolverMap();
2122
2118
  return {
2123
2119
  addUtility(name, styles) {
2124
2120
  standalone[name] = styles;
@@ -2149,11 +2145,16 @@ function onConfigChange(listener) {
2149
2145
  function updateConfig(userConfig) {
2150
2146
  const store = getConfigStore();
2151
2147
  store.resolved = buildConfig(userConfig);
2148
+ store._src = userConfig;
2152
2149
  clearCache();
2153
2150
  for (const listener of store.listeners) {
2154
2151
  listener(store.resolved);
2155
2152
  }
2156
2153
  }
2154
+ function initConfig(userConfig) {
2155
+ if (getConfigStore()._src === userConfig) return;
2156
+ updateConfig(userConfig);
2157
+ }
2157
2158
  var customVariants = new Proxy(
2158
2159
  {},
2159
2160
  {
@@ -2287,6 +2288,7 @@ export {
2287
2288
  buildConfig,
2288
2289
  onConfigChange,
2289
2290
  updateConfig,
2291
+ initConfig,
2290
2292
  syncGlobalDarkMode,
2291
2293
  setGlobalDarkMode,
2292
2294
  useGlobalDarkMode,
@@ -5,7 +5,7 @@ import {
5
5
  isWeb,
6
6
  resolve,
7
7
  useGlobalDarkMode
8
- } from "./chunk-V5KHX4CZ.mjs";
8
+ } from "./chunk-7XL6VQDW.mjs";
9
9
 
10
10
  // src/jsx-runtime.tsx
11
11
  import { jsx as _jsx, jsxs as _jsxs, Fragment } from "react/jsx-runtime";
package/dist/index.d.mts CHANGED
@@ -122,6 +122,13 @@ declare function flatten(resolved: ResolvedStyle, isDark: boolean, state?: {
122
122
  declare function getConfig(): ResolvedConfig;
123
123
  declare function buildConfig(userConfig: FrameworkConfig): ResolvedConfig;
124
124
  declare function updateConfig(userConfig: FrameworkConfig): void;
125
+ /**
126
+ * Like updateConfig, but only calls it when the config object reference has
127
+ * actually changed. Used by the Babel-injected IIFE so that:
128
+ * - multiple files with kbach classes don't re-run the update on every load
129
+ * - Fast Refresh DOES re-run when kbach.config.js changes (new module → new object)
130
+ */
131
+ declare function initConfig(userConfig: FrameworkConfig): void;
125
132
 
126
133
  interface ThemeContextValue {
127
134
  /** The user-selected mode ('light' | 'dark' | 'system') */
@@ -335,4 +342,4 @@ declare function kb(classString: string, isDark?: boolean): StyleValue | string;
335
342
  */
336
343
  declare function cx(...classes: Array<string | false | null | undefined>): string;
337
344
 
338
- export { type ColorScale, type ColorsAPI, type FrameworkConfig, type InteractionState, InteractiveWrapper, type InteractiveWrapperProps, type ParsedClass, type PluginAPI, type ResolvedConfig, type ResolvedStyle, type StyleValue, type StyledProps, type ThemeConfig, ThemeContext, type ThemeContextValue, type ThemeMode, ThemeProvider, type ThemeProviderProps, ThemeToggle, type ThemeToggleProps, type ToggleVariant, buildConfig, cx, defaultColors, defaultTheme, flatten, getConfig, kb, parseClass, parseClasses, resolve, styled, updateConfig, useColors, useGlobalDarkMode, useIsDark, useResolvedStyle, useStyles, useTheme, wrapColors };
345
+ export { type ColorScale, type ColorsAPI, type FrameworkConfig, type InteractionState, InteractiveWrapper, type InteractiveWrapperProps, type ParsedClass, type PluginAPI, type ResolvedConfig, type ResolvedStyle, type StyleValue, type StyledProps, type ThemeConfig, ThemeContext, type ThemeContextValue, type ThemeMode, ThemeProvider, type ThemeProviderProps, ThemeToggle, type ThemeToggleProps, type ToggleVariant, buildConfig, cx, defaultColors, defaultTheme, flatten, getConfig, initConfig, kb, parseClass, parseClasses, resolve, styled, updateConfig, useColors, useGlobalDarkMode, useIsDark, useResolvedStyle, useStyles, useTheme, wrapColors };
package/dist/index.d.ts CHANGED
@@ -122,6 +122,13 @@ declare function flatten(resolved: ResolvedStyle, isDark: boolean, state?: {
122
122
  declare function getConfig(): ResolvedConfig;
123
123
  declare function buildConfig(userConfig: FrameworkConfig): ResolvedConfig;
124
124
  declare function updateConfig(userConfig: FrameworkConfig): void;
125
+ /**
126
+ * Like updateConfig, but only calls it when the config object reference has
127
+ * actually changed. Used by the Babel-injected IIFE so that:
128
+ * - multiple files with kbach classes don't re-run the update on every load
129
+ * - Fast Refresh DOES re-run when kbach.config.js changes (new module → new object)
130
+ */
131
+ declare function initConfig(userConfig: FrameworkConfig): void;
125
132
 
126
133
  interface ThemeContextValue {
127
134
  /** The user-selected mode ('light' | 'dark' | 'system') */
@@ -335,4 +342,4 @@ declare function kb(classString: string, isDark?: boolean): StyleValue | string;
335
342
  */
336
343
  declare function cx(...classes: Array<string | false | null | undefined>): string;
337
344
 
338
- export { type ColorScale, type ColorsAPI, type FrameworkConfig, type InteractionState, InteractiveWrapper, type InteractiveWrapperProps, type ParsedClass, type PluginAPI, type ResolvedConfig, type ResolvedStyle, type StyleValue, type StyledProps, type ThemeConfig, ThemeContext, type ThemeContextValue, type ThemeMode, ThemeProvider, type ThemeProviderProps, ThemeToggle, type ThemeToggleProps, type ToggleVariant, buildConfig, cx, defaultColors, defaultTheme, flatten, getConfig, kb, parseClass, parseClasses, resolve, styled, updateConfig, useColors, useGlobalDarkMode, useIsDark, useResolvedStyle, useStyles, useTheme, wrapColors };
345
+ export { type ColorScale, type ColorsAPI, type FrameworkConfig, type InteractionState, InteractiveWrapper, type InteractiveWrapperProps, type ParsedClass, type PluginAPI, type ResolvedConfig, type ResolvedStyle, type StyleValue, type StyledProps, type ThemeConfig, ThemeContext, type ThemeContextValue, type ThemeMode, ThemeProvider, type ThemeProviderProps, ThemeToggle, type ThemeToggleProps, type ToggleVariant, buildConfig, cx, defaultColors, defaultTheme, flatten, getConfig, initConfig, kb, parseClass, parseClasses, resolve, styled, updateConfig, useColors, useGlobalDarkMode, useIsDark, useResolvedStyle, useStyles, useTheme, wrapColors };
package/dist/index.js CHANGED
@@ -40,6 +40,7 @@ __export(index_exports, {
40
40
  defaultTheme: () => defaultTheme,
41
41
  flatten: () => flatten,
42
42
  getConfig: () => getConfig,
43
+ initConfig: () => initConfig,
43
44
  kb: () => kb,
44
45
  parseClass: () => parseClass,
45
46
  parseClasses: () => parseClasses,
@@ -1964,9 +1965,6 @@ function clearPluginUtilities() {
1964
1965
  function getPluginStandaloneMap() {
1965
1966
  return PLUGIN_STANDALONE;
1966
1967
  }
1967
- function getPluginResolverMap() {
1968
- return PLUGIN_RESOLVERS;
1969
- }
1970
1968
 
1971
1969
  // src/core/resolver.ts
1972
1970
  var styleCache = new LRUCache(1e4);
@@ -2245,7 +2243,6 @@ function buildConfig(userConfig) {
2245
2243
  }
2246
2244
  function makePluginAPI(theme) {
2247
2245
  const standalone = getPluginStandaloneMap();
2248
- const resolvers = getPluginResolverMap();
2249
2246
  return {
2250
2247
  addUtility(name, styles) {
2251
2248
  standalone[name] = styles;
@@ -2276,11 +2273,16 @@ function onConfigChange(listener) {
2276
2273
  function updateConfig(userConfig) {
2277
2274
  const store = getConfigStore();
2278
2275
  store.resolved = buildConfig(userConfig);
2276
+ store._src = userConfig;
2279
2277
  clearCache();
2280
2278
  for (const listener of store.listeners) {
2281
2279
  listener(store.resolved);
2282
2280
  }
2283
2281
  }
2282
+ function initConfig(userConfig) {
2283
+ if (getConfigStore()._src === userConfig) return;
2284
+ updateConfig(userConfig);
2285
+ }
2284
2286
  var customVariants = new Proxy(
2285
2287
  {},
2286
2288
  {
@@ -2409,7 +2411,8 @@ function ThemeProvider({
2409
2411
  }, []);
2410
2412
  (0, import_react3.useEffect)(() => {
2411
2413
  if (!configOverride) return;
2412
- setResolvedConfig(buildConfig(configOverride));
2414
+ updateConfig(configOverride);
2415
+ setResolvedConfig(getConfig());
2413
2416
  }, [configOverride]);
2414
2417
  (0, import_react3.useEffect)(() => {
2415
2418
  if (configOverride) return;
@@ -2747,6 +2750,7 @@ function cx(...classes) {
2747
2750
  defaultTheme,
2748
2751
  flatten,
2749
2752
  getConfig,
2753
+ initConfig,
2750
2754
  kb,
2751
2755
  parseClass,
2752
2756
  parseClasses,
package/dist/index.mjs CHANGED
@@ -6,6 +6,7 @@ import {
6
6
  defaultTheme,
7
7
  flatten,
8
8
  getConfig,
9
+ initConfig,
9
10
  isWeb,
10
11
  onConfigChange,
11
12
  parseClass,
@@ -15,7 +16,7 @@ import {
15
16
  syncGlobalDarkMode,
16
17
  updateConfig,
17
18
  useGlobalDarkMode
18
- } from "./chunk-V5KHX4CZ.mjs";
19
+ } from "./chunk-7XL6VQDW.mjs";
19
20
 
20
21
  // src/context.tsx
21
22
  import { createContext, useContext } from "react";
@@ -176,7 +177,8 @@ function ThemeProvider({
176
177
  }, []);
177
178
  useEffect(() => {
178
179
  if (!configOverride) return;
179
- setResolvedConfig(buildConfig(configOverride));
180
+ updateConfig(configOverride);
181
+ setResolvedConfig(getConfig());
180
182
  }, [configOverride]);
181
183
  useEffect(() => {
182
184
  if (configOverride) return;
@@ -447,6 +449,7 @@ export {
447
449
  defaultTheme,
448
450
  flatten,
449
451
  getConfig,
452
+ initConfig,
450
453
  kb,
451
454
  parseClass,
452
455
  parseClasses,
@@ -1870,9 +1870,6 @@ function clearPluginUtilities() {
1870
1870
  function getPluginStandaloneMap() {
1871
1871
  return PLUGIN_STANDALONE;
1872
1872
  }
1873
- function getPluginResolverMap() {
1874
- return PLUGIN_RESOLVERS;
1875
- }
1876
1873
 
1877
1874
  // src/core/resolver.ts
1878
1875
  var styleCache = new LRUCache(1e4);
@@ -2148,7 +2145,6 @@ function buildConfig(userConfig) {
2148
2145
  }
2149
2146
  function makePluginAPI(theme) {
2150
2147
  const standalone = getPluginStandaloneMap();
2151
- const resolvers = getPluginResolverMap();
2152
2148
  return {
2153
2149
  addUtility(name, styles) {
2154
2150
  standalone[name] = styles;
@@ -2,8 +2,8 @@ import {
2
2
  Fragment,
3
3
  jsx,
4
4
  jsxs
5
- } from "./chunk-Q5RMVTAU.mjs";
6
- import "./chunk-V5KHX4CZ.mjs";
5
+ } from "./chunk-NFPYOE5K.mjs";
6
+ import "./chunk-7XL6VQDW.mjs";
7
7
 
8
8
  // src/jsx-dev-runtime.tsx
9
9
  function jsxDEV(type, props, key, isStaticChildren, _source, _self) {
@@ -1869,9 +1869,6 @@ function clearPluginUtilities() {
1869
1869
  function getPluginStandaloneMap() {
1870
1870
  return PLUGIN_STANDALONE;
1871
1871
  }
1872
- function getPluginResolverMap() {
1873
- return PLUGIN_RESOLVERS;
1874
- }
1875
1872
 
1876
1873
  // src/core/resolver.ts
1877
1874
  var styleCache = new LRUCache(1e4);
@@ -2147,7 +2144,6 @@ function buildConfig(userConfig) {
2147
2144
  }
2148
2145
  function makePluginAPI(theme) {
2149
2146
  const standalone = getPluginStandaloneMap();
2150
- const resolvers = getPluginResolverMap();
2151
2147
  return {
2152
2148
  addUtility(name, styles) {
2153
2149
  standalone[name] = styles;
@@ -2,8 +2,8 @@ import {
2
2
  Fragment,
3
3
  jsx,
4
4
  jsxs
5
- } from "./chunk-Q5RMVTAU.mjs";
6
- import "./chunk-V5KHX4CZ.mjs";
5
+ } from "./chunk-NFPYOE5K.mjs";
6
+ import "./chunk-7XL6VQDW.mjs";
7
7
  export {
8
8
  Fragment,
9
9
  jsx,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kbach/react",
3
- "version": "0.3.2",
3
+ "version": "0.3.3",
4
4
  "description": "React / React Native components and hooks for the Kbach framework",
5
5
  "source": "./src/index.ts",
6
6
  "main": "./dist/index.js",