@kbach/react 0.6.39 → 0.6.41
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-Z4ZOGRZG.mjs → chunk-LM3OWOK2.mjs} +13 -18
- package/dist/{chunk-NE4LAJXK.mjs → chunk-PTOTQ6A2.mjs} +162 -106
- package/dist/core/index.d.ts +17 -9
- package/dist/core/index.js +138 -94
- package/dist/index.js +40 -26
- package/dist/index.mjs +27 -15
- package/dist/jsx-dev-runtime.js +28 -28
- package/dist/jsx-dev-runtime.mjs +2 -2
- package/dist/jsx-runtime.js +28 -28
- package/dist/jsx-runtime.mjs +2 -2
- package/dist/vite-plugin.d.mts +18 -1
- package/dist/vite-plugin.d.ts +18 -1
- package/dist/vite-plugin.js +121 -87
- package/dist/vite-plugin.mjs +120 -87
- package/package.json +6 -1
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
EMPTY_BREAKPOINTS,
|
|
4
4
|
InteractiveWrapper,
|
|
5
|
+
composeNativeStyle,
|
|
5
6
|
expandModeAwareColorClasses,
|
|
6
7
|
flatten,
|
|
7
8
|
getActiveBreakpoints,
|
|
@@ -9,7 +10,7 @@ import {
|
|
|
9
10
|
getDefaultFontFamily,
|
|
10
11
|
getEffectiveIsWeb,
|
|
11
12
|
getGlobalScreens,
|
|
12
|
-
|
|
13
|
+
getImpliedRNClasses,
|
|
13
14
|
getInteractiveModifiers,
|
|
14
15
|
getModeModifiers,
|
|
15
16
|
getResponsiveModifiers,
|
|
@@ -17,7 +18,6 @@ import {
|
|
|
17
18
|
hasResponsiveBuckets,
|
|
18
19
|
isNative,
|
|
19
20
|
isRuntimeCSSDisabled,
|
|
20
|
-
isWeb,
|
|
21
21
|
normalizeClassString,
|
|
22
22
|
onConfigChange,
|
|
23
23
|
resolve,
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
transformToWebProps,
|
|
27
27
|
useConditionalGlobalDarkMode,
|
|
28
28
|
useConditionalWidth
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-PTOTQ6A2.mjs";
|
|
30
30
|
|
|
31
31
|
// src/jsx-runtime.tsx
|
|
32
32
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -51,7 +51,7 @@ var DarkWrapper = React.forwardRef(
|
|
|
51
51
|
return s;
|
|
52
52
|
}, [resolvedStyle, isDark, width, screens, isNonStringComponent]);
|
|
53
53
|
const skipComputedInline = isWebPlatform;
|
|
54
|
-
const finalStyle = skipComputedInline ? styleProp ?? void 0 :
|
|
54
|
+
const finalStyle = skipComputedInline ? styleProp ?? void 0 : composeNativeStyle(computedStyle, styleProp);
|
|
55
55
|
const props = { ref, ...rest, style: finalStyle };
|
|
56
56
|
return Array.isArray(children) ? React.createElement(Component, props, ...children) : React.createElement(Component, props, children);
|
|
57
57
|
}
|
|
@@ -107,15 +107,6 @@ function omitConsumed(props) {
|
|
|
107
107
|
}
|
|
108
108
|
return out;
|
|
109
109
|
}
|
|
110
|
-
function mergeStyle(computed, userStyle) {
|
|
111
|
-
if (!userStyle) return computed;
|
|
112
|
-
return Array.isArray(userStyle) ? [computed, ...userStyle] : [computed, userStyle];
|
|
113
|
-
}
|
|
114
|
-
function withImpliedRNStyleIfNeeded(webTag, resolvedBase, userStyle) {
|
|
115
|
-
const compensation = getImpliedRNStyle(webTag, resolvedBase);
|
|
116
|
-
if (!compensation) return userStyle;
|
|
117
|
-
return Array.isArray(userStyle) ? [compensation, ...userStyle] : { ...compensation, ...userStyle };
|
|
118
|
-
}
|
|
119
110
|
function makeElement(isStaticChildren, type, props, key) {
|
|
120
111
|
return (isStaticChildren ? _jsxs : _jsx)(type, props, key);
|
|
121
112
|
}
|
|
@@ -133,7 +124,7 @@ function processElement(type, rawProps, key, isStaticChildren) {
|
|
|
133
124
|
}
|
|
134
125
|
const classStr = classStrRaw;
|
|
135
126
|
const config = getConfig();
|
|
136
|
-
|
|
127
|
+
let expandedClassStr = classStr ? expandModeAwareColorClasses(classStr, config.theme.colors) : classStr;
|
|
137
128
|
if (!isNative && isRuntimeCSSDisabled() && expandedClassStr && !__kbachStyles) {
|
|
138
129
|
const { style: userStyle2, ...passProps2 } = omitConsumed(workingProps);
|
|
139
130
|
return makeElement(isStaticChildren, effectiveType, {
|
|
@@ -158,9 +149,13 @@ function processElement(type, rawProps, key, isStaticChildren) {
|
|
|
158
149
|
const finalStyle2 = userStyle2 ? Array.isArray(userStyle2) ? { fontFamily: defaultFont, ...Object.assign({}, ...userStyle2) } : { fontFamily: defaultFont, ...userStyle2 } : { fontFamily: defaultFont };
|
|
159
150
|
return makeElement(isStaticChildren, effectiveType, { ...passProps2, style: finalStyle2 }, key);
|
|
160
151
|
}
|
|
161
|
-
|
|
162
|
-
const
|
|
163
|
-
|
|
152
|
+
let resolved = isNative && __kbachStyles != null ? __kbachStyles : expandedClassStr ? resolve(expandedClassStr, config.theme, config.darkMode) : {};
|
|
153
|
+
const impliedClasses = getImpliedRNClasses(webTag, resolved.base);
|
|
154
|
+
if (impliedClasses) {
|
|
155
|
+
expandedClassStr = expandedClassStr ? `${expandedClassStr} ${impliedClasses}` : impliedClasses;
|
|
156
|
+
resolved = resolve(expandedClassStr, config.theme, config.darkMode);
|
|
157
|
+
}
|
|
158
|
+
const { style: userStyle, ...passProps } = omitConsumed(workingProps);
|
|
164
159
|
const { interactive, modeOrResponsive } = bucketMods(resolved);
|
|
165
160
|
if (interactive) {
|
|
166
161
|
return _jsx(InteractiveWrapper, {
|
|
@@ -186,7 +181,7 @@ function processElement(type, rawProps, key, isStaticChildren) {
|
|
|
186
181
|
const computedStyle = flatten(resolved, false);
|
|
187
182
|
stripInternalMarkers(computedStyle);
|
|
188
183
|
if (typeof effectiveType !== "string") stripWebOnlyProps(computedStyle);
|
|
189
|
-
finalStyle =
|
|
184
|
+
finalStyle = composeNativeStyle(computedStyle, userStyle);
|
|
190
185
|
} else {
|
|
191
186
|
finalStyle = userStyle ?? void 0;
|
|
192
187
|
}
|