vueless 1.1.1-beta.3 → 1.1.1-beta.4

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.
@@ -1,10 +1,11 @@
1
1
  import type { I18n } from "vue-i18n";
2
+ import type { LocaleInstance } from "../types.ts";
2
3
 
3
- export default function createVueI18nAdapter(i18n: I18n) {
4
+ export function createVueI18nAdapter(i18n: I18n): LocaleInstance {
4
5
  return {
5
6
  name: "vue-i18n",
6
7
  locale: i18n.global.locale,
7
- fallback: i18n.global.fallbackLocale,
8
+ fallback: i18n.global.fallbackLocale as string,
8
9
  messages: i18n.global.messages,
9
10
  // @ts-expect-error Type instantiation is excessively deep and possibly infinite
10
11
  t: (key: string, ...params: unknown[]) => i18n.global.t(key, params),
@@ -4,33 +4,12 @@ import { merge } from "lodash-es";
4
4
  import en from "./locales/en.ts";
5
5
 
6
6
  import type { Ref } from "vue";
7
- import type { UnknownObject } from "../types.ts";
8
7
  import type { VueMessageType } from "vue-i18n";
9
-
10
- export interface LocaleMessages {
11
- [key: string]: LocaleMessages | string;
12
- }
13
-
14
- export interface LocaleOptions {
15
- messages?: LocaleMessages;
16
- locale?: string;
17
- fallback?: string;
18
- adapter?: LocaleInstance;
19
- }
20
-
21
- export interface LocaleInstance {
22
- name: string;
23
- messages: Ref<LocaleMessages>;
24
- locale: Ref<string>;
25
- fallback: Ref<string>;
26
- t: (key: string, ...params: unknown[]) => string;
27
- n: (value: number) => string;
28
- tm: <TMassages>(key: string) => Partial<TMassages>;
29
- }
8
+ import type { UnknownObject, LocaleOptions, LocaleMessages, LocaleInstance } from "../types.ts";
30
9
 
31
10
  const FALLBACK_LOCALE_CODE = "en";
32
11
 
33
- export default function createVuelessAdapter(options?: LocaleOptions): LocaleInstance {
12
+ export function createVuelessAdapter(options?: LocaleOptions): LocaleInstance {
34
13
  const current = shallowRef(options?.locale ?? FALLBACK_LOCALE_CODE);
35
14
  const fallback = shallowRef(options?.fallback ?? FALLBACK_LOCALE_CODE);
36
15
 
@@ -1,8 +1,8 @@
1
1
  import { inject } from "vue";
2
- import createVuelessAdapter from "../adapter.locale/vueless.ts";
2
+ import { createVuelessAdapter } from "../adapter.locale/vueless.ts";
3
3
 
4
- import type { LocaleInstance, LocaleOptions } from "../adapter.locale/vueless.ts";
5
4
  import type { InjectionKey } from "vue";
5
+ import type { LocaleInstance, LocaleOptions } from "../types.ts";
6
6
 
7
7
  export const LocaleSymbol: InjectionKey<LocaleInstance> = Symbol.for("vueless:locale");
8
8
 
package/index.d.ts CHANGED
@@ -12,7 +12,8 @@ export {
12
12
  } from "./utils/helper.ts";
13
13
  export { getArgTypes, getSlotNames, getSlotsFragment, getSource } from "./utils/storybook.ts";
14
14
  export { isMac, isPWA, isIOS, isAndroid, isMobileApp, isWindows } from "./utils/platform.ts";
15
- export { default as createVueI18nAdapter } from "./adapter.locale/vue-i18n.ts";
15
+ export { createVueI18nAdapter } from "./adapter.locale/vue-i18n.ts";
16
+ export { createVuelessAdapter } from "./adapter.locale/vueless.ts";
16
17
  export { default as defaultEnLocale } from "./adapter.locale/locales/en.ts";
17
18
  export { default as useUI } from "./composables/useUI.ts";
18
19
  export { useLocale } from "./composables/useLocale.ts";
package/index.ts CHANGED
@@ -13,7 +13,8 @@ export { cx, cva, compose, getDefaults } from "./utils/ui.ts";
13
13
  export { getArgTypes, getSlotNames, getSlotsFragment, getSource, getDocsDescription } from "./utils/storybook.ts";
14
14
  export { isSSR, isCSR, getRandomId, setTitle, createDebounce, hasSlotContent } from "./utils/helper.ts";
15
15
  export { isMac, isPWA, isIOS, isAndroid, isMobileApp, isWindows } from "./utils/platform.ts";
16
- export { default as createVueI18nAdapter } from "./adapter.locale/vue-i18n.ts";
16
+ export { createVueI18nAdapter } from "./adapter.locale/vue-i18n.ts";
17
+ export { createVuelessAdapter } from "./adapter.locale/vueless.ts";
17
18
  export { default as defaultEnLocale } from "./adapter.locale/locales/en.ts";
18
19
  export { default as useUI } from "./composables/useUI.ts";
19
20
  export { useLocale } from "./composables/useLocale.ts";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vueless",
3
- "version": "1.1.1-beta.3",
3
+ "version": "1.1.1-beta.4",
4
4
  "description": "Vue Styleless UI Component Library, powered by Tailwind CSS.",
5
5
  "author": "Johnny Grid <hello@vueless.com> (https://vueless.com)",
6
6
  "homepage": "https://vueless.com",
@@ -45,7 +45,6 @@
45
45
  "vuedraggable": "4.1.0"
46
46
  },
47
47
  "devDependencies": {
48
- "@eslint/js": "^9.32.0",
49
48
  "@material-symbols/svg-500": "^0.33.0",
50
49
  "@release-it/bumper": "^7.0.5",
51
50
  "@tsconfig/node20": "^20.1.6",
package/types.ts CHANGED
@@ -61,7 +61,6 @@ import UListboxConfig from "./ui.form-listbox/config.ts";
61
61
  import type { Props } from "tippy.js";
62
62
  import type { Config as TailwindConfig } from "tailwindcss";
63
63
  import type { ComputedRef, Ref, ComponentInternalInstance } from "vue";
64
- import type { LocaleOptions } from "./adapter.locale/vueless.ts";
65
64
 
66
65
  export enum ColorMode {
67
66
  Dark = "dark",
@@ -366,6 +365,27 @@ export interface CreateVuelessOptions extends Config {
366
365
  config?: Config;
367
366
  }
368
367
 
368
+ export interface LocaleOptions {
369
+ messages?: LocaleMessages;
370
+ locale?: string;
371
+ fallback?: string;
372
+ adapter?: LocaleInstance;
373
+ }
374
+
375
+ export interface LocaleInstance {
376
+ name: string;
377
+ messages: LocaleMessages | Ref<LocaleMessages>;
378
+ locale: string | Ref<string>;
379
+ fallback: string | Ref<string>;
380
+ t: (key: string, ...params: unknown[]) => string;
381
+ n: (value: number) => string;
382
+ tm: <TMassages>(key: string) => Partial<TMassages>;
383
+ }
384
+
385
+ export interface LocaleMessages {
386
+ [key: string]: LocaleMessages | string;
387
+ }
388
+
369
389
  export interface VuelessCssVariables {
370
390
  /* Outline size CSS variables */
371
391
  "--vl-outline-sm": string;
@@ -6,7 +6,7 @@ import UIcon from "../../ui.image-icon/UIcon.vue";
6
6
 
7
7
  import { NotificationType } from "../constants.ts";
8
8
  import { LocaleSymbol } from "../../composables/useLocale.ts";
9
- import createVuelessAdapter from "../../adapter.locale/vueless.ts";
9
+ import { createVuelessAdapter } from "../../adapter.locale/vueless.ts";
10
10
 
11
11
  import type { Props, Notification } from "../types.ts";
12
12