@wordpress/block-editor 12.3.3 → 12.3.5

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 (92) hide show
  1. package/README.md +4 -0
  2. package/build/components/block-edit/edit.js +25 -13
  3. package/build/components/block-edit/edit.js.map +1 -1
  4. package/build/components/block-mobile-toolbar/block-actions-menu.native.js +3 -6
  5. package/build/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
  6. package/build/components/block-parent-selector/index.js +8 -5
  7. package/build/components/block-parent-selector/index.js.map +1 -1
  8. package/build/components/block-removal-warning-modal/index.js +5 -2
  9. package/build/components/block-removal-warning-modal/index.js.map +1 -1
  10. package/build/components/block-tools/block-contextual-toolbar.js +7 -11
  11. package/build/components/block-tools/block-contextual-toolbar.js.map +1 -1
  12. package/build/components/global-styles/filters-panel.js +1 -1
  13. package/build/components/global-styles/filters-panel.js.map +1 -1
  14. package/build/components/index.js +10 -1
  15. package/build/components/index.js.map +1 -1
  16. package/build/components/inserter/block-patterns-explorer/patterns-list.js +2 -2
  17. package/build/components/inserter/block-patterns-explorer/patterns-list.js.map +1 -1
  18. package/build/components/inserter/block-patterns-tab.js +7 -35
  19. package/build/components/inserter/block-patterns-tab.js.map +1 -1
  20. package/build/components/inserter/hooks/use-block-types-state.js +3 -4
  21. package/build/components/inserter/hooks/use-block-types-state.js.map +1 -1
  22. package/build/components/inserter/hooks/use-patterns-state.js +9 -3
  23. package/build/components/inserter/hooks/use-patterns-state.js.map +1 -1
  24. package/build/components/inserter/reusable-block-rename-hint.js +62 -0
  25. package/build/components/inserter/reusable-block-rename-hint.js.map +1 -0
  26. package/build/components/inserter/reusable-blocks-tab.js +6 -2
  27. package/build/components/inserter/reusable-blocks-tab.js.map +1 -1
  28. package/build/components/list-view/use-list-view-client-ids.js +2 -2
  29. package/build/components/list-view/use-list-view-client-ids.js.map +1 -1
  30. package/build/store/private-selectors.js +5 -6
  31. package/build/store/private-selectors.js.map +1 -1
  32. package/build/store/selectors.js +33 -15
  33. package/build/store/selectors.js.map +1 -1
  34. package/build-module/components/block-edit/edit.js +27 -10
  35. package/build-module/components/block-edit/edit.js.map +1 -1
  36. package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js +4 -6
  37. package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
  38. package/build-module/components/block-parent-selector/index.js +7 -5
  39. package/build-module/components/block-parent-selector/index.js.map +1 -1
  40. package/build-module/components/block-removal-warning-modal/index.js +6 -3
  41. package/build-module/components/block-removal-warning-modal/index.js.map +1 -1
  42. package/build-module/components/block-tools/block-contextual-toolbar.js +8 -11
  43. package/build-module/components/block-tools/block-contextual-toolbar.js.map +1 -1
  44. package/build-module/components/global-styles/filters-panel.js +2 -2
  45. package/build-module/components/global-styles/filters-panel.js.map +1 -1
  46. package/build-module/components/index.js +5 -0
  47. package/build-module/components/index.js.map +1 -1
  48. package/build-module/components/inserter/block-patterns-explorer/patterns-list.js +2 -2
  49. package/build-module/components/inserter/block-patterns-explorer/patterns-list.js.map +1 -1
  50. package/build-module/components/inserter/block-patterns-tab.js +7 -33
  51. package/build-module/components/inserter/block-patterns-tab.js.map +1 -1
  52. package/build-module/components/inserter/hooks/use-block-types-state.js +3 -4
  53. package/build-module/components/inserter/hooks/use-block-types-state.js.map +1 -1
  54. package/build-module/components/inserter/hooks/use-patterns-state.js +9 -3
  55. package/build-module/components/inserter/hooks/use-patterns-state.js.map +1 -1
  56. package/build-module/components/inserter/reusable-block-rename-hint.js +48 -0
  57. package/build-module/components/inserter/reusable-block-rename-hint.js.map +1 -0
  58. package/build-module/components/inserter/reusable-blocks-tab.js +5 -2
  59. package/build-module/components/inserter/reusable-blocks-tab.js.map +1 -1
  60. package/build-module/components/list-view/use-list-view-client-ids.js +2 -2
  61. package/build-module/components/list-view/use-list-view-client-ids.js.map +1 -1
  62. package/build-module/store/private-selectors.js +3 -3
  63. package/build-module/store/private-selectors.js.map +1 -1
  64. package/build-module/store/selectors.js +33 -15
  65. package/build-module/store/selectors.js.map +1 -1
  66. package/build-style/content-rtl.css +3 -0
  67. package/build-style/content.css +3 -0
  68. package/build-style/style-rtl.css +72 -22
  69. package/build-style/style.css +72 -22
  70. package/package.json +9 -9
  71. package/src/components/block-edit/edit.js +26 -9
  72. package/src/components/block-edit/test/edit.js +1 -1
  73. package/src/components/block-mobile-toolbar/block-actions-menu.native.js +4 -8
  74. package/src/components/block-parent-selector/index.js +13 -8
  75. package/src/components/block-removal-warning-modal/index.js +7 -6
  76. package/src/components/block-tools/block-contextual-toolbar.js +5 -11
  77. package/src/components/block-tools/style.scss +69 -26
  78. package/src/components/default-block-appender/content.scss +11 -0
  79. package/src/components/global-styles/filters-panel.js +2 -2
  80. package/src/components/index.js +5 -0
  81. package/src/components/inserter/block-patterns-explorer/patterns-list.js +8 -2
  82. package/src/components/inserter/block-patterns-tab.js +8 -56
  83. package/src/components/inserter/hooks/use-block-types-state.js +3 -4
  84. package/src/components/inserter/hooks/use-patterns-state.js +35 -19
  85. package/src/components/inserter/reusable-block-rename-hint.js +52 -0
  86. package/src/components/inserter/reusable-blocks-tab.js +5 -1
  87. package/src/components/inserter/style.scss +28 -0
  88. package/src/components/list-view/style.scss +1 -2
  89. package/src/components/list-view/use-list-view-client-ids.js +2 -2
  90. package/src/store/private-selectors.js +3 -6
  91. package/src/store/selectors.js +54 -20
  92. package/src/store/test/private-selectors.js +5 -5
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAIA;;AAIA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAMA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AASA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAIA;;AAIA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAIA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AAIA;;AACA;;AACA;;AACA;;AACA;;AAIA;;AACA;;AACA;;AAMA;;AACA","sourcesContent":["/*\n * Block Creation Components\n */\n\nexport * from './colors';\nexport * from './gradients';\nexport * from './font-sizes';\nexport * from './duotone';\nexport { AlignmentControl, AlignmentToolbar } from './alignment-control';\nexport { default as Autocomplete } from './autocomplete';\nexport {\n\tBlockAlignmentControl,\n\tBlockAlignmentToolbar,\n} from './block-alignment-control';\nexport { default as __experimentalBlockFullHeightAligmentControl } from './block-full-height-alignment-control';\nexport { default as __experimentalBlockAlignmentMatrixControl } from './block-alignment-matrix-control';\nexport { default as BlockBreadcrumb } from './block-breadcrumb';\nexport { default as __experimentalUseBlockOverlayActive } from './block-content-overlay';\nexport { BlockContextProvider } from './block-context';\nexport {\n\tdefault as BlockControls,\n\tBlockFormatControls,\n} from './block-controls';\nexport { default as BlockColorsStyleSelector } from './color-style-selector';\nexport { default as BlockEdit, useBlockEditContext } from './block-edit';\nexport { default as BlockIcon } from './block-icon';\nexport { default as BlockNavigationDropdown } from './block-navigation/dropdown';\nexport { default as BlockStyles } from './block-styles';\nexport { default as HeadingLevelDropdown } from './block-heading-level-dropdown';\nexport { default as __experimentalBlockVariationPicker } from './block-variation-picker';\nexport { default as __experimentalBlockPatternSetup } from './block-pattern-setup';\nexport { default as __experimentalBlockVariationTransforms } from './block-variation-transforms';\nexport {\n\tBlockVerticalAlignmentToolbar,\n\tBlockVerticalAlignmentControl,\n} from './block-vertical-alignment-control';\nexport { default as __experimentalBorderRadiusControl } from './border-radius-control';\nexport {\n\t// This is a typo, but kept here for back-compat.\n\tButtonBlockerAppender,\n\tdefault as ButtonBlockAppender,\n} from './button-block-appender';\nexport { default as ColorPalette } from './color-palette';\nexport { default as ColorPaletteControl } from './color-palette/control';\nexport { default as ContrastChecker } from './contrast-checker';\nexport { default as __experimentalDateFormatPicker } from './date-format-picker';\nexport { default as __experimentalDuotoneControl } from './duotone-control';\nexport { default as __experimentalFontAppearanceControl } from './font-appearance-control';\nexport { default as __experimentalFontFamilyControl } from './font-family';\nexport { default as __experimentalLetterSpacingControl } from './letter-spacing-control';\nexport { default as __experimentalTextDecorationControl } from './text-decoration-control';\nexport { default as __experimentalTextTransformControl } from './text-transform-control';\nexport { default as __experimentalColorGradientControl } from './colors-gradients/control';\nexport { default as __experimentalColorGradientSettingsDropdown } from './colors-gradients/dropdown';\nexport { default as __experimentalPanelColorGradientSettings } from './colors-gradients/panel-color-gradient-settings';\nexport { default as __experimentalUseMultipleOriginColorsAndGradients } from './colors-gradients/use-multiple-origin-colors-and-gradients';\nexport { default as HeightControl } from './height-control';\nexport { default as __experimentalImageEditor } from './image-editor';\nexport { default as __experimentalImageSizeControl } from './image-size-control';\nexport { default as InnerBlocks, useInnerBlocksProps } from './inner-blocks';\nexport {\n\tdefault as InspectorControls,\n\tInspectorAdvancedControls,\n} from './inspector-controls';\nexport {\n\tJustifyToolbar,\n\tJustifyContentControl,\n} from './justify-content-control';\nexport { default as __experimentalLinkControl } from './link-control';\nexport { default as __experimentalLinkControlSearchInput } from './link-control/search-input';\nexport { default as __experimentalLinkControlSearchResults } from './link-control/search-results';\nexport { default as __experimentalLinkControlSearchItem } from './link-control/search-item';\nexport { default as LineHeightControl } from './line-height-control';\nexport { default as __experimentalListView } from './list-view';\nexport { default as MediaReplaceFlow } from './media-replace-flow';\nexport { default as MediaPlaceholder } from './media-placeholder';\nexport { default as MediaUpload } from './media-upload';\nexport { default as MediaUploadCheck } from './media-upload/check';\nexport { default as PanelColorSettings } from './panel-color-settings';\nexport { default as PlainText } from './plain-text';\nexport { default as __experimentalResponsiveBlockControl } from './responsive-block-control';\nexport {\n\tdefault as RichText,\n\tRichTextShortcut,\n\tRichTextToolbarButton,\n\t__unstableRichTextInputEvent,\n} from './rich-text';\nexport { default as ToolSelector } from './tool-selector';\nexport { default as __experimentalUnitControl } from './unit-control';\nexport { default as URLInput } from './url-input';\nexport { default as URLInputButton } from './url-input/button';\nexport { default as URLPopover } from './url-popover';\nexport { __experimentalImageURLInputUI } from './url-popover/image-url-input-ui';\nexport { default as withColorContext } from './color-palette/with-color-context';\nexport { default as __experimentalSpacingSizesControl } from './spacing-sizes-control';\nexport {\n\tgetSpacingPresetCssVar,\n\tisValueSpacingPreset,\n\tgetCustomValueFromPreset,\n} from './spacing-sizes-control/utils';\n/*\n * Content Related Components\n */\n\nexport { default as __unstableBlockSettingsMenuFirstItem } from './block-settings-menu/block-settings-menu-first-item';\nexport { default as __unstableBlockToolbarLastItem } from './block-toolbar/block-toolbar-last-item';\nexport { default as __unstableBlockNameContext } from './block-toolbar/block-name-context';\nexport { default as __unstableInserterMenuExtension } from './inserter-menu-extension';\nexport { default as __experimentalPreviewOptions } from './preview-options';\nexport { default as __experimentalUseResizeCanvas } from './use-resize-canvas';\nexport { default as BlockInspector } from './block-inspector';\nexport { default as BlockList } from './block-list';\nexport { useBlockProps } from './block-list/use-block-props';\nexport { default as BlockMover } from './block-mover';\nexport {\n\tdefault as BlockPreview,\n\tuseBlockPreview as __experimentalUseBlockPreview,\n} from './block-preview';\nexport {\n\tdefault as BlockSelectionClearer,\n\tuseBlockSelectionClearer as __unstableUseBlockSelectionClearer,\n} from './block-selection-clearer';\nexport { default as BlockSettingsMenu } from './block-settings-menu';\nexport { default as BlockSettingsMenuControls } from './block-settings-menu-controls';\nexport { default as BlockTitle } from './block-title';\nexport { default as BlockToolbar } from './block-toolbar';\nexport { default as BlockTools } from './block-tools';\nexport {\n\tdefault as CopyHandler,\n\tuseClipboardHandler as __unstableUseClipboardHandler,\n} from './copy-handler';\nexport { default as DefaultBlockAppender } from './default-block-appender';\nexport { default as __unstableEditorStyles } from './editor-styles';\nexport { default as Inserter } from './inserter';\nexport { default as __experimentalLibrary } from './inserter/library';\nexport { default as BlockEditorKeyboardShortcuts } from './keyboard-shortcuts';\nexport { MultiSelectScrollIntoView } from './selection-scroll-into-view';\nexport { default as NavigableToolbar } from './navigable-toolbar';\nexport {\n\tdefault as ObserveTyping,\n\tuseTypingObserver as __unstableUseTypingObserver,\n\tuseMouseMoveTypingReset as __unstableUseMouseMoveTypingReset,\n} from './observe-typing';\nexport { default as SkipToSelectedBlock } from './skip-to-selected-block';\nexport {\n\tdefault as Typewriter,\n\tuseTypewriter as __unstableUseTypewriter,\n} from './typewriter';\nexport { default as Warning } from './warning';\nexport { default as WritingFlow } from './writing-flow';\nexport { default as useBlockDisplayInformation } from './use-block-display-information';\nexport { default as __unstableIframe } from './iframe';\nexport {\n\tRecursionProvider as __experimentalRecursionProvider,\n\tuseHasRecursion as __experimentalUseHasRecursion,\n} from './recursion-provider';\nexport { default as __experimentalBlockPatternsList } from './block-patterns-list';\nexport { default as __experimentalPublishDateTimePicker } from './publish-date-time-picker';\nexport { default as __experimentalInspectorPopoverHeader } from './inspector-popover-header';\n\n/*\n * State Related Components\n */\n\nexport { default as BlockEditorProvider } from './provider';\nexport { default as useSetting } from './use-setting';\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AACA;;AAIA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAIA;;AAIA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAMA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AASA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAIA;;AAIA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAIA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AAIA;;AACA;;AACA;;AACA;;AACA;;AAIA;;AACA;;AACA;;AAMA;;AACA;;AAKA","sourcesContent":["/*\n * Block Creation Components\n */\n\nexport * from './colors';\nexport * from './gradients';\nexport * from './font-sizes';\nexport * from './duotone';\nexport { AlignmentControl, AlignmentToolbar } from './alignment-control';\nexport { default as Autocomplete } from './autocomplete';\nexport {\n\tBlockAlignmentControl,\n\tBlockAlignmentToolbar,\n} from './block-alignment-control';\nexport { default as __experimentalBlockFullHeightAligmentControl } from './block-full-height-alignment-control';\nexport { default as __experimentalBlockAlignmentMatrixControl } from './block-alignment-matrix-control';\nexport { default as BlockBreadcrumb } from './block-breadcrumb';\nexport { default as __experimentalUseBlockOverlayActive } from './block-content-overlay';\nexport { BlockContextProvider } from './block-context';\nexport {\n\tdefault as BlockControls,\n\tBlockFormatControls,\n} from './block-controls';\nexport { default as BlockColorsStyleSelector } from './color-style-selector';\nexport { default as BlockEdit, useBlockEditContext } from './block-edit';\nexport { default as BlockIcon } from './block-icon';\nexport { default as BlockNavigationDropdown } from './block-navigation/dropdown';\nexport { default as BlockStyles } from './block-styles';\nexport { default as HeadingLevelDropdown } from './block-heading-level-dropdown';\nexport { default as __experimentalBlockVariationPicker } from './block-variation-picker';\nexport { default as __experimentalBlockPatternSetup } from './block-pattern-setup';\nexport { default as __experimentalBlockVariationTransforms } from './block-variation-transforms';\nexport {\n\tBlockVerticalAlignmentToolbar,\n\tBlockVerticalAlignmentControl,\n} from './block-vertical-alignment-control';\nexport { default as __experimentalBorderRadiusControl } from './border-radius-control';\nexport {\n\t// This is a typo, but kept here for back-compat.\n\tButtonBlockerAppender,\n\tdefault as ButtonBlockAppender,\n} from './button-block-appender';\nexport { default as ColorPalette } from './color-palette';\nexport { default as ColorPaletteControl } from './color-palette/control';\nexport { default as ContrastChecker } from './contrast-checker';\nexport { default as __experimentalDateFormatPicker } from './date-format-picker';\nexport { default as __experimentalDuotoneControl } from './duotone-control';\nexport { default as __experimentalFontAppearanceControl } from './font-appearance-control';\nexport { default as __experimentalFontFamilyControl } from './font-family';\nexport { default as __experimentalLetterSpacingControl } from './letter-spacing-control';\nexport { default as __experimentalTextDecorationControl } from './text-decoration-control';\nexport { default as __experimentalTextTransformControl } from './text-transform-control';\nexport { default as __experimentalColorGradientControl } from './colors-gradients/control';\nexport { default as __experimentalColorGradientSettingsDropdown } from './colors-gradients/dropdown';\nexport { default as __experimentalPanelColorGradientSettings } from './colors-gradients/panel-color-gradient-settings';\nexport { default as __experimentalUseMultipleOriginColorsAndGradients } from './colors-gradients/use-multiple-origin-colors-and-gradients';\nexport { default as HeightControl } from './height-control';\nexport { default as __experimentalImageEditor } from './image-editor';\nexport { default as __experimentalImageSizeControl } from './image-size-control';\nexport { default as InnerBlocks, useInnerBlocksProps } from './inner-blocks';\nexport {\n\tdefault as InspectorControls,\n\tInspectorAdvancedControls,\n} from './inspector-controls';\nexport {\n\tJustifyToolbar,\n\tJustifyContentControl,\n} from './justify-content-control';\nexport { default as __experimentalLinkControl } from './link-control';\nexport { default as __experimentalLinkControlSearchInput } from './link-control/search-input';\nexport { default as __experimentalLinkControlSearchResults } from './link-control/search-results';\nexport { default as __experimentalLinkControlSearchItem } from './link-control/search-item';\nexport { default as LineHeightControl } from './line-height-control';\nexport { default as __experimentalListView } from './list-view';\nexport { default as MediaReplaceFlow } from './media-replace-flow';\nexport { default as MediaPlaceholder } from './media-placeholder';\nexport { default as MediaUpload } from './media-upload';\nexport { default as MediaUploadCheck } from './media-upload/check';\nexport { default as PanelColorSettings } from './panel-color-settings';\nexport { default as PlainText } from './plain-text';\nexport { default as __experimentalResponsiveBlockControl } from './responsive-block-control';\nexport {\n\tdefault as RichText,\n\tRichTextShortcut,\n\tRichTextToolbarButton,\n\t__unstableRichTextInputEvent,\n} from './rich-text';\nexport { default as ToolSelector } from './tool-selector';\nexport { default as __experimentalUnitControl } from './unit-control';\nexport { default as URLInput } from './url-input';\nexport { default as URLInputButton } from './url-input/button';\nexport { default as URLPopover } from './url-popover';\nexport { __experimentalImageURLInputUI } from './url-popover/image-url-input-ui';\nexport { default as withColorContext } from './color-palette/with-color-context';\nexport { default as __experimentalSpacingSizesControl } from './spacing-sizes-control';\nexport {\n\tgetSpacingPresetCssVar,\n\tisValueSpacingPreset,\n\tgetCustomValueFromPreset,\n} from './spacing-sizes-control/utils';\n/*\n * Content Related Components\n */\n\nexport { default as __unstableBlockSettingsMenuFirstItem } from './block-settings-menu/block-settings-menu-first-item';\nexport { default as __unstableBlockToolbarLastItem } from './block-toolbar/block-toolbar-last-item';\nexport { default as __unstableBlockNameContext } from './block-toolbar/block-name-context';\nexport { default as __unstableInserterMenuExtension } from './inserter-menu-extension';\nexport { default as __experimentalPreviewOptions } from './preview-options';\nexport { default as __experimentalUseResizeCanvas } from './use-resize-canvas';\nexport { default as BlockInspector } from './block-inspector';\nexport { default as BlockList } from './block-list';\nexport { useBlockProps } from './block-list/use-block-props';\nexport { default as BlockMover } from './block-mover';\nexport {\n\tdefault as BlockPreview,\n\tuseBlockPreview as __experimentalUseBlockPreview,\n} from './block-preview';\nexport {\n\tdefault as BlockSelectionClearer,\n\tuseBlockSelectionClearer as __unstableUseBlockSelectionClearer,\n} from './block-selection-clearer';\nexport { default as BlockSettingsMenu } from './block-settings-menu';\nexport { default as BlockSettingsMenuControls } from './block-settings-menu-controls';\nexport { default as BlockTitle } from './block-title';\nexport { default as BlockToolbar } from './block-toolbar';\nexport { default as BlockTools } from './block-tools';\nexport {\n\tdefault as CopyHandler,\n\tuseClipboardHandler as __unstableUseClipboardHandler,\n} from './copy-handler';\nexport { default as DefaultBlockAppender } from './default-block-appender';\nexport { default as __unstableEditorStyles } from './editor-styles';\nexport { default as Inserter } from './inserter';\nexport { default as __experimentalLibrary } from './inserter/library';\nexport { default as BlockEditorKeyboardShortcuts } from './keyboard-shortcuts';\nexport { MultiSelectScrollIntoView } from './selection-scroll-into-view';\nexport { default as NavigableToolbar } from './navigable-toolbar';\nexport {\n\tdefault as ObserveTyping,\n\tuseTypingObserver as __unstableUseTypingObserver,\n\tuseMouseMoveTypingReset as __unstableUseMouseMoveTypingReset,\n} from './observe-typing';\nexport { default as SkipToSelectedBlock } from './skip-to-selected-block';\nexport {\n\tdefault as Typewriter,\n\tuseTypewriter as __unstableUseTypewriter,\n} from './typewriter';\nexport { default as Warning } from './warning';\nexport { default as WritingFlow } from './writing-flow';\nexport { default as useBlockDisplayInformation } from './use-block-display-information';\nexport { default as __unstableIframe } from './iframe';\nexport {\n\tRecursionProvider as __experimentalRecursionProvider,\n\tuseHasRecursion as __experimentalUseHasRecursion,\n} from './recursion-provider';\nexport { default as __experimentalBlockPatternsList } from './block-patterns-list';\nexport { default as __experimentalPublishDateTimePicker } from './publish-date-time-picker';\nexport { default as __experimentalInspectorPopoverHeader } from './inspector-popover-header';\n\n/*\n * State Related Components\n */\n\nexport { default as BlockEditorProvider } from './provider';\nexport { default as useSetting } from './use-setting';\n\n/*\n * The following rename hint component can be removed in 6.4.\n */\nexport { default as ReusableBlocksRenameHint } from './inserter/reusable-block-rename-hint';\n"]}
@@ -72,7 +72,7 @@ function PatternList({
72
72
  }
73
73
 
74
74
  return (0, _searchItems.searchItems)(allPatterns, filterValue);
75
- }, [filterValue, selectedCategory, allPatterns]); // Announce search results on change.
75
+ }, [filterValue, allPatterns, selectedCategory, registeredPatternCategories]); // Announce search results on change.
76
76
 
77
77
  (0, _element.useEffect)(() => {
78
78
  if (!filterValue) {
@@ -84,7 +84,7 @@ function PatternList({
84
84
  /* translators: %d: number of results. */
85
85
  (0, _i18n._n)('%d result found.', '%d results found.', count), count);
86
86
  debouncedSpeak(resultsFoundMessage);
87
- }, [filterValue, debouncedSpeak]);
87
+ }, [filterValue, debouncedSpeak, filteredBlockPatterns.length]);
88
88
  const currentShownPatterns = (0, _compose.useAsyncList)(filteredBlockPatterns, {
89
89
  step: INITIAL_INSERTER_RESULTS
90
90
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/inserter/block-patterns-explorer/patterns-list.js"],"names":["INITIAL_INSERTER_RESULTS","PatternsListHeader","filterValue","filteredBlockPatternsLength","PatternList","selectedCategory","patternCategories","debouncedSpeak","speak","destinationRootClientId","onInsertBlocks","shouldFocusBlock","allPatterns","onSelectBlockPattern","registeredPatternCategories","map","patternCategory","name","filteredBlockPatterns","filter","pattern","categories","length","every","category","includes","count","resultsFoundMessage","currentShownPatterns","step","hasItems"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAjBA;AACA;AACA;;AAOA;AACA;AACA;AAQA,MAAMA,wBAAwB,GAAG,CAAjC;;AAEA,SAASC,kBAAT,CAA6B;AAAEC,EAAAA,WAAF;AAAeC,EAAAA;AAAf,CAA7B,EAA4E;AAC3E,MAAK,CAAED,WAAP,EAAqB;AACpB,WAAO,IAAP;AACA;;AACD,SACC,4BAAC,iCAAD;AACC,IAAA,KAAK,EAAG,CADT;AAEC,IAAA,UAAU,EAAG,MAFd;AAGC,IAAA,SAAS,EAAC;AAHX,KAKG;AACD;AACA,gBACC,+BADD,EAEC,gCAFD,EAGCC,2BAHD,CAFC,EAODA,2BAPC,EAQDD,WARC,CALH,CADD;AAkBA;;AAED,SAASE,WAAT,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5B;AAKAnB,IAAAA,cAAc,CAAEoB,mBAAF,CAAd;AACA,GAXD,EAWG,CAAEzB,WAAF,EAAeK,cAAf,CAXH;AAaA,QAAMqB,oBAAoB,GAAG,2BAAcV,qBAAd,EAAqC;AACjEW,IAAAA,IAAI,EAAE7B;AAD2D,GAArC,CAA7B;AAIA,QAAM8B,QAAQ,GAAG,CAAC,CAAEZ,qBAAqB,EAAEI,MAA3C;AACA,SACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACGQ,QAAQ,IACT,4BAAC,kBAAD;AACC,IAAA,WAAW,EAAG5B,WADf;AAEC,IAAA,2BAA2B,EAAGgB,qBAAqB,CAACI;AAFrD,IAFF,EAOC,4BAAC,wBAAD,QACG,CAAEQ,QAAF,IAAc,4BAAC,kBAAD,OADjB,EAEGA,QAAQ,IACT,4BAAC,0BAAD;AACC,IAAA,aAAa,EAAGF,oBADjB;AAEC,IAAA,aAAa,EAAGV,qBAFjB;AAGC,IAAA,cAAc,EAAGL,oBAHlB;AAIC,IAAA,WAAW,EAAG;AAJf,IAHF,CAPD,CADD;AAqBA;;eAEcT,W","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo, useEffect } from '@wordpress/element';\nimport { _n, sprintf } from '@wordpress/i18n';\nimport { useDebounce, useAsyncList } from '@wordpress/compose';\nimport { __experimentalHeading as Heading } from '@wordpress/components';\nimport { speak } from '@wordpress/a11y';\n\n/**\n * Internal dependencies\n */\nimport BlockPatternsList from '../../block-patterns-list';\nimport InserterNoResults from '../no-results';\nimport useInsertionPoint from '../hooks/use-insertion-point';\nimport usePatternsState from '../hooks/use-patterns-state';\nimport InserterListbox from '../../inserter-listbox';\nimport { searchItems } from '../search-items';\n\nconst INITIAL_INSERTER_RESULTS = 2;\n\nfunction PatternsListHeader( { filterValue, filteredBlockPatternsLength } ) {\n\tif ( ! filterValue ) {\n\t\treturn null;\n\t}\n\treturn (\n\t\t<Heading\n\t\t\tlevel={ 2 }\n\t\t\tlineHeight={ '48px' }\n\t\t\tclassName=\"block-editor-block-patterns-explorer__search-results-count\"\n\t\t>\n\t\t\t{ sprintf(\n\t\t\t\t/* translators: %d: number of patterns. %s: block pattern search query */\n\t\t\t\t_n(\n\t\t\t\t\t'%1$d pattern found for \"%2$s\"',\n\t\t\t\t\t'%1$d patterns found for \"%2$s\"',\n\t\t\t\t\tfilteredBlockPatternsLength\n\t\t\t\t),\n\t\t\t\tfilteredBlockPatternsLength,\n\t\t\t\tfilterValue\n\t\t\t) }\n\t\t</Heading>\n\t);\n}\n\nfunction PatternList( { filterValue, selectedCategory, patternCategories } ) {\n\tconst debouncedSpeak = useDebounce( speak, 500 );\n\tconst [ destinationRootClientId, onInsertBlocks ] = useInsertionPoint( {\n\t\tshouldFocusBlock: true,\n\t} );\n\tconst [ allPatterns, , onSelectBlockPattern ] = usePatternsState(\n\t\tonInsertBlocks,\n\t\tdestinationRootClientId\n\t);\n\tconst registeredPatternCategories = useMemo(\n\t\t() =>\n\t\t\tpatternCategories.map(\n\t\t\t\t( patternCategory ) => patternCategory.name\n\t\t\t),\n\t\t[ patternCategories ]\n\t);\n\n\tconst filteredBlockPatterns = useMemo( () => {\n\t\tif ( ! filterValue ) {\n\t\t\treturn allPatterns.filter( ( pattern ) =>\n\t\t\t\tselectedCategory === 'uncategorized'\n\t\t\t\t\t? ! pattern.categories?.length ||\n\t\t\t\t\t pattern.categories.every(\n\t\t\t\t\t\t\t( category ) =>\n\t\t\t\t\t\t\t\t! registeredPatternCategories.includes(\n\t\t\t\t\t\t\t\t\tcategory\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t )\n\t\t\t\t\t: pattern.categories?.includes( selectedCategory )\n\t\t\t);\n\t\t}\n\t\treturn searchItems( allPatterns, filterValue );\n\t}, [ filterValue, selectedCategory, allPatterns ] );\n\n\t// Announce search results on change.\n\tuseEffect( () => {\n\t\tif ( ! filterValue ) {\n\t\t\treturn;\n\t\t}\n\t\tconst count = filteredBlockPatterns.length;\n\t\tconst resultsFoundMessage = sprintf(\n\t\t\t/* translators: %d: number of results. */\n\t\t\t_n( '%d result found.', '%d results found.', count ),\n\t\t\tcount\n\t\t);\n\t\tdebouncedSpeak( resultsFoundMessage );\n\t}, [ filterValue, debouncedSpeak ] );\n\n\tconst currentShownPatterns = useAsyncList( filteredBlockPatterns, {\n\t\tstep: INITIAL_INSERTER_RESULTS,\n\t} );\n\n\tconst hasItems = !! filteredBlockPatterns?.length;\n\treturn (\n\t\t<div className=\"block-editor-block-patterns-explorer__list\">\n\t\t\t{ hasItems && (\n\t\t\t\t<PatternsListHeader\n\t\t\t\t\tfilterValue={ filterValue }\n\t\t\t\t\tfilteredBlockPatternsLength={ filteredBlockPatterns.length }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t<InserterListbox>\n\t\t\t\t{ ! hasItems && <InserterNoResults /> }\n\t\t\t\t{ hasItems && (\n\t\t\t\t\t<BlockPatternsList\n\t\t\t\t\t\tshownPatterns={ currentShownPatterns }\n\t\t\t\t\t\tblockPatterns={ filteredBlockPatterns }\n\t\t\t\t\t\tonClickPattern={ onSelectBlockPattern }\n\t\t\t\t\t\tisDraggable={ false }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</InserterListbox>\n\t\t</div>\n\t);\n}\n\nexport default PatternList;\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/inserter/block-patterns-explorer/patterns-list.js"],"names":["INITIAL_INSERTER_RESULTS","PatternsListHeader","filterValue","filteredBlockPatternsLength","PatternList","selectedCategory","patternCategories","debouncedSpeak","speak","destinationRootClientId","onInsertBlocks","shouldFocusBlock","allPatterns","onSelectBlockPattern","registeredPatternCategories","map","patternCategory","name","filteredBlockPatterns","filter","pattern","categories","length","every","category","includes","count","resultsFoundMessage","currentShownPatterns","step","hasItems"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAjBA;AACA;AACA;;AAOA;AACA;AACA;AAQA,MAAM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A8BpB,gBAA9B,CATG,CAAP;AAWA;;AACD,WAAO,8BAAaO,WAAb,EAA0BV,WAA1B,CAAP;AACA,GAf6B,EAe3B,CACFA,WADE,EAEFU,WAFE,EAGFP,gBAHE,EAIFS,2BAJE,CAf2B,CAA9B,CAlB4E,CAwC5E;;AACA,0BAAW,MAAM;AAChB,QAAK,CAAEZ,WAAP,EAAqB;AACpB;AACA;;AACD,UAAMwB,KAAK,GAAGR,qBAAqB,CAACI,MAApC;AACA,UAAMK,mBAAmB,GAAG;AAC3B;AACA,kBAAI,kBAAJ,EAAwB,mBAAxB,EAA6CD,KAA7C,CAF2B,EAG3BA,KAH2B,CAA5B;AAKAnB,IAAAA,cAAc,CAAEoB,mBAAF,CAAd;AACA,GAXD,EAWG,CAAEzB,WAAF,EAAeK,cAAf,EAA+BW,qBAAqB,CAACI,MAArD,CAXH;AAaA,QAAMM,oBAAoB,GAAG,2BAAcV,qBAAd,EAAqC;AACjEW,IAAAA,IAAI,EAAE7B;AAD2D,GAArC,CAA7B;AAIA,QAAM8B,QAAQ,GAAG,CAAC,CAAEZ,qBAAqB,EAAEI,MAA3C;AACA,SACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACGQ,QAAQ,IACT,4BAAC,kBAAD;AACC,IAAA,WAAW,EAAG5B,WADf;AAEC,IAAA,2BAA2B,EAAGgB,qBAAqB,CAACI;AAFrD,IAFF,EAOC,4BAAC,wBAAD,QACG,CAAEQ,QAAF,IAAc,4BAAC,kBAAD,OADjB,EAEGA,QAAQ,IACT,4BAAC,0BAAD;AACC,IAAA,aAAa,EAAGF,oBADjB;AAEC,IAAA,aAAa,EAAGV,qBAFjB;AAGC,IAAA,cAAc,EAAGL,oBAHlB;AAIC,IAAA,WAAW,EAAG;AAJf,IAHF,CAPD,CADD;AAqBA;;eAEcT,W","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo, useEffect } from '@wordpress/element';\nimport { _n, sprintf } from '@wordpress/i18n';\nimport { useDebounce, useAsyncList } from '@wordpress/compose';\nimport { __experimentalHeading as Heading } from '@wordpress/components';\nimport { speak } from '@wordpress/a11y';\n\n/**\n * Internal dependencies\n */\nimport BlockPatternsList from '../../block-patterns-list';\nimport InserterNoResults from '../no-results';\nimport useInsertionPoint from '../hooks/use-insertion-point';\nimport usePatternsState from '../hooks/use-patterns-state';\nimport InserterListbox from '../../inserter-listbox';\nimport { searchItems } from '../search-items';\n\nconst INITIAL_INSERTER_RESULTS = 2;\n\nfunction PatternsListHeader( { filterValue, filteredBlockPatternsLength } ) {\n\tif ( ! filterValue ) {\n\t\treturn null;\n\t}\n\treturn (\n\t\t<Heading\n\t\t\tlevel={ 2 }\n\t\t\tlineHeight={ '48px' }\n\t\t\tclassName=\"block-editor-block-patterns-explorer__search-results-count\"\n\t\t>\n\t\t\t{ sprintf(\n\t\t\t\t/* translators: %d: number of patterns. %s: block pattern search query */\n\t\t\t\t_n(\n\t\t\t\t\t'%1$d pattern found for \"%2$s\"',\n\t\t\t\t\t'%1$d patterns found for \"%2$s\"',\n\t\t\t\t\tfilteredBlockPatternsLength\n\t\t\t\t),\n\t\t\t\tfilteredBlockPatternsLength,\n\t\t\t\tfilterValue\n\t\t\t) }\n\t\t</Heading>\n\t);\n}\n\nfunction PatternList( { filterValue, selectedCategory, patternCategories } ) {\n\tconst debouncedSpeak = useDebounce( speak, 500 );\n\tconst [ destinationRootClientId, onInsertBlocks ] = useInsertionPoint( {\n\t\tshouldFocusBlock: true,\n\t} );\n\tconst [ allPatterns, , onSelectBlockPattern ] = usePatternsState(\n\t\tonInsertBlocks,\n\t\tdestinationRootClientId\n\t);\n\n\tconst registeredPatternCategories = useMemo(\n\t\t() =>\n\t\t\tpatternCategories.map(\n\t\t\t\t( patternCategory ) => patternCategory.name\n\t\t\t),\n\t\t[ patternCategories ]\n\t);\n\n\tconst filteredBlockPatterns = useMemo( () => {\n\t\tif ( ! filterValue ) {\n\t\t\treturn allPatterns.filter( ( pattern ) =>\n\t\t\t\tselectedCategory === 'uncategorized'\n\t\t\t\t\t? ! pattern.categories?.length ||\n\t\t\t\t\t pattern.categories.every(\n\t\t\t\t\t\t\t( category ) =>\n\t\t\t\t\t\t\t\t! registeredPatternCategories.includes(\n\t\t\t\t\t\t\t\t\tcategory\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t )\n\t\t\t\t\t: pattern.categories?.includes( selectedCategory )\n\t\t\t);\n\t\t}\n\t\treturn searchItems( allPatterns, filterValue );\n\t}, [\n\t\tfilterValue,\n\t\tallPatterns,\n\t\tselectedCategory,\n\t\tregisteredPatternCategories,\n\t] );\n\n\t// Announce search results on change.\n\tuseEffect( () => {\n\t\tif ( ! filterValue ) {\n\t\t\treturn;\n\t\t}\n\t\tconst count = filteredBlockPatterns.length;\n\t\tconst resultsFoundMessage = sprintf(\n\t\t\t/* translators: %d: number of results. */\n\t\t\t_n( '%d result found.', '%d results found.', count ),\n\t\t\tcount\n\t\t);\n\t\tdebouncedSpeak( resultsFoundMessage );\n\t}, [ filterValue, debouncedSpeak, filteredBlockPatterns.length ] );\n\n\tconst currentShownPatterns = useAsyncList( filteredBlockPatterns, {\n\t\tstep: INITIAL_INSERTER_RESULTS,\n\t} );\n\n\tconst hasItems = !! filteredBlockPatterns?.length;\n\treturn (\n\t\t<div className=\"block-editor-block-patterns-explorer__list\">\n\t\t\t{ hasItems && (\n\t\t\t\t<PatternsListHeader\n\t\t\t\t\tfilterValue={ filterValue }\n\t\t\t\t\tfilteredBlockPatternsLength={ filteredBlockPatterns.length }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t<InserterListbox>\n\t\t\t\t{ ! hasItems && <InserterNoResults /> }\n\t\t\t\t{ hasItems && (\n\t\t\t\t\t<BlockPatternsList\n\t\t\t\t\t\tshownPatterns={ currentShownPatterns }\n\t\t\t\t\t\tblockPatterns={ filteredBlockPatterns }\n\t\t\t\t\t\tonClickPattern={ onSelectBlockPattern }\n\t\t\t\t\t\tisDraggable={ false }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</InserterListbox>\n\t\t</div>\n\t);\n}\n\nexport default PatternList;\n"]}
@@ -19,8 +19,6 @@ var _components = require("@wordpress/components");
19
19
 
20
20
  var _icons = require("@wordpress/icons");
21
21
 
22
- var _blocks = require("@wordpress/blocks");
23
-
24
22
  var _dom = require("@wordpress/dom");
25
23
 
26
24
  var _usePatternsState = _interopRequireDefault(require("./hooks/use-patterns-state"));
@@ -31,8 +29,6 @@ var _explorer = _interopRequireDefault(require("./block-patterns-explorer/explor
31
29
 
32
30
  var _mobileTabNavigation = _interopRequireDefault(require("./mobile-tab-navigation"));
33
31
 
34
- var _useBlockTypesState = _interopRequireDefault(require("./hooks/use-block-types-state"));
35
-
36
32
  /**
37
33
  * WordPress dependencies
38
34
  */
@@ -44,16 +40,10 @@ const noop = () => {}; // Preferred order of pattern categories. Any other categ
44
40
  // be at the bottom without any re-ordering.
45
41
 
46
42
 
47
- const patternCategoriesOrder = ['featured', 'posts', 'text', 'gallery', 'call-to-action', 'banner', 'header', 'footer'];
43
+ const patternCategoriesOrder = ['custom', 'featured', 'posts', 'text', 'gallery', 'call-to-action', 'banner', 'header', 'footer'];
48
44
 
49
45
  function usePatternsCategories(rootClientId) {
50
46
  const [allPatterns, allCategories] = (0, _usePatternsState.default)(undefined, rootClientId);
51
- const [unsyncedPatterns] = (0, _useBlockTypesState.default)(rootClientId, undefined, 'unsynced');
52
- const filteredUnsyncedPatterns = (0, _element.useMemo)(() => {
53
- return unsyncedPatterns.filter(({
54
- category: unsyncedPatternCategory
55
- }) => unsyncedPatternCategory === 'reusable');
56
- }, [unsyncedPatterns]);
57
47
  const hasRegisteredCategory = (0, _element.useCallback)(pattern => {
58
48
  if (!pattern.categories || !pattern.categories.length) {
59
49
  return false;
@@ -84,15 +74,8 @@ function usePatternsCategories(rootClientId) {
84
74
  });
85
75
  }
86
76
 
87
- if (filteredUnsyncedPatterns.length > 0) {
88
- categories.push({
89
- name: 'reusable',
90
- label: (0, _i18n._x)('Custom patterns')
91
- });
92
- }
93
-
94
77
  return categories;
95
- }, [allCategories, allPatterns, filteredUnsyncedPatterns.length, hasRegisteredCategory]);
78
+ }, [allCategories, allPatterns, hasRegisteredCategory]);
96
79
  return populatedCategories;
97
80
  }
98
81
 
@@ -132,16 +115,6 @@ function BlockPatternsCategoryPanel({
132
115
  showTitlesAsTooltip
133
116
  }) {
134
117
  const [allPatterns,, onClick] = (0, _usePatternsState.default)(onInsert, rootClientId);
135
- const [unsyncedPatterns] = (0, _useBlockTypesState.default)(rootClientId, onInsert, 'unsynced');
136
- const filteredUnsyncedPatterns = (0, _element.useMemo)(() => {
137
- return unsyncedPatterns.filter(({
138
- category: unsyncedPatternCategory
139
- }) => unsyncedPatternCategory === 'reusable').map(syncedPattern => ({ ...syncedPattern,
140
- blocks: (0, _blocks.parse)(syncedPattern.content, {
141
- __unstableSkipMigrationLogs: true
142
- })
143
- }));
144
- }, [unsyncedPatterns]);
145
118
  const availableCategories = usePatternsCategories(rootClientId);
146
119
  const currentCategoryPatterns = (0, _element.useMemo)(() => allPatterns.filter(pattern => {
147
120
  var _pattern$categories$f;
@@ -154,13 +127,12 @@ function BlockPatternsCategoryPanel({
154
127
 
155
128
  const availablePatternCategories = (_pattern$categories$f = pattern.categories?.filter(cat => availableCategories.find(availableCategory => availableCategory.name === cat))) !== null && _pattern$categories$f !== void 0 ? _pattern$categories$f : [];
156
129
  return availablePatternCategories.length === 0;
157
- }), [allPatterns, category]);
158
- const patterns = category.name === 'reusable' ? filteredUnsyncedPatterns : currentCategoryPatterns;
159
- const currentShownPatterns = (0, _compose.useAsyncList)(patterns); // Hide block pattern preview on unmount.
130
+ }), [allPatterns, availableCategories, category.name]);
131
+ const categoryPatternsList = (0, _compose.useAsyncList)(currentCategoryPatterns); // Hide block pattern preview on unmount.
160
132
 
161
133
  (0, _element.useEffect)(() => () => onHover(null), []);
162
134
 
163
- if (!currentCategoryPatterns.length && !filteredUnsyncedPatterns.length) {
135
+ if (!currentCategoryPatterns.length) {
164
136
  return null;
165
137
  }
166
138
 
@@ -169,8 +141,8 @@ function BlockPatternsCategoryPanel({
169
141
  }, (0, _element.createElement)("div", {
170
142
  className: "block-editor-inserter__patterns-category-panel-title"
171
143
  }, category.label), (0, _element.createElement)("p", null, category.description), (0, _element.createElement)(_blockPatternsList.default, {
172
- shownPatterns: currentShownPatterns,
173
- blockPatterns: patterns,
144
+ shownPatterns: categoryPatternsList,
145
+ blockPatterns: currentCategoryPatterns,
174
146
  onClickPattern: onClick,
175
147
  onHover: onHover,
176
148
  label: category.label,
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/inserter/block-patterns-tab.js"],"names":["noop","patternCategoriesOrder","usePatternsCategories","rootClientId","allPatterns","allCategories","undefined","unsyncedPatterns","filteredUnsyncedPatterns","filter","category","unsyncedPatternCategory","hasRegisteredCategory","pattern","categories","length","some","cat","name","populatedCategories","includes","sort","aName","bName","aIndex","indexOf","bIndex","find","push","label","BlockPatternsCategoryDialog","onInsert","onHover","showTitlesAsTooltip","container","timeout","setTimeout","firstTabbable","focus","tabbable","current","clearTimeout","BlockPatternsCategoryPanel","onClick","map","syncedPattern","blocks","content","__unstableSkipMigrationLogs","availableCategories","currentCategoryPatterns","availablePatternCategories","availableCategory","patterns","currentShownPatterns","description","BlockPatternsTabs","onSelectCategory","selectedCategory","showPatternsExplorer","setShowPatternsExplorer","initialCategory","isMobile","chevronLeft","chevronRight"],"mappings":";;;;;;;;;;;AAGA;;AAOA;;AACA;;AACA;;AAOA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AA9BA;AACA;AACA;;AAqBA;AACA;AACA;AAOA,MAAMA,IAAI,GAAG,MAAM,CAAE,CAArB,C,CAEA;AACA;;;AACA,MAAMC,sBAAsB,GAAG,CAC9B,UAD8B,EAE9B,OAF8B,EAG9B,MAH8B,EAI9B,SAJ8B,EAK9B,gBAL8B,EAM9B,QAN8B,EAO9B,QAP8B,EAQ9B,QAR8B,CAA/B;;AAWA,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ADD,EAIC,4BAAC,WAAD;AACC,IAAA,IAAI,EACH,qBACGkC,kBADH,GAEGC;AAJL,IAJD,CAlBD,CADC,CAJH,EAqCC;AAAK,IAAA,IAAI,EAAC;AAAV,KACC,4BAAC,kBAAD;AACC,IAAA,SAAS,EAAC,gDADX;AAEC,IAAA,OAAO,EAAG,MACTJ,uBAAuB,CAAE,IAAF,CAHzB;AAKC,IAAA,OAAO,EAAC;AALT,KAOG,cAAI,sBAAJ,CAPH,CADD,CArCD,CADD,CADD,CAFF,EAwDGE,QAAQ,IACT,4BAAC,4BAAD;AAAqB,IAAA,UAAU,EAAGhD;AAAlC,KACKJ,QAAF,IACD,4BAAC,0BAAD;AACC,IAAA,QAAQ,EAAGqB,QADZ;AAEC,IAAA,YAAY,EAAG5B,YAFhB;AAGC,IAAA,QAAQ,EAAGO,QAHZ;AAIC,IAAA,mBAAmB,EAAG;AAJvB,IAFF,CAzDF,EAoEGiD,oBAAoB,IACrB,4BAAC,iBAAD;AACC,IAAA,eAAe,EAAGE,eADnB;AAEC,IAAA,iBAAiB,EAAG/C,UAFrB;AAGC,IAAA,YAAY,EAAG,MAAM8C,uBAAuB,CAAE,KAAF;AAH7C,IArEF,CADD;AA8EA;;eAEcJ,iB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tuseMemo,\n\tuseState,\n\tuseCallback,\n\tuseRef,\n\tuseEffect,\n} from '@wordpress/element';\nimport { _x, __, isRTL } from '@wordpress/i18n';\nimport { useAsyncList, useViewportMatch } from '@wordpress/compose';\nimport {\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalItem as Item,\n\t__experimentalHStack as HStack,\n\tFlexBlock,\n\tButton,\n} from '@wordpress/components';\nimport { Icon, chevronRight, chevronLeft } from '@wordpress/icons';\nimport { parse } from '@wordpress/blocks';\nimport { focus } from '@wordpress/dom';\n\n/**\n * Internal dependencies\n */\nimport usePatternsState from './hooks/use-patterns-state';\nimport BlockPatternList from '../block-patterns-list';\nimport PatternsExplorerModal from './block-patterns-explorer/explorer';\nimport MobileTabNavigation from './mobile-tab-navigation';\nimport useBlockTypesState from './hooks/use-block-types-state';\n\nconst noop = () => {};\n\n// Preferred order of pattern categories. Any other categories should\n// be at the bottom without any re-ordering.\nconst patternCategoriesOrder = [\n\t'featured',\n\t'posts',\n\t'text',\n\t'gallery',\n\t'call-to-action',\n\t'banner',\n\t'header',\n\t'footer',\n];\n\nfunction usePatternsCategories( rootClientId ) {\n\tconst [ allPatterns, allCategories ] = usePatternsState(\n\t\tundefined,\n\t\trootClientId\n\t);\n\n\tconst [ unsyncedPatterns ] = useBlockTypesState(\n\t\trootClientId,\n\t\tundefined,\n\t\t'unsynced'\n\t);\n\n\tconst filteredUnsyncedPatterns = useMemo( () => {\n\t\treturn unsyncedPatterns.filter(\n\t\t\t( { category: unsyncedPatternCategory } ) =>\n\t\t\t\tunsyncedPatternCategory === 'reusable'\n\t\t);\n\t}, [ unsyncedPatterns ] );\n\tconst hasRegisteredCategory = useCallback(\n\t\t( pattern ) => {\n\t\t\tif ( ! pattern.categories || ! pattern.categories.length ) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\treturn pattern.categories.some( ( cat ) =>\n\t\t\t\tallCategories.some( ( category ) => category.name === cat )\n\t\t\t);\n\t\t},\n\t\t[ allCategories ]\n\t);\n\n\t// Remove any empty categories.\n\tconst populatedCategories = useMemo( () => {\n\t\tconst categories = allCategories\n\t\t\t.filter( ( category ) =>\n\t\t\t\tallPatterns.some( ( pattern ) =>\n\t\t\t\t\tpattern.categories?.includes( category.name )\n\t\t\t\t)\n\t\t\t)\n\t\t\t.sort( ( { name: aName }, { name: bName } ) => {\n\t\t\t\t// Sort categories according to `patternCategoriesOrder`.\n\t\t\t\tlet aIndex = patternCategoriesOrder.indexOf( aName );\n\t\t\t\tlet bIndex = patternCategoriesOrder.indexOf( bName );\n\t\t\t\t// All other categories should come after that.\n\t\t\t\tif ( aIndex < 0 ) aIndex = patternCategoriesOrder.length;\n\t\t\t\tif ( bIndex < 0 ) bIndex = patternCategoriesOrder.length;\n\t\t\t\treturn aIndex - bIndex;\n\t\t\t} );\n\n\t\tif (\n\t\t\tallPatterns.some(\n\t\t\t\t( pattern ) => ! hasRegisteredCategory( pattern )\n\t\t\t) &&\n\t\t\t! categories.find(\n\t\t\t\t( category ) => category.name === 'uncategorized'\n\t\t\t)\n\t\t) {\n\t\t\tcategories.push( {\n\t\t\t\tname: 'uncategorized',\n\t\t\t\tlabel: _x( 'Uncategorized' ),\n\t\t\t} );\n\t\t}\n\t\tif ( filteredUnsyncedPatterns.length > 0 ) {\n\t\t\tcategories.push( {\n\t\t\t\tname: 'reusable',\n\t\t\t\tlabel: _x( 'Custom patterns' ),\n\t\t\t} );\n\t\t}\n\n\t\treturn categories;\n\t}, [\n\t\tallCategories,\n\t\tallPatterns,\n\t\tfilteredUnsyncedPatterns.length,\n\t\thasRegisteredCategory,\n\t] );\n\n\treturn populatedCategories;\n}\n\nexport function BlockPatternsCategoryDialog( {\n\trootClientId,\n\tonInsert,\n\tonHover,\n\tcategory,\n\tshowTitlesAsTooltip,\n} ) {\n\tconst container = useRef();\n\n\tuseEffect( () => {\n\t\tconst timeout = setTimeout( () => {\n\t\t\tconst [ firstTabbable ] = focus.tabbable.find( container.current );\n\t\t\tfirstTabbable?.focus();\n\t\t} );\n\t\treturn () => clearTimeout( timeout );\n\t}, [ category ] );\n\n\treturn (\n\t\t<div\n\t\t\tref={ container }\n\t\t\tclassName=\"block-editor-inserter__patterns-category-dialog\"\n\t\t>\n\t\t\t<BlockPatternsCategoryPanel\n\t\t\t\trootClientId={ rootClientId }\n\t\t\t\tonInsert={ onInsert }\n\t\t\t\tonHover={ onHover }\n\t\t\t\tcategory={ category }\n\t\t\t\tshowTitlesAsTooltip={ showTitlesAsTooltip }\n\t\t\t/>\n\t\t</div>\n\t);\n}\n\nexport function BlockPatternsCategoryPanel( {\n\trootClientId,\n\tonInsert,\n\tonHover = noop,\n\tcategory,\n\tshowTitlesAsTooltip,\n} ) {\n\tconst [ allPatterns, , onClick ] = usePatternsState(\n\t\tonInsert,\n\t\trootClientId\n\t);\n\tconst [ unsyncedPatterns ] = useBlockTypesState(\n\t\trootClientId,\n\t\tonInsert,\n\t\t'unsynced'\n\t);\n\tconst filteredUnsyncedPatterns = useMemo( () => {\n\t\treturn unsyncedPatterns\n\t\t\t.filter(\n\t\t\t\t( { category: unsyncedPatternCategory } ) =>\n\t\t\t\t\tunsyncedPatternCategory === 'reusable'\n\t\t\t)\n\t\t\t.map( ( syncedPattern ) => ( {\n\t\t\t\t...syncedPattern,\n\t\t\t\tblocks: parse( syncedPattern.content, {\n\t\t\t\t\t__unstableSkipMigrationLogs: true,\n\t\t\t\t} ),\n\t\t\t} ) );\n\t}, [ unsyncedPatterns ] );\n\n\tconst availableCategories = usePatternsCategories( rootClientId );\n\tconst currentCategoryPatterns = useMemo(\n\t\t() =>\n\t\t\tallPatterns.filter( ( pattern ) => {\n\t\t\t\tif ( category.name !== 'uncategorized' ) {\n\t\t\t\t\treturn pattern.categories?.includes( category.name );\n\t\t\t\t}\n\n\t\t\t\t// The uncategorized category should show all the patterns without any category\n\t\t\t\t// or with no available category.\n\t\t\t\tconst availablePatternCategories =\n\t\t\t\t\tpattern.categories?.filter( ( cat ) =>\n\t\t\t\t\t\tavailableCategories.find(\n\t\t\t\t\t\t\t( availableCategory ) =>\n\t\t\t\t\t\t\t\tavailableCategory.name === cat\n\t\t\t\t\t\t)\n\t\t\t\t\t) ?? [];\n\n\t\t\t\treturn availablePatternCategories.length === 0;\n\t\t\t} ),\n\t\t[ allPatterns, category ]\n\t);\n\tconst patterns =\n\t\tcategory.name === 'reusable'\n\t\t\t? filteredUnsyncedPatterns\n\t\t\t: currentCategoryPatterns;\n\tconst currentShownPatterns = useAsyncList( patterns );\n\n\t// Hide block pattern preview on unmount.\n\tuseEffect( () => () => onHover( null ), [] );\n\n\tif (\n\t\t! currentCategoryPatterns.length &&\n\t\t! filteredUnsyncedPatterns.length\n\t) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<div className=\"block-editor-inserter__patterns-category-panel\">\n\t\t\t<div className=\"block-editor-inserter__patterns-category-panel-title\">\n\t\t\t\t{ category.label }\n\t\t\t</div>\n\t\t\t<p>{ category.description }</p>\n\t\t\t<BlockPatternList\n\t\t\t\tshownPatterns={ currentShownPatterns }\n\t\t\t\tblockPatterns={ patterns }\n\t\t\t\tonClickPattern={ onClick }\n\t\t\t\tonHover={ onHover }\n\t\t\t\tlabel={ category.label }\n\t\t\t\torientation=\"vertical\"\n\t\t\t\tcategory={ category.label }\n\t\t\t\tisDraggable\n\t\t\t\tshowTitlesAsTooltip={ showTitlesAsTooltip }\n\t\t\t/>\n\t\t</div>\n\t);\n}\n\nfunction BlockPatternsTabs( {\n\tonSelectCategory,\n\tselectedCategory,\n\tonInsert,\n\trootClientId,\n} ) {\n\tconst [ showPatternsExplorer, setShowPatternsExplorer ] = useState( false );\n\tconst categories = usePatternsCategories( rootClientId );\n\tconst initialCategory = selectedCategory || categories[ 0 ];\n\tconst isMobile = useViewportMatch( 'medium', '<' );\n\treturn (\n\t\t<>\n\t\t\t{ ! isMobile && (\n\t\t\t\t<div className=\"block-editor-inserter__block-patterns-tabs-container\">\n\t\t\t\t\t<nav aria-label={ __( 'Block pattern categories' ) }>\n\t\t\t\t\t\t<ItemGroup\n\t\t\t\t\t\t\trole=\"list\"\n\t\t\t\t\t\t\tclassName=\"block-editor-inserter__block-patterns-tabs\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ categories.map( ( category ) => (\n\t\t\t\t\t\t\t\t<Item\n\t\t\t\t\t\t\t\t\trole=\"listitem\"\n\t\t\t\t\t\t\t\t\tkey={ category.name }\n\t\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\t\tonSelectCategory( category )\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tclassName={\n\t\t\t\t\t\t\t\t\t\tcategory === selectedCategory\n\t\t\t\t\t\t\t\t\t\t\t? 'block-editor-inserter__patterns-category block-editor-inserter__patterns-selected-category'\n\t\t\t\t\t\t\t\t\t\t\t: 'block-editor-inserter__patterns-category'\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\taria-label={ category.label }\n\t\t\t\t\t\t\t\t\taria-current={\n\t\t\t\t\t\t\t\t\t\tcategory === selectedCategory\n\t\t\t\t\t\t\t\t\t\t\t? 'true'\n\t\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<HStack>\n\t\t\t\t\t\t\t\t\t\t<FlexBlock>\n\t\t\t\t\t\t\t\t\t\t\t{ category.label }\n\t\t\t\t\t\t\t\t\t\t</FlexBlock>\n\t\t\t\t\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t\t\t\t\t\tisRTL()\n\t\t\t\t\t\t\t\t\t\t\t\t\t? chevronLeft\n\t\t\t\t\t\t\t\t\t\t\t\t\t: chevronRight\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t</HStack>\n\t\t\t\t\t\t\t\t</Item>\n\t\t\t\t\t\t\t) ) }\n\t\t\t\t\t\t\t<div role=\"listitem\">\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\tclassName=\"block-editor-inserter__patterns-explore-button\"\n\t\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\t\tsetShowPatternsExplorer( true )\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ __( 'Explore all patterns' ) }\n\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</ItemGroup>\n\t\t\t\t\t</nav>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t{ isMobile && (\n\t\t\t\t<MobileTabNavigation categories={ categories }>\n\t\t\t\t\t{ ( category ) => (\n\t\t\t\t\t\t<BlockPatternsCategoryPanel\n\t\t\t\t\t\t\tonInsert={ onInsert }\n\t\t\t\t\t\t\trootClientId={ rootClientId }\n\t\t\t\t\t\t\tcategory={ category }\n\t\t\t\t\t\t\tshowTitlesAsTooltip={ false }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</MobileTabNavigation>\n\t\t\t) }\n\t\t\t{ showPatternsExplorer && (\n\t\t\t\t<PatternsExplorerModal\n\t\t\t\t\tinitialCategory={ initialCategory }\n\t\t\t\t\tpatternCategories={ categories }\n\t\t\t\t\tonModalClose={ () => setShowPatternsExplorer( false ) }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default BlockPatternsTabs;\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/inserter/block-patterns-tab.js"],"names":["noop","patternCategoriesOrder","usePatternsCategories","rootClientId","allPatterns","allCategories","undefined","hasRegisteredCategory","pattern","categories","length","some","cat","category","name","populatedCategories","filter","includes","sort","aName","bName","aIndex","indexOf","bIndex","find","push","label","BlockPatternsCategoryDialog","onInsert","onHover","showTitlesAsTooltip","container","timeout","setTimeout","firstTabbable","focus","tabbable","current","clearTimeout","BlockPatternsCategoryPanel","onClick","availableCategories","currentCategoryPatterns","availablePatternCategories","availableCategory","categoryPatternsList","description","BlockPatternsTabs","onSelectCategory","selectedCategory","showPatternsExplorer","setShowPatternsExplorer","initialCategory","isMobile","map","chevronLeft","chevronRight"],"mappings":";;;;;;;;;;;AAGA;;AAOA;;AACA;;AACA;;AAOA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AA5BA;AACA;AACA;;AAoBA;AACA;AACA;AAMA,MAAMA,IAAI,GAAG,MAAM,CAAE,CAArB,C,CAEA;AACA;;;AACA,MAAMC,sBAAsB,GAAG,CA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AO,EAAG,MACTkC,gBAAgB,CAAEnC,QAAF,CAJlB;AAMC,IAAA,SAAS,EACRA,QAAQ,KAAKoC,gBAAb,GACG,4FADH,GAEG,0CATL;AAWC,kBAAapC,QAAQ,CAACa,KAXvB;AAYC,oBACCb,QAAQ,KAAKoC,gBAAb,GACG,MADH,GAEG3C;AAfL,KAkBC,4BAAC,gCAAD,QACC,4BAAC,qBAAD,QACGO,QAAQ,CAACa,KADZ,CADD,EAIC,4BAAC,WAAD;AACC,IAAA,IAAI,EACH,qBACG6B,kBADH,GAEGC;AAJL,IAJD,CAlBD,CADC,CAJH,EAqCC;AAAK,IAAA,IAAI,EAAC;AAAV,KACC,4BAAC,kBAAD;AACC,IAAA,SAAS,EAAC,gDADX;AAEC,IAAA,OAAO,EAAG,MACTL,uBAAuB,CAAE,IAAF,CAHzB;AAKC,IAAA,OAAO,EAAC;AALT,KAOG,cAAI,sBAAJ,CAPH,CADD,CArCD,CADD,CADD,CAFF,EAwDGE,QAAQ,IACT,4BAAC,4BAAD;AAAqB,IAAA,UAAU,EAAG5C;AAAlC,KACKI,QAAF,IACD,4BAAC,0BAAD;AACC,IAAA,QAAQ,EAAGe,QADZ;AAEC,IAAA,YAAY,EAAGzB,YAFhB;AAGC,IAAA,QAAQ,EAAGU,QAHZ;AAIC,IAAA,mBAAmB,EAAG;AAJvB,IAFF,CAzDF,EAoEGqC,oBAAoB,IACrB,4BAAC,iBAAD;AACC,IAAA,eAAe,EAAGE,eADnB;AAEC,IAAA,iBAAiB,EAAG3C,UAFrB;AAGC,IAAA,YAAY,EAAG,MAAM0C,uBAAuB,CAAE,KAAF;AAH7C,IArEF,CADD;AA8EA;;eAEcJ,iB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tuseMemo,\n\tuseState,\n\tuseCallback,\n\tuseRef,\n\tuseEffect,\n} from '@wordpress/element';\nimport { _x, __, isRTL } from '@wordpress/i18n';\nimport { useAsyncList, useViewportMatch } from '@wordpress/compose';\nimport {\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalItem as Item,\n\t__experimentalHStack as HStack,\n\tFlexBlock,\n\tButton,\n} from '@wordpress/components';\nimport { Icon, chevronRight, chevronLeft } from '@wordpress/icons';\nimport { focus } from '@wordpress/dom';\n\n/**\n * Internal dependencies\n */\nimport usePatternsState from './hooks/use-patterns-state';\nimport BlockPatternList from '../block-patterns-list';\nimport PatternsExplorerModal from './block-patterns-explorer/explorer';\nimport MobileTabNavigation from './mobile-tab-navigation';\n\nconst noop = () => {};\n\n// Preferred order of pattern categories. Any other categories should\n// be at the bottom without any re-ordering.\nconst patternCategoriesOrder = [\n\t'custom',\n\t'featured',\n\t'posts',\n\t'text',\n\t'gallery',\n\t'call-to-action',\n\t'banner',\n\t'header',\n\t'footer',\n];\n\nfunction usePatternsCategories( rootClientId ) {\n\tconst [ allPatterns, allCategories ] = usePatternsState(\n\t\tundefined,\n\t\trootClientId\n\t);\n\n\tconst hasRegisteredCategory = useCallback(\n\t\t( pattern ) => {\n\t\t\tif ( ! pattern.categories || ! pattern.categories.length ) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\treturn pattern.categories.some( ( cat ) =>\n\t\t\t\tallCategories.some( ( category ) => category.name === cat )\n\t\t\t);\n\t\t},\n\t\t[ allCategories ]\n\t);\n\n\t// Remove any empty categories.\n\tconst populatedCategories = useMemo( () => {\n\t\tconst categories = allCategories\n\t\t\t.filter( ( category ) =>\n\t\t\t\tallPatterns.some( ( pattern ) =>\n\t\t\t\t\tpattern.categories?.includes( category.name )\n\t\t\t\t)\n\t\t\t)\n\t\t\t.sort( ( { name: aName }, { name: bName } ) => {\n\t\t\t\t// Sort categories according to `patternCategoriesOrder`.\n\t\t\t\tlet aIndex = patternCategoriesOrder.indexOf( aName );\n\t\t\t\tlet bIndex = patternCategoriesOrder.indexOf( bName );\n\t\t\t\t// All other categories should come after that.\n\t\t\t\tif ( aIndex < 0 ) aIndex = patternCategoriesOrder.length;\n\t\t\t\tif ( bIndex < 0 ) bIndex = patternCategoriesOrder.length;\n\t\t\t\treturn aIndex - bIndex;\n\t\t\t} );\n\n\t\tif (\n\t\t\tallPatterns.some(\n\t\t\t\t( pattern ) => ! hasRegisteredCategory( pattern )\n\t\t\t) &&\n\t\t\t! categories.find(\n\t\t\t\t( category ) => category.name === 'uncategorized'\n\t\t\t)\n\t\t) {\n\t\t\tcategories.push( {\n\t\t\t\tname: 'uncategorized',\n\t\t\t\tlabel: _x( 'Uncategorized' ),\n\t\t\t} );\n\t\t}\n\n\t\treturn categories;\n\t}, [ allCategories, allPatterns, hasRegisteredCategory ] );\n\n\treturn populatedCategories;\n}\n\nexport function BlockPatternsCategoryDialog( {\n\trootClientId,\n\tonInsert,\n\tonHover,\n\tcategory,\n\tshowTitlesAsTooltip,\n} ) {\n\tconst container = useRef();\n\n\tuseEffect( () => {\n\t\tconst timeout = setTimeout( () => {\n\t\t\tconst [ firstTabbable ] = focus.tabbable.find( container.current );\n\t\t\tfirstTabbable?.focus();\n\t\t} );\n\t\treturn () => clearTimeout( timeout );\n\t}, [ category ] );\n\n\treturn (\n\t\t<div\n\t\t\tref={ container }\n\t\t\tclassName=\"block-editor-inserter__patterns-category-dialog\"\n\t\t>\n\t\t\t<BlockPatternsCategoryPanel\n\t\t\t\trootClientId={ rootClientId }\n\t\t\t\tonInsert={ onInsert }\n\t\t\t\tonHover={ onHover }\n\t\t\t\tcategory={ category }\n\t\t\t\tshowTitlesAsTooltip={ showTitlesAsTooltip }\n\t\t\t/>\n\t\t</div>\n\t);\n}\n\nexport function BlockPatternsCategoryPanel( {\n\trootClientId,\n\tonInsert,\n\tonHover = noop,\n\tcategory,\n\tshowTitlesAsTooltip,\n} ) {\n\tconst [ allPatterns, , onClick ] = usePatternsState(\n\t\tonInsert,\n\t\trootClientId\n\t);\n\n\tconst availableCategories = usePatternsCategories( rootClientId );\n\tconst currentCategoryPatterns = useMemo(\n\t\t() =>\n\t\t\tallPatterns.filter( ( pattern ) => {\n\t\t\t\tif ( category.name !== 'uncategorized' ) {\n\t\t\t\t\treturn pattern.categories?.includes( category.name );\n\t\t\t\t}\n\n\t\t\t\t// The uncategorized category should show all the patterns without any category\n\t\t\t\t// or with no available category.\n\t\t\t\tconst availablePatternCategories =\n\t\t\t\t\tpattern.categories?.filter( ( cat ) =>\n\t\t\t\t\t\tavailableCategories.find(\n\t\t\t\t\t\t\t( availableCategory ) =>\n\t\t\t\t\t\t\t\tavailableCategory.name === cat\n\t\t\t\t\t\t)\n\t\t\t\t\t) ?? [];\n\n\t\t\t\treturn availablePatternCategories.length === 0;\n\t\t\t} ),\n\t\t[ allPatterns, availableCategories, category.name ]\n\t);\n\n\tconst categoryPatternsList = useAsyncList( currentCategoryPatterns );\n\n\t// Hide block pattern preview on unmount.\n\tuseEffect( () => () => onHover( null ), [] );\n\n\tif ( ! currentCategoryPatterns.length ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<div className=\"block-editor-inserter__patterns-category-panel\">\n\t\t\t<div className=\"block-editor-inserter__patterns-category-panel-title\">\n\t\t\t\t{ category.label }\n\t\t\t</div>\n\t\t\t<p>{ category.description }</p>\n\t\t\t<BlockPatternList\n\t\t\t\tshownPatterns={ categoryPatternsList }\n\t\t\t\tblockPatterns={ currentCategoryPatterns }\n\t\t\t\tonClickPattern={ onClick }\n\t\t\t\tonHover={ onHover }\n\t\t\t\tlabel={ category.label }\n\t\t\t\torientation=\"vertical\"\n\t\t\t\tcategory={ category.label }\n\t\t\t\tisDraggable\n\t\t\t\tshowTitlesAsTooltip={ showTitlesAsTooltip }\n\t\t\t/>\n\t\t</div>\n\t);\n}\n\nfunction BlockPatternsTabs( {\n\tonSelectCategory,\n\tselectedCategory,\n\tonInsert,\n\trootClientId,\n} ) {\n\tconst [ showPatternsExplorer, setShowPatternsExplorer ] = useState( false );\n\tconst categories = usePatternsCategories( rootClientId );\n\tconst initialCategory = selectedCategory || categories[ 0 ];\n\tconst isMobile = useViewportMatch( 'medium', '<' );\n\treturn (\n\t\t<>\n\t\t\t{ ! isMobile && (\n\t\t\t\t<div className=\"block-editor-inserter__block-patterns-tabs-container\">\n\t\t\t\t\t<nav aria-label={ __( 'Block pattern categories' ) }>\n\t\t\t\t\t\t<ItemGroup\n\t\t\t\t\t\t\trole=\"list\"\n\t\t\t\t\t\t\tclassName=\"block-editor-inserter__block-patterns-tabs\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ categories.map( ( category ) => (\n\t\t\t\t\t\t\t\t<Item\n\t\t\t\t\t\t\t\t\trole=\"listitem\"\n\t\t\t\t\t\t\t\t\tkey={ category.name }\n\t\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\t\tonSelectCategory( category )\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tclassName={\n\t\t\t\t\t\t\t\t\t\tcategory === selectedCategory\n\t\t\t\t\t\t\t\t\t\t\t? 'block-editor-inserter__patterns-category block-editor-inserter__patterns-selected-category'\n\t\t\t\t\t\t\t\t\t\t\t: 'block-editor-inserter__patterns-category'\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\taria-label={ category.label }\n\t\t\t\t\t\t\t\t\taria-current={\n\t\t\t\t\t\t\t\t\t\tcategory === selectedCategory\n\t\t\t\t\t\t\t\t\t\t\t? 'true'\n\t\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<HStack>\n\t\t\t\t\t\t\t\t\t\t<FlexBlock>\n\t\t\t\t\t\t\t\t\t\t\t{ category.label }\n\t\t\t\t\t\t\t\t\t\t</FlexBlock>\n\t\t\t\t\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t\t\t\t\t\tisRTL()\n\t\t\t\t\t\t\t\t\t\t\t\t\t? chevronLeft\n\t\t\t\t\t\t\t\t\t\t\t\t\t: chevronRight\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t</HStack>\n\t\t\t\t\t\t\t\t</Item>\n\t\t\t\t\t\t\t) ) }\n\t\t\t\t\t\t\t<div role=\"listitem\">\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\tclassName=\"block-editor-inserter__patterns-explore-button\"\n\t\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\t\tsetShowPatternsExplorer( true )\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ __( 'Explore all patterns' ) }\n\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</ItemGroup>\n\t\t\t\t\t</nav>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t{ isMobile && (\n\t\t\t\t<MobileTabNavigation categories={ categories }>\n\t\t\t\t\t{ ( category ) => (\n\t\t\t\t\t\t<BlockPatternsCategoryPanel\n\t\t\t\t\t\t\tonInsert={ onInsert }\n\t\t\t\t\t\t\trootClientId={ rootClientId }\n\t\t\t\t\t\t\tcategory={ category }\n\t\t\t\t\t\t\tshowTitlesAsTooltip={ false }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</MobileTabNavigation>\n\t\t\t) }\n\t\t\t{ showPatternsExplorer && (\n\t\t\t\t<PatternsExplorerModal\n\t\t\t\t\tinitialCategory={ initialCategory }\n\t\t\t\t\tpatternCategories={ categories }\n\t\t\t\t\tonModalClose={ () => setShowPatternsExplorer( false ) }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default BlockPatternsTabs;\n"]}
@@ -26,10 +26,9 @@ var _store = require("../../../store");
26
26
  *
27
27
  * @param {string=} rootClientId Insertion's root client ID.
28
28
  * @param {Function} onInsert function called when inserter a list of blocks.
29
- * @param {?string} syncStatus Optional sync status to filter pattern blocks by.
30
29
  * @return {Array} Returns the block types state. (block types, categories, collections, onSelect handler)
31
30
  */
32
- const useBlockTypesState = (rootClientId, onInsert, syncStatus) => {
31
+ const useBlockTypesState = (rootClientId, onInsert) => {
33
32
  const {
34
33
  categories,
35
34
  collections,
@@ -45,9 +44,9 @@ const useBlockTypesState = (rootClientId, onInsert, syncStatus) => {
45
44
  return {
46
45
  categories: getCategories(),
47
46
  collections: getCollections(),
48
- items: getInserterItems(rootClientId, syncStatus)
47
+ items: getInserterItems(rootClientId)
49
48
  };
50
- }, [rootClientId, syncStatus]);
49
+ }, [rootClientId]);
51
50
  const onSelectItem = (0, _element.useCallback)(({
52
51
  name,
53
52
  initialAttributes,
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/inserter/hooks/use-block-types-state.js"],"names":["useBlockTypesState","rootClientId","onInsert","syncStatus","categories","collections","items","select","getInserterItems","blockEditorStore","getCategories","getCollections","blocksStore","onSelectItem","name","initialAttributes","innerBlocks","shouldFocusBlock","insertedBlock","undefined"],"mappings":";;;;;;;AAGA;;AAKA;;AACA;;AAKA;;AAdA;AACA;AACA;;AASA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,kBAAkB,GAAG,CAAEC,YAAF,EAAgBC,QAAhB,EAA0BC,UAA1B,KAA0C;AACpE,QAAM;AAAEC,IAAAA,UAAF;AAAcC,IAAAA,WAAd;AAA2BC,IAAAA;AAA3B,MAAqC,qBACxCC,MAAF,IAAc;AACb,UAAM;AAAEC,MAAAA;AAAF,QAAuBD,MAAM,CAAEE,YAAF,CAAnC;AACA,UAAM;AAAEC,MAAAA,aAAF;AAAiBC,MAAAA;AAAjB,QAAoCJ,MAAM,CAAEK,aAAF,CAAhD;AAEA,WAAO;AACNR,MAAAA,UAAU,EAAEM,aAAa,EADnB;AAENL,MAAAA,WAAW,EAAEM,cAAc,EAFrB;AAGNL,MAAAA,KAAK,EAAEE,gBAAgB,CAAEP,YAAF,EAAgBE,UAAhB;AAHjB,KAAP;AAKA,GAVyC,EAW1C,CAAEF,YAAF,EAAgBE,UAAhB,CAX0C,CAA3C;AAcA,QAAMU,YAAY,GAAG,0BACpB,CAAE;AAAEC,IAAAA,IAAF;AAAQC,IAAAA,iBAAR;AAA2BC,IAAAA;AAA3B,GAAF,EAA4CC,gBAA5C,KAAkE;AACjE,UAAMC,aAAa,GAAG,yBACrBJ,IADqB,EAErBC,iBAFqB,EAGrB,iDAAqCC,WAArC,CAHqB,CAAtB;AAMAd,IAAAA,QAAQ,CAAEgB,aAAF,EAAiBC,SAAjB,EAA4BF,gBAA5B,CAAR;AACA,GATmB,EAUpB,CAAEf,QAAF,CAVoB,CAArB;AAaA,SAAO,CAAEI,KAAF,EAASF,UAAT,EAAqBC,WAArB,EAAkCQ,YAAlC,CAAP;AACA,CA7BD;;eA+Beb,kB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tcreateBlock,\n\tcreateBlocksFromInnerBlocksTemplate,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\nimport { useSelect } from '@wordpress/data';\nimport { useCallback } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../../store';\n\n/**\n * Retrieves the block types inserter state.\n *\n * @param {string=} rootClientId Insertion's root client ID.\n * @param {Function} onInsert function called when inserter a list of blocks.\n * @param {?string} syncStatus Optional sync status to filter pattern blocks by.\n * @return {Array} Returns the block types state. (block types, categories, collections, onSelect handler)\n */\nconst useBlockTypesState = ( rootClientId, onInsert, syncStatus ) => {\n\tconst { categories, collections, items } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getInserterItems } = select( blockEditorStore );\n\t\t\tconst { getCategories, getCollections } = select( blocksStore );\n\n\t\t\treturn {\n\t\t\t\tcategories: getCategories(),\n\t\t\t\tcollections: getCollections(),\n\t\t\t\titems: getInserterItems( rootClientId, syncStatus ),\n\t\t\t};\n\t\t},\n\t\t[ rootClientId, syncStatus ]\n\t);\n\n\tconst onSelectItem = useCallback(\n\t\t( { name, initialAttributes, innerBlocks }, shouldFocusBlock ) => {\n\t\t\tconst insertedBlock = createBlock(\n\t\t\t\tname,\n\t\t\t\tinitialAttributes,\n\t\t\t\tcreateBlocksFromInnerBlocksTemplate( innerBlocks )\n\t\t\t);\n\n\t\t\tonInsert( insertedBlock, undefined, shouldFocusBlock );\n\t\t},\n\t\t[ onInsert ]\n\t);\n\n\treturn [ items, categories, collections, onSelectItem ];\n};\n\nexport default useBlockTypesState;\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/inserter/hooks/use-block-types-state.js"],"names":["useBlockTypesState","rootClientId","onInsert","categories","collections","items","select","getInserterItems","blockEditorStore","getCategories","getCollections","blocksStore","onSelectItem","name","initialAttributes","innerBlocks","shouldFocusBlock","insertedBlock","undefined"],"mappings":";;;;;;;AAGA;;AAKA;;AACA;;AAKA;;AAdA;AACA;AACA;;AASA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,kBAAkB,GAAG,CAAEC,YAAF,EAAgBC,QAAhB,KAA8B;AACxD,QAAM;AAAEC,IAAAA,UAAF;AAAcC,IAAAA,WAAd;AAA2BC,IAAAA;AAA3B,MAAqC,qBACxCC,MAAF,IAAc;AACb,UAAM;AAAEC,MAAAA;AAAF,QAAuBD,MAAM,CAAEE,YAAF,CAAnC;AACA,UAAM;AAAEC,MAAAA,aAAF;AAAiBC,MAAAA;AAAjB,QAAoCJ,MAAM,CAAEK,aAAF,CAAhD;AAEA,WAAO;AACNR,MAAAA,UAAU,EAAEM,aAAa,EADnB;AAENL,MAAAA,WAAW,EAAEM,cAAc,EAFrB;AAGNL,MAAAA,KAAK,EAAEE,gBAAgB,CAAEN,YAAF;AAHjB,KAAP;AAKA,GAVyC,EAW1C,CAAEA,YAAF,CAX0C,CAA3C;AAcA,QAAMW,YAAY,GAAG,0BACpB,CAAE;AAAEC,IAAAA,IAAF;AAAQC,IAAAA,iBAAR;AAA2BC,IAAAA;AAA3B,GAAF,EAA4CC,gBAA5C,KAAkE;AACjE,UAAMC,aAAa,GAAG,yBACrBJ,IADqB,EAErBC,iBAFqB,EAGrB,iDAAqCC,WAArC,CAHqB,CAAtB;AAMAb,IAAAA,QAAQ,CAAEe,aAAF,EAAiBC,SAAjB,EAA4BF,gBAA5B,CAAR;AACA,GATmB,EAUpB,CAAEd,QAAF,CAVoB,CAArB;AAaA,SAAO,CAAEG,KAAF,EAASF,UAAT,EAAqBC,WAArB,EAAkCQ,YAAlC,CAAP;AACA,CA7BD;;eA+BeZ,kB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tcreateBlock,\n\tcreateBlocksFromInnerBlocksTemplate,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\nimport { useSelect } from '@wordpress/data';\nimport { useCallback } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../../store';\n\n/**\n * Retrieves the block types inserter state.\n *\n * @param {string=} rootClientId Insertion's root client ID.\n * @param {Function} onInsert function called when inserter a list of blocks.\n * @return {Array} Returns the block types state. (block types, categories, collections, onSelect handler)\n */\nconst useBlockTypesState = ( rootClientId, onInsert ) => {\n\tconst { categories, collections, items } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getInserterItems } = select( blockEditorStore );\n\t\t\tconst { getCategories, getCollections } = select( blocksStore );\n\n\t\t\treturn {\n\t\t\t\tcategories: getCategories(),\n\t\t\t\tcollections: getCollections(),\n\t\t\t\titems: getInserterItems( rootClientId ),\n\t\t\t};\n\t\t},\n\t\t[ rootClientId ]\n\t);\n\n\tconst onSelectItem = useCallback(\n\t\t( { name, initialAttributes, innerBlocks }, shouldFocusBlock ) => {\n\t\t\tconst insertedBlock = createBlock(\n\t\t\t\tname,\n\t\t\t\tinitialAttributes,\n\t\t\t\tcreateBlocksFromInnerBlocksTemplate( innerBlocks )\n\t\t\t);\n\n\t\t\tonInsert( insertedBlock, undefined, shouldFocusBlock );\n\t\t},\n\t\t[ onInsert ]\n\t);\n\n\treturn [ items, categories, collections, onSelectItem ];\n};\n\nexport default useBlockTypesState;\n"]}
@@ -24,7 +24,11 @@ var _store = require("../../../store");
24
24
  /**
25
25
  * Internal dependencies
26
26
  */
27
-
27
+ const CUSTOM_CATEGORY = {
28
+ name: 'custom',
29
+ label: (0, _i18n.__)('My patterns'),
30
+ description: (0, _i18n.__)('Custom patterns add by site users')
31
+ };
28
32
  /**
29
33
  * Retrieves the block patterns inserter state.
30
34
  *
@@ -33,6 +37,7 @@ var _store = require("../../../store");
33
37
  *
34
38
  * @return {Array} Returns the patterns state. (patterns, categories, onSelect handler)
35
39
  */
40
+
36
41
  const usePatternsState = (onInsert, rootClientId) => {
37
42
  const {
38
43
  patternCategories,
@@ -47,6 +52,7 @@ const usePatternsState = (onInsert, rootClientId) => {
47
52
  patternCategories: getSettings().__experimentalBlockPatternCategories
48
53
  };
49
54
  }, [rootClientId]);
55
+ const allCategories = (0, _element.useMemo)(() => [...patternCategories, CUSTOM_CATEGORY], [patternCategories]);
50
56
  const {
51
57
  createSuccessNotice
52
58
  } = (0, _data.useDispatch)(_notices.store);
@@ -57,8 +63,8 @@ const usePatternsState = (onInsert, rootClientId) => {
57
63
  (0, _i18n.__)('Block pattern "%s" inserted.'), pattern.title), {
58
64
  type: 'snackbar'
59
65
  });
60
- }, []);
61
- return [patterns, patternCategories, onClickPattern];
66
+ }, [createSuccessNotice, onInsert]);
67
+ return [patterns, allCategories, onClickPattern];
62
68
  };
63
69
 
64
70
  var _default = usePatternsState;
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/inserter/hooks/use-patterns-state.js"],"names":["usePatternsState","onInsert","rootClientId","patternCategories","patterns","select","__experimentalGetAllowedPatterns","getSettings","blockEditorStore","__experimentalBlockPatternCategories","createSuccessNotice","noticesStore","onClickPattern","pattern","blocks","map","block","name","title","type"],"mappings":";;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AAZA;AACA;AACA;;AAOA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,gBAAgB,GAAG,CAAEC,QAAF,EAAYC,YAAZ,KAA8B;AACtD,QAAM;AAAEC,IAAAA,iBAAF;AAAqBC,IAAAA;AAArB,MAAkC,qBACrCC,MAAF,IAAc;AACb,UAAM;AAAEC,MAAAA,gCAAF;AAAoCC,MAAAA;AAApC,QACLF,MAAM,CAAEG,YAAF,CADP;AAEA,WAAO;AACNJ,MAAAA,QAAQ,EAAEE,gCAAgC,CAAEJ,YAAF,CADpC;AAENC,MAAAA,iBAAiB,EAChBI,WAAW,GAAGE;AAHT,KAAP;AAKA,GATsC,EAUvC,CAAEP,YAAF,CAVuC,CAAxC;AAYA,QAAM;AAAEQ,IAAAA;AAAF,MAA0B,uBAAaC,cAAb,CAAhC;AACA,QAAMC,cAAc,GAAG,0BAAa,CAAEC,OAAF,EAAWC,MAAX,KAAuB;AAC1Db,IAAAA,QAAQ,CACP,CAAEa,MAAF,aAAEA,MAAF,cAAEA,MAAF,GAAY,EAAZ,EAAiBC,GAAjB,CAAwBC,KAAF,IAAa,wBAAYA,KAAZ,CAAnC,CADO,EAEPH,OAAO,CAACI,IAFD,CAAR;AAIAP,IAAAA,mBAAmB,CAClB;AACC;AACA,kBAAI,8BAAJ,CAFD,EAGCG,OAAO,CAACK,KAHT,CADkB,EAMlB;AACCC,MAAAA,IAAI,EAAE;AADP,KANkB,CAAnB;AAUA,GAfsB,EAepB,EAfoB,CAAvB;AAiBA,SAAO,CAAEf,QAAF,EAAYD,iBAAZ,EAA+BS,cAA/B,CAAP;AACA,CAhCD;;eAkCeZ,gB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useCallback } from '@wordpress/element';\nimport { cloneBlock } from '@wordpress/blocks';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../../store';\n\n/**\n * Retrieves the block patterns inserter state.\n *\n * @param {Function} onInsert function called when inserter a list of blocks.\n * @param {string=} rootClientId Insertion's root client ID.\n *\n * @return {Array} Returns the patterns state. (patterns, categories, onSelect handler)\n */\nconst usePatternsState = ( onInsert, rootClientId ) => {\n\tconst { patternCategories, patterns } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { __experimentalGetAllowedPatterns, getSettings } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\treturn {\n\t\t\t\tpatterns: __experimentalGetAllowedPatterns( rootClientId ),\n\t\t\t\tpatternCategories:\n\t\t\t\t\tgetSettings().__experimentalBlockPatternCategories,\n\t\t\t};\n\t\t},\n\t\t[ rootClientId ]\n\t);\n\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\tconst onClickPattern = useCallback( ( pattern, blocks ) => {\n\t\tonInsert(\n\t\t\t( blocks ?? [] ).map( ( block ) => cloneBlock( block ) ),\n\t\t\tpattern.name\n\t\t);\n\t\tcreateSuccessNotice(\n\t\t\tsprintf(\n\t\t\t\t/* translators: %s: block pattern title. */\n\t\t\t\t__( 'Block pattern \"%s\" inserted.' ),\n\t\t\t\tpattern.title\n\t\t\t),\n\t\t\t{\n\t\t\t\ttype: 'snackbar',\n\t\t\t}\n\t\t);\n\t}, [] );\n\n\treturn [ patterns, patternCategories, onClickPattern ];\n};\n\nexport default usePatternsState;\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/inserter/hooks/use-patterns-state.js"],"names":["CUSTOM_CATEGORY","name","label","description","usePatternsState","onInsert","rootClientId","patternCategories","patterns","select","__experimentalGetAllowedPatterns","getSettings","blockEditorStore","__experimentalBlockPatternCategories","allCategories","createSuccessNotice","noticesStore","onClickPattern","pattern","blocks","map","block","title","type"],"mappings":";;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AAZA;AACA;AACA;;AAOA;AACA;AACA;AAGA,MAAMA,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AAEG,QAAF,EAAYM,aAAZ,EAA2BG,cAA3B,CAAP;AACA,CA1CD;;eA4Ceb,gB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useCallback, useMemo } from '@wordpress/element';\nimport { cloneBlock } from '@wordpress/blocks';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../../store';\n\nconst CUSTOM_CATEGORY = {\n\tname: 'custom',\n\tlabel: __( 'My patterns' ),\n\tdescription: __( 'Custom patterns add by site users' ),\n};\n\n/**\n * Retrieves the block patterns inserter state.\n *\n * @param {Function} onInsert function called when inserter a list of blocks.\n * @param {string=} rootClientId Insertion's root client ID.\n *\n * @return {Array} Returns the patterns state. (patterns, categories, onSelect handler)\n */\nconst usePatternsState = ( onInsert, rootClientId ) => {\n\tconst { patternCategories, patterns } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { __experimentalGetAllowedPatterns, getSettings } =\n\t\t\t\tselect( blockEditorStore );\n\n\t\t\treturn {\n\t\t\t\tpatterns: __experimentalGetAllowedPatterns( rootClientId ),\n\t\t\t\tpatternCategories:\n\t\t\t\t\tgetSettings().__experimentalBlockPatternCategories,\n\t\t\t};\n\t\t},\n\t\t[ rootClientId ]\n\t);\n\n\tconst allCategories = useMemo(\n\t\t() => [ ...patternCategories, CUSTOM_CATEGORY ],\n\t\t[ patternCategories ]\n\t);\n\n\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\tconst onClickPattern = useCallback(\n\t\t( pattern, blocks ) => {\n\t\t\tonInsert(\n\t\t\t\t( blocks ?? [] ).map( ( block ) => cloneBlock( block ) ),\n\t\t\t\tpattern.name\n\t\t\t);\n\t\t\tcreateSuccessNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t/* translators: %s: block pattern title. */\n\t\t\t\t\t__( 'Block pattern \"%s\" inserted.' ),\n\t\t\t\t\tpattern.title\n\t\t\t\t),\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t}\n\t\t\t);\n\t\t},\n\t\t[ createSuccessNotice, onInsert ]\n\t);\n\n\treturn [ patterns, allCategories, onClickPattern ];\n};\n\nexport default usePatternsState;\n"]}
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = ReusableBlocksRenameHint;
7
+
8
+ var _element = require("@wordpress/element");
9
+
10
+ var _components = require("@wordpress/components");
11
+
12
+ var _data = require("@wordpress/data");
13
+
14
+ var _dom = require("@wordpress/dom");
15
+
16
+ var _i18n = require("@wordpress/i18n");
17
+
18
+ var _icons = require("@wordpress/icons");
19
+
20
+ var _preferences = require("@wordpress/preferences");
21
+
22
+ /**
23
+ * WordPress dependencies
24
+ */
25
+ const PREFERENCE_NAME = 'isResuableBlocksrRenameHintVisible';
26
+
27
+ function ReusableBlocksRenameHint() {
28
+ const isReusableBlocksRenameHint = (0, _data.useSelect)(select => {
29
+ var _select$get;
30
+
31
+ return (_select$get = select(_preferences.store).get('core', PREFERENCE_NAME)) !== null && _select$get !== void 0 ? _select$get : true;
32
+ }, []);
33
+ const ref = (0, _element.useRef)();
34
+ const {
35
+ set: setPreference
36
+ } = (0, _data.useDispatch)(_preferences.store);
37
+
38
+ if (!isReusableBlocksRenameHint) {
39
+ return null;
40
+ }
41
+
42
+ return (0, _element.createElement)("div", {
43
+ ref: ref,
44
+ className: "reusable-blocks-menu-items__rename-hint"
45
+ }, (0, _element.createElement)("div", {
46
+ className: "reusable-blocks-menu-items__rename-hint-content"
47
+ }, (0, _i18n.__)('Reusable blocks are now called patterns. A synced pattern will behave in exactly the same way as a reusable block.')), (0, _element.createElement)(_components.Button, {
48
+ className: "reusable-blocks-menu-items__rename-hint-dismiss",
49
+ icon: _icons.close,
50
+ iconSize: "16",
51
+ label: (0, _i18n.__)('Dismiss hint'),
52
+ onClick: () => {
53
+ // Retain focus when dismissing the element.
54
+ const previousElement = _dom.focus.tabbable.findPrevious(ref.current);
55
+
56
+ previousElement?.focus();
57
+ setPreference('core', PREFERENCE_NAME, false);
58
+ },
59
+ showTooltip: false
60
+ }));
61
+ }
62
+ //# sourceMappingURL=reusable-block-rename-hint.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/inserter/reusable-block-rename-hint.js"],"names":["PREFERENCE_NAME","ReusableBlocksRenameHint","isReusableBlocksRenameHint","select","preferencesStore","get","ref","set","setPreference","close","previousElement","focus","tabbable","findPrevious","current"],"mappings":";;;;;;;AAMA;;AAHA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AATA;AACA;AACA;AASA,MAAMA,eAAe,GAAG,oCAAxB;;AAEe,SAASC,wBAAT,GAAoC;AAClD,QAAMC,0BAA0B,GAAG,qBAChCC,MAAF;AAAA;;AAAA,0BACCA,MAAM,CAAEC,kBAAF,CAAN,CAA2BC,GAA3B,CAAgC,MAAhC,EAAwCL,eAAxC,CADD,qDAC8D,IAD9D;AAAA,GADkC,EAGlC,EAHkC,CAAnC;AAMA,QAAMM,GAAG,GAAG,sBAAZ;AAEA,QAAM;AAAEC,IAAAA,GAAG,EAAEC;AAAP,MAAyB,uBAAaJ,kBAAb,CAA/B;;AACA,MAAK,CAAEF,0BAAP,EAAoC;AACnC,WAAO,IAAP;AACA;;AAED,SACC;AAAK,IAAA,GAAG,EAAGI,GAAX;AAAiB,IAAA,SAAS,EAAC;AAA3B,KACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACG,cACD,oHADC,CADH,CADD,EAMC,4BAAC,kBAAD;AACC,IAAA,SAAS,EAAC,iDADX;AAEC,IAAA,IAAI,EAAGG,YAFR;AAGC,IAAA,QAAQ,EAAC,IAHV;AAIC,IAAA,KAAK,EAAG,cAAI,cAAJ,CAJT;AAKC,IAAA,OAAO,EAAG,MAAM;AACf;AACA,YAAMC,eAAe,GAAGC,WAAMC,QAAN,CAAeC,YAAf,CACvBP,GAAG,CAACQ,OADmB,CAAxB;;AAGAJ,MAAAA,eAAe,EAAEC,KAAjB;AACAH,MAAAA,aAAa,CAAE,MAAF,EAAUR,eAAV,EAA2B,KAA3B,CAAb;AACA,KAZF;AAaC,IAAA,WAAW,EAAG;AAbf,IAND,CADD;AAwBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Button } from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { focus } from '@wordpress/dom';\nimport { useRef } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { close } from '@wordpress/icons';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\nconst PREFERENCE_NAME = 'isResuableBlocksrRenameHintVisible';\n\nexport default function ReusableBlocksRenameHint() {\n\tconst isReusableBlocksRenameHint = useSelect(\n\t\t( select ) =>\n\t\t\tselect( preferencesStore ).get( 'core', PREFERENCE_NAME ) ?? true,\n\t\t[]\n\t);\n\n\tconst ref = useRef();\n\n\tconst { set: setPreference } = useDispatch( preferencesStore );\n\tif ( ! isReusableBlocksRenameHint ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<div ref={ ref } className=\"reusable-blocks-menu-items__rename-hint\">\n\t\t\t<div className=\"reusable-blocks-menu-items__rename-hint-content\">\n\t\t\t\t{ __(\n\t\t\t\t\t'Reusable blocks are now called patterns. A synced pattern will behave in exactly the same way as a reusable block.'\n\t\t\t\t) }\n\t\t\t</div>\n\t\t\t<Button\n\t\t\t\tclassName=\"reusable-blocks-menu-items__rename-hint-dismiss\"\n\t\t\t\ticon={ close }\n\t\t\t\ticonSize=\"16\"\n\t\t\t\tlabel={ __( 'Dismiss hint' ) }\n\t\t\t\tonClick={ () => {\n\t\t\t\t\t// Retain focus when dismissing the element.\n\t\t\t\t\tconst previousElement = focus.tabbable.findPrevious(\n\t\t\t\t\t\tref.current\n\t\t\t\t\t);\n\t\t\t\t\tpreviousElement?.focus();\n\t\t\t\t\tsetPreference( 'core', PREFERENCE_NAME, false );\n\t\t\t\t} }\n\t\t\t\tshowTooltip={ false }\n\t\t\t/>\n\t\t</div>\n\t);\n}\n"]}
@@ -24,6 +24,8 @@ var _noResults = _interopRequireDefault(require("./no-results"));
24
24
 
25
25
  var _useBlockTypesState = _interopRequireDefault(require("./hooks/use-block-types-state"));
26
26
 
27
+ var _reusableBlockRenameHint = _interopRequireDefault(require("./reusable-block-rename-hint"));
28
+
27
29
  /**
28
30
  * WordPress dependencies
29
31
  */
@@ -74,7 +76,9 @@ function ReusableBlocksTab({
74
76
  onInsert,
75
77
  onHover
76
78
  }) {
77
- return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(ReusableBlocksList, {
79
+ return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)("div", {
80
+ className: "block-editor-inserter__hint"
81
+ }, (0, _element.createElement)(_reusableBlockRenameHint.default, null)), (0, _element.createElement)(ReusableBlocksList, {
78
82
  onHover: onHover,
79
83
  onInsert: onInsert,
80
84
  rootClientId: rootClientId
@@ -86,7 +90,7 @@ function ReusableBlocksTab({
86
90
  href: (0, _url.addQueryArgs)('edit.php', {
87
91
  post_type: 'wp_block'
88
92
  })
89
- }, (0, _i18n.__)('Manage custom patterns'))));
93
+ }, (0, _i18n.__)('Manage my patterns'))));
90
94
  }
91
95
 
92
96
  var _default = ReusableBlocksTab;
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/inserter/reusable-blocks-tab.js"],"names":["ReusableBlocksList","onHover","onInsert","rootClientId","items","onSelectItem","filteredItems","filter","category","length","ReusableBlocksTab","post_type"],"mappings":";;;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AAdA;AACA;AACA;;AAMA;AACA;AACA;AAMA,SAASA,kBAAT,CAA6B;AAAEC,EAAAA,OAAF;AAAWC,EAAAA,QAAX;AAAqBC,EAAAA;AAArB,CAA7B,EAAmE;AAClE,QAAM,CAAEC,KAAF,IAAaC,YAAb,IAA8B,iCACnCF,YADmC,EAEnCD,QAFmC,CAApC;AAKA,QAAMI,aAAa,GAAG,sBAAS,MAAM;AACpC,WAAOF,KAAK,CAACG,MAAN,CAAc,CAAE;AAAEC,MAAAA;AAAF,KAAF,KAAoBA,QAAQ,KAAK,UAA/C,CAAP;AACA,GAFqB,EAEnB,CAAEJ,KAAF,CAFmB,CAAtB;;AAIA,MAAKE,aAAa,CAACG,MAAd,KAAyB,CAA9B,EAAkC;AACjC,WAAO,4BAAC,kBAAD,OAAP;AACA;;AAED,SACC,4BAAC,cAAD;AAAe,IAAA,KAAK,EAAG,cAAI,iBAAJ;AAAvB,KACC,4BAAC,uBAAD;AACC,IAAA,KAAK,EAAGH,aADT;AAEC,IAAA,QAAQ,EAAGD,YAFZ;AAGC,IAAA,OAAO,EAAGJ,OAHX;AAIC,IAAA,KAAK,EAAG,cAAI,iBAAJ;AAJT,IADD,CADD;AAUA,C,CAED;;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASS,iBAAT,CAA4B;AAAEP,EAAAA,YAAF;AAAgBD,EAAAA,QAAhB;AAA0BD,EAAAA;AAA1B,CAA5B,EAAkE;AACxE,SACC,qDACC,4BAAC,kBAAD;AACC,IAAA,OAAO,EAAGA,OADX;AAEC,IAAA,QAAQ,EAAGC,QAFZ;AAGC,IAAA,YAAY,EAAGC;AAHhB,IADD,EAMC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,4BAAC,kBAAD;AACC,IAAA,SAAS,EAAC,+CADX;AAEC,IAAA,OAAO,EAAC,WAFT;AAGC,IAAA,IAAI,EAAG,uBAAc,UAAd,EAA0B;AAChCQ,MAAAA,SAAS,EAAE;AADqB,KAA1B;AAHR,KAOG,cAAI,wBAAJ,CAPH,CADD,CAND,CADD;AAoBA;;eAEcD,iB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { addQueryArgs } from '@wordpress/url';\nimport { Button } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport BlockTypesList from '../block-types-list';\nimport InserterPanel from './panel';\nimport InserterNoResults from './no-results';\nimport useBlockTypesState from './hooks/use-block-types-state';\n\nfunction ReusableBlocksList( { onHover, onInsert, rootClientId } ) {\n\tconst [ items, , , onSelectItem ] = useBlockTypesState(\n\t\trootClientId,\n\t\tonInsert\n\t);\n\n\tconst filteredItems = useMemo( () => {\n\t\treturn items.filter( ( { category } ) => category === 'reusable' );\n\t}, [ items ] );\n\n\tif ( filteredItems.length === 0 ) {\n\t\treturn <InserterNoResults />;\n\t}\n\n\treturn (\n\t\t<InserterPanel title={ __( 'Synced patterns' ) }>\n\t\t\t<BlockTypesList\n\t\t\t\titems={ filteredItems }\n\t\t\t\tonSelect={ onSelectItem }\n\t\t\t\tonHover={ onHover }\n\t\t\t\tlabel={ __( 'Synced patterns' ) }\n\t\t\t/>\n\t\t</InserterPanel>\n\t);\n}\n\n// The unwrapped component is only exported for use by unit tests.\n/**\n * List of reusable blocks shown in the \"Reusable\" tab of the inserter.\n *\n * @param {Object} props Component props.\n * @param {?string} props.rootClientId Client id of block to insert into.\n * @param {Function} props.onInsert Callback to run when item is inserted.\n * @param {Function} props.onHover Callback to run when item is hovered.\n *\n * @return {WPComponent} The component.\n */\nexport function ReusableBlocksTab( { rootClientId, onInsert, onHover } ) {\n\treturn (\n\t\t<>\n\t\t\t<ReusableBlocksList\n\t\t\t\tonHover={ onHover }\n\t\t\t\tonInsert={ onInsert }\n\t\t\t\trootClientId={ rootClientId }\n\t\t\t/>\n\t\t\t<div className=\"block-editor-inserter__manage-reusable-blocks-container\">\n\t\t\t\t<Button\n\t\t\t\t\tclassName=\"block-editor-inserter__manage-reusable-blocks\"\n\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\thref={ addQueryArgs( 'edit.php', {\n\t\t\t\t\t\tpost_type: 'wp_block',\n\t\t\t\t\t} ) }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Manage custom patterns' ) }\n\t\t\t\t</Button>\n\t\t\t</div>\n\t\t</>\n\t);\n}\n\nexport default ReusableBlocksTab;\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/inserter/reusable-blocks-tab.js"],"names":["ReusableBlocksList","onHover","onInsert","rootClientId","items","onSelectItem","filteredItems","filter","category","length","ReusableBlocksTab","post_type"],"mappings":";;;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AAfA;AACA;AACA;;AAMA;AACA;AACA;AAOA,SAASA,kBAAT,CAA6B;AAAEC,EAAAA,OAAF;AAAWC,EAAAA,QAAX;AAAqBC,EAAAA;AAArB,CAA7B,EAAmE;AAClE,QAAM,CAAEC,KAAF,IAAaC,YAAb,IAA8B,iCACnCF,YADmC,EAEnCD,QAFmC,CAApC;AAKA,QAAMI,aAAa,GAAG,sBAAS,MAAM;AACpC,WAAOF,KAAK,CAACG,MAAN,CAAc,CAAE;AAAEC,MAAAA;AAAF,KAAF,KAAoBA,QAAQ,KAAK,UAA/C,CAAP;AACA,GAFqB,EAEnB,CAAEJ,KAAF,CAFmB,CAAtB;;AAIA,MAAKE,aAAa,CAACG,MAAd,KAAyB,CAA9B,EAAkC;AACjC,WAAO,4BAAC,kBAAD,OAAP;AACA;;AAED,SACC,4BAAC,cAAD;AAAe,IAAA,KAAK,EAAG,cAAI,iBAAJ;AAAvB,KACC,4BAAC,uBAAD;AACC,IAAA,KAAK,EAAGH,aADT;AAEC,IAAA,QAAQ,EAAGD,YAFZ;AAGC,IAAA,OAAO,EAAGJ,OAHX;AAIC,IAAA,KAAK,EAAG,cAAI,iBAAJ;AAJT,IADD,CADD;AAUA,C,CAED;;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASS,iBAAT,CAA4B;AAAEP,EAAAA,YAAF;AAAgBD,EAAAA,QAAhB;AAA0BD,EAAAA;AAA1B,CAA5B,EAAkE;AACxE,SACC,qDACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,4BAAC,gCAAD,OADD,CADD,EAIC,4BAAC,kBAAD;AACC,IAAA,OAAO,EAAGA,OADX;AAEC,IAAA,QAAQ,EAAGC,QAFZ;AAGC,IAAA,YAAY,EAAGC;AAHhB,IAJD,EASC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,4BAAC,kBAAD;AACC,IAAA,SAAS,EAAC,+CADX;AAEC,IAAA,OAAO,EAAC,WAFT;AAGC,IAAA,IAAI,EAAG,uBAAc,UAAd,EAA0B;AAChCQ,MAAAA,SAAS,EAAE;AADqB,KAA1B;AAHR,KAOG,cAAI,oBAAJ,CAPH,CADD,CATD,CADD;AAuBA;;eAEcD,iB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { addQueryArgs } from '@wordpress/url';\nimport { Button } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport BlockTypesList from '../block-types-list';\nimport InserterPanel from './panel';\nimport InserterNoResults from './no-results';\nimport useBlockTypesState from './hooks/use-block-types-state';\nimport ReusableBlocksRenameHint from './reusable-block-rename-hint';\n\nfunction ReusableBlocksList( { onHover, onInsert, rootClientId } ) {\n\tconst [ items, , , onSelectItem ] = useBlockTypesState(\n\t\trootClientId,\n\t\tonInsert\n\t);\n\n\tconst filteredItems = useMemo( () => {\n\t\treturn items.filter( ( { category } ) => category === 'reusable' );\n\t}, [ items ] );\n\n\tif ( filteredItems.length === 0 ) {\n\t\treturn <InserterNoResults />;\n\t}\n\n\treturn (\n\t\t<InserterPanel title={ __( 'Synced patterns' ) }>\n\t\t\t<BlockTypesList\n\t\t\t\titems={ filteredItems }\n\t\t\t\tonSelect={ onSelectItem }\n\t\t\t\tonHover={ onHover }\n\t\t\t\tlabel={ __( 'Synced patterns' ) }\n\t\t\t/>\n\t\t</InserterPanel>\n\t);\n}\n\n// The unwrapped component is only exported for use by unit tests.\n/**\n * List of reusable blocks shown in the \"Reusable\" tab of the inserter.\n *\n * @param {Object} props Component props.\n * @param {?string} props.rootClientId Client id of block to insert into.\n * @param {Function} props.onInsert Callback to run when item is inserted.\n * @param {Function} props.onHover Callback to run when item is hovered.\n *\n * @return {WPComponent} The component.\n */\nexport function ReusableBlocksTab( { rootClientId, onInsert, onHover } ) {\n\treturn (\n\t\t<>\n\t\t\t<div className=\"block-editor-inserter__hint\">\n\t\t\t\t<ReusableBlocksRenameHint />\n\t\t\t</div>\n\t\t\t<ReusableBlocksList\n\t\t\t\tonHover={ onHover }\n\t\t\t\tonInsert={ onInsert }\n\t\t\t\trootClientId={ rootClientId }\n\t\t\t/>\n\t\t\t<div className=\"block-editor-inserter__manage-reusable-blocks-container\">\n\t\t\t\t<Button\n\t\t\t\t\tclassName=\"block-editor-inserter__manage-reusable-blocks\"\n\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\thref={ addQueryArgs( 'edit.php', {\n\t\t\t\t\t\tpost_type: 'wp_block',\n\t\t\t\t\t} ) }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Manage my patterns' ) }\n\t\t\t\t</Button>\n\t\t\t</div>\n\t\t</>\n\t);\n}\n\nexport default ReusableBlocksTab;\n"]}
@@ -26,12 +26,12 @@ function useListViewClientIds({
26
26
  const {
27
27
  getDraggedBlockClientIds,
28
28
  getSelectedBlockClientIds,
29
- getListViewClientIdsTree
29
+ getEnabledClientIdsTree
30
30
  } = (0, _lockUnlock.unlock)(select(_store.store));
31
31
  return {
32
32
  selectedClientIds: getSelectedBlockClientIds(),
33
33
  draggedClientIds: getDraggedBlockClientIds(),
34
- clientIdsTree: blocks !== null && blocks !== void 0 ? blocks : getListViewClientIdsTree(rootClientId)
34
+ clientIdsTree: blocks !== null && blocks !== void 0 ? blocks : getEnabledClientIdsTree(rootClientId)
35
35
  };
36
36
  }, [blocks, rootClientId]);
37
37
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/list-view/use-list-view-client-ids.js"],"names":["useListViewClientIds","blocks","rootClientId","select","getDraggedBlockClientIds","getSelectedBlockClientIds","getListViewClientIdsTree","blockEditorStore","selectedClientIds","draggedClientIds","clientIdsTree"],"mappings":";;;;;;;AAIA;;AAKA;;AACA;;AAVA;AACA;AACA;;AAIA;AACA;AACA;AAIe,SAASA,oBAAT,CAA+B;AAAEC,EAAAA,MAAF;AAAUC,EAAAA;AAAV,CAA/B,EAA0D;AACxE,SAAO,qBACJC,MAAF,IAAc;AACb,UAAM;AACLC,MAAAA,wBADK;AAELC,MAAAA,yBAFK;AAGLC,MAAAA;AAHK,QAIF,wBAAQH,MAAM,CAAEI,YAAF,CAAd,CAJJ;AAMA,WAAO;AACNC,MAAAA,iBAAiB,EAAEH,yBAAyB,EADtC;AAENI,MAAAA,gBAAgB,EAAEL,wBAAwB,EAFpC;AAGNM,MAAAA,aAAa,EACZT,MADY,aACZA,MADY,cACZA,MADY,GACFK,wBAAwB,CAAEJ,YAAF;AAJ7B,KAAP;AAMA,GAdK,EAeN,CAAED,MAAF,EAAUC,YAAV,CAfM,CAAP;AAiBA","sourcesContent":["/**\n * WordPress dependencies\n */\n\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nexport default function useListViewClientIds( { blocks, rootClientId } ) {\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetDraggedBlockClientIds,\n\t\t\t\tgetSelectedBlockClientIds,\n\t\t\t\tgetListViewClientIdsTree,\n\t\t\t} = unlock( select( blockEditorStore ) );\n\n\t\t\treturn {\n\t\t\t\tselectedClientIds: getSelectedBlockClientIds(),\n\t\t\t\tdraggedClientIds: getDraggedBlockClientIds(),\n\t\t\t\tclientIdsTree:\n\t\t\t\t\tblocks ?? getListViewClientIdsTree( rootClientId ),\n\t\t\t};\n\t\t},\n\t\t[ blocks, rootClientId ]\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/list-view/use-list-view-client-ids.js"],"names":["useListViewClientIds","blocks","rootClientId","select","getDraggedBlockClientIds","getSelectedBlockClientIds","getEnabledClientIdsTree","blockEditorStore","selectedClientIds","draggedClientIds","clientIdsTree"],"mappings":";;;;;;;AAIA;;AAKA;;AACA;;AAVA;AACA;AACA;;AAIA;AACA;AACA;AAIe,SAASA,oBAAT,CAA+B;AAAEC,EAAAA,MAAF;AAAUC,EAAAA;AAAV,CAA/B,EAA0D;AACxE,SAAO,qBACJC,MAAF,IAAc;AACb,UAAM;AACLC,MAAAA,wBADK;AAELC,MAAAA,yBAFK;AAGLC,MAAAA;AAHK,QAIF,wBAAQH,MAAM,CAAEI,YAAF,CAAd,CAJJ;AAMA,WAAO;AACNC,MAAAA,iBAAiB,EAAEH,yBAAyB,EADtC;AAENI,MAAAA,gBAAgB,EAAEL,wBAAwB,EAFpC;AAGNM,MAAAA,aAAa,EACZT,MADY,aACZA,MADY,cACZA,MADY,GACFK,uBAAuB,CAAEJ,YAAF;AAJ5B,KAAP;AAMA,GAdK,EAeN,CAAED,MAAF,EAAUC,YAAV,CAfM,CAAP;AAiBA","sourcesContent":["/**\n * WordPress dependencies\n */\n\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nexport default function useListViewClientIds( { blocks, rootClientId } ) {\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetDraggedBlockClientIds,\n\t\t\t\tgetSelectedBlockClientIds,\n\t\t\t\tgetEnabledClientIdsTree,\n\t\t\t} = unlock( select( blockEditorStore ) );\n\n\t\t\treturn {\n\t\t\t\tselectedClientIds: getSelectedBlockClientIds(),\n\t\t\t\tdraggedClientIds: getDraggedBlockClientIds(),\n\t\t\t\tclientIdsTree:\n\t\t\t\t\tblocks ?? getEnabledClientIdsTree( rootClientId ),\n\t\t\t};\n\t\t},\n\t\t[ blocks, rootClientId ]\n\t);\n}\n"]}
@@ -6,9 +6,8 @@ Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
8
  exports.getBlockEditingMode = getBlockEditingMode;
9
- exports.getEnabledBlockParents = void 0;
9
+ exports.getEnabledClientIdsTree = exports.getEnabledBlockParents = void 0;
10
10
  exports.getLastInsertedBlocksClientIds = getLastInsertedBlocksClientIds;
11
- exports.getListViewClientIdsTree = void 0;
12
11
  exports.getRemovalPromptData = getRemovalPromptData;
13
12
  exports.isBlockInterfaceHidden = isBlockInterfaceHidden;
14
13
  exports.isBlockSubtreeDisabled = void 0;
@@ -148,16 +147,16 @@ const isBlockSubtreeDisabled = (0, _rememo.default)((state, clientId) => {
148
147
  */
149
148
 
150
149
  exports.isBlockSubtreeDisabled = isBlockSubtreeDisabled;
151
- const getListViewClientIdsTree = (0, _rememo.default)((state, rootClientId = '') => {
150
+ const getEnabledClientIdsTree = (0, _rememo.default)((state, rootClientId = '') => {
152
151
  return (0, _selectors.getBlockOrder)(state, rootClientId).flatMap(clientId => {
153
152
  if (getBlockEditingMode(state, clientId) !== 'disabled') {
154
153
  return [{
155
154
  clientId,
156
- innerBlocks: getListViewClientIdsTree(state, clientId)
155
+ innerBlocks: getEnabledClientIdsTree(state, clientId)
157
156
  }];
158
157
  }
159
158
 
160
- return getListViewClientIdsTree(state, clientId);
159
+ return getEnabledClientIdsTree(state, clientId);
161
160
  });
162
161
  }, state => [state.blocks.order, state.blockEditingModes, state.settings.templateLock, state.blockListSettings]);
163
162
  /**
@@ -172,7 +171,7 @@ const getListViewClientIdsTree = (0, _rememo.default)((state, rootClientId = '')
172
171
  * to bottom (false).
173
172
  */
174
173
 
175
- exports.getListViewClientIdsTree = getListViewClientIdsTree;
174
+ exports.getEnabledClientIdsTree = getEnabledClientIdsTree;
176
175
  const getEnabledBlockParents = (0, _rememo.default)((state, clientId, ascending = false) => {
177
176
  return (0, _selectors.getBlockParents)(state, clientId, ascending).filter(parent => getBlockEditingMode(state, parent) !== 'disabled');
178
177
  }, state => [state.blocks.parents, state.blockEditingModes, state.settings.templateLock, state.blockListSettings]);