@kbach/react-native 1.0.0-beta.52 → 1.0.0-beta.54

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.
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getTheme
3
- } from "./chunk-Z5Q3FGXR.mjs";
3
+ } from "./chunk-MLBH2JYH.mjs";
4
4
 
5
5
  // src/darkModeStore.ts
6
6
  import { Appearance } from "react-native";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  resolveClassName
3
- } from "./chunk-Z5Q3FGXR.mjs";
3
+ } from "./chunk-MLBH2JYH.mjs";
4
4
 
5
5
  // src/jsxRuntimeCoreWeb.ts
6
6
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
package/dist/index.d.ts CHANGED
@@ -1,8 +1,9 @@
1
1
  export { ColorEntry, ContainerConfig, ThemeConfig, defaultTheme, getTheme, setTheme } from './theme';
2
- export { C as ClassArray, a as ClassDictionary, b as ClassValue, c as ColorScale, d as ColorsAPI, K as KbachConfig, T as ThemeProvider, e as ThemeProviderProps, f as ThemeState, g as ThemeStorageAdapter, h as applyKbachConfig, i as clsx, r as resolveKbachConfig, u as useColors, j as useDynamicToken, k as useTheme } from './clsx-BLLSnqAa.js';
2
+ export { B as Button, a as ButtonProps, C as ClassArray, b as ClassDictionary, c as ClassValue, d as ColorScale, e as ColorsAPI, H as H1, f as H2, g as H3, h as H4, i as H5, j as H6, k as HeadingProps, K as KbachConfig, P as Paragraph, l as ParagraphProps, T as ThemeProvider, m as ThemeProviderProps, n as ThemeState, o as ThemeStorageAdapter, p as applyKbachConfig, q as clsx, r as resolveKbachConfig, u as useColors, s as useDynamicToken, t as useTheme } from './semanticElements-Bk3TB-vt.js';
3
3
  export { ThemeMode, getGlobalDarkMode, getGlobalThemeMode, setGlobalThemeMode, subscribeGlobalDarkMode, toggleGlobalDarkMode } from './darkModeStore';
4
4
  export { deleteDynamicToken, getDynamicToken, setDynamicToken, subscribeDynamicTokens } from './dynamicTokens';
5
5
  import 'react';
6
+ import 'react-native';
6
7
 
7
8
  type StyleValue = string | number | {
8
9
  width: number;
package/dist/index.js CHANGED
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
+ var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
5
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
8
  var __export = (target, all) => {
7
9
  for (var name in all)
@@ -15,11 +17,27 @@ var __copyProps = (to, from, except, desc) => {
15
17
  }
16
18
  return to;
17
19
  };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
18
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
29
 
20
30
  // src/index.ts
21
31
  var src_exports = {};
22
32
  __export(src_exports, {
33
+ Button: () => Button,
34
+ H1: () => H1,
35
+ H2: () => H2,
36
+ H3: () => H3,
37
+ H4: () => H4,
38
+ H5: () => H5,
39
+ H6: () => H6,
40
+ Paragraph: () => Paragraph,
23
41
  ThemeProvider: () => ThemeProvider,
24
42
  applyKbachConfig: () => applyKbachConfig,
25
43
  clsx: () => clsx,
@@ -184,11 +202,15 @@ var VALUE_PREFIXES = [
184
202
  "rotate-y-",
185
203
  "rotate-z-",
186
204
  "rotate-",
205
+ // Bare 'translate-'/'skew-' (both axes) after their per-axis forms, same
206
+ // longer-before-shorter rule as resolvers/parser.rs.
187
207
  "translate-x-",
188
208
  "translate-y-",
189
209
  "translate-z-",
210
+ "translate-",
190
211
  "skew-x-",
191
212
  "skew-y-",
213
+ "skew-",
192
214
  "perspective-origin-",
193
215
  "perspective-",
194
216
  "origin-",
@@ -376,6 +398,7 @@ function decl(property, value) {
376
398
  function spacingPx(theme, value) {
377
399
  const fromTable = theme.spacing[value];
378
400
  if (fromTable !== void 0) return fromTable;
401
+ if (value === "px") return 1;
379
402
  const n = Number(value);
380
403
  return Number.isFinite(n) && value.trim() !== "" ? n * 4 : void 0;
381
404
  }
@@ -418,6 +441,7 @@ function fractionPercent(value) {
418
441
  }
419
442
  function resolveNegatableSize(theme, parsed) {
420
443
  if (!parsed.isArbitrary && parsed.value !== null) {
444
+ if (parsed.negative && parsed.value === "full") return "-100%";
421
445
  const pct = fractionPercent(parsed.value);
422
446
  if (pct !== null) return parsed.negative ? `-${pct}` : pct;
423
447
  }
@@ -676,7 +700,7 @@ function resolveFlex(parsed, web) {
676
700
  case "shrink-0":
677
701
  return [decl("flex-shrink", "0")];
678
702
  default:
679
- return null;
703
+ return /^\d+$/.test(value) ? [decl("flex", value)] : null;
680
704
  }
681
705
  }
682
706
 
@@ -920,8 +944,11 @@ function radiusSize(key) {
920
944
  switch (key) {
921
945
  case "none":
922
946
  return "0px";
923
- case "sm":
947
+ // Tailwind v4.3's radius scale: `sm` is 0.25rem (v3's 0.125rem is `xs`).
948
+ case "xs":
924
949
  return "0.125rem";
950
+ case "sm":
951
+ return "0.25rem";
925
952
  case "md":
926
953
  return "0.375rem";
927
954
  case "lg":
@@ -932,12 +959,19 @@ function radiusSize(key) {
932
959
  return "1rem";
933
960
  case "3xl":
934
961
  return "1.5rem";
962
+ case "4xl":
963
+ return "2rem";
935
964
  case "full":
936
965
  return "9999px";
937
966
  default:
938
967
  return null;
939
968
  }
940
969
  }
970
+ function borderWidthPx(parsed) {
971
+ if (parsed.negative || parsed.isArbitrary || parsed.value === null) return null;
972
+ const n = Number(parsed.value);
973
+ return Number.isFinite(n) && n >= 0 && parsed.value.trim() !== "" ? `${n}px` : null;
974
+ }
941
975
  function borderSideProperty(side) {
942
976
  switch (side) {
943
977
  case "t":
@@ -960,6 +994,15 @@ function borderValue(theme, parsed) {
960
994
  if (side !== null) {
961
995
  return [decl(`${side}-width`, "1px"), decl(`${side}-style`, "solid")];
962
996
  }
997
+ const pair = value === "x" ? ["border-left", "border-right"] : value === "y" ? ["border-top", "border-bottom"] : null;
998
+ if (pair !== null) {
999
+ return [
1000
+ decl(`${pair[0]}-width`, "1px"),
1001
+ decl(`${pair[1]}-width`, "1px"),
1002
+ decl(`${pair[0]}-style`, "solid"),
1003
+ decl(`${pair[1]}-style`, "solid")
1004
+ ];
1005
+ }
963
1006
  if (value === "collapse") return [decl("border-collapse", "collapse")];
964
1007
  if (value === "separate") return [decl("border-collapse", "separate")];
965
1008
  }
@@ -969,7 +1012,7 @@ function borderValue(theme, parsed) {
969
1012
  return color2 === null ? null : [decl("border-color", color2)];
970
1013
  }
971
1014
  if (Number.isFinite(Number(value)) && value.trim() !== "") {
972
- const v = resolveLength(theme, parsed);
1015
+ const v = borderWidthPx(parsed);
973
1016
  return v === null ? null : [decl("border-width", v)];
974
1017
  }
975
1018
  if (value === "solid" || value === "dashed" || value === "dotted" || value === "double" || value === "hidden" || value === "none") {
@@ -987,7 +1030,7 @@ function borderSideValue(theme, parsed, sideProperty) {
987
1030
  return color2 === null ? null : [decl(`${sideProperty}-color`, color2)];
988
1031
  }
989
1032
  if (Number.isFinite(Number(value)) && value.trim() !== "") {
990
- const v = resolveLength(theme, parsed);
1033
+ const v = borderWidthPx(parsed);
991
1034
  return v === null ? null : [decl(`${sideProperty}-width`, v)];
992
1035
  }
993
1036
  if (value === "solid" || value === "dashed" || value === "dotted" || value === "double" || value === "hidden" || value === "none") {
@@ -1005,7 +1048,7 @@ function borderAxisValue(theme, parsed, sideA, sideB) {
1005
1048
  return color2 === null ? null : [decl(`${sideA}-color`, color2), decl(`${sideB}-color`, color2)];
1006
1049
  }
1007
1050
  if (Number.isFinite(Number(value)) && value.trim() !== "") {
1008
- const v = resolveLength(theme, parsed);
1051
+ const v = borderWidthPx(parsed);
1009
1052
  return v === null ? null : [decl(`${sideA}-width`, v), decl(`${sideB}-width`, v)];
1010
1053
  }
1011
1054
  if (value === "solid" || value === "dashed" || value === "dotted" || value === "double" || value === "hidden" || value === "none") {
@@ -1052,20 +1095,7 @@ function resolveRadiusSide(theme, parsed, side) {
1052
1095
  }
1053
1096
  var OUTLINE_STYLES = ["solid", "dashed", "dotted", "double"];
1054
1097
  function outlineWidthValue(key) {
1055
- switch (key) {
1056
- case "0":
1057
- return "0px";
1058
- case "1":
1059
- return "1px";
1060
- case "2":
1061
- return "2px";
1062
- case "4":
1063
- return "4px";
1064
- case "8":
1065
- return "8px";
1066
- default:
1067
- return null;
1068
- }
1098
+ return /^\d+$/.test(key) ? `${Number(key)}px` : null;
1069
1099
  }
1070
1100
  function outlineValue(theme, parsed) {
1071
1101
  const value = parsed.value;
@@ -1088,48 +1118,6 @@ function outlineOffsetValue(parsed) {
1088
1118
  const w = outlineWidthValue(value);
1089
1119
  return w === null ? null : [decl("outline-offset", w)];
1090
1120
  }
1091
- var RING_BOX_SHADOW = "var(--kb-ring-inset,) 0 0 0 var(--kb-ring-offset-width, 0px) var(--kb-ring-offset-color, #fff), var(--kb-ring-inset,) 0 0 0 calc(var(--kb-ring-width, 0px) + var(--kb-ring-offset-width, 0px)) var(--kb-ring-color, rgba(59,130,246,0.5))";
1092
- function ringWidth(key) {
1093
- switch (key) {
1094
- case "0":
1095
- return "0px";
1096
- case "1":
1097
- return "1px";
1098
- case "2":
1099
- return "2px";
1100
- case "4":
1101
- return "4px";
1102
- case "8":
1103
- return "8px";
1104
- default:
1105
- return null;
1106
- }
1107
- }
1108
- function ringValue(theme, parsed) {
1109
- const value = parsed.value;
1110
- if (value === null) return null;
1111
- if (value === "inset") {
1112
- return [decl("--kb-ring-inset", "inset"), decl("box-shadow", RING_BOX_SHADOW)];
1113
- }
1114
- if (!parsed.isArbitrary) {
1115
- const w = ringWidth(value);
1116
- if (w !== null) return [decl("--kb-ring-width", w), decl("box-shadow", RING_BOX_SHADOW)];
1117
- }
1118
- const color = colorValue(theme, parsed);
1119
- if (color === null) return null;
1120
- return [decl("--kb-ring-color", color), decl("box-shadow", RING_BOX_SHADOW)];
1121
- }
1122
- function ringOffsetValue(theme, parsed) {
1123
- const value = parsed.value;
1124
- if (value === null) return null;
1125
- if (!parsed.isArbitrary) {
1126
- const w = ringWidth(value);
1127
- if (w !== null) return [decl("--kb-ring-offset-width", w), decl("box-shadow", RING_BOX_SHADOW)];
1128
- }
1129
- const color = colorValue(theme, parsed);
1130
- if (color === null) return null;
1131
- return [decl("--kb-ring-offset-color", color), decl("box-shadow", RING_BOX_SHADOW)];
1132
- }
1133
1121
  var RADIUS_SIDES = /* @__PURE__ */ new Set(["t", "r", "b", "l", "tl", "tr", "br", "bl"]);
1134
1122
  function resolve3(parsed, theme) {
1135
1123
  switch (parsed.utility) {
@@ -1158,14 +1146,19 @@ function resolve3(parsed, theme) {
1158
1146
  const v = resolveLength(theme, parsed);
1159
1147
  return v === null ? null : [decl("border-radius", v)];
1160
1148
  }
1149
+ // Rings are web-only (a var()-composed CSS box-shadow React Native can't
1150
+ // parse) — same as resolvers/mod.rs's native dispatcher.
1161
1151
  case "ring":
1162
- if (parsed.value === null) return [decl("--kb-ring-width", "3px"), decl("box-shadow", RING_BOX_SHADOW)];
1163
- return ringValue(theme, parsed);
1164
1152
  case "ring-offset":
1165
- return ringOffsetValue(theme, parsed);
1153
+ return null;
1154
+ // Outlines: the same final native style the Rust engine produces once
1155
+ // its var()-based web declarations are filtered out (resolve_style.rs):
1156
+ // bare `outline` is a 1px width, `outline-none` is outline-style: none,
1157
+ // `outline-hidden` keeps only its offset (RN has no `outline` shorthand).
1166
1158
  case "outline":
1167
- if (parsed.value === null) return [decl("outline-style", "solid")];
1168
- if (parsed.value === "none") return [decl("outline", "none")];
1159
+ if (parsed.value === null) return [decl("outline-width", "1px")];
1160
+ if (parsed.value === "none") return [decl("outline-style", "none")];
1161
+ if (!parsed.isArbitrary && parsed.value === "hidden") return [decl("outline-offset", "2px")];
1169
1162
  return outlineValue(theme, parsed);
1170
1163
  case "outline-offset":
1171
1164
  return outlineOffsetValue(parsed);
@@ -1211,26 +1204,10 @@ function textSize(key) {
1211
1204
  }
1212
1205
  }
1213
1206
  function lineHeightSize(key) {
1214
- switch (key) {
1215
- case "3":
1216
- return "0.75rem";
1217
- case "4":
1218
- return "1rem";
1219
- case "5":
1220
- return "1.25rem";
1221
- case "6":
1222
- return "1.5rem";
1223
- case "7":
1224
- return "1.75rem";
1225
- case "8":
1226
- return "2rem";
1227
- case "9":
1228
- return "2.25rem";
1229
- case "10":
1230
- return "2.5rem";
1231
- default:
1232
- return null;
1233
- }
1207
+ if (key === "px") return "1px";
1208
+ if (key.trim() === "") return null;
1209
+ const n = Number(key);
1210
+ return Number.isFinite(n) && n >= 0 ? `${n * 0.25}rem` : null;
1234
1211
  }
1235
1212
  function textAlign(key) {
1236
1213
  switch (key) {
@@ -1294,8 +1271,14 @@ function fontFamilyValue(theme, key) {
1294
1271
  // src/jsEngine/resolvers/effects.ts
1295
1272
  function nativeShadowValue(key) {
1296
1273
  switch (key) {
1297
- case "sm":
1274
+ // Tailwind v4.3's scale, like effects.rs: `sm` is the default shadow,
1275
+ // v3's `sm` is `xs`.
1276
+ case "2xs":
1277
+ return { offsetY: 1, radius: 0, opacity: 0.05, elevation: 1 };
1278
+ case "xs":
1298
1279
  return { offsetY: 1, radius: 2, opacity: 0.05, elevation: 1 };
1280
+ case "sm":
1281
+ return { offsetY: 1, radius: 3, opacity: 0.1, elevation: 2 };
1299
1282
  case "DEFAULT":
1300
1283
  return { offsetY: 1, radius: 3, opacity: 0.1, elevation: 2 };
1301
1284
  case "md":
@@ -1345,6 +1328,16 @@ function resolveNative(parsed, theme) {
1345
1328
  switch (parsed.utility) {
1346
1329
  case "transform-none":
1347
1330
  return [decl("transform-op-none", "1")];
1331
+ // Both axes at once (`translate-4`, `-skew-3`); mirrors transform.rs.
1332
+ case "translate": {
1333
+ if (!parsed.isArbitrary && parsed.value === "none") return [decl("transform-op-translate-x", "0"), decl("transform-op-translate-y", "0")];
1334
+ const v = resolveNegatableSize(theme, parsed);
1335
+ return v === null ? null : [decl("transform-op-translate-x", v), decl("transform-op-translate-y", v)];
1336
+ }
1337
+ case "skew": {
1338
+ const deg = angle(parsed);
1339
+ return deg === null ? null : [decl("transform-op-skew-x", deg), decl("transform-op-skew-y", deg)];
1340
+ }
1348
1341
  case "backface-visible":
1349
1342
  return [decl("backface-visibility", "visible")];
1350
1343
  case "backface-hidden":
@@ -1358,6 +1351,7 @@ function resolveNative(parsed, theme) {
1358
1351
  return v === null ? null : [decl("transform-op-translate-y", v)];
1359
1352
  }
1360
1353
  case "scale": {
1354
+ if (!parsed.isArbitrary && parsed.value === "none") return [decl("transform-op-scale-x", "1"), decl("transform-op-scale-y", "1")];
1361
1355
  const n = scaleFactor(parsed);
1362
1356
  return n === null ? null : [decl("transform-op-scale-x", `${n}`), decl("transform-op-scale-y", `${n}`)];
1363
1357
  }
@@ -1370,6 +1364,7 @@ function resolveNative(parsed, theme) {
1370
1364
  return n === null ? null : [decl("transform-op-scale-y", `${n}`)];
1371
1365
  }
1372
1366
  case "rotate": {
1367
+ if (!parsed.isArbitrary && parsed.value === "none") return [decl("transform-op-rotate", "0deg")];
1373
1368
  const deg = angle(parsed);
1374
1369
  return deg === null ? null : [decl("transform-op-rotate", deg)];
1375
1370
  }
@@ -1814,6 +1809,9 @@ function resolveStyleJsWithWarnings(classString, theme, colorScheme, pressed, wi
1814
1809
  if (d.property.startsWith("__")) {
1815
1810
  continue;
1816
1811
  }
1812
+ if (d.property.startsWith("--") || d.value.includes("var(") || d.property === "outline" || d.property === "object-position" || d.property === "container-type") {
1813
+ continue;
1814
+ }
1817
1815
  if (d.property === "shadow-offset-x" || d.property === "shadow-offset-y") {
1818
1816
  if (spec < (keySpecificity.get("shadowOffset") ?? 0)) continue;
1819
1817
  const n = Number(d.value);
@@ -2179,8 +2177,42 @@ function resolveClassValue(value) {
2179
2177
  }
2180
2178
  return "";
2181
2179
  }
2180
+
2181
+ // src/semanticElements.tsx
2182
+ var React = __toESM(require("react"));
2183
+ var import_react_native2 = require("react-native");
2184
+ var import_jsx_runtime2 = require("react/jsx-runtime");
2185
+ var Button = React.forwardRef(function Button2(props, ref) {
2186
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_native2.Pressable, { ref, accessibilityRole: "button", ...props });
2187
+ });
2188
+ var PARAGRAPH_ROLE = "paragraph";
2189
+ var Paragraph = React.forwardRef(function Paragraph2(props, ref) {
2190
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_native2.Text, { ref, role: PARAGRAPH_ROLE, ...props });
2191
+ });
2192
+ function makeHeading(level) {
2193
+ const extra = { "aria-level": level };
2194
+ const Heading = React.forwardRef(function Heading2(props, ref) {
2195
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_native2.Text, { ref, accessibilityRole: "header", ...extra, ...props });
2196
+ });
2197
+ Heading.displayName = `H${level}`;
2198
+ return Heading;
2199
+ }
2200
+ var H1 = makeHeading(1);
2201
+ var H2 = makeHeading(2);
2202
+ var H3 = makeHeading(3);
2203
+ var H4 = makeHeading(4);
2204
+ var H5 = makeHeading(5);
2205
+ var H6 = makeHeading(6);
2182
2206
  // Annotate the CommonJS export names for ESM import in node:
2183
2207
  0 && (module.exports = {
2208
+ Button,
2209
+ H1,
2210
+ H2,
2211
+ H3,
2212
+ H4,
2213
+ H5,
2214
+ H6,
2215
+ Paragraph,
2184
2216
  ThemeProvider,
2185
2217
  applyKbachConfig,
2186
2218
  clsx,
@@ -1,8 +1,9 @@
1
1
  export { ColorEntry, ContainerConfig, ThemeConfig, defaultTheme, getTheme, setTheme } from './theme';
2
- export { C as ClassArray, a as ClassDictionary, b as ClassValue, c as ColorScale, d as ColorsAPI, K as KbachConfig, T as ThemeProvider, e as ThemeProviderProps, f as ThemeState, h as applyKbachConfig, i as clsx, r as resolveKbachConfig, u as useColors, j as useDynamicToken, k as useTheme } from './clsx-BLLSnqAa.js';
2
+ export { B as Button, a as ButtonProps, C as ClassArray, b as ClassDictionary, c as ClassValue, d as ColorScale, e as ColorsAPI, H as H1, f as H2, g as H3, h as H4, i as H5, j as H6, k as HeadingProps, K as KbachConfig, P as Paragraph, l as ParagraphProps, T as ThemeProvider, m as ThemeProviderProps, n as ThemeState, p as applyKbachConfig, q as clsx, r as resolveKbachConfig, u as useColors, s as useDynamicToken, t as useTheme } from './semanticElements-Bk3TB-vt.js';
3
3
  export { ThemeMode, getGlobalDarkMode, getGlobalThemeMode, setGlobalThemeMode, subscribeGlobalDarkMode, toggleGlobalDarkMode } from './darkModeStore';
4
4
  export { deleteDynamicToken, getDynamicToken, setDynamicToken, subscribeDynamicTokens } from './dynamicTokens';
5
5
  import 'react';
6
+ import 'react-native';
6
7
 
7
8
  /**
8
9
  * Resolves `classString` to CSS via the WASM engine, injects every returned