@g9tm/lynxcontrols-foundation 0.0.0-stage → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (164) hide show
  1. package/README.md +4 -2
  2. package/dist/.tsbuildinfo +1 -0
  3. package/dist/collections.d.ts +16 -0
  4. package/dist/collections.d.ts.map +1 -0
  5. package/dist/collections.js +40 -0
  6. package/dist/collections.js.map +1 -0
  7. package/dist/culture/calendar.d.ts +122 -0
  8. package/dist/culture/calendar.d.ts.map +1 -0
  9. package/dist/culture/calendar.js +379 -0
  10. package/dist/culture/calendar.js.map +1 -0
  11. package/dist/culture/culture.d.ts +91 -0
  12. package/dist/culture/culture.d.ts.map +1 -0
  13. package/dist/culture/culture.js +173 -0
  14. package/dist/culture/culture.js.map +1 -0
  15. package/dist/culture/date-format.d.ts +19 -0
  16. package/dist/culture/date-format.d.ts.map +1 -0
  17. package/dist/culture/date-format.js +101 -0
  18. package/dist/culture/date-format.js.map +1 -0
  19. package/dist/culture/digits.d.ts +29 -0
  20. package/dist/culture/digits.d.ts.map +1 -0
  21. package/dist/culture/digits.js +43 -0
  22. package/dist/culture/digits.js.map +1 -0
  23. package/dist/culture/duration.d.ts +38 -0
  24. package/dist/culture/duration.d.ts.map +1 -0
  25. package/dist/culture/duration.js +41 -0
  26. package/dist/culture/duration.js.map +1 -0
  27. package/dist/culture/index.d.ts +9 -0
  28. package/dist/culture/index.d.ts.map +1 -0
  29. package/dist/culture/index.js +8 -0
  30. package/dist/culture/numbers.d.ts +38 -0
  31. package/dist/culture/numbers.d.ts.map +1 -0
  32. package/dist/culture/numbers.js +64 -0
  33. package/dist/culture/numbers.js.map +1 -0
  34. package/dist/culture/relative-time.d.ts +50 -0
  35. package/dist/culture/relative-time.d.ts.map +1 -0
  36. package/dist/culture/relative-time.js +63 -0
  37. package/dist/culture/relative-time.js.map +1 -0
  38. package/dist/culture/strings.d.ts +145 -0
  39. package/dist/culture/strings.d.ts.map +1 -0
  40. package/dist/culture/strings.js +345 -0
  41. package/dist/culture/strings.js.map +1 -0
  42. package/dist/enums/index.d.ts +195 -0
  43. package/dist/enums/index.d.ts.map +1 -0
  44. package/dist/enums/index.js +130 -0
  45. package/dist/enums/index.js.map +1 -0
  46. package/dist/errors.d.ts +10 -0
  47. package/dist/errors.d.ts.map +1 -0
  48. package/dist/errors.js +21 -0
  49. package/dist/errors.js.map +1 -0
  50. package/dist/exec/diagnostics.d.ts +74 -0
  51. package/dist/exec/diagnostics.d.ts.map +1 -0
  52. package/dist/exec/diagnostics.js +73 -0
  53. package/dist/exec/diagnostics.js.map +1 -0
  54. package/dist/exec/index.d.ts +5 -0
  55. package/dist/exec/index.d.ts.map +1 -0
  56. package/dist/exec/index.js +4 -0
  57. package/dist/exec/options.d.ts +75 -0
  58. package/dist/exec/options.d.ts.map +1 -0
  59. package/dist/exec/options.js +107 -0
  60. package/dist/exec/options.js.map +1 -0
  61. package/dist/exec/safe-executor.d.ts +138 -0
  62. package/dist/exec/safe-executor.d.ts.map +1 -0
  63. package/dist/exec/safe-executor.js +401 -0
  64. package/dist/exec/safe-executor.js.map +1 -0
  65. package/dist/exec/trace.d.ts +59 -0
  66. package/dist/exec/trace.d.ts.map +1 -0
  67. package/dist/exec/trace.js +108 -0
  68. package/dist/exec/trace.js.map +1 -0
  69. package/dist/icons/generated/glyph-svg.d.ts +37 -0
  70. package/dist/icons/generated/glyph-svg.d.ts.map +1 -0
  71. package/dist/icons/generated/glyph-svg.js +33 -0
  72. package/dist/icons/generated/glyph-svg.js.map +1 -0
  73. package/dist/icons/glyph-slots.d.ts +79 -0
  74. package/dist/icons/glyph-slots.d.ts.map +1 -0
  75. package/dist/icons/glyph-slots.js +50 -0
  76. package/dist/icons/glyph-slots.js.map +1 -0
  77. package/dist/icons/glyph.d.ts +76 -0
  78. package/dist/icons/glyph.d.ts.map +1 -0
  79. package/dist/icons/glyph.js +42 -0
  80. package/dist/icons/glyph.js.map +1 -0
  81. package/dist/icons/icon-fonts.d.ts +55 -0
  82. package/dist/icons/icon-fonts.d.ts.map +1 -0
  83. package/dist/icons/icon-fonts.js +74 -0
  84. package/dist/icons/icon-fonts.js.map +1 -0
  85. package/dist/icons/icon.d.ts +102 -0
  86. package/dist/icons/icon.d.ts.map +1 -0
  87. package/dist/icons/icon.js +132 -0
  88. package/dist/icons/icon.js.map +1 -0
  89. package/dist/icons/index.d.ts +7 -0
  90. package/dist/icons/index.d.ts.map +1 -0
  91. package/dist/icons/index.js +6 -0
  92. package/dist/icons/svg.d.ts +28 -0
  93. package/dist/icons/svg.d.ts.map +1 -0
  94. package/dist/icons/svg.js +59 -0
  95. package/dist/icons/svg.js.map +1 -0
  96. package/dist/index.d.ts +10 -0
  97. package/dist/index.d.ts.map +1 -0
  98. package/dist/index.js +9 -0
  99. package/dist/services/abort.d.ts +31 -0
  100. package/dist/services/abort.d.ts.map +1 -0
  101. package/dist/services/abort.js +47 -0
  102. package/dist/services/abort.js.map +1 -0
  103. package/dist/services/clock.d.ts +35 -0
  104. package/dist/services/clock.d.ts.map +1 -0
  105. package/dist/services/clock.js +37 -0
  106. package/dist/services/clock.js.map +1 -0
  107. package/dist/services/contracts.d.ts +200 -0
  108. package/dist/services/contracts.d.ts.map +1 -0
  109. package/dist/services/contracts.js +37 -0
  110. package/dist/services/contracts.js.map +1 -0
  111. package/dist/services/index.d.ts +5 -0
  112. package/dist/services/index.d.ts.map +1 -0
  113. package/dist/services/index.js +4 -0
  114. package/dist/services/preferences.d.ts +105 -0
  115. package/dist/services/preferences.d.ts.map +1 -0
  116. package/dist/services/preferences.js +253 -0
  117. package/dist/services/preferences.js.map +1 -0
  118. package/dist/theme/color.d.ts +94 -0
  119. package/dist/theme/color.d.ts.map +1 -0
  120. package/dist/theme/color.js +150 -0
  121. package/dist/theme/color.js.map +1 -0
  122. package/dist/theme/control-colors.d.ts +46 -0
  123. package/dist/theme/control-colors.d.ts.map +1 -0
  124. package/dist/theme/control-colors.js +46 -0
  125. package/dist/theme/control-colors.js.map +1 -0
  126. package/dist/theme/index.d.ts +5 -0
  127. package/dist/theme/index.d.ts.map +1 -0
  128. package/dist/theme/index.js +4 -0
  129. package/dist/theme/theme.d.ts +88 -0
  130. package/dist/theme/theme.d.ts.map +1 -0
  131. package/dist/theme/theme.js +190 -0
  132. package/dist/theme/theme.js.map +1 -0
  133. package/dist/theme/variants.d.ts +33 -0
  134. package/dist/theme/variants.d.ts.map +1 -0
  135. package/dist/theme/variants.js +53 -0
  136. package/dist/theme/variants.js.map +1 -0
  137. package/dist/tokens/css-vars.d.ts +35 -0
  138. package/dist/tokens/css-vars.d.ts.map +1 -0
  139. package/dist/tokens/css-vars.js +49 -0
  140. package/dist/tokens/css-vars.js.map +1 -0
  141. package/dist/tokens/generated/metrics.d.ts +184 -0
  142. package/dist/tokens/generated/metrics.d.ts.map +1 -0
  143. package/dist/tokens/generated/metrics.js +349 -0
  144. package/dist/tokens/generated/metrics.js.map +1 -0
  145. package/dist/tokens/generated/palettes.d.ts +113 -0
  146. package/dist/tokens/generated/palettes.d.ts.map +1 -0
  147. package/dist/tokens/generated/palettes.js +391 -0
  148. package/dist/tokens/generated/palettes.js.map +1 -0
  149. package/dist/tokens/index.d.ts +5 -0
  150. package/dist/tokens/index.d.ts.map +1 -0
  151. package/dist/tokens/index.js +4 -0
  152. package/dist/tokens/layout-metrics.d.ts +120 -0
  153. package/dist/tokens/layout-metrics.d.ts.map +1 -0
  154. package/dist/tokens/layout-metrics.js +111 -0
  155. package/dist/tokens/layout-metrics.js.map +1 -0
  156. package/docs/api.md +368 -0
  157. package/docs/foundation.md +369 -0
  158. package/docs/migration/Core.Controls.Shared.md +475 -0
  159. package/docs/migration/Core.Helpers.md +132 -0
  160. package/docs/migration/Core.Icons.md +135 -0
  161. package/docs/migration/Core.Localization.md +118 -0
  162. package/docs/migration/Core.Storage.md +54 -0
  163. package/docs/migration/Core.Theming.md +328 -0
  164. package/package.json +59 -4
@@ -0,0 +1,111 @@
1
+ import { G9Error } from "../errors.js";
2
+ const thickness = (left, top, right, bottom)=>({
3
+ top,
4
+ end: right,
5
+ bottom,
6
+ start: left
7
+ });
8
+ const g9LayoutMetricDefaults = {
9
+ EdgeSpacing: 10,
10
+ ControlCornerRadius: 9,
11
+ ToolbarButtonSize: 42,
12
+ ToolbarIconSize: 24,
13
+ FitContentLoadingMinHeight: 180,
14
+ ModalHeaderIconButtonSize: 30,
15
+ ModalHeaderIconTitleSpacing: 3,
16
+ SheetHeaderVerticalGap: 10,
17
+ SheetHeaderMinHeight: 64,
18
+ SheetHeaderTitleFontSize: 16.2,
19
+ ModalInnerIconSize: 39,
20
+ ModalSheetHandleWidth: 90,
21
+ ModalSheetHandleHeight: 5,
22
+ ModalTargetHeaderHeight: 64,
23
+ ModalTargetTabBarHeight: 56,
24
+ ModalTargetCategoryRowHeight: 66,
25
+ ModalTargetFooterButtonHeight: 52,
26
+ SpacingXSmall: 2,
27
+ SpacingSmall: 4,
28
+ SpacingMedium: 8,
29
+ SpacingLarge: 12,
30
+ SpacingXLarge: 16,
31
+ ControlCellHeight: 52,
32
+ MinTouchTarget: 48,
33
+ SiteThumbnailSize: 58,
34
+ MapChromeEdgeSpacing: 12,
35
+ ControlCornerRadiusValue: 9,
36
+ MapChromeCornerRadius: 24,
37
+ EdgeHorizontalThickness: thickness(10, 0, 10, 0),
38
+ BodyPadding: thickness(10, 10, 10, 10),
39
+ BodyElementMargin: thickness(10, 10, 10, 0),
40
+ BodyElementMarginWithBottomGap: thickness(10, 10, 10, 10),
41
+ BodyTopMargin: thickness(0, 10, 0, 0),
42
+ ItemBottomMargin: thickness(0, 0, 0, 10),
43
+ ModalBaseBodyMargin: thickness(10, 0, 10, 10),
44
+ SearchFieldPadding: thickness(14, 0, 12, 0),
45
+ CardPadding: thickness(14, 12, 14, 12),
46
+ ListCardPadding: thickness(12, 12, 12, 12),
47
+ OutlinedCardPadding: thickness(14, 22, 14, 14),
48
+ OutlinedInputTopGap: thickness(0, 16, 0, 0)
49
+ };
50
+ const g9LayoutMetricConstants = {
51
+ DeferredContentLoadDelayMs: 369,
52
+ G9BottomSheetFooterTopBorderThickness: 1,
53
+ G9BottomSheetFooterMaxButtonsPerRow: 3,
54
+ G9BottomSheetDragHandleTouchHeight: 30,
55
+ G9BottomSheetDragHandleWidth: 32,
56
+ G9BottomSheetDragHandleHeight: 4,
57
+ G9BottomSheetBackdropCardThreshold: 0.75,
58
+ G9BottomSheetBackdropCardMinScale: 0.93,
59
+ G9BottomSheetBackdropCardTranslationY: 12
60
+ };
61
+ const isNumber = (v)=>'number' == typeof v && Number.isFinite(v);
62
+ const hasNumbers = (v, keys)=>'object' == typeof v && null !== v && keys.every((k)=>isNumber(v[k]));
63
+ const INSET_KEYS = [
64
+ 'top',
65
+ 'end',
66
+ 'bottom',
67
+ 'start'
68
+ ];
69
+ const CORNER_KEYS = [
70
+ 'topStart',
71
+ 'topEnd',
72
+ 'bottomEnd',
73
+ 'bottomStart'
74
+ ];
75
+ function validate(name, fallback, value) {
76
+ const ok = 'number' == typeof fallback && ('ControlCornerRadiusValue' === name || 'MapChromeCornerRadius' === name) ? isNumber(value) || hasNumbers(value, CORNER_KEYS) : 'number' == typeof fallback ? isNumber(value) : hasNumbers(value, INSET_KEYS);
77
+ if (!ok) throw new G9Error('layout-metric-invalid', `Layout metric "${name}" has an invalid value.`);
78
+ }
79
+ function resolveLayoutMetrics(overrides = {}) {
80
+ var _values_MapBottomBarMargin;
81
+ const merged = {
82
+ ...g9LayoutMetricDefaults
83
+ };
84
+ for (const [name, value] of Object.entries(overrides))if (void 0 !== value) {
85
+ if ('MapBottomBarMargin' === name) validate(name, merged.BodyPadding, value);
86
+ else if (name in g9LayoutMetricDefaults) validate(name, merged[name], value);
87
+ else throw new G9Error('layout-metric-unknown', `"${name}" is not an overridable layout metric.`);
88
+ merged[name] = value;
89
+ }
90
+ const values = merged;
91
+ const edge = values.EdgeSpacing;
92
+ const map = values.MapChromeEdgeSpacing;
93
+ return Object.freeze({
94
+ ...values,
95
+ ...g9LayoutMetricConstants,
96
+ G9BottomSheetFooterButtonHeight: values.ModalTargetFooterButtonHeight,
97
+ G9BottomSheetFooterButtonSpacing: edge,
98
+ G9BottomSheetFooterPadding: thickness(edge, edge, edge, edge),
99
+ MapBottomBarMargin: null != (_values_MapBottomBarMargin = values.MapBottomBarMargin) ? _values_MapBottomBarMargin : thickness(map, 0, map, map)
100
+ });
101
+ }
102
+ const g9LayoutMetrics = resolveLayoutMetrics();
103
+ function resolveFullScreenSheetTopPadding(input) {
104
+ const override = input.topSafeAreaPaddingOverride;
105
+ if (null != override) return Math.max(0, override);
106
+ const safeArea = input.useTopSafeAreaPadding ? Math.max(0, input.safeAreaInset) : 0;
107
+ return Math.max(0, safeArea + input.additionalTopSafeAreaPadding);
108
+ }
109
+ export { g9LayoutMetricConstants, g9LayoutMetricDefaults, g9LayoutMetrics, resolveFullScreenSheetTopPadding, resolveLayoutMetrics };
110
+
111
+ //# sourceMappingURL=layout-metrics.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tokens/layout-metrics.js","sources":["../../src/tokens/layout-metrics.ts"],"sourcesContent":["import { G9Error } from '../errors';\n\n/** Logical edge insets in pixels (MAUI `Thickness`; `Left` is the start side, `Right` the end side). */\nexport interface G9EdgeInsets {\n readonly top: number;\n readonly end: number;\n readonly bottom: number;\n readonly start: number;\n}\n\n/** Per-corner radii in pixels (MAUI `CornerRadius`; left corners are the start side). */\nexport interface G9CornerRadii {\n readonly topStart: number;\n readonly topEnd: number;\n readonly bottomEnd: number;\n readonly bottomStart: number;\n}\n\n/** A corner radius: one value for all four corners, or one per corner. */\nexport type G9CornerRadius = number | G9CornerRadii;\n\n/** MAUI `new Thickness(left, top, right, bottom)` as logical insets. */\nconst thickness = (left: number, top: number, right: number, bottom: number): G9EdgeInsets => ({\n top,\n end: right,\n bottom,\n start: left,\n});\n\n/**\n * The layout metrics an app may retune (MAUI read these from `Application.Resources` with the literal fallbacks\n * below; the census card `Core.Theming` lists them as `=> D(nameof(X), n)`, `Th(…)` and `Cr(…)`).\n */\nexport const g9LayoutMetricDefaults = {\n EdgeSpacing: 10,\n ControlCornerRadius: 9,\n ToolbarButtonSize: 42,\n ToolbarIconSize: 24,\n FitContentLoadingMinHeight: 180,\n ModalHeaderIconButtonSize: 30,\n ModalHeaderIconTitleSpacing: 3,\n SheetHeaderVerticalGap: 10,\n SheetHeaderMinHeight: 64,\n SheetHeaderTitleFontSize: 16.2,\n ModalInnerIconSize: 39,\n ModalSheetHandleWidth: 90,\n ModalSheetHandleHeight: 5,\n ModalTargetHeaderHeight: 64,\n ModalTargetTabBarHeight: 56,\n ModalTargetCategoryRowHeight: 66,\n ModalTargetFooterButtonHeight: 52,\n SpacingXSmall: 2,\n SpacingSmall: 4,\n SpacingMedium: 8,\n SpacingLarge: 12,\n SpacingXLarge: 16,\n ControlCellHeight: 52,\n MinTouchTarget: 48,\n SiteThumbnailSize: 58,\n MapChromeEdgeSpacing: 12,\n ControlCornerRadiusValue: 9 as G9CornerRadius,\n MapChromeCornerRadius: 24 as G9CornerRadius,\n EdgeHorizontalThickness: thickness(10, 0, 10, 0),\n BodyPadding: thickness(10, 10, 10, 10),\n BodyElementMargin: thickness(10, 10, 10, 0),\n BodyElementMarginWithBottomGap: thickness(10, 10, 10, 10),\n BodyTopMargin: thickness(0, 10, 0, 0),\n ItemBottomMargin: thickness(0, 0, 0, 10),\n ModalBaseBodyMargin: thickness(10, 0, 10, 10),\n SearchFieldPadding: thickness(14, 0, 12, 0),\n CardPadding: thickness(14, 12, 14, 12),\n ListCardPadding: thickness(12, 12, 12, 12),\n OutlinedCardPadding: thickness(14, 22, 14, 14),\n OutlinedInputTopGap: thickness(0, 16, 0, 0),\n};\n\n/** Compile-time constants of MAUI `G9LayoutMetrics`: never read from resources, so not overridable. */\nexport const g9LayoutMetricConstants = {\n DeferredContentLoadDelayMs: 369,\n G9BottomSheetFooterTopBorderThickness: 1,\n G9BottomSheetFooterMaxButtonsPerRow: 3,\n G9BottomSheetDragHandleTouchHeight: 30,\n G9BottomSheetDragHandleWidth: 32,\n G9BottomSheetDragHandleHeight: 4,\n G9BottomSheetBackdropCardThreshold: 0.75,\n G9BottomSheetBackdropCardMinScale: 0.93,\n G9BottomSheetBackdropCardTranslationY: 12,\n} as const;\n\ntype Defaults = typeof g9LayoutMetricDefaults;\n\n/** Values an app may override; `MapBottomBarMargin` is derived from `MapChromeEdgeSpacing` unless overridden. */\nexport type G9LayoutMetricOverrides = { readonly [K in keyof Defaults]?: Defaults[K] | undefined } & {\n readonly MapBottomBarMargin?: G9EdgeInsets | undefined;\n};\n\n/** Every layout metric, resolved (MAUI `G9LayoutMetrics`). */\nexport type G9LayoutMetrics = { readonly [K in keyof Defaults]: Defaults[K] } & typeof g9LayoutMetricConstants & {\n /** `ModalTargetFooterButtonHeight`. */\n readonly G9BottomSheetFooterButtonHeight: number;\n /** `EdgeSpacing`. */\n readonly G9BottomSheetFooterButtonSpacing: number;\n /** `EdgeSpacing` on all four sides. */\n readonly G9BottomSheetFooterPadding: G9EdgeInsets;\n /** `MapChromeEdgeSpacing` on start, end and bottom. */\n readonly MapBottomBarMargin: G9EdgeInsets;\n };\n\nconst isNumber = (v: unknown): v is number => typeof v === 'number' && Number.isFinite(v);\nconst hasNumbers = (v: unknown, keys: readonly string[]): boolean =>\n typeof v === 'object' && v !== null && keys.every((k) => isNumber((v as Record<string, unknown>)[k]));\nconst INSET_KEYS = ['top', 'end', 'bottom', 'start'] as const;\nconst CORNER_KEYS = ['topStart', 'topEnd', 'bottomEnd', 'bottomStart'] as const;\n\nfunction validate(name: string, fallback: unknown, value: unknown): void {\n const ok =\n typeof fallback === 'number' && (name === 'ControlCornerRadiusValue' || name === 'MapChromeCornerRadius')\n ? isNumber(value) || hasNumbers(value, CORNER_KEYS)\n : typeof fallback === 'number'\n ? isNumber(value)\n : hasNumbers(value, INSET_KEYS);\n if (!ok) throw new G9Error('layout-metric-invalid', `Layout metric \"${name}\" has an invalid value.`);\n}\n\n/**\n * Resolves the layout metrics: the MAUI fallbacks, then `overrides` (the counterpart of defining the keys in the app's\n * `LayoutMetrics.xaml`), then the derived members. An unknown key or a wrongly shaped value throws a `G9Error`\n * (`layout-metric-unknown` / `layout-metric-invalid`) instead of being ignored.\n */\nexport function resolveLayoutMetrics(overrides: G9LayoutMetricOverrides = {}): G9LayoutMetrics {\n const merged: Record<string, unknown> = { ...g9LayoutMetricDefaults };\n for (const [name, value] of Object.entries(overrides)) {\n if (value === undefined) continue;\n if (name === 'MapBottomBarMargin') validate(name, merged.BodyPadding, value);\n else if (name in g9LayoutMetricDefaults) validate(name, merged[name], value);\n else throw new G9Error('layout-metric-unknown', `\"${name}\" is not an overridable layout metric.`);\n merged[name] = value;\n }\n const values = merged as unknown as Defaults & { MapBottomBarMargin?: G9EdgeInsets };\n const edge = values.EdgeSpacing;\n const map = values.MapChromeEdgeSpacing;\n return Object.freeze({\n ...values,\n ...g9LayoutMetricConstants,\n G9BottomSheetFooterButtonHeight: values.ModalTargetFooterButtonHeight,\n G9BottomSheetFooterButtonSpacing: edge,\n G9BottomSheetFooterPadding: thickness(edge, edge, edge, edge),\n MapBottomBarMargin: values.MapBottomBarMargin ?? thickness(map, 0, map, map),\n });\n}\n\n/** The stock layout metrics (no overrides). */\nexport const g9LayoutMetrics: G9LayoutMetrics = resolveLayoutMetrics();\n\n/** Input of {@link resolveFullScreenSheetTopPadding}. */\nexport interface G9FullScreenSheetTopPaddingInput {\n /** The status-bar (top safe-area) inset. */\n readonly safeAreaInset: number;\n /** Whether the safe-area inset is reserved at all. */\n readonly useTopSafeAreaPadding: boolean;\n /** Extra padding added to the reserved inset. */\n readonly additionalTopSafeAreaPadding: number;\n /** When set, replaces the whole computation (clamped at 0). */\n readonly topSafeAreaPaddingOverride?: number | null;\n}\n\n/**\n * Top padding band above a full-screen sheet's content: exactly the status-bar inset (plus the additional padding),\n * never negative; an explicit override wins. MAUI `G9LayoutMetrics.ResolveFullScreenSheetTopPadding`.\n */\nexport function resolveFullScreenSheetTopPadding(input: G9FullScreenSheetTopPaddingInput): number {\n const override = input.topSafeAreaPaddingOverride;\n if (override !== undefined && override !== null) return Math.max(0, override);\n const safeArea = input.useTopSafeAreaPadding ? Math.max(0, input.safeAreaInset) : 0;\n return Math.max(0, safeArea + input.additionalTopSafeAreaPadding);\n}\n"],"names":["thickness","left","top","right","bottom","g9LayoutMetricDefaults","g9LayoutMetricConstants","isNumber","v","Number","hasNumbers","keys","k","INSET_KEYS","CORNER_KEYS","validate","name","fallback","value","ok","G9Error","resolveLayoutMetrics","overrides","_values_MapBottomBarMargin","merged","Object","undefined","values","edge","map","g9LayoutMetrics","resolveFullScreenSheetTopPadding","input","override","Math","safeArea"],"mappings":";AAsBA,MAAMA,YAAY,CAACC,MAAcC,KAAaC,OAAeC,SAAkC;QAC7FF;QACA,KAAKC;QACLC;QACA,OAAOH;IACT;AAMO,MAAMI,yBAAyB;IACpC,aAAa;IACb,qBAAqB;IACrB,mBAAmB;IACnB,iBAAiB;IACjB,4BAA4B;IAC5B,2BAA2B;IAC3B,6BAA6B;IAC7B,wBAAwB;IACxB,sBAAsB;IACtB,0BAA0B;IAC1B,oBAAoB;IACpB,uBAAuB;IACvB,wBAAwB;IACxB,yBAAyB;IACzB,yBAAyB;IACzB,8BAA8B;IAC9B,+BAA+B;IAC/B,eAAe;IACf,cAAc;IACd,eAAe;IACf,cAAc;IACd,eAAe;IACf,mBAAmB;IACnB,gBAAgB;IAChB,mBAAmB;IACnB,sBAAsB;IACtB,0BAA0B;IAC1B,uBAAuB;IACvB,yBAAyBL,UAAU,IAAI,GAAG,IAAI;IAC9C,aAAaA,UAAU,IAAI,IAAI,IAAI;IACnC,mBAAmBA,UAAU,IAAI,IAAI,IAAI;IACzC,gCAAgCA,UAAU,IAAI,IAAI,IAAI;IACtD,eAAeA,UAAU,GAAG,IAAI,GAAG;IACnC,kBAAkBA,UAAU,GAAG,GAAG,GAAG;IACrC,qBAAqBA,UAAU,IAAI,GAAG,IAAI;IAC1C,oBAAoBA,UAAU,IAAI,GAAG,IAAI;IACzC,aAAaA,UAAU,IAAI,IAAI,IAAI;IACnC,iBAAiBA,UAAU,IAAI,IAAI,IAAI;IACvC,qBAAqBA,UAAU,IAAI,IAAI,IAAI;IAC3C,qBAAqBA,UAAU,GAAG,IAAI,GAAG;AAC3C;AAGO,MAAMM,0BAA0B;IACrC,4BAA4B;IAC5B,uCAAuC;IACvC,qCAAqC;IACrC,oCAAoC;IACpC,8BAA8B;IAC9B,+BAA+B;IAC/B,oCAAoC;IACpC,mCAAmC;IACnC,uCAAuC;AACzC;AAqBA,MAAMC,WAAW,CAACC,IAA4B,AAAa,YAAb,OAAOA,KAAkBC,OAAO,QAAQ,CAACD;AACvF,MAAME,aAAa,CAACF,GAAYG,OAC9B,AAAa,YAAb,OAAOH,KAAkBA,AAAM,SAANA,KAAcG,KAAK,KAAK,CAAC,CAACC,IAAML,SAAUC,CAA6B,CAACI,EAAE;AACrG,MAAMC,aAAa;IAAC;IAAO;IAAO;IAAU;CAAQ;AACpD,MAAMC,cAAc;IAAC;IAAY;IAAU;IAAa;CAAc;AAEtE,SAASC,SAASC,IAAY,EAAEC,QAAiB,EAAEC,KAAc;IAC/D,MAAMC,KACJ,AAAoB,YAApB,OAAOF,YAA0BD,CAAAA,AAAS,+BAATA,QAAuCA,AAAS,4BAATA,IAA+B,IACnGT,SAASW,UAAUR,WAAWQ,OAAOJ,eACrC,AAAoB,YAApB,OAAOG,WACLV,SAASW,SACTR,WAAWQ,OAAOL;IAC1B,IAAI,CAACM,IAAI,MAAM,IAAIC,QAAQ,yBAAyB,CAAC,eAAe,EAAEJ,KAAK,uBAAuB,CAAC;AACrG;AAOO,SAASK,qBAAqBC,YAAqC,CAAC,CAAC;QAkBpDC;IAjBtB,MAAMC,SAAkC;QAAE,GAAGnB,sBAAsB;IAAC;IACpE,KAAK,MAAM,CAACW,MAAME,MAAM,IAAIO,OAAO,OAAO,CAACH,WACzC,IAAIJ,AAAUQ,WAAVR;QACJ,IAAIF,AAAS,yBAATA,MAA+BD,SAASC,MAAMQ,OAAO,WAAW,EAAEN;aACjE,IAAIF,QAAQX,wBAAwBU,SAASC,MAAMQ,MAAM,CAACR,KAAK,EAAEE;aACjE,MAAM,IAAIE,QAAQ,yBAAyB,CAAC,CAAC,EAAEJ,KAAK,sCAAsC,CAAC;QAChGQ,MAAM,CAACR,KAAK,GAAGE;;IAEjB,MAAMS,SAASH;IACf,MAAMI,OAAOD,OAAO,WAAW;IAC/B,MAAME,MAAMF,OAAO,oBAAoB;IACvC,OAAOF,OAAO,MAAM,CAAC;QACnB,GAAGE,MAAM;QACT,GAAGrB,uBAAuB;QAC1B,iCAAiCqB,OAAO,6BAA6B;QACrE,kCAAkCC;QAClC,4BAA4B5B,UAAU4B,MAAMA,MAAMA,MAAMA;QACxD,oBAAoB,QAAAL,CAAAA,6BAAAA,OAAO,kBAAkB,AAAD,IAAxBA,6BAA6BvB,UAAU6B,KAAK,GAAGA,KAAKA;IAC1E;AACF;AAGO,MAAMC,kBAAmCT;AAkBzC,SAASU,iCAAiCC,KAAuC;IACtF,MAAMC,WAAWD,MAAM,0BAA0B;IACjD,IAAIC,QAAAA,UAA6C,OAAOC,KAAK,GAAG,CAAC,GAAGD;IACpE,MAAME,WAAWH,MAAM,qBAAqB,GAAGE,KAAK,GAAG,CAAC,GAAGF,MAAM,aAAa,IAAI;IAClF,OAAOE,KAAK,GAAG,CAAC,GAAGC,WAAWH,MAAM,4BAA4B;AAClE"}
package/docs/api.md ADDED
@@ -0,0 +1,368 @@
1
+ # API reference: `@g9tm/lynxcontrols-foundation`
2
+
3
+ Generated from the TSDoc of every public export by `node scripts/check-docs.mjs --write`; `npm run verify` fails
4
+ when it is stale. Do not edit by hand: change the TSDoc. The narrative guides (README, the other files in this
5
+ folder) explain how the pieces fit; the migration tables map every MAUI member.
6
+
7
+ ## `@g9tm/lynxcontrols-foundation/tokens`
8
+
9
+ | Export | Kind | Summary |
10
+ | --- | --- | --- |
11
+ | `cssVariableName` | function | CSS variable of a colour token: `Primary` → `--g9-primary` (plan/specs/01-Architecture.md §6). |
12
+ | `cssVariablesToText` | function | Renders variables as CSS declarations inside `selector`, one per line (e.g. for a generated stylesheet). |
13
+ | `g9Token` | function | A colour usable in any G9 colour prop or stylesheet that follows the active theme: `g9Token('Primary')` is `var(--g9-primary)`. Replaces the MAUI `{G9Color Primary}` markup extension. |
14
+ | `layoutCssVariableName` | function | CSS variable of a layout metric: `EdgeSpacing` → `--g9-layout-edge-spacing`. Insets and corner radii are emitted per side/corner, e.g. `--g9-layout-body-padding-start`, `--g9-layout-map-chrome-corner-radius-top-end`. |
15
+ | `metricCssVariableName` | function | CSS variable of a `G9Metrics` value: `RadiusMd` → `--g9-metric-radius-md`. |
16
+ | `resolveFullScreenSheetTopPadding` | function | Top padding band above a full-screen sheet's content: exactly the status-bar inset (plus the additional padding), never negative; an explicit override wins. MAUI `G9LayoutMetrics.ResolveFullScreenSheetTopPadding`. |
17
+ | `resolveLayoutMetrics` | function | Resolves the layout metrics: the MAUI fallbacks, then `overrides` (the counterpart of defining the keys in the app's `LayoutMetrics.xaml`), then the derived members. An unknown key or a wrongly shaped value throws a `G9Error` (`layout-metric-unknown` / `layout-metric-invalid`) instead of being ignored. |
18
+ | `toCssVariables` | function | One `--g9-<token>` variable per colour of `palette`, in token order. |
19
+ | `toKebabCase` | function | `OnPrimaryContainer` → `on-primary-container`, `SpacingXSmall` → `spacing-x-small`, `G9BottomSheet…` → `g9-bottom-sheet…`. |
20
+ | `toLayoutCssVariables` | function | The layout metrics as CSS variables (the counterpart of MAUI `G9LayoutMetrics.InstallDefaults`, which seeded the resource keys XAML bound to). Lengths get `px`, `DeferredContentLoadDelayMs` gets `ms`, counts and ratios none. |
21
+ | `toMetricCssVariables` | function | One `--g9-metric-<name>` variable per `G9Metrics` value, with its unit (`px`, `ms` or none). |
22
+ | `G9ColorToken` | enum | The colour tokens of the G9 theme in MAUI declaration order (MAUI `G9ColorToken`). Values keep the MAUI names so `G9ColorToken.Primary === 'Primary'`; the CSS variable is `--g9-primary` (see `cssVariableName`). |
23
+ | `g9ColorTokens` | constant | Every token, in declaration order. |
24
+ | `g9DarkPalette` | constant | The stock dark palette (MAUI `G9Theme.Dark.xaml`). |
25
+ | `g9LayoutMetricConstants` | constant | Compile-time constants of MAUI `G9LayoutMetrics`: never read from resources, so not overridable. |
26
+ | `g9LayoutMetricDefaults` | constant | The layout metrics an app may retune (MAUI read these from `Application.Resources` with the literal fallbacks below; the census card `Core.Theming` lists them as `=> D(nameof(X), n)`, `Th(…)` and `Cr(…)`). |
27
+ | `g9LayoutMetrics` | constant | The stock layout metrics (no overrides). |
28
+ | `g9LightPalette` | constant | The stock light palette (MAUI `G9Theme.Light.xaml`). |
29
+ | `G9Metrics` | constant | Shared visual metric defaults of the G9 controls (MAUI `G9Metrics`), every public static value in declaration order. Lengths are logical pixels, `…Ms` values are milliseconds, scales/opacities are plain numbers. |
30
+ | `g9MetricUnits` | constant | The CSS unit each metric is emitted with by `toMetricCssVariables`. |
31
+ | `G9CornerRadii` | interface | Per-corner radii in pixels (MAUI `CornerRadius`; left corners are the start side). |
32
+ | `G9EdgeInsets` | interface | Logical edge insets in pixels (MAUI `Thickness`; `Left` is the start side, `Right` the end side). |
33
+ | `G9FullScreenSheetTopPaddingInput` | interface | Input of `resolveFullScreenSheetTopPadding`. |
34
+ | `G9CornerRadius` | type | A corner radius: one value for all four corners, or one per corner. |
35
+ | `G9CssVariables` | type | A set of CSS custom properties: name (`--g9-…`) to value. Feed it to a root element's style or `setProperty`. |
36
+ | `G9LayoutMetricOverrides` | type | Values an app may override; `MapBottomBarMargin` is derived from `MapChromeEdgeSpacing` unless overridden. |
37
+ | `G9LayoutMetrics` | type | Every layout metric, resolved (MAUI `G9LayoutMetrics`). |
38
+ | `G9MetricName` | type | The name of a `G9Metrics` value. |
39
+ | `G9PaletteValues` | type | One CSS colour per token: a complete palette (MAUI `G9PaletteValues`). |
40
+
41
+ ## `@g9tm/lynxcontrols-foundation/theme`
42
+
43
+ | Export | Kind | Summary |
44
+ | --- | --- | --- |
45
+ | `applyAlpha` | function | MAUI `G9AlphaConverter.Convert`: applies `alpha` (clamped to `0..1`) when it is a number, otherwise returns the colour unchanged. `ConvertBack` had no behaviour (it threw) and has no counterpart. |
46
+ | `buildSolidOrGradient` | function | MAUI `G9Colors.BuildSolidOrGradient`: the solid colour, or a vertical gradient from 8 % lighter (top) through the colour (middle) to 8 % darker (bottom). |
47
+ | `checkBoxMark` | function | Check mark / indeterminate bar on a filled box: `OnPrimary` (the one place the mark colour is decided). |
48
+ | `createBorderColor` | function | 15 % darker: the stock border recipe. MAUI `G9ColorHelper.CreateBorderColor`. |
49
+ | `createHoverColor` | function | 8 % darker: the stock hover recipe. MAUI `G9ColorHelper.CreateHoverColor`. |
50
+ | `createPalette` | function | Validates a complete palette (every token, every value a readable colour) and returns a frozen copy in token order. |
51
+ | `createPressedColor` | function | 20 % darker: the stock pressed recipe. MAUI `G9ColorHelper.CreatePressedColor`. |
52
+ | `createThemeStore` | function | Creates a `G9ThemeStore`. Options are validated like `resolveTheme`. |
53
+ | `darken` | function | Darkens each RGB channel by `percentage` (`0..1`, clamped); alpha is kept. MAUI `G9ColorHelper.Darken`. |
54
+ | `fillToCss` | function | A fill as a CSS `background` value: the colour, or `linear-gradient(to bottom, …)`. |
55
+ | `formatColor` | function | Formats a colour as CSS: `#RRGGBB` when opaque, otherwise `rgba(R, G, B, A)`. Channels are rounded to the nearest byte; the alpha is printed with the fewest digits that parse back to the same float32 value, so `parseColor(formatColor(c))` reproduces the alpha exactly. |
56
+ | `getContrastingTextColor` | function | Black on light backgrounds (luminance above 0.5), white otherwise. MAUI `GetContrastingTextColor`. |
57
+ | `getContrastRatio` | function | WCAG contrast ratio, `1` to `21`. |
58
+ | `getLuminance` | function | WCAG relative luminance, `0` (black) to `1` (white). Alpha is ignored, as in MAUI. |
59
+ | `hasSwatch` | function | True when at least one swatch colour is set (MAUI `G9Visuals.HasSwatch`). The shared convention: no colour → no swatch, one → solid circle, two → circle split into two vertical halves. |
60
+ | `lighten` | function | Moves each RGB channel towards white by `percentage` (`0..1`, clamped). MAUI `G9ColorHelper.Lighten`. |
61
+ | `meetsWcagAA` | function | Contrast of at least 4.5:1 (WCAG AA, normal text). |
62
+ | `meetsWcagAAA` | function | Contrast of at least 7:1 (WCAG AAA, normal text). |
63
+ | `mix` | function | Linear mix of all four channels: `ratio` 0 is all `first`, 1 is all `second` (clamped). MAUI `Mix`. |
64
+ | `parseColor` | function | Parses a CSS colour: `#rgb`, `#rgba`, `#rrggbb`, `#rrggbbaa` (CSS order, alpha last), `rgb(r, g, b)`, `rgba(r, g, b, a)` (channels 0–255 or percentages, alpha 0–1 or a percentage) and `transparent`. Named colours other than `transparent` are not accepted: the palette tokens are the names. |
65
+ | `parseMauiColor` | function | Parses a colour written the MAUI way: `#rgb`, `#argb`, `#rrggbb` or `#aarrggbb`. Note the **alpha-first** order for 4 and 8 digits, unlike CSS. This is how the MAUI theme dictionaries and `golden/theme-palettes.json` spell colours. |
66
+ | `resolveButtonVariant` | function | Resolves a button variant against a palette (MAUI `G9Visuals.ResolveButtonVariant`, which read `G9Palette.Current`; pass the active theme's palette). An unrecognised variant resolves like `'primary'`, as the MAUI switch's default arm did. |
67
+ | `resolveColorScheme` | function | `'light'`/`'dark'` pick that scheme; `'system'` follows `systemScheme` (MAUI `G9Theme.ApplyCurrent`). |
68
+ | `resolveProgressColor` | function | Fill colour of a progress indicator (MAUI `G9Visuals.ResolveProgressColor`); unrecognised types use `Primary`. |
69
+ | `resolveTheme` | function | Resolves the painted theme: the stock palette of the effective scheme, then the app palette for that scheme, then `overrides`. Every supplied value is validated; nothing invalid is silently kept. |
70
+ | `rgba` | function | Builds channels the way the MAUI `Color(float, float, float, float)` constructor does: each channel is clamped to `0..1` and stored as float32. `NaN` stays `NaN`, as it does in .NET. |
71
+ | `stockPalette` | function | The stock palette of a scheme (MAUI `G9ThemeLight` / `G9ThemeDark`). |
72
+ | `switchOffTrack` | function | Switch track when off: `SurfaceContainerHighest` in dark, `OutlineVariant` in light. |
73
+ | `switchOnTrack` | function | Switch track when on: `Primary`. |
74
+ | `switchThumbOff` | function | Switch thumb when off: `OnSurfaceVariant` in dark, `Surface` in light. |
75
+ | `switchThumbOn` | function | Switch thumb when on: `OnPrimaryContainer` in dark, `OnPrimary` in light. |
76
+ | `toHex` | function | MAUI `G9ColorHelper.ToHex`: `#RRGGBB` without alpha, each channel **truncated** after a float32 multiply by 255 — the original's exact arithmetic, kept so derived colours print the same hex as before. |
77
+ | `toRgba` | function | Normalises a helper input to channels. Strings go through `parseColor`. |
78
+ | `tryParseColor` | function | `parseColor` that returns `undefined` instead of throwing. |
79
+ | `withAlpha` | function | The same colour with a new alpha (`MAUI Color.WithAlpha`); `alpha` is clamped to `0..1`. |
80
+ | `withOpacity` | function | MAUI `G9ColorHelper.WithOpacity`. `null`/`undefined` returns the colour unchanged; a number or an invariant-culture numeric string sets the alpha, clamped to `0..1`; an unreadable string means opacity `1`. |
81
+ | `G9ColorScheme` | enum | The scheme actually painted. |
82
+ | `G9ThemeMode` | enum | Which theme the user chose (MAUI `AppTheme`: `Unspecified` is `system`, follow the platform). |
83
+ | `G9Colors` | constant | Alpha recipes the G9 controls paint with (MAUI `G9Colors` constants). |
84
+ | `G9ColorFormatError` | class | Thrown when a string is not a colour this library can read. |
85
+ | `G9CustomPalettes` | interface | App palettes replacing (all or some of) the stock light and dark palettes. |
86
+ | `G9GradientStop` | interface | A gradient stop: colour at `offset` (`0..1`). |
87
+ | `G9ResolvedTheme` | interface | A resolved theme: what is painted and why. Frozen. |
88
+ | `G9Rgba` | interface | A colour as four channels in `0..1`, stored at float32 precision exactly like MAUI `Color`. Colour arithmetic (darken, mix, contrast) runs on this shape so its results match the original helpers bit for bit; format with `formatColor` to get a CSS string back. |
89
+ | `G9ThemeOptions` | interface | Inputs of theme resolution. |
90
+ | `G9ThemeStore` | interface | The live theme (MAUI `G9Palette.Current` + `G9Theme`): one snapshot, replaced on every change, and listeners told once per change. Works with `useSyncExternalStore` (`subscribe` / `getSnapshot`). |
91
+ | `G9VariantColors` | interface | The colours a variant resolves to: fill, foreground, stroke, and whether the fill is a gradient (MAUI `G9VariantColors`). Colours are CSS strings. |
92
+ | `G9ButtonVisualResult` | type | The colours a button finally paints, after its `baseBackgroundColor` / `textColor` escape hatches are applied over the variant (MAUI `G9Visuals.ButtonVisualResult`). Same shape as `G9VariantColors`, so a button treats both paths identically; the button itself (WP04) applies the escape hatches. |
93
+ | `G9Color` | type | A CSS colour string, the value type every G9 colour prop takes (plan/specs/03-API-Conventions.md §2). Use `g9Token` for a theme token reference such as `var(--g9-primary)`. |
94
+ | `G9ColorInput` | type | Anything the colour helpers accept: a CSS colour string or channels. |
95
+ | `G9Fill` | type | A fill: a solid colour, or a top-to-bottom linear gradient. |
96
+ | `G9PaletteOverrides` | type | Some tokens replaced by CSS colours. |
97
+ | `G9ThemeListener` | type | Listener of `G9ThemeStore`; receives the snapshot taken at notify time. |
98
+
99
+ ## `@g9tm/lynxcontrols-foundation/culture`
100
+
101
+ | Export | Kind | Summary |
102
+ | --- | --- | --- |
103
+ | `addDays` | function | The date `days` later (earlier when negative). |
104
+ | `clampToPersianRange` | function | The value pulled into the Persian calendar's range (MAUI `G9Calendar.ClampToPersianRange`); a value already inside is returned unchanged. A date stays a date and a date-time stays a date-time. |
105
+ | `combineLocalDateTime` | function | Joins a date and a time. |
106
+ | `compareLocal` | function | Orders dates or date-times (a date compares as its midnight): negative, 0 or positive. |
107
+ | `composeDays` | function | Joins years, months and days into a day count with the same convention (MAUI `G9TimeSpanMath.Compose`). Negative parts count as zero; the result saturates at 2,147,483,647 (`int.MaxValue`) like MAUI. |
108
+ | `createCulture` | function | Builds a culture value. Defaults follow the language, never the direction alone: `fa*` → Persian calendar, Persian digits, RTL; `ar*` → Gregorian, Arabic-Indic digits, RTL; other RTL languages (he, ur, …) and scripts (`-Arab`) → RTL with Gregorian and Latin digits; everything else LTR, Gregorian, Latin. `options` override any of these. |
109
+ | `createCultureStore` | function | Creates a `G9CultureStore`. Notification follows MAUI `NotifyChanged`: each listener receives the snapshot of the change being reported, even if a listener switches the culture again (that switch is reported afterwards, in a new round, with its own snapshot). Every listener runs even if one throws; the first error is rethrown afterwards. An invalid culture throws before anything changes. |
110
+ | `createStrings` | function | Creates the strings of one culture. Every input is validated now (unknown keys, non-string texts), so a typo fails at startup rather than rendering a raw key. |
111
+ | `dayOfWeek` | function | Day of the week, 0 = Sunday … 6 = Saturday (.NET `DayOfWeek` numbering). |
112
+ | `daysInGregorianMonth` | function | Days in a Gregorian month. |
113
+ | `daysInMonth` | function | Days in a month of the calendar. |
114
+ | `daysToMs` | function | A whole-day count as a duration in milliseconds. |
115
+ | `decomposeDays` | function | Splits a day count into years, months and days (MAUI `G9TimeSpanMath.Decompose`). Negative input counts as zero. Because 365 is not a multiple of 30, the last five days of a "year" stay in `days` (months is capped at 11, so days can reach 34) instead of producing a month 12 the drum cannot show. |
116
+ | `digitValue` | function | The value 0–9 of an ASCII, Persian or Arabic-Indic digit, or -1 for any other UTF-16 code unit. This is the digit set MAUI `G9Digits` recognises: a Persian or Arabic keyboard and any paste from a Persian source produce these. |
117
+ | `formatAgo` | function | The relative phrase alone, e.g. `'2 d ago'`, `'۲ روز پیش'` (MAUI `G9RelativeTimeFormatter.FormatAgo`). Takes an absolute instant, so a time zone can no longer shift the result (MAUI subtracted a local `DateTime` from UTC now). |
118
+ | `formatAgoWithTime` | function | The phrase joined with the wall-clock time, e.g. `'6 h ago - 14:19'` (MAUI `FormatAgoWithTime`, the history timeline format). The time is `HH:mm` in the culture's digits at `utcOffsetMinutes`. |
119
+ | `formatIsoDate` | function | `YYYY-MM-DD`. |
120
+ | `formatIsoDateTime` | function | `YYYY-MM-DDTHH:mm:ss.sss` (no zone). |
121
+ | `formatLocalDateTime` | function | Writes a date or date-time with a .NET-style custom pattern, without Intl: `yyyy yy y`, `MMMM MMM MM M`, `dddd ddd dd d`, `HH H hh h`, `mm m`, `ss s`, `fff ff f`, `tt t`; `'quoted'`/`"quoted"` text and `\x` are literal; other non-letters (`/ : . - space`) are written as is. Names and AM/PM come from the culture's language (fa/ar/en); digits from its numbering system. A date without time formats as midnight. |
122
+ | `formatNumber` | function | Formats a number without `Intl` (Lynx has none): thousands grouping, fraction digits and the numbering system's digits and separators. `formatNumber(1234.5, { numberingSystem: 'persian' })` is `'۱٬۲۳۴٫۵'`. |
123
+ | `formatPlainNumber` | function | Writes a number the way .NET's composite formatting (`string.Format("{0}", n)`) does, in shortest round-trip form and without grouping, then in `numberingSystem`'s digits and separators. Used by `G9Strings.format` placeholders. |
124
+ | `formatTemplate` | function | Fills a .NET composite-format template (`{0}`, `{{`, `}}`). Specifiers (`{0:N2}`, `{0,5}`) are rejected rather than ignored. |
125
+ | `fromCalendarDate` | function | The Gregorian day of a date written in a calendar (`{ calendar: 'persian', year: 1403, month: 1, day: 1 }` → 2024-03-20). |
126
+ | `fromEpochDays` | function | The date `epochDays` after 1970-01-01. |
127
+ | `g9StringResourceName` | function | The MAUI member name of a key (`'noResults'` → `'NoResults'`): the name a provider or resource catalogue sees. |
128
+ | `getMonthName` | function | One month name (`month` 1–12). |
129
+ | `getMonthNames` | function | The 12 month names of a calendar in the culture's language (`fa`, `ar`, otherwise English): Persian months are Farvardin…Esfand, Gregorian months January…December. English Gregorian names abbreviate to three letters. |
130
+ | `getNumberSymbols` | function | Decimal, grouping and minus characters for a numbering system. |
131
+ | `getRelativeTimeParts` | function | Buckets an instant against `now` exactly like MAUI `G9RelativeTimeFormatter.FormatAgo`: under a minute is "just now"; then whole minutes (< 60), hours (< 24), days (< 7), weeks (days / 7, < 30 days), months (days / 30, < 365 days), years (days / 365); counts are truncated and at least 1. A future instant counts as now. |
132
+ | `getWeekdayNames` | function | The 7 weekday names, index 0 = Sunday (matching `dayOfWeek`). English abbreviates to three letters. |
133
+ | `isGregorianLeapYear` | function | `true` for a Gregorian leap year. |
134
+ | `isLeapYear` | function | `true` for a leap year of the calendar (Persian: Esfand has 30 days). |
135
+ | `isPersianLanguage` | function | `true` when the language is Persian (`fa`, any region), the test MAUI uses to show Jalali dates (`G9Calendar.IsPersianLanguage`). Dari (`prs`), Pashto, Arabic and the invariant culture are `false`. |
136
+ | `isRtl` | function | `true` when the culture reads right-to-left (MAUI `G9Culture.IsRtl`, `G9Visuals.IsRtl`). |
137
+ | `isSupportedByPersianCalendar` | function | `true` when the value is inside the Persian calendar's range (MAUI `G9Calendar.IsSupportedByPersianCalendar`). |
138
+ | `languageOf` | function | Lower-case language subtag of a culture or locale tag; `''` for `null`, `undefined` and the invariant culture. |
139
+ | `localDate` | function | A validated, frozen `G9LocalDate`. |
140
+ | `localDateTime` | function | A validated, frozen `G9LocalDateTime`; the time defaults to midnight. |
141
+ | `localDateTimeFromDate` | function | The wall-clock fields of a `Date` in the device's zone (Date's own getters; no Intl needed). |
142
+ | `localDateTimeFromEpochMs` | function | The wall-clock date-time of an instant at a fixed UTC offset. |
143
+ | `localDateTimeToDate` | function | A `Date` at this wall-clock time in the device's zone. |
144
+ | `localDateTimeToEpochMs` | function | The instant (epoch ms) of a wall-clock date-time at a fixed UTC offset (`210` for Tehran +03:30). Lynx has no time-zone database (no Intl): the host supplies the offset, e.g. from its clock service. |
145
+ | `localTime` | function | A validated, frozen `G9LocalTime`. |
146
+ | `msToWholeDays` | function | The whole days in a duration in milliseconds, truncated toward zero (.NET `TimeSpan.Days`). |
147
+ | `normalizeToAscii` | function | Replaces every Persian (U+06F0–U+06F9) and Arabic-Indic (U+0660–U+0669) digit with its ASCII counterpart; every other character, separators included, is kept (MAUI `G9Digits.NormalizeToAscii`, both overloads: a one-character string is a `char`). `null`/`undefined` yield `''`. The input string is returned as is when nothing changes. |
148
+ | `parseIsoDate` | function | Reads `YYYY-MM-DD`. |
149
+ | `parseIsoDateTime` | function | Reads `YYYY-MM-DD[THH:mm[:ss[.fffffff]]]` (no zone; .NET round-trip strings included, sub-millisecond digits truncated). |
150
+ | `parseNumber` | function | Reads a number typed in any of the three digit sets, with either separator style (`'1,234.5'`, `'۱٬۲۳۴٫۵'`, `'١٬٢٣٤٫٥'`), a leading sign and bidi marks. Returns `null` for anything else (no partial parse). |
151
+ | `persianNewYear` | function | First day (Nowruz, 1 Farvardin) of a Persian year, as a Gregorian date. |
152
+ | `resolveFontFamily` | function | The font family text should use now (MAUI `G9Culture.ResolveFontFamily`, `G9Visuals.ResolveCulturalFont`): a non-blank `explicitFontFamily` always wins, otherwise the culture's RTL or LTR family. `undefined` means "platform default". |
153
+ | `sameCulture` | function | Field-by-field equality of two culture values. |
154
+ | `toCalendarDate` | function | The date written in `calendar`. Persian dates match .NET `PersianCalendar` exactly for 1200–1501 AP (golden `calendar.json`); outside that span they follow |
155
+ | `toEpochDays` | function | Days since 1970-01-01 (negative before). |
156
+ | `toLocalDate` | function | The date part of a date-time (or the date itself). |
157
+ | `toNativeDigits` | function | Writes every ASCII digit of `text` in `numberingSystem` (the inverse of `normalizeToAscii` for one system). Other characters are kept, so separators must already be the culture's (see `formatNumber`). |
158
+ | `withCultureOptions` | function | The same culture with some settings replaced (`undefined` in `options` keeps the current value). |
159
+ | `G9CalendarSystem` | enum | Calendar dates are shown in. Only Persian (Jalali) and Gregorian are supported, as in MAUI. |
160
+ | `G9Direction` | enum | Reading direction (MAUI `G9Culture.IsRtl`). |
161
+ | `G9NumberingSystem` | enum | Which digits numbers are written with. Independent of language and direction (plan/specs/01-Architecture.md §7): `fa*` defaults to `'persian'` (U+06F0–U+06F9), `ar` to `'arabicIndic'` (U+0660–U+0669), everything else `'latin'`. |
162
+ | `G9RelativeTimeUnit` | enum | The unit a relative phrase is written in. |
163
+ | `G9StringKey` | enum | Every string the controls display on their own initiative (MAUI `G9StringKey`). Values are the camelCase member names; `g9StringResourceName` gives the MAUI (PascalCase) name a provider is asked for. Keys ending in `Format` are templates with a `{0}` placeholder: a translation must keep it. |
164
+ | `g9ArabicStrings` | constant | Arabic translation of every built-in string. Opt-in, like `g9PersianStrings`. Count templates use one form; apps that need Arabic plural agreement override those keys or supply a provider. |
165
+ | `g9BuiltInStringTables` | constant | The bundled translations keyed by language: pass as `tables` to localize `fa` and `ar` without a provider. |
166
+ | `g9EnglishStrings` | constant | The built-in English strings (MAUI `G9Strings` defaults; the golden `strings.json`). |
167
+ | `g9PersianStrings` | constant | Persian translation of every built-in string. Opt-in (pass it in `G9StringsOptions.tables`): MAUI shipped English only, so without it a `fa` culture still shows English, exactly as MAUI did. |
168
+ | `g9StringKeys` | constant | Every key in MAUI declaration order. |
169
+ | `G9TimeSpanMath` | constant | The picker convention for day-based durations (MAUI `G9TimeSpanMath`): a "year" is 365 days, a "month" 30 days, and the months drum shows 0–11. |
170
+ | `MS_PER_DAY` | constant | Milliseconds per day: day-based durations travel as milliseconds (plan/specs/03-API-Conventions.md §2). |
171
+ | `persianMaxSupportedDateTime` | constant | Last instant the Persian calendar represents (MAUI `PersianMaxSupportedDateTime`; .NET's last tick → last ms). |
172
+ | `persianMinSupportedDateTime` | constant | First day the Persian calendar represents (MAUI `G9Calendar.PersianMinSupportedDateTime`, .NET 0622-03-22). |
173
+ | `G9CalendarDate` | interface | A date written in a given calendar (`{ calendar: 'persian', year: 1403, month: 1, day: 1 }`). |
174
+ | `G9Culture` | interface | An immutable culture value: what MAUI read from `CultureInfo` plus the `G9Culture` facade, as independent settings (plan/specs/01-Architecture.md §7). Create with `createCulture`; frozen. |
175
+ | `G9CultureOptions` | interface | Settings that override what the locale implies. `undefined` keeps the locale default. |
176
+ | `G9CultureStore` | interface | The app's active culture (MAUI `G9Culture` facade + `CultureChanged`): one frozen snapshot, replaced on each change; listeners are told once per change. Works with `useSyncExternalStore` (`subscribe` / `getSnapshot`). The React provider (WP02) owns one. |
177
+ | `G9DateFormatOptions` | interface | Options of `formatLocalDateTime`. |
178
+ | `G9DayParts` | interface | Years, months and days of a day count (MAUI `(int Years, int Months, int Days)`). |
179
+ | `G9LocalDate` | interface | A calendar day without time or zone (MAUI `DateTime.Date`), proleptic Gregorian, years 1–9999 like .NET. |
180
+ | `G9LocalDateTime` | interface | A calendar day and wall-clock time without zone (MAUI `DateTime` used as a calendar value). |
181
+ | `G9LocalTime` | interface | A wall-clock time without date or zone (MAUI `TimeSpan` time of day / `TimeOnly`). |
182
+ | `G9NumberFormatOptions` | interface | Options of `formatNumber`. |
183
+ | `G9NumberSymbols` | interface | The characters a numbering system writes numbers with (CLDR `latn` / `arabext` / `arab` symbols). |
184
+ | `G9RelativeTimeOptions` | interface | Inputs of `formatAgo`. |
185
+ | `G9RelativeTimeParts` | interface | How long ago an instant was, in the unit the phrase uses. `count` is at least 1 (0 for `'justNow'`). |
186
+ | `G9RelativeTimeWithClockOptions` | interface | Inputs of `formatAgoWithTime`. |
187
+ | `G9Strings` | interface | Resolved strings for one culture (MAUI `G9Strings`). Immutable: build a new one when an input changes. |
188
+ | `G9StringsOptions` | interface | Inputs of `createStrings`. |
189
+ | `G9CultureListener` | type | Listener of `G9CultureStore`: receives the snapshot taken when the change was notified. |
190
+ | `G9NameWidth` | type | `'wide'` (`January`) or `'abbreviated'` (`Jan`). Persian and Arabic names have no shorter form. |
191
+ | `G9Now` | type | A clock (the WP01.4 `G9Clock` contract fits) or a fixed instant, in epoch milliseconds. |
192
+ | `G9PartialStringTable` | type | Some strings of a table (overrides, a partial translation). |
193
+ | `G9StringProvider` | type | An app resolver (MAUI `G9Strings.UseProvider` / `UseResources`): receives the resource name (`keyPrefix` + the MAUI member name for built-in keys, the caller's own key for `G9Strings.resolve`) and the culture. Return `null`/`undefined`/`''` to fall back. |
194
+ | `G9StringTable` | type | A complete string table. |
195
+
196
+ ## `@g9tm/lynxcontrols-foundation/icons`
197
+
198
+ | Export | Kind | Summary |
199
+ | --- | --- | --- |
200
+ | `assertG9Glyph` | function | Throws a `G9Error` with code `'icon-glyph'` unless `value` is a `G9Glyph` value. |
201
+ | `assertG9Icon` | function | Throws a `G9Error` unless `value` is a well-formed `G9Icon` (exactly one of the four shapes, valid glyph, family, text, code point, SVG or image). Use at configuration boundaries; the constructors already validate. |
202
+ | `builtInGlyph` | function | The built-in glyph of an icon, or `'none'` for every other icon (MAUI `G9IconSource.BuiltIn`). |
203
+ | `codePointIcon` | function | A font glyph given as a code point, e.g. `0xE801` (MAUI `G9IconSource.FromCodePoint`). Above U+FFFF the glyph text is a surrogate pair. A blank family or a non-scalar code point throws. |
204
+ | `createGlyphSvgCache` | function | Creates a bounded LRU cache of glyph SVG documents (default capacity `g9GlyphSvgCacheDefaultSize`). |
205
+ | `createIconFontRegistry` | function | Creates an empty icon-font registry (MAUI `G9IconFonts`, without the process-wide static state). |
206
+ | `defineIconFont` | function | Builds the frozen font icons of an icon-font table (MAUI `G9IconSource.FromEnum` and the implicit enum conversion): family = `font`, each member's glyph = its text, or its number read as a code point. An empty text throws (MAUI throws for an empty `[Description]`: a silently empty slot is harder to diagnose than a throw). |
207
+ | `fontIcon` | function | A font glyph given as its literal text (MAUI `G9IconSource.FromFont`). Blank family or empty text throws. |
208
+ | `fontIconText` | function | The glyph text of a font icon, a code point converted to its (possibly surrogate-pair) string, or `undefined` for every other icon (MAUI `G9IconSource.Glyph`). |
209
+ | `glyphIcon` | function | A built-in glyph icon (MAUI `G9IconSource.FromGlyph` and the implicit `G9Glyph` conversion). Unknown glyphs throw. |
210
+ | `iconEquals` | function | Value equality (MAUI `G9IconSource.Equals`, `==`, `!=`): same built-in glyph, or same family and glyph text (ordinal; a code point equals the text it converts to), or same SVG / image reference. All empty values are equal. |
211
+ | `iconNameKey` | function | The ordinal-ignore-case key of a name: each code point upper-cased when that maps to exactly one code point (a simple case mapping, like .NET `OrdinalIgnoreCase`; no Intl, no locale-specific rules). |
212
+ | `iconSignature` | function | A stable identity string that changes if and only if the icon changes (MAUI `G9IconSource.ToString`): `builtin:<glyph>`, `<font>:<text>`, `svg:<svg>`, `image:<kind>:<ref>`, or `''` when empty. Renderers compare it to decide whether an icon host needs rebuilding. |
213
+ | `isFontIcon` | function | True for a font icon (code point or text). |
214
+ | `isG9Glyph` | function | True when `value` is one of the `G9Glyph` values (`'none'` included). |
215
+ | `isGlyphIcon` | function | True for a built-in glyph icon that draws something (MAUI `G9IconSource.IsBuiltIn`). |
216
+ | `isIconEmpty` | function | True when the value carries no icon: `null`, `undefined` or `{ glyph: 'none' }` (MAUI `G9IconSource.IsEmpty`). |
217
+ | `isImageIcon` | function | True for an image icon. |
218
+ | `isSvgIcon` | function | True for an SVG icon. |
219
+ | `resolveGlyphSlots` | function | Returns a frozen slot set: the defaults with `overrides` applied (MAUI: assigning `G9Glyphs.X`; no overrides is MAUI `G9Glyphs.Reset()`). An unknown slot name or a malformed icon throws a `G9Error` rather than being ignored. An override may be an empty icon (`{ glyph: 'none' }`), as MAUI allowed `G9IconSource.Empty`. |
220
+ | `svgForGlyph` | function | The SVG document of a built-in glyph for Lynx `<svg content>` (WP02 renders it): the golden MAUI drawing with every `currentColor` replaced by `color` and the stroke width scaled by `weightScale` (MAUI `G9GlyphDrawable.Color`, `WeightScale`; stroke = 2 design units × weight; filled dots keep their recorded radius). `'none'` returns `''` (renders nothing). `color` defaults to `currentColor`; any other value must be a CSS colour `parseColor` reads and is written normalised (`formatColor`). Invalid glyph, colour or weight (finite, above 0) throws a `G9Error`. Results come from a shared bounded LRU cache (`createGlyphSvgCache` for a private one). |
221
+ | `toIcon` | function | Normalises a slot value (MAUI implicit `G9Glyph` conversion): a `G9Glyph` string becomes `glyphIcon(value)`, an icon is validated and returned, `null`/`undefined` become `null` (no icon). Anything malformed throws a `G9Error`. |
222
+ | `G9Glyph` | enum | The library's own built-in glyph set (MAUI `G9Glyph`): the control-chrome affordances the controls need to look right with no icon font configured. They are vector paths (MAUI ADR-0003), rendered as SVG by `svgForGlyph`; for anything else register an icon font (`createIconFontRegistry`) and pass a font icon. Values are the camelCase member names. |
223
+ | `g9DefaultGlyphSlots` | constant | The built-in defaults of every slot, in MAUI declaration order (MAUI `G9Glyphs` initialisers and `Reset()`). |
224
+ | `g9Glyphs` | constant | Every glyph in MAUI declaration order; the index is the MAUI enum number (`'none'` is 0). |
225
+ | `g9GlyphSlotNames` | constant | Every slot name, in MAUI declaration order. |
226
+ | `g9GlyphStrokeUnits` | constant | Stroke width of the built-in glyphs in 24 × 24 design-box units at weight 1 (MAUI `G9GlyphDrawable.StrokeUnits`). |
227
+ | `g9GlyphSvg` | constant | Every built-in glyph as the SVG document the original MAUI drawing code produced (24 × 24 box, stroke `g9GlyphStrokeUnits`, round caps and joins, colour `currentColor`), keyed by the `G9Glyph` value, in MAUI declaration order. Render through `svgForGlyph`, which substitutes the colour and the weight. |
228
+ | `g9GlyphSvgCacheDefaultSize` | constant | Default capacity of a glyph SVG cache: every glyph in a few colours and weights. |
229
+ | `G9FontCodePointIcon` | interface | A glyph of an icon font, given as a code point (MAUI `G9IconSource.FromCodePoint`). `font` is the font family the renderer uses (MAUI: the enum type name / the `fonts.AddFont` alias). |
230
+ | `G9FontTextIcon` | interface | A glyph of an icon font, given as its literal text (MAUI `G9IconSource.FromFont`), e.g. a surrogate pair or a ligature. |
231
+ | `G9GlyphIcon` | interface | A built-in vector glyph (MAUI `G9IconSource.FromGlyph`). `{ glyph: 'none' }` is an empty icon. |
232
+ | `G9GlyphSlots` | interface | The icons the controls draw for themselves, and the one place to replace them (MAUI `G9Glyphs`). Every slot defaults to a built-in glyph; an app supplies overrides through `G9Provider settings.glyphs` (WP02, specs/03 §6) instead of mutating statics. Per MAUI ADR-0021, a control that exposes a slot draws every icon of that kind from the slot. |
233
+ | `G9GlyphSvgCache` | interface | A bounded least-recently-used cache of rendered glyph SVG documents. |
234
+ | `G9IconFontRegistry` | interface | The registry of icon fonts and the by-name lookup that turns a name decided at runtime (an API response, a config row) into an icon (MAUI `G9IconFonts`). One registry per app; the WP02 provider owns it (no module-level state). |
235
+ | `G9ImageIcon` | interface | An icon given as an image. |
236
+ | `G9SvgIcon` | interface | An icon given as an SVG document (rendered with Lynx `<svg content>` in WP02). |
237
+ | `G9DrawableGlyph` | type | A glyph that draws something: every `G9Glyph` except `'none'`. |
238
+ | `G9FontIcon` | type | A glyph of an icon font. Two font icons are equal when their family and glyph text are equal. |
239
+ | `G9GlyphSlot` | type | A slot name of `G9GlyphSlots`. |
240
+ | `G9GlyphSlotOverrides` | type | Per-slot replacements; an omitted or `undefined` slot keeps its default. |
241
+ | `G9Icon` | type | One icon from any source: the single type every icon slot accepts (MAUI `G9IconSource`, ADR-0002). A slot with no icon is `null`/`undefined` (MAUI `G9IconSource.Empty`); `{ glyph: 'none' }` is also empty. |
242
+ | `G9IconFontMemberValue` | type | The value of each member of an icon-font table: glyph text (MAUI `[Description]`) or a code point (MAUI `Valve = 0xE801` without a description). |
243
+ | `G9ImageSource` | type | A bitmap or vector image (plan/specs/03-API-Conventions.md §2); rendering needs the host image service (WP02). |
244
+
245
+ ## `@g9tm/lynxcontrols-foundation/enums`
246
+
247
+ | Export | Kind | Summary |
248
+ | --- | --- | --- |
249
+ | `G9ButtonVariant` | enum | Colour role of a button-like control (MAUI `G9ButtonVariant`). Default for buttons: `'primary'`. |
250
+ | `G9CascadeDirection` | enum | Direction a cascade (drill-down) panel moves in (MAUI `G9CascadeDirection`); `'auto'` follows the direction. |
251
+ | `G9CascadeTransition` | enum | How the next cascade level appears (MAUI `G9CascadeTransition`): over the current one, or pushing it out. |
252
+ | `G9ChipGroupLayoutMode` | enum | Layout of a chip group (MAUI `G9ChipGroupLayoutMode`): wrapping rows or one horizontally scrolling line. |
253
+ | `G9ChipGroupSelectionMode` | enum | Selection behaviour of a chip group (MAUI `G9ChipGroupSelectionMode`). |
254
+ | `G9ControlSize` | enum | Size step of a control (MAUI `G9ControlSize`). Default for controls: `'medium'`. |
255
+ | `G9DateTimeDisplayFormat` | enum | How a picked date/time is displayed (MAUI `G9DateTimeDisplayFormat`); `'custom'` uses the caller's pattern. |
256
+ | `G9DateTimePickerMode` | enum | What a date/time picker edits (MAUI `G9DateTimePickerMode`). |
257
+ | `G9FilledValueHighlight` | enum | How a filled field's value is highlighted (MAUI `G9FilledValueHighlight`): `'inherit'` takes the app-wide setting, `'accent'` tints with the primary colour, `'neutral'` keeps the regular text colour. |
258
+ | `G9InputType` | enum | Semantic input type of a text field (MAUI `G9InputType`). One value drives the keyboard, the live keystroke filter and the on-blur validation; the policy itself (filters, validation, LTR preference) lands with the fields in WP03. |
259
+ | `G9KeyboardType` | enum | On-screen keyboard of a text field (MAUI `G9KeyboardType`). |
260
+ | `G9PinEntryType` | enum | Characters a PIN entry accepts (MAUI `G9PinEntryType`); `'password'` masks them. |
261
+ | `G9ProgressLabelPlacement` | enum | Where a progress bar's label sits (MAUI `G9ProgressLabelPlacement`). |
262
+ | `G9ProgressType` | enum | Colour role of a progress indicator (MAUI `G9ProgressType`). |
263
+ | `G9RangeSliderMode` | enum | One thumb or two (MAUI `G9RangeSliderMode`). |
264
+ | `G9SeparatorTitleAlignment` | enum | Alignment of a separator's title (MAUI `G9SeparatorTitleAlignment`); `'auto'` follows the direction. |
265
+ | `G9TabBarPosition` | enum | Where a tab bar sits (MAUI `G9TabBarPosition`). |
266
+ | `G9TabMode` | enum | Tab width behaviour (MAUI `G9TabMode`): equal fixed tabs or a scrolling strip. |
267
+ | `G9TabStyle` | enum | Tab indicator style (MAUI `G9TabStyle`). |
268
+ | `G9TextInputDirection` | enum | Writing direction of a field's entered value (MAUI `G9TextInputDirection`). `'matchParent'` follows the culture. |
269
+
270
+ ## `@g9tm/lynxcontrols-foundation/exec`
271
+
272
+ | Export | Kind | Summary |
273
+ | --- | --- | --- |
274
+ | `createDiagnostics` | function | Creates a `G9Diagnostics` hub. |
275
+ | `createDiagnosticsReport` | function | Creates a frozen `G9DiagnosticsReport` (MAUI positional record constructor). |
276
+ | `createFireAndForgetOperationOptions` | function | Observed event callbacks run fire-and-forget (MAUI `CreateFireAndForgetOperationOptions`). |
277
+ | `createOperationTrace` | function | Creates a trace that starts now. |
278
+ | `createSafeExecutor` | function | Creates a `G9SafeExecutor`. One per control or screen; dispose it on unmount. |
279
+ | `createSilentOperationOptions` | function | Silent nested/background work that must not block siblings (MAUI `CreateSilentOperationOptions`). |
280
+ | `createUiOperationOptions` | function | Traced UI operations that reject same-key overlap (MAUI `CreateUiOperationOptions`). |
281
+ | `describeError` | function | The full text of an error (MAUI `Exception.ToString()`): the stack when the runtime has one. |
282
+ | `formatRoundTripUtc` | function | `.NET` round-trip ("O") formatting of a UTC instant: `2024-03-20T06:36:26.1230000+00:00`. |
283
+ | `resolveExecutionDelay` | function | The delay actually applied: `delayBeforeExecutionMs` when positive, else `busyDelayMs` (MAUI precedence). |
284
+ | `resolveSafeExecutorOptions` | function | Applies `options` over `base`, validating every field. |
285
+ | `G9LogLevel` | enum | Log severity (MAUI used `Microsoft.Extensions.Logging.LogLevel`; same names, camelCase). |
286
+ | `g9DefaultSafeExecutorOptions` | constant | The MAUI defaults (`G9SafeCommandOptions.Default`). |
287
+ | `g9RuntimeTimers` | constant | The runtime's timers, safe on every Lynx thread host (bundle-scope identifiers, not `globalThis` properties). Every G9 timer goes through this or an injected `G9Timers`. |
288
+ | `G9ActivityScope` | interface | Closes an activity started with `G9Diagnostics.activity`. Idempotent. |
289
+ | `G9Diagnostics` | interface | The library's observation seam (MAUI `G9Diagnostics`, plus `G9SafeCommand.OperationFailed` and the logger): a host learns that something started, finished, failed or was logged, without the library deciding what that means. Not a testing feature. Every listener call is guarded: an observer that throws never breaks the operation it observes (its error goes to `onListenerError` when given). One hub per app; the WP02 provider owns it. |
290
+ | `G9DiagnosticsOptions` | interface | Options of `createDiagnostics`. |
291
+ | `G9DiagnosticsReport` | interface | Everything a safe executor knows about a failed operation (MAUI `G9DiagnosticsReport`), handed to `onOperationFailed` observers and to the app's "More details" surface. |
292
+ | `G9ErrorPopupRequest` | interface | What the host's error presenter shows (MAUI's error popup with OK and the optional "More details"). |
293
+ | `G9LogEntry` | interface | One log line (MAUI wrote these to `ILogger`). |
294
+ | `G9OperationTrace` | interface | Step-by-step record of one operation (MAUI `G9OperationTrace`), passed to every safe-executor action so the "More details" report says what had already succeeded. Steps are also logged. |
295
+ | `G9OperationTraceOptions` | interface | Options of `createOperationTrace`. |
296
+ | `G9ResolvedSafeExecutorOptions` | interface | `G9SafeExecutorOptions` with every default applied. |
297
+ | `G9SafeExecutor` | interface | The one guarded-execution state machine (MAUI `G9SafeCommand`, specs/03 §4): throttle and same-key concurrency guards, optional delay, busy reporting, trace, timeout, cancellation, error routing (diagnostics → `onError` → popup → optional rethrow, all after the guards are released). Every run settles its promise exactly once. |
298
+ | `G9SafeExecutorConfig` | interface | Configuration of `createSafeExecutor`; the WP02 provider fills it from its services and settings. |
299
+ | `G9SafeExecutorOptions` | interface | Options of one guarded run (MAUI `G9SafeCommandOptions`). Every field is optional; executor-level `defaults` apply first, then these. Defaults are the MAUI defaults. |
300
+ | `G9SafeExecutorSnapshot` | interface | Busy state of an executor, for a control's spinner. |
301
+ | `G9SafeRunContext` | interface | What a guarded action receives. |
302
+ | `G9ShowOperationErrorOptions` | interface | Options of `G9SafeExecutor.showOperationError`. |
303
+ | `G9Timers` | interface | Timer functions; default the runtime's `setTimeout`/`clearTimeout`. |
304
+ | `G9TraceEntry` | interface | One recorded step. `elapsedMs` is measured from the trace's start. |
305
+ | `G9TraceFailure` | interface | A user-facing failure recorded with `G9OperationTrace.fail`. |
306
+ | `G9SafeAction` | type | A guarded action. It may be synchronous; it then runs inside `run()` itself when there is no delay. |
307
+ | `G9SafeRunResult` | type | How a run ended. Expected outcomes are results (specs/03 §7); `failed` carries the error and the report that was routed to diagnostics, `onError` and the popup. |
308
+ | `G9TraceLevel` | type | Severity of a trace entry. |
309
+
310
+ ## `@g9tm/lynxcontrols-foundation/services`
311
+
312
+ | Export | Kind | Summary |
313
+ | --- | --- | --- |
314
+ | `assertRequiredCapabilities` | function | Checks every required capability at once (the provider calls this at mount). |
315
+ | `createAbortController` | function | A runtime `AbortController` when there is one, otherwise `createPortableAbortController`. |
316
+ | `createAbortError` | function | An `Error` named `'AbortError'`, the shape web APIs and `isAbortError` agree on. |
317
+ | `createManualClock` | function | Creates a `G9ManualClock`. |
318
+ | `createMemoryPreferenceStore` | function | An in-memory store (MAUI `G9InMemoryPreferenceStore`): for tests, previews, and apps that opt out of persistence. Synchronous. Values are typed: an integer is not readable as a string and vice versa, as in MAUI. |
319
+ | `createMonotonicFromWall` | function | A monotonic counter built from a wall clock: it advances by every positive step of `wallNow` and ignores backward steps, so a clock corrected backwards pauses nothing and a forward jump only makes time pass faster once. |
320
+ | `createPortableAbortController` | function | The portable controller used when the runtime has no `AbortController`. Listeners run once, in order, guarded. |
321
+ | `createPreferences` | function | Creates the root `G9Preferences` over a store. One per app; the WP02 provider owns it. |
322
+ | `createSystemClock` | function | The system clock: `Date.now()` for wall time; `performance.now()` for monotonic time where the runtime has it (the Lynx typings do not promise it), otherwise `createMonotonicFromWall` over `Date.now()`. |
323
+ | `hasCapability` | function | `true` when the capability is present (optional features use this to hide themselves). |
324
+ | `isAbortError` | function | `true` for an error named `'AbortError'` (web `DOMException`, our `createAbortError`, most libraries). |
325
+ | `requireCapability` | function | The capability, or throws `G9CapabilityMissingError` naming it. |
326
+ | `g9PreferenceKeyPrefix` | constant | The prefix on every key the controls write (MAUI `G9Preferences.KeyPrefix`). |
327
+ | `g9RequiredCapabilities` | constant | Capabilities without which the provider cannot mount. |
328
+ | `G9CapabilityMissingError` | class | Thrown when code needs a capability the app did not supply (specs/03 §7: `G9CapabilityMissingError('speech')`). |
329
+ | `G9AbortController` | interface | Owner side of a `G9AbortSignal`. |
330
+ | `G9AbortSignal` | interface | The cancellation signal G9 passes to async work (MAUI `CancellationToken`, plan/specs/03-API-Conventions.md §2). A web `AbortSignal` satisfies it, so app code can hand it to `fetch`. The Lynx typings do not declare `AbortController`, and its presence on PrimJS is not verified, so `createAbortController` falls back to a small portable implementation when the runtime has none. |
331
+ | `G9Capabilities` | interface | Every service the app can supply. Required ones are listed in `g9RequiredCapabilities`. |
332
+ | `G9Clock` | interface | Time source of everything in G9 that needs "now" (plan/specs/01-Architecture.md §8). Supplied by the app through the provider; tests pass a manual clock. |
333
+ | `G9HostServices` | interface | Host integration the provider and overlays need (MAUI page/window plumbing), supplied by the native host. Required. The system back press does not go through this object: the host sends a global event (default `g9:back`, specs/02 §4) and the provider dispatches it to the active `G9Host`; `exit` is what happens when nothing handled it. |
334
+ | `G9ManualClock` | interface | A clock you move by hand (tests, previews). Both readings start at the given values and advance together. |
335
+ | `G9MediaPlayer` | interface | One video player created by the app's media provider. `view` is what the control renders (the platform video XElement the host registered, built by the app); the control never names a video tag itself. |
336
+ | `G9MediaPlayerOptions` | interface | Options of `G9MediaProvider.createPlayer`. |
337
+ | `G9MediaProvider` | interface | Resolves image and video sources for IntroCarousel and other media controls (WP09). Video is part of the contract on every target, desktop included (decision D14 is open; no scope reduction is accepted). A provider that cannot play video yet omits `createPlayer` or returns `false` from `supportsVideo`; controls then show the slide image and say why (`'video-unsupported'`). |
338
+ | `G9PreferenceKey` | interface | A typed handle on one key (see `G9Preferences.intKey` / `G9Preferences.stringKey`). |
339
+ | `G9Preferences` | interface | Typed, namespaced preferences over a store (MAUI `G9Preferences`), read synchronously from a hydrated snapshot. Reads never touch the store: `hydrate()` loads the namespace once; writes update the snapshot immediately, notify subscribers, then write through. A local write made before hydration finishes wins over the stored value. |
340
+ | `G9PreferencesOptions` | interface | Options of `createPreferences`. |
341
+ | `G9PreferencesSnapshot` | interface | The values of one namespace, keys relative to it. Immutable; a new object after every change. |
342
+ | `G9PreferenceStore` | interface | Where preferences are persisted (MAUI `IG9PreferenceStore`). Keys arrive already prefixed. The app supplies one through the provider: the Lynxtron, Android and iOS adapters (WP12–WP14) and `createMemoryPreferenceStore`. A store may throw or reject; `createPreferences` guards every call. |
343
+ | `G9PreferenceStoreFailure` | interface | Which store call failed, for `G9PreferencesOptions.onStoreError`. |
344
+ | `G9ResolvedMedia` | interface | A source resolved to something the platform can display; `uri` is what `<image>`/the video XElement load. |
345
+ | `G9SafeInsets` | interface | Safe-area insets in logical pixels. |
346
+ | `G9Scanner` | interface | Barcode/QR scanning supplied by the app (WP09 barcode package). Optional: without it the scan action is hidden. |
347
+ | `G9ScanOptions` | interface | Options of one scan. |
348
+ | `G9SpeechToText` | interface | Speech recognition for dictation into fields (MAUI `IG9SpeechToText`). Optional: without it the microphone affordance is hidden. A platform fault rejects with a `G9Error`. |
349
+ | `G9SpeechToTextOptions` | interface | Options of one dictation session. |
350
+ | `G9CapabilityName` | type | The name of a capability. |
351
+ | `G9MaybePromise` | type | A value or a promise of it: stores may be synchronous (memory) or asynchronous (a native module). |
352
+ | `G9MediaPlayerEvent` | type | What a `G9MediaPlayer` tells its owner. |
353
+ | `G9MediaSource` | type | A media reference as the app describes it (an asset name, a file or a remote URI). |
354
+ | `G9PermissionStatus` | type | Result of asking for a runtime permission. `'restricted'`: blocked by policy, the user cannot grant it. |
355
+ | `G9PreferenceValue` | type | What a preference holds: a 32-bit integer or a string (MAUI `IG9PreferenceStore` stores exactly these). |
356
+ | `G9ScanResult` | type | How a scan ended. |
357
+ | `G9SoftInputMode` | type | Android soft-input policy while a flow needs it (MAUI `G9KeyboardHelper.UseAndroidPanSoftInputMode`). |
358
+ | `G9SpeechToTextResult` | type | How a dictation session ended. Expected outcomes are results, not errors (specs/03 §7). |
359
+
360
+ ## `@g9tm/lynxcontrols-foundation`
361
+
362
+ | Export | Kind | Summary |
363
+ | --- | --- | --- |
364
+ | `addRange` | function | Appends every item of `more` (MAUI `AddRange`). Same reference when `more` is empty. |
365
+ | `removeRange` | function | Removes the first occurrence of each item of `remove` (MAUI `RemoveRange`), compared with `equals` (default `Object.is`). `remove` is read before anything is removed, so it may be derived from `items`. Same reference when nothing matched. |
366
+ | `replaceRange` | function | Replaces the whole list (MAUI `ReplaceRange`). `next` is read first, so it may be derived from `items` (a filter or a sort). Same reference when both the old and the new list are empty. |
367
+ | `replaceWith` | function | Replaces the whole list with one item (MAUI `Replace`). |
368
+ | `G9Error` | class | Base class of every unexpected G9 failure (plan/specs/03-API-Conventions.md §7). `code` is stable and safe to switch on; `message` is for people. |