@kbach/react 0.1.9 → 0.2.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.
@@ -1173,62 +1173,64 @@ function resolveFontSize(value, fontSizes, isArbitrary) {
1173
1173
  }
1174
1174
  var STANDALONE = {
1175
1175
  // Display
1176
- flex: { display: "flex" },
1177
- block: { display: "block" },
1178
- "inline-block": { display: "inline-block" },
1179
- inline: { display: "inline" },
1180
- grid: { display: "grid" },
1181
- "inline-flex": { display: "inline-flex" },
1182
- "inline-grid": { display: "inline-grid" },
1176
+ // On native, Views are flex containers by default — `display: 'flex'` is a no-op.
1177
+ // `grid`, `inline-*`, `contents`, `flow-root` have no native equivalent.
1178
+ flex: isWeb ? { display: "flex" } : {},
1179
+ block: isWeb ? { display: "block" } : null,
1180
+ "inline-block": isWeb ? { display: "inline-block" } : null,
1181
+ inline: isWeb ? { display: "inline" } : null,
1182
+ grid: isWeb ? { display: "grid" } : null,
1183
+ "inline-flex": isWeb ? { display: "inline-flex" } : {},
1184
+ "inline-grid": isWeb ? { display: "inline-grid" } : null,
1183
1185
  hidden: { display: "none" },
1184
- contents: { display: "contents" },
1185
- "flow-root": { display: "flow-root" },
1186
- // Flex direction
1186
+ contents: isWeb ? { display: "contents" } : null,
1187
+ "flow-root": isWeb ? { display: "flow-root" } : null,
1188
+ // Flex direction (both web and native)
1187
1189
  "flex-row": { flexDirection: "row" },
1188
1190
  "flex-col": { flexDirection: "column" },
1189
1191
  "flex-row-reverse": { flexDirection: "row-reverse" },
1190
1192
  "flex-col-reverse": { flexDirection: "column-reverse" },
1191
- // Flex wrap
1193
+ // Flex wrap (both)
1192
1194
  "flex-wrap": { flexWrap: "wrap" },
1193
1195
  "flex-wrap-reverse": { flexWrap: "wrap-reverse" },
1194
1196
  "flex-nowrap": { flexWrap: "nowrap" },
1195
- // Flex grow / shrink
1197
+ // Flex grow / shrink (both)
1196
1198
  "flex-grow": { flexGrow: 1 },
1197
1199
  "flex-grow-0": { flexGrow: 0 },
1198
1200
  "flex-shrink": { flexShrink: 1 },
1199
1201
  "flex-shrink-0": { flexShrink: 0 },
1200
- // Align items
1202
+ // Align items (both)
1201
1203
  "items-start": { alignItems: "flex-start" },
1202
1204
  "items-end": { alignItems: "flex-end" },
1203
1205
  "items-center": { alignItems: "center" },
1204
1206
  "items-baseline": { alignItems: "baseline" },
1205
1207
  "items-stretch": { alignItems: "stretch" },
1206
- // Justify content
1208
+ // Justify content (both)
1207
1209
  "justify-start": { justifyContent: "flex-start" },
1208
1210
  "justify-end": { justifyContent: "flex-end" },
1209
1211
  "justify-center": { justifyContent: "center" },
1210
1212
  "justify-between": { justifyContent: "space-between" },
1211
1213
  "justify-around": { justifyContent: "space-around" },
1212
1214
  "justify-evenly": { justifyContent: "space-evenly" },
1213
- // Align content
1215
+ // Align content (both)
1214
1216
  "content-start": { alignContent: "flex-start" },
1215
1217
  "content-end": { alignContent: "flex-end" },
1216
1218
  "content-center": { alignContent: "center" },
1217
1219
  "content-between": { alignContent: "space-between" },
1218
1220
  "content-around": { alignContent: "space-around" },
1219
1221
  "content-evenly": { alignContent: "space-evenly" },
1220
- // Align self
1222
+ // Align self (both)
1221
1223
  "self-auto": { alignSelf: "auto" },
1222
1224
  "self-start": { alignSelf: "flex-start" },
1223
1225
  "self-end": { alignSelf: "flex-end" },
1224
1226
  "self-center": { alignSelf: "center" },
1225
1227
  "self-stretch": { alignSelf: "stretch" },
1226
- // Text align
1228
+ // Text align (both)
1227
1229
  "text-left": { textAlign: "left" },
1228
1230
  "text-right": { textAlign: "right" },
1229
1231
  "text-center": { textAlign: "center" },
1230
1232
  "text-justify": { textAlign: "justify" },
1231
- // Font weight shortcuts
1233
+ // Font weight shortcuts (both)
1232
1234
  "font-thin": { fontWeight: "100" },
1233
1235
  "font-extralight": { fontWeight: "200" },
1234
1236
  "font-light": { fontWeight: "300" },
@@ -1238,94 +1240,95 @@ var STANDALONE = {
1238
1240
  "font-bold": { fontWeight: "700" },
1239
1241
  "font-extrabold": { fontWeight: "800" },
1240
1242
  "font-black": { fontWeight: "900" },
1241
- // Text decoration
1243
+ // Text decoration (overline is web-only)
1242
1244
  underline: { textDecorationLine: "underline" },
1243
- overline: { textDecorationLine: "overline" },
1245
+ overline: isWeb ? { textDecorationLine: "overline" } : null,
1244
1246
  "line-through": { textDecorationLine: "line-through" },
1245
1247
  "no-underline": { textDecorationLine: "none" },
1246
- // Text transform
1248
+ // Text transform (both)
1247
1249
  uppercase: { textTransform: "uppercase" },
1248
1250
  lowercase: { textTransform: "lowercase" },
1249
1251
  capitalize: { textTransform: "capitalize" },
1250
1252
  "normal-case": { textTransform: "none" },
1251
- // Font style
1253
+ // Font style (both)
1252
1254
  italic: { fontStyle: "italic" },
1253
1255
  "non-italic": { fontStyle: "normal" },
1254
- // Position
1256
+ // Position (fixed/sticky/static are web-only; RN only supports relative/absolute)
1255
1257
  relative: { position: "relative" },
1256
1258
  absolute: { position: "absolute" },
1257
- fixed: { position: "fixed" },
1258
- sticky: { position: "sticky" },
1259
- static: { position: "static" },
1260
- // Visibility
1261
- visible: { visibility: "visible" },
1262
- invisible: { visibility: "hidden" },
1263
- // Overflow
1259
+ fixed: isWeb ? { position: "fixed" } : null,
1260
+ sticky: isWeb ? { position: "sticky" } : null,
1261
+ static: isWeb ? { position: "static" } : null,
1262
+ // Visibility (no `visibility` prop on native; use opacity instead)
1263
+ visible: isWeb ? { visibility: "visible" } : null,
1264
+ invisible: isWeb ? { visibility: "hidden" } : { opacity: 0 },
1265
+ // Overflow (RN supports 'hidden' | 'visible' | 'scroll'; not 'auto')
1264
1266
  "overflow-hidden": { overflow: "hidden" },
1265
1267
  "overflow-visible": { overflow: "visible" },
1266
1268
  "overflow-scroll": { overflow: "scroll" },
1267
- "overflow-auto": { overflow: "auto" },
1268
- "overflow-x-hidden": { overflowX: "hidden" },
1269
- "overflow-x-scroll": { overflowX: "scroll" },
1270
- "overflow-x-auto": { overflowX: "auto" },
1271
- "overflow-y-hidden": { overflowY: "hidden" },
1272
- "overflow-y-scroll": { overflowY: "scroll" },
1273
- "overflow-y-auto": { overflowY: "auto" },
1274
- // Object fit
1275
- "object-contain": { objectFit: "contain" },
1276
- "object-cover": { objectFit: "cover" },
1277
- "object-fill": { objectFit: "fill" },
1278
- "object-none": { objectFit: "none" },
1279
- "object-scale-down": { objectFit: "scale-down" },
1280
- // Border style
1269
+ "overflow-auto": isWeb ? { overflow: "auto" } : { overflow: "scroll" },
1270
+ // overflowX / overflowY are web-only
1271
+ "overflow-x-hidden": isWeb ? { overflowX: "hidden" } : null,
1272
+ "overflow-x-scroll": isWeb ? { overflowX: "scroll" } : null,
1273
+ "overflow-x-auto": isWeb ? { overflowX: "auto" } : null,
1274
+ "overflow-y-hidden": isWeb ? { overflowY: "hidden" } : null,
1275
+ "overflow-y-scroll": isWeb ? { overflowY: "scroll" } : null,
1276
+ "overflow-y-auto": isWeb ? { overflowY: "auto" } : null,
1277
+ // Object fit (web-only; use resizeMode prop on RN Image)
1278
+ "object-contain": isWeb ? { objectFit: "contain" } : null,
1279
+ "object-cover": isWeb ? { objectFit: "cover" } : null,
1280
+ "object-fill": isWeb ? { objectFit: "fill" } : null,
1281
+ "object-none": isWeb ? { objectFit: "none" } : null,
1282
+ "object-scale-down": isWeb ? { objectFit: "scale-down" } : null,
1283
+ // Border style (both)
1281
1284
  "border-solid": { borderStyle: "solid" },
1282
1285
  "border-dashed": { borderStyle: "dashed" },
1283
1286
  "border-dotted": { borderStyle: "dotted" },
1284
1287
  "border-none": { borderWidth: 0 },
1285
- // Border sides (default width 1)
1288
+ // Border sides default width (both)
1286
1289
  "border-t": { borderTopWidth: 1 },
1287
1290
  "border-r": { borderRightWidth: 1 },
1288
1291
  "border-b": { borderBottomWidth: 1 },
1289
1292
  "border-l": { borderLeftWidth: 1 },
1290
- // Cursor
1291
- "cursor-auto": { cursor: "auto" },
1292
- "cursor-default": { cursor: "default" },
1293
- "cursor-pointer": { cursor: "pointer" },
1294
- "cursor-wait": { cursor: "wait" },
1295
- "cursor-text": { cursor: "text" },
1296
- "cursor-move": { cursor: "move" },
1297
- "cursor-not-allowed": { cursor: "not-allowed" },
1298
- // Select
1299
- "select-none": { userSelect: "none" },
1300
- "select-text": { userSelect: "text" },
1301
- "select-all": { userSelect: "all" },
1302
- "select-auto": { userSelect: "auto" },
1303
- // Pointer events
1293
+ // Cursor (web-only)
1294
+ "cursor-auto": isWeb ? { cursor: "auto" } : null,
1295
+ "cursor-default": isWeb ? { cursor: "default" } : null,
1296
+ "cursor-pointer": isWeb ? { cursor: "pointer" } : null,
1297
+ "cursor-wait": isWeb ? { cursor: "wait" } : null,
1298
+ "cursor-text": isWeb ? { cursor: "text" } : null,
1299
+ "cursor-move": isWeb ? { cursor: "move" } : null,
1300
+ "cursor-not-allowed": isWeb ? { cursor: "not-allowed" } : null,
1301
+ // User select (web-only)
1302
+ "select-none": isWeb ? { userSelect: "none" } : null,
1303
+ "select-text": isWeb ? { userSelect: "text" } : null,
1304
+ "select-all": isWeb ? { userSelect: "all" } : null,
1305
+ "select-auto": isWeb ? { userSelect: "auto" } : null,
1306
+ // Pointer events (both)
1304
1307
  "pointer-events-none": { pointerEvents: "none" },
1305
1308
  "pointer-events-auto": { pointerEvents: "auto" },
1306
- // Whitespace
1307
- "whitespace-normal": { whiteSpace: "normal" },
1308
- "whitespace-nowrap": { whiteSpace: "nowrap" },
1309
- "whitespace-pre": { whiteSpace: "pre" },
1310
- "whitespace-pre-wrap": { whiteSpace: "pre-wrap" },
1311
- "whitespace-pre-line": { whiteSpace: "pre-line" },
1312
- // Word break
1313
- "break-normal": { overflowWrap: "normal", wordBreak: "normal" },
1314
- "break-words": { overflowWrap: "break-word" },
1315
- "break-all": { wordBreak: "break-all" },
1316
- // Misc
1317
- truncate: { overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" },
1318
- "box-border": { boxSizing: "border-box" },
1319
- "box-content": { boxSizing: "content-box" },
1320
- "appearance-none": { appearance: "none" },
1321
- "outline-none": { outline: "none", outlineOffset: "0" },
1322
- outline: { outline: "2px solid transparent", outlineOffset: "2px" },
1323
- resize: { resize: "both" },
1324
- "resize-none": { resize: "none" },
1325
- "resize-y": { resize: "vertical" },
1326
- "resize-x": { resize: "horizontal" },
1327
- antialiased: { WebkitFontSmoothing: "antialiased", MozOsxFontSmoothing: "grayscale" },
1328
- "sr-only": {
1309
+ // Whitespace (web-only; RN Text uses numberOfLines prop instead)
1310
+ "whitespace-normal": isWeb ? { whiteSpace: "normal" } : null,
1311
+ "whitespace-nowrap": isWeb ? { whiteSpace: "nowrap" } : null,
1312
+ "whitespace-pre": isWeb ? { whiteSpace: "pre" } : null,
1313
+ "whitespace-pre-wrap": isWeb ? { whiteSpace: "pre-wrap" } : null,
1314
+ "whitespace-pre-line": isWeb ? { whiteSpace: "pre-line" } : null,
1315
+ // Word break (web-only)
1316
+ "break-normal": isWeb ? { overflowWrap: "normal", wordBreak: "normal" } : null,
1317
+ "break-words": isWeb ? { overflowWrap: "break-word" } : null,
1318
+ "break-all": isWeb ? { wordBreak: "break-all" } : null,
1319
+ // Misc web-only
1320
+ truncate: isWeb ? { overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" } : null,
1321
+ "box-border": isWeb ? { boxSizing: "border-box" } : null,
1322
+ "box-content": isWeb ? { boxSizing: "content-box" } : null,
1323
+ "appearance-none": isWeb ? { appearance: "none" } : null,
1324
+ "outline-none": isWeb ? { outline: "none", outlineOffset: "0" } : null,
1325
+ outline: isWeb ? { outline: "2px solid transparent", outlineOffset: "2px" } : null,
1326
+ resize: isWeb ? { resize: "both" } : null,
1327
+ "resize-none": isWeb ? { resize: "none" } : null,
1328
+ "resize-y": isWeb ? { resize: "vertical" } : null,
1329
+ "resize-x": isWeb ? { resize: "horizontal" } : null,
1330
+ antialiased: isWeb ? { WebkitFontSmoothing: "antialiased", MozOsxFontSmoothing: "grayscale" } : null,
1331
+ "sr-only": isWeb ? {
1329
1332
  position: "absolute",
1330
1333
  width: 1,
1331
1334
  height: 1,
@@ -1335,8 +1338,8 @@ var STANDALONE = {
1335
1338
  clip: "rect(0,0,0,0)",
1336
1339
  whiteSpace: "nowrap",
1337
1340
  border: 0
1338
- },
1339
- "not-sr-only": {
1341
+ } : null,
1342
+ "not-sr-only": isWeb ? {
1340
1343
  position: "static",
1341
1344
  width: "auto",
1342
1345
  height: "auto",
@@ -1345,16 +1348,16 @@ var STANDALONE = {
1345
1348
  overflow: "visible",
1346
1349
  clip: "auto",
1347
1350
  whiteSpace: "normal"
1348
- },
1349
- // Lists
1350
- "list-none": { listStyleType: "none" },
1351
- "list-disc": { listStyleType: "disc" },
1352
- "list-decimal": { listStyleType: "decimal" },
1353
- // Background clip
1354
- "bg-clip-border": { backgroundClip: "border-box" },
1355
- "bg-clip-padding": { backgroundClip: "padding-box" },
1356
- "bg-clip-content": { backgroundClip: "content-box" },
1357
- "bg-clip-text": { backgroundClip: "text", WebkitBackgroundClip: "text" }
1351
+ } : null,
1352
+ // Lists (web-only)
1353
+ "list-none": isWeb ? { listStyleType: "none" } : null,
1354
+ "list-disc": isWeb ? { listStyleType: "disc" } : null,
1355
+ "list-decimal": isWeb ? { listStyleType: "decimal" } : null,
1356
+ // Background clip (web-only)
1357
+ "bg-clip-border": isWeb ? { backgroundClip: "border-box" } : null,
1358
+ "bg-clip-padding": isWeb ? { backgroundClip: "padding-box" } : null,
1359
+ "bg-clip-content": isWeb ? { backgroundClip: "content-box" } : null,
1360
+ "bg-clip-text": isWeb ? { backgroundClip: "text", WebkitBackgroundClip: "text" } : null
1358
1361
  };
1359
1362
  var RESOLVERS = {
1360
1363
  // ── Background ─────────────────────────────────────────────────────────────
@@ -1362,8 +1365,9 @@ var RESOLVERS = {
1362
1365
  const color = resolveColor(value, colors, isArbitrary);
1363
1366
  return color ? { backgroundColor: color } : null;
1364
1367
  },
1365
- "bg-opacity": ({ value, isArbitrary }, _) => {
1366
- const v = isArbitrary ? parseFloat(value) / 100 : parseFloat(value) / 100;
1368
+ "bg-opacity": ({ value }, _) => {
1369
+ if (!isWeb) return null;
1370
+ const v = parseFloat(value) / 100;
1367
1371
  return isNaN(v) ? null : { "--bg-opacity": v };
1368
1372
  },
1369
1373
  // ── Text ───────────────────────────────────────────────────────────────────
@@ -1380,6 +1384,7 @@ var RESOLVERS = {
1380
1384
  return color ? { color } : null;
1381
1385
  },
1382
1386
  "text-opacity": ({ value }, _) => {
1387
+ if (!isWeb) return null;
1383
1388
  const v = parseFloat(value) / 100;
1384
1389
  return isNaN(v) ? null : { "--text-opacity": v };
1385
1390
  },
@@ -1545,8 +1550,8 @@ var RESOLVERS = {
1545
1550
  return r !== null ? { borderBottomRightRadius: r } : null;
1546
1551
  },
1547
1552
  // ── Flex ───────────────────────────────────────────────────────────────────
1548
- flex: ({ value, isArbitrary }, { flex, spacing }) => {
1549
- if (!value) return { display: "flex" };
1553
+ flex: ({ value, isArbitrary }, { flex }) => {
1554
+ if (!value) return isWeb ? { display: "flex" } : {};
1550
1555
  if (isArbitrary) {
1551
1556
  const v = parseFloat(value);
1552
1557
  return isNaN(v) ? null : { flex: v };
@@ -1703,8 +1708,9 @@ var RESOLVERS = {
1703
1708
  const presets = { auto: "auto", square: 1, video: 16 / 9 };
1704
1709
  return value in presets ? { aspectRatio: presets[value] } : null;
1705
1710
  },
1706
- // ── Transition ─────────────────────────────────────────────────────────────
1711
+ // ── Transition (web-only; use Animated API on native) ─────────────────────
1707
1712
  transition: ({ value }) => {
1713
+ if (!isWeb) return null;
1708
1714
  const presets = {
1709
1715
  "": "color 150ms, background-color 150ms, border-color 150ms, opacity 150ms, box-shadow 150ms",
1710
1716
  all: "all 150ms",
@@ -1718,10 +1724,12 @@ var RESOLVERS = {
1718
1724
  return v !== void 0 ? { transition: v } : null;
1719
1725
  },
1720
1726
  duration: ({ value, isArbitrary }) => {
1727
+ if (!isWeb) return null;
1721
1728
  const ms = isArbitrary ? value : `${value}ms`;
1722
1729
  return { transitionDuration: ms };
1723
1730
  },
1724
1731
  delay: ({ value, isArbitrary }) => {
1732
+ if (!isWeb) return null;
1725
1733
  const ms = isArbitrary ? value : `${value}ms`;
1726
1734
  return { transitionDelay: ms };
1727
1735
  },
@@ -1736,8 +1744,9 @@ var RESOLVERS = {
1736
1744
  }
1737
1745
  };
1738
1746
  function resolveUtility(parsed, theme) {
1739
- const standalone = STANDALONE[parsed.utility];
1740
- if (standalone) return standalone;
1747
+ if (!parsed.value && parsed.utility in STANDALONE) {
1748
+ return STANDALONE[parsed.utility] ?? null;
1749
+ }
1741
1750
  const resolver = RESOLVERS[parsed.utility];
1742
1751
  if (resolver) return resolver(parsed, theme);
1743
1752
  return null;
@@ -2,8 +2,8 @@ import {
2
2
  Fragment,
3
3
  jsx,
4
4
  jsxs
5
- } from "./chunk-CNS23UB5.mjs";
6
- import "./chunk-PYBA3DFG.mjs";
5
+ } from "./chunk-7SN3LQKS.mjs";
6
+ import "./chunk-MXJINF4T.mjs";
7
7
 
8
8
  // src/jsx-dev-runtime.tsx
9
9
  function jsxDEV(type, props, key, isStaticChildren, _source, _self) {