@nuxt/ui 0.4.1 → 2.8.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/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 +185 -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 +56 -39
- package/LICENSE +0 -21
- package/dist/assets/styles.css +0 -14
- package/dist/components/NButton.vue +0 -22
- 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 -20
- 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 -127
- package/nuxt.cjs +0 -7
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/// <reference types="lodash" />
|
|
2
|
+
import type { PropType } from 'vue';
|
|
3
|
+
import type { PopperOptions } from '../../types/popper';
|
|
4
|
+
declare const _default: import("vue").DefineComponent<{
|
|
5
|
+
text: {
|
|
6
|
+
type: StringConstructor;
|
|
7
|
+
default: null;
|
|
8
|
+
};
|
|
9
|
+
prevent: {
|
|
10
|
+
type: BooleanConstructor;
|
|
11
|
+
default: boolean;
|
|
12
|
+
};
|
|
13
|
+
shortcuts: {
|
|
14
|
+
type: PropType<string[]>;
|
|
15
|
+
default: () => never[];
|
|
16
|
+
};
|
|
17
|
+
openDelay: {
|
|
18
|
+
type: NumberConstructor;
|
|
19
|
+
default: number;
|
|
20
|
+
};
|
|
21
|
+
closeDelay: {
|
|
22
|
+
type: NumberConstructor;
|
|
23
|
+
default: number;
|
|
24
|
+
};
|
|
25
|
+
popper: {
|
|
26
|
+
type: PropType<PopperOptions>;
|
|
27
|
+
default: () => {};
|
|
28
|
+
};
|
|
29
|
+
ui: {
|
|
30
|
+
type: PropType<any>;
|
|
31
|
+
default: () => {};
|
|
32
|
+
};
|
|
33
|
+
}, {
|
|
34
|
+
attrs: import("lodash").Omit<{
|
|
35
|
+
[x: string]: unknown;
|
|
36
|
+
}, "class">;
|
|
37
|
+
ui: import("vue").ComputedRef<any>;
|
|
38
|
+
trigger: import("vue").Ref<import("@vueuse/core").MaybeElement>;
|
|
39
|
+
container: import("vue").Ref<import("@vueuse/core").MaybeElement>;
|
|
40
|
+
open: import("vue").Ref<boolean>;
|
|
41
|
+
wrapperClass: import("vue").ComputedRef<string>;
|
|
42
|
+
onMouseOver: () => void;
|
|
43
|
+
onMouseLeave: () => void;
|
|
44
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
45
|
+
text: {
|
|
46
|
+
type: StringConstructor;
|
|
47
|
+
default: null;
|
|
48
|
+
};
|
|
49
|
+
prevent: {
|
|
50
|
+
type: BooleanConstructor;
|
|
51
|
+
default: boolean;
|
|
52
|
+
};
|
|
53
|
+
shortcuts: {
|
|
54
|
+
type: PropType<string[]>;
|
|
55
|
+
default: () => never[];
|
|
56
|
+
};
|
|
57
|
+
openDelay: {
|
|
58
|
+
type: NumberConstructor;
|
|
59
|
+
default: number;
|
|
60
|
+
};
|
|
61
|
+
closeDelay: {
|
|
62
|
+
type: NumberConstructor;
|
|
63
|
+
default: number;
|
|
64
|
+
};
|
|
65
|
+
popper: {
|
|
66
|
+
type: PropType<PopperOptions>;
|
|
67
|
+
default: () => {};
|
|
68
|
+
};
|
|
69
|
+
ui: {
|
|
70
|
+
type: PropType<any>;
|
|
71
|
+
default: () => {};
|
|
72
|
+
};
|
|
73
|
+
}>>, {
|
|
74
|
+
ui: any;
|
|
75
|
+
popper: PopperOptions;
|
|
76
|
+
text: string;
|
|
77
|
+
openDelay: number;
|
|
78
|
+
closeDelay: number;
|
|
79
|
+
prevent: boolean;
|
|
80
|
+
shortcuts: string[];
|
|
81
|
+
}, {}>;
|
|
82
|
+
export default _default;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { WatchSource } from 'vue';
|
|
2
|
+
export interface ShortcutConfig {
|
|
3
|
+
handler: Function;
|
|
4
|
+
usingInput?: string | boolean;
|
|
5
|
+
whenever?: WatchSource<Boolean>[];
|
|
6
|
+
}
|
|
7
|
+
export interface ShortcutsConfig {
|
|
8
|
+
[key: string]: ShortcutConfig | Function;
|
|
9
|
+
}
|
|
10
|
+
export interface ShortcutsOptions {
|
|
11
|
+
chainDelay?: number;
|
|
12
|
+
}
|
|
13
|
+
export declare const defineShortcuts: (config: ShortcutsConfig, options?: ShortcutsOptions) => void;
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { ref, computed } from "vue";
|
|
2
|
+
import { logicAnd, logicNot } from "@vueuse/math";
|
|
3
|
+
import { useEventListener, useDebounceFn } from "@vueuse/core";
|
|
4
|
+
import { useShortcuts } from "./useShortcuts.mjs";
|
|
5
|
+
export const defineShortcuts = (config, options = {}) => {
|
|
6
|
+
const { macOS, usingInput } = useShortcuts();
|
|
7
|
+
let shortcuts = [];
|
|
8
|
+
const chainedInputs = ref([]);
|
|
9
|
+
const clearChainedInput = () => {
|
|
10
|
+
chainedInputs.value.splice(0, chainedInputs.value.length);
|
|
11
|
+
};
|
|
12
|
+
const debouncedClearChainedInput = useDebounceFn(clearChainedInput, options.chainDelay ?? 800);
|
|
13
|
+
const onKeyDown = (e) => {
|
|
14
|
+
if (!e.key) {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
const alphabeticalKey = /^[a-z]{1}$/i.test(e.key);
|
|
18
|
+
let chainedKey;
|
|
19
|
+
chainedInputs.value.push(e.key);
|
|
20
|
+
if (chainedInputs.value.length >= 2) {
|
|
21
|
+
chainedKey = chainedInputs.value.slice(-2).join("-");
|
|
22
|
+
for (const shortcut of shortcuts.filter((s) => s.chained)) {
|
|
23
|
+
if (shortcut.key !== chainedKey) {
|
|
24
|
+
continue;
|
|
25
|
+
}
|
|
26
|
+
if (shortcut.condition.value) {
|
|
27
|
+
e.preventDefault();
|
|
28
|
+
shortcut.handler();
|
|
29
|
+
}
|
|
30
|
+
clearChainedInput();
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
for (const shortcut of shortcuts.filter((s) => !s.chained)) {
|
|
35
|
+
if (e.key.toLowerCase() !== shortcut.key) {
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
if (e.metaKey !== shortcut.metaKey) {
|
|
39
|
+
continue;
|
|
40
|
+
}
|
|
41
|
+
if (e.ctrlKey !== shortcut.ctrlKey) {
|
|
42
|
+
continue;
|
|
43
|
+
}
|
|
44
|
+
if (alphabeticalKey && e.shiftKey !== shortcut.shiftKey) {
|
|
45
|
+
continue;
|
|
46
|
+
}
|
|
47
|
+
if (shortcut.condition.value) {
|
|
48
|
+
e.preventDefault();
|
|
49
|
+
shortcut.handler();
|
|
50
|
+
}
|
|
51
|
+
clearChainedInput();
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
debouncedClearChainedInput();
|
|
55
|
+
};
|
|
56
|
+
shortcuts = Object.entries(config).map(([key, shortcutConfig]) => {
|
|
57
|
+
if (!shortcutConfig) {
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
let shortcut;
|
|
61
|
+
if (key.includes("-") && key.includes("_")) {
|
|
62
|
+
console.trace("[Shortcut] Invalid key");
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
const chained = key.includes("-");
|
|
66
|
+
if (chained) {
|
|
67
|
+
shortcut = {
|
|
68
|
+
key: key.toLowerCase(),
|
|
69
|
+
metaKey: false,
|
|
70
|
+
ctrlKey: false,
|
|
71
|
+
shiftKey: false,
|
|
72
|
+
altKey: false
|
|
73
|
+
};
|
|
74
|
+
} else {
|
|
75
|
+
const keySplit = key.toLowerCase().split("_").map((k) => k);
|
|
76
|
+
shortcut = {
|
|
77
|
+
key: keySplit.filter((k) => !["meta", "ctrl", "shift", "alt"].includes(k)).join("_"),
|
|
78
|
+
metaKey: keySplit.includes("meta"),
|
|
79
|
+
ctrlKey: keySplit.includes("ctrl"),
|
|
80
|
+
shiftKey: keySplit.includes("shift"),
|
|
81
|
+
altKey: keySplit.includes("alt")
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
shortcut.chained = chained;
|
|
85
|
+
if (!macOS.value && shortcut.metaKey && !shortcut.ctrlKey) {
|
|
86
|
+
shortcut.metaKey = false;
|
|
87
|
+
shortcut.ctrlKey = true;
|
|
88
|
+
}
|
|
89
|
+
if (typeof shortcutConfig === "function") {
|
|
90
|
+
shortcut.handler = shortcutConfig;
|
|
91
|
+
} else if (typeof shortcutConfig === "object") {
|
|
92
|
+
shortcut = { ...shortcut, handler: shortcutConfig.handler };
|
|
93
|
+
}
|
|
94
|
+
if (!shortcut.handler) {
|
|
95
|
+
console.trace("[Shortcut] Invalid value");
|
|
96
|
+
return null;
|
|
97
|
+
}
|
|
98
|
+
const conditions = [];
|
|
99
|
+
if (!shortcutConfig.usingInput) {
|
|
100
|
+
conditions.push(logicNot(usingInput));
|
|
101
|
+
} else if (typeof shortcutConfig.usingInput === "string") {
|
|
102
|
+
conditions.push(computed(() => usingInput.value === shortcutConfig.usingInput));
|
|
103
|
+
}
|
|
104
|
+
shortcut.condition = logicAnd(...conditions, ...shortcutConfig.whenever || []);
|
|
105
|
+
return shortcut;
|
|
106
|
+
}).filter(Boolean);
|
|
107
|
+
useEventListener("keydown", onKeyDown);
|
|
108
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Notification } from '../types/notification';
|
|
2
|
+
export declare function useCopyToClipboard(options?: Partial<Notification>): {
|
|
3
|
+
copy: (text: string, success?: {
|
|
4
|
+
title?: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
}, failure?: {
|
|
7
|
+
title?: string;
|
|
8
|
+
description?: string;
|
|
9
|
+
}) => void;
|
|
10
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { useClipboard } from "@vueuse/core";
|
|
2
|
+
import { useToast } from "./useToast.mjs";
|
|
3
|
+
export function useCopyToClipboard(options = {}) {
|
|
4
|
+
const { copy: copyToClipboard, isSupported } = useClipboard();
|
|
5
|
+
const toast = useToast();
|
|
6
|
+
function copy(text, success = {}, failure = {}) {
|
|
7
|
+
if (!isSupported) {
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
copyToClipboard(text).then(() => {
|
|
11
|
+
if (!success.title && !success.description) {
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
toast.add({ ...success, ...options });
|
|
15
|
+
}, function(e) {
|
|
16
|
+
toast.add({
|
|
17
|
+
...failure,
|
|
18
|
+
description: failure.description || e.message,
|
|
19
|
+
...options
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
return {
|
|
24
|
+
copy
|
|
25
|
+
};
|
|
26
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { inject, ref } from "vue";
|
|
2
|
+
import { useDebounceFn } from "@vueuse/core";
|
|
3
|
+
export const useFormGroup = () => {
|
|
4
|
+
const formBus = inject("form-events", void 0);
|
|
5
|
+
const formGroup = inject("form-group", void 0);
|
|
6
|
+
const blurred = ref(false);
|
|
7
|
+
function emitFormEvent(type, path) {
|
|
8
|
+
if (formBus) {
|
|
9
|
+
formBus.emit({ type, path });
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
function emitFormBlur() {
|
|
13
|
+
emitFormEvent("blur", formGroup?.name.value);
|
|
14
|
+
blurred.value = true;
|
|
15
|
+
}
|
|
16
|
+
function emitFormChange() {
|
|
17
|
+
emitFormEvent("change", formGroup?.name.value);
|
|
18
|
+
}
|
|
19
|
+
const emitFormInput = useDebounceFn(() => {
|
|
20
|
+
if (blurred.value) {
|
|
21
|
+
emitFormEvent("input", formGroup?.name.value);
|
|
22
|
+
}
|
|
23
|
+
}, 300);
|
|
24
|
+
return {
|
|
25
|
+
emitFormBlur,
|
|
26
|
+
emitFormInput,
|
|
27
|
+
emitFormChange,
|
|
28
|
+
formGroup
|
|
29
|
+
};
|
|
30
|
+
};
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
import type { Ref } from 'vue';
|
|
2
|
+
import { VirtualElement } from '@popperjs/core/lib/popper-lite';
|
|
3
|
+
import type { Instance } from '@popperjs/core';
|
|
4
|
+
import { MaybeElement } from '@vueuse/core';
|
|
5
|
+
import type { PopperOptions } from '../types/popper';
|
|
6
|
+
export declare const createPopper: <TModifier extends Partial<import("@popperjs/core").Modifier<any, any>>>(reference: Element | VirtualElement, popper: HTMLElement, options?: Partial<import("@popperjs/core").OptionsGeneric<TModifier>> | undefined) => Instance;
|
|
7
|
+
export declare function usePopper({ locked, overflowPadding, offsetDistance, offsetSkid, gpuAcceleration, adaptive, scroll, resize, placement, strategy }: PopperOptions, virtualReference?: Ref<Element | VirtualElement>): readonly [Ref<MaybeElement>, Ref<MaybeElement>, Ref<{
|
|
8
|
+
state: {
|
|
9
|
+
elements: {
|
|
10
|
+
reference: Element | {
|
|
11
|
+
getBoundingClientRect: () => ClientRect | DOMRect;
|
|
12
|
+
contextElement?: Element | undefined;
|
|
13
|
+
};
|
|
14
|
+
popper: HTMLElement;
|
|
15
|
+
arrow?: HTMLElement | undefined;
|
|
16
|
+
};
|
|
17
|
+
options: {
|
|
18
|
+
placement: import("@popperjs/core").Placement;
|
|
19
|
+
modifiers: any[];
|
|
20
|
+
strategy: import("@popperjs/core").PositioningStrategy;
|
|
21
|
+
onFirstUpdate?: ((arg0: Partial<import("@popperjs/core").State>) => void) | undefined;
|
|
22
|
+
};
|
|
23
|
+
placement: import("@popperjs/core").Placement;
|
|
24
|
+
strategy: import("@popperjs/core").PositioningStrategy;
|
|
25
|
+
orderedModifiers: {
|
|
26
|
+
name: any;
|
|
27
|
+
enabled: boolean;
|
|
28
|
+
phase: import("@popperjs/core").ModifierPhases;
|
|
29
|
+
requires?: string[] | undefined;
|
|
30
|
+
requiresIfExists?: string[] | undefined;
|
|
31
|
+
fn: (arg0: import("@popperjs/core").ModifierArguments<any>) => void | import("@popperjs/core").State;
|
|
32
|
+
effect?: ((arg0: import("@popperjs/core").ModifierArguments<any>) => void | (() => void)) | undefined;
|
|
33
|
+
options?: Partial<any> | undefined;
|
|
34
|
+
data?: import("@popperjs/core").Obj | undefined;
|
|
35
|
+
}[];
|
|
36
|
+
rects: {
|
|
37
|
+
reference: {
|
|
38
|
+
width: number;
|
|
39
|
+
height: number;
|
|
40
|
+
x: number;
|
|
41
|
+
y: number;
|
|
42
|
+
};
|
|
43
|
+
popper: {
|
|
44
|
+
width: number;
|
|
45
|
+
height: number;
|
|
46
|
+
x: number;
|
|
47
|
+
y: number;
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
scrollParents: {
|
|
51
|
+
reference: (Element | {
|
|
52
|
+
innerHeight: number;
|
|
53
|
+
offsetHeight: number;
|
|
54
|
+
innerWidth: number;
|
|
55
|
+
offsetWidth: number;
|
|
56
|
+
pageXOffset: number;
|
|
57
|
+
pageYOffset: number;
|
|
58
|
+
getComputedStyle: typeof getComputedStyle;
|
|
59
|
+
addEventListener: (type: any, listener: any, optionsOrUseCapture?: any) => void;
|
|
60
|
+
removeEventListener: (type: any, listener: any, optionsOrUseCapture?: any) => void;
|
|
61
|
+
Element: Element;
|
|
62
|
+
HTMLElement: HTMLElement;
|
|
63
|
+
Node: Node;
|
|
64
|
+
toString: () => "[object Window]";
|
|
65
|
+
devicePixelRatio: number;
|
|
66
|
+
visualViewport?: {
|
|
67
|
+
addEventListener: (type: string, callback: EventListenerOrEventListenerObject | null, options?: boolean | AddEventListenerOptions | undefined) => void;
|
|
68
|
+
dispatchEvent: (event: Event) => boolean;
|
|
69
|
+
removeEventListener: (type: string, callback: EventListenerOrEventListenerObject | null, options?: boolean | EventListenerOptions | undefined) => void;
|
|
70
|
+
width: number;
|
|
71
|
+
height: number;
|
|
72
|
+
offsetLeft: number;
|
|
73
|
+
offsetTop: number;
|
|
74
|
+
scale: number;
|
|
75
|
+
} | undefined;
|
|
76
|
+
ShadowRoot: ShadowRoot;
|
|
77
|
+
} | {
|
|
78
|
+
addEventListener: (type: string, callback: EventListenerOrEventListenerObject | null, options?: boolean | AddEventListenerOptions | undefined) => void;
|
|
79
|
+
dispatchEvent: (event: Event) => boolean;
|
|
80
|
+
removeEventListener: (type: string, callback: EventListenerOrEventListenerObject | null, options?: boolean | EventListenerOptions | undefined) => void;
|
|
81
|
+
width: number;
|
|
82
|
+
height: number;
|
|
83
|
+
offsetLeft: number;
|
|
84
|
+
offsetTop: number;
|
|
85
|
+
scale: number;
|
|
86
|
+
})[];
|
|
87
|
+
popper: (Element | {
|
|
88
|
+
innerHeight: number;
|
|
89
|
+
offsetHeight: number;
|
|
90
|
+
innerWidth: number;
|
|
91
|
+
offsetWidth: number;
|
|
92
|
+
pageXOffset: number;
|
|
93
|
+
pageYOffset: number;
|
|
94
|
+
getComputedStyle: typeof getComputedStyle;
|
|
95
|
+
addEventListener: (type: any, listener: any, optionsOrUseCapture?: any) => void;
|
|
96
|
+
removeEventListener: (type: any, listener: any, optionsOrUseCapture?: any) => void;
|
|
97
|
+
Element: Element;
|
|
98
|
+
HTMLElement: HTMLElement;
|
|
99
|
+
Node: Node;
|
|
100
|
+
toString: () => "[object Window]";
|
|
101
|
+
devicePixelRatio: number;
|
|
102
|
+
visualViewport?: {
|
|
103
|
+
addEventListener: (type: string, callback: EventListenerOrEventListenerObject | null, options?: boolean | AddEventListenerOptions | undefined) => void;
|
|
104
|
+
dispatchEvent: (event: Event) => boolean;
|
|
105
|
+
removeEventListener: (type: string, callback: EventListenerOrEventListenerObject | null, options?: boolean | EventListenerOptions | undefined) => void;
|
|
106
|
+
width: number;
|
|
107
|
+
height: number;
|
|
108
|
+
offsetLeft: number;
|
|
109
|
+
offsetTop: number;
|
|
110
|
+
scale: number;
|
|
111
|
+
} | undefined;
|
|
112
|
+
ShadowRoot: ShadowRoot;
|
|
113
|
+
} | {
|
|
114
|
+
addEventListener: (type: string, callback: EventListenerOrEventListenerObject | null, options?: boolean | AddEventListenerOptions | undefined) => void;
|
|
115
|
+
dispatchEvent: (event: Event) => boolean;
|
|
116
|
+
removeEventListener: (type: string, callback: EventListenerOrEventListenerObject | null, options?: boolean | EventListenerOptions | undefined) => void;
|
|
117
|
+
width: number;
|
|
118
|
+
height: number;
|
|
119
|
+
offsetLeft: number;
|
|
120
|
+
offsetTop: number;
|
|
121
|
+
scale: number;
|
|
122
|
+
})[];
|
|
123
|
+
};
|
|
124
|
+
styles: {
|
|
125
|
+
[key: string]: Partial<CSSStyleDeclaration>;
|
|
126
|
+
};
|
|
127
|
+
attributes: {
|
|
128
|
+
[key: string]: {
|
|
129
|
+
[key: string]: string | boolean;
|
|
130
|
+
};
|
|
131
|
+
};
|
|
132
|
+
modifiersData: {
|
|
133
|
+
[x: string]: any;
|
|
134
|
+
arrow?: {
|
|
135
|
+
x?: number | undefined;
|
|
136
|
+
y?: number | undefined;
|
|
137
|
+
centerOffset: number;
|
|
138
|
+
} | undefined;
|
|
139
|
+
hide?: {
|
|
140
|
+
isReferenceHidden: boolean;
|
|
141
|
+
hasPopperEscaped: boolean;
|
|
142
|
+
referenceClippingOffsets: {
|
|
143
|
+
top: number;
|
|
144
|
+
left: number;
|
|
145
|
+
right: number;
|
|
146
|
+
bottom: number;
|
|
147
|
+
};
|
|
148
|
+
popperEscapeOffsets: {
|
|
149
|
+
top: number;
|
|
150
|
+
left: number;
|
|
151
|
+
right: number;
|
|
152
|
+
bottom: number;
|
|
153
|
+
};
|
|
154
|
+
} | undefined;
|
|
155
|
+
offset?: {
|
|
156
|
+
"bottom-end"?: {
|
|
157
|
+
y: number;
|
|
158
|
+
x: number;
|
|
159
|
+
} | undefined;
|
|
160
|
+
"bottom-start"?: {
|
|
161
|
+
y: number;
|
|
162
|
+
x: number;
|
|
163
|
+
} | undefined;
|
|
164
|
+
auto?: {
|
|
165
|
+
y: number;
|
|
166
|
+
x: number;
|
|
167
|
+
} | undefined;
|
|
168
|
+
"auto-start"?: {
|
|
169
|
+
y: number;
|
|
170
|
+
x: number;
|
|
171
|
+
} | undefined;
|
|
172
|
+
"auto-end"?: {
|
|
173
|
+
y: number;
|
|
174
|
+
x: number;
|
|
175
|
+
} | undefined;
|
|
176
|
+
top?: {
|
|
177
|
+
y: number;
|
|
178
|
+
x: number;
|
|
179
|
+
} | undefined;
|
|
180
|
+
bottom?: {
|
|
181
|
+
y: number;
|
|
182
|
+
x: number;
|
|
183
|
+
} | undefined;
|
|
184
|
+
right?: {
|
|
185
|
+
y: number;
|
|
186
|
+
x: number;
|
|
187
|
+
} | undefined;
|
|
188
|
+
left?: {
|
|
189
|
+
y: number;
|
|
190
|
+
x: number;
|
|
191
|
+
} | undefined;
|
|
192
|
+
"top-start"?: {
|
|
193
|
+
y: number;
|
|
194
|
+
x: number;
|
|
195
|
+
} | undefined;
|
|
196
|
+
"top-end"?: {
|
|
197
|
+
y: number;
|
|
198
|
+
x: number;
|
|
199
|
+
} | undefined;
|
|
200
|
+
"right-start"?: {
|
|
201
|
+
y: number;
|
|
202
|
+
x: number;
|
|
203
|
+
} | undefined;
|
|
204
|
+
"right-end"?: {
|
|
205
|
+
y: number;
|
|
206
|
+
x: number;
|
|
207
|
+
} | undefined;
|
|
208
|
+
"left-start"?: {
|
|
209
|
+
y: number;
|
|
210
|
+
x: number;
|
|
211
|
+
} | undefined;
|
|
212
|
+
"left-end"?: {
|
|
213
|
+
y: number;
|
|
214
|
+
x: number;
|
|
215
|
+
} | undefined;
|
|
216
|
+
} | undefined;
|
|
217
|
+
preventOverflow?: {
|
|
218
|
+
y: number;
|
|
219
|
+
x: number;
|
|
220
|
+
} | undefined;
|
|
221
|
+
popperOffsets?: {
|
|
222
|
+
y: number;
|
|
223
|
+
x: number;
|
|
224
|
+
} | undefined;
|
|
225
|
+
};
|
|
226
|
+
reset: boolean;
|
|
227
|
+
};
|
|
228
|
+
destroy: () => void;
|
|
229
|
+
forceUpdate: () => void;
|
|
230
|
+
update: () => Promise<Partial<import("@popperjs/core").State>>;
|
|
231
|
+
setOptions: (setOptionsAction: Partial<import("@popperjs/core").OptionsGeneric<any>> | ((prev: Partial<import("@popperjs/core").OptionsGeneric<any>>) => Partial<import("@popperjs/core").OptionsGeneric<any>>)) => Promise<Partial<import("@popperjs/core").State>>;
|
|
232
|
+
} | null>];
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { ref, onMounted, watchEffect } from "vue";
|
|
2
|
+
import { popperGenerator, defaultModifiers } from "@popperjs/core/lib/popper-lite";
|
|
3
|
+
import { omitBy, isUndefined } from "lodash-es";
|
|
4
|
+
import flip from "@popperjs/core/lib/modifiers/flip";
|
|
5
|
+
import offset from "@popperjs/core/lib/modifiers/offset";
|
|
6
|
+
import preventOverflow from "@popperjs/core/lib/modifiers/preventOverflow";
|
|
7
|
+
import computeStyles from "@popperjs/core/lib/modifiers/computeStyles";
|
|
8
|
+
import eventListeners from "@popperjs/core/lib/modifiers/eventListeners";
|
|
9
|
+
import { unrefElement } from "@vueuse/core";
|
|
10
|
+
export const createPopper = popperGenerator({
|
|
11
|
+
defaultModifiers: [...defaultModifiers, offset, flip, preventOverflow, computeStyles, eventListeners]
|
|
12
|
+
});
|
|
13
|
+
export function usePopper({
|
|
14
|
+
locked = false,
|
|
15
|
+
overflowPadding = 8,
|
|
16
|
+
offsetDistance = 8,
|
|
17
|
+
offsetSkid = 0,
|
|
18
|
+
gpuAcceleration = true,
|
|
19
|
+
adaptive = true,
|
|
20
|
+
scroll = true,
|
|
21
|
+
resize = true,
|
|
22
|
+
placement,
|
|
23
|
+
strategy
|
|
24
|
+
}, virtualReference) {
|
|
25
|
+
const reference = ref(null);
|
|
26
|
+
const popper = ref(null);
|
|
27
|
+
const instance = ref(null);
|
|
28
|
+
onMounted(() => {
|
|
29
|
+
watchEffect((onInvalidate) => {
|
|
30
|
+
if (!popper.value) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
if (!reference.value && !virtualReference?.value) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
const popperEl = unrefElement(popper);
|
|
37
|
+
const referenceEl = virtualReference?.value || unrefElement(reference);
|
|
38
|
+
if (!(popperEl instanceof HTMLElement)) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
if (!referenceEl) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
instance.value = createPopper(referenceEl, popperEl, omitBy({
|
|
45
|
+
placement,
|
|
46
|
+
strategy,
|
|
47
|
+
modifiers: [{
|
|
48
|
+
name: "flip",
|
|
49
|
+
enabled: !locked
|
|
50
|
+
}, {
|
|
51
|
+
name: "preventOverflow",
|
|
52
|
+
options: {
|
|
53
|
+
padding: overflowPadding
|
|
54
|
+
}
|
|
55
|
+
}, {
|
|
56
|
+
name: "offset",
|
|
57
|
+
options: {
|
|
58
|
+
offset: [offsetSkid, offsetDistance]
|
|
59
|
+
}
|
|
60
|
+
}, {
|
|
61
|
+
name: "computeStyles",
|
|
62
|
+
options: {
|
|
63
|
+
adaptive,
|
|
64
|
+
gpuAcceleration
|
|
65
|
+
}
|
|
66
|
+
}, {
|
|
67
|
+
name: "eventListeners",
|
|
68
|
+
options: {
|
|
69
|
+
scroll,
|
|
70
|
+
resize
|
|
71
|
+
}
|
|
72
|
+
}]
|
|
73
|
+
}, isUndefined));
|
|
74
|
+
onInvalidate(instance.value.destroy);
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
return [reference, popper, instance];
|
|
78
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const _useShortcuts: () => {
|
|
2
|
+
macOS: import("vue").ComputedRef<any>;
|
|
3
|
+
metaSymbol: import("vue").Ref<string>;
|
|
4
|
+
activeElement: import("@vueuse/shared").ComputedRefWithControl<HTMLElement | null | undefined>;
|
|
5
|
+
usingInput: import("vue").ComputedRef<string | boolean>;
|
|
6
|
+
};
|
|
7
|
+
export declare const useShortcuts: () => {
|
|
8
|
+
macOS: import("vue").ComputedRef<any>;
|
|
9
|
+
metaSymbol: import("vue").Ref<string>;
|
|
10
|
+
activeElement: import("@vueuse/shared").ComputedRefWithControl<HTMLElement | null | undefined>;
|
|
11
|
+
usingInput: import("vue").ComputedRef<string | boolean>;
|
|
12
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { createSharedComposable, useActiveElement } from "@vueuse/core";
|
|
2
|
+
import { ref, computed, onMounted } from "vue";
|
|
3
|
+
export const _useShortcuts = () => {
|
|
4
|
+
const macOS = computed(() => process.client && navigator && navigator.userAgent && navigator.userAgent.match(/Macintosh;/));
|
|
5
|
+
const metaSymbol = ref(" ");
|
|
6
|
+
const activeElement = useActiveElement();
|
|
7
|
+
const usingInput = computed(() => {
|
|
8
|
+
const usingInput2 = !!(activeElement.value?.tagName === "INPUT" || activeElement.value?.tagName === "TEXTAREA" || activeElement.value?.contentEditable === "true");
|
|
9
|
+
if (usingInput2) {
|
|
10
|
+
return activeElement.value?.name || true;
|
|
11
|
+
}
|
|
12
|
+
return false;
|
|
13
|
+
});
|
|
14
|
+
onMounted(() => {
|
|
15
|
+
metaSymbol.value = macOS.value ? "\u2318" : "Ctrl";
|
|
16
|
+
});
|
|
17
|
+
return {
|
|
18
|
+
macOS,
|
|
19
|
+
metaSymbol,
|
|
20
|
+
activeElement,
|
|
21
|
+
usingInput
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
export const useShortcuts = createSharedComposable(_useShortcuts);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { UseTimestampOptions } from '@vueuse/core';
|
|
2
|
+
export declare function useTimer(cb: (...args: unknown[]) => any, interval: number, options?: UseTimestampOptions<true>): {
|
|
3
|
+
start: () => void;
|
|
4
|
+
stop: () => void;
|
|
5
|
+
pause: () => void;
|
|
6
|
+
resume: () => void;
|
|
7
|
+
remaining: import("vue-demi").ComputedRef<number>;
|
|
8
|
+
};
|