@wordpress/edit-site 3.0.6 → 3.0.10
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/index.js +49 -0
- package/build/components/add-new-template/index.js.map +1 -0
- package/build/components/add-new-template/new-template-part.js +79 -0
- package/build/components/add-new-template/new-template-part.js.map +1 -0
- package/build/components/add-new-template/new-template.js +115 -0
- package/build/components/add-new-template/new-template.js.map +1 -0
- package/build/components/block-editor/block-inspector-button.js +4 -3
- package/build/components/block-editor/block-inspector-button.js.map +1 -1
- package/build/components/block-editor/index.js +12 -8
- package/build/components/block-editor/index.js.map +1 -1
- package/build/components/block-editor/resizable-editor.js +6 -5
- package/build/components/block-editor/resizable-editor.js.map +1 -1
- package/build/components/block-editor/resize-handle.js +6 -4
- package/build/components/block-editor/resize-handle.js.map +1 -1
- package/build/components/create-template-part-modal/index.js +115 -0
- package/build/components/create-template-part-modal/index.js.map +1 -0
- package/build/components/edit-template-part-menu-button/index.js +15 -11
- package/build/components/edit-template-part-menu-button/index.js.map +1 -1
- package/build/components/editor/index.js +16 -17
- package/build/components/editor/index.js.map +1 -1
- package/build/components/error-boundary/index.js +5 -4
- package/build/components/error-boundary/index.js.map +1 -1
- package/build/components/global-styles/border-panel.js +5 -4
- package/build/components/global-styles/border-panel.js.map +1 -1
- package/build/components/global-styles/color-palette-panel.js +4 -3
- package/build/components/global-styles/color-palette-panel.js.map +1 -1
- package/build/components/global-styles/context-menu.js +5 -4
- package/build/components/global-styles/context-menu.js.map +1 -1
- package/build/components/global-styles/dimensions-panel.js +5 -4
- package/build/components/global-styles/dimensions-panel.js.map +1 -1
- package/build/components/global-styles/global-styles-provider.js +16 -13
- package/build/components/global-styles/global-styles-provider.js.map +1 -1
- package/build/components/global-styles/header.js +6 -5
- package/build/components/global-styles/header.js.map +1 -1
- package/build/components/global-styles/hooks.js +34 -30
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/index.js +6 -6
- package/build/components/global-styles/navigation-button.js +8 -7
- package/build/components/global-styles/navigation-button.js.map +1 -1
- package/build/components/global-styles/palette.js +13 -9
- package/build/components/global-styles/palette.js.map +1 -1
- package/build/components/global-styles/screen-background-color.js +4 -3
- package/build/components/global-styles/screen-background-color.js.map +1 -1
- package/build/components/global-styles/screen-block-list.js +13 -4
- package/build/components/global-styles/screen-block-list.js.map +1 -1
- package/build/components/global-styles/screen-block.js +4 -3
- package/build/components/global-styles/screen-block.js.map +1 -1
- package/build/components/global-styles/screen-color-palette.js +4 -3
- package/build/components/global-styles/screen-color-palette.js.map +1 -1
- package/build/components/global-styles/screen-colors.js +19 -15
- package/build/components/global-styles/screen-colors.js.map +1 -1
- package/build/components/global-styles/screen-layout.js +8 -5
- package/build/components/global-styles/screen-layout.js.map +1 -1
- package/build/components/global-styles/screen-link-color.js +4 -3
- package/build/components/global-styles/screen-link-color.js.map +1 -1
- package/build/components/global-styles/screen-text-color.js +4 -3
- package/build/components/global-styles/screen-text-color.js.map +1 -1
- package/build/components/global-styles/screen-typography.js +4 -3
- package/build/components/global-styles/screen-typography.js.map +1 -1
- package/build/components/global-styles/subtitle.js +4 -3
- package/build/components/global-styles/subtitle.js.map +1 -1
- package/build/components/global-styles/typography-panel.js +10 -8
- package/build/components/global-styles/typography-panel.js.map +1 -1
- package/build/components/global-styles/ui.js +4 -3
- package/build/components/global-styles/ui.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +61 -44
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/global-styles/utils.js +4 -3
- package/build/components/global-styles/utils.js.map +1 -1
- package/build/components/header/document-actions/index.js +23 -19
- package/build/components/header/document-actions/index.js.map +1 -1
- package/build/components/header/feature-toggle/index.js +9 -7
- package/build/components/header/feature-toggle/index.js.map +1 -1
- package/build/components/header/index.js +15 -13
- package/build/components/header/index.js.map +1 -1
- package/build/components/header/more-menu/index.js +30 -27
- package/build/components/header/more-menu/index.js.map +1 -1
- package/build/components/header/tools-more-menu-group/index.js +10 -7
- package/build/components/header/tools-more-menu-group/index.js.map +1 -1
- package/build/components/keyboard-shortcuts/index.js +4 -3
- package/build/components/keyboard-shortcuts/index.js.map +1 -1
- package/build/components/list/header.js +50 -0
- package/build/components/list/header.js.map +1 -0
- package/build/components/list/index.js +55 -0
- package/build/components/list/index.js.map +1 -0
- package/build/components/list/table.js +128 -0
- package/build/components/list/table.js.map +1 -0
- package/build/components/main-dashboard-button/index.js +4 -3
- package/build/components/main-dashboard-button/index.js.map +1 -1
- package/build/components/navigate-to-link/index.js +7 -6
- package/build/components/navigate-to-link/index.js.map +1 -1
- package/build/components/navigation-sidebar/index.js +12 -11
- package/build/components/navigation-sidebar/index.js.map +1 -1
- package/build/components/navigation-sidebar/navigation-panel/constants.js +1 -1
- package/build/components/navigation-sidebar/navigation-panel/content-navigation-item.js +4 -3
- package/build/components/navigation-sidebar/navigation-panel/content-navigation-item.js.map +1 -1
- package/build/components/navigation-sidebar/navigation-panel/index.js +36 -55
- package/build/components/navigation-sidebar/navigation-panel/index.js.map +1 -1
- package/build/components/navigation-sidebar/navigation-panel/menus/template-parts-sub.js +6 -5
- package/build/components/navigation-sidebar/navigation-panel/menus/template-parts-sub.js.map +1 -1
- package/build/components/navigation-sidebar/navigation-panel/menus/template-parts.js +26 -20
- package/build/components/navigation-sidebar/navigation-panel/menus/template-parts.js.map +1 -1
- package/build/components/navigation-sidebar/navigation-panel/menus/templates-sub.js +17 -10
- package/build/components/navigation-sidebar/navigation-panel/menus/templates-sub.js.map +1 -1
- package/build/components/navigation-sidebar/navigation-panel/menus/templates.js +11 -5
- package/build/components/navigation-sidebar/navigation-panel/menus/templates.js.map +1 -1
- package/build/components/navigation-sidebar/navigation-panel/navigation-entity-items.js +13 -11
- package/build/components/navigation-sidebar/navigation-panel/navigation-entity-items.js.map +1 -1
- package/build/components/navigation-sidebar/navigation-panel/new-template-dropdown.js +24 -18
- package/build/components/navigation-sidebar/navigation-panel/new-template-dropdown.js.map +1 -1
- package/build/components/navigation-sidebar/navigation-panel/search-results.js +14 -11
- package/build/components/navigation-sidebar/navigation-panel/search-results.js.map +1 -1
- package/build/components/navigation-sidebar/navigation-panel/template-hierarchy.js +8 -5
- package/build/components/navigation-sidebar/navigation-panel/template-hierarchy.js.map +1 -1
- package/build/components/navigation-sidebar/navigation-panel/template-navigation-item.js +4 -3
- package/build/components/navigation-sidebar/navigation-panel/template-navigation-item.js.map +1 -1
- package/build/components/navigation-sidebar/navigation-panel/template-preview.js +5 -4
- package/build/components/navigation-sidebar/navigation-panel/template-preview.js.map +1 -1
- package/build/components/navigation-sidebar/navigation-toggle/index.js +7 -27
- package/build/components/navigation-sidebar/navigation-toggle/index.js.map +1 -1
- package/build/components/save-button/index.js +5 -4
- package/build/components/save-button/index.js.map +1 -1
- package/build/components/sidebar/constants.js +1 -1
- package/build/components/sidebar/default-sidebar.js +11 -10
- package/build/components/sidebar/default-sidebar.js.map +1 -1
- package/build/components/sidebar/plugin-sidebar/index.js +5 -4
- package/build/components/sidebar/plugin-sidebar/index.js.map +1 -1
- package/build/components/sidebar/settings-header/index.js +4 -3
- package/build/components/sidebar/settings-header/index.js.map +1 -1
- package/build/components/sidebar/template-card/template-areas.js +17 -13
- package/build/components/sidebar/template-card/template-areas.js.map +1 -1
- package/build/components/template-details/index.js +14 -9
- package/build/components/template-details/index.js.map +1 -1
- package/build/components/template-details/template-areas.js +38 -29
- package/build/components/template-details/template-areas.js.map +1 -1
- package/build/components/template-part-converter/convert-to-regular.js +15 -11
- package/build/components/template-part-converter/convert-to-regular.js.map +1 -1
- package/build/components/template-part-converter/convert-to-template-part.js +29 -86
- package/build/components/template-part-converter/convert-to-template-part.js.map +1 -1
- package/build/components/welcome-guide/editor.js +58 -0
- package/build/components/welcome-guide/editor.js.map +1 -0
- package/build/components/welcome-guide/image.js +27 -0
- package/build/components/welcome-guide/image.js.map +1 -0
- package/build/components/welcome-guide/index.js +49 -0
- package/build/components/welcome-guide/index.js.map +1 -0
- package/build/components/welcome-guide/styles.js +83 -0
- package/build/components/welcome-guide/styles.js.map +1 -0
- package/build/index.js +40 -16
- package/build/index.js.map +1 -1
- package/build/plugins/index.js +4 -2
- package/build/plugins/index.js.map +1 -1
- package/build/plugins/welcome-guide-menu-item.js +39 -0
- package/build/plugins/welcome-guide-menu-item.js.map +1 -0
- package/build/store/actions.js +24 -24
- package/build/store/actions.js.map +1 -1
- package/build/store/constants.js +1 -1
- package/build/store/defaults.js +4 -1
- package/build/store/defaults.js.map +1 -1
- package/build/store/index.js +5 -3
- package/build/store/index.js.map +1 -1
- package/build/store/reducer.js +36 -14
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +27 -19
- package/build/store/selectors.js.map +1 -1
- package/build/utils/is-template-removable.js +21 -0
- package/build/utils/is-template-removable.js.map +1 -0
- package/build-module/components/add-new-template/index.js +36 -0
- package/build-module/components/add-new-template/index.js.map +1 -0
- package/build-module/components/add-new-template/new-template-part.js +66 -0
- package/build-module/components/add-new-template/new-template-part.js.map +1 -0
- package/build-module/components/add-new-template/new-template.js +98 -0
- package/build-module/components/add-new-template/new-template.js.map +1 -0
- package/build-module/components/block-editor/block-inspector-button.js +4 -3
- package/build-module/components/block-editor/block-inspector-button.js.map +1 -1
- package/build-module/components/block-editor/index.js +12 -8
- package/build-module/components/block-editor/index.js.map +1 -1
- package/build-module/components/block-editor/resizable-editor.js +6 -5
- package/build-module/components/block-editor/resizable-editor.js.map +1 -1
- package/build-module/components/block-editor/resize-handle.js +6 -4
- package/build-module/components/block-editor/resize-handle.js.map +1 -1
- package/build-module/components/create-template-part-modal/index.js +102 -0
- package/build-module/components/create-template-part-modal/index.js.map +1 -0
- package/build-module/components/edit-template-part-menu-button/index.js +15 -11
- package/build-module/components/edit-template-part-menu-button/index.js.map +1 -1
- package/build-module/components/editor/index.js +14 -17
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/error-boundary/index.js +5 -4
- package/build-module/components/error-boundary/index.js.map +1 -1
- package/build-module/components/global-styles/border-panel.js +4 -3
- package/build-module/components/global-styles/border-panel.js.map +1 -1
- package/build-module/components/global-styles/color-palette-panel.js +4 -3
- package/build-module/components/global-styles/color-palette-panel.js.map +1 -1
- package/build-module/components/global-styles/context-menu.js +5 -4
- package/build-module/components/global-styles/context-menu.js.map +1 -1
- package/build-module/components/global-styles/dimensions-panel.js +4 -3
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
- package/build-module/components/global-styles/global-styles-provider.js +16 -13
- package/build-module/components/global-styles/global-styles-provider.js.map +1 -1
- package/build-module/components/global-styles/header.js +6 -5
- package/build-module/components/global-styles/header.js.map +1 -1
- package/build-module/components/global-styles/hooks.js +32 -28
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/navigation-button.js +8 -7
- package/build-module/components/global-styles/navigation-button.js.map +1 -1
- package/build-module/components/global-styles/palette.js +13 -9
- package/build-module/components/global-styles/palette.js.map +1 -1
- package/build-module/components/global-styles/screen-background-color.js +4 -3
- package/build-module/components/global-styles/screen-background-color.js.map +1 -1
- package/build-module/components/global-styles/screen-block-list.js +11 -4
- package/build-module/components/global-styles/screen-block-list.js.map +1 -1
- package/build-module/components/global-styles/screen-block.js +4 -3
- package/build-module/components/global-styles/screen-block.js.map +1 -1
- package/build-module/components/global-styles/screen-color-palette.js +4 -3
- package/build-module/components/global-styles/screen-color-palette.js.map +1 -1
- package/build-module/components/global-styles/screen-colors.js +19 -15
- package/build-module/components/global-styles/screen-colors.js.map +1 -1
- package/build-module/components/global-styles/screen-layout.js +4 -3
- package/build-module/components/global-styles/screen-layout.js.map +1 -1
- package/build-module/components/global-styles/screen-link-color.js +4 -3
- package/build-module/components/global-styles/screen-link-color.js.map +1 -1
- package/build-module/components/global-styles/screen-text-color.js +4 -3
- package/build-module/components/global-styles/screen-text-color.js.map +1 -1
- package/build-module/components/global-styles/screen-typography.js +4 -3
- package/build-module/components/global-styles/screen-typography.js.map +1 -1
- package/build-module/components/global-styles/subtitle.js +4 -3
- package/build-module/components/global-styles/subtitle.js.map +1 -1
- package/build-module/components/global-styles/typography-panel.js +9 -7
- package/build-module/components/global-styles/typography-panel.js.map +1 -1
- package/build-module/components/global-styles/ui.js +4 -3
- package/build-module/components/global-styles/ui.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +60 -43
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/global-styles/utils.js +3 -2
- package/build-module/components/global-styles/utils.js.map +1 -1
- package/build-module/components/header/document-actions/index.js +23 -19
- package/build-module/components/header/document-actions/index.js.map +1 -1
- package/build-module/components/header/feature-toggle/index.js +9 -7
- package/build-module/components/header/feature-toggle/index.js.map +1 -1
- package/build-module/components/header/index.js +15 -12
- package/build-module/components/header/index.js.map +1 -1
- package/build-module/components/header/more-menu/index.js +30 -27
- package/build-module/components/header/more-menu/index.js.map +1 -1
- package/build-module/components/header/tools-more-menu-group/index.js +10 -7
- package/build-module/components/header/tools-more-menu-group/index.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/index.js +4 -3
- package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
- package/build-module/components/list/header.js +37 -0
- package/build-module/components/list/header.js.map +1 -0
- package/build-module/components/list/index.js +40 -0
- package/build-module/components/list/index.js.map +1 -0
- package/build-module/components/list/table.js +112 -0
- package/build-module/components/list/table.js.map +1 -0
- package/build-module/components/main-dashboard-button/index.js +4 -3
- package/build-module/components/main-dashboard-button/index.js.map +1 -1
- package/build-module/components/navigate-to-link/index.js +7 -6
- package/build-module/components/navigate-to-link/index.js.map +1 -1
- package/build-module/components/navigation-sidebar/index.js +12 -8
- package/build-module/components/navigation-sidebar/index.js.map +1 -1
- package/build-module/components/navigation-sidebar/navigation-panel/content-navigation-item.js +4 -3
- package/build-module/components/navigation-sidebar/navigation-panel/content-navigation-item.js.map +1 -1
- package/build-module/components/navigation-sidebar/navigation-panel/index.js +38 -55
- package/build-module/components/navigation-sidebar/navigation-panel/index.js.map +1 -1
- package/build-module/components/navigation-sidebar/navigation-panel/menus/template-parts-sub.js +6 -5
- package/build-module/components/navigation-sidebar/navigation-panel/menus/template-parts-sub.js.map +1 -1
- package/build-module/components/navigation-sidebar/navigation-panel/menus/template-parts.js +26 -20
- package/build-module/components/navigation-sidebar/navigation-panel/menus/template-parts.js.map +1 -1
- package/build-module/components/navigation-sidebar/navigation-panel/menus/templates-sub.js +17 -10
- package/build-module/components/navigation-sidebar/navigation-panel/menus/templates-sub.js.map +1 -1
- package/build-module/components/navigation-sidebar/navigation-panel/menus/templates.js +11 -5
- package/build-module/components/navigation-sidebar/navigation-panel/menus/templates.js.map +1 -1
- package/build-module/components/navigation-sidebar/navigation-panel/navigation-entity-items.js +13 -11
- package/build-module/components/navigation-sidebar/navigation-panel/navigation-entity-items.js.map +1 -1
- package/build-module/components/navigation-sidebar/navigation-panel/new-template-dropdown.js +24 -18
- package/build-module/components/navigation-sidebar/navigation-panel/new-template-dropdown.js.map +1 -1
- package/build-module/components/navigation-sidebar/navigation-panel/search-results.js +14 -11
- package/build-module/components/navigation-sidebar/navigation-panel/search-results.js.map +1 -1
- package/build-module/components/navigation-sidebar/navigation-panel/template-hierarchy.js +6 -3
- package/build-module/components/navigation-sidebar/navigation-panel/template-hierarchy.js.map +1 -1
- package/build-module/components/navigation-sidebar/navigation-panel/template-navigation-item.js +4 -3
- package/build-module/components/navigation-sidebar/navigation-panel/template-navigation-item.js.map +1 -1
- package/build-module/components/navigation-sidebar/navigation-panel/template-preview.js +5 -4
- package/build-module/components/navigation-sidebar/navigation-panel/template-preview.js.map +1 -1
- package/build-module/components/navigation-sidebar/navigation-toggle/index.js +8 -27
- package/build-module/components/navigation-sidebar/navigation-toggle/index.js.map +1 -1
- package/build-module/components/save-button/index.js +5 -4
- package/build-module/components/save-button/index.js.map +1 -1
- package/build-module/components/sidebar/default-sidebar.js +11 -10
- package/build-module/components/sidebar/default-sidebar.js.map +1 -1
- package/build-module/components/sidebar/plugin-sidebar/index.js +5 -4
- package/build-module/components/sidebar/plugin-sidebar/index.js.map +1 -1
- package/build-module/components/sidebar/settings-header/index.js +4 -3
- package/build-module/components/sidebar/settings-header/index.js.map +1 -1
- package/build-module/components/sidebar/template-card/template-areas.js +17 -13
- package/build-module/components/sidebar/template-card/template-areas.js.map +1 -1
- package/build-module/components/template-details/index.js +14 -9
- package/build-module/components/template-details/index.js.map +1 -1
- package/build-module/components/template-details/template-areas.js +38 -29
- package/build-module/components/template-details/template-areas.js.map +1 -1
- package/build-module/components/template-part-converter/convert-to-regular.js +15 -11
- package/build-module/components/template-part-converter/convert-to-regular.js.map +1 -1
- package/build-module/components/template-part-converter/convert-to-template-part.js +29 -86
- package/build-module/components/template-part-converter/convert-to-template-part.js.map +1 -1
- package/build-module/components/welcome-guide/editor.js +45 -0
- package/build-module/components/welcome-guide/editor.js.map +1 -0
- package/build-module/components/welcome-guide/image.js +19 -0
- package/build-module/components/welcome-guide/image.js.map +1 -0
- package/build-module/components/welcome-guide/index.js +35 -0
- package/build-module/components/welcome-guide/index.js.map +1 -0
- package/build-module/components/welcome-guide/styles.js +69 -0
- package/build-module/components/welcome-guide/styles.js.map +1 -0
- package/build-module/index.js +21 -1
- package/build-module/index.js.map +1 -1
- package/build-module/plugins/index.js +3 -2
- package/build-module/plugins/index.js.map +1 -1
- package/build-module/plugins/welcome-guide-menu-item.js +27 -0
- package/build-module/plugins/welcome-guide-menu-item.js.map +1 -0
- package/build-module/store/actions.js +11 -11
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/defaults.js +4 -1
- package/build-module/store/defaults.js.map +1 -1
- package/build-module/store/reducer.js +31 -10
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +17 -10
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/is-template-removable.js +14 -0
- package/build-module/utils/is-template-removable.js.map +1 -0
- package/build-style/style-rtl.css +365 -40
- package/build-style/style.css +365 -40
- package/package.json +27 -27
- package/src/components/add-new-template/index.js +30 -0
- package/src/components/add-new-template/new-template-part.js +67 -0
- package/src/components/add-new-template/new-template.js +117 -0
- package/src/components/add-new-template/style.scss +11 -0
- package/src/components/create-template-part-modal/index.js +132 -0
- package/src/components/{template-part-converter → create-template-part-modal}/style.scss +9 -9
- package/src/components/editor/index.js +10 -14
- package/src/components/editor/style.scss +8 -0
- package/src/components/global-styles/global-styles-provider.js +4 -3
- package/src/components/global-styles/hooks.js +58 -26
- package/src/components/global-styles/screen-block-list.js +11 -1
- package/src/components/global-styles/test/use-global-styles-output.js +2 -2
- package/src/components/global-styles/use-global-styles-output.js +2 -2
- package/src/components/global-styles/utils.js +1 -1
- package/src/components/header/index.js +0 -3
- package/src/components/list/header.js +34 -0
- package/src/components/list/index.js +38 -0
- package/src/components/list/style.scss +113 -0
- package/src/components/list/table.js +133 -0
- package/src/components/navigation-sidebar/index.js +15 -8
- package/src/components/navigation-sidebar/navigation-panel/index.js +44 -55
- package/src/components/navigation-sidebar/navigation-panel/style.scss +4 -2
- package/src/components/navigation-sidebar/navigation-toggle/index.js +4 -28
- package/src/components/template-details/index.js +3 -2
- package/src/components/template-part-converter/convert-to-template-part.js +20 -140
- package/src/components/welcome-guide/editor.js +63 -0
- package/src/components/welcome-guide/image.js +11 -0
- package/src/components/welcome-guide/index.js +33 -0
- package/src/components/welcome-guide/style.scss +37 -0
- package/src/components/welcome-guide/styles.js +116 -0
- package/src/index.js +21 -1
- package/src/plugins/index.js +3 -1
- package/src/plugins/welcome-guide-menu-item.js +35 -0
- package/src/store/actions.js +11 -9
- package/src/store/defaults.js +4 -1
- package/src/store/test/actions.js +14 -20
- package/src/style.scss +11 -7
- package/src/utils/is-template-removable.js +13 -0
- package/build/components/header/navigation-link/index.js +0 -86
- package/build/components/header/navigation-link/index.js.map +0 -1
- package/build-module/components/header/navigation-link/index.js +0 -73
- package/build-module/components/header/navigation-link/index.js.map +0 -1
- package/src/components/header/navigation-link/index.js +0 -71
- package/src/components/header/navigation-link/style.scss +0 -69
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
4
|
|
|
5
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
|
|
6
|
-
|
|
7
5
|
Object.defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
@@ -19,6 +17,10 @@ var _dimensionsPanel = _interopRequireWildcard(require("./dimensions-panel"));
|
|
|
19
17
|
|
|
20
18
|
var _header = _interopRequireDefault(require("./header"));
|
|
21
19
|
|
|
20
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
21
|
+
|
|
22
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
23
|
+
|
|
22
24
|
/**
|
|
23
25
|
* WordPress dependencies
|
|
24
26
|
*/
|
|
@@ -26,9 +28,10 @@ var _header = _interopRequireDefault(require("./header"));
|
|
|
26
28
|
/**
|
|
27
29
|
* Internal dependencies
|
|
28
30
|
*/
|
|
29
|
-
function ScreenLayout({
|
|
30
|
-
|
|
31
|
-
|
|
31
|
+
function ScreenLayout(_ref) {
|
|
32
|
+
let {
|
|
33
|
+
name
|
|
34
|
+
} = _ref;
|
|
32
35
|
const parentMenu = name === undefined ? '' : '/blocks/' + name;
|
|
33
36
|
const hasBorderPanel = (0, _borderPanel.useHasBorderPanel)(name);
|
|
34
37
|
const hasDimensionsPanel = (0, _dimensionsPanel.useHasDimensionsPanel)(name);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-layout.js"],"names":["ScreenLayout","name","parentMenu","undefined","hasBorderPanel","hasDimensionsPanel"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-layout.js"],"names":["ScreenLayout","name","parentMenu","undefined","hasBorderPanel","hasDimensionsPanel"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;;;;;AAVA;AACA;AACA;;AAGA;AACA;AACA;AAKA,SAASA,YAAT,OAAkC;AAAA,MAAX;AAAEC,IAAAA;AAAF,GAAW;AACjC,QAAMC,UAAU,GAAGD,IAAI,KAAKE,SAAT,GAAqB,EAArB,GAA0B,aAAaF,IAA1D;AACA,QAAMG,cAAc,GAAG,oCAAmBH,IAAnB,CAAvB;AACA,QAAMI,kBAAkB,GAAG,4CAAuBJ,IAAvB,CAA3B;AAEA,SACC,qDACC,4BAAC,eAAD;AACC,IAAA,IAAI,EAAGC,UAAU,GAAGA,UAAH,GAAgB,GADlC;AAEC,IAAA,KAAK,EAAG,cAAI,QAAJ;AAFT,IADD,EAKGG,kBAAkB,IAAI,4BAAC,wBAAD;AAAiB,IAAA,IAAI,EAAGJ;AAAxB,IALzB,EAMGG,cAAc,IAAI,4BAAC,oBAAD;AAAa,IAAA,IAAI,EAAGH;AAApB,IANrB,CADD;AAUA;;eAEcD,Y","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport BorderPanel, { useHasBorderPanel } from './border-panel';\nimport DimensionsPanel, { useHasDimensionsPanel } from './dimensions-panel';\nimport ScreenHeader from './header';\n\nfunction ScreenLayout( { name } ) {\n\tconst parentMenu = name === undefined ? '' : '/blocks/' + name;\n\tconst hasBorderPanel = useHasBorderPanel( name );\n\tconst hasDimensionsPanel = useHasDimensionsPanel( name );\n\n\treturn (\n\t\t<>\n\t\t\t<ScreenHeader\n\t\t\t\tback={ parentMenu ? parentMenu : '/' }\n\t\t\t\ttitle={ __( 'Layout' ) }\n\t\t\t/>\n\t\t\t{ hasDimensionsPanel && <DimensionsPanel name={ name } /> }\n\t\t\t{ hasBorderPanel && <BorderPanel name={ name } /> }\n\t\t</>\n\t);\n}\n\nexport default ScreenLayout;\n"]}
|
|
@@ -24,9 +24,10 @@ var _hooks = require("./hooks");
|
|
|
24
24
|
/**
|
|
25
25
|
* Internal dependencies
|
|
26
26
|
*/
|
|
27
|
-
function ScreenLinkColor({
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
function ScreenLinkColor(_ref) {
|
|
28
|
+
let {
|
|
29
|
+
name
|
|
30
|
+
} = _ref;
|
|
30
31
|
const parentMenu = name === undefined ? '' : '/blocks/' + name;
|
|
31
32
|
const supports = (0, _hooks.getSupportedGlobalStylesPanels)(name);
|
|
32
33
|
const [solids] = (0, _hooks.useSetting)('color.palette', name);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-link-color.js"],"names":["ScreenLinkColor","name","parentMenu","undefined","supports","solids","areCustomSolidsEnabled","colorsPerOrigin","isLinkEnabled","hasLinkColor","includes","length","linkColor","setLinkColor","userLinkColor","settings","colorValue","onColorChange","label","clearable"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AAKA;;AACA;;AAVA;AACA;AACA;;AAIA;AACA;AACA;AASA,SAASA,eAAT,
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-link-color.js"],"names":["ScreenLinkColor","name","parentMenu","undefined","supports","solids","areCustomSolidsEnabled","colorsPerOrigin","isLinkEnabled","hasLinkColor","includes","length","linkColor","setLinkColor","userLinkColor","settings","colorValue","onColorChange","label","clearable"],"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,2CAAgCH,IAAhC,CAAjB;AACA,QAAM,CAAEI,MAAF,IAAa,uBAAY,eAAZ,EAA6BJ,IAA7B,CAAnB;AACA,QAAM,CAAEK,sBAAF,IAA6B,uBAAY,cAAZ,EAA4BL,IAA5B,CAAnC;AAEA,QAAMM,eAAe,GAAG,+BAAoBN,IAApB,CAAxB;AAEA,QAAM,CAAEO,aAAF,IAAoB,uBAAY,YAAZ,EAA0BP,IAA1B,CAA1B;AAEA,QAAMQ,YAAY,GACjBL,QAAQ,CAACM,QAAT,CAAmB,WAAnB,KACAF,aADA,KAEEH,MAAM,CAACM,MAAP,GAAgB,CAAhB,IAAqBL,sBAFvB,CADD;AAKA,QAAM,CAAEM,SAAF,EAAaC,YAAb,IAA8B,qBACnC,0BADmC,EAEnCZ,IAFmC,CAApC;AAIA,QAAM,CAAEa,aAAF,IAAoB,qBACzB,0BADyB,EAEzBb,IAFyB,EAGzB,MAHyB,CAA1B;;AAMA,MAAK,CAAEQ,YAAP,EAAsB;AACrB,WAAO,IAAP;AACA;;AAED,QAAMM,QAAQ,GAAG,CAChB;AACCC,IAAAA,UAAU,EAAEJ,SADb;AAECK,IAAAA,aAAa,EAAEJ,YAFhB;AAGCK,IAAAA,KAAK,EAAE,cAAI,YAAJ,CAHR;AAICC,IAAAA,SAAS,EAAEP,SAAS,KAAKE;AAJ1B,GADgB,CAAjB;AASA,SACC,qDACC,4BAAC,eAAD;AACC,IAAA,IAAI,EAAGZ,UAAU,GAAG,SADrB;AAEC,IAAA,KAAK,EAAG,cAAI,OAAJ,CAFT;AAGC,IAAA,WAAW,EAAG,cACb,uDADa;AAHf,IADD,EASC,4BAAC,qDAAD;AACC,IAAA,KAAK,EAAG,cAAI,OAAJ,CADT;AAEC,IAAA,QAAQ,EAAGa,QAFZ;AAGC,IAAA,MAAM,EAAGR,eAHV;AAIC,IAAA,mBAAmB,EAAG,CAAED,sBAJzB;AAKC,IAAA,gCAAgC,MALjC;AAMC,IAAA,SAAS,EAAG;AANb,IATD,CADD;AAoBA;;eAEcN,e","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { __experimentalPanelColorGradientSettings as PanelColorGradientSettings } 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 ScreenLinkColor( { 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\n\tconst colorsPerOrigin = useColorsPerOrigin( name );\n\n\tconst [ isLinkEnabled ] = useSetting( 'color.link', name );\n\n\tconst hasLinkColor =\n\t\tsupports.includes( 'linkColor' ) &&\n\t\tisLinkEnabled &&\n\t\t( solids.length > 0 || areCustomSolidsEnabled );\n\n\tconst [ linkColor, setLinkColor ] = useStyle(\n\t\t'elements.link.color.text',\n\t\tname\n\t);\n\tconst [ userLinkColor ] = useStyle(\n\t\t'elements.link.color.text',\n\t\tname,\n\t\t'user'\n\t);\n\n\tif ( ! hasLinkColor ) {\n\t\treturn null;\n\t}\n\n\tconst settings = [\n\t\t{\n\t\t\tcolorValue: linkColor,\n\t\t\tonColorChange: setLinkColor,\n\t\t\tlabel: __( 'Link color' ),\n\t\t\tclearable: linkColor === userLinkColor,\n\t\t},\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={ __( 'Links' ) }\n\t\t\t\tdescription={ __(\n\t\t\t\t\t'Set the default color used for links across the site.'\n\t\t\t\t) }\n\t\t\t/>\n\n\t\t\t<PanelColorGradientSettings\n\t\t\t\ttitle={ __( 'Color' ) }\n\t\t\t\tsettings={ settings }\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/>\n\t\t</>\n\t);\n}\n\nexport default ScreenLinkColor;\n"]}
|
|
@@ -24,9 +24,10 @@ var _hooks = require("./hooks");
|
|
|
24
24
|
/**
|
|
25
25
|
* Internal dependencies
|
|
26
26
|
*/
|
|
27
|
-
function ScreenTextColor({
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
function ScreenTextColor(_ref) {
|
|
28
|
+
let {
|
|
29
|
+
name
|
|
30
|
+
} = _ref;
|
|
30
31
|
const parentMenu = name === undefined ? '' : '/blocks/' + name;
|
|
31
32
|
const supports = (0, _hooks.getSupportedGlobalStylesPanels)(name);
|
|
32
33
|
const [solids] = (0, _hooks.useSetting)('color.palette', name);
|
|
@@ -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","settings","colorValue","onColorChange","label","clearable"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AAKA;;AACA;;AAVA;AACA;AACA;;AAIA;AACA;AACA;AASA,SAASA,eAAT,
|
|
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","settings","colorValue","onColorChange","label","clearable"],"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,2CAAgCH,IAAhC,CAAjB;AACA,QAAM,CAAEI,MAAF,IAAa,uBAAY,eAAZ,EAA6BJ,IAA7B,CAAnB;AACA,QAAM,CAAEK,sBAAF,IAA6B,uBAAY,cAAZ,EAA4BL,IAA5B,CAAnC;AACA,QAAM,CAAEM,aAAF,IAAoB,uBAAY,YAAZ,EAA0BN,IAA1B,CAA1B;AAEA,QAAMO,eAAe,GAAG,+BAAoBP,IAApB,CAAxB;AAEA,QAAMQ,YAAY,GACjBL,QAAQ,CAACM,QAAT,CAAmB,OAAnB,KACAH,aADA,KAEEF,MAAM,CAACM,MAAP,GAAgB,CAAhB,IAAqBL,sBAFvB,CADD;AAKA,QAAM,CAAEM,KAAF,EAASC,QAAT,IAAsB,qBAAU,YAAV,EAAwBZ,IAAxB,CAA5B;AACA,QAAM,CAAEa,SAAF,IAAgB,qBAAU,YAAV,EAAwBb,IAAxB,EAA8B,MAA9B,CAAtB;;AAEA,MAAK,CAAEQ,YAAP,EAAsB;AACrB,WAAO,IAAP;AACA;;AAED,QAAMM,QAAQ,GAAG,CAChB;AACCC,IAAAA,UAAU,EAAEJ,KADb;AAECK,IAAAA,aAAa,EAAEJ,QAFhB;AAGCK,IAAAA,KAAK,EAAE,cAAI,YAAJ,CAHR;AAICC,IAAAA,SAAS,EAAEP,KAAK,KAAKE;AAJtB,GADgB,CAAjB;AASA,SACC,qDACC,4BAAC,eAAD;AACC,IAAA,IAAI,EAAGZ,UAAU,GAAG,SADrB;AAEC,IAAA,KAAK,EAAG,cAAI,MAAJ,CAFT;AAGC,IAAA,WAAW,EAAG,cACb,sDADa;AAHf,IADD,EASC,4BAAC,qDAAD;AACC,IAAA,KAAK,EAAG,cAAI,OAAJ,CADT;AAEC,IAAA,QAAQ,EAAGa,QAFZ;AAGC,IAAA,MAAM,EAAGP,eAHV;AAIC,IAAA,mBAAmB,EAAG,CAAEF,sBAJzB;AAKC,IAAA,gCAAgC,MALjC;AAMC,IAAA,SAAS,EAAG;AANb,IATD,CADD;AAoBA;;eAEcN,e","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { __experimentalPanelColorGradientSettings as PanelColorGradientSettings } 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\tconst settings = [\n\t\t{\n\t\t\tcolorValue: color,\n\t\t\tonColorChange: setColor,\n\t\t\tlabel: __( 'Text color' ),\n\t\t\tclearable: color === userColor,\n\t\t},\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\n\t\t\t<PanelColorGradientSettings\n\t\t\t\ttitle={ __( 'Color' ) }\n\t\t\t\tsettings={ settings }\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/>\n\t\t</>\n\t);\n}\n\nexport default ScreenTextColor;\n"]}
|
|
@@ -22,9 +22,10 @@ var _header = _interopRequireDefault(require("./header"));
|
|
|
22
22
|
/**
|
|
23
23
|
* Internal dependencies
|
|
24
24
|
*/
|
|
25
|
-
function ScreenTypography({
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
function ScreenTypography(_ref) {
|
|
26
|
+
let {
|
|
27
|
+
name
|
|
28
|
+
} = _ref;
|
|
28
29
|
const parentMenu = name === undefined ? '' : '/blocks/' + name;
|
|
29
30
|
return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_header.default, {
|
|
30
31
|
back: parentMenu ? parentMenu : '/',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-typography.js"],"names":["ScreenTypography","name","parentMenu","undefined"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;AACA;;AATA;AACA;AACA;;AAGA;AACA;AACA;AAIA,SAASA,gBAAT,
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-typography.js"],"names":["ScreenTypography","name","parentMenu","undefined"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;AACA;;AATA;AACA;AACA;;AAGA;AACA;AACA;AAIA,SAASA,gBAAT,OAAsC;AAAA,MAAX;AAAEC,IAAAA;AAAF,GAAW;AACrC,QAAMC,UAAU,GAAGD,IAAI,KAAKE,SAAT,GAAqB,EAArB,GAA0B,aAAaF,IAA1D;AAEA,SACC,qDACC,4BAAC,eAAD;AACC,IAAA,IAAI,EAAGC,UAAU,GAAGA,UAAH,GAAgB,GADlC;AAEC,IAAA,KAAK,EAAG,cAAI,YAAJ,CAFT;AAGC,IAAA,WAAW,EAAG,cACb,2FADa;AAHf,IADD,EAQC,4BAAC,wBAAD;AAAiB,IAAA,IAAI,EAAGD;AAAxB,IARD,CADD;AAYA;;eAEcD,gB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport TypographyPanel from './typography-panel';\nimport ScreenHeader from './header';\n\nfunction ScreenTypography( { name } ) {\n\tconst parentMenu = name === undefined ? '' : '/blocks/' + name;\n\n\treturn (\n\t\t<>\n\t\t\t<ScreenHeader\n\t\t\t\tback={ parentMenu ? parentMenu : '/' }\n\t\t\t\ttitle={ __( 'Typography' ) }\n\t\t\t\tdescription={ __(\n\t\t\t\t\t'Manage the fonts used on the website and the default aspect of different global elements.'\n\t\t\t\t) }\n\t\t\t/>\n\t\t\t<TypographyPanel name={ name } />\n\t\t</>\n\t);\n}\n\nexport default ScreenTypography;\n"]}
|
|
@@ -12,9 +12,10 @@ var _components = require("@wordpress/components");
|
|
|
12
12
|
/**
|
|
13
13
|
* WordPress dependencies
|
|
14
14
|
*/
|
|
15
|
-
function Subtitle({
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
function Subtitle(_ref) {
|
|
16
|
+
let {
|
|
17
|
+
children
|
|
18
|
+
} = _ref;
|
|
18
19
|
return (0, _element.createElement)(_components.__experimentalHeading, {
|
|
19
20
|
className: "edit-site-global-styles-subtitle",
|
|
20
21
|
level: 2
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/subtitle.js"],"names":["Subtitle","children"],"mappings":";;;;;;;;;AAGA;;AAHA;AACA;AACA;AAGA,SAASA,QAAT,
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/subtitle.js"],"names":["Subtitle","children"],"mappings":";;;;;;;;;AAGA;;AAHA;AACA;AACA;AAGA,SAASA,QAAT,OAAkC;AAAA,MAAf;AAAEC,IAAAA;AAAF,GAAe;AACjC,SACC,4BAAC,iCAAD;AAAS,IAAA,SAAS,EAAC,kCAAnB;AAAsD,IAAA,KAAK,EAAG;AAA9D,KACGA,QADH,CADD;AAKA;;eAEcD,Q","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __experimentalHeading as Heading } from '@wordpress/components';\n\nfunction Subtitle( { children } ) {\n\treturn (\n\t\t<Heading className=\"edit-site-global-styles-subtitle\" level={ 2 }>\n\t\t\t{ children }\n\t\t</Heading>\n\t);\n}\n\nexport default Subtitle;\n"]}
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.useHasTypographyPanel = useHasTypographyPanel;
|
|
7
6
|
exports.default = TypographyPanel;
|
|
7
|
+
exports.useHasTypographyPanel = useHasTypographyPanel;
|
|
8
8
|
|
|
9
9
|
var _element = require("@wordpress/element");
|
|
10
10
|
|
|
@@ -46,9 +46,10 @@ function useHasLetterSpacingControl(name) {
|
|
|
46
46
|
return (0, _hooks.useSetting)('typography.letterSpacing', name)[0] && supports.includes('letterSpacing');
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
function TypographyPanel({
|
|
50
|
-
|
|
51
|
-
|
|
49
|
+
function TypographyPanel(_ref) {
|
|
50
|
+
let {
|
|
51
|
+
name
|
|
52
|
+
} = _ref;
|
|
52
53
|
const supports = (0, _hooks.getSupportedGlobalStylesPanels)(name);
|
|
53
54
|
const [fontSizes] = (0, _hooks.useSetting)('typography.fontSizes', name);
|
|
54
55
|
const disableCustomFontSizes = !(0, _hooks.useSetting)('typography.customFontSize', name)[0];
|
|
@@ -84,10 +85,11 @@ function TypographyPanel({
|
|
|
84
85
|
fontStyle,
|
|
85
86
|
fontWeight
|
|
86
87
|
},
|
|
87
|
-
onChange:
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
88
|
+
onChange: _ref2 => {
|
|
89
|
+
let {
|
|
90
|
+
fontStyle: newFontStyle,
|
|
91
|
+
fontWeight: newFontWeight
|
|
92
|
+
} = _ref2;
|
|
91
93
|
setFontStyle(newFontStyle);
|
|
92
94
|
setFontWeight(newFontWeight);
|
|
93
95
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/typography-panel.js"],"names":["useHasTypographyPanel","name","hasLineHeight","useHasLineHeightControl","hasFontAppearance","useHasAppearanceControl","hasLetterSpacing","useHasLetterSpacingControl","supports","includes","hasFontStyles","hasFontWeights","TypographyPanel","fontSizes","disableCustomFontSizes","fontFamilies","hasLineHeightEnabled","hasAppearanceControl","hasLetterSpacingControl","fontFamily","setFontFamily","fontSize","setFontSize","fontStyle","setFontStyle","fontWeight","setFontWeight","lineHeight","setLineHeight","letterSpacing","setLetterSpacing","newFontStyle","newFontWeight"],"mappings":";;;;;;;;;;AAGA;;AAMA;;AAKA;;AAdA;AACA;AACA;;AASA;AACA;AACA;AAGO,SAASA,qBAAT,CAAgCC,IAAhC,EAAuC;AAC7C,QAAMC,aAAa,GAAGC,uBAAuB,CAAEF,IAAF,CAA7C;AACA,QAAMG,iBAAiB,GAAGC,uBAAuB,CAAEJ,IAAF,CAAjD;AACA,QAAMK,gBAAgB,GAAGC,0BAA0B,CAAEN,IAAF,CAAnD;AACA,QAAMO,QAAQ,GAAG,2CAAgCP,IAAhC,CAAjB;AACA,SACCC,aAAa,IACbE,iBADA,IAEAE,gBAFA,IAGAE,QAAQ,CAACC,QAAT,CAAmB,UAAnB,CAJD;AAMA;;AAED,SAASN,uBAAT,CAAkCF,IAAlC,EAAyC;AACxC,QAAMO,QAAQ,GAAG,2CAAgCP,IAAhC,CAAjB;AACA,SACC,uBAAY,uBAAZ,EAAqCA,IAArC,EAA6C,CAA7C,KACAO,QAAQ,CAACC,QAAT,CAAmB,YAAnB,CAFD;AAIA;;AAED,SAASJ,uBAAT,CAAkCJ,IAAlC,EAAyC;AACxC,QAAMO,QAAQ,GAAG,2CAAgCP,IAAhC,CAAjB;AACA,QAAMS,aAAa,GAClB,uBAAY,sBAAZ,EAAoCT,IAApC,EAA4C,CAA5C,KACAO,QAAQ,CAACC,QAAT,CAAmB,WAAnB,CAFD;AAGA,QAAME,cAAc,GACnB,uBAAY,uBAAZ,EAAqCV,IAArC,EAA6C,CAA7C,KACAO,QAAQ,CAACC,QAAT,CAAmB,YAAnB,CAFD;AAGA,SAAOC,aAAa,IAAIC,cAAxB;AACA;;AAED,SAASJ,0BAAT,CAAqCN,IAArC,EAA4C;AAC3C,QAAMO,QAAQ,GAAG,2CAAgCP,IAAhC,CAAjB;AACA,SACC,uBAAY,0BAAZ,EAAwCA,IAAxC,EAAgD,CAAhD,KACAO,QAAQ,CAACC,QAAT,CAAmB,eAAnB,CAFD;AAIA;;AAEc,SAASG,eAAT,
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/typography-panel.js"],"names":["useHasTypographyPanel","name","hasLineHeight","useHasLineHeightControl","hasFontAppearance","useHasAppearanceControl","hasLetterSpacing","useHasLetterSpacingControl","supports","includes","hasFontStyles","hasFontWeights","TypographyPanel","fontSizes","disableCustomFontSizes","fontFamilies","hasLineHeightEnabled","hasAppearanceControl","hasLetterSpacingControl","fontFamily","setFontFamily","fontSize","setFontSize","fontStyle","setFontStyle","fontWeight","setFontWeight","lineHeight","setLineHeight","letterSpacing","setLetterSpacing","newFontStyle","newFontWeight"],"mappings":";;;;;;;;;;AAGA;;AAMA;;AAKA;;AAdA;AACA;AACA;;AASA;AACA;AACA;AAGO,SAASA,qBAAT,CAAgCC,IAAhC,EAAuC;AAC7C,QAAMC,aAAa,GAAGC,uBAAuB,CAAEF,IAA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B;AAEC,IAAA,KAAK,EAAGI,UAFT;AAGC,IAAA,QAAQ,EAAGC;AAHZ,IAFF,EAQGZ,QAAQ,CAACC,QAAT,CAAmB,UAAnB,KACD,4BAAC,0BAAD;AACC,IAAA,KAAK,EAAGY,QADT;AAEC,IAAA,QAAQ,EAAGC,WAFZ;AAGC,IAAA,SAAS,EAAGT,SAHb;AAIC,IAAA,sBAAsB,EAAGC;AAJ1B,IATF,EAgBGE,oBAAoB,IACrB,4BAAC,8BAAD;AACC,IAAA,KAAK,EAAGW,UADT;AAEC,IAAA,QAAQ,EAAGC;AAFZ,IAjBF,EAsBGX,oBAAoB,IACrB,4BAAC,gDAAD;AACC,IAAA,KAAK,EAAG;AACPM,MAAAA,SADO;AAEPE,MAAAA;AAFO,KADT;AAKC,IAAA,QAAQ,EAAG,SAGJ;AAAA,UAHM;AACZF,QAAAA,SAAS,EAAEQ,YADC;AAEZN,QAAAA,UAAU,EAAEO;AAFA,OAGN;AACNR,MAAAA,YAAY,CAAEO,YAAF,CAAZ;AACAL,MAAAA,aAAa,CAAEM,aAAF,CAAb;AACA,KAXF;AAYC,IAAA,aAAa,EAAGtB,aAZjB;AAaC,IAAA,cAAc,EAAGC;AAblB,IAvBF,EAuCGO,uBAAuB,IACxB,4BAAC,+CAAD;AACC,IAAA,KAAK,EAAGW,aADT;AAEC,IAAA,QAAQ,EAAGC;AAFZ,IAxCF,CADD;AAgDA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tLineHeightControl,\n\t__experimentalFontFamilyControl as FontFamilyControl,\n\t__experimentalFontAppearanceControl as FontAppearanceControl,\n\t__experimentalLetterSpacingControl as LetterSpacingControl,\n} from '@wordpress/block-editor';\nimport { PanelBody, FontSizePicker } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport { getSupportedGlobalStylesPanels, useSetting, useStyle } from './hooks';\n\nexport function useHasTypographyPanel( name ) {\n\tconst hasLineHeight = useHasLineHeightControl( name );\n\tconst hasFontAppearance = useHasAppearanceControl( name );\n\tconst hasLetterSpacing = useHasLetterSpacingControl( name );\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\treturn (\n\t\thasLineHeight ||\n\t\thasFontAppearance ||\n\t\thasLetterSpacing ||\n\t\tsupports.includes( 'fontSize' )\n\t);\n}\n\nfunction useHasLineHeightControl( name ) {\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\treturn (\n\t\tuseSetting( 'typography.lineHeight', name )[ 0 ] &&\n\t\tsupports.includes( 'lineHeight' )\n\t);\n}\n\nfunction useHasAppearanceControl( name ) {\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\tconst hasFontStyles =\n\t\tuseSetting( 'typography.fontStyle', name )[ 0 ] &&\n\t\tsupports.includes( 'fontStyle' );\n\tconst hasFontWeights =\n\t\tuseSetting( 'typography.fontWeight', name )[ 0 ] &&\n\t\tsupports.includes( 'fontWeight' );\n\treturn hasFontStyles || hasFontWeights;\n}\n\nfunction useHasLetterSpacingControl( name ) {\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\treturn (\n\t\tuseSetting( 'typography.letterSpacing', name )[ 0 ] &&\n\t\tsupports.includes( 'letterSpacing' )\n\t);\n}\n\nexport default function TypographyPanel( { name } ) {\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\tconst [ fontSizes ] = useSetting( 'typography.fontSizes', name );\n\tconst disableCustomFontSizes = ! useSetting(\n\t\t'typography.customFontSize',\n\t\tname\n\t)[ 0 ];\n\tconst [ fontFamilies ] = useSetting( 'typography.fontFamilies', name );\n\tconst hasFontStyles =\n\t\tuseSetting( 'typography.fontStyle', name )[ 0 ] &&\n\t\tsupports.includes( 'fontStyle' );\n\tconst hasFontWeights =\n\t\tuseSetting( 'typography.fontWeight', name )[ 0 ] &&\n\t\tsupports.includes( 'fontWeight' );\n\tconst hasLineHeightEnabled = useHasLineHeightControl( name );\n\tconst hasAppearanceControl = useHasAppearanceControl( name );\n\tconst hasLetterSpacingControl = useHasLetterSpacingControl( name );\n\n\tconst [ fontFamily, setFontFamily ] = useStyle(\n\t\t'typography.fontFamily',\n\t\tname\n\t);\n\tconst [ fontSize, setFontSize ] = useStyle( 'typography.fontSize', name );\n\n\tconst [ fontStyle, setFontStyle ] = useStyle(\n\t\t'typography.fontStyle',\n\t\tname\n\t);\n\tconst [ fontWeight, setFontWeight ] = useStyle(\n\t\t'typography.fontWeight',\n\t\tname\n\t);\n\tconst [ lineHeight, setLineHeight ] = useStyle(\n\t\t'typography.lineHeight',\n\t\tname\n\t);\n\tconst [ letterSpacing, setLetterSpacing ] = useStyle(\n\t\t'typography.letterSpacing',\n\t\tname\n\t);\n\n\treturn (\n\t\t<PanelBody className=\"edit-site-typography-panel\" initialOpen={ true }>\n\t\t\t{ supports.includes( 'fontFamily' ) && (\n\t\t\t\t<FontFamilyControl\n\t\t\t\t\tfontFamilies={ fontFamilies }\n\t\t\t\t\tvalue={ fontFamily }\n\t\t\t\t\tonChange={ setFontFamily }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ supports.includes( 'fontSize' ) && (\n\t\t\t\t<FontSizePicker\n\t\t\t\t\tvalue={ fontSize }\n\t\t\t\t\tonChange={ setFontSize }\n\t\t\t\t\tfontSizes={ fontSizes }\n\t\t\t\t\tdisableCustomFontSizes={ disableCustomFontSizes }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasLineHeightEnabled && (\n\t\t\t\t<LineHeightControl\n\t\t\t\t\tvalue={ lineHeight }\n\t\t\t\t\tonChange={ setLineHeight }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasAppearanceControl && (\n\t\t\t\t<FontAppearanceControl\n\t\t\t\t\tvalue={ {\n\t\t\t\t\t\tfontStyle,\n\t\t\t\t\t\tfontWeight,\n\t\t\t\t\t} }\n\t\t\t\t\tonChange={ ( {\n\t\t\t\t\t\tfontStyle: newFontStyle,\n\t\t\t\t\t\tfontWeight: newFontWeight,\n\t\t\t\t\t} ) => {\n\t\t\t\t\t\tsetFontStyle( newFontStyle );\n\t\t\t\t\t\tsetFontWeight( newFontWeight );\n\t\t\t\t\t} }\n\t\t\t\t\thasFontStyles={ hasFontStyles }\n\t\t\t\t\thasFontWeights={ hasFontWeights }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasLetterSpacingControl && (\n\t\t\t\t<LetterSpacingControl\n\t\t\t\t\tvalue={ letterSpacing }\n\t\t\t\t\tonChange={ setLetterSpacing }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</PanelBody>\n\t);\n}\n"]}
|
|
@@ -40,9 +40,10 @@ var _screenLayout = _interopRequireDefault(require("./screen-layout"));
|
|
|
40
40
|
/**
|
|
41
41
|
* Internal dependencies
|
|
42
42
|
*/
|
|
43
|
-
function ContextScreens({
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
function ContextScreens(_ref) {
|
|
44
|
+
let {
|
|
45
|
+
name
|
|
46
|
+
} = _ref;
|
|
46
47
|
const parentMenu = name === undefined ? '' : '/blocks/' + name;
|
|
47
48
|
return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_components.__experimentalNavigatorScreen, {
|
|
48
49
|
path: parentMenu + '/typography'
|
|
@@ -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":";;;;;;;;;;;AAGA;;AAIA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AArBA;AACA;AACA;;AAOA;AACA;AACA;AAYA,SAASA,cAAT,
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/ui.js"],"names":["ContextScreens","name","parentMenu","undefined","GlobalStylesUI","blocks","map","block"],"mappings":";;;;;;;;;;;AAGA;;AAIA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AArBA;AACA;AACA;;AAOA;AACA;AACA;AAYA,SAASA,c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BAAD,OADD,CADD,EAKC,4BAAC,yCAAD;AAAiB,IAAA,IAAI,EAAC;AAAtB,KACC,4BAAC,wBAAD,OADD,CALD,EASGA,MAAM,CAACC,GAAP,CAAcC,KAAF,IACb,4BAAC,yCAAD;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,CATH,EAkBC,4BAAC,cAAD,OAlBD,EAoBGI,MAAM,CAACC,GAAP,CAAcC,KAAF,IACb,4BAAC,cAAD;AACC,IAAA,GAAG,EAAG,mBAAmBA,KAAK,CAACN,IADhC;AAEC,IAAA,IAAI,EAAGM,KAAK,CAACN;AAFd,IADC,CApBH,CADD;AA6BA;;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 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 ContextScreens( { name } ) {\n\tconst parentMenu = name === undefined ? '' : '/blocks/' + name;\n\n\treturn (\n\t\t<>\n\t\t\t<NavigatorScreen path={ parentMenu + '/typography' }>\n\t\t\t\t<ScreenTypography name={ name } />\n\t\t\t</NavigatorScreen>\n\n\t\t\t<NavigatorScreen path={ parentMenu + '/colors' }>\n\t\t\t\t<ScreenColors name={ name } />\n\t\t\t</NavigatorScreen>\n\n\t\t\t<NavigatorScreen path={ parentMenu + '/colors/palette' }>\n\t\t\t\t<ScreenColorPalette name={ name } />\n\t\t\t</NavigatorScreen>\n\n\t\t\t<NavigatorScreen path={ parentMenu + '/colors/background' }>\n\t\t\t\t<ScreenBackgroundColor name={ name } />\n\t\t\t</NavigatorScreen>\n\n\t\t\t<NavigatorScreen path={ parentMenu + '/colors/text' }>\n\t\t\t\t<ScreenTextColor name={ name } />\n\t\t\t</NavigatorScreen>\n\n\t\t\t<NavigatorScreen path={ parentMenu + '/colors/link' }>\n\t\t\t\t<ScreenLinkColor name={ name } />\n\t\t\t</NavigatorScreen>\n\n\t\t\t<NavigatorScreen path={ parentMenu + '/layout' }>\n\t\t\t\t<ScreenLayout name={ name } />\n\t\t\t</NavigatorScreen>\n\t\t</>\n\t);\n}\n\nfunction GlobalStylesUI() {\n\tconst blocks = getBlockTypes();\n\n\treturn (\n\t\t<NavigatorProvider initialPath=\"/\">\n\t\t\t<NavigatorScreen path=\"/\">\n\t\t\t\t<ScreenRoot />\n\t\t\t</NavigatorScreen>\n\n\t\t\t<NavigatorScreen path=\"/blocks\">\n\t\t\t\t<ScreenBlockList />\n\t\t\t</NavigatorScreen>\n\n\t\t\t{ blocks.map( ( block ) => (\n\t\t\t\t<NavigatorScreen\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</NavigatorScreen>\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"]}
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
exports.toStyles = exports.toCustomProperties = exports.getNodesWithStyles = exports.getNodesWithSettings = void 0;
|
|
6
7
|
exports.useGlobalStylesOutput = useGlobalStylesOutput;
|
|
7
|
-
exports.toStyles = exports.toCustomProperties = exports.getNodesWithSettings = exports.getNodesWithStyles = void 0;
|
|
8
8
|
|
|
9
9
|
var _lodash = require("lodash");
|
|
10
10
|
|
|
@@ -52,14 +52,16 @@ function compileStyleValue(uncompiledValue) {
|
|
|
52
52
|
*/
|
|
53
53
|
|
|
54
54
|
|
|
55
|
-
function getPresetsDeclarations(
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
55
|
+
function getPresetsDeclarations() {
|
|
56
|
+
let blockPresets = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
57
|
+
return (0, _lodash.reduce)(_utils.PRESET_METADATA, (declarations, _ref) => {
|
|
58
|
+
let {
|
|
59
|
+
path,
|
|
60
|
+
valueKey,
|
|
61
|
+
cssVarInfix
|
|
62
|
+
} = _ref;
|
|
61
63
|
const presetByOrigin = (0, _lodash.get)(blockPresets, path, []);
|
|
62
|
-
['
|
|
64
|
+
['default', 'theme', 'user'].forEach(origin => {
|
|
63
65
|
if (presetByOrigin[origin]) {
|
|
64
66
|
presetByOrigin[origin].forEach(value => {
|
|
65
67
|
declarations.push(`--wp--preset--${cssVarInfix}--${(0, _lodash.kebabCase)(value.slug)}: ${value[valueKey]}`);
|
|
@@ -78,26 +80,31 @@ function getPresetsDeclarations(blockPresets = {}) {
|
|
|
78
80
|
*/
|
|
79
81
|
|
|
80
82
|
|
|
81
|
-
function getPresetsClasses(blockSelector
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
83
|
+
function getPresetsClasses(blockSelector) {
|
|
84
|
+
let blockPresets = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
85
|
+
return (0, _lodash.reduce)(_utils.PRESET_METADATA, (declarations, _ref2) => {
|
|
86
|
+
let {
|
|
87
|
+
path,
|
|
88
|
+
cssVarInfix,
|
|
89
|
+
classes
|
|
90
|
+
} = _ref2;
|
|
91
|
+
|
|
87
92
|
if (!classes) {
|
|
88
93
|
return declarations;
|
|
89
94
|
}
|
|
90
95
|
|
|
91
96
|
const presetByOrigin = (0, _lodash.get)(blockPresets, path, []);
|
|
92
|
-
['
|
|
97
|
+
['default', 'theme', 'user'].forEach(origin => {
|
|
93
98
|
if (presetByOrigin[origin]) {
|
|
94
|
-
presetByOrigin[origin].forEach(
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
99
|
+
presetByOrigin[origin].forEach(_ref3 => {
|
|
100
|
+
let {
|
|
101
|
+
slug
|
|
102
|
+
} = _ref3;
|
|
103
|
+
classes.forEach(_ref4 => {
|
|
104
|
+
let {
|
|
105
|
+
classSuffix,
|
|
106
|
+
propertyName
|
|
107
|
+
} = _ref4;
|
|
101
108
|
const classSelectorToUse = `.has-${(0, _lodash.kebabCase)(slug)}-${classSuffix}`;
|
|
102
109
|
const selectorToUse = blockSelector.split(',') // Selector can be "h1, h2, h3"
|
|
103
110
|
.map(selector => `${selector}${classSelectorToUse}`).join(',');
|
|
@@ -111,7 +118,10 @@ function getPresetsClasses(blockSelector, blockPresets = {}) {
|
|
|
111
118
|
}, '');
|
|
112
119
|
}
|
|
113
120
|
|
|
114
|
-
function flattenTree(
|
|
121
|
+
function flattenTree() {
|
|
122
|
+
let input = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
123
|
+
let prefix = arguments.length > 1 ? arguments[1] : undefined;
|
|
124
|
+
let token = arguments.length > 2 ? arguments[2] : undefined;
|
|
115
125
|
let result = [];
|
|
116
126
|
Object.keys(input).forEach(key => {
|
|
117
127
|
const newKey = prefix + (0, _lodash.kebabCase)(key.replace('/', '-'));
|
|
@@ -135,11 +145,13 @@ function flattenTree(input = {}, prefix, token) {
|
|
|
135
145
|
*/
|
|
136
146
|
|
|
137
147
|
|
|
138
|
-
function getStylesDeclarations(
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
148
|
+
function getStylesDeclarations() {
|
|
149
|
+
let blockStyles = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
150
|
+
return (0, _lodash.reduce)(_blocks.__EXPERIMENTAL_STYLE_PROPERTY, (declarations, _ref5, key) => {
|
|
151
|
+
let {
|
|
152
|
+
value,
|
|
153
|
+
properties
|
|
154
|
+
} = _ref5;
|
|
143
155
|
const pathToValue = value;
|
|
144
156
|
|
|
145
157
|
if ((0, _lodash.first)(pathToValue) === 'elements') {
|
|
@@ -238,9 +250,10 @@ const getNodesWithSettings = (tree, blockSelectors) => {
|
|
|
238
250
|
const pickPresets = treeToPickFrom => {
|
|
239
251
|
const presets = {};
|
|
240
252
|
|
|
241
|
-
_utils.PRESET_METADATA.forEach(
|
|
242
|
-
|
|
243
|
-
|
|
253
|
+
_utils.PRESET_METADATA.forEach(_ref6 => {
|
|
254
|
+
let {
|
|
255
|
+
path
|
|
256
|
+
} = _ref6;
|
|
244
257
|
const value = (0, _lodash.get)(treeToPickFrom, path, false);
|
|
245
258
|
|
|
246
259
|
if (value !== false) {
|
|
@@ -284,11 +297,12 @@ exports.getNodesWithSettings = getNodesWithSettings;
|
|
|
284
297
|
const toCustomProperties = (tree, blockSelectors) => {
|
|
285
298
|
const settings = getNodesWithSettings(tree, blockSelectors);
|
|
286
299
|
let ruleset = '';
|
|
287
|
-
settings.forEach(
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
300
|
+
settings.forEach(_ref7 => {
|
|
301
|
+
let {
|
|
302
|
+
presets,
|
|
303
|
+
custom,
|
|
304
|
+
selector
|
|
305
|
+
} = _ref7;
|
|
292
306
|
const declarations = getPresetsDeclarations(presets);
|
|
293
307
|
const customProps = flattenTree(custom, '--wp--custom--', '--');
|
|
294
308
|
|
|
@@ -309,10 +323,11 @@ const toStyles = (tree, blockSelectors) => {
|
|
|
309
323
|
const nodesWithStyles = getNodesWithStyles(tree, blockSelectors);
|
|
310
324
|
const nodesWithSettings = getNodesWithSettings(tree, blockSelectors);
|
|
311
325
|
let ruleset = '.wp-site-blocks > * { margin-top: 0; margin-bottom: 0; }.wp-site-blocks > * + * { margin-top: var( --wp--style--block-gap ); }';
|
|
312
|
-
nodesWithStyles.forEach(
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
326
|
+
nodesWithStyles.forEach(_ref8 => {
|
|
327
|
+
let {
|
|
328
|
+
selector,
|
|
329
|
+
styles
|
|
330
|
+
} = _ref8;
|
|
316
331
|
const declarations = getStylesDeclarations(styles);
|
|
317
332
|
|
|
318
333
|
if (declarations.length === 0) {
|
|
@@ -321,10 +336,12 @@ const toStyles = (tree, blockSelectors) => {
|
|
|
321
336
|
|
|
322
337
|
ruleset = ruleset + `${selector}{${declarations.join(';')};}`;
|
|
323
338
|
});
|
|
324
|
-
nodesWithSettings.forEach(
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
339
|
+
nodesWithSettings.forEach(_ref9 => {
|
|
340
|
+
let {
|
|
341
|
+
selector,
|
|
342
|
+
presets
|
|
343
|
+
} = _ref9;
|
|
344
|
+
|
|
328
345
|
if (_utils.ROOT_BLOCK_SELECTOR === selector) {
|
|
329
346
|
// Do not add extra specificity for top-level classes.
|
|
330
347
|
selector = '';
|
|
@@ -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,mCAAmC,GAAG,IAA5C;;AACA,MAAK,wBAAYH,eAAZ,EAA6BC,yBAA7B,CAAL,EAAgE;AAC/D,UAAMG,QAAQ,GAAGJ,eAAe,CAC9BK,KADe,CACRJ,yBAAyB,CAACK,MADlB,EAEfC,KAFe,CAERL,uCAFQ,EAGfM,IAHe,CAGTL,mCAHS,CAAjB;AAIA,WAAQ,aAAaC,QAAU,GAA/B;AACA;;AACD,SAAOJ,eAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAASS,sBAAT,CAAiCC,YAAY,GAAG,EAAhD,EAAqD;AACpD,SAAO,oBACNC,sBADM,EAEN,CAAEC,YAAF,EAAgB;AAAEC,IAAAA,IAAF;AAAQC,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AAF,aAAEA,YAAF,eAAEA,YAAY,CAAElC,MAAhB,KAA0B,EAAEkC,YAAF,aAAEA,YAAF,eAAEA,YAAY,CAAErB,QAAhB,CAA/B,EAA0D;AACzD;AACA;;AAED,UAAMf,cAAc,GAAG0B,iBAAiB,CAAE,4BAAF,CAAxC;AACA,UAAMY,gBAAgB,GAAGlB,kBAAkB,CAC1CgB,YAD0C,EAE1CpC,cAF0C,CAA3C;AAIA,UAAMuC,YAAY,GAAGhB,QAAQ,CAAEa,YAAF,EAAgBpC,cAAhB,CAA7B;AACAiC,IAAAA,cAAc,CAAE,CACf;AACCO,MAAAA,GAAG,EAAEF,gBADN;AAECG,MAAAA,cAAc,EAAE,IAFjB;AAGCC,MAAAA,uBAAuB,EAAE;AAH1B,KADe,EAMf;AACCF,MAAAA,GAAG,EAAED,YADN;AAECE,MAAAA,cAAc,EAAE;AAFjB,KANe,CAAF,CAAd;AAWAP,IAAAA,WAAW,CAAEE,YAAY,CAACrB,QAAf,CAAX;AACA,GAvBD,EAuBG,CAAEqB,YAAF,CAvBH;AAyBA,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[ 'core', 'theme', 'user' ].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[ 'core', 'theme', 'user' ].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","__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,mCAAmC,GAAG,IAA5C;;AACA,MAAK,wBAAYH,eAAZ,EAA6BC,yBAA7B,CAAL,EAAgE;AAC/D,UAAMG,QAAQ,GAAGJ,eAAe,CAC9BK,KADe,CACRJ,yBAAyB,CAACK,MADlB,EAEfC,KAFe,CAERL,uCAFQ,EAGfM,IAHe,CAGTL,mCAHS,CAAjB;AAIA,WAAQ,aAAaC,QAAU,GAA/B;AACA;;AACD,SAAOJ,eAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;A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QAAM,CAAEC,WAAF,EAAeC,cAAf,IAAkC,uBAAU,EAAV,CAAxC;AACA,QAAM,CAAElB,QAAF,EAAYmB,WAAZ,IAA4B,uBAAU,EAAV,CAAlC;AACA,QAAM;AAAEC,IAAAA,MAAM,EAAEC;AAAV,MAA2B,yBAAYC,4BAAZ,CAAjC;AAEA,0BAAW,MAAM;AAChB,QAAK,EAAED,YAAF,aAAEA,YAAF,eAAEA,YAAY,CAAElC,MAAhB,KAA0B,EAAEkC,YAAF,aAAEA,YAAF,eAAEA,YAAY,CAAErB,QAAhB,CAA/B,EAA0D;AACzD;AACA;;AAED,UAAMf,cAAc,GAAG0B,iBAAiB,CAAE,4BAAF,CAAxC;AACA,UAAMY,gBAAgB,GAAGlB,kBAAkB,CAC1CgB,YAD0C,EAE1CpC,cAF0C,CAA3C;AAIA,UAAMuC,YAAY,GAAGhB,QAAQ,CAAEa,YAAF,EAAgBpC,cAAhB,CAA7B;AACAiC,IAAAA,cAAc,CAAE,CACf;AACCO,MAAAA,GAAG,EAAEF,gBADN;AAECG,MAAAA,cAAc,EAAE,IAFjB;AAGCC,MAAAA,uBAAuB,EAAE;AAH1B,KADe,EAMf;AACCF,MAAAA,GAAG,EAAED,YADN;AAECE,MAAAA,cAAc,EAAE;AAFjB,KANe,CAAF,CAAd;AAWAP,IAAAA,WAAW,CAAEE,YAAY,CAACrB,QAAf,CAAX;AACA,GAvBD,EAuBG,CAAEqB,YAAF,CAvBH;AAyBA,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', 'user' ].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', 'user' ].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"]}
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
exports.ROOT_BLOCK_SUPPORTS = exports.ROOT_BLOCK_SELECTOR = exports.ROOT_BLOCK_NAME = exports.PRESET_METADATA = void 0;
|
|
6
7
|
exports.getPresetVariableFromValue = getPresetVariableFromValue;
|
|
7
8
|
exports.getValueFromVariable = getValueFromVariable;
|
|
8
|
-
exports.PRESET_METADATA = exports.ROOT_BLOCK_SUPPORTS = exports.ROOT_BLOCK_SELECTOR = exports.ROOT_BLOCK_NAME = void 0;
|
|
9
9
|
|
|
10
10
|
var _lodash = require("lodash");
|
|
11
11
|
|
|
@@ -76,7 +76,7 @@ function findInPresetsBy(features, blockName, presetPath, presetProperty, preset
|
|
|
76
76
|
for (const presetByOrigin of orderedPresetsByOrigin) {
|
|
77
77
|
if (presetByOrigin) {
|
|
78
78
|
// Preset origins ordered by priority.
|
|
79
|
-
const origins = ['user', 'theme', '
|
|
79
|
+
const origins = ['user', 'theme', 'default'];
|
|
80
80
|
|
|
81
81
|
for (const origin of origins) {
|
|
82
82
|
const presets = presetByOrigin[origin];
|
|
@@ -133,7 +133,8 @@ function getPresetVariableFromValue(features, blockName, variableStylePath, pres
|
|
|
133
133
|
return `var:preset|${cssVarInfix}|${presetObject.slug}`;
|
|
134
134
|
}
|
|
135
135
|
|
|
136
|
-
function getValueFromPresetVariable(features, blockName, variable,
|
|
136
|
+
function getValueFromPresetVariable(features, blockName, variable, _ref) {
|
|
137
|
+
let [presetType, slug] = _ref;
|
|
137
138
|
const metadata = (0, _lodash.find)(PRESET_METADATA, ['cssVarInfix', presetType]);
|
|
138
139
|
|
|
139
140
|
if (!metadata) {
|