@wordpress/edit-widgets 6.14.0 → 6.15.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 6.15.0 (2025-01-02)
6
+
5
7
  ## 6.14.0 (2024-12-11)
6
8
 
7
9
  ## 6.13.0 (2024-11-27)
package/LICENSE.md CHANGED
@@ -1,6 +1,6 @@
1
1
  ## Gutenberg
2
2
 
3
- Copyright 2016-2024 by the contributors
3
+ Copyright 2016-2025 by the contributors
4
4
 
5
5
  **License for Contributions (on and after April 15, 2021)**
6
6
 
@@ -5,13 +5,10 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.default = InserterSidebar;
8
- var _components = require("@wordpress/components");
9
- var _icons = require("@wordpress/icons");
10
8
  var _blockEditor = require("@wordpress/block-editor");
11
9
  var _compose = require("@wordpress/compose");
12
10
  var _element = require("@wordpress/element");
13
11
  var _data = require("@wordpress/data");
14
- var _i18n = require("@wordpress/i18n");
15
12
  var _useWidgetLibraryInsertionPoint = _interopRequireDefault(require("../../hooks/use-widget-library-insertion-point"));
16
13
  var _store = require("../../store");
17
14
  var _jsxRuntime = require("react/jsx-runtime");
@@ -35,34 +32,26 @@ function InserterSidebar() {
35
32
  const closeInserter = (0, _element.useCallback)(() => {
36
33
  return setIsInserterOpened(false);
37
34
  }, [setIsInserterOpened]);
38
- const TagName = !isMobileViewport ? _components.VisuallyHidden : 'div';
39
35
  const [inserterDialogRef, inserterDialogProps] = (0, _compose.__experimentalUseDialog)({
40
36
  onClose: closeInserter,
41
37
  focusOnMount: true
42
38
  });
43
39
  const libraryRef = (0, _element.useRef)();
44
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
40
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
45
41
  ref: inserterDialogRef,
46
42
  ...inserterDialogProps,
47
43
  className: "edit-widgets-layout__inserter-panel",
48
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(TagName, {
49
- className: "edit-widgets-layout__inserter-panel-header",
50
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
51
- __next40pxDefaultSize: true,
52
- icon: _icons.close,
53
- onClick: closeInserter,
54
- label: (0, _i18n.__)('Close Block Inserter')
55
- })
56
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
44
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
57
45
  className: "edit-widgets-layout__inserter-panel-content",
58
46
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_blockEditor.__experimentalLibrary, {
59
47
  showInserterHelpPanel: true,
60
48
  shouldFocusBlock: isMobileViewport,
61
49
  rootClientId: rootClientId,
62
50
  __experimentalInsertionIndex: insertionIndex,
63
- ref: libraryRef
51
+ ref: libraryRef,
52
+ onClose: closeInserter
64
53
  })
65
- })]
54
+ })
66
55
  });
67
56
  }
68
57
  //# sourceMappingURL=inserter-sidebar.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_components","require","_icons","_blockEditor","_compose","_element","_data","_i18n","_useWidgetLibraryInsertionPoint","_interopRequireDefault","_store","_jsxRuntime","InserterSidebar","isMobileViewport","useViewportMatch","rootClientId","insertionIndex","useWidgetLibraryInsertionPoint","setIsInserterOpened","useDispatch","editWidgetsStore","closeInserter","useCallback","TagName","VisuallyHidden","inserterDialogRef","inserterDialogProps","useDialog","onClose","focusOnMount","libraryRef","useRef","jsxs","ref","className","children","jsx","Button","__next40pxDefaultSize","icon","close","onClick","label","__","__experimentalLibrary","showInserterHelpPanel","shouldFocusBlock","__experimentalInsertionIndex"],"sources":["@wordpress/edit-widgets/src/components/secondary-sidebar/inserter-sidebar.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Button, VisuallyHidden } from '@wordpress/components';\nimport { close } from '@wordpress/icons';\nimport { __experimentalLibrary as Library } from '@wordpress/block-editor';\nimport {\n\tuseViewportMatch,\n\t__experimentalUseDialog as useDialog,\n} from '@wordpress/compose';\nimport { useCallback, useRef } from '@wordpress/element';\nimport { useDispatch } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport useWidgetLibraryInsertionPoint from '../../hooks/use-widget-library-insertion-point';\nimport { store as editWidgetsStore } from '../../store';\n\nexport default function InserterSidebar() {\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst { rootClientId, insertionIndex } = useWidgetLibraryInsertionPoint();\n\n\tconst { setIsInserterOpened } = useDispatch( editWidgetsStore );\n\n\tconst closeInserter = useCallback( () => {\n\t\treturn setIsInserterOpened( false );\n\t}, [ setIsInserterOpened ] );\n\n\tconst TagName = ! isMobileViewport ? VisuallyHidden : 'div';\n\tconst [ inserterDialogRef, inserterDialogProps ] = useDialog( {\n\t\tonClose: closeInserter,\n\t\tfocusOnMount: true,\n\t} );\n\n\tconst libraryRef = useRef();\n\n\treturn (\n\t\t<div\n\t\t\tref={ inserterDialogRef }\n\t\t\t{ ...inserterDialogProps }\n\t\t\tclassName=\"edit-widgets-layout__inserter-panel\"\n\t\t>\n\t\t\t<TagName className=\"edit-widgets-layout__inserter-panel-header\">\n\t\t\t\t<Button\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\ticon={ close }\n\t\t\t\t\tonClick={ closeInserter }\n\t\t\t\t\tlabel={ __( 'Close Block Inserter' ) }\n\t\t\t\t/>\n\t\t\t</TagName>\n\t\t\t<div className=\"edit-widgets-layout__inserter-panel-content\">\n\t\t\t\t<Library\n\t\t\t\t\tshowInserterHelpPanel\n\t\t\t\t\tshouldFocusBlock={ isMobileViewport }\n\t\t\t\t\trootClientId={ rootClientId }\n\t\t\t\t\t__experimentalInsertionIndex={ insertionIndex }\n\t\t\t\t\tref={ libraryRef }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAA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AAC,QAAA,eAC9D,IAAAxB,WAAA,CAAAyB,GAAA,EAACpC,WAAA,CAAAqC,MAAM;QACNC,qBAAqB;QACrBC,IAAI,EAAGC,YAAO;QACdC,OAAO,EAAGpB,aAAe;QACzBqB,KAAK,EAAG,IAAAC,QAAE,EAAE,sBAAuB;MAAG,CACtC;IAAC,CACM,CAAC,eACV,IAAAhC,WAAA,CAAAyB,GAAA;MAAKF,SAAS,EAAC,6CAA6C;MAAAC,QAAA,eAC3D,IAAAxB,WAAA,CAAAyB,GAAA,EAACjC,YAAA,CAAAyC,qBAAO;QACPC,qBAAqB;QACrBC,gBAAgB,EAAGjC,gBAAkB;QACrCE,YAAY,EAAGA,YAAc;QAC7BgC,4BAA4B,EAAG/B,cAAgB;QAC/CiB,GAAG,EAAGH;MAAY,CAClB;IAAC,CACE,CAAC;EAAA,CACF,CAAC;AAER","ignoreList":[]}
1
+ {"version":3,"names":["_blockEditor","require","_compose","_element","_data","_useWidgetLibraryInsertionPoint","_interopRequireDefault","_store","_jsxRuntime","InserterSidebar","isMobileViewport","useViewportMatch","rootClientId","insertionIndex","useWidgetLibraryInsertionPoint","setIsInserterOpened","useDispatch","editWidgetsStore","closeInserter","useCallback","inserterDialogRef","inserterDialogProps","useDialog","onClose","focusOnMount","libraryRef","useRef","jsx","ref","className","children","__experimentalLibrary","showInserterHelpPanel","shouldFocusBlock","__experimentalInsertionIndex"],"sources":["@wordpress/edit-widgets/src/components/secondary-sidebar/inserter-sidebar.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __experimentalLibrary as Library } from '@wordpress/block-editor';\nimport {\n\tuseViewportMatch,\n\t__experimentalUseDialog as useDialog,\n} from '@wordpress/compose';\nimport { useCallback, useRef } from '@wordpress/element';\nimport { useDispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport useWidgetLibraryInsertionPoint from '../../hooks/use-widget-library-insertion-point';\nimport { store as editWidgetsStore } from '../../store';\n\nexport default function InserterSidebar() {\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst { rootClientId, insertionIndex } = useWidgetLibraryInsertionPoint();\n\n\tconst { setIsInserterOpened } = useDispatch( editWidgetsStore );\n\n\tconst closeInserter = useCallback( () => {\n\t\treturn setIsInserterOpened( false );\n\t}, [ setIsInserterOpened ] );\n\n\tconst [ inserterDialogRef, inserterDialogProps ] = useDialog( {\n\t\tonClose: closeInserter,\n\t\tfocusOnMount: true,\n\t} );\n\n\tconst libraryRef = useRef();\n\n\treturn (\n\t\t<div\n\t\t\tref={ inserterDialogRef }\n\t\t\t{ ...inserterDialogProps }\n\t\t\tclassName=\"edit-widgets-layout__inserter-panel\"\n\t\t>\n\t\t\t<div className=\"edit-widgets-layout__inserter-panel-content\">\n\t\t\t\t<Library\n\t\t\t\t\tshowInserterHelpPanel\n\t\t\t\t\tshouldFocusBlock={ isMobileViewport }\n\t\t\t\t\trootClientId={ rootClientId }\n\t\t\t\t\t__experimentalInsertionIndex={ insertionIndex }\n\t\t\t\t\tref={ libraryRef }\n\t\t\t\t\tonClose={ closeInserter }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AAIA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AAKA,IAAAI,+BAAA,GAAAC,sBAAA,CAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AAAwD,IAAAO,WAAA,GAAAP,OAAA;AAfxD;AACA;AACA;;AASA;AACA;AACA;;AAIe,SAASQ,eAAeA,CAAA,EAAG;EACzC,MAAMC,gBAAgB,GAAG,IAAAC,yBAAgB,EAAE,QAAQ,EAAE,GAAI,CAAC;EAC1D,MAAM;IAAEC,YAAY;IAAEC;EAAe,CAAC,GAAG,IAAAC,uCAA8B,EAAC,CAAC;EAEzE,MAAM;IAAEC;EAAoB,CAAC,GAAG,IAAAC,iBAAW,EAAEC,YAAiB,CAAC;EAE/D,MAAMC,aAAa,GAAG,IAAAC,oBAAW,EAAE,MAAM;IACxC,OAAOJ,mBAAmB,CAAE,KAAM,CAAC;EACpC,CAAC,EAAE,CAAEA,mBAAmB,CAAG,CAAC;EAE5B,MAAM,CAAEK,iBAAiB,EAAEC,mBAAmB,CAAE,GAAG,IAAAC,gCAAS,EAAE;IAC7DC,OAAO,EAAEL,aAAa;IACtBM,YAAY,EAAE;EACf,CAAE,CAAC;EAEH,MAAMC,UAAU,GAAG,IAAAC,eAAM,EAAC,CAAC;EAE3B,oBACC,IAAAlB,WAAA,CAAAmB,GAAA;IACCC,GAAG,EAAGR,iBAAmB;IAAA,GACpBC,mBAAmB;IACxBQ,SAAS,EAAC,qCAAqC;IAAAC,QAAA,eAE/C,IAAAtB,WAAA,CAAAmB,GAAA;MAAKE,SAAS,EAAC,6CAA6C;MAAAC,QAAA,eAC3D,IAAAtB,WAAA,CAAAmB,GAAA,EAAC3B,YAAA,CAAA+B,qBAAO;QACPC,qBAAqB;QACrBC,gBAAgB,EAAGvB,gBAAkB;QACrCE,YAAY,EAAGA,YAAc;QAC7BsB,4BAA4B,EAAGrB,cAAgB;QAC/Ce,GAAG,EAAGH,UAAY;QAClBF,OAAO,EAAGL;MAAe,CACzB;IAAC,CACE;EAAC,CACF,CAAC;AAER","ignoreList":[]}
@@ -45,7 +45,7 @@ function transformWidgetToBlock(widget) {
45
45
  * Converts a block to a widget entity record.
46
46
  *
47
47
  * @param {Object} block The block.
48
- * @param {Object?} relatedWidget A related widget entity record from the API (optional).
48
+ * @param {?Object} relatedWidget A related widget entity record from the API (optional).
49
49
  * @return {Object} the widget object (converted from block).
50
50
  */
51
51
  function transformBlockToWidget(block, relatedWidget = {}) {
@@ -1 +1 @@
1
- {"version":3,"names":["_blocks","require","_widgets","transformWidgetToBlock","widget","id_base","parsedBlocks","parse","instance","raw","content","__unstableSkipAutop","length","addWidgetIdToBlock","createBlock","id","attributes","_embedded","about","is_multi","idBase","transformBlockToWidget","block","relatedWidget","isValidLegacyWidgetBlock","name","_block$attributes$id","_block$attributes$idB","_block$attributes$ins","serialize","rendered","rendered_form"],"sources":["@wordpress/edit-widgets/src/store/transformers.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createBlock, parse, serialize } from '@wordpress/blocks';\nimport { addWidgetIdToBlock } from '@wordpress/widgets';\n\n/**\n * Converts a widget entity record into a block.\n *\n * @param {Object} widget The widget entity record.\n * @return {Object} a block (converted from the entity record).\n */\nexport function transformWidgetToBlock( widget ) {\n\tif ( widget.id_base === 'block' ) {\n\t\tconst parsedBlocks = parse( widget.instance.raw.content, {\n\t\t\t__unstableSkipAutop: true,\n\t\t} );\n\t\tif ( ! parsedBlocks.length ) {\n\t\t\treturn addWidgetIdToBlock(\n\t\t\t\tcreateBlock( 'core/paragraph', {}, [] ),\n\t\t\t\twidget.id\n\t\t\t);\n\t\t}\n\t\treturn addWidgetIdToBlock( parsedBlocks[ 0 ], widget.id );\n\t}\n\n\tlet attributes;\n\tif ( widget._embedded.about[ 0 ].is_multi ) {\n\t\tattributes = {\n\t\t\tidBase: widget.id_base,\n\t\t\tinstance: widget.instance,\n\t\t};\n\t} else {\n\t\tattributes = {\n\t\t\tid: widget.id,\n\t\t};\n\t}\n\n\treturn addWidgetIdToBlock(\n\t\tcreateBlock( 'core/legacy-widget', attributes, [] ),\n\t\twidget.id\n\t);\n}\n\n/**\n * Converts a block to a widget entity record.\n *\n * @param {Object} block The block.\n * @param {Object?} relatedWidget A related widget entity record from the API (optional).\n * @return {Object} the widget object (converted from block).\n */\nexport function transformBlockToWidget( block, relatedWidget = {} ) {\n\tlet widget;\n\n\tconst isValidLegacyWidgetBlock =\n\t\tblock.name === 'core/legacy-widget' &&\n\t\t( block.attributes.id || block.attributes.instance );\n\n\tif ( isValidLegacyWidgetBlock ) {\n\t\twidget = {\n\t\t\t...relatedWidget,\n\t\t\tid: block.attributes.id ?? relatedWidget.id,\n\t\t\tid_base: block.attributes.idBase ?? relatedWidget.id_base,\n\t\t\tinstance: block.attributes.instance ?? relatedWidget.instance,\n\t\t};\n\t} else {\n\t\twidget = {\n\t\t\t...relatedWidget,\n\t\t\tid_base: 'block',\n\t\t\tinstance: {\n\t\t\t\traw: {\n\t\t\t\t\tcontent: serialize( block ),\n\t\t\t\t},\n\t\t\t},\n\t\t};\n\t}\n\n\t// Delete read-only properties.\n\tdelete widget.rendered;\n\tdelete widget.rendered_form;\n\n\treturn widget;\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AAJA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACO,SAASE,sBAAsBA,CAAEC,MAAM,EAAG;EAChD,IAAKA,MAAM,CAACC,OAAO,KAAK,OAAO,EAAG;IACjC,MAAMC,YAAY,GAAG,IAAAC,aAAK,EAAEH,MAAM,CAACI,QAAQ,CAACC,GAAG,CAACC,OAAO,EAAE;MACxDC,mBAAmB,EAAE;IACtB,CAAE,CAAC;IACH,IAAK,CAAEL,YAAY,CAACM,MAAM,EAAG;MAC5B,OAAO,IAAAC,2BAAkB,EACxB,IAAAC,mBAAW,EAAE,gBAAgB,EAAE,CAAC,CAAC,EAAE,EAAG,CAAC,EACvCV,MAAM,CAACW,EACR,CAAC;IACF;IACA,OAAO,IAAAF,2BAAkB,EAAEP,YAAY,CAAE,CAAC,CAAE,EAAEF,MAAM,CAACW,EAAG,CAAC;EAC1D;EAEA,IAAIC,UAAU;EACd,IAAKZ,MAAM,CAACa,SAAS,CAACC,KAAK,CAAE,CAAC,CAAE,CAACC,QAAQ,EAAG;IAC3CH,UAAU,GAAG;MACZI,MAAM,EAAEhB,MAAM,CAACC,OAAO;MACtBG,QAAQ,EAAEJ,MAAM,CAACI;IAClB,CAAC;EACF,CAAC,MAAM;IACNQ,UAAU,GAAG;MACZD,EAAE,EAAEX,MAAM,CAACW;IACZ,CAAC;EACF;EAEA,O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WidgetToBlock","widget","id_base","parsedBlocks","parse","instance","raw","content","__unstableSkipAutop","length","addWidgetIdToBlock","createBlock","id","attributes","_embedded","about","is_multi","idBase","transformBlockToWidget","block","relatedWidget","isValidLegacyWidgetBlock","name","_block$attributes$id","_block$attributes$idB","_block$attributes$ins","serialize","rendered","rendered_form"],"sources":["@wordpress/edit-widgets/src/store/transformers.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createBlock, parse, serialize } from '@wordpress/blocks';\nimport { addWidgetIdToBlock } from '@wordpress/widgets';\n\n/**\n * Converts a widget entity record into a block.\n *\n * @param {Object} widget The widget entity record.\n * @return {Object} a block (converted from the entity record).\n */\nexport function transformWidgetToBlock( widget ) {\n\tif ( widget.id_base === 'block' ) {\n\t\tconst parsedBlocks = parse( widget.instance.raw.content, {\n\t\t\t__unstableSkipAutop: true,\n\t\t} );\n\t\tif ( ! parsedBlocks.length ) {\n\t\t\treturn addWidgetIdToBlock(\n\t\t\t\tcreateBlock( 'core/paragraph', {}, [] ),\n\t\t\t\twidget.id\n\t\t\t);\n\t\t}\n\t\treturn addWidgetIdToBlock( parsedBlocks[ 0 ], widget.id );\n\t}\n\n\tlet attributes;\n\tif ( widget._embedded.about[ 0 ].is_multi ) {\n\t\tattributes = {\n\t\t\tidBase: widget.id_base,\n\t\t\tinstance: widget.instance,\n\t\t};\n\t} else {\n\t\tattributes = {\n\t\t\tid: widget.id,\n\t\t};\n\t}\n\n\treturn addWidgetIdToBlock(\n\t\tcreateBlock( 'core/legacy-widget', attributes, [] ),\n\t\twidget.id\n\t);\n}\n\n/**\n * Converts a block to a widget entity record.\n *\n * @param {Object} block The block.\n * @param {?Object} relatedWidget A related widget entity record from the API (optional).\n * @return {Object} the widget object (converted from block).\n */\nexport function transformBlockToWidget( block, relatedWidget = {} ) {\n\tlet widget;\n\n\tconst isValidLegacyWidgetBlock =\n\t\tblock.name === 'core/legacy-widget' &&\n\t\t( block.attributes.id || block.attributes.instance );\n\n\tif ( isValidLegacyWidgetBlock ) {\n\t\twidget = {\n\t\t\t...relatedWidget,\n\t\t\tid: block.attributes.id ?? relatedWidget.id,\n\t\t\tid_base: block.attributes.idBase ?? relatedWidget.id_base,\n\t\t\tinstance: block.attributes.instance ?? relatedWidget.instance,\n\t\t};\n\t} else {\n\t\twidget = {\n\t\t\t...relatedWidget,\n\t\t\tid_base: 'block',\n\t\t\tinstance: {\n\t\t\t\traw: {\n\t\t\t\t\tcontent: serialize( block ),\n\t\t\t\t},\n\t\t\t},\n\t\t};\n\t}\n\n\t// Delete read-only properties.\n\tdelete widget.rendered;\n\tdelete widget.rendered_form;\n\n\treturn widget;\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AAJA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACO,SAASE,sBAAsBA,CAAEC,MAAM,EAAG;EAChD,IAAKA,MAAM,CAACC,OAAO,KAAK,OAAO,EAAG;IACjC,MAAMC,YAAY,GAAG,IAAAC,aAAK,EAAEH,MAAM,CAACI,QAAQ,CAACC,GAAG,CAACC,OAAO,EAAE;MACxDC,mBAAmB,EAAE;IACtB,CAAE,CAAC;IACH,IAAK,CAAEL,YAAY,CAACM,MAAM,EAAG;MAC5B,OAAO,IAAAC,2BAAkB,EACxB,IAAAC,mBAAW,EAAE,gBAAgB,EAAE,CAAC,CAAC,EAAE,EAAG,CAAC,EACvCV,MAAM,CAACW,EACR,CAAC;IACF;IACA,OAAO,IAAAF,2BAAkB,EAAEP,YAAY,CAAE,CAAC,CAAE,EAAEF,MAAM,CAACW,EAAG,CAAC;EAC1D;EAEA,IAAIC,UAAU;EACd,IAAKZ,MAAM,CAACa,SAAS,CAACC,KAAK,CAAE,CAAC,CAAE,CAACC,QAAQ,EAAG;IAC3CH,UAAU,GAAG;MACZI,MAAM,EAAEhB,MAAM,CAACC,OAAO;MACtBG,QAAQ,EAAEJ,MAAM,CAACI;IAClB,CAAC;E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AM,CAAC2B,aAAa;EAE3B,OAAO3B,MAAM;AACd","ignoreList":[]}
@@ -1,20 +1,17 @@
1
1
  /**
2
2
  * WordPress dependencies
3
3
  */
4
- import { Button, VisuallyHidden } from '@wordpress/components';
5
- import { close } from '@wordpress/icons';
6
4
  import { __experimentalLibrary as Library } from '@wordpress/block-editor';
7
5
  import { useViewportMatch, __experimentalUseDialog as useDialog } from '@wordpress/compose';
8
6
  import { useCallback, useRef } from '@wordpress/element';
9
7
  import { useDispatch } from '@wordpress/data';
10
- import { __ } from '@wordpress/i18n';
11
8
 
12
9
  /**
13
10
  * Internal dependencies
14
11
  */
15
12
  import useWidgetLibraryInsertionPoint from '../../hooks/use-widget-library-insertion-point';
16
13
  import { store as editWidgetsStore } from '../../store';
17
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
14
+ import { jsx as _jsx } from "react/jsx-runtime";
18
15
  export default function InserterSidebar() {
19
16
  const isMobileViewport = useViewportMatch('medium', '<');
20
17
  const {
@@ -27,34 +24,26 @@ export default function InserterSidebar() {
27
24
  const closeInserter = useCallback(() => {
28
25
  return setIsInserterOpened(false);
29
26
  }, [setIsInserterOpened]);
30
- const TagName = !isMobileViewport ? VisuallyHidden : 'div';
31
27
  const [inserterDialogRef, inserterDialogProps] = useDialog({
32
28
  onClose: closeInserter,
33
29
  focusOnMount: true
34
30
  });
35
31
  const libraryRef = useRef();
36
- return /*#__PURE__*/_jsxs("div", {
32
+ return /*#__PURE__*/_jsx("div", {
37
33
  ref: inserterDialogRef,
38
34
  ...inserterDialogProps,
39
35
  className: "edit-widgets-layout__inserter-panel",
40
- children: [/*#__PURE__*/_jsx(TagName, {
41
- className: "edit-widgets-layout__inserter-panel-header",
42
- children: /*#__PURE__*/_jsx(Button, {
43
- __next40pxDefaultSize: true,
44
- icon: close,
45
- onClick: closeInserter,
46
- label: __('Close Block Inserter')
47
- })
48
- }), /*#__PURE__*/_jsx("div", {
36
+ children: /*#__PURE__*/_jsx("div", {
49
37
  className: "edit-widgets-layout__inserter-panel-content",
50
38
  children: /*#__PURE__*/_jsx(Library, {
51
39
  showInserterHelpPanel: true,
52
40
  shouldFocusBlock: isMobileViewport,
53
41
  rootClientId: rootClientId,
54
42
  __experimentalInsertionIndex: insertionIndex,
55
- ref: libraryRef
43
+ ref: libraryRef,
44
+ onClose: closeInserter
56
45
  })
57
- })]
46
+ })
58
47
  });
59
48
  }
60
49
  //# sourceMappingURL=inserter-sidebar.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["Button","VisuallyHidden","close","__experimentalLibrary","Library","useViewportMatch","__experimentalUseDialog","useDialog","useCallback","useRef","useDispatch","__","useWidgetLibraryInsertionPoint","store","editWidgetsStore","jsx","_jsx","jsxs","_jsxs","InserterSidebar","isMobileViewport","rootClientId","insertionIndex","setIsInserterOpened","closeInserter","TagName","inserterDialogRef","inserterDialogProps","onClose","focusOnMount","libraryRef","ref","className","children","__next40pxDefaultSize","icon","onClick","label","showInserterHelpPanel","shouldFocusBlock","__experimentalInsertionIndex"],"sources":["@wordpress/edit-widgets/src/components/secondary-sidebar/inserter-sidebar.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Button, VisuallyHidden } from '@wordpress/components';\nimport { close } from '@wordpress/icons';\nimport { __experimentalLibrary as Library } from '@wordpress/block-editor';\nimport {\n\tuseViewportMatch,\n\t__experimentalUseDialog as useDialog,\n} from '@wordpress/compose';\nimport { useCallback, useRef } from '@wordpress/element';\nimport { useDispatch } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport useWidgetLibraryInsertionPoint from '../../hooks/use-widget-library-insertion-point';\nimport { store as editWidgetsStore } from '../../store';\n\nexport default function InserterSidebar() {\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst { rootClientId, insertionIndex } = useWidgetLibraryInsertionPoint();\n\n\tconst { setIsInserterOpened } = useDispatch( editWidgetsStore );\n\n\tconst closeInserter = useCallback( () => {\n\t\treturn setIsInserterOpened( false );\n\t}, [ setIsInserterOpened ] );\n\n\tconst TagName = ! isMobileViewport ? VisuallyHidden : 'div';\n\tconst [ inserterDialogRef, inserterDialogProps ] = useDialog( {\n\t\tonClose: closeInserter,\n\t\tfocusOnMount: true,\n\t} );\n\n\tconst libraryRef = useRef();\n\n\treturn (\n\t\t<div\n\t\t\tref={ inserterDialogRef }\n\t\t\t{ ...inserterDialogProps }\n\t\t\tclassName=\"edit-widgets-layout__inserter-panel\"\n\t\t>\n\t\t\t<TagName className=\"edit-widgets-layout__inserter-panel-header\">\n\t\t\t\t<Button\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\ticon={ close }\n\t\t\t\t\tonClick={ closeInserter }\n\t\t\t\t\tlabel={ __( 'Close Block Inserter' ) }\n\t\t\t\t/>\n\t\t\t</TagName>\n\t\t\t<div className=\"edit-widgets-layout__inserter-panel-content\">\n\t\t\t\t<Library\n\t\t\t\t\tshowInserterHelpPanel\n\t\t\t\t\tshouldFocusBlock={ isMobileViewport }\n\t\t\t\t\trootClientId={ rootClientId }\n\t\t\t\t\t__experimentalInsertionIndex={ insertionIndex }\n\t\t\t\t\tref={ libraryRef }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,MAAM,EAAEC,cAAc,QAAQ,uBAAuB;AAC9D,SAASC,KAAK,QAAQ,kBAAkB;AACxC,SAASC,qBAAqB,IAAIC,OAAO,QAAQ,yBAAyB;AAC1E,SACCC,gBAAgB,EAChBC,uBAAuB,IAAIC,SAAS,QAC9B,oBAAoB;AAC3B,SAASC,WAAW,EAAEC,MAAM,QAAQ,oBAAoB;AACxD,SAASC,WAAW,QAAQ,iBAAiB;AAC7C,SAASC,EAAE,QAAQ,iBAAiB;;AAEpC;AACA;AACA;AACA,OAAOC,8BAA8B,MAAM,gDAAgD;AAC3F,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AAAC,SAAAC,GAA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AAGD;MAAY,CAClB;IAAC,CACE,CAAC;EAAA,CACF,CAAC;AAER","ignoreList":[]}
1
+ {"version":3,"names":["__experimentalLibrary","Library","useViewportMatch","__experimentalUseDialog","useDialog","useCallback","useRef","useDispatch","useWidgetLibraryInsertionPoint","store","editWidgetsStore","jsx","_jsx","InserterSidebar","isMobileViewport","rootClientId","insertionIndex","setIsInserterOpened","closeInserter","inserterDialogRef","inserterDialogProps","onClose","focusOnMount","libraryRef","ref","className","children","showInserterHelpPanel","shouldFocusBlock","__experimentalInsertionIndex"],"sources":["@wordpress/edit-widgets/src/components/secondary-sidebar/inserter-sidebar.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __experimentalLibrary as Library } from '@wordpress/block-editor';\nimport {\n\tuseViewportMatch,\n\t__experimentalUseDialog as useDialog,\n} from '@wordpress/compose';\nimport { useCallback, useRef } from '@wordpress/element';\nimport { useDispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport useWidgetLibraryInsertionPoint from '../../hooks/use-widget-library-insertion-point';\nimport { store as editWidgetsStore } from '../../store';\n\nexport default function InserterSidebar() {\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst { rootClientId, insertionIndex } = useWidgetLibraryInsertionPoint();\n\n\tconst { setIsInserterOpened } = useDispatch( editWidgetsStore );\n\n\tconst closeInserter = useCallback( () => {\n\t\treturn setIsInserterOpened( false );\n\t}, [ setIsInserterOpened ] );\n\n\tconst [ inserterDialogRef, inserterDialogProps ] = useDialog( {\n\t\tonClose: closeInserter,\n\t\tfocusOnMount: true,\n\t} );\n\n\tconst libraryRef = useRef();\n\n\treturn (\n\t\t<div\n\t\t\tref={ inserterDialogRef }\n\t\t\t{ ...inserterDialogProps }\n\t\t\tclassName=\"edit-widgets-layout__inserter-panel\"\n\t\t>\n\t\t\t<div className=\"edit-widgets-layout__inserter-panel-content\">\n\t\t\t\t<Library\n\t\t\t\t\tshowInserterHelpPanel\n\t\t\t\t\tshouldFocusBlock={ isMobileViewport }\n\t\t\t\t\trootClientId={ rootClientId }\n\t\t\t\t\t__experimentalInsertionIndex={ insertionIndex }\n\t\t\t\t\tref={ libraryRef }\n\t\t\t\t\tonClose={ closeInserter }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,qBAAqB,IAAIC,OAAO,QAAQ,yBAAyB;AAC1E,SACCC,gBAAgB,EAChBC,uBAAuB,IAAIC,SAAS,QAC9B,oBAAoB;AAC3B,SAASC,WAAW,EAAEC,MAAM,QAAQ,oBAAoB;AACxD,SAASC,WAAW,QAAQ,iBAAiB;;AAE7C;AACA;AACA;AACA,OAAOC,8BAA8B,MAAM,gDAAgD;AAC3F,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAExD,eAAe,SAASC,eAAeA,CAAA,EAAG;EACzC,MAAMC,gBAAgB,GAAGZ,gBAAgB,CAAE,QAAQ,EAAE,GAAI,CAAC;EAC1D,MAAM;IAAEa,YAAY;IAAEC;EAAe,CAAC,GAAGR,8BAA8B,CAAC,CAAC;EAEzE,MAAM;IAAES;EAAoB,CAAC,GAAGV,WAAW,CAAEG,gBAAiB,CAAC;EAE/D,MAAMQ,aAAa,GAAGb,WAAW,CAAE,MAAM;IACxC,OAAOY,mBAAmB,CAAE,KAAM,CAAC;EACpC,CAAC,EAAE,CAAEA,mBAAmB,CAAG,CAAC;EAE5B,MAAM,CAAEE,iBAAiB,EAAEC,mBAAmB,CAAE,GAAGhB,SAAS,CAAE;IAC7DiB,OAAO,EAAEH,aAAa;IACtBI,YAAY,EAAE;EACf,CAAE,CAAC;EAEH,MAAMC,UAAU,GAAGjB,MAAM,CAAC,CAAC;EAE3B,oBACCM,IAAA;IACCY,GAAG,EAAGL,iBAAmB;IAAA,GACpBC,mBAAmB;IACxBK,SAAS,EAAC,qCAAqC;IAAAC,QAAA,eAE/Cd,IAAA;MAAKa,SAAS,EAAC,6CAA6C;MAAAC,QAAA,eAC3Dd,IAAA,CAACX,OAAO;QACP0B,qBAAqB;QACrBC,gBAAgB,EAAGd,gBAAkB;QACrCC,YAAY,EAAGA,YAAc;QAC7Bc,4BAA4B,EAAGb,cAAgB;QAC/CQ,GAAG,EAAGD,UAAY;QAClBF,OAAO,EAAGH;MAAe,CACzB;IAAC,CACE;EAAC,CACF,CAAC;AAER","ignoreList":[]}
@@ -38,7 +38,7 @@ export function transformWidgetToBlock(widget) {
38
38
  * Converts a block to a widget entity record.
39
39
  *
40
40
  * @param {Object} block The block.
41
- * @param {Object?} relatedWidget A related widget entity record from the API (optional).
41
+ * @param {?Object} relatedWidget A related widget entity record from the API (optional).
42
42
  * @return {Object} the widget object (converted from block).
43
43
  */
44
44
  export function transformBlockToWidget(block, relatedWidget = {}) {
@@ -1 +1 @@
1
- {"version":3,"names":["createBlock","parse","serialize","addWidgetIdToBlock","transformWidgetToBlock","widget","id_base","parsedBlocks","instance","raw","content","__unstableSkipAutop","length","id","attributes","_embedded","about","is_multi","idBase","transformBlockToWidget","block","relatedWidget","isValidLegacyWidgetBlock","name","_block$attributes$id","_block$attributes$idB","_block$attributes$ins","rendered","rendered_form"],"sources":["@wordpress/edit-widgets/src/store/transformers.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createBlock, parse, serialize } from '@wordpress/blocks';\nimport { addWidgetIdToBlock } from '@wordpress/widgets';\n\n/**\n * Converts a widget entity record into a block.\n *\n * @param {Object} widget The widget entity record.\n * @return {Object} a block (converted from the entity record).\n */\nexport function transformWidgetToBlock( widget ) {\n\tif ( widget.id_base === 'block' ) {\n\t\tconst parsedBlocks = parse( widget.instance.raw.content, {\n\t\t\t__unstableSkipAutop: true,\n\t\t} );\n\t\tif ( ! parsedBlocks.length ) {\n\t\t\treturn addWidgetIdToBlock(\n\t\t\t\tcreateBlock( 'core/paragraph', {}, [] ),\n\t\t\t\twidget.id\n\t\t\t);\n\t\t}\n\t\treturn addWidgetIdToBlock( parsedBlocks[ 0 ], widget.id );\n\t}\n\n\tlet attributes;\n\tif ( widget._embedded.about[ 0 ].is_multi ) {\n\t\tattributes = {\n\t\t\tidBase: widget.id_base,\n\t\t\tinstance: widget.instance,\n\t\t};\n\t} else {\n\t\tattributes = {\n\t\t\tid: widget.id,\n\t\t};\n\t}\n\n\treturn addWidgetIdToBlock(\n\t\tcreateBlock( 'core/legacy-widget', attributes, [] ),\n\t\twidget.id\n\t);\n}\n\n/**\n * Converts a block to a widget entity record.\n *\n * @param {Object} block The block.\n * @param {Object?} relatedWidget A related widget entity record from the API (optional).\n * @return {Object} the widget object (converted from block).\n */\nexport function transformBlockToWidget( block, relatedWidget = {} ) {\n\tlet widget;\n\n\tconst isValidLegacyWidgetBlock =\n\t\tblock.name === 'core/legacy-widget' &&\n\t\t( block.attributes.id || block.attributes.instance );\n\n\tif ( isValidLegacyWidgetBlock ) {\n\t\twidget = {\n\t\t\t...relatedWidget,\n\t\t\tid: block.attributes.id ?? relatedWidget.id,\n\t\t\tid_base: block.attributes.idBase ?? relatedWidget.id_base,\n\t\t\tinstance: block.attributes.instance ?? relatedWidget.instance,\n\t\t};\n\t} else {\n\t\twidget = {\n\t\t\t...relatedWidget,\n\t\t\tid_base: 'block',\n\t\t\tinstance: {\n\t\t\t\traw: {\n\t\t\t\t\tcontent: serialize( block ),\n\t\t\t\t},\n\t\t\t},\n\t\t};\n\t}\n\n\t// Delete read-only properties.\n\tdelete widget.rendered;\n\tdelete widget.rendered_form;\n\n\treturn widget;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,WAAW,EAAEC,KAAK,EAAEC,SAAS,QAAQ,mBAAmB;AACjE,SAASC,kBAAkB,QAAQ,oBAAoB;;AAEvD;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,sBAAsBA,CAAEC,MAAM,EAAG;EAChD,IAAKA,MAAM,CAACC,OAAO,KAAK,OAAO,EAAG;IACjC,MAAMC,YAAY,GAAGN,KAAK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A,cAAAA,oBAAA,GAAIH,aAAa,CAACR,EAAE;MAC3CP,OAAO,GAAAmB,qBAAA,GAAEL,KAAK,CAACN,UAAU,CAACI,MAAM,cAAAO,qBAAA,cAAAA,qBAAA,GAAIJ,aAAa,CAACf,OAAO;MACzDE,QAAQ,GAAAkB,qBAAA,GAAEN,KAAK,CAACN,UAAU,CAACN,QAAQ,cAAAkB,qBAAA,cAAAA,qBAAA,GAAIL,aAAa,CAACb;IACtD,CAAC;EACF,CAAC,MAAM;IACNH,MAAM,GAAG;MACR,GAAGgB,aAAa;MAChBf,OAAO,EAAE,OAAO;MAChBE,QAAQ,EAAE;QACTC,GAAG,EAAE;UACJC,OAAO,EAAER,SAAS,CAAEkB,KAAM;QAC3B;MACD;IACD,CAAC;EACF;;EAEA;EACA,OAAOf,MAAM,CAACsB,QAAQ;EACtB,OAAOtB,MAAM,CAACuB,aAAa;EAE3B,OAAOvB,MAAM;AACd","ignoreList":[]}
1
+ {"version":3,"names":["createBlock","parse","serialize","addWidgetIdToBlock","transformWidgetToBlock","widget","id_base","parsedBlocks","instance","raw","content","__unstableSkipAutop","length","id","attributes","_embedded","about","is_multi","idBase","transformBlockToWidget","block","relatedWidget","isValidLegacyWidgetBlock","name","_block$attributes$id","_block$attributes$idB","_block$attributes$ins","rendered","rendered_form"],"sources":["@wordpress/edit-widgets/src/store/transformers.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createBlock, parse, serialize } from '@wordpress/blocks';\nimport { addWidgetIdToBlock } from '@wordpress/widgets';\n\n/**\n * Converts a widget entity record into a block.\n *\n * @param {Object} widget The widget entity record.\n * @return {Object} a block (converted from the entity record).\n */\nexport function transformWidgetToBlock( widget ) {\n\tif ( widget.id_base === 'block' ) {\n\t\tconst parsedBlocks = parse( widget.instance.raw.content, {\n\t\t\t__unstableSkipAutop: true,\n\t\t} );\n\t\tif ( ! parsedBlocks.length ) {\n\t\t\treturn addWidgetIdToBlock(\n\t\t\t\tcreateBlock( 'core/paragraph', {}, [] ),\n\t\t\t\twidget.id\n\t\t\t);\n\t\t}\n\t\treturn addWidgetIdToBlock( parsedBlocks[ 0 ], widget.id );\n\t}\n\n\tlet attributes;\n\tif ( widget._embedded.about[ 0 ].is_multi ) {\n\t\tattributes = {\n\t\t\tidBase: widget.id_base,\n\t\t\tinstance: widget.instance,\n\t\t};\n\t} else {\n\t\tattributes = {\n\t\t\tid: widget.id,\n\t\t};\n\t}\n\n\treturn addWidgetIdToBlock(\n\t\tcreateBlock( 'core/legacy-widget', attributes, [] ),\n\t\twidget.id\n\t);\n}\n\n/**\n * Converts a block to a widget entity record.\n *\n * @param {Object} block The block.\n * @param {?Object} relatedWidget A related widget entity record from the API (optional).\n * @return {Object} the widget object (converted from block).\n */\nexport function transformBlockToWidget( block, relatedWidget = {} ) {\n\tlet widget;\n\n\tconst isValidLegacyWidgetBlock =\n\t\tblock.name === 'core/legacy-widget' &&\n\t\t( block.attributes.id || block.attributes.instance );\n\n\tif ( isValidLegacyWidgetBlock ) {\n\t\twidget = {\n\t\t\t...relatedWidget,\n\t\t\tid: block.attributes.id ?? relatedWidget.id,\n\t\t\tid_base: block.attributes.idBase ?? relatedWidget.id_base,\n\t\t\tinstance: block.attributes.instance ?? relatedWidget.instance,\n\t\t};\n\t} else {\n\t\twidget = {\n\t\t\t...relatedWidget,\n\t\t\tid_base: 'block',\n\t\t\tinstance: {\n\t\t\t\traw: {\n\t\t\t\t\tcontent: serialize( block ),\n\t\t\t\t},\n\t\t\t},\n\t\t};\n\t}\n\n\t// Delete read-only properties.\n\tdelete widget.rendered;\n\tdelete widget.rendered_form;\n\n\treturn widget;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,WAAW,EAAEC,KAAK,EAAEC,SAAS,QAAQ,mBAAmB;AACjE,SAASC,kBAAkB,QAAQ,oBAAoB;;AAEvD;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,sBAAsBA,CAAEC,MAAM,EAAG;EAChD,IAAKA,MAAM,CAAC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oBAAA,GAAEJ,KAAK,CAACN,UAAU,CAACD,EAAE,cAAAW,oBAAA,cAAAA,oBAAA,GAAIH,aAAa,CAACR,EAAE;MAC3CP,OAAO,GAAAmB,qBAAA,GAAEL,KAAK,CAACN,UAAU,CAACI,MAAM,cAAAO,qBAAA,cAAAA,qBAAA,GAAIJ,aAAa,CAACf,OAAO;MACzDE,QAAQ,GAAAkB,qBAAA,GAAEN,KAAK,CAACN,UAAU,CAACN,QAAQ,cAAAkB,qBAAA,cAAAA,qBAAA,GAAIL,aAAa,CAACb;IACtD,CAAC;EACF,CAAC,MAAM;IACNH,MAAM,GAAG;MACR,GAAGgB,aAAa;MAChBf,OAAO,EAAE,OAAO;MAChBE,QAAQ,EAAE;QACTC,GAAG,EAAE;UACJC,OAAO,EAAER,SAAS,CAAEkB,KAAM;QAC3B;MACD;IACD,CAAC;EACF;;EAEA;EACA,OAAOf,MAAM,CAACsB,QAAQ;EACtB,OAAOtB,MAAM,CAACuB,aAAa;EAE3B,OAAOvB,MAAM;AACd","ignoreList":[]}
@@ -248,8 +248,7 @@ html.interface-interface-skeleton__html-container {
248
248
  overflow: hidden;
249
249
  }
250
250
 
251
- .interface-interface-skeleton {
252
- /* Set left position when auto-fold is not on the body element. */
251
+ .interface-interface-skeleton { /* Set left position when auto-fold is not on the body element. */
253
252
  right: 0;
254
253
  }
255
254
  @media (min-width: 783px) {
@@ -258,9 +257,7 @@ html.interface-interface-skeleton__html-container {
258
257
  }
259
258
  }
260
259
 
261
- .auto-fold .interface-interface-skeleton {
262
- /* Auto fold is when on smaller breakpoints, nav menu auto collapses. */
263
- }
260
+ .auto-fold .interface-interface-skeleton { /* Auto fold is when on smaller breakpoints, nav menu auto collapses. */ }
264
261
  @media (min-width: 783px) {
265
262
  .auto-fold .interface-interface-skeleton {
266
263
  right: 36px;
@@ -703,8 +700,7 @@ body.is-dragging-components-draggable .wp-block[data-type="core/widget-area"] .c
703
700
  padding-left: 16px;
704
701
  }
705
702
 
706
- .edit-widgets-notices__snackbar {
707
- /* Set left position when auto-fold is not on the body element. */
703
+ .edit-widgets-notices__snackbar { /* Set left position when auto-fold is not on the body element. */
708
704
  right: 0;
709
705
  }
710
706
  @media (min-width: 783px) {
@@ -713,9 +709,7 @@ body.is-dragging-components-draggable .wp-block[data-type="core/widget-area"] .c
713
709
  }
714
710
  }
715
711
 
716
- .auto-fold .edit-widgets-notices__snackbar {
717
- /* Auto fold is when on smaller breakpoints, nav menu auto collapses. */
718
- }
712
+ .auto-fold .edit-widgets-notices__snackbar { /* Auto fold is when on smaller breakpoints, nav menu auto collapses. */ }
719
713
  @media (min-width: 783px) {
720
714
  .auto-fold .edit-widgets-notices__snackbar {
721
715
  right: 36px;
@@ -762,13 +756,6 @@ body.is-fullscreen-mode .edit-widgets-notices__snackbar {
762
756
  overflow: hidden;
763
757
  }
764
758
 
765
- .edit-widgets-layout__inserter-panel-header {
766
- padding-top: 8px;
767
- padding-left: 8px;
768
- display: flex;
769
- justify-content: flex-end;
770
- }
771
-
772
759
  .edit-widgets-layout__inserter-panel-content {
773
760
  height: calc(100% - 36px - 8px);
774
761
  }
@@ -248,8 +248,7 @@ html.interface-interface-skeleton__html-container {
248
248
  overflow: hidden;
249
249
  }
250
250
 
251
- .interface-interface-skeleton {
252
- /* Set left position when auto-fold is not on the body element. */
251
+ .interface-interface-skeleton { /* Set left position when auto-fold is not on the body element. */
253
252
  left: 0;
254
253
  }
255
254
  @media (min-width: 783px) {
@@ -258,9 +257,7 @@ html.interface-interface-skeleton__html-container {
258
257
  }
259
258
  }
260
259
 
261
- .auto-fold .interface-interface-skeleton {
262
- /* Auto fold is when on smaller breakpoints, nav menu auto collapses. */
263
- }
260
+ .auto-fold .interface-interface-skeleton { /* Auto fold is when on smaller breakpoints, nav menu auto collapses. */ }
264
261
  @media (min-width: 783px) {
265
262
  .auto-fold .interface-interface-skeleton {
266
263
  left: 36px;
@@ -703,8 +700,7 @@ body.is-dragging-components-draggable .wp-block[data-type="core/widget-area"] .c
703
700
  padding-right: 16px;
704
701
  }
705
702
 
706
- .edit-widgets-notices__snackbar {
707
- /* Set left position when auto-fold is not on the body element. */
703
+ .edit-widgets-notices__snackbar { /* Set left position when auto-fold is not on the body element. */
708
704
  left: 0;
709
705
  }
710
706
  @media (min-width: 783px) {
@@ -713,9 +709,7 @@ body.is-dragging-components-draggable .wp-block[data-type="core/widget-area"] .c
713
709
  }
714
710
  }
715
711
 
716
- .auto-fold .edit-widgets-notices__snackbar {
717
- /* Auto fold is when on smaller breakpoints, nav menu auto collapses. */
718
- }
712
+ .auto-fold .edit-widgets-notices__snackbar { /* Auto fold is when on smaller breakpoints, nav menu auto collapses. */ }
719
713
  @media (min-width: 783px) {
720
714
  .auto-fold .edit-widgets-notices__snackbar {
721
715
  left: 36px;
@@ -762,13 +756,6 @@ body.is-fullscreen-mode .edit-widgets-notices__snackbar {
762
756
  overflow: hidden;
763
757
  }
764
758
 
765
- .edit-widgets-layout__inserter-panel-header {
766
- padding-top: 8px;
767
- padding-right: 8px;
768
- display: flex;
769
- justify-content: flex-end;
770
- }
771
-
772
759
  .edit-widgets-layout__inserter-panel-content {
773
760
  height: calc(100% - 36px - 8px);
774
761
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/edit-widgets",
3
- "version": "6.14.0",
3
+ "version": "6.15.1",
4
4
  "description": "Widgets Page module for WordPress..",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -29,32 +29,32 @@
29
29
  "wpScript": true,
30
30
  "dependencies": {
31
31
  "@babel/runtime": "7.25.7",
32
- "@wordpress/api-fetch": "*",
33
- "@wordpress/block-editor": "*",
34
- "@wordpress/block-library": "*",
35
- "@wordpress/blocks": "*",
36
- "@wordpress/components": "*",
37
- "@wordpress/compose": "*",
38
- "@wordpress/core-data": "*",
39
- "@wordpress/data": "*",
40
- "@wordpress/deprecated": "*",
41
- "@wordpress/dom": "*",
42
- "@wordpress/element": "*",
43
- "@wordpress/hooks": "*",
44
- "@wordpress/i18n": "*",
45
- "@wordpress/icons": "*",
46
- "@wordpress/interface": "*",
47
- "@wordpress/keyboard-shortcuts": "*",
48
- "@wordpress/keycodes": "*",
49
- "@wordpress/media-utils": "*",
50
- "@wordpress/notices": "*",
51
- "@wordpress/patterns": "*",
52
- "@wordpress/plugins": "*",
53
- "@wordpress/preferences": "*",
54
- "@wordpress/private-apis": "*",
55
- "@wordpress/reusable-blocks": "*",
56
- "@wordpress/url": "*",
57
- "@wordpress/widgets": "*",
32
+ "@wordpress/api-fetch": "^7.15.1",
33
+ "@wordpress/block-editor": "^14.10.1",
34
+ "@wordpress/block-library": "^9.15.1",
35
+ "@wordpress/blocks": "^14.4.1",
36
+ "@wordpress/components": "^29.1.1",
37
+ "@wordpress/compose": "^7.15.1",
38
+ "@wordpress/core-data": "^7.15.1",
39
+ "@wordpress/data": "^10.15.1",
40
+ "@wordpress/deprecated": "^4.15.1",
41
+ "@wordpress/dom": "^4.15.1",
42
+ "@wordpress/element": "^6.15.1",
43
+ "@wordpress/hooks": "^4.15.0",
44
+ "@wordpress/i18n": "^5.15.1",
45
+ "@wordpress/icons": "^10.15.1",
46
+ "@wordpress/interface": "^9.0.1",
47
+ "@wordpress/keyboard-shortcuts": "^5.15.1",
48
+ "@wordpress/keycodes": "^4.15.1",
49
+ "@wordpress/media-utils": "^5.15.1",
50
+ "@wordpress/notices": "^5.15.1",
51
+ "@wordpress/patterns": "^2.15.1",
52
+ "@wordpress/plugins": "^7.15.1",
53
+ "@wordpress/preferences": "^4.15.1",
54
+ "@wordpress/private-apis": "^1.15.0",
55
+ "@wordpress/reusable-blocks": "^5.15.1",
56
+ "@wordpress/url": "^4.15.0",
57
+ "@wordpress/widgets": "^4.15.1",
58
58
  "clsx": "^2.1.1"
59
59
  },
60
60
  "peerDependencies": {
@@ -64,5 +64,5 @@
64
64
  "publishConfig": {
65
65
  "access": "public"
66
66
  },
67
- "gitHead": "b432c18934c9db866b6dba7d37517a4e97d642e3"
67
+ "gitHead": "0d4503ecc364cf4ca16024673baf5a84dacf212f"
68
68
  }
@@ -7,13 +7,6 @@
7
7
  }
8
8
  }
9
9
 
10
- .edit-widgets-layout__inserter-panel-header {
11
- padding-top: $grid-unit-10;
12
- padding-right: $grid-unit-10;
13
- display: flex;
14
- justify-content: flex-end;
15
- }
16
-
17
10
  .edit-widgets-layout__inserter-panel-content {
18
11
  // Leave space for the close button
19
12
  height: calc(100% - #{$button-size} - #{$grid-unit-10});
@@ -1,8 +1,6 @@
1
1
  /**
2
2
  * WordPress dependencies
3
3
  */
4
- import { Button, VisuallyHidden } from '@wordpress/components';
5
- import { close } from '@wordpress/icons';
6
4
  import { __experimentalLibrary as Library } from '@wordpress/block-editor';
7
5
  import {
8
6
  useViewportMatch,
@@ -10,7 +8,6 @@ import {
10
8
  } from '@wordpress/compose';
11
9
  import { useCallback, useRef } from '@wordpress/element';
12
10
  import { useDispatch } from '@wordpress/data';
13
- import { __ } from '@wordpress/i18n';
14
11
 
15
12
  /**
16
13
  * Internal dependencies
@@ -28,7 +25,6 @@ export default function InserterSidebar() {
28
25
  return setIsInserterOpened( false );
29
26
  }, [ setIsInserterOpened ] );
30
27
 
31
- const TagName = ! isMobileViewport ? VisuallyHidden : 'div';
32
28
  const [ inserterDialogRef, inserterDialogProps ] = useDialog( {
33
29
  onClose: closeInserter,
34
30
  focusOnMount: true,
@@ -42,14 +38,6 @@ export default function InserterSidebar() {
42
38
  { ...inserterDialogProps }
43
39
  className="edit-widgets-layout__inserter-panel"
44
40
  >
45
- <TagName className="edit-widgets-layout__inserter-panel-header">
46
- <Button
47
- __next40pxDefaultSize
48
- icon={ close }
49
- onClick={ closeInserter }
50
- label={ __( 'Close Block Inserter' ) }
51
- />
52
- </TagName>
53
41
  <div className="edit-widgets-layout__inserter-panel-content">
54
42
  <Library
55
43
  showInserterHelpPanel
@@ -57,6 +45,7 @@ export default function InserterSidebar() {
57
45
  rootClientId={ rootClientId }
58
46
  __experimentalInsertionIndex={ insertionIndex }
59
47
  ref={ libraryRef }
48
+ onClose={ closeInserter }
60
49
  />
61
50
  </div>
62
51
  </div>
@@ -46,7 +46,7 @@ export function transformWidgetToBlock( widget ) {
46
46
  * Converts a block to a widget entity record.
47
47
  *
48
48
  * @param {Object} block The block.
49
- * @param {Object?} relatedWidget A related widget entity record from the API (optional).
49
+ * @param {?Object} relatedWidget A related widget entity record from the API (optional).
50
50
  * @return {Object} the widget object (converted from block).
51
51
  */
52
52
  export function transformBlockToWidget( block, relatedWidget = {} ) {