@flux-ui/internals 3.0.0-next.7 → 3.0.0-next.70
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-5ooZTjm_.js +2 -0
- package/dist/composable-5ooZTjm_.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-7w0u9Q_D.d.ts +138 -0
- package/dist/index-7w0u9Q_D.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 -4
- 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 +30 -13
- 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 +26 -20
- 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 +76 -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/index.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,38 +0,0 @@
|
|
|
1
|
-
import type { Ref } from 'vue';
|
|
2
|
-
import { customRef, isRef, ref, watch } from 'vue';
|
|
3
|
-
|
|
4
|
-
export default function <T>(initialValue: Ref<T> | T, delay: number, immediate: boolean = false): Ref<T> {
|
|
5
|
-
const state = ref(isRef(initialValue) ? initialValue.value : initialValue);
|
|
6
|
-
|
|
7
|
-
const debounced = customRef((track, trigger) => ({
|
|
8
|
-
get() {
|
|
9
|
-
track();
|
|
10
|
-
return state.value;
|
|
11
|
-
},
|
|
12
|
-
|
|
13
|
-
set: debounce(value => {
|
|
14
|
-
state.value = value;
|
|
15
|
-
trigger();
|
|
16
|
-
}, delay, immediate)
|
|
17
|
-
})) as Ref<T>;
|
|
18
|
-
|
|
19
|
-
if (isRef(initialValue)) {
|
|
20
|
-
watch(initialValue, value => debounced.value = value);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
return debounced;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
function debounce<TFunc extends (...args: any[]) => any>(fn: TFunc, delay: number, immediate: boolean = false): VoidFunction {
|
|
27
|
-
let timeout: any;
|
|
28
|
-
|
|
29
|
-
return (...args: any[]) => {
|
|
30
|
-
if (immediate && !timeout) {
|
|
31
|
-
fn(...args);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
clearTimeout(timeout);
|
|
35
|
-
|
|
36
|
-
timeout = setTimeout(() => requestAnimationFrame(() => fn(...args)), delay);
|
|
37
|
-
};
|
|
38
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type { Ref } from 'vue';
|
|
2
|
-
import { onMounted, onUnmounted, ref, unref } from 'vue';
|
|
3
|
-
|
|
4
|
-
export default function (interval: Ref<number> | number, fn: Function): void {
|
|
5
|
-
const intervalRef = ref<any>();
|
|
6
|
-
|
|
7
|
-
onMounted(() => {
|
|
8
|
-
tick();
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
onUnmounted(() => {
|
|
12
|
-
clearTimeout(intervalRef.value);
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
function schedule(): void {
|
|
16
|
-
intervalRef.value = setTimeout(() => requestAnimationFrame(tick), unref(interval));
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
function tick(): void {
|
|
20
|
-
schedule();
|
|
21
|
-
fn();
|
|
22
|
-
}
|
|
23
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { onScopeDispose, watch } from 'vue';
|
|
2
|
-
import type { TemplateRef } from '../util';
|
|
3
|
-
import { unrefTemplateElement } from '../util';
|
|
4
|
-
|
|
5
|
-
export default function <TElement extends HTMLElement>(elementRef: TemplateRef<TElement>, callback: MutationCallback, options?: MutationObserverInit): void {
|
|
6
|
-
options ??= {
|
|
7
|
-
attributes: true
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
let observer: MutationObserver | undefined;
|
|
11
|
-
|
|
12
|
-
const stop = watch(() => unrefTemplateElement(elementRef), element => {
|
|
13
|
-
cleanup();
|
|
14
|
-
|
|
15
|
-
if (!element) {
|
|
16
|
-
return;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
observer = new MutationObserver(callback);
|
|
20
|
-
observer.observe(element, options);
|
|
21
|
-
}, {immediate: true});
|
|
22
|
-
|
|
23
|
-
function cleanup(): void {
|
|
24
|
-
if (!observer) {
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
observer.disconnect();
|
|
29
|
-
observer = undefined;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
function dispose(): void {
|
|
33
|
-
cleanup();
|
|
34
|
-
stop();
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
onScopeDispose(dispose);
|
|
38
|
-
}
|