@vnejs/plugins.text.locs 0.1.8 → 0.1.10
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/dist/index.d.ts +1 -1
- package/dist/index.js +1 -0
- package/dist/modules/locs.d.ts +3 -2
- package/dist/modules/locs.js +1 -1
- package/dist/utils/locs.d.ts +0 -4
- package/package.json +1 -1
- package/src/index.ts +2 -0
- package/src/modules/locs.ts +2 -2
- package/src/utils/locs.ts +0 -5
package/dist/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import "@vnejs/plugins.text.locs.contract";
|
package/dist/index.js
CHANGED
package/dist/modules/locs.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Module } from "@vnejs/module";
|
|
2
|
+
import type { SettingsChangedResult } from "@vnejs/plugins.core.settings.contract";
|
|
2
3
|
import type { LocsPluginConstants, LocsPluginEvents, LocsPluginParams, LocsPluginSettings } from "../types.js";
|
|
3
|
-
import type { ComponentsInjectResult, LocsComponent, LocsGetPayload, LocsLoadPayload,
|
|
4
|
+
import type { ComponentsInjectResult, LocsComponent, LocsGetPayload, LocsLoadPayload, TextReplaceHandlerPayload } from "../utils/locs.js";
|
|
4
5
|
export declare class TextLocs extends Module<LocsPluginEvents, LocsPluginConstants, LocsPluginSettings, LocsPluginParams> {
|
|
5
6
|
name: string;
|
|
6
7
|
loading: Record<string, Promise<void> | undefined>;
|
|
@@ -11,7 +12,7 @@ export declare class TextLocs extends Module<LocsPluginEvents, LocsPluginConstan
|
|
|
11
12
|
onLocsLoad: ({ label, lang }?: LocsLoadPayload) => Promise<void>;
|
|
12
13
|
onLocsChanged: () => Promise<void>;
|
|
13
14
|
onLocsGet: ({ label, lang }?: LocsGetPayload) => Promise<unknown>;
|
|
14
|
-
onSettingChange: ({ name, value }
|
|
15
|
+
onSettingChange: ({ name, value }: SettingsChangedResult) => false | Promise<unknown[]> | undefined;
|
|
15
16
|
getLoadedLocs: (label?: string, lang?: string | null) => Promise<unknown> | undefined;
|
|
16
17
|
loadLoc: (label?: string) => Promise<void>;
|
|
17
18
|
setLang: (lang: string) => Promise<unknown[]> | undefined;
|
package/dist/modules/locs.js
CHANGED
|
@@ -53,7 +53,7 @@ export class TextLocs extends Module {
|
|
|
53
53
|
await this.emit(this.EVENTS.LOCS.LOAD, { label, lang });
|
|
54
54
|
return this.getLoadedLocs(label, lang);
|
|
55
55
|
};
|
|
56
|
-
onSettingChange = ({ name, value }
|
|
56
|
+
onSettingChange = ({ name, value }) => name === this.SETTINGS.LOCS.LANG && this.setLang(value);
|
|
57
57
|
getLoadedLocs = (label, lang) => this.emitOne(this.EVENTS.MEMORY.GET, { module: this.name, key: `${lang || this.shared.lang}:${label}` });
|
|
58
58
|
loadLoc = (label) => {
|
|
59
59
|
const [loadingId, url] = [`${this.shared.lang}:${label}`, this.media.locs?.[`${this.shared.lang}/${label}`]];
|
package/dist/utils/locs.d.ts
CHANGED
package/package.json
CHANGED
package/src/index.ts
CHANGED
package/src/modules/locs.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Module } from "@vnejs/module";
|
|
2
2
|
import { toJson } from "@vnejs/helpers";
|
|
3
|
+
import type { SettingsChangedResult } from "@vnejs/plugins.core.settings.contract";
|
|
3
4
|
|
|
4
5
|
import type { LocsPluginConstants, LocsPluginEvents, LocsPluginParams, LocsPluginSettings } from "../types.js";
|
|
5
6
|
import type {
|
|
@@ -8,7 +9,6 @@ import type {
|
|
|
8
9
|
LocsGetPayload,
|
|
9
10
|
LocsLoadPayload,
|
|
10
11
|
LocsRecord,
|
|
11
|
-
SettingsChangedPayload,
|
|
12
12
|
TextReplaceHandlerPayload,
|
|
13
13
|
} from "../utils/locs.js";
|
|
14
14
|
|
|
@@ -84,7 +84,7 @@ export class TextLocs extends Module<LocsPluginEvents, LocsPluginConstants, Locs
|
|
|
84
84
|
return this.getLoadedLocs(label, lang);
|
|
85
85
|
};
|
|
86
86
|
|
|
87
|
-
onSettingChange = ({ name, value }:
|
|
87
|
+
onSettingChange = ({ name, value }: SettingsChangedResult) => name === this.SETTINGS.LOCS.LANG && this.setLang(value as string);
|
|
88
88
|
|
|
89
89
|
getLoadedLocs = (label?: string, lang?: string | null) =>
|
|
90
90
|
this.emitOne(this.EVENTS.MEMORY.GET, { module: this.name, key: `${lang || this.shared.lang}:${label}` });
|
package/src/utils/locs.ts
CHANGED