@wordpress/edit-site 5.12.0 → 5.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +6 -8
- 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 +49 -5
- package/build/components/create-template-part-modal/index.js.map +1 -1
- package/build/components/editor/index.js +23 -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 +90 -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 +6 -8
- package/build/components/header-edit-mode/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 +7 -2
- 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 +1 -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 +40 -22
- 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 +67 -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 +165 -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 +4 -7
- package/build/components/preferences-modal/enable-feature.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 +5 -5
- 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 +18 -7
- 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 +13 -13
- 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 +54 -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 +163 -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 +46 -7
- 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 +190 -0
- package/build/hooks/commands/use-common-commands.js.map +1 -0
- package/build/hooks/commands/use-edit-mode-commands.js +67 -23
- 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/{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 +40 -16
- 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 +4 -5
- 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 +46 -6
- package/build-module/components/create-template-part-modal/index.js.map +1 -1
- package/build-module/components/editor/index.js +23 -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 +89 -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 +4 -6
- package/build-module/components/header-edit-mode/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 +7 -2
- 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 +1 -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 +33 -16
- 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 +53 -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 +145 -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 +4 -4
- package/build-module/components/preferences-modal/enable-feature.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 +5 -5
- 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 +18 -7
- 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 +9 -8
- 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 +46 -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 +151 -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 +45 -7
- 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 +172 -0
- package/build-module/hooks/commands/use-common-commands.js.map +1 -0
- package/build-module/hooks/commands/use-edit-mode-commands.js +68 -24
- 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/{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 +35 -14
- 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 +323 -29
- package/build-style/style.css +323 -29
- package/package.json +44 -40
- package/src/components/add-new-pattern/index.js +94 -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 +1 -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 +63 -3
- package/src/components/editor/index.js +24 -15
- 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 +105 -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 +4 -4
- package/src/components/keyboard-shortcuts/edit-mode.js +5 -1
- package/src/components/keyboard-shortcuts/index.js +5 -1
- package/src/components/keyboard-shortcuts/register.js +1 -1
- package/src/components/layout/hooks.js +21 -0
- package/src/components/layout/index.js +92 -64
- package/src/components/layout/style.scss +7 -0
- 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 +65 -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/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-edit-mode/global-styles-sidebar.js +42 -29
- package/src/components/sidebar-edit-mode/index.js +5 -5
- 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 +7 -0
- package/src/components/sidebar-navigation-screen/index.js +19 -7
- package/src/components/sidebar-navigation-screen/style.scss +28 -8
- 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 +9 -3
- 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 +7 -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 +51 -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 +175 -0
- package/src/components/sidebar-navigation-screen-navigation-menus/constants.js +3 -1
- package/src/components/sidebar-navigation-screen-navigation-menus/index.js +43 -7
- 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/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 +23 -0
- package/src/components/sidebar-navigation-screen-templates/index.js +18 -25
- package/src/components/site-hub/index.js +13 -9
- 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 +167 -0
- package/src/hooks/commands/use-edit-mode-commands.js +61 -25
- 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/store/actions.js +40 -8
- package/src/store/index.js +1 -1
- package/src/store/reducer.js +6 -5
- package/src/store/selectors.js +34 -9
- package/src/store/test/actions.js +8 -8
- package/src/store/test/reducer.js +11 -11
- package/src/store/test/selectors.js +8 -8
- package/src/style.scss +12 -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,156 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import removeAccents from 'remove-accents';
|
|
5
|
+
import { noCase } from 'change-case'; // Default search helpers.
|
|
6
|
+
|
|
7
|
+
const defaultGetName = item => item.name || '';
|
|
8
|
+
|
|
9
|
+
const defaultGetTitle = item => item.title;
|
|
10
|
+
|
|
11
|
+
const defaultGetDescription = item => item.description || '';
|
|
12
|
+
|
|
13
|
+
const defaultGetKeywords = item => item.keywords || [];
|
|
14
|
+
|
|
15
|
+
const defaultHasCategory = () => false;
|
|
16
|
+
/**
|
|
17
|
+
* Extracts words from an input string.
|
|
18
|
+
*
|
|
19
|
+
* @param {string} input The input string.
|
|
20
|
+
*
|
|
21
|
+
* @return {Array} Words, extracted from the input string.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
function extractWords(input = '') {
|
|
26
|
+
return noCase(input, {
|
|
27
|
+
splitRegexp: [/([\p{Ll}\p{Lo}\p{N}])([\p{Lu}\p{Lt}])/gu, // One lowercase or digit, followed by one uppercase.
|
|
28
|
+
/([\p{Lu}\p{Lt}])([\p{Lu}\p{Lt}][\p{Ll}\p{Lo}])/gu // One uppercase followed by one uppercase and one lowercase.
|
|
29
|
+
],
|
|
30
|
+
stripRegexp: /(\p{C}|\p{P}|\p{S})+/giu // Anything that's not a punctuation, symbol or control/format character.
|
|
31
|
+
|
|
32
|
+
}).split(' ').filter(Boolean);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Sanitizes the search input string.
|
|
36
|
+
*
|
|
37
|
+
* @param {string} input The search input to normalize.
|
|
38
|
+
*
|
|
39
|
+
* @return {string} The normalized search input.
|
|
40
|
+
*/
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
function normalizeSearchInput(input = '') {
|
|
44
|
+
// Disregard diacritics.
|
|
45
|
+
// Input: "média"
|
|
46
|
+
input = removeAccents(input); // Accommodate leading slash, matching autocomplete expectations.
|
|
47
|
+
// Input: "/media"
|
|
48
|
+
|
|
49
|
+
input = input.replace(/^\//, ''); // Lowercase.
|
|
50
|
+
// Input: "MEDIA"
|
|
51
|
+
|
|
52
|
+
input = input.toLowerCase();
|
|
53
|
+
return input;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Converts the search term into a list of normalized terms.
|
|
57
|
+
*
|
|
58
|
+
* @param {string} input The search term to normalize.
|
|
59
|
+
*
|
|
60
|
+
* @return {string[]} The normalized list of search terms.
|
|
61
|
+
*/
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
export const getNormalizedSearchTerms = (input = '') => {
|
|
65
|
+
return extractWords(normalizeSearchInput(input));
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
const removeMatchingTerms = (unmatchedTerms, unprocessedTerms) => {
|
|
69
|
+
return unmatchedTerms.filter(term => !getNormalizedSearchTerms(unprocessedTerms).some(unprocessedTerm => unprocessedTerm.includes(term)));
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* Filters an item list given a search term.
|
|
73
|
+
*
|
|
74
|
+
* @param {Array} items Item list
|
|
75
|
+
* @param {string} searchInput Search input.
|
|
76
|
+
* @param {Object} config Search Config.
|
|
77
|
+
*
|
|
78
|
+
* @return {Array} Filtered item list.
|
|
79
|
+
*/
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
export const searchItems = (items = [], searchInput = '', config = {}) => {
|
|
83
|
+
const normalizedSearchTerms = getNormalizedSearchTerms(searchInput);
|
|
84
|
+
const onlyFilterByCategory = !normalizedSearchTerms.length;
|
|
85
|
+
const searchRankConfig = { ...config,
|
|
86
|
+
onlyFilterByCategory
|
|
87
|
+
}; // If we aren't filtering on search terms, matching on category is satisfactory.
|
|
88
|
+
// If we are, then we need more than a category match.
|
|
89
|
+
|
|
90
|
+
const threshold = onlyFilterByCategory ? 0 : 1;
|
|
91
|
+
const rankedItems = items.map(item => {
|
|
92
|
+
return [item, getItemSearchRank(item, searchInput, searchRankConfig)];
|
|
93
|
+
}).filter(([, rank]) => rank > threshold); // If we didn't have terms to search on, there's no point sorting.
|
|
94
|
+
|
|
95
|
+
if (normalizedSearchTerms.length === 0) {
|
|
96
|
+
return rankedItems.map(([item]) => item);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
rankedItems.sort(([, rank1], [, rank2]) => rank2 - rank1);
|
|
100
|
+
return rankedItems.map(([item]) => item);
|
|
101
|
+
};
|
|
102
|
+
/**
|
|
103
|
+
* Get the search rank for a given item and a specific search term.
|
|
104
|
+
* The better the match, the higher the rank.
|
|
105
|
+
* If the rank equals 0, it should be excluded from the results.
|
|
106
|
+
*
|
|
107
|
+
* @param {Object} item Item to filter.
|
|
108
|
+
* @param {string} searchTerm Search term.
|
|
109
|
+
* @param {Object} config Search Config.
|
|
110
|
+
*
|
|
111
|
+
* @return {number} Search Rank.
|
|
112
|
+
*/
|
|
113
|
+
|
|
114
|
+
function getItemSearchRank(item, searchTerm, config) {
|
|
115
|
+
const {
|
|
116
|
+
categoryId,
|
|
117
|
+
getName = defaultGetName,
|
|
118
|
+
getTitle = defaultGetTitle,
|
|
119
|
+
getDescription = defaultGetDescription,
|
|
120
|
+
getKeywords = defaultGetKeywords,
|
|
121
|
+
hasCategory = defaultHasCategory,
|
|
122
|
+
onlyFilterByCategory
|
|
123
|
+
} = config;
|
|
124
|
+
let rank = hasCategory(item, categoryId) ? 1 : 0; // If an item doesn't belong to the current category or we don't have
|
|
125
|
+
// search terms to filter by, return the initial rank value.
|
|
126
|
+
|
|
127
|
+
if (!rank || onlyFilterByCategory) {
|
|
128
|
+
return rank;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
const name = getName(item);
|
|
132
|
+
const title = getTitle(item);
|
|
133
|
+
const description = getDescription(item);
|
|
134
|
+
const keywords = getKeywords(item);
|
|
135
|
+
const normalizedSearchInput = normalizeSearchInput(searchTerm);
|
|
136
|
+
const normalizedTitle = normalizeSearchInput(title); // Prefers exact matches
|
|
137
|
+
// Then prefers if the beginning of the title matches the search term
|
|
138
|
+
// name, keywords, description matches come later.
|
|
139
|
+
|
|
140
|
+
if (normalizedSearchInput === normalizedTitle) {
|
|
141
|
+
rank += 30;
|
|
142
|
+
} else if (normalizedTitle.startsWith(normalizedSearchInput)) {
|
|
143
|
+
rank += 20;
|
|
144
|
+
} else {
|
|
145
|
+
const terms = [name, title, description, ...keywords].join(' ');
|
|
146
|
+
const normalizedSearchTerms = extractWords(normalizedSearchInput);
|
|
147
|
+
const unmatchedTerms = removeMatchingTerms(normalizedSearchTerms, terms);
|
|
148
|
+
|
|
149
|
+
if (unmatchedTerms.length === 0) {
|
|
150
|
+
rank += 10;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
return rank;
|
|
155
|
+
}
|
|
156
|
+
//# sourceMappingURL=search-items.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/page-library/search-items.js"],"names":["removeAccents","noCase","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":"AAAA;AACA;AACA;AACA,OAAOA,aAAP,MAA0B,gBAA1B;AACA,SAASC,MAAT,QAAuB,aAAvB,C,CAEA;;AACA,MAAMC,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,SAAOZ,MAAM,CAAEY,KAAF,EAAS;AACrBC,IAAAA,WAAW,EAAE,CACZ,yCADY,EAC+B;AAC3C,sDAFY,CAEwC;AAFxC,KADQ;AAKrBC,IAAAA,WAAW,EAAE,yBALQ,CAKmB;;AALnB,GAAT,CAAN,CAOLC,KAPK,CAOE,GAPF,EAQLC,MARK,CAQGC,OARH,CAAP;AASA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAASC,oBAAT,CAA+BN,KAAK,GAAG,EAAvC,EAA4C;AAC3C;AACA;AACAA,EAAAA,KAAK,GAAGb,aAAa,CAAEa,KAAF,CAArB,CAH2C,CAK3C;AACA;;AACAA,EAAAA,KAAK,GAAGA,KAAK,CAACO,OAAN,CAAe,KAAf,EAAsB,EAAtB,CAAR,CAP2C,CAS3C;AACA;;AACAP,EAAAA,KAAK,GAAGA,KAAK,CAACQ,WAAN,EAAR;AAEA,SAAOR,KAAP;AACA;AAED;AACA;AACA;AACA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Z,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"]}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { store as coreStore } from '@wordpress/core-data';
|
|
5
|
+
import { useSelect } from '@wordpress/data';
|
|
6
|
+
import { useMemo } from '@wordpress/element';
|
|
7
|
+
/**
|
|
8
|
+
* Internal dependencies
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { unlock } from '../../lock-unlock';
|
|
12
|
+
import { store as editSiteStore } from '../../store';
|
|
13
|
+
import { filterOutDuplicatesByName } from './utils';
|
|
14
|
+
export default function useLibrarySettings() {
|
|
15
|
+
var _storedSettings$__exp;
|
|
16
|
+
|
|
17
|
+
const storedSettings = useSelect(select => {
|
|
18
|
+
const {
|
|
19
|
+
getSettings
|
|
20
|
+
} = unlock(select(editSiteStore));
|
|
21
|
+
return getSettings();
|
|
22
|
+
}, []);
|
|
23
|
+
const settingsBlockPatterns = (_storedSettings$__exp = storedSettings.__experimentalAdditionalBlockPatterns) !== null && _storedSettings$__exp !== void 0 ? _storedSettings$__exp : // WP 6.0
|
|
24
|
+
storedSettings.__experimentalBlockPatterns; // WP 5.9
|
|
25
|
+
|
|
26
|
+
const restBlockPatterns = useSelect(select => select(coreStore).getBlockPatterns(), []);
|
|
27
|
+
const blockPatterns = useMemo(() => [...(settingsBlockPatterns || []), ...(restBlockPatterns || [])].filter(filterOutDuplicatesByName), [settingsBlockPatterns, restBlockPatterns]);
|
|
28
|
+
const settings = useMemo(() => {
|
|
29
|
+
const {
|
|
30
|
+
__experimentalAdditionalBlockPatterns,
|
|
31
|
+
...restStoredSettings
|
|
32
|
+
} = storedSettings;
|
|
33
|
+
return { ...restStoredSettings,
|
|
34
|
+
__experimentalBlockPatterns: blockPatterns,
|
|
35
|
+
__unstableIsPreviewMode: true
|
|
36
|
+
};
|
|
37
|
+
}, [storedSettings, blockPatterns]);
|
|
38
|
+
return settings;
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=use-library-settings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/page-library/use-library-settings.js"],"names":["store","coreStore","useSelect","useMemo","unlock","editSiteStore","filterOutDuplicatesByName","useLibrarySettings","storedSettings","select","getSettings","settingsBlockPatterns","__experimentalAdditionalBlockPatterns","__experimentalBlockPatterns","restBlockPatterns","getBlockPatterns","blockPatterns","filter","settings","restStoredSettings","__unstableIsPreviewMode"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,OAAT,QAAwB,oBAAxB;AAEA;AACA;AACA;;AACA,SAASC,MAAT,QAAuB,mBAAvB;AACA,SAASJ,KAAK,IAAIK,aAAlB,QAAuC,aAAvC;AACA,SAASC,yBAAT,QAA0C,SAA1C;AAEA,eAAe,SAASC,kBAAT,GAA8B;AAAA;;AAC5C,QAAMC,cAAc,GAAGN,SAAS,CAAIO,MAAF,IAAc;AAC/C,UAAM;AAAEC,MAAAA;AAAF,QAAkBN,MAAM,CAAEK,MAAM,CAAEJ,aAAF,CAAR,CAA9B;AACA,WAAOK,WAAW,EAAlB;AACA,GAH+B,EAG7B,EAH6B,CAAhC;AAKA,QAAMC,qBAAqB,4BAC1BH,cAAc,CAACI,qCADW,yEAC8B;AACxDJ,EAAAA,cAAc,CAACK,2BAFhB,CAN4C,CAQC;;AAE7C,QAAMC,iBAAiB,GAAGZ,SAAS,CAChCO,MAAF,IAAcA,MAAM,CAAER,SAAF,CAAN,CAAoBc,gBAApB,EADoB,EAElC,EAFkC,CAAnC;AAKA,QAAMC,aAAa,GAAGb,OAAO,CAC5B,MACC,CACC,IAAKQ,qBAAqB,IAAI,EAA9B,CADD,EAEC,IAAKG,iBAAiB,IAAI,EAA1B,CAFD,EAGEG,MAHF,CAGUX,yBAHV,CAF2B,EAM5B,CAAEK,qBAAF,EAAyBG,iBAAzB,CAN4B,CAA7B;AASA,QAAMI,QAAQ,GAAGf,OAAO,CAAE,MAAM;AAC/B,UAAM;AAAES,MAAAA,qCAAF;AAAyC,SAAGO;AAA5C,QACLX,cADD;AAGA,WAAO,EACN,GAAGW,kBADG;AAENN,MAAAA,2BAA2B,EAAEG,aAFvB;AAGNI,MAAAA,uBAAuB,EAAE;AAHnB,KAAP;AAKA,GATuB,EASrB,CAAEZ,cAAF,EAAkBQ,aAAlB,CATqB,CAAxB;AAWA,SAAOE,QAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { store as editSiteStore } from '../../store';\nimport { filterOutDuplicatesByName } from './utils';\n\nexport default function useLibrarySettings() {\n\tconst storedSettings = useSelect( ( select ) => {\n\t\tconst { getSettings } = unlock( select( editSiteStore ) );\n\t\treturn getSettings();\n\t}, [] );\n\n\tconst settingsBlockPatterns =\n\t\tstoredSettings.__experimentalAdditionalBlockPatterns ?? // WP 6.0\n\t\tstoredSettings.__experimentalBlockPatterns; // WP 5.9\n\n\tconst restBlockPatterns = useSelect(\n\t\t( select ) => select( coreStore ).getBlockPatterns(),\n\t\t[]\n\t);\n\n\tconst blockPatterns = useMemo(\n\t\t() =>\n\t\t\t[\n\t\t\t\t...( settingsBlockPatterns || [] ),\n\t\t\t\t...( restBlockPatterns || [] ),\n\t\t\t].filter( filterOutDuplicatesByName ),\n\t\t[ settingsBlockPatterns, restBlockPatterns ]\n\t);\n\n\tconst settings = useMemo( () => {\n\t\tconst { __experimentalAdditionalBlockPatterns, ...restStoredSettings } =\n\t\t\tstoredSettings;\n\n\t\treturn {\n\t\t\t...restStoredSettings,\n\t\t\t__experimentalBlockPatterns: blockPatterns,\n\t\t\t__unstableIsPreviewMode: true,\n\t\t};\n\t}, [ storedSettings, blockPatterns ] );\n\n\treturn settings;\n}\n"]}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { parse } from '@wordpress/blocks';
|
|
5
|
+
import { useSelect } from '@wordpress/data';
|
|
6
|
+
import { store as coreStore } from '@wordpress/core-data';
|
|
7
|
+
import { useMemo } from '@wordpress/element';
|
|
8
|
+
/**
|
|
9
|
+
* Internal dependencies
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import { CORE_PATTERN_SOURCES, PATTERNS, SYNC_TYPES, TEMPLATE_PARTS, USER_PATTERNS, USER_PATTERN_CATEGORY, filterOutDuplicatesByName } from './utils';
|
|
13
|
+
import { unlock } from '../../lock-unlock';
|
|
14
|
+
import { searchItems } from './search-items';
|
|
15
|
+
import { store as editSiteStore } from '../../store';
|
|
16
|
+
const EMPTY_PATTERN_LIST = [];
|
|
17
|
+
|
|
18
|
+
const createTemplatePartId = (theme, slug) => theme && slug ? theme + '//' + slug : null;
|
|
19
|
+
|
|
20
|
+
const templatePartToPattern = templatePart => ({
|
|
21
|
+
blocks: parse(templatePart.content.raw),
|
|
22
|
+
categories: [templatePart.area],
|
|
23
|
+
description: templatePart.description || '',
|
|
24
|
+
keywords: templatePart.keywords || [],
|
|
25
|
+
name: createTemplatePartId(templatePart.theme, templatePart.slug),
|
|
26
|
+
title: templatePart.title.rendered,
|
|
27
|
+
type: templatePart.type,
|
|
28
|
+
templatePart
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
const useTemplatePartsAsPatterns = (categoryId, postType = TEMPLATE_PARTS, filterValue = '') => {
|
|
32
|
+
const {
|
|
33
|
+
templateParts,
|
|
34
|
+
isResolving
|
|
35
|
+
} = useSelect(select => {
|
|
36
|
+
if (postType !== TEMPLATE_PARTS) {
|
|
37
|
+
return {
|
|
38
|
+
templateParts: EMPTY_PATTERN_LIST,
|
|
39
|
+
isResolving: false
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const {
|
|
44
|
+
getEntityRecords,
|
|
45
|
+
isResolving: _isResolving
|
|
46
|
+
} = select(coreStore);
|
|
47
|
+
const query = {
|
|
48
|
+
per_page: -1
|
|
49
|
+
};
|
|
50
|
+
const rawTemplateParts = getEntityRecords('postType', postType, query);
|
|
51
|
+
const partsAsPatterns = rawTemplateParts?.map(templatePart => templatePartToPattern(templatePart));
|
|
52
|
+
return {
|
|
53
|
+
templateParts: partsAsPatterns,
|
|
54
|
+
isResolving: _isResolving('getEntityRecords', ['postType', 'wp_template_part', query])
|
|
55
|
+
};
|
|
56
|
+
}, [postType]);
|
|
57
|
+
const filteredTemplateParts = useMemo(() => {
|
|
58
|
+
if (!templateParts) {
|
|
59
|
+
return EMPTY_PATTERN_LIST;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return searchItems(templateParts, filterValue, {
|
|
63
|
+
categoryId,
|
|
64
|
+
hasCategory: (item, area) => item.templatePart.area === area
|
|
65
|
+
});
|
|
66
|
+
}, [templateParts, filterValue, categoryId]);
|
|
67
|
+
return {
|
|
68
|
+
templateParts: filteredTemplateParts,
|
|
69
|
+
isResolving
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
const useThemePatterns = (categoryId, postType = PATTERNS, filterValue = '') => {
|
|
74
|
+
const blockPatterns = useSelect(select => {
|
|
75
|
+
var _settings$__experimen;
|
|
76
|
+
|
|
77
|
+
const {
|
|
78
|
+
getSettings
|
|
79
|
+
} = unlock(select(editSiteStore));
|
|
80
|
+
const settings = getSettings();
|
|
81
|
+
return (_settings$__experimen = settings.__experimentalAdditionalBlockPatterns) !== null && _settings$__experimen !== void 0 ? _settings$__experimen : settings.__experimentalBlockPatterns;
|
|
82
|
+
});
|
|
83
|
+
const restBlockPatterns = useSelect(select => select(coreStore).getBlockPatterns());
|
|
84
|
+
const patterns = useMemo(() => [...(blockPatterns || []), ...(restBlockPatterns || [])].filter(pattern => !CORE_PATTERN_SOURCES.includes(pattern.source)).filter(filterOutDuplicatesByName).map(pattern => ({ ...pattern,
|
|
85
|
+
keywords: pattern.keywords || [],
|
|
86
|
+
type: 'pattern',
|
|
87
|
+
blocks: parse(pattern.content)
|
|
88
|
+
})), [blockPatterns, restBlockPatterns]);
|
|
89
|
+
const filteredPatterns = useMemo(() => {
|
|
90
|
+
if (postType !== PATTERNS) {
|
|
91
|
+
return EMPTY_PATTERN_LIST;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
return searchItems(patterns, filterValue, {
|
|
95
|
+
categoryId,
|
|
96
|
+
hasCategory: (item, currentCategory) => item.categories?.includes(currentCategory)
|
|
97
|
+
});
|
|
98
|
+
}, [patterns, filterValue, categoryId, postType]);
|
|
99
|
+
return filteredPatterns;
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
const reusableBlockToPattern = reusableBlock => ({
|
|
103
|
+
blocks: parse(reusableBlock.content.raw),
|
|
104
|
+
categories: reusableBlock.wp_pattern,
|
|
105
|
+
id: reusableBlock.id,
|
|
106
|
+
name: reusableBlock.slug,
|
|
107
|
+
syncStatus: reusableBlock.meta?.sync_status,
|
|
108
|
+
title: reusableBlock.title.raw,
|
|
109
|
+
type: reusableBlock.type,
|
|
110
|
+
reusableBlock
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
const useUserPatterns = (categoryId, categoryType = PATTERNS, filterValue = '') => {
|
|
114
|
+
const postType = categoryType === PATTERNS ? USER_PATTERNS : categoryType;
|
|
115
|
+
const unfilteredPatterns = useSelect(select => {
|
|
116
|
+
if (postType !== USER_PATTERNS || categoryId !== USER_PATTERN_CATEGORY) {
|
|
117
|
+
return EMPTY_PATTERN_LIST;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
const {
|
|
121
|
+
getEntityRecords
|
|
122
|
+
} = select(coreStore);
|
|
123
|
+
const records = getEntityRecords('postType', postType, {
|
|
124
|
+
per_page: -1
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
if (!records) {
|
|
128
|
+
return EMPTY_PATTERN_LIST;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
return records.map(record => reusableBlockToPattern(record));
|
|
132
|
+
}, [postType, categoryId]);
|
|
133
|
+
const filteredPatterns = useMemo(() => {
|
|
134
|
+
if (!unfilteredPatterns.length) {
|
|
135
|
+
return EMPTY_PATTERN_LIST;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
return searchItems(unfilteredPatterns, filterValue, {
|
|
139
|
+
// We exit user pattern retrieval early if we aren't in the
|
|
140
|
+
// catch-all category for user created patterns, so it has
|
|
141
|
+
// to be in the category.
|
|
142
|
+
hasCategory: () => true
|
|
143
|
+
});
|
|
144
|
+
}, [unfilteredPatterns, filterValue]);
|
|
145
|
+
const patterns = {
|
|
146
|
+
syncedPatterns: [],
|
|
147
|
+
unsyncedPatterns: []
|
|
148
|
+
};
|
|
149
|
+
filteredPatterns.forEach(pattern => {
|
|
150
|
+
if (pattern.syncStatus === SYNC_TYPES.full) {
|
|
151
|
+
patterns.syncedPatterns.push(pattern);
|
|
152
|
+
} else {
|
|
153
|
+
patterns.unsyncedPatterns.push(pattern);
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
return patterns;
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
export const usePatterns = (categoryType, categoryId, filterValue) => {
|
|
160
|
+
const blockPatterns = useThemePatterns(categoryId, categoryType, filterValue);
|
|
161
|
+
const {
|
|
162
|
+
syncedPatterns = [],
|
|
163
|
+
unsyncedPatterns = []
|
|
164
|
+
} = useUserPatterns(categoryId, categoryType, filterValue);
|
|
165
|
+
const {
|
|
166
|
+
templateParts,
|
|
167
|
+
isResolving
|
|
168
|
+
} = useTemplatePartsAsPatterns(categoryId, categoryType, filterValue);
|
|
169
|
+
const patterns = {
|
|
170
|
+
syncedPatterns: [...templateParts, ...syncedPatterns],
|
|
171
|
+
unsyncedPatterns: [...blockPatterns, ...unsyncedPatterns]
|
|
172
|
+
};
|
|
173
|
+
return [patterns, isResolving];
|
|
174
|
+
};
|
|
175
|
+
export default usePatterns;
|
|
176
|
+
//# sourceMappingURL=use-patterns.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/page-library/use-patterns.js"],"names":["parse","useSelect","store","coreStore","useMemo","CORE_PATTERN_SOURCES","PATTERNS","SYNC_TYPES","TEMPLATE_PARTS","USER_PATTERNS","USER_PATTERN_CATEGORY","filterOutDuplicatesByName","unlock","searchItems","editSiteStore","EMPTY_PATTERN_LIST","createTemplatePartId","theme","slug","templatePartToPattern","templatePart","blocks","content","raw","categories","area","description","keywords","name","title","rendered","type","useTemplatePartsAsPatterns","categoryId","postType","filterValue","templateParts","isResolving","select","getEntityRecords","_isResolving","query","per_page","rawTemplateParts","partsAsPatterns","map","filteredTemplateParts","hasCategory","item","useThemePatterns","blockPatterns","getSettings","settings","__experimentalAdditionalBlockPatterns","__experimentalBlockPatterns","restBlockPatterns","getBlockPatterns","patterns","filter","pattern","includes","source","filteredPatterns","currentCategory","reusableBlockToPattern","reusableBlock","wp_pattern","id","syncStatus","meta","sync_status","useUserPatterns","categoryType","unfilteredPatterns","records","record","length","syncedPatterns","unsyncedPatterns","forEach","full","push","usePatterns"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,KAAT,QAAsB,mBAAtB;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AACA,SAASC,OAAT,QAAwB,oBAAxB;AAEA;AACA;AACA;;AACA,SACCC,oBADD,EAECC,QAFD,EAGCC,UAHD,EAICC,cAJD,EAKCC,aALD,EAMCC,qBAND,EAOCC,yBAPD,QAQO,SARP;AASA,SAASC,MAAT,QAAuB,mBAAvB;AACA,SAASC,WAAT,QAA4B,gBAA5B;AACA,SAASX,KAAK,IAAIY,aAAlB,QAAuC,aAAvC;AAEA,MAAMC,kBAAkB,GAAG,EAA3B;;AAEA,MAAMC,oBAAoB,GAAG,CAAEC,KAAF,EAASC,IAAT,KAC5BD,KAAK,IAAIC,IAA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,CAAErB,QAAF,EAAYpB,WAAZ,CAAP;AACA,CAzBM;AA2BP,eAAe6C,WAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { parse } from '@wordpress/blocks';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport {\n\tCORE_PATTERN_SOURCES,\n\tPATTERNS,\n\tSYNC_TYPES,\n\tTEMPLATE_PARTS,\n\tUSER_PATTERNS,\n\tUSER_PATTERN_CATEGORY,\n\tfilterOutDuplicatesByName,\n} from './utils';\nimport { unlock } from '../../lock-unlock';\nimport { searchItems } from './search-items';\nimport { store as editSiteStore } from '../../store';\n\nconst EMPTY_PATTERN_LIST = [];\n\nconst createTemplatePartId = ( theme, slug ) =>\n\ttheme && slug ? theme + '//' + slug : null;\n\nconst templatePartToPattern = ( templatePart ) => ( {\n\tblocks: parse( templatePart.content.raw ),\n\tcategories: [ templatePart.area ],\n\tdescription: templatePart.description || '',\n\tkeywords: templatePart.keywords || [],\n\tname: createTemplatePartId( templatePart.theme, templatePart.slug ),\n\ttitle: templatePart.title.rendered,\n\ttype: templatePart.type,\n\ttemplatePart,\n} );\n\nconst useTemplatePartsAsPatterns = (\n\tcategoryId,\n\tpostType = TEMPLATE_PARTS,\n\tfilterValue = ''\n) => {\n\tconst { templateParts, isResolving } = useSelect(\n\t\t( select ) => {\n\t\t\tif ( postType !== TEMPLATE_PARTS ) {\n\t\t\t\treturn {\n\t\t\t\t\ttemplateParts: EMPTY_PATTERN_LIST,\n\t\t\t\t\tisResolving: false,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tconst { getEntityRecords, isResolving: _isResolving } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst query = { per_page: -1 };\n\t\t\tconst rawTemplateParts = getEntityRecords(\n\t\t\t\t'postType',\n\t\t\t\tpostType,\n\t\t\t\tquery\n\t\t\t);\n\t\t\tconst partsAsPatterns = rawTemplateParts?.map( ( templatePart ) =>\n\t\t\t\ttemplatePartToPattern( templatePart )\n\t\t\t);\n\n\t\t\treturn {\n\t\t\t\ttemplateParts: partsAsPatterns,\n\t\t\t\tisResolving: _isResolving( 'getEntityRecords', [\n\t\t\t\t\t'postType',\n\t\t\t\t\t'wp_template_part',\n\t\t\t\t\tquery,\n\t\t\t\t] ),\n\t\t\t};\n\t\t},\n\t\t[ postType ]\n\t);\n\n\tconst filteredTemplateParts = useMemo( () => {\n\t\tif ( ! templateParts ) {\n\t\t\treturn EMPTY_PATTERN_LIST;\n\t\t}\n\n\t\treturn searchItems( templateParts, filterValue, {\n\t\t\tcategoryId,\n\t\t\thasCategory: ( item, area ) => item.templatePart.area === area,\n\t\t} );\n\t}, [ templateParts, filterValue, categoryId ] );\n\n\treturn { templateParts: filteredTemplateParts, isResolving };\n};\n\nconst useThemePatterns = (\n\tcategoryId,\n\tpostType = PATTERNS,\n\tfilterValue = ''\n) => {\n\tconst blockPatterns = useSelect( ( select ) => {\n\t\tconst { getSettings } = unlock( select( editSiteStore ) );\n\t\tconst settings = getSettings();\n\t\treturn (\n\t\t\tsettings.__experimentalAdditionalBlockPatterns ??\n\t\t\tsettings.__experimentalBlockPatterns\n\t\t);\n\t} );\n\n\tconst restBlockPatterns = useSelect( ( select ) =>\n\t\tselect( coreStore ).getBlockPatterns()\n\t);\n\n\tconst patterns = useMemo(\n\t\t() =>\n\t\t\t[ ...( blockPatterns || [] ), ...( restBlockPatterns || [] ) ]\n\t\t\t\t.filter(\n\t\t\t\t\t( pattern ) =>\n\t\t\t\t\t\t! CORE_PATTERN_SOURCES.includes( pattern.source )\n\t\t\t\t)\n\t\t\t\t.filter( filterOutDuplicatesByName )\n\t\t\t\t.map( ( pattern ) => ( {\n\t\t\t\t\t...pattern,\n\t\t\t\t\tkeywords: pattern.keywords || [],\n\t\t\t\t\ttype: 'pattern',\n\t\t\t\t\tblocks: parse( pattern.content ),\n\t\t\t\t} ) ),\n\t\t[ blockPatterns, restBlockPatterns ]\n\t);\n\n\tconst filteredPatterns = useMemo( () => {\n\t\tif ( postType !== PATTERNS ) {\n\t\t\treturn EMPTY_PATTERN_LIST;\n\t\t}\n\n\t\treturn searchItems( patterns, filterValue, {\n\t\t\tcategoryId,\n\t\t\thasCategory: ( item, currentCategory ) =>\n\t\t\t\titem.categories?.includes( currentCategory ),\n\t\t} );\n\t}, [ patterns, filterValue, categoryId, postType ] );\n\n\treturn filteredPatterns;\n};\n\nconst reusableBlockToPattern = ( reusableBlock ) => ( {\n\tblocks: parse( reusableBlock.content.raw ),\n\tcategories: reusableBlock.wp_pattern,\n\tid: reusableBlock.id,\n\tname: reusableBlock.slug,\n\tsyncStatus: reusableBlock.meta?.sync_status,\n\ttitle: reusableBlock.title.raw,\n\ttype: reusableBlock.type,\n\treusableBlock,\n} );\n\nconst useUserPatterns = (\n\tcategoryId,\n\tcategoryType = PATTERNS,\n\tfilterValue = ''\n) => {\n\tconst postType = categoryType === PATTERNS ? USER_PATTERNS : categoryType;\n\tconst unfilteredPatterns = useSelect(\n\t\t( select ) => {\n\t\t\tif (\n\t\t\t\tpostType !== USER_PATTERNS ||\n\t\t\t\tcategoryId !== USER_PATTERN_CATEGORY\n\t\t\t) {\n\t\t\t\treturn EMPTY_PATTERN_LIST;\n\t\t\t}\n\n\t\t\tconst { getEntityRecords } = select( coreStore );\n\t\t\tconst records = getEntityRecords( 'postType', postType, {\n\t\t\t\tper_page: -1,\n\t\t\t} );\n\n\t\t\tif ( ! records ) {\n\t\t\t\treturn EMPTY_PATTERN_LIST;\n\t\t\t}\n\n\t\t\treturn records.map( ( record ) =>\n\t\t\t\treusableBlockToPattern( record )\n\t\t\t);\n\t\t},\n\t\t[ postType, categoryId ]\n\t);\n\n\tconst filteredPatterns = useMemo( () => {\n\t\tif ( ! unfilteredPatterns.length ) {\n\t\t\treturn EMPTY_PATTERN_LIST;\n\t\t}\n\n\t\treturn searchItems( unfilteredPatterns, filterValue, {\n\t\t\t// We exit user pattern retrieval early if we aren't in the\n\t\t\t// catch-all category for user created patterns, so it has\n\t\t\t// to be in the category.\n\t\t\thasCategory: () => true,\n\t\t} );\n\t}, [ unfilteredPatterns, filterValue ] );\n\n\tconst patterns = { syncedPatterns: [], unsyncedPatterns: [] };\n\n\tfilteredPatterns.forEach( ( pattern ) => {\n\t\tif ( pattern.syncStatus === SYNC_TYPES.full ) {\n\t\t\tpatterns.syncedPatterns.push( pattern );\n\t\t} else {\n\t\t\tpatterns.unsyncedPatterns.push( pattern );\n\t\t}\n\t} );\n\n\treturn patterns;\n};\n\nexport const usePatterns = ( categoryType, categoryId, filterValue ) => {\n\tconst blockPatterns = useThemePatterns(\n\t\tcategoryId,\n\t\tcategoryType,\n\t\tfilterValue\n\t);\n\n\tconst { syncedPatterns = [], unsyncedPatterns = [] } = useUserPatterns(\n\t\tcategoryId,\n\t\tcategoryType,\n\t\tfilterValue\n\t);\n\n\tconst { templateParts, isResolving } = useTemplatePartsAsPatterns(\n\t\tcategoryId,\n\t\tcategoryType,\n\t\tfilterValue\n\t);\n\n\tconst patterns = {\n\t\tsyncedPatterns: [ ...templateParts, ...syncedPatterns ],\n\t\tunsyncedPatterns: [ ...blockPatterns, ...unsyncedPatterns ],\n\t};\n\n\treturn [ patterns, isResolving ];\n};\n\nexport default usePatterns;\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export const DEFAULT_CATEGORY = 'header';
|
|
2
|
+
export const DEFAULT_TYPE = 'wp_template_part';
|
|
3
|
+
export const PATTERNS = 'pattern';
|
|
4
|
+
export const TEMPLATE_PARTS = 'wp_template_part';
|
|
5
|
+
export const USER_PATTERNS = 'wp_block';
|
|
6
|
+
export const USER_PATTERN_CATEGORY = 'custom-patterns';
|
|
7
|
+
export const CORE_PATTERN_SOURCES = ['core', 'pattern-directory/core', 'pattern-directory/featured', 'pattern-directory/theme'];
|
|
8
|
+
export const SYNC_TYPES = {
|
|
9
|
+
full: 'fully',
|
|
10
|
+
unsynced: 'unsynced'
|
|
11
|
+
};
|
|
12
|
+
export const filterOutDuplicatesByName = (currentItem, index, items) => index === items.findIndex(item => currentItem.name === item.name);
|
|
13
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/page-library/utils.js"],"names":["DEFAULT_CATEGORY","DEFAULT_TYPE","PATTERNS","TEMPLATE_PARTS","USER_PATTERNS","USER_PATTERN_CATEGORY","CORE_PATTERN_SOURCES","SYNC_TYPES","full","unsynced","filterOutDuplicatesByName","currentItem","index","items","findIndex","item","name"],"mappings":"AAAA,OAAO,MAAMA,gBAAgB,GAAG,QAAzB;AACP,OAAO,MAAMC,YAAY,GAAG,kBAArB;AACP,OAAO,MAAMC,QAAQ,GAAG,SAAjB;AACP,OAAO,MAAMC,cAAc,GAAG,kBAAvB;AACP,OAAO,MAAMC,aAAa,GAAG,UAAtB;AACP,OAAO,MAAMC,qBAAqB,GAAG,iBAA9B;AAEP,OAAO,MAAMC,oBAAoB,GAAG,CACnC,MADmC,EAEnC,wBAFmC,EAGnC,4BAHmC,EAInC,yBAJmC,CAA7B;AAOP,OAAO,MAAMC,UAAU,GAAG;AACzBC,EAAAA,IAAI,EAAE,OADmB;AAEzBC,EAAAA,QAAQ,EAAE;AAFe,CAAnB;AAKP,OAAO,MAAMC,yBAAyB,GAAG,CAAEC,WAAF,EAAeC,KAAf,EAAsBC,KAAtB,KACxCD,KAAK,KAAKC,KAAK,CAACC,SAAN,CAAmBC,IAAF,IAAYJ,WAAW,CAACK,IAAZ,KAAqBD,IAAI,CAACC,IAAvD,CADJ","sourcesContent":["export const DEFAULT_CATEGORY = 'header';\nexport const DEFAULT_TYPE = 'wp_template_part';\nexport const PATTERNS = 'pattern';\nexport const TEMPLATE_PARTS = 'wp_template_part';\nexport const USER_PATTERNS = 'wp_block';\nexport const USER_PATTERN_CATEGORY = 'custom-patterns';\n\nexport const CORE_PATTERN_SOURCES = [\n\t'core',\n\t'pattern-directory/core',\n\t'pattern-directory/featured',\n\t'pattern-directory/theme',\n];\n\nexport const SYNC_TYPES = {\n\tfull: 'fully',\n\tunsynced: 'unsynced',\n};\n\nexport const filterOutDuplicatesByName = ( currentItem, index, items ) =>\n\tindex === items.findIndex( ( item ) => currentItem.name === item.name );\n"]}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { createElement } from "@wordpress/element";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* WordPress dependencies
|
|
5
|
+
*/
|
|
6
|
+
import { privateApis as routerPrivateApis } from '@wordpress/router';
|
|
7
|
+
/**
|
|
8
|
+
* Internal dependencies
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import PageTemplates from '../page-templates';
|
|
12
|
+
import PageLibrary from '../page-library';
|
|
13
|
+
import { unlock } from '../../lock-unlock';
|
|
14
|
+
const {
|
|
15
|
+
useLocation
|
|
16
|
+
} = unlock(routerPrivateApis);
|
|
17
|
+
export default function PageMain() {
|
|
18
|
+
const {
|
|
19
|
+
params: {
|
|
20
|
+
path
|
|
21
|
+
}
|
|
22
|
+
} = useLocation();
|
|
23
|
+
|
|
24
|
+
if (path === '/wp_template/all') {
|
|
25
|
+
return createElement(PageTemplates, null);
|
|
26
|
+
} else if (path === '/library') {
|
|
27
|
+
return createElement(PageLibrary, null);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/page-main/index.js"],"names":["privateApis","routerPrivateApis","PageTemplates","PageLibrary","unlock","useLocation","PageMain","params","path"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,WAAW,IAAIC,iBAAxB,QAAiD,mBAAjD;AAEA;AACA;AACA;;AACA,OAAOC,aAAP,MAA0B,mBAA1B;AACA,OAAOC,WAAP,MAAwB,iBAAxB;AACA,SAASC,MAAT,QAAuB,mBAAvB;AAEA,MAAM;AAAEC,EAAAA;AAAF,IAAkBD,MAAM,CAAEH,iBAAF,CAA9B;AAEA,eAAe,SAASK,QAAT,GAAoB;AAClC,QAAM;AACLC,IAAAA,MAAM,EAAE;AAAEC,MAAAA;AAAF;AADH,MAEFH,WAAW,EAFf;;AAIA,MAAKG,IAAI,KAAK,kBAAd,EAAmC;AAClC,WAAO,cAAC,aAAD,OAAP;AACA,GAFD,MAEO,IAAKA,IAAI,KAAK,UAAd,EAA2B;AACjC,WAAO,cAAC,WAAD,OAAP;AACA;;AAED,SAAO,IAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport PageTemplates from '../page-templates';\nimport PageLibrary from '../page-library';\nimport { unlock } from '../../lock-unlock';\n\nconst { useLocation } = unlock( routerPrivateApis );\n\nexport default function PageMain() {\n\tconst {\n\t\tparams: { path },\n\t} = useLocation();\n\n\tif ( path === '/wp_template/all' ) {\n\t\treturn <PageTemplates />;\n\t} else if ( path === '/library' ) {\n\t\treturn <PageLibrary />;\n\t}\n\n\treturn null;\n}\n"]}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { createElement } from "@wordpress/element";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* WordPress dependencies
|
|
5
|
+
*/
|
|
6
|
+
import { VisuallyHidden, __experimentalHeading as Heading, __experimentalText as Text, __experimentalVStack as VStack } from '@wordpress/components';
|
|
7
|
+
import { __ } from '@wordpress/i18n';
|
|
8
|
+
import { useSelect } from '@wordpress/data';
|
|
9
|
+
import { store as coreStore, useEntityRecords } from '@wordpress/core-data';
|
|
10
|
+
import { decodeEntities } from '@wordpress/html-entities';
|
|
11
|
+
/**
|
|
12
|
+
* Internal dependencies
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import Page from '../page';
|
|
16
|
+
import Table from '../table';
|
|
17
|
+
import Link from '../routes/link';
|
|
18
|
+
import AddedBy from '../list/added-by';
|
|
19
|
+
import TemplateActions from '../template-actions';
|
|
20
|
+
import AddNewTemplate from '../add-new-template';
|
|
21
|
+
import { store as editSiteStore } from '../../store';
|
|
22
|
+
export default function PageTemplates() {
|
|
23
|
+
const {
|
|
24
|
+
records: templates
|
|
25
|
+
} = useEntityRecords('postType', 'wp_template', {
|
|
26
|
+
per_page: -1
|
|
27
|
+
});
|
|
28
|
+
const {
|
|
29
|
+
canCreate
|
|
30
|
+
} = useSelect(select => {
|
|
31
|
+
const {
|
|
32
|
+
supportsTemplatePartsMode
|
|
33
|
+
} = select(editSiteStore).getSettings();
|
|
34
|
+
return {
|
|
35
|
+
postType: select(coreStore).getPostType('wp_template'),
|
|
36
|
+
canCreate: !supportsTemplatePartsMode
|
|
37
|
+
};
|
|
38
|
+
});
|
|
39
|
+
const columns = [{
|
|
40
|
+
header: __('Template'),
|
|
41
|
+
cell: template => createElement(VStack, null, createElement(Heading, {
|
|
42
|
+
level: 5
|
|
43
|
+
}, createElement(Link, {
|
|
44
|
+
params: {
|
|
45
|
+
postId: template.id,
|
|
46
|
+
postType: template.type,
|
|
47
|
+
canvas: 'edit'
|
|
48
|
+
}
|
|
49
|
+
}, decodeEntities(template.title?.rendered || template.slug))), template.description && createElement(Text, {
|
|
50
|
+
variant: "muted"
|
|
51
|
+
}, decodeEntities(template.description))),
|
|
52
|
+
maxWidth: 400
|
|
53
|
+
}, {
|
|
54
|
+
header: __('Added by'),
|
|
55
|
+
cell: template => createElement(AddedBy, {
|
|
56
|
+
postType: template.type,
|
|
57
|
+
postId: template.id
|
|
58
|
+
})
|
|
59
|
+
}, {
|
|
60
|
+
header: createElement(VisuallyHidden, null, __('Actions')),
|
|
61
|
+
cell: template => createElement(TemplateActions, {
|
|
62
|
+
postType: template.type,
|
|
63
|
+
postId: template.id
|
|
64
|
+
})
|
|
65
|
+
}];
|
|
66
|
+
return createElement(Page, {
|
|
67
|
+
title: __('Templates'),
|
|
68
|
+
actions: canCreate && createElement(AddNewTemplate, {
|
|
69
|
+
templateType: 'wp_template',
|
|
70
|
+
showIcon: false,
|
|
71
|
+
toggleProps: {
|
|
72
|
+
variant: 'primary'
|
|
73
|
+
}
|
|
74
|
+
})
|
|
75
|
+
}, templates && createElement(Table, {
|
|
76
|
+
data: templates,
|
|
77
|
+
columns: columns
|
|
78
|
+
}));
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/page-templates/index.js"],"names":["VisuallyHidden","__experimentalHeading","Heading","__experimentalText","Text","__experimentalVStack","VStack","__","useSelect","store","coreStore","useEntityRecords","decodeEntities","Page","Table","Link","AddedBy","TemplateActions","AddNewTemplate","editSiteStore","PageTemplates","records","templates","per_page","canCreate","select","supportsTemplatePartsMode","getSettings","postType","getPostType","columns","header","cell","template","postId","id","type","canvas","title","rendered","slug","description","maxWidth","variant"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,cADD,EAECC,qBAAqB,IAAIC,OAF1B,EAGCC,kBAAkB,IAAIC,IAHvB,EAICC,oBAAoB,IAAIC,MAJzB,QAKO,uBALP;AAMA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,KAAK,IAAIC,SAAlB,EAA6BC,gBAA7B,QAAqD,sBAArD;AACA,SAASC,cAAT,QAA+B,0BAA/B;AAEA;AACA;AACA;;AACA,OAAOC,IAAP,MAAiB,SAAjB;AACA,OAAOC,KAAP,MAAkB,UAAlB;AACA,OAAOC,IAAP,MAAiB,gBAAjB;AACA,OAAOC,OAAP,MAAoB,kBAApB;AACA,OAAOC,eAAP,MAA4B,qBAA5B;AACA,OAAOC,cAAP,MAA2B,qBAA3B;AACA,SAAST,KAAK,IAAIU,aAAlB,QAAuC,aAAvC;AAEA,eAAe,SAASC,aAAT,GAAyB;AACvC,QAAM;AAAEC,IAAAA,OAAO,EAAEC;AA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,QAAQ,CAACE;AAAtD;AAHF,GA3Be,EAiCf;AACCJ,IAAAA,MAAM,EAAE,cAAC,cAAD,QAAkBxB,EAAE,CAAE,SAAF,CAApB,CADT;AAECyB,IAAAA,IAAI,EAAIC,QAAF,IACL,cAAC,eAAD;AACC,MAAA,QAAQ,EAAGA,QAAQ,CAACG,IADrB;AAEC,MAAA,MAAM,EAAGH,QAAQ,CAACE;AAFnB;AAHF,GAjCe,CAAhB;AA4CA,SACC,cAAC,IAAD;AACC,IAAA,KAAK,EAAG5B,EAAE,CAAE,WAAF,CADX;AAEC,IAAA,OAAO,EACNiB,SAAS,IACR,cAAC,cAAD;AACC,MAAA,YAAY,EAAG,aADhB;AAEC,MAAA,QAAQ,EAAG,KAFZ;AAGC,MAAA,WAAW,EAAG;AAAEmB,QAAAA,OAAO,EAAE;AAAX;AAHf;AAJH,KAYGrB,SAAS,IAAI,cAAC,KAAD;AAAO,IAAA,IAAI,EAAGA,SAAd;AAA0B,IAAA,OAAO,EAAGQ;AAApC,IAZhB,CADD;AAgBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tVisuallyHidden,\n\t__experimentalHeading as Heading,\n\t__experimentalText as Text,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore, useEntityRecords } from '@wordpress/core-data';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport Page from '../page';\nimport Table from '../table';\nimport Link from '../routes/link';\nimport AddedBy from '../list/added-by';\nimport TemplateActions from '../template-actions';\nimport AddNewTemplate from '../add-new-template';\nimport { store as editSiteStore } from '../../store';\n\nexport default function PageTemplates() {\n\tconst { records: templates } = useEntityRecords(\n\t\t'postType',\n\t\t'wp_template',\n\t\t{\n\t\t\tper_page: -1,\n\t\t}\n\t);\n\n\tconst { canCreate } = useSelect( ( select ) => {\n\t\tconst { supportsTemplatePartsMode } =\n\t\t\tselect( editSiteStore ).getSettings();\n\t\treturn {\n\t\t\tpostType: select( coreStore ).getPostType( 'wp_template' ),\n\t\t\tcanCreate: ! supportsTemplatePartsMode,\n\t\t};\n\t} );\n\n\tconst columns = [\n\t\t{\n\t\t\theader: __( 'Template' ),\n\t\t\tcell: ( template ) => (\n\t\t\t\t<VStack>\n\t\t\t\t\t<Heading level={ 5 }>\n\t\t\t\t\t\t<Link\n\t\t\t\t\t\t\tparams={ {\n\t\t\t\t\t\t\t\tpostId: template.id,\n\t\t\t\t\t\t\t\tpostType: template.type,\n\t\t\t\t\t\t\t\tcanvas: 'edit',\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ decodeEntities(\n\t\t\t\t\t\t\t\ttemplate.title?.rendered || template.slug\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</Link>\n\t\t\t\t\t</Heading>\n\t\t\t\t\t{ template.description && (\n\t\t\t\t\t\t<Text variant=\"muted\">\n\t\t\t\t\t\t\t{ decodeEntities( template.description ) }\n\t\t\t\t\t\t</Text>\n\t\t\t\t\t) }\n\t\t\t\t</VStack>\n\t\t\t),\n\t\t\tmaxWidth: 400,\n\t\t},\n\t\t{\n\t\t\theader: __( 'Added by' ),\n\t\t\tcell: ( template ) => (\n\t\t\t\t<AddedBy postType={ template.type } postId={ template.id } />\n\t\t\t),\n\t\t},\n\t\t{\n\t\t\theader: <VisuallyHidden>{ __( 'Actions' ) }</VisuallyHidden>,\n\t\t\tcell: ( template ) => (\n\t\t\t\t<TemplateActions\n\t\t\t\t\tpostType={ template.type }\n\t\t\t\t\tpostId={ template.id }\n\t\t\t\t/>\n\t\t\t),\n\t\t},\n\t];\n\n\treturn (\n\t\t<Page\n\t\t\ttitle={ __( 'Templates' ) }\n\t\t\tactions={\n\t\t\t\tcanCreate && (\n\t\t\t\t\t<AddNewTemplate\n\t\t\t\t\t\ttemplateType={ 'wp_template' }\n\t\t\t\t\t\tshowIcon={ false }\n\t\t\t\t\t\ttoggleProps={ { variant: 'primary' } }\n\t\t\t\t\t/>\n\t\t\t\t)\n\t\t\t}\n\t\t>\n\t\t\t{ templates && <Table data={ templates } columns={ columns } /> }\n\t\t</Page>\n\t);\n}\n"]}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
1
|
import { createElement } from "@wordpress/element";
|
|
3
2
|
|
|
4
3
|
/**
|
|
@@ -19,9 +18,10 @@ export default function EnableFeature(props) {
|
|
|
19
18
|
|
|
20
19
|
const onChange = () => toggle('core/edit-site', featureName);
|
|
21
20
|
|
|
22
|
-
return createElement(BaseOption,
|
|
21
|
+
return createElement(BaseOption, {
|
|
23
22
|
onChange: onChange,
|
|
24
|
-
isChecked: isChecked
|
|
25
|
-
|
|
23
|
+
isChecked: isChecked,
|
|
24
|
+
...remainingProps
|
|
25
|
+
});
|
|
26
26
|
}
|
|
27
27
|
//# sourceMappingURL=enable-feature.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/preferences-modal/enable-feature.js"],"names":["useSelect","useDispatch","___unstablePreferencesModalBaseOption","BaseOption","store","preferencesStore","EnableFeature","props","featureName","remainingProps","isChecked","select","get","toggle","onChange"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/preferences-modal/enable-feature.js"],"names":["useSelect","useDispatch","___unstablePreferencesModalBaseOption","BaseOption","store","preferencesStore","EnableFeature","props","featureName","remainingProps","isChecked","select","get","toggle","onChange"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,qCAAqC,IAAIC,UAAlD,QAAoE,sBAApE;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,wBAA1C;AAEA,eAAe,SAASC,aAAT,CAAwBC,KAAxB,EAAgC;AAC9C,QAAM;AAAEC,IAAAA,WAAF;AAAe,OAAGC;AAAlB,MAAqCF,KAA3C;AACA,QAAMG,SAAS,GAAGV,SAAS,CACxBW,MAAF,IACC,CAAC,CAAEA,MAAM,CAAEN,gBAAF,CAAN,CAA2BO,GAA3B,CAAgC,gBAAhC,EAAkDJ,WAAlD,CAFsB,EAG1B,CAAEA,WAAF,CAH0B,CAA3B;AAKA,QAAM;AAAEK,IAAAA;AAAF,MAAaZ,WAAW,CAAEI,gBAAF,CAA9B;;AACA,QAAMS,QAAQ,GAAG,MAAMD,MAAM,CAAE,gBAAF,EAAoBL,WAApB,CAA7B;;AACA,SACC,cAAC,UAAD;AACC,IAAA,QAAQ,EAAGM,QADZ;AAEC,IAAA,SAAS,EAAGJ,SAFb;AAAA,OAGMD;AAHN,IADD;AAOA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { ___unstablePreferencesModalBaseOption as BaseOption } from '@wordpress/interface';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\nexport default function EnableFeature( props ) {\n\tconst { featureName, ...remainingProps } = props;\n\tconst isChecked = useSelect(\n\t\t( select ) =>\n\t\t\t!! select( preferencesStore ).get( 'core/edit-site', featureName ),\n\t\t[ featureName ]\n\t);\n\tconst { toggle } = useDispatch( preferencesStore );\n\tconst onChange = () => toggle( 'core/edit-site', featureName );\n\treturn (\n\t\t<BaseOption\n\t\t\tonChange={ onChange }\n\t\t\tisChecked={ isChecked }\n\t\t\t{ ...remainingProps }\n\t\t/>\n\t);\n}\n"]}
|
|
@@ -15,7 +15,7 @@ import { useDispatch } from '@wordpress/data';
|
|
|
15
15
|
* Internal dependencies
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
|
-
import { unlock } from '../../
|
|
18
|
+
import { unlock } from '../../lock-unlock';
|
|
19
19
|
import { store as editSiteStore } from '../../store'; // Removes the inline styles in the drag handles.
|
|
20
20
|
|
|
21
21
|
const HANDLE_STYLES_OVERRIDE = {
|
|
@@ -57,7 +57,8 @@ function ResizableFrame({
|
|
|
57
57
|
isFullWidth,
|
|
58
58
|
isReady,
|
|
59
59
|
children,
|
|
60
|
-
oversizedClassName
|
|
60
|
+
oversizedClassName,
|
|
61
|
+
innerContentStyle
|
|
61
62
|
}) {
|
|
62
63
|
const [frameSize, setFrameSize] = useState({
|
|
63
64
|
width: '100%',
|
|
@@ -228,7 +229,8 @@ function ResizableFrame({
|
|
|
228
229
|
animate: {
|
|
229
230
|
borderRadius: isFullWidth ? 0 : 8
|
|
230
231
|
},
|
|
231
|
-
transition: FRAME_TRANSITION
|
|
232
|
+
transition: FRAME_TRANSITION,
|
|
233
|
+
style: innerContentStyle
|
|
232
234
|
}, children));
|
|
233
235
|
}
|
|
234
236
|
|