@kbach/react 0.6.29 → 0.6.31
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-S6AHQ5M6.mjs → chunk-MOWXWICC.mjs} +20 -12
- package/dist/{chunk-TKBIGAR2.mjs → chunk-OIJ6RP4F.mjs} +1369 -1297
- package/dist/core/index.d.ts +40 -3
- package/dist/core/index.js +1465 -1391
- package/dist/index.d.ts +1 -1
- package/dist/index.js +16 -11
- package/dist/index.mjs +18 -12
- package/dist/jsx-dev-runtime.js +18 -11
- package/dist/jsx-dev-runtime.mjs +2 -2
- package/dist/jsx-runtime.js +18 -11
- package/dist/jsx-runtime.mjs +2 -2
- package/dist/vite-plugin.d.mts +11 -2
- package/dist/vite-plugin.d.ts +11 -2
- package/dist/vite-plugin.js +80 -10
- package/dist/vite-plugin.mjs +80 -10
- package/kbach-react.md +23 -0
- package/package.json +1 -1
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
EMPTY_BREAKPOINTS,
|
|
4
4
|
InteractiveWrapper,
|
|
5
|
+
expandModeAwareColorClasses,
|
|
5
6
|
flatten,
|
|
6
7
|
getActiveBreakpoints,
|
|
7
8
|
getConfig,
|
|
@@ -24,7 +25,7 @@ import {
|
|
|
24
25
|
transformToWebProps,
|
|
25
26
|
useConditionalGlobalDarkMode,
|
|
26
27
|
useConditionalWidth
|
|
27
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-OIJ6RP4F.mjs";
|
|
28
29
|
|
|
29
30
|
// src/jsx-runtime.tsx
|
|
30
31
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -111,10 +112,16 @@ function mergeStyle(computed, userStyle) {
|
|
|
111
112
|
return { ...computed, ...userStyle };
|
|
112
113
|
}
|
|
113
114
|
function withImpliedFlexIfNeeded(webTag, resolvedBase, userStyle) {
|
|
114
|
-
if (!webTag || !resolvedBase
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
115
|
+
if (!webTag || !resolvedBase) return userStyle;
|
|
116
|
+
const explicitDisplay = resolvedBase.display;
|
|
117
|
+
const hasFlexItemProps = "flexGrow" in resolvedBase || "flexShrink" in resolvedBase || "flex" in resolvedBase;
|
|
118
|
+
const willBeFlex = explicitDisplay === "flex" || explicitDisplay === void 0 && hasFlexItemProps;
|
|
119
|
+
if (!willBeFlex) return userStyle;
|
|
120
|
+
const compensation = {};
|
|
121
|
+
if (explicitDisplay === void 0) compensation.display = "flex";
|
|
122
|
+
if (resolvedBase.flexDirection === void 0) compensation.flexDirection = "column";
|
|
123
|
+
if (Object.keys(compensation).length === 0) return userStyle;
|
|
124
|
+
return Array.isArray(userStyle) ? [compensation, ...userStyle] : { ...compensation, ...userStyle };
|
|
118
125
|
}
|
|
119
126
|
function makeElement(isStaticChildren, type, props, key) {
|
|
120
127
|
return (isStaticChildren ? _jsxs : _jsx)(type, props, key);
|
|
@@ -132,11 +139,13 @@ function processElement(type, rawProps, key, isStaticChildren) {
|
|
|
132
139
|
return makeElement(isStaticChildren, effectiveType, workingProps, key);
|
|
133
140
|
}
|
|
134
141
|
const classStr = classStrRaw;
|
|
135
|
-
|
|
142
|
+
const config = getConfig();
|
|
143
|
+
const expandedClassStr = classStr ? expandModeAwareColorClasses(classStr, config.theme.colors) : classStr;
|
|
144
|
+
if (!isNative && isRuntimeCSSDisabled() && expandedClassStr && !__kbachStyles) {
|
|
136
145
|
const { style: userStyle2, ...passProps2 } = omitConsumed(workingProps);
|
|
137
146
|
return makeElement(isStaticChildren, effectiveType, {
|
|
138
147
|
...passProps2,
|
|
139
|
-
className: normalizeClassString(
|
|
148
|
+
className: normalizeClassString(expandedClassStr),
|
|
140
149
|
...userStyle2 !== void 0 ? { style: userStyle2 } : {}
|
|
141
150
|
}, key);
|
|
142
151
|
}
|
|
@@ -156,8 +165,7 @@ function processElement(type, rawProps, key, isStaticChildren) {
|
|
|
156
165
|
const finalStyle2 = userStyle2 ? Array.isArray(userStyle2) ? { fontFamily: defaultFont, ...Object.assign({}, ...userStyle2) } : { fontFamily: defaultFont, ...userStyle2 } : { fontFamily: defaultFont };
|
|
157
166
|
return makeElement(isStaticChildren, effectiveType, { ...passProps2, style: finalStyle2 }, key);
|
|
158
167
|
}
|
|
159
|
-
const
|
|
160
|
-
const resolved = !isWeb && __kbachStyles != null ? __kbachStyles : classStr ? resolve(classStr, config.theme, config.darkMode) : {};
|
|
168
|
+
const resolved = !isWeb && __kbachStyles != null ? __kbachStyles : expandedClassStr ? resolve(expandedClassStr, config.theme, config.darkMode) : {};
|
|
161
169
|
const { style: rawUserStyle, ...passProps } = omitConsumed(workingProps);
|
|
162
170
|
const userStyle = withImpliedFlexIfNeeded(webTag, resolved.base, rawUserStyle);
|
|
163
171
|
const { interactive, modeOrResponsive } = bucketMods(resolved);
|
|
@@ -165,7 +173,7 @@ function processElement(type, rawProps, key, isStaticChildren) {
|
|
|
165
173
|
return _jsx(InteractiveWrapper, {
|
|
166
174
|
Component: effectiveType,
|
|
167
175
|
resolvedStyle: resolved,
|
|
168
|
-
...!isNative &&
|
|
176
|
+
...!isNative && expandedClassStr ? { className: normalizeClassString(expandedClassStr) } : {},
|
|
169
177
|
style: userStyle,
|
|
170
178
|
...passProps
|
|
171
179
|
}, key);
|
|
@@ -174,7 +182,7 @@ function processElement(type, rawProps, key, isStaticChildren) {
|
|
|
174
182
|
return _jsx(DarkWrapper, {
|
|
175
183
|
Component: effectiveType,
|
|
176
184
|
resolvedStyle: resolved,
|
|
177
|
-
...!isNative &&
|
|
185
|
+
...!isNative && expandedClassStr ? { className: normalizeClassString(expandedClassStr) } : {},
|
|
178
186
|
style: userStyle,
|
|
179
187
|
...passProps
|
|
180
188
|
}, key);
|
|
@@ -192,7 +200,7 @@ function processElement(type, rawProps, key, isStaticChildren) {
|
|
|
192
200
|
return makeElement(isStaticChildren, effectiveType, {
|
|
193
201
|
...passProps,
|
|
194
202
|
...finalStyle !== void 0 ? { style: finalStyle } : {},
|
|
195
|
-
...!isNative &&
|
|
203
|
+
...!isNative && expandedClassStr ? { className: normalizeClassString(expandedClassStr) } : {}
|
|
196
204
|
}, key);
|
|
197
205
|
}
|
|
198
206
|
function jsx(type, props, key) {
|