@wordpress/block-editor 12.19.2 → 12.19.4

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 (148) hide show
  1. package/build/components/block-edit/context.js +2 -1
  2. package/build/components/block-edit/context.js.map +1 -1
  3. package/build/components/block-edit/index.js +8 -3
  4. package/build/components/block-edit/index.js.map +1 -1
  5. package/build/components/block-inspector/index.js +5 -4
  6. package/build/components/block-inspector/index.js.map +1 -1
  7. package/build/components/block-preview/index.js +4 -0
  8. package/build/components/block-preview/index.js.map +1 -1
  9. package/build/components/block-tools/insertion-point.js +4 -1
  10. package/build/components/block-tools/insertion-point.js.map +1 -1
  11. package/build/components/global-styles/advanced-panel.js +5 -10
  12. package/build/components/global-styles/advanced-panel.js.map +1 -1
  13. package/build/components/global-styles/border-panel.js +21 -8
  14. package/build/components/global-styles/border-panel.js.map +1 -1
  15. package/build/components/global-styles/index.js +6 -0
  16. package/build/components/global-styles/index.js.map +1 -1
  17. package/build/components/global-styles/shadow-panel-components.js +80 -23
  18. package/build/components/global-styles/shadow-panel-components.js.map +1 -1
  19. package/build/components/inserter/media-tab/media-preview.js +1 -1
  20. package/build/components/inserter/media-tab/media-preview.js.map +1 -1
  21. package/build/components/inspector-controls-tabs/styles-tab.js +1 -1
  22. package/build/components/inspector-controls-tabs/styles-tab.js.map +1 -1
  23. package/build/components/link-control/link-preview.js +4 -1
  24. package/build/components/link-control/link-preview.js.map +1 -1
  25. package/build/components/rich-text/index.js +52 -28
  26. package/build/components/rich-text/index.js.map +1 -1
  27. package/build/components/rich-text/use-enter.js +3 -0
  28. package/build/components/rich-text/use-enter.js.map +1 -1
  29. package/build/components/rich-text/use-paste-handler.js +25 -26
  30. package/build/components/rich-text/use-paste-handler.js.map +1 -1
  31. package/build/hooks/background.js +4 -2
  32. package/build/hooks/background.js.map +1 -1
  33. package/build/hooks/block-hooks.js +8 -6
  34. package/build/hooks/block-hooks.js.map +1 -1
  35. package/build/hooks/border.js +6 -4
  36. package/build/hooks/border.js.map +1 -1
  37. package/build/hooks/use-bindings-attributes.js +2 -4
  38. package/build/hooks/use-bindings-attributes.js.map +1 -1
  39. package/build/private-apis.js +5 -1
  40. package/build/private-apis.js.map +1 -1
  41. package/build/store/index.js +0 -2
  42. package/build/store/index.js.map +1 -1
  43. package/build/store/private-actions.js +0 -10
  44. package/build/store/private-actions.js.map +1 -1
  45. package/build/store/private-keys.js +8 -0
  46. package/build/store/private-keys.js.map +1 -0
  47. package/build/store/private-selectors.js +6 -17
  48. package/build/store/private-selectors.js.map +1 -1
  49. package/build/store/reducer.js +1 -24
  50. package/build/store/reducer.js.map +1 -1
  51. package/build/store/selectors.js +7 -12
  52. package/build/store/selectors.js.map +1 -1
  53. package/build/store/utils.js +7 -2
  54. package/build/store/utils.js.map +1 -1
  55. package/build-module/components/block-edit/context.js +1 -0
  56. package/build-module/components/block-edit/context.js.map +1 -1
  57. package/build-module/components/block-edit/index.js +9 -4
  58. package/build-module/components/block-edit/index.js.map +1 -1
  59. package/build-module/components/block-inspector/index.js +6 -5
  60. package/build-module/components/block-inspector/index.js.map +1 -1
  61. package/build-module/components/block-preview/index.js +4 -0
  62. package/build-module/components/block-preview/index.js.map +1 -1
  63. package/build-module/components/block-tools/insertion-point.js +4 -1
  64. package/build-module/components/block-tools/insertion-point.js.map +1 -1
  65. package/build-module/components/global-styles/advanced-panel.js +6 -11
  66. package/build-module/components/global-styles/advanced-panel.js.map +1 -1
  67. package/build-module/components/global-styles/border-panel.js +22 -10
  68. package/build-module/components/global-styles/border-panel.js.map +1 -1
  69. package/build-module/components/global-styles/index.js +1 -1
  70. package/build-module/components/global-styles/index.js.map +1 -1
  71. package/build-module/components/global-styles/shadow-panel-components.js +82 -24
  72. package/build-module/components/global-styles/shadow-panel-components.js.map +1 -1
  73. package/build-module/components/inserter/media-tab/media-preview.js +1 -1
  74. package/build-module/components/inserter/media-tab/media-preview.js.map +1 -1
  75. package/build-module/components/inspector-controls-tabs/styles-tab.js +2 -2
  76. package/build-module/components/inspector-controls-tabs/styles-tab.js.map +1 -1
  77. package/build-module/components/link-control/link-preview.js +5 -2
  78. package/build-module/components/link-control/link-preview.js.map +1 -1
  79. package/build-module/components/rich-text/index.js +52 -29
  80. package/build-module/components/rich-text/index.js.map +1 -1
  81. package/build-module/components/rich-text/use-enter.js +3 -0
  82. package/build-module/components/rich-text/use-enter.js.map +1 -1
  83. package/build-module/components/rich-text/use-paste-handler.js +25 -26
  84. package/build-module/components/rich-text/use-paste-handler.js.map +1 -1
  85. package/build-module/hooks/background.js +4 -2
  86. package/build-module/hooks/background.js.map +1 -1
  87. package/build-module/hooks/block-hooks.js +8 -6
  88. package/build-module/hooks/block-hooks.js.map +1 -1
  89. package/build-module/hooks/border.js +7 -5
  90. package/build-module/hooks/border.js.map +1 -1
  91. package/build-module/hooks/use-bindings-attributes.js +3 -5
  92. package/build-module/hooks/use-bindings-attributes.js.map +1 -1
  93. package/build-module/private-apis.js +5 -1
  94. package/build-module/private-apis.js.map +1 -1
  95. package/build-module/store/index.js +0 -2
  96. package/build-module/store/index.js.map +1 -1
  97. package/build-module/store/private-actions.js +0 -9
  98. package/build-module/store/private-actions.js.map +1 -1
  99. package/build-module/store/private-keys.js +2 -0
  100. package/build-module/store/private-keys.js.map +1 -0
  101. package/build-module/store/private-selectors.js +5 -12
  102. package/build-module/store/private-selectors.js.map +1 -1
  103. package/build-module/store/reducer.js +1 -24
  104. package/build-module/store/reducer.js.map +1 -1
  105. package/build-module/store/selectors.js +8 -13
  106. package/build-module/store/selectors.js.map +1 -1
  107. package/build-module/store/utils.js +6 -2
  108. package/build-module/store/utils.js.map +1 -1
  109. package/build-style/style-rtl.css +47 -24
  110. package/build-style/style.css +47 -24
  111. package/package.json +7 -7
  112. package/src/components/block-edit/context.js +1 -0
  113. package/src/components/block-edit/index.js +5 -1
  114. package/src/components/block-inspector/index.js +7 -5
  115. package/src/components/block-preview/index.js +6 -1
  116. package/src/components/block-toolbar/style.scss +11 -6
  117. package/src/components/block-tools/insertion-point.js +6 -1
  118. package/src/components/global-styles/advanced-panel.js +6 -12
  119. package/src/components/global-styles/border-panel.js +33 -22
  120. package/src/components/global-styles/index.js +5 -1
  121. package/src/components/global-styles/shadow-panel-components.js +92 -23
  122. package/src/components/global-styles/style.scss +33 -20
  123. package/src/components/inserter/media-tab/media-preview.js +6 -1
  124. package/src/components/inspector-controls-tabs/styles-tab.js +2 -2
  125. package/src/components/link-control/link-preview.js +9 -2
  126. package/src/components/link-control/style.scss +9 -0
  127. package/src/components/rich-text/index.js +74 -44
  128. package/src/components/rich-text/use-enter.js +4 -0
  129. package/src/components/rich-text/use-paste-handler.js +26 -25
  130. package/src/components/url-popover/style.scss +1 -0
  131. package/src/hooks/background.js +5 -2
  132. package/src/hooks/block-hooks.js +10 -5
  133. package/src/hooks/block-hooks.scss +6 -0
  134. package/src/hooks/border.js +16 -4
  135. package/src/hooks/use-bindings-attributes.js +5 -7
  136. package/src/private-apis.js +4 -0
  137. package/src/store/index.js +0 -2
  138. package/src/store/private-actions.js +0 -10
  139. package/src/store/private-keys.js +1 -0
  140. package/src/store/private-selectors.js +4 -15
  141. package/src/store/reducer.js +0 -25
  142. package/src/store/selectors.js +7 -15
  143. package/src/store/utils.js +7 -2
  144. package/build/store/resolvers.js +0 -27
  145. package/build/store/resolvers.js.map +0 -1
  146. package/build-module/store/resolvers.js +0 -20
  147. package/build-module/store/resolvers.js.map +0 -1
  148. package/src/store/resolvers.js +0 -17
@@ -18,9 +18,14 @@ import { useSelect } from '@wordpress/data';
18
18
  import { getColorClassName } from '../components/colors';
19
19
  import InspectorControls from '../components/inspector-controls';
20
20
  import useMultipleOriginColorsAndGradients from '../components/colors-gradients/use-multiple-origin-colors-and-gradients';
21
- import { cleanEmptyObject, shouldSkipSerialization } from './utils';
21
+ import {
22
+ cleanEmptyObject,
23
+ shouldSkipSerialization,
24
+ useBlockSettings,
25
+ } from './utils';
22
26
  import {
23
27
  useHasBorderPanel,
28
+ useHasBorderPanelControls,
24
29
  BorderPanel as StylesBorderPanel,
25
30
  } from '../components/global-styles';
26
31
  import { store as blockEditorStore } from '../store';
@@ -220,14 +225,21 @@ export function hasShadowSupport( blockName ) {
220
225
  return hasBlockSupport( blockName, SHADOW_SUPPORT_KEY );
221
226
  }
222
227
 
223
- export function getBorderPanelLabel( {
228
+ export function useBorderPanelLabel( {
224
229
  blockName,
225
230
  hasBorderControl,
226
231
  hasShadowControl,
227
232
  } = {} ) {
233
+ const settings = useBlockSettings( blockName );
234
+ const controls = useHasBorderPanelControls( settings );
235
+
228
236
  if ( ! hasBorderControl && ! hasShadowControl && blockName ) {
229
- hasBorderControl = hasBorderSupport( blockName );
230
- hasShadowControl = hasShadowSupport( blockName );
237
+ hasBorderControl =
238
+ controls?.hasBorderColor ||
239
+ controls?.hasBorderStyle ||
240
+ controls?.hasBorderWidth ||
241
+ controls?.hasBorderRadius;
242
+ hasShadowControl = controls?.hasShadow;
231
243
  }
232
244
 
233
245
  if ( hasBorderControl && hasShadowControl ) {
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * WordPress dependencies
3
3
  */
4
- import { getBlockType } from '@wordpress/blocks';
4
+ import { getBlockType, store as blocksStore } from '@wordpress/blocks';
5
5
  import { createHigherOrderComponent } from '@wordpress/compose';
6
6
  import { useSelect } from '@wordpress/data';
7
7
  import { addFilter } from '@wordpress/hooks';
@@ -33,18 +33,16 @@ const createEditFunctionWithBindingsAttribute = () =>
33
33
  createHigherOrderComponent(
34
34
  ( BlockEdit ) => ( props ) => {
35
35
  const { clientId, name: blockName } = useBlockEditContext();
36
- const { getBlockBindingsSource } = unlock(
37
- useSelect( blockEditorStore )
38
- );
36
+ const blockBindingsSources = unlock(
37
+ useSelect( blocksStore )
38
+ ).getAllBlockBindingsSources();
39
39
  const { getBlockAttributes } = useSelect( blockEditorStore );
40
40
 
41
41
  const updatedAttributes = getBlockAttributes( clientId );
42
42
  if ( updatedAttributes?.metadata?.bindings ) {
43
43
  Object.entries( updatedAttributes.metadata.bindings ).forEach(
44
44
  ( [ attributeName, settings ] ) => {
45
- const source = getBlockBindingsSource(
46
- settings.source
47
- );
45
+ const source = blockBindingsSources[ settings.source ];
48
46
 
49
47
  if ( source && source.useSource ) {
50
48
  // Second argument (`updateMetaValue`) will be used to update the value in the future.
@@ -26,6 +26,8 @@ import { usesContextKey } from './components/rich-text/format-edit';
26
26
  import { ExperimentalBlockCanvas } from './components/block-canvas';
27
27
  import { getDuotoneFilter } from './components/duotone/utils';
28
28
  import { useFlashEditableBlocks } from './components/use-flash-editable-blocks';
29
+ import { selectBlockPatternsKey } from './store/private-keys';
30
+ import { PrivateRichText } from './components/rich-text/';
29
31
 
30
32
  /**
31
33
  * Private @wordpress/block-editor APIs.
@@ -56,4 +58,6 @@ lock( privateApis, {
56
58
  useReusableBlocksRenameHint,
57
59
  usesContextKey,
58
60
  useFlashEditableBlocks,
61
+ selectBlockPatternsKey,
62
+ PrivateRichText,
59
63
  } );
@@ -10,7 +10,6 @@ import reducer from './reducer';
10
10
  import * as selectors from './selectors';
11
11
  import * as privateActions from './private-actions';
12
12
  import * as privateSelectors from './private-selectors';
13
- import * as resolvers from './resolvers';
14
13
  import * as actions from './actions';
15
14
  import { STORE_NAME } from './constants';
16
15
  import { unlock } from '../lock-unlock';
@@ -23,7 +22,6 @@ import { unlock } from '../lock-unlock';
23
22
  export const storeConfig = {
24
23
  reducer,
25
24
  selectors,
26
- resolvers,
27
25
  actions,
28
26
  };
29
27
 
@@ -390,16 +390,6 @@ export function stopEditingAsBlocks( clientId ) {
390
390
  };
391
391
  }
392
392
 
393
- export function registerBlockBindingsSource( source ) {
394
- return {
395
- type: 'REGISTER_BLOCK_BINDINGS_SOURCE',
396
- sourceName: source.name,
397
- sourceLabel: source.label,
398
- useSource: source.useSource,
399
- lockAttributesEditing: source.lockAttributesEditing,
400
- };
401
- }
402
-
403
393
  /**
404
394
  * Returns an action object used in signalling that the user has begun to drag.
405
395
  *
@@ -0,0 +1 @@
1
+ export const selectBlockPatternsKey = Symbol( 'selectBlockPatternsKey' );
@@ -22,6 +22,7 @@ import { checkAllowListRecursive, getAllPatternsDependants } from './utils';
22
22
  import { INSERTER_PATTERN_TYPES } from '../components/inserter/block-patterns-tab/utils';
23
23
  import { STORE_NAME } from './constants';
24
24
  import { unlock } from '../lock-unlock';
25
+ import { selectBlockPatternsKey } from './private-keys';
25
26
 
26
27
  export { getBlockSettings } from './get-block-settings';
27
28
 
@@ -250,10 +251,6 @@ export const getInserterMediaCategories = createSelector(
250
251
  ]
251
252
  );
252
253
 
253
- export function getFetchedPatterns( state ) {
254
- return state.blockPatterns;
255
- }
256
-
257
254
  /**
258
255
  * Returns whether there is at least one allowed pattern for inner blocks children.
259
256
  * This is useful for deferring the parsing of all patterns until needed.
@@ -285,7 +282,7 @@ export const hasAllowedPatterns = createRegistrySelector( ( select ) =>
285
282
  } );
286
283
  },
287
284
  ( state, rootClientId ) => [
288
- getAllPatternsDependants( state ),
285
+ getAllPatternsDependants( select )( state ),
289
286
  state.settings.allowedBlockTypes,
290
287
  state.settings.templateLock,
291
288
  state.blockListSettings[ rootClientId ],
@@ -325,12 +322,12 @@ export const getAllPatterns = createRegistrySelector( ( select ) =>
325
322
  return [
326
323
  ...userPatterns,
327
324
  ...__experimentalBlockPatterns,
328
- ...unlock( select( STORE_NAME ) ).getFetchedPatterns(),
325
+ ...( state.settings[ selectBlockPatternsKey ]?.( select ) ?? [] ),
329
326
  ].filter(
330
327
  ( x, index, arr ) =>
331
328
  index === arr.findIndex( ( y ) => x.name === y.name )
332
329
  );
333
- }, getAllPatternsDependants )
330
+ }, getAllPatternsDependants( select ) )
334
331
  );
335
332
 
336
333
  /**
@@ -344,14 +341,6 @@ export function getLastFocus( state ) {
344
341
  return state.lastFocus;
345
342
  }
346
343
 
347
- export function getAllBlockBindingsSources( state ) {
348
- return state.blockBindingsSources;
349
- }
350
-
351
- export function getBlockBindingsSource( state, sourceName ) {
352
- return state.blockBindingsSources[ sourceName ];
353
- }
354
-
355
344
  /**
356
345
  * Returns true if the user is dragging anything, or false otherwise. It is possible for a
357
346
  * user to be dragging data from outside of the editor, so this selector is separate from
@@ -2050,29 +2050,6 @@ export function lastFocus( state = false, action ) {
2050
2050
  return state;
2051
2051
  }
2052
2052
 
2053
- function blockBindingsSources( state = {}, action ) {
2054
- if ( action.type === 'REGISTER_BLOCK_BINDINGS_SOURCE' ) {
2055
- return {
2056
- ...state,
2057
- [ action.sourceName ]: {
2058
- label: action.sourceLabel,
2059
- useSource: action.useSource,
2060
- lockAttributesEditing: action.lockAttributesEditing ?? true,
2061
- },
2062
- };
2063
- }
2064
- return state;
2065
- }
2066
-
2067
- function blockPatterns( state = [], action ) {
2068
- switch ( action.type ) {
2069
- case 'RECEIVE_BLOCK_PATTERNS':
2070
- return action.patterns;
2071
- }
2072
-
2073
- return state;
2074
- }
2075
-
2076
2053
  const combinedReducers = combineReducers( {
2077
2054
  blocks,
2078
2055
  isDragging,
@@ -2104,8 +2081,6 @@ const combinedReducers = combineReducers( {
2104
2081
  blockRemovalRules,
2105
2082
  openedBlockSettingsMenu,
2106
2083
  registeredInserterMediaCategories,
2107
- blockBindingsSources,
2108
- blockPatterns,
2109
2084
  } );
2110
2085
 
2111
2086
  function withAutomaticChangeReset( reducer ) {
@@ -10,7 +10,6 @@ import {
10
10
  getBlockType,
11
11
  getBlockTypes,
12
12
  getBlockVariations,
13
- getHookedBlocks,
14
13
  hasBlockSupport,
15
14
  getPossibleBlockTransformations,
16
15
  parse,
@@ -1937,16 +1936,9 @@ const buildBlockTypeItem =
1937
1936
  blockType.name,
1938
1937
  'inserter'
1939
1938
  );
1940
-
1941
- const ignoredHookedBlocks = [
1942
- ...new Set( Object.values( getHookedBlocks( id ) ).flat() ),
1943
- ];
1944
-
1945
1939
  return {
1946
1940
  ...blockItemBase,
1947
- initialAttributes: ignoredHookedBlocks.length
1948
- ? { metadata: { ignoredHookedBlocks } }
1949
- : {},
1941
+ initialAttributes: {},
1950
1942
  description: blockType.description,
1951
1943
  category: blockType.category,
1952
1944
  keywords: blockType.keywords,
@@ -2307,12 +2299,12 @@ export const __experimentalGetParsedPattern = createRegistrySelector(
2307
2299
  __unstableSkipMigrationLogs: true,
2308
2300
  } ),
2309
2301
  };
2310
- }, getAllPatternsDependants )
2302
+ }, getAllPatternsDependants( select ) )
2311
2303
  );
2312
2304
 
2313
- const getAllowedPatternsDependants = ( state, rootClientId ) => {
2305
+ const getAllowedPatternsDependants = ( select ) => ( state, rootClientId ) => {
2314
2306
  return [
2315
- ...getAllPatternsDependants( state ),
2307
+ ...getAllPatternsDependants( select )( state ),
2316
2308
  state.settings.allowedBlockTypes,
2317
2309
  state.settings.templateLock,
2318
2310
  state.blockListSettings[ rootClientId ],
@@ -2353,7 +2345,7 @@ export const __experimentalGetAllowedPatterns = createRegistrySelector(
2353
2345
  );
2354
2346
 
2355
2347
  return patternsAllowed;
2356
- }, getAllowedPatternsDependants );
2348
+ }, getAllowedPatternsDependants( select ) );
2357
2349
  }
2358
2350
  );
2359
2351
 
@@ -2392,7 +2384,7 @@ export const getPatternsByBlockTypes = createRegistrySelector( ( select ) =>
2392
2384
  return filteredPatterns;
2393
2385
  },
2394
2386
  ( state, blockNames, rootClientId ) =>
2395
- getAllowedPatternsDependants( state, rootClientId )
2387
+ getAllowedPatternsDependants( select )( state, rootClientId )
2396
2388
  )
2397
2389
  );
2398
2390
 
@@ -2466,7 +2458,7 @@ export const __experimentalGetPatternTransformItems = createRegistrySelector(
2466
2458
  );
2467
2459
  },
2468
2460
  ( state, blocks, rootClientId ) =>
2469
- getAllowedPatternsDependants( state, rootClientId )
2461
+ getAllowedPatternsDependants( select )( state, rootClientId )
2470
2462
  )
2471
2463
  );
2472
2464
 
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Internal dependencies
3
+ */
4
+ import { selectBlockPatternsKey } from './private-keys';
5
+
1
6
  export const checkAllowList = ( list, item, defaultResult = null ) => {
2
7
  if ( typeof list === 'boolean' ) {
3
8
  return list;
@@ -40,12 +45,12 @@ export const checkAllowListRecursive = ( blocks, allowedBlockTypes ) => {
40
45
  return true;
41
46
  };
42
47
 
43
- export const getAllPatternsDependants = ( state ) => {
48
+ export const getAllPatternsDependants = ( select ) => ( state ) => {
44
49
  return [
45
50
  state.settings.__experimentalBlockPatterns,
46
51
  state.settings.__experimentalUserPatternCategories,
47
52
  state.settings.__experimentalReusableBlocks,
48
- state.settings.__experimentalFetchBlockPatterns,
53
+ state.settings[ selectBlockPatternsKey ]?.( select ),
49
54
  state.blockPatterns,
50
55
  ];
51
56
  };
@@ -1,27 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.getFetchedPatterns = void 0;
7
- const getFetchedPatterns = () => async ({
8
- dispatch,
9
- select
10
- }) => {
11
- const {
12
- __experimentalFetchBlockPatterns
13
- } = select.getSettings();
14
- if (!__experimentalFetchBlockPatterns) {
15
- return [];
16
- }
17
- const patterns = await __experimentalFetchBlockPatterns();
18
- dispatch({
19
- type: 'RECEIVE_BLOCK_PATTERNS',
20
- patterns
21
- });
22
- };
23
- exports.getFetchedPatterns = getFetchedPatterns;
24
- getFetchedPatterns.shouldInvalidate = action => {
25
- return action.type === 'UPDATE_SETTINGS' && !!action.settings.__experimentalFetchBlockPatterns;
26
- };
27
- //# sourceMappingURL=resolvers.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["getFetchedPatterns","dispatch","select","__experimentalFetchBlockPatterns","getSettings","patterns","type","exports","shouldInvalidate","action","settings"],"sources":["@wordpress/block-editor/src/store/resolvers.js"],"sourcesContent":["export const getFetchedPatterns =\n\t() =>\n\tasync ( { dispatch, select } ) => {\n\t\tconst { __experimentalFetchBlockPatterns } = select.getSettings();\n\t\tif ( ! __experimentalFetchBlockPatterns ) {\n\t\t\treturn [];\n\t\t}\n\t\tconst patterns = await __experimentalFetchBlockPatterns();\n\t\tdispatch( { type: 'RECEIVE_BLOCK_PATTERNS', patterns } );\n\t};\n\ngetFetchedPatterns.shouldInvalidate = ( action ) => {\n\treturn (\n\t\taction.type === 'UPDATE_SETTINGS' &&\n\t\t!! action.settings.__experimentalFetchBlockPatterns\n\t);\n};\n"],"mappings":";;;;;;AAAO,MAAMA,kBAAkB,GAC9BA,CAAA,KACA,OAAQ;EAAEC,QAAQ;EAAEC;AAAO,CAAC,KAAM;EACjC,MAAM;IAAEC;EAAiC,CAAC,GAAGD,MAAM,CAACE,WAAW,CAAC,CAAC;EACjE,IAAK,CAAED,gCAAgC,EAAG;IACzC,OAAO,EAAE;EACV;EACA,MAAME,QAAQ,GAAG,MAAMF,gCAAgC,CAAC,CAAC;EACzDF,QAAQ,CAAE;IAAEK,IAAI,EAAE,wBAAwB;IAAED;EAAS,CAAE,CAAC;AACzD,CAAC;AAACE,OAAA,CAAAP,kBAAA,GAAAA,kBAAA;AAEHA,kBAAkB,CAACQ,gBAAgB,GAAKC,MAAM,IAAM;EACnD,OACCA,MAAM,CAACH,IAAI,KAAK,iBAAiB,IACjC,CAAC,CAAEG,MAAM,CAACC,QAAQ,CAACP,gCAAgC;AAErD,CAAC"}
@@ -1,20 +0,0 @@
1
- export const getFetchedPatterns = () => async ({
2
- dispatch,
3
- select
4
- }) => {
5
- const {
6
- __experimentalFetchBlockPatterns
7
- } = select.getSettings();
8
- if (!__experimentalFetchBlockPatterns) {
9
- return [];
10
- }
11
- const patterns = await __experimentalFetchBlockPatterns();
12
- dispatch({
13
- type: 'RECEIVE_BLOCK_PATTERNS',
14
- patterns
15
- });
16
- };
17
- getFetchedPatterns.shouldInvalidate = action => {
18
- return action.type === 'UPDATE_SETTINGS' && !!action.settings.__experimentalFetchBlockPatterns;
19
- };
20
- //# sourceMappingURL=resolvers.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["getFetchedPatterns","dispatch","select","__experimentalFetchBlockPatterns","getSettings","patterns","type","shouldInvalidate","action","settings"],"sources":["@wordpress/block-editor/src/store/resolvers.js"],"sourcesContent":["export const getFetchedPatterns =\n\t() =>\n\tasync ( { dispatch, select } ) => {\n\t\tconst { __experimentalFetchBlockPatterns } = select.getSettings();\n\t\tif ( ! __experimentalFetchBlockPatterns ) {\n\t\t\treturn [];\n\t\t}\n\t\tconst patterns = await __experimentalFetchBlockPatterns();\n\t\tdispatch( { type: 'RECEIVE_BLOCK_PATTERNS', patterns } );\n\t};\n\ngetFetchedPatterns.shouldInvalidate = ( action ) => {\n\treturn (\n\t\taction.type === 'UPDATE_SETTINGS' &&\n\t\t!! action.settings.__experimentalFetchBlockPatterns\n\t);\n};\n"],"mappings":"AAAA,OAAO,MAAMA,kBAAkB,GAC9BA,CAAA,KACA,OAAQ;EAAEC,QAAQ;EAAEC;AAAO,CAAC,KAAM;EACjC,MAAM;IAAEC;EAAiC,CAAC,GAAGD,MAAM,CAACE,WAAW,CAAC,CAAC;EACjE,IAAK,CAAED,gCAAgC,EAAG;IACzC,OAAO,EAAE;EACV;EACA,MAAME,QAAQ,GAAG,MAAMF,gCAAgC,CAAC,CAAC;EACzDF,QAAQ,CAAE;IAAEK,IAAI,EAAE,wBAAwB;IAAED;EAAS,CAAE,CAAC;AACzD,CAAC;AAEFL,kBAAkB,CAACO,gBAAgB,GAAKC,MAAM,IAAM;EACnD,OACCA,MAAM,CAACF,IAAI,KAAK,iBAAiB,IACjC,CAAC,CAAEE,MAAM,CAACC,QAAQ,CAACN,gCAAgC;AAErD,CAAC"}
@@ -1,17 +0,0 @@
1
- export const getFetchedPatterns =
2
- () =>
3
- async ( { dispatch, select } ) => {
4
- const { __experimentalFetchBlockPatterns } = select.getSettings();
5
- if ( ! __experimentalFetchBlockPatterns ) {
6
- return [];
7
- }
8
- const patterns = await __experimentalFetchBlockPatterns();
9
- dispatch( { type: 'RECEIVE_BLOCK_PATTERNS', patterns } );
10
- };
11
-
12
- getFetchedPatterns.shouldInvalidate = ( action ) => {
13
- return (
14
- action.type === 'UPDATE_SETTINGS' &&
15
- !! action.settings.__experimentalFetchBlockPatterns
16
- );
17
- };