orvyn-lang 0.2.0 → 0.4.0

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.
Files changed (63) hide show
  1. package/GUIDE.md +198 -0
  2. package/LANGUAGE.md +818 -30
  3. package/README.md +211 -250
  4. package/brand/orvyn-sunset-animated.svg +15 -0
  5. package/package.json +3 -1
  6. package/src/cli/orvyn.js +207 -16
  7. package/src/core/signal.js +104 -6
  8. package/src/devtools/runtime.js +25 -1
  9. package/src/lang/a11y.js +152 -0
  10. package/src/lang/auth.js +239 -0
  11. package/src/lang/bundle-native.js +10 -6
  12. package/src/lang/codegen.js +615 -58
  13. package/src/lang/device.js +41 -0
  14. package/src/lang/doctor.js +60 -0
  15. package/src/lang/env.js +27 -0
  16. package/src/lang/errors.js +513 -0
  17. package/src/lang/form.js +69 -8
  18. package/src/lang/index.js +2 -1
  19. package/src/lang/lexer.js +2 -0
  20. package/src/lang/list.js +44 -0
  21. package/src/lang/native/android/MainActivity.kt +65 -4
  22. package/src/lang/native/android/OrvynDevice.kt +163 -0
  23. package/src/lang/native/android/OrvynEngine.kt +176 -7
  24. package/src/lang/native/android/OrvynRenderer.kt +970 -50
  25. package/src/lang/native/android.js +74 -11
  26. package/src/lang/native/assets.js +39 -0
  27. package/src/lang/native/build.js +140 -63
  28. package/src/lang/native/compatibility.js +57 -0
  29. package/src/lang/native/config.js +108 -0
  30. package/src/lang/native/ios/OrvynApp.swift +6 -0
  31. package/src/lang/native/ios/OrvynEngine.swift +291 -4
  32. package/src/lang/native/ios/OrvynViews.swift +769 -41
  33. package/src/lang/native/ios.js +81 -2
  34. package/src/lang/native-runtime.js +541 -55
  35. package/src/lang/native-size.js +53 -0
  36. package/src/lang/page-files.js +71 -0
  37. package/src/lang/page.js +63 -0
  38. package/src/lang/parser.js +278 -15
  39. package/src/lang/prerender.js +300 -0
  40. package/src/lang/read-import.js +12 -0
  41. package/src/lang/router.js +266 -0
  42. package/src/lang/runtime-shared.js +796 -10
  43. package/src/lang/runtime.js +399 -51
  44. package/src/lang/select.js +13 -0
  45. package/src/lang/server-code.js +233 -0
  46. package/src/lang/server-export.js +78 -0
  47. package/src/lang/server-libs.js +53 -0
  48. package/src/lang/server.js +409 -0
  49. package/src/lang/style-check.js +60 -0
  50. package/src/lang/test-runner.js +134 -0
  51. package/src/lang/types.js +317 -0
  52. package/src/lang/vite-plugin.js +108 -6
  53. package/src/lang/web-overlay.js +578 -0
  54. package/src/lang/widgets.js +94 -0
  55. package/src/lang/words.js +38 -0
  56. package/src/runtime/animations.js +24 -0
  57. package/src/runtime/appear.js +73 -0
  58. package/src/runtime/marquee.js +57 -0
  59. package/src/runtime/mount.js +120 -27
  60. package/src/runtime/patch.js +90 -11
  61. package/src/runtime/style.js +50 -9
  62. package/src/styling/fluid.js +129 -6
  63. package/src/styling/spec.js +319 -0
@@ -1,3 +1,8 @@
1
+ import {
2
+ resolveFontFamily,
3
+ resolveThemeToken,
4
+ theme
5
+ } from "./spec.js";
1
6
  const fluidProps = /* @__PURE__ */ new Set([
2
7
  "size",
3
8
  "gap",
@@ -29,6 +34,7 @@ const containerSafeProps = /* @__PURE__ */ new Set([
29
34
  const stateStyleProps = /* @__PURE__ */ new Set([
30
35
  "hover",
31
36
  "active",
37
+ "pressed",
32
38
  "focus"
33
39
  ]);
34
40
  const unitlessProps = /* @__PURE__ */ new Set([
@@ -100,7 +106,8 @@ const domStyleProps = {
100
106
  zIndex: ["zIndex"],
101
107
  opacity: ["opacity"],
102
108
  fontWeight: ["fontWeight"],
103
- weight: ["fontWeight"]
109
+ weight: ["fontWeight"],
110
+ font: ["fontFamily"]
104
111
  };
105
112
  const cssStyleProps = {
106
113
  display: ["display"],
@@ -158,7 +165,8 @@ const cssStyleProps = {
158
165
  zIndex: ["z-index"],
159
166
  opacity: ["opacity"],
160
167
  fontWeight: ["font-weight"],
161
- weight: ["font-weight"]
168
+ weight: ["font-weight"],
169
+ font: ["font-family"]
162
170
  };
163
171
  const utilityProps = {
164
172
  text: "size",
@@ -344,11 +352,63 @@ function responsiveFluid(value, prop) {
344
352
  }
345
353
  return toCssLength(desktop);
346
354
  }
355
+ const WEB_THEME_VARS = {
356
+ bg: "var(--orvyn-bg, #ffffff)",
357
+ surface: "var(--orvyn-surface, #f8fafc)",
358
+ card: "var(--orvyn-card, #f1f5f9)",
359
+ text: "var(--orvyn-text, #0f172a)",
360
+ muted: "var(--orvyn-muted, #64748b)",
361
+ primary: "var(--orvyn-primary, #0066cc)",
362
+ onPrimary: "var(--orvyn-on-primary, #ffffff)",
363
+ border: "var(--orvyn-border, #cbd5e1)",
364
+ danger: "var(--orvyn-danger, #b91c1c)",
365
+ success: "var(--orvyn-success, #16a34a)",
366
+ warning: "var(--orvyn-warning, #f59e0b)"
367
+ };
368
+ function resolveWebThemeColor(value) {
369
+ const trimmed = value.trim();
370
+ return Object.hasOwn(WEB_THEME_VARS, trimmed) ? WEB_THEME_VARS[trimmed] : trimmed;
371
+ }
372
+ const ALIGN_MAP = {
373
+ start: "flex-start",
374
+ end: "flex-end"
375
+ };
376
+ const JUSTIFY_MAP = {
377
+ start: "flex-start",
378
+ end: "flex-end",
379
+ between: "space-between",
380
+ around: "space-around",
381
+ evenly: "space-evenly"
382
+ };
347
383
  function formatStyleValue(prop, value, options = {}) {
384
+ const css = formatValue(prop, value, options);
385
+ if (prop !== "size" || css === null) return css;
386
+ return css.replace(/(\d*\.?\d+)px/g, (_, n) => `${formatNumber(Number(n) / 16)}rem`);
387
+ }
388
+ function formatValue(prop, value, options = {}) {
348
389
  const fluidNumbers = options.fluidNumbers ?? true;
349
390
  if (value === null || value === void 0 || value === false) {
350
391
  return null;
351
392
  }
393
+ if (prop === "bg" || prop === "color") {
394
+ if (typeof value === "string") value = resolveWebThemeColor(value);
395
+ } else if (prop === "border" && typeof value === "string") {
396
+ value = value.trim().split(/\s+/).map(resolveWebThemeColor).join(" ");
397
+ } else {
398
+ value = resolveThemeToken(prop, value, theme());
399
+ }
400
+ if (prop === "font") {
401
+ return resolveFontFamily(value, "web");
402
+ }
403
+ if (prop === "grow" && value === true) {
404
+ return "1";
405
+ }
406
+ if (prop === "align" && typeof value === "string") {
407
+ return ALIGN_MAP[value] ?? value;
408
+ }
409
+ if (prop === "justify" && typeof value === "string") {
410
+ return JUSTIFY_MAP[value] ?? value;
411
+ }
352
412
  if (prop === "flex" && value === true) {
353
413
  return "flex";
354
414
  }
@@ -452,9 +512,18 @@ function isFluidProp(prop) {
452
512
  return fluidProps.has(prop);
453
513
  }
454
514
  function isStyleProp(prop) {
455
- return prop in domStyleProps || stateStyleProps.has(prop);
515
+ return prop in domStyleProps || stateStyleProps.has(prop) || prop === "center" || prop === "animate" || prop === "appear" || prop === "marquee" || prop === "scroll" || prop === "show";
456
516
  }
457
517
  function getStylePropTargets(prop, target) {
518
+ if (prop === "show") {
519
+ return ["display"];
520
+ }
521
+ if (prop === "center") {
522
+ return target === "dom" ? ["display", "alignItems", "justifyContent", "textAlign"] : ["display", "align-items", "justify-content", "text-align"];
523
+ }
524
+ if (prop === "scroll") {
525
+ return target === "dom" ? ["overflow", "overflowX", "overflowY"] : ["overflow", "overflow-x", "overflow-y"];
526
+ }
458
527
  return getStyleProps(target)[prop] || [];
459
528
  }
460
529
  function getStyleDeclarations(prop, value, target) {
@@ -469,6 +538,37 @@ function getStyleDeclarationsForValue(prop, value, target, options) {
469
538
  if (isBreakpointValue(value)) {
470
539
  return [];
471
540
  }
541
+ if (prop === "show") {
542
+ return value === false ? [{ property: "display", value: "none" }] : [];
543
+ }
544
+ if (prop === "appear") return [];
545
+ if (prop === "marquee") return [];
546
+ if (prop === "animate") {
547
+ const match = String(value).trim().match(/^(ease|linear|spring)(?:\s+(\d+(?:\.\d+)?)s)?$/);
548
+ if (!match) return [];
549
+ const easing = match[1] === "spring" ? "cubic-bezier(.2,.8,.2,1)" : match[1];
550
+ return [{ property: "transition", value: `all ${match[2] ?? "0.3"}s ${easing}` }];
551
+ }
552
+ if (prop === "center") {
553
+ if (value !== true) return [];
554
+ const align = target === "dom" ? "alignItems" : "align-items";
555
+ const justify = target === "dom" ? "justifyContent" : "justify-content";
556
+ const textAlign = target === "dom" ? "textAlign" : "text-align";
557
+ return [
558
+ { property: "display", value: "flex" },
559
+ { property: align, value: "center" },
560
+ { property: justify, value: "center" },
561
+ { property: textAlign, value: "center" }
562
+ ];
563
+ }
564
+ if (prop === "scroll") {
565
+ if (!value) return [];
566
+ const ox = target === "dom" ? "overflowX" : "overflow-x";
567
+ const oy = target === "dom" ? "overflowY" : "overflow-y";
568
+ if (value === "horizontal") return [{ property: ox, value: "auto" }];
569
+ if (value === "both") return [{ property: "overflow", value: "auto" }];
570
+ return [{ property: oy, value: "auto" }];
571
+ }
472
572
  if (prop === "columns") {
473
573
  const property = target === "dom" ? "gridTemplateColumns" : "grid-template-columns";
474
574
  const template = gridTemplateColumns(value);
@@ -527,7 +627,7 @@ function getResponsiveDeclarationGroups(props = {}, target) {
527
627
  desktop: []
528
628
  };
529
629
  for (const key in props) {
530
- if (key === "children" || key === "key" || key === "class" || key === "className" || key === "hydrate" || key === "resume" || key.startsWith("on") || !isStyleProp(key)) {
630
+ if (key === "children" || key === "key" || key === "class" || key === "className" || key === "hydrate" || key === "resume" || key === "show" || key.startsWith("on") || !isStyleProp(key)) {
531
631
  continue;
532
632
  }
533
633
  const value = readValue(props[key]);
@@ -548,17 +648,34 @@ function getResponsiveDeclarationGroups(props = {}, target) {
548
648
  }
549
649
  return groups;
550
650
  }
651
+ function showBreakpointMedia(value) {
652
+ if (!isBreakpointValue(value)) return [];
653
+ const mobileShown = (value.mobile ?? value.tablet ?? value.desktop) !== false;
654
+ const tabletShown = (value.tablet ?? value.mobile ?? value.desktop) !== false;
655
+ const desktopShown = (value.desktop ?? value.tablet ?? value.mobile) !== false;
656
+ const rules = [];
657
+ if (!mobileShown && !tabletShown && !desktopShown) return [{ query: null }];
658
+ if (!mobileShown && !tabletShown) rules.push({ query: `(max-width: ${breakpoints.desktop - 1}px)` });
659
+ else {
660
+ if (!mobileShown) rules.push({ query: `(max-width: ${breakpoints.tablet - 1}px)` });
661
+ if (!tabletShown) rules.push({ query: `(min-width: ${breakpoints.tablet}px) and (max-width: ${breakpoints.desktop - 1}px)` });
662
+ }
663
+ if (!desktopShown) rules.push({ query: `(min-width: ${breakpoints.desktop}px)` });
664
+ return rules;
665
+ }
551
666
  function getResponsiveSignature(props = {}) {
552
667
  const groups = getResponsiveDeclarationGroups(
553
668
  props,
554
669
  "css"
555
670
  );
556
671
  const states = getStateDeclarationGroups(props);
672
+ const showVal = readValue(props.show);
673
+ const showSig = isBreakpointValue(showVal) ? `show{${showBreakpointMedia(showVal).map((r) => r.query ?? "all").join(",")}}` : "";
557
674
  return ["base", "tablet", "desktop"].map(
558
675
  (breakpoint) => `${breakpoint}{${formatDeclarationBody(groups[breakpoint])}}`
559
676
  ).join("") + Object.entries(states).map(
560
677
  ([state, declarations]) => `${state}{${formatDeclarationBody(declarations)}}`
561
- ).join("");
678
+ ).join("") + showSig;
562
679
  }
563
680
  function getStateDeclarationGroups(props = {}) {
564
681
  const groups = {
@@ -571,11 +688,12 @@ function getStateDeclarationGroups(props = {}) {
571
688
  if (!value || typeof value !== "object" || Array.isArray(value)) {
572
689
  return;
573
690
  }
691
+ const cssState = state === "pressed" ? "active" : state;
574
692
  for (const key in value) {
575
693
  if (!isStyleProp(key)) {
576
694
  continue;
577
695
  }
578
- groups[state].push(
696
+ groups[cssState].push(
579
697
  ...getStyleDeclarationsForValue(
580
698
  key,
581
699
  readValue(value[key]),
@@ -639,6 +757,11 @@ function getResponsiveStyleRules(props = {}) {
639
757
  `${selector}:${state} { ${formatDeclarationBody(declarations)} }`
640
758
  );
641
759
  });
760
+ for (const media of showBreakpointMedia(readValue(props.show))) {
761
+ rules.push(
762
+ media.query ? `@media ${media.query} { ${selector} { display: none !important } }` : `${selector} { display: none !important }`
763
+ );
764
+ }
642
765
  return rules.join("\n");
643
766
  }
644
767
  function ensureResponsiveStyles(props = {}) {
@@ -0,0 +1,319 @@
1
+ import { signal } from "../core/signal.js";
2
+ const STYLE_SPEC = {
3
+ // Layout & sizing (all platforms)
4
+ width: { support: "all" },
5
+ height: { support: "all" },
6
+ minWidth: { support: "all" },
7
+ maxWidth: { support: "all" },
8
+ minHeight: { support: "all" },
9
+ maxHeight: { support: "all" },
10
+ padding: { support: "all" },
11
+ paddingX: { support: "all" },
12
+ paddingY: { support: "all" },
13
+ margin: { support: "all" },
14
+ gap: { support: "all" },
15
+ align: { support: "all" },
16
+ justify: { support: "all" },
17
+ center: { support: "all" },
18
+ wrap: { support: "all" },
19
+ scroll: { support: "all" },
20
+ grow: { support: "all" },
21
+ flex: { support: "all" },
22
+ direction: { support: "all" },
23
+ show: { support: "all" },
24
+ // Visual appearance (all platforms)
25
+ bg: { support: "all" },
26
+ color: { support: "all" },
27
+ radius: { support: "all" },
28
+ border: { support: "all" },
29
+ shadow: { support: "all" },
30
+ opacity: { support: "all" },
31
+ animate: { support: "all" },
32
+ appear: { support: "all" },
33
+ marquee: { support: "all" },
34
+ // Typography & direction (all platforms)
35
+ size: { support: "all" },
36
+ weight: { support: "all" },
37
+ fontWeight: { support: "all" },
38
+ font: { support: "all" },
39
+ lineHeight: { support: "all" },
40
+ textAlign: { support: "all" },
41
+ rtl: { support: "all" },
42
+ // Interactive & validation states (all platforms)
43
+ disabled: { support: "all" },
44
+ loading: { support: "all" },
45
+ error: { support: "all" },
46
+ pressed: { support: "all" },
47
+ active: { support: "all" },
48
+ focus: { support: "all" },
49
+ // Web-specific extras (warn cleanly when used in native apps)
50
+ hover: { support: "web", note: "Touch devices have no pointer hover state" },
51
+ grid: { support: "web", note: "CSS Grid layout is web-only; use Row with wrap: true for cross-platform grids" },
52
+ columns: { support: "web", note: "CSS Grid columns are web-only; use Row with wrap: true on phones" },
53
+ rows: { support: "web", note: "CSS Grid rows are web-only" },
54
+ minItemWidth: { support: "web", note: "CSS Grid auto-fit width is web-only" },
55
+ basis: { support: "all", note: "On phones, basis acts as the width when no width is set" },
56
+ shrink: { support: "web", note: "flex-shrink is web-only" },
57
+ display: { support: "web" },
58
+ overflow: { support: "all", note: 'On phones only "hidden" is used; use scroll: true to scroll' },
59
+ overflowX: { support: "web", note: 'Use scroll: "horizontal" for cross-platform scrolling' },
60
+ overflowY: { support: "web", note: "Use scroll: true for cross-platform scrolling" },
61
+ objectFit: { support: "web" },
62
+ objectPosition: { support: "web" },
63
+ position: { support: "all", note: 'On phones only "absolute" is used (iPhone so far); sticky and fixed act like normal' },
64
+ inset: { support: "web" },
65
+ top: { support: "all" },
66
+ right: { support: "all" },
67
+ bottom: { support: "all" },
68
+ left: { support: "all" },
69
+ zIndex: { support: "web" },
70
+ boxShadow: { support: "web", note: "Use shadow: 1..3 for cross-platform elevation" },
71
+ cursor: { support: "web" },
72
+ userSelect: { support: "web" },
73
+ pointerEvents: { support: "web" },
74
+ transform: { support: "web" },
75
+ transition: { support: "web" },
76
+ whiteSpace: { support: "web" },
77
+ letterSpacing: { support: "all" },
78
+ textDecoration: { support: "web" }
79
+ };
80
+ const NON_STYLE_PROPS = /* @__PURE__ */ new Set([
81
+ "children",
82
+ "key",
83
+ "class",
84
+ "className",
85
+ "hydrate",
86
+ "resume",
87
+ "nativeRole",
88
+ "type",
89
+ "placeholder",
90
+ "value",
91
+ "checked",
92
+ "selected",
93
+ "src",
94
+ "href",
95
+ "alt",
96
+ "id",
97
+ "name",
98
+ "role",
99
+ "noValidate",
100
+ "required",
101
+ "minLength",
102
+ "maxLength",
103
+ "email",
104
+ "label",
105
+ "message",
106
+ "bind"
107
+ ]);
108
+ const LIGHT_COLORS = {
109
+ bg: "#ffffff",
110
+ surface: "#f8fafc",
111
+ card: "#f1f5f9",
112
+ text: "#0f172a",
113
+ muted: "#64748b",
114
+ primary: "#0066cc",
115
+ onPrimary: "#ffffff",
116
+ border: "#cbd5e1",
117
+ danger: "#b91c1c",
118
+ success: "#16a34a",
119
+ warning: "#f59e0b"
120
+ };
121
+ const DARK_COLORS = {
122
+ bg: "#0b0f19",
123
+ surface: "#111827",
124
+ card: "#1e293b",
125
+ text: "#f8fafc",
126
+ muted: "#94a3b8",
127
+ primary: "#3b82f6",
128
+ onPrimary: "#ffffff",
129
+ border: "#334155",
130
+ danger: "#f87171",
131
+ success: "#4ade80",
132
+ warning: "#fbbf24"
133
+ };
134
+ const DEFAULT_SPACING = {
135
+ xs: 4,
136
+ sm: 8,
137
+ md: 16,
138
+ lg: 24,
139
+ xl: 32
140
+ };
141
+ const DEFAULT_TEXT_SIZES = {
142
+ caption: 13,
143
+ body: 17,
144
+ subtitle: 20,
145
+ title: 28
146
+ };
147
+ function systemPrefersDark() {
148
+ try {
149
+ return typeof globalThis.matchMedia === "function" && globalThis.matchMedia("(prefers-color-scheme: dark)").matches;
150
+ } catch {
151
+ return false;
152
+ }
153
+ }
154
+ function buildTheme(mode, overrides = {}) {
155
+ const dark = mode === "dark" || mode === "system" && systemPrefersDark();
156
+ const base = dark ? DARK_COLORS : LIGHT_COLORS;
157
+ return {
158
+ mode,
159
+ dark,
160
+ colors: { ...base, ...overrides },
161
+ spacing: { ...DEFAULT_SPACING },
162
+ textSizes: { ...DEFAULT_TEXT_SIZES }
163
+ };
164
+ }
165
+ const themeState = signal(buildTheme("light"), "__orvyn_theme");
166
+ let themeOverrides = {};
167
+ function setOrReadTheme(input) {
168
+ if (input === void 0) return themeState.get();
169
+ if (typeof input === "string") {
170
+ if (input !== "light" && input !== "dark" && input !== "system") {
171
+ throw new Error(`[Orvyn] theme("${input}") is not valid. Use "light", "dark", or "system".`);
172
+ }
173
+ const next = buildTheme(input, themeOverrides);
174
+ themeState.set(next);
175
+ return next;
176
+ }
177
+ if (input && typeof input === "object") {
178
+ const { mode, dark, ...palette } = input;
179
+ const resolvedMode = mode ?? (dark === true ? "dark" : dark === false ? "light" : themeState.get().mode);
180
+ themeOverrides = { ...themeOverrides, ...palette };
181
+ const next = buildTheme(resolvedMode, themeOverrides);
182
+ themeState.set(next);
183
+ return next;
184
+ }
185
+ return themeState.get();
186
+ }
187
+ const theme = Object.defineProperties(setOrReadTheme, {
188
+ mode: { get: () => themeState.get().mode, enumerable: true },
189
+ dark: { get: () => themeState.get().dark, enumerable: true },
190
+ colors: { get: () => themeState.get().colors, enumerable: true },
191
+ spacing: { get: () => themeState.get().spacing, enumerable: true },
192
+ textSizes: { get: () => themeState.get().textSizes, enumerable: true },
193
+ toggle: {
194
+ value: () => setOrReadTheme(themeState.get().dark ? "light" : "dark"),
195
+ enumerable: true
196
+ }
197
+ });
198
+ const LIGHT_BGS = /* @__PURE__ */ new Set(["white", "#fff", "#ffffff", "surface", "card", "yellow", "transparent", "clear"]);
199
+ function autoButtonColor(bg, currentTheme = themeState.get()) {
200
+ if (typeof bg !== "string") return null;
201
+ const key = bg.trim().toLowerCase();
202
+ if (!key || key === "none") return null;
203
+ if (LIGHT_BGS.has(key) || key === currentTheme.colors.bg.toLowerCase() && !currentTheme.dark) {
204
+ return "#0f172a";
205
+ }
206
+ return "#ffffff";
207
+ }
208
+ function resetTheme() {
209
+ themeOverrides = {};
210
+ themeState.set(buildTheme("light"));
211
+ }
212
+ function subscribeTheme(fn) {
213
+ return themeState.subscribe(fn);
214
+ }
215
+ const COLOR_PROPS = /* @__PURE__ */ new Set(["bg", "color"]);
216
+ const SPACE_PROPS = /* @__PURE__ */ new Set(["padding", "paddingX", "paddingY", "margin", "gap", "radius"]);
217
+ const FONT_ALIASES = {
218
+ sans: '-apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, system-ui, sans-serif',
219
+ serif: 'Georgia, Cambria, "Times New Roman", Times, serif',
220
+ mono: "ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace"
221
+ };
222
+ function resolveThemeToken(prop, value, currentTheme = themeState.get()) {
223
+ if (typeof value !== "string") return value;
224
+ const key = value.trim();
225
+ if (COLOR_PROPS.has(prop) && Object.hasOwn(currentTheme.colors, key)) {
226
+ return currentTheme.colors[key];
227
+ }
228
+ if (prop === "border") {
229
+ return key.split(/\s+/).map(
230
+ (part) => Object.hasOwn(currentTheme.colors, part) ? currentTheme.colors[part] : part
231
+ ).join(" ");
232
+ }
233
+ if (SPACE_PROPS.has(prop) && Object.hasOwn(currentTheme.spacing, key)) {
234
+ return currentTheme.spacing[key];
235
+ }
236
+ if (prop === "size" && Object.hasOwn(currentTheme.textSizes, key)) {
237
+ return currentTheme.textSizes[key];
238
+ }
239
+ return value;
240
+ }
241
+ function resolveFontFamily(value, target) {
242
+ if (typeof value !== "string" || !value.trim()) return null;
243
+ const trimmed = value.trim();
244
+ if (target === "web") return FONT_ALIASES[trimmed] ?? trimmed;
245
+ return trimmed;
246
+ }
247
+ const emittedWarnings = /* @__PURE__ */ new Set();
248
+ let warningHandler = null;
249
+ function setStyleWarningHandler(fn) {
250
+ warningHandler = fn;
251
+ emittedWarnings.clear();
252
+ }
253
+ function clearStyleWarnings() {
254
+ emittedWarnings.clear();
255
+ }
256
+ function closestStyleProp(name) {
257
+ const lower = name.toLowerCase();
258
+ const aliases = {
259
+ colour: "color",
260
+ background: "bg",
261
+ backgroundcolor: "bg",
262
+ fontsize: "size",
263
+ fontweight: "weight",
264
+ fontfamily: "font",
265
+ borderradius: "radius",
266
+ textalign: "textAlign",
267
+ lineheight: "lineHeight",
268
+ maxwidth: "maxWidth",
269
+ minwidth: "minWidth",
270
+ maxheight: "maxHeight",
271
+ minheight: "minHeight",
272
+ paddingx: "paddingX",
273
+ paddingy: "paddingY",
274
+ paddingtop: "paddingY",
275
+ paddingbottom: "paddingY",
276
+ paddingleft: "paddingX",
277
+ paddingright: "paddingX",
278
+ margintop: "margin",
279
+ marginbottom: "margin",
280
+ marginleft: "margin",
281
+ marginright: "margin"
282
+ };
283
+ if (aliases[lower]) return aliases[lower];
284
+ for (const candidate of Object.keys(STYLE_SPEC)) {
285
+ if (candidate.toLowerCase() === lower) return candidate;
286
+ }
287
+ return null;
288
+ }
289
+ function warnStyle(key, platform) {
290
+ if (NON_STYLE_PROPS.has(key) || key.startsWith("on") || key.startsWith("aria-")) return;
291
+ const spec = STYLE_SPEC[key];
292
+ let message = null;
293
+ if (!spec) {
294
+ const suggestion = closestStyleProp(key);
295
+ message = suggestion ? `[Orvyn style] Unknown style "${key}". Did you mean "${suggestion}"?` : `[Orvyn style] Unknown style "${key}". Check LANGUAGE.md for supported style props.`;
296
+ } else if (platform === "native" && spec.support === "web") {
297
+ message = spec.note ? `[Orvyn style] "${key}" is web-only (${spec.note}).` : `[Orvyn style] "${key}" is currently web-only and is ignored on iOS/Android.`;
298
+ }
299
+ if (!message) return;
300
+ const dedupeKey = `${platform}:${key}:${message}`;
301
+ if (emittedWarnings.has(dedupeKey)) return;
302
+ emittedWarnings.add(dedupeKey);
303
+ if (warningHandler) warningHandler(message);
304
+ else console.warn(message);
305
+ }
306
+ export {
307
+ NON_STYLE_PROPS,
308
+ STYLE_SPEC,
309
+ autoButtonColor,
310
+ clearStyleWarnings,
311
+ closestStyleProp,
312
+ resetTheme,
313
+ resolveFontFamily,
314
+ resolveThemeToken,
315
+ setStyleWarningHandler,
316
+ subscribeTheme,
317
+ theme,
318
+ warnStyle
319
+ };