@mgamadeus/ddd-admin-ui 0.0.0-stage → 0.1.0-rc.1
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 +29 -0
- package/CHANGELOG.md +16 -0
- package/LICENSE +21 -0
- package/README.md +131 -2
- package/dist/cli/ddd-admin-ui.d.ts +3 -0
- package/dist/cli/ddd-admin-ui.d.ts.map +1 -0
- package/dist/cli/ddd-admin-ui.js +18 -0
- package/dist/cli/ddd-admin-ui.js.map +1 -0
- package/dist/cli/linkSkills.d.ts +25 -0
- package/dist/cli/linkSkills.d.ts.map +1 -0
- package/dist/cli/linkSkills.js +76 -0
- package/dist/cli/linkSkills.js.map +1 -0
- package/dist/components.css +42 -0
- package/dist/data/StatTile.d.ts +8 -0
- package/dist/data/StatTile.d.ts.map +1 -0
- package/dist/data/StatTile.js +6 -0
- package/dist/data/StatTile.js.map +1 -0
- package/dist/data/index.d.ts +2 -0
- package/dist/data/index.d.ts.map +1 -0
- package/dist/data/index.js +2 -0
- package/dist/data/index.js.map +1 -0
- package/dist/form/Form.d.ts +13 -0
- package/dist/form/Form.d.ts.map +1 -0
- package/dist/form/Form.js +11 -0
- package/dist/form/Form.js.map +1 -0
- package/dist/form/fieldLabels.d.ts +10 -0
- package/dist/form/fieldLabels.d.ts.map +1 -0
- package/dist/form/fieldLabels.js +8 -0
- package/dist/form/fieldLabels.js.map +1 -0
- package/dist/form/index.d.ts +3 -0
- package/dist/form/index.d.ts.map +1 -0
- package/dist/form/index.js +3 -0
- package/dist/form/index.js.map +1 -0
- package/dist/glass/GlassPanel.d.ts +7 -0
- package/dist/glass/GlassPanel.d.ts.map +1 -0
- package/dist/glass/GlassPanel.js +5 -0
- package/dist/glass/GlassPanel.js.map +1 -0
- package/dist/glass/index.d.ts +2 -0
- package/dist/glass/index.d.ts.map +1 -0
- package/dist/glass/index.js +2 -0
- package/dist/glass/index.js.map +1 -0
- package/dist/i18n/Translate.d.ts +7 -0
- package/dist/i18n/Translate.d.ts.map +1 -0
- package/dist/i18n/Translate.js +9 -0
- package/dist/i18n/Translate.js.map +1 -0
- package/dist/i18n/index.d.ts +5 -0
- package/dist/i18n/index.d.ts.map +1 -0
- package/dist/i18n/index.js +5 -0
- package/dist/i18n/index.js.map +1 -0
- package/dist/i18n/m.d.ts +7 -0
- package/dist/i18n/m.d.ts.map +1 -0
- package/dist/i18n/m.js +7 -0
- package/dist/i18n/m.js.map +1 -0
- package/dist/i18n/store.d.ts +24 -0
- package/dist/i18n/store.d.ts.map +1 -0
- package/dist/i18n/store.js +30 -0
- package/dist/i18n/store.js.map +1 -0
- package/dist/i18n/useTranslate.d.ts +9 -0
- package/dist/i18n/useTranslate.d.ts.map +1 -0
- package/dist/i18n/useTranslate.js +12 -0
- package/dist/i18n/useTranslate.js.map +1 -0
- package/dist/i18n-keys.json +32 -0
- package/dist/list/ClearFiltersButton.d.ts +7 -0
- package/dist/list/ClearFiltersButton.d.ts.map +1 -0
- package/dist/list/ClearFiltersButton.js +10 -0
- package/dist/list/ClearFiltersButton.js.map +1 -0
- package/dist/list/DateCell.d.ts +8 -0
- package/dist/list/DateCell.d.ts.map +1 -0
- package/dist/list/DateCell.js +12 -0
- package/dist/list/DateCell.js.map +1 -0
- package/dist/list/index.d.ts +3 -0
- package/dist/list/index.d.ts.map +1 -0
- package/dist/list/index.js +3 -0
- package/dist/list/index.js.map +1 -0
- package/dist/logic/index.d.ts +6 -0
- package/dist/logic/index.d.ts.map +1 -0
- package/dist/logic/index.js +6 -0
- package/dist/logic/index.js.map +1 -0
- package/dist/logic/pure/errors.d.ts +3 -0
- package/dist/logic/pure/errors.d.ts.map +1 -0
- package/dist/logic/pure/errors.js +5 -0
- package/dist/logic/pure/errors.js.map +1 -0
- package/dist/logic/pure/format.d.ts +15 -0
- package/dist/logic/pure/format.d.ts.map +1 -0
- package/dist/logic/pure/format.js +32 -0
- package/dist/logic/pure/format.js.map +1 -0
- package/dist/logic/pure/notify.d.ts +19 -0
- package/dist/logic/pure/notify.d.ts.map +1 -0
- package/dist/logic/pure/notify.js +33 -0
- package/dist/logic/pure/notify.js.map +1 -0
- package/dist/logic/pure/statusMap.d.ts +12 -0
- package/dist/logic/pure/statusMap.d.ts.map +1 -0
- package/dist/logic/pure/statusMap.js +5 -0
- package/dist/logic/pure/statusMap.js.map +1 -0
- package/dist/logic/react/useToggle.d.ts +8 -0
- package/dist/logic/react/useToggle.d.ts.map +1 -0
- package/dist/logic/react/useToggle.js +9 -0
- package/dist/logic/react/useToggle.js.map +1 -0
- package/dist/media/MediaItemField.d.ts +6 -0
- package/dist/media/MediaItemField.d.ts.map +1 -0
- package/dist/media/MediaItemField.js +11 -0
- package/dist/media/MediaItemField.js.map +1 -0
- package/dist/media/index.d.ts +3 -0
- package/dist/media/index.d.ts.map +1 -0
- package/dist/media/index.js +2 -0
- package/dist/media/index.js.map +1 -0
- package/dist/media/types.d.ts +7 -0
- package/dist/media/types.d.ts.map +1 -0
- package/dist/media/types.js +2 -0
- package/dist/media/types.js.map +1 -0
- package/dist/next/index.d.ts +3 -0
- package/dist/next/index.d.ts.map +1 -0
- package/dist/next/index.js +3 -0
- package/dist/next/index.js.map +1 -0
- package/dist/next/searchParamsWriter.d.ts +7 -0
- package/dist/next/searchParamsWriter.d.ts.map +1 -0
- package/dist/next/searchParamsWriter.js +34 -0
- package/dist/next/searchParamsWriter.js.map +1 -0
- package/dist/next/useNextSearchParam.d.ts +3 -0
- package/dist/next/useNextSearchParam.d.ts.map +1 -0
- package/dist/next/useNextSearchParam.js +16 -0
- package/dist/next/useNextSearchParam.js.map +1 -0
- package/dist/notify-sonner/index.d.ts +2 -0
- package/dist/notify-sonner/index.d.ts.map +1 -0
- package/dist/notify-sonner/index.js +2 -0
- package/dist/notify-sonner/index.js.map +1 -0
- package/dist/notify-sonner/sonnerNotifications.d.ts +4 -0
- package/dist/notify-sonner/sonnerNotifications.d.ts.map +1 -0
- package/dist/notify-sonner/sonnerNotifications.js +12 -0
- package/dist/notify-sonner/sonnerNotifications.js.map +1 -0
- package/dist/page/PageFrame.d.ts +9 -0
- package/dist/page/PageFrame.d.ts.map +1 -0
- package/dist/page/PageFrame.js +5 -0
- package/dist/page/PageFrame.js.map +1 -0
- package/dist/page/index.d.ts +2 -0
- package/dist/page/index.d.ts.map +1 -0
- package/dist/page/index.js +2 -0
- package/dist/page/index.js.map +1 -0
- package/dist/primitives/button.d.ts +10 -0
- package/dist/primitives/button.d.ts.map +1 -0
- package/dist/primitives/button.js +20 -0
- package/dist/primitives/button.js.map +1 -0
- package/dist/primitives/cn.d.ts +4 -0
- package/dist/primitives/cn.d.ts.map +1 -0
- package/dist/primitives/cn.js +5 -0
- package/dist/primitives/cn.js.map +1 -0
- package/dist/primitives/dialog.d.ts +10 -0
- package/dist/primitives/dialog.d.ts.map +1 -0
- package/dist/primitives/dialog.js +19 -0
- package/dist/primitives/dialog.js.map +1 -0
- package/dist/primitives/index.d.ts +7 -0
- package/dist/primitives/index.d.ts.map +1 -0
- package/dist/primitives/index.js +7 -0
- package/dist/primitives/index.js.map +1 -0
- package/dist/primitives/portalContainer.d.ts +8 -0
- package/dist/primitives/portalContainer.d.ts.map +1 -0
- package/dist/primitives/portalContainer.js +12 -0
- package/dist/primitives/portalContainer.js.map +1 -0
- package/dist/primitives/select.d.ts +9 -0
- package/dist/primitives/select.d.ts.map +1 -0
- package/dist/primitives/select.js +16 -0
- package/dist/primitives/select.js.map +1 -0
- package/dist/primitives/sheet.d.ts +9 -0
- package/dist/primitives/sheet.d.ts.map +1 -0
- package/dist/primitives/sheet.js +15 -0
- package/dist/primitives/sheet.js.map +1 -0
- package/dist/provider/AdminUiProvider.d.ts +7 -0
- package/dist/provider/AdminUiProvider.d.ts.map +1 -0
- package/dist/provider/AdminUiProvider.js +32 -0
- package/dist/provider/AdminUiProvider.js.map +1 -0
- package/dist/provider/index.d.ts +3 -0
- package/dist/provider/index.d.ts.map +1 -0
- package/dist/provider/index.js +2 -0
- package/dist/provider/index.js.map +1 -0
- package/dist/provider/types.d.ts +33 -0
- package/dist/provider/types.d.ts.map +1 -0
- package/dist/provider/types.js +2 -0
- package/dist/provider/types.js.map +1 -0
- package/dist/theme.css +44 -0
- package/dist/tokens.json +66 -0
- package/dist/translations/TranslatableInputField.d.ts +8 -0
- package/dist/translations/TranslatableInputField.d.ts.map +1 -0
- package/dist/translations/TranslatableInputField.js +12 -0
- package/dist/translations/TranslatableInputField.js.map +1 -0
- package/dist/translations/index.d.ts +2 -0
- package/dist/translations/index.d.ts.map +1 -0
- package/dist/translations/index.js +2 -0
- package/dist/translations/index.js.map +1 -0
- package/docs/README.md +11 -0
- package/package.json +158 -3
- package/scripts/check-tokens.mjs +136 -0
- package/scripts/lib/i18n-manifest.mjs +91 -0
- package/scripts/lib/source-scan.mjs +258 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ddd-admin-ui-specialist
|
|
3
|
+
description: "Build admin screens with @mgamadeus/ddd-admin-ui (React 19, Next 16, Tailwind 4, mgamadeus/ddd backends): which entry to import from (./logic, ./i18n, ./primitives, ./list, ./page, ./form, ./translations, ./media, ./glass, ./data, ./next, ./provider, ./notify-sonner), server-safe helpers versus 'use client' files, the stylesheets theme.css and components.css, the CSS contract in tokens.json (colour roles, custom properties, layer scale), AdminUiProvider and its adapters, translations with m() and i18n-keys.json, and check-tokens for a host's built CSS. Use when adding or changing an admin screen, wiring the package into a host, choosing an import path, fixing missing styles, overlays below a host dialog, untranslated block texts, or a server component that imports a client file."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# ddd-admin-ui-specialist
|
|
7
|
+
|
|
8
|
+
Skeleton: the package is a scaffold with sample source. The sections below are filled when the blocks arrive.
|
|
9
|
+
|
|
10
|
+
## Entries and import rules
|
|
11
|
+
|
|
12
|
+
- Import from the entry, never from a file inside `dist`.
|
|
13
|
+
- `./logic` and `./i18n` run without Tailwind, Radix, icons and Next; server components may call `m()`, the formats
|
|
14
|
+
and the status maps.
|
|
15
|
+
- `./next` is the only entry that needs `next`; `./notify-sonner` the only one that needs `sonner`.
|
|
16
|
+
|
|
17
|
+
## Host setup
|
|
18
|
+
|
|
19
|
+
1. `@import 'tailwindcss';`, then `theme.css` (when the host declares complete colours under the role names), then
|
|
20
|
+
`components.css`.
|
|
21
|
+
2. Declare every colour and property of `tokens.json` on `:root`, and the themed ones under `.dark`.
|
|
22
|
+
3. Wrap the app in `AdminUiProvider` (a client component) with the host's adapters.
|
|
23
|
+
4. Run `node node_modules/@mgamadeus/ddd-admin-ui/scripts/check-tokens.mjs <built css…>` after a production build.
|
|
24
|
+
|
|
25
|
+
## Translations
|
|
26
|
+
|
|
27
|
+
- Texts of the package go through its store; the host feeds it (`setTranslations` or the provider's `translations`
|
|
28
|
+
adapter).
|
|
29
|
+
- `i18n-keys.json` lists them for the host's translation export.
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to `@mgamadeus/ddd-admin-ui`. 0.x: each minor may break; depend on it with `">=0.N <1"`.
|
|
4
|
+
|
|
5
|
+
## 0.1.0-rc.1
|
|
6
|
+
|
|
7
|
+
- First published version of the scaffold (the content of 0.1.0-rc.0).
|
|
8
|
+
- Release step: the version is part of `i18n-keys.json`, so a version bump is followed by `pnpm i18n:manifest`
|
|
9
|
+
before the commit; the release checks refuse a stale manifest.
|
|
10
|
+
|
|
11
|
+
## 0.1.0-rc.0 (tagged, not published: its manifest named the former version)
|
|
12
|
+
|
|
13
|
+
- Repository scaffold: unbundled `tsc` build with per-file `'use client'` directives, `check-package` (13 rules, a
|
|
14
|
+
failing fixture per rule), `check-tokens` for hosts, the i18n key manifest, consumer tests (Next 16 build,
|
|
15
|
+
hydration, overlays, CSS, optional peers, strict type checks), CI and the tag release workflow, and the
|
|
16
|
+
`ddd-admin-ui link-skills` command. Sample source only.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 ddd-framework
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,132 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @mgamadeus/ddd-admin-ui
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Admin UI building blocks for React 19 / Next 16 / Tailwind 4 apps built on the
|
|
4
|
+
[`mgamadeus/ddd`](https://github.com/ddd-framework/ddd) framework: pure helpers and React hooks, shadcn-style
|
|
5
|
+
primitives, list / page / form / translation / media / glass blocks, Next adapters, a provider, two stylesheets and two
|
|
6
|
+
JSON manifests.
|
|
7
|
+
|
|
8
|
+
> **Status: scaffold.** The build, the package checks, the consumer tests and the release workflow are in place; the
|
|
9
|
+
> source is a small set of samples that exercises every rule. The real blocks follow. Nothing is published yet.
|
|
10
|
+
|
|
11
|
+
## Entries
|
|
12
|
+
|
|
13
|
+
| Entry | Content | Runs without |
|
|
14
|
+
|---|---|---|
|
|
15
|
+
| `./logic` | pure helpers (formats, status maps, `notify`, error messages) and React hooks | Tailwind, Radix, icons, Next |
|
|
16
|
+
| `./i18n` | the translation store (one per app), `m()`, `useTranslate`, `<Translate>` | Tailwind, Radix, icons, Next |
|
|
17
|
+
| `./primitives` | shadcn-style components on Radix (button, dialog, sheet, select, …), `cn` | Next |
|
|
18
|
+
| `./list`, `./page`, `./form`, `./translations`, `./media`, `./glass`, `./data` | blocks | Next |
|
|
19
|
+
| `./next` | Next adapters: the one URL write queue and URL-state hooks | — (needs `next`) |
|
|
20
|
+
| `./provider` | `AdminUiProvider`, `useAdminUi` and the adapter types | Next |
|
|
21
|
+
| `./notify-sonner` | the notification adapter for sonner | — (needs `sonner`) |
|
|
22
|
+
| `./theme.css` | binds the colour roles of `tokens.json` as Tailwind theme colours | |
|
|
23
|
+
| `./components.css` | structure the blocks rely on: surfaces, title utilities, data-attribute rules, the layer scale | |
|
|
24
|
+
| `./tokens.json` | the CSS contract: colour roles, custom properties, layers, data attributes | |
|
|
25
|
+
| `./i18n-keys.json` | every text the package translates, with context and hint | |
|
|
26
|
+
|
|
27
|
+
ESM only. Every file keeps its own `'use client'` directive: files with hooks, contexts or `react-dom` carry it, pure
|
|
28
|
+
files do not, so server components can call `m()`, the formats and the status maps directly.
|
|
29
|
+
|
|
30
|
+
Allowed imports between entries (run time): `logic → i18n`; `primitives → i18n`; `list → logic, i18n, primitives`;
|
|
31
|
+
`page → list, logic, i18n, primitives`; `form → page, logic, i18n, primitives`; `translations → form, logic, i18n,
|
|
32
|
+
primitives`; `media → list, form, logic, i18n, primitives`; `glass`, `data`, `provider → logic, i18n, primitives`;
|
|
33
|
+
`next → logic, provider`; `notify-sonner → logic`.
|
|
34
|
+
|
|
35
|
+
## Install
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
pnpm add @mgamadeus/ddd-admin-ui @mgamadeus/ddd-web react react-dom lucide-react react-hook-form zod
|
|
39
|
+
# optional, per entry: next (./next), sonner (./notify-sonner), recharts (chart files of ./data)
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
| Peer | Range |
|
|
43
|
+
|---|---|
|
|
44
|
+
| `react`, `react-dom` | `^19.0.0` |
|
|
45
|
+
| `@mgamadeus/ddd-web` | `>=0.13.0 <1.0.0` |
|
|
46
|
+
| `lucide-react` | `>=0.550.0 <2` |
|
|
47
|
+
| `react-hook-form` | `^7.65.0` |
|
|
48
|
+
| `zod` | `^4.0.0` |
|
|
49
|
+
| `next` (optional) | `^16.0.0` |
|
|
50
|
+
| `sonner` (optional) | `^2.0.0` |
|
|
51
|
+
| `recharts` (optional) | `^3.0.0` |
|
|
52
|
+
| `tailwindcss` (optional, host requirement) | `^4.1.0` |
|
|
53
|
+
|
|
54
|
+
## Stylesheets
|
|
55
|
+
|
|
56
|
+
```css
|
|
57
|
+
@import 'tailwindcss';
|
|
58
|
+
@import '@mgamadeus/ddd-admin-ui/theme.css'; /* hosts that declare complete colours under the role names */
|
|
59
|
+
@import '@mgamadeus/ddd-admin-ui/components.css'; /* always */
|
|
60
|
+
|
|
61
|
+
:root {
|
|
62
|
+
--card: #ffffff;
|
|
63
|
+
--nav-h: 4rem;
|
|
64
|
+
/* … every colour and property of tokens.json */
|
|
65
|
+
}
|
|
66
|
+
.dark {
|
|
67
|
+
--card: #111827;
|
|
68
|
+
/* … every themed entry */
|
|
69
|
+
}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
`components.css` carries `@source "./";`, so the host's Tailwind scans the package's built files for class names.
|
|
73
|
+
Colours are complete CSS colours (`#fff`, `oklch(…)`, `hsl(0 0% 100%)`), not bare channels. Layers
|
|
74
|
+
(`--layer-overlay`, `--layer-popover`, …) default to Tailwind's `z-50` scale and can be raised by the host.
|
|
75
|
+
|
|
76
|
+
Check a host's built CSS against the package:
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
node node_modules/@mgamadeus/ddd-admin-ui/scripts/check-tokens.mjs .next/static/css/*.css
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Provider
|
|
83
|
+
|
|
84
|
+
```tsx
|
|
85
|
+
'use client';
|
|
86
|
+
import { AdminUiProvider } from '@mgamadeus/ddd-admin-ui/provider';
|
|
87
|
+
import { sonnerNotifications } from '@mgamadeus/ddd-admin-ui/notify-sonner';
|
|
88
|
+
|
|
89
|
+
export const Providers = ({ children }: { children: React.ReactNode }) => (
|
|
90
|
+
<AdminUiProvider notifications={sonnerNotifications}>{children}</AdminUiProvider>
|
|
91
|
+
);
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Translations
|
|
95
|
+
|
|
96
|
+
The package translates its own texts through its store (`setTranslations` from `./i18n`, or a `translations` adapter
|
|
97
|
+
on the provider). `i18n-keys.json` lists every such text (`key` = text or `text__context`, `hint`, `files`), so a
|
|
98
|
+
host's translation export can merge them with its own keys.
|
|
99
|
+
|
|
100
|
+
## Agent skill
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
npx ddd-admin-ui link-skills # or: pnpm exec ddd-admin-ui link-skills
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
Symlinks the skills shipped in `.claude/skills/` of the installed package into the project's `.claude/skills/`.
|
|
107
|
+
Idempotent; repoints an existing symlink, never touches a real file or directory.
|
|
108
|
+
|
|
109
|
+
## Versioning
|
|
110
|
+
|
|
111
|
+
0.x: each minor may break. Depend on it with an explicit range, `">=0.N <1"`, never a caret on 0.x. Pre-releases
|
|
112
|
+
(`x.y.z-…`) are published under the `next` dist-tag. Changes per release: [CHANGELOG.md](CHANGELOG.md).
|
|
113
|
+
|
|
114
|
+
## Development
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
pnpm install
|
|
118
|
+
pnpm typecheck
|
|
119
|
+
pnpm test # unit tests and the check-package rules (node --test)
|
|
120
|
+
pnpm i18n:manifest # after changing a translated text or the version
|
|
121
|
+
pnpm build # tsc → dist, declaration specifiers, stylesheets and manifests
|
|
122
|
+
node scripts/check-package.mjs .
|
|
123
|
+
pnpm pack --pack-destination "$TMPDIR" && test/consumer/run.sh "$TMPDIR"/mgamadeus-ddd-admin-ui-*.tgz pnpm "$TMPDIR/consumer-pnpm"
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
Source files import each other with explicit `.ts` / `.tsx` extensions and never through a directory.
|
|
127
|
+
`scripts/check-package.mjs` lists its rules at the top of the file. `CHECK_PACKAGE_DENY` (comma-separated) adds words
|
|
128
|
+
that must not appear in shipped files.
|
|
129
|
+
|
|
130
|
+
## License
|
|
131
|
+
|
|
132
|
+
MIT
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ddd-admin-ui.d.ts","sourceRoot":"","sources":["../../src/cli/ddd-admin-ui.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { linkSkills } from "./linkSkills.js";
|
|
3
|
+
const HELP = `Usage:
|
|
4
|
+
ddd-admin-ui link-skills Symlink the package's agent skills into .claude/skills/
|
|
5
|
+
ddd-admin-ui help Show this help
|
|
6
|
+
`;
|
|
7
|
+
const [command] = process.argv.slice(2);
|
|
8
|
+
if (command === 'link-skills') {
|
|
9
|
+
linkSkills();
|
|
10
|
+
}
|
|
11
|
+
else if (command === undefined || command === 'help' || command === '--help' || command === '-h') {
|
|
12
|
+
process.stdout.write(HELP);
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
process.stderr.write(`Unknown command: ${command}\n\n${HELP}`);
|
|
16
|
+
process.exitCode = 1;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=ddd-admin-ui.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ddd-admin-ui.js","sourceRoot":"","sources":["../../src/cli/ddd-admin-ui.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,MAAM,IAAI,GAAG;;;CAGZ,CAAC;AAEF,MAAM,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AACxC,IAAI,OAAO,KAAK,aAAa,EAAE,CAAC;IAC9B,UAAU,EAAE,CAAC;AACf,CAAC;KAAM,IAAI,OAAO,KAAK,SAAS,IAAI,OAAO,KAAK,MAAM,IAAI,OAAO,KAAK,QAAQ,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;IACnG,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;AAC7B,CAAC;KAAM,CAAC;IACN,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,oBAAoB,OAAO,OAAO,IAAI,EAAE,CAAC,CAAC;IAC/D,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;AACvB,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export declare const PACKAGE_NAME = "@mgamadeus/ddd-admin-ui";
|
|
2
|
+
export interface Logger {
|
|
3
|
+
info(message: string): void;
|
|
4
|
+
warn(message: string): void;
|
|
5
|
+
}
|
|
6
|
+
export declare const consoleLogger: Logger;
|
|
7
|
+
export interface LinkSkillsOptions {
|
|
8
|
+
cwd?: string;
|
|
9
|
+
/** Directory holding the package's skills. Default `<cwd>/node_modules/@mgamadeus/ddd-admin-ui/.claude/skills`. */
|
|
10
|
+
sourceDir?: string;
|
|
11
|
+
logger?: Logger;
|
|
12
|
+
}
|
|
13
|
+
export type LinkSkillAction = 'linked' | 'relinked' | 'unchanged' | 'skipped';
|
|
14
|
+
export interface LinkSkillsResult {
|
|
15
|
+
skill: string;
|
|
16
|
+
action: LinkSkillAction;
|
|
17
|
+
target: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Symlinks every skill directory of the installed package into `<cwd>/.claude/skills/`. Idempotent; an existing
|
|
21
|
+
* symlink is repointed, a real file or directory is never touched. A package version that ships no skills, or a
|
|
22
|
+
* missing package, is reported (nothing is created).
|
|
23
|
+
*/
|
|
24
|
+
export declare const linkSkills: (options?: LinkSkillsOptions) => LinkSkillsResult[];
|
|
25
|
+
//# sourceMappingURL=linkSkills.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"linkSkills.d.ts","sourceRoot":"","sources":["../../src/cli/linkSkills.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,YAAY,4BAA4B,CAAC;AAEtD,MAAM,WAAW,MAAM;IACrB,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B;AAID,eAAO,MAAM,aAAa,EAAE,MAG3B,CAAC;AAEF,MAAM,WAAW,iBAAiB;IAChC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,mHAAmH;IACnH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,MAAM,eAAe,GAAG,QAAQ,GAAG,UAAU,GAAG,WAAW,GAAG,SAAS,CAAC;AAE9E,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,eAAe,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;CAChB;AAiBD;;;;GAIG;AACH,eAAO,MAAM,UAAU,GAAI,UAAS,iBAAsB,KAAG,gBAAgB,EA2C5E,CAAC"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import * as fs from 'node:fs';
|
|
2
|
+
import * as path from 'node:path';
|
|
3
|
+
export const PACKAGE_NAME = '@mgamadeus/ddd-admin-ui';
|
|
4
|
+
const PREFIX = '[ddd-admin-ui]';
|
|
5
|
+
export const consoleLogger = {
|
|
6
|
+
info: (message) => console.log(`${PREFIX} ${message}`),
|
|
7
|
+
warn: (message) => console.warn(`${PREFIX} ${message}`),
|
|
8
|
+
};
|
|
9
|
+
/** `@mgamadeus/ddd-admin-ui <version>` of the installed package, or the bare name when the version is unknown. */
|
|
10
|
+
const packageLabel = (packageDir) => {
|
|
11
|
+
if (packageDir) {
|
|
12
|
+
try {
|
|
13
|
+
const manifest = JSON.parse(fs.readFileSync(path.join(packageDir, 'package.json'), 'utf-8'));
|
|
14
|
+
if (typeof manifest.version === 'string')
|
|
15
|
+
return `${PACKAGE_NAME} ${manifest.version}`;
|
|
16
|
+
}
|
|
17
|
+
catch {
|
|
18
|
+
// no readable manifest: fall back to the bare name
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return PACKAGE_NAME;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Symlinks every skill directory of the installed package into `<cwd>/.claude/skills/`. Idempotent; an existing
|
|
25
|
+
* symlink is repointed, a real file or directory is never touched. A package version that ships no skills, or a
|
|
26
|
+
* missing package, is reported (nothing is created).
|
|
27
|
+
*/
|
|
28
|
+
export const linkSkills = (options = {}) => {
|
|
29
|
+
const cwd = path.resolve(options.cwd ?? process.cwd());
|
|
30
|
+
const logger = options.logger ?? consoleLogger;
|
|
31
|
+
const packageDir = path.join(cwd, 'node_modules', ...PACKAGE_NAME.split('/'));
|
|
32
|
+
const sourceDir = options.sourceDir ? path.resolve(cwd, options.sourceDir) : path.join(packageDir, '.claude', 'skills');
|
|
33
|
+
if (!options.sourceDir && !fs.existsSync(packageDir)) {
|
|
34
|
+
logger.warn(`${PACKAGE_NAME} is not installed in ${cwd} (no ${packageDir}) — nothing to link.`);
|
|
35
|
+
return [];
|
|
36
|
+
}
|
|
37
|
+
const skills = fs.existsSync(sourceDir)
|
|
38
|
+
? fs.readdirSync(sourceDir, { withFileTypes: true }).filter((entry) => entry.isDirectory() || entry.isSymbolicLink())
|
|
39
|
+
: [];
|
|
40
|
+
if (skills.length === 0) {
|
|
41
|
+
logger.info(`${packageLabel(options.sourceDir ? undefined : packageDir)} ships no agent skills (${sourceDir}) — nothing to link.`);
|
|
42
|
+
return [];
|
|
43
|
+
}
|
|
44
|
+
const targetDir = path.join(cwd, '.claude', 'skills');
|
|
45
|
+
fs.mkdirSync(targetDir, { recursive: true });
|
|
46
|
+
const results = [];
|
|
47
|
+
for (const entry of skills) {
|
|
48
|
+
const linkPath = path.join(targetDir, entry.name);
|
|
49
|
+
const linkTarget = path.relative(targetDir, path.join(sourceDir, entry.name));
|
|
50
|
+
let action;
|
|
51
|
+
const existing = fs.lstatSync(linkPath, { throwIfNoEntry: false });
|
|
52
|
+
if (!existing) {
|
|
53
|
+
fs.symlinkSync(linkTarget, linkPath, 'dir');
|
|
54
|
+
action = 'linked';
|
|
55
|
+
}
|
|
56
|
+
else if (!existing.isSymbolicLink()) {
|
|
57
|
+
action = 'skipped';
|
|
58
|
+
}
|
|
59
|
+
else if (fs.readlinkSync(linkPath) === linkTarget) {
|
|
60
|
+
action = 'unchanged';
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
fs.unlinkSync(linkPath);
|
|
64
|
+
fs.symlinkSync(linkTarget, linkPath, 'dir');
|
|
65
|
+
action = 'relinked';
|
|
66
|
+
}
|
|
67
|
+
const message = `${action.padEnd(9)} .claude/skills/${entry.name} → ${linkTarget}`;
|
|
68
|
+
if (action === 'skipped')
|
|
69
|
+
logger.warn(`${message} (exists and is not a symlink — left as is)`);
|
|
70
|
+
else
|
|
71
|
+
logger.info(message);
|
|
72
|
+
results.push({ skill: entry.name, action, target: linkTarget });
|
|
73
|
+
}
|
|
74
|
+
return results;
|
|
75
|
+
};
|
|
76
|
+
//# sourceMappingURL=linkSkills.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"linkSkills.js","sourceRoot":"","sources":["../../src/cli/linkSkills.ts"],"names":[],"mappings":"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AAO,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC,CAAC;IAClE,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @mgamadeus/ddd-admin-ui — structure the blocks rely on.
|
|
3
|
+
* Colours are read only through the host's Tailwind theme (--theme(--color-…)), never through bare role variables;
|
|
4
|
+
* layout values and alphas are plain custom properties the host sets (see tokens.json).
|
|
5
|
+
* Import after `@import "tailwindcss";` (and after theme.css when the host uses it).
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/* Lets the host's Tailwind scan this package's built files for class names. */
|
|
9
|
+
@source "./";
|
|
10
|
+
|
|
11
|
+
/* Layer scale: defaults with zero specificity, so any host value wins. */
|
|
12
|
+
:where(:root) {
|
|
13
|
+
--layer-raised: 10;
|
|
14
|
+
--layer-sticky: 20;
|
|
15
|
+
--layer-overlay: 50;
|
|
16
|
+
--layer-popover: 50;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
@utility text-title-page {
|
|
20
|
+
font-size: 1.5rem;
|
|
21
|
+
line-height: 2rem;
|
|
22
|
+
font-weight: 600;
|
|
23
|
+
letter-spacing: -0.01em;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
@layer components {
|
|
27
|
+
.surface {
|
|
28
|
+
background-color: color-mix(in oklab, --theme(--color-card) var(--surface-alpha), transparent);
|
|
29
|
+
box-shadow: var(--surface-shadow);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.surface-glass {
|
|
33
|
+
background-color: color-mix(in oklab, --theme(--color-card) var(--surface-glass-alpha), transparent);
|
|
34
|
+
box-shadow: var(--glass-shadow);
|
|
35
|
+
backdrop-filter: blur(12px);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/* Form actions render first, above the fields. */
|
|
39
|
+
form > [data-form-actions] {
|
|
40
|
+
order: -1;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export interface StatTileProps {
|
|
2
|
+
label: string;
|
|
3
|
+
value: number;
|
|
4
|
+
className?: string;
|
|
5
|
+
}
|
|
6
|
+
/** One key figure. Presentation only; data and polling stay with the caller. */
|
|
7
|
+
export declare const StatTile: ({ label, value, className }: StatTileProps) => import("react").JSX.Element;
|
|
8
|
+
//# sourceMappingURL=StatTile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StatTile.d.ts","sourceRoot":"","sources":["../../src/data/StatTile.tsx"],"names":[],"mappings":"AAGA,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,gFAAgF;AAChF,eAAO,MAAM,QAAQ,GAAI,6BAA6B,aAAa,gCAKlE,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { formatUiNumber } from "../logic/pure/format.js";
|
|
3
|
+
import { cn } from "../primitives/cn.js";
|
|
4
|
+
/** One key figure. Presentation only; data and polling stay with the caller. */
|
|
5
|
+
export const StatTile = ({ label, value, className }) => (_jsxs("div", { className: cn('surface flex flex-col gap-1 rounded-lg p-4', className), children: [_jsx("span", { className: "text-sm text-muted-foreground", children: label }), _jsx("span", { className: "text-2xl font-semibold tabular-nums", children: formatUiNumber(value) })] }));
|
|
6
|
+
//# sourceMappingURL=StatTile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StatTile.js","sourceRoot":"","sources":["../../src/data/StatTile.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,EAAE,EAAE,MAAM,qBAAqB,CAAC;AAQzC,gFAAgF;AAChF,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,EAAiB,EAAE,EAAE,CAAC,CACtE,eAAK,SAAS,EAAE,EAAE,CAAC,4CAA4C,EAAE,SAAS,CAAC,aACzE,eAAM,SAAS,EAAC,+BAA+B,YAAE,KAAK,GAAQ,EAC9D,eAAM,SAAS,EAAC,qCAAqC,YAAE,cAAc,CAAC,KAAK,CAAC,GAAQ,IAChF,CACP,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/data/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,KAAK,aAAa,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/data/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAsB,MAAM,eAAgB,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import { type FieldValues, type SubmitHandler } from 'react-hook-form';
|
|
3
|
+
import { type FieldLabels } from './fieldLabels.js';
|
|
4
|
+
export interface FormProps<Values extends FieldValues> {
|
|
5
|
+
defaultValues: Values;
|
|
6
|
+
labels: FieldLabels;
|
|
7
|
+
onSubmit: SubmitHandler<Values>;
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
actions?: ReactNode;
|
|
10
|
+
}
|
|
11
|
+
/** A react-hook-form form that gives its fields their labels; the actions render first (`data-form-actions`). */
|
|
12
|
+
export declare const Form: <Values extends FieldValues>({ defaultValues, labels, onSubmit, children, actions, }: FormProps<Values>) => import("react").JSX.Element;
|
|
13
|
+
//# sourceMappingURL=Form.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Form.d.ts","sourceRoot":"","sources":["../../src/form/Form.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAyB,KAAK,WAAW,EAAE,KAAK,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC9F,OAAO,EAAuB,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAE1E,MAAM,WAAW,SAAS,CAAC,MAAM,SAAS,WAAW;IACnD,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,WAAW,CAAC;IACpB,QAAQ,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IAChC,QAAQ,EAAE,SAAS,CAAC;IACpB,OAAO,CAAC,EAAE,SAAS,CAAC;CACrB;AAED,iHAAiH;AACjH,eAAO,MAAM,IAAI,GAAI,MAAM,SAAS,WAAW,EAAE,yDAM9C,SAAS,CAAC,MAAM,CAAC,gCAanB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { FormProvider, useForm } from 'react-hook-form';
|
|
4
|
+
import { FieldLabelsProvider } from "./fieldLabels.js";
|
|
5
|
+
/** A react-hook-form form that gives its fields their labels; the actions render first (`data-form-actions`). */
|
|
6
|
+
export const Form = ({ defaultValues, labels, onSubmit, children, actions, }) => {
|
|
7
|
+
// `defaultValues` is typed by the caller; react-hook-form's DefaultValues<> is a deep partial of it.
|
|
8
|
+
const methods = useForm({ defaultValues: defaultValues });
|
|
9
|
+
return (_jsx(FormProvider, { ...methods, children: _jsx(FieldLabelsProvider, { labels: labels, children: _jsxs("form", { className: "flex flex-col gap-4", onSubmit: methods.handleSubmit(onSubmit), children: [children, actions ? _jsx("div", { "data-form-actions": "", children: actions }) : null] }) }) }));
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=Form.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Form.js","sourceRoot":"","sources":["../../src/form/Form.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAGb,OAAO,EAAE,YAAY,EAAE,OAAO,EAAwC,MAAM,iBAAiB,CAAC;AAC9F,OAAO,EAAE,mBAAmB,EAAoB,MAAM,kBAAmB,CAAC;AAU1E,iHAAiH;AACjH,MAAM,CAAC,MAAM,IAAI,GAAG,CAA6B,EAC/C,aAAa,EACb,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,OAAO,GACW,EAAE,EAAE;IACtB,qGAAqG;IACrG,MAAM,OAAO,GAAG,OAAO,CAAS,EAAE,aAAa,EAAE,aAAsB,EAAE,CAAC,CAAC;IAC3E,OAAO,CACL,KAAC,YAAY,OAAK,OAAO,YACvB,KAAC,mBAAmB,IAAC,MAAM,EAAE,MAAM,YACjC,gBAAM,SAAS,EAAC,qBAAqB,EAAC,QAAQ,EAAE,OAAO,CAAC,YAAY,CAAC,QAAQ,CAAC,aAC3E,QAAQ,EACR,OAAO,CAAC,CAAC,CAAC,mCAAuB,EAAE,YAAE,OAAO,GAAO,CAAC,CAAC,CAAC,IAAI,IACtD,GACa,GACT,CAChB,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
/** Field name → visible label. One context for `./form`, `./translations` and `./media`. */
|
|
3
|
+
export type FieldLabels = Readonly<Record<string, string>>;
|
|
4
|
+
export declare const FieldLabelsProvider: ({ labels, children }: {
|
|
5
|
+
labels: FieldLabels;
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
}) => import("react").JSX.Element;
|
|
8
|
+
/** The label of a field, or its name when the form declares none. */
|
|
9
|
+
export declare const useFieldLabel: (name: string) => string;
|
|
10
|
+
//# sourceMappingURL=fieldLabels.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fieldLabels.d.ts","sourceRoot":"","sources":["../../src/form/fieldLabels.tsx"],"names":[],"mappings":"AAEA,OAAO,EAA6B,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAElE,4FAA4F;AAC5F,MAAM,MAAM,WAAW,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;AAI3D,eAAO,MAAM,mBAAmB,GAAI,sBAAsB;IAAE,MAAM,EAAE,WAAW,CAAC;IAAC,QAAQ,EAAE,SAAS,CAAA;CAAE,gCAErG,CAAC;AAEF,qEAAqE;AACrE,eAAO,MAAM,aAAa,GAAI,MAAM,MAAM,KAAG,MAAsD,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { createContext, useContext } from 'react';
|
|
4
|
+
const FieldLabelsContext = createContext({});
|
|
5
|
+
export const FieldLabelsProvider = ({ labels, children }) => (_jsx(FieldLabelsContext.Provider, { value: labels, children: children }));
|
|
6
|
+
/** The label of a field, or its name when the form declares none. */
|
|
7
|
+
export const useFieldLabel = (name) => useContext(FieldLabelsContext)[name] ?? name;
|
|
8
|
+
//# sourceMappingURL=fieldLabels.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fieldLabels.js","sourceRoot":"","sources":["../../src/form/fieldLabels.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,aAAa,EAAE,UAAU,EAAkB,MAAM,OAAO,CAAC;AAKlE,MAAM,kBAAkB,GAAG,aAAa,CAAc,EAAE,CAAC,CAAC;AAE1D,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAgD,EAAE,EAAE,CAAC,CACzG,KAAC,kBAAkB,CAAC,QAAQ,IAAC,KAAK,EAAE,MAAM,YAAG,QAAQ,GAA+B,CACrF,CAAC;AAEF,qEAAqE;AACrE,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,IAAY,EAAU,EAAE,CAAC,UAAU,CAAC,kBAAkB,CAAC,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/form/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,KAAK,SAAS,EAAE,MAAM,YAAY,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAE,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/form/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAkB,MAAM,WAAY,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAoB,MAAM,kBAAmB,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
/** A translucent panel (`surface-glass` in components.css). No hooks: usable from server components. */
|
|
3
|
+
export declare const GlassPanel: ({ children, className }: {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
className?: string;
|
|
6
|
+
}) => import("react").JSX.Element;
|
|
7
|
+
//# sourceMappingURL=GlassPanel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GlassPanel.d.ts","sourceRoot":"","sources":["../../src/glass/GlassPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,wGAAwG;AACxG,eAAO,MAAM,UAAU,GAAI,yBAAyB;IAAE,QAAQ,EAAE,SAAS,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,gCAE9F,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "../primitives/cn.js";
|
|
3
|
+
/** A translucent panel (`surface-glass` in components.css). No hooks: usable from server components. */
|
|
4
|
+
export const GlassPanel = ({ children, className }) => (_jsx("div", { className: cn('surface-glass rounded-xl p-4', className), children: children }));
|
|
5
|
+
//# sourceMappingURL=GlassPanel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GlassPanel.js","sourceRoot":"","sources":["../../src/glass/GlassPanel.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,EAAE,EAAE,MAAM,qBAAqB,CAAC;AAEzC,wGAAwG;AACxG,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,EAAE,QAAQ,EAAE,SAAS,EAA+C,EAAE,EAAE,CAAC,CAClG,cAAK,SAAS,EAAE,EAAE,CAAC,8BAA8B,EAAE,SAAS,CAAC,YAAG,QAAQ,GAAO,CAChF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/glass/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/glass/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAkB,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export interface TranslateProps {
|
|
2
|
+
children: string;
|
|
3
|
+
context?: string;
|
|
4
|
+
}
|
|
5
|
+
/** Renders its text child translated; `context` tells equal texts with different meanings apart. */
|
|
6
|
+
export declare const Translate: ({ children, context }: TranslateProps) => import("react").JSX.Element;
|
|
7
|
+
//# sourceMappingURL=Translate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Translate.d.ts","sourceRoot":"","sources":["../../src/i18n/Translate.tsx"],"names":[],"mappings":"AAIA,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,oGAAoG;AACpG,eAAO,MAAM,SAAS,GAAI,uBAAuB,cAAc,gCAG9D,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useTranslate } from "./useTranslate.js";
|
|
4
|
+
/** Renders its text child translated; `context` tells equal texts with different meanings apart. */
|
|
5
|
+
export const Translate = ({ children, context }) => {
|
|
6
|
+
const { t } = useTranslate();
|
|
7
|
+
return _jsx(_Fragment, { children: t(children, context ? { context } : {}) });
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=Translate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Translate.js","sourceRoot":"","sources":["../../src/i18n/Translate.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAOjD,oGAAoG;AACpG,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAkB,EAAE,EAAE;IACjE,MAAM,EAAE,CAAC,EAAE,GAAG,YAAY,EAAE,CAAC;IAC7B,OAAO,4BAAG,CAAC,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,GAAI,CAAC;AACxD,CAAC,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { getTranslationsSnapshot, setTranslations, subscribeTranslations, translateText, translationKeyOf, type TranslateOptions, type TranslationsSnapshot, type WritingStyle, } from './store.js';
|
|
2
|
+
export { m } from './m.js';
|
|
3
|
+
export { useTranslate, type UseTranslateResult } from './useTranslate.js';
|
|
4
|
+
export { Translate, type TranslateProps } from './Translate.js';
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/i18n/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,eAAe,EACf,qBAAqB,EACrB,aAAa,EACb,gBAAgB,EAChB,KAAK,gBAAgB,EACrB,KAAK,oBAAoB,EACzB,KAAK,YAAY,GAClB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAC3B,OAAO,EAAE,YAAY,EAAE,KAAK,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAC1E,OAAO,EAAE,SAAS,EAAE,KAAK,cAAc,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { getTranslationsSnapshot, setTranslations, subscribeTranslations, translateText, translationKeyOf, } from "./store.js";
|
|
2
|
+
export { m } from "./m.js";
|
|
3
|
+
export { useTranslate } from "./useTranslate.js";
|
|
4
|
+
export { Translate } from "./Translate.js";
|
|
5
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/i18n/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,eAAe,EACf,qBAAqB,EACrB,aAAa,EACb,gBAAgB,GAIjB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAC3B,OAAO,EAAE,YAAY,EAA2B,MAAM,mBAAmB,CAAC;AAC1E,OAAO,EAAE,SAAS,EAAuB,MAAM,gBAAiB,CAAC"}
|
package/dist/i18n/m.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type TranslateOptions } from './store.js';
|
|
2
|
+
/**
|
|
3
|
+
* Translates a text outside React: server components, `export const metadata`, schemas, event handlers.
|
|
4
|
+
* Same lookup as {@link translateText}; the name marks the call for the translation-key manifest.
|
|
5
|
+
*/
|
|
6
|
+
export declare const m: (text: string, options?: TranslateOptions) => string;
|
|
7
|
+
//# sourceMappingURL=m.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"m.d.ts","sourceRoot":"","sources":["../../src/i18n/m.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAElE;;;GAGG;AACH,eAAO,MAAM,CAAC,GAAI,MAAM,MAAM,EAAE,UAAU,gBAAgB,KAAG,MAAsC,CAAC"}
|