@nuxt/ui 4.8.2 → 4.9.0
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/module.d.mts +7 -0
- package/dist/module.json +1 -1
- package/dist/module.mjs +2 -2
- package/dist/runtime/components/Avatar.vue +1 -1
- package/dist/runtime/components/Banner.vue +0 -1
- package/dist/runtime/components/BlogPost.vue +8 -10
- package/dist/runtime/components/Calendar.d.vue.ts +40 -4
- package/dist/runtime/components/Calendar.vue +179 -61
- package/dist/runtime/components/Calendar.vue.d.ts +40 -4
- package/dist/runtime/components/ChatMessages.d.vue.ts +7 -3
- package/dist/runtime/components/ChatMessages.vue +4 -1
- package/dist/runtime/components/ChatMessages.vue.d.ts +7 -3
- package/dist/runtime/components/ChatPrompt.vue +8 -2
- package/dist/runtime/components/ChatPromptSubmit.d.vue.ts +2 -2
- package/dist/runtime/components/ChatPromptSubmit.vue +2 -2
- package/dist/runtime/components/ChatPromptSubmit.vue.d.ts +2 -2
- package/dist/runtime/components/CommandPalette.d.vue.ts +2 -2
- package/dist/runtime/components/CommandPalette.vue +10 -4
- package/dist/runtime/components/CommandPalette.vue.d.ts +2 -2
- package/dist/runtime/components/DashboardSearch.d.vue.ts +7 -1
- package/dist/runtime/components/DashboardSearch.vue +9 -2
- package/dist/runtime/components/DashboardSearch.vue.d.ts +7 -1
- package/dist/runtime/components/DashboardSearchButton.d.vue.ts +2 -2
- package/dist/runtime/components/DashboardSearchButton.vue +2 -2
- package/dist/runtime/components/DashboardSearchButton.vue.d.ts +2 -2
- package/dist/runtime/components/FileUpload.d.vue.ts +5 -2
- package/dist/runtime/components/FileUpload.vue +8 -6
- package/dist/runtime/components/FileUpload.vue.d.ts +5 -2
- package/dist/runtime/components/Link.d.vue.ts +1 -0
- package/dist/runtime/components/Link.vue +1 -1
- package/dist/runtime/components/Link.vue.d.ts +1 -0
- package/dist/runtime/components/Modal.d.vue.ts +6 -0
- package/dist/runtime/components/Modal.vue +3 -1
- package/dist/runtime/components/Modal.vue.d.ts +6 -0
- package/dist/runtime/components/PinInput.d.vue.ts +14 -2
- package/dist/runtime/components/PinInput.vue +36 -11
- package/dist/runtime/components/PinInput.vue.d.ts +14 -2
- package/dist/runtime/components/Popover.d.vue.ts +2 -0
- package/dist/runtime/components/Popover.vue +2 -2
- package/dist/runtime/components/Popover.vue.d.ts +2 -0
- package/dist/runtime/components/ScrollArea.d.vue.ts +8 -0
- package/dist/runtime/components/ScrollArea.vue +10 -0
- package/dist/runtime/components/ScrollArea.vue.d.ts +8 -0
- package/dist/runtime/components/Select.vue +8 -1
- package/dist/runtime/components/SelectMenu.vue +11 -4
- package/dist/runtime/components/Sidebar.d.vue.ts +5 -0
- package/dist/runtime/components/Sidebar.vue +3 -1
- package/dist/runtime/components/Sidebar.vue.d.ts +5 -0
- package/dist/runtime/components/Slideover.d.vue.ts +6 -0
- package/dist/runtime/components/Slideover.vue +3 -1
- package/dist/runtime/components/Slideover.vue.d.ts +6 -0
- package/dist/runtime/components/content/ContentSearch.d.vue.ts +7 -1
- package/dist/runtime/components/content/ContentSearch.vue +9 -2
- package/dist/runtime/components/content/ContentSearch.vue.d.ts +7 -1
- package/dist/runtime/components/content/ContentSearchButton.d.vue.ts +2 -2
- package/dist/runtime/components/content/ContentSearchButton.vue +2 -2
- package/dist/runtime/components/content/ContentSearchButton.vue.d.ts +2 -2
- package/dist/runtime/components/prose/Kbd.d.vue.ts +2 -1
- package/dist/runtime/components/prose/Kbd.vue.d.ts +2 -1
- package/dist/runtime/components/prose/Pre.vue +0 -1
- package/dist/runtime/composables/index.d.ts +1 -0
- package/dist/runtime/composables/index.js +1 -0
- package/dist/runtime/composables/useComponentProps.d.ts +3 -3
- package/dist/runtime/composables/useTour.d.ts +80 -0
- package/dist/runtime/composables/useTour.js +102 -0
- package/dist/runtime/index.css +1 -1
- package/dist/runtime/keyframes.css +1 -1
- package/dist/runtime/locale/index.d.ts +1 -0
- package/dist/runtime/locale/index.js +1 -0
- package/dist/runtime/locale/lv.d.ts +3 -0
- package/dist/runtime/locale/lv.js +152 -0
- package/dist/runtime/plugins/colors.js +5 -4
- package/dist/runtime/types/tv.d.ts +15 -3
- package/dist/runtime/utils/tv.d.ts +41 -1
- package/dist/runtime/utils/tv.js +91 -2
- package/dist/runtime/vue/stubs/base.d.ts +1 -1
- package/dist/runtime/vue/stubs/base.js +1 -1
- package/dist/shared/{ui.C-lVg1QQ.mjs → ui.BfHSFiIO.mjs} +375 -232
- package/dist/unplugin.d.mts +8 -0
- package/dist/unplugin.mjs +2 -2
- package/dist/vite.mjs +1 -1
- package/package.json +57 -40
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import type { MaybeRefOrGetter, Ref, ComputedRef } from 'vue';
|
|
2
|
+
import type { ReferenceElement } from 'reka-ui';
|
|
3
|
+
export interface TourStep {
|
|
4
|
+
/**
|
|
5
|
+
* The element this step points to. Accepts:
|
|
6
|
+
* - a CSS selector (`'#id'`, `'.class'`, or a bare id resolved as `#id`)
|
|
7
|
+
* - an element or a virtual element (anything with `getBoundingClientRect`)
|
|
8
|
+
* - a ref or a getter returning any of the above
|
|
9
|
+
*
|
|
10
|
+
* Omit or pass `null` to anchor the step to the center of the viewport
|
|
11
|
+
* (useful for intro / summary steps with no target).
|
|
12
|
+
*/
|
|
13
|
+
target?: MaybeRefOrGetter<string | ReferenceElement | null | undefined>;
|
|
14
|
+
/**
|
|
15
|
+
* Any other fields (title, body, side, …) are passed through untouched
|
|
16
|
+
* and available via `current` — you own the rendering and copy.
|
|
17
|
+
*/
|
|
18
|
+
[key: string]: any;
|
|
19
|
+
}
|
|
20
|
+
export interface UseTourOptions {
|
|
21
|
+
/**
|
|
22
|
+
* The step index the tour starts on.
|
|
23
|
+
* @defaultValue 0
|
|
24
|
+
*/
|
|
25
|
+
initialStep?: number;
|
|
26
|
+
/**
|
|
27
|
+
* Loop back to the first step after the last one.
|
|
28
|
+
* @defaultValue false
|
|
29
|
+
*/
|
|
30
|
+
loop?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Scroll the target into view when a step becomes active.
|
|
33
|
+
* @defaultValue true
|
|
34
|
+
*/
|
|
35
|
+
scrollIntoView?: boolean | ScrollIntoViewOptions;
|
|
36
|
+
}
|
|
37
|
+
export interface UseTourReturn {
|
|
38
|
+
/** Whether the tour is currently open. */
|
|
39
|
+
open: Ref<boolean>;
|
|
40
|
+
/** The current step index (clamped to the steps range). */
|
|
41
|
+
index: Ref<number>;
|
|
42
|
+
/** The current step object, or `undefined` when there are no steps. */
|
|
43
|
+
current: ComputedRef<TourStep | undefined>;
|
|
44
|
+
/** The resolved anchor for the current step, to pass to `<UPopover :reference>`. */
|
|
45
|
+
reference: ComputedRef<ReferenceElement | undefined>;
|
|
46
|
+
/** Total number of steps. */
|
|
47
|
+
total: ComputedRef<number>;
|
|
48
|
+
/** Whether a next step exists. */
|
|
49
|
+
hasNext: ComputedRef<boolean>;
|
|
50
|
+
/** Whether a previous step exists. */
|
|
51
|
+
hasPrev: ComputedRef<boolean>;
|
|
52
|
+
/** Open the tour, optionally at a given index. */
|
|
53
|
+
start: (index?: number) => void;
|
|
54
|
+
/** Go to the next step (loops or finishes at the end depending on `loop`). */
|
|
55
|
+
next: () => void;
|
|
56
|
+
/** Go to the previous step. */
|
|
57
|
+
prev: () => void;
|
|
58
|
+
/** Jump to a specific step and open the tour. */
|
|
59
|
+
goTo: (index: number) => void;
|
|
60
|
+
/** Close the tour. */
|
|
61
|
+
finish: () => void;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Drive a guided tour with a single `<UPopover>` whose anchor moves between steps.
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* ```ts
|
|
68
|
+
* const tour = useTour([
|
|
69
|
+
* { target: '#cta', title: 'Get started' },
|
|
70
|
+
* { target: () => card.value, title: 'Profile', side: 'right' },
|
|
71
|
+
* { target: null, title: 'All set' } // centered, no target
|
|
72
|
+
* ])
|
|
73
|
+
* ```
|
|
74
|
+
* ```vue
|
|
75
|
+
* <UPopover :open="tour.open.value" :reference="tour.reference.value">
|
|
76
|
+
* <template #content>…your content + buttons…</template>
|
|
77
|
+
* </UPopover>
|
|
78
|
+
* ```
|
|
79
|
+
*/
|
|
80
|
+
export declare function useTour(steps: MaybeRefOrGetter<TourStep[]>, options?: UseTourOptions): UseTourReturn;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { ref, computed, toValue, nextTick, watch } from "vue";
|
|
2
|
+
export function useTour(steps, options = {}) {
|
|
3
|
+
const { loop = false, scrollIntoView = true } = options;
|
|
4
|
+
const stepList = computed(() => toValue(steps) ?? []);
|
|
5
|
+
const total = computed(() => stepList.value.length);
|
|
6
|
+
const open = ref(false);
|
|
7
|
+
const rawIndex = ref(options.initialStep ?? 0);
|
|
8
|
+
function clamp(value) {
|
|
9
|
+
return Math.min(Math.max(value, 0), Math.max(total.value - 1, 0));
|
|
10
|
+
}
|
|
11
|
+
const index = computed({
|
|
12
|
+
get: () => clamp(rawIndex.value),
|
|
13
|
+
set: (value) => rawIndex.value = clamp(value)
|
|
14
|
+
});
|
|
15
|
+
const current = computed(() => stepList.value[index.value]);
|
|
16
|
+
const hasNext = computed(() => index.value < total.value - 1);
|
|
17
|
+
const hasPrev = computed(() => index.value > 0);
|
|
18
|
+
const centerAnchor = {
|
|
19
|
+
getBoundingClientRect() {
|
|
20
|
+
const x = typeof window === "undefined" ? 0 : window.innerWidth / 2;
|
|
21
|
+
const y = typeof window === "undefined" ? 0 : window.innerHeight / 2;
|
|
22
|
+
return { x, y, top: y, left: x, right: x, bottom: y, width: 0, height: 0, toJSON: () => ({}) };
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
const reference = computed(() => {
|
|
26
|
+
if (!open.value || typeof window === "undefined") {
|
|
27
|
+
return void 0;
|
|
28
|
+
}
|
|
29
|
+
const target = toValue(current.value?.target);
|
|
30
|
+
if (target == null) {
|
|
31
|
+
return centerAnchor;
|
|
32
|
+
}
|
|
33
|
+
if (typeof target === "string") {
|
|
34
|
+
const selector = target.startsWith("#") || target.startsWith(".") ? target : `#${target}`;
|
|
35
|
+
try {
|
|
36
|
+
return document.querySelector(selector) ?? void 0;
|
|
37
|
+
} catch {
|
|
38
|
+
return void 0;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return target;
|
|
42
|
+
});
|
|
43
|
+
function scrollTargetIntoView() {
|
|
44
|
+
if (!scrollIntoView) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
const el = reference.value;
|
|
48
|
+
if (el instanceof Element) {
|
|
49
|
+
el.scrollIntoView(typeof scrollIntoView === "object" ? scrollIntoView : { behavior: "smooth", block: "center" });
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
function goTo(value) {
|
|
53
|
+
index.value = value;
|
|
54
|
+
if (total.value > 0) {
|
|
55
|
+
open.value = true;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
function start(value = options.initialStep ?? 0) {
|
|
59
|
+
goTo(value);
|
|
60
|
+
}
|
|
61
|
+
function next() {
|
|
62
|
+
if (hasNext.value) {
|
|
63
|
+
index.value++;
|
|
64
|
+
} else if (loop) {
|
|
65
|
+
index.value = 0;
|
|
66
|
+
} else {
|
|
67
|
+
finish();
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
function prev() {
|
|
71
|
+
if (hasPrev.value) {
|
|
72
|
+
index.value--;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
function finish() {
|
|
76
|
+
open.value = false;
|
|
77
|
+
}
|
|
78
|
+
watch(total, (value) => {
|
|
79
|
+
if (!value) {
|
|
80
|
+
open.value = false;
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
watch([open, index], () => {
|
|
84
|
+
if (open.value) {
|
|
85
|
+
nextTick(scrollTargetIntoView);
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
return {
|
|
89
|
+
open,
|
|
90
|
+
index,
|
|
91
|
+
current,
|
|
92
|
+
reference,
|
|
93
|
+
total,
|
|
94
|
+
hasNext,
|
|
95
|
+
hasPrev,
|
|
96
|
+
start,
|
|
97
|
+
next,
|
|
98
|
+
prev,
|
|
99
|
+
goTo,
|
|
100
|
+
finish
|
|
101
|
+
};
|
|
102
|
+
}
|
package/dist/runtime/index.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
@import "#build/ui.css";@import "./keyframes.css";@source "./components";@variant light (&:where(.light, .light *));@variant dark (&:where(.dark, .dark *));@layer theme{:host,:root{--ui-header-height:4rem;--ui-radius:0.25rem;--ui-container:80rem}.light,:host,:root{--ui-text-dimmed:var(--ui-color-neutral-400);--ui-text-muted:var(--ui-color-neutral-500);--ui-text-toned:var(--ui-color-neutral-600);--ui-text:var(--ui-color-neutral-700);--ui-text-highlighted:var(--ui-color-neutral-900);--ui-text-inverted:#fff;--ui-bg:#fff;--ui-bg-muted:var(--ui-color-neutral-50);--ui-bg-elevated:var(--ui-color-neutral-100);--ui-bg-accented:var(--ui-color-neutral-200);--ui-bg-inverted:var(--ui-color-neutral-900);--ui-border:var(--ui-color-neutral-200);--ui-border-muted:var(--ui-color-neutral-200);--ui-border-accented:var(--ui-color-neutral-300);--ui-border-inverted:var(--ui-color-neutral-900)}.dark{--ui-text-dimmed:var(--ui-color-neutral-500);--ui-text-muted:var(--ui-color-neutral-400);--ui-text-toned:var(--ui-color-neutral-300);--ui-text:var(--ui-color-neutral-200);--ui-text-highlighted:#fff;--ui-text-inverted:var(--ui-color-neutral-900);--ui-bg:var(--ui-color-neutral-900);--ui-bg-muted:var(--ui-color-neutral-800);--ui-bg-elevated:var(--ui-color-neutral-800);--ui-bg-accented:var(--ui-color-neutral-700);--ui-bg-inverted:#fff;--ui-border:var(--ui-color-neutral-800);--ui-border-muted:var(--ui-color-neutral-700);--ui-border-accented:var(--ui-color-neutral-700);--ui-border-inverted:#fff}}
|
|
1
|
+
@import "#build/ui.css";@import "./keyframes.css";@source "./components";@variant light (&:where(.light, .light *));@variant dark (&:where(.dark, .dark *));@layer base{a:focus-visible{outline-offset:0}}@layer theme{:host,:root{--ui-header-height:4rem;--ui-radius:0.25rem;--ui-container:80rem}.light,:host,:root{--ui-text-dimmed:var(--ui-color-neutral-400);--ui-text-muted:var(--ui-color-neutral-500);--ui-text-toned:var(--ui-color-neutral-600);--ui-text:var(--ui-color-neutral-700);--ui-text-highlighted:var(--ui-color-neutral-900);--ui-text-inverted:#fff;--ui-bg:#fff;--ui-bg-muted:var(--ui-color-neutral-50);--ui-bg-elevated:var(--ui-color-neutral-100);--ui-bg-accented:var(--ui-color-neutral-200);--ui-bg-inverted:var(--ui-color-neutral-900);--ui-border:var(--ui-color-neutral-200);--ui-border-muted:var(--ui-color-neutral-200);--ui-border-accented:var(--ui-color-neutral-300);--ui-border-inverted:var(--ui-color-neutral-900)}.dark{--ui-text-dimmed:var(--ui-color-neutral-500);--ui-text-muted:var(--ui-color-neutral-400);--ui-text-toned:var(--ui-color-neutral-300);--ui-text:var(--ui-color-neutral-200);--ui-text-highlighted:#fff;--ui-text-inverted:var(--ui-color-neutral-900);--ui-bg:var(--ui-color-neutral-900);--ui-bg-muted:var(--ui-color-neutral-800);--ui-bg-elevated:var(--ui-color-neutral-800);--ui-bg-accented:var(--ui-color-neutral-700);--ui-bg-inverted:#fff;--ui-border:var(--ui-color-neutral-800);--ui-border-muted:var(--ui-color-neutral-700);--ui-border-accented:var(--ui-color-neutral-700);--ui-border-inverted:#fff}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
@keyframes accordion-up{0%{height:var(--reka-accordion-content-height)}to{height:0}}@keyframes accordion-down{0%{height:0}to{height:var(--reka-accordion-content-height)}}@keyframes collapsible-up{0%{height:var(--reka-collapsible-content-height)}to{height:0}}@keyframes collapsible-down{0%{height:0}to{height:var(--reka-collapsible-content-height)}}@keyframes toast-slide-in-from-top{0%{transform:translateY(-100%)}to{transform:var(--transform)}}@keyframes toast-slide-in-from-bottom{0%{transform:translateY(100%)}to{transform:var(--transform)}}@keyframes toast-slide-up{0%{transform:translateX(0) translateY(var(--translate))}to{transform:translateX(0) translateY(calc(var(--translate) - 100%))}}@keyframes toast-slide-down{0%{transform:translateX(0) translateY(var(--translate))}to{transform:translateX(0) translateY(calc(var(--translate) + 100%))}}@keyframes toast-pulse-a{0%,to{scale:1}50%{scale:1.04}}@keyframes toast-pulse-b{0%,to{scale:1}50%{scale:1.04}}@keyframes toast-collapsed-closed{0%{transform:var(--transform)}to{transform:translateY(calc((var(--before) - var(--height))*var(--gap))) scale(var(--scale))}}@keyframes toast-closed{0%{transform:var(--transform)}to{transform:translateY(calc((var(--offset) - var(--height))*var(--translate-factor)))}}@keyframes toast-slide-left{0%{transform:translateX(0) translateY(var(--translate))}to{transform:translateX(-100%) translateY(var(--translate))}}@keyframes toast-slide-right{0%{transform:translateX(0) translateY(var(--translate))}to{transform:translateX(100%) translateY(var(--translate))}}@keyframes fade-in{0%{opacity:0}to{opacity:1}}@keyframes fade-out{0%{opacity:1}to{opacity:0}}@keyframes scale-in{0%{opacity:0;transform:scale(.95)}to{opacity:1;transform:scale(1)}}@keyframes scale-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.95)}}@keyframes slide-in-from-top{0%{transform:translateY(-100%)}to{transform:translateY(0)}}@keyframes slide-out-to-top{0%{transform:translateY(0)}to{transform:translateY(-100%)}}@keyframes slide-in-from-right{0%{transform:translateX(100%)}to{transform:translateX(0)}}@keyframes slide-out-to-right{0%{transform:translateX(0)}to{transform:translateX(100%)}}@keyframes slide-in-from-bottom{0%{transform:translateY(100%)}to{transform:translateY(0)}}@keyframes slide-out-to-bottom{0%{transform:translateY(0)}to{transform:translateY(100%)}}@keyframes slide-in-from-left{0%{transform:translateX(-100%)}to{transform:translateX(0)}}@keyframes slide-out-to-left{0%{transform:translateX(0)}to{transform:translateX(-100%)}}@keyframes slide-in-from-top-and-fade{0%{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:translateY(0)}}@keyframes slide-out-to-top-and-fade{0%{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(-4px)}}@keyframes slide-in-from-right-and-fade{0%{opacity:0;transform:translateX(4px)}to{opacity:1;transform:translateX(0)}}@keyframes slide-out-to-right-and-fade{0%{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(4px)}}@keyframes slide-in-from-bottom-and-fade{0%{opacity:0;transform:translateY(4px)}to{opacity:1;transform:translateY(0)}}@keyframes slide-out-to-bottom-and-fade{0%{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(4px)}}@keyframes slide-in-from-left-and-fade{0%{opacity:0;transform:translateX(-4px)}to{opacity:1;transform:translateX(0)}}@keyframes slide-out-to-left-and-fade{0%{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(-4px)}}@keyframes enter-from-right{0%{opacity:0;transform:translateX(200px)}to{opacity:1;transform:translateX(0)}}@keyframes enter-from-left{0%{opacity:0;transform:translateX(-200px)}to{opacity:1;transform:translateX(0)}}@keyframes exit-to-right{0%{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(200px)}}@keyframes exit-to-left{0%{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(-200px)}}@keyframes carousel{0%,to{width:50%}0%{transform:translateX(-100%)}to{transform:translateX(200%)}}@keyframes carousel-rtl{0%,to{width:50%}0%{transform:translateX(100%)}to{transform:translateX(-200%)}}@keyframes carousel-vertical{0%,to{height:50%}0%{transform:translateY(-100%)}to{transform:translateY(200%)}}@keyframes carousel-inverse{0%,to{width:50%}0%{transform:translateX(200%)}to{transform:translateX(-100%)}}@keyframes carousel-inverse-rtl{0%,to{width:50%}0%{transform:translateX(-200%)}to{transform:translateX(100%)}}@keyframes carousel-inverse-vertical{0%,to{height:50%}0%{transform:translateY(200%)}to{transform:translateY(-100%)}}@keyframes swing{0%,to{width:50%}0%,to{transform:translateX(-25%)}50%{transform:translateX(125%)}}@keyframes swing-vertical{0%,to{height:50%}0%,to{transform:translateY(-25%)}50%{transform:translateY(125%)}}@keyframes elastic{0%,to{margin-left:25%;width:50%}50%{margin-left:5%;width:90%}}@keyframes elastic-vertical{0%,to{height:50%;margin-top:25%}50%{height:90%;margin-top:5%}}@keyframes marquee{0%{transform:translateZ(0)}to{transform:translate3d(calc(-100% - var(--gap)),0,0)}}@keyframes marquee-rtl{0%{transform:translateZ(0)}to{transform:translate3d(calc(100% + var(--gap)),0,0)}}@keyframes marquee-vertical{0%{transform:translateZ(0)}to{transform:translate3d(0,calc(-100% - var(--gap)),0)}}@keyframes marquee-vertical-rtl{0%{transform:translate3d(0,calc(-100% - var(--gap)),0)}to{transform:translate3d(0,calc(-100%*var(--gap)),0)}}@keyframes shimmer{0%{background-position:100%}to{background-position:0}}@keyframes shimmer-rtl{0%{background-position:0}to{background-position:100%}}
|
|
1
|
+
@keyframes accordion-up{0%{height:var(--reka-accordion-content-height);overflow:hidden}to{height:0;overflow:hidden}}@keyframes accordion-down{0%{height:0;overflow:hidden}to{height:var(--reka-accordion-content-height);overflow:hidden}}@keyframes collapsible-up{0%{height:var(--reka-collapsible-content-height);overflow:hidden}to{height:0;overflow:hidden}}@keyframes collapsible-down{0%{height:0;overflow:hidden}to{height:var(--reka-collapsible-content-height);overflow:hidden}}@keyframes toast-slide-in-from-top{0%{transform:translateY(-100%)}to{transform:var(--transform)}}@keyframes toast-slide-in-from-bottom{0%{transform:translateY(100%)}to{transform:var(--transform)}}@keyframes toast-slide-up{0%{transform:translateX(0) translateY(var(--translate))}to{transform:translateX(0) translateY(calc(var(--translate) - 100%))}}@keyframes toast-slide-down{0%{transform:translateX(0) translateY(var(--translate))}to{transform:translateX(0) translateY(calc(var(--translate) + 100%))}}@keyframes toast-pulse-a{0%,to{scale:1}50%{scale:1.04}}@keyframes toast-pulse-b{0%,to{scale:1}50%{scale:1.04}}@keyframes toast-collapsed-closed{0%{transform:var(--transform)}to{transform:translateY(calc((var(--before) - var(--height))*var(--gap))) scale(var(--scale))}}@keyframes toast-closed{0%{transform:var(--transform)}to{transform:translateY(calc((var(--offset) - var(--height))*var(--translate-factor)))}}@keyframes toast-slide-left{0%{transform:translateX(0) translateY(var(--translate))}to{transform:translateX(-100%) translateY(var(--translate))}}@keyframes toast-slide-right{0%{transform:translateX(0) translateY(var(--translate))}to{transform:translateX(100%) translateY(var(--translate))}}@keyframes fade-in{0%{opacity:0}to{opacity:1}}@keyframes fade-out{0%{opacity:1}to{opacity:0}}@keyframes scale-in{0%{opacity:0;transform:scale(.95)}to{opacity:1;transform:scale(1)}}@keyframes scale-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.95)}}@keyframes slide-in-from-top{0%{transform:translateY(-100%)}to{transform:translateY(0)}}@keyframes slide-out-to-top{0%{transform:translateY(0)}to{transform:translateY(-100%)}}@keyframes slide-in-from-right{0%{transform:translateX(100%)}to{transform:translateX(0)}}@keyframes slide-out-to-right{0%{transform:translateX(0)}to{transform:translateX(100%)}}@keyframes slide-in-from-bottom{0%{transform:translateY(100%)}to{transform:translateY(0)}}@keyframes slide-out-to-bottom{0%{transform:translateY(0)}to{transform:translateY(100%)}}@keyframes slide-in-from-left{0%{transform:translateX(-100%)}to{transform:translateX(0)}}@keyframes slide-out-to-left{0%{transform:translateX(0)}to{transform:translateX(-100%)}}@keyframes slide-in-from-top-and-fade{0%{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:translateY(0)}}@keyframes slide-out-to-top-and-fade{0%{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(-4px)}}@keyframes slide-in-from-right-and-fade{0%{opacity:0;transform:translateX(4px)}to{opacity:1;transform:translateX(0)}}@keyframes slide-out-to-right-and-fade{0%{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(4px)}}@keyframes slide-in-from-bottom-and-fade{0%{opacity:0;transform:translateY(4px)}to{opacity:1;transform:translateY(0)}}@keyframes slide-out-to-bottom-and-fade{0%{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(4px)}}@keyframes slide-in-from-left-and-fade{0%{opacity:0;transform:translateX(-4px)}to{opacity:1;transform:translateX(0)}}@keyframes slide-out-to-left-and-fade{0%{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(-4px)}}@keyframes enter-from-right{0%{opacity:0;transform:translateX(200px)}to{opacity:1;transform:translateX(0)}}@keyframes enter-from-left{0%{opacity:0;transform:translateX(-200px)}to{opacity:1;transform:translateX(0)}}@keyframes exit-to-right{0%{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(200px)}}@keyframes exit-to-left{0%{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(-200px)}}@keyframes carousel{0%,to{width:50%}0%{transform:translateX(-100%)}to{transform:translateX(200%)}}@keyframes carousel-rtl{0%,to{width:50%}0%{transform:translateX(100%)}to{transform:translateX(-200%)}}@keyframes carousel-vertical{0%,to{height:50%}0%{transform:translateY(-100%)}to{transform:translateY(200%)}}@keyframes carousel-inverse{0%,to{width:50%}0%{transform:translateX(200%)}to{transform:translateX(-100%)}}@keyframes carousel-inverse-rtl{0%,to{width:50%}0%{transform:translateX(-200%)}to{transform:translateX(100%)}}@keyframes carousel-inverse-vertical{0%,to{height:50%}0%{transform:translateY(200%)}to{transform:translateY(-100%)}}@keyframes swing{0%,to{width:50%}0%,to{transform:translateX(-25%)}50%{transform:translateX(125%)}}@keyframes swing-vertical{0%,to{height:50%}0%,to{transform:translateY(-25%)}50%{transform:translateY(125%)}}@keyframes elastic{0%,to{margin-left:25%;width:50%}50%{margin-left:5%;width:90%}}@keyframes elastic-vertical{0%,to{height:50%;margin-top:25%}50%{height:90%;margin-top:5%}}@keyframes marquee{0%{transform:translateZ(0)}to{transform:translate3d(calc(-100% - var(--gap)),0,0)}}@keyframes marquee-rtl{0%{transform:translateZ(0)}to{transform:translate3d(calc(100% + var(--gap)),0,0)}}@keyframes marquee-vertical{0%{transform:translateZ(0)}to{transform:translate3d(0,calc(-100% - var(--gap)),0)}}@keyframes marquee-vertical-rtl{0%{transform:translate3d(0,calc(-100% - var(--gap)),0)}to{transform:translate3d(0,calc(-100%*var(--gap)),0)}}@keyframes shimmer{0%{background-position:100%}to{background-position:0}}@keyframes shimmer-rtl{0%{background-position:0}to{background-position:100%}}
|
|
@@ -36,6 +36,7 @@ export { default as ky } from './ky';
|
|
|
36
36
|
export { default as lb } from './lb';
|
|
37
37
|
export { default as lo } from './lo';
|
|
38
38
|
export { default as lt } from './lt';
|
|
39
|
+
export { default as lv } from './lv';
|
|
39
40
|
export { default as mn } from './mn';
|
|
40
41
|
export { default as ms } from './ms';
|
|
41
42
|
export { default as nb_no } from './nb_no';
|
|
@@ -36,6 +36,7 @@ export { default as ky } from "./ky.js";
|
|
|
36
36
|
export { default as lb } from "./lb.js";
|
|
37
37
|
export { default as lo } from "./lo.js";
|
|
38
38
|
export { default as lt } from "./lt.js";
|
|
39
|
+
export { default as lv } from "./lv.js";
|
|
39
40
|
export { default as mn } from "./mn.js";
|
|
40
41
|
export { default as ms } from "./ms.js";
|
|
41
42
|
export { default as nb_no } from "./nb_no.js";
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { defineLocale } from "../composables/defineLocale.js";
|
|
2
|
+
export default defineLocale({
|
|
3
|
+
name: "Latvie\u0161u",
|
|
4
|
+
code: "lv",
|
|
5
|
+
messages: {
|
|
6
|
+
alert: {
|
|
7
|
+
close: "Aizv\u0113rt"
|
|
8
|
+
},
|
|
9
|
+
authForm: {
|
|
10
|
+
hidePassword: "Pasl\u0113pt paroli",
|
|
11
|
+
showPassword: "R\u0101d\u012Bt paroli",
|
|
12
|
+
submit: "Turpin\u0101t"
|
|
13
|
+
},
|
|
14
|
+
banner: {
|
|
15
|
+
close: "Aizv\u0113rt"
|
|
16
|
+
},
|
|
17
|
+
calendar: {
|
|
18
|
+
nextMonth: "N\u0101kamais m\u0113nesis",
|
|
19
|
+
nextYear: "N\u0101kamais gads",
|
|
20
|
+
prevMonth: "Iepriek\u0161\u0113jais m\u0113nesis",
|
|
21
|
+
prevYear: "Iepriek\u0161\u0113jais gads"
|
|
22
|
+
},
|
|
23
|
+
carousel: {
|
|
24
|
+
dots: "Izv\u0113lies slaidu, ko r\u0101d\u012Bt",
|
|
25
|
+
goto: "P\u0101riet uz slaidu {slide}",
|
|
26
|
+
next: "N\u0101kamais",
|
|
27
|
+
prev: "Iepriek\u0161\u0113jais"
|
|
28
|
+
},
|
|
29
|
+
chatPrompt: {
|
|
30
|
+
placeholder: "Raksti savu zi\u0146u \u0161eit\u2026"
|
|
31
|
+
},
|
|
32
|
+
chatPromptSubmit: {
|
|
33
|
+
label: "S\u016Bt\u012Bt zi\u0146u"
|
|
34
|
+
},
|
|
35
|
+
colorMode: {
|
|
36
|
+
dark: "Tum\u0161s",
|
|
37
|
+
light: "Gai\u0161s",
|
|
38
|
+
switchToDark: "P\u0101rsl\u0113gt uz tum\u0161o re\u017E\u012Bmu",
|
|
39
|
+
switchToLight: "P\u0101rsl\u0113gt uz gai\u0161o re\u017E\u012Bmu",
|
|
40
|
+
system: "Sist\u0113mas"
|
|
41
|
+
},
|
|
42
|
+
commandPalette: {
|
|
43
|
+
back: "Atpaka\u013C",
|
|
44
|
+
close: "Aizv\u0113rt",
|
|
45
|
+
noData: "Nav datu",
|
|
46
|
+
noMatch: "Nav atbilsto\u0161u datu",
|
|
47
|
+
placeholder: "Ievadi komandu vai mekl\u0113\u2026"
|
|
48
|
+
},
|
|
49
|
+
contentSearch: {
|
|
50
|
+
links: "Saites",
|
|
51
|
+
search: "Rezult\u0101ti",
|
|
52
|
+
theme: "T\u0113ma"
|
|
53
|
+
},
|
|
54
|
+
contentSearchButton: {
|
|
55
|
+
label: "Mekl\u0113t\u2026"
|
|
56
|
+
},
|
|
57
|
+
contentToc: {
|
|
58
|
+
title: "\u0160aj\u0101 lap\u0101"
|
|
59
|
+
},
|
|
60
|
+
dropdownMenu: {
|
|
61
|
+
noMatch: "Nav atbilsto\u0161u datu",
|
|
62
|
+
search: "Mekl\u0113t\u2026"
|
|
63
|
+
},
|
|
64
|
+
dashboardSearch: {
|
|
65
|
+
theme: "T\u0113ma"
|
|
66
|
+
},
|
|
67
|
+
dashboardSearchButton: {
|
|
68
|
+
label: "Mekl\u0113t\u2026"
|
|
69
|
+
},
|
|
70
|
+
dashboardSidebarCollapse: {
|
|
71
|
+
collapse: "Sak\u013Caut s\u0101njoslu",
|
|
72
|
+
expand: "Izv\u0113rst s\u0101njoslu"
|
|
73
|
+
},
|
|
74
|
+
dashboardSidebarToggle: {
|
|
75
|
+
close: "Aizv\u0113rt s\u0101njoslu",
|
|
76
|
+
open: "Atv\u0113rt s\u0101njoslu"
|
|
77
|
+
},
|
|
78
|
+
error: {
|
|
79
|
+
clear: "Atpaka\u013C uz s\u0101kumlapu"
|
|
80
|
+
},
|
|
81
|
+
fileUpload: {
|
|
82
|
+
removeFile: "No\u0146emt {filename}"
|
|
83
|
+
},
|
|
84
|
+
header: {
|
|
85
|
+
close: "Aizv\u0113rt izv\u0113lni",
|
|
86
|
+
open: "Atv\u0113rt izv\u0113lni"
|
|
87
|
+
},
|
|
88
|
+
inputMenu: {
|
|
89
|
+
create: 'Izveidot "{label}"',
|
|
90
|
+
noData: "Nav datu",
|
|
91
|
+
noMatch: "Nav atbilsto\u0161u datu"
|
|
92
|
+
},
|
|
93
|
+
inputNumber: {
|
|
94
|
+
decrement: "Samazin\u0101t",
|
|
95
|
+
increment: "Palielin\u0101t"
|
|
96
|
+
},
|
|
97
|
+
listbox: {
|
|
98
|
+
noData: "Nav datu",
|
|
99
|
+
noMatch: "Nav atbilsto\u0161u datu",
|
|
100
|
+
search: "Mekl\u0113t\u2026"
|
|
101
|
+
},
|
|
102
|
+
modal: {
|
|
103
|
+
close: "Aizv\u0113rt"
|
|
104
|
+
},
|
|
105
|
+
pricingTable: {
|
|
106
|
+
caption: "Cenu sal\u012Bdzin\u0101jums"
|
|
107
|
+
},
|
|
108
|
+
prose: {
|
|
109
|
+
codeCollapse: {
|
|
110
|
+
closeText: "Sak\u013Caut",
|
|
111
|
+
name: "kods",
|
|
112
|
+
openText: "Izv\u0113rst"
|
|
113
|
+
},
|
|
114
|
+
collapsible: {
|
|
115
|
+
closeText: "Pasl\u0113pt",
|
|
116
|
+
name: "\u012Bpa\u0161\u012Bbas",
|
|
117
|
+
openText: "R\u0101d\u012Bt"
|
|
118
|
+
},
|
|
119
|
+
pre: {
|
|
120
|
+
copy: "Kop\u0113t kodu"
|
|
121
|
+
},
|
|
122
|
+
prompt: {
|
|
123
|
+
copy: "Kop\u0113t vaic\u0101jumu",
|
|
124
|
+
openIn: "Atv\u0113rt iek\u0161 {name}"
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
chatReasoning: {
|
|
128
|
+
thinking: "Dom\u0101\u2026",
|
|
129
|
+
thought: "Dom\u0101ja",
|
|
130
|
+
thoughtFor: "Dom\u0101ja {duration}"
|
|
131
|
+
},
|
|
132
|
+
sidebar: {
|
|
133
|
+
close: "Aizv\u0113rt",
|
|
134
|
+
toggle: "P\u0101rsl\u0113gt"
|
|
135
|
+
},
|
|
136
|
+
selectMenu: {
|
|
137
|
+
create: 'Izveidot "{label}"',
|
|
138
|
+
noData: "Nav datu",
|
|
139
|
+
noMatch: "Nav atbilsto\u0161u datu",
|
|
140
|
+
search: "Mekl\u0113t\u2026"
|
|
141
|
+
},
|
|
142
|
+
slideover: {
|
|
143
|
+
close: "Aizv\u0113rt"
|
|
144
|
+
},
|
|
145
|
+
table: {
|
|
146
|
+
noData: "Nav datu"
|
|
147
|
+
},
|
|
148
|
+
toast: {
|
|
149
|
+
close: "Aizv\u0113rt"
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { computed } from "vue";
|
|
2
2
|
import colors from "tailwindcss/colors";
|
|
3
|
-
import { defineNuxtPlugin, useAppConfig, useNuxtApp, useHead } from "#imports";
|
|
3
|
+
import { defineNuxtPlugin, injectHead, useAppConfig, useNuxtApp, useHead } from "#imports";
|
|
4
4
|
const shades = [50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950];
|
|
5
5
|
function getColor(color, shade) {
|
|
6
6
|
if (color in colors && typeof colors[color] === "object" && shade in colors[color]) {
|
|
@@ -15,6 +15,9 @@ function generateShades(key, value, prefix) {
|
|
|
15
15
|
function generateColor(key, shade) {
|
|
16
16
|
return `--ui-${key}: var(--ui-color-${key}-${shade});`;
|
|
17
17
|
}
|
|
18
|
+
function removeTemporaryColorsStyle() {
|
|
19
|
+
document.querySelector("[data-nuxt-ui-colors]")?.remove();
|
|
20
|
+
}
|
|
18
21
|
export default defineNuxtPlugin(() => {
|
|
19
22
|
const appConfig = useAppConfig();
|
|
20
23
|
const nuxtApp = useNuxtApp();
|
|
@@ -45,9 +48,7 @@ export default defineNuxtPlugin(() => {
|
|
|
45
48
|
style.innerHTML = root.value;
|
|
46
49
|
style.setAttribute("data-nuxt-ui-colors", "");
|
|
47
50
|
document.head.appendChild(style);
|
|
48
|
-
|
|
49
|
-
innerHTML: "document.head.removeChild(document.querySelector('[data-nuxt-ui-colors]'))"
|
|
50
|
-
}];
|
|
51
|
+
injectHead().hooks.hookOnce("dom:rendered", removeTemporaryColorsStyle);
|
|
51
52
|
}
|
|
52
53
|
useHead(headData);
|
|
53
54
|
});
|
|
@@ -1,11 +1,23 @@
|
|
|
1
1
|
import type { ClassValue, TVVariants, TVCompoundVariants, TVDefaultVariants } from 'tailwind-variants';
|
|
2
|
+
/**
|
|
3
|
+
* A function form for a slot class that **replaces** the slot's default classes
|
|
4
|
+
* instead of merging onto them. It receives the slot's fully resolved default
|
|
5
|
+
* class string and returns the classes to use in its place.
|
|
6
|
+
* @example title: defaults => 'text-xl font-bold'
|
|
7
|
+
*/
|
|
8
|
+
export type SlotClassReplacer = (defaults: string) => ClassValue;
|
|
9
|
+
/**
|
|
10
|
+
* The value accepted for a slot in `:ui`, the `class` prop or `app.config.ui`:
|
|
11
|
+
* either classes to merge (the default) or a {@link SlotClassReplacer} to replace.
|
|
12
|
+
*/
|
|
13
|
+
export type SlotClass = ClassValue | SlotClassReplacer;
|
|
2
14
|
/**
|
|
3
15
|
* Defines the AppConfig object based on the tailwind-variants configuration.
|
|
4
16
|
*/
|
|
5
17
|
export type TVConfig<T extends Record<string, any>> = {
|
|
6
18
|
[P in keyof T]?: {
|
|
7
|
-
[K in keyof T[P] as K extends 'base' | 'slots' | 'variants' | 'defaultVariants' ? K : never]?: K extends 'base' ?
|
|
8
|
-
[S in keyof T[P]['slots']]?:
|
|
19
|
+
[K in keyof T[P] as K extends 'base' | 'slots' | 'variants' | 'defaultVariants' ? K : never]?: K extends 'base' ? SlotClass : K extends 'slots' ? {
|
|
20
|
+
[S in keyof T[P]['slots']]?: SlotClass;
|
|
9
21
|
} : K extends 'variants' ? TVVariants<T[P]['slots'], ClassValue, WidenVariantsValues<T[P]['variants']>> : K extends 'defaultVariants' ? TVDefaultVariants<WidenVariantsValues<T[P]['variants']>, T[P]['slots'], object, undefined> : never;
|
|
10
22
|
};
|
|
11
23
|
} & {
|
|
@@ -31,7 +43,7 @@ type ComponentVariants<T extends {
|
|
|
31
43
|
type ComponentSlots<T extends {
|
|
32
44
|
slots?: Record<string, any>;
|
|
33
45
|
}> = Id<{
|
|
34
|
-
[K in keyof T['slots']]?:
|
|
46
|
+
[K in keyof T['slots']]?: SlotClass;
|
|
35
47
|
}>;
|
|
36
48
|
type ComponentUI<T extends {
|
|
37
49
|
slots?: Record<string, any>;
|
|
@@ -1 +1,41 @@
|
|
|
1
|
-
|
|
1
|
+
import type { ClassValue, TVVariants, TVCompoundVariants, TVDefaultVariants, TVReturnType, defaultConfig } from 'tailwind-variants';
|
|
2
|
+
type TVSlots = Record<string, ClassValue> | undefined;
|
|
3
|
+
/**
|
|
4
|
+
* Widen the slot functions of a `tailwind-variants` return type so `class` /
|
|
5
|
+
* `className` also accept the `(defaults) => classes` replacer — `:ui` and the
|
|
6
|
+
* `class` prop flow straight into them. The concrete slot keys (and the
|
|
7
|
+
* extend-readable `slots` / `variants` / … properties) are preserved, so
|
|
8
|
+
* components keep type-checking under `noUncheckedIndexedAccess`.
|
|
9
|
+
*/
|
|
10
|
+
type WideSlotFn = (slotProps?: Record<string, any>) => string;
|
|
11
|
+
type Widen<R> = R extends (props?: infer P) => infer Slots ? {
|
|
12
|
+
(props?: P): Slots extends string ? string : {
|
|
13
|
+
[K in keyof Slots]: WideSlotFn;
|
|
14
|
+
};
|
|
15
|
+
} & Omit<R, never> : R;
|
|
16
|
+
/**
|
|
17
|
+
* Mirrors `tailwind-variants`' `TV` call signature (so config inference is
|
|
18
|
+
* unchanged) but returns the {@link Widen}-ed result. Component prop types are
|
|
19
|
+
* derived from `typeof theme` via `ComponentConfig`, not from this type, so the
|
|
20
|
+
* widening only affects the internal `ui.slot(...)` calls.
|
|
21
|
+
*/
|
|
22
|
+
type WideTV = {
|
|
23
|
+
<V extends TVVariants<S, B, EV>, CV extends TVCompoundVariants<V, S, B, EV, ES>, DV extends TVDefaultVariants<V, S, EV, ES>, B extends ClassValue = undefined, S extends TVSlots = undefined, E extends TVReturnType = TVReturnType<V, S, B, EV extends undefined ? {} : EV, ES extends undefined ? {} : ES>, EV extends TVVariants<ES, B, E['variants'], ES> = E['variants'], ES extends TVSlots = E['slots'] extends TVSlots ? E['slots'] : undefined>(options: {
|
|
24
|
+
extend?: E;
|
|
25
|
+
base?: B;
|
|
26
|
+
slots?: S;
|
|
27
|
+
variants?: V;
|
|
28
|
+
compoundVariants?: CV;
|
|
29
|
+
compoundSlots?: any;
|
|
30
|
+
defaultVariants?: DV;
|
|
31
|
+
}, config?: typeof defaultConfig): Widen<TVReturnType<V, S, B, EV, ES, E>>;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Wraps `tailwind-variants`' `tv` so slot classes can be **replaced** (not just
|
|
35
|
+
* merged) through a function form — `(defaults) => classes` — in `:ui`, the
|
|
36
|
+
* `class` prop and `app.config.ui`. The wrapper is transparent for every other
|
|
37
|
+
* usage: it preserves the `TVReturnType` (so `extend: tv(theme)` keeps working
|
|
38
|
+
* via property reads) and only intercepts the slot functions on invocation.
|
|
39
|
+
*/
|
|
40
|
+
export declare const tv: WideTV;
|
|
41
|
+
export {};
|
package/dist/runtime/utils/tv.js
CHANGED
|
@@ -1,4 +1,93 @@
|
|
|
1
|
-
import { createTV } from "tailwind-variants";
|
|
1
|
+
import { createTV, cnMerge } from "tailwind-variants";
|
|
2
2
|
import appConfig from "#build/app.config";
|
|
3
3
|
const appConfigTv = appConfig;
|
|
4
|
-
|
|
4
|
+
const config = appConfigTv.ui?.tv;
|
|
5
|
+
const baseTv = /* @__PURE__ */ createTV(config);
|
|
6
|
+
function findReplacer(value) {
|
|
7
|
+
if (typeof value === "function") {
|
|
8
|
+
return value;
|
|
9
|
+
}
|
|
10
|
+
if (Array.isArray(value)) {
|
|
11
|
+
for (let i = value.length - 1; i >= 0; i--) {
|
|
12
|
+
const replacer = findReplacer(value[i]);
|
|
13
|
+
if (replacer) {
|
|
14
|
+
return replacer;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
return void 0;
|
|
19
|
+
}
|
|
20
|
+
function plainClasses(value) {
|
|
21
|
+
if (Array.isArray(value)) {
|
|
22
|
+
return value.flatMap((item) => plainClasses(item));
|
|
23
|
+
}
|
|
24
|
+
if (typeof value === "function") {
|
|
25
|
+
return [];
|
|
26
|
+
}
|
|
27
|
+
return [value];
|
|
28
|
+
}
|
|
29
|
+
function applyReplacer(replacer, slotProps, resolveDefaults) {
|
|
30
|
+
return cnMerge(replacer(resolveDefaults()), ...plainClasses(slotProps.class), ...plainClasses(slotProps.className))(config) ?? "";
|
|
31
|
+
}
|
|
32
|
+
function wrapSlots(slots, directives) {
|
|
33
|
+
return new Proxy(slots, {
|
|
34
|
+
get(target, key) {
|
|
35
|
+
const slot = target[key];
|
|
36
|
+
if (typeof slot !== "function") {
|
|
37
|
+
return slot;
|
|
38
|
+
}
|
|
39
|
+
return (slotProps = {}) => {
|
|
40
|
+
const replacer = findReplacer(slotProps.class) ?? findReplacer(slotProps.className) ?? directives?.[key];
|
|
41
|
+
if (!replacer) {
|
|
42
|
+
return slot(slotProps);
|
|
43
|
+
}
|
|
44
|
+
return applyReplacer(replacer, slotProps, () => slot({ ...slotProps, class: void 0, className: void 0 }));
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
function extractDirectives(componentConfig) {
|
|
50
|
+
if (!componentConfig || typeof componentConfig !== "object") {
|
|
51
|
+
return { config: componentConfig };
|
|
52
|
+
}
|
|
53
|
+
let config2 = componentConfig;
|
|
54
|
+
let directives;
|
|
55
|
+
if (typeof componentConfig.base === "function") {
|
|
56
|
+
directives = { base: componentConfig.base };
|
|
57
|
+
config2 = { ...config2, base: "" };
|
|
58
|
+
}
|
|
59
|
+
const slots = componentConfig.slots;
|
|
60
|
+
if (slots && typeof slots === "object") {
|
|
61
|
+
const replacers = Object.entries(slots).filter(([, value]) => typeof value === "function");
|
|
62
|
+
if (replacers.length) {
|
|
63
|
+
directives ??= {};
|
|
64
|
+
const cleaned = { ...slots };
|
|
65
|
+
for (const [slot, replacer] of replacers) {
|
|
66
|
+
directives[slot] = replacer;
|
|
67
|
+
cleaned[slot] = "";
|
|
68
|
+
}
|
|
69
|
+
config2 = { ...config2, slots: cleaned };
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return { config: config2, directives };
|
|
73
|
+
}
|
|
74
|
+
export const tv = ((componentConfig) => {
|
|
75
|
+
const { config: cleanConfig, directives } = extractDirectives(componentConfig);
|
|
76
|
+
const component = baseTv(cleanConfig);
|
|
77
|
+
return new Proxy(component, {
|
|
78
|
+
apply(target, thisArg, args) {
|
|
79
|
+
const result = Reflect.apply(target, thisArg, args);
|
|
80
|
+
if (result && typeof result === "object") {
|
|
81
|
+
return wrapSlots(result, directives);
|
|
82
|
+
}
|
|
83
|
+
if (typeof result === "string") {
|
|
84
|
+
const slotProps = args[0] ?? {};
|
|
85
|
+
const replacer = findReplacer(slotProps.class) ?? findReplacer(slotProps.className) ?? directives?.base;
|
|
86
|
+
if (replacer) {
|
|
87
|
+
return applyReplacer(replacer, slotProps, () => Reflect.apply(target, thisArg, [{ ...slotProps, class: void 0, className: void 0 }]));
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return result;
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Ref } from 'vue';
|
|
2
2
|
import type { NuxtApp } from '#app';
|
|
3
|
-
export { useHead } from '@unhead/vue';
|
|
3
|
+
export { injectHead, useHead } from '@unhead/vue';
|
|
4
4
|
export { useAppConfig } from '../composables/useAppConfig';
|
|
5
5
|
export { defineShortcuts } from '../../composables/defineShortcuts';
|
|
6
6
|
export { defineLocale } from '../../composables/defineLocale';
|
|
@@ -2,7 +2,7 @@ import { ref, onScopeDispose } from "vue";
|
|
|
2
2
|
import { createHooks } from "hookable";
|
|
3
3
|
import { useColorMode as useColorModeVueUse } from "@vueuse/core";
|
|
4
4
|
import appConfig from "#build/app.config";
|
|
5
|
-
export { useHead } from "@unhead/vue";
|
|
5
|
+
export { injectHead, useHead } from "@unhead/vue";
|
|
6
6
|
export { useAppConfig } from "../composables/useAppConfig.js";
|
|
7
7
|
export { defineShortcuts } from "../../composables/defineShortcuts.js";
|
|
8
8
|
export { defineLocale } from "../../composables/defineLocale.js";
|