@nuxt/ui 3.1.1 → 3.1.3

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.
Files changed (126) hide show
  1. package/.nuxt/ui/alert.ts +0 -5
  2. package/.nuxt/ui/badge.ts +30 -7
  3. package/.nuxt/ui/button-group.ts +0 -13
  4. package/.nuxt/ui/button.ts +2 -7
  5. package/.nuxt/ui/calendar.ts +1 -1
  6. package/.nuxt/ui/carousel.ts +0 -5
  7. package/.nuxt/ui/checkbox-group.ts +144 -1
  8. package/.nuxt/ui/color-picker.ts +2 -2
  9. package/.nuxt/ui/context-menu.ts +2 -1
  10. package/.nuxt/ui/dropdown-menu.ts +2 -1
  11. package/.nuxt/ui/input-menu.ts +4 -13
  12. package/.nuxt/ui/input-number.ts +10 -0
  13. package/.nuxt/ui/input.ts +2 -11
  14. package/.nuxt/ui/link.ts +12 -5
  15. package/.nuxt/ui/navigation-menu.ts +43 -34
  16. package/.nuxt/ui/radio-group.ts +1 -1
  17. package/.nuxt/ui/select-menu.ts +4 -13
  18. package/.nuxt/ui/select.ts +4 -13
  19. package/.nuxt/ui/tabs.ts +4 -3
  20. package/.nuxt/ui/textarea.ts +2 -11
  21. package/.nuxt/ui/toast.ts +0 -5
  22. package/.nuxt/ui/tooltip.ts +1 -1
  23. package/.nuxt/ui.css +4 -1
  24. package/cli/templates.mjs +2 -2
  25. package/dist/module.json +1 -1
  26. package/dist/module.mjs +14 -5
  27. package/dist/runtime/components/Accordion.vue +9 -9
  28. package/dist/runtime/components/Accordion.vue.d.ts +2 -0
  29. package/dist/runtime/components/Alert.vue +1 -1
  30. package/dist/runtime/components/Avatar.vue +2 -2
  31. package/dist/runtime/components/AvatarGroup.vue +1 -1
  32. package/dist/runtime/components/Badge.vue +5 -3
  33. package/dist/runtime/components/Badge.vue.d.ts +2 -0
  34. package/dist/runtime/components/Breadcrumb.vue +8 -8
  35. package/dist/runtime/components/Breadcrumb.vue.d.ts +2 -0
  36. package/dist/runtime/components/Button.vue +2 -3
  37. package/dist/runtime/components/Button.vue.d.ts +1 -1
  38. package/dist/runtime/components/Calendar.vue +2 -1
  39. package/dist/runtime/components/Card.vue +1 -1
  40. package/dist/runtime/components/Carousel.vue +5 -2
  41. package/dist/runtime/components/Carousel.vue.d.ts +6 -1
  42. package/dist/runtime/components/Checkbox.vue +2 -2
  43. package/dist/runtime/components/CheckboxGroup.vue +8 -5
  44. package/dist/runtime/components/CheckboxGroup.vue.d.ts +7 -1
  45. package/dist/runtime/components/Chip.vue +1 -1
  46. package/dist/runtime/components/Collapsible.vue +1 -1
  47. package/dist/runtime/components/ColorPicker.vue +1 -1
  48. package/dist/runtime/components/CommandPalette.vue +18 -18
  49. package/dist/runtime/components/CommandPalette.vue.d.ts +2 -0
  50. package/dist/runtime/components/ContextMenu.vue.d.ts +2 -0
  51. package/dist/runtime/components/ContextMenuContent.vue +69 -67
  52. package/dist/runtime/components/Drawer.vue +15 -1
  53. package/dist/runtime/components/DropdownMenu.vue.d.ts +2 -0
  54. package/dist/runtime/components/DropdownMenuContent.vue +71 -69
  55. package/dist/runtime/components/FormField.vue +5 -5
  56. package/dist/runtime/components/Input.vue +3 -2
  57. package/dist/runtime/components/Input.vue.d.ts +30 -29
  58. package/dist/runtime/components/InputMenu.vue +20 -20
  59. package/dist/runtime/components/InputMenu.vue.d.ts +210 -0
  60. package/dist/runtime/components/InputNumber.vue +13 -7
  61. package/dist/runtime/components/InputNumber.vue.d.ts +78 -0
  62. package/dist/runtime/components/Link.vue +5 -14
  63. package/dist/runtime/components/Modal.vue +2 -2
  64. package/dist/runtime/components/Modal.vue.d.ts +3 -0
  65. package/dist/runtime/components/NavigationMenu.vue +106 -41
  66. package/dist/runtime/components/NavigationMenu.vue.d.ts +38 -7
  67. package/dist/runtime/components/Pagination.vue +1 -1
  68. package/dist/runtime/components/PinInput.vue +1 -1
  69. package/dist/runtime/components/Popover.vue +4 -0
  70. package/dist/runtime/components/Popover.vue.d.ts +1 -0
  71. package/dist/runtime/components/Progress.vue +1 -1
  72. package/dist/runtime/components/RadioGroup.vue +8 -8
  73. package/dist/runtime/components/RadioGroup.vue.d.ts +2 -0
  74. package/dist/runtime/components/Select.vue +15 -15
  75. package/dist/runtime/components/Select.vue.d.ts +3 -1
  76. package/dist/runtime/components/SelectMenu.vue +16 -16
  77. package/dist/runtime/components/SelectMenu.vue.d.ts +2 -0
  78. package/dist/runtime/components/Separator.vue +1 -1
  79. package/dist/runtime/components/Slideover.vue +9 -2
  80. package/dist/runtime/components/Slideover.vue.d.ts +3 -0
  81. package/dist/runtime/components/Slider.vue +16 -4
  82. package/dist/runtime/components/Slider.vue.d.ts +26 -20
  83. package/dist/runtime/components/Stepper.vue +10 -10
  84. package/dist/runtime/components/Stepper.vue.d.ts +2 -0
  85. package/dist/runtime/components/Switch.vue +1 -1
  86. package/dist/runtime/components/Table.vue +2 -2
  87. package/dist/runtime/components/Tabs.vue +6 -6
  88. package/dist/runtime/components/Tabs.vue.d.ts +2 -0
  89. package/dist/runtime/components/Textarea.vue +7 -4
  90. package/dist/runtime/components/Textarea.vue.d.ts +30 -31
  91. package/dist/runtime/components/Toast.vue +3 -2
  92. package/dist/runtime/components/Toast.vue.d.ts +6 -0
  93. package/dist/runtime/components/Toaster.vue +4 -4
  94. package/dist/runtime/components/Toaster.vue.d.ts +6 -0
  95. package/dist/runtime/components/Tree.vue +10 -10
  96. package/dist/runtime/components/Tree.vue.d.ts +2 -0
  97. package/dist/runtime/composables/useFormField.d.ts +1 -1
  98. package/dist/runtime/composables/useFormField.js +2 -1
  99. package/dist/runtime/inertia/components/Link.vue +46 -60
  100. package/dist/runtime/inertia/components/Link.vue.d.ts +1 -1
  101. package/dist/runtime/inertia/components/LinkBase.vue +68 -0
  102. package/dist/runtime/inertia/components/LinkBase.vue.d.ts +25 -0
  103. package/dist/runtime/inertia/stubs.d.ts +1 -1
  104. package/dist/runtime/inertia/stubs.js +1 -1
  105. package/dist/runtime/locale/index.d.ts +7 -2
  106. package/dist/runtime/locale/index.js +7 -2
  107. package/dist/runtime/locale/ky.d.ts +3 -0
  108. package/dist/runtime/locale/ky.js +54 -0
  109. package/dist/runtime/locale/lt.d.ts +3 -0
  110. package/dist/runtime/locale/lt.js +54 -0
  111. package/dist/runtime/locale/mn.d.ts +3 -0
  112. package/dist/runtime/locale/mn.js +54 -0
  113. package/dist/runtime/locale/ms.d.ts +3 -0
  114. package/dist/runtime/locale/ms.js +54 -0
  115. package/dist/runtime/locale/sl.d.ts +3 -0
  116. package/dist/runtime/locale/sl.js +54 -0
  117. package/dist/runtime/utils/link.d.ts +1 -0
  118. package/dist/runtime/utils/link.js +12 -0
  119. package/dist/runtime/vue/components/Link.vue +27 -40
  120. package/dist/runtime/vue/composables/useAppConfig.js +3 -1
  121. package/dist/runtime/vue/stubs.d.ts +1 -1
  122. package/dist/runtime/vue/stubs.js +1 -1
  123. package/dist/shared/{ui.CbtTMMzt.mjs → ui.Bix4DSU4.mjs} +153 -52
  124. package/dist/unplugin.mjs +1 -1
  125. package/dist/vite.mjs +1 -1
  126. package/package.json +28 -28
@@ -0,0 +1,54 @@
1
+ import { defineLocale } from "../composables/defineLocale.js";
2
+ export default defineLocale({
3
+ name: "\u041A\u044B\u0440\u0433\u044B\u0437\u0447\u0430",
4
+ code: "ky",
5
+ messages: {
6
+ inputMenu: {
7
+ noMatch: "\u042D\u0447 \u043D\u0435\u0440\u0441\u0435 \u0442\u0430\u0431\u044B\u043B\u0433\u0430\u043D \u0436\u043E\u043A",
8
+ noData: "\u041C\u0430\u0430\u043B\u044B\u043C\u0430\u0442 \u0436\u043E\u043A",
9
+ create: '"{label}" \u0436\u0430\u0441\u043E\u043E'
10
+ },
11
+ calendar: {
12
+ prevYear: "\u0410\u043B\u0434\u044B\u04A3\u043A\u044B \u0436\u044B\u043B",
13
+ nextYear: "\u041A\u0438\u0439\u0438\u043D\u043A\u0438 \u0436\u044B\u043B",
14
+ prevMonth: "\u0410\u043B\u0434\u044B\u04A3\u043A\u044B \u0430\u0439",
15
+ nextMonth: "\u041A\u0438\u0439\u0438\u043D\u043A\u0438 \u0430\u0439"
16
+ },
17
+ inputNumber: {
18
+ increment: "\u041A\u043E\u0448\u0443\u0443",
19
+ decrement: "\u0410\u0437\u0430\u0439\u0442\u0443\u0443"
20
+ },
21
+ commandPalette: {
22
+ placeholder: "\u0411\u0443\u0439\u0440\u0443\u043A \u043A\u0438\u0440\u0433\u0438\u0437\u0438\u04A3\u0438\u0437 \u0436\u0435 \u0438\u0437\u0434\u04E9\u04E9\u2026",
23
+ noMatch: "\u042D\u0447 \u043D\u0435\u0440\u0441\u0435 \u0442\u0430\u0431\u044B\u043B\u0433\u0430\u043D \u0436\u043E\u043A",
24
+ noData: "\u041C\u0430\u0430\u043B\u044B\u043C\u0430\u0442 \u0436\u043E\u043A",
25
+ close: "\u0416\u0430\u0431\u0443\u0443"
26
+ },
27
+ selectMenu: {
28
+ noMatch: "\u0421\u04AF\u0439\u043B\u04E9\u0448\u043A\u04E9\u043D \u043C\u0430\u0430\u043B\u044B\u043C\u0430\u0442\u0442\u0430\u0440 \u0436\u043E\u043A",
29
+ noData: "\u041C\u0430\u0430\u043B\u044B\u043C\u0430\u0442 \u0436\u043E\u043A",
30
+ create: '"{label}" \u0436\u0430\u0441\u043E\u043E',
31
+ search: "\u0418\u0437\u0434\u04E9\u04E9..."
32
+ },
33
+ toast: {
34
+ close: "\u0416\u0430\u0431\u0443\u0443"
35
+ },
36
+ carousel: {
37
+ prev: "\u0410\u043B\u0434\u044B\u04A3\u043A\u044B",
38
+ next: "\u041A\u0438\u0439\u0438\u043D\u043A\u0438",
39
+ goto: "{slide} \u0441\u043B\u0430\u0439\u0434\u0433\u0430 \u04E9\u0442\u04AF\u04AF"
40
+ },
41
+ modal: {
42
+ close: "\u0416\u0430\u0431\u0443\u0443"
43
+ },
44
+ slideover: {
45
+ close: "\u0416\u0430\u0431\u0443\u0443"
46
+ },
47
+ alert: {
48
+ close: "\u0416\u0430\u0431\u0443\u0443"
49
+ },
50
+ table: {
51
+ noData: "\u041C\u0430\u0430\u043B\u044B\u043C\u0430\u0442 \u0436\u043E\u043A"
52
+ }
53
+ }
54
+ });
@@ -0,0 +1,3 @@
1
+ import type { Messages } from '../types';
2
+ declare const _default: import("../types").Locale<Messages>;
3
+ export default _default;
@@ -0,0 +1,54 @@
1
+ import { defineLocale } from "../composables/defineLocale.js";
2
+ export default defineLocale({
3
+ name: "Lietuvi\u0173",
4
+ code: "lt",
5
+ messages: {
6
+ inputMenu: {
7
+ noMatch: "N\u0117ra atitinkan\u010Di\u0173 duomen\u0173",
8
+ noData: "N\u0117ra duomen\u0173",
9
+ create: "Sukurti \u201E{label}\u201C"
10
+ },
11
+ calendar: {
12
+ prevYear: "Ankstesni metai",
13
+ nextYear: "Kiti metai",
14
+ prevMonth: "Ankstesnis m\u0117nuo",
15
+ nextMonth: "Kitas m\u0117nuo"
16
+ },
17
+ inputNumber: {
18
+ increment: "Padidinti",
19
+ decrement: "Suma\u017Einti"
20
+ },
21
+ commandPalette: {
22
+ placeholder: "\u012Eveskite komand\u0105 arba ie\u0161kokite...",
23
+ noMatch: "N\u0117ra atitinkan\u010Di\u0173 duomen\u0173",
24
+ noData: "N\u0117ra duomen\u0173",
25
+ close: "U\u017Edaryti"
26
+ },
27
+ selectMenu: {
28
+ noMatch: "N\u0117ra atitinkan\u010Di\u0173 duomen\u0173",
29
+ noData: "N\u0117ra duomen\u0173",
30
+ create: "Sukurti \u201E{label}\u201C",
31
+ search: "Ie\u0161koti..."
32
+ },
33
+ toast: {
34
+ close: "U\u017Edaryti"
35
+ },
36
+ carousel: {
37
+ prev: "Atgal",
38
+ next: "Pirmyn",
39
+ goto: "Eiti \u012F skaidr\u0119 {slide}"
40
+ },
41
+ modal: {
42
+ close: "U\u017Edaryti"
43
+ },
44
+ slideover: {
45
+ close: "U\u017Edaryti"
46
+ },
47
+ alert: {
48
+ close: "U\u017Edaryti"
49
+ },
50
+ table: {
51
+ noData: "N\u0117ra duomen\u0173"
52
+ }
53
+ }
54
+ });
@@ -0,0 +1,3 @@
1
+ import type { Messages } from '../types';
2
+ declare const _default: import("../types").Locale<Messages>;
3
+ export default _default;
@@ -0,0 +1,54 @@
1
+ import { defineLocale } from "../composables/defineLocale.js";
2
+ export default defineLocale({
3
+ name: "\u041C\u043E\u043D\u0433\u043E\u043B",
4
+ code: "mn",
5
+ messages: {
6
+ inputMenu: {
7
+ noMatch: "\u0422\u043E\u0445\u0438\u0440\u043E\u0445 \u043C\u044D\u0434\u044D\u044D\u043B\u044D\u043B \u043E\u043B\u0434\u0441\u043E\u043D\u0433\u04AF\u0439",
8
+ noData: "\u041C\u044D\u0434\u044D\u044D\u043B\u044D\u043B \u0431\u0430\u0439\u0445\u0433\u04AF\u0439",
9
+ create: '"{label}" \u04AF\u04AF\u0441\u0433\u044D\u0445'
10
+ },
11
+ calendar: {
12
+ prevYear: "\u04E8\u043C\u043D\u04E9\u0445 \u0436\u0438\u043B",
13
+ nextYear: "\u0414\u0430\u0440\u0430\u0430 \u0436\u0438\u043B",
14
+ prevMonth: "\u04E8\u043C\u043D\u04E9\u0445 \u0441\u0430\u0440",
15
+ nextMonth: "\u0414\u0430\u0440\u0430\u0430 \u0441\u0430\u0440"
16
+ },
17
+ inputNumber: {
18
+ increment: "\u041D\u044D\u043C\u044D\u0445",
19
+ decrement: "\u0425\u0430\u0441\u0430\u0445"
20
+ },
21
+ commandPalette: {
22
+ placeholder: "\u041A\u043E\u043C\u043C\u0430\u043D\u0434 \u0431\u0438\u0447\u0438\u0445 \u044D\u0441\u0432\u044D\u043B \u0445\u0430\u0439\u043B\u0442 \u0445\u0438\u0439\u0445...",
23
+ noMatch: "\u0422\u043E\u0445\u0438\u0440\u043E\u0445 \u043C\u044D\u0434\u044D\u044D\u043B\u044D\u043B \u043E\u043B\u0434\u0441\u043E\u043D\u0433\u04AF\u0439",
24
+ noData: "\u041C\u044D\u0434\u044D\u044D\u043B\u044D\u043B \u0431\u0430\u0439\u0445\u0433\u04AF\u0439",
25
+ close: "\u0425\u0430\u0430\u0445"
26
+ },
27
+ selectMenu: {
28
+ noMatch: "\u0422\u043E\u0445\u0438\u0440\u043E\u0445 \u043C\u044D\u0434\u044D\u044D\u043B\u044D\u043B \u043E\u043B\u0434\u0441\u043E\u043D\u0433\u04AF\u0439",
29
+ noData: "\u041C\u044D\u0434\u044D\u044D\u043B\u044D\u043B \u0431\u0430\u0439\u0445\u0433\u04AF\u0439",
30
+ create: '"{label}" \u04AF\u04AF\u0441\u0433\u044D\u0445',
31
+ search: "\u0425\u0430\u0439\u0445..."
32
+ },
33
+ toast: {
34
+ close: "\u0425\u0430\u0430\u0445"
35
+ },
36
+ carousel: {
37
+ prev: "\u04E8\u043C\u043D\u04E9\u0445",
38
+ next: "\u0414\u0430\u0440\u0430\u0430\u0445",
39
+ goto: "{slide}-\u0440 \u0445\u0443\u0443\u0434\u0441\u0430\u043D\u0434 \u0448\u0438\u043B\u0436\u0438\u0445"
40
+ },
41
+ modal: {
42
+ close: "\u0425\u0430\u0430\u0445"
43
+ },
44
+ slideover: {
45
+ close: "\u0425\u0430\u0430\u0445"
46
+ },
47
+ alert: {
48
+ close: "\u0425\u0430\u0430\u0445"
49
+ },
50
+ table: {
51
+ noData: "\u041C\u044D\u0434\u044D\u044D\u043B\u044D\u043B \u0431\u0430\u0439\u0445\u0433\u04AF\u0439"
52
+ }
53
+ }
54
+ });
@@ -0,0 +1,3 @@
1
+ import type { Messages } from '../types';
2
+ declare const _default: import("../types").Locale<Messages>;
3
+ export default _default;
@@ -0,0 +1,54 @@
1
+ import { defineLocale } from "../composables/defineLocale.js";
2
+ export default defineLocale({
3
+ name: "Melayu",
4
+ code: "ms",
5
+ messages: {
6
+ inputMenu: {
7
+ noMatch: "Tiada data yang sepadan",
8
+ noData: "Tiada data",
9
+ create: 'Cipta "{label}"'
10
+ },
11
+ calendar: {
12
+ prevYear: "Tahun sebelum",
13
+ nextYear: "Tahun seterusnya",
14
+ prevMonth: "Bulan sebelum",
15
+ nextMonth: "Bulan seterusnya"
16
+ },
17
+ inputNumber: {
18
+ increment: "Naikkan",
19
+ decrement: "Kurangkan"
20
+ },
21
+ commandPalette: {
22
+ placeholder: "Taip arahan atau carian...",
23
+ noMatch: "Tiada data yang sepadan",
24
+ noData: "Tiada data",
25
+ close: "Tutup"
26
+ },
27
+ selectMenu: {
28
+ noMatch: "Tiada data yang sepadan",
29
+ noData: "Tiada data",
30
+ create: 'Cipta "{label}"',
31
+ search: "Cari..."
32
+ },
33
+ toast: {
34
+ close: "Tutup"
35
+ },
36
+ carousel: {
37
+ prev: "Sebelum",
38
+ next: "Seterusnya",
39
+ goto: "Pergi ke slaid {slide}"
40
+ },
41
+ modal: {
42
+ close: "Tutup"
43
+ },
44
+ slideover: {
45
+ close: "Tutup"
46
+ },
47
+ alert: {
48
+ close: "Tutup"
49
+ },
50
+ table: {
51
+ noData: "Tiada data"
52
+ }
53
+ }
54
+ });
@@ -0,0 +1,3 @@
1
+ import type { Messages } from '../types';
2
+ declare const _default: import("../types").Locale<Messages>;
3
+ export default _default;
@@ -0,0 +1,54 @@
1
+ import { defineLocale } from "../composables/defineLocale.js";
2
+ export default defineLocale({
3
+ name: "Sloven\u0161\u010Dina",
4
+ code: "sl",
5
+ messages: {
6
+ inputMenu: {
7
+ noMatch: "Ni ujemanj",
8
+ noData: "Ni podatkov",
9
+ create: 'Ustvari "{label}"'
10
+ },
11
+ calendar: {
12
+ prevYear: "Prej\u0161nje leto",
13
+ nextYear: "Naslednje leto",
14
+ prevMonth: "Prej\u0161nji mesec",
15
+ nextMonth: "Naslednji mesec"
16
+ },
17
+ inputNumber: {
18
+ increment: "Povi\u0161aj",
19
+ decrement: "Zmanj\u0161aj"
20
+ },
21
+ commandPalette: {
22
+ placeholder: "Vpi\u0161i ukaz ali i\u0161\u010Di...",
23
+ noMatch: "Ni ujemanj",
24
+ noData: "Ni podatkov",
25
+ close: "Zapri"
26
+ },
27
+ selectMenu: {
28
+ noMatch: "Ni ujemanj",
29
+ noData: "Ni podatkov",
30
+ create: 'Ustvari "{label}"',
31
+ search: "I\u0161\u010Di..."
32
+ },
33
+ toast: {
34
+ close: "Zapri"
35
+ },
36
+ carousel: {
37
+ prev: "Nazaj",
38
+ next: "Naprej",
39
+ goto: "Pojdi na {slide}"
40
+ },
41
+ modal: {
42
+ close: "Zapri"
43
+ },
44
+ slideover: {
45
+ close: "Zapri"
46
+ },
47
+ alert: {
48
+ close: "Zapri"
49
+ },
50
+ table: {
51
+ noData: "Ni podatkov"
52
+ }
53
+ }
54
+ });
@@ -4,3 +4,4 @@ export declare function pickLinkProps(link: LinkProps & {
4
4
  }): import("@vueuse/shared").ReactivePickReturn<LinkProps & {
5
5
  [key: string]: any;
6
6
  }, string>;
7
+ export declare function isPartiallyEqual(item1: any, item2: any): boolean;
@@ -1,4 +1,5 @@
1
1
  import { reactivePick } from "@vueuse/core";
2
+ import { isEqual, diff } from "ohash/utils";
2
3
  export function pickLinkProps(link) {
3
4
  const keys = Object.keys(link);
4
5
  const ariaKeys = keys.filter((key) => key.startsWith("aria-"));
@@ -33,3 +34,14 @@ export function pickLinkProps(link) {
33
34
  ];
34
35
  return reactivePick(link, ...propsToInclude);
35
36
  }
37
+ export function isPartiallyEqual(item1, item2) {
38
+ const diffedKeys = diff(item1, item2).reduce((filtered, q) => {
39
+ if (q.type === "added") {
40
+ filtered.add(q.key);
41
+ }
42
+ return filtered;
43
+ }, /* @__PURE__ */ new Set());
44
+ const item1Filtered = Object.fromEntries(Object.entries(item1).filter(([key]) => !diffedKeys.has(key)));
45
+ const item2Filtered = Object.fromEntries(Object.entries(item2).filter(([key]) => !diffedKeys.has(key)));
46
+ return isEqual(item1Filtered, item2Filtered);
47
+ }
@@ -3,15 +3,17 @@ import theme from "#build/ui/link";
3
3
  </script>
4
4
 
5
5
  <script setup>
6
- import { computed, getCurrentInstance } from "vue";
6
+ import { computed } from "vue";
7
7
  import { defu } from "defu";
8
- import { isEqual, diff } from "ohash/utils";
8
+ import { isEqual } from "ohash/utils";
9
9
  import { useForwardProps } from "reka-ui";
10
10
  import { reactiveOmit } from "@vueuse/core";
11
11
  import { hasProtocol } from "ufo";
12
12
  import { useRoute, RouterLink } from "vue-router";
13
13
  import { useAppConfig } from "#imports";
14
14
  import { tv } from "../../utils/tv";
15
+ import { isPartiallyEqual } from "../../utils/link";
16
+ import ULinkBase from "../../components/LinkBase.vue";
15
17
  defineOptions({ inheritAttrs: false });
16
18
  const props = defineProps({
17
19
  as: { type: null, required: false, default: "button" },
@@ -42,20 +44,9 @@ const props = defineProps({
42
44
  replace: { type: Boolean, required: false }
43
45
  });
44
46
  defineSlots();
45
- const hasRouter = computed(() => {
46
- const app = getCurrentInstance()?.appContext.app;
47
- return !!app?.config?.globalProperties?.$router;
48
- });
49
- const route = computed(() => {
50
- if (!hasRouter.value) return null;
51
- try {
52
- return useRoute();
53
- } catch {
54
- return null;
55
- }
56
- });
47
+ const route = useRoute();
57
48
  const appConfig = useAppConfig();
58
- const routerLinkProps = useForwardProps(reactiveOmit(props, "as", "type", "disabled", "active", "exact", "exactQuery", "exactHash", "activeClass", "inactiveClass", "to", "raw", "class"));
49
+ const routerLinkProps = useForwardProps(reactiveOmit(props, "as", "type", "disabled", "active", "exact", "exactQuery", "exactHash", "activeClass", "inactiveClass", "to", "href", "raw", "custom", "class"));
59
50
  const ui = computed(() => tv({
60
51
  extend: tv(theme),
61
52
  ...defu({
@@ -67,34 +58,29 @@ const ui = computed(() => tv({
67
58
  }
68
59
  }, appConfig.ui?.link || {})
69
60
  }));
70
- function isPartiallyEqual(item1, item2) {
71
- const diffedKeys = diff(item1, item2).reduce((filtered, q) => {
72
- if (q.type === "added") {
73
- filtered.add(q.key);
74
- }
75
- return filtered;
76
- }, /* @__PURE__ */ new Set());
77
- const item1Filtered = Object.fromEntries(Object.entries(item1).filter(([key]) => !diffedKeys.has(key)));
78
- const item2Filtered = Object.fromEntries(Object.entries(item2).filter(([key]) => !diffedKeys.has(key)));
79
- return isEqual(item1Filtered, item2Filtered);
80
- }
61
+ const to = computed(() => props.to ?? props.href);
81
62
  const isExternal = computed(() => {
82
- if (!props.to) return false;
83
- return typeof props.to === "string" && hasProtocol(props.to, { acceptRelative: true });
63
+ if (props.external) {
64
+ return true;
65
+ }
66
+ if (!to.value) {
67
+ return false;
68
+ }
69
+ return typeof to.value === "string" && hasProtocol(to.value, { acceptRelative: true });
84
70
  });
85
71
  function isLinkActive({ route: linkRoute, isActive, isExactActive }) {
86
72
  if (props.active !== void 0) {
87
73
  return props.active;
88
74
  }
89
- if (!props.to || !route.value) {
75
+ if (!to.value) {
90
76
  return false;
91
77
  }
92
78
  if (props.exactQuery === "partial") {
93
- if (!isPartiallyEqual(linkRoute.query, route.value.query)) return false;
79
+ if (!isPartiallyEqual(linkRoute.query, route.query)) return false;
94
80
  } else if (props.exactQuery === true) {
95
- if (!isEqual(linkRoute.query, route.value.query)) return false;
81
+ if (!isEqual(linkRoute.query, route.query)) return false;
96
82
  }
97
- if (props.exactHash && linkRoute.hash !== route.value.hash) {
83
+ if (props.exactHash && linkRoute.hash !== route.hash) {
98
84
  return false;
99
85
  }
100
86
  if (props.exact && isExactActive) {
@@ -115,8 +101,8 @@ function resolveLinkClass({ route: route2, isActive, isExactActive } = {}) {
115
101
  </script>
116
102
 
117
103
  <template>
118
- <template v-if="hasRouter && !isExternal">
119
- <RouterLink v-slot="{ href, navigate, route: linkRoute, isActive, isExactActive }" v-bind="routerLinkProps" :to="to || '#'" custom>
104
+ <template v-if="!isExternal && !!to">
105
+ <RouterLink v-slot="{ href, navigate, route: linkRoute, isActive, isExactActive }" v-bind="routerLinkProps" :to="to" custom>
120
106
  <template v-if="custom">
121
107
  <slot
122
108
  v-bind="{
@@ -125,7 +111,7 @@ function resolveLinkClass({ route: route2, isActive, isExactActive } = {}) {
125
111
  as,
126
112
  type,
127
113
  disabled,
128
- href: to ? href : void 0,
114
+ href,
129
115
  navigate,
130
116
  active: isLinkActive({ route: linkRoute, isActive, isExactActive })
131
117
  }"
@@ -139,7 +125,7 @@ function resolveLinkClass({ route: route2, isActive, isExactActive } = {}) {
139
125
  as,
140
126
  type,
141
127
  disabled,
142
- href: to ? href : void 0,
128
+ href,
143
129
  navigate
144
130
  }"
145
131
  :class="resolveLinkClass({ route: linkRoute, isActive, isExactActive })"
@@ -159,7 +145,8 @@ function resolveLinkClass({ route: route2, isActive, isExactActive } = {}) {
159
145
  disabled,
160
146
  href: to,
161
147
  target: isExternal ? '_blank' : void 0,
162
- active: false
148
+ active,
149
+ isExternal
163
150
  }"
164
151
  />
165
152
  </template>
@@ -171,12 +158,12 @@ function resolveLinkClass({ route: route2, isActive, isExactActive } = {}) {
171
158
  type,
172
159
  disabled,
173
160
  href: to,
174
- target: isExternal ? '_blank' : void 0
161
+ target: isExternal ? '_blank' : void 0,
162
+ isExternal
175
163
  }"
176
- :is-external="isExternal"
177
164
  :class="resolveLinkClass()"
178
165
  >
179
- <slot :active="false" />
166
+ <slot :active="active" />
180
167
  </ULinkBase>
181
168
  </template>
182
169
  </template>
@@ -1,2 +1,4 @@
1
+ import { reactive } from "vue";
1
2
  import appConfig from "#build/app.config";
2
- export const useAppConfig = () => appConfig;
3
+ const _appConfig = reactive(appConfig);
4
+ export const useAppConfig = () => _appConfig;
@@ -2,6 +2,7 @@ import type { Ref } from 'vue';
2
2
  import type { NuxtApp } from '#app';
3
3
  export { useHead } from '@unhead/vue';
4
4
  export { useRoute, useRouter } from 'vue-router';
5
+ export { useAppConfig } from './composables/useAppConfig';
5
6
  export { defineShortcuts } from '../composables/defineShortcuts';
6
7
  export { defineLocale } from '../composables/defineLocale';
7
8
  export { useLocale } from '../composables/useLocale';
@@ -14,7 +15,6 @@ export declare const useColorMode: () => {
14
15
  readonly value: import("@vueuse/core").BasicColorMode;
15
16
  forced: boolean;
16
17
  };
17
- export declare const useAppConfig: () => any;
18
18
  export declare const useCookie: <T = string>(_name: string, _options?: Record<string, any>) => {
19
19
  value: Ref<T, T>;
20
20
  get: () => T;
@@ -4,6 +4,7 @@ import appConfig from "#build/app.config";
4
4
  import { useColorMode as useColorModeVueUse } from "@vueuse/core";
5
5
  export { useHead } from "@unhead/vue";
6
6
  export { useRoute, useRouter } from "vue-router";
7
+ export { useAppConfig } from "./composables/useAppConfig.js";
7
8
  export { defineShortcuts } from "../composables/defineShortcuts.js";
8
9
  export { defineLocale } from "../composables/defineLocale.js";
9
10
  export { useLocale } from "../composables/useLocale.js";
@@ -27,7 +28,6 @@ export const useColorMode = () => {
27
28
  forced: false
28
29
  };
29
30
  };
30
- export const useAppConfig = () => appConfig;
31
31
  export const useCookie = (_name, _options = {}) => {
32
32
  const value = ref(null);
33
33
  return {