@wordpress/customize-widgets 4.16.0 → 4.17.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.
Files changed (150) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/block-appender/index.js +6 -8
  3. package/build/components/block-appender/index.js.map +1 -1
  4. package/build/components/block-inspector-button/index.js +3 -9
  5. package/build/components/block-inspector-button/index.js.map +1 -1
  6. package/build/components/customize-widgets/index.js +4 -12
  7. package/build/components/customize-widgets/index.js.map +1 -1
  8. package/build/components/customize-widgets/use-clear-selected-block.js +12 -15
  9. package/build/components/customize-widgets/use-clear-selected-block.js.map +1 -1
  10. package/build/components/error-boundary/index.js +1 -14
  11. package/build/components/error-boundary/index.js.map +1 -1
  12. package/build/components/focus-control/index.js +1 -12
  13. package/build/components/focus-control/index.js.map +1 -1
  14. package/build/components/focus-control/use-blocks-focus-control.js +3 -9
  15. package/build/components/focus-control/use-blocks-focus-control.js.map +1 -1
  16. package/build/components/header/index.js +7 -18
  17. package/build/components/header/index.js.map +1 -1
  18. package/build/components/inserter/index.js +1 -10
  19. package/build/components/inserter/index.js.map +1 -1
  20. package/build/components/inserter/use-inserter.js +1 -6
  21. package/build/components/inserter/use-inserter.js.map +1 -1
  22. package/build/components/keyboard-shortcut-help-modal/config.js +1 -2
  23. package/build/components/keyboard-shortcut-help-modal/config.js.map +1 -1
  24. package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +1 -9
  25. package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -1
  26. package/build/components/keyboard-shortcut-help-modal/index.js +4 -20
  27. package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -1
  28. package/build/components/keyboard-shortcut-help-modal/shortcut.js +1 -6
  29. package/build/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
  30. package/build/components/keyboard-shortcuts/index.js +1 -16
  31. package/build/components/keyboard-shortcuts/index.js.map +1 -1
  32. package/build/components/more-menu/index.js +2 -15
  33. package/build/components/more-menu/index.js.map +1 -1
  34. package/build/components/sidebar-block-editor/index.js +5 -22
  35. package/build/components/sidebar-block-editor/index.js.map +1 -1
  36. package/build/components/sidebar-block-editor/sidebar-adapter.js +13 -75
  37. package/build/components/sidebar-block-editor/sidebar-adapter.js.map +1 -1
  38. package/build/components/sidebar-block-editor/sidebar-editor-provider.js +1 -8
  39. package/build/components/sidebar-block-editor/sidebar-editor-provider.js.map +1 -1
  40. package/build/components/sidebar-block-editor/use-sidebar-block-editor.js +14 -24
  41. package/build/components/sidebar-block-editor/use-sidebar-block-editor.js.map +1 -1
  42. package/build/components/sidebar-controls/index.js +1 -5
  43. package/build/components/sidebar-controls/index.js.map +1 -1
  44. package/build/components/welcome-guide/index.js +1 -6
  45. package/build/components/welcome-guide/index.js.map +1 -1
  46. package/build/controls/inserter-outer-section.js +15 -24
  47. package/build/controls/inserter-outer-section.js.map +1 -1
  48. package/build/controls/inspector-section.js +0 -12
  49. package/build/controls/inspector-section.js.map +1 -1
  50. package/build/controls/sidebar-control.js +1 -12
  51. package/build/controls/sidebar-control.js.map +1 -1
  52. package/build/controls/sidebar-section.js +3 -14
  53. package/build/controls/sidebar-section.js.map +1 -1
  54. package/build/filters/index.js +0 -2
  55. package/build/filters/index.js.map +1 -1
  56. package/build/filters/move-to-sidebar.js +7 -17
  57. package/build/filters/move-to-sidebar.js.map +1 -1
  58. package/build/filters/replace-media-upload.js +1 -3
  59. package/build/filters/replace-media-upload.js.map +1 -1
  60. package/build/filters/wide-widget-display.js +3 -5
  61. package/build/filters/wide-widget-display.js.map +1 -1
  62. package/build/index.js +5 -20
  63. package/build/index.js.map +1 -1
  64. package/build/lock-unlock.js +1 -2
  65. package/build/lock-unlock.js.map +1 -1
  66. package/build/store/actions.js +0 -1
  67. package/build/store/actions.js.map +1 -1
  68. package/build/store/constants.js +0 -1
  69. package/build/store/constants.js.map +1 -1
  70. package/build/store/index.js +1 -10
  71. package/build/store/index.js.map +1 -1
  72. package/build/store/reducer.js +0 -5
  73. package/build/store/reducer.js.map +1 -1
  74. package/build/store/selectors.js +9 -10
  75. package/build/store/selectors.js.map +1 -1
  76. package/build/utils.js +8 -18
  77. package/build/utils.js.map +1 -1
  78. package/build-module/components/block-appender/index.js +5 -5
  79. package/build-module/components/block-appender/index.js.map +1 -1
  80. package/build-module/components/block-inspector-button/index.js +2 -5
  81. package/build-module/components/block-inspector-button/index.js.map +1 -1
  82. package/build-module/components/customize-widgets/index.js +4 -4
  83. package/build-module/components/customize-widgets/index.js.map +1 -1
  84. package/build-module/components/customize-widgets/use-clear-selected-block.js +13 -12
  85. package/build-module/components/customize-widgets/use-clear-selected-block.js.map +1 -1
  86. package/build-module/components/error-boundary/index.js +0 -8
  87. package/build-module/components/error-boundary/index.js.map +1 -1
  88. package/build-module/components/focus-control/index.js +1 -8
  89. package/build-module/components/focus-control/index.js.map +1 -1
  90. package/build-module/components/focus-control/use-blocks-focus-control.js +3 -4
  91. package/build-module/components/focus-control/use-blocks-focus-control.js.map +1 -1
  92. package/build-module/components/header/index.js +8 -11
  93. package/build-module/components/header/index.js.map +1 -1
  94. package/build-module/components/inserter/index.js +1 -4
  95. package/build-module/components/inserter/index.js.map +1 -1
  96. package/build-module/components/inserter/use-inserter.js +1 -3
  97. package/build-module/components/inserter/use-inserter.js.map +1 -1
  98. package/build-module/components/keyboard-shortcut-help-modal/config.js.map +1 -1
  99. package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +1 -6
  100. package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -1
  101. package/build-module/components/keyboard-shortcut-help-modal/index.js +5 -13
  102. package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
  103. package/build-module/components/keyboard-shortcut-help-modal/shortcut.js +0 -5
  104. package/build-module/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
  105. package/build-module/components/keyboard-shortcuts/index.js +0 -9
  106. package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
  107. package/build-module/components/more-menu/index.js +2 -6
  108. package/build-module/components/more-menu/index.js.map +1 -1
  109. package/build-module/components/sidebar-block-editor/index.js +5 -9
  110. package/build-module/components/sidebar-block-editor/index.js.map +1 -1
  111. package/build-module/components/sidebar-block-editor/sidebar-adapter.js +12 -72
  112. package/build-module/components/sidebar-block-editor/sidebar-adapter.js.map +1 -1
  113. package/build-module/components/sidebar-block-editor/sidebar-editor-provider.js +1 -2
  114. package/build-module/components/sidebar-block-editor/sidebar-editor-provider.js.map +1 -1
  115. package/build-module/components/sidebar-block-editor/use-sidebar-block-editor.js +15 -20
  116. package/build-module/components/sidebar-block-editor/use-sidebar-block-editor.js.map +1 -1
  117. package/build-module/components/sidebar-controls/index.js +0 -1
  118. package/build-module/components/sidebar-controls/index.js.map +1 -1
  119. package/build-module/components/welcome-guide/index.js +0 -1
  120. package/build-module/components/welcome-guide/index.js.map +1 -1
  121. package/build-module/controls/inserter-outer-section.js +15 -20
  122. package/build-module/controls/inserter-outer-section.js.map +1 -1
  123. package/build-module/controls/inspector-section.js +0 -11
  124. package/build-module/controls/inspector-section.js.map +1 -1
  125. package/build-module/controls/sidebar-control.js +1 -8
  126. package/build-module/controls/sidebar-control.js.map +1 -1
  127. package/build-module/controls/sidebar-section.js +3 -12
  128. package/build-module/controls/sidebar-section.js.map +1 -1
  129. package/build-module/filters/index.js.map +1 -1
  130. package/build-module/filters/move-to-sidebar.js +7 -10
  131. package/build-module/filters/move-to-sidebar.js.map +1 -1
  132. package/build-module/filters/replace-media-upload.js +0 -2
  133. package/build-module/filters/replace-media-upload.js.map +1 -1
  134. package/build-module/filters/wide-widget-display.js +2 -3
  135. package/build-module/filters/wide-widget-display.js.map +1 -1
  136. package/build-module/index.js +5 -10
  137. package/build-module/index.js.map +1 -1
  138. package/build-module/lock-unlock.js.map +1 -1
  139. package/build-module/store/actions.js.map +1 -1
  140. package/build-module/store/constants.js.map +1 -1
  141. package/build-module/store/index.js +3 -3
  142. package/build-module/store/index.js.map +1 -1
  143. package/build-module/store/reducer.js +1 -3
  144. package/build-module/store/reducer.js.map +1 -1
  145. package/build-module/store/selectors.js +10 -9
  146. package/build-module/store/selectors.js.map +1 -1
  147. package/build-module/utils.js +9 -14
  148. package/build-module/utils.js.map +1 -1
  149. package/package.json +22 -22
  150. package/src/store/selectors.js +10 -2
@@ -1,5 +1,4 @@
1
1
  import { createElement } from "@wordpress/element";
2
-
3
2
  /**
4
3
  * WordPress dependencies
5
4
  */
@@ -9,10 +8,10 @@ import { registerLegacyWidgetBlock, registerLegacyWidgetVariations, registerWidg
9
8
  import { setFreeformContentHandlerName, store as blocksStore } from '@wordpress/blocks';
10
9
  import { dispatch } from '@wordpress/data';
11
10
  import { store as preferencesStore } from '@wordpress/preferences';
11
+
12
12
  /**
13
13
  * Internal dependencies
14
14
  */
15
-
16
15
  import CustomizeWidgets from './components/customize-widgets';
17
16
  import getSidebarSection from './controls/sidebar-section';
18
17
  import getSidebarControl from './controls/sidebar-control';
@@ -22,40 +21,36 @@ const {
22
21
  } = window;
23
22
  const DISABLED_BLOCKS = ['core/more', 'core/block', 'core/freeform', 'core/template-part'];
24
23
  const ENABLE_EXPERIMENTAL_FSE_BLOCKS = false;
24
+
25
25
  /**
26
26
  * Initializes the widgets block editor in the customizer.
27
27
  *
28
28
  * @param {string} editorName The editor name.
29
29
  * @param {Object} blockEditorSettings Block editor settings.
30
30
  */
31
-
32
31
  export function initialize(editorName, blockEditorSettings) {
33
32
  dispatch(preferencesStore).setDefaults('core/customize-widgets', {
34
33
  fixedToolbar: false,
35
34
  welcomeGuide: true
36
35
  });
37
-
38
36
  dispatch(blocksStore).__experimentalReapplyBlockTypeFilters();
39
-
40
37
  const coreBlocks = __experimentalGetCoreBlocks().filter(block => {
41
38
  return !(DISABLED_BLOCKS.includes(block.name) || block.name.startsWith('core/post') || block.name.startsWith('core/query') || block.name.startsWith('core/site') || block.name.startsWith('core/navigation'));
42
39
  });
43
-
44
40
  registerCoreBlocks(coreBlocks);
45
41
  registerLegacyWidgetBlock();
46
-
47
42
  if (process.env.IS_GUTENBERG_PLUGIN) {
48
43
  __experimentalRegisterExperimentalCoreBlocks({
49
44
  enableFSEBlocks: ENABLE_EXPERIMENTAL_FSE_BLOCKS
50
45
  });
51
46
  }
52
-
53
47
  registerLegacyWidgetVariations(blockEditorSettings);
54
- registerWidgetGroupBlock(); // As we are unregistering `core/freeform` to avoid the Classic block, we must
48
+ registerWidgetGroupBlock();
49
+
50
+ // As we are unregistering `core/freeform` to avoid the Classic block, we must
55
51
  // replace it with something as the default freeform content handler. Failure to
56
52
  // do this will result in errors in the default block parser.
57
53
  // see: https://github.com/WordPress/gutenberg/issues/33097
58
-
59
54
  setFreeformContentHandlerName('core/html');
60
55
  const SidebarControl = getSidebarControl(blockEditorSettings);
61
56
  wp.customize.sectionConstructor.sidebar = getSidebarSection();
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/customize-widgets/src/index.js"],"names":["createRoot","registerCoreBlocks","__experimentalGetCoreBlocks","__experimentalRegisterExperimentalCoreBlocks","registerLegacyWidgetBlock","registerLegacyWidgetVariations","registerWidgetGroupBlock","setFreeformContentHandlerName","store","blocksStore","dispatch","preferencesStore","CustomizeWidgets","getSidebarSection","getSidebarControl","wp","window","DISABLED_BLOCKS","ENABLE_EXPERIMENTAL_FSE_BLOCKS","initialize","editorName","blockEditorSettings","setDefaults","fixedToolbar","welcomeGuide","__experimentalReapplyBlockTypeFilters","coreBlocks","filter","block","includes","name","startsWith","process","env","IS_GUTENBERG_PLUGIN","enableFSEBlocks","SidebarControl","customize","sectionConstructor","sidebar","controlConstructor","sidebar_block_editor","container","document","createElement","body","appendChild","bind","sidebarControls","control","each","push","render"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,UAAT,QAA2B,oBAA3B;AACA,SACCC,kBADD,EAECC,2BAFD,EAGCC,4CAHD,QAIO,0BAJP;AAKA,SACCC,yBADD,EAECC,8BAFD,EAGCC,wBAHD,QAIO,oBAJP;AAKA,SACCC,6B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t__experimentalGetCoreBlocks,\n\t__experimentalRegisterExperimentalCoreBlocks,\n} from '@wordpress/block-library';\nimport {\n\tregisterLegacyWidgetBlock,\n\tregisterLegacyWidgetVariations,\n\tregisterWidgetGroupBlock,\n} from '@wordpress/widgets';\nimport {\n\tsetFreeformContentHandlerName,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\nimport { dispatch } from '@wordpress/data';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport CustomizeWidgets from './components/customize-widgets';\nimport getSidebarSection from './controls/sidebar-section';\nimport getSidebarControl from './controls/sidebar-control';\nimport './filters';\n\nconst { wp } = window;\n\nconst DISABLED_BLOCKS = [\n\t'core/more',\n\t'core/block',\n\t'core/freeform',\n\t'core/template-part',\n];\nconst ENABLE_EXPERIMENTAL_FSE_BLOCKS = false;\n\n/**\n * Initializes the widgets block editor in the customizer.\n *\n * @param {string} editorName The editor name.\n * @param {Object} blockEditorSettings Block editor settings.\n */\nexport function initialize( editorName, blockEditorSettings ) {\n\tdispatch( preferencesStore ).setDefaults( 'core/customize-widgets', {\n\t\tfixedToolbar: false,\n\t\twelcomeGuide: true,\n\t} );\n\n\tdispatch( blocksStore ).__experimentalReapplyBlockTypeFilters();\n\tconst coreBlocks = __experimentalGetCoreBlocks().filter( ( block ) => {\n\t\treturn ! (\n\t\t\tDISABLED_BLOCKS.includes( block.name ) ||\n\t\t\tblock.name.startsWith( 'core/post' ) ||\n\t\t\tblock.name.startsWith( 'core/query' ) ||\n\t\t\tblock.name.startsWith( 'core/site' ) ||\n\t\t\tblock.name.startsWith( 'core/navigation' )\n\t\t);\n\t} );\n\tregisterCoreBlocks( coreBlocks );\n\tregisterLegacyWidgetBlock();\n\tif ( process.env.IS_GUTENBERG_PLUGIN ) {\n\t\t__experimentalRegisterExperimentalCoreBlocks( {\n\t\t\tenableFSEBlocks: ENABLE_EXPERIMENTAL_FSE_BLOCKS,\n\t\t} );\n\t}\n\tregisterLegacyWidgetVariations( blockEditorSettings );\n\tregisterWidgetGroupBlock();\n\n\t// As we are unregistering `core/freeform` to avoid the Classic block, we must\n\t// replace it with something as the default freeform content handler. Failure to\n\t// do this will result in errors in the default block parser.\n\t// see: https://github.com/WordPress/gutenberg/issues/33097\n\tsetFreeformContentHandlerName( 'core/html' );\n\n\tconst SidebarControl = getSidebarControl( blockEditorSettings );\n\n\twp.customize.sectionConstructor.sidebar = getSidebarSection();\n\twp.customize.controlConstructor.sidebar_block_editor = SidebarControl;\n\n\tconst container = document.createElement( 'div' );\n\tdocument.body.appendChild( container );\n\n\twp.customize.bind( 'ready', () => {\n\t\tconst sidebarControls = [];\n\t\twp.customize.control.each( ( control ) => {\n\t\t\tif ( control instanceof SidebarControl ) {\n\t\t\t\tsidebarControls.push( control );\n\t\t\t}\n\t\t} );\n\n\t\tcreateRoot( container ).render(\n\t\t\t<CustomizeWidgets\n\t\t\t\tapi={ wp.customize }\n\t\t\t\tsidebarControls={ sidebarControls }\n\t\t\t\tblockEditorSettings={ blockEditorSettings }\n\t\t\t/>\n\t\t);\n\t} );\n}\nexport { store } from './store';\n"]}
1
+ {"version":3,"names":["createRoot","registerCoreBlocks","__experimentalGetCoreBlocks","__experimentalRegisterExperimentalCoreBlocks","registerLegacyWidgetBlock","registerLegacyWidgetVariations","registerWidgetGroupBlock","setFreeformContentHandlerName","store","blocksStore","dispatch","preferencesStore","CustomizeWidgets","getSidebarSection","getSidebarControl","wp","window","DISABLED_BLOCKS","ENABLE_EXPERIMENTAL_FSE_BLOCKS","initialize","editorName","blockEditorSettings","setDefaults","fixedToolbar","welcomeGuide","__experimentalReapplyBlockTypeFilters","coreBlocks","filter","block","includes","name","startsWith","process","env","IS_GUTENBERG_PLUGIN","enableFSEBlocks","SidebarControl","customize","sectionConstructor","sidebar","controlConstructor","sidebar_block_editor","container","document","createElement","body","appendChild","bind","sidebarControls","control","each","push","render","api"],"sources":["@wordpress/customize-widgets/src/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createRoot } from '@wordpress/element';\nimport {\n\tregisterCoreBlocks,\n\t__experimentalGetCoreBlocks,\n\t__experimentalRegisterExperimentalCoreBlocks,\n} from '@wordpress/block-library';\nimport {\n\tregisterLegacyWidgetBlock,\n\tregisterLegacyWidgetVariations,\n\tregisterWidgetGroupBlock,\n} from '@wordpress/widgets';\nimport {\n\tsetFreeformContentHandlerName,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\nimport { dispatch } from '@wordpress/data';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport CustomizeWidgets from './components/customize-widgets';\nimport getSidebarSection from './controls/sidebar-section';\nimport getSidebarControl from './controls/sidebar-control';\nimport './filters';\n\nconst { wp } = window;\n\nconst DISABLED_BLOCKS = [\n\t'core/more',\n\t'core/block',\n\t'core/freeform',\n\t'core/template-part',\n];\nconst ENABLE_EXPERIMENTAL_FSE_BLOCKS = false;\n\n/**\n * Initializes the widgets block editor in the customizer.\n *\n * @param {string} editorName The editor name.\n * @param {Object} blockEditorSettings Block editor settings.\n */\nexport function initialize( editorName, blockEditorSettings ) {\n\tdispatch( preferencesStore ).setDefaults( 'core/customize-widgets', {\n\t\tfixedToolbar: false,\n\t\twelcomeGuide: true,\n\t} );\n\n\tdispatch( blocksStore ).__experimentalReapplyBlockTypeFilters();\n\tconst coreBlocks = __experimentalGetCoreBlocks().filter( ( block ) => {\n\t\treturn ! (\n\t\t\tDISABLED_BLOCKS.includes( block.name ) ||\n\t\t\tblock.name.startsWith( 'core/post' ) ||\n\t\t\tblock.name.startsWith( 'core/query' ) ||\n\t\t\tblock.name.startsWith( 'core/site' ) ||\n\t\t\tblock.name.startsWith( 'core/navigation' )\n\t\t);\n\t} );\n\tregisterCoreBlocks( coreBlocks );\n\tregisterLegacyWidgetBlock();\n\tif ( process.env.IS_GUTENBERG_PLUGIN ) {\n\t\t__experimentalRegisterExperimentalCoreBlocks( {\n\t\t\tenableFSEBlocks: ENABLE_EXPERIMENTAL_FSE_BLOCKS,\n\t\t} );\n\t}\n\tregisterLegacyWidgetVariations( blockEditorSettings );\n\tregisterWidgetGroupBlock();\n\n\t// As we are unregistering `core/freeform` to avoid the Classic block, we must\n\t// replace it with something as the default freeform content handler. Failure to\n\t// do this will result in errors in the default block parser.\n\t// see: https://github.com/WordPress/gutenberg/issues/33097\n\tsetFreeformContentHandlerName( 'core/html' );\n\n\tconst SidebarControl = getSidebarControl( blockEditorSettings );\n\n\twp.customize.sectionConstructor.sidebar = getSidebarSection();\n\twp.customize.controlConstructor.sidebar_block_editor = SidebarControl;\n\n\tconst container = document.createElement( 'div' );\n\tdocument.body.appendChild( container );\n\n\twp.customize.bind( 'ready', () => {\n\t\tconst sidebarControls = [];\n\t\twp.customize.control.each( ( control ) => {\n\t\t\tif ( control instanceof SidebarControl ) {\n\t\t\t\tsidebarControls.push( control );\n\t\t\t}\n\t\t} );\n\n\t\tcreateRoot( container ).render(\n\t\t\t<CustomizeWidgets\n\t\t\t\tapi={ wp.customize }\n\t\t\t\tsidebarControls={ sidebarControls }\n\t\t\t\tblockEditorSettings={ blockEditorSettings }\n\t\t\t/>\n\t\t);\n\t} );\n}\nexport { store } from './store';\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,UAAU,QAAQ,oBAAoB;AAC/C,SACCC,kBAAkB,EAClBC,2BAA2B,EAC3BC,4CAA4C,QACtC,0BAA0B;AACjC,SACCC,yBAAyB,EACzBC,8BAA8B,EAC9BC,wBAAwB,QAClB,oBAAoB;AAC3B,SACCC,6BAA6B,EAC7BC,KAAK,IAAIC,WAAW,QACd,mBAAmB;AAC1B,SAASC,QAAQ,QAAQ,iBAAiB;AAC1C,SAASF,KAAK,IAAIG,gBAAgB,QAAQ,wBAAwB;;AAElE;AACA;AACA;AACA,OAAOC,gBAAgB,MAAM,gCAAgC;AAC7D,OAAOC,iBAAiB,MAAM,4BAA4B;AAC1D,OAAOC,iBAAiB,MAAM,4BAA4B;AAC1D,OAAO,WAAW;AAElB,MA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kBAAkB,CAACC,OAAO,GAAG1B,iBAAiB,CAAC,CAAC;EAC7DE,EAAE,CAACsB,SAAS,CAACG,kBAAkB,CAACC,oBAAoB,GAAGL,cAAc;EAErE,MAAMM,SAAS,GAAGC,QAAQ,CAACC,aAAa,CAAE,KAAM,CAAC;EACjDD,QAAQ,CAACE,IAAI,CAACC,WAAW,CAAEJ,SAAU,CAAC;EAEtC3B,EAAE,CAACsB,SAAS,CAACU,IAAI,CAAE,OAAO,EAAE,MAAM;IACjC,MAAMC,eAAe,GAAG,EAAE;IAC1BjC,EAAE,CAACsB,SAAS,CAACY,OAAO,CAACC,IAAI,CAAID,OAAO,IAAM;MACzC,IAAKA,OAAO,YAAYb,cAAc,EAAG;QACxCY,eAAe,CAACG,IAAI,CAAEF,OAAQ,CAAC;MAChC;IACD,CAAE,CAAC;IAEHjD,UAAU,CAAE0C,SAAU,CAAC,CAACU,MAAM,CAC7BR,aAAA,CAAChC,gBAAgB;MAChByC,GAAG,EAAGtC,EAAE,CAACsB,SAAW;MACpBW,eAAe,EAAGA,eAAiB;MACnC3B,mBAAmB,EAAGA;IAAqB,CAC3C,CACF,CAAC;EACF,CAAE,CAAC;AACJ;AACA,SAASb,KAAK,QAAQ,SAAS"}
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/customize-widgets/src/lock-unlock.js"],"names":["__dangerousOptInToUnstableAPIsOnlyForCoreModules","lock","unlock"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,gDAAT,QAAiE,yBAAjE;AAEA,OAAO,MAAM;AAAEC,EAAAA,IAAF;AAAQC,EAAAA;AAAR,IACZF,gDAAgD,CAC/C,8GAD+C,EAE/C,8BAF+C,CAD1C","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/private-apis';\n\nexport const { lock, unlock } =\n\t__dangerousOptInToUnstableAPIsOnlyForCoreModules(\n\t\t'I know using unstable features means my plugin or theme will inevitably break on the next WordPress release.',\n\t\t'@wordpress/customize-widgets'\n\t);\n"]}
1
+ {"version":3,"names":["__dangerousOptInToUnstableAPIsOnlyForCoreModules","lock","unlock"],"sources":["@wordpress/customize-widgets/src/lock-unlock.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/private-apis';\n\nexport const { lock, unlock } =\n\t__dangerousOptInToUnstableAPIsOnlyForCoreModules(\n\t\t'I know using unstable features means my plugin or theme will inevitably break on the next WordPress release.',\n\t\t'@wordpress/customize-widgets'\n\t);\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,gDAAgD,QAAQ,yBAAyB;AAE1F,OAAO,MAAM;EAAEC,IAAI;EAAEC;AAAO,CAAC,GAC5BF,gDAAgD,CAC/C,8GAA8G,EAC9G,8BACD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/customize-widgets/src/store/actions.js"],"names":["setIsInserterOpened","value","type"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,mBAAT,CAA8BC,KAA9B,EAAsC;AAC5C,SAAO;AACNC,IAAAA,IAAI,EAAE,wBADA;AAEND,IAAAA;AAFM,GAAP;AAIA","sourcesContent":["/**\n * Returns an action object used to open/close the inserter.\n *\n * @param {boolean|Object} value Whether the inserter should be\n * opened (true) or closed (false).\n * To specify an insertion point,\n * use an object.\n * @param {string} value.rootClientId The root client ID to insert at.\n * @param {number} value.insertionIndex The index to insert at.\n *\n * @example\n * ```js\n * import { store as customizeWidgetsStore } from '@wordpress/customize-widgets';\n * import { __ } from '@wordpress/i18n';\n * import { useDispatch } from '@wordpress/data';\n * import { Button } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const ExampleComponent = () => {\n * const { setIsInserterOpened } = useDispatch( customizeWidgetsStore );\n * const [ isOpen, setIsOpen ] = useState( false );\n *\n * return (\n * <Button\n * onClick={ () => {\n * setIsInserterOpened( ! isOpen );\n * setIsOpen( ! isOpen );\n * } }\n * >\n * { __( 'Open/close inserter' ) }\n * </Button>\n * );\n * };\n * ```\n *\n * @return {Object} Action object.\n */\nexport function setIsInserterOpened( value ) {\n\treturn {\n\t\ttype: 'SET_IS_INSERTER_OPENED',\n\t\tvalue,\n\t};\n}\n"]}
1
+ {"version":3,"names":["setIsInserterOpened","value","type"],"sources":["@wordpress/customize-widgets/src/store/actions.js"],"sourcesContent":["/**\n * Returns an action object used to open/close the inserter.\n *\n * @param {boolean|Object} value Whether the inserter should be\n * opened (true) or closed (false).\n * To specify an insertion point,\n * use an object.\n * @param {string} value.rootClientId The root client ID to insert at.\n * @param {number} value.insertionIndex The index to insert at.\n *\n * @example\n * ```js\n * import { store as customizeWidgetsStore } from '@wordpress/customize-widgets';\n * import { __ } from '@wordpress/i18n';\n * import { useDispatch } from '@wordpress/data';\n * import { Button } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const ExampleComponent = () => {\n * const { setIsInserterOpened } = useDispatch( customizeWidgetsStore );\n * const [ isOpen, setIsOpen ] = useState( false );\n *\n * return (\n * <Button\n * onClick={ () => {\n * setIsInserterOpened( ! isOpen );\n * setIsOpen( ! isOpen );\n * } }\n * >\n * { __( 'Open/close inserter' ) }\n * </Button>\n * );\n * };\n * ```\n *\n * @return {Object} Action object.\n */\nexport function setIsInserterOpened( value ) {\n\treturn {\n\t\ttype: 'SET_IS_INSERTER_OPENED',\n\t\tvalue,\n\t};\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,mBAAmBA,CAAEC,KAAK,EAAG;EAC5C,OAAO;IACNC,IAAI,EAAE,wBAAwB;IAC9BD;EACD,CAAC;AACF"}
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/customize-widgets/src/store/constants.js"],"names":["STORE_NAME"],"mappings":"AAAA;AACA;AACA;AACA,OAAO,MAAMA,UAAU,GAAG,wBAAnB","sourcesContent":["/**\n * Module Constants\n */\nexport const STORE_NAME = 'core/customize-widgets';\n"]}
1
+ {"version":3,"names":["STORE_NAME"],"sources":["@wordpress/customize-widgets/src/store/constants.js"],"sourcesContent":["/**\n * Module Constants\n */\nexport const STORE_NAME = 'core/customize-widgets';\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAO,MAAMA,UAAU,GAAG,wBAAwB"}
@@ -2,14 +2,15 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import { createReduxStore, register } from '@wordpress/data';
5
+
5
6
  /**
6
7
  * Internal dependencies
7
8
  */
8
-
9
9
  import reducer from './reducer';
10
10
  import * as selectors from './selectors';
11
11
  import * as actions from './actions';
12
12
  import { STORE_NAME } from './constants';
13
+
13
14
  /**
14
15
  * Block editor data store configuration.
15
16
  *
@@ -17,12 +18,12 @@ import { STORE_NAME } from './constants';
17
18
  *
18
19
  * @type {Object}
19
20
  */
20
-
21
21
  const storeConfig = {
22
22
  reducer,
23
23
  selectors,
24
24
  actions
25
25
  };
26
+
26
27
  /**
27
28
  * Store definition for the edit widgets namespace.
28
29
  *
@@ -30,7 +31,6 @@ const storeConfig = {
30
31
  *
31
32
  * @type {Object}
32
33
  */
33
-
34
34
  export const store = createReduxStore(STORE_NAME, storeConfig);
35
35
  register(store);
36
36
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/customize-widgets/src/store/index.js"],"names":["createReduxStore","register","reducer","selectors","actions","STORE_NAME","storeConfig","store"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,gBAAT,EAA2BC,QAA3B,QAA2C,iBAA3C;AAEA;AACA;AACA;;AACA,OAAOC,OAAP,MAAoB,WAApB;AACA,OAAO,KAAKC,SAAZ,MAA2B,aAA3B;AACA,OAAO,KAAKC,OAAZ,MAAyB,WAAzB;AACA,SAASC,UAAT,QAA2B,aAA3B;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,MAAMC,WAAW,GAAG;AACnBJ,EAAAA,OADmB;AAEnBC,EAAAA,SAFmB;AAGnBC,EAAAA;AAHmB,CAApB;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMG,KAAK,GAAGP,gBAAgB,CAAEK,UAAF,EAAcC,WAAd,CAA9B;AACPL,QAAQ,CAAEM,KAAF,CAAR","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createReduxStore, register } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport reducer from './reducer';\nimport * as selectors from './selectors';\nimport * as actions from './actions';\nimport { STORE_NAME } from './constants';\n\n/**\n * Block editor data store configuration.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#registering-a-store\n *\n * @type {Object}\n */\nconst storeConfig = {\n\treducer,\n\tselectors,\n\tactions,\n};\n\n/**\n * Store definition for the edit widgets namespace.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore\n *\n * @type {Object}\n */\nexport const store = createReduxStore( STORE_NAME, storeConfig );\nregister( store );\n"]}
1
+ {"version":3,"names":["createReduxStore","register","reducer","selectors","actions","STORE_NAME","storeConfig","store"],"sources":["@wordpress/customize-widgets/src/store/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createReduxStore, register } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport reducer from './reducer';\nimport * as selectors from './selectors';\nimport * as actions from './actions';\nimport { STORE_NAME } from './constants';\n\n/**\n * Block editor data store configuration.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#registering-a-store\n *\n * @type {Object}\n */\nconst storeConfig = {\n\treducer,\n\tselectors,\n\tactions,\n};\n\n/**\n * Store definition for the edit widgets namespace.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore\n *\n * @type {Object}\n */\nexport const store = createReduxStore( STORE_NAME, storeConfig );\nregister( store );\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,gBAAgB,EAAEC,QAAQ,QAAQ,iBAAiB;;AAE5D;AACA;AACA;AACA,OAAOC,OAAO,MAAM,WAAW;AAC/B,OAAO,KAAKC,SAAS,MAAM,aAAa;AACxC,OAAO,KAAKC,OAAO,MAAM,WAAW;AACpC,SAASC,UAAU,QAAQ,aAAa;;AAExC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,WAAW,GAAG;EACnBJ,OAAO;EACPC,SAAS;EACTC;AACD,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMG,KAAK,GAAGP,gBAAgB,CAAEK,UAAU,EAAEC,WAAY,CAAC;AAChEL,QAAQ,CAAEM,KAAM,CAAC"}
@@ -2,22 +2,20 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import { combineReducers } from '@wordpress/data';
5
+
5
6
  /**
6
7
  * Reducer tracking whether the inserter is open.
7
8
  *
8
9
  * @param {boolean|Object} state
9
10
  * @param {Object} action
10
11
  */
11
-
12
12
  function blockInserterPanel(state = false, action) {
13
13
  switch (action.type) {
14
14
  case 'SET_IS_INSERTER_OPENED':
15
15
  return action.value;
16
16
  }
17
-
18
17
  return state;
19
18
  }
20
-
21
19
  export default combineReducers({
22
20
  blockInserterPanel
23
21
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/customize-widgets/src/store/reducer.js"],"names":["combineReducers","blockInserterPanel","state","action","type","value"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,eAAT,QAAgC,iBAAhC;AAEA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASC,kBAAT,CAA6BC,KAAK,GAAG,KAArC,EAA4CC,MAA5C,EAAqD;AACpD,UAASA,MAAM,CAACC,IAAhB;AACC,SAAK,wBAAL;AACC,aAAOD,MAAM,CAACE,KAAd;AAFF;;AAIA,SAAOH,KAAP;AACA;;AAED,eAAeF,eAAe,CAAE;AAC/BC,EAAAA;AAD+B,CAAF,CAA9B","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { combineReducers } from '@wordpress/data';\n\n/**\n * Reducer tracking whether the inserter is open.\n *\n * @param {boolean|Object} state\n * @param {Object} action\n */\nfunction blockInserterPanel( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_IS_INSERTER_OPENED':\n\t\t\treturn action.value;\n\t}\n\treturn state;\n}\n\nexport default combineReducers( {\n\tblockInserterPanel,\n} );\n"]}
1
+ {"version":3,"names":["combineReducers","blockInserterPanel","state","action","type","value"],"sources":["@wordpress/customize-widgets/src/store/reducer.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { combineReducers } from '@wordpress/data';\n\n/**\n * Reducer tracking whether the inserter is open.\n *\n * @param {boolean|Object} state\n * @param {Object} action\n */\nfunction blockInserterPanel( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_IS_INSERTER_OPENED':\n\t\t\treturn action.value;\n\t}\n\treturn state;\n}\n\nexport default combineReducers( {\n\tblockInserterPanel,\n} );\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,eAAe,QAAQ,iBAAiB;;AAEjD;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,kBAAkBA,CAAEC,KAAK,GAAG,KAAK,EAAEC,MAAM,EAAG;EACpD,QAASA,MAAM,CAACC,IAAI;IACnB,KAAK,wBAAwB;MAC5B,OAAOD,MAAM,CAACE,KAAK;EACrB;EACA,OAAOH,KAAK;AACb;AAEA,eAAeF,eAAe,CAAE;EAC/BC;AACD,CAAE,CAAC"}
@@ -1,3 +1,8 @@
1
+ const EMPTY_INSERTION_POINT = {
2
+ rootClientId: undefined,
3
+ insertionIndex: undefined
4
+ };
5
+
1
6
  /**
2
7
  * Returns true if the inserter is opened.
3
8
  *
@@ -26,6 +31,7 @@
26
31
  export function isInserterOpened(state) {
27
32
  return !!state.blockInserterPanel;
28
33
  }
34
+
29
35
  /**
30
36
  * Get the insertion point for the inserter.
31
37
  *
@@ -33,15 +39,10 @@ export function isInserterOpened(state) {
33
39
  *
34
40
  * @return {Object} The root client ID and index to insert at.
35
41
  */
36
-
37
42
  export function __experimentalGetInsertionPoint(state) {
38
- const {
39
- rootClientId,
40
- insertionIndex
41
- } = state.blockInserterPanel;
42
- return {
43
- rootClientId,
44
- insertionIndex
45
- };
43
+ if (typeof state.blockInserterPanel === 'boolean') {
44
+ return EMPTY_INSERTION_POINT;
45
+ }
46
+ return state.blockInserterPanel;
46
47
  }
47
48
  //# sourceMappingURL=selectors.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/customize-widgets/src/store/selectors.js"],"names":["isInserterOpened","state","blockInserterPanel","__experimentalGetInsertionPoint","rootClientId","insertionIndex"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,gBAAT,CAA2BC,KAA3B,EAAmC;AACzC,SAAO,CAAC,CAAEA,KAAK,CAACC,kBAAhB;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,+BAAT,CAA0CF,KAA1C,EAAkD;AACxD,QAAM;AAAEG,IAAAA,YAAF;AAAgBC,IAAAA;AAAhB,MAAmCJ,KAAK,CAACC,kBAA/C;AACA,SAAO;AAAEE,IAAAA,YAAF;AAAgBC,IAAAA;AAAhB,GAAP;AACA","sourcesContent":["/**\n * Returns true if the inserter is opened.\n *\n * @param {Object} state Global application state.\n *\n * @example\n * ```js\n * import { store as customizeWidgetsStore } from '@wordpress/customize-widgets';\n * import { __ } from '@wordpress/i18n';\n * import { useSelect } from '@wordpress/data';\n *\n * const ExampleComponent = () => {\n * const { isInserterOpened } = useSelect(\n * ( select ) => select( customizeWidgetsStore ),\n * []\n * );\n *\n * return isInserterOpened()\n * ? __( 'Inserter is open' )\n * : __( 'Inserter is closed.' );\n * };\n * ```\n *\n * @return {boolean} Whether the inserter is opened.\n */\nexport function isInserterOpened( state ) {\n\treturn !! state.blockInserterPanel;\n}\n\n/**\n * Get the insertion point for the inserter.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} The root client ID and index to insert at.\n */\nexport function __experimentalGetInsertionPoint( state ) {\n\tconst { rootClientId, insertionIndex } = state.blockInserterPanel;\n\treturn { rootClientId, insertionIndex };\n}\n"]}
1
+ {"version":3,"names":["EMPTY_INSERTION_POINT","rootClientId","undefined","insertionIndex","isInserterOpened","state","blockInserterPanel","__experimentalGetInsertionPoint"],"sources":["@wordpress/customize-widgets/src/store/selectors.js"],"sourcesContent":["const EMPTY_INSERTION_POINT = {\n\trootClientId: undefined,\n\tinsertionIndex: undefined,\n};\n\n/**\n * Returns true if the inserter is opened.\n *\n * @param {Object} state Global application state.\n *\n * @example\n * ```js\n * import { store as customizeWidgetsStore } from '@wordpress/customize-widgets';\n * import { __ } from '@wordpress/i18n';\n * import { useSelect } from '@wordpress/data';\n *\n * const ExampleComponent = () => {\n * const { isInserterOpened } = useSelect(\n * ( select ) => select( customizeWidgetsStore ),\n * []\n * );\n *\n * return isInserterOpened()\n * ? __( 'Inserter is open' )\n * : __( 'Inserter is closed.' );\n * };\n * ```\n *\n * @return {boolean} Whether the inserter is opened.\n */\nexport function isInserterOpened( state ) {\n\treturn !! state.blockInserterPanel;\n}\n\n/**\n * Get the insertion point for the inserter.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} The root client ID and index to insert at.\n */\nexport function __experimentalGetInsertionPoint( state ) {\n\tif ( typeof state.blockInserterPanel === 'boolean' ) {\n\t\treturn EMPTY_INSERTION_POINT;\n\t}\n\n\treturn state.blockInserterPanel;\n}\n"],"mappings":"AAAA,MAAMA,qBAAqB,GAAG;EAC7BC,YAAY,EAAEC,SAAS;EACvBC,cAAc,EAAED;AACjB,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASE,gBAAgBA,CAAEC,KAAK,EAAG;EACzC,OAAO,CAAC,CAAEA,KAAK,CAACC,kBAAkB;AACnC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,+BAA+BA,CAAEF,KAAK,EAAG;EACxD,IAAK,OAAOA,KAAK,CAACC,kBAAkB,KAAK,SAAS,EAAG;IACpD,OAAON,qBAAqB;EAC7B;EAEA,OAAOK,KAAK,CAACC,kBAAkB;AAChC"}
@@ -1,28 +1,26 @@
1
1
  // @ts-check
2
-
3
2
  /**
4
3
  * WordPress dependencies
5
4
  */
6
5
  import { serialize, parse, createBlock } from '@wordpress/blocks';
7
6
  import { addWidgetIdToBlock } from '@wordpress/widgets';
7
+
8
8
  /**
9
9
  * Convert settingId to widgetId.
10
10
  *
11
11
  * @param {string} settingId The setting id.
12
12
  * @return {string} The widget id.
13
13
  */
14
-
15
14
  export function settingIdToWidgetId(settingId) {
16
15
  const matches = settingId.match(/^widget_(.+)(?:\[(\d+)\])$/);
17
-
18
16
  if (matches) {
19
17
  const idBase = matches[1];
20
18
  const number = parseInt(matches[2], 10);
21
19
  return `${idBase}-${number}`;
22
20
  }
23
-
24
21
  return settingId;
25
22
  }
23
+
26
24
  /**
27
25
  * Transform a block to a customizable widget.
28
26
  *
@@ -30,11 +28,9 @@ export function settingIdToWidgetId(settingId) {
30
28
  * @param {Object} existingWidget The widget to be extended from.
31
29
  * @return {Object} The transformed widget.
32
30
  */
33
-
34
31
  export function blockToWidget(block, existingWidget = null) {
35
32
  let widget;
36
33
  const isValidLegacyWidgetBlock = block.name === 'core/legacy-widget' && (block.attributes.id || block.attributes.instance);
37
-
38
34
  if (isValidLegacyWidgetBlock) {
39
35
  if (block.attributes.id) {
40
36
  // Widget that does not extend WP_Widget.
@@ -47,11 +43,13 @@ export function blockToWidget(block, existingWidget = null) {
47
43
  hash,
48
44
  raw,
49
45
  ...rest
50
- } = block.attributes.instance; // Widget that extends WP_Widget.
46
+ } = block.attributes.instance;
51
47
 
48
+ // Widget that extends WP_Widget.
52
49
  widget = {
53
50
  idBase: block.attributes.idBase,
54
- instance: { ...existingWidget?.instance,
51
+ instance: {
52
+ ...existingWidget?.instance,
55
53
  // Required only for the customizer.
56
54
  is_widget_customizer_js_value: true,
57
55
  encoded_serialized_instance: encoded,
@@ -73,16 +71,17 @@ export function blockToWidget(block, existingWidget = null) {
73
71
  }
74
72
  };
75
73
  }
76
-
77
74
  const {
78
75
  form,
79
76
  rendered,
80
77
  ...restExistingWidget
81
78
  } = existingWidget || {};
82
- return { ...restExistingWidget,
79
+ return {
80
+ ...restExistingWidget,
83
81
  ...widget
84
82
  };
85
83
  }
84
+
86
85
  /**
87
86
  * Transform a widget to a block.
88
87
  *
@@ -93,7 +92,6 @@ export function blockToWidget(block, existingWidget = null) {
93
92
  * @param {Object} widget.instance The instance of the widget.
94
93
  * @return {WPBlock} The transformed block.
95
94
  */
96
-
97
95
  export function widgetToBlock({
98
96
  id,
99
97
  idBase,
@@ -107,10 +105,8 @@ export function widgetToBlock({
107
105
  raw_instance: raw,
108
106
  ...rest
109
107
  } = instance;
110
-
111
108
  if (idBase === 'block') {
112
109
  var _raw$content;
113
-
114
110
  const parsedBlocks = parse((_raw$content = raw.content) !== null && _raw$content !== void 0 ? _raw$content : '', {
115
111
  __unstableSkipAutop: true
116
112
  });
@@ -132,7 +128,6 @@ export function widgetToBlock({
132
128
  id
133
129
  });
134
130
  }
135
-
136
131
  return addWidgetIdToBlock(block, id);
137
132
  }
138
133
  //# sourceMappingURL=utils.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/customize-widgets/src/utils.js"],"names":["serialize","parse","createBlock","addWidgetIdToBlock","settingIdToWidgetId","settingId","matches","match","idBase","number","parseInt","blockToWidget","block","existingWidget","widget","isValidLegacyWidgetBlock","name","attributes","id","instance","encoded","hash","raw","rest","is_widget_customizer_js_value","encoded_serialized_instance","instance_hash_key","raw_instance","content","widgetClass","form","rendered","restExistingWidget","widgetToBlock","parsedBlocks","__unstableSkipAutop","length"],"mappings":"AAAA;;AACA;AACA;AACA;AACA,SAASA,SAAT,EAAoBC,KAApB,EAA2BC,WAA3B,QAA8C,mBAA9C;AACA,SAASC,kBAAT,QAAmC,oBAAnC;AAEA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,mBAAT,CAA8BC,SAA9B,EAA0C;AAChD,QAAMC,OAAO,GAAGD,SAAS,CAACE,KAAV,CAAiB,4BAAjB,CAAhB;;AAEA,MAAKD,OAAL,EAAe;AACd,UAAME,MAAM,GAAGF,OAAO,CAAE,CAAF,CAAtB;AACA,UAAMG,MAAM,GAAGC,QAAQ,CAAEJ,OAAO,CAAE,CAAF,CAAT,EAAgB,EAAhB,CAAvB;AAEA,WAAQ,GAAGE,MAAQ,IAAIC,MAAQ,EAA/B;AACA;;AAED,SAAOJ,SAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASM,aAAT,CAAwBC,KAAxB,EAA+BC,cAAc,GAAG,IAAhD,EAAuD;AAC7D,MAAIC,MAAJ;AAEA,QAAMC,wBAAwB,GAC7BH,KAAK,CAACI,IAAN,KAAe,oBAAf,KACEJ,KAAK,CAACK,UAAN,CAAiBC,EAAjB,IAAuBN,KAAK,CAACK,UAAN,CAAiBE,QAD1C,CADD;;AAIA,MAAKJ,wBAAL,EAAgC;AAC/B,QAAKH,KAAK,CAACK,UAAN,CAAiBC,EAAtB,EAA2B;AAC1B;AACAJ,MAAAA,MAAM,GAAG;AACRI,QAAAA,EAAE,EAAEN,KAAK,CAACK,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;AAGLM,IAAAA,YAAY,EAAEL,GAHT;AAIL,OAAGC;AAJE,MAKFJ,QALJ;;AAOA,MAAKX,MAAM,KAAK,OAAhB,EAA0B;AAAA;;AACzB,UAAM0B,YAAY,GAAGjC,KAAK,iBAAEqB,GAAG,CAACM,OAAN,uDAAiB,EAAjB,EAAqB;AAC9CO,MAAAA,mBAAmB,EAAE;AADyB,KAArB,CAA1B;AAGAvB,IAAAA,KAAK,GAAGsB,YAAY,CAACE,MAAb,GACLF,YAAY,CAAE,CAAF,CADP,GAELhC,WAAW,CAAE,gBAAF,EAAoB,EAApB,CAFd;AAGA,GAPD,MAOO,IAAKO,MAAL,EAAc;AACpB;AACAG,IAAAA,KAAK,GAAGV,WAAW,CAAE,oBAAF,EAAwB;AAC1CM,MAAAA,MAD0C;AAE1CW,MAAAA,QAAQ,EAAE;AACTC,QAAAA,OADS;AAETC,QAAAA,IAFS;AAGTC,QAAAA,GAHS;AAIT,WAAGC;AAJM;AAFgC,KAAxB,CAAnB;AASA,GAXM,MAWA;AACN;AACAX,IAAAA,KAAK,GAAGV,WAAW,CAAE,oBAAF,EAAwB;AAC1CgB,MAAAA;AAD0C,KAAxB,CAAnB;AAGA;;AAED,SAAOf,kBAAkB,CAAES,KAAF,EAASM,EAAT,CAAzB;AACA","sourcesContent":["// @ts-check\n/**\n * WordPress dependencies\n */\nimport { serialize, parse, createBlock } from '@wordpress/blocks';\nimport { addWidgetIdToBlock } from '@wordpress/widgets';\n\n/**\n * Convert settingId to widgetId.\n *\n * @param {string} settingId The setting id.\n * @return {string} The widget id.\n */\nexport function settingIdToWidgetId( settingId ) {\n\tconst matches = settingId.match( /^widget_(.+)(?:\\[(\\d+)\\])$/ );\n\n\tif ( matches ) {\n\t\tconst idBase = matches[ 1 ];\n\t\tconst number = parseInt( matches[ 2 ], 10 );\n\n\t\treturn `${ idBase }-${ number }`;\n\t}\n\n\treturn settingId;\n}\n\n/**\n * Transform a block to a customizable widget.\n *\n * @param {WPBlock} block The block to be transformed from.\n * @param {Object} existingWidget The widget to be extended from.\n * @return {Object} The transformed widget.\n */\nexport function blockToWidget( block, existingWidget = null ) {\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\tif ( block.attributes.id ) {\n\t\t\t// Widget that does not extend WP_Widget.\n\t\t\twidget = {\n\t\t\t\tid: block.attributes.id,\n\t\t\t};\n\t\t} else {\n\t\t\tconst { encoded, hash, raw, ...rest } = block.attributes.instance;\n\n\t\t\t// Widget that extends WP_Widget.\n\t\t\twidget = {\n\t\t\t\tidBase: block.attributes.idBase,\n\t\t\t\tinstance: {\n\t\t\t\t\t...existingWidget?.instance,\n\t\t\t\t\t// Required only for the customizer.\n\t\t\t\t\tis_widget_customizer_js_value: true,\n\t\t\t\t\tencoded_serialized_instance: encoded,\n\t\t\t\t\tinstance_hash_key: hash,\n\t\t\t\t\traw_instance: raw,\n\t\t\t\t\t...rest,\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t} else {\n\t\tconst instance = {\n\t\t\tcontent: serialize( block ),\n\t\t};\n\t\twidget = {\n\t\t\tidBase: 'block',\n\t\t\twidgetClass: 'WP_Widget_Block',\n\t\t\tinstance: {\n\t\t\t\traw_instance: instance,\n\t\t\t},\n\t\t};\n\t}\n\n\tconst { form, rendered, ...restExistingWidget } = existingWidget || {};\n\n\treturn {\n\t\t...restExistingWidget,\n\t\t...widget,\n\t};\n}\n\n/**\n * Transform a widget to a block.\n *\n * @param {Object} widget The widget to be transformed from.\n * @param {string} widget.id The widget id.\n * @param {string} widget.idBase The id base of the widget.\n * @param {number} widget.number The number/index of the widget.\n * @param {Object} widget.instance The instance of the widget.\n * @return {WPBlock} The transformed block.\n */\nexport function widgetToBlock( { id, idBase, number, instance } ) {\n\tlet block;\n\n\tconst {\n\t\tencoded_serialized_instance: encoded,\n\t\tinstance_hash_key: hash,\n\t\traw_instance: raw,\n\t\t...rest\n\t} = instance;\n\n\tif ( idBase === 'block' ) {\n\t\tconst parsedBlocks = parse( raw.content ?? '', {\n\t\t\t__unstableSkipAutop: true,\n\t\t} );\n\t\tblock = parsedBlocks.length\n\t\t\t? parsedBlocks[ 0 ]\n\t\t\t: createBlock( 'core/paragraph', {} );\n\t} else if ( number ) {\n\t\t// Widget that extends WP_Widget.\n\t\tblock = createBlock( 'core/legacy-widget', {\n\t\t\tidBase,\n\t\t\tinstance: {\n\t\t\t\tencoded,\n\t\t\t\thash,\n\t\t\t\traw,\n\t\t\t\t...rest,\n\t\t\t},\n\t\t} );\n\t} else {\n\t\t// Widget that does not extend WP_Widget.\n\t\tblock = createBlock( 'core/legacy-widget', {\n\t\t\tid,\n\t\t} );\n\t}\n\n\treturn addWidgetIdToBlock( block, id );\n}\n"]}
1
+ {"version":3,"names":["serialize","parse","createBlock","addWidgetIdToBlock","settingIdToWidgetId","settingId","matches","match","idBase","number","parseInt","blockToWidget","block","existingWidget","widget","isValidLegacyWidgetBlock","name","attributes","id","instance","encoded","hash","raw","rest","is_widget_customizer_js_value","encoded_serialized_instance","instance_hash_key","raw_instance","content","widgetClass","form","rendered","restExistingWidget","widgetToBlock","_raw$content","parsedBlocks","__unstableSkipAutop","length"],"sources":["@wordpress/customize-widgets/src/utils.js"],"sourcesContent":["// @ts-check\n/**\n * WordPress dependencies\n */\nimport { serialize, parse, createBlock } from '@wordpress/blocks';\nimport { addWidgetIdToBlock } from '@wordpress/widgets';\n\n/**\n * Convert settingId to widgetId.\n *\n * @param {string} settingId The setting id.\n * @return {string} The widget id.\n */\nexport function settingIdToWidgetId( settingId ) {\n\tconst matches = settingId.match( /^widget_(.+)(?:\\[(\\d+)\\])$/ );\n\n\tif ( matches ) {\n\t\tconst idBase = matches[ 1 ];\n\t\tconst number = parseInt( matches[ 2 ], 10 );\n\n\t\treturn `${ idBase }-${ number }`;\n\t}\n\n\treturn settingId;\n}\n\n/**\n * Transform a block to a customizable widget.\n *\n * @param {WPBlock} block The block to be transformed from.\n * @param {Object} existingWidget The widget to be extended from.\n * @return {Object} The transformed widget.\n */\nexport function blockToWidget( block, existingWidget = null ) {\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\tif ( block.attributes.id ) {\n\t\t\t// Widget that does not extend WP_Widget.\n\t\t\twidget = {\n\t\t\t\tid: block.attributes.id,\n\t\t\t};\n\t\t} else {\n\t\t\tconst { encoded, hash, raw, ...rest } = block.attributes.instance;\n\n\t\t\t// Widget that extends WP_Widget.\n\t\t\twidget = {\n\t\t\t\tidBase: block.attributes.idBase,\n\t\t\t\tinstance: {\n\t\t\t\t\t...existingWidget?.instance,\n\t\t\t\t\t// Required only for the customizer.\n\t\t\t\t\tis_widget_customizer_js_value: true,\n\t\t\t\t\tencoded_serialized_instance: encoded,\n\t\t\t\t\tinstance_hash_key: hash,\n\t\t\t\t\traw_instance: raw,\n\t\t\t\t\t...rest,\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t} else {\n\t\tconst instance = {\n\t\t\tcontent: serialize( block ),\n\t\t};\n\t\twidget = {\n\t\t\tidBase: 'block',\n\t\t\twidgetClass: 'WP_Widget_Block',\n\t\t\tinstance: {\n\t\t\t\traw_instance: instance,\n\t\t\t},\n\t\t};\n\t}\n\n\tconst { form, rendered, ...restExistingWidget } = existingWidget || {};\n\n\treturn {\n\t\t...restExistingWidget,\n\t\t...widget,\n\t};\n}\n\n/**\n * Transform a widget to a block.\n *\n * @param {Object} widget The widget to be transformed from.\n * @param {string} widget.id The widget id.\n * @param {string} widget.idBase The id base of the widget.\n * @param {number} widget.number The number/index of the widget.\n * @param {Object} widget.instance The instance of the widget.\n * @return {WPBlock} The transformed block.\n */\nexport function widgetToBlock( { id, idBase, number, instance } ) {\n\tlet block;\n\n\tconst {\n\t\tencoded_serialized_instance: encoded,\n\t\tinstance_hash_key: hash,\n\t\traw_instance: raw,\n\t\t...rest\n\t} = instance;\n\n\tif ( idBase === 'block' ) {\n\t\tconst parsedBlocks = parse( raw.content ?? '', {\n\t\t\t__unstableSkipAutop: true,\n\t\t} );\n\t\tblock = parsedBlocks.length\n\t\t\t? parsedBlocks[ 0 ]\n\t\t\t: createBlock( 'core/paragraph', {} );\n\t} else if ( number ) {\n\t\t// Widget that extends WP_Widget.\n\t\tblock = createBlock( 'core/legacy-widget', {\n\t\t\tidBase,\n\t\t\tinstance: {\n\t\t\t\tencoded,\n\t\t\t\thash,\n\t\t\t\traw,\n\t\t\t\t...rest,\n\t\t\t},\n\t\t} );\n\t} else {\n\t\t// Widget that does not extend WP_Widget.\n\t\tblock = createBlock( 'core/legacy-widget', {\n\t\t\tid,\n\t\t} );\n\t}\n\n\treturn addWidgetIdToBlock( block, id );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,KAAK,EAAEC,WAAW,QAAQ,mBAAmB;AACjE,SAASC,kBAAkB,QAAQ,oBAAoB;;AAEvD;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,mBAAmBA,CAAEC,SAAS,EAAG;EAChD,MAAMC,OAAO,GAAGD,SAAS,CAACE,KAAK,CAAE,4BAA6B,CAAC;EAE/D,IAAKD,OAAO,EAAG;IACd,MAAME,MAAM,GAAGF,OAAO,CAAE,CAAC,CAAE;IAC3B,MAAMG,MAAM,GAAGC,QAAQ,CAAEJ,OAAO,CAAE,CAAC,CAAE,EAAE,EAAG,CAAC;IAE3C,OAAQ,GAAGE,MAAQ,IAAIC,MAAQ,EAAC;EACjC;EAEA,OAAOJ,SAAS;AACjB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASM,aAAaA,CAAEC,KAAK,EAAEC,cAAc,GAAG,IAAI,EAAG;EAC7D,IAAIC,MAAM;EAEV,MAAMC,wBAAwB,GAC7BH,KAAK,CAACI,IAA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K;EAET,MAAM;IACLa,2BAA2B,EAAEL,OAAO;IACpCM,iBAAiB,EAAEL,IAAI;IACvBM,YAAY,EAAEL,GAAG;IACjB,GAAGC;EACJ,CAAC,GAAGJ,QAAQ;EAEZ,IAAKX,MAAM,KAAK,OAAO,EAAG;IAAA,IAAA0B,YAAA;IACzB,MAAMC,YAAY,GAAGlC,KAAK,EAAAiC,YAAA,GAAEZ,GAAG,CAACM,OAAO,cAAAM,YAAA,cAAAA,YAAA,GAAI,EAAE,EAAE;MAC9CE,mBAAmB,EAAE;IACtB,CAAE,CAAC;IACHxB,KAAK,GAAGuB,YAAY,CAACE,MAAM,GACxBF,YAAY,CAAE,CAAC,CAAE,GACjBjC,WAAW,CAAE,gBAAgB,EAAE,CAAC,CAAE,CAAC;EACvC,CAAC,MAAM,IAAKO,MAAM,EAAG;IACpB;IACAG,KAAK,GAAGV,WAAW,CAAE,oBAAoB,EAAE;MAC1CM,MAAM;MACNW,QAAQ,EAAE;QACTC,OAAO;QACPC,IAAI;QACJC,GAAG;QACH,GAAGC;MACJ;IACD,CAAE,CAAC;EACJ,CAAC,MAAM;IACN;IACAX,KAAK,GAAGV,WAAW,CAAE,oBAAoB,EAAE;MAC1CgB;IACD,CAAE,CAAC;EACJ;EAEA,OAAOf,kBAAkB,CAAES,KAAK,EAAEM,EAAG,CAAC;AACvC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/customize-widgets",
3
- "version": "4.16.0",
3
+ "version": "4.17.1",
4
4
  "description": "Widgets blocks in Customizer Module for WordPress.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -24,26 +24,26 @@
24
24
  "react-native": "src/index",
25
25
  "dependencies": {
26
26
  "@babel/runtime": "^7.16.0",
27
- "@wordpress/block-editor": "^12.7.0",
28
- "@wordpress/block-library": "^8.16.0",
29
- "@wordpress/blocks": "^12.16.0",
30
- "@wordpress/components": "^25.5.0",
31
- "@wordpress/compose": "^6.16.0",
32
- "@wordpress/core-data": "^6.16.0",
33
- "@wordpress/data": "^9.9.0",
34
- "@wordpress/dom": "^3.39.0",
35
- "@wordpress/element": "^5.16.0",
36
- "@wordpress/hooks": "^3.39.0",
37
- "@wordpress/i18n": "^4.39.0",
38
- "@wordpress/icons": "^9.30.0",
39
- "@wordpress/interface": "^5.16.0",
40
- "@wordpress/is-shallow-equal": "^4.39.0",
41
- "@wordpress/keyboard-shortcuts": "^4.16.0",
42
- "@wordpress/keycodes": "^3.39.0",
43
- "@wordpress/media-utils": "^4.30.0",
44
- "@wordpress/preferences": "^3.16.0",
45
- "@wordpress/private-apis": "^0.21.0",
46
- "@wordpress/widgets": "^3.16.0",
27
+ "@wordpress/block-editor": "^12.8.1",
28
+ "@wordpress/block-library": "^8.17.1",
29
+ "@wordpress/blocks": "^12.17.1",
30
+ "@wordpress/components": "^25.6.1",
31
+ "@wordpress/compose": "^6.17.1",
32
+ "@wordpress/core-data": "^6.17.1",
33
+ "@wordpress/data": "^9.10.1",
34
+ "@wordpress/dom": "^3.40.1",
35
+ "@wordpress/element": "^5.17.1",
36
+ "@wordpress/hooks": "^3.40.1",
37
+ "@wordpress/i18n": "^4.40.1",
38
+ "@wordpress/icons": "^9.31.1",
39
+ "@wordpress/interface": "^5.17.1",
40
+ "@wordpress/is-shallow-equal": "^4.40.1",
41
+ "@wordpress/keyboard-shortcuts": "^4.17.1",
42
+ "@wordpress/keycodes": "^3.40.1",
43
+ "@wordpress/media-utils": "^4.31.1",
44
+ "@wordpress/preferences": "^3.17.1",
45
+ "@wordpress/private-apis": "^0.22.1",
46
+ "@wordpress/widgets": "^3.17.1",
47
47
  "classnames": "^2.3.1",
48
48
  "fast-deep-equal": "^3.1.3"
49
49
  },
@@ -54,5 +54,5 @@
54
54
  "publishConfig": {
55
55
  "access": "public"
56
56
  },
57
- "gitHead": "b898cf1dc8e70841d1647ea0994ac6278acc18a7"
57
+ "gitHead": "bb1fbf87bb0f451744530fc6a85de2dff1263bed"
58
58
  }
@@ -1,3 +1,8 @@
1
+ const EMPTY_INSERTION_POINT = {
2
+ rootClientId: undefined,
3
+ insertionIndex: undefined,
4
+ };
5
+
1
6
  /**
2
7
  * Returns true if the inserter is opened.
3
8
  *
@@ -35,6 +40,9 @@ export function isInserterOpened( state ) {
35
40
  * @return {Object} The root client ID and index to insert at.
36
41
  */
37
42
  export function __experimentalGetInsertionPoint( state ) {
38
- const { rootClientId, insertionIndex } = state.blockInserterPanel;
39
- return { rootClientId, insertionIndex };
43
+ if ( typeof state.blockInserterPanel === 'boolean' ) {
44
+ return EMPTY_INSERTION_POINT;
45
+ }
46
+
47
+ return state.blockInserterPanel;
40
48
  }