@kbach/react 0.5.5 → 0.5.6

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.
@@ -8,7 +8,7 @@ import {
8
8
  resolve,
9
9
  useConditionalWidth,
10
10
  useGlobalDarkMode
11
- } from "./chunk-D7Q7ZCOW.mjs";
11
+ } from "./chunk-MNDU7U43.mjs";
12
12
 
13
13
  // src/jsx-runtime.tsx
14
14
  import { jsx as _jsx, jsxs as _jsxs, Fragment } from "react/jsx-runtime";
@@ -3384,16 +3384,21 @@ function buildConfig(userConfig) {
3384
3384
  if (userConfig.theme) {
3385
3385
  theme = deepMerge(theme, userConfig.theme);
3386
3386
  }
3387
- if (userConfig.extend?.theme) {
3388
- const ext = userConfig.extend.theme;
3389
- for (const [key, value] of Object.entries(ext)) {
3390
- if (value !== null && typeof value === "object" && !Array.isArray(value)) {
3391
- theme[key] = deepMerge(
3392
- theme[key] ?? {},
3393
- value
3394
- );
3395
- } else {
3396
- theme[key] = value;
3387
+ if (userConfig.extend) {
3388
+ const { theme: nestedTheme, ...directKeys } = userConfig.extend;
3389
+ const extSources = [];
3390
+ if (nestedTheme) extSources.push(nestedTheme);
3391
+ if (Object.keys(directKeys).length) extSources.push(directKeys);
3392
+ for (const ext of extSources) {
3393
+ for (const [key, value] of Object.entries(ext)) {
3394
+ if (value !== null && typeof value === "object" && !Array.isArray(value)) {
3395
+ theme[key] = deepMerge(
3396
+ theme[key] ?? {},
3397
+ value
3398
+ );
3399
+ } else if (value !== void 0) {
3400
+ theme[key] = value;
3401
+ }
3397
3402
  }
3398
3403
  }
3399
3404
  }
package/dist/index.d.mts CHANGED
@@ -57,9 +57,10 @@ interface PluginAPI {
57
57
  interface FrameworkConfig {
58
58
  darkMode?: DarkMode;
59
59
  theme?: Partial<ThemeConfig>;
60
+ /** Additive theme extension — accepts either `extend.theme.X` or `extend.X` directly. */
60
61
  extend?: {
61
62
  theme?: Partial<ThemeConfig>;
62
- };
63
+ } & Partial<ThemeConfig>;
63
64
  plugins?: Array<(api: PluginAPI) => void>;
64
65
  content?: string[];
65
66
  }
package/dist/index.d.ts CHANGED
@@ -57,9 +57,10 @@ interface PluginAPI {
57
57
  interface FrameworkConfig {
58
58
  darkMode?: DarkMode;
59
59
  theme?: Partial<ThemeConfig>;
60
+ /** Additive theme extension — accepts either `extend.theme.X` or `extend.X` directly. */
60
61
  extend?: {
61
62
  theme?: Partial<ThemeConfig>;
62
- };
63
+ } & Partial<ThemeConfig>;
63
64
  plugins?: Array<(api: PluginAPI) => void>;
64
65
  content?: string[];
65
66
  }
package/dist/index.js CHANGED
@@ -3514,16 +3514,21 @@ function buildConfig(userConfig) {
3514
3514
  if (userConfig.theme) {
3515
3515
  theme = deepMerge(theme, userConfig.theme);
3516
3516
  }
3517
- if (userConfig.extend?.theme) {
3518
- const ext = userConfig.extend.theme;
3519
- for (const [key, value] of Object.entries(ext)) {
3520
- if (value !== null && typeof value === "object" && !Array.isArray(value)) {
3521
- theme[key] = deepMerge(
3522
- theme[key] ?? {},
3523
- value
3524
- );
3525
- } else {
3526
- theme[key] = value;
3517
+ if (userConfig.extend) {
3518
+ const { theme: nestedTheme, ...directKeys } = userConfig.extend;
3519
+ const extSources = [];
3520
+ if (nestedTheme) extSources.push(nestedTheme);
3521
+ if (Object.keys(directKeys).length) extSources.push(directKeys);
3522
+ for (const ext of extSources) {
3523
+ for (const [key, value] of Object.entries(ext)) {
3524
+ if (value !== null && typeof value === "object" && !Array.isArray(value)) {
3525
+ theme[key] = deepMerge(
3526
+ theme[key] ?? {},
3527
+ value
3528
+ );
3529
+ } else if (value !== void 0) {
3530
+ theme[key] = value;
3531
+ }
3527
3532
  }
3528
3533
  }
3529
3534
  }
package/dist/index.mjs CHANGED
@@ -23,7 +23,7 @@ import {
23
23
  useConditionalWidth,
24
24
  useGlobalDarkMode,
25
25
  useGlobalWidth
26
- } from "./chunk-D7Q7ZCOW.mjs";
26
+ } from "./chunk-MNDU7U43.mjs";
27
27
 
28
28
  // src/context.tsx
29
29
  import { createContext, useContext } from "react";
@@ -3397,16 +3397,21 @@ function buildConfig(userConfig) {
3397
3397
  if (userConfig.theme) {
3398
3398
  theme = deepMerge(theme, userConfig.theme);
3399
3399
  }
3400
- if (userConfig.extend?.theme) {
3401
- const ext = userConfig.extend.theme;
3402
- for (const [key, value] of Object.entries(ext)) {
3403
- if (value !== null && typeof value === "object" && !Array.isArray(value)) {
3404
- theme[key] = deepMerge(
3405
- theme[key] ?? {},
3406
- value
3407
- );
3408
- } else {
3409
- theme[key] = value;
3400
+ if (userConfig.extend) {
3401
+ const { theme: nestedTheme, ...directKeys } = userConfig.extend;
3402
+ const extSources = [];
3403
+ if (nestedTheme) extSources.push(nestedTheme);
3404
+ if (Object.keys(directKeys).length) extSources.push(directKeys);
3405
+ for (const ext of extSources) {
3406
+ for (const [key, value] of Object.entries(ext)) {
3407
+ if (value !== null && typeof value === "object" && !Array.isArray(value)) {
3408
+ theme[key] = deepMerge(
3409
+ theme[key] ?? {},
3410
+ value
3411
+ );
3412
+ } else if (value !== void 0) {
3413
+ theme[key] = value;
3414
+ }
3410
3415
  }
3411
3416
  }
3412
3417
  }
@@ -2,8 +2,8 @@ import {
2
2
  Fragment,
3
3
  jsx,
4
4
  jsxs
5
- } from "./chunk-UR4DTYE3.mjs";
6
- import "./chunk-D7Q7ZCOW.mjs";
5
+ } from "./chunk-BQJS4P2Z.mjs";
6
+ import "./chunk-MNDU7U43.mjs";
7
7
 
8
8
  // src/jsx-dev-runtime.tsx
9
9
  function jsxDEV(type, props, key, isStaticChildren, _source, _self) {
@@ -3396,16 +3396,21 @@ function buildConfig(userConfig) {
3396
3396
  if (userConfig.theme) {
3397
3397
  theme = deepMerge(theme, userConfig.theme);
3398
3398
  }
3399
- if (userConfig.extend?.theme) {
3400
- const ext = userConfig.extend.theme;
3401
- for (const [key, value] of Object.entries(ext)) {
3402
- if (value !== null && typeof value === "object" && !Array.isArray(value)) {
3403
- theme[key] = deepMerge(
3404
- theme[key] ?? {},
3405
- value
3406
- );
3407
- } else {
3408
- theme[key] = value;
3399
+ if (userConfig.extend) {
3400
+ const { theme: nestedTheme, ...directKeys } = userConfig.extend;
3401
+ const extSources = [];
3402
+ if (nestedTheme) extSources.push(nestedTheme);
3403
+ if (Object.keys(directKeys).length) extSources.push(directKeys);
3404
+ for (const ext of extSources) {
3405
+ for (const [key, value] of Object.entries(ext)) {
3406
+ if (value !== null && typeof value === "object" && !Array.isArray(value)) {
3407
+ theme[key] = deepMerge(
3408
+ theme[key] ?? {},
3409
+ value
3410
+ );
3411
+ } else if (value !== void 0) {
3412
+ theme[key] = value;
3413
+ }
3409
3414
  }
3410
3415
  }
3411
3416
  }
@@ -2,8 +2,8 @@ import {
2
2
  Fragment,
3
3
  jsx,
4
4
  jsxs
5
- } from "./chunk-UR4DTYE3.mjs";
6
- import "./chunk-D7Q7ZCOW.mjs";
5
+ } from "./chunk-BQJS4P2Z.mjs";
6
+ import "./chunk-MNDU7U43.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.5.5",
3
+ "version": "0.5.6",
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",