@kbach/react 0.5.46 → 0.5.48
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/README.md +1 -1
- package/dist/{chunk-G76344ZQ.mjs → chunk-BKSXIWL7.mjs} +14 -11
- package/dist/chunk-YZNSWFJT.mjs +544 -0
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +127 -28
- package/dist/index.mjs +30 -16
- package/dist/jsx-dev-runtime.js +122 -33
- package/dist/jsx-dev-runtime.mjs +2 -3
- package/dist/jsx-runtime.d.mts +12 -1
- package/dist/jsx-runtime.d.ts +12 -1
- package/dist/jsx-runtime.js +131 -35
- package/dist/jsx-runtime.mjs +6 -5
- package/dist/vite-plugin.js +35 -22
- package/dist/vite-plugin.mjs +22 -12
- package/package.json +1 -1
- package/dist/chunk-ISCQQRG5.mjs +0 -232
- package/dist/chunk-ZN5E7I56.mjs +0 -226
package/dist/index.js
CHANGED
|
@@ -46,6 +46,7 @@ __export(index_exports, {
|
|
|
46
46
|
normalizeClassString: () => normalizeClassString,
|
|
47
47
|
parseClass: () => parseClass,
|
|
48
48
|
parseClasses: () => parseClasses,
|
|
49
|
+
registerWebElement: () => registerWebElement,
|
|
49
50
|
resolve: () => resolve,
|
|
50
51
|
splitClassTokens: () => splitClassTokens,
|
|
51
52
|
styled: () => styled,
|
|
@@ -835,6 +836,12 @@ function isKnownModifier(name) {
|
|
|
835
836
|
function _allEntries() {
|
|
836
837
|
return [...Object.entries(BUILTIN_MODIFIERS), ...Object.entries(_pluginModifiers)];
|
|
837
838
|
}
|
|
839
|
+
function getInteractiveModifiers() {
|
|
840
|
+
if (!_interactiveNames) {
|
|
841
|
+
_interactiveNames = new Set(_allEntries().filter(([, d]) => d.jsBehavior === "interactive").map(([k]) => k));
|
|
842
|
+
}
|
|
843
|
+
return _interactiveNames;
|
|
844
|
+
}
|
|
838
845
|
function getResponsiveModifiers() {
|
|
839
846
|
if (!_responsiveNames) {
|
|
840
847
|
_responsiveNames = new Set(_allEntries().filter(([, d]) => d.jsBehavior === "responsive").map(([k]) => k));
|
|
@@ -887,7 +894,12 @@ function resolveColor(value, colors, isArbitrary) {
|
|
|
887
894
|
}
|
|
888
895
|
}
|
|
889
896
|
if (!hex) return null;
|
|
890
|
-
if (!opacityPart)
|
|
897
|
+
if (!opacityPart) {
|
|
898
|
+
if (!isWeb && hex.startsWith("#") && hex.length === 9) {
|
|
899
|
+
return hexToRgba(hex, Math.round(parseInt(hex.slice(7, 9), 16) / 255 * 1e3) / 1e3);
|
|
900
|
+
}
|
|
901
|
+
return hex;
|
|
902
|
+
}
|
|
891
903
|
let alpha;
|
|
892
904
|
if (opacityPart.startsWith("[") && opacityPart.endsWith("]")) {
|
|
893
905
|
const v = parseFloat(opacityPart.slice(1, -1));
|
|
@@ -2450,12 +2462,6 @@ var RESOLVERS = {
|
|
|
2450
2462
|
function resolveUtility(parsed, theme) {
|
|
2451
2463
|
if (!parsed.value) {
|
|
2452
2464
|
if (parsed.utility in PLUGIN_STANDALONE) return PLUGIN_STANDALONE[parsed.utility] ?? null;
|
|
2453
|
-
if (parsed.utility === "grd" || parsed.utility === "grid") {
|
|
2454
|
-
return getEffectiveIsWeb() ? { display: "grid" } : null;
|
|
2455
|
-
}
|
|
2456
|
-
if (parsed.utility === "inline-grid") {
|
|
2457
|
-
return getEffectiveIsWeb() ? { display: "inline-grid" } : null;
|
|
2458
|
-
}
|
|
2459
2465
|
if (parsed.utility in getStandalone()) return getStandalone()[parsed.utility] ?? null;
|
|
2460
2466
|
}
|
|
2461
2467
|
const resolver = PLUGIN_RESOLVERS[parsed.utility] ?? RESOLVERS[parsed.utility];
|
|
@@ -2606,16 +2612,18 @@ function findOuterColon(s) {
|
|
|
2606
2612
|
|
|
2607
2613
|
// src/core/reset.ts
|
|
2608
2614
|
var BASE_RESET = [
|
|
2609
|
-
|
|
2615
|
+
// border-style: solid means border-N utilities show a visible border without an extra border-solid class.
|
|
2616
|
+
// border-width: 0 keeps all elements borderless by default.
|
|
2617
|
+
"*, *::before, *::after { box-sizing: border-box; border-width: 0; border-style: solid; border-color: currentColor; }",
|
|
2610
2618
|
"body { margin: 0; padding: 0; }",
|
|
2611
2619
|
"h1, h2, h3, h4, h5, h6 { margin: 0; font-size: inherit; font-weight: inherit; }",
|
|
2612
2620
|
"p { margin: 0; }",
|
|
2613
2621
|
"a { color: inherit; text-decoration: none; }",
|
|
2614
2622
|
"ul, ol { margin: 0; padding: 0; list-style: none; }",
|
|
2615
2623
|
"img, video, svg { display: block; max-width: 100%; }",
|
|
2616
|
-
"input, textarea, select { appearance: none; -webkit-appearance: none; background: transparent;
|
|
2617
|
-
"button { appearance: none; -webkit-appearance: none; background: transparent;
|
|
2618
|
-
"fieldset {
|
|
2624
|
+
"input, textarea, select { appearance: none; -webkit-appearance: none; background: transparent; padding: 0; margin: 0; font: inherit; color: inherit; line-height: inherit; }",
|
|
2625
|
+
"button { appearance: none; -webkit-appearance: none; background: transparent; padding: 0; margin: 0; font: inherit; color: inherit; cursor: pointer; line-height: inherit; text-align: inherit; }",
|
|
2626
|
+
"fieldset { padding: 0; margin: 0; }",
|
|
2619
2627
|
"table { border-collapse: collapse; border-spacing: 0; }"
|
|
2620
2628
|
].join("\n");
|
|
2621
2629
|
|
|
@@ -3060,6 +3068,8 @@ function buildConfig(userConfig) {
|
|
|
3060
3068
|
};
|
|
3061
3069
|
clearPluginUtilities();
|
|
3062
3070
|
clearPluginModifiers();
|
|
3071
|
+
const _store = getConfigStore();
|
|
3072
|
+
for (const k of Object.keys(_store.customVariants)) delete _store.customVariants[k];
|
|
3063
3073
|
const pluginAPI = makePluginAPI(resolved.theme);
|
|
3064
3074
|
for (const plugin of resolved.plugins) {
|
|
3065
3075
|
plugin(pluginAPI);
|
|
@@ -3215,16 +3225,23 @@ function ThemeProvider({
|
|
|
3215
3225
|
() => isWeb && typeof window !== "undefined" ? window.innerWidth : 0
|
|
3216
3226
|
);
|
|
3217
3227
|
const effectiveWidth = windowWidthProp ?? (isWeb ? webWidth : 0);
|
|
3218
|
-
const numericScreens = {
|
|
3219
|
-
|
|
3220
|
-
|
|
3221
|
-
|
|
3228
|
+
const numericScreens = (0, import_react3.useMemo)(() => {
|
|
3229
|
+
const out = {};
|
|
3230
|
+
for (const [k, v] of Object.entries(resolvedConfig.theme.screens ?? {})) {
|
|
3231
|
+
out[k] = typeof v === "number" ? v : parseInt(String(v), 10);
|
|
3232
|
+
}
|
|
3233
|
+
return out;
|
|
3234
|
+
}, [resolvedConfig.theme.screens]);
|
|
3222
3235
|
const _prevWidthRef = (0, import_react3.useRef)(-1);
|
|
3223
3236
|
if (_prevWidthRef.current !== effectiveWidth) {
|
|
3224
3237
|
_prevWidthRef.current = effectiveWidth;
|
|
3225
3238
|
syncGlobalWidth(effectiveWidth);
|
|
3226
3239
|
}
|
|
3227
|
-
|
|
3240
|
+
const _prevScreensRef = (0, import_react3.useRef)(null);
|
|
3241
|
+
if (_prevScreensRef.current !== numericScreens) {
|
|
3242
|
+
_prevScreensRef.current = numericScreens;
|
|
3243
|
+
syncGlobalScreens(numericScreens);
|
|
3244
|
+
}
|
|
3228
3245
|
(0, import_react3.useEffect)(() => {
|
|
3229
3246
|
setGlobalWidth(effectiveWidth);
|
|
3230
3247
|
}, [effectiveWidth]);
|
|
@@ -3509,6 +3526,17 @@ function hasResponsiveBuckets(resolved) {
|
|
|
3509
3526
|
}
|
|
3510
3527
|
return false;
|
|
3511
3528
|
}
|
|
3529
|
+
function hasInteractiveBuckets(resolved) {
|
|
3530
|
+
const interactiveMods = getInteractiveModifiers();
|
|
3531
|
+
for (const key of Object.keys(resolved)) {
|
|
3532
|
+
if (key === "base") continue;
|
|
3533
|
+
for (const mod of key.split(":")) {
|
|
3534
|
+
if (interactiveMods.has(mod)) return true;
|
|
3535
|
+
}
|
|
3536
|
+
}
|
|
3537
|
+
return false;
|
|
3538
|
+
}
|
|
3539
|
+
var EMPTY_BREAKPOINTS2 = /* @__PURE__ */ new Set();
|
|
3512
3540
|
|
|
3513
3541
|
// src/styled.tsx
|
|
3514
3542
|
function styled(Component, baseClasses = "") {
|
|
@@ -3528,6 +3556,8 @@ function styled(Component, baseClasses = "") {
|
|
|
3528
3556
|
onBlur,
|
|
3529
3557
|
...rest
|
|
3530
3558
|
} = props;
|
|
3559
|
+
const disabled = !!props.disabled;
|
|
3560
|
+
const checked = !!props.checked;
|
|
3531
3561
|
const { isDark, config } = useTheme();
|
|
3532
3562
|
const [pressed, setPressed] = (0, import_react6.useState)(false);
|
|
3533
3563
|
const [hovered, setHovered] = (0, import_react6.useState)(false);
|
|
@@ -3570,28 +3600,30 @@ function styled(Component, baseClasses = "") {
|
|
|
3570
3600
|
}, [onBlur]);
|
|
3571
3601
|
const combined = extraClasses ? `${baseClasses} ${extraClasses}` : baseClasses;
|
|
3572
3602
|
const resolved = (0, import_react6.useMemo)(() => resolve(combined, config.theme, config.darkMode), [combined, config.theme, config.darkMode]);
|
|
3603
|
+
const hasInteractive = (0, import_react6.useMemo)(() => hasInteractiveBuckets(resolved), [resolved]);
|
|
3573
3604
|
const needsWidth = hasResponsiveBuckets(resolved);
|
|
3574
3605
|
const width = useConditionalWidth(needsWidth);
|
|
3575
3606
|
const breakpoints = needsWidth ? getActiveBreakpoints(width) : EMPTY_BREAKPOINTS;
|
|
3576
3607
|
const computedStyle = (0, import_react6.useMemo)(
|
|
3577
|
-
() => flatten(resolved, isDark, { pressed, hover: hovered, focus: focused }, breakpoints),
|
|
3578
|
-
[resolved, isDark, pressed, hovered, focused, width]
|
|
3608
|
+
() => flatten(resolved, isDark, { pressed, hover: hovered, focus: focused, disabled, checked }, breakpoints),
|
|
3609
|
+
[resolved, isDark, pressed, hovered, focused, disabled, checked, width]
|
|
3579
3610
|
// eslint-disable-line react-hooks/exhaustive-deps
|
|
3580
3611
|
);
|
|
3581
3612
|
const extraStyle = Array.isArray(styleProp) ? Object.assign({}, ...styleProp) : styleProp;
|
|
3582
|
-
const finalStyle = extraStyle ? { ...computedStyle, ...extraStyle } : computedStyle;
|
|
3613
|
+
const finalStyle = isWeb ? extraStyle ?? void 0 : extraStyle ? { ...computedStyle, ...extraStyle } : computedStyle;
|
|
3583
3614
|
return import_react6.default.createElement(Component, {
|
|
3584
3615
|
ref,
|
|
3585
3616
|
...rest,
|
|
3586
3617
|
style: finalStyle,
|
|
3587
3618
|
// className lets injected CSS rules (group-hover:, before:, print:, etc.) match the element.
|
|
3588
3619
|
...isWeb && combined ? { className: normalizeClassString(combined) } : {},
|
|
3589
|
-
//
|
|
3590
|
-
|
|
3591
|
-
|
|
3592
|
-
|
|
3593
|
-
|
|
3594
|
-
|
|
3620
|
+
// Only attach state-tracking handlers when interactive modifiers are present.
|
|
3621
|
+
// Always forward user-provided handlers to avoid silently swallowing them.
|
|
3622
|
+
...isWeb ? hasInteractive ? { onPointerDown: handlePointerDown, onPointerUp: handlePointerUp, onPointerLeave: handlePointerLeave } : { onPointerDown, onPointerUp, onPointerLeave } : hasInteractive ? { onPressIn: handlePressIn, onPressOut: handlePressOut } : { onPressIn, onPressOut },
|
|
3623
|
+
onMouseEnter: hasInteractive ? handleMouseEnter : onMouseEnter,
|
|
3624
|
+
onMouseLeave: hasInteractive ? handleMouseLeave : onMouseLeave,
|
|
3625
|
+
onFocus: hasInteractive ? handleFocus : onFocus,
|
|
3626
|
+
onBlur: hasInteractive ? handleBlur : onBlur
|
|
3595
3627
|
});
|
|
3596
3628
|
}
|
|
3597
3629
|
);
|
|
@@ -3708,7 +3740,7 @@ var InteractiveWrapper = (0, import_react10.forwardRef)(
|
|
|
3708
3740
|
const handleBlur = (0, import_react10.useCallback)(chain(onBlur, () => setFocused(false)), [onBlur]);
|
|
3709
3741
|
const computedStyle = (0, import_react10.useMemo)(
|
|
3710
3742
|
() => {
|
|
3711
|
-
const s = flatten(resolvedStyle, isDark, { pressed, hover: hovered, focus: focused }, breakpoints);
|
|
3743
|
+
const s = flatten(resolvedStyle, isDark, { pressed, hover: hovered, focus: focused, disabled: !!rest.disabled, checked: !!rest.checked }, breakpoints);
|
|
3712
3744
|
delete s.__divideX;
|
|
3713
3745
|
delete s.__divideY;
|
|
3714
3746
|
delete s.__divideColor;
|
|
@@ -3742,8 +3774,8 @@ var InteractiveWrapper = (0, import_react10.forwardRef)(
|
|
|
3742
3774
|
[resolvedStyle, isDark, pressed, hovered, focused, width]
|
|
3743
3775
|
// eslint-disable-line react-hooks/exhaustive-deps
|
|
3744
3776
|
);
|
|
3745
|
-
const
|
|
3746
|
-
const finalStyle =
|
|
3777
|
+
const skipComputedInline = isWeb || !isNative && typeof Component === "string";
|
|
3778
|
+
const finalStyle = skipComputedInline ? styleProp ?? void 0 : styleProp ? Array.isArray(styleProp) ? Object.assign({}, computedStyle, ...styleProp) : { ...computedStyle, ...styleProp } : computedStyle;
|
|
3747
3779
|
const { children, ...restWithoutChildren } = rest;
|
|
3748
3780
|
const componentProps = {
|
|
3749
3781
|
ref,
|
|
@@ -3775,6 +3807,72 @@ function kb(classString, isDark = false) {
|
|
|
3775
3807
|
function cx(...classes) {
|
|
3776
3808
|
return classes.filter(Boolean).join(" ");
|
|
3777
3809
|
}
|
|
3810
|
+
|
|
3811
|
+
// src/jsx-runtime.tsx
|
|
3812
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
3813
|
+
var import_react12 = require("react");
|
|
3814
|
+
|
|
3815
|
+
// src/DarkWrapper.tsx
|
|
3816
|
+
var import_react11 = __toESM(require("react"));
|
|
3817
|
+
var DarkWrapper = import_react11.default.forwardRef(
|
|
3818
|
+
function DarkWrapper2({ Component, resolvedStyle, style: styleProp, children, ...rest }, ref) {
|
|
3819
|
+
const isDark = useGlobalDarkMode();
|
|
3820
|
+
const needsWidth = hasResponsiveBuckets(resolvedStyle);
|
|
3821
|
+
const width = useConditionalWidth(needsWidth);
|
|
3822
|
+
const breakpoints = needsWidth ? getActiveBreakpoints(width) : EMPTY_BREAKPOINTS2;
|
|
3823
|
+
const isNonStringComponent = typeof Component !== "string";
|
|
3824
|
+
const computedStyle = (0, import_react11.useMemo)(() => {
|
|
3825
|
+
const s = flatten(resolvedStyle, isDark, {}, breakpoints);
|
|
3826
|
+
stripInternalMarkers(s);
|
|
3827
|
+
if (isNonStringComponent) stripWebOnlyProps(s);
|
|
3828
|
+
return s;
|
|
3829
|
+
}, [resolvedStyle, isDark, width, isNonStringComponent]);
|
|
3830
|
+
const skipComputedInline = isWeb || !isNative && typeof Component === "string";
|
|
3831
|
+
const finalStyle = skipComputedInline ? styleProp ?? void 0 : styleProp ? Array.isArray(styleProp) ? Object.assign({}, computedStyle, ...styleProp) : { ...computedStyle, ...styleProp } : computedStyle;
|
|
3832
|
+
const props = { ref, ...rest, style: finalStyle };
|
|
3833
|
+
return Array.isArray(children) ? import_react11.default.createElement(Component, props, ...children) : import_react11.default.createElement(Component, props, children);
|
|
3834
|
+
}
|
|
3835
|
+
);
|
|
3836
|
+
DarkWrapper.displayName = "Kbach.DarkWrapper";
|
|
3837
|
+
function stripInternalMarkers(s) {
|
|
3838
|
+
delete s.__divideX;
|
|
3839
|
+
delete s.__divideY;
|
|
3840
|
+
delete s.__divideColor;
|
|
3841
|
+
delete s.__divideStyle;
|
|
3842
|
+
delete s.__keyframe;
|
|
3843
|
+
}
|
|
3844
|
+
function stripWebOnlyProps(s) {
|
|
3845
|
+
if (s.display === "grid" || s.display === "inline-grid") delete s.display;
|
|
3846
|
+
delete s.gridTemplateColumns;
|
|
3847
|
+
delete s.gridTemplateRows;
|
|
3848
|
+
delete s.gridColumn;
|
|
3849
|
+
delete s.gridRow;
|
|
3850
|
+
delete s.gridArea;
|
|
3851
|
+
delete s.gridColumnStart;
|
|
3852
|
+
delete s.gridColumnEnd;
|
|
3853
|
+
delete s.gridRowStart;
|
|
3854
|
+
delete s.gridRowEnd;
|
|
3855
|
+
delete s.gridAutoFlow;
|
|
3856
|
+
delete s.gridAutoColumns;
|
|
3857
|
+
delete s.gridAutoRows;
|
|
3858
|
+
delete s.placeItems;
|
|
3859
|
+
delete s.placeContent;
|
|
3860
|
+
delete s.justifyItems;
|
|
3861
|
+
delete s.placeSelf;
|
|
3862
|
+
delete s.justifySelf;
|
|
3863
|
+
if (s.position === "sticky" || s.position === "fixed" || s.position === "static") {
|
|
3864
|
+
delete s.position;
|
|
3865
|
+
}
|
|
3866
|
+
}
|
|
3867
|
+
|
|
3868
|
+
// src/jsx-runtime.tsx
|
|
3869
|
+
var _userWebTypeMap = /* @__PURE__ */ new Map();
|
|
3870
|
+
var _webTypeCache = /* @__PURE__ */ new WeakMap();
|
|
3871
|
+
function registerWebElement(rnComponent, htmlTag) {
|
|
3872
|
+
if (typeof rnComponent !== "object" && typeof rnComponent !== "function") return;
|
|
3873
|
+
_userWebTypeMap.set(rnComponent, htmlTag);
|
|
3874
|
+
_webTypeCache.delete(rnComponent);
|
|
3875
|
+
}
|
|
3778
3876
|
// Annotate the CommonJS export names for ESM import in node:
|
|
3779
3877
|
0 && (module.exports = {
|
|
3780
3878
|
InteractiveWrapper,
|
|
@@ -3793,6 +3891,7 @@ function cx(...classes) {
|
|
|
3793
3891
|
normalizeClassString,
|
|
3794
3892
|
parseClass,
|
|
3795
3893
|
parseClasses,
|
|
3894
|
+
registerWebElement,
|
|
3796
3895
|
resolve,
|
|
3797
3896
|
splitClassTokens,
|
|
3798
3897
|
styled,
|
package/dist/index.mjs
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
EMPTY_BREAKPOINTS,
|
|
3
3
|
InteractiveWrapper,
|
|
4
|
+
hasInteractiveBuckets,
|
|
4
5
|
hasResponsiveBuckets,
|
|
6
|
+
registerWebElement,
|
|
5
7
|
setGlobalDarkMode,
|
|
6
8
|
syncGlobalDarkMode,
|
|
7
9
|
useConditionalWidth,
|
|
8
10
|
useGlobalDarkMode,
|
|
9
11
|
useGlobalWidth
|
|
10
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-YZNSWFJT.mjs";
|
|
11
13
|
import {
|
|
12
14
|
__require,
|
|
13
15
|
buildConfig,
|
|
@@ -29,7 +31,7 @@ import {
|
|
|
29
31
|
syncGlobalScreens,
|
|
30
32
|
syncGlobalWidth,
|
|
31
33
|
updateConfig
|
|
32
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-BKSXIWL7.mjs";
|
|
33
35
|
|
|
34
36
|
// src/context.tsx
|
|
35
37
|
import { createContext, useContext } from "react";
|
|
@@ -166,16 +168,23 @@ function ThemeProvider({
|
|
|
166
168
|
() => isWeb && typeof window !== "undefined" ? window.innerWidth : 0
|
|
167
169
|
);
|
|
168
170
|
const effectiveWidth = windowWidthProp ?? (isWeb ? webWidth : 0);
|
|
169
|
-
const numericScreens = {
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
171
|
+
const numericScreens = useMemo2(() => {
|
|
172
|
+
const out = {};
|
|
173
|
+
for (const [k, v] of Object.entries(resolvedConfig.theme.screens ?? {})) {
|
|
174
|
+
out[k] = typeof v === "number" ? v : parseInt(String(v), 10);
|
|
175
|
+
}
|
|
176
|
+
return out;
|
|
177
|
+
}, [resolvedConfig.theme.screens]);
|
|
173
178
|
const _prevWidthRef = useRef(-1);
|
|
174
179
|
if (_prevWidthRef.current !== effectiveWidth) {
|
|
175
180
|
_prevWidthRef.current = effectiveWidth;
|
|
176
181
|
syncGlobalWidth(effectiveWidth);
|
|
177
182
|
}
|
|
178
|
-
|
|
183
|
+
const _prevScreensRef = useRef(null);
|
|
184
|
+
if (_prevScreensRef.current !== numericScreens) {
|
|
185
|
+
_prevScreensRef.current = numericScreens;
|
|
186
|
+
syncGlobalScreens(numericScreens);
|
|
187
|
+
}
|
|
179
188
|
useEffect(() => {
|
|
180
189
|
setGlobalWidth(effectiveWidth);
|
|
181
190
|
}, [effectiveWidth]);
|
|
@@ -416,6 +425,8 @@ function styled(Component, baseClasses = "") {
|
|
|
416
425
|
onBlur,
|
|
417
426
|
...rest
|
|
418
427
|
} = props;
|
|
428
|
+
const disabled = !!props.disabled;
|
|
429
|
+
const checked = !!props.checked;
|
|
419
430
|
const { isDark, config } = useTheme();
|
|
420
431
|
const [pressed, setPressed] = useState2(false);
|
|
421
432
|
const [hovered, setHovered] = useState2(false);
|
|
@@ -458,28 +469,30 @@ function styled(Component, baseClasses = "") {
|
|
|
458
469
|
}, [onBlur]);
|
|
459
470
|
const combined = extraClasses ? `${baseClasses} ${extraClasses}` : baseClasses;
|
|
460
471
|
const resolved = useMemo3(() => resolve(combined, config.theme, config.darkMode), [combined, config.theme, config.darkMode]);
|
|
472
|
+
const hasInteractive = useMemo3(() => hasInteractiveBuckets(resolved), [resolved]);
|
|
461
473
|
const needsWidth = hasResponsiveBuckets(resolved);
|
|
462
474
|
const width = useConditionalWidth(needsWidth);
|
|
463
475
|
const breakpoints = needsWidth ? getActiveBreakpoints(width) : EMPTY_BREAKPOINTS;
|
|
464
476
|
const computedStyle = useMemo3(
|
|
465
|
-
() => flatten(resolved, isDark, { pressed, hover: hovered, focus: focused }, breakpoints),
|
|
466
|
-
[resolved, isDark, pressed, hovered, focused, width]
|
|
477
|
+
() => flatten(resolved, isDark, { pressed, hover: hovered, focus: focused, disabled, checked }, breakpoints),
|
|
478
|
+
[resolved, isDark, pressed, hovered, focused, disabled, checked, width]
|
|
467
479
|
// eslint-disable-line react-hooks/exhaustive-deps
|
|
468
480
|
);
|
|
469
481
|
const extraStyle = Array.isArray(styleProp) ? Object.assign({}, ...styleProp) : styleProp;
|
|
470
|
-
const finalStyle = extraStyle ? { ...computedStyle, ...extraStyle } : computedStyle;
|
|
482
|
+
const finalStyle = isWeb ? extraStyle ?? void 0 : extraStyle ? { ...computedStyle, ...extraStyle } : computedStyle;
|
|
471
483
|
return React3.createElement(Component, {
|
|
472
484
|
ref,
|
|
473
485
|
...rest,
|
|
474
486
|
style: finalStyle,
|
|
475
487
|
// className lets injected CSS rules (group-hover:, before:, print:, etc.) match the element.
|
|
476
488
|
...isWeb && combined ? { className: normalizeClassString(combined) } : {},
|
|
477
|
-
//
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
489
|
+
// Only attach state-tracking handlers when interactive modifiers are present.
|
|
490
|
+
// Always forward user-provided handlers to avoid silently swallowing them.
|
|
491
|
+
...isWeb ? hasInteractive ? { onPointerDown: handlePointerDown, onPointerUp: handlePointerUp, onPointerLeave: handlePointerLeave } : { onPointerDown, onPointerUp, onPointerLeave } : hasInteractive ? { onPressIn: handlePressIn, onPressOut: handlePressOut } : { onPressIn, onPressOut },
|
|
492
|
+
onMouseEnter: hasInteractive ? handleMouseEnter : onMouseEnter,
|
|
493
|
+
onMouseLeave: hasInteractive ? handleMouseLeave : onMouseLeave,
|
|
494
|
+
onFocus: hasInteractive ? handleFocus : onFocus,
|
|
495
|
+
onBlur: hasInteractive ? handleBlur : onBlur
|
|
483
496
|
});
|
|
484
497
|
}
|
|
485
498
|
);
|
|
@@ -566,6 +579,7 @@ export {
|
|
|
566
579
|
normalizeClassString,
|
|
567
580
|
parseClass,
|
|
568
581
|
parseClasses,
|
|
582
|
+
registerWebElement,
|
|
569
583
|
resolve,
|
|
570
584
|
splitClassTokens,
|
|
571
585
|
styled,
|
package/dist/jsx-dev-runtime.js
CHANGED
|
@@ -787,7 +787,12 @@ function resolveColor(value, colors, isArbitrary) {
|
|
|
787
787
|
}
|
|
788
788
|
}
|
|
789
789
|
if (!hex) return null;
|
|
790
|
-
if (!opacityPart)
|
|
790
|
+
if (!opacityPart) {
|
|
791
|
+
if (!isWeb && hex.startsWith("#") && hex.length === 9) {
|
|
792
|
+
return hexToRgba(hex, Math.round(parseInt(hex.slice(7, 9), 16) / 255 * 1e3) / 1e3);
|
|
793
|
+
}
|
|
794
|
+
return hex;
|
|
795
|
+
}
|
|
791
796
|
let alpha;
|
|
792
797
|
if (opacityPart.startsWith("[") && opacityPart.endsWith("]")) {
|
|
793
798
|
const v = parseFloat(opacityPart.slice(1, -1));
|
|
@@ -2350,12 +2355,6 @@ var RESOLVERS = {
|
|
|
2350
2355
|
function resolveUtility(parsed, theme) {
|
|
2351
2356
|
if (!parsed.value) {
|
|
2352
2357
|
if (parsed.utility in PLUGIN_STANDALONE) return PLUGIN_STANDALONE[parsed.utility] ?? null;
|
|
2353
|
-
if (parsed.utility === "grd" || parsed.utility === "grid") {
|
|
2354
|
-
return getEffectiveIsWeb() ? { display: "grid" } : null;
|
|
2355
|
-
}
|
|
2356
|
-
if (parsed.utility === "inline-grid") {
|
|
2357
|
-
return getEffectiveIsWeb() ? { display: "inline-grid" } : null;
|
|
2358
|
-
}
|
|
2359
2358
|
if (parsed.utility in getStandalone()) return getStandalone()[parsed.utility] ?? null;
|
|
2360
2359
|
}
|
|
2361
2360
|
const resolver = PLUGIN_RESOLVERS[parsed.utility] ?? RESOLVERS[parsed.utility];
|
|
@@ -2506,16 +2505,18 @@ function findOuterColon(s) {
|
|
|
2506
2505
|
|
|
2507
2506
|
// src/core/reset.ts
|
|
2508
2507
|
var BASE_RESET = [
|
|
2509
|
-
|
|
2508
|
+
// border-style: solid means border-N utilities show a visible border without an extra border-solid class.
|
|
2509
|
+
// border-width: 0 keeps all elements borderless by default.
|
|
2510
|
+
"*, *::before, *::after { box-sizing: border-box; border-width: 0; border-style: solid; border-color: currentColor; }",
|
|
2510
2511
|
"body { margin: 0; padding: 0; }",
|
|
2511
2512
|
"h1, h2, h3, h4, h5, h6 { margin: 0; font-size: inherit; font-weight: inherit; }",
|
|
2512
2513
|
"p { margin: 0; }",
|
|
2513
2514
|
"a { color: inherit; text-decoration: none; }",
|
|
2514
2515
|
"ul, ol { margin: 0; padding: 0; list-style: none; }",
|
|
2515
2516
|
"img, video, svg { display: block; max-width: 100%; }",
|
|
2516
|
-
"input, textarea, select { appearance: none; -webkit-appearance: none; background: transparent;
|
|
2517
|
-
"button { appearance: none; -webkit-appearance: none; background: transparent;
|
|
2518
|
-
"fieldset {
|
|
2517
|
+
"input, textarea, select { appearance: none; -webkit-appearance: none; background: transparent; padding: 0; margin: 0; font: inherit; color: inherit; line-height: inherit; }",
|
|
2518
|
+
"button { appearance: none; -webkit-appearance: none; background: transparent; padding: 0; margin: 0; font: inherit; color: inherit; cursor: pointer; line-height: inherit; text-align: inherit; }",
|
|
2519
|
+
"fieldset { padding: 0; margin: 0; }",
|
|
2519
2520
|
"table { border-collapse: collapse; border-spacing: 0; }"
|
|
2520
2521
|
].join("\n");
|
|
2521
2522
|
|
|
@@ -2938,6 +2939,8 @@ function buildConfig(userConfig) {
|
|
|
2938
2939
|
};
|
|
2939
2940
|
clearPluginUtilities();
|
|
2940
2941
|
clearPluginModifiers();
|
|
2942
|
+
const _store = getConfigStore();
|
|
2943
|
+
for (const k of Object.keys(_store.customVariants)) delete _store.customVariants[k];
|
|
2941
2944
|
const pluginAPI = makePluginAPI(resolved.theme);
|
|
2942
2945
|
for (const plugin of resolved.plugins) {
|
|
2943
2946
|
plugin(pluginAPI);
|
|
@@ -3144,7 +3147,7 @@ var InteractiveWrapper = (0, import_react3.forwardRef)(
|
|
|
3144
3147
|
const handleBlur = (0, import_react3.useCallback)(chain(onBlur, () => setFocused(false)), [onBlur]);
|
|
3145
3148
|
const computedStyle = (0, import_react3.useMemo)(
|
|
3146
3149
|
() => {
|
|
3147
|
-
const s = flatten(resolvedStyle, isDark, { pressed, hover: hovered, focus: focused }, breakpoints);
|
|
3150
|
+
const s = flatten(resolvedStyle, isDark, { pressed, hover: hovered, focus: focused, disabled: !!rest.disabled, checked: !!rest.checked }, breakpoints);
|
|
3148
3151
|
delete s.__divideX;
|
|
3149
3152
|
delete s.__divideY;
|
|
3150
3153
|
delete s.__divideColor;
|
|
@@ -3178,8 +3181,8 @@ var InteractiveWrapper = (0, import_react3.forwardRef)(
|
|
|
3178
3181
|
[resolvedStyle, isDark, pressed, hovered, focused, width]
|
|
3179
3182
|
// eslint-disable-line react-hooks/exhaustive-deps
|
|
3180
3183
|
);
|
|
3181
|
-
const
|
|
3182
|
-
const finalStyle =
|
|
3184
|
+
const skipComputedInline = isWeb || !isNative && typeof Component === "string";
|
|
3185
|
+
const finalStyle = skipComputedInline ? styleProp ?? void 0 : styleProp ? Array.isArray(styleProp) ? Object.assign({}, computedStyle, ...styleProp) : { ...computedStyle, ...styleProp } : computedStyle;
|
|
3183
3186
|
const { children, ...restWithoutChildren } = rest;
|
|
3184
3187
|
const componentProps = {
|
|
3185
3188
|
ref,
|
|
@@ -3207,11 +3210,15 @@ var DarkWrapper = import_react4.default.forwardRef(
|
|
|
3207
3210
|
const needsWidth = hasResponsiveBuckets(resolvedStyle);
|
|
3208
3211
|
const width = useConditionalWidth(needsWidth);
|
|
3209
3212
|
const breakpoints = needsWidth ? getActiveBreakpoints(width) : EMPTY_BREAKPOINTS2;
|
|
3210
|
-
const
|
|
3211
|
-
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
|
|
3213
|
+
const isNonStringComponent = typeof Component !== "string";
|
|
3214
|
+
const computedStyle = (0, import_react4.useMemo)(() => {
|
|
3215
|
+
const s = flatten(resolvedStyle, isDark, {}, breakpoints);
|
|
3216
|
+
stripInternalMarkers(s);
|
|
3217
|
+
if (isNonStringComponent) stripWebOnlyProps(s);
|
|
3218
|
+
return s;
|
|
3219
|
+
}, [resolvedStyle, isDark, width, isNonStringComponent]);
|
|
3220
|
+
const skipComputedInline = isWeb || !isNative && typeof Component === "string";
|
|
3221
|
+
const finalStyle = skipComputedInline ? styleProp ?? void 0 : styleProp ? Array.isArray(styleProp) ? Object.assign({}, computedStyle, ...styleProp) : { ...computedStyle, ...styleProp } : computedStyle;
|
|
3215
3222
|
const props = { ref, ...rest, style: finalStyle };
|
|
3216
3223
|
return Array.isArray(children) ? import_react4.default.createElement(Component, props, ...children) : import_react4.default.createElement(Component, props, children);
|
|
3217
3224
|
}
|
|
@@ -3326,14 +3333,96 @@ function stripWebOnlyInlineProps(s) {
|
|
|
3326
3333
|
delete s.position;
|
|
3327
3334
|
}
|
|
3328
3335
|
}
|
|
3336
|
+
var _rnToHtml = {
|
|
3337
|
+
View: "div",
|
|
3338
|
+
SafeAreaView: "div",
|
|
3339
|
+
KeyboardAvoidingView: "div",
|
|
3340
|
+
ScrollView: "div",
|
|
3341
|
+
VirtualizedList: "div",
|
|
3342
|
+
Text: "span",
|
|
3343
|
+
Pressable: "div",
|
|
3344
|
+
TouchableOpacity: "div",
|
|
3345
|
+
TouchableHighlight: "div",
|
|
3346
|
+
TouchableWithoutFeedback: "div",
|
|
3347
|
+
TouchableNativeFeedback: "div"
|
|
3348
|
+
};
|
|
3349
|
+
var _userWebTypeMap = /* @__PURE__ */ new Map();
|
|
3350
|
+
var _webTypeCache = /* @__PURE__ */ new WeakMap();
|
|
3351
|
+
function getWebTag(type) {
|
|
3352
|
+
if (typeof type === "string") return null;
|
|
3353
|
+
if (type === null || typeof type !== "function" && typeof type !== "object") return null;
|
|
3354
|
+
const obj = type;
|
|
3355
|
+
if (_userWebTypeMap.has(obj)) return _userWebTypeMap.get(obj);
|
|
3356
|
+
if (_webTypeCache.has(obj)) return _webTypeCache.get(obj);
|
|
3357
|
+
const name = obj.displayName ?? obj.name;
|
|
3358
|
+
const tag = name ? _rnToHtml[name] ?? null : null;
|
|
3359
|
+
_webTypeCache.set(obj, tag);
|
|
3360
|
+
return tag;
|
|
3361
|
+
}
|
|
3362
|
+
var _rnOnlyProps = /* @__PURE__ */ new Set([
|
|
3363
|
+
"onLongPress",
|
|
3364
|
+
"delayLongPress",
|
|
3365
|
+
"activeOpacity",
|
|
3366
|
+
"underlayColor",
|
|
3367
|
+
"hitSlop",
|
|
3368
|
+
"pressRetentionOffset",
|
|
3369
|
+
"accessible",
|
|
3370
|
+
"accessibilityState",
|
|
3371
|
+
"accessibilityLiveRegion",
|
|
3372
|
+
"importantForAccessibility",
|
|
3373
|
+
"nativeID",
|
|
3374
|
+
"collapsable",
|
|
3375
|
+
"needsOffscreenAlphaCompositing",
|
|
3376
|
+
"renderToHardwareTextureAndroid",
|
|
3377
|
+
"shouldRasterizeIOS",
|
|
3378
|
+
"pointerEvents"
|
|
3379
|
+
// RN prop — values differ from HTML pointer-events CSS
|
|
3380
|
+
]);
|
|
3381
|
+
var _pressableDisplayNames = /* @__PURE__ */ new Set([
|
|
3382
|
+
"Pressable",
|
|
3383
|
+
"TouchableOpacity",
|
|
3384
|
+
"TouchableHighlight",
|
|
3385
|
+
"TouchableWithoutFeedback",
|
|
3386
|
+
"TouchableNativeFeedback"
|
|
3387
|
+
]);
|
|
3388
|
+
function transformToWebProps(originalName, props) {
|
|
3389
|
+
const out = {};
|
|
3390
|
+
const isPressable = _pressableDisplayNames.has(originalName);
|
|
3391
|
+
for (const [k, v] of Object.entries(props)) {
|
|
3392
|
+
if (_rnOnlyProps.has(k)) continue;
|
|
3393
|
+
if (k === "onPress") {
|
|
3394
|
+
if (!("onClick" in props)) out.onClick = v;
|
|
3395
|
+
continue;
|
|
3396
|
+
}
|
|
3397
|
+
if (k === "accessibilityLabel") {
|
|
3398
|
+
if (out["aria-label"] == null) out["aria-label"] = v;
|
|
3399
|
+
continue;
|
|
3400
|
+
}
|
|
3401
|
+
if (k === "accessibilityRole") {
|
|
3402
|
+
if (out.role == null) out.role = v;
|
|
3403
|
+
continue;
|
|
3404
|
+
}
|
|
3405
|
+
if (k === "testID") {
|
|
3406
|
+
if (out["data-testid"] == null) out["data-testid"] = v;
|
|
3407
|
+
continue;
|
|
3408
|
+
}
|
|
3409
|
+
out[k] = v;
|
|
3410
|
+
}
|
|
3411
|
+
if (isPressable && !out.role) out.role = "button";
|
|
3412
|
+
return out;
|
|
3413
|
+
}
|
|
3329
3414
|
function processElement(type, rawProps, key, isStaticChildren) {
|
|
3330
3415
|
if (typeof type === "symbol") return makeElement(isStaticChildren, type, rawProps ?? {}, key);
|
|
3331
|
-
|
|
3332
|
-
const
|
|
3416
|
+
const webTag = isWeb ? getWebTag(type) : null;
|
|
3417
|
+
const effectiveType = webTag ?? type;
|
|
3418
|
+
const originalName = webTag ? type?.displayName ?? type?.name : void 0;
|
|
3419
|
+
if (!rawProps) return (0, import_jsx_runtime.jsx)(effectiveType, null, key);
|
|
3420
|
+
const workingProps = webTag && originalName ? transformToWebProps(originalName, rawProps) : rawProps;
|
|
3421
|
+
const { className, kb: kbProp, __kbachStyles, __kbachClasses } = workingProps;
|
|
3333
3422
|
const classStr = className ?? kbProp ?? __kbachClasses;
|
|
3334
3423
|
if (!isNative && isRuntimeCSSDisabled() && classStr && !__kbachStyles) {
|
|
3335
|
-
const { style: userStyle2, ...passProps2 } = omitConsumed(
|
|
3336
|
-
return makeElement(isStaticChildren,
|
|
3424
|
+
const { style: userStyle2, ...passProps2 } = omitConsumed(workingProps);
|
|
3425
|
+
return makeElement(isStaticChildren, effectiveType, {
|
|
3337
3426
|
...passProps2,
|
|
3338
3427
|
className: normalizeClassString(classStr),
|
|
3339
3428
|
...userStyle2 !== void 0 ? { style: userStyle2 } : {}
|
|
@@ -3341,18 +3430,18 @@ function processElement(type, rawProps, key, isStaticChildren) {
|
|
|
3341
3430
|
}
|
|
3342
3431
|
if (!classStr && !__kbachStyles) {
|
|
3343
3432
|
const defaultFont = getCachedDefaultFont();
|
|
3344
|
-
if (!defaultFont) return makeElement(isStaticChildren,
|
|
3345
|
-
const { style: userStyle2, ...passProps2 } = omitConsumed(
|
|
3433
|
+
if (!defaultFont) return makeElement(isStaticChildren, effectiveType, workingProps, key);
|
|
3434
|
+
const { style: userStyle2, ...passProps2 } = omitConsumed(workingProps);
|
|
3346
3435
|
const finalStyle2 = userStyle2 ? Array.isArray(userStyle2) ? { fontFamily: defaultFont, ...Object.assign({}, ...userStyle2) } : { fontFamily: defaultFont, ...userStyle2 } : { fontFamily: defaultFont };
|
|
3347
|
-
return makeElement(isStaticChildren,
|
|
3436
|
+
return makeElement(isStaticChildren, effectiveType, { ...passProps2, style: finalStyle2 }, key);
|
|
3348
3437
|
}
|
|
3349
3438
|
const config = getConfig();
|
|
3350
3439
|
const resolved = __kbachStyles ?? (classStr ? resolve(classStr, config.theme, config.darkMode) : {});
|
|
3351
|
-
const { style: userStyle, ...passProps } = omitConsumed(
|
|
3440
|
+
const { style: userStyle, ...passProps } = omitConsumed(workingProps);
|
|
3352
3441
|
const { interactive, modeOrResponsive } = bucketMods(resolved);
|
|
3353
3442
|
if (interactive) {
|
|
3354
3443
|
return (0, import_jsx_runtime.jsx)(InteractiveWrapper, {
|
|
3355
|
-
Component:
|
|
3444
|
+
Component: effectiveType,
|
|
3356
3445
|
resolvedStyle: resolved,
|
|
3357
3446
|
...!isNative && classStr ? { className: normalizeClassString(classStr) } : {},
|
|
3358
3447
|
style: userStyle,
|
|
@@ -3361,24 +3450,24 @@ function processElement(type, rawProps, key, isStaticChildren) {
|
|
|
3361
3450
|
}
|
|
3362
3451
|
if (modeOrResponsive) {
|
|
3363
3452
|
return (0, import_jsx_runtime.jsx)(DarkWrapper, {
|
|
3364
|
-
Component:
|
|
3453
|
+
Component: effectiveType,
|
|
3365
3454
|
resolvedStyle: resolved,
|
|
3366
3455
|
...!isNative && classStr ? { className: normalizeClassString(classStr) } : {},
|
|
3367
3456
|
style: userStyle,
|
|
3368
3457
|
...passProps
|
|
3369
3458
|
}, key);
|
|
3370
3459
|
}
|
|
3371
|
-
const
|
|
3460
|
+
const skipComputedInline = isWeb || !isNative && typeof effectiveType === "string";
|
|
3372
3461
|
let finalStyle;
|
|
3373
|
-
if (!
|
|
3462
|
+
if (!skipComputedInline) {
|
|
3374
3463
|
const computedStyle = flatten(resolved, false);
|
|
3375
3464
|
stripInternalMarkers2(computedStyle);
|
|
3376
|
-
if (typeof
|
|
3465
|
+
if (typeof effectiveType !== "string") stripWebOnlyInlineProps(computedStyle);
|
|
3377
3466
|
finalStyle = mergeStyle(computedStyle, userStyle);
|
|
3378
3467
|
} else {
|
|
3379
3468
|
finalStyle = userStyle ?? void 0;
|
|
3380
3469
|
}
|
|
3381
|
-
return makeElement(isStaticChildren,
|
|
3470
|
+
return makeElement(isStaticChildren, effectiveType, {
|
|
3382
3471
|
...passProps,
|
|
3383
3472
|
style: finalStyle,
|
|
3384
3473
|
...!isNative && classStr ? { className: normalizeClassString(classStr) } : {}
|
package/dist/jsx-dev-runtime.mjs
CHANGED
|
@@ -2,9 +2,8 @@ import {
|
|
|
2
2
|
Fragment,
|
|
3
3
|
jsx,
|
|
4
4
|
jsxs
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-G76344ZQ.mjs";
|
|
5
|
+
} from "./chunk-YZNSWFJT.mjs";
|
|
6
|
+
import "./chunk-BKSXIWL7.mjs";
|
|
8
7
|
|
|
9
8
|
// src/jsx-dev-runtime.tsx
|
|
10
9
|
function jsxDEV(type, props, key, isStaticChildren, source, self) {
|