@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/chunk-ISCQQRG5.mjs
DELETED
|
@@ -1,232 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
flatten,
|
|
3
|
-
getActiveBreakpoints,
|
|
4
|
-
getGlobalWidth,
|
|
5
|
-
getResponsiveModifiers,
|
|
6
|
-
isNative,
|
|
7
|
-
isWeb,
|
|
8
|
-
subscribeGlobalWidth
|
|
9
|
-
} from "./chunk-G76344ZQ.mjs";
|
|
10
|
-
|
|
11
|
-
// src/core/darkModeStore.ts
|
|
12
|
-
var KEY = "__kbach_dark_store__";
|
|
13
|
-
function getStore() {
|
|
14
|
-
const g = globalThis;
|
|
15
|
-
if (!g[KEY]) {
|
|
16
|
-
g[KEY] = { isDark: false, lastNotified: false, subscribers: /* @__PURE__ */ new Set() };
|
|
17
|
-
}
|
|
18
|
-
return g[KEY];
|
|
19
|
-
}
|
|
20
|
-
function syncGlobalDarkMode(isDark) {
|
|
21
|
-
getStore().isDark = isDark;
|
|
22
|
-
}
|
|
23
|
-
function setGlobalDarkMode(isDark) {
|
|
24
|
-
const store = getStore();
|
|
25
|
-
store.isDark = isDark;
|
|
26
|
-
if (store.lastNotified === isDark) return;
|
|
27
|
-
store.lastNotified = isDark;
|
|
28
|
-
for (const sub of store.subscribers) sub();
|
|
29
|
-
}
|
|
30
|
-
function getGlobalDarkMode() {
|
|
31
|
-
return getStore().isDark;
|
|
32
|
-
}
|
|
33
|
-
function subscribeGlobalDarkMode(callback) {
|
|
34
|
-
const store = getStore();
|
|
35
|
-
store.subscribers.add(callback);
|
|
36
|
-
return () => store.subscribers.delete(callback);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
// src/useGlobalDarkMode.ts
|
|
40
|
-
import React from "react";
|
|
41
|
-
var useSyncExternalStore = React.useSyncExternalStore ?? function useSyncExternalStoreFallback(subscribe, getSnapshot, _getServerSnapshot) {
|
|
42
|
-
const [, forceUpdate] = React.useReducer((n) => n + 1, 0);
|
|
43
|
-
React.useEffect(() => subscribe(forceUpdate), [subscribe]);
|
|
44
|
-
return getSnapshot();
|
|
45
|
-
};
|
|
46
|
-
function useGlobalDarkMode() {
|
|
47
|
-
return useSyncExternalStore(
|
|
48
|
-
subscribeGlobalDarkMode,
|
|
49
|
-
getGlobalDarkMode,
|
|
50
|
-
() => false
|
|
51
|
-
// SSR: default light
|
|
52
|
-
);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
// src/InteractiveWrapper.tsx
|
|
56
|
-
import React3, { forwardRef, useState, useCallback, useMemo } from "react";
|
|
57
|
-
|
|
58
|
-
// src/useGlobalWidth.ts
|
|
59
|
-
import React2 from "react";
|
|
60
|
-
var useSyncExternalStore2 = React2.useSyncExternalStore ?? function useSyncExternalStoreFallback2(subscribe, getSnapshot, _getServerSnapshot) {
|
|
61
|
-
const [, forceUpdate] = React2.useReducer((n) => n + 1, 0);
|
|
62
|
-
React2.useEffect(() => subscribe(forceUpdate), [subscribe]);
|
|
63
|
-
return getSnapshot();
|
|
64
|
-
};
|
|
65
|
-
var NOOP_SUB = (_) => () => {
|
|
66
|
-
};
|
|
67
|
-
var ZERO_SNAP = () => 0;
|
|
68
|
-
var EMPTY_BREAKPOINTS = /* @__PURE__ */ new Set();
|
|
69
|
-
var _webListeners = null;
|
|
70
|
-
var _webRaf = 0;
|
|
71
|
-
function _webResizeHandler() {
|
|
72
|
-
cancelAnimationFrame(_webRaf);
|
|
73
|
-
_webRaf = requestAnimationFrame(() => {
|
|
74
|
-
if (_webListeners) for (const cb of _webListeners) cb();
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
function subscribeWebWidth(cb) {
|
|
78
|
-
if (typeof window === "undefined") return () => {
|
|
79
|
-
};
|
|
80
|
-
if (!_webListeners) {
|
|
81
|
-
_webListeners = /* @__PURE__ */ new Set();
|
|
82
|
-
window.addEventListener("resize", _webResizeHandler);
|
|
83
|
-
}
|
|
84
|
-
_webListeners.add(cb);
|
|
85
|
-
return () => {
|
|
86
|
-
_webListeners.delete(cb);
|
|
87
|
-
if (_webListeners.size === 0) {
|
|
88
|
-
window.removeEventListener("resize", _webResizeHandler);
|
|
89
|
-
cancelAnimationFrame(_webRaf);
|
|
90
|
-
_webListeners = null;
|
|
91
|
-
}
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
function getWebWidth() {
|
|
95
|
-
return typeof window !== "undefined" ? window.innerWidth : 0;
|
|
96
|
-
}
|
|
97
|
-
function useGlobalWidth() {
|
|
98
|
-
return useSyncExternalStore2(
|
|
99
|
-
isWeb ? subscribeWebWidth : subscribeGlobalWidth,
|
|
100
|
-
isWeb ? getWebWidth : getGlobalWidth,
|
|
101
|
-
ZERO_SNAP
|
|
102
|
-
);
|
|
103
|
-
}
|
|
104
|
-
function useConditionalWidth(active) {
|
|
105
|
-
return useSyncExternalStore2(
|
|
106
|
-
active ? isWeb ? subscribeWebWidth : subscribeGlobalWidth : NOOP_SUB,
|
|
107
|
-
active ? isWeb ? getWebWidth : getGlobalWidth : ZERO_SNAP,
|
|
108
|
-
ZERO_SNAP
|
|
109
|
-
);
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
// src/shared-utils.ts
|
|
113
|
-
function hasResponsiveBuckets(resolved) {
|
|
114
|
-
const responsiveMods = getResponsiveModifiers();
|
|
115
|
-
for (const key of Object.keys(resolved)) {
|
|
116
|
-
if (key === "base") continue;
|
|
117
|
-
for (const mod of key.split(":")) {
|
|
118
|
-
if (responsiveMods.has(mod)) return true;
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
return false;
|
|
122
|
-
}
|
|
123
|
-
var EMPTY_BREAKPOINTS2 = /* @__PURE__ */ new Set();
|
|
124
|
-
|
|
125
|
-
// src/InteractiveWrapper.tsx
|
|
126
|
-
function chain(original, extra) {
|
|
127
|
-
return (...args) => {
|
|
128
|
-
original?.(...args);
|
|
129
|
-
extra();
|
|
130
|
-
};
|
|
131
|
-
}
|
|
132
|
-
var InteractiveWrapper = forwardRef(
|
|
133
|
-
function InteractiveWrapper2({
|
|
134
|
-
Component,
|
|
135
|
-
resolvedStyle,
|
|
136
|
-
className,
|
|
137
|
-
style: styleProp,
|
|
138
|
-
onPressIn,
|
|
139
|
-
onPressOut,
|
|
140
|
-
onPointerDown,
|
|
141
|
-
onPointerUp,
|
|
142
|
-
onPointerLeave,
|
|
143
|
-
onMouseEnter,
|
|
144
|
-
onMouseLeave,
|
|
145
|
-
onFocus,
|
|
146
|
-
onBlur,
|
|
147
|
-
...rest
|
|
148
|
-
}, ref) {
|
|
149
|
-
const isDark = useGlobalDarkMode();
|
|
150
|
-
const needsWidth = hasResponsiveBuckets(resolvedStyle);
|
|
151
|
-
const width = useConditionalWidth(needsWidth);
|
|
152
|
-
const breakpoints = needsWidth ? getActiveBreakpoints(width) : EMPTY_BREAKPOINTS;
|
|
153
|
-
const [pressed, setPressed] = useState(false);
|
|
154
|
-
const [hovered, setHovered] = useState(false);
|
|
155
|
-
const [focused, setFocused] = useState(false);
|
|
156
|
-
const handlePressIn = useCallback(chain(onPressIn, () => setPressed(true)), [onPressIn]);
|
|
157
|
-
const handlePressOut = useCallback(chain(onPressOut, () => setPressed(false)), [onPressOut]);
|
|
158
|
-
const handlePointerDown = useCallback(chain(onPointerDown, () => setPressed(true)), [onPointerDown]);
|
|
159
|
-
const handlePointerUp = useCallback(chain(onPointerUp, () => setPressed(false)), [onPointerUp]);
|
|
160
|
-
const handlePointerLeave = useCallback(chain(onPointerLeave, () => setPressed(false)), [onPointerLeave]);
|
|
161
|
-
const handleMouseEnter = useCallback(chain(onMouseEnter, () => setHovered(true)), [onMouseEnter]);
|
|
162
|
-
const handleMouseLeave = useCallback(chain(onMouseLeave, () => setHovered(false)), [onMouseLeave]);
|
|
163
|
-
const handleFocus = useCallback(chain(onFocus, () => setFocused(true)), [onFocus]);
|
|
164
|
-
const handleBlur = useCallback(chain(onBlur, () => setFocused(false)), [onBlur]);
|
|
165
|
-
const computedStyle = useMemo(
|
|
166
|
-
() => {
|
|
167
|
-
const s = flatten(resolvedStyle, isDark, { pressed, hover: hovered, focus: focused }, breakpoints);
|
|
168
|
-
delete s.__divideX;
|
|
169
|
-
delete s.__divideY;
|
|
170
|
-
delete s.__divideColor;
|
|
171
|
-
delete s.__divideStyle;
|
|
172
|
-
delete s.__keyframe;
|
|
173
|
-
if (typeof Component !== "string") {
|
|
174
|
-
if (s.display === "grid" || s.display === "inline-grid") delete s.display;
|
|
175
|
-
delete s.gridTemplateColumns;
|
|
176
|
-
delete s.gridTemplateRows;
|
|
177
|
-
delete s.gridColumn;
|
|
178
|
-
delete s.gridRow;
|
|
179
|
-
delete s.gridArea;
|
|
180
|
-
delete s.gridColumnStart;
|
|
181
|
-
delete s.gridColumnEnd;
|
|
182
|
-
delete s.gridRowStart;
|
|
183
|
-
delete s.gridRowEnd;
|
|
184
|
-
delete s.gridAutoFlow;
|
|
185
|
-
delete s.gridAutoColumns;
|
|
186
|
-
delete s.gridAutoRows;
|
|
187
|
-
delete s.placeItems;
|
|
188
|
-
delete s.placeContent;
|
|
189
|
-
delete s.justifyItems;
|
|
190
|
-
delete s.placeSelf;
|
|
191
|
-
delete s.justifySelf;
|
|
192
|
-
if (s.position === "sticky" || s.position === "fixed" || s.position === "static") {
|
|
193
|
-
delete s.position;
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
return s;
|
|
197
|
-
},
|
|
198
|
-
[resolvedStyle, isDark, pressed, hovered, focused, width]
|
|
199
|
-
// eslint-disable-line react-hooks/exhaustive-deps
|
|
200
|
-
);
|
|
201
|
-
const isWebHTMLElement = !isNative && typeof Component === "string";
|
|
202
|
-
const finalStyle = isWebHTMLElement ? styleProp ?? void 0 : styleProp ? Array.isArray(styleProp) ? Object.assign({}, computedStyle, ...styleProp) : { ...computedStyle, ...styleProp } : computedStyle;
|
|
203
|
-
const { children, ...restWithoutChildren } = rest;
|
|
204
|
-
const componentProps = {
|
|
205
|
-
ref,
|
|
206
|
-
...restWithoutChildren,
|
|
207
|
-
style: finalStyle,
|
|
208
|
-
...!isNative && className ? { className } : {},
|
|
209
|
-
// onPressIn / onPressOut are React Native-only.
|
|
210
|
-
// On web, onPointerDown/Up drive the pressed state instead (covers mouse + touch).
|
|
211
|
-
...!isNative ? { onPointerDown: handlePointerDown, onPointerUp: handlePointerUp, onPointerLeave: handlePointerLeave } : { onPressIn: handlePressIn, onPressOut: handlePressOut },
|
|
212
|
-
onMouseEnter: handleMouseEnter,
|
|
213
|
-
onMouseLeave: handleMouseLeave,
|
|
214
|
-
onFocus: handleFocus,
|
|
215
|
-
onBlur: handleBlur
|
|
216
|
-
};
|
|
217
|
-
return Array.isArray(children) ? React3.createElement(Component, componentProps, ...children) : React3.createElement(Component, componentProps, children);
|
|
218
|
-
}
|
|
219
|
-
);
|
|
220
|
-
InteractiveWrapper.displayName = "Kbach.InteractiveWrapper";
|
|
221
|
-
|
|
222
|
-
export {
|
|
223
|
-
syncGlobalDarkMode,
|
|
224
|
-
setGlobalDarkMode,
|
|
225
|
-
EMPTY_BREAKPOINTS,
|
|
226
|
-
useGlobalWidth,
|
|
227
|
-
useConditionalWidth,
|
|
228
|
-
hasResponsiveBuckets,
|
|
229
|
-
EMPTY_BREAKPOINTS2,
|
|
230
|
-
useGlobalDarkMode,
|
|
231
|
-
InteractiveWrapper
|
|
232
|
-
};
|
package/dist/chunk-ZN5E7I56.mjs
DELETED
|
@@ -1,226 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
EMPTY_BREAKPOINTS2 as EMPTY_BREAKPOINTS,
|
|
3
|
-
InteractiveWrapper,
|
|
4
|
-
hasResponsiveBuckets,
|
|
5
|
-
useConditionalWidth,
|
|
6
|
-
useGlobalDarkMode
|
|
7
|
-
} from "./chunk-ISCQQRG5.mjs";
|
|
8
|
-
import {
|
|
9
|
-
flatten,
|
|
10
|
-
getActiveBreakpoints,
|
|
11
|
-
getConfig,
|
|
12
|
-
getDefaultFontFamily,
|
|
13
|
-
getInteractiveModifiers,
|
|
14
|
-
getModeModifiers,
|
|
15
|
-
getResponsiveModifiers,
|
|
16
|
-
isNative,
|
|
17
|
-
isRuntimeCSSDisabled,
|
|
18
|
-
normalizeClassString,
|
|
19
|
-
resolve
|
|
20
|
-
} from "./chunk-G76344ZQ.mjs";
|
|
21
|
-
|
|
22
|
-
// src/jsx-runtime.tsx
|
|
23
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
24
|
-
import { Fragment } from "react";
|
|
25
|
-
|
|
26
|
-
// src/DarkWrapper.tsx
|
|
27
|
-
import React from "react";
|
|
28
|
-
var DarkWrapper = React.forwardRef(
|
|
29
|
-
function DarkWrapper2({ Component, resolvedStyle, style: styleProp, children, ...rest }, ref) {
|
|
30
|
-
const isDark = useGlobalDarkMode();
|
|
31
|
-
const needsWidth = hasResponsiveBuckets(resolvedStyle);
|
|
32
|
-
const width = useConditionalWidth(needsWidth);
|
|
33
|
-
const breakpoints = needsWidth ? getActiveBreakpoints(width) : EMPTY_BREAKPOINTS;
|
|
34
|
-
const computedStyle = flatten(resolvedStyle, isDark, {}, breakpoints);
|
|
35
|
-
stripInternalMarkers(computedStyle);
|
|
36
|
-
if (typeof Component !== "string") stripWebOnlyProps(computedStyle);
|
|
37
|
-
const isWebHTMLElement = !isNative && typeof Component === "string";
|
|
38
|
-
const finalStyle = isWebHTMLElement ? styleProp ?? void 0 : styleProp ? Array.isArray(styleProp) ? Object.assign({}, computedStyle, ...styleProp) : { ...computedStyle, ...styleProp } : computedStyle;
|
|
39
|
-
const props = { ref, ...rest, style: finalStyle };
|
|
40
|
-
return Array.isArray(children) ? React.createElement(Component, props, ...children) : React.createElement(Component, props, children);
|
|
41
|
-
}
|
|
42
|
-
);
|
|
43
|
-
DarkWrapper.displayName = "Kbach.DarkWrapper";
|
|
44
|
-
function stripInternalMarkers(s) {
|
|
45
|
-
delete s.__divideX;
|
|
46
|
-
delete s.__divideY;
|
|
47
|
-
delete s.__divideColor;
|
|
48
|
-
delete s.__divideStyle;
|
|
49
|
-
delete s.__keyframe;
|
|
50
|
-
}
|
|
51
|
-
function stripWebOnlyProps(s) {
|
|
52
|
-
if (s.display === "grid" || s.display === "inline-grid") delete s.display;
|
|
53
|
-
delete s.gridTemplateColumns;
|
|
54
|
-
delete s.gridTemplateRows;
|
|
55
|
-
delete s.gridColumn;
|
|
56
|
-
delete s.gridRow;
|
|
57
|
-
delete s.gridArea;
|
|
58
|
-
delete s.gridColumnStart;
|
|
59
|
-
delete s.gridColumnEnd;
|
|
60
|
-
delete s.gridRowStart;
|
|
61
|
-
delete s.gridRowEnd;
|
|
62
|
-
delete s.gridAutoFlow;
|
|
63
|
-
delete s.gridAutoColumns;
|
|
64
|
-
delete s.gridAutoRows;
|
|
65
|
-
delete s.placeItems;
|
|
66
|
-
delete s.placeContent;
|
|
67
|
-
delete s.justifyItems;
|
|
68
|
-
delete s.placeSelf;
|
|
69
|
-
delete s.justifySelf;
|
|
70
|
-
if (s.position === "sticky" || s.position === "fixed" || s.position === "static") {
|
|
71
|
-
delete s.position;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
// src/jsx-runtime.tsx
|
|
76
|
-
var _cachedDefaultFont = void 0;
|
|
77
|
-
var _defaultFontVersion = 0;
|
|
78
|
-
var _lastFontVersion = -1;
|
|
79
|
-
function _invalidateDefaultFontCache() {
|
|
80
|
-
_defaultFontVersion++;
|
|
81
|
-
}
|
|
82
|
-
function getCachedDefaultFont() {
|
|
83
|
-
if (_lastFontVersion !== _defaultFontVersion) {
|
|
84
|
-
_cachedDefaultFont = getDefaultFontFamily();
|
|
85
|
-
_lastFontVersion = _defaultFontVersion;
|
|
86
|
-
}
|
|
87
|
-
return _cachedDefaultFont;
|
|
88
|
-
}
|
|
89
|
-
var _bucketModsCache = /* @__PURE__ */ new WeakMap();
|
|
90
|
-
function bucketMods(resolved) {
|
|
91
|
-
const cached = _bucketModsCache.get(resolved);
|
|
92
|
-
if (cached) return cached;
|
|
93
|
-
const interactiveMods = getInteractiveModifiers();
|
|
94
|
-
const modeMods = getModeModifiers();
|
|
95
|
-
const responsiveMods = getResponsiveModifiers();
|
|
96
|
-
let interactive = false;
|
|
97
|
-
let modeOrResponsive = false;
|
|
98
|
-
for (const key of Object.keys(resolved)) {
|
|
99
|
-
if (key === "base") continue;
|
|
100
|
-
for (const mod of key.split(":")) {
|
|
101
|
-
if (!interactive && interactiveMods.has(mod)) interactive = true;
|
|
102
|
-
if (!modeOrResponsive && (modeMods.has(mod) || responsiveMods.has(mod))) modeOrResponsive = true;
|
|
103
|
-
}
|
|
104
|
-
if (interactive && modeOrResponsive) break;
|
|
105
|
-
}
|
|
106
|
-
const result = { interactive, modeOrResponsive };
|
|
107
|
-
_bucketModsCache.set(resolved, result);
|
|
108
|
-
return result;
|
|
109
|
-
}
|
|
110
|
-
var CONSUMED_PROPS = /* @__PURE__ */ new Set(["className", "kb", "__kbachStyles", "__kbachClasses"]);
|
|
111
|
-
function omitConsumed(props) {
|
|
112
|
-
const out = {};
|
|
113
|
-
for (const key of Object.keys(props)) {
|
|
114
|
-
if (!CONSUMED_PROPS.has(key)) out[key] = props[key];
|
|
115
|
-
}
|
|
116
|
-
return out;
|
|
117
|
-
}
|
|
118
|
-
function mergeStyle(computed, userStyle) {
|
|
119
|
-
if (!userStyle) return computed;
|
|
120
|
-
if (Array.isArray(userStyle)) return Object.assign({}, computed, ...userStyle);
|
|
121
|
-
return { ...computed, ...userStyle };
|
|
122
|
-
}
|
|
123
|
-
function makeElement(isStaticChildren, type, props, key) {
|
|
124
|
-
return (isStaticChildren ? _jsxs : _jsx)(type, props, key);
|
|
125
|
-
}
|
|
126
|
-
function stripInternalMarkers2(s) {
|
|
127
|
-
delete s.__divideX;
|
|
128
|
-
delete s.__divideY;
|
|
129
|
-
delete s.__divideColor;
|
|
130
|
-
delete s.__divideStyle;
|
|
131
|
-
delete s.__keyframe;
|
|
132
|
-
}
|
|
133
|
-
function stripWebOnlyInlineProps(s) {
|
|
134
|
-
if (s.display === "grid" || s.display === "inline-grid") delete s.display;
|
|
135
|
-
delete s.gridTemplateColumns;
|
|
136
|
-
delete s.gridTemplateRows;
|
|
137
|
-
delete s.gridColumn;
|
|
138
|
-
delete s.gridRow;
|
|
139
|
-
delete s.gridArea;
|
|
140
|
-
delete s.gridColumnStart;
|
|
141
|
-
delete s.gridColumnEnd;
|
|
142
|
-
delete s.gridRowStart;
|
|
143
|
-
delete s.gridRowEnd;
|
|
144
|
-
delete s.gridAutoFlow;
|
|
145
|
-
delete s.gridAutoColumns;
|
|
146
|
-
delete s.gridAutoRows;
|
|
147
|
-
delete s.placeItems;
|
|
148
|
-
delete s.placeContent;
|
|
149
|
-
delete s.justifyItems;
|
|
150
|
-
delete s.placeSelf;
|
|
151
|
-
delete s.justifySelf;
|
|
152
|
-
if (s.position === "sticky" || s.position === "fixed" || s.position === "static") {
|
|
153
|
-
delete s.position;
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
function processElement(type, rawProps, key, isStaticChildren) {
|
|
157
|
-
if (typeof type === "symbol") return makeElement(isStaticChildren, type, rawProps ?? {}, key);
|
|
158
|
-
if (!rawProps) return _jsx(type, null, key);
|
|
159
|
-
const { className, kb: kbProp, __kbachStyles, __kbachClasses } = rawProps;
|
|
160
|
-
const classStr = className ?? kbProp ?? __kbachClasses;
|
|
161
|
-
if (!isNative && isRuntimeCSSDisabled() && classStr && !__kbachStyles) {
|
|
162
|
-
const { style: userStyle2, ...passProps2 } = omitConsumed(rawProps);
|
|
163
|
-
return makeElement(isStaticChildren, type, {
|
|
164
|
-
...passProps2,
|
|
165
|
-
className: normalizeClassString(classStr),
|
|
166
|
-
...userStyle2 !== void 0 ? { style: userStyle2 } : {}
|
|
167
|
-
}, key);
|
|
168
|
-
}
|
|
169
|
-
if (!classStr && !__kbachStyles) {
|
|
170
|
-
const defaultFont = getCachedDefaultFont();
|
|
171
|
-
if (!defaultFont) return makeElement(isStaticChildren, type, rawProps, key);
|
|
172
|
-
const { style: userStyle2, ...passProps2 } = omitConsumed(rawProps);
|
|
173
|
-
const finalStyle2 = userStyle2 ? Array.isArray(userStyle2) ? { fontFamily: defaultFont, ...Object.assign({}, ...userStyle2) } : { fontFamily: defaultFont, ...userStyle2 } : { fontFamily: defaultFont };
|
|
174
|
-
return makeElement(isStaticChildren, type, { ...passProps2, style: finalStyle2 }, key);
|
|
175
|
-
}
|
|
176
|
-
const config = getConfig();
|
|
177
|
-
const resolved = __kbachStyles ?? (classStr ? resolve(classStr, config.theme, config.darkMode) : {});
|
|
178
|
-
const { style: userStyle, ...passProps } = omitConsumed(rawProps);
|
|
179
|
-
const { interactive, modeOrResponsive } = bucketMods(resolved);
|
|
180
|
-
if (interactive) {
|
|
181
|
-
return _jsx(InteractiveWrapper, {
|
|
182
|
-
Component: type,
|
|
183
|
-
resolvedStyle: resolved,
|
|
184
|
-
...!isNative && classStr ? { className: normalizeClassString(classStr) } : {},
|
|
185
|
-
style: userStyle,
|
|
186
|
-
...passProps
|
|
187
|
-
}, key);
|
|
188
|
-
}
|
|
189
|
-
if (modeOrResponsive) {
|
|
190
|
-
return _jsx(DarkWrapper, {
|
|
191
|
-
Component: type,
|
|
192
|
-
resolvedStyle: resolved,
|
|
193
|
-
...!isNative && classStr ? { className: normalizeClassString(classStr) } : {},
|
|
194
|
-
style: userStyle,
|
|
195
|
-
...passProps
|
|
196
|
-
}, key);
|
|
197
|
-
}
|
|
198
|
-
const isWebHTMLElement = !isNative && typeof type === "string";
|
|
199
|
-
let finalStyle;
|
|
200
|
-
if (!isWebHTMLElement) {
|
|
201
|
-
const computedStyle = flatten(resolved, false);
|
|
202
|
-
stripInternalMarkers2(computedStyle);
|
|
203
|
-
if (typeof type !== "string") stripWebOnlyInlineProps(computedStyle);
|
|
204
|
-
finalStyle = mergeStyle(computedStyle, userStyle);
|
|
205
|
-
} else {
|
|
206
|
-
finalStyle = userStyle ?? void 0;
|
|
207
|
-
}
|
|
208
|
-
return makeElement(isStaticChildren, type, {
|
|
209
|
-
...passProps,
|
|
210
|
-
style: finalStyle,
|
|
211
|
-
...!isNative && classStr ? { className: normalizeClassString(classStr) } : {}
|
|
212
|
-
}, key);
|
|
213
|
-
}
|
|
214
|
-
function jsx(type, props, key) {
|
|
215
|
-
return processElement(type, props, key, false);
|
|
216
|
-
}
|
|
217
|
-
function jsxs(type, props, key) {
|
|
218
|
-
return processElement(type, props, key, true);
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
export {
|
|
222
|
-
Fragment,
|
|
223
|
-
_invalidateDefaultFontCache,
|
|
224
|
-
jsx,
|
|
225
|
-
jsxs
|
|
226
|
-
};
|