@flux-ui/internals 3.0.0-next.5 → 3.0.0-next.51

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.
Files changed (75) hide show
  1. package/README.md +36 -0
  2. package/dist/composable/index.d.ts +2 -17
  3. package/dist/composable/index.js +1 -0
  4. package/dist/composable-CJXC7sly.js +2 -0
  5. package/dist/composable-CJXC7sly.js.map +1 -0
  6. package/dist/data/index.d.ts +246 -1
  7. package/dist/data/index.d.ts.map +1 -0
  8. package/dist/data/index.js +2 -0
  9. package/dist/data/index.js.map +1 -0
  10. package/dist/directive/index.d.ts +2 -3
  11. package/dist/directive/index.js +1 -0
  12. package/dist/directive-Dprka-AO.js +2 -0
  13. package/dist/directive-Dprka-AO.js.map +1 -0
  14. package/dist/index-B79OP5Th.d.ts +70 -0
  15. package/dist/index-B79OP5Th.d.ts.map +1 -0
  16. package/dist/index-BRS2s2tX.d.ts +14 -0
  17. package/dist/index-BRS2s2tX.d.ts.map +1 -0
  18. package/dist/index-BhkFHXuX.d.ts +98 -0
  19. package/dist/index-BhkFHXuX.d.ts.map +1 -0
  20. package/dist/index.d.ts +5 -4
  21. package/dist/index.js +1 -0
  22. package/dist/util/index.d.ts +2 -13
  23. package/dist/util/index.js +1 -0
  24. package/dist/util-CwaOsSvo.js +2 -0
  25. package/dist/util-CwaOsSvo.js.map +1 -0
  26. package/package.json +31 -18
  27. package/src/composable/index.ts +1 -5
  28. package/src/composable/useFocusTrap.ts +1 -1
  29. package/src/composable/useFocusTrapReturn.ts +11 -7
  30. package/src/composable/useFocusZone.ts +10 -9
  31. package/src/composable/useScrollEdges.ts +70 -0
  32. package/src/directive/focusTrap.ts +4 -0
  33. package/src/directive/heightTransition.ts +6 -2
  34. package/src/util/animationFrameDebounce.ts +14 -0
  35. package/src/util/focusTrap.ts +2 -1
  36. package/src/util/index.ts +2 -1
  37. package/dist/composable/useCalendar.d.ts +0 -20
  38. package/dist/composable/useCalendarMonthSwitcher.d.ts +0 -10
  39. package/dist/composable/useCalendarYearSwitcher.d.ts +0 -8
  40. package/dist/composable/useClickOutside.d.ts +0 -4
  41. package/dist/composable/useComponentId.d.ts +0 -2
  42. package/dist/composable/useDebouncedRef.d.ts +0 -2
  43. package/dist/composable/useEventListener.d.ts +0 -2
  44. package/dist/composable/useFocusTrap.d.ts +0 -8
  45. package/dist/composable/useFocusTrapLock.d.ts +0 -2
  46. package/dist/composable/useFocusTrapReturn.d.ts +0 -2
  47. package/dist/composable/useFocusTrapSubscription.d.ts +0 -2
  48. package/dist/composable/useFocusZone.d.ts +0 -6
  49. package/dist/composable/useInView.d.ts +0 -6
  50. package/dist/composable/useInterval.d.ts +0 -2
  51. package/dist/composable/useMutationObserver.d.ts +0 -2
  52. package/dist/composable/useRemembered.d.ts +0 -2
  53. package/dist/composable/useScrollPosition.d.ts +0 -7
  54. package/dist/data/color.d.ts +0 -242
  55. package/dist/directive/focusTrap.d.ts +0 -5
  56. package/dist/directive/heightTransition.d.ts +0 -5
  57. package/dist/flux-internals.js +0 -4
  58. package/dist/flux-internals.js.map +0 -42
  59. package/dist/util/flattenVNodeTree.d.ts +0 -2
  60. package/dist/util/focusTrap.d.ts +0 -8
  61. package/dist/util/getBidirectionalFocusElement.d.ts +0 -1
  62. package/dist/util/getComponentName.d.ts +0 -7
  63. package/dist/util/getComponentProps.d.ts +0 -1
  64. package/dist/util/getExposedRef.d.ts +0 -2
  65. package/dist/util/getFocusableElement.d.ts +0 -1
  66. package/dist/util/getFocusableElements.d.ts +0 -1
  67. package/dist/util/getKeyboardFocusableElements.d.ts +0 -1
  68. package/dist/util/unrefTemplateElement.d.ts +0 -4
  69. package/dist/util/warn.d.ts +0 -1
  70. package/dist/util/wrapFocus.d.ts +0 -1
  71. package/src/composable/useClickOutside.ts +0 -38
  72. package/src/composable/useComponentId.ts +0 -8
  73. package/src/composable/useDebouncedRef.ts +0 -38
  74. package/src/composable/useInterval.ts +0 -23
  75. package/src/composable/useMutationObserver.ts +0 -38
@@ -1,38 +0,0 @@
1
- import type { Ref } from 'vue';
2
- import { onMounted, onUnmounted, ref, unref, watchEffect } from 'vue';
3
- import type { TemplateRef } from '../util';
4
- import { unrefTemplateElement } from '../util';
5
-
6
- type Handler = ((evt: PointerEvent) => void) | ((evt: PointerEvent) => Promise<void>);
7
-
8
- export default function <TElement extends HTMLElement>(elementRefs: TemplateRef<TElement> | TemplateRef<TElement>[], enabled: boolean | Ref<boolean>, onOutsideClick: Handler): void {
9
- const elements = ref<HTMLElement[]>([]);
10
-
11
- onMounted(() => {
12
- document.addEventListener('pointerdown', onBodyClick);
13
- });
14
-
15
- onUnmounted(() => {
16
- document.removeEventListener('pointerdown', onBodyClick);
17
- });
18
-
19
- function onBodyClick(evt: PointerEvent): void {
20
- if (!unref(enabled)) {
21
- return;
22
- }
23
-
24
- const isInside = unref(elements).some(element => element.contains(evt.target as Node));
25
- !isInside && onOutsideClick(evt);
26
- }
27
-
28
- watchEffect(() => {
29
- const newElements: HTMLElement[] = [];
30
-
31
- (Array.isArray(elementRefs) ? elementRefs : [elementRefs]).forEach(elementRef => {
32
- const element = unrefTemplateElement(elementRef);
33
- element && newElements.push(element);
34
- });
35
-
36
- elements.value = newElements;
37
- });
38
- }
@@ -1,8 +0,0 @@
1
- import type { ComputedRef } from 'vue';
2
- import { computed, getCurrentInstance } from 'vue';
3
-
4
- export default function (): ComputedRef<number> {
5
- const instance = getCurrentInstance();
6
-
7
- return computed(() => instance?.uid ?? (instance?.proxy as any)._uid ?? 0);
8
- }
@@ -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
- }