@wordpress/block-library 9.13.0 → 9.13.1-next.cd6172eb0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (127) hide show
  1. package/build/block/edit.js +2 -29
  2. package/build/block/edit.js.map +1 -1
  3. package/build/cover/edit/index.js +4 -2
  4. package/build/cover/edit/index.js.map +1 -1
  5. package/build/cover/edit/inspector-controls.js +6 -4
  6. package/build/cover/edit/inspector-controls.js.map +1 -1
  7. package/build/list-item/hooks/use-merge.js +2 -2
  8. package/build/list-item/hooks/use-merge.js.map +1 -1
  9. package/build/navigation/edit/deleted-navigation-warning.js +9 -2
  10. package/build/navigation/edit/deleted-navigation-warning.js.map +1 -1
  11. package/build/navigation-submenu/edit.js +3 -0
  12. package/build/navigation-submenu/edit.js.map +1 -1
  13. package/build/pattern/recursion-detector.js +0 -1
  14. package/build/pattern/recursion-detector.js.map +1 -1
  15. package/build/query/edit/index.js +2 -2
  16. package/build/query/edit/index.js.map +1 -1
  17. package/build/query/edit/inspector-controls/author-control.js +0 -1
  18. package/build/query/edit/inspector-controls/author-control.js.map +1 -1
  19. package/build/query/edit/inspector-controls/parent-control.js +0 -1
  20. package/build/query/edit/inspector-controls/parent-control.js.map +1 -1
  21. package/build/query/edit/inspector-controls/taxonomy-controls.js +0 -1
  22. package/build/query/edit/inspector-controls/taxonomy-controls.js.map +1 -1
  23. package/build/query/edit/{pattern-selection-modal.js → pattern-selection.js} +55 -36
  24. package/build/query/edit/pattern-selection.js.map +1 -0
  25. package/build/query/edit/query-content.js +5 -8
  26. package/build/query/edit/query-content.js.map +1 -1
  27. package/build/query/edit/query-placeholder.js +5 -11
  28. package/build/query/edit/query-placeholder.js.map +1 -1
  29. package/build/query/edit/query-toolbar.js +31 -11
  30. package/build/query/edit/query-toolbar.js.map +1 -1
  31. package/build/separator/deprecated.js +2 -1
  32. package/build/separator/deprecated.js.map +1 -1
  33. package/build/separator/edit.js +29 -4
  34. package/build/separator/edit.js.map +1 -1
  35. package/build/separator/index.js +5 -0
  36. package/build/separator/index.js.map +1 -1
  37. package/build/separator/save.js +3 -2
  38. package/build/separator/save.js.map +1 -1
  39. package/build/template-part/edit/import-controls.js +0 -1
  40. package/build/template-part/edit/import-controls.js.map +1 -1
  41. package/build-module/block/edit.js +3 -30
  42. package/build-module/block/edit.js.map +1 -1
  43. package/build-module/cover/edit/index.js +4 -2
  44. package/build-module/cover/edit/index.js.map +1 -1
  45. package/build-module/cover/edit/inspector-controls.js +6 -4
  46. package/build-module/cover/edit/inspector-controls.js.map +1 -1
  47. package/build-module/list-item/hooks/use-merge.js +2 -2
  48. package/build-module/list-item/hooks/use-merge.js.map +1 -1
  49. package/build-module/navigation/edit/deleted-navigation-warning.js +10 -3
  50. package/build-module/navigation/edit/deleted-navigation-warning.js.map +1 -1
  51. package/build-module/navigation-submenu/edit.js +3 -0
  52. package/build-module/navigation-submenu/edit.js.map +1 -1
  53. package/build-module/pattern/recursion-detector.js +0 -1
  54. package/build-module/pattern/recursion-detector.js.map +1 -1
  55. package/build-module/query/edit/index.js +1 -1
  56. package/build-module/query/edit/index.js.map +1 -1
  57. package/build-module/query/edit/inspector-controls/author-control.js +0 -1
  58. package/build-module/query/edit/inspector-controls/author-control.js.map +1 -1
  59. package/build-module/query/edit/inspector-controls/parent-control.js +0 -1
  60. package/build-module/query/edit/inspector-controls/parent-control.js.map +1 -1
  61. package/build-module/query/edit/inspector-controls/taxonomy-controls.js +0 -1
  62. package/build-module/query/edit/inspector-controls/taxonomy-controls.js.map +1 -1
  63. package/build-module/query/edit/{pattern-selection-modal.js → pattern-selection.js} +53 -36
  64. package/build-module/query/edit/pattern-selection.js.map +1 -0
  65. package/build-module/query/edit/query-content.js +5 -8
  66. package/build-module/query/edit/query-content.js.map +1 -1
  67. package/build-module/query/edit/query-placeholder.js +6 -12
  68. package/build-module/query/edit/query-placeholder.js.map +1 -1
  69. package/build-module/query/edit/query-toolbar.js +31 -13
  70. package/build-module/query/edit/query-toolbar.js.map +1 -1
  71. package/build-module/separator/deprecated.js +2 -1
  72. package/build-module/separator/deprecated.js.map +1 -1
  73. package/build-module/separator/edit.js +32 -7
  74. package/build-module/separator/edit.js.map +1 -1
  75. package/build-module/separator/index.js +5 -0
  76. package/build-module/separator/index.js.map +1 -1
  77. package/build-module/separator/save.js +3 -2
  78. package/build-module/separator/save.js.map +1 -1
  79. package/build-module/template-part/edit/import-controls.js +0 -1
  80. package/build-module/template-part/edit/import-controls.js.map +1 -1
  81. package/build-style/comments-pagination/editor-rtl.css +1 -0
  82. package/build-style/comments-pagination/editor.css +1 -0
  83. package/build-style/comments-pagination/style-rtl.css +1 -0
  84. package/build-style/comments-pagination/style.css +1 -0
  85. package/build-style/editor-rtl.css +31 -0
  86. package/build-style/editor.css +31 -0
  87. package/build-style/image/style-rtl.css +3 -2
  88. package/build-style/image/style.css +3 -2
  89. package/build-style/pullquote/style-rtl.css +1 -0
  90. package/build-style/pullquote/style.css +1 -0
  91. package/build-style/query/editor-rtl.css +30 -0
  92. package/build-style/query/editor.css +30 -0
  93. package/build-style/style-rtl.css +5 -2
  94. package/build-style/style.css +5 -2
  95. package/build-types/lock-unlock.d.ts +1 -1
  96. package/build-types/lock-unlock.d.ts.map +1 -1
  97. package/package.json +34 -34
  98. package/src/block/edit.js +6 -51
  99. package/src/comments-pagination/editor.scss +1 -0
  100. package/src/comments-pagination/style.scss +1 -0
  101. package/src/cover/edit/index.js +4 -1
  102. package/src/cover/edit/inspector-controls.js +10 -3
  103. package/src/cover/index.php +2 -2
  104. package/src/image/style.scss +4 -3
  105. package/src/list-item/hooks/use-merge.js +2 -2
  106. package/src/missing/test/edit.native.js +0 -1
  107. package/src/navigation/README.md +1 -0
  108. package/src/navigation/edit/deleted-navigation-warning.js +11 -2
  109. package/src/navigation/index.php +9 -35
  110. package/src/navigation-submenu/edit.js +5 -0
  111. package/src/navigation-submenu/index.php +17 -1
  112. package/src/pullquote/style.scss +1 -0
  113. package/src/query/edit/index.js +1 -1
  114. package/src/query/edit/{pattern-selection-modal.js → pattern-selection.js} +53 -33
  115. package/src/query/edit/query-content.js +4 -10
  116. package/src/query/edit/query-placeholder.js +5 -14
  117. package/src/query/edit/query-toolbar.js +38 -17
  118. package/src/query/editor.scss +30 -0
  119. package/src/search/index.php +3 -3
  120. package/src/separator/block.json +5 -0
  121. package/src/separator/deprecated.js +1 -0
  122. package/src/separator/edit.js +28 -3
  123. package/src/separator/save.js +2 -2
  124. package/src/separator/test/edit.js +1 -0
  125. package/tsconfig.tsbuildinfo +1 -1
  126. package/build/query/edit/pattern-selection-modal.js.map +0 -1
  127. package/build-module/query/edit/pattern-selection-modal.js.map +0 -1
@@ -3,7 +3,9 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.default = PatternSelectionModal;
6
+ exports.PatternSelectionModal = PatternSelectionModal;
7
+ exports.default = PatternSelection;
8
+ exports.useBlockPatterns = useBlockPatterns;
7
9
  var _element = require("@wordpress/element");
8
10
  var _data = require("@wordpress/data");
9
11
  var _components = require("@wordpress/components");
@@ -24,12 +26,44 @@ function PatternSelectionModal({
24
26
  clientId,
25
27
  attributes,
26
28
  setIsPatternSelectionModalOpen
29
+ }) {
30
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Modal, {
31
+ overlayClassName: "block-library-query-pattern__selection-modal",
32
+ title: (0, _i18n.__)('Choose a pattern'),
33
+ onRequestClose: () => setIsPatternSelectionModalOpen(false),
34
+ isFullScreen: true,
35
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(PatternSelection, {
36
+ clientId: clientId,
37
+ attributes: attributes
38
+ })
39
+ });
40
+ }
41
+ function useBlockPatterns(clientId, attributes) {
42
+ const blockNameForPatterns = (0, _utils.useBlockNameForPatterns)(clientId, attributes);
43
+ return (0, _utils.usePatterns)(clientId, blockNameForPatterns);
44
+ }
45
+ function PatternSelection({
46
+ clientId,
47
+ attributes,
48
+ showTitlesAsTooltip = false,
49
+ showSearch = true
27
50
  }) {
28
51
  const [searchValue, setSearchValue] = (0, _element.useState)('');
29
52
  const {
30
53
  replaceBlock,
31
54
  selectBlock
32
55
  } = (0, _data.useDispatch)(_blockEditor.store);
56
+ const blockPatterns = useBlockPatterns(clientId, attributes);
57
+ /*
58
+ * When we preview Query Loop blocks we should prefer the current
59
+ * block's postType, which is passed through block context.
60
+ */
61
+ const blockPreviewContext = (0, _element.useMemo)(() => ({
62
+ previewPostType: attributes.query.postType
63
+ }), [attributes.query.postType]);
64
+ const filteredBlockPatterns = (0, _element.useMemo)(() => {
65
+ return (0, _searchPatterns.searchPatterns)(blockPatterns, searchValue);
66
+ }, [blockPatterns, searchValue]);
33
67
  const onBlockPatternSelect = (pattern, blocks) => {
34
68
  const {
35
69
  newBlocks,
@@ -40,40 +74,25 @@ function PatternSelectionModal({
40
74
  selectBlock(queryClientIds[0]);
41
75
  }
42
76
  };
43
- // When we preview Query Loop blocks we should prefer the current
44
- // block's postType, which is passed through block context.
45
- const blockPreviewContext = (0, _element.useMemo)(() => ({
46
- previewPostType: attributes.query.postType
47
- }), [attributes.query.postType]);
48
- const blockNameForPatterns = (0, _utils.useBlockNameForPatterns)(clientId, attributes);
49
- const blockPatterns = (0, _utils.usePatterns)(clientId, blockNameForPatterns);
50
- const filteredBlockPatterns = (0, _element.useMemo)(() => {
51
- return (0, _searchPatterns.searchPatterns)(blockPatterns, searchValue);
52
- }, [blockPatterns, searchValue]);
53
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Modal, {
54
- overlayClassName: "block-library-query-pattern__selection-modal",
55
- title: (0, _i18n.__)('Choose a pattern'),
56
- onRequestClose: () => setIsPatternSelectionModalOpen(false),
57
- isFullScreen: true,
58
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
59
- className: "block-library-query-pattern__selection-content",
60
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
61
- className: "block-library-query-pattern__selection-search",
62
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.SearchControl, {
63
- __nextHasNoMarginBottom: true,
64
- onChange: setSearchValue,
65
- value: searchValue,
66
- label: (0, _i18n.__)('Search'),
67
- placeholder: (0, _i18n.__)('Search')
68
- })
69
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_blockEditor.BlockContextProvider, {
70
- value: blockPreviewContext,
71
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_blockEditor.__experimentalBlockPatternsList, {
72
- blockPatterns: filteredBlockPatterns,
73
- onClickPattern: onBlockPatternSelect
74
- })
75
- })]
76
- })
77
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
78
+ className: "block-library-query-pattern__selection-content",
79
+ children: [showSearch && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
80
+ className: "block-library-query-pattern__selection-search",
81
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.SearchControl, {
82
+ __nextHasNoMarginBottom: true,
83
+ onChange: setSearchValue,
84
+ value: searchValue,
85
+ label: (0, _i18n.__)('Search'),
86
+ placeholder: (0, _i18n.__)('Search')
87
+ })
88
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_blockEditor.BlockContextProvider, {
89
+ value: blockPreviewContext,
90
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_blockEditor.__experimentalBlockPatternsList, {
91
+ blockPatterns: filteredBlockPatterns,
92
+ onClickPattern: onBlockPatternSelect,
93
+ showTitlesAsTooltip: showTitlesAsTooltip
94
+ })
95
+ })]
77
96
  });
78
97
  }
79
- //# sourceMappingURL=pattern-selection-modal.js.map
98
+ //# sourceMappingURL=pattern-selection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_element","require","_data","_components","_blockEditor","_i18n","_utils","_searchPatterns","_jsxRuntime","PatternSelectionModal","clientId","attributes","setIsPatternSelectionModalOpen","jsx","Modal","overlayClassName","title","__","onRequestClose","isFullScreen","children","PatternSelection","useBlockPatterns","blockNameForPatterns","useBlockNameForPatterns","usePatterns","showTitlesAsTooltip","showSearch","searchValue","setSearchValue","useState","replaceBlock","selectBlock","useDispatch","blockEditorStore","blockPatterns","blockPreviewContext","useMemo","previewPostType","query","postType","filteredBlockPatterns","searchPatterns","onBlockPatternSelect","pattern","blocks","newBlocks","queryClientIds","getTransformedBlocksFromPattern","jsxs","className","SearchControl","__nextHasNoMarginBottom","onChange","value","label","placeholder","BlockContextProvider","__experimentalBlockPatternsList","onClickPattern"],"sources":["@wordpress/block-library/src/query/edit/pattern-selection.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useState, useMemo } from '@wordpress/element';\nimport { useDispatch } from '@wordpress/data';\nimport { Modal, SearchControl } from '@wordpress/components';\nimport {\n\tBlockContextProvider,\n\tstore as blockEditorStore,\n\t__experimentalBlockPatternsList as BlockPatternsList,\n} from '@wordpress/block-editor';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport {\n\tuseBlockNameForPatterns,\n\tgetTransformedBlocksFromPattern,\n\tusePatterns,\n} from '../utils';\nimport { searchPatterns } from '../../utils/search-patterns';\n\nexport function PatternSelectionModal( {\n\tclientId,\n\tattributes,\n\tsetIsPatternSelectionModalOpen,\n} ) {\n\treturn (\n\t\t<Modal\n\t\t\toverlayClassName=\"block-library-query-pattern__selection-modal\"\n\t\t\ttitle={ __( 'Choose a pattern' ) }\n\t\t\tonRequestClose={ () => setIsPatternSelectionModalOpen( false ) }\n\t\t\tisFullScreen\n\t\t>\n\t\t\t<PatternSelection clientId={ clientId } attributes={ attributes } />\n\t\t</Modal>\n\t);\n}\n\nexport function useBlockPatterns( clientId, attributes ) {\n\tconst blockNameForPatterns = useBlockNameForPatterns(\n\t\tclientId,\n\t\tattributes\n\t);\n\treturn usePatterns( clientId, blockNameForPatterns );\n}\n\nexport default function PatternSelection( {\n\tclientId,\n\tattributes,\n\tshowTitlesAsTooltip = false,\n\tshowSearch = true,\n} ) {\n\tconst [ searchValue, setSearchValue ] = useState( '' );\n\tconst { replaceBlock, selectBlock } = useDispatch( blockEditorStore );\n\tconst blockPatterns = useBlockPatterns( clientId, attributes );\n\t/*\n\t * When we preview Query Loop blocks we should prefer the current\n\t * block's postType, which is passed through block context.\n\t */\n\tconst blockPreviewContext = useMemo(\n\t\t() => ( {\n\t\t\tpreviewPostType: attributes.query.postType,\n\t\t} ),\n\t\t[ attributes.query.postType ]\n\t);\n\tconst filteredBlockPatterns = useMemo( () => {\n\t\treturn searchPatterns( blockPatterns, searchValue );\n\t}, [ blockPatterns, searchValue ] );\n\n\tconst onBlockPatternSelect = ( pattern, blocks ) => {\n\t\tconst { newBlocks, queryClientIds } = getTransformedBlocksFromPattern(\n\t\t\tblocks,\n\t\t\tattributes\n\t\t);\n\t\treplaceBlock( clientId, newBlocks );\n\t\tif ( queryClientIds[ 0 ] ) {\n\t\t\tselectBlock( queryClientIds[ 0 ] );\n\t\t}\n\t};\n\treturn (\n\t\t<div className=\"block-library-query-pattern__selection-content\">\n\t\t\t{ showSearch && (\n\t\t\t\t<div className=\"block-library-query-pattern__selection-search\">\n\t\t\t\t\t<SearchControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tonChange={ setSearchValue }\n\t\t\t\t\t\tvalue={ searchValue }\n\t\t\t\t\t\tlabel={ __( 'Search' ) }\n\t\t\t\t\t\tplaceholder={ __( 'Search' ) }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t<BlockContextProvider value={ blockPreviewContext }>\n\t\t\t\t<BlockPatternsList\n\t\t\t\t\tblockPatterns={ filteredBlockPatterns }\n\t\t\t\t\tonClickPattern={ onBlockPatternSelect }\n\t\t\t\t\tshowTitlesAsTooltip={ showTitlesAsTooltip }\n\t\t\t\t/>\n\t\t\t</BlockContextProvider>\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA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GAAA,EAACT,YAAA,CAAAsD,+BAAiB;QACjBvB,aAAa,EAAGM,qBAAuB;QACvCkB,cAAc,EAAGhB,oBAAsB;QACvCjB,mBAAmB,EAAGA;MAAqB,CAC3C;IAAC,CACmB,CAAC;EAAA,CACnB,CAAC;AAER","ignoreList":[]}
@@ -13,10 +13,10 @@ var _components = require("@wordpress/components");
13
13
  var _i18n = require("@wordpress/i18n");
14
14
  var _coreData = require("@wordpress/core-data");
15
15
  var _enhancedPaginationControl = _interopRequireDefault(require("./inspector-controls/enhanced-pagination-control"));
16
- var _queryToolbar = _interopRequireDefault(require("./query-toolbar"));
17
16
  var _inspectorControls = _interopRequireDefault(require("./inspector-controls"));
18
17
  var _enhancedPaginationModal = _interopRequireDefault(require("./enhanced-pagination-modal"));
19
18
  var _utils = require("../utils");
19
+ var _queryToolbar = _interopRequireDefault(require("./query-toolbar"));
20
20
  var _jsxRuntime = require("react/jsx-runtime");
21
21
  /**
22
22
  * WordPress dependencies
@@ -31,10 +31,9 @@ const TEMPLATE = [['core/post-template']];
31
31
  function QueryContent({
32
32
  attributes,
33
33
  setAttributes,
34
- openPatternSelectionModal,
35
- name,
36
34
  clientId,
37
- context
35
+ context,
36
+ name
38
37
  }) {
39
38
  const {
40
39
  queryId,
@@ -146,6 +145,7 @@ function QueryContent({
146
145
  clientId: clientId
147
146
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_blockEditor.InspectorControls, {
148
147
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_inspectorControls.default, {
148
+ name: name,
149
149
  attributes: attributes,
150
150
  setQuery: updateQuery,
151
151
  setDisplayLayout: updateDisplayLayout,
@@ -155,11 +155,8 @@ function QueryContent({
155
155
  })
156
156
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_blockEditor.BlockControls, {
157
157
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_queryToolbar.default, {
158
- name: name,
159
- clientId: clientId,
160
158
  attributes: attributes,
161
- setQuery: updateQuery,
162
- openPatternSelectionModal: openPatternSelectionModal
159
+ clientId: clientId
163
160
  })
164
161
  }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_blockEditor.InspectorControls, {
165
162
  group: "advanced",
@@ -1 +1 @@
1
- {"version":3,"names":["_data","require","_compose","_element","_blockEditor","_components","_i18n","_coreData","_enhancedPaginationControl","_interopRequireDefault","_queryToolbar","_inspectorControls","_enhancedPaginationModal","_utils","_jsxRuntime","DEFAULTS_POSTS_PER_PAGE","TEMPLATE","QueryContent","attributes","setAttributes","openPatternSelectionModal","name","clientId","context","queryId","query","displayLayout","enhancedPagination","tagName","TagName","inherit","templateSlug","isSingular","getQueryContextFromTemplate","__unstableMarkNextChangeAsNotPersistent","useDispatch","blockEditorStore","instanceId","useInstanceId","blockProps","useBlockProps","innerBlocksProps","useInnerBlocksProps","template","postsPerPage","useSelect","select","getSettings","getEntityRecord","getEntityRecordEdits","canUser","coreStore","settingPerPage","kind","posts_per_page","editedSettingPerPage","updateQuery","useCallback","newQuery","useEffect","perPage","Object","keys","length","Number","isFinite","updateDisplayLayout","newDisplayLayout","htmlElementMessages","main","__","section","aside","jsxs","Fragment","children","jsx","default","InspectorControls","setQuery","setDisplayLayout","BlockControls","group","SelectControl","__nextHasNoMarginBottom","__next40pxDefaultSize","label","options","value","onChange","help"],"sources":["@wordpress/block-library/src/query/edit/query-content.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useInstanceId } from '@wordpress/compose';\nimport { useEffect, useCallback } from '@wordpress/element';\nimport {\n\tBlockControls,\n\tInspectorControls,\n\tuseBlockProps,\n\tstore as blockEditorStore,\n\tuseInnerBlocksProps,\n} from '@wordpress/block-editor';\nimport { SelectControl } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport EnhancedPaginationControl from './inspector-controls/enhanced-pagination-control';\nimport QueryToolbar from './query-toolbar';\nimport QueryInspectorControls from './inspector-controls';\nimport EnhancedPaginationModal from './enhanced-pagination-modal';\nimport { getQueryContextFromTemplate } from '../utils';\n\nconst DEFAULTS_POSTS_PER_PAGE = 3;\n\nconst TEMPLATE = [ [ 'core/post-template' ] ];\nexport default function QueryContent( {\n\tattributes,\n\tsetAttributes,\n\topenPatternSelectionModal,\n\tname,\n\tclientId,\n\tcontext,\n} ) {\n\tconst {\n\t\tqueryId,\n\t\tquery,\n\t\tdisplayLayout,\n\t\tenhancedPagination,\n\t\ttagName: TagName = 'div',\n\t\tquery: { inherit } = {},\n\t} = attributes;\n\tconst { templateSlug } = context;\n\tconst { isSingular } = getQueryContextFromTemplate( templateSlug );\n\tconst { __unstableMarkNextChangeAsNotPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\tconst instanceId = useInstanceId( QueryContent );\n\tconst blockProps = useBlockProps();\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\ttemplate: TEMPLATE,\n\t} );\n\tconst { postsPerPage } = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\tconst { getEntityRecord, getEntityRecordEdits, canUser } =\n\t\t\tselect( coreStore );\n\t\tconst settingPerPage = canUser( 'read', {\n\t\t\tkind: 'root',\n\t\t\tname: 'site',\n\t\t} )\n\t\t\t? +getEntityRecord( 'root', 'site' )?.posts_per_page\n\t\t\t: +getSettings().postsPerPage;\n\n\t\t// Gets changes made via the template area posts per page setting. These won't be saved\n\t\t// until the page is saved, but we should reflect this setting within the query loops\n\t\t// that inherit it.\n\t\tconst editedSettingPerPage = +getEntityRecordEdits( 'root', 'site' )\n\t\t\t?.posts_per_page;\n\n\t\treturn {\n\t\t\tpostsPerPage:\n\t\t\t\teditedSettingPerPage ||\n\t\t\t\tsettingPerPage ||\n\t\t\t\tDEFAULTS_POSTS_PER_PAGE,\n\t\t};\n\t}, [] );\n\t// There are some effects running where some initialization logic is\n\t// happening and setting some values to some attributes (ex. queryId).\n\t// These updates can cause an `undo trap` where undoing will result in\n\t// resetting again, so we need to mark these changes as not persistent\n\t// with `__unstableMarkNextChangeAsNotPersistent`.\n\n\t// Changes in query property (which is an object) need to be in the same callback,\n\t// because updates are batched after the render and changes in different query properties\n\t// would cause to override previous wanted changes.\n\tconst updateQuery = useCallback(\n\t\t( newQuery ) => setAttributes( { query: { ...query, ...newQuery } } ),\n\t\t[ query, setAttributes ]\n\t);\n\tuseEffect( () => {\n\t\tconst newQuery = {};\n\t\t// When we inherit from global query always need to set the `perPage`\n\t\t// based on the reading settings.\n\t\tif ( inherit && query.perPage !== postsPerPage ) {\n\t\t\tnewQuery.perPage = postsPerPage;\n\t\t} else if ( ! query.perPage && postsPerPage ) {\n\t\t\tnewQuery.perPage = postsPerPage;\n\t\t}\n\t\t// We need to reset the `inherit` value if in a singular template, as queries\n\t\t// are not inherited when in singular content (e.g. post, page, 404, blank).\n\t\tif ( isSingular && query.inherit ) {\n\t\t\tnewQuery.inherit = false;\n\t\t}\n\t\tif ( !! Object.keys( newQuery ).length ) {\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\tupdateQuery( newQuery );\n\t\t}\n\t}, [\n\t\tquery.perPage,\n\t\tquery.inherit,\n\t\tpostsPerPage,\n\t\tinherit,\n\t\tisSingular,\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t\tupdateQuery,\n\t] );\n\t// We need this for multi-query block pagination.\n\t// Query parameters for each block are scoped to their ID.\n\tuseEffect( () => {\n\t\tif ( ! Number.isFinite( queryId ) ) {\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\tsetAttributes( { queryId: instanceId } );\n\t\t}\n\t}, [\n\t\tqueryId,\n\t\tinstanceId,\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t\tsetAttributes,\n\t] );\n\tconst updateDisplayLayout = ( newDisplayLayout ) =>\n\t\tsetAttributes( {\n\t\t\tdisplayLayout: { ...displayLayout, ...newDisplayLayout },\n\t\t} );\n\tconst htmlElementMessages = {\n\t\tmain: __(\n\t\t\t'The <main> element should be used for the primary content of your document only.'\n\t\t),\n\t\tsection: __(\n\t\t\t\"The <section> element should represent a standalone portion of the document that can't be better represented by another element.\"\n\t\t),\n\t\taside: __(\n\t\t\t\"The <aside> element should represent a portion of a document whose content is only indirectly related to the document's main content.\"\n\t\t),\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<EnhancedPaginationModal\n\t\t\t\tattributes={ attributes }\n\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\tclientId={ clientId }\n\t\t\t/>\n\t\t\t<InspectorControls>\n\t\t\t\t<QueryInspectorControls\n\t\t\t\t\tattributes={ attributes }\n\t\t\t\t\tsetQuery={ updateQuery }\n\t\t\t\t\tsetDisplayLayout={ updateDisplayLayout }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\tisSingular={ isSingular }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t\t<BlockControls>\n\t\t\t\t<QueryToolbar\n\t\t\t\t\tname={ name }\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\tattributes={ attributes }\n\t\t\t\t\tsetQuery={ updateQuery }\n\t\t\t\t\topenPatternSelectionModal={ openPatternSelectionModal }\n\t\t\t\t/>\n\t\t\t</BlockControls>\n\t\t\t<InspectorControls group=\"advanced\">\n\t\t\t\t<SelectControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tlabel={ __( 'HTML element' ) }\n\t\t\t\t\toptions={ [\n\t\t\t\t\t\t{ label: __( 'Default (<div>)' ), value: 'div' },\n\t\t\t\t\t\t{ label: '<main>', value: 'main' },\n\t\t\t\t\t\t{ label: '<section>', value: 'section' },\n\t\t\t\t\t\t{ label: '<aside>', value: 'aside' },\n\t\t\t\t\t] }\n\t\t\t\t\tvalue={ TagName }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { tagName: value } )\n\t\t\t\t\t}\n\t\t\t\t\thelp={ htmlElementMessages[ TagName ] }\n\t\t\t\t/>\n\t\t\t\t<EnhancedPaginationControl\n\t\t\t\t\tenhancedPagination={ enhancedPagination }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t\t<TagName { ...innerBlocksProps } />\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AAOA,IAAAI,WAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AAKA,IAAAO,0BAAA,GAAAC,sBAAA,CAAAR,OAAA;AACA,IAAAS,aAAA,GAAAD,sBAAA,CAAAR,OAAA;AACA,IAAAU,kBAAA,GAAAF,sBAAA,CAAAR,OAAA;AACA,IAAAW,wBAAA,GAAAH,sBAAA,CAAAR,OAAA;AACA,IAAAY,MAAA,GAAAZ,OAAA;AAAuD,IAAAa,WAAA,GAAAb,OAAA;AAxBvD;AACA;AACA;;AAeA;AACA;AACA;;AAOA,MAAMc,uBAAuB,GAAG,CAAC;AAEjC,MAAMC,QAAQ,GAAG,CAAE,CAAE,oBAAoB,CAAE,CAAE;AAC9B,SAASC,YAAYA,CAAE;EACrCC,UAAU;EACVC,aAAa;EACbC,yBAAyB;EACzBC,IAAI;EACJC,QAAQ;EACRC;AACD,CAAC,EAAG;EACH,MAAM;IACLC,OAAO;IACPC,KAAK;IACLC,aAAa;IACbC,kBAAkB;IAClBC,OAAO,EAAEC,OAAO,GAAG,KAAK;IACxBJ,KAAK,EAAE;MAAEK;IAAQ,CAAC,GAAG,CAAC;EACvB,CAAC,GAAGZ,UAAU;EACd,MAAM;IAAEa;EAAa,CAAC,GAAGR,OAAO;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AAO,EAAG,CACT;UAAED,KAAK,EAAE,IAAAhB,QAAE,EAAE,iBAAkB,CAAC;UAAEkB,KAAK,EAAE;QAAM,CAAC,EAChD;UAAEF,KAAK,EAAE,QAAQ;UAAEE,KAAK,EAAE;QAAO,CAAC,EAClC;UAAEF,KAAK,EAAE,WAAW;UAAEE,KAAK,EAAE;QAAU,CAAC,EACxC;UAAEF,KAAK,EAAE,SAAS;UAAEE,KAAK,EAAE;QAAQ,CAAC,CAClC;QACHA,KAAK,EAAG3D,OAAS;QACjB4D,QAAQ,EAAKD,KAAK,IACjBrE,aAAa,CAAE;UAAES,OAAO,EAAE4D;QAAM,CAAE,CAClC;QACDE,IAAI,EAAGtB,mBAAmB,CAAEvC,OAAO;MAAI,CACvC,CAAC,eACF,IAAAf,WAAA,CAAA8D,GAAA,EAACpE,0BAAA,CAAAqE,OAAyB;QACzBlD,kBAAkB,EAAGA,kBAAoB;QACzCR,aAAa,EAAGA,aAAe;QAC/BG,QAAQ,EAAGA;MAAU,CACrB,CAAC;IAAA,CACgB,CAAC,eACpB,IAAAR,WAAA,CAAA8D,GAAA,EAAC/C,OAAO;MAAA,GAAMY;IAAgB,CAAI,CAAC;EAAA,CAClC,CAAC;AAEL","ignoreList":[]}
1
+ {"version":3,"names":["_data","require","_compose","_element","_blockEditor","_components","_i18n","_coreData","_enhancedPaginationControl","_interopRequireDefault","_inspectorControls","_enhancedPaginationModal","_utils","_queryToolbar","_jsxRuntime","DEFAULTS_POSTS_PER_PAGE","TEMPLATE","QueryContent","attributes","setAttributes","clientId","context","name","queryId","query","displayLayout","enhancedPagination","tagName","TagName","inherit","templateSlug","isSingular","getQueryContextFromTemplate","__unstableMarkNextChangeAsNotPersistent","useDispatch","blockEditorStore","instanceId","useInstanceId","blockProps","useBlockProps","innerBlocksProps","useInnerBlocksProps","template","postsPerPage","useSelect","select","getSettings","getEntityRecord","getEntityRecordEdits","canUser","coreStore","settingPerPage","kind","posts_per_page","editedSettingPerPage","updateQuery","useCallback","newQuery","useEffect","perPage","Object","keys","length","Number","isFinite","updateDisplayLayout","newDisplayLayout","htmlElementMessages","main","__","section","aside","jsxs","Fragment","children","jsx","default","InspectorControls","setQuery","setDisplayLayout","BlockControls","group","SelectControl","__nextHasNoMarginBottom","__next40pxDefaultSize","label","options","value","onChange","help"],"sources":["@wordpress/block-library/src/query/edit/query-content.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useInstanceId } from '@wordpress/compose';\nimport { useEffect, useCallback } from '@wordpress/element';\nimport {\n\tBlockControls,\n\tInspectorControls,\n\tuseBlockProps,\n\tstore as blockEditorStore,\n\tuseInnerBlocksProps,\n} from '@wordpress/block-editor';\nimport { SelectControl } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport EnhancedPaginationControl from './inspector-controls/enhanced-pagination-control';\nimport QueryInspectorControls from './inspector-controls';\nimport EnhancedPaginationModal from './enhanced-pagination-modal';\nimport { getQueryContextFromTemplate } from '../utils';\nimport QueryToolbar from './query-toolbar';\n\nconst DEFAULTS_POSTS_PER_PAGE = 3;\n\nconst TEMPLATE = [ [ 'core/post-template' ] ];\nexport default function QueryContent( {\n\tattributes,\n\tsetAttributes,\n\tclientId,\n\tcontext,\n\tname,\n} ) {\n\tconst {\n\t\tqueryId,\n\t\tquery,\n\t\tdisplayLayout,\n\t\tenhancedPagination,\n\t\ttagName: TagName = 'div',\n\t\tquery: { inherit } = {},\n\t} = attributes;\n\tconst { templateSlug } = context;\n\tconst { isSingular } = getQueryContextFromTemplate( templateSlug );\n\tconst { __unstableMarkNextChangeAsNotPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\tconst instanceId = useInstanceId( QueryContent );\n\tconst blockProps = useBlockProps();\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\ttemplate: TEMPLATE,\n\t} );\n\tconst { postsPerPage } = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\tconst { getEntityRecord, getEntityRecordEdits, canUser } =\n\t\t\tselect( coreStore );\n\t\tconst settingPerPage = canUser( 'read', {\n\t\t\tkind: 'root',\n\t\t\tname: 'site',\n\t\t} )\n\t\t\t? +getEntityRecord( 'root', 'site' )?.posts_per_page\n\t\t\t: +getSettings().postsPerPage;\n\n\t\t// Gets changes made via the template area posts per page setting. These won't be saved\n\t\t// until the page is saved, but we should reflect this setting within the query loops\n\t\t// that inherit it.\n\t\tconst editedSettingPerPage = +getEntityRecordEdits( 'root', 'site' )\n\t\t\t?.posts_per_page;\n\n\t\treturn {\n\t\t\tpostsPerPage:\n\t\t\t\teditedSettingPerPage ||\n\t\t\t\tsettingPerPage ||\n\t\t\t\tDEFAULTS_POSTS_PER_PAGE,\n\t\t};\n\t}, [] );\n\t// There are some effects running where some initialization logic is\n\t// happening and setting some values to some attributes (ex. queryId).\n\t// These updates can cause an `undo trap` where undoing will result in\n\t// resetting again, so we need to mark these changes as not persistent\n\t// with `__unstableMarkNextChangeAsNotPersistent`.\n\n\t// Changes in query property (which is an object) need to be in the same callback,\n\t// because updates are batched after the render and changes in different query properties\n\t// would cause to override previous wanted changes.\n\tconst updateQuery = useCallback(\n\t\t( newQuery ) => setAttributes( { query: { ...query, ...newQuery } } ),\n\t\t[ query, setAttributes ]\n\t);\n\tuseEffect( () => {\n\t\tconst newQuery = {};\n\t\t// When we inherit from global query always need to set the `perPage`\n\t\t// based on the reading settings.\n\t\tif ( inherit && query.perPage !== postsPerPage ) {\n\t\t\tnewQuery.perPage = postsPerPage;\n\t\t} else if ( ! query.perPage && postsPerPage ) {\n\t\t\tnewQuery.perPage = postsPerPage;\n\t\t}\n\t\t// We need to reset the `inherit` value if in a singular template, as queries\n\t\t// are not inherited when in singular content (e.g. post, page, 404, blank).\n\t\tif ( isSingular && query.inherit ) {\n\t\t\tnewQuery.inherit = false;\n\t\t}\n\t\tif ( !! Object.keys( newQuery ).length ) {\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\tupdateQuery( newQuery );\n\t\t}\n\t}, [\n\t\tquery.perPage,\n\t\tquery.inherit,\n\t\tpostsPerPage,\n\t\tinherit,\n\t\tisSingular,\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t\tupdateQuery,\n\t] );\n\t// We need this for multi-query block pagination.\n\t// Query parameters for each block are scoped to their ID.\n\tuseEffect( () => {\n\t\tif ( ! Number.isFinite( queryId ) ) {\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\tsetAttributes( { queryId: instanceId } );\n\t\t}\n\t}, [\n\t\tqueryId,\n\t\tinstanceId,\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t\tsetAttributes,\n\t] );\n\tconst updateDisplayLayout = ( newDisplayLayout ) =>\n\t\tsetAttributes( {\n\t\t\tdisplayLayout: { ...displayLayout, ...newDisplayLayout },\n\t\t} );\n\tconst htmlElementMessages = {\n\t\tmain: __(\n\t\t\t'The <main> element should be used for the primary content of your document only.'\n\t\t),\n\t\tsection: __(\n\t\t\t\"The <section> element should represent a standalone portion of the document that can't be better represented by another element.\"\n\t\t),\n\t\taside: __(\n\t\t\t\"The <aside> element should represent a portion of a document whose content is only indirectly related to the document's main content.\"\n\t\t),\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<EnhancedPaginationModal\n\t\t\t\tattributes={ attributes }\n\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\tclientId={ clientId }\n\t\t\t/>\n\t\t\t<InspectorControls>\n\t\t\t\t<QueryInspectorControls\n\t\t\t\t\tname={ name }\n\t\t\t\t\tattributes={ attributes }\n\t\t\t\t\tsetQuery={ updateQuery }\n\t\t\t\t\tsetDisplayLayout={ updateDisplayLayout }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\tisSingular={ isSingular }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t\t<BlockControls>\n\t\t\t\t<QueryToolbar attributes={ attributes } clientId={ clientId } />\n\t\t\t</BlockControls>\n\t\t\t<InspectorControls group=\"advanced\">\n\t\t\t\t<SelectControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tlabel={ __( 'HTML element' ) }\n\t\t\t\t\toptions={ [\n\t\t\t\t\t\t{ label: __( 'Default (<div>)' ), value: 'div' },\n\t\t\t\t\t\t{ label: '<main>', value: 'main' },\n\t\t\t\t\t\t{ label: '<section>', value: 'section' },\n\t\t\t\t\t\t{ label: '<aside>', value: 'aside' },\n\t\t\t\t\t] }\n\t\t\t\t\tvalue={ TagName }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { tagName: value } )\n\t\t\t\t\t}\n\t\t\t\t\thelp={ htmlElementMessages[ TagName ] }\n\t\t\t\t/>\n\t\t\t\t<EnhancedPaginationControl\n\t\t\t\t\tenhancedPagination={ enhancedPagination }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t\t<TagName { ...innerBlocksProps } />\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AAOA,IAAAI,WAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AAKA,IAAAO,0BAAA,GAAAC,sBAAA,CAAAR,OAAA;AACA,IAAAS,kBAAA,GAAAD,sBAAA,CAAAR,OAAA;AACA,IAAAU,wBAAA,GAAAF,sBAAA,CAAAR,OAAA;AACA,IAAAW,MAAA,GAAAX,OAAA;AACA,IAAAY,aAAA,GAAAJ,sBAAA,CAAAR,OAAA;AAA2C,IAAAa,WAAA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  var _components = require("@wordpress/components");
12
12
  var _i18n = require("@wordpress/i18n");
13
13
  var _utils = require("../utils");
14
+ var _patternSelection = require("./pattern-selection");
14
15
  var _jsxRuntime = require("react/jsx-runtime");
15
16
  /**
16
17
  * WordPress dependencies
@@ -28,27 +29,20 @@ function QueryPlaceholder({
28
29
  }) {
29
30
  const [isStartingBlank, setIsStartingBlank] = (0, _element.useState)(false);
30
31
  const blockProps = (0, _blockEditor.useBlockProps)();
31
- const blockNameForPatterns = (0, _utils.useBlockNameForPatterns)(clientId, attributes);
32
32
  const {
33
33
  blockType,
34
- activeBlockVariation,
35
- hasPatterns
34
+ activeBlockVariation
36
35
  } = (0, _data.useSelect)(select => {
37
36
  const {
38
37
  getActiveBlockVariation,
39
38
  getBlockType
40
39
  } = select(_blocks.store);
41
- const {
42
- getBlockRootClientId,
43
- getPatternsByBlockTypes
44
- } = select(_blockEditor.store);
45
- const rootClientId = getBlockRootClientId(clientId);
46
40
  return {
47
41
  blockType: getBlockType(name),
48
- activeBlockVariation: getActiveBlockVariation(name, attributes),
49
- hasPatterns: !!getPatternsByBlockTypes(blockNameForPatterns, rootClientId).length
42
+ activeBlockVariation: getActiveBlockVariation(name, attributes)
50
43
  };
51
- }, [name, blockNameForPatterns, clientId, attributes]);
44
+ }, [name, attributes]);
45
+ const hasPatterns = !!(0, _patternSelection.useBlockPatterns)(clientId, attributes).length;
52
46
  const icon = activeBlockVariation?.icon?.src || activeBlockVariation?.icon || blockType?.icon?.src;
53
47
  const label = activeBlockVariation?.title || blockType?.title;
54
48
  if (isStartingBlank) {
@@ -1 +1 @@
1
- {"version":3,"names":["_data","require","_blocks","_element","_blockEditor","_components","_i18n","_utils","_jsxRuntime","QueryPlaceholder","attributes","clientId","name","openPatternSelectionModal","isStartingBlank","setIsStartingBlank","useState","blockProps","useBlockProps","blockNameForPatterns","useBlockNameForPatterns","blockType","activeBlockVariation","hasPatterns","useSelect","select","getActiveBlockVariation","getBlockType","blocksStore","getBlockRootClientId","getPatternsByBlockTypes","blockEditorStore","rootClientId","length","icon","src","label","title","jsx","QueryVariationPicker","children","jsxs","Placeholder","instructions","__","Button","__next40pxDefaultSize","variant","onClick","scopeVariations","useScopedBlockVariations","replaceInnerBlocks","useDispatch","__experimentalBlockVariationPicker","variations","onSelect","variation","innerBlocks","createBlocksFromInnerBlocksTemplate"],"sources":["@wordpress/block-library/src/query/edit/query-placeholder.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tcreateBlocksFromInnerBlocksTemplate,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\nimport { useState } from '@wordpress/element';\nimport {\n\tuseBlockProps,\n\tstore as blockEditorStore,\n\t__experimentalBlockVariationPicker,\n} from '@wordpress/block-editor';\nimport { Button, Placeholder } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { useScopedBlockVariations, useBlockNameForPatterns } from '../utils';\n\nexport default function QueryPlaceholder( {\n\tattributes,\n\tclientId,\n\tname,\n\topenPatternSelectionModal,\n} ) {\n\tconst [ isStartingBlank, setIsStartingBlank ] = useState( false );\n\tconst blockProps = useBlockProps();\n\tconst blockNameForPatterns = useBlockNameForPatterns(\n\t\tclientId,\n\t\tattributes\n\t);\n\tconst { blockType, activeBlockVariation, hasPatterns } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getActiveBlockVariation, getBlockType } =\n\t\t\t\tselect( blocksStore );\n\t\t\tconst { getBlockRootClientId, getPatternsByBlockTypes } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst rootClientId = getBlockRootClientId( clientId );\n\t\t\treturn {\n\t\t\t\tblockType: getBlockType( name ),\n\t\t\t\tactiveBlockVariation: getActiveBlockVariation(\n\t\t\t\t\tname,\n\t\t\t\t\tattributes\n\t\t\t\t),\n\t\t\t\thasPatterns: !! getPatternsByBlockTypes(\n\t\t\t\t\tblockNameForPatterns,\n\t\t\t\t\trootClientId\n\t\t\t\t).length,\n\t\t\t};\n\t\t},\n\t\t[ name, blockNameForPatterns, clientId, attributes ]\n\t);\n\tconst icon =\n\t\tactiveBlockVariation?.icon?.src ||\n\t\tactiveBlockVariation?.icon ||\n\t\tblockType?.icon?.src;\n\tconst label = activeBlockVariation?.title || blockType?.title;\n\tif ( isStartingBlank ) {\n\t\treturn (\n\t\t\t<QueryVariationPicker\n\t\t\t\tclientId={ clientId }\n\t\t\t\tattributes={ attributes }\n\t\t\t\ticon={ icon }\n\t\t\t\tlabel={ label }\n\t\t\t/>\n\t\t);\n\t}\n\treturn (\n\t\t<div { ...blockProps }>\n\t\t\t<Placeholder\n\t\t\t\ticon={ icon }\n\t\t\t\tlabel={ label }\n\t\t\t\tinstructions={ __(\n\t\t\t\t\t'Choose a pattern for the query loop or start blank.'\n\t\t\t\t) }\n\t\t\t>\n\t\t\t\t{ !! hasPatterns && (\n\t\t\t\t\t<Button\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\tonClick={ openPatternSelectionModal }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Choose' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t) }\n\n\t\t\t\t<Button\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\tsetIsStartingBlank( true );\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Start blank' ) }\n\t\t\t\t</Button>\n\t\t\t</Placeholder>\n\t\t</div>\n\t);\n}\n\nfunction QueryVariationPicker( { clientId, attributes, icon, label } ) {\n\tconst scopeVariations = useScopedBlockVariations( attributes );\n\tconst { replaceInnerBlocks } = useDispatch( blockEditorStore );\n\tconst blockProps = useBlockProps();\n\treturn (\n\t\t<div { ...blockProps }>\n\t\t\t<__experimentalBlockVariationPicker\n\t\t\t\ticon={ icon }\n\t\t\t\tlabel={ label }\n\t\t\t\tvariations={ scopeVariations }\n\t\t\t\tonSelect={ ( variation ) => {\n\t\t\t\t\tif ( variation.innerBlocks ) {\n\t\t\t\t\t\treplaceInnerBlocks(\n\t\t\t\t\t\t\tclientId,\n\t\t\t\t\t\t\tcreateBlocksFromInnerBlocksTemplate(\n\t\t\t\t\t\t\t\tvariation.innerBlocks\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tfalse\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t} }\n\t\t\t/>\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAIA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AAKA,IAAAI,WAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AAKA,IAAAM,MAAA,GAAAN,OAAA;AAA6E,IAAAO,WAAA,GAAAP,OAAA;AApB7E;AACA;AACA;;AAeA;AACA;AACA;;AAGe,SAASQ,gBAAgBA,CAAE;EACzCC,UAAU;EACVC,QAAQ;EACRC,IAAI;EACJC;AACD,CAAC,EAAG;EACH,MAAM,CAAEC,eAAe,EAAEC,kBAAkB,CAAE,GAAG,IAAAC,iBAAQ,EAAE,KAAM,CAAC;EACjE,MAAMC,UAAU,GAAG,IAAAC,0BAAa,EAAC,CAAC;EAClC,MAAMC,oBAAoB,GAAG,IAAAC,8BAAuB,EACnDT,QAAQ,EACRD,UACD,CAAC;EACD,MAAM;IAAEW,SAAS;IAAEC,oBAAoB;IAAEC;EAAY,CAAC,GAAG,IAAAC,eAAS,EAC/DC,MAAM,IAAM;IACb,MAAM;MAAEC,uBAAuB;MAAEC;IAAa,CAAC,GAC9CF,MAAM,CAAEG,aAAY,CAAC;IACtB,MAAM;MAAEC,oBAAoB;MAAEC;IAAwB,CAAC,GACtDL,MAAM,CAAEM,kBAAiB,CAAC;IAC3B,MAAMC,YAAY,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AAA,CAAA8B,GAAA,EAACjC,WAAA,CAAAwC,MAAM;QACNC,qBAAqB;QACrBC,OAAO,EAAC,WAAW;QACnBC,OAAO,EAAGA,CAAA,KAAM;UACfjC,kBAAkB,CAAE,IAAK,CAAC;QAC3B,CAAG;QAAAyB,QAAA,EAED,IAAAI,QAAE,EAAE,aAAc;MAAC,CACd,CAAC;IAAA,CACG;EAAC,CACV,CAAC;AAER;AAEA,SAASL,oBAAoBA,CAAE;EAAE5B,QAAQ;EAAED,UAAU;EAAEwB,IAAI;EAAEE;AAAM,CAAC,EAAG;EACtE,MAAMa,eAAe,GAAG,IAAAC,+BAAwB,EAAExC,UAAW,CAAC;EAC9D,MAAM;IAAEyC;EAAmB,CAAC,GAAG,IAAAC,iBAAW,EAAErB,kBAAiB,CAAC;EAC9D,MAAMd,UAAU,GAAG,IAAAC,0BAAa,EAAC,CAAC;EAClC,oBACC,IAAAV,WAAA,CAAA8B,GAAA;IAAA,GAAUrB,UAAU;IAAAuB,QAAA,eACnB,IAAAhC,WAAA,CAAA8B,GAAA,EAAClC,YAAA,CAAAiD,kCAAkC;MAClCnB,IAAI,EAAGA,IAAM;MACbE,KAAK,EAAGA,KAAO;MACfkB,UAAU,EAAGL,eAAiB;MAC9BM,QAAQ,EAAKC,SAAS,IAAM;QAC3B,IAAKA,SAAS,CAACC,WAAW,EAAG;UAC5BN,kBAAkB,CACjBxC,QAAQ,EACR,IAAA+C,2CAAmC,EAClCF,SAAS,CAACC,WACX,CAAC,EACD,KACD,CAAC;QACF;MACD;IAAG,CACH;EAAC,CACE,CAAC;AAER","ignoreList":[]}
1
+ {"version":3,"names":["_data","require","_blocks","_element","_blockEditor","_components","_i18n","_utils","_patternSelection","_jsxRuntime","QueryPlaceholder","attributes","clientId","name","openPatternSelectionModal","isStartingBlank","setIsStartingBlank","useState","blockProps","useBlockProps","blockType","activeBlockVariation","useSelect","select","getActiveBlockVariation","getBlockType","blocksStore","hasPatterns","useBlockPatterns","length","icon","src","label","title","jsx","QueryVariationPicker","children","jsxs","Placeholder","instructions","__","Button","__next40pxDefaultSize","variant","onClick","scopeVariations","useScopedBlockVariations","replaceInnerBlocks","useDispatch","blockEditorStore","__experimentalBlockVariationPicker","variations","onSelect","variation","innerBlocks","createBlocksFromInnerBlocksTemplate"],"sources":["@wordpress/block-library/src/query/edit/query-placeholder.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tcreateBlocksFromInnerBlocksTemplate,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\nimport { useState } from '@wordpress/element';\nimport {\n\tuseBlockProps,\n\tstore as blockEditorStore,\n\t__experimentalBlockVariationPicker,\n} from '@wordpress/block-editor';\nimport { Button, Placeholder } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { useScopedBlockVariations } from '../utils';\nimport { useBlockPatterns } from './pattern-selection';\n\nexport default function QueryPlaceholder( {\n\tattributes,\n\tclientId,\n\tname,\n\topenPatternSelectionModal,\n} ) {\n\tconst [ isStartingBlank, setIsStartingBlank ] = useState( false );\n\tconst blockProps = useBlockProps();\n\tconst { blockType, activeBlockVariation } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getActiveBlockVariation, getBlockType } =\n\t\t\t\tselect( blocksStore );\n\t\t\treturn {\n\t\t\t\tblockType: getBlockType( name ),\n\t\t\t\tactiveBlockVariation: getActiveBlockVariation(\n\t\t\t\t\tname,\n\t\t\t\t\tattributes\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ name, attributes ]\n\t);\n\tconst hasPatterns = !! useBlockPatterns( clientId, attributes ).length;\n\tconst icon =\n\t\tactiveBlockVariation?.icon?.src ||\n\t\tactiveBlockVariation?.icon ||\n\t\tblockType?.icon?.src;\n\tconst label = activeBlockVariation?.title || blockType?.title;\n\tif ( isStartingBlank ) {\n\t\treturn (\n\t\t\t<QueryVariationPicker\n\t\t\t\tclientId={ clientId }\n\t\t\t\tattributes={ attributes }\n\t\t\t\ticon={ icon }\n\t\t\t\tlabel={ label }\n\t\t\t/>\n\t\t);\n\t}\n\treturn (\n\t\t<div { ...blockProps }>\n\t\t\t<Placeholder\n\t\t\t\ticon={ icon }\n\t\t\t\tlabel={ label }\n\t\t\t\tinstructions={ __(\n\t\t\t\t\t'Choose a pattern for the query loop or start blank.'\n\t\t\t\t) }\n\t\t\t>\n\t\t\t\t{ !! hasPatterns && (\n\t\t\t\t\t<Button\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\tonClick={ openPatternSelectionModal }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Choose' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t) }\n\n\t\t\t\t<Button\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\tsetIsStartingBlank( true );\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Start blank' ) }\n\t\t\t\t</Button>\n\t\t\t</Placeholder>\n\t\t</div>\n\t);\n}\n\nfunction QueryVariationPicker( { clientId, attributes, icon, label } ) {\n\tconst scopeVariations = useScopedBlockVariations( attributes );\n\tconst { replaceInnerBlocks } = useDispatch( blockEditorStore );\n\tconst blockProps = useBlockProps();\n\treturn (\n\t\t<div { ...blockProps }>\n\t\t\t<__experimentalBlockVariationPicker\n\t\t\t\ticon={ icon }\n\t\t\t\tlabel={ label }\n\t\t\t\tvariations={ scopeVariations }\n\t\t\t\tonSelect={ ( variation ) => {\n\t\t\t\t\tif ( variation.innerBlocks ) {\n\t\t\t\t\t\treplaceInnerBlocks(\n\t\t\t\t\t\t\tclientId,\n\t\t\t\t\t\t\tcreateBlocksFromInnerBlocksTemplate(\n\t\t\t\t\t\t\t\tvariation.innerBlocks\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tfalse\n\t\t\t\t\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AiB,CAAC;EAC9D,MAAM/B,UAAU,GAAG,IAAAC,0BAAa,EAAC,CAAC;EAClC,oBACC,IAAAV,WAAA,CAAAyB,GAAA;IAAA,GAAUhB,UAAU;IAAAkB,QAAA,eACnB,IAAA3B,WAAA,CAAAyB,GAAA,EAAC9B,YAAA,CAAA8C,kCAAkC;MAClCpB,IAAI,EAAGA,IAAM;MACbE,KAAK,EAAGA,KAAO;MACfmB,UAAU,EAAGN,eAAiB;MAC9BO,QAAQ,EAAKC,SAAS,IAAM;QAC3B,IAAKA,SAAS,CAACC,WAAW,EAAG;UAC5BP,kBAAkB,CACjBnC,QAAQ,EACR,IAAA2C,2CAAmC,EAClCF,SAAS,CAACC,WACX,CAAC,EACD,KACD,CAAC;QACF;MACD;IAAG,CACH;EAAC,CACE,CAAC;AAER","ignoreList":[]}
@@ -6,8 +6,10 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.default = QueryToolbar;
7
7
  var _components = require("@wordpress/components");
8
8
  var _i18n = require("@wordpress/i18n");
9
- var _utils = require("../utils");
9
+ var _patternSelection = _interopRequireWildcard(require("./pattern-selection"));
10
10
  var _jsxRuntime = require("react/jsx-runtime");
11
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
12
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
11
13
  /**
12
14
  * WordPress dependencies
13
15
  */
@@ -17,17 +19,35 @@ var _jsxRuntime = require("react/jsx-runtime");
17
19
  */
18
20
 
19
21
  function QueryToolbar({
20
- openPatternSelectionModal,
21
- name,
22
- clientId
22
+ clientId,
23
+ attributes
23
24
  }) {
24
- const hasPatterns = !!(0, _utils.usePatterns)(clientId, name).length;
25
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
26
- children: hasPatterns && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ToolbarGroup, {
27
- className: "wp-block-template-part__block-control-group",
28
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ToolbarButton, {
29
- onClick: openPatternSelectionModal,
30
- children: (0, _i18n.__)('Replace')
25
+ const hasPatterns = (0, _patternSelection.useBlockPatterns)(clientId, attributes).length;
26
+ if (!hasPatterns) {
27
+ return null;
28
+ }
29
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ToolbarGroup, {
30
+ className: "wp-block-template-part__block-control-group",
31
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalDropdownContentWrapper, {
32
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Dropdown, {
33
+ contentClassName: "block-editor-block-settings-menu__popover",
34
+ focusOnMount: "firstElement",
35
+ expandOnMobile: true,
36
+ renderToggle: ({
37
+ isOpen,
38
+ onToggle
39
+ }) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ToolbarButton, {
40
+ "aria-haspopup": "true",
41
+ "aria-expanded": isOpen,
42
+ onClick: onToggle,
43
+ children: (0, _i18n.__)('Change design')
44
+ }),
45
+ renderContent: () => /*#__PURE__*/(0, _jsxRuntime.jsx)(_patternSelection.default, {
46
+ clientId: clientId,
47
+ attributes: attributes,
48
+ showSearch: false,
49
+ showTitlesAsTooltip: true
50
+ })
31
51
  })
32
52
  })
33
53
  });
@@ -1 +1 @@
1
- {"version":3,"names":["_components","require","_i18n","_utils","_jsxRuntime","QueryToolbar","openPatternSelectionModal","name","clientId","hasPatterns","usePatterns","length","jsx","Fragment","children","ToolbarGroup","className","ToolbarButton","onClick","__"],"sources":["@wordpress/block-library/src/query/edit/query-toolbar.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { ToolbarGroup, ToolbarButton } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { usePatterns } from '../utils';\n\nexport default function QueryToolbar( {\n\topenPatternSelectionModal,\n\tname,\n\tclientId,\n} ) {\n\tconst hasPatterns = !! usePatterns( clientId, name ).length;\n\n\treturn (\n\t\t<>\n\t\t\t{ hasPatterns && (\n\t\t\t\t<ToolbarGroup className=\"wp-block-template-part__block-control-group\">\n\t\t\t\t\t<ToolbarButton onClick={ openPatternSelectionModal }>\n\t\t\t\t\t\t{ __( 'Replace' ) }\n\t\t\t\t\t</ToolbarButton>\n\t\t\t\t</ToolbarGroup>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAKA,IAAAE,MAAA,GAAAF,OAAA;AAAuC,IAAAG,WAAA,GAAAH,OAAA;AATvC;AACA;AACA;;AAIA;AACA;AACA;;AAGe,SAASI,YAAYA,CAAE;EACrCC,yBAAyB;EACzBC,IAAI;EACJC;AACD,CAAC,EAAG;EACH,MAAMC,WAAW,GAAG,CAAC,CAAE,IAAAC,kBAAW,EAAEF,QAAQ,EAAED,IAAK,CAAC,CAACI,MAAM;EAE3D,oBACC,IAAAP,WAAA,CAAAQ,GAAA,EAAAR,WAAA,CAAAS,QAAA;IAAAC,QAAA,EACGL,WAAW,iBACZ,IAAAL,WAAA,CAAAQ,GAAA,EAACZ,WAAA,CAAAe,YAAY;MAACC,SAAS,EAAC,6CAA6C;MAAAF,QAAA,eACpE,IAAAV,WAAA,CAAAQ,GAAA,EAACZ,WAAA,CAAAiB,aAAa;QAACC,OAAO,EAAGZ,yBAA2B;QAAAQ,QAAA,EACjD,IAAAK,QAAE,EAAE,SAAU;MAAC,CACH;IAAC,CACH;EACd,CACA,CAAC;AAEL","ignoreList":[]}
1
+ {"version":3,"names":["_components","require","_i18n","_patternSelection","_interopRequireWildcard","_jsxRuntime","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","QueryToolbar","clientId","attributes","hasPatterns","useBlockPatterns","length","jsx","ToolbarGroup","className","children","__experimentalDropdownContentWrapper","Dropdown","contentClassName","focusOnMount","expandOnMobile","renderToggle","isOpen","onToggle","ToolbarButton","onClick","__","renderContent","showSearch","showTitlesAsTooltip"],"sources":["@wordpress/block-library/src/query/edit/query-toolbar.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tToolbarGroup,\n\tToolbarButton,\n\tDropdown,\n\t__experimentalDropdownContentWrapper as DropdownContentWrapper,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport PatternSelection, { useBlockPatterns } from './pattern-selection';\n\nexport default function QueryToolbar( { clientId, attributes } ) {\n\tconst hasPatterns = useBlockPatterns( clientId, attributes ).length;\n\tif ( ! hasPatterns ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<ToolbarGroup className=\"wp-block-template-part__block-control-group\">\n\t\t\t<DropdownContentWrapper>\n\t\t\t\t<Dropdown\n\t\t\t\t\tcontentClassName=\"block-editor-block-settings-menu__popover\"\n\t\t\t\t\tfocusOnMount=\"firstElement\"\n\t\t\t\t\texpandOnMobile\n\t\t\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\t\taria-haspopup=\"true\"\n\t\t\t\t\t\t\taria-expanded={ isOpen }\n\t\t\t\t\t\t\tonClick={ onToggle }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Change design' ) }\n\t\t\t\t\t\t</ToolbarButton>\n\t\t\t\t\t) }\n\t\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AY;UACzBoB,UAAU,EAAG,KAAO;UACpBC,mBAAmB;QAAA,CACnB;MACC,CACH;IAAC,CACqB;EAAC,CACZ,CAAC;AAEjB","ignoreList":[]}
@@ -69,7 +69,8 @@ const v1 = {
69
69
  color: {
70
70
  background: customColor
71
71
  }
72
- } : undefined
72
+ } : undefined,
73
+ tagName: 'hr'
73
74
  };
74
75
  }
75
76
  };
@@ -1 +1 @@
1
- {"version":3,"names":["_clsx","_interopRequireDefault","require","_blockEditor","_jsxRuntime","v1","attributes","color","type","customColor","save","backgroundClass","getColorClassName","colorClass","className","clsx","style","backgroundColor","undefined","jsx","useBlockProps","migrate","restAttributes","opacity","background","_default","exports","default"],"sources":["@wordpress/block-library/src/separator/deprecated.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { getColorClassName, useBlockProps } from '@wordpress/block-editor';\n\nconst v1 = {\n\tattributes: {\n\t\tcolor: {\n\t\t\ttype: 'string',\n\t\t},\n\t\tcustomColor: {\n\t\t\ttype: 'string',\n\t\t},\n\t},\n\tsave( { attributes } ) {\n\t\tconst { color, customColor } = attributes;\n\n\t\t// the hr support changing color using border-color, since border-color\n\t\t// is not yet supported in the color palette, we use background-color\n\t\tconst backgroundClass = getColorClassName( 'background-color', color );\n\t\t// the dots styles uses text for the dots, to change those dots color is\n\t\t// using color, not backgroundColor\n\t\tconst colorClass = getColorClassName( 'color', color );\n\n\t\tconst className = clsx( {\n\t\t\t'has-text-color has-background': color || customColor,\n\t\t\t[ backgroundClass ]: backgroundClass,\n\t\t\t[ colorClass ]: colorClass,\n\t\t} );\n\n\t\tconst style = {\n\t\t\tbackgroundColor: backgroundClass ? undefined : customColor,\n\t\t\tcolor: colorClass ? undefined : customColor,\n\t\t};\n\n\t\treturn <hr { ...useBlockProps.save( { className, style } ) } />;\n\t},\n\tmigrate( attributes ) {\n\t\tconst { color, customColor, ...restAttributes } = attributes;\n\t\treturn {\n\t\t\t...restAttributes,\n\t\t\tbackgroundColor: color ? color : undefined,\n\t\t\topacity: 'css',\n\t\t\tstyle: customColor\n\t\t\t\t? { color: { background: customColor } }\n\t\t\t\t: undefined,\n\t\t};\n\t},\n};\n\nexport default [ v1 ];\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,YAAA,GAAAD,OAAA;AAA2E,IAAAE,WAAA,GAAAF,OAAA;AAR3E;AACA;AACA;;AAGA;AACA;AACA;;AAGA,MAAMG,EAAE,GAAG;EACVC,UAAU,EAAE;IACXC,KAAK,EAAE;MACNC,IAAI,EAAE;IACP,CAAC;IACDC,WAAW,EAAE;MACZD,IAAI,EAAE;IACP;EACD,CAAC;EACDE,IAAIA,CAAE;IAAEJ;EAAW,CAAC,EAAG;IACtB,MAAM;MAAEC,KAAK;MAAEE;IAAY,CAAC,GAAGH,UAAU;;IAEzC;IACA;IACA,MAAMK,eAAe,GAAG,IAAAC,8BAAiB,EAAE,kBAAkB,EAAEL,KAAM,CAAC;IACtE;IACA;IACA,MAAMM,UAAU,GAAG,IAAAD,8BAAiB,EAAE,OAAO,EAAEL,KAAM,CAAC;IAEtD,MAAMO,SAAS,GAAG,IAAAC,aAAI,EAAE;MACvB,+BAA+B,EAAER,KAAK,IAAIE,WAAW;MACrD,CAAEE,eAAe,GAAIA,eAAe;MACpC,CAAEE,UAAU,GAAIA;IACjB,CAAE,CAAC;IAEH,MAAMG,KAAK,GAAG;MACbC,eAAe,EAAEN,eAAe,GAAGO,SAAS,GAAGT,WAAW;MAC1DF,KAAK,EAAEM,UAAU,GAAGK,SAAS,GAAGT;IACjC,CAAC;IAED,oBAAO,IAAAL,WAAA,CAAAe,GAAA;MAAA,GAASC,0BAAa,CAACV,IAAI,CAAE;QAAEI,SAAS;QAAEE;MAAM,CAAE;IAAC,CAAI,CAAC;EAChE,CAAC;EACDK,OAAOA,CAAEf,UAAU,EAAG;IACrB,MAAM;MAAEC,KAAK;MAAEE,WAAW;MAAE,GAAGa;IAAe,CAAC,GAAGhB,UAAU;IAC5D,OAAO;MACN,GAAGgB,cAAc;MACjBL,eAAe,EAAEV,KAAK,GAAGA,KAAK,GAAGW,SAAS;MAC1CK,OAAO,EAAE,KAAK;MACdP,KAAK,EAAEP,WAAW,GACf;QAAEF,KAAK,EAAE;UAAEiB,UAAU,EAAEf;QAAY;MAAE,CAAC,GACtCS;IACJ,CAAC;EACF;AACD,CAAC;AAAC,IAAAO,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEa,CAAEtB,EAAE,CAAE","ignoreList":[]}
1
+ {"version":3,"names":["_clsx","_interopRequireDefault","require","_blockEditor","_jsxRuntime","v1","attributes","color","type","customColor","save","backgroundClass","getColorClassName","colorClass","className","clsx","style","backgroundColor","undefined","jsx","useBlockProps","migrate","restAttributes","opacity","background","tagName","_default","exports","default"],"sources":["@wordpress/block-library/src/separator/deprecated.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { getColorClassName, useBlockProps } from '@wordpress/block-editor';\n\nconst v1 = {\n\tattributes: {\n\t\tcolor: {\n\t\t\ttype: 'string',\n\t\t},\n\t\tcustomColor: {\n\t\t\ttype: 'string',\n\t\t},\n\t},\n\tsave( { attributes } ) {\n\t\tconst { color, customColor } = attributes;\n\n\t\t// the hr support changing color using border-color, since border-color\n\t\t// is not yet supported in the color palette, we use background-color\n\t\tconst backgroundClass = getColorClassName( 'background-color', color );\n\t\t// the dots styles uses text for the dots, to change those dots color is\n\t\t// using color, not backgroundColor\n\t\tconst colorClass = getColorClassName( 'color', color );\n\n\t\tconst className = clsx( {\n\t\t\t'has-text-color has-background': color || customColor,\n\t\t\t[ backgroundClass ]: backgroundClass,\n\t\t\t[ colorClass ]: colorClass,\n\t\t} );\n\n\t\tconst style = {\n\t\t\tbackgroundColor: backgroundClass ? undefined : customColor,\n\t\t\tcolor: colorClass ? undefined : customColor,\n\t\t};\n\n\t\treturn <hr { ...useBlockProps.save( { className, style } ) } />;\n\t},\n\tmigrate( attributes ) {\n\t\tconst { color, customColor, ...restAttributes } = attributes;\n\t\treturn {\n\t\t\t...restAttributes,\n\t\t\tbackgroundColor: color ? color : undefined,\n\t\t\topacity: 'css',\n\t\t\tstyle: customColor\n\t\t\t\t? { color: { background: customColor } }\n\t\t\t\t: undefined,\n\t\t\ttagName: 'hr',\n\t\t};\n\t},\n};\n\nexport default [ v1 ];\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,YAAA,GAAAD,OAAA;AAA2E,IAAAE,WAAA,GAAAF,OAAA;AAR3E;AACA;AACA;;AAGA;AACA;AACA;;AAGA,MAAMG,EAAE,GAAG;EACVC,UAAU,EAAE;IACXC,KAAK,EAAE;MACNC,IAAI,EAAE;IACP,CAAC;IACDC,WAAW,EAAE;MACZD,IAAI,EAAE;IACP;EACD,CAAC;EACDE,IAAIA,CAAE;IAAEJ;EAAW,CAAC,EAAG;IACtB,MAAM;MAAEC,KAAK;MAAEE;IAAY,CAAC,GAAGH,UAAU;;IAEzC;IACA;IACA,MAAMK,eAAe,GAAG,IAAAC,8BAAiB,EAAE,kBAAkB,EAAEL,KAAM,CAAC;IACtE;IACA;IACA,MAAMM,UAAU,GAAG,IAAAD,8BAAiB,EAAE,OAAO,EAAEL,KAAM,CAAC;IAEtD,MAAMO,SAAS,GAAG,IAAAC,aAAI,EAAE;MACvB,+BAA+B,EAAER,KAAK,IAAIE,WAAW;MACrD,CAAEE,eAAe,GAAIA,eAAe;MACpC,CAAEE,UAAU,GAAIA;IACjB,CAAE,CAAC;IAEH,MAAMG,KAAK,GAAG;MACbC,eAAe,EAAEN,eAAe,GAAGO,SAAS,GAAGT,WAAW;MAC1DF,KAAK,EAAEM,UAAU,GAAGK,SAAS,GAAGT;IACjC,CAAC;IAED,oBAAO,IAAAL,WAAA,CAAAe,GAAA;MAAA,GAASC,0BAAa,CAACV,IAAI,CAAE;QAAEI,SAAS;QAAEE;MAAM,CAAE;IAAC,CAAI,CAAC;EAChE,CAAC;EACDK,OAAOA,CAAEf,UAAU,EAAG;IACrB,MAAM;MAAEC,KAAK;MAAEE,WAAW;MAAE,GAAGa;IAAe,CAAC,GAAGhB,UAAU;IAC5D,OAAO;MACN,GAAGgB,cAAc;MACjBL,eAAe,EAAEV,KAAK,GAAGA,KAAK,GAAGW,SAAS;MAC1CK,OAAO,EAAE,KAAK;MACdP,KAAK,EAAEP,WAAW,GACf;QAAEF,KAAK,EAAE;UAAEiB,UAAU,EAAEf;QAAY;MAAE,CAAC,GACtCS,SAAS;MACZO,OAAO,EAAE;IACV,CAAC;EACF;AACD,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEa,CAAEvB,EAAE,CAAE","ignoreList":[]}
@@ -8,6 +8,7 @@ exports.default = SeparatorEdit;
8
8
  var _clsx = _interopRequireDefault(require("clsx"));
9
9
  var _components = require("@wordpress/components");
10
10
  var _blockEditor = require("@wordpress/block-editor");
11
+ var _i18n = require("@wordpress/i18n");
11
12
  var _useDeprecatedOpacity = _interopRequireDefault(require("./use-deprecated-opacity"));
12
13
  var _jsxRuntime = require("react/jsx-runtime");
13
14
  /**
@@ -22,6 +23,9 @@ var _jsxRuntime = require("react/jsx-runtime");
22
23
  * Internal dependencies
23
24
  */
24
25
 
26
+ const htmlElementMessages = {
27
+ div: (0, _i18n.__)('The <div> element should only be used if the separator is a design element that should not be announced.')
28
+ };
25
29
  function SeparatorEdit({
26
30
  attributes,
27
31
  setAttributes
@@ -29,7 +33,8 @@ function SeparatorEdit({
29
33
  const {
30
34
  backgroundColor,
31
35
  opacity,
32
- style
36
+ style,
37
+ tagName
33
38
  } = attributes;
34
39
  const colorProps = (0, _blockEditor.__experimentalUseColorProps)(attributes);
35
40
  const currentColor = colorProps?.style?.backgroundColor;
@@ -49,13 +54,33 @@ function SeparatorEdit({
49
54
  color: currentColor,
50
55
  backgroundColor: currentColor
51
56
  };
52
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
53
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.HorizontalRule, {
57
+ const Wrapper = tagName === 'hr' ? _components.HorizontalRule : tagName;
58
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
59
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_blockEditor.InspectorControls, {
60
+ group: "advanced",
61
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.SelectControl, {
62
+ __nextHasNoMarginBottom: true,
63
+ __next40pxDefaultSize: true,
64
+ label: (0, _i18n.__)('HTML element'),
65
+ options: [{
66
+ label: (0, _i18n.__)('Default (<hr>)'),
67
+ value: 'hr'
68
+ }, {
69
+ label: '<div>',
70
+ value: 'div'
71
+ }],
72
+ value: tagName,
73
+ onChange: value => setAttributes({
74
+ tagName: value
75
+ }),
76
+ help: htmlElementMessages[tagName]
77
+ })
78
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(Wrapper, {
54
79
  ...(0, _blockEditor.useBlockProps)({
55
80
  className,
56
81
  style: hasCustomColor ? styles : undefined
57
82
  })
58
- })
83
+ })]
59
84
  });
60
85
  }
61
86
  //# sourceMappingURL=edit.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_clsx","_interopRequireDefault","require","_components","_blockEditor","_useDeprecatedOpacity","_jsxRuntime","SeparatorEdit","attributes","setAttributes","backgroundColor","opacity","style","colorProps","useColorProps","currentColor","hasCustomColor","color","background","useDeprecatedOpacity","colorClass","getColorClassName","className","clsx","styles","jsx","Fragment","children","HorizontalRule","useBlockProps","undefined"],"sources":["@wordpress/block-library/src/separator/edit.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { HorizontalRule } from '@wordpress/components';\nimport {\n\tuseBlockProps,\n\tgetColorClassName,\n\t__experimentalUseColorProps as useColorProps,\n} from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport useDeprecatedOpacity from './use-deprecated-opacity';\n\nexport default function SeparatorEdit( { attributes, setAttributes } ) {\n\tconst { backgroundColor, opacity, style } = attributes;\n\tconst colorProps = useColorProps( attributes );\n\tconst currentColor = colorProps?.style?.backgroundColor;\n\tconst hasCustomColor = !! style?.color?.background;\n\n\tuseDeprecatedOpacity( opacity, currentColor, setAttributes );\n\n\t// The dots styles uses text for the dots, to change those dots color is\n\t// using color, not backgroundColor.\n\tconst colorClass = getColorClassName( 'color', backgroundColor );\n\n\tconst className = clsx(\n\t\t{\n\t\t\t'has-text-color': backgroundColor || currentColor,\n\t\t\t[ colorClass ]: colorClass,\n\t\t\t'has-css-opacity': opacity === 'css',\n\t\t\t'has-alpha-channel-opacity': opacity === 'alpha-channel',\n\t\t},\n\t\tcolorProps.className\n\t);\n\n\tconst styles = {\n\t\tcolor: currentColor,\n\t\tbackgroundColor: currentColor,\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<HorizontalRule\n\t\t\t\t{ ...useBlockProps( {\n\t\t\t\t\tclassName,\n\t\t\t\t\tstyle: hasCustomColor ? styles : undefined,\n\t\t\t\t} ) }\n\t\t\t/>\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AASA,IAAAG,qBAAA,GAAAJ,sBAAA,CAAAC,OAAA;AAA4D,IAAAI,WAAA,GAAAJ,OAAA;AAlB5D;AACA;AACA;;AAGA;AACA;AACA;;AAQA;AACA;AACA;;AAGe,SAASK,aAAaA,CAAE;EAAEC,UAAU;EAAEC;AAAc,CAAC,EAAG;EACtE,MAAM;IAAEC,eAAe;IAAEC,OAAO;IAAEC;EAAM,CAAC,GAAGJ,UAAU;EACtD,MAAMK,UAAU,GAAG,IAAAC,wCAAa,EAAEN,UAAW,CAAC;EAC9C,MAAMO,YAAY,GAAGF,UAAU,EAAED,KAAK,EAAEF,eAAe;EACvD,MAAMM,cAAc,GAAG,CAAC,CAAEJ,KAAK,EAAEK,KAAK,EAAEC,UAAU;EAElD,IAAAC,6BAAoB,EAAER,OAAO,EAAEI,YAAY,EAAEN,aAAc,CAAC;;EAE5D;EACA;EACA,MAAMW,UAAU,GAAG,IAAAC,8BAAiB,EAAE,OAAO,EAAEX,eAAgB,CAAC;EAEhE,MAAMY,SAAS,GAAG,IAAAC,aAAI,EACrB;IACC,gBAAgB,EAAEb,eAAe,IAAIK,YAAY;IACjD,CAAEK,UAAU,GAAIA,UAAU;IAC1B,iBAAiB,EAAET,OAAO,KAAK,KAAK;IACpC,2BAA2B,EAAEA,OAAO,KAAK;EAC1C,CAAC,EACDE,UAAU,CAACS,SACZ,CAAC;EAED,MAAME,MAAM,GAAG;IACdP,KAAK,EAAEF,YAAY;IACnBL,eAAe,EAAEK;EAClB,CAAC;EAED,oBACC,IAAAT,WAAA,CAAAmB,GAAA,EAAAnB,WAAA,CAAAoB,QAAA;IAAAC,QAAA,eACC,IAAArB,WAAA,CAAAmB,GAAA,EAACtB,WAAA,CAAAyB,cAAc;MAAA,GACT,IAAAC,0BAAa,EAAE;QACnBP,SAAS;QACTV,KAAK,EAAEI,cAAc,GAAGQ,MAAM,GAAGM;MAClC,CAAE;IAAC,CACH;EAAC,CACD,CAAC;AAEL","ignoreList":[]}
1
+ {"version":3,"names":["_clsx","_interopRequireDefault","require","_components","_blockEditor","_i18n","_useDeprecatedOpacity","_jsxRuntime","htmlElementMessages","div","__","SeparatorEdit","attributes","setAttributes","backgroundColor","opacity","style","tagName","colorProps","useColorProps","currentColor","hasCustomColor","color","background","useDeprecatedOpacity","colorClass","getColorClassName","className","clsx","styles","Wrapper","HorizontalRule","jsxs","Fragment","children","jsx","InspectorControls","group","SelectControl","__nextHasNoMarginBottom","__next40pxDefaultSize","label","options","value","onChange","help","useBlockProps","undefined"],"sources":["@wordpress/block-library/src/separator/edit.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { HorizontalRule, SelectControl } from '@wordpress/components';\nimport {\n\tuseBlockProps,\n\tgetColorClassName,\n\t__experimentalUseColorProps as useColorProps,\n\tInspectorControls,\n} from '@wordpress/block-editor';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport useDeprecatedOpacity from './use-deprecated-opacity';\n\nconst htmlElementMessages = {\n\tdiv: __(\n\t\t'The <div> element should only be used if the separator is a design element that should not be announced.'\n\t),\n};\n\nexport default function SeparatorEdit( { attributes, setAttributes } ) {\n\tconst { backgroundColor, opacity, style, tagName } = attributes;\n\tconst colorProps = useColorProps( attributes );\n\tconst currentColor = colorProps?.style?.backgroundColor;\n\tconst hasCustomColor = !! style?.color?.background;\n\n\tuseDeprecatedOpacity( opacity, currentColor, setAttributes );\n\n\t// The dots styles uses text for the dots, to change those dots color is\n\t// using color, not backgroundColor.\n\tconst colorClass = getColorClassName( 'color', backgroundColor );\n\n\tconst className = clsx(\n\t\t{\n\t\t\t'has-text-color': backgroundColor || currentColor,\n\t\t\t[ colorClass ]: colorClass,\n\t\t\t'has-css-opacity': opacity === 'css',\n\t\t\t'has-alpha-channel-opacity': opacity === 'alpha-channel',\n\t\t},\n\t\tcolorProps.className\n\t);\n\n\tconst styles = {\n\t\tcolor: currentColor,\n\t\tbackgroundColor: currentColor,\n\t};\n\tconst Wrapper = tagName === 'hr' ? HorizontalRule : tagName;\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls group=\"advanced\">\n\t\t\t\t<SelectControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tlabel={ __( 'HTML element' ) }\n\t\t\t\t\toptions={ [\n\t\t\t\t\t\t{ label: __( 'Default (<hr>)' ), value: 'hr' },\n\t\t\t\t\t\t{ label: '<div>', value: 'div' },\n\t\t\t\t\t] }\n\t\t\t\t\tvalue={ tagName }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { tagName: value } )\n\t\t\t\t\t}\n\t\t\t\t\thelp={ htmlElementMessages[ tagName ] }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t\t<Wrapper\n\t\t\t\t{ ...useBlockProps( {\n\t\t\t\t\tclassName,\n\t\t\t\t\tstyle: hasCustomColor ? styles : undefined,\n\t\t\t\t} ) }\n\t\t\t/>\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AAMA,IAAAG,KAAA,GAAAH,OAAA;AAKA,IAAAI,qBAAA,GAAAL,sBAAA,CAAAC,OAAA;AAA4D,IAAAK,WAAA,GAAAL,OAAA;AApB5D;AACA;AACA;;AAGA;AACA;AACA;;AAUA;AACA;AACA;;AAGA,MAAMM,mBAAmB,GAAG;EAC3BC,GAAG,EAAE,IAAAC,QAAE,EACN,0GACD;AACD,CAAC;AAEc,SAASC,aAAaA,CAAE;EAAEC,UAAU;EAAEC;AAAc,CAAC,EAAG;EACtE,MAAM;IAAEC,eAAe;IAAEC,OAAO;IAAEC,KAAK;IAAEC;EAAQ,CAAC,GAAGL,UAAU;EAC/D,MAAMM,UAAU,GAAG,IAAAC,wCAAa,EAAEP,UAAW,CAAC;EAC9C,MAAMQ,YAAY,GAAGF,UAAU,EAAEF,KAAK,EAAEF,eAAe;EACvD,MAAMO,cAAc,GAAG,CAAC,CAAEL,KAAK,EAAEM,KAAK,EAAEC,UAAU;EAElD,IAAAC,6BAAoB,EAAET,OAAO,EAAEK,YAAY,EAAEP,aAAc,CAAC;;EAE5D;EACA;EACA,MAAMY,UAAU,GAAG,IAAAC,8BAAiB,EAAE,OAAO,EAAEZ,eAAgB,CAAC;EAEhE,MAAMa,SAAS,GAA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;EAAA,CACD,CAAC;AAEL","ignoreList":[]}
@@ -30,6 +30,11 @@ const metadata = exports.metadata = {
30
30
  opacity: {
31
31
  type: "string",
32
32
  "default": "alpha-channel"
33
+ },
34
+ tagName: {
35
+ type: "string",
36
+ "enum": ["hr", "div"],
37
+ "default": "hr"
33
38
  }
34
39
  },
35
40
  supports: {
@@ -1 +1 @@
1
- {"version":3,"names":["_icons","require","_initBlock","_interopRequireDefault","_edit","_save","_transforms","_deprecated","metadata","exports","$schema","apiVersion","name","title","category","description","keywords","textdomain","attributes","opacity","type","supports","anchor","align","color","enableContrastChecker","__experimentalSkipSerialization","gradients","background","text","__experimentalDefaultControls","spacing","margin","interactivity","clientNavigation","styles","label","isDefault","editorStyle","style","settings","icon","example","customColor","className","transforms","edit","save","deprecated","init","initBlock"],"sources":["@wordpress/block-library/src/separator/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { separator as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport edit from './edit';\nimport metadata from './block.json';\nimport save from './save';\nimport transforms from './transforms';\nimport deprecated from './deprecated';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tattributes: {\n\t\t\tcustomColor: '#065174',\n\t\t\tclassName: 'is-style-wide',\n\t\t},\n\t},\n\ttransforms,\n\tedit,\n\tsave,\n\tdeprecated,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],"mappings":";;;;;;;AAGA,IAAAA,MAAA,GAAAC,OAAA;AAKA,IAAAC,UAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,KAAA,GAAAD,sBAAA,CAAAF,OAAA;AAEA,IAAAI,KAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAAAK,WAAA,GAAAH,sBAAA,CAAAF,OAAA;AACA,IAAAM,WAAA,GAAAJ,sBAAA,CAAAF,OAAA;AAbA;AACA;AACA;AAGA;AACA;AACA;AAFA,MAAAO,QAAA,GAAAC,OAAA,CAAAD,QAAA;EAAAE,OAAA;EAAAC,UAAA;EAAAC,IAAA;EAAAC,KAAA;EAAAC,QAAA;EAAAC,WAAA;EAAAC,QAAA;EAAAC,UAAA;EAAAC,UAAA;IAAAC,OAAA;MAAAC,IAAA;MAAA;IAAA;EAAA;EAAAC,QAAA;IAAAC,MAAA;IAAAC,KAAA;IAAAC,KAAA;MAAAC,qBAAA;MAAAC,+BAAA;MAAAC,SAAA;MAAAC,UAAA;MAAAC,IAAA;MAAAC,6BAAA;QAAAF,UAAA;MAAA;IAAA;IAAAG,OAAA;MAAAC,MAAA;IAAA;IAAAC,aAAA;MAAAC,gBAAA;IAAA;EAAA;EAAAC,MAAA;IAAAvB,IAAA;IAAAwB,KAAA;IAAAC,SAAA;EAAA;IAAAzB,IAAA;IAAAwB,KAAA;EAAA;IAAAxB,IAAA;IAAAwB,KAAA;EAAA;EAAAE,WAAA;EAAAC,KAAA;AAAA;AAUA,MAAM;EAAE3B;AAAK,CAAC,GAAGJ,QAAQ;AAACC,OAAA,CAAAG,IAAA,GAAAA,IAAA;AAInB,MAAM4B,QAAQ,GAAA/B,OAAA,CAAA+B,QAAA,GAAG;EACvBC,IAAI,EAAJA,gBAAI;EACJC,OAAO,EAAE;IACRxB,UAAU,EAAE;MACXyB,WAAW,EAAE,SAAS;MACtBC,SAAS,EAAE;IACZ;EACD,CAAC;EACDC,UAAU,EAAVA,mBAAU;EACVC,IAAI,EAAJA,aAAI;EACJC,IAAI,EAAJA,aAAI;EACJC,UAAU,EAAVA;AACD,CAAC;AAEM,MAAMC,IAAI,GAAGA,CAAA,KAAM,IAAAC,kBAAS,EAAE;EAAEtC,IAAI;EAAEJ,QAAQ;EAAEgC;AAAS,CAAE,CAAC;AAAC/B,OAAA,CAAAwC,IAAA,GAAAA,IAAA","ignoreList":[]}
1
+ {"version":3,"names":["_icons","require","_initBlock","_interopRequireDefault","_edit","_save","_transforms","_deprecated","metadata","exports","$schema","apiVersion","name","title","category","description","keywords","textdomain","attributes","opacity","type","tagName","supports","anchor","align","color","enableContrastChecker","__experimentalSkipSerialization","gradients","background","text","__experimentalDefaultControls","spacing","margin","interactivity","clientNavigation","styles","label","isDefault","editorStyle","style","settings","icon","example","customColor","className","transforms","edit","save","deprecated","init","initBlock"],"sources":["@wordpress/block-library/src/separator/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { separator as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport edit from './edit';\nimport metadata from './block.json';\nimport save from './save';\nimport transforms from './transforms';\nimport deprecated from './deprecated';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tattributes: {\n\t\t\tcustomColor: '#065174',\n\t\t\tclassName: 'is-style-wide',\n\t\t},\n\t},\n\ttransforms,\n\tedit,\n\tsave,\n\tdeprecated,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],"mappings":";;;;;;;AAGA,IAAAA,MAAA,GAAAC,OAAA;AAKA,IAAAC,UAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,KAAA,GAAAD,sBAAA,CAAAF,OAAA;AAEA,IAAAI,KAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAAAK,WAAA,GAAAH,sBAAA,CAAAF,OAAA;AACA,IAAAM,WAAA,GAAAJ,sBAAA,CAAAF,OAAA;AAbA;AACA;AACA;AAGA;AACA;AACA;AAFA,MAAAO,QAAA,GAAAC,OAAA,CAAAD,QAAA;EAAAE,OAAA;EAAAC,UAAA;EAAAC,IAAA;EAAAC,KAAA;EAAAC,QAAA;EAAAC,WAAA;EAAAC,QAAA;EAAAC,UAAA;EAAAC,UAAA;IAAAC,OAAA;MAAAC,IAAA;MAAA;IAAA;IAAAC,OAAA;MAAAD,IAAA;MAAA;MAAA;IAAA;EAAA;EAAAE,QAAA;IAAAC,MAAA;IAAAC,KAAA;IAAAC,KAAA;MAAAC,qBAAA;MAAAC,+BAAA;MAAAC,SAAA;MAAAC,UAAA;MAAAC,IAAA;MAAAC,6BAAA;QAAAF,UAAA;MAAA;IAAA;IAAAG,OAAA;MAAAC,MAAA;IAAA;IAAAC,aAAA;MAAAC,gBAAA;IAAA;EAAA;EAAAC,MAAA;IAAAxB,IAAA;IAAAyB,KAAA;IAAAC,SAAA;EAAA;IAAA1B,IAAA;IAAAyB,KAAA;EAAA;IAAAzB,IAAA;IAAAyB,KAAA;EAAA;EAAAE,WAAA;EAAAC,KAAA;AAAA;AAUA,MAAM;EAAE5B;AAAK,CAAC,GAAGJ,QAAQ;AAACC,OAAA,CAAAG,IAAA,GAAAA,IAAA;AAInB,MAAM6B,QAAQ,GAAAhC,OAAA,CAAAgC,QAAA,GAAG;EACvBC,IAAI,EAAJA,gBAAI;EACJC,OAAO,EAAE;IACRzB,UAAU,EAAE;MACX0B,WAAW,EAAE,SAAS;MACtBC,SAAS,EAAE;IACZ;EACD,CAAC;EACDC,UAAU,EAAVA,mBAAU;EACVC,IAAI,EAAJA,aAAI;EACJC,IAAI,EAAJA,aAAI;EACJC,UAAU,EAAVA;AACD,CAAC;AAEM,MAAMC,IAAI,GAAGA,CAAA,KAAM,IAAAC,kBAAS,EAAE;EAAEvC,IAAI;EAAEJ,QAAQ;EAAEiC;AAAS,CAAE,CAAC;AAAChC,OAAA,CAAAyC,IAAA,GAAAA,IAAA","ignoreList":[]}
@@ -22,7 +22,8 @@ function separatorSave({
22
22
  const {
23
23
  backgroundColor,
24
24
  style,
25
- opacity
25
+ opacity,
26
+ tagName: Tag
26
27
  } = attributes;
27
28
  const customColor = style?.color?.background;
28
29
  const colorProps = (0, _blockEditor.__experimentalGetColorClassesAndStyles)(attributes);
@@ -42,7 +43,7 @@ function separatorSave({
42
43
  backgroundColor: colorProps?.style?.backgroundColor,
43
44
  color: colorClass ? undefined : customColor
44
45
  };
45
- return /*#__PURE__*/(0, _jsxRuntime.jsx)("hr", {
46
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(Tag, {
46
47
  ..._blockEditor.useBlockProps.save({
47
48
  className,
48
49
  style: styles
@@ -1 +1 @@
1
- {"version":3,"names":["_clsx","_interopRequireDefault","require","_blockEditor","_jsxRuntime","separatorSave","attributes","backgroundColor","style","opacity","customColor","color","background","colorProps","getColorClassesAndStyles","colorClass","getColorClassName","className","clsx","styles","undefined","jsx","useBlockProps","save"],"sources":["@wordpress/block-library/src/separator/save.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tgetColorClassName,\n\tuseBlockProps,\n\t__experimentalGetColorClassesAndStyles as getColorClassesAndStyles,\n} from '@wordpress/block-editor';\n\nexport default function separatorSave( { attributes } ) {\n\tconst { backgroundColor, style, opacity } = attributes;\n\tconst customColor = style?.color?.background;\n\tconst colorProps = getColorClassesAndStyles( attributes );\n\t// The hr support changing color using border-color, since border-color\n\t// is not yet supported in the color palette, we use background-color.\n\n\t// The dots styles uses text for the dots, to change those dots color is\n\t// using color, not backgroundColor.\n\tconst colorClass = getColorClassName( 'color', backgroundColor );\n\n\tconst className = clsx(\n\t\t{\n\t\t\t'has-text-color': backgroundColor || customColor,\n\t\t\t[ colorClass ]: colorClass,\n\t\t\t'has-css-opacity': opacity === 'css',\n\t\t\t'has-alpha-channel-opacity': opacity === 'alpha-channel',\n\t\t},\n\t\tcolorProps.className\n\t);\n\n\tconst styles = {\n\t\tbackgroundColor: colorProps?.style?.backgroundColor,\n\t\tcolor: colorClass ? undefined : customColor,\n\t};\n\treturn <hr { ...useBlockProps.save( { className, style: styles } ) } />;\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,YAAA,GAAAD,OAAA;AAIiC,IAAAE,WAAA,GAAAF,OAAA;AAZjC;AACA;AACA;;AAGA;AACA;AACA;;AAOe,SAASG,aAAaA,CAAE;EAAEC;AAAW,CAAC,EAAG;EACvD,MAAM;IAAEC,eAAe;IAAEC,KAAK;IAAEC;EAAQ,CAAC,GAAGH,UAAU;EACtD,MAAMI,WAAW,GAAGF,KAAK,EAAEG,KAAK,EAAEC,UAAU;EAC5C,MAAMC,UAAU,GAAG,IAAAC,mDAAwB,EAAER,UAAW,CAAC;EACzD;EACA;;EAEA;EACA;EACA,MAAMS,UAAU,GAAG,IAAAC,8BAAiB,EAAE,OAAO,EAAET,eAAgB,CAAC;EAEhE,MAAMU,SAAS,GAAG,IAAAC,aAAI,EACrB;IACC,gBAAgB,EAAEX,eAAe,IAAIG,WAAW;IAChD,CAAEK,UAAU,GAAIA,UAAU;IAC1B,iBAAiB,EAAEN,OAAO,KAAK,KAAK;IACpC,2BAA2B,EAAEA,OAAO,KAAK;EAC1C,CAAC,EACDI,UAAU,CAACI,SACZ,CAAC;EAED,MAAME,MAAM,GAAG;IACdZ,eAAe,EAAEM,UAAU,EAAEL,KAAK,EAAED,eAAe;IACnDI,KAAK,EAAEI,UAAU,GAAGK,SAAS,GAAGV;EACjC,CAAC;EACD,oBAAO,IAAAN,WAAA,CAAAiB,GAAA;IAAA,GAASC,0BAAa,CAACC,IAAI,CAAE;MAAEN,SAAS;MAAET,KAAK,EAAEW;IAAO,CAAE;EAAC,CAAI,CAAC;AACxE","ignoreList":[]}
1
+ {"version":3,"names":["_clsx","_interopRequireDefault","require","_blockEditor","_jsxRuntime","separatorSave","attributes","backgroundColor","style","opacity","tagName","Tag","customColor","color","background","colorProps","getColorClassesAndStyles","colorClass","getColorClassName","className","clsx","styles","undefined","jsx","useBlockProps","save"],"sources":["@wordpress/block-library/src/separator/save.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tgetColorClassName,\n\tuseBlockProps,\n\t__experimentalGetColorClassesAndStyles as getColorClassesAndStyles,\n} from '@wordpress/block-editor';\n\nexport default function separatorSave( { attributes } ) {\n\tconst { backgroundColor, style, opacity, tagName: Tag } = attributes;\n\tconst customColor = style?.color?.background;\n\tconst colorProps = getColorClassesAndStyles( attributes );\n\t// The hr support changing color using border-color, since border-color\n\t// is not yet supported in the color palette, we use background-color.\n\n\t// The dots styles uses text for the dots, to change those dots color is\n\t// using color, not backgroundColor.\n\tconst colorClass = getColorClassName( 'color', backgroundColor );\n\n\tconst className = clsx(\n\t\t{\n\t\t\t'has-text-color': backgroundColor || customColor,\n\t\t\t[ colorClass ]: colorClass,\n\t\t\t'has-css-opacity': opacity === 'css',\n\t\t\t'has-alpha-channel-opacity': opacity === 'alpha-channel',\n\t\t},\n\t\tcolorProps.className\n\t);\n\n\tconst styles = {\n\t\tbackgroundColor: colorProps?.style?.backgroundColor,\n\t\tcolor: colorClass ? undefined : customColor,\n\t};\n\treturn <Tag { ...useBlockProps.save( { className, style: styles } ) } />;\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,YAAA,GAAAD,OAAA;AAIiC,IAAAE,WAAA,GAAAF,OAAA;AAZjC;AACA;AACA;;AAGA;AACA;AACA;;AAOe,SAASG,aAAaA,CAAE;EAAEC;AAAW,CAAC,EAAG;EACvD,MAAM;IAAEC,eAAe;IAAEC,KAAK;IAAEC,OAAO;IAAEC,OAAO,EAAEC;EAAI,CAAC,GAAGL,UAAU;EACpE,MAAMM,WAAW,GAAGJ,KAAK,EAAEK,KAAK,EAAEC,UAAU;EAC5C,MAAMC,UAAU,GAAG,IAAAC,mDAAwB,EAAEV,UAAW,CAAC;EACzD;EACA;;EAEA;EACA;EACA,MAAMW,UAAU,GAAG,IAAAC,8BAAiB,EAAE,OAAO,EAAEX,eAAgB,CAAC;EAEhE,MAAMY,SAAS,GAAG,IAAAC,aAAI,EACrB;IACC,gBAAgB,EAAEb,eAAe,IAAIK,WAAW;IAChD,CAAEK,UAAU,GAAIA,UAAU;IAC1B,iBAAiB,EAAER,OAAO,KAAK,KAAK;IACpC,2BAA2B,EAAEA,OAAO,KAAK;EAC1C,CAAC,EACDM,UAAU,CAACI,SACZ,CAAC;EAED,MAAME,MAAM,GAAG;IACdd,eAAe,EAAEQ,UAAU,EAAEP,KAAK,EAAED,eAAe;IACnDM,KAAK,EAAEI,UAAU,GAAGK,SAAS,GAAGV;EACjC,CAAC;EACD,oBAAO,IAAAR,WAAA,CAAAmB,GAAA,EAACZ,GAAG;IAAA,GAAMa,0BAAa,CAACC,IAAI,CAAE;MAAEN,SAAS;MAAEX,KAAK,EAAEa;IAAO,CAAE;EAAC,CAAI,CAAC;AACzE","ignoreList":[]}
@@ -1,4 +1,3 @@
1
- /* wp:polyfill */
2
1
  "use strict";
3
2
 
4
3
  Object.defineProperty(exports, "__esModule", {