@flux-ui/internals 3.0.0-next.6 → 3.0.0-next.60
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/README.md +36 -0
- package/dist/composable/index.d.ts +2 -17
- package/dist/composable/index.js +1 -0
- package/dist/composable-Cp0PgZry.js +2 -0
- package/dist/composable-Cp0PgZry.js.map +1 -0
- package/dist/data/index.d.ts +246 -1
- package/dist/data/index.d.ts.map +1 -0
- package/dist/data/index.js +2 -0
- package/dist/data/index.js.map +1 -0
- package/dist/directive/index.d.ts +2 -3
- package/dist/directive/index.js +1 -0
- package/dist/directive-Dprka-AO.js +2 -0
- package/dist/directive-Dprka-AO.js.map +1 -0
- package/dist/index-4qwf2pQQ.d.ts +136 -0
- package/dist/index-4qwf2pQQ.d.ts.map +1 -0
- package/dist/index-B79OP5Th.d.ts +70 -0
- package/dist/index-B79OP5Th.d.ts.map +1 -0
- package/dist/index-BRS2s2tX.d.ts +14 -0
- package/dist/index-BRS2s2tX.d.ts.map +1 -0
- package/dist/index.d.ts +5 -4
- package/dist/index.js +1 -0
- package/dist/util/index.d.ts +2 -13
- package/dist/util/index.js +1 -0
- package/dist/util-CwaOsSvo.js +2 -0
- package/dist/util-CwaOsSvo.js.map +1 -0
- package/package.json +33 -18
- package/src/composable/index.ts +3 -5
- package/src/composable/useCalendar.ts +1 -1
- package/src/composable/useCalendarMonthSwitcher.ts +1 -2
- package/src/composable/useCalendarTimeGrid.ts +103 -0
- package/src/composable/useCalendarYearSwitcher.ts +1 -2
- package/src/composable/useFocusTrap.ts +3 -5
- package/src/composable/useFocusTrapLock.ts +1 -2
- package/src/composable/useFocusTrapReturn.ts +11 -7
- package/src/composable/useFocusTrapSubscription.ts +1 -2
- package/src/composable/useFocusZone.ts +10 -9
- package/src/composable/useInView.ts +2 -4
- package/src/composable/useKeyboardGrab.ts +152 -0
- package/src/composable/useRemembered.ts +1 -2
- package/src/composable/useScrollEdges.ts +68 -0
- package/src/composable/useScrollPosition.ts +1 -2
- package/src/directive/focusTrap.ts +4 -0
- package/src/directive/heightTransition.ts +6 -2
- package/src/directive/index.ts +1 -1
- package/src/util/animationFrameDebounce.ts +15 -0
- package/src/util/flattenVNodeTree.ts +1 -2
- package/src/util/focusTrap.ts +2 -1
- package/src/util/index.ts +2 -1
- package/src/util/unrefTemplateElement.ts +1 -1
- package/dist/composable/useCalendar.d.ts +0 -20
- package/dist/composable/useCalendarMonthSwitcher.d.ts +0 -10
- package/dist/composable/useCalendarYearSwitcher.d.ts +0 -8
- package/dist/composable/useClickOutside.d.ts +0 -4
- package/dist/composable/useComponentId.d.ts +0 -2
- package/dist/composable/useDebouncedRef.d.ts +0 -2
- package/dist/composable/useEventListener.d.ts +0 -2
- package/dist/composable/useFocusTrap.d.ts +0 -8
- package/dist/composable/useFocusTrapLock.d.ts +0 -2
- package/dist/composable/useFocusTrapReturn.d.ts +0 -2
- package/dist/composable/useFocusTrapSubscription.d.ts +0 -2
- package/dist/composable/useFocusZone.d.ts +0 -6
- package/dist/composable/useInView.d.ts +0 -6
- package/dist/composable/useInterval.d.ts +0 -2
- package/dist/composable/useMutationObserver.d.ts +0 -2
- package/dist/composable/useRemembered.d.ts +0 -2
- package/dist/composable/useScrollPosition.d.ts +0 -7
- package/dist/data/color.d.ts +0 -242
- package/dist/directive/focusTrap.d.ts +0 -5
- package/dist/directive/heightTransition.d.ts +0 -5
- package/dist/flux-internals.js +0 -4
- package/dist/flux-internals.js.map +0 -42
- package/dist/util/flattenVNodeTree.d.ts +0 -2
- package/dist/util/focusTrap.d.ts +0 -8
- package/dist/util/getBidirectionalFocusElement.d.ts +0 -1
- package/dist/util/getComponentName.d.ts +0 -7
- package/dist/util/getComponentProps.d.ts +0 -1
- package/dist/util/getExposedRef.d.ts +0 -2
- package/dist/util/getFocusableElement.d.ts +0 -1
- package/dist/util/getFocusableElements.d.ts +0 -1
- package/dist/util/getKeyboardFocusableElements.d.ts +0 -1
- package/dist/util/unrefTemplateElement.d.ts +0 -4
- package/dist/util/warn.d.ts +0 -1
- package/dist/util/wrapFocus.d.ts +0 -1
- package/src/composable/useClickOutside.ts +0 -38
- package/src/composable/useComponentId.ts +0 -8
- package/src/composable/useDebouncedRef.ts +0 -38
- package/src/composable/useInterval.ts +0 -23
- package/src/composable/useMutationObserver.ts +0 -38
|
@@ -1,14 +1,18 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import {
|
|
1
|
+
import { type Ref, unref, watch } from 'vue';
|
|
2
|
+
import { type TemplateRef, unrefTemplateElement } from '../util';
|
|
3
3
|
|
|
4
|
-
export default function (disabled: Ref<boolean>): void {
|
|
5
|
-
|
|
4
|
+
export default function (containerRef: TemplateRef<HTMLElement>, disabled: Ref<boolean>): void {
|
|
5
|
+
watch(containerRef, (_, __, onCleanup) => {
|
|
6
|
+
const container = unrefTemplateElement(containerRef);
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
if (unref(disabled)) {
|
|
8
|
+
if (!container || unref(disabled)) {
|
|
9
9
|
return;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
const previousTarget = document.activeElement as HTMLElement | null;
|
|
13
|
+
|
|
14
|
+
onCleanup(() => {
|
|
15
|
+
requestAnimationFrame(() => previousTarget?.focus());
|
|
16
|
+
});
|
|
13
17
|
});
|
|
14
18
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { onMounted, onUnmounted, ref } from 'vue';
|
|
2
|
-
import type
|
|
3
|
-
import { FOCUS_TRAP_LOCKS } from '../util';
|
|
2
|
+
import { FOCUS_TRAP_LOCKS, type FocusTrapListener } from '../util';
|
|
4
3
|
|
|
5
4
|
export default function (listener: FocusTrapListener): void {
|
|
6
5
|
const unsubscribe = ref<Function | null>(null);
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type
|
|
3
|
-
import { getBidirectionalFocusElement, getFocusableElement, getFocusableElements
|
|
4
|
-
import useMutationObserver from './useMutationObserver';
|
|
1
|
+
import { unwrapElement, useMutationObserver } from '@basmilius/common';
|
|
2
|
+
import { type ComponentPublicInstance, type Ref, watch } from 'vue';
|
|
3
|
+
import { getBidirectionalFocusElement, getFocusableElement, getFocusableElements } from '../util';
|
|
5
4
|
|
|
6
|
-
|
|
5
|
+
type EligibleElement = ComponentPublicInstance | HTMLElement;
|
|
6
|
+
|
|
7
|
+
export default function <TElement extends EligibleElement>(containerRef: Ref<TElement>, {cycle = true, direction = 'bidirectional'}: UseFocusZoneOptions = {}): void {
|
|
7
8
|
useMutationObserver(containerRef, () => updateFocus(findInitialIndex(), false));
|
|
8
9
|
|
|
9
10
|
function findInitialIndex(): number {
|
|
10
|
-
const container =
|
|
11
|
+
const container = unwrapElement(containerRef);
|
|
11
12
|
const elements = getFocusableElements(container);
|
|
12
13
|
const isActiveIndex = elements.findIndex(e => e.classList.contains('is-active'));
|
|
13
14
|
const notDisabledIndex = elements.findIndex(e => !e.hasAttribute('aria-disabled'));
|
|
@@ -24,7 +25,7 @@ export default function <TElement extends HTMLElement>(containerRef: TemplateRef
|
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
function updateFocus(elementIndex: number, doFocus: boolean = true): void {
|
|
27
|
-
const container =
|
|
28
|
+
const container = unwrapElement(containerRef)!;
|
|
28
29
|
const elements = getFocusableElements(container);
|
|
29
30
|
elements.forEach((elm, index) => elm.tabIndex = index === elementIndex ? 0 : -1);
|
|
30
31
|
|
|
@@ -32,7 +33,7 @@ export default function <TElement extends HTMLElement>(containerRef: TemplateRef
|
|
|
32
33
|
}
|
|
33
34
|
|
|
34
35
|
function onKeyDown(evt: KeyboardEvent): void {
|
|
35
|
-
const container =
|
|
36
|
+
const container = unwrapElement(containerRef)!;
|
|
36
37
|
const elements = getFocusableElements(container);
|
|
37
38
|
|
|
38
39
|
if (['Enter', ' '].includes(evt.key)) {
|
|
@@ -52,7 +53,7 @@ export default function <TElement extends HTMLElement>(containerRef: TemplateRef
|
|
|
52
53
|
}
|
|
53
54
|
|
|
54
55
|
watch(containerRef, (_, __, onCleanup) => {
|
|
55
|
-
const container =
|
|
56
|
+
const container = unwrapElement(containerRef);
|
|
56
57
|
|
|
57
58
|
if (!container) {
|
|
58
59
|
return;
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import {
|
|
3
|
-
import type { TemplateRef } from '../util';
|
|
4
|
-
import { unrefTemplateElement } from '../util';
|
|
1
|
+
import { ref, type Ref, watch } from 'vue';
|
|
2
|
+
import { type TemplateRef, unrefTemplateElement } from '../util';
|
|
5
3
|
|
|
6
4
|
export default function <TElement extends HTMLElement>(containerRef: TemplateRef<TElement>, options: UseInViewOptions = {}): Ref<boolean> {
|
|
7
5
|
const inView = ref(options.initial ?? false);
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { computed, type ComputedRef, ref, type Ref, unref } from 'vue';
|
|
2
|
+
|
|
3
|
+
export type KeyboardGrabDirection = 'up' | 'down' | 'left' | 'right';
|
|
4
|
+
|
|
5
|
+
export type UseKeyboardGrabOptions<TPos> = {
|
|
6
|
+
readonly isDraggable: Ref<boolean>;
|
|
7
|
+
readonly itemId: Ref<string | number | null | undefined>;
|
|
8
|
+
readonly grabbedId: Ref<string | number | null>;
|
|
9
|
+
onGrab(): TPos;
|
|
10
|
+
onMove(direction: KeyboardGrabDirection): void;
|
|
11
|
+
onCommit(origin: TPos): void;
|
|
12
|
+
onCancel(origin: TPos): void;
|
|
13
|
+
announce?(message: string): void;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export type UseKeyboardGrabReturn = {
|
|
17
|
+
readonly isGrabbed: ComputedRef<boolean>;
|
|
18
|
+
handleKeyDown(evt: KeyboardEvent): void;
|
|
19
|
+
release(): void;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
let liveRegion: HTMLElement | null = null;
|
|
23
|
+
|
|
24
|
+
function ensureLiveRegion(): HTMLElement {
|
|
25
|
+
if (liveRegion) {
|
|
26
|
+
return liveRegion;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (typeof document === 'undefined') {
|
|
30
|
+
return null as unknown as HTMLElement;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const region = document.createElement('div');
|
|
34
|
+
region.setAttribute('role', 'status');
|
|
35
|
+
region.setAttribute('aria-live', 'polite');
|
|
36
|
+
region.setAttribute('aria-atomic', 'true');
|
|
37
|
+
region.style.cssText = 'position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0';
|
|
38
|
+
document.body.appendChild(region);
|
|
39
|
+
liveRegion = region;
|
|
40
|
+
return region;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export function defaultAnnounce(message: string): void {
|
|
44
|
+
const region = ensureLiveRegion();
|
|
45
|
+
|
|
46
|
+
if (!region) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
region.textContent = '';
|
|
51
|
+
requestAnimationFrame(() => {
|
|
52
|
+
region.textContent = message;
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Generic keyboard-grab state machine. Maps Space/Enter/Escape/Arrow keys
|
|
58
|
+
* onto grab/commit/cancel/move callbacks. The actual movement logic is
|
|
59
|
+
* delegated to `onMove` since it depends on the host component's topology.
|
|
60
|
+
*/
|
|
61
|
+
export default function useKeyboardGrab<TPos>(options: UseKeyboardGrabOptions<TPos>): UseKeyboardGrabReturn {
|
|
62
|
+
const origin = ref<TPos | null>(null);
|
|
63
|
+
const announce = options.announce ?? defaultAnnounce;
|
|
64
|
+
|
|
65
|
+
const isGrabbed = computed<boolean>(() => {
|
|
66
|
+
const id = unref(options.itemId);
|
|
67
|
+
const grabbed = unref(options.grabbedId);
|
|
68
|
+
|
|
69
|
+
return id != null && grabbed === id;
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
function release(): void {
|
|
73
|
+
origin.value = null;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function handleKeyDown(evt: KeyboardEvent): void {
|
|
77
|
+
if (!unref(options.isDraggable)) {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const id = unref(options.itemId);
|
|
82
|
+
|
|
83
|
+
if (id == null) {
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
if (!isGrabbed.value) {
|
|
88
|
+
if (evt.key === ' ' || evt.key === 'Enter') {
|
|
89
|
+
evt.preventDefault();
|
|
90
|
+
origin.value = options.onGrab() as TPos;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
switch (evt.key) {
|
|
97
|
+
case 'ArrowUp':
|
|
98
|
+
evt.preventDefault();
|
|
99
|
+
options.onMove('up');
|
|
100
|
+
break;
|
|
101
|
+
|
|
102
|
+
case 'ArrowDown':
|
|
103
|
+
evt.preventDefault();
|
|
104
|
+
options.onMove('down');
|
|
105
|
+
break;
|
|
106
|
+
|
|
107
|
+
case 'ArrowLeft':
|
|
108
|
+
evt.preventDefault();
|
|
109
|
+
options.onMove('left');
|
|
110
|
+
break;
|
|
111
|
+
|
|
112
|
+
case 'ArrowRight':
|
|
113
|
+
evt.preventDefault();
|
|
114
|
+
options.onMove('right');
|
|
115
|
+
break;
|
|
116
|
+
|
|
117
|
+
case ' ':
|
|
118
|
+
case 'Enter': {
|
|
119
|
+
evt.preventDefault();
|
|
120
|
+
const o = origin.value;
|
|
121
|
+
origin.value = null;
|
|
122
|
+
|
|
123
|
+
if (o !== null) {
|
|
124
|
+
options.onCommit(o);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
break;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
case 'Escape': {
|
|
131
|
+
evt.preventDefault();
|
|
132
|
+
const o = origin.value;
|
|
133
|
+
origin.value = null;
|
|
134
|
+
|
|
135
|
+
if (o !== null) {
|
|
136
|
+
options.onCancel(o);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
break;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
// Suppress unused-warning when announce is unused inside the function.
|
|
144
|
+
void announce;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
return {
|
|
148
|
+
isGrabbed,
|
|
149
|
+
handleKeyDown,
|
|
150
|
+
release
|
|
151
|
+
};
|
|
152
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { ref, type Ref, watch } from 'vue';
|
|
2
|
+
import { type TemplateRef, unrefTemplateElement } from '../util';
|
|
3
|
+
|
|
4
|
+
export default function <TElement extends HTMLElement>(elementRef: TemplateRef<TElement>): UseScrollEdgesReturn {
|
|
5
|
+
const isAtStart = ref(true);
|
|
6
|
+
const isAtEnd = ref(true);
|
|
7
|
+
|
|
8
|
+
watch(elementRef, (_, __, onCleanup) => {
|
|
9
|
+
const element = unrefTemplateElement(elementRef);
|
|
10
|
+
|
|
11
|
+
if (!element) {
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const update = (): void => {
|
|
16
|
+
const {scrollTop, scrollHeight, clientHeight} = element;
|
|
17
|
+
|
|
18
|
+
isAtStart.value = scrollTop <= 0;
|
|
19
|
+
isAtEnd.value = Math.ceil(scrollTop + clientHeight) >= scrollHeight;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const resizeObserver = new ResizeObserver(update);
|
|
23
|
+
resizeObserver.observe(element);
|
|
24
|
+
|
|
25
|
+
for (const child of Array.from(element.children)) {
|
|
26
|
+
resizeObserver.observe(child);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const mutationObserver = new MutationObserver(mutations => {
|
|
30
|
+
for (const mutation of mutations) {
|
|
31
|
+
for (const node of Array.from(mutation.addedNodes)) {
|
|
32
|
+
if (node instanceof Element) {
|
|
33
|
+
resizeObserver.observe(node);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
for (const node of Array.from(mutation.removedNodes)) {
|
|
38
|
+
if (node instanceof Element) {
|
|
39
|
+
resizeObserver.unobserve(node);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
update();
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
mutationObserver.observe(element, {childList: true});
|
|
48
|
+
element.addEventListener('scroll', update, {passive: true});
|
|
49
|
+
|
|
50
|
+
update();
|
|
51
|
+
|
|
52
|
+
onCleanup(() => {
|
|
53
|
+
element.removeEventListener('scroll', update);
|
|
54
|
+
resizeObserver.disconnect();
|
|
55
|
+
mutationObserver.disconnect();
|
|
56
|
+
});
|
|
57
|
+
}, {immediate: true});
|
|
58
|
+
|
|
59
|
+
return {
|
|
60
|
+
isAtStart,
|
|
61
|
+
isAtEnd
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export type UseScrollEdgesReturn = {
|
|
66
|
+
readonly isAtStart: Ref<boolean>;
|
|
67
|
+
readonly isAtEnd: Ref<boolean>;
|
|
68
|
+
};
|
|
@@ -34,7 +34,7 @@ class HeightTransition {
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
getComputedStyle(this.#root);
|
|
37
|
-
requestAnimationFrame(() =>
|
|
37
|
+
requestAnimationFrame(() => this.#root.style.height = height);
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
|
|
@@ -49,7 +49,11 @@ export default {
|
|
|
49
49
|
const heightTransition = new HeightTransition(elm);
|
|
50
50
|
heightTransition.register();
|
|
51
51
|
heightTransitions.set(elm, heightTransition);
|
|
52
|
+
},
|
|
53
|
+
|
|
54
|
+
getSSRProps(): Record<string, unknown> {
|
|
55
|
+
return {};
|
|
52
56
|
}
|
|
53
|
-
} satisfies Directive;
|
|
57
|
+
} satisfies Directive as Directive;
|
|
54
58
|
|
|
55
59
|
const heightTransitions: WeakMap<HTMLElement, HeightTransition> = new WeakMap();
|
package/src/directive/index.ts
CHANGED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { FluxMaybePromise } from '@flux-ui/types';
|
|
2
|
+
|
|
3
|
+
export default function <T extends () => FluxMaybePromise<void>>(fn: T): T {
|
|
4
|
+
if (typeof requestAnimationFrame === 'undefined') {
|
|
5
|
+
return (() => {
|
|
6
|
+
}) as T;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
let animationFrame = 0;
|
|
10
|
+
|
|
11
|
+
return (() => {
|
|
12
|
+
cancelAnimationFrame(animationFrame);
|
|
13
|
+
animationFrame = requestAnimationFrame(fn);
|
|
14
|
+
}) as T;
|
|
15
|
+
}
|
package/src/util/focusTrap.ts
CHANGED
package/src/util/index.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export { default as animationFrameDebounce } from './animationFrameDebounce';
|
|
1
2
|
export { default as flattenVNodeTree } from './flattenVNodeTree';
|
|
2
3
|
export { default as getBidirectionalFocusElement } from './getBidirectionalFocusElement';
|
|
3
4
|
export { default as getComponentName } from './getComponentName';
|
|
@@ -12,4 +13,4 @@ export { default as wrapFocus } from './wrapFocus';
|
|
|
12
13
|
|
|
13
14
|
export { default as FOCUS_TRAP_LOCKS, type FocusTrapListener } from './focusTrap';
|
|
14
15
|
|
|
15
|
-
export const isSSR = !globalThis.document;
|
|
16
|
+
export const isSSR: boolean = !globalThis.document;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { isHtmlElement } from '@basmilius/utils';
|
|
2
|
-
import { ComponentPublicInstance, ShallowRef, unref } from 'vue';
|
|
2
|
+
import { type ComponentPublicInstance, type ShallowRef, unref } from 'vue';
|
|
3
3
|
|
|
4
4
|
export type TemplateElement<TElement extends HTMLElement> = ComponentPublicInstance<any, any, any, any, any, any, any, any, any, any, any, any, any, any, TElement> | TElement | null;
|
|
5
5
|
export type TemplateRef<TElement extends HTMLElement> = Readonly<ShallowRef<TemplateElement<TElement>>>;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { DateTime } from "luxon";
|
|
2
|
-
import { type Ref } from "vue";
|
|
3
|
-
export default function(initialDate: DateTime, options?: UseCalendarOptions): UseCalendarReturn;
|
|
4
|
-
type UseCalendarOptions = {
|
|
5
|
-
readonly monthLength?: "short" | "long"
|
|
6
|
-
readonly weekDayLength?: "short" | "long"
|
|
7
|
-
};
|
|
8
|
-
type UseCalendarReturn = {
|
|
9
|
-
readonly isTransitioningToPast: Ref<boolean>
|
|
10
|
-
readonly viewDate: Ref<DateTime>
|
|
11
|
-
readonly viewDateNext: Ref<DateTime>
|
|
12
|
-
readonly viewDatePrevious: Ref<DateTime>
|
|
13
|
-
readonly viewMonth: Ref<string>
|
|
14
|
-
readonly viewYear: Ref<string>
|
|
15
|
-
readonly dates: Ref<DateTime[]>
|
|
16
|
-
readonly days: Ref<string[]>
|
|
17
|
-
setViewDate(date: DateTime): void
|
|
18
|
-
nextMonth(): void
|
|
19
|
-
previousMonth(): void
|
|
20
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { DateTime } from "luxon";
|
|
2
|
-
import type { Ref } from "vue";
|
|
3
|
-
export default function(currentDate: Ref<DateTime>, displayLength: "short" | "long"): UseCalendarMonthSwitcherReturn;
|
|
4
|
-
type MonthEntry = {
|
|
5
|
-
readonly date: DateTime
|
|
6
|
-
readonly label: string
|
|
7
|
-
};
|
|
8
|
-
type UseCalendarMonthSwitcherReturn = {
|
|
9
|
-
readonly months: Ref<MonthEntry[]>
|
|
10
|
-
};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { DateTime } from "luxon";
|
|
2
|
-
import type { Ref } from "vue";
|
|
3
|
-
export default function(currentDate: Ref<DateTime>, limit?: number): UseCalendarYearSwitcherReturn;
|
|
4
|
-
type UseCalendarYearSwitcherReturn = {
|
|
5
|
-
readonly years: Ref<number[]>
|
|
6
|
-
next(): void
|
|
7
|
-
previous(): void
|
|
8
|
-
};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { Ref } from "vue";
|
|
2
|
-
import type { TemplateRef } from "../util";
|
|
3
|
-
type Handler = ((evt: PointerEvent) => void) | ((evt: PointerEvent) => Promise<void>);
|
|
4
|
-
export default function<TElement extends HTMLElement>(elementRefs: TemplateRef<TElement> | TemplateRef<TElement>[], enabled: boolean | Ref<boolean>, onOutsideClick: Handler): void;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { Ref } from "vue";
|
|
2
|
-
import type { TemplateRef } from "../util";
|
|
3
|
-
export default function(containerRef: TemplateRef<HTMLElement>, options?: UseFocusTrapOptions): void;
|
|
4
|
-
type UseFocusTrapOptions = {
|
|
5
|
-
attachTo?: HTMLElement | Document
|
|
6
|
-
disable?: Ref<boolean>
|
|
7
|
-
disableReturn?: Ref<boolean>
|
|
8
|
-
};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { TemplateRef } from "../util";
|
|
2
|
-
export default function<TElement extends HTMLElement>(containerRef: TemplateRef<TElement>, { cycle, direction }?: UseFocusZoneOptions): void;
|
|
3
|
-
type UseFocusZoneOptions = {
|
|
4
|
-
readonly cycle?: boolean
|
|
5
|
-
readonly direction?: "bidirectional" | "horizontal" | "vertical"
|
|
6
|
-
};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { Ref } from "vue";
|
|
2
|
-
import type { TemplateRef } from "../util";
|
|
3
|
-
export default function<TElement extends HTMLElement>(containerRef: TemplateRef<TElement>, options?: UseInViewOptions): Ref<boolean>;
|
|
4
|
-
type UseInViewOptions = IntersectionObserverInit & {
|
|
5
|
-
readonly initial?: boolean
|
|
6
|
-
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { Ref } from "vue";
|
|
2
|
-
import type { TemplateRef } from "../util";
|
|
3
|
-
export default function<TElement extends HTMLElement>(elementRef?: TemplateRef<TElement>): UseScrollPositionReturn;
|
|
4
|
-
export type UseScrollPositionReturn = {
|
|
5
|
-
readonly x: Ref<number>
|
|
6
|
-
readonly y: Ref<number>
|
|
7
|
-
};
|