@owlmeans/client-panel 0.1.18-rc.5 → 0.1.18-rc.50
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/README.md +63 -4
- package/agent-meta/manifest.json +2 -2
- package/agent-meta/skills/client-panel/SKILL.md +130 -11
- package/build/auth/i18n/fr.json +56 -0
- package/build/auth/i18n.js +2 -0
- package/build/auth/i18n.js.map +1 -1
- package/build/auth/index.d.ts +1 -0
- package/build/auth/index.d.ts.map +1 -1
- package/build/auth/index.js +1 -0
- package/build/auth/index.js.map +1 -1
- package/build/auth/login/index.d.ts +3 -0
- package/build/auth/login/index.d.ts.map +1 -0
- package/build/auth/login/index.js +2 -0
- package/build/auth/login/index.js.map +1 -0
- package/build/auth/login/model.d.ts +10 -0
- package/build/auth/login/model.d.ts.map +1 -0
- package/build/auth/login/model.js +85 -0
- package/build/auth/login/model.js.map +1 -0
- package/build/auth/login/types.d.ts +56 -0
- package/build/auth/login/types.d.ts.map +1 -0
- package/build/auth/login/types.js +2 -0
- package/build/auth/login/types.js.map +1 -0
- package/build/components/index.d.ts +1 -0
- package/build/components/index.d.ts.map +1 -1
- package/build/components/index.js +1 -0
- package/build/components/index.js.map +1 -1
- package/build/components/nav/helper.d.ts +21 -0
- package/build/components/nav/helper.d.ts.map +1 -0
- package/build/components/nav/helper.js +111 -0
- package/build/components/nav/helper.js.map +1 -0
- package/build/components/nav/index.d.ts +3 -0
- package/build/components/nav/index.d.ts.map +1 -0
- package/build/components/nav/index.js +2 -0
- package/build/components/nav/index.js.map +1 -0
- package/build/components/nav/types.d.ts +76 -0
- package/build/components/nav/types.d.ts.map +1 -0
- package/build/components/nav/types.js +2 -0
- package/build/components/nav/types.js.map +1 -0
- package/build/i18n.d.ts +2 -0
- package/build/i18n.d.ts.map +1 -0
- package/build/i18n.js +15 -0
- package/build/i18n.js.map +1 -0
- package/build/index.d.ts +1 -0
- package/build/index.d.ts.map +1 -1
- package/build/index.js +1 -0
- package/build/index.js.map +1 -1
- package/package.json +14 -13
- package/src/auth/i18n/fr.json +56 -0
- package/src/auth/i18n.ts +2 -0
- package/src/auth/index.ts +1 -1
- package/src/auth/login/index.ts +2 -0
- package/src/auth/login/model.ts +102 -0
- package/src/auth/login/types.ts +59 -0
- package/src/components/index.ts +1 -0
- package/src/components/nav/helper.ts +136 -0
- package/src/components/nav/index.ts +3 -0
- package/src/components/nav/types.ts +79 -0
- package/src/i18n.ts +16 -0
- package/src/index.ts +2 -0
- package/build/.gitkeep +0 -0
package/README.md
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# @owlmeans/client-panel
|
|
2
2
|
|
|
3
|
-
Schema-driven React form components with react-hook-form integration, i18n,
|
|
3
|
+
Schema-driven React form components with react-hook-form integration, i18n, action buttons, and the
|
|
4
|
+
headless navigation model.
|
|
4
5
|
|
|
5
6
|
## Overview
|
|
6
7
|
|
|
@@ -9,12 +10,13 @@ Schema-driven React form components with react-hook-form integration, i18n, and
|
|
|
9
10
|
- `InputCtrl` — labeled input field component backed by react-hook-form
|
|
10
11
|
- `useFormRef()` — hook to get a ref for programmatic form operations
|
|
11
12
|
- `FormOnSubmit` — type for form submission handler functions
|
|
13
|
+
- `usePanelNav()` — the model behind a two-layer navigation menu (no JSX)
|
|
12
14
|
- Platform-agnostic: used by React web and React Native frontends
|
|
13
15
|
|
|
14
16
|
## Installation
|
|
15
17
|
|
|
16
18
|
```bash
|
|
17
|
-
bun add @owlmeans/client-panel
|
|
19
|
+
bun add @owlmeans/client-panel@^0.1.18-rc.50
|
|
18
20
|
```
|
|
19
21
|
|
|
20
22
|
## Usage
|
|
@@ -24,12 +26,13 @@ A complete form with submit and cancel actions:
|
|
|
24
26
|
```typescript
|
|
25
27
|
import { ClientForm, InputCtrl, ActionCtrl, useFormRef } from '@owlmeans/client-panel'
|
|
26
28
|
import type { FormOnSubmit } from '@owlmeans/client-panel'
|
|
29
|
+
import { appProtocols } from 'my-app-common'
|
|
27
30
|
|
|
28
31
|
function CreateProjectForm() {
|
|
29
32
|
const formRef = useFormRef()
|
|
30
33
|
|
|
31
34
|
const onSubmit: FormOnSubmit<CreateProject> = async (data) => {
|
|
32
|
-
await ctx.
|
|
35
|
+
await ctx.entrypoint(appProtocols.api.project.create).call({ body: data })
|
|
33
36
|
}
|
|
34
37
|
|
|
35
38
|
return (
|
|
@@ -81,6 +84,62 @@ type FormOnSubmit<T> = (data: T) => void | Promise<void>
|
|
|
81
84
|
|
|
82
85
|
Derives default form values from an AJV schema's `default` fields.
|
|
83
86
|
|
|
87
|
+
## Navigation model
|
|
88
|
+
|
|
89
|
+
Navigation is declared as data and rendered by the platform package
|
|
90
|
+
(`@owlmeans/web-panel` ships `NavLayout` / `TopNav` / `SideNav` / `Footer`). This package holds only
|
|
91
|
+
the model, so both levels of the menu agree on what is active.
|
|
92
|
+
|
|
93
|
+
```typescript
|
|
94
|
+
import { usePanelNav } from '@owlmeans/client-panel'
|
|
95
|
+
import type { PanelNavConfig } from '@owlmeans/client-panel'
|
|
96
|
+
|
|
97
|
+
const config: PanelNavConfig = {
|
|
98
|
+
sections: [
|
|
99
|
+
{ name: 'home', label: 'Home', items: [{ alias: HOME, label: 'Overview' }] },
|
|
100
|
+
{ name: 'demo', items: [{ alias: web.session }, { alias: web.about }] },
|
|
101
|
+
],
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
const model = usePanelNav(config)
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### Types
|
|
108
|
+
|
|
109
|
+
- `PanelNavItem` — `{ alias, label?, Icon?, hidden? }`; one screen, addressed by entrypoint alias,
|
|
110
|
+
never by URL.
|
|
111
|
+
- `PanelNavSection` — `{ name, label?, items, hidden? }`; the first menu level. Pressing it goes to
|
|
112
|
+
the first visible item.
|
|
113
|
+
- `PanelNavConfig` — `{ sections }`.
|
|
114
|
+
- `PanelNavLink` — `{ alias? | href?, label?, open? }`; a footer link.
|
|
115
|
+
- `NavTranslate` — `(key, defaultValue) => string`.
|
|
116
|
+
|
|
117
|
+
### `usePanelNav(config): PanelNavModel`
|
|
118
|
+
|
|
119
|
+
Returns `sections` (with `hidden` filtered out), `current` (the active screen's alias or null),
|
|
120
|
+
`active` (its section), `showSide`, `isSectionActive` / `isItemActive`, `goSection` / `goItem`
|
|
121
|
+
(each returning a handler), and `hrefOf(target)`.
|
|
122
|
+
|
|
123
|
+
- `showSide` is false when the active section holds a single screen — that is where the "one screen,
|
|
124
|
+
no second level" rule lives; a renderer asks the model rather than counting items.
|
|
125
|
+
- The current screen resolves from the router's `location.state.alias` when present, and otherwise
|
|
126
|
+
from the pathname matched against entrypoint paths — exact first, then longest prefix.
|
|
127
|
+
Both are needed: `state` is `window.history.state`, so it is empty on a hard load or deep link. A
|
|
128
|
+
screen listed in no section finds its section by walking its declared `parent` upward.
|
|
129
|
+
- `hrefOf` resolves a real URL synchronously so a menu entry can be a proper link (focusable,
|
|
130
|
+
keyboard-operable, openable in a new tab). It returns `undefined` for a path carrying route
|
|
131
|
+
parameters.
|
|
132
|
+
|
|
133
|
+
### `resolveNavLabel(translate, label, key, alias)`
|
|
134
|
+
|
|
135
|
+
Resolves a label as literal `label` → `translate(key, defaultNavLabel(alias))` → the humanized
|
|
136
|
+
alias. `translate` always reaches a component as a **prop**, defaulting to `defaultNavTranslate`
|
|
137
|
+
(which returns the fallback) — a menu must never read an i18n context implicitly, because an app
|
|
138
|
+
mounted without an i18n provider throws inside render and blanks the page. `defaultNavLabel`
|
|
139
|
+
humanizes the last alias segment
|
|
140
|
+
(`my-app:web:user-list` → `User list`). Default key families are `nav.<section>` and
|
|
141
|
+
`modules.<alias>`.
|
|
142
|
+
|
|
84
143
|
## Related Packages
|
|
85
144
|
|
|
86
145
|
- [`@owlmeans/client`](../client) — `useContext`, `useNavigate` used within form components
|
|
@@ -94,7 +153,7 @@ This package ships embedded agent skills under `agent-meta/`. After installing y
|
|
|
94
153
|
your project's skill store (`.agents/skills/`):
|
|
95
154
|
|
|
96
155
|
```sh
|
|
97
|
-
npx @owlmeans/agent-skills
|
|
156
|
+
npx @owlmeans/agent-skills@^0.1.18-rc.40
|
|
98
157
|
```
|
|
99
158
|
|
|
100
159
|
The embedded files are version-matched to this package release. Do not edit them
|
package/agent-meta/manifest.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 2,
|
|
3
3
|
"package": "@owlmeans/client-panel",
|
|
4
|
-
"version": "0.1.18-rc.
|
|
5
|
-
"generatedAt": "2026-
|
|
4
|
+
"version": "0.1.18-rc.50",
|
|
5
|
+
"generatedAt": "2026-09-25T21:19:37.992Z",
|
|
6
6
|
"canonicalRepo": "https://github.com/owlmeans/common",
|
|
7
7
|
"entries": [
|
|
8
8
|
{
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: client-panel
|
|
3
|
-
description: How to use @owlmeans/client-panel — reusable cross-platform UI panel + form components (auth screens, layouts) shared by web-panel and native-panel. Auto-invoked when importing panel components.
|
|
3
|
+
description: How to use @owlmeans/client-panel — reusable cross-platform UI panel + form components (auth screens, layouts) and the headless navigation model (usePanelNav) shared by web-panel and native-panel. Auto-invoked when importing panel components or building a navigation menu.
|
|
4
4
|
user-invocable: false
|
|
5
5
|
---
|
|
6
6
|
<!-- AUTO-GENERATED — do not edit. Regenerate via sync-agent-meta. -->
|
|
@@ -8,30 +8,149 @@ user-invocable: false
|
|
|
8
8
|
# @owlmeans/client-panel
|
|
9
9
|
|
|
10
10
|
**Layer:** Client
|
|
11
|
-
**Install:** `"@owlmeans/client-panel": "^0.1.18-rc.
|
|
11
|
+
**Install:** `"@owlmeans/client-panel": "^0.1.18-rc.50"` in `dependencies`
|
|
12
12
|
|
|
13
13
|
## Key Exports
|
|
14
14
|
|
|
15
|
+
Everything below is a **root** export — this package has no `./components` or `./helpers`
|
|
16
|
+
subpath. Only auth is split out (see below).
|
|
17
|
+
|
|
18
|
+
Importing the root also registers the package-owned seven-language `client-panel` bundle. Its
|
|
19
|
+
generic `buttons.submit` fallback is always available after an application imports any root form
|
|
20
|
+
controller; apps may override it through their own `buttons` resource.
|
|
21
|
+
|
|
15
22
|
| Export | Description |
|
|
16
23
|
|--------|-------------|
|
|
17
|
-
| `
|
|
18
|
-
| `
|
|
24
|
+
| `ClientForm` | The form model: `react-hook-form` + an AJV resolver with `coerceTypes` and `ajv-formats`, publishing a `FormContext` and a loader toggle |
|
|
25
|
+
| `FormContext` / `useClientFormContext` | That context, and the hook a renderer reads it with |
|
|
26
|
+
| `useFormI18n()` / `useFormError(name, error?)` | The form's `t`, and a field error resolved to a message — `<field>.errors.<type>` → `errors.<type>` → `lib:errors.<type>`, or `<field>.error` → `lib:errors.form-field` when the error carries no type |
|
|
27
|
+
| `useFormRef<T>()` | The `MutableRefObject<FormRef>` a caller holds to drive a form from outside: `form`, `update`, `loader`, `error` |
|
|
28
|
+
| `InputCtrl` | The headless field controller — resolves `label`/`placeholder`/`hint` from the form namespace when passed `true`, and calls the platform `render` |
|
|
29
|
+
| `ActionCtrl` | The headless submit/action controller — three-tier label lookup (form namespace, the app's `buttons` section, then `client-panel`'s), the loader flag, and the bound `action` |
|
|
30
|
+
| `schemaToFormDefault(schema)` | Initial values derived from an AJV schema, which is what `ClientForm` uses when no `defaults` are given |
|
|
31
|
+
| `PanelContext` / `usePanelHelper()` | Inject `resource`, `ns`, `prefix` or `suppress` into a sub-tree; the parent's values are inherited and overridden field by field |
|
|
32
|
+
| `usePanelI18n(name?, override?)` / `usePanelError(name, error?)` | The panel's `t`, and a `ResilientError` resolved through it |
|
|
33
|
+
| `useStatusMessage(opts)` | `{ message, variant, ok }` for a status surface — a marshalled error's `:` is rewritten to `.` before lookup, so a key written with a colon never matches |
|
|
34
|
+
| `usePanelLayout()` / `useLayoutTitle(name?, alias?)` / `prepareLayoutTitle(title)` | The entrypoint the current layout is rendering, and its translated title |
|
|
35
|
+
| `BlockScaling` | `Full` / `Half` / `Wide` — the sizing vocabulary both platform families render |
|
|
36
|
+
| `usePanelNav(config)` | Headless navigation model behind a two-layer menu |
|
|
37
|
+
| `resolveNavLabel`, `defaultNavLabel`, `defaultNavTranslate` | Label resolution helpers |
|
|
38
|
+
| `PanelNavConfig`, `PanelNavSection`, `PanelNavItem`, `PanelNavLink`, `PanelNavModel`, `NavTranslate` | Navigation types |
|
|
39
|
+
| `FormProps`, `FormRef`, `FormOnSubmit`, `TFormContext`, `FormFieldProps`, `FormActionProps`, `FormActionRenderArgs`, `InputControllerProps`, `TPanelContext`, `StatusOptions` | The model shapes a renderer is written against |
|
|
19
40
|
|
|
20
41
|
## Subpath Exports
|
|
21
42
|
|
|
22
|
-
- `./auth` —
|
|
23
|
-
|
|
43
|
+
- `./auth` — `useLoginMethods` and the login model types (`LoginMethodsModel`, `LoginTermsModel`,
|
|
44
|
+
`LoginCreditModel`, `UseLoginMethodsOptions`). Importing it also registers this package's own
|
|
45
|
+
seven-language `client-panel-auth` bundle by side effect.
|
|
46
|
+
- `./auth/plugins` — the shapes an auth UI plugin is written against: `Ed22519BasicAuthUIPluginForm`
|
|
47
|
+
and its `Ed22519BasicAuthUIPluginFormSchema`.
|
|
48
|
+
|
|
49
|
+
`useLoginMethods` is the headless model behind a sign-in screen: which methods are offered, whether
|
|
50
|
+
the terms are confirmed, what the credit line says, and a `select` that is deliberately NOT async
|
|
51
|
+
(the flow may have to open a window inside the click). The rendering lives in `web-panel` — the
|
|
52
|
+
same split the form and navigation models already use. See `login-methods`.
|
|
53
|
+
|
|
54
|
+
`LoginTermsModel.terms` carries `documents` and `notices` (each `ResolvedTermsDocument[]` from
|
|
55
|
+
`@owlmeans/client-auth/login`) rather than a flat `urls: { terms, privacy, cookies? }` — that field
|
|
56
|
+
is gone; nothing in the repo read it outside this model and its one renderer, so it was dropped
|
|
57
|
+
rather than kept alongside the replacement. It also carries `revisedAt?` and `version`. A renderer
|
|
58
|
+
turns `documents`/`notices` into markup with `termsSentence` (`@owlmeans/client-auth/login`), never
|
|
59
|
+
by re-deriving link/label pairs itself.
|
|
60
|
+
|
|
61
|
+
`LoginTermsModel.deferred` mirrors `termsDeferred(ctx)`: true once a registered, bound `LoginStep`
|
|
62
|
+
confirms the terms instead of this screen. `LoginMethodsModel.blocked` folds it in
|
|
63
|
+
(`required && !deferred && !accepted`) — a renderer never blocks on `required`/`accepted` alone,
|
|
64
|
+
or it would re-block a screen whose confirmation moved elsewhere.
|
|
24
65
|
|
|
25
66
|
## Usage
|
|
26
67
|
|
|
27
68
|
```typescript
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
69
|
+
import { ClientForm, InputCtrl, useFormRef, PanelContext } from '@owlmeans/client-panel'
|
|
70
|
+
import { useLoginMethods } from '@owlmeans/client-panel/auth'
|
|
30
71
|
```
|
|
31
72
|
|
|
32
|
-
`@owlmeans/web-panel` re-exports
|
|
73
|
+
Nothing here renders. A platform package supplies the JSX, and `@owlmeans/web-panel` re-exports
|
|
74
|
+
this package's whole root surface (`export * from '@owlmeans/client-panel'`), so an application can
|
|
75
|
+
reach any of it through the platform package it already imports.
|
|
76
|
+
|
|
77
|
+
The split is not uniform, and the difference matters when reading a screen:
|
|
78
|
+
|
|
79
|
+
- **The navigation model is wrapped.** `usePanelNav` has no renderer here; `TopNav`, `SideNav` and
|
|
80
|
+
`NavLayout` in `@owlmeans/web-panel` are its only rendering, and an app calls those.
|
|
81
|
+
- **The form controllers are used directly.** `ClientForm`, `InputCtrl` and `ActionCtrl` are not
|
|
82
|
+
wrapped by any platform package: `@owlmeans/web-panel`'s `Form` builds its own `useForm` +
|
|
83
|
+
`ajvResolver` and takes only `FormContext` and `schemaToFormDefault` from here, its `TextInput`
|
|
84
|
+
drives `react-hook-form`'s `Controller` itself, and its buttons call `handleSubmit` themselves.
|
|
85
|
+
An application that wants a form laid out its own way imports the three from this package: it
|
|
86
|
+
puts its fields inside `ClientForm` and writes the `render` callbacks `InputCtrl` and `ActionCtrl`
|
|
87
|
+
take.
|
|
88
|
+
|
|
89
|
+
Read the contracts from the controller you actually use — they differ. `InputCtrl` resolves
|
|
90
|
+
`label`/`placeholder`/`hint` only from a boolean `true` and **drops a string**, while
|
|
91
|
+
`@owlmeans/web-panel`'s `TextInput` honours a string verbatim.
|
|
92
|
+
|
|
93
|
+
## Navigation model — `usePanelNav`
|
|
94
|
+
|
|
95
|
+
The **model lives here, the JSX lives in the platform package.** `usePanelNav` is headless and
|
|
96
|
+
cross-platform; `@owlmeans/web-panel` renders it as `TopNav`/`SideNav`/`NavLayout`. Never put a
|
|
97
|
+
rendered menu in this package, and never re-derive active state in a renderer.
|
|
98
|
+
|
|
99
|
+
Navigation is declared as data. A **section** is the first menu level; its **items** are the screens
|
|
100
|
+
the second level offers while that section is active. An item addresses a frontend entrypoint by
|
|
101
|
+
`alias` and never carries a URL — the router resolves it, so a path that changes shape stays correct
|
|
102
|
+
everywhere it is rendered.
|
|
103
|
+
|
|
104
|
+
```ts
|
|
105
|
+
import { usePanelNav } from '@owlmeans/client-panel'
|
|
106
|
+
import type { PanelNavConfig } from '@owlmeans/client-panel'
|
|
107
|
+
|
|
108
|
+
const config: PanelNavConfig = {
|
|
109
|
+
sections: [
|
|
110
|
+
{ name: 'home', label: 'Home', items: [{ alias: HOME, label: 'Overview' }] },
|
|
111
|
+
{ name: 'demo', items: [{ alias: web.session }, { alias: web.about }] },
|
|
112
|
+
],
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
const model = usePanelNav(config)
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
`PanelNavModel` carries `sections` (with `hidden` filtered out), `current` (the active screen's
|
|
119
|
+
alias, or null), `active` (its section), `showSide`, `isSectionActive` / `isItemActive`,
|
|
120
|
+
`goSection` / `goItem` (each returning a handler), and `hrefOf`.
|
|
121
|
+
|
|
122
|
+
- **`showSide` owns the one-screen rule.** It is false when the active section holds a single
|
|
123
|
+
screen — a second level offering the page you are already on is noise. A renderer asks the model;
|
|
124
|
+
it does not count items itself.
|
|
125
|
+
- **Label resolution never touches i18n implicitly.** `NavTranslate` is a `(key, defaultValue) =>
|
|
126
|
+
string` **prop**, defaulting to `defaultNavTranslate`, which returns the fallback. An app mounted
|
|
127
|
+
without an i18n provider (`renderApp` from `@owlmeans/web-client` mounts none) crashes if a menu
|
|
128
|
+
reaches for the panel i18n context: the hook dereferences `i18n.options` on the empty object
|
|
129
|
+
`react-i18next` returns without an instance, and a throw inside render blanks the whole app.
|
|
130
|
+
`resolveNavLabel(translate, label, key, alias)` applies the order — literal `label` →
|
|
131
|
+
`translate(key, humanized)` → `defaultNavLabel(alias)`, which humanizes the last alias segment
|
|
132
|
+
(`my-app:web:user-list` → `User list`). Default key families: `nav.<name>` for sections,
|
|
133
|
+
`modules.<alias>` for items and footer links.
|
|
134
|
+
- **Resolving the current screen needs two sources.** The router's `location.state.alias` is
|
|
135
|
+
authoritative but is `window.history.state`, so it is null until the first in-app navigation — on
|
|
136
|
+
a hard page load or a deep link a menu keyed on it alone highlights nothing, on exactly the entry
|
|
137
|
+
that matters most. The pathname is the fallback: entrypoint paths are matched exactly
|
|
138
|
+
first, then by longest prefix, so a detail screen under a listed one still belongs to its section.
|
|
139
|
+
A screen listed in no section resolves its section by walking `route.route.parent` upward.
|
|
140
|
+
- **`hrefOf` gives a menu entry a real URL**, resolved synchronously from
|
|
141
|
+
`context.entrypoint(protocol).path()` — a protocol composes its path from its own declaration and
|
|
142
|
+
its ancestors', so matching one is a lookup rather than a guess. It returns undefined for a path
|
|
143
|
+
carrying route parameters (`:id`) — there is no honest URL for a screen whose address is not
|
|
144
|
+
known yet. A protocol the app never bound resolves to null and is skipped rather than taking the
|
|
145
|
+
menu down.
|
|
33
146
|
|
|
34
147
|
## Depends On
|
|
35
148
|
|
|
36
|
-
- `@owlmeans/client`, `@owlmeans/client-
|
|
37
|
-
|
|
149
|
+
- `@owlmeans/client`, `@owlmeans/client-i18n`, `@owlmeans/client-entrypoint`, `@owlmeans/client-route`,
|
|
150
|
+
`@owlmeans/entrypoint`, `@owlmeans/error`, `@hookform/resolvers`
|
|
151
|
+
- Peers (host-provided): `react`, `react-hook-form`, `ajv`, `@owlmeans/auth`, `@owlmeans/client-auth`,
|
|
152
|
+
`@owlmeans/config`, `@owlmeans/i18n`, `@owlmeans/router`. No platform UI library — that is the
|
|
153
|
+
point of the split. (`@owlmeans/auth` and `@owlmeans/client-auth` are marked optional.)
|
|
154
|
+
- `ajv-formats` is imported at module scope by `ClientForm` but is declared in no dependency section
|
|
155
|
+
of the manifest, which lists `ajv` alone. An install that does not otherwise pull it in fails at
|
|
156
|
+
import time, so declare `ajv-formats` next to `ajv` in the consuming application.
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
{
|
|
2
|
+
"basic-ed25519": {
|
|
3
|
+
"entityId": {
|
|
4
|
+
"label": "Identifiant de l’organisation"
|
|
5
|
+
},
|
|
6
|
+
"address": {
|
|
7
|
+
"label": "DID de l’utilisateur"
|
|
8
|
+
},
|
|
9
|
+
"privateKey": {
|
|
10
|
+
"label": "Clé privée"
|
|
11
|
+
},
|
|
12
|
+
"submit": "S’authentifier"
|
|
13
|
+
},
|
|
14
|
+
"re-captcha": {
|
|
15
|
+
"guideline": "Nous devons vérifier que vous n’êtes pas un robot. Cliquez dans la case blanche ci-dessous pour prouver que vous êtes humain."
|
|
16
|
+
},
|
|
17
|
+
"wallet-provider": {
|
|
18
|
+
"pin": {
|
|
19
|
+
"loading": "Chargement…",
|
|
20
|
+
"guideline": "Utilisez ce code PIN avec toute ressource prenant en charge l’autorisation par portefeuille"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"wallet-consumer": {
|
|
24
|
+
"pin": {
|
|
25
|
+
"label": "Code PIN",
|
|
26
|
+
"hint": "Scannez le code QR ou générez un code PIN avec votre application OwlMeans ID"
|
|
27
|
+
},
|
|
28
|
+
"submit": "Continuer avec le PIN"
|
|
29
|
+
},
|
|
30
|
+
"oidp-auth": {
|
|
31
|
+
"reset": "Réinitialiser",
|
|
32
|
+
"error": {
|
|
33
|
+
"socket": {
|
|
34
|
+
"timeout": {
|
|
35
|
+
"rely": "La fenêtre d’authentification a expiré. Actualisez la page pour réessayer."
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
"oidp-create-id": {
|
|
41
|
+
"error": {
|
|
42
|
+
"socket": {
|
|
43
|
+
"timeout": {
|
|
44
|
+
"call": "Délai d’action dépassé. Pour des raisons de sécurité, les actions d’authentification sont limitées dans le temps. Réessayez.",
|
|
45
|
+
"rely": "Le code d’authentification a expiré. Réessayez."
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
"auth": {
|
|
49
|
+
"authorization": {
|
|
50
|
+
"sequence": "Le processus d’authentification a été interrompu par l’application d’authentification utilisée."
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
"reset": "Actualiser"
|
|
55
|
+
}
|
|
56
|
+
}
|
package/build/auth/i18n.js
CHANGED
|
@@ -6,6 +6,7 @@ import be from './i18n/be.json' with { type: 'json' };
|
|
|
6
6
|
import uk from './i18n/uk.json' with { type: 'json' };
|
|
7
7
|
import es from './i18n/es.json' with { type: 'json' };
|
|
8
8
|
import de from './i18n/de.json' with { type: 'json' };
|
|
9
|
+
import fr from './i18n/fr.json' with { type: 'json' };
|
|
9
10
|
addI18nLib('en', 'client-panel-auth', en);
|
|
10
11
|
addI18nLib('pl', 'client-panel-auth', pl);
|
|
11
12
|
addI18nLib('ru', 'client-panel-auth', ru);
|
|
@@ -13,4 +14,5 @@ addI18nLib('be', 'client-panel-auth', be);
|
|
|
13
14
|
addI18nLib('uk', 'client-panel-auth', uk);
|
|
14
15
|
addI18nLib('es', 'client-panel-auth', es);
|
|
15
16
|
addI18nLib('de', 'client-panel-auth', de);
|
|
17
|
+
addI18nLib('fr', 'client-panel-auth', fr);
|
|
16
18
|
//# sourceMappingURL=i18n.js.map
|
package/build/auth/i18n.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i18n.js","source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IAAI,EAAE,MAAM,EAAE,CAAA;AACrD,OAAO,EAAE,MAAM,gBAAgB,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAA;AACrD,OAAO,EAAE,MAAM,gBAAgB,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAA;AACrD,OAAO,EAAE,MAAM,gBAAgB,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAA;AACrD,OAAO,EAAE,MAAM,gBAAgB,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAA;AACrD,OAAO,EAAE,MAAM,gBAAgB,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAA;AACrD,OAAO,EAAE,MAAM,gBAAgB,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAA;AACrD,OAAO,EAAE,MAAM,gBAAgB,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAA;AAErD,UAAU,CAAC,IAAI,EAAE,mBAAmB,EAAE,EAAE,CAAC,CAAA;AACzC,UAAU,CAAC,IAAI,EAAE,mBAAmB,EAAE,EAAE,CAAC,CAAA;AACzC,UAAU,CAAC,IAAI,EAAE,mBAAmB,EAAE,EAAE,CAAC,CAAA;AACzC,UAAU,CAAC,IAAI,EAAE,mBAAmB,EAAE,EAAE,CAAC,CAAA;AACzC,UAAU,CAAC,IAAI,EAAE,mBAAmB,EAAE,EAAE,CAAC,CAAA;AACzC,UAAU,CAAC,IAAI,EAAE,mBAAmB,EAAE,EAAE,CAAC,CAAA;AACzC,UAAU,CAAC,IAAI,EAAE,mBAAmB,EAAE,EAAE,CAAC,CAAA;AACzC,UAAU,CAAC,IAAI,EAAE,mBAAmB,EAAE,EAAE,CAAC,CAAA"}
|
package/build/auth/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/auth/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/auth/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AACzB,cAAc,kBAAkB,CAAA"}
|
package/build/auth/index.js
CHANGED
package/build/auth/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/auth/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/auth/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AACzB,cAAc,kBAAkB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/auth/login/index.ts"],"names":[],"mappings":"AAAA,mBAAmB,YAAY,CAAA;AAC/B,cAAc,YAAY,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/auth/login/index.ts"],"names":[],"mappings":"AACA,cAAc,YAAY,CAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { LoginMethodsModel, UseLoginMethodsOptions } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Everything a sign-in screen needs, with no opinion about how it looks.
|
|
4
|
+
*
|
|
5
|
+
* Headless and cross-platform, like `usePanelNav`: the rules about what may be offered, what must
|
|
6
|
+
* be confirmed first and what the credit line says are the same on every platform, and only the
|
|
7
|
+
* rendering differs. A renderer that re-derives any of them will drift from the one that does not.
|
|
8
|
+
*/
|
|
9
|
+
export declare const useLoginMethods: (opts?: UseLoginMethodsOptions) => LoginMethodsModel;
|
|
10
|
+
//# sourceMappingURL=model.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../../src/auth/login/model.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAA;AAE3E;;;;;;GAMG;AACH,eAAO,MAAM,eAAe,UAAW,sBAAsB,KAAG,iBAoF/D,CAAA"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { useCallback, useMemo, useState } from 'react';
|
|
2
|
+
import { useContext, useNavigate } from '@owlmeans/client';
|
|
3
|
+
import { acceptTerms, primaryLoginMethod, resolveCredit, resolveTerms, termsAccepted, termsDeferred, LoginOutcome, LOGIN_SERVICE, } from '@owlmeans/client-auth/login';
|
|
4
|
+
/**
|
|
5
|
+
* Everything a sign-in screen needs, with no opinion about how it looks.
|
|
6
|
+
*
|
|
7
|
+
* Headless and cross-platform, like `usePanelNav`: the rules about what may be offered, what must
|
|
8
|
+
* be confirmed first and what the credit line says are the same on every platform, and only the
|
|
9
|
+
* rendering differs. A renderer that re-derives any of them will drift from the one that does not.
|
|
10
|
+
*/
|
|
11
|
+
export const useLoginMethods = (opts) => {
|
|
12
|
+
const context = useContext();
|
|
13
|
+
const nav = useNavigate();
|
|
14
|
+
const login = context.service(LOGIN_SERVICE);
|
|
15
|
+
const cfg = opts?.config ?? context.cfg.security?.auth?.login;
|
|
16
|
+
const brand = context.cfg.brand;
|
|
17
|
+
const resolved = useMemo(() => resolveTerms(opts?.terms ?? cfg?.terms), [opts?.terms, cfg]);
|
|
18
|
+
const credit = useMemo(() => resolveCredit(cfg?.credit, brand, context.cfg.service), [cfg, brand, context]);
|
|
19
|
+
const [accepted, setAccepted] = useState(() => termsAccepted(resolved));
|
|
20
|
+
const [attempted, setAttempted] = useState(false);
|
|
21
|
+
const [busy, setBusy] = useState(null);
|
|
22
|
+
const [outcome, setOutcome] = useState(null);
|
|
23
|
+
const [error, setError] = useState(null);
|
|
24
|
+
const env = login.env();
|
|
25
|
+
const all = login.methods({
|
|
26
|
+
context, env,
|
|
27
|
+
navigate: (alias, params) => { nav.go(alias, params != null ? { params } : undefined); },
|
|
28
|
+
});
|
|
29
|
+
const methods = typeof opts?.methods === 'function'
|
|
30
|
+
? opts.methods(all)
|
|
31
|
+
: opts?.methods ?? all;
|
|
32
|
+
const deferred = termsDeferred(context);
|
|
33
|
+
const blocked = resolved != null && resolved.required && !deferred && !accepted;
|
|
34
|
+
const select = useCallback((method) => {
|
|
35
|
+
if (blocked) {
|
|
36
|
+
// Nothing starts, and no window opens. The screen renders the reason instead — which is why
|
|
37
|
+
// a control must never be `disabled`: a disabled control swallows the click and says nothing.
|
|
38
|
+
setAttempted(true);
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
setBusy(method.id);
|
|
42
|
+
setError(null);
|
|
43
|
+
void method.start({
|
|
44
|
+
context, env,
|
|
45
|
+
navigate: (alias, params) => { nav.go(alias, params != null ? { params } : undefined); },
|
|
46
|
+
}).then(result => {
|
|
47
|
+
setOutcome(result);
|
|
48
|
+
// `Redirected` means the browser is leaving; keeping the control busy is honest there.
|
|
49
|
+
if (result !== LoginOutcome.Redirected) {
|
|
50
|
+
setBusy(null);
|
|
51
|
+
}
|
|
52
|
+
}).catch((e) => {
|
|
53
|
+
setError(e.message);
|
|
54
|
+
setOutcome(LoginOutcome.Failed);
|
|
55
|
+
setBusy(null);
|
|
56
|
+
});
|
|
57
|
+
}, [blocked, context, env, nav]);
|
|
58
|
+
const accept = useCallback((value) => {
|
|
59
|
+
setAccepted(value);
|
|
60
|
+
setAttempted(false);
|
|
61
|
+
acceptTerms(resolved, value);
|
|
62
|
+
}, [resolved]);
|
|
63
|
+
return {
|
|
64
|
+
methods,
|
|
65
|
+
primary: primaryLoginMethod(methods),
|
|
66
|
+
terms: {
|
|
67
|
+
required: resolved?.required ?? false,
|
|
68
|
+
accepted: resolved == null ? true : accepted,
|
|
69
|
+
deferred,
|
|
70
|
+
attempted,
|
|
71
|
+
documents: resolved?.documents ?? [],
|
|
72
|
+
notices: resolved?.notices ?? [],
|
|
73
|
+
...(resolved?.revisedAt != null ? { revisedAt: resolved.revisedAt } : {}),
|
|
74
|
+
version: resolved?.version ?? '',
|
|
75
|
+
accept,
|
|
76
|
+
},
|
|
77
|
+
credit,
|
|
78
|
+
blocked,
|
|
79
|
+
busy,
|
|
80
|
+
outcome,
|
|
81
|
+
error,
|
|
82
|
+
select,
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
//# sourceMappingURL=model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model.js","sourceRoot":"","sources":["../../../src/auth/login/model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AACtD,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAE1D,OAAO,EACL,WAAW,EAAE,kBAAkB,EAAE,aAAa,EAAE,YAAY,EAAE,aAAa,EAAE,aAAa,EAC1F,YAAY,EAAE,aAAa,GAC5B,MAAM,6BAA6B,CAAA;AAIpC;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,IAA6B,EAAqB,EAAE;IAClF,MAAM,OAAO,GAAG,UAAU,EAA6B,CAAA;IACvD,MAAM,GAAG,GAAG,WAAW,EAAE,CAAA;IACzB,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAe,aAAa,CAAC,CAAA;IAE1D,MAAM,GAAG,GAAG,IAAI,EAAE,MAAM,IAAK,OAAO,CAAC,GAAoB,CAAC,QAAQ,EAAE,IAAI,EAAE,KAAK,CAAA;IAC/E,MAAM,KAAK,GAAI,OAAO,CAAC,GAAoB,CAAC,KAAK,CAAA;IAEjD,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,YAAY,CAAC,IAAI,EAAE,KAAK,IAAI,GAAG,EAAE,KAAK,CAAC,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC,CAAA;IAC3F,MAAM,MAAM,GAAG,OAAO,CACpB,GAAG,EAAE,CAAC,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,GAAG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AEd,OAAO;QACL,OAAO;QACP,OAAO,EAAE,kBAAkB,CAAC,OAAO,CAAC;QACpC,KAAK,EAAE;YACL,QAAQ,EAAE,QAAQ,EAAE,QAAQ,IAAI,KAAK;YACrC,QAAQ,EAAE,QAAQ,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ;YAC5C,QAAQ;YACR,SAAS;YACT,SAAS,EAAE,QAAQ,EAAE,SAAS,IAAI,EAAE;YACpC,OAAO,EAAE,QAAQ,EAAE,OAAO,IAAI,EAAE;YAChC,GAAG,CAAC,QAAQ,EAAE,SAAS,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,QAAQ,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YACzE,OAAO,EAAE,QAAQ,EAAE,OAAO,IAAI,EAAE;YAChC,MAAM;SACP;QACD,MAAM;QACN,OAAO;QACP,IAAI;QACJ,OAAO;QACP,KAAK;QACL,MAAM;KACP,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { LoginMethod, LoginOutcome, ResolvedTermsDocument } from '@owlmeans/client-auth/login';
|
|
2
|
+
import type { LoginScreenConfig, LoginTermsConfig } from '@owlmeans/config';
|
|
3
|
+
export interface UseLoginMethodsOptions {
|
|
4
|
+
/** Overrides the configuration the context carries. */
|
|
5
|
+
config?: LoginScreenConfig;
|
|
6
|
+
terms?: LoginTermsConfig | false;
|
|
7
|
+
/** Replace or reorder what the resolver produced. */
|
|
8
|
+
methods?: LoginMethod[] | ((methods: LoginMethod[]) => LoginMethod[]);
|
|
9
|
+
}
|
|
10
|
+
export interface LoginTermsModel {
|
|
11
|
+
required: boolean;
|
|
12
|
+
accepted: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* A registered, bound `LoginStep` confirms the terms instead of this screen — see
|
|
15
|
+
* `termsDeferred` (`@owlmeans/client-auth/login`). While true, `required` and `accepted` still
|
|
16
|
+
* carry their ordinary values (for a renderer that wants them), but nothing is EVER blocked on
|
|
17
|
+
* them here, and a renderer should show the privacy notice only, no checkbox.
|
|
18
|
+
*/
|
|
19
|
+
deferred: boolean;
|
|
20
|
+
/** A blocked selection was attempted — render the explanation. */
|
|
21
|
+
attempted: boolean;
|
|
22
|
+
/** What the checkbox agrees to — terms, then billing/product when configured, then custom. */
|
|
23
|
+
documents: ResolvedTermsDocument[];
|
|
24
|
+
/** What is merely disclosed, never consented to — privacy, plus cookies per its own rule. */
|
|
25
|
+
notices: ResolvedTermsDocument[];
|
|
26
|
+
/** The latest revision date among `documents`, only when the configuration asked to show it. */
|
|
27
|
+
revisedAt?: string;
|
|
28
|
+
/** The digest acceptance is recorded against — changes whenever a document does. */
|
|
29
|
+
version: string;
|
|
30
|
+
accept: (value: boolean) => void;
|
|
31
|
+
}
|
|
32
|
+
export interface LoginCreditModel {
|
|
33
|
+
poweredBy: boolean;
|
|
34
|
+
line: string | null;
|
|
35
|
+
}
|
|
36
|
+
export interface LoginMethodsModel {
|
|
37
|
+
methods: LoginMethod[];
|
|
38
|
+
/** The one a screen highlights and focuses. It is never started automatically. */
|
|
39
|
+
primary: LoginMethod | null;
|
|
40
|
+
terms: LoginTermsModel;
|
|
41
|
+
credit: LoginCreditModel;
|
|
42
|
+
/** True while the terms have not been confirmed and confirming them is required. */
|
|
43
|
+
blocked: boolean;
|
|
44
|
+
/** Id of the method currently starting. */
|
|
45
|
+
busy: string | null;
|
|
46
|
+
outcome: LoginOutcome | null;
|
|
47
|
+
error: string | null;
|
|
48
|
+
/**
|
|
49
|
+
* Start a method.
|
|
50
|
+
*
|
|
51
|
+
* NOT async, and it awaits nothing before delegating — the flow may need to open a window, and a
|
|
52
|
+
* window opened after the click has finished being handled is eaten by the popup blocker.
|
|
53
|
+
*/
|
|
54
|
+
select: (method: LoginMethod) => void;
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
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AAoF;IACpF,OAAO,EAAE,OAAO,CAAA;IAChB,2CAA2C;IAC3C,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;IACnB,OAAO,EAAE,YAAY,GAAG,IAAI,CAAA;IAC5B,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB;;;;;OAKG;IACH,MAAM,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,IAAI,CAAA;CACtC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/auth/login/types.ts"],"names":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,mBAAmB,YAAY,CAAA;AAE/B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,mBAAmB,CAAA;AACjC,cAAc,cAAc,CAAA;AAC5B,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,mBAAmB,YAAY,CAAA;AAE/B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,mBAAmB,CAAA;AACjC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,cAAc,CAAA;AAC5B,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAEA,cAAc,iBAAiB,CAAA;AAC/B,cAAc,mBAAmB,CAAA;AACjC,cAAc,cAAc,CAAA;AAC5B,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAEA,cAAc,iBAAiB,CAAA;AAC/B,cAAc,mBAAmB,CAAA;AACjC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,cAAc,CAAA;AAC5B,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { NavTranslate, PanelNavConfig, PanelNavModel } from './types.js';
|
|
2
|
+
/** Default resolver: no i18n, the caller's fallback wins. See {@link NavTranslate}. */
|
|
3
|
+
export declare const defaultNavTranslate: NavTranslate;
|
|
4
|
+
/**
|
|
5
|
+
* Turn an alias into something readable — `my-app:web:user-list` becomes `User list`.
|
|
6
|
+
* The last segment is the meaningful one; the prefixes address the app, not the screen.
|
|
7
|
+
*/
|
|
8
|
+
export declare const defaultNavLabel: (alias: string) => string;
|
|
9
|
+
export declare const resolveNavLabel: (translate: NavTranslate, label: string | undefined, key: string, alias?: string) => string;
|
|
10
|
+
/**
|
|
11
|
+
* The navigation model behind both menus.
|
|
12
|
+
*
|
|
13
|
+
* Resolving the CURRENT screen has two sources, and both are needed. The router carries the
|
|
14
|
+
* alias in `location.state`, which is authoritative — but `state` is `window.history.state`,
|
|
15
|
+
* so it is null until the first in-app navigation: on a hard page load or a deep link there
|
|
16
|
+
* is nothing there, and a menu keyed on it alone highlights nothing on exactly the entry that
|
|
17
|
+
* matters most. The pathname is the fallback: an entrypoint computes its path from its own
|
|
18
|
+
* declaration and its ancestors', so matching them is a lookup, not a guess.
|
|
19
|
+
*/
|
|
20
|
+
export declare const usePanelNav: (config: PanelNavConfig) => PanelNavModel;
|
|
21
|
+
//# sourceMappingURL=helper.d.ts.map
|