@kbach/react 0.6.0 → 0.6.2
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 +49 -0
- package/dist/{chunk-6NED62DB.mjs → chunk-GRZ6MVIL.mjs} +659 -179
- package/dist/{chunk-AAAI37Y4.mjs → chunk-NWW57Q5Q.mjs} +12 -71
- package/dist/index.d.mts +142 -3
- package/dist/index.d.ts +142 -3
- package/dist/index.js +345 -395
- package/dist/index.mjs +69 -98
- package/dist/jsx-dev-runtime.js +205 -289
- package/dist/jsx-dev-runtime.mjs +4 -4
- package/dist/jsx-runtime.js +204 -288
- package/dist/jsx-runtime.mjs +3 -3
- package/dist/vite-plugin.d.mts +102 -1
- package/dist/vite-plugin.d.ts +102 -1
- package/dist/vite-plugin.js +139 -163
- package/dist/vite-plugin.mjs +2883 -12
- package/jsx-dev-runtime.js +1 -0
- package/jsx-runtime.js +1 -0
- package/kbach-react.md +7 -0
- package/package.json +3 -3
- package/dist/chunk-D4LJICWZ.mjs +0 -524
- package/dist/types-BESBQANS.d.mts +0 -131
- package/dist/types-BESBQANS.d.ts +0 -131
package/dist/jsx-dev-runtime.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
'use client';
|
|
1
2
|
"use strict";
|
|
2
3
|
var __create = Object.create;
|
|
3
4
|
var __defProp = Object.defineProperty;
|
|
@@ -30,14 +31,14 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
31
|
// src/jsx-dev-runtime.tsx
|
|
31
32
|
var jsx_dev_runtime_exports = {};
|
|
32
33
|
__export(jsx_dev_runtime_exports, {
|
|
33
|
-
Fragment: () =>
|
|
34
|
+
Fragment: () => import_react4.Fragment,
|
|
34
35
|
jsxDEV: () => jsxDEV
|
|
35
36
|
});
|
|
36
37
|
module.exports = __toCommonJS(jsx_dev_runtime_exports);
|
|
37
38
|
|
|
38
39
|
// src/jsx-runtime.tsx
|
|
39
40
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
40
|
-
var
|
|
41
|
+
var import_react4 = require("react");
|
|
41
42
|
|
|
42
43
|
// src/core/theme.ts
|
|
43
44
|
var defaultColors = {
|
|
@@ -581,10 +582,11 @@ var defaultTheme = {
|
|
|
581
582
|
|
|
582
583
|
// src/core/cache.ts
|
|
583
584
|
var LRUCache = class {
|
|
584
|
-
constructor(capacity = 1e4) {
|
|
585
|
+
constructor(capacity = 1e4, onEvict) {
|
|
585
586
|
this.capacity = capacity;
|
|
586
587
|
if (capacity <= 0) throw new Error("LRUCache: capacity must be a positive integer");
|
|
587
588
|
this.cache = /* @__PURE__ */ new Map();
|
|
589
|
+
this.onEvict = onEvict;
|
|
588
590
|
}
|
|
589
591
|
get(key) {
|
|
590
592
|
if (!this.cache.has(key)) return void 0;
|
|
@@ -597,7 +599,10 @@ var LRUCache = class {
|
|
|
597
599
|
if (this.cache.has(key)) {
|
|
598
600
|
this.cache.delete(key);
|
|
599
601
|
} else if (this.cache.size >= this.capacity) {
|
|
600
|
-
this.cache.
|
|
602
|
+
const oldestKey = this.cache.keys().next().value;
|
|
603
|
+
const oldestValue = this.cache.get(oldestKey);
|
|
604
|
+
this.cache.delete(oldestKey);
|
|
605
|
+
this.onEvict?.(oldestKey, oldestValue);
|
|
601
606
|
}
|
|
602
607
|
this.cache.set(key, value);
|
|
603
608
|
return this;
|
|
@@ -619,9 +624,10 @@ var LRUCache = class {
|
|
|
619
624
|
// src/core/platform.ts
|
|
620
625
|
var isWeb = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
|
|
621
626
|
var isNative = !isWeb && (typeof globalThis.HermesInternal !== "undefined" || typeof globalThis.__fbBatchedBridge !== "undefined" || typeof navigator !== "undefined" && navigator.product === "ReactNative" || typeof globalThis.__REACT_NATIVE__ !== "undefined");
|
|
622
|
-
var
|
|
627
|
+
var _resolveTargetOverride = null;
|
|
623
628
|
function getEffectiveIsWeb() {
|
|
624
|
-
|
|
629
|
+
if (_resolveTargetOverride) return _resolveTargetOverride === "web";
|
|
630
|
+
return isWeb || !isNative;
|
|
625
631
|
}
|
|
626
632
|
function toNativeValue(raw) {
|
|
627
633
|
if (/^-?\d+(\.\d+)?px$/.test(raw)) return parseFloat(raw);
|
|
@@ -808,18 +814,28 @@ function resolveColor(value, colors, isArbitrary) {
|
|
|
808
814
|
if (isNaN(alpha)) return hex;
|
|
809
815
|
return hexToRgba(hex, alpha);
|
|
810
816
|
}
|
|
811
|
-
function
|
|
817
|
+
function parseHexRgb(hex) {
|
|
812
818
|
const h = hex.replace("#", "");
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
r = parseInt(h.slice(0, 2), 16);
|
|
820
|
-
g = parseInt(h.slice(2, 4), 16);
|
|
821
|
-
b = parseInt(h.slice(4, 6), 16);
|
|
819
|
+
if (h.length === 3 || h.length === 4) {
|
|
820
|
+
return [
|
|
821
|
+
parseInt(h[0] + h[0], 16),
|
|
822
|
+
parseInt(h[1] + h[1], 16),
|
|
823
|
+
parseInt(h[2] + h[2], 16)
|
|
824
|
+
];
|
|
822
825
|
}
|
|
826
|
+
if (h.length === 6 || h.length === 8) {
|
|
827
|
+
return [
|
|
828
|
+
parseInt(h.slice(0, 2), 16),
|
|
829
|
+
parseInt(h.slice(2, 4), 16),
|
|
830
|
+
parseInt(h.slice(4, 6), 16)
|
|
831
|
+
];
|
|
832
|
+
}
|
|
833
|
+
return null;
|
|
834
|
+
}
|
|
835
|
+
function hexToRgba(hex, alpha) {
|
|
836
|
+
const rgb = parseHexRgb(hex);
|
|
837
|
+
if (!rgb) return hex;
|
|
838
|
+
const [r, g, b] = rgb;
|
|
823
839
|
return `rgba(${r},${g},${b},${alpha})`;
|
|
824
840
|
}
|
|
825
841
|
function resolveSpacing(value, negative, spacing, isArbitrary) {
|
|
@@ -863,8 +879,8 @@ function resolveFontSize(value, fontSizes, isArbitrary) {
|
|
|
863
879
|
if (isArbitrary) return getEffectiveIsWeb() ? value : toNativeValue(value);
|
|
864
880
|
return fontSizes[value] ?? null;
|
|
865
881
|
}
|
|
866
|
-
var FILTER_COMPOSE = "var(--
|
|
867
|
-
var BACKDROP_FILTER_COMPOSE = "var(--
|
|
882
|
+
var FILTER_COMPOSE = "var(--kb-blur,) var(--kb-brightness,) var(--kb-contrast,) var(--kb-grayscale,) var(--kb-hue-rotate,) var(--kb-invert,) var(--kb-saturate,) var(--kb-sepia,) var(--kb-drop-shadow,)";
|
|
883
|
+
var BACKDROP_FILTER_COMPOSE = "var(--kb-backdrop-blur,) var(--kb-backdrop-brightness,) var(--kb-backdrop-contrast,) var(--kb-backdrop-grayscale,) var(--kb-backdrop-hue-rotate,) var(--kb-backdrop-invert,) var(--kb-backdrop-opacity,) var(--kb-backdrop-saturate,) var(--kb-backdrop-sepia,)";
|
|
868
884
|
var _standalone = null;
|
|
869
885
|
function buildStandalone() {
|
|
870
886
|
const web = getEffectiveIsWeb();
|
|
@@ -1126,9 +1142,9 @@ function buildStandalone() {
|
|
|
1126
1142
|
"backface-visible": { backfaceVisibility: "visible" },
|
|
1127
1143
|
"backface-hidden": { backfaceVisibility: "hidden" },
|
|
1128
1144
|
// CSS filters — standalone = default/full effect (web-only)
|
|
1129
|
-
grayscale: web ? { "--
|
|
1130
|
-
invert: web ? { "--
|
|
1131
|
-
sepia: web ? { "--
|
|
1145
|
+
grayscale: web ? { "--kb-grayscale": "grayscale(100%)", filter: FILTER_COMPOSE } : null,
|
|
1146
|
+
invert: web ? { "--kb-invert": "invert(100%)", filter: FILTER_COMPOSE } : null,
|
|
1147
|
+
sepia: web ? { "--kb-sepia": "sepia(100%)", filter: FILTER_COMPOSE } : null,
|
|
1132
1148
|
// Divide none
|
|
1133
1149
|
"divide-none": web ? { __divideX: 0, __divideY: 0 } : null,
|
|
1134
1150
|
// Group / peer markers (no-op: no style emitted; just ensures isKnownUtility returns true)
|
|
@@ -1213,6 +1229,48 @@ function getStandalone() {
|
|
|
1213
1229
|
if (!_standalone) _standalone = buildStandalone();
|
|
1214
1230
|
return _standalone;
|
|
1215
1231
|
}
|
|
1232
|
+
function makeSpacingResolver(prop) {
|
|
1233
|
+
return ({ value, negative, isArbitrary }, { spacing }) => {
|
|
1234
|
+
const v = resolveSpacing(value, negative, spacing, isArbitrary);
|
|
1235
|
+
return v !== null ? { [prop]: v } : null;
|
|
1236
|
+
};
|
|
1237
|
+
}
|
|
1238
|
+
var PADDING_MARGIN_PROPS = {
|
|
1239
|
+
p: "padding",
|
|
1240
|
+
px: "paddingHorizontal",
|
|
1241
|
+
py: "paddingVertical",
|
|
1242
|
+
pt: "paddingTop",
|
|
1243
|
+
pr: "paddingRight",
|
|
1244
|
+
pb: "paddingBottom",
|
|
1245
|
+
pl: "paddingLeft",
|
|
1246
|
+
m: "margin",
|
|
1247
|
+
mx: "marginHorizontal",
|
|
1248
|
+
my: "marginVertical",
|
|
1249
|
+
mt: "marginTop",
|
|
1250
|
+
mr: "marginRight",
|
|
1251
|
+
mb: "marginBottom",
|
|
1252
|
+
ml: "marginLeft"
|
|
1253
|
+
};
|
|
1254
|
+
function makeBorderSideResolver(widthProp, colorProp) {
|
|
1255
|
+
return ({ value, isArbitrary }, { colors, borderWidth }) => {
|
|
1256
|
+
if (!value) return { [widthProp]: 1 };
|
|
1257
|
+
if (isArbitrary) {
|
|
1258
|
+
const w2 = toNativeValue(value);
|
|
1259
|
+
if (typeof w2 === "number") return { [widthProp]: w2 };
|
|
1260
|
+
return { [colorProp]: value };
|
|
1261
|
+
}
|
|
1262
|
+
const color = resolveColor(value, colors, false);
|
|
1263
|
+
if (color) return { [colorProp]: color };
|
|
1264
|
+
const w = borderWidth[value];
|
|
1265
|
+
return w !== void 0 ? { [widthProp]: w } : null;
|
|
1266
|
+
};
|
|
1267
|
+
}
|
|
1268
|
+
var BORDER_SIDE_PROPS = {
|
|
1269
|
+
"border-t": ["borderTopWidth", "borderTopColor"],
|
|
1270
|
+
"border-r": ["borderRightWidth", "borderRightColor"],
|
|
1271
|
+
"border-b": ["borderBottomWidth", "borderBottomColor"],
|
|
1272
|
+
"border-l": ["borderLeftWidth", "borderLeftColor"]
|
|
1273
|
+
};
|
|
1216
1274
|
var RESOLVERS = {
|
|
1217
1275
|
// ── Background ─────────────────────────────────────────────────────────────
|
|
1218
1276
|
bg: ({ value, isArbitrary }, { colors }) => {
|
|
@@ -1246,64 +1304,8 @@ var RESOLVERS = {
|
|
|
1246
1304
|
const v = isArbitrary ? n > 1 ? n / 100 : n : n / 100;
|
|
1247
1305
|
return { "--text-opacity": v };
|
|
1248
1306
|
},
|
|
1249
|
-
// ── Padding
|
|
1250
|
-
|
|
1251
|
-
const v = resolveSpacing(value, negative, spacing, isArbitrary);
|
|
1252
|
-
return v !== null ? { padding: v } : null;
|
|
1253
|
-
},
|
|
1254
|
-
px: ({ value, negative, isArbitrary }, { spacing }) => {
|
|
1255
|
-
const v = resolveSpacing(value, negative, spacing, isArbitrary);
|
|
1256
|
-
return v !== null ? { paddingHorizontal: v } : null;
|
|
1257
|
-
},
|
|
1258
|
-
py: ({ value, negative, isArbitrary }, { spacing }) => {
|
|
1259
|
-
const v = resolveSpacing(value, negative, spacing, isArbitrary);
|
|
1260
|
-
return v !== null ? { paddingVertical: v } : null;
|
|
1261
|
-
},
|
|
1262
|
-
pt: ({ value, negative, isArbitrary }, { spacing }) => {
|
|
1263
|
-
const v = resolveSpacing(value, negative, spacing, isArbitrary);
|
|
1264
|
-
return v !== null ? { paddingTop: v } : null;
|
|
1265
|
-
},
|
|
1266
|
-
pr: ({ value, negative, isArbitrary }, { spacing }) => {
|
|
1267
|
-
const v = resolveSpacing(value, negative, spacing, isArbitrary);
|
|
1268
|
-
return v !== null ? { paddingRight: v } : null;
|
|
1269
|
-
},
|
|
1270
|
-
pb: ({ value, negative, isArbitrary }, { spacing }) => {
|
|
1271
|
-
const v = resolveSpacing(value, negative, spacing, isArbitrary);
|
|
1272
|
-
return v !== null ? { paddingBottom: v } : null;
|
|
1273
|
-
},
|
|
1274
|
-
pl: ({ value, negative, isArbitrary }, { spacing }) => {
|
|
1275
|
-
const v = resolveSpacing(value, negative, spacing, isArbitrary);
|
|
1276
|
-
return v !== null ? { paddingLeft: v } : null;
|
|
1277
|
-
},
|
|
1278
|
-
// ── Margin ─────────────────────────────────────────────────────────────────
|
|
1279
|
-
m: ({ value, negative, isArbitrary }, { spacing }) => {
|
|
1280
|
-
const v = resolveSpacing(value, negative, spacing, isArbitrary);
|
|
1281
|
-
return v !== null ? { margin: v } : null;
|
|
1282
|
-
},
|
|
1283
|
-
mx: ({ value, negative, isArbitrary }, { spacing }) => {
|
|
1284
|
-
const v = resolveSpacing(value, negative, spacing, isArbitrary);
|
|
1285
|
-
return v !== null ? { marginHorizontal: v } : null;
|
|
1286
|
-
},
|
|
1287
|
-
my: ({ value, negative, isArbitrary }, { spacing }) => {
|
|
1288
|
-
const v = resolveSpacing(value, negative, spacing, isArbitrary);
|
|
1289
|
-
return v !== null ? { marginVertical: v } : null;
|
|
1290
|
-
},
|
|
1291
|
-
mt: ({ value, negative, isArbitrary }, { spacing }) => {
|
|
1292
|
-
const v = resolveSpacing(value, negative, spacing, isArbitrary);
|
|
1293
|
-
return v !== null ? { marginTop: v } : null;
|
|
1294
|
-
},
|
|
1295
|
-
mr: ({ value, negative, isArbitrary }, { spacing }) => {
|
|
1296
|
-
const v = resolveSpacing(value, negative, spacing, isArbitrary);
|
|
1297
|
-
return v !== null ? { marginRight: v } : null;
|
|
1298
|
-
},
|
|
1299
|
-
mb: ({ value, negative, isArbitrary }, { spacing }) => {
|
|
1300
|
-
const v = resolveSpacing(value, negative, spacing, isArbitrary);
|
|
1301
|
-
return v !== null ? { marginBottom: v } : null;
|
|
1302
|
-
},
|
|
1303
|
-
ml: ({ value, negative, isArbitrary }, { spacing }) => {
|
|
1304
|
-
const v = resolveSpacing(value, negative, spacing, isArbitrary);
|
|
1305
|
-
return v !== null ? { marginLeft: v } : null;
|
|
1306
|
-
},
|
|
1307
|
+
// ── Padding & margin ───────────────────────────────────────────────────────
|
|
1308
|
+
// Generated below via makeSpacingResolver() — see PADDING_MARGIN_PROPS.
|
|
1307
1309
|
// ── Sizing ─────────────────────────────────────────────────────────────────
|
|
1308
1310
|
w: ({ value, isArbitrary }, { spacing }) => {
|
|
1309
1311
|
const v = resolveSizing(value, spacing, isArbitrary);
|
|
@@ -1347,54 +1349,7 @@ var RESOLVERS = {
|
|
|
1347
1349
|
}
|
|
1348
1350
|
return null;
|
|
1349
1351
|
},
|
|
1350
|
-
|
|
1351
|
-
if (!value) return { borderTopWidth: 1 };
|
|
1352
|
-
if (isArbitrary) {
|
|
1353
|
-
const w2 = toNativeValue(value);
|
|
1354
|
-
if (typeof w2 === "number") return { borderTopWidth: w2 };
|
|
1355
|
-
return { borderTopColor: value };
|
|
1356
|
-
}
|
|
1357
|
-
const color = resolveColor(value, colors, false);
|
|
1358
|
-
if (color) return { borderTopColor: color };
|
|
1359
|
-
const w = borderWidth[value];
|
|
1360
|
-
return w !== void 0 ? { borderTopWidth: w } : null;
|
|
1361
|
-
},
|
|
1362
|
-
"border-r": ({ value, isArbitrary }, { colors, borderWidth }) => {
|
|
1363
|
-
if (!value) return { borderRightWidth: 1 };
|
|
1364
|
-
if (isArbitrary) {
|
|
1365
|
-
const w2 = toNativeValue(value);
|
|
1366
|
-
if (typeof w2 === "number") return { borderRightWidth: w2 };
|
|
1367
|
-
return { borderRightColor: value };
|
|
1368
|
-
}
|
|
1369
|
-
const color = resolveColor(value, colors, false);
|
|
1370
|
-
if (color) return { borderRightColor: color };
|
|
1371
|
-
const w = borderWidth[value];
|
|
1372
|
-
return w !== void 0 ? { borderRightWidth: w } : null;
|
|
1373
|
-
},
|
|
1374
|
-
"border-b": ({ value, isArbitrary }, { colors, borderWidth }) => {
|
|
1375
|
-
if (!value) return { borderBottomWidth: 1 };
|
|
1376
|
-
if (isArbitrary) {
|
|
1377
|
-
const w2 = toNativeValue(value);
|
|
1378
|
-
if (typeof w2 === "number") return { borderBottomWidth: w2 };
|
|
1379
|
-
return { borderBottomColor: value };
|
|
1380
|
-
}
|
|
1381
|
-
const color = resolveColor(value, colors, false);
|
|
1382
|
-
if (color) return { borderBottomColor: color };
|
|
1383
|
-
const w = borderWidth[value];
|
|
1384
|
-
return w !== void 0 ? { borderBottomWidth: w } : null;
|
|
1385
|
-
},
|
|
1386
|
-
"border-l": ({ value, isArbitrary }, { colors, borderWidth }) => {
|
|
1387
|
-
if (!value) return { borderLeftWidth: 1 };
|
|
1388
|
-
if (isArbitrary) {
|
|
1389
|
-
const w2 = toNativeValue(value);
|
|
1390
|
-
if (typeof w2 === "number") return { borderLeftWidth: w2 };
|
|
1391
|
-
return { borderLeftColor: value };
|
|
1392
|
-
}
|
|
1393
|
-
const color = resolveColor(value, colors, false);
|
|
1394
|
-
if (color) return { borderLeftColor: color };
|
|
1395
|
-
const w = borderWidth[value];
|
|
1396
|
-
return w !== void 0 ? { borderLeftWidth: w } : null;
|
|
1397
|
-
},
|
|
1352
|
+
// border-t/-r/-b/-l generated below via makeBorderSideResolver() — see BORDER_SIDE_PROPS.
|
|
1398
1353
|
// ── Border radius ──────────────────────────────────────────────────────────
|
|
1399
1354
|
rounded: ({ value, isArbitrary }, { borderRadius }) => {
|
|
1400
1355
|
const r = resolveRadius(value, borderRadius, isArbitrary);
|
|
@@ -1626,49 +1581,49 @@ var RESOLVERS = {
|
|
|
1626
1581
|
"2xl": "blur(40px)",
|
|
1627
1582
|
"3xl": "blur(64px)"
|
|
1628
1583
|
};
|
|
1629
|
-
if (value === "none") return { "--
|
|
1584
|
+
if (value === "none") return { "--kb-blur": "", filter: FILTER_COMPOSE };
|
|
1630
1585
|
const v = isArbitrary ? `blur(${value})` : sizes[value];
|
|
1631
|
-
return v !== void 0 ? { "--
|
|
1586
|
+
return v !== void 0 ? { "--kb-blur": v, filter: FILTER_COMPOSE } : null;
|
|
1632
1587
|
},
|
|
1633
1588
|
brightness: ({ value, isArbitrary }) => {
|
|
1634
1589
|
if (!getEffectiveIsWeb()) return null;
|
|
1635
1590
|
const v = isArbitrary ? `brightness(${value})` : `brightness(${parseFloat(value) / 100})`;
|
|
1636
|
-
return isNaN(parseFloat(value)) && !isArbitrary ? null : { "--
|
|
1591
|
+
return isNaN(parseFloat(value)) && !isArbitrary ? null : { "--kb-brightness": v, filter: FILTER_COMPOSE };
|
|
1637
1592
|
},
|
|
1638
1593
|
contrast: ({ value, isArbitrary }) => {
|
|
1639
1594
|
if (!getEffectiveIsWeb()) return null;
|
|
1640
1595
|
const v = isArbitrary ? `contrast(${value})` : `contrast(${parseFloat(value) / 100})`;
|
|
1641
|
-
return isNaN(parseFloat(value)) && !isArbitrary ? null : { "--
|
|
1596
|
+
return isNaN(parseFloat(value)) && !isArbitrary ? null : { "--kb-contrast": v, filter: FILTER_COMPOSE };
|
|
1642
1597
|
},
|
|
1643
1598
|
grayscale: ({ value }) => {
|
|
1644
1599
|
if (!getEffectiveIsWeb()) return null;
|
|
1645
1600
|
const v = value === "0" ? "grayscale(0)" : "grayscale(100%)";
|
|
1646
|
-
return { "--
|
|
1601
|
+
return { "--kb-grayscale": v, filter: FILTER_COMPOSE };
|
|
1647
1602
|
},
|
|
1648
1603
|
"hue-rotate": ({ value, negative, isArbitrary }) => {
|
|
1649
1604
|
if (!getEffectiveIsWeb()) return null;
|
|
1650
1605
|
const deg = isArbitrary ? value : `${(negative ? -1 : 1) * parseFloat(value)}deg`;
|
|
1651
1606
|
if (isNaN(parseFloat(deg)) && !isArbitrary) return null;
|
|
1652
|
-
return { "--
|
|
1607
|
+
return { "--kb-hue-rotate": `hue-rotate(${deg})`, filter: FILTER_COMPOSE };
|
|
1653
1608
|
},
|
|
1654
1609
|
invert: ({ value }) => {
|
|
1655
1610
|
if (!getEffectiveIsWeb()) return null;
|
|
1656
1611
|
const v = value === "0" ? "invert(0)" : "invert(100%)";
|
|
1657
|
-
return { "--
|
|
1612
|
+
return { "--kb-invert": v, filter: FILTER_COMPOSE };
|
|
1658
1613
|
},
|
|
1659
1614
|
saturate: ({ value, isArbitrary }) => {
|
|
1660
1615
|
if (!getEffectiveIsWeb()) return null;
|
|
1661
1616
|
const v = isArbitrary ? `saturate(${value})` : `saturate(${parseFloat(value) / 100})`;
|
|
1662
|
-
return isNaN(parseFloat(value)) && !isArbitrary ? null : { "--
|
|
1617
|
+
return isNaN(parseFloat(value)) && !isArbitrary ? null : { "--kb-saturate": v, filter: FILTER_COMPOSE };
|
|
1663
1618
|
},
|
|
1664
1619
|
sepia: ({ value }) => {
|
|
1665
1620
|
if (!getEffectiveIsWeb()) return null;
|
|
1666
1621
|
const v = value === "0" ? "sepia(0)" : "sepia(100%)";
|
|
1667
|
-
return { "--
|
|
1622
|
+
return { "--kb-sepia": v, filter: FILTER_COMPOSE };
|
|
1668
1623
|
},
|
|
1669
1624
|
"drop-shadow": ({ value, isArbitrary }) => {
|
|
1670
1625
|
if (!getEffectiveIsWeb()) return null;
|
|
1671
|
-
if (isArbitrary) return { "--
|
|
1626
|
+
if (isArbitrary) return { "--kb-drop-shadow": `drop-shadow(${value.replace(/_/g, " ")})`, filter: FILTER_COMPOSE };
|
|
1672
1627
|
const presets = {
|
|
1673
1628
|
"": "drop-shadow(0 1px 2px rgb(0 0 0/0.1)) drop-shadow(0 1px 1px rgb(0 0 0/0.06))",
|
|
1674
1629
|
sm: "drop-shadow(0 1px 1px rgb(0 0 0/0.05))",
|
|
@@ -1679,7 +1634,7 @@ var RESOLVERS = {
|
|
|
1679
1634
|
none: "drop-shadow(0 0 #0000)"
|
|
1680
1635
|
};
|
|
1681
1636
|
const v = presets[value];
|
|
1682
|
-
return v !== void 0 ? { "--
|
|
1637
|
+
return v !== void 0 ? { "--kb-drop-shadow": v, filter: FILTER_COMPOSE } : null;
|
|
1683
1638
|
},
|
|
1684
1639
|
// Arbitrary full filter string: filter-[blur(4px)_grayscale(1)]
|
|
1685
1640
|
filter: ({ value, isArbitrary }) => {
|
|
@@ -1700,47 +1655,47 @@ var RESOLVERS = {
|
|
|
1700
1655
|
"2xl": "blur(40px)",
|
|
1701
1656
|
"3xl": "blur(64px)"
|
|
1702
1657
|
};
|
|
1703
|
-
if (value === "none") return { "--
|
|
1658
|
+
if (value === "none") return { "--kb-backdrop-blur": "", backdropFilter: BACKDROP_FILTER_COMPOSE };
|
|
1704
1659
|
const v = isArbitrary ? `blur(${value})` : sizes[value];
|
|
1705
|
-
return v !== void 0 ? { "--
|
|
1660
|
+
return v !== void 0 ? { "--kb-backdrop-blur": v, backdropFilter: BACKDROP_FILTER_COMPOSE } : null;
|
|
1706
1661
|
},
|
|
1707
1662
|
"backdrop-brightness": ({ value, isArbitrary }) => {
|
|
1708
1663
|
if (!getEffectiveIsWeb()) return null;
|
|
1709
1664
|
const v = isArbitrary ? `brightness(${value})` : `brightness(${parseFloat(value) / 100})`;
|
|
1710
|
-
return isNaN(parseFloat(value)) && !isArbitrary ? null : { "--
|
|
1665
|
+
return isNaN(parseFloat(value)) && !isArbitrary ? null : { "--kb-backdrop-brightness": v, backdropFilter: BACKDROP_FILTER_COMPOSE };
|
|
1711
1666
|
},
|
|
1712
1667
|
"backdrop-contrast": ({ value, isArbitrary }) => {
|
|
1713
1668
|
if (!getEffectiveIsWeb()) return null;
|
|
1714
1669
|
const v = isArbitrary ? `contrast(${value})` : `contrast(${parseFloat(value) / 100})`;
|
|
1715
|
-
return isNaN(parseFloat(value)) && !isArbitrary ? null : { "--
|
|
1670
|
+
return isNaN(parseFloat(value)) && !isArbitrary ? null : { "--kb-backdrop-contrast": v, backdropFilter: BACKDROP_FILTER_COMPOSE };
|
|
1716
1671
|
},
|
|
1717
1672
|
"backdrop-grayscale": ({ value }) => {
|
|
1718
1673
|
if (!getEffectiveIsWeb()) return null;
|
|
1719
|
-
return { "--
|
|
1674
|
+
return { "--kb-backdrop-grayscale": value === "0" ? "grayscale(0)" : "grayscale(100%)", backdropFilter: BACKDROP_FILTER_COMPOSE };
|
|
1720
1675
|
},
|
|
1721
1676
|
"backdrop-hue-rotate": ({ value, negative, isArbitrary }) => {
|
|
1722
1677
|
if (!getEffectiveIsWeb()) return null;
|
|
1723
1678
|
const deg = isArbitrary ? value : `${(negative ? -1 : 1) * parseFloat(value)}deg`;
|
|
1724
1679
|
if (isNaN(parseFloat(deg)) && !isArbitrary) return null;
|
|
1725
|
-
return { "--
|
|
1680
|
+
return { "--kb-backdrop-hue-rotate": `hue-rotate(${deg})`, backdropFilter: BACKDROP_FILTER_COMPOSE };
|
|
1726
1681
|
},
|
|
1727
1682
|
"backdrop-invert": ({ value }) => {
|
|
1728
1683
|
if (!getEffectiveIsWeb()) return null;
|
|
1729
|
-
return { "--
|
|
1684
|
+
return { "--kb-backdrop-invert": value === "0" ? "invert(0)" : "invert(100%)", backdropFilter: BACKDROP_FILTER_COMPOSE };
|
|
1730
1685
|
},
|
|
1731
1686
|
"backdrop-opacity": ({ value, isArbitrary }) => {
|
|
1732
1687
|
if (!getEffectiveIsWeb()) return null;
|
|
1733
1688
|
const v = isArbitrary ? `opacity(${value})` : `opacity(${parseFloat(value) / 100})`;
|
|
1734
|
-
return isNaN(parseFloat(value)) && !isArbitrary ? null : { "--
|
|
1689
|
+
return isNaN(parseFloat(value)) && !isArbitrary ? null : { "--kb-backdrop-opacity": v, backdropFilter: BACKDROP_FILTER_COMPOSE };
|
|
1735
1690
|
},
|
|
1736
1691
|
"backdrop-saturate": ({ value, isArbitrary }) => {
|
|
1737
1692
|
if (!getEffectiveIsWeb()) return null;
|
|
1738
1693
|
const v = isArbitrary ? `saturate(${value})` : `saturate(${parseFloat(value) / 100})`;
|
|
1739
|
-
return isNaN(parseFloat(value)) && !isArbitrary ? null : { "--
|
|
1694
|
+
return isNaN(parseFloat(value)) && !isArbitrary ? null : { "--kb-backdrop-saturate": v, backdropFilter: BACKDROP_FILTER_COMPOSE };
|
|
1740
1695
|
},
|
|
1741
1696
|
"backdrop-sepia": ({ value }) => {
|
|
1742
1697
|
if (!getEffectiveIsWeb()) return null;
|
|
1743
|
-
return { "--
|
|
1698
|
+
return { "--kb-backdrop-sepia": value === "0" ? "sepia(0)" : "sepia(100%)", backdropFilter: BACKDROP_FILTER_COMPOSE };
|
|
1744
1699
|
},
|
|
1745
1700
|
"backdrop-filter": ({ value, isArbitrary }) => {
|
|
1746
1701
|
if (!getEffectiveIsWeb()) return null;
|
|
@@ -1764,7 +1719,7 @@ var RESOLVERS = {
|
|
|
1764
1719
|
const dir = directions[value];
|
|
1765
1720
|
if (!dir) return null;
|
|
1766
1721
|
return {
|
|
1767
|
-
backgroundImage: `linear-gradient(${dir}, var(--
|
|
1722
|
+
backgroundImage: `linear-gradient(${dir}, var(--kb-gradient-from, transparent), var(--kb-gradient-stops, transparent))`
|
|
1768
1723
|
};
|
|
1769
1724
|
},
|
|
1770
1725
|
from: ({ value, isArbitrary }, { colors }) => {
|
|
@@ -1772,8 +1727,8 @@ var RESOLVERS = {
|
|
|
1772
1727
|
const color = resolveColor(value, colors, isArbitrary);
|
|
1773
1728
|
if (!color) return null;
|
|
1774
1729
|
return {
|
|
1775
|
-
"--
|
|
1776
|
-
"--
|
|
1730
|
+
"--kb-gradient-from": color,
|
|
1731
|
+
"--kb-gradient-stops": `var(--kb-gradient-from), var(--kb-gradient-to, transparent)`
|
|
1777
1732
|
};
|
|
1778
1733
|
},
|
|
1779
1734
|
via: ({ value, isArbitrary }, { colors }) => {
|
|
@@ -1781,15 +1736,15 @@ var RESOLVERS = {
|
|
|
1781
1736
|
const color = resolveColor(value, colors, isArbitrary);
|
|
1782
1737
|
if (!color) return null;
|
|
1783
1738
|
return {
|
|
1784
|
-
"--
|
|
1785
|
-
"--
|
|
1739
|
+
"--kb-gradient-via": color,
|
|
1740
|
+
"--kb-gradient-stops": `var(--kb-gradient-from), var(--kb-gradient-via), var(--kb-gradient-to, transparent)`
|
|
1786
1741
|
};
|
|
1787
1742
|
},
|
|
1788
1743
|
to: ({ value, isArbitrary }, { colors }) => {
|
|
1789
1744
|
if (!getEffectiveIsWeb()) return null;
|
|
1790
1745
|
const color = resolveColor(value, colors, isArbitrary);
|
|
1791
1746
|
if (!color) return null;
|
|
1792
|
-
return { "--
|
|
1747
|
+
return { "--kb-gradient-to": color };
|
|
1793
1748
|
},
|
|
1794
1749
|
// ── Transform extras (web-only) ───────────────────────────────────────────
|
|
1795
1750
|
"skew-x": ({ value, negative, isArbitrary }) => {
|
|
@@ -2393,6 +2348,12 @@ var RESOLVERS = {
|
|
|
2393
2348
|
return { rowGap: v };
|
|
2394
2349
|
}
|
|
2395
2350
|
};
|
|
2351
|
+
for (const [utility, prop] of Object.entries(PADDING_MARGIN_PROPS)) {
|
|
2352
|
+
RESOLVERS[utility] = makeSpacingResolver(prop);
|
|
2353
|
+
}
|
|
2354
|
+
for (const [utility, [widthProp, colorProp]] of Object.entries(BORDER_SIDE_PROPS)) {
|
|
2355
|
+
RESOLVERS[utility] = makeBorderSideResolver(widthProp, colorProp);
|
|
2356
|
+
}
|
|
2396
2357
|
function resolveUtility(parsed, theme) {
|
|
2397
2358
|
if (!parsed.value) {
|
|
2398
2359
|
if (parsed.utility in PLUGIN_STANDALONE) return PLUGIN_STANDALONE[parsed.utility] ?? null;
|
|
@@ -2651,7 +2612,20 @@ function getDefaultFontFamily() {
|
|
|
2651
2612
|
return globalThis[FONT_KEY];
|
|
2652
2613
|
}
|
|
2653
2614
|
var _styleEl = null;
|
|
2654
|
-
|
|
2615
|
+
function evictInjectedRule(rule) {
|
|
2616
|
+
const sheet = _styleEl?.sheet;
|
|
2617
|
+
if (!sheet) return;
|
|
2618
|
+
for (let i = 0; i < sheet.cssRules.length; i++) {
|
|
2619
|
+
if (sheet.cssRules[i].cssText === rule) {
|
|
2620
|
+
try {
|
|
2621
|
+
sheet.deleteRule(i);
|
|
2622
|
+
} catch {
|
|
2623
|
+
}
|
|
2624
|
+
return;
|
|
2625
|
+
}
|
|
2626
|
+
}
|
|
2627
|
+
}
|
|
2628
|
+
var _injectedRules = new LRUCache(5e4, evictInjectedRule);
|
|
2655
2629
|
var _CSS_DISABLED_KEY = "__kbach_runtime_css_disabled__";
|
|
2656
2630
|
function isRuntimeCSSDisabled() {
|
|
2657
2631
|
return !!globalThis[_CSS_DISABLED_KEY];
|
|
@@ -2685,8 +2659,7 @@ function injectGlobalStyles(theme) {
|
|
|
2685
2659
|
if (typeof document === "undefined" || isRuntimeCSSDisabled()) return;
|
|
2686
2660
|
const rules = [BASE_RESET];
|
|
2687
2661
|
const ff = theme.fontFamily;
|
|
2688
|
-
if (
|
|
2689
|
-
if (ff.sans && ff.sans !== "System") {
|
|
2662
|
+
if (ff?.sans && ff.sans !== "System") {
|
|
2690
2663
|
const family = Array.isArray(ff.sans) ? ff.sans.join(", ") : ff.sans;
|
|
2691
2664
|
rules.push(`body { font-family: ${family}; }`);
|
|
2692
2665
|
}
|
|
@@ -2849,7 +2822,7 @@ function buildClassCSSRules(cls, bucketKey, styles, darkMode, important, screens
|
|
|
2849
2822
|
else rule = `[data-theme="dark"] ${selector} { ${decls} }`;
|
|
2850
2823
|
} else if (darkScheme === "light") {
|
|
2851
2824
|
if (darkMode === "media") rule = `@media (prefers-color-scheme: light) { ${selector} { ${decls} } }`;
|
|
2852
|
-
else if (darkMode === "class") rule =
|
|
2825
|
+
else if (darkMode === "class") rule = `.light ${selector} { ${decls} }`;
|
|
2853
2826
|
else rule = `[data-theme="light"] ${selector} { ${decls} }`;
|
|
2854
2827
|
} else {
|
|
2855
2828
|
rule = `${selector} { ${decls} }`;
|
|
@@ -2969,11 +2942,14 @@ function getConfig() {
|
|
|
2969
2942
|
return store.resolved;
|
|
2970
2943
|
}
|
|
2971
2944
|
function resolveOneRef(ref, colors) {
|
|
2972
|
-
const
|
|
2973
|
-
if (
|
|
2974
|
-
const
|
|
2945
|
+
const lastDash = ref.lastIndexOf("-");
|
|
2946
|
+
if (lastDash <= 0) return null;
|
|
2947
|
+
const name = ref.slice(0, lastDash);
|
|
2948
|
+
const shade = ref.slice(lastDash + 1);
|
|
2949
|
+
if (!/^\d+$/.test(shade)) return null;
|
|
2950
|
+
const entry = colors[name];
|
|
2975
2951
|
if (!entry || typeof entry !== "object") return null;
|
|
2976
|
-
return entry[
|
|
2952
|
+
return entry[shade] ?? null;
|
|
2977
2953
|
}
|
|
2978
2954
|
function resolveColorRefs(colors) {
|
|
2979
2955
|
const MAX_DEPTH = 5;
|
|
@@ -3003,7 +2979,7 @@ function resolveColorRefs(colors) {
|
|
|
3003
2979
|
function buildConfig(userConfig) {
|
|
3004
2980
|
let theme = { ...defaultTheme };
|
|
3005
2981
|
if (userConfig.theme) {
|
|
3006
|
-
theme =
|
|
2982
|
+
theme = { ...theme, ...userConfig.theme };
|
|
3007
2983
|
}
|
|
3008
2984
|
if (userConfig.extend) {
|
|
3009
2985
|
const extendConfig = userConfig.extend;
|
|
@@ -3131,15 +3107,17 @@ function subscribeGlobalDarkMode(callback) {
|
|
|
3131
3107
|
}
|
|
3132
3108
|
|
|
3133
3109
|
// src/InteractiveWrapper.tsx
|
|
3134
|
-
var
|
|
3110
|
+
var import_react2 = __toESM(require("react"));
|
|
3135
3111
|
|
|
3136
|
-
// src/
|
|
3112
|
+
// src/useSyncExternalStoreShim.ts
|
|
3137
3113
|
var import_react = __toESM(require("react"));
|
|
3138
3114
|
var useSyncExternalStore = import_react.default.useSyncExternalStore ?? function useSyncExternalStoreFallback(subscribe, getSnapshot, _getServerSnapshot) {
|
|
3139
3115
|
const [, forceUpdate] = import_react.default.useReducer((n) => n + 1, 0);
|
|
3140
3116
|
import_react.default.useEffect(() => subscribe(forceUpdate), [subscribe]);
|
|
3141
3117
|
return getSnapshot();
|
|
3142
3118
|
};
|
|
3119
|
+
|
|
3120
|
+
// src/useGlobalDarkMode.ts
|
|
3143
3121
|
function useGlobalDarkMode() {
|
|
3144
3122
|
return useSyncExternalStore(
|
|
3145
3123
|
subscribeGlobalDarkMode,
|
|
@@ -3150,12 +3128,6 @@ function useGlobalDarkMode() {
|
|
|
3150
3128
|
}
|
|
3151
3129
|
|
|
3152
3130
|
// src/useGlobalWidth.ts
|
|
3153
|
-
var import_react2 = __toESM(require("react"));
|
|
3154
|
-
var useSyncExternalStore2 = import_react2.default.useSyncExternalStore ?? function useSyncExternalStoreFallback2(subscribe, getSnapshot, _getServerSnapshot) {
|
|
3155
|
-
const [, forceUpdate] = import_react2.default.useReducer((n) => n + 1, 0);
|
|
3156
|
-
import_react2.default.useEffect(() => subscribe(forceUpdate), [subscribe]);
|
|
3157
|
-
return getSnapshot();
|
|
3158
|
-
};
|
|
3159
3131
|
var NOOP_SUB = (_) => () => {
|
|
3160
3132
|
};
|
|
3161
3133
|
var ZERO_SNAP = () => 0;
|
|
@@ -3189,7 +3161,7 @@ function getWebWidth() {
|
|
|
3189
3161
|
return typeof window !== "undefined" ? window.innerWidth : 0;
|
|
3190
3162
|
}
|
|
3191
3163
|
function useConditionalWidth(active) {
|
|
3192
|
-
return
|
|
3164
|
+
return useSyncExternalStore(
|
|
3193
3165
|
active ? isWeb ? subscribeWebWidth : subscribeGlobalWidth : NOOP_SUB,
|
|
3194
3166
|
active ? isWeb ? getWebWidth : getGlobalWidth : ZERO_SNAP,
|
|
3195
3167
|
ZERO_SNAP
|
|
@@ -3207,15 +3179,45 @@ function hasResponsiveBuckets(resolved) {
|
|
|
3207
3179
|
}
|
|
3208
3180
|
return false;
|
|
3209
3181
|
}
|
|
3210
|
-
|
|
3211
|
-
// src/InteractiveWrapper.tsx
|
|
3212
3182
|
function chain(original, extra) {
|
|
3213
3183
|
return (...args) => {
|
|
3214
3184
|
original?.(...args);
|
|
3215
3185
|
extra();
|
|
3216
3186
|
};
|
|
3217
3187
|
}
|
|
3218
|
-
|
|
3188
|
+
function stripInternalMarkers(s) {
|
|
3189
|
+
delete s.__divideX;
|
|
3190
|
+
delete s.__divideY;
|
|
3191
|
+
delete s.__divideColor;
|
|
3192
|
+
delete s.__divideStyle;
|
|
3193
|
+
delete s.__keyframe;
|
|
3194
|
+
}
|
|
3195
|
+
function stripWebOnlyProps(s) {
|
|
3196
|
+
if (s.display === "grid" || s.display === "inline-grid") delete s.display;
|
|
3197
|
+
delete s.gridTemplateColumns;
|
|
3198
|
+
delete s.gridTemplateRows;
|
|
3199
|
+
delete s.gridColumn;
|
|
3200
|
+
delete s.gridRow;
|
|
3201
|
+
delete s.gridArea;
|
|
3202
|
+
delete s.gridColumnStart;
|
|
3203
|
+
delete s.gridColumnEnd;
|
|
3204
|
+
delete s.gridRowStart;
|
|
3205
|
+
delete s.gridRowEnd;
|
|
3206
|
+
delete s.gridAutoFlow;
|
|
3207
|
+
delete s.gridAutoColumns;
|
|
3208
|
+
delete s.gridAutoRows;
|
|
3209
|
+
delete s.placeItems;
|
|
3210
|
+
delete s.placeContent;
|
|
3211
|
+
delete s.justifyItems;
|
|
3212
|
+
delete s.placeSelf;
|
|
3213
|
+
delete s.justifySelf;
|
|
3214
|
+
if (s.position === "sticky" || s.position === "fixed" || s.position === "static") {
|
|
3215
|
+
delete s.position;
|
|
3216
|
+
}
|
|
3217
|
+
}
|
|
3218
|
+
|
|
3219
|
+
// src/InteractiveWrapper.tsx
|
|
3220
|
+
var InteractiveWrapper = (0, import_react2.forwardRef)(
|
|
3219
3221
|
function InteractiveWrapper2({
|
|
3220
3222
|
Component,
|
|
3221
3223
|
resolvedStyle,
|
|
@@ -3226,6 +3228,7 @@ var InteractiveWrapper = (0, import_react3.forwardRef)(
|
|
|
3226
3228
|
onPointerDown,
|
|
3227
3229
|
onPointerUp,
|
|
3228
3230
|
onPointerLeave,
|
|
3231
|
+
onPointerCancel,
|
|
3229
3232
|
onMouseEnter,
|
|
3230
3233
|
onMouseLeave,
|
|
3231
3234
|
onFocus,
|
|
@@ -3236,51 +3239,26 @@ var InteractiveWrapper = (0, import_react3.forwardRef)(
|
|
|
3236
3239
|
const needsWidth = hasResponsiveBuckets(resolvedStyle);
|
|
3237
3240
|
const width = useConditionalWidth(needsWidth);
|
|
3238
3241
|
const breakpoints = needsWidth ? getActiveBreakpoints(width) : EMPTY_BREAKPOINTS;
|
|
3239
|
-
const [pressed, setPressed] = (0,
|
|
3240
|
-
const [hovered, setHovered] = (0,
|
|
3241
|
-
const [focused, setFocused] = (0,
|
|
3242
|
-
const handlePressIn = (0,
|
|
3243
|
-
const handlePressOut = (0,
|
|
3244
|
-
const handlePointerDown = (0,
|
|
3245
|
-
const handlePointerUp = (0,
|
|
3246
|
-
const handlePointerLeave = (0,
|
|
3247
|
-
const
|
|
3248
|
-
const
|
|
3249
|
-
const
|
|
3250
|
-
const
|
|
3242
|
+
const [pressed, setPressed] = (0, import_react2.useState)(false);
|
|
3243
|
+
const [hovered, setHovered] = (0, import_react2.useState)(false);
|
|
3244
|
+
const [focused, setFocused] = (0, import_react2.useState)(false);
|
|
3245
|
+
const handlePressIn = (0, import_react2.useCallback)(chain(onPressIn, () => setPressed(true)), [onPressIn]);
|
|
3246
|
+
const handlePressOut = (0, import_react2.useCallback)(chain(onPressOut, () => setPressed(false)), [onPressOut]);
|
|
3247
|
+
const handlePointerDown = (0, import_react2.useCallback)(chain(onPointerDown, () => setPressed(true)), [onPointerDown]);
|
|
3248
|
+
const handlePointerUp = (0, import_react2.useCallback)(chain(onPointerUp, () => setPressed(false)), [onPointerUp]);
|
|
3249
|
+
const handlePointerLeave = (0, import_react2.useCallback)(chain(onPointerLeave, () => setPressed(false)), [onPointerLeave]);
|
|
3250
|
+
const handlePointerCancel = (0, import_react2.useCallback)(chain(onPointerCancel, () => setPressed(false)), [onPointerCancel]);
|
|
3251
|
+
const handleMouseEnter = (0, import_react2.useCallback)(chain(onMouseEnter, () => setHovered(true)), [onMouseEnter]);
|
|
3252
|
+
const handleMouseLeave = (0, import_react2.useCallback)(chain(onMouseLeave, () => setHovered(false)), [onMouseLeave]);
|
|
3253
|
+
const handleFocus = (0, import_react2.useCallback)(chain(onFocus, () => setFocused(true)), [onFocus]);
|
|
3254
|
+
const handleBlur = (0, import_react2.useCallback)(chain(onBlur, () => setFocused(false)), [onBlur]);
|
|
3251
3255
|
const { children, disabled, checked, ...restForComponent } = rest;
|
|
3252
|
-
const computedStyle = (0,
|
|
3256
|
+
const computedStyle = (0, import_react2.useMemo)(
|
|
3253
3257
|
() => {
|
|
3254
3258
|
if (isWeb) return {};
|
|
3255
3259
|
const s = flatten(resolvedStyle, isDark, { pressed, hover: hovered, focus: focused, disabled: !!disabled, checked: !!checked }, breakpoints);
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
delete s.__divideColor;
|
|
3259
|
-
delete s.__divideStyle;
|
|
3260
|
-
delete s.__keyframe;
|
|
3261
|
-
if (typeof Component !== "string") {
|
|
3262
|
-
if (s.display === "grid" || s.display === "inline-grid") delete s.display;
|
|
3263
|
-
delete s.gridTemplateColumns;
|
|
3264
|
-
delete s.gridTemplateRows;
|
|
3265
|
-
delete s.gridColumn;
|
|
3266
|
-
delete s.gridRow;
|
|
3267
|
-
delete s.gridArea;
|
|
3268
|
-
delete s.gridColumnStart;
|
|
3269
|
-
delete s.gridColumnEnd;
|
|
3270
|
-
delete s.gridRowStart;
|
|
3271
|
-
delete s.gridRowEnd;
|
|
3272
|
-
delete s.gridAutoFlow;
|
|
3273
|
-
delete s.gridAutoColumns;
|
|
3274
|
-
delete s.gridAutoRows;
|
|
3275
|
-
delete s.placeItems;
|
|
3276
|
-
delete s.placeContent;
|
|
3277
|
-
delete s.justifyItems;
|
|
3278
|
-
delete s.placeSelf;
|
|
3279
|
-
delete s.justifySelf;
|
|
3280
|
-
if (s.position === "sticky" || s.position === "fixed" || s.position === "static") {
|
|
3281
|
-
delete s.position;
|
|
3282
|
-
}
|
|
3283
|
-
}
|
|
3260
|
+
stripInternalMarkers(s);
|
|
3261
|
+
if (typeof Component !== "string") stripWebOnlyProps(s);
|
|
3284
3262
|
return s;
|
|
3285
3263
|
},
|
|
3286
3264
|
[resolvedStyle, isDark, pressed, hovered, focused, width, disabled, checked]
|
|
@@ -3297,20 +3275,20 @@ var InteractiveWrapper = (0, import_react3.forwardRef)(
|
|
|
3297
3275
|
// On web, onPointerDown/Up drive the wrapper's own pressed state (covers mouse + touch),
|
|
3298
3276
|
// but onPressIn/onPressOut are still forwarded unchanged — react-native-web components
|
|
3299
3277
|
// (and any component that accepts both prop names) depend on receiving them directly.
|
|
3300
|
-
...!isNative ? { onPointerDown: handlePointerDown, onPointerUp: handlePointerUp, onPointerLeave: handlePointerLeave, onPointerCancel:
|
|
3278
|
+
...!isNative ? { onPointerDown: handlePointerDown, onPointerUp: handlePointerUp, onPointerLeave: handlePointerLeave, onPointerCancel: handlePointerCancel, onPressIn, onPressOut } : { onPressIn: handlePressIn, onPressOut: handlePressOut },
|
|
3301
3279
|
onMouseEnter: handleMouseEnter,
|
|
3302
3280
|
onMouseLeave: handleMouseLeave,
|
|
3303
3281
|
onFocus: handleFocus,
|
|
3304
3282
|
onBlur: handleBlur
|
|
3305
3283
|
};
|
|
3306
|
-
return Array.isArray(children) ?
|
|
3284
|
+
return Array.isArray(children) ? import_react2.default.createElement(Component, componentProps, ...children) : import_react2.default.createElement(Component, componentProps, children);
|
|
3307
3285
|
}
|
|
3308
3286
|
);
|
|
3309
3287
|
InteractiveWrapper.displayName = "Kbach.InteractiveWrapper";
|
|
3310
3288
|
|
|
3311
3289
|
// src/DarkWrapper.tsx
|
|
3312
|
-
var
|
|
3313
|
-
var DarkWrapper =
|
|
3290
|
+
var import_react3 = __toESM(require("react"));
|
|
3291
|
+
var DarkWrapper = import_react3.default.forwardRef(
|
|
3314
3292
|
function DarkWrapper2({ Component, resolvedStyle, style: styleProp, children, ...rest }, ref) {
|
|
3315
3293
|
const isDark = useGlobalDarkMode();
|
|
3316
3294
|
const needsWidth = hasResponsiveBuckets(resolvedStyle);
|
|
@@ -3318,7 +3296,7 @@ var DarkWrapper = import_react4.default.forwardRef(
|
|
|
3318
3296
|
const breakpoints = needsWidth ? getActiveBreakpoints(width) : EMPTY_BREAKPOINTS;
|
|
3319
3297
|
const screens = getGlobalScreens();
|
|
3320
3298
|
const isNonStringComponent = typeof Component !== "string";
|
|
3321
|
-
const computedStyle = (0,
|
|
3299
|
+
const computedStyle = (0, import_react3.useMemo)(() => {
|
|
3322
3300
|
if (isWeb) return {};
|
|
3323
3301
|
const s = flatten(resolvedStyle, isDark, {}, breakpoints);
|
|
3324
3302
|
stripInternalMarkers(s);
|
|
@@ -3328,40 +3306,10 @@ var DarkWrapper = import_react4.default.forwardRef(
|
|
|
3328
3306
|
const skipComputedInline = isWeb || !isNative && typeof Component === "string";
|
|
3329
3307
|
const finalStyle = skipComputedInline ? styleProp ?? void 0 : styleProp ? Array.isArray(styleProp) ? Object.assign({}, computedStyle, ...styleProp) : { ...computedStyle, ...styleProp } : computedStyle;
|
|
3330
3308
|
const props = { ref, ...rest, style: finalStyle };
|
|
3331
|
-
return Array.isArray(children) ?
|
|
3309
|
+
return Array.isArray(children) ? import_react3.default.createElement(Component, props, ...children) : import_react3.default.createElement(Component, props, children);
|
|
3332
3310
|
}
|
|
3333
3311
|
);
|
|
3334
3312
|
DarkWrapper.displayName = "Kbach.DarkWrapper";
|
|
3335
|
-
function stripInternalMarkers(s) {
|
|
3336
|
-
delete s.__divideX;
|
|
3337
|
-
delete s.__divideY;
|
|
3338
|
-
delete s.__divideColor;
|
|
3339
|
-
delete s.__divideStyle;
|
|
3340
|
-
delete s.__keyframe;
|
|
3341
|
-
}
|
|
3342
|
-
function stripWebOnlyProps(s) {
|
|
3343
|
-
if (s.display === "grid" || s.display === "inline-grid") delete s.display;
|
|
3344
|
-
delete s.gridTemplateColumns;
|
|
3345
|
-
delete s.gridTemplateRows;
|
|
3346
|
-
delete s.gridColumn;
|
|
3347
|
-
delete s.gridRow;
|
|
3348
|
-
delete s.gridArea;
|
|
3349
|
-
delete s.gridColumnStart;
|
|
3350
|
-
delete s.gridColumnEnd;
|
|
3351
|
-
delete s.gridRowStart;
|
|
3352
|
-
delete s.gridRowEnd;
|
|
3353
|
-
delete s.gridAutoFlow;
|
|
3354
|
-
delete s.gridAutoColumns;
|
|
3355
|
-
delete s.gridAutoRows;
|
|
3356
|
-
delete s.placeItems;
|
|
3357
|
-
delete s.placeContent;
|
|
3358
|
-
delete s.justifyItems;
|
|
3359
|
-
delete s.placeSelf;
|
|
3360
|
-
delete s.justifySelf;
|
|
3361
|
-
if (s.position === "sticky" || s.position === "fixed" || s.position === "static") {
|
|
3362
|
-
delete s.position;
|
|
3363
|
-
}
|
|
3364
|
-
}
|
|
3365
3313
|
|
|
3366
3314
|
// src/web-substitute.ts
|
|
3367
3315
|
var _rnToHtml = {
|
|
@@ -3606,13 +3554,11 @@ function transformToWebProps(originalName, tag, props) {
|
|
|
3606
3554
|
continue;
|
|
3607
3555
|
}
|
|
3608
3556
|
if (k === "resizeMode") {
|
|
3609
|
-
|
|
3610
|
-
out.style = { ...existing, objectFit: _resizeModeMap[v] ?? "cover" };
|
|
3557
|
+
pendingStyle = { ...pendingStyle ?? {}, objectFit: _resizeModeMap[v] ?? "cover" };
|
|
3611
3558
|
continue;
|
|
3612
3559
|
}
|
|
3613
3560
|
if (k === "contentFit") {
|
|
3614
|
-
|
|
3615
|
-
out.style = { ...existing, objectFit: v };
|
|
3561
|
+
pendingStyle = { ...pendingStyle ?? {}, objectFit: v };
|
|
3616
3562
|
continue;
|
|
3617
3563
|
}
|
|
3618
3564
|
if (k === "defaultSource") continue;
|
|
@@ -3692,36 +3638,6 @@ function mergeStyle(computed, userStyle) {
|
|
|
3692
3638
|
function makeElement(isStaticChildren, type, props, key) {
|
|
3693
3639
|
return (isStaticChildren ? import_jsx_runtime.jsxs : import_jsx_runtime.jsx)(type, props, key);
|
|
3694
3640
|
}
|
|
3695
|
-
function stripInternalMarkers2(s) {
|
|
3696
|
-
delete s.__divideX;
|
|
3697
|
-
delete s.__divideY;
|
|
3698
|
-
delete s.__divideColor;
|
|
3699
|
-
delete s.__divideStyle;
|
|
3700
|
-
delete s.__keyframe;
|
|
3701
|
-
}
|
|
3702
|
-
function stripWebOnlyInlineProps(s) {
|
|
3703
|
-
if (s.display === "grid" || s.display === "inline-grid") delete s.display;
|
|
3704
|
-
delete s.gridTemplateColumns;
|
|
3705
|
-
delete s.gridTemplateRows;
|
|
3706
|
-
delete s.gridColumn;
|
|
3707
|
-
delete s.gridRow;
|
|
3708
|
-
delete s.gridArea;
|
|
3709
|
-
delete s.gridColumnStart;
|
|
3710
|
-
delete s.gridColumnEnd;
|
|
3711
|
-
delete s.gridRowStart;
|
|
3712
|
-
delete s.gridRowEnd;
|
|
3713
|
-
delete s.gridAutoFlow;
|
|
3714
|
-
delete s.gridAutoColumns;
|
|
3715
|
-
delete s.gridAutoRows;
|
|
3716
|
-
delete s.placeItems;
|
|
3717
|
-
delete s.placeContent;
|
|
3718
|
-
delete s.justifyItems;
|
|
3719
|
-
delete s.placeSelf;
|
|
3720
|
-
delete s.justifySelf;
|
|
3721
|
-
if (s.position === "sticky" || s.position === "fixed" || s.position === "static") {
|
|
3722
|
-
delete s.position;
|
|
3723
|
-
}
|
|
3724
|
-
}
|
|
3725
3641
|
function processElement(type, rawProps, key, isStaticChildren) {
|
|
3726
3642
|
if (type === null || typeof type === "symbol") return makeElement(isStaticChildren, type, rawProps ?? {}, key);
|
|
3727
3643
|
const webTag = isWeb ? getWebTag(type, rawProps ?? void 0) : null;
|
|
@@ -3781,8 +3697,8 @@ function processElement(type, rawProps, key, isStaticChildren) {
|
|
|
3781
3697
|
let finalStyle;
|
|
3782
3698
|
if (!skipComputedInline) {
|
|
3783
3699
|
const computedStyle = flatten(resolved, false);
|
|
3784
|
-
|
|
3785
|
-
if (typeof effectiveType !== "string")
|
|
3700
|
+
stripInternalMarkers(computedStyle);
|
|
3701
|
+
if (typeof effectiveType !== "string") stripWebOnlyProps(computedStyle);
|
|
3786
3702
|
finalStyle = mergeStyle(computedStyle, userStyle);
|
|
3787
3703
|
} else {
|
|
3788
3704
|
finalStyle = userStyle ?? void 0;
|
|
@@ -3803,7 +3719,7 @@ function jsxs(type, props, key) {
|
|
|
3803
3719
|
// src/jsx-dev-runtime.tsx
|
|
3804
3720
|
function jsxDEV(type, props, key, isStaticChildren, source, self) {
|
|
3805
3721
|
const element = (isStaticChildren ? jsxs : jsx)(type, props, key);
|
|
3806
|
-
if (source && element && typeof element === "object") {
|
|
3722
|
+
if (source && element && typeof element === "object" && Object.isExtensible(element)) {
|
|
3807
3723
|
element._source = source;
|
|
3808
3724
|
element._self = self;
|
|
3809
3725
|
}
|