@sheinx/hooks 3.5.0-beta.1 → 3.5.0-beta.10
Sign up to get free protection for your applications and to get access to all the features.
- package/cjs/common/use-in-view/index.d.ts +2 -0
- package/cjs/common/use-in-view/index.d.ts.map +1 -0
- package/cjs/common/use-in-view/index.js +14 -0
- package/cjs/common/use-in-view/use-in-view.d.ts +14 -0
- package/cjs/common/use-in-view/use-in-view.d.ts.map +1 -0
- package/cjs/common/use-in-view/use-in-view.js +73 -0
- package/cjs/common/use-position-style/check-position.d.ts +11 -0
- package/cjs/common/use-position-style/check-position.d.ts.map +1 -0
- package/cjs/common/use-position-style/check-position.js +90 -0
- package/cjs/common/use-position-style/index.d.ts.map +1 -1
- package/cjs/common/use-position-style/index.js +15 -21
- package/cjs/components/use-form/index.d.ts +1 -0
- package/cjs/components/use-form/index.d.ts.map +1 -1
- package/cjs/components/use-form/index.js +12 -0
- package/cjs/components/use-form/use-form-context.d.ts +6 -0
- package/cjs/components/use-form/use-form-context.d.ts.map +1 -0
- package/cjs/components/use-form/use-form-context.js +22 -0
- package/cjs/components/use-form/use-form-context.type.d.ts +45 -0
- package/cjs/components/use-form/use-form-context.type.d.ts.map +1 -0
- package/cjs/components/use-form/use-form-context.type.js +5 -0
- package/cjs/components/use-form/use-form-control/use-form-control.d.ts.map +1 -1
- package/cjs/components/use-form/use-form-control/use-form-control.js +30 -11
- package/cjs/components/use-form/use-form.d.ts.map +1 -1
- package/cjs/components/use-form/use-form.js +4 -2
- package/cjs/components/use-form/use-form.type.d.ts +7 -0
- package/cjs/components/use-form/use-form.type.d.ts.map +1 -1
- package/cjs/components/use-image/use-image.d.ts.map +1 -1
- package/cjs/components/use-image/use-image.js +7 -0
- package/cjs/components/use-image/use-image.type.d.ts +7 -0
- package/cjs/components/use-image/use-image.type.d.ts.map +1 -1
- package/cjs/components/use-input/use-input-format.d.ts +1 -1
- package/cjs/components/use-input/use-input-number.d.ts +1 -1
- package/cjs/components/use-input/use-input-number.d.ts.map +1 -1
- package/cjs/components/use-input/use-input-number.js +5 -0
- package/cjs/components/use-table/use-table-group.d.ts.map +1 -1
- package/cjs/components/use-table/use-table-group.js +2 -1
- package/cjs/components/use-table/use-table-layout.d.ts.map +1 -1
- package/cjs/components/use-table/use-table-layout.js +2 -1
- package/cjs/components/use-table/use-table.type.d.ts +26 -0
- package/cjs/components/use-table/use-table.type.d.ts.map +1 -1
- package/cjs/index.d.ts +1 -0
- package/cjs/index.d.ts.map +1 -1
- package/cjs/index.js +12 -0
- package/cjs/utils/dom/document.d.ts +2 -0
- package/cjs/utils/dom/document.d.ts.map +1 -0
- package/cjs/utils/dom/document.js +49 -0
- package/cjs/utils/dom/element.d.ts +1 -1
- package/cjs/utils/dom/element.d.ts.map +1 -1
- package/cjs/utils/dom/index.d.ts +1 -0
- package/cjs/utils/dom/index.d.ts.map +1 -1
- package/cjs/utils/dom/index.js +12 -0
- package/cjs/utils/is.d.ts +0 -1
- package/cjs/utils/is.d.ts.map +1 -1
- package/cjs/utils/is.js +1 -10
- package/cjs/utils/lazyload.d.ts +1 -0
- package/cjs/utils/lazyload.d.ts.map +1 -1
- package/cjs/utils/lazyload.js +3 -0
- package/esm/common/use-in-view/index.d.ts +2 -0
- package/esm/common/use-in-view/index.d.ts.map +1 -0
- package/esm/common/use-in-view/index.js +2 -0
- package/esm/common/use-in-view/use-in-view.d.ts +14 -0
- package/esm/common/use-in-view/use-in-view.d.ts.map +1 -0
- package/esm/common/use-in-view/use-in-view.js +70 -0
- package/esm/common/use-position-style/check-position.d.ts +11 -0
- package/esm/common/use-position-style/check-position.d.ts.map +1 -0
- package/esm/common/use-position-style/check-position.js +84 -0
- package/esm/common/use-position-style/index.d.ts.map +1 -1
- package/esm/common/use-position-style/index.js +17 -22
- package/esm/components/use-form/index.d.ts +1 -0
- package/esm/components/use-form/index.d.ts.map +1 -1
- package/esm/components/use-form/index.js +1 -0
- package/esm/components/use-form/use-form-context.d.ts +6 -0
- package/esm/components/use-form/use-form-context.d.ts.map +1 -0
- package/esm/components/use-form/use-form-context.js +13 -0
- package/esm/components/use-form/use-form-context.type.d.ts +45 -0
- package/esm/components/use-form/use-form-context.type.d.ts.map +1 -0
- package/esm/components/use-form/use-form-context.type.js +1 -0
- package/esm/components/use-form/use-form-control/use-form-control.d.ts.map +1 -1
- package/esm/components/use-form/use-form-control/use-form-control.js +30 -11
- package/esm/components/use-form/use-form.d.ts.map +1 -1
- package/esm/components/use-form/use-form.js +4 -2
- package/esm/components/use-form/use-form.type.d.ts +7 -0
- package/esm/components/use-form/use-form.type.d.ts.map +1 -1
- package/esm/components/use-image/use-image.d.ts.map +1 -1
- package/esm/components/use-image/use-image.js +7 -0
- package/esm/components/use-image/use-image.type.d.ts +7 -0
- package/esm/components/use-image/use-image.type.d.ts.map +1 -1
- package/esm/components/use-input/use-input-format.d.ts +1 -1
- package/esm/components/use-input/use-input-number.d.ts +1 -1
- package/esm/components/use-input/use-input-number.d.ts.map +1 -1
- package/esm/components/use-input/use-input-number.js +5 -0
- package/esm/components/use-table/use-table-group.d.ts.map +1 -1
- package/esm/components/use-table/use-table-group.js +3 -2
- package/esm/components/use-table/use-table-layout.d.ts.map +1 -1
- package/esm/components/use-table/use-table-layout.js +2 -1
- package/esm/components/use-table/use-table.type.d.ts +26 -0
- package/esm/components/use-table/use-table.type.d.ts.map +1 -1
- package/esm/index.d.ts +1 -0
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +1 -0
- package/esm/utils/dom/document.d.ts +2 -0
- package/esm/utils/dom/document.d.ts.map +1 -0
- package/esm/utils/dom/document.js +43 -0
- package/esm/utils/dom/element.d.ts +1 -1
- package/esm/utils/dom/element.d.ts.map +1 -1
- package/esm/utils/dom/index.d.ts +1 -0
- package/esm/utils/dom/index.d.ts.map +1 -1
- package/esm/utils/dom/index.js +1 -0
- package/esm/utils/is.d.ts +0 -1
- package/esm/utils/is.d.ts.map +1 -1
- package/esm/utils/is.js +0 -9
- package/esm/utils/lazyload.d.ts +1 -0
- package/esm/utils/lazyload.d.ts.map +1 -1
- package/esm/utils/lazyload.js +3 -0
- package/package.json +1 -1
@@ -12,7 +12,7 @@ export declare const addResizeObserver: (el: HTMLElement, handler: any, options?
|
|
12
12
|
timer?: number | undefined;
|
13
13
|
}) => () => void;
|
14
14
|
export declare function getParent(el: HTMLElement | null | Element, target?: string | HTMLElement): Element | null;
|
15
|
-
export declare function getClosestScrollContainer(element: HTMLElement | null):
|
15
|
+
export declare function getClosestScrollContainer(element: HTMLElement | null): HTMLElement | null;
|
16
16
|
export declare function cssSupport(attr: keyof CSSStyleDeclaration, value: string): boolean;
|
17
17
|
export declare const parsePxToNumber: (str: string) => number;
|
18
18
|
//# sourceMappingURL=element.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"element.d.ts","sourceRoot":"","sources":["element.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAa1B;;;;;;GAMG;AACH,wBAAgB,QAAQ,CACtB,QAAQ,EAAE,KAAK,CAAC,SAAS,EACzB,WAAW,UAAQ,EACnB,SAAS,CAAC,EAAE,MAAM,GACjB,KAAK,CAAC,SAAS,CASjB;AAGD,eAAO,MAAM,iBAAiB,OACxB,WAAW,WACN,GAAG;;;gBA4Cb,CAAC;AAEF,wBAAgB,SAAS,CAAC,EAAE,EAAE,WAAW,GAAG,IAAI,GAAG,OAAO,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,WAAW,kBAmBxF;AAED,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,
|
1
|
+
{"version":3,"file":"element.d.ts","sourceRoot":"","sources":["element.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAa1B;;;;;;GAMG;AACH,wBAAgB,QAAQ,CACtB,QAAQ,EAAE,KAAK,CAAC,SAAS,EACzB,WAAW,UAAQ,EACnB,SAAS,CAAC,EAAE,MAAM,GACjB,KAAK,CAAC,SAAS,CASjB;AAGD,eAAO,MAAM,iBAAiB,OACxB,WAAW,WACN,GAAG;;;gBA4Cb,CAAC;AAEF,wBAAgB,SAAS,CAAC,EAAE,EAAE,WAAW,GAAG,IAAI,GAAG,OAAO,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,WAAW,kBAmBxF;AAED,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,GAAG,WAAW,GAAG,IAAI,CA+BzF;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,mBAAmB,EAAE,KAAK,EAAE,MAAM,WAYxE;AAED,eAAO,MAAM,eAAe,QAAS,MAAM,WAAwC,CAAC"}
|
package/esm/utils/dom/index.d.ts
CHANGED
@@ -3,6 +3,7 @@ export { parsePxToNumber, addResizeObserver } from './element';
|
|
3
3
|
export type { OldWheelEvent } from './normalize-wheel.type';
|
4
4
|
export * from './ready';
|
5
5
|
export * from './element';
|
6
|
+
export * from './document';
|
6
7
|
export { default as ResponsiveObserve } from './responsiveObserve';
|
7
8
|
export type { Breakpoint, ScreenMap } from './responsiveObserve.type';
|
8
9
|
//# sourceMappingURL=index.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACvE,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAC/D,YAAY,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC5D,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACvE,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAC/D,YAAY,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC5D,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAE3B,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACnE,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC"}
|
package/esm/utils/dom/index.js
CHANGED
@@ -2,4 +2,5 @@ export { default, default as NormalizeWheel } from "./normalize-wheel";
|
|
2
2
|
export { parsePxToNumber, addResizeObserver } from "./element";
|
3
3
|
export * from "./ready";
|
4
4
|
export * from "./element";
|
5
|
+
export * from "./document";
|
5
6
|
export { default as ResponsiveObserve } from "./responsiveObserve";
|
package/esm/utils/is.d.ts
CHANGED
@@ -24,6 +24,5 @@ export declare const isLink: (el: unknown) => el is React.ReactElement<any, stri
|
|
24
24
|
export declare function isNamedComponent(type: any): type is React.ForwardRefExoticComponent<unknown>;
|
25
25
|
export declare const isMacOS: () => boolean;
|
26
26
|
export declare const isFirefox: () => boolean;
|
27
|
-
export declare const isChromeLowerThan: (version: number) => boolean;
|
28
27
|
export declare function isDomElement(element: any): element is HTMLElement;
|
29
28
|
//# sourceMappingURL=is.d.ts.map
|
package/esm/utils/is.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"is.d.ts","sourceRoot":"","sources":["is.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,yCAAyC,CAAC;AACxE,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,wBAAgB,SAAS,YAExB;AASD,eAAO,MAAM,OAAO,4BAAgB,CAAC;AACrC,eAAO,MAAM,QAAQ,QAAS,OAAO,sBACc,CAAC;AACpD,eAAO,MAAM,MAAM,QAAS,OAAO,gBAAqC,CAAC;AACzE,eAAO,MAAM,SAAS,QAAS,OAAO,mBAA2C,CAAC;AACl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,IAAI,WAAW,CAQjE"}
|
package/esm/utils/is.js
CHANGED
@@ -95,15 +95,6 @@ export var isFirefox = function isFirefox() {
|
|
95
95
|
if (!isBrowser()) return false;
|
96
96
|
return navigator.userAgent.toLowerCase().indexOf('firefox') > -1;
|
97
97
|
};
|
98
|
-
export var isChromeLowerThan = function isChromeLowerThan(version) {
|
99
|
-
// 服务器端渲染时,不执行版本检查
|
100
|
-
if (typeof window === 'undefined' || typeof navigator === 'undefined') {
|
101
|
-
return false;
|
102
|
-
}
|
103
|
-
var ua = navigator.userAgent;
|
104
|
-
var chrome = ua.match(/chrome\/(\d+)/i);
|
105
|
-
return Boolean(chrome && chrome[1] && parseInt(chrome[1], 10) < version);
|
106
|
-
};
|
107
98
|
export function isDomElement(element) {
|
108
99
|
return (typeof HTMLElement === "undefined" ? "undefined" : _typeof(HTMLElement)) === 'object' ? element instanceof HTMLElement // DOM2
|
109
100
|
: element && _typeof(element) === 'object' && element !== null && element.nodeType === 1 && typeof element.nodeName === 'string';
|
package/esm/utils/lazyload.d.ts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"lazyload.d.ts","sourceRoot":"","sources":["lazyload.ts"],"names":[],"mappings":"AAIA,KAAK,UAAU,GAAG;IAChB,SAAS,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IAC3B,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,oBAAoB,CAAC;CACjC,CAAC;AAoBF,wBAAgB,QAAQ,SAgBvB;AAWD,wBAAgB,WAAW,CAAC,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,EAAE,cAAc,CAAC,EAAE,OAAO,QAUvE;
|
1
|
+
{"version":3,"file":"lazyload.d.ts","sourceRoot":"","sources":["lazyload.ts"],"names":[],"mappings":"AAIA,KAAK,UAAU,GAAG;IAChB,SAAS,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IAC3B,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,oBAAoB,CAAC;CACjC,CAAC;AAoBF,wBAAgB,QAAQ,SAgBvB;AAWD,wBAAgB,WAAW,CAAC,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,EAAE,cAAc,CAAC,EAAE,OAAO,QAUvE;AAwBD,wBAAgB,QAAQ,CAAC,GAAG,EAAE,UAAU,iBA4BvC"}
|
package/esm/utils/lazyload.js
CHANGED
@@ -60,12 +60,15 @@ function getObserver(obj, id) {
|
|
60
60
|
container = _obj$container === void 0 ? null : _obj$container,
|
61
61
|
offset = obj.offset,
|
62
62
|
render = obj.render,
|
63
|
+
offscreen = obj.offscreen,
|
63
64
|
noRemove = obj.noRemove;
|
64
65
|
var observer = new IntersectionObserver(function (entries) {
|
65
66
|
entries.forEach(function (en) {
|
66
67
|
if (en.isIntersecting || en.intersectionRatio > 0) {
|
67
68
|
render();
|
68
69
|
if (!noRemove) removeStack(id);
|
70
|
+
} else {
|
71
|
+
offscreen && offscreen();
|
69
72
|
}
|
70
73
|
});
|
71
74
|
}, {
|