@wordpress/edit-site 5.10.0 → 5.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/build/components/add-new-template/{add-custom-generic-template-modal.js → add-custom-generic-template-modal-content.js} +7 -22
- package/build/components/add-new-template/add-custom-generic-template-modal-content.js.map +1 -0
- package/build/components/add-new-template/{add-custom-template-modal.js → add-custom-template-modal-content.js} +11 -21
- package/build/components/add-new-template/add-custom-template-modal-content.js.map +1 -0
- package/build/components/add-new-template/new-template.js +98 -65
- package/build/components/add-new-template/new-template.js.map +1 -1
- package/build/components/block-editor/index.js +1 -3
- package/build/components/block-editor/index.js.map +1 -1
- package/build/components/create-template-part-modal/index.js +6 -7
- package/build/components/create-template-part-modal/index.js.map +1 -1
- package/build/components/editor/index.js +15 -40
- package/build/components/editor/index.js.map +1 -1
- package/build/components/editor-canvas-container/index.js +10 -3
- package/build/components/editor-canvas-container/index.js.map +1 -1
- package/build/components/global-styles/screen-block.js +80 -3
- package/build/components/global-styles/screen-block.js.map +1 -1
- package/build/components/global-styles/screen-revisions/index.js +3 -10
- package/build/components/global-styles/screen-revisions/index.js.map +1 -1
- package/build/components/global-styles/screen-revisions/revisions-buttons.js +16 -18
- package/build/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
- package/build/components/global-styles/screen-revisions/use-global-styles-revisions.js +15 -24
- package/build/components/global-styles/screen-revisions/use-global-styles-revisions.js.map +1 -1
- package/build/components/global-styles/screen-root.js +4 -4
- package/build/components/global-styles/screen-root.js.map +1 -1
- package/build/components/global-styles/style-variations-container.js +6 -10
- package/build/components/global-styles/style-variations-container.js.map +1 -1
- package/build/components/global-styles/ui.js +9 -9
- package/build/components/global-styles/ui.js.map +1 -1
- package/build/components/header-edit-mode/document-actions/index.js +28 -103
- package/build/components/header-edit-mode/document-actions/index.js.map +1 -1
- package/build/components/header-edit-mode/index.js +14 -1
- package/build/components/header-edit-mode/index.js.map +1 -1
- package/build/components/layout/hooks.js +54 -0
- package/build/components/layout/hooks.js.map +1 -0
- package/build/components/layout/index.js +45 -98
- package/build/components/layout/index.js.map +1 -1
- package/build/components/list/actions/index.js +5 -2
- package/build/components/list/actions/index.js.map +1 -1
- package/build/components/resizable-frame/index.js +242 -0
- package/build/components/resizable-frame/index.js.map +1 -0
- package/build/components/revisions/index.js +2 -1
- package/build/components/revisions/index.js.map +1 -1
- package/build/components/secondary-sidebar/list-view-sidebar.js +4 -3
- package/build/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- package/build/components/sidebar/index.js +4 -4
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/template-revisions/index.js +1 -1
- package/build/components/sidebar-edit-mode/template-revisions/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-global-styles/index.js +75 -11
- package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-main/index.js +24 -33
- package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/index.js +162 -0
- package/build/components/sidebar-navigation-screen-navigation-menu/index.js.map +1 -0
- package/build/components/sidebar-navigation-screen-navigation-menus/constants.js +17 -0
- package/build/components/sidebar-navigation-screen-navigation-menus/constants.js.map +1 -0
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js +53 -103
- 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 +87 -0
- package/build/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js.map +1 -0
- package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +14 -71
- package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/navigator-button.js +53 -0
- package/build/components/sidebar-navigation-screen-navigation-menus/navigator-button.js.map +1 -0
- package/build/components/sidebar-navigation-screen-templates/index.js +36 -11
- package/build/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build/components/site-hub/index.js +1 -3
- package/build/components/site-hub/index.js.map +1 -1
- package/build/components/style-book/index.js +93 -19
- package/build/components/style-book/index.js.map +1 -1
- package/build/components/use-edited-entity-record/index.js +8 -4
- package/build/components/use-edited-entity-record/index.js.map +1 -1
- package/build/hooks/commands/use-edit-mode-commands.js +105 -0
- package/build/hooks/commands/use-edit-mode-commands.js.map +1 -0
- package/build/store/actions.js +5 -3
- package/build/store/actions.js.map +1 -1
- package/build-module/components/add-new-template/{add-custom-generic-template-modal.js → add-custom-generic-template-modal-content.js} +8 -20
- package/build-module/components/add-new-template/add-custom-generic-template-modal-content.js.map +1 -0
- package/build-module/components/add-new-template/{add-custom-template-modal.js → add-custom-template-modal-content.js} +13 -22
- package/build-module/components/add-new-template/add-custom-template-modal-content.js.map +1 -0
- package/build-module/components/add-new-template/new-template.js +98 -67
- package/build-module/components/add-new-template/new-template.js.map +1 -1
- package/build-module/components/block-editor/index.js +1 -3
- package/build-module/components/block-editor/index.js.map +1 -1
- package/build-module/components/create-template-part-modal/index.js +7 -8
- package/build-module/components/create-template-part-modal/index.js.map +1 -1
- package/build-module/components/editor/index.js +16 -43
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/editor-canvas-container/index.js +7 -3
- package/build-module/components/editor-canvas-container/index.js.map +1 -1
- package/build-module/components/global-styles/screen-block.js +82 -4
- package/build-module/components/global-styles/screen-block.js.map +1 -1
- package/build-module/components/global-styles/screen-revisions/index.js +3 -10
- package/build-module/components/global-styles/screen-revisions/index.js.map +1 -1
- package/build-module/components/global-styles/screen-revisions/revisions-buttons.js +16 -19
- package/build-module/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
- package/build-module/components/global-styles/screen-revisions/use-global-styles-revisions.js +15 -24
- 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 +4 -4
- package/build-module/components/global-styles/screen-root.js.map +1 -1
- package/build-module/components/global-styles/style-variations-container.js +7 -11
- package/build-module/components/global-styles/style-variations-container.js.map +1 -1
- package/build-module/components/global-styles/ui.js +10 -10
- package/build-module/components/global-styles/ui.js.map +1 -1
- package/build-module/components/header-edit-mode/document-actions/index.js +31 -107
- package/build-module/components/header-edit-mode/document-actions/index.js.map +1 -1
- package/build-module/components/header-edit-mode/index.js +14 -2
- package/build-module/components/header-edit-mode/index.js.map +1 -1
- package/build-module/components/layout/hooks.js +41 -0
- package/build-module/components/layout/hooks.js.map +1 -0
- package/build-module/components/layout/index.js +46 -101
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/list/actions/index.js +6 -3
- package/build-module/components/list/actions/index.js.map +1 -1
- package/build-module/components/resizable-frame/index.js +228 -0
- package/build-module/components/resizable-frame/index.js.map +1 -0
- package/build-module/components/revisions/index.js +2 -1
- package/build-module/components/revisions/index.js.map +1 -1
- package/build-module/components/secondary-sidebar/list-view-sidebar.js +3 -3
- package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- package/build-module/components/sidebar/index.js +3 -3
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/template-revisions/index.js +1 -1
- package/build-module/components/sidebar-edit-mode/template-revisions/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js +70 -14
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-main/index.js +21 -32
- package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/index.js +141 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menu/index.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menus/constants.js +10 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menus/constants.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js +52 -103
- 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 +71 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +12 -71
- package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/navigator-button.js +40 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menus/navigator-button.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-templates/index.js +35 -11
- package/build-module/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build-module/components/site-hub/index.js +1 -3
- package/build-module/components/site-hub/index.js.map +1 -1
- package/build-module/components/style-book/index.js +93 -20
- package/build-module/components/style-book/index.js.map +1 -1
- package/build-module/components/use-edited-entity-record/index.js +8 -4
- package/build-module/components/use-edited-entity-record/index.js.map +1 -1
- package/build-module/hooks/commands/use-edit-mode-commands.js +86 -0
- package/build-module/hooks/commands/use-edit-mode-commands.js.map +1 -0
- package/build-module/store/actions.js +5 -3
- package/build-module/store/actions.js.map +1 -1
- package/build-style/style-rtl.css +233 -210
- package/build-style/style.css +234 -210
- package/package.json +37 -37
- package/src/components/add-new-template/add-custom-generic-template-modal-content.js +82 -0
- package/src/components/add-new-template/{add-custom-template-modal.js → add-custom-template-modal-content.js} +13 -26
- package/src/components/add-new-template/new-template.js +139 -153
- package/src/components/add-new-template/style.scss +79 -66
- package/src/components/block-editor/index.js +2 -3
- package/src/components/create-template-part-modal/index.js +19 -25
- package/src/components/editor/index.js +16 -45
- package/src/components/editor/style.scss +21 -6
- package/src/components/editor-canvas-container/index.js +28 -19
- package/src/components/global-styles/screen-block.js +74 -3
- package/src/components/global-styles/screen-revisions/index.js +3 -11
- package/src/components/global-styles/screen-revisions/revisions-buttons.js +33 -25
- package/src/components/global-styles/screen-revisions/style.scss +3 -2
- package/src/components/global-styles/screen-revisions/test/use-global-styles-revisions.js +16 -3
- package/src/components/global-styles/screen-revisions/use-global-styles-revisions.js +15 -19
- package/src/components/global-styles/screen-root.js +5 -3
- package/src/components/global-styles/style-variations-container.js +13 -18
- package/src/components/global-styles/style.scss +3 -0
- package/src/components/global-styles/ui.js +11 -9
- package/src/components/header-edit-mode/document-actions/index.js +26 -129
- package/src/components/header-edit-mode/document-actions/style.scss +28 -59
- package/src/components/header-edit-mode/index.js +18 -0
- package/src/components/header-edit-mode/style.scss +1 -0
- package/src/components/layout/hooks.js +46 -0
- package/src/components/layout/index.js +56 -125
- package/src/components/layout/style.scss +8 -2
- package/src/components/list/actions/index.js +12 -5
- package/src/components/list/style.scss +1 -0
- package/src/components/resizable-frame/index.js +253 -0
- package/src/components/resizable-frame/style.scss +69 -0
- package/src/components/revisions/index.js +1 -0
- package/src/components/secondary-sidebar/list-view-sidebar.js +2 -1
- package/src/components/sidebar/index.js +4 -4
- package/src/components/sidebar-edit-mode/template-revisions/index.js +1 -2
- package/src/components/sidebar-navigation-item/style.scss +9 -0
- package/src/components/sidebar-navigation-screen/style.scss +1 -2
- package/src/components/sidebar-navigation-screen-global-styles/index.js +106 -21
- package/src/components/sidebar-navigation-screen-main/index.js +35 -52
- package/src/components/sidebar-navigation-screen-navigation-menu/index.js +157 -0
- package/src/components/sidebar-navigation-screen-navigation-menus/constants.js +9 -0
- package/src/components/sidebar-navigation-screen-navigation-menus/index.js +63 -117
- package/src/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +83 -0
- package/src/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +6 -72
- package/src/components/sidebar-navigation-screen-navigation-menus/navigator-button.js +47 -0
- package/src/components/sidebar-navigation-screen-navigation-menus/style.scss +6 -20
- package/src/components/sidebar-navigation-screen-templates/index.js +53 -14
- package/src/components/site-hub/index.js +8 -9
- package/src/components/start-template-options/style.scss +20 -21
- package/src/components/style-book/index.js +132 -43
- package/src/components/style-book/style.scss +19 -0
- package/src/components/use-edited-entity-record/index.js +12 -3
- package/src/hooks/commands/use-edit-mode-commands.js +79 -0
- package/src/store/actions.js +4 -5
- package/src/store/test/utils.js +15 -5
- package/src/style.scss +1 -1
- package/build/components/add-new-template/add-custom-generic-template-modal.js.map +0 -1
- package/build/components/add-new-template/add-custom-template-modal.js.map +0 -1
- package/build/components/global-styles/border-panel.js +0 -135
- package/build/components/global-styles/border-panel.js.map +0 -1
- package/build/components/navigate-to-link/index.js +0 -51
- package/build/components/navigate-to-link/index.js.map +0 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/loader.js +0 -19
- package/build/components/sidebar-navigation-screen-navigation-menus/loader.js.map +0 -1
- package/build/components/template-details/edit-template-title.js +0 -42
- package/build/components/template-details/edit-template-title.js.map +0 -1
- package/build/components/template-details/index.js +0 -103
- package/build/components/template-details/index.js.map +0 -1
- package/build/components/template-details/template-areas.js +0 -166
- package/build/components/template-details/template-areas.js.map +0 -1
- package/build/components/template-details/template-part-area-selector.js +0 -48
- package/build/components/template-details/template-part-area-selector.js.map +0 -1
- package/build-module/components/add-new-template/add-custom-generic-template-modal.js.map +0 -1
- package/build-module/components/add-new-template/add-custom-template-modal.js.map +0 -1
- package/build-module/components/global-styles/border-panel.js +0 -125
- package/build-module/components/global-styles/border-panel.js.map +0 -1
- package/build-module/components/navigate-to-link/index.js +0 -39
- package/build-module/components/navigate-to-link/index.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/loader.js +0 -11
- package/build-module/components/sidebar-navigation-screen-navigation-menus/loader.js.map +0 -1
- package/build-module/components/template-details/edit-template-title.js +0 -33
- package/build-module/components/template-details/edit-template-title.js.map +0 -1
- package/build-module/components/template-details/index.js +0 -83
- package/build-module/components/template-details/index.js.map +0 -1
- package/build-module/components/template-details/template-areas.js +0 -145
- package/build-module/components/template-details/template-areas.js.map +0 -1
- package/build-module/components/template-details/template-part-area-selector.js +0 -36
- package/build-module/components/template-details/template-part-area-selector.js.map +0 -1
- package/src/components/add-new-template/add-custom-generic-template-modal.js +0 -101
- package/src/components/global-styles/border-panel.js +0 -114
- package/src/components/navigate-to-link/index.js +0 -46
- package/src/components/sidebar-navigation-screen-navigation-menus/loader.js +0 -9
- package/src/components/template-details/edit-template-title.js +0 -41
- package/src/components/template-details/index.js +0 -113
- package/src/components/template-details/style.scss +0 -72
- package/src/components/template-details/template-areas.js +0 -167
- package/src/components/template-details/template-part-area-selector.js +0 -39
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/list/actions/index.js"],"names":["useDispatch","store","coreStore","__","DropdownMenu","MenuGroup","MenuItem","moreVertical","noticesStore","editSiteStore","isTemplateRemovable","isTemplateRevertable","RenameMenuItem","Actions","template","removeTemplate","revertTemplate","saveEditedEntityRecord","createSuccessNotice","createErrorNotice","isRemovable","isRevertable","revertAndSaveTemplate","allowUndo","type","id","error","errorMessage","message","code","onClose"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,WAAT,QAA4B,iBAA5B;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AACA,SAASC,EAAT,
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/list/actions/index.js"],"names":["useDispatch","store","coreStore","__","sprintf","DropdownMenu","MenuGroup","MenuItem","moreVertical","noticesStore","editSiteStore","isTemplateRemovable","isTemplateRevertable","RenameMenuItem","Actions","template","removeTemplate","revertTemplate","saveEditedEntityRecord","createSuccessNotice","createErrorNotice","isRemovable","isRevertable","revertAndSaveTemplate","allowUndo","type","id","title","rendered","error","errorMessage","message","code","onClose"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,WAAT,QAA4B,iBAA5B;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AACA,SAASC,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SAASC,YAAT,EAAuBC,SAAvB,EAAkCC,QAAlC,QAAkD,uBAAlD;AACA,SAASC,YAAT,QAA6B,kBAA7B;AACA,SAAS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BF,KAAK,CAACG,IAAN,KAAe,eAAhC,GACGH,KAAK,CAACE,OADT,GAEG5B,EAAE,CAAE,+CAAF,CAHN;AAKAiB,MAAAA,iBAAiB,CAAEU,YAAF,EAAgB;AAAEL,QAAAA,IAAI,EAAE;AAAR,OAAhB,CAAjB;AACA;AACD;;AAED,SACC,cAAC,YAAD;AACC,IAAA,IAAI,EAAGjB,YADR;AAEC,IAAA,KAAK,EAAGL,EAAE,CAAE,SAAF,CAFX;AAGC,IAAA,SAAS,EAAC;AAHX,KAKG;AAAA,QAAE;AAAE8B,MAAAA;AAAF,KAAF;AAAA,WACD,cAAC,SAAD,QACGZ,WAAW,IACZ,8BACC,cAAC,cAAD;AACC,MAAA,QAAQ,EAAGN,QADZ;AAEC,MAAA,OAAO,EAAGkB;AAFX,MADD,EAKC,cAAC,QAAD;AACC,MAAA,aAAa,MADd;AAEC,MAAA,UAAU,MAFX;AAGC,MAAA,OAAO,EAAG,MAAM;AACfjB,QAAAA,cAAc,CAAED,QAAF,CAAd;AACAkB,QAAAA,OAAO;AACP;AANF,OAQG9B,EAAE,CAAE,QAAF,CARL,CALD,CAFF,EAmBGmB,YAAY,IACb,cAAC,QAAD;AACC,MAAA,IAAI,EAAGnB,EAAE,CACR,4CADQ,CADV;AAIC,MAAA,OAAO,EAAG,MAAM;AACfoB,QAAAA,qBAAqB;AACrBU,QAAAA,OAAO;AACP;AAPF,OASG9B,EAAE,CAAE,sBAAF,CATL,CApBF,CADC;AAAA,GALH,CADD;AA2CA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { DropdownMenu, MenuGroup, MenuItem } from '@wordpress/components';\nimport { moreVertical } from '@wordpress/icons';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../../store';\nimport isTemplateRemovable from '../../../utils/is-template-removable';\nimport isTemplateRevertable from '../../../utils/is-template-revertable';\nimport RenameMenuItem from './rename-menu-item';\n\nexport default function Actions( { template } ) {\n\tconst { removeTemplate, revertTemplate } = useDispatch( editSiteStore );\n\tconst { saveEditedEntityRecord } = useDispatch( coreStore );\n\tconst { createSuccessNotice, createErrorNotice } =\n\t\tuseDispatch( noticesStore );\n\tconst isRemovable = isTemplateRemovable( template );\n\tconst isRevertable = isTemplateRevertable( template );\n\n\tif ( ! isRemovable && ! isRevertable ) {\n\t\treturn null;\n\t}\n\n\tasync function revertAndSaveTemplate() {\n\t\ttry {\n\t\t\tawait revertTemplate( template, { allowUndo: false } );\n\t\t\tawait saveEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\ttemplate.type,\n\t\t\t\ttemplate.id\n\t\t\t);\n\n\t\t\tcreateSuccessNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t/* translators: The template/part's name. */\n\t\t\t\t\t__( '\"%s\" reverted.' ),\n\t\t\t\t\ttemplate.title.rendered\n\t\t\t\t),\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\tid: 'edit-site-template-reverted',\n\t\t\t\t}\n\t\t\t);\n\t\t} catch ( error ) {\n\t\t\tconst errorMessage =\n\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t? error.message\n\t\t\t\t\t: __( 'An error occurred while reverting the entity.' );\n\n\t\t\tcreateErrorNotice( errorMessage, { type: 'snackbar' } );\n\t\t}\n\t}\n\n\treturn (\n\t\t<DropdownMenu\n\t\t\ticon={ moreVertical }\n\t\t\tlabel={ __( 'Actions' ) }\n\t\t\tclassName=\"edit-site-list-table__actions\"\n\t\t>\n\t\t\t{ ( { onClose } ) => (\n\t\t\t\t<MenuGroup>\n\t\t\t\t\t{ isRemovable && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<RenameMenuItem\n\t\t\t\t\t\t\t\ttemplate={ template }\n\t\t\t\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\tisDestructive\n\t\t\t\t\t\t\t\tisTertiary\n\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\tremoveTemplate( template );\n\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Delete' ) }\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\t\t\t\t\t{ isRevertable && (\n\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\tinfo={ __(\n\t\t\t\t\t\t\t\t'Use the template as supplied by the theme.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\trevertAndSaveTemplate();\n\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Clear customizations' ) }\n\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t) }\n\t\t\t\t</MenuGroup>\n\t\t\t) }\n\t\t</DropdownMenu>\n\t);\n}\n"]}
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
import { createElement } from "@wordpress/element";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* External dependencies
|
|
5
|
+
*/
|
|
6
|
+
import classnames from 'classnames';
|
|
7
|
+
/**
|
|
8
|
+
* WordPress dependencies
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { useState, useRef, useEffect } from '@wordpress/element';
|
|
12
|
+
import { ResizableBox, __unstableMotion as motion } from '@wordpress/components';
|
|
13
|
+
import { useDispatch } from '@wordpress/data';
|
|
14
|
+
/**
|
|
15
|
+
* Internal dependencies
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import { unlock } from '../../private-apis';
|
|
19
|
+
import { store as editSiteStore } from '../../store'; // Removes the inline styles in the drag handles.
|
|
20
|
+
|
|
21
|
+
const HANDLE_STYLES_OVERRIDE = {
|
|
22
|
+
position: undefined,
|
|
23
|
+
userSelect: undefined,
|
|
24
|
+
cursor: undefined,
|
|
25
|
+
width: undefined,
|
|
26
|
+
height: undefined,
|
|
27
|
+
top: undefined,
|
|
28
|
+
right: undefined,
|
|
29
|
+
bottom: undefined,
|
|
30
|
+
left: undefined
|
|
31
|
+
}; // The minimum width of the frame (in px) while resizing.
|
|
32
|
+
|
|
33
|
+
const FRAME_MIN_WIDTH = 340; // The reference width of the frame (in px) used to calculate the aspect ratio.
|
|
34
|
+
|
|
35
|
+
const FRAME_REFERENCE_WIDTH = 1300; // 9 : 19.5 is the target aspect ratio enforced (when possible) while resizing.
|
|
36
|
+
|
|
37
|
+
const FRAME_TARGET_ASPECT_RATIO = 9 / 19.5; // The minimum distance (in px) between the frame resize handle and the
|
|
38
|
+
// viewport's edge. If the frame is resized to be closer to the viewport's edge
|
|
39
|
+
// than this distance, then "canvas mode" will be enabled.
|
|
40
|
+
|
|
41
|
+
const SNAP_TO_EDIT_CANVAS_MODE_THRESHOLD = 200;
|
|
42
|
+
|
|
43
|
+
function calculateNewHeight(width, initialAspectRatio) {
|
|
44
|
+
const lerp = (a, b, amount) => {
|
|
45
|
+
return a + (b - a) * amount;
|
|
46
|
+
}; // Calculate the intermediate aspect ratio based on the current width.
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
const lerpFactor = 1 - Math.max(0, Math.min(1, (width - FRAME_MIN_WIDTH) / (FRAME_REFERENCE_WIDTH - FRAME_MIN_WIDTH))); // Calculate the height based on the intermediate aspect ratio
|
|
50
|
+
// ensuring the frame arrives at the target aspect ratio.
|
|
51
|
+
|
|
52
|
+
const intermediateAspectRatio = lerp(initialAspectRatio, FRAME_TARGET_ASPECT_RATIO, lerpFactor);
|
|
53
|
+
return width / intermediateAspectRatio;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function ResizableFrame(_ref2) {
|
|
57
|
+
let {
|
|
58
|
+
isFullWidth,
|
|
59
|
+
isReady,
|
|
60
|
+
children,
|
|
61
|
+
oversizedClassName
|
|
62
|
+
} = _ref2;
|
|
63
|
+
const [frameSize, setFrameSize] = useState({
|
|
64
|
+
width: '100%',
|
|
65
|
+
height: '100%'
|
|
66
|
+
}); // The width of the resizable frame when a new resize gesture starts.
|
|
67
|
+
|
|
68
|
+
const [startingWidth, setStartingWidth] = useState();
|
|
69
|
+
const [isResizing, setIsResizing] = useState(false);
|
|
70
|
+
const [isHovering, setIsHovering] = useState(false);
|
|
71
|
+
const [isOversized, setIsOversized] = useState(false);
|
|
72
|
+
const [resizeRatio, setResizeRatio] = useState(1);
|
|
73
|
+
const {
|
|
74
|
+
setCanvasMode
|
|
75
|
+
} = unlock(useDispatch(editSiteStore));
|
|
76
|
+
const initialAspectRatioRef = useRef(null); // The width of the resizable frame on initial render.
|
|
77
|
+
|
|
78
|
+
const initialComputedWidthRef = useRef(null);
|
|
79
|
+
const FRAME_TRANSITION = {
|
|
80
|
+
type: 'tween',
|
|
81
|
+
duration: isResizing ? 0 : 0.5
|
|
82
|
+
};
|
|
83
|
+
const frameRef = useRef(null); // Remember frame dimensions on initial render.
|
|
84
|
+
|
|
85
|
+
useEffect(() => {
|
|
86
|
+
const {
|
|
87
|
+
offsetWidth,
|
|
88
|
+
offsetHeight
|
|
89
|
+
} = frameRef.current.resizable;
|
|
90
|
+
initialComputedWidthRef.current = offsetWidth;
|
|
91
|
+
initialAspectRatioRef.current = offsetWidth / offsetHeight;
|
|
92
|
+
}, []);
|
|
93
|
+
|
|
94
|
+
const handleResizeStart = (_event, _direction, ref) => {
|
|
95
|
+
// Remember the starting width so we don't have to get `ref.offsetWidth` on
|
|
96
|
+
// every resize event thereafter, which will cause layout thrashing.
|
|
97
|
+
setStartingWidth(ref.offsetWidth);
|
|
98
|
+
setIsResizing(true);
|
|
99
|
+
}; // Calculate the frame size based on the window width as its resized.
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
const handleResize = (_event, _direction, _ref, delta) => {
|
|
103
|
+
const normalizedDelta = delta.width / resizeRatio;
|
|
104
|
+
const deltaAbs = Math.abs(normalizedDelta);
|
|
105
|
+
const maxDoubledDelta = delta.width < 0 // is shrinking
|
|
106
|
+
? deltaAbs : (initialComputedWidthRef.current - startingWidth) / 2;
|
|
107
|
+
const deltaToDouble = Math.min(deltaAbs, maxDoubledDelta);
|
|
108
|
+
const doubleSegment = deltaAbs === 0 ? 0 : deltaToDouble / deltaAbs;
|
|
109
|
+
const singleSegment = 1 - doubleSegment;
|
|
110
|
+
setResizeRatio(singleSegment + doubleSegment * 2);
|
|
111
|
+
const updatedWidth = startingWidth + delta.width;
|
|
112
|
+
setIsOversized(updatedWidth > initialComputedWidthRef.current); // Width will be controlled by the library (via `resizeRatio`),
|
|
113
|
+
// so we only need to update the height.
|
|
114
|
+
|
|
115
|
+
setFrameSize({
|
|
116
|
+
height: isOversized ? '100%' : calculateNewHeight(updatedWidth, initialAspectRatioRef.current)
|
|
117
|
+
});
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
const handleResizeStop = (_event, _direction, ref) => {
|
|
121
|
+
setIsResizing(false);
|
|
122
|
+
|
|
123
|
+
if (!isOversized) {
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
setIsOversized(false);
|
|
128
|
+
const remainingWidth = ref.ownerDocument.documentElement.offsetWidth - ref.offsetWidth;
|
|
129
|
+
|
|
130
|
+
if (remainingWidth > SNAP_TO_EDIT_CANVAS_MODE_THRESHOLD) {
|
|
131
|
+
// Reset the initial aspect ratio if the frame is resized slightly
|
|
132
|
+
// above the sidebar but not far enough to trigger full screen.
|
|
133
|
+
setFrameSize({
|
|
134
|
+
width: '100%',
|
|
135
|
+
height: '100%'
|
|
136
|
+
});
|
|
137
|
+
} else {
|
|
138
|
+
// Trigger full screen if the frame is resized far enough to the left.
|
|
139
|
+
setCanvasMode('edit');
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
const frameAnimationVariants = {
|
|
144
|
+
default: {
|
|
145
|
+
flexGrow: 0,
|
|
146
|
+
height: frameSize.height
|
|
147
|
+
},
|
|
148
|
+
fullWidth: {
|
|
149
|
+
flexGrow: 1,
|
|
150
|
+
height: frameSize.height
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
return createElement(ResizableBox, {
|
|
154
|
+
as: motion.div,
|
|
155
|
+
ref: frameRef,
|
|
156
|
+
initial: false,
|
|
157
|
+
variants: frameAnimationVariants,
|
|
158
|
+
animate: isFullWidth ? 'fullWidth' : 'default',
|
|
159
|
+
onAnimationComplete: definition => {
|
|
160
|
+
if (definition === 'fullWidth') setFrameSize({
|
|
161
|
+
width: '100%',
|
|
162
|
+
height: '100%'
|
|
163
|
+
});
|
|
164
|
+
},
|
|
165
|
+
transition: FRAME_TRANSITION,
|
|
166
|
+
size: frameSize,
|
|
167
|
+
enable: {
|
|
168
|
+
top: false,
|
|
169
|
+
right: false,
|
|
170
|
+
bottom: false,
|
|
171
|
+
// Resizing will be disabled until the editor content is loaded.
|
|
172
|
+
left: isReady,
|
|
173
|
+
topRight: false,
|
|
174
|
+
bottomRight: false,
|
|
175
|
+
bottomLeft: false,
|
|
176
|
+
topLeft: false
|
|
177
|
+
},
|
|
178
|
+
resizeRatio: resizeRatio,
|
|
179
|
+
handleClasses: undefined,
|
|
180
|
+
handleStyles: {
|
|
181
|
+
left: HANDLE_STYLES_OVERRIDE,
|
|
182
|
+
right: HANDLE_STYLES_OVERRIDE
|
|
183
|
+
},
|
|
184
|
+
minWidth: FRAME_MIN_WIDTH,
|
|
185
|
+
maxWidth: isFullWidth ? '100%' : '150%',
|
|
186
|
+
maxHeight: '100%',
|
|
187
|
+
onMouseOver: () => setIsHovering(true),
|
|
188
|
+
onMouseOut: () => setIsHovering(false),
|
|
189
|
+
handleComponent: {
|
|
190
|
+
left: isHovering || isResizing ? createElement(motion.div, {
|
|
191
|
+
key: "handle",
|
|
192
|
+
className: "edit-site-resizable-frame__handle",
|
|
193
|
+
title: "Drag to resize",
|
|
194
|
+
initial: {
|
|
195
|
+
opacity: 0,
|
|
196
|
+
left: 0
|
|
197
|
+
},
|
|
198
|
+
animate: {
|
|
199
|
+
opacity: 1,
|
|
200
|
+
left: -15
|
|
201
|
+
},
|
|
202
|
+
exit: {
|
|
203
|
+
opacity: 0,
|
|
204
|
+
left: 0
|
|
205
|
+
},
|
|
206
|
+
whileHover: {
|
|
207
|
+
scale: 1.1
|
|
208
|
+
}
|
|
209
|
+
}) : null
|
|
210
|
+
},
|
|
211
|
+
onResizeStart: handleResizeStart,
|
|
212
|
+
onResize: handleResize,
|
|
213
|
+
onResizeStop: handleResizeStop,
|
|
214
|
+
className: classnames('edit-site-resizable-frame__inner', {
|
|
215
|
+
'is-resizing': isResizing,
|
|
216
|
+
[oversizedClassName]: isOversized
|
|
217
|
+
})
|
|
218
|
+
}, createElement(motion.div, {
|
|
219
|
+
className: "edit-site-resizable-frame__inner-content",
|
|
220
|
+
animate: {
|
|
221
|
+
borderRadius: isFullWidth ? 0 : 8
|
|
222
|
+
},
|
|
223
|
+
transition: FRAME_TRANSITION
|
|
224
|
+
}, children));
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
export default ResizableFrame;
|
|
228
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/resizable-frame/index.js"],"names":["classnames","useState","useRef","useEffect","ResizableBox","__unstableMotion","motion","useDispatch","unlock","store","editSiteStore","HANDLE_STYLES_OVERRIDE","position","undefined","userSelect","cursor","width","height","top","right","bottom","left","FRAME_MIN_WIDTH","FRAME_REFERENCE_WIDTH","FRAME_TARGET_ASPECT_RATIO","SNAP_TO_EDIT_CANVAS_MODE_THRESHOLD","calculateNewHeight","initialAspectRatio","lerp","a","b","amount","lerpFactor","Math","max","min","intermediateAspectRatio","ResizableFrame","isFullWidth","isReady","children","oversizedClassName","frameSize","setFrameSize","startingWidth","setStartingWidth","isResizing","setIsResizing","isHovering","setIsHovering","isOversized","setIsOversized","resizeRatio","setResizeRatio","setCanvasMode","initialAspectRatioRef","initialComputedWidthRef","FRAME_TRANSITION","type","duration","frameRef","offsetWidth","offsetHeight","current","resizable","handleResizeStart","_event","_direction","ref","handleResize","_ref","delta","normalizedDelta","deltaAbs","abs","maxDoubledDelta","deltaToDouble","doubleSegment","singleSegment","updatedWidth","handleResizeStop","remainingWidth","ownerDocument","documentElement","frameAnimationVariants","default","flexGrow","fullWidth","div","definition","topRight","bottomRight","bottomLeft","topLeft","opacity","scale","borderRadius"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,QAAT,EAAmBC,MAAnB,EAA2BC,SAA3B,QAA4C,oBAA5C;AACA,SACCC,YADD,EAECC,gBAAgB,IAAIC,MAFrB,QAGO,uBAHP;AAIA,SAASC,WAAT,QAA4B,iBAA5B;AAEA;AACA;AACA;;AACA,SAASC,MAAT,QAAuB,oBAAvB;AACA,SAASC,KAAK,IAAIC,aAAlB,QAAuC,aAAvC,C,CAEA;;AACA,MAAMC,sBAAsB,GAAG;AAC9BC,EAAAA,QAAQ,EAAEC,SADoB;AAE9BC,EAAAA,UAAU,EAAED,SAFkB;AAG9BE,EAAAA,MAAM,EAAEF,SAHsB;AAI9BG,EAAAA,KAAK,EAAEH,SAJuB;AAK9BI,EAAAA,MAAM,EAAEJ,SALsB;AAM9BK,EAAAA,GAAG,EAAEL,SANyB;AAO9BM,EAAAA,KAAK,EAAEN,SAPuB;AAQ9BO,EAAAA,MAAM,EAAEP,SARsB;AAS9BQ,EAAAA,IAAI,EAAER;AATwB,CAA/B,C,CAYA;;AACA,MAAMS,eAAe,GAAG,GAAxB,C,CACA;;AACA,MAAMC,qBAAqB,GAAG,IAA9B,C,CACA;;AACA,MAAMC,yBAAyB,GAAG,IAAI,IAAtC,C,CACA;A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* External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useState, useRef, useEffect } from '@wordpress/element';\nimport {\n\tResizableBox,\n\t__unstableMotion as motion,\n} from '@wordpress/components';\nimport { useDispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../private-apis';\nimport { store as editSiteStore } from '../../store';\n\n// Removes the inline styles in the drag handles.\nconst HANDLE_STYLES_OVERRIDE = {\n\tposition: undefined,\n\tuserSelect: undefined,\n\tcursor: undefined,\n\twidth: undefined,\n\theight: undefined,\n\ttop: undefined,\n\tright: undefined,\n\tbottom: undefined,\n\tleft: undefined,\n};\n\n// The minimum width of the frame (in px) while resizing.\nconst FRAME_MIN_WIDTH = 340;\n// The reference width of the frame (in px) used to calculate the aspect ratio.\nconst FRAME_REFERENCE_WIDTH = 1300;\n// 9 : 19.5 is the target aspect ratio enforced (when possible) while resizing.\nconst FRAME_TARGET_ASPECT_RATIO = 9 / 19.5;\n// The minimum distance (in px) between the frame resize handle and the\n// viewport's edge. If the frame is resized to be closer to the viewport's edge\n// than this distance, then \"canvas mode\" will be enabled.\nconst SNAP_TO_EDIT_CANVAS_MODE_THRESHOLD = 200;\n\nfunction calculateNewHeight( width, initialAspectRatio ) {\n\tconst lerp = ( a, b, amount ) => {\n\t\treturn a + ( b - a ) * amount;\n\t};\n\n\t// Calculate the intermediate aspect ratio based on the current width.\n\tconst lerpFactor =\n\t\t1 -\n\t\tMath.max(\n\t\t\t0,\n\t\t\tMath.min(\n\t\t\t\t1,\n\t\t\t\t( width - FRAME_MIN_WIDTH ) /\n\t\t\t\t\t( FRAME_REFERENCE_WIDTH - FRAME_MIN_WIDTH )\n\t\t\t)\n\t\t);\n\n\t// Calculate the height based on the intermediate aspect ratio\n\t// ensuring the frame arrives at the target aspect ratio.\n\tconst intermediateAspectRatio = lerp(\n\t\tinitialAspectRatio,\n\t\tFRAME_TARGET_ASPECT_RATIO,\n\t\tlerpFactor\n\t);\n\n\treturn width / intermediateAspectRatio;\n}\n\nfunction ResizableFrame( {\n\tisFullWidth,\n\tisReady,\n\tchildren,\n\toversizedClassName,\n} ) {\n\tconst [ frameSize, setFrameSize ] = useState( {\n\t\twidth: '100%',\n\t\theight: '100%',\n\t} );\n\t// The width of the resizable frame when a new resize gesture starts.\n\tconst [ startingWidth, setStartingWidth ] = useState();\n\tconst [ isResizing, setIsResizing ] = useState( false );\n\tconst [ isHovering, setIsHovering ] = useState( false );\n\tconst [ isOversized, setIsOversized ] = useState( false );\n\tconst [ resizeRatio, setResizeRatio ] = useState( 1 );\n\tconst { setCanvasMode } = unlock( useDispatch( editSiteStore ) );\n\tconst initialAspectRatioRef = useRef( null );\n\t// The width of the resizable frame on initial render.\n\tconst initialComputedWidthRef = useRef( null );\n\tconst FRAME_TRANSITION = { type: 'tween', duration: isResizing ? 0 : 0.5 };\n\tconst frameRef = useRef( null );\n\n\t// Remember frame dimensions on initial render.\n\tuseEffect( () => {\n\t\tconst { offsetWidth, offsetHeight } = frameRef.current.resizable;\n\t\tinitialComputedWidthRef.current = offsetWidth;\n\t\tinitialAspectRatioRef.current = offsetWidth / offsetHeight;\n\t}, [] );\n\n\tconst handleResizeStart = ( _event, _direction, ref ) => {\n\t\t// Remember the starting width so we don't have to get `ref.offsetWidth` on\n\t\t// every resize event thereafter, which will cause layout thrashing.\n\t\tsetStartingWidth( ref.offsetWidth );\n\t\tsetIsResizing( true );\n\t};\n\n\t// Calculate the frame size based on the window width as its resized.\n\tconst handleResize = ( _event, _direction, _ref, delta ) => {\n\t\tconst normalizedDelta = delta.width / resizeRatio;\n\t\tconst deltaAbs = Math.abs( normalizedDelta );\n\t\tconst maxDoubledDelta =\n\t\t\tdelta.width < 0 // is shrinking\n\t\t\t\t? deltaAbs\n\t\t\t\t: ( initialComputedWidthRef.current - startingWidth ) / 2;\n\t\tconst deltaToDouble = Math.min( deltaAbs, maxDoubledDelta );\n\t\tconst doubleSegment = deltaAbs === 0 ? 0 : deltaToDouble / deltaAbs;\n\t\tconst singleSegment = 1 - doubleSegment;\n\n\t\tsetResizeRatio( singleSegment + doubleSegment * 2 );\n\n\t\tconst updatedWidth = startingWidth + delta.width;\n\n\t\tsetIsOversized( updatedWidth > initialComputedWidthRef.current );\n\n\t\t// Width will be controlled by the library (via `resizeRatio`),\n\t\t// so we only need to update the height.\n\t\tsetFrameSize( {\n\t\t\theight: isOversized\n\t\t\t\t? '100%'\n\t\t\t\t: calculateNewHeight(\n\t\t\t\t\t\tupdatedWidth,\n\t\t\t\t\t\tinitialAspectRatioRef.current\n\t\t\t\t ),\n\t\t} );\n\t};\n\n\tconst handleResizeStop = ( _event, _direction, ref ) => {\n\t\tsetIsResizing( false );\n\n\t\tif ( ! isOversized ) {\n\t\t\treturn;\n\t\t}\n\n\t\tsetIsOversized( false );\n\n\t\tconst remainingWidth =\n\t\t\tref.ownerDocument.documentElement.offsetWidth - ref.offsetWidth;\n\n\t\tif ( remainingWidth > SNAP_TO_EDIT_CANVAS_MODE_THRESHOLD ) {\n\t\t\t// Reset the initial aspect ratio if the frame is resized slightly\n\t\t\t// above the sidebar but not far enough to trigger full screen.\n\t\t\tsetFrameSize( { width: '100%', height: '100%' } );\n\t\t} else {\n\t\t\t// Trigger full screen if the frame is resized far enough to the left.\n\t\t\tsetCanvasMode( 'edit' );\n\t\t}\n\t};\n\n\tconst frameAnimationVariants = {\n\t\tdefault: {\n\t\t\tflexGrow: 0,\n\t\t\theight: frameSize.height,\n\t\t},\n\t\tfullWidth: {\n\t\t\tflexGrow: 1,\n\t\t\theight: frameSize.height,\n\t\t},\n\t};\n\n\treturn (\n\t\t<ResizableBox\n\t\t\tas={ motion.div }\n\t\t\tref={ frameRef }\n\t\t\tinitial={ false }\n\t\t\tvariants={ frameAnimationVariants }\n\t\t\tanimate={ isFullWidth ? 'fullWidth' : 'default' }\n\t\t\tonAnimationComplete={ ( definition ) => {\n\t\t\t\tif ( definition === 'fullWidth' )\n\t\t\t\t\tsetFrameSize( { width: '100%', height: '100%' } );\n\t\t\t} }\n\t\t\ttransition={ FRAME_TRANSITION }\n\t\t\tsize={ frameSize }\n\t\t\tenable={ {\n\t\t\t\ttop: false,\n\t\t\t\tright: false,\n\t\t\t\tbottom: false,\n\t\t\t\t// Resizing will be disabled until the editor content is loaded.\n\t\t\t\tleft: isReady,\n\t\t\t\ttopRight: false,\n\t\t\t\tbottomRight: false,\n\t\t\t\tbottomLeft: false,\n\t\t\t\ttopLeft: false,\n\t\t\t} }\n\t\t\tresizeRatio={ resizeRatio }\n\t\t\thandleClasses={ undefined }\n\t\t\thandleStyles={ {\n\t\t\t\tleft: HANDLE_STYLES_OVERRIDE,\n\t\t\t\tright: HANDLE_STYLES_OVERRIDE,\n\t\t\t} }\n\t\t\tminWidth={ FRAME_MIN_WIDTH }\n\t\t\tmaxWidth={ isFullWidth ? '100%' : '150%' }\n\t\t\tmaxHeight={ '100%' }\n\t\t\tonMouseOver={ () => setIsHovering( true ) }\n\t\t\tonMouseOut={ () => setIsHovering( false ) }\n\t\t\thandleComponent={ {\n\t\t\t\tleft:\n\t\t\t\t\tisHovering || isResizing ? (\n\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\tkey=\"handle\"\n\t\t\t\t\t\t\tclassName=\"edit-site-resizable-frame__handle\"\n\t\t\t\t\t\t\ttitle=\"Drag to resize\"\n\t\t\t\t\t\t\tinitial={ {\n\t\t\t\t\t\t\t\topacity: 0,\n\t\t\t\t\t\t\t\tleft: 0,\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tanimate={ {\n\t\t\t\t\t\t\t\topacity: 1,\n\t\t\t\t\t\t\t\tleft: -15,\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\texit={ {\n\t\t\t\t\t\t\t\topacity: 0,\n\t\t\t\t\t\t\t\tleft: 0,\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\twhileHover={ { scale: 1.1 } }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) : null,\n\t\t\t} }\n\t\t\tonResizeStart={ handleResizeStart }\n\t\t\tonResize={ handleResize }\n\t\t\tonResizeStop={ handleResizeStop }\n\t\t\tclassName={ classnames( 'edit-site-resizable-frame__inner', {\n\t\t\t\t'is-resizing': isResizing,\n\t\t\t\t[ oversizedClassName ]: isOversized,\n\t\t\t} ) }\n\t\t>\n\t\t\t<motion.div\n\t\t\t\tclassName=\"edit-site-resizable-frame__inner-content\"\n\t\t\t\tanimate={ {\n\t\t\t\t\tborderRadius: isFullWidth ? 0 : 8,\n\t\t\t\t} }\n\t\t\t\ttransition={ FRAME_TRANSITION }\n\t\t\t>\n\t\t\t\t{ children }\n\t\t\t</motion.div>\n\t\t</ResizableBox>\n\t);\n}\n\nexport default ResizableFrame;\n"]}
|
|
@@ -54,7 +54,8 @@ function Revisions(_ref) {
|
|
|
54
54
|
return createElement(EditorCanvasContainer, {
|
|
55
55
|
title: __('Revisions'),
|
|
56
56
|
onClose: onClose,
|
|
57
|
-
closeButtonLabel: __('Close revisions')
|
|
57
|
+
closeButtonLabel: __('Close revisions'),
|
|
58
|
+
enableResizing: true
|
|
58
59
|
}, createElement(Iframe, {
|
|
59
60
|
className: "edit-site-revisions__iframe",
|
|
60
61
|
name: "revisions",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/revisions/index.js"],"names":["isEmpty","Disabled","__","BlockList","privateApis","blockEditorPrivateApis","store","blockEditorStore","__unstableEditorStyles","EditorStyles","__unstableIframe","Iframe","useSelect","useMemo","coreStore","unlock","mergeBaseAndUserConfigs","EditorCanvasContainer","ExperimentalBlockEditorProvider","useGlobalStylesOutputWithConfig","Revisions","onClose","userConfig","blocks","baseConfig","select","__experimentalGetCurrentThemeBaseGlobalStyles","mergedConfig","renderedBlocksArray","Array","isArray","originalSettings","getSettings","settings","__unstableIsPreviewMode","globalStyles","editorStyles","styles"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,OAAT,QAAwB,QAAxB;AAEA;AACA;AACA;;A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F,CAFkC,CAAnC;AAKA,QAAMQ,gBAAgB,GAAGnB,SAAS,CAC/Ba,MAAF,IAAcA,MAAM,CAAElB,gBAAF,CAAN,CAA2ByB,WAA3B,EADmB,EAEjC,EAFiC,CAAlC;AAIA,QAAMC,QAAQ,GAAGpB,OAAO,CACvB,OAAQ,EAAE,GAAGkB,gBAAL;AAAuBG,IAAAA,uBAAuB,EAAE;AAAhD,GAAR,CADuB,EAEvB,CAAEH,gBAAF,CAFuB,CAAxB;AAKA,QAAM,CAAEI,YAAF,IAAmBhB,+BAA+B,CAAEQ,YAAF,CAAxD;AAEA,QAAMS,YAAY,GACjB,CAAEpC,OAAO,CAAEmC,YAAF,CAAT,IAA6B,CAAEnC,OAAO,CAAEsB,UAAF,CAAtC,GACGa,YADH,GAEGF,QAAQ,CAACI,MAHb;AAKA,SACC,cAAC,qBAAD;AACC,IAAA,KAAK,EAAGnC,EAAE,CAAE,WAAF,CADX;AAEC,IAAA,OAAO,EAAGmB,OAFX;AAGC,IAAA,gBAAgB,EAAGnB,EAAE,CAAE,iBAAF;
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/revisions/index.js"],"names":["isEmpty","Disabled","__","BlockList","privateApis","blockEditorPrivateApis","store","blockEditorStore","__unstableEditorStyles","EditorStyles","__unstableIframe","Iframe","useSelect","useMemo","coreStore","unlock","mergeBaseAndUserConfigs","EditorCanvasContainer","ExperimentalBlockEditorProvider","useGlobalStylesOutputWithConfig","Revisions","onClose","userConfig","blocks","baseConfig","select","__experimentalGetCurrentThemeBaseGlobalStyles","mergedConfig","renderedBlocksArray","Array","isArray","originalSettings","getSettings","settings","__unstableIsPreviewMode","globalStyles","editorStyles","styles"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,OAAT,QAAwB,QAAxB;AAEA;AACA;AACA;;AACA,SAASC,QAAT,QAAyB,uBAAzB;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SACCC,SADD,EAECC,WAAW,IAAIC,sBAFhB,EA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ByB,WAA3B,EADmB,EAEjC,EAFiC,CAAlC;AAIA,QAAMC,QAAQ,GAAGpB,OAAO,CACvB,OAAQ,EAAE,GAAGkB,gBAAL;AAAuBG,IAAAA,uBAAuB,EAAE;AAAhD,GAAR,CADuB,EAEvB,CAAEH,gBAAF,CAFuB,CAAxB;AAKA,QAAM,CAAEI,YAAF,IAAmBhB,+BAA+B,CAAEQ,YAAF,CAAxD;AAEA,QAAMS,YAAY,GACjB,CAAEpC,OAAO,CAAEmC,YAAF,CAAT,IAA6B,CAAEnC,OAAO,CAAEsB,UAAF,CAAtC,GACGa,YADH,GAEGF,QAAQ,CAACI,MAHb;AAKA,SACC,cAAC,qBAAD;AACC,IAAA,KAAK,EAAGnC,EAAE,CAAE,WAAF,CADX;AAEC,IAAA,OAAO,EAAGmB,OAFX;AAGC,IAAA,gBAAgB,EAAGnB,EAAE,CAAE,iBAAF,CAHtB;AAIC,IAAA,cAAc,EAAG;AAJlB,KAMC,cAAC,MAAD;AACC,IAAA,SAAS,EAAC,6BADX;AAEC,IAAA,IAAI,EAAC,WAFN;AAGC,IAAA,QAAQ,EAAG;AAHZ,KAKC,cAAC,YAAD;AAAc,IAAA,MAAM,EAAGkC;AAAvB,IALD,EAMC,6BAEE;AACA;AACC,0FAJH,CAND,EAaC,cAAC,QAAD;AAAU,IAAA,SAAS,EAAC;AAApB,KACC,cAAC,+BAAD;AACC,IAAA,KAAK,EAAGR,mBADT;AAEC,IAAA,QAAQ,EAAGK;AAFZ,KAIC,cAAC,SAAD;AAAW,IAAA,cAAc,EAAG;AAA5B,IAJD,CADD,CAbD,CAND,CADD;AA+BA;;AAED,eAAeb,SAAf","sourcesContent":["/**\n * External dependencies\n */\nimport { isEmpty } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { Disabled } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tBlockList,\n\tprivateApis as blockEditorPrivateApis,\n\tstore as blockEditorStore,\n\t__unstableEditorStyles as EditorStyles,\n\t__unstableIframe as Iframe,\n} from '@wordpress/block-editor';\nimport { useSelect } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\n\nimport { unlock } from '../../private-apis';\nimport { mergeBaseAndUserConfigs } from '../global-styles/global-styles-provider';\nimport EditorCanvasContainer from '../editor-canvas-container';\n\nconst { ExperimentalBlockEditorProvider, useGlobalStylesOutputWithConfig } =\n\tunlock( blockEditorPrivateApis );\n\nfunction Revisions( { onClose, userConfig, blocks } ) {\n\tconst { baseConfig } = useSelect(\n\t\t( select ) => ( {\n\t\t\tbaseConfig:\n\t\t\t\tselect(\n\t\t\t\t\tcoreStore\n\t\t\t\t).__experimentalGetCurrentThemeBaseGlobalStyles(),\n\t\t} ),\n\t\t[]\n\t);\n\n\tconst mergedConfig = useMemo( () => {\n\t\tif ( ! isEmpty( userConfig ) && ! isEmpty( baseConfig ) ) {\n\t\t\treturn mergeBaseAndUserConfigs( baseConfig, userConfig );\n\t\t}\n\t\treturn {};\n\t}, [ baseConfig, userConfig ] );\n\n\tconst renderedBlocksArray = useMemo(\n\t\t() => ( Array.isArray( blocks ) ? blocks : [ blocks ] ),\n\t\t[ blocks ]\n\t);\n\n\tconst originalSettings = useSelect(\n\t\t( select ) => select( blockEditorStore ).getSettings(),\n\t\t[]\n\t);\n\tconst settings = useMemo(\n\t\t() => ( { ...originalSettings, __unstableIsPreviewMode: true } ),\n\t\t[ originalSettings ]\n\t);\n\n\tconst [ globalStyles ] = useGlobalStylesOutputWithConfig( mergedConfig );\n\n\tconst editorStyles =\n\t\t! isEmpty( globalStyles ) && ! isEmpty( userConfig )\n\t\t\t? globalStyles\n\t\t\t: settings.styles;\n\n\treturn (\n\t\t<EditorCanvasContainer\n\t\t\ttitle={ __( 'Revisions' ) }\n\t\t\tonClose={ onClose }\n\t\t\tcloseButtonLabel={ __( 'Close revisions' ) }\n\t\t\tenableResizing={ true }\n\t\t>\n\t\t\t<Iframe\n\t\t\t\tclassName=\"edit-site-revisions__iframe\"\n\t\t\t\tname=\"revisions\"\n\t\t\t\ttabIndex={ 0 }\n\t\t\t>\n\t\t\t\t<EditorStyles styles={ editorStyles } />\n\t\t\t\t<style>\n\t\t\t\t\t{\n\t\t\t\t\t\t// Forming a \"block formatting context\" to prevent margin collapsing.\n\t\t\t\t\t\t// @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context\n\t\t\t\t\t\t`.is-root-container { display: flow-root; } body { position: relative; padding: 32px; }`\n\t\t\t\t\t}\n\t\t\t\t</style>\n\t\t\t\t<Disabled className=\"edit-site-revisions__example-preview__content\">\n\t\t\t\t\t<ExperimentalBlockEditorProvider\n\t\t\t\t\t\tvalue={ renderedBlocksArray }\n\t\t\t\t\t\tsettings={ settings }\n\t\t\t\t\t>\n\t\t\t\t\t\t<BlockList renderAppender={ false } />\n\t\t\t\t\t</ExperimentalBlockEditorProvider>\n\t\t\t\t</Disabled>\n\t\t\t</Iframe>\n\t\t</EditorCanvasContainer>\n\t);\n}\n\nexport default Revisions;\n"]}
|
|
@@ -16,6 +16,9 @@ import { ESCAPE } from '@wordpress/keycodes';
|
|
|
16
16
|
|
|
17
17
|
import { store as editSiteStore } from '../../store';
|
|
18
18
|
import { unlock } from '../../private-apis';
|
|
19
|
+
const {
|
|
20
|
+
PrivateListView
|
|
21
|
+
} = unlock(blockEditorPrivateApis);
|
|
19
22
|
export default function ListViewSidebar() {
|
|
20
23
|
const {
|
|
21
24
|
setIsListViewOpened
|
|
@@ -30,9 +33,6 @@ export default function ListViewSidebar() {
|
|
|
30
33
|
}
|
|
31
34
|
}
|
|
32
35
|
|
|
33
|
-
const {
|
|
34
|
-
PrivateListView
|
|
35
|
-
} = unlock(blockEditorPrivateApis);
|
|
36
36
|
return (// eslint-disable-next-line jsx-a11y/no-static-element-interactions
|
|
37
37
|
createElement("div", {
|
|
38
38
|
className: "edit-site-editor__list-view-panel",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/secondary-sidebar/list-view-sidebar.js"],"names":["privateApis","blockEditorPrivateApis","Button","useFocusOnMount","useFocusReturn","useMergeRefs","useDispatch","__","closeSmall","ESCAPE","store","editSiteStore","unlock","ListViewSidebar","setIsListViewOpened","focusOnMountRef","headerFocusReturnRef","contentFocusReturnRef","closeOnEscape","event","keyCode","defaultPrevented"
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/secondary-sidebar/list-view-sidebar.js"],"names":["privateApis","blockEditorPrivateApis","Button","useFocusOnMount","useFocusReturn","useMergeRefs","useDispatch","__","closeSmall","ESCAPE","store","editSiteStore","unlock","PrivateListView","ListViewSidebar","setIsListViewOpened","focusOnMountRef","headerFocusReturnRef","contentFocusReturnRef","closeOnEscape","event","keyCode","defaultPrevented"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,WAAW,IAAIC,sBAAxB,QAAsD,yBAAtD;AACA,SAASC,MAAT,QAAuB,uBAAvB;AACA,SACCC,eADD,EAECC,cAFD,EAGCC,YAHD,QAIO,oBAJP;AAKA,SAASC,WAAT,QAA4B,iBAA5B;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,UAAT,QAA2B,kBAA3B;AACA,SAASC,MAAT,QAAuB,qBAAvB;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,aAAlB,QAAuC,aAAvC;AACA,SAASC,MAAT,QAAuB,oBAAvB;AAEA,MAAM;AAAEC,EAAAA;AAAF,IAAsBD,MAAM,CAAEX,sBAAF,CAAlC;AAEA,eAAe,SAASa,eAAT,GAA2B;AACzC,QAAM;AAAEC,IAAAA;AAAF,MAA0BT,WAAW,CAAEK,aAAF,CAA3C;AAEA,QAAMK,eAAe,GAAGb,eAAe,CAAE,cAAF,CAAvC;AACA,QAAMc,oBAAoB,GAAGb,cAAc,EAA3C;AACA,QAAMc,qBAAqB,GAAGd,cAAc,EAA5C;;AACA,WAASe,aAAT,CAAwBC,KAAxB,EAAgC;AAC/B,QAAKA,KAAK,CAACC,OAAN,KAAkBZ,MAAlB,IAA4B,CAAEW,KAAK,CAACE,gBAAzC,EAA4D;AAC3DP,MAAAA,mBAAmB,CAAE,KAAF,CAAnB;AACA;AACD;;AAED,SACC;AACA;AACC,MAAA,SAAS,EAAC,mCADX;AAEC,MAAA,SAAS,EAAGI;AAFb,OAIC;AACC,MAAA,SAAS,EAAC,0CADX;AAEC,MAAA,GAAG,EAAGF;AAFP,OAIC,8BAAUV,EAAE,CAAE,WAAF,CAAZ,CAJD,EAKC,cAAC,MAAD;AACC,MAAA,IAAI,EAAGC,UADR;AAEC,MAAA,KAAK,EAAGD,EAAE,CAAE,OAAF,CAFX;AAGC,MAAA,OAAO,EAAG,MAAMQ,mBAAmB,CAAE,KAAF;AAHpC,MALD,CAJD,EAeC;AACC,MAAA,SAAS,EAAC,2CADX;AAEC,MAAA,GAAG,EAAGV,YAAY,CAAE,CACnBa,qBADmB,EAEnBF,eAFmB,CAAF;AAFnB,OAOC,cAAC,eAAD,OAPD,CAfD;AAFD;AA4BA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\nimport { Button } from '@wordpress/components';\nimport {\n\tuseFocusOnMount,\n\tuseFocusReturn,\n\tuseMergeRefs,\n} from '@wordpress/compose';\nimport { useDispatch } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { closeSmall } from '@wordpress/icons';\nimport { ESCAPE } from '@wordpress/keycodes';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport { unlock } from '../../private-apis';\n\nconst { PrivateListView } = unlock( blockEditorPrivateApis );\n\nexport default function ListViewSidebar() {\n\tconst { setIsListViewOpened } = useDispatch( editSiteStore );\n\n\tconst focusOnMountRef = useFocusOnMount( 'firstElement' );\n\tconst headerFocusReturnRef = useFocusReturn();\n\tconst contentFocusReturnRef = useFocusReturn();\n\tfunction closeOnEscape( event ) {\n\t\tif ( event.keyCode === ESCAPE && ! event.defaultPrevented ) {\n\t\t\tsetIsListViewOpened( false );\n\t\t}\n\t}\n\n\treturn (\n\t\t// eslint-disable-next-line jsx-a11y/no-static-element-interactions\n\t\t<div\n\t\t\tclassName=\"edit-site-editor__list-view-panel\"\n\t\t\tonKeyDown={ closeOnEscape }\n\t\t>\n\t\t\t<div\n\t\t\t\tclassName=\"edit-site-editor__list-view-panel-header\"\n\t\t\t\tref={ headerFocusReturnRef }\n\t\t\t>\n\t\t\t\t<strong>{ __( 'List View' ) }</strong>\n\t\t\t\t<Button\n\t\t\t\t\ticon={ closeSmall }\n\t\t\t\t\tlabel={ __( 'Close' ) }\n\t\t\t\t\tonClick={ () => setIsListViewOpened( false ) }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t\t<div\n\t\t\t\tclassName=\"edit-site-editor__list-view-panel-content\"\n\t\t\t\tref={ useMergeRefs( [\n\t\t\t\t\tcontentFocusReturnRef,\n\t\t\t\t\tfocusOnMountRef,\n\t\t\t\t] ) }\n\t\t\t>\n\t\t\t\t<PrivateListView />\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n"]}
|
|
@@ -15,10 +15,10 @@ import SidebarNavigationScreenTemplates from '../sidebar-navigation-screen-templ
|
|
|
15
15
|
import SidebarNavigationScreenTemplate from '../sidebar-navigation-screen-template';
|
|
16
16
|
import useSyncPathWithURL, { getPathFromURL } from '../sync-state-with-url/use-sync-path-with-url';
|
|
17
17
|
import SidebarNavigationScreenNavigationMenus from '../sidebar-navigation-screen-navigation-menus';
|
|
18
|
+
import SidebarNavigationScreenNavigationMenu from '../sidebar-navigation-screen-navigation-menu';
|
|
18
19
|
import SidebarNavigationScreenGlobalStyles from '../sidebar-navigation-screen-global-styles';
|
|
19
20
|
import SidebarNavigationScreenTemplatesBrowse from '../sidebar-navigation-screen-templates-browse';
|
|
20
21
|
import SaveHub from '../save-hub';
|
|
21
|
-
import SidebarNavigationScreenNavigationItem from '../sidebar-navigation-screen-navigation-item';
|
|
22
22
|
import { unlock } from '../../private-apis';
|
|
23
23
|
import SidebarNavigationScreenPages from '../sidebar-navigation-screen-pages';
|
|
24
24
|
import SidebarNavigationScreenPage from '../sidebar-navigation-screen-page';
|
|
@@ -33,10 +33,10 @@ function SidebarScreens() {
|
|
|
33
33
|
}, createElement(SidebarNavigationScreenMain, null)), createElement(NavigatorScreen, {
|
|
34
34
|
path: "/navigation"
|
|
35
35
|
}, createElement(SidebarNavigationScreenNavigationMenus, null)), createElement(NavigatorScreen, {
|
|
36
|
+
path: "/navigation/:postType/:postId"
|
|
37
|
+
}, createElement(SidebarNavigationScreenNavigationMenu, null)), createElement(NavigatorScreen, {
|
|
36
38
|
path: "/wp_global_styles"
|
|
37
39
|
}, createElement(SidebarNavigationScreenGlobalStyles, null)), createElement(NavigatorScreen, {
|
|
38
|
-
path: "/navigation/:postType/:postId"
|
|
39
|
-
}, createElement(SidebarNavigationScreenNavigationItem, null)), createElement(NavigatorScreen, {
|
|
40
40
|
path: "/page"
|
|
41
41
|
}, createElement(SidebarNavigationScreenPages, null)), createElement(NavigatorScreen, {
|
|
42
42
|
path: "/page/:postId"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar/index.js"],"names":["memo","useRef","__experimentalNavigatorProvider","NavigatorProvider","__experimentalNavigatorScreen","NavigatorScreen","privateApis","routerPrivateApis","SidebarNavigationScreenMain","SidebarNavigationScreenTemplates","SidebarNavigationScreenTemplate","useSyncPathWithURL","getPathFromURL","SidebarNavigationScreenNavigationMenus","SidebarNavigationScreenGlobalStyles","SidebarNavigationScreenTemplatesBrowse","SaveHub","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar/index.js"],"names":["memo","useRef","__experimentalNavigatorProvider","NavigatorProvider","__experimentalNavigatorScreen","NavigatorScreen","privateApis","routerPrivateApis","SidebarNavigationScreenMain","SidebarNavigationScreenTemplates","SidebarNavigationScreenTemplate","useSyncPathWithURL","getPathFromURL","SidebarNavigationScreenNavigationMenus","SidebarNavigationScreenNavigationMenu","SidebarNavigationScreenGlobalStyles","SidebarNavigationScreenTemplatesBrowse","SaveHub","unlock","SidebarNavigationScreenPages","SidebarNavigationScreenPage","useLocation","SidebarScreens","Sidebar","params","urlParams","initialPath","current"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,IAAT,EAAeC,MAAf,QAA6B,oBAA7B;AACA,SACCC,+BAA+B,IAAIC,iBADpC,EAECC,6BAA6B,IAAIC,eAFlC,QAGO,uBAHP;AAIA,SAASC,WAAW,IAAIC,iBAAxB,QAAiD,mBAAjD;AAEA;AACA;AACA;;AACA,OAAOC,2BAAP,MAAwC,mCAAxC;AACA,OAAOC,gCAAP,MAA6C,wCAA7C;AACA,OAAOC,+BAAP,MAA4C,uCAA5C;AACA,OAAOC,kBAAP,IACCC,cADD,QAEO,+CAFP;AAGA,OAAOC,sCAAP,MAAmD,+CAAnD;AACA,OAAOC,qCAAP,MAAkD,8CAAlD;AACA,OAAOC,mCAAP,MAAgD,4CAAhD;AACA,OAAOC,sCAAP,MAAmD,+CAAnD;AACA,OAAOC,OAAP,MAAoB,aAApB;AACA,SAASC,MAAT,QAAuB,oBAAvB;AACA,OAAOC,4BAAP,MAAyC,oCAAzC;AACA,OAAOC,2BAAP,MAAwC,mCAAxC;AAEA,MAAM;AAAEC,EAAAA;AAAF,IAAkBH,MAAM,CAAEX,iBAAF,CAA9B;;AAEA,SAASe,cAAT,GAA0B;AACzBX,EAAAA,kBAAkB;AAElB,SACC,8BACC,cAAC,eAAD;AAAiB,IAAA,IAAI,EAAC;AAAtB,KACC,cAAC,2BAAD,OADD,CADD,EAIC,cAAC,eAAD;AAAiB,IAAA,IAAI,EAAC;AAAtB,KACC,cAAC,sCAAD,OADD,CAJD,EAOC,cAAC,eAAD;AAAiB,IAAA,IAAI,EAAC;AAAtB,KACC,cAAC,qCAAD,OADD,CAPD,EAUC,cAAC,eAAD;AAAiB,IAAA,IAAI,EAAC;AAAtB,KACC,cAAC,mCAAD,OADD,CAVD,EAaC,cAAC,eAAD;AAAiB,IAAA,IAAI,EAAC;AAAtB,KACC,cAAC,4BAAD,OADD,CAbD,EAgBC,cAAC,eAAD;AAAiB,IAAA,IAAI,EAAC;AAAtB,KACC,cAAC,2BAAD,OADD,CAhBD,EAmBC,cAAC,eAAD;AAAiB,IAAA,IAAI,EAAC;AAAtB,KACC,cAAC,gCAAD,OADD,CAnBD,EAsBC,cAAC,eAAD;AAAiB,IAAA,IAAI,EAAC;AAAtB,KACC,cAAC,sCAAD,OADD,CAtBD,EAyBC,cAAC,eAAD;AAAiB,IAAA,IAAI,EAAC;AAAtB,KACC,cAAC,+BAAD,OADD,CAzBD,CADD;AA+BA;;AAED,SAASY,OAAT,GAAmB;AAClB,QAAM;AAAEC,IAAAA,MAAM,EAAEC;AAAV,MAAwBJ,WAAW,EAAzC;AACA,QAAMK,WAAW,GAAGzB,MAAM,CAAEW,cAAc,CAAEa,SAAF,CAAhB,CAA1B;AAEA,SACC,8BACC,cAAC,iBAAD;AACC,IAAA,SAAS,EAAC,4BADX;AAEC,IAAA,WAAW,EAAGC,WAAW,CAACC;AAF3B,KAIC,cAAC,cAAD,OAJD,CADD,EAOC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,cAAC,OAAD,OADD,CAPD,CADD;AAaA;;AAED,eAAe3B,IAAI,CAAEuB,OAAF,CAAnB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { memo, useRef } from '@wordpress/element';\nimport {\n\t__experimentalNavigatorProvider as NavigatorProvider,\n\t__experimentalNavigatorScreen as NavigatorScreen,\n} from '@wordpress/components';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreenMain from '../sidebar-navigation-screen-main';\nimport SidebarNavigationScreenTemplates from '../sidebar-navigation-screen-templates';\nimport SidebarNavigationScreenTemplate from '../sidebar-navigation-screen-template';\nimport useSyncPathWithURL, {\n\tgetPathFromURL,\n} from '../sync-state-with-url/use-sync-path-with-url';\nimport SidebarNavigationScreenNavigationMenus from '../sidebar-navigation-screen-navigation-menus';\nimport SidebarNavigationScreenNavigationMenu from '../sidebar-navigation-screen-navigation-menu';\nimport SidebarNavigationScreenGlobalStyles from '../sidebar-navigation-screen-global-styles';\nimport SidebarNavigationScreenTemplatesBrowse from '../sidebar-navigation-screen-templates-browse';\nimport SaveHub from '../save-hub';\nimport { unlock } from '../../private-apis';\nimport SidebarNavigationScreenPages from '../sidebar-navigation-screen-pages';\nimport SidebarNavigationScreenPage from '../sidebar-navigation-screen-page';\n\nconst { useLocation } = unlock( routerPrivateApis );\n\nfunction SidebarScreens() {\n\tuseSyncPathWithURL();\n\n\treturn (\n\t\t<>\n\t\t\t<NavigatorScreen path=\"/\">\n\t\t\t\t<SidebarNavigationScreenMain />\n\t\t\t</NavigatorScreen>\n\t\t\t<NavigatorScreen path=\"/navigation\">\n\t\t\t\t<SidebarNavigationScreenNavigationMenus />\n\t\t\t</NavigatorScreen>\n\t\t\t<NavigatorScreen path=\"/navigation/:postType/:postId\">\n\t\t\t\t<SidebarNavigationScreenNavigationMenu />\n\t\t\t</NavigatorScreen>\n\t\t\t<NavigatorScreen path=\"/wp_global_styles\">\n\t\t\t\t<SidebarNavigationScreenGlobalStyles />\n\t\t\t</NavigatorScreen>\n\t\t\t<NavigatorScreen path=\"/page\">\n\t\t\t\t<SidebarNavigationScreenPages />\n\t\t\t</NavigatorScreen>\n\t\t\t<NavigatorScreen path=\"/page/:postId\">\n\t\t\t\t<SidebarNavigationScreenPage />\n\t\t\t</NavigatorScreen>\n\t\t\t<NavigatorScreen path=\"/:postType(wp_template|wp_template_part)\">\n\t\t\t\t<SidebarNavigationScreenTemplates />\n\t\t\t</NavigatorScreen>\n\t\t\t<NavigatorScreen path=\"/:postType(wp_template|wp_template_part)/all\">\n\t\t\t\t<SidebarNavigationScreenTemplatesBrowse />\n\t\t\t</NavigatorScreen>\n\t\t\t<NavigatorScreen path=\"/:postType(wp_template|wp_template_part)/:postId\">\n\t\t\t\t<SidebarNavigationScreenTemplate />\n\t\t\t</NavigatorScreen>\n\t\t</>\n\t);\n}\n\nfunction Sidebar() {\n\tconst { params: urlParams } = useLocation();\n\tconst initialPath = useRef( getPathFromURL( urlParams ) );\n\n\treturn (\n\t\t<>\n\t\t\t<NavigatorProvider\n\t\t\t\tclassName=\"edit-site-sidebar__content\"\n\t\t\t\tinitialPath={ initialPath.current }\n\t\t\t>\n\t\t\t\t<SidebarScreens />\n\t\t\t</NavigatorProvider>\n\t\t\t<div className=\"edit-site-sidebar__footer\">\n\t\t\t\t<SaveHub />\n\t\t\t</div>\n\t\t</>\n\t);\n}\n\nexport default memo( Sidebar );\n"]}
|
|
@@ -21,7 +21,7 @@ const useRevisionData = () => {
|
|
|
21
21
|
record: currentTemplate
|
|
22
22
|
} = useEditedEntityRecord();
|
|
23
23
|
const lastRevisionId = (_currentTemplate$_lin = currentTemplate === null || currentTemplate === void 0 ? void 0 : (_currentTemplate$_lin2 = currentTemplate._links) === null || _currentTemplate$_lin2 === void 0 ? void 0 : (_currentTemplate$_lin3 = _currentTemplate$_lin2['predecessor-version']) === null || _currentTemplate$_lin3 === void 0 ? void 0 : (_currentTemplate$_lin4 = _currentTemplate$_lin3[0]) === null || _currentTemplate$_lin4 === void 0 ? void 0 : _currentTemplate$_lin4.id) !== null && _currentTemplate$_lin !== void 0 ? _currentTemplate$_lin : null;
|
|
24
|
-
const revisionsCount = (
|
|
24
|
+
const revisionsCount = (_currentTemplate$_lin5 = currentTemplate === null || currentTemplate === void 0 ? void 0 : (_currentTemplate$_lin6 = currentTemplate._links) === null || _currentTemplate$_lin6 === void 0 ? void 0 : (_currentTemplate$_lin7 = _currentTemplate$_lin6['version-history']) === null || _currentTemplate$_lin7 === void 0 ? void 0 : (_currentTemplate$_lin8 = _currentTemplate$_lin7[0]) === null || _currentTemplate$_lin8 === void 0 ? void 0 : _currentTemplate$_lin8.count) !== null && _currentTemplate$_lin5 !== void 0 ? _currentTemplate$_lin5 : 0;
|
|
25
25
|
return {
|
|
26
26
|
currentTemplate,
|
|
27
27
|
lastRevisionId,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-edit-mode/template-revisions/index.js"],"names":["Button","sprintf","_n","backup","addQueryArgs","PostTypeSupportCheck","useEditedEntityRecord","useRevisionData","record","currentTemplate","lastRevisionId","_links","id","revisionsCount","count","PostLastRevisionCheck","children","PostLastRevision","revision","gutenberg","LastRevision"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,MAAT,QAAuB,uBAAvB;AACA,SAASC,OAAT,EAAkBC,EAAlB,QAA4B,iBAA5B;AACA,SAASC,MAAT,QAAuB,kBAAvB;AACA,SAASC,YAAT,QAA6B,gBAA7B;AACA,SAASC,oBAAT,QAAqC,mBAArC;AAEA;AACA;AACA;;AACA,OAAOC,qBAAP,MAAkC,gCAAlC;;AAEA,MAAMC,eAAe,GAAG,MAAM;AAAA;;AAC7B,QAAM;AAAEC,IAAAA,MAAM,EAAEC;AAAV,MAA8BH,qBAAqB,EAAzD;AAEA,QAAMI,cAAc,4BACnBD,eADmB,aACnBA,eADmB,iDACnBA,eAAe,CAAEE,MADE,qFACnB,uBAA2B,qBAA3B,CADmB,qFACnB,uBAAsD,CAAtD,CADmB,2DACnB,uBAA2DC,EADxC,yEAC8C,IADlE;AAGA,QAAMC,cAAc,
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-edit-mode/template-revisions/index.js"],"names":["Button","sprintf","_n","backup","addQueryArgs","PostTypeSupportCheck","useEditedEntityRecord","useRevisionData","record","currentTemplate","lastRevisionId","_links","id","revisionsCount","count","PostLastRevisionCheck","children","PostLastRevision","revision","gutenberg","LastRevision"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,MAAT,QAAuB,uBAAvB;AACA,SAASC,OAAT,EAAkBC,EAAlB,QAA4B,iBAA5B;AACA,SAASC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,MAAAA,SAAS,EAAE;AAFyB,KAAlB,CADpB;AAKC,IAAA,SAAS,EAAC,yCALX;AAMC,IAAA,IAAI,EAAGhB;AANR,KAQGF,OAAO;AACR;AACAC,EAAAA,EAAE,CAAE,aAAF,EAAiB,cAAjB,EAAiCW,cAAjC,CAFM,EAGRA,cAHQ,CARV,CADD,CADD;AAkBA,CArBD;;AAuBA,eAAe,SAASO,YAAT,GAAwB;AACtC,SACC,cAAC,qBAAD,QACC,cAAC,gBAAD,OADD,CADD;AAKA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Button } from '@wordpress/components';\nimport { sprintf, _n } from '@wordpress/i18n';\nimport { backup } from '@wordpress/icons';\nimport { addQueryArgs } from '@wordpress/url';\nimport { PostTypeSupportCheck } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport useEditedEntityRecord from '../../use-edited-entity-record';\n\nconst useRevisionData = () => {\n\tconst { record: currentTemplate } = useEditedEntityRecord();\n\n\tconst lastRevisionId =\n\t\tcurrentTemplate?._links?.[ 'predecessor-version' ]?.[ 0 ]?.id ?? null;\n\n\tconst revisionsCount =\n\t\tcurrentTemplate?._links?.[ 'version-history' ]?.[ 0 ]?.count ?? 0;\n\n\treturn {\n\t\tcurrentTemplate,\n\t\tlastRevisionId,\n\t\trevisionsCount,\n\t};\n};\n\nfunction PostLastRevisionCheck( { children } ) {\n\tconst { lastRevisionId, revisionsCount } = useRevisionData();\n\n\tif ( ! lastRevisionId || revisionsCount < 2 ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<PostTypeSupportCheck supportKeys=\"revisions\">\n\t\t\t{ children }\n\t\t</PostTypeSupportCheck>\n\t);\n}\n\nconst PostLastRevision = () => {\n\tconst { lastRevisionId, revisionsCount } = useRevisionData();\n\n\treturn (\n\t\t<PostLastRevisionCheck>\n\t\t\t<Button\n\t\t\t\thref={ addQueryArgs( 'revision.php', {\n\t\t\t\t\trevision: lastRevisionId,\n\t\t\t\t\tgutenberg: true,\n\t\t\t\t} ) }\n\t\t\t\tclassName=\"edit-site-template-last-revision__title\"\n\t\t\t\ticon={ backup }\n\t\t\t>\n\t\t\t\t{ sprintf(\n\t\t\t\t\t/* translators: %d: number of revisions */\n\t\t\t\t\t_n( '%d Revision', '%d Revisions', revisionsCount ),\n\t\t\t\t\trevisionsCount\n\t\t\t\t) }\n\t\t\t</Button>\n\t\t</PostLastRevisionCheck>\n\t);\n};\n\nexport default function LastRevision() {\n\treturn (\n\t\t<PostLastRevisionCheck>\n\t\t\t<PostLastRevision />\n\t\t</PostLastRevisionCheck>\n\t);\n}\n"]}
|
|
@@ -1,11 +1,15 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import { createElement, Fragment } from "@wordpress/element";
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* WordPress dependencies
|
|
5
6
|
*/
|
|
6
7
|
import { __ } from '@wordpress/i18n';
|
|
7
|
-
import { edit } from '@wordpress/icons';
|
|
8
|
-
import { useDispatch } from '@wordpress/data';
|
|
8
|
+
import { edit, seen } from '@wordpress/icons';
|
|
9
|
+
import { useSelect, useDispatch } from '@wordpress/data';
|
|
10
|
+
import { store as coreStore } from '@wordpress/core-data';
|
|
11
|
+
import { __experimentalNavigatorButton as NavigatorButton } from '@wordpress/components';
|
|
12
|
+
import { useViewportMatch } from '@wordpress/compose';
|
|
9
13
|
/**
|
|
10
14
|
* Internal dependencies
|
|
11
15
|
*/
|
|
@@ -15,27 +19,79 @@ import StyleVariationsContainer from '../global-styles/style-variations-containe
|
|
|
15
19
|
import { unlock } from '../../private-apis';
|
|
16
20
|
import { store as editSiteStore } from '../../store';
|
|
17
21
|
import SidebarButton from '../sidebar-button';
|
|
18
|
-
|
|
22
|
+
import SidebarNavigationItem from '../sidebar-navigation-item';
|
|
23
|
+
import StyleBook from '../style-book';
|
|
24
|
+
export function SidebarNavigationItemGlobalStyles(props) {
|
|
19
25
|
const {
|
|
20
26
|
openGeneralSidebar
|
|
21
27
|
} = useDispatch(editSiteStore);
|
|
22
28
|
const {
|
|
23
29
|
setCanvasMode
|
|
24
30
|
} = unlock(useDispatch(editSiteStore));
|
|
25
|
-
|
|
31
|
+
const hasGlobalStyleVariations = useSelect(select => {
|
|
32
|
+
var _select$__experimenta;
|
|
33
|
+
|
|
34
|
+
return !!((_select$__experimenta = select(coreStore).__experimentalGetCurrentThemeGlobalStylesVariations()) !== null && _select$__experimenta !== void 0 && _select$__experimenta.length);
|
|
35
|
+
}, []);
|
|
36
|
+
|
|
37
|
+
if (hasGlobalStyleVariations) {
|
|
38
|
+
return createElement(NavigatorButton, _extends({}, props, {
|
|
39
|
+
as: SidebarNavigationItem,
|
|
40
|
+
path: "/wp_global_styles"
|
|
41
|
+
}));
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return createElement(SidebarNavigationItem, _extends({}, props, {
|
|
45
|
+
onClick: () => {
|
|
46
|
+
// switch to edit mode.
|
|
47
|
+
setCanvasMode('edit'); // open global styles sidebar.
|
|
48
|
+
|
|
49
|
+
openGeneralSidebar('edit-site/global-styles');
|
|
50
|
+
}
|
|
51
|
+
}));
|
|
52
|
+
}
|
|
53
|
+
export default function SidebarNavigationScreenGlobalStyles() {
|
|
54
|
+
const {
|
|
55
|
+
openGeneralSidebar
|
|
56
|
+
} = useDispatch(editSiteStore);
|
|
57
|
+
const isMobileViewport = useViewportMatch('medium', '<');
|
|
58
|
+
const {
|
|
59
|
+
setCanvasMode,
|
|
60
|
+
setEditorCanvasContainerView
|
|
61
|
+
} = unlock(useDispatch(editSiteStore));
|
|
62
|
+
const isStyleBookOpened = useSelect(select => 'style-book' === unlock(select(editSiteStore)).getEditorCanvasContainerView(), []);
|
|
63
|
+
|
|
64
|
+
const openGlobalStyles = async () => Promise.all([setCanvasMode('edit'), openGeneralSidebar('edit-site/global-styles')]);
|
|
65
|
+
|
|
66
|
+
const openStyleBook = async () => {
|
|
67
|
+
await openGlobalStyles(); // Open the Style Book once the canvas mode is set to edit,
|
|
68
|
+
// and the global styles sidebar is open. This ensures that
|
|
69
|
+
// the Style Book is not prematurely closed.
|
|
70
|
+
|
|
71
|
+
setEditorCanvasContainerView('style-book');
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
return createElement(Fragment, null, createElement(SidebarNavigationScreen, {
|
|
26
75
|
title: __('Styles'),
|
|
27
76
|
description: __('Choose a different style combination for the theme styles.'),
|
|
28
77
|
content: createElement(StyleVariationsContainer, null),
|
|
29
|
-
actions: createElement(SidebarButton, {
|
|
78
|
+
actions: createElement("div", null, !isMobileViewport && createElement(SidebarButton, {
|
|
79
|
+
icon: seen,
|
|
80
|
+
label: __('Style Book'),
|
|
81
|
+
onClick: () => setEditorCanvasContainerView(!isStyleBookOpened ? 'style-book' : undefined),
|
|
82
|
+
isPressed: isStyleBookOpened
|
|
83
|
+
}), createElement(SidebarButton, {
|
|
30
84
|
icon: edit,
|
|
31
85
|
label: __('Edit styles'),
|
|
32
|
-
onClick: () =>
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
86
|
+
onClick: async () => await openGlobalStyles()
|
|
87
|
+
}))
|
|
88
|
+
}), isStyleBookOpened && !isMobileViewport && createElement(StyleBook, {
|
|
89
|
+
enableResizing: false,
|
|
90
|
+
isSelected: () => false,
|
|
91
|
+
onClick: openStyleBook,
|
|
92
|
+
onSelect: openStyleBook,
|
|
93
|
+
showCloseButton: false,
|
|
94
|
+
showTabs: false
|
|
95
|
+
}));
|
|
40
96
|
}
|
|
41
97
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-global-styles/index.js"],"names":["__","edit","useDispatch","SidebarNavigationScreen","StyleVariationsContainer","unlock","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-global-styles/index.js"],"names":["__","edit","seen","useSelect","useDispatch","store","coreStore","__experimentalNavigatorButton","NavigatorButton","useViewportMatch","SidebarNavigationScreen","StyleVariationsContainer","unlock","editSiteStore","SidebarButton","SidebarNavigationItem","StyleBook","SidebarNavigationItemGlobalStyles","props","openGeneralSidebar","setCanvasMode","hasGlobalStyleVariations","select","__experimentalGetCurrentThemeGlobalStylesVariations","length","SidebarNavigationScreenGlobalStyles","isMobileViewport","setEditorCanvasContainerView","isStyleBookOpened","getEditorCanvasContainerView","openGlobalStyles","Promise","all","openStyleBook","undefined"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,IAAT,EAAeC,IAAf,QAA2B,kBAA3B;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AACA,SAASC,6BAA6B,IAAIC,eAA1C,QAAiE,uBAAjE;AACA,SAASC,gBAAT,QAAiC,oBAAjC;AAEA;AACA;AACA;;AACA,OAAOC,uBAAP,MAAoC,8BAApC;AACA,OAAOC,wBAAP,MAAqC,6CAArC;AACA,SAASC,MAAT,QAAuB,oBAAvB;AACA,SAASP,KAAK,IAAIQ,aAAlB,QAAuC,aAAvC;AACA,OAAOC,aAAP,MAA0B,mBAA1B;AACA,OAAOC,qBAAP,MAAkC,4BAAlC;AACA,OAAOC,SAAP,MAAsB,eAAtB;AAEA,OAAO,SAASC,iCAAT,CAA4CC,KAA5C,EAAoD;AAC1D,QAAM;AAAEC,IAAAA;AAAF,MAAyBf,WAAW,CAAES,aAAF,CAA1C;AACA,QAAM;AAAEO,IAAAA;AAAF,MAAoBR,MAAM,CAAER,WAAW,CAAES,aAAF,CAAb,CAAhC;AACA,QAAMQ,wBAAwB,GAAGlB,SAAS,CACvCmB,MAAF;AAAA;;AAAA,WACC,CAAC,2BAAEA,MAAM,CACRhB,SADQ,CAAN,CAEDiB,mDAFC,EAAF,kDAAE,sBAEsDC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D,OALX;AAMC,IAAA,OAAO,EACN,2BACG,CAAE0B,gBAAF,IACD,cAAC,aAAD;AACC,MAAA,IAAI,EAAGxB,IADR;AAEC,MAAA,KAAK,EAAGF,EAAE,CAAE,YAAF,CAFX;AAGC,MAAA,OAAO,EAAG,MACT2B,4BAA4B,CAC3B,CAAEC,iBAAF,GACG,YADH,GAEGM,SAHwB,CAJ9B;AAUC,MAAA,SAAS,EAAGN;AAVb,MAFF,EAeC,cAAC,aAAD;AACC,MAAA,IAAI,EAAG3B,IADR;AAEC,MAAA,KAAK,EAAGD,EAAE,CAAE,aAAF,CAFX;AAGC,MAAA,OAAO,EAAG,YAAY,MAAM8B,gBAAgB;AAH7C,MAfD;AAPF,IADD,EA+BGF,iBAAiB,IAAI,CAAEF,gBAAvB,IACD,cAAC,SAAD;AACC,IAAA,cAAc,EAAG,KADlB;AAEC,IAAA,UAAU,EAAG,MAAM,KAFpB;AAGC,IAAA,OAAO,EAAGO,aAHX;AAIC,IAAA,QAAQ,EAAGA,aAJZ;AAKC,IAAA,eAAe,EAAG,KALnB;AAMC,IAAA,QAAQ,EAAG;AANZ,IAhCF,CADD;AA4CA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { edit, seen } from '@wordpress/icons';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __experimentalNavigatorButton as NavigatorButton } from '@wordpress/components';\nimport { useViewportMatch } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport StyleVariationsContainer from '../global-styles/style-variations-container';\nimport { unlock } from '../../private-apis';\nimport { store as editSiteStore } from '../../store';\nimport SidebarButton from '../sidebar-button';\nimport SidebarNavigationItem from '../sidebar-navigation-item';\nimport StyleBook from '../style-book';\n\nexport function SidebarNavigationItemGlobalStyles( props ) {\n\tconst { openGeneralSidebar } = useDispatch( editSiteStore );\n\tconst { setCanvasMode } = unlock( useDispatch( editSiteStore ) );\n\tconst hasGlobalStyleVariations = useSelect(\n\t\t( select ) =>\n\t\t\t!! select(\n\t\t\t\tcoreStore\n\t\t\t).__experimentalGetCurrentThemeGlobalStylesVariations()?.length,\n\t\t[]\n\t);\n\tif ( hasGlobalStyleVariations ) {\n\t\treturn (\n\t\t\t<NavigatorButton\n\t\t\t\t{ ...props }\n\t\t\t\tas={ SidebarNavigationItem }\n\t\t\t\tpath=\"/wp_global_styles\"\n\t\t\t/>\n\t\t);\n\t}\n\treturn (\n\t\t<SidebarNavigationItem\n\t\t\t{ ...props }\n\t\t\tonClick={ () => {\n\t\t\t\t// switch to edit mode.\n\t\t\t\tsetCanvasMode( 'edit' );\n\t\t\t\t// open global styles sidebar.\n\t\t\t\topenGeneralSidebar( 'edit-site/global-styles' );\n\t\t\t} }\n\t\t/>\n\t);\n}\n\nexport default function SidebarNavigationScreenGlobalStyles() {\n\tconst { openGeneralSidebar } = useDispatch( editSiteStore );\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst { setCanvasMode, setEditorCanvasContainerView } = unlock(\n\t\tuseDispatch( editSiteStore )\n\t);\n\n\tconst isStyleBookOpened = useSelect(\n\t\t( select ) =>\n\t\t\t'style-book' ===\n\t\t\tunlock( select( editSiteStore ) ).getEditorCanvasContainerView(),\n\t\t[]\n\t);\n\n\tconst openGlobalStyles = async () =>\n\t\tPromise.all( [\n\t\t\tsetCanvasMode( 'edit' ),\n\t\t\topenGeneralSidebar( 'edit-site/global-styles' ),\n\t\t] );\n\n\tconst openStyleBook = async () => {\n\t\tawait openGlobalStyles();\n\t\t// Open the Style Book once the canvas mode is set to edit,\n\t\t// and the global styles sidebar is open. This ensures that\n\t\t// the Style Book is not prematurely closed.\n\t\tsetEditorCanvasContainerView( 'style-book' );\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<SidebarNavigationScreen\n\t\t\t\ttitle={ __( 'Styles' ) }\n\t\t\t\tdescription={ __(\n\t\t\t\t\t'Choose a different style combination for the theme styles.'\n\t\t\t\t) }\n\t\t\t\tcontent={ <StyleVariationsContainer /> }\n\t\t\t\tactions={\n\t\t\t\t\t<div>\n\t\t\t\t\t\t{ ! isMobileViewport && (\n\t\t\t\t\t\t\t<SidebarButton\n\t\t\t\t\t\t\t\ticon={ seen }\n\t\t\t\t\t\t\t\tlabel={ __( 'Style Book' ) }\n\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\tsetEditorCanvasContainerView(\n\t\t\t\t\t\t\t\t\t\t! isStyleBookOpened\n\t\t\t\t\t\t\t\t\t\t\t? 'style-book'\n\t\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tisPressed={ isStyleBookOpened }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<SidebarButton\n\t\t\t\t\t\t\ticon={ edit }\n\t\t\t\t\t\t\tlabel={ __( 'Edit styles' ) }\n\t\t\t\t\t\t\tonClick={ async () => await openGlobalStyles() }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t}\n\t\t\t/>\n\t\t\t{ isStyleBookOpened && ! isMobileViewport && (\n\t\t\t\t<StyleBook\n\t\t\t\t\tenableResizing={ false }\n\t\t\t\t\tisSelected={ () => false }\n\t\t\t\t\tonClick={ openStyleBook }\n\t\t\t\t\tonSelect={ openStyleBook }\n\t\t\t\t\tshowCloseButton={ false }\n\t\t\t\t\tshowTabs={ false }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"]}
|