@wordpress/edit-site 5.5.0 → 5.7.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 +4 -0
- package/build/components/add-new-template/new-template-part.js +3 -11
- package/build/components/add-new-template/new-template-part.js.map +1 -1
- package/build/components/add-new-template/new-template.js +23 -17
- package/build/components/add-new-template/new-template.js.map +1 -1
- package/build/components/add-new-template/utils.js +1 -1
- package/build/components/add-new-template/utils.js.map +1 -1
- package/build/components/app/index.js +4 -2
- package/build/components/app/index.js.map +1 -1
- package/build/components/block-editor/editor-canvas.js +7 -9
- package/build/components/block-editor/editor-canvas.js.map +1 -1
- package/build/components/editor/index.js +2 -4
- package/build/components/editor/index.js.map +1 -1
- package/build/components/global-styles/border-panel.js +20 -159
- package/build/components/global-styles/border-panel.js.map +1 -1
- package/build/components/global-styles/context-menu.js +4 -6
- package/build/components/global-styles/context-menu.js.map +1 -1
- package/build/components/global-styles/hooks.js +0 -72
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/preview.js +3 -4
- package/build/components/global-styles/preview.js.map +1 -1
- package/build/components/global-styles/screen-block-list.js +5 -7
- package/build/components/global-styles/screen-block-list.js.map +1 -1
- package/build/components/global-styles/screen-border.js +13 -5
- package/build/components/global-styles/screen-border.js.map +1 -1
- package/build/components/global-styles/screen-colors.js +22 -211
- package/build/components/global-styles/screen-colors.js.map +1 -1
- package/build/components/global-styles/screen-root.js +2 -1
- package/build/components/global-styles/screen-root.js.map +1 -1
- package/build/components/global-styles/screen-style-variations.js +2 -1
- package/build/components/global-styles/screen-style-variations.js.map +1 -1
- package/build/components/global-styles/screen-typography-element.js +4 -0
- package/build/components/global-styles/screen-typography-element.js.map +1 -1
- package/build/components/global-styles/screen-typography.js +5 -0
- package/build/components/global-styles/screen-typography.js.map +1 -1
- package/build/components/global-styles/ui.js +5 -35
- package/build/components/global-styles/ui.js.map +1 -1
- package/build/components/global-styles-renderer/index.js +1 -2
- package/build/components/global-styles-renderer/index.js.map +1 -1
- package/build/components/layout/index.js +7 -0
- package/build/components/layout/index.js.map +1 -1
- package/build/components/list/added-by.js +128 -136
- package/build/components/list/added-by.js.map +1 -1
- package/build/components/list/index.js +2 -1
- package/build/components/list/index.js.map +1 -1
- package/build/components/list/table.js +6 -5
- package/build/components/list/table.js.map +1 -1
- package/build/components/routes/link.js +4 -1
- package/build/components/routes/link.js.map +1 -1
- package/build/components/save-button/index.js +2 -5
- package/build/components/save-button/index.js.map +1 -1
- package/build/components/save-hub/index.js +82 -0
- package/build/components/save-hub/index.js.map +1 -0
- package/build/components/secondary-sidebar/list-view-sidebar.js +6 -1
- package/build/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- package/build/components/sidebar/index.js +2 -4
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen/index.js +5 -2
- package/build/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-main/index.js +13 -13
- package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-item/index.js +9 -14
- package/build/components/sidebar-navigation-screen-navigation-item/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js +87 -10
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/loader.js +19 -0
- package/build/components/sidebar-navigation-screen-navigation-menus/loader.js.map +1 -0
- package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +77 -0
- package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -0
- package/build/components/sidebar-navigation-screen-template/index.js +59 -10
- package/build/components/sidebar-navigation-screen-template/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-templates/index.js +5 -2
- package/build/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-templates-browse/index.js +6 -3
- package/build/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
- package/build/components/site-hub/index.js +3 -1
- package/build/components/site-hub/index.js.map +1 -1
- package/build/components/start-template-options/index.js +44 -9
- package/build/components/start-template-options/index.js.map +1 -1
- package/build/components/style-book/index.js +133 -19
- package/build/components/style-book/index.js.map +1 -1
- package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +24 -8
- 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 +9 -7
- package/build/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
- package/build/components/template-details/index.js +0 -3
- package/build/components/template-details/index.js.map +1 -1
- package/build/components/template-part-converter/convert-to-regular.js +8 -12
- package/build/components/template-part-converter/convert-to-regular.js.map +1 -1
- package/build/components/template-part-converter/convert-to-template-part.js +2 -2
- package/build/components/template-part-converter/convert-to-template-part.js.map +1 -1
- package/build/components/template-part-converter/index.js +19 -14
- package/build/components/template-part-converter/index.js.map +1 -1
- package/build/components/use-edited-entity-record/index.js +6 -6
- package/build/components/use-edited-entity-record/index.js.map +1 -1
- package/build/hooks/push-changes-to-global-styles/index.js +1 -0
- package/build/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build/index.js +3 -0
- package/build/index.js.map +1 -1
- package/build/utils/history.js +8 -2
- package/build/utils/history.js.map +1 -1
- package/build-module/components/add-new-template/new-template-part.js +3 -9
- package/build-module/components/add-new-template/new-template-part.js.map +1 -1
- package/build-module/components/add-new-template/new-template.js +25 -18
- package/build-module/components/add-new-template/new-template.js.map +1 -1
- package/build-module/components/add-new-template/utils.js +1 -1
- package/build-module/components/add-new-template/utils.js.map +1 -1
- package/build-module/components/app/index.js +3 -2
- package/build-module/components/app/index.js.map +1 -1
- package/build-module/components/block-editor/editor-canvas.js +8 -10
- package/build-module/components/block-editor/editor-canvas.js.map +1 -1
- package/build-module/components/editor/index.js +2 -3
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/global-styles/border-panel.js +21 -157
- package/build-module/components/global-styles/border-panel.js.map +1 -1
- package/build-module/components/global-styles/context-menu.js +4 -4
- package/build-module/components/global-styles/context-menu.js.map +1 -1
- package/build-module/components/global-styles/hooks.js +0 -66
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/preview.js +3 -4
- package/build-module/components/global-styles/preview.js.map +1 -1
- package/build-module/components/global-styles/screen-block-list.js +5 -5
- package/build-module/components/global-styles/screen-block-list.js.map +1 -1
- package/build-module/components/global-styles/screen-border.js +11 -2
- package/build-module/components/global-styles/screen-border.js.map +1 -1
- package/build-module/components/global-styles/screen-colors.js +23 -208
- package/build-module/components/global-styles/screen-colors.js.map +1 -1
- package/build-module/components/global-styles/screen-root.js +2 -1
- package/build-module/components/global-styles/screen-root.js.map +1 -1
- package/build-module/components/global-styles/screen-style-variations.js +2 -1
- package/build-module/components/global-styles/screen-style-variations.js.map +1 -1
- package/build-module/components/global-styles/screen-typography-element.js +4 -0
- package/build-module/components/global-styles/screen-typography-element.js.map +1 -1
- package/build-module/components/global-styles/screen-typography.js +5 -0
- package/build-module/components/global-styles/screen-typography.js.map +1 -1
- package/build-module/components/global-styles/ui.js +5 -30
- package/build-module/components/global-styles/ui.js.map +1 -1
- package/build-module/components/global-styles-renderer/index.js +1 -2
- package/build-module/components/global-styles-renderer/index.js.map +1 -1
- package/build-module/components/layout/index.js +7 -0
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/list/added-by.js +126 -137
- package/build-module/components/list/added-by.js.map +1 -1
- package/build-module/components/list/index.js +2 -1
- package/build-module/components/list/index.js.map +1 -1
- package/build-module/components/list/table.js +6 -5
- package/build-module/components/list/table.js.map +1 -1
- package/build-module/components/routes/link.js +5 -2
- package/build-module/components/routes/link.js.map +1 -1
- package/build-module/components/save-button/index.js +2 -5
- package/build-module/components/save-button/index.js.map +1 -1
- package/build-module/components/save-hub/index.js +68 -0
- package/build-module/components/save-hub/index.js.map +1 -0
- package/build-module/components/secondary-sidebar/list-view-sidebar.js +6 -2
- package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- package/build-module/components/sidebar/index.js +2 -4
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen/index.js +5 -2
- package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
- 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 +13 -18
- package/build-module/components/sidebar-navigation-screen-navigation-item/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js +81 -10
- package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/loader.js +11 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menus/loader.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +66 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-template/index.js +60 -13
- package/build-module/components/sidebar-navigation-screen-template/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-templates/index.js +5 -2
- package/build-module/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-templates-browse/index.js +6 -3
- package/build-module/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
- package/build-module/components/site-hub/index.js +3 -1
- package/build-module/components/site-hub/index.js.map +1 -1
- package/build-module/components/start-template-options/index.js +45 -10
- package/build-module/components/start-template-options/index.js.map +1 -1
- package/build-module/components/style-book/index.js +133 -21
- package/build-module/components/style-book/index.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +24 -8
- 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 +9 -7
- package/build-module/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
- package/build-module/components/template-details/index.js +0 -3
- package/build-module/components/template-details/index.js.map +1 -1
- package/build-module/components/template-part-converter/convert-to-regular.js +9 -13
- package/build-module/components/template-part-converter/convert-to-regular.js.map +1 -1
- package/build-module/components/template-part-converter/convert-to-template-part.js +3 -3
- package/build-module/components/template-part-converter/convert-to-template-part.js.map +1 -1
- package/build-module/components/template-part-converter/index.js +20 -15
- package/build-module/components/template-part-converter/index.js.map +1 -1
- package/build-module/components/use-edited-entity-record/index.js +6 -6
- package/build-module/components/use-edited-entity-record/index.js.map +1 -1
- package/build-module/hooks/push-changes-to-global-styles/index.js +1 -0
- package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build-module/index.js +4 -1
- package/build-module/index.js.map +1 -1
- package/build-module/utils/history.js +9 -3
- package/build-module/utils/history.js.map +1 -1
- package/build-style/style-rtl.css +172 -128
- package/build-style/style.css +172 -128
- package/package.json +31 -31
- package/src/components/add-new-template/new-template-part.js +1 -6
- package/src/components/add-new-template/new-template.js +60 -38
- package/src/components/add-new-template/style.scss +12 -1
- package/src/components/add-new-template/utils.js +1 -1
- package/src/components/app/index.js +9 -6
- package/src/components/block-editor/editor-canvas.js +13 -22
- package/src/components/editor/index.js +61 -65
- package/src/components/global-styles/border-panel.js +24 -199
- package/src/components/global-styles/context-menu.js +4 -4
- package/src/components/global-styles/hooks.js +0 -101
- package/src/components/global-styles/preview.js +1 -1
- package/src/components/global-styles/screen-block-list.js +4 -4
- package/src/components/global-styles/screen-border.js +9 -2
- package/src/components/global-styles/screen-colors.js +25 -229
- package/src/components/global-styles/screen-root.js +1 -1
- package/src/components/global-styles/screen-style-variations.js +5 -1
- package/src/components/global-styles/screen-typography-element.js +4 -0
- package/src/components/global-styles/screen-typography.js +6 -0
- package/src/components/global-styles/stories/index.js +425 -0
- package/src/components/global-styles/style.scss +14 -18
- package/src/components/global-styles/ui.js +6 -31
- package/src/components/global-styles-renderer/index.js +1 -2
- package/src/components/layout/index.js +15 -0
- package/src/components/layout/style.scss +1 -3
- package/src/components/list/added-by.js +144 -140
- package/src/components/list/index.js +3 -1
- package/src/components/list/table.js +7 -4
- package/src/components/routes/link.js +9 -2
- package/src/components/save-button/index.js +2 -2
- package/src/components/save-hub/index.js +78 -0
- package/src/components/save-hub/style.scss +15 -0
- package/src/components/secondary-sidebar/list-view-sidebar.js +4 -3
- package/src/components/sidebar/index.js +2 -3
- package/src/components/sidebar/style.scss +4 -3
- package/src/components/sidebar-button/style.scss +2 -1
- package/src/components/sidebar-navigation-item/style.scss +1 -23
- package/src/components/sidebar-navigation-screen/index.js +6 -0
- package/src/components/sidebar-navigation-screen/style.scss +15 -0
- package/src/components/sidebar-navigation-screen-main/index.js +21 -8
- package/src/components/sidebar-navigation-screen-navigation-item/index.js +30 -21
- package/src/components/sidebar-navigation-screen-navigation-menus/index.js +92 -9
- package/src/components/sidebar-navigation-screen-navigation-menus/loader.js +9 -0
- package/src/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +78 -0
- package/src/components/sidebar-navigation-screen-navigation-menus/style.scss +108 -1
- package/src/components/sidebar-navigation-screen-template/index.js +82 -11
- package/src/components/sidebar-navigation-screen-template/style.scss +25 -0
- package/src/components/sidebar-navigation-screen-templates/index.js +7 -0
- package/src/components/sidebar-navigation-screen-templates-browse/index.js +12 -1
- package/src/components/site-hub/index.js +5 -1
- package/src/components/site-hub/style.scss +5 -1
- package/src/components/start-template-options/index.js +40 -8
- package/src/components/style-book/index.js +203 -54
- package/src/components/style-book/style.scss +2 -46
- package/src/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +38 -8
- package/src/components/sync-state-with-url/use-sync-path-with-url.js +12 -7
- package/src/components/template-details/index.js +0 -3
- package/src/components/template-part-converter/convert-to-regular.js +10 -17
- package/src/components/template-part-converter/convert-to-template-part.js +9 -16
- package/src/components/template-part-converter/index.js +28 -12
- package/src/components/use-edited-entity-record/index.js +26 -18
- package/src/hooks/push-changes-to-global-styles/index.js +1 -0
- package/src/index.js +5 -1
- package/src/store/test/actions.js +0 -2
- package/src/style.scss +2 -1
- package/src/utils/history.js +13 -9
- package/build/components/global-styles/color-utils.js +0 -17
- package/build/components/global-styles/color-utils.js.map +0 -1
- package/build/components/global-styles/screen-background-color.js +0 -114
- package/build/components/global-styles/screen-background-color.js.map +0 -1
- package/build/components/global-styles/screen-button-color.js +0 -88
- package/build/components/global-styles/screen-button-color.js.map +0 -1
- package/build/components/global-styles/screen-heading-color.js +0 -165
- package/build/components/global-styles/screen-heading-color.js.map +0 -1
- package/build/components/global-styles/screen-link-color.js +0 -105
- package/build/components/global-styles/screen-link-color.js.map +0 -1
- package/build/components/global-styles/screen-text-color.js +0 -71
- package/build/components/global-styles/screen-text-color.js.map +0 -1
- package/build/components/navigation-inspector/index.js +0 -161
- package/build/components/navigation-inspector/index.js.map +0 -1
- package/build/components/navigation-inspector/navigation-menu.js +0 -79
- package/build/components/navigation-inspector/navigation-menu.js.map +0 -1
- package/build-module/components/global-styles/color-utils.js +0 -9
- package/build-module/components/global-styles/color-utils.js.map +0 -1
- package/build-module/components/global-styles/screen-background-color.js +0 -97
- package/build-module/components/global-styles/screen-background-color.js.map +0 -1
- package/build-module/components/global-styles/screen-button-color.js +0 -73
- package/build-module/components/global-styles/screen-button-color.js.map +0 -1
- package/build-module/components/global-styles/screen-heading-color.js +0 -149
- package/build-module/components/global-styles/screen-heading-color.js.map +0 -1
- package/build-module/components/global-styles/screen-link-color.js +0 -89
- package/build-module/components/global-styles/screen-link-color.js.map +0 -1
- package/build-module/components/global-styles/screen-text-color.js +0 -56
- package/build-module/components/global-styles/screen-text-color.js.map +0 -1
- package/build-module/components/navigation-inspector/index.js +0 -146
- package/build-module/components/navigation-inspector/index.js.map +0 -1
- package/build-module/components/navigation-inspector/navigation-menu.js +0 -69
- package/build-module/components/navigation-inspector/navigation-menu.js.map +0 -1
- package/src/components/global-styles/color-utils.js +0 -14
- package/src/components/global-styles/screen-background-color.js +0 -132
- package/src/components/global-styles/screen-button-color.js +0 -104
- package/src/components/global-styles/screen-heading-color.js +0 -206
- package/src/components/global-styles/screen-link-color.js +0 -124
- package/src/components/global-styles/screen-text-color.js +0 -62
- package/src/components/navigation-inspector/index.js +0 -191
- package/src/components/navigation-inspector/navigation-menu.js +0 -84
- package/src/components/navigation-inspector/style.scss +0 -46
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/style-book/index.js"],"names":["useGlobalStyle","blockEditorPrivateApis","SLOT_FILL_NAME","Slot","StyleBookSlot","Fill","StyleBookFill","getExamples","headingsExample","name","title","category","blocks","content","level","otherExamples","filter","blockType","example","supports","inserter","map","StyleBook","isSelected","onSelect","onClose","resizeObserver","sizes","focusOnMountRef","sectionFocusReturnRef","textColor","backgroundColor","examples","tabs","some","slug","icon","closeOnEscape","event","keyCode","ESCAPE","defaultPrevented","preventDefault","width","color","background","closeSmall","tab","Examples","Example","onClick","css","useHasStyleBook","fills","length"],"mappings":";;;;;;;;;;AAgCA;;AA7BA;;AAKA;;AAMA;;AACA;;AAMA;;AAIA;;AACA;;AAOA;;AAKA;;AAtCA;AACA;AACA;;AAGA;AACA;AACA;;AA4BA;AACA;AACA;AAGA,MAAM;AAAEA,EAAAA;AAAF,IAAqB,yBAAQC,wBAAR,CAA3B;AAEA,MAAMC,cAAc,GAAG,mBAAvB;AACA,MAAM;AAAEC,EAAAA,IAAI,EAAEC,aAAR;AAAuBC,EAAAA,IAAI,EAAEC;AAA7B,IACL,gCAAgBJ,cAAhB,CADD;;AAGA,SAASK,WAAT,GAAuB;AACtB;AACA;AACA,QAAMC,eAAe,GAAG;AACvBC,IAAAA,IAAI,EAAE,cADiB;AAEvBC,IAAAA,KAAK,EAAE,cAAI,UAAJ,CAFgB;AAGvBC,IAAAA,QAAQ,EAAE,MAHa;AAIvBC,IAAAA,MAAM,EAAE,CACP,yBAAa,cAAb,EAA6B;AAC5BC,MAAAA,OAAO,EAAE,cA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MwC,OAAO,GAAG,mBAAM;AAAA,MAAE;AAAEvC,IAAAA,KAAF;AAASE,IAAAA,MAAT;AAAiBW,IAAAA,UAAjB;AAA6B2B,IAAAA;AAA7B,GAAF;AAAA,SACrB;AACC,IAAA,SAAS,EAAG,yBAAY,+BAAZ,EAA6C;AACxD,qBAAe3B;AADyC,KAA7C,CADb;AAIC,kBAAa,oBACZ;AACA,kBAAI,gCAAJ,CAFY,EAGZb,KAHY,CAJd;AASC,IAAA,OAAO,EAAGwC;AATX,KAWC;AAAM,IAAA,SAAS,EAAC;AAAhB,KAAwDxC,KAAxD,CAXD,EAYC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,4BAAC,yBAAD;AACC,IAAA,MAAM,EAAGE,MADV;AAEC,IAAA,aAAa,EAAG,CAFjB;AAGC,IAAA,gBAAgB,EAAG,CAClB;AACCuC,MAAAA,GAAG,EACF,6CACA;AAHF,KADkB;AAHpB,IADD,CAZD,CADqB;AAAA,CAAN,CAAhB;;AA6BA,SAASC,eAAT,GAA2B;AAC1B,QAAMC,KAAK,GAAG,4CAAcnD,cAAd,CAAd;AACA,SAAO,CAAC,EAAEmD,KAAF,aAAEA,KAAF,eAAEA,KAAK,CAAEC,MAAT,CAAR;AACA;;AAEDhC,SAAS,CAACnB,IAAV,GAAiBC,aAAjB;eACekB,S","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\tTabPanel,\n\tcreateSlotFill,\n\t__experimentalUseSlotFills as useSlotFills,\n} from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tgetCategories,\n\tgetBlockTypes,\n\tgetBlockFromExample,\n\tcreateBlock,\n} from '@wordpress/blocks';\nimport {\n\tBlockPreview,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { closeSmall } from '@wordpress/icons';\nimport {\n\tuseResizeObserver,\n\tuseFocusOnMount,\n\tuseFocusReturn,\n\tuseMergeRefs,\n} from '@wordpress/compose';\nimport { useMemo, memo } from '@wordpress/element';\nimport { ESCAPE } from '@wordpress/keycodes';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../private-apis';\n\nconst { useGlobalStyle } = unlock( blockEditorPrivateApis );\n\nconst SLOT_FILL_NAME = 'EditSiteStyleBook';\nconst { Slot: StyleBookSlot, Fill: StyleBookFill } =\n\tcreateSlotFill( SLOT_FILL_NAME );\n\nfunction getExamples() {\n\t// Use our own example for the Heading block so that we can show multiple\n\t// heading levels.\n\tconst headingsExample = {\n\t\tname: 'core/heading',\n\t\ttitle: __( 'Headings' ),\n\t\tcategory: 'text',\n\t\tblocks: [\n\t\t\tcreateBlock( 'core/heading', {\n\t\t\t\tcontent: __( 'Code Is Poetry' ),\n\t\t\t\tlevel: 1,\n\t\t\t} ),\n\t\t\tcreateBlock( 'core/heading', {\n\t\t\t\tcontent: __( 'Code Is Poetry' ),\n\t\t\t\tlevel: 2,\n\t\t\t} ),\n\t\t\tcreateBlock( 'core/heading', {\n\t\t\t\tcontent: __( 'Code Is Poetry' ),\n\t\t\t\tlevel: 3,\n\t\t\t} ),\n\t\t\tcreateBlock( 'core/heading', {\n\t\t\t\tcontent: __( 'Code Is Poetry' ),\n\t\t\t\tlevel: 4,\n\t\t\t} ),\n\t\t\tcreateBlock( 'core/heading', {\n\t\t\t\tcontent: __( 'Code Is Poetry' ),\n\t\t\t\tlevel: 5,\n\t\t\t} ),\n\t\t],\n\t};\n\n\tconst otherExamples = getBlockTypes()\n\t\t.filter( ( blockType ) => {\n\t\t\tconst { name, example, supports } = blockType;\n\t\t\treturn (\n\t\t\t\tname !== 'core/heading' &&\n\t\t\t\t!! example &&\n\t\t\t\tsupports.inserter !== false\n\t\t\t);\n\t\t} )\n\t\t.map( ( blockType ) => ( {\n\t\t\tname: blockType.name,\n\t\t\ttitle: blockType.title,\n\t\t\tcategory: blockType.category,\n\t\t\tblocks: getBlockFromExample( blockType.name, blockType.example ),\n\t\t} ) );\n\n\treturn [ headingsExample, ...otherExamples ];\n}\n\nfunction StyleBook( { isSelected, onSelect, onClose } ) {\n\tconst [ resizeObserver, sizes ] = useResizeObserver();\n\tconst focusOnMountRef = useFocusOnMount( 'firstElement' );\n\tconst sectionFocusReturnRef = useFocusReturn();\n\n\tconst [ textColor ] = useGlobalStyle( 'color.text' );\n\tconst [ backgroundColor ] = useGlobalStyle( 'color.background' );\n\tconst examples = useMemo( getExamples, [] );\n\tconst tabs = useMemo(\n\t\t() =>\n\t\t\tgetCategories()\n\t\t\t\t.filter( ( category ) =>\n\t\t\t\t\texamples.some(\n\t\t\t\t\t\t( example ) => example.category === category.slug\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t\t.map( ( category ) => ( {\n\t\t\t\t\tname: category.slug,\n\t\t\t\t\ttitle: category.title,\n\t\t\t\t\ticon: category.icon,\n\t\t\t\t} ) ),\n\t\t[ examples ]\n\t);\n\n\tfunction closeOnEscape( event ) {\n\t\tif ( event.keyCode === ESCAPE && ! event.defaultPrevented ) {\n\t\t\tevent.preventDefault();\n\t\t\tonClose();\n\t\t}\n\t}\n\n\treturn (\n\t\t<StyleBookFill>\n\t\t\t{ /* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */ }\n\t\t\t<section\n\t\t\t\tclassName={ classnames( 'edit-site-style-book', {\n\t\t\t\t\t'is-wide': sizes.width > 600,\n\t\t\t\t} ) }\n\t\t\t\tstyle={ {\n\t\t\t\t\tcolor: textColor,\n\t\t\t\t\tbackground: backgroundColor,\n\t\t\t\t} }\n\t\t\t\taria-label={ __( 'Style Book' ) }\n\t\t\t\tonKeyDown={ closeOnEscape }\n\t\t\t\tref={ useMergeRefs( [\n\t\t\t\t\tsectionFocusReturnRef,\n\t\t\t\t\tfocusOnMountRef,\n\t\t\t\t] ) }\n\t\t\t>\n\t\t\t\t{ resizeObserver }\n\t\t\t\t<Button\n\t\t\t\t\tclassName=\"edit-site-style-book__close-button\"\n\t\t\t\t\ticon={ closeSmall }\n\t\t\t\t\tlabel={ __( 'Close Style Book' ) }\n\t\t\t\t\tonClick={ onClose }\n\t\t\t\t\tshowTooltip={ false }\n\t\t\t\t/>\n\t\t\t\t<TabPanel\n\t\t\t\t\tclassName=\"edit-site-style-book__tab-panel\"\n\t\t\t\t\ttabs={ tabs }\n\t\t\t\t>\n\t\t\t\t\t{ ( tab ) => (\n\t\t\t\t\t\t<Examples\n\t\t\t\t\t\t\texamples={ examples }\n\t\t\t\t\t\t\tcategory={ tab.name }\n\t\t\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\t\t\tonSelect={ onSelect }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</TabPanel>\n\t\t\t</section>\n\t\t</StyleBookFill>\n\t);\n}\n\nconst Examples = memo( ( { examples, category, isSelected, onSelect } ) => (\n\t<div className=\"edit-site-style-book__examples\">\n\t\t{ examples\n\t\t\t.filter( ( example ) => example.category === category )\n\t\t\t.map( ( example ) => (\n\t\t\t\t<Example\n\t\t\t\t\tkey={ example.name }\n\t\t\t\t\ttitle={ example.title }\n\t\t\t\t\tblocks={ example.blocks }\n\t\t\t\t\tisSelected={ isSelected( example.name ) }\n\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\tonSelect( example.name );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t) ) }\n\t</div>\n) );\n\nconst Example = memo( ( { title, blocks, isSelected, onClick } ) => (\n\t<button\n\t\tclassName={ classnames( 'edit-site-style-book__example', {\n\t\t\t'is-selected': isSelected,\n\t\t} ) }\n\t\taria-label={ sprintf(\n\t\t\t// translators: %s: Title of a block, e.g. Heading.\n\t\t\t__( 'Open %s styles in Styles panel' ),\n\t\t\ttitle\n\t\t) }\n\t\tonClick={ onClick }\n\t>\n\t\t<span className=\"edit-site-style-book__example-title\">{ title }</span>\n\t\t<div className=\"edit-site-style-book__example-preview\">\n\t\t\t<BlockPreview\n\t\t\t\tblocks={ blocks }\n\t\t\t\tviewportWidth={ 0 }\n\t\t\t\tadditionalStyles={ [\n\t\t\t\t\t{\n\t\t\t\t\t\tcss:\n\t\t\t\t\t\t\t'.wp-block:first-child { margin-top: 0; }' +\n\t\t\t\t\t\t\t'.wp-block:last-child { margin-bottom: 0; }',\n\t\t\t\t\t},\n\t\t\t\t] }\n\t\t\t/>\n\t\t</div>\n\t</button>\n) );\n\nfunction useHasStyleBook() {\n\tconst fills = useSlotFills( SLOT_FILL_NAME );\n\treturn !! fills?.length;\n}\n\nStyleBook.Slot = StyleBookSlot;\nexport default StyleBook;\nexport { useHasStyleBook };\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/style-book/index.js"],"names":["ExperimentalBlockEditorProvider","useGlobalStyle","blockEditorPrivateApis","SLOT_FILL_NAME","Slot","StyleBookSlot","Fill","StyleBookFill","STYLE_BOOK_IFRAME_STYLES","getExamples","headingsExample","name","title","category","blocks","content","level","otherExamples","filter","blockType","example","supports","inserter","map","StyleBook","isSelected","onSelect","onClose","resizeObserver","sizes","focusOnMountRef","sectionFocusReturnRef","textColor","backgroundColor","examples","tabs","some","slug","icon","originalSettings","select","blockEditorStore","getSettings","settings","__unstableIsPreviewMode","closeOnEscape","event","keyCode","ESCAPE","defaultPrevented","preventDefault","width","color","background","closeSmall","tab","styles","Examples","className","label","composite","orientation","Example","id","onClick","renderedBlocks","Array","isArray","useHasStyleBook","fills","length"],"mappings":";;;;;;;;;;AAwCA;;;;AArCA;;AAKA;;AAUA;;AACA;;AAMA;;AAOA;;AACA;;AACA;;AAOA;;AAKA;;AA9CA;AACA;AACA;;AAGA;AACA;AACA;;AAoCA;AACA;AACA;AAGA,MAAM;AAAEA,EAAAA,+BAAF;AAAmCC,EAAAA;AAAnC,IAAsD,yBAC3DC,wBAD2D,CAA5D;AAIA,MAAMC,cAAc,GAAG,mBAAvB;AACA,MAAM;AAAEC,EAAAA,IAAI,EAAEC,aAAR;AAAuBC,EAAAA,IAAI,EAAEC;AAA7B,IACL,gC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AAO,EAAGoD,OAXX;AAYC,IAAA,IAAI,EAAC,QAZN;AAaC,IAAA,EAAE,EAAC;AAbJ,MAeC;AAAM,IAAA,SAAS,EAAC;AAAhB,KACGpD,KADH,CAfD,EAkBC;AAAK,IAAA,SAAS,EAAC,uCAAf;AAAuD;AAAvD,KACC,4BAAC,oBAAD;AAAU,IAAA,SAAS,EAAC;AAApB,KACC,4BAAC,+BAAD;AACC,IAAA,KAAK,EAAGqD,cADT;AAEC,IAAA,QAAQ,EAAGtB;AAFZ,KAIC,4BAAC,sBAAD;AAAW,IAAA,cAAc,EAAG;AAA5B,IAJD,CADD,CADD,CAlBD,CADD;AA+BA,CA/CD;;AAiDA,SAASyB,eAAT,GAA2B;AAC1B,QAAMC,KAAK,GAAG,4CAAclE,cAAd,CAAd;AACA,SAAO,CAAC,EAAEkE,KAAF,aAAEA,KAAF,eAAEA,KAAK,CAAEC,MAAT,CAAR;AACA;;AAED9C,SAAS,CAACpB,IAAV,GAAiBC,aAAjB;eACemB,S","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\t__unstableComposite as Composite,\n\t__unstableUseCompositeState as useCompositeState,\n\t__unstableCompositeItem as CompositeItem,\n\tDisabled,\n\tTabPanel,\n\tcreateSlotFill,\n\t__experimentalUseSlotFills as useSlotFills,\n} from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tgetCategories,\n\tgetBlockTypes,\n\tgetBlockFromExample,\n\tcreateBlock,\n} from '@wordpress/blocks';\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 { closeSmall } from '@wordpress/icons';\nimport {\n\tuseResizeObserver,\n\tuseFocusOnMount,\n\tuseFocusReturn,\n\tuseMergeRefs,\n} from '@wordpress/compose';\nimport { useMemo, memo } from '@wordpress/element';\nimport { ESCAPE } from '@wordpress/keycodes';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../private-apis';\n\nconst { ExperimentalBlockEditorProvider, useGlobalStyle } = unlock(\n\tblockEditorPrivateApis\n);\n\nconst SLOT_FILL_NAME = 'EditSiteStyleBook';\nconst { Slot: StyleBookSlot, Fill: StyleBookFill } =\n\tcreateSlotFill( SLOT_FILL_NAME );\n\n// The content area of the Style Book is rendered within an iframe so that global styles\n// are applied to elements within the entire content area. To support elements that are\n// not part of the block previews, such as headings and layout for the block previews,\n// additional CSS rules need to be passed into the iframe. These are hard-coded below.\n// Note that button styles are unset, and then focus rules from the `Button` component are\n// applied to the `button` element, targeted via `.edit-site-style-book__example`.\n// This is to ensure that browser default styles for buttons are not applied to the previews.\nconst STYLE_BOOK_IFRAME_STYLES = `\n\t.edit-site-style-book__examples {\n\t\tmax-width: 900px;\n\t\tmargin: 0 auto;\n\t}\n\n\t.edit-site-style-book__example {\n\t\tborder-radius: 2px;\n\t\tcursor: pointer;\n\t\tdisplay: flex;\n\t\tflex-direction: column;\n\t\tgap: 40px;\n\t\tmargin-bottom: 40px;\n\t\tpadding: 16px;\n\t\twidth: 100%;\n\t\tbox-sizing: border-box;\n\t}\n\n\t.edit-site-style-book__example.is-selected {\n\t\tbox-shadow: 0 0 0 1px var(--wp-components-color-accent, var(--wp-admin-theme-color, #007cba));\n\t}\n\n\t.edit-site-style-book__example:focus:not(:disabled) {\n\t\tbox-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-components-color-accent, var(--wp-admin-theme-color, #007cba));\n\t\toutline: 3px solid transparent;\n\t}\n\n\t.edit-site-style-book__examples.is-wide .edit-site-style-book__example {\n\t\tflex-direction: row;\n\t}\n\n\t.edit-site-style-book__example-title {\n\t\tfont-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Oxygen-Sans, Ubuntu, Cantarell, \"Helvetica Neue\", sans-serif;\n\t\tfont-size: 11px;\n\t\tfont-weight: 500;\n\t\tline-height: normal;\n\t\tmargin: 0;\n\t\ttext-align: left;\n\t\ttext-transform: uppercase;\n\t}\n\n\t.edit-site-style-book__examples.is-wide .edit-site-style-book__example-title {\n\t\ttext-align: right;\n\t\twidth: 120px;\n\t}\n\n\t.edit-site-style-book__example-preview {\n\t\twidth: 100%;\n\t}\n\n\t.edit-site-style-book__example-preview .block-editor-block-list__insertion-point,\n\t.edit-site-style-book__example-preview .block-list-appender {\n\t\tdisplay: none;\n\t}\n\n\t.edit-site-style-book__example-preview .is-root-container > .wp-block:first-child {\n\t\tmargin-top: 0;\n\t}\n\t.edit-site-style-book__example-preview .is-root-container > .wp-block:last-child {\n\t\tmargin-bottom: 0;\n\t}\n`;\n\nfunction getExamples() {\n\t// Use our own example for the Heading block so that we can show multiple\n\t// heading levels.\n\tconst headingsExample = {\n\t\tname: 'core/heading',\n\t\ttitle: __( 'Headings' ),\n\t\tcategory: 'text',\n\t\tblocks: [\n\t\t\tcreateBlock( 'core/heading', {\n\t\t\t\tcontent: __( 'Code Is Poetry' ),\n\t\t\t\tlevel: 1,\n\t\t\t} ),\n\t\t\tcreateBlock( 'core/heading', {\n\t\t\t\tcontent: __( 'Code Is Poetry' ),\n\t\t\t\tlevel: 2,\n\t\t\t} ),\n\t\t\tcreateBlock( 'core/heading', {\n\t\t\t\tcontent: __( 'Code Is Poetry' ),\n\t\t\t\tlevel: 3,\n\t\t\t} ),\n\t\t\tcreateBlock( 'core/heading', {\n\t\t\t\tcontent: __( 'Code Is Poetry' ),\n\t\t\t\tlevel: 4,\n\t\t\t} ),\n\t\t\tcreateBlock( 'core/heading', {\n\t\t\t\tcontent: __( 'Code Is Poetry' ),\n\t\t\t\tlevel: 5,\n\t\t\t} ),\n\t\t],\n\t};\n\n\tconst otherExamples = getBlockTypes()\n\t\t.filter( ( blockType ) => {\n\t\t\tconst { name, example, supports } = blockType;\n\t\t\treturn (\n\t\t\t\tname !== 'core/heading' &&\n\t\t\t\t!! example &&\n\t\t\t\tsupports.inserter !== false\n\t\t\t);\n\t\t} )\n\t\t.map( ( blockType ) => ( {\n\t\t\tname: blockType.name,\n\t\t\ttitle: blockType.title,\n\t\t\tcategory: blockType.category,\n\t\t\tblocks: getBlockFromExample( blockType.name, blockType.example ),\n\t\t} ) );\n\n\treturn [ headingsExample, ...otherExamples ];\n}\n\nfunction StyleBook( { isSelected, onSelect, onClose } ) {\n\tconst [ resizeObserver, sizes ] = useResizeObserver();\n\tconst focusOnMountRef = useFocusOnMount( 'firstElement' );\n\tconst sectionFocusReturnRef = useFocusReturn();\n\n\tconst [ textColor ] = useGlobalStyle( 'color.text' );\n\tconst [ backgroundColor ] = useGlobalStyle( 'color.background' );\n\tconst examples = useMemo( getExamples, [] );\n\tconst tabs = useMemo(\n\t\t() =>\n\t\t\tgetCategories()\n\t\t\t\t.filter( ( category ) =>\n\t\t\t\t\texamples.some(\n\t\t\t\t\t\t( example ) => example.category === category.slug\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t\t.map( ( category ) => ( {\n\t\t\t\t\tname: category.slug,\n\t\t\t\t\ttitle: category.title,\n\t\t\t\t\ticon: category.icon,\n\t\t\t\t} ) ),\n\t\t[ examples ]\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\tfunction closeOnEscape( event ) {\n\t\tif ( event.keyCode === ESCAPE && ! event.defaultPrevented ) {\n\t\t\tevent.preventDefault();\n\t\t\tonClose();\n\t\t}\n\t}\n\n\treturn (\n\t\t<StyleBookFill>\n\t\t\t{ /* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */ }\n\t\t\t<section\n\t\t\t\tclassName={ classnames( 'edit-site-style-book', {\n\t\t\t\t\t'is-wide': sizes.width > 600,\n\t\t\t\t} ) }\n\t\t\t\tstyle={ {\n\t\t\t\t\tcolor: textColor,\n\t\t\t\t\tbackground: backgroundColor,\n\t\t\t\t} }\n\t\t\t\taria-label={ __( 'Style Book' ) }\n\t\t\t\tonKeyDown={ closeOnEscape }\n\t\t\t\tref={ useMergeRefs( [\n\t\t\t\t\tsectionFocusReturnRef,\n\t\t\t\t\tfocusOnMountRef,\n\t\t\t\t] ) }\n\t\t\t>\n\t\t\t\t{ resizeObserver }\n\t\t\t\t<Button\n\t\t\t\t\tclassName=\"edit-site-style-book__close-button\"\n\t\t\t\t\ticon={ closeSmall }\n\t\t\t\t\tlabel={ __( 'Close Style Book' ) }\n\t\t\t\t\tonClick={ onClose }\n\t\t\t\t\tshowTooltip={ false }\n\t\t\t\t/>\n\t\t\t\t<TabPanel\n\t\t\t\t\tclassName=\"edit-site-style-book__tab-panel\"\n\t\t\t\t\ttabs={ tabs }\n\t\t\t\t>\n\t\t\t\t\t{ ( tab ) => (\n\t\t\t\t\t\t<Iframe\n\t\t\t\t\t\t\tclassName=\"edit-site-style-book__iframe\"\n\t\t\t\t\t\t\tname=\"style-book-canvas\"\n\t\t\t\t\t\t\ttabIndex={ 0 }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<EditorStyles styles={ settings.styles } />\n\t\t\t\t\t\t\t<style>\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t// Forming a \"block formatting context\" to prevent margin collapsing.\n\t\t\t\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\t\t\t`.is-root-container { display: flow-root; }\n\t\t\t\t\t\t\t\t\t\t\tbody { position: relative; padding: 32px !important; }` +\n\t\t\t\t\t\t\t\t\t\tSTYLE_BOOK_IFRAME_STYLES\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t</style>\n\t\t\t\t\t\t\t<Examples\n\t\t\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t\t\t'edit-site-style-book__examples',\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t'is-wide': sizes.width > 600,\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\texamples={ examples }\n\t\t\t\t\t\t\t\tcategory={ tab.name }\n\t\t\t\t\t\t\t\tlabel={ sprintf(\n\t\t\t\t\t\t\t\t\t// translators: %s: Category of blocks, e.g. Text.\n\t\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t\t'Examples of blocks in the %s category'\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\ttab.title\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\t\t\t\tonSelect={ onSelect }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</Iframe>\n\t\t\t\t\t) }\n\t\t\t\t</TabPanel>\n\t\t\t</section>\n\t\t</StyleBookFill>\n\t);\n}\n\nconst Examples = memo(\n\t( { className, examples, category, label, isSelected, onSelect } ) => {\n\t\tconst composite = useCompositeState( { orientation: 'vertical' } );\n\t\treturn (\n\t\t\t<Composite\n\t\t\t\t{ ...composite }\n\t\t\t\tclassName={ className }\n\t\t\t\taria-label={ label }\n\t\t\t>\n\t\t\t\t{ examples\n\t\t\t\t\t.filter( ( example ) => example.category === category )\n\t\t\t\t\t.map( ( example ) => (\n\t\t\t\t\t\t<Example\n\t\t\t\t\t\t\tkey={ example.name }\n\t\t\t\t\t\t\tid={ `example-${ example.name }` }\n\t\t\t\t\t\t\tcomposite={ composite }\n\t\t\t\t\t\t\ttitle={ example.title }\n\t\t\t\t\t\t\tblocks={ example.blocks }\n\t\t\t\t\t\t\tisSelected={ isSelected( example.name ) }\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tonSelect( example.name );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) ) }\n\t\t\t</Composite>\n\t\t);\n\t}\n);\n\nconst Example = ( { composite, id, title, blocks, isSelected, onClick } ) => {\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\t// Cache the list of blocks to avoid additional processing when the component is re-rendered.\n\tconst renderedBlocks = useMemo(\n\t\t() => ( Array.isArray( blocks ) ? blocks : [ blocks ] ),\n\t\t[ blocks ]\n\t);\n\n\treturn (\n\t\t<CompositeItem\n\t\t\t{ ...composite }\n\t\t\tclassName={ classnames( 'edit-site-style-book__example', {\n\t\t\t\t'is-selected': isSelected,\n\t\t\t} ) }\n\t\t\tid={ id }\n\t\t\taria-label={ sprintf(\n\t\t\t\t// translators: %s: Title of a block, e.g. Heading.\n\t\t\t\t__( 'Open %s styles in Styles panel' ),\n\t\t\t\ttitle\n\t\t\t) }\n\t\t\tonClick={ onClick }\n\t\t\trole=\"button\"\n\t\t\tas=\"div\"\n\t\t>\n\t\t\t<span className=\"edit-site-style-book__example-title\">\n\t\t\t\t{ title }\n\t\t\t</span>\n\t\t\t<div className=\"edit-site-style-book__example-preview\" aria-hidden>\n\t\t\t\t<Disabled className=\"edit-site-style-book__example-preview__content\">\n\t\t\t\t\t<ExperimentalBlockEditorProvider\n\t\t\t\t\t\tvalue={ renderedBlocks }\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</div>\n\t\t</CompositeItem>\n\t);\n};\n\nfunction useHasStyleBook() {\n\tconst fills = useSlotFills( SLOT_FILL_NAME );\n\treturn !! fills?.length;\n}\n\nStyleBook.Slot = StyleBookSlot;\nexport default StyleBook;\nexport { useHasStyleBook };\n"]}
|
|
@@ -33,24 +33,40 @@ function useSyncCanvasModeWithURL() {
|
|
|
33
33
|
} = (0, _privateApis.unlock)((0, _data.useDispatch)(_store.store));
|
|
34
34
|
const currentCanvasMode = (0, _element.useRef)(canvasMode);
|
|
35
35
|
const {
|
|
36
|
-
canvas: canvasInUrl
|
|
36
|
+
canvas: canvasInUrl
|
|
37
37
|
} = params;
|
|
38
38
|
const currentCanvasInUrl = (0, _element.useRef)(canvasInUrl);
|
|
39
|
+
const currentUrlParams = (0, _element.useRef)(params);
|
|
40
|
+
(0, _element.useEffect)(() => {
|
|
41
|
+
currentUrlParams.current = params;
|
|
42
|
+
}, [params]);
|
|
39
43
|
(0, _element.useEffect)(() => {
|
|
40
44
|
currentCanvasMode.current = canvasMode;
|
|
41
45
|
|
|
42
|
-
if (
|
|
43
|
-
|
|
44
|
-
|
|
46
|
+
if (canvasMode === 'init') {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
if (canvasMode === 'edit' && currentCanvasInUrl.current !== canvasMode) {
|
|
51
|
+
history.push({ ...currentUrlParams.current,
|
|
52
|
+
canvas: 'edit'
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (canvasMode === 'view' && currentCanvasInUrl.current !== undefined) {
|
|
57
|
+
history.push({ ...currentUrlParams.current,
|
|
58
|
+
canvas: undefined
|
|
45
59
|
});
|
|
46
60
|
}
|
|
47
|
-
}, [canvasMode]);
|
|
61
|
+
}, [canvasMode, history]);
|
|
48
62
|
(0, _element.useEffect)(() => {
|
|
49
63
|
currentCanvasInUrl.current = canvasInUrl;
|
|
50
64
|
|
|
51
|
-
if (canvasInUrl
|
|
52
|
-
setCanvasMode(
|
|
65
|
+
if (canvasInUrl === undefined && currentCanvasMode.current !== 'view') {
|
|
66
|
+
setCanvasMode('view');
|
|
67
|
+
} else if (canvasInUrl === 'edit' && currentCanvasMode.current !== 'edit') {
|
|
68
|
+
setCanvasMode('edit');
|
|
53
69
|
}
|
|
54
|
-
}, [canvasInUrl]);
|
|
70
|
+
}, [canvasInUrl, setCanvasMode]);
|
|
55
71
|
}
|
|
56
72
|
//# sourceMappingURL=use-sync-canvas-mode-with-url.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sync-state-with-url/use-sync-canvas-mode-with-url.js"],"names":["useSyncCanvasModeWithURL","history","params","canvasMode","select","editSiteStore","getCanvasMode","setCanvasMode","currentCanvasMode","canvas","canvasInUrl","currentCanvasInUrl","current","push"],"mappings":";;;;;;;AAGA;;AACA;;AAKA;;AACA;;AACA;;AAXA;AACA;AACA;;AAIA;AACA;AACA;AAKe,SAASA,wBAAT,GAAoC;AAClD,QAAMC,OAAO,GAAG,yBAAhB;AACA,QAAM;AAAEC,IAAAA;AAAF,MAAa,0BAAnB;AACA,QAAMC,UAAU,GAAG,qBAChBC,MAAF,IAAc,yBAAQA,MAAM,CAAEC,YAAF,CAAd,EAAkCC,aAAlC,EADI,EAElB,EAFkB,CAAnB;AAIA,QAAM;AAAEC,IAAAA;AAAF,MAAoB,yBAAQ,uBAAaF,YAAb,CAAR,CAA1B;AACA,QAAMG,iBAAiB,GAAG,qBAAQL,UAAR,CAA1B;AACA,QAAM;AAAEM,IAAAA,MAAM,EAAEC
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sync-state-with-url/use-sync-canvas-mode-with-url.js"],"names":["useSyncCanvasModeWithURL","history","params","canvasMode","select","editSiteStore","getCanvasMode","setCanvasMode","currentCanvasMode","canvas","canvasInUrl","currentCanvasInUrl","currentUrlParams","current","push","undefined"],"mappings":";;;;;;;AAGA;;AACA;;AAKA;;AACA;;AACA;;AAXA;AACA;AACA;;AAIA;AACA;AACA;AAKe,SAASA,wBAAT,GAAoC;AAClD,QAAMC,OAAO,GAAG,yBAAhB;AACA,QAAM;AAAEC,IAAAA;AAAF,MAAa,0BAAnB;AACA,QAAMC,UAAU,GAAG,qBAChBC,MAAF,IAAc,yBAAQA,MAAM,CAAEC,YAAF,C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F,iBAAiB,CAACK,OAAlB,KAA8B,MAFxB,EAGL;AACDN,MAAAA,aAAa,CAAE,MAAF,CAAb;AACA;AACD,GAbD,EAaG,CAAEG,WAAF,EAAeH,aAAf,CAbH;AAcA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect, useRef } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport { useLocation, useHistory } from '../routes';\nimport { unlock } from '../../private-apis';\n\nexport default function useSyncCanvasModeWithURL() {\n\tconst history = useHistory();\n\tconst { params } = useLocation();\n\tconst canvasMode = useSelect(\n\t\t( select ) => unlock( select( editSiteStore ) ).getCanvasMode(),\n\t\t[]\n\t);\n\tconst { setCanvasMode } = unlock( useDispatch( editSiteStore ) );\n\tconst currentCanvasMode = useRef( canvasMode );\n\tconst { canvas: canvasInUrl } = params;\n\tconst currentCanvasInUrl = useRef( canvasInUrl );\n\tconst currentUrlParams = useRef( params );\n\tuseEffect( () => {\n\t\tcurrentUrlParams.current = params;\n\t}, [ params ] );\n\n\tuseEffect( () => {\n\t\tcurrentCanvasMode.current = canvasMode;\n\t\tif ( canvasMode === 'init' ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (\n\t\t\tcanvasMode === 'edit' &&\n\t\t\tcurrentCanvasInUrl.current !== canvasMode\n\t\t) {\n\t\t\thistory.push( {\n\t\t\t\t...currentUrlParams.current,\n\t\t\t\tcanvas: 'edit',\n\t\t\t} );\n\t\t}\n\n\t\tif (\n\t\t\tcanvasMode === 'view' &&\n\t\t\tcurrentCanvasInUrl.current !== undefined\n\t\t) {\n\t\t\thistory.push( {\n\t\t\t\t...currentUrlParams.current,\n\t\t\t\tcanvas: undefined,\n\t\t\t} );\n\t\t}\n\t}, [ canvasMode, history ] );\n\n\tuseEffect( () => {\n\t\tcurrentCanvasInUrl.current = canvasInUrl;\n\t\tif (\n\t\t\tcanvasInUrl === undefined &&\n\t\t\tcurrentCanvasMode.current !== 'view'\n\t\t) {\n\t\t\tsetCanvasMode( 'view' );\n\t\t} else if (\n\t\t\tcanvasInUrl === 'edit' &&\n\t\t\tcurrentCanvasMode.current !== 'edit'\n\t\t) {\n\t\t\tsetCanvasMode( 'edit' );\n\t\t}\n\t}, [ canvasInUrl, setCanvasMode ] );\n}\n"]}
|
|
@@ -51,7 +51,15 @@ function useSyncPathWithURL() {
|
|
|
51
51
|
} = (0, _components.__experimentalUseNavigator)();
|
|
52
52
|
const currentUrlParams = (0, _element.useRef)(urlParams);
|
|
53
53
|
const currentPath = (0, _element.useRef)(navigatorLocation.path);
|
|
54
|
+
const isMounting = (0, _element.useRef)(true);
|
|
54
55
|
(0, _element.useEffect)(() => {
|
|
56
|
+
// The navigatorParams are only initially filled properly when the
|
|
57
|
+
// navigator screens mount. so we ignore the first synchronisation.
|
|
58
|
+
if (isMounting.current) {
|
|
59
|
+
isMounting.current = false;
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
|
|
55
63
|
function updateUrlParams(newUrlParams) {
|
|
56
64
|
if (Object.entries(newUrlParams).every(_ref => {
|
|
57
65
|
let [key, value] = _ref;
|
|
@@ -73,17 +81,11 @@ function useSyncPathWithURL() {
|
|
|
73
81
|
postId: navigatorParams === null || navigatorParams === void 0 ? void 0 : navigatorParams.postId,
|
|
74
82
|
path: undefined
|
|
75
83
|
});
|
|
76
|
-
} else if (navigatorParams !== null && navigatorParams !== void 0 && navigatorParams.postType && !(navigatorParams !== null && navigatorParams !== void 0 && navigatorParams.postId)) {
|
|
77
|
-
updateUrlParams({
|
|
78
|
-
postType: navigatorParams === null || navigatorParams === void 0 ? void 0 : navigatorParams.postType,
|
|
79
|
-
path: navigatorLocation.path,
|
|
80
|
-
postId: undefined
|
|
81
|
-
});
|
|
82
84
|
} else {
|
|
83
85
|
updateUrlParams({
|
|
84
86
|
postType: undefined,
|
|
85
87
|
postId: undefined,
|
|
86
|
-
path: navigatorLocation.path
|
|
88
|
+
path: navigatorLocation.path === '/' ? undefined : navigatorLocation.path
|
|
87
89
|
});
|
|
88
90
|
}
|
|
89
91
|
}, [navigatorLocation === null || navigatorLocation === void 0 ? void 0 : navigatorLocation.path, navigatorParams, history]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sync-state-with-url/use-sync-path-with-url.js"],"names":["getPathFromURL","urlParams","path","postType","postId","encodeURIComponent","useSyncPathWithURL","history","params","location","navigatorLocation","navigatorParams","goTo","currentUrlParams","currentPath","updateUrlParams","newUrlParams","Object","entries","every","key","value","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sync-state-with-url/use-sync-path-with-url.js"],"names":["getPathFromURL","urlParams","path","postType","postId","encodeURIComponent","useSyncPathWithURL","history","params","location","navigatorLocation","navigatorParams","goTo","currentUrlParams","currentPath","isMounting","current","updateUrlParams","newUrlParams","Object","entries","every","key","value","updatedParams","push","undefined"],"mappings":";;;;;;;;AAGA;;AACA;;AAKA;;AATA;AACA;AACA;;AAIA;AACA;AACA;AAGO,SAASA,cAAT,CAAyBC,SAAzB,EAAqC;AAAA;;AAC3C,MAAIC,IAAI,sBAAGD,SAAH,aAAGA,SAAH,uBAAGA,SAAS,CAAEC,IAAd,6DAAsB,GAA9B,CAD2C,CAG3C;;AACA,MAAKD,SAAS,SAAT,IAAAA,SAAS,WAAT,IAAAA,SAAS,CAAEE,QAAX,IAAuBF,SAAvB,aAAuBA,SAAvB,eAAuBA,SAAS,CAAEG,MAAvC,EAAgD;AAC/C,YAASH,SAAS,CAACE,QAAnB;AACC,WAAK,aAAL;AACA,WAAK,kBAAL;AACCD,QAAAA,IAAI,GAAI,IAAIG,kBAAkB,CAC7BJ,SAAS,CAACE,QADmB,CAE3B,IAAIE,kBAAkB,CAAEJ,SAAS,CAACG,MAAZ,CAAsB,EAF/C;AAGA;;AACD;AACCF,QAAAA,IAAI,GAAI,eAAeG,kBAAkB,CACxCJ,SAAS,CAACE,QAD8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CAAE;AAChBd,QAAAA,QAAQ,EAAEQ,eAAF,aAAEA,eAAF,uBAAEA,eAAe,CAAER,QADX;AAEhBC,QAAAA,MAAM,EAAEO,eAAF,aAAEA,eAAF,uBAAEA,eAAe,CAAEP,MAFT;AAGhBF,QAAAA,IAAI,EAAEwB;AAHU,OAAF,CAAf;AAKA,KAND,MAMO;AACNT,MAAAA,eAAe,CAAE;AAChBd,QAAAA,QAAQ,EAAEuB,SADM;AAEhBtB,QAAAA,MAAM,EAAEsB,SAFQ;AAGhBxB,QAAAA,IAAI,EACHQ,iBAAiB,CAACR,IAAlB,KAA2B,GAA3B,GACGwB,SADH,GAEGhB,iBAAiB,CAACR;AANN,OAAF,CAAf;AAQA;AACD,GAxCD,EAwCG,CAAEQ,iBAAF,aAAEA,iBAAF,uBAAEA,iBAAiB,CAAER,IAArB,EAA2BS,eAA3B,EAA4CJ,OAA5C,CAxCH;AA0CA,0BAAW,MAAM;AAChBM,IAAAA,gBAAgB,CAACG,OAAjB,GAA2Bf,SAA3B;AACA,UAAMC,IAAI,GAAGF,cAAc,CAAEC,SAAF,CAA3B;;AACA,QAAKa,WAAW,CAACE,OAAZ,KAAwBd,IAA7B,EAAoC;AACnCY,MAAAA,WAAW,CAACE,OAAZ,GAAsBd,IAAtB;AACAU,MAAAA,IAAI,CAAEV,IAAF,CAAJ;AACA;AACD,GAPD,EAOG,CAAED,SAAF,EAAaW,IAAb,CAPH;AAQA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __experimentalUseNavigator as useNavigator } from '@wordpress/components';\nimport { useEffect, useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { useLocation, useHistory } from '../routes';\n\nexport function getPathFromURL( urlParams ) {\n\tlet path = urlParams?.path ?? '/';\n\n\t// Compute the navigator path based on the URL params.\n\tif ( urlParams?.postType && urlParams?.postId ) {\n\t\tswitch ( urlParams.postType ) {\n\t\t\tcase 'wp_template':\n\t\t\tcase 'wp_template_part':\n\t\t\t\tpath = `/${ encodeURIComponent(\n\t\t\t\t\turlParams.postType\n\t\t\t\t) }/${ encodeURIComponent( urlParams.postId ) }`;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tpath = `/navigation/${ encodeURIComponent(\n\t\t\t\t\turlParams.postType\n\t\t\t\t) }/${ encodeURIComponent( urlParams.postId ) }`;\n\t\t}\n\t}\n\n\treturn path;\n}\n\nexport default function useSyncPathWithURL() {\n\tconst history = useHistory();\n\tconst { params: urlParams } = useLocation();\n\tconst {\n\t\tlocation: navigatorLocation,\n\t\tparams: navigatorParams,\n\t\tgoTo,\n\t} = useNavigator();\n\tconst currentUrlParams = useRef( urlParams );\n\tconst currentPath = useRef( navigatorLocation.path );\n\tconst isMounting = useRef( true );\n\n\tuseEffect( () => {\n\t\t// The navigatorParams are only initially filled properly when the\n\t\t// navigator screens mount. so we ignore the first synchronisation.\n\t\tif ( isMounting.current ) {\n\t\t\tisMounting.current = false;\n\t\t\treturn;\n\t\t}\n\n\t\tfunction updateUrlParams( newUrlParams ) {\n\t\t\tif (\n\t\t\t\tObject.entries( newUrlParams ).every( ( [ key, value ] ) => {\n\t\t\t\t\treturn currentUrlParams.current[ key ] === value;\n\t\t\t\t} )\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst updatedParams = {\n\t\t\t\t...currentUrlParams.current,\n\t\t\t\t...newUrlParams,\n\t\t\t};\n\t\t\tcurrentUrlParams.current = updatedParams;\n\t\t\thistory.push( updatedParams );\n\t\t}\n\n\t\tif ( navigatorParams?.postType && navigatorParams?.postId ) {\n\t\t\tupdateUrlParams( {\n\t\t\t\tpostType: navigatorParams?.postType,\n\t\t\t\tpostId: navigatorParams?.postId,\n\t\t\t\tpath: undefined,\n\t\t\t} );\n\t\t} else {\n\t\t\tupdateUrlParams( {\n\t\t\t\tpostType: undefined,\n\t\t\t\tpostId: undefined,\n\t\t\t\tpath:\n\t\t\t\t\tnavigatorLocation.path === '/'\n\t\t\t\t\t\t? undefined\n\t\t\t\t\t\t: navigatorLocation.path,\n\t\t\t} );\n\t\t}\n\t}, [ navigatorLocation?.path, navigatorParams, history ] );\n\n\tuseEffect( () => {\n\t\tcurrentUrlParams.current = urlParams;\n\t\tconst path = getPathFromURL( urlParams );\n\t\tif ( currentPath.current !== path ) {\n\t\t\tcurrentPath.current = path;\n\t\t\tgoTo( path );\n\t\t}\n\t}, [ urlParams, goTo ] );\n}\n"]}
|
|
@@ -52,9 +52,6 @@ function TemplateDetails(_ref) {
|
|
|
52
52
|
} = (0, _data.useDispatch)(_store.store); // TODO: We should update this to filter by template part's areas as well.
|
|
53
53
|
|
|
54
54
|
const browseAllLinkProps = (0, _link.useLink)({
|
|
55
|
-
canvas: 'view',
|
|
56
|
-
postType: template.type,
|
|
57
|
-
postId: undefined,
|
|
58
55
|
path: '/' + template.type + '/all'
|
|
59
56
|
});
|
|
60
57
|
const isTemplatePart = template.type === 'wp_template_part'; // Only user-created and non-default templates can change the name.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/template-details/index.js"],"names":["TemplateDetails","template","onClose","title","description","select","editorStore","__experimentalGetTemplateInfo","revertTemplate","editSiteStore","browseAllLinkProps","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/template-details/index.js"],"names":["TemplateDetails","template","onClose","title","description","select","editorStore","__experimentalGetTemplateInfo","revertTemplate","editSiteStore","browseAllLinkProps","path","type","isTemplatePart","canEditTitle","has_theme_file","is_custom","revert","id"],"mappings":";;;;;;;;;;;;;AAGA;;AACA;;AAOA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AAtBA;AACA;AACA;;AAaA;AACA;AACA;AAOe,SAASA,eAAT,OAAkD;AAAA,MAAxB;AAAEC,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,GAAwB;AAChE,QAAM;AAAEC,IAAAA,KAAF;AAASC,IAAAA;AAAT,MAAyB,qBAC5BC,MAAF,IACCA,MAAM,CA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AD;AAA0B,IAAA,EAAE,EAAGZ,QAAQ,CAACiB;AAAxC,IADD,CA3BF,EAgCG,mCAAsBjB,QAAtB,KACD,4BAAC,qBAAD;AAAW,IAAA,SAAS,EAAC;AAArB,KACC,4BAAC,oBAAD;AACC,IAAA,SAAS,EAAC,2CADX;AAEC,IAAA,IAAI,EAAG,cACN,4CADM,CAFR;AAKC,IAAA,OAAO,EAAGgB;AALX,KAOG,cAAI,sBAAJ,CAPH,CADD,CAjCF,EA8CC,4BAAC,kBAAD;AACC,IAAA,SAAS,EAAC;AADX,KAEMP,kBAFN,GAIG,CAAAT,QAAQ,SAAR,IAAAA,QAAQ,WAAR,YAAAA,QAAQ,CAAEW,IAAV,MAAmB,aAAnB,GACC,cAAI,sBAAJ,CADD,GAEC,cAAI,2BAAJ,CANJ,CA9CD,CADD;AAyDA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tButton,\n\tMenuGroup,\n\tMenuItem,\n\t__experimentalVStack as VStack,\n\t__experimentalText as Text,\n} from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as editorStore } from '@wordpress/editor';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport isTemplateRevertable from '../../utils/is-template-revertable';\nimport { store as editSiteStore } from '../../store';\nimport EditTemplateTitle from './edit-template-title';\nimport { useLink } from '../routes/link';\nimport TemplatePartAreaSelector from './template-part-area-selector';\n\nexport default function TemplateDetails( { template, onClose } ) {\n\tconst { title, description } = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editorStore ).__experimentalGetTemplateInfo( template ),\n\t\t[]\n\t);\n\tconst { revertTemplate } = useDispatch( editSiteStore );\n\n\t// TODO: We should update this to filter by template part's areas as well.\n\tconst browseAllLinkProps = useLink( {\n\t\tpath: '/' + template.type + '/all',\n\t} );\n\n\tconst isTemplatePart = template.type === 'wp_template_part';\n\n\t// Only user-created and non-default templates can change the name.\n\t// But any user-created template part can be renamed.\n\tconst canEditTitle = isTemplatePart\n\t\t? ! template.has_theme_file\n\t\t: template.is_custom && ! template.has_theme_file;\n\n\tif ( ! template ) {\n\t\treturn null;\n\t}\n\n\tconst revert = () => {\n\t\trevertTemplate( template );\n\t\tonClose();\n\t};\n\n\treturn (\n\t\t<div className=\"edit-site-template-details\">\n\t\t\t<VStack className=\"edit-site-template-details__group\" spacing={ 3 }>\n\t\t\t\t{ canEditTitle ? (\n\t\t\t\t\t<EditTemplateTitle template={ template } />\n\t\t\t\t) : (\n\t\t\t\t\t<Text\n\t\t\t\t\t\tsize={ 16 }\n\t\t\t\t\t\tweight={ 600 }\n\t\t\t\t\t\tclassName=\"edit-site-template-details__title\"\n\t\t\t\t\t\tas=\"p\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ decodeEntities( title ) }\n\t\t\t\t\t</Text>\n\t\t\t\t) }\n\n\t\t\t\t{ description && (\n\t\t\t\t\t<Text\n\t\t\t\t\t\tsize=\"body\"\n\t\t\t\t\t\tclassName=\"edit-site-template-details__description\"\n\t\t\t\t\t\tas=\"p\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ decodeEntities( description ) }\n\t\t\t\t\t</Text>\n\t\t\t\t) }\n\t\t\t</VStack>\n\n\t\t\t{ isTemplatePart && (\n\t\t\t\t<div className=\"edit-site-template-details__group\">\n\t\t\t\t\t<TemplatePartAreaSelector id={ template.id } />\n\t\t\t\t</div>\n\t\t\t) }\n\n\t\t\t{ isTemplateRevertable( template ) && (\n\t\t\t\t<MenuGroup className=\"edit-site-template-details__group edit-site-template-details__revert\">\n\t\t\t\t\t<MenuItem\n\t\t\t\t\t\tclassName=\"edit-site-template-details__revert-button\"\n\t\t\t\t\t\tinfo={ __(\n\t\t\t\t\t\t\t'Use the template as supplied by the theme.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tonClick={ revert }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Clear customizations' ) }\n\t\t\t\t\t</MenuItem>\n\t\t\t\t</MenuGroup>\n\t\t\t) }\n\n\t\t\t<Button\n\t\t\t\tclassName=\"edit-site-template-details__show-all-button\"\n\t\t\t\t{ ...browseAllLinkProps }\n\t\t\t>\n\t\t\t\t{ template?.type === 'wp_template'\n\t\t\t\t\t? __( 'Manage all templates' )\n\t\t\t\t\t: __( 'Manage all template parts' ) }\n\t\t\t</Button>\n\t\t</div>\n\t);\n}\n"]}
|
|
@@ -20,7 +20,8 @@ var _i18n = require("@wordpress/i18n");
|
|
|
20
20
|
*/
|
|
21
21
|
function ConvertToRegularBlocks(_ref) {
|
|
22
22
|
let {
|
|
23
|
-
clientId
|
|
23
|
+
clientId,
|
|
24
|
+
onClose
|
|
24
25
|
} = _ref;
|
|
25
26
|
const {
|
|
26
27
|
getBlocks
|
|
@@ -34,16 +35,11 @@ function ConvertToRegularBlocks(_ref) {
|
|
|
34
35
|
return null;
|
|
35
36
|
}
|
|
36
37
|
|
|
37
|
-
return (0, _element.createElement)(
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
replaceBlocks(clientId, getBlocks(clientId));
|
|
44
|
-
onClose();
|
|
45
|
-
}
|
|
46
|
-
}, (0, _i18n.__)('Detach blocks from template part'));
|
|
47
|
-
});
|
|
38
|
+
return (0, _element.createElement)(_components.MenuItem, {
|
|
39
|
+
onClick: () => {
|
|
40
|
+
replaceBlocks(clientId, getBlocks(clientId));
|
|
41
|
+
onClose();
|
|
42
|
+
}
|
|
43
|
+
}, (0, _i18n.__)('Detach blocks from template part'));
|
|
48
44
|
}
|
|
49
45
|
//# sourceMappingURL=convert-to-regular.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/template-part-converter/convert-to-regular.js"],"names":["ConvertToRegularBlocks","clientId","getBlocks","blockEditorStore","replaceBlocks","canRemove","select","canRemoveBlock"
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/template-part-converter/convert-to-regular.js"],"names":["ConvertToRegularBlocks","clientId","onClose","getBlocks","blockEditorStore","replaceBlocks","canRemove","select","canRemoveBlock"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AANA;AACA;AACA;AAMe,SAASA,sBAAT,OAAyD;AAAA,MAAxB;AAAEC,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,GAAwB;AACvE,QAAM;AAAEC,IAAAA;AAAF,MAAgB,qBAAWC,kBAAX,CAAtB;AACA,QAAM;AAAEC,IAAAA;AAAF,MAAoB,uBAAaD,kBAAb,CAA1B;AAEA,QAAME,SAAS,GAAG,qBACfC,MAAF,IAAcA,MAAM,CAAEH,kBAAF,CAAN,CAA2BI,cAA3B,CAA2CP,QAA3C,CADG,EAEjB,CAAEA,QAAF,CAFiB,CAAlB;;AAKA,MAAK,CAAEK,SAAP,EAAmB;AAClB,WAAO,IAAP;AACA;;AAED,SACC,4BAAC,oBAAD;AACC,IAAA,OAAO,EAAG,MAAM;AACfD,MAAAA,aAAa,CAAEJ,QAAF,EAAYE,SAAS,CAAEF,QAAF,CAArB,CAAb;AACAC,MAAAA,OAAO;AACP;AAJF,KAMG,cAAI,kCAAJ,CANH,CADD;AAUA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { MenuItem } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\nexport default function ConvertToRegularBlocks( { clientId, onClose } ) {\n\tconst { getBlocks } = useSelect( blockEditorStore );\n\tconst { replaceBlocks } = useDispatch( blockEditorStore );\n\n\tconst canRemove = useSelect(\n\t\t( select ) => select( blockEditorStore ).canRemoveBlock( clientId ),\n\t\t[ clientId ]\n\t);\n\n\tif ( ! canRemove ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<MenuItem\n\t\t\tonClick={ () => {\n\t\t\t\treplaceBlocks( clientId, getBlocks( clientId ) );\n\t\t\t\tonClose();\n\t\t\t} }\n\t\t>\n\t\t\t{ __( 'Detach blocks from template part' ) }\n\t\t</MenuItem>\n\t);\n}\n"]}
|
|
@@ -92,12 +92,12 @@ function ConvertToTemplatePart(_ref) {
|
|
|
92
92
|
// so no need to call `closeModal` or `onClose`.
|
|
93
93
|
};
|
|
94
94
|
|
|
95
|
-
return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(
|
|
95
|
+
return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_components.MenuItem, {
|
|
96
96
|
icon: _icons.symbolFilled,
|
|
97
97
|
onClick: () => {
|
|
98
98
|
setIsModalOpen(true);
|
|
99
99
|
}
|
|
100
|
-
}, (0, _i18n.__)('Create Template part'))
|
|
100
|
+
}, (0, _i18n.__)('Create Template part')), isModalOpen && (0, _element.createElement)(_createTemplatePartModal.default, {
|
|
101
101
|
closeModal: () => {
|
|
102
102
|
setIsModalOpen(false);
|
|
103
103
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/template-part-converter/convert-to-template-part.js"],"names":["ConvertToTemplatePart","clientIds","blocks","isModalOpen","setIsModalOpen","replaceBlocks","blockEditorStore","saveEntityRecord","coreStore","createSuccessNotice","noticesStore","existingTemplateParts","canCreate","select","supportsTemplatePartsMode","editSiteStore","getSettings","onConvert","title","area","uniqueTitle","cleanSlug","templatePart","slug","content","theme","type","symbolFilled"],"mappings":";;;;;;;;;
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/template-part-converter/convert-to-template-part.js"],"names":["ConvertToTemplatePart","clientIds","blocks","isModalOpen","setIsModalOpen","replaceBlocks","blockEditorStore","saveEntityRecord","coreStore","createSuccessNotice","noticesStore","existingTemplateParts","canCreate","select","supportsTemplatePartsMode","editSiteStore","getSettings","onConvert","title","area","uniqueTitle","cleanSlug","templatePart","slug","content","theme","type","symbolFilled"],"mappings":";;;;;;;;;AAQA;;AALA;;AACA;;AACA;;AACA;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AClCsB,MAAAA,IAAI,EAAED,YAAY,CAACC,IADe;AAElCE,MAAAA,KAAK,EAAEH,YAAY,CAACG;AAFc,KAAnC,CAFY,CAAb;AAOAhB,IAAAA,mBAAmB,CAAE,cAAI,wBAAJ,CAAF,EAAkC;AACpDiB,MAAAA,IAAI,EAAE;AAD8C,KAAlC,CAAnB,CAxB8C,CA4B9C;AACA;AACA,GA9BD;;AAgCA,SACC,qDACC,4BAAC,oBAAD;AACC,IAAA,IAAI,EAAGC,mBADR;AAEC,IAAA,OAAO,EAAG,MAAM;AACfvB,MAAAA,cAAc,CAAE,IAAF,CAAd;AACA;AAJF,KAMG,cAAI,sBAAJ,CANH,CADD,EASGD,WAAW,IACZ,4BAAC,gCAAD;AACC,IAAA,UAAU,EAAG,MAAM;AAClBC,MAAAA,cAAc,CAAE,KAAF,CAAd;AACA,KAHF;AAIC,IAAA,QAAQ,EAAGa;AAJZ,IAVF,CADD;AAoBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { MenuItem } from '@wordpress/components';\nimport { createBlock, serialize } from '@wordpress/blocks';\nimport { __ } from '@wordpress/i18n';\nimport { useState } from '@wordpress/element';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { symbolFilled } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport CreateTemplatePartModal from '../create-template-part-modal';\nimport { store as editSiteStore } from '../../store';\nimport {\n\tuseExistingTemplateParts,\n\tgetUniqueTemplatePartTitle,\n\tgetCleanTemplatePartSlug,\n} from '../../utils/template-part-create';\n\nexport default function ConvertToTemplatePart( { clientIds, blocks } ) {\n\tconst [ isModalOpen, setIsModalOpen ] = useState( false );\n\tconst { replaceBlocks } = useDispatch( blockEditorStore );\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\tconst existingTemplateParts = useExistingTemplateParts();\n\n\tconst { canCreate } = useSelect( ( select ) => {\n\t\tconst { supportsTemplatePartsMode } =\n\t\t\tselect( editSiteStore ).getSettings();\n\t\treturn {\n\t\t\tcanCreate: ! supportsTemplatePartsMode,\n\t\t};\n\t}, [] );\n\n\tif ( ! canCreate ) {\n\t\treturn null;\n\t}\n\n\tconst onConvert = async ( { title, area } ) => {\n\t\tconst uniqueTitle = getUniqueTemplatePartTitle(\n\t\t\ttitle,\n\t\t\texistingTemplateParts\n\t\t);\n\t\tconst cleanSlug = getCleanTemplatePartSlug( uniqueTitle );\n\n\t\tconst templatePart = await saveEntityRecord(\n\t\t\t'postType',\n\t\t\t'wp_template_part',\n\t\t\t{\n\t\t\t\tslug: cleanSlug,\n\t\t\t\ttitle: uniqueTitle,\n\t\t\t\tcontent: serialize( blocks ),\n\t\t\t\tarea,\n\t\t\t}\n\t\t);\n\t\treplaceBlocks(\n\t\t\tclientIds,\n\t\t\tcreateBlock( 'core/template-part', {\n\t\t\t\tslug: templatePart.slug,\n\t\t\t\ttheme: templatePart.theme,\n\t\t\t} )\n\t\t);\n\t\tcreateSuccessNotice( __( 'Template part created.' ), {\n\t\t\ttype: 'snackbar',\n\t\t} );\n\n\t\t// The modal and this component will be unmounted because of `replaceBlocks` above,\n\t\t// so no need to call `closeModal` or `onClose`.\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<MenuItem\n\t\t\t\ticon={ symbolFilled }\n\t\t\t\tonClick={ () => {\n\t\t\t\t\tsetIsModalOpen( true );\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ __( 'Create Template part' ) }\n\t\t\t</MenuItem>\n\t\t\t{ isModalOpen && (\n\t\t\t\t<CreateTemplatePartModal\n\t\t\t\t\tcloseModal={ () => {\n\t\t\t\t\t\tsetIsModalOpen( false );\n\t\t\t\t\t} }\n\t\t\t\t\tonCreate={ onConvert }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"]}
|
|
@@ -25,26 +25,31 @@ var _convertToTemplatePart = _interopRequireDefault(require("./convert-to-templa
|
|
|
25
25
|
* Internal dependencies
|
|
26
26
|
*/
|
|
27
27
|
function TemplatePartConverter() {
|
|
28
|
+
return (0, _element.createElement)(_blockEditor.BlockSettingsMenuControls, null, _ref => {
|
|
29
|
+
let {
|
|
30
|
+
selectedClientIds,
|
|
31
|
+
onClose
|
|
32
|
+
} = _ref;
|
|
33
|
+
return (0, _element.createElement)(TemplatePartConverterMenuItem, {
|
|
34
|
+
clientIds: selectedClientIds,
|
|
35
|
+
onClose: onClose
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function TemplatePartConverterMenuItem(_ref2) {
|
|
28
41
|
var _blocks$;
|
|
29
42
|
|
|
30
|
-
|
|
43
|
+
let {
|
|
31
44
|
clientIds,
|
|
32
|
-
|
|
33
|
-
} =
|
|
34
|
-
|
|
35
|
-
getSelectedBlockClientIds,
|
|
36
|
-
getBlocksByClientId
|
|
37
|
-
} = select(_blockEditor.store);
|
|
38
|
-
const selectedBlockClientIds = getSelectedBlockClientIds();
|
|
39
|
-
return {
|
|
40
|
-
clientIds: selectedBlockClientIds,
|
|
41
|
-
blocks: getBlocksByClientId(selectedBlockClientIds)
|
|
42
|
-
};
|
|
43
|
-
}, []); // Allow converting a single template part to standard blocks.
|
|
45
|
+
onClose
|
|
46
|
+
} = _ref2;
|
|
47
|
+
const blocks = (0, _data.useSelect)(select => select(_blockEditor.store).getBlocksByClientId(clientIds), [clientIds]); // Allow converting a single template part to standard blocks.
|
|
44
48
|
|
|
45
49
|
if (blocks.length === 1 && ((_blocks$ = blocks[0]) === null || _blocks$ === void 0 ? void 0 : _blocks$.name) === 'core/template-part') {
|
|
46
50
|
return (0, _element.createElement)(_convertToRegular.default, {
|
|
47
|
-
clientId: clientIds[0]
|
|
51
|
+
clientId: clientIds[0],
|
|
52
|
+
onClose: onClose
|
|
48
53
|
});
|
|
49
54
|
}
|
|
50
55
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/template-part-converter/index.js"],"names":["TemplatePartConverter","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/template-part-converter/index.js"],"names":["TemplatePartConverter","selectedClientIds","onClose","TemplatePartConverterMenuItem","clientIds","blocks","select","blockEditorStore","getBlocksByClientId","length","name"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AAQA;;AACA;;AAbA;AACA;AACA;;AAOA;AACA;AACA;AAIe,SAASA,qBAAT,GAAiC;AAC/C,SACC,4BAAC,sCAAD,QACG;AAAA,QAAE;AAAEC,MAAAA,iBAAF;AAAqBC,MAAAA;AAArB,KAAF;AAAA,WACD,4BAAC,6BAAD;AACC,MAAA,SAAS,EAAGD,iBADb;AAEC,MAAA,OAAO,EAAGC;AAFX,MADC;AAAA,GADH,CADD;AAUA;;AAED,SAASC,6BAAT,QAAiE;AAAA;;AAAA,MAAzB;AAAEC,IAAAA,SAAF;AAAaF,IAAAA;AAAb,GAAyB;AAChE,QAAMG,MAAM,GAAG,qBACZC,MAAF,IACCA,MAAM,CAAEC,kBAAF,CAAN,CAA2BC,mBAA3B,CAAgDJ,SAAhD,CAFa,EAGd,CAAEA,SAAF,CAHc,CAAf,CADgE,CAOhE;;AACA,MAAKC,MAAM,CAACI,MAAP,KAAkB,CAAlB,IAAuB,aAAAJ,MAAM,CAAE,CAAF,CAAN,sDAAaK,IAAb,MAAsB,oBAAlD,EAAyE;AACxE,WACC,4BAAC,yBAAD;AACC,MAAA,QAAQ,EAAGN,SAAS,CAAE,CAAF,CADrB;AAEC,MAAA,OAAO,EAAGF;AAFX,MADD;AAMA;;AACD,SAAO,4BAAC,8BAAD;AAAuB,IAAA,SAAS,EAAGE,SAAnC;AAA+C,IAAA,MAAM,EAAGC;AAAxD,IAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport {\n\tBlockSettingsMenuControls,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport ConvertToRegularBlocks from './convert-to-regular';\nimport ConvertToTemplatePart from './convert-to-template-part';\n\nexport default function TemplatePartConverter() {\n\treturn (\n\t\t<BlockSettingsMenuControls>\n\t\t\t{ ( { selectedClientIds, onClose } ) => (\n\t\t\t\t<TemplatePartConverterMenuItem\n\t\t\t\t\tclientIds={ selectedClientIds }\n\t\t\t\t\tonClose={ onClose }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</BlockSettingsMenuControls>\n\t);\n}\n\nfunction TemplatePartConverterMenuItem( { clientIds, onClose } ) {\n\tconst blocks = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockEditorStore ).getBlocksByClientId( clientIds ),\n\t\t[ clientIds ]\n\t);\n\n\t// Allow converting a single template part to standard blocks.\n\tif ( blocks.length === 1 && blocks[ 0 ]?.name === 'core/template-part' ) {\n\t\treturn (\n\t\t\t<ConvertToRegularBlocks\n\t\t\t\tclientId={ clientIds[ 0 ] }\n\t\t\t\tonClose={ onClose }\n\t\t\t/>\n\t\t);\n\t}\n\treturn <ConvertToTemplatePart clientIds={ clientIds } blocks={ blocks } />;\n}\n"]}
|
|
@@ -22,7 +22,7 @@ var _store = require("../../store");
|
|
|
22
22
|
/**
|
|
23
23
|
* Internal dependencies
|
|
24
24
|
*/
|
|
25
|
-
function useEditedEntityRecord() {
|
|
25
|
+
function useEditedEntityRecord(postType, postId) {
|
|
26
26
|
const {
|
|
27
27
|
record,
|
|
28
28
|
title,
|
|
@@ -39,12 +39,12 @@ function useEditedEntityRecord() {
|
|
|
39
39
|
const {
|
|
40
40
|
__experimentalGetTemplateInfo: getTemplateInfo
|
|
41
41
|
} = select(_editor.store);
|
|
42
|
-
const
|
|
43
|
-
const
|
|
42
|
+
const usedPostType = postType !== null && postType !== void 0 ? postType : getEditedPostType();
|
|
43
|
+
const usedPostId = postId !== null && postId !== void 0 ? postId : getEditedPostId();
|
|
44
44
|
|
|
45
|
-
const _record = getEditedEntityRecord('postType',
|
|
45
|
+
const _record = getEditedEntityRecord('postType', usedPostType, usedPostId);
|
|
46
46
|
|
|
47
|
-
const _isLoaded = !!
|
|
47
|
+
const _isLoaded = !!usedPostId;
|
|
48
48
|
|
|
49
49
|
const templateInfo = getTemplateInfo(_record);
|
|
50
50
|
return {
|
|
@@ -53,7 +53,7 @@ function useEditedEntityRecord() {
|
|
|
53
53
|
description: templateInfo.description,
|
|
54
54
|
isLoaded: _isLoaded
|
|
55
55
|
};
|
|
56
|
-
}, []);
|
|
56
|
+
}, [postType, postId]);
|
|
57
57
|
return {
|
|
58
58
|
isLoaded,
|
|
59
59
|
record,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/use-edited-entity-record/index.js"],"names":["useEditedEntityRecord","record","title","description","isLoaded","select","getEditedPostType","getEditedPostId","editSiteStore","getEditedEntityRecord","coreStore","__experimentalGetTemplateInfo","getTemplateInfo","editorStore","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/use-edited-entity-record/index.js"],"names":["useEditedEntityRecord","postType","postId","record","title","description","isLoaded","select","getEditedPostType","getEditedPostId","editSiteStore","getEditedEntityRecord","coreStore","__experimentalGetTemplateInfo","getTemplateInfo","editorStore","usedPostType","usedPostId","_record","_isLoaded","templateInfo","getTitle","getDescription"],"mappings":";;;;;;;AAGA;;AACA;;AACA;;AACA;;AAKA;;AAXA;AACA;AACA;;AAMA;AACA;AACA;AAGe,SAASA,qBAAT,CAAgCC,QAAhC,EAA0CC,MAA1C,EAAmD;AACjE,QAAM;AAAEC,IAAAA,MAAF;AAAUC,IAAAA,KAAV;AAAiBC,IAAAA,WAAjB;AAA8BC,IAAAA;AAA9B,MAA2C,qBAC9CC,MAAF,IAAc;AACb,UAAM;AAAEC,MAAAA,iBAAF;AAAqBC,MAAAA;AAArB,QACLF,MAAM,CAAEG,YAAF,CADP;AAEA,UAAM;AAAEC,MAAAA;AAAF,QAA4BJ,MAAM,CAAEK,eAAF,CAAxC;AACA,UAAM;AAAEC,MAAAA,6BAA6B,EAAEC;AAAjC,QACLP,MAAM,CAAEQ,aAAF,CADP;AAEA,UAAMC,YAAY,GAAGf,QAAH,aAAGA,QAAH,cAAGA,QAAH,GAAeO,iBAAiB,EAAlD;AACA,UAAMS,UAAU,GAAGf,MAAH,aAAGA,MAAH,cAAGA,MAAH,GAAaO,eAAe,EAA5C;;AACA,UAAMS,OAAO,GAAGP,qBAAqB,CACpC,UADoC,EAEpCK,YAFoC,EAGpCC,UAHoC,CAArC;;AAKA,UAAME,SAAS,GAAG,CAAC,CAAEF,UAArB;;AACA,UAAMG,YAAY,GAAGN,eAAe,CAAEI,OAAF,CAApC;AAEA,WAAO;AACNf,MAAAA,MAAM,EAAEe,OADF;AAENd,MAAAA,KAAK,EAAEgB,YAAY,CAAChB,KAFd;AAGNC,MAAAA,WAAW,EAAEe,YAAY,CAACf,WAHpB;AAINC,MAAAA,QAAQ,EAAEa;AAJJ,KAAP;AAMA,GAvB+C,EAwBhD,CAAElB,QAAF,EAAYC,MAAZ,CAxBgD,CAAjD;AA2BA,SAAO;AACNI,IAAAA,QADM;AAENH,IAAAA,MAFM;AAGNkB,IAAAA,QAAQ,EAAE,MAAQjB,KAAK,GAAG,kCAAgBA,KAAhB,CAAH,GAA6B,IAH9C;AAINkB,IAAAA,cAAc,EAAE,MACfjB,WAAW,GAAG,kCAAgBA,WAAhB,CAAH,GAAmC;AALzC,GAAP;AAOA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as editorStore } from '@wordpress/editor';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\n\nexport default function useEditedEntityRecord( postType, postId ) {\n\tconst { record, title, description, isLoaded } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedPostType, getEditedPostId } =\n\t\t\t\tselect( editSiteStore );\n\t\t\tconst { getEditedEntityRecord } = select( coreStore );\n\t\t\tconst { __experimentalGetTemplateInfo: getTemplateInfo } =\n\t\t\t\tselect( editorStore );\n\t\t\tconst usedPostType = postType ?? getEditedPostType();\n\t\t\tconst usedPostId = postId ?? getEditedPostId();\n\t\t\tconst _record = getEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tusedPostType,\n\t\t\t\tusedPostId\n\t\t\t);\n\t\t\tconst _isLoaded = !! usedPostId;\n\t\t\tconst templateInfo = getTemplateInfo( _record );\n\n\t\t\treturn {\n\t\t\t\trecord: _record,\n\t\t\t\ttitle: templateInfo.title,\n\t\t\t\tdescription: templateInfo.description,\n\t\t\t\tisLoaded: _isLoaded,\n\t\t\t};\n\t\t},\n\t\t[ postType, postId ]\n\t);\n\n\treturn {\n\t\tisLoaded,\n\t\trecord,\n\t\tgetTitle: () => ( title ? decodeEntities( title ) : null ),\n\t\tgetDescription: () =>\n\t\t\tdescription ? decodeEntities( description ) : null,\n\t};\n}\n"]}
|
|
@@ -52,6 +52,7 @@ const STYLE_PATH_TO_CSS_VAR_INFIX = {
|
|
|
52
52
|
'elements.button.color.background': 'color',
|
|
53
53
|
'elements.button.typography.fontFamily': 'font-family',
|
|
54
54
|
'elements.button.typography.fontSize': 'font-size',
|
|
55
|
+
'elements.caption.color.text': 'color',
|
|
55
56
|
'elements.heading.color': 'color',
|
|
56
57
|
'elements.heading.color.background': 'color',
|
|
57
58
|
'elements.heading.typography.fontFamily': 'font-family',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/hooks/push-changes-to-global-styles/index.js"],"names":["GlobalStylesContext","blockEditorPrivateApis","STYLE_PATH_TO_CSS_VAR_INFIX","STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE","useChangesToPush","name","attributes","supports","flatMap","key","STYLE_PROPERTY","value","path","presetAttributeKey","join","presetAttributeValue","style","cloneDeep","object","JSON","parse","stringify","PushChangesToGlobalStylesControl","setAttributes","changes","user","userConfig","setUserConfig","__unstableMarkNextChangeAsNotPersistent","blockEditorStore","createSuccessNotice","noticesStore","pushChanges","length","blockStyles","newBlockStyles","newUserConfig","undefined","undoIgnore","title","type","actions","label","onClick","withPushChangesToGlobalStyles","BlockEdit","props"],"mappings":";;AAqBA;;AAlBA;;AAKA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AAKA;;AACA;;AAKA;;AACA;;AA7BA;AACA;AACA;;AAGA;AACA;AACA;;AAkBA;AACA;AACA;AAIA,MAAM;AAAEA,EAAAA;AAAF,IAA0B,yBAAQC,wBAAR,CAAhC,C,CAEA;AACA;AACA;;AACA,MAAMC,2BAA2B,GAAG;AACnC,sBAAoB,OADe;AAEnC,gBAAc,OAFqB;AAGnC,8BAA4B,OAHO;AAInC,qCAAmC,OAJA;AAKnC,yCAAuC,aALJ;AAMnC,uCAAqC,WANF;AAOnC,gCAA8B,OAPK;AAQnC,sCAAoC,OARD;AASnC,2CAAyC,aATN;AAUnC,yCAAuC,WAVJ;AAWnC,4BAA0B,OAXS;AAYnC,uCAAqC,OAZF;AAanC,4CAA0C,aAbP;AAcnC,+BAA6B,UAdM;AAenC,qCAAmC,UAfA;AAgBnC,uBAAqB,OAhBc;AAiBnC,kCAAgC,OAjBG;AAkBnC,uCAAqC,aAlBF;AAmBnC,gCAA8B,UAnBK;AAoBnC,uBAAqB,OApBc;AAqBnC,kCAAgC,OArBG;AAsBnC,uCAAqC,aAtBF;AAuBnC,gCAA8B,UAvBK;AAwBnC,uBAAqB,OAxBc;AAyBnC,kCAAgC,OAzBG;AA0BnC,uCAAqC,aA1BF;AA2BnC,gCAA8B,UA3BK;AA4BnC,uBAAqB,OA5Bc;AA6BnC,kCAAgC,OA7BG;AA8BnC,uCAAqC,aA9BF;AA+BnC,gCAA8B,UA/BK;AAgCnC,uBAAqB,OAhCc;AAiCnC,kCAAgC,OAjCG;AAkCnC,uCAAqC,aAlCF;AA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* External dependencies\n */\nimport { get, set } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport {\n\tInspectorAdvancedControls,\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { BaseControl, Button } from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\t__EXPERIMENTAL_STYLE_PROPERTY as STYLE_PROPERTY,\n\tgetBlockType,\n} from '@wordpress/blocks';\nimport { useContext, useMemo, useCallback } from '@wordpress/element';\nimport { useDispatch } from '@wordpress/data';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport { useSupportedStyles } from '../../components/global-styles/hooks';\nimport { unlock } from '../../private-apis';\n\nconst { GlobalStylesContext } = unlock( blockEditorPrivateApis );\n\n// TODO: Temporary duplication of constant in @wordpress/block-editor. Can be\n// removed by moving PushChangesToGlobalStylesControl to\n// @wordpress/block-editor.\nconst STYLE_PATH_TO_CSS_VAR_INFIX = {\n\t'color.background': 'color',\n\t'color.text': 'color',\n\t'elements.link.color.text': 'color',\n\t'elements.link.:hover.color.text': 'color',\n\t'elements.link.typography.fontFamily': 'font-family',\n\t'elements.link.typography.fontSize': 'font-size',\n\t'elements.button.color.text': 'color',\n\t'elements.button.color.background': 'color',\n\t'elements.button.typography.fontFamily': 'font-family',\n\t'elements.button.typography.fontSize': 'font-size',\n\t'elements.heading.color': 'color',\n\t'elements.heading.color.background': 'color',\n\t'elements.heading.typography.fontFamily': 'font-family',\n\t'elements.heading.gradient': 'gradient',\n\t'elements.heading.color.gradient': 'gradient',\n\t'elements.h1.color': 'color',\n\t'elements.h1.color.background': 'color',\n\t'elements.h1.typography.fontFamily': 'font-family',\n\t'elements.h1.color.gradient': 'gradient',\n\t'elements.h2.color': 'color',\n\t'elements.h2.color.background': 'color',\n\t'elements.h2.typography.fontFamily': 'font-family',\n\t'elements.h2.color.gradient': 'gradient',\n\t'elements.h3.color': 'color',\n\t'elements.h3.color.background': 'color',\n\t'elements.h3.typography.fontFamily': 'font-family',\n\t'elements.h3.color.gradient': 'gradient',\n\t'elements.h4.color': 'color',\n\t'elements.h4.color.background': 'color',\n\t'elements.h4.typography.fontFamily': 'font-family',\n\t'elements.h4.color.gradient': 'gradient',\n\t'elements.h5.color': 'color',\n\t'elements.h5.color.background': 'color',\n\t'elements.h5.typography.fontFamily': 'font-family',\n\t'elements.h5.color.gradient': 'gradient',\n\t'elements.h6.color': 'color',\n\t'elements.h6.color.background': 'color',\n\t'elements.h6.typography.fontFamily': 'font-family',\n\t'elements.h6.color.gradient': 'gradient',\n\t'color.gradient': 'gradient',\n\t'typography.fontSize': 'font-size',\n\t'typography.fontFamily': 'font-family',\n};\n\n// TODO: Temporary duplication of constant in @wordpress/block-editor. Can be\n// removed by moving PushChangesToGlobalStylesControl to\n// @wordpress/block-editor.\nconst STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE = {\n\t'color.background': 'backgroundColor',\n\t'color.text': 'textColor',\n\t'color.gradient': 'gradient',\n\t'typography.fontSize': 'fontSize',\n\t'typography.fontFamily': 'fontFamily',\n};\n\nfunction useChangesToPush( name, attributes ) {\n\tconst supports = useSupportedStyles( name );\n\n\treturn useMemo(\n\t\t() =>\n\t\t\tsupports.flatMap( ( key ) => {\n\t\t\t\tif ( ! STYLE_PROPERTY[ key ] ) {\n\t\t\t\t\treturn [];\n\t\t\t\t}\n\t\t\t\tconst { value: path } = STYLE_PROPERTY[ key ];\n\t\t\t\tconst presetAttributeKey = path.join( '.' );\n\t\t\t\tconst presetAttributeValue =\n\t\t\t\t\tattributes[\n\t\t\t\t\t\tSTYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE[\n\t\t\t\t\t\t\tpresetAttributeKey\n\t\t\t\t\t\t]\n\t\t\t\t\t];\n\t\t\t\tconst value = presetAttributeValue\n\t\t\t\t\t? `var:preset|${ STYLE_PATH_TO_CSS_VAR_INFIX[ presetAttributeKey ] }|${ presetAttributeValue }`\n\t\t\t\t\t: get( attributes.style, path );\n\t\t\t\treturn value ? [ { path, value } ] : [];\n\t\t\t} ),\n\t\t[ supports, name, attributes ]\n\t);\n}\n\nfunction cloneDeep( object ) {\n\treturn ! object ? {} : JSON.parse( JSON.stringify( object ) );\n}\n\nfunction PushChangesToGlobalStylesControl( {\n\tname,\n\tattributes,\n\tsetAttributes,\n} ) {\n\tconst changes = useChangesToPush( name, attributes );\n\n\tconst { user: userConfig, setUserConfig } =\n\t\tuseContext( GlobalStylesContext );\n\n\tconst { __unstableMarkNextChangeAsNotPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\n\tconst pushChanges = useCallback( () => {\n\t\tif ( changes.length === 0 ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { style: blockStyles } = attributes;\n\n\t\tconst newBlockStyles = cloneDeep( blockStyles );\n\t\tconst newUserConfig = cloneDeep( userConfig );\n\n\t\tfor ( const { path, value } of changes ) {\n\t\t\tset( newBlockStyles, path, undefined );\n\t\t\tset( newUserConfig, [ 'styles', 'blocks', name, ...path ], value );\n\t\t}\n\n\t\t// @wordpress/core-data doesn't support editing multiple entity types in\n\t\t// a single undo level. So for now, we disable @wordpress/core-data undo\n\t\t// tracking and implement our own Undo button in the snackbar\n\t\t// notification.\n\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\tsetAttributes( { style: newBlockStyles } );\n\t\tsetUserConfig( () => newUserConfig, { undoIgnore: true } );\n\n\t\tcreateSuccessNotice(\n\t\t\tsprintf(\n\t\t\t\t// translators: %s: Title of the block e.g. 'Heading'.\n\t\t\t\t__( '%s styles applied.' ),\n\t\t\t\tgetBlockType( name ).title\n\t\t\t),\n\t\t\t{\n\t\t\t\ttype: 'snackbar',\n\t\t\t\tactions: [\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: __( 'Undo' ),\n\t\t\t\t\t\tonClick() {\n\t\t\t\t\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\t\t\t\t\tsetAttributes( { style: blockStyles } );\n\t\t\t\t\t\t\tsetUserConfig( () => userConfig, {\n\t\t\t\t\t\t\t\tundoIgnore: true,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t}\n\t\t);\n\t}, [ changes, attributes, userConfig, name ] );\n\n\treturn (\n\t\t<BaseControl\n\t\t\tclassName=\"edit-site-push-changes-to-global-styles-control\"\n\t\t\thelp={ sprintf(\n\t\t\t\t// translators: %s: Title of the block e.g. 'Heading'.\n\t\t\t\t__(\n\t\t\t\t\t'Apply this block’s typography, spacing, dimensions, and color styles to all %s blocks.'\n\t\t\t\t),\n\t\t\t\tgetBlockType( name ).title\n\t\t\t) }\n\t\t>\n\t\t\t<BaseControl.VisualLabel>\n\t\t\t\t{ __( 'Styles' ) }\n\t\t\t</BaseControl.VisualLabel>\n\t\t\t<Button\n\t\t\t\tvariant=\"primary\"\n\t\t\t\tdisabled={ changes.length === 0 }\n\t\t\t\tonClick={ pushChanges }\n\t\t\t>\n\t\t\t\t{ __( 'Apply globally' ) }\n\t\t\t</Button>\n\t\t</BaseControl>\n\t);\n}\n\nconst withPushChangesToGlobalStyles = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) =>\n\t\t(\n\t\t\t<>\n\t\t\t\t<BlockEdit { ...props } />\n\t\t\t\t<InspectorAdvancedControls>\n\t\t\t\t\t<PushChangesToGlobalStylesControl { ...props } />\n\t\t\t\t</InspectorAdvancedControls>\n\t\t\t</>\n\t\t)\n);\n\naddFilter(\n\t'editor.BlockEdit',\n\t'core/edit-site/push-changes-to-global-styles',\n\twithPushChangesToGlobalStyles\n);\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/hooks/push-changes-to-global-styles/index.js"],"names":["GlobalStylesContext","blockEditorPrivateApis","STYLE_PATH_TO_CSS_VAR_INFIX","STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE","useChangesToPush","name","attributes","supports","flatMap","key","STYLE_PROPERTY","value","path","presetAttributeKey","join","presetAttributeValue","style","cloneDeep","object","JSON","parse","stringify","PushChangesToGlobalStylesControl","setAttributes","changes","user","userConfig","setUserConfig","__unstableMarkNextChangeAsNotPersistent","blockEditorStore","createSuccessNotice","noticesStore","pushChanges","length","blockStyles","newBlockStyles","newUserConfig","undefined","undoIgnore","title","type","actions","label","onClick","withPushChangesToGlobalStyles","BlockEdit","props"],"mappings":";;AAqBA;;AAlBA;;AAKA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AAKA;;AACA;;AAKA;;AACA;;AA7BA;AACA;AACA;;AAGA;AACA;AACA;;AAkBA;AACA;AACA;AAIA,MAAM;AAAEA,EAAAA;AAAF,IAA0B,yBAAQC,wBAAR,CAAhC,C,CAEA;AACA;AACA;;AACA,MAAMC,2BAA2B,GAAG;AACnC,sBAAoB,OADe;AAEnC,gBAAc,OAFqB;AAGnC,8BAA4B,OAHO;AAInC,qCAAmC,OAJA;AAKnC,yCAAuC,aALJ;AAMnC,uCAAqC,WANF;AAOnC,gCAA8B,OAPK;AAQnC,sCAAoC,OARD;AASnC,2CAAyC,aATN;AAUnC,yCAAuC,WAVJ;AAWnC,iCAA+B,OAXI;AAYnC,4BAA0B,OAZS;AAanC,uCAAqC,OAbF;AAcnC,4CAA0C,aAdP;AAenC,+BAA6B,UAfM;AAgBnC,qCAAmC,UAhBA;AAiBnC,uBAAqB,OAjBc;AAkBnC,kCAAgC,OAlBG;AAmBnC,uCAAqC,aAnBF;AAoBnC,gCAA8B,UApBK;AAqBnC,uBAAqB,OArBc;AAsBnC,kCAAgC,OAtBG;AAuBnC,uCAAqC,aAvBF;AAwBnC,gCAA8B,UAxBK;AAyBnC,uBAAqB,OAzBc;AA0BnC,kCAAgC,OA1BG;AA2BnC,uCAAqC,aA3BF;AA4BnC,gCAA8B,UA5BK;AA6BnC,uBAAqB,OA7Bc;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,CADD,EAEC,4BAAC,sCAAD,QACC,4BAAC,gCAAD,EAAuCA,KAAvC,CADD,CAFD,CAHmC,CAAtC;AAYA,sBACC,kBADD,EAEC,8CAFD,EAGCF,6BAHD","sourcesContent":["/**\n * External dependencies\n */\nimport { get, set } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport {\n\tInspectorAdvancedControls,\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { BaseControl, Button } from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\t__EXPERIMENTAL_STYLE_PROPERTY as STYLE_PROPERTY,\n\tgetBlockType,\n} from '@wordpress/blocks';\nimport { useContext, useMemo, useCallback } from '@wordpress/element';\nimport { useDispatch } from '@wordpress/data';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport { useSupportedStyles } from '../../components/global-styles/hooks';\nimport { unlock } from '../../private-apis';\n\nconst { GlobalStylesContext } = unlock( blockEditorPrivateApis );\n\n// TODO: Temporary duplication of constant in @wordpress/block-editor. Can be\n// removed by moving PushChangesToGlobalStylesControl to\n// @wordpress/block-editor.\nconst STYLE_PATH_TO_CSS_VAR_INFIX = {\n\t'color.background': 'color',\n\t'color.text': 'color',\n\t'elements.link.color.text': 'color',\n\t'elements.link.:hover.color.text': 'color',\n\t'elements.link.typography.fontFamily': 'font-family',\n\t'elements.link.typography.fontSize': 'font-size',\n\t'elements.button.color.text': 'color',\n\t'elements.button.color.background': 'color',\n\t'elements.button.typography.fontFamily': 'font-family',\n\t'elements.button.typography.fontSize': 'font-size',\n\t'elements.caption.color.text': 'color',\n\t'elements.heading.color': 'color',\n\t'elements.heading.color.background': 'color',\n\t'elements.heading.typography.fontFamily': 'font-family',\n\t'elements.heading.gradient': 'gradient',\n\t'elements.heading.color.gradient': 'gradient',\n\t'elements.h1.color': 'color',\n\t'elements.h1.color.background': 'color',\n\t'elements.h1.typography.fontFamily': 'font-family',\n\t'elements.h1.color.gradient': 'gradient',\n\t'elements.h2.color': 'color',\n\t'elements.h2.color.background': 'color',\n\t'elements.h2.typography.fontFamily': 'font-family',\n\t'elements.h2.color.gradient': 'gradient',\n\t'elements.h3.color': 'color',\n\t'elements.h3.color.background': 'color',\n\t'elements.h3.typography.fontFamily': 'font-family',\n\t'elements.h3.color.gradient': 'gradient',\n\t'elements.h4.color': 'color',\n\t'elements.h4.color.background': 'color',\n\t'elements.h4.typography.fontFamily': 'font-family',\n\t'elements.h4.color.gradient': 'gradient',\n\t'elements.h5.color': 'color',\n\t'elements.h5.color.background': 'color',\n\t'elements.h5.typography.fontFamily': 'font-family',\n\t'elements.h5.color.gradient': 'gradient',\n\t'elements.h6.color': 'color',\n\t'elements.h6.color.background': 'color',\n\t'elements.h6.typography.fontFamily': 'font-family',\n\t'elements.h6.color.gradient': 'gradient',\n\t'color.gradient': 'gradient',\n\t'typography.fontSize': 'font-size',\n\t'typography.fontFamily': 'font-family',\n};\n\n// TODO: Temporary duplication of constant in @wordpress/block-editor. Can be\n// removed by moving PushChangesToGlobalStylesControl to\n// @wordpress/block-editor.\nconst STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE = {\n\t'color.background': 'backgroundColor',\n\t'color.text': 'textColor',\n\t'color.gradient': 'gradient',\n\t'typography.fontSize': 'fontSize',\n\t'typography.fontFamily': 'fontFamily',\n};\n\nfunction useChangesToPush( name, attributes ) {\n\tconst supports = useSupportedStyles( name );\n\n\treturn useMemo(\n\t\t() =>\n\t\t\tsupports.flatMap( ( key ) => {\n\t\t\t\tif ( ! STYLE_PROPERTY[ key ] ) {\n\t\t\t\t\treturn [];\n\t\t\t\t}\n\t\t\t\tconst { value: path } = STYLE_PROPERTY[ key ];\n\t\t\t\tconst presetAttributeKey = path.join( '.' );\n\t\t\t\tconst presetAttributeValue =\n\t\t\t\t\tattributes[\n\t\t\t\t\t\tSTYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE[\n\t\t\t\t\t\t\tpresetAttributeKey\n\t\t\t\t\t\t]\n\t\t\t\t\t];\n\t\t\t\tconst value = presetAttributeValue\n\t\t\t\t\t? `var:preset|${ STYLE_PATH_TO_CSS_VAR_INFIX[ presetAttributeKey ] }|${ presetAttributeValue }`\n\t\t\t\t\t: get( attributes.style, path );\n\t\t\t\treturn value ? [ { path, value } ] : [];\n\t\t\t} ),\n\t\t[ supports, name, attributes ]\n\t);\n}\n\nfunction cloneDeep( object ) {\n\treturn ! object ? {} : JSON.parse( JSON.stringify( object ) );\n}\n\nfunction PushChangesToGlobalStylesControl( {\n\tname,\n\tattributes,\n\tsetAttributes,\n} ) {\n\tconst changes = useChangesToPush( name, attributes );\n\n\tconst { user: userConfig, setUserConfig } =\n\t\tuseContext( GlobalStylesContext );\n\n\tconst { __unstableMarkNextChangeAsNotPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\n\tconst pushChanges = useCallback( () => {\n\t\tif ( changes.length === 0 ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { style: blockStyles } = attributes;\n\n\t\tconst newBlockStyles = cloneDeep( blockStyles );\n\t\tconst newUserConfig = cloneDeep( userConfig );\n\n\t\tfor ( const { path, value } of changes ) {\n\t\t\tset( newBlockStyles, path, undefined );\n\t\t\tset( newUserConfig, [ 'styles', 'blocks', name, ...path ], value );\n\t\t}\n\n\t\t// @wordpress/core-data doesn't support editing multiple entity types in\n\t\t// a single undo level. So for now, we disable @wordpress/core-data undo\n\t\t// tracking and implement our own Undo button in the snackbar\n\t\t// notification.\n\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\tsetAttributes( { style: newBlockStyles } );\n\t\tsetUserConfig( () => newUserConfig, { undoIgnore: true } );\n\n\t\tcreateSuccessNotice(\n\t\t\tsprintf(\n\t\t\t\t// translators: %s: Title of the block e.g. 'Heading'.\n\t\t\t\t__( '%s styles applied.' ),\n\t\t\t\tgetBlockType( name ).title\n\t\t\t),\n\t\t\t{\n\t\t\t\ttype: 'snackbar',\n\t\t\t\tactions: [\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: __( 'Undo' ),\n\t\t\t\t\t\tonClick() {\n\t\t\t\t\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\t\t\t\t\tsetAttributes( { style: blockStyles } );\n\t\t\t\t\t\t\tsetUserConfig( () => userConfig, {\n\t\t\t\t\t\t\t\tundoIgnore: true,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t}\n\t\t);\n\t}, [ changes, attributes, userConfig, name ] );\n\n\treturn (\n\t\t<BaseControl\n\t\t\tclassName=\"edit-site-push-changes-to-global-styles-control\"\n\t\t\thelp={ sprintf(\n\t\t\t\t// translators: %s: Title of the block e.g. 'Heading'.\n\t\t\t\t__(\n\t\t\t\t\t'Apply this block’s typography, spacing, dimensions, and color styles to all %s blocks.'\n\t\t\t\t),\n\t\t\t\tgetBlockType( name ).title\n\t\t\t) }\n\t\t>\n\t\t\t<BaseControl.VisualLabel>\n\t\t\t\t{ __( 'Styles' ) }\n\t\t\t</BaseControl.VisualLabel>\n\t\t\t<Button\n\t\t\t\tvariant=\"primary\"\n\t\t\t\tdisabled={ changes.length === 0 }\n\t\t\t\tonClick={ pushChanges }\n\t\t\t>\n\t\t\t\t{ __( 'Apply globally' ) }\n\t\t\t</Button>\n\t\t</BaseControl>\n\t);\n}\n\nconst withPushChangesToGlobalStyles = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) =>\n\t\t(\n\t\t\t<>\n\t\t\t\t<BlockEdit { ...props } />\n\t\t\t\t<InspectorAdvancedControls>\n\t\t\t\t\t<PushChangesToGlobalStylesControl { ...props } />\n\t\t\t\t</InspectorAdvancedControls>\n\t\t\t</>\n\t\t)\n);\n\naddFilter(\n\t'editor.BlockEdit',\n\t'core/edit-site/push-changes-to-global-styles',\n\twithPushChangesToGlobalStyles\n);\n"]}
|
package/build/index.js
CHANGED
|
@@ -93,6 +93,9 @@ function initializeEditor(id, settings) {
|
|
|
93
93
|
(0, _widgets.registerLegacyWidgetBlock)({
|
|
94
94
|
inserter: false
|
|
95
95
|
});
|
|
96
|
+
(0, _widgets.registerWidgetGroupBlock)({
|
|
97
|
+
inserter: false
|
|
98
|
+
});
|
|
96
99
|
|
|
97
100
|
if (process.env.IS_GUTENBERG_PLUGIN) {
|
|
98
101
|
(0, _blockLibrary.__experimentalRegisterExperimentalCoreBlocks)({
|