@bpmn-io/properties-panel 2.2.1 → 3.1.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/LICENSE +20 -20
- package/README.md +34 -34
- package/assets/properties-panel.css +1180 -1114
- package/dist/index.esm.js +657 -507
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +656 -505
- package/dist/index.js.map +1 -1
- package/package.json +90 -90
- 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
|
@@ -15,5 +15,36 @@
|
|
|
15
15
|
},
|
|
16
16
|
"peerDependencies": {
|
|
17
17
|
"preact": "^10.0.0"
|
|
18
|
+
},
|
|
19
|
+
"exports": {
|
|
20
|
+
".": {
|
|
21
|
+
"types": "./src/index.d.ts",
|
|
22
|
+
"browser": "./dist/compat.module.js",
|
|
23
|
+
"umd": "./dist/compat.umd.js",
|
|
24
|
+
"import": "./dist/compat.mjs",
|
|
25
|
+
"require": "./dist/compat.js"
|
|
26
|
+
},
|
|
27
|
+
"./client": {
|
|
28
|
+
"import": "./client.mjs",
|
|
29
|
+
"require": "./client.js"
|
|
30
|
+
},
|
|
31
|
+
"./server": {
|
|
32
|
+
"browser": "./server.browser.js",
|
|
33
|
+
"import": "./server.mjs",
|
|
34
|
+
"require": "./server.js"
|
|
35
|
+
},
|
|
36
|
+
"./jsx-runtime": {
|
|
37
|
+
"import": "./jsx-runtime.mjs",
|
|
38
|
+
"require": "./jsx-runtime.js"
|
|
39
|
+
},
|
|
40
|
+
"./jsx-dev-runtime": {
|
|
41
|
+
"import": "./jsx-dev-runtime.mjs",
|
|
42
|
+
"require": "./jsx-dev-runtime.js"
|
|
43
|
+
},
|
|
44
|
+
"./scheduler": {
|
|
45
|
+
"import": "./scheduler.mjs",
|
|
46
|
+
"require": "./scheduler.js"
|
|
47
|
+
},
|
|
48
|
+
"./package.json": "./package.json"
|
|
18
49
|
}
|
|
19
50
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// see scheduler.mjs
|
|
2
|
+
|
|
3
|
+
function unstable_runWithPriority(priority, callback) {
|
|
4
|
+
return callback();
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
module.exports = {
|
|
8
|
+
unstable_ImmediatePriority: 1,
|
|
9
|
+
unstable_UserBlockingPriority: 2,
|
|
10
|
+
unstable_NormalPriority: 3,
|
|
11
|
+
unstable_LowPriority: 4,
|
|
12
|
+
unstable_IdlePriority: 5,
|
|
13
|
+
unstable_runWithPriority,
|
|
14
|
+
unstable_now: performance.now.bind(performance)
|
|
15
|
+
};
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
|
|
1
3
|
// This file includes experimental React APIs exported from the "scheduler"
|
|
2
4
|
// npm package. Despite being explicitely marked as unstable some libraries
|
|
3
5
|
// already make use of them. This file is not a full replacement for the
|
|
4
6
|
// scheduler package, but includes the necessary shims to make those libraries
|
|
5
7
|
// work with Preact.
|
|
6
8
|
|
|
7
|
-
export
|
|
8
|
-
export
|
|
9
|
-
export
|
|
10
|
-
export
|
|
11
|
-
export
|
|
9
|
+
export var unstable_ImmediatePriority = 1;
|
|
10
|
+
export var unstable_UserBlockingPriority = 2;
|
|
11
|
+
export var unstable_NormalPriority = 3;
|
|
12
|
+
export var unstable_LowPriority = 4;
|
|
13
|
+
export var unstable_IdlePriority = 5;
|
|
12
14
|
|
|
13
15
|
/**
|
|
14
16
|
* @param {number} priority
|
|
@@ -18,7 +20,4 @@ export function unstable_runWithPriority(priority, callback) {
|
|
|
18
20
|
return callback();
|
|
19
21
|
}
|
|
20
22
|
|
|
21
|
-
export
|
|
22
|
-
typeof performance === 'object' && typeof performance.now === 'function'
|
|
23
|
-
? performance.now.bind(performance)
|
|
24
|
-
: () => Date.now();
|
|
23
|
+
export var unstable_now = performance.now.bind(performance);
|
|
@@ -10,6 +10,6 @@ export function PureComponent(p) {
|
|
|
10
10
|
PureComponent.prototype = new Component();
|
|
11
11
|
// Some third-party libraries check if this property is present
|
|
12
12
|
PureComponent.prototype.isPureReactComponent = true;
|
|
13
|
-
PureComponent.prototype.shouldComponentUpdate = function(props, state) {
|
|
13
|
+
PureComponent.prototype.shouldComponentUpdate = function (props, state) {
|
|
14
14
|
return shallowDiffers(this.props, props) || shallowDiffers(this.state, state);
|
|
15
15
|
};
|
|
@@ -24,17 +24,10 @@ export const REACT_FORWARD_SYMBOL =
|
|
|
24
24
|
* @returns {import('./internal').FunctionComponent}
|
|
25
25
|
*/
|
|
26
26
|
export function forwardRef(fn) {
|
|
27
|
-
|
|
28
|
-
// mobx-react. It will call this function directly
|
|
29
|
-
// and always pass ref as the second argument.
|
|
30
|
-
function Forwarded(props, ref) {
|
|
27
|
+
function Forwarded(props) {
|
|
31
28
|
let clone = assign({}, props);
|
|
32
29
|
delete clone.ref;
|
|
33
|
-
|
|
34
|
-
return fn(
|
|
35
|
-
clone,
|
|
36
|
-
!ref || (typeof ref === 'object' && !('current' in ref)) ? null : ref
|
|
37
|
-
);
|
|
30
|
+
return fn(clone, props.ref || null);
|
|
38
31
|
}
|
|
39
32
|
|
|
40
33
|
// mobx-react checks for this being present
|
|
@@ -17,6 +17,7 @@ declare namespace React {
|
|
|
17
17
|
export import Inputs = _hooks.Inputs;
|
|
18
18
|
export import PropRef = _hooks.PropRef;
|
|
19
19
|
export import Reducer = _hooks.Reducer;
|
|
20
|
+
export import Dispatch = _hooks.Dispatch;
|
|
20
21
|
export import Ref = _hooks.Ref;
|
|
21
22
|
export import StateUpdater = _hooks.StateUpdater;
|
|
22
23
|
export import useCallback = _hooks.useCallback;
|
|
@@ -24,13 +25,25 @@ declare namespace React {
|
|
|
24
25
|
export import useDebugValue = _hooks.useDebugValue;
|
|
25
26
|
export import useEffect = _hooks.useEffect;
|
|
26
27
|
export import useImperativeHandle = _hooks.useImperativeHandle;
|
|
28
|
+
export import useId = _hooks.useId;
|
|
27
29
|
export import useLayoutEffect = _hooks.useLayoutEffect;
|
|
28
30
|
export import useMemo = _hooks.useMemo;
|
|
29
31
|
export import useReducer = _hooks.useReducer;
|
|
30
32
|
export import useRef = _hooks.useRef;
|
|
31
33
|
export import useState = _hooks.useState;
|
|
34
|
+
// React 18 hooks
|
|
35
|
+
export import useInsertionEffect = _hooks.useLayoutEffect;
|
|
36
|
+
export function useTransition(): [false, typeof startTransition];
|
|
37
|
+
export function useDeferredValue<T = any>(val: T): T;
|
|
38
|
+
export function useSyncExternalStore<T>(
|
|
39
|
+
subscribe: (flush: () => void) => () => void,
|
|
40
|
+
getSnapshot: () => T
|
|
41
|
+
): T;
|
|
32
42
|
|
|
33
43
|
// Preact Defaults
|
|
44
|
+
export import Context = preact.Context;
|
|
45
|
+
export import ContextType = preact.ContextType;
|
|
46
|
+
export import RefObject = preact.RefObject;
|
|
34
47
|
export import Component = preact.Component;
|
|
35
48
|
export import FunctionComponent = preact.FunctionComponent;
|
|
36
49
|
export import FC = preact.FunctionComponent;
|
|
@@ -39,6 +52,7 @@ declare namespace React {
|
|
|
39
52
|
export import Fragment = preact.Fragment;
|
|
40
53
|
export import createElement = preact.createElement;
|
|
41
54
|
export import cloneElement = preact.cloneElement;
|
|
55
|
+
export import ComponentProps = preact.ComponentProps;
|
|
42
56
|
|
|
43
57
|
// Suspense
|
|
44
58
|
export import Suspense = _Suspense.Suspense;
|
|
@@ -48,10 +62,21 @@ declare namespace React {
|
|
|
48
62
|
// Compat
|
|
49
63
|
export import StrictMode = preact.Fragment;
|
|
50
64
|
export const version: string;
|
|
65
|
+
export function startTransition(cb: () => void): void;
|
|
66
|
+
|
|
67
|
+
// HTML
|
|
68
|
+
export import HTMLAttributes = JSXInternal.HTMLAttributes;
|
|
69
|
+
export import DetailedHTMLProps = JSXInternal.DetailedHTMLProps;
|
|
70
|
+
export import CSSProperties = JSXInternal.CSSProperties;
|
|
71
|
+
|
|
72
|
+
// Events
|
|
73
|
+
export import TargetedEvent = JSXInternal.TargetedEvent;
|
|
74
|
+
export import ChangeEvent = JSXInternal.TargetedEvent;
|
|
75
|
+
export import ChangeEventHandler = JSXInternal.GenericEventHandler;
|
|
51
76
|
|
|
52
77
|
export function createPortal(
|
|
53
78
|
vnode: preact.VNode,
|
|
54
|
-
container: Element
|
|
79
|
+
container: Element | DocumentFragment
|
|
55
80
|
): preact.VNode<any>;
|
|
56
81
|
|
|
57
82
|
export function render(
|
|
@@ -77,7 +102,9 @@ declare namespace React {
|
|
|
77
102
|
...children: preact.ComponentChildren[]
|
|
78
103
|
) => preact.VNode<any>;
|
|
79
104
|
export function isValidElement(element: any): boolean;
|
|
80
|
-
export function findDOMNode(
|
|
105
|
+
export function findDOMNode(
|
|
106
|
+
component: preact.Component | Element
|
|
107
|
+
): Element | null;
|
|
81
108
|
|
|
82
109
|
export abstract class PureComponent<P = {}, S = {}> extends preact.Component<
|
|
83
110
|
P,
|
|
@@ -86,6 +113,11 @@ declare namespace React {
|
|
|
86
113
|
isPureReactComponent: boolean;
|
|
87
114
|
}
|
|
88
115
|
|
|
116
|
+
export type MemoExoticComponent<C extends preact.FunctionalComponent<any>> =
|
|
117
|
+
preact.FunctionComponent<ComponentProps<C>> & {
|
|
118
|
+
readonly type: C;
|
|
119
|
+
};
|
|
120
|
+
|
|
89
121
|
export function memo<P = {}>(
|
|
90
122
|
component: preact.FunctionalComponent<P>,
|
|
91
123
|
comparer?: (prev: P, next: P) => boolean
|
|
@@ -98,20 +130,42 @@ declare namespace React {
|
|
|
98
130
|
) => boolean
|
|
99
131
|
): C;
|
|
100
132
|
|
|
133
|
+
export interface RefAttributes<R> extends preact.Attributes {
|
|
134
|
+
ref?: preact.Ref<R> | undefined;
|
|
135
|
+
}
|
|
136
|
+
|
|
101
137
|
export interface ForwardFn<P = {}, T = any> {
|
|
102
|
-
(props: P, ref:
|
|
138
|
+
(props: P, ref: ForwardedRef<T>): preact.ComponentChild;
|
|
103
139
|
displayName?: string;
|
|
104
140
|
}
|
|
105
141
|
|
|
142
|
+
export interface ForwardRefExoticComponent<P>
|
|
143
|
+
extends preact.FunctionComponent<P> {
|
|
144
|
+
defaultProps?: Partial<P> | undefined;
|
|
145
|
+
}
|
|
146
|
+
|
|
106
147
|
export function forwardRef<R, P = {}>(
|
|
107
148
|
fn: ForwardFn<P, R>
|
|
108
|
-
): preact.FunctionalComponent<P>;
|
|
149
|
+
): preact.FunctionalComponent<Omit<P, 'ref'> & { ref?: preact.Ref<R> }>;
|
|
150
|
+
|
|
151
|
+
interface MutableRefObject<T> {
|
|
152
|
+
current: T;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export type ForwardedRef<T> =
|
|
156
|
+
| ((instance: T | null) => void)
|
|
157
|
+
| MutableRefObject<T | null>
|
|
158
|
+
| null;
|
|
109
159
|
|
|
110
160
|
export function unstable_batchedUpdates(
|
|
111
161
|
callback: (arg?: any) => void,
|
|
112
162
|
arg?: any
|
|
113
163
|
): void;
|
|
114
164
|
|
|
165
|
+
export type PropsWithChildren<P = unknown> = P & {
|
|
166
|
+
children?: preact.ComponentChild | undefined;
|
|
167
|
+
};
|
|
168
|
+
|
|
115
169
|
export const Children: {
|
|
116
170
|
map<T extends preact.ComponentChild, R>(
|
|
117
171
|
children: T | T[],
|
|
@@ -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
|
|