@wordpress/edit-site 3.0.14 → 3.0.18-next.33ec3857e2.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/build/components/add-new-template/new-template-part.js +29 -18
- package/build/components/add-new-template/new-template-part.js.map +1 -1
- package/build/components/add-new-template/new-template.js +30 -23
- package/build/components/add-new-template/new-template.js.map +1 -1
- package/build/components/app/index.js +51 -0
- package/build/components/app/index.js.map +1 -0
- package/build/components/block-editor/back-button.js +8 -20
- package/build/components/block-editor/back-button.js.map +1 -1
- package/build/components/block-editor/index.js +2 -1
- package/build/components/block-editor/index.js.map +1 -1
- package/build/components/block-editor/resizable-editor.js +1 -0
- package/build/components/block-editor/resizable-editor.js.map +1 -1
- package/build/components/create-template-part-modal/index.js +0 -2
- package/build/components/create-template-part-modal/index.js.map +1 -1
- package/build/components/edit-template-part-menu-button/index.js +20 -8
- package/build/components/edit-template-part-menu-button/index.js.map +1 -1
- package/build/components/editor/index.js +11 -30
- package/build/components/editor/index.js.map +1 -1
- package/build/components/global-styles/border-panel.js +81 -22
- package/build/components/global-styles/border-panel.js.map +1 -1
- package/build/components/global-styles/gradients-palette-panel.js +10 -10
- package/build/components/global-styles/gradients-palette-panel.js.map +1 -1
- package/build/components/global-styles/screen-background-color.js +9 -10
- package/build/components/global-styles/screen-background-color.js.map +1 -1
- package/build/components/global-styles/screen-colors.js +1 -1
- package/build/components/global-styles/screen-colors.js.map +1 -1
- package/build/components/global-styles/screen-link-color.js +6 -10
- package/build/components/global-styles/screen-link-color.js.map +1 -1
- package/build/components/global-styles/screen-root.js +8 -2
- package/build/components/global-styles/screen-root.js.map +1 -1
- package/build/components/global-styles/screen-text-color.js +6 -10
- package/build/components/global-styles/screen-text-color.js.map +1 -1
- package/build/components/global-styles/ui.js +27 -14
- package/build/components/global-styles/ui.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +1 -2
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/header/document-actions/index.js +3 -6
- package/build/components/header/document-actions/index.js.map +1 -1
- package/build/components/list/actions/index.js +1 -0
- package/build/components/list/actions/index.js.map +1 -1
- package/build/components/list/index.js +17 -15
- package/build/components/list/index.js.map +1 -1
- package/build/components/list/table.js +4 -4
- package/build/components/list/table.js.map +1 -1
- package/build/components/navigation-sidebar/index.js +12 -13
- package/build/components/navigation-sidebar/index.js.map +1 -1
- package/build/components/navigation-sidebar/navigation-panel/index.js +26 -24
- package/build/components/navigation-sidebar/navigation-panel/index.js.map +1 -1
- package/build/components/navigation-sidebar/navigation-toggle/index.js +3 -1
- package/build/components/navigation-sidebar/navigation-toggle/index.js.map +1 -1
- package/build/components/routes/index.js +60 -0
- package/build/components/routes/index.js.map +1 -0
- package/build/components/routes/link.js +65 -0
- package/build/components/routes/link.js.map +1 -0
- package/build/components/routes/use-title.js +57 -0
- package/build/components/routes/use-title.js.map +1 -0
- package/build/components/sidebar/default-sidebar.js +4 -2
- package/build/components/sidebar/default-sidebar.js.map +1 -1
- package/build/components/sidebar/global-styles-sidebar.js +11 -0
- package/build/components/sidebar/global-styles-sidebar.js.map +1 -1
- package/build/components/sidebar/template-card/template-areas.js +7 -4
- package/build/components/sidebar/template-card/template-areas.js.map +1 -1
- package/build/components/template-details/index.js +12 -10
- package/build/components/template-details/index.js.map +1 -1
- package/build/components/template-details/template-areas.js +27 -10
- package/build/components/template-details/template-areas.js.map +1 -1
- package/build/components/template-part-converter/convert-to-template-part.js +7 -12
- package/build/components/template-part-converter/convert-to-template-part.js.map +1 -1
- package/build/components/url-query-controller/index.js +41 -50
- package/build/components/url-query-controller/index.js.map +1 -1
- package/build/components/welcome-guide/editor.js +6 -0
- package/build/components/welcome-guide/editor.js.map +1 -1
- package/build/components/welcome-guide/index.js +1 -28
- package/build/components/welcome-guide/index.js.map +1 -1
- package/build/components/welcome-guide/styles.js +18 -1
- package/build/components/welcome-guide/styles.js.map +1 -1
- package/build/index.js +29 -35
- package/build/index.js.map +1 -1
- package/build/plugins/index.js +3 -23
- package/build/plugins/index.js.map +1 -1
- package/build/plugins/site-export.js +67 -0
- package/build/plugins/site-export.js.map +1 -0
- package/build/plugins/welcome-guide-menu-item.js +1 -7
- package/build/plugins/welcome-guide-menu-item.js.map +1 -1
- package/build/store/actions.js +0 -27
- package/build/store/actions.js.map +1 -1
- package/build/store/constants.js +1 -14
- package/build/store/constants.js.map +1 -1
- package/build/store/reducer.js +7 -16
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +1 -31
- package/build/store/selectors.js.map +1 -1
- package/build/utils/get-is-list-page.js +23 -0
- package/build/utils/get-is-list-page.js.map +1 -0
- package/build/utils/history.js +35 -0
- package/build/utils/history.js.map +1 -0
- package/build-module/components/add-new-template/new-template-part.js +27 -16
- package/build-module/components/add-new-template/new-template-part.js.map +1 -1
- package/build-module/components/add-new-template/new-template.js +28 -18
- package/build-module/components/add-new-template/new-template.js.map +1 -1
- package/build-module/components/app/index.js +35 -0
- package/build-module/components/app/index.js.map +1 -0
- package/build-module/components/block-editor/back-button.js +8 -19
- package/build-module/components/block-editor/back-button.js.map +1 -1
- package/build-module/components/block-editor/index.js +2 -1
- package/build-module/components/block-editor/index.js.map +1 -1
- package/build-module/components/block-editor/resizable-editor.js +1 -0
- package/build-module/components/block-editor/resizable-editor.js.map +1 -1
- package/build-module/components/create-template-part-modal/index.js +0 -2
- package/build-module/components/create-template-part-modal/index.js.map +1 -1
- package/build-module/components/edit-template-part-menu-button/index.js +17 -9
- package/build-module/components/edit-template-part-menu-button/index.js.map +1 -1
- package/build-module/components/editor/index.js +13 -33
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/global-styles/border-panel.js +82 -23
- package/build-module/components/global-styles/border-panel.js.map +1 -1
- package/build-module/components/global-styles/gradients-palette-panel.js +10 -10
- package/build-module/components/global-styles/gradients-palette-panel.js.map +1 -1
- package/build-module/components/global-styles/screen-background-color.js +9 -11
- package/build-module/components/global-styles/screen-background-color.js.map +1 -1
- package/build-module/components/global-styles/screen-colors.js +1 -1
- package/build-module/components/global-styles/screen-colors.js.map +1 -1
- package/build-module/components/global-styles/screen-link-color.js +7 -11
- package/build-module/components/global-styles/screen-link-color.js.map +1 -1
- package/build-module/components/global-styles/screen-root.js +9 -4
- package/build-module/components/global-styles/screen-root.js.map +1 -1
- package/build-module/components/global-styles/screen-text-color.js +7 -11
- package/build-module/components/global-styles/screen-text-color.js.map +1 -1
- package/build-module/components/global-styles/ui.js +26 -14
- package/build-module/components/global-styles/ui.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +1 -2
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/header/document-actions/index.js +3 -6
- package/build-module/components/header/document-actions/index.js.map +1 -1
- package/build-module/components/list/actions/index.js +1 -0
- package/build-module/components/list/actions/index.js.map +1 -1
- package/build-module/components/list/index.js +15 -15
- package/build-module/components/list/index.js.map +1 -1
- package/build-module/components/list/table.js +4 -4
- package/build-module/components/list/table.js.map +1 -1
- package/build-module/components/navigation-sidebar/index.js +13 -13
- package/build-module/components/navigation-sidebar/index.js.map +1 -1
- package/build-module/components/navigation-sidebar/navigation-panel/index.js +24 -24
- package/build-module/components/navigation-sidebar/navigation-panel/index.js.map +1 -1
- package/build-module/components/navigation-sidebar/navigation-toggle/index.js +3 -1
- package/build-module/components/navigation-sidebar/navigation-toggle/index.js.map +1 -1
- package/build-module/components/routes/index.js +47 -0
- package/build-module/components/routes/index.js.map +1 -0
- package/build-module/components/routes/link.js +51 -0
- package/build-module/components/routes/link.js.map +1 -0
- package/build-module/components/routes/use-title.js +44 -0
- package/build-module/components/routes/use-title.js.map +1 -0
- package/build-module/components/sidebar/default-sidebar.js +4 -2
- package/build-module/components/sidebar/default-sidebar.js.map +1 -1
- package/build-module/components/sidebar/global-styles-sidebar.js +9 -0
- package/build-module/components/sidebar/global-styles-sidebar.js.map +1 -1
- package/build-module/components/sidebar/template-card/template-areas.js +8 -4
- package/build-module/components/sidebar/template-card/template-areas.js.map +1 -1
- package/build-module/components/template-details/index.js +10 -9
- package/build-module/components/template-details/index.js.map +1 -1
- package/build-module/components/template-details/template-areas.js +24 -9
- package/build-module/components/template-details/template-areas.js.map +1 -1
- package/build-module/components/template-part-converter/convert-to-template-part.js +7 -12
- package/build-module/components/template-part-converter/convert-to-template-part.js.map +1 -1
- package/build-module/components/url-query-controller/index.js +40 -49
- package/build-module/components/url-query-controller/index.js.map +1 -1
- package/build-module/components/welcome-guide/editor.js +7 -1
- package/build-module/components/welcome-guide/editor.js.map +1 -1
- package/build-module/components/welcome-guide/index.js +2 -26
- package/build-module/components/welcome-guide/index.js.map +1 -1
- package/build-module/components/welcome-guide/styles.js +18 -2
- package/build-module/components/welcome-guide/styles.js.map +1 -1
- package/build-module/index.js +28 -33
- package/build-module/index.js.map +1 -1
- package/build-module/plugins/index.js +2 -18
- package/build-module/plugins/index.js.map +1 -1
- package/build-module/plugins/site-export.js +51 -0
- package/build-module/plugins/site-export.js.map +1 -0
- package/build-module/plugins/welcome-guide-menu-item.js +2 -7
- package/build-module/plugins/welcome-guide-menu-item.js.map +1 -1
- package/build-module/store/actions.js +0 -23
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/constants.js +0 -11
- package/build-module/store/constants.js.map +1 -1
- package/build-module/store/reducer.js +7 -16
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +1 -27
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/get-is-list-page.js +16 -0
- package/build-module/utils/get-is-list-page.js.map +1 -0
- package/build-module/utils/history.js +25 -0
- package/build-module/utils/history.js.map +1 -0
- package/build-style/style-rtl.css +36 -61
- package/build-style/style.css +36 -61
- package/package.json +29 -28
- package/src/components/add-new-template/new-template-part.js +29 -11
- package/src/components/add-new-template/new-template.js +26 -12
- package/src/components/app/index.js +47 -0
- package/src/components/block-editor/back-button.js +6 -14
- package/src/components/block-editor/index.js +1 -0
- package/src/components/block-editor/resizable-editor.js +1 -0
- package/src/components/block-editor/style.scss +10 -18
- package/src/components/create-template-part-modal/index.js +0 -2
- package/src/components/edit-template-part-menu-button/index.js +16 -5
- package/src/components/editor/index.js +105 -131
- package/src/components/global-styles/border-panel.js +106 -42
- package/src/components/global-styles/gradients-palette-panel.js +12 -12
- package/src/components/global-styles/screen-background-color.js +7 -10
- package/src/components/global-styles/screen-colors.js +1 -1
- package/src/components/global-styles/screen-link-color.js +6 -14
- package/src/components/global-styles/screen-root.js +17 -7
- package/src/components/global-styles/screen-text-color.js +6 -14
- package/src/components/global-styles/style.scss +6 -17
- package/src/components/global-styles/test/use-global-styles-output.js +7 -1
- package/src/components/global-styles/ui.js +50 -25
- package/src/components/global-styles/use-global-styles-output.js +0 -1
- package/src/components/header/document-actions/index.js +3 -9
- package/src/components/header/document-actions/style.scss +1 -9
- package/src/components/header/style.scss +2 -1
- package/src/components/list/actions/index.js +1 -0
- package/src/components/list/index.js +11 -12
- package/src/components/list/style.scss +6 -11
- package/src/components/list/table.js +5 -5
- package/src/components/navigation-sidebar/index.js +18 -17
- package/src/components/navigation-sidebar/navigation-panel/index.js +16 -22
- package/src/components/navigation-sidebar/navigation-toggle/index.js +2 -0
- package/src/components/routes/index.js +53 -0
- package/src/components/routes/link.js +44 -0
- package/src/components/routes/use-title.js +56 -0
- package/src/components/sidebar/default-sidebar.js +2 -0
- package/src/components/sidebar/global-styles-sidebar.js +9 -0
- package/src/components/sidebar/style.scss +21 -14
- package/src/components/sidebar/template-card/template-areas.js +16 -4
- package/src/components/template-details/index.js +8 -6
- package/src/components/template-details/template-areas.js +31 -8
- package/src/components/template-part-converter/convert-to-template-part.js +4 -2
- package/src/components/url-query-controller/index.js +34 -45
- package/src/components/welcome-guide/editor.js +10 -1
- package/src/components/welcome-guide/index.js +6 -25
- package/src/components/welcome-guide/styles.js +20 -2
- package/src/index.js +33 -36
- package/src/plugins/index.js +2 -32
- package/src/plugins/site-export.js +52 -0
- package/src/plugins/welcome-guide-menu-item.js +2 -16
- package/src/store/actions.js +0 -23
- package/src/store/constants.js +0 -12
- package/src/store/reducer.js +12 -26
- package/src/store/selectors.js +1 -27
- package/src/store/test/reducer.js +22 -39
- package/src/store/test/selectors.js +3 -34
- package/src/utils/get-is-list-page.js +11 -0
- package/src/utils/history.js +35 -0
|
@@ -13,6 +13,8 @@ var _components = require("@wordpress/components");
|
|
|
13
13
|
|
|
14
14
|
var _i18n = require("@wordpress/i18n");
|
|
15
15
|
|
|
16
|
+
var _icons = require("@wordpress/icons");
|
|
17
|
+
|
|
16
18
|
var _preview = _interopRequireDefault(require("./preview"));
|
|
17
19
|
|
|
18
20
|
var _navigationButton = _interopRequireDefault(require("./navigation-button"));
|
|
@@ -29,9 +31,13 @@ var _contextMenu = _interopRequireDefault(require("./context-menu"));
|
|
|
29
31
|
function ScreenRoot() {
|
|
30
32
|
return (0, _element.createElement)(_components.Card, {
|
|
31
33
|
size: "small"
|
|
32
|
-
}, (0, _element.createElement)(_components.CardBody, null, (0, _element.createElement)(_preview.default, null)), (0, _element.createElement)(_components.CardBody, null, (0, _element.createElement)(_contextMenu.default, null)), (0, _element.createElement)(_components.CardDivider, null), (0, _element.createElement)(_components.CardBody, null, (0, _element.createElement)(_components.__experimentalItemGroup, null, (0, _element.createElement)(_components.__experimentalItem, null, (0,
|
|
34
|
+
}, (0, _element.createElement)(_components.CardBody, null, (0, _element.createElement)(_preview.default, null)), (0, _element.createElement)(_components.CardBody, null, (0, _element.createElement)(_contextMenu.default, null)), (0, _element.createElement)(_components.CardDivider, null), (0, _element.createElement)(_components.CardBody, null, (0, _element.createElement)(_components.__experimentalItemGroup, null, (0, _element.createElement)(_components.__experimentalItem, null, (0, _i18n.__)('Customize the appearance of specific blocks for the whole site.')), (0, _element.createElement)(_navigationButton.default, {
|
|
33
35
|
path: "/blocks"
|
|
34
|
-
}, (0,
|
|
36
|
+
}, (0, _element.createElement)(_components.__experimentalHStack, {
|
|
37
|
+
justify: "space-between"
|
|
38
|
+
}, (0, _element.createElement)(_components.FlexItem, null, (0, _i18n.__)('Blocks')), (0, _element.createElement)(_components.FlexItem, null, (0, _element.createElement)(_icons.Icon, {
|
|
39
|
+
icon: (0, _i18n.isRTL)() ? _icons.chevronLeft : _icons.chevronRight
|
|
40
|
+
})))))));
|
|
35
41
|
}
|
|
36
42
|
|
|
37
43
|
var _default = ScreenRoot;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-root.js"],"names":["ScreenRoot"],"mappings":";;;;;;;;;;;AAGA;;
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-root.js"],"names":["ScreenRoot","chevronLeft","chevronRight"],"mappings":";;;;;;;;;;;AAGA;;AASA;;AACA;;AAKA;;AACA;;AACA;;AApBA;AACA;AACA;;AAaA;AACA;AACA;AAKA,SAASA,UAAT,GAAsB;AACrB,SACC,4BAAC,gBAAD;AAAM,IAAA,IAAI,EAAC;AAAX,KACC,4BAAC,oBAAD,QACC,4BAAC,gBAAD,OADD,CADD,EAKC,4BAAC,oBAAD,QACC,4BAAC,oBAAD,OADD,CALD,EASC,4BAAC,uBAAD,OATD,EAWC,4BAAC,oBAAD,QACC,4BAAC,mCAAD,QACC,4BAAC,8BAAD,QACG,cACD,iEADC,CADH,CADD,EAMC,4BAAC,yBAAD;AAAkB,IAAA,IAAI,EAAC;AAAvB,KACC,4BAAC,gCAAD;AAAQ,IAAA,OAAO,EAAC;AAAhB,KACC,4BAAC,oBAAD,QAAY,cAAI,QAAJ,CAAZ,CADD,EAEC,4BAAC,oBAAD,QACC,4BAAC,WAAD;AACC,IAAA,IAAI,EACH,qBAAUC,kBAAV,GAAwBC;AAF1B,IADD,CAFD,CADD,CAND,CADD,CAXD,CADD;AAmCA;;eAEcF,U","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalItem as Item,\n\t__experimentalHStack as HStack,\n\tFlexItem,\n\tCardBody,\n\tCard,\n\tCardDivider,\n} from '@wordpress/components';\nimport { isRTL, __ } from '@wordpress/i18n';\nimport { chevronLeft, chevronRight, Icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport StylesPreview from './preview';\nimport NavigationButton from './navigation-button';\nimport ContextMenu from './context-menu';\n\nfunction ScreenRoot() {\n\treturn (\n\t\t<Card size=\"small\">\n\t\t\t<CardBody>\n\t\t\t\t<StylesPreview />\n\t\t\t</CardBody>\n\n\t\t\t<CardBody>\n\t\t\t\t<ContextMenu />\n\t\t\t</CardBody>\n\n\t\t\t<CardDivider />\n\n\t\t\t<CardBody>\n\t\t\t\t<ItemGroup>\n\t\t\t\t\t<Item>\n\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t'Customize the appearance of specific blocks for the whole site.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t</Item>\n\t\t\t\t\t<NavigationButton path=\"/blocks\">\n\t\t\t\t\t\t<HStack justify=\"space-between\">\n\t\t\t\t\t\t\t<FlexItem>{ __( 'Blocks' ) }</FlexItem>\n\t\t\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t\t\t\tisRTL() ? chevronLeft : chevronRight\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</FlexItem>\n\t\t\t\t\t\t</HStack>\n\t\t\t\t\t</NavigationButton>\n\t\t\t\t</ItemGroup>\n\t\t\t</CardBody>\n\t\t</Card>\n\t);\n}\n\nexport default ScreenRoot;\n"]}
|
|
@@ -42,25 +42,21 @@ function ScreenTextColor(_ref) {
|
|
|
42
42
|
return null;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
const settings = [{
|
|
46
|
-
colorValue: color,
|
|
47
|
-
onColorChange: setColor,
|
|
48
|
-
label: (0, _i18n.__)('Text color'),
|
|
49
|
-
clearable: color === userColor
|
|
50
|
-
}];
|
|
51
45
|
return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_header.default, {
|
|
52
46
|
back: parentMenu + '/colors',
|
|
53
47
|
title: (0, _i18n.__)('Text'),
|
|
54
48
|
description: (0, _i18n.__)('Set the default color used for text across the site.')
|
|
55
|
-
}), (0, _element.createElement)(_blockEditor.
|
|
56
|
-
|
|
57
|
-
settings: settings,
|
|
49
|
+
}), (0, _element.createElement)(_blockEditor.__experimentalColorGradientControl, {
|
|
50
|
+
className: "edit-site-screen-text-color__control",
|
|
58
51
|
colors: colorsPerOrigin,
|
|
59
52
|
disableCustomColors: !areCustomSolidsEnabled,
|
|
60
53
|
__experimentalHasMultipleOrigins: true,
|
|
61
54
|
showTitle: false,
|
|
62
55
|
enableAlpha: true,
|
|
63
|
-
__experimentalIsRenderedInSidebar: true
|
|
56
|
+
__experimentalIsRenderedInSidebar: true,
|
|
57
|
+
colorValue: color,
|
|
58
|
+
onColorChange: setColor,
|
|
59
|
+
clearable: color === userColor
|
|
64
60
|
}));
|
|
65
61
|
}
|
|
66
62
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-text-color.js"],"names":["ScreenTextColor","name","parentMenu","undefined","supports","solids","areCustomSolidsEnabled","isTextEnabled","colorsPerOrigin","hasTextColor","includes","length","color","setColor","userColor"
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-text-color.js"],"names":["ScreenTextColor","name","parentMenu","undefined","supports","solids","areCustomSolidsEnabled","isTextEnabled","colorsPerOrigin","hasTextColor","includes","length","color","setColor","userColor"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AAKA;;AACA;;AAVA;AACA;AACA;;AAIA;AACA;AACA;AASA,SAASA,eAAT,OAAqC;AAAA,MAAX;AAAEC,IAAAA;AAAF,GAAW;AACpC,QAAMC,UAAU,GAAGD,IAAI,KAAKE,SAAT,GAAqB,EAArB,GAA0B,aAAaF,IAA1D;AACA,QAAMG,QAAQ,GAAG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Control as ColorGradientControl } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport ScreenHeader from './header';\nimport {\n\tgetSupportedGlobalStylesPanels,\n\tuseSetting,\n\tuseStyle,\n\tuseColorsPerOrigin,\n} from './hooks';\n\nfunction ScreenTextColor( { name } ) {\n\tconst parentMenu = name === undefined ? '' : '/blocks/' + name;\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\tconst [ solids ] = useSetting( 'color.palette', name );\n\tconst [ areCustomSolidsEnabled ] = useSetting( 'color.custom', name );\n\tconst [ isTextEnabled ] = useSetting( 'color.text', name );\n\n\tconst colorsPerOrigin = useColorsPerOrigin( name );\n\n\tconst hasTextColor =\n\t\tsupports.includes( 'color' ) &&\n\t\tisTextEnabled &&\n\t\t( solids.length > 0 || areCustomSolidsEnabled );\n\n\tconst [ color, setColor ] = useStyle( 'color.text', name );\n\tconst [ userColor ] = useStyle( 'color.text', name, 'user' );\n\n\tif ( ! hasTextColor ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<ScreenHeader\n\t\t\t\tback={ parentMenu + '/colors' }\n\t\t\t\ttitle={ __( 'Text' ) }\n\t\t\t\tdescription={ __(\n\t\t\t\t\t'Set the default color used for text across the site.'\n\t\t\t\t) }\n\t\t\t/>\n\t\t\t<ColorGradientControl\n\t\t\t\tclassName=\"edit-site-screen-text-color__control\"\n\t\t\t\tcolors={ colorsPerOrigin }\n\t\t\t\tdisableCustomColors={ ! areCustomSolidsEnabled }\n\t\t\t\t__experimentalHasMultipleOrigins\n\t\t\t\tshowTitle={ false }\n\t\t\t\tenableAlpha\n\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\tcolorValue={ color }\n\t\t\t\tonColorChange={ setColor }\n\t\t\t\tclearable={ color === userColor }\n\t\t\t/>\n\t\t</>\n\t);\n}\n\nexport default ScreenTextColor;\n"]}
|
|
@@ -9,6 +9,8 @@ exports.default = void 0;
|
|
|
9
9
|
|
|
10
10
|
var _element = require("@wordpress/element");
|
|
11
11
|
|
|
12
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
|
+
|
|
12
14
|
var _components = require("@wordpress/components");
|
|
13
15
|
|
|
14
16
|
var _blocks = require("@wordpress/blocks");
|
|
@@ -42,46 +44,56 @@ var _screenLayout = _interopRequireDefault(require("./screen-layout"));
|
|
|
42
44
|
/**
|
|
43
45
|
* Internal dependencies
|
|
44
46
|
*/
|
|
45
|
-
function
|
|
47
|
+
function GlobalStylesNavigationScreen(_ref) {
|
|
46
48
|
let {
|
|
47
|
-
|
|
49
|
+
className,
|
|
50
|
+
...props
|
|
48
51
|
} = _ref;
|
|
52
|
+
return (0, _element.createElement)(_components.__experimentalNavigatorScreen, (0, _extends2.default)({
|
|
53
|
+
className: ['edit-site-global-styles-sidebar__navigator-screen', className].filter(Boolean).join(' ')
|
|
54
|
+
}, props));
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function ContextScreens(_ref2) {
|
|
58
|
+
let {
|
|
59
|
+
name
|
|
60
|
+
} = _ref2;
|
|
49
61
|
const parentMenu = name === undefined ? '' : '/blocks/' + name;
|
|
50
|
-
return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(
|
|
62
|
+
return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(GlobalStylesNavigationScreen, {
|
|
51
63
|
path: parentMenu + '/typography'
|
|
52
64
|
}, (0, _element.createElement)(_screenTypography.default, {
|
|
53
65
|
name: name
|
|
54
|
-
})), (0, _element.createElement)(
|
|
66
|
+
})), (0, _element.createElement)(GlobalStylesNavigationScreen, {
|
|
55
67
|
path: parentMenu + '/typography/text'
|
|
56
68
|
}, (0, _element.createElement)(_screenTypographyElement.default, {
|
|
57
69
|
name: name,
|
|
58
70
|
element: "text"
|
|
59
|
-
})), (0, _element.createElement)(
|
|
71
|
+
})), (0, _element.createElement)(GlobalStylesNavigationScreen, {
|
|
60
72
|
path: parentMenu + '/typography/link'
|
|
61
73
|
}, (0, _element.createElement)(_screenTypographyElement.default, {
|
|
62
74
|
name: name,
|
|
63
75
|
element: "link"
|
|
64
|
-
})), (0, _element.createElement)(
|
|
76
|
+
})), (0, _element.createElement)(GlobalStylesNavigationScreen, {
|
|
65
77
|
path: parentMenu + '/colors'
|
|
66
78
|
}, (0, _element.createElement)(_screenColors.default, {
|
|
67
79
|
name: name
|
|
68
|
-
})), (0, _element.createElement)(
|
|
80
|
+
})), (0, _element.createElement)(GlobalStylesNavigationScreen, {
|
|
69
81
|
path: parentMenu + '/colors/palette'
|
|
70
82
|
}, (0, _element.createElement)(_screenColorPalette.default, {
|
|
71
83
|
name: name
|
|
72
|
-
})), (0, _element.createElement)(
|
|
84
|
+
})), (0, _element.createElement)(GlobalStylesNavigationScreen, {
|
|
73
85
|
path: parentMenu + '/colors/background'
|
|
74
86
|
}, (0, _element.createElement)(_screenBackgroundColor.default, {
|
|
75
87
|
name: name
|
|
76
|
-
})), (0, _element.createElement)(
|
|
88
|
+
})), (0, _element.createElement)(GlobalStylesNavigationScreen, {
|
|
77
89
|
path: parentMenu + '/colors/text'
|
|
78
90
|
}, (0, _element.createElement)(_screenTextColor.default, {
|
|
79
91
|
name: name
|
|
80
|
-
})), (0, _element.createElement)(
|
|
92
|
+
})), (0, _element.createElement)(GlobalStylesNavigationScreen, {
|
|
81
93
|
path: parentMenu + '/colors/link'
|
|
82
94
|
}, (0, _element.createElement)(_screenLinkColor.default, {
|
|
83
95
|
name: name
|
|
84
|
-
})), (0, _element.createElement)(
|
|
96
|
+
})), (0, _element.createElement)(GlobalStylesNavigationScreen, {
|
|
85
97
|
path: parentMenu + '/layout'
|
|
86
98
|
}, (0, _element.createElement)(_screenLayout.default, {
|
|
87
99
|
name: name
|
|
@@ -91,12 +103,13 @@ function ContextScreens(_ref) {
|
|
|
91
103
|
function GlobalStylesUI() {
|
|
92
104
|
const blocks = (0, _blocks.getBlockTypes)();
|
|
93
105
|
return (0, _element.createElement)(_components.__experimentalNavigatorProvider, {
|
|
106
|
+
className: "edit-site-global-styles-sidebar__navigator-provider",
|
|
94
107
|
initialPath: "/"
|
|
95
|
-
}, (0, _element.createElement)(
|
|
108
|
+
}, (0, _element.createElement)(GlobalStylesNavigationScreen, {
|
|
96
109
|
path: "/"
|
|
97
|
-
}, (0, _element.createElement)(_screenRoot.default, null)), (0, _element.createElement)(
|
|
110
|
+
}, (0, _element.createElement)(_screenRoot.default, null)), (0, _element.createElement)(GlobalStylesNavigationScreen, {
|
|
98
111
|
path: "/blocks"
|
|
99
|
-
}, (0, _element.createElement)(_screenBlockList.default, null)), blocks.map(block => (0, _element.createElement)(
|
|
112
|
+
}, (0, _element.createElement)(_screenBlockList.default, null)), blocks.map(block => (0, _element.createElement)(GlobalStylesNavigationScreen, {
|
|
100
113
|
key: 'menu-block-' + block.name,
|
|
101
114
|
path: '/blocks/' + block.name
|
|
102
115
|
}, (0, _element.createElement)(_screenBlock.default, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/ui.js"],"names":["ContextScreens","name","parentMenu","undefined","GlobalStylesUI","blocks","map","block"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/ui.js"],"names":["GlobalStylesNavigationScreen","className","props","filter","Boolean","join","ContextScreens","name","parentMenu","undefined","GlobalStylesUI","blocks","map","block"],"mappings":";;;;;;;;;;;;;AAGA;;AAIA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAtBA;AACA;AACA;;AAOA;AACA;AACA;AAaA,SAASA,4BAAT,OAAiE;AAAA,MAA1B;AAAEC,IAAAA,SAAF;AAAa,OAAGC;AAAhB,GAA0B;AAChE,SACC,4BAAC,yCAAD;AACC,IAAA,SAAS,EAAG,CACX,mDADW,EAEXD,SAFW,EAIVE,MAJU,CAIFC,OAJE,EAKVC,IALU,CAKJ,GALI;AADb,KAOMH,KAPN,EADD;AAWA;;A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EAAGD;AAAxB,IADD,CArCD,EAyCC,4BAAC,4BAAD;AAA8B,IAAA,IAAI,EAAGC,UAAU,GAAG;AAAlD,KACC,4BAAC,qBAAD;AAAc,IAAA,IAAI,EAAGD;AAArB,IADD,CAzCD,CADD;AA+CA;;AAED,SAASG,cAAT,GAA0B;AACzB,QAAMC,MAAM,GAAG,4BAAf;AAEA,SACC,4BAAC,2CAAD;AACC,IAAA,SAAS,EAAC,qDADX;AAEC,IAAA,WAAW,EAAC;AAFb,KAIC,4BAAC,4BAAD;AAA8B,IAAA,IAAI,EAAC;AAAnC,KACC,4BAAC,mBAAD,OADD,CAJD,EAQC,4BAAC,4BAAD;AAA8B,IAAA,IAAI,EAAC;AAAnC,KACC,4BAAC,wBAAD,OADD,CARD,EAYGA,MAAM,CAACC,GAAP,CAAcC,KAAF,IACb,4BAAC,4BAAD;AACC,IAAA,GAAG,EAAG,gBAAgBA,KAAK,CAACN,IAD7B;AAEC,IAAA,IAAI,EAAG,aAAaM,KAAK,CAACN;AAF3B,KAIC,4BAAC,oBAAD;AAAa,IAAA,IAAI,EAAGM,KAAK,CAACN;AAA1B,IAJD,CADC,CAZH,EAqBC,4BAAC,cAAD,OArBD,EAuBGI,MAAM,CAACC,GAAP,CAAcC,KAAF,IACb,4BAAC,cAAD;AACC,IAAA,GAAG,EAAG,mBAAmBA,KAAK,CAACN,IADhC;AAEC,IAAA,IAAI,EAAGM,KAAK,CAACN;AAFd,IADC,CAvBH,CADD;AAgCA;;eAEcG,c","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalNavigatorProvider as NavigatorProvider,\n\t__experimentalNavigatorScreen as NavigatorScreen,\n} from '@wordpress/components';\nimport { getBlockTypes } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport ScreenRoot from './screen-root';\nimport ScreenBlockList from './screen-block-list';\nimport ScreenBlock from './screen-block';\nimport ScreenTypography from './screen-typography';\nimport ScreenTypographyElement from './screen-typography-element';\nimport ScreenColors from './screen-colors';\nimport ScreenColorPalette from './screen-color-palette';\nimport ScreenBackgroundColor from './screen-background-color';\nimport ScreenTextColor from './screen-text-color';\nimport ScreenLinkColor from './screen-link-color';\nimport ScreenLayout from './screen-layout';\n\nfunction GlobalStylesNavigationScreen( { className, ...props } ) {\n\treturn (\n\t\t<NavigatorScreen\n\t\t\tclassName={ [\n\t\t\t\t'edit-site-global-styles-sidebar__navigator-screen',\n\t\t\t\tclassName,\n\t\t\t]\n\t\t\t\t.filter( Boolean )\n\t\t\t\t.join( ' ' ) }\n\t\t\t{ ...props }\n\t\t/>\n\t);\n}\n\nfunction ContextScreens( { name } ) {\n\tconst parentMenu = name === undefined ? '' : '/blocks/' + name;\n\n\treturn (\n\t\t<>\n\t\t\t<GlobalStylesNavigationScreen path={ parentMenu + '/typography' }>\n\t\t\t\t<ScreenTypography name={ name } />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen\n\t\t\t\tpath={ parentMenu + '/typography/text' }\n\t\t\t>\n\t\t\t\t<ScreenTypographyElement name={ name } element=\"text\" />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen\n\t\t\t\tpath={ parentMenu + '/typography/link' }\n\t\t\t>\n\t\t\t\t<ScreenTypographyElement name={ name } element=\"link\" />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen path={ parentMenu + '/colors' }>\n\t\t\t\t<ScreenColors name={ name } />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen\n\t\t\t\tpath={ parentMenu + '/colors/palette' }\n\t\t\t>\n\t\t\t\t<ScreenColorPalette name={ name } />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen\n\t\t\t\tpath={ parentMenu + '/colors/background' }\n\t\t\t>\n\t\t\t\t<ScreenBackgroundColor name={ name } />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen path={ parentMenu + '/colors/text' }>\n\t\t\t\t<ScreenTextColor name={ name } />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen path={ parentMenu + '/colors/link' }>\n\t\t\t\t<ScreenLinkColor name={ name } />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen path={ parentMenu + '/layout' }>\n\t\t\t\t<ScreenLayout name={ name } />\n\t\t\t</GlobalStylesNavigationScreen>\n\t\t</>\n\t);\n}\n\nfunction GlobalStylesUI() {\n\tconst blocks = getBlockTypes();\n\n\treturn (\n\t\t<NavigatorProvider\n\t\t\tclassName=\"edit-site-global-styles-sidebar__navigator-provider\"\n\t\t\tinitialPath=\"/\"\n\t\t>\n\t\t\t<GlobalStylesNavigationScreen path=\"/\">\n\t\t\t\t<ScreenRoot />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen path=\"/blocks\">\n\t\t\t\t<ScreenBlockList />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t{ blocks.map( ( block ) => (\n\t\t\t\t<GlobalStylesNavigationScreen\n\t\t\t\t\tkey={ 'menu-block-' + block.name }\n\t\t\t\t\tpath={ '/blocks/' + block.name }\n\t\t\t\t>\n\t\t\t\t\t<ScreenBlock name={ block.name } />\n\t\t\t\t</GlobalStylesNavigationScreen>\n\t\t\t) ) }\n\n\t\t\t<ContextScreens />\n\n\t\t\t{ blocks.map( ( block ) => (\n\t\t\t\t<ContextScreens\n\t\t\t\t\tkey={ 'screens-block-' + block.name }\n\t\t\t\t\tname={ block.name }\n\t\t\t\t/>\n\t\t\t) ) }\n\t\t</NavigatorProvider>\n\t);\n}\n\nexport default GlobalStylesUI;\n"]}
|
|
@@ -389,8 +389,7 @@ function useGlobalStylesOutput() {
|
|
|
389
389
|
const globalStyles = toStyles(mergedConfig, blockSelectors);
|
|
390
390
|
setStylesheets([{
|
|
391
391
|
css: customProperties,
|
|
392
|
-
isGlobalStyles: true
|
|
393
|
-
__experimentalNoWrapper: true
|
|
392
|
+
isGlobalStyles: true
|
|
394
393
|
}, {
|
|
395
394
|
css: globalStyles,
|
|
396
395
|
isGlobalStyles: true
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/use-global-styles-output.js"],"names":["compileStyleValue","uncompiledValue","VARIABLE_REFERENCE_PREFIX","VARIABLE_PATH_SEPARATOR_TOKEN_ATTRIBUTE","VARIABLE_PATH_SEPARATOR_TOKEN_STYLE","variable","slice","length","split","join","getPresetsDeclarations","blockPresets","PRESET_METADATA","declarations","path","valueKey","cssVarInfix","presetByOrigin","forEach","origin","value","push","slug","getPresetsClasses","blockSelector","classes","classSuffix","propertyName","classSelectorToUse","selectorToUse","map","selector","flattenTree","input","prefix","token","result","Object","keys","key","newKey","replace","newLeaf","newPrefix","getStylesDeclarations","blockStyles","STYLE_PROPERTY","properties","pathToValue","styleValue","entries","entry","name","prop","cssProperty","startsWith","getNodesWithStyles","tree","blockSelectors","nodes","styles","pickStyleKeys","treeToPickFrom","includes","ROOT_BLOCK_SELECTOR","elements","ELEMENTS","blocks","node","blockName","elementName","sel","getNodesWithSettings","settings","pickPresets","presets","custom","blockCustom","toCustomProperties","ruleset","customProps","toStyles","nodesWithStyles","nodesWithSettings","getBlockSelectors","blockTypes","blockType","supports","__experimentalSelector","useGlobalStylesOutput","stylesheets","setStylesheets","setSettings","merged","mergedConfig","GlobalStylesContext","customProperties","globalStyles","css","isGlobalStyles","__experimentalNoWrapper"],"mappings":";;;;;;;;AAGA;;AAgBA;;AAKA;;AASA;;AACA;;AAlCA;AACA;AACA;;AAcA;AACA;AACA;;AAQA;AACA;AACA;;AAEA;AACA;AACA;AAIA,SAASA,iBAAT,CAA4BC,eAA5B,EAA8C;AAC7C,QAAMC,yBAAyB,GAAG,MAAlC;AACA,QAAMC,uCAAuC,GAAG,GAAhD;AACA,QAAMC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J,WAAF,EAAejB,QAAf,CAAP;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport {\n\tfirst,\n\tforEach,\n\tget,\n\tisEmpty,\n\tisString,\n\tkebabCase,\n\tpickBy,\n\treduce,\n\tset,\n\tstartsWith,\n} from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport {\n\t__EXPERIMENTAL_STYLE_PROPERTY as STYLE_PROPERTY,\n\t__EXPERIMENTAL_ELEMENTS as ELEMENTS,\n\tgetBlockTypes,\n} from '@wordpress/blocks';\nimport { useEffect, useState, useContext } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\n\n/**\n * Internal dependencies\n */\nimport { PRESET_METADATA, ROOT_BLOCK_SELECTOR } from './utils';\nimport { GlobalStylesContext } from './context';\n\nfunction compileStyleValue( uncompiledValue ) {\n\tconst VARIABLE_REFERENCE_PREFIX = 'var:';\n\tconst VARIABLE_PATH_SEPARATOR_TOKEN_ATTRIBUTE = '|';\n\tconst VARIABLE_PATH_SEPARATOR_TOKEN_STYLE = '--';\n\tif ( startsWith( uncompiledValue, VARIABLE_REFERENCE_PREFIX ) ) {\n\t\tconst variable = uncompiledValue\n\t\t\t.slice( VARIABLE_REFERENCE_PREFIX.length )\n\t\t\t.split( VARIABLE_PATH_SEPARATOR_TOKEN_ATTRIBUTE )\n\t\t\t.join( VARIABLE_PATH_SEPARATOR_TOKEN_STYLE );\n\t\treturn `var(--wp--${ variable })`;\n\t}\n\treturn uncompiledValue;\n}\n\n/**\n * Transform given preset tree into a set of style declarations.\n *\n * @param {Object} blockPresets\n *\n * @return {Array} An array of style declarations.\n */\nfunction getPresetsDeclarations( blockPresets = {} ) {\n\treturn reduce(\n\t\tPRESET_METADATA,\n\t\t( declarations, { path, valueKey, cssVarInfix } ) => {\n\t\t\tconst presetByOrigin = get( blockPresets, path, [] );\n\t\t\t[ 'default', 'theme', 'custom' ].forEach( ( origin ) => {\n\t\t\t\tif ( presetByOrigin[ origin ] ) {\n\t\t\t\t\tpresetByOrigin[ origin ].forEach( ( value ) => {\n\t\t\t\t\t\tdeclarations.push(\n\t\t\t\t\t\t\t`--wp--preset--${ cssVarInfix }--${ kebabCase(\n\t\t\t\t\t\t\t\tvalue.slug\n\t\t\t\t\t\t\t) }: ${ value[ valueKey ] }`\n\t\t\t\t\t\t);\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t} );\n\n\t\t\treturn declarations;\n\t\t},\n\t\t[]\n\t);\n}\n\n/**\n * Transform given preset tree into a set of preset class declarations.\n *\n * @param {string} blockSelector\n * @param {Object} blockPresets\n * @return {string} CSS declarations for the preset classes.\n */\nfunction getPresetsClasses( blockSelector, blockPresets = {} ) {\n\treturn reduce(\n\t\tPRESET_METADATA,\n\t\t( declarations, { path, cssVarInfix, classes } ) => {\n\t\t\tif ( ! classes ) {\n\t\t\t\treturn declarations;\n\t\t\t}\n\n\t\t\tconst presetByOrigin = get( blockPresets, path, [] );\n\t\t\t[ 'default', 'theme', 'custom' ].forEach( ( origin ) => {\n\t\t\t\tif ( presetByOrigin[ origin ] ) {\n\t\t\t\t\tpresetByOrigin[ origin ].forEach( ( { slug } ) => {\n\t\t\t\t\t\tclasses.forEach( ( { classSuffix, propertyName } ) => {\n\t\t\t\t\t\t\tconst classSelectorToUse = `.has-${ kebabCase(\n\t\t\t\t\t\t\t\tslug\n\t\t\t\t\t\t\t) }-${ classSuffix }`;\n\t\t\t\t\t\t\tconst selectorToUse = blockSelector\n\t\t\t\t\t\t\t\t.split( ',' ) // Selector can be \"h1, h2, h3\"\n\t\t\t\t\t\t\t\t.map(\n\t\t\t\t\t\t\t\t\t( selector ) =>\n\t\t\t\t\t\t\t\t\t\t`${ selector }${ classSelectorToUse }`\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t.join( ',' );\n\t\t\t\t\t\t\tconst value = `var(--wp--preset--${ cssVarInfix }--${ kebabCase(\n\t\t\t\t\t\t\t\tslug\n\t\t\t\t\t\t\t) })`;\n\t\t\t\t\t\t\tdeclarations += `${ selectorToUse }{${ propertyName }: ${ value } !important;}`;\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\treturn declarations;\n\t\t},\n\t\t''\n\t);\n}\n\nfunction flattenTree( input = {}, prefix, token ) {\n\tlet result = [];\n\tObject.keys( input ).forEach( ( key ) => {\n\t\tconst newKey = prefix + kebabCase( key.replace( '/', '-' ) );\n\t\tconst newLeaf = input[ key ];\n\n\t\tif ( newLeaf instanceof Object ) {\n\t\t\tconst newPrefix = newKey + token;\n\t\t\tresult = [ ...result, ...flattenTree( newLeaf, newPrefix, token ) ];\n\t\t} else {\n\t\t\tresult.push( `${ newKey }: ${ newLeaf }` );\n\t\t}\n\t} );\n\treturn result;\n}\n\n/**\n * Transform given style tree into a set of style declarations.\n *\n * @param {Object} blockStyles Block styles.\n *\n * @return {Array} An array of style declarations.\n */\nfunction getStylesDeclarations( blockStyles = {} ) {\n\treturn reduce(\n\t\tSTYLE_PROPERTY,\n\t\t( declarations, { value, properties }, key ) => {\n\t\t\tconst pathToValue = value;\n\t\t\tif ( first( pathToValue ) === 'elements' ) {\n\t\t\t\treturn declarations;\n\t\t\t}\n\n\t\t\tconst styleValue = get( blockStyles, pathToValue );\n\n\t\t\tif ( !! properties && ! isString( styleValue ) ) {\n\t\t\t\tObject.entries( properties ).forEach( ( entry ) => {\n\t\t\t\t\tconst [ name, prop ] = entry;\n\n\t\t\t\t\tif ( ! get( styleValue, [ prop ], false ) ) {\n\t\t\t\t\t\t// Do not create a declaration\n\t\t\t\t\t\t// for sub-properties that don't have any value.\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst cssProperty = kebabCase( name );\n\t\t\t\t\tdeclarations.push(\n\t\t\t\t\t\t`${ cssProperty }: ${ compileStyleValue(\n\t\t\t\t\t\t\tget( styleValue, [ prop ] )\n\t\t\t\t\t\t) }`\n\t\t\t\t\t);\n\t\t\t\t} );\n\t\t\t} else if ( get( blockStyles, pathToValue, false ) ) {\n\t\t\t\tconst cssProperty = key.startsWith( '--' )\n\t\t\t\t\t? key\n\t\t\t\t\t: kebabCase( key );\n\t\t\t\tdeclarations.push(\n\t\t\t\t\t`${ cssProperty }: ${ compileStyleValue(\n\t\t\t\t\t\tget( blockStyles, pathToValue )\n\t\t\t\t\t) }`\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn declarations;\n\t\t},\n\t\t[]\n\t);\n}\n\nexport const getNodesWithStyles = ( tree, blockSelectors ) => {\n\tconst nodes = [];\n\n\tif ( ! tree?.styles ) {\n\t\treturn nodes;\n\t}\n\n\tconst pickStyleKeys = ( treeToPickFrom ) =>\n\t\tpickBy( treeToPickFrom, ( value, key ) =>\n\t\t\t[ 'border', 'color', 'spacing', 'typography' ].includes( key )\n\t\t);\n\n\t// Top-level.\n\tconst styles = pickStyleKeys( tree.styles );\n\tif ( !! styles ) {\n\t\tnodes.push( {\n\t\t\tstyles,\n\t\t\tselector: ROOT_BLOCK_SELECTOR,\n\t\t} );\n\t}\n\tforEach( tree.styles?.elements, ( value, key ) => {\n\t\tif ( !! value && !! ELEMENTS[ key ] ) {\n\t\t\tnodes.push( {\n\t\t\t\tstyles: value,\n\t\t\t\tselector: ELEMENTS[ key ],\n\t\t\t} );\n\t\t}\n\t} );\n\n\t// Iterate over blocks: they can have styles & elements.\n\tforEach( tree.styles?.blocks, ( node, blockName ) => {\n\t\tconst blockStyles = pickStyleKeys( node );\n\t\tif ( !! blockStyles && !! blockSelectors?.[ blockName ]?.selector ) {\n\t\t\tnodes.push( {\n\t\t\t\tstyles: blockStyles,\n\t\t\t\tselector: blockSelectors[ blockName ].selector,\n\t\t\t} );\n\t\t}\n\n\t\tforEach( node?.elements, ( value, elementName ) => {\n\t\t\tif (\n\t\t\t\t!! value &&\n\t\t\t\t!! blockSelectors?.[ blockName ] &&\n\t\t\t\t!! ELEMENTS?.[ elementName ]\n\t\t\t) {\n\t\t\t\tnodes.push( {\n\t\t\t\t\tstyles: value,\n\t\t\t\t\tselector: blockSelectors[ blockName ].selector\n\t\t\t\t\t\t.split( ',' )\n\t\t\t\t\t\t.map( ( sel ) => sel + ' ' + ELEMENTS[ elementName ] )\n\t\t\t\t\t\t.join( ',' ),\n\t\t\t\t} );\n\t\t\t}\n\t\t} );\n\t} );\n\n\treturn nodes;\n};\n\nexport const getNodesWithSettings = ( tree, blockSelectors ) => {\n\tconst nodes = [];\n\n\tif ( ! tree?.settings ) {\n\t\treturn nodes;\n\t}\n\n\tconst pickPresets = ( treeToPickFrom ) => {\n\t\tconst presets = {};\n\t\tPRESET_METADATA.forEach( ( { path } ) => {\n\t\t\tconst value = get( treeToPickFrom, path, false );\n\t\t\tif ( value !== false ) {\n\t\t\t\tset( presets, path, value );\n\t\t\t}\n\t\t} );\n\t\treturn presets;\n\t};\n\n\t// Top-level.\n\tconst presets = pickPresets( tree.settings );\n\tconst custom = tree.settings?.custom;\n\tif ( ! isEmpty( presets ) || !! custom ) {\n\t\tnodes.push( {\n\t\t\tpresets,\n\t\t\tcustom,\n\t\t\tselector: ROOT_BLOCK_SELECTOR,\n\t\t} );\n\t}\n\n\t// Blocks.\n\tforEach( tree.settings?.blocks, ( node, blockName ) => {\n\t\tconst blockPresets = pickPresets( node );\n\t\tconst blockCustom = node.custom;\n\t\tif ( ! isEmpty( blockPresets ) || !! blockCustom ) {\n\t\t\tnodes.push( {\n\t\t\t\tpresets: blockPresets,\n\t\t\t\tcustom: blockCustom,\n\t\t\t\tselector: blockSelectors[ blockName ].selector,\n\t\t\t} );\n\t\t}\n\t} );\n\n\treturn nodes;\n};\n\nexport const toCustomProperties = ( tree, blockSelectors ) => {\n\tconst settings = getNodesWithSettings( tree, blockSelectors );\n\n\tlet ruleset = '';\n\tsettings.forEach( ( { presets, custom, selector } ) => {\n\t\tconst declarations = getPresetsDeclarations( presets );\n\t\tconst customProps = flattenTree( custom, '--wp--custom--', '--' );\n\t\tif ( customProps.length > 0 ) {\n\t\t\tdeclarations.push( ...customProps );\n\t\t}\n\n\t\tif ( declarations.length > 0 ) {\n\t\t\truleset = ruleset + `${ selector }{${ declarations.join( ';' ) };}`;\n\t\t}\n\t} );\n\n\treturn ruleset;\n};\n\nexport const toStyles = ( tree, blockSelectors ) => {\n\tconst nodesWithStyles = getNodesWithStyles( tree, blockSelectors );\n\tconst nodesWithSettings = getNodesWithSettings( tree, blockSelectors );\n\n\tlet ruleset =\n\t\t'.wp-site-blocks > * { margin-top: 0; margin-bottom: 0; }.wp-site-blocks > * + * { margin-top: var( --wp--style--block-gap ); }';\n\tnodesWithStyles.forEach( ( { selector, styles } ) => {\n\t\tconst declarations = getStylesDeclarations( styles );\n\t\tif ( declarations.length === 0 ) {\n\t\t\treturn;\n\t\t}\n\t\truleset = ruleset + `${ selector }{${ declarations.join( ';' ) };}`;\n\t} );\n\n\tnodesWithSettings.forEach( ( { selector, presets } ) => {\n\t\tif ( ROOT_BLOCK_SELECTOR === selector ) {\n\t\t\t// Do not add extra specificity for top-level classes.\n\t\t\tselector = '';\n\t\t}\n\n\t\tconst classes = getPresetsClasses( selector, presets );\n\t\tif ( ! isEmpty( classes ) ) {\n\t\t\truleset = ruleset + classes;\n\t\t}\n\t} );\n\n\treturn ruleset;\n};\n\nconst getBlockSelectors = ( blockTypes ) => {\n\tconst result = {};\n\tblockTypes.forEach( ( blockType ) => {\n\t\tconst name = blockType.name;\n\t\tconst selector =\n\t\t\tblockType?.supports?.__experimentalSelector ??\n\t\t\t'.wp-block-' + name.replace( 'core/', '' ).replace( '/', '-' );\n\t\tresult[ name ] = {\n\t\t\tname,\n\t\t\tselector,\n\t\t};\n\t} );\n\n\treturn result;\n};\n\nexport function useGlobalStylesOutput() {\n\tconst [ stylesheets, setStylesheets ] = useState( [] );\n\tconst [ settings, setSettings ] = useState( {} );\n\tconst { merged: mergedConfig } = useContext( GlobalStylesContext );\n\n\tuseEffect( () => {\n\t\tif ( ! mergedConfig?.styles || ! mergedConfig?.settings ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst blockSelectors = getBlockSelectors( getBlockTypes() );\n\t\tconst customProperties = toCustomProperties(\n\t\t\tmergedConfig,\n\t\t\tblockSelectors\n\t\t);\n\t\tconst globalStyles = toStyles( mergedConfig, blockSelectors );\n\t\tsetStylesheets( [\n\t\t\t{\n\t\t\t\tcss: customProperties,\n\t\t\t\tisGlobalStyles: true,\n\t\t\t\t__experimentalNoWrapper: true,\n\t\t\t},\n\t\t\t{\n\t\t\t\tcss: globalStyles,\n\t\t\t\tisGlobalStyles: true,\n\t\t\t},\n\t\t] );\n\t\tsetSettings( mergedConfig.settings );\n\t}, [ mergedConfig ] );\n\n\treturn [ stylesheets, settings ];\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/use-global-styles-output.js"],"names":["compileStyleValue","uncompiledValue","VARIABLE_REFERENCE_PREFIX","VARIABLE_PATH_SEPARATOR_TOKEN_ATTRIBUTE","VARIABLE_PATH_SEPARATOR_TOKEN_STYLE","variable","slice","length","split","join","getPresetsDeclarations","blockPresets","PRESET_METADATA","declarations","path","valueKey","cssVarInfix","presetByOrigin","forEach","origin","value","push","slug","getPresetsClasses","blockSelector","classes","classSuffix","propertyName","classSelectorToUse","selectorToUse","map","selector","flattenTree","input","prefix","token","result","Object","keys","key","newKey","replace","newLeaf","newPrefix","getStylesDeclarations","blockStyles","STYLE_PROPERTY","properties","pathToValue","styleValue","entries","entry","name","prop","cssProperty","startsWith","getNodesWithStyles","tree","blockSelectors","nodes","styles","pickStyleKeys","treeToPickFrom","includes","ROOT_BLOCK_SELECTOR","elements","ELEMENTS","blocks","node","blockName","elementName","sel","getNodesWithSettings","settings","pickPresets","presets","custom","blockCustom","toCustomProperties","ruleset","customProps","toStyles","nodesWithStyles","nodesWithSettings","getBlockSelectors","blockTypes","blockType","supports","__experimentalSelector","useGlobalStylesOutput","stylesheets","setStylesheets","setSettings","merged","mergedConfig","GlobalStylesContext","customProperties","globalStyles","css","isGlobalStyles"],"mappings":";;;;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f;AACCD,MAAAA,GAAG,EAAED,YADN;AAECE,MAAAA,cAAc,EAAE;AAFjB,KALe,CAAF,CAAd;AAUAP,IAAAA,WAAW,CAAEE,YAAY,CAACrB,QAAf,CAAX;AACA,GAtBD,EAsBG,CAAEqB,YAAF,CAtBH;AAwBA,SAAO,CAAEJ,WAAF,EAAejB,QAAf,CAAP;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport {\n\tfirst,\n\tforEach,\n\tget,\n\tisEmpty,\n\tisString,\n\tkebabCase,\n\tpickBy,\n\treduce,\n\tset,\n\tstartsWith,\n} from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport {\n\t__EXPERIMENTAL_STYLE_PROPERTY as STYLE_PROPERTY,\n\t__EXPERIMENTAL_ELEMENTS as ELEMENTS,\n\tgetBlockTypes,\n} from '@wordpress/blocks';\nimport { useEffect, useState, useContext } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\n\n/**\n * Internal dependencies\n */\nimport { PRESET_METADATA, ROOT_BLOCK_SELECTOR } from './utils';\nimport { GlobalStylesContext } from './context';\n\nfunction compileStyleValue( uncompiledValue ) {\n\tconst VARIABLE_REFERENCE_PREFIX = 'var:';\n\tconst VARIABLE_PATH_SEPARATOR_TOKEN_ATTRIBUTE = '|';\n\tconst VARIABLE_PATH_SEPARATOR_TOKEN_STYLE = '--';\n\tif ( startsWith( uncompiledValue, VARIABLE_REFERENCE_PREFIX ) ) {\n\t\tconst variable = uncompiledValue\n\t\t\t.slice( VARIABLE_REFERENCE_PREFIX.length )\n\t\t\t.split( VARIABLE_PATH_SEPARATOR_TOKEN_ATTRIBUTE )\n\t\t\t.join( VARIABLE_PATH_SEPARATOR_TOKEN_STYLE );\n\t\treturn `var(--wp--${ variable })`;\n\t}\n\treturn uncompiledValue;\n}\n\n/**\n * Transform given preset tree into a set of style declarations.\n *\n * @param {Object} blockPresets\n *\n * @return {Array} An array of style declarations.\n */\nfunction getPresetsDeclarations( blockPresets = {} ) {\n\treturn reduce(\n\t\tPRESET_METADATA,\n\t\t( declarations, { path, valueKey, cssVarInfix } ) => {\n\t\t\tconst presetByOrigin = get( blockPresets, path, [] );\n\t\t\t[ 'default', 'theme', 'custom' ].forEach( ( origin ) => {\n\t\t\t\tif ( presetByOrigin[ origin ] ) {\n\t\t\t\t\tpresetByOrigin[ origin ].forEach( ( value ) => {\n\t\t\t\t\t\tdeclarations.push(\n\t\t\t\t\t\t\t`--wp--preset--${ cssVarInfix }--${ kebabCase(\n\t\t\t\t\t\t\t\tvalue.slug\n\t\t\t\t\t\t\t) }: ${ value[ valueKey ] }`\n\t\t\t\t\t\t);\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t} );\n\n\t\t\treturn declarations;\n\t\t},\n\t\t[]\n\t);\n}\n\n/**\n * Transform given preset tree into a set of preset class declarations.\n *\n * @param {string} blockSelector\n * @param {Object} blockPresets\n * @return {string} CSS declarations for the preset classes.\n */\nfunction getPresetsClasses( blockSelector, blockPresets = {} ) {\n\treturn reduce(\n\t\tPRESET_METADATA,\n\t\t( declarations, { path, cssVarInfix, classes } ) => {\n\t\t\tif ( ! classes ) {\n\t\t\t\treturn declarations;\n\t\t\t}\n\n\t\t\tconst presetByOrigin = get( blockPresets, path, [] );\n\t\t\t[ 'default', 'theme', 'custom' ].forEach( ( origin ) => {\n\t\t\t\tif ( presetByOrigin[ origin ] ) {\n\t\t\t\t\tpresetByOrigin[ origin ].forEach( ( { slug } ) => {\n\t\t\t\t\t\tclasses.forEach( ( { classSuffix, propertyName } ) => {\n\t\t\t\t\t\t\tconst classSelectorToUse = `.has-${ kebabCase(\n\t\t\t\t\t\t\t\tslug\n\t\t\t\t\t\t\t) }-${ classSuffix }`;\n\t\t\t\t\t\t\tconst selectorToUse = blockSelector\n\t\t\t\t\t\t\t\t.split( ',' ) // Selector can be \"h1, h2, h3\"\n\t\t\t\t\t\t\t\t.map(\n\t\t\t\t\t\t\t\t\t( selector ) =>\n\t\t\t\t\t\t\t\t\t\t`${ selector }${ classSelectorToUse }`\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t.join( ',' );\n\t\t\t\t\t\t\tconst value = `var(--wp--preset--${ cssVarInfix }--${ kebabCase(\n\t\t\t\t\t\t\t\tslug\n\t\t\t\t\t\t\t) })`;\n\t\t\t\t\t\t\tdeclarations += `${ selectorToUse }{${ propertyName }: ${ value } !important;}`;\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\treturn declarations;\n\t\t},\n\t\t''\n\t);\n}\n\nfunction flattenTree( input = {}, prefix, token ) {\n\tlet result = [];\n\tObject.keys( input ).forEach( ( key ) => {\n\t\tconst newKey = prefix + kebabCase( key.replace( '/', '-' ) );\n\t\tconst newLeaf = input[ key ];\n\n\t\tif ( newLeaf instanceof Object ) {\n\t\t\tconst newPrefix = newKey + token;\n\t\t\tresult = [ ...result, ...flattenTree( newLeaf, newPrefix, token ) ];\n\t\t} else {\n\t\t\tresult.push( `${ newKey }: ${ newLeaf }` );\n\t\t}\n\t} );\n\treturn result;\n}\n\n/**\n * Transform given style tree into a set of style declarations.\n *\n * @param {Object} blockStyles Block styles.\n *\n * @return {Array} An array of style declarations.\n */\nfunction getStylesDeclarations( blockStyles = {} ) {\n\treturn reduce(\n\t\tSTYLE_PROPERTY,\n\t\t( declarations, { value, properties }, key ) => {\n\t\t\tconst pathToValue = value;\n\t\t\tif ( first( pathToValue ) === 'elements' ) {\n\t\t\t\treturn declarations;\n\t\t\t}\n\n\t\t\tconst styleValue = get( blockStyles, pathToValue );\n\n\t\t\tif ( !! properties && ! isString( styleValue ) ) {\n\t\t\t\tObject.entries( properties ).forEach( ( entry ) => {\n\t\t\t\t\tconst [ name, prop ] = entry;\n\n\t\t\t\t\tif ( ! get( styleValue, [ prop ], false ) ) {\n\t\t\t\t\t\t// Do not create a declaration\n\t\t\t\t\t\t// for sub-properties that don't have any value.\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst cssProperty = kebabCase( name );\n\t\t\t\t\tdeclarations.push(\n\t\t\t\t\t\t`${ cssProperty }: ${ compileStyleValue(\n\t\t\t\t\t\t\tget( styleValue, [ prop ] )\n\t\t\t\t\t\t) }`\n\t\t\t\t\t);\n\t\t\t\t} );\n\t\t\t} else if ( get( blockStyles, pathToValue, false ) ) {\n\t\t\t\tconst cssProperty = key.startsWith( '--' )\n\t\t\t\t\t? key\n\t\t\t\t\t: kebabCase( key );\n\t\t\t\tdeclarations.push(\n\t\t\t\t\t`${ cssProperty }: ${ compileStyleValue(\n\t\t\t\t\t\tget( blockStyles, pathToValue )\n\t\t\t\t\t) }`\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn declarations;\n\t\t},\n\t\t[]\n\t);\n}\n\nexport const getNodesWithStyles = ( tree, blockSelectors ) => {\n\tconst nodes = [];\n\n\tif ( ! tree?.styles ) {\n\t\treturn nodes;\n\t}\n\n\tconst pickStyleKeys = ( treeToPickFrom ) =>\n\t\tpickBy( treeToPickFrom, ( value, key ) =>\n\t\t\t[ 'border', 'color', 'spacing', 'typography' ].includes( key )\n\t\t);\n\n\t// Top-level.\n\tconst styles = pickStyleKeys( tree.styles );\n\tif ( !! styles ) {\n\t\tnodes.push( {\n\t\t\tstyles,\n\t\t\tselector: ROOT_BLOCK_SELECTOR,\n\t\t} );\n\t}\n\tforEach( tree.styles?.elements, ( value, key ) => {\n\t\tif ( !! value && !! ELEMENTS[ key ] ) {\n\t\t\tnodes.push( {\n\t\t\t\tstyles: value,\n\t\t\t\tselector: ELEMENTS[ key ],\n\t\t\t} );\n\t\t}\n\t} );\n\n\t// Iterate over blocks: they can have styles & elements.\n\tforEach( tree.styles?.blocks, ( node, blockName ) => {\n\t\tconst blockStyles = pickStyleKeys( node );\n\t\tif ( !! blockStyles && !! blockSelectors?.[ blockName ]?.selector ) {\n\t\t\tnodes.push( {\n\t\t\t\tstyles: blockStyles,\n\t\t\t\tselector: blockSelectors[ blockName ].selector,\n\t\t\t} );\n\t\t}\n\n\t\tforEach( node?.elements, ( value, elementName ) => {\n\t\t\tif (\n\t\t\t\t!! value &&\n\t\t\t\t!! blockSelectors?.[ blockName ] &&\n\t\t\t\t!! ELEMENTS?.[ elementName ]\n\t\t\t) {\n\t\t\t\tnodes.push( {\n\t\t\t\t\tstyles: value,\n\t\t\t\t\tselector: blockSelectors[ blockName ].selector\n\t\t\t\t\t\t.split( ',' )\n\t\t\t\t\t\t.map( ( sel ) => sel + ' ' + ELEMENTS[ elementName ] )\n\t\t\t\t\t\t.join( ',' ),\n\t\t\t\t} );\n\t\t\t}\n\t\t} );\n\t} );\n\n\treturn nodes;\n};\n\nexport const getNodesWithSettings = ( tree, blockSelectors ) => {\n\tconst nodes = [];\n\n\tif ( ! tree?.settings ) {\n\t\treturn nodes;\n\t}\n\n\tconst pickPresets = ( treeToPickFrom ) => {\n\t\tconst presets = {};\n\t\tPRESET_METADATA.forEach( ( { path } ) => {\n\t\t\tconst value = get( treeToPickFrom, path, false );\n\t\t\tif ( value !== false ) {\n\t\t\t\tset( presets, path, value );\n\t\t\t}\n\t\t} );\n\t\treturn presets;\n\t};\n\n\t// Top-level.\n\tconst presets = pickPresets( tree.settings );\n\tconst custom = tree.settings?.custom;\n\tif ( ! isEmpty( presets ) || !! custom ) {\n\t\tnodes.push( {\n\t\t\tpresets,\n\t\t\tcustom,\n\t\t\tselector: ROOT_BLOCK_SELECTOR,\n\t\t} );\n\t}\n\n\t// Blocks.\n\tforEach( tree.settings?.blocks, ( node, blockName ) => {\n\t\tconst blockPresets = pickPresets( node );\n\t\tconst blockCustom = node.custom;\n\t\tif ( ! isEmpty( blockPresets ) || !! blockCustom ) {\n\t\t\tnodes.push( {\n\t\t\t\tpresets: blockPresets,\n\t\t\t\tcustom: blockCustom,\n\t\t\t\tselector: blockSelectors[ blockName ].selector,\n\t\t\t} );\n\t\t}\n\t} );\n\n\treturn nodes;\n};\n\nexport const toCustomProperties = ( tree, blockSelectors ) => {\n\tconst settings = getNodesWithSettings( tree, blockSelectors );\n\n\tlet ruleset = '';\n\tsettings.forEach( ( { presets, custom, selector } ) => {\n\t\tconst declarations = getPresetsDeclarations( presets );\n\t\tconst customProps = flattenTree( custom, '--wp--custom--', '--' );\n\t\tif ( customProps.length > 0 ) {\n\t\t\tdeclarations.push( ...customProps );\n\t\t}\n\n\t\tif ( declarations.length > 0 ) {\n\t\t\truleset = ruleset + `${ selector }{${ declarations.join( ';' ) };}`;\n\t\t}\n\t} );\n\n\treturn ruleset;\n};\n\nexport const toStyles = ( tree, blockSelectors ) => {\n\tconst nodesWithStyles = getNodesWithStyles( tree, blockSelectors );\n\tconst nodesWithSettings = getNodesWithSettings( tree, blockSelectors );\n\n\tlet ruleset =\n\t\t'.wp-site-blocks > * { margin-top: 0; margin-bottom: 0; }.wp-site-blocks > * + * { margin-top: var( --wp--style--block-gap ); }';\n\tnodesWithStyles.forEach( ( { selector, styles } ) => {\n\t\tconst declarations = getStylesDeclarations( styles );\n\t\tif ( declarations.length === 0 ) {\n\t\t\treturn;\n\t\t}\n\t\truleset = ruleset + `${ selector }{${ declarations.join( ';' ) };}`;\n\t} );\n\n\tnodesWithSettings.forEach( ( { selector, presets } ) => {\n\t\tif ( ROOT_BLOCK_SELECTOR === selector ) {\n\t\t\t// Do not add extra specificity for top-level classes.\n\t\t\tselector = '';\n\t\t}\n\n\t\tconst classes = getPresetsClasses( selector, presets );\n\t\tif ( ! isEmpty( classes ) ) {\n\t\t\truleset = ruleset + classes;\n\t\t}\n\t} );\n\n\treturn ruleset;\n};\n\nconst getBlockSelectors = ( blockTypes ) => {\n\tconst result = {};\n\tblockTypes.forEach( ( blockType ) => {\n\t\tconst name = blockType.name;\n\t\tconst selector =\n\t\t\tblockType?.supports?.__experimentalSelector ??\n\t\t\t'.wp-block-' + name.replace( 'core/', '' ).replace( '/', '-' );\n\t\tresult[ name ] = {\n\t\t\tname,\n\t\t\tselector,\n\t\t};\n\t} );\n\n\treturn result;\n};\n\nexport function useGlobalStylesOutput() {\n\tconst [ stylesheets, setStylesheets ] = useState( [] );\n\tconst [ settings, setSettings ] = useState( {} );\n\tconst { merged: mergedConfig } = useContext( GlobalStylesContext );\n\n\tuseEffect( () => {\n\t\tif ( ! mergedConfig?.styles || ! mergedConfig?.settings ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst blockSelectors = getBlockSelectors( getBlockTypes() );\n\t\tconst customProperties = toCustomProperties(\n\t\t\tmergedConfig,\n\t\t\tblockSelectors\n\t\t);\n\t\tconst globalStyles = toStyles( mergedConfig, blockSelectors );\n\t\tsetStylesheets( [\n\t\t\t{\n\t\t\t\tcss: customProperties,\n\t\t\t\tisGlobalStyles: true,\n\t\t\t},\n\t\t\t{\n\t\t\t\tcss: globalStyles,\n\t\t\t\tisGlobalStyles: true,\n\t\t\t},\n\t\t] );\n\t\tsetSettings( mergedConfig.settings );\n\t}, [ mergedConfig ] );\n\n\treturn [ stylesheets, settings ];\n}\n"]}
|
|
@@ -104,16 +104,13 @@ function DocumentActions(_ref) {
|
|
|
104
104
|
className: "edit-site-document-actions__title-wrapper"
|
|
105
105
|
}, (0, _element.createElement)(_components.__experimentalText, {
|
|
106
106
|
size: "body",
|
|
107
|
-
className: "edit-site-document-actions__title
|
|
107
|
+
className: "edit-site-document-actions__title",
|
|
108
|
+
as: "h1"
|
|
108
109
|
}, (0, _element.createElement)(_components.VisuallyHidden, {
|
|
109
110
|
as: "span"
|
|
110
111
|
}, (0, _i18n.sprintf)(
|
|
111
112
|
/* translators: %s: the entity being edited, like "template"*/
|
|
112
|
-
(0, _i18n.__)('Editing %s:'), entityLabel))), (0, _element.createElement)(_components.__experimentalText, {
|
|
113
|
-
size: "body",
|
|
114
|
-
className: "edit-site-document-actions__title",
|
|
115
|
-
as: "h1"
|
|
116
|
-
}, entityTitle), (0, _element.createElement)(_components.__experimentalText, {
|
|
113
|
+
(0, _i18n.__)('Editing %s: '), entityLabel)), entityTitle), (0, _element.createElement)(_components.__experimentalText, {
|
|
117
114
|
size: "body",
|
|
118
115
|
className: "edit-site-document-actions__secondary-item"
|
|
119
116
|
}, label !== null && label !== void 0 ? label : ''), dropdownContent && (0, _element.createElement)(_components.Dropdown, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/header/document-actions/index.js"],"names":["getBlockDisplayText","block","blockType","name","attributes","useSecondaryText","getBlock","blockEditorStore","activeEntityBlockId","select","__experimentalGetActiveBlockIdByBlockNames","label","isActive","DocumentActions","entityTitle","entityLabel","isLoaded","children","dropdownContent","titleRef","anchorRef","current","isOpen","onToggle","chevronDown"],"mappings":";;;;;;;;;AAqBA;;AAlBA;;AAKA;;AACA;;AAIA;;AACA;;AAMA;;AAEA;;AAtBA;AACA;AACA;;AAGA;AACA;AACA;AAiBA,SAASA,mBAAT,CAA8BC,KAA9B,EAAsC;AACrC,MAAKA,KAAL,EAAa;AACZ,UAAMC,SAAS,GAAG,0BAAcD,KAAK,CAACE,IAApB,CAAlB;AACA,WAAOD,SAAS,GAAG,yCAAeA,SAAf,EAA0BD,KAAK,CAACG,UAAhC,CAAH,GAAkD,IAAlE;AACA;;AACD,SAAO,IAAP;AACA;;AAED,SAASC,gBAAT,GAA4B;AAC3B,QAAM;AAAEC,IAAAA;AAAF,MAAe,qBAAWC,kBAAX,CAArB;AACA,QAAMC,mBAAmB,GAAG,qBACzBC,MAAF,IACCA,MAAM,CACLF,kBADK,CAAN,CAEEG,0CAFF,CAE8C,CAC7C,oBAD6C,CAF9C,CAF0B,EAO3B,EAP2B,CAA5B;;AAUA,MAAKF,mBAAL,EAA2B;AAC1B,WAAO;AACNG,MAAAA,KAAK,EAAEX,mBAAmB,CAAEM,QAAQ,CAAEE,mBAAF,CAAV,CADpB;AAENI,MAAAA,QAAQ,EAAE;AAFJ,KAAP;AAIA;;AAED,SAAO,EAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACe,SAASC,eAAT,OAKX;AAAA,MALqC;AACxCC,IAAAA,WADwC;AAExCC,IAAAA,WAFwC;AAGxCC,IAAAA,QAHwC;AAIxCC,IAAAA,QAAQ,EAAEC;AAJ8B,GAKrC;AACH,QAAM;AAAEP,IAAAA;AAAF,MAAYN,gBAAgB,EAAlC,CADG,CAGH;AACA;AACA;;AACA,QAAMc,QAAQ,GAAG,sBAAjB,CANG,CAQH;;AACA,MAAK,CAAEH,QAAP,EAAkB;AACjB,WACC;AAAK,MAAA,SAAS,EAAC;AAAf,OACG,cAAI,UAAJ,CADH,CADD;AAKA,GAfE,CAiBH;;;AACA,MAAK,CAAEF,WAAP,EAAqB;AACpB,WACC;AAAK,MAAA,SAAS,EAAC;AAAf,OACG,cAAI,oBAAJ,CADH,CADD;AAKA;;AAED,SACC;AACC,IAAA,SAAS,EAAG,yBAAY,4BAAZ,EAA0C;AACrD,6BAAuB,CAAC,CAAEH;AAD2B,KAA1C;AADb,KAKC;AACC,IAAA,GAAG,EAAGQ,QADP;AAEC,IAAA,SAAS,EAAC;AAFX,KAIC,4BAAC,8BAAD;AACC,IAAA,IAAI,EAAC,MADN;AAEC,IAAA,SAAS,EAAC;
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/header/document-actions/index.js"],"names":["getBlockDisplayText","block","blockType","name","attributes","useSecondaryText","getBlock","blockEditorStore","activeEntityBlockId","select","__experimentalGetActiveBlockIdByBlockNames","label","isActive","DocumentActions","entityTitle","entityLabel","isLoaded","children","dropdownContent","titleRef","anchorRef","current","isOpen","onToggle","chevronDown"],"mappings":";;;;;;;;;AAqBA;;AAlBA;;AAKA;;AACA;;AAIA;;AACA;;AAMA;;AAEA;;AAtBA;AACA;AACA;;AAGA;AACA;AACA;AAiBA,SAASA,mBAAT,CAA8BC,KAA9B,EAAsC;AACrC,MAAKA,KAAL,EAAa;AACZ,UAAMC,SAAS,GAAG,0BAAcD,KAAK,CAACE,IAApB,CAAlB;AACA,WAAOD,SAAS,GAAG,yCAAeA,SAAf,EAA0BD,KAAK,C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AAI,EAAC,MADN;AAEC,IAAA,SAAS,EAAC,mCAFX;AAGC,IAAA,EAAE,EAAC;AAHJ,KAKC,4BAAC,0BAAD;AAAgB,IAAA,EAAE,EAAC;AAAnB,KACG;AACD;AACA,gBAAI,cAAJ,CAFC,EAGDJ,WAHC,CADH,CALD,EAYGD,WAZH,CAJD,EAmBC,4BAAC,8BAAD;AACC,IAAA,IAAI,EAAC,MADN;AAEC,IAAA,SAAS,EAAC;AAFX,KAIGH,KAJH,aAIGA,KAJH,cAIGA,KAJH,GAIY,EAJZ,CAnBD,EA0BGO,eAAe,IAChB,4BAAC,oBAAD;AACC,IAAA,YAAY,EAAG;AACdE,MAAAA,SAAS,EAAED,QAAQ,CAACE;AADN,KADhB;AAIC,IAAA,QAAQ,EAAC,eAJV;AAKC,IAAA,YAAY,EAAG;AAAA,UAAE;AAAEC,QAAAA,MAAF;AAAUC,QAAAA;AAAV,OAAF;AAAA,aACd,4BAAC,kBAAD;AACC,QAAA,SAAS,EAAC,sCADX;AAEC,QAAA,IAAI,EAAGC,kBAFR;AAGC,yBAAgBF,MAHjB;AAIC,yBAAc,MAJf;AAKC,QAAA,OAAO,EAAGC,QALX;AAMC,QAAA,KAAK,EAAG;AACP;AACA,sBAAI,iBAAJ,CAFO,EAGPR,WAHO;AANT,QADc;AAAA,KALhB;AAmBC,IAAA,gBAAgB,EAAC,2CAnBlB;AAoBC,IAAA,aAAa,EAAGG;AApBjB,IA3BF,CALD,CADD;AA2DA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { sprintf, __ } from '@wordpress/i18n';\nimport {\n\t__experimentalGetBlockLabel as getBlockLabel,\n\tgetBlockType,\n} from '@wordpress/blocks';\nimport { useSelect } from '@wordpress/data';\nimport {\n\tDropdown,\n\tButton,\n\tVisuallyHidden,\n\t__experimentalText as Text,\n} from '@wordpress/components';\nimport { chevronDown } from '@wordpress/icons';\nimport { useRef } from '@wordpress/element';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\nfunction getBlockDisplayText( block ) {\n\tif ( block ) {\n\t\tconst blockType = getBlockType( block.name );\n\t\treturn blockType ? getBlockLabel( blockType, block.attributes ) : null;\n\t}\n\treturn null;\n}\n\nfunction useSecondaryText() {\n\tconst { getBlock } = useSelect( blockEditorStore );\n\tconst activeEntityBlockId = useSelect(\n\t\t( select ) =>\n\t\t\tselect(\n\t\t\t\tblockEditorStore\n\t\t\t).__experimentalGetActiveBlockIdByBlockNames( [\n\t\t\t\t'core/template-part',\n\t\t\t] ),\n\t\t[]\n\t);\n\n\tif ( activeEntityBlockId ) {\n\t\treturn {\n\t\t\tlabel: getBlockDisplayText( getBlock( activeEntityBlockId ) ),\n\t\t\tisActive: true,\n\t\t};\n\t}\n\n\treturn {};\n}\n\n/**\n * @param {Object} props Props for the DocumentActions component.\n * @param {string} props.entityTitle The title to display.\n * @param {string} props.entityLabel A label to use for entity-related options.\n * E.g. \"template\" would be used for \"edit\n * template\" and \"show template details\".\n * @param {boolean} props.isLoaded Whether the data is available.\n * @param {Function} props.children React component to use for the\n * information dropdown area. Should be a\n * function which accepts dropdown props.\n */\nexport default function DocumentActions( {\n\tentityTitle,\n\tentityLabel,\n\tisLoaded,\n\tchildren: dropdownContent,\n} ) {\n\tconst { label } = useSecondaryText();\n\n\t// The title ref is passed to the popover as the anchorRef so that the\n\t// dropdown is centered over the whole title area rather than just one\n\t// part of it.\n\tconst titleRef = useRef();\n\n\t// Return a simple loading indicator until we have information to show.\n\tif ( ! isLoaded ) {\n\t\treturn (\n\t\t\t<div className=\"edit-site-document-actions\">\n\t\t\t\t{ __( 'Loading…' ) }\n\t\t\t</div>\n\t\t);\n\t}\n\n\t// Return feedback that the template does not seem to exist.\n\tif ( ! entityTitle ) {\n\t\treturn (\n\t\t\t<div className=\"edit-site-document-actions\">\n\t\t\t\t{ __( 'Template not found' ) }\n\t\t\t</div>\n\t\t);\n\t}\n\n\treturn (\n\t\t<div\n\t\t\tclassName={ classnames( 'edit-site-document-actions', {\n\t\t\t\t'has-secondary-label': !! label,\n\t\t\t} ) }\n\t\t>\n\t\t\t<div\n\t\t\t\tref={ titleRef }\n\t\t\t\tclassName=\"edit-site-document-actions__title-wrapper\"\n\t\t\t>\n\t\t\t\t<Text\n\t\t\t\t\tsize=\"body\"\n\t\t\t\t\tclassName=\"edit-site-document-actions__title\"\n\t\t\t\t\tas=\"h1\"\n\t\t\t\t>\n\t\t\t\t\t<VisuallyHidden as=\"span\">\n\t\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t\t/* translators: %s: the entity being edited, like \"template\"*/\n\t\t\t\t\t\t\t__( 'Editing %s: ' ),\n\t\t\t\t\t\t\tentityLabel\n\t\t\t\t\t\t) }\n\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t{ entityTitle }\n\t\t\t\t</Text>\n\n\t\t\t\t<Text\n\t\t\t\t\tsize=\"body\"\n\t\t\t\t\tclassName=\"edit-site-document-actions__secondary-item\"\n\t\t\t\t>\n\t\t\t\t\t{ label ?? '' }\n\t\t\t\t</Text>\n\n\t\t\t\t{ dropdownContent && (\n\t\t\t\t\t<Dropdown\n\t\t\t\t\t\tpopoverProps={ {\n\t\t\t\t\t\t\tanchorRef: titleRef.current,\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tposition=\"bottom center\"\n\t\t\t\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\tclassName=\"edit-site-document-actions__get-info\"\n\t\t\t\t\t\t\t\ticon={ chevronDown }\n\t\t\t\t\t\t\t\taria-expanded={ isOpen }\n\t\t\t\t\t\t\t\taria-haspopup=\"true\"\n\t\t\t\t\t\t\t\tonClick={ onToggle }\n\t\t\t\t\t\t\t\tlabel={ sprintf(\n\t\t\t\t\t\t\t\t\t/* translators: %s: the entity to see details about, like \"template\"*/\n\t\t\t\t\t\t\t\t\t__( 'Show %s details' ),\n\t\t\t\t\t\t\t\t\tentityLabel\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\tcontentClassName=\"edit-site-document-actions__info-dropdown\"\n\t\t\t\t\t\trenderContent={ dropdownContent }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/list/actions/index.js"],"names":["Actions","template","removeTemplate","revertTemplate","editSiteStore","saveEditedEntityRecord","coreStore","createSuccessNotice","createErrorNotice","noticesStore","isRemovable","isRevertable","revertAndSaveTemplate","allowUndo","type","id","error","errorMessage","message","code","moreVertical","onClose"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AAhBA;AACA;AACA;;AAQA;AACA;AACA;AAMe,SAASA,OAAT,OAAiC;AAAA,MAAf;AAAEC,IAAAA;AAAF,GAAe;AAC/C,QAAM;AAAEC,IAAAA,cAAF;AAAkBC,IAAAA;AAAlB,MAAqC,uBAAaC,YAAb,CAA3C;AACA,QAAM;AAAEC,IAAAA;AAAF,MAA6B,uBAAaC,eAAb,CAAnC;AACA,QAAM;AAAEC,IAAAA,mBAAF;AAAuBC,IAAAA;AAAvB,MAA6C,uBAClDC,cADkD,CAAnD;AAIA,QAAMC,WAAW,GAAG,kCAAqBT,QAArB,CAApB;AACA,QAAMU,YAAY,GAAG,mCAAsBV,QAAtB,CAArB;;AAEA,MAAK,CAAES,WAAF,IAAiB,CAAEC,YAAxB,EAAuC;AACtC,WAAO,IAAP;AACA;;AAED,iBAAeC,qBAAf,GAAuC;AACtC,QAAI;AACH,YAAMT,cAAc,CAAEF,QAAF,EAAY;AAAEY,QAAAA,SAAS,EAAE;AAAb,OAAZ,CAApB;AACA,YAAMR,sBAAsB,CAC3B,UAD2B,EAE3BJ,QAAQ,CAACa,IAFkB,EAG3Bb,QAAQ,CAACc,EAHkB,CAA5B;AAMAR,MAAAA,mBAAmB,CAAE,cAAI,oBAAJ,CAAF,EAA8B;AAChDO,QAAAA,IAAI,EAAE;AAD0C,OAA9B,CAAnB;AAGA,KAXD,CAWE,OAAQE,KAAR,EAAgB;AACjB,YAAMC,YAAY,GACjBD,KAAK,CAACE,OAAN,IAAiBF,KAAK,CAACG,IAAN,KAAe,eAAhC,GACGH,KAAK,CAACE,OADT,GAEG,cAAI,iDAAJ,CAHJ;AAKAV,MAAAA,iBAAiB,CAAES,YAAF,EAAgB;AAAEH,QAAAA,IAAI,EAAE;AAAR,OAAhB,CAAjB;AACA;AACD;;AAED,SACC,4BAAC,wBAAD;AACC,IAAA,IAAI,EAAGM,mBADR;AAEC,IAAA,KAAK,EAAG,cAAI,SAAJ,CAFT;AAGC,IAAA,SAAS,EAAC;AAHX,KAKG;AAAA,QAAE;AAAEC,MAAAA;AAAF,KAAF;AAAA,WACD,4BAAC,qBAAD,QACGX,WAAW,IACZ,qDACC,4BAAC,uBAAD;AACC,MAAA,QAAQ,EAAGT,QADZ;AAEC,MAAA,OAAO,EAAGoB;AAFX,MADD,EAKC,4BAAC,oBAAD;AACC,MAAA,aAAa,MADd;AAEC,MAAA,OAAO,EAAG,MAAM;AACfnB,QAAAA,cAAc,CAAED,QAAF,CAAd;AACAoB,QAAAA,OAAO;AACP;
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/list/actions/index.js"],"names":["Actions","template","removeTemplate","revertTemplate","editSiteStore","saveEditedEntityRecord","coreStore","createSuccessNotice","createErrorNotice","noticesStore","isRemovable","isRevertable","revertAndSaveTemplate","allowUndo","type","id","error","errorMessage","message","code","moreVertical","onClose"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AAhBA;AACA;AACA;;AAQA;AACA;AACA;AAMe,SAASA,OAAT,OAAiC;AAAA,MAAf;AAAEC,IAAAA;AAAF,G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BAAC,uBAAD;AACC,MAAA,QAAQ,EAAGT,QADZ;AAEC,MAAA,OAAO,EAAGoB;AAFX,MADD,EAKC,4BAAC,oBAAD;AACC,MAAA,aAAa,MADd;AAEC,MAAA,UAAU,MAFX;AAGC,MAAA,OAAO,EAAG,MAAM;AACfnB,QAAAA,cAAc,CAAED,QAAF,CAAd;AACAoB,QAAAA,OAAO;AACP;AANF,OAQG,cAAI,iBAAJ,CARH,CALD,CAFF,EAmBGV,YAAY,IACb,4BAAC,oBAAD;AACC,MAAA,IAAI,EAAG,cAAI,mCAAJ,CADR;AAEC,MAAA,OAAO,EAAG,MAAM;AACfC,QAAAA,qBAAqB;AACrBS,QAAAA,OAAO;AACP;AALF,OAOG,cAAI,sBAAJ,CAPH,CApBF,CADC;AAAA,GALH,CADD;AAyCA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __ } from '@wordpress/i18n';\nimport { DropdownMenu, MenuGroup, MenuItem } from '@wordpress/components';\nimport { moreVertical } from '@wordpress/icons';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../../store';\nimport isTemplateRemovable from '../../../utils/is-template-removable';\nimport isTemplateRevertable from '../../../utils/is-template-revertable';\nimport RenameMenuItem from './rename-menu-item';\n\nexport default function Actions( { template } ) {\n\tconst { removeTemplate, revertTemplate } = useDispatch( editSiteStore );\n\tconst { saveEditedEntityRecord } = useDispatch( coreStore );\n\tconst { createSuccessNotice, createErrorNotice } = useDispatch(\n\t\tnoticesStore\n\t);\n\n\tconst isRemovable = isTemplateRemovable( template );\n\tconst isRevertable = isTemplateRevertable( template );\n\n\tif ( ! isRemovable && ! isRevertable ) {\n\t\treturn null;\n\t}\n\n\tasync function revertAndSaveTemplate() {\n\t\ttry {\n\t\t\tawait revertTemplate( template, { allowUndo: false } );\n\t\t\tawait saveEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\ttemplate.type,\n\t\t\t\ttemplate.id\n\t\t\t);\n\n\t\t\tcreateSuccessNotice( __( 'Template reverted.' ), {\n\t\t\t\ttype: 'snackbar',\n\t\t\t} );\n\t\t} catch ( error ) {\n\t\t\tconst errorMessage =\n\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t? error.message\n\t\t\t\t\t: __( 'An error occurred while reverting the template.' );\n\n\t\t\tcreateErrorNotice( errorMessage, { type: 'snackbar' } );\n\t\t}\n\t}\n\n\treturn (\n\t\t<DropdownMenu\n\t\t\ticon={ moreVertical }\n\t\t\tlabel={ __( 'Actions' ) }\n\t\t\tclassName=\"edit-site-list-table__actions\"\n\t\t>\n\t\t\t{ ( { onClose } ) => (\n\t\t\t\t<MenuGroup>\n\t\t\t\t\t{ isRemovable && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<RenameMenuItem\n\t\t\t\t\t\t\t\ttemplate={ template }\n\t\t\t\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\tisDestructive\n\t\t\t\t\t\t\t\tisTertiary\n\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\tremoveTemplate( template );\n\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Delete template' ) }\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\t\t\t\t\t{ isRevertable && (\n\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\tinfo={ __( 'Restore template to default state' ) }\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\trevertAndSaveTemplate();\n\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Clear customizations' ) }\n\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t) }\n\t\t\t\t</MenuGroup>\n\t\t\t) }\n\t\t</DropdownMenu>\n\t);\n}\n"]}
|
|
@@ -33,6 +33,10 @@ var _table = _interopRequireDefault(require("./table"));
|
|
|
33
33
|
|
|
34
34
|
var _store = require("../../store");
|
|
35
35
|
|
|
36
|
+
var _routes = require("../routes");
|
|
37
|
+
|
|
38
|
+
var _useTitle = _interopRequireDefault(require("../routes/use-title"));
|
|
39
|
+
|
|
36
40
|
/**
|
|
37
41
|
* External dependencies
|
|
38
42
|
*/
|
|
@@ -44,12 +48,14 @@ var _store = require("../../store");
|
|
|
44
48
|
/**
|
|
45
49
|
* Internal dependencies
|
|
46
50
|
*/
|
|
47
|
-
function List(
|
|
48
|
-
var _postType$labels;
|
|
51
|
+
function List() {
|
|
52
|
+
var _postType$labels, _postType$labels2;
|
|
49
53
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
54
|
+
const {
|
|
55
|
+
params: {
|
|
56
|
+
postType: templateType
|
|
57
|
+
}
|
|
58
|
+
} = (0, _routes.useLocation)();
|
|
53
59
|
(0, _useRegisterShortcuts.default)();
|
|
54
60
|
const {
|
|
55
61
|
previousShortcut,
|
|
@@ -62,10 +68,11 @@ function List(_ref) {
|
|
|
62
68
|
isNavigationOpen: select(_store.store).isNavigationOpened()
|
|
63
69
|
};
|
|
64
70
|
}, []);
|
|
65
|
-
const postType = (0, _data.useSelect)(select => select(_coreData.store).getPostType(templateType), [templateType]);
|
|
71
|
+
const postType = (0, _data.useSelect)(select => select(_coreData.store).getPostType(templateType), [templateType]);
|
|
72
|
+
(0, _useTitle.default)(postType === null || postType === void 0 ? void 0 : (_postType$labels = postType.labels) === null || _postType$labels === void 0 ? void 0 : _postType$labels.name); // `postType` could load in asynchronously. Only provide the detailed region labels if
|
|
66
73
|
// the postType has loaded, otherwise `InterfaceSkeleton` will fallback to the defaults.
|
|
67
74
|
|
|
68
|
-
const itemsListLabel = postType === null || postType === void 0 ? void 0 : (_postType$
|
|
75
|
+
const itemsListLabel = postType === null || postType === void 0 ? void 0 : (_postType$labels2 = postType.labels) === null || _postType$labels2 === void 0 ? void 0 : _postType$labels2.items_list;
|
|
69
76
|
const detailedRegionLabels = postType ? {
|
|
70
77
|
header: (0, _i18n.sprintf)( // translators: %s - the name of the page, 'Header' as in the header area of that page.
|
|
71
78
|
(0, _i18n.__)('%s - Header'), itemsListLabel),
|
|
@@ -83,16 +90,11 @@ function List(_ref) {
|
|
|
83
90
|
header: (0, _element.createElement)(_header.default, {
|
|
84
91
|
templateType: templateType
|
|
85
92
|
}),
|
|
86
|
-
drawer: (0, _element.createElement)(_navigationSidebar.default,
|
|
87
|
-
activeTemplateType: templateType,
|
|
88
|
-
isDefaultOpen: true
|
|
89
|
-
}),
|
|
93
|
+
drawer: (0, _element.createElement)(_navigationSidebar.default.Slot, null),
|
|
90
94
|
notices: (0, _element.createElement)(_editor.EditorSnackbars, null),
|
|
91
|
-
content: (0, _element.createElement)(
|
|
92
|
-
className: "edit-site-list-main"
|
|
93
|
-
}, (0, _element.createElement)(_table.default, {
|
|
95
|
+
content: (0, _element.createElement)(_table.default, {
|
|
94
96
|
templateType: templateType
|
|
95
|
-
})
|
|
97
|
+
}),
|
|
96
98
|
shortcuts: {
|
|
97
99
|
previous: previousShortcut,
|
|
98
100
|
next: nextShortcut
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/list/index.js"],"names":["List","templateType","previousShortcut","nextShortcut","isNavigationOpen","select","keyboardShortcutsStore","getAllShortcutKeyCombinations","editSiteStore","isNavigationOpened","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/list/index.js"],"names":["List","params","postType","templateType","previousShortcut","nextShortcut","isNavigationOpen","select","keyboardShortcutsStore","getAllShortcutKeyCombinations","editSiteStore","isNavigationOpened","coreStore","getPostType","labels","name","itemsListLabel","items_list","detailedRegionLabels","header","body","undefined","drawer","previous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,CAFK,EAGLJ,cAHK;AANN,GADkC,GAalCK,SAbH;AAeA,SACC,4BAAC,4BAAD;AACC,IAAA,SAAS,EAAG,yBAAY,gBAAZ,EAA8B;AACzC,4BAAsBf;AADmB,KAA9B,CADb;AAIC,IAAA,MAAM,EAAG;AACRgB,MAAAA,MAAM,EAAE,cAAI,oBAAJ,CADA;AAER,SAAGJ;AAFK,KAJV;AAQC,IAAA,MAAM,EAAG,4BAAC,eAAD;AAAQ,MAAA,YAAY,EAAGf;AAAvB,MARV;AASC,IAAA,MAAM,EAAG,4BAAC,0BAAD,CAAmB,IAAnB,OATV;AAUC,IAAA,OAAO,EAAG,4BAAC,uBAAD,OAVX;AAWC,IAAA,OAAO,EAAG,4BAAC,cAAD;AAAO,MAAA,YAAY,EAAGA;AAAtB,MAXX;AAYC,IAAA,SAAS,EAAG;AACXoB,MAAAA,QAAQ,EAAEnB,gBADC;AAEXoB,MAAAA,IAAI,EAAEnB;AAFK;AAZb,IADD;AAmBA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { InterfaceSkeleton } from '@wordpress/interface';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\nimport { EditorSnackbars } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport useRegisterShortcuts from './use-register-shortcuts';\nimport Header from './header';\nimport NavigationSidebar from '../navigation-sidebar';\nimport Table from './table';\nimport { store as editSiteStore } from '../../store';\nimport { useLocation } from '../routes';\nimport useTitle from '../routes/use-title';\n\nexport default function List() {\n\tconst {\n\t\tparams: { postType: templateType },\n\t} = useLocation();\n\n\tuseRegisterShortcuts();\n\n\tconst { previousShortcut, nextShortcut, isNavigationOpen } = useSelect(\n\t\t( select ) => {\n\t\t\treturn {\n\t\t\t\tpreviousShortcut: select(\n\t\t\t\t\tkeyboardShortcutsStore\n\t\t\t\t).getAllShortcutKeyCombinations(\n\t\t\t\t\t'core/edit-site/previous-region'\n\t\t\t\t),\n\t\t\t\tnextShortcut: select(\n\t\t\t\t\tkeyboardShortcutsStore\n\t\t\t\t).getAllShortcutKeyCombinations( 'core/edit-site/next-region' ),\n\t\t\t\tisNavigationOpen: select( editSiteStore ).isNavigationOpened(),\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\tconst postType = useSelect(\n\t\t( select ) => select( coreStore ).getPostType( templateType ),\n\t\t[ templateType ]\n\t);\n\n\tuseTitle( postType?.labels?.name );\n\n\t// `postType` could load in asynchronously. Only provide the detailed region labels if\n\t// the postType has loaded, otherwise `InterfaceSkeleton` will fallback to the defaults.\n\tconst itemsListLabel = postType?.labels?.items_list;\n\tconst detailedRegionLabels = postType\n\t\t? {\n\t\t\t\theader: sprintf(\n\t\t\t\t\t// translators: %s - the name of the page, 'Header' as in the header area of that page.\n\t\t\t\t\t__( '%s - Header' ),\n\t\t\t\t\titemsListLabel\n\t\t\t\t),\n\t\t\t\tbody: sprintf(\n\t\t\t\t\t// translators: %s - the name of the page, 'Content' as in the content area of that page.\n\t\t\t\t\t__( '%s - Content' ),\n\t\t\t\t\titemsListLabel\n\t\t\t\t),\n\t\t }\n\t\t: undefined;\n\n\treturn (\n\t\t<InterfaceSkeleton\n\t\t\tclassName={ classnames( 'edit-site-list', {\n\t\t\t\t'is-navigation-open': isNavigationOpen,\n\t\t\t} ) }\n\t\t\tlabels={ {\n\t\t\t\tdrawer: __( 'Navigation Sidebar' ),\n\t\t\t\t...detailedRegionLabels,\n\t\t\t} }\n\t\t\theader={ <Header templateType={ templateType } /> }\n\t\t\tdrawer={ <NavigationSidebar.Slot /> }\n\t\t\tnotices={ <EditorSnackbars /> }\n\t\t\tcontent={ <Table templateType={ templateType } /> }\n\t\t\tshortcuts={ {\n\t\t\t\tprevious: previousShortcut,\n\t\t\t\tnext: nextShortcut,\n\t\t\t} }\n\t\t/>\n\t);\n}\n"]}
|
|
@@ -17,7 +17,7 @@ var _i18n = require("@wordpress/i18n");
|
|
|
17
17
|
|
|
18
18
|
var _components = require("@wordpress/components");
|
|
19
19
|
|
|
20
|
-
var
|
|
20
|
+
var _link = _interopRequireDefault(require("../routes/link"));
|
|
21
21
|
|
|
22
22
|
var _actions = _interopRequireDefault(require("./actions"));
|
|
23
23
|
|
|
@@ -95,11 +95,11 @@ function Table(_ref) {
|
|
|
95
95
|
role: "cell"
|
|
96
96
|
}, (0, _element.createElement)(_components.__experimentalHeading, {
|
|
97
97
|
level: 4
|
|
98
|
-
}, (0, _element.createElement)(
|
|
99
|
-
|
|
98
|
+
}, (0, _element.createElement)(_link.default, {
|
|
99
|
+
params: {
|
|
100
100
|
postId: template.id,
|
|
101
101
|
postType: template.type
|
|
102
|
-
}
|
|
102
|
+
}
|
|
103
103
|
}, ((_template$title = template.title) === null || _template$title === void 0 ? void 0 : _template$title.rendered) || template.slug)), template.description), (0, _element.createElement)("td", {
|
|
104
104
|
className: "edit-site-list-table-column",
|
|
105
105
|
role: "cell"
|