@bpmn-io/properties-panel 0.8.0 → 0.10.1

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 (177) hide show
  1. package/CHANGELOG.md +112 -85
  2. package/LICENSE +20 -20
  3. package/README.md +34 -34
  4. package/assets/properties-panel.css +891 -848
  5. package/dist/index.esm.js +1609 -0
  6. package/dist/index.esm.js.map +1 -0
  7. package/dist/index.js +1650 -0
  8. package/dist/index.js.map +1 -0
  9. package/package.json +87 -78
  10. package/preact/LICENSE +21 -0
  11. package/preact/README.md +185 -0
  12. package/preact/compat/dist/compat.js +2 -0
  13. package/preact/compat/dist/compat.js.map +1 -0
  14. package/preact/compat/dist/compat.mjs +2 -0
  15. package/preact/compat/dist/compat.module.js +2 -0
  16. package/preact/compat/dist/compat.module.js.map +1 -0
  17. package/preact/compat/dist/compat.umd.js +2 -0
  18. package/preact/compat/dist/compat.umd.js.map +1 -0
  19. package/preact/compat/jsx-dev-runtime.js +1 -0
  20. package/preact/compat/jsx-dev-runtime.mjs +1 -0
  21. package/preact/compat/jsx-runtime.js +1 -0
  22. package/preact/compat/jsx-runtime.mjs +1 -0
  23. package/preact/compat/package.json +19 -0
  24. package/preact/compat/server.js +15 -0
  25. package/preact/compat/server.mjs +4 -0
  26. package/preact/compat/src/Children.js +21 -0
  27. package/preact/compat/src/PureComponent.js +15 -0
  28. package/preact/compat/src/forwardRef.js +51 -0
  29. package/preact/compat/src/index.d.ts +140 -0
  30. package/preact/compat/src/index.js +175 -0
  31. package/preact/compat/src/internal.d.ts +47 -0
  32. package/preact/compat/src/memo.js +34 -0
  33. package/preact/compat/src/portals.js +80 -0
  34. package/preact/compat/src/render.js +219 -0
  35. package/preact/compat/src/scheduler.js +24 -0
  36. package/preact/compat/src/suspense-list.d.ts +14 -0
  37. package/preact/compat/src/suspense-list.js +126 -0
  38. package/preact/compat/src/suspense.d.ts +15 -0
  39. package/preact/compat/src/suspense.js +270 -0
  40. package/preact/compat/src/util.js +28 -0
  41. package/preact/compat/test-utils.js +1 -0
  42. package/preact/debug/dist/debug.js +2 -0
  43. package/preact/debug/dist/debug.js.map +1 -0
  44. package/preact/debug/dist/debug.mjs +2 -0
  45. package/preact/debug/dist/debug.module.js +2 -0
  46. package/preact/debug/dist/debug.module.js.map +1 -0
  47. package/preact/debug/dist/debug.umd.js +2 -0
  48. package/preact/debug/dist/debug.umd.js.map +1 -0
  49. package/preact/debug/package.json +18 -0
  50. package/preact/debug/src/check-props.js +54 -0
  51. package/preact/debug/src/component-stack.js +146 -0
  52. package/preact/debug/src/constants.js +3 -0
  53. package/preact/debug/src/debug.js +442 -0
  54. package/preact/debug/src/index.js +6 -0
  55. package/preact/debug/src/internal.d.ts +82 -0
  56. package/preact/debug/src/util.js +11 -0
  57. package/preact/devtools/dist/devtools.js +2 -0
  58. package/preact/devtools/dist/devtools.js.map +1 -0
  59. package/preact/devtools/dist/devtools.mjs +2 -0
  60. package/preact/devtools/dist/devtools.module.js +2 -0
  61. package/preact/devtools/dist/devtools.module.js.map +1 -0
  62. package/preact/devtools/dist/devtools.umd.js +2 -0
  63. package/preact/devtools/dist/devtools.umd.js.map +1 -0
  64. package/preact/devtools/package.json +16 -0
  65. package/preact/devtools/src/devtools.js +10 -0
  66. package/preact/devtools/src/index.d.ts +8 -0
  67. package/preact/devtools/src/index.js +15 -0
  68. package/preact/dist/preact.js +2 -0
  69. package/preact/dist/preact.js.map +1 -0
  70. package/preact/dist/preact.min.js +2 -0
  71. package/preact/dist/preact.min.js.map +1 -0
  72. package/preact/dist/preact.mjs +2 -0
  73. package/preact/dist/preact.module.js +2 -0
  74. package/preact/dist/preact.module.js.map +1 -0
  75. package/preact/dist/preact.umd.js +2 -0
  76. package/preact/dist/preact.umd.js.map +1 -0
  77. package/preact/hooks/dist/hooks.js +2 -0
  78. package/preact/hooks/dist/hooks.js.map +1 -0
  79. package/preact/hooks/dist/hooks.mjs +2 -0
  80. package/preact/hooks/dist/hooks.module.js +2 -0
  81. package/preact/hooks/dist/hooks.module.js.map +1 -0
  82. package/preact/hooks/dist/hooks.umd.js +2 -0
  83. package/preact/hooks/dist/hooks.umd.js.map +1 -0
  84. package/preact/hooks/package.json +26 -0
  85. package/preact/hooks/src/index.d.ts +130 -0
  86. package/preact/hooks/src/index.js +386 -0
  87. package/preact/hooks/src/internal.d.ts +75 -0
  88. package/preact/jsx-runtime/dist/jsxRuntime.js +2 -0
  89. package/preact/jsx-runtime/dist/jsxRuntime.js.map +1 -0
  90. package/preact/jsx-runtime/dist/jsxRuntime.mjs +2 -0
  91. package/preact/jsx-runtime/dist/jsxRuntime.module.js +2 -0
  92. package/preact/jsx-runtime/dist/jsxRuntime.module.js.map +1 -0
  93. package/preact/jsx-runtime/dist/jsxRuntime.umd.js +2 -0
  94. package/preact/jsx-runtime/dist/jsxRuntime.umd.js.map +1 -0
  95. package/preact/jsx-runtime/package.json +19 -0
  96. package/preact/jsx-runtime/src/index.d.ts +50 -0
  97. package/preact/jsx-runtime/src/index.js +72 -0
  98. package/preact/package.json +268 -0
  99. package/preact/src/cjs.js +3 -0
  100. package/preact/src/clone-element.js +39 -0
  101. package/preact/src/component.js +225 -0
  102. package/preact/src/constants.js +3 -0
  103. package/preact/src/create-context.js +68 -0
  104. package/preact/src/create-element.js +100 -0
  105. package/preact/src/diff/catch-error.js +38 -0
  106. package/preact/src/diff/children.js +347 -0
  107. package/preact/src/diff/index.js +516 -0
  108. package/preact/src/diff/props.js +158 -0
  109. package/preact/src/index.d.ts +310 -0
  110. package/preact/src/index.js +13 -0
  111. package/preact/src/internal.d.ts +147 -0
  112. package/preact/src/jsx.d.ts +955 -0
  113. package/preact/src/options.js +17 -0
  114. package/preact/src/render.js +74 -0
  115. package/preact/src/util.js +23 -0
  116. package/preact/test-utils/dist/testUtils.js +2 -0
  117. package/preact/test-utils/dist/testUtils.js.map +1 -0
  118. package/preact/test-utils/dist/testUtils.mjs +2 -0
  119. package/preact/test-utils/dist/testUtils.module.js +2 -0
  120. package/preact/test-utils/dist/testUtils.module.js.map +1 -0
  121. package/preact/test-utils/dist/testUtils.umd.js +2 -0
  122. package/preact/test-utils/dist/testUtils.umd.js.map +1 -0
  123. package/preact/test-utils/package.json +19 -0
  124. package/preact/test-utils/src/index.d.ts +3 -0
  125. package/preact/test-utils/src/index.js +117 -0
  126. package/lib/PropertiesPanel.js +0 -126
  127. package/lib/PropertiesPanel.js.map +0 -1
  128. package/lib/components/DropdownButton.js +0 -109
  129. package/lib/components/DropdownButton.js.map +0 -1
  130. package/lib/components/Group.js +0 -75
  131. package/lib/components/Group.js.map +0 -1
  132. package/lib/components/Header.js +0 -49
  133. package/lib/components/Header.js.map +0 -1
  134. package/lib/components/HeaderButton.js +0 -16
  135. package/lib/components/HeaderButton.js.map +0 -1
  136. package/lib/components/ListGroup.js +0 -167
  137. package/lib/components/ListGroup.js.map +0 -1
  138. package/lib/components/ListItem.js +0 -37
  139. package/lib/components/ListItem.js.map +0 -1
  140. package/lib/components/entries/Checkbox.js +0 -81
  141. package/lib/components/entries/Checkbox.js.map +0 -1
  142. package/lib/components/entries/Collapsible.js +0 -48
  143. package/lib/components/entries/Collapsible.js.map +0 -1
  144. package/lib/components/entries/List.js +0 -204
  145. package/lib/components/entries/List.js.map +0 -1
  146. package/lib/components/entries/NumberField.js +0 -108
  147. package/lib/components/entries/NumberField.js.map +0 -1
  148. package/lib/components/entries/Select.js +0 -107
  149. package/lib/components/entries/Select.js.map +0 -1
  150. package/lib/components/entries/Simple.js +0 -56
  151. package/lib/components/entries/Simple.js.map +0 -1
  152. package/lib/components/entries/TextArea.js +0 -96
  153. package/lib/components/entries/TextArea.js.map +0 -1
  154. package/lib/components/entries/TextField.js +0 -121
  155. package/lib/components/entries/TextField.js.map +0 -1
  156. package/lib/components/entries/ToggleSwitch.js +0 -87
  157. package/lib/components/entries/ToggleSwitch.js.map +0 -1
  158. package/lib/components/icons/index.js +0 -51
  159. package/lib/components/icons/index.js.map +0 -1
  160. package/lib/context/LayoutContext.js +0 -9
  161. package/lib/context/LayoutContext.js.map +0 -1
  162. package/lib/context/index.js +0 -2
  163. package/lib/context/index.js.map +0 -1
  164. package/lib/features/debounce-input/debounceInput.js +0 -14
  165. package/lib/features/debounce-input/debounceInput.js.map +0 -1
  166. package/lib/features/debounce-input/index.js +0 -5
  167. package/lib/features/debounce-input/index.js.map +0 -1
  168. package/lib/hooks/index.js +0 -4
  169. package/lib/hooks/index.js.map +0 -1
  170. package/lib/hooks/useKeyFactory.js +0 -39
  171. package/lib/hooks/useKeyFactory.js.map +0 -1
  172. package/lib/hooks/useLayoutState.js +0 -36
  173. package/lib/hooks/useLayoutState.js.map +0 -1
  174. package/lib/hooks/usePrevious.js +0 -16
  175. package/lib/hooks/usePrevious.js.map +0 -1
  176. package/lib/index.js +0 -2
  177. package/lib/index.js.map +0 -1
@@ -0,0 +1,225 @@
1
+ import { assign } from './util';
2
+ import { diff, commitRoot } from './diff/index';
3
+ import options from './options';
4
+ import { Fragment } from './create-element';
5
+
6
+ /**
7
+ * Base Component class. Provides `setState()` and `forceUpdate()`, which
8
+ * trigger rendering
9
+ * @param {object} props The initial component props
10
+ * @param {object} context The initial context from parent components'
11
+ * getChildContext
12
+ */
13
+ export function Component(props, context) {
14
+ this.props = props;
15
+ this.context = context;
16
+ }
17
+
18
+ /**
19
+ * Update component state and schedule a re-render.
20
+ * @this {import('./internal').Component}
21
+ * @param {object | ((s: object, p: object) => object)} update A hash of state
22
+ * properties to update with new values or a function that given the current
23
+ * state and props returns a new partial state
24
+ * @param {() => void} [callback] A function to be called once component state is
25
+ * updated
26
+ */
27
+ Component.prototype.setState = function(update, callback) {
28
+ // only clone state when copying to nextState the first time.
29
+ let s;
30
+ if (this._nextState != null && this._nextState !== this.state) {
31
+ s = this._nextState;
32
+ } else {
33
+ s = this._nextState = assign({}, this.state);
34
+ }
35
+
36
+ if (typeof update == 'function') {
37
+ // Some libraries like `immer` mark the current state as readonly,
38
+ // preventing us from mutating it, so we need to clone it. See #2716
39
+ update = update(assign({}, s), this.props);
40
+ }
41
+
42
+ if (update) {
43
+ assign(s, update);
44
+ }
45
+
46
+ // Skip update if updater function returned null
47
+ if (update == null) return;
48
+
49
+ if (this._vnode) {
50
+ if (callback) this._renderCallbacks.push(callback);
51
+ enqueueRender(this);
52
+ }
53
+ };
54
+
55
+ /**
56
+ * Immediately perform a synchronous re-render of the component
57
+ * @this {import('./internal').Component}
58
+ * @param {() => void} [callback] A function to be called after component is
59
+ * re-rendered
60
+ */
61
+ Component.prototype.forceUpdate = function(callback) {
62
+ if (this._vnode) {
63
+ // Set render mode so that we can differentiate where the render request
64
+ // is coming from. We need this because forceUpdate should never call
65
+ // shouldComponentUpdate
66
+ this._force = true;
67
+ if (callback) this._renderCallbacks.push(callback);
68
+ enqueueRender(this);
69
+ }
70
+ };
71
+
72
+ /**
73
+ * Accepts `props` and `state`, and returns a new Virtual DOM tree to build.
74
+ * Virtual DOM is generally constructed via [JSX](http://jasonformat.com/wtf-is-jsx).
75
+ * @param {object} props Props (eg: JSX attributes) received from parent
76
+ * element/component
77
+ * @param {object} state The component's current state
78
+ * @param {object} context Context object, as returned by the nearest
79
+ * ancestor's `getChildContext()`
80
+ * @returns {import('./index').ComponentChildren | void}
81
+ */
82
+ Component.prototype.render = Fragment;
83
+
84
+ /**
85
+ * @param {import('./internal').VNode} vnode
86
+ * @param {number | null} [childIndex]
87
+ */
88
+ export function getDomSibling(vnode, childIndex) {
89
+ if (childIndex == null) {
90
+ // Use childIndex==null as a signal to resume the search from the vnode's sibling
91
+ return vnode._parent
92
+ ? getDomSibling(vnode._parent, vnode._parent._children.indexOf(vnode) + 1)
93
+ : null;
94
+ }
95
+
96
+ let sibling;
97
+ for (; childIndex < vnode._children.length; childIndex++) {
98
+ sibling = vnode._children[childIndex];
99
+
100
+ if (sibling != null && sibling._dom != null) {
101
+ // Since updateParentDomPointers keeps _dom pointer correct,
102
+ // we can rely on _dom to tell us if this subtree contains a
103
+ // rendered DOM node, and what the first rendered DOM node is
104
+ return sibling._dom;
105
+ }
106
+ }
107
+
108
+ // If we get here, we have not found a DOM node in this vnode's children.
109
+ // We must resume from this vnode's sibling (in it's parent _children array)
110
+ // Only climb up and search the parent if we aren't searching through a DOM
111
+ // VNode (meaning we reached the DOM parent of the original vnode that began
112
+ // the search)
113
+ return typeof vnode.type == 'function' ? getDomSibling(vnode) : null;
114
+ }
115
+
116
+ /**
117
+ * Trigger in-place re-rendering of a component.
118
+ * @param {import('./internal').Component} component The component to rerender
119
+ */
120
+ function renderComponent(component) {
121
+ let vnode = component._vnode,
122
+ oldDom = vnode._dom,
123
+ parentDom = component._parentDom;
124
+
125
+ if (parentDom) {
126
+ let commitQueue = [];
127
+ const oldVNode = assign({}, vnode);
128
+ oldVNode._original = vnode._original + 1;
129
+
130
+ diff(
131
+ parentDom,
132
+ vnode,
133
+ oldVNode,
134
+ component._globalContext,
135
+ parentDom.ownerSVGElement !== undefined,
136
+ vnode._hydrating != null ? [oldDom] : null,
137
+ commitQueue,
138
+ oldDom == null ? getDomSibling(vnode) : oldDom,
139
+ vnode._hydrating
140
+ );
141
+ commitRoot(commitQueue, vnode);
142
+
143
+ if (vnode._dom != oldDom) {
144
+ updateParentDomPointers(vnode);
145
+ }
146
+ }
147
+ }
148
+
149
+ /**
150
+ * @param {import('./internal').VNode} vnode
151
+ */
152
+ function updateParentDomPointers(vnode) {
153
+ if ((vnode = vnode._parent) != null && vnode._component != null) {
154
+ vnode._dom = vnode._component.base = null;
155
+ for (let i = 0; i < vnode._children.length; i++) {
156
+ let child = vnode._children[i];
157
+ if (child != null && child._dom != null) {
158
+ vnode._dom = vnode._component.base = child._dom;
159
+ break;
160
+ }
161
+ }
162
+
163
+ return updateParentDomPointers(vnode);
164
+ }
165
+ }
166
+
167
+ /**
168
+ * The render queue
169
+ * @type {Array<import('./internal').Component>}
170
+ */
171
+ let rerenderQueue = [];
172
+
173
+ /**
174
+ * Asynchronously schedule a callback
175
+ * @type {(cb: () => void) => void}
176
+ */
177
+ /* istanbul ignore next */
178
+ // Note the following line isn't tree-shaken by rollup cuz of rollup/rollup#2566
179
+ const defer =
180
+ typeof Promise == 'function'
181
+ ? Promise.prototype.then.bind(Promise.resolve())
182
+ : setTimeout;
183
+
184
+ /*
185
+ * The value of `Component.debounce` must asynchronously invoke the passed in callback. It is
186
+ * important that contributors to Preact can consistently reason about what calls to `setState`, etc.
187
+ * do, and when their effects will be applied. See the links below for some further reading on designing
188
+ * asynchronous APIs.
189
+ * * [Designing APIs for Asynchrony](https://blog.izs.me/2013/08/designing-apis-for-asynchrony)
190
+ * * [Callbacks synchronous and asynchronous](https://blog.ometer.com/2011/07/24/callbacks-synchronous-and-asynchronous/)
191
+ */
192
+
193
+ let prevDebounce;
194
+
195
+ /**
196
+ * Enqueue a rerender of a component
197
+ * @param {import('./internal').Component} c The component to rerender
198
+ */
199
+ export function enqueueRender(c) {
200
+ if (
201
+ (!c._dirty &&
202
+ (c._dirty = true) &&
203
+ rerenderQueue.push(c) &&
204
+ !process._rerenderCount++) ||
205
+ prevDebounce !== options.debounceRendering
206
+ ) {
207
+ prevDebounce = options.debounceRendering;
208
+ (prevDebounce || defer)(process);
209
+ }
210
+ }
211
+
212
+ /** Flush the render queue by rerendering all queued components */
213
+ function process() {
214
+ let queue;
215
+ while ((process._rerenderCount = rerenderQueue.length)) {
216
+ queue = rerenderQueue.sort((a, b) => a._vnode._depth - b._vnode._depth);
217
+ rerenderQueue = [];
218
+ // Don't update `renderCount` yet. Keep its value non-zero to prevent unnecessary
219
+ // process() calls from getting scheduled while `queue` is still being consumed.
220
+ queue.some(c => {
221
+ if (c._dirty) renderComponent(c);
222
+ });
223
+ }
224
+ }
225
+ process._rerenderCount = 0;
@@ -0,0 +1,3 @@
1
+ export const EMPTY_OBJ = {};
2
+ export const EMPTY_ARR = [];
3
+ export const IS_NON_DIMENSIONAL = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;
@@ -0,0 +1,68 @@
1
+ import { enqueueRender } from './component';
2
+
3
+ export let i = 0;
4
+
5
+ export function createContext(defaultValue, contextId) {
6
+ contextId = '__cC' + i++;
7
+
8
+ const context = {
9
+ _id: contextId,
10
+ _defaultValue: defaultValue,
11
+ /** @type {import('./internal').FunctionComponent} */
12
+ Consumer(props, contextValue) {
13
+ // return props.children(
14
+ // context[contextId] ? context[contextId].props.value : defaultValue
15
+ // );
16
+ return props.children(contextValue);
17
+ },
18
+ /** @type {import('./internal').FunctionComponent} */
19
+ Provider(props) {
20
+ if (!this.getChildContext) {
21
+ let subs = [];
22
+ let ctx = {};
23
+ ctx[contextId] = this;
24
+
25
+ this.getChildContext = () => ctx;
26
+
27
+ this.shouldComponentUpdate = function(_props) {
28
+ if (this.props.value !== _props.value) {
29
+ // I think the forced value propagation here was only needed when `options.debounceRendering` was being bypassed:
30
+ // https://github.com/preactjs/preact/commit/4d339fb803bea09e9f198abf38ca1bf8ea4b7771#diff-54682ce380935a717e41b8bfc54737f6R358
31
+ // In those cases though, even with the value corrected, we're double-rendering all nodes.
32
+ // It might be better to just tell folks not to use force-sync mode.
33
+ // Currently, using `useContext()` in a class component will overwrite its `this.context` value.
34
+ // subs.some(c => {
35
+ // c.context = _props.value;
36
+ // enqueueRender(c);
37
+ // });
38
+
39
+ // subs.some(c => {
40
+ // c.context[contextId] = _props.value;
41
+ // enqueueRender(c);
42
+ // });
43
+ subs.some(enqueueRender);
44
+ }
45
+ };
46
+
47
+ this.sub = c => {
48
+ subs.push(c);
49
+ let old = c.componentWillUnmount;
50
+ c.componentWillUnmount = () => {
51
+ subs.splice(subs.indexOf(c), 1);
52
+ if (old) old.call(c);
53
+ };
54
+ };
55
+ }
56
+
57
+ return props.children;
58
+ }
59
+ };
60
+
61
+ // Devtools needs access to the context object when it
62
+ // encounters a Provider. This is necessary to support
63
+ // setting `displayName` on the context object instead
64
+ // of on the component itself. See:
65
+ // https://reactjs.org/docs/context.html#contextdisplayname
66
+
67
+ return (context.Provider._contextRef = context.Consumer.contextType = context);
68
+ }
@@ -0,0 +1,100 @@
1
+ import options from './options';
2
+
3
+ /**
4
+ * Create an virtual node (used for JSX)
5
+ * @param {import('./internal').VNode["type"]} type The node name or Component
6
+ * constructor for this virtual node
7
+ * @param {object | null | undefined} [props] The properties of the virtual node
8
+ * @param {Array<import('.').ComponentChildren>} [children] The children of the virtual node
9
+ * @returns {import('./internal').VNode}
10
+ */
11
+ export function createElement(type, props, children) {
12
+ let normalizedProps = {},
13
+ key,
14
+ ref,
15
+ i;
16
+ for (i in props) {
17
+ if (i == 'key') key = props[i];
18
+ else if (i == 'ref') ref = props[i];
19
+ else normalizedProps[i] = props[i];
20
+ }
21
+
22
+ if (arguments.length > 3) {
23
+ children = [children];
24
+ // https://github.com/preactjs/preact/issues/1916
25
+ for (i = 3; i < arguments.length; i++) {
26
+ children.push(arguments[i]);
27
+ }
28
+ }
29
+ if (children != null) {
30
+ normalizedProps.children = children;
31
+ }
32
+
33
+ // If a Component VNode, check for and apply defaultProps
34
+ // Note: type may be undefined in development, must never error here.
35
+ if (typeof type == 'function' && type.defaultProps != null) {
36
+ for (i in type.defaultProps) {
37
+ if (normalizedProps[i] === undefined) {
38
+ normalizedProps[i] = type.defaultProps[i];
39
+ }
40
+ }
41
+ }
42
+
43
+ return createVNode(type, normalizedProps, key, ref, null);
44
+ }
45
+
46
+ /**
47
+ * Create a VNode (used internally by Preact)
48
+ * @param {import('./internal').VNode["type"]} type The node name or Component
49
+ * Constructor for this virtual node
50
+ * @param {object | string | number | null} props The properties of this virtual node.
51
+ * If this virtual node represents a text node, this is the text of the node (string or number).
52
+ * @param {string | number | null} key The key for this virtual node, used when
53
+ * diffing it against its children
54
+ * @param {import('./internal').VNode["ref"]} ref The ref property that will
55
+ * receive a reference to its created child
56
+ * @returns {import('./internal').VNode}
57
+ */
58
+ export function createVNode(type, props, key, ref, original) {
59
+ // V8 seems to be better at detecting type shapes if the object is allocated from the same call site
60
+ // Do not inline into createElement and coerceToVNode!
61
+ const vnode = {
62
+ type,
63
+ props,
64
+ key,
65
+ ref,
66
+ _children: null,
67
+ _parent: null,
68
+ _depth: 0,
69
+ _dom: null,
70
+ // _nextDom must be initialized to undefined b/c it will eventually
71
+ // be set to dom.nextSibling which can return `null` and it is important
72
+ // to be able to distinguish between an uninitialized _nextDom and
73
+ // a _nextDom that has been set to `null`
74
+ _nextDom: undefined,
75
+ _component: null,
76
+ _hydrating: null,
77
+ constructor: undefined,
78
+ _original: original == null ? ++options._vnodeId : original
79
+ };
80
+
81
+ if (options.vnode != null) options.vnode(vnode);
82
+
83
+ return vnode;
84
+ }
85
+
86
+ export function createRef() {
87
+ return { current: null };
88
+ }
89
+
90
+ export function Fragment(props) {
91
+ return props.children;
92
+ }
93
+
94
+ /**
95
+ * Check if a the argument is a valid Preact VNode.
96
+ * @param {*} vnode
97
+ * @returns {vnode is import('./internal').VNode}
98
+ */
99
+ export const isValidElement = vnode =>
100
+ vnode != null && vnode.constructor === undefined;
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Find the closest error boundary to a thrown error and call it
3
+ * @param {object} error The thrown value
4
+ * @param {import('../internal').VNode} vnode The vnode that threw
5
+ * the error that was caught (except for unmounting when this parameter
6
+ * is the highest parent that was being unmounted)
7
+ */
8
+ export function _catchError(error, vnode) {
9
+ /** @type {import('../internal').Component} */
10
+ let component, ctor, handled;
11
+
12
+ for (; (vnode = vnode._parent); ) {
13
+ if ((component = vnode._component) && !component._processingException) {
14
+ try {
15
+ ctor = component.constructor;
16
+
17
+ if (ctor && ctor.getDerivedStateFromError != null) {
18
+ component.setState(ctor.getDerivedStateFromError(error));
19
+ handled = component._dirty;
20
+ }
21
+
22
+ if (component.componentDidCatch != null) {
23
+ component.componentDidCatch(error);
24
+ handled = component._dirty;
25
+ }
26
+
27
+ // This is an error boundary. Mark it as having bailed out, and whether it was mid-hydration.
28
+ if (handled) {
29
+ return (component._pendingError = component);
30
+ }
31
+ } catch (e) {
32
+ error = e;
33
+ }
34
+ }
35
+ }
36
+
37
+ throw error;
38
+ }