@bpmn-io/properties-panel 2.2.0 → 3.0.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.
- package/assets/properties-panel.css +11 -6
- package/dist/index.esm.js +12 -64
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +12 -64
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
- package/preact/README.md +56 -51
- package/preact/compat/client.js +19 -0
- package/preact/compat/client.mjs +22 -0
- package/preact/compat/dist/compat.js +1 -1
- package/preact/compat/dist/compat.js.map +1 -1
- package/preact/compat/dist/compat.mjs +1 -1
- package/preact/compat/dist/compat.module.js +1 -1
- package/preact/compat/dist/compat.module.js.map +1 -1
- package/preact/compat/dist/compat.umd.js +1 -1
- package/preact/compat/dist/compat.umd.js.map +1 -1
- package/preact/compat/jsx-dev-runtime.js +2 -0
- package/preact/compat/jsx-dev-runtime.mjs +2 -0
- package/preact/compat/jsx-runtime.js +2 -0
- package/preact/compat/jsx-runtime.mjs +2 -0
- package/preact/compat/package.json +31 -0
- package/preact/compat/scheduler.js +15 -0
- package/preact/compat/{src/scheduler.js → scheduler.mjs} +8 -9
- package/preact/compat/server.browser.js +4 -0
- package/preact/compat/src/PureComponent.js +1 -1
- package/preact/compat/src/forwardRef.js +2 -9
- package/preact/compat/src/index.d.ts +58 -4
- package/preact/compat/src/index.js +73 -2
- package/preact/compat/src/portals.js +4 -2
- package/preact/compat/src/render.js +133 -76
- package/preact/compat/src/suspense-list.d.ts +2 -2
- package/preact/compat/src/suspense-list.js +14 -13
- package/preact/compat/src/suspense.d.ts +4 -4
- package/preact/compat/src/suspense.js +6 -6
- package/preact/compat/src/util.js +10 -0
- package/preact/debug/dist/debug.js +1 -1
- package/preact/debug/dist/debug.js.map +1 -1
- package/preact/debug/dist/debug.mjs +1 -1
- package/preact/debug/dist/debug.module.js +1 -1
- package/preact/debug/dist/debug.module.js.map +1 -1
- package/preact/debug/dist/debug.umd.js +1 -1
- package/preact/debug/dist/debug.umd.js.map +1 -1
- package/preact/debug/package.json +9 -0
- package/preact/debug/src/check-props.js +3 -3
- package/preact/debug/src/debug.js +38 -17
- package/preact/debug/src/index.d.ts +4 -0
- package/preact/debug/src/util.js +4 -0
- package/preact/devtools/dist/devtools.js +1 -1
- package/preact/devtools/dist/devtools.js.map +1 -1
- package/preact/devtools/dist/devtools.mjs +1 -1
- package/preact/devtools/dist/devtools.module.js +1 -1
- package/preact/devtools/dist/devtools.module.js.map +1 -1
- package/preact/devtools/dist/devtools.umd.js +1 -1
- package/preact/devtools/dist/devtools.umd.js.map +1 -1
- package/preact/devtools/package.json +23 -14
- package/preact/devtools/src/devtools.js +1 -1
- package/preact/dist/preact.js +1 -1
- package/preact/dist/preact.js.map +1 -1
- package/preact/dist/preact.min.js +1 -1
- package/preact/dist/preact.min.js.map +1 -1
- package/preact/dist/preact.min.module.js +2 -0
- package/preact/dist/preact.min.module.js.map +1 -0
- package/preact/dist/preact.min.umd.js +2 -0
- package/preact/dist/preact.min.umd.js.map +1 -0
- package/preact/dist/preact.mjs +1 -1
- package/preact/dist/preact.module.js +1 -1
- package/preact/dist/preact.module.js.map +1 -1
- package/preact/dist/preact.umd.js +1 -1
- package/preact/dist/preact.umd.js.map +1 -1
- package/preact/hooks/dist/hooks.js +1 -1
- package/preact/hooks/dist/hooks.js.map +1 -1
- package/preact/hooks/dist/hooks.mjs +1 -1
- package/preact/hooks/dist/hooks.module.js +1 -1
- package/preact/hooks/dist/hooks.module.js.map +1 -1
- package/preact/hooks/dist/hooks.umd.js +1 -1
- package/preact/hooks/dist/hooks.umd.js.map +1 -1
- package/preact/hooks/package.json +9 -0
- package/preact/hooks/src/index.d.ts +26 -14
- package/preact/hooks/src/index.js +169 -44
- package/preact/hooks/src/internal.d.ts +12 -2
- package/preact/jsx-runtime/dist/jsxRuntime.js +1 -1
- package/preact/jsx-runtime/dist/jsxRuntime.js.map +1 -1
- package/preact/jsx-runtime/dist/jsxRuntime.mjs +1 -1
- package/preact/jsx-runtime/dist/jsxRuntime.module.js +1 -1
- package/preact/jsx-runtime/dist/jsxRuntime.module.js.map +1 -1
- package/preact/jsx-runtime/dist/jsxRuntime.umd.js +1 -1
- package/preact/jsx-runtime/dist/jsxRuntime.umd.js.map +1 -1
- package/preact/jsx-runtime/package.json +26 -17
- package/preact/jsx-runtime/src/index.js +19 -13
- package/preact/package.json +315 -262
- package/preact/src/clone-element.js +16 -10
- package/preact/src/component.js +33 -23
- package/preact/src/constants.js +2 -1
- package/preact/src/create-context.js +8 -3
- package/preact/src/create-element.js +9 -11
- package/preact/src/diff/catch-error.js +4 -2
- package/preact/src/diff/children.js +41 -32
- package/preact/src/diff/index.js +81 -34
- package/preact/src/diff/props.js +15 -14
- package/preact/src/index.d.ts +369 -301
- package/preact/src/internal.d.ts +11 -2
- package/preact/src/jsx.d.ts +1862 -626
- package/preact/src/options.js +1 -2
- package/preact/src/render.js +5 -6
- package/preact/src/util.js +6 -0
- package/preact/test-utils/dist/testUtils.js +1 -1
- package/preact/test-utils/dist/testUtils.js.map +1 -1
- package/preact/test-utils/dist/testUtils.mjs +1 -1
- package/preact/test-utils/dist/testUtils.module.js +1 -1
- package/preact/test-utils/dist/testUtils.module.js.map +1 -1
- package/preact/test-utils/dist/testUtils.umd.js +1 -1
- package/preact/test-utils/dist/testUtils.umd.js.map +1 -1
- package/preact/test-utils/package.json +9 -0
- package/preact/test-utils/src/index.js +2 -1
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
} from '../..';
|
|
10
10
|
import {
|
|
11
11
|
useState,
|
|
12
|
+
useId,
|
|
12
13
|
useReducer,
|
|
13
14
|
useEffect,
|
|
14
15
|
useLayoutEffect,
|
|
@@ -26,15 +27,15 @@ import { Children } from './Children';
|
|
|
26
27
|
import { Suspense, lazy } from './suspense';
|
|
27
28
|
import { SuspenseList } from './suspense-list';
|
|
28
29
|
import { createPortal } from './portals';
|
|
30
|
+
import { is } from './util';
|
|
29
31
|
import {
|
|
30
32
|
hydrate,
|
|
31
33
|
render,
|
|
32
34
|
REACT_ELEMENT_TYPE,
|
|
33
35
|
__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED
|
|
34
36
|
} from './render';
|
|
35
|
-
export * from './scheduler';
|
|
36
37
|
|
|
37
|
-
const version = '
|
|
38
|
+
const version = '17.0.2'; // trick libraries to think we are react
|
|
38
39
|
|
|
39
40
|
/**
|
|
40
41
|
* Legacy version of createElement.
|
|
@@ -101,12 +102,74 @@ function findDOMNode(component) {
|
|
|
101
102
|
// eslint-disable-next-line camelcase
|
|
102
103
|
const unstable_batchedUpdates = (callback, arg) => callback(arg);
|
|
103
104
|
|
|
105
|
+
/**
|
|
106
|
+
* In React, `flushSync` flushes the entire tree and forces a rerender. It's
|
|
107
|
+
* implmented here as a no-op.
|
|
108
|
+
* @template Arg
|
|
109
|
+
* @template Result
|
|
110
|
+
* @param {(arg: Arg) => Result} callback function that runs before the flush
|
|
111
|
+
* @param {Arg} [arg] Optional argument that can be passed to the callback
|
|
112
|
+
* @returns
|
|
113
|
+
*/
|
|
114
|
+
const flushSync = (callback, arg) => callback(arg);
|
|
115
|
+
|
|
104
116
|
/**
|
|
105
117
|
* Strict Mode is not implemented in Preact, so we provide a stand-in for it
|
|
106
118
|
* that just renders its children without imposing any restrictions.
|
|
107
119
|
*/
|
|
108
120
|
const StrictMode = Fragment;
|
|
109
121
|
|
|
122
|
+
export function startTransition(cb) {
|
|
123
|
+
cb();
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export function useDeferredValue(val) {
|
|
127
|
+
return val;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export function useTransition() {
|
|
131
|
+
return [false, startTransition];
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// TODO: in theory this should be done after a VNode is diffed as we want to insert
|
|
135
|
+
// styles/... before it attaches
|
|
136
|
+
export const useInsertionEffect = useLayoutEffect;
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* This is taken from https://github.com/facebook/react/blob/main/packages/use-sync-external-store/src/useSyncExternalStoreShimClient.js#L84
|
|
140
|
+
* on a high level this cuts out the warnings, ... and attempts a smaller implementation
|
|
141
|
+
*/
|
|
142
|
+
export function useSyncExternalStore(subscribe, getSnapshot) {
|
|
143
|
+
const value = getSnapshot();
|
|
144
|
+
|
|
145
|
+
const [{ _instance }, forceUpdate] = useState({
|
|
146
|
+
_instance: { _value: value, _getSnapshot: getSnapshot }
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
useLayoutEffect(() => {
|
|
150
|
+
_instance._value = value;
|
|
151
|
+
_instance._getSnapshot = getSnapshot;
|
|
152
|
+
|
|
153
|
+
if (!is(_instance._value, getSnapshot())) {
|
|
154
|
+
forceUpdate({ _instance });
|
|
155
|
+
}
|
|
156
|
+
}, [subscribe, value, getSnapshot]);
|
|
157
|
+
|
|
158
|
+
useEffect(() => {
|
|
159
|
+
if (!is(_instance._value, _instance._getSnapshot())) {
|
|
160
|
+
forceUpdate({ _instance });
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
return subscribe(() => {
|
|
164
|
+
if (!is(_instance._value, _instance._getSnapshot())) {
|
|
165
|
+
forceUpdate({ _instance });
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
}, [subscribe]);
|
|
169
|
+
|
|
170
|
+
return value;
|
|
171
|
+
}
|
|
172
|
+
|
|
110
173
|
export * from '../../hooks';
|
|
111
174
|
export {
|
|
112
175
|
version,
|
|
@@ -127,6 +190,7 @@ export {
|
|
|
127
190
|
PureComponent,
|
|
128
191
|
memo,
|
|
129
192
|
forwardRef,
|
|
193
|
+
flushSync,
|
|
130
194
|
// eslint-disable-next-line camelcase
|
|
131
195
|
unstable_batchedUpdates,
|
|
132
196
|
StrictMode,
|
|
@@ -139,9 +203,15 @@ export {
|
|
|
139
203
|
// React copies the named exports to the default one.
|
|
140
204
|
export default {
|
|
141
205
|
useState,
|
|
206
|
+
useId,
|
|
142
207
|
useReducer,
|
|
143
208
|
useEffect,
|
|
144
209
|
useLayoutEffect,
|
|
210
|
+
useInsertionEffect,
|
|
211
|
+
useTransition,
|
|
212
|
+
useDeferredValue,
|
|
213
|
+
useSyncExternalStore,
|
|
214
|
+
startTransition,
|
|
145
215
|
useRef,
|
|
146
216
|
useImperativeHandle,
|
|
147
217
|
useMemo,
|
|
@@ -166,6 +236,7 @@ export default {
|
|
|
166
236
|
PureComponent,
|
|
167
237
|
memo,
|
|
168
238
|
forwardRef,
|
|
239
|
+
flushSync,
|
|
169
240
|
unstable_batchedUpdates,
|
|
170
241
|
StrictMode,
|
|
171
242
|
Suspense,
|
|
@@ -19,7 +19,7 @@ function Portal(props) {
|
|
|
19
19
|
const _this = this;
|
|
20
20
|
let container = props._container;
|
|
21
21
|
|
|
22
|
-
_this.componentWillUnmount = function() {
|
|
22
|
+
_this.componentWillUnmount = function () {
|
|
23
23
|
render(null, _this._temp);
|
|
24
24
|
_this._temp = null;
|
|
25
25
|
_this._container = null;
|
|
@@ -76,5 +76,7 @@ function Portal(props) {
|
|
|
76
76
|
* @param {import('./internal').PreactElement} container The DOM node to continue rendering in to.
|
|
77
77
|
*/
|
|
78
78
|
export function createPortal(vnode, container) {
|
|
79
|
-
|
|
79
|
+
const el = createElement(Portal, { _vnode: vnode, _container: container });
|
|
80
|
+
el.containerInfo = container;
|
|
81
|
+
return el;
|
|
80
82
|
}
|
|
@@ -10,15 +10,20 @@ export const REACT_ELEMENT_TYPE =
|
|
|
10
10
|
(typeof Symbol != 'undefined' && Symbol.for && Symbol.for('react.element')) ||
|
|
11
11
|
0xeac7;
|
|
12
12
|
|
|
13
|
-
const CAMEL_PROPS =
|
|
13
|
+
const CAMEL_PROPS =
|
|
14
|
+
/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/;
|
|
15
|
+
const ON_ANI = /^on(Ani|Tra|Tou|BeforeInp|Compo)/;
|
|
16
|
+
const CAMEL_REPLACE = /[A-Z0-9]/g;
|
|
17
|
+
|
|
18
|
+
const IS_DOM = typeof document !== 'undefined';
|
|
14
19
|
|
|
15
20
|
// Input types for which onchange should not be converted to oninput.
|
|
16
21
|
// type="file|checkbox|radio", plus "range" in IE11.
|
|
17
22
|
// (IE11 doesn't support Symbol, which we use here to turn `rad` into `ra` which matches "range")
|
|
18
23
|
const onChangeInputType = type =>
|
|
19
24
|
(typeof Symbol != 'undefined' && typeof Symbol() == 'symbol'
|
|
20
|
-
? /fil|che|rad/
|
|
21
|
-
: /fil|che|ra/
|
|
25
|
+
? /fil|che|rad/
|
|
26
|
+
: /fil|che|ra/
|
|
22
27
|
).test(type);
|
|
23
28
|
|
|
24
29
|
// Some libraries like `react-virtualized` explicitly check for this.
|
|
@@ -81,6 +86,7 @@ export function hydrate(vnode, parent, callback) {
|
|
|
81
86
|
let oldEventHook = options.event;
|
|
82
87
|
options.event = e => {
|
|
83
88
|
if (oldEventHook) e = oldEventHook(e);
|
|
89
|
+
|
|
84
90
|
e.persist = empty;
|
|
85
91
|
e.isPropagationStopped = isPropagationStopped;
|
|
86
92
|
e.isDefaultPrevented = isDefaultPrevented;
|
|
@@ -97,96 +103,125 @@ function isDefaultPrevented() {
|
|
|
97
103
|
return this.defaultPrevented;
|
|
98
104
|
}
|
|
99
105
|
|
|
100
|
-
|
|
106
|
+
const classNameDescriptorNonEnumberable = {
|
|
107
|
+
enumerable: false,
|
|
101
108
|
configurable: true,
|
|
102
109
|
get() {
|
|
103
110
|
return this.class;
|
|
104
111
|
}
|
|
105
112
|
};
|
|
106
113
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
let props = vnode.props;
|
|
111
|
-
let normalizedProps = props;
|
|
112
|
-
|
|
113
|
-
// only normalize props on Element nodes
|
|
114
|
-
if (typeof type === 'string') {
|
|
114
|
+
function handleDomVNode(vnode) {
|
|
115
|
+
let props = vnode.props,
|
|
116
|
+
type = vnode.type,
|
|
115
117
|
normalizedProps = {};
|
|
116
118
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
if (i === 'value' && 'defaultValue' in props && value == null) {
|
|
121
|
-
// Skip applying value if it is null/undefined and we already set
|
|
122
|
-
// a default value
|
|
123
|
-
continue;
|
|
124
|
-
} else if (
|
|
125
|
-
i === 'defaultValue' &&
|
|
126
|
-
'value' in props &&
|
|
127
|
-
props.value == null
|
|
128
|
-
) {
|
|
129
|
-
// `defaultValue` is treated as a fallback `value` when a value prop is present but null/undefined.
|
|
130
|
-
// `defaultValue` for Elements with no value prop is the same as the DOM defaultValue property.
|
|
131
|
-
i = 'value';
|
|
132
|
-
} else if (i === 'download' && value === true) {
|
|
133
|
-
// Calling `setAttribute` with a truthy value will lead to it being
|
|
134
|
-
// passed as a stringified value, e.g. `download="true"`. React
|
|
135
|
-
// converts it to an empty string instead, otherwise the attribute
|
|
136
|
-
// value will be used as the file name and the file will be called
|
|
137
|
-
// "true" upon downloading it.
|
|
138
|
-
value = '';
|
|
139
|
-
} else if (/ondoubleclick/i.test(i)) {
|
|
140
|
-
i = 'ondblclick';
|
|
141
|
-
} else if (
|
|
142
|
-
/^onchange(textarea|input)/i.test(i + type) &&
|
|
143
|
-
!onChangeInputType(props.type)
|
|
144
|
-
) {
|
|
145
|
-
i = 'oninput';
|
|
146
|
-
} else if (/^on(Ani|Tra|Tou|BeforeInp)/.test(i)) {
|
|
147
|
-
i = i.toLowerCase();
|
|
148
|
-
} else if (CAMEL_PROPS.test(i)) {
|
|
149
|
-
i = i.replace(/[A-Z0-9]/, '-$&').toLowerCase();
|
|
150
|
-
} else if (value === null) {
|
|
151
|
-
value = undefined;
|
|
152
|
-
}
|
|
119
|
+
for (let i in props) {
|
|
120
|
+
let value = props[i];
|
|
153
121
|
|
|
154
|
-
|
|
122
|
+
if (
|
|
123
|
+
(i === 'value' && 'defaultValue' in props && value == null) ||
|
|
124
|
+
// Emulate React's behavior of not rendering the contents of noscript tags on the client.
|
|
125
|
+
(IS_DOM && i === 'children' && type === 'noscript') ||
|
|
126
|
+
i === 'class' ||
|
|
127
|
+
i === 'className'
|
|
128
|
+
) {
|
|
129
|
+
// Skip applying value if it is null/undefined and we already set
|
|
130
|
+
// a default value
|
|
131
|
+
continue;
|
|
155
132
|
}
|
|
156
133
|
|
|
157
|
-
|
|
158
|
-
if (
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
134
|
+
let lowerCased = i.toLowerCase();
|
|
135
|
+
if (i === 'defaultValue' && 'value' in props && props.value == null) {
|
|
136
|
+
// `defaultValue` is treated as a fallback `value` when a value prop is present but null/undefined.
|
|
137
|
+
// `defaultValue` for Elements with no value prop is the same as the DOM defaultValue property.
|
|
138
|
+
i = 'value';
|
|
139
|
+
} else if (i === 'download' && value === true) {
|
|
140
|
+
// Calling `setAttribute` with a truthy value will lead to it being
|
|
141
|
+
// passed as a stringified value, e.g. `download="true"`. React
|
|
142
|
+
// converts it to an empty string instead, otherwise the attribute
|
|
143
|
+
// value will be used as the file name and the file will be called
|
|
144
|
+
// "true" upon downloading it.
|
|
145
|
+
value = '';
|
|
146
|
+
} else if (lowerCased === 'ondoubleclick') {
|
|
147
|
+
i = 'ondblclick';
|
|
148
|
+
} else if (
|
|
149
|
+
lowerCased === 'onchange' &&
|
|
150
|
+
(type === 'input' || type === 'textarea') &&
|
|
151
|
+
!onChangeInputType(props.type)
|
|
162
152
|
) {
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
153
|
+
lowerCased = i = 'oninput';
|
|
154
|
+
} else if (lowerCased === 'onfocus') {
|
|
155
|
+
i = 'onfocusin';
|
|
156
|
+
} else if (lowerCased === 'onblur') {
|
|
157
|
+
i = 'onfocusout';
|
|
158
|
+
} else if (ON_ANI.test(i)) {
|
|
159
|
+
i = lowerCased;
|
|
160
|
+
} else if (type.indexOf('-') === -1 && CAMEL_PROPS.test(i)) {
|
|
161
|
+
i = i.replace(CAMEL_REPLACE, '-$&').toLowerCase();
|
|
162
|
+
} else if (value === null) {
|
|
163
|
+
value = undefined;
|
|
168
164
|
}
|
|
169
165
|
|
|
170
|
-
//
|
|
171
|
-
if
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
child.props.selected =
|
|
178
|
-
normalizedProps.defaultValue == child.props.value;
|
|
179
|
-
}
|
|
180
|
-
});
|
|
166
|
+
// Add support for onInput and onChange, see #3561
|
|
167
|
+
// if we have an oninput prop already change it to oninputCapture
|
|
168
|
+
if (lowerCased === 'oninput') {
|
|
169
|
+
i = lowerCased;
|
|
170
|
+
if (normalizedProps[i]) {
|
|
171
|
+
i = 'oninputCapture';
|
|
172
|
+
}
|
|
181
173
|
}
|
|
182
174
|
|
|
183
|
-
|
|
175
|
+
normalizedProps[i] = value;
|
|
184
176
|
}
|
|
185
177
|
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
178
|
+
// Add support for array select values: <select multiple value={[]} />
|
|
179
|
+
if (
|
|
180
|
+
type == 'select' &&
|
|
181
|
+
normalizedProps.multiple &&
|
|
182
|
+
Array.isArray(normalizedProps.value)
|
|
183
|
+
) {
|
|
184
|
+
// forEach() always returns undefined, which we abuse here to unset the value prop.
|
|
185
|
+
normalizedProps.value = toChildArray(props.children).forEach(child => {
|
|
186
|
+
child.props.selected =
|
|
187
|
+
normalizedProps.value.indexOf(child.props.value) != -1;
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
// Adding support for defaultValue in select tag
|
|
192
|
+
if (type == 'select' && normalizedProps.defaultValue != null) {
|
|
193
|
+
normalizedProps.value = toChildArray(props.children).forEach(child => {
|
|
194
|
+
if (normalizedProps.multiple) {
|
|
195
|
+
child.props.selected =
|
|
196
|
+
normalizedProps.defaultValue.indexOf(child.props.value) != -1;
|
|
197
|
+
} else {
|
|
198
|
+
child.props.selected =
|
|
199
|
+
normalizedProps.defaultValue == child.props.value;
|
|
200
|
+
}
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
if (props.class && !props.className) {
|
|
205
|
+
normalizedProps.class = props.class;
|
|
206
|
+
Object.defineProperty(
|
|
207
|
+
normalizedProps,
|
|
208
|
+
'className',
|
|
209
|
+
classNameDescriptorNonEnumberable
|
|
210
|
+
);
|
|
211
|
+
} else if (props.className && !props.class) {
|
|
212
|
+
normalizedProps.class = normalizedProps.className = props.className;
|
|
213
|
+
} else if (props.class && props.className) {
|
|
214
|
+
normalizedProps.class = normalizedProps.className = props.className;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
vnode.props = normalizedProps;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
let oldVNodeHook = options.vnode;
|
|
221
|
+
options.vnode = vnode => {
|
|
222
|
+
// only normalize props on Element nodes
|
|
223
|
+
if (typeof vnode.type === 'string') {
|
|
224
|
+
handleDomVNode(vnode);
|
|
190
225
|
}
|
|
191
226
|
|
|
192
227
|
vnode.$$typeof = REACT_ELEMENT_TYPE;
|
|
@@ -197,13 +232,35 @@ options.vnode = vnode => {
|
|
|
197
232
|
// Only needed for react-relay
|
|
198
233
|
let currentComponent;
|
|
199
234
|
const oldBeforeRender = options._render;
|
|
200
|
-
options._render = function(vnode) {
|
|
235
|
+
options._render = function (vnode) {
|
|
201
236
|
if (oldBeforeRender) {
|
|
202
237
|
oldBeforeRender(vnode);
|
|
203
238
|
}
|
|
204
239
|
currentComponent = vnode._component;
|
|
205
240
|
};
|
|
206
241
|
|
|
242
|
+
const oldDiffed = options.diffed;
|
|
243
|
+
/** @type {(vnode: import('./internal').VNode) => void} */
|
|
244
|
+
options.diffed = function (vnode) {
|
|
245
|
+
if (oldDiffed) {
|
|
246
|
+
oldDiffed(vnode);
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
const props = vnode.props;
|
|
250
|
+
const dom = vnode._dom;
|
|
251
|
+
|
|
252
|
+
if (
|
|
253
|
+
dom != null &&
|
|
254
|
+
vnode.type === 'textarea' &&
|
|
255
|
+
'value' in props &&
|
|
256
|
+
props.value !== dom.value
|
|
257
|
+
) {
|
|
258
|
+
dom.value = props.value == null ? '' : props.value;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
currentComponent = null;
|
|
262
|
+
};
|
|
263
|
+
|
|
207
264
|
// This is a very very private internal function for React it
|
|
208
265
|
// is used to sort-of do runtime dependency injection. So far
|
|
209
266
|
// only `react-relay` makes use of it. It uses it to read the
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { Component, ComponentChild } from '../../src';
|
|
1
|
+
import { Component, ComponentChild, ComponentChildren } from '../../src';
|
|
2
2
|
|
|
3
3
|
//
|
|
4
4
|
// SuspenseList
|
|
5
5
|
// -----------------------------------
|
|
6
6
|
|
|
7
7
|
export interface SuspenseListProps {
|
|
8
|
-
children?:
|
|
8
|
+
children?: ComponentChildren;
|
|
9
9
|
revealOrder?: 'forwards' | 'backwards' | 'together';
|
|
10
10
|
}
|
|
11
11
|
|
|
@@ -57,7 +57,7 @@ const resolve = (list, child, node) => {
|
|
|
57
57
|
// - do not set `Suspense.prototype.constructor` to `Suspense`
|
|
58
58
|
SuspenseList.prototype = new Component();
|
|
59
59
|
|
|
60
|
-
SuspenseList.prototype._suspended = function(child) {
|
|
60
|
+
SuspenseList.prototype._suspended = function (child) {
|
|
61
61
|
const list = this;
|
|
62
62
|
const delegated = suspended(list._vnode);
|
|
63
63
|
|
|
@@ -83,7 +83,7 @@ SuspenseList.prototype._suspended = function(child) {
|
|
|
83
83
|
};
|
|
84
84
|
};
|
|
85
85
|
|
|
86
|
-
SuspenseList.prototype.render = function(props) {
|
|
86
|
+
SuspenseList.prototype.render = function (props) {
|
|
87
87
|
this._next = null;
|
|
88
88
|
this._map = new Map();
|
|
89
89
|
|
|
@@ -113,14 +113,15 @@ SuspenseList.prototype.render = function(props) {
|
|
|
113
113
|
return props.children;
|
|
114
114
|
};
|
|
115
115
|
|
|
116
|
-
SuspenseList.prototype.componentDidUpdate =
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
};
|
|
116
|
+
SuspenseList.prototype.componentDidUpdate =
|
|
117
|
+
SuspenseList.prototype.componentDidMount = function () {
|
|
118
|
+
// Iterate through all children after mounting for two reasons:
|
|
119
|
+
// 1. As each node[SUSPENDED_COUNT] starts from 1, this iteration increases
|
|
120
|
+
// each node[RELEASED_COUNT] by 1, therefore balancing the counters.
|
|
121
|
+
// The nodes can now be completely consumed from the linked list.
|
|
122
|
+
// 2. Handle nodes that might have gotten resolved between render and
|
|
123
|
+
// componentDidMount.
|
|
124
|
+
this._map.forEach((node, child) => {
|
|
125
|
+
resolve(this, child, node);
|
|
126
|
+
});
|
|
127
|
+
};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { Component, ComponentChild } from '../../src';
|
|
1
|
+
import { Component, ComponentChild, ComponentChildren } from '../../src';
|
|
2
2
|
|
|
3
3
|
//
|
|
4
4
|
// Suspense/lazy
|
|
5
5
|
// -----------------------------------
|
|
6
|
-
export function lazy<T>(loader: () => Promise<{ default: T }>): T;
|
|
6
|
+
export function lazy<T>(loader: () => Promise<{ default: T } | T>): T;
|
|
7
7
|
|
|
8
8
|
export interface SuspenseProps {
|
|
9
|
-
children?:
|
|
10
|
-
fallback:
|
|
9
|
+
children?: ComponentChildren;
|
|
10
|
+
fallback: ComponentChildren;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
export class Suspense extends Component<SuspenseProps> {
|
|
@@ -2,7 +2,7 @@ import { Component, createElement, options, Fragment } from '../..';
|
|
|
2
2
|
import { assign } from './util';
|
|
3
3
|
|
|
4
4
|
const oldCatchError = options._catchError;
|
|
5
|
-
options._catchError = function(error, newVNode, oldVNode) {
|
|
5
|
+
options._catchError = function (error, newVNode, oldVNode, errorInfo) {
|
|
6
6
|
if (error.then) {
|
|
7
7
|
/** @type {import('./internal').Component} */
|
|
8
8
|
let component;
|
|
@@ -19,11 +19,11 @@ options._catchError = function(error, newVNode, oldVNode) {
|
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
|
-
oldCatchError(error, newVNode, oldVNode);
|
|
22
|
+
oldCatchError(error, newVNode, oldVNode, errorInfo);
|
|
23
23
|
};
|
|
24
24
|
|
|
25
25
|
const oldUnmount = options.unmount;
|
|
26
|
-
options.unmount = function(vnode) {
|
|
26
|
+
options.unmount = function (vnode) {
|
|
27
27
|
/** @type {import('./internal').Component} */
|
|
28
28
|
const component = vnode._component;
|
|
29
29
|
if (component && component._onResolve) {
|
|
@@ -110,7 +110,7 @@ Suspense.prototype = new Component();
|
|
|
110
110
|
* @param {Promise} promise The thrown promise
|
|
111
111
|
* @param {import('./internal').VNode<any, any>} suspendingVNode The suspending component
|
|
112
112
|
*/
|
|
113
|
-
Suspense.prototype._childDidSuspend = function(promise, suspendingVNode) {
|
|
113
|
+
Suspense.prototype._childDidSuspend = function (promise, suspendingVNode) {
|
|
114
114
|
const suspendingComponent = suspendingVNode._component;
|
|
115
115
|
|
|
116
116
|
/** @type {import('./internal').SuspenseComponent} */
|
|
@@ -173,7 +173,7 @@ Suspense.prototype._childDidSuspend = function(promise, suspendingVNode) {
|
|
|
173
173
|
promise.then(onResolved, onResolved);
|
|
174
174
|
};
|
|
175
175
|
|
|
176
|
-
Suspense.prototype.componentWillUnmount = function() {
|
|
176
|
+
Suspense.prototype.componentWillUnmount = function () {
|
|
177
177
|
this._suspenders = [];
|
|
178
178
|
};
|
|
179
179
|
|
|
@@ -182,7 +182,7 @@ Suspense.prototype.componentWillUnmount = function() {
|
|
|
182
182
|
* @param {import('./internal').SuspenseComponent["props"]} props
|
|
183
183
|
* @param {import('./internal').SuspenseState} state
|
|
184
184
|
*/
|
|
185
|
-
Suspense.prototype.render = function(props, state) {
|
|
185
|
+
Suspense.prototype.render = function (props, state) {
|
|
186
186
|
if (this._detachOnNextRender) {
|
|
187
187
|
// When the Suspense's _vnode was created by a call to createVNode
|
|
188
188
|
// (i.e. due to a setState further up in the tree)
|
|
@@ -26,3 +26,13 @@ export function removeNode(node) {
|
|
|
26
26
|
let parentNode = node.parentNode;
|
|
27
27
|
if (parentNode) parentNode.removeChild(node);
|
|
28
28
|
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Check if two values are the same value
|
|
32
|
+
* @param {*} x
|
|
33
|
+
* @param {*} y
|
|
34
|
+
* @returns {boolean}
|
|
35
|
+
*/
|
|
36
|
+
export function is(x, y) {
|
|
37
|
+
return (x === y && (x !== 0 || 1 / x === 1 / y)) || (x !== x && y !== y);
|
|
38
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var n=require("../..");require("../../devtools");var
|
|
1
|
+
var n=require("../..");function e(n,e){(null==e||e>n.length)&&(e=n.length);for(var t=0,o=new Array(e);t<e;t++)o[t]=n[t];return o}function t(n,t){var o="undefined"!=typeof Symbol&&n[Symbol.iterator]||n["@@iterator"];if(o)return(o=o.call(n)).next.bind(o);if(Array.isArray(n)||(o=function(n,t){if(n){if("string"==typeof n)return e(n,t);var o=Object.prototype.toString.call(n).slice(8,-1);return"Object"===o&&n.constructor&&(o=n.constructor.name),"Map"===o||"Set"===o?Array.from(n):"Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?e(n,t):void 0}}(n))||t&&n&&"number"==typeof n.length){o&&(n=o);var r=0;return function(){return r>=n.length?{done:!0}:{done:!1,value:n[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}require("../../devtools");var o={};function r(e){return e.type===n.Fragment?"Fragment":"function"==typeof e.type?e.type.displayName||e.type.name:"string"==typeof e.type?e.type:"#text"}var a=[],i=[];function c(){return a.length>0?a[a.length-1]:null}var s=!1;function u(e){return"function"==typeof e.type&&e.type!=n.Fragment}function l(n){for(var e=[n],t=n;null!=t.__o;)e.push(t.__o),t=t.__o;return e.reduce(function(n,e){n+=" in "+r(e);var t=e.__source;return t?n+=" (at "+t.fileName+":"+t.lineNumber+")":s||(s=!0,console.warn("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.")),n+"\n"},"")}var f="function"==typeof WeakMap;function d(n){return n?"function"==typeof n.type?d(n.__):n:{}}var p=n.Component.prototype.setState;n.Component.prototype.setState=function(n,e){return null==this.__v&&null==this.state&&console.warn('Calling "this.setState" inside the constructor of a component is a no-op and might be a bug in your application. Instead, set "this.state = {}" directly.\n\n'+l(c())),p.call(this,n,e)};var h=n.Component.prototype.forceUpdate;function v(n){var e=n.props,t=r(n),o="";for(var a in e)if(e.hasOwnProperty(a)&&"children"!==a){var i=e[a];"function"==typeof i&&(i="function "+(i.displayName||i.name)+"() {}"),i=Object(i)!==i||i.toString?i+"":Object.prototype.toString.call(i),o+=" "+a+"="+JSON.stringify(i)}var c=e.children;return"<"+t+o+(c&&c.length?">..</"+t+">":" />")}n.Component.prototype.forceUpdate=function(n){return null==this.__v?console.warn('Calling "this.forceUpdate" inside the constructor of a component is a no-op and might be a bug in your application.\n\n'+l(c())):null==this.__P&&console.warn('Can\'t call "this.forceUpdate" on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all subscriptions and asynchronous tasks in the componentWillUnmount method.\n\n'+l(this.__v)),h.call(this,n)},function(){!function(){var e=n.options.__b,t=n.options.diffed,o=n.options.__,r=n.options.vnode,c=n.options.__r;n.options.diffed=function(n){u(n)&&i.pop(),a.pop(),t&&t(n)},n.options.__b=function(n){u(n)&&a.push(n),e&&e(n)},n.options.__=function(n,e){i=[],o&&o(n,e)},n.options.vnode=function(n){n.__o=i.length>0?i[i.length-1]:null,r&&r(n)},n.options.__r=function(n){u(n)&&i.push(n),c&&c(n)}}();var e=!1,c=n.options.__b,s=n.options.diffed,p=n.options.vnode,h=n.options.__r,y=n.options.__e,m=n.options.__,b=n.options.__h,w=f?{useEffect:new WeakMap,useLayoutEffect:new WeakMap,lazyPropTypes:new WeakMap}:null,g=[];n.options.__e=function(n,e,t,o){if(e&&e.__c&&"function"==typeof n.then){var a=n;n=new Error("Missing Suspense. The throwing component was: "+r(e));for(var i=e;i;i=i.__)if(i.__c&&i.__c.__c){n=a;break}if(n instanceof Error)throw n}try{(o=o||{}).componentStack=l(e),y(n,e,t,o),"function"!=typeof n.then&&setTimeout(function(){throw n})}catch(n){throw n}},n.options.__=function(n,e){if(!e)throw new Error("Undefined parent passed to render(), this is the second argument.\nCheck if the element is available in the DOM/has the correct id.");var t;switch(e.nodeType){case 1:case 11:case 9:t=!0;break;default:t=!1}if(!t){var o=r(n);throw new Error("Expected a valid HTML node as a second argument to render.\tReceived "+e+" instead: render(<"+o+" />, "+e+");")}m&&m(n,e)},n.options.__b=function(n){var t=n.type,a=d(n.__);if(e=!0,void 0===t)throw new Error("Undefined component passed to createElement()\n\nYou likely forgot to export your component or might have mixed up default and named imports"+v(n)+"\n\n"+l(n));if(null!=t&&"object"==typeof t){if(void 0!==t.__k&&void 0!==t.__e)throw new Error("Invalid type passed to createElement(): "+t+"\n\nDid you accidentally pass a JSX literal as JSX twice?\n\n let My"+r(n)+" = "+v(t)+";\n let vnode = <My"+r(n)+" />;\n\nThis usually happens when you export a JSX literal and not the component.\n\n"+l(n));throw new Error("Invalid type passed to createElement(): "+(Array.isArray(t)?"array":t))}if("thead"!==t&&"tfoot"!==t&&"tbody"!==t||"table"===a.type?"tr"===t&&"thead"!==a.type&&"tfoot"!==a.type&&"tbody"!==a.type&&"table"!==a.type?console.error("Improper nesting of table. Your <tr> should have a <thead/tbody/tfoot/table> parent."+v(n)+"\n\n"+l(n)):"td"===t&&"tr"!==a.type?console.error("Improper nesting of table. Your <td> should have a <tr> parent."+v(n)+"\n\n"+l(n)):"th"===t&&"tr"!==a.type&&console.error("Improper nesting of table. Your <th> should have a <tr>."+v(n)+"\n\n"+l(n)):console.error("Improper nesting of table. Your <thead/tbody/tfoot> should have a <table> parent."+v(n)+"\n\n"+l(n)),void 0!==n.ref&&"function"!=typeof n.ref&&"object"!=typeof n.ref&&!("$$typeof"in n))throw new Error('Component\'s "ref" property should be a function, or an object created by createRef(), but got ['+typeof n.ref+"] instead\n"+v(n)+"\n\n"+l(n));if("string"==typeof n.type)for(var i in n.props)if("o"===i[0]&&"n"===i[1]&&"function"!=typeof n.props[i]&&null!=n.props[i])throw new Error("Component's \""+i+'" property should be a function, but got ['+typeof n.props[i]+"] instead\n"+v(n)+"\n\n"+l(n));if("function"==typeof n.type&&n.type.propTypes){if("Lazy"===n.type.displayName&&w&&!w.lazyPropTypes.has(n.type)){var s="PropTypes are not supported on lazy(). Use propTypes on the wrapped component itself. ";try{var u=n.type();w.lazyPropTypes.set(n.type,!0),console.warn(s+"Component wrapped in lazy() is "+r(u))}catch(n){console.warn(s+"We will log the wrapped component's name once it is loaded.")}}var f=n.props;n.type.__f&&delete(f=function(n,e){for(var t in e)n[t]=e[t];return n}({},f)).ref,function(n,e,t,r,a){Object.keys(n).forEach(function(t){var i;try{i=n[t](e,t,r,"prop",null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(n){i=n}i&&!(i.message in o)&&(o[i.message]=!0,console.error("Failed prop type: "+i.message+(a&&"\n"+a()||"")))})}(n.type.propTypes,f,0,r(n),function(){return l(n)})}c&&c(n)},n.options.__r=function(n){h&&h(n),e=!0},n.options.__h=function(n,t,o){if(!n||!e)throw new Error("Hook can only be invoked from render methods.");b&&b(n,t,o)};var E=function(n,e){return{get:function(){var t="get"+n+e;g&&g.indexOf(t)<0&&(g.push(t),console.warn("getting vnode."+n+" is deprecated, "+e))},set:function(){var t="set"+n+e;g&&g.indexOf(t)<0&&(g.push(t),console.warn("setting vnode."+n+" is not allowed, "+e))}}},k={nodeName:E("nodeName","use vnode.type"),attributes:E("attributes","use vnode.props"),children:E("children","use vnode.props.children")},_=Object.create({},k);n.options.vnode=function(n){var e=n.props;if(null!==n.type&&null!=e&&("__source"in e||"__self"in e)){var t=n.props={};for(var o in e){var r=e[o];"__source"===o?n.__source=r:"__self"===o?n.__self=r:t[o]=r}}n.__proto__=_,p&&p(n)},n.options.diffed=function(n){if(n.__k&&n.__k.forEach(function(e){if("object"==typeof e&&e&&void 0===e.type){var t=Object.keys(e).join(",");throw new Error("Objects are not valid as a child. Encountered an object with the keys {"+t+"}.\n\n"+l(n))}}),e=!1,s&&s(n),null!=n.__k)for(var o=[],a=0;a<n.__k.length;a++){var i=n.__k[a];if(i&&null!=i.key){var c=i.key;if(-1!==o.indexOf(c)){console.error('Following component has two or more children with the same key attribute: "'+c+'". This may cause glitches and misbehavior in rendering process. Component: \n\n'+v(n)+"\n\n"+l(n));break}o.push(c)}}if(null!=n.__c&&null!=n.__c.__H){var u=n.__c.__H.__;if(u)for(var f=0;f<u.length;f+=1){var d=u[f];if(d.__H)for(var p,h=t(d.__H);!(p=h()).done;)if((m=p.value)!=m){var y=r(n);throw new Error("Invalid argument passed to hook. Hooks should not be called with NaN in the dependency array. Hook index "+f+" in component "+y+" was called with NaN.")}}}var m}}(),exports.resetPropWarnings=function(){o={}};
|
|
2
2
|
//# sourceMappingURL=debug.js.map
|