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