silvery 0.19.2 → 0.21.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.
Files changed (172) hide show
  1. package/README.md +9 -4
  2. package/dist/Text-BRf-59j2.mjs +237 -0
  3. package/dist/Text-BRf-59j2.mjs.map +1 -0
  4. package/dist/ag-BeFC4S2N.mjs +8727 -0
  5. package/dist/ag-BeFC4S2N.mjs.map +1 -0
  6. package/dist/{animation-Cn64yepo.mjs → animation-N8MFybTk.mjs} +2 -2
  7. package/dist/animation-N8MFybTk.mjs.map +1 -0
  8. package/dist/{ansi-CLOitHKx.mjs → ansi-C6Qs1Wn2.mjs} +1 -1
  9. package/dist/{ansi-CLOitHKx.mjs.map → ansi-C6Qs1Wn2.mjs.map} +1 -1
  10. package/dist/{ansi-Cc33mW54.d.mts → ansi-CBkam1ty.d.mts} +1 -1
  11. package/dist/{ansi-Cc33mW54.d.mts.map → ansi-CBkam1ty.d.mts.map} +1 -1
  12. package/dist/ansi-OYRLxxZQ.mjs +10669 -0
  13. package/dist/ansi-OYRLxxZQ.mjs.map +1 -0
  14. package/dist/bound-term-BumfuXXW.d.mts +4902 -0
  15. package/dist/bound-term-BumfuXXW.d.mts.map +1 -0
  16. package/dist/{chunk-Vs_PY4HZ.mjs → chunk-hT5z_Zn9.mjs} +1 -3
  17. package/dist/cli-DG6zsfsS.mjs +4 -0
  18. package/dist/context-BU5LkkIy.mjs.map +1 -1
  19. package/dist/{devtools-DxkSLXDA.mjs → devtools-9zfhpFyG.mjs} +3 -3
  20. package/dist/{devtools-DxkSLXDA.mjs.map → devtools-9zfhpFyG.mjs.map} +1 -1
  21. package/dist/devtools-nmPUmYU_.mjs +2 -0
  22. package/dist/easing-B0oZKDki.d.mts +24 -0
  23. package/dist/easing-B0oZKDki.d.mts.map +1 -0
  24. package/dist/{eta-Bb3RH3wh.mjs → eta-DGOuC8yU.mjs} +5 -1
  25. package/dist/{eta-Bb3RH3wh.mjs.map → eta-DGOuC8yU.mjs.map} +1 -1
  26. package/dist/flexily-zero-adapter-CEJOcbNp.mjs +306 -0
  27. package/dist/flexily-zero-adapter-CEJOcbNp.mjs.map +1 -0
  28. package/dist/{flexily-zero-adapter-CMxXhdOL.mjs → flexily-zero-adapter-D6hcFgrH.mjs} +1 -1
  29. package/dist/image-1nRyKa60.mjs +5960 -0
  30. package/dist/image-1nRyKa60.mjs.map +1 -0
  31. package/dist/{index-D3saHouR.d.mts → index-2E1jYgak.d.mts} +1057 -1133
  32. package/dist/index-2E1jYgak.d.mts.map +1 -0
  33. package/dist/index-Bi4Jdz5g.d.mts +453 -0
  34. package/dist/index-Bi4Jdz5g.d.mts.map +1 -0
  35. package/dist/index-Dg1YaeJb.d.mts +336 -0
  36. package/dist/index-Dg1YaeJb.d.mts.map +1 -0
  37. package/dist/{index-BXslOebb.d.mts → index-DnuadDNL.d.mts} +5750 -4158
  38. package/dist/index-DnuadDNL.d.mts.map +1 -0
  39. package/dist/index.d.mts +8 -5
  40. package/dist/index.d.mts.map +1 -1
  41. package/dist/index.mjs +16 -12
  42. package/dist/index.mjs.map +1 -1
  43. package/dist/layout-engine-Ca_nbtfL.mjs +67 -0
  44. package/dist/layout-engine-Ca_nbtfL.mjs.map +1 -0
  45. package/dist/{layout-engine-B6Cdz1yZ.mjs → layout-engine-CgsoBRIn.mjs} +1 -1
  46. package/dist/layout-signals-Dch2EiCy.mjs +1111 -0
  47. package/dist/layout-signals-Dch2EiCy.mjs.map +1 -0
  48. package/dist/mouse-events-hnbJZRwK.mjs +1071 -0
  49. package/dist/mouse-events-hnbJZRwK.mjs.map +1 -0
  50. package/dist/{multi-progress-DAQC7eap.d.mts → multi-progress-Bg4ngK80.d.mts} +2 -2
  51. package/dist/{multi-progress-DAQC7eap.d.mts.map → multi-progress-Bg4ngK80.d.mts.map} +1 -1
  52. package/dist/{multi-progress-Bq9Oi_WI.mjs → multi-progress-CaXTuL9G.mjs} +3 -3
  53. package/dist/{multi-progress-Bq9Oi_WI.mjs.map → multi-progress-CaXTuL9G.mjs.map} +1 -1
  54. package/dist/{node-BeWlnCPY.mjs → node-BiFu8I9Y.mjs} +4 -4
  55. package/dist/node-BiFu8I9Y.mjs.map +1 -0
  56. package/dist/progress-B_UPy6zk.mjs +675 -0
  57. package/dist/progress-B_UPy6zk.mjs.map +1 -0
  58. package/dist/{progress-bar-CXE5Qfkd.mjs → progress-bar-DmIMPdL0.mjs} +4 -4
  59. package/dist/{progress-bar-CXE5Qfkd.mjs.map → progress-bar-DmIMPdL0.mjs.map} +1 -1
  60. package/dist/reconciler-NBDSEm8k.mjs +2178 -0
  61. package/dist/reconciler-NBDSEm8k.mjs.map +1 -0
  62. package/dist/render-string-B4h4SmK7.mjs +211 -0
  63. package/dist/render-string-B4h4SmK7.mjs.map +1 -0
  64. package/dist/{render-string-CDCeYkS3.mjs → render-string-BntLj7Xq.mjs} +1 -1
  65. package/dist/runtime.d.mts +3 -2
  66. package/dist/runtime.mjs +3 -3
  67. package/dist/{src-B5GjfG7g.mjs → schemes-DYt2ushj.mjs} +23 -1812
  68. package/dist/schemes-DYt2ushj.mjs.map +1 -0
  69. package/dist/{spinner-CGo34vyR.d.mts → spinner-CLgzJ_QF.d.mts} +2 -2
  70. package/dist/{spinner-CGo34vyR.d.mts.map → spinner-CLgzJ_QF.d.mts.map} +1 -1
  71. package/dist/{spinner-CeOmcuw_.mjs → spinner-Py8_-hn9.mjs} +23 -8
  72. package/dist/spinner-Py8_-hn9.mjs.map +1 -0
  73. package/dist/src-B9S_woYc.mjs +25024 -0
  74. package/dist/src-B9S_woYc.mjs.map +1 -0
  75. package/dist/src-CbhWmUnF.mjs +3928 -0
  76. package/dist/src-CbhWmUnF.mjs.map +1 -0
  77. package/dist/src-Dvq-s8iD.mjs +939 -0
  78. package/dist/src-Dvq-s8iD.mjs.map +1 -0
  79. package/dist/src-Oe6x5PrS.mjs +4621 -0
  80. package/dist/src-Oe6x5PrS.mjs.map +1 -0
  81. package/dist/{types-Bk2yw9Qj.mjs → src-WeA_J4BV.mjs} +34 -94
  82. package/dist/src-WeA_J4BV.mjs.map +1 -0
  83. package/dist/steps-DYrzCUCK.d.mts +202 -0
  84. package/dist/steps-DYrzCUCK.d.mts.map +1 -0
  85. package/dist/svg-DhxQkz-O.mjs +255 -0
  86. package/dist/svg-DhxQkz-O.mjs.map +1 -0
  87. package/dist/svg-Hk7lIl4F.d.mts +82 -0
  88. package/dist/svg-Hk7lIl4F.d.mts.map +1 -0
  89. package/dist/term.d.mts +3 -0
  90. package/dist/term.mjs +4 -0
  91. package/dist/theme.d.mts +95 -2
  92. package/dist/theme.d.mts.map +1 -0
  93. package/dist/theme.mjs +4 -3
  94. package/dist/{types-BH_v3iMT.d.mts → types-Bx-XZNbE.d.mts} +2 -15
  95. package/dist/types-Bx-XZNbE.d.mts.map +1 -0
  96. package/dist/ui/animation.d.mts +2 -1
  97. package/dist/ui/animation.mjs +1 -1
  98. package/dist/ui/ansi.d.mts +1 -1
  99. package/dist/ui/ansi.mjs +1 -1
  100. package/dist/ui/cli.d.mts +3 -3
  101. package/dist/ui/cli.mjs +5 -5
  102. package/dist/ui/display.d.mts +1 -1
  103. package/dist/ui/display.mjs.map +1 -1
  104. package/dist/ui/image.d.mts +2 -2
  105. package/dist/ui/image.mjs +2 -2
  106. package/dist/ui/input.d.mts +1 -1
  107. package/dist/ui/input.mjs.map +1 -1
  108. package/dist/ui/progress.d.mts +5 -249
  109. package/dist/ui/progress.mjs +5 -858
  110. package/dist/ui/react.d.mts +1 -1
  111. package/dist/ui/react.mjs +2 -2
  112. package/dist/ui/react.mjs.map +1 -1
  113. package/dist/ui/recording-chrome-react.d.mts +21 -0
  114. package/dist/ui/recording-chrome-react.d.mts.map +1 -0
  115. package/dist/ui/recording-chrome-react.mjs +105 -0
  116. package/dist/ui/recording-chrome-react.mjs.map +1 -0
  117. package/dist/ui/recording-chrome.d.mts +2 -0
  118. package/dist/ui/recording-chrome.mjs +2 -0
  119. package/dist/ui/utils.mjs +1 -1
  120. package/dist/ui/wrappers.d.mts +3 -3
  121. package/dist/ui/wrappers.mjs +2 -2
  122. package/dist/ui.d.mts +7 -6
  123. package/dist/ui.mjs +8 -7
  124. package/dist/{useLatest-Bg2x4bfP.d.mts → useLatest-DC8i7guK.d.mts} +5 -25
  125. package/dist/useLatest-DC8i7guK.d.mts.map +1 -0
  126. package/dist/useLayout-BKsQl2Or.mjs +424 -0
  127. package/dist/useLayout-BKsQl2Or.mjs.map +1 -0
  128. package/dist/{with-text-input-CRfoiFFG.d.mts → with-text-input-DG4f7JII.d.mts} +4 -55
  129. package/dist/with-text-input-DG4f7JII.d.mts.map +1 -0
  130. package/dist/wrapper-D7gNSsgf.mjs +3589 -0
  131. package/dist/wrapper-D7gNSsgf.mjs.map +1 -0
  132. package/dist/{wrappers-UTADQkSY.mjs → wrappers-CypAzrMO.mjs} +19 -161
  133. package/dist/wrappers-CypAzrMO.mjs.map +1 -0
  134. package/dist/yoga-adapter-1ex8r0ws.mjs +2 -0
  135. package/dist/{yoga-adapter-8oRGRw8V.mjs → yoga-adapter-SsEIqMc1.mjs} +28 -2
  136. package/dist/yoga-adapter-SsEIqMc1.mjs.map +1 -0
  137. package/package.json +63 -12
  138. package/dist/animation-Cn64yepo.mjs.map +0 -1
  139. package/dist/cli-BKp0YtBD.mjs +0 -4
  140. package/dist/devtools-9QY4teqI.mjs +0 -2
  141. package/dist/flexily-zero-adapter-BlQa46nr.mjs +0 -3385
  142. package/dist/flexily-zero-adapter-BlQa46nr.mjs.map +0 -1
  143. package/dist/image-CTII5QWI.mjs +0 -477
  144. package/dist/image-CTII5QWI.mjs.map +0 -1
  145. package/dist/index-BXslOebb.d.mts.map +0 -1
  146. package/dist/index-BnA7mNpo.d.mts +0 -175
  147. package/dist/index-BnA7mNpo.d.mts.map +0 -1
  148. package/dist/index-D3saHouR.d.mts.map +0 -1
  149. package/dist/layout-engine-ClUgv6jB.mjs +0 -50
  150. package/dist/layout-engine-ClUgv6jB.mjs.map +0 -1
  151. package/dist/node-BeWlnCPY.mjs.map +0 -1
  152. package/dist/reconciler-Cwgm8hRR.mjs +0 -8459
  153. package/dist/reconciler-Cwgm8hRR.mjs.map +0 -1
  154. package/dist/render-string-Darrg7ku.mjs +0 -5529
  155. package/dist/render-string-Darrg7ku.mjs.map +0 -1
  156. package/dist/spinner-CeOmcuw_.mjs.map +0 -1
  157. package/dist/src-B5GjfG7g.mjs.map +0 -1
  158. package/dist/src-CChwjk0Z.mjs +0 -738
  159. package/dist/src-CChwjk0Z.mjs.map +0 -1
  160. package/dist/src-CF-6UN01.mjs +0 -19434
  161. package/dist/src-CF-6UN01.mjs.map +0 -1
  162. package/dist/src-NCKb8kE5.mjs +0 -2660
  163. package/dist/src-NCKb8kE5.mjs.map +0 -1
  164. package/dist/types-BH_v3iMT.d.mts.map +0 -1
  165. package/dist/types-Bk2yw9Qj.mjs.map +0 -1
  166. package/dist/ui/progress.d.mts.map +0 -1
  167. package/dist/ui/progress.mjs.map +0 -1
  168. package/dist/useLatest-Bg2x4bfP.d.mts.map +0 -1
  169. package/dist/with-text-input-CRfoiFFG.d.mts.map +0 -1
  170. package/dist/wrappers-UTADQkSY.mjs.map +0 -1
  171. package/dist/yoga-adapter-8oRGRw8V.mjs.map +0 -1
  172. package/dist/yoga-adapter-D_CcxSt5.mjs +0 -2
@@ -0,0 +1,67 @@
1
+ //#region packages/ag-term/src/layout-engine.ts
2
+ let layoutEngine = null;
3
+ /**
4
+ * Set the global layout engine instance.
5
+ * Must be called before rendering.
6
+ */
7
+ function setLayoutEngine(engine) {
8
+ layoutEngine = engine;
9
+ }
10
+ /**
11
+ * Get the global layout engine instance.
12
+ * Throws if not initialized.
13
+ */
14
+ function getLayoutEngine() {
15
+ if (!layoutEngine) throw new Error("Layout engine not initialized. Call setLayoutEngine() or initYoga()/initFlexily() first.");
16
+ return layoutEngine;
17
+ }
18
+ /**
19
+ * Check if a layout engine is initialized.
20
+ */
21
+ function isLayoutEngineInitialized() {
22
+ return layoutEngine !== null;
23
+ }
24
+ /**
25
+ * Get the layout constants from the current engine.
26
+ * Convenience function for accessing constants.
27
+ */
28
+ function getConstants() {
29
+ return getLayoutEngine().constants;
30
+ }
31
+ /**
32
+ * Runtime guard: throws if the active layout engine doesn't advertise the named capability.
33
+ *
34
+ * Used by Phase A0.1+ primitives (`<Box fitWidth>`, `<Box containerQueries>`, cq* units,
35
+ * style math functions) at their first-paint resolution path. Under `yoga` (or pre-A0.1
36
+ * flexily), the throw happens at first paint with a one-line fix instruction in the error
37
+ * message. No silent fallback — silent fallback under yoga would look like a fresh render
38
+ * bug and cost hours of debugging.
39
+ *
40
+ * @param name The capability key being checked (e.g. `"fitWidth"`, `"containerQueries"`).
41
+ * @param consumer A human-readable label for the call site, e.g. `"<Box fitWidth>"` or
42
+ * `"cqi unit in 'padding'"`. Surfaces in the error message.
43
+ */
44
+ function requireCapability(name, consumer) {
45
+ const engine = getLayoutEngine();
46
+ if (!engine.capabilities[name]) throw new Error(`${consumer} requires layout engine capability "${name}" — current engine "${engine.name}" doesn't support it. Switch to flexily: set SILVERY_ENGINE=flexily, OR call ensureDefaultLayoutEngine("flexily") before render.`);
47
+ }
48
+ /**
49
+ * Initialize the layout engine if not already set.
50
+ *
51
+ * @param engineType - 'flexily', 'flexily-classic', or 'yoga'. If not provided, checks
52
+ * SILVERY_ENGINE env var, then defaults to 'flexily'.
53
+ */
54
+ async function ensureDefaultLayoutEngine(engineType) {
55
+ if (isLayoutEngineInitialized()) return;
56
+ if ((engineType ?? process.env.SILVERY_ENGINE?.toLowerCase() ?? "flexily") === "yoga") {
57
+ const { initYogaEngine } = await import("./yoga-adapter-1ex8r0ws.mjs");
58
+ setLayoutEngine(await initYogaEngine());
59
+ } else {
60
+ const { createFlexilyZeroEngine } = await import("./flexily-zero-adapter-D6hcFgrH.mjs");
61
+ setLayoutEngine(createFlexilyZeroEngine());
62
+ }
63
+ }
64
+ //#endregion
65
+ export { requireCapability as a, isLayoutEngineInitialized as i, getConstants as n, setLayoutEngine as o, getLayoutEngine as r, ensureDefaultLayoutEngine as t };
66
+
67
+ //# sourceMappingURL=layout-engine-Ca_nbtfL.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"layout-engine-Ca_nbtfL.mjs","names":[],"sources":["../packages/ag-term/src/layout-engine.ts"],"sourcesContent":["/**\n * Layout Engine Abstraction\n *\n * Provides a pluggable interface for layout engines (Yoga, Flexily, etc.)\n * This allows silvery to use different layout backends without code changes.\n *\n * Core type interfaces (LayoutNode, MeasureFunc, MeasureMode) live in\n * @silvery/ag/layout-types. This file contains the runtime engine management.\n */\n\nimport type { LayoutNode } from \"@silvery/ag/layout-types\"\n\n// ============================================================================\n// Branded Types for Type Safety\n// ============================================================================\n\n/**\n * Branded types prevent accidentally mixing up layout constant categories.\n * E.g., you can't pass an AlignValue where a FlexDirectionValue is expected.\n */\nexport type FlexDirectionValue = number & { readonly __brand: \"FlexDirection\" }\nexport type WrapValue = number & { readonly __brand: \"Wrap\" }\nexport type AlignValue = number & { readonly __brand: \"Align\" }\nexport type JustifyValue = number & { readonly __brand: \"Justify\" }\nexport type EdgeValue = number & { readonly __brand: \"Edge\" }\nexport type GutterValue = number & { readonly __brand: \"Gutter\" }\nexport type DisplayValue = number & { readonly __brand: \"Display\" }\nexport type PositionTypeValue = number & { readonly __brand: \"PositionType\" }\nexport type OverflowValue = number & { readonly __brand: \"Overflow\" }\nexport type DirectionValue = number & { readonly __brand: \"Direction\" }\nexport type MeasureModeValue = number & { readonly __brand: \"MeasureMode\" }\n\n// ============================================================================\n// Layout Constants Interface\n// ============================================================================\n\n/**\n * Constants for layout configuration.\n * These are the same across Yoga and Flexily.\n * Uses branded types for compile-time safety.\n */\nexport interface LayoutConstants {\n // Flex Direction\n FLEX_DIRECTION_COLUMN: FlexDirectionValue\n FLEX_DIRECTION_COLUMN_REVERSE: FlexDirectionValue\n FLEX_DIRECTION_ROW: FlexDirectionValue\n FLEX_DIRECTION_ROW_REVERSE: FlexDirectionValue\n\n // Wrap\n WRAP_NO_WRAP: WrapValue\n WRAP_WRAP: WrapValue\n WRAP_WRAP_REVERSE: WrapValue\n\n // Align\n ALIGN_AUTO: AlignValue\n ALIGN_FLEX_START: AlignValue\n ALIGN_CENTER: AlignValue\n ALIGN_FLEX_END: AlignValue\n ALIGN_STRETCH: AlignValue\n ALIGN_BASELINE: AlignValue\n ALIGN_SPACE_BETWEEN: AlignValue\n ALIGN_SPACE_AROUND: AlignValue\n ALIGN_SPACE_EVENLY: AlignValue\n\n // Justify\n JUSTIFY_FLEX_START: JustifyValue\n JUSTIFY_CENTER: JustifyValue\n JUSTIFY_FLEX_END: JustifyValue\n JUSTIFY_SPACE_BETWEEN: JustifyValue\n JUSTIFY_SPACE_AROUND: JustifyValue\n JUSTIFY_SPACE_EVENLY: JustifyValue\n\n // Edge\n EDGE_LEFT: EdgeValue\n EDGE_TOP: EdgeValue\n EDGE_RIGHT: EdgeValue\n EDGE_BOTTOM: EdgeValue\n EDGE_HORIZONTAL: EdgeValue\n EDGE_VERTICAL: EdgeValue\n EDGE_ALL: EdgeValue\n\n // Gutter\n GUTTER_COLUMN: GutterValue\n GUTTER_ROW: GutterValue\n GUTTER_ALL: GutterValue\n\n // Display\n DISPLAY_FLEX: DisplayValue\n DISPLAY_NONE: DisplayValue\n\n // Position Type\n POSITION_TYPE_STATIC: PositionTypeValue\n POSITION_TYPE_RELATIVE: PositionTypeValue\n POSITION_TYPE_ABSOLUTE: PositionTypeValue\n\n // Overflow\n OVERFLOW_VISIBLE: OverflowValue\n OVERFLOW_HIDDEN: OverflowValue\n OVERFLOW_SCROLL: OverflowValue\n\n // Direction\n DIRECTION_LTR: DirectionValue\n\n // Measure Mode\n MEASURE_MODE_UNDEFINED: MeasureModeValue\n MEASURE_MODE_EXACTLY: MeasureModeValue\n MEASURE_MODE_AT_MOST: MeasureModeValue\n}\n\n// ============================================================================\n// Engine Capabilities (Phase A0.0.5 of @km/silvery/responsive-layout-architecture-reframe)\n// ============================================================================\n\n/**\n * Declares which engine-native primitives a `LayoutEngine` supports.\n *\n * silvery is engine-pluggable — `flexily` (pure JS) and `yoga` (WASM) ship as peer\n * adapters. The responsive-layout reframe (Phase A0.1+) adds engine-native container\n * queries, fitWidth, size containment, cq* units, and CSS math functions. These\n * primitives can only be implemented in `flexily` (yoga's WASM boundary doesn't expose\n * inter-pass child-style mutation).\n *\n * Each adapter declares which capabilities it supports. Consumers (`<Box fitWidth>`,\n * `<Box containerQueries>`, etc.) gate on capability presence via `requireCapability()`\n * — under yoga, those primitives THROW at first paint with a one-line fix instruction\n * (switch via `SILVERY_ENGINE=flexily`).\n */\nexport interface EngineCapabilities {\n /** Container queries: `<Box containerQueries={...}>` + `containerType` / `containerName` */\n readonly containerQueries: boolean\n /** Size containment: `<Box containSize>` */\n readonly containSize: boolean\n /** Container-query units in style values: `cqi`, `cqmin`, `cqb`, `cqmax` */\n readonly containerQueryUnits: boolean\n /** fitWidth Box prop: `<Box fitWidth={[80, 120, \"100cqi\"]}>` */\n readonly fitWidth: boolean\n /** CSS math functions in style values: `min()`, `max()`, `clamp()` */\n readonly styleMathFunctions: boolean\n /** Inter-pass child-style mutation hook (underlying mechanism for CQ + fitWidth) */\n readonly childStyleMutation: boolean\n}\n\n// ============================================================================\n// Layout Engine Interface\n// ============================================================================\n\n/**\n * Abstract layout engine interface.\n * Implementations can wrap Yoga, Flexily, or other layout engines.\n */\nexport interface LayoutEngine {\n /** Create a new layout node */\n createNode(): LayoutNode\n\n /** Layout constants for this engine */\n readonly constants: LayoutConstants\n\n /** Engine name for debugging */\n readonly name: string\n\n /** Which engine-native primitives this adapter supports (Phase A0.0.5+). */\n readonly capabilities: EngineCapabilities\n}\n\n// ============================================================================\n// Global Layout Engine Management\n// ============================================================================\n\nlet layoutEngine: LayoutEngine | null = null\n\n/**\n * Set the global layout engine instance.\n * Must be called before rendering.\n */\nexport function setLayoutEngine(engine: LayoutEngine): void {\n layoutEngine = engine\n}\n\n/**\n * Get the global layout engine instance.\n * Throws if not initialized.\n */\nexport function getLayoutEngine(): LayoutEngine {\n if (!layoutEngine) {\n throw new Error(\n \"Layout engine not initialized. Call setLayoutEngine() or initYoga()/initFlexily() first.\",\n )\n }\n return layoutEngine\n}\n\n/**\n * Check if a layout engine is initialized.\n */\nexport function isLayoutEngineInitialized(): boolean {\n return layoutEngine !== null\n}\n\n/**\n * Get the layout constants from the current engine.\n * Convenience function for accessing constants.\n */\nexport function getConstants(): LayoutConstants {\n return getLayoutEngine().constants\n}\n\n/**\n * Runtime guard: throws if the active layout engine doesn't advertise the named capability.\n *\n * Used by Phase A0.1+ primitives (`<Box fitWidth>`, `<Box containerQueries>`, cq* units,\n * style math functions) at their first-paint resolution path. Under `yoga` (or pre-A0.1\n * flexily), the throw happens at first paint with a one-line fix instruction in the error\n * message. No silent fallback — silent fallback under yoga would look like a fresh render\n * bug and cost hours of debugging.\n *\n * @param name The capability key being checked (e.g. `\"fitWidth\"`, `\"containerQueries\"`).\n * @param consumer A human-readable label for the call site, e.g. `\"<Box fitWidth>\"` or\n * `\"cqi unit in 'padding'\"`. Surfaces in the error message.\n */\nexport function requireCapability(name: keyof EngineCapabilities, consumer: string): void {\n const engine = getLayoutEngine()\n if (!engine.capabilities[name]) {\n throw new Error(\n `${consumer} requires layout engine capability \"${name}\" — current engine \"${engine.name}\" doesn't support it. ` +\n `Switch to flexily: set SILVERY_ENGINE=flexily, OR call ensureDefaultLayoutEngine(\"flexily\") before render.`,\n )\n }\n}\n\n// ============================================================================\n// Default Engine Initialization\n// ============================================================================\n\n/**\n * Layout engine type for configuration.\n *\n * - 'flexily': Zero-allocation Flexily (default, optimized for high-frequency layout)\n * - 'flexily-classic': Classic Flexily algorithm (for debugging/compatibility)\n * - 'yoga': Facebook's WASM-based flexbox (most mature)\n */\nexport type LayoutEngineType = \"flexily\" | \"yoga\"\n\n/**\n * Initialize the layout engine if not already set.\n *\n * @param engineType - 'flexily', 'flexily-classic', or 'yoga'. If not provided, checks\n * SILVERY_ENGINE env var, then defaults to 'flexily'.\n */\nexport async function ensureDefaultLayoutEngine(engineType?: LayoutEngineType): Promise<void> {\n if (isLayoutEngineInitialized()) {\n return\n }\n\n // Resolve engine type: option → env → 'flexily'\n const resolved =\n engineType ?? (process.env.SILVERY_ENGINE?.toLowerCase() as LayoutEngineType) ?? \"flexily\"\n\n if (resolved === \"yoga\") {\n const { initYogaEngine } = await import(\"./adapters/yoga-adapter.js\")\n setLayoutEngine(await initYogaEngine())\n } else {\n // 'flexily' (default) uses zero-allocation engine with CSS-correct defaults\n const { createFlexilyZeroEngine } = await import(\"./adapters/flexily-zero-adapter.js\")\n setLayoutEngine(createFlexilyZeroEngine())\n }\n}\n"],"mappings":";AAwKA,IAAI,eAAoC;;;;;AAMxC,SAAgB,gBAAgB,QAA4B;AAC1D,gBAAe;;;;;;AAOjB,SAAgB,kBAAgC;AAC9C,KAAI,CAAC,aACH,OAAM,IAAI,MACR,2FACD;AAEH,QAAO;;;;;AAMT,SAAgB,4BAAqC;AACnD,QAAO,iBAAiB;;;;;;AAO1B,SAAgB,eAAgC;AAC9C,QAAO,iBAAiB,CAAC;;;;;;;;;;;;;;;AAgB3B,SAAgB,kBAAkB,MAAgC,UAAwB;CACxF,MAAM,SAAS,iBAAiB;AAChC,KAAI,CAAC,OAAO,aAAa,MACvB,OAAM,IAAI,MACR,GAAG,SAAS,sCAAsC,KAAK,sBAAsB,OAAO,KAAK,kIAE1F;;;;;;;;AAuBL,eAAsB,0BAA0B,YAA8C;AAC5F,KAAI,2BAA2B,CAC7B;AAOF,MAFE,cAAe,QAAQ,IAAI,gBAAgB,aAAa,IAAyB,eAElE,QAAQ;EACvB,MAAM,EAAE,mBAAmB,MAAM,OAAO;AACxC,kBAAgB,MAAM,gBAAgB,CAAC;QAClC;EAEL,MAAM,EAAE,4BAA4B,MAAM,OAAO;AACjD,kBAAgB,yBAAyB,CAAC"}
@@ -1,2 +1,2 @@
1
- import { t as ensureDefaultLayoutEngine } from "./layout-engine-ClUgv6jB.mjs";
1
+ import { t as ensureDefaultLayoutEngine } from "./layout-engine-Ca_nbtfL.mjs";
2
2
  export { ensureDefaultLayoutEngine };