@v-c/util 1.1.0 → 1.2.1
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/Dom/shadow.d.ts +2 -2
- package/dist/Dom/shadow.js +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -1
- package/dist/is.d.ts +14 -0
- package/dist/is.js +21 -0
- package/package.json +6 -6
package/dist/Dom/shadow.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Check if is in shadowRoot
|
|
3
3
|
*/
|
|
4
|
-
export declare function inShadow(ele
|
|
4
|
+
export declare function inShadow(ele?: Node | null): boolean;
|
|
5
5
|
/**
|
|
6
6
|
* Return shadowRoot if possible
|
|
7
7
|
*/
|
|
8
|
-
export declare function getShadowRoot(ele
|
|
8
|
+
export declare function getShadowRoot(ele?: Node | null): ShadowRoot | null;
|
package/dist/Dom/shadow.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export { useControlledState } from './hooks/useControlledState';
|
|
|
3
3
|
export { default as useId } from './hooks/useId';
|
|
4
4
|
export { default as useMergedState } from './hooks/useMergedState';
|
|
5
5
|
export { default as KeyCode } from './KeyCode';
|
|
6
|
+
export { isNonNullable, isVueRenderable } from './is';
|
|
6
7
|
export { default as omit } from './omit';
|
|
7
8
|
export { default as raf } from './raf';
|
|
8
9
|
export { default as RenderComponent } from './RenderComponent';
|
package/dist/index.js
CHANGED
|
@@ -6,7 +6,8 @@ import classNames, { clsx } from "./classnames.js";
|
|
|
6
6
|
import { useControlledState } from "./hooks/useControlledState.js";
|
|
7
7
|
import useId_default from "./hooks/useId.js";
|
|
8
8
|
import useMergedState from "./hooks/useMergedState.js";
|
|
9
|
+
import { isNonNullable, isVueRenderable } from "./is.js";
|
|
9
10
|
import get from "./utils/get.js";
|
|
10
11
|
import set, { merge, mergeWith } from "./utils/set.js";
|
|
11
12
|
import warningOnce from "./warning.js";
|
|
12
|
-
export { KeyCode, RenderComponent_default as RenderComponent, classNames, clsx, get, merge, mergeWith, omit, wrapperRaf as raf, set, useControlledState, useId_default as useId, useMergedState, warningOnce as warning };
|
|
13
|
+
export { KeyCode, RenderComponent_default as RenderComponent, classNames, clsx, get, isNonNullable, isVueRenderable, merge, mergeWith, omit, wrapperRaf as raf, set, useControlledState, useId_default as useId, useMergedState, warningOnce as warning };
|
package/dist/is.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Check if a value is neither `null` nor `undefined`.
|
|
3
|
+
*/
|
|
4
|
+
export declare function isNonNullable<T>(value: T): value is NonNullable<T>;
|
|
5
|
+
/**
|
|
6
|
+
* Check whether a value should be treated as renderable content.
|
|
7
|
+
*
|
|
8
|
+
* Returns `false` only for `null`, `undefined`, `false`, and `''`; all other
|
|
9
|
+
* values, including `0` and `true`, are treated as renderable.
|
|
10
|
+
*
|
|
11
|
+
* This is a compatibility-oriented presence check, not a complete Vue node
|
|
12
|
+
* validator.
|
|
13
|
+
*/
|
|
14
|
+
export declare function isVueRenderable<T>(value: T): value is Exclude<NonNullable<T>, false | ''>;
|
package/dist/is.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
//#region src/is.ts
|
|
2
|
+
/**
|
|
3
|
+
* Check if a value is neither `null` nor `undefined`.
|
|
4
|
+
*/
|
|
5
|
+
function isNonNullable(value) {
|
|
6
|
+
return value !== void 0 && value !== null;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Check whether a value should be treated as renderable content.
|
|
10
|
+
*
|
|
11
|
+
* Returns `false` only for `null`, `undefined`, `false`, and `''`; all other
|
|
12
|
+
* values, including `0` and `true`, are treated as renderable.
|
|
13
|
+
*
|
|
14
|
+
* This is a compatibility-oriented presence check, not a complete Vue node
|
|
15
|
+
* validator.
|
|
16
|
+
*/
|
|
17
|
+
function isVueRenderable(value) {
|
|
18
|
+
return isNonNullable(value) && value !== false && value !== "";
|
|
19
|
+
}
|
|
20
|
+
//#endregion
|
|
21
|
+
export { isNonNullable, isVueRenderable };
|
package/package.json
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@v-c/util",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.1
|
|
4
|
+
"version": "1.2.1",
|
|
5
5
|
"description": "Vue3 components utils",
|
|
6
|
+
"author": {
|
|
7
|
+
"name": "aibayanyu20",
|
|
8
|
+
"email": "aibayanyu@qq.com",
|
|
9
|
+
"url": "https://yanyu.me"
|
|
10
|
+
},
|
|
6
11
|
"license": "MIT",
|
|
7
12
|
"homepage": "https://github.com/antdv-next/vue-components/tree/next/packages/util",
|
|
8
13
|
"repository": {
|
|
@@ -12,11 +17,6 @@
|
|
|
12
17
|
"publishConfig": {
|
|
13
18
|
"access": "public"
|
|
14
19
|
},
|
|
15
|
-
"author": {
|
|
16
|
-
"name": "aibayanyu20",
|
|
17
|
-
"email": "aibayanyu@qq.com",
|
|
18
|
-
"url": "https://yanyu.me"
|
|
19
|
-
},
|
|
20
20
|
"exports": {
|
|
21
21
|
".": {
|
|
22
22
|
"types": "./dist/index.d.ts",
|