@wordpress/block-editor 15.10.1-next.v.0 → 15.11.1-next.v.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/build/components/block-controls/index.cjs +1 -1
- package/build/components/block-controls/index.cjs.map +2 -2
- package/build/components/block-edit/context.cjs +5 -0
- package/build/components/block-edit/context.cjs.map +2 -2
- package/build/components/block-edit/index.cjs +3 -0
- package/build/components/block-edit/index.cjs.map +2 -2
- package/build/components/block-inspector/index.cjs +7 -27
- package/build/components/block-inspector/index.cjs.map +3 -3
- package/build/components/block-list/block.cjs +3 -0
- package/build/components/block-list/block.cjs.map +2 -2
- package/build/components/block-list/use-block-props/use-selected-block-event-handlers.cjs +37 -13
- package/build/components/block-list/use-block-props/use-selected-block-event-handlers.cjs.map +2 -2
- package/build/components/block-settings-menu-controls/index.cjs +1 -1
- package/build/components/block-settings-menu-controls/index.cjs.map +2 -2
- package/build/components/block-toolbar/index.cjs +1 -1
- package/build/components/block-toolbar/index.cjs.map +2 -2
- package/build/components/block-tools/index.cjs +2 -26
- package/build/components/block-tools/index.cjs.map +2 -2
- package/build/components/block-visibility/index.cjs +7 -9
- package/build/components/block-visibility/index.cjs.map +3 -3
- package/build/components/block-visibility/modal.cjs +13 -11
- package/build/components/block-visibility/modal.cjs.map +2 -2
- package/build/components/block-visibility/use-block-visibility.cjs +1 -1
- package/build/components/block-visibility/use-block-visibility.cjs.map +2 -2
- package/build/components/block-visibility/utils.cjs +5 -1
- package/build/components/block-visibility/utils.cjs.map +2 -2
- package/build/components/block-visibility/viewport-menu-item.cjs +11 -4
- package/build/components/block-visibility/viewport-menu-item.cjs.map +2 -2
- package/build/components/block-visibility/viewport-toolbar.cjs +4 -6
- package/build/components/block-visibility/viewport-toolbar.cjs.map +2 -2
- package/build/components/block-visibility/viewport-visibility-info.cjs +121 -0
- package/build/components/block-visibility/viewport-visibility-info.cjs.map +7 -0
- package/build/components/button-block-appender/index.cjs +23 -19
- package/build/components/button-block-appender/index.cjs.map +2 -2
- package/build/components/color-palette/with-color-context.cjs +1 -1
- package/build/components/color-palette/with-color-context.cjs.map +2 -2
- package/build/components/color-style-selector/index.cjs +1 -1
- package/build/components/color-style-selector/index.cjs.map +2 -2
- package/build/components/colors/with-colors.cjs +5 -3
- package/build/components/colors/with-colors.cjs.map +2 -2
- package/build/components/colors-gradients/dropdown.cjs +1 -1
- package/build/components/colors-gradients/dropdown.cjs.map +2 -2
- package/build/components/editable-text/index.cjs +5 -1
- package/build/components/editable-text/index.cjs.map +2 -2
- package/build/components/font-sizes/font-size-picker.cjs +2 -1
- package/build/components/font-sizes/font-size-picker.cjs.map +2 -2
- package/build/components/font-sizes/with-font-sizes.cjs +5 -3
- package/build/components/font-sizes/with-font-sizes.cjs.map +2 -2
- package/build/components/global-styles/advanced-panel.cjs +26 -13
- package/build/components/global-styles/advanced-panel.cjs.map +2 -2
- package/build/components/global-styles/filters-panel.cjs +1 -1
- package/build/components/global-styles/filters-panel.cjs.map +2 -2
- package/build/components/global-styles/shadow-panel-components.cjs +1 -1
- package/build/components/global-styles/shadow-panel-components.cjs.map +2 -2
- package/build/components/gradients/with-gradient.cjs +1 -1
- package/build/components/gradients/with-gradient.cjs.map +2 -2
- package/build/components/inspector-controls/fill.cjs +14 -25
- package/build/components/inspector-controls/fill.cjs.map +2 -2
- package/build/components/inspector-controls/index.cjs +1 -1
- package/build/components/inspector-controls/index.cjs.map +2 -2
- package/build/components/inspector-controls-tabs/index.cjs +1 -1
- package/build/components/inspector-controls-tabs/index.cjs.map +2 -2
- package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.cjs +7 -7
- package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.cjs.map +2 -2
- package/build/components/list-view/block-select-button.cjs +8 -16
- package/build/components/list-view/block-select-button.cjs.map +2 -2
- package/build/components/list-view/block.cjs +29 -34
- package/build/components/list-view/block.cjs.map +3 -3
- package/build/components/list-view/utils.cjs +3 -1
- package/build/components/list-view/utils.cjs.map +2 -2
- package/build/components/provider/index.cjs +7 -8
- package/build/components/provider/index.cjs.map +2 -2
- package/build/components/provider/with-registry-provider.cjs +1 -1
- package/build/components/provider/with-registry-provider.cjs.map +2 -2
- package/build/components/use-block-commands/index.cjs +2 -34
- package/build/components/use-block-commands/index.cjs.map +2 -2
- package/build/hooks/block-fields/index.cjs +52 -86
- package/build/hooks/block-fields/index.cjs.map +3 -3
- package/build/hooks/block-fields/link/index.cjs +2 -11
- package/build/hooks/block-fields/link/index.cjs.map +2 -2
- package/build/hooks/block-fields/media/index.cjs +9 -14
- package/build/hooks/block-fields/media/index.cjs.map +2 -2
- package/build/hooks/cross-origin-isolation.cjs +1 -1
- package/build/hooks/cross-origin-isolation.cjs.map +2 -2
- package/build/hooks/custom-css.cjs +141 -0
- package/build/hooks/custom-css.cjs.map +7 -0
- package/build/hooks/fit-text.cjs +14 -7
- package/build/hooks/fit-text.cjs.map +2 -2
- package/build/hooks/grid-visualizer.cjs +1 -1
- package/build/hooks/grid-visualizer.cjs.map +2 -2
- package/build/hooks/index.cjs +6 -1
- package/build/hooks/index.cjs.map +3 -3
- package/build/hooks/layout.cjs +10 -4
- package/build/hooks/layout.cjs.map +2 -2
- package/build/hooks/list-view.cjs +32 -11
- package/build/hooks/list-view.cjs.map +3 -3
- package/build/hooks/utils.cjs +5 -4
- package/build/hooks/utils.cjs.map +2 -2
- package/build/layouts/grid.cjs +12 -1
- package/build/layouts/grid.cjs.map +2 -2
- package/build/store/defaults.cjs +3 -0
- package/build/store/defaults.cjs.map +2 -2
- package/build/store/private-selectors.cjs +45 -37
- package/build/store/private-selectors.cjs.map +2 -2
- package/build/store/selectors.cjs +7 -1
- package/build/store/selectors.cjs.map +2 -2
- package/build/utils/fit-text-utils.cjs +5 -1
- package/build/utils/fit-text-utils.cjs.map +2 -2
- package/build-module/components/block-controls/index.mjs +1 -1
- package/build-module/components/block-controls/index.mjs.map +2 -2
- package/build-module/components/block-edit/context.mjs +4 -0
- package/build-module/components/block-edit/context.mjs.map +2 -2
- package/build-module/components/block-edit/index.mjs +4 -0
- package/build-module/components/block-edit/index.mjs.map +2 -2
- package/build-module/components/block-inspector/index.mjs +7 -27
- package/build-module/components/block-inspector/index.mjs.map +2 -2
- package/build-module/components/block-list/block.mjs +3 -0
- package/build-module/components/block-list/block.mjs.map +2 -2
- package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.mjs +37 -13
- package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.mjs.map +2 -2
- package/build-module/components/block-settings-menu-controls/index.mjs +2 -2
- package/build-module/components/block-settings-menu-controls/index.mjs.map +2 -2
- package/build-module/components/block-toolbar/index.mjs +2 -2
- package/build-module/components/block-toolbar/index.mjs.map +2 -2
- package/build-module/components/block-tools/index.mjs +2 -26
- package/build-module/components/block-tools/index.mjs.map +2 -2
- package/build-module/components/block-visibility/index.mjs +6 -9
- package/build-module/components/block-visibility/index.mjs.map +2 -2
- package/build-module/components/block-visibility/modal.mjs +13 -11
- package/build-module/components/block-visibility/modal.mjs.map +2 -2
- package/build-module/components/block-visibility/use-block-visibility.mjs +1 -1
- package/build-module/components/block-visibility/use-block-visibility.mjs.map +2 -2
- package/build-module/components/block-visibility/utils.mjs +5 -1
- package/build-module/components/block-visibility/utils.mjs.map +2 -2
- package/build-module/components/block-visibility/viewport-menu-item.mjs +11 -4
- package/build-module/components/block-visibility/viewport-menu-item.mjs.map +2 -2
- package/build-module/components/block-visibility/viewport-toolbar.mjs +4 -6
- package/build-module/components/block-visibility/viewport-toolbar.mjs.map +2 -2
- package/build-module/components/block-visibility/viewport-visibility-info.mjs +95 -0
- package/build-module/components/block-visibility/viewport-visibility-info.mjs.map +7 -0
- package/build-module/components/button-block-appender/index.mjs +23 -19
- package/build-module/components/button-block-appender/index.mjs.map +2 -2
- package/build-module/components/color-palette/with-color-context.mjs +1 -1
- package/build-module/components/color-palette/with-color-context.mjs.map +2 -2
- package/build-module/components/color-style-selector/index.mjs +1 -1
- package/build-module/components/color-style-selector/index.mjs.map +2 -2
- package/build-module/components/colors/with-colors.mjs +5 -3
- package/build-module/components/colors/with-colors.mjs.map +2 -2
- package/build-module/components/colors-gradients/dropdown.mjs +1 -1
- package/build-module/components/colors-gradients/dropdown.mjs.map +2 -2
- package/build-module/components/editable-text/index.mjs +5 -1
- package/build-module/components/editable-text/index.mjs.map +2 -2
- package/build-module/components/font-sizes/font-size-picker.mjs +2 -1
- package/build-module/components/font-sizes/font-size-picker.mjs.map +2 -2
- package/build-module/components/font-sizes/with-font-sizes.mjs +5 -3
- package/build-module/components/font-sizes/with-font-sizes.mjs.map +2 -2
- package/build-module/components/global-styles/advanced-panel.mjs +22 -13
- package/build-module/components/global-styles/advanced-panel.mjs.map +2 -2
- package/build-module/components/global-styles/filters-panel.mjs +1 -1
- package/build-module/components/global-styles/filters-panel.mjs.map +2 -2
- package/build-module/components/global-styles/shadow-panel-components.mjs +1 -1
- package/build-module/components/global-styles/shadow-panel-components.mjs.map +2 -2
- package/build-module/components/gradients/with-gradient.mjs +1 -1
- package/build-module/components/gradients/with-gradient.mjs.map +2 -2
- package/build-module/components/inspector-controls/fill.mjs +16 -22
- package/build-module/components/inspector-controls/fill.mjs.map +2 -2
- package/build-module/components/inspector-controls/index.mjs +1 -1
- package/build-module/components/inspector-controls/index.mjs.map +2 -2
- package/build-module/components/inspector-controls-tabs/index.mjs +1 -1
- package/build-module/components/inspector-controls-tabs/index.mjs.map +2 -2
- package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.mjs +7 -7
- package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.mjs.map +2 -2
- package/build-module/components/list-view/block-select-button.mjs +8 -16
- package/build-module/components/list-view/block-select-button.mjs.map +2 -2
- package/build-module/components/list-view/block.mjs +31 -36
- package/build-module/components/list-view/block.mjs.map +2 -2
- package/build-module/components/list-view/utils.mjs +3 -1
- package/build-module/components/list-view/utils.mjs.map +2 -2
- package/build-module/components/provider/index.mjs +7 -8
- package/build-module/components/provider/index.mjs.map +2 -2
- package/build-module/components/provider/with-registry-provider.mjs +1 -1
- package/build-module/components/provider/with-registry-provider.mjs.map +2 -2
- package/build-module/components/use-block-commands/index.mjs +3 -37
- package/build-module/components/use-block-commands/index.mjs.map +2 -2
- package/build-module/hooks/block-fields/index.mjs +45 -87
- package/build-module/hooks/block-fields/index.mjs.map +2 -2
- package/build-module/hooks/block-fields/link/index.mjs +2 -11
- package/build-module/hooks/block-fields/link/index.mjs.map +2 -2
- package/build-module/hooks/block-fields/media/index.mjs +9 -14
- package/build-module/hooks/block-fields/media/index.mjs.map +2 -2
- package/build-module/hooks/cross-origin-isolation.mjs +1 -1
- package/build-module/hooks/cross-origin-isolation.mjs.map +2 -2
- package/build-module/hooks/custom-css.mjs +112 -0
- package/build-module/hooks/custom-css.mjs.map +7 -0
- package/build-module/hooks/fit-text.mjs +14 -7
- package/build-module/hooks/fit-text.mjs.map +2 -2
- package/build-module/hooks/grid-visualizer.mjs +1 -1
- package/build-module/hooks/grid-visualizer.mjs.map +2 -2
- package/build-module/hooks/index.mjs +6 -1
- package/build-module/hooks/index.mjs.map +2 -2
- package/build-module/hooks/layout.mjs +10 -4
- package/build-module/hooks/layout.mjs.map +2 -2
- package/build-module/hooks/list-view.mjs +33 -12
- package/build-module/hooks/list-view.mjs.map +2 -2
- package/build-module/hooks/utils.mjs +7 -5
- package/build-module/hooks/utils.mjs.map +2 -2
- package/build-module/layouts/grid.mjs +12 -1
- package/build-module/layouts/grid.mjs.map +2 -2
- package/build-module/store/defaults.mjs +3 -0
- package/build-module/store/defaults.mjs.map +2 -2
- package/build-module/store/private-selectors.mjs +42 -40
- package/build-module/store/private-selectors.mjs.map +2 -2
- package/build-module/store/selectors.mjs +7 -1
- package/build-module/store/selectors.mjs.map +2 -2
- package/build-module/utils/fit-text-utils.mjs +5 -1
- package/build-module/utils/fit-text-utils.mjs.map +2 -2
- package/build-style/style-rtl.css +3 -0
- package/build-style/style.css +3 -0
- package/package.json +39 -39
- package/src/components/block-controls/index.js +1 -1
- package/src/components/block-controls/test/index.js +1 -0
- package/src/components/block-edit/context.js +3 -0
- package/src/components/block-edit/index.js +6 -0
- package/src/components/block-edit/test/edit.js +10 -0
- package/src/components/block-inspector/index.js +16 -38
- package/src/components/block-list/block.js +3 -0
- package/src/components/block-list/block.native.js +5 -0
- package/src/components/block-list/use-block-props/use-selected-block-event-handlers.js +49 -29
- package/src/components/block-patterns-list/stories/index.story.jsx +1 -1
- package/src/components/block-preview/test/index.js +11 -7
- package/src/components/block-settings-menu-controls/index.js +2 -2
- package/src/components/block-switcher/test/index.js +2 -0
- package/src/components/block-switcher/test/use-transformed.patterns.js +2 -0
- package/src/components/block-switcher/test/utils.js +2 -0
- package/src/components/block-toolbar/index.js +2 -2
- package/src/components/block-tools/index.js +2 -29
- package/src/components/block-visibility/index.js +3 -19
- package/src/components/block-visibility/modal.js +16 -14
- package/src/components/block-visibility/test/use-block-visibility.js +27 -25
- package/src/components/block-visibility/test/utils.js +24 -8
- package/src/components/block-visibility/use-block-visibility.js +1 -4
- package/src/components/block-visibility/utils.js +9 -1
- package/src/components/block-visibility/viewport-menu-item.js +11 -5
- package/src/components/block-visibility/viewport-toolbar.js +5 -6
- package/src/components/block-visibility/viewport-visibility-info.js +131 -0
- package/src/components/button-block-appender/index.js +2 -2
- package/src/components/color-palette/with-color-context.js +1 -1
- package/src/components/color-style-selector/index.js +2 -3
- package/src/components/colors/with-colors.js +23 -20
- package/src/components/colors-gradients/dropdown.js +2 -3
- package/src/components/editable-text/index.js +5 -1
- package/src/components/font-sizes/font-size-picker.js +1 -0
- package/src/components/font-sizes/with-font-sizes.js +13 -10
- package/src/components/global-styles/advanced-panel.js +35 -16
- package/src/components/global-styles/filters-panel.js +2 -3
- package/src/components/global-styles/shadow-panel-components.js +1 -1
- package/src/components/global-styles/style.scss +9 -5
- package/src/components/gradients/with-gradient.js +7 -4
- package/src/components/inner-blocks/test/index.js +2 -0
- package/src/components/inspector-controls/fill.js +30 -20
- package/src/components/inspector-controls/index.js +1 -1
- package/src/components/inspector-controls-tabs/index.js +5 -1
- package/src/components/inspector-controls-tabs/use-inspector-controls-tabs.js +13 -11
- package/src/components/link-control/test/index.js +6 -1
- package/src/components/list-view/block-select-button.js +16 -25
- package/src/components/list-view/block.js +38 -43
- package/src/components/list-view/utils.js +4 -2
- package/src/components/media-replace-flow/test/index.js +13 -11
- package/src/components/provider/index.js +11 -10
- package/src/components/provider/test/use-block-sync.js +1 -0
- package/src/components/provider/with-registry-provider.js +1 -1
- package/src/components/use-block-commands/index.js +0 -41
- package/src/hooks/block-fields/index.js +66 -111
- package/src/hooks/block-fields/link/index.js +2 -14
- package/src/hooks/block-fields/media/index.js +9 -21
- package/src/hooks/cross-origin-isolation.js +19 -18
- package/src/hooks/custom-css.js +176 -0
- package/src/hooks/fit-text.js +20 -5
- package/src/hooks/grid-visualizer.js +15 -14
- package/src/hooks/index.js +6 -1
- package/src/hooks/layout.js +55 -43
- package/src/hooks/list-view.js +46 -12
- package/src/hooks/test/align.js +1 -0
- package/src/hooks/test/allowed-blocks.js +8 -0
- package/src/hooks/test/auto-inspector-controls.js +4 -0
- package/src/hooks/test/font-size.js +1 -0
- package/src/hooks/test/metadata.js +4 -0
- package/src/hooks/test/text-align.js +1 -0
- package/src/hooks/utils.js +124 -116
- package/src/layouts/grid.js +19 -3
- package/src/layouts/test/grid.js +1 -1
- package/src/store/defaults.js +4 -0
- package/src/store/private-selectors.js +94 -63
- package/src/store/selectors.js +14 -6
- package/src/store/test/actions.js +7 -0
- package/src/store/test/private-selectors.js +116 -119
- package/src/store/test/reducer.js +4 -0
- package/src/store/test/registry-selectors.js +2 -0
- package/src/store/test/selectors.js +19 -0
- package/src/utils/fit-text-utils.js +12 -2
- package/build/components/block-visibility/block-visibility-info.cjs +0 -63
- package/build/components/block-visibility/block-visibility-info.cjs.map +0 -7
- package/build/components/block-visibility/menu-item.cjs +0 -109
- package/build/components/block-visibility/menu-item.cjs.map +0 -7
- package/build/components/block-visibility/toolbar.cjs +0 -92
- package/build/components/block-visibility/toolbar.cjs.map +0 -7
- package/build-module/components/block-visibility/block-visibility-info.mjs +0 -47
- package/build-module/components/block-visibility/block-visibility-info.mjs.map +0 -7
- package/build-module/components/block-visibility/menu-item.mjs +0 -88
- package/build-module/components/block-visibility/menu-item.mjs.map +0 -7
- package/build-module/components/block-visibility/toolbar.mjs +0 -71
- package/build-module/components/block-visibility/toolbar.mjs.map +0 -7
- package/src/components/block-visibility/block-visibility-info.js +0 -62
- package/src/components/block-visibility/menu-item.js +0 -96
- package/src/components/block-visibility/toolbar.js +0 -88
- /package/src/components/block-icon/stories/{index.story.js → index.story.ts} +0 -0
- /package/src/components/contrast-checker/stories/{index.story.js → index.story.ts} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/hooks/utils.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { getBlockSupport } from '@wordpress/blocks';\nimport { memo, useMemo, useEffect, useId, useState } from '@wordpress/element';\nimport { useDispatch, useRegistry } from '@wordpress/data';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport { addFilter } from '@wordpress/hooks';\n\n/**\n * Internal dependencies\n */\nimport {\n\tuseBlockEditContext,\n\tmayDisplayControlsKey,\n\tmayDisplayParentControlsKey,\n} from '../components/block-edit/context';\nimport { useSettings } from '../components';\nimport { useSettingsForBlockElement } from '../components/global-styles/hooks';\nimport { getValueFromObjectPath, setImmutably } from '../utils/object';\nimport { store as blockEditorStore } from '../store';\nimport { unlock } from '../lock-unlock';\n\n/**\n * Removed falsy values from nested object.\n *\n * @param {*} object\n * @return {*} Object cleaned from falsy values\n */\nexport const cleanEmptyObject = ( object ) => {\n\tif (\n\t\tobject === null ||\n\t\ttypeof object !== 'object' ||\n\t\tArray.isArray( object )\n\t) {\n\t\treturn object;\n\t}\n\n\tconst cleanedNestedObjects = Object.entries( object )\n\t\t.map( ( [ key, value ] ) => [ key, cleanEmptyObject( value ) ] )\n\t\t.filter( ( [ , value ] ) => value !== undefined );\n\treturn ! cleanedNestedObjects.length\n\t\t? undefined\n\t\t: Object.fromEntries( cleanedNestedObjects );\n};\n\nexport function transformStyles(\n\tactiveSupports,\n\tmigrationPaths,\n\tresult,\n\tsource,\n\tindex,\n\tresults\n) {\n\t// If there are no active supports return early.\n\tif (\n\t\tObject.values( activeSupports ?? {} ).every(\n\t\t\t( isActive ) => ! isActive\n\t\t)\n\t) {\n\t\treturn result;\n\t}\n\t// If the condition verifies we are probably in the presence of a wrapping transform\n\t// e.g: nesting paragraphs in a group or columns and in that case the styles should not be transformed.\n\tif ( results.length === 1 && result.innerBlocks.length === source.length ) {\n\t\treturn result;\n\t}\n\t// For cases where we have a transform from one block to multiple blocks\n\t// or multiple blocks to one block we apply the styles of the first source block\n\t// to the result(s).\n\tlet referenceBlockAttributes = source[ 0 ]?.attributes;\n\t// If we are in presence of transform between more than one block in the source\n\t// that has more than one block in the result\n\t// we apply the styles on source N to the result N,\n\t// if source N does not exists we do nothing.\n\tif ( results.length > 1 && source.length > 1 ) {\n\t\tif ( source[ index ] ) {\n\t\t\treferenceBlockAttributes = source[ index ]?.attributes;\n\t\t} else {\n\t\t\treturn result;\n\t\t}\n\t}\n\tlet returnBlock = result;\n\tObject.entries( activeSupports ).forEach( ( [ support, isActive ] ) => {\n\t\tif ( isActive ) {\n\t\t\tmigrationPaths[ support ].forEach( ( path ) => {\n\t\t\t\tconst styleValue = getValueFromObjectPath(\n\t\t\t\t\treferenceBlockAttributes,\n\t\t\t\t\tpath\n\t\t\t\t);\n\t\t\t\tif ( styleValue ) {\n\t\t\t\t\treturnBlock = {\n\t\t\t\t\t\t...returnBlock,\n\t\t\t\t\t\tattributes: setImmutably(\n\t\t\t\t\t\t\treturnBlock.attributes,\n\t\t\t\t\t\t\tpath,\n\t\t\t\t\t\t\tstyleValue\n\t\t\t\t\t\t),\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t} );\n\t\t}\n\t} );\n\treturn returnBlock;\n}\n\n/**\n * Check whether serialization of specific block support feature or set should\n * be skipped.\n *\n * @param {string|Object} blockNameOrType Block name or block type object.\n * @param {string} featureSet Name of block support feature set.\n * @param {string} feature Name of the individual feature to check.\n *\n * @return {boolean} Whether serialization should occur.\n */\nexport function shouldSkipSerialization(\n\tblockNameOrType,\n\tfeatureSet,\n\tfeature\n) {\n\tconst support = getBlockSupport( blockNameOrType, featureSet );\n\tconst skipSerialization = support?.__experimentalSkipSerialization;\n\n\tif ( Array.isArray( skipSerialization ) ) {\n\t\treturn skipSerialization.includes( feature );\n\t}\n\n\treturn skipSerialization;\n}\n\nconst pendingStyleOverrides = new WeakMap();\n\n/**\n * Override a block editor settings style. Leave the ID blank to create a new\n * style.\n *\n * @param {Object} override Override object.\n * @param {?string} override.id Id of the style override, leave blank to create\n * a new style.\n * @param {string} override.css CSS to apply.\n */\nexport function useStyleOverride( { id, css } ) {\n\treturn usePrivateStyleOverride( { id, css } );\n}\n\nexport function usePrivateStyleOverride( {\n\tid,\n\tcss,\n\tassets,\n\t__unstableType,\n\tvariation,\n\tclientId,\n} = {} ) {\n\tconst { setStyleOverride, deleteStyleOverride } = unlock(\n\t\tuseDispatch( blockEditorStore )\n\t);\n\tconst registry = useRegistry();\n\tconst fallbackId = useId();\n\tuseEffect( () => {\n\t\t// Unmount if there is CSS and assets are empty.\n\t\tif ( ! css && ! assets ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst _id = id || fallbackId;\n\t\tconst override = {\n\t\t\tid,\n\t\t\tcss,\n\t\t\tassets,\n\t\t\t__unstableType,\n\t\t\tvariation,\n\t\t\tclientId,\n\t\t};\n\t\t// Batch updates to style overrides to avoid triggering cascading renders\n\t\t// for each style override block included in a tree and optimize initial render.\n\t\tif ( ! pendingStyleOverrides.get( registry ) ) {\n\t\t\tpendingStyleOverrides.set( registry, [] );\n\t\t}\n\t\tpendingStyleOverrides.get( registry ).push( [ _id, override ] );\n\t\twindow.queueMicrotask( () => {\n\t\t\tif ( pendingStyleOverrides.get( registry )?.length ) {\n\t\t\t\tregistry.batch( () => {\n\t\t\t\t\tpendingStyleOverrides.get( registry ).forEach( ( args ) => {\n\t\t\t\t\t\tsetStyleOverride( ...args );\n\t\t\t\t\t} );\n\t\t\t\t\tpendingStyleOverrides.set( registry, [] );\n\t\t\t\t} );\n\t\t\t}\n\t\t} );\n\n\t\treturn () => {\n\t\t\tconst isPending = pendingStyleOverrides\n\t\t\t\t.get( registry )\n\t\t\t\t?.find( ( [ currentId ] ) => currentId === _id );\n\t\t\tif ( isPending ) {\n\t\t\t\tpendingStyleOverrides.set(\n\t\t\t\t\tregistry,\n\t\t\t\t\tpendingStyleOverrides\n\t\t\t\t\t\t.get( registry )\n\t\t\t\t\t\t.filter( ( [ currentId ] ) => currentId !== _id )\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tdeleteStyleOverride( _id );\n\t\t\t}\n\t\t};\n\t}, [\n\t\tid,\n\t\tcss,\n\t\tclientId,\n\t\tassets,\n\t\t__unstableType,\n\t\tfallbackId,\n\t\tsetStyleOverride,\n\t\tdeleteStyleOverride,\n\t\tregistry,\n\t\tvariation,\n\t] );\n}\n\n/**\n * Based on the block and its context, returns an object of all the block settings.\n * This object can be passed as a prop to all the Styles UI components\n * (TypographyPanel, DimensionsPanel...).\n *\n * @param {string} name Block name.\n * @param {*} parentLayout Parent layout.\n *\n * @return {Object} Settings object.\n */\nexport function useBlockSettings( name, parentLayout ) {\n\tconst [\n\t\tbackgroundImage,\n\t\tbackgroundSize,\n\t\tcustomFontFamilies,\n\t\tdefaultFontFamilies,\n\t\tthemeFontFamilies,\n\t\tdefaultFontSizesEnabled,\n\t\tcustomFontSizes,\n\t\tdefaultFontSizes,\n\t\tthemeFontSizes,\n\t\tcustomFontSize,\n\t\tfontStyle,\n\t\tfontWeight,\n\t\tlineHeight,\n\t\ttextAlign,\n\t\ttextColumns,\n\t\ttextDecoration,\n\t\twritingMode,\n\t\ttextTransform,\n\t\tletterSpacing,\n\t\tpadding,\n\t\tmargin,\n\t\tblockGap,\n\t\tdefaultSpacingSizesEnabled,\n\t\tcustomSpacingSize,\n\t\tuserSpacingSizes,\n\t\tdefaultSpacingSizes,\n\t\tthemeSpacingSizes,\n\t\tunits,\n\t\taspectRatio,\n\t\theight,\n\t\tminHeight,\n\t\twidth,\n\t\tdimensionSizes,\n\t\tlayout,\n\t\tborderColor,\n\t\tborderRadius,\n\t\tborderStyle,\n\t\tborderWidth,\n\t\tborderRadiusSizes,\n\t\tcustomColorsEnabled,\n\t\tcustomColors,\n\t\tcustomDuotone,\n\t\tthemeColors,\n\t\tdefaultColors,\n\t\tdefaultPalette,\n\t\tdefaultDuotone,\n\t\tuserDuotonePalette,\n\t\tthemeDuotonePalette,\n\t\tdefaultDuotonePalette,\n\t\tuserGradientPalette,\n\t\tthemeGradientPalette,\n\t\tdefaultGradientPalette,\n\t\tdefaultGradients,\n\t\tareCustomGradientsEnabled,\n\t\tisBackgroundEnabled,\n\t\tisLinkEnabled,\n\t\tisTextEnabled,\n\t\tisHeadingEnabled,\n\t\tisButtonEnabled,\n\t\tshadow,\n\t] = useSettings(\n\t\t'background.backgroundImage',\n\t\t'background.backgroundSize',\n\t\t'typography.fontFamilies.custom',\n\t\t'typography.fontFamilies.default',\n\t\t'typography.fontFamilies.theme',\n\t\t'typography.defaultFontSizes',\n\t\t'typography.fontSizes.custom',\n\t\t'typography.fontSizes.default',\n\t\t'typography.fontSizes.theme',\n\t\t'typography.customFontSize',\n\t\t'typography.fontStyle',\n\t\t'typography.fontWeight',\n\t\t'typography.lineHeight',\n\t\t'typography.textAlign',\n\t\t'typography.textColumns',\n\t\t'typography.textDecoration',\n\t\t'typography.writingMode',\n\t\t'typography.textTransform',\n\t\t'typography.letterSpacing',\n\t\t'spacing.padding',\n\t\t'spacing.margin',\n\t\t'spacing.blockGap',\n\t\t'spacing.defaultSpacingSizes',\n\t\t'spacing.customSpacingSize',\n\t\t'spacing.spacingSizes.custom',\n\t\t'spacing.spacingSizes.default',\n\t\t'spacing.spacingSizes.theme',\n\t\t'spacing.units',\n\t\t'dimensions.aspectRatio',\n\t\t'dimensions.height',\n\t\t'dimensions.minHeight',\n\t\t'dimensions.width',\n\t\t'dimensions.dimensionSizes',\n\t\t'layout',\n\t\t'border.color',\n\t\t'border.radius',\n\t\t'border.style',\n\t\t'border.width',\n\t\t'border.radiusSizes',\n\t\t'color.custom',\n\t\t'color.palette.custom',\n\t\t'color.customDuotone',\n\t\t'color.palette.theme',\n\t\t'color.palette.default',\n\t\t'color.defaultPalette',\n\t\t'color.defaultDuotone',\n\t\t'color.duotone.custom',\n\t\t'color.duotone.theme',\n\t\t'color.duotone.default',\n\t\t'color.gradients.custom',\n\t\t'color.gradients.theme',\n\t\t'color.gradients.default',\n\t\t'color.defaultGradients',\n\t\t'color.customGradient',\n\t\t'color.background',\n\t\t'color.link',\n\t\t'color.text',\n\t\t'color.heading',\n\t\t'color.button',\n\t\t'shadow'\n\t);\n\n\tconst rawSettings = useMemo( () => {\n\t\treturn {\n\t\t\tbackground: {\n\t\t\t\tbackgroundImage,\n\t\t\t\tbackgroundSize,\n\t\t\t},\n\t\t\tcolor: {\n\t\t\t\tpalette: {\n\t\t\t\t\tcustom: customColors,\n\t\t\t\t\ttheme: themeColors,\n\t\t\t\t\tdefault: defaultColors,\n\t\t\t\t},\n\t\t\t\tgradients: {\n\t\t\t\t\tcustom: userGradientPalette,\n\t\t\t\t\ttheme: themeGradientPalette,\n\t\t\t\t\tdefault: defaultGradientPalette,\n\t\t\t\t},\n\t\t\t\tduotone: {\n\t\t\t\t\tcustom: userDuotonePalette,\n\t\t\t\t\ttheme: themeDuotonePalette,\n\t\t\t\t\tdefault: defaultDuotonePalette,\n\t\t\t\t},\n\t\t\t\tdefaultGradients,\n\t\t\t\tdefaultPalette,\n\t\t\t\tdefaultDuotone,\n\t\t\t\tcustom: customColorsEnabled,\n\t\t\t\tcustomGradient: areCustomGradientsEnabled,\n\t\t\t\tcustomDuotone,\n\t\t\t\tbackground: isBackgroundEnabled,\n\t\t\t\tlink: isLinkEnabled,\n\t\t\t\theading: isHeadingEnabled,\n\t\t\t\tbutton: isButtonEnabled,\n\t\t\t\ttext: isTextEnabled,\n\t\t\t},\n\t\t\ttypography: {\n\t\t\t\tfontFamilies: {\n\t\t\t\t\tcustom: customFontFamilies,\n\t\t\t\t\tdefault: defaultFontFamilies,\n\t\t\t\t\ttheme: themeFontFamilies,\n\t\t\t\t},\n\t\t\t\tfontSizes: {\n\t\t\t\t\tcustom: customFontSizes,\n\t\t\t\t\tdefault: defaultFontSizes,\n\t\t\t\t\ttheme: themeFontSizes,\n\t\t\t\t},\n\t\t\t\tcustomFontSize,\n\t\t\t\tdefaultFontSizes: defaultFontSizesEnabled,\n\t\t\t\tfontStyle,\n\t\t\t\tfontWeight,\n\t\t\t\tlineHeight,\n\t\t\t\ttextAlign,\n\t\t\t\ttextColumns,\n\t\t\t\ttextDecoration,\n\t\t\t\ttextTransform,\n\t\t\t\tletterSpacing,\n\t\t\t\twritingMode,\n\t\t\t},\n\t\t\tspacing: {\n\t\t\t\tspacingSizes: {\n\t\t\t\t\tcustom: userSpacingSizes,\n\t\t\t\t\tdefault: defaultSpacingSizes,\n\t\t\t\t\ttheme: themeSpacingSizes,\n\t\t\t\t},\n\t\t\t\tcustomSpacingSize,\n\t\t\t\tdefaultSpacingSizes: defaultSpacingSizesEnabled,\n\t\t\t\tpadding,\n\t\t\t\tmargin,\n\t\t\t\tblockGap,\n\t\t\t\tunits,\n\t\t\t},\n\t\t\tborder: {\n\t\t\t\tcolor: borderColor,\n\t\t\t\tradius: borderRadius,\n\t\t\t\tstyle: borderStyle,\n\t\t\t\twidth: borderWidth,\n\t\t\t\tradiusSizes: borderRadiusSizes,\n\t\t\t},\n\t\t\tdimensions: {\n\t\t\t\taspectRatio,\n\t\t\t\theight,\n\t\t\t\tminHeight,\n\t\t\t\twidth,\n\t\t\t\tdimensionSizes,\n\t\t\t},\n\t\t\tlayout,\n\t\t\tparentLayout,\n\t\t\tshadow,\n\t\t};\n\t}, [\n\t\tbackgroundImage,\n\t\tbackgroundSize,\n\t\tcustomFontFamilies,\n\t\tdefaultFontFamilies,\n\t\tthemeFontFamilies,\n\t\tdefaultFontSizesEnabled,\n\t\tcustomFontSizes,\n\t\tdefaultFontSizes,\n\t\tthemeFontSizes,\n\t\tcustomFontSize,\n\t\tfontStyle,\n\t\tfontWeight,\n\t\tlineHeight,\n\t\ttextAlign,\n\t\ttextColumns,\n\t\ttextDecoration,\n\t\ttextTransform,\n\t\tletterSpacing,\n\t\twritingMode,\n\t\tpadding,\n\t\tmargin,\n\t\tblockGap,\n\t\tdefaultSpacingSizesEnabled,\n\t\tcustomSpacingSize,\n\t\tuserSpacingSizes,\n\t\tdefaultSpacingSizes,\n\t\tthemeSpacingSizes,\n\t\tunits,\n\t\taspectRatio,\n\t\theight,\n\t\tminHeight,\n\t\twidth,\n\t\tdimensionSizes,\n\t\tlayout,\n\t\tparentLayout,\n\t\tborderColor,\n\t\tborderRadius,\n\t\tborderStyle,\n\t\tborderWidth,\n\t\tborderRadiusSizes,\n\t\tcustomColorsEnabled,\n\t\tcustomColors,\n\t\tcustomDuotone,\n\t\tthemeColors,\n\t\tdefaultColors,\n\t\tdefaultPalette,\n\t\tdefaultDuotone,\n\t\tuserDuotonePalette,\n\t\tthemeDuotonePalette,\n\t\tdefaultDuotonePalette,\n\t\tuserGradientPalette,\n\t\tthemeGradientPalette,\n\t\tdefaultGradientPalette,\n\t\tdefaultGradients,\n\t\tareCustomGradientsEnabled,\n\t\tisBackgroundEnabled,\n\t\tisLinkEnabled,\n\t\tisTextEnabled,\n\t\tisHeadingEnabled,\n\t\tisButtonEnabled,\n\t\tshadow,\n\t] );\n\n\treturn useSettingsForBlockElement( rawSettings, name );\n}\n\nexport function createBlockEditFilter( features ) {\n\t// We don't want block controls to re-render when typing inside a block.\n\t// `memo` will prevent re-renders unless props change, so only pass the\n\t// needed props and not the whole attributes object.\n\tfeatures = features.map( ( settings ) => {\n\t\treturn { ...settings, Edit: memo( settings.edit ) };\n\t} );\n\tconst withBlockEditHooks = createHigherOrderComponent(\n\t\t( OriginalBlockEdit ) => ( props ) => {\n\t\t\tconst context = useBlockEditContext();\n\t\t\t// CAUTION: code added before this line will be executed for all\n\t\t\t// blocks, not just those that support the feature! Code added\n\t\t\t// above this line should be carefully evaluated for its impact on\n\t\t\t// performance.\n\t\t\treturn [\n\t\t\t\t...features.map( ( feature, i ) => {\n\t\t\t\t\tconst {\n\t\t\t\t\t\tEdit,\n\t\t\t\t\t\thasSupport,\n\t\t\t\t\t\tattributeKeys = [],\n\t\t\t\t\t\tshareWithChildBlocks,\n\t\t\t\t\t} = feature;\n\t\t\t\t\tconst shouldDisplayControls =\n\t\t\t\t\t\tcontext[ mayDisplayControlsKey ] ||\n\t\t\t\t\t\t( context[ mayDisplayParentControlsKey ] &&\n\t\t\t\t\t\t\tshareWithChildBlocks );\n\n\t\t\t\t\tif (\n\t\t\t\t\t\t! shouldDisplayControls ||\n\t\t\t\t\t\t! hasSupport( props.name )\n\t\t\t\t\t) {\n\t\t\t\t\t\treturn null;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst neededProps = {};\n\t\t\t\t\tfor ( const key of attributeKeys ) {\n\t\t\t\t\t\tif ( props.attributes[ key ] ) {\n\t\t\t\t\t\t\tneededProps[ key ] = props.attributes[ key ];\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<Edit\n\t\t\t\t\t\t\t// We can use the index because the array length\n\t\t\t\t\t\t\t// is fixed per page load right now.\n\t\t\t\t\t\t\tkey={ i }\n\t\t\t\t\t\t\tname={ props.name }\n\t\t\t\t\t\t\tisSelected={ props.isSelected }\n\t\t\t\t\t\t\tclientId={ props.clientId }\n\t\t\t\t\t\t\tsetAttributes={ props.setAttributes }\n\t\t\t\t\t\t\t__unstableParentLayout={\n\t\t\t\t\t\t\t\tprops.__unstableParentLayout\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t// This component is pure, so only pass needed\n\t\t\t\t\t\t\t// props!!!\n\t\t\t\t\t\t\t{ ...neededProps }\n\t\t\t\t\t\t/>\n\t\t\t\t\t);\n\t\t\t\t} ),\n\t\t\t\t<OriginalBlockEdit key=\"edit\" { ...props } />,\n\t\t\t];\n\t\t},\n\t\t'withBlockEditHooks'\n\t);\n\taddFilter( 'editor.BlockEdit', 'core/editor/hooks', withBlockEditHooks );\n}\n\nfunction BlockProps( {\n\tindex,\n\tuseBlockProps: hook,\n\tsetAllWrapperProps,\n\t...props\n} ) {\n\tconst wrapperProps = hook( props );\n\tconst setWrapperProps = ( next ) =>\n\t\tsetAllWrapperProps( ( prev ) => {\n\t\t\tconst nextAll = [ ...prev ];\n\t\t\tnextAll[ index ] = next;\n\t\t\treturn nextAll;\n\t\t} );\n\t// Setting state after every render is fine because this component is\n\t// pure and will only re-render when needed props change.\n\tuseEffect( () => {\n\t\t// We could shallow compare the props, but since this component only\n\t\t// changes when needed attributes change, the benefit is probably small.\n\t\tsetWrapperProps( wrapperProps );\n\t\treturn () => {\n\t\t\tsetWrapperProps( undefined );\n\t\t};\n\t} );\n\treturn null;\n}\n\nconst BlockPropsPure = memo( BlockProps );\n\nexport function createBlockListBlockFilter( features ) {\n\tconst withBlockListBlockHooks = createHigherOrderComponent(\n\t\t( BlockListBlock ) => ( props ) => {\n\t\t\tconst [ allWrapperProps, setAllWrapperProps ] = useState(\n\t\t\t\tArray( features.length ).fill( undefined )\n\t\t\t);\n\t\t\treturn [\n\t\t\t\t...features.map( ( feature, i ) => {\n\t\t\t\t\tconst {\n\t\t\t\t\t\thasSupport,\n\t\t\t\t\t\tattributeKeys = [],\n\t\t\t\t\t\tuseBlockProps,\n\t\t\t\t\t\tisMatch,\n\t\t\t\t\t} = feature;\n\n\t\t\t\t\tconst neededProps = {};\n\t\t\t\t\tfor ( const key of attributeKeys ) {\n\t\t\t\t\t\tif ( props.attributes[ key ] ) {\n\t\t\t\t\t\t\tneededProps[ key ] = props.attributes[ key ];\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (\n\t\t\t\t\t\t// Skip rendering if none of the needed attributes are\n\t\t\t\t\t\t// set.\n\t\t\t\t\t\t! Object.keys( neededProps ).length ||\n\t\t\t\t\t\t! hasSupport( props.name ) ||\n\t\t\t\t\t\t( isMatch && ! isMatch( neededProps ) )\n\t\t\t\t\t) {\n\t\t\t\t\t\treturn null;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<BlockPropsPure\n\t\t\t\t\t\t\t// We can use the index because the array length\n\t\t\t\t\t\t\t// is fixed per page load right now.\n\t\t\t\t\t\t\tkey={ i }\n\t\t\t\t\t\t\tindex={ i }\n\t\t\t\t\t\t\tuseBlockProps={ useBlockProps }\n\t\t\t\t\t\t\t// This component is pure, so we must pass a stable\n\t\t\t\t\t\t\t// function reference.\n\t\t\t\t\t\t\tsetAllWrapperProps={ setAllWrapperProps }\n\t\t\t\t\t\t\tname={ props.name }\n\t\t\t\t\t\t\tclientId={ props.clientId }\n\t\t\t\t\t\t\t// This component is pure, so only pass needed\n\t\t\t\t\t\t\t// props!!!\n\t\t\t\t\t\t\t{ ...neededProps }\n\t\t\t\t\t\t/>\n\t\t\t\t\t);\n\t\t\t\t} ),\n\t\t\t\t<BlockListBlock\n\t\t\t\t\tkey=\"edit\"\n\t\t\t\t\t{ ...props }\n\t\t\t\t\twrapperProps={ allWrapperProps\n\t\t\t\t\t\t.filter( Boolean )\n\t\t\t\t\t\t.reduce( ( acc, wrapperProps ) => {\n\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t...acc,\n\t\t\t\t\t\t\t\t...wrapperProps,\n\t\t\t\t\t\t\t\tclassName: clsx(\n\t\t\t\t\t\t\t\t\tacc.className,\n\t\t\t\t\t\t\t\t\twrapperProps.className\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\t\t\t...acc.style,\n\t\t\t\t\t\t\t\t\t...wrapperProps.style,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t}, props.wrapperProps || {} ) }\n\t\t\t\t/>,\n\t\t\t];\n\t\t},\n\t\t'withBlockListBlockHooks'\n\t);\n\taddFilter(\n\t\t'editor.BlockListBlock',\n\t\t'core/editor/hooks',\n\t\twithBlockListBlockHooks\n\t);\n}\n\nexport function createBlockSaveFilter( features ) {\n\tfunction extraPropsFromHooks( props, name, attributes ) {\n\t\treturn features.reduce( ( accu, feature ) => {\n\t\t\tconst { hasSupport, attributeKeys = [], addSaveProps } = feature;\n\n\t\t\tconst neededAttributes = {};\n\t\t\tfor ( const key of attributeKeys ) {\n\t\t\t\tif ( attributes[ key ] ) {\n\t\t\t\t\tneededAttributes[ key ] = attributes[ key ];\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\t// Skip rendering if none of the needed attributes are\n\t\t\t\t// set.\n\t\t\t\t! Object.keys( neededAttributes ).length ||\n\t\t\t\t! hasSupport( name )\n\t\t\t) {\n\t\t\t\treturn accu;\n\t\t\t}\n\n\t\t\treturn addSaveProps( accu, name, neededAttributes );\n\t\t}, props );\n\t}\n\taddFilter(\n\t\t'blocks.getSaveContent.extraProps',\n\t\t'core/editor/hooks',\n\t\textraPropsFromHooks,\n\t\t0\n\t);\n\taddFilter(\n\t\t'blocks.getSaveContent.extraProps',\n\t\t'core/editor/hooks',\n\t\t( props ) => {\n\t\t\t// Previously we had a filter deleting the className if it was an empty\n\t\t\t// string. That filter is no longer running, so now we need to delete it\n\t\t\t// here.\n\t\t\tif ( props.hasOwnProperty( 'className' ) && ! props.className ) {\n\t\t\t\tdelete props.className;\n\t\t\t}\n\n\t\t\treturn props;\n\t\t}\n\t);\n}\n"],
|
|
5
|
-
"mappings": ";AAGA,OAAO,UAAU;AAKjB,SAAS,uBAAuB;AAChC,SAAS,MAAM,SAAS,WAAW,OAAO,gBAAgB;AAC1D,SAAS,aAAa,mBAAmB;AACzC,SAAS,kCAAkC;AAC3C,SAAS,iBAAiB;AAK1B;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,SAAS,mBAAmB;AAC5B,SAAS,kCAAkC;AAC3C,SAAS,wBAAwB,oBAAoB;AACrD,SAAS,SAAS,wBAAwB;AAC1C,SAAS,cAAc;
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { getBlockSupport } from '@wordpress/blocks';\nimport { memo, useMemo, useEffect, useId, useState } from '@wordpress/element';\nimport { useDispatch, useRegistry } from '@wordpress/data';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport { addFilter } from '@wordpress/hooks';\n\n/**\n * Internal dependencies\n */\nimport {\n\tuseBlockEditContext,\n\tmayDisplayControlsKey,\n\tmayDisplayParentControlsKey,\n\tmayDisplayPatternEditingControlsKey,\n} from '../components/block-edit/context';\nimport { useSettings } from '../components';\nimport { useSettingsForBlockElement } from '../components/global-styles/hooks';\nimport { getValueFromObjectPath, setImmutably } from '../utils/object';\nimport { store as blockEditorStore } from '../store';\nimport { unlock } from '../lock-unlock';\n\n/**\n * Removed falsy values from nested object.\n *\n * @param {*} object\n * @return {*} Object cleaned from falsy values\n */\nexport const cleanEmptyObject = ( object ) => {\n\tif (\n\t\tobject === null ||\n\t\ttypeof object !== 'object' ||\n\t\tArray.isArray( object )\n\t) {\n\t\treturn object;\n\t}\n\n\tconst cleanedNestedObjects = Object.entries( object )\n\t\t.map( ( [ key, value ] ) => [ key, cleanEmptyObject( value ) ] )\n\t\t.filter( ( [ , value ] ) => value !== undefined );\n\treturn ! cleanedNestedObjects.length\n\t\t? undefined\n\t\t: Object.fromEntries( cleanedNestedObjects );\n};\n\nexport function transformStyles(\n\tactiveSupports,\n\tmigrationPaths,\n\tresult,\n\tsource,\n\tindex,\n\tresults\n) {\n\t// If there are no active supports return early.\n\tif (\n\t\tObject.values( activeSupports ?? {} ).every(\n\t\t\t( isActive ) => ! isActive\n\t\t)\n\t) {\n\t\treturn result;\n\t}\n\t// If the condition verifies we are probably in the presence of a wrapping transform\n\t// e.g: nesting paragraphs in a group or columns and in that case the styles should not be transformed.\n\tif ( results.length === 1 && result.innerBlocks.length === source.length ) {\n\t\treturn result;\n\t}\n\t// For cases where we have a transform from one block to multiple blocks\n\t// or multiple blocks to one block we apply the styles of the first source block\n\t// to the result(s).\n\tlet referenceBlockAttributes = source[ 0 ]?.attributes;\n\t// If we are in presence of transform between more than one block in the source\n\t// that has more than one block in the result\n\t// we apply the styles on source N to the result N,\n\t// if source N does not exists we do nothing.\n\tif ( results.length > 1 && source.length > 1 ) {\n\t\tif ( source[ index ] ) {\n\t\t\treferenceBlockAttributes = source[ index ]?.attributes;\n\t\t} else {\n\t\t\treturn result;\n\t\t}\n\t}\n\tlet returnBlock = result;\n\tObject.entries( activeSupports ).forEach( ( [ support, isActive ] ) => {\n\t\tif ( isActive ) {\n\t\t\tmigrationPaths[ support ].forEach( ( path ) => {\n\t\t\t\tconst styleValue = getValueFromObjectPath(\n\t\t\t\t\treferenceBlockAttributes,\n\t\t\t\t\tpath\n\t\t\t\t);\n\t\t\t\tif ( styleValue ) {\n\t\t\t\t\treturnBlock = {\n\t\t\t\t\t\t...returnBlock,\n\t\t\t\t\t\tattributes: setImmutably(\n\t\t\t\t\t\t\treturnBlock.attributes,\n\t\t\t\t\t\t\tpath,\n\t\t\t\t\t\t\tstyleValue\n\t\t\t\t\t\t),\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t} );\n\t\t}\n\t} );\n\treturn returnBlock;\n}\n\n/**\n * Check whether serialization of specific block support feature or set should\n * be skipped.\n *\n * @param {string|Object} blockNameOrType Block name or block type object.\n * @param {string} featureSet Name of block support feature set.\n * @param {string} feature Name of the individual feature to check.\n *\n * @return {boolean} Whether serialization should occur.\n */\nexport function shouldSkipSerialization(\n\tblockNameOrType,\n\tfeatureSet,\n\tfeature\n) {\n\tconst support = getBlockSupport( blockNameOrType, featureSet );\n\tconst skipSerialization = support?.__experimentalSkipSerialization;\n\n\tif ( Array.isArray( skipSerialization ) ) {\n\t\treturn skipSerialization.includes( feature );\n\t}\n\n\treturn skipSerialization;\n}\n\nconst pendingStyleOverrides = new WeakMap();\n\n/**\n * Override a block editor settings style. Leave the ID blank to create a new\n * style.\n *\n * @param {Object} override Override object.\n * @param {?string} override.id Id of the style override, leave blank to create\n * a new style.\n * @param {string} override.css CSS to apply.\n */\nexport function useStyleOverride( { id, css } ) {\n\treturn usePrivateStyleOverride( { id, css } );\n}\n\nexport function usePrivateStyleOverride( {\n\tid,\n\tcss,\n\tassets,\n\t__unstableType,\n\tvariation,\n\tclientId,\n} = {} ) {\n\tconst { setStyleOverride, deleteStyleOverride } = unlock(\n\t\tuseDispatch( blockEditorStore )\n\t);\n\tconst registry = useRegistry();\n\tconst fallbackId = useId();\n\tuseEffect( () => {\n\t\t// Unmount if there is CSS and assets are empty.\n\t\tif ( ! css && ! assets ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst _id = id || fallbackId;\n\t\tconst override = {\n\t\t\tid,\n\t\t\tcss,\n\t\t\tassets,\n\t\t\t__unstableType,\n\t\t\tvariation,\n\t\t\tclientId,\n\t\t};\n\t\t// Batch updates to style overrides to avoid triggering cascading renders\n\t\t// for each style override block included in a tree and optimize initial render.\n\t\tif ( ! pendingStyleOverrides.get( registry ) ) {\n\t\t\tpendingStyleOverrides.set( registry, [] );\n\t\t}\n\t\tpendingStyleOverrides.get( registry ).push( [ _id, override ] );\n\t\twindow.queueMicrotask( () => {\n\t\t\tif ( pendingStyleOverrides.get( registry )?.length ) {\n\t\t\t\tregistry.batch( () => {\n\t\t\t\t\tpendingStyleOverrides.get( registry ).forEach( ( args ) => {\n\t\t\t\t\t\tsetStyleOverride( ...args );\n\t\t\t\t\t} );\n\t\t\t\t\tpendingStyleOverrides.set( registry, [] );\n\t\t\t\t} );\n\t\t\t}\n\t\t} );\n\n\t\treturn () => {\n\t\t\tconst isPending = pendingStyleOverrides\n\t\t\t\t.get( registry )\n\t\t\t\t?.find( ( [ currentId ] ) => currentId === _id );\n\t\t\tif ( isPending ) {\n\t\t\t\tpendingStyleOverrides.set(\n\t\t\t\t\tregistry,\n\t\t\t\t\tpendingStyleOverrides\n\t\t\t\t\t\t.get( registry )\n\t\t\t\t\t\t.filter( ( [ currentId ] ) => currentId !== _id )\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tdeleteStyleOverride( _id );\n\t\t\t}\n\t\t};\n\t}, [\n\t\tid,\n\t\tcss,\n\t\tclientId,\n\t\tassets,\n\t\t__unstableType,\n\t\tfallbackId,\n\t\tsetStyleOverride,\n\t\tdeleteStyleOverride,\n\t\tregistry,\n\t\tvariation,\n\t] );\n}\n\n/**\n * Based on the block and its context, returns an object of all the block settings.\n * This object can be passed as a prop to all the Styles UI components\n * (TypographyPanel, DimensionsPanel...).\n *\n * @param {string} name Block name.\n * @param {*} parentLayout Parent layout.\n *\n * @return {Object} Settings object.\n */\nexport function useBlockSettings( name, parentLayout ) {\n\tconst [\n\t\tbackgroundImage,\n\t\tbackgroundSize,\n\t\tcustomFontFamilies,\n\t\tdefaultFontFamilies,\n\t\tthemeFontFamilies,\n\t\tdefaultFontSizesEnabled,\n\t\tcustomFontSizes,\n\t\tdefaultFontSizes,\n\t\tthemeFontSizes,\n\t\tcustomFontSize,\n\t\tfontStyle,\n\t\tfontWeight,\n\t\tlineHeight,\n\t\ttextAlign,\n\t\ttextColumns,\n\t\ttextDecoration,\n\t\twritingMode,\n\t\ttextTransform,\n\t\tletterSpacing,\n\t\tpadding,\n\t\tmargin,\n\t\tblockGap,\n\t\tdefaultSpacingSizesEnabled,\n\t\tcustomSpacingSize,\n\t\tuserSpacingSizes,\n\t\tdefaultSpacingSizes,\n\t\tthemeSpacingSizes,\n\t\tunits,\n\t\taspectRatio,\n\t\theight,\n\t\tminHeight,\n\t\twidth,\n\t\tdimensionSizes,\n\t\tlayout,\n\t\tborderColor,\n\t\tborderRadius,\n\t\tborderStyle,\n\t\tborderWidth,\n\t\tborderRadiusSizes,\n\t\tcustomColorsEnabled,\n\t\tcustomColors,\n\t\tcustomDuotone,\n\t\tthemeColors,\n\t\tdefaultColors,\n\t\tdefaultPalette,\n\t\tdefaultDuotone,\n\t\tuserDuotonePalette,\n\t\tthemeDuotonePalette,\n\t\tdefaultDuotonePalette,\n\t\tuserGradientPalette,\n\t\tthemeGradientPalette,\n\t\tdefaultGradientPalette,\n\t\tdefaultGradients,\n\t\tareCustomGradientsEnabled,\n\t\tisBackgroundEnabled,\n\t\tisLinkEnabled,\n\t\tisTextEnabled,\n\t\tisHeadingEnabled,\n\t\tisButtonEnabled,\n\t\tshadow,\n\t] = useSettings(\n\t\t'background.backgroundImage',\n\t\t'background.backgroundSize',\n\t\t'typography.fontFamilies.custom',\n\t\t'typography.fontFamilies.default',\n\t\t'typography.fontFamilies.theme',\n\t\t'typography.defaultFontSizes',\n\t\t'typography.fontSizes.custom',\n\t\t'typography.fontSizes.default',\n\t\t'typography.fontSizes.theme',\n\t\t'typography.customFontSize',\n\t\t'typography.fontStyle',\n\t\t'typography.fontWeight',\n\t\t'typography.lineHeight',\n\t\t'typography.textAlign',\n\t\t'typography.textColumns',\n\t\t'typography.textDecoration',\n\t\t'typography.writingMode',\n\t\t'typography.textTransform',\n\t\t'typography.letterSpacing',\n\t\t'spacing.padding',\n\t\t'spacing.margin',\n\t\t'spacing.blockGap',\n\t\t'spacing.defaultSpacingSizes',\n\t\t'spacing.customSpacingSize',\n\t\t'spacing.spacingSizes.custom',\n\t\t'spacing.spacingSizes.default',\n\t\t'spacing.spacingSizes.theme',\n\t\t'spacing.units',\n\t\t'dimensions.aspectRatio',\n\t\t'dimensions.height',\n\t\t'dimensions.minHeight',\n\t\t'dimensions.width',\n\t\t'dimensions.dimensionSizes',\n\t\t'layout',\n\t\t'border.color',\n\t\t'border.radius',\n\t\t'border.style',\n\t\t'border.width',\n\t\t'border.radiusSizes',\n\t\t'color.custom',\n\t\t'color.palette.custom',\n\t\t'color.customDuotone',\n\t\t'color.palette.theme',\n\t\t'color.palette.default',\n\t\t'color.defaultPalette',\n\t\t'color.defaultDuotone',\n\t\t'color.duotone.custom',\n\t\t'color.duotone.theme',\n\t\t'color.duotone.default',\n\t\t'color.gradients.custom',\n\t\t'color.gradients.theme',\n\t\t'color.gradients.default',\n\t\t'color.defaultGradients',\n\t\t'color.customGradient',\n\t\t'color.background',\n\t\t'color.link',\n\t\t'color.text',\n\t\t'color.heading',\n\t\t'color.button',\n\t\t'shadow'\n\t);\n\n\tconst rawSettings = useMemo( () => {\n\t\treturn {\n\t\t\tbackground: {\n\t\t\t\tbackgroundImage,\n\t\t\t\tbackgroundSize,\n\t\t\t},\n\t\t\tcolor: {\n\t\t\t\tpalette: {\n\t\t\t\t\tcustom: customColors,\n\t\t\t\t\ttheme: themeColors,\n\t\t\t\t\tdefault: defaultColors,\n\t\t\t\t},\n\t\t\t\tgradients: {\n\t\t\t\t\tcustom: userGradientPalette,\n\t\t\t\t\ttheme: themeGradientPalette,\n\t\t\t\t\tdefault: defaultGradientPalette,\n\t\t\t\t},\n\t\t\t\tduotone: {\n\t\t\t\t\tcustom: userDuotonePalette,\n\t\t\t\t\ttheme: themeDuotonePalette,\n\t\t\t\t\tdefault: defaultDuotonePalette,\n\t\t\t\t},\n\t\t\t\tdefaultGradients,\n\t\t\t\tdefaultPalette,\n\t\t\t\tdefaultDuotone,\n\t\t\t\tcustom: customColorsEnabled,\n\t\t\t\tcustomGradient: areCustomGradientsEnabled,\n\t\t\t\tcustomDuotone,\n\t\t\t\tbackground: isBackgroundEnabled,\n\t\t\t\tlink: isLinkEnabled,\n\t\t\t\theading: isHeadingEnabled,\n\t\t\t\tbutton: isButtonEnabled,\n\t\t\t\ttext: isTextEnabled,\n\t\t\t},\n\t\t\ttypography: {\n\t\t\t\tfontFamilies: {\n\t\t\t\t\tcustom: customFontFamilies,\n\t\t\t\t\tdefault: defaultFontFamilies,\n\t\t\t\t\ttheme: themeFontFamilies,\n\t\t\t\t},\n\t\t\t\tfontSizes: {\n\t\t\t\t\tcustom: customFontSizes,\n\t\t\t\t\tdefault: defaultFontSizes,\n\t\t\t\t\ttheme: themeFontSizes,\n\t\t\t\t},\n\t\t\t\tcustomFontSize,\n\t\t\t\tdefaultFontSizes: defaultFontSizesEnabled,\n\t\t\t\tfontStyle,\n\t\t\t\tfontWeight,\n\t\t\t\tlineHeight,\n\t\t\t\ttextAlign,\n\t\t\t\ttextColumns,\n\t\t\t\ttextDecoration,\n\t\t\t\ttextTransform,\n\t\t\t\tletterSpacing,\n\t\t\t\twritingMode,\n\t\t\t},\n\t\t\tspacing: {\n\t\t\t\tspacingSizes: {\n\t\t\t\t\tcustom: userSpacingSizes,\n\t\t\t\t\tdefault: defaultSpacingSizes,\n\t\t\t\t\ttheme: themeSpacingSizes,\n\t\t\t\t},\n\t\t\t\tcustomSpacingSize,\n\t\t\t\tdefaultSpacingSizes: defaultSpacingSizesEnabled,\n\t\t\t\tpadding,\n\t\t\t\tmargin,\n\t\t\t\tblockGap,\n\t\t\t\tunits,\n\t\t\t},\n\t\t\tborder: {\n\t\t\t\tcolor: borderColor,\n\t\t\t\tradius: borderRadius,\n\t\t\t\tstyle: borderStyle,\n\t\t\t\twidth: borderWidth,\n\t\t\t\tradiusSizes: borderRadiusSizes,\n\t\t\t},\n\t\t\tdimensions: {\n\t\t\t\taspectRatio,\n\t\t\t\theight,\n\t\t\t\tminHeight,\n\t\t\t\twidth,\n\t\t\t\tdimensionSizes,\n\t\t\t},\n\t\t\tlayout,\n\t\t\tparentLayout,\n\t\t\tshadow,\n\t\t};\n\t}, [\n\t\tbackgroundImage,\n\t\tbackgroundSize,\n\t\tcustomFontFamilies,\n\t\tdefaultFontFamilies,\n\t\tthemeFontFamilies,\n\t\tdefaultFontSizesEnabled,\n\t\tcustomFontSizes,\n\t\tdefaultFontSizes,\n\t\tthemeFontSizes,\n\t\tcustomFontSize,\n\t\tfontStyle,\n\t\tfontWeight,\n\t\tlineHeight,\n\t\ttextAlign,\n\t\ttextColumns,\n\t\ttextDecoration,\n\t\ttextTransform,\n\t\tletterSpacing,\n\t\twritingMode,\n\t\tpadding,\n\t\tmargin,\n\t\tblockGap,\n\t\tdefaultSpacingSizesEnabled,\n\t\tcustomSpacingSize,\n\t\tuserSpacingSizes,\n\t\tdefaultSpacingSizes,\n\t\tthemeSpacingSizes,\n\t\tunits,\n\t\taspectRatio,\n\t\theight,\n\t\tminHeight,\n\t\twidth,\n\t\tdimensionSizes,\n\t\tlayout,\n\t\tparentLayout,\n\t\tborderColor,\n\t\tborderRadius,\n\t\tborderStyle,\n\t\tborderWidth,\n\t\tborderRadiusSizes,\n\t\tcustomColorsEnabled,\n\t\tcustomColors,\n\t\tcustomDuotone,\n\t\tthemeColors,\n\t\tdefaultColors,\n\t\tdefaultPalette,\n\t\tdefaultDuotone,\n\t\tuserDuotonePalette,\n\t\tthemeDuotonePalette,\n\t\tdefaultDuotonePalette,\n\t\tuserGradientPalette,\n\t\tthemeGradientPalette,\n\t\tdefaultGradientPalette,\n\t\tdefaultGradients,\n\t\tareCustomGradientsEnabled,\n\t\tisBackgroundEnabled,\n\t\tisLinkEnabled,\n\t\tisTextEnabled,\n\t\tisHeadingEnabled,\n\t\tisButtonEnabled,\n\t\tshadow,\n\t] );\n\n\treturn useSettingsForBlockElement( rawSettings, name );\n}\n\nexport function createBlockEditFilter( features ) {\n\t// We don't want block controls to re-render when typing inside a block.\n\t// `memo` will prevent re-renders unless props change, so only pass the\n\t// needed props and not the whole attributes object.\n\tfeatures = features.map( ( settings ) => {\n\t\treturn { ...settings, Edit: memo( settings.edit ) };\n\t} );\n\tconst withBlockEditHooks = createHigherOrderComponent(\n\t\t( OriginalBlockEdit ) =>\n\t\t\tfunction WithBlockEditHooks( props ) {\n\t\t\t\tconst context = useBlockEditContext();\n\t\t\t\t// CAUTION: code added before this line will be executed for all\n\t\t\t\t// blocks, not just those that support the feature! Code added\n\t\t\t\t// above this line should be carefully evaluated for its impact on\n\t\t\t\t// performance.\n\t\t\t\treturn [\n\t\t\t\t\t...features.map( ( feature, i ) => {\n\t\t\t\t\t\tconst {\n\t\t\t\t\t\t\tEdit,\n\t\t\t\t\t\t\thasSupport,\n\t\t\t\t\t\t\tattributeKeys = [],\n\t\t\t\t\t\t\tshareWithChildBlocks,\n\t\t\t\t\t\t\tsupportsPatternEditing,\n\t\t\t\t\t\t} = feature;\n\t\t\t\t\t\tconst shouldDisplayControls =\n\t\t\t\t\t\t\t( supportsPatternEditing &&\n\t\t\t\t\t\t\t\tcontext[\n\t\t\t\t\t\t\t\t\tmayDisplayPatternEditingControlsKey\n\t\t\t\t\t\t\t\t] ) ||\n\t\t\t\t\t\t\tcontext[ mayDisplayControlsKey ] ||\n\t\t\t\t\t\t\t( context[ mayDisplayParentControlsKey ] &&\n\t\t\t\t\t\t\t\tshareWithChildBlocks );\n\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t! shouldDisplayControls ||\n\t\t\t\t\t\t\t! hasSupport( props.name )\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\treturn null;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst neededProps = {};\n\t\t\t\t\t\tfor ( const key of attributeKeys ) {\n\t\t\t\t\t\t\tif ( props.attributes[ key ] ) {\n\t\t\t\t\t\t\t\tneededProps[ key ] = props.attributes[ key ];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<Edit\n\t\t\t\t\t\t\t\t// We can use the index because the array length\n\t\t\t\t\t\t\t\t// is fixed per page load right now.\n\t\t\t\t\t\t\t\tkey={ i }\n\t\t\t\t\t\t\t\tname={ props.name }\n\t\t\t\t\t\t\t\tisSelected={ props.isSelected }\n\t\t\t\t\t\t\t\tclientId={ props.clientId }\n\t\t\t\t\t\t\t\tsetAttributes={ props.setAttributes }\n\t\t\t\t\t\t\t\t__unstableParentLayout={\n\t\t\t\t\t\t\t\t\tprops.__unstableParentLayout\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t// This component is pure, so only pass needed\n\t\t\t\t\t\t\t\t// props!!!\n\t\t\t\t\t\t\t\t{ ...neededProps }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t);\n\t\t\t\t\t} ),\n\t\t\t\t\t<OriginalBlockEdit key=\"edit\" { ...props } />,\n\t\t\t\t];\n\t\t\t},\n\t\t'withBlockEditHooks'\n\t);\n\taddFilter( 'editor.BlockEdit', 'core/editor/hooks', withBlockEditHooks );\n}\n\nfunction BlockProps( {\n\tindex,\n\tuseBlockProps: hook,\n\tsetAllWrapperProps,\n\t...props\n} ) {\n\tconst wrapperProps = hook( props );\n\tconst setWrapperProps = ( next ) =>\n\t\tsetAllWrapperProps( ( prev ) => {\n\t\t\tconst nextAll = [ ...prev ];\n\t\t\tnextAll[ index ] = next;\n\t\t\treturn nextAll;\n\t\t} );\n\t// Setting state after every render is fine because this component is\n\t// pure and will only re-render when needed props change.\n\tuseEffect( () => {\n\t\t// We could shallow compare the props, but since this component only\n\t\t// changes when needed attributes change, the benefit is probably small.\n\t\tsetWrapperProps( wrapperProps );\n\t\treturn () => {\n\t\t\tsetWrapperProps( undefined );\n\t\t};\n\t} );\n\treturn null;\n}\n\nconst BlockPropsPure = memo( BlockProps );\n\nexport function createBlockListBlockFilter( features ) {\n\tconst withBlockListBlockHooks = createHigherOrderComponent(\n\t\t( BlockListBlock ) =>\n\t\t\tfunction WithBlockListBlockHooks( props ) {\n\t\t\t\tconst [ allWrapperProps, setAllWrapperProps ] = useState(\n\t\t\t\t\tArray( features.length ).fill( undefined )\n\t\t\t\t);\n\t\t\t\treturn [\n\t\t\t\t\t...features.map( ( feature, i ) => {\n\t\t\t\t\t\tconst {\n\t\t\t\t\t\t\thasSupport,\n\t\t\t\t\t\t\tattributeKeys = [],\n\t\t\t\t\t\t\tuseBlockProps,\n\t\t\t\t\t\t\tisMatch,\n\t\t\t\t\t\t} = feature;\n\n\t\t\t\t\t\tconst neededProps = {};\n\t\t\t\t\t\tfor ( const key of attributeKeys ) {\n\t\t\t\t\t\t\tif ( props.attributes[ key ] ) {\n\t\t\t\t\t\t\t\tneededProps[ key ] = props.attributes[ key ];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t// Skip rendering if none of the needed attributes are\n\t\t\t\t\t\t\t// set.\n\t\t\t\t\t\t\t! Object.keys( neededProps ).length ||\n\t\t\t\t\t\t\t! hasSupport( props.name ) ||\n\t\t\t\t\t\t\t( isMatch && ! isMatch( neededProps ) )\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\treturn null;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<BlockPropsPure\n\t\t\t\t\t\t\t\t// We can use the index because the array length\n\t\t\t\t\t\t\t\t// is fixed per page load right now.\n\t\t\t\t\t\t\t\tkey={ i }\n\t\t\t\t\t\t\t\tindex={ i }\n\t\t\t\t\t\t\t\tuseBlockProps={ useBlockProps }\n\t\t\t\t\t\t\t\t// This component is pure, so we must pass a stable\n\t\t\t\t\t\t\t\t// function reference.\n\t\t\t\t\t\t\t\tsetAllWrapperProps={ setAllWrapperProps }\n\t\t\t\t\t\t\t\tname={ props.name }\n\t\t\t\t\t\t\t\tclientId={ props.clientId }\n\t\t\t\t\t\t\t\t// This component is pure, so only pass needed\n\t\t\t\t\t\t\t\t// props!!!\n\t\t\t\t\t\t\t\t{ ...neededProps }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t);\n\t\t\t\t\t} ),\n\t\t\t\t\t<BlockListBlock\n\t\t\t\t\t\tkey=\"edit\"\n\t\t\t\t\t\t{ ...props }\n\t\t\t\t\t\twrapperProps={ allWrapperProps\n\t\t\t\t\t\t\t.filter( Boolean )\n\t\t\t\t\t\t\t.reduce( ( acc, wrapperProps ) => {\n\t\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t\t...acc,\n\t\t\t\t\t\t\t\t\t...wrapperProps,\n\t\t\t\t\t\t\t\t\tclassName: clsx(\n\t\t\t\t\t\t\t\t\t\tacc.className,\n\t\t\t\t\t\t\t\t\t\twrapperProps.className\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\t\t\t\t...acc.style,\n\t\t\t\t\t\t\t\t\t\t...wrapperProps.style,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t}, props.wrapperProps || {} ) }\n\t\t\t\t\t/>,\n\t\t\t\t];\n\t\t\t},\n\t\t'withBlockListBlockHooks'\n\t);\n\taddFilter(\n\t\t'editor.BlockListBlock',\n\t\t'core/editor/hooks',\n\t\twithBlockListBlockHooks\n\t);\n}\n\nexport function createBlockSaveFilter( features ) {\n\tfunction extraPropsFromHooks( props, name, attributes ) {\n\t\treturn features.reduce( ( accu, feature ) => {\n\t\t\tconst { hasSupport, attributeKeys = [], addSaveProps } = feature;\n\n\t\t\tconst neededAttributes = {};\n\t\t\tfor ( const key of attributeKeys ) {\n\t\t\t\tif ( attributes[ key ] ) {\n\t\t\t\t\tneededAttributes[ key ] = attributes[ key ];\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\t// Skip rendering if none of the needed attributes are\n\t\t\t\t// set.\n\t\t\t\t! Object.keys( neededAttributes ).length ||\n\t\t\t\t! hasSupport( name )\n\t\t\t) {\n\t\t\t\treturn accu;\n\t\t\t}\n\n\t\t\treturn addSaveProps( accu, name, neededAttributes );\n\t\t}, props );\n\t}\n\taddFilter(\n\t\t'blocks.getSaveContent.extraProps',\n\t\t'core/editor/hooks',\n\t\textraPropsFromHooks,\n\t\t0\n\t);\n\taddFilter(\n\t\t'blocks.getSaveContent.extraProps',\n\t\t'core/editor/hooks',\n\t\t( props ) => {\n\t\t\t// Previously we had a filter deleting the className if it was an empty\n\t\t\t// string. That filter is no longer running, so now we need to delete it\n\t\t\t// here.\n\t\t\tif ( props.hasOwnProperty( 'className' ) && ! props.className ) {\n\t\t\t\tdelete props.className;\n\t\t\t}\n\n\t\t\treturn props;\n\t\t}\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";AAGA,OAAO,UAAU;AAKjB,SAAS,uBAAuB;AAChC,SAAS,MAAM,SAAS,WAAW,OAAO,gBAAgB;AAC1D,SAAS,aAAa,mBAAmB;AACzC,SAAS,kCAAkC;AAC3C,SAAS,iBAAiB;AAK1B;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,SAAS,mBAAmB;AAC5B,SAAS,kCAAkC;AAC3C,SAAS,wBAAwB,oBAAoB;AACrD,SAAS,SAAS,wBAAwB;AAC1C,SAAS,cAAc;AAyhBhB;AAjhBA,IAAM,mBAAmB,CAAE,WAAY;AAC7C,MACC,WAAW,QACX,OAAO,WAAW,YAClB,MAAM,QAAS,MAAO,GACrB;AACD,WAAO;AAAA,EACR;AAEA,QAAM,uBAAuB,OAAO,QAAS,MAAO,EAClD,IAAK,CAAE,CAAE,KAAK,KAAM,MAAO,CAAE,KAAK,iBAAkB,KAAM,CAAE,CAAE,EAC9D,OAAQ,CAAE,CAAE,EAAE,KAAM,MAAO,UAAU,MAAU;AACjD,SAAO,CAAE,qBAAqB,SAC3B,SACA,OAAO,YAAa,oBAAqB;AAC7C;AAEO,SAAS,gBACf,gBACA,gBACA,QACA,QACA,OACA,SACC;AAED,MACC,OAAO,OAAQ,kBAAkB,CAAC,CAAE,EAAE;AAAA,IACrC,CAAE,aAAc,CAAE;AAAA,EACnB,GACC;AACD,WAAO;AAAA,EACR;AAGA,MAAK,QAAQ,WAAW,KAAK,OAAO,YAAY,WAAW,OAAO,QAAS;AAC1E,WAAO;AAAA,EACR;AAIA,MAAI,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AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD,IAAI;AAAA,IACH;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD;AAEA,QAAM,cAAc,QAAS,MAAM;AAClC,WAAO;AAAA,MACN,YAAY;AAAA,QACX;AAAA,QACA;AAAA,MAC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,iBAAY,OAAO,eAAgB;AAClC,YAAK,WAAY,GAAI,GAAI;AACxB,2BAAkB,GAAI,IAAI,WAAY,GAAI;AAAA,QAC3C;AAAA,MACD;AAEA;AAAA;AAAA;AAAA,QAGC,CAAE,OAAO,KAAM,gBAAiB,EAAE,UAClC,CAAE,WAAY,IAAK;AAAA,QAClB;AACD,eAAO;AAAA,MACR;AAEA,aAAO,aAAc,MAAM,MAAM,gBAAiB;AAAA,IACnD,GAAG,KAAM;AAAA,EACV;AACA;AAAA,IACC;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD;AACA;AAAA,IACC;AAAA,IACA;AAAA,IACA,CAAE,UAAW;AAIZ,UAAK,MAAM,eAAgB,WAAY,KAAK,CAAE,MAAM,WAAY;AAC/D,eAAO,MAAM;AAAA,MACd;AAEA,aAAO;AAAA,IACR;AAAA,EACD;AACD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -100,6 +100,7 @@ var grid_default = {
|
|
|
100
100
|
style,
|
|
101
101
|
blockName,
|
|
102
102
|
hasBlockGapSupport,
|
|
103
|
+
globalBlockGapValue,
|
|
103
104
|
layoutDefinitions = LAYOUT_DEFINITIONS
|
|
104
105
|
}) {
|
|
105
106
|
const {
|
|
@@ -119,10 +120,20 @@ var grid_default = {
|
|
|
119
120
|
}
|
|
120
121
|
}
|
|
121
122
|
const blockGapValue = style?.spacing?.blockGap && !shouldSkipSerialization(blockName, "spacing", "blockGap") ? getGapCSSValue(style?.spacing?.blockGap, "0.5em") : void 0;
|
|
123
|
+
let fallbackGapValue = "1.2rem";
|
|
124
|
+
if (globalBlockGapValue) {
|
|
125
|
+
const processedGap = getGapCSSValue(globalBlockGapValue, "0.5em");
|
|
126
|
+
const gapParts = processedGap.split(" ");
|
|
127
|
+
fallbackGapValue = gapParts.length > 1 ? gapParts[1] : gapParts[0];
|
|
128
|
+
}
|
|
122
129
|
let output = "";
|
|
123
130
|
const rules = [];
|
|
124
131
|
if (minimumColumnWidth && columnCount > 0) {
|
|
125
|
-
|
|
132
|
+
let blockGapToUse = blockGapValue || fallbackGapValue;
|
|
133
|
+
if (blockGapToUse === "0" || blockGapToUse === 0) {
|
|
134
|
+
blockGapToUse = "0px";
|
|
135
|
+
}
|
|
136
|
+
const maxValue = `max(min( ${minimumColumnWidth}, 100%), ( 100% - (${blockGapToUse}*${columnCount - 1}) ) / ${columnCount})`;
|
|
126
137
|
rules.push(
|
|
127
138
|
`grid-template-columns: repeat(auto-fill, minmax(${maxValue}, 1fr))`,
|
|
128
139
|
`container-type: inline-size`
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/layouts/grid.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\nimport {\n\tBaseControl,\n\tFlex,\n\tFlexItem,\n\tRangeControl,\n\t__experimentalNumberControl as NumberControl,\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOption as ToggleGroupControlOption,\n\t__experimentalUnitControl as UnitControl,\n\t__experimentalParseQuantityAndUnitFromRawValue as parseQuantityAndUnitFromRawValue,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { appendSelectors, getBlockGapCSS } from './utils';\nimport { getGapCSSValue } from '../hooks/gap';\nimport { shouldSkipSerialization } from '../hooks/utils';\nimport { LAYOUT_DEFINITIONS } from './definitions';\n\nconst RANGE_CONTROL_MAX_VALUES = {\n\tpx: 600,\n\t'%': 100,\n\tvw: 100,\n\tvh: 100,\n\tem: 38,\n\trem: 38,\n\tsvw: 100,\n\tlvw: 100,\n\tdvw: 100,\n\tsvh: 100,\n\tlvh: 100,\n\tdvh: 100,\n\tvi: 100,\n\tsvi: 100,\n\tlvi: 100,\n\tdvi: 100,\n\tvb: 100,\n\tsvb: 100,\n\tlvb: 100,\n\tdvb: 100,\n\tvmin: 100,\n\tsvmin: 100,\n\tlvmin: 100,\n\tdvmin: 100,\n\tvmax: 100,\n\tsvmax: 100,\n\tlvmax: 100,\n\tdvmax: 100,\n};\n\nconst units = [\n\t{ value: 'px', label: 'px', default: 0 },\n\t{ value: 'rem', label: 'rem', default: 0 },\n\t{ value: 'em', label: 'em', default: 0 },\n];\n\nexport default {\n\tname: 'grid',\n\tlabel: __( 'Grid' ),\n\tinspectorControls: function GridLayoutInspectorControls( {\n\t\tlayout = {},\n\t\tonChange,\n\t\tlayoutBlockSupport = {},\n\t} ) {\n\t\tconst { allowSizingOnChildren = false } = layoutBlockSupport;\n\n\t\t// Always show both column and minimum width controls in Auto mode.\n\t\t// Manual mode (with isManualPlacement) is only available behind the experiment flag.\n\t\tconst showColumnsControl = true;\n\t\tconst showMinWidthControl =\n\t\t\t! layout?.isManualPlacement ||\n\t\t\twindow.__experimentalEnableGridInteractivity;\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ window.__experimentalEnableGridInteractivity && (\n\t\t\t\t\t<GridLayoutTypeControl\n\t\t\t\t\t\tlayout={ layout }\n\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t<VStack spacing={ 4 }>\n\t\t\t\t\t{ showColumnsControl && (\n\t\t\t\t\t\t<GridLayoutColumnsAndRowsControl\n\t\t\t\t\t\t\tlayout={ layout }\n\t\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\t\tallowSizingOnChildren={ allowSizingOnChildren }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t{ showMinWidthControl && (\n\t\t\t\t\t\t<GridLayoutMinimumWidthControl\n\t\t\t\t\t\t\tlayout={ layout }\n\t\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</VStack>\n\t\t\t</>\n\t\t);\n\t},\n\ttoolBarControls: function GridLayoutToolbarControls() {\n\t\treturn null;\n\t},\n\tgetLayoutStyle: function getLayoutStyle( {\n\t\tselector,\n\t\tlayout,\n\t\tstyle,\n\t\tblockName,\n\t\thasBlockGapSupport,\n\t\tlayoutDefinitions = LAYOUT_DEFINITIONS,\n\t} ) {\n\t\tconst {\n\t\t\tminimumColumnWidth = null,\n\t\t\tcolumnCount = null,\n\t\t\trowCount = null,\n\t\t} = layout;\n\n\t\t// Check that the grid layout attributes are of the correct type, so that we don't accidentally\n\t\t// write code that stores a string attribute instead of a number.\n\t\tif ( process.env.NODE_ENV === 'development' ) {\n\t\t\tif (\n\t\t\t\tminimumColumnWidth &&\n\t\t\t\ttypeof minimumColumnWidth !== 'string'\n\t\t\t) {\n\t\t\t\tthrow new Error( 'minimumColumnWidth must be a string' );\n\t\t\t}\n\t\t\tif ( columnCount && typeof columnCount !== 'number' ) {\n\t\t\t\tthrow new Error( 'columnCount must be a number' );\n\t\t\t}\n\t\t\tif ( rowCount && typeof rowCount !== 'number' ) {\n\t\t\t\tthrow new Error( 'rowCount must be a number' );\n\t\t\t}\n\t\t}\n\n\t\t// If a block's block.json skips serialization for spacing or spacing.blockGap,\n\t\t// don't apply the user-defined value to the styles.\n\t\tconst blockGapValue =\n\t\t\tstyle?.spacing?.blockGap &&\n\t\t\t! shouldSkipSerialization( blockName, 'spacing', 'blockGap' )\n\t\t\t\t? getGapCSSValue( style?.spacing?.blockGap, '0.5em' )\n\t\t\t\t: undefined;\n\n\t\tlet output = '';\n\t\tconst rules = [];\n\n\t\tif ( minimumColumnWidth && columnCount > 0 ) {\n\t\t\tconst maxValue = `max(${ minimumColumnWidth }, ( 100% - (${\n\t\t\t\tblockGapValue || '1.2rem'\n\t\t\t}*${ columnCount - 1 }) ) / ${ columnCount })`;\n\t\t\trules.push(\n\t\t\t\t`grid-template-columns: repeat(auto-fill, minmax(${ maxValue }, 1fr))`,\n\t\t\t\t`container-type: inline-size`\n\t\t\t);\n\t\t\tif ( rowCount ) {\n\t\t\t\trules.push(\n\t\t\t\t\t`grid-template-rows: repeat(${ rowCount }, minmax(1rem, auto))`\n\t\t\t\t);\n\t\t\t}\n\t\t} else if ( columnCount ) {\n\t\t\trules.push(\n\t\t\t\t`grid-template-columns: repeat(${ columnCount }, minmax(0, 1fr))`\n\t\t\t);\n\t\t\tif ( rowCount ) {\n\t\t\t\trules.push(\n\t\t\t\t\t`grid-template-rows: repeat(${ rowCount }, minmax(1rem, auto))`\n\t\t\t\t);\n\t\t\t}\n\t\t} else {\n\t\t\trules.push(\n\t\t\t\t`grid-template-columns: repeat(auto-fill, minmax(min(${\n\t\t\t\t\tminimumColumnWidth || '12rem'\n\t\t\t\t}, 100%), 1fr))`,\n\t\t\t\t'container-type: inline-size'\n\t\t\t);\n\t\t}\n\n\t\tif ( rules.length ) {\n\t\t\toutput = `${ appendSelectors( selector ) } { ${ rules.join(\n\t\t\t\t'; '\n\t\t\t) }; }`;\n\t\t}\n\n\t\t// Output blockGap styles based on rules contained in layout definitions in theme.json.\n\t\tif ( hasBlockGapSupport && blockGapValue ) {\n\t\t\toutput += getBlockGapCSS(\n\t\t\t\tselector,\n\t\t\t\tlayoutDefinitions,\n\t\t\t\t'grid',\n\t\t\t\tblockGapValue\n\t\t\t);\n\t\t}\n\t\treturn output;\n\t},\n\tgetOrientation() {\n\t\treturn 'horizontal';\n\t},\n\tgetAlignments() {\n\t\treturn [];\n\t},\n};\n\n// Enables setting minimum width of grid items.\nfunction GridLayoutMinimumWidthControl( { layout, onChange } ) {\n\tconst { minimumColumnWidth, columnCount, isManualPlacement } = layout;\n\tconst defaultValue = isManualPlacement || columnCount ? null : '12rem';\n\tconst value = minimumColumnWidth || defaultValue;\n\tconst [ quantity, unit = 'rem' ] =\n\t\tparseQuantityAndUnitFromRawValue( value );\n\n\tconst handleSliderChange = ( next ) => {\n\t\tonChange( {\n\t\t\t...layout,\n\t\t\tminimumColumnWidth: [ next, unit ].join( '' ),\n\t\t} );\n\t};\n\n\t// Mostly copied from HeightControl.\n\tconst handleUnitChange = ( newUnit ) => {\n\t\t// Attempt to smooth over differences between currentUnit and newUnit.\n\t\t// This should slightly improve the experience of switching between unit types.\n\t\tlet newValue;\n\n\t\tif ( [ 'em', 'rem' ].includes( newUnit ) && unit === 'px' ) {\n\t\t\t// Convert pixel value to an approximate of the new unit, assuming a root size of 16px.\n\t\t\tnewValue = ( quantity / 16 ).toFixed( 2 ) + newUnit;\n\t\t} else if ( [ 'em', 'rem' ].includes( unit ) && newUnit === 'px' ) {\n\t\t\t// Convert to pixel value assuming a root size of 16px.\n\t\t\tnewValue = Math.round( quantity * 16 ) + newUnit;\n\t\t}\n\n\t\tonChange( {\n\t\t\t...layout,\n\t\t\tminimumColumnWidth: newValue,\n\t\t} );\n\t};\n\n\treturn (\n\t\t<fieldset className=\"block-editor-hooks__grid-layout-minimum-width-control\">\n\t\t\t<BaseControl.VisualLabel as=\"legend\">\n\t\t\t\t{ __( 'Min. column width' ) }\n\t\t\t</BaseControl.VisualLabel>\n\t\t\t<Flex gap={ 4 }>\n\t\t\t\t<FlexItem isBlock>\n\t\t\t\t\t<UnitControl\n\t\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\t\tonChange={ ( newValue ) => {\n\t\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\t\t...layout,\n\t\t\t\t\t\t\t\tminimumColumnWidth:\n\t\t\t\t\t\t\t\t\tnewValue === '' ? undefined : newValue,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tonUnitChange={ handleUnitChange }\n\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\tunits={ units }\n\t\t\t\t\t\tmin={ 0 }\n\t\t\t\t\t\tlabel={ __( 'Minimum column width' ) }\n\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t/>\n\t\t\t\t</FlexItem>\n\t\t\t\t<FlexItem isBlock>\n\t\t\t\t\t<RangeControl\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tonChange={ handleSliderChange }\n\t\t\t\t\t\tvalue={ quantity || 0 }\n\t\t\t\t\t\tmin={ 0 }\n\t\t\t\t\t\tmax={ RANGE_CONTROL_MAX_VALUES[ unit ] || 600 }\n\t\t\t\t\t\twithInputField={ false }\n\t\t\t\t\t\tlabel={ __( 'Minimum column width' ) }\n\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t/>\n\t\t\t\t</FlexItem>\n\t\t\t</Flex>\n\t\t\t<p className=\"components-base-control__help\">\n\t\t\t\t{ __(\n\t\t\t\t\t'Columns will wrap to fewer per row when they can no longer maintain the minimum width.'\n\t\t\t\t) }\n\t\t\t</p>\n\t\t</fieldset>\n\t);\n}\n\n// Enables setting number of grid columns\nfunction GridLayoutColumnsAndRowsControl( {\n\tlayout,\n\tonChange,\n\tallowSizingOnChildren,\n} ) {\n\t// Allow unsetting the column count in Auto mode.\n\tconst defaultColumnCount = undefined;\n\tconst {\n\t\tcolumnCount = defaultColumnCount,\n\t\trowCount,\n\t\tisManualPlacement,\n\t} = layout;\n\n\treturn (\n\t\t<>\n\t\t\t<fieldset className=\"block-editor-hooks__grid-layout-columns-and-rows-controls\">\n\t\t\t\t{ ! isManualPlacement && (\n\t\t\t\t\t<BaseControl.VisualLabel as=\"legend\">\n\t\t\t\t\t\t{ __( 'Max. columns' ) }\n\t\t\t\t\t</BaseControl.VisualLabel>\n\t\t\t\t) }\n\t\t\t\t<Flex gap={ 4 }>\n\t\t\t\t\t<FlexItem isBlock>\n\t\t\t\t\t\t<NumberControl\n\t\t\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\t\t// Allow unsetting the column count when in auto mode.\n\t\t\t\t\t\t\t\tconst defaultNewColumnCount = isManualPlacement\n\t\t\t\t\t\t\t\t\t? 1\n\t\t\t\t\t\t\t\t\t: undefined;\n\t\t\t\t\t\t\t\tconst newColumnCount =\n\t\t\t\t\t\t\t\t\tvalue === '' || value === '0'\n\t\t\t\t\t\t\t\t\t\t? defaultNewColumnCount\n\t\t\t\t\t\t\t\t\t\t: parseInt( value, 10 );\n\t\t\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\t\t\t...layout,\n\t\t\t\t\t\t\t\t\tcolumnCount: newColumnCount,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tvalue={ columnCount }\n\t\t\t\t\t\t\tmin={ 1 }\n\t\t\t\t\t\t\tlabel={ __( 'Columns' ) }\n\t\t\t\t\t\t\thideLabelFromVision={ ! isManualPlacement }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</FlexItem>\n\n\t\t\t\t\t<FlexItem isBlock>\n\t\t\t\t\t\t{ allowSizingOnChildren && isManualPlacement ? (\n\t\t\t\t\t\t\t<NumberControl\n\t\t\t\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\t\t\t// Don't allow unsetting the row count.\n\t\t\t\t\t\t\t\t\tconst newRowCount =\n\t\t\t\t\t\t\t\t\t\tvalue === '' || value === '0'\n\t\t\t\t\t\t\t\t\t\t\t? 1\n\t\t\t\t\t\t\t\t\t\t\t: parseInt( value, 10 );\n\t\t\t\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\t\t\t\t...layout,\n\t\t\t\t\t\t\t\t\t\trowCount: newRowCount,\n\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\tvalue={ rowCount }\n\t\t\t\t\t\t\t\tmin={ 1 }\n\t\t\t\t\t\t\t\tlabel={ __( 'Rows' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<RangeControl\n\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\tvalue={ columnCount ?? 1 }\n\t\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\t\t\t\t...layout,\n\t\t\t\t\t\t\t\t\t\tcolumnCount:\n\t\t\t\t\t\t\t\t\t\t\tvalue === '' || value === '0'\n\t\t\t\t\t\t\t\t\t\t\t\t? 1\n\t\t\t\t\t\t\t\t\t\t\t\t: value,\n\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tmin={ 1 }\n\t\t\t\t\t\t\t\tmax={ 16 }\n\t\t\t\t\t\t\t\twithInputField={ false }\n\t\t\t\t\t\t\t\tlabel={ __( 'Columns' ) }\n\t\t\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</FlexItem>\n\t\t\t\t</Flex>\n\t\t\t</fieldset>\n\t\t</>\n\t);\n}\n\n// Enables switching between grid types\nfunction GridLayoutTypeControl( { layout, onChange } ) {\n\tconst { columnCount, rowCount, minimumColumnWidth, isManualPlacement } =\n\t\tlayout;\n\n\t/**\n\t * When switching, temporarily save any custom values set on the\n\t * previous type so we can switch back without loss.\n\t */\n\tconst [ tempColumnCount, setTempColumnCount ] = useState(\n\t\tcolumnCount || 3\n\t);\n\tconst [ tempRowCount, setTempRowCount ] = useState( rowCount );\n\tconst [ tempMinimumColumnWidth, setTempMinimumColumnWidth ] = useState(\n\t\tminimumColumnWidth || '12rem'\n\t);\n\n\tconst gridPlacement = isManualPlacement ? 'manual' : 'auto';\n\n\tconst onChangeType = ( value ) => {\n\t\tif ( value === 'manual' ) {\n\t\t\tsetTempMinimumColumnWidth( minimumColumnWidth || '12rem' );\n\t\t} else {\n\t\t\tsetTempColumnCount( columnCount || 3 );\n\t\t\tsetTempRowCount( rowCount );\n\t\t}\n\t\tonChange( {\n\t\t\t...layout,\n\t\t\tcolumnCount: value === 'manual' ? tempColumnCount : tempColumnCount,\n\t\t\trowCount: value === 'manual' ? tempRowCount : undefined,\n\t\t\tisManualPlacement: value === 'manual' ? true : undefined,\n\t\t\tminimumColumnWidth:\n\t\t\t\tvalue === 'auto' ? tempMinimumColumnWidth : null,\n\t\t} );\n\t};\n\n\tconst helpText =\n\t\tgridPlacement === 'manual'\n\t\t\t? __(\n\t\t\t\t\t'Grid items can be manually placed in any position on the grid.'\n\t\t\t )\n\t\t\t: __(\n\t\t\t\t\t'Grid items are placed automatically depending on their order.'\n\t\t\t );\n\n\treturn (\n\t\t<ToggleGroupControl\n\t\t\t__next40pxDefaultSize\n\t\t\tlabel={ __( 'Grid item position' ) }\n\t\t\tvalue={ gridPlacement }\n\t\t\tonChange={ onChangeType }\n\t\t\tisBlock\n\t\t\thelp={ helpText }\n\t\t>\n\t\t\t<ToggleGroupControlOption\n\t\t\t\tkey=\"auto\"\n\t\t\t\tvalue=\"auto\"\n\t\t\t\tlabel={ __( 'Auto' ) }\n\t\t\t/>\n\t\t\t<ToggleGroupControlOption\n\t\t\t\tkey=\"manual\"\n\t\t\t\tvalue=\"manual\"\n\t\t\t\tlabel={ __( 'Manual' ) }\n\t\t\t/>\n\t\t</ToggleGroupControl>\n\t);\n}\n"],
|
|
5
|
-
"mappings": ";AAGA,SAAS,UAAU;AAEnB;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,+BAA+B;AAAA,EAC/B,oCAAoC;AAAA,EACpC,0CAA0C;AAAA,EAC1C,6BAA6B;AAAA,EAC7B,kDAAkD;AAAA,EAClD,wBAAwB;AAAA,OAClB;AACP,SAAS,gBAAgB;AAKzB,SAAS,iBAAiB,sBAAsB;AAChD,SAAS,sBAAsB;AAC/B,SAAS,+BAA+B;AACxC,SAAS,0BAA0B;AAwDhC,mBAEE,KAKD,YAPD;AAtDH,IAAM,2BAA2B;AAAA,EAChC,IAAI;AAAA,EACJ,KAAK;AAAA,EACL,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KA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A,oBAAoB;AAAA,EACrB,GAAI;AACH,UAAM;AAAA,MACL,qBAAqB;AAAA,MACrB,cAAc;AAAA,MACd,WAAW;AAAA,IACZ,IAAI;AAIJ,QAAK,QAAQ,IAAI,aAAa,eAAgB;AAC7C,UACC,sBACA,OAAO,uBAAuB,UAC7B;AACD,cAAM,IAAI,MAAO,qCAAsC;AAAA,MACxD;AACA,UAAK,eAAe,OAAO,gBAAgB,UAAW;AACrD,cAAM,IAAI,MAAO,8BAA+B;AAAA,MACjD;AACA,UAAK,YAAY,OAAO,aAAa,UAAW;AAC/C,cAAM,IAAI,MAAO,2BAA4B;AAAA,MAC9C;AAAA,IACD;AAIA,UAAM,gBACL,OAAO,SAAS,YAChB,CAAE,wBAAyB,WAAW,WAAW,UAAW,IACzD,eAAgB,OAAO,SAAS,UAAU,OAAQ,IAClD;
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\nimport {\n\tBaseControl,\n\tFlex,\n\tFlexItem,\n\tRangeControl,\n\t__experimentalNumberControl as NumberControl,\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOption as ToggleGroupControlOption,\n\t__experimentalUnitControl as UnitControl,\n\t__experimentalParseQuantityAndUnitFromRawValue as parseQuantityAndUnitFromRawValue,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { appendSelectors, getBlockGapCSS } from './utils';\nimport { getGapCSSValue } from '../hooks/gap';\nimport { shouldSkipSerialization } from '../hooks/utils';\nimport { LAYOUT_DEFINITIONS } from './definitions';\n\nconst RANGE_CONTROL_MAX_VALUES = {\n\tpx: 600,\n\t'%': 100,\n\tvw: 100,\n\tvh: 100,\n\tem: 38,\n\trem: 38,\n\tsvw: 100,\n\tlvw: 100,\n\tdvw: 100,\n\tsvh: 100,\n\tlvh: 100,\n\tdvh: 100,\n\tvi: 100,\n\tsvi: 100,\n\tlvi: 100,\n\tdvi: 100,\n\tvb: 100,\n\tsvb: 100,\n\tlvb: 100,\n\tdvb: 100,\n\tvmin: 100,\n\tsvmin: 100,\n\tlvmin: 100,\n\tdvmin: 100,\n\tvmax: 100,\n\tsvmax: 100,\n\tlvmax: 100,\n\tdvmax: 100,\n};\n\nconst units = [\n\t{ value: 'px', label: 'px', default: 0 },\n\t{ value: 'rem', label: 'rem', default: 0 },\n\t{ value: 'em', label: 'em', default: 0 },\n];\n\nexport default {\n\tname: 'grid',\n\tlabel: __( 'Grid' ),\n\tinspectorControls: function GridLayoutInspectorControls( {\n\t\tlayout = {},\n\t\tonChange,\n\t\tlayoutBlockSupport = {},\n\t} ) {\n\t\tconst { allowSizingOnChildren = false } = layoutBlockSupport;\n\n\t\t// Always show both column and minimum width controls in Auto mode.\n\t\t// Manual mode (with isManualPlacement) is only available behind the experiment flag.\n\t\tconst showColumnsControl = true;\n\t\tconst showMinWidthControl =\n\t\t\t! layout?.isManualPlacement ||\n\t\t\twindow.__experimentalEnableGridInteractivity;\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ window.__experimentalEnableGridInteractivity && (\n\t\t\t\t\t<GridLayoutTypeControl\n\t\t\t\t\t\tlayout={ layout }\n\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t<VStack spacing={ 4 }>\n\t\t\t\t\t{ showColumnsControl && (\n\t\t\t\t\t\t<GridLayoutColumnsAndRowsControl\n\t\t\t\t\t\t\tlayout={ layout }\n\t\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\t\tallowSizingOnChildren={ allowSizingOnChildren }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t{ showMinWidthControl && (\n\t\t\t\t\t\t<GridLayoutMinimumWidthControl\n\t\t\t\t\t\t\tlayout={ layout }\n\t\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</VStack>\n\t\t\t</>\n\t\t);\n\t},\n\ttoolBarControls: function GridLayoutToolbarControls() {\n\t\treturn null;\n\t},\n\tgetLayoutStyle: function getLayoutStyle( {\n\t\tselector,\n\t\tlayout,\n\t\tstyle,\n\t\tblockName,\n\t\thasBlockGapSupport,\n\t\tglobalBlockGapValue,\n\t\tlayoutDefinitions = LAYOUT_DEFINITIONS,\n\t} ) {\n\t\tconst {\n\t\t\tminimumColumnWidth = null,\n\t\t\tcolumnCount = null,\n\t\t\trowCount = null,\n\t\t} = layout;\n\n\t\t// Check that the grid layout attributes are of the correct type, so that we don't accidentally\n\t\t// write code that stores a string attribute instead of a number.\n\t\tif ( process.env.NODE_ENV === 'development' ) {\n\t\t\tif (\n\t\t\t\tminimumColumnWidth &&\n\t\t\t\ttypeof minimumColumnWidth !== 'string'\n\t\t\t) {\n\t\t\t\tthrow new Error( 'minimumColumnWidth must be a string' );\n\t\t\t}\n\t\t\tif ( columnCount && typeof columnCount !== 'number' ) {\n\t\t\t\tthrow new Error( 'columnCount must be a number' );\n\t\t\t}\n\t\t\tif ( rowCount && typeof rowCount !== 'number' ) {\n\t\t\t\tthrow new Error( 'rowCount must be a number' );\n\t\t\t}\n\t\t}\n\n\t\t// If a block's block.json skips serialization for spacing or spacing.blockGap,\n\t\t// don't apply the user-defined value to the styles.\n\t\tconst blockGapValue =\n\t\t\tstyle?.spacing?.blockGap &&\n\t\t\t! shouldSkipSerialization( blockName, 'spacing', 'blockGap' )\n\t\t\t\t? getGapCSSValue( style?.spacing?.blockGap, '0.5em' )\n\t\t\t\t: undefined;\n\n\t\t// Use the global blockGap value for grid column calculations when available\n\t\t// If the gap value has both top and left (separated by space), use the left value for horizontal calculations\n\t\tlet fallbackGapValue = '1.2rem';\n\t\tif ( globalBlockGapValue ) {\n\t\t\tconst processedGap = getGapCSSValue( globalBlockGapValue, '0.5em' );\n\t\t\tconst gapParts = processedGap.split( ' ' );\n\t\t\tfallbackGapValue =\n\t\t\t\tgapParts.length > 1 ? gapParts[ 1 ] : gapParts[ 0 ];\n\t\t}\n\n\t\tlet output = '';\n\t\tconst rules = [];\n\n\t\tif ( minimumColumnWidth && columnCount > 0 ) {\n\t\t\tlet blockGapToUse = blockGapValue || fallbackGapValue;\n\t\t\t// Ensure 0 values have a unit so they work in calc().\n\t\t\tif ( blockGapToUse === '0' || blockGapToUse === 0 ) {\n\t\t\t\tblockGapToUse = '0px';\n\t\t\t}\n\t\t\tconst maxValue = `max(min( ${ minimumColumnWidth }, 100%), ( 100% - (${ blockGapToUse }*${\n\t\t\t\tcolumnCount - 1\n\t\t\t}) ) / ${ columnCount })`;\n\t\t\trules.push(\n\t\t\t\t`grid-template-columns: repeat(auto-fill, minmax(${ maxValue }, 1fr))`,\n\t\t\t\t`container-type: inline-size`\n\t\t\t);\n\t\t\tif ( rowCount ) {\n\t\t\t\trules.push(\n\t\t\t\t\t`grid-template-rows: repeat(${ rowCount }, minmax(1rem, auto))`\n\t\t\t\t);\n\t\t\t}\n\t\t} else if ( columnCount ) {\n\t\t\trules.push(\n\t\t\t\t`grid-template-columns: repeat(${ columnCount }, minmax(0, 1fr))`\n\t\t\t);\n\t\t\tif ( rowCount ) {\n\t\t\t\trules.push(\n\t\t\t\t\t`grid-template-rows: repeat(${ rowCount }, minmax(1rem, auto))`\n\t\t\t\t);\n\t\t\t}\n\t\t} else {\n\t\t\trules.push(\n\t\t\t\t`grid-template-columns: repeat(auto-fill, minmax(min(${\n\t\t\t\t\tminimumColumnWidth || '12rem'\n\t\t\t\t}, 100%), 1fr))`,\n\t\t\t\t'container-type: inline-size'\n\t\t\t);\n\t\t}\n\n\t\tif ( rules.length ) {\n\t\t\toutput = `${ appendSelectors( selector ) } { ${ rules.join(\n\t\t\t\t'; '\n\t\t\t) }; }`;\n\t\t}\n\n\t\t// Output blockGap styles based on rules contained in layout definitions in theme.json.\n\t\tif ( hasBlockGapSupport && blockGapValue ) {\n\t\t\toutput += getBlockGapCSS(\n\t\t\t\tselector,\n\t\t\t\tlayoutDefinitions,\n\t\t\t\t'grid',\n\t\t\t\tblockGapValue\n\t\t\t);\n\t\t}\n\t\treturn output;\n\t},\n\tgetOrientation() {\n\t\treturn 'horizontal';\n\t},\n\tgetAlignments() {\n\t\treturn [];\n\t},\n};\n\n// Enables setting minimum width of grid items.\nfunction GridLayoutMinimumWidthControl( { layout, onChange } ) {\n\tconst { minimumColumnWidth, columnCount, isManualPlacement } = layout;\n\tconst defaultValue = isManualPlacement || columnCount ? null : '12rem';\n\tconst value = minimumColumnWidth || defaultValue;\n\tconst [ quantity, unit = 'rem' ] =\n\t\tparseQuantityAndUnitFromRawValue( value );\n\n\tconst handleSliderChange = ( next ) => {\n\t\tonChange( {\n\t\t\t...layout,\n\t\t\tminimumColumnWidth: [ next, unit ].join( '' ),\n\t\t} );\n\t};\n\n\t// Mostly copied from HeightControl.\n\tconst handleUnitChange = ( newUnit ) => {\n\t\t// Attempt to smooth over differences between currentUnit and newUnit.\n\t\t// This should slightly improve the experience of switching between unit types.\n\t\tlet newValue;\n\n\t\tif ( [ 'em', 'rem' ].includes( newUnit ) && unit === 'px' ) {\n\t\t\t// Convert pixel value to an approximate of the new unit, assuming a root size of 16px.\n\t\t\tnewValue = ( quantity / 16 ).toFixed( 2 ) + newUnit;\n\t\t} else if ( [ 'em', 'rem' ].includes( unit ) && newUnit === 'px' ) {\n\t\t\t// Convert to pixel value assuming a root size of 16px.\n\t\t\tnewValue = Math.round( quantity * 16 ) + newUnit;\n\t\t}\n\n\t\tonChange( {\n\t\t\t...layout,\n\t\t\tminimumColumnWidth: newValue,\n\t\t} );\n\t};\n\n\treturn (\n\t\t<fieldset className=\"block-editor-hooks__grid-layout-minimum-width-control\">\n\t\t\t<BaseControl.VisualLabel as=\"legend\">\n\t\t\t\t{ __( 'Min. column width' ) }\n\t\t\t</BaseControl.VisualLabel>\n\t\t\t<Flex gap={ 4 }>\n\t\t\t\t<FlexItem isBlock>\n\t\t\t\t\t<UnitControl\n\t\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\t\tonChange={ ( newValue ) => {\n\t\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\t\t...layout,\n\t\t\t\t\t\t\t\tminimumColumnWidth:\n\t\t\t\t\t\t\t\t\tnewValue === '' ? undefined : newValue,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tonUnitChange={ handleUnitChange }\n\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\tunits={ units }\n\t\t\t\t\t\tmin={ 0 }\n\t\t\t\t\t\tlabel={ __( 'Minimum column width' ) }\n\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t/>\n\t\t\t\t</FlexItem>\n\t\t\t\t<FlexItem isBlock>\n\t\t\t\t\t<RangeControl\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tonChange={ handleSliderChange }\n\t\t\t\t\t\tvalue={ quantity || 0 }\n\t\t\t\t\t\tmin={ 0 }\n\t\t\t\t\t\tmax={ RANGE_CONTROL_MAX_VALUES[ unit ] || 600 }\n\t\t\t\t\t\twithInputField={ false }\n\t\t\t\t\t\tlabel={ __( 'Minimum column width' ) }\n\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t/>\n\t\t\t\t</FlexItem>\n\t\t\t</Flex>\n\t\t\t<p className=\"components-base-control__help\">\n\t\t\t\t{ __(\n\t\t\t\t\t'Columns will wrap to fewer per row when they can no longer maintain the minimum width.'\n\t\t\t\t) }\n\t\t\t</p>\n\t\t</fieldset>\n\t);\n}\n\n// Enables setting number of grid columns\nfunction GridLayoutColumnsAndRowsControl( {\n\tlayout,\n\tonChange,\n\tallowSizingOnChildren,\n} ) {\n\t// Allow unsetting the column count in Auto mode.\n\tconst defaultColumnCount = undefined;\n\tconst {\n\t\tcolumnCount = defaultColumnCount,\n\t\trowCount,\n\t\tisManualPlacement,\n\t} = layout;\n\n\treturn (\n\t\t<>\n\t\t\t<fieldset className=\"block-editor-hooks__grid-layout-columns-and-rows-controls\">\n\t\t\t\t{ ! isManualPlacement && (\n\t\t\t\t\t<BaseControl.VisualLabel as=\"legend\">\n\t\t\t\t\t\t{ __( 'Max. columns' ) }\n\t\t\t\t\t</BaseControl.VisualLabel>\n\t\t\t\t) }\n\t\t\t\t<Flex gap={ 4 }>\n\t\t\t\t\t<FlexItem isBlock>\n\t\t\t\t\t\t<NumberControl\n\t\t\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\t\t// Allow unsetting the column count when in auto mode.\n\t\t\t\t\t\t\t\tconst defaultNewColumnCount = isManualPlacement\n\t\t\t\t\t\t\t\t\t? 1\n\t\t\t\t\t\t\t\t\t: undefined;\n\t\t\t\t\t\t\t\tconst newColumnCount =\n\t\t\t\t\t\t\t\t\tvalue === '' || value === '0'\n\t\t\t\t\t\t\t\t\t\t? defaultNewColumnCount\n\t\t\t\t\t\t\t\t\t\t: parseInt( value, 10 );\n\t\t\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\t\t\t...layout,\n\t\t\t\t\t\t\t\t\tcolumnCount: newColumnCount,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tvalue={ columnCount }\n\t\t\t\t\t\t\tmin={ 1 }\n\t\t\t\t\t\t\tlabel={ __( 'Columns' ) }\n\t\t\t\t\t\t\thideLabelFromVision={ ! isManualPlacement }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</FlexItem>\n\n\t\t\t\t\t<FlexItem isBlock>\n\t\t\t\t\t\t{ allowSizingOnChildren && isManualPlacement ? (\n\t\t\t\t\t\t\t<NumberControl\n\t\t\t\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\t\t\t// Don't allow unsetting the row count.\n\t\t\t\t\t\t\t\t\tconst newRowCount =\n\t\t\t\t\t\t\t\t\t\tvalue === '' || value === '0'\n\t\t\t\t\t\t\t\t\t\t\t? 1\n\t\t\t\t\t\t\t\t\t\t\t: parseInt( value, 10 );\n\t\t\t\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\t\t\t\t...layout,\n\t\t\t\t\t\t\t\t\t\trowCount: newRowCount,\n\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\tvalue={ rowCount }\n\t\t\t\t\t\t\t\tmin={ 1 }\n\t\t\t\t\t\t\t\tlabel={ __( 'Rows' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<RangeControl\n\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\tvalue={ columnCount ?? 1 }\n\t\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\t\t\t\t...layout,\n\t\t\t\t\t\t\t\t\t\tcolumnCount:\n\t\t\t\t\t\t\t\t\t\t\tvalue === '' || value === '0'\n\t\t\t\t\t\t\t\t\t\t\t\t? 1\n\t\t\t\t\t\t\t\t\t\t\t\t: value,\n\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tmin={ 1 }\n\t\t\t\t\t\t\t\tmax={ 16 }\n\t\t\t\t\t\t\t\twithInputField={ false }\n\t\t\t\t\t\t\t\tlabel={ __( 'Columns' ) }\n\t\t\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</FlexItem>\n\t\t\t\t</Flex>\n\t\t\t</fieldset>\n\t\t</>\n\t);\n}\n\n// Enables switching between grid types\nfunction GridLayoutTypeControl( { layout, onChange } ) {\n\tconst { columnCount, rowCount, minimumColumnWidth, isManualPlacement } =\n\t\tlayout;\n\n\t/**\n\t * When switching, temporarily save any custom values set on the\n\t * previous type so we can switch back without loss.\n\t */\n\tconst [ tempColumnCount, setTempColumnCount ] = useState(\n\t\tcolumnCount || 3\n\t);\n\tconst [ tempRowCount, setTempRowCount ] = useState( rowCount );\n\tconst [ tempMinimumColumnWidth, setTempMinimumColumnWidth ] = useState(\n\t\tminimumColumnWidth || '12rem'\n\t);\n\n\tconst gridPlacement = isManualPlacement ? 'manual' : 'auto';\n\n\tconst onChangeType = ( value ) => {\n\t\tif ( value === 'manual' ) {\n\t\t\tsetTempMinimumColumnWidth( minimumColumnWidth || '12rem' );\n\t\t} else {\n\t\t\tsetTempColumnCount( columnCount || 3 );\n\t\t\tsetTempRowCount( rowCount );\n\t\t}\n\t\tonChange( {\n\t\t\t...layout,\n\t\t\tcolumnCount: value === 'manual' ? tempColumnCount : tempColumnCount,\n\t\t\trowCount: value === 'manual' ? tempRowCount : undefined,\n\t\t\tisManualPlacement: value === 'manual' ? true : undefined,\n\t\t\tminimumColumnWidth:\n\t\t\t\tvalue === 'auto' ? tempMinimumColumnWidth : null,\n\t\t} );\n\t};\n\n\tconst helpText =\n\t\tgridPlacement === 'manual'\n\t\t\t? __(\n\t\t\t\t\t'Grid items can be manually placed in any position on the grid.'\n\t\t\t )\n\t\t\t: __(\n\t\t\t\t\t'Grid items are placed automatically depending on their order.'\n\t\t\t );\n\n\treturn (\n\t\t<ToggleGroupControl\n\t\t\t__next40pxDefaultSize\n\t\t\tlabel={ __( 'Grid item position' ) }\n\t\t\tvalue={ gridPlacement }\n\t\t\tonChange={ onChangeType }\n\t\t\tisBlock\n\t\t\thelp={ helpText }\n\t\t>\n\t\t\t<ToggleGroupControlOption\n\t\t\t\tkey=\"auto\"\n\t\t\t\tvalue=\"auto\"\n\t\t\t\tlabel={ __( 'Auto' ) }\n\t\t\t/>\n\t\t\t<ToggleGroupControlOption\n\t\t\t\tkey=\"manual\"\n\t\t\t\tvalue=\"manual\"\n\t\t\t\tlabel={ __( 'Manual' ) }\n\t\t\t/>\n\t\t</ToggleGroupControl>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";AAGA,SAA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,YACN,OAAQ,GAAI,MAAO;AAAA;AAAA,UAFf;AAAA,QAGL;AAAA,QACA;AAAA,UAAC;AAAA;AAAA,YAEA,OAAM;AAAA,YACN,OAAQ,GAAI,QAAS;AAAA;AAAA,UAFjB;AAAA,QAGL;AAAA;AAAA;AAAA,EACD;AAEF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -116,6 +116,9 @@ var SETTINGS_DEFAULTS = {
|
|
|
116
116
|
allowedMimeTypes: null,
|
|
117
117
|
// Allows to disable block locking interface.
|
|
118
118
|
canLockBlocks: true,
|
|
119
|
+
// Whether the user can edit custom CSS (requires edit_css capability).
|
|
120
|
+
// Defaults to false for safety - PHP passes true when user has capability.
|
|
121
|
+
canEditCSS: false,
|
|
119
122
|
// Allows to disable Openverse media category in the inserter.
|
|
120
123
|
enableOpenverseMediaCategory: true,
|
|
121
124
|
clearBlockSelection: true,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/store/defaults.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __, _x } from '@wordpress/i18n';\n\nexport const PREFERENCES_DEFAULTS = {\n\tinsertUsage: {},\n};\n\n/**\n * The default editor settings\n *\n * @typedef {Object} SETTINGS_DEFAULT\n * @property {boolean} alignWide Enable/Disable Wide/Full Alignments\n * @property {boolean} supportsLayout Enable/disable layouts support in container blocks.\n * @property {boolean} imageEditing Image Editing settings set to false to disable.\n * @property {Array} imageSizes Available image sizes\n * @property {number} maxWidth Max width to constraint resizing\n * @property {boolean|Array} allowedBlockTypes Allowed block types\n * @property {boolean} hasFixedToolbar Whether or not the editor toolbar is fixed\n * @property {boolean} distractionFree Whether or not the editor UI is distraction free\n * @property {boolean} focusMode Whether the focus mode is enabled or not\n * @property {Array} styles Editor Styles\n * @property {boolean} keepCaretInsideBlock Whether caret should move between blocks in edit mode\n * @property {string} bodyPlaceholder Empty post placeholder\n * @property {string} titlePlaceholder Empty title placeholder\n * @property {boolean} canLockBlocks Whether the user can manage Block Lock state\n * @property {boolean} codeEditingEnabled Whether or not the user can switch to the code editor\n * @property {boolean} generateAnchors Enable/Disable auto anchor generation for Heading blocks\n * @property {boolean} enableOpenverseMediaCategory Enable/Disable the Openverse media category in the inserter.\n * @property {boolean} clearBlockSelection Whether the block editor should clear selection on mousedown when a block is not clicked.\n * @property {boolean} __experimentalCanUserUseUnfilteredHTML Whether the user should be able to use unfiltered HTML or the HTML should be filtered e.g., to remove elements considered insecure like iframes.\n * @property {boolean} __experimentalBlockDirectory Whether the user has enabled the Block Directory\n * @property {Array} __experimentalBlockPatterns Array of objects representing the block patterns\n * @property {Array} __experimentalBlockPatternCategories Array of objects representing the block pattern categories\n */\nexport const SETTINGS_DEFAULTS = {\n\talignWide: false,\n\tsupportsLayout: true,\n\n\t// colors setting is not used anymore now defaults are passed from theme.json on the server and core has its own defaults.\n\t// The setting is only kept for backward compatibility purposes.\n\tcolors: [\n\t\t{\n\t\t\tname: __( 'Black' ),\n\t\t\tslug: 'black',\n\t\t\tcolor: '#000000',\n\t\t},\n\t\t{\n\t\t\tname: __( 'Cyan bluish gray' ),\n\t\t\tslug: 'cyan-bluish-gray',\n\t\t\tcolor: '#abb8c3',\n\t\t},\n\t\t{\n\t\t\tname: __( 'White' ),\n\t\t\tslug: 'white',\n\t\t\tcolor: '#ffffff',\n\t\t},\n\t\t{\n\t\t\tname: __( 'Pale pink' ),\n\t\t\tslug: 'pale-pink',\n\t\t\tcolor: '#f78da7',\n\t\t},\n\t\t{ name: __( 'Vivid red' ), slug: 'vivid-red', color: '#cf2e2e' },\n\t\t{\n\t\t\tname: __( 'Luminous vivid orange' ),\n\t\t\tslug: 'luminous-vivid-orange',\n\t\t\tcolor: '#ff6900',\n\t\t},\n\t\t{\n\t\t\tname: __( 'Luminous vivid amber' ),\n\t\t\tslug: 'luminous-vivid-amber',\n\t\t\tcolor: '#fcb900',\n\t\t},\n\t\t{\n\t\t\tname: __( 'Light green cyan' ),\n\t\t\tslug: 'light-green-cyan',\n\t\t\tcolor: '#7bdcb5',\n\t\t},\n\t\t{\n\t\t\tname: __( 'Vivid green cyan' ),\n\t\t\tslug: 'vivid-green-cyan',\n\t\t\tcolor: '#00d084',\n\t\t},\n\t\t{\n\t\t\tname: __( 'Pale cyan blue' ),\n\t\t\tslug: 'pale-cyan-blue',\n\t\t\tcolor: '#8ed1fc',\n\t\t},\n\t\t{\n\t\t\tname: __( 'Vivid cyan blue' ),\n\t\t\tslug: 'vivid-cyan-blue',\n\t\t\tcolor: '#0693e3',\n\t\t},\n\t\t{\n\t\t\tname: __( 'Vivid purple' ),\n\t\t\tslug: 'vivid-purple',\n\t\t\tcolor: '#9b51e0',\n\t\t},\n\t],\n\t// fontSizes setting is not used anymore now defaults are passed from theme.json on the server and core has its own defaults.\n\t// The setting is only kept for backward compatibility purposes.\n\tfontSizes: [\n\t\t{\n\t\t\tname: _x( 'Small', 'font size name' ),\n\t\t\tsize: 13,\n\t\t\tslug: 'small',\n\t\t},\n\t\t{\n\t\t\tname: _x( 'Normal', 'font size name' ),\n\t\t\tsize: 16,\n\t\t\tslug: 'normal',\n\t\t},\n\t\t{\n\t\t\tname: _x( 'Medium', 'font size name' ),\n\t\t\tsize: 20,\n\t\t\tslug: 'medium',\n\t\t},\n\t\t{\n\t\t\tname: _x( 'Large', 'font size name' ),\n\t\t\tsize: 36,\n\t\t\tslug: 'large',\n\t\t},\n\t\t{\n\t\t\tname: _x( 'Huge', 'font size name' ),\n\t\t\tsize: 42,\n\t\t\tslug: 'huge',\n\t\t},\n\t],\n\n\t// Image default size slug.\n\timageDefaultSize: 'large',\n\n\timageSizes: [\n\t\t{ slug: 'thumbnail', name: __( 'Thumbnail' ) },\n\t\t{ slug: 'medium', name: __( 'Medium' ) },\n\t\t{ slug: 'large', name: __( 'Large' ) },\n\t\t{ slug: 'full', name: __( 'Full Size' ) },\n\t],\n\n\t// Allow plugin to disable Image Editor if need be.\n\timageEditing: true,\n\n\t// This is current max width of the block inner area\n\t// It's used to constraint image resizing and this value could be overridden later by themes\n\tmaxWidth: 580,\n\n\t// Allowed block types for the editor, defaulting to true (all supported).\n\tallowedBlockTypes: true,\n\n\t// Maximum upload size in bytes allowed for the site.\n\tmaxUploadFileSize: 0,\n\n\t// List of allowed mime types and file extensions.\n\tallowedMimeTypes: null,\n\n\t// Allows to disable block locking interface.\n\tcanLockBlocks: true,\n\n\t// Allows to disable Openverse media category in the inserter.\n\tenableOpenverseMediaCategory: true,\n\n\tclearBlockSelection: true,\n\n\t__experimentalCanUserUseUnfilteredHTML: false,\n\t__experimentalBlockDirectory: false,\n\t__mobileEnablePageTemplates: false,\n\t__experimentalBlockPatterns: [],\n\t__experimentalBlockPatternCategories: [],\n\n\tisPreviewMode: false,\n\n\t// These settings will be completely revamped in the future.\n\t// The goal is to evolve this into an API which will instruct\n\t// the block inspector to animate transitions between what it\n\t// displays based on the relationship between the selected block\n\t// and its parent, and only enable it if the parent is controlling\n\t// its children blocks.\n\tblockInspectorAnimation: {\n\t\tanimationParent: 'core/navigation',\n\t\t'core/navigation': { enterDirection: 'leftToRight' },\n\t\t'core/navigation-submenu': { enterDirection: 'rightToLeft' },\n\t\t'core/navigation-link': { enterDirection: 'rightToLeft' },\n\t\t'core/search': { enterDirection: 'rightToLeft' },\n\t\t'core/social-links': { enterDirection: 'rightToLeft' },\n\t\t'core/page-list': { enterDirection: 'rightToLeft' },\n\t\t'core/spacer': { enterDirection: 'rightToLeft' },\n\t\t'core/home-link': { enterDirection: 'rightToLeft' },\n\t\t'core/site-title': { enterDirection: 'rightToLeft' },\n\t\t'core/site-logo': { enterDirection: 'rightToLeft' },\n\t},\n\n\tgenerateAnchors: false,\n\t// gradients setting is not used anymore now defaults are passed from theme.json on the server and core has its own defaults.\n\t// The setting is only kept for backward compatibility purposes.\n\tgradients: [\n\t\t{\n\t\t\tname: __( 'Vivid cyan blue to vivid purple' ),\n\t\t\tgradient:\n\t\t\t\t'linear-gradient(135deg,rgba(6,147,227,1) 0%,rgb(155,81,224) 100%)',\n\t\t\tslug: 'vivid-cyan-blue-to-vivid-purple',\n\t\t},\n\t\t{\n\t\t\tname: __( 'Light green cyan to vivid green cyan' ),\n\t\t\tgradient:\n\t\t\t\t'linear-gradient(135deg,rgb(122,220,180) 0%,rgb(0,208,130) 100%)',\n\t\t\tslug: 'light-green-cyan-to-vivid-green-cyan',\n\t\t},\n\t\t{\n\t\t\tname: __( 'Luminous vivid amber to luminous vivid orange' ),\n\t\t\tgradient:\n\t\t\t\t'linear-gradient(135deg,rgba(252,185,0,1) 0%,rgba(255,105,0,1) 100%)',\n\t\t\tslug: 'luminous-vivid-amber-to-luminous-vivid-orange',\n\t\t},\n\t\t{\n\t\t\tname: __( 'Luminous vivid orange to vivid red' ),\n\t\t\tgradient:\n\t\t\t\t'linear-gradient(135deg,rgba(255,105,0,1) 0%,rgb(207,46,46) 100%)',\n\t\t\tslug: 'luminous-vivid-orange-to-vivid-red',\n\t\t},\n\t\t{\n\t\t\tname: __( 'Very light gray to cyan bluish gray' ),\n\t\t\tgradient:\n\t\t\t\t'linear-gradient(135deg,rgb(238,238,238) 0%,rgb(169,184,195) 100%)',\n\t\t\tslug: 'very-light-gray-to-cyan-bluish-gray',\n\t\t},\n\t\t{\n\t\t\tname: __( 'Cool to warm spectrum' ),\n\t\t\tgradient:\n\t\t\t\t'linear-gradient(135deg,rgb(74,234,220) 0%,rgb(151,120,209) 20%,rgb(207,42,186) 40%,rgb(238,44,130) 60%,rgb(251,105,98) 80%,rgb(254,248,76) 100%)',\n\t\t\tslug: 'cool-to-warm-spectrum',\n\t\t},\n\t\t{\n\t\t\tname: __( 'Blush light purple' ),\n\t\t\tgradient:\n\t\t\t\t'linear-gradient(135deg,rgb(255,206,236) 0%,rgb(152,150,240) 100%)',\n\t\t\tslug: 'blush-light-purple',\n\t\t},\n\t\t{\n\t\t\tname: __( 'Blush bordeaux' ),\n\t\t\tgradient:\n\t\t\t\t'linear-gradient(135deg,rgb(254,205,165) 0%,rgb(254,45,45) 50%,rgb(107,0,62) 100%)',\n\t\t\tslug: 'blush-bordeaux',\n\t\t},\n\t\t{\n\t\t\tname: __( 'Luminous dusk' ),\n\t\t\tgradient:\n\t\t\t\t'linear-gradient(135deg,rgb(255,203,112) 0%,rgb(199,81,192) 50%,rgb(65,88,208) 100%)',\n\t\t\tslug: 'luminous-dusk',\n\t\t},\n\t\t{\n\t\t\tname: __( 'Pale ocean' ),\n\t\t\tgradient:\n\t\t\t\t'linear-gradient(135deg,rgb(255,245,203) 0%,rgb(182,227,212) 50%,rgb(51,167,181) 100%)',\n\t\t\tslug: 'pale-ocean',\n\t\t},\n\t\t{\n\t\t\tname: __( 'Electric grass' ),\n\t\t\tgradient:\n\t\t\t\t'linear-gradient(135deg,rgb(202,248,128) 0%,rgb(113,206,126) 100%)',\n\t\t\tslug: 'electric-grass',\n\t\t},\n\t\t{\n\t\t\tname: __( 'Midnight' ),\n\t\t\tgradient:\n\t\t\t\t'linear-gradient(135deg,rgb(2,3,129) 0%,rgb(40,116,252) 100%)',\n\t\t\tslug: 'midnight',\n\t\t},\n\t],\n\n\t__unstableResolvedAssets: { styles: [], scripts: [] },\n};\n"],
|
|
5
|
-
"mappings": ";AAGA,SAAS,IAAI,UAAU;AAEhB,IAAM,uBAAuB;AAAA,EACnC,aAAa,CAAC;AACf;AA6BO,IAAM,oBAAoB;AAAA,EAChC,WAAW;AAAA,EACX,gBAAgB;AAAA;AAAA;AAAA,EAIhB,QAAQ;AAAA,IACP;AAAA,MACC,MAAM,GAAI,OAAQ;AAAA,MAClB,MAAM;AAAA,MACN,OAAO;AAAA,IACR;AAAA,IACA;AAAA,MACC,MAAM,GAAI,kBAAmB;AAAA,MAC7B,MAAM;AAAA,MACN,OAAO;AAAA,IACR;AAAA,IACA;AAAA,MACC,MAAM,GAAI,OAAQ;AAAA,MAClB,MAAM;AAAA,MACN,OAAO;AAAA,IACR;AAAA,IACA;AAAA,MACC,MAAM,G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ACN,MAAM;AAAA,IACP;AAAA,EACD;AAAA;AAAA,EAGA,kBAAkB;AAAA,EAElB,YAAY;AAAA,IACX,EAAE,MAAM,aAAa,MAAM,GAAI,WAAY,EAAE;AAAA,IAC7C,EAAE,MAAM,UAAU,MAAM,GAAI,QAAS,EAAE;AAAA,IACvC,EAAE,MAAM,SAAS,MAAM,GAAI,OAAQ,EAAE;AAAA,IACrC,EAAE,MAAM,QAAQ,MAAM,GAAI,WAAY,EAAE;AAAA,EACzC;AAAA;AAAA,EAGA,cAAc;AAAA;AAAA;AAAA,EAId,UAAU;AAAA;AAAA,EAGV,mBAAmB;AAAA;AAAA,EAGnB,mBAAmB;AAAA;AAAA,EAGnB,kBAAkB;AAAA;AAAA,EAGlB,eAAe;AAAA;AAAA,
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __, _x } from '@wordpress/i18n';\n\nexport const PREFERENCES_DEFAULTS = {\n\tinsertUsage: {},\n};\n\n/**\n * The default editor settings\n *\n * @typedef {Object} SETTINGS_DEFAULT\n * @property {boolean} alignWide Enable/Disable Wide/Full Alignments\n * @property {boolean} supportsLayout Enable/disable layouts support in container blocks.\n * @property {boolean} imageEditing Image Editing settings set to false to disable.\n * @property {Array} imageSizes Available image sizes\n * @property {number} maxWidth Max width to constraint resizing\n * @property {boolean|Array} allowedBlockTypes Allowed block types\n * @property {boolean} hasFixedToolbar Whether or not the editor toolbar is fixed\n * @property {boolean} distractionFree Whether or not the editor UI is distraction free\n * @property {boolean} focusMode Whether the focus mode is enabled or not\n * @property {Array} styles Editor Styles\n * @property {boolean} keepCaretInsideBlock Whether caret should move between blocks in edit mode\n * @property {string} bodyPlaceholder Empty post placeholder\n * @property {string} titlePlaceholder Empty title placeholder\n * @property {boolean} canLockBlocks Whether the user can manage Block Lock state\n * @property {boolean} codeEditingEnabled Whether or not the user can switch to the code editor\n * @property {boolean} generateAnchors Enable/Disable auto anchor generation for Heading blocks\n * @property {boolean} enableOpenverseMediaCategory Enable/Disable the Openverse media category in the inserter.\n * @property {boolean} clearBlockSelection Whether the block editor should clear selection on mousedown when a block is not clicked.\n * @property {boolean} __experimentalCanUserUseUnfilteredHTML Whether the user should be able to use unfiltered HTML or the HTML should be filtered e.g., to remove elements considered insecure like iframes.\n * @property {boolean} __experimentalBlockDirectory Whether the user has enabled the Block Directory\n * @property {Array} __experimentalBlockPatterns Array of objects representing the block patterns\n * @property {Array} __experimentalBlockPatternCategories Array of objects representing the block pattern categories\n */\nexport const SETTINGS_DEFAULTS = {\n\talignWide: false,\n\tsupportsLayout: true,\n\n\t// colors setting is not used anymore now defaults are passed from theme.json on the server and core has its own defaults.\n\t// The setting is only kept for backward compatibility purposes.\n\tcolors: [\n\t\t{\n\t\t\tname: __( 'Black' ),\n\t\t\tslug: 'black',\n\t\t\tcolor: '#000000',\n\t\t},\n\t\t{\n\t\t\tname: __( 'Cyan bluish gray' ),\n\t\t\tslug: 'cyan-bluish-gray',\n\t\t\tcolor: '#abb8c3',\n\t\t},\n\t\t{\n\t\t\tname: __( 'White' ),\n\t\t\tslug: 'white',\n\t\t\tcolor: '#ffffff',\n\t\t},\n\t\t{\n\t\t\tname: __( 'Pale pink' ),\n\t\t\tslug: 'pale-pink',\n\t\t\tcolor: '#f78da7',\n\t\t},\n\t\t{ name: __( 'Vivid red' ), slug: 'vivid-red', color: '#cf2e2e' },\n\t\t{\n\t\t\tname: __( 'Luminous vivid orange' ),\n\t\t\tslug: 'luminous-vivid-orange',\n\t\t\tcolor: '#ff6900',\n\t\t},\n\t\t{\n\t\t\tname: __( 'Luminous vivid amber' ),\n\t\t\tslug: 'luminous-vivid-amber',\n\t\t\tcolor: '#fcb900',\n\t\t},\n\t\t{\n\t\t\tname: __( 'Light green cyan' ),\n\t\t\tslug: 'light-green-cyan',\n\t\t\tcolor: '#7bdcb5',\n\t\t},\n\t\t{\n\t\t\tname: __( 'Vivid green cyan' ),\n\t\t\tslug: 'vivid-green-cyan',\n\t\t\tcolor: '#00d084',\n\t\t},\n\t\t{\n\t\t\tname: __( 'Pale cyan blue' ),\n\t\t\tslug: 'pale-cyan-blue',\n\t\t\tcolor: '#8ed1fc',\n\t\t},\n\t\t{\n\t\t\tname: __( 'Vivid cyan blue' ),\n\t\t\tslug: 'vivid-cyan-blue',\n\t\t\tcolor: '#0693e3',\n\t\t},\n\t\t{\n\t\t\tname: __( 'Vivid purple' ),\n\t\t\tslug: 'vivid-purple',\n\t\t\tcolor: '#9b51e0',\n\t\t},\n\t],\n\t// fontSizes setting is not used anymore now defaults are passed from theme.json on the server and core has its own defaults.\n\t// The setting is only kept for backward compatibility purposes.\n\tfontSizes: [\n\t\t{\n\t\t\tname: _x( 'Small', 'font size name' ),\n\t\t\tsize: 13,\n\t\t\tslug: 'small',\n\t\t},\n\t\t{\n\t\t\tname: _x( 'Normal', 'font size name' ),\n\t\t\tsize: 16,\n\t\t\tslug: 'normal',\n\t\t},\n\t\t{\n\t\t\tname: _x( 'Medium', 'font size name' ),\n\t\t\tsize: 20,\n\t\t\tslug: 'medium',\n\t\t},\n\t\t{\n\t\t\tname: _x( 'Large', 'font size name' ),\n\t\t\tsize: 36,\n\t\t\tslug: 'large',\n\t\t},\n\t\t{\n\t\t\tname: _x( 'Huge', 'font size name' ),\n\t\t\tsize: 42,\n\t\t\tslug: 'huge',\n\t\t},\n\t],\n\n\t// Image default size slug.\n\timageDefaultSize: 'large',\n\n\timageSizes: [\n\t\t{ slug: 'thumbnail', name: __( 'Thumbnail' ) },\n\t\t{ slug: 'medium', name: __( 'Medium' ) },\n\t\t{ slug: 'large', name: __( 'Large' ) },\n\t\t{ slug: 'full', name: __( 'Full Size' ) },\n\t],\n\n\t// Allow plugin to disable Image Editor if need be.\n\timageEditing: true,\n\n\t// This is current max width of the block inner area\n\t// It's used to constraint image resizing and this value could be overridden later by themes\n\tmaxWidth: 580,\n\n\t// Allowed block types for the editor, defaulting to true (all supported).\n\tallowedBlockTypes: true,\n\n\t// Maximum upload size in bytes allowed for the site.\n\tmaxUploadFileSize: 0,\n\n\t// List of allowed mime types and file extensions.\n\tallowedMimeTypes: null,\n\n\t// Allows to disable block locking interface.\n\tcanLockBlocks: true,\n\n\t// Whether the user can edit custom CSS (requires edit_css capability).\n\t// Defaults to false for safety - PHP passes true when user has capability.\n\tcanEditCSS: false,\n\n\t// Allows to disable Openverse media category in the inserter.\n\tenableOpenverseMediaCategory: true,\n\n\tclearBlockSelection: true,\n\n\t__experimentalCanUserUseUnfilteredHTML: false,\n\t__experimentalBlockDirectory: false,\n\t__mobileEnablePageTemplates: false,\n\t__experimentalBlockPatterns: [],\n\t__experimentalBlockPatternCategories: [],\n\n\tisPreviewMode: false,\n\n\t// These settings will be completely revamped in the future.\n\t// The goal is to evolve this into an API which will instruct\n\t// the block inspector to animate transitions between what it\n\t// displays based on the relationship between the selected block\n\t// and its parent, and only enable it if the parent is controlling\n\t// its children blocks.\n\tblockInspectorAnimation: {\n\t\tanimationParent: 'core/navigation',\n\t\t'core/navigation': { enterDirection: 'leftToRight' },\n\t\t'core/navigation-submenu': { enterDirection: 'rightToLeft' },\n\t\t'core/navigation-link': { enterDirection: 'rightToLeft' },\n\t\t'core/search': { enterDirection: 'rightToLeft' },\n\t\t'core/social-links': { enterDirection: 'rightToLeft' },\n\t\t'core/page-list': { enterDirection: 'rightToLeft' },\n\t\t'core/spacer': { enterDirection: 'rightToLeft' },\n\t\t'core/home-link': { enterDirection: 'rightToLeft' },\n\t\t'core/site-title': { enterDirection: 'rightToLeft' },\n\t\t'core/site-logo': { enterDirection: 'rightToLeft' },\n\t},\n\n\tgenerateAnchors: false,\n\t// gradients setting is not used anymore now defaults are passed from theme.json on the server and core has its own defaults.\n\t// The setting is only kept for backward compatibility purposes.\n\tgradients: [\n\t\t{\n\t\t\tname: __( 'Vivid cyan blue to vivid purple' ),\n\t\t\tgradient:\n\t\t\t\t'linear-gradient(135deg,rgba(6,147,227,1) 0%,rgb(155,81,224) 100%)',\n\t\t\tslug: 'vivid-cyan-blue-to-vivid-purple',\n\t\t},\n\t\t{\n\t\t\tname: __( 'Light green cyan to vivid green cyan' ),\n\t\t\tgradient:\n\t\t\t\t'linear-gradient(135deg,rgb(122,220,180) 0%,rgb(0,208,130) 100%)',\n\t\t\tslug: 'light-green-cyan-to-vivid-green-cyan',\n\t\t},\n\t\t{\n\t\t\tname: __( 'Luminous vivid amber to luminous vivid orange' ),\n\t\t\tgradient:\n\t\t\t\t'linear-gradient(135deg,rgba(252,185,0,1) 0%,rgba(255,105,0,1) 100%)',\n\t\t\tslug: 'luminous-vivid-amber-to-luminous-vivid-orange',\n\t\t},\n\t\t{\n\t\t\tname: __( 'Luminous vivid orange to vivid red' ),\n\t\t\tgradient:\n\t\t\t\t'linear-gradient(135deg,rgba(255,105,0,1) 0%,rgb(207,46,46) 100%)',\n\t\t\tslug: 'luminous-vivid-orange-to-vivid-red',\n\t\t},\n\t\t{\n\t\t\tname: __( 'Very light gray to cyan bluish gray' ),\n\t\t\tgradient:\n\t\t\t\t'linear-gradient(135deg,rgb(238,238,238) 0%,rgb(169,184,195) 100%)',\n\t\t\tslug: 'very-light-gray-to-cyan-bluish-gray',\n\t\t},\n\t\t{\n\t\t\tname: __( 'Cool to warm spectrum' ),\n\t\t\tgradient:\n\t\t\t\t'linear-gradient(135deg,rgb(74,234,220) 0%,rgb(151,120,209) 20%,rgb(207,42,186) 40%,rgb(238,44,130) 60%,rgb(251,105,98) 80%,rgb(254,248,76) 100%)',\n\t\t\tslug: 'cool-to-warm-spectrum',\n\t\t},\n\t\t{\n\t\t\tname: __( 'Blush light purple' ),\n\t\t\tgradient:\n\t\t\t\t'linear-gradient(135deg,rgb(255,206,236) 0%,rgb(152,150,240) 100%)',\n\t\t\tslug: 'blush-light-purple',\n\t\t},\n\t\t{\n\t\t\tname: __( 'Blush bordeaux' ),\n\t\t\tgradient:\n\t\t\t\t'linear-gradient(135deg,rgb(254,205,165) 0%,rgb(254,45,45) 50%,rgb(107,0,62) 100%)',\n\t\t\tslug: 'blush-bordeaux',\n\t\t},\n\t\t{\n\t\t\tname: __( 'Luminous dusk' ),\n\t\t\tgradient:\n\t\t\t\t'linear-gradient(135deg,rgb(255,203,112) 0%,rgb(199,81,192) 50%,rgb(65,88,208) 100%)',\n\t\t\tslug: 'luminous-dusk',\n\t\t},\n\t\t{\n\t\t\tname: __( 'Pale ocean' ),\n\t\t\tgradient:\n\t\t\t\t'linear-gradient(135deg,rgb(255,245,203) 0%,rgb(182,227,212) 50%,rgb(51,167,181) 100%)',\n\t\t\tslug: 'pale-ocean',\n\t\t},\n\t\t{\n\t\t\tname: __( 'Electric grass' ),\n\t\t\tgradient:\n\t\t\t\t'linear-gradient(135deg,rgb(202,248,128) 0%,rgb(113,206,126) 100%)',\n\t\t\tslug: 'electric-grass',\n\t\t},\n\t\t{\n\t\t\tname: __( 'Midnight' ),\n\t\t\tgradient:\n\t\t\t\t'linear-gradient(135deg,rgb(2,3,129) 0%,rgb(40,116,252) 100%)',\n\t\t\tslug: 'midnight',\n\t\t},\n\t],\n\n\t__unstableResolvedAssets: { styles: [], scripts: [] },\n};\n"],
|
|
5
|
+
"mappings": ";AAGA,SAAS,IAAI,UAAU;AAEhB,IAAM,uBAAuB;AAAA,EACnC,aAAa,CAAC;AACf;AA6BO,IAAM,oBAAoB;AAAA,EAChC,WAAW;AAAA,EACX,gBAAgB;AAAA;AAAA;AAAA,EAIhB,QAAQ;AAAA,IACP;AAAA,MACC,MAAM,GAAI,OAAQ;AAAA,MAClB,MAAM;AAAA,MACN,OAAO;AAAA,IACR;AAAA,IACA;AAAA,MACC,MAAM,GAAI,kBAAmB;AAAA,MAC7B,MAAM;AAAA,MACN,OAAO;AAAA,IACR;AAAA,IACA;AAAA,MACC,MAAM,GAAI,OAAQ;AAAA,MAClB,MAAM;AAAA,MACN,OAAO;AAAA,IACR;AAAA,IACA;AAAA,MACC,MAAM,GAAI,WAAY;AAAA,MACtB,MAAM;AAAA,MACN,OAAO;AAAA,IACR;AAAA,IACA,EAAE,MAAM,GAAI,WAAY,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A,IACA;AAAA,MACC,MAAM,GAAI,sCAAuC;AAAA,MACjD,UACC;AAAA,MACD,MAAM;AAAA,IACP;AAAA,IACA;AAAA,MACC,MAAM,GAAI,+CAAgD;AAAA,MAC1D,UACC;AAAA,MACD,MAAM;AAAA,IACP;AAAA,IACA;AAAA,MACC,MAAM,GAAI,oCAAqC;AAAA,MAC/C,UACC;AAAA,MACD,MAAM;AAAA,IACP;AAAA,IACA;AAAA,MACC,MAAM,GAAI,qCAAsC;AAAA,MAChD,UACC;AAAA,MACD,MAAM;AAAA,IACP;AAAA,IACA;AAAA,MACC,MAAM,GAAI,uBAAwB;AAAA,MAClC,UACC;AAAA,MACD,MAAM;AAAA,IACP;AAAA,IACA;AAAA,MACC,MAAM,GAAI,oBAAqB;AAAA,MAC/B,UACC;AAAA,MACD,MAAM;AAAA,IACP;AAAA,IACA;AAAA,MACC,MAAM,GAAI,gBAAiB;AAAA,MAC3B,UACC;AAAA,MACD,MAAM;AAAA,IACP;AAAA,IACA;AAAA,MACC,MAAM,GAAI,eAAgB;AAAA,MAC1B,UACC;AAAA,MACD,MAAM;AAAA,IACP;AAAA,IACA;AAAA,MACC,MAAM,GAAI,YAAa;AAAA,MACvB,UACC;AAAA,MACD,MAAM;AAAA,IACP;AAAA,IACA;AAAA,MACC,MAAM,GAAI,gBAAiB;AAAA,MAC3B,UACC;AAAA,MACD,MAAM;AAAA,IACP;AAAA,IACA;AAAA,MACC,MAAM,GAAI,UAAW;AAAA,MACrB,UACC;AAAA,MACD,MAAM;AAAA,IACP;AAAA,EACD;AAAA,EAEA,0BAA0B,EAAE,QAAQ,CAAC,GAAG,SAAS,CAAC,EAAE;AACrD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -29,13 +29,9 @@ import {
|
|
|
29
29
|
selectBlockPatternsKey,
|
|
30
30
|
reusableBlocksSelectKey,
|
|
31
31
|
sectionRootClientIdKey,
|
|
32
|
-
isIsolatedEditorKey
|
|
33
|
-
deviceTypeKey
|
|
32
|
+
isIsolatedEditorKey
|
|
34
33
|
} from "./private-keys.mjs";
|
|
35
|
-
import {
|
|
36
|
-
BLOCK_VISIBILITY_VIEWPORT_ENTRIES,
|
|
37
|
-
BLOCK_VISIBILITY_VIEWPORTS
|
|
38
|
-
} from "../components/block-visibility/constants.mjs";
|
|
34
|
+
import { BLOCK_VISIBILITY_VIEWPORTS } from "../components/block-visibility/constants.mjs";
|
|
39
35
|
import { getBlockSettings } from "./get-block-settings.mjs";
|
|
40
36
|
var { isContentBlock } = unlock(blocksPrivateApis);
|
|
41
37
|
function isBlockInterfaceHidden(state) {
|
|
@@ -365,7 +361,7 @@ function getClosestAllowedInsertionPointForPattern(state, pattern, clientId) {
|
|
|
365
361
|
function getInsertionPoint(state) {
|
|
366
362
|
return state.insertionPoint;
|
|
367
363
|
}
|
|
368
|
-
var
|
|
364
|
+
var isBlockHiddenAnywhere = (state, clientId) => {
|
|
369
365
|
const blockName = getBlockName(state, clientId);
|
|
370
366
|
if (!hasBlockSupport(blockName, "visibility", true)) {
|
|
371
367
|
return false;
|
|
@@ -375,43 +371,47 @@ var isBlockHidden = (state, clientId) => {
|
|
|
375
371
|
if (blockVisibility === false) {
|
|
376
372
|
return true;
|
|
377
373
|
}
|
|
378
|
-
if (
|
|
379
|
-
return
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
const settings = getSettings(state);
|
|
383
|
-
const viewportType = settings[deviceTypeKey] ?? BLOCK_VISIBILITY_VIEWPORTS.desktop.key;
|
|
384
|
-
const viewportKey = viewportType.toLowerCase();
|
|
385
|
-
return blockVisibility?.[viewportKey] === false;
|
|
374
|
+
if (typeof blockVisibility?.viewport === "object" && blockVisibility?.viewport !== null) {
|
|
375
|
+
return Object.values(BLOCK_VISIBILITY_VIEWPORTS).some(
|
|
376
|
+
(viewport) => blockVisibility?.viewport?.[viewport.key] === false
|
|
377
|
+
);
|
|
386
378
|
}
|
|
387
379
|
return false;
|
|
388
380
|
};
|
|
389
|
-
var
|
|
390
|
-
|
|
381
|
+
var isBlockHiddenEverywhere = (state, clientId) => {
|
|
382
|
+
const blockName = getBlockName(state, clientId);
|
|
383
|
+
if (!hasBlockSupport(blockName, "visibility", true)) {
|
|
391
384
|
return false;
|
|
392
385
|
}
|
|
393
|
-
|
|
386
|
+
const attributes = state.blocks.attributes.get(clientId);
|
|
387
|
+
const blockVisibility = attributes?.metadata?.blockVisibility;
|
|
388
|
+
if (blockVisibility === false) {
|
|
389
|
+
return true;
|
|
390
|
+
}
|
|
391
|
+
return false;
|
|
394
392
|
};
|
|
395
|
-
var
|
|
396
|
-
|
|
397
|
-
|
|
393
|
+
var isBlockParentHiddenEverywhere = (state, clientId) => {
|
|
394
|
+
const parents = getBlockParents(state, clientId);
|
|
395
|
+
return parents.some(
|
|
396
|
+
(parentId) => isBlockHiddenEverywhere(state, parentId)
|
|
397
|
+
);
|
|
398
|
+
};
|
|
399
|
+
var isBlockHiddenAtViewport = (state, clientId, viewport) => {
|
|
400
|
+
if (isBlockHiddenEverywhere(state, clientId)) {
|
|
401
|
+
return true;
|
|
398
402
|
}
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
return BLOCK_VISIBILITY_VIEWPORT_ENTRIES.some(
|
|
412
|
-
([, { key }]) => blockVisibility?.[key] === false
|
|
413
|
-
);
|
|
414
|
-
});
|
|
403
|
+
const attributes = state.blocks.attributes.get(clientId);
|
|
404
|
+
const blockVisibilityViewport = attributes?.metadata?.blockVisibility?.viewport;
|
|
405
|
+
if (typeof blockVisibilityViewport === "object" && blockVisibilityViewport !== null && typeof viewport === "string") {
|
|
406
|
+
return blockVisibilityViewport?.[viewport.toLowerCase()] === false;
|
|
407
|
+
}
|
|
408
|
+
return false;
|
|
409
|
+
};
|
|
410
|
+
var isBlockParentHiddenAtViewport = (state, clientId, viewport) => {
|
|
411
|
+
const parents = getBlockParents(state, clientId);
|
|
412
|
+
return parents.some(
|
|
413
|
+
(parentId) => isBlockHiddenAtViewport(state, parentId, viewport)
|
|
414
|
+
);
|
|
415
415
|
};
|
|
416
416
|
function hasBlockSpotlight(state) {
|
|
417
417
|
return !!state.hasBlockSpotlight || !!state.editedContentOnlySection;
|
|
@@ -442,8 +442,6 @@ function isLockedBlock(state, clientId) {
|
|
|
442
442
|
return isEditLockedBlock(state, clientId) || isMoveLockedBlock(state, clientId) || isRemoveLockedBlock(state, clientId);
|
|
443
443
|
}
|
|
444
444
|
export {
|
|
445
|
-
areBlocksHidden,
|
|
446
|
-
areBlocksHiddenAnywhere,
|
|
447
445
|
getAllPatterns,
|
|
448
446
|
getBlockRemovalRules,
|
|
449
447
|
getBlockSettings,
|
|
@@ -470,8 +468,12 @@ export {
|
|
|
470
468
|
getZoomLevel,
|
|
471
469
|
hasAllowedPatterns,
|
|
472
470
|
hasBlockSpotlight,
|
|
473
|
-
|
|
471
|
+
isBlockHiddenAnywhere,
|
|
472
|
+
isBlockHiddenAtViewport,
|
|
473
|
+
isBlockHiddenEverywhere,
|
|
474
474
|
isBlockInterfaceHidden,
|
|
475
|
+
isBlockParentHiddenAtViewport,
|
|
476
|
+
isBlockParentHiddenEverywhere,
|
|
475
477
|
isBlockSubtreeDisabled,
|
|
476
478
|
isContainerInsertableToInContentOnlyMode,
|
|
477
479
|
isDragging,
|