@kbach/react 0.5.4 → 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
  }
@@ -3968,6 +3973,9 @@ function styled(Component, baseClasses = "") {
3968
3973
  style: styleProp,
3969
3974
  onPressIn,
3970
3975
  onPressOut,
3976
+ onPointerDown,
3977
+ onPointerUp,
3978
+ onPointerLeave,
3971
3979
  onMouseEnter,
3972
3980
  onMouseLeave,
3973
3981
  onFocus,
@@ -3986,6 +3994,18 @@ function styled(Component, baseClasses = "") {
3986
3994
  setPressed(false);
3987
3995
  onPressOut?.(e);
3988
3996
  }, [onPressOut]);
3997
+ const handlePointerDown = (0, import_react6.useCallback)((e) => {
3998
+ setPressed(true);
3999
+ onPointerDown?.(e);
4000
+ }, [onPointerDown]);
4001
+ const handlePointerUp = (0, import_react6.useCallback)((e) => {
4002
+ setPressed(false);
4003
+ onPointerUp?.(e);
4004
+ }, [onPointerUp]);
4005
+ const handlePointerLeave = (0, import_react6.useCallback)((e) => {
4006
+ setPressed(false);
4007
+ onPointerLeave?.(e);
4008
+ }, [onPointerLeave]);
3989
4009
  const handleMouseEnter = (0, import_react6.useCallback)((e) => {
3990
4010
  setHovered(true);
3991
4011
  onMouseEnter?.(e);
@@ -4020,9 +4040,8 @@ function styled(Component, baseClasses = "") {
4020
4040
  style: finalStyle,
4021
4041
  // className lets injected CSS rules (group-hover:, before:, print:, etc.) match the element.
4022
4042
  ...isWeb && combined ? { className: combined } : {},
4023
- // onPressIn / onPressOut are React Native-only events; forwarding them to
4024
- // a DOM element on web triggers React's unknown-prop warning.
4025
- ...isWeb ? {} : { onPressIn: handlePressIn, onPressOut: handlePressOut },
4043
+ // onPressIn / onPressOut are React Native-only; on web use Pointer Events instead.
4044
+ ...isWeb ? { onPointerDown: handlePointerDown, onPointerUp: handlePointerUp, onPointerLeave: handlePointerLeave } : { onPressIn: handlePressIn, onPressOut: handlePressOut },
4026
4045
  onMouseEnter: handleMouseEnter,
4027
4046
  onMouseLeave: handleMouseLeave,
4028
4047
  onFocus: handleFocus,
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";
@@ -390,6 +390,9 @@ function styled(Component, baseClasses = "") {
390
390
  style: styleProp,
391
391
  onPressIn,
392
392
  onPressOut,
393
+ onPointerDown,
394
+ onPointerUp,
395
+ onPointerLeave,
393
396
  onMouseEnter,
394
397
  onMouseLeave,
395
398
  onFocus,
@@ -408,6 +411,18 @@ function styled(Component, baseClasses = "") {
408
411
  setPressed(false);
409
412
  onPressOut?.(e);
410
413
  }, [onPressOut]);
414
+ const handlePointerDown = useCallback3((e) => {
415
+ setPressed(true);
416
+ onPointerDown?.(e);
417
+ }, [onPointerDown]);
418
+ const handlePointerUp = useCallback3((e) => {
419
+ setPressed(false);
420
+ onPointerUp?.(e);
421
+ }, [onPointerUp]);
422
+ const handlePointerLeave = useCallback3((e) => {
423
+ setPressed(false);
424
+ onPointerLeave?.(e);
425
+ }, [onPointerLeave]);
411
426
  const handleMouseEnter = useCallback3((e) => {
412
427
  setHovered(true);
413
428
  onMouseEnter?.(e);
@@ -442,9 +457,8 @@ function styled(Component, baseClasses = "") {
442
457
  style: finalStyle,
443
458
  // className lets injected CSS rules (group-hover:, before:, print:, etc.) match the element.
444
459
  ...isWeb && combined ? { className: combined } : {},
445
- // onPressIn / onPressOut are React Native-only events; forwarding them to
446
- // a DOM element on web triggers React's unknown-prop warning.
447
- ...isWeb ? {} : { onPressIn: handlePressIn, onPressOut: handlePressOut },
460
+ // onPressIn / onPressOut are React Native-only; on web use Pointer Events instead.
461
+ ...isWeb ? { onPointerDown: handlePointerDown, onPointerUp: handlePointerUp, onPointerLeave: handlePointerLeave } : { onPressIn: handlePressIn, onPressOut: handlePressOut },
448
462
  onMouseEnter: handleMouseEnter,
449
463
  onMouseLeave: handleMouseLeave,
450
464
  onFocus: handleFocus,
@@ -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.4",
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",