@g9tm/lynxcontrols-foundation 1.7.3 → 2.1.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 (112) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/dist/culture/bidi.d.ts +8 -0
  3. package/dist/culture/bidi.d.ts.map +1 -0
  4. package/dist/culture/bidi.js +16 -0
  5. package/dist/culture/bidi.js.map +1 -0
  6. package/dist/culture/coordinates.d.ts +17 -0
  7. package/dist/culture/coordinates.d.ts.map +1 -0
  8. package/dist/culture/coordinates.js +18 -0
  9. package/dist/culture/coordinates.js.map +1 -0
  10. package/dist/culture/index.d.ts +4 -0
  11. package/dist/culture/index.d.ts.map +1 -1
  12. package/dist/culture/index.js +4 -0
  13. package/dist/culture/natural-date.d.ts +9 -0
  14. package/dist/culture/natural-date.d.ts.map +1 -0
  15. package/dist/culture/natural-date.js +208 -0
  16. package/dist/culture/natural-date.js.map +1 -0
  17. package/dist/culture/text.d.ts +73 -0
  18. package/dist/culture/text.d.ts.map +1 -0
  19. package/dist/culture/text.js +213 -0
  20. package/dist/culture/text.js.map +1 -0
  21. package/dist/enums/index.d.ts +6 -0
  22. package/dist/enums/index.d.ts.map +1 -1
  23. package/dist/enums/index.js +4 -1
  24. package/dist/enums/index.js.map +1 -1
  25. package/dist/icons/index.d.ts +2 -1
  26. package/dist/icons/index.d.ts.map +1 -1
  27. package/dist/icons/index.js +2 -1
  28. package/dist/icons/packs.d.ts +34 -0
  29. package/dist/icons/packs.d.ts.map +1 -0
  30. package/dist/icons/packs.js +70 -0
  31. package/dist/icons/packs.js.map +1 -0
  32. package/dist/icons/svg.d.ts +9 -2
  33. package/dist/icons/svg.d.ts.map +1 -1
  34. package/dist/icons/svg.js +13 -2
  35. package/dist/icons/svg.js.map +1 -1
  36. package/dist/index.d.ts +1 -0
  37. package/dist/index.d.ts.map +1 -1
  38. package/dist/index.js +1 -0
  39. package/dist/layout/index.d.ts +43 -0
  40. package/dist/layout/index.d.ts.map +1 -0
  41. package/dist/layout/index.js +31 -0
  42. package/dist/layout/index.js.map +1 -0
  43. package/dist/services/contracts.d.ts +32 -0
  44. package/dist/services/contracts.d.ts.map +1 -1
  45. package/dist/services/contracts.js.map +1 -1
  46. package/dist/services/feedback.d.ts +28 -0
  47. package/dist/services/feedback.d.ts.map +1 -0
  48. package/dist/services/feedback.js +27 -0
  49. package/dist/services/feedback.js.map +1 -0
  50. package/dist/services/index.d.ts +3 -1
  51. package/dist/services/index.d.ts.map +1 -1
  52. package/dist/services/index.js +2 -0
  53. package/dist/services/keys.d.ts +39 -0
  54. package/dist/services/keys.d.ts.map +1 -0
  55. package/dist/services/keys.js +96 -0
  56. package/dist/services/keys.js.map +1 -0
  57. package/dist/theme/aliases.d.ts +73 -0
  58. package/dist/theme/aliases.d.ts.map +1 -0
  59. package/dist/theme/aliases.js +76 -0
  60. package/dist/theme/aliases.js.map +1 -0
  61. package/dist/theme/appearance.d.ts +57 -0
  62. package/dist/theme/appearance.d.ts.map +1 -0
  63. package/dist/theme/appearance.js +275 -0
  64. package/dist/theme/appearance.js.map +1 -0
  65. package/dist/theme/brand.d.ts +40 -0
  66. package/dist/theme/brand.d.ts.map +1 -0
  67. package/dist/theme/brand.js +181 -0
  68. package/dist/theme/brand.js.map +1 -0
  69. package/dist/theme/contrast.d.ts +19 -0
  70. package/dist/theme/contrast.d.ts.map +1 -0
  71. package/dist/theme/contrast.js +119 -0
  72. package/dist/theme/contrast.js.map +1 -0
  73. package/dist/theme/css-color.d.ts +20 -0
  74. package/dist/theme/css-color.d.ts.map +1 -0
  75. package/dist/theme/css-color.js +149 -0
  76. package/dist/theme/css-color.js.map +1 -0
  77. package/dist/theme/design.d.ts +33 -0
  78. package/dist/theme/design.d.ts.map +1 -0
  79. package/dist/theme/design.js +162 -0
  80. package/dist/theme/design.js.map +1 -0
  81. package/dist/theme/index.d.ts +10 -2
  82. package/dist/theme/index.d.ts.map +1 -1
  83. package/dist/theme/index.js +10 -2
  84. package/dist/theme/oklch.d.ts +63 -0
  85. package/dist/theme/oklch.d.ts.map +1 -0
  86. package/dist/theme/oklch.js +258 -0
  87. package/dist/theme/oklch.js.map +1 -0
  88. package/dist/theme/recipe.d.ts +44 -0
  89. package/dist/theme/recipe.d.ts.map +1 -0
  90. package/dist/theme/recipe.js +156 -0
  91. package/dist/theme/recipe.js.map +1 -0
  92. package/dist/theme/theme.d.ts +43 -2
  93. package/dist/theme/theme.d.ts.map +1 -1
  94. package/dist/theme/theme.js +85 -9
  95. package/dist/theme/theme.js.map +1 -1
  96. package/dist/theme/variants.d.ts +10 -0
  97. package/dist/theme/variants.d.ts.map +1 -1
  98. package/dist/theme/variants.js +74 -1
  99. package/dist/theme/variants.js.map +1 -1
  100. package/dist/tokens/derived.d.ts +31 -0
  101. package/dist/tokens/derived.d.ts.map +1 -0
  102. package/dist/tokens/derived.js +42 -0
  103. package/dist/tokens/derived.js.map +1 -0
  104. package/dist/tokens/index.d.ts +2 -0
  105. package/dist/tokens/index.d.ts.map +1 -1
  106. package/dist/tokens/index.js +2 -0
  107. package/dist/tokens/shape.d.ts +46 -0
  108. package/dist/tokens/shape.d.ts.map +1 -0
  109. package/dist/tokens/shape.js +95 -0
  110. package/dist/tokens/shape.js.map +1 -0
  111. package/docs/api.md +135 -2
  112. package/package.json +6 -1
package/dist/icons/svg.js CHANGED
@@ -13,9 +13,20 @@ function requireWeight(weightScale) {
13
13
  function canonicalColor(color) {
14
14
  return 'currentColor' === color ? color : formatColor(parseColor(color));
15
15
  }
16
+ function toLynxSvg(svg) {
17
+ return svg.replace(/<line((?:\s+[a-z0-9-]+="[^"]*")*)\s*\/>/g, (_whole, attrs)=>{
18
+ var _at_x1, _at_y1, _at_x2, _at_y2;
19
+ const at = {};
20
+ const rest = attrs.replace(/\s+(x1|y1|x2|y2)="([^"]*)"/g, (_m, name, value)=>{
21
+ at[name] = value;
22
+ return '';
23
+ });
24
+ return `<path d="M${null != (_at_x1 = at.x1) ? _at_x1 : '0'} ${null != (_at_y1 = at.y1) ? _at_y1 : '0'} L${null != (_at_x2 = at.x2) ? _at_x2 : '0'} ${null != (_at_y2 = at.y2) ? _at_y2 : '0'}"${rest}/>`;
25
+ });
26
+ }
16
27
  function render(glyph, color, weightScale) {
17
28
  if ('none' === glyph) return '';
18
- return g9GlyphSvg[glyph].replace(`stroke-width="${g9GlyphStrokeUnits}"`, `stroke-width="${formatWidth(g9GlyphStrokeUnits * weightScale)}"`).replace(/currentColor/g, color);
29
+ return toLynxSvg(g9GlyphSvg[glyph]).replace(`stroke-width="${g9GlyphStrokeUnits}"`, `stroke-width="${formatWidth(g9GlyphStrokeUnits * weightScale)}"`).replace(/currentColor/g, color);
19
30
  }
20
31
  function createGlyphSvgCache(maxEntries = g9GlyphSvgCacheDefaultSize) {
21
32
  if (!Number.isInteger(maxEntries) || maxEntries < 1) throw new G9Error('icon-cache', `maxEntries must be a positive integer (got ${String(maxEntries)}).`);
@@ -54,6 +65,6 @@ const sharedCache = createGlyphSvgCache();
54
65
  function svgForGlyph(glyph, color = 'currentColor', weightScale = 1) {
55
66
  return sharedCache.svg(glyph, color, weightScale);
56
67
  }
57
- export { createGlyphSvgCache, g9GlyphSvgCacheDefaultSize, svgForGlyph };
68
+ export { createGlyphSvgCache, g9GlyphSvgCacheDefaultSize, svgForGlyph, toLynxSvg };
58
69
 
59
70
  //# sourceMappingURL=svg.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"icons/svg.js","sources":["../../src/icons/svg.ts"],"sourcesContent":["import { G9Error } from '../errors';\nimport { formatColor, parseColor } from '../theme/color';\nimport { g9GlyphStrokeUnits, g9GlyphSvg } from './generated/glyph-svg';\nimport { assertG9Glyph, type G9Glyph } from './glyph';\n\n/** Default capacity of a glyph SVG cache: every glyph in a few colours and weights. */\nexport const g9GlyphSvgCacheDefaultSize = 256;\n\n/** A bounded least-recently-used cache of rendered glyph SVG documents. */\nexport interface G9GlyphSvgCache {\n /** The capacity; inserting beyond it evicts the least recently used entry. */\n readonly maxEntries: number;\n /** How many documents are cached now (never more than `maxEntries`). */\n readonly size: number;\n /** Renders (or returns the cached) SVG document; same contract as `svgForGlyph`. */\n svg(glyph: G9Glyph, color?: string, weightScale?: number): string;\n /** True when the document for these arguments is cached (does not refresh its recency). */\n has(glyph: G9Glyph, color?: string, weightScale?: number): boolean;\n /** Drops every cached document. */\n clear(): void;\n}\n\n/** Shortest decimal for a stroke width, rounded to 4 places so `2 * 1.1` prints `2.2`; no locale (no Intl). */\nfunction formatWidth(value: number): string {\n return String(Math.round(value * 10_000) / 10_000);\n}\n\nfunction requireWeight(weightScale: number): number {\n if (typeof weightScale !== 'number' || !Number.isFinite(weightScale) || weightScale <= 0) {\n throw new G9Error('icon-weight', `weightScale must be a finite number above 0 (got ${String(weightScale)}).`);\n }\n return weightScale;\n}\n\n/** The canonical colour string written into the SVG: `currentColor` stays, any other CSS colour is normalised. */\nfunction canonicalColor(color: string): string {\n return color === 'currentColor' ? color : formatColor(parseColor(color));\n}\n\nfunction render(glyph: G9Glyph, color: string, weightScale: number): string {\n if (glyph === 'none') return '';\n return g9GlyphSvg[glyph]\n .replace(`stroke-width=\"${g9GlyphStrokeUnits}\"`, `stroke-width=\"${formatWidth(g9GlyphStrokeUnits * weightScale)}\"`)\n .replace(/currentColor/g, color);\n}\n\n/** Creates a bounded LRU cache of glyph SVG documents (default capacity `g9GlyphSvgCacheDefaultSize`). */\nexport function createGlyphSvgCache(maxEntries: number = g9GlyphSvgCacheDefaultSize): G9GlyphSvgCache {\n if (!Number.isInteger(maxEntries) || maxEntries < 1) {\n throw new G9Error('icon-cache', `maxEntries must be a positive integer (got ${String(maxEntries)}).`);\n }\n // Map iteration order is insertion order: re-inserting on a hit makes the first key the least recently used.\n const entries = new Map<string, string>();\n const keyOf = (glyph: G9Glyph, color: string, weightScale: number) => {\n assertG9Glyph(glyph);\n return `${glyph}|${canonicalColor(color)}|${requireWeight(weightScale)}`;\n };\n return {\n maxEntries,\n get size() {\n return entries.size;\n },\n svg(glyph, color = 'currentColor', weightScale = 1) {\n const key = keyOf(glyph, color, weightScale);\n const hit = entries.get(key);\n if (hit !== undefined) {\n entries.delete(key);\n entries.set(key, hit);\n return hit;\n }\n const svg = render(glyph, canonicalColor(color), weightScale);\n entries.set(key, svg);\n if (entries.size > maxEntries) entries.delete(entries.keys().next().value as string);\n return svg;\n },\n has(glyph, color = 'currentColor', weightScale = 1) {\n return entries.has(keyOf(glyph, color, weightScale));\n },\n clear() {\n entries.clear();\n },\n };\n}\n\nconst sharedCache = createGlyphSvgCache();\n\n/**\n * The SVG document of a built-in glyph for Lynx `<svg content>` (WP02 renders it): the golden MAUI drawing with every\n * `currentColor` replaced by `color` and the stroke width scaled by `weightScale` (MAUI `G9GlyphDrawable.Color`,\n * `WeightScale`; stroke = 2 design units × weight; filled dots keep their recorded radius). `'none'` returns `''`\n * (renders nothing). `color` defaults to `currentColor`; any other value must be a CSS colour `parseColor` reads and\n * is written normalised (`formatColor`). Invalid glyph, colour or weight (finite, above 0) throws a `G9Error`.\n * Results come from a shared bounded LRU cache (`createGlyphSvgCache` for a private one).\n */\nexport function svgForGlyph(glyph: G9Glyph, color = 'currentColor', weightScale = 1): string {\n return sharedCache.svg(glyph, color, weightScale);\n}\n"],"names":["g9GlyphSvgCacheDefaultSize","formatWidth","value","String","Math","requireWeight","weightScale","Number","G9Error","canonicalColor","color","formatColor","parseColor","render","glyph","g9GlyphSvg","g9GlyphStrokeUnits","createGlyphSvgCache","maxEntries","entries","Map","keyOf","assertG9Glyph","key","hit","undefined","svg","sharedCache","svgForGlyph"],"mappings":";;;;AAMO,MAAMA,6BAA6B;AAiB1C,SAASC,YAAYC,KAAa;IAChC,OAAOC,OAAOC,KAAK,KAAK,CAACF,AAAQ,QAARA,SAAkB;AAC7C;AAEA,SAASG,cAAcC,WAAmB;IACxC,IAAI,AAAuB,YAAvB,OAAOA,eAA4B,CAACC,OAAO,QAAQ,CAACD,gBAAgBA,eAAe,GACrF,MAAM,IAA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AAYC,QAAQ,MAAM,CAACA,QAAQ,IAAI,GAAG,IAAI,GAAG,KAAK;YACzE,OAAOO;QACT;QACA,KAAIZ,KAAK,EAAEJ,QAAQ,cAAc,EAAEJ,cAAc,CAAC;YAChD,OAAOa,QAAQ,GAAG,CAACE,MAAMP,OAAOJ,OAAOJ;QACzC;QACA;YACEa,QAAQ,KAAK;QACf;IACF;AACF;AAEA,MAAMQ,cAAcV;AAUb,SAASW,YAAYd,KAAc,EAAEJ,QAAQ,cAAc,EAAEJ,cAAc,CAAC;IACjF,OAAOqB,YAAY,GAAG,CAACb,OAAOJ,OAAOJ;AACvC"}
1
+ {"version":3,"file":"icons/svg.js","sources":["../../src/icons/svg.ts"],"sourcesContent":["import { G9Error } from '../errors';\nimport { formatColor, parseColor } from '../theme/color';\nimport { g9GlyphStrokeUnits, g9GlyphSvg } from './generated/glyph-svg';\nimport { assertG9Glyph, type G9Glyph } from './glyph';\n\n/** Default capacity of a glyph SVG cache: every glyph in a few colours and weights. */\nexport const g9GlyphSvgCacheDefaultSize = 256;\n\n/** A bounded least-recently-used cache of rendered glyph SVG documents. */\nexport interface G9GlyphSvgCache {\n /** The capacity; inserting beyond it evicts the least recently used entry. */\n readonly maxEntries: number;\n /** How many documents are cached now (never more than `maxEntries`). */\n readonly size: number;\n /** Renders (or returns the cached) SVG document; same contract as `svgForGlyph`. */\n svg(glyph: G9Glyph, color?: string, weightScale?: number): string;\n /** True when the document for these arguments is cached (does not refresh its recency). */\n has(glyph: G9Glyph, color?: string, weightScale?: number): boolean;\n /** Drops every cached document. */\n clear(): void;\n}\n\n/** Shortest decimal for a stroke width, rounded to 4 places so `2 * 1.1` prints `2.2`; no locale (no Intl). */\nfunction formatWidth(value: number): string {\n return String(Math.round(value * 10_000) / 10_000);\n}\n\nfunction requireWeight(weightScale: number): number {\n if (typeof weightScale !== 'number' || !Number.isFinite(weightScale) || weightScale <= 0) {\n throw new G9Error('icon-weight', `weightScale must be a finite number above 0 (got ${String(weightScale)}).`);\n }\n return weightScale;\n}\n\n/** The canonical colour string written into the SVG: `currentColor` stays, any other CSS colour is normalised. */\nfunction canonicalColor(color: string): string {\n return color === 'currentColor' ? color : formatColor(parseColor(color));\n}\n\n/**\n * The SVG elements Lynx 4.2's svg element draws, from any SVG text: every line element (x1 y1 x2 y2) becomes the\n * two-point path `M x1 y1 L x2 y2` of the same geometry and attributes. Lynx draws no line element at all (proven on a Galaxy\n * A21s, 2026-11-18: ✕, +, −, ≡ and the search handle were invisible). The golden documents keep MAUI's elements; this is\n * applied where they become Lynx content.\n */\nexport function toLynxSvg(svg: string): string {\n return svg.replace(/<line((?:\\s+[a-z0-9-]+=\"[^\"]*\")*)\\s*\\/>/g, (_whole, attrs: string) => {\n const at: Record<string, string> = {};\n const rest = attrs.replace(/\\s+(x1|y1|x2|y2)=\"([^\"]*)\"/g, (_m, name: string, value: string) => {\n at[name] = value;\n return '';\n });\n return `<path d=\"M${at.x1 ?? '0'} ${at.y1 ?? '0'} L${at.x2 ?? '0'} ${at.y2 ?? '0'}\"${rest}/>`;\n });\n}\n\nfunction render(glyph: G9Glyph, color: string, weightScale: number): string {\n if (glyph === 'none') return '';\n return toLynxSvg(g9GlyphSvg[glyph])\n .replace(`stroke-width=\"${g9GlyphStrokeUnits}\"`, `stroke-width=\"${formatWidth(g9GlyphStrokeUnits * weightScale)}\"`)\n .replace(/currentColor/g, color);\n}\n\n/** Creates a bounded LRU cache of glyph SVG documents (default capacity `g9GlyphSvgCacheDefaultSize`). */\nexport function createGlyphSvgCache(maxEntries: number = g9GlyphSvgCacheDefaultSize): G9GlyphSvgCache {\n if (!Number.isInteger(maxEntries) || maxEntries < 1) {\n throw new G9Error('icon-cache', `maxEntries must be a positive integer (got ${String(maxEntries)}).`);\n }\n // Map iteration order is insertion order: re-inserting on a hit makes the first key the least recently used.\n const entries = new Map<string, string>();\n const keyOf = (glyph: G9Glyph, color: string, weightScale: number) => {\n assertG9Glyph(glyph);\n return `${glyph}|${canonicalColor(color)}|${requireWeight(weightScale)}`;\n };\n return {\n maxEntries,\n get size() {\n return entries.size;\n },\n svg(glyph, color = 'currentColor', weightScale = 1) {\n const key = keyOf(glyph, color, weightScale);\n const hit = entries.get(key);\n if (hit !== undefined) {\n entries.delete(key);\n entries.set(key, hit);\n return hit;\n }\n const svg = render(glyph, canonicalColor(color), weightScale);\n entries.set(key, svg);\n if (entries.size > maxEntries) entries.delete(entries.keys().next().value as string);\n return svg;\n },\n has(glyph, color = 'currentColor', weightScale = 1) {\n return entries.has(keyOf(glyph, color, weightScale));\n },\n clear() {\n entries.clear();\n },\n };\n}\n\nconst sharedCache = createGlyphSvgCache();\n\n/**\n * The SVG document of a built-in glyph for Lynx `<svg content>` (WP02 renders it): the golden MAUI drawing in the\n * elements Lynx draws ({@link toLynxSvg}), every `currentColor` replaced by `color` and the stroke width scaled by `weightScale` (MAUI `G9GlyphDrawable.Color`,\n * `WeightScale`; stroke = 2 design units × weight; filled dots keep their recorded radius). `'none'` returns `''`\n * (renders nothing). `color` defaults to `currentColor`; any other value must be a CSS colour `parseColor` reads and\n * is written normalised (`formatColor`). Invalid glyph, colour or weight (finite, above 0) throws a `G9Error`.\n * Results come from a shared bounded LRU cache (`createGlyphSvgCache` for a private one).\n */\nexport function svgForGlyph(glyph: G9Glyph, color = 'currentColor', weightScale = 1): string {\n return sharedCache.svg(glyph, color, weightScale);\n}\n"],"names":["g9GlyphSvgCacheDefaultSize","formatWidth","value","String","Math","requireWeight","weightScale","Number","G9Error","canonicalColor","color","formatColor","parseColor","toLynxSvg","svg","_whole","attrs","_at_x1","_at_y1","_at_x2","_at_y2","at","rest","_m","name","render","glyph","g9GlyphSvg","g9GlyphStrokeUnits","createGlyphSvgCache","maxEntries","entries","Map","keyOf","assertG9Glyph","key","hit","undefined","sharedCache","svgForGlyph"],"mappings":";;;;AAMO,MAAMA,6BAA6B;AAiB1C,SAASC,YAAYC,KAAa;IAChC,OAAOC,OAAOC,KAAK,KAAK,CAACF,AAAQ,QAARA,SAAkB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  export * from './exec/index.js';
6
6
  export * from './icons/index.js';
7
+ export * from './layout/index.js';
7
8
  export * from './route/index.js';
8
9
  export * from './services/index.js';
9
10
  export * from './theme/index.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjF,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACnC,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjF,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACnC,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC"}
package/dist/index.js CHANGED
@@ -2,6 +2,7 @@ export * from "./culture/index.js";
2
2
  export * from "./enums/index.js";
3
3
  export * from "./exec/index.js";
4
4
  export * from "./icons/index.js";
5
+ export * from "./layout/index.js";
5
6
  export * from "./route/index.js";
6
7
  export * from "./services/index.js";
7
8
  export * from "./theme/index.js";
@@ -0,0 +1,43 @@
1
+ /** Widths in dp at which the layout changes. */
2
+ export interface G9Breakpoints {
3
+ /** From here up: tablet (two columns, icon rail). Default 720. */
4
+ readonly tablet: number;
5
+ /** From here up: desktop (side navigation, top bar). Default 1100. */
6
+ readonly desktop: number;
7
+ /** From here up: sheets present as centred dialogs or side panels. Default 860. */
8
+ readonly modal: number;
9
+ }
10
+ /** Window widths (px) where the layout changes: tablet 720, desktop 1100; a sheet becomes a dialog from 860. */
11
+ export declare const g9Breakpoints: G9Breakpoints;
12
+ /** The window's size class: phone, tablet or desktop. */
13
+ export type G9LayoutClass = 'phone' | 'tablet' | 'desktop';
14
+ /** What a control needs to know about the window, all derived from its size. */
15
+ export interface G9Layout {
16
+ readonly width: number;
17
+ readonly height: number;
18
+ readonly layout: G9LayoutClass;
19
+ /** Overlays present as dialogs/panels (width ≥ `modal`). */
20
+ readonly wide: boolean;
21
+ /** Width > height. */
22
+ readonly landscape: boolean;
23
+ }
24
+ /** The class of a width. */
25
+ export declare function classifyWidth(width: number, bp?: G9Breakpoints): G9LayoutClass;
26
+ /** The full layout of a window size. */
27
+ export declare function resolveLayout(width: number, height: number, bp?: G9Breakpoints): G9Layout;
28
+ /** True when two layouts differ in anything a control branches on (class, wide, orientation) — not in raw pixels. */
29
+ export declare const sameLayoutClass: (a: G9Layout, b: G9Layout) => boolean;
30
+ /** Chooses by layout class: `byLayout(layout, { phone: 1, tablet: 2, desktop: 3 })` (missing classes fall back down). */
31
+ export declare function byLayout<T>(layout: G9LayoutClass, values: {
32
+ readonly phone: T;
33
+ readonly tablet?: T;
34
+ readonly desktop?: T;
35
+ }): T;
36
+ /** How a sheet-like overlay presents at this layout. */
37
+ export type G9Presentation = 'bottom' | 'dialog' | 'side';
38
+ /**
39
+ * The presentation of an overlay that asked for `preferred` (`'auto'`: bottom sheet on narrow, dialog on wide). A
40
+ * `'side'` request falls back to a bottom sheet on narrow windows, where a side panel would cover the whole screen.
41
+ */
42
+ export declare function resolvePresentation(wide: boolean, preferred?: 'auto' | G9Presentation): G9Presentation;
43
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+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C,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,CAAA;CAAE,GACvE,CAAC,CAIH;AAED,wDAAwD;AACxD,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,QAAQ,GAAG,MAAM,CAAC;AAE1D;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,OAAO,EAAE,SAAS,GAAE,MAAM,GAAG,cAAuB,GAAG,cAAc,CAG9G"}
@@ -0,0 +1,31 @@
1
+ const g9Breakpoints = Object.freeze({
2
+ tablet: 720,
3
+ desktop: 1100,
4
+ modal: 860
5
+ });
6
+ function classifyWidth(width, bp = g9Breakpoints) {
7
+ return width >= bp.desktop ? 'desktop' : width >= bp.tablet ? 'tablet' : 'phone';
8
+ }
9
+ function resolveLayout(width, height, bp = g9Breakpoints) {
10
+ return {
11
+ width,
12
+ height,
13
+ layout: classifyWidth(width, bp),
14
+ wide: width >= bp.modal,
15
+ landscape: width > height
16
+ };
17
+ }
18
+ const sameLayoutClass = (a, b)=>a.layout === b.layout && a.wide === b.wide && a.landscape === b.landscape;
19
+ function byLayout(layout, values) {
20
+ var _ref, _values_desktop, _values_tablet;
21
+ if ('desktop' === layout) return null != (_ref = null != (_values_desktop = values.desktop) ? _values_desktop : values.tablet) ? _ref : values.phone;
22
+ if ('tablet' === layout) return null != (_values_tablet = values.tablet) ? _values_tablet : values.phone;
23
+ return values.phone;
24
+ }
25
+ function resolvePresentation(wide, preferred = 'auto') {
26
+ if (!wide) return 'bottom';
27
+ return 'auto' === preferred ? 'dialog' : preferred;
28
+ }
29
+ export { byLayout, classifyWidth, g9Breakpoints, resolveLayout, resolvePresentation, sameLayoutClass };
30
+
31
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"layout/index.js","sources":["../../src/layout/index.ts"],"sourcesContent":["// Responsive layout classes shared by every control and app: the same three sizes the projects use (SAC's BP, Riskara's\n// phone/tablet/desktop, G9Hub's AppShell), plus the width from which overlays turn from bottom sheets into dialogs.\n// Pure: the provider measures the window once and every consumer reads a class, so a resize re-renders only what\n// actually changes class (not every control on every pixel).\n\n/** Widths in dp at which the layout changes. */\nexport interface G9Breakpoints {\n /** From here up: tablet (two columns, icon rail). Default 720. */\n readonly tablet: number;\n /** From here up: desktop (side navigation, top bar). Default 1100. */\n readonly desktop: number;\n /** From here up: sheets present as centred dialogs or side panels. Default 860. */\n readonly modal: number;\n}\n\n/** Window widths (px) where the layout changes: tablet 720, desktop 1100; a sheet becomes a dialog from 860. */\nexport const g9Breakpoints: G9Breakpoints = Object.freeze({ tablet: 720, desktop: 1100, modal: 860 });\n\n/** The window's size class: phone, tablet or desktop. */\nexport type G9LayoutClass = 'phone' | 'tablet' | 'desktop';\n\n/** What a control needs to know about the window, all derived from its size. */\nexport interface G9Layout {\n readonly width: number;\n readonly height: number;\n readonly layout: G9LayoutClass;\n /** Overlays present as dialogs/panels (width ≥ `modal`). */\n readonly wide: boolean;\n /** Width > height. */\n readonly landscape: boolean;\n}\n\n/** The class of a width. */\nexport function classifyWidth(width: number, bp: G9Breakpoints = g9Breakpoints): G9LayoutClass {\n return width >= bp.desktop ? 'desktop' : width >= bp.tablet ? 'tablet' : 'phone';\n}\n\n/** The full layout of a window size. */\nexport function resolveLayout(width: number, height: number, bp: G9Breakpoints = g9Breakpoints): G9Layout {\n return { width, height, layout: classifyWidth(width, bp), wide: width >= bp.modal, landscape: width > height };\n}\n\n/** True when two layouts differ in anything a control branches on (class, wide, orientation) — not in raw pixels. */\nexport const sameLayoutClass = (a: G9Layout, b: G9Layout): boolean =>\n a.layout === b.layout && a.wide === b.wide && a.landscape === b.landscape;\n\n/** Chooses by layout class: `byLayout(layout, { phone: 1, tablet: 2, desktop: 3 })` (missing classes fall back down). */\nexport function byLayout<T>(\n layout: G9LayoutClass,\n values: { readonly phone: T; readonly tablet?: T; readonly desktop?: T },\n): T {\n if (layout === 'desktop') return values.desktop ?? values.tablet ?? values.phone;\n if (layout === 'tablet') return values.tablet ?? values.phone;\n return values.phone;\n}\n\n/** How a sheet-like overlay presents at this layout. */\nexport type G9Presentation = 'bottom' | 'dialog' | 'side';\n\n/**\n * The presentation of an overlay that asked for `preferred` (`'auto'`: bottom sheet on narrow, dialog on wide). A\n * `'side'` request falls back to a bottom sheet on narrow windows, where a side panel would cover the whole screen.\n */\nexport function resolvePresentation(wide: boolean, preferred: 'auto' | G9Presentation = 'auto'): G9Presentation {\n if (!wide) return 'bottom';\n return preferred === 'auto' ? 'dialog' : preferred;\n}\n"],"names":["g9Breakpoints","Object","classifyWidth","width","bp","resolveLayout","height","sameLayoutClass","a","b","byLayout","layout","values","_ref","_values_tablet","resolvePresentation","wide","preferred"],"mappings":"AAgBO,MAAMA,gBAA+BC,OAAO,MAAM,CAAC;IAAE,QAAQ;IAAK,SAAS;IAAM,OAAO;AAAI;AAiB5F,SAASC,cAAcC,KAAa,EAAEC,KAAoBJ,aAAa;IAC5E,OAAOG,SAASC,GAAG,OAAO,GAAG,YAAYD,SAASC,GAAG,MAAM,GAAG,WAAW;AAC3E;AAGO,SAASC,cAAcF,KAAa,EAAEG,MAAc,EAAEF,KAAoBJ,aAAa;IAC5F,OAAO;QAAEG;QAAOG;QAAQ,QAAQJ,cAAcC,OAAOC;QAAK,MAAMD,SAASC,GAAG,KAAK;QAAE,WAAWD,QAAQG;IAAO;AAC/G;AAGO,MAAMC,kBAAkB,CAACC,GAAaC,IAC3CD,EAAE,MAAM,KAAKC,EAAE,MAAM,IAAID,EAAE,IAAI,KAAKC,EAAE,IAAI,IAAID,EAAE,SAAS,KAAKC,EAAE,SAAS;AAGpE,SAASC,SACdC,MAAqB,EACrBC,MAAwE;QAEvCC,MAAAA,iBACDC;IADhC,IAAIH,AAAW,cAAXA,QAAsB,OAAO,QAAAE,CAAAA,OAAAA,QAAAA,CAAAA,kBAAAA,OAAO,OAAO,AAAD,IAAbA,kBAAkBD,OAAO,MAAM,AAAD,IAA9BC,OAAmCD,OAAO,KAAK;IAChF,IAAID,AAAW,aAAXA,QAAqB,OAAO,QAAAG,CAAAA,iBAAAA,OAAO,MAAM,AAAD,IAAZA,iBAAiBF,OAAO,KAAK;IAC7D,OAAOA,OAAO,KAAK;AACrB;AASO,SAASG,oBAAoBC,IAAa,EAAEC,YAAqC,MAAM;IAC5F,IAAI,CAACD,MAAM,OAAO;IAClB,OAAOC,AAAc,WAAdA,YAAuB,WAAWA;AAC3C"}
@@ -2,6 +2,7 @@ import { G9Error } from '../errors.js';
2
2
  import type { G9RouteSink } from '../route/sink.js';
3
3
  import type { G9AbortSignal } from './abort.js';
4
4
  import type { G9Clock } from './clock.js';
5
+ import type { G9Haptics, G9Sounds } from './feedback.js';
5
6
  import type { G9PreferenceStore } from './preferences.js';
6
7
  /** Result of asking for a runtime permission. `'restricted'`: blocked by policy, the user cannot grant it. */
7
8
  export type G9PermissionStatus = 'granted' | 'denied' | 'restricted';
@@ -141,6 +142,31 @@ export interface G9MediaProvider {
141
142
  /** Creates a player for a resolved video. The control disposes it on slide change, deactivation and unmount. */
142
143
  createPlayer?(media: G9ResolvedMedia, options?: G9MediaPlayerOptions): G9MediaPlayer;
143
144
  }
145
+ /** A file the host picked or received (a handle: read and release it through the host's own files API). */
146
+ export interface G9FileRef {
147
+ readonly id: string;
148
+ readonly name?: string;
149
+ readonly mime?: string;
150
+ readonly size?: number;
151
+ }
152
+ /**
153
+ * The system file chooser and camera (G9Hub `platform().files`). Optional: without it `G9DropZone` shows its area
154
+ * disabled. A host that can drop files on the window emits `g9:drag` `{ active }` and `g9:drop` `{ files }`.
155
+ */
156
+ export interface G9FilePicker {
157
+ /** Opens the chooser filtered by category; resolves `[]` when cancelled. */
158
+ pick(options: {
159
+ readonly accept: 'image' | 'video' | 'media' | 'audio' | 'any';
160
+ readonly multiple: boolean;
161
+ }): Promise<readonly G9FileRef[]>;
162
+ /** One photo from the camera, or `null` when cancelled. */
163
+ camera?(options: {
164
+ readonly mode: 'photo';
165
+ readonly facing?: 'user' | 'environment';
166
+ }): Promise<G9FileRef | null>;
167
+ /** Gives a file the app will not use back to the host. */
168
+ release?(id: string): void;
169
+ }
144
170
  /** Safe-area insets in logical pixels. */
145
171
  export interface G9SafeInsets {
146
172
  readonly top: number;
@@ -183,6 +209,12 @@ export interface G9Capabilities {
183
209
  * and hosts work as before and a `route` option only reports a one-time diagnostics warning.
184
210
  */
185
211
  readonly route?: G9RouteSink;
212
+ /** Haptic feedback (optional: without it controls stay silent). */
213
+ readonly haptics?: G9Haptics;
214
+ /** Sound feedback (optional). */
215
+ readonly sounds?: G9Sounds;
216
+ /** The file chooser and camera (optional: `G9DropZone`). */
217
+ readonly files?: G9FilePicker;
186
218
  }
187
219
  /** The name of a capability. */
188
220
  export type G9CapabilityName = keyof G9Capabilities;
@@ -1 +1 @@
1
- {"version":3,"file":"contracts.d.ts","sourceRoot":"","sources":["../../src/services/contracts.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAEvD,8GAA8G;AAC9G,MAAM,MAAM,kBAAkB,GAAG,SAAS,GAAG,QAAQ,GAAG,YAAY,CAAC;AAErE,wCAAwC;AACxC,MAAM,WAAW,qBAAqB;IACpC,mFAAmF;IACnF,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,yFAAyF;IACzF,QAAQ,CAAC,MAAM,CAAC,EAAE,aAAa,CAAC;IAChC,gFAAgF;IAChF,QAAQ,CAAC,eAAe,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACnD;AAED,8FAA8F;AAC9F,MAAM,MAAM,oBAAoB,GAC5B;IAAE,QAAQ,CAAC,MAAM,EAAE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AC,EAAE,SAAS,CAAC;IAC7B,iCAAiC;IACjC,QAAQ,CAAC,MAAM,CAAC,EAAE,QAAQ,CAAC;IAC3B,4DAA4D;IAC5D,QAAQ,CAAC,KAAK,CAAC,EAAE,YAAY,CAAC;CAC/B;AAED,gCAAgC;AAChC,MAAM,MAAM,gBAAgB,GAAG,MAAM,cAAc,CAAC;AAEpD,4DAA4D;AAC5D,eAAO,MAAM,sBAAsB,EAAE,aAAa,CAAC,gBAAgB,CAAmD,CAAC;AAEvH,sHAAsH;AACtH,qBAAa,wBAAyB,SAAQ,OAAO;IACnD,8BAA8B;IAC9B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;gBAEhB,UAAU,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM;CAKjD;AAED,6FAA6F;AAC7F,wBAAgB,aAAa,CAAC,QAAQ,EAAE,OAAO,CAAC,cAAc,CAAC,EAAE,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAEhG;AAED,4EAA4E;AAC5E,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,gBAAgB,EAC1D,QAAQ,EAAE,OAAO,CAAC,cAAc,CAAC,EACjC,IAAI,EAAE,CAAC,GACN,WAAW,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAIhC;AAED;;;GAGG;AACH,wBAAgB,0BAA0B,CAAC,QAAQ,EAAE,OAAO,CAAC,cAAc,CAAC,GAAG,OAAO,CAAC,QAAQ,IAAI,cAAc,CAEhH"}
@@ -1 +1 @@
1
- {"version":3,"file":"services/contracts.js","sources":["../../src/services/contracts.ts"],"sourcesContent":["// Platform capability contracts (plan/specs/01-Architecture.md §8). Foundation defines the shapes only; the app\n// supplies implementations through the WP02 provider (`<G9Provider services={…}>`), platform adapters live in the\n// native and Lynxtron packages (WP12–WP14), and the features that use them (fields' dictation WP03, barcode WP09,\n// IntroCarousel WP09) own the behaviour. Nothing here requests a permission or touches a native module.\nimport { G9Error } from '../errors';\nimport type { G9RouteSink } from '../route/sink';\nimport type { G9AbortSignal } from './abort';\nimport type { G9Clock } from './clock';\nimport type { G9PreferenceStore } from './preferences';\n\n/** Result of asking for a runtime permission. `'restricted'`: blocked by policy, the user cannot grant it. */\nexport type G9PermissionStatus = 'granted' | 'denied' | 'restricted';\n\n/** Options of one dictation session. */\nexport interface G9SpeechToTextOptions {\n /** BCP 47 locale the recogniser listens for (from the culture, e.g. `'fa-IR'`). */\n readonly locale: string;\n /** Aborting stops listening; the session then settles with `{ status: 'cancelled' }`. */\n readonly signal?: G9AbortSignal;\n /** Interim hypotheses while the user speaks, when the platform reports them. */\n readonly onPartialResult?: (text: string) => void;\n}\n\n/** How a dictation session ended. Expected outcomes are results, not errors (specs/03 §7). */\nexport type G9SpeechToTextResult =\n | { readonly status: 'recognized'; readonly text: string }\n | { readonly status: 'cancelled' }\n | { readonly status: 'no-match' }\n | { readonly status: 'denied' };\n\n/**\n * Speech recognition for dictation into fields (MAUI `IG9SpeechToText`). Optional: without it the microphone\n * affordance is hidden. A platform fault rejects with a `G9Error`.\n */\nexport interface G9SpeechToText {\n /** Whether a recogniser exists for this locale on this device (no permission prompt). */\n isAvailable(locale: string): Promise<boolean>;\n /** Asks for microphone and speech permission (only ever from a user action). */\n requestPermission(): Promise<G9PermissionStatus>;\n /** Listens once and settles exactly once. */\n listen(options: G9SpeechToTextOptions): Promise<G9SpeechToTextResult>;\n}\n\n/** Options of one scan. */\nexport interface G9ScanOptions {\n /** Symbologies to accept (e.g. `'qr'`, `'ean13'`, `'code128'`); empty or absent means every one the scanner has. */\n readonly formats?: ReadonlyArray<string>;\n /** Aborting closes the scanner; the scan then settles with `{ status: 'cancelled' }`. */\n readonly signal?: G9AbortSignal;\n}\n\n/** How a scan ended. */\nexport type G9ScanResult =\n | { readonly status: 'scanned'; readonly text: string; readonly format: string }\n | { readonly status: 'cancelled' }\n | { readonly status: 'denied' };\n\n/** Barcode/QR scanning supplied by the app (WP09 barcode package). Optional: without it the scan action is hidden. */\nexport interface G9Scanner {\n /** Whether a camera scanner is usable on this device (no permission prompt). */\n isAvailable(): Promise<boolean>;\n /** Opens the scanner and settles exactly once. */\n scan(options?: G9ScanOptions): Promise<G9ScanResult>;\n}\n\n/** A media reference as the app describes it (an asset name, a file or a remote URI). */\nexport type G9MediaSource =\n | { readonly kind: 'image'; readonly uri: string }\n | { readonly kind: 'image'; readonly asset: string }\n | { readonly kind: 'video'; readonly uri: string }\n | { readonly kind: 'video'; readonly asset: string };\n\n/** A source resolved to something the platform can display; `uri` is what `<image>`/the video XElement load. */\nexport interface G9ResolvedMedia {\n readonly kind: 'image' | 'video';\n readonly uri: string;\n /** Intrinsic size when known, so layout can reserve space before the first frame. */\n readonly width?: number;\n readonly height?: number;\n}\n\n/** What a {@link G9MediaPlayer} tells its owner. */\nexport type G9MediaPlayerEvent =\n /** The first frame is ready to show. */\n | { readonly type: 'ready' }\n /** A looping video is about to end (`seconds` left); the owner may fade out. */\n | { readonly type: 'nearEnd'; readonly seconds: number }\n /** A looping video restarted from the beginning; the owner may fade back in. */\n | { readonly type: 'looped' }\n /** Playback failed; the owner falls back to the slide image. */\n | { readonly type: 'error'; readonly error: unknown };\n\n/** Options of {@link G9MediaProvider.createPlayer}. */\nexport interface G9MediaPlayerOptions {\n readonly loop?: boolean;\n readonly muted?: boolean;\n /** Best-effort seek applied once after the media opened (MAUI `InitialVideoStartSeconds`). */\n readonly startSeconds?: number;\n /** How early `nearEnd` fires, in seconds. */\n readonly nearEndSeconds?: number;\n}\n\n/**\n * One video player created by the app's media provider. `view` is what the control renders (the platform video\n * XElement the host registered, built by the app); the control never names a video tag itself.\n */\nexport interface G9MediaPlayer {\n /** The element to render (a ReactNode built by the app's provider; foundation keeps it opaque). */\n readonly view: unknown;\n play(): void;\n pause(): void;\n /** Releases the native player; idempotent. */\n dispose(): void;\n /** Subscribes to player events; returns the unsubscribe function. */\n subscribe(listener: (event: G9MediaPlayerEvent) => void): () => void;\n}\n\n/**\n * Resolves image and video sources for IntroCarousel and other media controls (WP09). Video is part of the contract on\n * every target, desktop included (decision D14 is open; no scope reduction is accepted). A provider that cannot play\n * video yet omits `createPlayer` or returns `false` from `supportsVideo`; controls then show the slide image and say\n * why (`'video-unsupported'`).\n */\nexport interface G9MediaProvider {\n resolve(source: G9MediaSource, options?: { readonly signal?: G9AbortSignal }): Promise<G9ResolvedMedia>;\n /** Whether this target can play video now (no permission prompt). Absent = `createPlayer` decides. */\n supportsVideo?(): boolean;\n /** Creates a player for a resolved video. The control disposes it on slide change, deactivation and unmount. */\n createPlayer?(media: G9ResolvedMedia, options?: G9MediaPlayerOptions): G9MediaPlayer;\n}\n\n/** Safe-area insets in logical pixels. */\nexport interface G9SafeInsets {\n readonly top: number;\n readonly end: number;\n readonly bottom: number;\n readonly start: number;\n}\n\n/** Android soft-input policy while a flow needs it (MAUI `G9KeyboardHelper.UseAndroidPanSoftInputMode`). */\nexport type G9SoftInputMode = 'pan' | 'resize';\n\n/**\n * Host integration the provider and overlays need (MAUI page/window plumbing), supplied by the native host. Required.\n * The system back press does not go through this object: the host sends a global event (default `g9:back`, specs/02\n * §4) and the provider dispatches it to the active `G9Host`; `exit` is what happens when nothing handled it.\n */\nexport interface G9HostServices {\n /** Leaves the app the platform way (Android moves the task to the back; desktop closes the window). */\n exit(): void;\n /** Hides the soft keyboard and clears focus (MAUI `G9KeyboardHelper.HideKeyboardAndClearFocus`). */\n hideKeyboard(): void;\n /** Current safe-area insets. */\n getSafeInsets(): G9SafeInsets;\n /** Called when the insets change (rotation, window resize). Returns an unsubscribe function. */\n subscribeSafeInsets(listener: (insets: G9SafeInsets) => void): () => void;\n /**\n * Switches the window's soft-input mode (Android only; `'resize'` is the app default). Hosts on platforms without\n * soft-input modes (iOS, desktop) omit it, which is where MAUI's helper was a no-op too.\n */\n setSoftInputMode?(mode: G9SoftInputMode): void;\n}\n\n/** Every service the app can supply. Required ones are listed in {@link g9RequiredCapabilities}. */\nexport interface G9Capabilities {\n readonly clock: G9Clock;\n readonly preferences: G9PreferenceStore;\n readonly host: G9HostServices;\n readonly speech?: G9SpeechToText;\n readonly scanner?: G9Scanner;\n readonly media?: G9MediaProvider;\n /**\n * The router places declare themselves to (`@g9tm/lynxcontrols/route` makes one). Optional: without it sheets, tab views\n * and hosts work as before and a `route` option only reports a one-time diagnostics warning.\n */\n readonly route?: G9RouteSink;\n}\n\n/** The name of a capability. */\nexport type G9CapabilityName = keyof G9Capabilities;\n\n/** Capabilities without which the provider cannot mount. */\nexport const g9RequiredCapabilities: ReadonlyArray<G9CapabilityName> = Object.freeze(['clock', 'preferences', 'host']);\n\n/** Thrown when code needs a capability the app did not supply (specs/03 §7: `G9CapabilityMissingError('speech')`). */\nexport class G9CapabilityMissingError extends G9Error {\n /** The missing capability. */\n readonly capability: string;\n\n constructor(capability: string, message?: string) {\n super('capability-missing', message ?? `The '${capability}' service is not available; supply it to G9Provider.`);\n this.name = 'G9CapabilityMissingError';\n this.capability = capability;\n }\n}\n\n/** `true` when the capability is present (optional features use this to hide themselves). */\nexport function hasCapability(services: Partial<G9Capabilities>, name: G9CapabilityName): boolean {\n return services[name] != null;\n}\n\n/** The capability, or throws {@link G9CapabilityMissingError} naming it. */\nexport function requireCapability<K extends G9CapabilityName>(\n services: Partial<G9Capabilities>,\n name: K,\n): NonNullable<G9Capabilities[K]> {\n const service = services[name];\n if (service == null) throw new G9CapabilityMissingError(name);\n return service as NonNullable<G9Capabilities[K]>;\n}\n\n/**\n * Checks every required capability at once (the provider calls this at mount).\n * @throws {G9CapabilityMissingError} for the first missing one, in {@link g9RequiredCapabilities} order.\n */\nexport function assertRequiredCapabilities(services: Partial<G9Capabilities>): asserts services is G9Capabilities {\n for (const name of g9RequiredCapabilities) requireCapability(services, name);\n}\n"],"names":["g9RequiredCapabilities","Object","G9CapabilityMissingError","G9Error","capability","message","hasCapability","services","name","requireCapability","service","assertRequiredCapabilities"],"mappings":";;;;;;;;;;;AAsLO,MAAMA,yBAA0DC,OAAO,MAAM,CAAC;IAAC;IAAS;IAAe;CAAO;AAG9G,MAAMC,iCAAiCC;IAI5C,YAAYC,UAAkB,EAAEC,OAAgB,CAAE;QAChD,KAAK,CAAC,sBAAsBA,QAAAA,UAAAA,UAAW,CAAC,KAAK,EAAED,WAAW,oDAAoD,CAAC,GAHjH,uBAAS,cAAT;QAIE,IAAI,CAAC,IAAI,GAAG;QACZ,IAAI,CAAC,UAAU,GAAGA;IACpB;AACF;AAGO,SAASE,cAAcC,QAAiC,EAAEC,IAAsB;IACrF,OAAOD,AAAkB,QAAlBA,QAAQ,CAACC,KAAK;AACvB;AAGO,SAASC,kBACdF,QAAiC,EACjCC,IAAO;IAEP,MAAME,UAAUH,QAAQ,CAACC,KAAK;IAC9B,IAAIE,AAAW,QAAXA,SAAiB,MAAM,IAAIR,yBAAyBM;IACxD,OAAOE;AACT;AAMO,SAASC,2BAA2BJ,QAAiC;IAC1E,KAAK,MAAMC,QAAQR,uBAAwBS,kBAAkBF,UAAUC;AACzE"}
1
+ {"version":3,"file":"services/contracts.js","sources":["../../src/services/contracts.ts"],"sourcesContent":["// Platform capability contracts (plan/specs/01-Architecture.md §8). Foundation defines the shapes only; the app\n// supplies implementations through the WP02 provider (`<G9Provider services={…}>`), platform adapters live in the\n// native and Lynxtron packages (WP12–WP14), and the features that use them (fields' dictation WP03, barcode WP09,\n// IntroCarousel WP09) own the behaviour. Nothing here requests a permission or touches a native module.\nimport { G9Error } from '../errors';\nimport type { G9RouteSink } from '../route/sink';\nimport type { G9AbortSignal } from './abort';\nimport type { G9Clock } from './clock';\nimport type { G9Haptics, G9Sounds } from './feedback';\nimport type { G9PreferenceStore } from './preferences';\n\n/** Result of asking for a runtime permission. `'restricted'`: blocked by policy, the user cannot grant it. */\nexport type G9PermissionStatus = 'granted' | 'denied' | 'restricted';\n\n/** Options of one dictation session. */\nexport interface G9SpeechToTextOptions {\n /** BCP 47 locale the recogniser listens for (from the culture, e.g. `'fa-IR'`). */\n readonly locale: string;\n /** Aborting stops listening; the session then settles with `{ status: 'cancelled' }`. */\n readonly signal?: G9AbortSignal;\n /** Interim hypotheses while the user speaks, when the platform reports them. */\n readonly onPartialResult?: (text: string) => void;\n}\n\n/** How a dictation session ended. Expected outcomes are results, not errors (specs/03 §7). */\nexport type G9SpeechToTextResult =\n | { readonly status: 'recognized'; readonly text: string }\n | { readonly status: 'cancelled' }\n | { readonly status: 'no-match' }\n | { readonly status: 'denied' };\n\n/**\n * Speech recognition for dictation into fields (MAUI `IG9SpeechToText`). Optional: without it the microphone\n * affordance is hidden. A platform fault rejects with a `G9Error`.\n */\nexport interface G9SpeechToText {\n /** Whether a recogniser exists for this locale on this device (no permission prompt). */\n isAvailable(locale: string): Promise<boolean>;\n /** Asks for microphone and speech permission (only ever from a user action). */\n requestPermission(): Promise<G9PermissionStatus>;\n /** Listens once and settles exactly once. */\n listen(options: G9SpeechToTextOptions): Promise<G9SpeechToTextResult>;\n}\n\n/** Options of one scan. */\nexport interface G9ScanOptions {\n /** Symbologies to accept (e.g. `'qr'`, `'ean13'`, `'code128'`); empty or absent means every one the scanner has. */\n readonly formats?: ReadonlyArray<string>;\n /** Aborting closes the scanner; the scan then settles with `{ status: 'cancelled' }`. */\n readonly signal?: G9AbortSignal;\n}\n\n/** How a scan ended. */\nexport type G9ScanResult =\n | { readonly status: 'scanned'; readonly text: string; readonly format: string }\n | { readonly status: 'cancelled' }\n | { readonly status: 'denied' };\n\n/** Barcode/QR scanning supplied by the app (WP09 barcode package). Optional: without it the scan action is hidden. */\nexport interface G9Scanner {\n /** Whether a camera scanner is usable on this device (no permission prompt). */\n isAvailable(): Promise<boolean>;\n /** Opens the scanner and settles exactly once. */\n scan(options?: G9ScanOptions): Promise<G9ScanResult>;\n}\n\n/** A media reference as the app describes it (an asset name, a file or a remote URI). */\nexport type G9MediaSource =\n | { readonly kind: 'image'; readonly uri: string }\n | { readonly kind: 'image'; readonly asset: string }\n | { readonly kind: 'video'; readonly uri: string }\n | { readonly kind: 'video'; readonly asset: string };\n\n/** A source resolved to something the platform can display; `uri` is what `<image>`/the video XElement load. */\nexport interface G9ResolvedMedia {\n readonly kind: 'image' | 'video';\n readonly uri: string;\n /** Intrinsic size when known, so layout can reserve space before the first frame. */\n readonly width?: number;\n readonly height?: number;\n}\n\n/** What a {@link G9MediaPlayer} tells its owner. */\nexport type G9MediaPlayerEvent =\n /** The first frame is ready to show. */\n | { readonly type: 'ready' }\n /** A looping video is about to end (`seconds` left); the owner may fade out. */\n | { readonly type: 'nearEnd'; readonly seconds: number }\n /** A looping video restarted from the beginning; the owner may fade back in. */\n | { readonly type: 'looped' }\n /** Playback failed; the owner falls back to the slide image. */\n | { readonly type: 'error'; readonly error: unknown };\n\n/** Options of {@link G9MediaProvider.createPlayer}. */\nexport interface G9MediaPlayerOptions {\n readonly loop?: boolean;\n readonly muted?: boolean;\n /** Best-effort seek applied once after the media opened (MAUI `InitialVideoStartSeconds`). */\n readonly startSeconds?: number;\n /** How early `nearEnd` fires, in seconds. */\n readonly nearEndSeconds?: number;\n}\n\n/**\n * One video player created by the app's media provider. `view` is what the control renders (the platform video\n * XElement the host registered, built by the app); the control never names a video tag itself.\n */\nexport interface G9MediaPlayer {\n /** The element to render (a ReactNode built by the app's provider; foundation keeps it opaque). */\n readonly view: unknown;\n play(): void;\n pause(): void;\n /** Releases the native player; idempotent. */\n dispose(): void;\n /** Subscribes to player events; returns the unsubscribe function. */\n subscribe(listener: (event: G9MediaPlayerEvent) => void): () => void;\n}\n\n/**\n * Resolves image and video sources for IntroCarousel and other media controls (WP09). Video is part of the contract on\n * every target, desktop included (decision D14 is open; no scope reduction is accepted). A provider that cannot play\n * video yet omits `createPlayer` or returns `false` from `supportsVideo`; controls then show the slide image and say\n * why (`'video-unsupported'`).\n */\nexport interface G9MediaProvider {\n resolve(source: G9MediaSource, options?: { readonly signal?: G9AbortSignal }): Promise<G9ResolvedMedia>;\n /** Whether this target can play video now (no permission prompt). Absent = `createPlayer` decides. */\n supportsVideo?(): boolean;\n /** Creates a player for a resolved video. The control disposes it on slide change, deactivation and unmount. */\n createPlayer?(media: G9ResolvedMedia, options?: G9MediaPlayerOptions): G9MediaPlayer;\n}\n\n/** A file the host picked or received (a handle: read and release it through the host's own files API). */\nexport interface G9FileRef {\n readonly id: string;\n readonly name?: string;\n readonly mime?: string;\n readonly size?: number;\n}\n\n/**\n * The system file chooser and camera (G9Hub `platform().files`). Optional: without it `G9DropZone` shows its area\n * disabled. A host that can drop files on the window emits `g9:drag` `{ active }` and `g9:drop` `{ files }`.\n */\nexport interface G9FilePicker {\n /** Opens the chooser filtered by category; resolves `[]` when cancelled. */\n pick(options: {\n readonly accept: 'image' | 'video' | 'media' | 'audio' | 'any';\n readonly multiple: boolean;\n }): Promise<readonly G9FileRef[]>;\n /** One photo from the camera, or `null` when cancelled. */\n camera?(options: { readonly mode: 'photo'; readonly facing?: 'user' | 'environment' }): Promise<G9FileRef | null>;\n /** Gives a file the app will not use back to the host. */\n release?(id: string): void;\n}\n\n/** Safe-area insets in logical pixels. */\nexport interface G9SafeInsets {\n readonly top: number;\n readonly end: number;\n readonly bottom: number;\n readonly start: number;\n}\n\n/** Android soft-input policy while a flow needs it (MAUI `G9KeyboardHelper.UseAndroidPanSoftInputMode`). */\nexport type G9SoftInputMode = 'pan' | 'resize';\n\n/**\n * Host integration the provider and overlays need (MAUI page/window plumbing), supplied by the native host. Required.\n * The system back press does not go through this object: the host sends a global event (default `g9:back`, specs/02\n * §4) and the provider dispatches it to the active `G9Host`; `exit` is what happens when nothing handled it.\n */\nexport interface G9HostServices {\n /** Leaves the app the platform way (Android moves the task to the back; desktop closes the window). */\n exit(): void;\n /** Hides the soft keyboard and clears focus (MAUI `G9KeyboardHelper.HideKeyboardAndClearFocus`). */\n hideKeyboard(): void;\n /** Current safe-area insets. */\n getSafeInsets(): G9SafeInsets;\n /** Called when the insets change (rotation, window resize). Returns an unsubscribe function. */\n subscribeSafeInsets(listener: (insets: G9SafeInsets) => void): () => void;\n /**\n * Switches the window's soft-input mode (Android only; `'resize'` is the app default). Hosts on platforms without\n * soft-input modes (iOS, desktop) omit it, which is where MAUI's helper was a no-op too.\n */\n setSoftInputMode?(mode: G9SoftInputMode): void;\n}\n\n/** Every service the app can supply. Required ones are listed in {@link g9RequiredCapabilities}. */\nexport interface G9Capabilities {\n readonly clock: G9Clock;\n readonly preferences: G9PreferenceStore;\n readonly host: G9HostServices;\n readonly speech?: G9SpeechToText;\n readonly scanner?: G9Scanner;\n readonly media?: G9MediaProvider;\n /**\n * The router places declare themselves to (`@g9tm/lynxcontrols/route` makes one). Optional: without it sheets, tab views\n * and hosts work as before and a `route` option only reports a one-time diagnostics warning.\n */\n readonly route?: G9RouteSink;\n /** Haptic feedback (optional: without it controls stay silent). */\n readonly haptics?: G9Haptics;\n /** Sound feedback (optional). */\n readonly sounds?: G9Sounds;\n /** The file chooser and camera (optional: `G9DropZone`). */\n readonly files?: G9FilePicker;\n}\n\n/** The name of a capability. */\nexport type G9CapabilityName = keyof G9Capabilities;\n\n/** Capabilities without which the provider cannot mount. */\nexport const g9RequiredCapabilities: ReadonlyArray<G9CapabilityName> = Object.freeze(['clock', 'preferences', 'host']);\n\n/** Thrown when code needs a capability the app did not supply (specs/03 §7: `G9CapabilityMissingError('speech')`). */\nexport class G9CapabilityMissingError extends G9Error {\n /** The missing capability. */\n readonly capability: string;\n\n constructor(capability: string, message?: string) {\n super('capability-missing', message ?? `The '${capability}' service is not available; supply it to G9Provider.`);\n this.name = 'G9CapabilityMissingError';\n this.capability = capability;\n }\n}\n\n/** `true` when the capability is present (optional features use this to hide themselves). */\nexport function hasCapability(services: Partial<G9Capabilities>, name: G9CapabilityName): boolean {\n return services[name] != null;\n}\n\n/** The capability, or throws {@link G9CapabilityMissingError} naming it. */\nexport function requireCapability<K extends G9CapabilityName>(\n services: Partial<G9Capabilities>,\n name: K,\n): NonNullable<G9Capabilities[K]> {\n const service = services[name];\n if (service == null) throw new G9CapabilityMissingError(name);\n return service as NonNullable<G9Capabilities[K]>;\n}\n\n/**\n * Checks every required capability at once (the provider calls this at mount).\n * @throws {G9CapabilityMissingError} for the first missing one, in {@link g9RequiredCapabilities} order.\n */\nexport function assertRequiredCapabilities(services: Partial<G9Capabilities>): asserts services is G9Capabilities {\n for (const name of g9RequiredCapabilities) requireCapability(services, name);\n}\n"],"names":["g9RequiredCapabilities","Object","G9CapabilityMissingError","G9Error","capability","message","hasCapability","services","name","requireCapability","service","assertRequiredCapabilities"],"mappings":";;;;;;;;;;;AAqNO,MAAMA,yBAA0DC,OAAO,MAAM,CAAC;IAAC;IAAS;IAAe;CAAO;AAG9G,MAAMC,iCAAiCC;IAI5C,YAAYC,UAAkB,EAAEC,OAAgB,CAAE;QAChD,KAAK,CAAC,sBAAsBA,QAAAA,UAAAA,UAAW,CAAC,KAAK,EAAED,WAAW,oDAAoD,CAAC,GAHjH,uBAAS,cAAT;QAIE,IAAI,CAAC,IAAI,GAAG;QACZ,IAAI,CAAC,UAAU,GAAGA;IACpB;AACF;AAGO,SAASE,cAAcC,QAAiC,EAAEC,IAAsB;IACrF,OAAOD,AAAkB,QAAlBA,QAAQ,CAACC,KAAK;AACvB;AAGO,SAASC,kBACdF,QAAiC,EACjCC,IAAO;IAEP,MAAME,UAAUH,QAAQ,CAACC,KAAK;IAC9B,IAAIE,AAAW,QAAXA,SAAiB,MAAM,IAAIR,yBAAyBM;IACxD,OAAOE;AACT;AAMO,SAASC,2BAA2BJ,QAAiC;IAC1E,KAAK,MAAMC,QAAQR,uBAAwBS,kBAAkBF,UAAUC;AACzE"}
@@ -0,0 +1,28 @@
1
+ /** What a haptic means; the host chooses the pattern. */
2
+ export type G9HapticKind = 'tap' | 'tick' | 'select' | 'toggle' | 'success' | 'warning' | 'error' | 'impact' | 'drag';
3
+ /** What a sound means. */
4
+ export type G9SoundKind = 'tap' | 'select' | 'success' | 'warning' | 'error' | 'notify' | 'open' | 'close';
5
+ /** Haptic feedback the host plays (optional capability `haptics`); without it controls stay silent. */
6
+ export interface G9Haptics {
7
+ /** Plays the pattern for `kind` now; never throws, never waits. */
8
+ play(kind: G9HapticKind): void;
9
+ }
10
+ /** Sound feedback the host plays (optional capability `sounds`): a tick, a success, an error. */
11
+ export interface G9Sounds {
12
+ play(kind: G9SoundKind): void;
13
+ }
14
+ /** Installs (or removes, with null) the host's feedback; the provider does this from its `services`. */
15
+ export declare function setG9Feedback(next: {
16
+ readonly haptics?: G9Haptics | null;
17
+ readonly sounds?: G9Sounds | null;
18
+ }): void;
19
+ /** The user's settings (an app's "vibration" and "sounds" switches). */
20
+ export declare function setG9FeedbackEnabled(next: {
21
+ readonly haptics?: boolean;
22
+ readonly sounds?: boolean;
23
+ }): void;
24
+ /** A haptic for `kind`, if the host has haptics and the user allows them. */
25
+ export declare function g9Haptic(kind: G9HapticKind): void;
26
+ /** A sound for `kind`, if the host has sounds and the user allows them. */
27
+ export declare function g9Sound(kind: G9SoundKind): void;
28
+ //# sourceMappingURL=feedback.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"feedback.d.ts","sourceRoot":"","sources":["../../src/services/feedback.ts"],"names":[],"mappings":"AAKA,yDAAyD;AACzD,MAAM,MAAM,YAAY,GAAG,KAAK,GAAG,MAAM,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAC;AAEtH,0BAA0B;AAC1B,MAAM,MAAM,WAAW,GAAG,KAAK,GAAG,QAAQ,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAC;AAE3G,uGAAuG;AACvG,MAAM,WAAW,SAAS;IACxB,mEAAmE;IACnE,IAAI,CAAC,IAAI,EAAE,YAAY,GAAG,IAAI,CAAC;CAChC;AAED,iGAAiG;AACjG,MAAM,WAAW,QAAQ;IACvB,IAAI,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,CAAC;CAC/B;AAOD,wGAAwG;AACxG,wBAAgB,aAAa,CAAC,IAAI,EAAE;IAAE,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,GAAG,IAAI,CAAC;IAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,QAAQ,GAAG,IAAI,CAAA;CAAE,GAAG,IAAI,CAGpH;AAED,wEAAwE;AACxE,wBAAgB,oBAAoB,CAAC,IAAI,EAAE;IAAE,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,IAAI,CAG1G;AAED,6EAA6E;AAC7E,wBAAgB,QAAQ,CAAC,IAAI,EAAE,YAAY,GAAG,IAAI,CAOjD;AAED,2EAA2E;AAC3E,wBAAgB,OAAO,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,CAO/C"}
@@ -0,0 +1,27 @@
1
+ let haptics = null;
2
+ let sounds = null;
3
+ let hapticsOn = true;
4
+ let soundsOn = true;
5
+ function setG9Feedback(next) {
6
+ if (void 0 !== next.haptics) haptics = next.haptics;
7
+ if (void 0 !== next.sounds) sounds = next.sounds;
8
+ }
9
+ function setG9FeedbackEnabled(next) {
10
+ if (void 0 !== next.haptics) hapticsOn = next.haptics;
11
+ if (void 0 !== next.sounds) soundsOn = next.sounds;
12
+ }
13
+ function g9Haptic(kind) {
14
+ if (!hapticsOn || !haptics) return;
15
+ try {
16
+ haptics.play(kind);
17
+ } catch {}
18
+ }
19
+ function g9Sound(kind) {
20
+ if (!soundsOn || !sounds) return;
21
+ try {
22
+ sounds.play(kind);
23
+ } catch {}
24
+ }
25
+ export { g9Haptic, g9Sound, setG9Feedback, setG9FeedbackEnabled };
26
+
27
+ //# sourceMappingURL=feedback.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"services/feedback.js","sources":["../../src/services/feedback.ts"],"sourcesContent":["// Haptic and sound feedback as optional capabilities (SAC `host.haptic('tap'|'tick')`, Riskara HAPTICS/SOUNDS,\n// ShopManager web-host haptics). Controls ask for a *meaning* (`'tap'`, `'select'`, `'success'`); the host maps it to\n// its platform's pattern (Android VibrationEffect, iOS UIFeedbackGenerator, the web's navigator.vibrate) or ignores it.\n// A missing capability is silence, never an error, and nothing is awaited: feedback must not delay the UI.\n\n/** What a haptic means; the host chooses the pattern. */\nexport type G9HapticKind = 'tap' | 'tick' | 'select' | 'toggle' | 'success' | 'warning' | 'error' | 'impact' | 'drag';\n\n/** What a sound means. */\nexport type G9SoundKind = 'tap' | 'select' | 'success' | 'warning' | 'error' | 'notify' | 'open' | 'close';\n\n/** Haptic feedback the host plays (optional capability `haptics`); without it controls stay silent. */\nexport interface G9Haptics {\n /** Plays the pattern for `kind` now; never throws, never waits. */\n play(kind: G9HapticKind): void;\n}\n\n/** Sound feedback the host plays (optional capability `sounds`): a tick, a success, an error. */\nexport interface G9Sounds {\n play(kind: G9SoundKind): void;\n}\n\nlet haptics: G9Haptics | null = null;\nlet sounds: G9Sounds | null = null;\nlet hapticsOn = true;\nlet soundsOn = true;\n\n/** Installs (or removes, with null) the host's feedback; the provider does this from its `services`. */\nexport function setG9Feedback(next: { readonly haptics?: G9Haptics | null; readonly sounds?: G9Sounds | null }): void {\n if (next.haptics !== undefined) haptics = next.haptics;\n if (next.sounds !== undefined) sounds = next.sounds;\n}\n\n/** The user's settings (an app's \"vibration\" and \"sounds\" switches). */\nexport function setG9FeedbackEnabled(next: { readonly haptics?: boolean; readonly sounds?: boolean }): void {\n if (next.haptics !== undefined) hapticsOn = next.haptics;\n if (next.sounds !== undefined) soundsOn = next.sounds;\n}\n\n/** A haptic for `kind`, if the host has haptics and the user allows them. */\nexport function g9Haptic(kind: G9HapticKind): void {\n if (!hapticsOn || !haptics) return;\n try {\n haptics.play(kind);\n } catch {\n // feedback never breaks an action\n }\n}\n\n/** A sound for `kind`, if the host has sounds and the user allows them. */\nexport function g9Sound(kind: G9SoundKind): void {\n if (!soundsOn || !sounds) return;\n try {\n sounds.play(kind);\n } catch {\n // feedback never breaks an action\n }\n}\n"],"names":["haptics","sounds","hapticsOn","soundsOn","setG9Feedback","next","undefined","setG9FeedbackEnabled","g9Haptic","kind","g9Sound"],"mappings":"AAsBA,IAAIA,UAA4B;AAChC,IAAIC,SAA0B;AAC9B,IAAIC,YAAY;AAChB,IAAIC,WAAW;AAGR,SAASC,cAAcC,IAAgF;IAC5G,IAAIA,AAAiBC,WAAjBD,KAAK,OAAO,EAAgBL,UAAUK,KAAK,OAAO;IACtD,IAAIA,AAAgBC,WAAhBD,KAAK,MAAM,EAAgBJ,SAASI,KAAK,MAAM;AACrD;AAGO,SAASE,qBAAqBF,IAA+D;IAClG,IAAIA,AAAiBC,WAAjBD,KAAK,OAAO,EAAgBH,YAAYG,KAAK,OAAO;IACxD,IAAIA,AAAgBC,WAAhBD,KAAK,MAAM,EAAgBF,WAAWE,KAAK,MAAM;AACvD;AAGO,SAASG,SAASC,IAAkB;IACzC,IAAI,CAACP,aAAa,CAACF,SAAS;IAC5B,IAAI;QACFA,QAAQ,IAAI,CAACS;IACf,EAAE,OAAM,CAER;AACF;AAGO,SAASC,QAAQD,IAAiB;IACvC,IAAI,CAACN,YAAY,CAACF,QAAQ;IAC1B,IAAI;QACFA,OAAO,IAAI,CAACQ;IACd,EAAE,OAAM,CAER;AACF"}
@@ -1,6 +1,8 @@
1
1
  export { createAbortController, createAbortError, createPortableAbortController, type G9AbortController, type G9AbortSignal, isAbortError, } from './abort.js';
2
2
  export { createManualClock, createMonotonicFromWall, createSystemClock, type G9Clock, type G9ManualClock, } from './clock.js';
3
- export { assertRequiredCapabilities, type G9Capabilities, G9CapabilityMissingError, type G9CapabilityName, type G9HostServices, type G9MediaPlayer, type G9MediaPlayerEvent, type G9MediaPlayerOptions, type G9MediaProvider, type G9MediaSource, type G9PermissionStatus, type G9ResolvedMedia, type G9SafeInsets, type G9Scanner, type G9ScanOptions, type G9ScanResult, type G9SoftInputMode, type G9SpeechToText, type G9SpeechToTextOptions, type G9SpeechToTextResult, g9RequiredCapabilities, hasCapability, requireCapability, } from './contracts.js';
3
+ export { assertRequiredCapabilities, type G9Capabilities, G9CapabilityMissingError, type G9CapabilityName, type G9FilePicker, type G9FileRef, type G9HostServices, type G9MediaPlayer, type G9MediaPlayerEvent, type G9MediaPlayerOptions, type G9MediaProvider, type G9MediaSource, type G9PermissionStatus, type G9ResolvedMedia, type G9SafeInsets, type G9Scanner, type G9ScanOptions, type G9ScanResult, type G9SoftInputMode, type G9SpeechToText, type G9SpeechToTextOptions, type G9SpeechToTextResult, g9RequiredCapabilities, hasCapability, requireCapability, } from './contracts.js';
4
+ export { type G9HapticKind, type G9Haptics, type G9SoundKind, type G9Sounds, g9Haptic, g9Sound, setG9Feedback, setG9FeedbackEnabled, } from './feedback.js';
5
+ export { comboLabel, createSequenceMatcher, type G9KeyCombo, type G9KeyEvent, g9FieldKeyEventName, g9KeyEventName, matchesCombo, parseCombo, } from './keys.js';
4
6
  export { g9MotionScale, g9Ms, setG9MotionScale, subscribeG9Motion } from './motion.js';
5
7
  export { createMemoryPreferenceStore, createPreferences, type G9MaybePromise, type G9PreferenceKey, type G9PreferenceStore, type G9PreferenceStoreFailure, type G9Preferences, type G9PreferencesOptions, type G9PreferencesSnapshot, type G9PreferenceValue, g9PreferenceKeyPrefix, } from './preferences.js';
6
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,gBAAgB,EAChB,6BAA6B,EAC7B,KAAK,iBAAiB,EACtB,KAAK,aAAa,EAClB,YAAY,GACb,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,iBAAiB,EACjB,uBAAuB,EACvB,iBAAiB,EACjB,KAAK,OAAO,EACZ,KAAK,aAAa,GACnB,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,0BAA0B,EAC1B,KAAK,cAAc,EACnB,wBAAwB,EACxB,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EACzB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,kBAAkB,EACvB,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,KAAK,SAAS,EACd,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,EACzB,sBAAsB,EACtB,aAAa,EACb,iBAAiB,GAClB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AACpF,OAAO,EACL,2BAA2B,EAC3B,iBAAiB,EACjB,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACtB,KAAK,wBAAwB,EAC7B,KAAK,aAAa,EAClB,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAC1B,KAAK,iBAAiB,EACtB,qBAAqB,GACtB,MAAM,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,gBAAgB,EAChB,6BAA6B,EAC7B,KAAK,iBAAiB,EACtB,KAAK,aAAa,EAClB,YAAY,GACb,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,iBAAiB,EACjB,uBAAuB,EACvB,iBAAiB,EACjB,KAAK,OAAO,EACZ,KAAK,aAAa,GACnB,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,0BAA0B,EAC1B,KAAK,cAAc,EACnB,wBAAwB,EACxB,KAAK,gBAAgB,EACrB,KAAK,YAAY,EACjB,KAAK,SAAS,EACd,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EACzB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,kBAAkB,EACvB,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,KAAK,SAAS,EACd,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,EACzB,sBAAsB,EACtB,aAAa,EACb,iBAAiB,GAClB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,SAAS,EACd,KAAK,WAAW,EAChB,KAAK,QAAQ,EACb,QAAQ,EACR,OAAO,EACP,aAAa,EACb,oBAAoB,GACrB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,UAAU,EACV,qBAAqB,EACrB,KAAK,UAAU,EACf,KAAK,UAAU,EACf,mBAAmB,EACnB,cAAc,EACd,YAAY,EACZ,UAAU,GACX,MAAM,QAAQ,CAAC;AAChB,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AACpF,OAAO,EACL,2BAA2B,EAC3B,iBAAiB,EACjB,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACtB,KAAK,wBAAwB,EAC7B,KAAK,aAAa,EAClB,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAC1B,KAAK,iBAAiB,EACtB,qBAAqB,GACtB,MAAM,eAAe,CAAC"}
@@ -1,5 +1,7 @@
1
1
  export { createAbortController, createAbortError, createPortableAbortController, isAbortError } from "./abort.js";
2
2
  export { createManualClock, createMonotonicFromWall, createSystemClock } from "./clock.js";
3
3
  export { G9CapabilityMissingError, assertRequiredCapabilities, g9RequiredCapabilities, hasCapability, requireCapability } from "./contracts.js";
4
+ export { g9Haptic, g9Sound, setG9Feedback, setG9FeedbackEnabled } from "./feedback.js";
5
+ export { comboLabel, createSequenceMatcher, g9FieldKeyEventName, g9KeyEventName, matchesCombo, parseCombo } from "./keys.js";
4
6
  export { g9MotionScale, g9Ms, setG9MotionScale, subscribeG9Motion } from "./motion.js";
5
7
  export { createMemoryPreferenceStore, createPreferences, g9PreferenceKeyPrefix } from "./preferences.js";
@@ -0,0 +1,39 @@
1
+ /** Global event a host sends for a key pressed outside a text field. */
2
+ export declare const g9KeyEventName = "g9key";
3
+ /** Global event for a key pressed inside a text field (hosts forward only Escape and modified keys). */
4
+ export declare const g9FieldKeyEventName = "g9fieldkey";
5
+ /** A key as hosts send it: `key` is a DOM key name (`'ArrowLeft'`, `'Escape'`, `'k'`). */
6
+ export interface G9KeyEvent {
7
+ readonly key: string;
8
+ readonly ctrl?: boolean;
9
+ readonly shift?: boolean;
10
+ readonly alt?: boolean;
11
+ /** Cmd on macOS. */
12
+ readonly meta?: boolean;
13
+ readonly repeat?: boolean;
14
+ /** Came from inside a text field (`g9fieldkey`). */
15
+ readonly field?: boolean;
16
+ }
17
+ /** A parsed combo: `'Mod+Shift+K'` (Mod = Ctrl, or Cmd on macOS). */
18
+ export interface G9KeyCombo {
19
+ readonly key: string;
20
+ readonly mod: boolean;
21
+ readonly ctrl: boolean;
22
+ readonly shift: boolean;
23
+ readonly alt: boolean;
24
+ }
25
+ /** Parses `'Mod+K'`, `'ctrl+shift+p'`, `'Escape'`, `'?'`. Case-insensitive; the last part is the key. */
26
+ export declare function parseCombo(combo: string): G9KeyCombo;
27
+ /** True when `event` is `combo` (`platform: 'mac'` maps Mod to Meta). */
28
+ export declare function matchesCombo(event: G9KeyEvent, combo: string | G9KeyCombo, platform?: 'mac' | 'other'): boolean;
29
+ /** How a combo reads on a key cap (`'Mod+K'` → `'Ctrl K'` / `'⌘ K'`). */
30
+ export declare function comboLabel(combo: string, platform?: 'mac' | 'other'): string;
31
+ /**
32
+ * Key sequences (`'g i'`: g then i within `timeoutMs`, G9Hub's "go to" shortcuts). Feed every key; it answers the
33
+ * sequence completed by this key, or null.
34
+ */
35
+ export declare function createSequenceMatcher(sequences: readonly string[], timeoutMs?: number, now?: () => number): {
36
+ feed(event: G9KeyEvent): string | null;
37
+ reset(): void;
38
+ };
39
+ //# sourceMappingURL=keys.d.ts.map
@@ -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AAgB,qBAAqB,CAAC,SAAS,EAAE,SAAS,MAAM,EAAE,EAAE,SAAS,SAAO,EAAE,GAAG,GAAE,MAAM,MAAiB;gBAKlG,UAAU,GAAG,MAAM,GAAG,IAAI;;EAuBzC"}
@@ -0,0 +1,96 @@
1
+ const g9KeyEventName = 'g9key';
2
+ const g9FieldKeyEventName = 'g9fieldkey';
3
+ const ALIASES = {
4
+ esc: 'escape',
5
+ return: 'enter',
6
+ del: 'delete',
7
+ space: ' ',
8
+ up: 'arrowup',
9
+ down: 'arrowdown',
10
+ left: 'arrowleft',
11
+ right: 'arrowright',
12
+ plus: '+'
13
+ };
14
+ function parseCombo(combo) {
15
+ var _parts_pop, _ALIASES_key;
16
+ const parts = combo.split('+').map((p)=>p.trim().toLowerCase());
17
+ if (combo.endsWith('++')) parts.splice(parts.length - 2, 2, '+');
18
+ const key = null != (_parts_pop = parts.pop()) ? _parts_pop : '';
19
+ return {
20
+ key: null != (_ALIASES_key = ALIASES[key]) ? _ALIASES_key : key,
21
+ mod: parts.includes('mod'),
22
+ ctrl: parts.includes('ctrl'),
23
+ shift: parts.includes('shift'),
24
+ alt: parts.includes('alt') || parts.includes('option')
25
+ };
26
+ }
27
+ function matchesCombo(event, combo, platform = 'other') {
28
+ const c = 'string' == typeof combo ? parseCombo(combo) : combo;
29
+ const key = event.key.toLowerCase();
30
+ if (key !== c.key && !(1 === c.key.length && key === c.key)) return false;
31
+ const modDown = 'mac' === platform ? Boolean(event.meta) : Boolean(event.ctrl);
32
+ if (c.mod !== modDown && !(c.ctrl && !c.mod)) return false;
33
+ if (c.ctrl && !event.ctrl) return false;
34
+ if (!c.mod && !c.ctrl && (event.ctrl || event.meta)) return false;
35
+ if (c.shift && !event.shift) return false;
36
+ if (c.alt !== Boolean(event.alt)) return false;
37
+ return true;
38
+ }
39
+ function comboLabel(combo, platform = 'other') {
40
+ var _named_c_key;
41
+ const c = parseCombo(combo);
42
+ const parts = [];
43
+ if (c.mod) parts.push('mac' === platform ? '⌘' : 'Ctrl');
44
+ if (c.ctrl) parts.push('mac' === platform ? '⌃' : 'Ctrl');
45
+ if (c.alt) parts.push('mac' === platform ? '⌥' : 'Alt');
46
+ if (c.shift) parts.push('mac' === platform ? '⇧' : 'Shift');
47
+ const named = {
48
+ escape: 'Esc',
49
+ enter: '↵',
50
+ arrowup: '↑',
51
+ arrowdown: '↓',
52
+ arrowleft: '←',
53
+ arrowright: '→',
54
+ ' ': 'Space',
55
+ delete: 'Del',
56
+ backspace: '⌫',
57
+ tab: 'Tab'
58
+ };
59
+ parts.push(null != (_named_c_key = named[c.key]) ? _named_c_key : 1 === c.key.length ? c.key.toUpperCase() : c.key);
60
+ return parts.join(' ');
61
+ }
62
+ function createSequenceMatcher(sequences, timeoutMs = 1200, now = Date.now) {
63
+ const parsed = sequences.map((s)=>({
64
+ source: s,
65
+ keys: s.trim().toLowerCase().split(/\s+/)
66
+ }));
67
+ let buffer = [];
68
+ let last = 0;
69
+ return {
70
+ feed (event) {
71
+ if (event.ctrl || event.meta || event.alt || event.field) {
72
+ buffer = [];
73
+ return null;
74
+ }
75
+ const t = now();
76
+ if (t - last > timeoutMs) buffer = [];
77
+ last = t;
78
+ buffer.push(event.key.toLowerCase());
79
+ if (buffer.length > 4) buffer = buffer.slice(-4);
80
+ for (const seq of parsed){
81
+ const tail = buffer.slice(-seq.keys.length);
82
+ if (tail.length === seq.keys.length && tail.every((k, i)=>k === seq.keys[i])) {
83
+ buffer = [];
84
+ return seq.source;
85
+ }
86
+ }
87
+ return null;
88
+ },
89
+ reset () {
90
+ buffer = [];
91
+ }
92
+ };
93
+ }
94
+ export { comboLabel, createSequenceMatcher, g9FieldKeyEventName, g9KeyEventName, matchesCombo, parseCombo };
95
+
96
+ //# sourceMappingURL=keys.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"services/keys.js","sources":["../../src/services/keys.ts"],"sourcesContent":["// Keyboard shortcuts on hosts with a keyboard (Lynx for Web, Lynxtron, a tablet with a keyboard). Lynx has no keydown\n// event on the page, so the host forwards keys as global events (SAC: `g9key` / `g9fieldkey` from the web host; G9Hub:\n// hotkey.ts): `g9key` for keys outside text fields, `g9fieldkey` for the few that matter inside one (Escape, Mod+K,\n// Mod+Enter). This module is the platform-free part: the event names, the key shape, combo parsing and matching, and\n// key sequences (`g` then `i`). The hook that listens lives in `@g9tm/lynxcontrols/commands`.\n\n/** Global event a host sends for a key pressed outside a text field. */\nexport const g9KeyEventName = 'g9key';\n/** Global event for a key pressed inside a text field (hosts forward only Escape and modified keys). */\nexport const g9FieldKeyEventName = 'g9fieldkey';\n\n/** A key as hosts send it: `key` is a DOM key name (`'ArrowLeft'`, `'Escape'`, `'k'`). */\nexport interface G9KeyEvent {\n readonly key: string;\n readonly ctrl?: boolean;\n readonly shift?: boolean;\n readonly alt?: boolean;\n /** Cmd on macOS. */\n readonly meta?: boolean;\n readonly repeat?: boolean;\n /** Came from inside a text field (`g9fieldkey`). */\n readonly field?: boolean;\n}\n\n/** A parsed combo: `'Mod+Shift+K'` (Mod = Ctrl, or Cmd on macOS). */\nexport interface G9KeyCombo {\n readonly key: string;\n readonly mod: boolean;\n readonly ctrl: boolean;\n readonly shift: boolean;\n readonly alt: boolean;\n}\n\nconst ALIASES: Readonly<Record<string, string>> = {\n esc: 'escape',\n return: 'enter',\n del: 'delete',\n space: ' ',\n up: 'arrowup',\n down: 'arrowdown',\n left: 'arrowleft',\n right: 'arrowright',\n plus: '+',\n};\n\n/** Parses `'Mod+K'`, `'ctrl+shift+p'`, `'Escape'`, `'?'`. Case-insensitive; the last part is the key. */\nexport function parseCombo(combo: string): G9KeyCombo {\n const parts = combo.split('+').map((p) => p.trim().toLowerCase());\n // \"Mod++\" means the plus key\n if (combo.endsWith('++')) parts.splice(parts.length - 2, 2, '+');\n const key = parts.pop() ?? '';\n return {\n key: ALIASES[key] ?? key,\n mod: parts.includes('mod'),\n ctrl: parts.includes('ctrl'),\n shift: parts.includes('shift'),\n alt: parts.includes('alt') || parts.includes('option'),\n };\n}\n\n/** True when `event` is `combo` (`platform: 'mac'` maps Mod to Meta). */\nexport function matchesCombo(\n event: G9KeyEvent,\n combo: string | G9KeyCombo,\n platform: 'mac' | 'other' = 'other',\n): boolean {\n const c = typeof combo === 'string' ? parseCombo(combo) : combo;\n const key = event.key.toLowerCase();\n if (key !== c.key && !(c.key.length === 1 && key === c.key)) return false;\n const modDown = platform === 'mac' ? Boolean(event.meta) : Boolean(event.ctrl);\n if (c.mod !== modDown && !(c.ctrl && !c.mod)) return false;\n if (c.ctrl && !event.ctrl) return false;\n if (!c.mod && !c.ctrl && (event.ctrl || event.meta)) return false;\n // shift is part of a printed character ('?' is Shift+/): only require it when the combo says so\n if (c.shift && !event.shift) return false;\n if (c.alt !== Boolean(event.alt)) return false;\n return true;\n}\n\n/** How a combo reads on a key cap (`'Mod+K'` → `'Ctrl K'` / `'⌘ K'`). */\nexport function comboLabel(combo: string, platform: 'mac' | 'other' = 'other'): string {\n const c = parseCombo(combo);\n const parts: string[] = [];\n if (c.mod) parts.push(platform === 'mac' ? '⌘' : 'Ctrl');\n if (c.ctrl) parts.push(platform === 'mac' ? '⌃' : 'Ctrl');\n if (c.alt) parts.push(platform === 'mac' ? '⌥' : 'Alt');\n if (c.shift) parts.push(platform === 'mac' ? '⇧' : 'Shift');\n const named: Record<string, string> = {\n escape: 'Esc',\n enter: '↵',\n arrowup: '↑',\n arrowdown: '↓',\n arrowleft: '←',\n arrowright: '→',\n ' ': 'Space',\n delete: 'Del',\n backspace: '⌫',\n tab: 'Tab',\n };\n parts.push(named[c.key] ?? (c.key.length === 1 ? c.key.toUpperCase() : c.key));\n return parts.join(' ');\n}\n\n/**\n * Key sequences (`'g i'`: g then i within `timeoutMs`, G9Hub's \"go to\" shortcuts). Feed every key; it answers the\n * sequence completed by this key, or null.\n */\nexport function createSequenceMatcher(sequences: readonly string[], timeoutMs = 1200, now: () => number = Date.now) {\n const parsed = sequences.map((s) => ({ source: s, keys: s.trim().toLowerCase().split(/\\s+/) }));\n let buffer: string[] = [];\n let last = 0;\n return {\n feed(event: G9KeyEvent): string | null {\n if (event.ctrl || event.meta || event.alt || event.field) {\n buffer = [];\n return null;\n }\n const t = now();\n if (t - last > timeoutMs) buffer = [];\n last = t;\n buffer.push(event.key.toLowerCase());\n if (buffer.length > 4) buffer = buffer.slice(-4);\n for (const seq of parsed) {\n const tail = buffer.slice(-seq.keys.length);\n if (tail.length === seq.keys.length && tail.every((k, i) => k === seq.keys[i])) {\n buffer = [];\n return seq.source;\n }\n }\n return null;\n },\n reset() {\n buffer = [];\n },\n };\n}\n"],"names":["g9KeyEventName","g9FieldKeyEventName","ALIASES","parseCombo","combo","_parts_pop","_ALIASES_key","parts","p","key","matchesCombo","event","platform","c","modDown","Boolean","comboLabel","_named_c_key","named","createSequenceMatcher","sequences","timeoutMs","now","Date","parsed","s","buffer","last","t","seq","tail","k","i"],"mappings":"AAOO,MAAMA,iBAAiB;AAEvB,MAAMC,sBAAsB;AAwBnC,MAAMC,UAA4C;IAChD,KAAK;IACL,QAAQ;IACR,KAAK;IACL,OAAO;IACP,IAAI;IACJ,MAAM;IACN,MAAM;IACN,OAAO;IACP,MAAM;AACR;AAGO,SAASC,WAAWC,KAAa;QAI1BC,YAELC;IALP,MAAMC,QAAQH,MAAM,KAAK,CAAC,KAAK,GAAG,CAAC,CAACI,IAAMA,EAAE,IAAI,GAAG,WAAW;IAE9D,IAAIJ,MAAM,QAAQ,CAAC,OAAOG,MAAM,MAAM,CAACA,MAAM,MAAM,GAAG,GAAG,GAAG;IAC5D,MAAME,MAAM,QAAAJ,CAAAA,aAAAA,MAAM,GAAG,EAAC,IAAVA,aAAe;IAC3B,OAAO;QACL,KAAK,QAAAC,CAAAA,eAAAA,OAAO,CAACG,IAAI,AAAD,IAAXH,eAAgBG;QACrB,KAAKF,MAAM,QAAQ,CAAC;QACpB,MAAMA,MAAM,QAAQ,CAAC;QACrB,OAAOA,MAAM,QAAQ,CAAC;QACtB,KAAKA,MAAM,QAAQ,CAAC,U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