isomorfeus-preact 10.8.0 → 10.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/isomorfeus_preact/preact/function_component/api.rb +24 -0
- data/lib/preact/version.rb +1 -1
- data/node_modules/.package-lock.json +5 -7
- data/node_modules/preact/compat/dist/compat.js +2 -2
- data/node_modules/preact/compat/dist/compat.js.map +1 -1
- data/node_modules/preact/compat/dist/compat.mjs +2 -2
- data/node_modules/preact/compat/dist/compat.module.js +2 -2
- data/node_modules/preact/compat/dist/compat.module.js.map +1 -1
- data/node_modules/preact/compat/dist/compat.umd.js +2 -2
- data/node_modules/preact/compat/dist/compat.umd.js.map +1 -1
- data/node_modules/preact/compat/src/index.d.ts +164 -155
- data/node_modules/preact/compat/src/index.js +223 -187
- data/node_modules/preact/compat/src/render.js +238 -238
- data/node_modules/preact/debug/dist/debug.js +2 -2
- data/node_modules/preact/debug/dist/debug.js.map +1 -1
- data/node_modules/preact/debug/dist/debug.mjs +2 -2
- data/node_modules/preact/debug/dist/debug.module.js +2 -2
- data/node_modules/preact/debug/dist/debug.module.js.map +1 -1
- data/node_modules/preact/debug/dist/debug.umd.js +2 -2
- data/node_modules/preact/debug/dist/debug.umd.js.map +1 -1
- data/node_modules/preact/debug/src/debug.js +437 -444
- data/node_modules/preact/devtools/dist/devtools.js +2 -2
- data/node_modules/preact/devtools/dist/devtools.js.map +1 -1
- data/node_modules/preact/devtools/dist/devtools.mjs +2 -2
- data/node_modules/preact/devtools/dist/devtools.module.js +2 -2
- data/node_modules/preact/devtools/dist/devtools.module.js.map +1 -1
- data/node_modules/preact/devtools/dist/devtools.umd.js +2 -2
- data/node_modules/preact/devtools/dist/devtools.umd.js.map +1 -1
- data/node_modules/preact/devtools/src/devtools.js +10 -10
- data/node_modules/preact/hooks/dist/hooks.js +2 -2
- data/node_modules/preact/hooks/dist/hooks.js.map +1 -1
- data/node_modules/preact/hooks/dist/hooks.mjs +2 -2
- data/node_modules/preact/hooks/dist/hooks.module.js +2 -2
- data/node_modules/preact/hooks/dist/hooks.module.js.map +1 -1
- data/node_modules/preact/hooks/dist/hooks.umd.js +2 -2
- data/node_modules/preact/hooks/dist/hooks.umd.js.map +1 -1
- data/node_modules/preact/hooks/src/index.js +417 -404
- data/node_modules/preact/hooks/src/internal.d.ts +3 -0
- data/node_modules/preact/package.json +304 -304
- data/node_modules/preact/src/jsx.d.ts +1014 -1013
- data/package.json +1 -1
- metadata +4 -4
@@ -1,187 +1,223 @@
|
|
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
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
export
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
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 function startTransition(cb) {
|
121
|
+
cb();
|
122
|
+
}
|
123
|
+
|
124
|
+
export function useDeferredValue(val) {
|
125
|
+
return val;
|
126
|
+
}
|
127
|
+
|
128
|
+
export function useTransition() {
|
129
|
+
return [false, startTransition];
|
130
|
+
}
|
131
|
+
|
132
|
+
// TODO: in theory this should be done after a VNode is diffed as we want to insert
|
133
|
+
// styles/... before it attaches
|
134
|
+
export const useInsertionEffect = useLayoutEffect;
|
135
|
+
|
136
|
+
export function useSyncExternalStore(subscribe, getSnapshot) {
|
137
|
+
const [state, setState] = useState(getSnapshot);
|
138
|
+
|
139
|
+
// TODO: in suspense for data we could have a discrepancy here because Preact won't re-init the "useState"
|
140
|
+
// when this unsuspends which could lead to stale state as the subscription is torn down.
|
141
|
+
|
142
|
+
useEffect(() => {
|
143
|
+
return subscribe(() => {
|
144
|
+
setState(getSnapshot());
|
145
|
+
});
|
146
|
+
}, [subscribe, getSnapshot]);
|
147
|
+
|
148
|
+
return state;
|
149
|
+
}
|
150
|
+
|
151
|
+
export * from 'preact/hooks';
|
152
|
+
export {
|
153
|
+
version,
|
154
|
+
Children,
|
155
|
+
render,
|
156
|
+
hydrate,
|
157
|
+
unmountComponentAtNode,
|
158
|
+
createPortal,
|
159
|
+
createElement,
|
160
|
+
createContext,
|
161
|
+
createFactory,
|
162
|
+
cloneElement,
|
163
|
+
createRef,
|
164
|
+
Fragment,
|
165
|
+
isValidElement,
|
166
|
+
findDOMNode,
|
167
|
+
Component,
|
168
|
+
PureComponent,
|
169
|
+
memo,
|
170
|
+
forwardRef,
|
171
|
+
flushSync,
|
172
|
+
// eslint-disable-next-line camelcase
|
173
|
+
unstable_batchedUpdates,
|
174
|
+
StrictMode,
|
175
|
+
Suspense,
|
176
|
+
SuspenseList,
|
177
|
+
lazy,
|
178
|
+
__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED
|
179
|
+
};
|
180
|
+
|
181
|
+
// React copies the named exports to the default one.
|
182
|
+
export default {
|
183
|
+
useState,
|
184
|
+
useReducer,
|
185
|
+
useEffect,
|
186
|
+
useLayoutEffect,
|
187
|
+
useInsertionEffect,
|
188
|
+
useTransition,
|
189
|
+
useDeferredValue,
|
190
|
+
useSyncExternalStore,
|
191
|
+
startTransition,
|
192
|
+
useRef,
|
193
|
+
useImperativeHandle,
|
194
|
+
useMemo,
|
195
|
+
useCallback,
|
196
|
+
useContext,
|
197
|
+
useDebugValue,
|
198
|
+
version,
|
199
|
+
Children,
|
200
|
+
render,
|
201
|
+
hydrate,
|
202
|
+
unmountComponentAtNode,
|
203
|
+
createPortal,
|
204
|
+
createElement,
|
205
|
+
createContext,
|
206
|
+
createFactory,
|
207
|
+
cloneElement,
|
208
|
+
createRef,
|
209
|
+
Fragment,
|
210
|
+
isValidElement,
|
211
|
+
findDOMNode,
|
212
|
+
Component,
|
213
|
+
PureComponent,
|
214
|
+
memo,
|
215
|
+
forwardRef,
|
216
|
+
flushSync,
|
217
|
+
unstable_batchedUpdates,
|
218
|
+
StrictMode,
|
219
|
+
Suspense,
|
220
|
+
SuspenseList,
|
221
|
+
lazy,
|
222
|
+
__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED
|
223
|
+
};
|