@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-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,7 +31,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
31
|
// src/jsx-runtime.tsx
|
|
31
32
|
var jsx_runtime_exports = {};
|
|
32
33
|
__export(jsx_runtime_exports, {
|
|
33
|
-
Fragment: () =>
|
|
34
|
+
Fragment: () => import_react4.Fragment,
|
|
34
35
|
_invalidateDefaultFontCache: () => _invalidateDefaultFontCache,
|
|
35
36
|
jsx: () => jsx,
|
|
36
37
|
jsxs: () => jsxs,
|
|
@@ -38,7 +39,7 @@ __export(jsx_runtime_exports, {
|
|
|
38
39
|
});
|
|
39
40
|
module.exports = __toCommonJS(jsx_runtime_exports);
|
|
40
41
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
41
|
-
var
|
|
42
|
+
var import_react4 = require("react");
|
|
42
43
|
|
|
43
44
|
// src/core/theme.ts
|
|
44
45
|
var defaultColors = {
|
|
@@ -582,10 +583,11 @@ var defaultTheme = {
|
|
|
582
583
|
|
|
583
584
|
// src/core/cache.ts
|
|
584
585
|
var LRUCache = class {
|
|
585
|
-
constructor(capacity = 1e4) {
|
|
586
|
+
constructor(capacity = 1e4, onEvict) {
|
|
586
587
|
this.capacity = capacity;
|
|
587
588
|
if (capacity <= 0) throw new Error("LRUCache: capacity must be a positive integer");
|
|
588
589
|
this.cache = /* @__PURE__ */ new Map();
|
|
590
|
+
this.onEvict = onEvict;
|
|
589
591
|
}
|
|
590
592
|
get(key) {
|
|
591
593
|
if (!this.cache.has(key)) return void 0;
|
|
@@ -598,7 +600,10 @@ var LRUCache = class {
|
|
|
598
600
|
if (this.cache.has(key)) {
|
|
599
601
|
this.cache.delete(key);
|
|
600
602
|
} else if (this.cache.size >= this.capacity) {
|
|
601
|
-
this.cache.
|
|
603
|
+
const oldestKey = this.cache.keys().next().value;
|
|
604
|
+
const oldestValue = this.cache.get(oldestKey);
|
|
605
|
+
this.cache.delete(oldestKey);
|
|
606
|
+
this.onEvict?.(oldestKey, oldestValue);
|
|
602
607
|
}
|
|
603
608
|
this.cache.set(key, value);
|
|
604
609
|
return this;
|
|
@@ -620,9 +625,10 @@ var LRUCache = class {
|
|
|
620
625
|
// src/core/platform.ts
|
|
621
626
|
var isWeb = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
|
|
622
627
|
var isNative = !isWeb && (typeof globalThis.HermesInternal !== "undefined" || typeof globalThis.__fbBatchedBridge !== "undefined" || typeof navigator !== "undefined" && navigator.product === "ReactNative" || typeof globalThis.__REACT_NATIVE__ !== "undefined");
|
|
623
|
-
var
|
|
628
|
+
var _resolveTargetOverride = null;
|
|
624
629
|
function getEffectiveIsWeb() {
|
|
625
|
-
|
|
630
|
+
if (_resolveTargetOverride) return _resolveTargetOverride === "web";
|
|
631
|
+
return isWeb || !isNative;
|
|
626
632
|
}
|
|
627
633
|
function toNativeValue(raw) {
|
|
628
634
|
if (/^-?\d+(\.\d+)?px$/.test(raw)) return parseFloat(raw);
|
|
@@ -809,18 +815,28 @@ function resolveColor(value, colors, isArbitrary) {
|
|
|
809
815
|
if (isNaN(alpha)) return hex;
|
|
810
816
|
return hexToRgba(hex, alpha);
|
|
811
817
|
}
|
|
812
|
-
function
|
|
818
|
+
function parseHexRgb(hex) {
|
|
813
819
|
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);
|
|
820
|
+
if (h.length === 3 || h.length === 4) {
|
|
821
|
+
return [
|
|
822
|
+
parseInt(h[0] + h[0], 16),
|
|
823
|
+
parseInt(h[1] + h[1], 16),
|
|
824
|
+
parseInt(h[2] + h[2], 16)
|
|
825
|
+
];
|
|
823
826
|
}
|
|
827
|
+
if (h.length === 6 || h.length === 8) {
|
|
828
|
+
return [
|
|
829
|
+
parseInt(h.slice(0, 2), 16),
|
|
830
|
+
parseInt(h.slice(2, 4), 16),
|
|
831
|
+
parseInt(h.slice(4, 6), 16)
|
|
832
|
+
];
|
|
833
|
+
}
|
|
834
|
+
return null;
|
|
835
|
+
}
|
|
836
|
+
function hexToRgba(hex, alpha) {
|
|
837
|
+
const rgb = parseHexRgb(hex);
|
|
838
|
+
if (!rgb) return hex;
|
|
839
|
+
const [r, g, b] = rgb;
|
|
824
840
|
return `rgba(${r},${g},${b},${alpha})`;
|
|
825
841
|
}
|
|
826
842
|
function resolveSpacing(value, negative, spacing, isArbitrary) {
|
|
@@ -864,8 +880,8 @@ function resolveFontSize(value, fontSizes, isArbitrary) {
|
|
|
864
880
|
if (isArbitrary) return getEffectiveIsWeb() ? value : toNativeValue(value);
|
|
865
881
|
return fontSizes[value] ?? null;
|
|
866
882
|
}
|
|
867
|
-
var FILTER_COMPOSE = "var(--
|
|
868
|
-
var BACKDROP_FILTER_COMPOSE = "var(--
|
|
883
|
+
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,)";
|
|
884
|
+
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
885
|
var _standalone = null;
|
|
870
886
|
function buildStandalone() {
|
|
871
887
|
const web = getEffectiveIsWeb();
|
|
@@ -1127,9 +1143,9 @@ function buildStandalone() {
|
|
|
1127
1143
|
"backface-visible": { backfaceVisibility: "visible" },
|
|
1128
1144
|
"backface-hidden": { backfaceVisibility: "hidden" },
|
|
1129
1145
|
// CSS filters — standalone = default/full effect (web-only)
|
|
1130
|
-
grayscale: web ? { "--
|
|
1131
|
-
invert: web ? { "--
|
|
1132
|
-
sepia: web ? { "--
|
|
1146
|
+
grayscale: web ? { "--kb-grayscale": "grayscale(100%)", filter: FILTER_COMPOSE } : null,
|
|
1147
|
+
invert: web ? { "--kb-invert": "invert(100%)", filter: FILTER_COMPOSE } : null,
|
|
1148
|
+
sepia: web ? { "--kb-sepia": "sepia(100%)", filter: FILTER_COMPOSE } : null,
|
|
1133
1149
|
// Divide none
|
|
1134
1150
|
"divide-none": web ? { __divideX: 0, __divideY: 0 } : null,
|
|
1135
1151
|
// Group / peer markers (no-op: no style emitted; just ensures isKnownUtility returns true)
|
|
@@ -1214,6 +1230,48 @@ function getStandalone() {
|
|
|
1214
1230
|
if (!_standalone) _standalone = buildStandalone();
|
|
1215
1231
|
return _standalone;
|
|
1216
1232
|
}
|
|
1233
|
+
function makeSpacingResolver(prop) {
|
|
1234
|
+
return ({ value, negative, isArbitrary }, { spacing }) => {
|
|
1235
|
+
const v = resolveSpacing(value, negative, spacing, isArbitrary);
|
|
1236
|
+
return v !== null ? { [prop]: v } : null;
|
|
1237
|
+
};
|
|
1238
|
+
}
|
|
1239
|
+
var PADDING_MARGIN_PROPS = {
|
|
1240
|
+
p: "padding",
|
|
1241
|
+
px: "paddingHorizontal",
|
|
1242
|
+
py: "paddingVertical",
|
|
1243
|
+
pt: "paddingTop",
|
|
1244
|
+
pr: "paddingRight",
|
|
1245
|
+
pb: "paddingBottom",
|
|
1246
|
+
pl: "paddingLeft",
|
|
1247
|
+
m: "margin",
|
|
1248
|
+
mx: "marginHorizontal",
|
|
1249
|
+
my: "marginVertical",
|
|
1250
|
+
mt: "marginTop",
|
|
1251
|
+
mr: "marginRight",
|
|
1252
|
+
mb: "marginBottom",
|
|
1253
|
+
ml: "marginLeft"
|
|
1254
|
+
};
|
|
1255
|
+
function makeBorderSideResolver(widthProp, colorProp) {
|
|
1256
|
+
return ({ value, isArbitrary }, { colors, borderWidth }) => {
|
|
1257
|
+
if (!value) return { [widthProp]: 1 };
|
|
1258
|
+
if (isArbitrary) {
|
|
1259
|
+
const w2 = toNativeValue(value);
|
|
1260
|
+
if (typeof w2 === "number") return { [widthProp]: w2 };
|
|
1261
|
+
return { [colorProp]: value };
|
|
1262
|
+
}
|
|
1263
|
+
const color = resolveColor(value, colors, false);
|
|
1264
|
+
if (color) return { [colorProp]: color };
|
|
1265
|
+
const w = borderWidth[value];
|
|
1266
|
+
return w !== void 0 ? { [widthProp]: w } : null;
|
|
1267
|
+
};
|
|
1268
|
+
}
|
|
1269
|
+
var BORDER_SIDE_PROPS = {
|
|
1270
|
+
"border-t": ["borderTopWidth", "borderTopColor"],
|
|
1271
|
+
"border-r": ["borderRightWidth", "borderRightColor"],
|
|
1272
|
+
"border-b": ["borderBottomWidth", "borderBottomColor"],
|
|
1273
|
+
"border-l": ["borderLeftWidth", "borderLeftColor"]
|
|
1274
|
+
};
|
|
1217
1275
|
var RESOLVERS = {
|
|
1218
1276
|
// ── Background ─────────────────────────────────────────────────────────────
|
|
1219
1277
|
bg: ({ value, isArbitrary }, { colors }) => {
|
|
@@ -1247,64 +1305,8 @@ var RESOLVERS = {
|
|
|
1247
1305
|
const v = isArbitrary ? n > 1 ? n / 100 : n : n / 100;
|
|
1248
1306
|
return { "--text-opacity": v };
|
|
1249
1307
|
},
|
|
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
|
-
},
|
|
1308
|
+
// ── Padding & margin ───────────────────────────────────────────────────────
|
|
1309
|
+
// Generated below via makeSpacingResolver() — see PADDING_MARGIN_PROPS.
|
|
1308
1310
|
// ── Sizing ─────────────────────────────────────────────────────────────────
|
|
1309
1311
|
w: ({ value, isArbitrary }, { spacing }) => {
|
|
1310
1312
|
const v = resolveSizing(value, spacing, isArbitrary);
|
|
@@ -1348,54 +1350,7 @@ var RESOLVERS = {
|
|
|
1348
1350
|
}
|
|
1349
1351
|
return null;
|
|
1350
1352
|
},
|
|
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
|
-
},
|
|
1353
|
+
// border-t/-r/-b/-l generated below via makeBorderSideResolver() — see BORDER_SIDE_PROPS.
|
|
1399
1354
|
// ── Border radius ──────────────────────────────────────────────────────────
|
|
1400
1355
|
rounded: ({ value, isArbitrary }, { borderRadius }) => {
|
|
1401
1356
|
const r = resolveRadius(value, borderRadius, isArbitrary);
|
|
@@ -1627,49 +1582,49 @@ var RESOLVERS = {
|
|
|
1627
1582
|
"2xl": "blur(40px)",
|
|
1628
1583
|
"3xl": "blur(64px)"
|
|
1629
1584
|
};
|
|
1630
|
-
if (value === "none") return { "--
|
|
1585
|
+
if (value === "none") return { "--kb-blur": "", filter: FILTER_COMPOSE };
|
|
1631
1586
|
const v = isArbitrary ? `blur(${value})` : sizes[value];
|
|
1632
|
-
return v !== void 0 ? { "--
|
|
1587
|
+
return v !== void 0 ? { "--kb-blur": v, filter: FILTER_COMPOSE } : null;
|
|
1633
1588
|
},
|
|
1634
1589
|
brightness: ({ value, isArbitrary }) => {
|
|
1635
1590
|
if (!getEffectiveIsWeb()) return null;
|
|
1636
1591
|
const v = isArbitrary ? `brightness(${value})` : `brightness(${parseFloat(value) / 100})`;
|
|
1637
|
-
return isNaN(parseFloat(value)) && !isArbitrary ? null : { "--
|
|
1592
|
+
return isNaN(parseFloat(value)) && !isArbitrary ? null : { "--kb-brightness": v, filter: FILTER_COMPOSE };
|
|
1638
1593
|
},
|
|
1639
1594
|
contrast: ({ value, isArbitrary }) => {
|
|
1640
1595
|
if (!getEffectiveIsWeb()) return null;
|
|
1641
1596
|
const v = isArbitrary ? `contrast(${value})` : `contrast(${parseFloat(value) / 100})`;
|
|
1642
|
-
return isNaN(parseFloat(value)) && !isArbitrary ? null : { "--
|
|
1597
|
+
return isNaN(parseFloat(value)) && !isArbitrary ? null : { "--kb-contrast": v, filter: FILTER_COMPOSE };
|
|
1643
1598
|
},
|
|
1644
1599
|
grayscale: ({ value }) => {
|
|
1645
1600
|
if (!getEffectiveIsWeb()) return null;
|
|
1646
1601
|
const v = value === "0" ? "grayscale(0)" : "grayscale(100%)";
|
|
1647
|
-
return { "--
|
|
1602
|
+
return { "--kb-grayscale": v, filter: FILTER_COMPOSE };
|
|
1648
1603
|
},
|
|
1649
1604
|
"hue-rotate": ({ value, negative, isArbitrary }) => {
|
|
1650
1605
|
if (!getEffectiveIsWeb()) return null;
|
|
1651
1606
|
const deg = isArbitrary ? value : `${(negative ? -1 : 1) * parseFloat(value)}deg`;
|
|
1652
1607
|
if (isNaN(parseFloat(deg)) && !isArbitrary) return null;
|
|
1653
|
-
return { "--
|
|
1608
|
+
return { "--kb-hue-rotate": `hue-rotate(${deg})`, filter: FILTER_COMPOSE };
|
|
1654
1609
|
},
|
|
1655
1610
|
invert: ({ value }) => {
|
|
1656
1611
|
if (!getEffectiveIsWeb()) return null;
|
|
1657
1612
|
const v = value === "0" ? "invert(0)" : "invert(100%)";
|
|
1658
|
-
return { "--
|
|
1613
|
+
return { "--kb-invert": v, filter: FILTER_COMPOSE };
|
|
1659
1614
|
},
|
|
1660
1615
|
saturate: ({ value, isArbitrary }) => {
|
|
1661
1616
|
if (!getEffectiveIsWeb()) return null;
|
|
1662
1617
|
const v = isArbitrary ? `saturate(${value})` : `saturate(${parseFloat(value) / 100})`;
|
|
1663
|
-
return isNaN(parseFloat(value)) && !isArbitrary ? null : { "--
|
|
1618
|
+
return isNaN(parseFloat(value)) && !isArbitrary ? null : { "--kb-saturate": v, filter: FILTER_COMPOSE };
|
|
1664
1619
|
},
|
|
1665
1620
|
sepia: ({ value }) => {
|
|
1666
1621
|
if (!getEffectiveIsWeb()) return null;
|
|
1667
1622
|
const v = value === "0" ? "sepia(0)" : "sepia(100%)";
|
|
1668
|
-
return { "--
|
|
1623
|
+
return { "--kb-sepia": v, filter: FILTER_COMPOSE };
|
|
1669
1624
|
},
|
|
1670
1625
|
"drop-shadow": ({ value, isArbitrary }) => {
|
|
1671
1626
|
if (!getEffectiveIsWeb()) return null;
|
|
1672
|
-
if (isArbitrary) return { "--
|
|
1627
|
+
if (isArbitrary) return { "--kb-drop-shadow": `drop-shadow(${value.replace(/_/g, " ")})`, filter: FILTER_COMPOSE };
|
|
1673
1628
|
const presets = {
|
|
1674
1629
|
"": "drop-shadow(0 1px 2px rgb(0 0 0/0.1)) drop-shadow(0 1px 1px rgb(0 0 0/0.06))",
|
|
1675
1630
|
sm: "drop-shadow(0 1px 1px rgb(0 0 0/0.05))",
|
|
@@ -1680,7 +1635,7 @@ var RESOLVERS = {
|
|
|
1680
1635
|
none: "drop-shadow(0 0 #0000)"
|
|
1681
1636
|
};
|
|
1682
1637
|
const v = presets[value];
|
|
1683
|
-
return v !== void 0 ? { "--
|
|
1638
|
+
return v !== void 0 ? { "--kb-drop-shadow": v, filter: FILTER_COMPOSE } : null;
|
|
1684
1639
|
},
|
|
1685
1640
|
// Arbitrary full filter string: filter-[blur(4px)_grayscale(1)]
|
|
1686
1641
|
filter: ({ value, isArbitrary }) => {
|
|
@@ -1701,47 +1656,47 @@ var RESOLVERS = {
|
|
|
1701
1656
|
"2xl": "blur(40px)",
|
|
1702
1657
|
"3xl": "blur(64px)"
|
|
1703
1658
|
};
|
|
1704
|
-
if (value === "none") return { "--
|
|
1659
|
+
if (value === "none") return { "--kb-backdrop-blur": "", backdropFilter: BACKDROP_FILTER_COMPOSE };
|
|
1705
1660
|
const v = isArbitrary ? `blur(${value})` : sizes[value];
|
|
1706
|
-
return v !== void 0 ? { "--
|
|
1661
|
+
return v !== void 0 ? { "--kb-backdrop-blur": v, backdropFilter: BACKDROP_FILTER_COMPOSE } : null;
|
|
1707
1662
|
},
|
|
1708
1663
|
"backdrop-brightness": ({ value, isArbitrary }) => {
|
|
1709
1664
|
if (!getEffectiveIsWeb()) return null;
|
|
1710
1665
|
const v = isArbitrary ? `brightness(${value})` : `brightness(${parseFloat(value) / 100})`;
|
|
1711
|
-
return isNaN(parseFloat(value)) && !isArbitrary ? null : { "--
|
|
1666
|
+
return isNaN(parseFloat(value)) && !isArbitrary ? null : { "--kb-backdrop-brightness": v, backdropFilter: BACKDROP_FILTER_COMPOSE };
|
|
1712
1667
|
},
|
|
1713
1668
|
"backdrop-contrast": ({ value, isArbitrary }) => {
|
|
1714
1669
|
if (!getEffectiveIsWeb()) return null;
|
|
1715
1670
|
const v = isArbitrary ? `contrast(${value})` : `contrast(${parseFloat(value) / 100})`;
|
|
1716
|
-
return isNaN(parseFloat(value)) && !isArbitrary ? null : { "--
|
|
1671
|
+
return isNaN(parseFloat(value)) && !isArbitrary ? null : { "--kb-backdrop-contrast": v, backdropFilter: BACKDROP_FILTER_COMPOSE };
|
|
1717
1672
|
},
|
|
1718
1673
|
"backdrop-grayscale": ({ value }) => {
|
|
1719
1674
|
if (!getEffectiveIsWeb()) return null;
|
|
1720
|
-
return { "--
|
|
1675
|
+
return { "--kb-backdrop-grayscale": value === "0" ? "grayscale(0)" : "grayscale(100%)", backdropFilter: BACKDROP_FILTER_COMPOSE };
|
|
1721
1676
|
},
|
|
1722
1677
|
"backdrop-hue-rotate": ({ value, negative, isArbitrary }) => {
|
|
1723
1678
|
if (!getEffectiveIsWeb()) return null;
|
|
1724
1679
|
const deg = isArbitrary ? value : `${(negative ? -1 : 1) * parseFloat(value)}deg`;
|
|
1725
1680
|
if (isNaN(parseFloat(deg)) && !isArbitrary) return null;
|
|
1726
|
-
return { "--
|
|
1681
|
+
return { "--kb-backdrop-hue-rotate": `hue-rotate(${deg})`, backdropFilter: BACKDROP_FILTER_COMPOSE };
|
|
1727
1682
|
},
|
|
1728
1683
|
"backdrop-invert": ({ value }) => {
|
|
1729
1684
|
if (!getEffectiveIsWeb()) return null;
|
|
1730
|
-
return { "--
|
|
1685
|
+
return { "--kb-backdrop-invert": value === "0" ? "invert(0)" : "invert(100%)", backdropFilter: BACKDROP_FILTER_COMPOSE };
|
|
1731
1686
|
},
|
|
1732
1687
|
"backdrop-opacity": ({ value, isArbitrary }) => {
|
|
1733
1688
|
if (!getEffectiveIsWeb()) return null;
|
|
1734
1689
|
const v = isArbitrary ? `opacity(${value})` : `opacity(${parseFloat(value) / 100})`;
|
|
1735
|
-
return isNaN(parseFloat(value)) && !isArbitrary ? null : { "--
|
|
1690
|
+
return isNaN(parseFloat(value)) && !isArbitrary ? null : { "--kb-backdrop-opacity": v, backdropFilter: BACKDROP_FILTER_COMPOSE };
|
|
1736
1691
|
},
|
|
1737
1692
|
"backdrop-saturate": ({ value, isArbitrary }) => {
|
|
1738
1693
|
if (!getEffectiveIsWeb()) return null;
|
|
1739
1694
|
const v = isArbitrary ? `saturate(${value})` : `saturate(${parseFloat(value) / 100})`;
|
|
1740
|
-
return isNaN(parseFloat(value)) && !isArbitrary ? null : { "--
|
|
1695
|
+
return isNaN(parseFloat(value)) && !isArbitrary ? null : { "--kb-backdrop-saturate": v, backdropFilter: BACKDROP_FILTER_COMPOSE };
|
|
1741
1696
|
},
|
|
1742
1697
|
"backdrop-sepia": ({ value }) => {
|
|
1743
1698
|
if (!getEffectiveIsWeb()) return null;
|
|
1744
|
-
return { "--
|
|
1699
|
+
return { "--kb-backdrop-sepia": value === "0" ? "sepia(0)" : "sepia(100%)", backdropFilter: BACKDROP_FILTER_COMPOSE };
|
|
1745
1700
|
},
|
|
1746
1701
|
"backdrop-filter": ({ value, isArbitrary }) => {
|
|
1747
1702
|
if (!getEffectiveIsWeb()) return null;
|
|
@@ -1765,7 +1720,7 @@ var RESOLVERS = {
|
|
|
1765
1720
|
const dir = directions[value];
|
|
1766
1721
|
if (!dir) return null;
|
|
1767
1722
|
return {
|
|
1768
|
-
backgroundImage: `linear-gradient(${dir}, var(--
|
|
1723
|
+
backgroundImage: `linear-gradient(${dir}, var(--kb-gradient-from, transparent), var(--kb-gradient-stops, transparent))`
|
|
1769
1724
|
};
|
|
1770
1725
|
},
|
|
1771
1726
|
from: ({ value, isArbitrary }, { colors }) => {
|
|
@@ -1773,8 +1728,8 @@ var RESOLVERS = {
|
|
|
1773
1728
|
const color = resolveColor(value, colors, isArbitrary);
|
|
1774
1729
|
if (!color) return null;
|
|
1775
1730
|
return {
|
|
1776
|
-
"--
|
|
1777
|
-
"--
|
|
1731
|
+
"--kb-gradient-from": color,
|
|
1732
|
+
"--kb-gradient-stops": `var(--kb-gradient-from), var(--kb-gradient-to, transparent)`
|
|
1778
1733
|
};
|
|
1779
1734
|
},
|
|
1780
1735
|
via: ({ value, isArbitrary }, { colors }) => {
|
|
@@ -1782,15 +1737,15 @@ var RESOLVERS = {
|
|
|
1782
1737
|
const color = resolveColor(value, colors, isArbitrary);
|
|
1783
1738
|
if (!color) return null;
|
|
1784
1739
|
return {
|
|
1785
|
-
"--
|
|
1786
|
-
"--
|
|
1740
|
+
"--kb-gradient-via": color,
|
|
1741
|
+
"--kb-gradient-stops": `var(--kb-gradient-from), var(--kb-gradient-via), var(--kb-gradient-to, transparent)`
|
|
1787
1742
|
};
|
|
1788
1743
|
},
|
|
1789
1744
|
to: ({ value, isArbitrary }, { colors }) => {
|
|
1790
1745
|
if (!getEffectiveIsWeb()) return null;
|
|
1791
1746
|
const color = resolveColor(value, colors, isArbitrary);
|
|
1792
1747
|
if (!color) return null;
|
|
1793
|
-
return { "--
|
|
1748
|
+
return { "--kb-gradient-to": color };
|
|
1794
1749
|
},
|
|
1795
1750
|
// ── Transform extras (web-only) ───────────────────────────────────────────
|
|
1796
1751
|
"skew-x": ({ value, negative, isArbitrary }) => {
|
|
@@ -2394,6 +2349,12 @@ var RESOLVERS = {
|
|
|
2394
2349
|
return { rowGap: v };
|
|
2395
2350
|
}
|
|
2396
2351
|
};
|
|
2352
|
+
for (const [utility, prop] of Object.entries(PADDING_MARGIN_PROPS)) {
|
|
2353
|
+
RESOLVERS[utility] = makeSpacingResolver(prop);
|
|
2354
|
+
}
|
|
2355
|
+
for (const [utility, [widthProp, colorProp]] of Object.entries(BORDER_SIDE_PROPS)) {
|
|
2356
|
+
RESOLVERS[utility] = makeBorderSideResolver(widthProp, colorProp);
|
|
2357
|
+
}
|
|
2397
2358
|
function resolveUtility(parsed, theme) {
|
|
2398
2359
|
if (!parsed.value) {
|
|
2399
2360
|
if (parsed.utility in PLUGIN_STANDALONE) return PLUGIN_STANDALONE[parsed.utility] ?? null;
|
|
@@ -2652,7 +2613,20 @@ function getDefaultFontFamily() {
|
|
|
2652
2613
|
return globalThis[FONT_KEY];
|
|
2653
2614
|
}
|
|
2654
2615
|
var _styleEl = null;
|
|
2655
|
-
|
|
2616
|
+
function evictInjectedRule(rule) {
|
|
2617
|
+
const sheet = _styleEl?.sheet;
|
|
2618
|
+
if (!sheet) return;
|
|
2619
|
+
for (let i = 0; i < sheet.cssRules.length; i++) {
|
|
2620
|
+
if (sheet.cssRules[i].cssText === rule) {
|
|
2621
|
+
try {
|
|
2622
|
+
sheet.deleteRule(i);
|
|
2623
|
+
} catch {
|
|
2624
|
+
}
|
|
2625
|
+
return;
|
|
2626
|
+
}
|
|
2627
|
+
}
|
|
2628
|
+
}
|
|
2629
|
+
var _injectedRules = new LRUCache(5e4, evictInjectedRule);
|
|
2656
2630
|
var _CSS_DISABLED_KEY = "__kbach_runtime_css_disabled__";
|
|
2657
2631
|
function isRuntimeCSSDisabled() {
|
|
2658
2632
|
return !!globalThis[_CSS_DISABLED_KEY];
|
|
@@ -2686,8 +2660,7 @@ function injectGlobalStyles(theme) {
|
|
|
2686
2660
|
if (typeof document === "undefined" || isRuntimeCSSDisabled()) return;
|
|
2687
2661
|
const rules = [BASE_RESET];
|
|
2688
2662
|
const ff = theme.fontFamily;
|
|
2689
|
-
if (
|
|
2690
|
-
if (ff.sans && ff.sans !== "System") {
|
|
2663
|
+
if (ff?.sans && ff.sans !== "System") {
|
|
2691
2664
|
const family = Array.isArray(ff.sans) ? ff.sans.join(", ") : ff.sans;
|
|
2692
2665
|
rules.push(`body { font-family: ${family}; }`);
|
|
2693
2666
|
}
|
|
@@ -2850,7 +2823,7 @@ function buildClassCSSRules(cls, bucketKey, styles, darkMode, important, screens
|
|
|
2850
2823
|
else rule = `[data-theme="dark"] ${selector} { ${decls} }`;
|
|
2851
2824
|
} else if (darkScheme === "light") {
|
|
2852
2825
|
if (darkMode === "media") rule = `@media (prefers-color-scheme: light) { ${selector} { ${decls} } }`;
|
|
2853
|
-
else if (darkMode === "class") rule =
|
|
2826
|
+
else if (darkMode === "class") rule = `.light ${selector} { ${decls} }`;
|
|
2854
2827
|
else rule = `[data-theme="light"] ${selector} { ${decls} }`;
|
|
2855
2828
|
} else {
|
|
2856
2829
|
rule = `${selector} { ${decls} }`;
|
|
@@ -2970,11 +2943,14 @@ function getConfig() {
|
|
|
2970
2943
|
return store.resolved;
|
|
2971
2944
|
}
|
|
2972
2945
|
function resolveOneRef(ref, colors) {
|
|
2973
|
-
const
|
|
2974
|
-
if (
|
|
2975
|
-
const
|
|
2946
|
+
const lastDash = ref.lastIndexOf("-");
|
|
2947
|
+
if (lastDash <= 0) return null;
|
|
2948
|
+
const name = ref.slice(0, lastDash);
|
|
2949
|
+
const shade = ref.slice(lastDash + 1);
|
|
2950
|
+
if (!/^\d+$/.test(shade)) return null;
|
|
2951
|
+
const entry = colors[name];
|
|
2976
2952
|
if (!entry || typeof entry !== "object") return null;
|
|
2977
|
-
return entry[
|
|
2953
|
+
return entry[shade] ?? null;
|
|
2978
2954
|
}
|
|
2979
2955
|
function resolveColorRefs(colors) {
|
|
2980
2956
|
const MAX_DEPTH = 5;
|
|
@@ -3004,7 +2980,7 @@ function resolveColorRefs(colors) {
|
|
|
3004
2980
|
function buildConfig(userConfig) {
|
|
3005
2981
|
let theme = { ...defaultTheme };
|
|
3006
2982
|
if (userConfig.theme) {
|
|
3007
|
-
theme =
|
|
2983
|
+
theme = { ...theme, ...userConfig.theme };
|
|
3008
2984
|
}
|
|
3009
2985
|
if (userConfig.extend) {
|
|
3010
2986
|
const extendConfig = userConfig.extend;
|
|
@@ -3132,15 +3108,17 @@ function subscribeGlobalDarkMode(callback) {
|
|
|
3132
3108
|
}
|
|
3133
3109
|
|
|
3134
3110
|
// src/InteractiveWrapper.tsx
|
|
3135
|
-
var
|
|
3111
|
+
var import_react2 = __toESM(require("react"));
|
|
3136
3112
|
|
|
3137
|
-
// src/
|
|
3113
|
+
// src/useSyncExternalStoreShim.ts
|
|
3138
3114
|
var import_react = __toESM(require("react"));
|
|
3139
3115
|
var useSyncExternalStore = import_react.default.useSyncExternalStore ?? function useSyncExternalStoreFallback(subscribe, getSnapshot, _getServerSnapshot) {
|
|
3140
3116
|
const [, forceUpdate] = import_react.default.useReducer((n) => n + 1, 0);
|
|
3141
3117
|
import_react.default.useEffect(() => subscribe(forceUpdate), [subscribe]);
|
|
3142
3118
|
return getSnapshot();
|
|
3143
3119
|
};
|
|
3120
|
+
|
|
3121
|
+
// src/useGlobalDarkMode.ts
|
|
3144
3122
|
function useGlobalDarkMode() {
|
|
3145
3123
|
return useSyncExternalStore(
|
|
3146
3124
|
subscribeGlobalDarkMode,
|
|
@@ -3151,12 +3129,6 @@ function useGlobalDarkMode() {
|
|
|
3151
3129
|
}
|
|
3152
3130
|
|
|
3153
3131
|
// 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
3132
|
var NOOP_SUB = (_) => () => {
|
|
3161
3133
|
};
|
|
3162
3134
|
var ZERO_SNAP = () => 0;
|
|
@@ -3190,7 +3162,7 @@ function getWebWidth() {
|
|
|
3190
3162
|
return typeof window !== "undefined" ? window.innerWidth : 0;
|
|
3191
3163
|
}
|
|
3192
3164
|
function useConditionalWidth(active) {
|
|
3193
|
-
return
|
|
3165
|
+
return useSyncExternalStore(
|
|
3194
3166
|
active ? isWeb ? subscribeWebWidth : subscribeGlobalWidth : NOOP_SUB,
|
|
3195
3167
|
active ? isWeb ? getWebWidth : getGlobalWidth : ZERO_SNAP,
|
|
3196
3168
|
ZERO_SNAP
|
|
@@ -3208,15 +3180,45 @@ function hasResponsiveBuckets(resolved) {
|
|
|
3208
3180
|
}
|
|
3209
3181
|
return false;
|
|
3210
3182
|
}
|
|
3211
|
-
|
|
3212
|
-
// src/InteractiveWrapper.tsx
|
|
3213
3183
|
function chain(original, extra) {
|
|
3214
3184
|
return (...args) => {
|
|
3215
3185
|
original?.(...args);
|
|
3216
3186
|
extra();
|
|
3217
3187
|
};
|
|
3218
3188
|
}
|
|
3219
|
-
|
|
3189
|
+
function stripInternalMarkers(s) {
|
|
3190
|
+
delete s.__divideX;
|
|
3191
|
+
delete s.__divideY;
|
|
3192
|
+
delete s.__divideColor;
|
|
3193
|
+
delete s.__divideStyle;
|
|
3194
|
+
delete s.__keyframe;
|
|
3195
|
+
}
|
|
3196
|
+
function stripWebOnlyProps(s) {
|
|
3197
|
+
if (s.display === "grid" || s.display === "inline-grid") delete s.display;
|
|
3198
|
+
delete s.gridTemplateColumns;
|
|
3199
|
+
delete s.gridTemplateRows;
|
|
3200
|
+
delete s.gridColumn;
|
|
3201
|
+
delete s.gridRow;
|
|
3202
|
+
delete s.gridArea;
|
|
3203
|
+
delete s.gridColumnStart;
|
|
3204
|
+
delete s.gridColumnEnd;
|
|
3205
|
+
delete s.gridRowStart;
|
|
3206
|
+
delete s.gridRowEnd;
|
|
3207
|
+
delete s.gridAutoFlow;
|
|
3208
|
+
delete s.gridAutoColumns;
|
|
3209
|
+
delete s.gridAutoRows;
|
|
3210
|
+
delete s.placeItems;
|
|
3211
|
+
delete s.placeContent;
|
|
3212
|
+
delete s.justifyItems;
|
|
3213
|
+
delete s.placeSelf;
|
|
3214
|
+
delete s.justifySelf;
|
|
3215
|
+
if (s.position === "sticky" || s.position === "fixed" || s.position === "static") {
|
|
3216
|
+
delete s.position;
|
|
3217
|
+
}
|
|
3218
|
+
}
|
|
3219
|
+
|
|
3220
|
+
// src/InteractiveWrapper.tsx
|
|
3221
|
+
var InteractiveWrapper = (0, import_react2.forwardRef)(
|
|
3220
3222
|
function InteractiveWrapper2({
|
|
3221
3223
|
Component,
|
|
3222
3224
|
resolvedStyle,
|
|
@@ -3227,6 +3229,7 @@ var InteractiveWrapper = (0, import_react3.forwardRef)(
|
|
|
3227
3229
|
onPointerDown,
|
|
3228
3230
|
onPointerUp,
|
|
3229
3231
|
onPointerLeave,
|
|
3232
|
+
onPointerCancel,
|
|
3230
3233
|
onMouseEnter,
|
|
3231
3234
|
onMouseLeave,
|
|
3232
3235
|
onFocus,
|
|
@@ -3237,51 +3240,26 @@ var InteractiveWrapper = (0, import_react3.forwardRef)(
|
|
|
3237
3240
|
const needsWidth = hasResponsiveBuckets(resolvedStyle);
|
|
3238
3241
|
const width = useConditionalWidth(needsWidth);
|
|
3239
3242
|
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
|
|
3243
|
+
const [pressed, setPressed] = (0, import_react2.useState)(false);
|
|
3244
|
+
const [hovered, setHovered] = (0, import_react2.useState)(false);
|
|
3245
|
+
const [focused, setFocused] = (0, import_react2.useState)(false);
|
|
3246
|
+
const handlePressIn = (0, import_react2.useCallback)(chain(onPressIn, () => setPressed(true)), [onPressIn]);
|
|
3247
|
+
const handlePressOut = (0, import_react2.useCallback)(chain(onPressOut, () => setPressed(false)), [onPressOut]);
|
|
3248
|
+
const handlePointerDown = (0, import_react2.useCallback)(chain(onPointerDown, () => setPressed(true)), [onPointerDown]);
|
|
3249
|
+
const handlePointerUp = (0, import_react2.useCallback)(chain(onPointerUp, () => setPressed(false)), [onPointerUp]);
|
|
3250
|
+
const handlePointerLeave = (0, import_react2.useCallback)(chain(onPointerLeave, () => setPressed(false)), [onPointerLeave]);
|
|
3251
|
+
const handlePointerCancel = (0, import_react2.useCallback)(chain(onPointerCancel, () => setPressed(false)), [onPointerCancel]);
|
|
3252
|
+
const handleMouseEnter = (0, import_react2.useCallback)(chain(onMouseEnter, () => setHovered(true)), [onMouseEnter]);
|
|
3253
|
+
const handleMouseLeave = (0, import_react2.useCallback)(chain(onMouseLeave, () => setHovered(false)), [onMouseLeave]);
|
|
3254
|
+
const handleFocus = (0, import_react2.useCallback)(chain(onFocus, () => setFocused(true)), [onFocus]);
|
|
3255
|
+
const handleBlur = (0, import_react2.useCallback)(chain(onBlur, () => setFocused(false)), [onBlur]);
|
|
3252
3256
|
const { children, disabled, checked, ...restForComponent } = rest;
|
|
3253
|
-
const computedStyle = (0,
|
|
3257
|
+
const computedStyle = (0, import_react2.useMemo)(
|
|
3254
3258
|
() => {
|
|
3255
3259
|
if (isWeb) return {};
|
|
3256
3260
|
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
|
-
}
|
|
3261
|
+
stripInternalMarkers(s);
|
|
3262
|
+
if (typeof Component !== "string") stripWebOnlyProps(s);
|
|
3285
3263
|
return s;
|
|
3286
3264
|
},
|
|
3287
3265
|
[resolvedStyle, isDark, pressed, hovered, focused, width, disabled, checked]
|
|
@@ -3298,20 +3276,20 @@ var InteractiveWrapper = (0, import_react3.forwardRef)(
|
|
|
3298
3276
|
// On web, onPointerDown/Up drive the wrapper's own pressed state (covers mouse + touch),
|
|
3299
3277
|
// but onPressIn/onPressOut are still forwarded unchanged — react-native-web components
|
|
3300
3278
|
// (and any component that accepts both prop names) depend on receiving them directly.
|
|
3301
|
-
...!isNative ? { onPointerDown: handlePointerDown, onPointerUp: handlePointerUp, onPointerLeave: handlePointerLeave, onPointerCancel:
|
|
3279
|
+
...!isNative ? { onPointerDown: handlePointerDown, onPointerUp: handlePointerUp, onPointerLeave: handlePointerLeave, onPointerCancel: handlePointerCancel, onPressIn, onPressOut } : { onPressIn: handlePressIn, onPressOut: handlePressOut },
|
|
3302
3280
|
onMouseEnter: handleMouseEnter,
|
|
3303
3281
|
onMouseLeave: handleMouseLeave,
|
|
3304
3282
|
onFocus: handleFocus,
|
|
3305
3283
|
onBlur: handleBlur
|
|
3306
3284
|
};
|
|
3307
|
-
return Array.isArray(children) ?
|
|
3285
|
+
return Array.isArray(children) ? import_react2.default.createElement(Component, componentProps, ...children) : import_react2.default.createElement(Component, componentProps, children);
|
|
3308
3286
|
}
|
|
3309
3287
|
);
|
|
3310
3288
|
InteractiveWrapper.displayName = "Kbach.InteractiveWrapper";
|
|
3311
3289
|
|
|
3312
3290
|
// src/DarkWrapper.tsx
|
|
3313
|
-
var
|
|
3314
|
-
var DarkWrapper =
|
|
3291
|
+
var import_react3 = __toESM(require("react"));
|
|
3292
|
+
var DarkWrapper = import_react3.default.forwardRef(
|
|
3315
3293
|
function DarkWrapper2({ Component, resolvedStyle, style: styleProp, children, ...rest }, ref) {
|
|
3316
3294
|
const isDark = useGlobalDarkMode();
|
|
3317
3295
|
const needsWidth = hasResponsiveBuckets(resolvedStyle);
|
|
@@ -3319,7 +3297,7 @@ var DarkWrapper = import_react4.default.forwardRef(
|
|
|
3319
3297
|
const breakpoints = needsWidth ? getActiveBreakpoints(width) : EMPTY_BREAKPOINTS;
|
|
3320
3298
|
const screens = getGlobalScreens();
|
|
3321
3299
|
const isNonStringComponent = typeof Component !== "string";
|
|
3322
|
-
const computedStyle = (0,
|
|
3300
|
+
const computedStyle = (0, import_react3.useMemo)(() => {
|
|
3323
3301
|
if (isWeb) return {};
|
|
3324
3302
|
const s = flatten(resolvedStyle, isDark, {}, breakpoints);
|
|
3325
3303
|
stripInternalMarkers(s);
|
|
@@ -3329,40 +3307,10 @@ var DarkWrapper = import_react4.default.forwardRef(
|
|
|
3329
3307
|
const skipComputedInline = isWeb || !isNative && typeof Component === "string";
|
|
3330
3308
|
const finalStyle = skipComputedInline ? styleProp ?? void 0 : styleProp ? Array.isArray(styleProp) ? Object.assign({}, computedStyle, ...styleProp) : { ...computedStyle, ...styleProp } : computedStyle;
|
|
3331
3309
|
const props = { ref, ...rest, style: finalStyle };
|
|
3332
|
-
return Array.isArray(children) ?
|
|
3310
|
+
return Array.isArray(children) ? import_react3.default.createElement(Component, props, ...children) : import_react3.default.createElement(Component, props, children);
|
|
3333
3311
|
}
|
|
3334
3312
|
);
|
|
3335
3313
|
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
3314
|
|
|
3367
3315
|
// src/web-substitute.ts
|
|
3368
3316
|
var _rnToHtml = {
|
|
@@ -3612,13 +3560,11 @@ function transformToWebProps(originalName, tag, props) {
|
|
|
3612
3560
|
continue;
|
|
3613
3561
|
}
|
|
3614
3562
|
if (k === "resizeMode") {
|
|
3615
|
-
|
|
3616
|
-
out.style = { ...existing, objectFit: _resizeModeMap[v] ?? "cover" };
|
|
3563
|
+
pendingStyle = { ...pendingStyle ?? {}, objectFit: _resizeModeMap[v] ?? "cover" };
|
|
3617
3564
|
continue;
|
|
3618
3565
|
}
|
|
3619
3566
|
if (k === "contentFit") {
|
|
3620
|
-
|
|
3621
|
-
out.style = { ...existing, objectFit: v };
|
|
3567
|
+
pendingStyle = { ...pendingStyle ?? {}, objectFit: v };
|
|
3622
3568
|
continue;
|
|
3623
3569
|
}
|
|
3624
3570
|
if (k === "defaultSource") continue;
|
|
@@ -3698,36 +3644,6 @@ function mergeStyle(computed, userStyle) {
|
|
|
3698
3644
|
function makeElement(isStaticChildren, type, props, key) {
|
|
3699
3645
|
return (isStaticChildren ? import_jsx_runtime.jsxs : import_jsx_runtime.jsx)(type, props, key);
|
|
3700
3646
|
}
|
|
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
3647
|
function processElement(type, rawProps, key, isStaticChildren) {
|
|
3732
3648
|
if (type === null || typeof type === "symbol") return makeElement(isStaticChildren, type, rawProps ?? {}, key);
|
|
3733
3649
|
const webTag = isWeb ? getWebTag(type, rawProps ?? void 0) : null;
|
|
@@ -3787,8 +3703,8 @@ function processElement(type, rawProps, key, isStaticChildren) {
|
|
|
3787
3703
|
let finalStyle;
|
|
3788
3704
|
if (!skipComputedInline) {
|
|
3789
3705
|
const computedStyle = flatten(resolved, false);
|
|
3790
|
-
|
|
3791
|
-
if (typeof effectiveType !== "string")
|
|
3706
|
+
stripInternalMarkers(computedStyle);
|
|
3707
|
+
if (typeof effectiveType !== "string") stripWebOnlyProps(computedStyle);
|
|
3792
3708
|
finalStyle = mergeStyle(computedStyle, userStyle);
|
|
3793
3709
|
} else {
|
|
3794
3710
|
finalStyle = userStyle ?? void 0;
|