vueless 0.0.584 → 0.0.585
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.
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { computed, onBeforeUnmount, onMounted, toValue, watch } from "vue";
|
|
2
2
|
import { isSSR } from "../utils/helper.ts";
|
|
3
3
|
|
|
4
|
-
import type {
|
|
4
|
+
import type { MaybeRef } from "vue";
|
|
5
5
|
|
|
6
6
|
export function useMutationObserver(
|
|
7
|
-
target:
|
|
7
|
+
target: MaybeRef<Element | Element[] | null>,
|
|
8
8
|
callback: MutationCallback,
|
|
9
9
|
config = { childList: true, attributes: true, characterData: true },
|
|
10
10
|
) {
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import type { DirectiveBinding } from "vue";
|
|
2
|
-
import type { TemplateRefElement } from "../../types.ts";
|
|
1
|
+
import type { DirectiveBinding, MaybeRef } from "vue";
|
|
3
2
|
|
|
4
3
|
export type RemoveEvents = () => void;
|
|
5
4
|
export type ClickCallback = (event: MouseEvent) => void;
|
|
6
5
|
|
|
7
6
|
export interface ClickOutsideOptions {
|
|
8
7
|
capture?: boolean;
|
|
9
|
-
ignore?:
|
|
8
|
+
ignore?: MaybeRef<Element | Element[] | null>[];
|
|
10
9
|
}
|
|
11
10
|
|
|
12
11
|
export interface DirectiveBindingCallback extends DirectiveBinding {
|
|
@@ -10,6 +10,10 @@ import type {
|
|
|
10
10
|
DirectiveBindingOptions,
|
|
11
11
|
} from "./types.ts";
|
|
12
12
|
|
|
13
|
+
function isElement(element: EventTarget | null) {
|
|
14
|
+
return element instanceof HTMLElement || element instanceof SVGElement;
|
|
15
|
+
}
|
|
16
|
+
|
|
13
17
|
function clickOutside(
|
|
14
18
|
target: MaybeRef<HTMLElement | null>,
|
|
15
19
|
handler: ClickCallback,
|
|
@@ -21,9 +25,9 @@ function clickOutside(
|
|
|
21
25
|
const el = unref(target);
|
|
22
26
|
|
|
23
27
|
function onClick(event: MouseEvent) {
|
|
24
|
-
if (!(event.target
|
|
28
|
+
if (!isElement(event.target)) return;
|
|
25
29
|
|
|
26
|
-
const targetElements = event.composedPath().filter((element) => element
|
|
30
|
+
const targetElements = event.composedPath().filter((element) => isElement(element));
|
|
27
31
|
|
|
28
32
|
if (
|
|
29
33
|
!el ||
|
package/package.json
CHANGED
package/types.ts
CHANGED
|
@@ -55,12 +55,10 @@ import UInputFileConfig from "./ui.form-input-file/config.ts";
|
|
|
55
55
|
import UInputMoneyConfig from "./ui.form-input-money/config.ts";
|
|
56
56
|
import UDataListConfig from "./ui.data-list/config.ts";
|
|
57
57
|
|
|
58
|
-
import type { ComputedRef,
|
|
58
|
+
import type { ComputedRef, Ref, ComponentInternalInstance } from "vue";
|
|
59
59
|
import type { Props } from "tippy.js";
|
|
60
60
|
import type { LocaleOptions } from "./adatper.locale/vueless.ts";
|
|
61
61
|
|
|
62
|
-
export type TemplateRefElement = MaybeRef<HTMLElement | HTMLElement[] | null>;
|
|
63
|
-
|
|
64
62
|
export enum ColorMode {
|
|
65
63
|
Dark = "dark",
|
|
66
64
|
Light = "light",
|