isomorfeus-preact 10.8.0 → 10.9.0

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.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/lib/isomorfeus_preact/preact/function_component/api.rb +24 -0
  3. data/lib/preact/version.rb +1 -1
  4. data/node_modules/.package-lock.json +5 -7
  5. data/node_modules/preact/compat/dist/compat.js +2 -2
  6. data/node_modules/preact/compat/dist/compat.js.map +1 -1
  7. data/node_modules/preact/compat/dist/compat.mjs +2 -2
  8. data/node_modules/preact/compat/dist/compat.module.js +2 -2
  9. data/node_modules/preact/compat/dist/compat.module.js.map +1 -1
  10. data/node_modules/preact/compat/dist/compat.umd.js +2 -2
  11. data/node_modules/preact/compat/dist/compat.umd.js.map +1 -1
  12. data/node_modules/preact/compat/src/index.d.ts +164 -155
  13. data/node_modules/preact/compat/src/index.js +223 -187
  14. data/node_modules/preact/compat/src/render.js +238 -238
  15. data/node_modules/preact/debug/dist/debug.js +2 -2
  16. data/node_modules/preact/debug/dist/debug.js.map +1 -1
  17. data/node_modules/preact/debug/dist/debug.mjs +2 -2
  18. data/node_modules/preact/debug/dist/debug.module.js +2 -2
  19. data/node_modules/preact/debug/dist/debug.module.js.map +1 -1
  20. data/node_modules/preact/debug/dist/debug.umd.js +2 -2
  21. data/node_modules/preact/debug/dist/debug.umd.js.map +1 -1
  22. data/node_modules/preact/debug/src/debug.js +437 -444
  23. data/node_modules/preact/devtools/dist/devtools.js +2 -2
  24. data/node_modules/preact/devtools/dist/devtools.js.map +1 -1
  25. data/node_modules/preact/devtools/dist/devtools.mjs +2 -2
  26. data/node_modules/preact/devtools/dist/devtools.module.js +2 -2
  27. data/node_modules/preact/devtools/dist/devtools.module.js.map +1 -1
  28. data/node_modules/preact/devtools/dist/devtools.umd.js +2 -2
  29. data/node_modules/preact/devtools/dist/devtools.umd.js.map +1 -1
  30. data/node_modules/preact/devtools/src/devtools.js +10 -10
  31. data/node_modules/preact/hooks/dist/hooks.js +2 -2
  32. data/node_modules/preact/hooks/dist/hooks.js.map +1 -1
  33. data/node_modules/preact/hooks/dist/hooks.mjs +2 -2
  34. data/node_modules/preact/hooks/dist/hooks.module.js +2 -2
  35. data/node_modules/preact/hooks/dist/hooks.module.js.map +1 -1
  36. data/node_modules/preact/hooks/dist/hooks.umd.js +2 -2
  37. data/node_modules/preact/hooks/dist/hooks.umd.js.map +1 -1
  38. data/node_modules/preact/hooks/src/index.js +417 -404
  39. data/node_modules/preact/hooks/src/internal.d.ts +3 -0
  40. data/node_modules/preact/package.json +304 -304
  41. data/node_modules/preact/src/jsx.d.ts +1014 -1013
  42. data/package.json +1 -1
  43. 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 * 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 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
+ };