@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/dist/i18n/server.d.ts
CHANGED
|
@@ -16,31 +16,16 @@
|
|
|
16
16
|
* — only this Node-only `/i18n/server` subpath pulls it in.
|
|
17
17
|
*/
|
|
18
18
|
import { type ResolveLanguageStringOptions } from '@happyvertical/smrt-languages';
|
|
19
|
-
import { type
|
|
20
|
-
import '@happyvertical/smrt-ui/i18n';
|
|
21
|
-
import './strings.forms.js';
|
|
22
|
-
import './strings.onboarding.js';
|
|
23
|
-
import './strings.board.js';
|
|
24
|
-
import './strings.sortable.js';
|
|
25
|
-
import './strings.audit.js';
|
|
26
|
-
import './strings.notifications.js';
|
|
27
|
-
import './strings.import-export.js';
|
|
28
|
-
import './strings.workspace.js';
|
|
29
|
-
import './strings.screens.js';
|
|
30
|
-
import './strings.palette.js';
|
|
31
|
-
import './strings.overview.js';
|
|
32
|
-
import './strings.settings.js';
|
|
33
|
-
import './strings.connect-ai.js';
|
|
34
|
-
import './strings.browser-ai.js';
|
|
35
|
-
import '../mcp-apps/strings.js';
|
|
19
|
+
import { type ApplicationMessageCatalog } from '@happyvertical/smrt-ui/i18n/catalog';
|
|
20
|
+
import { type I18nSnapshot } from '@happyvertical/smrt-ui/i18n/server';
|
|
36
21
|
export interface BuildI18nSnapshotOptions {
|
|
37
22
|
/** Target locale (BCP-47-ish, e.g. `fr-CA`). */
|
|
38
23
|
locale: string;
|
|
39
24
|
/** Tenant scope for tenant-level overrides. */
|
|
40
25
|
tenantId?: ResolveLanguageStringOptions['tenantId'];
|
|
41
26
|
/**
|
|
42
|
-
* DB handle for
|
|
43
|
-
*
|
|
27
|
+
* DB handle for scoped overrides. Omit for code defaults only. Snapshot
|
|
28
|
+
* resolution is read-only and never enqueues translation jobs.
|
|
44
29
|
*/
|
|
45
30
|
db?: ResolveLanguageStringOptions['db'];
|
|
46
31
|
/**
|
|
@@ -48,6 +33,10 @@ export interface BuildI18nSnapshotOptions {
|
|
|
48
33
|
* `defineMessages` (the catalogs imported on the server so far).
|
|
49
34
|
*/
|
|
50
35
|
keys?: string[];
|
|
36
|
+
/** Explicit app/package inventory, including lazy routes. Defaults stay request-local. */
|
|
37
|
+
catalog?: ApplicationMessageCatalog;
|
|
38
|
+
/** Persisted app default used at the end of the request locale fallback chain. */
|
|
39
|
+
defaultLocale?: string;
|
|
51
40
|
}
|
|
52
41
|
/**
|
|
53
42
|
* Resolve a per-locale dictionary of message **templates** for the keys an app
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/i18n/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAGL,KAAK,4BAA4B,EAElC,MAAM,+BAA+B,CAAC;AACvC,OAAO,
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/i18n/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAGL,KAAK,4BAA4B,EAElC,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,KAAK,yBAAyB,EAG/B,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAEL,KAAK,YAAY,EAClB,MAAM,oCAAoC,CAAC;AAW5C,MAAM,WAAW,wBAAwB;IACvC,gDAAgD;IAChD,MAAM,EAAE,MAAM,CAAC;IACf,+CAA+C;IAC/C,QAAQ,CAAC,EAAE,4BAA4B,CAAC,UAAU,CAAC,CAAC;IACpD;;;OAGG;IACH,EAAE,CAAC,EAAE,4BAA4B,CAAC,IAAI,CAAC,CAAC;IACxC;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,0FAA0F;IAC1F,OAAO,CAAC,EAAE,yBAAyB,CAAC;IACpC,kFAAkF;IAClF,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;;;;GAMG;AACH,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,wBAAwB,GAChC,OAAO,CAAC,YAAY,CAAC,CAoDvB"}
|
package/dist/i18n/server.js
CHANGED
|
@@ -15,29 +15,15 @@
|
|
|
15
15
|
* server tree (smrt-core/sql/ai/jobs) is tree-shaken out of the browser bundle
|
|
16
16
|
* — only this Node-only `/i18n/server` subpath pulls it in.
|
|
17
17
|
*/
|
|
18
|
-
import { defineLanguageString, LanguageRegistry,
|
|
19
|
-
import {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
//
|
|
23
|
-
//
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
import './strings.onboarding.js';
|
|
28
|
-
import './strings.board.js';
|
|
29
|
-
import './strings.sortable.js';
|
|
30
|
-
import './strings.audit.js';
|
|
31
|
-
import './strings.notifications.js';
|
|
32
|
-
import './strings.import-export.js';
|
|
33
|
-
import './strings.workspace.js';
|
|
34
|
-
import './strings.screens.js';
|
|
35
|
-
import './strings.palette.js';
|
|
36
|
-
import './strings.overview.js';
|
|
37
|
-
import './strings.settings.js';
|
|
38
|
-
import './strings.connect-ai.js';
|
|
39
|
-
import './strings.browser-ai.js';
|
|
40
|
-
import '../mcp-apps/strings.js';
|
|
18
|
+
import { defineLanguageString, LanguageRegistry, resolveLanguageStrings, } from '@happyvertical/smrt-languages';
|
|
19
|
+
import { assembleApplicationCatalog, messageCatalog as uiCatalog, } from '@happyvertical/smrt-ui/i18n/catalog';
|
|
20
|
+
import { getRegisteredDefaults, } from '@happyvertical/smrt-ui/i18n/server';
|
|
21
|
+
import { messageCatalog as shellCatalog } from './catalog.js';
|
|
22
|
+
// Legacy calls still receive every shipped English default, without importing
|
|
23
|
+
// browser barrels or Svelte components into Node's module loader.
|
|
24
|
+
const shippedEnglish = Object.fromEntries(assembleApplicationCatalog([uiCatalog, shellCatalog])
|
|
25
|
+
.messages.filter((message) => message.locale === 'en')
|
|
26
|
+
.map(({ key, template }) => [key, template]));
|
|
41
27
|
/**
|
|
42
28
|
* Resolve a per-locale dictionary of message **templates** for the keys an app
|
|
43
29
|
* uses. Seeds `LanguageRegistry` from the English defaults registered via
|
|
@@ -47,25 +33,47 @@ import '../mcp-apps/strings.js';
|
|
|
47
33
|
*/
|
|
48
34
|
export async function buildI18nSnapshot(options) {
|
|
49
35
|
const { locale, tenantId = null, db, keys } = options;
|
|
36
|
+
if (options.catalog) {
|
|
37
|
+
const catalog = assembleApplicationCatalog([options.catalog]);
|
|
38
|
+
const inventory = new Set(catalog.messages.map((message) => message.key));
|
|
39
|
+
const targetKeys = keys ?? [...inventory];
|
|
40
|
+
for (const key of targetKeys) {
|
|
41
|
+
if (!inventory.has(key))
|
|
42
|
+
throw new Error(`Key ${key} is not in the application catalog`);
|
|
43
|
+
}
|
|
44
|
+
const resolved = await resolveLanguageStrings(targetKeys, {
|
|
45
|
+
db,
|
|
46
|
+
tenantId,
|
|
47
|
+
locale,
|
|
48
|
+
codeDefaults: catalog.messages,
|
|
49
|
+
defaultLocale: options.defaultLocale,
|
|
50
|
+
});
|
|
51
|
+
const messages = Object.fromEntries(Object.entries(resolved).map(([key, value]) => [key, value.template]));
|
|
52
|
+
return { locale, messages };
|
|
53
|
+
}
|
|
50
54
|
// Seed the languages registry with smrt-svelte's English code defaults so the
|
|
51
55
|
// resolver's code layer can serve them. Idempotent — skip keys already
|
|
52
56
|
// registered (a different template for the same key would have thrown at
|
|
53
57
|
// `defineMessages` time).
|
|
54
|
-
const defaults =
|
|
58
|
+
const defaults = { ...shippedEnglish };
|
|
59
|
+
for (const [key, template] of Object.entries(getRegisteredDefaults())) {
|
|
60
|
+
if (defaults[key] !== undefined && defaults[key] !== template) {
|
|
61
|
+
throw new Error(`Conflicting registered message default: ${key}`);
|
|
62
|
+
}
|
|
63
|
+
defaults[key] = template;
|
|
64
|
+
}
|
|
55
65
|
for (const [key, template] of Object.entries(defaults)) {
|
|
56
66
|
if (!LanguageRegistry.has(key, 'en')) {
|
|
57
67
|
defineLanguageString({ key, locale: 'en', template });
|
|
58
68
|
}
|
|
59
69
|
}
|
|
60
70
|
const targetKeys = keys ?? Object.keys(defaults);
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
messages[key] = resolved.template;
|
|
69
|
-
}));
|
|
71
|
+
const resolved = await resolveLanguageStrings(targetKeys, {
|
|
72
|
+
db,
|
|
73
|
+
tenantId,
|
|
74
|
+
locale,
|
|
75
|
+
defaultLocale: options.defaultLocale,
|
|
76
|
+
});
|
|
77
|
+
const messages = Object.fromEntries(Object.entries(resolved).map(([key, value]) => [key, value.template]));
|
|
70
78
|
return { locale, messages };
|
|
71
79
|
}
|
|
@@ -134,7 +134,7 @@ export interface LiveCollectionOptions {
|
|
|
134
134
|
* duplicate fetch. The live view starts populated at `ready`.
|
|
135
135
|
* ```ts
|
|
136
136
|
* // +page.server.ts — read the collection server-side, return plain rows.
|
|
137
|
-
* import { getCollection } from '
|
|
137
|
+
* import { getCollection } from '#lib/server/smrt.js';
|
|
138
138
|
* import type { PageServerLoad } from './$types';
|
|
139
139
|
*
|
|
140
140
|
* export const load: PageServerLoad = async () => {
|
|
@@ -90,7 +90,7 @@ function toLiveStatus(isReady, isError) {
|
|
|
90
90
|
* duplicate fetch. The live view starts populated at `ready`.
|
|
91
91
|
* ```ts
|
|
92
92
|
* // +page.server.ts — read the collection server-side, return plain rows.
|
|
93
|
-
* import { getCollection } from '
|
|
93
|
+
* import { getCollection } from '#lib/server/smrt.js';
|
|
94
94
|
* import type { PageServerLoad } from './$types';
|
|
95
95
|
*
|
|
96
96
|
* export const load: PageServerLoad = async () => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@happyvertical/smrt-svelte",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.75.0",
|
|
4
4
|
"smrtJsdoc": "strict",
|
|
5
5
|
"description": "Svelte 5 components for SMRT user management - auth, users, tenants, roles, permissions, groups",
|
|
6
6
|
"type": "module",
|
|
@@ -210,6 +210,16 @@
|
|
|
210
210
|
"svelte": "./dist/components/onboarding/index.js",
|
|
211
211
|
"import": "./dist/components/onboarding/index.js",
|
|
212
212
|
"default": "./dist/components/onboarding/index.js"
|
|
213
|
+
},
|
|
214
|
+
"./i18n/catalog": {
|
|
215
|
+
"types": "./dist/i18n/catalog.d.ts",
|
|
216
|
+
"import": "./dist/i18n/catalog.js",
|
|
217
|
+
"default": "./dist/i18n/catalog.js"
|
|
218
|
+
},
|
|
219
|
+
"./app/settings-sections": {
|
|
220
|
+
"types": "./dist/components/workspace/admin-shell/settings-sections.d.ts",
|
|
221
|
+
"import": "./dist/components/workspace/admin-shell/settings-sections.js",
|
|
222
|
+
"default": "./dist/components/workspace/admin-shell/settings-sections.js"
|
|
213
223
|
}
|
|
214
224
|
},
|
|
215
225
|
"files": [
|
|
@@ -242,18 +252,18 @@
|
|
|
242
252
|
},
|
|
243
253
|
"dependencies": {
|
|
244
254
|
"@happyvertical/logger": "^0.116.6",
|
|
245
|
-
"@happyvertical/smrt-core": "0.
|
|
246
|
-
"@happyvertical/smrt-fields": "0.
|
|
247
|
-
"@happyvertical/smrt-languages": "0.
|
|
248
|
-
"@happyvertical/smrt-mcp-apps": "0.
|
|
249
|
-
"@happyvertical/smrt-types": "0.
|
|
250
|
-
"@happyvertical/smrt-ui": "0.
|
|
251
|
-
"@happyvertical/smrt-web": "0.
|
|
255
|
+
"@happyvertical/smrt-core": "0.75.0",
|
|
256
|
+
"@happyvertical/smrt-fields": "0.75.0",
|
|
257
|
+
"@happyvertical/smrt-languages": "0.75.0",
|
|
258
|
+
"@happyvertical/smrt-mcp-apps": "0.75.0",
|
|
259
|
+
"@happyvertical/smrt-types": "0.75.0",
|
|
260
|
+
"@happyvertical/smrt-ui": "0.75.0",
|
|
261
|
+
"@happyvertical/smrt-web": "0.75.0",
|
|
252
262
|
"@tanstack/db": "^1.0.0-rc.1",
|
|
253
263
|
"@tanstack/svelte-db": "^1.0.0-rc.1",
|
|
254
264
|
"esm-env": "^1.2.2",
|
|
255
|
-
"@happyvertical/smrt-chat": "0.
|
|
256
|
-
"@happyvertical/smrt-inference": "0.
|
|
265
|
+
"@happyvertical/smrt-chat": "0.75.0",
|
|
266
|
+
"@happyvertical/smrt-inference": "0.75.0"
|
|
257
267
|
},
|
|
258
268
|
"peerDependencies": {
|
|
259
269
|
"@happyvertical/speech": ">=0.102.5",
|
|
@@ -262,7 +272,7 @@
|
|
|
262
272
|
"@remotion/whisper-web": ">=4.0.526",
|
|
263
273
|
"bitgpu": "^0.19.1",
|
|
264
274
|
"chrono-node": "^2.10.1",
|
|
265
|
-
"svelte": "^5.57.
|
|
275
|
+
"svelte": "^5.57.1"
|
|
266
276
|
},
|
|
267
277
|
"peerDependenciesMeta": {
|
|
268
278
|
"@happyvertical/speech": {
|
|
@@ -285,12 +295,12 @@
|
|
|
285
295
|
}
|
|
286
296
|
},
|
|
287
297
|
"devDependencies": {
|
|
288
|
-
"@happyvertical/smrt-agents": "0.
|
|
289
|
-
"@happyvertical/smrt-content": "0.
|
|
290
|
-
"@happyvertical/smrt-reports": "0.
|
|
291
|
-
"@happyvertical/smrt-scanner": "0.
|
|
292
|
-
"@happyvertical/smrt-tenancy": "0.
|
|
293
|
-
"@happyvertical/smrt-users": "0.
|
|
298
|
+
"@happyvertical/smrt-agents": "0.75.0",
|
|
299
|
+
"@happyvertical/smrt-content": "0.75.0",
|
|
300
|
+
"@happyvertical/smrt-reports": "0.75.0",
|
|
301
|
+
"@happyvertical/smrt-scanner": "0.75.0",
|
|
302
|
+
"@happyvertical/smrt-tenancy": "0.75.0",
|
|
303
|
+
"@happyvertical/smrt-users": "0.75.0",
|
|
294
304
|
"@happyvertical/speech": "^0.116.6",
|
|
295
305
|
"@sveltejs/package": "^2.5.8",
|
|
296
306
|
"@sveltejs/vite-plugin-svelte": "^7.3.0",
|
|
@@ -306,7 +316,7 @@
|
|
|
306
316
|
"vitest": "4.1.10"
|
|
307
317
|
},
|
|
308
318
|
"scripts": {
|
|
309
|
-
"build": "svelte-package -i src --tsconfig tsconfig.svelte.json && node ../../scripts/prune-svelte-package-artifacts.js dist",
|
|
319
|
+
"build": "svelte-package -i src --tsconfig tsconfig.svelte.json && node scripts/check-node-i18n.mjs && node ../../scripts/prune-svelte-package-artifacts.js dist",
|
|
310
320
|
"dev": "svelte-package -i src --watch",
|
|
311
321
|
"check": "node ../../scripts/svelte-check-workspace.mjs --config ./svelte.config.typecheck.js --tsconfig ./tsconfig.typecheck.json",
|
|
312
322
|
"test": "pnpm run test:unit && pnpm run test:conformance",
|