isomorfeus-preact 10.6.14 → 10.6.18
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.rb +4 -4
- data/lib/isomorfeus_preact/lucid_component/api.rb +1 -1
- data/lib/isomorfeus_preact/lucid_component/initializer.rb +2 -4
- 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 +2 -2
- 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/component/resolution.rb +2 -2
- data/lib/preact/params.rb +16 -0
- data/lib/preact/props.rb +69 -0
- data/lib/preact/state.rb +87 -0
- data/lib/preact/version.rb +1 -1
- data/lib/preact.rb +4 -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 +7 -7
- data/lib/preact/component/params.rb +0 -18
- data/lib/preact/component/props.rb +0 -55
- data/lib/preact/component/state.rb +0 -58
@@ -1,146 +1,146 @@
|
|
1
|
-
import { options, Fragment } from 'preact';
|
2
|
-
|
3
|
-
/**
|
4
|
-
* Get human readable name of the component/dom node
|
5
|
-
* @param {import('./internal').VNode} vnode
|
6
|
-
* @param {import('./internal').VNode} vnode
|
7
|
-
* @returns {string}
|
8
|
-
*/
|
9
|
-
export function getDisplayName(vnode) {
|
10
|
-
if (vnode.type === Fragment) {
|
11
|
-
return 'Fragment';
|
12
|
-
} else if (typeof vnode.type == 'function') {
|
13
|
-
return vnode.type.displayName || vnode.type.name;
|
14
|
-
} else if (typeof vnode.type == 'string') {
|
15
|
-
return vnode.type;
|
16
|
-
}
|
17
|
-
|
18
|
-
return '#text';
|
19
|
-
}
|
20
|
-
|
21
|
-
/**
|
22
|
-
* Used to keep track of the currently rendered `vnode` and print it
|
23
|
-
* in debug messages.
|
24
|
-
*/
|
25
|
-
let renderStack = [];
|
26
|
-
|
27
|
-
/**
|
28
|
-
* Keep track of the current owners. An owner describes a component
|
29
|
-
* which was responsible to render a specific `vnode`. This exclude
|
30
|
-
* children that are passed via `props.children`, because they belong
|
31
|
-
* to the parent owner.
|
32
|
-
*
|
33
|
-
* ```jsx
|
34
|
-
* const Foo = props => <div>{props.children}</div> // div's owner is Foo
|
35
|
-
* const Bar = props => {
|
36
|
-
* return (
|
37
|
-
* <Foo><span /></Foo> // Foo's owner is Bar, span's owner is Bar
|
38
|
-
* )
|
39
|
-
* }
|
40
|
-
* ```
|
41
|
-
*
|
42
|
-
* Note: A `vnode` may be hoisted to the root scope due to compiler
|
43
|
-
* optimiztions. In these cases the `_owner` will be different.
|
44
|
-
*/
|
45
|
-
let ownerStack = [];
|
46
|
-
|
47
|
-
/**
|
48
|
-
* Get the currently rendered `vnode`
|
49
|
-
* @returns {import('./internal').VNode | null}
|
50
|
-
*/
|
51
|
-
export function getCurrentVNode() {
|
52
|
-
return renderStack.length > 0 ? renderStack[renderStack.length - 1] : null;
|
53
|
-
}
|
54
|
-
|
55
|
-
/**
|
56
|
-
* If the user doesn't have `@babel/plugin-transform-react-jsx-source`
|
57
|
-
* somewhere in his tool chain we can't print the filename and source
|
58
|
-
* location of a component. In that case we just omit that, but we'll
|
59
|
-
* print a helpful message to the console, notifying the user of it.
|
60
|
-
*/
|
61
|
-
let hasBabelPlugin = false;
|
62
|
-
|
63
|
-
/**
|
64
|
-
* Check if a `vnode` is a possible owner.
|
65
|
-
* @param {import('./internal').VNode} vnode
|
66
|
-
*/
|
67
|
-
function isPossibleOwner(vnode) {
|
68
|
-
return typeof vnode.type == 'function' && vnode.type != Fragment;
|
69
|
-
}
|
70
|
-
|
71
|
-
/**
|
72
|
-
* Return the component stack that was captured up to this point.
|
73
|
-
* @param {import('./internal').VNode} vnode
|
74
|
-
* @returns {string}
|
75
|
-
*/
|
76
|
-
export function getOwnerStack(vnode) {
|
77
|
-
const stack = [vnode];
|
78
|
-
let next = vnode;
|
79
|
-
while (next._owner != null) {
|
80
|
-
stack.push(next._owner);
|
81
|
-
next = next._owner;
|
82
|
-
}
|
83
|
-
|
84
|
-
return stack.reduce((acc, owner) => {
|
85
|
-
acc += ` in ${getDisplayName(owner)}`;
|
86
|
-
|
87
|
-
const source = owner.__source;
|
88
|
-
if (source) {
|
89
|
-
acc += ` (at ${source.fileName}:${source.lineNumber})`;
|
90
|
-
} else if (!hasBabelPlugin) {
|
91
|
-
hasBabelPlugin = true;
|
92
|
-
console.warn(
|
93
|
-
'Add @babel/plugin-transform-react-jsx-source to get a more detailed component stack. Note that you should not add it to production builds of your App for bundle size reasons.'
|
94
|
-
);
|
95
|
-
}
|
96
|
-
|
97
|
-
return (acc += '\n');
|
98
|
-
}, '');
|
99
|
-
}
|
100
|
-
|
101
|
-
/**
|
102
|
-
* Setup code to capture the component trace while rendering. Note that
|
103
|
-
* we cannot simply traverse `vnode._parent` upwards, because we have some
|
104
|
-
* debug messages for `this.setState` where the `vnode` is `undefined`.
|
105
|
-
*/
|
106
|
-
export function setupComponentStack() {
|
107
|
-
let oldDiff = options._diff;
|
108
|
-
let oldDiffed = options.diffed;
|
109
|
-
let oldRoot = options._root;
|
110
|
-
let oldVNode = options.vnode;
|
111
|
-
let oldRender = options._render;
|
112
|
-
|
113
|
-
options.diffed = vnode => {
|
114
|
-
if (isPossibleOwner(vnode)) {
|
115
|
-
ownerStack.pop();
|
116
|
-
}
|
117
|
-
renderStack.pop();
|
118
|
-
if (oldDiffed) oldDiffed(vnode);
|
119
|
-
};
|
120
|
-
|
121
|
-
options._diff = vnode => {
|
122
|
-
if (isPossibleOwner(vnode)) {
|
123
|
-
renderStack.push(vnode);
|
124
|
-
}
|
125
|
-
if (oldDiff) oldDiff(vnode);
|
126
|
-
};
|
127
|
-
|
128
|
-
options._root = (vnode, parent) => {
|
129
|
-
ownerStack = [];
|
130
|
-
if (oldRoot) oldRoot(vnode, parent);
|
131
|
-
};
|
132
|
-
|
133
|
-
options.vnode = vnode => {
|
134
|
-
vnode._owner =
|
135
|
-
ownerStack.length > 0 ? ownerStack[ownerStack.length - 1] : null;
|
136
|
-
if (oldVNode) oldVNode(vnode);
|
137
|
-
};
|
138
|
-
|
139
|
-
options._render = vnode => {
|
140
|
-
if (isPossibleOwner(vnode)) {
|
141
|
-
ownerStack.push(vnode);
|
142
|
-
}
|
143
|
-
|
144
|
-
if (oldRender) oldRender(vnode);
|
145
|
-
};
|
146
|
-
}
|
1
|
+
import { options, Fragment } from 'preact';
|
2
|
+
|
3
|
+
/**
|
4
|
+
* Get human readable name of the component/dom node
|
5
|
+
* @param {import('./internal').VNode} vnode
|
6
|
+
* @param {import('./internal').VNode} vnode
|
7
|
+
* @returns {string}
|
8
|
+
*/
|
9
|
+
export function getDisplayName(vnode) {
|
10
|
+
if (vnode.type === Fragment) {
|
11
|
+
return 'Fragment';
|
12
|
+
} else if (typeof vnode.type == 'function') {
|
13
|
+
return vnode.type.displayName || vnode.type.name;
|
14
|
+
} else if (typeof vnode.type == 'string') {
|
15
|
+
return vnode.type;
|
16
|
+
}
|
17
|
+
|
18
|
+
return '#text';
|
19
|
+
}
|
20
|
+
|
21
|
+
/**
|
22
|
+
* Used to keep track of the currently rendered `vnode` and print it
|
23
|
+
* in debug messages.
|
24
|
+
*/
|
25
|
+
let renderStack = [];
|
26
|
+
|
27
|
+
/**
|
28
|
+
* Keep track of the current owners. An owner describes a component
|
29
|
+
* which was responsible to render a specific `vnode`. This exclude
|
30
|
+
* children that are passed via `props.children`, because they belong
|
31
|
+
* to the parent owner.
|
32
|
+
*
|
33
|
+
* ```jsx
|
34
|
+
* const Foo = props => <div>{props.children}</div> // div's owner is Foo
|
35
|
+
* const Bar = props => {
|
36
|
+
* return (
|
37
|
+
* <Foo><span /></Foo> // Foo's owner is Bar, span's owner is Bar
|
38
|
+
* )
|
39
|
+
* }
|
40
|
+
* ```
|
41
|
+
*
|
42
|
+
* Note: A `vnode` may be hoisted to the root scope due to compiler
|
43
|
+
* optimiztions. In these cases the `_owner` will be different.
|
44
|
+
*/
|
45
|
+
let ownerStack = [];
|
46
|
+
|
47
|
+
/**
|
48
|
+
* Get the currently rendered `vnode`
|
49
|
+
* @returns {import('./internal').VNode | null}
|
50
|
+
*/
|
51
|
+
export function getCurrentVNode() {
|
52
|
+
return renderStack.length > 0 ? renderStack[renderStack.length - 1] : null;
|
53
|
+
}
|
54
|
+
|
55
|
+
/**
|
56
|
+
* If the user doesn't have `@babel/plugin-transform-react-jsx-source`
|
57
|
+
* somewhere in his tool chain we can't print the filename and source
|
58
|
+
* location of a component. In that case we just omit that, but we'll
|
59
|
+
* print a helpful message to the console, notifying the user of it.
|
60
|
+
*/
|
61
|
+
let hasBabelPlugin = false;
|
62
|
+
|
63
|
+
/**
|
64
|
+
* Check if a `vnode` is a possible owner.
|
65
|
+
* @param {import('./internal').VNode} vnode
|
66
|
+
*/
|
67
|
+
function isPossibleOwner(vnode) {
|
68
|
+
return typeof vnode.type == 'function' && vnode.type != Fragment;
|
69
|
+
}
|
70
|
+
|
71
|
+
/**
|
72
|
+
* Return the component stack that was captured up to this point.
|
73
|
+
* @param {import('./internal').VNode} vnode
|
74
|
+
* @returns {string}
|
75
|
+
*/
|
76
|
+
export function getOwnerStack(vnode) {
|
77
|
+
const stack = [vnode];
|
78
|
+
let next = vnode;
|
79
|
+
while (next._owner != null) {
|
80
|
+
stack.push(next._owner);
|
81
|
+
next = next._owner;
|
82
|
+
}
|
83
|
+
|
84
|
+
return stack.reduce((acc, owner) => {
|
85
|
+
acc += ` in ${getDisplayName(owner)}`;
|
86
|
+
|
87
|
+
const source = owner.__source;
|
88
|
+
if (source) {
|
89
|
+
acc += ` (at ${source.fileName}:${source.lineNumber})`;
|
90
|
+
} else if (!hasBabelPlugin) {
|
91
|
+
hasBabelPlugin = true;
|
92
|
+
console.warn(
|
93
|
+
'Add @babel/plugin-transform-react-jsx-source to get a more detailed component stack. Note that you should not add it to production builds of your App for bundle size reasons.'
|
94
|
+
);
|
95
|
+
}
|
96
|
+
|
97
|
+
return (acc += '\n');
|
98
|
+
}, '');
|
99
|
+
}
|
100
|
+
|
101
|
+
/**
|
102
|
+
* Setup code to capture the component trace while rendering. Note that
|
103
|
+
* we cannot simply traverse `vnode._parent` upwards, because we have some
|
104
|
+
* debug messages for `this.setState` where the `vnode` is `undefined`.
|
105
|
+
*/
|
106
|
+
export function setupComponentStack() {
|
107
|
+
let oldDiff = options._diff;
|
108
|
+
let oldDiffed = options.diffed;
|
109
|
+
let oldRoot = options._root;
|
110
|
+
let oldVNode = options.vnode;
|
111
|
+
let oldRender = options._render;
|
112
|
+
|
113
|
+
options.diffed = vnode => {
|
114
|
+
if (isPossibleOwner(vnode)) {
|
115
|
+
ownerStack.pop();
|
116
|
+
}
|
117
|
+
renderStack.pop();
|
118
|
+
if (oldDiffed) oldDiffed(vnode);
|
119
|
+
};
|
120
|
+
|
121
|
+
options._diff = vnode => {
|
122
|
+
if (isPossibleOwner(vnode)) {
|
123
|
+
renderStack.push(vnode);
|
124
|
+
}
|
125
|
+
if (oldDiff) oldDiff(vnode);
|
126
|
+
};
|
127
|
+
|
128
|
+
options._root = (vnode, parent) => {
|
129
|
+
ownerStack = [];
|
130
|
+
if (oldRoot) oldRoot(vnode, parent);
|
131
|
+
};
|
132
|
+
|
133
|
+
options.vnode = vnode => {
|
134
|
+
vnode._owner =
|
135
|
+
ownerStack.length > 0 ? ownerStack[ownerStack.length - 1] : null;
|
136
|
+
if (oldVNode) oldVNode(vnode);
|
137
|
+
};
|
138
|
+
|
139
|
+
options._render = vnode => {
|
140
|
+
if (isPossibleOwner(vnode)) {
|
141
|
+
ownerStack.push(vnode);
|
142
|
+
}
|
143
|
+
|
144
|
+
if (oldRender) oldRender(vnode);
|
145
|
+
};
|
146
|
+
}
|
@@ -1,3 +1,3 @@
|
|
1
|
-
export const ELEMENT_NODE = 1;
|
2
|
-
export const DOCUMENT_NODE = 9;
|
3
|
-
export const DOCUMENT_FRAGMENT_NODE = 11;
|
1
|
+
export const ELEMENT_NODE = 1;
|
2
|
+
export const DOCUMENT_NODE = 9;
|
3
|
+
export const DOCUMENT_FRAGMENT_NODE = 11;
|