@mgamadeus/ddd-admin-ui 0.1.0-rc.2 → 0.1.0-rc.3
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/.claude/skills/ddd-admin-ui-specialist/SKILL.md +13 -2
- package/CHANGELOG.md +39 -1
- package/README.md +12 -3
- package/STANDARDS.md +105 -57
- package/dist/components.css +55 -0
- package/dist/i18n/hints.json +2 -1
- package/dist/i18n/index.d.ts +1 -1
- package/dist/i18n/index.d.ts.map +1 -1
- package/dist/i18n/index.js.map +1 -1
- package/dist/i18n/store.d.ts +10 -2
- package/dist/i18n/store.d.ts.map +1 -1
- package/dist/i18n/store.js +6 -2
- package/dist/i18n/store.js.map +1 -1
- package/dist/i18n-keys.json +9 -1
- package/dist/list/EntityListBody.d.ts +10 -3
- package/dist/list/EntityListBody.d.ts.map +1 -1
- package/dist/list/EntityListBody.js +9 -3
- package/dist/list/EntityListBody.js.map +1 -1
- package/dist/list/EntityListTable.d.ts +35 -2
- package/dist/list/EntityListTable.d.ts.map +1 -1
- package/dist/list/EntityListTable.js +157 -6
- package/dist/list/EntityListTable.js.map +1 -1
- package/dist/list/StatusBadge.d.ts +1 -1
- package/dist/list/StatusBadge.d.ts.map +1 -1
- package/dist/list/StatusBadge.js +3 -2
- package/dist/list/StatusBadge.js.map +1 -1
- package/dist/logic/index.d.ts +5 -1
- package/dist/logic/index.d.ts.map +1 -1
- package/dist/logic/index.js +2 -0
- package/dist/logic/index.js.map +1 -1
- package/dist/logic/pure/listSort.d.ts +21 -0
- package/dist/logic/pure/listSort.d.ts.map +1 -0
- package/dist/logic/pure/listSort.js +31 -0
- package/dist/logic/pure/listSort.js.map +1 -0
- package/dist/logic/pure/listTracks.d.ts +90 -0
- package/dist/logic/pure/listTracks.d.ts.map +1 -0
- package/dist/logic/pure/listTracks.js +139 -0
- package/dist/logic/pure/listTracks.js.map +1 -0
- package/dist/logic/pure/status.d.ts +23 -2
- package/dist/logic/pure/status.d.ts.map +1 -1
- package/dist/logic/pure/status.js +23 -2
- package/dist/logic/pure/status.js.map +1 -1
- package/dist/tokens.json +20 -0
- package/package.json +3 -6
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: ddd-admin-ui-specialist
|
|
3
|
-
description: "Build admin screens with @mgamadeus/ddd-admin-ui
|
|
3
|
+
description: "Build admin screens with @mgamadeus/ddd-admin-ui and extend the package. Covers entries and import matrix, host setup (AdminUiProvider above every page, theme.css and components.css, tokens.json with ddd-admin-ui-check-tokens, one Radix copy with ddd-admin-ui-check-radix), list pages with URL filters, grid/table view, selection and bulk actions, wide tables (column tracks, pins, sortable headers, row index), detail shells, form drawers with conditions, server errors and the unsaved-changes guard, translations on full locale::style keys, media fields, toasts, layers, the portal container, the text manifest i18n-keys.json and text contexts, server vs client files, and adding a block. Use when building or reviewing a list, detail or form screen with these blocks, a page fails with Tooltip must be used within TooltipProvider, a wide table squeezes or needs pinned columns or sorting, a colour, layer or overlay misbehaves, translations lose a style variant, URL filters get lost, or a block is added."
|
|
4
4
|
metadata:
|
|
5
5
|
author: mgamadeus
|
|
6
6
|
version: 0.1.0
|
|
@@ -20,7 +20,10 @@ installed package (`node_modules/@mgamadeus/ddd-admin-ui/`). This skill reaches
|
|
|
20
20
|
| search and filters in the URL | `useUrlListState` with `useNextUrlStateAdapter` | logic, next |
|
|
21
21
|
| grid / table switch remembered per list | `useListViewParam` + `EntityListViewToggle` | next, list |
|
|
22
22
|
| checkbox column and bulk actions | `useRowSelection` + `EntityListBulkBar` + `runSequentialWithSummary` | logic, list |
|
|
23
|
-
| status pill of an enum | `defineStatusMap` + `StatusBadge` | logic, list |
|
|
23
|
+
| status pill of an enum | `defineStatusMap` + `StatusBadge` (a `context` for an ambiguous word) | logic, list |
|
|
24
|
+
| a wide table: column tracks, pinned columns, sortable headers, row numbers | `EntityListColumn` `width` / `minWidth` / `pin` / `align` / `sortKey` + `sort` / `onSortChange` / `showRowIndex` | list |
|
|
25
|
+
| the sort in the URL | `formatListSort` / `parseListSort` / `nextListSort` (`key:asc`) | logic |
|
|
26
|
+
| a view that loads its own data (a tree) in the list card | `EntityListBody.renderOwnView` | list |
|
|
24
27
|
| an entity detail with tabs | `EntityDetailShell` (+ `SectionHeader`, `DefinitionList`) | page |
|
|
25
28
|
| a form page or drawer | `Form` + `FormField` / `FormSection` + `FormActions`, in `FormDrawer` | form |
|
|
26
29
|
| drawer state in the URL (`?edit=<id>`, `?create=1`) | `useEntityDrawer` with `useNextDrawerUrlAdapter` | logic, next |
|
|
@@ -50,6 +53,13 @@ installed package (`node_modules/@mgamadeus/ddd-admin-ui/`). This skill reaches
|
|
|
50
53
|
- **URL state.** Build requests from `list.debounced`, never `list.values`. All writes (filters, view, drawer) go
|
|
51
54
|
through the one URL writer, so writes in the same tick merge; never `router.replace` the search parameters by hand.
|
|
52
55
|
Screens reading search parameters render inside `<Suspense>`.
|
|
56
|
+
- **Wide tables.** Tracks are opt-in per table: one `width` gives every column a track (default `1fr`, minimum 120
|
|
57
|
+
px); the table then scrolls sideways inside its card instead of squeezing. `pin: 'end'` always holds; `pin: 'start'`
|
|
58
|
+
only while the table overflows by 120 px or more and the pinned columns stay under a third of the visible width. The
|
|
59
|
+
table never sorts rows: map `sortKey` to the request. Sizes are measured after hydration only.
|
|
60
|
+
- **Text contexts are literals.** `m('Failed', { context: 'import-status' })`: extractors (the package manifest and
|
|
61
|
+
host exports) read the text and the context as string literals; a context only on the status map or in a variable is
|
|
62
|
+
not exported. Put the same context on the definition or the map so `StatusBadge` translates with it.
|
|
53
63
|
- **Server vs client.** Hooks and context live in files with `'use client'`; pure helpers (`m`, `formatDateTime`,
|
|
54
64
|
`defineStatusMap`, schemas, conditions) may be called in server code and `metadata`.
|
|
55
65
|
|
|
@@ -65,6 +75,7 @@ export const ItemsScreen = () => {
|
|
|
65
75
|
const list = useUrlListState(LIST_KEYS, { adapter: useNextUrlStateAdapter({ listId: LIST_ID }), uncounted: ['q'] });
|
|
66
76
|
const [displayMode, setDisplayMode] = useListViewParam(LIST_ID, 'table');
|
|
67
77
|
const query = useItemsQuery(list.debounced); // the host's data hook
|
|
78
|
+
// wide tables: columns with width / pin / sortKey, then sort={sort} onSortChange={setSort} showRowIndex on the body
|
|
68
79
|
return (
|
|
69
80
|
<EntityListPage
|
|
70
81
|
title="Items"
|
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,44 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
All notable changes to `@mgamadeus/ddd-admin-ui`. 0.x: each minor may break;
|
|
3
|
+
All notable changes to `@mgamadeus/ddd-admin-ui`. 0.x: each minor may break; pin the exact version while the package
|
|
4
|
+
is in 0.x prereleases.
|
|
5
|
+
|
|
6
|
+
## 0.1.0-rc.3
|
|
7
|
+
|
|
8
|
+
- List table, all optional (a table without the new props renders the same DOM and classes as 0.1.0-rc.2, proven by
|
|
9
|
+
a server-render snapshot taken from 0.1.0-rc.2, `pnpm test:render`):
|
|
10
|
+
- Column tracks: `EntityListColumn.width` (`'1fr'`, `'2fr'`, `'120px'`), `minWidth` (px, default 120), `align`
|
|
11
|
+
(`start` / `center` / `end`). One column with a width gives every column a track (default `1fr`); share columns
|
|
12
|
+
never go below their minimum, and when the minimums exceed the visible width the table scrolls sideways inside its
|
|
13
|
+
card. A table with tracks is one CSS grid (every row a subgrid, table roles kept); without any width the layout
|
|
14
|
+
stays content-sized.
|
|
15
|
+
- Pinned columns: `pin: 'start' | 'end'`. `end` always holds; `start` only while the table overflows by 120 px or
|
|
16
|
+
more and the pinned columns take less than a third of the visible width. In a table using tracks, pins or the row
|
|
17
|
+
index, the selection column and the row index always pin. A pinned cell paints the card surface and its edge only
|
|
18
|
+
while content scrolls under it.
|
|
19
|
+
- Sortable headers: `sortKey` on the column, `sort` / `onSortChange` on `EntityListTable` and `EntityListBody`;
|
|
20
|
+
not sorted → ascending → descending → not sorted, `aria-sort`, the header content is a button. The table never
|
|
21
|
+
sorts rows itself.
|
|
22
|
+
- Row index: `showRowIndex`, a leading `#` column, 1-based among the loaded rows (new text `Row number`).
|
|
23
|
+
- Sizes are measured after hydration only (server and hydration render use the CSS form of the same tracks).
|
|
24
|
+
- `EntityListBody.renderOwnView(mode)`: a view that owns its data and states, drawn in the list card as is, without
|
|
25
|
+
the paged list's skeletons, empty and error states and tail. `renderExtraView` is unchanged.
|
|
26
|
+
- `./logic`: `nextListSort`, `parseListSort`, `formatListSort` (`key:asc`), `EntityListSort`, `ListSortDirection`; the
|
|
27
|
+
pure track and pin mechanics `computeListTracks`, `listTrackTemplate`, `minimumListWidth`, `hasListTracks`,
|
|
28
|
+
`resolveListPins`, `shouldHonourStartPins`, `LIST_COLUMN_MIN_WIDTH`, `LIST_PIN_MAX_VISIBLE_SHARE`,
|
|
29
|
+
`LIST_PIN_MIN_OVERFLOW` and their types (`ListColumnWidth`, `ListColumnPin`, `ListColumnAlign`, `ListTrack`,
|
|
30
|
+
`ListTrackLayout`, `ListPinRequest`, `ListPinPlacement`, `ListPinMeasure`, `ListPinLayout`).
|
|
31
|
+
- Status contexts: `StatusDefinition.context` and `defineStatusMap(map, { context })` (`StatusMapOptions`; the
|
|
32
|
+
definition's context wins). `StatusBadge` translates label and description with it. `m()` takes an optional
|
|
33
|
+
`{ context }` (`MarkOptions`) that text exports read: `m('Failed', { context: 'import-status' })` → key
|
|
34
|
+
`Failed__import-status`. Existing calls are unchanged.
|
|
35
|
+
- `tokens.json`: data attributes `data-list-tracks`, `data-list-pin`, `data-list-pin-edge`, `data-list-overflow-start`,
|
|
36
|
+
`data-list-overflow-end` (read by `components.css`). No new colour role or custom property.
|
|
37
|
+
- Removed the optional peer `recharts` (no entry used it).
|
|
38
|
+
- Docs: pin the exact version while the package is in 0.x prereleases; neutral examples in `STANDARDS.md`; the list
|
|
39
|
+
section and the skill describe the new table props.
|
|
40
|
+
- Consumer checks: the no-prop snapshot and the status context (server render), and a list page with tracks, pins, sort
|
|
41
|
+
and row index in the browser (pin guard at three widths, sideways scroll inside the card at 390 px, sort cycle).
|
|
4
42
|
|
|
5
43
|
## 0.1.0-rc.2
|
|
6
44
|
|
package/README.md
CHANGED
|
@@ -52,7 +52,6 @@ from the entry that owns it.
|
|
|
52
52
|
| `next` | optional peer | `^16.0.0` — needed by `./next` only |
|
|
53
53
|
| `sonner` | optional peer | `^2.0.0` — needed by `./notify-sonner` only |
|
|
54
54
|
| `tailwindcss` | optional peer | `^4.1.0` — the host's build compiles the CSS |
|
|
55
|
-
| `recharts` | optional peer | `^3.0.0` — reserved; no entry uses it yet |
|
|
56
55
|
| `radix-ui` | peer | `^1.8.1` — one copy per app, as with React (see below) |
|
|
57
56
|
| `class-variance-authority`, `cmdk`, `clsx`, `tailwind-merge` | dependencies | imported inside `./primitives` only |
|
|
58
57
|
|
|
@@ -190,6 +189,13 @@ The UI language lives in one store: `setTranslations(languageCode, writingStyle,
|
|
|
190
189
|
`translations` adapter) sets it, `useTranslate().t` and `translateText` read it, `m('…')` marks a text for extraction
|
|
191
190
|
without translating it. A key is the English text, or `<text>__<context>` with a context.
|
|
192
191
|
|
|
192
|
+
A text rendered with a context is marked with it: `m('Failed', { context: 'import-status' })` (`m` returns the text;
|
|
193
|
+
the context reaches the renderer separately, e.g. as `StatusDefinition.context` or the map context of
|
|
194
|
+
`defineStatusMap(map, { context })`). Extractors read the call statically: the first argument of `t(…)`,
|
|
195
|
+
`translateText(…)` or `m(…)` as a string literal, an optional second argument `{ … }` without nested braces whose
|
|
196
|
+
`context:` is a string literal, and `<Translate context="…">text</Translate>`; the key is `<text>__<context>`. A
|
|
197
|
+
context held in a variable, or only on the map, is invisible to an extractor, so each label carries its literal.
|
|
198
|
+
|
|
193
199
|
The package ships its texts as [`i18n-keys.json`](./i18n-keys.json) (`./i18n-keys.json`): every key with its text,
|
|
194
200
|
context, translator hint and the files that use it, sorted by key. A host's text export merges this manifest instead of
|
|
195
201
|
scanning the package (one usage per key, the hints with the host's own hint precedence). `ddd-admin-ui-i18n-manifest
|
|
@@ -207,8 +213,9 @@ project's `.claude/skills/`. Idempotent; repoints an existing symlink, never tou
|
|
|
207
213
|
|
|
208
214
|
## Versioning
|
|
209
215
|
|
|
210
|
-
0.x: each minor may break.
|
|
211
|
-
(`x.y.z-…`) are published under the `next` dist-tag. Changes per release:
|
|
216
|
+
0.x: each minor may break. Pin the exact version while the package is in 0.x prereleases; modules peer on the version
|
|
217
|
+
they were tested with. Pre-releases (`x.y.z-…`) are published under the `next` dist-tag. Changes per release:
|
|
218
|
+
[CHANGELOG.md](CHANGELOG.md).
|
|
212
219
|
|
|
213
220
|
## Development
|
|
214
221
|
|
|
@@ -217,6 +224,7 @@ pnpm install
|
|
|
217
224
|
pnpm typecheck
|
|
218
225
|
pnpm test # unit tests beside the sources, script tests and a failing fixture per check-package rule
|
|
219
226
|
pnpm build # tsc → dist, declaration specifiers, stylesheets, manifests and shipped scripts
|
|
227
|
+
pnpm test:render # after the build: list tables without the optional props render as in 0.1.0-rc.2
|
|
220
228
|
node scripts/check-package.mjs --dir .
|
|
221
229
|
pnpm pack --pack-destination "$TMPDIR" && test/consumer/run.sh "$TMPDIR"/mgamadeus-ddd-admin-ui-*.tgz pnpm "$TMPDIR/consumer-pnpm"
|
|
222
230
|
```
|
|
@@ -226,6 +234,7 @@ pnpm pack --pack-destination "$TMPDIR" && test/consumer/run.sh "$TMPDIR"/mgamade
|
|
|
226
234
|
| `node scripts/build.mjs` (`pnpm build`) | removes `dist`, `tsc -p tsconfig.build.json` (one JS and declaration file per source file, directives kept, `.js` specifiers), rewrites the declarations' specifiers to `.js`, copies CSS, JSON and the shipped scripts into `dist` |
|
|
227
235
|
| `node scripts/check-package.mjs --dir <package root or extracted tarball>` | the 13 package rules: exports and bins, directives, specifiers, no app alias, deny list (`--deny a,b` or `CHECK_PACKAGE_DENY`; `--require-deny-list` on release), declared dependencies, entry edges and reach, module state once, `files` and `sideEffects`, declarations in a strict consumer, no tests, fresh text manifest, tokens |
|
|
228
236
|
| `node scripts/tokens-utilities.mjs [--write]` | checks (or regenerates) the `utilities` lists of `tokens.json` from the source |
|
|
237
|
+
| `pnpm test:render` | server-renders list tables, bodies and badges from the build: without the optional table props the markup equals `test/consumer/fixtures/plain/list-snapshot.html` (taken from 0.1.0-rc.2); a status map's translation context reaches `StatusBadge` |
|
|
229
238
|
| `node scripts/build-i18n-manifest.mjs [--check]` (`pnpm i18n:manifest`) | regenerates `i18n-keys.json` from the source and `i18n/hints.json`; run it after changing a text or the version |
|
|
230
239
|
| `node scripts/check-tokens.mjs <css> [tokens.json]` | the host check above (shipped as `ddd-admin-ui-check-tokens`) |
|
|
231
240
|
| `node scripts/check-radix.mjs [host folder]` | the Radix copy check above (shipped as `ddd-admin-ui-check-radix`) |
|
package/STANDARDS.md
CHANGED
|
@@ -8,7 +8,7 @@ Where the names below come from (setup and the entry list: [`README.md`](./READM
|
|
|
8
8
|
|
|
9
9
|
| Entry | Names used here |
|
|
10
10
|
|---|---|
|
|
11
|
-
| `@mgamadeus/ddd-admin-ui/logic` | `useUrlListState`, `useRowSelection`, `useEntityDrawer`, `drawerKey`, `defineStatusMap`, `formatDate`, `formatDateTime`, `runSequentialWithSummary` |
|
|
11
|
+
| `@mgamadeus/ddd-admin-ui/logic` | `useUrlListState`, `useRowSelection`, `useEntityDrawer`, `drawerKey`, `defineStatusMap`, `formatDate`, `formatDateTime`, `runSequentialWithSummary`, `nextListSort`, `parseListSort`, `formatListSort` |
|
|
12
12
|
| `@mgamadeus/ddd-admin-ui/list` | `EntityListToolbar`, `EntityListBody`, `EntityListTable`, `EntityListViewToggle`, `EntityListBulkBar`, `FilterPanel`, `FilterText`, `FilterSelect`, `FilterMultiSelect`, `FilterDateRange`, `YES_NO_FILTER_OPTIONS`, `StatusBadge`, `IdCell`, `DateCell`, `BooleanCell`, `ImageCell`, `EmptyValue`, `orEmpty`, `MultiSelect`, `ChipToggleGroup`, `Combobox`, `Tag` |
|
|
13
13
|
| `@mgamadeus/ddd-admin-ui/page` | `EntityListPage`, `PageToolbar`, `ExportButton`, `AddEntityButton`, `EntityDetailShell`, `SectionHeader`, `DefinitionList`, `EditableCard`, `IconValue`, `IconValueRow`, `PageSections`, `CardGrid`, `PageFrame`, `PageHeader` |
|
|
14
14
|
| `@mgamadeus/ddd-admin-ui/form` | `FormDrawer`, `FormActions`, `FormField`, `FormSection`, `useConfirmDialog` |
|
|
@@ -26,9 +26,9 @@ One hook for search + filters, in the URL, 350 ms debounce. Keys = URL parameter
|
|
|
26
26
|
import { useUrlListState } from '@mgamadeus/ddd-admin-ui/logic';
|
|
27
27
|
import { useNextUrlStateAdapter } from '@mgamadeus/ddd-admin-ui/next'; // or the host's own `UrlStateAdapter`
|
|
28
28
|
|
|
29
|
-
const LIST_KEYS = ['q', '
|
|
29
|
+
const LIST_KEYS = ['q', 'workspaceId', 'status', 'createdFrom', 'createdTo'] as const;
|
|
30
30
|
|
|
31
|
-
const list = useUrlListState(LIST_KEYS, { adapter: useNextUrlStateAdapter({ listId: 'admin.
|
|
31
|
+
const list = useUrlListState(LIST_KEYS, { adapter: useNextUrlStateAdapter({ listId: 'admin.projects' }), uncounted: ['q'] });
|
|
32
32
|
// inputs: list.values.q / list.setValue('q', value)
|
|
33
33
|
// request: build the filter string from list.debounced (never from list.values)
|
|
34
34
|
// multi: list.getList('status') / list.setList('status', next) → `?status=RUNNING,PAUSED`
|
|
@@ -50,8 +50,8 @@ below. Filters go **only** in the panel (never in `trailing`, never as an inline
|
|
|
50
50
|
filters={
|
|
51
51
|
<FilterPanel>
|
|
52
52
|
<FilterText label="ID" inputMode="numeric" value={list.values.id} onChange={value => list.setValue('id', value)} />
|
|
53
|
-
<FilterSelect label="
|
|
54
|
-
onChange={value => list.setValue('
|
|
53
|
+
<FilterSelect label="Workspace" allLabel="All workspaces" options={workspaceOptions} value={list.values.workspaceId}
|
|
54
|
+
onChange={value => list.setValue('workspaceId', value)} />
|
|
55
55
|
<FilterMultiSelect label="Status" options={STATUS_OPTIONS} value={list.getList('status')}
|
|
56
56
|
onChange={next => list.setList('status', next)} />
|
|
57
57
|
<FilterDateRange label="Created" from={list.values.createdFrom} to={list.values.createdTo}
|
|
@@ -68,6 +68,8 @@ below. Filters go **only** in the panel (never in `trailing`, never as an inline
|
|
|
68
68
|
- `FilterSelect`: `''` = All (`allLabel`), searchable automatically from 10 options (`searchable` to force).
|
|
69
69
|
- Yes / No filters: `options={YES_NO_FILTER_OPTIONS}` (`'1'` / `'0'`).
|
|
70
70
|
- Body: `isSearchActive={list.isActive}` and `onClearSearch={list.clear}` on `EntityListBody`.
|
|
71
|
+
- A view that owns its data and states (a tree with its own query): `EntityListBody.renderOwnView(mode)`, drawn in the
|
|
72
|
+
card as is. While an own view is shown the host omits search, filters and clear from the toolbar.
|
|
71
73
|
- Search modes (e.g. an AI search next to the text search): the mode switch goes in `search.leading` (it replaces the
|
|
72
74
|
magnifier at the same spot, ≤ 24 px), Enter / Escape in `search.onKeyDown`. Never lay a control over the field from
|
|
73
75
|
outside.
|
|
@@ -80,13 +82,13 @@ fit, already translated). Every write control `disabled={!writesAllowed}`.
|
|
|
80
82
|
|
|
81
83
|
```tsx
|
|
82
84
|
<EntityListPage
|
|
83
|
-
title="
|
|
85
|
+
title="Projects"
|
|
84
86
|
headerActions={
|
|
85
87
|
<PageToolbar
|
|
86
88
|
exportAction={<ExportButton onExport={handleExport} disabled={!writesAllowed} />}
|
|
87
|
-
moreActions={[{ id: 'recalc', label: 'Recalculate
|
|
89
|
+
moreActions={[{ id: 'recalc', label: 'Recalculate totals', icon: <RefreshCw />, onSelect: handleRecalc,
|
|
88
90
|
disabled: !writesAllowed }]}
|
|
89
|
-
primaryAction={<AddEntityButton entity="
|
|
91
|
+
primaryAction={<AddEntityButton entity="Project" href="/projects/create" linkComponent={Link}
|
|
90
92
|
disabled={!writesAllowed} />}
|
|
91
93
|
>
|
|
92
94
|
<Button variant="outline" onClick={openImport}>Import</Button>
|
|
@@ -103,17 +105,17 @@ fit, already translated). Every write control `disabled={!writesAllowed}`.
|
|
|
103
105
|
```tsx
|
|
104
106
|
const selection = useRowSelection({
|
|
105
107
|
items: list.items, // useGrowingWindowList().items
|
|
106
|
-
getKey:
|
|
108
|
+
getKey: task => toNumericId(task.id), // a host helper
|
|
107
109
|
resetKey: filterString ?? '', // new filters → empty selection
|
|
108
110
|
disabled: busy,
|
|
109
111
|
});
|
|
110
112
|
|
|
111
113
|
const handleBulkDelete = async () => {
|
|
112
|
-
if (!writesAllowed || !(await confirm({ title: `Delete ${selection.count}
|
|
114
|
+
if (!writesAllowed || !(await confirm({ title: `Delete ${selection.count} task(s)?`, confirmVariant: 'destructive',
|
|
113
115
|
confirmLabel: 'Delete' }))) return;
|
|
114
116
|
setBusy(true);
|
|
115
|
-
await runSequentialWithSummary(selection.selectedKeys, id =>
|
|
116
|
-
{ progress: 'Deleting', done: 'Deleted', noun: '
|
|
117
|
+
await runSequentialWithSummary(selection.selectedKeys, id => deleteTask({ taskId: id }).unwrap(),
|
|
118
|
+
{ progress: 'Deleting', done: 'Deleted', noun: 'task' });
|
|
117
119
|
setBusy(false);
|
|
118
120
|
selection.clear();
|
|
119
121
|
};
|
|
@@ -140,15 +142,15 @@ Order: [select] → image → **ID** → name (link) → relations → type / at
|
|
|
140
142
|
**Created / Updated** → **Actions**. Title Case headers. Every table with a detail route sets `rowAction`.
|
|
141
143
|
|
|
142
144
|
```tsx
|
|
143
|
-
const columns: EntityListColumn<
|
|
145
|
+
const columns: EntityListColumn<Project>[] = [
|
|
144
146
|
{ id: 'image', header: 'Image', cell: c => <ImageCell src={mediaSizedUrl(c.coverImage?.publicUrl, 'SMALL')} alt="" />,
|
|
145
147
|
className: 'w-16' },
|
|
146
148
|
{ id: 'id', header: 'ID', cell: c => <IdCell id={c.id} copyable />, className: 'w-20' },
|
|
147
|
-
{ id: 'name', header: 'Name', cell: c => <Link href={
|
|
149
|
+
{ id: 'name', header: 'Name', cell: c => <Link href={projectRoute(c.id)} className="font-medium hover:underline">
|
|
148
150
|
{c.name}</Link> },
|
|
149
|
-
{ id: '
|
|
150
|
-
{ id: 'status', header: 'Status', cell: c => <StatusBadge value={c.status} map={
|
|
151
|
-
{ id: '
|
|
151
|
+
{ id: 'workspace', header: 'Workspace', cell: c => orEmpty(c.workspace?.name) },
|
|
152
|
+
{ id: 'status', header: 'Status', cell: c => <StatusBadge value={c.status} map={PROJECT_STATUS} /> },
|
|
153
|
+
{ id: 'archived', header: 'Archived', cell: c => <BooleanCell value={c.archived} /> },
|
|
152
154
|
{ id: 'start', header: 'Start', cell: c => <DateCell value={c.startDate} format="date" /> },
|
|
153
155
|
{ id: 'created', header: 'Created', cell: c => <DateCell value={c.changeHistory?.createdTime} /> },
|
|
154
156
|
{ id: 'updated', header: 'Updated', cell: c => <DateCell value={c.changeHistory?.modifiedTime} /> },
|
|
@@ -168,15 +170,61 @@ const columns: EntityListColumn<Campaign>[] = [
|
|
|
168
170
|
- Numbers and ids: the host's formatters (one per kind), never ad-hoc `toFixed` calls.
|
|
169
171
|
- Copy next to a value outside the ID column: a copy button on `useCopyToClipboard`.
|
|
170
172
|
|
|
173
|
+
### Wide tables: tracks, pins, sort, row index
|
|
174
|
+
|
|
175
|
+
All optional; a table that uses none of them keeps the content-sized layout.
|
|
176
|
+
|
|
177
|
+
```tsx
|
|
178
|
+
const [sort, setSort] = useState<EntityListSort | null>(() => parseListSort(list.values.sort, ['name', 'created']));
|
|
179
|
+
// or in the URL list state: list.setValue('sort', formatListSort(next))
|
|
180
|
+
|
|
181
|
+
const columns: EntityListColumn<Project>[] = [
|
|
182
|
+
{ id: 'id', header: 'ID', cell: c => <IdCell id={c.id} />, width: '96px', pin: 'start', sortKey: 'id' },
|
|
183
|
+
{ id: 'name', header: 'Name', cell: c => c.name, width: '2fr', minWidth: 200, sortKey: 'name' },
|
|
184
|
+
{ id: 'owner', header: 'Owner', cell: c => orEmpty(c.owner?.name), width: '1fr' },
|
|
185
|
+
{ id: 'created', header: 'Created', cell: c => <DateCell value={c.changeHistory?.createdTime} />, width: '160px',
|
|
186
|
+
sortKey: 'created' },
|
|
187
|
+
{ id: 'actions', header: <span className="sr-only">Actions</span>, cell: c => <RowActions project={c} />,
|
|
188
|
+
width: '96px', pin: 'end', align: 'end' },
|
|
189
|
+
];
|
|
190
|
+
|
|
191
|
+
<EntityListBody … columns={columns} sort={sort} onSortChange={setSort} showRowIndex selection={selection} />
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
- **Tracks.** One column with `width` gives every column a track (default `1fr`): share columns (`'2fr'`) divide the
|
|
195
|
+
free width and never go below `minWidth` (default 120 px), fixed columns (`'120px'`) keep their length. When the
|
|
196
|
+
minimums exceed the visible width the table scrolls sideways inside its card; the page never does. In a table with
|
|
197
|
+
tracks a width class in `className` does not size the column, and cell text wraps inside its track.
|
|
198
|
+
- **Pins.** `pin: 'end'` always holds (a row's actions). `pin: 'start'` is a request: honoured only while the table
|
|
199
|
+
overflows (by 120 px or more) and the pinned columns take less than a third of the visible width; otherwise the column
|
|
200
|
+
scrolls like the others. The selection column and the row index always pin in a table that uses tracks, pins or the
|
|
201
|
+
row index. A pinned cell paints the card surface and its edge only while content scrolls under it.
|
|
202
|
+
- **Sort.** `sortKey` makes the header a button (with `aria-sort` on the sorted header); a click moves the sort on: not
|
|
203
|
+
sorted → ascending → descending → not sorted (`null`: the request's default order). The table never sorts rows
|
|
204
|
+
itself; the screen maps the key to its request. One sort at a time; keep it in the URL list state as one value
|
|
205
|
+
(`formatListSort` / `parseListSort`, `key:asc`).
|
|
206
|
+
- **Row index.** `showRowIndex`: a leading `#` column, 1-based among the loaded rows.
|
|
207
|
+
- `align: 'center' | 'end'` aligns header and cells (numbers and actions `end`).
|
|
208
|
+
|
|
171
209
|
## 6. Status badges
|
|
172
210
|
|
|
173
|
-
One family map per enum, defined once in the host with `defineStatusMap` (e.g. `
|
|
174
|
-
a `
|
|
211
|
+
One family map per enum, defined once in the host with `defineStatusMap` (e.g. `PROJECT_STATUS`, `SYNC_STATUS` +
|
|
212
|
+
a `syncStatusOf` mapper for a boolean). A new enum gets a map there.
|
|
213
|
+
|
|
214
|
+
```tsx
|
|
215
|
+
<StatusBadge value={task.status} map={TASK_STATUS} />
|
|
216
|
+
<StatusBadge value={syncStatusOf(job.succeeded)} map={SYNC_STATUS} />
|
|
217
|
+
<StatusBadge tone="highlight" label="Featured" icon={Zap} /> // one-off flag
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
A word that means something else elsewhere (`Failed`, `Open`) gets a translation context, on the map or on one
|
|
221
|
+
definition (the definition's wins), and every label is marked with the same context so text exports find the key:
|
|
175
222
|
|
|
176
223
|
```tsx
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
224
|
+
const IMPORT_STATUS = defineStatusMap(
|
|
225
|
+
{ FAILED: { label: m('Failed', { context: 'import-status' }), tone: 'danger', icon: CircleX }, … },
|
|
226
|
+
{ context: 'import-status' },
|
|
227
|
+
);
|
|
180
228
|
```
|
|
181
229
|
|
|
182
230
|
Tones: `neutral` not started / inactive · `info` finished / informational · `success` running / active / done ·
|
|
@@ -186,7 +234,7 @@ Always with an icon.
|
|
|
186
234
|
## 7. Multi-select inputs
|
|
187
235
|
|
|
188
236
|
- Filters: `FilterMultiSelect` (above).
|
|
189
|
-
- Forms (roles,
|
|
237
|
+
- Forms (roles, teams, languages): `MultiSelect` inside `FormField`; a short fixed set (≤ ~8, fully visible):
|
|
190
238
|
`ChipToggleGroup`.
|
|
191
239
|
|
|
192
240
|
```tsx
|
|
@@ -205,28 +253,28 @@ Single searchable select (not a filter): `Combobox`.
|
|
|
205
253
|
|
|
206
254
|
## 8. Detail screens — `EntityDetailShell`
|
|
207
255
|
|
|
208
|
-
Every entity detail
|
|
209
|
-
|
|
210
|
-
|
|
256
|
+
Every entity detail uses the shell: back + centred title + description + actions, `EntityMetadata` (ID, Created,
|
|
257
|
+
Updated), centred segmented route tabs, loading and error. Full width (§ 10); the header is `DetailHeader`, `nested`
|
|
258
|
+
inside another shell.
|
|
211
259
|
|
|
212
260
|
```tsx
|
|
213
|
-
export const
|
|
261
|
+
export const ProjectShell = ({ projectId, children }: ProjectShellProps) => {
|
|
214
262
|
const pathname = usePathname();
|
|
215
|
-
const query =
|
|
216
|
-
const
|
|
263
|
+
const query = useProjectQuery(projectId);
|
|
264
|
+
const project = query.data?.project;
|
|
217
265
|
return (
|
|
218
266
|
<EntityDetailShell
|
|
219
|
-
title={
|
|
220
|
-
fallbackTitle={`
|
|
221
|
-
description={
|
|
222
|
-
back={{ href: '/
|
|
267
|
+
title={project?.name}
|
|
268
|
+
fallbackTitle={`Project #${projectId}`}
|
|
269
|
+
description={project?.workspace?.name}
|
|
270
|
+
back={{ href: '/projects', label: 'Back to projects' }}
|
|
223
271
|
linkComponent={Link}
|
|
224
|
-
metadata={{ id:
|
|
225
|
-
tabs={
|
|
272
|
+
metadata={{ id: project?.id, changeHistory: project?.changeHistory }}
|
|
273
|
+
tabs={PROJECT_TABS.map(tab => ({ id: tab.segment, label: tab.label, href: projectRoute(projectId, tab.segment) }))}
|
|
226
274
|
currentPath={pathname}
|
|
227
|
-
tabsLabel="
|
|
275
|
+
tabsLabel="Project sections"
|
|
228
276
|
isLoading={query.isLoading}
|
|
229
|
-
error={!query.isLoading && !
|
|
277
|
+
error={!query.isLoading && !project ? (query.isError ? 'This project could not be loaded.' : 'Project not found.') : undefined}
|
|
230
278
|
actions={<PageToolbar moreActions={…} />}
|
|
231
279
|
>
|
|
232
280
|
{children}
|
|
@@ -238,15 +286,15 @@ export const CampaignShell = ({ campaignId, children }: CampaignShellProps) => {
|
|
|
238
286
|
Inside a tab:
|
|
239
287
|
|
|
240
288
|
```tsx
|
|
241
|
-
<SectionHeader title="
|
|
242
|
-
tabs={[{ id: '
|
|
243
|
-
activeTab={tab} onTabSelect={setTab} actions={<ExportButton onExport={
|
|
289
|
+
<SectionHeader title="Members" description="People working on this project"
|
|
290
|
+
tabs={[{ id: 'people', label: 'People' }, { id: 'teams', label: 'Teams' }]}
|
|
291
|
+
activeTab={tab} onTabSelect={setTab} actions={<ExportButton onExport={exportMembers} />} />
|
|
244
292
|
|
|
245
293
|
<Card><CardContent>
|
|
246
294
|
<DefinitionList columns={3} items={[
|
|
247
|
-
{ label: 'Access Code', value:
|
|
248
|
-
{ label: 'Start', value: <DateCell value={
|
|
249
|
-
{ label: 'Description', value:
|
|
295
|
+
{ label: 'Access Code', value: workspace.accessCode },
|
|
296
|
+
{ label: 'Start', value: <DateCell value={workspace.startDate} format="date" /> },
|
|
297
|
+
{ label: 'Description', value: workspace.description, wide: true },
|
|
250
298
|
]} />
|
|
251
299
|
</CardContent></Card>
|
|
252
300
|
```
|
|
@@ -281,7 +329,7 @@ The look lives in the blocks; a screen never re-draws it.
|
|
|
281
329
|
- **Tabs** are the segmented pill control: `EntityDetailShell` centres them under the centred title; standalone tab
|
|
282
330
|
bars use `EntityTabs` as is; sub-tabs of a section are `SectionHeader tabs`
|
|
283
331
|
(compact). Never a hand-made underline or pill bar.
|
|
284
|
-
- **Two-tone titles**: wrap the brand part in `<em>` — `title={<>
|
|
332
|
+
- **Two-tone titles**: wrap the brand part in `<em>` — `title={<>Item <em>Types</em></>}` (pass `label="Item Types"` to
|
|
285
333
|
`EntityListPage` then). Only where a title earns it (Home, section headers), not on every list.
|
|
286
334
|
- **Sticky glass bars**: page forms get them from `FormActions` (`sticky={false}` inside a dialog); the bulk bar from
|
|
287
335
|
`EntityListBulkBar`.
|
|
@@ -293,8 +341,8 @@ The look lives in the blocks; a screen never re-draws it.
|
|
|
293
341
|
<CardGrid>
|
|
294
342
|
<EditableCard title="Access" onEdit={openAccessForm} editLabel="Edit access" editDisabled={!writesAllowed}>
|
|
295
343
|
<IconValueRow>
|
|
296
|
-
<IconValue icon={<KeyRound />}>{
|
|
297
|
-
<IconValue icon={<Calendar />}><DateCell value={
|
|
344
|
+
<IconValue icon={<KeyRound />}>{workspace.accessCode ?? <EmptyValue />}</IconValue>
|
|
345
|
+
<IconValue icon={<Calendar />}><DateCell value={workspace.startDate} format="date" /></IconValue>
|
|
298
346
|
</IconValueRow>
|
|
299
347
|
</EditableCard>
|
|
300
348
|
<EditableCard title="Languages" onEdit={openLanguagesForm} editLabel="Edit languages" editDisabled={!writesAllowed}>
|
|
@@ -329,10 +377,10 @@ Blocks in `glass/`.
|
|
|
329
377
|
</CollapsibleCard>
|
|
330
378
|
|
|
331
379
|
// A grouped to-do list on the clouds: glass group (no shadow) + solid rows.
|
|
332
|
-
<GlassGroup title="Running" count={cards.length} limit={8} emptyText="No
|
|
380
|
+
<GlassGroup title="Running" count={cards.length} limit={8} emptyText="No tasks">
|
|
333
381
|
{cards.map(card => (
|
|
334
382
|
<Link key={card.id} href={…}><ActionRow as="span" interactive title={card.name} description={card.context}
|
|
335
|
-
tone={
|
|
383
|
+
tone={TASK_STATUS[card.status].tone} toneLabel={TASK_STATUS[card.status].label} /></Link>
|
|
336
384
|
))}
|
|
337
385
|
</GlassGroup>
|
|
338
386
|
```
|
|
@@ -351,19 +399,19 @@ button).
|
|
|
351
399
|
// The list screen (inside <Suspense>): drawer state in the URL next to the filters — `?edit=<id>` / `?create=1`.
|
|
352
400
|
const drawer = useEntityDrawer({ adapter: useNextDrawerUrlAdapter() }); // ./next, or the host's own adapter
|
|
353
401
|
|
|
354
|
-
<AddEntityButton entity="
|
|
355
|
-
rowAction={
|
|
356
|
-
<Link href={
|
|
357
|
-
<
|
|
402
|
+
<AddEntityButton entity="Supplier" onClick={drawer.openCreate} disabled={!writesAllowed} />
|
|
403
|
+
rowAction={supplier => () => drawer.openEdit(id)}
|
|
404
|
+
<Link href={supplierEditRoute(id)} onClick={drawer.editLinkClick(id)}>{supplier.name}</Link> // middle click = new tab
|
|
405
|
+
<SupplierFormDrawer drawer={drawer} />
|
|
358
406
|
|
|
359
407
|
// The module's drawer: loads the entity for the header, renders the existing form inside.
|
|
360
408
|
const shown = drawer.shown; // stays set while the close animation runs
|
|
361
409
|
const id = shown?.mode === 'edit' ? shown.id : undefined;
|
|
362
410
|
const query = useGet…Query({ …, id: id ?? '' }, { skip: id === undefined });
|
|
363
|
-
const entity = id ? (query.currentData?.
|
|
364
|
-
<FormDrawer open={drawer.isOpen} onClose={drawer.close} title={entity?.name ?? `
|
|
411
|
+
const entity = id ? (query.currentData?.supplier ?? null) : null; // currentData: never the previous row's
|
|
412
|
+
<FormDrawer open={drawer.isOpen} onClose={drawer.close} title={entity?.name ?? `Supplier #${id}`}
|
|
365
413
|
metadata={entity ? { id: entity.id, changeHistory: entity.changeHistory } : undefined}>
|
|
366
|
-
<
|
|
414
|
+
<SupplierForm key={drawerKey(shown)} supplier={entity} onClose={drawer.close} />
|
|
367
415
|
</FormDrawer>
|
|
368
416
|
```
|
|
369
417
|
|
|
@@ -372,13 +420,13 @@ const entity = id ? (query.currentData?.sponsor ?? null) : null; // currentDat
|
|
|
372
420
|
`onClose()`. `FormActions` moves into the drawer's pinned footer by itself (change status left, buttons right); the
|
|
373
421
|
✕, Esc and an overlay click ask "Discard changes?" through `useUnsavedChangesGuard`. Request bodies stay as they are.
|
|
374
422
|
- **Header**: entity title + `EntityMetadata variant="inline"` (ID · Created · Updated, one line) via `metadata`;
|
|
375
|
-
create passes a `description` instead. Entity actions that are no save (e.g. "Open as
|
|
423
|
+
create passes a `description` instead. Entity actions that are no save (e.g. "Open as customer", "Reset password")
|
|
376
424
|
go into `headerActions` (outline `sm` buttons at the right end of the header); the save stays in the footer.
|
|
377
425
|
- **History**: opening pushes an entry (Back closes the drawer); `close()` pops it when this page opened the drawer and
|
|
378
426
|
removes the parameter otherwise (a link, a reload). A create that turns into the new entity's edit uses
|
|
379
427
|
`openEdit(newId, { replace: true })`. The writes are shallow (`history.pushState`): the list stays mounted.
|
|
380
428
|
- **Detail routes** (`/<entity>/:id`, `/create`) can stay as redirects to the list with the parameter. Route helpers
|
|
381
|
-
(`
|
|
429
|
+
(`supplierEditRoute`) live in a non-client file (a server page calls them).
|
|
382
430
|
- A list hosting two drawers passes its own `editKey` / `createKey`.
|
|
383
431
|
- **Confirm**: the drawer asks through the package dialog; a host with its own confirmation service passes
|
|
384
432
|
`confirm={hostConfirm}` (stable function, same Radix copy). The same prop exists on the translatable fields.
|
package/dist/components.css
CHANGED
|
@@ -127,6 +127,61 @@
|
|
|
127
127
|
backdrop-filter: blur(12px);
|
|
128
128
|
box-shadow: var(--surface-shadow);
|
|
129
129
|
}
|
|
130
|
+
/* A list table with column tracks (`EntityListColumn.width`): one CSS grid, every row a subgrid of it, so header and
|
|
131
|
+
body share the tracks. The table sets `grid-template-columns` (and its minimum width) inline; the header sticks as
|
|
132
|
+
a whole (a cell's containing block is now its row). Cells centre their content vertically, as table cells do. */
|
|
133
|
+
table[data-list-tracks] {
|
|
134
|
+
display: grid;
|
|
135
|
+
}
|
|
136
|
+
table[data-list-tracks] > :is(thead, tbody),
|
|
137
|
+
table[data-list-tracks] > :is(thead, tbody) > tr {
|
|
138
|
+
display: grid;
|
|
139
|
+
grid-column: 1 / -1;
|
|
140
|
+
grid-template-columns: subgrid;
|
|
141
|
+
}
|
|
142
|
+
table[data-list-tracks] > thead {
|
|
143
|
+
position: sticky;
|
|
144
|
+
top: 0;
|
|
145
|
+
z-index: var(--layer-raised);
|
|
146
|
+
}
|
|
147
|
+
table[data-list-tracks] > :is(thead, tbody) > tr > :is(th, td) {
|
|
148
|
+
display: flex;
|
|
149
|
+
align-items: center;
|
|
150
|
+
min-width: 0;
|
|
151
|
+
}
|
|
152
|
+
/* Pinned columns (`data-list-pin`, sticky offsets inline): while content scrolls under them they paint the card
|
|
153
|
+
surface (the row's tint on a selected or hovered row) and the innermost one draws the separating edge. The scroll
|
|
154
|
+
container carries `data-list-overflow-start` / `-end` while content is hidden past that edge. */
|
|
155
|
+
[data-list-overflow-start] tbody [data-list-pin='start'],
|
|
156
|
+
[data-list-overflow-end] tbody [data-list-pin='end'] {
|
|
157
|
+
background-color: --theme(--color-card);
|
|
158
|
+
}
|
|
159
|
+
[data-list-overflow-start] tbody tr:hover > [data-list-pin='start'],
|
|
160
|
+
[data-list-overflow-end] tbody tr:hover > [data-list-pin='end'] {
|
|
161
|
+
background-color: color-mix(in oklab, --theme(--color-muted) 50%, --theme(--color-card));
|
|
162
|
+
}
|
|
163
|
+
[data-list-overflow-start] tbody tr[data-state='selected'] > [data-list-pin='start'],
|
|
164
|
+
[data-list-overflow-end] tbody tr[data-state='selected'] > [data-list-pin='end'] {
|
|
165
|
+
background-color: --theme(--color-muted);
|
|
166
|
+
}
|
|
167
|
+
[data-list-overflow-start] [data-list-pin='start'][data-list-pin-edge]::after,
|
|
168
|
+
[data-list-overflow-end] [data-list-pin='end'][data-list-pin-edge]::before {
|
|
169
|
+
content: '';
|
|
170
|
+
position: absolute;
|
|
171
|
+
top: 0;
|
|
172
|
+
bottom: 0;
|
|
173
|
+
width: 1px;
|
|
174
|
+
pointer-events: none;
|
|
175
|
+
background-color: --theme(--color-border);
|
|
176
|
+
}
|
|
177
|
+
[data-list-overflow-start] [data-list-pin='start'][data-list-pin-edge]::after {
|
|
178
|
+
right: -1px;
|
|
179
|
+
box-shadow: 4px 0 8px color-mix(in oklab, --theme(--color-foreground) 8%, transparent);
|
|
180
|
+
}
|
|
181
|
+
[data-list-overflow-end] [data-list-pin='end'][data-list-pin-edge]::before {
|
|
182
|
+
left: -1px;
|
|
183
|
+
box-shadow: -4px 0 8px color-mix(in oklab, --theme(--color-foreground) 8%, transparent);
|
|
184
|
+
}
|
|
130
185
|
}
|
|
131
186
|
|
|
132
187
|
/* List cards: the toolbar and the filter panel sit straight on the page background — no card background, no rule;
|
package/dist/i18n/hints.json
CHANGED
|
@@ -126,5 +126,6 @@
|
|
|
126
126
|
"Wrong credentials.": "Error message on the login page when the e-mail address / username or the password is wrong.",
|
|
127
127
|
"Yes": "Option of a yes/no filter in the filter panel of a list; selecting it shows only records where the flag is set.",
|
|
128
128
|
"Yes__boolean-flag": "Default label of a yes/no flag cell in a list table, shown with a green check when the flag is on, e.g. Active column.",
|
|
129
|
-
"You have unsaved changes. Closing now will lose them.": "Body text of the discard confirmation dialog, warning that closing the form drawer throws away the user's unsaved edits."
|
|
129
|
+
"You have unsaved changes. Closing now will lose them.": "Body text of the discard confirmation dialog, warning that closing the form drawer throws away the user's unsaved edits.",
|
|
130
|
+
"Row number": "Screen-reader name of the narrow '#' column at the start of a list table that numbers the loaded rows 1, 2, 3 …"
|
|
130
131
|
}
|
package/dist/i18n/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { formatIcuPlural, isIcuPlural } from './plural.js';
|
|
2
|
-
export { getTranslationState, m, setTranslations, subscribeTranslations, type TranslateOptions, translateText, translationKeyOf, type WritingStyle, } from './store.js';
|
|
2
|
+
export { getTranslationState, m, type MarkOptions, setTranslations, subscribeTranslations, type TranslateOptions, translateText, translationKeyOf, type WritingStyle, } from './store.js';
|
|
3
3
|
export { Translate, type TranslateProps } from './Translate.js';
|
|
4
4
|
export { type TranslateFn, useTranslate } from './useTranslate.js';
|
|
5
5
|
export { formatUiNumber, getUiLocale, uiDateTimeFormat, uiNumberFormat, uiRelativeTimeFormat } from './format.js';
|
package/dist/i18n/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/i18n/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,EACL,mBAAmB,EACnB,CAAC,EACD,eAAe,EACf,qBAAqB,EACrB,KAAK,gBAAgB,EACrB,aAAa,EACb,gBAAgB,EAChB,KAAK,YAAY,GAClB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,SAAS,EAAE,KAAK,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjE,OAAO,EAAE,KAAK,WAAW,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,gBAAgB,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAClH,OAAO,EACL,yBAAyB,EACzB,KAAK,oBAAoB,EACzB,qBAAqB,EACrB,wBAAwB,EACxB,sBAAsB,GACvB,MAAM,qBAAqB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/i18n/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,EACL,mBAAmB,EACnB,CAAC,EACD,KAAK,WAAW,EAChB,eAAe,EACf,qBAAqB,EACrB,KAAK,gBAAgB,EACrB,aAAa,EACb,gBAAgB,EAChB,KAAK,YAAY,GAClB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,SAAS,EAAE,KAAK,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjE,OAAO,EAAE,KAAK,WAAW,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,gBAAgB,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAClH,OAAO,EACL,yBAAyB,EACzB,KAAK,oBAAoB,EACzB,qBAAqB,EACrB,wBAAwB,EACxB,sBAAsB,GACvB,MAAM,qBAAqB,CAAC"}
|
package/dist/i18n/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/i18n/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,EACL,mBAAmB,EACnB,CAAC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/i18n/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,EACL,mBAAmB,EACnB,CAAC,EAED,eAAe,EACf,qBAAqB,EAErB,aAAa,EACb,gBAAgB,GAEjB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,SAAS,EAAuB,MAAM,gBAAiB,CAAC;AACjE,OAAO,EAAoB,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,gBAAgB,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAClH,OAAO,EACL,yBAAyB,EAEzB,qBAAqB,EACrB,wBAAwB,EACxB,sBAAsB,GACvB,MAAM,qBAAqB,CAAC"}
|
package/dist/i18n/store.d.ts
CHANGED
|
@@ -27,10 +27,18 @@ export declare const setTranslations: (languageCode: string, writingStyle: Writi
|
|
|
27
27
|
export declare const translationKeyOf: (text: string, context?: string) => string;
|
|
28
28
|
/** Translates `text` in the active language (English text when no translation exists). */
|
|
29
29
|
export declare const translateText: (text: string, options?: TranslateOptions) => string;
|
|
30
|
+
/** Options of the `m()` marker: what text exports read next to the text. */
|
|
31
|
+
export interface MarkOptions {
|
|
32
|
+
/** The translation context the text is rendered with (key `<text>__<context>`). */
|
|
33
|
+
context?: string;
|
|
34
|
+
}
|
|
30
35
|
/**
|
|
31
36
|
* Marks an English UI text that is defined outside a component (status maps, column definitions, option lists) for
|
|
32
|
-
* the key export, unchanged. The component that renders it translates it with `t(value)
|
|
37
|
+
* the key export, unchanged. The component that renders it translates it with `t(value)`, or with
|
|
38
|
+
* `t(value, { context })` for a text marked `m('Failed', { context: 'import-status' })`. The marker returns the text
|
|
39
|
+
* only: the context reaches the renderer separately (e.g. `StatusDefinition.context`). Text exports read the text and
|
|
40
|
+
* the context as literals, so write both as string literals.
|
|
33
41
|
*/
|
|
34
|
-
export declare const m: <TText extends string>(text: TText) => TText;
|
|
42
|
+
export declare const m: <TText extends string>(text: TText, _options?: MarkOptions) => TText;
|
|
35
43
|
export {};
|
|
36
44
|
//# sourceMappingURL=store.d.ts.map
|
package/dist/i18n/store.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/i18n/store.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/i18n/store.ts"],"names":[],"mappings":"AAIA;;;;;GAKG;AAEH,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,UAAU,CAAC;AAEjD,MAAM,WAAW,gBAAgB;IAC/B,6GAA6G;IAC7G,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,+EAA+E;IAC/E,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,wCAAwC;IACxC,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC;CAChD;AAED,UAAU,gBAAgB;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,YAAY,CAAC;IAC3B,YAAY,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAC/C,OAAO,EAAE,MAAM,CAAC;CACjB;AASD,eAAO,MAAM,qBAAqB,GAAI,UAAU,MAAM,IAAI,KAAG,CAAC,MAAM,IAAI,CAGvE,CAAC;AAEF,eAAO,MAAM,mBAAmB,QAAO,gBAAyB,CAAC;AAEjE,6GAA6G;AAC7G,eAAO,MAAM,eAAe,GAC1B,cAAc,MAAM,EACpB,cAAc,YAAY,EAC1B,cAAc,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,KAC7C,IAGF,CAAC;AAEF,yDAAyD;AACzD,eAAO,MAAM,gBAAgB,GAAI,MAAM,MAAM,EAAE,UAAU,MAAM,KAAG,MAAkD,CAAC;AAOrH,0FAA0F;AAC1F,eAAO,MAAM,aAAa,GAAI,MAAM,MAAM,EAAE,UAAS,gBAAqB,KAAG,MAQ5E,CAAC;AAEF,4EAA4E;AAC5E,MAAM,WAAW,WAAW;IAC1B,mFAAmF;IACnF,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;GAMG;AACH,eAAO,MAAM,CAAC,GAAI,KAAK,SAAS,MAAM,EAAE,MAAM,KAAK,EAAE,WAAW,WAAW,KAAG,KAAa,CAAC"}
|
package/dist/i18n/store.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// @translations-ignore-file — the doc examples below are not UI texts
|
|
1
2
|
import { formatIcuPlural } from "./plural.js";
|
|
2
3
|
let state = { languageCode: 'en', writingStyle: 'FORMAL', translations: {}, version: 0 };
|
|
3
4
|
const listeners = new Set();
|
|
@@ -30,7 +31,10 @@ export const translateText = (text, options = {}) => {
|
|
|
30
31
|
};
|
|
31
32
|
/**
|
|
32
33
|
* Marks an English UI text that is defined outside a component (status maps, column definitions, option lists) for
|
|
33
|
-
* the key export, unchanged. The component that renders it translates it with `t(value)
|
|
34
|
+
* the key export, unchanged. The component that renders it translates it with `t(value)`, or with
|
|
35
|
+
* `t(value, { context })` for a text marked `m('Failed', { context: 'import-status' })`. The marker returns the text
|
|
36
|
+
* only: the context reaches the renderer separately (e.g. `StatusDefinition.context`). Text exports read the text and
|
|
37
|
+
* the context as literals, so write both as string literals.
|
|
34
38
|
*/
|
|
35
|
-
export const m = (text) => text;
|
|
39
|
+
export const m = (text, _options) => text;
|
|
36
40
|
//# sourceMappingURL=store.js.map
|