@pantoken/vue 0.1.11 → 0.1.13

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.mts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { iconSvg, register } from "@pantoken/web-components";
2
+ import { LocaleBundle, registerLocalized } from "@pantoken/i18n";
2
3
  //#region src/index.d.ts
3
4
  /**
4
5
  * Read a resolved token value. Returns `fallback` on the server.
@@ -20,7 +21,7 @@ interface VueAppLike {
20
21
  };
21
22
  }
22
23
  /**
23
- * The pantoken Vue plugin: `app.use(PantokenVue)`.
24
+ * The pantoken Vue plugin: `app.use(PantokenVue)` or `app.use(PantokenVue, { locale: "hu" })`.
24
25
  *
25
26
  * @example
26
27
  * ```ts
@@ -29,10 +30,13 @@ interface VueAppLike {
29
30
  * import "@pantoken/css";
30
31
  *
31
32
  * createApp(App).use(PantokenVue).mount("#app");
33
+ * createApp(App).use(PantokenVue, { locale: "hu" }).mount("#app"); // localized
32
34
  * ```
33
35
  */
34
36
  declare const PantokenVue: {
35
- install(app: VueAppLike): void;
37
+ install(app: VueAppLike, options?: {
38
+ locale?: string | LocaleBundle;
39
+ }): void;
36
40
  };
37
41
  //#endregion
38
- export { PantokenVue, PantokenVue as default, iconSvg, readToken, register };
42
+ export { PantokenVue, PantokenVue as default, iconSvg, readToken, register, registerLocalized };
package/dist/index.mjs CHANGED
@@ -1,4 +1,5 @@
1
1
  import { iconSvg, register, register as register$1 } from "@pantoken/web-components";
2
+ import { registerLocalized, registerLocalized as registerLocalized$1 } from "@pantoken/i18n";
2
3
  //#region src/index.ts
3
4
  /**
4
5
  * `@pantoken/vue` — a Vue plugin over `@pantoken/web-components`.
@@ -24,7 +25,7 @@ function readToken(name, fallback = "") {
24
25
  return getComputedStyle(document.documentElement).getPropertyValue(name).trim() || fallback;
25
26
  }
26
27
  /**
27
- * The pantoken Vue plugin: `app.use(PantokenVue)`.
28
+ * The pantoken Vue plugin: `app.use(PantokenVue)` or `app.use(PantokenVue, { locale: "hu" })`.
28
29
  *
29
30
  * @example
30
31
  * ```ts
@@ -33,13 +34,15 @@ function readToken(name, fallback = "") {
33
34
  * import "@pantoken/css";
34
35
  *
35
36
  * createApp(App).use(PantokenVue).mount("#app");
37
+ * createApp(App).use(PantokenVue, { locale: "hu" }).mount("#app"); // localized
36
38
  * ```
37
39
  */
38
- const PantokenVue = { install(app) {
39
- register$1();
40
- const options = app.config.compilerOptions ??= {};
41
- const previous = options.isCustomElement;
42
- options.isCustomElement = (tag) => tag.startsWith("instui-") || (previous?.(tag) ?? false);
40
+ const PantokenVue = { install(app, options = {}) {
41
+ if (options.locale) registerLocalized$1(options.locale);
42
+ else register$1();
43
+ const compilerOptions = app.config.compilerOptions ??= {};
44
+ const previous = compilerOptions.isCustomElement;
45
+ compilerOptions.isCustomElement = (tag) => tag.startsWith("instui-") || (previous?.(tag) ?? false);
43
46
  } };
44
47
  //#endregion
45
- export { PantokenVue, PantokenVue as default, iconSvg, readToken, register };
48
+ export { PantokenVue, PantokenVue as default, iconSvg, readToken, register, registerLocalized };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pantoken/vue",
3
- "version": "0.1.11",
3
+ "version": "0.1.13",
4
4
  "description": "Vue plugin for pantoken: registers the web components and reads tokens.",
5
5
  "homepage": "https://pantoken.iywahl.com",
6
6
  "bugs": "https://github.com/thedannywahl/pantoken/issues",
@@ -33,6 +33,7 @@
33
33
  "check": "vp check"
34
34
  },
35
35
  "dependencies": {
36
+ "@pantoken/i18n": "workspace:*",
36
37
  "@pantoken/web-components": "workspace:*"
37
38
  },
38
39
  "devDependencies": {