@g9tm/lynxcontrols-foundation 0.0.0-stage → 1.4.2

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 +41 -0
  138. package/dist/tokens/css-vars.d.ts.map +1 -0
  139. package/dist/tokens/css-vars.js +55 -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 +369 -0
  157. package/docs/foundation.md +370 -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,132 @@
1
+ # Migration: `G9MAUIControls/Helpers` → `@g9tm/lynxcontrols-foundation`
2
+
3
+ Census card: `plan/census/units/Core.Helpers.md` (MAUI `6604cf0`). This table grows per slice: WP01.1 maps
4
+ `G9ColorHelper`; WP01.2 maps `G9RelativeTimeFormatter`; WP01.4 adds safe command, options, diagnostics, trace and the range collection. Types
5
+ owned by other work packages are mapped in their own packages' tables.
6
+
7
+ ## `G9ColorHelper` (WP01.1)
8
+
9
+ All functions take `G9ColorInput` (a CSS colour string or `G9Rgba` channels) and return `G9Rgba` at float32
10
+ precision, so chained arithmetic is bit-identical to MAUI's `Color` maths; `formatColor` turns a result into CSS.
11
+ Source: `packages/foundation/src/theme/color.ts`; tests: `packages/foundation/src/theme/color.test.ts`.
12
+
13
+ | MAUI | Lynx | Disposition | Tests |
14
+ | --- | --- | --- | --- |
15
+ | `G9ColorHelper.WithOpacity` | `withOpacity(color, opacity)`: `null`/`undefined` keeps the colour; a number or invariant numeric string sets the alpha (clamped 0–1); an unreadable string means 1 | preserved (NaN and the `Infinity` spellings also mean 1; .NET produced a NaN or clamped alpha there) | color.test.ts "withOpacity follows G9ColorHelper.WithOpacity" |
16
+ | `G9ColorHelper.Darken` | `darken(color, percentage)` | preserved | color.test.ts "darken scales RGB, keeps alpha, clamps the percentage" |
17
+ | `G9ColorHelper.Lighten` | `lighten(color, percentage)` | preserved | color.test.ts "lighten moves towards white, keeps alpha, clamps" |
18
+ | `G9ColorHelper.Mix` | `mix(first, second, ratio)` | preserved | color.test.ts "mix interpolates all four channels" |
19
+ | `G9ColorHelper.CreateBorderColor` | `createBorderColor(base)` (15 % darker) | preserved | color.test.ts "border, hover and pressed are 15 %, 8 % and 20 % darker" |
20
+ | `G9ColorHelper.CreateHoverColor` | `createHoverColor(base)` (8 % darker) | preserved | color.test.ts "border, hover and pressed are 15 %, 8 % and 20 % darker" |
21
+ | `G9ColorHelper.CreatePressedColor` | `createPressedColor(base)` (20 % darker) | preserved | color.test.ts "border, hover and pressed are 15 %, 8 % and 20 % darker" |
22
+ | `G9ColorHelper.ToHex` | `toHex(color)`: `#RRGGBB`, no alpha, float32 × 255 truncated exactly like MAUI (`formatColor` is the rounding, alpha-aware CSS formatter) | preserved | color.test.ts "drops alpha and truncates each float32 channel × 255" |
23
+ | `G9ColorHelper.GetLuminance` | `getLuminance(color)` | preserved | color.test.ts "matches the WCAG formula the MAUI helper uses" |
24
+ | `G9ColorHelper.GetContrastingTextColor` | `getContrastingTextColor(background)`: black above luminance 0.5, else white | preserved | color.test.ts "picks black text on light backgrounds and white on dark ones" |
25
+ | `G9ColorHelper.GetContrastRatio` | `getContrastRatio(first, second)` | preserved | color.test.ts "matches the WCAG formula the MAUI helper uses"; "contrast ratio stays within 1..21 (property)" |
26
+ | `G9ColorHelper.MeetsWcagAA` | `meetsWcagAA(foreground, background)` (≥ 4.5) | preserved | color.test.ts "applies the WCAG AA (4.5) and AAA (7) thresholds" |
27
+ | `G9ColorHelper.MeetsWcagAAA` | `meetsWcagAAA(foreground, background)` (≥ 7) | preserved | color.test.ts "applies the WCAG AA (4.5) and AAA (7) thresholds" |
28
+
29
+ ## `G9RelativeTimeFormatter` (WP01.2)
30
+
31
+ Source: `packages/foundation/src/culture/relative-time.ts`; tests: `relative-time.test.ts`.
32
+
33
+ | MAUI | Lynx | Disposition | Tests |
34
+ | --- | --- | --- | --- |
35
+ | `G9RelativeTimeFormatter.FormatAgo` | `formatAgo(instantMs, { now, strings })`: `now` is a clock (`{ now(): number }`) or epoch ms; same buckets and truncation as MAUI (`getRelativeTimeParts` exposes them) | changed: takes an absolute instant, so a Local/Unspecified `DateTime` is no longer shifted by the machine's UTC offset (MAUI subtracted it from `DateTimeOffset.UtcNow`); counts use the culture's digits (MAUI's documented intent; .NET wrote Latin digits under fa-IR, reproduced with `numberingSystem: 'latin'`) | relative-time.test.ts "reproduces every golden phrase for en-US and fa-IR (.NET writes Latin digits under fa-IR)"; "takes an absolute instant: the MAUI local/unspecified DateTime shift cannot happen"; "buckets at the MAUI boundaries" |
36
+ | `G9RelativeTimeFormatter.FormatAgoWithTime` | `formatAgoWithTime(instantMs, { now, strings, utcOffsetMinutes })` → `'6 h ago - 09:30'` | changed: the wall clock's UTC offset is an explicit argument (Lynx has no time-zone data); time digits follow the culture | relative-time.test.ts "joins the phrase and HH:mm at the given offset, in the culture digits" |
37
+
38
+ ## `G9SafeCommand` (WP01.4)
39
+
40
+ `createSafeExecutor(config)` is the one guarded-execution state machine (specs/03 §4); controls get theirs from the
41
+ WP02 provider, which supplies the clock, diagnostics hub, strings and error presenter. Per run: guards (disposed,
42
+ caller signal, throttle, same-key concurrency) → optional delay (guards held) → `setBusy(true)`, `operationStarted`
43
+ → action → `operationCompleted`, `setBusy(false)`, guards released → failure routing: `operationFailed` → `onError` →
44
+ popup → optional rethrow. Additions over MAUI, all opt-in: `timeoutMs`, a caller `signal`, `dispose()` (unmount: runs
45
+ settle at once as cancelled, late completions are ignored) and a busy snapshot for spinners. An action that throws an
46
+ `AbortError` is a quiet cancellation (MAUI `OperationCanceledException`); MAUI's separate `ObjectDisposedException`
47
+ swallow has no JS equivalent and is covered by `dispose()`. Logging (`ILogger`) becomes the hub's `onLog`.
48
+ Source: `packages/foundation/src/exec/`; tests: `safe-executor.test.ts`, `diagnostics-trace.test.ts`.
49
+
50
+ | MAUI | Lynx | Disposition | Tests |
51
+ | --- | --- | --- | --- |
52
+ | `G9SafeCommand.RunAsync( Func<G9OperationTrace, Task> action, G9SafeCommandOptions? options = null, [CallerMemberName] string callerMember = "", [CallerFilePath] string callerFile = "")` | `executor.run(action, options)`: the action gets `{ signal, trace, key, source }`; resolves to a `G9SafeRunResult` | idiomatic: one executor per control/screen (`createSafeExecutor`) instead of a static class; the key defaults to the executor's `defaults.throttleKey` (`'default'`) because JS has no `[CallerMemberName]`; outcomes are results (`completed`/`skipped`/`cancelled`/`failed`) instead of a bare `Task` | safe-executor.test.ts "runs a synchronous action inside run(), with busy and started/completed around it"; "routes a failure in MAUI order after the guard is released: failed → onError → popup → settle" |
53
+ | `G9SafeCommand.RunAsync<T>( Func<G9OperationTrace, Task<T>> action, G9SafeCommandOptions? options = null, [CallerMemberName] string callerMember = "", [CallerFilePath] string callerFile = "")` | `executor.run(action)` → `{ status: 'completed', value }` | changed: a failed or skipped run returns its status instead of `default(T)`, so "no value" and "failed" are distinguishable | safe-executor.test.ts "awaits an async action and reports its elapsed time; snapshot goes busy then idle"; "busy resets after an async rejection; the report carries the trace and the error" |
54
+ | `G9SafeCommand.RunAsync( Func<Task> action, G9SafeCommandOptions? options = null, [CallerMemberName] string callerMember = "", [CallerFilePath] string callerFile = "")` | `executor.run(() => …)` (the context argument may be ignored) | idiomatic: one signature covers traced and untraced actions | safe-executor.test.ts "awaits an async action and reports its elapsed time; snapshot goes busy then idle" |
55
+ | `G9SafeCommand.RunAsync<TBackground>( Func<Task<TBackground>> runOnBackgroundThread, Func<TBackground, Task> runOnMainThread, G9SafeCommandOptions? options = null, [CallerMemberName] string callerMember = "", [CallerFilePath] string ca…` | `executor.run(async (ctx) => { const v = await load(ctx); return apply(v, ctx); })` | changed: ReactLynx business code runs on the background thread and a foundation function cannot call a `'main thread'` worklet (specs/02 §3), so there is no thread hand-off; both phases run in sequence inside one guarded run (UI-thread work goes through ReactLynx `runOnMainThread` in WP02+) | safe-executor.test.ts "two phases compose inside one guarded run (MAUI background → main-thread overloads)" |
56
+ | `G9SafeCommand.RunAsync<TBackground>( Func<G9OperationTrace, Task<TBackground>> runOnBackgroundThread, Func<TBackground, G9OperationTrace, Task> runOnMainThread, G9SafeCommandOptions? options = null, [CallerMemberName] string callerMem…` | `executor.run(async (ctx) => { const v = await load(ctx); return apply(v, ctx); })` | changed: ReactLynx business code runs on the background thread and a foundation function cannot call a `'main thread'` worklet (specs/02 §3), so there is no thread hand-off; both phases run in sequence inside one guarded run (UI-thread work goes through ReactLynx `runOnMainThread` in WP02+) | safe-executor.test.ts "two phases compose inside one guarded run (MAUI background → main-thread overloads)" |
57
+ | `G9SafeCommand.RunAsync<TBackground, TResult>( Func<Task<TBackground>> runOnBackgroundThread, Func<TBackground, Task<TResult>> runOnMainThread, G9SafeCommandOptions? options = null, [CallerMemberName] string callerMember = "", [CallerFilePath] …` | `executor.run(async (ctx) => { const v = await load(ctx); return apply(v, ctx); })` | changed: ReactLynx business code runs on the background thread and a foundation function cannot call a `'main thread'` worklet (specs/02 §3), so there is no thread hand-off; both phases run in sequence inside one guarded run (UI-thread work goes through ReactLynx `runOnMainThread` in WP02+) | safe-executor.test.ts "two phases compose inside one guarded run (MAUI background → main-thread overloads)" |
58
+ | `G9SafeCommand.RunAsync<TBackground, TResult>( Func<G9OperationTrace, Task<TBackground>> runOnBackgroundThread, Func<TBackground, G9OperationTrace, Task<TResult>> runOnMainThread, G9SafeCommandOptions? options = null, [CallerMemberName] string …` | `executor.run(async (ctx) => { const v = await load(ctx); return apply(v, ctx); })` | changed: ReactLynx business code runs on the background thread and a foundation function cannot call a `'main thread'` worklet (specs/02 §3), so there is no thread hand-off; both phases run in sequence inside one guarded run (UI-thread work goes through ReactLynx `runOnMainThread` in WP02+) | safe-executor.test.ts "two phases compose inside one guarded run (MAUI background → main-thread overloads)" |
59
+ | `G9SafeCommand.RunSafe( Func<Task> action, G9SafeCommandOptions? options = null, [CallerMemberName] string callerMember = "", [CallerFilePath] string callerFile = "")` | `executor.runSafe(action, options)` | preserved: fire-and-forget; a rethrown failure is logged, never unobserved | safe-executor.test.ts "runSafe observes a rethrown failure and logs it instead of leaving it unhandled" |
60
+ | `G9SafeCommand.RunSafe( Action action, G9SafeCommandOptions? options = null, [CallerMemberName] string callerMember = "", [CallerFilePath] string callerFile = "")` | `executor.runSafe(() => { … })` | idiomatic: a synchronous action is accepted by the same function | safe-executor.test.ts "runSafe observes a rethrown failure and logs it instead of leaving it unhandled" |
61
+ | `G9SafeCommand.Run( Action<G9OperationTrace> action, G9SafeCommandOptions? options = null, [CallerMemberName] string callerMember = "", [CallerFilePath] string callerFile = "")` | `executor.run(({ trace }) => { … })`: a synchronous action runs inside `run()` itself when there is no delay; busy is set and cleared before `run()` returns | changed: JS cannot block, so the delay is awaited (MAUI blocked the thread on `Task.Delay`) and the error popup is awaited before the promise settles (MAUI's sync overload fired it and forgot) | safe-executor.test.ts "runs a synchronous action inside run(), with busy and started/completed around it"; "busy resets and the guard is released after a synchronous throw" |
62
+ | `G9SafeCommand.Run( Action action, G9SafeCommandOptions? options = null, [CallerMemberName] string callerMember = "", [CallerFilePath] string callerFile = "")` | `executor.run(() => { … })` | changed: as `Run(Action<G9OperationTrace>)` | safe-executor.test.ts "busy resets and the guard is released after a synchronous throw" |
63
+ | `G9SafeCommand.ShowOperationErrorAsync` | `executor.showOperationError(message, { title, diagnosticsText, exceptions, source })`: builds a `G9ErrorPopupRequest` (title, message, OK text, optional "More details") for the configured `showError` presenter; never rejects; a blank message shows nothing | changed: foundation renders nothing, so the popup is drawn by the presenter the WP02/WP07 provider passes as `showError`; without one the request is logged as a warning instead of shown | safe-executor.test.ts "shows nothing for a blank message and logs when there is no presenter"; "offers More details only with a handler and an allowing gate; the handler gets the report"; "a throwing diagnostics handler or presenter never escapes" |
64
+ | `G9SafeCommand.CreateUiOperationOptions` | `createUiOperationOptions(source, throttleKey)` | preserved | safe-executor.test.ts "the three option factories match MAUI" |
65
+ | `G9SafeCommand.CreateSilentOperationOptions` | `createSilentOperationOptions(source, throttleKey)` | preserved | safe-executor.test.ts "the three option factories match MAUI" |
66
+ | `G9SafeCommand.CreateFireAndForgetOperationOptions` | `createFireAndForgetOperationOptions(source, throttleKey)` | preserved | safe-executor.test.ts "the three option factories match MAUI" |
67
+ | `G9SafeCommand.TryThrottle` | `executor.tryThrottle(key, minIntervalMs = 369)`: monotonic clock (`G9Clock.monotonicNow`), stale entries dropped after a minute, a blank key throws `G9Error` `safe-options` | preserved (per executor instead of process-wide) | safe-executor.test.ts "tryThrottle / resetThrottle follow MAUI: per key, default 369 ms, blank keys rejected, stale entries cleaned"; "throttles a second run of the key within 369 ms, by monotonic time" |
68
+ | `G9SafeCommand.ResetThrottle` | `executor.resetThrottle()` (throttle stamps and in-flight keys) | preserved | safe-executor.test.ts "resetThrottle also clears the in-flight set (MAUI: logout / tests)" |
69
+ | `G9SafeCommand.DiagnosticsHandler` | `createSafeExecutor({ diagnosticsHandler })`, reached through `G9ErrorPopupRequest.moreDetails.open()` | idiomatic: configuration instead of a mutable static (specs/03 §6) | safe-executor.test.ts "offers More details only with a handler and an allowing gate; the handler gets the report" |
70
+ | `G9SafeCommand.DiagnosticsAvailable` | `createSafeExecutor({ diagnosticsAvailable })`, asked per popup; a throwing gate hides "More details" | idiomatic: configuration instead of a mutable static | safe-executor.test.ts "offers More details only with a handler and an allowing gate; the handler gets the report" |
71
+ | `G9SafeCommand.OperationFailed` | `diagnostics.onOperationFailed(listener)`: once per failure (error, timeout, `trace.fail`), after busy and guards are released, popup or not; source `source/key`, exceptions `[]` for `trace.fail` | idiomatic: a subscription on the diagnostics hub instead of a static delegate | safe-executor.test.ts "busy resets after an async rejection; the report carries the trace and the error"; "trace.fail reports without an exception: popup with the user message, no onError, no rethrow" |
72
+
73
+ ## `G9SafeCommandOptions` (WP01.4)
74
+
75
+ Per-run `G9SafeExecutorOptions` are layered over `createSafeExecutor({ defaults })`, which is layered over the MAUI
76
+ defaults. Every field is validated (`G9Error` `safe-options`); durations are milliseconds and negative ones clamp to 0
77
+ as in MAUI.
78
+
79
+ | MAUI | Lynx | Disposition | Tests |
80
+ | --- | --- | --- | --- |
81
+ | `G9SafeCommandOptions.PreventConcurrentExecution` | `preventConcurrentExecution` (default `true`) | preserved | safe-executor.test.ts "skips a same-key run while one is in flight; other keys run; the key is free again afterwards"; "property: with the guard on, a key never runs concurrently, whatever the call/settle interleaving"; "preventConcurrentExecution: false lets same-key runs overlap" |
82
+ | `G9SafeCommandOptions.ThrottleKey` | `throttleKey` (default: executor `defaults.throttleKey`, else `'default'`) | changed: no caller-member auto key in JS; a blank key is rejected (`safe-options`) instead of silently aborting the run | safe-executor.test.ts "skips a same-key run while one is in flight; other keys run; the key is free again afterwards"; "rejects invalid options and a non-function action before touching any state" |
83
+ | `G9SafeCommandOptions.ThrottleInterval` | `throttleIntervalMs` (default `369`) | renamed: milliseconds | safe-executor.test.ts "throttles a second run of the key within 369 ms, by monotonic time" |
84
+ | `G9SafeCommandOptions.EnableThrottle` | `enableThrottle` (default `true`) | preserved | safe-executor.test.ts "throttles a second run of the key within 369 ms, by monotonic time" |
85
+ | `G9SafeCommandOptions.ErrorMessage` | `errorMessage` (default: the `UnexpectedError` string) | preserved | safe-executor.test.ts "routes a failure in MAUI order after the guard is released: failed → onError → popup → settle"; "uses localised defaults for the title, button and message" |
86
+ | `G9SafeCommandOptions.ErrorTitle` | `errorTitle` (default: the `Error` string) | preserved | safe-executor.test.ts "routes a failure in MAUI order after the guard is released: failed → onError → popup → settle"; "uses localised defaults for the title, button and message" |
87
+ | `G9SafeCommandOptions.Source` | `source` (default: executor `defaults.source`, else `'unknown'`) | changed: no caller-file default in JS | safe-executor.test.ts "busy resets after an async rejection; the report carries the trace and the error" |
88
+ | `G9SafeCommandOptions.ShowErrorG9Popup` | `showErrorPopup` (default `true`), shown through the configured `showError` presenter | renamed | safe-executor.test.ts "routes a failure in MAUI order after the guard is released: failed → onError → popup → settle"; "busy resets and the guard is released after a synchronous throw" |
89
+ | `G9SafeCommandOptions.RethrowException` | `rethrow` (default `false`): the run's promise rejects with the original error after reporting (errors and timeouts, never `trace.fail`) | renamed | safe-executor.test.ts "a throwing onError is contained; rethrow rejects with the original error after reporting"; "a timeout with rethrow rejects the run with the timeout error" |
90
+ | `G9SafeCommandOptions.SetBusy` | `setBusy(busy)`: `true` after the delay when the action starts, `false` on every exit (completion, throw, timeout, caller abort, dispose); a throwing callback is logged | preserved | safe-executor.test.ts "busy resets and the guard is released after a synchronous throw"; "timeout fails the run, aborts its signal, resets busy and frees the key; late completion is ignored"; "dispose settles every run at once as cancelled, resets busy, completes diagnostics, ignores late completion" |
91
+ | `G9SafeCommandOptions.OnError` | `onError(error)`: after the guards are released, before the popup; also for timeouts; a throwing handler is logged | preserved | safe-executor.test.ts "routes a failure in MAUI order after the guard is released: failed → onError → popup → settle"; "a throwing onError is contained; rethrow rejects with the original error after reporting" |
92
+ | `G9SafeCommandOptions.BusyDelay` | `busyDelayMs` (default `0`; negative → 0) | renamed: milliseconds | safe-executor.test.ts "waits delayBeforeExecutionMs (over busyDelayMs) holding the guard, then sets busy and runs"; "resolveExecutionDelay: DelayBeforeExecution wins when positive, else BusyDelay" |
93
+ | `G9SafeCommandOptions.DelayBeforeExecution` | `delayBeforeExecutionMs` (default `0`; wins over `busyDelayMs` when positive); the guards are held during the delay, as in MAUI | renamed: milliseconds | safe-executor.test.ts "waits delayBeforeExecutionMs (over busyDelayMs) holding the guard, then sets busy and runs"; "dispose during the delay: the action never runs and busy was never set" |
94
+ | `G9SafeCommandOptions.RunActionOnMainThread` | not an option: actions run on the background thread; UI-thread work inside an action uses ReactLynx `runOnMainThread` (WP02+) | changed: foundation cannot dispatch to the Lynx main thread (specs/02 §3), and accepting the flag would be a silent no-op (AGENTS rule 5) | safe-executor.test.ts "defaults are the MAUI defaults" (the resolved options have no such field) |
95
+ | `G9SafeCommandOptions.Default` | `g9DefaultSafeExecutorOptions` (frozen) and `resolveSafeExecutorOptions(options, base)` | preserved; adds `timeoutMs` (none by default) and `signal` (caller cancellation) | safe-executor.test.ts "defaults are the MAUI defaults"; "layers per-run options over executor defaults and validates every field" |
96
+
97
+ ## `G9Diagnostics`, `G9DiagnosticsReport`, `G9OperationTrace` (WP01.4)
98
+
99
+ Source: `packages/foundation/src/exec/diagnostics.ts`, `trace.ts`; tests: `diagnostics-trace.test.ts`.
100
+
101
+ | MAUI | Lynx | Disposition | Tests |
102
+ | --- | --- | --- | --- |
103
+ | `G9Diagnostics.OperationStarted` | `diagnostics.onOperationStarted((source, key) => …)` → unsubscribe | idiomatic: a subscription on a hub created with `createDiagnostics()` (no mutable static, specs/03 §6) | diagnostics-trace.test.ts "raises started/completed/activity/failed/log to every listener; unsubscribe stops delivery"; safe-executor.test.ts "runs a synchronous action inside run(), with busy and started/completed around it" |
104
+ | `G9Diagnostics.OperationCompleted` | `diagnostics.onOperationCompleted((source, key, elapsedMs) => …)`: exactly once for every started run, including timeout, caller abort and dispose | idiomatic | diagnostics-trace.test.ts "raises started/completed/activity/failed/log to every listener; unsubscribe stops delivery"; safe-executor.test.ts "dispose settles every run at once as cancelled, resets busy, completes diagnostics, ignores late completion"; "timeout fails the run, aborts its signal, resets busy and frees the key; late completion is ignored" |
105
+ | `G9Diagnostics.ActivityChanged` | `diagnostics.onActivityChanged((name, busy) => …)` | idiomatic | diagnostics-trace.test.ts "raises started/completed/activity/failed/log to every listener; unsubscribe stops delivery" |
106
+ | `G9Diagnostics.RaiseOperationStarted` | `diagnostics.raiseOperationStarted(source, key)`: never throws; listener errors go to `onListenerError` | preserved | diagnostics-trace.test.ts "a throwing listener never breaks the raise; other listeners still run; the error is reported" |
107
+ | `G9Diagnostics.RaiseOperationCompleted` | `diagnostics.raiseOperationCompleted(source, key, elapsedMs)` | preserved | diagnostics-trace.test.ts "raises started/completed/activity/failed/log to every listener; unsubscribe stops delivery" |
108
+ | `G9Diagnostics.RaiseActivityChanged` | `diagnostics.raiseActivityChanged(name, busy)` | preserved | diagnostics-trace.test.ts "a throwing listener never breaks the raise; other listeners still run; the error is reported" |
109
+ | `G9Diagnostics.Activity` | `diagnostics.activity(name)` → `{ dispose() }`; the closing event fires once however often it is disposed | preserved | diagnostics-trace.test.ts "activity() raises busy true now and false once, however often it is disposed" |
110
+ | `G9DiagnosticsReport.Source` | `G9DiagnosticsReport.source` (`createDiagnosticsReport(source, …)`) | renamed | diagnostics-trace.test.ts "reports are frozen and keep null vs empty exceptions apart" |
111
+ | `G9DiagnosticsReport.UserMessage` | `userMessage` (string or `null`) | renamed | diagnostics-trace.test.ts "reports are frozen and keep null vs empty exceptions apart" |
112
+ | `G9DiagnosticsReport.DiagnosticsText` | `diagnosticsText` (string or `null`) | renamed | diagnostics-trace.test.ts "reports are frozen and keep null vs empty exceptions apart" |
113
+ | `G9DiagnosticsReport.Exceptions` | `exceptions` (`ReadonlyArray<unknown>` or `null`; empty for a `trace.fail`) | renamed: JS can throw any value, so the items are `unknown` | diagnostics-trace.test.ts "reports are frozen and keep null vs empty exceptions apart"; safe-executor.test.ts "trace.fail reports without an exception: popup with the user message, no onError, no rethrow" |
114
+ | `G9OperationTrace.Elapsed` | `trace.elapsedMs` (monotonic; frozen once `buildReport` ran) | renamed: milliseconds instead of `TimeSpan` | diagnostics-trace.test.ts "records steps with elapsed time, logs them, and builds the MAUI report layout" |
115
+ | `G9OperationTrace.Step` | `trace.step(message, detail?)` (logged at `debug`) | preserved | diagnostics-trace.test.ts "records steps with elapsed time, logs them, and builds the MAUI report layout" |
116
+ | `G9OperationTrace.Warning` | `trace.warning(message, detail?)` | preserved | diagnostics-trace.test.ts "records steps with elapsed time, logs them, and builds the MAUI report layout" |
117
+ | `G9OperationTrace.Error` | `trace.error(message, error?, detail?)` | preserved | diagnostics-trace.test.ts "records steps with elapsed time, logs them, and builds the MAUI report layout" |
118
+ | `G9OperationTrace.Fail` | `trace.fail(userMessage, diagnostics?)`; `trace.failure` exposes it | preserved | diagnostics-trace.test.ts "fail() records the user message (last call wins) and an unhandled error is appended"; safe-executor.test.ts "trace.fail reports without an exception: popup with the user message, no onError, no rethrow" |
119
+ | `G9OperationTrace.BuildReport` | `trace.buildReport(error?)`: same layout, `TimestampUtc` in .NET round-trip form; the final error is its stack (MAUI `Exception.ToString()`) | preserved (line ends are `\n` on every platform) | diagnostics-trace.test.ts "records steps with elapsed time, logs them, and builds the MAUI report layout"; "fail() records the user message (last call wins) and an unhandled error is appended" |
120
+
121
+ ## `G9ObservableRangeCollection` (WP01.4)
122
+
123
+ Source: `packages/foundation/src/collections.ts`; tests: `collections.test.ts`.
124
+
125
+ | MAUI | Lynx | Disposition | Tests |
126
+ | --- | --- | --- | --- |
127
+ | `G9ObservableRangeCollection.G9ObservableRangeCollection()` | `[]` as a `ReadonlyArray<T>` items prop | idiomatic: lists are immutable arrays with keys (specs/03 §2); a new array is the change notification | collections.test.ts "starts from a plain array: [] or a copy of any iterable (the two MAUI constructors)" |
128
+ | `G9ObservableRangeCollection.G9ObservableRangeCollection(IEnumerable<T> collection)` | `[...iterable]` | idiomatic | collections.test.ts "starts from a plain array: [] or a copy of any iterable (the two MAUI constructors)" |
129
+ | `G9ObservableRangeCollection.AddRange` | `addRange(items, more)`: same reference when nothing is added | changed: no `notificationMode`; React re-renders on a new array, so Add vs Reset events have no equivalent | collections.test.ts "addRange appends; nothing to add keeps the same reference (no re-render)" |
130
+ | `G9ObservableRangeCollection.RemoveRange` | `removeRange(items, remove, equals = Object.is)`: first occurrence of each, the argument snapshotted first | changed: no `notificationMode` (see `AddRange`); `equals` replaces `EqualityComparer<T>.Default` | collections.test.ts "removeRange removes the first occurrence of each item; no match keeps the reference" |
131
+ | `G9ObservableRangeCollection.Replace` | `replaceWith(items, item)` | renamed | collections.test.ts "replaceRange replaces from a snapshot of its argument; empty to empty keeps the reference" |
132
+ | `G9ObservableRangeCollection.ReplaceRange` | `replaceRange(items, next)`: the argument is read before replacing; empty → empty keeps the reference | preserved | collections.test.ts "replaceRange replaces from a snapshot of its argument; empty to empty keeps the reference" |
@@ -0,0 +1,135 @@
1
+ # Migration: `G9MAUIControls/Icons` → `@g9tm/lynxcontrols-foundation`
2
+
3
+ Census card: `plan/census/units/Core.Icons.md` (MAUI `6604cf0`). WP01.3 maps the types WP01 owns: `G9Glyph`,
4
+ `G9Glyphs`, `G9IconSource`, `G9IconFonts`. The rendering types (`G9GlyphDrawable`, `G9IconView`, `G9IconFactory`,
5
+ `G9ImageFactory`, `G9IconSourceTypeConverter`) belong to WP02, which renders `svgForGlyph` output with Lynx
6
+ `<svg content>`; WP02's table maps them.
7
+
8
+ MAUI kept the glyph slots and the font registry in static mutable state. Here they are values (plan/specs/03 §6): the
9
+ slots are a frozen object built by `resolveGlyphSlots(overrides)`, and the registry is an instance from
10
+ `createIconFontRegistry()`; the WP02 `G9Provider` owns both (`settings.glyphs`). The built-in glyphs are the golden SVG
11
+ documents recorded from the original drawing code (`plan/golden/glyphs.json`, generated into
12
+ `src/icons/generated/glyph-svg.ts` by `scripts/gen-glyphs.mjs`). Sources: `packages/foundation/src/icons/`; tests next
13
+ to them (`glyph.test.ts`, `icon.test.ts`, `icon-fonts.test.ts`) and `src/no-intl.test.ts`.
14
+
15
+ ## `G9Glyph`
16
+
17
+ Each value is the camelCase member name; `g9Glyphs[n]` is the glyph with MAUI enum number `n`. Every drawable glyph's
18
+ SVG equals the golden document; `svgForGlyph(glyph, color, weightScale)` substitutes the colour (`currentColor` by
19
+ default) and scales the stroke (2 design units × weight).
20
+
21
+ | MAUI | Lynx | Disposition | Tests |
22
+ | --- | --- | --- | --- |
23
+ | `G9Glyph.None` | `G9Glyph.None` (`'none'`): renders nothing (`svgForGlyph('none')` is `''`; `{ glyph: 'none' }` is an empty icon) | preserved | glyph.test.ts "has every MAUI member in declaration order with camelCase values"; "renders nothing for 'none'" |
24
+ | `G9Glyph.ChevronDown` | `G9Glyph.ChevronDown` (`'chevronDown'`), SVG `g9GlyphSvg.chevronDown` | preserved | glyph.test.ts "has every MAUI member in declaration order with camelCase values"; "reproduces all 27 recorded glyphs verbatim, in MAUI order, keyed by G9Glyph" |
25
+ | `G9Glyph.ChevronUp` | `G9Glyph.ChevronUp` (`'chevronUp'`), SVG `g9GlyphSvg.chevronUp` | preserved | glyph.test.ts "has every MAUI member in declaration order with camelCase values"; "reproduces all 27 recorded glyphs verbatim, in MAUI order, keyed by G9Glyph" |
26
+ | `G9Glyph.ChevronLeft` | `G9Glyph.ChevronLeft` (`'chevronLeft'`), SVG `g9GlyphSvg.chevronLeft` | preserved | glyph.test.ts "has every MAUI member in declaration order with camelCase values"; "reproduces all 27 recorded glyphs verbatim, in MAUI order, keyed by G9Glyph" |
27
+ | `G9Glyph.ChevronRight` | `G9Glyph.ChevronRight` (`'chevronRight'`), SVG `g9GlyphSvg.chevronRight` | preserved | glyph.test.ts "has every MAUI member in declaration order with camelCase values"; "reproduces all 27 recorded glyphs verbatim, in MAUI order, keyed by G9Glyph" |
28
+ | `G9Glyph.ArrowBack` | `G9Glyph.ArrowBack` (`'arrowBack'`), SVG `g9GlyphSvg.arrowBack` | preserved | glyph.test.ts "has every MAUI member in declaration order with camelCase values"; "reproduces all 27 recorded glyphs verbatim, in MAUI order, keyed by G9Glyph" |
29
+ | `G9Glyph.ArrowForward` | `G9Glyph.ArrowForward` (`'arrowForward'`), SVG `g9GlyphSvg.arrowForward` | preserved | glyph.test.ts "has every MAUI member in declaration order with camelCase values"; "reproduces all 27 recorded glyphs verbatim, in MAUI order, keyed by G9Glyph" |
30
+ | `G9Glyph.Close` | `G9Glyph.Close` (`'close'`), SVG `g9GlyphSvg.close` | preserved | glyph.test.ts "has every MAUI member in declaration order with camelCase values"; "reproduces all 27 recorded glyphs verbatim, in MAUI order, keyed by G9Glyph" |
31
+ | `G9Glyph.Search` | `G9Glyph.Search` (`'search'`), SVG `g9GlyphSvg.search` | preserved | glyph.test.ts "has every MAUI member in declaration order with camelCase values"; "reproduces all 27 recorded glyphs verbatim, in MAUI order, keyed by G9Glyph" |
32
+ | `G9Glyph.Language` | `G9Glyph.Language` (`'language'`), SVG `g9GlyphSvg.language` | preserved | glyph.test.ts "has every MAUI member in declaration order with camelCase values"; "reproduces all 27 recorded glyphs verbatim, in MAUI order, keyed by G9Glyph" |
33
+ | `G9Glyph.CloudOff` | `G9Glyph.CloudOff` (`'cloudOff'`), SVG `g9GlyphSvg.cloudOff` | preserved | glyph.test.ts "has every MAUI member in declaration order with camelCase values"; "reproduces all 27 recorded glyphs verbatim, in MAUI order, keyed by G9Glyph" |
34
+ | `G9Glyph.ScanCode` | `G9Glyph.ScanCode` (`'scanCode'`), SVG `g9GlyphSvg.scanCode` | preserved | glyph.test.ts "has every MAUI member in declaration order with camelCase values"; "reproduces all 27 recorded glyphs verbatim, in MAUI order, keyed by G9Glyph" |
35
+ | `G9Glyph.Eye` | `G9Glyph.Eye` (`'eye'`), SVG `g9GlyphSvg.eye` | preserved | glyph.test.ts "has every MAUI member in declaration order with camelCase values"; "reproduces all 27 recorded glyphs verbatim, in MAUI order, keyed by G9Glyph" |
36
+ | `G9Glyph.EyeOff` | `G9Glyph.EyeOff` (`'eyeOff'`), SVG `g9GlyphSvg.eyeOff` | preserved | glyph.test.ts "has every MAUI member in declaration order with camelCase values"; "reproduces all 27 recorded glyphs verbatim, in MAUI order, keyed by G9Glyph" |
37
+ | `G9Glyph.Check` | `G9Glyph.Check` (`'check'`), SVG `g9GlyphSvg.check` | preserved | glyph.test.ts "has every MAUI member in declaration order with camelCase values"; "reproduces all 27 recorded glyphs verbatim, in MAUI order, keyed by G9Glyph" |
38
+ | `G9Glyph.CheckCircle` | `G9Glyph.CheckCircle` (`'checkCircle'`), SVG `g9GlyphSvg.checkCircle` | preserved | glyph.test.ts "has every MAUI member in declaration order with camelCase values"; "reproduces all 27 recorded glyphs verbatim, in MAUI order, keyed by G9Glyph" |
39
+ | `G9Glyph.Warning` | `G9Glyph.Warning` (`'warning'`), SVG `g9GlyphSvg.warning` | preserved | glyph.test.ts "has every MAUI member in declaration order with camelCase values"; "reproduces all 27 recorded glyphs verbatim, in MAUI order, keyed by G9Glyph" |
40
+ | `G9Glyph.ErrorCircle` | `G9Glyph.ErrorCircle` (`'errorCircle'`), SVG `g9GlyphSvg.errorCircle` | preserved | glyph.test.ts "has every MAUI member in declaration order with camelCase values"; "reproduces all 27 recorded glyphs verbatim, in MAUI order, keyed by G9Glyph" |
41
+ | `G9Glyph.Info` | `G9Glyph.Info` (`'info'`), SVG `g9GlyphSvg.info` | preserved | glyph.test.ts "has every MAUI member in declaration order with camelCase values"; "reproduces all 27 recorded glyphs verbatim, in MAUI order, keyed by G9Glyph" |
42
+ | `G9Glyph.Calendar` | `G9Glyph.Calendar` (`'calendar'`), SVG `g9GlyphSvg.calendar` | preserved | glyph.test.ts "has every MAUI member in declaration order with camelCase values"; "reproduces all 27 recorded glyphs verbatim, in MAUI order, keyed by G9Glyph" |
43
+ | `G9Glyph.Clock` | `G9Glyph.Clock` (`'clock'`), SVG `g9GlyphSvg.clock` | preserved | glyph.test.ts "has every MAUI member in declaration order with camelCase values"; "reproduces all 27 recorded glyphs verbatim, in MAUI order, keyed by G9Glyph" |
44
+ | `G9Glyph.Mic` | `G9Glyph.Mic` (`'mic'`), SVG `g9GlyphSvg.mic` | preserved | glyph.test.ts "has every MAUI member in declaration order with camelCase values"; "reproduces all 27 recorded glyphs verbatim, in MAUI order, keyed by G9Glyph" |
45
+ | `G9Glyph.MicOff` | `G9Glyph.MicOff` (`'micOff'`), SVG `g9GlyphSvg.micOff` | preserved | glyph.test.ts "has every MAUI member in declaration order with camelCase values"; "reproduces all 27 recorded glyphs verbatim, in MAUI order, keyed by G9Glyph" |
46
+ | `G9Glyph.Plus` | `G9Glyph.Plus` (`'plus'`), SVG `g9GlyphSvg.plus` | preserved | glyph.test.ts "has every MAUI member in declaration order with camelCase values"; "reproduces all 27 recorded glyphs verbatim, in MAUI order, keyed by G9Glyph" |
47
+ | `G9Glyph.Minus` | `G9Glyph.Minus` (`'minus'`), SVG `g9GlyphSvg.minus` | preserved | glyph.test.ts "has every MAUI member in declaration order with camelCase values"; "reproduces all 27 recorded glyphs verbatim, in MAUI order, keyed by G9Glyph" |
48
+ | `G9Glyph.Menu` | `G9Glyph.Menu` (`'menu'`), SVG `g9GlyphSvg.menu` | preserved | glyph.test.ts "has every MAUI member in declaration order with camelCase values"; "reproduces all 27 recorded glyphs verbatim, in MAUI order, keyed by G9Glyph" |
49
+ | `G9Glyph.Refresh` | `G9Glyph.Refresh` (`'refresh'`), SVG `g9GlyphSvg.refresh` | preserved | glyph.test.ts "has every MAUI member in declaration order with camelCase values"; "reproduces all 27 recorded glyphs verbatim, in MAUI order, keyed by G9Glyph" |
50
+ | `G9Glyph.Delete` | `G9Glyph.Delete` (`'delete'`), SVG `g9GlyphSvg.delete` | preserved | glyph.test.ts "has every MAUI member in declaration order with camelCase values"; "reproduces all 27 recorded glyphs verbatim, in MAUI order, keyed by G9Glyph" |
51
+
52
+ ## `G9Glyphs`
53
+
54
+ `g9DefaultGlyphSlots` holds every default; `resolveGlyphSlots(overrides)` returns a frozen slot set with the overrides
55
+ applied (an unknown slot name or a malformed icon throws a `G9Error`; `undefined` keeps the default). Apps pass the
56
+ overrides as `G9Provider settings.glyphs` (WP02). MAUI ADR-0021 (a control draws every icon of a slot's kind from that
57
+ slot) is a rule for the WP02+ controls that read these slots.
58
+
59
+ | MAUI | Lynx | Disposition | Tests |
60
+ | --- | --- | --- | --- |
61
+ | `G9Glyphs.Chevron` | slot `chevron` of `G9GlyphSlots` (default `{ glyph: 'chevronDown' }`), overridden through `resolveGlyphSlots({ chevron: … })` | idiomatic: provider setting instead of a static property (specs/03 §6) | icon.test.ts "default every slot to the census default glyph, in MAUI declaration order"; "resolveGlyphSlots applies overrides, keeps defaults, and resets with no overrides" |
62
+ | `G9Glyphs.ChevronCollapse` | slot `chevronCollapse` of `G9GlyphSlots` (default `{ glyph: 'chevronUp' }`), overridden through `resolveGlyphSlots({ chevronCollapse: … })` | idiomatic: provider setting instead of a static property (specs/03 §6) | icon.test.ts "default every slot to the census default glyph, in MAUI declaration order"; "resolveGlyphSlots applies overrides, keeps defaults, and resets with no overrides" |
63
+ | `G9Glyphs.ChevronForward` | slot `chevronForward` of `G9GlyphSlots` (default `{ glyph: 'chevronRight' }`), overridden through `resolveGlyphSlots({ chevronForward: … })` | idiomatic: provider setting instead of a static property (specs/03 §6) | icon.test.ts "default every slot to the census default glyph, in MAUI declaration order"; "resolveGlyphSlots applies overrides, keeps defaults, and resets with no overrides" |
64
+ | `G9Glyphs.ChevronBack` | slot `chevronBack` of `G9GlyphSlots` (default `{ glyph: 'chevronLeft' }`), overridden through `resolveGlyphSlots({ chevronBack: … })` | idiomatic: provider setting instead of a static property (specs/03 §6) | icon.test.ts "default every slot to the census default glyph, in MAUI declaration order"; "resolveGlyphSlots applies overrides, keeps defaults, and resets with no overrides" |
65
+ | `G9Glyphs.ArrowBack` | slot `arrowBack` of `G9GlyphSlots` (default `{ glyph: 'arrowBack' }`), overridden through `resolveGlyphSlots({ arrowBack: … })` | idiomatic: provider setting instead of a static property (specs/03 §6) | icon.test.ts "default every slot to the census default glyph, in MAUI declaration order"; "resolveGlyphSlots applies overrides, keeps defaults, and resets with no overrides" |
66
+ | `G9Glyphs.ArrowForward` | slot `arrowForward` of `G9GlyphSlots` (default `{ glyph: 'arrowForward' }`), overridden through `resolveGlyphSlots({ arrowForward: … })` | idiomatic: provider setting instead of a static property (specs/03 §6) | icon.test.ts "default every slot to the census default glyph, in MAUI declaration order"; "resolveGlyphSlots applies overrides, keeps defaults, and resets with no overrides" |
67
+ | `G9Glyphs.Clear` | slot `clear` of `G9GlyphSlots` (default `{ glyph: 'close' }`), overridden through `resolveGlyphSlots({ clear: … })` | idiomatic: provider setting instead of a static property (specs/03 §6) | icon.test.ts "default every slot to the census default glyph, in MAUI declaration order"; "resolveGlyphSlots applies overrides, keeps defaults, and resets with no overrides" |
68
+ | `G9Glyphs.Search` | slot `search` of `G9GlyphSlots` (default `{ glyph: 'search' }`), overridden through `resolveGlyphSlots({ search: … })` | idiomatic: provider setting instead of a static property (specs/03 §6) | icon.test.ts "default every slot to the census default glyph, in MAUI declaration order"; "resolveGlyphSlots applies overrides, keeps defaults, and resets with no overrides" |
69
+ | `G9Glyphs.ScanCode` | slot `scanCode` of `G9GlyphSlots` (default `{ glyph: 'scanCode' }`), overridden through `resolveGlyphSlots({ scanCode: … })` | idiomatic: provider setting instead of a static property (specs/03 §6) | icon.test.ts "default every slot to the census default glyph, in MAUI declaration order"; "resolveGlyphSlots applies overrides, keeps defaults, and resets with no overrides" |
70
+ | `G9Glyphs.Language` | slot `language` of `G9GlyphSlots` (default `{ glyph: 'language' }`), overridden through `resolveGlyphSlots({ language: … })` | idiomatic: provider setting instead of a static property (specs/03 §6) | icon.test.ts "default every slot to the census default glyph, in MAUI declaration order"; "resolveGlyphSlots applies overrides, keeps defaults, and resets with no overrides" |
71
+ | `G9Glyphs.CloudOff` | slot `cloudOff` of `G9GlyphSlots` (default `{ glyph: 'cloudOff' }`), overridden through `resolveGlyphSlots({ cloudOff: … })` | idiomatic: provider setting instead of a static property (specs/03 §6) | icon.test.ts "default every slot to the census default glyph, in MAUI declaration order"; "resolveGlyphSlots applies overrides, keeps defaults, and resets with no overrides" |
72
+ | `G9Glyphs.CalendarToday` | slot `calendarToday` of `G9GlyphSlots` (default `{ glyph: 'calendar' }`), overridden through `resolveGlyphSlots({ calendarToday: … })` | idiomatic: provider setting instead of a static property (specs/03 §6) | icon.test.ts "default every slot to the census default glyph, in MAUI declaration order"; "resolveGlyphSlots applies overrides, keeps defaults, and resets with no overrides" |
73
+ | `G9Glyphs.DateRange` | slot `dateRange` of `G9GlyphSlots` (default `{ glyph: 'calendar' }`), overridden through `resolveGlyphSlots({ dateRange: … })` | idiomatic: provider setting instead of a static property (specs/03 §6) | icon.test.ts "default every slot to the census default glyph, in MAUI declaration order"; "resolveGlyphSlots applies overrides, keeps defaults, and resets with no overrides" |
74
+ | `G9Glyphs.EyeOpen` | slot `eyeOpen` of `G9GlyphSlots` (default `{ glyph: 'eye' }`), overridden through `resolveGlyphSlots({ eyeOpen: … })` | idiomatic: provider setting instead of a static property (specs/03 §6) | icon.test.ts "default every slot to the census default glyph, in MAUI declaration order"; "resolveGlyphSlots applies overrides, keeps defaults, and resets with no overrides" |
75
+ | `G9Glyphs.EyeClosed` | slot `eyeClosed` of `G9GlyphSlots` (default `{ glyph: 'eyeOff' }`), overridden through `resolveGlyphSlots({ eyeClosed: … })` | idiomatic: provider setting instead of a static property (specs/03 §6) | icon.test.ts "default every slot to the census default glyph, in MAUI declaration order"; "resolveGlyphSlots applies overrides, keeps defaults, and resets with no overrides" |
76
+ | `G9Glyphs.Check` | slot `check` of `G9GlyphSlots` (default `{ glyph: 'check' }`), overridden through `resolveGlyphSlots({ check: … })` | idiomatic: provider setting instead of a static property (specs/03 §6) | icon.test.ts "default every slot to the census default glyph, in MAUI declaration order"; "resolveGlyphSlots applies overrides, keeps defaults, and resets with no overrides" |
77
+ | `G9Glyphs.Calendar` | slot `calendar` of `G9GlyphSlots` (default `{ glyph: 'calendar' }`), overridden through `resolveGlyphSlots({ calendar: … })` | idiomatic: provider setting instead of a static property (specs/03 §6) | icon.test.ts "default every slot to the census default glyph, in MAUI declaration order"; "resolveGlyphSlots applies overrides, keeps defaults, and resets with no overrides" |
78
+ | `G9Glyphs.Clock` | slot `clock` of `G9GlyphSlots` (default `{ glyph: 'clock' }`), overridden through `resolveGlyphSlots({ clock: … })` | idiomatic: provider setting instead of a static property (specs/03 §6) | icon.test.ts "default every slot to the census default glyph, in MAUI declaration order"; "resolveGlyphSlots applies overrides, keeps defaults, and resets with no overrides" |
79
+ | `G9Glyphs.Mic` | slot `mic` of `G9GlyphSlots` (default `{ glyph: 'mic' }`), overridden through `resolveGlyphSlots({ mic: … })` | idiomatic: provider setting instead of a static property (specs/03 §6) | icon.test.ts "default every slot to the census default glyph, in MAUI declaration order"; "resolveGlyphSlots applies overrides, keeps defaults, and resets with no overrides" |
80
+ | `G9Glyphs.MicOff` | slot `micOff` of `G9GlyphSlots` (default `{ glyph: 'micOff' }`), overridden through `resolveGlyphSlots({ micOff: … })` | idiomatic: provider setting instead of a static property (specs/03 §6) | icon.test.ts "default every slot to the census default glyph, in MAUI declaration order"; "resolveGlyphSlots applies overrides, keeps defaults, and resets with no overrides" |
81
+ | `G9Glyphs.Plus` | slot `plus` of `G9GlyphSlots` (default `{ glyph: 'plus' }`), overridden through `resolveGlyphSlots({ plus: … })` | idiomatic: provider setting instead of a static property (specs/03 §6) | icon.test.ts "default every slot to the census default glyph, in MAUI declaration order"; "resolveGlyphSlots applies overrides, keeps defaults, and resets with no overrides" |
82
+ | `G9Glyphs.Info` | slot `info` of `G9GlyphSlots` (default `{ glyph: 'info' }`), overridden through `resolveGlyphSlots({ info: … })` | idiomatic: provider setting instead of a static property (specs/03 §6) | icon.test.ts "default every slot to the census default glyph, in MAUI declaration order"; "resolveGlyphSlots applies overrides, keeps defaults, and resets with no overrides" |
83
+ | `G9Glyphs.Success` | slot `success` of `G9GlyphSlots` (default `{ glyph: 'checkCircle' }`), overridden through `resolveGlyphSlots({ success: … })` | idiomatic: provider setting instead of a static property (specs/03 §6) | icon.test.ts "default every slot to the census default glyph, in MAUI declaration order"; "resolveGlyphSlots applies overrides, keeps defaults, and resets with no overrides" |
84
+ | `G9Glyphs.Warning` | slot `warning` of `G9GlyphSlots` (default `{ glyph: 'warning' }`), overridden through `resolveGlyphSlots({ warning: … })` | idiomatic: provider setting instead of a static property (specs/03 §6) | icon.test.ts "default every slot to the census default glyph, in MAUI declaration order"; "resolveGlyphSlots applies overrides, keeps defaults, and resets with no overrides" |
85
+ | `G9Glyphs.Error` | slot `error` of `G9GlyphSlots` (default `{ glyph: 'errorCircle' }`), overridden through `resolveGlyphSlots({ error: … })` | idiomatic: provider setting instead of a static property (specs/03 §6) | icon.test.ts "default every slot to the census default glyph, in MAUI declaration order"; "resolveGlyphSlots applies overrides, keeps defaults, and resets with no overrides" |
86
+ | `G9Glyphs.Refresh` | slot `refresh` of `G9GlyphSlots` (default `{ glyph: 'refresh' }`), overridden through `resolveGlyphSlots({ refresh: … })` | idiomatic: provider setting instead of a static property (specs/03 §6) | icon.test.ts "default every slot to the census default glyph, in MAUI declaration order"; "resolveGlyphSlots applies overrides, keeps defaults, and resets with no overrides" |
87
+ | `G9Glyphs.Delete` | slot `delete` of `G9GlyphSlots` (default `{ glyph: 'delete' }`), overridden through `resolveGlyphSlots({ delete: … })` | idiomatic: provider setting instead of a static property (specs/03 §6) | icon.test.ts "default every slot to the census default glyph, in MAUI declaration order"; "resolveGlyphSlots applies overrides, keeps defaults, and resets with no overrides" |
88
+ | `G9Glyphs.Reset` | `resolveGlyphSlots()` (no overrides) returns `g9DefaultGlyphSlots` | idiomatic: no mutable statics to reset | icon.test.ts "resolveGlyphSlots applies overrides, keeps defaults, and resets with no overrides" |
89
+
90
+ ## `G9IconSource`
91
+
92
+ `G9Icon` is the union `{ glyph } | { font, codepoint } | { font, text } | { svg } | { image }` (specs/03 §2). MAUI's
93
+ font glyph is text; `{ font, text }` keeps that (literal text, surrogate pairs, ligatures) next to the specs'
94
+ `{ font, codepoint }`, and the two are equal when the code point converts to the text. A slot with no icon is
95
+ `null`/`undefined`. `{ svg }` and `{ image }` are new sources (MAUI handled bitmaps in `G9IconFactory`, WP02).
96
+
97
+ | MAUI | Lynx | Disposition | Tests |
98
+ | --- | --- | --- | --- |
99
+ | `G9IconSource.FontFamily` | `icon.font` of a font icon (`isFontIcon(icon)`); absent on other icons | renamed | icon.test.ts "fontIcon is FromFont: blank family and empty text throw, text kept verbatim"; "IsEmpty / IsBuiltIn / BuiltIn / Glyph / FontFamily for every shape" |
100
+ | `G9IconSource.Glyph` | `fontIconText(icon)`: the text, or the code point as a (surrogate-pair) string; `undefined` for other icons | renamed | icon.test.ts "codePointIcon is FromCodePoint: astral code points become a surrogate pair, surrogates throw"; "IsEmpty / IsBuiltIn / BuiltIn / Glyph / FontFamily for every shape" |
101
+ | `G9IconSource.BuiltIn` | `builtInGlyph(icon)` (`'none'` for non-glyph icons), or `icon.glyph` | renamed | icon.test.ts "glyphIcon is FromGlyph: frozen, validated, built-in unless none"; "IsEmpty / IsBuiltIn / BuiltIn / Glyph / FontFamily for every shape" |
102
+ | `G9IconSource.IsEmpty` | `isIconEmpty(icon)`: `null`, `undefined` or `{ glyph: 'none' }` (a font icon cannot have empty text: the constructors reject it, as MAUI's did) | idiomatic | icon.test.ts "IsEmpty / IsBuiltIn / BuiltIn / Glyph / FontFamily for every shape" |
103
+ | `G9IconSource.IsBuiltIn` | `isGlyphIcon(icon)` (false for `'none'`) | renamed | icon.test.ts "glyphIcon is FromGlyph: frozen, validated, built-in unless none" |
104
+ | `G9IconSource.Empty` | `null` (no icon); `{ glyph: 'none' }` is equivalent | idiomatic | icon.test.ts "IsEmpty / IsBuiltIn / BuiltIn / Glyph / FontFamily for every shape"; "iconEquals is G9IconSource.Equals / == / !=: ordinal family + glyph text, code point equals its text" |
105
+ | `G9IconSource.FromFont` | `fontIcon(font, text)`: blank family or empty text throws `G9Error('icon-font')` | renamed | icon.test.ts "fontIcon is FromFont: blank family and empty text throw, text kept verbatim" |
106
+ | `G9IconSource.FromCodePoint` | `codePointIcon(font, codepoint)`: a non-scalar code point (negative, > 0x10FFFF, surrogate, fractional) throws `G9Error('icon-codepoint')` like `char.ConvertFromUtf32` | renamed | icon.test.ts "codePointIcon is FromCodePoint: astral code points become a surrogate pair, surrogates throw" |
107
+ | `G9IconSource.FromGlyph` | `glyphIcon(glyph)`: an unknown glyph throws `G9Error('icon-glyph')` | renamed | icon.test.ts "glyphIcon is FromGlyph: frozen, validated, built-in unless none" |
108
+ | `G9IconSource.FromEnum` | `defineIconFont(font, { Member: textOrCodepoint })` → frozen font icons; family = `font` (MAUI: the enum type name), text = MAUI `[Description]`, number = MAUI numeric value read as a code point; an empty text throws | idiomatic: TypeScript has no enum attributes, a member table replaces reflection | icon.test.ts "defineIconFont is FromEnum: family = font, text or number-as-code-point, empty text throws" |
109
+ | `G9IconSource.implicit operator G9IconSource(Enum? value)` | an icon-font member from `defineIconFont` is already a `G9Icon`; `null` is the empty slot | idiomatic | icon.test.ts "defineIconFont is FromEnum: family = font, text or number-as-code-point, empty text throws" |
110
+ | `G9IconSource.implicit operator G9IconSource(G9Glyph glyph)` | `toIcon(glyph)` / `glyphIcon(glyph)` | idiomatic | icon.test.ts "toIcon is the implicit G9Glyph conversion; assertG9Icon rejects malformed values" |
111
+ | `G9IconSource.implicit operator G9IconSource(string? name)` | `registry.parse(name)`: blank → `null`, unknown throws `G9Error('icon-unknown')` naming the value | idiomatic | icon-fonts.test.ts "parse is the strict string conversion: blank is no icon, unknown throws icon-unknown" |
112
+ | `G9IconSource.Equals` | `iconEquals(a, b)`: same glyph, or ordinal family + glyph text; every empty value equals every other | preserved | icon.test.ts "iconEquals is G9IconSource.Equals / == / !=: ordinal family + glyph text, code point equals its text" |
113
+ | `G9IconSource.operator ==` | `iconEquals(a, b)` | idiomatic | icon.test.ts "iconEquals is G9IconSource.Equals / == / !=: ordinal family + glyph text, code point equals its text" |
114
+ | `G9IconSource.operator !=` | `!iconEquals(a, b)` | idiomatic | icon.test.ts "iconEquals is G9IconSource.Equals / == / !=: ordinal family + glyph text, code point equals its text" |
115
+
116
+ `G9IconSource.ToString` (not a census member) is `iconSignature(icon)`: `builtin:<glyph>`, `<font>:<text>`, `''`, plus
117
+ `svg:` and `image:` forms (icon.test.ts "iconSignature is G9IconSource.ToString: changes if and only if the icon
118
+ changes").
119
+
120
+ ## `G9IconFonts`
121
+
122
+ `createIconFontRegistry()` returns one registry (the WP02 provider owns it). Keys compare ordinal-ignore-case by simple
123
+ per-code-point upper-casing (`iconNameKey`, no Intl), as MAUI's `StringComparer.OrdinalIgnoreCase` dictionaries did.
124
+ Raw names stay distinct: `registerName('hour-glass', …)` and `registerName('hourglass', …)` resolve to different
125
+ glyphs, while member names that differ only by case collide exactly as in MAUI (qualified key: last wins; unqualified:
126
+ first come).
127
+
128
+ | MAUI | Lynx | Disposition | Tests |
129
+ | --- | --- | --- | --- |
130
+ | `G9IconFonts.DefaultFontAlias` | `registry.defaultFontAlias` (last `isDefault: true` wins) | preserved (as in MAUI it never changes a `resolve` result, see `Resolve` below) | icon-fonts.test.ts "register validates its table and the last isDefault wins"; "resolves in MAUI order: raw name (incl. every member name, first font first), then built-in glyph" |
131
+ | `G9IconFonts.Register` | `registry.register(font, members, { isDefault })`: `Font.Member` keys overwrite, unqualified member names are first-come raw names; returns the font icons | idiomatic: a member table replaces `Register<TEnum>()` reflection | icon-fonts.test.ts "a qualified key is overwritten by a later registration; an unqualified one is first-come"; "member names that differ only by case collide like the MAUI OrdinalIgnoreCase maps" |
132
+ | `G9IconFonts.RegisterName` | `registry.registerName(rawName, icon)`: overwrites; blank name or malformed icon throws | preserved | icon-fonts.test.ts "keeps raw names distinct: hour-glass and hourglass resolve to different glyphs"; "registerName overwrites, accepts any icon, and rejects blank names and malformed icons" |
133
+ | `G9IconFonts.Resolve(string? name)` | `registry.resolve(name)` → a `G9Icon` or `null`: trimmed; raw name (incl. registered member names) first, then a built-in glyph by name (any case) or defined MAUI number | changed: MAUI's `Enum.TryParse` also accepted comma lists (`"1,2"` → the flag-OR glyph `ChevronLeft`) and undefined numbers (an icon that draws nothing); both resolve to `null` here. MAUI's steps 3 (`Font.Member` via the member map) and 4 (default-font member) are unreachable behind step 1 and are omitted with identical results | icon-fonts.test.ts "resolves in MAUI order: raw name (incl. every member name, first font first), then built-in glyph"; "returns null (or the fallback) for blank and unknown names and for None or undefined numbers"; "trims the name and compares ordinal-ignore-case" |
134
+ | `G9IconFonts.Resolve(string? name, G9IconSource fallback)` | `registry.resolve(name, fallback)` | preserved | icon-fonts.test.ts "returns null (or the fallback) for blank and unknown names and for None or undefined numbers" |
135
+ | `G9IconFonts.Reset` | `registry.reset()`; separate registries never share state | preserved | icon-fonts.test.ts "reset forgets every registration; registries are independent" |
@@ -0,0 +1,118 @@
1
+ # Migration: `G9MAUIControls/Localization` → `@g9tm/lynxcontrols-foundation`
2
+
3
+ Census card: `plan/census/units/Core.Localization.md` (MAUI `6604cf0`). WP01.2 maps the types WP01 owns:
4
+ `G9Culture`, `G9CultureEventArgs`, `G9Strings`, `G9StringKey`. Speech (`G9Speech`, `IG9SpeechToText`,
5
+ `G9SpeechResult`, `G9SpeechStatus`, `G9VoiceDictation`) is mapped by the work packages that own it.
6
+
7
+ MAUI kept the culture and the string catalogue in static mutable state. Here they are values: `createCulture` builds an
8
+ immutable culture, `createCultureStore` holds the live one with snapshot notifications, and `createStrings` resolves
9
+ the strings of one culture. The WP02 `G9Provider` owns the store and rebuilds the strings when the culture or the
10
+ string settings change (plan/specs/03-API-Conventions.md §6). Sources: `packages/foundation/src/culture/culture.ts`,
11
+ `strings.ts`; tests next to them.
12
+
13
+ ## `G9Culture`, `G9CultureEventArgs`
14
+
15
+ | MAUI | Lynx | Disposition | Tests |
16
+ | --- | --- | --- | --- |
17
+ | `G9Culture.CurrentCulture` | `store.getSnapshot()` → `G9Culture` `{ locale, language, direction, calendar, numberingSystem, rtlFontFamily?, ltrFontFamily? }`; no Intl, so there is no implicit device culture: the app passes its locale to `createCultureStore` | idiomatic: an immutable culture value instead of `CultureInfo` | culture.test.ts "starts from a locale or a value and notifies listeners once per change with the new snapshot" |
18
+ | `G9Culture.IsRtl` | `isRtl(culture)` / `culture.direction`; default from the language or script subtag (ICU right-to-left set), overridable with `{ direction }` | idiomatic: the MAUI `isRtl` accessor becomes an explicit setting | culture.test.ts "derives direction, calendar and digits from the language, never from direction alone"; "lets a script subtag decide the direction" |
19
+ | `G9Culture.RtlFontFamily` | `culture.rtlFontFamily` (`createCulture(locale, { rtlFontFamily })`, `store.update({ rtlFontFamily })`, `null` clears) | renamed: part of the culture value, so a change notifies | culture.test.ts "withCultureOptions replaces some settings, keeps the rest, and null clears a font" |
20
+ | `G9Culture.LtrFontFamily` | `culture.ltrFontFamily` | renamed: part of the culture value | culture.test.ts "withCultureOptions replaces some settings, keeps the rest, and null clears a font" |
21
+ | `G9Culture.ResolveFontFamily` | `resolveFontFamily(culture, explicitFontFamily?)`: a non-blank explicit family wins, else the RTL/LTR family, `undefined` = platform default | renamed: takes the culture | culture.test.ts "resolves the font family like G9Culture.ResolveFontFamily: a non-blank explicit family wins" |
22
+ | `G9Culture.Configure` | `createCultureStore(culture)` + `store.setCulture(...)` / `store.update({ direction, … })` | idiomatic: the app pushes values instead of registering accessors | culture.test.ts "starts from a locale or a value and notifies listeners once per change with the new snapshot" |
23
+ | `G9Culture.NotifyChanged` | implicit: `setCulture`/`update` notify once per actual change, each listener receives the snapshot of the change it reports (a switch made inside a listener is reported afterwards with its own snapshot) | changed: no notification without a change; a throwing listener no longer disappears into `Debug.WriteLine`: the others still run, then the first error is rethrown (specs/03 §7). There is no main-thread marshalling: the store lives on the background thread | culture.test.ts "gives each listener the snapshot of the change it reports, even when a listener switches again"; "keeps notifying after a listener throws, then rethrows the first error" |
24
+ | `G9Culture.CultureChanged` | `store.subscribe(listener)` → unsubscribe function; `listener(culture)` | idiomatic | culture.test.ts "skips a listener removed by an earlier one in the same round" |
25
+ | `G9Culture.Reset` | create a new store (tests) | idiomatic: no global state to reset | culture.test.ts "validates before committing: an invalid change leaves the culture as it was" |
26
+ | `G9Culture.ResolveAppFont` | the app passes its font families as culture values (`rtlFontFamily`, `ltrFontFamily`) | changed: Lynx has no application resource dictionary to read keys from | culture.test.ts "applies explicit settings independently, and freezes the value" |
27
+ | `G9CultureEventArgs.Culture` | the listener argument (the snapshot) | idiomatic | culture.test.ts "gives each listener the snapshot of the change it reports, even when a listener switches again" |
28
+ | `G9CultureEventArgs.IsRtl` | `isRtl(snapshot)` | idiomatic | culture.test.ts "starts from a locale or a value and notifies listeners once per change with the new snapshot" |
29
+
30
+ Culture defaults (plan/specs/01-Architecture.md §7): `fa*` → Persian calendar, Persian digits, RTL; `ar*` → Gregorian,
31
+ Arabic-Indic digits, RTL; other RTL languages → RTL, Gregorian, Latin; everything else LTR, Gregorian, Latin. Each is
32
+ an independent override. MAUI formatted numbers with .NET, which never substitutes native digits, so MAUI showed Latin
33
+ digits under `fa-IR`; here digits follow `numberingSystem` (`changed`; pass `numberingSystem: 'latin'` for the MAUI output).
34
+
35
+ ## `G9Strings`
36
+
37
+ | MAUI | Lynx | Disposition | Tests |
38
+ | --- | --- | --- | --- |
39
+ | `G9Strings.Get` | `createStrings({ culture, … }).get(key)`: provider → `overrides` → `tables[culture.language]` → built-in English | preserved (golden `strings.json`: English for every culture when nothing is configured) | strings.test.ts "reproduces G9Strings.Get for en-US, fa-IR and ar with no host override"; "asks the provider first with the prefixed MAUI name and the culture, then falls back" |
40
+ | `G9Strings.Format` | `strings.format(key, ...args)`: `{n}`, `{{`, `}}`; numbers in the culture digits | changed: numbers follow `culture.numberingSystem` (see above); `{0:N2}`-style specifiers and missing arguments throw `G9Error('strings-format')` (.NET threw `FormatException` for the latter, formatted the former) | strings.test.ts "fills placeholders, writes numbers in the culture digits and keeps escaped braces"; "rejects malformed templates, specifiers and missing arguments" |
41
+ | `G9Strings.UseResources` | `provider` + `keyPrefix` options; the provider receives `keyPrefix` + the MAUI member name (`G9NoResults`), so existing resx-derived catalogues keep their keys | idiomatic: no `ResourceManager` in Lynx | strings.test.ts "asks the provider first with the prefixed MAUI name and the culture, then falls back" |
42
+ | `G9Strings.UseProvider` | `provider: (name, culture)` returning the text, or `null`/`undefined`/`''` to fall back; a throwing provider falls back and is reported to `onProviderError` | preserved (+ error hook; MAUI swallowed silently) | strings.test.ts "falls back when the provider throws and reports the error" |
43
+ | `G9Strings.Resolve` | `strings.resolve(name)`: provider only, never prefixed, `null` without an entry | preserved | strings.test.ts "resolve uses the provider only, never the prefix, and returns null without an entry" |
44
+ | `G9Strings.Override` | `overrides: { [key]: text }`, validated at creation | idiomatic: an option instead of mutating a global table | strings.test.ts "validates overrides and tables up front" |
45
+ | `G9Strings.Reset` | create new strings without the provider | idiomatic: no global state | strings.test.ts "falls back when the provider throws and reports the error" |
46
+
47
+ Additive: `g9PersianStrings` and `g9ArabicStrings` translate every key and keep every placeholder;
48
+ `g9BuiltInStringTables` (`{ fa, ar }`) opts into them. They are opt-in so the default output stays identical to MAUI.
49
+ Arabic count templates use one plural form; apps needing agreement override those keys or use a provider.
50
+
51
+ ## `G9StringKey`
52
+
53
+ Values are the camelCase member names (specs/03 §1); `g9StringResourceName(key)` returns the MAUI name; `g9StringKeys`
54
+ lists them in declaration order.
55
+
56
+ | MAUI | Lynx | Disposition | Tests |
57
+ | --- | --- | --- | --- |
58
+ | `G9StringKey.Ok` | `G9StringKey.Ok` (`'ok'`) | preserved | strings.test.ts "has every MAUI member, in order, with camelCase values"; "reproduces G9Strings.Get for en-US, fa-IR and ar with no host override" |
59
+ | `G9StringKey.Cancel` | `G9StringKey.Cancel` (`'cancel'`) | preserved | strings.test.ts "has every MAUI member, in order, with camelCase values"; "reproduces G9Strings.Get for en-US, fa-IR and ar with no host override" |
60
+ | `G9StringKey.Save` | `G9StringKey.Save` (`'save'`) | preserved | strings.test.ts "has every MAUI member, in order, with camelCase values"; "reproduces G9Strings.Get for en-US, fa-IR and ar with no host override" |
61
+ | `G9StringKey.Confirm` | `G9StringKey.Confirm` (`'confirm'`) | preserved | strings.test.ts "has every MAUI member, in order, with camelCase values"; "reproduces G9Strings.Get for en-US, fa-IR and ar with no host override" |
62
+ | `G9StringKey.Close` | `G9StringKey.Close` (`'close'`) | preserved | strings.test.ts "has every MAUI member, in order, with camelCase values"; "reproduces G9Strings.Get for en-US, fa-IR and ar with no host override" |
63
+ | `G9StringKey.Done` | `G9StringKey.Done` (`'done'`) | preserved | strings.test.ts "has every MAUI member, in order, with camelCase values"; "reproduces G9Strings.Get for en-US, fa-IR and ar with no host override" |
64
+ | `G9StringKey.Back` | `G9StringKey.Back` (`'back'`) | preserved | strings.test.ts "has every MAUI member, in order, with camelCase values"; "reproduces G9Strings.Get for en-US, fa-IR and ar with no host override" |
65
+ | `G9StringKey.Retry` | `G9StringKey.Retry` (`'retry'`) | preserved | strings.test.ts "has every MAUI member, in order, with camelCase values"; "reproduces G9Strings.Get for en-US, fa-IR and ar with no host override" |
66
+ | `G9StringKey.Skip` | `G9StringKey.Skip` (`'skip'`) | preserved | strings.test.ts "has every MAUI member, in order, with camelCase values"; "reproduces G9Strings.Get for en-US, fa-IR and ar with no host override" |
67
+ | `G9StringKey.MoreDetails` | `G9StringKey.MoreDetails` (`'moreDetails'`) | preserved | strings.test.ts "has every MAUI member, in order, with camelCase values"; "reproduces G9Strings.Get for en-US, fa-IR and ar with no host override" |
68
+ | `G9StringKey.Clear` | `G9StringKey.Clear` (`'clear'`) | preserved | strings.test.ts "has every MAUI member, in order, with camelCase values"; "reproduces G9Strings.Get for en-US, fa-IR and ar with no host override" |
69
+ | `G9StringKey.Reset` | `G9StringKey.Reset` (`'reset'`) | preserved | strings.test.ts "has every MAUI member, in order, with camelCase values"; "reproduces G9Strings.Get for en-US, fa-IR and ar with no host override" |
70
+ | `G9StringKey.Delete` | `G9StringKey.Delete` (`'delete'`) | preserved | strings.test.ts "has every MAUI member, in order, with camelCase values"; "reproduces G9Strings.Get for en-US, fa-IR and ar with no host override" |
71
+ | `G9StringKey.Search` | `G9StringKey.Search` (`'search'`) | preserved | strings.test.ts "has every MAUI member, in order, with camelCase values"; "reproduces G9Strings.Get for en-US, fa-IR and ar with no host override" |
72
+ | `G9StringKey.NoResults` | `G9StringKey.NoResults` (`'noResults'`) | preserved | strings.test.ts "has every MAUI member, in order, with camelCase values"; "reproduces G9Strings.Get for en-US, fa-IR and ar with no host override" |
73
+ | `G9StringKey.Selected` | `G9StringKey.Selected` (`'selected'`) | preserved | strings.test.ts "has every MAUI member, in order, with camelCase values"; "reproduces G9Strings.Get for en-US, fa-IR and ar with no host override" |
74
+ | `G9StringKey.ComingSoon` | `G9StringKey.ComingSoon` (`'comingSoon'`) | preserved | strings.test.ts "has every MAUI member, in order, with camelCase values"; "reproduces G9Strings.Get for en-US, fa-IR and ar with no host override" |
75
+ | `G9StringKey.Loading` | `G9StringKey.Loading` (`'loading'`) | preserved | strings.test.ts "has every MAUI member, in order, with camelCase values"; "reproduces G9Strings.Get for en-US, fa-IR and ar with no host override" |
76
+ | `G9StringKey.SelectDate` | `G9StringKey.SelectDate` (`'selectDate'`) | preserved | strings.test.ts "has every MAUI member, in order, with camelCase values"; "reproduces G9Strings.Get for en-US, fa-IR and ar with no host override" |
77
+ | `G9StringKey.SelectTime` | `G9StringKey.SelectTime` (`'selectTime'`) | preserved | strings.test.ts "has every MAUI member, in order, with camelCase values"; "reproduces G9Strings.Get for en-US, fa-IR and ar with no host override" |
78
+ | `G9StringKey.SelectDateTime` | `G9StringKey.SelectDateTime` (`'selectDateTime'`) | preserved | strings.test.ts "has every MAUI member, in order, with camelCase values"; "reproduces G9Strings.Get for en-US, fa-IR and ar with no host override" |
79
+ | `G9StringKey.SelectDuration` | `G9StringKey.SelectDuration` (`'selectDuration'`) | preserved | strings.test.ts "has every MAUI member, in order, with camelCase values"; "reproduces G9Strings.Get for en-US, fa-IR and ar with no host override" |
80
+ | `G9StringKey.Today` | `G9StringKey.Today` (`'today'`) | preserved | strings.test.ts "has every MAUI member, in order, with camelCase values"; "reproduces G9Strings.Get for en-US, fa-IR and ar with no host override" |
81
+ | `G9StringKey.Tomorrow` | `G9StringKey.Tomorrow` (`'tomorrow'`; fa `فردا`, ar `غدًا` in the bundled tables), the day word of `'relativeDay'` dates (MAUI 1.4.0) | preserved | strings.test.ts "has every MAUI member, in order, with camelCase values"; "reproduces G9Strings.Get for en-US, fa-IR and ar with no host override"; "ships complete Persian and Arabic tables that keep every placeholder" |
82
+ | `G9StringKey.Yesterday` | `G9StringKey.Yesterday` (`'yesterday'`; fa `دیروز`, ar `أمس` in the bundled tables), the day word of `'relativeDay'` dates (MAUI 1.4.0) | preserved | strings.test.ts "has every MAUI member, in order, with camelCase values"; "reproduces G9Strings.Get for en-US, fa-IR and ar with no host override"; "ships complete Persian and Arabic tables that keep every placeholder" |
83
+ | `G9StringKey.Now` | `G9StringKey.Now` (`'now'`) | preserved | strings.test.ts "has every MAUI member, in order, with camelCase values"; "reproduces G9Strings.Get for en-US, fa-IR and ar with no host override" |
84
+ | `G9StringKey.Year` | `G9StringKey.Year` (`'year'`) | preserved | strings.test.ts "has every MAUI member, in order, with camelCase values"; "reproduces G9Strings.Get for en-US, fa-IR and ar with no host override" |
85
+ | `G9StringKey.Month` | `G9StringKey.Month` (`'month'`) | preserved | strings.test.ts "has every MAUI member, in order, with camelCase values"; "reproduces G9Strings.Get for en-US, fa-IR and ar with no host override" |
86
+ | `G9StringKey.Day` | `G9StringKey.Day` (`'day'`) | preserved | strings.test.ts "has every MAUI member, in order, with camelCase values"; "reproduces G9Strings.Get for en-US, fa-IR and ar with no host override" |
87
+ | `G9StringKey.Hour` | `G9StringKey.Hour` (`'hour'`) | preserved | strings.test.ts "has every MAUI member, in order, with camelCase values"; "reproduces G9Strings.Get for en-US, fa-IR and ar with no host override" |
88
+ | `G9StringKey.Minute` | `G9StringKey.Minute` (`'minute'`) | preserved | strings.test.ts "has every MAUI member, in order, with camelCase values"; "reproduces G9Strings.Get for en-US, fa-IR and ar with no host override" |
89
+ | `G9StringKey.TimeSpanYearsFormat` | `G9StringKey.TimeSpanYearsFormat` (`'timeSpanYearsFormat'`) | preserved | strings.test.ts "has every MAUI member, in order, with camelCase values"; "reproduces G9Strings.Get for en-US, fa-IR and ar with no host override" |
90
+ | `G9StringKey.TimeSpanMonthsFormat` | `G9StringKey.TimeSpanMonthsFormat` (`'timeSpanMonthsFormat'`) | preserved | strings.test.ts "has every MAUI member, in order, with camelCase values"; "reproduces G9Strings.Get for en-US, fa-IR and ar with no host override" |
91
+ | `G9StringKey.TimeSpanDaysFormat` | `G9StringKey.TimeSpanDaysFormat` (`'timeSpanDaysFormat'`) | preserved | strings.test.ts "has every MAUI member, in order, with camelCase values"; "reproduces G9Strings.Get for en-US, fa-IR and ar with no host override" |
92
+ | `G9StringKey.Information` | `G9StringKey.Information` (`'information'`) | preserved | strings.test.ts "has every MAUI member, in order, with camelCase values"; "reproduces G9Strings.Get for en-US, fa-IR and ar with no host override" |
93
+ | `G9StringKey.Success` | `G9StringKey.Success` (`'success'`) | preserved | strings.test.ts "has every MAUI member, in order, with camelCase values"; "reproduces G9Strings.Get for en-US, fa-IR and ar with no host override" |
94
+ | `G9StringKey.Warning` | `G9StringKey.Warning` (`'warning'`) | preserved | strings.test.ts "has every MAUI member, in order, with camelCase values"; "reproduces G9Strings.Get for en-US, fa-IR and ar with no host override" |
95
+ | `G9StringKey.Error` | `G9StringKey.Error` (`'error'`) | preserved | strings.test.ts "has every MAUI member, in order, with camelCase values"; "reproduces G9Strings.Get for en-US, fa-IR and ar with no host override" |
96
+ | `G9StringKey.RequiredSuffix` | `G9StringKey.RequiredSuffix` (`'requiredSuffix'`) | preserved | strings.test.ts "has every MAUI member, in order, with camelCase values"; "reproduces G9Strings.Get for en-US, fa-IR and ar with no host override" |
97
+ | `G9StringKey.InvalidEmail` | `G9StringKey.InvalidEmail` (`'invalidEmail'`) | preserved | strings.test.ts "has every MAUI member, in order, with camelCase values"; "reproduces G9Strings.Get for en-US, fa-IR and ar with no host override" |
98
+ | `G9StringKey.InvalidUrl` | `G9StringKey.InvalidUrl` (`'invalidUrl'`) | preserved | strings.test.ts "has every MAUI member, in order, with camelCase values"; "reproduces G9Strings.Get for en-US, fa-IR and ar with no host override" |
99
+ | `G9StringKey.InvalidValue` | `G9StringKey.InvalidValue` (`'invalidValue'`) | preserved | strings.test.ts "has every MAUI member, in order, with camelCase values"; "reproduces G9Strings.Get for en-US, fa-IR and ar with no host override" |
100
+ | `G9StringKey.Scanning` | `G9StringKey.Scanning` (`'scanning'`) | preserved | strings.test.ts "has every MAUI member, in order, with camelCase values"; "reproduces G9Strings.Get for en-US, fa-IR and ar with no host override" |
101
+ | `G9StringKey.MicrophonePermissionDenied` | `G9StringKey.MicrophonePermissionDenied` (`'microphonePermissionDenied'`) | preserved | strings.test.ts "has every MAUI member, in order, with camelCase values"; "reproduces G9Strings.Get for en-US, fa-IR and ar with no host override" |
102
+ | `G9StringKey.SpeechRecognitionPermissionDenied` | `G9StringKey.SpeechRecognitionPermissionDenied` (`'speechRecognitionPermissionDenied'`) | preserved | strings.test.ts "has every MAUI member, in order, with camelCase values"; "reproduces G9Strings.Get for en-US, fa-IR and ar with no host override" |
103
+ | `G9StringKey.SpeechRecognitionUnavailable` | `G9StringKey.SpeechRecognitionUnavailable` (`'speechRecognitionUnavailable'`) | preserved | strings.test.ts "has every MAUI member, in order, with camelCase values"; "reproduces G9Strings.Get for en-US, fa-IR and ar with no host override" |
104
+ | `G9StringKey.VoiceRecognitionFailed` | `G9StringKey.VoiceRecognitionFailed` (`'voiceRecognitionFailed'`) | preserved | strings.test.ts "has every MAUI member, in order, with camelCase values"; "reproduces G9Strings.Get for en-US, fa-IR and ar with no host override" |
105
+ | `G9StringKey.PermissionErrorFormat` | `G9StringKey.PermissionErrorFormat` (`'permissionErrorFormat'`) | preserved | strings.test.ts "has every MAUI member, in order, with camelCase values"; "reproduces G9Strings.Get for en-US, fa-IR and ar with no host override" |
106
+ | `G9StringKey.TimeAgoJustNow` | `G9StringKey.TimeAgoJustNow` (`'timeAgoJustNow'`) | preserved | strings.test.ts "has every MAUI member, in order, with camelCase values"; "reproduces G9Strings.Get for en-US, fa-IR and ar with no host override" |
107
+ | `G9StringKey.TimeAgoMinutesFormat` | `G9StringKey.TimeAgoMinutesFormat` (`'timeAgoMinutesFormat'`) | preserved | strings.test.ts "has every MAUI member, in order, with camelCase values"; "reproduces G9Strings.Get for en-US, fa-IR and ar with no host override" |
108
+ | `G9StringKey.TimeAgoHoursFormat` | `G9StringKey.TimeAgoHoursFormat` (`'timeAgoHoursFormat'`) | preserved | strings.test.ts "has every MAUI member, in order, with camelCase values"; "reproduces G9Strings.Get for en-US, fa-IR and ar with no host override" |
109
+ | `G9StringKey.TimeAgoDaysFormat` | `G9StringKey.TimeAgoDaysFormat` (`'timeAgoDaysFormat'`) | preserved | strings.test.ts "has every MAUI member, in order, with camelCase values"; "reproduces G9Strings.Get for en-US, fa-IR and ar with no host override" |
110
+ | `G9StringKey.TimeAgoWeeksFormat` | `G9StringKey.TimeAgoWeeksFormat` (`'timeAgoWeeksFormat'`) | preserved | strings.test.ts "has every MAUI member, in order, with camelCase values"; "reproduces G9Strings.Get for en-US, fa-IR and ar with no host override" |
111
+ | `G9StringKey.TimeAgoMonthsFormat` | `G9StringKey.TimeAgoMonthsFormat` (`'timeAgoMonthsFormat'`) | preserved | strings.test.ts "has every MAUI member, in order, with camelCase values"; "reproduces G9Strings.Get for en-US, fa-IR and ar with no host override" |
112
+ | `G9StringKey.TimeAgoYearsFormat` | `G9StringKey.TimeAgoYearsFormat` (`'timeAgoYearsFormat'`) | preserved | strings.test.ts "has every MAUI member, in order, with camelCase values"; "reproduces G9Strings.Get for en-US, fa-IR and ar with no host override" |
113
+ | `G9StringKey.Cancelled` | `G9StringKey.Cancelled` (`'cancelled'`) | preserved | strings.test.ts "has every MAUI member, in order, with camelCase values"; "reproduces G9Strings.Get for en-US, fa-IR and ar with no host override" |
114
+ | `G9StringKey.CancelFinishingStep` | `G9StringKey.CancelFinishingStep` (`'cancelFinishingStep'`) | preserved | strings.test.ts "has every MAUI member, in order, with camelCase values"; "reproduces G9Strings.Get for en-US, fa-IR and ar with no host override" |
115
+ | `G9StringKey.UnexpectedError` | `G9StringKey.UnexpectedError` (`'unexpectedError'`) | preserved | strings.test.ts "has every MAUI member, in order, with camelCase values"; "reproduces G9Strings.Get for en-US, fa-IR and ar with no host override" |
116
+ | `G9StringKey.Checked` | `G9StringKey.Checked` (`'checked'`) | preserved | strings.test.ts "has every MAUI member, in order, with camelCase values"; "reproduces G9Strings.Get for en-US, fa-IR and ar with no host override" |
117
+ | `G9StringKey.NotChecked` | `G9StringKey.NotChecked` (`'notChecked'`) | preserved | strings.test.ts "has every MAUI member, in order, with camelCase values"; "reproduces G9Strings.Get for en-US, fa-IR and ar with no host override" |
118
+ | `G9StringKey.PartiallyChecked` | `G9StringKey.PartiallyChecked` (`'partiallyChecked'`) | preserved | strings.test.ts "has every MAUI member, in order, with camelCase values"; "reproduces G9Strings.Get for en-US, fa-IR and ar with no host override" |
@@ -0,0 +1,54 @@
1
+ # Migration: `G9MAUIControls/Storage` → `@g9tm/lynxcontrols-foundation`
2
+
3
+ Census card: `plan/census/units/Core.Storage.md` (MAUI `6604cf0`). WP01.4 maps the whole unit. Sources:
4
+ `packages/foundation/src/services/preferences.ts`; tests: `packages/foundation/src/services/preferences.test.ts`.
5
+
6
+ MAUI read and wrote platform preferences synchronously through a static `G9Preferences.Store`. Lynx native modules
7
+ are asynchronous and foundation has no mutable statics (specs/03 §6), so `createPreferences({ store, keyPrefix,
8
+ onStoreError })` hydrates the namespace once (`hydrate()`), serves synchronous typed reads from an immutable snapshot
9
+ (`getSnapshot`/`subscribe`, for `useSyncExternalStore` in WP02), applies writes to the snapshot immediately and then
10
+ writes through. A write made before hydration finishes wins over the stored value. `namespace(name)` gives a child
11
+ view (`g9controls.<name>.`), and `intKey`/`stringKey` give typed handles on one key. The two MAUI consumers (theme
12
+ mode, learned sheet heights) use it from WP02 and WP05.
13
+
14
+ ## `G9Preferences`
15
+
16
+ | MAUI | Lynx | Disposition | Tests |
17
+ | --- | --- | --- | --- |
18
+ | `G9Preferences.KeyPrefix` | `g9PreferenceKeyPrefix` (`'g9controls.'`), the default `keyPrefix` of `createPreferences`; `prefs.keyPrefix` reads it | preserved | preferences.test.ts "prefixes every key with g9controls. and reads typed values with MAUI defaults" |
19
+ | `G9Preferences.Store` | `createPreferences({ store })`; `prefs.store` reads it | idiomatic: the store is passed in (from the provider's `preferences` service) instead of a mutable static; there is no default platform store in foundation | preferences.test.ts "prefixes every key with g9controls. and reads typed values with MAUI defaults" |
20
+ | `G9Preferences.GetInt` | `prefs.getInt(key, defaultValue = 0)`: synchronous, from the hydrated snapshot | changed: reads come from the snapshot `hydrate()` loaded (native stores are asynchronous in Lynx); before hydration a read returns the default | preferences.test.ts "prefixes every key with g9controls. and reads typed values with MAUI defaults"; "a synchronous store hydrates before hydrate() returns; the promise is shared" |
21
+ | `G9Preferences.SetInt` | `prefs.setInt(key, value)` → `Promise<void>`: snapshot and subscribers first, then the store; only 32-bit integers | changed: asynchronous write-through; a non-int32 value throws `G9Error` `preference-value` (C# `int` made it impossible) | preferences.test.ts "prefixes every key with g9controls. and reads typed values with MAUI defaults"; "validates keys and values before changing anything" |
22
+ | `G9Preferences.GetString` | `prefs.getString(key, defaultValue = null)` | changed: as `GetInt` (snapshot read) | preferences.test.ts "prefixes every key with g9controls. and reads typed values with MAUI defaults" |
23
+ | `G9Preferences.SetString` | `prefs.setString(key, value)`; `null` removes the key | changed: as `SetInt` (asynchronous write-through) | preferences.test.ts "null removes: setString(key, null) and remove() delete from snapshot and store" |
24
+ | `G9Preferences.Remove` | `prefs.remove(key)`; an absent key is not an error | preserved | preferences.test.ts "null removes: setString(key, null) and remove() delete from snapshot and store" |
25
+
26
+ ## `IG9PreferenceStore`
27
+
28
+ | MAUI | Lynx | Disposition | Tests |
29
+ | --- | --- | --- | --- |
30
+ | `IG9PreferenceStore.GetInt` | `G9PreferenceStore.getInt(key, defaultValue)` (may return a promise) | renamed: `I` dropped (specs/03 §1); results may be promises so native stores fit | preferences.test.ts "reads defaults when absent and keeps ints and strings apart" |
31
+ | `IG9PreferenceStore.SetInt` | `G9PreferenceStore.setInt(key, value)` | renamed | preferences.test.ts "reads defaults when absent and keeps ints and strings apart" |
32
+ | `IG9PreferenceStore.GetString` | `G9PreferenceStore.getString(key, defaultValue)` | renamed | preferences.test.ts "reads defaults when absent and keeps ints and strings apart" |
33
+ | `IG9PreferenceStore.SetString` | `G9PreferenceStore.setString(key, value)`; `null` removes the key | renamed | preferences.test.ts "setString(null) removes the key; remove of an absent key is not an error" |
34
+ | `IG9PreferenceStore.Remove` | `G9PreferenceStore.remove(key)`; an absent key is not an error | renamed | preferences.test.ts "setString(null) removes the key; remove of an absent key is not an error" |
35
+
36
+ ## `G9MauiPreferenceStore`
37
+
38
+ | MAUI | Lynx | Disposition | Tests |
39
+ | --- | --- | --- | --- |
40
+ | `G9MauiPreferenceStore.GetInt` | the host adapter's `G9PreferenceStore.getInt`, guarded by `createPreferences` | idiomatic: platform persistence is a host adapter implementing `G9PreferenceStore` (Lynxtron WP12, Android DataStore WP13, iOS WP14); MAUI's "every call is guarded" contract is enforced by `createPreferences` for any store: failures go to `onStoreError`, reads keep their defaults, writes never throw into the caller | preferences.test.ts "guards every store call: failures go to onStoreError and never reach the caller" |
41
+ | `G9MauiPreferenceStore.SetInt` | the host adapter's `G9PreferenceStore.setInt`, guarded by `createPreferences` | idiomatic: platform persistence is a host adapter implementing `G9PreferenceStore` (Lynxtron WP12, Android DataStore WP13, iOS WP14); MAUI's "every call is guarded" contract is enforced by `createPreferences` for any store: failures go to `onStoreError`, reads keep their defaults, writes never throw into the caller | preferences.test.ts "guards every store call: failures go to onStoreError and never reach the caller" |
42
+ | `G9MauiPreferenceStore.GetString` | the host adapter's `G9PreferenceStore.getString`, guarded by `createPreferences` | idiomatic: platform persistence is a host adapter implementing `G9PreferenceStore` (Lynxtron WP12, Android DataStore WP13, iOS WP14); MAUI's "every call is guarded" contract is enforced by `createPreferences` for any store: failures go to `onStoreError`, reads keep their defaults, writes never throw into the caller | preferences.test.ts "guards every store call: failures go to onStoreError and never reach the caller" |
43
+ | `G9MauiPreferenceStore.SetString` | the host adapter's `G9PreferenceStore.setString`, guarded by `createPreferences` | idiomatic: platform persistence is a host adapter implementing `G9PreferenceStore` (Lynxtron WP12, Android DataStore WP13, iOS WP14); MAUI's "every call is guarded" contract is enforced by `createPreferences` for any store: failures go to `onStoreError`, reads keep their defaults, writes never throw into the caller | preferences.test.ts "guards every store call: failures go to onStoreError and never reach the caller" |
44
+ | `G9MauiPreferenceStore.Remove` | the host adapter's `G9PreferenceStore.remove`, guarded by `createPreferences` | idiomatic: platform persistence is a host adapter implementing `G9PreferenceStore` (Lynxtron WP12, Android DataStore WP13, iOS WP14); MAUI's "every call is guarded" contract is enforced by `createPreferences` for any store: failures go to `onStoreError`, reads keep their defaults, writes never throw into the caller | preferences.test.ts "guards every store call: failures go to onStoreError and never reach the caller" |
45
+
46
+ ## `G9InMemoryPreferenceStore`
47
+
48
+ | MAUI | Lynx | Disposition | Tests |
49
+ | --- | --- | --- | --- |
50
+ | `G9InMemoryPreferenceStore.GetInt` | `createMemoryPreferenceStore(initial?).getInt` | preserved (synchronous; ints and strings typed apart as in MAUI) | preferences.test.ts "reads defaults when absent and keeps ints and strings apart" |
51
+ | `G9InMemoryPreferenceStore.SetInt` | `createMemoryPreferenceStore(initial?).setInt` | preserved (synchronous; ints and strings typed apart as in MAUI) | preferences.test.ts "rejects non-int32 integers, non-string values and empty keys" |
52
+ | `G9InMemoryPreferenceStore.GetString` | `createMemoryPreferenceStore(initial?).getString` | preserved (synchronous; ints and strings typed apart as in MAUI) | preferences.test.ts "reads defaults when absent and keeps ints and strings apart" |
53
+ | `G9InMemoryPreferenceStore.SetString` | `createMemoryPreferenceStore(initial?).setString` | preserved (synchronous; ints and strings typed apart as in MAUI) | preferences.test.ts "setString(null) removes the key; remove of an absent key is not an error" |
54
+ | `G9InMemoryPreferenceStore.Remove` | `createMemoryPreferenceStore(initial?).remove` | preserved (synchronous; ints and strings typed apart as in MAUI) | preferences.test.ts "setString(null) removes the key; remove of an absent key is not an error" |