@kbach/ui 0.1.0-beta.0

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.
@@ -0,0 +1,780 @@
1
+ 'use client';
2
+ "use strict";
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __export = (target, all) => {
10
+ for (var name in all)
11
+ __defProp(target, name, { get: all[name], enumerable: true });
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from))
16
+ if (!__hasOwnProp.call(to, key) && key !== except)
17
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
+ }
19
+ return to;
20
+ };
21
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
+ // If the importer is in node compatibility mode or this is not an ESM
23
+ // file that has been converted to a CommonJS file using a Babel-
24
+ // compatible transform (i.e. "__esModule" has not been set), then set
25
+ // "default" to the CommonJS "module.exports" for node compatibility.
26
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
+ mod
28
+ ));
29
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
+
31
+ // src/jsx-dev-runtime.tsx
32
+ var jsx_dev_runtime_exports = {};
33
+ __export(jsx_dev_runtime_exports, {
34
+ Fragment: () => import_react4.Fragment,
35
+ jsxDEV: () => jsxDEV
36
+ });
37
+ module.exports = __toCommonJS(jsx_dev_runtime_exports);
38
+
39
+ // src/jsx-runtime.tsx
40
+ var import_jsx_runtime = require("react/jsx-runtime");
41
+ var import_react4 = require("react");
42
+ var import_core6 = require("./core");
43
+
44
+ // src/InteractiveWrapper.tsx
45
+ var import_react2 = __toESM(require("react"));
46
+ var import_core4 = require("./core");
47
+
48
+ // src/useGlobalDarkMode.ts
49
+ var import_core = require("./core");
50
+
51
+ // src/useSyncExternalStoreShim.ts
52
+ var import_react = __toESM(require("react"));
53
+ var useSyncExternalStore = import_react.default.useSyncExternalStore ?? function useSyncExternalStoreFallback(subscribe, getSnapshot, getServerSnapshot) {
54
+ const isServer = typeof window === "undefined";
55
+ const [, forceUpdate] = import_react.default.useReducer((n) => n + 1, 0);
56
+ const value = isServer && getServerSnapshot ? getServerSnapshot() : getSnapshot();
57
+ import_react.default.useEffect(() => {
58
+ if (getSnapshot() !== value) forceUpdate();
59
+ return subscribe(forceUpdate);
60
+ }, [subscribe]);
61
+ return value;
62
+ };
63
+
64
+ // src/useGlobalDarkMode.ts
65
+ var NOOP_SUB = (_) => () => {
66
+ };
67
+ var FALSE_SNAP = () => false;
68
+ function useConditionalGlobalDarkMode(active) {
69
+ return useSyncExternalStore(
70
+ active ? import_core.subscribeGlobalDarkMode : NOOP_SUB,
71
+ active ? import_core.getGlobalDarkMode : FALSE_SNAP,
72
+ FALSE_SNAP
73
+ );
74
+ }
75
+
76
+ // src/useGlobalWidth.ts
77
+ var import_core2 = require("./core");
78
+ var NOOP_SUB2 = (_) => () => {
79
+ };
80
+ var ZERO_SNAP = () => 0;
81
+ var EMPTY_BREAKPOINTS = /* @__PURE__ */ new Set();
82
+ var _webListeners = null;
83
+ var _webRaf = 0;
84
+ function _webResizeHandler() {
85
+ cancelAnimationFrame(_webRaf);
86
+ _webRaf = requestAnimationFrame(() => {
87
+ if (_webListeners) for (const cb of _webListeners) cb();
88
+ });
89
+ }
90
+ function subscribeWebWidth(cb) {
91
+ if (typeof window === "undefined") return () => {
92
+ };
93
+ if (!_webListeners) {
94
+ _webListeners = /* @__PURE__ */ new Set();
95
+ window.addEventListener("resize", _webResizeHandler);
96
+ }
97
+ _webListeners.add(cb);
98
+ return () => {
99
+ _webListeners.delete(cb);
100
+ if (_webListeners.size === 0) {
101
+ window.removeEventListener("resize", _webResizeHandler);
102
+ cancelAnimationFrame(_webRaf);
103
+ _webListeners = null;
104
+ }
105
+ };
106
+ }
107
+ function getWebWidth() {
108
+ return typeof window !== "undefined" ? window.innerWidth : 0;
109
+ }
110
+ function useConditionalWidth(active) {
111
+ return useSyncExternalStore(
112
+ active ? import_core2.isWeb ? subscribeWebWidth : import_core2.subscribeGlobalWidth : NOOP_SUB2,
113
+ active ? import_core2.isWeb ? getWebWidth : import_core2.getGlobalWidth : ZERO_SNAP,
114
+ ZERO_SNAP
115
+ );
116
+ }
117
+
118
+ // src/shared-utils.ts
119
+ var import_core3 = require("./core");
120
+ function hasResponsiveBuckets(resolved) {
121
+ const responsiveMods = (0, import_core3.getResponsiveModifiers)();
122
+ for (const key of Object.keys(resolved)) {
123
+ if (key === "base") continue;
124
+ for (const mod of key.split(":")) {
125
+ if (responsiveMods.has(mod)) return true;
126
+ }
127
+ }
128
+ return false;
129
+ }
130
+ function chain(original, extra) {
131
+ return (...args) => {
132
+ original?.(...args);
133
+ extra();
134
+ };
135
+ }
136
+ function stripInternalMarkers(s) {
137
+ delete s.__divideX;
138
+ delete s.__divideY;
139
+ delete s.__divideColor;
140
+ delete s.__divideStyle;
141
+ delete s.__keyframe;
142
+ }
143
+ function stripWebOnlyProps(s) {
144
+ if (s.display === "grid" || s.display === "inline-grid") delete s.display;
145
+ delete s.gridTemplateColumns;
146
+ delete s.gridTemplateRows;
147
+ delete s.gridColumn;
148
+ delete s.gridRow;
149
+ delete s.gridArea;
150
+ delete s.gridColumnStart;
151
+ delete s.gridColumnEnd;
152
+ delete s.gridRowStart;
153
+ delete s.gridRowEnd;
154
+ delete s.gridAutoFlow;
155
+ delete s.gridAutoColumns;
156
+ delete s.gridAutoRows;
157
+ delete s.placeItems;
158
+ delete s.placeContent;
159
+ delete s.justifyItems;
160
+ delete s.placeSelf;
161
+ delete s.justifySelf;
162
+ if (s.position === "sticky" || s.position === "fixed" || s.position === "static") {
163
+ delete s.position;
164
+ }
165
+ }
166
+ function composeNativeStyle(computed, userStyle) {
167
+ if (!userStyle) return computed;
168
+ return Array.isArray(userStyle) ? [computed, ...userStyle] : [computed, userStyle];
169
+ }
170
+
171
+ // src/InteractiveWrapper.tsx
172
+ var InteractiveWrapper = (0, import_react2.forwardRef)(
173
+ function InteractiveWrapper2({
174
+ Component,
175
+ resolvedStyle,
176
+ className,
177
+ style: styleProp,
178
+ onPressIn,
179
+ onPressOut,
180
+ onPointerDown,
181
+ onPointerUp,
182
+ onPointerLeave,
183
+ onPointerCancel,
184
+ onMouseEnter,
185
+ onMouseLeave,
186
+ onFocus,
187
+ onBlur,
188
+ ...rest
189
+ }, ref) {
190
+ const isWebPlatform = (0, import_core4.getEffectiveIsWeb)();
191
+ const isDark = useConditionalGlobalDarkMode(!isWebPlatform);
192
+ const needsWidth = hasResponsiveBuckets(resolvedStyle);
193
+ const width = useConditionalWidth(needsWidth && !isWebPlatform);
194
+ const breakpoints = needsWidth ? (0, import_core4.getActiveBreakpoints)(width) : EMPTY_BREAKPOINTS;
195
+ const screens = (0, import_core4.getGlobalScreens)();
196
+ const [pressed, setPressed] = (0, import_react2.useState)(false);
197
+ const [hovered, setHovered] = (0, import_react2.useState)(false);
198
+ const [focused, setFocused] = (0, import_react2.useState)(false);
199
+ const handlePressIn = (0, import_react2.useCallback)(chain(onPressIn, () => {
200
+ if (!isWebPlatform) setPressed(true);
201
+ }), [onPressIn, isWebPlatform]);
202
+ const handlePressOut = (0, import_react2.useCallback)(chain(onPressOut, () => {
203
+ if (!isWebPlatform) setPressed(false);
204
+ }), [onPressOut, isWebPlatform]);
205
+ const handlePointerDown = (0, import_react2.useCallback)(chain(onPointerDown, () => {
206
+ if (!isWebPlatform) setPressed(true);
207
+ }), [onPointerDown, isWebPlatform]);
208
+ const handlePointerUp = (0, import_react2.useCallback)(chain(onPointerUp, () => {
209
+ if (!isWebPlatform) setPressed(false);
210
+ }), [onPointerUp, isWebPlatform]);
211
+ const handlePointerLeave = (0, import_react2.useCallback)(chain(onPointerLeave, () => {
212
+ if (!isWebPlatform) setPressed(false);
213
+ }), [onPointerLeave, isWebPlatform]);
214
+ const handlePointerCancel = (0, import_react2.useCallback)(chain(onPointerCancel, () => {
215
+ if (!isWebPlatform) setPressed(false);
216
+ }), [onPointerCancel, isWebPlatform]);
217
+ const handleMouseEnter = (0, import_react2.useCallback)(chain(onMouseEnter, () => {
218
+ if (!isWebPlatform) setHovered(true);
219
+ }), [onMouseEnter, isWebPlatform]);
220
+ const handleMouseLeave = (0, import_react2.useCallback)(chain(onMouseLeave, () => {
221
+ if (!isWebPlatform) setHovered(false);
222
+ }), [onMouseLeave, isWebPlatform]);
223
+ const handleFocus = (0, import_react2.useCallback)(chain(onFocus, () => {
224
+ if (!isWebPlatform) setFocused(true);
225
+ }), [onFocus, isWebPlatform]);
226
+ const handleBlur = (0, import_react2.useCallback)(chain(onBlur, () => {
227
+ if (!isWebPlatform) setFocused(false);
228
+ }), [onBlur, isWebPlatform]);
229
+ const { children, disabled, checked, ...restForComponent } = rest;
230
+ const isNonStringComponent = typeof Component !== "string";
231
+ const computedStyle = (0, import_react2.useMemo)(
232
+ () => {
233
+ if (isWebPlatform) return {};
234
+ const s = (0, import_core4.flatten)(resolvedStyle, isDark, { pressed, hover: hovered, focus: focused, disabled: !!disabled, checked: !!checked }, breakpoints);
235
+ stripInternalMarkers(s);
236
+ if (isNonStringComponent) stripWebOnlyProps(s);
237
+ return s;
238
+ },
239
+ [resolvedStyle, isDark, pressed, hovered, focused, width, screens, disabled, checked, isNonStringComponent]
240
+ );
241
+ const skipComputedInline = isWebPlatform;
242
+ const finalStyle = skipComputedInline ? styleProp ?? void 0 : composeNativeStyle(computedStyle, styleProp);
243
+ const componentProps = {
244
+ ref,
245
+ ...restForComponent,
246
+ ...disabled !== void 0 ? { disabled } : {},
247
+ ...checked !== void 0 ? { checked } : {},
248
+ style: finalStyle,
249
+ ...!import_core4.isNative && className ? { className } : {},
250
+ // On web, onPointerDown/Up drive the wrapper's own pressed state (covers mouse + touch) —
251
+ // onPressIn/onPressOut are RN-only prop names and are never forwarded here, even when
252
+ // Component isn't a literal HTML tag string. A non-string Component on web is just as
253
+ // likely to be an ordinary web component (React Router's <Link>, Next.js's <Link>, any
254
+ // custom wrapper) as an actual react-native-web primitive — "not a string" alone was never
255
+ // a reliable signal that onPressIn/onPressOut are wanted, and forwarding them
256
+ // unconditionally made React DOM warn "Unknown event handler property" the moment any web
257
+ // component got an interactive modifier (hover:, active:, …), which is the common case,
258
+ // not the exception. (A real react-native-web primitive would additionally have this pair
259
+ // of props silently vanish after hydration anyway, once the browser-only web-substitution
260
+ // in jsx-runtime.tsx swaps it for a plain host tag — so keeping them pre-hydration would
261
+ // only have traded one prop-mismatch warning for another.) Genuinely native code paths
262
+ // still get them via the isNative branch below.
263
+ ...!import_core4.isNative ? {
264
+ onPointerDown: handlePointerDown,
265
+ onPointerUp: handlePointerUp,
266
+ onPointerLeave: handlePointerLeave,
267
+ onPointerCancel: handlePointerCancel
268
+ } : { onPressIn: handlePressIn, onPressOut: handlePressOut },
269
+ onMouseEnter: handleMouseEnter,
270
+ onMouseLeave: handleMouseLeave,
271
+ onFocus: handleFocus,
272
+ onBlur: handleBlur
273
+ };
274
+ return Array.isArray(children) ? import_react2.default.createElement(Component, componentProps, ...children) : import_react2.default.createElement(Component, componentProps, children);
275
+ }
276
+ );
277
+ InteractiveWrapper.displayName = "Kbach.InteractiveWrapper";
278
+
279
+ // src/DarkWrapper.tsx
280
+ var import_react3 = __toESM(require("react"));
281
+ var import_core5 = require("./core");
282
+ var DarkWrapper = import_react3.default.forwardRef(
283
+ function DarkWrapper2({ Component, resolvedStyle, style: styleProp, children, ...rest }, ref) {
284
+ const isWebPlatform = (0, import_core5.getEffectiveIsWeb)();
285
+ const isDark = useConditionalGlobalDarkMode(!isWebPlatform);
286
+ const needsWidth = hasResponsiveBuckets(resolvedStyle);
287
+ const width = useConditionalWidth(needsWidth && !isWebPlatform);
288
+ const breakpoints = needsWidth ? (0, import_core5.getActiveBreakpoints)(width) : EMPTY_BREAKPOINTS;
289
+ const screens = (0, import_core5.getGlobalScreens)();
290
+ const isNonStringComponent = typeof Component !== "string";
291
+ const computedStyle = (0, import_react3.useMemo)(() => {
292
+ if (isWebPlatform) return {};
293
+ const s = (0, import_core5.flatten)(resolvedStyle, isDark, {}, breakpoints);
294
+ stripInternalMarkers(s);
295
+ if (isNonStringComponent) stripWebOnlyProps(s);
296
+ return s;
297
+ }, [resolvedStyle, isDark, width, screens, isNonStringComponent]);
298
+ const skipComputedInline = isWebPlatform;
299
+ const finalStyle = skipComputedInline ? styleProp ?? void 0 : composeNativeStyle(computedStyle, styleProp);
300
+ const props = { ref, ...rest, style: finalStyle };
301
+ return Array.isArray(children) ? import_react3.default.createElement(Component, props, ...children) : import_react3.default.createElement(Component, props, children);
302
+ }
303
+ );
304
+ DarkWrapper.displayName = "Kbach.DarkWrapper";
305
+
306
+ // src/web-substitute.ts
307
+ var _rnToHtml = {
308
+ View: "div",
309
+ SafeAreaView: "div",
310
+ KeyboardAvoidingView: "div",
311
+ ScrollView: "div",
312
+ VirtualizedList: "div",
313
+ FlatList: "div",
314
+ SectionList: "div",
315
+ Text: "span",
316
+ TextInput: "input",
317
+ Image: "img",
318
+ ImageBackground: "div",
319
+ Pressable: "div",
320
+ TouchableOpacity: "div",
321
+ TouchableHighlight: "div",
322
+ TouchableWithoutFeedback: "div",
323
+ TouchableNativeFeedback: "div"
324
+ };
325
+ var _userMap = /* @__PURE__ */ new Map();
326
+ var _cache = /* @__PURE__ */ new WeakMap();
327
+ var _forwardRefOrMemoType = /* @__PURE__ */ new Set([
328
+ /* @__PURE__ */ Symbol.for("react.forward_ref"),
329
+ /* @__PURE__ */ Symbol.for("react.memo")
330
+ ]);
331
+ function looksLikeRealRNPrimitive(type) {
332
+ const t = type.$$typeof;
333
+ if (t !== void 0) return _forwardRefOrMemoType.has(t);
334
+ return !!type.prototype?.isReactComponent;
335
+ }
336
+ function getWebTag(type, props) {
337
+ if (typeof type === "string") return null;
338
+ if (type === null || typeof type !== "function" && typeof type !== "object") return null;
339
+ const obj = type;
340
+ if (_userMap.has(obj)) return _userMap.get(obj);
341
+ if (!looksLikeRealRNPrimitive(obj)) return null;
342
+ const name = obj.displayName ?? obj.name;
343
+ if (!name) {
344
+ _cache.set(obj, null);
345
+ return null;
346
+ }
347
+ if (name === "TextInput") {
348
+ const multiline = !!props && (props.multiline === true || Number(props.numberOfLines) > 1);
349
+ return multiline ? "textarea" : "input";
350
+ }
351
+ if (_cache.has(obj)) return _cache.get(obj);
352
+ const tag = _rnToHtml[name] ?? null;
353
+ _cache.set(obj, tag);
354
+ return tag;
355
+ }
356
+ function getImpliedRNClasses(webTag, resolvedBase) {
357
+ if (!webTag || !resolvedBase) return void 0;
358
+ const classes = [];
359
+ if (resolvedBase.position === void 0) classes.push("relative");
360
+ const explicitDisplay = resolvedBase.display;
361
+ const hasFlexItemProps = "flexGrow" in resolvedBase || "flexShrink" in resolvedBase || "flex" in resolvedBase || "gap" in resolvedBase || "columnGap" in resolvedBase || "rowGap" in resolvedBase;
362
+ const willBeFlex = explicitDisplay === "flex" || explicitDisplay === void 0 && hasFlexItemProps;
363
+ if (willBeFlex && (explicitDisplay === void 0 || resolvedBase.flexDirection === void 0)) {
364
+ classes.push("flex-col");
365
+ }
366
+ return classes.length > 0 ? classes.join(" ") : void 0;
367
+ }
368
+ var _rnOnlyProps = /* @__PURE__ */ new Set([
369
+ // Interaction
370
+ "onLongPress",
371
+ "delayLongPress",
372
+ "activeOpacity",
373
+ "underlayColor",
374
+ "hitSlop",
375
+ "pressRetentionOffset",
376
+ "android_ripple",
377
+ "android_disableSound",
378
+ "onHoverIn",
379
+ "onHoverOut",
380
+ "onHoverStart",
381
+ "onHoverEnd",
382
+ // Layout event
383
+ "onLayout",
384
+ // Accessibility
385
+ "accessible",
386
+ "accessibilityState",
387
+ "accessibilityLiveRegion",
388
+ "importantForAccessibility",
389
+ // Platform
390
+ "nativeID",
391
+ "collapsable",
392
+ "needsOffscreenAlphaCompositing",
393
+ "renderToHardwareTextureAndroid",
394
+ "shouldRasterizeIOS",
395
+ "focusable",
396
+ "hasTVPreferredFocus",
397
+ // 'pointerEvents' is handled in transformToWebProps (mapped to CSS style)
398
+ // Text
399
+ "selectable",
400
+ "allowFontScaling",
401
+ "adjustsFontSizeToFit",
402
+ "minimumFontScale",
403
+ "ellipsizeMode",
404
+ "numberOfLines",
405
+ "onTextLayout",
406
+ "textBreakStrategy",
407
+ "lineBreakStrategyIOS",
408
+ // TextInput
409
+ "multiline",
410
+ // NOTE: 'resizeMode' (Image's prop, not TextInput's) deliberately does NOT
411
+ // go here — it's handled below in the isImage branch (mapped to CSS
412
+ // object-fit). Blacklisting it here would make that branch unreachable.
413
+ "blurOnSubmit",
414
+ "clearButtonMode",
415
+ "clearTextOnFocus",
416
+ "enablesReturnKeyAutomatically",
417
+ "returnKeyType",
418
+ "spellCheck",
419
+ // ScrollView
420
+ "scrollEnabled",
421
+ "showsVerticalScrollIndicator",
422
+ "showsHorizontalScrollIndicator",
423
+ "contentContainerStyle",
424
+ // 'horizontal' is handled in transformToWebProps (converted to CSS overflow-x).
425
+ "keyboardShouldPersistTaps",
426
+ "keyboardDismissMode",
427
+ "pagingEnabled",
428
+ "scrollEventThrottle",
429
+ "decelerationRate",
430
+ "bounces",
431
+ "alwaysBounceHorizontal",
432
+ "alwaysBounceVertical",
433
+ "snapToAlignment",
434
+ "snapToInterval",
435
+ "snapToOffsets",
436
+ "removeClippedSubviews",
437
+ "overScrollMode",
438
+ "stickyHeaderIndices",
439
+ "invertStickyHeaders",
440
+ "onScrollBeginDrag",
441
+ "onScrollEndDrag",
442
+ "onMomentumScrollBegin",
443
+ "onMomentumScrollEnd",
444
+ "contentInset",
445
+ "contentInsetAdjustmentBehavior",
446
+ "automaticallyAdjustContentInsets",
447
+ "automaticallyAdjustsScrollIndicatorInsets",
448
+ // expo-image
449
+ "contentPosition",
450
+ "cachePolicy",
451
+ "recyclingKey",
452
+ "blurRadius",
453
+ "fadeDuration",
454
+ "responsivePolicy",
455
+ "tintColor",
456
+ "allowDownscaling",
457
+ "placeholderContentFit",
458
+ // FlatList / SectionList
459
+ "data",
460
+ "renderItem",
461
+ "keyExtractor",
462
+ "getItemLayout",
463
+ "initialScrollIndex",
464
+ "initialNumToRender",
465
+ "maxToRenderPerBatch",
466
+ "windowSize",
467
+ "updateCellsBatchingPeriod",
468
+ "onEndReached",
469
+ "onEndReachedThreshold",
470
+ "ListHeaderComponent",
471
+ "ListFooterComponent",
472
+ "ListEmptyComponent",
473
+ "ListHeaderComponentStyle",
474
+ "ListFooterComponentStyle",
475
+ "ItemSeparatorComponent",
476
+ "SectionSeparatorComponent",
477
+ "inverted",
478
+ "getItem",
479
+ "getItemCount"
480
+ ]);
481
+ var _pressableNames = /* @__PURE__ */ new Set([
482
+ "Pressable",
483
+ "TouchableOpacity",
484
+ "TouchableHighlight",
485
+ "TouchableWithoutFeedback",
486
+ "TouchableNativeFeedback"
487
+ ]);
488
+ var _keyboardTypeMap = {
489
+ "numeric": "number",
490
+ "number-pad": "number",
491
+ "decimal-pad": "decimal",
492
+ "email-address": "email",
493
+ "phone-pad": "tel",
494
+ "url": "url"
495
+ };
496
+ var _resizeModeMap = {
497
+ "contain": "contain",
498
+ "cover": "cover",
499
+ "stretch": "fill",
500
+ "center": "none",
501
+ "repeat": "none"
502
+ };
503
+ var PLACEHOLDER_RULE_ATTR = "data-kbach-ph";
504
+ var _placeholderRuleInjected = false;
505
+ function ensurePlaceholderColorRuleInjected() {
506
+ if (_placeholderRuleInjected || typeof document === "undefined") return;
507
+ _placeholderRuleInjected = true;
508
+ const style = document.createElement("style");
509
+ style.setAttribute("data-kbach-placeholder", "");
510
+ style.textContent = `[${PLACEHOLDER_RULE_ATTR}]::placeholder{color:var(--kbach-ph-color)}`;
511
+ document.head.appendChild(style);
512
+ }
513
+ function transformToWebProps(originalName, tag, props) {
514
+ const out = {};
515
+ const isPressable = _pressableNames.has(originalName);
516
+ const isTextInput = originalName === "TextInput";
517
+ const isImage = originalName === "Image" || originalName === "ImageBackground";
518
+ const isScrollable = originalName === "ScrollView" || originalName === "FlatList" || originalName === "SectionList";
519
+ let pendingStyle = null;
520
+ for (const [k, v] of Object.entries(props)) {
521
+ if (_rnOnlyProps.has(k)) continue;
522
+ if (k === "onPress") {
523
+ if (!("onClick" in props)) out.onClick = v;
524
+ continue;
525
+ }
526
+ if (k === "accessibilityLabel") {
527
+ if (out["aria-label"] == null) out["aria-label"] = v;
528
+ continue;
529
+ }
530
+ if (k === "accessibilityRole") {
531
+ if (out.role == null) out.role = v;
532
+ continue;
533
+ }
534
+ if (k === "testID") {
535
+ if (out["data-testid"] == null) out["data-testid"] = v;
536
+ continue;
537
+ }
538
+ if (isTextInput) {
539
+ if (k === "onChangeText") {
540
+ if (!("onChange" in props)) out.onChange = (e) => v(e.target.value);
541
+ continue;
542
+ }
543
+ if (k === "onSubmitEditing") {
544
+ if (!("onKeyDown" in props)) {
545
+ out.onKeyDown = (e) => {
546
+ if (e.key === "Enter") v();
547
+ };
548
+ }
549
+ continue;
550
+ }
551
+ if (k === "placeholderTextColor") {
552
+ if (v) {
553
+ ensurePlaceholderColorRuleInjected();
554
+ out[PLACEHOLDER_RULE_ATTR] = "";
555
+ pendingStyle = { ...pendingStyle ?? {}, "--kbach-ph-color": v };
556
+ }
557
+ continue;
558
+ }
559
+ if (k === "secureTextEntry") {
560
+ if (v && !("type" in props)) out.type = "password";
561
+ continue;
562
+ }
563
+ if (k === "keyboardType") {
564
+ if (!("type" in props) && !props.secureTextEntry) {
565
+ const mapped = _keyboardTypeMap[v];
566
+ if (mapped) out.type = mapped;
567
+ }
568
+ continue;
569
+ }
570
+ if (k === "editable") {
571
+ if (v === false) out.readOnly = true;
572
+ continue;
573
+ }
574
+ if (k === "maxLength") {
575
+ out.maxLength = v;
576
+ continue;
577
+ }
578
+ }
579
+ if (isScrollable && k === "horizontal") {
580
+ if (v) pendingStyle = { ...pendingStyle ?? {}, display: "flex", flexDirection: "row", overflowX: "auto" };
581
+ continue;
582
+ }
583
+ if (k === "pointerEvents") {
584
+ if (v === "none" || v === "auto") pendingStyle = { ...pendingStyle ?? {}, pointerEvents: v };
585
+ continue;
586
+ }
587
+ if (isImage) {
588
+ if (k === "source") {
589
+ if (typeof v === "string") {
590
+ out.src = v;
591
+ } else if (v && typeof v === "object" && "uri" in v) {
592
+ out.src = v.uri;
593
+ if (v.headers) out["crossOrigin"] = "anonymous";
594
+ }
595
+ continue;
596
+ }
597
+ if (k === "resizeMode") {
598
+ pendingStyle = { ...pendingStyle ?? {}, objectFit: _resizeModeMap[v] ?? "cover" };
599
+ continue;
600
+ }
601
+ if (k === "contentFit") {
602
+ pendingStyle = { ...pendingStyle ?? {}, objectFit: v };
603
+ continue;
604
+ }
605
+ if (k === "defaultSource") continue;
606
+ }
607
+ if (k === "style") {
608
+ if (Array.isArray(v)) {
609
+ out.style = Object.assign({}, ...v.filter(Boolean));
610
+ } else if (v != null) {
611
+ out.style = v;
612
+ }
613
+ continue;
614
+ }
615
+ out[k] = v;
616
+ }
617
+ if (pendingStyle) {
618
+ out.style = out.style ? { ...pendingStyle, ...out.style } : pendingStyle;
619
+ }
620
+ if (isPressable && !out.role) out.role = "button";
621
+ if (isImage && tag === "img" && out.alt == null) out.alt = "";
622
+ return out;
623
+ }
624
+
625
+ // src/jsx-runtime.tsx
626
+ var _cachedDefaultFont = void 0;
627
+ var _defaultFontVersion = 0;
628
+ var _lastFontVersion = -1;
629
+ function _invalidateDefaultFontCache() {
630
+ _defaultFontVersion++;
631
+ }
632
+ {
633
+ const _KEY = "__kbach_font_cache_unsub__";
634
+ const g = globalThis;
635
+ if (g[_KEY]) g[_KEY]();
636
+ g[_KEY] = (0, import_core6.onConfigChange)(_invalidateDefaultFontCache);
637
+ }
638
+ function getCachedDefaultFont() {
639
+ if (_lastFontVersion !== _defaultFontVersion) {
640
+ _cachedDefaultFont = (0, import_core6.getDefaultFontFamily)();
641
+ _lastFontVersion = _defaultFontVersion;
642
+ }
643
+ return _cachedDefaultFont;
644
+ }
645
+ var _bucketModsCache = /* @__PURE__ */ new WeakMap();
646
+ function bucketMods(resolved) {
647
+ const cached = _bucketModsCache.get(resolved);
648
+ if (cached) return cached;
649
+ const interactiveMods = (0, import_core6.getInteractiveModifiers)();
650
+ const modeMods = (0, import_core6.getModeModifiers)();
651
+ const responsiveMods = (0, import_core6.getResponsiveModifiers)();
652
+ let interactive = false;
653
+ let modeOrResponsive = false;
654
+ for (const key of Object.keys(resolved)) {
655
+ if (key === "base") continue;
656
+ for (const mod of key.split(":")) {
657
+ if (!interactive && interactiveMods.has(mod)) interactive = true;
658
+ if (!modeOrResponsive && (modeMods.has(mod) || responsiveMods.has(mod))) modeOrResponsive = true;
659
+ }
660
+ if (interactive && modeOrResponsive) break;
661
+ }
662
+ const result = { interactive, modeOrResponsive };
663
+ _bucketModsCache.set(resolved, result);
664
+ return result;
665
+ }
666
+ var CONSUMED_PROPS = /* @__PURE__ */ new Set(["className", "kb", "__kbachStyles", "__kbachClasses"]);
667
+ function omitConsumed(props) {
668
+ const out = {};
669
+ for (const key of Object.keys(props)) {
670
+ if (!CONSUMED_PROPS.has(key)) out[key] = props[key];
671
+ }
672
+ return out;
673
+ }
674
+ function makeElement(isStaticChildren, type, props, key) {
675
+ return (isStaticChildren ? import_jsx_runtime.jsxs : import_jsx_runtime.jsx)(type, props, key);
676
+ }
677
+ function processElement(type, rawProps, key, isStaticChildren) {
678
+ if (type === null || typeof type === "symbol") return makeElement(isStaticChildren, type, rawProps ?? {}, key);
679
+ const webTag = (0, import_core6.getEffectiveIsWeb)() ? getWebTag(type, rawProps ?? void 0) : null;
680
+ const effectiveType = webTag ?? type;
681
+ const originalName = webTag ? type?.displayName ?? type?.name : void 0;
682
+ if (!rawProps) return (0, import_jsx_runtime.jsx)(effectiveType, null, key);
683
+ const workingProps = webTag && originalName ? transformToWebProps(originalName, webTag, rawProps) : rawProps;
684
+ const { className, kb: kbProp, __kbachStyles, __kbachClasses } = workingProps;
685
+ const classStrRaw = className ?? kbProp ?? __kbachClasses;
686
+ if (classStrRaw !== void 0 && typeof classStrRaw !== "string") {
687
+ return makeElement(isStaticChildren, effectiveType, workingProps, key);
688
+ }
689
+ const classStr = classStrRaw;
690
+ const config = (0, import_core6.getConfig)();
691
+ let expandedClassStr = classStr ? (0, import_core6.expandModeAwareColorClasses)(classStr, config.theme.colors) : classStr;
692
+ if (!import_core6.isNative && (0, import_core6.isRuntimeCSSDisabled)() && expandedClassStr && !__kbachStyles) {
693
+ const { style: userStyle2, ...passProps2 } = omitConsumed(workingProps);
694
+ return makeElement(isStaticChildren, effectiveType, {
695
+ ...passProps2,
696
+ className: (0, import_core6.normalizeClassString)(expandedClassStr),
697
+ ...userStyle2 !== void 0 ? { style: userStyle2 } : {}
698
+ }, key);
699
+ }
700
+ if (classStr && !__kbachStyles && /^(__[A-Za-z0-9_]+\s*)+$/.test(classStr.trim())) {
701
+ const { style: userStyle2, ...passProps2 } = omitConsumed(workingProps);
702
+ return makeElement(isStaticChildren, effectiveType, {
703
+ ...passProps2,
704
+ className: classStr,
705
+ ...userStyle2 !== void 0 ? { style: userStyle2 } : {}
706
+ }, key);
707
+ }
708
+ if (!classStr && !__kbachStyles) {
709
+ if ((0, import_core6.getEffectiveIsWeb)()) return makeElement(isStaticChildren, effectiveType, omitConsumed(workingProps), key);
710
+ const defaultFont = getCachedDefaultFont();
711
+ if (!defaultFont || getWebTag(type) !== "span") {
712
+ return makeElement(isStaticChildren, effectiveType, workingProps, key);
713
+ }
714
+ const { style: userStyle2, ...passProps2 } = omitConsumed(workingProps);
715
+ const finalStyle2 = userStyle2 ? Array.isArray(userStyle2) ? { fontFamily: defaultFont, ...Object.assign({}, ...userStyle2) } : { fontFamily: defaultFont, ...userStyle2 } : { fontFamily: defaultFont };
716
+ return makeElement(isStaticChildren, effectiveType, { ...passProps2, style: finalStyle2 }, key);
717
+ }
718
+ let resolved = import_core6.isNative && __kbachStyles != null ? __kbachStyles : expandedClassStr ? (0, import_core6.resolve)(expandedClassStr, config.theme, config.darkMode) : {};
719
+ const impliedClasses = getImpliedRNClasses(webTag, resolved.base);
720
+ if (impliedClasses) {
721
+ expandedClassStr = expandedClassStr ? `${expandedClassStr} ${impliedClasses}` : impliedClasses;
722
+ resolved = (0, import_core6.resolve)(expandedClassStr, config.theme, config.darkMode);
723
+ }
724
+ const { style: userStyle, ...passProps } = omitConsumed(workingProps);
725
+ const { interactive, modeOrResponsive } = bucketMods(resolved);
726
+ if (interactive) {
727
+ return (0, import_jsx_runtime.jsx)(InteractiveWrapper, {
728
+ Component: effectiveType,
729
+ resolvedStyle: resolved,
730
+ ...!import_core6.isNative && expandedClassStr ? { className: (0, import_core6.normalizeClassString)(expandedClassStr) } : {},
731
+ style: userStyle,
732
+ ...passProps
733
+ }, key);
734
+ }
735
+ if (modeOrResponsive) {
736
+ return (0, import_jsx_runtime.jsx)(DarkWrapper, {
737
+ Component: effectiveType,
738
+ resolvedStyle: resolved,
739
+ ...!import_core6.isNative && expandedClassStr ? { className: (0, import_core6.normalizeClassString)(expandedClassStr) } : {},
740
+ style: userStyle,
741
+ ...passProps
742
+ }, key);
743
+ }
744
+ const skipComputedInline = (0, import_core6.getEffectiveIsWeb)();
745
+ let finalStyle;
746
+ if (!skipComputedInline) {
747
+ const computedStyle = (0, import_core6.flatten)(resolved, false);
748
+ stripInternalMarkers(computedStyle);
749
+ if (typeof effectiveType !== "string") stripWebOnlyProps(computedStyle);
750
+ finalStyle = composeNativeStyle(computedStyle, userStyle);
751
+ } else {
752
+ finalStyle = userStyle ?? void 0;
753
+ }
754
+ return makeElement(isStaticChildren, effectiveType, {
755
+ ...passProps,
756
+ ...finalStyle !== void 0 ? { style: finalStyle } : {},
757
+ ...!import_core6.isNative && expandedClassStr ? { className: (0, import_core6.normalizeClassString)(expandedClassStr) } : {}
758
+ }, key);
759
+ }
760
+ function jsx(type, props, key) {
761
+ return processElement(type, props, key, false);
762
+ }
763
+ function jsxs(type, props, key) {
764
+ return processElement(type, props, key, true);
765
+ }
766
+
767
+ // src/jsx-dev-runtime.tsx
768
+ function jsxDEV(type, props, key, isStaticChildren, source, self) {
769
+ const element = (isStaticChildren ? jsxs : jsx)(type, props, key);
770
+ if (source && element && typeof element === "object" && Object.isExtensible(element)) {
771
+ element._source = source;
772
+ element._self = self;
773
+ }
774
+ return element;
775
+ }
776
+ // Annotate the CommonJS export names for ESM import in node:
777
+ 0 && (module.exports = {
778
+ Fragment,
779
+ jsxDEV
780
+ });