@wordpress/widgets 3.19.3 → 3.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/blocks/legacy-widget/edit/convert-to-blocks-button.js +2 -2
  3. package/build/blocks/legacy-widget/edit/convert-to-blocks-button.js.map +1 -1
  4. package/build/blocks/legacy-widget/edit/form.js +8 -7
  5. package/build/blocks/legacy-widget/edit/form.js.map +1 -1
  6. package/build/blocks/legacy-widget/edit/index.js +17 -16
  7. package/build/blocks/legacy-widget/edit/index.js.map +1 -1
  8. package/build/blocks/legacy-widget/edit/inspector-card.js +4 -4
  9. package/build/blocks/legacy-widget/edit/inspector-card.js.map +1 -1
  10. package/build/blocks/legacy-widget/edit/no-preview.js +3 -3
  11. package/build/blocks/legacy-widget/edit/no-preview.js.map +1 -1
  12. package/build/blocks/legacy-widget/edit/preview.js +4 -3
  13. package/build/blocks/legacy-widget/edit/preview.js.map +1 -1
  14. package/build/blocks/legacy-widget/edit/widget-type-selector.js +3 -3
  15. package/build/blocks/legacy-widget/edit/widget-type-selector.js.map +1 -1
  16. package/build/blocks/widget-group/deprecated.js +3 -3
  17. package/build/blocks/widget-group/deprecated.js.map +1 -1
  18. package/build/blocks/widget-group/edit.js +10 -10
  19. package/build/blocks/widget-group/edit.js.map +1 -1
  20. package/build/blocks/widget-group/save.js +4 -4
  21. package/build/blocks/widget-group/save.js.map +1 -1
  22. package/build/components/move-to-widget-area/index.js +4 -4
  23. package/build/components/move-to-widget-area/index.js.map +1 -1
  24. package/build-module/blocks/legacy-widget/edit/convert-to-blocks-button.js +1 -1
  25. package/build-module/blocks/legacy-widget/edit/form.js +1 -1
  26. package/build-module/blocks/legacy-widget/edit/index.js +1 -1
  27. package/build-module/blocks/legacy-widget/edit/inspector-card.js +1 -1
  28. package/build-module/blocks/legacy-widget/edit/no-preview.js +1 -1
  29. package/build-module/blocks/legacy-widget/edit/preview.js +1 -1
  30. package/build-module/blocks/legacy-widget/edit/widget-type-selector.js +1 -1
  31. package/build-module/blocks/widget-group/deprecated.js +1 -1
  32. package/build-module/blocks/widget-group/edit.js +1 -1
  33. package/build-module/blocks/widget-group/save.js +1 -1
  34. package/build-module/components/move-to-widget-area/index.js +1 -1
  35. package/build-style/style-rtl.css +1 -1
  36. package/build-style/style.css +1 -1
  37. package/package.json +13 -13
package/CHANGELOG.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 3.20.0 (2023-10-05)
6
+
5
7
  ## 3.19.0 (2023-09-20)
6
8
 
7
9
  ## 3.18.0 (2023-08-31)
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = ConvertToBlocksButton;
7
- var _element = require("@wordpress/element");
7
+ var _react = require("react");
8
8
  var _data = require("@wordpress/data");
9
9
  var _blockEditor = require("@wordpress/block-editor");
10
10
  var _components = require("@wordpress/components");
@@ -21,7 +21,7 @@ function ConvertToBlocksButton({
21
21
  const {
22
22
  replaceBlocks
23
23
  } = (0, _data.useDispatch)(_blockEditor.store);
24
- return (0, _element.createElement)(_components.ToolbarButton, {
24
+ return (0, _react.createElement)(_components.ToolbarButton, {
25
25
  onClick: () => {
26
26
  if (rawInstance.title) {
27
27
  replaceBlocks(clientId, [(0, _blocks.createBlock)('core/heading', {
@@ -1 +1 @@
1
- {"version":3,"names":["_data","require","_blockEditor","_components","_blocks","_i18n","ConvertToBlocksButton","clientId","rawInstance","replaceBlocks","useDispatch","blockEditorStore","_element","createElement","ToolbarButton","onClick","title","createBlock","content","rawHandler","HTML","text","__"],"sources":["@wordpress/widgets/src/blocks/legacy-widget/edit/convert-to-blocks-button.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { ToolbarButton } from '@wordpress/components';\nimport { createBlock, rawHandler } from '@wordpress/blocks';\nimport { __ } from '@wordpress/i18n';\n\nexport default function ConvertToBlocksButton( { clientId, rawInstance } ) {\n\tconst { replaceBlocks } = useDispatch( blockEditorStore );\n\n\treturn (\n\t\t<ToolbarButton\n\t\t\tonClick={ () => {\n\t\t\t\tif ( rawInstance.title ) {\n\t\t\t\t\treplaceBlocks( clientId, [\n\t\t\t\t\t\tcreateBlock( 'core/heading', {\n\t\t\t\t\t\t\tcontent: rawInstance.title,\n\t\t\t\t\t\t} ),\n\t\t\t\t\t\t...rawHandler( { HTML: rawInstance.text } ),\n\t\t\t\t\t] );\n\t\t\t\t} else {\n\t\t\t\t\treplaceBlocks(\n\t\t\t\t\t\tclientId,\n\t\t\t\t\t\trawHandler( { HTML: rawInstance.text } )\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t} }\n\t\t>\n\t\t\t{ __( 'Convert to blocks' ) }\n\t\t</ToolbarButton>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AAPA;AACA;AACA;;AAOe,SAASK,qBAAqBA,CAAE;EAAEC,QAAQ;EAAEC;AAAY,CAAC,EAAG;EAC1E,MAAM;IAAEC;EAAc,CAAC,GAAG,IAAAC,iBAAW,EAAEC,kBAAiB,CAAC;EAEzD,OACC,IAAAC,QAAA,CAAAC,aAAA,EAACV,WAAA,CAAAW,aAAa;IACbC,OAAO,EAAGA,CAAA,KAAM;MACf,IAAKP,WAAW,CAACQ,KAAK,EAAG;QACxBP,aAAa,CAAEF,QAAQ,EAAE,CACxB,IAAAU,mBAAW,EAAE,cAAc,EAAE;UAC5BC,OAAO,EAAEV,WAAW,CAACQ;QACtB,CAAE,CAAC,EACH,GAAG,IAAAG,kBAAU,EAAE;UAAEC,IAAI,EAAEZ,WAAW,CAACa;QAAK,CAAE,CAAC,CAC1C,CAAC;MACJ,CAAC,MAAM;QACNZ,aAAa,CACZF,QAAQ,EACR,IAAAY,kBAAU,EAAE;UAAEC,IAAI,EAAEZ,WAAW,CAACa;QAAK,CAAE,CACxC,CAAC;MACF;IACD;EAAG,GAED,IAAAC,QAAE,EAAE,mBAAoB,CACZ,CAAC;AAElB"}
1
+ {"version":3,"names":["_data","require","_blockEditor","_components","_blocks","_i18n","ConvertToBlocksButton","clientId","rawInstance","replaceBlocks","useDispatch","blockEditorStore","_react","createElement","ToolbarButton","onClick","title","createBlock","content","rawHandler","HTML","text","__"],"sources":["@wordpress/widgets/src/blocks/legacy-widget/edit/convert-to-blocks-button.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { ToolbarButton } from '@wordpress/components';\nimport { createBlock, rawHandler } from '@wordpress/blocks';\nimport { __ } from '@wordpress/i18n';\n\nexport default function ConvertToBlocksButton( { clientId, rawInstance } ) {\n\tconst { replaceBlocks } = useDispatch( blockEditorStore );\n\n\treturn (\n\t\t<ToolbarButton\n\t\t\tonClick={ () => {\n\t\t\t\tif ( rawInstance.title ) {\n\t\t\t\t\treplaceBlocks( clientId, [\n\t\t\t\t\t\tcreateBlock( 'core/heading', {\n\t\t\t\t\t\t\tcontent: rawInstance.title,\n\t\t\t\t\t\t} ),\n\t\t\t\t\t\t...rawHandler( { HTML: rawInstance.text } ),\n\t\t\t\t\t] );\n\t\t\t\t} else {\n\t\t\t\t\treplaceBlocks(\n\t\t\t\t\t\tclientId,\n\t\t\t\t\t\trawHandler( { HTML: rawInstance.text } )\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t} }\n\t\t>\n\t\t\t{ __( 'Convert to blocks' ) }\n\t\t</ToolbarButton>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AAPA;AACA;AACA;;AAOe,SAASK,qBAAqBA,CAAE;EAAEC,QAAQ;EAAEC;AAAY,CAAC,EAAG;EAC1E,MAAM;IAAEC;EAAc,CAAC,GAAG,IAAAC,iBAAW,EAAEC,kBAAiB,CAAC;EAEzD,OACC,IAAAC,MAAA,CAAAC,aAAA,EAACV,WAAA,CAAAW,aAAa;IACbC,OAAO,EAAGA,CAAA,KAAM;MACf,IAAKP,WAAW,CAACQ,KAAK,EAAG;QACxBP,aAAa,CAAEF,QAAQ,EAAE,CACxB,IAAAU,mBAAW,EAAE,cAAc,EAAE;UAC5BC,OAAO,EAAEV,WAAW,CAACQ;QACtB,CAAE,CAAC,EACH,GAAG,IAAAG,kBAAU,EAAE;UAAEC,IAAI,EAAEZ,WAAW,CAACa;QAAK,CAAE,CAAC,CAC1C,CAAC;MACJ,CAAC,MAAM;QACNZ,aAAa,CACZF,QAAQ,EACR,IAAAY,kBAAU,EAAE;UAAEC,IAAI,EAAEZ,WAAW,CAACa;QAAK,CAAE,CACxC,CAAC;MACF;IACD;EAAG,GAED,IAAAC,QAAE,EAAE,mBAAoB,CACZ,CAAC;AAElB"}
@@ -5,8 +5,9 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.default = Form;
8
- var _element = require("@wordpress/element");
8
+ var _react = require("react");
9
9
  var _classnames = _interopRequireDefault(require("classnames"));
10
+ var _element = require("@wordpress/element");
10
11
  var _data = require("@wordpress/data");
11
12
  var _notices = require("@wordpress/notices");
12
13
  var _i18n = require("@wordpress/i18n");
@@ -78,30 +79,30 @@ function Form({
78
79
  };
79
80
  }, [id, idBase, instance, onChangeInstance, onChangeHasPreview, isMediumLargeViewport]);
80
81
  if (isWide && isMediumLargeViewport) {
81
- return (0, _element.createElement)("div", {
82
+ return (0, _react.createElement)("div", {
82
83
  className: (0, _classnames.default)({
83
84
  'wp-block-legacy-widget__container': isVisible
84
85
  })
85
- }, isVisible && (0, _element.createElement)("h3", {
86
+ }, isVisible && (0, _react.createElement)("h3", {
86
87
  className: "wp-block-legacy-widget__edit-form-title"
87
- }, title), (0, _element.createElement)(_components.Popover, {
88
+ }, title), (0, _react.createElement)(_components.Popover, {
88
89
  focusOnMount: false,
89
90
  placement: "right",
90
91
  offset: 32,
91
92
  resize: false,
92
93
  flip: false,
93
94
  shift: true
94
- }, (0, _element.createElement)("div", {
95
+ }, (0, _react.createElement)("div", {
95
96
  ref: ref,
96
97
  className: "wp-block-legacy-widget__edit-form",
97
98
  hidden: !isVisible
98
99
  })));
99
100
  }
100
- return (0, _element.createElement)("div", {
101
+ return (0, _react.createElement)("div", {
101
102
  ref: ref,
102
103
  className: "wp-block-legacy-widget__edit-form",
103
104
  hidden: !isVisible
104
- }, (0, _element.createElement)("h3", {
105
+ }, (0, _react.createElement)("h3", {
105
106
  className: "wp-block-legacy-widget__edit-form-title"
106
107
  }, title));
107
108
  }
@@ -1 +1 @@
1
- {"version":3,"names":["_element","require","_classnames","_interopRequireDefault","_data","_notices","_i18n","_components","_compose","_control","Form","title","isVisible","id","idBase","instance","isWide","onChangeInstance","onChangeHasPreview","ref","useRef","isMediumLargeViewport","useViewportMatch","outgoingInstances","Set","incomingInstances","createNotice","useDispatch","noticesStore","useEffect","current","has","delete","control","Control","nextInstance","add","onError","error","window","console","sprintf","__","appendChild","element","destroy","createElement","className","classnames","Popover","focusOnMount","placement","offset","resize","flip","shift","hidden"],"sources":["@wordpress/widgets/src/blocks/legacy-widget/edit/form.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\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={ classnames( {\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"],"mappings":";;;;;;;AAOA,IAAAA,QAAA,GAAAC,OAAA;AAJA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;AAKA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,WAAA,GAAAN,OAAA;AACA,IAAAO,QAAA,GAAAP,OAAA;AAIA,IAAAQ,QAAA,GAAAN,sBAAA,CAAAF,OAAA;AAhBA;AACA;AACA;;AAEA;AACA;AACA;;AAOA;AACA;AACA;;AAGe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","_interopRequireDefault","require","_element","_data","_notices","_i18n","_components","_compose","_control","Form","title","isVisible","id","idBase","instance","isWide","onChangeInstance","onChangeHasPreview","ref","useRef","isMediumLargeViewport","useViewportMatch","outgoingInstances","Set","incomingInstances","createNotice","useDispatch","noticesStore","useEffect","current","has","delete","control","Control","nextInstance","add","onError","error","window","console","sprintf","__","appendChild","element","destroy","_react","createElement","className","classnames","Popover","focusOnMount","placement","offset","resize","flip","shift","hidden"],"sources":["@wordpress/widgets/src/blocks/legacy-widget/edit/form.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\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={ classnames( {\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"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAIA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AAIA,IAAAO,QAAA,GAAAR,sBAAA,CAAAC,OAAA;AAhBA;AACA;AACA;;AAEA;AACA;AACA;;AAOA;AACA;AACA;;AAGe,SAASQ,IAAIA,CAAE;EAC7BC,KAAK;EACLC,SAAS;EACTC,EAAE;EACFC,MAAM;EACNC,QAAQ;EACRC,MAAM;EACNC,gBAAgB;EAChBC;AACD,CAAC,EAAG;EACH,MAAMC,GAAG,GAAG,IAAAC,eAAM,EAAC,CAAC;EAEpB,MAAMC,qBAAqB,GAAG,IAAAC,yBAAgB,EAAE,OAAQ,CAAC;;EAEzD;EACA;EACA;EACA;EACA,MAAMC,iBAAiB,GAAG,IAAAH,eAAM,EAAE,IAAII,GAAG,CAAC,CAAE,CAAC;EAC7C,MAAMC,iBAAiB,GAAG,IAAAL,eAAM,EAAE,IAAII,GAAG,CAAC,CAAE,CAAC;EAE7C,MAAM;IAAEE;EAAa,CAAC,GAAG,IAAAC,iBAAW,EAAEC,cAAa,CAAC;EAEpD,IAAAC,kBAAS,EAAE,MAAM;IAChB,IAAKJ,iBAAiB,CAACK,OAAO,CAACC,GAAG,CAAEhB,QAAS,CAAC,EAAG;MAChDU,iBAAiB,CAACK,OAAO,CAACE,MAAM,CAAEjB,QAAS,CAAC;MAC5C;IACD;IAEA,MAAM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OAAO;MACPC,YAAY,EAAG,KAAO;MACtBC,SAAS,EAAC,OAAO;MACjBC,MAAM,EAAG,EAAI;MACbC,MAAM,EAAG,KAAO;MAChBC,IAAI,EAAG,KAAO;MACdC,KAAK;IAAA,GAEL,IAAAV,MAAA,CAAAC,aAAA;MACC5B,GAAG,EAAGA,GAAK;MACX6B,SAAS,EAAC,mCAAmC;MAC7CS,MAAM,EAAG,CAAE7C;IAAW,CACjB,CACE,CACL,CAAC;EAER;EAEA,OACC,IAAAkC,MAAA,CAAAC,aAAA;IACC5B,GAAG,EAAGA,GAAK;IACX6B,SAAS,EAAC,mCAAmC;IAC7CS,MAAM,EAAG,CAAE7C;EAAW,GAEtB,IAAAkC,MAAA,CAAAC,aAAA;IAAIC,SAAS,EAAC;EAAyC,GACpDrC,KACC,CACA,CAAC;AAER"}
@@ -5,12 +5,13 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.default = Edit;
8
- var _element = require("@wordpress/element");
8
+ var _react = require("react");
9
9
  var _classnames = _interopRequireDefault(require("classnames"));
10
10
  var _blockEditor = require("@wordpress/block-editor");
11
11
  var _components = require("@wordpress/components");
12
12
  var _icons = require("@wordpress/icons");
13
13
  var _i18n = require("@wordpress/i18n");
14
+ var _element = require("@wordpress/element");
14
15
  var _data = require("@wordpress/data");
15
16
  var _coreData = require("@wordpress/core-data");
16
17
  var _widgetTypeSelector = _interopRequireDefault(require("./widget-type-selector"));
@@ -44,11 +45,11 @@ function Edit(props) {
44
45
  'is-wide-widget': isWide
45
46
  })
46
47
  });
47
- return (0, _element.createElement)("div", {
48
+ return (0, _react.createElement)("div", {
48
49
  ...blockProps
49
- }, !id && !idBase ? (0, _element.createElement)(Empty, {
50
+ }, !id && !idBase ? (0, _react.createElement)(Empty, {
50
51
  ...props
51
- }) : (0, _element.createElement)(NotEmpty, {
52
+ }) : (0, _react.createElement)(NotEmpty, {
52
53
  ...props
53
54
  }));
54
55
  }
@@ -59,12 +60,12 @@ function Empty({
59
60
  },
60
61
  setAttributes
61
62
  }) {
62
- return (0, _element.createElement)(_components.Placeholder, {
63
- icon: (0, _element.createElement)(_blockEditor.BlockIcon, {
63
+ return (0, _react.createElement)(_components.Placeholder, {
64
+ icon: (0, _react.createElement)(_blockEditor.BlockIcon, {
64
65
  icon: _icons.brush
65
66
  }),
66
67
  label: (0, _i18n.__)('Legacy Widget')
67
- }, (0, _element.createElement)(_components.Flex, null, (0, _element.createElement)(_components.FlexBlock, null, (0, _element.createElement)(_widgetTypeSelector.default, {
68
+ }, (0, _react.createElement)(_components.Flex, null, (0, _react.createElement)(_components.FlexBlock, null, (0, _react.createElement)(_widgetTypeSelector.default, {
68
69
  selectedId: id !== null && id !== void 0 ? id : idBase,
69
70
  onSelect: ({
70
71
  selectedId,
@@ -116,26 +117,26 @@ function NotEmpty({
116
117
  });
117
118
  }, []);
118
119
  if (!widgetType && hasResolvedWidgetType) {
119
- return (0, _element.createElement)(_components.Placeholder, {
120
- icon: (0, _element.createElement)(_blockEditor.BlockIcon, {
120
+ return (0, _react.createElement)(_components.Placeholder, {
121
+ icon: (0, _react.createElement)(_blockEditor.BlockIcon, {
121
122
  icon: _icons.brush
122
123
  }),
123
124
  label: (0, _i18n.__)('Legacy Widget')
124
125
  }, (0, _i18n.__)('Widget is missing.'));
125
126
  }
126
127
  if (!hasResolvedWidgetType) {
127
- return (0, _element.createElement)(_components.Placeholder, null, (0, _element.createElement)(_components.Spinner, null));
128
+ return (0, _react.createElement)(_components.Placeholder, null, (0, _react.createElement)(_components.Spinner, null));
128
129
  }
129
130
  const mode = idBase && (isNavigationMode || !isSelected) ? 'preview' : 'edit';
130
- return (0, _element.createElement)(_element.Fragment, null, idBase === 'text' && (0, _element.createElement)(_blockEditor.BlockControls, {
131
+ return (0, _react.createElement)(_react.Fragment, null, idBase === 'text' && (0, _react.createElement)(_blockEditor.BlockControls, {
131
132
  group: "other"
132
- }, (0, _element.createElement)(_convertToBlocksButton.default, {
133
+ }, (0, _react.createElement)(_convertToBlocksButton.default, {
133
134
  clientId: clientId,
134
135
  rawInstance: instance.raw
135
- })), (0, _element.createElement)(_blockEditor.InspectorControls, null, (0, _element.createElement)(_inspectorCard.default, {
136
+ })), (0, _react.createElement)(_blockEditor.InspectorControls, null, (0, _react.createElement)(_inspectorCard.default, {
136
137
  name: widgetType.name,
137
138
  description: widgetType.description
138
- })), (0, _element.createElement)(_form.default, {
139
+ })), (0, _react.createElement)(_form.default, {
139
140
  title: widgetType.name,
140
141
  isVisible: mode === 'edit',
141
142
  id: id,
@@ -144,11 +145,11 @@ function NotEmpty({
144
145
  isWide: isWide,
145
146
  onChangeInstance: setInstance,
146
147
  onChangeHasPreview: setHasPreview
147
- }), idBase && (0, _element.createElement)(_element.Fragment, null, hasPreview === null && mode === 'preview' && (0, _element.createElement)(_components.Placeholder, null, (0, _element.createElement)(_components.Spinner, null)), hasPreview === true && (0, _element.createElement)(_preview.default, {
148
+ }), idBase && (0, _react.createElement)(_react.Fragment, null, hasPreview === null && mode === 'preview' && (0, _react.createElement)(_components.Placeholder, null, (0, _react.createElement)(_components.Spinner, null)), hasPreview === true && (0, _react.createElement)(_preview.default, {
148
149
  idBase: idBase,
149
150
  instance: instance,
150
151
  isVisible: mode === 'preview'
151
- }), hasPreview === false && mode === 'preview' && (0, _element.createElement)(_noPreview.default, {
152
+ }), hasPreview === false && mode === 'preview' && (0, _react.createElement)(_noPreview.default, {
152
153
  name: widgetType.name
153
154
  })));
154
155
  }
@@ -1 +1 @@
1
- {"version":3,"names":["_element","require","_classnames","_interopRequireDefault","_blockEditor","_components","_icons","_i18n","_data","_coreData","_widgetTypeSelector","_inspectorCard","_form","_preview","_noPreview","_convertToBlocksButton","Edit","props","id","idBase","attributes","isWide","blockProps","useBlockProps","className","classnames","createElement","Empty","NotEmpty","setAttributes","Placeholder","icon","BlockIcon","brushIcon","label","__","Flex","FlexBlock","default","selectedId","onSelect","isMulti","instance","clientId","isSelected","hasPreview","setHasPreview","useState","widgetTypeId","record","widgetType","hasResolved","hasResolvedWidgetType","useEntityRecord","isNavigationMode","useSelect","select","blockEditorStore","setInstance","useCallback","nextInstance","Spinner","mode","Fragment","BlockControls","group","rawInstance","raw","InspectorControls","name","description","title","isVisible","onChangeInstance","onChangeHasPreview"],"sources":["@wordpress/widgets/src/blocks/legacy-widget/edit/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tuseBlockProps,\n\tBlockControls,\n\tInspectorControls,\n\tBlockIcon,\n\tstore as blockEditorStore,\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 { useSelect } from '@wordpress/data';\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: classnames( {\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 isNavigationMode = useSelect(\n\t\t( select ) => select( blockEditorStore ).isNavigationMode(),\n\t\t[]\n\t);\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 =\n\t\tidBase && ( isNavigationMode || ! 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' && (\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AAE,CACE,CACb,EACChB,UAAU,KAAK,IAAI,IACpB,IAAA7C,QAAA,CAAA0B,aAAA,EAACb,QAAA,CAAAyB,OAAO;IACPnB,MAAM,EAAGA,MAAQ;IACjBuB,QAAQ,EAAGA,QAAU;IACrB8B,SAAS,EAAGV,IAAI,KAAK;EAAW,CAChC,CACD,EACCjB,UAAU,KAAK,KAAK,IAAIiB,IAAI,KAAK,SAAS,IAC3C,IAAA9D,QAAA,CAAA0B,aAAA,EAACZ,UAAA,CAAAwB,OAAS;IAAC+B,IAAI,EAAGnB,UAAU,CAACmB;EAAM,CAAE,CAErC,CAEF,CAAC;AAEL"}
1
+ {"version":3,"names":["_classnames","_interopRequireDefault","require","_blockEditor","_components","_icons","_i18n","_element","_data","_coreData","_widgetTypeSelector","_inspectorCard","_form","_preview","_noPreview","_convertToBlocksButton","Edit","props","id","idBase","attributes","isWide","blockProps","useBlockProps","className","classnames","_react","createElement","Empty","NotEmpty","setAttributes","Placeholder","icon","BlockIcon","brushIcon","label","__","Flex","FlexBlock","default","selectedId","onSelect","isMulti","instance","clientId","isSelected","hasPreview","setHasPreview","useState","widgetTypeId","record","widgetType","hasResolved","hasResolvedWidgetType","useEntityRecord","isNavigationMode","useSelect","select","blockEditorStore","setInstance","useCallback","nextInstance","Spinner","mode","Fragment","BlockControls","group","rawInstance","raw","InspectorControls","name","description","title","isVisible","onChangeInstance","onChangeHasPreview"],"sources":["@wordpress/widgets/src/blocks/legacy-widget/edit/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tuseBlockProps,\n\tBlockControls,\n\tInspectorControls,\n\tBlockIcon,\n\tstore as blockEditorStore,\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 { useSelect } from '@wordpress/data';\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: classnames( {\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 isNavigationMode = useSelect(\n\t\t( select ) => select( blockEditorStore ).isNavigationMode(),\n\t\t[]\n\t);\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 =\n\t\tidBase && ( isNavigationMode || ! 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"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,YAAA,GAAAD,OAAA;AAOA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,KAAA,GAAAN,OAAA;AACA,IAAAO,SAAA,GAAAP,OAAA;AAKA,IAAAQ,mBAAA,GAAAT,sBAAA,CAAAC,OAAA;AACA,IAAAS,cAAA,GAAAV,sBAAA,CAAAC,OAAA;AACA,IAAAU,KAAA,GAAAX,sBAAA,CAAAC,OAAA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+B,IAAI,EAAGnB,UAAU,CAACmB,IAAM;IACxBC,WAAW,EAAGpB,UAAU,CAACoB;EAAa,CACtC,CACiB,CAAC,EAEpB,IAAA7C,MAAA,CAAAC,aAAA,EAACf,KAAA,CAAA2B,OAAI;IACJiC,KAAK,EAAGrB,UAAU,CAACmB,IAAM;IACzBG,SAAS,EAAGV,IAAI,KAAK,MAAQ;IAC7B7C,EAAE,EAAGA,EAAI;IACTC,MAAM,EAAGA,MAAQ;IACjBwB,QAAQ,EAAGA,QAAU;IACrBtB,MAAM,EAAGA,MAAQ;IACjBqD,gBAAgB,EAAGf,WAAa;IAChCgB,kBAAkB,EAAG5B;EAAe,CACpC,CAAC,EAEA5B,MAAM,IACP,IAAAO,MAAA,CAAAC,aAAA,EAAAD,MAAA,CAAAsC,QAAA,QACGlB,UAAU,KAAK,IAAI,IAAIiB,IAAI,KAAK,SAAS,IAC1C,IAAArC,MAAA,CAAAC,aAAA,EAACvB,WAAA,CAAA2B,WAAW,QACX,IAAAL,MAAA,CAAAC,aAAA,EAACvB,WAAA,CAAA0D,OAAO,MAAE,CACE,CACb,EACChB,UAAU,KAAK,IAAI,IACpB,IAAApB,MAAA,CAAAC,aAAA,EAACd,QAAA,CAAA0B,OAAO;IACPpB,MAAM,EAAGA,MAAQ;IACjBwB,QAAQ,EAAGA,QAAU;IACrB8B,SAAS,EAAGV,IAAI,KAAK;EAAW,CAChC,CACD,EACCjB,UAAU,KAAK,KAAK,IAAIiB,IAAI,KAAK,SAAS,IAC3C,IAAArC,MAAA,CAAAC,aAAA,EAACb,UAAA,CAAAyB,OAAS;IAAC+B,IAAI,EAAGnB,UAAU,CAACmB;EAAM,CAAE,CAErC,CAEF,CAAC;AAEL"}
@@ -4,15 +4,15 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = InspectorCard;
7
- var _element = require("@wordpress/element");
7
+ var _react = require("react");
8
8
  function InspectorCard({
9
9
  name,
10
10
  description
11
11
  }) {
12
- return (0, _element.createElement)("div", {
12
+ return (0, _react.createElement)("div", {
13
13
  className: "wp-block-legacy-widget-inspector-card"
14
- }, (0, _element.createElement)("h3", {
14
+ }, (0, _react.createElement)("h3", {
15
15
  className: "wp-block-legacy-widget-inspector-card__name"
16
- }, name), (0, _element.createElement)("span", null, description));
16
+ }, name), (0, _react.createElement)("span", null, description));
17
17
  }
18
18
  //# sourceMappingURL=inspector-card.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["InspectorCard","name","description","_element","createElement","className"],"sources":["@wordpress/widgets/src/blocks/legacy-widget/edit/inspector-card.js"],"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"],"mappings":";;;;;;;AAAe,SAASA,aAAaA,CAAE;EAAEC,IAAI;EAAEC;AAAY,CAAC,EAAG;EAC9D,OACC,IAAAC,QAAA,CAAAC,aAAA;IAAKC,SAAS,EAAC;EAAuC,GACrD,IAAAF,QAAA,CAAAC,aAAA;IAAIC,SAAS,EAAC;EAA6C,GACxDJ,IACC,CAAC,EACL,IAAAE,QAAA,CAAAC,aAAA,gBAAQF,WAAmB,CACvB,CAAC;AAER"}
1
+ {"version":3,"names":["InspectorCard","name","description","_react","createElement","className"],"sources":["@wordpress/widgets/src/blocks/legacy-widget/edit/inspector-card.js"],"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"],"mappings":";;;;;;;AAAe,SAASA,aAAaA,CAAE;EAAEC,IAAI;EAAEC;AAAY,CAAC,EAAG;EAC9D,OACC,IAAAC,MAAA,CAAAC,aAAA;IAAKC,SAAS,EAAC;EAAuC,GACrD,IAAAF,MAAA,CAAAC,aAAA;IAAIC,SAAS,EAAC;EAA6C,GACxDJ,IACC,CAAC,EACL,IAAAE,MAAA,CAAAC,aAAA,gBAAQF,WAAmB,CACvB,CAAC;AAER"}
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = NoPreview;
7
- var _element = require("@wordpress/element");
7
+ var _react = require("react");
8
8
  var _i18n = require("@wordpress/i18n");
9
9
  /**
10
10
  * WordPress dependencies
@@ -13,8 +13,8 @@ var _i18n = require("@wordpress/i18n");
13
13
  function NoPreview({
14
14
  name
15
15
  }) {
16
- return (0, _element.createElement)("div", {
16
+ return (0, _react.createElement)("div", {
17
17
  className: "wp-block-legacy-widget__edit-no-preview"
18
- }, name && (0, _element.createElement)("h3", null, name), (0, _element.createElement)("p", null, (0, _i18n.__)('No preview available.')));
18
+ }, name && (0, _react.createElement)("h3", null, name), (0, _react.createElement)("p", null, (0, _i18n.__)('No preview available.')));
19
19
  }
20
20
  //# sourceMappingURL=no-preview.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_i18n","require","NoPreview","name","_element","createElement","className","__"],"sources":["@wordpress/widgets/src/blocks/legacy-widget/edit/no-preview.js"],"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"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGe,SAASC,SAASA,CAAE;EAAEC;AAAK,CAAC,EAAG;EAC7C,OACC,IAAAC,QAAA,CAAAC,aAAA;IAAKC,SAAS,EAAC;EAAyC,GACrDH,IAAI,IAAI,IAAAC,QAAA,CAAAC,aAAA,cAAMF,IAAU,CAAC,EAC3B,IAAAC,QAAA,CAAAC,aAAA,aAAK,IAAAE,QAAE,EAAE,uBAAwB,CAAM,CACnC,CAAC;AAER"}
1
+ {"version":3,"names":["_i18n","require","NoPreview","name","_react","createElement","className","__"],"sources":["@wordpress/widgets/src/blocks/legacy-widget/edit/no-preview.js"],"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"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGe,SAASC,SAASA,CAAE;EAAEC;AAAK,CAAC,EAAG;EAC7C,OACC,IAAAC,MAAA,CAAAC,aAAA;IAAKC,SAAS,EAAC;EAAyC,GACrDH,IAAI,IAAI,IAAAC,MAAA,CAAAC,aAAA,cAAMF,IAAU,CAAC,EAC3B,IAAAC,MAAA,CAAAC,aAAA,aAAK,IAAAE,QAAE,EAAE,uBAAwB,CAAM,CACnC,CAAC;AAER"}
@@ -5,9 +5,10 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.default = Preview;
8
- var _element = require("@wordpress/element");
8
+ var _react = require("react");
9
9
  var _classnames = _interopRequireDefault(require("classnames"));
10
10
  var _compose = require("@wordpress/compose");
11
+ var _element = require("@wordpress/element");
11
12
  var _components = require("@wordpress/components");
12
13
  var _i18n = require("@wordpress/i18n");
13
14
  var _apiFetch = _interopRequireDefault(require("@wordpress/api-fetch"));
@@ -92,11 +93,11 @@ function Preview({
92
93
  iframe.removeEventListener('load', setHeight);
93
94
  };
94
95
  }, [isLoaded]);
95
- return (0, _element.createElement)(_element.Fragment, null, isVisible && !isLoaded && (0, _element.createElement)(_components.Placeholder, null, (0, _element.createElement)(_components.Spinner, null)), (0, _element.createElement)("div", {
96
+ return (0, _react.createElement)(_react.Fragment, null, isVisible && !isLoaded && (0, _react.createElement)(_components.Placeholder, null, (0, _react.createElement)(_components.Spinner, null)), (0, _react.createElement)("div", {
96
97
  className: (0, _classnames.default)('wp-block-legacy-widget__edit-preview', {
97
98
  'is-offscreen': !isVisible || !isLoaded
98
99
  })
99
- }, (0, _element.createElement)(_components.Disabled, null, (0, _element.createElement)("iframe", {
100
+ }, (0, _react.createElement)(_components.Disabled, null, (0, _react.createElement)("iframe", {
100
101
  ref: ref,
101
102
  className: "wp-block-legacy-widget__edit-preview-iframe",
102
103
  tabIndex: "-1",
@@ -1 +1 @@
1
- {"version":3,"names":["_element","require","_classnames","_interopRequireDefault","_compose","_components","_i18n","_apiFetch","Preview","idBase","instance","isVisible","isLoaded","setIsLoaded","useState","srcDoc","setSrcDoc","useEffect","abortController","window","AbortController","undefined","fetchPreviewHTML","restRoute","apiFetch","path","method","signal","data","then","response","preview","catch","error","name","abort","ref","useRefEffect","iframe","setHeight","_iframe$contentDocume","_iframe$contentDocume2","height","Math","max","contentDocument","documentElement","offsetHeight","body","style","IntersectionObserver","ownerDocument","defaultView","intersectionObserver","entry","isIntersecting","threshold","observe","addEventListener","disconnect","removeEventListener","createElement","Fragment","Placeholder","Spinner","className","classnames","Disabled","tabIndex","title","__","onLoad","event","target","overflow"],"sources":["@wordpress/widgets/src/blocks/legacy-widget/edit/preview.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useRefEffect } from '@wordpress/compose';\nimport { useEffect, useState } from '@wordpress/element';\nimport { Disabled, Placeholder, Spinner } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport apiFetch from '@wordpress/api-fetch';\n\nexport default function Preview( { idBase, instance, isVisible } ) {\n\tconst [ isLoaded, setIsLoaded ] = useState( false );\n\tconst [ srcDoc, setSrcDoc ] = useState( '' );\n\n\tuseEffect( () => {\n\t\tconst abortController =\n\t\t\ttypeof window.AbortController === 'undefined'\n\t\t\t\t? undefined\n\t\t\t\t: new window.AbortController();\n\n\t\tasync function fetchPreviewHTML() {\n\t\t\tconst restRoute = `/wp/v2/widget-types/${ idBase }/render`;\n\t\t\treturn await apiFetch( {\n\t\t\t\tpath: restRoute,\n\t\t\t\tmethod: 'POST',\n\t\t\t\tsignal: abortController?.signal,\n\t\t\t\tdata: instance ? { instance } : {},\n\t\t\t} );\n\t\t}\n\n\t\tfetchPreviewHTML()\n\t\t\t.then( ( response ) => {\n\t\t\t\tsetSrcDoc( response.preview );\n\t\t\t} )\n\t\t\t.catch( ( error ) => {\n\t\t\t\tif ( 'AbortError' === error.name ) {\n\t\t\t\t\t// We don't want to log aborted requests.\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tthrow error;\n\t\t\t} );\n\n\t\treturn () => abortController?.abort();\n\t}, [ idBase, instance ] );\n\n\t// Resize the iframe on either the load event, or when the iframe becomes visible.\n\tconst ref = useRefEffect(\n\t\t( iframe ) => {\n\t\t\t// Only set height if the iframe is loaded,\n\t\t\t// or it will grow to an unexpected large height in Safari if it's hidden initially.\n\t\t\tif ( ! isLoaded ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// If the preview frame has another origin then this won't work.\n\t\t\t// One possible solution is to add custom script to call `postMessage` in the preview frame.\n\t\t\t// Or, better yet, we migrate away from iframe.\n\t\t\tfunction setHeight() {\n\t\t\t\t// Pick the maximum of these two values to account for margin collapsing.\n\t\t\t\tconst height = Math.max(\n\t\t\t\t\tiframe.contentDocument.documentElement?.offsetHeight ?? 0,\n\t\t\t\t\tiframe.contentDocument.body?.offsetHeight ?? 0\n\t\t\t\t);\n\n\t\t\t\t// Fallback to a height of 100px if the height cannot be determined.\n\t\t\t\t// This ensures the block is still selectable. 100px should hopefully\n\t\t\t\t// be not so big that it's annoying, and not so small that nothing\n\t\t\t\t// can be seen.\n\t\t\t\tiframe.style.height = `${ height !== 0 ? height : 100 }px`;\n\t\t\t}\n\n\t\t\tconst { IntersectionObserver } = iframe.ownerDocument.defaultView;\n\n\t\t\t// Observe for intersections that might cause a change in the height of\n\t\t\t// the iframe, e.g. a Widget Area becoming expanded.\n\t\t\tconst intersectionObserver = new IntersectionObserver(\n\t\t\t\t( [ entry ] ) => {\n\t\t\t\t\tif ( entry.isIntersecting ) {\n\t\t\t\t\t\tsetHeight();\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tthreshold: 1,\n\t\t\t\t}\n\t\t\t);\n\t\t\tintersectionObserver.observe( iframe );\n\n\t\t\tiframe.addEventListener( 'load', setHeight );\n\n\t\t\treturn () => {\n\t\t\t\tintersectionObserver.disconnect();\n\t\t\t\tiframe.removeEventListener( 'load', setHeight );\n\t\t\t};\n\t\t},\n\t\t[ isLoaded ]\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t{ /*\n\t\t\tWhile the iframe contents are loading, we move the iframe off-screen\n\t\t\tand display a placeholder instead. This ensures that the user\n\t\t\tdoesn't see the iframe resize (which looks really janky). We have to\n\t\t\tmove the iframe off-screen instead of hiding it because web browsers\n\t\t\twill not trigger onLoad if the iframe is hidden.\n\t\t\t*/ }\n\t\t\t{ isVisible && ! isLoaded && (\n\t\t\t\t<Placeholder>\n\t\t\t\t\t<Spinner />\n\t\t\t\t</Placeholder>\n\t\t\t) }\n\t\t\t<div\n\t\t\t\tclassName={ classnames(\n\t\t\t\t\t'wp-block-legacy-widget__edit-preview',\n\t\t\t\t\t{\n\t\t\t\t\t\t'is-offscreen': ! isVisible || ! isLoaded,\n\t\t\t\t\t}\n\t\t\t\t) }\n\t\t\t>\n\t\t\t\t<Disabled>\n\t\t\t\t\t{ /*\n\t\t\t\t\tWe use an iframe so that the widget has an opportunity to\n\t\t\t\t\tload scripts and styles that it needs to run.\n\t\t\t\t\t*/ }\n\t\t\t\t\t<iframe\n\t\t\t\t\t\tref={ ref }\n\t\t\t\t\t\tclassName=\"wp-block-legacy-widget__edit-preview-iframe\"\n\t\t\t\t\t\ttabIndex=\"-1\"\n\t\t\t\t\t\ttitle={ __( 'Legacy Widget Preview' ) }\n\t\t\t\t\t\tsrcDoc={ srcDoc }\n\t\t\t\t\t\tonLoad={ ( event ) => {\n\t\t\t\t\t\t\t// To hide the scrollbars of the preview frame for some edge cases,\n\t\t\t\t\t\t\t// such as negative margins in the Gallery Legacy Widget.\n\t\t\t\t\t\t\t// It can't be scrolled anyway.\n\t\t\t\t\t\t\t// TODO: Ideally, this should be fixed in core.\n\t\t\t\t\t\t\tevent.target.contentDocument.body.style.overflow =\n\t\t\t\t\t\t\t\t'hidden';\n\n\t\t\t\t\t\t\tsetIsLoaded( true );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\theight={ 100 }\n\t\t\t\t\t/>\n\t\t\t\t</Disabled>\n\t\t\t</div>\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;AASA,IAAAA,QAAA,GAAAC,OAAA;AANA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;AAKA,IAAAG,QAAA,GAAAH,OAAA;AAEA,IAAAI,WAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,GAAAJ,sBAAA,CAAAF,OAAA;AAZA;AACA;AACA;;AAGA;AACA;AACA;;AAOe,SAASO,OAAOA,CAAE;EAAEC,MAAM;EAAEC,QAAQ;EAAEC;AAAU,CAAC,EAAG;EAClE,MAAM,CAAEC,QAAQ,EAAEC,WAAW,CAAE,GAAG,IAAAC,iBAAQ,EAAE,KAAM,CAAC;EACnD,MAAM,CAAEC,MAAM,EAAEC,SAAS,CAAE,GAAG,IAAAF,iBAAQ,EAAE,EAAG,CAAC;EAE5C,IAAAG,kBAAS,EAAE,MAAM;IAChB,MAAMC,eAAe,GACpB,OAAOC,MAAM,CAACC,eAAe,KAAK,WAAW,GAC1CC,SAAS,GACT,IAAIF,MA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AAE,EAAE,uBAAwB,CAAG;IACvCvD,MAAM,EAAGA,MAAQ;IACjBwD,MAAM,EAAKC,KAAK,IAAM;MACrB;MACA;MACA;MACA;MACAA,KAAK,CAACC,MAAM,CAAC5B,eAAe,CAACG,IAAI,CAACC,KAAK,CAACyB,QAAQ,GAC/C,QAAQ;MAET7D,WAAW,CAAE,IAAK,CAAC;IACpB,CAAG;IACH6B,MAAM,EAAG;EAAK,CACd,CACQ,CACN,CACJ,CAAC;AAEL"}
1
+ {"version":3,"names":["_classnames","_interopRequireDefault","require","_compose","_element","_components","_i18n","_apiFetch","Preview","idBase","instance","isVisible","isLoaded","setIsLoaded","useState","srcDoc","setSrcDoc","useEffect","abortController","window","AbortController","undefined","fetchPreviewHTML","restRoute","apiFetch","path","method","signal","data","then","response","preview","catch","error","name","abort","ref","useRefEffect","iframe","setHeight","_iframe$contentDocume","_iframe$contentDocume2","height","Math","max","contentDocument","documentElement","offsetHeight","body","style","IntersectionObserver","ownerDocument","defaultView","intersectionObserver","entry","isIntersecting","threshold","observe","addEventListener","disconnect","removeEventListener","_react","createElement","Fragment","Placeholder","Spinner","className","classnames","Disabled","tabIndex","title","__","onLoad","event","target","overflow"],"sources":["@wordpress/widgets/src/blocks/legacy-widget/edit/preview.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useRefEffect } from '@wordpress/compose';\nimport { useEffect, useState } from '@wordpress/element';\nimport { Disabled, Placeholder, Spinner } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport apiFetch from '@wordpress/api-fetch';\n\nexport default function Preview( { idBase, instance, isVisible } ) {\n\tconst [ isLoaded, setIsLoaded ] = useState( false );\n\tconst [ srcDoc, setSrcDoc ] = useState( '' );\n\n\tuseEffect( () => {\n\t\tconst abortController =\n\t\t\ttypeof window.AbortController === 'undefined'\n\t\t\t\t? undefined\n\t\t\t\t: new window.AbortController();\n\n\t\tasync function fetchPreviewHTML() {\n\t\t\tconst restRoute = `/wp/v2/widget-types/${ idBase }/render`;\n\t\t\treturn await apiFetch( {\n\t\t\t\tpath: restRoute,\n\t\t\t\tmethod: 'POST',\n\t\t\t\tsignal: abortController?.signal,\n\t\t\t\tdata: instance ? { instance } : {},\n\t\t\t} );\n\t\t}\n\n\t\tfetchPreviewHTML()\n\t\t\t.then( ( response ) => {\n\t\t\t\tsetSrcDoc( response.preview );\n\t\t\t} )\n\t\t\t.catch( ( error ) => {\n\t\t\t\tif ( 'AbortError' === error.name ) {\n\t\t\t\t\t// We don't want to log aborted requests.\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tthrow error;\n\t\t\t} );\n\n\t\treturn () => abortController?.abort();\n\t}, [ idBase, instance ] );\n\n\t// Resize the iframe on either the load event, or when the iframe becomes visible.\n\tconst ref = useRefEffect(\n\t\t( iframe ) => {\n\t\t\t// Only set height if the iframe is loaded,\n\t\t\t// or it will grow to an unexpected large height in Safari if it's hidden initially.\n\t\t\tif ( ! isLoaded ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// If the preview frame has another origin then this won't work.\n\t\t\t// One possible solution is to add custom script to call `postMessage` in the preview frame.\n\t\t\t// Or, better yet, we migrate away from iframe.\n\t\t\tfunction setHeight() {\n\t\t\t\t// Pick the maximum of these two values to account for margin collapsing.\n\t\t\t\tconst height = Math.max(\n\t\t\t\t\tiframe.contentDocument.documentElement?.offsetHeight ?? 0,\n\t\t\t\t\tiframe.contentDocument.body?.offsetHeight ?? 0\n\t\t\t\t);\n\n\t\t\t\t// Fallback to a height of 100px if the height cannot be determined.\n\t\t\t\t// This ensures the block is still selectable. 100px should hopefully\n\t\t\t\t// be not so big that it's annoying, and not so small that nothing\n\t\t\t\t// can be seen.\n\t\t\t\tiframe.style.height = `${ height !== 0 ? height : 100 }px`;\n\t\t\t}\n\n\t\t\tconst { IntersectionObserver } = iframe.ownerDocument.defaultView;\n\n\t\t\t// Observe for intersections that might cause a change in the height of\n\t\t\t// the iframe, e.g. a Widget Area becoming expanded.\n\t\t\tconst intersectionObserver = new IntersectionObserver(\n\t\t\t\t( [ entry ] ) => {\n\t\t\t\t\tif ( entry.isIntersecting ) {\n\t\t\t\t\t\tsetHeight();\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tthreshold: 1,\n\t\t\t\t}\n\t\t\t);\n\t\t\tintersectionObserver.observe( iframe );\n\n\t\t\tiframe.addEventListener( 'load', setHeight );\n\n\t\t\treturn () => {\n\t\t\t\tintersectionObserver.disconnect();\n\t\t\t\tiframe.removeEventListener( 'load', setHeight );\n\t\t\t};\n\t\t},\n\t\t[ isLoaded ]\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t{ /*\n\t\t\tWhile the iframe contents are loading, we move the iframe off-screen\n\t\t\tand display a placeholder instead. This ensures that the user\n\t\t\tdoesn't see the iframe resize (which looks really janky). We have to\n\t\t\tmove the iframe off-screen instead of hiding it because web browsers\n\t\t\twill not trigger onLoad if the iframe is hidden.\n\t\t\t*/ }\n\t\t\t{ isVisible && ! isLoaded && (\n\t\t\t\t<Placeholder>\n\t\t\t\t\t<Spinner />\n\t\t\t\t</Placeholder>\n\t\t\t) }\n\t\t\t<div\n\t\t\t\tclassName={ classnames(\n\t\t\t\t\t'wp-block-legacy-widget__edit-preview',\n\t\t\t\t\t{\n\t\t\t\t\t\t'is-offscreen': ! isVisible || ! isLoaded,\n\t\t\t\t\t}\n\t\t\t\t) }\n\t\t\t>\n\t\t\t\t<Disabled>\n\t\t\t\t\t{ /*\n\t\t\t\t\tWe use an iframe so that the widget has an opportunity to\n\t\t\t\t\tload scripts and styles that it needs to run.\n\t\t\t\t\t*/ }\n\t\t\t\t\t<iframe\n\t\t\t\t\t\tref={ ref }\n\t\t\t\t\t\tclassName=\"wp-block-legacy-widget__edit-preview-iframe\"\n\t\t\t\t\t\ttabIndex=\"-1\"\n\t\t\t\t\t\ttitle={ __( 'Legacy Widget Preview' ) }\n\t\t\t\t\t\tsrcDoc={ srcDoc }\n\t\t\t\t\t\tonLoad={ ( event ) => {\n\t\t\t\t\t\t\t// To hide the scrollbars of the preview frame for some edge cases,\n\t\t\t\t\t\t\t// such as negative margins in the Gallery Legacy Widget.\n\t\t\t\t\t\t\t// It can't be scrolled anyway.\n\t\t\t\t\t\t\t// TODO: Ideally, this should be fixed in core.\n\t\t\t\t\t\t\tevent.target.contentDocument.body.style.overflow =\n\t\t\t\t\t\t\t\t'hidden';\n\n\t\t\t\t\t\t\tsetIsLoaded( true );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\theight={ 100 }\n\t\t\t\t\t/>\n\t\t\t\t</Disabled>\n\t\t\t</div>\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAN,sBAAA,CAAAC,OAAA;AAZA;AACA;AACA;;AAGA;AACA;AACA;;AAOe,SAASM,OAAOA,CAAE;EAAEC,MAAM;EAAEC,QAAQ;EAAEC;AAAU,CAAC,EAAG;EAClE,MAAM,CAAEC,QAAQ,EAAEC,WAAW,CAAE,GAAG,IAAAC,iBAAQ,EAAE,KAAM,CAAC;EACnD,MAAM,CAAEC,MAAM,EAAEC,SAAS,CAAE,GAAG,IAAAF,iBAAQ,EAAE,EAAG,CAAC;EAE5C,IAAAG,kBAAS,EAAE,MAAM;IAChB,MAAMC,eAAe,GACpB,OAAOC,MAAM,CAACC,eAAe,KAAK,WAAW,GAC1CC,SAAS,GACT,IAAIF,MAAM,CAACC,eAAe,CAAC,CAAC;IAEhC,eAAeE,gBAAgBA,CAAA,EAAG;MACjC,MAAMC,SAAS,GAAI,uBAAuBd,MAAQ,SAAQ;MAC1D,OAAO,MAAM,IAAAe,iBAAQ,EA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KAAK,CAAC0B,QAAQ,GAC/C,QAAQ;MAET9D,WAAW,CAAE,IAAK,CAAC;IACpB,CAAG;IACH6B,MAAM,EAAG;EAAK,CACd,CACQ,CACN,CACJ,CAAC;AAEL"}
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = WidgetTypeSelector;
7
- var _element = require("@wordpress/element");
7
+ var _react = require("react");
8
8
  var _components = require("@wordpress/components");
9
9
  var _i18n = require("@wordpress/i18n");
10
10
  var _data = require("@wordpress/data");
@@ -26,12 +26,12 @@ function WidgetTypeSelector({
26
26
  })?.filter(widgetType => !hiddenIds.includes(widgetType.id));
27
27
  }, []);
28
28
  if (!widgetTypes) {
29
- return (0, _element.createElement)(_components.Spinner, null);
29
+ return (0, _react.createElement)(_components.Spinner, null);
30
30
  }
31
31
  if (widgetTypes.length === 0) {
32
32
  return (0, _i18n.__)('There are no widgets available.');
33
33
  }
34
- return (0, _element.createElement)(_components.SelectControl, {
34
+ return (0, _react.createElement)(_components.SelectControl, {
35
35
  __nextHasNoMarginBottom: true,
36
36
  label: (0, _i18n.__)('Select a legacy widget to display:'),
37
37
  value: selectedId !== null && selectedId !== void 0 ? selectedId : '',
@@ -1 +1 @@
1
- {"version":3,"names":["_components","require","_i18n","_data","_coreData","_blockEditor","WidgetTypeSelector","selectedId","onSelect","widgetTypes","useSelect","select","_select$getSettings$w","hiddenIds","blockEditorStore","getSettings","widgetTypesToHideFromLegacyWidgetBlock","coreStore","getWidgetTypes","per_page","filter","widgetType","includes","id","_element","createElement","Spinner","length","__","SelectControl","__nextHasNoMarginBottom","label","value","options","map","name","onChange","selected","find","isMulti","is_multi"],"sources":["@wordpress/widgets/src/blocks/legacy-widget/edit/widget-type-selector.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Spinner, SelectControl } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\nexport default function WidgetTypeSelector( { selectedId, onSelect } ) {\n\tconst widgetTypes = useSelect( ( select ) => {\n\t\tconst hiddenIds =\n\t\t\tselect( blockEditorStore ).getSettings()\n\t\t\t\t?.widgetTypesToHideFromLegacyWidgetBlock ?? [];\n\t\treturn select( coreStore )\n\t\t\t.getWidgetTypes( { per_page: -1 } )\n\t\t\t?.filter( ( widgetType ) => ! hiddenIds.includes( widgetType.id ) );\n\t}, [] );\n\n\tif ( ! widgetTypes ) {\n\t\treturn <Spinner />;\n\t}\n\n\tif ( widgetTypes.length === 0 ) {\n\t\treturn __( 'There are no widgets available.' );\n\t}\n\n\treturn (\n\t\t<SelectControl\n\t\t\t__nextHasNoMarginBottom\n\t\t\tlabel={ __( 'Select a legacy widget to display:' ) }\n\t\t\tvalue={ selectedId ?? '' }\n\t\t\toptions={ [\n\t\t\t\t{ value: '', label: __( 'Select widget' ) },\n\t\t\t\t...widgetTypes.map( ( widgetType ) => ( {\n\t\t\t\t\tvalue: widgetType.id,\n\t\t\t\t\tlabel: widgetType.name,\n\t\t\t\t} ) ),\n\t\t\t] }\n\t\t\tonChange={ ( value ) => {\n\t\t\t\tif ( value ) {\n\t\t\t\t\tconst selected = widgetTypes.find(\n\t\t\t\t\t\t( widgetType ) => widgetType.id === value\n\t\t\t\t\t);\n\t\t\t\t\tonSelect( {\n\t\t\t\t\t\tselectedId: selected.id,\n\t\t\t\t\t\tisMulti: selected.is_multi,\n\t\t\t\t\t} );\n\t\t\t\t} else {\n\t\t\t\t\tonSelect( { selectedId: null } );\n\t\t\t\t}\n\t\t\t} }\n\t\t/>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AAPA;AACA;AACA;;A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IAAM;MACvB,IAAKA,KAAK,EAAG;QACZ,MAAMK,QAAQ,GAAG5B,WAAW,CAAC6B,IAAI,CAC9BjB,UAAU,IAAMA,UAAU,CAACE,EAAE,KAAKS,KACrC,CAAC;QACDxB,QAAQ,CAAE;UACTD,UAAU,EAAE8B,QAAQ,CAACd,EAAE;UACvBgB,OAAO,EAAEF,QAAQ,CAACG;QACnB,CAAE,CAAC;MACJ,CAAC,MAAM;QACNhC,QAAQ,CAAE;UAAED,UAAU,EAAE;QAAK,CAAE,CAAC;MACjC;IACD;EAAG,CACH,CAAC;AAEJ"}
1
+ {"version":3,"names":["_components","require","_i18n","_data","_coreData","_blockEditor","WidgetTypeSelector","selectedId","onSelect","widgetTypes","useSelect","select","_select$getSettings$w","hiddenIds","blockEditorStore","getSettings","widgetTypesToHideFromLegacyWidgetBlock","coreStore","getWidgetTypes","per_page","filter","widgetType","includes","id","_react","createElement","Spinner","length","__","SelectControl","__nextHasNoMarginBottom","label","value","options","map","name","onChange","selected","find","isMulti","is_multi"],"sources":["@wordpress/widgets/src/blocks/legacy-widget/edit/widget-type-selector.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Spinner, SelectControl } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\nexport default function WidgetTypeSelector( { selectedId, onSelect } ) {\n\tconst widgetTypes = useSelect( ( select ) => {\n\t\tconst hiddenIds =\n\t\t\tselect( blockEditorStore ).getSettings()\n\t\t\t\t?.widgetTypesToHideFromLegacyWidgetBlock ?? [];\n\t\treturn select( coreStore )\n\t\t\t.getWidgetTypes( { per_page: -1 } )\n\t\t\t?.filter( ( widgetType ) => ! hiddenIds.includes( widgetType.id ) );\n\t}, [] );\n\n\tif ( ! widgetTypes ) {\n\t\treturn <Spinner />;\n\t}\n\n\tif ( widgetTypes.length === 0 ) {\n\t\treturn __( 'There are no widgets available.' );\n\t}\n\n\treturn (\n\t\t<SelectControl\n\t\t\t__nextHasNoMarginBottom\n\t\t\tlabel={ __( 'Select a legacy widget to display:' ) }\n\t\t\tvalue={ selectedId ?? '' }\n\t\t\toptions={ [\n\t\t\t\t{ value: '', label: __( 'Select widget' ) },\n\t\t\t\t...widgetTypes.map( ( widgetType ) => ( {\n\t\t\t\t\tvalue: widgetType.id,\n\t\t\t\t\tlabel: widgetType.name,\n\t\t\t\t} ) ),\n\t\t\t] }\n\t\t\tonChange={ ( value ) => {\n\t\t\t\tif ( value ) {\n\t\t\t\t\tconst selected = widgetTypes.find(\n\t\t\t\t\t\t( widgetType ) => widgetType.id === value\n\t\t\t\t\t);\n\t\t\t\t\tonSelect( {\n\t\t\t\t\t\tselectedId: selected.id,\n\t\t\t\t\t\tisMulti: selected.is_multi,\n\t\t\t\t\t} );\n\t\t\t\t} else {\n\t\t\t\t\tonSelect( { selectedId: null } );\n\t\t\t\t}\n\t\t\t} }\n\t\t/>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AAPA;AACA;AACA;;AAOe,SAASK,kBAAkBA,CAAE;EAAEC,UAAU;EAAEC;AAAS,CAAC,EAAG;EACtE,MAAMC,WAAW,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IAAA,IAAAC,qBAAA;IAC5C,MAAMC,SAAS,IAAAD,qBAAA,GACdD,MAAM,CAAEG,kBAAiB,CAAC,CAACC,WAAW,CAAC,CAAC,EACrCC,sCAAsC,cAAAJ,qBAAA,cAAAA,qBAAA,GAAI,EAAE;IAChD,OAAOD,MAAM,CAAEM,eAAU,CAAC,CACxBC,cAAc,CAAE;MAAEC,QAAQ,EAAE,CAAC;IAAE,CAAE,CAAC,EACjCC,MAAM,C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
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- var _element = require("@wordpress/element");
7
+ var _react = require("react");
8
8
  var _blockEditor = require("@wordpress/block-editor");
9
9
  /**
10
10
  * WordPress dependencies
@@ -25,11 +25,11 @@ const v1 = {
25
25
  save({
26
26
  attributes
27
27
  }) {
28
- return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_blockEditor.RichText.Content, {
28
+ return (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)(_blockEditor.RichText.Content, {
29
29
  tagName: "h2",
30
30
  className: "widget-title",
31
31
  value: attributes.title
32
- }), (0, _element.createElement)(_blockEditor.InnerBlocks.Content, null));
32
+ }), (0, _react.createElement)(_blockEditor.InnerBlocks.Content, null));
33
33
  }
34
34
  };
35
35
  var _default = [v1];
@@ -1 +1 @@
1
- {"version":3,"names":["_blockEditor","require","v1","attributes","title","type","supports","html","inserter","customClassName","reusable","save","_element","createElement","Fragment","RichText","Content","tagName","className","value","InnerBlocks","_default","exports","default"],"sources":["@wordpress/widgets/src/blocks/widget-group/deprecated.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { InnerBlocks, RichText } from '@wordpress/block-editor';\n\nconst v1 = {\n\tattributes: {\n\t\ttitle: {\n\t\t\ttype: 'string',\n\t\t},\n\t},\n\tsupports: {\n\t\thtml: false,\n\t\tinserter: true,\n\t\tcustomClassName: true,\n\t\treusable: false,\n\t},\n\tsave( { attributes } ) {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<RichText.Content\n\t\t\t\t\ttagName=\"h2\"\n\t\t\t\t\tclassName=\"widget-title\"\n\t\t\t\t\tvalue={ attributes.title }\n\t\t\t\t/>\n\t\t\t\t<InnerBlocks.Content />\n\t\t\t</>\n\t\t);\n\t},\n};\n\nexport default [ v1 ];\n"],"mappings":";;;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA,MAAMC,EAAE,GAAG;EACVC,UAAU,EAAE;IACXC,KAAK,EAAE;MACNC,IAAI,EAAE;IACP;EACD,CAAC;EACDC,QAAQ,EAAE;IACTC,IAAI,EAAE,KAAK;IACXC,QAAQ,EAAE,IAAI;IACdC,eAAe,EAAE,IAAI;IACrBC,QAAQ,EAAE;EACX,CAAC;EACDC,IAAIA,CAAE;IAAER;EAAW,CAAC,EAAG;IACtB,OACC,IAAAS,QAAA,CAAAC,aAAA,EAAAD,QAAA,CAAAE,QAAA,QACC,IAAAF,QAAA,CAAAC,aAAA,EAACb,YAAA,CAAAe,QAAQ,CAACC,OAAO;MAChBC,OAAO,EAAC,IAAI;MACZC,SAAS,EAAC,cAAc;MACxBC,KAAK,EAAGhB,UAAU,CAACC;IAAO,CAC1B,CAAC,EACF,IAAAQ,QAAA,CAAAC,aAAA,EAACb,YAAA,CAAAoB,WAAW,CAACJ,OAAO,MAAE,CACrB,CAAC;EAEL;AACD,CAAC;AAAC,IAAAK,QAAA,GAEa,CAAEnB,EAAE,CAAE;AAAAoB,OAAA,CAAAC,OAAA,GAAAF,QAAA"}
1
+ {"version":3,"names":["_blockEditor","require","v1","attributes","title","type","supports","html","inserter","customClassName","reusable","save","_react","createElement","Fragment","RichText","Content","tagName","className","value","InnerBlocks","_default","exports","default"],"sources":["@wordpress/widgets/src/blocks/widget-group/deprecated.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { InnerBlocks, RichText } from '@wordpress/block-editor';\n\nconst v1 = {\n\tattributes: {\n\t\ttitle: {\n\t\t\ttype: 'string',\n\t\t},\n\t},\n\tsupports: {\n\t\thtml: false,\n\t\tinserter: true,\n\t\tcustomClassName: true,\n\t\treusable: false,\n\t},\n\tsave( { attributes } ) {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<RichText.Content\n\t\t\t\t\ttagName=\"h2\"\n\t\t\t\t\tclassName=\"widget-title\"\n\t\t\t\t\tvalue={ attributes.title }\n\t\t\t\t/>\n\t\t\t\t<InnerBlocks.Content />\n\t\t\t</>\n\t\t);\n\t},\n};\n\nexport default [ v1 ];\n"],"mappings":";;;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA,MAAMC,EAAE,GAAG;EACVC,UAAU,EAAE;IACXC,KAAK,EAAE;MACNC,IAAI,EAAE;IACP;EACD,CAAC;EACDC,QAAQ,EAAE;IACTC,IAAI,EAAE,KAAK;IACXC,QAAQ,EAAE,IAAI;IACdC,eAAe,EAAE,IAAI;IACrBC,QAAQ,EAAE;EACX,CAAC;EACDC,IAAIA,CAAE;IAAER;EAAW,CAAC,EAAG;IACtB,OACC,IAAAS,MAAA,CAAAC,aAAA,EAAAD,MAAA,CAAAE,QAAA,QACC,IAAAF,MAAA,CAAAC,aAAA,EAACb,YAAA,CAAAe,QAAQ,CAACC,OAAO;MAChBC,OAAO,EAAC,IAAI;MACZC,SAAS,EAAC,cAAc;MACxBC,KAAK,EAAGhB,UAAU,CAACC;IAAO,CAC1B,CAAC,EACF,IAAAQ,MAAA,CAAAC,aAAA,EAACb,YAAA,CAAAoB,WAAW,CAACJ,OAAO,MAAE,CACrB,CAAC;EAEL;AACD,CAAC;AAAC,IAAAK,QAAA,GAEa,CAAEnB,EAAE,CAAE;AAAAoB,OAAA,CAAAC,OAAA,GAAAF,QAAA"}
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = Edit;
7
- var _element = require("@wordpress/element");
7
+ var _react = require("react");
8
8
  var _blockEditor = require("@wordpress/block-editor");
9
9
  var _components = require("@wordpress/components");
10
10
  var _icons = require("@wordpress/icons");
@@ -21,28 +21,28 @@ function Edit(props) {
21
21
  const {
22
22
  innerBlocks
23
23
  } = (0, _data.useSelect)(select => select(_blockEditor.store).getBlock(clientId), [clientId]);
24
- return (0, _element.createElement)("div", {
24
+ return (0, _react.createElement)("div", {
25
25
  ...(0, _blockEditor.useBlockProps)({
26
26
  className: 'widget'
27
27
  })
28
- }, innerBlocks.length === 0 ? (0, _element.createElement)(PlaceholderContent, {
28
+ }, innerBlocks.length === 0 ? (0, _react.createElement)(PlaceholderContent, {
29
29
  ...props
30
- }) : (0, _element.createElement)(PreviewContent, {
30
+ }) : (0, _react.createElement)(PreviewContent, {
31
31
  ...props
32
32
  }));
33
33
  }
34
34
  function PlaceholderContent({
35
35
  clientId
36
36
  }) {
37
- return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_components.Placeholder, {
37
+ return (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)(_components.Placeholder, {
38
38
  className: "wp-block-widget-group__placeholder",
39
- icon: (0, _element.createElement)(_blockEditor.BlockIcon, {
39
+ icon: (0, _react.createElement)(_blockEditor.BlockIcon, {
40
40
  icon: _icons.group
41
41
  }),
42
42
  label: (0, _i18n.__)('Widget Group')
43
- }, (0, _element.createElement)(_blockEditor.ButtonBlockAppender, {
43
+ }, (0, _react.createElement)(_blockEditor.ButtonBlockAppender, {
44
44
  rootClientId: clientId
45
- })), (0, _element.createElement)(_blockEditor.InnerBlocks, {
45
+ })), (0, _react.createElement)(_blockEditor.InnerBlocks, {
46
46
  renderAppender: false
47
47
  }));
48
48
  }
@@ -51,7 +51,7 @@ function PreviewContent({
51
51
  setAttributes
52
52
  }) {
53
53
  var _attributes$title;
54
- return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_blockEditor.RichText, {
54
+ return (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)(_blockEditor.RichText, {
55
55
  tagName: "h2",
56
56
  className: "widget-title",
57
57
  allowedFormats: [],
@@ -60,6 +60,6 @@ function PreviewContent({
60
60
  onChange: title => setAttributes({
61
61
  title
62
62
  })
63
- }), (0, _element.createElement)(_blockEditor.InnerBlocks, null));
63
+ }), (0, _react.createElement)(_blockEditor.InnerBlocks, null));
64
64
  }
65
65
  //# sourceMappingURL=edit.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_blockEditor","require","_components","_icons","_i18n","_data","Edit","props","clientId","innerBlocks","useSelect","select","blockEditorStore","getBlock","_element","createElement","useBlockProps","className","length","PlaceholderContent","PreviewContent","Fragment","Placeholder","icon","BlockIcon","groupIcon","label","__","ButtonBlockAppender","rootClientId","InnerBlocks","renderAppender","attributes","setAttributes","_attributes$title","RichText","tagName","allowedFormats","placeholder","value","title","onChange"],"sources":["@wordpress/widgets/src/blocks/widget-group/edit.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tuseBlockProps,\n\tBlockIcon,\n\tButtonBlockAppender,\n\tInnerBlocks,\n\tstore as blockEditorStore,\n\tRichText,\n} from '@wordpress/block-editor';\nimport { Placeholder } from '@wordpress/components';\nimport { group as groupIcon } from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\n\nexport default function Edit( props ) {\n\tconst { clientId } = props;\n\tconst { innerBlocks } = useSelect(\n\t\t( select ) => select( blockEditorStore ).getBlock( clientId ),\n\t\t[ clientId ]\n\t);\n\n\treturn (\n\t\t<div { ...useBlockProps( { className: 'widget' } ) }>\n\t\t\t{ innerBlocks.length === 0 ? (\n\t\t\t\t<PlaceholderContent { ...props } />\n\t\t\t) : (\n\t\t\t\t<PreviewContent { ...props } />\n\t\t\t) }\n\t\t</div>\n\t);\n}\n\nfunction PlaceholderContent( { clientId } ) {\n\treturn (\n\t\t<>\n\t\t\t<Placeholder\n\t\t\t\tclassName=\"wp-block-widget-group__placeholder\"\n\t\t\t\ticon={ <BlockIcon icon={ groupIcon } /> }\n\t\t\t\tlabel={ __( 'Widget Group' ) }\n\t\t\t>\n\t\t\t\t<ButtonBlockAppender rootClientId={ clientId } />\n\t\t\t</Placeholder>\n\t\t\t<InnerBlocks renderAppender={ false } />\n\t\t</>\n\t);\n}\n\nfunction PreviewContent( { attributes, setAttributes } ) {\n\treturn (\n\t\t<>\n\t\t\t<RichText\n\t\t\t\ttagName=\"h2\"\n\t\t\t\tclassName=\"widget-title\"\n\t\t\t\tallowedFormats={ [] }\n\t\t\t\tplaceholder={ __( 'Title' ) }\n\t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;EAAG,GAE9B,IAAAb,QAAA,CAAAC,aAAA,EAACf,YAAA,CAAA4B,mBAAmB;IAACC,YAAY,EAAGrB;EAAU,CAAE,CACpC,CAAC,EACd,IAAAM,QAAA,CAAAC,aAAA,EAACf,YAAA,CAAA8B,WAAW;IAACC,cAAc,EAAG;EAAO,CAAE,CACtC,CAAC;AAEL;AAEA,SAASX,cAAcA,CAAE;EAAEY,UAAU;EAAEC;AAAc,CAAC,EAAG;EAAA,IAAAC,iBAAA;EACxD,OACC,IAAApB,QAAA,CAAAC,aAAA,EAAAD,QAAA,CAAAO,QAAA,QACC,IAAAP,QAAA,CAAAC,aAAA,EAACf,YAAA,CAAAmC,QAAQ;IACRC,OAAO,EAAC,IAAI;IACZnB,SAAS,EAAC,cAAc;IACxBoB,cAAc,EAAG,EAAI;IACrBC,WAAW,EAAG,IAAAX,QAAE,EAAE,OAAQ,CAAG;IAC7BY,KAAK,GAAAL,iBAAA,GAAGF,UAAU,CAACQ,KAAK,cAAAN,iBAAA,cAAAA,iBAAA,GAAI,EAAI;IAChCO,QAAQ,EAAKD,KAAK,IAAMP,aAAa,CAAE;MAAEO;IAAM,CAAE;EAAG,CACpD,CAAC,EACF,IAAA1B,QAAA,CAAAC,aAAA,EAACf,YAAA,CAAA8B,WAAW,MAAE,CACb,CAAC;AAEL"}
1
+ {"version":3,"names":["_blockEditor","require","_components","_icons","_i18n","_data","Edit","props","clientId","innerBlocks","useSelect","select","blockEditorStore","getBlock","_react","createElement","useBlockProps","className","length","PlaceholderContent","PreviewContent","Fragment","Placeholder","icon","BlockIcon","groupIcon","label","__","ButtonBlockAppender","rootClientId","InnerBlocks","renderAppender","attributes","setAttributes","_attributes$title","RichText","tagName","allowedFormats","placeholder","value","title","onChange"],"sources":["@wordpress/widgets/src/blocks/widget-group/edit.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tuseBlockProps,\n\tBlockIcon,\n\tButtonBlockAppender,\n\tInnerBlocks,\n\tstore as blockEditorStore,\n\tRichText,\n} from '@wordpress/block-editor';\nimport { Placeholder } from '@wordpress/components';\nimport { group as groupIcon } from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\n\nexport default function Edit( props ) {\n\tconst { clientId } = props;\n\tconst { innerBlocks } = useSelect(\n\t\t( select ) => select( blockEditorStore ).getBlock( clientId ),\n\t\t[ clientId ]\n\t);\n\n\treturn (\n\t\t<div { ...useBlockProps( { className: 'widget' } ) }>\n\t\t\t{ innerBlocks.length === 0 ? (\n\t\t\t\t<PlaceholderContent { ...props } />\n\t\t\t) : (\n\t\t\t\t<PreviewContent { ...props } />\n\t\t\t) }\n\t\t</div>\n\t);\n}\n\nfunction PlaceholderContent( { clientId } ) {\n\treturn (\n\t\t<>\n\t\t\t<Placeholder\n\t\t\t\tclassName=\"wp-block-widget-group__placeholder\"\n\t\t\t\ticon={ <BlockIcon icon={ groupIcon } /> }\n\t\t\t\tlabel={ __( 'Widget Group' ) }\n\t\t\t>\n\t\t\t\t<ButtonBlockAppender rootClientId={ clientId } />\n\t\t\t</Placeholder>\n\t\t\t<InnerBlocks renderAppender={ false } />\n\t\t</>\n\t);\n}\n\nfunction PreviewContent( { attributes, setAttributes } ) {\n\treturn (\n\t\t<>\n\t\t\t<RichText\n\t\t\t\ttagName=\"h2\"\n\t\t\t\tclassName=\"widget-title\"\n\t\t\t\tallowedFormats={ [] }\n\t\t\t\tplaceholder={ __( 'Title' ) }\n\t\t\t\tvalue={ attributes.title ?? '' }\n\t\t\t\tonChange={ ( title ) => setAttributes( { title } ) }\n\t\t\t/>\n\t\t\t<InnerBlocks />\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AAQA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AAdA;AACA;AACA;;AAce,SAASK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AAA,CAAAC,aAAA,EAAAD,MAAA,CAAAO,QAAA,QACC,IAAAP,MAAA,CAAAC,aAAA,EAACf,YAAA,CAAAmC,QAAQ;IACRC,OAAO,EAAC,IAAI;IACZnB,SAAS,EAAC,cAAc;IACxBoB,cAAc,EAAG,EAAI;IACrBC,WAAW,EAAG,IAAAX,QAAE,EAAE,OAAQ,CAAG;IAC7BY,KAAK,GAAAL,iBAAA,GAAGF,UAAU,CAACQ,KAAK,cAAAN,iBAAA,cAAAA,iBAAA,GAAI,EAAI;IAChCO,QAAQ,EAAKD,KAAK,IAAMP,aAAa,CAAE;MAAEO;IAAM,CAAE;EAAG,CACpD,CAAC,EACF,IAAA1B,MAAA,CAAAC,aAAA,EAACf,YAAA,CAAA8B,WAAW,MAAE,CACb,CAAC;AAEL"}
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = save;
7
- var _element = require("@wordpress/element");
7
+ var _react = require("react");
8
8
  var _blockEditor = require("@wordpress/block-editor");
9
9
  /**
10
10
  * WordPress dependencies
@@ -13,12 +13,12 @@ var _blockEditor = require("@wordpress/block-editor");
13
13
  function save({
14
14
  attributes
15
15
  }) {
16
- return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_blockEditor.RichText.Content, {
16
+ return (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)(_blockEditor.RichText.Content, {
17
17
  tagName: "h2",
18
18
  className: "widget-title",
19
19
  value: attributes.title
20
- }), (0, _element.createElement)("div", {
20
+ }), (0, _react.createElement)("div", {
21
21
  className: "wp-widget-group__inner-blocks"
22
- }, (0, _element.createElement)(_blockEditor.InnerBlocks.Content, null)));
22
+ }, (0, _react.createElement)(_blockEditor.InnerBlocks.Content, null)));
23
23
  }
24
24
  //# sourceMappingURL=save.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_blockEditor","require","save","attributes","_element","createElement","Fragment","RichText","Content","tagName","className","value","title","InnerBlocks"],"sources":["@wordpress/widgets/src/blocks/widget-group/save.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { InnerBlocks, RichText } from '@wordpress/block-editor';\n\nexport default function save( { attributes } ) {\n\treturn (\n\t\t<>\n\t\t\t<RichText.Content\n\t\t\t\ttagName=\"h2\"\n\t\t\t\tclassName=\"widget-title\"\n\t\t\t\tvalue={ attributes.title }\n\t\t\t/>\n\t\t\t<div className=\"wp-widget-group__inner-blocks\">\n\t\t\t\t<InnerBlocks.Content />\n\t\t\t</div>\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGe,SAASC,IAAIA,CAAE;EAAEC;AAAW,CAAC,EAAG;EAC9C,OACC,IAAAC,QAAA,CAAAC,aAAA,EAAAD,QAAA,CAAAE,QAAA,QACC,IAAAF,QAAA,CAAAC,aAAA,EAACL,YAAA,CAAAO,QAAQ,CAACC,OAAO;IAChBC,OAAO,EAAC,IAAI;IACZC,SAAS,EAAC,cAAc;IACxBC,KAAK,EAAGR,UAAU,CAACS;EAAO,CAC1B,CAAC,EACF,IAAAR,QAAA,CAAAC,aAAA;IAAKK,SAAS,EAAC;EAA+B,GAC7C,IAAAN,QAAA,CAAAC,aAAA,EAACL,YAAA,CAAAa,WAAW,CAACL,OAAO,MAAE,CAClB,CACJ,CAAC;AAEL"}
1
+ {"version":3,"names":["_blockEditor","require","save","attributes","_react","createElement","Fragment","RichText","Content","tagName","className","value","title","InnerBlocks"],"sources":["@wordpress/widgets/src/blocks/widget-group/save.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { InnerBlocks, RichText } from '@wordpress/block-editor';\n\nexport default function save( { attributes } ) {\n\treturn (\n\t\t<>\n\t\t\t<RichText.Content\n\t\t\t\ttagName=\"h2\"\n\t\t\t\tclassName=\"widget-title\"\n\t\t\t\tvalue={ attributes.title }\n\t\t\t/>\n\t\t\t<div className=\"wp-widget-group__inner-blocks\">\n\t\t\t\t<InnerBlocks.Content />\n\t\t\t</div>\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGe,SAASC,IAAIA,CAAE;EAAEC;AAAW,CAAC,EAAG;EAC9C,OACC,IAAAC,MAAA,CAAAC,aAAA,EAAAD,MAAA,CAAAE,QAAA,QACC,IAAAF,MAAA,CAAAC,aAAA,EAACL,YAAA,CAAAO,QAAQ,CAACC,OAAO;IAChBC,OAAO,EAAC,IAAI;IACZC,SAAS,EAAC,cAAc;IACxBC,KAAK,EAAGR,UAAU,CAACS;EAAO,CAC1B,CAAC,EACF,IAAAR,MAAA,CAAAC,aAAA;IAAKK,SAAS,EAAC;EAA+B,GAC7C,IAAAN,MAAA,CAAAC,aAAA,EAACL,YAAA,CAAAa,WAAW,CAACL,OAAO,MAAE,CAClB,CACJ,CAAC;AAEL"}
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = MoveToWidgetArea;
7
- var _element = require("@wordpress/element");
7
+ var _react = require("react");
8
8
  var _components = require("@wordpress/components");
9
9
  var _i18n = require("@wordpress/i18n");
10
10
  var _icons = require("@wordpress/icons");
@@ -17,15 +17,15 @@ function MoveToWidgetArea({
17
17
  widgetAreas,
18
18
  onSelect
19
19
  }) {
20
- return (0, _element.createElement)(_components.ToolbarGroup, null, (0, _element.createElement)(_components.ToolbarItem, null, toggleProps => (0, _element.createElement)(_components.DropdownMenu, {
20
+ return (0, _react.createElement)(_components.ToolbarGroup, null, (0, _react.createElement)(_components.ToolbarItem, null, toggleProps => (0, _react.createElement)(_components.DropdownMenu, {
21
21
  icon: _icons.moveTo,
22
22
  label: (0, _i18n.__)('Move to widget area'),
23
23
  toggleProps: toggleProps
24
24
  }, ({
25
25
  onClose
26
- }) => (0, _element.createElement)(_components.MenuGroup, {
26
+ }) => (0, _react.createElement)(_components.MenuGroup, {
27
27
  label: (0, _i18n.__)('Move to')
28
- }, (0, _element.createElement)(_components.MenuItemsChoice, {
28
+ }, (0, _react.createElement)(_components.MenuItemsChoice, {
29
29
  choices: widgetAreas.map(widgetArea => ({
30
30
  value: widgetArea.id,
31
31
  label: widgetArea.name,
@@ -1 +1 @@
1
- {"version":3,"names":["_components","require","_i18n","_icons","MoveToWidgetArea","currentWidgetAreaId","widgetAreas","onSelect","_element","createElement","ToolbarGroup","ToolbarItem","toggleProps","DropdownMenu","icon","moveTo","label","__","onClose","MenuGroup","MenuItemsChoice","choices","map","widgetArea","value","id","name","info","description"],"sources":["@wordpress/widgets/src/components/move-to-widget-area/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tDropdownMenu,\n\tMenuGroup,\n\tMenuItemsChoice,\n\tToolbarGroup,\n\tToolbarItem,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { moveTo } from '@wordpress/icons';\n\nexport default function MoveToWidgetArea( {\n\tcurrentWidgetAreaId,\n\twidgetAreas,\n\tonSelect,\n} ) {\n\treturn (\n\t\t<ToolbarGroup>\n\t\t\t<ToolbarItem>\n\t\t\t\t{ ( toggleProps ) => (\n\t\t\t\t\t<DropdownMenu\n\t\t\t\t\t\ticon={ moveTo }\n\t\t\t\t\t\tlabel={ __( 'Move to widget area' ) }\n\t\t\t\t\t\ttoggleProps={ toggleProps }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t\t\t<MenuGroup label={ __( 'Move to' ) }>\n\t\t\t\t\t\t\t\t<MenuItemsChoice\n\t\t\t\t\t\t\t\t\tchoices={ widgetAreas.map(\n\t\t\t\t\t\t\t\t\t\t( widgetArea ) => ( {\n\t\t\t\t\t\t\t\t\t\t\tvalue: widgetArea.id,\n\t\t\t\t\t\t\t\t\t\t\tlabel: widgetArea.name,\n\t\t\t\t\t\t\t\t\t\t\tinfo: widgetArea.description,\n\t\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\tvalue={ currentWidgetAreaId }\n\t\t\t\t\t\t\t\t\tonSelect={ ( value ) => {\n\t\t\t\t\t\t\t\t\t\tonSelect( value );\n\t\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</DropdownMenu>\n\t\t\t\t) }\n\t\t\t</ToolbarItem>\n\t\t</ToolbarGroup>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAOA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAXA;AACA;AACA;;AAWe,SAASG,gBAAgBA,CAAE;EACzCC,mBAAmB;EACnBC,WAAW;EACXC;AACD,CAAC,EAAG;EACH,OACC,IAAAC,QAAA,CAAAC,aAAA,EAACT,WAAA,CAAAU,YAAY,QACZ,IAAAF,QAAA,CAAAC,aAAA,EAACT,WAAA,CAAAW,WAAW,QACPC,WAAW,IACd,IAAAJ,QAAA,CAAAC,aAAA,EAACT,WAAA,CAAAa,YAAY;IACZC,IAAI,EAAGC,aAAQ;IACfC,KAAK,EAAG,IAAAC,QAAE,EAAE,qBAAsB,CAAG;IACrCL,WAAW,EAAGA;EAAa,GAEzB,CAAE;IAAEM;EAAQ,CAAC,KACd,IAAAV,QAAA,CAAAC,aAAA,EAACT,WAAA,CAAAmB,SAAS;IAACH,KAAK,EAAG,IAAAC,QAAE,EAAE,SAAU;EAAG,GACnC,IAAAT,QAAA,CAAAC,aAAA,EAACT,WAAA,CAAAoB,eAAe;IACfC,OAAO,EAAGf,WAAW,CAACgB,GAAG,CACtBC,UAAU,KAAQ;MACnBC,KAAK,EAAED,UAAU,CAACE,EAAE;MACpBT,KAAK,EAAEO,UAAU,CAACG,IAAI;MACtBC,IAAI,EAAEJ,UAAU,CAACK;IAClB,CAAC,CACF,CAAG;IACHJ,KAAK,EAAGnB,mBAAqB;IAC7BE,QAAQ,EAAKiB,KAAK,IAAM;MACvBjB,QAAQ,CAAEiB,KAAM,CAAC;MACjBN,OAAO,CAAC,CAAC;IACV;EAAG,CACH,CACS,CAEC,CAEH,CACA,CAAC;AAEjB"}
1
+ {"version":3,"names":["_components","require","_i18n","_icons","MoveToWidgetArea","currentWidgetAreaId","widgetAreas","onSelect","_react","createElement","ToolbarGroup","ToolbarItem","toggleProps","DropdownMenu","icon","moveTo","label","__","onClose","MenuGroup","MenuItemsChoice","choices","map","widgetArea","value","id","name","info","description"],"sources":["@wordpress/widgets/src/components/move-to-widget-area/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tDropdownMenu,\n\tMenuGroup,\n\tMenuItemsChoice,\n\tToolbarGroup,\n\tToolbarItem,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { moveTo } from '@wordpress/icons';\n\nexport default function MoveToWidgetArea( {\n\tcurrentWidgetAreaId,\n\twidgetAreas,\n\tonSelect,\n} ) {\n\treturn (\n\t\t<ToolbarGroup>\n\t\t\t<ToolbarItem>\n\t\t\t\t{ ( toggleProps ) => (\n\t\t\t\t\t<DropdownMenu\n\t\t\t\t\t\ticon={ moveTo }\n\t\t\t\t\t\tlabel={ __( 'Move to widget area' ) }\n\t\t\t\t\t\ttoggleProps={ toggleProps }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t\t\t<MenuGroup label={ __( 'Move to' ) }>\n\t\t\t\t\t\t\t\t<MenuItemsChoice\n\t\t\t\t\t\t\t\t\tchoices={ widgetAreas.map(\n\t\t\t\t\t\t\t\t\t\t( widgetArea ) => ( {\n\t\t\t\t\t\t\t\t\t\t\tvalue: widgetArea.id,\n\t\t\t\t\t\t\t\t\t\t\tlabel: widgetArea.name,\n\t\t\t\t\t\t\t\t\t\t\tinfo: widgetArea.description,\n\t\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\tvalue={ currentWidgetAreaId }\n\t\t\t\t\t\t\t\t\tonSelect={ ( value ) => {\n\t\t\t\t\t\t\t\t\t\tonSelect( value );\n\t\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</DropdownMenu>\n\t\t\t\t) }\n\t\t\t</ToolbarItem>\n\t\t</ToolbarGroup>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAOA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAXA;AACA;AACA;;AAWe,SAASG,gBAAgBA,CAAE;EACzCC,mBAAmB;EACnBC,WAAW;EACXC;AACD,CAAC,EAAG;EACH,OACC,IAAAC,MAAA,CAAAC,aAAA,EAACT,WAAA,CAAAU,YAAY,QACZ,IAAAF,MAAA,CAAAC,aAAA,EAACT,WAAA,CAAAW,WAAW,QACPC,WAAW,IACd,IAAAJ,MAAA,CAAAC,aAAA,EAACT,WAAA,CAAAa,YAAY;IACZC,IAAI,EAAGC,aAAQ;IACfC,KAAK,EAAG,IAAAC,QAAE,EAAE,qBAAsB,CAAG;IACrCL,WAAW,EAAGA;EAAa,GAEzB,CAAE;IAAEM;EAAQ,CAAC,KACd,IAAAV,MAAA,CAAAC,aAAA,EAACT,WAAA,CAAAmB,SAAS;IAACH,KAAK,EAAG,IAAAC,QAAE,EAAE,SAAU;EAAG,GACnC,IAAAT,MAAA,CAAAC,aAAA,EAACT,WAAA,CAAAoB,eAAe;IACfC,OAAO,EAAGf,WAAW,CAACgB,GAAG,CACtBC,UAAU,KAAQ;MACnBC,KAAK,EAAED,UAAU,CAACE,EAAE;MACpBT,KAAK,EAAEO,UAAU,CAACG,IAAI;MACtBC,IAAI,EAAEJ,UAAU,CAACK;IAClB,CAAC,CACF,CAAG;IACHJ,KAAK,EAAGnB,mBAAqB;IAC7BE,QAAQ,EAAKiB,KAAK,IAAM;MACvBjB,QAAQ,CAAEiB,KAAM,CAAC;MACjBN,OAAO,CAAC,CAAC;IACV;EAAG,CACH,CACS,CAEC,CAEH,CACA,CAAC;AAEjB"}
@@ -1,4 +1,4 @@
1
- import { createElement } from "@wordpress/element";
1
+ import { createElement } from "react";
2
2
  /**
3
3
  * WordPress dependencies
4
4
  */
@@ -1,4 +1,4 @@
1
- import { createElement } from "@wordpress/element";
1
+ import { createElement } from "react";
2
2
  /**
3
3
  * External dependencies
4
4
  */
@@ -1,4 +1,4 @@
1
- import { createElement, Fragment } from "@wordpress/element";
1
+ import { createElement, Fragment } from "react";
2
2
  /**
3
3
  * External dependencies
4
4
  */
@@ -1,4 +1,4 @@
1
- import { createElement } from "@wordpress/element";
1
+ import { createElement } from "react";
2
2
  export default function InspectorCard({
3
3
  name,
4
4
  description
@@ -1,4 +1,4 @@
1
- import { createElement } from "@wordpress/element";
1
+ import { createElement } from "react";
2
2
  /**
3
3
  * WordPress dependencies
4
4
  */
@@ -1,4 +1,4 @@
1
- import { createElement, Fragment } from "@wordpress/element";
1
+ import { createElement, Fragment } from "react";
2
2
  /**
3
3
  * External dependencies
4
4
  */
@@ -1,4 +1,4 @@
1
- import { createElement } from "@wordpress/element";
1
+ import { createElement } from "react";
2
2
  /**
3
3
  * WordPress dependencies
4
4
  */
@@ -1,4 +1,4 @@
1
- import { createElement, Fragment } from "@wordpress/element";
1
+ import { createElement, Fragment } from "react";
2
2
  /**
3
3
  * WordPress dependencies
4
4
  */
@@ -1,4 +1,4 @@
1
- import { createElement, Fragment } from "@wordpress/element";
1
+ import { createElement, Fragment } from "react";
2
2
  /**
3
3
  * WordPress dependencies
4
4
  */
@@ -1,4 +1,4 @@
1
- import { createElement, Fragment } from "@wordpress/element";
1
+ import { createElement, Fragment } from "react";
2
2
  /**
3
3
  * WordPress dependencies
4
4
  */
@@ -1,4 +1,4 @@
1
- import { createElement } from "@wordpress/element";
1
+ import { createElement } from "react";
2
2
  /**
3
3
  * WordPress dependencies
4
4
  */
@@ -97,7 +97,7 @@
97
97
  --wp-block-synced-color: #7a00df;
98
98
  --wp-block-synced-color--rgb: 122, 0, 223;
99
99
  }
100
- @media (min-resolution: 192dpi) {
100
+ @media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
101
101
  :root {
102
102
  --wp-admin-border-width-focus: 1.5px;
103
103
  }
@@ -97,7 +97,7 @@
97
97
  --wp-block-synced-color: #7a00df;
98
98
  --wp-block-synced-color--rgb: 122, 0, 223;
99
99
  }
100
- @media (min-resolution: 192dpi) {
100
+ @media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
101
101
  :root {
102
102
  --wp-admin-border-width-focus: 1.5px;
103
103
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/widgets",
3
- "version": "3.19.3",
3
+ "version": "3.20.0",
4
4
  "description": "Functionality used by the widgets block editor in the Widgets screen and the Customizer.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -21,17 +21,17 @@
21
21
  "react-native": "src/index",
22
22
  "dependencies": {
23
23
  "@babel/runtime": "^7.16.0",
24
- "@wordpress/api-fetch": "^6.39.3",
25
- "@wordpress/block-editor": "^12.10.3",
26
- "@wordpress/blocks": "^12.19.3",
27
- "@wordpress/components": "^25.8.3",
28
- "@wordpress/compose": "^6.19.3",
29
- "@wordpress/core-data": "^6.19.3",
30
- "@wordpress/data": "^9.12.3",
31
- "@wordpress/element": "^5.19.3",
32
- "@wordpress/i18n": "^4.42.3",
33
- "@wordpress/icons": "^9.33.3",
34
- "@wordpress/notices": "^4.10.3",
24
+ "@wordpress/api-fetch": "^6.40.0",
25
+ "@wordpress/block-editor": "^12.11.0",
26
+ "@wordpress/blocks": "^12.20.0",
27
+ "@wordpress/components": "^25.9.0",
28
+ "@wordpress/compose": "^6.20.0",
29
+ "@wordpress/core-data": "^6.20.0",
30
+ "@wordpress/data": "^9.13.0",
31
+ "@wordpress/element": "^5.20.0",
32
+ "@wordpress/i18n": "^4.43.0",
33
+ "@wordpress/icons": "^9.34.0",
34
+ "@wordpress/notices": "^4.11.0",
35
35
  "classnames": "^2.3.1"
36
36
  },
37
37
  "peerDependencies": {
@@ -41,5 +41,5 @@
41
41
  "publishConfig": {
42
42
  "access": "public"
43
43
  },
44
- "gitHead": "6256f93c37705d142f75a99f1fc808540ca7dca8"
44
+ "gitHead": "9b8e598c5418d38fe72197c24ef1d3dd6c712151"
45
45
  }