@qilin-agent/client-locale 3.1.5 → 3.1.6

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/lib/client.js CHANGED
@@ -905,7 +905,9 @@ window.__ModuleLoader__.load({
905
905
  const LOCALE_ID_PATTERN = /^[A-Za-z]{2,8}(?:-[A-Za-z0-9]{1,8})*$/u;
906
906
  /** Locale identifiers shipped by the browser client. */
907
907
  const LOCALE_IDS = ["zh", "en"];
908
- Schema.object({ [LOCALE_PREFERENCE_FIELD]: Schema.string().pattern(LOCALE_ID_PATTERN).required(false) });
908
+ /** The durable locale fields, shared by the Host schema and the browser scope. */
909
+ const LocaleSettingsFields = { [LOCALE_PREFERENCE_FIELD]: Schema.string().pattern(LOCALE_ID_PATTERN).required(false) };
910
+ Schema.object(LocaleSettingsFields);
909
911
  //#endregion
910
912
  //#region lib/types/locales/zh.js
911
913
  /** zh base dictionary for the common namespace: cross-feature standard words. */
package/lib/index.js CHANGED
@@ -9,19 +9,20 @@ const LOCALE_PREFERENCE_FIELD = "preference";
9
9
  const LOCALE_ID_PATTERN = /^[A-Za-z]{2,8}(?:-[A-Za-z0-9]{1,8})*$/u;
10
10
  /** Locale identifiers shipped by the browser client. */
11
11
  const LOCALE_IDS = ["zh", "en"];
12
- /** Durable locale schema; also the wire envelope the browser scope validates against. */
13
- const LocaleSettingsSchema = z.object({ [LOCALE_PREFERENCE_FIELD]: z.string().pattern(LOCALE_ID_PATTERN).required(false) });
12
+ /** The durable locale fields, shared by the Host schema and the browser scope. */
13
+ const LocaleSettingsFields = { [LOCALE_PREFERENCE_FIELD]: z.string().pattern(LOCALE_ID_PATTERN).required(false) };
14
+ z.object(LocaleSettingsFields);
14
15
  //#endregion
15
16
  //#region lib/types/index.js
16
- /** Host registration for the browser locale preference. */
17
- /**
18
- * Register the durable locale section when a settings provider exists.
19
- * @param ctx - Host context whose optional settings service owns the section.
17
+ /** Live preferences projected to the browser. */
18
+ const Config = z.object({ [LOCALE_PREFERENCE_FIELD]: LocaleSettingsFields[LOCALE_PREFERENCE_FIELD].volatile() });
19
+ /** Host preferences are consumed through the configuration form projection.
20
+ * @param ctx Host plugin context used for optional settings presentation.
20
21
  */
21
22
  function apply(ctx) {
22
- ctx.inject(["settings"], (settingsCtx) => {
23
- settingsCtx.settings.register(LOCALE_SETTINGS_NAMESPACE, LocaleSettingsSchema);
23
+ ctx.inject(["settings"], (child) => {
24
+ child.effect(() => child.settings.configure({ auto: false }, ctx.fiber));
24
25
  });
25
26
  }
26
27
  //#endregion
27
- export { LOCALE_IDS, LOCALE_PREFERENCE_FIELD, LOCALE_SETTINGS_NAMESPACE, apply };
28
+ export { Config, LOCALE_IDS, LOCALE_PREFERENCE_FIELD, LOCALE_SETTINGS_NAMESPACE, apply };
@@ -1,9 +1,19 @@
1
- /** Host registration for the browser locale preference. */
2
- import type { Context } from '@qilin-agent/kylin';
1
+ import type { Volatile, Context } from '@qilin-agent/kylin';
2
+ import z from '@qilin-agent/schemastery';
3
3
  export { LOCALE_IDS, LOCALE_PREFERENCE_FIELD, LOCALE_SETTINGS_NAMESPACE, type BuiltInLocaleId, type LocaleId, type LocaleSettings, } from './locale-settings.ts';
4
- /**
5
- * Register the durable locale section when a settings provider exists.
6
- * @param ctx - Host context whose optional settings service owns the section.
4
+ /** Runtime preferences projected to the browser. */
5
+ export interface Config {
6
+ /** Explicit locale; omission follows the browser. */
7
+ preference: Volatile<string | undefined>;
8
+ }
9
+ /** Live preferences projected to the browser. */
10
+ export declare const Config: z<Schemastery.ObjectS<NoInfer<{
11
+ preference: z<string, string, "volatile">;
12
+ }>>, Schemastery.ObjectT<NoInfer<{
13
+ preference: z<string, string, "volatile">;
14
+ }>>, "plain">;
15
+ /** Host preferences are consumed through the configuration form projection.
16
+ * @param ctx Host plugin context used for optional settings presentation.
7
17
  */
8
18
  export declare function apply(ctx: Context): void;
9
19
  //# sourceMappingURL=index.d.ts.map
@@ -17,6 +17,14 @@ export interface LocaleSettings {
17
17
  /** Explicit locale selection; absence delegates to the browser. */
18
18
  preference?: LocaleId;
19
19
  }
20
- /** Durable locale schema; also the wire envelope the browser scope validates against. */
21
- export declare const LocaleSettingsSchema: z<LocaleSettings>;
20
+ /** The durable locale fields, shared by the Host schema and the browser scope. */
21
+ export declare const LocaleSettingsFields: {
22
+ preference: z<string, string, "plain">;
23
+ };
24
+ /** Schema for the shared locale preference. */
25
+ export declare const LocaleSettingsSchema: z<Schemastery.ObjectS<NoInfer<{
26
+ preference: z<string, string, "plain">;
27
+ }>>, Schemastery.ObjectT<NoInfer<{
28
+ preference: z<string, string, "plain">;
29
+ }>>, "plain">;
22
30
  //# sourceMappingURL=locale-settings.d.ts.map
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@qilin-agent/client-locale",
3
3
  "description": "Locale plugin: Host-backed preference, extensible language catalog, browser fallback, and typed built-in dictionaries",
4
- "version": "3.1.5",
4
+ "version": "3.1.6",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -42,25 +42,25 @@
42
42
  },
43
43
  "license": "MIT",
44
44
  "peerDependencies": {
45
- "@qilin-agent/kylin": "~4.0.3"
45
+ "@qilin-agent/kylin": "~4.0.5"
46
46
  },
47
47
  "devDependencies": {
48
48
  "@types/react": "~18.3.1",
49
49
  "react": "^18.2.0",
50
- "@qilin-agent/kylin": "~4.0.3",
51
- "@qilin-agent/api-remotes": "3.1.5",
52
- "@qilin-agent/client-store": "3.1.5",
53
- "@qilin-agent/client-ui-primitives": "3.1.5",
54
- "@qilin-agent/client-test-runtime": "3.1.5",
55
- "@qilin-agent/client-ui-renderer": "3.1.5",
56
- "@qilin-agent/client-ui-settings": "3.1.5",
57
- "@qilin-agent/client-ui-slots": "3.1.5",
58
- "@qilin-agent/package-manifest": "3.1.5",
59
- "@qilin-agent/settings": "3.1.5",
60
- "@qilin-agent/client-connection": "3.1.5"
50
+ "@qilin-agent/client-store": "3.1.6",
51
+ "@qilin-agent/client-test-runtime": "3.1.6",
52
+ "@qilin-agent/kylin": "~4.0.5",
53
+ "@qilin-agent/api-remotes": "3.1.6",
54
+ "@qilin-agent/client-ui-primitives": "3.1.6",
55
+ "@qilin-agent/client-ui-renderer": "3.1.6",
56
+ "@qilin-agent/client-ui-settings": "3.1.6",
57
+ "@qilin-agent/client-ui-slots": "3.1.6",
58
+ "@qilin-agent/package-manifest": "3.1.6",
59
+ "@qilin-agent/settings": "3.1.6",
60
+ "@qilin-agent/client-connection": "3.1.6"
61
61
  },
62
62
  "dependencies": {
63
- "@qilin-agent/schemastery": "~3.18.3"
63
+ "@qilin-agent/schemastery": "~3.18.5"
64
64
  },
65
65
  "files": [
66
66
  "lib/index.js",