@kbach/react 0.5.48 → 0.5.49

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.
@@ -1,24 +1,14 @@
1
1
  import {
2
2
  flatten,
3
3
  getActiveBreakpoints,
4
- getConfig,
5
- getDefaultFontFamily,
6
4
  getGlobalWidth,
7
5
  getInteractiveModifiers,
8
- getModeModifiers,
9
6
  getResponsiveModifiers,
10
7
  isNative,
11
- isRuntimeCSSDisabled,
12
8
  isWeb,
13
- normalizeClassString,
14
- resolve,
15
9
  subscribeGlobalWidth
16
10
  } from "./chunk-BKSXIWL7.mjs";
17
11
 
18
- // src/jsx-runtime.tsx
19
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
20
- import { Fragment } from "react";
21
-
22
12
  // src/core/darkModeStore.ts
23
13
  var KEY = "__kbach_dark_store__";
24
14
  function getStore() {
@@ -47,8 +37,90 @@ function subscribeGlobalDarkMode(callback) {
47
37
  return () => store.subscribers.delete(callback);
48
38
  }
49
39
 
50
- // src/InteractiveWrapper.tsx
51
- import React3, { forwardRef, useState, useCallback, useMemo } from "react";
40
+ // src/web-substitute.ts
41
+ var _rnToHtml = {
42
+ View: "div",
43
+ SafeAreaView: "div",
44
+ KeyboardAvoidingView: "div",
45
+ ScrollView: "div",
46
+ VirtualizedList: "div",
47
+ Text: "span",
48
+ Pressable: "div",
49
+ TouchableOpacity: "div",
50
+ TouchableHighlight: "div",
51
+ TouchableWithoutFeedback: "div",
52
+ TouchableNativeFeedback: "div"
53
+ };
54
+ var _userMap = /* @__PURE__ */ new Map();
55
+ var _cache = /* @__PURE__ */ new WeakMap();
56
+ function registerWebElement(rnComponent, htmlTag) {
57
+ if (typeof rnComponent !== "object" && typeof rnComponent !== "function") return;
58
+ _userMap.set(rnComponent, htmlTag);
59
+ _cache.delete(rnComponent);
60
+ }
61
+ function getWebTag(type) {
62
+ if (typeof type === "string") return null;
63
+ if (type === null || typeof type !== "function" && typeof type !== "object") return null;
64
+ const obj = type;
65
+ if (_userMap.has(obj)) return _userMap.get(obj);
66
+ if (_cache.has(obj)) return _cache.get(obj);
67
+ const name = obj.displayName ?? obj.name;
68
+ const tag = name ? _rnToHtml[name] ?? null : null;
69
+ _cache.set(obj, tag);
70
+ return tag;
71
+ }
72
+ var _rnOnlyProps = /* @__PURE__ */ new Set([
73
+ "onLongPress",
74
+ "delayLongPress",
75
+ "activeOpacity",
76
+ "underlayColor",
77
+ "hitSlop",
78
+ "pressRetentionOffset",
79
+ "accessible",
80
+ "accessibilityState",
81
+ "accessibilityLiveRegion",
82
+ "importantForAccessibility",
83
+ "nativeID",
84
+ "collapsable",
85
+ "needsOffscreenAlphaCompositing",
86
+ "renderToHardwareTextureAndroid",
87
+ "shouldRasterizeIOS",
88
+ "pointerEvents"
89
+ // RN and HTML values differ
90
+ ]);
91
+ var _pressableNames = /* @__PURE__ */ new Set([
92
+ "Pressable",
93
+ "TouchableOpacity",
94
+ "TouchableHighlight",
95
+ "TouchableWithoutFeedback",
96
+ "TouchableNativeFeedback"
97
+ ]);
98
+ function transformToWebProps(originalName, props) {
99
+ const out = {};
100
+ const isPressable = _pressableNames.has(originalName);
101
+ for (const [k, v] of Object.entries(props)) {
102
+ if (_rnOnlyProps.has(k)) continue;
103
+ if (k === "onPress") {
104
+ if (!("onClick" in props)) out.onClick = v;
105
+ continue;
106
+ }
107
+ if (k === "accessibilityLabel") {
108
+ if (out["aria-label"] == null) out["aria-label"] = v;
109
+ continue;
110
+ }
111
+ if (k === "accessibilityRole") {
112
+ if (out.role == null) out.role = v;
113
+ continue;
114
+ }
115
+ if (k === "testID") {
116
+ if (out["data-testid"] == null) out["data-testid"] = v;
117
+ continue;
118
+ }
119
+ out[k] = v;
120
+ }
121
+ if (isPressable && !out.role) out.role = "button";
122
+ return out;
123
+ }
52
124
 
53
125
  // src/useGlobalDarkMode.ts
54
126
  import React from "react";
@@ -66,6 +138,9 @@ function useGlobalDarkMode() {
66
138
  );
67
139
  }
68
140
 
141
+ // src/InteractiveWrapper.tsx
142
+ import React3, { forwardRef, useState, useCallback, useMemo } from "react";
143
+
69
144
  // src/useGlobalWidth.ts
70
145
  import React2 from "react";
71
146
  var useSyncExternalStore2 = React2.useSyncExternalStore ?? function useSyncExternalStoreFallback2(subscribe, getSnapshot, _getServerSnapshot) {
@@ -240,292 +315,6 @@ var InteractiveWrapper = forwardRef(
240
315
  );
241
316
  InteractiveWrapper.displayName = "Kbach.InteractiveWrapper";
242
317
 
243
- // src/DarkWrapper.tsx
244
- import React4, { useMemo as useMemo2 } from "react";
245
- var DarkWrapper = React4.forwardRef(
246
- function DarkWrapper2({ Component, resolvedStyle, style: styleProp, children, ...rest }, ref) {
247
- const isDark = useGlobalDarkMode();
248
- const needsWidth = hasResponsiveBuckets(resolvedStyle);
249
- const width = useConditionalWidth(needsWidth);
250
- const breakpoints = needsWidth ? getActiveBreakpoints(width) : EMPTY_BREAKPOINTS2;
251
- const isNonStringComponent = typeof Component !== "string";
252
- const computedStyle = useMemo2(() => {
253
- const s = flatten(resolvedStyle, isDark, {}, breakpoints);
254
- stripInternalMarkers(s);
255
- if (isNonStringComponent) stripWebOnlyProps(s);
256
- return s;
257
- }, [resolvedStyle, isDark, width, isNonStringComponent]);
258
- const skipComputedInline = isWeb || !isNative && typeof Component === "string";
259
- const finalStyle = skipComputedInline ? styleProp ?? void 0 : styleProp ? Array.isArray(styleProp) ? Object.assign({}, computedStyle, ...styleProp) : { ...computedStyle, ...styleProp } : computedStyle;
260
- const props = { ref, ...rest, style: finalStyle };
261
- return Array.isArray(children) ? React4.createElement(Component, props, ...children) : React4.createElement(Component, props, children);
262
- }
263
- );
264
- DarkWrapper.displayName = "Kbach.DarkWrapper";
265
- function stripInternalMarkers(s) {
266
- delete s.__divideX;
267
- delete s.__divideY;
268
- delete s.__divideColor;
269
- delete s.__divideStyle;
270
- delete s.__keyframe;
271
- }
272
- function stripWebOnlyProps(s) {
273
- if (s.display === "grid" || s.display === "inline-grid") delete s.display;
274
- delete s.gridTemplateColumns;
275
- delete s.gridTemplateRows;
276
- delete s.gridColumn;
277
- delete s.gridRow;
278
- delete s.gridArea;
279
- delete s.gridColumnStart;
280
- delete s.gridColumnEnd;
281
- delete s.gridRowStart;
282
- delete s.gridRowEnd;
283
- delete s.gridAutoFlow;
284
- delete s.gridAutoColumns;
285
- delete s.gridAutoRows;
286
- delete s.placeItems;
287
- delete s.placeContent;
288
- delete s.justifyItems;
289
- delete s.placeSelf;
290
- delete s.justifySelf;
291
- if (s.position === "sticky" || s.position === "fixed" || s.position === "static") {
292
- delete s.position;
293
- }
294
- }
295
-
296
- // src/jsx-runtime.tsx
297
- var _cachedDefaultFont = void 0;
298
- var _defaultFontVersion = 0;
299
- var _lastFontVersion = -1;
300
- function _invalidateDefaultFontCache() {
301
- _defaultFontVersion++;
302
- }
303
- function getCachedDefaultFont() {
304
- if (_lastFontVersion !== _defaultFontVersion) {
305
- _cachedDefaultFont = getDefaultFontFamily();
306
- _lastFontVersion = _defaultFontVersion;
307
- }
308
- return _cachedDefaultFont;
309
- }
310
- var _bucketModsCache = /* @__PURE__ */ new WeakMap();
311
- function bucketMods(resolved) {
312
- const cached = _bucketModsCache.get(resolved);
313
- if (cached) return cached;
314
- const interactiveMods = getInteractiveModifiers();
315
- const modeMods = getModeModifiers();
316
- const responsiveMods = getResponsiveModifiers();
317
- let interactive = false;
318
- let modeOrResponsive = false;
319
- for (const key of Object.keys(resolved)) {
320
- if (key === "base") continue;
321
- for (const mod of key.split(":")) {
322
- if (!interactive && interactiveMods.has(mod)) interactive = true;
323
- if (!modeOrResponsive && (modeMods.has(mod) || responsiveMods.has(mod))) modeOrResponsive = true;
324
- }
325
- if (interactive && modeOrResponsive) break;
326
- }
327
- const result = { interactive, modeOrResponsive };
328
- _bucketModsCache.set(resolved, result);
329
- return result;
330
- }
331
- var CONSUMED_PROPS = /* @__PURE__ */ new Set(["className", "kb", "__kbachStyles", "__kbachClasses"]);
332
- function omitConsumed(props) {
333
- const out = {};
334
- for (const key of Object.keys(props)) {
335
- if (!CONSUMED_PROPS.has(key)) out[key] = props[key];
336
- }
337
- return out;
338
- }
339
- function mergeStyle(computed, userStyle) {
340
- if (!userStyle) return computed;
341
- if (Array.isArray(userStyle)) return Object.assign({}, computed, ...userStyle);
342
- return { ...computed, ...userStyle };
343
- }
344
- function makeElement(isStaticChildren, type, props, key) {
345
- return (isStaticChildren ? _jsxs : _jsx)(type, props, key);
346
- }
347
- function stripInternalMarkers2(s) {
348
- delete s.__divideX;
349
- delete s.__divideY;
350
- delete s.__divideColor;
351
- delete s.__divideStyle;
352
- delete s.__keyframe;
353
- }
354
- function stripWebOnlyInlineProps(s) {
355
- if (s.display === "grid" || s.display === "inline-grid") delete s.display;
356
- delete s.gridTemplateColumns;
357
- delete s.gridTemplateRows;
358
- delete s.gridColumn;
359
- delete s.gridRow;
360
- delete s.gridArea;
361
- delete s.gridColumnStart;
362
- delete s.gridColumnEnd;
363
- delete s.gridRowStart;
364
- delete s.gridRowEnd;
365
- delete s.gridAutoFlow;
366
- delete s.gridAutoColumns;
367
- delete s.gridAutoRows;
368
- delete s.placeItems;
369
- delete s.placeContent;
370
- delete s.justifyItems;
371
- delete s.placeSelf;
372
- delete s.justifySelf;
373
- if (s.position === "sticky" || s.position === "fixed" || s.position === "static") {
374
- delete s.position;
375
- }
376
- }
377
- var _rnToHtml = {
378
- View: "div",
379
- SafeAreaView: "div",
380
- KeyboardAvoidingView: "div",
381
- ScrollView: "div",
382
- VirtualizedList: "div",
383
- Text: "span",
384
- Pressable: "div",
385
- TouchableOpacity: "div",
386
- TouchableHighlight: "div",
387
- TouchableWithoutFeedback: "div",
388
- TouchableNativeFeedback: "div"
389
- };
390
- var _userWebTypeMap = /* @__PURE__ */ new Map();
391
- var _webTypeCache = /* @__PURE__ */ new WeakMap();
392
- function registerWebElement(rnComponent, htmlTag) {
393
- if (typeof rnComponent !== "object" && typeof rnComponent !== "function") return;
394
- _userWebTypeMap.set(rnComponent, htmlTag);
395
- _webTypeCache.delete(rnComponent);
396
- }
397
- function getWebTag(type) {
398
- if (typeof type === "string") return null;
399
- if (type === null || typeof type !== "function" && typeof type !== "object") return null;
400
- const obj = type;
401
- if (_userWebTypeMap.has(obj)) return _userWebTypeMap.get(obj);
402
- if (_webTypeCache.has(obj)) return _webTypeCache.get(obj);
403
- const name = obj.displayName ?? obj.name;
404
- const tag = name ? _rnToHtml[name] ?? null : null;
405
- _webTypeCache.set(obj, tag);
406
- return tag;
407
- }
408
- var _rnOnlyProps = /* @__PURE__ */ new Set([
409
- "onLongPress",
410
- "delayLongPress",
411
- "activeOpacity",
412
- "underlayColor",
413
- "hitSlop",
414
- "pressRetentionOffset",
415
- "accessible",
416
- "accessibilityState",
417
- "accessibilityLiveRegion",
418
- "importantForAccessibility",
419
- "nativeID",
420
- "collapsable",
421
- "needsOffscreenAlphaCompositing",
422
- "renderToHardwareTextureAndroid",
423
- "shouldRasterizeIOS",
424
- "pointerEvents"
425
- // RN prop — values differ from HTML pointer-events CSS
426
- ]);
427
- var _pressableDisplayNames = /* @__PURE__ */ new Set([
428
- "Pressable",
429
- "TouchableOpacity",
430
- "TouchableHighlight",
431
- "TouchableWithoutFeedback",
432
- "TouchableNativeFeedback"
433
- ]);
434
- function transformToWebProps(originalName, props) {
435
- const out = {};
436
- const isPressable = _pressableDisplayNames.has(originalName);
437
- for (const [k, v] of Object.entries(props)) {
438
- if (_rnOnlyProps.has(k)) continue;
439
- if (k === "onPress") {
440
- if (!("onClick" in props)) out.onClick = v;
441
- continue;
442
- }
443
- if (k === "accessibilityLabel") {
444
- if (out["aria-label"] == null) out["aria-label"] = v;
445
- continue;
446
- }
447
- if (k === "accessibilityRole") {
448
- if (out.role == null) out.role = v;
449
- continue;
450
- }
451
- if (k === "testID") {
452
- if (out["data-testid"] == null) out["data-testid"] = v;
453
- continue;
454
- }
455
- out[k] = v;
456
- }
457
- if (isPressable && !out.role) out.role = "button";
458
- return out;
459
- }
460
- function processElement(type, rawProps, key, isStaticChildren) {
461
- if (typeof type === "symbol") return makeElement(isStaticChildren, type, rawProps ?? {}, key);
462
- const webTag = isWeb ? getWebTag(type) : null;
463
- const effectiveType = webTag ?? type;
464
- const originalName = webTag ? type?.displayName ?? type?.name : void 0;
465
- if (!rawProps) return _jsx(effectiveType, null, key);
466
- const workingProps = webTag && originalName ? transformToWebProps(originalName, rawProps) : rawProps;
467
- const { className, kb: kbProp, __kbachStyles, __kbachClasses } = workingProps;
468
- const classStr = className ?? kbProp ?? __kbachClasses;
469
- if (!isNative && isRuntimeCSSDisabled() && classStr && !__kbachStyles) {
470
- const { style: userStyle2, ...passProps2 } = omitConsumed(workingProps);
471
- return makeElement(isStaticChildren, effectiveType, {
472
- ...passProps2,
473
- className: normalizeClassString(classStr),
474
- ...userStyle2 !== void 0 ? { style: userStyle2 } : {}
475
- }, key);
476
- }
477
- if (!classStr && !__kbachStyles) {
478
- const defaultFont = getCachedDefaultFont();
479
- if (!defaultFont) return makeElement(isStaticChildren, effectiveType, workingProps, key);
480
- const { style: userStyle2, ...passProps2 } = omitConsumed(workingProps);
481
- const finalStyle2 = userStyle2 ? Array.isArray(userStyle2) ? { fontFamily: defaultFont, ...Object.assign({}, ...userStyle2) } : { fontFamily: defaultFont, ...userStyle2 } : { fontFamily: defaultFont };
482
- return makeElement(isStaticChildren, effectiveType, { ...passProps2, style: finalStyle2 }, key);
483
- }
484
- const config = getConfig();
485
- const resolved = __kbachStyles ?? (classStr ? resolve(classStr, config.theme, config.darkMode) : {});
486
- const { style: userStyle, ...passProps } = omitConsumed(workingProps);
487
- const { interactive, modeOrResponsive } = bucketMods(resolved);
488
- if (interactive) {
489
- return _jsx(InteractiveWrapper, {
490
- Component: effectiveType,
491
- resolvedStyle: resolved,
492
- ...!isNative && classStr ? { className: normalizeClassString(classStr) } : {},
493
- style: userStyle,
494
- ...passProps
495
- }, key);
496
- }
497
- if (modeOrResponsive) {
498
- return _jsx(DarkWrapper, {
499
- Component: effectiveType,
500
- resolvedStyle: resolved,
501
- ...!isNative && classStr ? { className: normalizeClassString(classStr) } : {},
502
- style: userStyle,
503
- ...passProps
504
- }, key);
505
- }
506
- const skipComputedInline = isWeb || !isNative && typeof effectiveType === "string";
507
- let finalStyle;
508
- if (!skipComputedInline) {
509
- const computedStyle = flatten(resolved, false);
510
- stripInternalMarkers2(computedStyle);
511
- if (typeof effectiveType !== "string") stripWebOnlyInlineProps(computedStyle);
512
- finalStyle = mergeStyle(computedStyle, userStyle);
513
- } else {
514
- finalStyle = userStyle ?? void 0;
515
- }
516
- return makeElement(isStaticChildren, effectiveType, {
517
- ...passProps,
518
- style: finalStyle,
519
- ...!isNative && classStr ? { className: normalizeClassString(classStr) } : {}
520
- }, key);
521
- }
522
- function jsx(type, props, key) {
523
- return processElement(type, props, key, false);
524
- }
525
- function jsxs(type, props, key) {
526
- return processElement(type, props, key, true);
527
- }
528
-
529
318
  export {
530
319
  syncGlobalDarkMode,
531
320
  setGlobalDarkMode,
@@ -534,11 +323,10 @@ export {
534
323
  useConditionalWidth,
535
324
  hasResponsiveBuckets,
536
325
  hasInteractiveBuckets,
537
- useGlobalDarkMode,
538
- InteractiveWrapper,
539
- Fragment,
540
- _invalidateDefaultFontCache,
326
+ EMPTY_BREAKPOINTS2,
541
327
  registerWebElement,
542
- jsx,
543
- jsxs
328
+ getWebTag,
329
+ transformToWebProps,
330
+ useGlobalDarkMode,
331
+ InteractiveWrapper
544
332
  };
@@ -0,0 +1,238 @@
1
+ import {
2
+ EMPTY_BREAKPOINTS2 as EMPTY_BREAKPOINTS,
3
+ InteractiveWrapper,
4
+ getWebTag,
5
+ hasResponsiveBuckets,
6
+ transformToWebProps,
7
+ useConditionalWidth,
8
+ useGlobalDarkMode
9
+ } from "./chunk-3UUTNNWV.mjs";
10
+ import {
11
+ flatten,
12
+ getActiveBreakpoints,
13
+ getConfig,
14
+ getDefaultFontFamily,
15
+ getInteractiveModifiers,
16
+ getModeModifiers,
17
+ getResponsiveModifiers,
18
+ isNative,
19
+ isRuntimeCSSDisabled,
20
+ isWeb,
21
+ normalizeClassString,
22
+ resolve
23
+ } from "./chunk-BKSXIWL7.mjs";
24
+
25
+ // src/jsx-runtime.tsx
26
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
27
+ import { Fragment } from "react";
28
+
29
+ // src/DarkWrapper.tsx
30
+ import React, { useMemo } from "react";
31
+ var DarkWrapper = React.forwardRef(
32
+ function DarkWrapper2({ Component, resolvedStyle, style: styleProp, children, ...rest }, ref) {
33
+ const isDark = useGlobalDarkMode();
34
+ const needsWidth = hasResponsiveBuckets(resolvedStyle);
35
+ const width = useConditionalWidth(needsWidth);
36
+ const breakpoints = needsWidth ? getActiveBreakpoints(width) : EMPTY_BREAKPOINTS;
37
+ const isNonStringComponent = typeof Component !== "string";
38
+ const computedStyle = useMemo(() => {
39
+ const s = flatten(resolvedStyle, isDark, {}, breakpoints);
40
+ stripInternalMarkers(s);
41
+ if (isNonStringComponent) stripWebOnlyProps(s);
42
+ return s;
43
+ }, [resolvedStyle, isDark, width, isNonStringComponent]);
44
+ const skipComputedInline = isWeb || !isNative && typeof Component === "string";
45
+ const finalStyle = skipComputedInline ? styleProp ?? void 0 : styleProp ? Array.isArray(styleProp) ? Object.assign({}, computedStyle, ...styleProp) : { ...computedStyle, ...styleProp } : computedStyle;
46
+ const props = { ref, ...rest, style: finalStyle };
47
+ return Array.isArray(children) ? React.createElement(Component, props, ...children) : React.createElement(Component, props, children);
48
+ }
49
+ );
50
+ DarkWrapper.displayName = "Kbach.DarkWrapper";
51
+ function stripInternalMarkers(s) {
52
+ delete s.__divideX;
53
+ delete s.__divideY;
54
+ delete s.__divideColor;
55
+ delete s.__divideStyle;
56
+ delete s.__keyframe;
57
+ }
58
+ function stripWebOnlyProps(s) {
59
+ if (s.display === "grid" || s.display === "inline-grid") delete s.display;
60
+ delete s.gridTemplateColumns;
61
+ delete s.gridTemplateRows;
62
+ delete s.gridColumn;
63
+ delete s.gridRow;
64
+ delete s.gridArea;
65
+ delete s.gridColumnStart;
66
+ delete s.gridColumnEnd;
67
+ delete s.gridRowStart;
68
+ delete s.gridRowEnd;
69
+ delete s.gridAutoFlow;
70
+ delete s.gridAutoColumns;
71
+ delete s.gridAutoRows;
72
+ delete s.placeItems;
73
+ delete s.placeContent;
74
+ delete s.justifyItems;
75
+ delete s.placeSelf;
76
+ delete s.justifySelf;
77
+ if (s.position === "sticky" || s.position === "fixed" || s.position === "static") {
78
+ delete s.position;
79
+ }
80
+ }
81
+
82
+ // src/jsx-runtime.tsx
83
+ var _cachedDefaultFont = void 0;
84
+ var _defaultFontVersion = 0;
85
+ var _lastFontVersion = -1;
86
+ function _invalidateDefaultFontCache() {
87
+ _defaultFontVersion++;
88
+ }
89
+ function getCachedDefaultFont() {
90
+ if (_lastFontVersion !== _defaultFontVersion) {
91
+ _cachedDefaultFont = getDefaultFontFamily();
92
+ _lastFontVersion = _defaultFontVersion;
93
+ }
94
+ return _cachedDefaultFont;
95
+ }
96
+ var _bucketModsCache = /* @__PURE__ */ new WeakMap();
97
+ function bucketMods(resolved) {
98
+ const cached = _bucketModsCache.get(resolved);
99
+ if (cached) return cached;
100
+ const interactiveMods = getInteractiveModifiers();
101
+ const modeMods = getModeModifiers();
102
+ const responsiveMods = getResponsiveModifiers();
103
+ let interactive = false;
104
+ let modeOrResponsive = false;
105
+ for (const key of Object.keys(resolved)) {
106
+ if (key === "base") continue;
107
+ for (const mod of key.split(":")) {
108
+ if (!interactive && interactiveMods.has(mod)) interactive = true;
109
+ if (!modeOrResponsive && (modeMods.has(mod) || responsiveMods.has(mod))) modeOrResponsive = true;
110
+ }
111
+ if (interactive && modeOrResponsive) break;
112
+ }
113
+ const result = { interactive, modeOrResponsive };
114
+ _bucketModsCache.set(resolved, result);
115
+ return result;
116
+ }
117
+ var CONSUMED_PROPS = /* @__PURE__ */ new Set(["className", "kb", "__kbachStyles", "__kbachClasses"]);
118
+ function omitConsumed(props) {
119
+ const out = {};
120
+ for (const key of Object.keys(props)) {
121
+ if (!CONSUMED_PROPS.has(key)) out[key] = props[key];
122
+ }
123
+ return out;
124
+ }
125
+ function mergeStyle(computed, userStyle) {
126
+ if (!userStyle) return computed;
127
+ if (Array.isArray(userStyle)) return Object.assign({}, computed, ...userStyle);
128
+ return { ...computed, ...userStyle };
129
+ }
130
+ function makeElement(isStaticChildren, type, props, key) {
131
+ return (isStaticChildren ? _jsxs : _jsx)(type, props, key);
132
+ }
133
+ function stripInternalMarkers2(s) {
134
+ delete s.__divideX;
135
+ delete s.__divideY;
136
+ delete s.__divideColor;
137
+ delete s.__divideStyle;
138
+ delete s.__keyframe;
139
+ }
140
+ function stripWebOnlyInlineProps(s) {
141
+ if (s.display === "grid" || s.display === "inline-grid") delete s.display;
142
+ delete s.gridTemplateColumns;
143
+ delete s.gridTemplateRows;
144
+ delete s.gridColumn;
145
+ delete s.gridRow;
146
+ delete s.gridArea;
147
+ delete s.gridColumnStart;
148
+ delete s.gridColumnEnd;
149
+ delete s.gridRowStart;
150
+ delete s.gridRowEnd;
151
+ delete s.gridAutoFlow;
152
+ delete s.gridAutoColumns;
153
+ delete s.gridAutoRows;
154
+ delete s.placeItems;
155
+ delete s.placeContent;
156
+ delete s.justifyItems;
157
+ delete s.placeSelf;
158
+ delete s.justifySelf;
159
+ if (s.position === "sticky" || s.position === "fixed" || s.position === "static") {
160
+ delete s.position;
161
+ }
162
+ }
163
+ function processElement(type, rawProps, key, isStaticChildren) {
164
+ if (typeof type === "symbol") return makeElement(isStaticChildren, type, rawProps ?? {}, key);
165
+ const webTag = isWeb ? getWebTag(type) : null;
166
+ const effectiveType = webTag ?? type;
167
+ const originalName = webTag ? type?.displayName ?? type?.name : void 0;
168
+ if (!rawProps) return _jsx(effectiveType, null, key);
169
+ const workingProps = webTag && originalName ? transformToWebProps(originalName, rawProps) : rawProps;
170
+ const { className, kb: kbProp, __kbachStyles, __kbachClasses } = workingProps;
171
+ const classStr = className ?? kbProp ?? __kbachClasses;
172
+ if (!isNative && isRuntimeCSSDisabled() && classStr && !__kbachStyles) {
173
+ const { style: userStyle2, ...passProps2 } = omitConsumed(workingProps);
174
+ return makeElement(isStaticChildren, effectiveType, {
175
+ ...passProps2,
176
+ className: normalizeClassString(classStr),
177
+ ...userStyle2 !== void 0 ? { style: userStyle2 } : {}
178
+ }, key);
179
+ }
180
+ if (!classStr && !__kbachStyles) {
181
+ if (isWeb) return makeElement(isStaticChildren, effectiveType, omitConsumed(workingProps), key);
182
+ const defaultFont = getCachedDefaultFont();
183
+ if (!defaultFont) return makeElement(isStaticChildren, effectiveType, workingProps, key);
184
+ const { style: userStyle2, ...passProps2 } = omitConsumed(workingProps);
185
+ const finalStyle2 = userStyle2 ? Array.isArray(userStyle2) ? { fontFamily: defaultFont, ...Object.assign({}, ...userStyle2) } : { fontFamily: defaultFont, ...userStyle2 } : { fontFamily: defaultFont };
186
+ return makeElement(isStaticChildren, effectiveType, { ...passProps2, style: finalStyle2 }, key);
187
+ }
188
+ const config = getConfig();
189
+ const resolved = __kbachStyles ?? (classStr ? resolve(classStr, config.theme, config.darkMode) : {});
190
+ const { style: userStyle, ...passProps } = omitConsumed(workingProps);
191
+ const { interactive, modeOrResponsive } = bucketMods(resolved);
192
+ if (interactive) {
193
+ return _jsx(InteractiveWrapper, {
194
+ Component: effectiveType,
195
+ resolvedStyle: resolved,
196
+ ...!isNative && classStr ? { className: normalizeClassString(classStr) } : {},
197
+ style: userStyle,
198
+ ...passProps
199
+ }, key);
200
+ }
201
+ if (modeOrResponsive) {
202
+ return _jsx(DarkWrapper, {
203
+ Component: effectiveType,
204
+ resolvedStyle: resolved,
205
+ ...!isNative && classStr ? { className: normalizeClassString(classStr) } : {},
206
+ style: userStyle,
207
+ ...passProps
208
+ }, key);
209
+ }
210
+ const skipComputedInline = isWeb || !isNative && typeof effectiveType === "string";
211
+ let finalStyle;
212
+ if (!skipComputedInline) {
213
+ const computedStyle = flatten(resolved, false);
214
+ stripInternalMarkers2(computedStyle);
215
+ if (typeof effectiveType !== "string") stripWebOnlyInlineProps(computedStyle);
216
+ finalStyle = mergeStyle(computedStyle, userStyle);
217
+ } else {
218
+ finalStyle = userStyle ?? void 0;
219
+ }
220
+ return makeElement(isStaticChildren, effectiveType, {
221
+ ...passProps,
222
+ style: finalStyle,
223
+ ...!isNative && classStr ? { className: normalizeClassString(classStr) } : {}
224
+ }, key);
225
+ }
226
+ function jsx(type, props, key) {
227
+ return processElement(type, props, key, false);
228
+ }
229
+ function jsxs(type, props, key) {
230
+ return processElement(type, props, key, true);
231
+ }
232
+
233
+ export {
234
+ Fragment,
235
+ _invalidateDefaultFontCache,
236
+ jsx,
237
+ jsxs
238
+ };
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 './jsx-runtime.mjs';
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 './jsx-runtime.js';
5
+ export { r as registerWebElement } from './web-substitute-CfpYFnE7.js';
6
6
 
7
7
  declare const defaultColors: ThemeColors;
8
8
  declare const defaultTheme: ThemeConfig;