@kbach/react 0.5.48 → 0.5.51
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/chunk-6YN6SRMN.mjs +239 -0
- package/dist/{chunk-BKSXIWL7.mjs → chunk-JBV2R655.mjs} +5 -3
- package/dist/{chunk-YZNSWFJT.mjs → chunk-JVTA5SC3.mjs} +94 -305
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +98 -73
- package/dist/index.mjs +11 -5
- package/dist/jsx-dev-runtime.js +89 -82
- package/dist/jsx-dev-runtime.mjs +3 -2
- package/dist/jsx-runtime.d.mts +2 -12
- package/dist/jsx-runtime.d.ts +2 -12
- package/dist/jsx-runtime.js +94 -87
- package/dist/jsx-runtime.mjs +5 -3
- package/dist/vite-plugin.mjs +1 -1
- package/dist/web-substitute-CfpYFnE7.d.mts +22 -0
- package/dist/web-substitute-CfpYFnE7.d.ts +22 -0
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -2,7 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
import React__default, { ReactNode, ComponentType, ForwardRefExoticComponent } from 'react';
|
|
3
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
4
|
export { d as PluginAPI } from './types-D-24rbXu.mjs';
|
|
5
|
-
export { registerWebElement } from './
|
|
5
|
+
export { r as registerWebElement } from './web-substitute-CfpYFnE7.mjs';
|
|
6
6
|
|
|
7
7
|
declare const defaultColors: ThemeColors;
|
|
8
8
|
declare const defaultTheme: ThemeConfig;
|
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
import React__default, { ReactNode, ComponentType, ForwardRefExoticComponent } from 'react';
|
|
3
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
4
|
export { d as PluginAPI } from './types-D-24rbXu.js';
|
|
5
|
-
export { registerWebElement } from './
|
|
5
|
+
export { r as registerWebElement } from './web-substitute-CfpYFnE7.js';
|
|
6
6
|
|
|
7
7
|
declare const defaultColors: ThemeColors;
|
|
8
8
|
declare const defaultTheme: ThemeConfig;
|
package/dist/index.js
CHANGED
|
@@ -2933,9 +2933,11 @@ function flatten(resolved, isDark, state = {}, breakpoints = /* @__PURE__ */ new
|
|
|
2933
2933
|
Object.assign(result, styles);
|
|
2934
2934
|
}
|
|
2935
2935
|
}
|
|
2936
|
-
|
|
2937
|
-
|
|
2938
|
-
|
|
2936
|
+
if (isNative) {
|
|
2937
|
+
const defaultFont = getDefaultFontFamily();
|
|
2938
|
+
if (defaultFont && !("fontFamily" in result)) {
|
|
2939
|
+
result.fontFamily = defaultFont;
|
|
2940
|
+
}
|
|
2939
2941
|
}
|
|
2940
2942
|
if (!isNative) {
|
|
2941
2943
|
const r = result;
|
|
@@ -3536,7 +3538,91 @@ function hasInteractiveBuckets(resolved) {
|
|
|
3536
3538
|
}
|
|
3537
3539
|
return false;
|
|
3538
3540
|
}
|
|
3539
|
-
|
|
3541
|
+
|
|
3542
|
+
// src/web-substitute.ts
|
|
3543
|
+
var _rnToHtml = {
|
|
3544
|
+
View: "div",
|
|
3545
|
+
SafeAreaView: "div",
|
|
3546
|
+
KeyboardAvoidingView: "div",
|
|
3547
|
+
ScrollView: "div",
|
|
3548
|
+
VirtualizedList: "div",
|
|
3549
|
+
Text: "span",
|
|
3550
|
+
Pressable: "div",
|
|
3551
|
+
TouchableOpacity: "div",
|
|
3552
|
+
TouchableHighlight: "div",
|
|
3553
|
+
TouchableWithoutFeedback: "div",
|
|
3554
|
+
TouchableNativeFeedback: "div"
|
|
3555
|
+
};
|
|
3556
|
+
var _userMap = /* @__PURE__ */ new Map();
|
|
3557
|
+
var _cache = /* @__PURE__ */ new WeakMap();
|
|
3558
|
+
function registerWebElement(rnComponent, htmlTag) {
|
|
3559
|
+
if (typeof rnComponent !== "object" && typeof rnComponent !== "function") return;
|
|
3560
|
+
_userMap.set(rnComponent, htmlTag);
|
|
3561
|
+
_cache.delete(rnComponent);
|
|
3562
|
+
}
|
|
3563
|
+
function getWebTag(type) {
|
|
3564
|
+
if (typeof type === "string") return null;
|
|
3565
|
+
if (type === null || typeof type !== "function" && typeof type !== "object") return null;
|
|
3566
|
+
const obj = type;
|
|
3567
|
+
if (_userMap.has(obj)) return _userMap.get(obj);
|
|
3568
|
+
if (_cache.has(obj)) return _cache.get(obj);
|
|
3569
|
+
const name = obj.displayName ?? obj.name;
|
|
3570
|
+
const tag = name ? _rnToHtml[name] ?? null : null;
|
|
3571
|
+
_cache.set(obj, tag);
|
|
3572
|
+
return tag;
|
|
3573
|
+
}
|
|
3574
|
+
var _rnOnlyProps = /* @__PURE__ */ new Set([
|
|
3575
|
+
"onLongPress",
|
|
3576
|
+
"delayLongPress",
|
|
3577
|
+
"activeOpacity",
|
|
3578
|
+
"underlayColor",
|
|
3579
|
+
"hitSlop",
|
|
3580
|
+
"pressRetentionOffset",
|
|
3581
|
+
"accessible",
|
|
3582
|
+
"accessibilityState",
|
|
3583
|
+
"accessibilityLiveRegion",
|
|
3584
|
+
"importantForAccessibility",
|
|
3585
|
+
"nativeID",
|
|
3586
|
+
"collapsable",
|
|
3587
|
+
"needsOffscreenAlphaCompositing",
|
|
3588
|
+
"renderToHardwareTextureAndroid",
|
|
3589
|
+
"shouldRasterizeIOS",
|
|
3590
|
+
"pointerEvents"
|
|
3591
|
+
// RN and HTML values differ
|
|
3592
|
+
]);
|
|
3593
|
+
var _pressableNames = /* @__PURE__ */ new Set([
|
|
3594
|
+
"Pressable",
|
|
3595
|
+
"TouchableOpacity",
|
|
3596
|
+
"TouchableHighlight",
|
|
3597
|
+
"TouchableWithoutFeedback",
|
|
3598
|
+
"TouchableNativeFeedback"
|
|
3599
|
+
]);
|
|
3600
|
+
function transformToWebProps(originalName, props) {
|
|
3601
|
+
const out = {};
|
|
3602
|
+
const isPressable = _pressableNames.has(originalName);
|
|
3603
|
+
for (const [k, v] of Object.entries(props)) {
|
|
3604
|
+
if (_rnOnlyProps.has(k)) continue;
|
|
3605
|
+
if (k === "onPress") {
|
|
3606
|
+
if (!("onClick" in props)) out.onClick = v;
|
|
3607
|
+
continue;
|
|
3608
|
+
}
|
|
3609
|
+
if (k === "accessibilityLabel") {
|
|
3610
|
+
if (out["aria-label"] == null) out["aria-label"] = v;
|
|
3611
|
+
continue;
|
|
3612
|
+
}
|
|
3613
|
+
if (k === "accessibilityRole") {
|
|
3614
|
+
if (out.role == null) out.role = v;
|
|
3615
|
+
continue;
|
|
3616
|
+
}
|
|
3617
|
+
if (k === "testID") {
|
|
3618
|
+
if (out["data-testid"] == null) out["data-testid"] = v;
|
|
3619
|
+
continue;
|
|
3620
|
+
}
|
|
3621
|
+
out[k] = v;
|
|
3622
|
+
}
|
|
3623
|
+
if (isPressable && !out.role) out.role = "button";
|
|
3624
|
+
return out;
|
|
3625
|
+
}
|
|
3540
3626
|
|
|
3541
3627
|
// src/styled.tsx
|
|
3542
3628
|
function styled(Component, baseClasses = "") {
|
|
@@ -3605,15 +3691,19 @@ function styled(Component, baseClasses = "") {
|
|
|
3605
3691
|
const width = useConditionalWidth(needsWidth);
|
|
3606
3692
|
const breakpoints = needsWidth ? getActiveBreakpoints(width) : EMPTY_BREAKPOINTS;
|
|
3607
3693
|
const computedStyle = (0, import_react6.useMemo)(
|
|
3608
|
-
() => flatten(resolved, isDark, { pressed, hover: hovered, focus: focused, disabled, checked }, breakpoints),
|
|
3694
|
+
() => isWeb ? {} : flatten(resolved, isDark, { pressed, hover: hovered, focus: focused, disabled, checked }, breakpoints),
|
|
3609
3695
|
[resolved, isDark, pressed, hovered, focused, disabled, checked, width]
|
|
3610
3696
|
// eslint-disable-line react-hooks/exhaustive-deps
|
|
3611
3697
|
);
|
|
3612
3698
|
const extraStyle = Array.isArray(styleProp) ? Object.assign({}, ...styleProp) : styleProp;
|
|
3613
3699
|
const finalStyle = isWeb ? extraStyle ?? void 0 : extraStyle ? { ...computedStyle, ...extraStyle } : computedStyle;
|
|
3614
|
-
|
|
3700
|
+
const webTag = isWeb ? getWebTag(Component) : null;
|
|
3701
|
+
const effectiveComponent = webTag ?? Component;
|
|
3702
|
+
const componentName2 = Component.displayName ?? Component.name ?? "";
|
|
3703
|
+
const effectiveRest = webTag && componentName2 ? transformToWebProps(componentName2, rest) : rest;
|
|
3704
|
+
return import_react6.default.createElement(effectiveComponent, {
|
|
3615
3705
|
ref,
|
|
3616
|
-
...
|
|
3706
|
+
...effectiveRest,
|
|
3617
3707
|
style: finalStyle,
|
|
3618
3708
|
// className lets injected CSS rules (group-hover:, before:, print:, etc.) match the element.
|
|
3619
3709
|
...isWeb && combined ? { className: normalizeClassString(combined) } : {},
|
|
@@ -3740,6 +3830,7 @@ var InteractiveWrapper = (0, import_react10.forwardRef)(
|
|
|
3740
3830
|
const handleBlur = (0, import_react10.useCallback)(chain(onBlur, () => setFocused(false)), [onBlur]);
|
|
3741
3831
|
const computedStyle = (0, import_react10.useMemo)(
|
|
3742
3832
|
() => {
|
|
3833
|
+
if (isWeb) return {};
|
|
3743
3834
|
const s = flatten(resolvedStyle, isDark, { pressed, hover: hovered, focus: focused, disabled: !!rest.disabled, checked: !!rest.checked }, breakpoints);
|
|
3744
3835
|
delete s.__divideX;
|
|
3745
3836
|
delete s.__divideY;
|
|
@@ -3807,72 +3898,6 @@ function kb(classString, isDark = false) {
|
|
|
3807
3898
|
function cx(...classes) {
|
|
3808
3899
|
return classes.filter(Boolean).join(" ");
|
|
3809
3900
|
}
|
|
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
|
-
}
|
|
3876
3901
|
// Annotate the CommonJS export names for ESM import in node:
|
|
3877
3902
|
0 && (module.exports = {
|
|
3878
3903
|
InteractiveWrapper,
|
package/dist/index.mjs
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
EMPTY_BREAKPOINTS,
|
|
3
3
|
InteractiveWrapper,
|
|
4
|
+
getWebTag,
|
|
4
5
|
hasInteractiveBuckets,
|
|
5
6
|
hasResponsiveBuckets,
|
|
6
7
|
registerWebElement,
|
|
7
8
|
setGlobalDarkMode,
|
|
8
9
|
syncGlobalDarkMode,
|
|
10
|
+
transformToWebProps,
|
|
9
11
|
useConditionalWidth,
|
|
10
12
|
useGlobalDarkMode,
|
|
11
13
|
useGlobalWidth
|
|
12
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-JVTA5SC3.mjs";
|
|
13
15
|
import {
|
|
14
16
|
__require,
|
|
15
17
|
buildConfig,
|
|
@@ -31,7 +33,7 @@ import {
|
|
|
31
33
|
syncGlobalScreens,
|
|
32
34
|
syncGlobalWidth,
|
|
33
35
|
updateConfig
|
|
34
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-JBV2R655.mjs";
|
|
35
37
|
|
|
36
38
|
// src/context.tsx
|
|
37
39
|
import { createContext, useContext } from "react";
|
|
@@ -474,15 +476,19 @@ function styled(Component, baseClasses = "") {
|
|
|
474
476
|
const width = useConditionalWidth(needsWidth);
|
|
475
477
|
const breakpoints = needsWidth ? getActiveBreakpoints(width) : EMPTY_BREAKPOINTS;
|
|
476
478
|
const computedStyle = useMemo3(
|
|
477
|
-
() => flatten(resolved, isDark, { pressed, hover: hovered, focus: focused, disabled, checked }, breakpoints),
|
|
479
|
+
() => isWeb ? {} : flatten(resolved, isDark, { pressed, hover: hovered, focus: focused, disabled, checked }, breakpoints),
|
|
478
480
|
[resolved, isDark, pressed, hovered, focused, disabled, checked, width]
|
|
479
481
|
// eslint-disable-line react-hooks/exhaustive-deps
|
|
480
482
|
);
|
|
481
483
|
const extraStyle = Array.isArray(styleProp) ? Object.assign({}, ...styleProp) : styleProp;
|
|
482
484
|
const finalStyle = isWeb ? extraStyle ?? void 0 : extraStyle ? { ...computedStyle, ...extraStyle } : computedStyle;
|
|
483
|
-
|
|
485
|
+
const webTag = isWeb ? getWebTag(Component) : null;
|
|
486
|
+
const effectiveComponent = webTag ?? Component;
|
|
487
|
+
const componentName2 = Component.displayName ?? Component.name ?? "";
|
|
488
|
+
const effectiveRest = webTag && componentName2 ? transformToWebProps(componentName2, rest) : rest;
|
|
489
|
+
return React3.createElement(effectiveComponent, {
|
|
484
490
|
ref,
|
|
485
|
-
...
|
|
491
|
+
...effectiveRest,
|
|
486
492
|
style: finalStyle,
|
|
487
493
|
// className lets injected CSS rules (group-hover:, before:, print:, etc.) match the element.
|
|
488
494
|
...isWeb && combined ? { className: normalizeClassString(combined) } : {},
|
package/dist/jsx-dev-runtime.js
CHANGED
|
@@ -2811,9 +2811,11 @@ function flatten(resolved, isDark, state = {}, breakpoints = /* @__PURE__ */ new
|
|
|
2811
2811
|
Object.assign(result, styles);
|
|
2812
2812
|
}
|
|
2813
2813
|
}
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2814
|
+
if (isNative) {
|
|
2815
|
+
const defaultFont = getDefaultFontFamily();
|
|
2816
|
+
if (defaultFont && !("fontFamily" in result)) {
|
|
2817
|
+
result.fontFamily = defaultFont;
|
|
2818
|
+
}
|
|
2817
2819
|
}
|
|
2818
2820
|
if (!isNative) {
|
|
2819
2821
|
const r = result;
|
|
@@ -3147,6 +3149,7 @@ var InteractiveWrapper = (0, import_react3.forwardRef)(
|
|
|
3147
3149
|
const handleBlur = (0, import_react3.useCallback)(chain(onBlur, () => setFocused(false)), [onBlur]);
|
|
3148
3150
|
const computedStyle = (0, import_react3.useMemo)(
|
|
3149
3151
|
() => {
|
|
3152
|
+
if (isWeb) return {};
|
|
3150
3153
|
const s = flatten(resolvedStyle, isDark, { pressed, hover: hovered, focus: focused, disabled: !!rest.disabled, checked: !!rest.checked }, breakpoints);
|
|
3151
3154
|
delete s.__divideX;
|
|
3152
3155
|
delete s.__divideY;
|
|
@@ -3212,6 +3215,7 @@ var DarkWrapper = import_react4.default.forwardRef(
|
|
|
3212
3215
|
const breakpoints = needsWidth ? getActiveBreakpoints(width) : EMPTY_BREAKPOINTS2;
|
|
3213
3216
|
const isNonStringComponent = typeof Component !== "string";
|
|
3214
3217
|
const computedStyle = (0, import_react4.useMemo)(() => {
|
|
3218
|
+
if (isWeb) return {};
|
|
3215
3219
|
const s = flatten(resolvedStyle, isDark, {}, breakpoints);
|
|
3216
3220
|
stripInternalMarkers(s);
|
|
3217
3221
|
if (isNonStringComponent) stripWebOnlyProps(s);
|
|
@@ -3255,6 +3259,86 @@ function stripWebOnlyProps(s) {
|
|
|
3255
3259
|
}
|
|
3256
3260
|
}
|
|
3257
3261
|
|
|
3262
|
+
// src/web-substitute.ts
|
|
3263
|
+
var _rnToHtml = {
|
|
3264
|
+
View: "div",
|
|
3265
|
+
SafeAreaView: "div",
|
|
3266
|
+
KeyboardAvoidingView: "div",
|
|
3267
|
+
ScrollView: "div",
|
|
3268
|
+
VirtualizedList: "div",
|
|
3269
|
+
Text: "span",
|
|
3270
|
+
Pressable: "div",
|
|
3271
|
+
TouchableOpacity: "div",
|
|
3272
|
+
TouchableHighlight: "div",
|
|
3273
|
+
TouchableWithoutFeedback: "div",
|
|
3274
|
+
TouchableNativeFeedback: "div"
|
|
3275
|
+
};
|
|
3276
|
+
var _userMap = /* @__PURE__ */ new Map();
|
|
3277
|
+
var _cache = /* @__PURE__ */ new WeakMap();
|
|
3278
|
+
function getWebTag(type) {
|
|
3279
|
+
if (typeof type === "string") return null;
|
|
3280
|
+
if (type === null || typeof type !== "function" && typeof type !== "object") return null;
|
|
3281
|
+
const obj = type;
|
|
3282
|
+
if (_userMap.has(obj)) return _userMap.get(obj);
|
|
3283
|
+
if (_cache.has(obj)) return _cache.get(obj);
|
|
3284
|
+
const name = obj.displayName ?? obj.name;
|
|
3285
|
+
const tag = name ? _rnToHtml[name] ?? null : null;
|
|
3286
|
+
_cache.set(obj, tag);
|
|
3287
|
+
return tag;
|
|
3288
|
+
}
|
|
3289
|
+
var _rnOnlyProps = /* @__PURE__ */ new Set([
|
|
3290
|
+
"onLongPress",
|
|
3291
|
+
"delayLongPress",
|
|
3292
|
+
"activeOpacity",
|
|
3293
|
+
"underlayColor",
|
|
3294
|
+
"hitSlop",
|
|
3295
|
+
"pressRetentionOffset",
|
|
3296
|
+
"accessible",
|
|
3297
|
+
"accessibilityState",
|
|
3298
|
+
"accessibilityLiveRegion",
|
|
3299
|
+
"importantForAccessibility",
|
|
3300
|
+
"nativeID",
|
|
3301
|
+
"collapsable",
|
|
3302
|
+
"needsOffscreenAlphaCompositing",
|
|
3303
|
+
"renderToHardwareTextureAndroid",
|
|
3304
|
+
"shouldRasterizeIOS",
|
|
3305
|
+
"pointerEvents"
|
|
3306
|
+
// RN and HTML values differ
|
|
3307
|
+
]);
|
|
3308
|
+
var _pressableNames = /* @__PURE__ */ new Set([
|
|
3309
|
+
"Pressable",
|
|
3310
|
+
"TouchableOpacity",
|
|
3311
|
+
"TouchableHighlight",
|
|
3312
|
+
"TouchableWithoutFeedback",
|
|
3313
|
+
"TouchableNativeFeedback"
|
|
3314
|
+
]);
|
|
3315
|
+
function transformToWebProps(originalName, props) {
|
|
3316
|
+
const out = {};
|
|
3317
|
+
const isPressable = _pressableNames.has(originalName);
|
|
3318
|
+
for (const [k, v] of Object.entries(props)) {
|
|
3319
|
+
if (_rnOnlyProps.has(k)) continue;
|
|
3320
|
+
if (k === "onPress") {
|
|
3321
|
+
if (!("onClick" in props)) out.onClick = v;
|
|
3322
|
+
continue;
|
|
3323
|
+
}
|
|
3324
|
+
if (k === "accessibilityLabel") {
|
|
3325
|
+
if (out["aria-label"] == null) out["aria-label"] = v;
|
|
3326
|
+
continue;
|
|
3327
|
+
}
|
|
3328
|
+
if (k === "accessibilityRole") {
|
|
3329
|
+
if (out.role == null) out.role = v;
|
|
3330
|
+
continue;
|
|
3331
|
+
}
|
|
3332
|
+
if (k === "testID") {
|
|
3333
|
+
if (out["data-testid"] == null) out["data-testid"] = v;
|
|
3334
|
+
continue;
|
|
3335
|
+
}
|
|
3336
|
+
out[k] = v;
|
|
3337
|
+
}
|
|
3338
|
+
if (isPressable && !out.role) out.role = "button";
|
|
3339
|
+
return out;
|
|
3340
|
+
}
|
|
3341
|
+
|
|
3258
3342
|
// src/jsx-runtime.tsx
|
|
3259
3343
|
var _cachedDefaultFont = void 0;
|
|
3260
3344
|
var _defaultFontVersion = 0;
|
|
@@ -3333,84 +3417,6 @@ function stripWebOnlyInlineProps(s) {
|
|
|
3333
3417
|
delete s.position;
|
|
3334
3418
|
}
|
|
3335
3419
|
}
|
|
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
|
-
}
|
|
3414
3420
|
function processElement(type, rawProps, key, isStaticChildren) {
|
|
3415
3421
|
if (typeof type === "symbol") return makeElement(isStaticChildren, type, rawProps ?? {}, key);
|
|
3416
3422
|
const webTag = isWeb ? getWebTag(type) : null;
|
|
@@ -3429,6 +3435,7 @@ function processElement(type, rawProps, key, isStaticChildren) {
|
|
|
3429
3435
|
}, key);
|
|
3430
3436
|
}
|
|
3431
3437
|
if (!classStr && !__kbachStyles) {
|
|
3438
|
+
if (isWeb) return makeElement(isStaticChildren, effectiveType, omitConsumed(workingProps), key);
|
|
3432
3439
|
const defaultFont = getCachedDefaultFont();
|
|
3433
3440
|
if (!defaultFont) return makeElement(isStaticChildren, effectiveType, workingProps, key);
|
|
3434
3441
|
const { style: userStyle2, ...passProps2 } = omitConsumed(workingProps);
|
|
@@ -3436,7 +3443,7 @@ function processElement(type, rawProps, key, isStaticChildren) {
|
|
|
3436
3443
|
return makeElement(isStaticChildren, effectiveType, { ...passProps2, style: finalStyle2 }, key);
|
|
3437
3444
|
}
|
|
3438
3445
|
const config = getConfig();
|
|
3439
|
-
const resolved = __kbachStyles
|
|
3446
|
+
const resolved = !isWeb && __kbachStyles != null ? __kbachStyles : classStr ? resolve(classStr, config.theme, config.darkMode) : {};
|
|
3440
3447
|
const { style: userStyle, ...passProps } = omitConsumed(workingProps);
|
|
3441
3448
|
const { interactive, modeOrResponsive } = bucketMods(resolved);
|
|
3442
3449
|
if (interactive) {
|
package/dist/jsx-dev-runtime.mjs
CHANGED
|
@@ -2,8 +2,9 @@ import {
|
|
|
2
2
|
Fragment,
|
|
3
3
|
jsx,
|
|
4
4
|
jsxs
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-6YN6SRMN.mjs";
|
|
6
|
+
import "./chunk-JVTA5SC3.mjs";
|
|
7
|
+
import "./chunk-JBV2R655.mjs";
|
|
7
8
|
|
|
8
9
|
// src/jsx-dev-runtime.tsx
|
|
9
10
|
function jsxDEV(type, props, key, isStaticChildren, source, self) {
|
package/dist/jsx-runtime.d.mts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ReactElement } from 'react';
|
|
2
2
|
export { Fragment, JSX } from 'react';
|
|
3
|
+
export { r as registerWebElement } from './web-substitute-CfpYFnE7.mjs';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* @kbach/react/jsx-runtime
|
|
@@ -10,18 +11,7 @@ export { Fragment, JSX } from 'react';
|
|
|
10
11
|
*/
|
|
11
12
|
|
|
12
13
|
declare function _invalidateDefaultFontCache(): void;
|
|
13
|
-
/**
|
|
14
|
-
* Register a custom React Native component → HTML tag substitution.
|
|
15
|
-
* Call this once at app startup (before first render).
|
|
16
|
-
*
|
|
17
|
-
* ```ts
|
|
18
|
-
* import { Animated } from 'react-native';
|
|
19
|
-
* import { registerWebElement } from '@kbach/react/jsx-runtime';
|
|
20
|
-
* registerWebElement(Animated.View, 'div');
|
|
21
|
-
* ```
|
|
22
|
-
*/
|
|
23
|
-
declare function registerWebElement(rnComponent: unknown, htmlTag: string): void;
|
|
24
14
|
declare function jsx(type: unknown, props: Record<string, unknown> | null, key?: string): ReactElement;
|
|
25
15
|
declare function jsxs(type: unknown, props: Record<string, unknown> | null, key?: string): ReactElement;
|
|
26
16
|
|
|
27
|
-
export { _invalidateDefaultFontCache, jsx, jsxs
|
|
17
|
+
export { _invalidateDefaultFontCache, jsx, jsxs };
|
package/dist/jsx-runtime.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ReactElement } from 'react';
|
|
2
2
|
export { Fragment, JSX } from 'react';
|
|
3
|
+
export { r as registerWebElement } from './web-substitute-CfpYFnE7.js';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* @kbach/react/jsx-runtime
|
|
@@ -10,18 +11,7 @@ export { Fragment, JSX } from 'react';
|
|
|
10
11
|
*/
|
|
11
12
|
|
|
12
13
|
declare function _invalidateDefaultFontCache(): void;
|
|
13
|
-
/**
|
|
14
|
-
* Register a custom React Native component → HTML tag substitution.
|
|
15
|
-
* Call this once at app startup (before first render).
|
|
16
|
-
*
|
|
17
|
-
* ```ts
|
|
18
|
-
* import { Animated } from 'react-native';
|
|
19
|
-
* import { registerWebElement } from '@kbach/react/jsx-runtime';
|
|
20
|
-
* registerWebElement(Animated.View, 'div');
|
|
21
|
-
* ```
|
|
22
|
-
*/
|
|
23
|
-
declare function registerWebElement(rnComponent: unknown, htmlTag: string): void;
|
|
24
14
|
declare function jsx(type: unknown, props: Record<string, unknown> | null, key?: string): ReactElement;
|
|
25
15
|
declare function jsxs(type: unknown, props: Record<string, unknown> | null, key?: string): ReactElement;
|
|
26
16
|
|
|
27
|
-
export { _invalidateDefaultFontCache, jsx, jsxs
|
|
17
|
+
export { _invalidateDefaultFontCache, jsx, jsxs };
|