lecodes-cli 0.10.3 → 0.11.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 (45) hide show
  1. package/README.md +2 -1
  2. package/dist/index.js +3480 -1527
  3. package/package.json +1 -1
  4. package/runtime/scene-harness.json +1 -1
  5. package/runtime/sdk/compile/aspectMacro.ts +42 -0
  6. package/runtime/sdk/compile/assetIconMacro.ts +382 -0
  7. package/runtime/sdk/compile/assetMacro.ts +45 -0
  8. package/runtime/sdk/compile/assetName.ts +50 -0
  9. package/runtime/sdk/compile/bundler.ts +244 -0
  10. package/runtime/sdk/compile/compileProject.ts +106 -0
  11. package/runtime/sdk/compile/detectEntry.ts +125 -0
  12. package/runtime/sdk/compile/fontMacro.ts +459 -0
  13. package/runtime/sdk/compile/fontRegistry.ts +78 -0
  14. package/runtime/sdk/compile/header.ts +55 -0
  15. package/runtime/sdk/compile/index.ts +53 -0
  16. package/runtime/sdk/compile/libraryImports.ts +52 -0
  17. package/runtime/sdk/compile/sceneEditor.ts +78 -0
  18. package/runtime/sdk/compile/sfnt.ts +98 -0
  19. package/runtime/sdk/compile/sourcemap.ts +25 -0
  20. package/runtime/sdk/inject.ts +2 -0
  21. package/runtime/sdk/runtime/channel.ts +14 -3
  22. package/runtime/sdk/runtime/service.ts +1 -1
  23. package/runtime/sdk/ui/NativeView.ts +4 -1
  24. package/runtime/sdk/ui/UI.ts +9 -1
  25. package/runtime/sdk/ui/UIBottomSheet.ts +10 -16
  26. package/runtime/sdk/ui/UIButton.ts +18 -16
  27. package/runtime/sdk/ui/UIContainer.ts +38 -46
  28. package/runtime/sdk/ui/UIImage.ts +8 -5
  29. package/runtime/sdk/ui/UIInput.ts +6 -6
  30. package/runtime/sdk/ui/UIModal.ts +10 -16
  31. package/runtime/sdk/ui/UINode.ts +105 -36
  32. package/runtime/sdk/ui/UIPager.ts +27 -15
  33. package/runtime/sdk/ui/UIPopover.ts +10 -16
  34. package/runtime/sdk/ui/UIScreen.ts +20 -21
  35. package/runtime/sdk/ui/UIScrollable.ts +37 -29
  36. package/runtime/sdk/ui/UISpacer.ts +2 -0
  37. package/runtime/sdk/ui/UITabs.ts +175 -0
  38. package/runtime/sdk/ui/UIText.ts +5 -0
  39. package/runtime/sdk/ui/UIVideo.ts +5 -0
  40. package/runtime/sdk/ui/UIVirtualizedList.ts +37 -37
  41. package/runtime/sdk/ui/UIWidget.ts +24 -19
  42. package/runtime/sdk/ui/fonts.ts +3 -0
  43. package/runtime/sdk/ui/router.ts +13 -0
  44. package/runtime/sdk/ui/theme.ts +21 -30
  45. package/runtime/sdk-types.json +1 -1
@@ -1,29 +1,7 @@
1
- // theme() — app theme variables (docs/ui-theme-plan.md).
2
- //
3
- // One global variable table lives in the UI core. Styles reference entries with CSS syntax —
4
- // `color: "var(--primaryColor)"` — resolved at style-apply time in the core, so re-calling
5
- // theme() with new values re-styles the LIVE UI (dark mode is just a second call). Two access
6
- // forms with one rule: bare style tokens (`pt: "comfort-top"`) are keywords that may expand to
7
- // formulas (max(safe-top, knob)); `var(--comfort-top)` always reads the raw table value (the
8
- // knob itself).
9
- //
10
- // theme(values) MERGES into the table and returns typed accessors whose values ARE the var()
11
- // strings — define once in a module, import where custom keys need typing:
12
- //
13
- // export const T = theme({ primaryColor: "#0A84FF", cardBg: "#1C1C1E" })
14
- // card.style({ bgColor: T.cardBg }) // T.cardBg === "var(--cardBg)"
15
- //
16
- // System vars need no import — they're static properties on the callable itself:
17
- // theme.primaryColor, theme.fontFamily, theme["comfort-top"], …
18
- //
19
- // Values: strings pass through (colors, fonts, expressions like "max(safe-top, 24px)");
20
- // numbers are LENGTHS (px). `null` removes a key (comfort knobs reset to their defaults:
21
- // 12 vertical, 16 horizontal — the page gutter). Env names (safe-*, vw/vh/vmin/vmax) are
22
- // host-owned facts, never theme keys — they're skipped with a warning.
23
- //
24
- // One key is not a style var: `replaceTransition` — the app-wide default for
25
- // `Router.replace` (any Transition, name or custom spec; `null` resets to "none"). The
26
- // router resolves it in the SDK, so it's consumed here and never sent to the host table.
1
+ // theme() — app theme variables (docs/ui-theme-plan.md). One global var table lives in the UI
2
+ // core; `var(--key)` references resolve at style-apply time, so re-calling theme() re-styles the
3
+ // LIVE UI. Bare style tokens (`pt: "comfort-top"`) are keywords that may expand to formulas
4
+ // (max(safe-top, knob)); `var(--comfort-top)` always reads the raw table value.
27
5
 
28
6
  import type { Transition } from "./presentable"
29
7
 
@@ -41,10 +19,20 @@ export type ThemeAccessors<T> = {
41
19
 
42
20
  const RESERVED = ["safe-top", "safe-bottom", "safe-left", "safe-right", "vw", "vh", "vmin", "vmax"]
43
21
 
44
- /** Merge app theme variables and get typed `var(--key)` accessors back. Strings/numbers are
45
- * style values (numbers = px); `null` removes a key. One special key: `replaceTransition` —
46
- * the app-wide default transition for `Router.replace` (any transition name or custom spec;
47
- * out of the box `"none"`). */
22
+ /**
23
+ * Merge app theme variables into the live table and get typed `var(--key)` accessors back:
24
+ *
25
+ * ```ts
26
+ * export const T = theme({ primaryColor: "#0A84FF", cardBg: "#1C1C1E" })
27
+ * card.style({ bgColor: T.cardBg }) // T.cardBg === "var(--cardBg)"
28
+ * ```
29
+ *
30
+ * Strings pass through (colors, fonts, expressions like `"max(safe-top, 24px)"`); numbers are
31
+ * lengths (px); `null` removes a key (comfort knobs reset to their defaults). Env names
32
+ * (`safe-*`, `vw`/`vh`/…) are host-owned — skipped with a warning. One special key:
33
+ * `replaceTransition` — the app-wide default transition for `Router.replace` (consumed SDK-side,
34
+ * never sent to the host table).
35
+ */
48
36
  const setTheme = <T extends Record<string, string | number | Transition | null>>(
49
37
  // Only `replaceTransition` may carry a Transition — every other key is a style value.
50
38
  values: T & { [K in Exclude<keyof T, "replaceTransition">]: string | number | null }
@@ -73,6 +61,9 @@ const setTheme = <T extends Record<string, string | number | Transition | null>>
73
61
  return accessors as ThemeAccessors<Omit<T, "replaceTransition">>
74
62
  }
75
63
 
64
+ /** App theme: callable to merge variables (`theme({...})` — re-calling re-styles the live UI, so
65
+ * dark mode is just a second call), with the system vars as static properties
66
+ * (`theme.primaryColor`, `theme["comfort-top"]`, …). */
76
67
  export const theme = Object.assign(setTheme, {
77
68
  /** The app accent color. Kit components will read it via `var(--primaryColor, <fallback>)`. */
78
69
  primaryColor: "var(--primaryColor)",