@nuxt/ui 0.4.0 → 2.8.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/LICENSE.md +9 -0
- package/README.md +63 -50
- package/dist/module.cjs +5 -0
- package/dist/module.d.mts +1234 -0
- package/dist/module.d.ts +1234 -0
- package/dist/module.json +8 -0
- package/dist/module.mjs +407 -0
- package/dist/runtime/app.config.d.ts +1203 -0
- package/dist/runtime/app.config.mjs +1057 -0
- package/dist/runtime/components/data/Table.vue +251 -0
- package/dist/runtime/components/data/Table.vue.d.ts +215 -0
- package/dist/runtime/components/elements/Accordion.vue +138 -0
- package/dist/runtime/components/elements/Accordion.vue.d.ts +80 -0
- package/dist/runtime/components/elements/Alert.vue +120 -0
- package/dist/runtime/components/elements/Alert.vue.d.ts +107 -0
- package/dist/runtime/components/elements/Avatar.vue +149 -0
- package/dist/runtime/components/elements/Avatar.vue.d.ts +115 -0
- package/dist/runtime/components/elements/AvatarGroup.d.ts +37 -0
- package/dist/runtime/components/elements/AvatarGroup.mjs +53 -0
- package/dist/runtime/components/elements/Badge.vue +69 -0
- package/dist/runtime/components/elements/Badge.vue.d.ts +63 -0
- package/dist/runtime/components/elements/Button.vue +182 -0
- package/dist/runtime/components/elements/Button.vue.d.ts +187 -0
- package/dist/runtime/components/elements/ButtonGroup.d.ts +39 -0
- package/dist/runtime/components/elements/ButtonGroup.mjs +70 -0
- package/dist/runtime/components/elements/Dropdown.vue +172 -0
- package/dist/runtime/components/elements/Dropdown.vue.d.ts +96 -0
- package/dist/runtime/components/elements/Icon.vue +15 -0
- package/dist/runtime/components/elements/Icon.vue.d.ts +12 -0
- package/dist/runtime/components/elements/Kbd.vue +55 -0
- package/dist/runtime/components/elements/Kbd.vue.d.ts +42 -0
- package/dist/runtime/components/elements/Link.vue +80 -0
- package/dist/runtime/components/elements/Link.vue.d.ts +9 -0
- package/dist/runtime/components/forms/Checkbox.vue +136 -0
- package/dist/runtime/components/forms/Checkbox.vue.d.ts +129 -0
- package/dist/runtime/components/forms/Form.vue +186 -0
- package/dist/runtime/components/forms/Form.vue.d.ts +50 -0
- package/dist/runtime/components/forms/FormGroup.vue +97 -0
- package/dist/runtime/components/forms/FormGroup.vue.d.ts +98 -0
- package/dist/runtime/components/forms/Input.vue +250 -0
- package/dist/runtime/components/forms/Input.vue.d.ts +214 -0
- package/dist/runtime/components/forms/Radio.vue +122 -0
- package/dist/runtime/components/forms/Radio.vue.d.ts +109 -0
- package/dist/runtime/components/forms/Range.vue +163 -0
- package/dist/runtime/components/forms/Range.vue.d.ts +119 -0
- package/dist/runtime/components/forms/Select.vue +307 -0
- package/dist/runtime/components/forms/Select.vue.d.ts +229 -0
- package/dist/runtime/components/forms/SelectMenu.vue +429 -0
- package/dist/runtime/components/forms/SelectMenu.vue.d.ts +330 -0
- package/dist/runtime/components/forms/Textarea.vue +184 -0
- package/dist/runtime/components/forms/Textarea.vue.d.ts +161 -0
- package/dist/runtime/components/forms/Toggle.vue +113 -0
- package/dist/runtime/components/forms/Toggle.vue.d.ts +83 -0
- package/dist/runtime/components/layout/Card.vue +58 -0
- package/dist/runtime/components/layout/Card.vue.d.ts +31 -0
- package/dist/runtime/components/layout/Container.vue +43 -0
- package/dist/runtime/components/layout/Container.vue.d.ts +31 -0
- package/dist/runtime/components/layout/Skeleton.vue +37 -0
- package/dist/runtime/components/layout/Skeleton.vue.d.ts +22 -0
- package/dist/runtime/components/navigation/CommandPalette.vue +304 -0
- package/dist/runtime/components/navigation/CommandPalette.vue.d.ts +224 -0
- package/dist/runtime/components/navigation/CommandPaletteGroup.vue +152 -0
- package/dist/runtime/components/navigation/CommandPaletteGroup.vue.d.ts +63 -0
- package/dist/runtime/components/navigation/Pagination.vue +197 -0
- package/dist/runtime/components/navigation/Pagination.vue.d.ts +125 -0
- package/dist/runtime/components/navigation/Tabs.vue +138 -0
- package/dist/runtime/components/navigation/Tabs.vue.d.ts +69 -0
- package/dist/runtime/components/navigation/VerticalNavigation.vue +79 -0
- package/dist/runtime/components/navigation/VerticalNavigation.vue.d.ts +37 -0
- package/dist/runtime/components/overlays/ContextMenu.vue +74 -0
- package/dist/runtime/components/overlays/ContextMenu.vue.d.ts +54 -0
- package/dist/runtime/components/overlays/Modal.vue +113 -0
- package/dist/runtime/components/overlays/Modal.vue.d.ts +82 -0
- package/dist/runtime/components/overlays/Notification.vue +197 -0
- package/dist/runtime/components/overlays/Notification.vue.d.ts +126 -0
- package/dist/runtime/components/overlays/Notifications.vue +61 -0
- package/dist/runtime/components/overlays/Notifications.vue.d.ts +41 -0
- package/dist/runtime/components/overlays/Popover.vue +139 -0
- package/dist/runtime/components/overlays/Popover.vue.d.ts +82 -0
- package/dist/runtime/components/overlays/Slideover.vue +103 -0
- package/dist/runtime/components/overlays/Slideover.vue.d.ts +84 -0
- package/dist/runtime/components/overlays/Tooltip.vue +118 -0
- package/dist/runtime/components/overlays/Tooltip.vue.d.ts +82 -0
- package/dist/runtime/composables/defineShortcuts.d.ts +13 -0
- package/dist/runtime/composables/defineShortcuts.mjs +108 -0
- package/dist/runtime/composables/useCopyToClipboard.d.ts +10 -0
- package/dist/runtime/composables/useCopyToClipboard.mjs +26 -0
- package/dist/runtime/composables/useFormGroup.d.ts +6 -0
- package/dist/runtime/composables/useFormGroup.mjs +30 -0
- package/dist/runtime/composables/usePopper.d.ts +232 -0
- package/dist/runtime/composables/usePopper.mjs +78 -0
- package/dist/runtime/composables/useShortcuts.d.ts +12 -0
- package/dist/runtime/composables/useShortcuts.mjs +24 -0
- package/dist/runtime/composables/useTimer.d.ts +8 -0
- package/dist/runtime/composables/useTimer.mjs +51 -0
- package/dist/runtime/composables/useToast.d.ts +18 -0
- package/dist/runtime/composables/useToast.mjs +22 -0
- package/dist/runtime/plugins/colors.d.ts +2 -0
- package/dist/runtime/plugins/colors.mjs +46 -0
- package/dist/runtime/types/accordion.d.ts +9 -0
- package/dist/runtime/types/avatar.d.ts +9 -0
- package/dist/runtime/types/button.d.ts +23 -0
- package/dist/runtime/types/clipboard.d.ts +3 -0
- package/dist/runtime/types/command-palette.d.ts +26 -0
- package/dist/runtime/types/dropdown.d.ts +13 -0
- package/dist/runtime/types/form.d.ts +21 -0
- package/dist/runtime/types/index.d.ts +12 -0
- package/dist/runtime/types/link.d.ts +8 -0
- package/dist/runtime/types/notification.d.ts +22 -0
- package/dist/runtime/types/popper.d.ts +14 -0
- package/dist/runtime/types/tabs.d.ts +6 -0
- package/dist/runtime/types/vertical-navigation.d.ts +11 -0
- package/dist/runtime/ui.css +13 -0
- package/dist/runtime/utils/StateEmitter.d.ts +17 -0
- package/dist/runtime/utils/StateEmitter.mjs +21 -0
- package/dist/runtime/utils/index.d.ts +11 -0
- package/dist/runtime/utils/index.mjs +33 -0
- package/dist/types.d.mts +15 -0
- package/dist/types.d.ts +15 -0
- package/package.json +57 -40
- package/LICENSE +0 -21
- package/dist/assets/styles.css +0 -14
- package/dist/components/NButton.vue +0 -19
- package/dist/components/NCard.vue +0 -5
- package/dist/components/NCheckbox.vue +0 -35
- package/dist/components/NDarkToggle.vue +0 -28
- package/dist/components/NDialog.vue +0 -59
- package/dist/components/NDropdown.vue +0 -31
- package/dist/components/NIcon.vue +0 -9
- package/dist/components/NLink.vue +0 -17
- package/dist/components/NRadio.vue +0 -40
- package/dist/components/NSwitch.vue +0 -37
- package/dist/components/NTextInput.vue +0 -34
- package/dist/components/NTip.vue +0 -16
- package/dist/components/NuxtContentLogo.vue +0 -7
- package/dist/components/NuxtExampleLayout.vue +0 -82
- package/dist/components/NuxtLogo.vue +0 -20
- package/dist/components/nuxt/NDarkToggle.vue +0 -28
- package/dist/nuxt.d.ts +0 -16
- package/dist/nuxt.mjs +0 -36
- package/dist/unocss.d.ts +0 -7
- package/dist/unocss.mjs +0 -117
- package/nuxt.cjs +0 -7
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { ref, computed } from "vue-demi";
|
|
2
|
+
import { useTimestamp } from "@vueuse/core";
|
|
3
|
+
export function useTimer(cb, interval, options) {
|
|
4
|
+
let timer = null;
|
|
5
|
+
const { pause: tPause, resume: tResume, timestamp } = useTimestamp({ ...options || {}, controls: true });
|
|
6
|
+
const startTime = ref(null);
|
|
7
|
+
const remaining = computed(() => {
|
|
8
|
+
if (!startTime.value) {
|
|
9
|
+
return 0;
|
|
10
|
+
}
|
|
11
|
+
return interval - (timestamp.value - startTime.value);
|
|
12
|
+
});
|
|
13
|
+
function set(...args) {
|
|
14
|
+
timer = setTimeout(() => {
|
|
15
|
+
timer = null;
|
|
16
|
+
startTime.value = null;
|
|
17
|
+
cb(...args);
|
|
18
|
+
}, remaining.value);
|
|
19
|
+
}
|
|
20
|
+
function clear() {
|
|
21
|
+
if (timer) {
|
|
22
|
+
clearTimeout(timer);
|
|
23
|
+
timer = null;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
function start() {
|
|
27
|
+
startTime.value = Date.now();
|
|
28
|
+
set();
|
|
29
|
+
}
|
|
30
|
+
function stop() {
|
|
31
|
+
clear();
|
|
32
|
+
tPause();
|
|
33
|
+
}
|
|
34
|
+
function pause() {
|
|
35
|
+
clear();
|
|
36
|
+
tPause();
|
|
37
|
+
}
|
|
38
|
+
function resume() {
|
|
39
|
+
set();
|
|
40
|
+
tResume();
|
|
41
|
+
startTime.value = (startTime.value || 0) + (Date.now() - timestamp.value);
|
|
42
|
+
}
|
|
43
|
+
start();
|
|
44
|
+
return {
|
|
45
|
+
start,
|
|
46
|
+
stop,
|
|
47
|
+
pause,
|
|
48
|
+
resume,
|
|
49
|
+
remaining
|
|
50
|
+
};
|
|
51
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Notification } from '../types/notification';
|
|
2
|
+
export declare function useToast(): {
|
|
3
|
+
add: (notification: Partial<Notification>) => {
|
|
4
|
+
id: string;
|
|
5
|
+
title?: string | undefined;
|
|
6
|
+
description?: string | undefined;
|
|
7
|
+
icon?: string | undefined;
|
|
8
|
+
avatar?: import("../types/avatar").Avatar | undefined;
|
|
9
|
+
closeButton?: import("../types/button").Button | undefined;
|
|
10
|
+
timeout?: number | undefined;
|
|
11
|
+
actions?: import("../types/notification").NotificationAction[] | undefined;
|
|
12
|
+
click?: Function | undefined;
|
|
13
|
+
callback?: Function | undefined;
|
|
14
|
+
color?: string | undefined;
|
|
15
|
+
ui?: any;
|
|
16
|
+
};
|
|
17
|
+
remove: (id: string) => void;
|
|
18
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { useState } from "#imports";
|
|
2
|
+
export function useToast() {
|
|
3
|
+
const notifications = useState("notifications", () => []);
|
|
4
|
+
function add(notification) {
|
|
5
|
+
const body = {
|
|
6
|
+
id: (/* @__PURE__ */ new Date()).getTime().toString(),
|
|
7
|
+
...notification
|
|
8
|
+
};
|
|
9
|
+
const index = notifications.value.findIndex((n) => n.id === body.id);
|
|
10
|
+
if (index === -1) {
|
|
11
|
+
notifications.value.push(body);
|
|
12
|
+
}
|
|
13
|
+
return body;
|
|
14
|
+
}
|
|
15
|
+
function remove(id) {
|
|
16
|
+
notifications.value = notifications.value.filter((n) => n.id !== id);
|
|
17
|
+
}
|
|
18
|
+
return {
|
|
19
|
+
add,
|
|
20
|
+
remove
|
|
21
|
+
};
|
|
22
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { computed } from "vue";
|
|
2
|
+
import { hexToRgb } from "../utils/index.mjs";
|
|
3
|
+
import { defineNuxtPlugin, useAppConfig, useNuxtApp, useHead } from "#imports";
|
|
4
|
+
import colors from "#tailwind-config/theme/colors";
|
|
5
|
+
export default defineNuxtPlugin(() => {
|
|
6
|
+
const appConfig = useAppConfig();
|
|
7
|
+
const nuxtApp = useNuxtApp();
|
|
8
|
+
const root = computed(() => {
|
|
9
|
+
const primary = colors[appConfig.ui.primary];
|
|
10
|
+
const gray = colors[appConfig.ui.gray];
|
|
11
|
+
if (!primary) {
|
|
12
|
+
console.warn(`[@nuxt/ui] Primary color '${appConfig.ui.primary}' not found in Tailwind config`);
|
|
13
|
+
}
|
|
14
|
+
if (!gray) {
|
|
15
|
+
console.warn(`[@nuxt/ui] Gray color '${appConfig.ui.gray}' not found in Tailwind config`);
|
|
16
|
+
}
|
|
17
|
+
return `:root {
|
|
18
|
+
${Object.entries(primary || colors.green).map(([key, value]) => `--color-primary-${key}: ${hexToRgb(value)};`).join("\n")}
|
|
19
|
+
--color-primary-DEFAULT: var(--color-primary-500);
|
|
20
|
+
|
|
21
|
+
${Object.entries(gray || colors.cool).map(([key, value]) => `--color-gray-${key}: ${hexToRgb(value)};`).join("\n")}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.dark {
|
|
25
|
+
--color-primary-DEFAULT: var(--color-primary-400);
|
|
26
|
+
}
|
|
27
|
+
`;
|
|
28
|
+
});
|
|
29
|
+
const headData = {
|
|
30
|
+
style: [{
|
|
31
|
+
innerHTML: () => root.value,
|
|
32
|
+
tagPriority: -2,
|
|
33
|
+
id: "nuxt-ui-colors"
|
|
34
|
+
}]
|
|
35
|
+
};
|
|
36
|
+
if (process.client && nuxtApp.isHydrating && !nuxtApp.payload.serverRendered) {
|
|
37
|
+
const style = document.createElement("style");
|
|
38
|
+
style.innerHTML = root.value;
|
|
39
|
+
style.setAttribute("data-nuxt-ui-colors", "");
|
|
40
|
+
document.head.appendChild(style);
|
|
41
|
+
headData.script = [{
|
|
42
|
+
innerHTML: "document.head.removeChild(document.querySelector('[data-nuxt-ui-colors]'))"
|
|
43
|
+
}];
|
|
44
|
+
}
|
|
45
|
+
useHead(headData);
|
|
46
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Link } from './link'
|
|
2
|
+
|
|
3
|
+
export interface Button extends Link {
|
|
4
|
+
type?: string
|
|
5
|
+
block?: boolean
|
|
6
|
+
label?: string
|
|
7
|
+
loading?: boolean
|
|
8
|
+
disabled?: boolean
|
|
9
|
+
padded?: boolean
|
|
10
|
+
size?: string
|
|
11
|
+
color?: string
|
|
12
|
+
variant?: string
|
|
13
|
+
icon?: string
|
|
14
|
+
loadingIcon?: string
|
|
15
|
+
leadingIcon?: string
|
|
16
|
+
trailingIcon?: string
|
|
17
|
+
trailing?: boolean
|
|
18
|
+
leading?: boolean
|
|
19
|
+
to?: string | object
|
|
20
|
+
target?: string
|
|
21
|
+
square?: boolean
|
|
22
|
+
truncate?: boolean
|
|
23
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { FuseSortFunctionMatch, FuseSortFunctionMatchList } from 'fuse.js'
|
|
2
|
+
import type { Avatar } from './avatar'
|
|
3
|
+
|
|
4
|
+
export interface Command {
|
|
5
|
+
id: string | number
|
|
6
|
+
prefix?: string
|
|
7
|
+
suffix?: string
|
|
8
|
+
icon?: string
|
|
9
|
+
iconClass?: string
|
|
10
|
+
avatar?: Avatar
|
|
11
|
+
chip?: string
|
|
12
|
+
disabled?: boolean
|
|
13
|
+
shortcuts?: string[]
|
|
14
|
+
group?: string
|
|
15
|
+
score?: number
|
|
16
|
+
matches?: (FuseSortFunctionMatch | FuseSortFunctionMatchList)[]
|
|
17
|
+
[key: string]: any
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface Group {
|
|
21
|
+
key: string
|
|
22
|
+
active?: string
|
|
23
|
+
inactive?: string
|
|
24
|
+
commands: Command[]
|
|
25
|
+
[key: string]: any
|
|
26
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Link } from './link'
|
|
2
|
+
import type { Avatar } from './avatar'
|
|
3
|
+
|
|
4
|
+
export interface DropdownItem extends Link {
|
|
5
|
+
label: string
|
|
6
|
+
slot?: string
|
|
7
|
+
icon?: string
|
|
8
|
+
iconClass?: string
|
|
9
|
+
avatar?: Avatar
|
|
10
|
+
shortcuts?: string[]
|
|
11
|
+
disabled?: boolean
|
|
12
|
+
click?: Function
|
|
13
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export interface FormError {
|
|
2
|
+
path: string
|
|
3
|
+
message: string
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export interface Form<T> {
|
|
7
|
+
validate(path?: string, opts: { silent?: boolean } = { silent: false }): Promise<T>
|
|
8
|
+
clear(path?: string): void
|
|
9
|
+
errors: Ref<FormError[]>
|
|
10
|
+
setErrors(errs: FormError[], path?: string): void
|
|
11
|
+
getErrors(path?: string): FormError[]
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export type FormSubmitEvent<T> = SubmitEvent & { data: T }
|
|
15
|
+
|
|
16
|
+
export type FormEventType = 'blur' | 'input' | 'change' | 'submit'
|
|
17
|
+
|
|
18
|
+
export interface FormEvent {
|
|
19
|
+
type: FormEventType
|
|
20
|
+
path: string
|
|
21
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export * from './accordion'
|
|
2
|
+
export * from './avatar'
|
|
3
|
+
export * from './button'
|
|
4
|
+
export * from './clipboard'
|
|
5
|
+
export * from './command-palette'
|
|
6
|
+
export * from './dropdown'
|
|
7
|
+
export * from './form'
|
|
8
|
+
export * from './link'
|
|
9
|
+
export * from './notification'
|
|
10
|
+
export * from './popper'
|
|
11
|
+
export * from './tabs'
|
|
12
|
+
export * from './vertical-navigation'
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Avatar } from './avatar'
|
|
2
|
+
import type { Button } from './button'
|
|
3
|
+
import appConfig from '#build/app.config'
|
|
4
|
+
|
|
5
|
+
export interface NotificationAction extends Button {
|
|
6
|
+
click?: Function
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface Notification {
|
|
10
|
+
id: string
|
|
11
|
+
title: string
|
|
12
|
+
description?: string
|
|
13
|
+
icon?: string
|
|
14
|
+
avatar?: Avatar
|
|
15
|
+
closeButton?: Button
|
|
16
|
+
timeout: number
|
|
17
|
+
actions?: NotificationAction[]
|
|
18
|
+
click?: Function
|
|
19
|
+
callback?: Function
|
|
20
|
+
color?: string
|
|
21
|
+
ui?: Partial<typeof appConfig.ui.notification>
|
|
22
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Placement, PositioningStrategy } from '@popperjs/core'
|
|
2
|
+
|
|
3
|
+
export interface PopperOptions {
|
|
4
|
+
locked?: boolean
|
|
5
|
+
overflowPadding?: number
|
|
6
|
+
offsetDistance?: number
|
|
7
|
+
offsetSkid?: number
|
|
8
|
+
placement?: Placement
|
|
9
|
+
strategy?: PositioningStrategy
|
|
10
|
+
gpuAcceleration?: boolean
|
|
11
|
+
adaptive?: boolean
|
|
12
|
+
scroll?: boolean
|
|
13
|
+
resize?: boolean
|
|
14
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
declare const _default: import("vue").DefineComponent<{
|
|
2
|
+
open: {
|
|
3
|
+
type: BooleanConstructor;
|
|
4
|
+
default: boolean;
|
|
5
|
+
};
|
|
6
|
+
}, () => void, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("close" | "open")[], "close" | "open", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
7
|
+
open: {
|
|
8
|
+
type: BooleanConstructor;
|
|
9
|
+
default: boolean;
|
|
10
|
+
};
|
|
11
|
+
}>> & {
|
|
12
|
+
onClose?: ((...args: any[]) => any) | undefined;
|
|
13
|
+
onOpen?: ((...args: any[]) => any) | undefined;
|
|
14
|
+
}, {
|
|
15
|
+
open: boolean;
|
|
16
|
+
}, {}>;
|
|
17
|
+
export default _default;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { watch, defineComponent } from "vue";
|
|
2
|
+
export default defineComponent({
|
|
3
|
+
props: {
|
|
4
|
+
open: {
|
|
5
|
+
type: Boolean,
|
|
6
|
+
default: false
|
|
7
|
+
}
|
|
8
|
+
},
|
|
9
|
+
emits: ["open", "close"],
|
|
10
|
+
setup(props, { emit }) {
|
|
11
|
+
watch(() => props.open, (value) => {
|
|
12
|
+
if (value) {
|
|
13
|
+
emit("open");
|
|
14
|
+
} else {
|
|
15
|
+
emit("close");
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
return () => {
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const defuTwMerge: <Source extends {
|
|
2
|
+
[x: string]: any;
|
|
3
|
+
[x: number]: any;
|
|
4
|
+
[x: symbol]: any;
|
|
5
|
+
}, Defaults extends ({
|
|
6
|
+
[x: string]: any;
|
|
7
|
+
[x: number]: any;
|
|
8
|
+
[x: symbol]: any;
|
|
9
|
+
} | (number | boolean | any[] | Record<never, any> | null | undefined))[]>(source: Source, ...defaults: Defaults) => import("defu").Defu<Source, Defaults>;
|
|
10
|
+
export declare const hexToRgb: (hex: string) => string | null;
|
|
11
|
+
export declare const getSlotsChildren: (slots: any) => any;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { createDefu } from "defu";
|
|
2
|
+
import { twMerge } from "tailwind-merge";
|
|
3
|
+
export const defuTwMerge = createDefu((obj, key, value) => {
|
|
4
|
+
if (typeof obj[key] === "string" && typeof value === "string" && obj[key] && value) {
|
|
5
|
+
obj[key] = twMerge(obj[key], value);
|
|
6
|
+
return true;
|
|
7
|
+
}
|
|
8
|
+
});
|
|
9
|
+
export const hexToRgb = (hex) => {
|
|
10
|
+
const shorthandRegex = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;
|
|
11
|
+
hex = hex.replace(shorthandRegex, function(_, r, g, b) {
|
|
12
|
+
return r + r + g + g + b + b;
|
|
13
|
+
});
|
|
14
|
+
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
|
|
15
|
+
return result ? `${parseInt(result[1], 16)} ${parseInt(result[2], 16)} ${parseInt(result[3], 16)}` : null;
|
|
16
|
+
};
|
|
17
|
+
export const getSlotsChildren = (slots) => {
|
|
18
|
+
let children = slots.default?.();
|
|
19
|
+
if (children.length) {
|
|
20
|
+
children = children.flatMap((c) => {
|
|
21
|
+
if (typeof c.type === "symbol") {
|
|
22
|
+
if (typeof c.children === "string") {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
return c.children;
|
|
26
|
+
} else if (c.type.name === "ContentSlot") {
|
|
27
|
+
return c.ctx.slots.default?.();
|
|
28
|
+
}
|
|
29
|
+
return c;
|
|
30
|
+
}).filter(Boolean);
|
|
31
|
+
}
|
|
32
|
+
return children;
|
|
33
|
+
};
|
package/dist/types.d.mts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
|
|
2
|
+
import { ModuleOptions } from './module'
|
|
3
|
+
|
|
4
|
+
declare module '@nuxt/schema' {
|
|
5
|
+
interface NuxtConfig { ['ui']?: Partial<ModuleOptions> }
|
|
6
|
+
interface NuxtOptions { ['ui']?: ModuleOptions }
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
declare module 'nuxt/schema' {
|
|
10
|
+
interface NuxtConfig { ['ui']?: Partial<ModuleOptions> }
|
|
11
|
+
interface NuxtOptions { ['ui']?: ModuleOptions }
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
export { ModuleOptions, default } from './module'
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
|
|
2
|
+
import { ModuleOptions } from './module'
|
|
3
|
+
|
|
4
|
+
declare module '@nuxt/schema' {
|
|
5
|
+
interface NuxtConfig { ['ui']?: Partial<ModuleOptions> }
|
|
6
|
+
interface NuxtOptions { ['ui']?: ModuleOptions }
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
declare module 'nuxt/schema' {
|
|
10
|
+
interface NuxtConfig { ['ui']?: Partial<ModuleOptions> }
|
|
11
|
+
interface NuxtOptions { ['ui']?: ModuleOptions }
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
export { ModuleOptions, default } from './module'
|
package/package.json
CHANGED
|
@@ -1,56 +1,73 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuxt/ui",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.8.0",
|
|
4
|
+
"repository": "https://github.com/nuxt/ui",
|
|
4
5
|
"license": "MIT",
|
|
5
|
-
"type": "module",
|
|
6
6
|
"exports": {
|
|
7
7
|
".": {
|
|
8
|
-
"import": "./dist/
|
|
9
|
-
"require": "./
|
|
10
|
-
},
|
|
11
|
-
"./nuxt": {
|
|
12
|
-
"import": "./dist/nuxt.mjs",
|
|
13
|
-
"require": "./nuxt.cjs"
|
|
14
|
-
},
|
|
15
|
-
"./unocss": {
|
|
16
|
-
"import": "./dist/unocss.mjs"
|
|
8
|
+
"import": "./dist/module.mjs",
|
|
9
|
+
"require": "./dist/module.cjs"
|
|
17
10
|
}
|
|
18
11
|
},
|
|
19
|
-
"main": "./dist/
|
|
12
|
+
"main": "./dist/module.cjs",
|
|
13
|
+
"types": "./dist/types.d.ts",
|
|
20
14
|
"files": [
|
|
21
|
-
"dist"
|
|
22
|
-
"*.cjs"
|
|
15
|
+
"dist"
|
|
23
16
|
],
|
|
17
|
+
"engines": {
|
|
18
|
+
"node": ">=v16.20.2"
|
|
19
|
+
},
|
|
24
20
|
"scripts": {
|
|
25
|
-
"build": "
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
21
|
+
"build": "nuxt-module-build",
|
|
22
|
+
"prepack": "pnpm build",
|
|
23
|
+
"dev": "nuxi dev docs",
|
|
24
|
+
"play": "nuxi dev playground",
|
|
25
|
+
"build:docs": "nuxi generate docs",
|
|
26
|
+
"lint": "eslint .",
|
|
27
|
+
"lint:fix": "eslint . --fix",
|
|
28
|
+
"typecheck": "nuxi typecheck",
|
|
29
|
+
"prepare": "nuxi prepare docs",
|
|
30
|
+
"release": "release-it"
|
|
30
31
|
},
|
|
31
32
|
"dependencies": {
|
|
32
|
-
"@
|
|
33
|
-
"@
|
|
34
|
-
"@
|
|
35
|
-
"@
|
|
36
|
-
"@
|
|
37
|
-
"@
|
|
38
|
-
"@
|
|
39
|
-
"@
|
|
40
|
-
"@
|
|
41
|
-
"@
|
|
42
|
-
"@
|
|
43
|
-
"@vueuse/
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
33
|
+
"@egoist/tailwindcss-icons": "^1.1.0",
|
|
34
|
+
"@headlessui/vue": "^1.7.16",
|
|
35
|
+
"@iconify-json/heroicons": "^1.1.12",
|
|
36
|
+
"@nuxt/kit": "^3.7.1",
|
|
37
|
+
"@nuxtjs/color-mode": "^3.3.0",
|
|
38
|
+
"@nuxtjs/tailwindcss": "^6.8.0",
|
|
39
|
+
"@popperjs/core": "^2.11.8",
|
|
40
|
+
"@tailwindcss/aspect-ratio": "^0.4.2",
|
|
41
|
+
"@tailwindcss/container-queries": "^0.1.1",
|
|
42
|
+
"@tailwindcss/forms": "^0.5.6",
|
|
43
|
+
"@tailwindcss/typography": "^0.5.10",
|
|
44
|
+
"@vueuse/core": "^10.4.1",
|
|
45
|
+
"@vueuse/integrations": "^10.4.1",
|
|
46
|
+
"@vueuse/math": "^10.4.1",
|
|
47
|
+
"defu": "^6.1.2",
|
|
48
|
+
"fuse.js": "^6.6.2",
|
|
49
|
+
"lodash-es": "^4.17.21",
|
|
50
|
+
"tailwind-merge": "^1.14.0",
|
|
51
|
+
"tailwindcss": "^3.3.3"
|
|
47
52
|
},
|
|
48
53
|
"devDependencies": {
|
|
49
|
-
"nuxt": "^
|
|
50
|
-
"
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
"
|
|
54
|
+
"@nuxt/eslint-config": "^0.2.0",
|
|
55
|
+
"@nuxt/module-builder": "^0.5.1",
|
|
56
|
+
"@release-it/conventional-changelog": "^7.0.1",
|
|
57
|
+
"eslint": "^8.48.0",
|
|
58
|
+
"joi": "^17.10.1",
|
|
59
|
+
"nuxt": "^3.7.1",
|
|
60
|
+
"release-it": "^16.1.5",
|
|
61
|
+
"typescript": "^5.2.2",
|
|
62
|
+
"unbuild": "^2.0.0",
|
|
63
|
+
"vue-tsc": "^1.8.10",
|
|
64
|
+
"yup": "^1.2.0",
|
|
65
|
+
"zod": "^3.22.2",
|
|
66
|
+
"valibot": "^0.13.1"
|
|
54
67
|
},
|
|
55
|
-
"
|
|
68
|
+
"pnpm": {
|
|
69
|
+
"patchedDependencies": {
|
|
70
|
+
"nuxt-component-meta@0.5.3": "patches/nuxt-component-meta@0.5.3.patch"
|
|
71
|
+
}
|
|
72
|
+
}
|
|
56
73
|
}
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2021 Nuxt Project
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
package/dist/assets/styles.css
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<Component
|
|
3
|
-
:is="to ? 'a' : 'button'"
|
|
4
|
-
:href="to"
|
|
5
|
-
class="n-button n-transition n-button-base hover:n-button-hover active:n-button-active focus-visible:n-focus-base n-disabled:n-disabled"
|
|
6
|
-
>
|
|
7
|
-
<slot name="icon">
|
|
8
|
-
<NIcon v-if="icon" :icon="icon" class="n-button-icon" />
|
|
9
|
-
</slot>
|
|
10
|
-
<slot />
|
|
11
|
-
</Component>
|
|
12
|
-
</template>
|
|
13
|
-
|
|
14
|
-
<script setup lang="ts">
|
|
15
|
-
defineProps<{
|
|
16
|
-
to?: string
|
|
17
|
-
icon?: string
|
|
18
|
-
}>()
|
|
19
|
-
</script>
|