@wordpress/edit-site 5.12.0 → 5.12.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +5 -0
- package/build/components/add-new-pattern/index.js +99 -0
- package/build/components/add-new-pattern/index.js.map +1 -0
- package/build/components/add-new-template/add-custom-template-modal-content.js +9 -23
- package/build/components/add-new-template/add-custom-template-modal-content.js.map +1 -1
- package/build/components/add-new-template/index.js +2 -10
- package/build/components/add-new-template/index.js.map +1 -1
- package/build/components/add-new-template/new-template.js +75 -22
- package/build/components/add-new-template/new-template.js.map +1 -1
- package/build/components/app/index.js +2 -2
- package/build/components/app/index.js.map +1 -1
- package/build/components/block-editor/back-button.js +5 -3
- package/build/components/block-editor/back-button.js.map +1 -1
- package/build/components/block-editor/constants.js +9 -0
- package/build/components/block-editor/constants.js.map +1 -0
- package/build/components/block-editor/editor-canvas.js +8 -8
- package/build/components/block-editor/editor-canvas.js.map +1 -1
- package/build/components/block-editor/get-block-editor-provider.js +42 -0
- package/build/components/block-editor/get-block-editor-provider.js.map +1 -0
- package/build/components/block-editor/index.js +6 -132
- package/build/components/block-editor/index.js.map +1 -1
- package/build/components/block-editor/providers/default-block-editor-provider.js +58 -0
- package/build/components/block-editor/providers/default-block-editor-provider.js.map +1 -0
- package/build/components/block-editor/providers/navigation-block-editor-provider.js +117 -0
- package/build/components/block-editor/providers/navigation-block-editor-provider.js.map +1 -0
- package/build/components/block-editor/site-editor-canvas.js +137 -0
- package/build/components/block-editor/site-editor-canvas.js.map +1 -0
- package/build/components/block-editor/use-site-editor-settings.js +82 -0
- package/build/components/block-editor/use-site-editor-settings.js.map +1 -0
- package/build/components/canvas-spinner/index.js +18 -1
- package/build/components/canvas-spinner/index.js.map +1 -1
- package/build/components/create-pattern-modal/index.js +125 -0
- package/build/components/create-pattern-modal/index.js.map +1 -0
- package/build/components/create-template-part-modal/index.js +50 -6
- package/build/components/create-template-part-modal/index.js.map +1 -1
- package/build/components/editor/index.js +24 -13
- package/build/components/editor/index.js.map +1 -1
- package/build/components/editor-canvas-container/index.js +22 -4
- package/build/components/editor-canvas-container/index.js.map +1 -1
- package/build/components/global-styles/color-indicator-wrapper.js +4 -5
- package/build/components/global-styles/color-indicator-wrapper.js.map +1 -1
- package/build/components/global-styles/color-palette-panel.js +2 -2
- package/build/components/global-styles/color-palette-panel.js.map +1 -1
- package/build/components/global-styles/dimensions-panel.js +2 -2
- package/build/components/global-styles/dimensions-panel.js.map +1 -1
- package/build/components/global-styles/global-styles-provider.js +12 -16
- package/build/components/global-styles/global-styles-provider.js.map +1 -1
- package/build/components/global-styles/gradients-palette-panel.js +2 -2
- package/build/components/global-styles/gradients-palette-panel.js.map +1 -1
- package/build/components/global-styles/hooks.js +3 -3
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/icon-with-current-color.js +4 -5
- package/build/components/global-styles/icon-with-current-color.js.map +1 -1
- package/build/components/global-styles/navigation-button.js +10 -11
- package/build/components/global-styles/navigation-button.js.map +1 -1
- package/build/components/global-styles/palette.js +3 -3
- package/build/components/global-styles/palette.js.map +1 -1
- package/build/components/global-styles/preview.js +2 -2
- package/build/components/global-styles/preview.js.map +1 -1
- package/build/components/global-styles/root-menu.js +2 -2
- package/build/components/global-styles/root-menu.js.map +1 -1
- package/build/components/global-styles/screen-block-list.js +2 -2
- package/build/components/global-styles/screen-block-list.js.map +1 -1
- package/build/components/global-styles/screen-block.js +2 -2
- package/build/components/global-styles/screen-block.js.map +1 -1
- package/build/components/global-styles/screen-colors.js +2 -2
- package/build/components/global-styles/screen-colors.js.map +1 -1
- package/build/components/global-styles/screen-css.js +2 -2
- package/build/components/global-styles/screen-css.js.map +1 -1
- package/build/components/global-styles/screen-layout.js +2 -2
- package/build/components/global-styles/screen-layout.js.map +1 -1
- package/build/components/global-styles/screen-revisions/index.js +4 -4
- package/build/components/global-styles/screen-revisions/index.js.map +1 -1
- package/build/components/global-styles/screen-revisions/use-global-styles-revisions.js +2 -2
- package/build/components/global-styles/screen-revisions/use-global-styles-revisions.js.map +1 -1
- package/build/components/global-styles/screen-root.js +2 -2
- package/build/components/global-styles/screen-root.js.map +1 -1
- package/build/components/global-styles/screen-typography.js +2 -2
- package/build/components/global-styles/screen-typography.js.map +1 -1
- package/build/components/global-styles/style-variations-container.js +11 -3
- package/build/components/global-styles/style-variations-container.js.map +1 -1
- package/build/components/global-styles/typography-panel.js +2 -2
- package/build/components/global-styles/typography-panel.js.map +1 -1
- package/build/components/global-styles/typography-preview.js +2 -2
- package/build/components/global-styles/typography-preview.js.map +1 -1
- package/build/components/global-styles/ui.js +95 -36
- package/build/components/global-styles/ui.js.map +1 -1
- package/build/components/global-styles-renderer/index.js +2 -2
- package/build/components/global-styles-renderer/index.js.map +1 -1
- package/build/components/header-edit-mode/document-actions/index.js +55 -22
- package/build/components/header-edit-mode/document-actions/index.js.map +1 -1
- package/build/components/header-edit-mode/index.js +41 -16
- package/build/components/header-edit-mode/index.js.map +1 -1
- package/build/components/header-edit-mode/more-menu/index.js +36 -2
- package/build/components/header-edit-mode/more-menu/index.js.map +1 -1
- package/build/components/header-edit-mode/plugin-sidebar-more-menu-item/index.js +4 -7
- package/build/components/header-edit-mode/plugin-sidebar-more-menu-item/index.js.map +1 -1
- package/build/components/header-edit-mode/undo-redo/redo.js +2 -6
- package/build/components/header-edit-mode/undo-redo/redo.js.map +1 -1
- package/build/components/header-edit-mode/undo-redo/undo.js +2 -6
- package/build/components/header-edit-mode/undo-redo/undo.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/index.js +2 -1
- package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build/components/keyboard-shortcuts/edit-mode.js +39 -3
- package/build/components/keyboard-shortcuts/edit-mode.js.map +1 -1
- package/build/components/keyboard-shortcuts/index.js +7 -2
- package/build/components/keyboard-shortcuts/index.js.map +1 -1
- package/build/components/keyboard-shortcuts/register.js +10 -1
- package/build/components/keyboard-shortcuts/register.js.map +1 -1
- package/build/components/layout/hooks.js +21 -0
- package/build/components/layout/hooks.js.map +1 -1
- package/build/components/layout/index.js +126 -34
- package/build/components/layout/index.js.map +1 -1
- package/build/components/list/index.js +2 -2
- package/build/components/list/index.js.map +1 -1
- package/build/components/page/header.js +41 -0
- package/build/components/page/header.js.map +1 -0
- package/build/components/page/index.js +49 -0
- package/build/components/page/index.js.map +1 -0
- package/build/components/page-content-focus-manager/back-to-page-notification.js +73 -0
- package/build/components/page-content-focus-manager/back-to-page-notification.js.map +1 -0
- package/build/components/page-content-focus-manager/constants.js +9 -0
- package/build/components/page-content-focus-manager/constants.js.map +1 -0
- package/build/components/page-content-focus-manager/disable-non-page-content-blocks.js +60 -0
- package/build/components/page-content-focus-manager/disable-non-page-content-blocks.js.map +1 -0
- package/build/components/page-content-focus-manager/edit-template-notification.js +121 -0
- package/build/components/page-content-focus-manager/edit-template-notification.js.map +1 -0
- package/build/components/page-content-focus-manager/index.js +37 -0
- package/build/components/page-content-focus-manager/index.js.map +1 -0
- package/build/components/page-library/grid-item.js +169 -0
- package/build/components/page-library/grid-item.js.map +1 -0
- package/build/components/page-library/grid.js +49 -0
- package/build/components/page-library/grid.js.map +1 -0
- package/build/components/page-library/index.js +61 -0
- package/build/components/page-library/index.js.map +1 -0
- package/build/components/page-library/no-patterns.js +20 -0
- package/build/components/page-library/no-patterns.js.map +1 -0
- package/build/components/page-library/patterns-list.js +108 -0
- package/build/components/page-library/patterns-list.js.map +1 -0
- package/build/components/page-library/search-items.js +172 -0
- package/build/components/page-library/search-items.js.map +1 -0
- package/build/components/page-library/use-library-settings.js +53 -0
- package/build/components/page-library/use-library-settings.js.map +1 -0
- package/build/components/page-library/use-patterns.js +194 -0
- package/build/components/page-library/use-patterns.js.map +1 -0
- package/build/components/page-library/utils.js +30 -0
- package/build/components/page-library/utils.js.map +1 -0
- package/build/components/page-main/index.js +46 -0
- package/build/components/page-main/index.js.map +1 -0
- package/build/components/page-templates/index.js +101 -0
- package/build/components/page-templates/index.js.map +1 -0
- package/build/components/preferences-modal/enable-feature.js +9 -8
- package/build/components/preferences-modal/enable-feature.js.map +1 -1
- package/build/components/preferences-modal/index.js +30 -0
- package/build/components/preferences-modal/index.js.map +1 -1
- package/build/components/resizable-frame/index.js +6 -4
- package/build/components/resizable-frame/index.js.map +1 -1
- package/build/components/revisions/index.js +2 -2
- package/build/components/revisions/index.js.map +1 -1
- package/build/components/routes/link.js +7 -10
- package/build/components/routes/link.js.map +1 -1
- package/build/components/routes/use-title.js +2 -2
- package/build/components/routes/use-title.js.map +1 -1
- package/build/components/save-button/index.js +15 -11
- package/build/components/save-button/index.js.map +1 -1
- package/build/components/save-hub/index.js +2 -2
- package/build/components/save-hub/index.js.map +1 -1
- package/build/components/save-panel/index.js +5 -7
- package/build/components/save-panel/index.js.map +1 -1
- package/build/components/secondary-sidebar/inserter-sidebar.js +4 -8
- package/build/components/secondary-sidebar/inserter-sidebar.js.map +1 -1
- package/build/components/secondary-sidebar/list-view-sidebar.js +47 -10
- package/build/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- package/build/components/sidebar/index.js +12 -8
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar-button/index.js +2 -4
- package/build/components/sidebar-button/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/global-styles-sidebar.js +22 -8
- package/build/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
- package/build/components/sidebar-edit-mode/index.js +8 -6
- package/build/components/sidebar-edit-mode/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/page-panels/edit-template.js +84 -0
- package/build/components/sidebar-edit-mode/page-panels/edit-template.js.map +1 -0
- package/build/components/sidebar-edit-mode/page-panels/index.js +51 -38
- package/build/components/sidebar-edit-mode/page-panels/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/page-panels/page-content.js +35 -0
- package/build/components/sidebar-edit-mode/page-panels/page-content.js.map +1 -0
- package/build/components/sidebar-edit-mode/page-panels/page-status.js +192 -0
- package/build/components/sidebar-edit-mode/page-panels/page-status.js.map +1 -0
- package/build/components/sidebar-edit-mode/page-panels/page-summary.js +45 -0
- package/build/components/sidebar-edit-mode/page-panels/page-summary.js.map +1 -0
- package/build/components/sidebar-edit-mode/page-panels/publish-date.js +98 -0
- package/build/components/sidebar-edit-mode/page-panels/publish-date.js.map +1 -0
- package/build/components/sidebar-edit-mode/plugin-sidebar/index.js +4 -7
- package/build/components/sidebar-edit-mode/plugin-sidebar/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/settings-header/index.js +19 -6
- package/build/components/sidebar-edit-mode/settings-header/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/sidebar-fixed-bottom.js +2 -2
- package/build/components/sidebar-edit-mode/sidebar-fixed-bottom.js.map +1 -1
- package/build/components/sidebar-edit-mode/template-panel/index.js +10 -6
- package/build/components/sidebar-edit-mode/template-panel/index.js.map +1 -1
- package/build/components/sidebar-navigation-item/index.js +11 -7
- package/build/components/sidebar-navigation-item/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen/index.js +24 -9
- package/build/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-details-footer/index.js +36 -0
- package/build/components/sidebar-navigation-screen-details-footer/index.js.map +1 -0
- package/build/components/sidebar-navigation-screen-details-panel/index.js +58 -0
- package/build/components/sidebar-navigation-screen-details-panel/index.js.map +1 -0
- package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-label.js +22 -0
- package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-label.js.map +1 -0
- package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js +35 -0
- package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js.map +1 -0
- package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-value.js +22 -0
- package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-value.js.map +1 -0
- package/build/components/sidebar-navigation-screen-global-styles/index.js +28 -16
- package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-library/category-item.js +48 -0
- package/build/components/sidebar-navigation-screen-library/category-item.js.map +1 -0
- package/build/components/sidebar-navigation-screen-library/index.js +112 -0
- package/build/components/sidebar-navigation-screen-library/index.js.map +1 -0
- package/build/components/sidebar-navigation-screen-library/use-default-pattern-categories.js +36 -0
- package/build/components/sidebar-navigation-screen-library/use-default-pattern-categories.js.map +1 -0
- package/build/components/sidebar-navigation-screen-library/use-pattern-categories.js +76 -0
- package/build/components/sidebar-navigation-screen-library/use-pattern-categories.js.map +1 -0
- package/build/components/sidebar-navigation-screen-library/use-template-part-areas.js +41 -0
- package/build/components/sidebar-navigation-screen-library/use-template-part-areas.js.map +1 -0
- package/build/components/sidebar-navigation-screen-library/use-theme-patterns.js +40 -0
- package/build/components/sidebar-navigation-screen-library/use-theme-patterns.js.map +1 -0
- package/build/components/sidebar-navigation-screen-main/index.js +12 -13
- package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-item/index.js +2 -2
- package/build/components/sidebar-navigation-screen-navigation-item/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/delete-modal.js +42 -0
- package/build/components/sidebar-navigation-screen-navigation-menu/delete-modal.js.map +1 -0
- package/build/components/sidebar-navigation-screen-navigation-menu/edit-button.js +41 -0
- package/build/components/sidebar-navigation-screen-navigation-menu/edit-button.js.map +1 -0
- package/build/components/sidebar-navigation-screen-navigation-menu/index.js +47 -92
- package/build/components/sidebar-navigation-screen-navigation-menu/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/more-menu.js +84 -0
- package/build/components/sidebar-navigation-screen-navigation-menu/more-menu.js.map +1 -0
- package/build/components/sidebar-navigation-screen-navigation-menu/navigation-menu-editor.js +71 -0
- package/build/components/sidebar-navigation-screen-navigation-menu/navigation-menu-editor.js.map +1 -0
- package/build/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +63 -0
- package/build/components/sidebar-navigation-screen-navigation-menu/rename-modal.js.map +1 -0
- package/build/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +49 -0
- package/build/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js.map +1 -0
- package/build/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +167 -0
- package/build/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js.map +1 -0
- package/build/components/sidebar-navigation-screen-navigation-menus/constants.js +3 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/constants.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js +58 -8
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +57 -10
- package/build/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +21 -50
- package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -1
- package/build/components/sidebar-navigation-screen-page/index.js +14 -34
- package/build/components/sidebar-navigation-screen-page/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-page/page-details.js +29 -27
- package/build/components/sidebar-navigation-screen-page/page-details.js.map +1 -1
- package/build/components/sidebar-navigation-screen-page/status-label.js +8 -7
- package/build/components/sidebar-navigation-screen-page/status-label.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pages/index.js +9 -8
- package/build/components/sidebar-navigation-screen-pages/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pattern/index.js +66 -0
- package/build/components/sidebar-navigation-screen-pattern/index.js.map +1 -0
- package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menu-list-item.js +41 -0
- package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menu-list-item.js.map +1 -0
- package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menu-list.js +33 -0
- package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menu-list.js.map +1 -0
- package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js +40 -0
- package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js.map +1 -0
- package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js +47 -0
- package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js.map +1 -0
- package/build/components/sidebar-navigation-screen-pattern/use-navigation-menu-content.js +82 -0
- package/build/components/sidebar-navigation-screen-pattern/use-navigation-menu-content.js.map +1 -0
- package/build/components/sidebar-navigation-screen-pattern/use-pattern-details.js +80 -0
- package/build/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map +1 -0
- package/build/components/sidebar-navigation-screen-template/home-template-details.js +212 -0
- package/build/components/sidebar-navigation-screen-template/home-template-details.js.map +1 -0
- package/build/components/sidebar-navigation-screen-template/index.js +21 -7
- package/build/components/sidebar-navigation-screen-template/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-templates/index.js +11 -11
- package/build/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build/components/site-hub/index.js +10 -12
- package/build/components/site-hub/index.js.map +1 -1
- package/build/components/style-book/index.js +10 -11
- package/build/components/style-book/index.js.map +1 -1
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +14 -4
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +4 -4
- package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -1
- package/build/components/sync-state-with-url/use-sync-path-with-url.js +12 -2
- package/build/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
- package/build/components/table/index.js +29 -0
- package/build/components/table/index.js.map +1 -0
- package/build/components/template-part-converter/convert-to-template-part.js +3 -21
- package/build/components/template-part-converter/convert-to-template-part.js.map +1 -1
- package/build/components/welcome-guide/editor.js +1 -1
- package/build/components/welcome-guide/editor.js.map +1 -1
- package/build/components/welcome-guide/styles.js +4 -3
- package/build/components/welcome-guide/styles.js.map +1 -1
- package/build/hooks/commands/use-common-commands.js +212 -0
- package/build/hooks/commands/use-common-commands.js.map +1 -0
- package/build/hooks/commands/use-edit-mode-commands.js +196 -24
- package/build/hooks/commands/use-edit-mode-commands.js.map +1 -1
- package/build/hooks/index.js +2 -0
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/navigation-menu-edit.js +95 -0
- package/build/hooks/navigation-menu-edit.js.map +1 -0
- package/build/hooks/push-changes-to-global-styles/index.js +5 -3
- package/build/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build/hooks/template-part-edit.js +6 -9
- package/build/hooks/template-part-edit.js.map +1 -1
- package/build/index.js +1 -0
- package/build/index.js.map +1 -1
- package/build/{private-apis.js → lock-unlock.js} +1 -1
- package/build/lock-unlock.js.map +1 -0
- package/build/store/actions.js +45 -9
- package/build/store/actions.js.map +1 -1
- package/build/store/index.js +3 -3
- package/build/store/index.js.map +1 -1
- package/build/store/reducer.js +7 -6
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +42 -17
- package/build/store/selectors.js.map +1 -1
- package/build/utils/get-is-list-page.js +12 -5
- package/build/utils/get-is-list-page.js.map +1 -1
- package/build/utils/is-previewing-theme.js +2 -2
- package/build/utils/is-previewing-theme.js.map +1 -1
- package/build/utils/use-activate-theme.js +3 -3
- package/build/utils/use-activate-theme.js.map +1 -1
- package/build/utils/use-debounced-input.js +26 -0
- package/build/utils/use-debounced-input.js.map +1 -0
- package/build-module/components/add-new-pattern/index.js +82 -0
- package/build-module/components/add-new-pattern/index.js.map +1 -0
- package/build-module/components/add-new-template/add-custom-template-modal-content.js +7 -20
- package/build-module/components/add-new-template/add-custom-template-modal-content.js.map +1 -1
- package/build-module/components/add-new-template/index.js +2 -8
- package/build-module/components/add-new-template/index.js.map +1 -1
- package/build-module/components/add-new-template/new-template.js +76 -22
- package/build-module/components/add-new-template/new-template.js.map +1 -1
- package/build-module/components/app/index.js +1 -1
- package/build-module/components/app/index.js.map +1 -1
- package/build-module/components/block-editor/back-button.js +4 -2
- package/build-module/components/block-editor/back-button.js.map +1 -1
- package/build-module/components/block-editor/constants.js +2 -0
- package/build-module/components/block-editor/constants.js.map +1 -0
- package/build-module/components/block-editor/editor-canvas.js +6 -5
- package/build-module/components/block-editor/editor-canvas.js.map +1 -1
- package/build-module/components/block-editor/get-block-editor-provider.js +31 -0
- package/build-module/components/block-editor/get-block-editor-provider.js.map +1 -0
- package/build-module/components/block-editor/index.js +9 -127
- package/build-module/components/block-editor/index.js.map +1 -1
- package/build-module/components/block-editor/providers/default-block-editor-provider.js +42 -0
- package/build-module/components/block-editor/providers/default-block-editor-provider.js.map +1 -0
- package/build-module/components/block-editor/providers/navigation-block-editor-provider.js +102 -0
- package/build-module/components/block-editor/providers/navigation-block-editor-provider.js.map +1 -0
- package/build-module/components/block-editor/site-editor-canvas.js +115 -0
- package/build-module/components/block-editor/site-editor-canvas.js.map +1 -0
- package/build-module/components/block-editor/use-site-editor-settings.js +67 -0
- package/build-module/components/block-editor/use-site-editor-settings.js.map +1 -0
- package/build-module/components/canvas-spinner/index.js +15 -1
- package/build-module/components/canvas-spinner/index.js.map +1 -1
- package/build-module/components/create-pattern-modal/index.js +113 -0
- package/build-module/components/create-pattern-modal/index.js.map +1 -0
- package/build-module/components/create-template-part-modal/index.js +47 -7
- package/build-module/components/create-template-part-modal/index.js.map +1 -1
- package/build-module/components/editor/index.js +24 -13
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/editor-canvas-container/index.js +19 -2
- package/build-module/components/editor-canvas-container/index.js.map +1 -1
- package/build-module/components/global-styles/color-indicator-wrapper.js +4 -4
- package/build-module/components/global-styles/color-indicator-wrapper.js.map +1 -1
- package/build-module/components/global-styles/color-palette-panel.js +1 -1
- package/build-module/components/global-styles/color-palette-panel.js.map +1 -1
- package/build-module/components/global-styles/dimensions-panel.js +1 -1
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
- package/build-module/components/global-styles/global-styles-provider.js +10 -15
- package/build-module/components/global-styles/global-styles-provider.js.map +1 -1
- package/build-module/components/global-styles/gradients-palette-panel.js +1 -1
- package/build-module/components/global-styles/gradients-palette-panel.js.map +1 -1
- package/build-module/components/global-styles/hooks.js +1 -1
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/icon-with-current-color.js +4 -4
- package/build-module/components/global-styles/icon-with-current-color.js.map +1 -1
- package/build-module/components/global-styles/navigation-button.js +10 -8
- package/build-module/components/global-styles/navigation-button.js.map +1 -1
- package/build-module/components/global-styles/palette.js +2 -2
- package/build-module/components/global-styles/palette.js.map +1 -1
- package/build-module/components/global-styles/preview.js +1 -1
- package/build-module/components/global-styles/preview.js.map +1 -1
- package/build-module/components/global-styles/root-menu.js +1 -1
- package/build-module/components/global-styles/root-menu.js.map +1 -1
- package/build-module/components/global-styles/screen-block-list.js +1 -1
- package/build-module/components/global-styles/screen-block-list.js.map +1 -1
- package/build-module/components/global-styles/screen-block.js +1 -1
- package/build-module/components/global-styles/screen-block.js.map +1 -1
- package/build-module/components/global-styles/screen-colors.js +1 -1
- package/build-module/components/global-styles/screen-colors.js.map +1 -1
- package/build-module/components/global-styles/screen-css.js +1 -1
- package/build-module/components/global-styles/screen-css.js.map +1 -1
- package/build-module/components/global-styles/screen-layout.js +1 -1
- package/build-module/components/global-styles/screen-layout.js.map +1 -1
- package/build-module/components/global-styles/screen-revisions/index.js +1 -1
- package/build-module/components/global-styles/screen-revisions/index.js.map +1 -1
- package/build-module/components/global-styles/screen-revisions/use-global-styles-revisions.js +1 -1
- package/build-module/components/global-styles/screen-revisions/use-global-styles-revisions.js.map +1 -1
- package/build-module/components/global-styles/screen-root.js +1 -1
- package/build-module/components/global-styles/screen-root.js.map +1 -1
- package/build-module/components/global-styles/screen-typography.js +1 -1
- package/build-module/components/global-styles/screen-typography.js.map +1 -1
- package/build-module/components/global-styles/style-variations-container.js +11 -3
- package/build-module/components/global-styles/style-variations-container.js.map +1 -1
- package/build-module/components/global-styles/typography-panel.js +1 -1
- package/build-module/components/global-styles/typography-panel.js.map +1 -1
- package/build-module/components/global-styles/typography-preview.js +1 -1
- package/build-module/components/global-styles/typography-preview.js.map +1 -1
- package/build-module/components/global-styles/ui.js +94 -35
- package/build-module/components/global-styles/ui.js.map +1 -1
- package/build-module/components/global-styles-renderer/index.js +1 -1
- package/build-module/components/global-styles-renderer/index.js.map +1 -1
- package/build-module/components/header-edit-mode/document-actions/index.js +55 -22
- package/build-module/components/header-edit-mode/document-actions/index.js.map +1 -1
- package/build-module/components/header-edit-mode/index.js +42 -17
- package/build-module/components/header-edit-mode/index.js.map +1 -1
- package/build-module/components/header-edit-mode/more-menu/index.js +35 -3
- package/build-module/components/header-edit-mode/more-menu/index.js.map +1 -1
- package/build-module/components/header-edit-mode/plugin-sidebar-more-menu-item/index.js +4 -4
- package/build-module/components/header-edit-mode/plugin-sidebar-more-menu-item/index.js.map +1 -1
- package/build-module/components/header-edit-mode/undo-redo/redo.js +2 -3
- package/build-module/components/header-edit-mode/undo-redo/redo.js.map +1 -1
- package/build-module/components/header-edit-mode/undo-redo/undo.js +2 -3
- package/build-module/components/header-edit-mode/undo-redo/undo.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/index.js +2 -1
- package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/edit-mode.js +36 -3
- package/build-module/components/keyboard-shortcuts/edit-mode.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/index.js +7 -2
- package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/register.js +10 -1
- package/build-module/components/keyboard-shortcuts/register.js.map +1 -1
- package/build-module/components/layout/hooks.js +21 -0
- package/build-module/components/layout/hooks.js.map +1 -1
- package/build-module/components/layout/index.js +119 -28
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/list/index.js +1 -1
- package/build-module/components/list/index.js.map +1 -1
- package/build-module/components/page/header.js +33 -0
- package/build-module/components/page/header.js.map +1 -0
- package/build-module/components/page/index.js +37 -0
- package/build-module/components/page/index.js.map +1 -0
- package/build-module/components/page-content-focus-manager/back-to-page-notification.js +59 -0
- package/build-module/components/page-content-focus-manager/back-to-page-notification.js.map +1 -0
- package/build-module/components/page-content-focus-manager/constants.js +2 -0
- package/build-module/components/page-content-focus-manager/constants.js.map +1 -0
- package/build-module/components/{page-content-lock/use-disable-non-content-blocks.js → page-content-focus-manager/disable-non-page-content-blocks.js} +18 -9
- package/build-module/components/page-content-focus-manager/disable-non-page-content-blocks.js.map +1 -0
- package/build-module/components/page-content-focus-manager/edit-template-notification.js +110 -0
- package/build-module/components/page-content-focus-manager/edit-template-notification.js.map +1 -0
- package/build-module/components/page-content-focus-manager/index.js +23 -0
- package/build-module/components/page-content-focus-manager/index.js.map +1 -0
- package/build-module/components/page-library/grid-item.js +149 -0
- package/build-module/components/page-library/grid-item.js.map +1 -0
- package/build-module/components/page-library/grid.js +38 -0
- package/build-module/components/page-library/grid.js.map +1 -0
- package/build-module/components/page-library/index.js +43 -0
- package/build-module/components/page-library/index.js.map +1 -0
- package/build-module/components/page-library/no-patterns.js +12 -0
- package/build-module/components/page-library/no-patterns.js.map +1 -0
- package/build-module/components/page-library/patterns-list.js +87 -0
- package/build-module/components/page-library/patterns-list.js.map +1 -0
- package/build-module/components/page-library/search-items.js +156 -0
- package/build-module/components/page-library/search-items.js.map +1 -0
- package/build-module/components/page-library/use-library-settings.js +40 -0
- package/build-module/components/page-library/use-library-settings.js.map +1 -0
- package/build-module/components/page-library/use-patterns.js +176 -0
- package/build-module/components/page-library/use-patterns.js.map +1 -0
- package/build-module/components/page-library/utils.js +13 -0
- package/build-module/components/page-library/utils.js.map +1 -0
- package/build-module/components/page-main/index.js +32 -0
- package/build-module/components/page-main/index.js.map +1 -0
- package/build-module/components/page-templates/index.js +80 -0
- package/build-module/components/page-templates/index.js.map +1 -0
- package/build-module/components/preferences-modal/enable-feature.js +9 -5
- package/build-module/components/preferences-modal/enable-feature.js.map +1 -1
- package/build-module/components/preferences-modal/index.js +27 -0
- package/build-module/components/preferences-modal/index.js.map +1 -1
- package/build-module/components/resizable-frame/index.js +5 -3
- package/build-module/components/resizable-frame/index.js.map +1 -1
- package/build-module/components/revisions/index.js +1 -1
- package/build-module/components/revisions/index.js.map +1 -1
- package/build-module/components/routes/link.js +6 -6
- package/build-module/components/routes/link.js.map +1 -1
- package/build-module/components/routes/use-title.js +1 -1
- package/build-module/components/routes/use-title.js.map +1 -1
- package/build-module/components/save-button/index.js +15 -11
- package/build-module/components/save-button/index.js.map +1 -1
- package/build-module/components/save-hub/index.js +1 -1
- package/build-module/components/save-hub/index.js.map +1 -1
- package/build-module/components/save-panel/index.js +3 -4
- package/build-module/components/save-panel/index.js.map +1 -1
- package/build-module/components/secondary-sidebar/inserter-sidebar.js +4 -5
- package/build-module/components/secondary-sidebar/inserter-sidebar.js.map +1 -1
- package/build-module/components/secondary-sidebar/list-view-sidebar.js +44 -10
- package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- package/build-module/components/sidebar/index.js +10 -7
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar-button/index.js +2 -3
- package/build-module/components/sidebar-button/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js +19 -6
- package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/index.js +8 -6
- package/build-module/components/sidebar-edit-mode/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/page-panels/edit-template.js +71 -0
- package/build-module/components/sidebar-edit-mode/page-panels/edit-template.js.map +1 -0
- package/build-module/components/sidebar-edit-mode/page-panels/index.js +51 -40
- package/build-module/components/sidebar-edit-mode/page-panels/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/page-panels/page-content.js +23 -0
- package/build-module/components/sidebar-edit-mode/page-panels/page-content.js.map +1 -0
- package/build-module/components/sidebar-edit-mode/page-panels/page-status.js +176 -0
- package/build-module/components/sidebar-edit-mode/page-panels/page-status.js.map +1 -0
- package/build-module/components/sidebar-edit-mode/page-panels/page-summary.js +33 -0
- package/build-module/components/sidebar-edit-mode/page-panels/page-summary.js.map +1 -0
- package/build-module/components/sidebar-edit-mode/page-panels/publish-date.js +85 -0
- package/build-module/components/sidebar-edit-mode/page-panels/publish-date.js.map +1 -0
- package/build-module/components/sidebar-edit-mode/plugin-sidebar/index.js +4 -4
- package/build-module/components/sidebar-edit-mode/plugin-sidebar/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/settings-header/index.js +20 -7
- package/build-module/components/sidebar-edit-mode/settings-header/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/sidebar-fixed-bottom.js +1 -1
- package/build-module/components/sidebar-edit-mode/sidebar-fixed-bottom.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/template-panel/index.js +9 -6
- package/build-module/components/sidebar-edit-mode/template-panel/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-item/index.js +11 -7
- package/build-module/components/sidebar-navigation-item/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen/index.js +24 -9
- package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-details-footer/index.js +27 -0
- package/build-module/components/sidebar-navigation-screen-details-footer/index.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-details-panel/index.js +30 -0
- package/build-module/components/sidebar-navigation-screen-details-panel/index.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-label.js +14 -0
- package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-label.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js +24 -0
- package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-value.js +14 -0
- package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-value.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js +23 -11
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-library/category-item.js +37 -0
- package/build-module/components/sidebar-navigation-screen-library/category-item.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-library/index.js +87 -0
- package/build-module/components/sidebar-navigation-screen-library/index.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-library/use-default-pattern-categories.js +25 -0
- package/build-module/components/sidebar-navigation-screen-library/use-default-pattern-categories.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-library/use-pattern-categories.js +61 -0
- package/build-module/components/sidebar-navigation-screen-library/use-pattern-categories.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-library/use-template-part-areas.js +34 -0
- package/build-module/components/sidebar-navigation-screen-library/use-template-part-areas.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-library/use-theme-patterns.js +27 -0
- package/build-module/components/sidebar-navigation-screen-library/use-theme-patterns.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-main/index.js +13 -13
- package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-item/index.js +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-item/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/delete-modal.js +33 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menu/delete-modal.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menu/edit-button.js +26 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menu/edit-button.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menu/index.js +45 -90
- package/build-module/components/sidebar-navigation-screen-navigation-menu/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/more-menu.js +70 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menu/more-menu.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menu/navigation-menu-editor.js +58 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menu/navigation-menu-editor.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +56 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +35 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +155 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menus/constants.js +3 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/constants.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js +57 -9
- package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +55 -7
- package/build-module/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +22 -50
- package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-page/index.js +14 -34
- package/build-module/components/sidebar-navigation-screen-page/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-page/page-details.js +28 -28
- package/build-module/components/sidebar-navigation-screen-page/page-details.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-page/status-label.js +9 -8
- package/build-module/components/sidebar-navigation-screen-page/status-label.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pages/index.js +8 -6
- package/build-module/components/sidebar-navigation-screen-pages/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pattern/index.js +46 -0
- package/build-module/components/sidebar-navigation-screen-pattern/index.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menu-list-item.js +28 -0
- package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menu-list-item.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menu-list.js +22 -0
- package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menu-list.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js +27 -0
- package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js +34 -0
- package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-pattern/use-navigation-menu-content.js +71 -0
- package/build-module/components/sidebar-navigation-screen-pattern/use-navigation-menu-content.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-pattern/use-pattern-details.js +64 -0
- package/build-module/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-template/home-template-details.js +192 -0
- package/build-module/components/sidebar-navigation-screen-template/home-template-details.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-template/index.js +18 -6
- package/build-module/components/sidebar-navigation-screen-template/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-templates/index.js +11 -10
- package/build-module/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build-module/components/site-hub/index.js +8 -9
- package/build-module/components/site-hub/index.js.map +1 -1
- package/build-module/components/style-book/index.js +9 -9
- package/build-module/components/style-book/index.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +13 -3
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +1 -1
- package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-sync-path-with-url.js +11 -1
- package/build-module/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
- package/build-module/components/table/index.js +21 -0
- package/build-module/components/table/index.js.map +1 -0
- package/build-module/components/template-part-converter/convert-to-template-part.js +4 -20
- package/build-module/components/template-part-converter/convert-to-template-part.js.map +1 -1
- package/build-module/components/welcome-guide/editor.js +1 -1
- package/build-module/components/welcome-guide/editor.js.map +1 -1
- package/build-module/components/welcome-guide/styles.js +5 -3
- package/build-module/components/welcome-guide/styles.js.map +1 -1
- package/build-module/hooks/commands/use-common-commands.js +194 -0
- package/build-module/hooks/commands/use-common-commands.js.map +1 -0
- package/build-module/hooks/commands/use-edit-mode-commands.js +196 -26
- package/build-module/hooks/commands/use-edit-mode-commands.js.map +1 -1
- package/build-module/hooks/index.js +1 -0
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/navigation-menu-edit.js +77 -0
- package/build-module/hooks/navigation-menu-edit.js.map +1 -0
- package/build-module/hooks/push-changes-to-global-styles/index.js +4 -2
- package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build-module/hooks/template-part-edit.js +5 -5
- package/build-module/hooks/template-part-edit.js.map +1 -1
- package/build-module/index.js +1 -0
- package/build-module/index.js.map +1 -1
- package/build-module/{private-apis.js → lock-unlock.js} +1 -1
- package/build-module/lock-unlock.js.map +1 -0
- package/build-module/store/actions.js +39 -7
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/index.js +1 -1
- package/build-module/store/index.js.map +1 -1
- package/build-module/store/reducer.js +6 -5
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +37 -15
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/get-is-list-page.js +12 -5
- package/build-module/utils/get-is-list-page.js.map +1 -1
- package/build-module/utils/is-previewing-theme.js +2 -2
- package/build-module/utils/is-previewing-theme.js.map +1 -1
- package/build-module/utils/use-activate-theme.js +2 -2
- package/build-module/utils/use-activate-theme.js.map +1 -1
- package/build-module/utils/use-debounced-input.js +17 -0
- package/build-module/utils/use-debounced-input.js.map +1 -0
- package/build-style/style-rtl.css +424 -38
- package/build-style/style.css +424 -38
- package/package.json +44 -40
- package/src/components/add-new-pattern/index.js +92 -0
- package/src/components/add-new-template/add-custom-template-modal-content.js +1 -13
- package/src/components/add-new-template/index.js +0 -3
- package/src/components/add-new-template/new-template.js +121 -26
- package/src/components/add-new-template/style.scss +30 -2
- package/src/components/app/index.js +1 -1
- package/src/components/block-editor/back-button.js +5 -2
- package/src/components/block-editor/constants.js +1 -0
- package/src/components/block-editor/editor-canvas.js +1 -1
- package/src/components/block-editor/get-block-editor-provider.js +29 -0
- package/src/components/block-editor/index.js +15 -199
- package/src/components/block-editor/providers/default-block-editor-provider.js +44 -0
- package/src/components/block-editor/providers/navigation-block-editor-provider.js +114 -0
- package/src/components/block-editor/site-editor-canvas.js +155 -0
- package/src/components/block-editor/style.scss +6 -0
- package/src/components/block-editor/use-site-editor-settings.js +91 -0
- package/src/components/canvas-spinner/index.js +11 -1
- package/src/components/create-pattern-modal/index.js +134 -0
- package/src/components/create-pattern-modal/style.scss +3 -0
- package/src/components/create-template-part-modal/index.js +64 -4
- package/src/components/editor/index.js +25 -15
- package/src/components/editor/style.scss +4 -0
- package/src/components/editor-canvas-container/index.js +21 -4
- package/src/components/global-styles/color-palette-panel.js +1 -1
- package/src/components/global-styles/dimensions-panel.js +1 -1
- package/src/components/global-styles/global-styles-provider.js +10 -14
- package/src/components/global-styles/gradients-palette-panel.js +1 -1
- package/src/components/global-styles/hooks.js +1 -1
- package/src/components/global-styles/palette.js +2 -2
- package/src/components/global-styles/preview.js +1 -1
- package/src/components/global-styles/root-menu.js +1 -1
- package/src/components/global-styles/screen-block-list.js +1 -1
- package/src/components/global-styles/screen-block.js +1 -1
- package/src/components/global-styles/screen-colors.js +1 -1
- package/src/components/global-styles/screen-css.js +1 -1
- package/src/components/global-styles/screen-layout.js +1 -1
- package/src/components/global-styles/screen-revisions/index.js +1 -1
- package/src/components/global-styles/screen-revisions/use-global-styles-revisions.js +1 -1
- package/src/components/global-styles/screen-root.js +1 -1
- package/src/components/global-styles/screen-typography.js +1 -1
- package/src/components/global-styles/stories/index.js +1 -1
- package/src/components/global-styles/style-variations-container.js +13 -3
- package/src/components/global-styles/style.scss +11 -0
- package/src/components/global-styles/typography-panel.js +1 -1
- package/src/components/global-styles/typography-preview.js +1 -1
- package/src/components/global-styles/ui.js +115 -46
- package/src/components/global-styles-renderer/index.js +1 -1
- package/src/components/header-edit-mode/document-actions/index.js +51 -26
- package/src/components/header-edit-mode/document-actions/style.scss +9 -5
- package/src/components/header-edit-mode/index.js +100 -58
- package/src/components/header-edit-mode/more-menu/index.js +52 -7
- package/src/components/keyboard-shortcuts/edit-mode.js +40 -3
- package/src/components/keyboard-shortcuts/index.js +5 -1
- package/src/components/keyboard-shortcuts/register.js +11 -1
- package/src/components/layout/hooks.js +21 -0
- package/src/components/layout/index.js +207 -110
- package/src/components/layout/style.scss +65 -1
- package/src/components/list/index.js +1 -1
- package/src/components/page/header.js +38 -0
- package/src/components/page/index.js +38 -0
- package/src/components/page/style.scss +38 -0
- package/src/components/page-content-focus-manager/back-to-page-notification.js +70 -0
- package/src/components/{page-content-lock → page-content-focus-manager}/constants.js +1 -1
- package/src/components/{page-content-lock/use-disable-non-content-blocks.js → page-content-focus-manager/disable-non-page-content-blocks.js} +15 -7
- package/src/components/page-content-focus-manager/edit-template-notification.js +108 -0
- package/src/components/page-content-focus-manager/index.js +26 -0
- package/src/components/page-library/grid-item.js +179 -0
- package/src/components/page-library/grid.js +39 -0
- package/src/components/page-library/index.js +39 -0
- package/src/components/page-library/no-patterns.js +12 -0
- package/src/components/page-library/patterns-list.js +114 -0
- package/src/components/page-library/search-items.js +171 -0
- package/src/components/page-library/style.scss +105 -0
- package/src/components/page-library/use-library-settings.js +51 -0
- package/src/components/page-library/use-patterns.js +238 -0
- package/src/components/page-library/utils.js +21 -0
- package/src/components/page-main/index.js +27 -0
- package/src/components/page-templates/index.js +104 -0
- package/src/components/preferences-modal/enable-feature.js +5 -2
- package/src/components/preferences-modal/index.js +25 -0
- package/src/components/resizable-frame/index.js +3 -1
- package/src/components/revisions/index.js +1 -1
- package/src/components/routes/link.js +2 -2
- package/src/components/routes/use-title.js +1 -1
- package/src/components/save-button/index.js +14 -11
- package/src/components/save-hub/index.js +1 -1
- package/src/components/save-panel/index.js +1 -1
- package/src/components/secondary-sidebar/list-view-sidebar.js +53 -6
- package/src/components/sidebar/index.js +11 -7
- package/src/components/sidebar-button/style.scss +1 -1
- package/src/components/sidebar-edit-mode/global-styles-sidebar.js +42 -29
- package/src/components/sidebar-edit-mode/index.js +8 -6
- package/src/components/sidebar-edit-mode/page-panels/edit-template.js +69 -0
- package/src/components/sidebar-edit-mode/page-panels/index.js +53 -53
- package/src/components/sidebar-edit-mode/page-panels/page-content.js +27 -0
- package/src/components/sidebar-edit-mode/page-panels/page-status.js +233 -0
- package/src/components/sidebar-edit-mode/page-panels/page-summary.js +35 -0
- package/src/components/sidebar-edit-mode/page-panels/publish-date.js +94 -0
- package/src/components/sidebar-edit-mode/page-panels/style.scss +31 -0
- package/src/components/sidebar-edit-mode/settings-header/index.js +18 -9
- package/src/components/sidebar-edit-mode/sidebar-fixed-bottom.js +1 -1
- package/src/components/sidebar-edit-mode/template-panel/index.js +9 -6
- package/src/components/sidebar-navigation-item/index.js +6 -2
- package/src/components/sidebar-navigation-item/style.scss +8 -1
- package/src/components/sidebar-navigation-screen/index.js +22 -8
- package/src/components/sidebar-navigation-screen/style.scss +30 -9
- package/src/components/sidebar-navigation-screen-details-footer/index.js +45 -0
- package/src/components/sidebar-navigation-screen-details-footer/style.scss +5 -0
- package/src/components/sidebar-navigation-screen-details-panel/index.js +40 -0
- package/src/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-label.js +14 -0
- package/src/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js +29 -0
- package/src/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-value.js +14 -0
- package/src/components/sidebar-navigation-screen-details-panel/style.scss +25 -0
- package/src/components/sidebar-navigation-screen-global-styles/index.js +24 -6
- package/src/components/sidebar-navigation-screen-global-styles/style.scss +0 -3
- package/src/components/sidebar-navigation-screen-library/category-item.js +43 -0
- package/src/components/sidebar-navigation-screen-library/index.js +136 -0
- package/src/components/sidebar-navigation-screen-library/style.scss +3 -0
- package/src/components/sidebar-navigation-screen-library/use-default-pattern-categories.js +32 -0
- package/src/components/sidebar-navigation-screen-library/use-pattern-categories.js +64 -0
- package/src/components/sidebar-navigation-screen-library/use-template-part-areas.js +33 -0
- package/src/components/sidebar-navigation-screen-library/use-theme-patterns.js +44 -0
- package/src/components/sidebar-navigation-screen-main/index.js +11 -14
- package/src/components/sidebar-navigation-screen-navigation-item/index.js +1 -1
- package/src/components/sidebar-navigation-screen-navigation-menu/delete-modal.js +45 -0
- package/src/components/sidebar-navigation-screen-navigation-menu/edit-button.js +24 -0
- package/src/components/sidebar-navigation-screen-navigation-menu/index.js +50 -96
- package/src/components/sidebar-navigation-screen-navigation-menu/more-menu.js +89 -0
- package/src/components/sidebar-navigation-screen-navigation-menu/navigation-menu-editor.js +51 -0
- package/src/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +62 -0
- package/src/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +39 -0
- package/src/components/sidebar-navigation-screen-navigation-menu/style.scss +15 -0
- package/src/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +179 -0
- package/src/components/sidebar-navigation-screen-navigation-menus/constants.js +3 -1
- package/src/components/sidebar-navigation-screen-navigation-menus/index.js +73 -14
- package/src/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +61 -2
- package/src/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +25 -47
- package/src/components/sidebar-navigation-screen-navigation-menus/style.scss +4 -0
- package/src/components/sidebar-navigation-screen-page/index.js +19 -58
- package/src/components/sidebar-navigation-screen-page/page-details.js +42 -39
- package/src/components/sidebar-navigation-screen-page/status-label.js +23 -19
- package/src/components/sidebar-navigation-screen-page/style.scss +1 -18
- package/src/components/sidebar-navigation-screen-pages/index.js +30 -29
- package/src/components/sidebar-navigation-screen-pattern/index.js +44 -0
- package/src/components/sidebar-navigation-screen-pattern/style.scss +25 -0
- package/src/components/sidebar-navigation-screen-pattern/template-part-navigation-menu-list-item.js +28 -0
- package/src/components/sidebar-navigation-screen-pattern/template-part-navigation-menu-list.js +21 -0
- package/src/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js +30 -0
- package/src/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js +33 -0
- package/src/components/sidebar-navigation-screen-pattern/use-navigation-menu-content.js +71 -0
- package/src/components/sidebar-navigation-screen-pattern/use-pattern-details.js +86 -0
- package/src/components/sidebar-navigation-screen-template/home-template-details.js +230 -0
- package/src/components/sidebar-navigation-screen-template/index.js +19 -5
- package/src/components/sidebar-navigation-screen-template/style.scss +37 -14
- package/src/components/sidebar-navigation-screen-templates/index.js +18 -25
- package/src/components/site-hub/index.js +13 -9
- package/src/components/site-hub/style.scss +4 -3
- package/src/components/style-book/index.js +1 -1
- package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +16 -3
- package/src/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +1 -1
- package/src/components/sync-state-with-url/use-sync-path-with-url.js +11 -1
- package/src/components/table/index.js +33 -0
- package/src/components/table/style.scss +37 -0
- package/src/components/template-part-converter/convert-to-template-part.js +4 -27
- package/src/components/welcome-guide/editor.js +1 -1
- package/src/components/welcome-guide/styles.js +5 -3
- package/src/hooks/commands/use-common-commands.js +186 -0
- package/src/hooks/commands/use-edit-mode-commands.js +183 -28
- package/src/hooks/index.js +1 -0
- package/src/hooks/navigation-menu-edit.js +95 -0
- package/src/hooks/push-changes-to-global-styles/index.js +1 -1
- package/src/hooks/template-part-edit.js +1 -1
- package/src/index.js +1 -0
- package/src/store/actions.js +40 -8
- package/src/store/index.js +1 -1
- package/src/store/reducer.js +6 -5
- package/src/store/selectors.js +39 -9
- package/src/store/test/actions.js +8 -8
- package/src/store/test/reducer.js +11 -11
- package/src/store/test/selectors.js +10 -8
- package/src/style.scss +13 -2
- package/src/utils/get-is-list-page.js +16 -4
- package/src/utils/is-previewing-theme.js +4 -2
- package/src/utils/use-activate-theme.js +3 -2
- package/src/utils/use-debounced-input.js +17 -0
- package/build/components/add-new-template/new-template-part.js +0 -113
- package/build/components/add-new-template/new-template-part.js.map +0 -1
- package/build/components/page-content-lock/constants.js +0 -9
- package/build/components/page-content-lock/constants.js.map +0 -1
- package/build/components/page-content-lock/index.js +0 -29
- package/build/components/page-content-lock/index.js.map +0 -1
- package/build/components/page-content-lock/use-disable-non-content-blocks.js +0 -49
- package/build/components/page-content-lock/use-disable-non-content-blocks.js.map +0 -1
- package/build/components/page-content-lock/use-page-content-lock-notifications.js +0 -112
- package/build/components/page-content-lock/use-page-content-lock-notifications.js.map +0 -1
- package/build/components/sidebar-edit-mode/page-panels/content-blocks-list.js +0 -79
- package/build/components/sidebar-edit-mode/page-panels/content-blocks-list.js.map +0 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/navigator-button.js +0 -52
- package/build/components/sidebar-navigation-screen-navigation-menus/navigator-button.js.map +0 -1
- package/build/components/sidebar-navigation-screen-template-part/index.js +0 -105
- package/build/components/sidebar-navigation-screen-template-part/index.js.map +0 -1
- package/build/components/sidebar-navigation-subtitle/index.js +0 -17
- package/build/components/sidebar-navigation-subtitle/index.js.map +0 -1
- package/build/private-apis.js.map +0 -1
- package/build-module/components/add-new-template/new-template-part.js +0 -93
- package/build-module/components/add-new-template/new-template-part.js.map +0 -1
- package/build-module/components/page-content-lock/constants.js +0 -2
- package/build-module/components/page-content-lock/constants.js.map +0 -1
- package/build-module/components/page-content-lock/index.js +0 -14
- package/build-module/components/page-content-lock/index.js.map +0 -1
- package/build-module/components/page-content-lock/use-disable-non-content-blocks.js.map +0 -1
- package/build-module/components/page-content-lock/use-page-content-lock-notifications.js +0 -98
- package/build-module/components/page-content-lock/use-page-content-lock-notifications.js.map +0 -1
- package/build-module/components/sidebar-edit-mode/page-panels/content-blocks-list.js +0 -67
- package/build-module/components/sidebar-edit-mode/page-panels/content-blocks-list.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/navigator-button.js +0 -39
- package/build-module/components/sidebar-navigation-screen-navigation-menus/navigator-button.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-template-part/index.js +0 -86
- package/build-module/components/sidebar-navigation-screen-template-part/index.js.map +0 -1
- package/build-module/components/sidebar-navigation-subtitle/index.js +0 -9
- package/build-module/components/sidebar-navigation-subtitle/index.js.map +0 -1
- package/build-module/private-apis.js.map +0 -1
- package/src/components/add-new-template/new-template-part.js +0 -109
- package/src/components/page-content-lock/index.js +0 -14
- package/src/components/page-content-lock/use-page-content-lock-notifications.js +0 -128
- package/src/components/sidebar-edit-mode/page-panels/content-blocks-list.js +0 -77
- package/src/components/sidebar-navigation-screen-navigation-menus/navigator-button.js +0 -47
- package/src/components/sidebar-navigation-screen-template-part/index.js +0 -103
- package/src/components/sidebar-navigation-screen-templates/style.scss +0 -4
- package/src/components/sidebar-navigation-subtitle/index.js +0 -5
- package/src/components/sidebar-navigation-subtitle/style.scss +0 -7
- /package/src/{private-apis.js → lock-unlock.js} +0 -0
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = GridItem;
|
|
9
|
+
|
|
10
|
+
var _element = require("@wordpress/element");
|
|
11
|
+
|
|
12
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
13
|
+
|
|
14
|
+
var _blockEditor = require("@wordpress/block-editor");
|
|
15
|
+
|
|
16
|
+
var _components = require("@wordpress/components");
|
|
17
|
+
|
|
18
|
+
var _compose = require("@wordpress/compose");
|
|
19
|
+
|
|
20
|
+
var _data = require("@wordpress/data");
|
|
21
|
+
|
|
22
|
+
var _i18n = require("@wordpress/i18n");
|
|
23
|
+
|
|
24
|
+
var _icons = require("@wordpress/icons");
|
|
25
|
+
|
|
26
|
+
var _notices = require("@wordpress/notices");
|
|
27
|
+
|
|
28
|
+
var _reusableBlocks = require("@wordpress/reusable-blocks");
|
|
29
|
+
|
|
30
|
+
var _keycodes = require("@wordpress/keycodes");
|
|
31
|
+
|
|
32
|
+
var _utils = require("./utils");
|
|
33
|
+
|
|
34
|
+
var _link = require("../routes/link");
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* External dependencies
|
|
38
|
+
*/
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* WordPress dependencies
|
|
42
|
+
*/
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Internal dependencies
|
|
46
|
+
*/
|
|
47
|
+
function GridItem({
|
|
48
|
+
categoryId,
|
|
49
|
+
composite,
|
|
50
|
+
icon,
|
|
51
|
+
item
|
|
52
|
+
}) {
|
|
53
|
+
const instanceId = (0, _compose.useInstanceId)(GridItem);
|
|
54
|
+
const descriptionId = `edit-site-library__pattern-description-${instanceId}`;
|
|
55
|
+
const [isDeleteDialogOpen, setIsDeleteDialogOpen] = (0, _element.useState)(false);
|
|
56
|
+
const {
|
|
57
|
+
__experimentalDeleteReusableBlock
|
|
58
|
+
} = (0, _data.useDispatch)(_reusableBlocks.store);
|
|
59
|
+
const {
|
|
60
|
+
createErrorNotice,
|
|
61
|
+
createSuccessNotice
|
|
62
|
+
} = (0, _data.useDispatch)(_notices.store);
|
|
63
|
+
const {
|
|
64
|
+
onClick
|
|
65
|
+
} = (0, _link.useLink)({
|
|
66
|
+
postType: item.type,
|
|
67
|
+
postId: item.type === _utils.USER_PATTERNS ? item.id : item.name,
|
|
68
|
+
categoryId,
|
|
69
|
+
categoryType: item.type,
|
|
70
|
+
canvas: 'edit'
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
const onKeyDown = event => {
|
|
74
|
+
if (_keycodes.DELETE === event.keyCode || _keycodes.BACKSPACE === event.keyCode) {
|
|
75
|
+
setIsDeleteDialogOpen(true);
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
const isEmpty = !item.blocks?.length;
|
|
80
|
+
const patternClassNames = (0, _classnames.default)('edit-site-library__pattern', {
|
|
81
|
+
'is-placeholder': isEmpty
|
|
82
|
+
});
|
|
83
|
+
const previewClassNames = (0, _classnames.default)('edit-site-library__preview', {
|
|
84
|
+
'is-inactive': item.type === _utils.PATTERNS
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
const deletePattern = async () => {
|
|
88
|
+
try {
|
|
89
|
+
await __experimentalDeleteReusableBlock(item.id);
|
|
90
|
+
createSuccessNotice((0, _i18n.__)('Pattern successfully deleted.'), {
|
|
91
|
+
type: 'snackbar'
|
|
92
|
+
});
|
|
93
|
+
} catch (error) {
|
|
94
|
+
const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : (0, _i18n.__)('An error occurred while deleting the pattern.');
|
|
95
|
+
createErrorNotice(errorMessage, {
|
|
96
|
+
type: 'snackbar'
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
const isUserPattern = item.type === _utils.USER_PATTERNS;
|
|
102
|
+
let ariaDescription;
|
|
103
|
+
|
|
104
|
+
if (isUserPattern) {
|
|
105
|
+
// User patterns don't have descriptions, but can be edited and deleted, so include some help text.
|
|
106
|
+
ariaDescription = (0, _i18n.__)('Press Enter to edit, or Delete to delete the pattern.');
|
|
107
|
+
} else if (item.description) {
|
|
108
|
+
ariaDescription = item.description;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)("div", {
|
|
112
|
+
className: patternClassNames
|
|
113
|
+
}, (0, _element.createElement)(_components.__unstableCompositeItem, {
|
|
114
|
+
className: previewClassNames,
|
|
115
|
+
role: "option",
|
|
116
|
+
as: "div",
|
|
117
|
+
...composite,
|
|
118
|
+
onClick: item.type !== _utils.PATTERNS ? onClick : undefined,
|
|
119
|
+
onKeyDown: isUserPattern ? onKeyDown : undefined,
|
|
120
|
+
"aria-label": item.title,
|
|
121
|
+
"aria-describedby": ariaDescription ? descriptionId : undefined
|
|
122
|
+
}, isEmpty && (0, _i18n.__)('Empty pattern'), !isEmpty && (0, _element.createElement)(_blockEditor.BlockPreview, {
|
|
123
|
+
blocks: item.blocks
|
|
124
|
+
})), ariaDescription && (0, _element.createElement)("div", {
|
|
125
|
+
"aria-hidden": "true",
|
|
126
|
+
style: {
|
|
127
|
+
display: 'none'
|
|
128
|
+
},
|
|
129
|
+
id: descriptionId
|
|
130
|
+
}, ariaDescription), (0, _element.createElement)(_components.__experimentalHStack, {
|
|
131
|
+
"aria-hidden": "true",
|
|
132
|
+
className: "edit-site-library__footer",
|
|
133
|
+
justify: "space-between"
|
|
134
|
+
}, (0, _element.createElement)(_components.__experimentalHStack, {
|
|
135
|
+
alignment: "center",
|
|
136
|
+
justify: "left",
|
|
137
|
+
spacing: 3,
|
|
138
|
+
className: "edit-site-library__pattern-title"
|
|
139
|
+
}, icon && (0, _element.createElement)(_icons.Icon, {
|
|
140
|
+
icon: icon
|
|
141
|
+
}), (0, _element.createElement)(_components.__experimentalHeading, {
|
|
142
|
+
level: 5
|
|
143
|
+
}, item.title)), item.type === _utils.USER_PATTERNS && (0, _element.createElement)(_components.DropdownMenu, {
|
|
144
|
+
icon: _icons.moreHorizontal,
|
|
145
|
+
label: (0, _i18n.__)('Actions'),
|
|
146
|
+
className: "edit-site-library__dropdown",
|
|
147
|
+
popoverProps: {
|
|
148
|
+
placement: 'bottom-end'
|
|
149
|
+
},
|
|
150
|
+
toggleProps: {
|
|
151
|
+
className: 'edit-site-library__button',
|
|
152
|
+
isSmall: true,
|
|
153
|
+
describedBy: (0, _i18n.sprintf)(
|
|
154
|
+
/* translators: %s: pattern name */
|
|
155
|
+
(0, _i18n.__)('Action menu for %s pattern'), item.title),
|
|
156
|
+
// The dropdown menu is not focusable using the
|
|
157
|
+
// keyboard as this would interfere with the grid's
|
|
158
|
+
// roving tab index system. Instead, keyboard users
|
|
159
|
+
// use keyboard shortcuts to trigger actions.
|
|
160
|
+
tabIndex: -1
|
|
161
|
+
}
|
|
162
|
+
}, () => (0, _element.createElement)(_components.MenuGroup, null, (0, _element.createElement)(_components.MenuItem, {
|
|
163
|
+
onClick: () => setIsDeleteDialogOpen(true)
|
|
164
|
+
}, (0, _i18n.__)('Delete')))))), isDeleteDialogOpen && (0, _element.createElement)(_components.__experimentalConfirmDialog, {
|
|
165
|
+
onConfirm: deletePattern,
|
|
166
|
+
onCancel: () => setIsDeleteDialogOpen(false)
|
|
167
|
+
}, (0, _i18n.__)('Are you sure you want to delete this pattern?')));
|
|
168
|
+
}
|
|
169
|
+
//# sourceMappingURL=grid-item.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/page-library/grid-item.js"],"names":["GridItem","categoryId","composite","icon","item","instanceId","descriptionId","isDeleteDialogOpen","setIsDeleteDialogOpen","__experimentalDeleteReusableBlock","reusableBlocksStore","createErrorNotice","createSuccessNotice","noticesStore","onClick","postType","type","postId","USER_PATTERNS","id","name","categoryType","canvas","onKeyDown","event","DELETE","keyCode","BACKSPACE","isEmpty","blocks","length","patternClassNames","previewClassNames","PATTERNS","deletePattern","error","errorMessage","message","code","isUserPattern","ariaDescription","description","undefined","title","display","moreHorizontal","placement","className","isSmall","describedBy","tabIndex"],"mappings":";;;;;;;;;AAoBA;;AAjBA;;AAKA;;AACA;;AASA;;AACA;;AAEA;;AACA;;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,qBAAqB,CAAE,IAAF;AAFvB,KAKG,cAAI,QAAJ,CALH,CADD,CArBF,CAfF,CAzBD,CADD,EA4EGD,kBAAkB,IACnB,4BAAC,uCAAD;AACC,IAAA,SAAS,EAAG2B,aADb;AAEC,IAAA,QAAQ,EAAG,MAAM1B,qBAAqB,CAAE,KAAF;AAFvC,KAIG,cAAI,+CAAJ,CAJH,CA7EF,CADD;AAuFA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { BlockPreview } from '@wordpress/block-editor';\nimport {\n\t__experimentalConfirmDialog as ConfirmDialog,\n\tDropdownMenu,\n\tMenuGroup,\n\tMenuItem,\n\t__experimentalHeading as Heading,\n\t__experimentalHStack as HStack,\n\t__unstableCompositeItem as CompositeItem,\n} from '@wordpress/components';\nimport { useInstanceId } from '@wordpress/compose';\nimport { useDispatch } from '@wordpress/data';\nimport { useState } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { Icon, moreHorizontal } from '@wordpress/icons';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as reusableBlocksStore } from '@wordpress/reusable-blocks';\nimport { DELETE, BACKSPACE } from '@wordpress/keycodes';\n\n/**\n * Internal dependencies\n */\nimport { PATTERNS, USER_PATTERNS } from './utils';\nimport { useLink } from '../routes/link';\n\nexport default function GridItem( { categoryId, composite, icon, item } ) {\n\tconst instanceId = useInstanceId( GridItem );\n\tconst descriptionId = `edit-site-library__pattern-description-${ instanceId }`;\n\tconst [ isDeleteDialogOpen, setIsDeleteDialogOpen ] = useState( false );\n\n\tconst { __experimentalDeleteReusableBlock } =\n\t\tuseDispatch( reusableBlocksStore );\n\tconst { createErrorNotice, createSuccessNotice } =\n\t\tuseDispatch( noticesStore );\n\n\tconst { onClick } = useLink( {\n\t\tpostType: item.type,\n\t\tpostId: item.type === USER_PATTERNS ? item.id : item.name,\n\t\tcategoryId,\n\t\tcategoryType: item.type,\n\t\tcanvas: 'edit',\n\t} );\n\n\tconst onKeyDown = ( event ) => {\n\t\tif ( DELETE === event.keyCode || BACKSPACE === event.keyCode ) {\n\t\t\tsetIsDeleteDialogOpen( true );\n\t\t}\n\t};\n\n\tconst isEmpty = ! item.blocks?.length;\n\tconst patternClassNames = classnames( 'edit-site-library__pattern', {\n\t\t'is-placeholder': isEmpty,\n\t} );\n\tconst previewClassNames = classnames( 'edit-site-library__preview', {\n\t\t'is-inactive': item.type === PATTERNS,\n\t} );\n\n\tconst deletePattern = async () => {\n\t\ttry {\n\t\t\tawait __experimentalDeleteReusableBlock( item.id );\n\t\t\tcreateSuccessNotice( __( 'Pattern successfully deleted.' ), {\n\t\t\t\ttype: 'snackbar',\n\t\t\t} );\n\t\t} catch ( error ) {\n\t\t\tconst errorMessage =\n\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t? error.message\n\t\t\t\t\t: __( 'An error occurred while deleting the pattern.' );\n\t\t\tcreateErrorNotice( errorMessage, { type: 'snackbar' } );\n\t\t}\n\t};\n\n\tconst isUserPattern = item.type === USER_PATTERNS;\n\tlet ariaDescription;\n\tif ( isUserPattern ) {\n\t\t// User patterns don't have descriptions, but can be edited and deleted, so include some help text.\n\t\tariaDescription = __(\n\t\t\t'Press Enter to edit, or Delete to delete the pattern.'\n\t\t);\n\t} else if ( item.description ) {\n\t\tariaDescription = item.description;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<div className={ patternClassNames }>\n\t\t\t\t<CompositeItem\n\t\t\t\t\tclassName={ previewClassNames }\n\t\t\t\t\trole=\"option\"\n\t\t\t\t\tas=\"div\"\n\t\t\t\t\t{ ...composite }\n\t\t\t\t\tonClick={ item.type !== PATTERNS ? onClick : undefined }\n\t\t\t\t\tonKeyDown={ isUserPattern ? onKeyDown : undefined }\n\t\t\t\t\taria-label={ item.title }\n\t\t\t\t\taria-describedby={\n\t\t\t\t\t\tariaDescription ? descriptionId : undefined\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t{ isEmpty && __( 'Empty pattern' ) }\n\t\t\t\t\t{ ! isEmpty && <BlockPreview blocks={ item.blocks } /> }\n\t\t\t\t</CompositeItem>\n\t\t\t\t{ ariaDescription && (\n\t\t\t\t\t<div\n\t\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\t\tstyle={ { display: 'none' } }\n\t\t\t\t\t\tid={ descriptionId }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ ariaDescription }\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t\t<HStack\n\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\tclassName=\"edit-site-library__footer\"\n\t\t\t\t\tjustify=\"space-between\"\n\t\t\t\t>\n\t\t\t\t\t<HStack\n\t\t\t\t\t\talignment=\"center\"\n\t\t\t\t\t\tjustify=\"left\"\n\t\t\t\t\t\tspacing={ 3 }\n\t\t\t\t\t\tclassName=\"edit-site-library__pattern-title\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ icon && <Icon icon={ icon } /> }\n\t\t\t\t\t\t<Heading level={ 5 }>{ item.title }</Heading>\n\t\t\t\t\t</HStack>\n\t\t\t\t\t{ item.type === USER_PATTERNS && (\n\t\t\t\t\t\t<DropdownMenu\n\t\t\t\t\t\t\ticon={ moreHorizontal }\n\t\t\t\t\t\t\tlabel={ __( 'Actions' ) }\n\t\t\t\t\t\t\tclassName=\"edit-site-library__dropdown\"\n\t\t\t\t\t\t\tpopoverProps={ { placement: 'bottom-end' } }\n\t\t\t\t\t\t\ttoggleProps={ {\n\t\t\t\t\t\t\t\tclassName: 'edit-site-library__button',\n\t\t\t\t\t\t\t\tisSmall: true,\n\t\t\t\t\t\t\t\tdescribedBy: sprintf(\n\t\t\t\t\t\t\t\t\t/* translators: %s: pattern name */\n\t\t\t\t\t\t\t\t\t__( 'Action menu for %s pattern' ),\n\t\t\t\t\t\t\t\t\titem.title\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t// The dropdown menu is not focusable using the\n\t\t\t\t\t\t\t\t// keyboard as this would interfere with the grid's\n\t\t\t\t\t\t\t\t// roving tab index system. Instead, keyboard users\n\t\t\t\t\t\t\t\t// use keyboard shortcuts to trigger actions.\n\t\t\t\t\t\t\t\ttabIndex: -1,\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ () => (\n\t\t\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\t\t\tsetIsDeleteDialogOpen( true )\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ __( 'Delete' ) }\n\t\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</DropdownMenu>\n\t\t\t\t\t) }\n\t\t\t\t</HStack>\n\t\t\t</div>\n\t\t\t{ isDeleteDialogOpen && (\n\t\t\t\t<ConfirmDialog\n\t\t\t\t\tonConfirm={ deletePattern }\n\t\t\t\t\tonCancel={ () => setIsDeleteDialogOpen( false ) }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Are you sure you want to delete this pattern?' ) }\n\t\t\t\t</ConfirmDialog>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"]}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = Grid;
|
|
9
|
+
|
|
10
|
+
var _element = require("@wordpress/element");
|
|
11
|
+
|
|
12
|
+
var _components = require("@wordpress/components");
|
|
13
|
+
|
|
14
|
+
var _gridItem = _interopRequireDefault(require("./grid-item"));
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* WordPress dependencies
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Internal dependencies
|
|
22
|
+
*/
|
|
23
|
+
function Grid({
|
|
24
|
+
categoryId,
|
|
25
|
+
label,
|
|
26
|
+
icon,
|
|
27
|
+
items
|
|
28
|
+
}) {
|
|
29
|
+
const composite = (0, _components.__unstableUseCompositeState)({
|
|
30
|
+
orientation: 'vertical'
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
if (!items?.length) {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return (0, _element.createElement)(_components.__unstableComposite, { ...composite,
|
|
38
|
+
role: "listbox",
|
|
39
|
+
className: "edit-site-library__grid",
|
|
40
|
+
"aria-label": label
|
|
41
|
+
}, items.map(item => (0, _element.createElement)(_gridItem.default, {
|
|
42
|
+
key: item.name,
|
|
43
|
+
icon: icon,
|
|
44
|
+
item: item,
|
|
45
|
+
categoryId: categoryId,
|
|
46
|
+
composite: composite
|
|
47
|
+
})));
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=grid.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/page-library/grid.js"],"names":["Grid","categoryId","label","icon","items","composite","orientation","length","map","item","name"],"mappings":";;;;;;;;;;;AAGA;;AAQA;;AAXA;AACA;AACA;;AAMA;AACA;AACA;AAGe,SAASA,IAAT,CAAe;AAAEC,EAAAA,UAAF;AAAcC,EAAAA,KAAd;AAAqBC,EAAAA,IAArB;AAA2BC,EAAAA;AAA3B,CAAf,EAAoD;AAClE,QAAMC,SAAS,GAAG,6CAAmB;AAAEC,IAAAA,WAAW,EAAE;AAAf,GAAnB,CAAlB;;AAEA,MAAK,CAAEF,KAAK,EAAEG,MAAd,EAAuB;AACtB,WAAO,IAAP;AACA;;AAED,SACC,4BAAC,+BAAD,OACMF,SADN;AAEC,IAAA,IAAI,EAAC,SAFN;AAGC,IAAA,SAAS,EAAC,yBAHX;AAIC,kBAAaH;AAJd,KAMGE,KAAK,CAACI,GAAN,CAAaC,IAAF,IACZ,4BAAC,iBAAD;AACC,IAAA,GAAG,EAAGA,IAAI,CAACC,IADZ;AAEC,IAAA,IAAI,EAAGP,IAFR;AAGC,IAAA,IAAI,EAAGM,IAHR;AAIC,IAAA,UAAU,EAAGR,UAJd;AAKC,IAAA,SAAS,EAAGI;AALb,IADC,CANH,CADD;AAkBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__unstableComposite as Composite,\n\t__unstableUseCompositeState as useCompositeState,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport GridItem from './grid-item';\n\nexport default function Grid( { categoryId, label, icon, items } ) {\n\tconst composite = useCompositeState( { orientation: 'vertical' } );\n\n\tif ( ! items?.length ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Composite\n\t\t\t{ ...composite }\n\t\t\trole=\"listbox\"\n\t\t\tclassName=\"edit-site-library__grid\"\n\t\t\taria-label={ label }\n\t\t>\n\t\t\t{ items.map( ( item ) => (\n\t\t\t\t<GridItem\n\t\t\t\t\tkey={ item.name }\n\t\t\t\t\ticon={ icon }\n\t\t\t\t\titem={ item }\n\t\t\t\t\tcategoryId={ categoryId }\n\t\t\t\t\tcomposite={ composite }\n\t\t\t\t/>\n\t\t\t) ) }\n\t\t</Composite>\n\t);\n}\n"]}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = PageLibrary;
|
|
9
|
+
|
|
10
|
+
var _element = require("@wordpress/element");
|
|
11
|
+
|
|
12
|
+
var _i18n = require("@wordpress/i18n");
|
|
13
|
+
|
|
14
|
+
var _blockEditor = require("@wordpress/block-editor");
|
|
15
|
+
|
|
16
|
+
var _url = require("@wordpress/url");
|
|
17
|
+
|
|
18
|
+
var _utils = require("./utils");
|
|
19
|
+
|
|
20
|
+
var _page = _interopRequireDefault(require("../page"));
|
|
21
|
+
|
|
22
|
+
var _patternsList = _interopRequireDefault(require("./patterns-list"));
|
|
23
|
+
|
|
24
|
+
var _useLibrarySettings = _interopRequireDefault(require("./use-library-settings"));
|
|
25
|
+
|
|
26
|
+
var _lockUnlock = require("../../lock-unlock");
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* WordPress dependencies
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Internal dependencies
|
|
34
|
+
*/
|
|
35
|
+
const {
|
|
36
|
+
ExperimentalBlockEditorProvider
|
|
37
|
+
} = (0, _lockUnlock.unlock)(_blockEditor.privateApis);
|
|
38
|
+
|
|
39
|
+
function PageLibrary() {
|
|
40
|
+
const {
|
|
41
|
+
categoryType,
|
|
42
|
+
categoryId
|
|
43
|
+
} = (0, _url.getQueryArgs)(window.location.href);
|
|
44
|
+
const type = categoryType || _utils.DEFAULT_TYPE;
|
|
45
|
+
const category = categoryId || _utils.DEFAULT_CATEGORY;
|
|
46
|
+
const settings = (0, _useLibrarySettings.default)(); // Wrap everything in a block editor provider.
|
|
47
|
+
// This ensures 'styles' that are needed for the previews are synced
|
|
48
|
+
// from the site editor store to the block editor store.
|
|
49
|
+
|
|
50
|
+
return (0, _element.createElement)(ExperimentalBlockEditorProvider, {
|
|
51
|
+
settings: settings
|
|
52
|
+
}, (0, _element.createElement)(_page.default, {
|
|
53
|
+
className: "edit-site-library",
|
|
54
|
+
title: (0, _i18n.__)('Library content'),
|
|
55
|
+
hideTitleFromUI: true
|
|
56
|
+
}, (0, _element.createElement)(_patternsList.default, {
|
|
57
|
+
type: type,
|
|
58
|
+
categoryId: category
|
|
59
|
+
})));
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/page-library/index.js"],"names":["ExperimentalBlockEditorProvider","blockEditorPrivateApis","PageLibrary","categoryType","categoryId","window","location","href","type","DEFAULT_TYPE","category","DEFAULT_CATEGORY","settings"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AAdA;AACA;AACA;;AAKA;AACA;AACA;AAOA,MAAM;AAAEA,EAAAA;AAAF,IAAsC,wBAAQC,wBAAR,CAA5C;;AAEe,SAASC,WAAT,GAAuB;AACrC,QAAM;AAAEC,IAAAA,YAAF;AAAgBC,IAAAA;AAAhB,MAA+B,uBAAcC,MAAM,CAACC,QAAP,CAAgBC,IAA9B,CAArC;AACA,QAAMC,IAAI,GAAGL,YAAY,IAAIM,mBAA7B;AACA,QAAMC,QAAQ,GAAGN,UAAU,IAAIO,uBAA/B;AACA,QAAMC,QAAQ,GAAG,kCAAjB,CAJqC,CAMrC;AACA;AACA;;AACA,SACC,4BAAC,+BAAD;AAAiC,IAAA,QAAQ,EAAGA;AAA5C,KACC,4BAAC,aAAD;AACC,IAAA,SAAS,EAAC,mBADX;AAEC,IAAA,KAAK,EAAG,cAAI,iBAAJ,CAFT;AAGC,IAAA,eAAe;AAHhB,KAKC,4BAAC,qBAAD;AAAc,IAAA,IAAI,EAAGJ,IAArB;AAA4B,IAAA,UAAU,EAAGE;AAAzC,IALD,CADD,CADD;AAWA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\nimport { getQueryArgs } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport { DEFAULT_CATEGORY, DEFAULT_TYPE } from './utils';\nimport Page from '../page';\nimport PatternsList from './patterns-list';\nimport useLibrarySettings from './use-library-settings';\nimport { unlock } from '../../lock-unlock';\n\nconst { ExperimentalBlockEditorProvider } = unlock( blockEditorPrivateApis );\n\nexport default function PageLibrary() {\n\tconst { categoryType, categoryId } = getQueryArgs( window.location.href );\n\tconst type = categoryType || DEFAULT_TYPE;\n\tconst category = categoryId || DEFAULT_CATEGORY;\n\tconst settings = useLibrarySettings();\n\n\t// Wrap everything in a block editor provider.\n\t// This ensures 'styles' that are needed for the previews are synced\n\t// from the site editor store to the block editor store.\n\treturn (\n\t\t<ExperimentalBlockEditorProvider settings={ settings }>\n\t\t\t<Page\n\t\t\t\tclassName=\"edit-site-library\"\n\t\t\t\ttitle={ __( 'Library content' ) }\n\t\t\t\thideTitleFromUI\n\t\t\t>\n\t\t\t\t<PatternsList type={ type } categoryId={ category } />\n\t\t\t</Page>\n\t\t</ExperimentalBlockEditorProvider>\n\t);\n}\n"]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = NoPatterns;
|
|
7
|
+
|
|
8
|
+
var _element = require("@wordpress/element");
|
|
9
|
+
|
|
10
|
+
var _i18n = require("@wordpress/i18n");
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* WordPress dependencies
|
|
14
|
+
*/
|
|
15
|
+
function NoPatterns() {
|
|
16
|
+
return (0, _element.createElement)("div", {
|
|
17
|
+
className: "edit-site-library__no-results"
|
|
18
|
+
}, (0, _i18n.__)('No patterns found.'));
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=no-patterns.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/page-library/no-patterns.js"],"names":["NoPatterns"],"mappings":";;;;;;;;;AAGA;;AAHA;AACA;AACA;AAGe,SAASA,UAAT,GAAsB;AACpC,SACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACG,cAAI,oBAAJ,CADH,CADD;AAKA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\nexport default function NoPatterns() {\n\treturn (\n\t\t<div className=\"edit-site-library__no-results\">\n\t\t\t{ __( 'No patterns found.' ) }\n\t\t</div>\n\t);\n}\n"]}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = PatternsList;
|
|
9
|
+
|
|
10
|
+
var _element = require("@wordpress/element");
|
|
11
|
+
|
|
12
|
+
var _components = require("@wordpress/components");
|
|
13
|
+
|
|
14
|
+
var _i18n = require("@wordpress/i18n");
|
|
15
|
+
|
|
16
|
+
var _icons = require("@wordpress/icons");
|
|
17
|
+
|
|
18
|
+
var _router = require("@wordpress/router");
|
|
19
|
+
|
|
20
|
+
var _compose = require("@wordpress/compose");
|
|
21
|
+
|
|
22
|
+
var _grid = _interopRequireDefault(require("./grid"));
|
|
23
|
+
|
|
24
|
+
var _noPatterns = _interopRequireDefault(require("./no-patterns"));
|
|
25
|
+
|
|
26
|
+
var _usePatterns = _interopRequireDefault(require("./use-patterns"));
|
|
27
|
+
|
|
28
|
+
var _sidebarButton = _interopRequireDefault(require("../sidebar-button"));
|
|
29
|
+
|
|
30
|
+
var _useDebouncedInput = _interopRequireDefault(require("../../utils/use-debounced-input"));
|
|
31
|
+
|
|
32
|
+
var _lockUnlock = require("../../lock-unlock");
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* WordPress dependencies
|
|
36
|
+
*/
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Internal dependencies
|
|
40
|
+
*/
|
|
41
|
+
const {
|
|
42
|
+
useLocation,
|
|
43
|
+
useHistory
|
|
44
|
+
} = (0, _lockUnlock.unlock)(_router.privateApis);
|
|
45
|
+
|
|
46
|
+
function PatternsList({
|
|
47
|
+
categoryId,
|
|
48
|
+
type
|
|
49
|
+
}) {
|
|
50
|
+
const location = useLocation();
|
|
51
|
+
const history = useHistory();
|
|
52
|
+
const isMobileViewport = (0, _compose.useViewportMatch)('medium', '<');
|
|
53
|
+
const [filterValue, setFilterValue, delayedFilterValue] = (0, _useDebouncedInput.default)('');
|
|
54
|
+
const [patterns, isResolving] = (0, _usePatterns.default)(type, categoryId, delayedFilterValue);
|
|
55
|
+
const {
|
|
56
|
+
syncedPatterns,
|
|
57
|
+
unsyncedPatterns
|
|
58
|
+
} = patterns;
|
|
59
|
+
const hasPatterns = !!syncedPatterns.length || !!unsyncedPatterns.length;
|
|
60
|
+
return (0, _element.createElement)(_components.__experimentalVStack, {
|
|
61
|
+
spacing: 6
|
|
62
|
+
}, (0, _element.createElement)(_components.Flex, null, isMobileViewport && (0, _element.createElement)(_sidebarButton.default, {
|
|
63
|
+
icon: (0, _i18n.isRTL)() ? _icons.chevronRight : _icons.chevronLeft,
|
|
64
|
+
label: (0, _i18n.__)('Back'),
|
|
65
|
+
onClick: () => {
|
|
66
|
+
// Go back in history if we came from the library page.
|
|
67
|
+
// Otherwise push a stack onto the history.
|
|
68
|
+
if (location.state?.backPath === '/library') {
|
|
69
|
+
history.back();
|
|
70
|
+
} else {
|
|
71
|
+
history.push({
|
|
72
|
+
path: '/library'
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}), (0, _element.createElement)(_components.FlexBlock, null, (0, _element.createElement)(_components.SearchControl, {
|
|
77
|
+
className: "edit-site-library__search",
|
|
78
|
+
onChange: value => setFilterValue(value),
|
|
79
|
+
placeholder: (0, _i18n.__)('Search patterns'),
|
|
80
|
+
label: (0, _i18n.__)('Search patterns'),
|
|
81
|
+
value: filterValue,
|
|
82
|
+
__nextHasNoMarginBottom: true
|
|
83
|
+
}))), isResolving && (0, _i18n.__)('Loading'), !isResolving && !!syncedPatterns.length && (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_components.__experimentalVStack, {
|
|
84
|
+
className: "edit-site-library__section-header"
|
|
85
|
+
}, (0, _element.createElement)(_components.__experimentalHeading, {
|
|
86
|
+
level: 4
|
|
87
|
+
}, (0, _i18n.__)('Synced')), (0, _element.createElement)(_components.__experimentalText, {
|
|
88
|
+
variant: "muted",
|
|
89
|
+
as: "p"
|
|
90
|
+
}, (0, _i18n.__)('Patterns that are kept in sync across your site'))), (0, _element.createElement)(_grid.default, {
|
|
91
|
+
icon: _icons.symbol,
|
|
92
|
+
categoryId: categoryId,
|
|
93
|
+
label: (0, _i18n.__)('Synced patterns'),
|
|
94
|
+
items: syncedPatterns
|
|
95
|
+
})), !isResolving && !!unsyncedPatterns.length && (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_components.__experimentalVStack, {
|
|
96
|
+
className: "edit-site-library__section-header"
|
|
97
|
+
}, (0, _element.createElement)(_components.__experimentalHeading, {
|
|
98
|
+
level: 4
|
|
99
|
+
}, (0, _i18n.__)('Standard')), (0, _element.createElement)(_components.__experimentalText, {
|
|
100
|
+
variant: "muted",
|
|
101
|
+
as: "p"
|
|
102
|
+
}, (0, _i18n.__)('Patterns that can be changed freely without affecting your site'))), (0, _element.createElement)(_grid.default, {
|
|
103
|
+
categoryId: categoryId,
|
|
104
|
+
label: (0, _i18n.__)('Standard patterns'),
|
|
105
|
+
items: unsyncedPatterns
|
|
106
|
+
})), !isResolving && !hasPatterns && (0, _element.createElement)(_noPatterns.default, null));
|
|
107
|
+
}
|
|
108
|
+
//# sourceMappingURL=patterns-list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/page-library/patterns-list.js"],"names":["useLocation","useHistory","routerPrivateApis","PatternsList","categoryId","type","location","history","isMobileViewport","filterValue","setFilterValue","delayedFilterValue","patterns","isResolving","syncedPatterns","unsyncedPatterns","hasPatterns","length","chevronRight","chevronLeft","state","backPath","back","push","path","value","symbol"],"mappings":";;;;;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T;AAGC,IAAA,KAAK,EAAGW;AAHT,IATD,CAhDF,EAgEG,CAAEF,WAAF,IAAiB,CAAEG,WAAnB,IAAkC,4BAAC,mBAAD,OAhErC,CADD;AAoEA","sourcesContent":["/**\n * WordPress dependencies\n */\n\nimport {\n\tSearchControl,\n\t__experimentalHeading as Heading,\n\t__experimentalText as Text,\n\t__experimentalVStack as VStack,\n\tFlex,\n\tFlexBlock,\n} from '@wordpress/components';\nimport { __, isRTL } from '@wordpress/i18n';\nimport { symbol, chevronLeft, chevronRight } from '@wordpress/icons';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { useViewportMatch } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport Grid from './grid';\nimport NoPatterns from './no-patterns';\nimport usePatterns from './use-patterns';\nimport SidebarButton from '../sidebar-button';\nimport useDebouncedInput from '../../utils/use-debounced-input';\nimport { unlock } from '../../lock-unlock';\n\nconst { useLocation, useHistory } = unlock( routerPrivateApis );\n\nexport default function PatternsList( { categoryId, type } ) {\n\tconst location = useLocation();\n\tconst history = useHistory();\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst [ filterValue, setFilterValue, delayedFilterValue ] =\n\t\tuseDebouncedInput( '' );\n\n\tconst [ patterns, isResolving ] = usePatterns(\n\t\ttype,\n\t\tcategoryId,\n\t\tdelayedFilterValue\n\t);\n\n\tconst { syncedPatterns, unsyncedPatterns } = patterns;\n\tconst hasPatterns = !! syncedPatterns.length || !! unsyncedPatterns.length;\n\n\treturn (\n\t\t<VStack spacing={ 6 }>\n\t\t\t<Flex>\n\t\t\t\t{ isMobileViewport && (\n\t\t\t\t\t<SidebarButton\n\t\t\t\t\t\ticon={ isRTL() ? chevronRight : chevronLeft }\n\t\t\t\t\t\tlabel={ __( 'Back' ) }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t// Go back in history if we came from the library page.\n\t\t\t\t\t\t\t// Otherwise push a stack onto the history.\n\t\t\t\t\t\t\tif ( location.state?.backPath === '/library' ) {\n\t\t\t\t\t\t\t\thistory.back();\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\thistory.push( { path: '/library' } );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t<FlexBlock>\n\t\t\t\t\t<SearchControl\n\t\t\t\t\t\tclassName=\"edit-site-library__search\"\n\t\t\t\t\t\tonChange={ ( value ) => setFilterValue( value ) }\n\t\t\t\t\t\tplaceholder={ __( 'Search patterns' ) }\n\t\t\t\t\t\tlabel={ __( 'Search patterns' ) }\n\t\t\t\t\t\tvalue={ filterValue }\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t/>\n\t\t\t\t</FlexBlock>\n\t\t\t</Flex>\n\t\t\t{ isResolving && __( 'Loading' ) }\n\t\t\t{ ! isResolving && !! syncedPatterns.length && (\n\t\t\t\t<>\n\t\t\t\t\t<VStack className=\"edit-site-library__section-header\">\n\t\t\t\t\t\t<Heading level={ 4 }>{ __( 'Synced' ) }</Heading>\n\t\t\t\t\t\t<Text variant=\"muted\" as=\"p\">\n\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t'Patterns that are kept in sync across your site'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</Text>\n\t\t\t\t\t</VStack>\n\t\t\t\t\t<Grid\n\t\t\t\t\t\ticon={ symbol }\n\t\t\t\t\t\tcategoryId={ categoryId }\n\t\t\t\t\t\tlabel={ __( 'Synced patterns' ) }\n\t\t\t\t\t\titems={ syncedPatterns }\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t) }\n\t\t\t{ ! isResolving && !! unsyncedPatterns.length && (\n\t\t\t\t<>\n\t\t\t\t\t<VStack className=\"edit-site-library__section-header\">\n\t\t\t\t\t\t<Heading level={ 4 }>{ __( 'Standard' ) }</Heading>\n\t\t\t\t\t\t<Text variant=\"muted\" as=\"p\">\n\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t'Patterns that can be changed freely without affecting your site'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</Text>\n\t\t\t\t\t</VStack>\n\t\t\t\t\t<Grid\n\t\t\t\t\t\tcategoryId={ categoryId }\n\t\t\t\t\t\tlabel={ __( 'Standard patterns' ) }\n\t\t\t\t\t\titems={ unsyncedPatterns }\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t) }\n\t\t\t{ ! isResolving && ! hasPatterns && <NoPatterns /> }\n\t\t</VStack>\n\t);\n}\n"]}
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.searchItems = exports.getNormalizedSearchTerms = void 0;
|
|
9
|
+
|
|
10
|
+
var _removeAccents = _interopRequireDefault(require("remove-accents"));
|
|
11
|
+
|
|
12
|
+
var _changeCase = require("change-case");
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* External dependencies
|
|
16
|
+
*/
|
|
17
|
+
// Default search helpers.
|
|
18
|
+
const defaultGetName = item => item.name || '';
|
|
19
|
+
|
|
20
|
+
const defaultGetTitle = item => item.title;
|
|
21
|
+
|
|
22
|
+
const defaultGetDescription = item => item.description || '';
|
|
23
|
+
|
|
24
|
+
const defaultGetKeywords = item => item.keywords || [];
|
|
25
|
+
|
|
26
|
+
const defaultHasCategory = () => false;
|
|
27
|
+
/**
|
|
28
|
+
* Extracts words from an input string.
|
|
29
|
+
*
|
|
30
|
+
* @param {string} input The input string.
|
|
31
|
+
*
|
|
32
|
+
* @return {Array} Words, extracted from the input string.
|
|
33
|
+
*/
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
function extractWords(input = '') {
|
|
37
|
+
return (0, _changeCase.noCase)(input, {
|
|
38
|
+
splitRegexp: [/([\p{Ll}\p{Lo}\p{N}])([\p{Lu}\p{Lt}])/gu, // One lowercase or digit, followed by one uppercase.
|
|
39
|
+
/([\p{Lu}\p{Lt}])([\p{Lu}\p{Lt}][\p{Ll}\p{Lo}])/gu // One uppercase followed by one uppercase and one lowercase.
|
|
40
|
+
],
|
|
41
|
+
stripRegexp: /(\p{C}|\p{P}|\p{S})+/giu // Anything that's not a punctuation, symbol or control/format character.
|
|
42
|
+
|
|
43
|
+
}).split(' ').filter(Boolean);
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Sanitizes the search input string.
|
|
47
|
+
*
|
|
48
|
+
* @param {string} input The search input to normalize.
|
|
49
|
+
*
|
|
50
|
+
* @return {string} The normalized search input.
|
|
51
|
+
*/
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
function normalizeSearchInput(input = '') {
|
|
55
|
+
// Disregard diacritics.
|
|
56
|
+
// Input: "média"
|
|
57
|
+
input = (0, _removeAccents.default)(input); // Accommodate leading slash, matching autocomplete expectations.
|
|
58
|
+
// Input: "/media"
|
|
59
|
+
|
|
60
|
+
input = input.replace(/^\//, ''); // Lowercase.
|
|
61
|
+
// Input: "MEDIA"
|
|
62
|
+
|
|
63
|
+
input = input.toLowerCase();
|
|
64
|
+
return input;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Converts the search term into a list of normalized terms.
|
|
68
|
+
*
|
|
69
|
+
* @param {string} input The search term to normalize.
|
|
70
|
+
*
|
|
71
|
+
* @return {string[]} The normalized list of search terms.
|
|
72
|
+
*/
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
const getNormalizedSearchTerms = (input = '') => {
|
|
76
|
+
return extractWords(normalizeSearchInput(input));
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
exports.getNormalizedSearchTerms = getNormalizedSearchTerms;
|
|
80
|
+
|
|
81
|
+
const removeMatchingTerms = (unmatchedTerms, unprocessedTerms) => {
|
|
82
|
+
return unmatchedTerms.filter(term => !getNormalizedSearchTerms(unprocessedTerms).some(unprocessedTerm => unprocessedTerm.includes(term)));
|
|
83
|
+
};
|
|
84
|
+
/**
|
|
85
|
+
* Filters an item list given a search term.
|
|
86
|
+
*
|
|
87
|
+
* @param {Array} items Item list
|
|
88
|
+
* @param {string} searchInput Search input.
|
|
89
|
+
* @param {Object} config Search Config.
|
|
90
|
+
*
|
|
91
|
+
* @return {Array} Filtered item list.
|
|
92
|
+
*/
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
const searchItems = (items = [], searchInput = '', config = {}) => {
|
|
96
|
+
const normalizedSearchTerms = getNormalizedSearchTerms(searchInput);
|
|
97
|
+
const onlyFilterByCategory = !normalizedSearchTerms.length;
|
|
98
|
+
const searchRankConfig = { ...config,
|
|
99
|
+
onlyFilterByCategory
|
|
100
|
+
}; // If we aren't filtering on search terms, matching on category is satisfactory.
|
|
101
|
+
// If we are, then we need more than a category match.
|
|
102
|
+
|
|
103
|
+
const threshold = onlyFilterByCategory ? 0 : 1;
|
|
104
|
+
const rankedItems = items.map(item => {
|
|
105
|
+
return [item, getItemSearchRank(item, searchInput, searchRankConfig)];
|
|
106
|
+
}).filter(([, rank]) => rank > threshold); // If we didn't have terms to search on, there's no point sorting.
|
|
107
|
+
|
|
108
|
+
if (normalizedSearchTerms.length === 0) {
|
|
109
|
+
return rankedItems.map(([item]) => item);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
rankedItems.sort(([, rank1], [, rank2]) => rank2 - rank1);
|
|
113
|
+
return rankedItems.map(([item]) => item);
|
|
114
|
+
};
|
|
115
|
+
/**
|
|
116
|
+
* Get the search rank for a given item and a specific search term.
|
|
117
|
+
* The better the match, the higher the rank.
|
|
118
|
+
* If the rank equals 0, it should be excluded from the results.
|
|
119
|
+
*
|
|
120
|
+
* @param {Object} item Item to filter.
|
|
121
|
+
* @param {string} searchTerm Search term.
|
|
122
|
+
* @param {Object} config Search Config.
|
|
123
|
+
*
|
|
124
|
+
* @return {number} Search Rank.
|
|
125
|
+
*/
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
exports.searchItems = searchItems;
|
|
129
|
+
|
|
130
|
+
function getItemSearchRank(item, searchTerm, config) {
|
|
131
|
+
const {
|
|
132
|
+
categoryId,
|
|
133
|
+
getName = defaultGetName,
|
|
134
|
+
getTitle = defaultGetTitle,
|
|
135
|
+
getDescription = defaultGetDescription,
|
|
136
|
+
getKeywords = defaultGetKeywords,
|
|
137
|
+
hasCategory = defaultHasCategory,
|
|
138
|
+
onlyFilterByCategory
|
|
139
|
+
} = config;
|
|
140
|
+
let rank = hasCategory(item, categoryId) ? 1 : 0; // If an item doesn't belong to the current category or we don't have
|
|
141
|
+
// search terms to filter by, return the initial rank value.
|
|
142
|
+
|
|
143
|
+
if (!rank || onlyFilterByCategory) {
|
|
144
|
+
return rank;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
const name = getName(item);
|
|
148
|
+
const title = getTitle(item);
|
|
149
|
+
const description = getDescription(item);
|
|
150
|
+
const keywords = getKeywords(item);
|
|
151
|
+
const normalizedSearchInput = normalizeSearchInput(searchTerm);
|
|
152
|
+
const normalizedTitle = normalizeSearchInput(title); // Prefers exact matches
|
|
153
|
+
// Then prefers if the beginning of the title matches the search term
|
|
154
|
+
// name, keywords, description matches come later.
|
|
155
|
+
|
|
156
|
+
if (normalizedSearchInput === normalizedTitle) {
|
|
157
|
+
rank += 30;
|
|
158
|
+
} else if (normalizedTitle.startsWith(normalizedSearchInput)) {
|
|
159
|
+
rank += 20;
|
|
160
|
+
} else {
|
|
161
|
+
const terms = [name, title, description, ...keywords].join(' ');
|
|
162
|
+
const normalizedSearchTerms = extractWords(normalizedSearchInput);
|
|
163
|
+
const unmatchedTerms = removeMatchingTerms(normalizedSearchTerms, terms);
|
|
164
|
+
|
|
165
|
+
if (unmatchedTerms.length === 0) {
|
|
166
|
+
rank += 10;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
return rank;
|
|
171
|
+
}
|
|
172
|
+
//# sourceMappingURL=search-items.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/page-library/search-items.js"],"names":["defaultGetName","item","name","defaultGetTitle","title","defaultGetDescription","description","defaultGetKeywords","keywords","defaultHasCategory","extractWords","input","splitRegexp","stripRegexp","split","filter","Boolean","normalizeSearchInput","replace","toLowerCase","getNormalizedSearchTerms","removeMatchingTerms","unmatchedTerms","unprocessedTerms","term","some","unprocessedTerm","includes","searchItems","items","searchInput","config","normalizedSearchTerms","onlyFilterByCategory","length","searchRankConfig","threshold","rankedItems","map","getItemSearchRank","rank","sort","rank1","rank2","searchTerm","categoryId","getName","getTitle","getDescription","getKeywords","hasCategory","normalizedSearchInput","normalizedTitle","startsWith","terms","join"],"mappings":";;;;;;;;;AAGA;;AACA;;AAJA;AACA;AACA;AAIA;AACA,MAAMA,cAAc,GAAKC,IAAF,IAAYA,IAAI,CAACC,IAAL,IAAa,EAAhD;;AACA,MAAMC,eAAe,GAAKF,IAAF,IAAYA,IAAI,CAACG,KAAzC;;AACA,MAAMC,qBAAqB,GAAKJ,IAAF,IAAYA,IAAI,CAACK,WAAL,IAAoB,EAA9D;;AACA,MAAMC,kBAAkB,GAAKN,IAAF,IAAYA,IAAI,CAACO,QAAL,IAAiB,EAAxD;;AACA,MAAMC,kBAAkB,GAAG,MAAM,KAAjC;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAASC,YAAT,CAAuBC,KAAK,GAAG,EAA/B,EAAoC;AACnC,SAAO,wBAAQA,KAAR,EAAe;AACrBC,IAAAA,WAAW,EAAE,CACZ,yCADY,EAC+B;AAC3C,sDAFY,CAEwC;AAFxC,KADQ;AAKrBC,IAAAA,WAAW,EAAE,yBALQ,CAKmB;;AALnB,GAAf,EAOLC,KAPK,CAOE,GAPF,EAQLC,MARK,CAQGC,OARH,CAAP;AASA;AAED;AACA;AACA;AACA;AACA;AACA;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AAE9C,IAAF,CAAtB;AACA,QAAMK,WAAW,GAAG0C,cAAc,CAAE/C,IAAF,CAAlC;AACA,QAAMO,QAAQ,GAAGyC,WAAW,CAAEhD,IAAF,CAA5B;AAEA,QAAMkD,qBAAqB,GAAGlC,oBAAoB,CAAE2B,UAAF,CAAlD;AACA,QAAMQ,eAAe,GAAGnC,oBAAoB,CAAEb,KAAF,CAA5C,CAzBsD,CA2BtD;AACA;AACA;;AACA,MAAK+C,qBAAqB,KAAKC,eAA/B,EAAiD;AAChDZ,IAAAA,IAAI,IAAI,EAAR;AACA,GAFD,MAEO,IAAKY,eAAe,CAACC,UAAhB,CAA4BF,qBAA5B,CAAL,EAA2D;AACjEX,IAAAA,IAAI,IAAI,EAAR;AACA,GAFM,MAEA;AACN,UAAMc,KAAK,GAAG,CAAEpD,IAAF,EAAQE,KAAR,EAAeE,WAAf,EAA4B,GAAGE,QAA/B,EAA0C+C,IAA1C,CAAgD,GAAhD,CAAd;AACA,UAAMvB,qBAAqB,GAAGtB,YAAY,CAAEyC,qBAAF,CAA1C;AACA,UAAM7B,cAAc,GAAGD,mBAAmB,CACzCW,qBADyC,EAEzCsB,KAFyC,CAA1C;;AAKA,QAAKhC,cAAc,CAACY,MAAf,KAA0B,CAA/B,EAAmC;AAClCM,MAAAA,IAAI,IAAI,EAAR;AACA;AACD;;AAED,SAAOA,IAAP;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport removeAccents from 'remove-accents';\nimport { noCase } from 'change-case';\n\n// Default search helpers.\nconst defaultGetName = ( item ) => item.name || '';\nconst defaultGetTitle = ( item ) => item.title;\nconst defaultGetDescription = ( item ) => item.description || '';\nconst defaultGetKeywords = ( item ) => item.keywords || [];\nconst defaultHasCategory = () => false;\n\n/**\n * Extracts words from an input string.\n *\n * @param {string} input The input string.\n *\n * @return {Array} Words, extracted from the input string.\n */\nfunction extractWords( input = '' ) {\n\treturn noCase( input, {\n\t\tsplitRegexp: [\n\t\t\t/([\\p{Ll}\\p{Lo}\\p{N}])([\\p{Lu}\\p{Lt}])/gu, // One lowercase or digit, followed by one uppercase.\n\t\t\t/([\\p{Lu}\\p{Lt}])([\\p{Lu}\\p{Lt}][\\p{Ll}\\p{Lo}])/gu, // One uppercase followed by one uppercase and one lowercase.\n\t\t],\n\t\tstripRegexp: /(\\p{C}|\\p{P}|\\p{S})+/giu, // Anything that's not a punctuation, symbol or control/format character.\n\t} )\n\t\t.split( ' ' )\n\t\t.filter( Boolean );\n}\n\n/**\n * Sanitizes the search input string.\n *\n * @param {string} input The search input to normalize.\n *\n * @return {string} The normalized search input.\n */\nfunction normalizeSearchInput( input = '' ) {\n\t// Disregard diacritics.\n\t// Input: \"média\"\n\tinput = removeAccents( input );\n\n\t// Accommodate leading slash, matching autocomplete expectations.\n\t// Input: \"/media\"\n\tinput = input.replace( /^\\//, '' );\n\n\t// Lowercase.\n\t// Input: \"MEDIA\"\n\tinput = input.toLowerCase();\n\n\treturn input;\n}\n\n/**\n * Converts the search term into a list of normalized terms.\n *\n * @param {string} input The search term to normalize.\n *\n * @return {string[]} The normalized list of search terms.\n */\nexport const getNormalizedSearchTerms = ( input = '' ) => {\n\treturn extractWords( normalizeSearchInput( input ) );\n};\n\nconst removeMatchingTerms = ( unmatchedTerms, unprocessedTerms ) => {\n\treturn unmatchedTerms.filter(\n\t\t( term ) =>\n\t\t\t! getNormalizedSearchTerms( unprocessedTerms ).some(\n\t\t\t\t( unprocessedTerm ) => unprocessedTerm.includes( term )\n\t\t\t)\n\t);\n};\n\n/**\n * Filters an item list given a search term.\n *\n * @param {Array} items Item list\n * @param {string} searchInput Search input.\n * @param {Object} config Search Config.\n *\n * @return {Array} Filtered item list.\n */\nexport const searchItems = ( items = [], searchInput = '', config = {} ) => {\n\tconst normalizedSearchTerms = getNormalizedSearchTerms( searchInput );\n\tconst onlyFilterByCategory = ! normalizedSearchTerms.length;\n\tconst searchRankConfig = { ...config, onlyFilterByCategory };\n\n\t// If we aren't filtering on search terms, matching on category is satisfactory.\n\t// If we are, then we need more than a category match.\n\tconst threshold = onlyFilterByCategory ? 0 : 1;\n\n\tconst rankedItems = items\n\t\t.map( ( item ) => {\n\t\t\treturn [\n\t\t\t\titem,\n\t\t\t\tgetItemSearchRank( item, searchInput, searchRankConfig ),\n\t\t\t];\n\t\t} )\n\t\t.filter( ( [ , rank ] ) => rank > threshold );\n\n\t// If we didn't have terms to search on, there's no point sorting.\n\tif ( normalizedSearchTerms.length === 0 ) {\n\t\treturn rankedItems.map( ( [ item ] ) => item );\n\t}\n\n\trankedItems.sort( ( [ , rank1 ], [ , rank2 ] ) => rank2 - rank1 );\n\treturn rankedItems.map( ( [ item ] ) => item );\n};\n\n/**\n * Get the search rank for a given item and a specific search term.\n * The better the match, the higher the rank.\n * If the rank equals 0, it should be excluded from the results.\n *\n * @param {Object} item Item to filter.\n * @param {string} searchTerm Search term.\n * @param {Object} config Search Config.\n *\n * @return {number} Search Rank.\n */\nfunction getItemSearchRank( item, searchTerm, config ) {\n\tconst {\n\t\tcategoryId,\n\t\tgetName = defaultGetName,\n\t\tgetTitle = defaultGetTitle,\n\t\tgetDescription = defaultGetDescription,\n\t\tgetKeywords = defaultGetKeywords,\n\t\thasCategory = defaultHasCategory,\n\t\tonlyFilterByCategory,\n\t} = config;\n\n\tlet rank = hasCategory( item, categoryId ) ? 1 : 0;\n\n\t// If an item doesn't belong to the current category or we don't have\n\t// search terms to filter by, return the initial rank value.\n\tif ( ! rank || onlyFilterByCategory ) {\n\t\treturn rank;\n\t}\n\n\tconst name = getName( item );\n\tconst title = getTitle( item );\n\tconst description = getDescription( item );\n\tconst keywords = getKeywords( item );\n\n\tconst normalizedSearchInput = normalizeSearchInput( searchTerm );\n\tconst normalizedTitle = normalizeSearchInput( title );\n\n\t// Prefers exact matches\n\t// Then prefers if the beginning of the title matches the search term\n\t// name, keywords, description matches come later.\n\tif ( normalizedSearchInput === normalizedTitle ) {\n\t\trank += 30;\n\t} else if ( normalizedTitle.startsWith( normalizedSearchInput ) ) {\n\t\trank += 20;\n\t} else {\n\t\tconst terms = [ name, title, description, ...keywords ].join( ' ' );\n\t\tconst normalizedSearchTerms = extractWords( normalizedSearchInput );\n\t\tconst unmatchedTerms = removeMatchingTerms(\n\t\t\tnormalizedSearchTerms,\n\t\t\tterms\n\t\t);\n\n\t\tif ( unmatchedTerms.length === 0 ) {\n\t\t\trank += 10;\n\t\t}\n\t}\n\n\treturn rank;\n}\n"]}
|