@bpmn-io/properties-panel 0.9.0 → 0.10.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 (180) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/index.esm.js +1607 -0
  3. package/dist/index.esm.js.map +1 -0
  4. package/dist/index.js +1648 -0
  5. package/dist/index.js.map +1 -0
  6. package/package.json +16 -7
  7. package/preact/LICENSE +21 -0
  8. package/preact/README.md +185 -0
  9. package/preact/compat/dist/compat.js +2 -0
  10. package/preact/compat/dist/compat.js.map +1 -0
  11. package/preact/compat/dist/compat.mjs +2 -0
  12. package/preact/compat/dist/compat.module.js +2 -0
  13. package/preact/compat/dist/compat.module.js.map +1 -0
  14. package/preact/compat/dist/compat.umd.js +2 -0
  15. package/preact/compat/dist/compat.umd.js.map +1 -0
  16. package/preact/compat/jsx-dev-runtime.js +1 -0
  17. package/preact/compat/jsx-dev-runtime.mjs +1 -0
  18. package/preact/compat/jsx-runtime.js +1 -0
  19. package/preact/compat/jsx-runtime.mjs +1 -0
  20. package/preact/compat/package.json +19 -0
  21. package/preact/compat/server.js +15 -0
  22. package/preact/compat/server.mjs +4 -0
  23. package/preact/compat/src/Children.js +21 -0
  24. package/preact/compat/src/PureComponent.js +15 -0
  25. package/preact/compat/src/forwardRef.js +51 -0
  26. package/preact/compat/src/index.d.ts +140 -0
  27. package/preact/compat/src/index.js +175 -0
  28. package/preact/compat/src/internal.d.ts +47 -0
  29. package/preact/compat/src/memo.js +34 -0
  30. package/preact/compat/src/portals.js +80 -0
  31. package/preact/compat/src/render.js +219 -0
  32. package/preact/compat/src/scheduler.js +24 -0
  33. package/preact/compat/src/suspense-list.d.ts +14 -0
  34. package/preact/compat/src/suspense-list.js +126 -0
  35. package/preact/compat/src/suspense.d.ts +15 -0
  36. package/preact/compat/src/suspense.js +270 -0
  37. package/preact/compat/src/util.js +28 -0
  38. package/preact/compat/test-utils.js +1 -0
  39. package/preact/debug/dist/debug.js +2 -0
  40. package/preact/debug/dist/debug.js.map +1 -0
  41. package/preact/debug/dist/debug.mjs +2 -0
  42. package/preact/debug/dist/debug.module.js +2 -0
  43. package/preact/debug/dist/debug.module.js.map +1 -0
  44. package/preact/debug/dist/debug.umd.js +2 -0
  45. package/preact/debug/dist/debug.umd.js.map +1 -0
  46. package/preact/debug/package.json +18 -0
  47. package/preact/debug/src/check-props.js +54 -0
  48. package/preact/debug/src/component-stack.js +146 -0
  49. package/preact/debug/src/constants.js +3 -0
  50. package/preact/debug/src/debug.js +442 -0
  51. package/preact/debug/src/index.js +6 -0
  52. package/preact/debug/src/internal.d.ts +82 -0
  53. package/preact/debug/src/util.js +11 -0
  54. package/preact/devtools/dist/devtools.js +2 -0
  55. package/preact/devtools/dist/devtools.js.map +1 -0
  56. package/preact/devtools/dist/devtools.mjs +2 -0
  57. package/preact/devtools/dist/devtools.module.js +2 -0
  58. package/preact/devtools/dist/devtools.module.js.map +1 -0
  59. package/preact/devtools/dist/devtools.umd.js +2 -0
  60. package/preact/devtools/dist/devtools.umd.js.map +1 -0
  61. package/preact/devtools/package.json +16 -0
  62. package/preact/devtools/src/devtools.js +10 -0
  63. package/preact/devtools/src/index.d.ts +8 -0
  64. package/preact/devtools/src/index.js +15 -0
  65. package/preact/dist/preact.js +2 -0
  66. package/preact/dist/preact.js.map +1 -0
  67. package/preact/dist/preact.min.js +2 -0
  68. package/preact/dist/preact.min.js.map +1 -0
  69. package/preact/dist/preact.mjs +2 -0
  70. package/preact/dist/preact.module.js +2 -0
  71. package/preact/dist/preact.module.js.map +1 -0
  72. package/preact/dist/preact.umd.js +2 -0
  73. package/preact/dist/preact.umd.js.map +1 -0
  74. package/preact/hooks/dist/hooks.js +2 -0
  75. package/preact/hooks/dist/hooks.js.map +1 -0
  76. package/preact/hooks/dist/hooks.mjs +2 -0
  77. package/preact/hooks/dist/hooks.module.js +2 -0
  78. package/preact/hooks/dist/hooks.module.js.map +1 -0
  79. package/preact/hooks/dist/hooks.umd.js +2 -0
  80. package/preact/hooks/dist/hooks.umd.js.map +1 -0
  81. package/preact/hooks/package.json +26 -0
  82. package/preact/hooks/src/index.d.ts +130 -0
  83. package/preact/hooks/src/index.js +386 -0
  84. package/preact/hooks/src/internal.d.ts +75 -0
  85. package/preact/jsx-runtime/dist/jsxRuntime.js +2 -0
  86. package/preact/jsx-runtime/dist/jsxRuntime.js.map +1 -0
  87. package/preact/jsx-runtime/dist/jsxRuntime.mjs +2 -0
  88. package/preact/jsx-runtime/dist/jsxRuntime.module.js +2 -0
  89. package/preact/jsx-runtime/dist/jsxRuntime.module.js.map +1 -0
  90. package/preact/jsx-runtime/dist/jsxRuntime.umd.js +2 -0
  91. package/preact/jsx-runtime/dist/jsxRuntime.umd.js.map +1 -0
  92. package/preact/jsx-runtime/package.json +19 -0
  93. package/preact/jsx-runtime/src/index.d.ts +50 -0
  94. package/preact/jsx-runtime/src/index.js +72 -0
  95. package/preact/package.json +268 -0
  96. package/preact/src/cjs.js +3 -0
  97. package/preact/src/clone-element.js +39 -0
  98. package/preact/src/component.js +225 -0
  99. package/preact/src/constants.js +3 -0
  100. package/preact/src/create-context.js +68 -0
  101. package/preact/src/create-element.js +100 -0
  102. package/preact/src/diff/catch-error.js +38 -0
  103. package/preact/src/diff/children.js +347 -0
  104. package/preact/src/diff/index.js +516 -0
  105. package/preact/src/diff/props.js +158 -0
  106. package/preact/src/index.d.ts +310 -0
  107. package/preact/src/index.js +13 -0
  108. package/preact/src/internal.d.ts +147 -0
  109. package/preact/src/jsx.d.ts +955 -0
  110. package/preact/src/options.js +17 -0
  111. package/preact/src/render.js +74 -0
  112. package/preact/src/util.js +23 -0
  113. package/preact/test-utils/dist/testUtils.js +2 -0
  114. package/preact/test-utils/dist/testUtils.js.map +1 -0
  115. package/preact/test-utils/dist/testUtils.mjs +2 -0
  116. package/preact/test-utils/dist/testUtils.module.js +2 -0
  117. package/preact/test-utils/dist/testUtils.module.js.map +1 -0
  118. package/preact/test-utils/dist/testUtils.umd.js +2 -0
  119. package/preact/test-utils/dist/testUtils.umd.js.map +1 -0
  120. package/preact/test-utils/package.json +19 -0
  121. package/preact/test-utils/src/index.d.ts +3 -0
  122. package/preact/test-utils/src/index.js +117 -0
  123. package/lib/PropertiesPanel.js +0 -166
  124. package/lib/PropertiesPanel.js.map +0 -1
  125. package/lib/components/DropdownButton.js +0 -109
  126. package/lib/components/DropdownButton.js.map +0 -1
  127. package/lib/components/Group.js +0 -75
  128. package/lib/components/Group.js.map +0 -1
  129. package/lib/components/Header.js +0 -49
  130. package/lib/components/Header.js.map +0 -1
  131. package/lib/components/HeaderButton.js +0 -16
  132. package/lib/components/HeaderButton.js.map +0 -1
  133. package/lib/components/ListGroup.js +0 -167
  134. package/lib/components/ListGroup.js.map +0 -1
  135. package/lib/components/ListItem.js +0 -37
  136. package/lib/components/ListItem.js.map +0 -1
  137. package/lib/components/entries/Checkbox.js +0 -83
  138. package/lib/components/entries/Checkbox.js.map +0 -1
  139. package/lib/components/entries/Collapsible.js +0 -48
  140. package/lib/components/entries/Collapsible.js.map +0 -1
  141. package/lib/components/entries/Description.js +0 -26
  142. package/lib/components/entries/Description.js.map +0 -1
  143. package/lib/components/entries/List.js +0 -204
  144. package/lib/components/entries/List.js.map +0 -1
  145. package/lib/components/entries/NumberField.js +0 -110
  146. package/lib/components/entries/NumberField.js.map +0 -1
  147. package/lib/components/entries/Select.js +0 -110
  148. package/lib/components/entries/Select.js.map +0 -1
  149. package/lib/components/entries/Simple.js +0 -56
  150. package/lib/components/entries/Simple.js.map +0 -1
  151. package/lib/components/entries/TextArea.js +0 -98
  152. package/lib/components/entries/TextArea.js.map +0 -1
  153. package/lib/components/entries/TextField.js +0 -123
  154. package/lib/components/entries/TextField.js.map +0 -1
  155. package/lib/components/entries/ToggleSwitch.js +0 -91
  156. package/lib/components/entries/ToggleSwitch.js.map +0 -1
  157. package/lib/components/icons/index.js +0 -51
  158. package/lib/components/icons/index.js.map +0 -1
  159. package/lib/context/DescriptionContext.js +0 -7
  160. package/lib/context/DescriptionContext.js.map +0 -1
  161. package/lib/context/LayoutContext.js +0 -9
  162. package/lib/context/LayoutContext.js.map +0 -1
  163. package/lib/context/index.js +0 -3
  164. package/lib/context/index.js.map +0 -1
  165. package/lib/features/debounce-input/debounceInput.js +0 -14
  166. package/lib/features/debounce-input/debounceInput.js.map +0 -1
  167. package/lib/features/debounce-input/index.js +0 -5
  168. package/lib/features/debounce-input/index.js.map +0 -1
  169. package/lib/hooks/index.js +0 -5
  170. package/lib/hooks/index.js.map +0 -1
  171. package/lib/hooks/useDescriptionContext.js +0 -25
  172. package/lib/hooks/useDescriptionContext.js.map +0 -1
  173. package/lib/hooks/useKeyFactory.js +0 -39
  174. package/lib/hooks/useKeyFactory.js.map +0 -1
  175. package/lib/hooks/useLayoutState.js +0 -36
  176. package/lib/hooks/useLayoutState.js.map +0 -1
  177. package/lib/hooks/usePrevious.js +0 -16
  178. package/lib/hooks/usePrevious.js.map +0 -1
  179. package/lib/index.js +0 -2
  180. package/lib/index.js.map +0 -1
@@ -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
+ }
@@ -0,0 +1,347 @@
1
+ import { diff, unmount, applyRef } from './index';
2
+ import { createVNode, Fragment } from '../create-element';
3
+ import { EMPTY_OBJ, EMPTY_ARR } from '../constants';
4
+ import { getDomSibling } from '../component';
5
+
6
+ /**
7
+ * Diff the children of a virtual node
8
+ * @param {import('../internal').PreactElement} parentDom The DOM element whose
9
+ * children are being diffed
10
+ * @param {import('../internal').ComponentChildren[]} renderResult
11
+ * @param {import('../internal').VNode} newParentVNode The new virtual
12
+ * node whose children should be diff'ed against oldParentVNode
13
+ * @param {import('../internal').VNode} oldParentVNode The old virtual
14
+ * node whose children should be diff'ed against newParentVNode
15
+ * @param {object} globalContext The current context object - modified by getChildContext
16
+ * @param {boolean} isSvg Whether or not this DOM node is an SVG node
17
+ * @param {Array<import('../internal').PreactElement>} excessDomChildren
18
+ * @param {Array<import('../internal').Component>} commitQueue List of components
19
+ * which have callbacks to invoke in commitRoot
20
+ * @param {import('../internal').PreactElement} oldDom The current attached DOM
21
+ * element any new dom elements should be placed around. Likely `null` on first
22
+ * render (except when hydrating). Can be a sibling DOM element when diffing
23
+ * Fragments that have siblings. In most cases, it starts out as `oldChildren[0]._dom`.
24
+ * @param {boolean} isHydrating Whether or not we are in hydration
25
+ */
26
+ export function diffChildren(
27
+ parentDom,
28
+ renderResult,
29
+ newParentVNode,
30
+ oldParentVNode,
31
+ globalContext,
32
+ isSvg,
33
+ excessDomChildren,
34
+ commitQueue,
35
+ oldDom,
36
+ isHydrating
37
+ ) {
38
+ let i, j, oldVNode, childVNode, newDom, firstChildDom, refs;
39
+
40
+ // This is a compression of oldParentVNode!=null && oldParentVNode != EMPTY_OBJ && oldParentVNode._children || EMPTY_ARR
41
+ // as EMPTY_OBJ._children should be `undefined`.
42
+ let oldChildren = (oldParentVNode && oldParentVNode._children) || EMPTY_ARR;
43
+
44
+ let oldChildrenLength = oldChildren.length;
45
+
46
+ newParentVNode._children = [];
47
+ for (i = 0; i < renderResult.length; i++) {
48
+ childVNode = renderResult[i];
49
+
50
+ if (childVNode == null || typeof childVNode == 'boolean') {
51
+ childVNode = newParentVNode._children[i] = null;
52
+ }
53
+ // If this newVNode is being reused (e.g. <div>{reuse}{reuse}</div>) in the same diff,
54
+ // or we are rendering a component (e.g. setState) copy the oldVNodes so it can have
55
+ // it's own DOM & etc. pointers
56
+ else if (
57
+ typeof childVNode == 'string' ||
58
+ typeof childVNode == 'number' ||
59
+ // eslint-disable-next-line valid-typeof
60
+ typeof childVNode == 'bigint'
61
+ ) {
62
+ childVNode = newParentVNode._children[i] = createVNode(
63
+ null,
64
+ childVNode,
65
+ null,
66
+ null,
67
+ childVNode
68
+ );
69
+ } else if (Array.isArray(childVNode)) {
70
+ childVNode = newParentVNode._children[i] = createVNode(
71
+ Fragment,
72
+ { children: childVNode },
73
+ null,
74
+ null,
75
+ null
76
+ );
77
+ } else if (childVNode._depth > 0) {
78
+ // VNode is already in use, clone it. This can happen in the following
79
+ // scenario:
80
+ // const reuse = <div />
81
+ // <div>{reuse}<span />{reuse}</div>
82
+ childVNode = newParentVNode._children[i] = createVNode(
83
+ childVNode.type,
84
+ childVNode.props,
85
+ childVNode.key,
86
+ null,
87
+ childVNode._original
88
+ );
89
+ } else {
90
+ childVNode = newParentVNode._children[i] = childVNode;
91
+ }
92
+
93
+ // Terser removes the `continue` here and wraps the loop body
94
+ // in a `if (childVNode) { ... } condition
95
+ if (childVNode == null) {
96
+ continue;
97
+ }
98
+
99
+ childVNode._parent = newParentVNode;
100
+ childVNode._depth = newParentVNode._depth + 1;
101
+
102
+ // Check if we find a corresponding element in oldChildren.
103
+ // If found, delete the array item by setting to `undefined`.
104
+ // We use `undefined`, as `null` is reserved for empty placeholders
105
+ // (holes).
106
+ oldVNode = oldChildren[i];
107
+
108
+ if (
109
+ oldVNode === null ||
110
+ (oldVNode &&
111
+ childVNode.key == oldVNode.key &&
112
+ childVNode.type === oldVNode.type)
113
+ ) {
114
+ oldChildren[i] = undefined;
115
+ } else {
116
+ // Either oldVNode === undefined or oldChildrenLength > 0,
117
+ // so after this loop oldVNode == null or oldVNode is a valid value.
118
+ for (j = 0; j < oldChildrenLength; j++) {
119
+ oldVNode = oldChildren[j];
120
+ // If childVNode is unkeyed, we only match similarly unkeyed nodes, otherwise we match by key.
121
+ // We always match by type (in either case).
122
+ if (
123
+ oldVNode &&
124
+ childVNode.key == oldVNode.key &&
125
+ childVNode.type === oldVNode.type
126
+ ) {
127
+ oldChildren[j] = undefined;
128
+ break;
129
+ }
130
+ oldVNode = null;
131
+ }
132
+ }
133
+
134
+ oldVNode = oldVNode || EMPTY_OBJ;
135
+
136
+ // Morph the old element into the new one, but don't append it to the dom yet
137
+ diff(
138
+ parentDom,
139
+ childVNode,
140
+ oldVNode,
141
+ globalContext,
142
+ isSvg,
143
+ excessDomChildren,
144
+ commitQueue,
145
+ oldDom,
146
+ isHydrating
147
+ );
148
+
149
+ newDom = childVNode._dom;
150
+
151
+ if ((j = childVNode.ref) && oldVNode.ref != j) {
152
+ if (!refs) refs = [];
153
+ if (oldVNode.ref) refs.push(oldVNode.ref, null, childVNode);
154
+ refs.push(j, childVNode._component || newDom, childVNode);
155
+ }
156
+
157
+ if (newDom != null) {
158
+ if (firstChildDom == null) {
159
+ firstChildDom = newDom;
160
+ }
161
+
162
+ if (
163
+ typeof childVNode.type == 'function' &&
164
+ childVNode._children != null && // Can be null if childVNode suspended
165
+ childVNode._children === oldVNode._children
166
+ ) {
167
+ childVNode._nextDom = oldDom = reorderChildren(
168
+ childVNode,
169
+ oldDom,
170
+ parentDom
171
+ );
172
+ } else {
173
+ oldDom = placeChild(
174
+ parentDom,
175
+ childVNode,
176
+ oldVNode,
177
+ oldChildren,
178
+ newDom,
179
+ oldDom
180
+ );
181
+ }
182
+
183
+ // Browsers will infer an option's `value` from `textContent` when
184
+ // no value is present. This essentially bypasses our code to set it
185
+ // later in `diff()`. It works fine in all browsers except for IE11
186
+ // where it breaks setting `select.value`. There it will be always set
187
+ // to an empty string. Re-applying an options value will fix that, so
188
+ // there are probably some internal data structures that aren't
189
+ // updated properly.
190
+ //
191
+ // To fix it we make sure to reset the inferred value, so that our own
192
+ // value check in `diff()` won't be skipped.
193
+ if (!isHydrating && newParentVNode.type === 'option') {
194
+ // @ts-ignore We have validated that the type of parentDOM is 'option'
195
+ // in the above check
196
+ parentDom.value = '';
197
+ } else if (typeof newParentVNode.type == 'function') {
198
+ // Because the newParentVNode is Fragment-like, we need to set it's
199
+ // _nextDom property to the nextSibling of its last child DOM node.
200
+ //
201
+ // `oldDom` contains the correct value here because if the last child
202
+ // is a Fragment-like, then oldDom has already been set to that child's _nextDom.
203
+ // If the last child is a DOM VNode, then oldDom will be set to that DOM
204
+ // node's nextSibling.
205
+ newParentVNode._nextDom = oldDom;
206
+ }
207
+ } else if (
208
+ oldDom &&
209
+ oldVNode._dom == oldDom &&
210
+ oldDom.parentNode != parentDom
211
+ ) {
212
+ // The above condition is to handle null placeholders. See test in placeholder.test.js:
213
+ // `efficiently replace null placeholders in parent rerenders`
214
+ oldDom = getDomSibling(oldVNode);
215
+ }
216
+ }
217
+
218
+ newParentVNode._dom = firstChildDom;
219
+
220
+ // Remove remaining oldChildren if there are any.
221
+ for (i = oldChildrenLength; i--; ) {
222
+ if (oldChildren[i] != null) {
223
+ if (
224
+ typeof newParentVNode.type == 'function' &&
225
+ oldChildren[i]._dom != null &&
226
+ oldChildren[i]._dom == newParentVNode._nextDom
227
+ ) {
228
+ // If the newParentVNode.__nextDom points to a dom node that is about to
229
+ // be unmounted, then get the next sibling of that vnode and set
230
+ // _nextDom to it
231
+ newParentVNode._nextDom = getDomSibling(oldParentVNode, i + 1);
232
+ }
233
+
234
+ unmount(oldChildren[i], oldChildren[i]);
235
+ }
236
+ }
237
+
238
+ // Set refs only after unmount
239
+ if (refs) {
240
+ for (i = 0; i < refs.length; i++) {
241
+ applyRef(refs[i], refs[++i], refs[++i]);
242
+ }
243
+ }
244
+ }
245
+
246
+ function reorderChildren(childVNode, oldDom, parentDom) {
247
+ for (let tmp = 0; tmp < childVNode._children.length; tmp++) {
248
+ let vnode = childVNode._children[tmp];
249
+ if (vnode) {
250
+ // We typically enter this code path on sCU bailout, where we copy
251
+ // oldVNode._children to newVNode._children. If that is the case, we need
252
+ // to update the old children's _parent pointer to point to the newVNode
253
+ // (childVNode here).
254
+ vnode._parent = childVNode;
255
+
256
+ if (typeof vnode.type == 'function') {
257
+ oldDom = reorderChildren(vnode, oldDom, parentDom);
258
+ } else {
259
+ oldDom = placeChild(
260
+ parentDom,
261
+ vnode,
262
+ vnode,
263
+ childVNode._children,
264
+ vnode._dom,
265
+ oldDom
266
+ );
267
+ }
268
+ }
269
+ }
270
+
271
+ return oldDom;
272
+ }
273
+
274
+ /**
275
+ * Flatten and loop through the children of a virtual node
276
+ * @param {import('../index').ComponentChildren} children The unflattened
277
+ * children of a virtual node
278
+ * @returns {import('../internal').VNode[]}
279
+ */
280
+ export function toChildArray(children, out) {
281
+ out = out || [];
282
+ if (children == null || typeof children == 'boolean') {
283
+ } else if (Array.isArray(children)) {
284
+ children.some(child => {
285
+ toChildArray(child, out);
286
+ });
287
+ } else {
288
+ out.push(children);
289
+ }
290
+ return out;
291
+ }
292
+
293
+ function placeChild(
294
+ parentDom,
295
+ childVNode,
296
+ oldVNode,
297
+ oldChildren,
298
+ newDom,
299
+ oldDom
300
+ ) {
301
+ let nextDom;
302
+ if (childVNode._nextDom !== undefined) {
303
+ // Only Fragments or components that return Fragment like VNodes will
304
+ // have a non-undefined _nextDom. Continue the diff from the sibling
305
+ // of last DOM child of this child VNode
306
+ nextDom = childVNode._nextDom;
307
+
308
+ // Eagerly cleanup _nextDom. We don't need to persist the value because
309
+ // it is only used by `diffChildren` to determine where to resume the diff after
310
+ // diffing Components and Fragments. Once we store it the nextDOM local var, we
311
+ // can clean up the property
312
+ childVNode._nextDom = undefined;
313
+ } else if (
314
+ oldVNode == null ||
315
+ newDom != oldDom ||
316
+ newDom.parentNode == null
317
+ ) {
318
+ outer: if (oldDom == null || oldDom.parentNode !== parentDom) {
319
+ parentDom.appendChild(newDom);
320
+ nextDom = null;
321
+ } else {
322
+ // `j<oldChildrenLength; j+=2` is an alternative to `j++<oldChildrenLength/2`
323
+ for (
324
+ let sibDom = oldDom, j = 0;
325
+ (sibDom = sibDom.nextSibling) && j < oldChildren.length;
326
+ j += 2
327
+ ) {
328
+ if (sibDom == newDom) {
329
+ break outer;
330
+ }
331
+ }
332
+ parentDom.insertBefore(newDom, oldDom);
333
+ nextDom = oldDom;
334
+ }
335
+ }
336
+
337
+ // If we have pre-calculated the nextDOM node, use it. Else calculate it now
338
+ // Strictly check for `undefined` here cuz `null` is a valid value of `nextDom`.
339
+ // See more detail in create-element.js:createVNode
340
+ if (nextDom !== undefined) {
341
+ oldDom = nextDom;
342
+ } else {
343
+ oldDom = newDom.nextSibling;
344
+ }
345
+
346
+ return oldDom;
347
+ }