@kbach/react-native 1.0.0-beta.20 → 1.0.0-beta.21

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
  resolveClassName
3
- } from "./chunk-OGFB3OXS.mjs";
3
+ } from "./chunk-AG7ZQ2K4.mjs";
4
4
 
5
5
  // src/jsxRuntimeCoreWeb.ts
6
6
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getTheme
3
- } from "./chunk-OGFB3OXS.mjs";
3
+ } from "./chunk-AG7ZQ2K4.mjs";
4
4
 
5
5
  // src/darkModeStore.ts
6
6
  import { Appearance } from "react-native";
@@ -18,10 +18,11 @@
18
18
  * Deliberately ONE listener set shared by every token, not per-token
19
19
  * subscriptions — same trade-off `darkModeStore.ts` already makes for
20
20
  * "any relevant change re-renders every subscribed element" simplicity.
21
- * `jsxRuntimeCore.ts`'s own key-suffix scoping (only the SPECIFIC token
22
- * names a given className references) is what keeps an unrelated token
23
- * change from forcing an unnecessary remount on an element that doesn't
24
- * use it, same shape as the responsive-breakpoint scoping already does.
21
+ * An unrelated token's change still re-renders every subscribed element
22
+ * (there's no per-token filtering), but `substituteDynamicTokens` in
23
+ * `jsxRuntimeCore.ts` re-reads each token's CURRENT value fresh on every
24
+ * one of those re-renders, so the resolved style stays correct regardless
25
+ * — the redundant re-render is a cheap, accepted trade-off, not a bug.
25
26
  */
26
27
  /** `name` is the bare token name, WITHOUT the leading `--` (matching how `getDynamicToken`/`var(--name)` substitution both address it). */
27
28
  declare function setDynamicToken(name: string, value: string): void;
package/dist/index.js CHANGED
@@ -135,11 +135,21 @@ var VALUE_PREFIXES = [
135
135
  "tracking-",
136
136
  "font-",
137
137
  "z-",
138
+ "inset-x-",
139
+ "inset-y-",
138
140
  "inset-",
139
141
  "top-",
140
142
  "right-",
141
143
  "bottom-",
142
144
  "left-",
145
+ "start-",
146
+ "end-",
147
+ "overflow-x-",
148
+ "overflow-y-",
149
+ "overscroll-x-",
150
+ "overscroll-y-",
151
+ "overscroll-",
152
+ "aspect-",
143
153
  "divide-color-",
144
154
  "space-x-",
145
155
  "space-y-",
@@ -324,11 +334,42 @@ function resolveNegatableLength(theme, parsed) {
324
334
  if (px === 0) return "0px";
325
335
  return `-${px}px`;
326
336
  }
337
+ function resolvePercent(parsed) {
338
+ if (parsed.negative) return null;
339
+ const value = parsed.value;
340
+ if (value === null) return null;
341
+ if (parsed.isArbitrary) return value;
342
+ const pct = Number(value);
343
+ if (!Number.isFinite(pct) || value.trim() === "") return null;
344
+ return String(pct / 100);
345
+ }
327
346
 
328
347
  // src/jsEngine/resolvers/layout.ts
329
348
  function negateRaw(value, negative) {
330
349
  return negative ? `-${value}` : value;
331
350
  }
351
+ function overflowAxisValue(property, value) {
352
+ switch (value) {
353
+ case "auto":
354
+ case "hidden":
355
+ case "clip":
356
+ case "visible":
357
+ case "scroll":
358
+ return [decl(property, value)];
359
+ default:
360
+ return null;
361
+ }
362
+ }
363
+ function overscrollValue(property, value) {
364
+ switch (value) {
365
+ case "auto":
366
+ case "contain":
367
+ case "none":
368
+ return [decl(property, value)];
369
+ default:
370
+ return null;
371
+ }
372
+ }
332
373
  function resolve(parsed, theme) {
333
374
  switch (parsed.utility) {
334
375
  case "flex":
@@ -375,6 +416,12 @@ function resolve(parsed, theme) {
375
416
  return [decl("justify-content", "space-around")];
376
417
  case "justify-evenly":
377
418
  return [decl("justify-content", "space-evenly")];
419
+ case "justify-normal":
420
+ return [decl("justify-content", "normal")];
421
+ case "justify-stretch":
422
+ return [decl("justify-content", "stretch")];
423
+ case "content-normal":
424
+ return [decl("align-content", "normal")];
378
425
  case "content-start":
379
426
  return [decl("align-content", "flex-start")];
380
427
  case "content-end":
@@ -409,6 +456,18 @@ function resolve(parsed, theme) {
409
456
  return [decl("overflow", "scroll")];
410
457
  case "overflow-visible":
411
458
  return [decl("overflow", "visible")];
459
+ case "overflow-clip":
460
+ return [decl("overflow", "clip")];
461
+ case "overflow-x":
462
+ return parsed.value === null ? null : overflowAxisValue("overflow-x", parsed.value);
463
+ case "overflow-y":
464
+ return parsed.value === null ? null : overflowAxisValue("overflow-y", parsed.value);
465
+ case "overscroll":
466
+ return parsed.value === null ? null : overscrollValue("overscroll-behavior", parsed.value);
467
+ case "overscroll-x":
468
+ return parsed.value === null ? null : overscrollValue("overscroll-behavior-x", parsed.value);
469
+ case "overscroll-y":
470
+ return parsed.value === null ? null : overscrollValue("overscroll-behavior-y", parsed.value);
412
471
  case "static":
413
472
  return [decl("position", "static")];
414
473
  case "relative":
@@ -449,10 +508,43 @@ function resolve(parsed, theme) {
449
508
  const v = resolveNegatableLength(theme, parsed);
450
509
  return v === null ? null : [decl("inset", v)];
451
510
  }
452
- case "aspect-square":
453
- return [decl("aspect-ratio", "1 / 1")];
454
- case "aspect-video":
455
- return [decl("aspect-ratio", "16 / 9")];
511
+ case "inset-x": {
512
+ const v = resolveNegatableLength(theme, parsed);
513
+ return v === null ? null : [decl("left", v), decl("right", v)];
514
+ }
515
+ case "inset-y": {
516
+ const v = resolveNegatableLength(theme, parsed);
517
+ return v === null ? null : [decl("top", v), decl("bottom", v)];
518
+ }
519
+ // Logical inset — just a different CSS property name, same reasoning
520
+ // as Rust's layout.rs (no direction-tracking logic needed here).
521
+ case "start": {
522
+ const v = resolveNegatableLength(theme, parsed);
523
+ return v === null ? null : [decl("inset-inline-start", v)];
524
+ }
525
+ case "end": {
526
+ const v = resolveNegatableLength(theme, parsed);
527
+ return v === null ? null : [decl("inset-inline-end", v)];
528
+ }
529
+ // "aspect-" is a registered VALUE_PREFIXES entry (parser.ts), so
530
+ // "aspect-square"/"aspect-video"/"aspect-auto"/arbitrary all arrive
531
+ // here as utility="aspect" + a value, mirroring layout.rs's own
532
+ // "aspect" arm.
533
+ case "aspect": {
534
+ const value = parsed.value;
535
+ if (value === null) return null;
536
+ if (parsed.isArbitrary) return [decl("aspect-ratio", value)];
537
+ switch (value) {
538
+ case "square":
539
+ return [decl("aspect-ratio", "1 / 1")];
540
+ case "video":
541
+ return [decl("aspect-ratio", "16 / 9")];
542
+ case "auto":
543
+ return [decl("aspect-ratio", "auto")];
544
+ default:
545
+ return null;
546
+ }
547
+ }
456
548
  default:
457
549
  return null;
458
550
  }
@@ -979,6 +1071,16 @@ function textSize(key) {
979
1071
  return "1.875rem";
980
1072
  case "4xl":
981
1073
  return "2.25rem";
1074
+ case "5xl":
1075
+ return "3rem";
1076
+ case "6xl":
1077
+ return "3.75rem";
1078
+ case "7xl":
1079
+ return "4.5rem";
1080
+ case "8xl":
1081
+ return "6rem";
1082
+ case "9xl":
1083
+ return "8rem";
982
1084
  default:
983
1085
  return null;
984
1086
  }
@@ -1015,6 +1117,12 @@ function textAlign(key) {
1015
1117
  return "right";
1016
1118
  case "justify":
1017
1119
  return "justify";
1120
+ // Logical alignment — same "no direction-tracking logic needed" reasoning
1121
+ // as layout.rs's start/end inset properties.
1122
+ case "start":
1123
+ return "start";
1124
+ case "end":
1125
+ return "end";
1018
1126
  default:
1019
1127
  return null;
1020
1128
  }
@@ -1023,6 +1131,10 @@ function fontWeight(key) {
1023
1131
  switch (key) {
1024
1132
  case "thin":
1025
1133
  return "100";
1134
+ case "extralight":
1135
+ return "200";
1136
+ case "light":
1137
+ return "300";
1026
1138
  case "normal":
1027
1139
  return "400";
1028
1140
  case "medium":
@@ -1033,6 +1145,22 @@ function fontWeight(key) {
1033
1145
  return "700";
1034
1146
  case "extrabold":
1035
1147
  return "800";
1148
+ case "black":
1149
+ return "900";
1150
+ default:
1151
+ return null;
1152
+ }
1153
+ }
1154
+ function fontFamilyValue(theme, key) {
1155
+ const fromTheme = theme.fontFamily?.[key];
1156
+ if (fromTheme !== void 0) return fromTheme;
1157
+ switch (key) {
1158
+ case "sans":
1159
+ return 'ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"';
1160
+ case "serif":
1161
+ return 'ui-serif, Georgia, Cambria, "Times New Roman", Times, serif';
1162
+ case "mono":
1163
+ return 'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace';
1036
1164
  default:
1037
1165
  return null;
1038
1166
  }
@@ -1075,12 +1203,21 @@ function nativeShadowDeclarations(parsed) {
1075
1203
  }
1076
1204
 
1077
1205
  // src/jsEngine/resolveUtilityNative.ts
1078
- function resolveTypographyNative(parsed) {
1206
+ function firstFontName(stack) {
1207
+ const first = stack.split(",")[0] ?? stack;
1208
+ return first.trim().replace(/^["']|["']$/g, "");
1209
+ }
1210
+ function resolveTypographyNative(parsed, theme) {
1079
1211
  switch (parsed.utility) {
1080
1212
  case "font": {
1081
1213
  if (parsed.value === null) return null;
1214
+ if (parsed.isArbitrary) {
1215
+ return [decl("font-family", firstFontName(parsed.value))];
1216
+ }
1082
1217
  const w = fontWeight(parsed.value);
1083
- return w === null ? null : [decl("font-weight", w)];
1218
+ if (w !== null) return [decl("font-weight", w)];
1219
+ const family = fontFamilyValue(theme, parsed.value);
1220
+ return family === null ? null : [decl("font-family", firstFontName(family))];
1084
1221
  }
1085
1222
  case "uppercase":
1086
1223
  return [decl("text-transform", "uppercase")];
@@ -1140,8 +1277,13 @@ function resolveColorNative(parsed, theme) {
1140
1277
  return null;
1141
1278
  }
1142
1279
  }
1280
+ function resolveOpacityNative(parsed) {
1281
+ if (parsed.utility !== "opacity") return null;
1282
+ const v = resolvePercent(parsed);
1283
+ return v === null ? null : [decl("opacity", v)];
1284
+ }
1143
1285
  function resolveUtilityNative(parsed, theme) {
1144
- return resolveFlex(parsed, false) ?? resolve(parsed, theme) ?? resolve2(parsed, theme) ?? resolve3(parsed, theme) ?? resolveColorNative(parsed, theme) ?? resolveLeadingTrackingNative(parsed) ?? resolveTypographyNative(parsed) ?? nativeShadowDeclarations(parsed);
1286
+ return resolveFlex(parsed, false) ?? resolve(parsed, theme) ?? resolve2(parsed, theme) ?? resolve3(parsed, theme) ?? resolveColorNative(parsed, theme) ?? resolveLeadingTrackingNative(parsed) ?? resolveTypographyNative(parsed, theme) ?? resolveOpacityNative(parsed) ?? nativeShadowDeclarations(parsed);
1145
1287
  }
1146
1288
 
1147
1289
  // src/jsEngine/calc.ts
@@ -1345,6 +1487,7 @@ var NUMERIC_LENGTH_PROPS = /* @__PURE__ */ new Set([
1345
1487
  "shadow-opacity",
1346
1488
  "shadow-radius",
1347
1489
  "elevation",
1490
+ "opacity",
1348
1491
  // Per-side border width + per-corner radius — see resolvers/border.ts's
1349
1492
  // new borderSideValue/borderAxisValue/resolveRadiusSide additions; RN's
1350
1493
  // style system wants plain numbers for these exactly like the generic