@wordpress/widgets 4.32.0 → 4.32.1-next.ff1cebbba.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/build/blocks/legacy-widget/block.json +29 -0
- package/build/blocks/legacy-widget/edit/control.js +137 -167
- package/build/blocks/legacy-widget/edit/control.js.map +7 -1
- package/build/blocks/legacy-widget/edit/convert-to-blocks-button.js +51 -39
- package/build/blocks/legacy-widget/edit/convert-to-blocks-button.js.map +7 -1
- package/build/blocks/legacy-widget/edit/form.js +105 -75
- package/build/blocks/legacy-widget/edit/form.js.map +7 -1
- package/build/blocks/legacy-widget/edit/index.js +121 -131
- package/build/blocks/legacy-widget/edit/index.js.map +7 -1
- package/build/blocks/legacy-widget/edit/inspector-card.js +28 -20
- package/build/blocks/legacy-widget/edit/inspector-card.js.map +7 -1
- package/build/blocks/legacy-widget/edit/no-preview.js +29 -23
- package/build/blocks/legacy-widget/edit/no-preview.js.map +7 -1
- package/build/blocks/legacy-widget/edit/preview.js +107 -108
- package/build/blocks/legacy-widget/edit/preview.js.map +7 -1
- package/build/blocks/legacy-widget/edit/widget-type-selector.js +61 -52
- package/build/blocks/legacy-widget/edit/widget-type-selector.js.map +7 -1
- package/build/blocks/legacy-widget/index.js +49 -53
- package/build/blocks/legacy-widget/index.js.map +7 -1
- package/build/blocks/legacy-widget/transforms.js +189 -198
- package/build/blocks/legacy-widget/transforms.js.map +7 -1
- package/build/blocks/widget-group/block.json +20 -0
- package/build/blocks/widget-group/deprecated.js +38 -24
- package/build/blocks/widget-group/deprecated.js.map +7 -1
- package/build/blocks/widget-group/edit.js +63 -67
- package/build/blocks/widget-group/edit.js.map +7 -1
- package/build/blocks/widget-group/index.js +93 -80
- package/build/blocks/widget-group/index.js.map +7 -1
- package/build/blocks/widget-group/save.js +36 -25
- package/build/blocks/widget-group/save.js.map +7 -1
- package/build/components/index.js +36 -12
- package/build/components/index.js.map +7 -1
- package/build/components/move-to-widget-area/index.js +48 -37
- package/build/components/move-to-widget-area/index.js.map +7 -1
- package/build/index.js +67 -98
- package/build/index.js.map +7 -1
- package/build/register-legacy-widget-variations.js +42 -30
- package/build/register-legacy-widget-variations.js.map +7 -1
- package/build/utils.js +29 -29
- package/build/utils.js.map +7 -1
- package/build-module/blocks/legacy-widget/block.json +29 -0
- package/build-module/blocks/legacy-widget/edit/control.js +107 -158
- package/build-module/blocks/legacy-widget/edit/control.js.map +7 -1
- package/build-module/blocks/legacy-widget/edit/convert-to-blocks-button.js +33 -33
- package/build-module/blocks/legacy-widget/edit/convert-to-blocks-button.js.map +7 -1
- package/build-module/blocks/legacy-widget/edit/form.js +75 -64
- package/build-module/blocks/legacy-widget/edit/form.js.map +7 -1
- package/build-module/blocks/legacy-widget/edit/index.js +96 -122
- package/build-module/blocks/legacy-widget/edit/index.js.map +7 -1
- package/build-module/blocks/legacy-widget/edit/inspector-card.js +10 -15
- package/build-module/blocks/legacy-widget/edit/inspector-card.js.map +7 -1
- package/build-module/blocks/legacy-widget/edit/no-preview.js +11 -17
- package/build-module/blocks/legacy-widget/edit/no-preview.js.map +7 -1
- package/build-module/blocks/legacy-widget/edit/preview.js +76 -98
- package/build-module/blocks/legacy-widget/edit/preview.js.map +7 -1
- package/build-module/blocks/legacy-widget/edit/widget-type-selector.js +43 -46
- package/build-module/blocks/legacy-widget/edit/widget-type-selector.js.map +7 -1
- package/build-module/blocks/legacy-widget/index.js +12 -45
- package/build-module/blocks/legacy-widget/index.js.map +7 -1
- package/build-module/blocks/legacy-widget/transforms.js +171 -192
- package/build-module/blocks/legacy-widget/transforms.js.map +7 -1
- package/build-module/blocks/widget-group/block.json +20 -0
- package/build-module/blocks/widget-group/deprecated.js +20 -18
- package/build-module/blocks/widget-group/deprecated.js.map +7 -1
- package/build-module/blocks/widget-group/edit.js +53 -62
- package/build-module/blocks/widget-group/edit.js.map +7 -1
- package/build-module/blocks/widget-group/index.js +55 -71
- package/build-module/blocks/widget-group/index.js.map +7 -1
- package/build-module/blocks/widget-group/save.js +18 -19
- package/build-module/blocks/widget-group/save.js.map +7 -1
- package/build-module/components/index.js +5 -2
- package/build-module/components/index.js.map +7 -1
- package/build-module/components/move-to-widget-area/index.js +37 -32
- package/build-module/components/move-to-widget-area/index.js.map +7 -1
- package/build-module/index.js +34 -60
- package/build-module/index.js.map +7 -1
- package/build-module/register-legacy-widget-variations.js +24 -24
- package/build-module/register-legacy-widget-variations.js.map +7 -1
- package/build-module/utils.js +8 -25
- package/build-module/utils.js.map +7 -1
- package/build-style/style-rtl.css +10 -145
- package/build-style/style.css +10 -145
- package/package.json +21 -14
- package/src/blocks/legacy-widget/editor.scss +3 -0
- package/src/blocks/widget-group/editor.scss +3 -0
- package/src/style.scss +3 -2
|
@@ -1,22 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import {
|
|
9
|
-
import
|
|
10
|
-
|
|
11
|
-
import { __, sprintf } from '@wordpress/i18n';
|
|
12
|
-
import { Popover } from '@wordpress/components';
|
|
13
|
-
import { useViewportMatch } from '@wordpress/compose';
|
|
14
|
-
/**
|
|
15
|
-
* Internal dependencies
|
|
16
|
-
*/
|
|
17
|
-
import Control from './control';
|
|
18
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
19
|
-
export default function Form({
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import clsx from "clsx";
|
|
3
|
+
import { useRef, useEffect } from "@wordpress/element";
|
|
4
|
+
import { useDispatch } from "@wordpress/data";
|
|
5
|
+
import { store as noticesStore } from "@wordpress/notices";
|
|
6
|
+
import { __, sprintf } from "@wordpress/i18n";
|
|
7
|
+
import { Popover } from "@wordpress/components";
|
|
8
|
+
import { useViewportMatch } from "@wordpress/compose";
|
|
9
|
+
import Control from "./control";
|
|
10
|
+
function Form({
|
|
20
11
|
title,
|
|
21
12
|
isVisible,
|
|
22
13
|
id,
|
|
@@ -27,17 +18,10 @@ export default function Form({
|
|
|
27
18
|
onChangeHasPreview
|
|
28
19
|
}) {
|
|
29
20
|
const ref = useRef();
|
|
30
|
-
const isMediumLargeViewport = useViewportMatch(
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
// keep track of changes made to instance by the control itself and then
|
|
35
|
-
// ignore those.
|
|
36
|
-
const outgoingInstances = useRef(new Set());
|
|
37
|
-
const incomingInstances = useRef(new Set());
|
|
38
|
-
const {
|
|
39
|
-
createNotice
|
|
40
|
-
} = useDispatch(noticesStore);
|
|
21
|
+
const isMediumLargeViewport = useViewportMatch("small");
|
|
22
|
+
const outgoingInstances = useRef(/* @__PURE__ */ new Set());
|
|
23
|
+
const incomingInstances = useRef(/* @__PURE__ */ new Set());
|
|
24
|
+
const { createNotice } = useDispatch(noticesStore);
|
|
41
25
|
useEffect(() => {
|
|
42
26
|
if (incomingInstances.current.has(instance)) {
|
|
43
27
|
incomingInstances.current.delete(instance);
|
|
@@ -55,8 +39,16 @@ export default function Form({
|
|
|
55
39
|
onChangeHasPreview,
|
|
56
40
|
onError(error) {
|
|
57
41
|
window.console.error(error);
|
|
58
|
-
createNotice(
|
|
59
|
-
|
|
42
|
+
createNotice(
|
|
43
|
+
"error",
|
|
44
|
+
sprintf(
|
|
45
|
+
/* translators: %s: the name of the affected block. */
|
|
46
|
+
__(
|
|
47
|
+
'The "%s" block was affected by errors and may not function properly. Check the developer tools for more details.'
|
|
48
|
+
),
|
|
49
|
+
idBase || id
|
|
50
|
+
)
|
|
51
|
+
);
|
|
60
52
|
}
|
|
61
53
|
});
|
|
62
54
|
ref.current.appendChild(control.element);
|
|
@@ -67,38 +59,57 @@ export default function Form({
|
|
|
67
59
|
}
|
|
68
60
|
control.destroy();
|
|
69
61
|
};
|
|
70
|
-
}, [
|
|
62
|
+
}, [
|
|
63
|
+
id,
|
|
64
|
+
idBase,
|
|
65
|
+
instance,
|
|
66
|
+
onChangeInstance,
|
|
67
|
+
onChangeHasPreview,
|
|
68
|
+
isMediumLargeViewport
|
|
69
|
+
]);
|
|
71
70
|
if (isWide && isMediumLargeViewport) {
|
|
72
|
-
return
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
children:
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
71
|
+
return /* @__PURE__ */ jsxs(
|
|
72
|
+
"div",
|
|
73
|
+
{
|
|
74
|
+
className: clsx({
|
|
75
|
+
"wp-block-legacy-widget__container": isVisible
|
|
76
|
+
}),
|
|
77
|
+
children: [
|
|
78
|
+
isVisible && /* @__PURE__ */ jsx("h3", { className: "wp-block-legacy-widget__edit-form-title", children: title }),
|
|
79
|
+
/* @__PURE__ */ jsx(
|
|
80
|
+
Popover,
|
|
81
|
+
{
|
|
82
|
+
focusOnMount: false,
|
|
83
|
+
placement: "right",
|
|
84
|
+
offset: 32,
|
|
85
|
+
resize: false,
|
|
86
|
+
flip: false,
|
|
87
|
+
shift: true,
|
|
88
|
+
children: /* @__PURE__ */ jsx(
|
|
89
|
+
"div",
|
|
90
|
+
{
|
|
91
|
+
ref,
|
|
92
|
+
className: "wp-block-legacy-widget__edit-form",
|
|
93
|
+
hidden: !isVisible
|
|
94
|
+
}
|
|
95
|
+
)
|
|
96
|
+
}
|
|
97
|
+
)
|
|
98
|
+
]
|
|
99
|
+
}
|
|
100
|
+
);
|
|
93
101
|
}
|
|
94
|
-
return
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
children: title
|
|
101
|
-
}
|
|
102
|
-
|
|
102
|
+
return /* @__PURE__ */ jsx(
|
|
103
|
+
"div",
|
|
104
|
+
{
|
|
105
|
+
ref,
|
|
106
|
+
className: "wp-block-legacy-widget__edit-form",
|
|
107
|
+
hidden: !isVisible,
|
|
108
|
+
children: /* @__PURE__ */ jsx("h3", { className: "wp-block-legacy-widget__edit-form-title", children: title })
|
|
109
|
+
}
|
|
110
|
+
);
|
|
103
111
|
}
|
|
104
|
-
|
|
112
|
+
export {
|
|
113
|
+
Form as default
|
|
114
|
+
};
|
|
115
|
+
//# sourceMappingURL=form.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/blocks/legacy-widget/edit/form.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n/**\n * WordPress dependencies\n */\nimport { useRef, useEffect } from '@wordpress/element';\nimport { useDispatch } from '@wordpress/data';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { Popover } from '@wordpress/components';\nimport { useViewportMatch } from '@wordpress/compose';\n/**\n * Internal dependencies\n */\nimport Control from './control';\n\nexport default function Form( {\n\ttitle,\n\tisVisible,\n\tid,\n\tidBase,\n\tinstance,\n\tisWide,\n\tonChangeInstance,\n\tonChangeHasPreview,\n} ) {\n\tconst ref = useRef();\n\n\tconst isMediumLargeViewport = useViewportMatch( 'small' );\n\n\t// We only want to remount the control when the instance changes\n\t// *externally*. For example, if the user performs an undo. To do this, we\n\t// keep track of changes made to instance by the control itself and then\n\t// ignore those.\n\tconst outgoingInstances = useRef( new Set() );\n\tconst incomingInstances = useRef( new Set() );\n\n\tconst { createNotice } = useDispatch( noticesStore );\n\n\tuseEffect( () => {\n\t\tif ( incomingInstances.current.has( instance ) ) {\n\t\t\tincomingInstances.current.delete( instance );\n\t\t\treturn;\n\t\t}\n\n\t\tconst control = new Control( {\n\t\t\tid,\n\t\t\tidBase,\n\t\t\tinstance,\n\t\t\tonChangeInstance( nextInstance ) {\n\t\t\t\toutgoingInstances.current.add( instance );\n\t\t\t\tincomingInstances.current.add( nextInstance );\n\t\t\t\tonChangeInstance( nextInstance );\n\t\t\t},\n\t\t\tonChangeHasPreview,\n\t\t\tonError( error ) {\n\t\t\t\twindow.console.error( error );\n\t\t\t\tcreateNotice(\n\t\t\t\t\t'error',\n\t\t\t\t\tsprintf(\n\t\t\t\t\t\t/* translators: %s: the name of the affected block. */\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'The \"%s\" block was affected by errors and may not function properly. Check the developer tools for more details.'\n\t\t\t\t\t\t),\n\t\t\t\t\t\tidBase || id\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t},\n\t\t} );\n\n\t\tref.current.appendChild( control.element );\n\n\t\treturn () => {\n\t\t\tif ( outgoingInstances.current.has( instance ) ) {\n\t\t\t\toutgoingInstances.current.delete( instance );\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tcontrol.destroy();\n\t\t};\n\t}, [\n\t\tid,\n\t\tidBase,\n\t\tinstance,\n\t\tonChangeInstance,\n\t\tonChangeHasPreview,\n\t\tisMediumLargeViewport,\n\t] );\n\n\tif ( isWide && isMediumLargeViewport ) {\n\t\treturn (\n\t\t\t<div\n\t\t\t\tclassName={ clsx( {\n\t\t\t\t\t'wp-block-legacy-widget__container': isVisible,\n\t\t\t\t} ) }\n\t\t\t>\n\t\t\t\t{ isVisible && (\n\t\t\t\t\t<h3 className=\"wp-block-legacy-widget__edit-form-title\">\n\t\t\t\t\t\t{ title }\n\t\t\t\t\t</h3>\n\t\t\t\t) }\n\t\t\t\t<Popover\n\t\t\t\t\tfocusOnMount={ false }\n\t\t\t\t\tplacement=\"right\"\n\t\t\t\t\toffset={ 32 }\n\t\t\t\t\tresize={ false }\n\t\t\t\t\tflip={ false }\n\t\t\t\t\tshift\n\t\t\t\t>\n\t\t\t\t\t<div\n\t\t\t\t\t\tref={ ref }\n\t\t\t\t\t\tclassName=\"wp-block-legacy-widget__edit-form\"\n\t\t\t\t\t\thidden={ ! isVisible }\n\t\t\t\t\t></div>\n\t\t\t\t</Popover>\n\t\t\t</div>\n\t\t);\n\t}\n\n\treturn (\n\t\t<div\n\t\t\tref={ ref }\n\t\t\tclassName=\"wp-block-legacy-widget__edit-form\"\n\t\t\thidden={ ! isVisible }\n\t\t>\n\t\t\t<h3 className=\"wp-block-legacy-widget__edit-form-title\">\n\t\t\t\t{ title }\n\t\t\t</h3>\n\t\t</div>\n\t);\n}\n"],
|
|
5
|
+
"mappings": "AA6FG,SAME,KANF;AA1FH,OAAO,UAAU;AAIjB,SAAS,QAAQ,iBAAiB;AAClC,SAAS,mBAAmB;AAC5B,SAAS,SAAS,oBAAoB;AACtC,SAAS,IAAI,eAAe;AAC5B,SAAS,eAAe;AACxB,SAAS,wBAAwB;AAIjC,OAAO,aAAa;AAEL,SAAR,KAAuB;AAAA,EAC7B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAAI;AACH,QAAM,MAAM,OAAO;AAEnB,QAAM,wBAAwB,iBAAkB,OAAQ;AAMxD,QAAM,oBAAoB,OAAQ,oBAAI,IAAI,CAAE;AAC5C,QAAM,oBAAoB,OAAQ,oBAAI,IAAI,CAAE;AAE5C,QAAM,EAAE,aAAa,IAAI,YAAa,YAAa;AAEnD,YAAW,MAAM;AAChB,QAAK,kBAAkB,QAAQ,IAAK,QAAS,GAAI;AAChD,wBAAkB,QAAQ,OAAQ,QAAS;AAC3C;AAAA,IACD;AAEA,UAAM,UAAU,IAAI,QAAS;AAAA,MAC5B;AAAA,MACA;AAAA,MACA;AAAA,MACA,iBAAkB,cAAe;AAChC,0BAAkB,QAAQ,IAAK,QAAS;AACxC,0BAAkB,QAAQ,IAAK,YAAa;AAC5C,yBAAkB,YAAa;AAAA,MAChC;AAAA,MACA;AAAA,MACA,QAAS,OAAQ;AAChB,eAAO,QAAQ,MAAO,KAAM;AAC5B;AAAA,UACC;AAAA,UACA;AAAA;AAAA,YAEC;AAAA,cACC;AAAA,YACD;AAAA,YACA,UAAU;AAAA,UACX;AAAA,QACD;AAAA,MACD;AAAA,IACD,CAAE;AAEF,QAAI,QAAQ,YAAa,QAAQ,OAAQ;AAEzC,WAAO,MAAM;AACZ,UAAK,kBAAkB,QAAQ,IAAK,QAAS,GAAI;AAChD,0BAAkB,QAAQ,OAAQ,QAAS;AAC3C;AAAA,MACD;AAEA,cAAQ,QAAQ;AAAA,IACjB;AAAA,EACD,GAAG;AAAA,IACF;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD,CAAE;AAEF,MAAK,UAAU,uBAAwB;AACtC,WACC;AAAA,MAAC;AAAA;AAAA,QACA,WAAY,KAAM;AAAA,UACjB,qCAAqC;AAAA,QACtC,CAAE;AAAA,QAEA;AAAA,uBACD,oBAAC,QAAG,WAAU,2CACX,iBACH;AAAA,UAED;AAAA,YAAC;AAAA;AAAA,cACA,cAAe;AAAA,cACf,WAAU;AAAA,cACV,QAAS;AAAA,cACT,QAAS;AAAA,cACT,MAAO;AAAA,cACP,OAAK;AAAA,cAEL;AAAA,gBAAC;AAAA;AAAA,kBACA;AAAA,kBACA,WAAU;AAAA,kBACV,QAAS,CAAE;AAAA;AAAA,cACX;AAAA;AAAA,UACF;AAAA;AAAA;AAAA,IACD;AAAA,EAEF;AAEA,SACC;AAAA,IAAC;AAAA;AAAA,MACA;AAAA,MACA,WAAU;AAAA,MACV,QAAS,CAAE;AAAA,MAEX,8BAAC,QAAG,WAAU,2CACX,iBACH;AAAA;AAAA,EACD;AAEF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,70 +1,43 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
import
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
import NoPreview from './no-preview';
|
|
24
|
-
import ConvertToBlocksButton from './convert-to-blocks-button';
|
|
25
|
-
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
26
|
-
export default function Edit(props) {
|
|
27
|
-
const {
|
|
28
|
-
id,
|
|
29
|
-
idBase
|
|
30
|
-
} = props.attributes;
|
|
31
|
-
const {
|
|
32
|
-
isWide = false
|
|
33
|
-
} = props;
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import clsx from "clsx";
|
|
3
|
+
import {
|
|
4
|
+
useBlockProps,
|
|
5
|
+
BlockControls,
|
|
6
|
+
InspectorControls,
|
|
7
|
+
BlockIcon
|
|
8
|
+
} from "@wordpress/block-editor";
|
|
9
|
+
import { Flex, FlexBlock, Spinner, Placeholder } from "@wordpress/components";
|
|
10
|
+
import { brush as brushIcon } from "@wordpress/icons";
|
|
11
|
+
import { __ } from "@wordpress/i18n";
|
|
12
|
+
import { useState, useCallback } from "@wordpress/element";
|
|
13
|
+
import { useEntityRecord } from "@wordpress/core-data";
|
|
14
|
+
import WidgetTypeSelector from "./widget-type-selector";
|
|
15
|
+
import InspectorCard from "./inspector-card";
|
|
16
|
+
import Form from "./form";
|
|
17
|
+
import Preview from "./preview";
|
|
18
|
+
import NoPreview from "./no-preview";
|
|
19
|
+
import ConvertToBlocksButton from "./convert-to-blocks-button";
|
|
20
|
+
function Edit(props) {
|
|
21
|
+
const { id, idBase } = props.attributes;
|
|
22
|
+
const { isWide = false } = props;
|
|
34
23
|
const blockProps = useBlockProps({
|
|
35
24
|
className: clsx({
|
|
36
|
-
|
|
37
|
-
})
|
|
38
|
-
});
|
|
39
|
-
return /*#__PURE__*/_jsx("div", {
|
|
40
|
-
...blockProps,
|
|
41
|
-
children: !id && !idBase ? /*#__PURE__*/_jsx(Empty, {
|
|
42
|
-
...props
|
|
43
|
-
}) : /*#__PURE__*/_jsx(NotEmpty, {
|
|
44
|
-
...props
|
|
25
|
+
"is-wide-widget": isWide
|
|
45
26
|
})
|
|
46
27
|
});
|
|
28
|
+
return /* @__PURE__ */ jsx("div", { ...blockProps, children: !id && !idBase ? /* @__PURE__ */ jsx(Empty, { ...props }) : /* @__PURE__ */ jsx(NotEmpty, { ...props }) });
|
|
47
29
|
}
|
|
48
|
-
function Empty({
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
label: __('Legacy Widget'),
|
|
60
|
-
children: /*#__PURE__*/_jsx(Flex, {
|
|
61
|
-
children: /*#__PURE__*/_jsx(FlexBlock, {
|
|
62
|
-
children: /*#__PURE__*/_jsx(WidgetTypeSelector, {
|
|
63
|
-
selectedId: id !== null && id !== void 0 ? id : idBase,
|
|
64
|
-
onSelect: ({
|
|
65
|
-
selectedId,
|
|
66
|
-
isMulti
|
|
67
|
-
}) => {
|
|
30
|
+
function Empty({ attributes: { id, idBase }, setAttributes }) {
|
|
31
|
+
return /* @__PURE__ */ jsx(
|
|
32
|
+
Placeholder,
|
|
33
|
+
{
|
|
34
|
+
icon: /* @__PURE__ */ jsx(BlockIcon, { icon: brushIcon }),
|
|
35
|
+
label: __("Legacy Widget"),
|
|
36
|
+
children: /* @__PURE__ */ jsx(Flex, { children: /* @__PURE__ */ jsx(FlexBlock, { children: /* @__PURE__ */ jsx(
|
|
37
|
+
WidgetTypeSelector,
|
|
38
|
+
{
|
|
39
|
+
selectedId: id ?? idBase,
|
|
40
|
+
onSelect: ({ selectedId, isMulti }) => {
|
|
68
41
|
if (!selectedId) {
|
|
69
42
|
setAttributes({
|
|
70
43
|
id: null,
|
|
@@ -85,80 +58,81 @@ function Empty({
|
|
|
85
58
|
});
|
|
86
59
|
}
|
|
87
60
|
}
|
|
88
|
-
}
|
|
89
|
-
})
|
|
90
|
-
}
|
|
91
|
-
|
|
61
|
+
}
|
|
62
|
+
) }) })
|
|
63
|
+
}
|
|
64
|
+
);
|
|
92
65
|
}
|
|
93
66
|
function NotEmpty({
|
|
94
|
-
attributes: {
|
|
95
|
-
id,
|
|
96
|
-
idBase,
|
|
97
|
-
instance
|
|
98
|
-
},
|
|
67
|
+
attributes: { id, idBase, instance },
|
|
99
68
|
setAttributes,
|
|
100
69
|
clientId,
|
|
101
70
|
isSelected,
|
|
102
71
|
isWide = false
|
|
103
72
|
}) {
|
|
104
73
|
const [hasPreview, setHasPreview] = useState(null);
|
|
105
|
-
const widgetTypeId = id
|
|
106
|
-
const {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
} = useEntityRecord('root', 'widgetType', widgetTypeId);
|
|
110
|
-
const setInstance = useCallback(nextInstance => {
|
|
111
|
-
setAttributes({
|
|
112
|
-
instance: nextInstance
|
|
113
|
-
});
|
|
74
|
+
const widgetTypeId = id ?? idBase;
|
|
75
|
+
const { record: widgetType, hasResolved: hasResolvedWidgetType } = useEntityRecord("root", "widgetType", widgetTypeId);
|
|
76
|
+
const setInstance = useCallback((nextInstance) => {
|
|
77
|
+
setAttributes({ instance: nextInstance });
|
|
114
78
|
}, []);
|
|
115
79
|
if (!widgetType && hasResolvedWidgetType) {
|
|
116
|
-
return
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
80
|
+
return /* @__PURE__ */ jsx(
|
|
81
|
+
Placeholder,
|
|
82
|
+
{
|
|
83
|
+
icon: /* @__PURE__ */ jsx(BlockIcon, { icon: brushIcon }),
|
|
84
|
+
label: __("Legacy Widget"),
|
|
85
|
+
children: __("Widget is missing.")
|
|
86
|
+
}
|
|
87
|
+
);
|
|
123
88
|
}
|
|
124
89
|
if (!hasResolvedWidgetType) {
|
|
125
|
-
return
|
|
126
|
-
children: /*#__PURE__*/_jsx(Spinner, {})
|
|
127
|
-
});
|
|
90
|
+
return /* @__PURE__ */ jsx(Placeholder, { children: /* @__PURE__ */ jsx(Spinner, {}) });
|
|
128
91
|
}
|
|
129
|
-
const mode = idBase && !isSelected ?
|
|
130
|
-
return
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
clientId
|
|
92
|
+
const mode = idBase && !isSelected ? "preview" : "edit";
|
|
93
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
94
|
+
idBase === "text" && /* @__PURE__ */ jsx(BlockControls, { group: "other", children: /* @__PURE__ */ jsx(
|
|
95
|
+
ConvertToBlocksButton,
|
|
96
|
+
{
|
|
97
|
+
clientId,
|
|
135
98
|
rawInstance: instance.raw
|
|
136
|
-
}
|
|
137
|
-
}),
|
|
138
|
-
|
|
99
|
+
}
|
|
100
|
+
) }),
|
|
101
|
+
/* @__PURE__ */ jsx(InspectorControls, { children: /* @__PURE__ */ jsx(
|
|
102
|
+
InspectorCard,
|
|
103
|
+
{
|
|
139
104
|
name: widgetType.name,
|
|
140
105
|
description: widgetType.description
|
|
141
|
-
}
|
|
142
|
-
}),
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
106
|
+
}
|
|
107
|
+
) }),
|
|
108
|
+
/* @__PURE__ */ jsx(
|
|
109
|
+
Form,
|
|
110
|
+
{
|
|
111
|
+
title: widgetType.name,
|
|
112
|
+
isVisible: mode === "edit",
|
|
113
|
+
id,
|
|
114
|
+
idBase,
|
|
115
|
+
instance,
|
|
116
|
+
isWide,
|
|
117
|
+
onChangeInstance: setInstance,
|
|
118
|
+
onChangeHasPreview: setHasPreview
|
|
119
|
+
}
|
|
120
|
+
),
|
|
121
|
+
idBase && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
122
|
+
hasPreview === null && mode === "preview" && /* @__PURE__ */ jsx(Placeholder, { children: /* @__PURE__ */ jsx(Spinner, {}) }),
|
|
123
|
+
hasPreview === true && /* @__PURE__ */ jsx(
|
|
124
|
+
Preview,
|
|
125
|
+
{
|
|
126
|
+
idBase,
|
|
127
|
+
instance,
|
|
128
|
+
isVisible: mode === "preview"
|
|
129
|
+
}
|
|
130
|
+
),
|
|
131
|
+
hasPreview === false && mode === "preview" && /* @__PURE__ */ jsx(NoPreview, { name: widgetType.name })
|
|
132
|
+
] })
|
|
133
|
+
] });
|
|
163
134
|
}
|
|
164
|
-
|
|
135
|
+
export {
|
|
136
|
+
Edit as default
|
|
137
|
+
};
|
|
138
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/blocks/legacy-widget/edit/index.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tuseBlockProps,\n\tBlockControls,\n\tInspectorControls,\n\tBlockIcon,\n} from '@wordpress/block-editor';\nimport { Flex, FlexBlock, Spinner, Placeholder } from '@wordpress/components';\nimport { brush as brushIcon } from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\nimport { useState, useCallback } from '@wordpress/element';\nimport { useEntityRecord } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport WidgetTypeSelector from './widget-type-selector';\nimport InspectorCard from './inspector-card';\nimport Form from './form';\nimport Preview from './preview';\nimport NoPreview from './no-preview';\nimport ConvertToBlocksButton from './convert-to-blocks-button';\n\nexport default function Edit( props ) {\n\tconst { id, idBase } = props.attributes;\n\tconst { isWide = false } = props;\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: clsx( {\n\t\t\t'is-wide-widget': isWide,\n\t\t} ),\n\t} );\n\n\treturn (\n\t\t<div { ...blockProps }>\n\t\t\t{ ! id && ! idBase ? (\n\t\t\t\t<Empty { ...props } />\n\t\t\t) : (\n\t\t\t\t<NotEmpty { ...props } />\n\t\t\t) }\n\t\t</div>\n\t);\n}\n\nfunction Empty( { attributes: { id, idBase }, setAttributes } ) {\n\treturn (\n\t\t<Placeholder\n\t\t\ticon={ <BlockIcon icon={ brushIcon } /> }\n\t\t\tlabel={ __( 'Legacy Widget' ) }\n\t\t>\n\t\t\t<Flex>\n\t\t\t\t<FlexBlock>\n\t\t\t\t\t<WidgetTypeSelector\n\t\t\t\t\t\tselectedId={ id ?? idBase }\n\t\t\t\t\t\tonSelect={ ( { selectedId, isMulti } ) => {\n\t\t\t\t\t\t\tif ( ! selectedId ) {\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tid: null,\n\t\t\t\t\t\t\t\t\tidBase: null,\n\t\t\t\t\t\t\t\t\tinstance: null,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t} else if ( isMulti ) {\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tid: null,\n\t\t\t\t\t\t\t\t\tidBase: selectedId,\n\t\t\t\t\t\t\t\t\tinstance: {},\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tid: selectedId,\n\t\t\t\t\t\t\t\t\tidBase: null,\n\t\t\t\t\t\t\t\t\tinstance: null,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t</FlexBlock>\n\t\t\t</Flex>\n\t\t</Placeholder>\n\t);\n}\n\nfunction NotEmpty( {\n\tattributes: { id, idBase, instance },\n\tsetAttributes,\n\tclientId,\n\tisSelected,\n\tisWide = false,\n} ) {\n\tconst [ hasPreview, setHasPreview ] = useState( null );\n\n\tconst widgetTypeId = id ?? idBase;\n\tconst { record: widgetType, hasResolved: hasResolvedWidgetType } =\n\t\tuseEntityRecord( 'root', 'widgetType', widgetTypeId );\n\n\tconst setInstance = useCallback( ( nextInstance ) => {\n\t\tsetAttributes( { instance: nextInstance } );\n\t}, [] );\n\n\tif ( ! widgetType && hasResolvedWidgetType ) {\n\t\treturn (\n\t\t\t<Placeholder\n\t\t\t\ticon={ <BlockIcon icon={ brushIcon } /> }\n\t\t\t\tlabel={ __( 'Legacy Widget' ) }\n\t\t\t>\n\t\t\t\t{ __( 'Widget is missing.' ) }\n\t\t\t</Placeholder>\n\t\t);\n\t}\n\n\tif ( ! hasResolvedWidgetType ) {\n\t\treturn (\n\t\t\t<Placeholder>\n\t\t\t\t<Spinner />\n\t\t\t</Placeholder>\n\t\t);\n\t}\n\n\tconst mode = idBase && ! isSelected ? 'preview' : 'edit';\n\n\treturn (\n\t\t<>\n\t\t\t{ idBase === 'text' && (\n\t\t\t\t<BlockControls group=\"other\">\n\t\t\t\t\t<ConvertToBlocksButton\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\trawInstance={ instance.raw }\n\t\t\t\t\t/>\n\t\t\t\t</BlockControls>\n\t\t\t) }\n\n\t\t\t<InspectorControls>\n\t\t\t\t<InspectorCard\n\t\t\t\t\tname={ widgetType.name }\n\t\t\t\t\tdescription={ widgetType.description }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\n\t\t\t<Form\n\t\t\t\ttitle={ widgetType.name }\n\t\t\t\tisVisible={ mode === 'edit' }\n\t\t\t\tid={ id }\n\t\t\t\tidBase={ idBase }\n\t\t\t\tinstance={ instance }\n\t\t\t\tisWide={ isWide }\n\t\t\t\tonChangeInstance={ setInstance }\n\t\t\t\tonChangeHasPreview={ setHasPreview }\n\t\t\t/>\n\n\t\t\t{ idBase && (\n\t\t\t\t<>\n\t\t\t\t\t{ hasPreview === null && mode === 'preview' && (\n\t\t\t\t\t\t<Placeholder>\n\t\t\t\t\t\t\t<Spinner />\n\t\t\t\t\t\t</Placeholder>\n\t\t\t\t\t) }\n\t\t\t\t\t{ hasPreview === true && (\n\t\t\t\t\t\t<Preview\n\t\t\t\t\t\t\tidBase={ idBase }\n\t\t\t\t\t\t\tinstance={ instance }\n\t\t\t\t\t\t\tisVisible={ mode === 'preview' }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t{ hasPreview === false && mode === 'preview' && (\n\t\t\t\t\t\t<NoPreview name={ widgetType.name } />\n\t\t\t\t\t) }\n\t\t\t\t</>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,16 +1,11 @@
|
|
|
1
|
-
import { jsx
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
})
|
|
6
|
-
|
|
7
|
-
className: "wp-block-legacy-widget-inspector-card",
|
|
8
|
-
children: [/*#__PURE__*/_jsx("h3", {
|
|
9
|
-
className: "wp-block-legacy-widget-inspector-card__name",
|
|
10
|
-
children: name
|
|
11
|
-
}), /*#__PURE__*/_jsx("span", {
|
|
12
|
-
children: description
|
|
13
|
-
})]
|
|
14
|
-
});
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
function InspectorCard({ name, description }) {
|
|
3
|
+
return /* @__PURE__ */ jsxs("div", { className: "wp-block-legacy-widget-inspector-card", children: [
|
|
4
|
+
/* @__PURE__ */ jsx("h3", { className: "wp-block-legacy-widget-inspector-card__name", children: name }),
|
|
5
|
+
/* @__PURE__ */ jsx("span", { children: description })
|
|
6
|
+
] });
|
|
15
7
|
}
|
|
16
|
-
|
|
8
|
+
export {
|
|
9
|
+
InspectorCard as default
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=inspector-card.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/blocks/legacy-widget/edit/inspector-card.js"],
|
|
4
|
+
"sourcesContent": ["export default function InspectorCard( { name, description } ) {\n\treturn (\n\t\t<div className=\"wp-block-legacy-widget-inspector-card\">\n\t\t\t<h3 className=\"wp-block-legacy-widget-inspector-card__name\">\n\t\t\t\t{ name }\n\t\t\t</h3>\n\t\t\t<span>{ description }</span>\n\t\t</div>\n\t);\n}\n"],
|
|
5
|
+
"mappings": "AAEE,SACC,KADD;AAFa,SAAR,cAAgC,EAAE,MAAM,YAAY,GAAI;AAC9D,SACC,qBAAC,SAAI,WAAU,yCACd;AAAA,wBAAC,QAAG,WAAU,+CACX,gBACH;AAAA,IACA,oBAAC,UAAO,uBAAa;AAAA,KACtB;AAEF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,18 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}) {
|
|
9
|
-
return /*#__PURE__*/_jsxs("div", {
|
|
10
|
-
className: "wp-block-legacy-widget__edit-no-preview",
|
|
11
|
-
children: [name && /*#__PURE__*/_jsx("h3", {
|
|
12
|
-
children: name
|
|
13
|
-
}), /*#__PURE__*/_jsx("p", {
|
|
14
|
-
children: __('No preview available.')
|
|
15
|
-
})]
|
|
16
|
-
});
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { __ } from "@wordpress/i18n";
|
|
3
|
+
function NoPreview({ name }) {
|
|
4
|
+
return /* @__PURE__ */ jsxs("div", { className: "wp-block-legacy-widget__edit-no-preview", children: [
|
|
5
|
+
name && /* @__PURE__ */ jsx("h3", { children: name }),
|
|
6
|
+
/* @__PURE__ */ jsx("p", { children: __("No preview available.") })
|
|
7
|
+
] });
|
|
17
8
|
}
|
|
18
|
-
|
|
9
|
+
export {
|
|
10
|
+
NoPreview as default
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=no-preview.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/blocks/legacy-widget/edit/no-preview.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\nexport default function NoPreview( { name } ) {\n\treturn (\n\t\t<div className=\"wp-block-legacy-widget__edit-no-preview\">\n\t\t\t{ name && <h3>{ name }</h3> }\n\t\t\t<p>{ __( 'No preview available.' ) }</p>\n\t\t</div>\n\t);\n}\n"],
|
|
5
|
+
"mappings": "AAOE,SACW,KADX;AAJF,SAAS,UAAU;AAEJ,SAAR,UAA4B,EAAE,KAAK,GAAI;AAC7C,SACC,qBAAC,SAAI,WAAU,2CACZ;AAAA,YAAQ,oBAAC,QAAK,gBAAM;AAAA,IACtB,oBAAC,OAAI,aAAI,uBAAwB,GAAG;AAAA,KACrC;AAEF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|