isomorfeus-preact 10.6.11 → 10.6.15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/browser/event.rb +2 -0
- data/lib/isomorfeus/preact_view_helper.rb +3 -2
- data/lib/isomorfeus/props/validate_hash_proxy.rb +1 -1
- data/lib/isomorfeus/props/validator.rb +6 -4
- data/lib/isomorfeus-preact.rb +3 -3
- data/lib/isomorfeus_preact/lucid_component/api.rb +1 -1
- data/lib/isomorfeus_preact/lucid_component/initializer.rb +2 -2
- data/lib/isomorfeus_preact/lucid_func/initializer.rb +1 -1
- data/lib/isomorfeus_preact/preact/function_component/initializer.rb +1 -1
- data/lib/preact/component/api.rb +1 -1
- data/lib/preact/component/callbacks.rb +6 -6
- data/lib/preact/component/initializer.rb +2 -2
- data/lib/preact/component/native_component_constructor.rb +1 -1
- data/lib/preact/props.rb +51 -0
- data/lib/preact/state.rb +67 -0
- data/lib/preact/version.rb +1 -1
- data/lib/preact.rb +2 -2
- data/node_modules/.package-lock.json +3 -3
- data/node_modules/preact/LICENSE +21 -21
- data/node_modules/preact/README.md +187 -187
- data/node_modules/preact/compat/dist/compat.js +1 -1
- data/node_modules/preact/compat/dist/compat.js.map +1 -1
- data/node_modules/preact/compat/dist/compat.mjs +1 -1
- data/node_modules/preact/compat/dist/compat.module.js +1 -1
- data/node_modules/preact/compat/dist/compat.module.js.map +1 -1
- data/node_modules/preact/compat/dist/compat.umd.js +1 -1
- data/node_modules/preact/compat/dist/compat.umd.js.map +1 -1
- data/node_modules/preact/compat/jsx-dev-runtime.js +1 -1
- data/node_modules/preact/compat/jsx-dev-runtime.mjs +1 -1
- data/node_modules/preact/compat/jsx-runtime.js +1 -1
- data/node_modules/preact/compat/jsx-runtime.mjs +1 -1
- data/node_modules/preact/compat/package.json +19 -19
- data/node_modules/preact/compat/scheduler.js +15 -15
- data/node_modules/preact/compat/scheduler.mjs +23 -23
- data/node_modules/preact/compat/server.js +15 -15
- data/node_modules/preact/compat/server.mjs +4 -4
- data/node_modules/preact/compat/src/Children.js +21 -21
- data/node_modules/preact/compat/src/PureComponent.js +15 -15
- data/node_modules/preact/compat/src/forwardRef.js +51 -51
- data/node_modules/preact/compat/src/index.d.ts +141 -141
- data/node_modules/preact/compat/src/index.js +187 -187
- data/node_modules/preact/compat/src/internal.d.ts +47 -47
- data/node_modules/preact/compat/src/memo.js +34 -34
- data/node_modules/preact/compat/src/portals.js +80 -80
- data/node_modules/preact/compat/src/render.js +229 -230
- data/node_modules/preact/compat/src/suspense-list.d.ts +14 -14
- data/node_modules/preact/compat/src/suspense-list.js +126 -126
- data/node_modules/preact/compat/src/suspense.d.ts +15 -15
- data/node_modules/preact/compat/src/suspense.js +270 -270
- data/node_modules/preact/compat/src/util.js +28 -28
- data/node_modules/preact/compat/test-utils.js +1 -1
- data/node_modules/preact/debug/dist/debug.js.map +1 -1
- data/node_modules/preact/debug/dist/debug.module.js.map +1 -1
- data/node_modules/preact/debug/dist/debug.umd.js.map +1 -1
- data/node_modules/preact/debug/package.json +18 -18
- data/node_modules/preact/debug/src/check-props.js +54 -54
- data/node_modules/preact/debug/src/component-stack.js +146 -146
- data/node_modules/preact/debug/src/constants.js +3 -3
- data/node_modules/preact/debug/src/debug.js +442 -442
- data/node_modules/preact/debug/src/index.js +6 -6
- data/node_modules/preact/debug/src/internal.d.ts +82 -82
- data/node_modules/preact/debug/src/util.js +11 -11
- data/node_modules/preact/devtools/dist/devtools.js +1 -1
- data/node_modules/preact/devtools/dist/devtools.js.map +1 -1
- data/node_modules/preact/devtools/dist/devtools.mjs +1 -1
- data/node_modules/preact/devtools/dist/devtools.module.js +1 -1
- data/node_modules/preact/devtools/dist/devtools.module.js.map +1 -1
- data/node_modules/preact/devtools/dist/devtools.umd.js +1 -1
- data/node_modules/preact/devtools/dist/devtools.umd.js.map +1 -1
- data/node_modules/preact/devtools/package.json +16 -16
- data/node_modules/preact/devtools/src/devtools.js +10 -10
- data/node_modules/preact/devtools/src/index.d.ts +8 -8
- data/node_modules/preact/devtools/src/index.js +15 -15
- data/node_modules/preact/dist/preact.js.map +1 -1
- data/node_modules/preact/dist/preact.min.js.map +1 -1
- data/node_modules/preact/dist/preact.module.js.map +1 -1
- data/node_modules/preact/dist/preact.umd.js.map +1 -1
- data/node_modules/preact/hooks/dist/hooks.js +1 -1
- data/node_modules/preact/hooks/dist/hooks.js.map +1 -1
- data/node_modules/preact/hooks/dist/hooks.mjs +1 -1
- data/node_modules/preact/hooks/dist/hooks.module.js +1 -1
- data/node_modules/preact/hooks/dist/hooks.module.js.map +1 -1
- data/node_modules/preact/hooks/dist/hooks.umd.js +1 -1
- data/node_modules/preact/hooks/dist/hooks.umd.js.map +1 -1
- data/node_modules/preact/hooks/package.json +26 -26
- data/node_modules/preact/hooks/src/index.d.ts +139 -139
- data/node_modules/preact/hooks/src/index.js +386 -388
- data/node_modules/preact/hooks/src/internal.d.ts +75 -75
- data/node_modules/preact/jsx-runtime/dist/jsxRuntime.js.map +1 -1
- data/node_modules/preact/jsx-runtime/dist/jsxRuntime.module.js.map +1 -1
- data/node_modules/preact/jsx-runtime/dist/jsxRuntime.umd.js.map +1 -1
- data/node_modules/preact/jsx-runtime/package.json +19 -19
- data/node_modules/preact/jsx-runtime/src/index.d.ts +50 -50
- data/node_modules/preact/jsx-runtime/src/index.js +77 -77
- data/node_modules/preact/package.json +291 -287
- data/node_modules/preact/src/cjs.js +3 -3
- data/node_modules/preact/src/clone-element.js +34 -34
- data/node_modules/preact/src/component.js +225 -225
- data/node_modules/preact/src/constants.js +3 -3
- data/node_modules/preact/src/create-context.js +68 -68
- data/node_modules/preact/src/create-element.js +98 -98
- data/node_modules/preact/src/diff/catch-error.js +38 -38
- data/node_modules/preact/src/diff/children.js +335 -335
- data/node_modules/preact/src/diff/index.js +516 -516
- data/node_modules/preact/src/diff/props.js +158 -158
- data/node_modules/preact/src/index.d.ts +310 -310
- data/node_modules/preact/src/index.js +13 -13
- data/node_modules/preact/src/internal.d.ts +146 -146
- data/node_modules/preact/src/jsx.d.ts +1005 -1005
- data/node_modules/preact/src/options.js +16 -16
- data/node_modules/preact/src/render.js +75 -75
- data/node_modules/preact/src/util.js +27 -27
- data/node_modules/preact/test-utils/dist/testUtils.js.map +1 -1
- data/node_modules/preact/test-utils/dist/testUtils.module.js.map +1 -1
- data/node_modules/preact/test-utils/dist/testUtils.umd.js.map +1 -1
- data/node_modules/preact/test-utils/package.json +19 -19
- data/node_modules/preact/test-utils/src/index.d.ts +3 -3
- data/node_modules/preact/test-utils/src/index.js +117 -117
- data/package.json +1 -1
- metadata +8 -8
- data/lib/preact/component/props.rb +0 -55
- data/lib/preact/component/state.rb +0 -58
@@ -1,187 +1,187 @@
|
|
1
|
-
import {
|
2
|
-
createElement,
|
3
|
-
render as preactRender,
|
4
|
-
cloneElement as preactCloneElement,
|
5
|
-
createRef,
|
6
|
-
Component,
|
7
|
-
createContext,
|
8
|
-
Fragment
|
9
|
-
} from 'preact';
|
10
|
-
import {
|
11
|
-
useState,
|
12
|
-
useReducer,
|
13
|
-
useEffect,
|
14
|
-
useLayoutEffect,
|
15
|
-
useRef,
|
16
|
-
useImperativeHandle,
|
17
|
-
useMemo,
|
18
|
-
useCallback,
|
19
|
-
useContext,
|
20
|
-
useDebugValue
|
21
|
-
} from 'preact/hooks';
|
22
|
-
import { PureComponent } from './PureComponent';
|
23
|
-
import { memo } from './memo';
|
24
|
-
import { forwardRef } from './forwardRef';
|
25
|
-
import { Children } from './Children';
|
26
|
-
import { Suspense, lazy } from './suspense';
|
27
|
-
import { SuspenseList } from './suspense-list';
|
28
|
-
import { createPortal } from './portals';
|
29
|
-
import {
|
30
|
-
hydrate,
|
31
|
-
render,
|
32
|
-
REACT_ELEMENT_TYPE,
|
33
|
-
__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED
|
34
|
-
} from './render';
|
35
|
-
|
36
|
-
const version = '17.0.2'; // trick libraries to think we are react
|
37
|
-
|
38
|
-
/**
|
39
|
-
* Legacy version of createElement.
|
40
|
-
* @param {import('./internal').VNode["type"]} type The node name or Component constructor
|
41
|
-
*/
|
42
|
-
function createFactory(type) {
|
43
|
-
return createElement.bind(null, type);
|
44
|
-
}
|
45
|
-
|
46
|
-
/**
|
47
|
-
* Check if the passed element is a valid (p)react node.
|
48
|
-
* @param {*} element The element to check
|
49
|
-
* @returns {boolean}
|
50
|
-
*/
|
51
|
-
function isValidElement(element) {
|
52
|
-
return !!element && element.$$typeof === REACT_ELEMENT_TYPE;
|
53
|
-
}
|
54
|
-
|
55
|
-
/**
|
56
|
-
* Wrap `cloneElement` to abort if the passed element is not a valid element and apply
|
57
|
-
* all vnode normalizations.
|
58
|
-
* @param {import('./internal').VNode} element The vnode to clone
|
59
|
-
* @param {object} props Props to add when cloning
|
60
|
-
* @param {Array<import('./internal').ComponentChildren>} rest Optional component children
|
61
|
-
*/
|
62
|
-
function cloneElement(element) {
|
63
|
-
if (!isValidElement(element)) return element;
|
64
|
-
return preactCloneElement.apply(null, arguments);
|
65
|
-
}
|
66
|
-
|
67
|
-
/**
|
68
|
-
* Remove a component tree from the DOM, including state and event handlers.
|
69
|
-
* @param {import('./internal').PreactElement} container
|
70
|
-
* @returns {boolean}
|
71
|
-
*/
|
72
|
-
function unmountComponentAtNode(container) {
|
73
|
-
if (container._children) {
|
74
|
-
preactRender(null, container);
|
75
|
-
return true;
|
76
|
-
}
|
77
|
-
return false;
|
78
|
-
}
|
79
|
-
|
80
|
-
/**
|
81
|
-
* Get the matching DOM node for a component
|
82
|
-
* @param {import('./internal').Component} component
|
83
|
-
* @returns {import('./internal').PreactElement | null}
|
84
|
-
*/
|
85
|
-
function findDOMNode(component) {
|
86
|
-
return (
|
87
|
-
(component &&
|
88
|
-
(component.base || (component.nodeType === 1 && component))) ||
|
89
|
-
null
|
90
|
-
);
|
91
|
-
}
|
92
|
-
|
93
|
-
/**
|
94
|
-
* Deprecated way to control batched rendering inside the reconciler, but we
|
95
|
-
* already schedule in batches inside our rendering code
|
96
|
-
* @template Arg
|
97
|
-
* @param {(arg: Arg) => void} callback function that triggers the updated
|
98
|
-
* @param {Arg} [arg] Optional argument that can be passed to the callback
|
99
|
-
*/
|
100
|
-
// eslint-disable-next-line camelcase
|
101
|
-
const unstable_batchedUpdates = (callback, arg) => callback(arg);
|
102
|
-
|
103
|
-
/**
|
104
|
-
* In React, `flushSync` flushes the entire tree and forces a rerender. It's
|
105
|
-
* implmented here as a no-op.
|
106
|
-
* @template Arg
|
107
|
-
* @template Result
|
108
|
-
* @param {(arg: Arg) => Result} callback function that runs before the flush
|
109
|
-
* @param {Arg} [arg] Optional arugment that can be passed to the callback
|
110
|
-
* @returns
|
111
|
-
*/
|
112
|
-
const flushSync = (callback, arg) => callback(arg);
|
113
|
-
|
114
|
-
/**
|
115
|
-
* Strict Mode is not implemented in Preact, so we provide a stand-in for it
|
116
|
-
* that just renders its children without imposing any restrictions.
|
117
|
-
*/
|
118
|
-
const StrictMode = Fragment;
|
119
|
-
|
120
|
-
export * from 'preact/hooks';
|
121
|
-
export {
|
122
|
-
version,
|
123
|
-
Children,
|
124
|
-
render,
|
125
|
-
hydrate,
|
126
|
-
unmountComponentAtNode,
|
127
|
-
createPortal,
|
128
|
-
createElement,
|
129
|
-
createContext,
|
130
|
-
createFactory,
|
131
|
-
cloneElement,
|
132
|
-
createRef,
|
133
|
-
Fragment,
|
134
|
-
isValidElement,
|
135
|
-
findDOMNode,
|
136
|
-
Component,
|
137
|
-
PureComponent,
|
138
|
-
memo,
|
139
|
-
forwardRef,
|
140
|
-
flushSync,
|
141
|
-
// eslint-disable-next-line camelcase
|
142
|
-
unstable_batchedUpdates,
|
143
|
-
StrictMode,
|
144
|
-
Suspense,
|
145
|
-
SuspenseList,
|
146
|
-
lazy,
|
147
|
-
__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED
|
148
|
-
};
|
149
|
-
|
150
|
-
// React copies the named exports to the default one.
|
151
|
-
export default {
|
152
|
-
useState,
|
153
|
-
useReducer,
|
154
|
-
useEffect,
|
155
|
-
useLayoutEffect,
|
156
|
-
useRef,
|
157
|
-
useImperativeHandle,
|
158
|
-
useMemo,
|
159
|
-
useCallback,
|
160
|
-
useContext,
|
161
|
-
useDebugValue,
|
162
|
-
version,
|
163
|
-
Children,
|
164
|
-
render,
|
165
|
-
hydrate,
|
166
|
-
unmountComponentAtNode,
|
167
|
-
createPortal,
|
168
|
-
createElement,
|
169
|
-
createContext,
|
170
|
-
createFactory,
|
171
|
-
cloneElement,
|
172
|
-
createRef,
|
173
|
-
Fragment,
|
174
|
-
isValidElement,
|
175
|
-
findDOMNode,
|
176
|
-
Component,
|
177
|
-
PureComponent,
|
178
|
-
memo,
|
179
|
-
forwardRef,
|
180
|
-
flushSync,
|
181
|
-
unstable_batchedUpdates,
|
182
|
-
StrictMode,
|
183
|
-
Suspense,
|
184
|
-
SuspenseList,
|
185
|
-
lazy,
|
186
|
-
__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED
|
187
|
-
};
|
1
|
+
import {
|
2
|
+
createElement,
|
3
|
+
render as preactRender,
|
4
|
+
cloneElement as preactCloneElement,
|
5
|
+
createRef,
|
6
|
+
Component,
|
7
|
+
createContext,
|
8
|
+
Fragment
|
9
|
+
} from 'preact';
|
10
|
+
import {
|
11
|
+
useState,
|
12
|
+
useReducer,
|
13
|
+
useEffect,
|
14
|
+
useLayoutEffect,
|
15
|
+
useRef,
|
16
|
+
useImperativeHandle,
|
17
|
+
useMemo,
|
18
|
+
useCallback,
|
19
|
+
useContext,
|
20
|
+
useDebugValue
|
21
|
+
} from 'preact/hooks';
|
22
|
+
import { PureComponent } from './PureComponent';
|
23
|
+
import { memo } from './memo';
|
24
|
+
import { forwardRef } from './forwardRef';
|
25
|
+
import { Children } from './Children';
|
26
|
+
import { Suspense, lazy } from './suspense';
|
27
|
+
import { SuspenseList } from './suspense-list';
|
28
|
+
import { createPortal } from './portals';
|
29
|
+
import {
|
30
|
+
hydrate,
|
31
|
+
render,
|
32
|
+
REACT_ELEMENT_TYPE,
|
33
|
+
__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED
|
34
|
+
} from './render';
|
35
|
+
|
36
|
+
const version = '17.0.2'; // trick libraries to think we are react
|
37
|
+
|
38
|
+
/**
|
39
|
+
* Legacy version of createElement.
|
40
|
+
* @param {import('./internal').VNode["type"]} type The node name or Component constructor
|
41
|
+
*/
|
42
|
+
function createFactory(type) {
|
43
|
+
return createElement.bind(null, type);
|
44
|
+
}
|
45
|
+
|
46
|
+
/**
|
47
|
+
* Check if the passed element is a valid (p)react node.
|
48
|
+
* @param {*} element The element to check
|
49
|
+
* @returns {boolean}
|
50
|
+
*/
|
51
|
+
function isValidElement(element) {
|
52
|
+
return !!element && element.$$typeof === REACT_ELEMENT_TYPE;
|
53
|
+
}
|
54
|
+
|
55
|
+
/**
|
56
|
+
* Wrap `cloneElement` to abort if the passed element is not a valid element and apply
|
57
|
+
* all vnode normalizations.
|
58
|
+
* @param {import('./internal').VNode} element The vnode to clone
|
59
|
+
* @param {object} props Props to add when cloning
|
60
|
+
* @param {Array<import('./internal').ComponentChildren>} rest Optional component children
|
61
|
+
*/
|
62
|
+
function cloneElement(element) {
|
63
|
+
if (!isValidElement(element)) return element;
|
64
|
+
return preactCloneElement.apply(null, arguments);
|
65
|
+
}
|
66
|
+
|
67
|
+
/**
|
68
|
+
* Remove a component tree from the DOM, including state and event handlers.
|
69
|
+
* @param {import('./internal').PreactElement} container
|
70
|
+
* @returns {boolean}
|
71
|
+
*/
|
72
|
+
function unmountComponentAtNode(container) {
|
73
|
+
if (container._children) {
|
74
|
+
preactRender(null, container);
|
75
|
+
return true;
|
76
|
+
}
|
77
|
+
return false;
|
78
|
+
}
|
79
|
+
|
80
|
+
/**
|
81
|
+
* Get the matching DOM node for a component
|
82
|
+
* @param {import('./internal').Component} component
|
83
|
+
* @returns {import('./internal').PreactElement | null}
|
84
|
+
*/
|
85
|
+
function findDOMNode(component) {
|
86
|
+
return (
|
87
|
+
(component &&
|
88
|
+
(component.base || (component.nodeType === 1 && component))) ||
|
89
|
+
null
|
90
|
+
);
|
91
|
+
}
|
92
|
+
|
93
|
+
/**
|
94
|
+
* Deprecated way to control batched rendering inside the reconciler, but we
|
95
|
+
* already schedule in batches inside our rendering code
|
96
|
+
* @template Arg
|
97
|
+
* @param {(arg: Arg) => void} callback function that triggers the updated
|
98
|
+
* @param {Arg} [arg] Optional argument that can be passed to the callback
|
99
|
+
*/
|
100
|
+
// eslint-disable-next-line camelcase
|
101
|
+
const unstable_batchedUpdates = (callback, arg) => callback(arg);
|
102
|
+
|
103
|
+
/**
|
104
|
+
* In React, `flushSync` flushes the entire tree and forces a rerender. It's
|
105
|
+
* implmented here as a no-op.
|
106
|
+
* @template Arg
|
107
|
+
* @template Result
|
108
|
+
* @param {(arg: Arg) => Result} callback function that runs before the flush
|
109
|
+
* @param {Arg} [arg] Optional arugment that can be passed to the callback
|
110
|
+
* @returns
|
111
|
+
*/
|
112
|
+
const flushSync = (callback, arg) => callback(arg);
|
113
|
+
|
114
|
+
/**
|
115
|
+
* Strict Mode is not implemented in Preact, so we provide a stand-in for it
|
116
|
+
* that just renders its children without imposing any restrictions.
|
117
|
+
*/
|
118
|
+
const StrictMode = Fragment;
|
119
|
+
|
120
|
+
export * from 'preact/hooks';
|
121
|
+
export {
|
122
|
+
version,
|
123
|
+
Children,
|
124
|
+
render,
|
125
|
+
hydrate,
|
126
|
+
unmountComponentAtNode,
|
127
|
+
createPortal,
|
128
|
+
createElement,
|
129
|
+
createContext,
|
130
|
+
createFactory,
|
131
|
+
cloneElement,
|
132
|
+
createRef,
|
133
|
+
Fragment,
|
134
|
+
isValidElement,
|
135
|
+
findDOMNode,
|
136
|
+
Component,
|
137
|
+
PureComponent,
|
138
|
+
memo,
|
139
|
+
forwardRef,
|
140
|
+
flushSync,
|
141
|
+
// eslint-disable-next-line camelcase
|
142
|
+
unstable_batchedUpdates,
|
143
|
+
StrictMode,
|
144
|
+
Suspense,
|
145
|
+
SuspenseList,
|
146
|
+
lazy,
|
147
|
+
__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED
|
148
|
+
};
|
149
|
+
|
150
|
+
// React copies the named exports to the default one.
|
151
|
+
export default {
|
152
|
+
useState,
|
153
|
+
useReducer,
|
154
|
+
useEffect,
|
155
|
+
useLayoutEffect,
|
156
|
+
useRef,
|
157
|
+
useImperativeHandle,
|
158
|
+
useMemo,
|
159
|
+
useCallback,
|
160
|
+
useContext,
|
161
|
+
useDebugValue,
|
162
|
+
version,
|
163
|
+
Children,
|
164
|
+
render,
|
165
|
+
hydrate,
|
166
|
+
unmountComponentAtNode,
|
167
|
+
createPortal,
|
168
|
+
createElement,
|
169
|
+
createContext,
|
170
|
+
createFactory,
|
171
|
+
cloneElement,
|
172
|
+
createRef,
|
173
|
+
Fragment,
|
174
|
+
isValidElement,
|
175
|
+
findDOMNode,
|
176
|
+
Component,
|
177
|
+
PureComponent,
|
178
|
+
memo,
|
179
|
+
forwardRef,
|
180
|
+
flushSync,
|
181
|
+
unstable_batchedUpdates,
|
182
|
+
StrictMode,
|
183
|
+
Suspense,
|
184
|
+
SuspenseList,
|
185
|
+
lazy,
|
186
|
+
__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED
|
187
|
+
};
|
@@ -1,47 +1,47 @@
|
|
1
|
-
import {
|
2
|
-
Component as PreactComponent,
|
3
|
-
VNode as PreactVNode,
|
4
|
-
FunctionComponent as PreactFunctionComponent
|
5
|
-
} from '../../src/internal';
|
6
|
-
import { SuspenseProps } from './suspense';
|
7
|
-
|
8
|
-
export { ComponentChildren } from '../..';
|
9
|
-
|
10
|
-
export { PreactElement } from '../../src/internal';
|
11
|
-
|
12
|
-
export interface Component<P = {}, S = {}> extends PreactComponent<P, S> {
|
13
|
-
isReactComponent?: object;
|
14
|
-
isPureReactComponent?: true;
|
15
|
-
_patchedLifecycles?: true;
|
16
|
-
|
17
|
-
// Suspense internal properties
|
18
|
-
_childDidSuspend?(error: Promise<void>, suspendingVNode: VNode): void;
|
19
|
-
_suspended: (vnode: VNode) => (unsuspend: () => void) => void;
|
20
|
-
_onResolve?(): void;
|
21
|
-
|
22
|
-
// Portal internal properties
|
23
|
-
_temp: any;
|
24
|
-
_container: PreactElement;
|
25
|
-
}
|
26
|
-
|
27
|
-
export interface FunctionComponent<P = {}> extends PreactFunctionComponent<P> {
|
28
|
-
shouldComponentUpdate?(nextProps: Readonly<P>): boolean;
|
29
|
-
_forwarded?: boolean;
|
30
|
-
_patchedLifecycles?: true;
|
31
|
-
}
|
32
|
-
|
33
|
-
export interface VNode<T = any> extends PreactVNode<T> {
|
34
|
-
$$typeof?: symbol | string;
|
35
|
-
preactCompatNormalized?: boolean;
|
36
|
-
}
|
37
|
-
|
38
|
-
export interface SuspenseState {
|
39
|
-
_suspended?: null | VNode<any>;
|
40
|
-
}
|
41
|
-
|
42
|
-
export interface SuspenseComponent
|
43
|
-
extends PreactComponent<SuspenseProps, SuspenseState> {
|
44
|
-
_pendingSuspensionCount: number;
|
45
|
-
_suspenders: Component[];
|
46
|
-
_detachOnNextRender: null | VNode<any>;
|
47
|
-
}
|
1
|
+
import {
|
2
|
+
Component as PreactComponent,
|
3
|
+
VNode as PreactVNode,
|
4
|
+
FunctionComponent as PreactFunctionComponent
|
5
|
+
} from '../../src/internal';
|
6
|
+
import { SuspenseProps } from './suspense';
|
7
|
+
|
8
|
+
export { ComponentChildren } from '../..';
|
9
|
+
|
10
|
+
export { PreactElement } from '../../src/internal';
|
11
|
+
|
12
|
+
export interface Component<P = {}, S = {}> extends PreactComponent<P, S> {
|
13
|
+
isReactComponent?: object;
|
14
|
+
isPureReactComponent?: true;
|
15
|
+
_patchedLifecycles?: true;
|
16
|
+
|
17
|
+
// Suspense internal properties
|
18
|
+
_childDidSuspend?(error: Promise<void>, suspendingVNode: VNode): void;
|
19
|
+
_suspended: (vnode: VNode) => (unsuspend: () => void) => void;
|
20
|
+
_onResolve?(): void;
|
21
|
+
|
22
|
+
// Portal internal properties
|
23
|
+
_temp: any;
|
24
|
+
_container: PreactElement;
|
25
|
+
}
|
26
|
+
|
27
|
+
export interface FunctionComponent<P = {}> extends PreactFunctionComponent<P> {
|
28
|
+
shouldComponentUpdate?(nextProps: Readonly<P>): boolean;
|
29
|
+
_forwarded?: boolean;
|
30
|
+
_patchedLifecycles?: true;
|
31
|
+
}
|
32
|
+
|
33
|
+
export interface VNode<T = any> extends PreactVNode<T> {
|
34
|
+
$$typeof?: symbol | string;
|
35
|
+
preactCompatNormalized?: boolean;
|
36
|
+
}
|
37
|
+
|
38
|
+
export interface SuspenseState {
|
39
|
+
_suspended?: null | VNode<any>;
|
40
|
+
}
|
41
|
+
|
42
|
+
export interface SuspenseComponent
|
43
|
+
extends PreactComponent<SuspenseProps, SuspenseState> {
|
44
|
+
_pendingSuspensionCount: number;
|
45
|
+
_suspenders: Component[];
|
46
|
+
_detachOnNextRender: null | VNode<any>;
|
47
|
+
}
|
@@ -1,34 +1,34 @@
|
|
1
|
-
import { createElement } from 'preact';
|
2
|
-
import { shallowDiffers } from './util';
|
3
|
-
|
4
|
-
/**
|
5
|
-
* Memoize a component, so that it only updates when the props actually have
|
6
|
-
* changed. This was previously known as `React.pure`.
|
7
|
-
* @param {import('./internal').FunctionComponent} c functional component
|
8
|
-
* @param {(prev: object, next: object) => boolean} [comparer] Custom equality function
|
9
|
-
* @returns {import('./internal').FunctionComponent}
|
10
|
-
*/
|
11
|
-
export function memo(c, comparer) {
|
12
|
-
function shouldUpdate(nextProps) {
|
13
|
-
let ref = this.props.ref;
|
14
|
-
let updateRef = ref == nextProps.ref;
|
15
|
-
if (!updateRef && ref) {
|
16
|
-
ref.call ? ref(null) : (ref.current = null);
|
17
|
-
}
|
18
|
-
|
19
|
-
if (!comparer) {
|
20
|
-
return shallowDiffers(this.props, nextProps);
|
21
|
-
}
|
22
|
-
|
23
|
-
return !comparer(this.props, nextProps) || !updateRef;
|
24
|
-
}
|
25
|
-
|
26
|
-
function Memoed(props) {
|
27
|
-
this.shouldComponentUpdate = shouldUpdate;
|
28
|
-
return createElement(c, props);
|
29
|
-
}
|
30
|
-
Memoed.displayName = 'Memo(' + (c.displayName || c.name) + ')';
|
31
|
-
Memoed.prototype.isReactComponent = true;
|
32
|
-
Memoed._forwarded = true;
|
33
|
-
return Memoed;
|
34
|
-
}
|
1
|
+
import { createElement } from 'preact';
|
2
|
+
import { shallowDiffers } from './util';
|
3
|
+
|
4
|
+
/**
|
5
|
+
* Memoize a component, so that it only updates when the props actually have
|
6
|
+
* changed. This was previously known as `React.pure`.
|
7
|
+
* @param {import('./internal').FunctionComponent} c functional component
|
8
|
+
* @param {(prev: object, next: object) => boolean} [comparer] Custom equality function
|
9
|
+
* @returns {import('./internal').FunctionComponent}
|
10
|
+
*/
|
11
|
+
export function memo(c, comparer) {
|
12
|
+
function shouldUpdate(nextProps) {
|
13
|
+
let ref = this.props.ref;
|
14
|
+
let updateRef = ref == nextProps.ref;
|
15
|
+
if (!updateRef && ref) {
|
16
|
+
ref.call ? ref(null) : (ref.current = null);
|
17
|
+
}
|
18
|
+
|
19
|
+
if (!comparer) {
|
20
|
+
return shallowDiffers(this.props, nextProps);
|
21
|
+
}
|
22
|
+
|
23
|
+
return !comparer(this.props, nextProps) || !updateRef;
|
24
|
+
}
|
25
|
+
|
26
|
+
function Memoed(props) {
|
27
|
+
this.shouldComponentUpdate = shouldUpdate;
|
28
|
+
return createElement(c, props);
|
29
|
+
}
|
30
|
+
Memoed.displayName = 'Memo(' + (c.displayName || c.name) + ')';
|
31
|
+
Memoed.prototype.isReactComponent = true;
|
32
|
+
Memoed._forwarded = true;
|
33
|
+
return Memoed;
|
34
|
+
}
|