piral-core 0.14.3 → 0.14.5-beta.3331
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/esm/actions/app.js +3 -5
- package/esm/actions/app.js.map +1 -1
- package/esm/actions/components.js +5 -5
- package/esm/actions/components.js.map +1 -1
- package/esm/utils/extension.d.ts +3 -0
- package/esm/utils/extension.js +5 -0
- package/esm/utils/extension.js.map +1 -0
- package/esm/utils/index.d.ts +2 -0
- package/esm/utils/index.js +2 -0
- package/esm/utils/index.js.map +1 -1
- package/esm/utils/state.d.ts +55 -0
- package/esm/utils/state.js +83 -0
- package/esm/utils/state.js.map +1 -0
- package/lib/actions/app.js +2 -4
- package/lib/actions/app.js.map +1 -1
- package/lib/actions/components.js +4 -4
- package/lib/actions/components.js.map +1 -1
- package/lib/utils/extension.d.ts +3 -0
- package/lib/utils/extension.js +9 -0
- package/lib/utils/extension.js.map +1 -0
- package/lib/utils/index.d.ts +2 -0
- package/lib/utils/index.js +2 -0
- package/lib/utils/index.js.map +1 -1
- package/lib/utils/state.d.ts +55 -0
- package/lib/utils/state.js +94 -0
- package/lib/utils/state.js.map +1 -0
- package/package.json +5 -4
- package/src/actions/app.ts +3 -11
- package/src/actions/components.ts +5 -33
- package/src/utils/extension.test.tsx +12 -0
- package/src/utils/extension.tsx +6 -0
- package/src/utils/index.ts +2 -0
- package/src/utils/state.ts +128 -0
- package/esm/hooks/debounce.d.ts +0 -8
- package/esm/hooks/debounce.js +0 -18
- package/esm/hooks/debounce.js.map +0 -1
- package/esm/hooks/lockBodyScroll.d.ts +0 -6
- package/esm/hooks/lockBodyScroll.js +0 -15
- package/esm/hooks/lockBodyScroll.js.map +0 -1
- package/esm/hooks/onClickOutside.d.ts +0 -11
- package/esm/hooks/onClickOutside.js +0 -23
- package/esm/hooks/onClickOutside.js.map +0 -1
- package/esm/hooks/onScreenVisible.d.ts +0 -11
- package/esm/hooks/onScreenVisible.js +0 -28
- package/esm/hooks/onScreenVisible.js.map +0 -1
- package/esm/hooks/promise.d.ts +0 -13
- package/esm/hooks/promise.js +0 -21
- package/esm/hooks/promise.js.map +0 -1
- package/esm/utils/events.d.ts +0 -3
- package/esm/utils/events.js +0 -35
- package/esm/utils/events.js.map +0 -1
- package/lib/hooks/debounce.d.ts +0 -8
- package/lib/hooks/debounce.js +0 -22
- package/lib/hooks/debounce.js.map +0 -1
- package/lib/hooks/lockBodyScroll.d.ts +0 -6
- package/lib/hooks/lockBodyScroll.js +0 -19
- package/lib/hooks/lockBodyScroll.js.map +0 -1
- package/lib/hooks/onClickOutside.d.ts +0 -8
- package/lib/hooks/onClickOutside.js +0 -27
- package/lib/hooks/onClickOutside.js.map +0 -1
- package/lib/hooks/onScreenVisible.d.ts +0 -11
- package/lib/hooks/onScreenVisible.js +0 -32
- package/lib/hooks/onScreenVisible.js.map +0 -1
- package/lib/hooks/promise.d.ts +0 -13
- package/lib/hooks/promise.js +0 -25
- package/lib/hooks/promise.js.map +0 -1
- package/lib/utils/events.d.ts +0 -3
- package/lib/utils/events.js +0 -39
- package/lib/utils/events.js.map +0 -1
|
@@ -1,46 +1,18 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { withExtension, withoutExtension, withoutPage, withPage } from '../utils';
|
|
2
2
|
import { PageRegistration, ExtensionRegistration, GlobalStateContext } from '../types';
|
|
3
3
|
|
|
4
4
|
export function registerPage(ctx: GlobalStateContext, name: string, value: PageRegistration) {
|
|
5
|
-
ctx.dispatch((
|
|
6
|
-
...state,
|
|
7
|
-
registry: {
|
|
8
|
-
...state.registry,
|
|
9
|
-
pages: withKey(state.registry.pages, name, value),
|
|
10
|
-
},
|
|
11
|
-
}));
|
|
5
|
+
ctx.dispatch(withPage(name, value));
|
|
12
6
|
}
|
|
13
7
|
|
|
14
8
|
export function unregisterPage(ctx: GlobalStateContext, name: string) {
|
|
15
|
-
ctx.dispatch((
|
|
16
|
-
...state,
|
|
17
|
-
registry: {
|
|
18
|
-
...state.registry,
|
|
19
|
-
pages: withoutKey(state.registry.pages, name),
|
|
20
|
-
},
|
|
21
|
-
}));
|
|
9
|
+
ctx.dispatch(withoutPage(name));
|
|
22
10
|
}
|
|
23
11
|
|
|
24
12
|
export function registerExtension(ctx: GlobalStateContext, name: string, value: ExtensionRegistration) {
|
|
25
|
-
ctx.dispatch((
|
|
26
|
-
...state,
|
|
27
|
-
registry: {
|
|
28
|
-
...state.registry,
|
|
29
|
-
extensions: withKey(state.registry.extensions, name, appendItem(state.registry.extensions[name], value)),
|
|
30
|
-
},
|
|
31
|
-
}));
|
|
13
|
+
ctx.dispatch(withExtension(name, value));
|
|
32
14
|
}
|
|
33
15
|
|
|
34
16
|
export function unregisterExtension(ctx: GlobalStateContext, name: string, reference: any) {
|
|
35
|
-
ctx.dispatch((
|
|
36
|
-
...state,
|
|
37
|
-
registry: {
|
|
38
|
-
...state.registry,
|
|
39
|
-
extensions: withKey(
|
|
40
|
-
state.registry.extensions,
|
|
41
|
-
name,
|
|
42
|
-
excludeOn(state.registry.extensions[name], (m) => m.reference === reference),
|
|
43
|
-
),
|
|
44
|
-
},
|
|
45
|
-
}));
|
|
17
|
+
ctx.dispatch(withoutExtension(name, reference));
|
|
46
18
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { mount } from 'enzyme';
|
|
3
|
+
import { toExtension } from './extension';
|
|
4
|
+
|
|
5
|
+
describe('Util Extension.', () => {
|
|
6
|
+
it('Convert some component to an extension component.', () => {
|
|
7
|
+
const Component = (props) => <b>{props.title}</b>;
|
|
8
|
+
const Extension = toExtension(Component);
|
|
9
|
+
const node = mount(<Extension piral={undefined} params={{ title: 'Foo' }} />);
|
|
10
|
+
expect(node.find('b').length).toBe(1);
|
|
11
|
+
});
|
|
12
|
+
});
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ExtensionComponentProps, WrappedComponent } from '../types';
|
|
3
|
+
|
|
4
|
+
export function toExtension<T>(Component: React.ComponentType<T>): WrappedComponent<ExtensionComponentProps<T>> {
|
|
5
|
+
return (props) => <Component {...props.params} />;
|
|
6
|
+
}
|
package/src/utils/index.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
export * from './compare';
|
|
2
2
|
export * from './data';
|
|
3
|
+
export * from './extension';
|
|
3
4
|
export * from './foreign';
|
|
4
5
|
export * from './guid';
|
|
5
6
|
export * from './helpers';
|
|
6
7
|
export * from './media';
|
|
7
8
|
export * from './react';
|
|
9
|
+
export * from './state';
|
|
8
10
|
export * from './storage';
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { cloneElement, ComponentType, createElement } from 'react';
|
|
2
|
+
import { RouteComponentProps } from 'react-router';
|
|
3
|
+
import { toExtension } from './extension';
|
|
4
|
+
import { withKey, withoutKey, appendItem, excludeOn } from './helpers';
|
|
5
|
+
import { GlobalState, PageRegistration, ExtensionRegistration } from '../types';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Returns a dispatcher that includes all mentioned dispatchers.
|
|
9
|
+
* @param dispatchers The dispatchers to include.
|
|
10
|
+
*/
|
|
11
|
+
export function withAll(...dispatchers: Array<(state: GlobalState) => GlobalState>) {
|
|
12
|
+
return (state: GlobalState): GlobalState => {
|
|
13
|
+
for (const dispatcher of dispatchers) {
|
|
14
|
+
state = dispatcher(state);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
return state;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Returns a dispatcher that adds a page registration.
|
|
23
|
+
* @param name The path of the page to register.
|
|
24
|
+
* @param value The value of the page to register.
|
|
25
|
+
* @returns The dispatcher.
|
|
26
|
+
*/
|
|
27
|
+
export function withPage(name: string, value: PageRegistration) {
|
|
28
|
+
return (state: GlobalState): GlobalState => ({
|
|
29
|
+
...state,
|
|
30
|
+
registry: {
|
|
31
|
+
...state.registry,
|
|
32
|
+
pages: withKey(state.registry.pages, name, value),
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Returns a dispatcher that removes a page registration.
|
|
39
|
+
* @param name The path of the page to unregister.
|
|
40
|
+
* @returns The dispatcher.
|
|
41
|
+
*/
|
|
42
|
+
export function withoutPage(name: string) {
|
|
43
|
+
return (state: GlobalState): GlobalState => ({
|
|
44
|
+
...state,
|
|
45
|
+
registry: {
|
|
46
|
+
...state.registry,
|
|
47
|
+
pages: withoutKey(state.registry.pages, name),
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Returns a dispatcher that adds an extension registration.
|
|
54
|
+
* @param name The name of the extension to register.
|
|
55
|
+
* @param value The value of the extension to register.
|
|
56
|
+
* @returns The dispatcher.
|
|
57
|
+
*/
|
|
58
|
+
export function withExtension(name: string, value: ExtensionRegistration) {
|
|
59
|
+
return (state: GlobalState): GlobalState => ({
|
|
60
|
+
...state,
|
|
61
|
+
registry: {
|
|
62
|
+
...state.registry,
|
|
63
|
+
extensions: withKey(state.registry.extensions, name, appendItem(state.registry.extensions[name], value)),
|
|
64
|
+
},
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Returns a dispatcher that removes an extension registration.
|
|
70
|
+
* @param name The name of the extension to unregister.
|
|
71
|
+
* @param reference The reference for the extension.
|
|
72
|
+
* @returns The dispatcher.
|
|
73
|
+
*/
|
|
74
|
+
export function withoutExtension(name: string, reference: any) {
|
|
75
|
+
return (state: GlobalState): GlobalState => ({
|
|
76
|
+
...state,
|
|
77
|
+
registry: {
|
|
78
|
+
...state.registry,
|
|
79
|
+
extensions: withKey(
|
|
80
|
+
state.registry.extensions,
|
|
81
|
+
name,
|
|
82
|
+
excludeOn(state.registry.extensions[name], (m) => m.reference === reference),
|
|
83
|
+
),
|
|
84
|
+
},
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Returns a dispatcher that adds an extension registration from the root (no Pilet API).
|
|
90
|
+
* @param name The name of the extension to register.
|
|
91
|
+
* @param component The extension's component to use.
|
|
92
|
+
* @returns The dispatcher.
|
|
93
|
+
*/
|
|
94
|
+
export function withRootExtension<T>(name: string, component: ComponentType<T>) {
|
|
95
|
+
return withExtension(name, {
|
|
96
|
+
component: toExtension(component),
|
|
97
|
+
defaults: {},
|
|
98
|
+
pilet: '',
|
|
99
|
+
reference: component,
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Returns a dispatcher that adds another provider.
|
|
105
|
+
* @param provider The provider to include.
|
|
106
|
+
* @returns The dispatcher.
|
|
107
|
+
*/
|
|
108
|
+
export function withProvider(provider: JSX.Element) {
|
|
109
|
+
const wrapper: React.FC = (props) => cloneElement(provider, props);
|
|
110
|
+
|
|
111
|
+
return (state: GlobalState): GlobalState => ({
|
|
112
|
+
...state,
|
|
113
|
+
provider: !state.provider ? wrapper : (props) => createElement(state.provider, undefined, wrapper(props)),
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Returns a dispatcher that registers another route.
|
|
119
|
+
* @param path The path of the route to register.
|
|
120
|
+
* @param component The component representing the route.
|
|
121
|
+
* @returns The dispatcher.
|
|
122
|
+
*/
|
|
123
|
+
export function withRoute<T>(path: string, component: ComponentType<RouteComponentProps<T>>) {
|
|
124
|
+
return (state: GlobalState): GlobalState => ({
|
|
125
|
+
...state,
|
|
126
|
+
routes: withKey(state.routes, path, component),
|
|
127
|
+
});
|
|
128
|
+
}
|
package/esm/hooks/debounce.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Hook that returns the debounced (i.e., delayed) value.
|
|
3
|
-
* Useful when user input should not fire immediately, but rather
|
|
4
|
-
* only after a certain timespan without any changes passed.
|
|
5
|
-
* @param value The value to consider.
|
|
6
|
-
* @param delay The timespan to pass before applying the value.
|
|
7
|
-
*/
|
|
8
|
-
export declare function useDebounce<T>(value: T, delay?: number): T;
|
package/esm/hooks/debounce.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { useState, useEffect } from 'react';
|
|
2
|
-
/**
|
|
3
|
-
* Hook that returns the debounced (i.e., delayed) value.
|
|
4
|
-
* Useful when user input should not fire immediately, but rather
|
|
5
|
-
* only after a certain timespan without any changes passed.
|
|
6
|
-
* @param value The value to consider.
|
|
7
|
-
* @param delay The timespan to pass before applying the value.
|
|
8
|
-
*/
|
|
9
|
-
export function useDebounce(value, delay) {
|
|
10
|
-
if (delay === void 0) { delay = 300; }
|
|
11
|
-
var _a = useState(value), debouncedValue = _a[0], setDebouncedValue = _a[1];
|
|
12
|
-
useEffect(function () {
|
|
13
|
-
var handler = setTimeout(function () { return setDebouncedValue(value); }, delay);
|
|
14
|
-
return function () { return clearTimeout(handler); };
|
|
15
|
-
}, [value, delay]);
|
|
16
|
-
return debouncedValue;
|
|
17
|
-
}
|
|
18
|
-
//# sourceMappingURL=debounce.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"debounce.js","sourceRoot":"","sources":["../../src/hooks/debounce.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAE5C;;;;;;GAMG;AACH,MAAM,UAAU,WAAW,CAAI,KAAQ,EAAE,KAAW;IAAX,sBAAA,EAAA,WAAW;IAC5C,IAAA,KAAsC,QAAQ,CAAC,KAAK,CAAC,EAApD,cAAc,QAAA,EAAE,iBAAiB,QAAmB,CAAC;IAE5D,SAAS,CAAC;QACR,IAAM,OAAO,GAAG,UAAU,CAAC,cAAM,OAAA,iBAAiB,CAAC,KAAK,CAAC,EAAxB,CAAwB,EAAE,KAAK,CAAC,CAAC;QAClE,OAAO,cAAM,OAAA,YAAY,CAAC,OAAO,CAAC,EAArB,CAAqB,CAAC;IACrC,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;IAEnB,OAAO,cAAc,CAAC;AACxB,CAAC"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { useLayoutEffect } from 'react';
|
|
2
|
-
/**
|
|
3
|
-
* Hook that locks scrolling on the main document.
|
|
4
|
-
* Useful for preventing the standard scrolling in context of
|
|
5
|
-
* a modal dialog.
|
|
6
|
-
*/
|
|
7
|
-
export function useLockBodyScroll() {
|
|
8
|
-
useLayoutEffect(function () {
|
|
9
|
-
document.body.style.overflow = 'hidden';
|
|
10
|
-
return function () {
|
|
11
|
-
document.body.style.overflow = 'visible';
|
|
12
|
-
};
|
|
13
|
-
}, []);
|
|
14
|
-
}
|
|
15
|
-
//# sourceMappingURL=lockBodyScroll.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"lockBodyScroll.js","sourceRoot":"","sources":["../../src/hooks/lockBodyScroll.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,OAAO,CAAC;AAExC;;;;GAIG;AACH,MAAM,UAAU,iBAAiB;IAC/B,eAAe,CAAC;QACd,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACxC,OAAO;YACL,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,GAAG,SAAS,CAAC;QAC3C,CAAC,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;AACT,CAAC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { RefObject } from 'react';
|
|
2
|
-
/**
|
|
3
|
-
* Hook that detects if a click outside the given reference
|
|
4
|
-
* has been performed.
|
|
5
|
-
* @param ref The reference to the element.
|
|
6
|
-
* @param handler The callback to invoke when an outside click happened.
|
|
7
|
-
*/
|
|
8
|
-
export declare function useOnClickOutside<T extends HTMLElement>(
|
|
9
|
-
ref: RefObject<T>,
|
|
10
|
-
handler: (event: MouseEvent) => void,
|
|
11
|
-
): void;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { useEffect } from 'react';
|
|
2
|
-
/**
|
|
3
|
-
* Hook that detects if a click outside the given reference
|
|
4
|
-
* has been performed.
|
|
5
|
-
* @param ref The reference to the element.
|
|
6
|
-
* @param handler The callback to invoke when an outside click happened.
|
|
7
|
-
*/
|
|
8
|
-
export function useOnClickOutside(ref, handler) {
|
|
9
|
-
useEffect(function () {
|
|
10
|
-
var listener = function (event) {
|
|
11
|
-
if (ref.current && !ref.current.contains(event.target)) {
|
|
12
|
-
handler(event);
|
|
13
|
-
}
|
|
14
|
-
};
|
|
15
|
-
document.addEventListener('mousedown', listener);
|
|
16
|
-
document.addEventListener('touchstart', listener);
|
|
17
|
-
return function () {
|
|
18
|
-
document.removeEventListener('mousedown', listener);
|
|
19
|
-
document.removeEventListener('touchstart', listener);
|
|
20
|
-
};
|
|
21
|
-
}, [handler]);
|
|
22
|
-
}
|
|
23
|
-
//# sourceMappingURL=onClickOutside.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"onClickOutside.js","sourceRoot":"","sources":["../../src/hooks/onClickOutside.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAa,MAAM,OAAO,CAAC;AAE7C;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAAwB,GAAiB,EAAE,OAAoC;IAC9G,SAAS,CAAC;QACR,IAAM,QAAQ,GAAG,UAAC,KAAiB;YACjC,IAAI,GAAG,CAAC,OAAO,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAc,CAAC,EAAE;gBAC9D,OAAO,CAAC,KAAK,CAAC,CAAC;aAChB;QACH,CAAC,CAAC;QAEF,QAAQ,CAAC,gBAAgB,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;QACjD,QAAQ,CAAC,gBAAgB,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAC;QAElD,OAAO;YACL,QAAQ,CAAC,mBAAmB,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;YACpD,QAAQ,CAAC,mBAAmB,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAC;QACvD,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;AAChB,CAAC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { RefObject } from 'react';
|
|
2
|
-
/**
|
|
3
|
-
* Hook that detects if a reference element within the main document is
|
|
4
|
-
* visible.
|
|
5
|
-
* Useful for performing some animation or triggering certain actions (e.g.,
|
|
6
|
-
* loading data for infinity scrolling) when an element appears or is close
|
|
7
|
-
* to appear on screen.
|
|
8
|
-
* @param ref The reference element to be visible.
|
|
9
|
-
* @param rootMargin The tolerance level to the reference element.
|
|
10
|
-
*/
|
|
11
|
-
export declare function useOnScreenVisible<T extends HTMLElement>(ref: RefObject<T>, rootMargin?: string): boolean;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { useState, useEffect } from 'react';
|
|
2
|
-
/**
|
|
3
|
-
* Hook that detects if a reference element within the main document is
|
|
4
|
-
* visible.
|
|
5
|
-
* Useful for performing some animation or triggering certain actions (e.g.,
|
|
6
|
-
* loading data for infinity scrolling) when an element appears or is close
|
|
7
|
-
* to appear on screen.
|
|
8
|
-
* @param ref The reference element to be visible.
|
|
9
|
-
* @param rootMargin The tolerance level to the reference element.
|
|
10
|
-
*/
|
|
11
|
-
export function useOnScreenVisible(ref, rootMargin) {
|
|
12
|
-
if (rootMargin === void 0) { rootMargin = '0px'; }
|
|
13
|
-
var _a = useState(false), isIntersecting = _a[0], setIntersecting = _a[1];
|
|
14
|
-
useEffect(function () {
|
|
15
|
-
var observer = new IntersectionObserver(function (_a) {
|
|
16
|
-
var entry = _a[0];
|
|
17
|
-
return setIntersecting(entry.isIntersecting);
|
|
18
|
-
}, {
|
|
19
|
-
rootMargin: rootMargin,
|
|
20
|
-
});
|
|
21
|
-
if (ref.current) {
|
|
22
|
-
observer.observe(ref.current);
|
|
23
|
-
}
|
|
24
|
-
return function () { return observer.unobserve(ref.current); };
|
|
25
|
-
}, []);
|
|
26
|
-
return isIntersecting;
|
|
27
|
-
}
|
|
28
|
-
//# sourceMappingURL=onScreenVisible.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"onScreenVisible.js","sourceRoot":"","sources":["../../src/hooks/onScreenVisible.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAa,MAAM,OAAO,CAAC;AAEvD;;;;;;;;GAQG;AACH,MAAM,UAAU,kBAAkB,CAAwB,GAAiB,EAAE,UAAkB;IAAlB,2BAAA,EAAA,kBAAkB;IACvF,IAAA,KAAoC,QAAQ,CAAC,KAAK,CAAC,EAAlD,cAAc,QAAA,EAAE,eAAe,QAAmB,CAAC;IAE1D,SAAS,CAAC;QACR,IAAM,QAAQ,GAAG,IAAI,oBAAoB,CAAC,UAAC,EAAO;gBAAN,KAAK,QAAA;YAAM,OAAA,eAAe,CAAC,KAAK,CAAC,cAAc,CAAC;QAArC,CAAqC,EAAE;YAC5F,UAAU,YAAA;SACX,CAAC,CAAC;QAEH,IAAI,GAAG,CAAC,OAAO,EAAE;YACf,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;SAC/B;QAED,OAAO,cAAM,OAAA,QAAQ,CAAC,SAAS,CAAC,GAAG,CAAC,OAAO,CAAC,EAA/B,CAA+B,CAAC;IAC/C,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,cAAc,CAAC;AACxB,CAAC"}
|
package/esm/hooks/promise.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The currently captured Promise state.
|
|
3
|
-
*/
|
|
4
|
-
export interface UsePromiseResult<T> {
|
|
5
|
-
loading: boolean;
|
|
6
|
-
data: T;
|
|
7
|
-
error: any;
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* Hook for introducing a complete local loading state for a promise.
|
|
11
|
-
* @param promise The callback for the promise to wait for.
|
|
12
|
-
*/
|
|
13
|
-
export declare function usePromise<T>(promise: () => Promise<T>): UsePromiseResult<T>;
|
package/esm/hooks/promise.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { useState, useEffect } from 'react';
|
|
2
|
-
/**
|
|
3
|
-
* Hook for introducing a complete local loading state for a promise.
|
|
4
|
-
* @param promise The callback for the promise to wait for.
|
|
5
|
-
*/
|
|
6
|
-
export function usePromise(promise) {
|
|
7
|
-
var _a = useState({
|
|
8
|
-
loading: true,
|
|
9
|
-
data: undefined,
|
|
10
|
-
error: undefined,
|
|
11
|
-
}), result = _a[0], setResult = _a[1];
|
|
12
|
-
useEffect(function () {
|
|
13
|
-
var cancelled = false;
|
|
14
|
-
promise().then(function (data) { return !cancelled && setResult({ data: data, error: undefined, loading: false }); }, function (error) { return !cancelled && setResult({ data: undefined, error: error, loading: false }); });
|
|
15
|
-
return function () {
|
|
16
|
-
cancelled = true;
|
|
17
|
-
};
|
|
18
|
-
}, []);
|
|
19
|
-
return result;
|
|
20
|
-
}
|
|
21
|
-
//# sourceMappingURL=promise.js.map
|
package/esm/hooks/promise.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"promise.js","sourceRoot":"","sources":["../../src/hooks/promise.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAW5C;;;GAGG;AACH,MAAM,UAAU,UAAU,CAAI,OAAyB;IAC/C,IAAA,KAAsB,QAAQ,CAAsB;QACxD,OAAO,EAAE,IAAI;QACb,IAAI,EAAE,SAAS;QACf,KAAK,EAAE,SAAS;KACjB,CAAC,EAJK,MAAM,QAAA,EAAE,SAAS,QAItB,CAAC;IACH,SAAS,CAAC;QACR,IAAI,SAAS,GAAG,KAAK,CAAC;QAEtB,OAAO,EAAE,CAAC,IAAI,CACZ,UAAC,IAAI,IAAK,OAAA,CAAC,SAAS,IAAI,SAAS,CAAC,EAAE,IAAI,MAAA,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,EAAnE,CAAmE,EAC7E,UAAC,KAAK,IAAK,OAAA,CAAC,SAAS,IAAI,SAAS,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,OAAA,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,EAAnE,CAAmE,CAC/E,CAAC;QAEF,OAAO;YACL,SAAS,GAAG,IAAI,CAAC;QACnB,CAAC,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;IACP,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/esm/utils/events.d.ts
DELETED
package/esm/utils/events.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
function nameOf(type) {
|
|
2
|
-
return "piral-" + type;
|
|
3
|
-
}
|
|
4
|
-
export function createListener(state) {
|
|
5
|
-
var eventListeners = [];
|
|
6
|
-
return {
|
|
7
|
-
on: function (type, callback) {
|
|
8
|
-
var listener = function (_a) {
|
|
9
|
-
var detail = _a.detail;
|
|
10
|
-
return detail && detail.state === state && callback(detail.arg);
|
|
11
|
-
};
|
|
12
|
-
document.body.addEventListener(nameOf(type), listener);
|
|
13
|
-
eventListeners.push([callback, listener]);
|
|
14
|
-
return this;
|
|
15
|
-
},
|
|
16
|
-
off: function (type, callback) {
|
|
17
|
-
var listener = eventListeners.filter(function (m) { return m[0] === callback; })[0];
|
|
18
|
-
if (listener) {
|
|
19
|
-
document.body.removeEventListener(nameOf(type), listener[1]);
|
|
20
|
-
eventListeners.splice(eventListeners.indexOf(listener), 1);
|
|
21
|
-
}
|
|
22
|
-
return this;
|
|
23
|
-
},
|
|
24
|
-
emit: function (type, arg) {
|
|
25
|
-
var ce = document.createEvent('CustomEvent');
|
|
26
|
-
ce.initCustomEvent(nameOf(type), false, false, {
|
|
27
|
-
arg: arg,
|
|
28
|
-
state: state,
|
|
29
|
-
});
|
|
30
|
-
document.body.dispatchEvent(ce);
|
|
31
|
-
return this;
|
|
32
|
-
},
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
//# sourceMappingURL=events.js.map
|
package/esm/utils/events.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"events.js","sourceRoot":"","sources":["../../src/utils/events.ts"],"names":[],"mappings":"AAIA,SAAS,MAAM,CAAC,IAAqB;IACnC,OAAO,WAAS,IAAM,CAAC;AACzB,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,KAAU;IACvC,IAAM,cAAc,GAAmB,EAAE,CAAC;IAE1C,OAAO;QACL,EAAE,EAAF,UAAG,IAAI,EAAE,QAAQ;YACf,IAAM,QAAQ,GAAG,UAAC,EAAuB;oBAArB,MAAM,YAAA;gBAAoB,OAAA,MAAM,IAAI,MAAM,CAAC,KAAK,KAAK,KAAK,IAAI,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC;YAAxD,CAAwD,CAAC;YACvG,QAAQ,CAAC,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,QAAQ,CAAC,CAAC;YACvD,cAAc,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC;YAC1C,OAAO,IAAI,CAAC;QACd,CAAC;QACD,GAAG,YAAC,IAAI,EAAE,QAAQ;YACT,IAAA,QAAQ,GAAI,cAAc,CAAC,MAAM,CAAC,UAAC,CAAC,IAAK,OAAA,CAAC,CAAC,CAAC,CAAC,KAAK,QAAQ,EAAjB,CAAiB,CAAC,GAAnD,CAAoD;YAEnE,IAAI,QAAQ,EAAE;gBACZ,QAAQ,CAAC,IAAI,CAAC,mBAAmB,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;gBAC7D,cAAc,CAAC,MAAM,CAAC,cAAc,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC;aAC5D;YAED,OAAO,IAAI,CAAC;QACd,CAAC;QACD,IAAI,YAAC,IAAI,EAAE,GAAG;YACZ,IAAM,EAAE,GAAG,QAAQ,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC;YAC/C,EAAE,CAAC,eAAe,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE;gBAC7C,GAAG,KAAA;gBACH,KAAK,OAAA;aACN,CAAC,CAAC;YACH,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC;YAChC,OAAO,IAAI,CAAC;QACd,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/lib/hooks/debounce.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Hook that returns the debounced (i.e., delayed) value.
|
|
3
|
-
* Useful when user input should not fire immediately, but rather
|
|
4
|
-
* only after a certain timespan without any changes passed.
|
|
5
|
-
* @param value The value to consider.
|
|
6
|
-
* @param delay The timespan to pass before applying the value.
|
|
7
|
-
*/
|
|
8
|
-
export declare function useDebounce<T>(value: T, delay?: number): T;
|
package/lib/hooks/debounce.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useDebounce = void 0;
|
|
4
|
-
var react_1 = require("react");
|
|
5
|
-
/**
|
|
6
|
-
* Hook that returns the debounced (i.e., delayed) value.
|
|
7
|
-
* Useful when user input should not fire immediately, but rather
|
|
8
|
-
* only after a certain timespan without any changes passed.
|
|
9
|
-
* @param value The value to consider.
|
|
10
|
-
* @param delay The timespan to pass before applying the value.
|
|
11
|
-
*/
|
|
12
|
-
function useDebounce(value, delay) {
|
|
13
|
-
if (delay === void 0) { delay = 300; }
|
|
14
|
-
var _a = react_1.useState(value), debouncedValue = _a[0], setDebouncedValue = _a[1];
|
|
15
|
-
react_1.useEffect(function () {
|
|
16
|
-
var handler = setTimeout(function () { return setDebouncedValue(value); }, delay);
|
|
17
|
-
return function () { return clearTimeout(handler); };
|
|
18
|
-
}, [value, delay]);
|
|
19
|
-
return debouncedValue;
|
|
20
|
-
}
|
|
21
|
-
exports.useDebounce = useDebounce;
|
|
22
|
-
//# sourceMappingURL=debounce.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"debounce.js","sourceRoot":"","sources":["../../src/hooks/debounce.ts"],"names":[],"mappings":";;;AAAA,+BAA4C;AAE5C;;;;;;GAMG;AACH,SAAgB,WAAW,CAAI,KAAQ,EAAE,KAAW;IAAX,sBAAA,EAAA,WAAW;IAC5C,IAAA,KAAsC,gBAAQ,CAAC,KAAK,CAAC,EAApD,cAAc,QAAA,EAAE,iBAAiB,QAAmB,CAAC;IAE5D,iBAAS,CAAC;QACR,IAAM,OAAO,GAAG,UAAU,CAAC,cAAM,OAAA,iBAAiB,CAAC,KAAK,CAAC,EAAxB,CAAwB,EAAE,KAAK,CAAC,CAAC;QAClE,OAAO,cAAM,OAAA,YAAY,CAAC,OAAO,CAAC,EAArB,CAAqB,CAAC;IACrC,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;IAEnB,OAAO,cAAc,CAAC;AACxB,CAAC;AATD,kCASC"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useLockBodyScroll = void 0;
|
|
4
|
-
var react_1 = require("react");
|
|
5
|
-
/**
|
|
6
|
-
* Hook that locks scrolling on the main document.
|
|
7
|
-
* Useful for preventing the standard scrolling in context of
|
|
8
|
-
* a modal dialog.
|
|
9
|
-
*/
|
|
10
|
-
function useLockBodyScroll() {
|
|
11
|
-
react_1.useLayoutEffect(function () {
|
|
12
|
-
document.body.style.overflow = 'hidden';
|
|
13
|
-
return function () {
|
|
14
|
-
document.body.style.overflow = 'visible';
|
|
15
|
-
};
|
|
16
|
-
}, []);
|
|
17
|
-
}
|
|
18
|
-
exports.useLockBodyScroll = useLockBodyScroll;
|
|
19
|
-
//# sourceMappingURL=lockBodyScroll.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"lockBodyScroll.js","sourceRoot":"","sources":["../../src/hooks/lockBodyScroll.ts"],"names":[],"mappings":";;;AAAA,+BAAwC;AAExC;;;;GAIG;AACH,SAAgB,iBAAiB;IAC/B,uBAAe,CAAC;QACd,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACxC,OAAO;YACL,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,GAAG,SAAS,CAAC;QAC3C,CAAC,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;AACT,CAAC;AAPD,8CAOC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { RefObject } from 'react';
|
|
2
|
-
/**
|
|
3
|
-
* Hook that detects if a click outside the given reference
|
|
4
|
-
* has been performed.
|
|
5
|
-
* @param ref The reference to the element.
|
|
6
|
-
* @param handler The callback to invoke when an outside click happened.
|
|
7
|
-
*/
|
|
8
|
-
export declare function useOnClickOutside<T extends HTMLElement>(ref: RefObject<T>, handler: (event: MouseEvent) => void): void;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useOnClickOutside = void 0;
|
|
4
|
-
var react_1 = require("react");
|
|
5
|
-
/**
|
|
6
|
-
* Hook that detects if a click outside the given reference
|
|
7
|
-
* has been performed.
|
|
8
|
-
* @param ref The reference to the element.
|
|
9
|
-
* @param handler The callback to invoke when an outside click happened.
|
|
10
|
-
*/
|
|
11
|
-
function useOnClickOutside(ref, handler) {
|
|
12
|
-
react_1.useEffect(function () {
|
|
13
|
-
var listener = function (event) {
|
|
14
|
-
if (ref.current && !ref.current.contains(event.target)) {
|
|
15
|
-
handler(event);
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
|
-
document.addEventListener('mousedown', listener);
|
|
19
|
-
document.addEventListener('touchstart', listener);
|
|
20
|
-
return function () {
|
|
21
|
-
document.removeEventListener('mousedown', listener);
|
|
22
|
-
document.removeEventListener('touchstart', listener);
|
|
23
|
-
};
|
|
24
|
-
}, [handler]);
|
|
25
|
-
}
|
|
26
|
-
exports.useOnClickOutside = useOnClickOutside;
|
|
27
|
-
//# sourceMappingURL=onClickOutside.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"onClickOutside.js","sourceRoot":"","sources":["../../src/hooks/onClickOutside.ts"],"names":[],"mappings":";;;AAAA,+BAA6C;AAE7C;;;;;GAKG;AACH,SAAgB,iBAAiB,CAAwB,GAAiB,EAAE,OAAoC;IAC9G,iBAAS,CAAC;QACR,IAAM,QAAQ,GAAG,UAAC,KAAiB;YACjC,IAAI,GAAG,CAAC,OAAO,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAc,CAAC,EAAE;gBAC9D,OAAO,CAAC,KAAK,CAAC,CAAC;aAChB;QACH,CAAC,CAAC;QAEF,QAAQ,CAAC,gBAAgB,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;QACjD,QAAQ,CAAC,gBAAgB,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAC;QAElD,OAAO;YACL,QAAQ,CAAC,mBAAmB,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;YACpD,QAAQ,CAAC,mBAAmB,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAC;QACvD,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;AAChB,CAAC;AAhBD,8CAgBC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { RefObject } from 'react';
|
|
2
|
-
/**
|
|
3
|
-
* Hook that detects if a reference element within the main document is
|
|
4
|
-
* visible.
|
|
5
|
-
* Useful for performing some animation or triggering certain actions (e.g.,
|
|
6
|
-
* loading data for infinity scrolling) when an element appears or is close
|
|
7
|
-
* to appear on screen.
|
|
8
|
-
* @param ref The reference element to be visible.
|
|
9
|
-
* @param rootMargin The tolerance level to the reference element.
|
|
10
|
-
*/
|
|
11
|
-
export declare function useOnScreenVisible<T extends HTMLElement>(ref: RefObject<T>, rootMargin?: string): boolean;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useOnScreenVisible = void 0;
|
|
4
|
-
var react_1 = require("react");
|
|
5
|
-
/**
|
|
6
|
-
* Hook that detects if a reference element within the main document is
|
|
7
|
-
* visible.
|
|
8
|
-
* Useful for performing some animation or triggering certain actions (e.g.,
|
|
9
|
-
* loading data for infinity scrolling) when an element appears or is close
|
|
10
|
-
* to appear on screen.
|
|
11
|
-
* @param ref The reference element to be visible.
|
|
12
|
-
* @param rootMargin The tolerance level to the reference element.
|
|
13
|
-
*/
|
|
14
|
-
function useOnScreenVisible(ref, rootMargin) {
|
|
15
|
-
if (rootMargin === void 0) { rootMargin = '0px'; }
|
|
16
|
-
var _a = react_1.useState(false), isIntersecting = _a[0], setIntersecting = _a[1];
|
|
17
|
-
react_1.useEffect(function () {
|
|
18
|
-
var observer = new IntersectionObserver(function (_a) {
|
|
19
|
-
var entry = _a[0];
|
|
20
|
-
return setIntersecting(entry.isIntersecting);
|
|
21
|
-
}, {
|
|
22
|
-
rootMargin: rootMargin,
|
|
23
|
-
});
|
|
24
|
-
if (ref.current) {
|
|
25
|
-
observer.observe(ref.current);
|
|
26
|
-
}
|
|
27
|
-
return function () { return observer.unobserve(ref.current); };
|
|
28
|
-
}, []);
|
|
29
|
-
return isIntersecting;
|
|
30
|
-
}
|
|
31
|
-
exports.useOnScreenVisible = useOnScreenVisible;
|
|
32
|
-
//# sourceMappingURL=onScreenVisible.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"onScreenVisible.js","sourceRoot":"","sources":["../../src/hooks/onScreenVisible.ts"],"names":[],"mappings":";;;AAAA,+BAAuD;AAEvD;;;;;;;;GAQG;AACH,SAAgB,kBAAkB,CAAwB,GAAiB,EAAE,UAAkB;IAAlB,2BAAA,EAAA,kBAAkB;IACvF,IAAA,KAAoC,gBAAQ,CAAC,KAAK,CAAC,EAAlD,cAAc,QAAA,EAAE,eAAe,QAAmB,CAAC;IAE1D,iBAAS,CAAC;QACR,IAAM,QAAQ,GAAG,IAAI,oBAAoB,CAAC,UAAC,EAAO;gBAAN,KAAK,QAAA;YAAM,OAAA,eAAe,CAAC,KAAK,CAAC,cAAc,CAAC;QAArC,CAAqC,EAAE;YAC5F,UAAU,YAAA;SACX,CAAC,CAAC;QAEH,IAAI,GAAG,CAAC,OAAO,EAAE;YACf,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;SAC/B;QAED,OAAO,cAAM,OAAA,QAAQ,CAAC,SAAS,CAAC,GAAG,CAAC,OAAO,CAAC,EAA/B,CAA+B,CAAC;IAC/C,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,cAAc,CAAC;AACxB,CAAC;AAhBD,gDAgBC"}
|
package/lib/hooks/promise.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The currently captured Promise state.
|
|
3
|
-
*/
|
|
4
|
-
export interface UsePromiseResult<T> {
|
|
5
|
-
loading: boolean;
|
|
6
|
-
data: T;
|
|
7
|
-
error: any;
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* Hook for introducing a complete local loading state for a promise.
|
|
11
|
-
* @param promise The callback for the promise to wait for.
|
|
12
|
-
*/
|
|
13
|
-
export declare function usePromise<T>(promise: () => Promise<T>): UsePromiseResult<T>;
|