@g9tm/lynxcontrols 1.4.11 → 1.5.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 (141) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/dist/anchor/context.d.ts +15 -0
  3. package/dist/anchor/context.d.ts.map +1 -0
  4. package/dist/anchor/context.jsx +10 -0
  5. package/dist/anchor/context.jsx.map +1 -0
  6. package/dist/anchor/hooks.d.ts +72 -0
  7. package/dist/anchor/hooks.d.ts.map +1 -0
  8. package/dist/anchor/hooks.jsx +147 -0
  9. package/dist/anchor/hooks.jsx.map +1 -0
  10. package/dist/anchor/index.d.ts +6 -0
  11. package/dist/anchor/index.d.ts.map +1 -0
  12. package/dist/anchor/index.jsx +5 -0
  13. package/dist/anchor/measure.d.ts +22 -0
  14. package/dist/anchor/measure.d.ts.map +1 -0
  15. package/dist/anchor/measure.jsx +110 -0
  16. package/dist/anchor/measure.jsx.map +1 -0
  17. package/dist/anchor/registry.d.ts +108 -0
  18. package/dist/anchor/registry.d.ts.map +1 -0
  19. package/dist/anchor/registry.jsx +142 -0
  20. package/dist/anchor/registry.jsx.map +1 -0
  21. package/dist/anchor/scroll.d.ts +34 -0
  22. package/dist/anchor/scroll.d.ts.map +1 -0
  23. package/dist/anchor/scroll.jsx +255 -0
  24. package/dist/anchor/scroll.jsx.map +1 -0
  25. package/dist/base/control.d.ts +10 -3
  26. package/dist/base/control.d.ts.map +1 -1
  27. package/dist/base/control.jsx +17 -2
  28. package/dist/base/control.jsx.map +1 -1
  29. package/dist/base/pressable.d.ts.map +1 -1
  30. package/dist/base/pressable.jsx +7 -1
  31. package/dist/base/pressable.jsx.map +1 -1
  32. package/dist/button/button.d.ts.map +1 -1
  33. package/dist/button/button.jsx +11 -1
  34. package/dist/button/button.jsx.map +1 -1
  35. package/dist/button/header-action-button.d.ts.map +1 -1
  36. package/dist/button/header-action-button.jsx +10 -1
  37. package/dist/button/header-action-button.jsx.map +1 -1
  38. package/dist/button/icon-button.d.ts.map +1 -1
  39. package/dist/button/icon-button.jsx +11 -1
  40. package/dist/button/icon-button.jsx.map +1 -1
  41. package/dist/button/nav-card.d.ts.map +1 -1
  42. package/dist/button/nav-card.jsx +10 -1
  43. package/dist/button/nav-card.jsx.map +1 -1
  44. package/dist/button/vertical-icon-text-button.d.ts.map +1 -1
  45. package/dist/button/vertical-icon-text-button.jsx +10 -1
  46. package/dist/button/vertical-icon-text-button.jsx.map +1 -1
  47. package/dist/expander/expander.d.ts.map +1 -1
  48. package/dist/expander/expander.jsx +14 -1
  49. package/dist/expander/expander.jsx.map +1 -1
  50. package/dist/fields/editor.d.ts.map +1 -1
  51. package/dist/fields/editor.jsx +17 -1
  52. package/dist/fields/editor.jsx.map +1 -1
  53. package/dist/fields/outlined-field.d.ts +6 -0
  54. package/dist/fields/outlined-field.d.ts.map +1 -1
  55. package/dist/fields/outlined-field.jsx +14 -3
  56. package/dist/fields/outlined-field.jsx.map +1 -1
  57. package/dist/fields/text-entry.d.ts.map +1 -1
  58. package/dist/fields/text-entry.jsx +17 -1
  59. package/dist/fields/text-entry.jsx.map +1 -1
  60. package/dist/guide/guide.css +453 -0
  61. package/dist/guide/guide.css.map +1 -0
  62. package/dist/guide/index.d.ts +5 -0
  63. package/dist/guide/index.d.ts.map +1 -0
  64. package/dist/guide/index.jsx +4 -0
  65. package/dist/guide/journey.d.ts +46 -0
  66. package/dist/guide/journey.d.ts.map +1 -0
  67. package/dist/guide/journey.jsx +464 -0
  68. package/dist/guide/journey.jsx.map +1 -0
  69. package/dist/guide/placement.d.ts +44 -0
  70. package/dist/guide/placement.d.ts.map +1 -0
  71. package/dist/guide/placement.jsx +119 -0
  72. package/dist/guide/placement.jsx.map +1 -0
  73. package/dist/guide/service.d.ts +85 -0
  74. package/dist/guide/service.d.ts.map +1 -0
  75. package/dist/guide/service.jsx +620 -0
  76. package/dist/guide/service.jsx.map +1 -0
  77. package/dist/guide/settings.d.ts +50 -0
  78. package/dist/guide/settings.d.ts.map +1 -0
  79. package/dist/guide/settings.jsx +60 -0
  80. package/dist/guide/settings.jsx.map +1 -0
  81. package/dist/host/host.d.ts +5 -1
  82. package/dist/host/host.d.ts.map +1 -1
  83. package/dist/host/host.jsx +12 -0
  84. package/dist/host/host.jsx.map +1 -1
  85. package/dist/host/layers.d.ts +3 -1
  86. package/dist/host/layers.d.ts.map +1 -1
  87. package/dist/host/layers.jsx +4 -2
  88. package/dist/host/layers.jsx.map +1 -1
  89. package/dist/host/registry.d.ts +3 -0
  90. package/dist/host/registry.d.ts.map +1 -1
  91. package/dist/host/registry.jsx.map +1 -1
  92. package/dist/index.d.ts +3 -0
  93. package/dist/index.d.ts.map +1 -1
  94. package/dist/provider/contexts.d.ts +3 -0
  95. package/dist/provider/contexts.d.ts.map +1 -1
  96. package/dist/provider/contexts.jsx.map +1 -1
  97. package/dist/provider/provider.d.ts.map +1 -1
  98. package/dist/provider/provider.jsx +24 -17
  99. package/dist/provider/provider.jsx.map +1 -1
  100. package/dist/provider/settings.d.ts +4 -0
  101. package/dist/provider/settings.d.ts.map +1 -1
  102. package/dist/provider/settings.jsx +3 -2
  103. package/dist/provider/settings.jsx.map +1 -1
  104. package/dist/route/hooks.d.ts +34 -0
  105. package/dist/route/hooks.d.ts.map +1 -0
  106. package/dist/route/hooks.jsx +147 -0
  107. package/dist/route/hooks.jsx.map +1 -0
  108. package/dist/route/index.d.ts +3 -0
  109. package/dist/route/index.d.ts.map +1 -0
  110. package/dist/route/index.jsx +2 -0
  111. package/dist/route/router.d.ts +201 -0
  112. package/dist/route/router.d.ts.map +1 -0
  113. package/dist/route/router.jsx +810 -0
  114. package/dist/route/router.jsx.map +1 -0
  115. package/dist/sheet/frame.d.ts +3 -1
  116. package/dist/sheet/frame.d.ts.map +1 -1
  117. package/dist/sheet/frame.jsx +67 -25
  118. package/dist/sheet/frame.jsx.map +1 -1
  119. package/dist/sheet/options.d.ts +10 -0
  120. package/dist/sheet/options.d.ts.map +1 -1
  121. package/dist/sheet/options.jsx.map +1 -1
  122. package/dist/sheet/service.d.ts +5 -0
  123. package/dist/sheet/service.d.ts.map +1 -1
  124. package/dist/sheet/service.jsx +14 -2
  125. package/dist/sheet/service.jsx.map +1 -1
  126. package/dist/sheet/sheet.css +9 -0
  127. package/dist/sheet/sheet.css.map +1 -1
  128. package/dist/tabs/tab-view.d.ts +14 -0
  129. package/dist/tabs/tab-view.d.ts.map +1 -1
  130. package/dist/tabs/tab-view.jsx +59 -3
  131. package/dist/tabs/tab-view.jsx.map +1 -1
  132. package/dist/toggle/checkbox.d.ts.map +1 -1
  133. package/dist/toggle/checkbox.jsx +15 -1
  134. package/dist/toggle/checkbox.jsx.map +1 -1
  135. package/dist/toggle/chip-group.d.ts.map +1 -1
  136. package/dist/toggle/chip-group.jsx +12 -1
  137. package/dist/toggle/chip-group.jsx.map +1 -1
  138. package/dist/toggle/switch.d.ts.map +1 -1
  139. package/dist/toggle/switch.jsx +15 -1
  140. package/dist/toggle/switch.jsx.map +1 -1
  141. package/package.json +17 -2
@@ -1 +1 @@
1
- {"version":3,"file":"host/registry.jsx","sources":["../../src/host/registry.ts"],"sourcesContent":["import type { G9Capabilities } from '@g9tm/lynxcontrols-foundation';\nimport { G9Error } from '@g9tm/lynxcontrols-foundation';\nimport type { G9BackStack } from './back';\nimport type { G9LayerItem, G9LayerStore, G9OverlayLayer } from './layers';\nimport type { G9HostReadiness } from './readiness';\n\n/** Safe-area insets of a host, with the bottom inset that also reserves the page's own tab bar. */\nexport interface G9HostInsets {\n readonly top: number;\n readonly end: number;\n readonly bottom: number;\n readonly start: number;\n /** MAUI `BottomSafeAreaWithTabBar`: `bottom` unless the host's `computeBottomSafeAreaWithTabBar` adds a bar. */\n readonly bottomWithTabBar: number;\n}\n\n/**\n * Feature controllers later packages attach to a host (sheets, popups, toasts). Augment this interface to type them:\n * `declare module '@g9tm/lynxcontrols/host' { interface G9HostFeatures { sheets: G9SheetsController } }`.\n */\n// biome-ignore lint/suspicious/noEmptyInterface: augmentation point for later work packages\nexport interface G9HostFeatures {}\n\n/** A feature key: a declared {@link G9HostFeatures} key, or any string for untyped use. */\nexport type G9HostFeatureKey = keyof G9HostFeatures | (string & {});\ntype FeatureValue<K> = K extends keyof G9HostFeatures ? G9HostFeatures[K] : unknown;\n\n/**\n * One mounted `G9Host`, as code outside the component tree sees it (MAUI `IG9OverlayHost` plus the page's back and\n * readiness): the layers to mount into, the back stack, the insets, the services of its provider.\n */\nexport interface G9HostHandle {\n /** Unique per mounted host. */\n readonly id: string;\n /** The nearest enclosing host, or `null`. */\n readonly parent: G9HostHandle | null;\n /** The services of the provider this host lives in. */\n readonly services: G9Capabilities;\n /** The overlay layers (MAUI `OverlayLayer` = `sheets`, `ToastLayer` = `feedback`, `DevLayer` = `floating`). */\n readonly layers: G9LayerStore;\n /** Shorthand for `layers.register`. */\n registerLayerItem(layer: G9OverlayLayer, item: G9LayerItem): () => void;\n /** Shorthand for `layers.remove`. */\n removeLayerItem(layer: G9OverlayLayer, key: string): boolean;\n /** The host's back handlers. */\n readonly back: G9BackStack;\n /** Current insets (MAUI `Page.TopSafeAreaInset` and friends). */\n getInsets(): G9HostInsets;\n /** The page-loading cover and ready signal. */\n readonly readiness: G9HostReadiness;\n /** Attaches a feature controller; returns its detach function. Attaching a key twice throws. */\n attachFeature<K extends G9HostFeatureKey>(key: K, value: FeatureValue<K>): () => void;\n /** The attached feature, or `undefined`. */\n getFeature<K extends G9HostFeatureKey>(key: K): FeatureValue<K> | undefined;\n /** `true` once the host unmounted; a released handle refuses new layer items. */\n readonly released: boolean;\n /**\n * Transforms the page content (the sheets' backdrop-card recede, MAUI `BackdropHost`): `scale` and `translateY`\n * with a transition of `durationMs`; `null` restores it. The backdrop colour shows around the scaled page.\n */\n setContentEffect(effect: G9HostContentEffect | null): void;\n /** The current content effect (`null` = identity). */\n getContentEffect(): G9HostContentEffect | null;\n}\n\n/** A transform of the page content (see {@link G9HostHandle.setContentEffect}). */\nexport interface G9HostContentEffect {\n readonly scale: number;\n readonly translateY: number;\n readonly durationMs: number;\n /** Colour shown around the receded page. */\n readonly backdropColor?: string;\n}\n\n/** Listener of {@link G9HostRegistry.subscribe}. */\nexport type G9HostListener = (host: G9HostHandle | null) => void;\n\n/**\n * Finds the host for code that is not a component (MAUI `G9OverlayHosts`): view models, services, startup hooks.\n *\n * **Which host is active.** The registry is a most-recent-first stack of mounted hosts. A host is *on screen* while its\n * `active` prop is `true` (the default). The active host is the most recently activated host that is on screen —\n * except that a host never outranks a mounted, on-screen host nested inside it (the nested one is drawn on top of its\n * parent's content). When no host is on screen, the most recently registered one is active (app start, tab switch).\n * Unmounting a host removes it synchronously; the host beneath becomes active again. There is no \"last page\" leak.\n */\nexport interface G9HostRegistry {\n /** The active host, or `null` (MAUI `TryGetCurrent`): before the first host mounts and after the last unmounts. */\n active(): G9HostHandle | null;\n /** The active host, or throws `G9Error('host-missing')` (MAUI `GetCurrent`). For user-gesture code only. */\n require(): G9HostHandle;\n /**\n * Called when the active host changes (MAUI `CurrentChanged`), with the new host or `null`. Not called when a host\n * merely re-asserts what is already active. Returns an unsubscribe function.\n */\n subscribe(listener: G9HostListener): () => void;\n /** Number of mounted hosts. */\n readonly size: number;\n}\n\ninterface Slot {\n readonly host: G9HostHandle;\n onScreen: boolean;\n}\n\nconst slots: Slot[] = [];\nconst listeners = new Set<G9HostListener>();\n\nfunction isDescendant(host: G9HostHandle, ancestor: G9HostHandle): boolean {\n for (let p = host.parent; p; p = p.parent) if (p === ancestor) return true;\n return false;\n}\n\nfunction resolve(): G9HostHandle | null {\n const onScreen = slots.filter((slot) => slot.onScreen);\n let current = onScreen[0]?.host ?? slots[0]?.host ?? null;\n if (!current || onScreen.length === 0) return current;\n for (;;) {\n const parent: G9HostHandle = current;\n const nested = onScreen.find((slot) => isDescendant(slot.host, parent));\n if (!nested) return current;\n current = nested.host;\n }\n}\n\nfunction mutate(change: () => void): void {\n const before = resolve();\n change();\n const after = resolve();\n if (before === after) return;\n let failure: { error: unknown } | null = null;\n for (const listener of Array.from(listeners)) {\n if (!listeners.has(listener)) continue;\n try {\n listener(after);\n } catch (error) {\n failure ??= { error };\n }\n }\n if (failure) throw failure.error;\n}\n\nconst indexOf = (host: G9HostHandle) => slots.findIndex((slot) => slot.host === host);\n\n/** The process-wide host registry (the only mutable module-level state in the library, plan/specs/03 §6). */\nexport const g9Hosts: G9HostRegistry = {\n active: resolve,\n require() {\n const host = resolve();\n if (!host) {\n throw new G9Error(\n 'host-missing',\n 'No G9Host is mounted. Wrap the page in <G9Host> inside <G9Provider>; during startup or teardown use ' +\n 'g9Hosts.active() and handle null.',\n );\n }\n return host;\n },\n subscribe(listener) {\n listeners.add(listener);\n return () => {\n listeners.delete(listener);\n };\n },\n get size() {\n return slots.length;\n },\n};\n\n/**\n * Registry mutators used by `G9Host` (not exported from the package). `activate` puts a host on top and on screen;\n * `register` adds it below every on-screen host without displacing one; `markOffScreen` keeps the entry; `remove`\n * forgets it.\n */\nexport const hostRegistry = {\n activate(host: G9HostHandle): void {\n mutate(() => {\n const index = indexOf(host);\n if (index >= 0) slots.splice(index, 1);\n slots.unshift({ host, onScreen: true });\n });\n },\n register(host: G9HostHandle): void {\n mutate(() => {\n if (indexOf(host) >= 0) return;\n let index = 0;\n slots.forEach((slot, i) => {\n if (slot.onScreen) index = i + 1;\n });\n slots.splice(index, 0, { host, onScreen: false });\n });\n },\n markOffScreen(host: G9HostHandle): void {\n mutate(() => {\n const slot = slots[indexOf(host)];\n if (slot) slot.onScreen = false;\n });\n },\n remove(host: G9HostHandle): void {\n mutate(() => {\n const index = indexOf(host);\n if (index >= 0) slots.splice(index, 1);\n });\n },\n};\n"],"names":["slots","listeners","Set","isDescendant","host","ancestor","p","resolve","_ref","_slots_","onScreen","slot","current","parent","nested","mutate","change","before","after","failure","listener","Array","error","indexOf","g9Hosts","G9Error","hostRegistry","index","i"],"mappings":";AAyGA,MAAMA,QAAgB,EAAE;AACxB,MAAMC,YAAY,IAAIC;AAEtB,SAAS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ACR;QACE,MAAMH,OAAOG;QACb,IAAI,CAACH,MACH,MAAM,IAAIqB,QACR,gBACA;QAIJ,OAAOrB;IACT;IACA,WAAUgB,QAAQ;QAChBnB,UAAU,GAAG,CAACmB;QACd,OAAO;YACLnB,UAAU,MAAM,CAACmB;QACnB;IACF;IACA,IAAI;QACF,OAAOpB,MAAM,MAAM;IACrB;AACF;AAOO,MAAM0B,eAAe;IAC1B,UAAStB,IAAkB;QACzBW,OAAO;YACL,MAAMY,QAAQJ,QAAQnB;YACtB,IAAIuB,SAAS,GAAG3B,MAAM,MAAM,CAAC2B,OAAO;YACpC3B,MAAM,OAAO,CAAC;gBAAEI;gBAAM,UAAU;YAAK;QACvC;IACF;IACA,UAASA,IAAkB;QACzBW,OAAO;YACL,IAAIQ,QAAQnB,SAAS,GAAG;YACxB,IAAIuB,QAAQ;YACZ3B,MAAM,OAAO,CAAC,CAACW,MAAMiB;gBACnB,IAAIjB,KAAK,QAAQ,EAAEgB,QAAQC,IAAI;YACjC;YACA5B,MAAM,MAAM,CAAC2B,OAAO,GAAG;gBAAEvB;gBAAM,UAAU;YAAM;QACjD;IACF;IACA,eAAcA,IAAkB;QAC9BW,OAAO;YACL,MAAMJ,OAAOX,KAAK,CAACuB,QAAQnB,MAAM;YACjC,IAAIO,MAAMA,KAAK,QAAQ,GAAG;QAC5B;IACF;IACA,QAAOP,IAAkB;QACvBW,OAAO;YACL,MAAMY,QAAQJ,QAAQnB;YACtB,IAAIuB,SAAS,GAAG3B,MAAM,MAAM,CAAC2B,OAAO;QACtC;IACF;AACF"}
1
+ {"version":3,"file":"host/registry.jsx","sources":["../../src/host/registry.ts"],"sourcesContent":["import type { G9Capabilities } from '@g9tm/lynxcontrols-foundation';\nimport { G9Error } from '@g9tm/lynxcontrols-foundation';\nimport type { G9AnchorRegistry } from '../anchor/registry';\nimport type { G9BackStack } from './back';\nimport type { G9LayerItem, G9LayerStore, G9OverlayLayer } from './layers';\nimport type { G9HostReadiness } from './readiness';\n\n/** Safe-area insets of a host, with the bottom inset that also reserves the page's own tab bar. */\nexport interface G9HostInsets {\n readonly top: number;\n readonly end: number;\n readonly bottom: number;\n readonly start: number;\n /** MAUI `BottomSafeAreaWithTabBar`: `bottom` unless the host's `computeBottomSafeAreaWithTabBar` adds a bar. */\n readonly bottomWithTabBar: number;\n}\n\n/**\n * Feature controllers later packages attach to a host (sheets, popups, toasts). Augment this interface to type them:\n * `declare module '@g9tm/lynxcontrols/host' { interface G9HostFeatures { sheets: G9SheetsController } }`.\n */\n// biome-ignore lint/suspicious/noEmptyInterface: augmentation point for later work packages\nexport interface G9HostFeatures {}\n\n/** A feature key: a declared {@link G9HostFeatures} key, or any string for untyped use. */\nexport type G9HostFeatureKey = keyof G9HostFeatures | (string & {});\ntype FeatureValue<K> = K extends keyof G9HostFeatures ? G9HostFeatures[K] : unknown;\n\n/**\n * One mounted `G9Host`, as code outside the component tree sees it (MAUI `IG9OverlayHost` plus the page's back and\n * readiness): the layers to mount into, the back stack, the insets, the services of its provider.\n */\nexport interface G9HostHandle {\n /** Unique per mounted host. */\n readonly id: string;\n /** The nearest enclosing host, or `null`. */\n readonly parent: G9HostHandle | null;\n /** The services of the provider this host lives in. */\n readonly services: G9Capabilities;\n /** The provider's anchors (every control a guide or an automation can reach). */\n readonly anchors: G9AnchorRegistry;\n /** The overlay layers (MAUI `OverlayLayer` = `sheets`, `ToastLayer` = `feedback`, `DevLayer` = `floating`). */\n readonly layers: G9LayerStore;\n /** Shorthand for `layers.register`. */\n registerLayerItem(layer: G9OverlayLayer, item: G9LayerItem): () => void;\n /** Shorthand for `layers.remove`. */\n removeLayerItem(layer: G9OverlayLayer, key: string): boolean;\n /** The host's back handlers. */\n readonly back: G9BackStack;\n /** Current insets (MAUI `Page.TopSafeAreaInset` and friends). */\n getInsets(): G9HostInsets;\n /** The page-loading cover and ready signal. */\n readonly readiness: G9HostReadiness;\n /** Attaches a feature controller; returns its detach function. Attaching a key twice throws. */\n attachFeature<K extends G9HostFeatureKey>(key: K, value: FeatureValue<K>): () => void;\n /** The attached feature, or `undefined`. */\n getFeature<K extends G9HostFeatureKey>(key: K): FeatureValue<K> | undefined;\n /** `true` once the host unmounted; a released handle refuses new layer items. */\n readonly released: boolean;\n /**\n * Transforms the page content (the sheets' backdrop-card recede, MAUI `BackdropHost`): `scale` and `translateY`\n * with a transition of `durationMs`; `null` restores it. The backdrop colour shows around the scaled page.\n */\n setContentEffect(effect: G9HostContentEffect | null): void;\n /** The current content effect (`null` = identity). */\n getContentEffect(): G9HostContentEffect | null;\n}\n\n/** A transform of the page content (see {@link G9HostHandle.setContentEffect}). */\nexport interface G9HostContentEffect {\n readonly scale: number;\n readonly translateY: number;\n readonly durationMs: number;\n /** Colour shown around the receded page. */\n readonly backdropColor?: string;\n}\n\n/** Listener of {@link G9HostRegistry.subscribe}. */\nexport type G9HostListener = (host: G9HostHandle | null) => void;\n\n/**\n * Finds the host for code that is not a component (MAUI `G9OverlayHosts`): view models, services, startup hooks.\n *\n * **Which host is active.** The registry is a most-recent-first stack of mounted hosts. A host is *on screen* while its\n * `active` prop is `true` (the default). The active host is the most recently activated host that is on screen —\n * except that a host never outranks a mounted, on-screen host nested inside it (the nested one is drawn on top of its\n * parent's content). When no host is on screen, the most recently registered one is active (app start, tab switch).\n * Unmounting a host removes it synchronously; the host beneath becomes active again. There is no \"last page\" leak.\n */\nexport interface G9HostRegistry {\n /** The active host, or `null` (MAUI `TryGetCurrent`): before the first host mounts and after the last unmounts. */\n active(): G9HostHandle | null;\n /** The active host, or throws `G9Error('host-missing')` (MAUI `GetCurrent`). For user-gesture code only. */\n require(): G9HostHandle;\n /**\n * Called when the active host changes (MAUI `CurrentChanged`), with the new host or `null`. Not called when a host\n * merely re-asserts what is already active. Returns an unsubscribe function.\n */\n subscribe(listener: G9HostListener): () => void;\n /** Number of mounted hosts. */\n readonly size: number;\n}\n\ninterface Slot {\n readonly host: G9HostHandle;\n onScreen: boolean;\n}\n\nconst slots: Slot[] = [];\nconst listeners = new Set<G9HostListener>();\n\nfunction isDescendant(host: G9HostHandle, ancestor: G9HostHandle): boolean {\n for (let p = host.parent; p; p = p.parent) if (p === ancestor) return true;\n return false;\n}\n\nfunction resolve(): G9HostHandle | null {\n const onScreen = slots.filter((slot) => slot.onScreen);\n let current = onScreen[0]?.host ?? slots[0]?.host ?? null;\n if (!current || onScreen.length === 0) return current;\n for (;;) {\n const parent: G9HostHandle = current;\n const nested = onScreen.find((slot) => isDescendant(slot.host, parent));\n if (!nested) return current;\n current = nested.host;\n }\n}\n\nfunction mutate(change: () => void): void {\n const before = resolve();\n change();\n const after = resolve();\n if (before === after) return;\n let failure: { error: unknown } | null = null;\n for (const listener of Array.from(listeners)) {\n if (!listeners.has(listener)) continue;\n try {\n listener(after);\n } catch (error) {\n failure ??= { error };\n }\n }\n if (failure) throw failure.error;\n}\n\nconst indexOf = (host: G9HostHandle) => slots.findIndex((slot) => slot.host === host);\n\n/** The process-wide host registry (the only mutable module-level state in the library, plan/specs/03 §6). */\nexport const g9Hosts: G9HostRegistry = {\n active: resolve,\n require() {\n const host = resolve();\n if (!host) {\n throw new G9Error(\n 'host-missing',\n 'No G9Host is mounted. Wrap the page in <G9Host> inside <G9Provider>; during startup or teardown use ' +\n 'g9Hosts.active() and handle null.',\n );\n }\n return host;\n },\n subscribe(listener) {\n listeners.add(listener);\n return () => {\n listeners.delete(listener);\n };\n },\n get size() {\n return slots.length;\n },\n};\n\n/**\n * Registry mutators used by `G9Host` (not exported from the package). `activate` puts a host on top and on screen;\n * `register` adds it below every on-screen host without displacing one; `markOffScreen` keeps the entry; `remove`\n * forgets it.\n */\nexport const hostRegistry = {\n activate(host: G9HostHandle): void {\n mutate(() => {\n const index = indexOf(host);\n if (index >= 0) slots.splice(index, 1);\n slots.unshift({ host, onScreen: true });\n });\n },\n register(host: G9HostHandle): void {\n mutate(() => {\n if (indexOf(host) >= 0) return;\n let index = 0;\n slots.forEach((slot, i) => {\n if (slot.onScreen) index = i + 1;\n });\n slots.splice(index, 0, { host, onScreen: false });\n });\n },\n markOffScreen(host: G9HostHandle): void {\n mutate(() => {\n const slot = slots[indexOf(host)];\n if (slot) slot.onScreen = false;\n });\n },\n remove(host: G9HostHandle): void {\n mutate(() => {\n const index = indexOf(host);\n if (index >= 0) slots.splice(index, 1);\n });\n },\n};\n"],"names":["slots","listeners","Set","isDescendant","host","ancestor","p","resolve","_ref","_slots_","onScreen","slot","current","parent","nested","mutate","change","before","after","failure","listener","Array","error","indexOf","g9Hosts","G9Error","hostRegistry","index","i"],"mappings":";AA4GA,MAAMA,QAAgB,EAAE;AACxB,MAAMC,YAAY,IAAIC;AAEtB,SAASC,aAAaC,IAAkB,EAAEC,QAAsB;IAC9D,IAAK,IAAIC,IAAIF,KAAK,MAAM,EAAEE,GAAGA,IAAIA,EAAE,MAAM,CAAE,IAAIA,MAAMD,UAAU,OAAO;IACtE,OAAO;AACT;AAEA,SAASE;QAEOC,MAAAA;QAAAA,YAAqBC;IADnC,MAAMC,WAAWV,MAAM,MAAM,CAAC,CAACW,OAASA,KAAK,QAAQ;IACrD,IAAIC,UAAU,QAAAJ,CAAAA,OAAAA,QAAAA,CAAAA,QAAAA,QAAAA,CAAAA,aAAAA,QAAQ,CAAC,EAAE,AAAD,IAAVA,KAAAA,IAAAA,WAAa,IAAI,AAAD,IAAC,gBAAIC,CAAAA,UAAAA,KAAK,CAAC,EAAE,AAAD,IAAPA,KAAAA,IAAAA,QAAU,IAAI,AAAD,IAAlCD,OAAuC;IACrD,IAAI,CAACI,WAAWF,AAAoB,MAApBA,SAAS,MAAM,EAAQ,OAAOE;IAC9C,OAAS;QACP,MAAMC,SAAuBD;QAC7B,MAAME,SAASJ,SAAS,IAAI,CAAC,CAACC,OAASR,aAAaQ,KAAK,IAAI,EAAEE;QAC/D,IAAI,CAACC,QAAQ,OAAOF;QACpBA,UAAUE,OAAO,IAAI;IACvB;AACF;AAEA,SAASC,OAAOC,MAAkB;IAChC,MAAMC,SAASV;IACfS;IACA,MAAME,QAAQX;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A,QAAOP,IAAkB;QACvBW,OAAO;YACL,MAAMY,QAAQJ,QAAQnB;YACtB,IAAIuB,SAAS,GAAG3B,MAAM,MAAM,CAAC2B,OAAO;QACtC;IACF;AACF"}
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ export type * from './anchor/index.js';
1
2
  export type * from './base/index.js';
2
3
  export type * from './button/index.js';
3
4
  export type * from './cascade/index.js';
@@ -6,6 +7,7 @@ export type * from './display/index.js';
6
7
  export type * from './edge-panel/index.js';
7
8
  export type * from './expander/index.js';
8
9
  export type * from './fields/index.js';
10
+ export type * from './guide/index.js';
9
11
  export type * from './host/index.js';
10
12
  export type * from './icon/index.js';
11
13
  export type * from './pickers/index.js';
@@ -13,6 +15,7 @@ export type * from './plus-button/index.js';
13
15
  export type * from './popup/index.js';
14
16
  export type * from './provider/index.js';
15
17
  export type * from './range-slider/index.js';
18
+ export type * from './route/index.js';
16
19
  export type * from './selection/index.js';
17
20
  export type * from './sheet/index.js';
18
21
  export type * from './swipe/index.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,mBAAmB,QAAQ,CAAC;AAC5B,mBAAmB,UAAU,CAAC;AAC9B,mBAAmB,WAAW,CAAC;AAC/B,mBAAmB,YAAY,CAAC;AAChC,mBAAmB,WAAW,CAAC;AAC/B,mBAAmB,cAAc,CAAC;AAClC,mBAAmB,YAAY,CAAC;AAChC,mBAAmB,UAAU,CAAC;AAC9B,mBAAmB,QAAQ,CAAC;AAC5B,mBAAmB,QAAQ,CAAC;AAC5B,mBAAmB,WAAW,CAAC;AAC/B,mBAAmB,eAAe,CAAC;AACnC,mBAAmB,SAAS,CAAC;AAC7B,mBAAmB,YAAY,CAAC;AAChC,mBAAmB,gBAAgB,CAAC;AACpC,mBAAmB,aAAa,CAAC;AACjC,mBAAmB,SAAS,CAAC;AAC7B,mBAAmB,SAAS,CAAC;AAC7B,mBAAmB,WAAW,CAAC;AAC/B,mBAAmB,QAAQ,CAAC;AAC5B,mBAAmB,SAAS,CAAC;AAC7B,mBAAmB,UAAU,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,mBAAmB,UAAU,CAAC;AAC9B,mBAAmB,QAAQ,CAAC;AAC5B,mBAAmB,UAAU,CAAC;AAC9B,mBAAmB,WAAW,CAAC;AAC/B,mBAAmB,YAAY,CAAC;AAChC,mBAAmB,WAAW,CAAC;AAC/B,mBAAmB,cAAc,CAAC;AAClC,mBAAmB,YAAY,CAAC;AAChC,mBAAmB,UAAU,CAAC;AAC9B,mBAAmB,SAAS,CAAC;AAC7B,mBAAmB,QAAQ,CAAC;AAC5B,mBAAmB,QAAQ,CAAC;AAC5B,mBAAmB,WAAW,CAAC;AAC/B,mBAAmB,eAAe,CAAC;AACnC,mBAAmB,SAAS,CAAC;AAC7B,mBAAmB,YAAY,CAAC;AAChC,mBAAmB,gBAAgB,CAAC;AACpC,mBAAmB,SAAS,CAAC;AAC7B,mBAAmB,aAAa,CAAC;AACjC,mBAAmB,SAAS,CAAC;AAC7B,mBAAmB,SAAS,CAAC;AAC7B,mBAAmB,WAAW,CAAC;AAC/B,mBAAmB,QAAQ,CAAC;AAC5B,mBAAmB,SAAS,CAAC;AAC7B,mBAAmB,UAAU,CAAC"}
@@ -1,4 +1,5 @@
1
1
  import type { G9Capabilities, G9Culture, G9CultureStore, G9Diagnostics, G9Preferences, G9SafeExecutor, G9SafeInsets, G9Strings, G9ThemeStore } from '@g9tm/lynxcontrols-foundation';
2
+ import type { G9AnchorRegistry } from '../anchor/registry.js';
2
3
  import type { G9ResolvedSettings } from './settings.js';
3
4
  /** What `useG9Culture` and `useG9Strings` read: the snapshot and the strings built for it. */
4
5
  export interface G9CultureContextValue {
@@ -29,6 +30,8 @@ export interface G9ProviderCore {
29
30
  readonly executor: G9SafeExecutor;
30
31
  /** Id of the provider's root `<view>` (the element carrying the theme variables). */
31
32
  readonly rootId: string;
33
+ /** Every anchor of this LynxView (`@g9tm/lynxcontrols/anchor`): the controls a guide or an automation can reach. */
34
+ readonly anchors: G9AnchorRegistry;
32
35
  }
33
36
  export declare const G9CoreContext: import("react").Context<G9ProviderCore | null>;
34
37
  export declare const G9CultureContext: import("react").Context<G9CultureContextValue | null>;
@@ -1 +1 @@
1
- {"version":3,"file":"contexts.d.ts","sourceRoot":"","sources":["../../src/provider/contexts.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,cAAc,EACd,SAAS,EACT,cAAc,EACd,aAAa,EACb,aAAa,EACb,cAAc,EACd,YAAY,EACZ,SAAS,EACT,YAAY,EACb,MAAM,+BAA+B,CAAC;AAEvC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAErD,8FAA8F;AAC9F,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,OAAO,EAAE,SAAS,CAAC;IAC5B,QAAQ,CAAC,OAAO,EAAE,SAAS,CAAC;IAC5B,QAAQ,CAAC,KAAK,EAAE,cAAc,CAAC;CAChC;AAED,qHAAqH;AACrH,MAAM,WAAW,eAAe;IAC9B,oDAAoD;IACpD,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,yCAAyC;IACzC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,wGAAwG;IACxG,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;CAC/B;AAED,wFAAwF;AACxF,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,oFAAoF;AACpF,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC;IAClC,QAAQ,CAAC,UAAU,EAAE,YAAY,CAAC;IAClC,QAAQ,CAAC,WAAW,EAAE,aAAa,CAAC;IACpC,QAAQ,CAAC,WAAW,EAAE,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;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,oFAAoF;AACpF,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC;IAClC,QAAQ,CAAC,UAAU,EAAE,YAAY,CAAC;IAClC,QAAQ,CAAC,WAAW,EAAE,aAAa,CAAC;IACpC,QAAQ,CAAC,WAAW,EAAE,aAAa,CAAC;IACpC,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC;IAClC,qFAAqF;IACrF,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,oHAAoH;IACpH,QAAQ,CAAC,OAAO,EAAE,gBAAgB,CAAC;CACpC;AAED,eAAO,MAAM,aAAa,gDAA6C,CAAC;AACxE,eAAO,MAAM,gBAAgB,uDAAoD,CAAC;AAClF,eAAO,MAAM,iBAAiB,oDAAiD,CAAC;AAChF,eAAO,MAAM,iBAAiB,iDAA8C,CAAC;AAC7E,eAAO,MAAM,eAAe,+CAA4C,CAAC;AACzE,eAAO,MAAM,eAAe,8CAA2C,CAAC;AACxE,wGAAwG;AACxG,eAAO,MAAM,oBAAoB,+CAA4C,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"provider/contexts.jsx","sources":["../../src/provider/contexts.ts"],"sourcesContent":["// React contexts behind G9Provider. One context per kind of change, so a consumer re-renders only for what it reads:\n// the theme store and services never change identity, culture changes re-render culture readers, keyboard and window\n// changes re-render only their readers (plan/specs/01 §5).\n\nimport type {\n G9Capabilities,\n G9Culture,\n G9CultureStore,\n G9Diagnostics,\n G9Preferences,\n G9SafeExecutor,\n G9SafeInsets,\n G9Strings,\n G9ThemeStore,\n} from '@g9tm/lynxcontrols-foundation';\nimport { createContext } from '@lynx-js/react';\nimport type { G9ResolvedSettings } from './settings';\n\n/** What `useG9Culture` and `useG9Strings` read: the snapshot and the strings built for it. */\nexport interface G9CultureContextValue {\n readonly culture: G9Culture;\n readonly strings: G9Strings;\n readonly store: G9CultureStore;\n}\n\n/** Soft-keyboard state (plan/specs/02 §4 `keyboardstatuschanged`). Heights are in the units the platform reports. */\nexport interface G9KeyboardState {\n /** `true` between a `'on'` and the next `'off'`. */\n readonly visible: boolean;\n /** Keyboard height; `0` while hidden. */\n readonly height: number;\n /** The platform's compatibility height (Lynx `compatHeight`); `0` while hidden or when not reported. */\n readonly compatHeight: number;\n}\n\n/** Window size in logical pixels (MAUI `G9ScreenHelper.WidthInDip` / `HeightInDip`). */\nexport interface G9WindowState {\n readonly width: number;\n readonly height: number;\n}\n\n/** Everything a provider shares that never changes identity while it is mounted. */\nexport interface G9ProviderCore {\n readonly services: G9Capabilities;\n readonly themeStore: G9ThemeStore;\n readonly preferences: G9Preferences;\n readonly diagnostics: G9Diagnostics;\n readonly executor: G9SafeExecutor;\n /** Id of the provider's root `<view>` (the element carrying the theme variables). */\n readonly rootId: string;\n}\n\nexport const G9CoreContext = createContext<G9ProviderCore | null>(null);\nexport const G9CultureContext = createContext<G9CultureContextValue | null>(null);\nexport const G9SettingsContext = createContext<G9ResolvedSettings | null>(null);\nexport const G9KeyboardContext = createContext<G9KeyboardState | null>(null);\nexport const G9WindowContext = createContext<G9WindowState | null>(null);\nexport const G9InsetsContext = createContext<G9SafeInsets | null>(null);\n/** The provider's diagnostics hub, or `null` outside a provider (base hooks fall back to `console`). */\nexport const G9DiagnosticsContext = createContext<G9Diagnostics | null>(null);\n"],"names":["G9CoreContext","createContext","G9CultureContext","G9SettingsContext","G9KeyboardContext","G9WindowContext","G9InsetsContext","G9DiagnosticsContext"],"mappings":";AAoDO,MAAMA,gBAAgBC,cAAqC;AAC3D,MAAMC,mBAAmBD,cAA4C;AACrE,MAAME,oBAAoBF,cAAyC;AACnE,MAAMG,oBAAoBH,cAAsC;AAChE,MAAMI,kBAAkBJ,cAAoC;AAC5D,MAAMK,kBAAkBL,cAAmC;AAE3D,MAAMM,uBAAuBN,cAAoC"}
1
+ {"version":3,"file":"provider/contexts.jsx","sources":["../../src/provider/contexts.ts"],"sourcesContent":["// React contexts behind G9Provider. One context per kind of change, so a consumer re-renders only for what it reads:\n// the theme store and services never change identity, culture changes re-render culture readers, keyboard and window\n// changes re-render only their readers (plan/specs/01 §5).\n\nimport type {\n G9Capabilities,\n G9Culture,\n G9CultureStore,\n G9Diagnostics,\n G9Preferences,\n G9SafeExecutor,\n G9SafeInsets,\n G9Strings,\n G9ThemeStore,\n} from '@g9tm/lynxcontrols-foundation';\nimport { createContext } from '@lynx-js/react';\nimport type { G9AnchorRegistry } from '../anchor/registry';\nimport type { G9ResolvedSettings } from './settings';\n\n/** What `useG9Culture` and `useG9Strings` read: the snapshot and the strings built for it. */\nexport interface G9CultureContextValue {\n readonly culture: G9Culture;\n readonly strings: G9Strings;\n readonly store: G9CultureStore;\n}\n\n/** Soft-keyboard state (plan/specs/02 §4 `keyboardstatuschanged`). Heights are in the units the platform reports. */\nexport interface G9KeyboardState {\n /** `true` between a `'on'` and the next `'off'`. */\n readonly visible: boolean;\n /** Keyboard height; `0` while hidden. */\n readonly height: number;\n /** The platform's compatibility height (Lynx `compatHeight`); `0` while hidden or when not reported. */\n readonly compatHeight: number;\n}\n\n/** Window size in logical pixels (MAUI `G9ScreenHelper.WidthInDip` / `HeightInDip`). */\nexport interface G9WindowState {\n readonly width: number;\n readonly height: number;\n}\n\n/** Everything a provider shares that never changes identity while it is mounted. */\nexport interface G9ProviderCore {\n readonly services: G9Capabilities;\n readonly themeStore: G9ThemeStore;\n readonly preferences: G9Preferences;\n readonly diagnostics: G9Diagnostics;\n readonly executor: G9SafeExecutor;\n /** Id of the provider's root `<view>` (the element carrying the theme variables). */\n readonly rootId: string;\n /** Every anchor of this LynxView (`@g9tm/lynxcontrols/anchor`): the controls a guide or an automation can reach. */\n readonly anchors: G9AnchorRegistry;\n}\n\nexport const G9CoreContext = createContext<G9ProviderCore | null>(null);\nexport const G9CultureContext = createContext<G9CultureContextValue | null>(null);\nexport const G9SettingsContext = createContext<G9ResolvedSettings | null>(null);\nexport const G9KeyboardContext = createContext<G9KeyboardState | null>(null);\nexport const G9WindowContext = createContext<G9WindowState | null>(null);\nexport const G9InsetsContext = createContext<G9SafeInsets | null>(null);\n/** The provider's diagnostics hub, or `null` outside a provider (base hooks fall back to `console`). */\nexport const G9DiagnosticsContext = createContext<G9Diagnostics | null>(null);\n"],"names":["G9CoreContext","createContext","G9CultureContext","G9SettingsContext","G9KeyboardContext","G9WindowContext","G9InsetsContext","G9DiagnosticsContext"],"mappings":";AAuDO,MAAMA,gBAAgBC,cAAqC;AAC3D,MAAMC,mBAAmBD,cAA4C;AACrE,MAAME,oBAAoBF,cAAyC;AACnE,MAAMG,oBAAoBH,cAAsC;AAChE,MAAMI,kBAAkBJ,cAAoC;AAC5D,MAAMK,kBAAkBL,cAAmC;AAE3D,MAAMM,uBAAuBN,cAAoC"}
@@ -1 +1 @@
1
- {"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../src/provider/provider.tsx"],"names":[],"mappings":"AAAA,OAAO,EASL,KAAK,cAAc,EACnB,KAAK,aAAa,EAElB,KAAK,SAAS,EACd,KAAK,cAAc,EACnB,KAAK,aAAa,EAGlB,KAAK,cAAc,EACnB,KAAK,YAAY,EAMlB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,KAAK,SAAS,EAA8D,MAAM,gBAAgB,CAAC;AAgB5G,OAAO,EAAE,KAAK,UAAU,EAA4C,MAAM,YAAY,CAAC;AAEvF,OAAO,gBAAgB,CAAC;AACxB,OAAO,aAAa,CAAC;AAErB,mCAAmC;AACnC,MAAM,WAAW,eAAe;IAC9B;;;OAGG;IACH,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC;IAC3C;;;OAGG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,cAAc,GAAG,SAAS,GAAG,MAAM,CAAC;IACvD;;;OAGG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,YAAY,GAAG,cAAc,CAAC;IAC/C,kHAAkH;IAClH,QAAQ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AAO,CAAC;IAChC,8EAA8E;IAC9E,QAAQ,CAAC,QAAQ,CAAC,EAAE,UAAU,CAAC;IAC/B,gEAAgE;IAChE,QAAQ,CAAC,WAAW,CAAC,EAAE,aAAa,CAAC;IACrC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAC;CAC/B;AA6BD;;;;;;;;;;;;GAYG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,GAAG,SAAS,CAwO5D"}
@@ -1,5 +1,7 @@
1
1
  import { assertRequiredCapabilities, createCultureStore, createDiagnostics, createIconFontRegistry, createPreferences, createSafeExecutor, createStrings, createThemeStore, g9MotionScale, subscribeG9Motion, toCssVariables, toLayoutCssVariables, toMetricCssVariables } from "@g9tm/lynxcontrols-foundation";
2
2
  import { useEffect, useMemo, useRef, useState, useSyncExternalStore } from "@lynx-js/react";
3
+ import { G9AnchorRegistryContext } from "../anchor/context.jsx";
4
+ import { createAnchorRegistry } from "../anchor/registry.jsx";
3
5
  import { useStableCallback } from "../base/use-stable-callback.jsx";
4
6
  import { g9Hosts } from "../host/registry.jsx";
5
7
  import { G9CoreContext, G9CultureContext, G9DiagnosticsContext, G9InsetsContext, G9KeyboardContext, G9SettingsContext, G9WindowContext } from "./contexts.jsx";
@@ -109,6 +111,7 @@ function G9Provider(props) {
109
111
  providerSequence += 1;
110
112
  return `g9-provider-${providerSequence}`;
111
113
  });
114
+ const [anchors] = useState(createAnchorRegistry);
112
115
  const core = useMemo(()=>{
113
116
  var _executorSettings_showError;
114
117
  const preferences = createPreferences({
@@ -152,14 +155,16 @@ function G9Provider(props) {
152
155
  preferences,
153
156
  diagnostics,
154
157
  executor,
155
- rootId
158
+ rootId,
159
+ anchors
156
160
  });
157
161
  }, [
158
162
  services,
159
163
  themeStore,
160
164
  diagnostics,
161
165
  settings.executor,
162
- rootId
166
+ rootId,
167
+ anchors
163
168
  ]);
164
169
  useEffect(()=>()=>core.executor.dispose(), [
165
170
  core
@@ -270,21 +275,23 @@ function G9Provider(props) {
270
275
  const rootStyle = null != fallbackVariables ? fallbackVariables : initialVariables;
271
276
  const directionClass = 'rtl' === culture.direction ? 'g9-dir-rtl' : 'g9-dir-ltr';
272
277
  return <G9CoreContext.Provider value={core}>
273
- <G9DiagnosticsContext.Provider value={diagnostics}>
274
- <G9SettingsContext.Provider value={settings}>
275
- <G9CultureContext.Provider value={cultureValue}>
276
- <G9KeyboardContext.Provider value={keyboard}>
277
- <G9WindowContext.Provider value={windowState}>
278
- <G9InsetsContext.Provider value={insets}>
279
- <view id={rootId} className={`g9-provider g9-theme-${initialScheme} ${directionClass}${motionOff ? ' g9-motion-off' : ''}${props.className ? ` ${props.className}` : ''}`} style={rootStyle}>
280
- {props.children}
281
- </view>
282
- </G9InsetsContext.Provider>
283
- </G9WindowContext.Provider>
284
- </G9KeyboardContext.Provider>
285
- </G9CultureContext.Provider>
286
- </G9SettingsContext.Provider>
287
- </G9DiagnosticsContext.Provider>
278
+ <G9AnchorRegistryContext.Provider value={anchors}>
279
+ <G9DiagnosticsContext.Provider value={diagnostics}>
280
+ <G9SettingsContext.Provider value={settings}>
281
+ <G9CultureContext.Provider value={cultureValue}>
282
+ <G9KeyboardContext.Provider value={keyboard}>
283
+ <G9WindowContext.Provider value={windowState}>
284
+ <G9InsetsContext.Provider value={insets}>
285
+ <view id={rootId} className={`g9-provider g9-theme-${initialScheme} ${directionClass}${motionOff ? ' g9-motion-off' : ''}${props.className ? ` ${props.className}` : ''}`} style={rootStyle}>
286
+ {props.children}
287
+ </view>
288
+ </G9InsetsContext.Provider>
289
+ </G9WindowContext.Provider>
290
+ </G9KeyboardContext.Provider>
291
+ </G9CultureContext.Provider>
292
+ </G9SettingsContext.Provider>
293
+ </G9DiagnosticsContext.Provider>
294
+ </G9AnchorRegistryContext.Provider>
288
295
  </G9CoreContext.Provider>;
289
296
  }
290
297
  export { G9Provider };
@@ -1 +1 @@
1
- {"version":3,"file":"provider/provider.jsx","sources":["../../src/provider/provider.tsx"],"sourcesContent":["import {\n assertRequiredCapabilities,\n createCultureStore,\n createDiagnostics,\n createIconFontRegistry,\n createPreferences,\n createSafeExecutor,\n createStrings,\n createThemeStore,\n type G9Capabilities,\n type G9ColorScheme,\n type G9CssVariables,\n type G9Culture,\n type G9CultureStore,\n type G9Diagnostics,\n type G9SafeInsets,\n type G9ThemeMode,\n type G9ThemeOptions,\n type G9ThemeStore,\n g9MotionScale,\n subscribeG9Motion,\n toCssVariables,\n toLayoutCssVariables,\n toMetricCssVariables,\n} from '@g9tm/lynxcontrols-foundation';\nimport { type ReactNode, useEffect, useMemo, useRef, useState, useSyncExternalStore } from '@lynx-js/react';\nimport { useStableCallback } from '../base/use-stable-callback';\nimport { g9Hosts } from '../host/registry';\nimport {\n G9CoreContext,\n G9CultureContext,\n G9DiagnosticsContext,\n G9InsetsContext,\n G9KeyboardContext,\n type G9KeyboardState,\n type G9ProviderCore,\n G9SettingsContext,\n G9WindowContext,\n type G9WindowState,\n} from './contexts';\nimport { addGlobalListener } from './global-events';\nimport { type G9Settings, g9DefaultErrorPresenter, resolveSettings } from './settings';\nimport { applyThemeVariables, changedVariables } from './theme-root';\nimport './provider.css';\nimport './theme.css';\n\n/** Props of {@link G9Provider}. */\nexport interface G9ProviderProps {\n /**\n * The app's platform services (plan/specs/01 §8). `clock`, `preferences` and `host` are required: a missing one\n * throws `G9CapabilityMissingError` naming it when the provider mounts. Pass a stable object.\n */\n readonly services: Partial<G9Capabilities>;\n /**\n * The culture: a store the app drives (`createCultureStore`), or a culture value / locale tag the provider keeps in\n * its own store (a new value switches it). Default `'en'`.\n */\n readonly culture?: G9CultureStore | G9Culture | string;\n /**\n * The theme: a store the app drives (`createThemeStore`), or options for the provider's own store (changes to\n * `mode`, `systemScheme`, `palettes`, `overrides` are applied to it). Default: system mode, stock palettes.\n */\n readonly theme?: G9ThemeStore | G9ThemeOptions;\n /** The platform's current colour scheme (MAUI `RequestedThemeChanged`); followed while the mode is `'system'`. */\n readonly systemScheme?: G9ColorScheme;\n /**\n * Save the theme mode in preferences and restore it at mount (MAUI `G9Theme.ChangeTheme` / `Init`, key\n * `g9controls.theme`, values 0 system, 1 light, 2 dark). Default `true`.\n */\n readonly persistTheme?: boolean;\n /** App-wide settings (plan/specs/03 §6). Validated at mount and on change. */\n readonly settings?: G9Settings;\n /** The diagnostics hub. Default: a hub the provider creates. */\n readonly diagnostics?: G9Diagnostics;\n readonly className?: string;\n readonly children?: ReactNode;\n}\n\nconst THEME_PREFERENCE_KEY = 'theme';\nconst THEME_MODES: readonly G9ThemeMode[] = ['system', 'light', 'dark'];\n\nlet providerSequence = 0;\n\nfunction isCultureStore(value: G9ProviderProps['culture']): value is G9CultureStore {\n return typeof value === 'object' && value !== null && typeof (value as G9CultureStore).getSnapshot === 'function';\n}\n\nfunction isThemeStore(value: G9ProviderProps['theme']): value is G9ThemeStore {\n return typeof value === 'object' && value !== null && typeof (value as G9ThemeStore).getSnapshot === 'function';\n}\n\n/** The logical window size the platform reports at startup (`SystemInfo` is in physical pixels). */\nfunction initialWindow(): G9WindowState {\n const info = (globalThis as { SystemInfo?: { pixelWidth?: number; pixelHeight?: number; pixelRatio?: number } })\n .SystemInfo;\n const ratio = info?.pixelRatio && info.pixelRatio > 0 ? info.pixelRatio : 1;\n return Object.freeze({ width: (info?.pixelWidth ?? 0) / ratio, height: (info?.pixelHeight ?? 0) / ratio });\n}\n\nconst HIDDEN_KEYBOARD: G9KeyboardState = Object.freeze({ visible: false, height: 0, compatHeight: 0 });\n\nfunction finite(value: unknown): number {\n return typeof value === 'number' && Number.isFinite(value) && value > 0 ? value : 0;\n}\n\n/**\n * The root every G9 component lives in (plan/specs/01 §5, MAUI `G9Theme`/`G9Culture`/`G9Strings` statics,\n * `G9ServiceProvider`, `G9ScreenHelper`, `G9KeyboardHelper`): culture and strings, the theme as CSS variables on one\n * root `<view>`, settings, services and capabilities, the diagnostics hub, the shared safe executor, keyboard, window\n * and safe-area state, and the dispatch of the system back event to the active `G9Host`. Mount it once per LynxView.\n *\n * - A theme change updates the root's CSS variables with `setProperty`: nothing re-renders except `useG9Theme`\n * readers. A culture change re-renders culture readers.\n * - One `keyboardstatuschanged` and one `onWindowResize` listener for the whole tree.\n * - The back event (`settings.backEventName`, default `g9:back`) goes to the active host's back stack; when nothing\n * handles it, `services.host.exit()` runs (desktop hosts send the same event for Escape).\n * - Unmounting removes every listener, subscription and timer it created.\n */\nexport function G9Provider(props: G9ProviderProps): ReactNode {\n const { services, persistTheme = true } = props;\n assertRequiredCapabilities(services);\n\n const [ownDiagnostics] = useState(createDiagnostics);\n const diagnostics = props.diagnostics ?? ownDiagnostics;\n const [iconFonts] = useState(createIconFontRegistry);\n const settings = useMemo(() => resolveSettings(props.settings, iconFonts), [props.settings, iconFonts]);\n\n // Culture: the app's store, or one the provider keeps in step with the prop.\n const cultureProp = props.culture ?? 'en';\n const [ownCulture] = useState(() => createCultureStore(isCultureStore(cultureProp) ? 'en' : cultureProp));\n const cultureStore = isCultureStore(cultureProp) ? cultureProp : ownCulture;\n useEffect(() => {\n if (!isCultureStore(cultureProp)) ownCulture.setCulture(cultureProp);\n }, [cultureProp, ownCulture]);\n const culture = useSyncExternalStore(cultureStore.subscribe, cultureStore.getSnapshot);\n const strings = useMemo(() => createStrings({ ...settings.strings, culture }), [settings.strings, culture]);\n const cultureValue = useMemo(() => ({ culture, strings, store: cultureStore }), [culture, strings, cultureStore]);\n\n // Theme: the app's store, or one the provider keeps in step with the options.\n const themeProp = props.theme;\n const [ownTheme] = useState(() => createThemeStore(isThemeStore(themeProp) ? {} : (themeProp ?? {})));\n const themeStore = isThemeStore(themeProp) ? themeProp : ownTheme;\n const options = isThemeStore(themeProp) ? undefined : themeProp;\n useEffect(() => {\n if (!options) return;\n ownTheme.beginBatch();\n try {\n if (options.mode !== undefined) ownTheme.setMode(options.mode);\n if (options.systemScheme !== undefined) ownTheme.setSystemScheme(options.systemScheme);\n ownTheme.setPalettes(options.palettes);\n ownTheme.setOverrides(options.overrides);\n } finally {\n ownTheme.endBatch();\n }\n // Field-wise on purpose: an inline `theme={{ … }}` object must not re-apply (and undo a restored mode) per render.\n }, [ownTheme, options?.mode, options?.systemScheme, options?.palettes, options?.overrides]);\n useEffect(() => {\n if (props.systemScheme !== undefined) themeStore.setSystemScheme(props.systemScheme);\n }, [themeStore, props.systemScheme]);\n\n const executorStrings = useRef(strings);\n executorStrings.current = strings;\n const [rootId] = useState(() => {\n providerSequence += 1;\n return `g9-provider-${providerSequence}`;\n });\n\n const core = useMemo<G9ProviderCore>(() => {\n const preferences = createPreferences({\n store: services.preferences,\n onStoreError: (error, failure) =>\n diagnostics.log({\n level: 'warning',\n message: `Preference ${failure.operation} failed for '${failure.key}'.`,\n source: 'G9Provider',\n error,\n }),\n });\n const executorSettings = settings.executor;\n const executor = createSafeExecutor({\n clock: services.clock,\n diagnostics,\n strings: { get: (key) => executorStrings.current.get(key) },\n // No app presenter: the default one (the error popup, registered by `@g9tm/lynxcontrols/popup`) if loaded.\n showError:\n executorSettings.showError ??\n ((request) => {\n const presenter = g9DefaultErrorPresenter.current;\n if (presenter) return presenter(request);\n diagnostics.log({\n level: 'warning',\n message: `No error presenter is configured; not shown: ${request.message}`,\n source: request.source,\n });\n return undefined;\n }),\n ...(executorSettings.diagnosticsHandler ? { diagnosticsHandler: executorSettings.diagnosticsHandler } : {}),\n ...(executorSettings.diagnosticsAvailable ? { diagnosticsAvailable: executorSettings.diagnosticsAvailable } : {}),\n ...(executorSettings.defaults ? { defaults: executorSettings.defaults } : {}),\n });\n return Object.freeze({ services, themeStore, preferences, diagnostics, executor, rootId });\n }, [services, themeStore, diagnostics, settings.executor, rootId]);\n useEffect(() => () => core.executor.dispose(), [core]);\n\n // Theme root. The Lynx engine drops custom properties in an inline style object (page config\n // `enableCSSInlineVariables` is off and not exposed), so the first frame takes the stock palette of the initial\n // scheme and the default metrics from theme.css classes; the inline copy below only serves engines that honour it.\n // At mount every variable is then written with setProperty (custom palettes, overrides, layout), and each later\n // theme change sends only what changed (no re-render).\n const [initialVariables] = useState<G9CssVariables>(() => ({\n ...toMetricCssVariables(),\n ...toLayoutCssVariables(),\n ...toCssVariables(themeStore.getSnapshot()),\n }));\n const [initialScheme] = useState(() => themeStore.getSnapshot().scheme);\n const applied = useRef<G9CssVariables>({});\n const [fallbackVariables, setFallbackVariables] = useState<G9CssVariables | null>(null);\n useEffect(() => {\n const apply = () => {\n const next = { ...initialVariables, ...applied.current, ...toCssVariables(themeStore.getSnapshot()) };\n const diff = changedVariables(applied.current, next);\n applied.current = next;\n if (!diff) return;\n // Without the element API (a host that lacks it), re-render the root's style instead: still no child render.\n if (!applyThemeVariables(rootId, diff)) setFallbackVariables(next);\n };\n apply();\n return themeStore.subscribe(apply);\n }, [themeStore, rootId, initialVariables]);\n\n // Theme persistence (MAUI ChangeTheme wrote the AppTheme number, Init read it back).\n useEffect(() => {\n if (!persistTheme) return;\n let alive = true;\n const save = () => {\n const value = THEME_MODES.indexOf(themeStore.getSnapshot().mode);\n if (core.preferences.getInt(THEME_PREFERENCE_KEY, -1) !== value) {\n void core.preferences.setInt(THEME_PREFERENCE_KEY, value);\n }\n };\n let lastMode = themeStore.getSnapshot().mode;\n const unsubscribe = themeStore.subscribe((theme) => {\n if (theme.mode === lastMode) return;\n lastMode = theme.mode;\n save();\n });\n core.preferences.hydrate().then(\n () => {\n if (!alive) return;\n const stored = THEME_MODES[core.preferences.getInt(THEME_PREFERENCE_KEY, -1)];\n if (stored) themeStore.setMode(stored);\n },\n (error: unknown) =>\n diagnostics.log({ level: 'warning', message: 'Theme restore failed.', source: 'G9Provider', error }),\n );\n return () => {\n alive = false;\n unsubscribe();\n };\n }, [persistTheme, themeStore, core, diagnostics]);\n\n // Keyboard and window: one listener each for the whole tree.\n const [keyboard, setKeyboard] = useState<G9KeyboardState>(HIDDEN_KEYBOARD);\n useEffect(\n () =>\n addGlobalListener(\n 'keyboardstatuschanged',\n (status: unknown, height: unknown, compatHeight: unknown) => {\n setKeyboard(\n status === 'on'\n ? Object.freeze({ visible: true, height: finite(height), compatHeight: finite(compatHeight) })\n : HIDDEN_KEYBOARD,\n );\n },\n // A host without keyboard detection (windowless Lynxtron): the keyboard simply stays hidden.\n (error) =>\n diagnostics.log({\n level: 'warning',\n message: 'Keyboard events are unavailable on this host.',\n source: 'G9Provider',\n error,\n }),\n ),\n [diagnostics],\n );\n const [windowState, setWindowState] = useState<G9WindowState>(initialWindow);\n useEffect(\n () =>\n addGlobalListener('onWindowResize', (width: unknown, height: unknown) => {\n setWindowState((current) => {\n const next = {\n width: typeof width === 'number' && width >= 0 ? width : current.width,\n height: typeof height === 'number' && height >= 0 ? height : current.height,\n };\n return next.width === current.width && next.height === current.height ? current : Object.freeze(next);\n });\n }),\n [],\n );\n\n // Safe-area insets from the host service.\n const [insets, setInsets] = useState<G9SafeInsets>(() => services.host.getSafeInsets());\n useEffect(() => {\n setInsets(services.host.getSafeInsets());\n return services.host.subscribeSafeInsets((next) => setInsets(next));\n }, [services.host]);\n\n // System back: the active host of this provider first, then exit.\n const onBack = useStableCallback(() => {\n const host = g9Hosts.active();\n if (host && host.services === services && host.back.dispatch() === 'handled') return;\n services.host.exit();\n });\n useEffect(() => addGlobalListener(settings.backEventName, onBack), [settings.backEventName, onBack]);\n\n // setG9MotionScale(0) (reduced motion; a screen that holds still for tests): the CSS transitions end at once too — the\n // root carries `g9-motion-off` and theme.css sets their durations to 0 (JS-timed motion already follows g9Ms).\n const [motionOff, setMotionOff] = useState(() => g9MotionScale() === 0);\n useEffect(() => subscribeG9Motion((s) => setMotionOff(s === 0)), []);\n\n const rootStyle = fallbackVariables ?? initialVariables;\n const directionClass = culture.direction === 'rtl' ? 'g9-dir-rtl' : 'g9-dir-ltr';\n return (\n <G9CoreContext.Provider value={core}>\n <G9DiagnosticsContext.Provider value={diagnostics}>\n <G9SettingsContext.Provider value={settings}>\n <G9CultureContext.Provider value={cultureValue}>\n <G9KeyboardContext.Provider value={keyboard}>\n <G9WindowContext.Provider value={windowState}>\n <G9InsetsContext.Provider value={insets}>\n <view\n id={rootId}\n className={`g9-provider g9-theme-${initialScheme} ${directionClass}${motionOff ? ' g9-motion-off' : ''}${props.className ? ` ${props.className}` : ''}`}\n style={rootStyle}\n >\n {props.children}\n </view>\n </G9InsetsContext.Provider>\n </G9WindowContext.Provider>\n </G9KeyboardContext.Provider>\n </G9CultureContext.Provider>\n </G9SettingsContext.Provider>\n </G9DiagnosticsContext.Provider>\n </G9CoreContext.Provider>\n );\n}\n"],"names":["THEME_PREFERENCE_KEY","THEME_MODES","providerSequence","isCultureStore","value","isThemeStore","initialWindow","info","globalThis","ratio","Object","HIDDEN_KEYBOARD","finite","Number","G9Provider","props","_props_diagnostics","_props_culture","services","persistTheme","assertRequiredCapabilities","ownDiagnostics","useState","createDiagnostics","diagnostics","iconFonts","createIconFontRegistry","settings","useMemo","resolveSettings","cultureProp","ownCulture","createCultureStore","cultureStore","useEffect","culture","useSyncExternalStore","strings","createStrings","cultureValue","themeProp","ownTheme","createThemeStore","themeStore","options","undefined","executorStrings","useRef","rootId","core","_executorSettings_showError","preferences","createPreferences","error","failure","executorSettings","executor","createSafeExecutor","key","request","presenter","g9DefaultErrorPresenter","initialVariables","toMetricCssVariables","toLayoutCssVariables","toCssVariables","initialScheme","applied","fallbackVariables","setFallbackVariables","apply","next","diff","changedVariables","applyThemeVariables","alive","save","lastMode","unsubscribe","theme","stored","keyboard","setKeyboard","addGlobalListener","status","height","compatHeight","windowState","setWindowState","width","current","insets","setInsets","onBack","useStableCallback","host","g9Hosts","motionOff","setMotionOff","g9MotionScale","subscribeG9Motion","s","rootStyle","directionClass","G9CoreContext","G9DiagnosticsContext","G9SettingsContext","G9CultureContext","G9KeyboardContext","G9WindowContext","G9InsetsContext","view"],"mappings":";;;;;;;;;;AA8EA,MAAMA,uBAAuB;AAC7B,MAAMC,cAAsC;IAAC;IAAU;IAAS;CAAO;AAEvE,IAAIC,mBAAmB;AAEvB,SAASC,eA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AqB,SAAS,OAAOjF,aAAa;QACjD,CAACkF,kBAAkB,SAAS,OAAO/E,UAAU;UAC3C,CAACgF,iBAAiB,SAAS,OAAOpE,cAAc;YAC9C,CAACqE,kBAAkB,SAAS,OAAO3B,UAAU;cAC3C,CAAC4B,gBAAgB,SAAS,OAAOtB,aAAa;gBAC5C,CAACuB,gBAAgB,SAAS,OAAOnB,QAAQ;kBACvC,CAACoB,KACC,IAAI/D,QACJ,WAAW,CAAC,qBAAqB,EAAEkB,cAAc,CAAC,EAAEqC,iBAAiBN,YAAY,mBAAmB,KAAKlF,MAAM,SAAS,GAAG,CAAC,CAAC,EAAEA,MAAM,SAAS,EAAE,GAAG,IAAI,EACvJ,OAAOuF,WACR;oBACC,CAACvF,MAAM,QAAQ,CAAC;kBAClB,EAAEgG,KAAK;gBACT,EAAED,gBAAgB,SAAS;cAC7B,EAAED,gBAAgB,SAAS;YAC7B,EAAED,kBAAkB,SAAS;UAC/B,EAAED,iBAAiB,SAAS;QAC9B,EAAED,kBAAkB,SAAS;MAC/B,EAAED,qBAAqB,SAAS;IAClC,EAAED,cAAc;AAEpB"}
1
+ {"version":3,"file":"provider/provider.jsx","sources":["../../src/provider/provider.tsx"],"sourcesContent":["import {\n assertRequiredCapabilities,\n createCultureStore,\n createDiagnostics,\n createIconFontRegistry,\n createPreferences,\n createSafeExecutor,\n createStrings,\n createThemeStore,\n type G9Capabilities,\n type G9ColorScheme,\n type G9CssVariables,\n type G9Culture,\n type G9CultureStore,\n type G9Diagnostics,\n type G9SafeInsets,\n type G9ThemeMode,\n type G9ThemeOptions,\n type G9ThemeStore,\n g9MotionScale,\n subscribeG9Motion,\n toCssVariables,\n toLayoutCssVariables,\n toMetricCssVariables,\n} from '@g9tm/lynxcontrols-foundation';\nimport { type ReactNode, useEffect, useMemo, useRef, useState, useSyncExternalStore } from '@lynx-js/react';\nimport { G9AnchorRegistryContext } from '../anchor/context';\nimport { createAnchorRegistry } from '../anchor/registry';\nimport { useStableCallback } from '../base/use-stable-callback';\nimport { g9Hosts } from '../host/registry';\nimport {\n G9CoreContext,\n G9CultureContext,\n G9DiagnosticsContext,\n G9InsetsContext,\n G9KeyboardContext,\n type G9KeyboardState,\n type G9ProviderCore,\n G9SettingsContext,\n G9WindowContext,\n type G9WindowState,\n} from './contexts';\nimport { addGlobalListener } from './global-events';\nimport { type G9Settings, g9DefaultErrorPresenter, resolveSettings } from './settings';\nimport { applyThemeVariables, changedVariables } from './theme-root';\nimport './provider.css';\nimport './theme.css';\n\n/** Props of {@link G9Provider}. */\nexport interface G9ProviderProps {\n /**\n * The app's platform services (plan/specs/01 §8). `clock`, `preferences` and `host` are required: a missing one\n * throws `G9CapabilityMissingError` naming it when the provider mounts. Pass a stable object.\n */\n readonly services: Partial<G9Capabilities>;\n /**\n * The culture: a store the app drives (`createCultureStore`), or a culture value / locale tag the provider keeps in\n * its own store (a new value switches it). Default `'en'`.\n */\n readonly culture?: G9CultureStore | G9Culture | string;\n /**\n * The theme: a store the app drives (`createThemeStore`), or options for the provider's own store (changes to\n * `mode`, `systemScheme`, `palettes`, `overrides` are applied to it). Default: system mode, stock palettes.\n */\n readonly theme?: G9ThemeStore | G9ThemeOptions;\n /** The platform's current colour scheme (MAUI `RequestedThemeChanged`); followed while the mode is `'system'`. */\n readonly systemScheme?: G9ColorScheme;\n /**\n * Save the theme mode in preferences and restore it at mount (MAUI `G9Theme.ChangeTheme` / `Init`, key\n * `g9controls.theme`, values 0 system, 1 light, 2 dark). Default `true`.\n */\n readonly persistTheme?: boolean;\n /** App-wide settings (plan/specs/03 §6). Validated at mount and on change. */\n readonly settings?: G9Settings;\n /** The diagnostics hub. Default: a hub the provider creates. */\n readonly diagnostics?: G9Diagnostics;\n readonly className?: string;\n readonly children?: ReactNode;\n}\n\nconst THEME_PREFERENCE_KEY = 'theme';\nconst THEME_MODES: readonly G9ThemeMode[] = ['system', 'light', 'dark'];\n\nlet providerSequence = 0;\n\nfunction isCultureStore(value: G9ProviderProps['culture']): value is G9CultureStore {\n return typeof value === 'object' && value !== null && typeof (value as G9CultureStore).getSnapshot === 'function';\n}\n\nfunction isThemeStore(value: G9ProviderProps['theme']): value is G9ThemeStore {\n return typeof value === 'object' && value !== null && typeof (value as G9ThemeStore).getSnapshot === 'function';\n}\n\n/** The logical window size the platform reports at startup (`SystemInfo` is in physical pixels). */\nfunction initialWindow(): G9WindowState {\n const info = (globalThis as { SystemInfo?: { pixelWidth?: number; pixelHeight?: number; pixelRatio?: number } })\n .SystemInfo;\n const ratio = info?.pixelRatio && info.pixelRatio > 0 ? info.pixelRatio : 1;\n return Object.freeze({ width: (info?.pixelWidth ?? 0) / ratio, height: (info?.pixelHeight ?? 0) / ratio });\n}\n\nconst HIDDEN_KEYBOARD: G9KeyboardState = Object.freeze({ visible: false, height: 0, compatHeight: 0 });\n\nfunction finite(value: unknown): number {\n return typeof value === 'number' && Number.isFinite(value) && value > 0 ? value : 0;\n}\n\n/**\n * The root every G9 component lives in (plan/specs/01 §5, MAUI `G9Theme`/`G9Culture`/`G9Strings` statics,\n * `G9ServiceProvider`, `G9ScreenHelper`, `G9KeyboardHelper`): culture and strings, the theme as CSS variables on one\n * root `<view>`, settings, services and capabilities, the diagnostics hub, the shared safe executor, keyboard, window\n * and safe-area state, and the dispatch of the system back event to the active `G9Host`. Mount it once per LynxView.\n *\n * - A theme change updates the root's CSS variables with `setProperty`: nothing re-renders except `useG9Theme`\n * readers. A culture change re-renders culture readers.\n * - One `keyboardstatuschanged` and one `onWindowResize` listener for the whole tree.\n * - The back event (`settings.backEventName`, default `g9:back`) goes to the active host's back stack; when nothing\n * handles it, `services.host.exit()` runs (desktop hosts send the same event for Escape).\n * - Unmounting removes every listener, subscription and timer it created.\n */\nexport function G9Provider(props: G9ProviderProps): ReactNode {\n const { services, persistTheme = true } = props;\n assertRequiredCapabilities(services);\n\n const [ownDiagnostics] = useState(createDiagnostics);\n const diagnostics = props.diagnostics ?? ownDiagnostics;\n const [iconFonts] = useState(createIconFontRegistry);\n const settings = useMemo(() => resolveSettings(props.settings, iconFonts), [props.settings, iconFonts]);\n\n // Culture: the app's store, or one the provider keeps in step with the prop.\n const cultureProp = props.culture ?? 'en';\n const [ownCulture] = useState(() => createCultureStore(isCultureStore(cultureProp) ? 'en' : cultureProp));\n const cultureStore = isCultureStore(cultureProp) ? cultureProp : ownCulture;\n useEffect(() => {\n if (!isCultureStore(cultureProp)) ownCulture.setCulture(cultureProp);\n }, [cultureProp, ownCulture]);\n const culture = useSyncExternalStore(cultureStore.subscribe, cultureStore.getSnapshot);\n const strings = useMemo(() => createStrings({ ...settings.strings, culture }), [settings.strings, culture]);\n const cultureValue = useMemo(() => ({ culture, strings, store: cultureStore }), [culture, strings, cultureStore]);\n\n // Theme: the app's store, or one the provider keeps in step with the options.\n const themeProp = props.theme;\n const [ownTheme] = useState(() => createThemeStore(isThemeStore(themeProp) ? {} : (themeProp ?? {})));\n const themeStore = isThemeStore(themeProp) ? themeProp : ownTheme;\n const options = isThemeStore(themeProp) ? undefined : themeProp;\n useEffect(() => {\n if (!options) return;\n ownTheme.beginBatch();\n try {\n if (options.mode !== undefined) ownTheme.setMode(options.mode);\n if (options.systemScheme !== undefined) ownTheme.setSystemScheme(options.systemScheme);\n ownTheme.setPalettes(options.palettes);\n ownTheme.setOverrides(options.overrides);\n } finally {\n ownTheme.endBatch();\n }\n // Field-wise on purpose: an inline `theme={{ … }}` object must not re-apply (and undo a restored mode) per render.\n }, [ownTheme, options?.mode, options?.systemScheme, options?.palettes, options?.overrides]);\n useEffect(() => {\n if (props.systemScheme !== undefined) themeStore.setSystemScheme(props.systemScheme);\n }, [themeStore, props.systemScheme]);\n\n const executorStrings = useRef(strings);\n executorStrings.current = strings;\n const [rootId] = useState(() => {\n providerSequence += 1;\n return `g9-provider-${providerSequence}`;\n });\n\n // One anchor registry for the provider's life: anchors and scrollers outlive a services change.\n const [anchors] = useState(createAnchorRegistry);\n\n const core = useMemo<G9ProviderCore>(() => {\n const preferences = createPreferences({\n store: services.preferences,\n onStoreError: (error, failure) =>\n diagnostics.log({\n level: 'warning',\n message: `Preference ${failure.operation} failed for '${failure.key}'.`,\n source: 'G9Provider',\n error,\n }),\n });\n const executorSettings = settings.executor;\n const executor = createSafeExecutor({\n clock: services.clock,\n diagnostics,\n strings: { get: (key) => executorStrings.current.get(key) },\n // No app presenter: the default one (the error popup, registered by `@g9tm/lynxcontrols/popup`) if loaded.\n showError:\n executorSettings.showError ??\n ((request) => {\n const presenter = g9DefaultErrorPresenter.current;\n if (presenter) return presenter(request);\n diagnostics.log({\n level: 'warning',\n message: `No error presenter is configured; not shown: ${request.message}`,\n source: request.source,\n });\n return undefined;\n }),\n ...(executorSettings.diagnosticsHandler ? { diagnosticsHandler: executorSettings.diagnosticsHandler } : {}),\n ...(executorSettings.diagnosticsAvailable ? { diagnosticsAvailable: executorSettings.diagnosticsAvailable } : {}),\n ...(executorSettings.defaults ? { defaults: executorSettings.defaults } : {}),\n });\n return Object.freeze({ services, themeStore, preferences, diagnostics, executor, rootId, anchors });\n }, [services, themeStore, diagnostics, settings.executor, rootId, anchors]);\n useEffect(() => () => core.executor.dispose(), [core]);\n\n // Theme root. The Lynx engine drops custom properties in an inline style object (page config\n // `enableCSSInlineVariables` is off and not exposed), so the first frame takes the stock palette of the initial\n // scheme and the default metrics from theme.css classes; the inline copy below only serves engines that honour it.\n // At mount every variable is then written with setProperty (custom palettes, overrides, layout), and each later\n // theme change sends only what changed (no re-render).\n const [initialVariables] = useState<G9CssVariables>(() => ({\n ...toMetricCssVariables(),\n ...toLayoutCssVariables(),\n ...toCssVariables(themeStore.getSnapshot()),\n }));\n const [initialScheme] = useState(() => themeStore.getSnapshot().scheme);\n const applied = useRef<G9CssVariables>({});\n const [fallbackVariables, setFallbackVariables] = useState<G9CssVariables | null>(null);\n useEffect(() => {\n const apply = () => {\n const next = { ...initialVariables, ...applied.current, ...toCssVariables(themeStore.getSnapshot()) };\n const diff = changedVariables(applied.current, next);\n applied.current = next;\n if (!diff) return;\n // Without the element API (a host that lacks it), re-render the root's style instead: still no child render.\n if (!applyThemeVariables(rootId, diff)) setFallbackVariables(next);\n };\n apply();\n return themeStore.subscribe(apply);\n }, [themeStore, rootId, initialVariables]);\n\n // Theme persistence (MAUI ChangeTheme wrote the AppTheme number, Init read it back).\n useEffect(() => {\n if (!persistTheme) return;\n let alive = true;\n const save = () => {\n const value = THEME_MODES.indexOf(themeStore.getSnapshot().mode);\n if (core.preferences.getInt(THEME_PREFERENCE_KEY, -1) !== value) {\n void core.preferences.setInt(THEME_PREFERENCE_KEY, value);\n }\n };\n let lastMode = themeStore.getSnapshot().mode;\n const unsubscribe = themeStore.subscribe((theme) => {\n if (theme.mode === lastMode) return;\n lastMode = theme.mode;\n save();\n });\n core.preferences.hydrate().then(\n () => {\n if (!alive) return;\n const stored = THEME_MODES[core.preferences.getInt(THEME_PREFERENCE_KEY, -1)];\n if (stored) themeStore.setMode(stored);\n },\n (error: unknown) =>\n diagnostics.log({ level: 'warning', message: 'Theme restore failed.', source: 'G9Provider', error }),\n );\n return () => {\n alive = false;\n unsubscribe();\n };\n }, [persistTheme, themeStore, core, diagnostics]);\n\n // Keyboard and window: one listener each for the whole tree.\n const [keyboard, setKeyboard] = useState<G9KeyboardState>(HIDDEN_KEYBOARD);\n useEffect(\n () =>\n addGlobalListener(\n 'keyboardstatuschanged',\n (status: unknown, height: unknown, compatHeight: unknown) => {\n setKeyboard(\n status === 'on'\n ? Object.freeze({ visible: true, height: finite(height), compatHeight: finite(compatHeight) })\n : HIDDEN_KEYBOARD,\n );\n },\n // A host without keyboard detection (windowless Lynxtron): the keyboard simply stays hidden.\n (error) =>\n diagnostics.log({\n level: 'warning',\n message: 'Keyboard events are unavailable on this host.',\n source: 'G9Provider',\n error,\n }),\n ),\n [diagnostics],\n );\n const [windowState, setWindowState] = useState<G9WindowState>(initialWindow);\n useEffect(\n () =>\n addGlobalListener('onWindowResize', (width: unknown, height: unknown) => {\n setWindowState((current) => {\n const next = {\n width: typeof width === 'number' && width >= 0 ? width : current.width,\n height: typeof height === 'number' && height >= 0 ? height : current.height,\n };\n return next.width === current.width && next.height === current.height ? current : Object.freeze(next);\n });\n }),\n [],\n );\n\n // Safe-area insets from the host service.\n const [insets, setInsets] = useState<G9SafeInsets>(() => services.host.getSafeInsets());\n useEffect(() => {\n setInsets(services.host.getSafeInsets());\n return services.host.subscribeSafeInsets((next) => setInsets(next));\n }, [services.host]);\n\n // System back: the active host of this provider first, then exit.\n const onBack = useStableCallback(() => {\n const host = g9Hosts.active();\n if (host && host.services === services && host.back.dispatch() === 'handled') return;\n services.host.exit();\n });\n useEffect(() => addGlobalListener(settings.backEventName, onBack), [settings.backEventName, onBack]);\n\n // setG9MotionScale(0) (reduced motion; a screen that holds still for tests): the CSS transitions end at once too — the\n // root carries `g9-motion-off` and theme.css sets their durations to 0 (JS-timed motion already follows g9Ms).\n const [motionOff, setMotionOff] = useState(() => g9MotionScale() === 0);\n useEffect(() => subscribeG9Motion((s) => setMotionOff(s === 0)), []);\n\n const rootStyle = fallbackVariables ?? initialVariables;\n const directionClass = culture.direction === 'rtl' ? 'g9-dir-rtl' : 'g9-dir-ltr';\n return (\n <G9CoreContext.Provider value={core}>\n <G9AnchorRegistryContext.Provider value={anchors}>\n <G9DiagnosticsContext.Provider value={diagnostics}>\n <G9SettingsContext.Provider value={settings}>\n <G9CultureContext.Provider value={cultureValue}>\n <G9KeyboardContext.Provider value={keyboard}>\n <G9WindowContext.Provider value={windowState}>\n <G9InsetsContext.Provider value={insets}>\n <view\n id={rootId}\n className={`g9-provider g9-theme-${initialScheme} ${directionClass}${motionOff ? ' g9-motion-off' : ''}${props.className ? ` ${props.className}` : ''}`}\n style={rootStyle}\n >\n {props.children}\n </view>\n </G9InsetsContext.Provider>\n </G9WindowContext.Provider>\n </G9KeyboardContext.Provider>\n </G9CultureContext.Provider>\n </G9SettingsContext.Provider>\n </G9DiagnosticsContext.Provider>\n </G9AnchorRegistryContext.Provider>\n </G9CoreContext.Provider>\n );\n}\n"],"names":["THEME_PREFERENCE_KEY","THEME_MODES","providerSequence","isCultureStore","value","isThemeStore","initialWindow","info","globalThis","ratio","Object","HIDDEN_KEYBOARD","finite","Number","G9Provider","props","_props_diagnostics","_props_culture","services","persistTheme","assertRequiredCapabilities","ownDiagnostics","useState","createDiagnostics","diagnostics","iconFonts","createIconFontRegistry","settings","useMemo","resolveSettings","cultureProp","ownCulture","createCultureStore","cultureStore","useEffect","culture","useSyncExternalStore","strings","createStrings","cultureValue","themeProp","ownTheme","createThemeStore","themeStore","options","undefined","executorStrings","useRef","rootId","anchors","createAnchorRegistry","core","_executorSettings_showError","preferences","createPreferences","error","failure","executorSettings","executor","createSafeExecutor","key","request","presenter","g9DefaultErrorPresenter","initialVariables","toMetricCssVariables","toLayoutCssVariables","toCssVariables","initialScheme","applied","fallbackVariables","setFallbackVariables","apply","next","diff","changedVariables","applyThemeVariables","alive","save","lastMode","unsubscribe","theme","stored","keyboard","setKeyboard","addGlobalListener","status","height","compatHeight","windowState","setWindowState","width","current","insets","setInsets","onBack","useStableCallback","host","g9Hosts","motionOff","setMotionOff","g9MotionScale","subscribeG9Motion","s","rootStyle","directionClass","G9CoreContext","G9AnchorRegistryContext","G9DiagnosticsContext","G9SettingsContext","G9CultureContext","G9KeyboardContext","G9WindowContext","G9InsetsContext","view"],"mappings":";;;;;;;;;;;;AAgFA,MAAMA,uBAAuB;AAC7B,MAAMC,cAAsC;IAAC;IAAU;IAAS;CAAO;AAEvE,IAAIC,mBAAmB;AAEvB,SAASC,eAAeC,KAAiC;IACvD,OAAO,AAAiB,YAAjB,OAAOA,SAAsBA,AAAU,SAAVA,SAAkB,AAAiD,cAAjD,OAAQA,MAAyB,WAAW;AACpG;AAEA,SAASC,aAAaD,KAA+B;IACnD,OAAO,AAAiB,YAAjB,OAAOA,SAAsBA,AAAU,SAAVA,SAAkB,AAA+C,cAA/C,OAAQA,MAAuB,WAAW;AAClG;AAGA,SAASE;;IACP,MAAMC,OAAQC,WACX,UAAU;IACb,MAAMC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vB,aAAa;kBAC5C,CAACwB,gBAAgB,SAAS,OAAOpB,QAAQ;oBACvC,CAACqB,KACC,IAAIlE,QACJ,WAAW,CAAC,qBAAqB,EAAEoB,cAAc,CAAC,EAAEqC,iBAAiBN,YAAY,mBAAmB,KAAKpF,MAAM,SAAS,GAAG,CAAC,CAAC,EAAEA,MAAM,SAAS,EAAE,GAAG,IAAI,EACvJ,OAAOyF,WACR;sBACC,CAACzF,MAAM,QAAQ,CAAC;oBAClB,EAAEmG,KAAK;kBACT,EAAED,gBAAgB,SAAS;gBAC7B,EAAED,gBAAgB,SAAS;cAC7B,EAAED,kBAAkB,SAAS;YAC/B,EAAED,iBAAiB,SAAS;UAC9B,EAAED,kBAAkB,SAAS;QAC/B,EAAED,qBAAqB,SAAS;MAClC,EAAED,wBAAwB,SAAS;IACrC,EAAED,cAAc;AAEpB"}
@@ -1,5 +1,6 @@
1
1
  import { type G9DiagnosticsReport, type G9ErrorPopupRequest, type G9GlyphSlotOverrides, type G9GlyphSlots, type G9IconFontRegistry, type G9ImageSource, type G9SafeExecutorOptions, type G9StringsOptions } from '@g9tm/lynxcontrols-foundation';
2
2
  import type { ReactNode } from '@lynx-js/react';
3
+ import type { G9GuideSettings } from '../guide/settings.js';
3
4
  import { type G9PopupSettings } from '../popup/types.js';
4
5
  import { type G9SheetSettings } from '../sheet/options.js';
5
6
  /** The global event the native host sends for a system back press (Android back, desktop Escape). */
@@ -66,6 +67,8 @@ export interface G9Settings {
66
67
  readonly popups?: G9PopupSettings;
67
68
  /** Toggle defaults (MAUI 1.4.10 `G9Switch.MirrorInRtl`, a static set once at startup). */
68
69
  readonly toggles?: G9ToggleSettings;
70
+ /** The guide's words and timings (`@g9tm/lynxcontrols/guide`): the app gives them in the person's language. */
71
+ readonly guide?: G9GuideSettings;
69
72
  }
70
73
  /** App-wide toggle settings. */
71
74
  export interface G9ToggleSettings {
@@ -98,6 +101,7 @@ export interface G9ResolvedSettings {
98
101
  readonly sheets: Required<G9SheetSettings>;
99
102
  readonly popups: G9PopupSettings;
100
103
  readonly toggles: Required<G9ToggleSettings>;
104
+ readonly guide: G9GuideSettings;
101
105
  }
102
106
  /** MAUI `G9PageBase.PageLoadingDismissDelayMs` default. */
103
107
  export declare const g9PageLoadingDismissDelayMs = 369;
@@ -1 +1 @@
1
- {"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../src/provider/settings.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,mBAAmB,EAExB,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,YAAY,EACjB,KAAK,kBAAkB,EACvB,KAAK,aAAa,EAClB,KAAK,qBAAqB,EAC1B,KAAK,gBAAgB,EAEtB,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAA8B,KAAK,eAAe,EAAsB,MAAM,gBAAgB,CAAC;AACtG,OAAO,EAAE,KAAK,eAAe,EAAwB,MAAM,kBAAkB,CAAC;AAE9E,qGAAqG;AACrG,eAAO,MAAM,sBAAsB,YAAY,CAAC;AAEhD,iHAAiH;AACjH,MAAM,WAAW,qBAAqB;IACpC,2GAA2G;IAC3G,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;IAClC,sFAAsF;IACtF,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B,yGAAyG;IACzG,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IACjC,8FAA8F;IAC9F,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;CACnC;AAED;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,MAAM,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,KAAK,SAAS,CAAC;AAEjF;;;GAGG;AACH,eAAO,MAAM,uBAAuB,EAAE;IACpC,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,mBAAmB,KAAK,IAAI,GAAG,WAAW,CAAC,IAA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AGG;AACH,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,UAAU,GAAG,SAAS,EAChC,iBAAiB,CAAC,EAAE,kBAAkB,GACrC,kBAAkB,CA+BpB"}
@@ -13,7 +13,7 @@ function nonNegative(name, value, fallback) {
13
13
  return value;
14
14
  }
15
15
  function resolveSettings(settings, fallbackIconFonts) {
16
- var _s_backEventName, _s_pageLoading, _s_strings, _ref, _s_iconFonts, _loading_backgroundColor, _loading_spinnerColor, _s_executor, _ref1, _ref2;
16
+ var _s_backEventName, _s_pageLoading, _s_strings, _ref, _s_iconFonts, _loading_backgroundColor, _loading_spinnerColor, _s_executor, _ref1, _ref2, _s_guide;
17
17
  var _s_fields, _s_toggles;
18
18
  const s = null != settings ? settings : {};
19
19
  const backEventName = null != (_s_backEventName = s.backEventName) ? _s_backEventName : g9DefaultBackEventName;
@@ -40,7 +40,8 @@ function resolveSettings(settings, fallbackIconFonts) {
40
40
  popups: Object.freeze(mergePopupSettings(s.popups, createDefaultPopupSettings())),
41
41
  toggles: Object.freeze({
42
42
  switchMirrorInRtl: null != (_ref2 = null == (_s_toggles = s.toggles) ? void 0 : _s_toggles.switchMirrorInRtl) ? _ref2 : true
43
- })
43
+ }),
44
+ guide: null != (_s_guide = s.guide) ? _s_guide : {}
44
45
  });
45
46
  }
46
47
  export { g9DefaultBackEventName, g9DefaultErrorPresenter, g9PageLoadingDismissDelayMs, g9PageLoadingSafetyTimeoutMs, resolveSettings };
@@ -1 +1 @@
1
- {"version":3,"file":"provider/settings.jsx","sources":["../../src/provider/settings.ts"],"sourcesContent":["import {\n createIconFontRegistry,\n type G9DiagnosticsReport,\n G9Error,\n type G9ErrorPopupRequest,\n type G9GlyphSlotOverrides,\n type G9GlyphSlots,\n type G9IconFontRegistry,\n type G9ImageSource,\n type G9SafeExecutorOptions,\n type G9StringsOptions,\n resolveGlyphSlots,\n} from '@g9tm/lynxcontrols-foundation';\nimport type { ReactNode } from '@lynx-js/react';\nimport { createDefaultPopupSettings, type G9PopupSettings, mergePopupSettings } from '../popup/types';\nimport { type G9SheetSettings, resolveSheetSettings } from '../sheet/options';\n\n/** The global event the native host sends for a system back press (Android back, desktop Escape). */\nexport const g9DefaultBackEventName = 'g9:back';\n\n/** App-wide page-loading cover settings (MAUI `G9PageLoadingOverlay` statics + `G9PageBase` timing defaults). */\nexport interface G9PageLoadingSettings {\n /** Cover colour (MAUI `BackgroundColorOverride`). Default: the theme's `Primary` (`var(--g9-primary)`). */\n readonly backgroundColor?: string;\n /** Spinner colour (MAUI `SpinnerColorOverride`). Default: the theme's `OnPrimary`. */\n readonly spinnerColor?: string;\n /** Delay after \"ready\" before the cover animates out (MAUI `PageLoadingDismissDelayMs`). Default 369. */\n readonly dismissDelayMs?: number;\n /** Hard cap from appearing to dismissal (MAUI `PageLoadingSafetyTimeoutMs`). Default 5000. */\n readonly safetyTimeoutMs?: number;\n}\n\n/**\n * Renders a bitmap icon at a box size (MAUI `G9ImageFactory.Factory`): the seam for a caching image element. The default\n * is a plain Lynx `<image>` (`aspectFill`), or `<svg content>` for an `{ svg }` source.\n */\nexport type G9ImageRenderer = (source: G9ImageSource, size: number) => ReactNode;\n\n/**\n * The error presenter used when the app sets no `executor.showError`: `@g9tm/lynxcontrols/popup` installs the error\n * popup here when it loads (so the provider does not depend on the popup module).\n */\nexport const g9DefaultErrorPresenter: {\n current: ((request: G9ErrorPopupRequest) => void | PromiseLike<void>) | null;\n} = { current: null };\n\n/** Settings of the shared safe executor (MAUI `G9SafeCommand` statics). */\nexport interface G9ExecutorSettings {\n readonly showError?: (request: G9ErrorPopupRequest) => void | PromiseLike<void>;\n readonly diagnosticsHandler?: (report: G9DiagnosticsReport) => void | PromiseLike<void>;\n readonly diagnosticsAvailable?: () => boolean;\n readonly defaults?: G9SafeExecutorOptions;\n}\n\n/**\n * App-wide configuration (plan/specs/03 §6): what MAUI configured through static helpers. Later work packages add\n * their families here (`sheets`, `popups`, `toasts`, `fields`).\n */\nexport interface G9Settings {\n /** String resolution (MAUI `G9Strings.UseProvider` / `Override`): everything but the culture. */\n readonly strings?: Omit<G9StringsOptions, 'culture'>;\n /** Replacements for the controls' own icons (MAUI `G9Glyphs.*` setters). */\n readonly glyphs?: G9GlyphSlotOverrides;\n /** The app's icon fonts (MAUI `G9IconFonts.Register`); default an empty registry. */\n readonly iconFonts?: G9IconFontRegistry;\n /** Bitmap icon renderer (MAUI `G9ImageFactory.Factory`). Default: {@link G9ImageRenderer}'s plain `<image>`. */\n readonly imageRenderer?: G9ImageRenderer;\n /** Name of the global back event (default {@link g9DefaultBackEventName}). */\n readonly backEventName?: string;\n /** Page-loading cover defaults for every `G9Host`. */\n readonly pageLoading?: G9PageLoadingSettings;\n /** The shared safe executor's popup, diagnostics surface and option defaults. */\n readonly executor?: G9ExecutorSettings;\n /**\n * Pauses the app's background work while a view that asks for it is active (MAUI\n * `G9ContentViewBase.BackgroundWorkSuppressionFactory`). Returns the release function, or nothing.\n */\n readonly backgroundWorkSuppression?: () => (() => void) | null | undefined;\n /** Outlined-field defaults (MAUI `G9OutlinedFieldSettings`, set through `G9OutlinedFieldBase.Configure`). */\n readonly fields?: G9FieldSettings;\n /** Bottom-sheet defaults (MAUI `G9BottomSheetHelper.Configure(G9BottomSheetSettings)`). */\n readonly sheets?: G9SheetSettings;\n /** Popup defaults (MAUI `G9PopupHelper.ConfigureG9PopupDefaults`), merged under per-call settings. */\n readonly popups?: G9PopupSettings;\n /** Toggle defaults (MAUI 1.4.10 `G9Switch.MirrorInRtl`, a static set once at startup). */\n readonly toggles?: G9ToggleSettings;\n}\n\n/** App-wide toggle settings. */\nexport interface G9ToggleSettings {\n /**\n * Whether a right-to-left language mirrors a switch's toggle (on = the thumb on the LEFT). Default `true` (MAUI\n * `G9Switch.MirrorInRtl`). `false` keeps every switch physical in every language — off = left, on = right — as\n * AgriPad's Figma draws all 31 of its toggles; the row (title, switch) still flows with the language.\n */\n readonly switchMirrorInRtl?: boolean;\n}\n\n/** App-wide outlined-field settings (MAUI `G9OutlinedFieldSettings`). */\nexport interface G9FieldSettings {\n /**\n * Whether a field holding a value (unfocused, no error) draws its outline and floated label in the primary colour.\n * Default `true` (MAUI `HighlightFilledValue`); a field's own `filledValueHighlight` overrides it (ADR-0025).\n */\n readonly highlightFilledValue?: boolean;\n}\n\n/** {@link G9Settings} with every default filled in. */\nexport interface G9ResolvedSettings {\n readonly strings: Omit<G9StringsOptions, 'culture'>;\n readonly glyphs: G9GlyphSlots;\n readonly iconFonts: G9IconFontRegistry;\n readonly imageRenderer: G9ImageRenderer | undefined;\n readonly backEventName: string;\n readonly pageLoading: Required<G9PageLoadingSettings>;\n readonly executor: G9ExecutorSettings;\n readonly backgroundWorkSuppression: G9Settings['backgroundWorkSuppression'];\n readonly fields: Required<G9FieldSettings>;\n readonly sheets: Required<G9SheetSettings>;\n readonly popups: G9PopupSettings;\n readonly toggles: Required<G9ToggleSettings>;\n}\n\n/** MAUI `G9PageBase.PageLoadingDismissDelayMs` default. */\nexport const g9PageLoadingDismissDelayMs = 369;\n/** MAUI `G9PageBase.PageLoadingSafetyTimeoutMs` default. */\nexport const g9PageLoadingSafetyTimeoutMs = 5000;\n\nfunction nonNegative(name: string, value: number | undefined, fallback: number): number {\n if (value === undefined) return fallback;\n if (typeof value !== 'number' || !Number.isFinite(value) || value < 0) {\n throw new G9Error(\n 'settings-invalid',\n `${name} must be a finite number of milliseconds ≥ 0 (got ${String(value)}).`,\n );\n }\n return value;\n}\n\n/**\n * Validates `settings` and fills the defaults. Invalid values throw a `G9Error` (`settings-invalid`, or the\n * foundation code for a malformed glyph slot) at provider mount rather than at first use.\n */\nexport function resolveSettings(\n settings: G9Settings | undefined,\n fallbackIconFonts?: G9IconFontRegistry,\n): G9ResolvedSettings {\n const s = settings ?? {};\n const backEventName = s.backEventName ?? g9DefaultBackEventName;\n if (typeof backEventName !== 'string' || backEventName.trim() === '') {\n throw new G9Error('settings-invalid', 'backEventName must be a non-blank string.');\n }\n const loading = s.pageLoading ?? {};\n return Object.freeze({\n strings: s.strings ?? {},\n glyphs: resolveGlyphSlots(s.glyphs),\n iconFonts: s.iconFonts ?? fallbackIconFonts ?? createIconFontRegistry(),\n imageRenderer: s.imageRenderer,\n backEventName,\n pageLoading: Object.freeze({\n backgroundColor: loading.backgroundColor ?? 'var(--g9-primary)',\n spinnerColor: loading.spinnerColor ?? 'var(--g9-on-primary)',\n dismissDelayMs: nonNegative('pageLoading.dismissDelayMs', loading.dismissDelayMs, g9PageLoadingDismissDelayMs),\n safetyTimeoutMs: nonNegative(\n 'pageLoading.safetyTimeoutMs',\n loading.safetyTimeoutMs,\n g9PageLoadingSafetyTimeoutMs,\n ),\n }),\n executor: s.executor ?? {},\n backgroundWorkSuppression: s.backgroundWorkSuppression,\n fields: Object.freeze({ highlightFilledValue: s.fields?.highlightFilledValue ?? true }),\n sheets: resolveSheetSettings(s.sheets),\n popups: Object.freeze(mergePopupSettings(s.popups, createDefaultPopupSettings())),\n toggles: Object.freeze({ switchMirrorInRtl: s.toggles?.switchMirrorInRtl ?? true }),\n });\n}\n"],"names":["g9DefaultBackEventName","g9DefaultErrorPresenter","g9PageLoadingDismissDelayMs","g9PageLoadingSafetyTimeoutMs","nonNegative","name","value","fallback","undefined","Number","G9Error","String","resolveSettings","settings","fallbackIconFonts","_s_backEventName","_s_pageLoading","_s_strings","_ref","_loading_backgroundColor","_loading_spinnerColor","_s_executor","_s_fields","_s_toggles","s","backEventName","loading","Object","resolveGlyphSlots","createIconFontRegistry","resolveSheetSettings","mergePopupSettings","createDefaultPopupSettings"],"mappings":";;;AAkBO,MAAMA,yBAAyB;AAwB/B,MAAMC,0BAET;IAAE,SAAS;AAAK;AAgFb,MAAMC,8BAA8B;AAEpC,MAAMC,+BAA+B;AAE5C,SAASC,YAAYC,IAAY,EAAEC,KAAyB,EAAEC,QAAgB;IAC5E,IAAID,AAAUE,WAAVF,OAAqB,OAAOC;IAChC,IAAI,AAAiB,YAAjB,OAAOD,SAAsB,CAACG,OAAO,QAAQ,CAACH,UAAUA,QA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;QACtD,QAAQG,OAAO,MAAM,CAAC;YAAE,sBAAsB,QAAF,iBAAEL,CAAAA,YAAAA,EAAE,MAAM,AAAD,IAAPA,KAAAA,IAAAA,UAAU,oBAAoB,AAAD,IAAC,QAAI;QAAK;QACrF,QAAQQ,qBAAqBN,EAAE,MAAM;QACrC,QAAQG,OAAO,MAAM,CAACI,mBAAmBP,EAAE,MAAM,EAAEQ;QACnD,SAASL,OAAO,MAAM,CAAC;YAAE,mBAAmB,QAAF,iBAAEJ,CAAAA,aAAAA,EAAE,OAAO,AAAD,IAARA,KAAAA,IAAAA,WAAW,iBAAiB,AAAD,IAAC,QAAI;QAAK;IACnF;AACF"}
1
+ {"version":3,"file":"provider/settings.jsx","sources":["../../src/provider/settings.ts"],"sourcesContent":["import {\n createIconFontRegistry,\n type G9DiagnosticsReport,\n G9Error,\n type G9ErrorPopupRequest,\n type G9GlyphSlotOverrides,\n type G9GlyphSlots,\n type G9IconFontRegistry,\n type G9ImageSource,\n type G9SafeExecutorOptions,\n type G9StringsOptions,\n resolveGlyphSlots,\n} from '@g9tm/lynxcontrols-foundation';\nimport type { ReactNode } from '@lynx-js/react';\nimport type { G9GuideSettings } from '../guide/settings';\nimport { createDefaultPopupSettings, type G9PopupSettings, mergePopupSettings } from '../popup/types';\nimport { type G9SheetSettings, resolveSheetSettings } from '../sheet/options';\n\n/** The global event the native host sends for a system back press (Android back, desktop Escape). */\nexport const g9DefaultBackEventName = 'g9:back';\n\n/** App-wide page-loading cover settings (MAUI `G9PageLoadingOverlay` statics + `G9PageBase` timing defaults). */\nexport interface G9PageLoadingSettings {\n /** Cover colour (MAUI `BackgroundColorOverride`). Default: the theme's `Primary` (`var(--g9-primary)`). */\n readonly backgroundColor?: string;\n /** Spinner colour (MAUI `SpinnerColorOverride`). Default: the theme's `OnPrimary`. */\n readonly spinnerColor?: string;\n /** Delay after \"ready\" before the cover animates out (MAUI `PageLoadingDismissDelayMs`). Default 369. */\n readonly dismissDelayMs?: number;\n /** Hard cap from appearing to dismissal (MAUI `PageLoadingSafetyTimeoutMs`). Default 5000. */\n readonly safetyTimeoutMs?: number;\n}\n\n/**\n * Renders a bitmap icon at a box size (MAUI `G9ImageFactory.Factory`): the seam for a caching image element. The default\n * is a plain Lynx `<image>` (`aspectFill`), or `<svg content>` for an `{ svg }` source.\n */\nexport type G9ImageRenderer = (source: G9ImageSource, size: number) => ReactNode;\n\n/**\n * The error presenter used when the app sets no `executor.showError`: `@g9tm/lynxcontrols/popup` installs the error\n * popup here when it loads (so the provider does not depend on the popup module).\n */\nexport const g9DefaultErrorPresenter: {\n current: ((request: G9ErrorPopupRequest) => void | PromiseLike<void>) | null;\n} = { current: null };\n\n/** Settings of the shared safe executor (MAUI `G9SafeCommand` statics). */\nexport interface G9ExecutorSettings {\n readonly showError?: (request: G9ErrorPopupRequest) => void | PromiseLike<void>;\n readonly diagnosticsHandler?: (report: G9DiagnosticsReport) => void | PromiseLike<void>;\n readonly diagnosticsAvailable?: () => boolean;\n readonly defaults?: G9SafeExecutorOptions;\n}\n\n/**\n * App-wide configuration (plan/specs/03 §6): what MAUI configured through static helpers. Later work packages add\n * their families here (`sheets`, `popups`, `toasts`, `fields`).\n */\nexport interface G9Settings {\n /** String resolution (MAUI `G9Strings.UseProvider` / `Override`): everything but the culture. */\n readonly strings?: Omit<G9StringsOptions, 'culture'>;\n /** Replacements for the controls' own icons (MAUI `G9Glyphs.*` setters). */\n readonly glyphs?: G9GlyphSlotOverrides;\n /** The app's icon fonts (MAUI `G9IconFonts.Register`); default an empty registry. */\n readonly iconFonts?: G9IconFontRegistry;\n /** Bitmap icon renderer (MAUI `G9ImageFactory.Factory`). Default: {@link G9ImageRenderer}'s plain `<image>`. */\n readonly imageRenderer?: G9ImageRenderer;\n /** Name of the global back event (default {@link g9DefaultBackEventName}). */\n readonly backEventName?: string;\n /** Page-loading cover defaults for every `G9Host`. */\n readonly pageLoading?: G9PageLoadingSettings;\n /** The shared safe executor's popup, diagnostics surface and option defaults. */\n readonly executor?: G9ExecutorSettings;\n /**\n * Pauses the app's background work while a view that asks for it is active (MAUI\n * `G9ContentViewBase.BackgroundWorkSuppressionFactory`). Returns the release function, or nothing.\n */\n readonly backgroundWorkSuppression?: () => (() => void) | null | undefined;\n /** Outlined-field defaults (MAUI `G9OutlinedFieldSettings`, set through `G9OutlinedFieldBase.Configure`). */\n readonly fields?: G9FieldSettings;\n /** Bottom-sheet defaults (MAUI `G9BottomSheetHelper.Configure(G9BottomSheetSettings)`). */\n readonly sheets?: G9SheetSettings;\n /** Popup defaults (MAUI `G9PopupHelper.ConfigureG9PopupDefaults`), merged under per-call settings. */\n readonly popups?: G9PopupSettings;\n /** Toggle defaults (MAUI 1.4.10 `G9Switch.MirrorInRtl`, a static set once at startup). */\n readonly toggles?: G9ToggleSettings;\n /** The guide's words and timings (`@g9tm/lynxcontrols/guide`): the app gives them in the person's language. */\n readonly guide?: G9GuideSettings;\n}\n\n/** App-wide toggle settings. */\nexport interface G9ToggleSettings {\n /**\n * Whether a right-to-left language mirrors a switch's toggle (on = the thumb on the LEFT). Default `true` (MAUI\n * `G9Switch.MirrorInRtl`). `false` keeps every switch physical in every language — off = left, on = right — as\n * AgriPad's Figma draws all 31 of its toggles; the row (title, switch) still flows with the language.\n */\n readonly switchMirrorInRtl?: boolean;\n}\n\n/** App-wide outlined-field settings (MAUI `G9OutlinedFieldSettings`). */\nexport interface G9FieldSettings {\n /**\n * Whether a field holding a value (unfocused, no error) draws its outline and floated label in the primary colour.\n * Default `true` (MAUI `HighlightFilledValue`); a field's own `filledValueHighlight` overrides it (ADR-0025).\n */\n readonly highlightFilledValue?: boolean;\n}\n\n/** {@link G9Settings} with every default filled in. */\nexport interface G9ResolvedSettings {\n readonly strings: Omit<G9StringsOptions, 'culture'>;\n readonly glyphs: G9GlyphSlots;\n readonly iconFonts: G9IconFontRegistry;\n readonly imageRenderer: G9ImageRenderer | undefined;\n readonly backEventName: string;\n readonly pageLoading: Required<G9PageLoadingSettings>;\n readonly executor: G9ExecutorSettings;\n readonly backgroundWorkSuppression: G9Settings['backgroundWorkSuppression'];\n readonly fields: Required<G9FieldSettings>;\n readonly sheets: Required<G9SheetSettings>;\n readonly popups: G9PopupSettings;\n readonly toggles: Required<G9ToggleSettings>;\n readonly guide: G9GuideSettings;\n}\n\n/** MAUI `G9PageBase.PageLoadingDismissDelayMs` default. */\nexport const g9PageLoadingDismissDelayMs = 369;\n/** MAUI `G9PageBase.PageLoadingSafetyTimeoutMs` default. */\nexport const g9PageLoadingSafetyTimeoutMs = 5000;\n\nfunction nonNegative(name: string, value: number | undefined, fallback: number): number {\n if (value === undefined) return fallback;\n if (typeof value !== 'number' || !Number.isFinite(value) || value < 0) {\n throw new G9Error(\n 'settings-invalid',\n `${name} must be a finite number of milliseconds ≥ 0 (got ${String(value)}).`,\n );\n }\n return value;\n}\n\n/**\n * Validates `settings` and fills the defaults. Invalid values throw a `G9Error` (`settings-invalid`, or the\n * foundation code for a malformed glyph slot) at provider mount rather than at first use.\n */\nexport function resolveSettings(\n settings: G9Settings | undefined,\n fallbackIconFonts?: G9IconFontRegistry,\n): G9ResolvedSettings {\n const s = settings ?? {};\n const backEventName = s.backEventName ?? g9DefaultBackEventName;\n if (typeof backEventName !== 'string' || backEventName.trim() === '') {\n throw new G9Error('settings-invalid', 'backEventName must be a non-blank string.');\n }\n const loading = s.pageLoading ?? {};\n return Object.freeze({\n strings: s.strings ?? {},\n glyphs: resolveGlyphSlots(s.glyphs),\n iconFonts: s.iconFonts ?? fallbackIconFonts ?? createIconFontRegistry(),\n imageRenderer: s.imageRenderer,\n backEventName,\n pageLoading: Object.freeze({\n backgroundColor: loading.backgroundColor ?? 'var(--g9-primary)',\n spinnerColor: loading.spinnerColor ?? 'var(--g9-on-primary)',\n dismissDelayMs: nonNegative('pageLoading.dismissDelayMs', loading.dismissDelayMs, g9PageLoadingDismissDelayMs),\n safetyTimeoutMs: nonNegative(\n 'pageLoading.safetyTimeoutMs',\n loading.safetyTimeoutMs,\n g9PageLoadingSafetyTimeoutMs,\n ),\n }),\n executor: s.executor ?? {},\n backgroundWorkSuppression: s.backgroundWorkSuppression,\n fields: Object.freeze({ highlightFilledValue: s.fields?.highlightFilledValue ?? true }),\n sheets: resolveSheetSettings(s.sheets),\n popups: Object.freeze(mergePopupSettings(s.popups, createDefaultPopupSettings())),\n toggles: Object.freeze({ switchMirrorInRtl: s.toggles?.switchMirrorInRtl ?? true }),\n guide: s.guide ?? {},\n });\n}\n"],"names":["g9DefaultBackEventName","g9DefaultErrorPresenter","g9PageLoadingDismissDelayMs","g9PageLoadingSafetyTimeoutMs","nonNegative","name","value","fallback","undefined","Number","G9Error","String","resolveSettings","settings","fallbackIconFonts","_s_backEventName","_s_pageLoading","_s_strings","_ref","_loading_backgroundColor","_loading_spinnerColor","_s_executor","_s_guide","_s_fields","_s_toggles","s","backEventName","loading","Object","resolveGlyphSlots","createIconFontRegistry","resolveSheetSettings","mergePopupSettings","createDefaultPopupSettings"],"mappings":";;;AAmBO,MAAMA,yBAAyB;AAwB/B,MAAMC,0BAET;IAAE,SAAS;AAAK;AAmFb,MAAMC,8BAA8B;AAEpC,MAAMC,+BAA+B;AAE5C,SAASC,YAAYC,IAAY,EAAEC,KAAyB,EAAEC,QAAgB;IAC5E,IAAID,AAAUE,WAAVF,OAAqB,OAAOC;IAChC,IAAI,AAAiB,YAAjB,OAAOD,SAAsB,CAACG,OAAO,QAAQ,CAACH,UAAUA,QAAQ,GAClE,MAAM,IAAII,QACR,oBACA,GAAGL,KAAK,kDAAkD,EAAEM,OAAOL,OAAO,EAAE,CAAC;IAGjF,OAAOA;AACT;AAMO,SAASM,gBACdC,QAAgC,EAChCC,iBAAsC;QAGhBC,kBAINC,gBAELC,YAEEC,MAAAA,cAIQC,0BACHC,uBAQNC,aAAAA,OAAAA,OAMHC;QAJuCC,WAGFC;IA3B9C,MAAMC,IAAIZ,QAAAA,WAAAA,WAAY,CAAC;IACvB,MAAMa,gBAAgB,QAAAX,CAAAA,mBAAAA,EAAE,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,AAAD,IAARA,KAAAA,IAAAA,WAAW,iBAAiB,AAAD,IAAC,QAAI;QAAK;QACjF,OAAO,QAAAF,CAAAA,WAAAA,EAAE,KAAK,AAAD,IAANA,WAAW,CAAC;IACrB;AACF"}
@@ -0,0 +1,34 @@
1
+ import { type G9PlaceDeclaration, type G9PlaceLayer, type G9RouteSink, type G9Segment, type G9SegmentInput } from '@g9tm/lynxcontrols-foundation';
2
+ import { type ReactNode } from '@lynx-js/react';
3
+ import { type G9Location, type G9Router } from './router.js';
4
+ /** A place a component declares while it is open. */
5
+ export interface G9PlaceSpec extends Omit<G9PlaceDeclaration, 'segment' | 'layer'> {
6
+ readonly segment: G9SegmentInput | (() => G9SegmentInput);
7
+ readonly layer: G9PlaceLayer;
8
+ }
9
+ /** The route sink of the provider (`services.route`), or null without one. */
10
+ export declare function useG9RouteSink(): G9RouteSink | null;
11
+ /** The provider's router when the sink is one, else null. */
12
+ export declare function useG9Router(): G9Router | null;
13
+ /** Where the app is (re-renders on every change), or null without a router. */
14
+ export declare function useG9Location(): G9Location | null;
15
+ /**
16
+ * Declares a place while mounted, `spec` is not null and `active` is true (a kept-alive tab body passes its own
17
+ * `active`). The spec may change every render: the router reads the latest; a new segment touches the declaration, a
18
+ * new layer, order or `under` declares it again. Which optional parts the place has (close, canLeave…) is fixed by the
19
+ * first declaration of a mount.
20
+ */
21
+ export declare function useG9Place(spec: G9PlaceSpec | null, options?: {
22
+ readonly active?: boolean;
23
+ readonly sink?: G9RouteSink | null;
24
+ }): void;
25
+ /** Props of {@link G9Place}. */
26
+ export interface G9PlaceProps extends G9PlaceSpec {
27
+ readonly active?: boolean;
28
+ readonly children?: ReactNode;
29
+ }
30
+ /** Declares a place around its children (renders no element). */
31
+ export declare function G9Place(props: G9PlaceProps): ReactNode;
32
+ /** The segment of a sheet without an explicit route: `sheet.<its automation id in kebab case>`, else `sheet`. */
33
+ export declare function sheetSegmentOf(automationId: string | undefined | null): G9Segment;
34
+ //# sourceMappingURL=hooks.d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