@g9tm/lynxcontrols-foundation 1.7.3 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.tsbuildinfo +1 -1
- package/dist/culture/bidi.d.ts +8 -0
- package/dist/culture/bidi.d.ts.map +1 -0
- package/dist/culture/bidi.js +16 -0
- package/dist/culture/bidi.js.map +1 -0
- package/dist/culture/coordinates.d.ts +17 -0
- package/dist/culture/coordinates.d.ts.map +1 -0
- package/dist/culture/coordinates.js +18 -0
- package/dist/culture/coordinates.js.map +1 -0
- package/dist/culture/index.d.ts +4 -0
- package/dist/culture/index.d.ts.map +1 -1
- package/dist/culture/index.js +4 -0
- package/dist/culture/natural-date.d.ts +9 -0
- package/dist/culture/natural-date.d.ts.map +1 -0
- package/dist/culture/natural-date.js +208 -0
- package/dist/culture/natural-date.js.map +1 -0
- package/dist/culture/text.d.ts +73 -0
- package/dist/culture/text.d.ts.map +1 -0
- package/dist/culture/text.js +213 -0
- package/dist/culture/text.js.map +1 -0
- package/dist/enums/index.d.ts +6 -0
- package/dist/enums/index.d.ts.map +1 -1
- package/dist/enums/index.js +4 -1
- package/dist/enums/index.js.map +1 -1
- package/dist/icons/index.d.ts +2 -1
- package/dist/icons/index.d.ts.map +1 -1
- package/dist/icons/index.js +2 -1
- package/dist/icons/packs.d.ts +34 -0
- package/dist/icons/packs.d.ts.map +1 -0
- package/dist/icons/packs.js +70 -0
- package/dist/icons/packs.js.map +1 -0
- package/dist/icons/svg.d.ts +9 -2
- package/dist/icons/svg.d.ts.map +1 -1
- package/dist/icons/svg.js +13 -2
- package/dist/icons/svg.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/layout/index.d.ts +43 -0
- package/dist/layout/index.d.ts.map +1 -0
- package/dist/layout/index.js +31 -0
- package/dist/layout/index.js.map +1 -0
- package/dist/services/contracts.d.ts +32 -0
- package/dist/services/contracts.d.ts.map +1 -1
- package/dist/services/contracts.js.map +1 -1
- package/dist/services/feedback.d.ts +28 -0
- package/dist/services/feedback.d.ts.map +1 -0
- package/dist/services/feedback.js +27 -0
- package/dist/services/feedback.js.map +1 -0
- package/dist/services/index.d.ts +3 -1
- package/dist/services/index.d.ts.map +1 -1
- package/dist/services/index.js +2 -0
- package/dist/services/keys.d.ts +39 -0
- package/dist/services/keys.d.ts.map +1 -0
- package/dist/services/keys.js +96 -0
- package/dist/services/keys.js.map +1 -0
- package/dist/theme/aliases.d.ts +73 -0
- package/dist/theme/aliases.d.ts.map +1 -0
- package/dist/theme/aliases.js +76 -0
- package/dist/theme/aliases.js.map +1 -0
- package/dist/theme/appearance.d.ts +57 -0
- package/dist/theme/appearance.d.ts.map +1 -0
- package/dist/theme/appearance.js +275 -0
- package/dist/theme/appearance.js.map +1 -0
- package/dist/theme/brand.d.ts +40 -0
- package/dist/theme/brand.d.ts.map +1 -0
- package/dist/theme/brand.js +181 -0
- package/dist/theme/brand.js.map +1 -0
- package/dist/theme/contrast.d.ts +19 -0
- package/dist/theme/contrast.d.ts.map +1 -0
- package/dist/theme/contrast.js +119 -0
- package/dist/theme/contrast.js.map +1 -0
- package/dist/theme/css-color.d.ts +20 -0
- package/dist/theme/css-color.d.ts.map +1 -0
- package/dist/theme/css-color.js +149 -0
- package/dist/theme/css-color.js.map +1 -0
- package/dist/theme/design.d.ts +33 -0
- package/dist/theme/design.d.ts.map +1 -0
- package/dist/theme/design.js +162 -0
- package/dist/theme/design.js.map +1 -0
- package/dist/theme/index.d.ts +10 -2
- package/dist/theme/index.d.ts.map +1 -1
- package/dist/theme/index.js +10 -2
- package/dist/theme/oklch.d.ts +63 -0
- package/dist/theme/oklch.d.ts.map +1 -0
- package/dist/theme/oklch.js +258 -0
- package/dist/theme/oklch.js.map +1 -0
- package/dist/theme/recipe.d.ts +44 -0
- package/dist/theme/recipe.d.ts.map +1 -0
- package/dist/theme/recipe.js +156 -0
- package/dist/theme/recipe.js.map +1 -0
- package/dist/theme/theme.d.ts +43 -2
- package/dist/theme/theme.d.ts.map +1 -1
- package/dist/theme/theme.js +85 -9
- package/dist/theme/theme.js.map +1 -1
- package/dist/theme/variants.d.ts +10 -0
- package/dist/theme/variants.d.ts.map +1 -1
- package/dist/theme/variants.js +74 -1
- package/dist/theme/variants.js.map +1 -1
- package/dist/tokens/derived.d.ts +31 -0
- package/dist/tokens/derived.d.ts.map +1 -0
- package/dist/tokens/derived.js +42 -0
- package/dist/tokens/derived.js.map +1 -0
- package/dist/tokens/index.d.ts +2 -0
- package/dist/tokens/index.d.ts.map +1 -1
- package/dist/tokens/index.js +2 -0
- package/dist/tokens/shape.d.ts +46 -0
- package/dist/tokens/shape.d.ts.map +1 -0
- package/dist/tokens/shape.js +95 -0
- package/dist/tokens/shape.js.map +1 -0
- package/docs/api.md +135 -2
- package/package.json +6 -1
package/docs/api.md
CHANGED
|
@@ -15,58 +15,122 @@ folder) explain how the pieces fit; the migration tables map every MAUI member.
|
|
|
15
15
|
| `metricCssVariableName` | function | CSS variable of a `G9Metrics` value: `RadiusMd` → `--g9-metric-radius-md`. |
|
|
16
16
|
| `resolveFullScreenSheetTopPadding` | function | Top padding band above a full-screen sheet's content: exactly the status-bar inset (plus the additional padding), never negative; an explicit override wins. MAUI `G9LayoutMetrics.ResolveFullScreenSheetTopPadding`. |
|
|
17
17
|
| `resolveLayoutMetrics` | function | Resolves the layout metrics: the MAUI fallbacks, then `overrides` (the counterpart of defining the keys in the app's `LayoutMetrics.xaml`), then the derived members. An unknown key or a wrongly shaped value throws a `G9Error` (`layout-metric-unknown` / `layout-metric-invalid`) instead of being ignored. |
|
|
18
|
+
| `resolveShape` | function | A shape with some parts replaced (deep for radii, type roles and heights). |
|
|
18
19
|
| `resolveThemeColor` | function | A colour value with a `var(--g9-<token>)` reference resolved against `palette` (`'var(--g9-surface)'` → the palette's `Surface`); any other value, or a variable the palette does not have, is returned unchanged. For places that need a literal, such as the value of another custom property (a `var()` there is not resolved on every engine). |
|
|
19
20
|
| `toCssVariables` | function | One `--g9-<token>` variable per colour of `palette`, in token order. |
|
|
21
|
+
| `toDerivedCssVariables` | function | The derived variables' values for a resolved theme (the provider writes them with the token variables). |
|
|
20
22
|
| `toKebabCase` | function | `OnPrimaryContainer` → `on-primary-container`, `SpacingXSmall` → `spacing-x-small`, `G9BottomSheet…` → `g9-bottom-sheet…`. |
|
|
21
23
|
| `toLayoutCssVariables` | function | The layout metrics as CSS variables (the counterpart of MAUI `G9LayoutMetrics.InstallDefaults`, which seeded the resource keys XAML bound to). Lengths get `px`, `DeferredContentLoadDelayMs` gets `ms`, counts and ratios none. |
|
|
22
24
|
| `toMetricCssVariables` | function | One `--g9-metric-<name>` variable per `G9Metrics` value, with its unit (`px`, `ms` or none). |
|
|
25
|
+
| `toShapeCssVariables` | function | CSS variables of a shape: `--g9-radius-<role>`, `--g9-type-<role>-size\|line\|weight`, `--g9-height-sm\|md\|lg`, `--g9-touch-target` (all px). |
|
|
23
26
|
| `G9ColorToken` | enum | The colour tokens of the G9 theme in MAUI declaration order (MAUI `G9ColorToken`). Values keep the MAUI names so `G9ColorToken.Primary === 'Primary'`; the CSS variable is `--g9-primary` (see `cssVariableName`). |
|
|
24
27
|
| `g9ColorTokens` | constant | Every token, in declaration order. |
|
|
25
28
|
| `g9DarkPalette` | constant | The stock dark palette (MAUI `G9Theme.Dark.xaml`). |
|
|
29
|
+
| `g9DefaultShape` | constant | The default shape: 12 px controls and fields, 16 px cards, 24 px sheets, the type scale and heights 36 / 44 / 52. |
|
|
30
|
+
| `g9Derived` | constant | The derived variables, as `var(...)` references (what controls write into their styles). |
|
|
31
|
+
| `g9GradientTokens` | constant | The tokens a solid button paints as a soft vertical gradient (MAUI `BuildSolidOrGradient`). |
|
|
26
32
|
| `g9LayoutMetricConstants` | constant | Compile-time constants of MAUI `G9LayoutMetrics`: never read from resources, so not overridable. |
|
|
27
33
|
| `g9LayoutMetricDefaults` | constant | The layout metrics an app may retune (MAUI read these from `Application.Resources` with the literal fallbacks below; the census card `Core.Theming` lists them as `=> D(nameof(X), n)`, `Th(…)` and `Cr(…)`). |
|
|
28
34
|
| `g9LayoutMetrics` | constant | The stock layout metrics (no overrides). |
|
|
29
35
|
| `g9LightPalette` | constant | The stock light palette (MAUI `G9Theme.Light.xaml`). |
|
|
30
36
|
| `G9Metrics` | constant | Shared visual metric defaults of the G9 controls (MAUI `G9Metrics`), every public static value in declaration order. Lengths are logical pixels, `…Ms` values are milliseconds, scales/opacities are plain numbers. |
|
|
31
37
|
| `g9MetricUnits` | constant | The CSS unit each metric is emitted with by `toMetricCssVariables`. |
|
|
38
|
+
| `G9ControlHeights` | interface | The three heights every control family shares (button, field, segmented, stepper, chip in its large size). |
|
|
32
39
|
| `G9CornerRadii` | interface | Per-corner radii in pixels (MAUI `CornerRadius`; left corners are the start side). |
|
|
33
40
|
| `G9EdgeInsets` | interface | Logical edge insets in pixels (MAUI `Thickness`; `Left` is the start side, `Right` the end side). |
|
|
34
41
|
| `G9FullScreenSheetTopPaddingInput` | interface | Input of `resolveFullScreenSheetTopPadding`. |
|
|
42
|
+
| `G9ShapeRadii` | interface | Corner radii by role, in dp. |
|
|
43
|
+
| `G9ShapeSet` | interface | A theme's shape: corner radii per role, the type scale and the three control heights. |
|
|
44
|
+
| `G9TypeRole` | interface | A type role: size and line height in dp, a weight 400…800. |
|
|
35
45
|
| `G9CornerRadius` | type | A corner radius: one value for all four corners, or one per corner. |
|
|
36
46
|
| `G9CssVariables` | type | A set of CSS custom properties: name (`--g9-…`) to value. Feed it to a root element's style or `setProperty`. |
|
|
47
|
+
| `G9GradientToken` | type | A colour token that has gradient stops (`--g9-<token>-grad-top` / `-grad-bottom`). |
|
|
37
48
|
| `G9LayoutMetricOverrides` | type | Values an app may override; `MapBottomBarMargin` is derived from `MapChromeEdgeSpacing` unless overridden. |
|
|
38
49
|
| `G9LayoutMetrics` | type | Every layout metric, resolved (MAUI `G9LayoutMetrics`). |
|
|
39
50
|
| `G9MetricName` | type | The name of a `G9Metrics` value. |
|
|
40
51
|
| `G9PaletteValues` | type | One CSS colour per token: a complete palette (MAUI `G9PaletteValues`). |
|
|
52
|
+
| `G9TypeRoleName` | type | A role of the type scale (display, title, section, body, label, caption, price, mono). |
|
|
53
|
+
|
|
54
|
+
## `@g9tm/lynxcontrols-foundation/layout`
|
|
55
|
+
|
|
56
|
+
| Export | Kind | Summary |
|
|
57
|
+
| --- | --- | --- |
|
|
58
|
+
| `byLayout` | function | Chooses by layout class: `byLayout(layout, { phone: 1, tablet: 2, desktop: 3 })` (missing classes fall back down). |
|
|
59
|
+
| `classifyWidth` | function | The class of a width. |
|
|
60
|
+
| `resolveLayout` | function | The full layout of a window size. |
|
|
61
|
+
| `resolvePresentation` | function | The presentation of an overlay that asked for `preferred` (`'auto'`: bottom sheet on narrow, dialog on wide). A `'side'` request falls back to a bottom sheet on narrow windows, where a side panel would cover the whole screen. |
|
|
62
|
+
| `sameLayoutClass` | function | True when two layouts differ in anything a control branches on (class, wide, orientation) — not in raw pixels. |
|
|
63
|
+
| `g9Breakpoints` | constant | Window widths (px) where the layout changes: tablet 720, desktop 1100; a sheet becomes a dialog from 860. |
|
|
64
|
+
| `G9Breakpoints` | interface | Widths in dp at which the layout changes. |
|
|
65
|
+
| `G9Layout` | interface | What a control needs to know about the window, all derived from its size. |
|
|
66
|
+
| `G9LayoutClass` | type | The window's size class: phone, tablet or desktop. |
|
|
67
|
+
| `G9Presentation` | type | How a sheet-like overlay presents at this layout. |
|
|
41
68
|
|
|
42
69
|
## `@g9tm/lynxcontrols-foundation/theme`
|
|
43
70
|
|
|
44
71
|
| Export | Kind | Summary |
|
|
45
72
|
| --- | --- | --- |
|
|
73
|
+
| `aliasCssVariables` | function | CSS variables for the app's names, each a reference to the library's variable, so a stylesheet written against `var(--ink)` follows the library theme with no repaint code: `{ '--ink': 'var(--g9-text-primary)' }`. `prefix` is prepended to the alias (G9Hub: `'g9-'` keeps its `--g9-surface-2`). |
|
|
74
|
+
| `aliasPalette` | function | The app's names with their colours in `palette` (for code that reads colours from an object, like `t.ink`). |
|
|
46
75
|
| `applyAlpha` | function | MAUI `G9AlphaConverter.Convert`: applies `alpha` (clamped to `0..1`) when it is a number, otherwise returns the colour unchanged. `ConvertBack` had no behaviour (it threw) and has no counterpart. |
|
|
76
|
+
| `applyThemeDefinition` | function | Paints `theme` into `store` (one notification): the recipe's palettes for its brand, the designer overrides layered per scheme, the forced mode if any. Returns the theme's resolved shape for the provider's CSS variables. |
|
|
77
|
+
| `brandRecipe` | function | A recipe built on the brand generator with fixed options. |
|
|
47
78
|
| `buildSolidOrGradient` | function | MAUI `G9Colors.BuildSolidOrGradient`: the solid colour, or a vertical gradient from 8 % lighter (top) through the colour (middle) to 8 % darker (bottom). |
|
|
79
|
+
| `chartPalette` | function | `n` chart colours that start at `primary` and step around the hue circle by the golden angle (137.5°), each at a lightness that reads on `background` (contrast ≥ 3, WCAG for graphics) and a chroma the scheme can carry. Neighbours stay distinguishable for n ≤ 10; the same inputs always give the same palette. |
|
|
48
80
|
| `checkBoxMark` | function | Check mark / indeterminate bar on a filled box: `OnPrimary` (the one place the mark colour is decided). |
|
|
81
|
+
| `colorDistance` | function | Perceptual distance (ΔE in OKLab, ×100: about 2 is just noticeable). |
|
|
82
|
+
| `contrastFailures` | function | Only the failures. |
|
|
83
|
+
| `contrastReport` | function | Checks `palette` against `rules` (default `g9ContrastRules`); failures first. |
|
|
49
84
|
| `createBorderColor` | function | 15 % darker: the stock border recipe. MAUI `G9ColorHelper.CreateBorderColor`. |
|
|
85
|
+
| `createBrandPalette` | function | The full palette for `scheme`. Pure and deterministic: the same brand gives the same palette everywhere (app, web, server-side previews), so it can be computed at build time or on the device. |
|
|
86
|
+
| `createBrandPalettes` | function | Both schemes at once (what a theme store's `palettes` option takes). |
|
|
87
|
+
| `createDesignRegistry` | function | Creates the registry. Colour ids are `color.<Token>` (`color.Primary`); shape ids are `shape.radius.card`, `shape.height.md`, `shape.type.body.size`, `shape.touchTarget`. A change is an override layered over the app's own overrides, so a reset returns exactly to what the app painted. |
|
|
50
88
|
| `createHoverColor` | function | 8 % darker: the stock hover recipe. MAUI `G9ColorHelper.CreateHoverColor`. |
|
|
51
89
|
| `createPalette` | function | Validates a complete palette (every token, every value a readable colour) and returns a frozen copy in token order. |
|
|
52
90
|
| `createPressedColor` | function | 20 % darker: the stock pressed recipe. MAUI `G9ColorHelper.CreatePressedColor`. |
|
|
53
91
|
| `createThemeStore` | function | Creates a `G9ThemeStore`. Options are validated like `resolveTheme`. |
|
|
54
92
|
| `darken` | function | Darkens each RGB channel by `percentage` (`0..1`, clamped); alpha is kept. MAUI `G9ColorHelper.Darken`. |
|
|
93
|
+
| `designedRecipe` | function | A designer's recipe: hand-picked tokens per scheme over a generated base (ShopManager's `designedRecipe`). Tokens not listed come from the brand generator, so a designed theme stays complete when the token set grows. |
|
|
94
|
+
| `ensureContrast` | function | `fg` moved in lightness (hue and chroma kept) until its WCAG contrast with `bg` is at least `min`. Goes darker on a light background and lighter on a dark one; returns `fg` unchanged when it already passes. If no lightness of this hue reaches `min`, returns black or white, whichever contrasts more. |
|
|
95
|
+
| `exportTheme` | function | A theme as portable JSON (personal themes, sharing, backup). |
|
|
55
96
|
| `fillToCss` | function | A fill as a CSS `background` value: the colour, or `linear-gradient(to bottom, …)`. |
|
|
56
97
|
| `formatColor` | function | Formats a colour as CSS: `#RRGGBB` when opaque, otherwise `rgba(R, G, B, A)`. Channels are rounded to the nearest byte; the alpha is printed with the fewest digits that parse back to the same float32 value, so `parseColor(formatColor(c))` reproduces the alpha exactly. |
|
|
98
|
+
| `fromOklch` | function | OKLCH → sRGB (`G9Rgba`, channels 0..1). Out-of-gamut colours keep L and H and lose chroma until they fit (binary search, 18 steps ≈ 1e-6 chroma), so a vivid brand never shifts hue when it is darkened or lightened. |
|
|
57
99
|
| `getContrastingTextColor` | function | Black on light backgrounds (luminance above 0.5), white otherwise. MAUI `GetContrastingTextColor`. |
|
|
58
100
|
| `getContrastRatio` | function | WCAG contrast ratio, `1` to `21`. |
|
|
59
101
|
| `getLuminance` | function | WCAG relative luminance, `0` (black) to `1` (white). Alpha is ignored, as in MAUI. |
|
|
102
|
+
| `getRecipe` | function | The recipe called `name`. |
|
|
60
103
|
| `hasSwatch` | function | True when at least one swatch colour is set (MAUI `G9Visuals.HasSwatch`). The shared convention: no colour → no swatch, one → solid circle, two → circle split into two vertical halves. |
|
|
104
|
+
| `importTheme` | function | Reads exported JSON back, checking every colour and the shape's numbers; the result is always a personal theme with a fresh id when `newId` is given (an import never overwrites a built-in). |
|
|
105
|
+
| `interpolateStops` | function | A colour at `t` (0..1) along several stops, mixed in OKLCH — e.g. Riskara's risk spectrum (`interpolateStops([calm, lime, amber, coral], score / 100)`). |
|
|
106
|
+
| `isInSrgbGamut` | function | True when the OKLCH colour is inside sRGB. |
|
|
107
|
+
| `isScheduledDark` | function | True when `hour` falls in the schedule's dark span. |
|
|
61
108
|
| `lighten` | function | Moves each RGB channel towards white by `percentage` (`0..1`, clamped). MAUI `G9ColorHelper.Lighten`. |
|
|
109
|
+
| `lightnessOf` | function | Lightness 0..1 of any parsable colour (for "is this a dark surface?" decisions). |
|
|
110
|
+
| `listRecipes` | function | Every registered recipe, in registration order. |
|
|
62
111
|
| `meetsWcagAA` | function | Contrast of at least 4.5:1 (WCAG AA, normal text). |
|
|
63
112
|
| `meetsWcagAAA` | function | Contrast of at least 7:1 (WCAG AAA, normal text). |
|
|
64
113
|
| `mix` | function | Linear mix of all four channels: `ratio` 0 is all `first`, 1 is all `second` (clamped). MAUI `Mix`. |
|
|
114
|
+
| `mixOklch` | function | Linear interpolation in OKLCH (shorter hue arc). `t` 0..1. |
|
|
115
|
+
| `nearestTonalStep` | function | The step whose lightness is nearest to `color`'s. |
|
|
116
|
+
| `neutralScale` | function | A neutral scale tinted by `color`: the brand's hue at a whisper of chroma (`tint` 0 = pure grey, 1 = 0.02 C, the strongest tint that still reads as grey), so surfaces and text belong to the brand without looking coloured. |
|
|
117
|
+
| `oklchToHex` | function | OKLCH → `#RRGGBB` (or `#RRGGBBAA` with alpha < 1). |
|
|
118
|
+
| `overriddenTokens` | function | Tokens a theme overrides (for a "what is changed" list in a theme editor). |
|
|
65
119
|
| `parseColor` | function | Parses a CSS colour: `#rgb`, `#rgba`, `#rrggbb`, `#rrggbbaa` (CSS order, alpha last), `rgb(r, g, b)`, `rgba(r, g, b, a)` (channels 0–255 or percentages, alpha 0–1 or a percentage) and `transparent`. Named colours other than `transparent` are not accepted: the palette tokens are the names. |
|
|
120
|
+
| `parseCssColor` | function | Parses any colour Lynx might be handed by a design tool or a web theme: hex, rgb/rgba, hsl/hsla, oklch, oklab, color-mix (in srgb, oklch or oklab, with percentages), a few named colours. Returns channels, or `undefined`. |
|
|
66
121
|
| `parseMauiColor` | function | Parses a colour written the MAUI way: `#rgb`, `#argb`, `#rrggbb` or `#aarrggbb`. Note the **alpha-first** order for 4 and 8 digits, unlike CSS. This is how the MAUI theme dictionaries and `golden/theme-palettes.json` spell colours. |
|
|
122
|
+
| `previewThemeDefinition` | function | A theme definition resolved for one scheme without touching any store: what `G9ThemePreviewCard` shows (a theme picker's cards, an editor's draft). Only the asked scheme's palette is built (palettes are cached by recipe and brand, so showing the same card again costs nothing). |
|
|
123
|
+
| `readableOn` | function | Black or white text, whichever contrasts more with `bg`, nudged toward `tint`'s hue when given. |
|
|
124
|
+
| `recipePalettes` | function | The palettes a recipe makes for a brand, both schemes (a theme store's `palettes` option): each scheme is built when first read and cached, so the store only builds the one it paints. |
|
|
125
|
+
| `registerRecipe` | function | Adds or replaces a recipe. |
|
|
67
126
|
| `resolveButtonVariant` | function | Resolves a button variant against a palette (MAUI `G9Visuals.ResolveButtonVariant`, which read `G9Palette.Current`; pass the active theme's palette). An unrecognised variant resolves like `'primary'`, as the MAUI switch's default arm did. |
|
|
68
|
-
| `
|
|
127
|
+
| `resolveButtonVariantVars` | function | `resolveButtonVariant` as `var(--g9-…)` references (no palette read; cached per variant). |
|
|
128
|
+
| `resolveColorFunctions` | function | Every colour function inside a CSS value replaced by a paintable colour (`'1px solid color-mix(in oklch, #f00 30%, white)'` → `'1px solid #FFB3A7'`), for shorthands and gradients. |
|
|
129
|
+
| `resolveColorScheme` | function | `'light'`/`'dark'` pick that scheme; `'system'` follows `systemScheme` (MAUI `G9Theme.ApplyCurrent`); `'scheduled'` is dark during the schedule's span at `hour`. |
|
|
130
|
+
| `resolveCssColor` | function | A colour Lynx can paint (`#RRGGBB` or `rgba(…)`), or the input unchanged when it is not a colour (a `var(--x)`). |
|
|
131
|
+
| `resolveEasing` | function | A named easing as Lynx-readable CSS, or the input when it already is one. |
|
|
69
132
|
| `resolveProgressColor` | function | Fill colour of a progress indicator (MAUI `G9Visuals.ResolveProgressColor`); unrecognised types use `Primary`. |
|
|
133
|
+
| `resolveProgressColorVar` | function | `resolveProgressColor` as a `var(--g9-…)` reference. |
|
|
70
134
|
| `resolveTheme` | function | Resolves the painted theme: the stock palette of the effective scheme, then the app palette for that scheme, then `overrides`. Every supplied value is validated; nothing invalid is silently kept. |
|
|
71
135
|
| `rgba` | function | Builds channels the way the MAUI `Color(float, float, float, float)` constructor does: each channel is clamped to `0..1` and stored as float32. `NaN` stays `NaN`, as it does in .NET. |
|
|
72
136
|
| `stockPalette` | function | The stock palette of a scheme (MAUI `G9ThemeLight` / `G9ThemeDark`). |
|
|
@@ -74,34 +138,61 @@ folder) explain how the pieces fit; the migration tables map every MAUI member.
|
|
|
74
138
|
| `switchOnTrack` | function | Switch track when on: `Primary`. |
|
|
75
139
|
| `switchThumbOff` | function | Switch thumb when off: `OnSurfaceVariant` in dark, `Surface` in light. |
|
|
76
140
|
| `switchThumbOn` | function | Switch thumb when on: `OnPrimaryContainer` in dark, `OnPrimary` in light. |
|
|
141
|
+
| `themeName` | function | A theme's display name in `language` (falls back to English, then any). |
|
|
77
142
|
| `toHex` | function | MAUI `G9ColorHelper.ToHex`: `#RRGGBB` without alpha, each channel **truncated** after a float32 multiply by 255 — the original's exact arithmetic, kept so derived colours print the same hex as before. |
|
|
143
|
+
| `tonalScale` | function | A tonal scale from one colour: same hue, lightness from the step table, chroma scaled from the source's. The source itself is placed exactly at its nearest step, so the brand colour always appears in its own scale unchanged. |
|
|
144
|
+
| `toOklch` | function | A colour in OKLCH (lightness, chroma, hue): the perceptual space the brand palettes and tonal scales are built in. Cached per string. |
|
|
78
145
|
| `toRgba` | function | Normalises a helper input to channels. Strings go through `parseColor`. |
|
|
79
146
|
| `tryParseColor` | function | `parseColor` that returns `undefined` instead of throwing. |
|
|
80
147
|
| `withAlpha` | function | The same colour with a new alpha (`MAUI Color.WithAlpha`); `alpha` is clamped to `0..1`. |
|
|
81
148
|
| `withOpacity` | function | MAUI `G9ColorHelper.WithOpacity`. `null`/`undefined` returns the colour unchanged; a number or an invariant-culture numeric string sets the alpha, clamped to `0..1`; an unreadable string means opacity `1`. |
|
|
82
149
|
| `G9ColorScheme` | enum | The scheme actually painted. |
|
|
83
150
|
| `G9ThemeMode` | enum | Which theme the user chose (MAUI `AppTheme`: `Unspecified` is `system`, follow the platform). |
|
|
151
|
+
| `g9AccentPresets` | constant | Accent colours offered by "pick a colour" UIs (G9Hub ACCENT_PRESETS, SAC brand picker). Tested for contrast. |
|
|
152
|
+
| `g9AliasPresets` | constant | Ready-made alias maps for the four G9 apps' existing names (the migration guides start from these). |
|
|
153
|
+
| `g9BuiltInThemes` | constant | The built-in themes over the built-in recipes, one per accent preset family. |
|
|
84
154
|
| `G9Colors` | constant | Alpha recipes the G9 controls paint with (MAUI `G9Colors` constants). |
|
|
155
|
+
| `g9ContrastRules` | constant | The rules every palette must pass. |
|
|
156
|
+
| `g9DefaultThemeSchedule` | constant | The default dark span of the scheduled mode: from 18:00 to 07:00. |
|
|
157
|
+
| `g9Easings` | constant | Named easings as cubic-bezier (Lynx reads cubic-bezier, linear, ease, ease-in, ease-out, ease-in-out). |
|
|
158
|
+
| `g9TonalSteps` | constant | Steps of a tonal scale (Tailwind-like names: 50 lightest … 950 darkest). |
|
|
85
159
|
| `G9ColorFormatError` | class | Thrown when a string is not a colour this library can read. |
|
|
160
|
+
| `G9BrandColors` | interface | The colours a brand gives. Only `primary` is required; the rest are derived when missing. |
|
|
161
|
+
| `G9BrandPaletteOptions` | interface | How `createBrandPalette` builds a palette from a brand colour: grey tint, contrast target and whether the brand colour is kept as is. |
|
|
162
|
+
| `G9ContrastResult` | interface | One rule's outcome. |
|
|
86
163
|
| `G9CustomPalettes` | interface | App palettes replacing (all or some of) the stock light and dark palettes. |
|
|
164
|
+
| `G9DesignRegistry` | interface | Pilot's `DesignRegistry`. |
|
|
165
|
+
| `G9DesignRegistryOptions` | interface | What `createDesignRegistry` edits live: the theme store and, when the app allows it, the shape. |
|
|
166
|
+
| `G9DesignToken` | interface | One token as Pilot reads it. |
|
|
87
167
|
| `G9GradientStop` | interface | A gradient stop: colour at `offset` (`0..1`). |
|
|
168
|
+
| `G9Oklch` | interface | A colour in OKLCH. `alpha` 0..1 (default 1). |
|
|
88
169
|
| `G9ResolvedTheme` | interface | A resolved theme: what is painted and why. Frozen. |
|
|
89
170
|
| `G9Rgba` | interface | A colour as four channels in `0..1`, stored at float32 precision exactly like MAUI `Color`. Colour arithmetic (darken, mix, contrast) runs on this shape so its results match the original helpers bit for bit; format with `formatColor` to get a CSS string back. |
|
|
171
|
+
| `G9ThemeDefinition` | interface | One selectable theme. |
|
|
90
172
|
| `G9ThemeOptions` | interface | Inputs of theme resolution. |
|
|
173
|
+
| `G9ThemeRecipe` | interface | A named recipe. |
|
|
174
|
+
| `G9ThemeSchedule` | interface | When `'scheduled'` paints dark: from `darkFrom` (hour, 0–23) to `darkTo` (exclusive), across midnight when `darkFrom > darkTo`. Default 18 → 7 (Riskara's evening theme). |
|
|
91
175
|
| `G9ThemeStore` | interface | The live theme (MAUI `G9Palette.Current` + `G9Theme`): one snapshot, replaced on every change, and listeners told once per change. Works with `useSyncExternalStore` (`subscribe` / `getSnapshot`). |
|
|
92
176
|
| `G9VariantColors` | interface | The colours a variant resolves to: fill, foreground, stroke, and whether the fill is a gradient (MAUI `G9VariantColors`). Colours are CSS strings. |
|
|
177
|
+
| `G9VariantVars` | interface | A variant painted with CSS variables: the same colours as `resolveButtonVariant`, following the theme with no script (the provider writes the variables). `gradient` names the token whose gradient a solid fill uses. |
|
|
93
178
|
| `G9ButtonVisualResult` | type | The colours a button finally paints, after its `baseBackgroundColor` / `textColor` escape hatches are applied over the variant (MAUI `G9Visuals.ButtonVisualResult`). Same shape as `G9VariantColors`, so a button treats both paths identically; the button itself (WP04) applies the escape hatches. |
|
|
94
179
|
| `G9Color` | type | A CSS colour string, the value type every G9 colour prop takes (plan/specs/03-API-Conventions.md §2). Use `g9Token` for a theme token reference such as `var(--g9-primary)`. |
|
|
95
180
|
| `G9ColorInput` | type | Anything the colour helpers accept: a CSS colour string or channels. |
|
|
181
|
+
| `G9ContrastRule` | type | `[foreground, background, minimum]`. 4.5 = body text (WCAG AA), 3 = large text, icons and borders that carry meaning. |
|
|
96
182
|
| `G9Fill` | type | A fill: a solid colour, or a top-to-bottom linear gradient. |
|
|
97
183
|
| `G9PaletteOverrides` | type | Some tokens replaced by CSS colours. |
|
|
98
184
|
| `G9ThemeListener` | type | Listener of `G9ThemeStore`; receives the snapshot taken at notify time. |
|
|
185
|
+
| `G9ThemeSource` | type | Where a theme definition comes from: built in, the organisation's, or the person's own. |
|
|
186
|
+
| `G9TokenAliasMap` | type | App name → library token (`'TextPrimary'`) or a literal colour (`'#1B1512'`). |
|
|
187
|
+
| `G9TonalScale` | type | A colour's tonal scale: one hex colour per step (50 lightest … 950 darkest). |
|
|
188
|
+
| `G9TonalStep` | type | A step of a tonal scale: 50, 100, 200 … 900, 950. |
|
|
99
189
|
|
|
100
190
|
## `@g9tm/lynxcontrols-foundation/culture`
|
|
101
191
|
|
|
102
192
|
| Export | Kind | Summary |
|
|
103
193
|
| --- | --- | --- |
|
|
104
194
|
| `addDays` | function | The date `days` later (earlier when negative). |
|
|
195
|
+
| `bytesToBase64` | function | Standard base64 of bytes (PrimJS has neither `btoa` nor `Buffer`): data URIs of generated images. |
|
|
105
196
|
| `clampToPersianRange` | function | The value pulled into the Persian calendar's range (MAUI `G9Calendar.ClampToPersianRange`); a value already inside is returned unchanged. A date stays a date and a date-time stays a date-time. |
|
|
106
197
|
| `combineLocalDateTime` | function | Joins a date and a time. |
|
|
107
198
|
| `compareLocal` | function | Orders dates or date-times (a date compares as its midnight): negative, 0 or positive. |
|
|
@@ -115,14 +206,19 @@ folder) explain how the pieces fit; the migration tables map every MAUI member.
|
|
|
115
206
|
| `daysToMs` | function | A whole-day count as a duration in milliseconds. |
|
|
116
207
|
| `decomposeDays` | function | Splits a day count into years, months and days (MAUI `G9TimeSpanMath.Decompose`). Negative input counts as zero. Because 365 is not a multiple of 30, the last five days of a "year" stay in `days` (months is capped at 11, so days can reach 34) instead of producing a month 12 the drum cannot show. |
|
|
117
208
|
| `digitValue` | function | The value 0–9 of an ASCII, Persian or Arabic-Indic digit, or -1 for any other UTF-16 code unit. This is the digit set MAUI `G9Digits` recognises: a Persian or Arabic keyboard and any paste from a Persian source produce these. |
|
|
209
|
+
| `firstStrongDirection` | function | The direction of a text's first strong letter (Unicode bidi P2/P3, approximated for the scripts G9 apps show): `'rtl'` for Hebrew, Arabic, Persian, Syriac, Thaana and N'Ko letters, `'ltr'` for any other letter, `null` when the text has none (digits, punctuation, empty). A one-line label truncated with `…` takes it so a Persian title in an English screen keeps its first letter (AgriPad F-388): the platform otherwise lays it out by the screen's direction. |
|
|
118
210
|
| `formatAgo` | function | The relative phrase alone, e.g. `'2 d ago'`, `'۲ روز پیش'` (MAUI `G9RelativeTimeFormatter.FormatAgo`). Takes an absolute instant, so a time zone can no longer shift the result (MAUI subtracted a local `DateTime` from UTC now). |
|
|
119
211
|
| `formatAgoWithTime` | function | The phrase joined with the wall-clock time, e.g. `'6 h ago - 14:19'` (MAUI `FormatAgoWithTime`, the history timeline format). The time is `HH:mm` in the culture's digits at `utcOffsetMinutes`. |
|
|
212
|
+
| `formatCompact` | function | A large amount in words people say (Riskara `toman({short})`, SAC `price`): `12_500_000` → `۱۲٫۵ میلیون` (fa) or `12.5M` (en). One fraction digit, dropped when it is zero; amounts under a thousand stay whole. |
|
|
213
|
+
| `formatCoordinates` | function | A position as «lat، lon» that can never read as one number (AgriPad F-401: «۳۴٫۸۰۴۲,۵۰٫۴۱۶۰»): each number in the culture's digits and decimal separator, no grouping, a fixed number of decimals, the culture's list separator between them, the whole left-to-right isolated so RTL text keeps latitude first. `formatCoordinates(34.80421, 50.41603, { numberingSystem: 'persian' })` → `'۳۴٫۸۰۴۲، ۵۰٫۴۱۶۰'`. |
|
|
120
214
|
| `formatIsoDate` | function | `YYYY-MM-DD`. |
|
|
121
215
|
| `formatIsoDateTime` | function | `YYYY-MM-DDTHH:mm:ss.sss` (no zone). |
|
|
122
216
|
| `formatLocalDateTime` | function | Writes a date or date-time with a .NET-style custom pattern, without Intl: `yyyy yy y`, `MMMM MMM MM M`, `dddd ddd dd d`, `HH H hh h`, `mm m`, `ss s`, `fff ff f`, `tt t`; `'quoted'`/`"quoted"` text and `\x` are literal; other non-letters (`/ : . - space`) are written as is. Names and AM/PM come from the culture's language (fa/ar/en); digits from its numbering system. A date without time formats as midnight. |
|
|
123
217
|
| `formatNumber` | function | Formats a number without `Intl` (Lynx has none): thousands grouping, fraction digits and the numbering system's digits and separators. `formatNumber(1234.5, { numberingSystem: 'persian' })` is `'۱٬۲۳۴٫۵'`. |
|
|
124
218
|
| `formatPlainNumber` | function | Writes a number the way .NET's composite formatting (`string.Format("{0}", n)`) does, in shortest round-trip form and without grouping, then in `numberingSystem`'s digits and separators. Used by `G9Strings.format` placeholders. |
|
|
219
|
+
| `formatSignedPercent` | function | A change as a signed percentage, always with its sign and isolated so RTL text never moves the sign to the wrong end (Riskara `pct`, SAC `Delta`): `0.125` → `+12.5%`; `formatSignedPercent(-3, { fromFraction: false })` → `−3%`. |
|
|
125
220
|
| `formatTemplate` | function | Fills a .NET composite-format template (`{0}`, `{{`, `}}`). Specifiers (`{0:N2}`, `{0,5}`) are rejected rather than ignored. |
|
|
221
|
+
| `formatWeight` | function | A weighed quantity (ShopManager `QtyText` / `kg`): kilograms to one decimal, dropped when whole, grouped, in the culture's digits — `2.5` → `۲٫۵ کیلوگرم` (fa, long) / `۲٫۵ کیلو` (fa, short) / `2.5 kg` (en). Under a kilogram, `grams: true` writes grams instead (`0.35` → `۳۵۰ گرم` / `350 g`). |
|
|
126
222
|
| `fromCalendarDate` | function | The Gregorian day of a date written in a calendar (`{ calendar: 'persian', year: 1403, month: 1, day: 1 }` → 2024-03-20). |
|
|
127
223
|
| `fromEpochDays` | function | The date `epochDays` after 1970-01-01. |
|
|
128
224
|
| `g9StringResourceName` | function | The MAUI member name of a key (`'noResults'` → `'NoResults'`): the name a provider or resource catalogue sees. |
|
|
@@ -131,8 +227,12 @@ folder) explain how the pieces fit; the migration tables map every MAUI member.
|
|
|
131
227
|
| `getNumberSymbols` | function | Decimal, grouping and minus characters for a numbering system. |
|
|
132
228
|
| `getRelativeTimeParts` | function | Buckets an instant against `now` exactly like MAUI `G9RelativeTimeFormatter.FormatAgo`: under a minute is "just now"; then whole minutes (< 60), hours (< 24), days (< 7), weeks (days / 7, < 30 days), months (days / 30, < 365 days), years (days / 365); counts are truncated and at least 1. A future instant counts as now. |
|
|
133
229
|
| `getWeekdayNames` | function | The 7 weekday names, index 0 = Sunday (matching `dayOfWeek`). English abbreviates to three letters. |
|
|
230
|
+
| `groupWhileTyping` | function | Regroups a number while it is typed and keeps the caret after the same digit (SAC `groupTyped`): typing `1234567` shows `1,234,567` (or `۱٬۲۳۴٬۵۶۷`), and the caret does not jump to the end when a digit is inserted in the middle. Accepts any digits and separators the person types; `decimals` 0 refuses a decimal point. |
|
|
134
231
|
| `isGregorianLeapYear` | function | `true` for a Gregorian leap year. |
|
|
135
232
|
| `isLeapYear` | function | `true` for a leap year of the calendar (Persian: Esfand has 30 days). |
|
|
233
|
+
| `isolate` | function | First-strong isolate: the direction of the text's first letter. |
|
|
234
|
+
| `isolateLtr` | function | Left-to-right isolate (FSI…PDI would guess; LRI forces): keeps `+12.5%` and phone numbers whole inside RTL text. |
|
|
235
|
+
| `isolateRtl` | function | Right-to-left isolate. |
|
|
136
236
|
| `isPersianLanguage` | function | `true` when the language is Persian (`fa`, any region), the test MAUI uses to show Jalali dates (`G9Calendar.IsPersianLanguage`). Dari (`prs`), Pashto, Arabic and the invariant culture are `false`. |
|
|
137
237
|
| `isRtl` | function | `true` when the culture reads right-to-left (MAUI `G9Culture.IsRtl`, `G9Visuals.IsRtl`). |
|
|
138
238
|
| `isSupportedByPersianCalendar` | function | `true` when the value is inside the Persian calendar's range (MAUI `G9Calendar.IsSupportedByPersianCalendar`). |
|
|
@@ -144,14 +244,19 @@ folder) explain how the pieces fit; the migration tables map every MAUI member.
|
|
|
144
244
|
| `localDateTimeToDate` | function | A `Date` at this wall-clock time in the device's zone. |
|
|
145
245
|
| `localDateTimeToEpochMs` | function | The instant (epoch ms) of a wall-clock date-time at a fixed UTC offset (`210` for Tehran +03:30). Lynx has no time-zone database (no Intl): the host supplies the offset, e.g. from its clock service. |
|
|
146
246
|
| `localTime` | function | A validated, frozen `G9LocalTime`. |
|
|
247
|
+
| `matchesSearch` | function | True when every word of `query` appears in `text` (any order, any spelling variant `normalizeText` unifies). |
|
|
147
248
|
| `msToWholeDays` | function | The whole days in a duration in milliseconds, truncated toward zero (.NET `TimeSpan.Days`). |
|
|
249
|
+
| `normalizePhone` | function | A phone number in E.164 (`+989121234567`), or null. Accepts any digits, spaces, dashes, a leading 0, 00 or +, and the national form; `country` gives the calling code for national numbers (default Iran, 98). |
|
|
250
|
+
| `normalizeText` | function | Unifies how Persian is written: Arabic letter forms → Persian, digits → ASCII, marks removed, spaces collapsed. |
|
|
148
251
|
| `normalizeToAscii` | function | Replaces every Persian (U+06F0–U+06F9) and Arabic-Indic (U+0660–U+0669) digit with its ASCII counterpart; every other character, separators included, is kept (MAUI `G9Digits.NormalizeToAscii`, both overloads: a one-character string is a `char`). `null`/`undefined` yield `''`. The input string is returned as is when nothing changes. |
|
|
149
252
|
| `parseIsoDate` | function | Reads `YYYY-MM-DD`. |
|
|
150
253
|
| `parseIsoDateTime` | function | Reads `YYYY-MM-DD[THH:mm[:ss[.fffffff]]]` (no zone; .NET round-trip strings included, sub-millisecond digits truncated). |
|
|
254
|
+
| `parseNaturalDate` | function | Parses `text` relative to `today`. `persian` (default true for Persian text) decides which calendar a month name without a year, «ماه بعد» and a bare day number belong to. |
|
|
151
255
|
| `parseNumber` | function | Reads a number typed in any of the three digit sets, with either separator style (`'1,234.5'`, `'۱٬۲۳۴٫۵'`, `'١٬٢٣٤٫٥'`), a leading sign and bidi marks. Returns `null` for anything else (no partial parse). |
|
|
152
256
|
| `persianNewYear` | function | First day (Nowruz, 1 Farvardin) of a Persian year, as a Gregorian date. |
|
|
153
257
|
| `resolveFontFamily` | function | The font family text should use now (MAUI `G9Culture.ResolveFontFamily`, `G9Visuals.ResolveCulturalFont`): a non-blank `explicitFontFamily` always wins, otherwise the culture's RTL or LTR family. `undefined` means "platform default". |
|
|
154
258
|
| `sameCulture` | function | Field-by-field equality of two culture values. |
|
|
259
|
+
| `searchKey` | function | A key to compare for search: `normalizeText`, lower-cased, ZWNJ-split words joined (`میروم` = `میروم`). |
|
|
155
260
|
| `toCalendarDate` | function | The date written in `calendar`. Persian dates match .NET `PersianCalendar` exactly for 1200–1501 AP (golden `calendar.json`); outside that span they follow |
|
|
156
261
|
| `toEpochDays` | function | Days since 1970-01-01 (negative before). |
|
|
157
262
|
| `toLocalDate` | function | The date part of a date-time (or the date itself). |
|
|
@@ -172,6 +277,7 @@ folder) explain how the pieces fit; the migration tables map every MAUI member.
|
|
|
172
277
|
| `persianMaxSupportedDateTime` | constant | Last instant the Persian calendar represents (MAUI `PersianMaxSupportedDateTime`; .NET's last tick → last ms). |
|
|
173
278
|
| `persianMinSupportedDateTime` | constant | First day the Persian calendar represents (MAUI `G9Calendar.PersianMinSupportedDateTime`, .NET 0622-03-22). |
|
|
174
279
|
| `G9CalendarDate` | interface | A date written in a given calendar (`{ calendar: 'persian', year: 1403, month: 1, day: 1 }`). |
|
|
280
|
+
| `G9CoordinateFormatOptions` | interface | Options of `formatCoordinates`. |
|
|
175
281
|
| `G9Culture` | interface | An immutable culture value: what MAUI read from `CultureInfo` plus the `G9Culture` facade, as independent settings (plan/specs/01-Architecture.md §7). Create with `createCulture`; frozen. |
|
|
176
282
|
| `G9CultureOptions` | interface | Settings that override what the locale implies. `undefined` keeps the locale default. |
|
|
177
283
|
| `G9CultureStore` | interface | The app's active culture (MAUI `G9Culture` facade + `CultureChanged`): one frozen snapshot, replaced on each change; listeners are told once per change. Works with `useSyncExternalStore` (`subscribe` / `getSnapshot`). The React provider (WP02) owns one. |
|
|
@@ -187,6 +293,7 @@ folder) explain how the pieces fit; the migration tables map every MAUI member.
|
|
|
187
293
|
| `G9RelativeTimeWithClockOptions` | interface | Inputs of `formatAgoWithTime`. |
|
|
188
294
|
| `G9Strings` | interface | Resolved strings for one culture (MAUI `G9Strings`). Immutable: build a new one when an input changes. |
|
|
189
295
|
| `G9StringsOptions` | interface | Inputs of `createStrings`. |
|
|
296
|
+
| `G9TypedNumber` | interface | The result of `groupWhileTyping`. |
|
|
190
297
|
| `G9CultureListener` | type | Listener of `G9CultureStore`: receives the snapshot taken when the change was notified. |
|
|
191
298
|
| `G9NameWidth` | type | `'wide'` (`January`) or `'abbreviated'` (`Jan`). Persian and Arabic names have no shorter form. |
|
|
192
299
|
| `G9Now` | type | A clock (the WP01.4 `G9Clock` contract fits) or a fixed instant, in epoch milliseconds. |
|
|
@@ -205,6 +312,7 @@ folder) explain how the pieces fit; the migration tables map every MAUI member.
|
|
|
205
312
|
| `createGlyphSvgCache` | function | Creates a bounded LRU cache of glyph SVG documents (default capacity `g9GlyphSvgCacheDefaultSize`). |
|
|
206
313
|
| `createIconFontRegistry` | function | Creates an empty icon-font registry (MAUI `G9IconFonts`, without the process-wide static state). |
|
|
207
314
|
| `defineIconFont` | function | Builds the frozen font icons of an icon-font table (MAUI `G9IconSource.FromEnum` and the implicit enum conversion): family = `font`, each member's glyph = its text, or its number read as a code point. An empty text throws (MAUI throws for an empty `[Description]`: a silently empty slot is harder to diagnose than a throw). |
|
|
315
|
+
| `findPackIcon` | function | The icon for `name` (`'pack:key'` or a bare `'key'`), or null when no pack has it. |
|
|
208
316
|
| `fontIcon` | function | A font glyph given as its literal text (MAUI `G9IconSource.FromFont`). Blank family or empty text throws. |
|
|
209
317
|
| `fontIconText` | function | The glyph text of a font icon, a code point converted to its (possibly surrogate-pair) string, or `undefined` for every other icon (MAUI `G9IconSource.Glyph`). |
|
|
210
318
|
| `glyphIcon` | function | A built-in glyph icon (MAUI `G9IconSource.FromGlyph` and the implicit `G9Glyph` conversion). Unknown glyphs throw. |
|
|
@@ -217,9 +325,14 @@ folder) explain how the pieces fit; the migration tables map every MAUI member.
|
|
|
217
325
|
| `isIconEmpty` | function | True when the value carries no icon: `null`, `undefined` or `{ glyph: 'none' }` (MAUI `G9IconSource.IsEmpty`). |
|
|
218
326
|
| `isImageIcon` | function | True for an image icon. |
|
|
219
327
|
| `isSvgIcon` | function | True for an SVG icon. |
|
|
328
|
+
| `listPackIcons` | function | Every registered name (`'pack:key'`), for pickers and docs. |
|
|
329
|
+
| `packIconSvg` | function | The SVG document of `icon` in `color` at stroke `weight` (cached; LRU bounded). |
|
|
330
|
+
| `registerIconPack` | function | Adds (or replaces, by name) a pack. Later packs win for bare names. |
|
|
220
331
|
| `resolveGlyphSlots` | function | Returns a frozen slot set: the defaults with `overrides` applied (MAUI: assigning `G9Glyphs.X`; no overrides is MAUI `G9Glyphs.Reset()`). An unknown slot name or a malformed icon throws a `G9Error` rather than being ignored. An override may be an empty icon (`{ glyph: 'none' }`), as MAUI allowed `G9IconSource.Empty`. |
|
|
221
|
-
| `svgForGlyph` | function | The SVG document of a built-in glyph for Lynx `<svg content>` (WP02 renders it): the golden MAUI drawing
|
|
332
|
+
| `svgForGlyph` | function | The SVG document of a built-in glyph for Lynx `<svg content>` (WP02 renders it): the golden MAUI drawing in the elements Lynx draws (`toLynxSvg`), every `currentColor` replaced by `color` and the stroke width scaled by `weightScale` (MAUI `G9GlyphDrawable.Color`, `WeightScale`; stroke = 2 design units × weight; filled dots keep their recorded radius). `'none'` returns `''` (renders nothing). `color` defaults to `currentColor`; any other value must be a CSS colour `parseColor` reads and is written normalised (`formatColor`). Invalid glyph, colour or weight (finite, above 0) throws a `G9Error`. Results come from a shared bounded LRU cache (`createGlyphSvgCache` for a private one). |
|
|
222
333
|
| `toIcon` | function | Normalises a slot value (MAUI implicit `G9Glyph` conversion): a `G9Glyph` string becomes `glyphIcon(value)`, an icon is validated and returned, `null`/`undefined` become `null` (no icon). Anything malformed throws a `G9Error`. |
|
|
334
|
+
| `toLynxSvg` | function | The SVG elements Lynx 4.2's svg element draws, from any SVG text: every line element (x1 y1 x2 y2) becomes the two-point path `M x1 y1 L x2 y2` of the same geometry and attributes. Lynx draws no line element at all (proven on a Galaxy A21s, 2026-11-18: ✕, +, −, ≡ and the search handle were invisible). The golden documents keep MAUI's elements; this is applied where they become Lynx content. |
|
|
335
|
+
| `unregisterIconPack` | function | Removes a pack (tests, a theme switch that changes icon style). |
|
|
223
336
|
| `G9Glyph` | enum | The library's own built-in glyph set (MAUI `G9Glyph`): the control-chrome affordances the controls need to look right with no icon font configured. They are vector paths (MAUI ADR-0003), rendered as SVG by `svgForGlyph`; for anything else register an icon font (`createIconFontRegistry`) and pass a font icon. Values are the camelCase member names. |
|
|
224
337
|
| `g9DefaultGlyphSlots` | constant | The built-in defaults of every slot, in MAUI declaration order (MAUI `G9Glyphs` initialisers and `Reset()`). |
|
|
225
338
|
| `g9Glyphs` | constant | Every glyph in MAUI declaration order; the index is the MAUI enum number (`'none'` is 0). |
|
|
@@ -233,7 +346,9 @@ folder) explain how the pieces fit; the migration tables map every MAUI member.
|
|
|
233
346
|
| `G9GlyphSlots` | interface | The icons the controls draw for themselves, and the one place to replace them (MAUI `G9Glyphs`). Every slot defaults to a built-in glyph; an app supplies overrides through `G9Provider settings.glyphs` (WP02, specs/03 §6) instead of mutating statics. Per MAUI ADR-0021, a control that exposes a slot draws every icon of that kind from the slot. |
|
|
234
347
|
| `G9GlyphSvgCache` | interface | A bounded least-recently-used cache of rendered glyph SVG documents. |
|
|
235
348
|
| `G9IconFontRegistry` | interface | The registry of icon fonts and the by-name lookup that turns a name decided at runtime (an API response, a config row) into an icon (MAUI `G9IconFonts`). One registry per app; the WP02 provider owns it (no module-level state). |
|
|
349
|
+
| `G9IconPack` | interface | A registered set of SVG icons. |
|
|
236
350
|
| `G9ImageIcon` | interface | An icon given as an image. |
|
|
351
|
+
| `G9PackIcon` | interface | A resolved pack icon. |
|
|
237
352
|
| `G9SvgIcon` | interface | An icon given as an SVG document (rendered with Lynx `<svg content>` in WP02). |
|
|
238
353
|
| `G9DrawableGlyph` | type | A glyph that draws something: every `G9Glyph` except `'none'`. |
|
|
239
354
|
| `G9FontIcon` | type | A glyph of an icon font. Two font icons are equal when their family and glyph text are equal. |
|
|
@@ -313,6 +428,7 @@ folder) explain how the pieces fit; the migration tables map every MAUI member.
|
|
|
313
428
|
| Export | Kind | Summary |
|
|
314
429
|
| --- | --- | --- |
|
|
315
430
|
| `assertRequiredCapabilities` | function | Checks every required capability at once (the provider calls this at mount). |
|
|
431
|
+
| `comboLabel` | function | How a combo reads on a key cap (`'Mod+K'` → `'Ctrl K'` / `'⌘ K'`). |
|
|
316
432
|
| `createAbortController` | function | A runtime `AbortController` when there is one, otherwise `createPortableAbortController`. |
|
|
317
433
|
| `createAbortError` | function | An `Error` named `'AbortError'`, the shape web APIs and `isAbortError` agree on. |
|
|
318
434
|
| `createManualClock` | function | Creates a `G9ManualClock`. |
|
|
@@ -320,14 +436,23 @@ folder) explain how the pieces fit; the migration tables map every MAUI member.
|
|
|
320
436
|
| `createMonotonicFromWall` | function | A monotonic counter built from a wall clock: it advances by every positive step of `wallNow` and ignores backward steps, so a clock corrected backwards pauses nothing and a forward jump only makes time pass faster once. |
|
|
321
437
|
| `createPortableAbortController` | function | The portable controller used when the runtime has no `AbortController`. Listeners run once, in order, guarded. |
|
|
322
438
|
| `createPreferences` | function | Creates the root `G9Preferences` over a store. One per app; the WP02 provider owns it. |
|
|
439
|
+
| `createSequenceMatcher` | function | Key sequences (`'g i'`: g then i within `timeoutMs`, G9Hub's "go to" shortcuts). Feed every key; it answers the sequence completed by this key, or null. |
|
|
323
440
|
| `createSystemClock` | function | The system clock: `Date.now()` for wall time; `performance.now()` for monotonic time where the runtime has it (the Lynx typings do not promise it), otherwise `createMonotonicFromWall` over `Date.now()`. |
|
|
441
|
+
| `g9Haptic` | function | A haptic for `kind`, if the host has haptics and the user allows them. |
|
|
324
442
|
| `g9MotionScale` | function | The current motion scale (1 = as designed). |
|
|
325
443
|
| `g9Ms` | function | A duration in ms at the current scale (whole ms; 0 stays 0). |
|
|
444
|
+
| `g9Sound` | function | A sound for `kind`, if the host has sounds and the user allows them. |
|
|
326
445
|
| `hasCapability` | function | `true` when the capability is present (optional features use this to hide themselves). |
|
|
327
446
|
| `isAbortError` | function | `true` for an error named `'AbortError'` (web `DOMException`, our `createAbortError`, most libraries). |
|
|
447
|
+
| `matchesCombo` | function | True when `event` is `combo` (`platform: 'mac'` maps Mod to Meta). |
|
|
448
|
+
| `parseCombo` | function | Parses `'Mod+K'`, `'ctrl+shift+p'`, `'Escape'`, `'?'`. Case-insensitive; the last part is the key. |
|
|
328
449
|
| `requireCapability` | function | The capability, or throws `G9CapabilityMissingError` naming it. |
|
|
450
|
+
| `setG9Feedback` | function | Installs (or removes, with null) the host's feedback; the provider does this from its `services`. |
|
|
451
|
+
| `setG9FeedbackEnabled` | function | The user's settings (an app's "vibration" and "sounds" switches). |
|
|
329
452
|
| `setG9MotionScale` | function | Sets the scale (clamped to 0..10). Listeners hear a real change only. |
|
|
330
453
|
| `subscribeG9Motion` | function | Hears every change of the scale; returns the remover. |
|
|
454
|
+
| `g9FieldKeyEventName` | constant | Global event for a key pressed inside a text field (hosts forward only Escape and modified keys). |
|
|
455
|
+
| `g9KeyEventName` | constant | Global event a host sends for a key pressed outside a text field. |
|
|
331
456
|
| `g9PreferenceKeyPrefix` | constant | The prefix on every key the controls write (MAUI `G9Preferences.KeyPrefix`). |
|
|
332
457
|
| `g9RequiredCapabilities` | constant | Capabilities without which the provider cannot mount. |
|
|
333
458
|
| `G9CapabilityMissingError` | class | Thrown when code needs a capability the app did not supply (specs/03 §7: `G9CapabilityMissingError('speech')`). |
|
|
@@ -335,7 +460,12 @@ folder) explain how the pieces fit; the migration tables map every MAUI member.
|
|
|
335
460
|
| `G9AbortSignal` | interface | The cancellation signal G9 passes to async work (MAUI `CancellationToken`, plan/specs/03-API-Conventions.md §2). A web `AbortSignal` satisfies it, so app code can hand it to `fetch`. The Lynx typings do not declare `AbortController`, and its presence on PrimJS is not verified, so `createAbortController` falls back to a small portable implementation when the runtime has none. |
|
|
336
461
|
| `G9Capabilities` | interface | Every service the app can supply. Required ones are listed in `g9RequiredCapabilities`. |
|
|
337
462
|
| `G9Clock` | interface | Time source of everything in G9 that needs "now" (plan/specs/01-Architecture.md §8). Supplied by the app through the provider; tests pass a manual clock. |
|
|
463
|
+
| `G9FilePicker` | interface | The system file chooser and camera (G9Hub `platform().files`). Optional: without it `G9DropZone` shows its area disabled. A host that can drop files on the window emits `g9:drag` `{ active }` and `g9:drop` `{ files }`. |
|
|
464
|
+
| `G9FileRef` | interface | A file the host picked or received (a handle: read and release it through the host's own files API). |
|
|
465
|
+
| `G9Haptics` | interface | Haptic feedback the host plays (optional capability `haptics`); without it controls stay silent. |
|
|
338
466
|
| `G9HostServices` | interface | Host integration the provider and overlays need (MAUI page/window plumbing), supplied by the native host. Required. The system back press does not go through this object: the host sends a global event (default `g9:back`, specs/02 §4) and the provider dispatches it to the active `G9Host`; `exit` is what happens when nothing handled it. |
|
|
467
|
+
| `G9KeyCombo` | interface | A parsed combo: `'Mod+Shift+K'` (Mod = Ctrl, or Cmd on macOS). |
|
|
468
|
+
| `G9KeyEvent` | interface | A key as hosts send it: `key` is a DOM key name (`'ArrowLeft'`, `'Escape'`, `'k'`). |
|
|
339
469
|
| `G9ManualClock` | interface | A clock you move by hand (tests, previews). Both readings start at the given values and advance together. |
|
|
340
470
|
| `G9MediaPlayer` | interface | One video player created by the app's media provider. `view` is what the control renders (the platform video XElement the host registered, built by the app); the control never names a video tag itself. |
|
|
341
471
|
| `G9MediaPlayerOptions` | interface | Options of `G9MediaProvider.createPlayer`. |
|
|
@@ -350,9 +480,11 @@ folder) explain how the pieces fit; the migration tables map every MAUI member.
|
|
|
350
480
|
| `G9SafeInsets` | interface | Safe-area insets in logical pixels. |
|
|
351
481
|
| `G9Scanner` | interface | Barcode/QR scanning supplied by the app (WP09 barcode package). Optional: without it the scan action is hidden. |
|
|
352
482
|
| `G9ScanOptions` | interface | Options of one scan. |
|
|
483
|
+
| `G9Sounds` | interface | Sound feedback the host plays (optional capability `sounds`): a tick, a success, an error. |
|
|
353
484
|
| `G9SpeechToText` | interface | Speech recognition for dictation into fields (MAUI `IG9SpeechToText`). Optional: without it the microphone affordance is hidden. A platform fault rejects with a `G9Error`. |
|
|
354
485
|
| `G9SpeechToTextOptions` | interface | Options of one dictation session. |
|
|
355
486
|
| `G9CapabilityName` | type | The name of a capability. |
|
|
487
|
+
| `G9HapticKind` | type | What a haptic means; the host chooses the pattern. |
|
|
356
488
|
| `G9MaybePromise` | type | A value or a promise of it: stores may be synchronous (memory) or asynchronous (a native module). |
|
|
357
489
|
| `G9MediaPlayerEvent` | type | What a `G9MediaPlayer` tells its owner. |
|
|
358
490
|
| `G9MediaSource` | type | A media reference as the app describes it (an asset name, a file or a remote URI). |
|
|
@@ -360,6 +492,7 @@ folder) explain how the pieces fit; the migration tables map every MAUI member.
|
|
|
360
492
|
| `G9PreferenceValue` | type | What a preference holds: a 32-bit integer or a string (MAUI `IG9PreferenceStore` stores exactly these). |
|
|
361
493
|
| `G9ScanResult` | type | How a scan ended. |
|
|
362
494
|
| `G9SoftInputMode` | type | Android soft-input policy while a flow needs it (MAUI `G9KeyboardHelper.UseAndroidPanSoftInputMode`). |
|
|
495
|
+
| `G9SoundKind` | type | What a sound means. |
|
|
363
496
|
| `G9SpeechToTextResult` | type | How a dictation session ended. Expected outcomes are results, not errors (specs/03 §7). |
|
|
364
497
|
|
|
365
498
|
## `@g9tm/lynxcontrols-foundation/route`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@g9tm/lynxcontrols-foundation",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "Pure TypeScript core: design tokens, theme model, culture (strings, digits, calendars, relative time, durations), icon model, safe execution, diagnostics, preference and capability contracts. No React, no UI.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -16,6 +16,11 @@
|
|
|
16
16
|
"types": "./dist/tokens/index.d.ts",
|
|
17
17
|
"default": "./dist/tokens/index.js"
|
|
18
18
|
},
|
|
19
|
+
"./layout": {
|
|
20
|
+
"source": "./src/layout/index.ts",
|
|
21
|
+
"types": "./dist/layout/index.d.ts",
|
|
22
|
+
"default": "./dist/layout/index.js"
|
|
23
|
+
},
|
|
19
24
|
"./theme": {
|
|
20
25
|
"source": "./src/theme/index.ts",
|
|
21
26
|
"types": "./dist/theme/index.d.ts",
|