@v-c/util 1.4.1 → 1.4.3
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/dist/PortalWrapper.d.ts +1 -1
- package/dist/hooks/useAllowClear.d.ts +1 -1
- package/dist/hooks/useScopeId.d.ts +1 -0
- package/dist/hooks/useScopeId.js +37 -0
- package/dist/index.d.ts +17 -16
- package/dist/index.js +2 -1
- package/dist/vnode.d.ts +1 -1
- package/dist/warning.d.ts +3 -3
- package/package.json +1 -1
package/dist/PortalWrapper.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ComputedRef, MaybeRefOrGetter } from 'vue';
|
|
2
|
-
import { VueNode } from '../type';
|
|
2
|
+
import { VueNode } from '../type.js';
|
|
3
3
|
export interface AllowClearConfig {
|
|
4
4
|
clearIcon?: VueNode;
|
|
5
5
|
/** Disable the clear entry without rendering a button or reserving space. */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useScopeIdAttrs(): Record<string, ''>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Comment, getCurrentInstance, isVNode } from "vue";
|
|
2
|
+
//#region src/hooks/useScopeId.ts
|
|
3
|
+
var DEV_ROOT_FRAGMENT = 2048;
|
|
4
|
+
function filterSingleRoot(children) {
|
|
5
|
+
if (!Array.isArray(children)) return;
|
|
6
|
+
let singleRoot;
|
|
7
|
+
for (const child of children) {
|
|
8
|
+
if (!isVNode(child)) return;
|
|
9
|
+
if (child.type !== Comment || child.children === "v-if") {
|
|
10
|
+
if (singleRoot) return;
|
|
11
|
+
singleRoot = child;
|
|
12
|
+
if (singleRoot.patchFlag > 0 && singleRoot.patchFlag & DEV_ROOT_FRAGMENT) return filterSingleRoot(singleRoot.children);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
return singleRoot;
|
|
16
|
+
}
|
|
17
|
+
function isParentRoot(parent, vnode) {
|
|
18
|
+
let subTree = parent.subTree;
|
|
19
|
+
if (!subTree) return false;
|
|
20
|
+
if (process.env.NODE_ENV !== "production" && subTree.patchFlag > 0 && subTree.patchFlag & DEV_ROOT_FRAGMENT) subTree = filterSingleRoot(subTree.children) || subTree;
|
|
21
|
+
return vnode === subTree || subTree.type.__isSuspense && (subTree.ssContent === vnode || subTree.ssFallback === vnode);
|
|
22
|
+
}
|
|
23
|
+
function useScopeIdAttrs() {
|
|
24
|
+
const scopeIds = /* @__PURE__ */ new Set();
|
|
25
|
+
let instance = getCurrentInstance();
|
|
26
|
+
while (instance) {
|
|
27
|
+
const vnode = instance.vnode;
|
|
28
|
+
if (vnode.scopeId) scopeIds.add(vnode.scopeId);
|
|
29
|
+
vnode.slotScopeIds?.forEach((scopeId) => scopeIds.add(scopeId));
|
|
30
|
+
const parent = instance.parent;
|
|
31
|
+
if (!parent || !isParentRoot(parent, vnode)) break;
|
|
32
|
+
instance = parent;
|
|
33
|
+
}
|
|
34
|
+
return Object.fromEntries([...scopeIds].map((scopeId) => [scopeId, ""]));
|
|
35
|
+
}
|
|
36
|
+
//#endregion
|
|
37
|
+
export { useScopeIdAttrs };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
export { default as classNames, clsx } from './classnames';
|
|
2
|
-
export { normalizeAllowClear, default as useAllowClear } from './hooks/useAllowClear';
|
|
3
|
-
export type { AllowClearConfig } from './hooks/useAllowClear';
|
|
4
|
-
export { useControlledState } from './hooks/useControlledState';
|
|
5
|
-
export { default as useId } from './hooks/useId';
|
|
6
|
-
export { default as useMergedState } from './hooks/useMergedState';
|
|
7
|
-
export { default as useMobile } from './hooks/useMobile';
|
|
8
|
-
export {
|
|
9
|
-
export {
|
|
10
|
-
export { default as
|
|
11
|
-
export { default as
|
|
12
|
-
export { default as
|
|
13
|
-
export
|
|
14
|
-
export {
|
|
15
|
-
export {
|
|
16
|
-
export { default as
|
|
1
|
+
export { default as classNames, clsx } from './classnames.js';
|
|
2
|
+
export { normalizeAllowClear, default as useAllowClear } from './hooks/useAllowClear.js';
|
|
3
|
+
export type { AllowClearConfig } from './hooks/useAllowClear.js';
|
|
4
|
+
export { useControlledState } from './hooks/useControlledState.js';
|
|
5
|
+
export { default as useId } from './hooks/useId.js';
|
|
6
|
+
export { default as useMergedState } from './hooks/useMergedState.js';
|
|
7
|
+
export { default as useMobile } from './hooks/useMobile.js';
|
|
8
|
+
export { useScopeIdAttrs } from './hooks/useScopeId.js';
|
|
9
|
+
export { isNonNullable, isVueRenderable } from './is.js';
|
|
10
|
+
export { default as KeyCode } from './KeyCode.js';
|
|
11
|
+
export { default as omit } from './omit.js';
|
|
12
|
+
export { default as raf } from './raf.js';
|
|
13
|
+
export { default as RenderComponent } from './RenderComponent.js';
|
|
14
|
+
export type { VueNode } from './type.js';
|
|
15
|
+
export { default as get } from './utils/get.js';
|
|
16
|
+
export { merge, mergeWith, default as set } from './utils/set.js';
|
|
17
|
+
export { default as warning } from './warning.js';
|
package/dist/index.js
CHANGED
|
@@ -8,8 +8,9 @@ import { useControlledState } from "./hooks/useControlledState.js";
|
|
|
8
8
|
import useId_default from "./hooks/useId.js";
|
|
9
9
|
import useMergedState from "./hooks/useMergedState.js";
|
|
10
10
|
import useMobile from "./hooks/useMobile.js";
|
|
11
|
+
import { useScopeIdAttrs } from "./hooks/useScopeId.js";
|
|
11
12
|
import { isNonNullable, isVueRenderable } from "./is.js";
|
|
12
13
|
import get from "./utils/get.js";
|
|
13
14
|
import set, { merge, mergeWith } from "./utils/set.js";
|
|
14
15
|
import warningOnce from "./warning.js";
|
|
15
|
-
export { KeyCode, RenderComponent_default as RenderComponent, classNames, clsx, get, isNonNullable, isVueRenderable, merge, mergeWith, normalizeAllowClear, omit, wrapperRaf as raf, set, useAllowClear, useControlledState, useId_default as useId, useMergedState, useMobile, warningOnce as warning };
|
|
16
|
+
export { KeyCode, RenderComponent_default as RenderComponent, classNames, clsx, get, isNonNullable, isVueRenderable, merge, mergeWith, normalizeAllowClear, omit, wrapperRaf as raf, set, useAllowClear, useControlledState, useId_default as useId, useMergedState, useMobile, useScopeIdAttrs, warningOnce as warning };
|
package/dist/vnode.d.ts
CHANGED
package/dist/warning.d.ts
CHANGED
|
@@ -10,9 +10,9 @@ export declare function resetWarned(): void;
|
|
|
10
10
|
export declare function call(method: (valid: boolean, message: string) => void, valid: boolean, message: string): void;
|
|
11
11
|
export declare function warningOnce(valid: boolean, message: string): void;
|
|
12
12
|
export declare namespace warningOnce {
|
|
13
|
-
var preMessage: typeof import("./warning").preMessage;
|
|
14
|
-
var resetWarned: typeof import("./warning").resetWarned;
|
|
15
|
-
var noteOnce: typeof import("./warning").noteOnce;
|
|
13
|
+
var preMessage: typeof import("./warning.js").preMessage;
|
|
14
|
+
var resetWarned: typeof import("./warning.js").resetWarned;
|
|
15
|
+
var noteOnce: typeof import("./warning.js").noteOnce;
|
|
16
16
|
}
|
|
17
17
|
export declare function noteOnce(valid: boolean, message: string): void;
|
|
18
18
|
export default warningOnce;
|