@nuxt/ui 4.11.0 → 4.11.1
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.json +1 -1
- package/dist/module.mjs +2 -2
- package/dist/runtime/components/Carousel.d.vue.ts +6 -6
- package/dist/runtime/components/Carousel.vue.d.ts +6 -6
- package/dist/runtime/components/ChatMessages.d.vue.ts +2 -2
- package/dist/runtime/components/ChatMessages.vue.d.ts +2 -2
- package/dist/runtime/components/Form.vue +1 -1
- package/dist/runtime/components/InputNumber.vue +8 -5
- package/dist/runtime/components/Link.vue +61 -7
- package/dist/runtime/components/NavigationMenu.vue +10 -10
- package/dist/runtime/components/Select.d.vue.ts +2 -0
- package/dist/runtime/components/Select.vue +2 -0
- package/dist/runtime/components/Select.vue.d.ts +2 -0
- package/dist/runtime/components/SelectMenu.d.vue.ts +3 -0
- package/dist/runtime/components/SelectMenu.vue +9 -2
- package/dist/runtime/components/SelectMenu.vue.d.ts +3 -0
- package/dist/runtime/components/Slider.vue +1 -1
- package/dist/runtime/components/Table.vue +5 -5
- package/dist/runtime/components/color-mode/ColorModeSelect.vue +1 -0
- package/dist/runtime/components/locale/LocaleSelect.vue +1 -0
- package/dist/runtime/components/prose/CodeTree.vue +31 -18
- package/dist/runtime/utils/form.d.ts +1 -1
- package/dist/runtime/utils/form.js +3 -1
- package/dist/runtime/utils/prefetch.d.ts +5 -0
- package/dist/runtime/utils/prefetch.js +45 -0
- package/dist/runtime/utils/search.js +8 -6
- package/dist/runtime/vue/components/color-mode/ColorModeSelect.vue +1 -0
- package/dist/shared/{ui.DNq7CNkE.mjs → ui.DCJ9twx8.mjs} +12 -11
- package/dist/unplugin.mjs +1 -1
- package/dist/vite.mjs +1 -1
- package/package.json +36 -36
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defu } from 'defu';
|
|
2
2
|
import { defineNuxtModule, createResolver, addPlugin, hasNuxtModule, addComponentsDir, addImportsDir, addImports } from '@nuxt/kit';
|
|
3
|
-
import { d as defaultOptions, r as resolveColors, c as getDefaultConfig, g as getClientBundleIcons, f as publicComposables, a as addTemplates } from './shared/ui.
|
|
3
|
+
import { d as defaultOptions, r as resolveColors, c as getDefaultConfig, g as getClientBundleIcons, f as publicComposables, a as addTemplates } from './shared/ui.DCJ9twx8.mjs';
|
|
4
4
|
import '../dist/runtime/utils/index.js';
|
|
5
5
|
import 'node:url';
|
|
6
6
|
import 'scule';
|
|
@@ -14,7 +14,7 @@ import 'tinyglobby';
|
|
|
14
14
|
import 'mlly';
|
|
15
15
|
|
|
16
16
|
const name = "@nuxt/ui";
|
|
17
|
-
const version = "4.11.
|
|
17
|
+
const version = "4.11.1";
|
|
18
18
|
|
|
19
19
|
const module$1 = defineNuxtModule({
|
|
20
20
|
meta: {
|
|
@@ -66,32 +66,32 @@ export interface CarouselProps<T extends CarouselItem = CarouselItem> extends Om
|
|
|
66
66
|
items?: T[];
|
|
67
67
|
/**
|
|
68
68
|
* Enable Autoplay plugin
|
|
69
|
-
* @see https://www.embla-carousel.com/plugins/autoplay
|
|
69
|
+
* @see https://www.embla-carousel.com/docs/v8/plugins/autoplay
|
|
70
70
|
*/
|
|
71
71
|
autoplay?: boolean | AutoplayOptionsType;
|
|
72
72
|
/**
|
|
73
73
|
* Enable Auto Scroll plugin
|
|
74
|
-
* @see https://www.embla-carousel.com/plugins/auto-scroll
|
|
74
|
+
* @see https://www.embla-carousel.com/docs/v8/plugins/auto-scroll
|
|
75
75
|
*/
|
|
76
76
|
autoScroll?: boolean | AutoScrollOptionsType;
|
|
77
77
|
/**
|
|
78
78
|
* Enable Auto Height plugin
|
|
79
|
-
* @see https://www.embla-carousel.com/plugins/auto-height
|
|
79
|
+
* @see https://www.embla-carousel.com/docs/v8/plugins/auto-height
|
|
80
80
|
*/
|
|
81
81
|
autoHeight?: boolean | AutoHeightOptionsType;
|
|
82
82
|
/**
|
|
83
83
|
* Enable Class Names plugin
|
|
84
|
-
* @see https://www.embla-carousel.com/plugins/class-names
|
|
84
|
+
* @see https://www.embla-carousel.com/docs/v8/plugins/class-names
|
|
85
85
|
*/
|
|
86
86
|
classNames?: boolean | ClassNamesOptionsType;
|
|
87
87
|
/**
|
|
88
88
|
* Enable Fade plugin
|
|
89
|
-
* @see https://www.embla-carousel.com/plugins/fade
|
|
89
|
+
* @see https://www.embla-carousel.com/docs/v8/plugins/fade
|
|
90
90
|
*/
|
|
91
91
|
fade?: boolean | FadeOptionsType;
|
|
92
92
|
/**
|
|
93
93
|
* Enable Wheel Gestures plugin
|
|
94
|
-
* @see https://www.embla-carousel.com/plugins/wheel-gestures
|
|
94
|
+
* @see https://www.embla-carousel.com/docs/v8/plugins/wheel-gestures
|
|
95
95
|
*/
|
|
96
96
|
wheelGestures?: boolean | WheelGesturesPluginOptions;
|
|
97
97
|
class?: any;
|
|
@@ -66,32 +66,32 @@ export interface CarouselProps<T extends CarouselItem = CarouselItem> extends Om
|
|
|
66
66
|
items?: T[];
|
|
67
67
|
/**
|
|
68
68
|
* Enable Autoplay plugin
|
|
69
|
-
* @see https://www.embla-carousel.com/plugins/autoplay
|
|
69
|
+
* @see https://www.embla-carousel.com/docs/v8/plugins/autoplay
|
|
70
70
|
*/
|
|
71
71
|
autoplay?: boolean | AutoplayOptionsType;
|
|
72
72
|
/**
|
|
73
73
|
* Enable Auto Scroll plugin
|
|
74
|
-
* @see https://www.embla-carousel.com/plugins/auto-scroll
|
|
74
|
+
* @see https://www.embla-carousel.com/docs/v8/plugins/auto-scroll
|
|
75
75
|
*/
|
|
76
76
|
autoScroll?: boolean | AutoScrollOptionsType;
|
|
77
77
|
/**
|
|
78
78
|
* Enable Auto Height plugin
|
|
79
|
-
* @see https://www.embla-carousel.com/plugins/auto-height
|
|
79
|
+
* @see https://www.embla-carousel.com/docs/v8/plugins/auto-height
|
|
80
80
|
*/
|
|
81
81
|
autoHeight?: boolean | AutoHeightOptionsType;
|
|
82
82
|
/**
|
|
83
83
|
* Enable Class Names plugin
|
|
84
|
-
* @see https://www.embla-carousel.com/plugins/class-names
|
|
84
|
+
* @see https://www.embla-carousel.com/docs/v8/plugins/class-names
|
|
85
85
|
*/
|
|
86
86
|
classNames?: boolean | ClassNamesOptionsType;
|
|
87
87
|
/**
|
|
88
88
|
* Enable Fade plugin
|
|
89
|
-
* @see https://www.embla-carousel.com/plugins/fade
|
|
89
|
+
* @see https://www.embla-carousel.com/docs/v8/plugins/fade
|
|
90
90
|
*/
|
|
91
91
|
fade?: boolean | FadeOptionsType;
|
|
92
92
|
/**
|
|
93
93
|
* Enable Wheel Gestures plugin
|
|
94
|
-
* @see https://www.embla-carousel.com/plugins/wheel-gestures
|
|
94
|
+
* @see https://www.embla-carousel.com/docs/v8/plugins/wheel-gestures
|
|
95
95
|
*/
|
|
96
96
|
wheelGestures?: boolean | WheelGesturesPluginOptions;
|
|
97
97
|
class?: any;
|
|
@@ -39,12 +39,12 @@ export interface ChatMessagesProps<T extends UIMessage[] = UIMessage[]> {
|
|
|
39
39
|
* The `user` messages props.
|
|
40
40
|
* `{ side: 'right', variant: 'soft' }`{lang="ts-type"}
|
|
41
41
|
*/
|
|
42
|
-
user?: Pick<PropsBase<T>, 'icon' | 'avatar' | 'variant' | 'side' | 'actions' | 'ui'>;
|
|
42
|
+
user?: Pick<PropsBase<T>, 'icon' | 'avatar' | 'variant' | 'side' | 'actions' | 'ui' | 'color'>;
|
|
43
43
|
/**
|
|
44
44
|
* The `assistant` messages props.
|
|
45
45
|
* `{ side: 'left', variant: 'naked' }`{lang="ts-type"}
|
|
46
46
|
*/
|
|
47
|
-
assistant?: Pick<PropsBase<T>, 'icon' | 'avatar' | 'variant' | 'side' | 'actions' | 'ui'>;
|
|
47
|
+
assistant?: Pick<PropsBase<T>, 'icon' | 'avatar' | 'variant' | 'side' | 'actions' | 'ui' | 'color'>;
|
|
48
48
|
/**
|
|
49
49
|
* Render the messages in a compact style.
|
|
50
50
|
* This is done automatically when used inside a `UChatPalette`{lang="ts-type"}.
|
|
@@ -39,12 +39,12 @@ export interface ChatMessagesProps<T extends UIMessage[] = UIMessage[]> {
|
|
|
39
39
|
* The `user` messages props.
|
|
40
40
|
* `{ side: 'right', variant: 'soft' }`{lang="ts-type"}
|
|
41
41
|
*/
|
|
42
|
-
user?: Pick<PropsBase<T>, 'icon' | 'avatar' | 'variant' | 'side' | 'actions' | 'ui'>;
|
|
42
|
+
user?: Pick<PropsBase<T>, 'icon' | 'avatar' | 'variant' | 'side' | 'actions' | 'ui' | 'color'>;
|
|
43
43
|
/**
|
|
44
44
|
* The `assistant` messages props.
|
|
45
45
|
* `{ side: 'left', variant: 'naked' }`{lang="ts-type"}
|
|
46
46
|
*/
|
|
47
|
-
assistant?: Pick<PropsBase<T>, 'icon' | 'avatar' | 'variant' | 'side' | 'actions' | 'ui'>;
|
|
47
|
+
assistant?: Pick<PropsBase<T>, 'icon' | 'avatar' | 'variant' | 'side' | 'actions' | 'ui' | 'color'>;
|
|
48
48
|
/**
|
|
49
49
|
* Render the messages in a compact style.
|
|
50
50
|
* This is done automatically when used inside a `UChatPalette`{lang="ts-type"}.
|
|
@@ -294,7 +294,7 @@ defineExpose(api);
|
|
|
294
294
|
:id="formId"
|
|
295
295
|
ref="formRef"
|
|
296
296
|
:name="parentBus ? void 0 : props.name"
|
|
297
|
-
method="post"
|
|
297
|
+
:method="parentBus ? void 0 : 'post'"
|
|
298
298
|
:class="ui({ class: [props.ui?.base, props.class] })"
|
|
299
299
|
@submit.prevent="onSubmitWrapper"
|
|
300
300
|
>
|
|
@@ -6,7 +6,7 @@ import theme from "#build/ui/input-number";
|
|
|
6
6
|
import { onMounted, onScopeDispose, computed, useTemplateRef, toRef } from "vue";
|
|
7
7
|
import { NumberFieldRoot, NumberFieldInput, NumberFieldDecrement, NumberFieldIncrement } from "reka-ui";
|
|
8
8
|
import { useForwardProps } from "../composables/useForwardProps";
|
|
9
|
-
import { reactivePick
|
|
9
|
+
import { reactivePick } from "@vueuse/core";
|
|
10
10
|
import { useAppConfig } from "#imports";
|
|
11
11
|
import { useComponentProps } from "../composables/useComponentProps";
|
|
12
12
|
import { useFieldGroup } from "../composables/useFieldGroup";
|
|
@@ -55,10 +55,9 @@ const _props = defineProps({
|
|
|
55
55
|
const emits = defineEmits(["update:modelValue", "blur", "change"]);
|
|
56
56
|
defineSlots();
|
|
57
57
|
const props = useComponentProps("inputNumber", _props);
|
|
58
|
-
const modelValue = useVModel(props, "modelValue", emits, { defaultValue: props.defaultValue });
|
|
59
58
|
const { t } = useLocale();
|
|
60
59
|
const appConfig = useAppConfig();
|
|
61
|
-
const rootProps = useForwardProps(reactivePick(props, "as", "stepSnapping", "formatOptions", "disableWheelChange", "invertWheelChange", "required", "readonly", "focusOnChange", "locale")
|
|
60
|
+
const rootProps = useForwardProps(reactivePick(props, "as", "stepSnapping", "formatOptions", "disableWheelChange", "invertWheelChange", "required", "readonly", "focusOnChange", "locale"));
|
|
62
61
|
const { emitFormBlur, emitFormFocus, emitFormChange, emitFormInput, id, color: formFieldColor, size: formFieldSize, name, highlight: formFieldHighlight, disabled: formFieldDisabled, ariaAttrs } = useFormField(_props);
|
|
63
62
|
const { orientation, size: fieldGroupSize } = useFieldGroup(_props);
|
|
64
63
|
const color = computed(() => formFieldColor.value ?? props.color);
|
|
@@ -81,8 +80,12 @@ const decrementIcon = computed(() => props.decrementIcon || (props.orientation =
|
|
|
81
80
|
const inputRef = useTemplateRef("inputRef");
|
|
82
81
|
function onUpdate(value) {
|
|
83
82
|
if (props.modelModifiers?.optional) {
|
|
84
|
-
|
|
83
|
+
value = value ?? void 0;
|
|
85
84
|
}
|
|
85
|
+
if (value === props.modelValue || value == null && props.modelValue == null) {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
emits("update:modelValue", value);
|
|
86
89
|
const event = new Event("change", { target: { value } });
|
|
87
90
|
emits("change", event);
|
|
88
91
|
emitFormChange();
|
|
@@ -114,7 +117,7 @@ defineExpose({
|
|
|
114
117
|
v-bind="rootProps"
|
|
115
118
|
:id="id"
|
|
116
119
|
:default-value="props.defaultValue"
|
|
117
|
-
:model-value="modelValue"
|
|
120
|
+
:model-value="props.modelValue"
|
|
118
121
|
:min="props.min"
|
|
119
122
|
:max="props.max"
|
|
120
123
|
:step="props.step"
|
|
@@ -3,16 +3,17 @@ import theme from "#build/ui/link";
|
|
|
3
3
|
</script>
|
|
4
4
|
|
|
5
5
|
<script setup>
|
|
6
|
-
import { computed } from "vue";
|
|
6
|
+
import { computed, getCurrentInstance, mergeProps, onMounted, onBeforeUnmount } from "vue";
|
|
7
7
|
import { isEqual } from "ohash/utils";
|
|
8
8
|
import { useForwardProps, Slot } from "reka-ui";
|
|
9
9
|
import { defu } from "defu";
|
|
10
10
|
import { hasProtocol } from "ufo";
|
|
11
11
|
import { reactiveOmit } from "@vueuse/core";
|
|
12
|
-
import { useRoute, useAppConfig, useNuxtApp } from "#imports";
|
|
12
|
+
import { useRoute, useAppConfig, useNuxtApp, onNuxtReady } from "#imports";
|
|
13
13
|
import { mergeClasses } from "../utils";
|
|
14
14
|
import { tv } from "../utils/tv";
|
|
15
15
|
import { isPartiallyEqual } from "../utils/link";
|
|
16
|
+
import { requestIdleCallback, cancelIdleCallback, observeIntersection } from "../utils/prefetch";
|
|
16
17
|
import ULinkBase from "./LinkBase.vue";
|
|
17
18
|
defineOptions({ inheritAttrs: false });
|
|
18
19
|
const props = defineProps({
|
|
@@ -126,13 +127,63 @@ function isLinkActive({ route: linkRoute, isActive, isExactActive } = {}) {
|
|
|
126
127
|
}
|
|
127
128
|
return false;
|
|
128
129
|
}
|
|
129
|
-
function resolveLinkClass({ route: route2, isActive, isExactActive } = {}) {
|
|
130
|
+
function resolveLinkClass({ route: route2, isActive, isExactActive, prefetched } = {}) {
|
|
130
131
|
const active = isLinkActive({ route: route2, isActive, isExactActive });
|
|
132
|
+
const prefetchedClass = prefetched ? props.prefetchedClass : void 0;
|
|
131
133
|
if (props.raw) {
|
|
132
|
-
return [props.class, active ? props.activeClass : props.inactiveClass];
|
|
134
|
+
return [props.class, active ? props.activeClass : props.inactiveClass, prefetchedClass];
|
|
133
135
|
}
|
|
134
|
-
return ui.value({ class: props.class, active, disabled: props.disabled });
|
|
136
|
+
return ui.value({ class: prefetchedClass ? [props.class, prefetchedClass] : props.class, active, disabled: props.disabled });
|
|
135
137
|
}
|
|
138
|
+
const instance = getCurrentInstance();
|
|
139
|
+
let prefetchApi;
|
|
140
|
+
function onPrefetch() {
|
|
141
|
+
prefetchApi?.prefetch?.(nuxtApp);
|
|
142
|
+
}
|
|
143
|
+
function getPrefetchListeners({ prefetch, shouldPrefetch }, attrs) {
|
|
144
|
+
if (!prefetch || !shouldPrefetch) {
|
|
145
|
+
return void 0;
|
|
146
|
+
}
|
|
147
|
+
prefetchApi = { prefetch, shouldPrefetch };
|
|
148
|
+
if (!shouldPrefetch("interaction")) {
|
|
149
|
+
return void 0;
|
|
150
|
+
}
|
|
151
|
+
return mergeProps(
|
|
152
|
+
{ onPointerenter: attrs.onPointerenter, onFocus: attrs.onFocus },
|
|
153
|
+
{ onPointerenter: onPrefetch, onFocus: onPrefetch }
|
|
154
|
+
);
|
|
155
|
+
}
|
|
156
|
+
let idleId;
|
|
157
|
+
let unobserve = null;
|
|
158
|
+
let unmounted = false;
|
|
159
|
+
onMounted(() => {
|
|
160
|
+
if (!prefetchApi?.shouldPrefetch?.("visibility")) {
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
const root = instance?.proxy?.$el;
|
|
164
|
+
const el = root instanceof Element ? root : root?.nextElementSibling;
|
|
165
|
+
if (!el) {
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
onNuxtReady(() => {
|
|
169
|
+
if (unmounted) {
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
idleId = requestIdleCallback(() => {
|
|
173
|
+
unobserve = observeIntersection(el, () => {
|
|
174
|
+
unobserve?.();
|
|
175
|
+
unobserve = null;
|
|
176
|
+
onPrefetch();
|
|
177
|
+
});
|
|
178
|
+
});
|
|
179
|
+
});
|
|
180
|
+
});
|
|
181
|
+
onBeforeUnmount(() => {
|
|
182
|
+
unmounted = true;
|
|
183
|
+
cancelIdleCallback(idleId);
|
|
184
|
+
unobserve?.();
|
|
185
|
+
unobserve = null;
|
|
186
|
+
});
|
|
136
187
|
</script>
|
|
137
188
|
|
|
138
189
|
<template>
|
|
@@ -142,6 +193,8 @@ function resolveLinkClass({ route: route2, isActive, isExactActive } = {}) {
|
|
|
142
193
|
v-bind="{
|
|
143
194
|
...$attrs,
|
|
144
195
|
...exact && isExactActive ? { 'aria-current': props.ariaCurrentValue } : {},
|
|
196
|
+
...rest.prefetched && prefetchedClass ? { class: prefetchedClass } : {},
|
|
197
|
+
...getPrefetchListeners(rest, $attrs),
|
|
145
198
|
as,
|
|
146
199
|
type,
|
|
147
200
|
disabled,
|
|
@@ -166,9 +219,10 @@ function resolveLinkClass({ route: route2, isActive, isExactActive } = {}) {
|
|
|
166
219
|
navigate,
|
|
167
220
|
rel,
|
|
168
221
|
target: rest.target,
|
|
169
|
-
isExternal: rest.isExternal
|
|
222
|
+
isExternal: rest.isExternal,
|
|
223
|
+
...getPrefetchListeners(rest, $attrs)
|
|
170
224
|
}"
|
|
171
|
-
:class="resolveLinkClass({ route: linkRoute, isActive, isExactActive })"
|
|
225
|
+
:class="resolveLinkClass({ route: linkRoute, isActive, isExactActive, prefetched: rest.prefetched })"
|
|
172
226
|
>
|
|
173
227
|
<slot :active="isLinkActive({ route: linkRoute, isActive, isExactActive })" />
|
|
174
228
|
</ULinkBase>
|
|
@@ -106,13 +106,13 @@ function getAccordionDefaultValue(list, level = 0, listIndex = 0) {
|
|
|
106
106
|
}, []);
|
|
107
107
|
return props.type === "single" ? indexes[0] : indexes;
|
|
108
108
|
}
|
|
109
|
-
function onLinkTrailingClick(e, item) {
|
|
109
|
+
function onLinkTrailingClick(e, item, trailingTrigger) {
|
|
110
110
|
if (!item.children?.length) {
|
|
111
111
|
return;
|
|
112
112
|
}
|
|
113
113
|
if (props.orientation === "horizontal") {
|
|
114
114
|
e.preventDefault();
|
|
115
|
-
} else if (props.orientation === "vertical" && !props.collapsed) {
|
|
115
|
+
} else if (props.orientation === "vertical" && !props.collapsed && trailingTrigger) {
|
|
116
116
|
e.preventDefault();
|
|
117
117
|
e.stopPropagation();
|
|
118
118
|
}
|
|
@@ -120,7 +120,7 @@ function onLinkTrailingClick(e, item) {
|
|
|
120
120
|
</script>
|
|
121
121
|
|
|
122
122
|
<template>
|
|
123
|
-
<DefineLinkTemplate v-slot="{ item, active, index }">
|
|
123
|
+
<DefineLinkTemplate v-slot="{ item, active, index, trailingTrigger }">
|
|
124
124
|
<slot :name="item.slot || 'item'" :item="item" :index="index" :active="active" :ui="ui">
|
|
125
125
|
<slot :name="item.slot ? `${item.slot}-leading` : 'item-leading'" :item="item" :active="active" :index="index" :ui="ui">
|
|
126
126
|
<UAvatar v-if="item.avatar" :size="item.ui?.linkLeadingAvatarSize || props.ui?.linkLeadingAvatarSize || ui.linkLeadingAvatarSize()" v-bind="item.avatar" data-slot="linkLeadingAvatar" :class="ui.linkLeadingAvatar({ class: [props.ui?.linkLeadingAvatar, item.ui?.linkLeadingAvatar], active, disabled: !!item.disabled })" />
|
|
@@ -149,12 +149,12 @@ function onLinkTrailingClick(e, item) {
|
|
|
149
149
|
</span>
|
|
150
150
|
|
|
151
151
|
<component
|
|
152
|
-
:is="props.orientation === 'vertical' && item.children?.length && !props.collapsed ? AccordionTrigger : 'span'"
|
|
152
|
+
:is="props.orientation === 'vertical' && item.children?.length && !props.collapsed && trailingTrigger ? AccordionTrigger : 'span'"
|
|
153
153
|
v-if="item.badge || item.badge === 0 || props.orientation === 'horizontal' && (item.children?.length || !!slots[item.slot ? `${item.slot}-content` : 'item-content']) || props.orientation === 'vertical' && item.children?.length || item.trailingIcon || !!slots[item.slot ? `${item.slot}-trailing` : 'item-trailing']"
|
|
154
|
-
:as="props.orientation === 'vertical' && item.children?.length && !props.collapsed ? 'span' : void 0"
|
|
154
|
+
:as="props.orientation === 'vertical' && item.children?.length && !props.collapsed && trailingTrigger ? 'span' : void 0"
|
|
155
155
|
data-slot="linkTrailing"
|
|
156
156
|
:class="ui.linkTrailing({ class: [props.ui?.linkTrailing, item.ui?.linkTrailing] })"
|
|
157
|
-
@click="(e) => onLinkTrailingClick(e, item)"
|
|
157
|
+
@click="(e) => onLinkTrailingClick(e, item, trailingTrigger)"
|
|
158
158
|
>
|
|
159
159
|
<slot :name="item.slot ? `${item.slot}-trailing` : 'item-trailing'" :item="item" :active="active" :index="index" :ui="ui">
|
|
160
160
|
<UBadge
|
|
@@ -182,7 +182,7 @@ function onLinkTrailingClick(e, item) {
|
|
|
182
182
|
:value="getItemValue(item, index, level, listIndex)"
|
|
183
183
|
>
|
|
184
184
|
<div v-if="props.orientation === 'vertical' && item.type === 'label' && !props.collapsed" data-slot="label" :class="ui.label({ class: [props.ui?.label, item.ui?.label, item.class] })">
|
|
185
|
-
<ReuseLinkTemplate :item="item" :index="index" />
|
|
185
|
+
<ReuseLinkTemplate :item="item" :index="index" :trailing-trigger="true" />
|
|
186
186
|
</div>
|
|
187
187
|
<ULink v-else-if="item.type !== 'label'" v-slot="{ active, ...slotProps }" v-bind="props.orientation === 'vertical' && item.children?.length && !props.collapsed && item.type === 'trigger' ? {} : pickLinkProps(item)" custom>
|
|
188
188
|
<component
|
|
@@ -194,7 +194,7 @@ function onLinkTrailingClick(e, item) {
|
|
|
194
194
|
>
|
|
195
195
|
<UPopover v-if="props.orientation === 'vertical' && props.collapsed && item.children?.length && (!!props.popover || !!item.popover)" v-bind="{ ...popoverProps, ...typeof item.popover === 'boolean' ? {} : item.popover || {} }" :ui="{ content: ui.content({ class: [props.ui?.content, item.ui?.content] }) }">
|
|
196
196
|
<ULinkBase v-bind="slotProps" data-slot="link" :class="ui.link({ class: [props.ui?.link, item.ui?.link, item.class], active: active || item.active, disabled: !!item.disabled, level: level > 0 })">
|
|
197
|
-
<ReuseLinkTemplate :item="item" :active="active || item.active" :index="index" />
|
|
197
|
+
<ReuseLinkTemplate :item="item" :active="active || item.active" :index="index" :trailing-trigger="!!slotProps.href" />
|
|
198
198
|
</ULinkBase>
|
|
199
199
|
|
|
200
200
|
<template #content="{ close }">
|
|
@@ -231,11 +231,11 @@ function onLinkTrailingClick(e, item) {
|
|
|
231
231
|
</UPopover>
|
|
232
232
|
<UTooltip v-else-if="props.orientation === 'vertical' && props.collapsed && (!!props.tooltip || !!item.tooltip) || props.orientation === 'horizontal' && !!item.tooltip" :text="get(item, props.labelKey)" v-bind="{ ...tooltipProps, ...typeof item.tooltip === 'boolean' ? {} : item.tooltip || {} }">
|
|
233
233
|
<ULinkBase v-bind="slotProps" data-slot="link" :class="ui.link({ class: [props.ui?.link, item.ui?.link, item.class], active: active || item.active, disabled: !!item.disabled, level: level > 0 })">
|
|
234
|
-
<ReuseLinkTemplate :item="item" :active="active || item.active" :index="index" />
|
|
234
|
+
<ReuseLinkTemplate :item="item" :active="active || item.active" :index="index" :trailing-trigger="!!slotProps.href" />
|
|
235
235
|
</ULinkBase>
|
|
236
236
|
</UTooltip>
|
|
237
237
|
<ULinkBase v-else v-bind="slotProps" data-slot="link" :class="ui.link({ class: [props.ui?.link, item.ui?.link, item.class], active: active || item.active, disabled: !!item.disabled, level: props.orientation === 'horizontal' || level > 0 })">
|
|
238
|
-
<ReuseLinkTemplate :item="item" :active="active || item.active" :index="index" />
|
|
238
|
+
<ReuseLinkTemplate :item="item" :active="active || item.active" :index="index" :trailing-trigger="!!slotProps.href" />
|
|
239
239
|
</ULinkBase>
|
|
240
240
|
</component>
|
|
241
241
|
|
|
@@ -105,6 +105,8 @@ export interface SelectProps<T extends ArrayOrNested<SelectItem> = ArrayOrNested
|
|
|
105
105
|
multiple?: M & boolean;
|
|
106
106
|
/** Highlight the ring color like a focus state. */
|
|
107
107
|
highlight?: boolean;
|
|
108
|
+
/** Keep the mobile text size on all breakpoints. */
|
|
109
|
+
fixed?: boolean;
|
|
108
110
|
autofocus?: boolean;
|
|
109
111
|
autofocusDelay?: number;
|
|
110
112
|
class?: any;
|
|
@@ -40,6 +40,7 @@ const _props = defineProps({
|
|
|
40
40
|
modelModifiers: { type: null, required: false },
|
|
41
41
|
multiple: { type: Boolean, required: false },
|
|
42
42
|
highlight: { type: Boolean, required: false },
|
|
43
|
+
fixed: { type: Boolean, required: false },
|
|
43
44
|
autofocus: { type: Boolean, required: false },
|
|
44
45
|
autofocusDelay: { type: Number, required: false, default: 0 },
|
|
45
46
|
class: { type: null, required: false },
|
|
@@ -90,6 +91,7 @@ const ui = computed(() => tv({ extend: theme, ...appConfig.ui?.select || {} })({
|
|
|
90
91
|
size: size.value,
|
|
91
92
|
loading: props.loading,
|
|
92
93
|
highlight: highlight.value,
|
|
94
|
+
fixed: props.fixed,
|
|
93
95
|
leading: isLeading.value || !!props.avatar || !!slots.leading,
|
|
94
96
|
trailing: isTrailing.value || !!slots.trailing,
|
|
95
97
|
fieldGroup: orientation.value,
|
|
@@ -105,6 +105,8 @@ export interface SelectProps<T extends ArrayOrNested<SelectItem> = ArrayOrNested
|
|
|
105
105
|
multiple?: M & boolean;
|
|
106
106
|
/** Highlight the ring color like a focus state. */
|
|
107
107
|
highlight?: boolean;
|
|
108
|
+
/** Keep the mobile text size on all breakpoints. */
|
|
109
|
+
fixed?: boolean;
|
|
108
110
|
autofocus?: boolean;
|
|
109
111
|
autofocusDelay?: number;
|
|
110
112
|
class?: any;
|
|
@@ -47,6 +47,7 @@ export interface SelectMenuProps<T extends ArrayOrNested<SelectMenuItem> = Array
|
|
|
47
47
|
* Whether to display the search input or not.
|
|
48
48
|
* Can be an object to pass additional props to the input.
|
|
49
49
|
* `{ placeholder: 'Search...', variant: 'none' }`{lang="ts-type"}
|
|
50
|
+
* Set `autofocus: false` to prevent the search input from being focused when the menu opens (e.g. to avoid opening the virtual keyboard on touch devices).
|
|
50
51
|
* @defaultValue true
|
|
51
52
|
*/
|
|
52
53
|
searchInput?: boolean | Omit<InputProps, 'modelValue' | 'defaultValue'>;
|
|
@@ -145,6 +146,8 @@ export interface SelectMenuProps<T extends ArrayOrNested<SelectMenuItem> = Array
|
|
|
145
146
|
multiple?: M & boolean;
|
|
146
147
|
/** Highlight the ring color like a focus state. */
|
|
147
148
|
highlight?: boolean;
|
|
149
|
+
/** Keep the mobile text size on all breakpoints. */
|
|
150
|
+
fixed?: boolean;
|
|
148
151
|
/**
|
|
149
152
|
* Determines if custom user input that does not exist in options can be added.
|
|
150
153
|
* @defaultValue false
|
|
@@ -50,6 +50,7 @@ const _props = defineProps({
|
|
|
50
50
|
modelModifiers: { type: null, required: false },
|
|
51
51
|
multiple: { type: Boolean, required: false },
|
|
52
52
|
highlight: { type: Boolean, required: false },
|
|
53
|
+
fixed: { type: Boolean, required: false },
|
|
53
54
|
createItem: { type: [Boolean, String, Object], required: false },
|
|
54
55
|
filterFields: { type: Array, required: false },
|
|
55
56
|
ignoreFilter: { type: Boolean, required: false },
|
|
@@ -92,7 +93,7 @@ const virtualizerProps = toRef(() => {
|
|
|
92
93
|
estimateSize: getEstimateSize(filteredItems.value, size.value ?? "md", props.descriptionKey, !!slots["item-description"])
|
|
93
94
|
});
|
|
94
95
|
});
|
|
95
|
-
const searchInputProps = toRef(() => defu(props.searchInput, { placeholder: t("selectMenu.search"), variant: "none" }));
|
|
96
|
+
const searchInputProps = toRef(() => defu(props.searchInput, { placeholder: t("selectMenu.search"), variant: "none", fixed: props.fixed }));
|
|
96
97
|
const { emitFormBlur, emitFormFocus, emitFormInput, emitFormChange, size: formFieldSize, color: formFieldColor, id, name, highlight: formFieldHighlight, disabled: formFieldDisabled, ariaAttrs } = useFormField(_props);
|
|
97
98
|
const { orientation, size: fieldGroupSize } = useFieldGroup(_props);
|
|
98
99
|
const { isLeading, isTrailing, leadingIconName, trailingIconName } = useComponentIcons(computed(() => ({
|
|
@@ -127,6 +128,7 @@ const ui = computed(() => tv({ extend: theme, ...appConfig.ui?.selectMenu || {}
|
|
|
127
128
|
size: size.value,
|
|
128
129
|
loading: props.loading,
|
|
129
130
|
highlight: highlight.value,
|
|
131
|
+
fixed: props.fixed,
|
|
130
132
|
leading: isLeading.value || !!props.avatar || !!slots.leading,
|
|
131
133
|
trailing: isTrailing.value || !!slots.trailing,
|
|
132
134
|
fieldGroup: orientation.value,
|
|
@@ -262,6 +264,11 @@ function isModelValueEmpty(modelValue) {
|
|
|
262
264
|
function onClear() {
|
|
263
265
|
emits("clear");
|
|
264
266
|
}
|
|
267
|
+
function onMountAutoFocus(event) {
|
|
268
|
+
if (searchInputProps.value.autofocus === false) {
|
|
269
|
+
event.preventDefault();
|
|
270
|
+
}
|
|
271
|
+
}
|
|
265
272
|
const viewportRef = useTemplateRef("viewportRef");
|
|
266
273
|
const comboboxRootRef = useTemplateRef("comboboxRootRef");
|
|
267
274
|
watch(() => props.items, async () => {
|
|
@@ -412,7 +419,7 @@ defineExpose({
|
|
|
412
419
|
<ComboboxPortal v-bind="portalProps">
|
|
413
420
|
<FieldGroupReset>
|
|
414
421
|
<ComboboxContent data-slot="content" :class="ui.content({ class: props.ui?.content })" v-bind="contentProps">
|
|
415
|
-
<FocusScope trapped data-slot="focusScope" :class="ui.focusScope({ class: props.ui?.focusScope })">
|
|
422
|
+
<FocusScope trapped data-slot="focusScope" :class="ui.focusScope({ class: props.ui?.focusScope })" @mount-auto-focus="onMountAutoFocus">
|
|
416
423
|
<slot name="content-top" />
|
|
417
424
|
|
|
418
425
|
<ComboboxInput v-if="!!props.searchInput" v-model="searchTerm" :display-value="() => searchTerm" as-child>
|
|
@@ -47,6 +47,7 @@ export interface SelectMenuProps<T extends ArrayOrNested<SelectMenuItem> = Array
|
|
|
47
47
|
* Whether to display the search input or not.
|
|
48
48
|
* Can be an object to pass additional props to the input.
|
|
49
49
|
* `{ placeholder: 'Search...', variant: 'none' }`{lang="ts-type"}
|
|
50
|
+
* Set `autofocus: false` to prevent the search input from being focused when the menu opens (e.g. to avoid opening the virtual keyboard on touch devices).
|
|
50
51
|
* @defaultValue true
|
|
51
52
|
*/
|
|
52
53
|
searchInput?: boolean | Omit<InputProps, 'modelValue' | 'defaultValue'>;
|
|
@@ -145,6 +146,8 @@ export interface SelectMenuProps<T extends ArrayOrNested<SelectMenuItem> = Array
|
|
|
145
146
|
multiple?: M & boolean;
|
|
146
147
|
/** Highlight the ring color like a focus state. */
|
|
147
148
|
highlight?: boolean;
|
|
149
|
+
/** Keep the mobile text size on all breakpoints. */
|
|
150
|
+
fixed?: boolean;
|
|
148
151
|
/**
|
|
149
152
|
* Determines if custom user input that does not exist in options can be added.
|
|
150
153
|
* @defaultValue false
|
|
@@ -35,7 +35,7 @@ defineOptions({ inheritAttrs: false });
|
|
|
35
35
|
const props = useComponentProps("slider", _props);
|
|
36
36
|
const modelValue = defineModel({ type: null });
|
|
37
37
|
const appConfig = useAppConfig();
|
|
38
|
-
const rootProps = useForwardProps(reactivePick(props, "as", "orientation", "min", "max", "step", "minStepsBetweenThumbs", "inverted")
|
|
38
|
+
const rootProps = useForwardProps(reactivePick(props, "as", "orientation", "min", "max", "step", "minStepsBetweenThumbs", "inverted"));
|
|
39
39
|
const { id, emitFormChange, emitFormInput, size: formFieldSize, color: formFieldColor, name, disabled: formFieldDisabled, ariaAttrs } = useFormField(_props);
|
|
40
40
|
const color = computed(() => formFieldColor.value ?? props.color);
|
|
41
41
|
const size = computed(() => formFieldSize.value ?? props.size);
|
|
@@ -359,7 +359,7 @@ defineExpose({
|
|
|
359
359
|
</tr>
|
|
360
360
|
|
|
361
361
|
<tr v-if="row.getIsExpanded()" data-slot="tr" :class="ui.tr({ class: [props.ui?.tr] })">
|
|
362
|
-
<td :colspan="row.
|
|
362
|
+
<td :colspan="row.getVisibleCells().length" data-slot="td" :class="ui.td({ class: [props.ui?.td] })">
|
|
363
363
|
<slot name="expanded" :row="row" />
|
|
364
364
|
</td>
|
|
365
365
|
</tr>
|
|
@@ -412,7 +412,7 @@ defineExpose({
|
|
|
412
412
|
|
|
413
413
|
<template v-if="virtualizer">
|
|
414
414
|
<tr v-if="virtualPaddingTop > 0" :style="{ height: `${virtualPaddingTop}px` }" aria-hidden="true">
|
|
415
|
-
<td :colspan="tableApi.
|
|
415
|
+
<td :colspan="tableApi.getVisibleLeafColumns().length" />
|
|
416
416
|
</tr>
|
|
417
417
|
<template v-for="virtualRow in virtualItems" :key="centerRows[virtualRow.index]?.id ?? `virtual-${virtualRow.index}`">
|
|
418
418
|
<ReuseRowTemplate
|
|
@@ -422,7 +422,7 @@ defineExpose({
|
|
|
422
422
|
/>
|
|
423
423
|
</template>
|
|
424
424
|
<tr v-if="virtualPaddingBottom > 0" :style="{ height: `${virtualPaddingBottom}px` }" aria-hidden="true">
|
|
425
|
-
<td :colspan="tableApi.
|
|
425
|
+
<td :colspan="tableApi.getVisibleLeafColumns().length" />
|
|
426
426
|
</tr>
|
|
427
427
|
</template>
|
|
428
428
|
|
|
@@ -434,13 +434,13 @@ defineExpose({
|
|
|
434
434
|
</template>
|
|
435
435
|
|
|
436
436
|
<tr v-else-if="props.loading && !!slots['loading']">
|
|
437
|
-
<td :colspan="tableApi.
|
|
437
|
+
<td :colspan="tableApi.getVisibleLeafColumns().length" data-slot="loading" :class="ui.loading({ class: props.ui?.loading })">
|
|
438
438
|
<slot name="loading" />
|
|
439
439
|
</td>
|
|
440
440
|
</tr>
|
|
441
441
|
|
|
442
442
|
<tr v-else>
|
|
443
|
-
<td :colspan="tableApi.
|
|
443
|
+
<td :colspan="tableApi.getVisibleLeafColumns().length" data-slot="empty" :class="ui.empty({ class: props.ui?.empty })">
|
|
444
444
|
<slot name="empty">
|
|
445
445
|
{{ props.empty || t("table.noData") }}
|
|
446
446
|
</slot>
|
|
@@ -32,6 +32,7 @@ const props = defineProps({
|
|
|
32
32
|
modelModifiers: { type: null, required: false },
|
|
33
33
|
multiple: { type: Boolean, required: false },
|
|
34
34
|
highlight: { type: Boolean, required: false },
|
|
35
|
+
fixed: { type: Boolean, required: false },
|
|
35
36
|
createItem: { type: [Boolean, String, Object], required: false },
|
|
36
37
|
filterFields: { type: Array, required: false },
|
|
37
38
|
ignoreFilter: { type: Boolean, required: false },
|
|
@@ -31,6 +31,7 @@ const props = defineProps({
|
|
|
31
31
|
modelModifiers: { type: null, required: false },
|
|
32
32
|
multiple: { type: Boolean, required: false },
|
|
33
33
|
highlight: { type: Boolean, required: false },
|
|
34
|
+
fixed: { type: Boolean, required: false },
|
|
34
35
|
createItem: { type: [Boolean, String, Object], required: false },
|
|
35
36
|
filterFields: { type: Array, required: false },
|
|
36
37
|
ignoreFilter: { type: Boolean, required: false },
|
|
@@ -3,7 +3,7 @@ import theme from "#build/ui/prose/code-tree";
|
|
|
3
3
|
</script>
|
|
4
4
|
|
|
5
5
|
<script setup>
|
|
6
|
-
import { computed, watch, onBeforeUpdate, ref } from "vue";
|
|
6
|
+
import { computed, watch, onBeforeUpdate, onMounted, ref } from "vue";
|
|
7
7
|
import { TreeRoot, TreeItem } from "reka-ui";
|
|
8
8
|
import { createReusableTemplate } from "@vueuse/core";
|
|
9
9
|
import { useAppConfig } from "#imports";
|
|
@@ -28,7 +28,6 @@ const [DefineTreeTemplate, ReuseTreeTemplate] = createReusableTemplate();
|
|
|
28
28
|
const ui = computed(() => tv({ extend: theme, ...appConfig.ui?.prose?.codeTree || {} })());
|
|
29
29
|
const initialPath = props.modelValue ?? props.defaultValue;
|
|
30
30
|
const model = ref(initialPath ? { path: initialPath } : void 0);
|
|
31
|
-
const lastSelectedItem = ref();
|
|
32
31
|
watch(model, (value) => {
|
|
33
32
|
if (value?.path !== props.modelValue) {
|
|
34
33
|
emits("update:modelValue", value?.path);
|
|
@@ -37,12 +36,13 @@ watch(model, (value) => {
|
|
|
37
36
|
watch(() => props.modelValue, (value) => {
|
|
38
37
|
if (value === model.value?.path) return;
|
|
39
38
|
model.value = value ? { path: value } : void 0;
|
|
40
|
-
const
|
|
41
|
-
for (const path of
|
|
42
|
-
if (!
|
|
43
|
-
|
|
39
|
+
const next = [...expanded.value];
|
|
40
|
+
for (const path of getExpandedPaths(value)) {
|
|
41
|
+
if (!next.includes(path)) {
|
|
42
|
+
next.push(path);
|
|
44
43
|
}
|
|
45
44
|
}
|
|
45
|
+
expanded.value = next;
|
|
46
46
|
});
|
|
47
47
|
const rerenderCount = ref(1);
|
|
48
48
|
const flatItems = computed(() => {
|
|
@@ -101,21 +101,34 @@ function getExpandedPaths(path) {
|
|
|
101
101
|
const parts = path.split("/");
|
|
102
102
|
return parts.slice(0, -1).map((_, index) => parts.slice(0, index + 1).join("/"));
|
|
103
103
|
}
|
|
104
|
-
const
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
if (newLabels !== oldLabels) {
|
|
110
|
-
expanded.value = getExpandedPaths();
|
|
104
|
+
const expandedOverride = ref(props.expandAll ? null : getExpandedPaths(model.value?.path));
|
|
105
|
+
const expanded = computed({
|
|
106
|
+
get: () => expandedOverride.value ?? getExpandedPaths(),
|
|
107
|
+
set: (value) => {
|
|
108
|
+
expandedOverride.value = value;
|
|
111
109
|
}
|
|
112
110
|
});
|
|
113
|
-
watch(
|
|
114
|
-
|
|
111
|
+
watch(() => props.expandAll, (value) => {
|
|
112
|
+
expandedOverride.value = value ? null : getExpandedPaths(model.value?.path);
|
|
113
|
+
});
|
|
114
|
+
onMounted(() => {
|
|
115
|
+
watch(flatItems, (newItems, oldItems) => {
|
|
116
|
+
if (!props.expandAll) return;
|
|
117
|
+
const newLabels = newItems.map((i) => i.label).join("\n");
|
|
118
|
+
const oldLabels = oldItems?.map((i) => i.label).join("\n") ?? "";
|
|
119
|
+
if (newLabels !== oldLabels) {
|
|
120
|
+
expandedOverride.value = null;
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
});
|
|
124
|
+
let lastFile;
|
|
125
|
+
const currentFile = computed(() => {
|
|
126
|
+
const item = flatItems.value.find((item2) => model.value?.path === item2.label);
|
|
115
127
|
if (item?.component) {
|
|
116
|
-
|
|
128
|
+
lastFile = item;
|
|
117
129
|
}
|
|
118
|
-
|
|
130
|
+
return lastFile;
|
|
131
|
+
});
|
|
119
132
|
onBeforeUpdate(() => rerenderCount.value++);
|
|
120
133
|
</script>
|
|
121
134
|
|
|
@@ -183,7 +196,7 @@ onBeforeUpdate(() => rerenderCount.value++);
|
|
|
183
196
|
</TreeRoot>
|
|
184
197
|
|
|
185
198
|
<div :class="ui.content({ class: props.ui?.content })">
|
|
186
|
-
<component :is="
|
|
199
|
+
<component :is="currentFile?.component" />
|
|
187
200
|
</div>
|
|
188
201
|
</div>
|
|
189
202
|
</template>
|
|
@@ -4,6 +4,6 @@ import type { FormSchema, ValidateReturnSchema } from '../types/form';
|
|
|
4
4
|
export declare function isSuperStructSchema(schema: any): schema is Struct<any, any>;
|
|
5
5
|
export declare function isStandardSchema(schema: any): schema is StandardSchemaV1;
|
|
6
6
|
export declare function validateStandardSchema(state: any, schema: StandardSchemaV1): Promise<ValidateReturnSchema<typeof state>>;
|
|
7
|
-
export declare function validateSchema<T extends object>(state: T,
|
|
7
|
+
export declare function validateSchema<T extends object>(state: T, _schema: FormSchema<T>): Promise<ValidateReturnSchema<typeof state>>;
|
|
8
8
|
export declare function getAtPath<T extends object>(data: T, path?: string): any;
|
|
9
9
|
export declare function setAtPath<T extends object>(data: T, path: string, value: any): T;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { toRaw } from "vue";
|
|
1
2
|
export function isSuperStructSchema(schema) {
|
|
2
3
|
return "schema" in schema && typeof schema.coercer === "function" && typeof schema.validator === "function" && typeof schema.refiner === "function";
|
|
3
4
|
}
|
|
@@ -37,7 +38,8 @@ async function validateSuperstructSchema(state, schema) {
|
|
|
37
38
|
result
|
|
38
39
|
};
|
|
39
40
|
}
|
|
40
|
-
export function validateSchema(state,
|
|
41
|
+
export function validateSchema(state, _schema) {
|
|
42
|
+
const schema = toRaw(_schema);
|
|
41
43
|
if (isStandardSchema(schema)) {
|
|
42
44
|
return validateStandardSchema(state, schema);
|
|
43
45
|
} else if (isSuperStructSchema(schema)) {
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
type IdleCallbackHandle = ReturnType<typeof setTimeout> | number;
|
|
2
|
+
export declare function requestIdleCallback(callback: () => void): IdleCallbackHandle | undefined;
|
|
3
|
+
export declare function cancelIdleCallback(handle: IdleCallbackHandle | undefined): void;
|
|
4
|
+
export declare function observeIntersection(element: Element, callback: () => void): () => void;
|
|
5
|
+
export {};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export function requestIdleCallback(callback) {
|
|
2
|
+
if (typeof window === "undefined") {
|
|
3
|
+
return;
|
|
4
|
+
}
|
|
5
|
+
if (typeof window.requestIdleCallback === "function") {
|
|
6
|
+
return window.requestIdleCallback(callback);
|
|
7
|
+
}
|
|
8
|
+
return setTimeout(callback, 1);
|
|
9
|
+
}
|
|
10
|
+
export function cancelIdleCallback(handle) {
|
|
11
|
+
if (typeof window === "undefined" || handle === void 0) {
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
if (typeof window.cancelIdleCallback === "function") {
|
|
15
|
+
window.cancelIdleCallback(handle);
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
clearTimeout(handle);
|
|
19
|
+
}
|
|
20
|
+
let observer = null;
|
|
21
|
+
const callbacks = /* @__PURE__ */ new Map();
|
|
22
|
+
export function observeIntersection(element, callback) {
|
|
23
|
+
if (typeof IntersectionObserver === "undefined") {
|
|
24
|
+
return () => {
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
observer ||= new IntersectionObserver((entries) => {
|
|
28
|
+
for (const entry of entries) {
|
|
29
|
+
const callback2 = callbacks.get(entry.target);
|
|
30
|
+
if ((entry.isIntersecting || entry.intersectionRatio > 0) && callback2) {
|
|
31
|
+
callback2();
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
callbacks.set(element, callback);
|
|
36
|
+
observer.observe(element);
|
|
37
|
+
return () => {
|
|
38
|
+
callbacks.delete(element);
|
|
39
|
+
observer?.unobserve(element);
|
|
40
|
+
if (callbacks.size === 0) {
|
|
41
|
+
observer?.disconnect();
|
|
42
|
+
observer = null;
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
}
|
|
@@ -12,19 +12,21 @@ function truncateHTMLFromStart(html, maxLength) {
|
|
|
12
12
|
let truncated = "";
|
|
13
13
|
let totalLength = 0;
|
|
14
14
|
let insideTag = false;
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
const chars = Array.from(html);
|
|
16
|
+
for (let i = chars.length - 1; i >= 0; i--) {
|
|
17
|
+
const char = chars[i];
|
|
18
|
+
if (char === ">") {
|
|
17
19
|
insideTag = true;
|
|
18
|
-
} else if (
|
|
20
|
+
} else if (char === "<") {
|
|
19
21
|
insideTag = false;
|
|
20
|
-
truncated =
|
|
22
|
+
truncated = char + truncated;
|
|
21
23
|
continue;
|
|
22
24
|
}
|
|
23
25
|
if (!insideTag) {
|
|
24
26
|
totalLength++;
|
|
25
27
|
}
|
|
26
28
|
if (totalLength <= maxLength) {
|
|
27
|
-
truncated =
|
|
29
|
+
truncated = char + truncated;
|
|
28
30
|
} else {
|
|
29
31
|
truncated = "..." + truncated;
|
|
30
32
|
break;
|
|
@@ -63,7 +65,7 @@ export function highlight(item, searchTerm, forceKey, omitKeys, useTokenSearch)
|
|
|
63
65
|
content += escapeHTML(value.substring(nextUnhighlightedRegionStartingIndex));
|
|
64
66
|
const markIndex = content.indexOf("<mark>");
|
|
65
67
|
if (markIndex !== -1) {
|
|
66
|
-
content = truncateHTMLFromStart(content, content.
|
|
68
|
+
content = truncateHTMLFromStart(content, Array.from(content.slice(markIndex)).length);
|
|
67
69
|
}
|
|
68
70
|
return content;
|
|
69
71
|
}
|
|
@@ -32,6 +32,7 @@ const props = defineProps({
|
|
|
32
32
|
modelModifiers: { type: null, required: false },
|
|
33
33
|
multiple: { type: Boolean, required: false },
|
|
34
34
|
highlight: { type: Boolean, required: false },
|
|
35
|
+
fixed: { type: Boolean, required: false },
|
|
35
36
|
createItem: { type: [Boolean, String, Object], required: false },
|
|
36
37
|
filterFields: { type: Array, required: false },
|
|
37
38
|
ignoreFilter: { type: Boolean, required: false },
|
|
@@ -1753,7 +1753,7 @@ const checkbox = (options) => ({
|
|
|
1753
1753
|
root: ""
|
|
1754
1754
|
},
|
|
1755
1755
|
card: {
|
|
1756
|
-
root: [`border border-
|
|
1756
|
+
root: [`border border-default rounded-lg ${hover}bg-elevated/50`, options.theme.transitions && "transition-colors"]
|
|
1757
1757
|
}
|
|
1758
1758
|
},
|
|
1759
1759
|
indicator: {
|
|
@@ -1952,10 +1952,14 @@ const checkboxGroup = (options) => ({
|
|
|
1952
1952
|
neutral: {}
|
|
1953
1953
|
},
|
|
1954
1954
|
variant: {
|
|
1955
|
-
list: {
|
|
1956
|
-
|
|
1955
|
+
list: {
|
|
1956
|
+
fieldset: "flex-wrap"
|
|
1957
|
+
},
|
|
1958
|
+
card: {
|
|
1959
|
+
fieldset: "flex-wrap"
|
|
1960
|
+
},
|
|
1957
1961
|
table: {
|
|
1958
|
-
item: [`border border-
|
|
1962
|
+
item: [`border border-default ${hover}bg-elevated/50`, options.theme.transitions && "transition-colors"]
|
|
1959
1963
|
}
|
|
1960
1964
|
},
|
|
1961
1965
|
size: {
|
|
@@ -5794,13 +5798,15 @@ const radioGroup = (options) => ({
|
|
|
5794
5798
|
},
|
|
5795
5799
|
variant: {
|
|
5796
5800
|
list: {
|
|
5801
|
+
fieldset: "flex-wrap",
|
|
5797
5802
|
item: ""
|
|
5798
5803
|
},
|
|
5799
5804
|
card: {
|
|
5800
|
-
|
|
5805
|
+
fieldset: "flex-wrap",
|
|
5806
|
+
item: [`border border-default rounded-lg ${hover}bg-elevated/50`, options.theme.transitions && "transition-colors"]
|
|
5801
5807
|
},
|
|
5802
5808
|
table: {
|
|
5803
|
-
item: [`border border-
|
|
5809
|
+
item: [`border border-default ${hover}bg-elevated/50`, options.theme.transitions && "transition-colors"]
|
|
5804
5810
|
}
|
|
5805
5811
|
},
|
|
5806
5812
|
orientation: {
|
|
@@ -6085,7 +6091,6 @@ const select = (options) => {
|
|
|
6085
6091
|
}),
|
|
6086
6092
|
size: {
|
|
6087
6093
|
xs: {
|
|
6088
|
-
base: "px-2 py-1 text-xs gap-1",
|
|
6089
6094
|
label: "p-1 text-[10px]/3 gap-1",
|
|
6090
6095
|
item: "p-1 text-xs gap-1",
|
|
6091
6096
|
itemLeadingIcon: "size-4",
|
|
@@ -6096,7 +6101,6 @@ const select = (options) => {
|
|
|
6096
6101
|
empty: "p-2 text-xs"
|
|
6097
6102
|
},
|
|
6098
6103
|
sm: {
|
|
6099
|
-
base: "px-2.5 py-1.5 text-xs gap-1.5",
|
|
6100
6104
|
label: "p-1.5 text-[10px]/3 gap-1.5",
|
|
6101
6105
|
item: "p-1.5 text-xs gap-1.5",
|
|
6102
6106
|
itemLeadingIcon: "size-4",
|
|
@@ -6107,7 +6111,6 @@ const select = (options) => {
|
|
|
6107
6111
|
empty: "p-2.5 text-xs"
|
|
6108
6112
|
},
|
|
6109
6113
|
md: {
|
|
6110
|
-
base: "px-2.5 py-1.5 text-sm gap-1.5",
|
|
6111
6114
|
label: "p-1.5 text-xs gap-1.5",
|
|
6112
6115
|
item: "p-1.5 text-sm gap-1.5",
|
|
6113
6116
|
itemLeadingIcon: "size-5",
|
|
@@ -6118,7 +6121,6 @@ const select = (options) => {
|
|
|
6118
6121
|
empty: "p-2.5 text-sm"
|
|
6119
6122
|
},
|
|
6120
6123
|
lg: {
|
|
6121
|
-
base: "px-3 py-2 text-sm gap-2",
|
|
6122
6124
|
label: "p-2 text-xs gap-2",
|
|
6123
6125
|
item: "p-2 text-sm gap-2",
|
|
6124
6126
|
itemLeadingIcon: "size-5",
|
|
@@ -6129,7 +6131,6 @@ const select = (options) => {
|
|
|
6129
6131
|
empty: "p-3 text-sm"
|
|
6130
6132
|
},
|
|
6131
6133
|
xl: {
|
|
6132
|
-
base: "px-3 py-2 text-base gap-2",
|
|
6133
6134
|
label: "p-2 text-sm gap-2",
|
|
6134
6135
|
item: "p-2 text-base gap-2",
|
|
6135
6136
|
itemLeadingIcon: "size-6",
|
package/dist/unplugin.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import { join, normalize, relative } from 'pathe';
|
|
|
3
3
|
import { createUnplugin } from 'unplugin';
|
|
4
4
|
import { defu } from 'defu';
|
|
5
5
|
import tailwind from '@tailwindcss/vite';
|
|
6
|
-
import { e as getTemplates, h as resolveExtraScanDirs, b as detectUsedComponents, f as publicComposables, g as getClientBundleIcons, p as parseIconName, d as defaultOptions, r as resolveColors, c as getDefaultConfig } from './shared/ui.
|
|
6
|
+
import { e as getTemplates, h as resolveExtraScanDirs, b as detectUsedComponents, f as publicComposables, g as getClientBundleIcons, p as parseIconName, d as defaultOptions, r as resolveColors, c as getDefaultConfig } from './shared/ui.DCJ9twx8.mjs';
|
|
7
7
|
import fs from 'node:fs';
|
|
8
8
|
import path from 'node:path';
|
|
9
9
|
import { consola } from 'consola';
|
package/dist/vite.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuxt/ui",
|
|
3
3
|
"description": "A UI Library for Modern Web Apps, powered by Vue & Tailwind CSS.",
|
|
4
|
-
"version": "4.11.
|
|
5
|
-
"packageManager": "pnpm@11.
|
|
4
|
+
"version": "4.11.1",
|
|
5
|
+
"packageManager": "pnpm@11.25.0",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
8
|
"url": "git+https://github.com/nuxt/ui.git"
|
|
@@ -133,10 +133,10 @@
|
|
|
133
133
|
"dependencies": {
|
|
134
134
|
"@floating-ui/dom": "^1.8.0",
|
|
135
135
|
"@iconify/vue": "^5.0.1",
|
|
136
|
-
"@internationalized/date": "^3.12.
|
|
137
|
-
"@internationalized/number": "^3.6.
|
|
136
|
+
"@internationalized/date": "^3.12.4",
|
|
137
|
+
"@internationalized/number": "^3.6.8",
|
|
138
138
|
"@nuxt/fonts": "^0.14.0",
|
|
139
|
-
"@nuxt/icon": "^2.5.
|
|
139
|
+
"@nuxt/icon": "^2.5.1",
|
|
140
140
|
"@nuxt/kit": "^4.5.2",
|
|
141
141
|
"@nuxt/schema": "^4.5.2",
|
|
142
142
|
"@nuxtjs/color-mode": "^4.0.1",
|
|
@@ -144,25 +144,25 @@
|
|
|
144
144
|
"@tailwindcss/postcss": "^4.3.3",
|
|
145
145
|
"@tailwindcss/vite": "^4.3.3",
|
|
146
146
|
"@tanstack/vue-table": "^8.21.3",
|
|
147
|
-
"@tanstack/vue-virtual": "^3.13.
|
|
148
|
-
"@tiptap/core": "^3.
|
|
149
|
-
"@tiptap/extension-bubble-menu": "^3.
|
|
150
|
-
"@tiptap/extension-code": "^3.
|
|
151
|
-
"@tiptap/extension-collaboration": "^3.
|
|
152
|
-
"@tiptap/extension-drag-handle": "^3.
|
|
153
|
-
"@tiptap/extension-drag-handle-vue-3": "^3.
|
|
154
|
-
"@tiptap/extension-floating-menu": "^3.
|
|
155
|
-
"@tiptap/extension-horizontal-rule": "^3.
|
|
156
|
-
"@tiptap/extension-image": "^3.
|
|
157
|
-
"@tiptap/extension-mention": "^3.
|
|
158
|
-
"@tiptap/extension-node-range": "^3.
|
|
159
|
-
"@tiptap/extension-placeholder": "^3.
|
|
160
|
-
"@tiptap/markdown": "^3.
|
|
161
|
-
"@tiptap/pm": "^3.
|
|
162
|
-
"@tiptap/starter-kit": "^3.
|
|
163
|
-
"@tiptap/suggestion": "^3.
|
|
164
|
-
"@tiptap/vue-3": "^3.
|
|
165
|
-
"@unhead/vue": "^3.
|
|
147
|
+
"@tanstack/vue-virtual": "^3.13.36",
|
|
148
|
+
"@tiptap/core": "^3.31.3",
|
|
149
|
+
"@tiptap/extension-bubble-menu": "^3.31.3",
|
|
150
|
+
"@tiptap/extension-code": "^3.31.3",
|
|
151
|
+
"@tiptap/extension-collaboration": "^3.31.3",
|
|
152
|
+
"@tiptap/extension-drag-handle": "^3.31.3",
|
|
153
|
+
"@tiptap/extension-drag-handle-vue-3": "^3.31.3",
|
|
154
|
+
"@tiptap/extension-floating-menu": "^3.31.3",
|
|
155
|
+
"@tiptap/extension-horizontal-rule": "^3.31.3",
|
|
156
|
+
"@tiptap/extension-image": "^3.31.3",
|
|
157
|
+
"@tiptap/extension-mention": "^3.31.3",
|
|
158
|
+
"@tiptap/extension-node-range": "^3.31.3",
|
|
159
|
+
"@tiptap/extension-placeholder": "^3.31.3",
|
|
160
|
+
"@tiptap/markdown": "^3.31.3",
|
|
161
|
+
"@tiptap/pm": "^3.31.3",
|
|
162
|
+
"@tiptap/starter-kit": "^3.31.3",
|
|
163
|
+
"@tiptap/suggestion": "^3.31.3",
|
|
164
|
+
"@tiptap/vue-3": "^3.31.3",
|
|
165
|
+
"@unhead/vue": "^3.4.0",
|
|
166
166
|
"@vueuse/core": "^14.4.0",
|
|
167
167
|
"@vueuse/integrations": "^14.4.0",
|
|
168
168
|
"@vueuse/shared": "^14.4.0",
|
|
@@ -179,12 +179,12 @@
|
|
|
179
179
|
"fuse.js": "^7.5.0",
|
|
180
180
|
"hookable": "^6.1.1",
|
|
181
181
|
"knitwork": "^1.3.0",
|
|
182
|
-
"magic-string": "^1.2.
|
|
182
|
+
"magic-string": "^1.2.3",
|
|
183
183
|
"mlly": "^1.8.2",
|
|
184
|
-
"motion-v": "^2.4.
|
|
184
|
+
"motion-v": "^2.4.2",
|
|
185
185
|
"ohash": "^2.0.12",
|
|
186
186
|
"pathe": "^2.0.3",
|
|
187
|
-
"reka-ui": "2.10.
|
|
187
|
+
"reka-ui": "2.10.4",
|
|
188
188
|
"scule": "^1.3.0",
|
|
189
189
|
"tailwind-merge": "^3.6.0",
|
|
190
190
|
"tailwind-variants": "^3.2.2",
|
|
@@ -195,29 +195,29 @@
|
|
|
195
195
|
"unplugin-auto-import": "^21.1.0",
|
|
196
196
|
"unplugin-vue-components": "^32.1.0",
|
|
197
197
|
"vaul-vue": "0.4.1",
|
|
198
|
-
"vue-component-type-helpers": "^3.3.
|
|
198
|
+
"vue-component-type-helpers": "^3.3.11"
|
|
199
199
|
},
|
|
200
200
|
"devDependencies": {
|
|
201
201
|
"@codspeed/vitest-plugin": "^5.7.1",
|
|
202
202
|
"@nuxt/eslint-config": "^1.17.0",
|
|
203
203
|
"@nuxt/module-builder": "^1.0.3",
|
|
204
|
-
"@nuxt/test-utils": "^4.
|
|
204
|
+
"@nuxt/test-utils": "^4.2.0",
|
|
205
205
|
"@release-it/conventional-changelog": "^12.0.0",
|
|
206
206
|
"@tanstack/table-core": "^8.21.3",
|
|
207
207
|
"@vitejs/plugin-vue": "^6.0.8",
|
|
208
|
-
"@vue/test-utils": "^2.
|
|
209
|
-
"ai": "^7.0.
|
|
208
|
+
"@vue/test-utils": "^2.5.0",
|
|
209
|
+
"ai": "^7.0.93",
|
|
210
210
|
"embla-carousel": "^8.6.0",
|
|
211
|
-
"eslint": "^10.
|
|
212
|
-
"happy-dom": "^20.
|
|
211
|
+
"eslint": "^10.10.0",
|
|
212
|
+
"happy-dom": "^20.14.0",
|
|
213
213
|
"nuxt": "^4.5.2",
|
|
214
214
|
"release-it": "^21.0.2",
|
|
215
215
|
"unbuild": "^3.6.1",
|
|
216
|
-
"vitest": "^4.1.
|
|
216
|
+
"vitest": "^4.1.11",
|
|
217
217
|
"vitest-axe": "^0.1.0",
|
|
218
218
|
"vitest-environment-nuxt": "^2.0.0",
|
|
219
|
-
"vue": "^3.5.
|
|
220
|
-
"vue-tsc": "^3.3.
|
|
219
|
+
"vue": "^3.5.42",
|
|
220
|
+
"vue-tsc": "^3.3.11"
|
|
221
221
|
},
|
|
222
222
|
"peerDependencies": {
|
|
223
223
|
"@inertiajs/vue3": "^2.0.7 || ^3.0.0",
|