@wordpress/edit-site 5.0.0 → 5.2.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 +14 -1
- package/LICENSE.md +1 -1
- package/build/components/add-new-template/new-template-part.js +21 -1
- package/build/components/add-new-template/new-template-part.js.map +1 -1
- package/build/components/add-new-template/utils.js +9 -1
- package/build/components/add-new-template/utils.js.map +1 -1
- package/build/components/block-editor/editor-canvas.js +0 -1
- package/build/components/block-editor/editor-canvas.js.map +1 -1
- package/build/components/block-editor/index.js +17 -52
- package/build/components/block-editor/index.js.map +1 -1
- package/build/components/block-editor/resize-handle.js +2 -1
- package/build/components/block-editor/resize-handle.js.map +1 -1
- package/build/components/editor/index.js +5 -17
- package/build/components/editor/index.js.map +1 -1
- package/build/components/global-styles/block-preview-panel.js +27 -6
- package/build/components/global-styles/block-preview-panel.js.map +1 -1
- package/build/components/global-styles/border-panel.js +5 -5
- package/build/components/global-styles/border-panel.js.map +1 -1
- package/build/components/global-styles/context-menu.js +9 -1
- package/build/components/global-styles/context-menu.js.map +1 -1
- package/build/components/global-styles/custom-css.js +1 -0
- package/build/components/global-styles/custom-css.js.map +1 -1
- package/build/components/global-styles/dimensions-panel.js +16 -11
- package/build/components/global-styles/dimensions-panel.js.map +1 -1
- package/build/components/global-styles/global-styles-provider.js +3 -2
- package/build/components/global-styles/global-styles-provider.js.map +1 -1
- package/build/components/global-styles/screen-background-color.js +6 -6
- package/build/components/global-styles/screen-background-color.js.map +1 -1
- package/build/components/global-styles/screen-block-list.js +4 -1
- package/build/components/global-styles/screen-block-list.js.map +1 -1
- package/build/components/global-styles/screen-block.js +2 -6
- package/build/components/global-styles/screen-block.js.map +1 -1
- package/build/components/global-styles/screen-border.js +12 -2
- package/build/components/global-styles/screen-border.js.map +1 -1
- package/build/components/global-styles/screen-button-color.js +3 -4
- package/build/components/global-styles/screen-button-color.js.map +1 -1
- package/build/components/global-styles/screen-colors.js +53 -25
- package/build/components/global-styles/screen-colors.js.map +1 -1
- package/build/components/global-styles/screen-heading-color.js +9 -10
- package/build/components/global-styles/screen-heading-color.js.map +1 -1
- package/build/components/global-styles/screen-layout.js +12 -2
- package/build/components/global-styles/screen-layout.js.map +1 -1
- package/build/components/global-styles/screen-link-color.js +8 -8
- package/build/components/global-styles/screen-link-color.js.map +1 -1
- package/build/components/global-styles/screen-root.js +7 -2
- package/build/components/global-styles/screen-root.js.map +1 -1
- package/build/components/global-styles/screen-text-color.js +4 -4
- package/build/components/global-styles/screen-text-color.js.map +1 -1
- package/build/components/global-styles/screen-typography.js +11 -1
- package/build/components/global-styles/screen-typography.js.map +1 -1
- package/build/components/global-styles/screen-variations.js +71 -0
- package/build/components/global-styles/screen-variations.js.map +1 -0
- package/build/components/global-styles/typography-panel.js +9 -8
- package/build/components/global-styles/typography-panel.js.map +1 -1
- package/build/components/global-styles/typography-utils.js +17 -5
- package/build/components/global-styles/typography-utils.js.map +1 -1
- package/build/components/global-styles/ui.js +85 -18
- package/build/components/global-styles/ui.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +119 -33
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/global-styles/utils.js +60 -3
- package/build/components/global-styles/utils.js.map +1 -1
- package/build/components/global-styles/variations-panel.js +85 -0
- package/build/components/global-styles/variations-panel.js.map +1 -0
- package/build/components/header-edit-mode/document-actions/index.js +10 -41
- package/build/components/header-edit-mode/document-actions/index.js.map +1 -1
- package/build/components/layout/index.js +129 -87
- package/build/components/layout/index.js.map +1 -1
- package/build/components/sidebar/index.js +5 -1
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/index.js +3 -1
- package/build/components/sidebar-edit-mode/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-inspector.js +2 -0
- package/build/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-inspector.js.map +1 -1
- package/build/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-menu.js +10 -0
- package/build/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-menu.js.map +1 -1
- package/build/components/sidebar-navigation-screen-main/index.js +1 -31
- package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-templates/index.js +3 -22
- package/build/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build/components/site-hub/index.js +149 -0
- package/build/components/site-hub/index.js.map +1 -0
- package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +54 -0
- package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -0
- package/build/components/template-details/edit-template-title.js +1 -0
- package/build/components/template-details/edit-template-title.js.map +1 -1
- package/build/components/template-details/template-part-area-selector.js +1 -0
- package/build/components/template-details/template-part-area-selector.js.map +1 -1
- package/build/components/use-edited-entity-record/index.js +60 -0
- package/build/components/use-edited-entity-record/index.js.map +1 -0
- package/build/hooks/index.js +2 -0
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/push-changes-to-global-styles/index.js +144 -0
- package/build/hooks/push-changes-to-global-styles/index.js.map +1 -0
- package/build/index.js +5 -0
- package/build/index.js.map +1 -1
- package/build/store/reducer.js +1 -1
- package/build/store/reducer.js.map +1 -1
- package/build-module/components/add-new-template/new-template-part.js +20 -1
- package/build-module/components/add-new-template/new-template-part.js.map +1 -1
- package/build-module/components/add-new-template/utils.js +5 -0
- package/build-module/components/add-new-template/utils.js.map +1 -1
- package/build-module/components/block-editor/editor-canvas.js +0 -1
- package/build-module/components/block-editor/editor-canvas.js.map +1 -1
- package/build-module/components/block-editor/index.js +19 -50
- package/build-module/components/block-editor/index.js.map +1 -1
- package/build-module/components/block-editor/resize-handle.js +2 -1
- package/build-module/components/block-editor/resize-handle.js.map +1 -1
- package/build-module/components/editor/index.js +2 -13
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/global-styles/block-preview-panel.js +26 -6
- package/build-module/components/global-styles/block-preview-panel.js.map +1 -1
- package/build-module/components/global-styles/border-panel.js +5 -5
- package/build-module/components/global-styles/border-panel.js.map +1 -1
- package/build-module/components/global-styles/context-menu.js +7 -1
- package/build-module/components/global-styles/context-menu.js.map +1 -1
- package/build-module/components/global-styles/custom-css.js +1 -0
- package/build-module/components/global-styles/custom-css.js.map +1 -1
- package/build-module/components/global-styles/dimensions-panel.js +16 -11
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
- package/build-module/components/global-styles/global-styles-provider.js +3 -2
- package/build-module/components/global-styles/global-styles-provider.js.map +1 -1
- package/build-module/components/global-styles/screen-background-color.js +6 -6
- package/build-module/components/global-styles/screen-background-color.js.map +1 -1
- package/build-module/components/global-styles/screen-block-list.js +3 -1
- package/build-module/components/global-styles/screen-block-list.js.map +1 -1
- package/build-module/components/global-styles/screen-block.js +2 -5
- package/build-module/components/global-styles/screen-block.js.map +1 -1
- package/build-module/components/global-styles/screen-border.js +10 -2
- package/build-module/components/global-styles/screen-border.js.map +1 -1
- package/build-module/components/global-styles/screen-button-color.js +3 -4
- package/build-module/components/global-styles/screen-button-color.js.map +1 -1
- package/build-module/components/global-styles/screen-colors.js +51 -25
- package/build-module/components/global-styles/screen-colors.js.map +1 -1
- package/build-module/components/global-styles/screen-heading-color.js +9 -10
- package/build-module/components/global-styles/screen-heading-color.js.map +1 -1
- package/build-module/components/global-styles/screen-layout.js +10 -2
- package/build-module/components/global-styles/screen-layout.js.map +1 -1
- package/build-module/components/global-styles/screen-link-color.js +8 -8
- package/build-module/components/global-styles/screen-link-color.js.map +1 -1
- package/build-module/components/global-styles/screen-root.js +8 -3
- package/build-module/components/global-styles/screen-root.js.map +1 -1
- package/build-module/components/global-styles/screen-text-color.js +4 -4
- package/build-module/components/global-styles/screen-text-color.js.map +1 -1
- package/build-module/components/global-styles/screen-typography.js +9 -1
- package/build-module/components/global-styles/screen-typography.js.map +1 -1
- package/build-module/components/global-styles/screen-variations.js +54 -0
- package/build-module/components/global-styles/screen-variations.js.map +1 -0
- package/build-module/components/global-styles/typography-panel.js +9 -8
- package/build-module/components/global-styles/typography-panel.js.map +1 -1
- package/build-module/components/global-styles/typography-utils.js +17 -5
- package/build-module/components/global-styles/typography-utils.js.map +1 -1
- package/build-module/components/global-styles/ui.js +84 -19
- package/build-module/components/global-styles/ui.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +121 -35
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/global-styles/utils.js +56 -3
- package/build-module/components/global-styles/utils.js.map +1 -1
- package/build-module/components/global-styles/variations-panel.js +68 -0
- package/build-module/components/global-styles/variations-panel.js.map +1 -0
- package/build-module/components/header-edit-mode/document-actions/index.js +10 -38
- package/build-module/components/header-edit-mode/document-actions/index.js.map +1 -1
- package/build-module/components/layout/index.js +129 -88
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/sidebar/index.js +4 -1
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/index.js +3 -1
- package/build-module/components/sidebar-edit-mode/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-inspector.js +2 -0
- package/build-module/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-inspector.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-menu.js +11 -1
- package/build-module/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-menu.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-main/index.js +2 -27
- package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-templates/index.js +5 -23
- package/build-module/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build-module/components/site-hub/index.js +127 -0
- package/build-module/components/site-hub/index.js.map +1 -0
- package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +43 -0
- package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -0
- package/build-module/components/template-details/edit-template-title.js +1 -0
- package/build-module/components/template-details/edit-template-title.js.map +1 -1
- package/build-module/components/template-details/template-part-area-selector.js +1 -0
- package/build-module/components/template-details/template-part-area-selector.js.map +1 -1
- package/build-module/components/use-edited-entity-record/index.js +48 -0
- package/build-module/components/use-edited-entity-record/index.js.map +1 -0
- package/build-module/hooks/index.js +1 -0
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/push-changes-to-global-styles/index.js +132 -0
- package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -0
- package/build-module/index.js +4 -0
- package/build-module/index.js.map +1 -1
- package/build-module/store/reducer.js +1 -1
- package/build-module/store/reducer.js.map +1 -1
- package/build-style/style-rtl.css +190 -125
- package/build-style/style.css +190 -125
- package/package.json +30 -29
- package/src/components/add-new-template/new-template-part.js +23 -1
- package/src/components/add-new-template/utils.js +14 -0
- package/src/components/block-editor/editor-canvas.js +0 -1
- package/src/components/block-editor/index.js +14 -59
- package/src/components/block-editor/resize-handle.js +6 -2
- package/src/components/block-editor/style.scss +43 -7
- package/src/components/editor/index.js +2 -17
- package/src/components/global-styles/block-preview-panel.js +37 -10
- package/src/components/global-styles/border-panel.js +8 -5
- package/src/components/global-styles/context-menu.js +6 -0
- package/src/components/global-styles/custom-css.js +1 -0
- package/src/components/global-styles/dimensions-panel.js +32 -15
- package/src/components/global-styles/global-styles-provider.js +11 -5
- package/src/components/global-styles/screen-background-color.js +12 -6
- package/src/components/global-styles/screen-block-list.js +6 -1
- package/src/components/global-styles/screen-block.js +1 -4
- package/src/components/global-styles/screen-border.js +8 -3
- package/src/components/global-styles/screen-button-color.js +2 -4
- package/src/components/global-styles/screen-colors.js +84 -20
- package/src/components/global-styles/screen-heading-color.js +8 -10
- package/src/components/global-styles/screen-layout.js +11 -3
- package/src/components/global-styles/screen-link-color.js +19 -8
- package/src/components/global-styles/screen-root.js +34 -27
- package/src/components/global-styles/screen-text-color.js +7 -4
- package/src/components/global-styles/screen-typography.js +13 -3
- package/src/components/global-styles/screen-variations.js +47 -0
- package/src/components/global-styles/style.scss +9 -0
- package/src/components/global-styles/test/typography-utils.js +72 -23
- package/src/components/global-styles/test/use-global-styles-output.js +1 -1
- package/src/components/global-styles/typography-panel.js +31 -8
- package/src/components/global-styles/typography-utils.js +24 -4
- package/src/components/global-styles/ui.js +101 -13
- package/src/components/global-styles/use-global-styles-output.js +137 -14
- package/src/components/global-styles/utils.js +56 -3
- package/src/components/global-styles/variations-panel.js +78 -0
- package/src/components/header-edit-mode/document-actions/index.js +18 -37
- package/src/components/header-edit-mode/style.scss +1 -0
- package/src/components/layout/index.js +217 -172
- package/src/components/layout/style.scss +98 -66
- package/src/components/list/style.scss +1 -8
- package/src/components/sidebar/index.js +4 -1
- package/src/components/sidebar-edit-mode/index.js +1 -1
- package/src/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-inspector.js +2 -0
- package/src/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-menu.js +10 -0
- package/src/components/sidebar-edit-mode/navigation-menu-sidebar/style.scss +4 -0
- package/src/components/sidebar-navigation-screen/style.scss +2 -4
- package/src/components/sidebar-navigation-screen-main/index.js +1 -29
- package/src/components/sidebar-navigation-screen-templates/index.js +9 -27
- package/src/components/site-hub/index.js +161 -0
- package/src/components/site-hub/style.scss +31 -0
- package/src/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +40 -0
- package/src/components/template-details/edit-template-title.js +1 -0
- package/src/components/template-details/template-part-area-selector.js +1 -0
- package/src/components/use-edited-entity-record/index.js +37 -0
- package/src/hooks/index.js +1 -0
- package/src/hooks/push-changes-to-global-styles/index.js +162 -0
- package/src/hooks/push-changes-to-global-styles/style.scss +4 -0
- package/src/index.js +2 -0
- package/src/store/reducer.js +1 -1
- package/src/style.scss +2 -0
- package/build/components/site-title/index.js +0 -55
- package/build/components/site-title/index.js.map +0 -1
- package/build-module/components/site-title/index.js +0 -43
- package/build-module/components/site-title/index.js.map +0 -1
- package/src/components/site-title/index.js +0 -39
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/block-editor/resize-handle.js"],"names":["DELTA_DISTANCE","ResizeHandle","direction","resizeWidthBy","handleKeyDown","event","keyCode","LEFT","RIGHT"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AALA;AACA;AACA;AAKA,MAAMA,cAAc,GAAG,EAAvB,C,CAA2B;;AAEZ,SAASC,YAAT,
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/block-editor/resize-handle.js"],"names":["DELTA_DISTANCE","ResizeHandle","variation","direction","resizeWidthBy","handleKeyDown","event","keyCode","LEFT","RIGHT"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AALA;AACA;AACA;AAKA,MAAMA,cAAc,GAAG,EAAvB,C,CAA2B;;AAEZ,SAASC,YAAT,OAIX;AAAA,MAJkC;AACrCC,IAAAA,SAAS,GAAG,SADyB;AAErCC,IAAAA,SAFqC;AAGrCC,IAAAA;AAHqC,GAIlC;;AACH,WAASC,aAAT,CAAwBC,KAAxB,EAAgC;AAC/B,UAAM;AAAEC,MAAAA;AAAF,QAAcD,KAApB;;AAEA,QACGH,SAAS,KAAK,MAAd,IAAwBI,OAAO,KAAKC,cAAtC,IACEL,SAAS,KAAK,OAAd,IAAyBI,OAAO,KAAKE,eAFxC,EAGE;AACDL,MAAAA,aAAa,CAAEJ,cAAF,CAAb;AACA,KALD,MAKO,IACJG,SAAS,KAAK,MAAd,IAAwBI,OAAO,KAAKE,eAAtC,IACEN,SAAS,KAAK,OAAd,IAAyBI,OAAO,KAAKC,cAFjC,EAGL;AACDJ,MAAAA,aAAa,CAAE,CAACJ,cAAH,CAAb;AACA;AACD;;AAED,SACC,qDACC;AACC,IAAA,SAAS,EAAI,oCAAoCG,SAAW,iBAAiBD,SAAW,EADzF;AAEC,kBAAa,cAAI,gBAAJ,CAFd;AAGC,wBAAoB,iCAAiCC,SAAW,EAHjE;AAIC,IAAA,SAAS,EAAGE;AAJb,IADD,EAOC,4BAAC,0BAAD;AACC,IAAA,EAAE,EAAI,iCAAiCF,SAAW;AADnD,KAGG,cAAI,qDAAJ,CAHH,CAPD,CADD;AAeA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { LEFT, RIGHT } from '@wordpress/keycodes';\nimport { VisuallyHidden } from '@wordpress/components';\n\nconst DELTA_DISTANCE = 20; // The distance to resize per keydown in pixels.\n\nexport default function ResizeHandle( {\n\tvariation = 'default',\n\tdirection,\n\tresizeWidthBy,\n} ) {\n\tfunction handleKeyDown( event ) {\n\t\tconst { keyCode } = event;\n\n\t\tif (\n\t\t\t( direction === 'left' && keyCode === LEFT ) ||\n\t\t\t( direction === 'right' && keyCode === RIGHT )\n\t\t) {\n\t\t\tresizeWidthBy( DELTA_DISTANCE );\n\t\t} else if (\n\t\t\t( direction === 'left' && keyCode === RIGHT ) ||\n\t\t\t( direction === 'right' && keyCode === LEFT )\n\t\t) {\n\t\t\tresizeWidthBy( -DELTA_DISTANCE );\n\t\t}\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<button\n\t\t\t\tclassName={ `resizable-editor__drag-handle is-${ direction } is-variation-${ variation }` }\n\t\t\t\taria-label={ __( 'Drag to resize' ) }\n\t\t\t\taria-describedby={ `resizable-editor__resize-help-${ direction }` }\n\t\t\t\tonKeyDown={ handleKeyDown }\n\t\t\t/>\n\t\t\t<VisuallyHidden\n\t\t\t\tid={ `resizable-editor__resize-help-${ direction }` }\n\t\t\t>\n\t\t\t\t{ __( 'Use left and right arrow keys to resize the canvas.' ) }\n\t\t\t</VisuallyHidden>\n\t\t</>\n\t);\n}\n"]}
|
|
@@ -25,15 +25,13 @@ var _editor = require("@wordpress/editor");
|
|
|
25
25
|
|
|
26
26
|
var _i18n = require("@wordpress/i18n");
|
|
27
27
|
|
|
28
|
-
var _keyboardShortcuts = require("@wordpress/keyboard-shortcuts");
|
|
29
|
-
|
|
30
28
|
var _sidebarEditMode = require("../sidebar-edit-mode");
|
|
31
29
|
|
|
32
30
|
var _blockEditor2 = _interopRequireDefault(require("../block-editor"));
|
|
33
31
|
|
|
34
32
|
var _codeEditor = _interopRequireDefault(require("../code-editor"));
|
|
35
33
|
|
|
36
|
-
var
|
|
34
|
+
var _keyboardShortcuts = _interopRequireDefault(require("../keyboard-shortcuts"));
|
|
37
35
|
|
|
38
36
|
var _inserterSidebar = _interopRequireDefault(require("../secondary-sidebar/inserter-sidebar"));
|
|
39
37
|
|
|
@@ -84,8 +82,6 @@ function Editor() {
|
|
|
84
82
|
isInserterOpen,
|
|
85
83
|
isListViewOpen,
|
|
86
84
|
isSaveViewOpen,
|
|
87
|
-
previousShortcut,
|
|
88
|
-
nextShortcut,
|
|
89
85
|
showIconLabels
|
|
90
86
|
} = (0, _data.useSelect)(select => {
|
|
91
87
|
const {
|
|
@@ -105,9 +101,6 @@ function Editor() {
|
|
|
105
101
|
const {
|
|
106
102
|
__unstableGetEditorMode
|
|
107
103
|
} = select(_blockEditor.store);
|
|
108
|
-
const {
|
|
109
|
-
getAllShortcutKeyCombinations
|
|
110
|
-
} = select(_keyboardShortcuts.store);
|
|
111
104
|
const {
|
|
112
105
|
getActiveComplementaryArea
|
|
113
106
|
} = select(_interface.store);
|
|
@@ -128,8 +121,6 @@ function Editor() {
|
|
|
128
121
|
isListViewOpen: isListViewOpened(),
|
|
129
122
|
isSaveViewOpen: isSaveViewOpened(),
|
|
130
123
|
isRightSidebarOpen: getActiveComplementaryArea(_store.store.name),
|
|
131
|
-
previousShortcut: getAllShortcutKeyCombinations('core/edit-site/previous-region'),
|
|
132
|
-
nextShortcut: getAllShortcutKeyCombinations('core/edit-site/next-region'),
|
|
133
124
|
showIconLabels: select(_preferences.store).get('core/edit-site', 'showIconLabels')
|
|
134
125
|
};
|
|
135
126
|
}, []);
|
|
@@ -162,7 +153,7 @@ function Editor() {
|
|
|
162
153
|
return null;
|
|
163
154
|
}
|
|
164
155
|
|
|
165
|
-
return (0, _element.createElement)(_element.Fragment, null, isEditMode && (0, _element.createElement)(_welcomeGuide.default, null), (0, _element.createElement)(
|
|
156
|
+
return (0, _element.createElement)(_element.Fragment, null, isEditMode && (0, _element.createElement)(_welcomeGuide.default, null), (0, _element.createElement)(_keyboardShortcuts.default.Register, null), (0, _element.createElement)(_coreData.EntityProvider, {
|
|
166
157
|
kind: "root",
|
|
167
158
|
type: "site"
|
|
168
159
|
}, (0, _element.createElement)(_coreData.EntityProvider, {
|
|
@@ -172,12 +163,13 @@ function Editor() {
|
|
|
172
163
|
}, (0, _element.createElement)(_globalStylesProvider.GlobalStylesProvider, null, (0, _element.createElement)(_blockEditor.BlockContextProvider, {
|
|
173
164
|
value: blockContext
|
|
174
165
|
}, (0, _element.createElement)(_sidebarEditMode.SidebarComplementaryAreaFills, null), (0, _element.createElement)(_interface.InterfaceSkeleton, {
|
|
166
|
+
enableRegionNavigation: false,
|
|
175
167
|
className: showIconLabels && 'show-icon-labels',
|
|
176
168
|
notices: isEditMode && (0, _element.createElement)(_editor.EditorSnackbars, null),
|
|
177
|
-
content: (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_globalStylesRenderer.GlobalStylesRenderer, null), (0, _element.createElement)(_editor.EditorNotices, null), showVisualEditor && editedPost && (0, _element.createElement)(_blockEditor2.default, null), editorMode === 'text' && editedPost && (0, _element.createElement)(_codeEditor.default, null), hasLoadedPost && !editedPost && (0, _element.createElement)(_components.Notice, {
|
|
169
|
+
content: (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_globalStylesRenderer.GlobalStylesRenderer, null), isEditMode && (0, _element.createElement)(_editor.EditorNotices, null), showVisualEditor && editedPost && (0, _element.createElement)(_blockEditor2.default, null), editorMode === 'text' && editedPost && (0, _element.createElement)(_codeEditor.default, null), hasLoadedPost && !editedPost && (0, _element.createElement)(_components.Notice, {
|
|
178
170
|
status: "warning",
|
|
179
171
|
isDismissible: false
|
|
180
|
-
}, (0, _i18n.__)("You attempted to edit an item that doesn't exist. Perhaps it was deleted?")), isEditMode && (0, _element.createElement)(
|
|
172
|
+
}, (0, _i18n.__)("You attempted to edit an item that doesn't exist. Perhaps it was deleted?")), isEditMode && (0, _element.createElement)(_keyboardShortcuts.default, null)),
|
|
181
173
|
secondarySidebar: isEditMode && (shouldShowInserter && (0, _element.createElement)(_inserterSidebar.default, null) || shouldShowListView && (0, _element.createElement)(_listViewSidebar.default, null)),
|
|
182
174
|
sidebar: isEditMode && isRightSidebarOpen && (0, _element.createElement)(_interface.ComplementaryArea.Slot, {
|
|
183
175
|
scope: "core/edit-site"
|
|
@@ -195,10 +187,6 @@ function Editor() {
|
|
|
195
187
|
footer: showBlockBreakcrumb && (0, _element.createElement)(_blockEditor.BlockBreadcrumb, {
|
|
196
188
|
rootLabelText: (0, _i18n.__)('Template')
|
|
197
189
|
}),
|
|
198
|
-
shortcuts: {
|
|
199
|
-
previous: previousShortcut,
|
|
200
|
-
next: nextShortcut
|
|
201
|
-
},
|
|
202
190
|
labels: { ...interfaceLabels,
|
|
203
191
|
secondarySidebar: secondarySidebarLabel
|
|
204
192
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/editor/index.js"],"names":["interfaceLabels","body","sidebar","actions","footer","Editor","editedPostId","editedPostType","editedPost","context","hasLoadedPost","editorMode","canvasMode","blockEditorMode","isRightSidebarOpen","isInserterOpen","isListViewOpen","isSaveViewOpen","previousShortcut","nextShortcut","showIconLabels","select","getEditedPostType","getEditedPostId","getEditedPostContext","getEditorMode","__unstableGetCanvasMode","isInserterOpened","isListViewOpened","isSaveViewOpened","editSiteStore","hasFinishedResolution","getEntityRecord","coreStore","__unstableGetEditorMode","blockEditorStore","getAllShortcutKeyCombinations","keyboardShortcutsStore","getActiveComplementaryArea","interfaceStore","postType","postId","name","preferencesStore","get","setIsSaveViewOpened","setEditedPostContext","isViewMode","isEditMode","showVisualEditor","showBlockBreakcrumb","shouldShowInserter","shouldShowListView","secondarySidebarLabel","blockContext","queryContext","page","newQueryContext","isReady","undefined","previous","next","secondarySidebar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WADT;AAEC,MAAA,SAAS,EAAC,4CAFX;AAGC,MAAA,OAAO,EAAG,MACTA,mBAAmB,CAClB,IADkB,CAJrB;AAQC,uBAAgB;AARjB,OAUG,cACD,iBADC,CAVH,CADD,CAVF,CA5CH;AA0EC,IAAA,MAAM,EACLK,mBAAmB,IAClB,4BAAC,4BAAD;AACC,MAAA,aAAa,EAAG,cAAI,UAAJ;AADjB,MA5EH;AAiFC,IAAA,SAAS,EAAG;AACXU,MAAAA,QAAQ,EAAE1C,gBADC;AAEX2C,MAAAA,IAAI,EAAE1C;AAFK,KAjFb;AAqFC,IAAA,MAAM,EAAG,EACR,GAAGnB,eADK;AAER8D,MAAAA,gBAAgB,EAAET;AAFV;AArFV,IAFD,CADD,CALD,CADD,CAHD,CADD;AA6GA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { Button, Notice } from '@wordpress/components';\nimport { EntityProvider, store as coreStore } from '@wordpress/core-data';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport {\n\tBlockContextProvider,\n\tBlockBreadcrumb,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport {\n\tInterfaceSkeleton,\n\tComplementaryArea,\n\tstore as interfaceStore,\n} from '@wordpress/interface';\nimport {\n\tEditorNotices,\n\tEditorSnackbars,\n\tEntitiesSavedStates,\n} from '@wordpress/editor';\nimport { __ } from '@wordpress/i18n';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\n\n/**\n * Internal dependencies\n */\nimport { SidebarComplementaryAreaFills } from '../sidebar-edit-mode';\nimport BlockEditor from '../block-editor';\nimport CodeEditor from '../code-editor';\nimport KeyboardShortcuts from '../keyboard-shortcuts';\nimport InserterSidebar from '../secondary-sidebar/inserter-sidebar';\nimport ListViewSidebar from '../secondary-sidebar/list-view-sidebar';\nimport WelcomeGuide from '../welcome-guide';\nimport { store as editSiteStore } from '../../store';\nimport { GlobalStylesRenderer } from '../global-styles-renderer';\nimport { GlobalStylesProvider } from '../global-styles/global-styles-provider';\nimport useTitle from '../routes/use-title';\n\nconst interfaceLabels = {\n\t/* translators: accessibility text for the editor content landmark region. */\n\tbody: __( 'Editor content' ),\n\t/* translators: accessibility text for the editor settings landmark region. */\n\tsidebar: __( 'Editor settings' ),\n\t/* translators: accessibility text for the editor publish landmark region. */\n\tactions: __( 'Editor publish' ),\n\t/* translators: accessibility text for the editor footer landmark region. */\n\tfooter: __( 'Editor footer' ),\n};\n\nexport default function Editor() {\n\tconst {\n\t\teditedPostId,\n\t\teditedPostType,\n\t\teditedPost,\n\t\tcontext,\n\t\thasLoadedPost,\n\t\teditorMode,\n\t\tcanvasMode,\n\t\tblockEditorMode,\n\t\tisRightSidebarOpen,\n\t\tisInserterOpen,\n\t\tisListViewOpen,\n\t\tisSaveViewOpen,\n\t\tpreviousShortcut,\n\t\tnextShortcut,\n\t\tshowIconLabels,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetEditedPostType,\n\t\t\tgetEditedPostId,\n\t\t\tgetEditedPostContext,\n\t\t\tgetEditorMode,\n\t\t\t__unstableGetCanvasMode,\n\t\t\tisInserterOpened,\n\t\t\tisListViewOpened,\n\t\t\tisSaveViewOpened,\n\t\t} = select( editSiteStore );\n\t\tconst { hasFinishedResolution, getEntityRecord } = select( coreStore );\n\t\tconst { __unstableGetEditorMode } = select( blockEditorStore );\n\t\tconst { getAllShortcutKeyCombinations } = select(\n\t\t\tkeyboardShortcutsStore\n\t\t);\n\t\tconst { getActiveComplementaryArea } = select( interfaceStore );\n\t\tconst postType = getEditedPostType();\n\t\tconst postId = getEditedPostId();\n\n\t\t// The currently selected entity to display.\n\t\t// Typically template or template part in the site editor.\n\t\treturn {\n\t\t\teditedPostId: postId,\n\t\t\teditedPostType: postType,\n\t\t\teditedPost: postId\n\t\t\t\t? getEntityRecord( 'postType', postType, postId )\n\t\t\t\t: null,\n\t\t\tcontext: getEditedPostContext(),\n\t\t\thasLoadedPost: postId\n\t\t\t\t? hasFinishedResolution( 'getEntityRecord', [\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\tpostType,\n\t\t\t\t\t\tpostId,\n\t\t\t\t ] )\n\t\t\t\t: false,\n\t\t\teditorMode: getEditorMode(),\n\t\t\tcanvasMode: __unstableGetCanvasMode(),\n\t\t\tblockEditorMode: __unstableGetEditorMode(),\n\t\t\tisInserterOpen: isInserterOpened(),\n\t\t\tisListViewOpen: isListViewOpened(),\n\t\t\tisSaveViewOpen: isSaveViewOpened(),\n\t\t\tisRightSidebarOpen: getActiveComplementaryArea(\n\t\t\t\teditSiteStore.name\n\t\t\t),\n\t\t\tpreviousShortcut: getAllShortcutKeyCombinations(\n\t\t\t\t'core/edit-site/previous-region'\n\t\t\t),\n\t\t\tnextShortcut: getAllShortcutKeyCombinations(\n\t\t\t\t'core/edit-site/next-region'\n\t\t\t),\n\t\t\tshowIconLabels: select( preferencesStore ).get(\n\t\t\t\t'core/edit-site',\n\t\t\t\t'showIconLabels'\n\t\t\t),\n\t\t};\n\t}, [] );\n\tconst { setIsSaveViewOpened, setEditedPostContext } =\n\t\tuseDispatch( editSiteStore );\n\n\tconst isViewMode = canvasMode === 'view';\n\tconst isEditMode = canvasMode === 'edit';\n\tconst showVisualEditor = isViewMode || editorMode === 'visual';\n\tconst showBlockBreakcrumb =\n\t\tisEditMode && showVisualEditor && blockEditorMode !== 'zoom-out';\n\tconst shouldShowInserter = isEditMode && showVisualEditor && isInserterOpen;\n\tconst shouldShowListView = isEditMode && showVisualEditor && isListViewOpen;\n\tconst secondarySidebarLabel = isListViewOpen\n\t\t? __( 'List View' )\n\t\t: __( 'Block Library' );\n\tconst blockContext = useMemo(\n\t\t() => ( {\n\t\t\t...context,\n\t\t\tqueryContext: [\n\t\t\t\tcontext?.queryContext || { page: 1 },\n\t\t\t\t( newQueryContext ) =>\n\t\t\t\t\tsetEditedPostContext( {\n\t\t\t\t\t\t...context,\n\t\t\t\t\t\tqueryContext: {\n\t\t\t\t\t\t\t...context?.queryContext,\n\t\t\t\t\t\t\t...newQueryContext,\n\t\t\t\t\t\t},\n\t\t\t\t\t} ),\n\t\t\t],\n\t\t} ),\n\t\t[ context ]\n\t);\n\tconst isReady = editedPostType !== undefined && editedPostId !== undefined;\n\n\t// Only announce the title once the editor is ready to prevent \"Replace\"\n\t// action in <URlQueryController> from double-announcing.\n\tuseTitle( isReady && __( 'Editor (beta)' ) );\n\n\tif ( ! isReady ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{ isEditMode && <WelcomeGuide /> }\n\t\t\t<KeyboardShortcuts.Register />\n\t\t\t<EntityProvider kind=\"root\" type=\"site\">\n\t\t\t\t<EntityProvider\n\t\t\t\t\tkind=\"postType\"\n\t\t\t\t\ttype={ editedPostType }\n\t\t\t\t\tid={ editedPostId }\n\t\t\t\t>\n\t\t\t\t\t<GlobalStylesProvider>\n\t\t\t\t\t\t<BlockContextProvider value={ blockContext }>\n\t\t\t\t\t\t\t<SidebarComplementaryAreaFills />\n\t\t\t\t\t\t\t<InterfaceSkeleton\n\t\t\t\t\t\t\t\tclassName={\n\t\t\t\t\t\t\t\t\tshowIconLabels && 'show-icon-labels'\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tnotices={ isEditMode && <EditorSnackbars /> }\n\t\t\t\t\t\t\t\tcontent={\n\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t<GlobalStylesRenderer />\n\t\t\t\t\t\t\t\t\t\t<EditorNotices />\n\t\t\t\t\t\t\t\t\t\t{ showVisualEditor && editedPost && (\n\t\t\t\t\t\t\t\t\t\t\t<BlockEditor />\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t{ editorMode === 'text' &&\n\t\t\t\t\t\t\t\t\t\t\teditedPost && <CodeEditor /> }\n\t\t\t\t\t\t\t\t\t\t{ hasLoadedPost && ! editedPost && (\n\t\t\t\t\t\t\t\t\t\t\t<Notice\n\t\t\t\t\t\t\t\t\t\t\t\tstatus=\"warning\"\n\t\t\t\t\t\t\t\t\t\t\t\tisDismissible={ false }\n\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"You attempted to edit an item that doesn't exist. Perhaps it was deleted?\"\n\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t</Notice>\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t{ isEditMode && <KeyboardShortcuts /> }\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\tsecondarySidebar={\n\t\t\t\t\t\t\t\t\tisEditMode &&\n\t\t\t\t\t\t\t\t\t( ( shouldShowInserter && (\n\t\t\t\t\t\t\t\t\t\t<InserterSidebar />\n\t\t\t\t\t\t\t\t\t) ) ||\n\t\t\t\t\t\t\t\t\t\t( shouldShowListView && (\n\t\t\t\t\t\t\t\t\t\t\t<ListViewSidebar />\n\t\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\tsidebar={\n\t\t\t\t\t\t\t\t\tisEditMode &&\n\t\t\t\t\t\t\t\t\tisRightSidebarOpen && (\n\t\t\t\t\t\t\t\t\t\t<ComplementaryArea.Slot scope=\"core/edit-site\" />\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\tactions={\n\t\t\t\t\t\t\t\t\tisEditMode && (\n\t\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t\t{ isSaveViewOpen ? (\n\t\t\t\t\t\t\t\t\t\t\t\t<EntitiesSavedStates\n\t\t\t\t\t\t\t\t\t\t\t\t\tclose={ () =>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tsetIsSaveViewOpened(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfalse\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\t\t\t\t<div className=\"edit-site-editor__toggle-save-panel\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tclassName=\"edit-site-editor__toggle-save-panel-button\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tsetIsSaveViewOpened(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttrue\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\taria-expanded={ false }\n\t\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'Open save panel'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tfooter={\n\t\t\t\t\t\t\t\t\tshowBlockBreakcrumb && (\n\t\t\t\t\t\t\t\t\t\t<BlockBreadcrumb\n\t\t\t\t\t\t\t\t\t\t\trootLabelText={ __( 'Template' ) }\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tshortcuts={ {\n\t\t\t\t\t\t\t\t\tprevious: previousShortcut,\n\t\t\t\t\t\t\t\t\tnext: nextShortcut,\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\tlabels={ {\n\t\t\t\t\t\t\t\t\t...interfaceLabels,\n\t\t\t\t\t\t\t\t\tsecondarySidebar: secondarySidebarLabel,\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</BlockContextProvider>\n\t\t\t\t\t</GlobalStylesProvider>\n\t\t\t\t</EntityProvider>\n\t\t\t</EntityProvider>\n\t\t</>\n\t);\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/editor/index.js"],"names":["interfaceLabels","body","sidebar","actions","footer","Editor","editedPostId","editedPostType","editedPost","context","hasLoadedPost","editorMode","canvasMode","blockEditorMode","isRightSidebarOpen","isInserterOpen","isListViewOpen","isSaveViewOpen","showIconLabels","select","getEditedPostType","getEditedPostId","getEditedPostContext","getEditorMode","__unstableGetCanvasMode","isInserterOpened","isListViewOpened","isSaveViewOpened","editSiteStore","hasFinishedResolution","getEntityRecord","coreStore","__unstableGetEditorMode","blockEditorStore","getActiveComplementaryArea","interfaceStore","postType","postId","name","preferencesStore","get","setIsSaveViewOpened","setEditedPostContext","isViewMode","isEditMode","showVisualEditor","showBlockBreakcrumb","shouldShowInserter","shouldShowListView","secondarySidebarLabel","blockContext","queryContext","page","newQueryContext","isReady","undefined","secondarySidebar"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AAKA;;AAKA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAtCA;AACA;AACA;;AAuBA;AACA;AACA;AAaA,MAAMA,eAAe,GAAG;AACvB;AACAC,EAAAA,IAAI,EAAE,cAAI,gBAAJ,CAFiB;;AAGvB;AACAC,EAAAA,OAAO,EAAE,cA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4BAAC,qBAAD,OAJF,EAMGG,UAAU,KAAK,MAAf,IACDH,UADC,IACa,4BAAC,mBAAD,OAPhB,EAQGE,aAAa,IAAI,CAAEF,UAAnB,IACD,4BAAC,kBAAD;AACC,MAAA,MAAM,EAAC,SADR;AAEC,MAAA,aAAa,EAAG;AAFjB,OAIG,cACD,2EADC,CAJH,CATF,EAkBGoC,UAAU,IAAI,4BAAC,0BAAD,OAlBjB,CAPF;AA4BC,IAAA,gBAAgB,EACfA,UAAU,KACNG,kBAAkB,IACrB,4BAAC,wBAAD,OADC,IAGCC,kBAAkB,IACnB,4BAAC,wBAAD,OALQ,CA7BZ;AAqCC,IAAA,OAAO,EACNJ,UAAU,IACV9B,kBADA,IAEC,4BAAC,4BAAD,CAAmB,IAAnB;AAAwB,MAAA,KAAK,EAAC;AAA9B,MAxCH;AA2CC,IAAA,OAAO,EACN8B,UAAU,IACT,qDACG3B,cAAc,GACf,4BAAC,2BAAD;AACC,MAAA,KAAK,EAAG,MACPwB,mBAAmB,CAClB,KADkB;AAFrB,MADe,GASf;AAAK,MAAA,SAAS,EAAC;AAAf,OACC,4BAAC,kBAAD;AACC,MAAA,OAAO,EAAC,WADT;AAEC,MAAA,SAAS,EAAC,4CAFX;AAGC,MAAA,OAAO,EAAG,MACTA,mBAAmB,CAClB,IADkB,CAJrB;AAQC,uBAAgB;AARjB,OAUG,cACD,iBADC,CAVH,CADD,CAVF,CA7CH;AA2EC,IAAA,MAAM,EACLK,mBAAmB,IAClB,4BAAC,4BAAD;AACC,MAAA,aAAa,EAAG,cAAI,UAAJ;AADjB,MA7EH;AAkFC,IAAA,MAAM,EAAG,EACR,GAAG9C,eADK;AAERwD,MAAAA,gBAAgB,EAAEP;AAFV;AAlFV,IAFD,CADD,CALD,CADD,CAHD,CADD;AA0GA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { Button, Notice } from '@wordpress/components';\nimport { EntityProvider, store as coreStore } from '@wordpress/core-data';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport {\n\tBlockContextProvider,\n\tBlockBreadcrumb,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport {\n\tInterfaceSkeleton,\n\tComplementaryArea,\n\tstore as interfaceStore,\n} from '@wordpress/interface';\nimport {\n\tEditorNotices,\n\tEditorSnackbars,\n\tEntitiesSavedStates,\n} from '@wordpress/editor';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { SidebarComplementaryAreaFills } from '../sidebar-edit-mode';\nimport BlockEditor from '../block-editor';\nimport CodeEditor from '../code-editor';\nimport KeyboardShortcuts from '../keyboard-shortcuts';\nimport InserterSidebar from '../secondary-sidebar/inserter-sidebar';\nimport ListViewSidebar from '../secondary-sidebar/list-view-sidebar';\nimport WelcomeGuide from '../welcome-guide';\nimport { store as editSiteStore } from '../../store';\nimport { GlobalStylesRenderer } from '../global-styles-renderer';\nimport { GlobalStylesProvider } from '../global-styles/global-styles-provider';\nimport useTitle from '../routes/use-title';\n\nconst interfaceLabels = {\n\t/* translators: accessibility text for the editor content landmark region. */\n\tbody: __( 'Editor content' ),\n\t/* translators: accessibility text for the editor settings landmark region. */\n\tsidebar: __( 'Editor settings' ),\n\t/* translators: accessibility text for the editor publish landmark region. */\n\tactions: __( 'Editor publish' ),\n\t/* translators: accessibility text for the editor footer landmark region. */\n\tfooter: __( 'Editor footer' ),\n};\n\nexport default function Editor() {\n\tconst {\n\t\teditedPostId,\n\t\teditedPostType,\n\t\teditedPost,\n\t\tcontext,\n\t\thasLoadedPost,\n\t\teditorMode,\n\t\tcanvasMode,\n\t\tblockEditorMode,\n\t\tisRightSidebarOpen,\n\t\tisInserterOpen,\n\t\tisListViewOpen,\n\t\tisSaveViewOpen,\n\t\tshowIconLabels,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetEditedPostType,\n\t\t\tgetEditedPostId,\n\t\t\tgetEditedPostContext,\n\t\t\tgetEditorMode,\n\t\t\t__unstableGetCanvasMode,\n\t\t\tisInserterOpened,\n\t\t\tisListViewOpened,\n\t\t\tisSaveViewOpened,\n\t\t} = select( editSiteStore );\n\t\tconst { hasFinishedResolution, getEntityRecord } = select( coreStore );\n\t\tconst { __unstableGetEditorMode } = select( blockEditorStore );\n\t\tconst { getActiveComplementaryArea } = select( interfaceStore );\n\t\tconst postType = getEditedPostType();\n\t\tconst postId = getEditedPostId();\n\n\t\t// The currently selected entity to display.\n\t\t// Typically template or template part in the site editor.\n\t\treturn {\n\t\t\teditedPostId: postId,\n\t\t\teditedPostType: postType,\n\t\t\teditedPost: postId\n\t\t\t\t? getEntityRecord( 'postType', postType, postId )\n\t\t\t\t: null,\n\t\t\tcontext: getEditedPostContext(),\n\t\t\thasLoadedPost: postId\n\t\t\t\t? hasFinishedResolution( 'getEntityRecord', [\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\tpostType,\n\t\t\t\t\t\tpostId,\n\t\t\t\t ] )\n\t\t\t\t: false,\n\t\t\teditorMode: getEditorMode(),\n\t\t\tcanvasMode: __unstableGetCanvasMode(),\n\t\t\tblockEditorMode: __unstableGetEditorMode(),\n\t\t\tisInserterOpen: isInserterOpened(),\n\t\t\tisListViewOpen: isListViewOpened(),\n\t\t\tisSaveViewOpen: isSaveViewOpened(),\n\t\t\tisRightSidebarOpen: getActiveComplementaryArea(\n\t\t\t\teditSiteStore.name\n\t\t\t),\n\t\t\tshowIconLabels: select( preferencesStore ).get(\n\t\t\t\t'core/edit-site',\n\t\t\t\t'showIconLabels'\n\t\t\t),\n\t\t};\n\t}, [] );\n\tconst { setIsSaveViewOpened, setEditedPostContext } =\n\t\tuseDispatch( editSiteStore );\n\n\tconst isViewMode = canvasMode === 'view';\n\tconst isEditMode = canvasMode === 'edit';\n\tconst showVisualEditor = isViewMode || editorMode === 'visual';\n\tconst showBlockBreakcrumb =\n\t\tisEditMode && showVisualEditor && blockEditorMode !== 'zoom-out';\n\tconst shouldShowInserter = isEditMode && showVisualEditor && isInserterOpen;\n\tconst shouldShowListView = isEditMode && showVisualEditor && isListViewOpen;\n\tconst secondarySidebarLabel = isListViewOpen\n\t\t? __( 'List View' )\n\t\t: __( 'Block Library' );\n\tconst blockContext = useMemo(\n\t\t() => ( {\n\t\t\t...context,\n\t\t\tqueryContext: [\n\t\t\t\tcontext?.queryContext || { page: 1 },\n\t\t\t\t( newQueryContext ) =>\n\t\t\t\t\tsetEditedPostContext( {\n\t\t\t\t\t\t...context,\n\t\t\t\t\t\tqueryContext: {\n\t\t\t\t\t\t\t...context?.queryContext,\n\t\t\t\t\t\t\t...newQueryContext,\n\t\t\t\t\t\t},\n\t\t\t\t\t} ),\n\t\t\t],\n\t\t} ),\n\t\t[ context ]\n\t);\n\tconst isReady = editedPostType !== undefined && editedPostId !== undefined;\n\n\t// Only announce the title once the editor is ready to prevent \"Replace\"\n\t// action in <URlQueryController> from double-announcing.\n\tuseTitle( isReady && __( 'Editor (beta)' ) );\n\n\tif ( ! isReady ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{ isEditMode && <WelcomeGuide /> }\n\t\t\t<KeyboardShortcuts.Register />\n\t\t\t<EntityProvider kind=\"root\" type=\"site\">\n\t\t\t\t<EntityProvider\n\t\t\t\t\tkind=\"postType\"\n\t\t\t\t\ttype={ editedPostType }\n\t\t\t\t\tid={ editedPostId }\n\t\t\t\t>\n\t\t\t\t\t<GlobalStylesProvider>\n\t\t\t\t\t\t<BlockContextProvider value={ blockContext }>\n\t\t\t\t\t\t\t<SidebarComplementaryAreaFills />\n\t\t\t\t\t\t\t<InterfaceSkeleton\n\t\t\t\t\t\t\t\tenableRegionNavigation={ false }\n\t\t\t\t\t\t\t\tclassName={\n\t\t\t\t\t\t\t\t\tshowIconLabels && 'show-icon-labels'\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tnotices={ isEditMode && <EditorSnackbars /> }\n\t\t\t\t\t\t\t\tcontent={\n\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t<GlobalStylesRenderer />\n\t\t\t\t\t\t\t\t\t\t{ isEditMode && <EditorNotices /> }\n\t\t\t\t\t\t\t\t\t\t{ showVisualEditor && editedPost && (\n\t\t\t\t\t\t\t\t\t\t\t<BlockEditor />\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t{ editorMode === 'text' &&\n\t\t\t\t\t\t\t\t\t\t\teditedPost && <CodeEditor /> }\n\t\t\t\t\t\t\t\t\t\t{ hasLoadedPost && ! editedPost && (\n\t\t\t\t\t\t\t\t\t\t\t<Notice\n\t\t\t\t\t\t\t\t\t\t\t\tstatus=\"warning\"\n\t\t\t\t\t\t\t\t\t\t\t\tisDismissible={ false }\n\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"You attempted to edit an item that doesn't exist. Perhaps it was deleted?\"\n\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t</Notice>\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t{ isEditMode && <KeyboardShortcuts /> }\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\tsecondarySidebar={\n\t\t\t\t\t\t\t\t\tisEditMode &&\n\t\t\t\t\t\t\t\t\t( ( shouldShowInserter && (\n\t\t\t\t\t\t\t\t\t\t<InserterSidebar />\n\t\t\t\t\t\t\t\t\t) ) ||\n\t\t\t\t\t\t\t\t\t\t( shouldShowListView && (\n\t\t\t\t\t\t\t\t\t\t\t<ListViewSidebar />\n\t\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\tsidebar={\n\t\t\t\t\t\t\t\t\tisEditMode &&\n\t\t\t\t\t\t\t\t\tisRightSidebarOpen && (\n\t\t\t\t\t\t\t\t\t\t<ComplementaryArea.Slot scope=\"core/edit-site\" />\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\tactions={\n\t\t\t\t\t\t\t\t\tisEditMode && (\n\t\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t\t{ isSaveViewOpen ? (\n\t\t\t\t\t\t\t\t\t\t\t\t<EntitiesSavedStates\n\t\t\t\t\t\t\t\t\t\t\t\t\tclose={ () =>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tsetIsSaveViewOpened(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfalse\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\t\t\t\t<div className=\"edit-site-editor__toggle-save-panel\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tclassName=\"edit-site-editor__toggle-save-panel-button\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tsetIsSaveViewOpened(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttrue\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\taria-expanded={ false }\n\t\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'Open save panel'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tfooter={\n\t\t\t\t\t\t\t\t\tshowBlockBreakcrumb && (\n\t\t\t\t\t\t\t\t\t\t<BlockBreadcrumb\n\t\t\t\t\t\t\t\t\t\t\trootLabelText={ __( 'Template' ) }\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tlabels={ {\n\t\t\t\t\t\t\t\t\t...interfaceLabels,\n\t\t\t\t\t\t\t\t\tsecondarySidebar: secondarySidebarLabel,\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</BlockContextProvider>\n\t\t\t\t\t</GlobalStylesProvider>\n\t\t\t\t</EntityProvider>\n\t\t\t</EntityProvider>\n\t\t</>\n\t);\n}\n"]}
|
|
@@ -13,6 +13,8 @@ var _blocks = require("@wordpress/blocks");
|
|
|
13
13
|
|
|
14
14
|
var _compose = require("@wordpress/compose");
|
|
15
15
|
|
|
16
|
+
var _components = require("@wordpress/components");
|
|
17
|
+
|
|
16
18
|
/**
|
|
17
19
|
* WordPress dependencies
|
|
18
20
|
*/
|
|
@@ -20,21 +22,40 @@ const BlockPreviewPanel = _ref => {
|
|
|
20
22
|
var _getBlockType;
|
|
21
23
|
|
|
22
24
|
let {
|
|
23
|
-
name
|
|
25
|
+
name,
|
|
26
|
+
variation = ''
|
|
24
27
|
} = _ref;
|
|
25
|
-
const blockExample = (_getBlockType = (0, _blocks.getBlockType)(name)) === null || _getBlockType === void 0 ? void 0 : _getBlockType.example;
|
|
26
28
|
const [containerResizeListener, {
|
|
27
29
|
width: containerWidth,
|
|
28
30
|
height: containerHeight
|
|
29
31
|
}] = (0, _compose.useResizeObserver)();
|
|
32
|
+
const blockExample = (_getBlockType = (0, _blocks.getBlockType)(name)) === null || _getBlockType === void 0 ? void 0 : _getBlockType.example;
|
|
33
|
+
const blockExampleWithVariation = { ...blockExample,
|
|
34
|
+
attributes: { ...(blockExample === null || blockExample === void 0 ? void 0 : blockExample.attributes),
|
|
35
|
+
className: variation
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
const blocks = blockExample && (0, _blocks.getBlockFromExample)(name, variation ? blockExampleWithVariation : blockExample);
|
|
30
39
|
const viewportWidth = (blockExample === null || blockExample === void 0 ? void 0 : blockExample.viewportWidth) || containerWidth;
|
|
31
|
-
|
|
40
|
+
const minHeight = containerHeight;
|
|
41
|
+
return !blockExample ? null : (0, _element.createElement)(_components.__experimentalSpacer, {
|
|
42
|
+
marginX: 4,
|
|
43
|
+
marginBottom: 4
|
|
44
|
+
}, (0, _element.createElement)("div", {
|
|
32
45
|
className: "edit-site-global-styles__block-preview-panel"
|
|
33
46
|
}, containerResizeListener, (0, _element.createElement)(_blockEditor.BlockPreview, {
|
|
47
|
+
blocks: blocks,
|
|
34
48
|
viewportWidth: viewportWidth,
|
|
35
|
-
__experimentalMinHeight:
|
|
36
|
-
|
|
37
|
-
|
|
49
|
+
__experimentalMinHeight: minHeight,
|
|
50
|
+
__experimentalStyles: [{
|
|
51
|
+
css: `
|
|
52
|
+
body{
|
|
53
|
+
min-height:${minHeight}px;
|
|
54
|
+
display:flex;align-items:center;justify-content:center;
|
|
55
|
+
}
|
|
56
|
+
`
|
|
57
|
+
}]
|
|
58
|
+
})));
|
|
38
59
|
};
|
|
39
60
|
|
|
40
61
|
var _default = BlockPreviewPanel;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/block-preview-panel.js"],"names":["BlockPreviewPanel","name","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/block-preview-panel.js"],"names":["BlockPreviewPanel","name","variation","containerResizeListener","width","containerWidth","height","containerHeight","blockExample","example","blockExampleWithVariation","attributes","className","blocks","viewportWidth","minHeight","css"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AANA;AACA;AACA;AAMA,MAAMA,iBAAiB,GAAG,QAAgC;AAAA;;AAAA,MAA9B;AAAEC,IAAAA,IAAF;AAAQC,IAAAA,SAAS,GAAG;AAApB,GAA8B;AACzD,QAAM,CACLC,uBADK,EAEL;AAAEC,IAAAA,KAAK,EAAEC,cAAT;AAAyBC,IAAAA,MAAM,EAAEC;AAAjC,GAFK,IAGF,iCAHJ;AAIA,QAAMC,YAAY,oBAAG,0BAAcP,IAAd,CAAH,kDAAG,cAAsBQ,OAA3C;AACA,QAAMC,yBAAyB,GAAG,EACjC,GAAGF,YAD8B;AAEjCG,IAAAA,UAAU,EAAE,EACX,IAAGH,YAAH,aAAGA,YAAH,uBAAGA,YAAY,CAAEG,UAAjB,CADW;AAEXC,MAAAA,SAAS,EAAEV;AAFA;AAFqB,GAAlC;AAOA,QAAMW,MAAM,GACXL,YAAY,IACZ,iCACCP,IADD,EAECC,SAAS,GAAGQ,yBAAH,GAA+BF,YAFzC,CAFD;AAMA,QAAMM,aAAa,GAAG,CAAAN,YAAY,SAAZ,IAAAA,YAAY,WAAZ,YAAAA,YAAY,CAAEM,aAAd,KAA+BT,cAArD;AACA,QAAMU,SAAS,GAAGR,eAAlB;AAEA,SAAO,CAAEC,YAAF,GAAiB,IAAjB,GACN,4BAAC,gCAAD;AAAQ,IAAA,OAAO,EAAG,CAAlB;AAAsB,IAAA,YAAY,EAAG;AAArC,KACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACGL,uBADH,EAGC,4BAAC,yBAAD;AACC,IAAA,MAAM,EAAGU,MADV;AAEC,IAAA,aAAa,EAAGC,aAFjB;AAGC,IAAA,uBAAuB,EAAGC,SAH3B;AAIC,IAAA,oBAAoB,EAAG,CACtB;AACCC,MAAAA,GAAG,EAAG;AACb;AACA,sBAAuBD,SAAW;AAClC;AACA;AACA;AANM,KADsB;AAJxB,IAHD,CADD,CADD;AAuBA,CA7CD;;eA+Cef,iB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { BlockPreview } from '@wordpress/block-editor';\nimport { getBlockType, getBlockFromExample } from '@wordpress/blocks';\nimport { useResizeObserver } from '@wordpress/compose';\nimport { __experimentalSpacer as Spacer } from '@wordpress/components';\n\nconst BlockPreviewPanel = ( { name, variation = '' } ) => {\n\tconst [\n\t\tcontainerResizeListener,\n\t\t{ width: containerWidth, height: containerHeight },\n\t] = useResizeObserver();\n\tconst blockExample = getBlockType( name )?.example;\n\tconst blockExampleWithVariation = {\n\t\t...blockExample,\n\t\tattributes: {\n\t\t\t...blockExample?.attributes,\n\t\t\tclassName: variation,\n\t\t},\n\t};\n\tconst blocks =\n\t\tblockExample &&\n\t\tgetBlockFromExample(\n\t\t\tname,\n\t\t\tvariation ? blockExampleWithVariation : blockExample\n\t\t);\n\tconst viewportWidth = blockExample?.viewportWidth || containerWidth;\n\tconst minHeight = containerHeight;\n\n\treturn ! blockExample ? null : (\n\t\t<Spacer marginX={ 4 } marginBottom={ 4 }>\n\t\t\t<div className=\"edit-site-global-styles__block-preview-panel\">\n\t\t\t\t{ containerResizeListener }\n\n\t\t\t\t<BlockPreview\n\t\t\t\t\tblocks={ blocks }\n\t\t\t\t\tviewportWidth={ viewportWidth }\n\t\t\t\t\t__experimentalMinHeight={ minHeight }\n\t\t\t\t\t__experimentalStyles={ [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcss: `\n\t\t\t\t\t\t\t\tbody{\n\t\t\t\t\t\t\t\t\tmin-height:${ minHeight }px;\n\t\t\t\t\t\t\t\t\tdisplay:flex;align-items:center;justify-content:center;\n\t\t\t\t\t\t\t\t}\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</div>\n\t\t</Spacer>\n\t);\n};\n\nexport default BlockPreviewPanel;\n"]}
|
|
@@ -81,19 +81,20 @@ function applyAllFallbackStyles(border) {
|
|
|
81
81
|
|
|
82
82
|
function BorderPanel(_ref) {
|
|
83
83
|
let {
|
|
84
|
-
name
|
|
84
|
+
name,
|
|
85
|
+
variationPath = ''
|
|
85
86
|
} = _ref;
|
|
86
87
|
// To better reflect if the user has customized a value we need to
|
|
87
88
|
// ensure the style value being checked is from the `user` origin.
|
|
88
|
-
const [userBorderStyles] = (0, _hooks.useStyle)(
|
|
89
|
-
const [border, setBorder] = (0, _hooks.useStyle)(
|
|
89
|
+
const [userBorderStyles] = (0, _hooks.useStyle)(`${variationPath}border`, name, 'user');
|
|
90
|
+
const [border, setBorder] = (0, _hooks.useStyle)(`${variationPath}border`, name);
|
|
90
91
|
const colors = (0, _hooks.useColorsPerOrigin)(name);
|
|
91
92
|
const showBorderColor = useHasBorderColorControl(name);
|
|
92
93
|
const showBorderStyle = useHasBorderStyleControl(name);
|
|
93
94
|
const showBorderWidth = useHasBorderWidthControl(name); // Border radius.
|
|
94
95
|
|
|
95
96
|
const showBorderRadius = useHasBorderRadiusControl(name);
|
|
96
|
-
const [borderRadiusValues, setBorderRadius] = (0, _hooks.useStyle)(
|
|
97
|
+
const [borderRadiusValues, setBorderRadius] = (0, _hooks.useStyle)(`${variationPath}border.radius`, name);
|
|
97
98
|
|
|
98
99
|
const hasBorderRadius = () => {
|
|
99
100
|
const borderValues = userBorderStyles === null || userBorderStyles === void 0 ? void 0 : userBorderStyles.radius;
|
|
@@ -166,7 +167,6 @@ function BorderPanel(_ref) {
|
|
|
166
167
|
popoverOffset: 40,
|
|
167
168
|
popoverPlacement: "left-start",
|
|
168
169
|
value: border,
|
|
169
|
-
__experimentalHasMultipleOrigins: true,
|
|
170
170
|
__experimentalIsRenderedInSidebar: true,
|
|
171
171
|
size: '__unstable-large'
|
|
172
172
|
})), showBorderRadius && (0, _element.createElement)(_components.__experimentalToolsPanelItem, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/border-panel.js"],"names":["useHasBorderPanel","name","controls","useHasBorderColorControl","useHasBorderRadiusControl","useHasBorderStyleControl","useHasBorderWidthControl","some","Boolean","supports","includes","applyFallbackStyle","border","style","color","width","applyAllFallbackStyles","top","right","bottom","left","BorderPanel","userBorderStyles","setBorder","colors","showBorderColor","showBorderStyle","showBorderWidth","showBorderRadius","borderRadiusValues","setBorderRadius","hasBorderRadius","borderValues","radius","Object","entries","resetBorder","undefined","resetAll","onBorderChange","newBorder","newBorderWithStyle","updatedBorder","value"],"mappings":";;;;;;;;AAWA;;AARA;;AACA;;AAQA;;AAKA;;AAjBA;AACA;AACA;;AAYA;AACA;AACA;AAQO,SAASA,iBAAT,CAA4BC,IAA5B,EAAmC;AACzC,QAAMC,QAAQ,GAAG,CAChBC,wBAAwB,CAAEF,IAAF,CADR,EAEhBG,yBAAyB,CAAEH,IAAF,CAFT,EAGhBI,wBAAwB,CAAEJ,IAAF,CAHR,EAIhBK,wBAAwB,CAAEL,IAAF,CAJR,CAAjB;AAOA,SAAOC,QAAQ,CAACK,IAAT,CAAeC,OAAf,CAAP;AACA;;AAED,SAASL,wBAAT,CAAmCF,IAAnC,EAA0C;AACzC,QAAMQ,QAAQ,GAAG,2CAAgCR,IAAhC,CAAjB;AACA,SACC,uBAAY,cAAZ,EAA4BA,IAA5B,EAAoC,CAApC,KACAQ,QAAQ,CAACC,QAAT,CAAmB,aAAnB,CAFD;AAIA;;AAED,SAASN,yBAAT,CAAoCH,IAApC,EAA2C;AAC1C,QAAMQ,QAAQ,GAAG,2CAAgCR,IAAhC,CAAjB;AACA,SACC,uBAAY,eAAZ,EAA6BA,IAA7B,EAAqC,CAArC,KACAQ,QAAQ,CAACC,QAAT,CAAmB,cAAnB,CAFD;AAIA;;AAED,SAASL,wBAAT,CAAmCJ,IAAnC,EAA0C;AACzC,QAAMQ,QAAQ,GAAG,2CAAgCR,IAAhC,CAAjB;AACA,SACC,uBAAY,cAAZ,EAA4BA,IAA5B,EAAoC,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AgB,IACjB,4BAAC,wCAAD;AACC,IAAA,QAAQ,EAAGG,eADZ;AAEC,IAAA,KAAK,EAAG,cAAI,QAAJ,CAFT;AAGC,IAAA,UAAU,EAAG,MAAMD,eAAe,CAAEO,SAAF,CAHnC;AAIC,IAAA,gBAAgB,EAAG;AAJpB,KAMC,4BAAC,8CAAD;AACC,IAAA,MAAM,EAAGR,kBADV;AAEC,IAAA,QAAQ,EAAKc,KAAF,IAAa;AACvBb,MAAAA,eAAe,CAAEa,KAAK,IAAIN,SAAX,CAAf;AACA;AAJF,IAND,CAvBF,CADD;AAwCA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __experimentalBorderRadiusControl as BorderRadiusControl } from '@wordpress/block-editor';\nimport {\n\t__experimentalBorderBoxControl as BorderBoxControl,\n\t__experimentalHasSplitBorders as hasSplitBorders,\n\t__experimentalIsDefinedBorder as isDefinedBorder,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport { useCallback } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport {\n\tgetSupportedGlobalStylesPanels,\n\tuseColorsPerOrigin,\n\tuseSetting,\n\tuseStyle,\n} from './hooks';\n\nexport function useHasBorderPanel( name ) {\n\tconst controls = [\n\t\tuseHasBorderColorControl( name ),\n\t\tuseHasBorderRadiusControl( name ),\n\t\tuseHasBorderStyleControl( name ),\n\t\tuseHasBorderWidthControl( name ),\n\t];\n\n\treturn controls.some( Boolean );\n}\n\nfunction useHasBorderColorControl( name ) {\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\treturn (\n\t\tuseSetting( 'border.color', name )[ 0 ] &&\n\t\tsupports.includes( 'borderColor' )\n\t);\n}\n\nfunction useHasBorderRadiusControl( name ) {\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\treturn (\n\t\tuseSetting( 'border.radius', name )[ 0 ] &&\n\t\tsupports.includes( 'borderRadius' )\n\t);\n}\n\nfunction useHasBorderStyleControl( name ) {\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\treturn (\n\t\tuseSetting( 'border.style', name )[ 0 ] &&\n\t\tsupports.includes( 'borderStyle' )\n\t);\n}\n\nfunction useHasBorderWidthControl( name ) {\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\treturn (\n\t\tuseSetting( 'border.width', name )[ 0 ] &&\n\t\tsupports.includes( 'borderWidth' )\n\t);\n}\n\nfunction applyFallbackStyle( border ) {\n\tif ( ! border ) {\n\t\treturn border;\n\t}\n\n\tif ( ! border.style && ( border.color || border.width ) ) {\n\t\treturn { ...border, style: 'solid' };\n\t}\n\n\treturn border;\n}\n\nfunction applyAllFallbackStyles( border ) {\n\tif ( ! border ) {\n\t\treturn border;\n\t}\n\n\tif ( hasSplitBorders( border ) ) {\n\t\treturn {\n\t\t\ttop: applyFallbackStyle( border.top ),\n\t\t\tright: applyFallbackStyle( border.right ),\n\t\t\tbottom: applyFallbackStyle( border.bottom ),\n\t\t\tleft: applyFallbackStyle( border.left ),\n\t\t};\n\t}\n\n\treturn applyFallbackStyle( border );\n}\n\nexport default function BorderPanel( { name } ) {\n\t// To better reflect if the user has customized a value we need to\n\t// ensure the style value being checked is from the `user` origin.\n\tconst [ userBorderStyles ] = useStyle( 'border', name, 'user' );\n\tconst [ border, setBorder ] = useStyle( 'border', name );\n\tconst colors = useColorsPerOrigin( name );\n\n\tconst showBorderColor = useHasBorderColorControl( name );\n\tconst showBorderStyle = useHasBorderStyleControl( name );\n\tconst showBorderWidth = useHasBorderWidthControl( name );\n\n\t// Border radius.\n\tconst showBorderRadius = useHasBorderRadiusControl( name );\n\tconst [ borderRadiusValues, setBorderRadius ] = useStyle(\n\t\t'border.radius',\n\t\tname\n\t);\n\tconst hasBorderRadius = () => {\n\t\tconst borderValues = userBorderStyles?.radius;\n\t\tif ( typeof borderValues === 'object' ) {\n\t\t\treturn Object.entries( borderValues ).some( Boolean );\n\t\t}\n\t\treturn !! borderValues;\n\t};\n\n\tconst resetBorder = () => {\n\t\tif ( hasBorderRadius() ) {\n\t\t\treturn setBorder( { radius: userBorderStyles.radius } );\n\t\t}\n\n\t\tsetBorder( undefined );\n\t};\n\n\tconst resetAll = useCallback( () => setBorder( undefined ), [ setBorder ] );\n\tconst onBorderChange = useCallback(\n\t\t( newBorder ) => {\n\t\t\t// Ensure we have a visible border style when a border width or\n\t\t\t// color is being selected.\n\t\t\tconst newBorderWithStyle = applyAllFallbackStyles( newBorder );\n\n\t\t\t// As we can't conditionally generate styles based on if other\n\t\t\t// style properties have been set we need to force split border\n\t\t\t// definitions for user set border styles. Border radius is derived\n\t\t\t// from the same property i.e. `border.radius` if it is a string\n\t\t\t// that is used. The longhand border radii styles are only generated\n\t\t\t// if that property is an object.\n\t\t\t//\n\t\t\t// For borders (color, style, and width) those are all properties on\n\t\t\t// the `border` style property. This means if the theme.json defined\n\t\t\t// split borders and the user condenses them into a flat border or\n\t\t\t// vice-versa we'd get both sets of styles which would conflict.\n\t\t\tconst updatedBorder = ! hasSplitBorders( newBorderWithStyle )\n\t\t\t\t? {\n\t\t\t\t\t\ttop: newBorderWithStyle,\n\t\t\t\t\t\tright: newBorderWithStyle,\n\t\t\t\t\t\tbottom: newBorderWithStyle,\n\t\t\t\t\t\tleft: newBorderWithStyle,\n\t\t\t\t }\n\t\t\t\t: {\n\t\t\t\t\t\tcolor: null,\n\t\t\t\t\t\tstyle: null,\n\t\t\t\t\t\twidth: null,\n\t\t\t\t\t\t...newBorderWithStyle,\n\t\t\t\t };\n\n\t\t\t// As radius is maintained separately to color, style, and width\n\t\t\t// maintain its value. Undefined values here will be cleaned when\n\t\t\t// global styles are saved.\n\t\t\tsetBorder( { radius: border?.radius, ...updatedBorder } );\n\t\t},\n\t\t[ setBorder ]\n\t);\n\n\treturn (\n\t\t<ToolsPanel label={ __( 'Border' ) } resetAll={ resetAll }>\n\t\t\t{ ( showBorderWidth || showBorderColor ) && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\thasValue={ () => isDefinedBorder( userBorderStyles ) }\n\t\t\t\t\tlabel={ __( 'Border' ) }\n\t\t\t\t\tonDeselect={ () => resetBorder() }\n\t\t\t\t\tisShownByDefault={ true }\n\t\t\t\t>\n\t\t\t\t\t<BorderBoxControl\n\t\t\t\t\t\tcolors={ colors }\n\t\t\t\t\t\tenableAlpha={ true }\n\t\t\t\t\t\tenableStyle={ showBorderStyle }\n\t\t\t\t\t\tonChange={ onBorderChange }\n\t\t\t\t\t\tpopoverOffset={ 40 }\n\t\t\t\t\t\tpopoverPlacement=\"left-start\"\n\t\t\t\t\t\tvalue={ border }\n\t\t\t\t\t\t__experimentalHasMultipleOrigins={ true }\n\t\t\t\t\t\t__experimentalIsRenderedInSidebar={ true }\n\t\t\t\t\t\tsize={ '__unstable-large' }\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t\t{ showBorderRadius && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\thasValue={ hasBorderRadius }\n\t\t\t\t\tlabel={ __( 'Radius' ) }\n\t\t\t\t\tonDeselect={ () => setBorderRadius( undefined ) }\n\t\t\t\t\tisShownByDefault={ true }\n\t\t\t\t>\n\t\t\t\t\t<BorderRadiusControl\n\t\t\t\t\t\tvalues={ borderRadiusValues }\n\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\tsetBorderRadius( value || undefined );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t</ToolsPanel>\n\t);\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/border-panel.js"],"names":["useHasBorderPanel","name","controls","useHasBorderColorControl","useHasBorderRadiusControl","useHasBorderStyleControl","useHasBorderWidthControl","some","Boolean","supports","includes","applyFallbackStyle","border","style","color","width","applyAllFallbackStyles","top","right","bottom","left","BorderPanel","variationPath","userBorderStyles","setBorder","colors","showBorderColor","showBorderStyle","showBorderWidth","showBorderRadius","borderRadiusValues","setBorderRadius","hasBorderRadius","borderValues","radius","Object","entries","resetBorder","undefined","resetAll","onBorderChange","newBorder","newBorderWithStyle","updatedBorder","value"],"mappings":";;;;;;;;AAWA;;AARA;;AACA;;AAQA;;AAKA;;AAjBA;AACA;AACA;;AAYA;AACA;AACA;AAQO,SAASA,iBAAT,CAA4BC,IAA5B,EAAmC;AACzC,QAAMC,QAAQ,GAAG,CAChBC,wBAAwB,CAAEF,IAAF,CADR,EAEhBG,yBAAyB,CAAEH,IAAF,CAFT,EAGhBI,wBAAwB,CAAEJ,IAAF,CAHR,EAIhBK,wBAAwB,CAAEL,IAAF,CAJR,CAAjB;AAOA,SAAOC,QAAQ,CAACK,IAAT,CAAeC,OAAf,CAAP;AACA;;AAED,SAASL,wBAAT,CAAmCF,IAAnC,EAA0C;AACzC,QAAMQ,QAAQ,GAAG,2CAAgCR,IAAhC,CAAjB;AACA,SACC,uBAAY,cAAZ,EAA4BA,IAA5B,EAAoC,CAApC,KACAQ,QAAQ,CAACC,QAAT,CAAmB,aAAnB,CAFD;AAIA;;AAED,SAASN,yBAAT,CAAoCH,IAApC,EAA2C;AAC1C,QAAMQ,QAAQ,GAAG,2CAAgCR,IAAhC,CAAjB;AACA,SACC,uBAAY,eAAZ,EAA6BA,IAA7B,EAAqC,CAArC,KACAQ,QAAQ,CAACC,QAAT,CAAmB,cAAnB,CAFD;AAIA;;AAED,SAASL,wBAAT,CAAmCJ,IAAnC,EAA0C;AACzC,QAAMQ,QAAQ,GAAG,2CAAgCR,IAAhC,CAAjB;AACA,SACC,uBAAY,cAAZ,EAA4BA,IAA5B,EAAoC,CAApC,KACAQ,QAAQ,CAACC,QAAT,CAAmB,aAAnB,CAFD;AAIA;;AAED,SAASJ,wBAAT,CAAmCL,IAAnC,EAA0C;AACzC,QAAMQ,QAAQ,GAAG,2CAAgCR,IAAhC,CAAjB;AACA,SACC,uBAAY,cAAZ,EAA4BA,IAA5B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AAF,CAHnC;AAIC,IAAA,gBAAgB,EAAG;AAJpB,KAMC,4BAAC,8CAAD;AACC,IAAA,MAAM,EAAGR,kBADV;AAEC,IAAA,QAAQ,EAAKc,KAAF,IAAa;AACvBb,MAAAA,eAAe,CAAEa,KAAK,IAAIN,SAAX,CAAf;AACA;AAJF,IAND,CAtBF,CADD;AAuCA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __experimentalBorderRadiusControl as BorderRadiusControl } from '@wordpress/block-editor';\nimport {\n\t__experimentalBorderBoxControl as BorderBoxControl,\n\t__experimentalHasSplitBorders as hasSplitBorders,\n\t__experimentalIsDefinedBorder as isDefinedBorder,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport { useCallback } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport {\n\tgetSupportedGlobalStylesPanels,\n\tuseColorsPerOrigin,\n\tuseSetting,\n\tuseStyle,\n} from './hooks';\n\nexport function useHasBorderPanel( name ) {\n\tconst controls = [\n\t\tuseHasBorderColorControl( name ),\n\t\tuseHasBorderRadiusControl( name ),\n\t\tuseHasBorderStyleControl( name ),\n\t\tuseHasBorderWidthControl( name ),\n\t];\n\n\treturn controls.some( Boolean );\n}\n\nfunction useHasBorderColorControl( name ) {\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\treturn (\n\t\tuseSetting( 'border.color', name )[ 0 ] &&\n\t\tsupports.includes( 'borderColor' )\n\t);\n}\n\nfunction useHasBorderRadiusControl( name ) {\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\treturn (\n\t\tuseSetting( 'border.radius', name )[ 0 ] &&\n\t\tsupports.includes( 'borderRadius' )\n\t);\n}\n\nfunction useHasBorderStyleControl( name ) {\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\treturn (\n\t\tuseSetting( 'border.style', name )[ 0 ] &&\n\t\tsupports.includes( 'borderStyle' )\n\t);\n}\n\nfunction useHasBorderWidthControl( name ) {\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\treturn (\n\t\tuseSetting( 'border.width', name )[ 0 ] &&\n\t\tsupports.includes( 'borderWidth' )\n\t);\n}\n\nfunction applyFallbackStyle( border ) {\n\tif ( ! border ) {\n\t\treturn border;\n\t}\n\n\tif ( ! border.style && ( border.color || border.width ) ) {\n\t\treturn { ...border, style: 'solid' };\n\t}\n\n\treturn border;\n}\n\nfunction applyAllFallbackStyles( border ) {\n\tif ( ! border ) {\n\t\treturn border;\n\t}\n\n\tif ( hasSplitBorders( border ) ) {\n\t\treturn {\n\t\t\ttop: applyFallbackStyle( border.top ),\n\t\t\tright: applyFallbackStyle( border.right ),\n\t\t\tbottom: applyFallbackStyle( border.bottom ),\n\t\t\tleft: applyFallbackStyle( border.left ),\n\t\t};\n\t}\n\n\treturn applyFallbackStyle( border );\n}\n\nexport default function BorderPanel( { name, variationPath = '' } ) {\n\t// To better reflect if the user has customized a value we need to\n\t// ensure the style value being checked is from the `user` origin.\n\tconst [ userBorderStyles ] = useStyle(\n\t\t`${ variationPath }border`,\n\t\tname,\n\t\t'user'\n\t);\n\tconst [ border, setBorder ] = useStyle( `${ variationPath }border`, name );\n\tconst colors = useColorsPerOrigin( name );\n\n\tconst showBorderColor = useHasBorderColorControl( name );\n\tconst showBorderStyle = useHasBorderStyleControl( name );\n\tconst showBorderWidth = useHasBorderWidthControl( name );\n\n\t// Border radius.\n\tconst showBorderRadius = useHasBorderRadiusControl( name );\n\tconst [ borderRadiusValues, setBorderRadius ] = useStyle(\n\t\t`${ variationPath }border.radius`,\n\t\tname\n\t);\n\tconst hasBorderRadius = () => {\n\t\tconst borderValues = userBorderStyles?.radius;\n\t\tif ( typeof borderValues === 'object' ) {\n\t\t\treturn Object.entries( borderValues ).some( Boolean );\n\t\t}\n\t\treturn !! borderValues;\n\t};\n\n\tconst resetBorder = () => {\n\t\tif ( hasBorderRadius() ) {\n\t\t\treturn setBorder( { radius: userBorderStyles.radius } );\n\t\t}\n\n\t\tsetBorder( undefined );\n\t};\n\n\tconst resetAll = useCallback( () => setBorder( undefined ), [ setBorder ] );\n\tconst onBorderChange = useCallback(\n\t\t( newBorder ) => {\n\t\t\t// Ensure we have a visible border style when a border width or\n\t\t\t// color is being selected.\n\t\t\tconst newBorderWithStyle = applyAllFallbackStyles( newBorder );\n\n\t\t\t// As we can't conditionally generate styles based on if other\n\t\t\t// style properties have been set we need to force split border\n\t\t\t// definitions for user set border styles. Border radius is derived\n\t\t\t// from the same property i.e. `border.radius` if it is a string\n\t\t\t// that is used. The longhand border radii styles are only generated\n\t\t\t// if that property is an object.\n\t\t\t//\n\t\t\t// For borders (color, style, and width) those are all properties on\n\t\t\t// the `border` style property. This means if the theme.json defined\n\t\t\t// split borders and the user condenses them into a flat border or\n\t\t\t// vice-versa we'd get both sets of styles which would conflict.\n\t\t\tconst updatedBorder = ! hasSplitBorders( newBorderWithStyle )\n\t\t\t\t? {\n\t\t\t\t\t\ttop: newBorderWithStyle,\n\t\t\t\t\t\tright: newBorderWithStyle,\n\t\t\t\t\t\tbottom: newBorderWithStyle,\n\t\t\t\t\t\tleft: newBorderWithStyle,\n\t\t\t\t }\n\t\t\t\t: {\n\t\t\t\t\t\tcolor: null,\n\t\t\t\t\t\tstyle: null,\n\t\t\t\t\t\twidth: null,\n\t\t\t\t\t\t...newBorderWithStyle,\n\t\t\t\t };\n\n\t\t\t// As radius is maintained separately to color, style, and width\n\t\t\t// maintain its value. Undefined values here will be cleaned when\n\t\t\t// global styles are saved.\n\t\t\tsetBorder( { radius: border?.radius, ...updatedBorder } );\n\t\t},\n\t\t[ setBorder ]\n\t);\n\n\treturn (\n\t\t<ToolsPanel label={ __( 'Border' ) } resetAll={ resetAll }>\n\t\t\t{ ( showBorderWidth || showBorderColor ) && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\thasValue={ () => isDefinedBorder( userBorderStyles ) }\n\t\t\t\t\tlabel={ __( 'Border' ) }\n\t\t\t\t\tonDeselect={ () => resetBorder() }\n\t\t\t\t\tisShownByDefault={ true }\n\t\t\t\t>\n\t\t\t\t\t<BorderBoxControl\n\t\t\t\t\t\tcolors={ colors }\n\t\t\t\t\t\tenableAlpha={ true }\n\t\t\t\t\t\tenableStyle={ showBorderStyle }\n\t\t\t\t\t\tonChange={ onBorderChange }\n\t\t\t\t\t\tpopoverOffset={ 40 }\n\t\t\t\t\t\tpopoverPlacement=\"left-start\"\n\t\t\t\t\t\tvalue={ border }\n\t\t\t\t\t\t__experimentalIsRenderedInSidebar={ true }\n\t\t\t\t\t\tsize={ '__unstable-large' }\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t\t{ showBorderRadius && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\thasValue={ hasBorderRadius }\n\t\t\t\t\tlabel={ __( 'Radius' ) }\n\t\t\t\t\tonDeselect={ () => setBorderRadius( undefined ) }\n\t\t\t\t\tisShownByDefault={ true }\n\t\t\t\t>\n\t\t\t\t\t<BorderRadiusControl\n\t\t\t\t\t\tvalues={ borderRadiusValues }\n\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\tsetBorderRadius( value || undefined );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t</ToolsPanel>\n\t);\n}\n"]}
|
|
@@ -21,8 +21,12 @@ var _dimensionsPanel = require("./dimensions-panel");
|
|
|
21
21
|
|
|
22
22
|
var _typographyPanel = require("./typography-panel");
|
|
23
23
|
|
|
24
|
+
var _variationsPanel = require("./variations-panel");
|
|
25
|
+
|
|
24
26
|
var _navigationButton = require("./navigation-button");
|
|
25
27
|
|
|
28
|
+
var _screenVariations = require("./screen-variations");
|
|
29
|
+
|
|
26
30
|
/**
|
|
27
31
|
* WordPress dependencies
|
|
28
32
|
*/
|
|
@@ -40,6 +44,7 @@ function ContextMenu(_ref) {
|
|
|
40
44
|
const hasBorderPanel = (0, _borderPanel.useHasBorderPanel)(name);
|
|
41
45
|
const hasDimensionsPanel = (0, _dimensionsPanel.useHasDimensionsPanel)(name);
|
|
42
46
|
const hasLayoutPanel = hasDimensionsPanel;
|
|
47
|
+
const hasVariationsPanel = (0, _variationsPanel.useHasVariationsPanel)(name, parentMenu);
|
|
43
48
|
return (0, _element.createElement)(_components.__experimentalItemGroup, null, hasTypographyPanel && (0, _element.createElement)(_navigationButton.NavigationButtonAsItem, {
|
|
44
49
|
icon: _icons.typography,
|
|
45
50
|
path: parentMenu + '/typography',
|
|
@@ -56,7 +61,10 @@ function ContextMenu(_ref) {
|
|
|
56
61
|
icon: _icons.layout,
|
|
57
62
|
path: parentMenu + '/layout',
|
|
58
63
|
"aria-label": (0, _i18n.__)('Layout styles')
|
|
59
|
-
}, (0, _i18n.__)('Layout')))
|
|
64
|
+
}, (0, _i18n.__)('Layout')), hasVariationsPanel && (0, _element.createElement)(_screenVariations.ScreenVariations, {
|
|
65
|
+
name: name,
|
|
66
|
+
path: parentMenu
|
|
67
|
+
}));
|
|
60
68
|
}
|
|
61
69
|
|
|
62
70
|
var _default = ContextMenu;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/context-menu.js"],"names":["ContextMenu","name","parentMenu","hasTypographyPanel","hasColorPanel","hasBorderPanel","hasDimensionsPanel","hasLayoutPanel","typography","color","border","layout"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/context-menu.js"],"names":["ContextMenu","name","parentMenu","hasTypographyPanel","hasColorPanel","hasBorderPanel","hasDimensionsPanel","hasLayoutPanel","hasVariationsPanel","typography","color","border","layout"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAhBA;AACA;AACA;;AAKA;AACA;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;eAEcF,W","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __experimentalItemGroup as ItemGroup } from '@wordpress/components';\nimport { typography, border, color, layout } from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { useHasBorderPanel } from './border-panel';\nimport { useHasColorPanel } from './color-utils';\nimport { useHasDimensionsPanel } from './dimensions-panel';\nimport { useHasTypographyPanel } from './typography-panel';\nimport { useHasVariationsPanel } from './variations-panel';\nimport { NavigationButtonAsItem } from './navigation-button';\nimport { ScreenVariations } from './screen-variations';\n\nfunction ContextMenu( { name, parentMenu = '' } ) {\n\tconst hasTypographyPanel = useHasTypographyPanel( name );\n\tconst hasColorPanel = useHasColorPanel( name );\n\tconst hasBorderPanel = useHasBorderPanel( name );\n\tconst hasDimensionsPanel = useHasDimensionsPanel( name );\n\tconst hasLayoutPanel = hasDimensionsPanel;\n\tconst hasVariationsPanel = useHasVariationsPanel( name, parentMenu );\n\n\treturn (\n\t\t<ItemGroup>\n\t\t\t{ hasTypographyPanel && (\n\t\t\t\t<NavigationButtonAsItem\n\t\t\t\t\ticon={ typography }\n\t\t\t\t\tpath={ parentMenu + '/typography' }\n\t\t\t\t\taria-label={ __( 'Typography styles' ) }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Typography' ) }\n\t\t\t\t</NavigationButtonAsItem>\n\t\t\t) }\n\t\t\t{ hasColorPanel && (\n\t\t\t\t<NavigationButtonAsItem\n\t\t\t\t\ticon={ color }\n\t\t\t\t\tpath={ parentMenu + '/colors' }\n\t\t\t\t\taria-label={ __( 'Colors styles' ) }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Colors' ) }\n\t\t\t\t</NavigationButtonAsItem>\n\t\t\t) }\n\t\t\t{ hasBorderPanel && (\n\t\t\t\t<NavigationButtonAsItem\n\t\t\t\t\ticon={ border }\n\t\t\t\t\tpath={ parentMenu + '/border' }\n\t\t\t\t\taria-label={ __( 'Border styles' ) }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Border' ) }\n\t\t\t\t</NavigationButtonAsItem>\n\t\t\t) }\n\t\t\t{ hasLayoutPanel && (\n\t\t\t\t<NavigationButtonAsItem\n\t\t\t\t\ticon={ layout }\n\t\t\t\t\tpath={ parentMenu + '/layout' }\n\t\t\t\t\taria-label={ __( 'Layout styles' ) }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Layout' ) }\n\t\t\t\t</NavigationButtonAsItem>\n\t\t\t) }\n\t\t\t{ hasVariationsPanel && (\n\t\t\t\t<ScreenVariations name={ name } path={ parentMenu } />\n\t\t\t) }\n\t\t</ItemGroup>\n\t);\n}\n\nexport default ContextMenu;\n"]}
|
|
@@ -42,6 +42,7 @@ function CustomCSSControl() {
|
|
|
42
42
|
|
|
43
43
|
const originalThemeCustomCSS = themeCSS && customCSS && themeCustomCSS !== customCSS ? themeCSS : undefined;
|
|
44
44
|
return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_components.TextareaControl, {
|
|
45
|
+
__nextHasNoMarginBottom: true,
|
|
45
46
|
value: (customCSS === null || customCSS === void 0 ? void 0 : customCSS.replace(ignoreThemeCustomCSS, '')) || themeCustomCSS,
|
|
46
47
|
onChange: value => handleOnChange(value),
|
|
47
48
|
rows: 15,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/custom-css.js"],"names":["CustomCSSControl","customCSS","setCustomCSS","themeCSS","ignoreThemeCustomCSS","themeCustomCSS","undefined","handleOnChange","value","originalThemeCustomCSS","replace"],"mappings":";;;;;;;;;AAGA;;AACA;;AAKA;;AATA;AACA;AACA;;AAIA;AACA;AACA;AAGA,SAASA,gBAAT,GAA4B;AAC3B,QAAM,CAAEC,SAAF,EAAaC,YAAb,IAA8B,qBAAU,KAAV,CAApC;AACA,QAAM,CAAEC,QAAF,IAAe,qBAAU,KAAV,EAAiB,IAAjB,EAAuB,MAAvB,CAArB;AACA,QAAMC,oBAAoB,GAAG,4BAA7B,CAH2B,CAK3B;AACA;AACA;;AACA,QAAMC,cAAc,GACnB,CAAEJ,SAAF,IAAeE,QAAf,GACI,MAAM,cACP,wBADO,CAEJ,QAAQA,QAAU,QAAQ,cAAI,sBAAJ,CAA8B,KAH9D,GAIGG,SALJ;;AAOA,WAASC,cAAT,CAAyBC,KAAzB,EAAiC;AAChC;AACA;AACA,QAAKL,QAAQ,IAAIK,KAAK,KAAK,EAA3B,EAAgC;AAC/BN,MAAAA,YAAY,CAAEE,oBAAF,CAAZ;AACA;AACA;;AACDF,IAAAA,YAAY,CAAEM,KAAF,CAAZ;AACA;;AAED,QAAMC,sBAAsB,GAC3BN,QAAQ,IAAIF,SAAZ,IAAyBI,cAAc,KAAKJ,SAA5C,GACGE,QADH,GAEGG,SAHJ;AAKA,SACC,qDACC,4BAAC,2BAAD;AACC,IAAA,KAAK,EACJ,CAAAL,SAAS,SAAT,IAAAA,SAAS,WAAT,YAAAA,SAAS,CAAES,OAAX,CAAoBN,oBAApB,EAA0C,EAA1C,MACAC,
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/custom-css.js"],"names":["CustomCSSControl","customCSS","setCustomCSS","themeCSS","ignoreThemeCustomCSS","themeCustomCSS","undefined","handleOnChange","value","originalThemeCustomCSS","replace"],"mappings":";;;;;;;;;AAGA;;AACA;;AAKA;;AATA;AACA;AACA;;AAIA;AACA;AACA;AAGA,SAASA,gBAAT,GAA4B;AAC3B,QAAM,CAAEC,SAAF,EAAaC,YAAb,IAA8B,qBAAU,KAAV,CAApC;AACA,QAAM,CAAEC,QAAF,IAAe,qBAAU,KAAV,EAAiB,IAAjB,EAAuB,MAAvB,CAArB;AACA,QAAMC,oBAAoB,GAAG,4BAA7B,CAH2B,CAK3B;AACA;AACA;;AACA,QAAMC,cAAc,GACnB,CAAEJ,SAAF,IAAeE,QAAf,GACI,MAAM,cACP,wBADO,CAEJ,QAAQA,QAAU,QAAQ,cAAI,sBAAJ,CAA8B,KAH9D,GAIGG,SALJ;;AAOA,WAASC,cAAT,CAAyBC,KAAzB,EAAiC;AAChC;AACA;AACA,QAAKL,QAAQ,IAAIK,KAAK,KAAK,EAA3B,EAAgC;AAC/BN,MAAAA,YAAY,CAAEE,oBAAF,CAAZ;AACA;AACA;;AACDF,IAAAA,YAAY,CAAEM,KAAF,CAAZ;AACA;;AAED,QAAMC,sBAAsB,GAC3BN,QAAQ,IAAIF,SAAZ,IAAyBI,cAAc,KAAKJ,SAA5C,GACGE,QADH,GAEGG,SAHJ;AAKA,SACC,qDACC,4BAAC,2BAAD;AACC,IAAA,uBAAuB,MADxB;AAEC,IAAA,KAAK,EACJ,CAAAL,SAAS,SAAT,IAAAA,SAAS,WAAT,YAAAA,SAAS,CAAES,OAAX,CAAoBN,oBAApB,EAA0C,EAA1C,MACAC,cAJF;AAMC,IAAA,QAAQ,EAAKG,KAAF,IAAaD,cAAc,CAAEC,KAAF,CANvC;AAOC,IAAA,IAAI,EAAG,EAPR;AAQC,IAAA,SAAS,EAAC,2CARX;AASC,IAAA,UAAU,EAAG,KATd;AAUC,IAAA,IAAI,EAAG,cACN,6HADM;AAVR,IADD,EAeGC,sBAAsB,IACvB,4BAAC,iBAAD,QACC,4BAAC,qBAAD;AACC,IAAA,KAAK,EAAG,cAAI,2BAAJ,CADT;AAEC,IAAA,WAAW,EAAG;AAFf,KAIC;AAAK,IAAA,SAAS,EAAC;AAAf,KACGA,sBADH,CAJD,CADD,CAhBF,CADD;AA8BA;;eAEcT,gB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { TextareaControl, Panel, PanelBody } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { useStyle } from './hooks';\n\nfunction CustomCSSControl() {\n\tconst [ customCSS, setCustomCSS ] = useStyle( 'css' );\n\tconst [ themeCSS ] = useStyle( 'css', null, 'base' );\n\tconst ignoreThemeCustomCSS = '/* IgnoreThemeCustomCSS */';\n\n\t// If there is custom css from theme.json show it in the edit box\n\t// so the user can selectively overwrite it, rather than have the user CSS\n\t// completely overwrite the theme CSS by default.\n\tconst themeCustomCSS =\n\t\t! customCSS && themeCSS\n\t\t\t? `/* ${ __(\n\t\t\t\t\t'Theme Custom CSS start'\n\t\t\t ) } */\\n${ themeCSS }\\n/* ${ __( 'Theme Custom CSS end' ) } */`\n\t\t\t: undefined;\n\n\tfunction handleOnChange( value ) {\n\t\t// If there is theme custom CSS, but the user clears the input box then save the\n\t\t// ignoreThemeCustomCSS string so that the theme custom CSS is not re-applied.\n\t\tif ( themeCSS && value === '' ) {\n\t\t\tsetCustomCSS( ignoreThemeCustomCSS );\n\t\t\treturn;\n\t\t}\n\t\tsetCustomCSS( value );\n\t}\n\n\tconst originalThemeCustomCSS =\n\t\tthemeCSS && customCSS && themeCustomCSS !== customCSS\n\t\t\t? themeCSS\n\t\t\t: undefined;\n\n\treturn (\n\t\t<>\n\t\t\t<TextareaControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tvalue={\n\t\t\t\t\tcustomCSS?.replace( ignoreThemeCustomCSS, '' ) ||\n\t\t\t\t\tthemeCustomCSS\n\t\t\t\t}\n\t\t\t\tonChange={ ( value ) => handleOnChange( value ) }\n\t\t\t\trows={ 15 }\n\t\t\t\tclassName=\"edit-site-global-styles__custom-css-input\"\n\t\t\t\tspellCheck={ false }\n\t\t\t\thelp={ __(\n\t\t\t\t\t\"Enter your custom CSS in the textarea and preview in the editor. Changes won't take effect until you've saved the template.\"\n\t\t\t\t) }\n\t\t\t/>\n\t\t\t{ originalThemeCustomCSS && (\n\t\t\t\t<Panel>\n\t\t\t\t\t<PanelBody\n\t\t\t\t\t\ttitle={ __( 'Original Theme Custom CSS' ) }\n\t\t\t\t\t\tinitialOpen={ false }\n\t\t\t\t\t>\n\t\t\t\t\t\t<pre className=\"edit-site-global-styles__custom-css-theme-css\">\n\t\t\t\t\t\t\t{ originalThemeCustomCSS }\n\t\t\t\t\t\t</pre>\n\t\t\t\t\t</PanelBody>\n\t\t\t\t</Panel>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default CustomCSSControl;\n"]}
|
|
@@ -180,7 +180,8 @@ function useWideSizeProps(name) {
|
|
|
180
180
|
|
|
181
181
|
|
|
182
182
|
function usePaddingProps(name) {
|
|
183
|
-
|
|
183
|
+
let variationPath = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
184
|
+
const [rawPadding, setRawPadding] = (0, _hooks.useStyle)(variationPath + 'spacing.padding', name);
|
|
184
185
|
const paddingValues = splitStyleValue(rawPadding);
|
|
185
186
|
const paddingSides = (0, _blockEditor.__experimentalUseCustomSides)(name, 'padding');
|
|
186
187
|
const isAxialPadding = paddingSides && paddingSides.some(side => AXIAL_SIDES.includes(side));
|
|
@@ -192,7 +193,7 @@ function usePaddingProps(name) {
|
|
|
192
193
|
|
|
193
194
|
const resetPaddingValue = () => setPaddingValues({});
|
|
194
195
|
|
|
195
|
-
const [userSetPaddingValue] = (0, _hooks.useStyle)('spacing.padding', name, 'user'); // The `hasPaddingValue` check does not need a parsed value, as `userSetPaddingValue` will be `undefined` if not set.
|
|
196
|
+
const [userSetPaddingValue] = (0, _hooks.useStyle)(variationPath + 'spacing.padding', name, 'user'); // The `hasPaddingValue` check does not need a parsed value, as `userSetPaddingValue` will be `undefined` if not set.
|
|
196
197
|
|
|
197
198
|
const hasPaddingValue = () => !!userSetPaddingValue;
|
|
198
199
|
|
|
@@ -208,7 +209,8 @@ function usePaddingProps(name) {
|
|
|
208
209
|
|
|
209
210
|
|
|
210
211
|
function useMarginProps(name) {
|
|
211
|
-
|
|
212
|
+
let variationPath = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
213
|
+
const [rawMargin, setRawMargin] = (0, _hooks.useStyle)(variationPath + 'spacing.margin', name);
|
|
212
214
|
const marginValues = splitStyleValue(rawMargin);
|
|
213
215
|
const marginSides = (0, _blockEditor.__experimentalUseCustomSides)(name, 'margin');
|
|
214
216
|
const isAxialMargin = marginSides && marginSides.some(side => AXIAL_SIDES.includes(side));
|
|
@@ -234,14 +236,15 @@ function useMarginProps(name) {
|
|
|
234
236
|
|
|
235
237
|
|
|
236
238
|
function useBlockGapProps(name) {
|
|
237
|
-
|
|
239
|
+
let variationPath = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
240
|
+
const [gapValue, setGapValue] = (0, _hooks.useStyle)(variationPath + 'spacing.blockGap', name);
|
|
238
241
|
const gapValues = splitGapValue(gapValue);
|
|
239
242
|
const gapSides = (0, _blockEditor.__experimentalUseCustomSides)(name, 'blockGap');
|
|
240
243
|
const isAxialGap = gapSides && gapSides.some(side => AXIAL_SIDES.includes(side));
|
|
241
244
|
|
|
242
245
|
const resetGapValue = () => setGapValue(undefined);
|
|
243
246
|
|
|
244
|
-
const [userSetGapValue] = (0, _hooks.useStyle)('spacing.blockGap', name, 'user');
|
|
247
|
+
const [userSetGapValue] = (0, _hooks.useStyle)(variationPath + 'spacing.blockGap', name, 'user');
|
|
245
248
|
|
|
246
249
|
const hasGapValue = () => !!userSetGapValue;
|
|
247
250
|
|
|
@@ -275,7 +278,8 @@ function useBlockGapProps(name) {
|
|
|
275
278
|
|
|
276
279
|
|
|
277
280
|
function useMinHeightProps(name) {
|
|
278
|
-
|
|
281
|
+
let variationPath = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
282
|
+
const [minHeightValue, setMinHeightValue] = (0, _hooks.useStyle)(variationPath + 'dimensions.minHeight', name);
|
|
279
283
|
|
|
280
284
|
const resetMinHeightValue = () => setMinHeightValue(undefined);
|
|
281
285
|
|
|
@@ -291,7 +295,8 @@ function useMinHeightProps(name) {
|
|
|
291
295
|
|
|
292
296
|
function DimensionsPanel(_ref) {
|
|
293
297
|
let {
|
|
294
|
-
name
|
|
298
|
+
name,
|
|
299
|
+
variationPath = ''
|
|
295
300
|
} = _ref;
|
|
296
301
|
const showContentSizeControl = useHasContentSize(name);
|
|
297
302
|
const showWideSizeControl = useHasWideSize(name);
|
|
@@ -325,7 +330,7 @@ function DimensionsPanel(_ref) {
|
|
|
325
330
|
setPaddingValues,
|
|
326
331
|
resetPaddingValue,
|
|
327
332
|
hasPaddingValue
|
|
328
|
-
} = usePaddingProps(name); // Props for managing `spacing.margin`.
|
|
333
|
+
} = usePaddingProps(name, variationPath); // Props for managing `spacing.margin`.
|
|
329
334
|
|
|
330
335
|
const {
|
|
331
336
|
marginValues,
|
|
@@ -334,7 +339,7 @@ function DimensionsPanel(_ref) {
|
|
|
334
339
|
setMarginValues,
|
|
335
340
|
resetMarginValue,
|
|
336
341
|
hasMarginValue
|
|
337
|
-
} = useMarginProps(name); // Props for managing `spacing.blockGap`.
|
|
342
|
+
} = useMarginProps(name, variationPath); // Props for managing `spacing.blockGap`.
|
|
338
343
|
|
|
339
344
|
const {
|
|
340
345
|
gapValue,
|
|
@@ -345,14 +350,14 @@ function DimensionsPanel(_ref) {
|
|
|
345
350
|
setGapValues,
|
|
346
351
|
resetGapValue,
|
|
347
352
|
hasGapValue
|
|
348
|
-
} = useBlockGapProps(name); // Props for managing `dimensions.minHeight`.
|
|
353
|
+
} = useBlockGapProps(name, variationPath); // Props for managing `dimensions.minHeight`.
|
|
349
354
|
|
|
350
355
|
const {
|
|
351
356
|
minHeightValue,
|
|
352
357
|
setMinHeightValue,
|
|
353
358
|
resetMinHeightValue,
|
|
354
359
|
hasMinHeightValue
|
|
355
|
-
} = useMinHeightProps(name);
|
|
360
|
+
} = useMinHeightProps(name, variationPath);
|
|
356
361
|
|
|
357
362
|
const resetAll = () => {
|
|
358
363
|
resetPaddingValue();
|