vueless 1.1.1-beta.2 → 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.2",
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;
@@ -5,10 +5,8 @@ import UBoilerplate from "../UBoilerplate.vue";
5
5
  import defaultConfig from "../config.ts";
6
6
 
7
7
  describe("UBoilerplate.vue", () => {
8
- // Props tests
9
8
  describe("Props", () => {
10
- // DataTest prop
11
- it("accepts the dataTest prop", () => {
9
+ it("Data Test – accepts the dataTest prop", () => {
12
10
  const dataTest = "test-boilerplate";
13
11
 
14
12
  const component = mount(UBoilerplate, {
@@ -20,8 +18,7 @@ describe("UBoilerplate.vue", () => {
20
18
  expect(component.attributes("data-test")).toBe(dataTest);
21
19
  });
22
20
 
23
- // Config prop
24
- it("applies custom config when provided", () => {
21
+ it("Config – applies custom config when provided", () => {
25
22
  const customClass = "custom-class";
26
23
  const config = {
27
24
  wrapper: customClass,
@@ -38,23 +35,4 @@ describe("UBoilerplate.vue", () => {
38
35
  expect(component.attributes("class")).toContain(defaultConfig.wrapper);
39
36
  });
40
37
  });
41
-
42
- /*
43
- // Slots tests
44
- describe("Slots", () => {
45
- // Default slot
46
- it("renders content from default slot", () => {
47
- const slotContent = "Custom Content";
48
-
49
- const component = mount(UBoilerplate, {
50
- slots: {
51
- default: slotContent,
52
- },
53
- });
54
-
55
- expect(component.text()).not.toBe("Boilerplate");
56
- expect(component.text()).toBe(slotContent);
57
- });
58
- });
59
- */
60
38
  });
@@ -225,7 +225,7 @@ describe("UDropdownButton.vue", () => {
225
225
  });
226
226
 
227
227
  // ToggleIcon prop (boolean: false)
228
- it("shows default toggle icon when toggleIcon is true", () => {
228
+ it("shows default toggle icon when toggleIcon is false", () => {
229
229
  const toggleIcon = false;
230
230
 
231
231
  const component = mount(UDropdownButton, {
@@ -291,7 +291,7 @@ describe("UInput.vue", () => {
291
291
  expect(component.get("input").attributes("id")).toBe(idValue);
292
292
  });
293
293
 
294
- it("DataTest – sets data-test attribute on input", () => {
294
+ it("Data Test – sets data-test attribute on input", () => {
295
295
  const dataTestValue = "test-input";
296
296
 
297
297
  const component = mount(UInput, {
@@ -261,7 +261,7 @@ describe("UInputCounter.vue", () => {
261
261
  },
262
262
  });
263
263
 
264
- component.get(`[data-test='test-${testCase}']`);
264
+ expect(component.get(`[data-test='test-${testCase}']`)).toBeTruthy();
265
265
  });
266
266
  });
267
267
  });
@@ -250,7 +250,7 @@ describe("UInputFile.vue", () => {
250
250
  },
251
251
  });
252
252
 
253
- component.get(`[data-test="${dataTestValue}-${key}"]`);
253
+ expect(component.get(`[data-test="${dataTestValue}-${key}"]`)).toBeTruthy();
254
254
  });
255
255
  });
256
256
  });
@@ -172,7 +172,7 @@ describe("UInputPassword.vue", () => {
172
172
 
173
173
  await flushPromises();
174
174
 
175
- component.get(`[data-test='${dataTest}-password-icon']`);
175
+ expect(component.get(`[data-test='${dataTest}-password-icon']`)).toBeTruthy();
176
176
  });
177
177
  });
178
178
 
@@ -215,7 +215,7 @@ describe("UInputPassword.vue", () => {
215
215
  },
216
216
  });
217
217
 
218
- component.get(`.${testClass}`);
218
+ expect(component.get(`.${testClass}`)).toBeTruthy();
219
219
  });
220
220
 
221
221
  it("Left – exposes leftIcon prop", () => {
@@ -242,7 +242,7 @@ describe("UInputPassword.vue", () => {
242
242
  },
243
243
  });
244
244
 
245
- component.get(`.${testClass}`);
245
+ expect(component.get(`.${testClass}`)).toBeTruthy();
246
246
  });
247
247
 
248
248
  it("Right – exposes password visibility state", async () => {
@@ -18,8 +18,8 @@ describe("UInputRating.vue", () => {
18
18
 
19
19
  const icons = component.findAllComponents(UIcon);
20
20
 
21
- expect(icons[2].props("name")).that.includes("star-fill");
22
- expect(icons[3].props("name")).that.includes("star");
21
+ expect(icons[2].props("name")).toContain("star-fill");
22
+ expect(icons[3].props("name")).toContain("star");
23
23
  });
24
24
 
25
25
  it("Model Value – updates value on click", async () => {
@@ -227,7 +227,7 @@ describe("UInputSearch.vue", () => {
227
227
  expect(component.get("input").attributes("disabled")).toBeDefined();
228
228
  });
229
229
 
230
- it("Data Test – applies the correct data-test attribute", async () => {
230
+ it("Data Test – applies the correct data-test attribute", () => {
231
231
  const testCases = [
232
232
  { testCase: "search-icon" },
233
233
  { testCase: "clear" },
@@ -248,7 +248,7 @@ describe("UInputSearch.vue", () => {
248
248
 
249
249
  await flushPromises();
250
250
 
251
- component.get(`[data-test='${resolvedDataTest}']`);
251
+ expect(component.get(`[data-test='${resolvedDataTest}']`)).toBeTruthy();
252
252
  });
253
253
  });
254
254
  });
@@ -20,7 +20,7 @@ describe("UIcon.vue", () => {
20
20
 
21
21
  await flushPromises();
22
22
 
23
- component.get("[vl-key='icon']");
23
+ expect(component.get("[vl-key='icon']")).toBeTruthy();
24
24
  });
25
25
 
26
26
  it("Src – renders icon based on provided src", async () => {
@@ -32,7 +32,7 @@ describe("UIcon.vue", () => {
32
32
 
33
33
  await flushPromises();
34
34
 
35
- component.get("[vl-key='icon']");
35
+ expect(component.get("[vl-key='icon']")).toBeTruthy();
36
36
  });
37
37
 
38
38
  it("Color – applies correct color classes", () => {
@@ -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