@happyvertical/smrt-svelte 0.74.6 → 0.75.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -1
- package/agents/i18n.md +27 -3
- package/dist/components/app/AppShell.svelte +15 -3
- package/dist/components/app/AppShell.svelte.d.ts +3 -0
- package/dist/components/app/AppShell.svelte.d.ts.map +1 -1
- package/dist/i18n/catalog.d.ts +3 -0
- package/dist/i18n/catalog.d.ts.map +1 -0
- package/dist/i18n/catalog.generated.d.ts +3 -0
- package/dist/i18n/catalog.generated.d.ts.map +1 -0
- package/dist/i18n/catalog.generated.js +3600 -0
- package/dist/i18n/catalog.js +2 -0
- package/dist/i18n/server.d.ts +8 -19
- package/dist/i18n/server.d.ts.map +1 -1
- package/dist/i18n/server.js +41 -33
- package/dist/web/live-collection.svelte.d.ts +1 -1
- package/dist/web/live-collection.svelte.js +1 -1
- package/package.json +28 -18
package/README.md
CHANGED
|
@@ -458,7 +458,7 @@ utterance. English-only models (`*.en`, Moonshine) ignore a requested language.
|
|
|
458
458
|
|
|
459
459
|
```svelte
|
|
460
460
|
<script lang="ts">
|
|
461
|
-
import { manifest } from '
|
|
461
|
+
import { manifest } from '#lib/smrt-manifest.js';
|
|
462
462
|
import {
|
|
463
463
|
AdminShell,
|
|
464
464
|
TenantNav,
|
|
@@ -894,3 +894,10 @@ icon rail. Groups start open, preserve nested links and active-route markers,
|
|
|
894
894
|
and inherit the navigation density. Supply `aria-label="Shop navigation"` for
|
|
895
895
|
an instance-specific landmark name; omission uses the localized default.
|
|
896
896
|
`ShellNavGroup` is exported from `@happyvertical/smrt-svelte/workspace`.
|
|
897
|
+
|
|
898
|
+
### Settings route matching
|
|
899
|
+
|
|
900
|
+
`@happyvertical/smrt-svelte/app/settings-sections` exposes the built-in settings
|
|
901
|
+
section list, type and predicate without loading Svelte components. Use this
|
|
902
|
+
Node-safe entry from a Kit 3 `src/params.ts` matcher table. A `defineParams`
|
|
903
|
+
function must return the accepted string or `undefined` to reject it.
|
package/agents/i18n.md
CHANGED
|
@@ -30,10 +30,34 @@ languages root is imported only by the Node-only `/i18n/server` subpath. See
|
|
|
30
30
|
— a consumer's load function calls it for the request locale and passes the
|
|
31
31
|
result to `<Provider>`. It seeds the languages registry from `defineMessages`
|
|
32
32
|
defaults, then resolves each key through the override/tenant/locale chain.
|
|
33
|
-
`server.ts`
|
|
34
|
-
`
|
|
35
|
-
|
|
33
|
+
`server.ts` consumes the pure UI/shell catalogs and the Node-safe
|
|
34
|
+
`smrt-ui/i18n/server` registry, so standalone Node never loads `Trans.svelte`.
|
|
35
|
+
Regenerate the package catalog after adding strings. The package build
|
|
36
|
+
runs `scripts/check-node-i18n.mjs` against its exact emitted entrypoints.
|
|
36
37
|
- Enforcement: `scripts/check-hardcoded-strings.mjs` (`pnpm
|
|
37
38
|
check:hardcoded-strings`) flags hardcoded prose in `.svelte` markup —
|
|
38
39
|
report-only until a package's extraction completes, then add it to the
|
|
39
40
|
script's `STRICT_PACKAGES`. Phase 1 extracted `DataTable` as the pilot.
|
|
41
|
+
|
|
42
|
+
## Explicit application catalogs (#5806)
|
|
43
|
+
|
|
44
|
+
`./i18n/catalog` exports server-safe shipped defaults, independent of component
|
|
45
|
+
imports. Compose it with the UI and app-owned lazy-route catalogs through
|
|
46
|
+
`assembleApplicationCatalog` from `@happyvertical/smrt-ui/i18n/catalog`.
|
|
47
|
+
`buildI18nSnapshot({ locale, catalog, defaultLocale, tenantId, db })` resolves
|
|
48
|
+
that explicit inventory into request-local snapshots without registering code
|
|
49
|
+
defaults globally or enqueueing translation jobs. Existing calls to `buildI18nSnapshot` retain the
|
|
50
|
+
registered-default behavior above. See the canonical
|
|
51
|
+
[message authoring contract](../../smrt-ui/agents/i18n-authoring.md) for generation,
|
|
52
|
+
plural/select, rich text, accessibility and locale formatting.
|
|
53
|
+
|
|
54
|
+
`AppShell` accepts the same `i18n` snapshot as `Provider` and forwards it unchanged.
|
|
55
|
+
Its own chrome reads a request-local store before constructing the child Provider,
|
|
56
|
+
so both shell labels and nested stock components translate in the first SSR HTML.
|
|
57
|
+
Replace the snapshot on navigation or language changes; never share a mutable
|
|
58
|
+
snapshot between tenant requests. The host owns document `lang`/`dir` and persistent
|
|
59
|
+
locale selection (see the SvelteKit template's tracked root load, document hook and language route).
|
|
60
|
+
|
|
61
|
+
Snapshot dictionaries use the public read-only bulk languages resolver: override
|
|
62
|
+
query count is independent of message count (one app list plus one tenant list).
|
|
63
|
+
No request dictionary is cached globally or shared across catalogs/versions.
|
|
@@ -10,7 +10,10 @@ import '@happyvertical/smrt-ui/themes/styles/all.css';
|
|
|
10
10
|
import '@happyvertical/smrt-ui/themes/styles/base.css';
|
|
11
11
|
import '@happyvertical/smrt-ui/themes/styles/fonts.css';
|
|
12
12
|
import type { DataSurfaceRegistry } from '@happyvertical/smrt-ui/data';
|
|
13
|
-
import {
|
|
13
|
+
import {
|
|
14
|
+
createI18nContext,
|
|
15
|
+
type I18nSnapshot,
|
|
16
|
+
} from '@happyvertical/smrt-ui/i18n';
|
|
14
17
|
import { type Component, type Snippet, tick, untrack } from 'svelte';
|
|
15
18
|
import { M as SORTABLE_STRINGS } from '../../i18n/strings.sortable.js';
|
|
16
19
|
import { M } from '../../i18n/strings.workspace.js';
|
|
@@ -90,6 +93,8 @@ import type {
|
|
|
90
93
|
import { runViewTransition } from './view-transition.js';
|
|
91
94
|
|
|
92
95
|
interface Props {
|
|
96
|
+
/** Request-scoped locale and resolved messages; forwarded to Provider unchanged. */
|
|
97
|
+
i18n?: I18nSnapshot;
|
|
93
98
|
/** Application name shown in the shell brand and app panel. */
|
|
94
99
|
title?: string;
|
|
95
100
|
/** Secondary line under the application name in the shell brand. */
|
|
@@ -341,6 +346,7 @@ interface Props {
|
|
|
341
346
|
}
|
|
342
347
|
|
|
343
348
|
let {
|
|
349
|
+
i18n,
|
|
344
350
|
title = 'SMRT',
|
|
345
351
|
subtitle,
|
|
346
352
|
logoSrc,
|
|
@@ -412,7 +418,13 @@ const layoutFloating = $derived(
|
|
|
412
418
|
typeof layoutEditing === 'object' && layoutEditing.floating === true,
|
|
413
419
|
);
|
|
414
420
|
const SHELL_LAYOUT_EDIT_ITEM_ID = 'item:layout-edit';
|
|
415
|
-
|
|
421
|
+
// The shell itself sits above its Provider: seed its own request-local reader
|
|
422
|
+
// synchronously as well, so shell labels translate on the first SSR render.
|
|
423
|
+
const shellI18n = untrack(() => createI18nContext(i18n));
|
|
424
|
+
$effect(() => {
|
|
425
|
+
shellI18n.snapshot = i18n ?? { locale: 'en', messages: {} };
|
|
426
|
+
});
|
|
427
|
+
const t = shellI18n.t;
|
|
416
428
|
// Every movable item, in default order: legacy `slots` snippets, `slotItems`,
|
|
417
429
|
// then dock toggles. Ids are stable (`slot:<slot>`, the host's id,
|
|
418
430
|
// `dock:<tool>`); the first of a duplicated id wins.
|
|
@@ -1180,7 +1192,7 @@ const EDGE_OF_REGION: Record<ShellRegion, PanelEdge> = {
|
|
|
1180
1192
|
/>
|
|
1181
1193
|
{/snippet}
|
|
1182
1194
|
|
|
1183
|
-
<Provider {webmcp} user={providerUser} {permissions}>
|
|
1195
|
+
<Provider {i18n} {webmcp} user={providerUser} {permissions}>
|
|
1184
1196
|
<RuntimeDiagnosticsWebMcp enabled={runtimeDiagnostics} />
|
|
1185
1197
|
<ThemeProvider
|
|
1186
1198
|
{preset}
|
|
@@ -3,6 +3,7 @@ import '@happyvertical/smrt-ui/themes/styles/all.css';
|
|
|
3
3
|
import '@happyvertical/smrt-ui/themes/styles/base.css';
|
|
4
4
|
import '@happyvertical/smrt-ui/themes/styles/fonts.css';
|
|
5
5
|
import type { DataSurfaceRegistry } from '@happyvertical/smrt-ui/data';
|
|
6
|
+
import { type I18nSnapshot } from '@happyvertical/smrt-ui/i18n';
|
|
6
7
|
import { type Component, type Snippet } from 'svelte';
|
|
7
8
|
import type { WebMcpProviderConfig } from '../../web/webmcp-provider.js';
|
|
8
9
|
import { type ShellLayout } from '../workspace/admin-shell/layout.js';
|
|
@@ -13,6 +14,8 @@ import { type PhoneTabBarOptions } from './phone-tabs.js';
|
|
|
13
14
|
import type { ShellUser } from './shell-user.js';
|
|
14
15
|
import type { AppShellAccountMenu, AppShellCommandPalette, AppShellPanelToggle, AppShellVoiceToggle, ShellSlotItem } from './slot-item.js';
|
|
15
16
|
interface Props {
|
|
17
|
+
/** Request-scoped locale and resolved messages; forwarded to Provider unchanged. */
|
|
18
|
+
i18n?: I18nSnapshot;
|
|
16
19
|
/** Application name shown in the shell brand and app panel. */
|
|
17
20
|
title?: string;
|
|
18
21
|
/** Secondary line under the application name in the shell brand. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppShell.svelte.d.ts","sourceRoot":"","sources":["../../../src/components/app/AppShell.svelte.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,kBAAkB,EACvB,KAAK,WAAW,EAChB,KAAK,WAAW,EAEjB,MAAM,+BAA+B,CAAC;AACvC,OAAO,8CAA8C,CAAC;AACtD,OAAO,+CAA+C,CAAC;AACvD,OAAO,gDAAgD,CAAC;AACxD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"AppShell.svelte.d.ts","sourceRoot":"","sources":["../../../src/components/app/AppShell.svelte.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,kBAAkB,EACvB,KAAK,WAAW,EAChB,KAAK,WAAW,EAEjB,MAAM,+BAA+B,CAAC;AACvC,OAAO,8CAA8C,CAAC;AACtD,OAAO,+CAA+C,CAAC;AACvD,OAAO,gDAAgD,CAAC;AACxD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AACvE,OAAO,EAEL,KAAK,YAAY,EAClB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,OAAO,EAAiB,MAAM,QAAQ,CA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C1E,WAAW,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;IACxD,wDAAwD;IACxD,aAAa,CAAC,EAAE,SAAS,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC3D;;;;OAIG;IACH,WAAW,CAAC,EAAE,eAAe,CAAC,aAAa,CAAC,CAAC;IAC7C,0EAA0E;IAC1E,oBAAoB,CAAC,EAAE,eAAe,CAAC,sBAAsB,CAAC,CAAC;IAC/D,4EAA4E;IAC5E,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;;;;;;;OAUG;IACH,WAAW,CAAC,EAAE,OAAO,GAAG,kBAAkB,CAAC;IAC3C;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;IAC/B;;;;;OAKG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;CACnB;AA+1BD,QAAA,MAAM,QAAQ,mCAAwC,CAAC;AACvD,KAAK,QAAQ,GAAG,UAAU,CAAC,OAAO,QAAQ,CAAC,CAAC;AAC5C,eAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../../src/i18n/catalog.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"catalog.generated.d.ts","sourceRoot":"","sources":["../../src/i18n/catalog.generated.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,qCAAqC,CAAC;AACrF,eAAO,MAAM,cAAc,EAAE,yBA6jH5B,CAAC"}
|