@bpmn-io/properties-panel 0.8.0 → 0.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +112 -85
- package/LICENSE +20 -20
- package/README.md +34 -34
- package/assets/properties-panel.css +891 -848
- package/dist/index.esm.js +1609 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/index.js +1650 -0
- package/dist/index.js.map +1 -0
- package/package.json +87 -78
- package/preact/LICENSE +21 -0
- package/preact/README.md +185 -0
- package/preact/compat/dist/compat.js +2 -0
- package/preact/compat/dist/compat.js.map +1 -0
- package/preact/compat/dist/compat.mjs +2 -0
- package/preact/compat/dist/compat.module.js +2 -0
- package/preact/compat/dist/compat.module.js.map +1 -0
- package/preact/compat/dist/compat.umd.js +2 -0
- package/preact/compat/dist/compat.umd.js.map +1 -0
- package/preact/compat/jsx-dev-runtime.js +1 -0
- package/preact/compat/jsx-dev-runtime.mjs +1 -0
- package/preact/compat/jsx-runtime.js +1 -0
- package/preact/compat/jsx-runtime.mjs +1 -0
- package/preact/compat/package.json +19 -0
- package/preact/compat/server.js +15 -0
- package/preact/compat/server.mjs +4 -0
- package/preact/compat/src/Children.js +21 -0
- package/preact/compat/src/PureComponent.js +15 -0
- package/preact/compat/src/forwardRef.js +51 -0
- package/preact/compat/src/index.d.ts +140 -0
- package/preact/compat/src/index.js +175 -0
- package/preact/compat/src/internal.d.ts +47 -0
- package/preact/compat/src/memo.js +34 -0
- package/preact/compat/src/portals.js +80 -0
- package/preact/compat/src/render.js +219 -0
- package/preact/compat/src/scheduler.js +24 -0
- package/preact/compat/src/suspense-list.d.ts +14 -0
- package/preact/compat/src/suspense-list.js +126 -0
- package/preact/compat/src/suspense.d.ts +15 -0
- package/preact/compat/src/suspense.js +270 -0
- package/preact/compat/src/util.js +28 -0
- package/preact/compat/test-utils.js +1 -0
- package/preact/debug/dist/debug.js +2 -0
- package/preact/debug/dist/debug.js.map +1 -0
- package/preact/debug/dist/debug.mjs +2 -0
- package/preact/debug/dist/debug.module.js +2 -0
- package/preact/debug/dist/debug.module.js.map +1 -0
- package/preact/debug/dist/debug.umd.js +2 -0
- package/preact/debug/dist/debug.umd.js.map +1 -0
- package/preact/debug/package.json +18 -0
- package/preact/debug/src/check-props.js +54 -0
- package/preact/debug/src/component-stack.js +146 -0
- package/preact/debug/src/constants.js +3 -0
- package/preact/debug/src/debug.js +442 -0
- package/preact/debug/src/index.js +6 -0
- package/preact/debug/src/internal.d.ts +82 -0
- package/preact/debug/src/util.js +11 -0
- package/preact/devtools/dist/devtools.js +2 -0
- package/preact/devtools/dist/devtools.js.map +1 -0
- package/preact/devtools/dist/devtools.mjs +2 -0
- package/preact/devtools/dist/devtools.module.js +2 -0
- package/preact/devtools/dist/devtools.module.js.map +1 -0
- package/preact/devtools/dist/devtools.umd.js +2 -0
- package/preact/devtools/dist/devtools.umd.js.map +1 -0
- package/preact/devtools/package.json +16 -0
- package/preact/devtools/src/devtools.js +10 -0
- package/preact/devtools/src/index.d.ts +8 -0
- package/preact/devtools/src/index.js +15 -0
- package/preact/dist/preact.js +2 -0
- package/preact/dist/preact.js.map +1 -0
- package/preact/dist/preact.min.js +2 -0
- package/preact/dist/preact.min.js.map +1 -0
- package/preact/dist/preact.mjs +2 -0
- package/preact/dist/preact.module.js +2 -0
- package/preact/dist/preact.module.js.map +1 -0
- package/preact/dist/preact.umd.js +2 -0
- package/preact/dist/preact.umd.js.map +1 -0
- package/preact/hooks/dist/hooks.js +2 -0
- package/preact/hooks/dist/hooks.js.map +1 -0
- package/preact/hooks/dist/hooks.mjs +2 -0
- package/preact/hooks/dist/hooks.module.js +2 -0
- package/preact/hooks/dist/hooks.module.js.map +1 -0
- package/preact/hooks/dist/hooks.umd.js +2 -0
- package/preact/hooks/dist/hooks.umd.js.map +1 -0
- package/preact/hooks/package.json +26 -0
- package/preact/hooks/src/index.d.ts +130 -0
- package/preact/hooks/src/index.js +386 -0
- package/preact/hooks/src/internal.d.ts +75 -0
- package/preact/jsx-runtime/dist/jsxRuntime.js +2 -0
- package/preact/jsx-runtime/dist/jsxRuntime.js.map +1 -0
- package/preact/jsx-runtime/dist/jsxRuntime.mjs +2 -0
- package/preact/jsx-runtime/dist/jsxRuntime.module.js +2 -0
- package/preact/jsx-runtime/dist/jsxRuntime.module.js.map +1 -0
- package/preact/jsx-runtime/dist/jsxRuntime.umd.js +2 -0
- package/preact/jsx-runtime/dist/jsxRuntime.umd.js.map +1 -0
- package/preact/jsx-runtime/package.json +19 -0
- package/preact/jsx-runtime/src/index.d.ts +50 -0
- package/preact/jsx-runtime/src/index.js +72 -0
- package/preact/package.json +268 -0
- package/preact/src/cjs.js +3 -0
- package/preact/src/clone-element.js +39 -0
- package/preact/src/component.js +225 -0
- package/preact/src/constants.js +3 -0
- package/preact/src/create-context.js +68 -0
- package/preact/src/create-element.js +100 -0
- package/preact/src/diff/catch-error.js +38 -0
- package/preact/src/diff/children.js +347 -0
- package/preact/src/diff/index.js +516 -0
- package/preact/src/diff/props.js +158 -0
- package/preact/src/index.d.ts +310 -0
- package/preact/src/index.js +13 -0
- package/preact/src/internal.d.ts +147 -0
- package/preact/src/jsx.d.ts +955 -0
- package/preact/src/options.js +17 -0
- package/preact/src/render.js +74 -0
- package/preact/src/util.js +23 -0
- package/preact/test-utils/dist/testUtils.js +2 -0
- package/preact/test-utils/dist/testUtils.js.map +1 -0
- package/preact/test-utils/dist/testUtils.mjs +2 -0
- package/preact/test-utils/dist/testUtils.module.js +2 -0
- package/preact/test-utils/dist/testUtils.module.js.map +1 -0
- package/preact/test-utils/dist/testUtils.umd.js +2 -0
- package/preact/test-utils/dist/testUtils.umd.js.map +1 -0
- package/preact/test-utils/package.json +19 -0
- package/preact/test-utils/src/index.d.ts +3 -0
- package/preact/test-utils/src/index.js +117 -0
- package/lib/PropertiesPanel.js +0 -126
- package/lib/PropertiesPanel.js.map +0 -1
- package/lib/components/DropdownButton.js +0 -109
- package/lib/components/DropdownButton.js.map +0 -1
- package/lib/components/Group.js +0 -75
- package/lib/components/Group.js.map +0 -1
- package/lib/components/Header.js +0 -49
- package/lib/components/Header.js.map +0 -1
- package/lib/components/HeaderButton.js +0 -16
- package/lib/components/HeaderButton.js.map +0 -1
- package/lib/components/ListGroup.js +0 -167
- package/lib/components/ListGroup.js.map +0 -1
- package/lib/components/ListItem.js +0 -37
- package/lib/components/ListItem.js.map +0 -1
- package/lib/components/entries/Checkbox.js +0 -81
- package/lib/components/entries/Checkbox.js.map +0 -1
- package/lib/components/entries/Collapsible.js +0 -48
- package/lib/components/entries/Collapsible.js.map +0 -1
- package/lib/components/entries/List.js +0 -204
- package/lib/components/entries/List.js.map +0 -1
- package/lib/components/entries/NumberField.js +0 -108
- package/lib/components/entries/NumberField.js.map +0 -1
- package/lib/components/entries/Select.js +0 -107
- package/lib/components/entries/Select.js.map +0 -1
- package/lib/components/entries/Simple.js +0 -56
- package/lib/components/entries/Simple.js.map +0 -1
- package/lib/components/entries/TextArea.js +0 -96
- package/lib/components/entries/TextArea.js.map +0 -1
- package/lib/components/entries/TextField.js +0 -121
- package/lib/components/entries/TextField.js.map +0 -1
- package/lib/components/entries/ToggleSwitch.js +0 -87
- package/lib/components/entries/ToggleSwitch.js.map +0 -1
- package/lib/components/icons/index.js +0 -51
- package/lib/components/icons/index.js.map +0 -1
- package/lib/context/LayoutContext.js +0 -9
- package/lib/context/LayoutContext.js.map +0 -1
- package/lib/context/index.js +0 -2
- package/lib/context/index.js.map +0 -1
- package/lib/features/debounce-input/debounceInput.js +0 -14
- package/lib/features/debounce-input/debounceInput.js.map +0 -1
- package/lib/features/debounce-input/index.js +0 -5
- package/lib/features/debounce-input/index.js.map +0 -1
- package/lib/hooks/index.js +0 -4
- package/lib/hooks/index.js.map +0 -1
- package/lib/hooks/useKeyFactory.js +0 -39
- package/lib/hooks/useKeyFactory.js.map +0 -1
- package/lib/hooks/useLayoutState.js +0 -36
- package/lib/hooks/useLayoutState.js.map +0 -1
- package/lib/hooks/usePrevious.js +0 -16
- package/lib/hooks/usePrevious.js.map +0 -1
- package/lib/index.js +0 -2
- package/lib/index.js.map +0 -1
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("../..")):"function"==typeof define&&define.amd?define(["exports","preact"],n):n(e.jsxRuntime={},e.preact)}(this,function(e,n){function o(e,o,r,t,_){var f={};for(var i in o)"ref"!=i&&(f[i]=o[i]);var u,c,l={type:e,props:f,key:r,ref:o&&o.ref,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:++n.options.__v,__source:t,__self:_};if("function"==typeof e&&(u=e.defaultProps))for(c in u)void 0===f[c]&&(f[c]=u[c]);return n.options.vnode&&n.options.vnode(l),l}e.Fragment=n.Fragment,e.jsx=o,e.jsxs=o,e.jsxDEV=o});
|
|
2
|
+
//# sourceMappingURL=jsxRuntime.umd.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsxRuntime.umd.js","sources":["../src/index.js"],"sourcesContent":["import { options, Fragment } from '../..';\n\n/** @typedef {import('preact').VNode} VNode */\n\n/**\n * @fileoverview\n * This file exports various methods that implement Babel's \"automatic\" JSX runtime API:\n * - jsx(type, props, key)\n * - jsxs(type, props, key)\n * - jsxDEV(type, props, key, __source, __self)\n *\n * The implementation of createVNode here is optimized for performance.\n * Benchmarks: https://esbench.com/bench/5f6b54a0b4632100a7dcd2b3\n */\n\n/**\n * JSX.Element factory used by Babel's {runtime:\"automatic\"} JSX transform\n * @param {VNode['type']} type\n * @param {VNode['props']} props\n * @param {VNode['key']} [key]\n * @param {string} [__source]\n * @param {string} [__self]\n */\nfunction createVNode(type, props, key, __source, __self) {\n\t// We'll want to preserve `ref` in props to get rid of the need for\n\t// forwardRef components in the future, but that should happen via\n\t// a separate PR.\n\tlet normalizedProps = {};\n\tfor (let i in props) {\n\t\tif (i != 'ref') {\n\t\t\tnormalizedProps[i] = props[i];\n\t\t}\n\t}\n\n\tconst vnode = {\n\t\ttype,\n\t\tprops: normalizedProps,\n\t\tkey,\n\t\tref: props && props.ref,\n\t\t_children: null,\n\t\t_parent: null,\n\t\t_depth: 0,\n\t\t_dom: null,\n\t\t_nextDom: undefined,\n\t\t_component: null,\n\t\t_hydrating: null,\n\t\tconstructor: undefined,\n\t\t_original: ++options._vnodeId,\n\t\t__source,\n\t\t__self\n\t};\n\n\t// If a Component VNode, check for and apply defaultProps.\n\t// Note: `type` is often a String, and can be `undefined` in development.\n\tlet defaults, i;\n\tif (typeof type === 'function' && (defaults = type.defaultProps)) {\n\t\tfor (i in defaults)\n\t\t\tif (normalizedProps[i] === undefined) {\n\t\t\t\tnormalizedProps[i] = defaults[i];\n\t\t\t}\n\t}\n\n\tif (options.vnode) options.vnode(vnode);\n\treturn vnode;\n}\n\nexport {\n\tcreateVNode as jsx,\n\tcreateVNode as jsxs,\n\tcreateVNode as jsxDEV,\n\tFragment\n};\n"],"names":["createVNode","type","props","key","__source","__self","normalizedProps","i","defaults","vnode","ref","undefined","constructor","options","defaultProps"],"mappings":"sNAuBA,SAASA,EAAYC,EAAMC,EAAOC,EAAKC,EAAUC,OAI5CC,EAAkB,OACjB,IAAIC,KAAKL,EACJ,OAALK,IACHD,EAAgBC,GAAKL,EAAMK,QAwBzBC,EAAUD,EApBRE,EAAQ,CACbR,KAAAA,EACAC,MAAOI,EACPH,IAAAA,EACAO,IAAKR,GAASA,EAAMQ,QACT,QACF,SACD,MACF,cACIC,MACE,SACA,KACZC,iBAAaD,QACAE,cACbT,SAAAA,EACAC,OAAAA,MAMmB,mBAATJ,IAAwBO,EAAWP,EAAKa,kBAC7CP,KAAKC,OACkBG,IAAvBL,EAAgBC,KACnBD,EAAgBC,GAAKC,EAASD,WAI7BM,UAAQJ,OAAOI,UAAQJ,MAAMA,GAC1BA"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "jsx-runtime",
|
|
3
|
+
"amdName": "jsxRuntime",
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"private": true,
|
|
6
|
+
"description": "Preact JSX runtime",
|
|
7
|
+
"main": "dist/jsxRuntime.js",
|
|
8
|
+
"module": "dist/jsxRuntime.module.js",
|
|
9
|
+
"umd:main": "dist/jsxRuntime.umd.js",
|
|
10
|
+
"source": "src/index.js",
|
|
11
|
+
"types": "src/index.d.ts",
|
|
12
|
+
"license": "MIT",
|
|
13
|
+
"peerDependencies": {
|
|
14
|
+
"preact": "^10.0.0"
|
|
15
|
+
},
|
|
16
|
+
"mangle": {
|
|
17
|
+
"regex": "^_"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
export { Fragment } from '../../';
|
|
2
|
+
import {
|
|
3
|
+
ComponentType,
|
|
4
|
+
ComponentChild,
|
|
5
|
+
ComponentChildren,
|
|
6
|
+
VNode,
|
|
7
|
+
Attributes
|
|
8
|
+
} from '../../';
|
|
9
|
+
import { JSXInternal } from '../../src/jsx';
|
|
10
|
+
|
|
11
|
+
export function jsx(
|
|
12
|
+
type: string,
|
|
13
|
+
props: JSXInternal.HTMLAttributes &
|
|
14
|
+
JSXInternal.SVGAttributes &
|
|
15
|
+
Record<string, any> & { children?: ComponentChild },
|
|
16
|
+
key?: string
|
|
17
|
+
): VNode<any>;
|
|
18
|
+
export function jsx<P>(
|
|
19
|
+
type: ComponentType<P>,
|
|
20
|
+
props: Attributes & P & { children?: ComponentChild },
|
|
21
|
+
key?: string
|
|
22
|
+
): VNode<any>;
|
|
23
|
+
|
|
24
|
+
export function jsxs(
|
|
25
|
+
type: string,
|
|
26
|
+
props: JSXInternal.HTMLAttributes &
|
|
27
|
+
JSXInternal.SVGAttributes &
|
|
28
|
+
Record<string, any> & { children?: ComponentChild[] },
|
|
29
|
+
key?: string
|
|
30
|
+
): VNode<any>;
|
|
31
|
+
export function jsxs<P>(
|
|
32
|
+
type: ComponentType<P>,
|
|
33
|
+
props: Attributes & P & { children?: ComponentChild[] },
|
|
34
|
+
key?: string
|
|
35
|
+
): VNode<any>;
|
|
36
|
+
|
|
37
|
+
export function jsxDEV(
|
|
38
|
+
type: string,
|
|
39
|
+
props: JSXInternal.HTMLAttributes &
|
|
40
|
+
JSXInternal.SVGAttributes &
|
|
41
|
+
Record<string, any> & { children?: ComponentChildren },
|
|
42
|
+
key?: string
|
|
43
|
+
): VNode<any>;
|
|
44
|
+
export function jsxDEV<P>(
|
|
45
|
+
type: ComponentType<P>,
|
|
46
|
+
props: Attributes & P & { children?: ComponentChildren },
|
|
47
|
+
key?: string
|
|
48
|
+
): VNode<any>;
|
|
49
|
+
|
|
50
|
+
export { JSXInternal as JSX };
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { options, Fragment } from '../..';
|
|
2
|
+
|
|
3
|
+
/** @typedef {import('preact').VNode} VNode */
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @fileoverview
|
|
7
|
+
* This file exports various methods that implement Babel's "automatic" JSX runtime API:
|
|
8
|
+
* - jsx(type, props, key)
|
|
9
|
+
* - jsxs(type, props, key)
|
|
10
|
+
* - jsxDEV(type, props, key, __source, __self)
|
|
11
|
+
*
|
|
12
|
+
* The implementation of createVNode here is optimized for performance.
|
|
13
|
+
* Benchmarks: https://esbench.com/bench/5f6b54a0b4632100a7dcd2b3
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* JSX.Element factory used by Babel's {runtime:"automatic"} JSX transform
|
|
18
|
+
* @param {VNode['type']} type
|
|
19
|
+
* @param {VNode['props']} props
|
|
20
|
+
* @param {VNode['key']} [key]
|
|
21
|
+
* @param {string} [__source]
|
|
22
|
+
* @param {string} [__self]
|
|
23
|
+
*/
|
|
24
|
+
function createVNode(type, props, key, __source, __self) {
|
|
25
|
+
// We'll want to preserve `ref` in props to get rid of the need for
|
|
26
|
+
// forwardRef components in the future, but that should happen via
|
|
27
|
+
// a separate PR.
|
|
28
|
+
let normalizedProps = {};
|
|
29
|
+
for (let i in props) {
|
|
30
|
+
if (i != 'ref') {
|
|
31
|
+
normalizedProps[i] = props[i];
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const vnode = {
|
|
36
|
+
type,
|
|
37
|
+
props: normalizedProps,
|
|
38
|
+
key,
|
|
39
|
+
ref: props && props.ref,
|
|
40
|
+
_children: null,
|
|
41
|
+
_parent: null,
|
|
42
|
+
_depth: 0,
|
|
43
|
+
_dom: null,
|
|
44
|
+
_nextDom: undefined,
|
|
45
|
+
_component: null,
|
|
46
|
+
_hydrating: null,
|
|
47
|
+
constructor: undefined,
|
|
48
|
+
_original: ++options._vnodeId,
|
|
49
|
+
__source,
|
|
50
|
+
__self
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
// If a Component VNode, check for and apply defaultProps.
|
|
54
|
+
// Note: `type` is often a String, and can be `undefined` in development.
|
|
55
|
+
let defaults, i;
|
|
56
|
+
if (typeof type === 'function' && (defaults = type.defaultProps)) {
|
|
57
|
+
for (i in defaults)
|
|
58
|
+
if (normalizedProps[i] === undefined) {
|
|
59
|
+
normalizedProps[i] = defaults[i];
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if (options.vnode) options.vnode(vnode);
|
|
64
|
+
return vnode;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export {
|
|
68
|
+
createVNode as jsx,
|
|
69
|
+
createVNode as jsxs,
|
|
70
|
+
createVNode as jsxDEV,
|
|
71
|
+
Fragment
|
|
72
|
+
};
|
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "preact",
|
|
3
|
+
"amdName": "preact",
|
|
4
|
+
"version": "10.5.13",
|
|
5
|
+
"private": false,
|
|
6
|
+
"description": "Fast 3kb React-compatible Virtual DOM library.",
|
|
7
|
+
"main": "dist/preact.js",
|
|
8
|
+
"module": "dist/preact.module.js",
|
|
9
|
+
"umd:main": "dist/preact.umd.js",
|
|
10
|
+
"unpkg": "dist/preact.min.js",
|
|
11
|
+
"source": "src/index.js",
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"browser": "./dist/preact.module.js",
|
|
15
|
+
"umd": "./dist/preact.umd.js",
|
|
16
|
+
"import": "./dist/preact.mjs",
|
|
17
|
+
"require": "./dist/preact.js"
|
|
18
|
+
},
|
|
19
|
+
"./compat": {
|
|
20
|
+
"browser": "./compat/dist/compat.module.js",
|
|
21
|
+
"umd": "./compat/dist/compat.umd.js",
|
|
22
|
+
"require": "./compat/dist/compat.js",
|
|
23
|
+
"import": "./compat/dist/compat.mjs"
|
|
24
|
+
},
|
|
25
|
+
"./debug": {
|
|
26
|
+
"browser": "./debug/dist/debug.module.js",
|
|
27
|
+
"umd": "./debug/dist/debug.umd.js",
|
|
28
|
+
"require": "./debug/dist/debug.js",
|
|
29
|
+
"import": "./debug/dist/debug.mjs"
|
|
30
|
+
},
|
|
31
|
+
"./devtools": {
|
|
32
|
+
"browser": "./devtools/dist/devtools.module.js",
|
|
33
|
+
"umd": "./devtools/dist/devtools.umd.js",
|
|
34
|
+
"require": "./devtools/dist/devtools.js",
|
|
35
|
+
"import": "./devtools/dist/devtools.mjs"
|
|
36
|
+
},
|
|
37
|
+
"./hooks": {
|
|
38
|
+
"browser": "./hooks/dist/hooks.module.js",
|
|
39
|
+
"umd": "./hooks/dist/hooks.umd.js",
|
|
40
|
+
"require": "./hooks/dist/hooks.js",
|
|
41
|
+
"import": "./hooks/dist/hooks.mjs"
|
|
42
|
+
},
|
|
43
|
+
"./test-utils": {
|
|
44
|
+
"browser": "./test-utils/dist/testUtils.module.js",
|
|
45
|
+
"umd": "./test-utils/dist/testUtils.umd.js",
|
|
46
|
+
"require": "./test-utils/dist/testUtils.js",
|
|
47
|
+
"import": "./test-utils/dist/testUtils.mjs"
|
|
48
|
+
},
|
|
49
|
+
"./jsx-runtime": {
|
|
50
|
+
"browser": "./jsx-runtime/dist/jsxRuntime.module.js",
|
|
51
|
+
"umd": "./jsx-runtime/dist/jsxRuntime.umd.js",
|
|
52
|
+
"require": "./jsx-runtime/dist/jsxRuntime.js",
|
|
53
|
+
"import": "./jsx-runtime/dist/jsxRuntime.mjs"
|
|
54
|
+
},
|
|
55
|
+
"./jsx-dev-runtime": {
|
|
56
|
+
"browser": "./jsx-runtime/dist/jsxRuntime.module.js",
|
|
57
|
+
"umd": "./jsx-runtime/dist/jsxRuntime.umd.js",
|
|
58
|
+
"require": "./jsx-runtime/dist/jsxRuntime.js",
|
|
59
|
+
"import": "./jsx-runtime/dist/jsxRuntime.mjs"
|
|
60
|
+
},
|
|
61
|
+
"./compat/server": {
|
|
62
|
+
"require": "./compat/server.js",
|
|
63
|
+
"import": "./compat/server.mjs"
|
|
64
|
+
},
|
|
65
|
+
"./package.json": "./package.json",
|
|
66
|
+
"./": "./"
|
|
67
|
+
},
|
|
68
|
+
"license": "MIT",
|
|
69
|
+
"funding": {
|
|
70
|
+
"type": "opencollective",
|
|
71
|
+
"url": "https://opencollective.com/preact"
|
|
72
|
+
},
|
|
73
|
+
"types": "src/index.d.ts",
|
|
74
|
+
"scripts": {
|
|
75
|
+
"prepare": "run-s build && check-export-map",
|
|
76
|
+
"build": "npm-run-all --parallel build:*",
|
|
77
|
+
"build:core": "microbundle build --raw",
|
|
78
|
+
"build:core-min": "microbundle build --raw -f iife src/cjs.js -o dist/preact.min.js",
|
|
79
|
+
"build:debug": "microbundle build --raw --cwd debug",
|
|
80
|
+
"build:devtools": "microbundle build --raw --cwd devtools",
|
|
81
|
+
"build:hooks": "microbundle build --raw --cwd hooks",
|
|
82
|
+
"build:test-utils": "microbundle build --raw --cwd test-utils",
|
|
83
|
+
"build:compat": "microbundle build --raw --cwd compat --globals 'preact/hooks=preactHooks'",
|
|
84
|
+
"build:jsx": "microbundle build --raw --cwd jsx-runtime",
|
|
85
|
+
"postbuild": "node ./config/node-13-exports.js && node ./config/compat-entries.js",
|
|
86
|
+
"dev": "microbundle watch --raw --format cjs",
|
|
87
|
+
"dev:hooks": "microbundle watch --raw --format cjs --cwd hooks",
|
|
88
|
+
"dev:compat": "microbundle watch --raw --format cjs --cwd compat --globals 'preact/hooks=preactHooks'",
|
|
89
|
+
"test": "npm-run-all build lint test:unit",
|
|
90
|
+
"test:unit": "run-p test:mocha test:karma:minify test:ts",
|
|
91
|
+
"test:ts": "run-p test:ts:*",
|
|
92
|
+
"test:ts:core": "tsc -p test/ts/ && mocha --require \"@babel/register\" test/ts/**/*-test.js",
|
|
93
|
+
"test:ts:compat": "tsc -p compat/test/ts/",
|
|
94
|
+
"test:mocha": "mocha --recursive --require \"@babel/register\" test/shared test/node",
|
|
95
|
+
"test:mocha:watch": "npm run test:mocha -- --watch",
|
|
96
|
+
"test:karma": "cross-env COVERAGE=true BABEL_NO_MODULES=true karma start karma.conf.js --single-run",
|
|
97
|
+
"test:karma:minify": "cross-env COVERAGE=true MINIFY=true BABEL_NO_MODULES=true karma start karma.conf.js --single-run",
|
|
98
|
+
"test:karma:watch": "cross-env BABEL_NO_MODULES=true karma start karma.conf.js --no-single-run",
|
|
99
|
+
"test:karma:hooks": "cross-env COVERAGE=false BABEL_NO_MODULES=true karma start karma.conf.js --grep=hooks/test/browser/**.js --no-single-run",
|
|
100
|
+
"test:karma:test-utils": "cross-env PERFORMANCE=false COVERAGE=false BABEL_NO_MODULES=true karma start karma.conf.js --grep=test-utils/test/shared/**.js --no-single-run",
|
|
101
|
+
"test:karma:bench": "cross-env PERFORMANCE=true COVERAGE=false BABEL_NO_MODULES=true karma start karma.conf.js --grep=test/benchmarks/**.js --single-run",
|
|
102
|
+
"benchmark": "npm run test:karma:bench -- no-single-run",
|
|
103
|
+
"lint": "eslint src test debug compat hooks test-utils"
|
|
104
|
+
},
|
|
105
|
+
"eslintConfig": {
|
|
106
|
+
"extends": [
|
|
107
|
+
"developit",
|
|
108
|
+
"prettier"
|
|
109
|
+
],
|
|
110
|
+
"settings": {
|
|
111
|
+
"react": {
|
|
112
|
+
"pragma": "createElement"
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
"rules": {
|
|
116
|
+
"camelcase": [
|
|
117
|
+
1,
|
|
118
|
+
{
|
|
119
|
+
"allow": [
|
|
120
|
+
"__test__*",
|
|
121
|
+
"unstable_*",
|
|
122
|
+
"UNSAFE_*"
|
|
123
|
+
]
|
|
124
|
+
}
|
|
125
|
+
],
|
|
126
|
+
"no-unused-vars": [
|
|
127
|
+
2,
|
|
128
|
+
{
|
|
129
|
+
"args": "none",
|
|
130
|
+
"varsIgnorePattern": "^h|React$"
|
|
131
|
+
}
|
|
132
|
+
],
|
|
133
|
+
"prefer-rest-params": 0,
|
|
134
|
+
"prefer-spread": 0,
|
|
135
|
+
"no-cond-assign": 0,
|
|
136
|
+
"react/jsx-no-bind": 0,
|
|
137
|
+
"react/no-danger": "off",
|
|
138
|
+
"react/prefer-stateless-function": 0,
|
|
139
|
+
"react/sort-comp": 0,
|
|
140
|
+
"jest/valid-expect": 0,
|
|
141
|
+
"jest/no-disabled-tests": 0,
|
|
142
|
+
"react/no-find-dom-node": 0
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
"eslintIgnore": [
|
|
146
|
+
"test/fixtures",
|
|
147
|
+
"test/ts/",
|
|
148
|
+
"*.ts",
|
|
149
|
+
"dist"
|
|
150
|
+
],
|
|
151
|
+
"prettier": {
|
|
152
|
+
"singleQuote": true,
|
|
153
|
+
"trailingComma": "none",
|
|
154
|
+
"useTabs": true,
|
|
155
|
+
"tabWidth": 2
|
|
156
|
+
},
|
|
157
|
+
"lint-staged": {
|
|
158
|
+
"**/*.{js,jsx,ts,tsx,yml}": [
|
|
159
|
+
"prettier --write"
|
|
160
|
+
]
|
|
161
|
+
},
|
|
162
|
+
"husky": {
|
|
163
|
+
"hooks": {
|
|
164
|
+
"pre-commit": "lint-staged"
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
"files": [
|
|
168
|
+
"src",
|
|
169
|
+
"dist",
|
|
170
|
+
"compat/dist",
|
|
171
|
+
"compat/src",
|
|
172
|
+
"compat/server.js",
|
|
173
|
+
"compat/server.mjs",
|
|
174
|
+
"compat/test-utils.js",
|
|
175
|
+
"compat/jsx-runtime.js",
|
|
176
|
+
"compat/jsx-runtime.mjs",
|
|
177
|
+
"compat/jsx-dev-runtime.js",
|
|
178
|
+
"compat/jsx-dev-runtime.mjs",
|
|
179
|
+
"compat/package.json",
|
|
180
|
+
"debug/dist",
|
|
181
|
+
"debug/src",
|
|
182
|
+
"debug/package.json",
|
|
183
|
+
"devtools/dist",
|
|
184
|
+
"devtools/src",
|
|
185
|
+
"devtools/package.json",
|
|
186
|
+
"hooks/dist",
|
|
187
|
+
"hooks/src",
|
|
188
|
+
"hooks/package.json",
|
|
189
|
+
"jsx-runtime/dist",
|
|
190
|
+
"jsx-runtime/src",
|
|
191
|
+
"jsx-runtime/package.json",
|
|
192
|
+
"test-utils/src",
|
|
193
|
+
"test-utils/package.json",
|
|
194
|
+
"test-utils/dist"
|
|
195
|
+
],
|
|
196
|
+
"keywords": [
|
|
197
|
+
"preact",
|
|
198
|
+
"react",
|
|
199
|
+
"ui",
|
|
200
|
+
"user interface",
|
|
201
|
+
"virtual dom",
|
|
202
|
+
"vdom",
|
|
203
|
+
"components",
|
|
204
|
+
"dom diff",
|
|
205
|
+
"front-end",
|
|
206
|
+
"framework"
|
|
207
|
+
],
|
|
208
|
+
"authors": [
|
|
209
|
+
"The Preact Authors (https://github.com/preactjs/preact/contributors)"
|
|
210
|
+
],
|
|
211
|
+
"repository": "preactjs/preact",
|
|
212
|
+
"bugs": "https://github.com/preactjs/preact/issues",
|
|
213
|
+
"homepage": "https://preactjs.com",
|
|
214
|
+
"devDependencies": {
|
|
215
|
+
"@babel/core": "^7.7.0",
|
|
216
|
+
"@babel/plugin-proposal-object-rest-spread": "^7.6.2",
|
|
217
|
+
"@babel/plugin-transform-react-jsx": "^7.7.0",
|
|
218
|
+
"@babel/plugin-transform-react-jsx-source": "^7.7.4",
|
|
219
|
+
"@babel/preset-env": "^7.7.1",
|
|
220
|
+
"@babel/register": "^7.7.0",
|
|
221
|
+
"@types/chai": "^4.1.2",
|
|
222
|
+
"@types/mocha": "^5.0.0",
|
|
223
|
+
"@types/node": "^14.14.10",
|
|
224
|
+
"babel-plugin-istanbul": "^6.0.0",
|
|
225
|
+
"babel-plugin-transform-async-to-promises": "^0.8.15",
|
|
226
|
+
"babel-plugin-transform-rename-properties": "0.1.0",
|
|
227
|
+
"benchmark": "^2.1.4",
|
|
228
|
+
"chai": "^4.1.2",
|
|
229
|
+
"check-export-map": "^1.0.1",
|
|
230
|
+
"coveralls": "^3.0.0",
|
|
231
|
+
"cross-env": "^7.0.2",
|
|
232
|
+
"csstype": "^3.0.5",
|
|
233
|
+
"diff": "^5.0.0",
|
|
234
|
+
"errorstacks": "^2.3.0",
|
|
235
|
+
"esbuild": "^0.8.47",
|
|
236
|
+
"eslint": "5.15.1",
|
|
237
|
+
"eslint-config-developit": "^1.1.1",
|
|
238
|
+
"eslint-config-prettier": "^6.5.0",
|
|
239
|
+
"eslint-plugin-react": "7.12.4",
|
|
240
|
+
"husky": "^4.3.0",
|
|
241
|
+
"karma": "^5.2.3",
|
|
242
|
+
"karma-chai-sinon": "^0.1.5",
|
|
243
|
+
"karma-chrome-launcher": "^3.1.0",
|
|
244
|
+
"karma-coverage": "^2.0.3",
|
|
245
|
+
"karma-esbuild": "^1.1.4",
|
|
246
|
+
"karma-mocha": "^2.0.1",
|
|
247
|
+
"karma-mocha-reporter": "^2.2.5",
|
|
248
|
+
"karma-sauce-launcher": "^4.3.4",
|
|
249
|
+
"karma-sinon": "^1.0.5",
|
|
250
|
+
"karma-sourcemap-loader": "^0.3.7",
|
|
251
|
+
"kolorist": "^1.2.10",
|
|
252
|
+
"lint-staged": "^10.5.2",
|
|
253
|
+
"lodash": "^4.17.20",
|
|
254
|
+
"microbundle": "^0.11.0",
|
|
255
|
+
"mocha": "^8.2.1",
|
|
256
|
+
"npm-merge-driver-install": "^1.1.1",
|
|
257
|
+
"npm-run-all": "^4.0.0",
|
|
258
|
+
"prettier": "^1.18.2",
|
|
259
|
+
"prop-types": "^15.7.2",
|
|
260
|
+
"sinon": "^9.2.3",
|
|
261
|
+
"sinon-chai": "^3.5.0",
|
|
262
|
+
"typescript": "3.5.3"
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
,"_resolved": "https://registry.npmjs.org/preact/-/preact-10.5.13.tgz"
|
|
266
|
+
,"_integrity": "sha512-q/vlKIGNwzTLu+jCcvywgGrt+H/1P/oIRSD6mV4ln3hmlC+Aa34C7yfPI4+5bzW8pONyVXYS7SvXosy2dKKtWQ=="
|
|
267
|
+
,"_from": "preact@10.5.13"
|
|
268
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { assign } from './util';
|
|
2
|
+
import { createVNode } from './create-element';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Clones the given VNode, optionally adding attributes/props and replacing its children.
|
|
6
|
+
* @param {import('./internal').VNode} vnode The virtual DOM element to clone
|
|
7
|
+
* @param {object} props Attributes/props to add when cloning
|
|
8
|
+
* @param {Array<import('./internal').ComponentChildren>} rest Any additional arguments will be used as replacement children.
|
|
9
|
+
* @returns {import('./internal').VNode}
|
|
10
|
+
*/
|
|
11
|
+
export function cloneElement(vnode, props, children) {
|
|
12
|
+
let normalizedProps = assign({}, vnode.props),
|
|
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
|
+
for (i = 3; i < arguments.length; i++) {
|
|
25
|
+
children.push(arguments[i]);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
if (children != null) {
|
|
29
|
+
normalizedProps.children = children;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return createVNode(
|
|
33
|
+
vnode.type,
|
|
34
|
+
normalizedProps,
|
|
35
|
+
key || vnode.key,
|
|
36
|
+
ref || vnode.ref,
|
|
37
|
+
null
|
|
38
|
+
);
|
|
39
|
+
}
|