@kbach/react 0.5.17 → 0.5.18
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-SHQPNCQ7.mjs → chunk-SOBLKZGE.mjs} +18 -6
- package/dist/{chunk-HTPCUYNH.mjs → chunk-VZD4672I.mjs} +2 -2
- package/dist/{chunk-RMZIFMWE.mjs → chunk-X6FH5QTD.mjs} +1 -1
- package/dist/index.js +18 -6
- package/dist/index.mjs +2 -2
- package/dist/jsx-dev-runtime.js +18 -6
- package/dist/jsx-dev-runtime.mjs +3 -3
- package/dist/jsx-runtime.js +18 -6
- package/dist/jsx-runtime.mjs +3 -3
- package/dist/vite-plugin.js +27 -11
- package/dist/vite-plugin.mjs +10 -6
- package/package.json +1 -1
|
@@ -3222,11 +3222,16 @@ var CSS_UNITLESS = /* @__PURE__ */ new Set([
|
|
|
3222
3222
|
"gridRowStart",
|
|
3223
3223
|
"gridRowEnd"
|
|
3224
3224
|
]);
|
|
3225
|
+
var RN_SHORTHAND_EXPAND = {
|
|
3226
|
+
marginHorizontal: ["margin-left", "margin-right"],
|
|
3227
|
+
marginVertical: ["margin-top", "margin-bottom"],
|
|
3228
|
+
paddingHorizontal: ["padding-left", "padding-right"],
|
|
3229
|
+
paddingVertical: ["padding-top", "padding-bottom"]
|
|
3230
|
+
};
|
|
3225
3231
|
function styleValueToCSS(styles, forceImportant = false) {
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
const cssProp = camelToKebab(prop);
|
|
3232
|
+
const parts = [];
|
|
3233
|
+
for (const [prop, val] of Object.entries(styles)) {
|
|
3234
|
+
if (val === void 0 || val === null || typeof val === "object" || RN_ONLY_PROPS.has(prop)) continue;
|
|
3230
3235
|
let cssVal;
|
|
3231
3236
|
if (typeof val === "number") {
|
|
3232
3237
|
cssVal = val === 0 || CSS_UNITLESS.has(prop) ? String(val) : `${val}px`;
|
|
@@ -3234,8 +3239,15 @@ function styleValueToCSS(styles, forceImportant = false) {
|
|
|
3234
3239
|
cssVal = String(val);
|
|
3235
3240
|
}
|
|
3236
3241
|
const imp = forceImportant || prop === "display" && (cssVal === "grid" || cssVal === "inline-grid") || prop === "position" && (cssVal === "sticky" || cssVal === "fixed" || cssVal === "static") ? " !important" : "";
|
|
3237
|
-
|
|
3238
|
-
|
|
3242
|
+
if (prop in RN_SHORTHAND_EXPAND) {
|
|
3243
|
+
const [p1, p2] = RN_SHORTHAND_EXPAND[prop];
|
|
3244
|
+
parts.push(`${p1}: ${cssVal}${imp}`);
|
|
3245
|
+
parts.push(`${p2}: ${cssVal}${imp}`);
|
|
3246
|
+
continue;
|
|
3247
|
+
}
|
|
3248
|
+
parts.push(`${camelToKebab(prop)}: ${cssVal}${imp}`);
|
|
3249
|
+
}
|
|
3250
|
+
return parts.join("; ");
|
|
3239
3251
|
}
|
|
3240
3252
|
function camelToKebab(str) {
|
|
3241
3253
|
return str.replace(/([A-Z])/g, "-$1").toLowerCase();
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
InteractiveWrapper,
|
|
4
4
|
useConditionalWidth,
|
|
5
5
|
useGlobalDarkMode
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-X6FH5QTD.mjs";
|
|
7
7
|
import {
|
|
8
8
|
flatten,
|
|
9
9
|
getActiveBreakpoints,
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
getDefaultFontFamily,
|
|
12
12
|
isWeb,
|
|
13
13
|
resolve
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-SOBLKZGE.mjs";
|
|
15
15
|
|
|
16
16
|
// src/jsx-runtime.tsx
|
|
17
17
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
package/dist/index.js
CHANGED
|
@@ -3342,11 +3342,16 @@ var CSS_UNITLESS = /* @__PURE__ */ new Set([
|
|
|
3342
3342
|
"gridRowStart",
|
|
3343
3343
|
"gridRowEnd"
|
|
3344
3344
|
]);
|
|
3345
|
+
var RN_SHORTHAND_EXPAND = {
|
|
3346
|
+
marginHorizontal: ["margin-left", "margin-right"],
|
|
3347
|
+
marginVertical: ["margin-top", "margin-bottom"],
|
|
3348
|
+
paddingHorizontal: ["padding-left", "padding-right"],
|
|
3349
|
+
paddingVertical: ["padding-top", "padding-bottom"]
|
|
3350
|
+
};
|
|
3345
3351
|
function styleValueToCSS(styles, forceImportant = false) {
|
|
3346
|
-
|
|
3347
|
-
|
|
3348
|
-
|
|
3349
|
-
const cssProp = camelToKebab(prop);
|
|
3352
|
+
const parts = [];
|
|
3353
|
+
for (const [prop, val] of Object.entries(styles)) {
|
|
3354
|
+
if (val === void 0 || val === null || typeof val === "object" || RN_ONLY_PROPS.has(prop)) continue;
|
|
3350
3355
|
let cssVal;
|
|
3351
3356
|
if (typeof val === "number") {
|
|
3352
3357
|
cssVal = val === 0 || CSS_UNITLESS.has(prop) ? String(val) : `${val}px`;
|
|
@@ -3354,8 +3359,15 @@ function styleValueToCSS(styles, forceImportant = false) {
|
|
|
3354
3359
|
cssVal = String(val);
|
|
3355
3360
|
}
|
|
3356
3361
|
const imp = forceImportant || prop === "display" && (cssVal === "grid" || cssVal === "inline-grid") || prop === "position" && (cssVal === "sticky" || cssVal === "fixed" || cssVal === "static") ? " !important" : "";
|
|
3357
|
-
|
|
3358
|
-
|
|
3362
|
+
if (prop in RN_SHORTHAND_EXPAND) {
|
|
3363
|
+
const [p1, p2] = RN_SHORTHAND_EXPAND[prop];
|
|
3364
|
+
parts.push(`${p1}: ${cssVal}${imp}`);
|
|
3365
|
+
parts.push(`${p2}: ${cssVal}${imp}`);
|
|
3366
|
+
continue;
|
|
3367
|
+
}
|
|
3368
|
+
parts.push(`${camelToKebab(prop)}: ${cssVal}${imp}`);
|
|
3369
|
+
}
|
|
3370
|
+
return parts.join("; ");
|
|
3359
3371
|
}
|
|
3360
3372
|
function camelToKebab(str) {
|
|
3361
3373
|
return str.replace(/([A-Z])/g, "-$1").toLowerCase();
|
package/dist/index.mjs
CHANGED
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
useConditionalWidth,
|
|
7
7
|
useGlobalDarkMode,
|
|
8
8
|
useGlobalWidth
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-X6FH5QTD.mjs";
|
|
10
10
|
import {
|
|
11
11
|
__require,
|
|
12
12
|
buildConfig,
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
syncGlobalScreens,
|
|
26
26
|
syncGlobalWidth,
|
|
27
27
|
updateConfig
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-SOBLKZGE.mjs";
|
|
29
29
|
|
|
30
30
|
// src/context.tsx
|
|
31
31
|
import { createContext, useContext } from "react";
|
package/dist/jsx-dev-runtime.js
CHANGED
|
@@ -3234,11 +3234,16 @@ var CSS_UNITLESS = /* @__PURE__ */ new Set([
|
|
|
3234
3234
|
"gridRowStart",
|
|
3235
3235
|
"gridRowEnd"
|
|
3236
3236
|
]);
|
|
3237
|
+
var RN_SHORTHAND_EXPAND = {
|
|
3238
|
+
marginHorizontal: ["margin-left", "margin-right"],
|
|
3239
|
+
marginVertical: ["margin-top", "margin-bottom"],
|
|
3240
|
+
paddingHorizontal: ["padding-left", "padding-right"],
|
|
3241
|
+
paddingVertical: ["padding-top", "padding-bottom"]
|
|
3242
|
+
};
|
|
3237
3243
|
function styleValueToCSS(styles, forceImportant = false) {
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
const cssProp = camelToKebab(prop);
|
|
3244
|
+
const parts = [];
|
|
3245
|
+
for (const [prop, val] of Object.entries(styles)) {
|
|
3246
|
+
if (val === void 0 || val === null || typeof val === "object" || RN_ONLY_PROPS.has(prop)) continue;
|
|
3242
3247
|
let cssVal;
|
|
3243
3248
|
if (typeof val === "number") {
|
|
3244
3249
|
cssVal = val === 0 || CSS_UNITLESS.has(prop) ? String(val) : `${val}px`;
|
|
@@ -3246,8 +3251,15 @@ function styleValueToCSS(styles, forceImportant = false) {
|
|
|
3246
3251
|
cssVal = String(val);
|
|
3247
3252
|
}
|
|
3248
3253
|
const imp = forceImportant || prop === "display" && (cssVal === "grid" || cssVal === "inline-grid") || prop === "position" && (cssVal === "sticky" || cssVal === "fixed" || cssVal === "static") ? " !important" : "";
|
|
3249
|
-
|
|
3250
|
-
|
|
3254
|
+
if (prop in RN_SHORTHAND_EXPAND) {
|
|
3255
|
+
const [p1, p2] = RN_SHORTHAND_EXPAND[prop];
|
|
3256
|
+
parts.push(`${p1}: ${cssVal}${imp}`);
|
|
3257
|
+
parts.push(`${p2}: ${cssVal}${imp}`);
|
|
3258
|
+
continue;
|
|
3259
|
+
}
|
|
3260
|
+
parts.push(`${camelToKebab(prop)}: ${cssVal}${imp}`);
|
|
3261
|
+
}
|
|
3262
|
+
return parts.join("; ");
|
|
3251
3263
|
}
|
|
3252
3264
|
function camelToKebab(str) {
|
|
3253
3265
|
return str.replace(/([A-Z])/g, "-$1").toLowerCase();
|
package/dist/jsx-dev-runtime.mjs
CHANGED
|
@@ -2,9 +2,9 @@ import {
|
|
|
2
2
|
Fragment,
|
|
3
3
|
jsx,
|
|
4
4
|
jsxs
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-VZD4672I.mjs";
|
|
6
|
+
import "./chunk-X6FH5QTD.mjs";
|
|
7
|
+
import "./chunk-SOBLKZGE.mjs";
|
|
8
8
|
|
|
9
9
|
// src/jsx-dev-runtime.tsx
|
|
10
10
|
function jsxDEV(type, props, key, isStaticChildren, _source, _self) {
|
package/dist/jsx-runtime.js
CHANGED
|
@@ -3233,11 +3233,16 @@ var CSS_UNITLESS = /* @__PURE__ */ new Set([
|
|
|
3233
3233
|
"gridRowStart",
|
|
3234
3234
|
"gridRowEnd"
|
|
3235
3235
|
]);
|
|
3236
|
+
var RN_SHORTHAND_EXPAND = {
|
|
3237
|
+
marginHorizontal: ["margin-left", "margin-right"],
|
|
3238
|
+
marginVertical: ["margin-top", "margin-bottom"],
|
|
3239
|
+
paddingHorizontal: ["padding-left", "padding-right"],
|
|
3240
|
+
paddingVertical: ["padding-top", "padding-bottom"]
|
|
3241
|
+
};
|
|
3236
3242
|
function styleValueToCSS(styles, forceImportant = false) {
|
|
3237
|
-
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
const cssProp = camelToKebab(prop);
|
|
3243
|
+
const parts = [];
|
|
3244
|
+
for (const [prop, val] of Object.entries(styles)) {
|
|
3245
|
+
if (val === void 0 || val === null || typeof val === "object" || RN_ONLY_PROPS.has(prop)) continue;
|
|
3241
3246
|
let cssVal;
|
|
3242
3247
|
if (typeof val === "number") {
|
|
3243
3248
|
cssVal = val === 0 || CSS_UNITLESS.has(prop) ? String(val) : `${val}px`;
|
|
@@ -3245,8 +3250,15 @@ function styleValueToCSS(styles, forceImportant = false) {
|
|
|
3245
3250
|
cssVal = String(val);
|
|
3246
3251
|
}
|
|
3247
3252
|
const imp = forceImportant || prop === "display" && (cssVal === "grid" || cssVal === "inline-grid") || prop === "position" && (cssVal === "sticky" || cssVal === "fixed" || cssVal === "static") ? " !important" : "";
|
|
3248
|
-
|
|
3249
|
-
|
|
3253
|
+
if (prop in RN_SHORTHAND_EXPAND) {
|
|
3254
|
+
const [p1, p2] = RN_SHORTHAND_EXPAND[prop];
|
|
3255
|
+
parts.push(`${p1}: ${cssVal}${imp}`);
|
|
3256
|
+
parts.push(`${p2}: ${cssVal}${imp}`);
|
|
3257
|
+
continue;
|
|
3258
|
+
}
|
|
3259
|
+
parts.push(`${camelToKebab(prop)}: ${cssVal}${imp}`);
|
|
3260
|
+
}
|
|
3261
|
+
return parts.join("; ");
|
|
3250
3262
|
}
|
|
3251
3263
|
function camelToKebab(str) {
|
|
3252
3264
|
return str.replace(/([A-Z])/g, "-$1").toLowerCase();
|
package/dist/jsx-runtime.mjs
CHANGED
|
@@ -2,9 +2,9 @@ import {
|
|
|
2
2
|
Fragment,
|
|
3
3
|
jsx,
|
|
4
4
|
jsxs
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-VZD4672I.mjs";
|
|
6
|
+
import "./chunk-X6FH5QTD.mjs";
|
|
7
|
+
import "./chunk-SOBLKZGE.mjs";
|
|
8
8
|
export {
|
|
9
9
|
Fragment,
|
|
10
10
|
jsx,
|
package/dist/vite-plugin.js
CHANGED
|
@@ -3183,11 +3183,16 @@ var CSS_UNITLESS = /* @__PURE__ */ new Set([
|
|
|
3183
3183
|
"gridRowStart",
|
|
3184
3184
|
"gridRowEnd"
|
|
3185
3185
|
]);
|
|
3186
|
+
var RN_SHORTHAND_EXPAND = {
|
|
3187
|
+
marginHorizontal: ["margin-left", "margin-right"],
|
|
3188
|
+
marginVertical: ["margin-top", "margin-bottom"],
|
|
3189
|
+
paddingHorizontal: ["padding-left", "padding-right"],
|
|
3190
|
+
paddingVertical: ["padding-top", "padding-bottom"]
|
|
3191
|
+
};
|
|
3186
3192
|
function styleValueToCSS(styles, forceImportant = false) {
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
const cssProp = camelToKebab(prop);
|
|
3193
|
+
const parts = [];
|
|
3194
|
+
for (const [prop, val] of Object.entries(styles)) {
|
|
3195
|
+
if (val === void 0 || val === null || typeof val === "object" || RN_ONLY_PROPS.has(prop)) continue;
|
|
3191
3196
|
let cssVal;
|
|
3192
3197
|
if (typeof val === "number") {
|
|
3193
3198
|
cssVal = val === 0 || CSS_UNITLESS.has(prop) ? String(val) : `${val}px`;
|
|
@@ -3195,8 +3200,15 @@ function styleValueToCSS(styles, forceImportant = false) {
|
|
|
3195
3200
|
cssVal = String(val);
|
|
3196
3201
|
}
|
|
3197
3202
|
const imp = forceImportant || prop === "display" && (cssVal === "grid" || cssVal === "inline-grid") || prop === "position" && (cssVal === "sticky" || cssVal === "fixed" || cssVal === "static") ? " !important" : "";
|
|
3198
|
-
|
|
3199
|
-
|
|
3203
|
+
if (prop in RN_SHORTHAND_EXPAND) {
|
|
3204
|
+
const [p1, p2] = RN_SHORTHAND_EXPAND[prop];
|
|
3205
|
+
parts.push(`${p1}: ${cssVal}${imp}`);
|
|
3206
|
+
parts.push(`${p2}: ${cssVal}${imp}`);
|
|
3207
|
+
continue;
|
|
3208
|
+
}
|
|
3209
|
+
parts.push(`${camelToKebab(prop)}: ${cssVal}${imp}`);
|
|
3210
|
+
}
|
|
3211
|
+
return parts.join("; ");
|
|
3200
3212
|
}
|
|
3201
3213
|
function camelToKebab(str) {
|
|
3202
3214
|
return str.replace(/([A-Z])/g, "-$1").toLowerCase();
|
|
@@ -3382,14 +3394,18 @@ function buildGlobalCSS(theme) {
|
|
|
3382
3394
|
function kbach(userConfig) {
|
|
3383
3395
|
const cfg = buildConfig(userConfig ?? {});
|
|
3384
3396
|
const screens = toNumericScreens(cfg.theme.screens ?? {});
|
|
3385
|
-
const
|
|
3397
|
+
const tokenCSS = /* @__PURE__ */ new Map();
|
|
3386
3398
|
const processedCSSFiles = /* @__PURE__ */ new Set();
|
|
3387
3399
|
let root = process.cwd();
|
|
3388
3400
|
let server = null;
|
|
3389
3401
|
function processClassString(classStr) {
|
|
3390
|
-
|
|
3391
|
-
|
|
3392
|
-
|
|
3402
|
+
let added = false;
|
|
3403
|
+
for (const token of classStr.split(/\s+/).filter(Boolean)) {
|
|
3404
|
+
if (tokenCSS.has(token)) continue;
|
|
3405
|
+
tokenCSS.set(token, generateClassCSS(token, cfg.theme, cfg.darkMode, screens));
|
|
3406
|
+
added = true;
|
|
3407
|
+
}
|
|
3408
|
+
return added;
|
|
3393
3409
|
}
|
|
3394
3410
|
function extractFromCode(code) {
|
|
3395
3411
|
let added = false;
|
|
@@ -3402,7 +3418,7 @@ function kbach(userConfig) {
|
|
|
3402
3418
|
const parts = [];
|
|
3403
3419
|
const global = buildGlobalCSS(cfg.theme);
|
|
3404
3420
|
if (global) parts.push(global);
|
|
3405
|
-
for (const css of
|
|
3421
|
+
for (const css of tokenCSS.values()) {
|
|
3406
3422
|
if (css) parts.push(css);
|
|
3407
3423
|
}
|
|
3408
3424
|
return parts.join("\n");
|
package/dist/vite-plugin.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
buildConfig,
|
|
3
3
|
generateClassCSS
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-SOBLKZGE.mjs";
|
|
5
5
|
|
|
6
6
|
// src/vite-plugin.ts
|
|
7
7
|
import { readFileSync, readdirSync, statSync } from "fs";
|
|
@@ -52,14 +52,18 @@ function buildGlobalCSS(theme) {
|
|
|
52
52
|
function kbach(userConfig) {
|
|
53
53
|
const cfg = buildConfig(userConfig ?? {});
|
|
54
54
|
const screens = toNumericScreens(cfg.theme.screens ?? {});
|
|
55
|
-
const
|
|
55
|
+
const tokenCSS = /* @__PURE__ */ new Map();
|
|
56
56
|
const processedCSSFiles = /* @__PURE__ */ new Set();
|
|
57
57
|
let root = process.cwd();
|
|
58
58
|
let server = null;
|
|
59
59
|
function processClassString(classStr) {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
60
|
+
let added = false;
|
|
61
|
+
for (const token of classStr.split(/\s+/).filter(Boolean)) {
|
|
62
|
+
if (tokenCSS.has(token)) continue;
|
|
63
|
+
tokenCSS.set(token, generateClassCSS(token, cfg.theme, cfg.darkMode, screens));
|
|
64
|
+
added = true;
|
|
65
|
+
}
|
|
66
|
+
return added;
|
|
63
67
|
}
|
|
64
68
|
function extractFromCode(code) {
|
|
65
69
|
let added = false;
|
|
@@ -72,7 +76,7 @@ function kbach(userConfig) {
|
|
|
72
76
|
const parts = [];
|
|
73
77
|
const global = buildGlobalCSS(cfg.theme);
|
|
74
78
|
if (global) parts.push(global);
|
|
75
|
-
for (const css of
|
|
79
|
+
for (const css of tokenCSS.values()) {
|
|
76
80
|
if (css) parts.push(css);
|
|
77
81
|
}
|
|
78
82
|
return parts.join("\n");
|