@wordpress/block-editor 13.3.0 → 13.4.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/README.md +0 -4
- package/build/components/alignment-control/ui.js +2 -2
- package/build/components/alignment-control/ui.js.map +1 -1
- package/build/components/block-alignment-control/ui.js +1 -1
- package/build/components/block-alignment-control/ui.js.map +1 -1
- package/build/components/block-alignment-control/ui.native.js +1 -1
- package/build/components/block-alignment-control/ui.native.js.map +1 -1
- package/build/components/block-inspector/index.js +6 -3
- package/build/components/block-inspector/index.js.map +1 -1
- package/build/components/block-list/use-block-props/index.js +3 -1
- package/build/components/block-list/use-block-props/index.js.map +1 -1
- package/build/components/block-list/use-block-props/use-block-refs.js +9 -2
- package/build/components/block-list/use-block-props/use-block-refs.js.map +1 -1
- package/build/components/block-list/use-block-props/use-is-hovered.js +25 -9
- package/build/components/block-list/use-block-props/use-is-hovered.js.map +1 -1
- package/build/components/block-list/use-in-between-inserter.js +3 -2
- package/build/components/block-list/use-in-between-inserter.js.map +1 -1
- package/build/components/block-lock/modal.js +2 -0
- package/build/components/block-lock/modal.js.map +1 -1
- package/build/components/block-removal-warning-modal/index.js +2 -0
- package/build/components/block-removal-warning-modal/index.js.map +1 -1
- package/build/components/block-switcher/index.js +1 -1
- package/build/components/block-switcher/index.js.map +1 -1
- package/build/components/block-switcher/pattern-transformations-menu.js +11 -12
- package/build/components/block-switcher/pattern-transformations-menu.js.map +1 -1
- package/build/components/block-switcher/preview-block-popover.js +20 -17
- package/build/components/block-switcher/preview-block-popover.js.map +1 -1
- package/build/components/block-toolbar/shuffle.js +5 -2
- package/build/components/block-toolbar/shuffle.js.map +1 -1
- package/build/components/block-tools/use-show-block-tools.js +7 -8
- package/build/components/block-tools/use-show-block-tools.js.map +1 -1
- package/build/components/block-tools/zoom-out-mode-inserter-button.js +45 -0
- package/build/components/block-tools/zoom-out-mode-inserter-button.js.map +1 -0
- package/build/components/block-tools/zoom-out-mode-inserters.js +27 -27
- package/build/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
- package/build/components/block-tools/zoom-out-popover.js +2 -1
- package/build/components/block-tools/zoom-out-popover.js.map +1 -1
- package/build/components/block-tools/zoom-out-toolbar.js +1 -1
- package/build/components/block-tools/zoom-out-toolbar.js.map +1 -1
- package/build/components/date-format-picker/index.js +2 -11
- package/build/components/date-format-picker/index.js.map +1 -1
- package/build/components/default-block-appender/index.js +7 -4
- package/build/components/default-block-appender/index.js.map +1 -1
- package/build/components/font-appearance-control/index.js +2 -7
- package/build/components/font-appearance-control/index.js.map +1 -1
- package/build/components/global-styles/background-panel.js +8 -1
- package/build/components/global-styles/background-panel.js.map +1 -1
- package/build/components/global-styles/hooks.js +5 -1
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/typography-panel.js +26 -43
- package/build/components/global-styles/typography-panel.js.map +1 -1
- package/build/components/global-styles/typography-utils.js +78 -7
- package/build/components/global-styles/typography-utils.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +24 -5
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/grid/grid-item-movers.js +89 -44
- package/build/components/grid/grid-item-movers.js.map +1 -1
- package/build/components/grid/grid-visualizer.js +1 -1
- package/build/components/grid/grid-visualizer.js.map +1 -1
- package/build/components/grid/use-grid-layout-sync.js +40 -28
- package/build/components/grid/use-grid-layout-sync.js.map +1 -1
- package/build/components/index.js +1 -9
- package/build/components/index.js.map +1 -1
- package/build/components/inner-blocks/index.js +1 -1
- package/build/components/inner-blocks/index.js.map +1 -1
- package/build/components/inserter/block-patterns-tab/patterns-filter.js +20 -23
- package/build/components/inserter/block-patterns-tab/patterns-filter.js.map +1 -1
- package/build/components/inserter/media-tab/media-panel.js +1 -0
- package/build/components/inserter/media-tab/media-panel.js.map +1 -1
- package/build/components/inserter/menu.js +1 -1
- package/build/components/inserter/menu.js.map +1 -1
- package/build/components/inserter/preview-panel.js +20 -3
- package/build/components/inserter/preview-panel.js.map +1 -1
- package/build/components/inserter-draggable-blocks/index.js +10 -3
- package/build/components/inserter-draggable-blocks/index.js.map +1 -1
- package/build/components/inspector-controls-tabs/settings-tab.js +1 -2
- package/build/components/inspector-controls-tabs/settings-tab.js.map +1 -1
- package/build/components/list-view/block-select-button.js +2 -6
- package/build/components/list-view/block-select-button.js.map +1 -1
- package/build/components/list-view/block.js +2 -2
- package/build/components/list-view/block.js.map +1 -1
- package/build/components/list-view/utils.js +3 -1
- package/build/components/list-view/utils.js.map +1 -1
- package/build/components/rich-text/format-toolbar/index.js +1 -1
- package/build/components/rich-text/format-toolbar/index.js.map +1 -1
- package/build/components/rich-text/index.js +1 -1
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js +4 -2
- package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
- package/build/components/url-popover/image-url-input-ui.js +3 -3
- package/build/components/url-popover/image-url-input-ui.js.map +1 -1
- package/build/hooks/grid-visualizer.js +5 -8
- package/build/hooks/grid-visualizer.js.map +1 -1
- package/build/hooks/layout-child.js +9 -2
- package/build/hooks/layout-child.js.map +1 -1
- package/build/hooks/position.js +3 -7
- package/build/hooks/position.js.map +1 -1
- package/build/hooks/use-bindings-attributes.js +81 -50
- package/build/hooks/use-bindings-attributes.js.map +1 -1
- package/build/layouts/constrained.js +6 -2
- package/build/layouts/constrained.js.map +1 -1
- package/build/layouts/grid.js +2 -0
- package/build/layouts/grid.js.map +1 -1
- package/build/private-apis.js +0 -3
- package/build/private-apis.js.map +1 -1
- package/build/store/actions.js +18 -1
- package/build/store/actions.js.map +1 -1
- package/build/store/reducer.js +19 -1
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +13 -1
- package/build/store/selectors.js.map +1 -1
- package/build-module/components/alignment-control/ui.js +2 -2
- package/build-module/components/alignment-control/ui.js.map +1 -1
- package/build-module/components/block-alignment-control/ui.js +1 -1
- package/build-module/components/block-alignment-control/ui.js.map +1 -1
- package/build-module/components/block-alignment-control/ui.native.js +1 -1
- package/build-module/components/block-alignment-control/ui.native.js.map +1 -1
- package/build-module/components/block-inspector/index.js +6 -3
- package/build-module/components/block-inspector/index.js.map +1 -1
- package/build-module/components/block-list/use-block-props/index.js +3 -1
- package/build-module/components/block-list/use-block-props/index.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-block-refs.js +11 -4
- package/build-module/components/block-list/use-block-props/use-block-refs.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-is-hovered.js +26 -9
- package/build-module/components/block-list/use-block-props/use-is-hovered.js.map +1 -1
- package/build-module/components/block-list/use-in-between-inserter.js +3 -2
- package/build-module/components/block-list/use-in-between-inserter.js.map +1 -1
- package/build-module/components/block-lock/modal.js +2 -0
- package/build-module/components/block-lock/modal.js.map +1 -1
- package/build-module/components/block-removal-warning-modal/index.js +2 -0
- package/build-module/components/block-removal-warning-modal/index.js.map +1 -1
- package/build-module/components/block-switcher/index.js +1 -1
- package/build-module/components/block-switcher/index.js.map +1 -1
- package/build-module/components/block-switcher/pattern-transformations-menu.js +12 -13
- package/build-module/components/block-switcher/pattern-transformations-menu.js.map +1 -1
- package/build-module/components/block-switcher/preview-block-popover.js +20 -17
- package/build-module/components/block-switcher/preview-block-popover.js.map +1 -1
- package/build-module/components/block-toolbar/shuffle.js +5 -2
- package/build-module/components/block-toolbar/shuffle.js.map +1 -1
- package/build-module/components/block-tools/use-show-block-tools.js +7 -8
- package/build-module/components/block-tools/use-show-block-tools.js.map +1 -1
- package/build-module/components/block-tools/zoom-out-mode-inserter-button.js +37 -0
- package/build-module/components/block-tools/zoom-out-mode-inserter-button.js.map +1 -0
- package/build-module/components/block-tools/zoom-out-mode-inserters.js +28 -28
- package/build-module/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
- package/build-module/components/block-tools/zoom-out-popover.js +2 -1
- package/build-module/components/block-tools/zoom-out-popover.js.map +1 -1
- package/build-module/components/block-tools/zoom-out-toolbar.js +1 -1
- package/build-module/components/block-tools/zoom-out-toolbar.js.map +1 -1
- package/build-module/components/date-format-picker/index.js +4 -12
- package/build-module/components/date-format-picker/index.js.map +1 -1
- package/build-module/components/default-block-appender/index.js +7 -4
- package/build-module/components/default-block-appender/index.js.map +1 -1
- package/build-module/components/font-appearance-control/index.js +3 -6
- package/build-module/components/font-appearance-control/index.js.map +1 -1
- package/build-module/components/global-styles/background-panel.js +8 -1
- package/build-module/components/global-styles/background-panel.js.map +1 -1
- package/build-module/components/global-styles/hooks.js +5 -1
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/typography-panel.js +27 -44
- package/build-module/components/global-styles/typography-panel.js.map +1 -1
- package/build-module/components/global-styles/typography-utils.js +76 -7
- package/build-module/components/global-styles/typography-utils.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +24 -5
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/grid/grid-item-movers.js +92 -46
- package/build-module/components/grid/grid-item-movers.js.map +1 -1
- package/build-module/components/grid/grid-visualizer.js +1 -1
- package/build-module/components/grid/grid-visualizer.js.map +1 -1
- package/build-module/components/grid/use-grid-layout-sync.js +41 -29
- package/build-module/components/grid/use-grid-layout-sync.js.map +1 -1
- package/build-module/components/index.js +0 -5
- package/build-module/components/index.js.map +1 -1
- package/build-module/components/inner-blocks/index.js +1 -1
- package/build-module/components/inner-blocks/index.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab/patterns-filter.js +20 -23
- package/build-module/components/inserter/block-patterns-tab/patterns-filter.js.map +1 -1
- package/build-module/components/inserter/media-tab/media-panel.js +1 -0
- package/build-module/components/inserter/media-tab/media-panel.js.map +1 -1
- package/build-module/components/inserter/menu.js +1 -1
- package/build-module/components/inserter/menu.js.map +1 -1
- package/build-module/components/inserter/preview-panel.js +20 -3
- package/build-module/components/inserter/preview-panel.js.map +1 -1
- package/build-module/components/inserter-draggable-blocks/index.js +10 -3
- package/build-module/components/inserter-draggable-blocks/index.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/settings-tab.js +1 -2
- package/build-module/components/inspector-controls-tabs/settings-tab.js.map +1 -1
- package/build-module/components/list-view/block-select-button.js +3 -7
- package/build-module/components/list-view/block-select-button.js.map +1 -1
- package/build-module/components/list-view/block.js +2 -2
- package/build-module/components/list-view/block.js.map +1 -1
- package/build-module/components/list-view/utils.js +3 -1
- package/build-module/components/list-view/utils.js.map +1 -1
- package/build-module/components/rich-text/format-toolbar/index.js +1 -1
- package/build-module/components/rich-text/format-toolbar/index.js.map +1 -1
- package/build-module/components/rich-text/index.js +1 -1
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js +4 -2
- package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
- package/build-module/components/url-popover/image-url-input-ui.js +3 -3
- package/build-module/components/url-popover/image-url-input-ui.js.map +1 -1
- package/build-module/hooks/grid-visualizer.js +5 -8
- package/build-module/hooks/grid-visualizer.js.map +1 -1
- package/build-module/hooks/layout-child.js +9 -2
- package/build-module/hooks/layout-child.js.map +1 -1
- package/build-module/hooks/position.js +3 -7
- package/build-module/hooks/position.js.map +1 -1
- package/build-module/hooks/use-bindings-attributes.js +81 -51
- package/build-module/hooks/use-bindings-attributes.js.map +1 -1
- package/build-module/layouts/constrained.js +6 -2
- package/build-module/layouts/constrained.js.map +1 -1
- package/build-module/layouts/grid.js +2 -0
- package/build-module/layouts/grid.js.map +1 -1
- package/build-module/private-apis.js +0 -3
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/actions.js +15 -0
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/reducer.js +18 -1
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +10 -0
- package/build-module/store/selectors.js.map +1 -1
- package/build-style/content-rtl.css +6 -6
- package/build-style/content.css +6 -6
- package/build-style/style-rtl.css +167 -103
- package/build-style/style.css +167 -103
- package/build-types/components/block-context/index.d.ts +2 -2
- package/build-types/components/block-context/index.d.ts.map +1 -1
- package/build-types/utils/dom.d.ts.map +1 -1
- package/package.json +31 -31
- package/src/components/alignment-control/ui.js +2 -2
- package/src/components/block-alignment-control/ui.js +1 -1
- package/src/components/block-alignment-control/ui.native.js +1 -1
- package/src/components/block-context/README.md +4 -4
- package/src/components/block-inspector/index.js +8 -4
- package/src/components/block-list/content.scss +2 -16
- package/src/components/block-list/use-block-props/index.js +1 -1
- package/src/components/block-list/use-block-props/use-block-refs.js +19 -3
- package/src/components/block-list/use-block-props/use-is-hovered.js +26 -11
- package/src/components/block-list/use-in-between-inserter.js +5 -1
- package/src/components/block-lock/modal.js +10 -2
- package/src/components/block-lock/style.scss +4 -8
- package/src/components/block-patterns-paging/style.scss +0 -23
- package/src/components/block-removal-warning-modal/index.js +10 -2
- package/src/components/block-switcher/index.js +1 -1
- package/src/components/block-switcher/pattern-transformations-menu.js +17 -15
- package/src/components/block-switcher/preview-block-popover.js +20 -14
- package/src/components/block-switcher/style.scss +8 -17
- package/src/components/block-toolbar/shuffle.js +8 -1
- package/src/components/block-tools/style.scss +8 -0
- package/src/components/block-tools/use-show-block-tools.js +12 -9
- package/src/components/block-tools/zoom-out-mode-inserter-button.js +47 -0
- package/src/components/block-tools/zoom-out-mode-inserters.js +43 -33
- package/src/components/block-tools/zoom-out-popover.js +1 -0
- package/src/components/block-tools/zoom-out-toolbar.js +1 -1
- package/src/components/date-format-picker/index.js +2 -11
- package/src/components/default-block-appender/index.js +11 -4
- package/src/components/font-appearance-control/index.js +1 -5
- package/src/components/global-styles/background-panel.js +21 -1
- package/src/components/global-styles/hooks.js +5 -1
- package/src/components/global-styles/style.scss +12 -0
- package/src/components/global-styles/test/typography-utils.js +325 -0
- package/src/components/global-styles/test/use-global-styles-output.js +3 -1
- package/src/components/global-styles/typography-panel.js +36 -44
- package/src/components/global-styles/typography-utils.js +103 -7
- package/src/components/global-styles/use-global-styles-output.js +22 -2
- package/src/components/grid/grid-item-movers.js +139 -69
- package/src/components/grid/grid-visualizer.js +1 -1
- package/src/components/grid/style.scss +114 -0
- package/src/components/grid/use-grid-layout-sync.js +66 -27
- package/src/components/iframe/content.scss +1 -1
- package/src/components/index.js +0 -5
- package/src/components/inner-blocks/index.js +4 -1
- package/src/components/inserter/block-patterns-tab/patterns-filter.js +40 -44
- package/src/components/inserter/media-tab/media-panel.js +1 -0
- package/src/components/inserter/menu.js +1 -1
- package/src/components/inserter/preview-panel.js +27 -4
- package/src/components/inserter/style.scss +57 -43
- package/src/components/inserter-draggable-blocks/index.js +11 -3
- package/src/components/inspector-controls-tabs/settings-tab.js +0 -2
- package/src/components/inspector-controls-tabs/style.scss +0 -21
- package/src/components/list-view/block-select-button.js +3 -13
- package/src/components/list-view/block.js +10 -3
- package/src/components/list-view/style.scss +2 -1
- package/src/components/list-view/utils.js +13 -2
- package/src/components/rich-text/format-toolbar/index.js +1 -1
- package/src/components/rich-text/index.js +1 -1
- package/src/components/spacing-sizes-control/input-controls/spacing-input-control.js +3 -1
- package/src/components/url-popover/image-url-input-ui.js +3 -3
- package/src/components/url-popover/style.scss +1 -0
- package/src/hooks/grid-visualizer.js +5 -7
- package/src/hooks/layout-child.js +12 -3
- package/src/hooks/position.js +3 -13
- package/src/hooks/use-bindings-attributes.js +89 -59
- package/src/layouts/constrained.js +10 -2
- package/src/layouts/grid.js +2 -0
- package/src/private-apis.js +0 -6
- package/src/store/actions.js +15 -0
- package/src/store/reducer.js +18 -0
- package/src/store/selectors.js +10 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/build/components/inserter/reusable-block-rename-hint.js +0 -71
- package/build/components/inserter/reusable-block-rename-hint.js.map +0 -1
- package/build/components/inspector-controls-tabs/settings-tab-hint.js +0 -53
- package/build/components/inspector-controls-tabs/settings-tab-hint.js.map +0 -1
- package/build-module/components/inserter/reusable-block-rename-hint.js +0 -64
- package/build-module/components/inserter/reusable-block-rename-hint.js.map +0 -1
- package/build-module/components/inspector-controls-tabs/settings-tab-hint.js +0 -47
- package/build-module/components/inspector-controls-tabs/settings-tab-hint.js.map +0 -1
- package/src/components/inserter/reusable-block-rename-hint.js +0 -69
- package/src/components/inspector-controls-tabs/settings-tab-hint.js +0 -52
package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Button","Icon","RangeControl","__experimentalHStack","HStack","__experimentalUnitControl","UnitControl","__experimentalUseCustomUnits","useCustomUnits","__experimentalParseQuantityAndUnitFromRawValue","parseQuantityAndUnitFromRawValue","privateApis","componentsPrivateApis","useSelect","useState","useMemo","usePrevious","__","sprintf","settings","useSettings","store","blockEditorStore","RANGE_CONTROL_MAX_SIZE","ALL_SIDES","LABELS","getSliderValueFromPreset","getCustomValueFromPreset","getPresetValueFromCustomValue","isValueSpacingPreset","unlock","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","CustomSelectControlV2Legacy","CustomSelectControl","CUSTOM_VALUE_SETTINGS","px","max","steps","vw","vh","em","rm","svw","lvw","dvw","svh","lvh","dvh","vi","svi","lvi","dvi","vb","svb","lvb","dvb","vmin","svmin","lvmin","dvmin","vmax","svmax","lvmax","dvmax","SpacingInputControl","icon","isMixed","minimumCustomValue","onChange","onMouseOut","onMouseOver","showSideInLabel","side","spacingSizes","type","value","_CUSTOM_VALUE_SETTING","_CUSTOM_VALUE_SETTING2","selectListSizes","showRangeControl","length","disableCustomSpacingSizes","select","editorSettings","getSettings","showCustomValueControl","setShowCustomValueControl","undefined","minValue","setMinValue","previousValue","availableUnits","units","currentValue","showCustomValueInSelectList","name","slug","size","selectedUnit","setInitialValue","customTooltipContent","newValue","customRangeValue","parseFloat","getNewCustomValue","newSize","isNumeric","isNaN","nextValue","getNewPresetValue","controlType","parseInt","handleCustomValueSliderChange","next","join","allPlaceholder","options","map","index","key","marks","_newValue","label","sideLabel","includes","typeLabel","toLowerCase","ariaLabel","trim","className","children","onFocus","onBlur","min","placeholder","disableUnits","hideLabelFromVision","onDragStart","charAt","onDrag","onDragEnd","step","withInputField","__nextHasNoMarginBottom","onMouseDown","event","nativeEvent","offsetX","renderTooltipContent","find","option","selection","selectedItem","onClick","isPressed","iconSize"],"sources":["@wordpress/block-editor/src/components/spacing-sizes-control/input-controls/spacing-input-control.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\tIcon,\n\tRangeControl,\n\t__experimentalHStack as HStack,\n\t__experimentalUnitControl as UnitControl,\n\t__experimentalUseCustomUnits as useCustomUnits,\n\t__experimentalParseQuantityAndUnitFromRawValue as parseQuantityAndUnitFromRawValue,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { useState, useMemo } from '@wordpress/element';\nimport { usePrevious } from '@wordpress/compose';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { settings } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { useSettings } from '../../use-settings';\nimport { store as blockEditorStore } from '../../../store';\nimport {\n\tRANGE_CONTROL_MAX_SIZE,\n\tALL_SIDES,\n\tLABELS,\n\tgetSliderValueFromPreset,\n\tgetCustomValueFromPreset,\n\tgetPresetValueFromCustomValue,\n\tisValueSpacingPreset,\n} from '../utils';\nimport { unlock } from '../../../lock-unlock';\n\nconst { CustomSelectControlV2Legacy: CustomSelectControl } = unlock(\n\tcomponentsPrivateApis\n);\n\nconst CUSTOM_VALUE_SETTINGS = {\n\tpx: { max: 300, steps: 1 },\n\t'%': { max: 100, steps: 1 },\n\tvw: { max: 100, steps: 1 },\n\tvh: { max: 100, steps: 1 },\n\tem: { max: 10, steps: 0.1 },\n\trm: { max: 10, steps: 0.1 },\n\tsvw: { max: 100, steps: 1 },\n\tlvw: { max: 100, steps: 1 },\n\tdvw: { max: 100, steps: 1 },\n\tsvh: { max: 100, steps: 1 },\n\tlvh: { max: 100, steps: 1 },\n\tdvh: { max: 100, steps: 1 },\n\tvi: { max: 100, steps: 1 },\n\tsvi: { max: 100, steps: 1 },\n\tlvi: { max: 100, steps: 1 },\n\tdvi: { max: 100, steps: 1 },\n\tvb: { max: 100, steps: 1 },\n\tsvb: { max: 100, steps: 1 },\n\tlvb: { max: 100, steps: 1 },\n\tdvb: { max: 100, steps: 1 },\n\tvmin: { max: 100, steps: 1 },\n\tsvmin: { max: 100, steps: 1 },\n\tlvmin: { max: 100, steps: 1 },\n\tdvmin: { max: 100, steps: 1 },\n\tvmax: { max: 100, steps: 1 },\n\tsvmax: { max: 100, steps: 1 },\n\tlvmax: { max: 100, steps: 1 },\n\tdvmax: { max: 100, steps: 1 },\n};\n\nexport default function SpacingInputControl( {\n\ticon,\n\tisMixed = false,\n\tminimumCustomValue,\n\tonChange,\n\tonMouseOut,\n\tonMouseOver,\n\tshowSideInLabel = true,\n\tside,\n\tspacingSizes,\n\ttype,\n\tvalue,\n} ) {\n\t// Treat value as a preset value if the passed in value matches the value of one of the spacingSizes.\n\tvalue = getPresetValueFromCustomValue( value, spacingSizes );\n\n\tlet selectListSizes = spacingSizes;\n\tconst showRangeControl = spacingSizes.length <= RANGE_CONTROL_MAX_SIZE;\n\n\tconst disableCustomSpacingSizes = useSelect( ( select ) => {\n\t\tconst editorSettings = select( blockEditorStore ).getSettings();\n\t\treturn editorSettings?.disableCustomSpacingSizes;\n\t} );\n\n\tconst [ showCustomValueControl, setShowCustomValueControl ] = useState(\n\t\t! disableCustomSpacingSizes &&\n\t\t\tvalue !== undefined &&\n\t\t\t! isValueSpacingPreset( value )\n\t);\n\n\tconst [ minValue, setMinValue ] = useState( minimumCustomValue );\n\n\tconst previousValue = usePrevious( value );\n\tif (\n\t\t!! value &&\n\t\tpreviousValue !== value &&\n\t\t! isValueSpacingPreset( value ) &&\n\t\tshowCustomValueControl !== true\n\t) {\n\t\tsetShowCustomValueControl( true );\n\t}\n\n\tconst [ availableUnits ] = useSettings( 'spacing.units' );\n\tconst units = useCustomUnits( {\n\t\tavailableUnits: availableUnits || [ 'px', 'em', 'rem' ],\n\t} );\n\n\tlet currentValue = null;\n\n\tconst showCustomValueInSelectList =\n\t\t! showRangeControl &&\n\t\t! showCustomValueControl &&\n\t\tvalue !== undefined &&\n\t\t( ! isValueSpacingPreset( value ) ||\n\t\t\t( isValueSpacingPreset( value ) && isMixed ) );\n\n\tif ( showCustomValueInSelectList ) {\n\t\tselectListSizes = [\n\t\t\t...spacingSizes,\n\t\t\t{\n\t\t\t\tname: ! isMixed\n\t\t\t\t\t? // translators: A custom measurement, eg. a number followed by a unit like 12px.\n\t\t\t\t\t sprintf( __( 'Custom (%s)' ), value )\n\t\t\t\t\t: __( 'Mixed' ),\n\t\t\t\tslug: 'custom',\n\t\t\t\tsize: value,\n\t\t\t},\n\t\t];\n\t\tcurrentValue = selectListSizes.length - 1;\n\t} else if ( ! isMixed ) {\n\t\tcurrentValue = ! showCustomValueControl\n\t\t\t? getSliderValueFromPreset( value, spacingSizes )\n\t\t\t: getCustomValueFromPreset( value, spacingSizes );\n\t}\n\n\tconst selectedUnit =\n\t\tuseMemo(\n\t\t\t() => parseQuantityAndUnitFromRawValue( currentValue ),\n\t\t\t[ currentValue ]\n\t\t)[ 1 ] || units[ 0 ]?.value;\n\n\tconst setInitialValue = () => {\n\t\tif ( value === undefined ) {\n\t\t\tonChange( '0' );\n\t\t}\n\t};\n\n\tconst customTooltipContent = ( newValue ) =>\n\t\tvalue === undefined ? undefined : spacingSizes[ newValue ]?.name;\n\n\tconst customRangeValue = parseFloat( currentValue, 10 );\n\n\tconst getNewCustomValue = ( newSize ) => {\n\t\tconst isNumeric = ! isNaN( parseFloat( newSize ) );\n\t\tconst nextValue = isNumeric ? newSize : undefined;\n\t\treturn nextValue;\n\t};\n\n\tconst getNewPresetValue = ( newSize, controlType ) => {\n\t\tconst size = parseInt( newSize, 10 );\n\n\t\tif ( controlType === 'selectList' ) {\n\t\t\tif ( size === 0 ) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\tif ( size === 1 ) {\n\t\t\t\treturn '0';\n\t\t\t}\n\t\t} else if ( size === 0 ) {\n\t\t\treturn '0';\n\t\t}\n\t\treturn `var:preset|spacing|${ spacingSizes[ newSize ]?.slug }`;\n\t};\n\n\tconst handleCustomValueSliderChange = ( next ) => {\n\t\tonChange( [ next, selectedUnit ].join( '' ) );\n\t};\n\n\tconst allPlaceholder = isMixed ? __( 'Mixed' ) : null;\n\n\tconst options = selectListSizes.map( ( size, index ) => ( {\n\t\tkey: index,\n\t\tname: size.name,\n\t} ) );\n\n\tconst marks = spacingSizes.map( ( _newValue, index ) => ( {\n\t\tvalue: index,\n\t\tlabel: undefined,\n\t} ) );\n\n\tconst sideLabel =\n\t\tALL_SIDES.includes( side ) && showSideInLabel ? LABELS[ side ] : '';\n\tconst typeLabel = showSideInLabel ? type?.toLowerCase() : type;\n\n\tconst ariaLabel = sprintf(\n\t\t// translators: 1: The side of the block being modified (top, bottom, left, All sides etc.). 2. Type of spacing being modified (Padding, margin, etc)\n\t\t__( '%1$s %2$s' ),\n\t\tsideLabel,\n\t\ttypeLabel\n\t).trim();\n\n\treturn (\n\t\t<HStack className=\"spacing-sizes-control__wrapper\">\n\t\t\t{ icon && (\n\t\t\t\t<Icon\n\t\t\t\t\tclassName=\"spacing-sizes-control__icon\"\n\t\t\t\t\ticon={ icon }\n\t\t\t\t\tsize={ 24 }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ showCustomValueControl && (\n\t\t\t\t<>\n\t\t\t\t\t<UnitControl\n\t\t\t\t\t\tonMouseOver={ onMouseOver }\n\t\t\t\t\t\tonMouseOut={ onMouseOut }\n\t\t\t\t\t\tonFocus={ onMouseOver }\n\t\t\t\t\t\tonBlur={ onMouseOut }\n\t\t\t\t\t\tonChange={ ( newSize ) =>\n\t\t\t\t\t\t\tonChange( getNewCustomValue( newSize ) )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tvalue={ currentValue }\n\t\t\t\t\t\tunits={ units }\n\t\t\t\t\t\tmin={ minValue }\n\t\t\t\t\t\tplaceholder={ allPlaceholder }\n\t\t\t\t\t\tdisableUnits={ isMixed }\n\t\t\t\t\t\tlabel={ ariaLabel }\n\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\tclassName=\"spacing-sizes-control__custom-value-input\"\n\t\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\t\tonDragStart={ () => {\n\t\t\t\t\t\t\tif ( value?.charAt( 0 ) === '-' ) {\n\t\t\t\t\t\t\t\tsetMinValue( 0 );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tonDrag={ () => {\n\t\t\t\t\t\t\tif ( value?.charAt( 0 ) === '-' ) {\n\t\t\t\t\t\t\t\tsetMinValue( 0 );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tonDragEnd={ () => {\n\t\t\t\t\t\t\tsetMinValue( minimumCustomValue );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t\t<RangeControl\n\t\t\t\t\t\tonMouseOver={ onMouseOver }\n\t\t\t\t\t\tonMouseOut={ onMouseOut }\n\t\t\t\t\t\tonFocus={ onMouseOver }\n\t\t\t\t\t\tonBlur={ onMouseOut }\n\t\t\t\t\t\tvalue={ customRangeValue }\n\t\t\t\t\t\tmin={ 0 }\n\t\t\t\t\t\tmax={ CUSTOM_VALUE_SETTINGS[ selectedUnit ]?.max ?? 10 }\n\t\t\t\t\t\tstep={\n\t\t\t\t\t\t\tCUSTOM_VALUE_SETTINGS[ selectedUnit ]?.steps ?? 0.1\n\t\t\t\t\t\t}\n\t\t\t\t\t\twithInputField={ false }\n\t\t\t\t\t\tonChange={ handleCustomValueSliderChange }\n\t\t\t\t\t\tclassName=\"spacing-sizes-control__custom-value-range\"\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t) }\n\t\t\t{ showRangeControl && ! showCustomValueControl && (\n\t\t\t\t<RangeControl\n\t\t\t\t\tonMouseOver={ onMouseOver }\n\t\t\t\t\tonMouseOut={ onMouseOut }\n\t\t\t\t\tclassName=\"spacing-sizes-control__range-control\"\n\t\t\t\t\tvalue={ currentValue }\n\t\t\t\t\tonChange={ ( newSize ) =>\n\t\t\t\t\t\tonChange( getNewPresetValue( newSize ) )\n\t\t\t\t\t}\n\t\t\t\t\tonMouseDown={ ( event ) => {\n\t\t\t\t\t\t// If mouse down is near start of range set initial value to 0, which\n\t\t\t\t\t\t// prevents the user have to drag right then left to get 0 setting.\n\t\t\t\t\t\tif ( event?.nativeEvent?.offsetX < 35 ) {\n\t\t\t\t\t\t\tsetInitialValue();\n\t\t\t\t\t\t}\n\t\t\t\t\t} }\n\t\t\t\t\twithInputField={ false }\n\t\t\t\t\taria-valuenow={ currentValue }\n\t\t\t\t\taria-valuetext={ spacingSizes[ currentValue ]?.name }\n\t\t\t\t\trenderTooltipContent={ customTooltipContent }\n\t\t\t\t\tmin={ 0 }\n\t\t\t\t\tmax={ spacingSizes.length - 1 }\n\t\t\t\t\tmarks={ marks }\n\t\t\t\t\tlabel={ ariaLabel }\n\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tonFocus={ onMouseOver }\n\t\t\t\t\tonBlur={ onMouseOut }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ ! showRangeControl && ! showCustomValueControl && (\n\t\t\t\t<CustomSelectControl\n\t\t\t\t\tclassName=\"spacing-sizes-control__custom-select-control\"\n\t\t\t\t\tvalue={\n\t\t\t\t\t\toptions.find(\n\t\t\t\t\t\t\t( option ) => option.key === currentValue\n\t\t\t\t\t\t) || '' // passing undefined here causes a downshift controlled/uncontrolled warning\n\t\t\t\t\t}\n\t\t\t\t\tonChange={ ( selection ) => {\n\t\t\t\t\t\tonChange(\n\t\t\t\t\t\t\tgetNewPresetValue(\n\t\t\t\t\t\t\t\tselection.selectedItem.key,\n\t\t\t\t\t\t\t\t'selectList'\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\toptions={ options }\n\t\t\t\t\tlabel={ ariaLabel }\n\t\t\t\t\thideLabelFromVision\n\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\tonMouseOver={ onMouseOver }\n\t\t\t\t\tonMouseOut={ onMouseOut }\n\t\t\t\t\tonFocus={ onMouseOver }\n\t\t\t\t\tonBlur={ onMouseOut }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ ! disableCustomSpacingSizes && (\n\t\t\t\t<Button\n\t\t\t\t\tlabel={\n\t\t\t\t\t\tshowCustomValueControl\n\t\t\t\t\t\t\t? __( 'Use size preset' )\n\t\t\t\t\t\t\t: __( 'Set custom size' )\n\t\t\t\t\t}\n\t\t\t\t\ticon={ settings }\n\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\tsetShowCustomValueControl( ! showCustomValueControl );\n\t\t\t\t\t} }\n\t\t\t\t\tisPressed={ showCustomValueControl }\n\t\t\t\t\tsize=\"small\"\n\t\t\t\t\tclassName=\"spacing-sizes-control__custom-toggle\"\n\t\t\t\t\ticonSize={ 24 }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</HStack>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SACCA,MAAM,EACNC,IAAI,EACJC,YAAY,EACZC,oBAAoB,IAAIC,MAAM,EAC9BC,yBAAyB,IAAIC,WAAW,EACxCC,4BAA4B,IAAIC,cAAc,EAC9CC,8CAA8C,IAAIC,gCAAgC,EAClFC,WAAW,IAAIC,qBAAqB,QAC9B,uBAAuB;AAC9B,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,QAAQ,EAAEC,OAAO,QAAQ,oBAAoB;AACtD,SAASC,WAAW,QAAQ,oBAAoB;AAChD,SAASC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASC,QAAQ,QAAQ,kBAAkB;;AAE3C;AACA;AACA;AACA,SAASC,WAAW,QAAQ,oBA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AE,iBAAkB,CAAC,GACvBA,EAAE,CAAE,iBAAkB,CACzB;MACDqD,IAAI,EAAGnD,QAAU;MACjB2I,OAAO,EAAGA,CAAA,KAAM;QACfnE,yBAAyB,CAAE,CAAED,sBAAuB,CAAC;MACtD,CAAG;MACHqE,SAAS,EAAGrE,sBAAwB;MACpCY,IAAI,EAAC,OAAO;MACZgC,SAAS,EAAC,sCAAsC;MAChD0B,QAAQ,EAAG;IAAI,CACf,CACD;EAAA,CACM,CAAC;AAEX","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["Button","Icon","RangeControl","__experimentalHStack","HStack","__experimentalUnitControl","UnitControl","__experimentalUseCustomUnits","useCustomUnits","__experimentalParseQuantityAndUnitFromRawValue","parseQuantityAndUnitFromRawValue","privateApis","componentsPrivateApis","useSelect","useState","useMemo","usePrevious","__","sprintf","settings","useSettings","store","blockEditorStore","RANGE_CONTROL_MAX_SIZE","ALL_SIDES","LABELS","getSliderValueFromPreset","getCustomValueFromPreset","getPresetValueFromCustomValue","isValueSpacingPreset","unlock","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","CustomSelectControlV2Legacy","CustomSelectControl","CUSTOM_VALUE_SETTINGS","px","max","steps","vw","vh","em","rm","svw","lvw","dvw","svh","lvh","dvh","vi","svi","lvi","dvi","vb","svb","lvb","dvb","vmin","svmin","lvmin","dvmin","vmax","svmax","lvmax","dvmax","SpacingInputControl","icon","isMixed","minimumCustomValue","onChange","onMouseOut","onMouseOver","showSideInLabel","side","spacingSizes","type","value","_CUSTOM_VALUE_SETTING","_CUSTOM_VALUE_SETTING2","selectListSizes","showRangeControl","length","disableCustomSpacingSizes","select","editorSettings","getSettings","showCustomValueControl","setShowCustomValueControl","undefined","minValue","setMinValue","previousValue","availableUnits","units","currentValue","showCustomValueInSelectList","name","slug","size","selectedUnit","setInitialValue","customTooltipContent","newValue","customRangeValue","parseFloat","getNewCustomValue","newSize","isNumeric","isNaN","nextValue","getNewPresetValue","controlType","parseInt","handleCustomValueSliderChange","next","join","allPlaceholder","options","map","index","key","marks","_newValue","label","sideLabel","includes","typeLabel","toLowerCase","ariaLabel","trim","className","children","onFocus","onBlur","min","placeholder","disableUnits","hideLabelFromVision","onDragStart","charAt","onDrag","onDragEnd","step","withInputField","__nextHasNoMarginBottom","onMouseDown","event","nativeEvent","offsetX","renderTooltipContent","find","option","selection","selectedItem","onClick","isPressed","iconSize"],"sources":["@wordpress/block-editor/src/components/spacing-sizes-control/input-controls/spacing-input-control.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\tIcon,\n\tRangeControl,\n\t__experimentalHStack as HStack,\n\t__experimentalUnitControl as UnitControl,\n\t__experimentalUseCustomUnits as useCustomUnits,\n\t__experimentalParseQuantityAndUnitFromRawValue as parseQuantityAndUnitFromRawValue,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { useState, useMemo } from '@wordpress/element';\nimport { usePrevious } from '@wordpress/compose';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { settings } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { useSettings } from '../../use-settings';\nimport { store as blockEditorStore } from '../../../store';\nimport {\n\tRANGE_CONTROL_MAX_SIZE,\n\tALL_SIDES,\n\tLABELS,\n\tgetSliderValueFromPreset,\n\tgetCustomValueFromPreset,\n\tgetPresetValueFromCustomValue,\n\tisValueSpacingPreset,\n} from '../utils';\nimport { unlock } from '../../../lock-unlock';\n\nconst { CustomSelectControlV2Legacy: CustomSelectControl } = unlock(\n\tcomponentsPrivateApis\n);\n\nconst CUSTOM_VALUE_SETTINGS = {\n\tpx: { max: 300, steps: 1 },\n\t'%': { max: 100, steps: 1 },\n\tvw: { max: 100, steps: 1 },\n\tvh: { max: 100, steps: 1 },\n\tem: { max: 10, steps: 0.1 },\n\trm: { max: 10, steps: 0.1 },\n\tsvw: { max: 100, steps: 1 },\n\tlvw: { max: 100, steps: 1 },\n\tdvw: { max: 100, steps: 1 },\n\tsvh: { max: 100, steps: 1 },\n\tlvh: { max: 100, steps: 1 },\n\tdvh: { max: 100, steps: 1 },\n\tvi: { max: 100, steps: 1 },\n\tsvi: { max: 100, steps: 1 },\n\tlvi: { max: 100, steps: 1 },\n\tdvi: { max: 100, steps: 1 },\n\tvb: { max: 100, steps: 1 },\n\tsvb: { max: 100, steps: 1 },\n\tlvb: { max: 100, steps: 1 },\n\tdvb: { max: 100, steps: 1 },\n\tvmin: { max: 100, steps: 1 },\n\tsvmin: { max: 100, steps: 1 },\n\tlvmin: { max: 100, steps: 1 },\n\tdvmin: { max: 100, steps: 1 },\n\tvmax: { max: 100, steps: 1 },\n\tsvmax: { max: 100, steps: 1 },\n\tlvmax: { max: 100, steps: 1 },\n\tdvmax: { max: 100, steps: 1 },\n};\n\nexport default function SpacingInputControl( {\n\ticon,\n\tisMixed = false,\n\tminimumCustomValue,\n\tonChange,\n\tonMouseOut,\n\tonMouseOver,\n\tshowSideInLabel = true,\n\tside,\n\tspacingSizes,\n\ttype,\n\tvalue,\n} ) {\n\t// Treat value as a preset value if the passed in value matches the value of one of the spacingSizes.\n\tvalue = getPresetValueFromCustomValue( value, spacingSizes );\n\n\tlet selectListSizes = spacingSizes;\n\tconst showRangeControl = spacingSizes.length <= RANGE_CONTROL_MAX_SIZE;\n\n\tconst disableCustomSpacingSizes = useSelect( ( select ) => {\n\t\tconst editorSettings = select( blockEditorStore ).getSettings();\n\t\treturn editorSettings?.disableCustomSpacingSizes;\n\t} );\n\n\tconst [ showCustomValueControl, setShowCustomValueControl ] = useState(\n\t\t! disableCustomSpacingSizes &&\n\t\t\tvalue !== undefined &&\n\t\t\t! isValueSpacingPreset( value )\n\t);\n\n\tconst [ minValue, setMinValue ] = useState( minimumCustomValue );\n\n\tconst previousValue = usePrevious( value );\n\tif (\n\t\t!! value &&\n\t\tpreviousValue !== value &&\n\t\t! isValueSpacingPreset( value ) &&\n\t\tshowCustomValueControl !== true\n\t) {\n\t\tsetShowCustomValueControl( true );\n\t}\n\n\tconst [ availableUnits ] = useSettings( 'spacing.units' );\n\tconst units = useCustomUnits( {\n\t\tavailableUnits: availableUnits || [ 'px', 'em', 'rem' ],\n\t} );\n\n\tlet currentValue = null;\n\n\tconst showCustomValueInSelectList =\n\t\t! showRangeControl &&\n\t\t! showCustomValueControl &&\n\t\tvalue !== undefined &&\n\t\t( ! isValueSpacingPreset( value ) ||\n\t\t\t( isValueSpacingPreset( value ) && isMixed ) );\n\n\tif ( showCustomValueInSelectList ) {\n\t\tselectListSizes = [\n\t\t\t...spacingSizes,\n\t\t\t{\n\t\t\t\tname: ! isMixed\n\t\t\t\t\t? // translators: A custom measurement, eg. a number followed by a unit like 12px.\n\t\t\t\t\t sprintf( __( 'Custom (%s)' ), value )\n\t\t\t\t\t: __( 'Mixed' ),\n\t\t\t\tslug: 'custom',\n\t\t\t\tsize: value,\n\t\t\t},\n\t\t];\n\t\tcurrentValue = selectListSizes.length - 1;\n\t} else if ( ! isMixed ) {\n\t\tcurrentValue = ! showCustomValueControl\n\t\t\t? getSliderValueFromPreset( value, spacingSizes )\n\t\t\t: getCustomValueFromPreset( value, spacingSizes );\n\t}\n\n\tconst selectedUnit =\n\t\tuseMemo(\n\t\t\t() => parseQuantityAndUnitFromRawValue( currentValue ),\n\t\t\t[ currentValue ]\n\t\t)[ 1 ] || units[ 0 ]?.value;\n\n\tconst setInitialValue = () => {\n\t\tif ( value === undefined ) {\n\t\t\tonChange( '0' );\n\t\t}\n\t};\n\n\tconst customTooltipContent = ( newValue ) =>\n\t\tvalue === undefined ? undefined : spacingSizes[ newValue ]?.name;\n\n\tconst customRangeValue = parseFloat( currentValue, 10 );\n\n\tconst getNewCustomValue = ( newSize ) => {\n\t\tconst isNumeric = ! isNaN( parseFloat( newSize ) );\n\t\tconst nextValue = isNumeric ? newSize : undefined;\n\t\treturn nextValue;\n\t};\n\n\tconst getNewPresetValue = ( newSize, controlType ) => {\n\t\tconst size = parseInt( newSize, 10 );\n\n\t\tif ( controlType === 'selectList' ) {\n\t\t\tif ( size === 0 ) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\tif ( size === 1 ) {\n\t\t\t\treturn '0';\n\t\t\t}\n\t\t} else if ( size === 0 ) {\n\t\t\treturn '0';\n\t\t}\n\t\treturn `var:preset|spacing|${ spacingSizes[ newSize ]?.slug }`;\n\t};\n\n\tconst handleCustomValueSliderChange = ( next ) => {\n\t\tonChange( [ next, selectedUnit ].join( '' ) );\n\t};\n\n\tconst allPlaceholder = isMixed ? __( 'Mixed' ) : null;\n\n\tconst options = selectListSizes.map( ( size, index ) => ( {\n\t\tkey: index,\n\t\tname: size.name,\n\t} ) );\n\n\tconst marks = spacingSizes.map( ( _newValue, index ) => ( {\n\t\tvalue: index,\n\t\tlabel: undefined,\n\t} ) );\n\n\tconst sideLabel =\n\t\tALL_SIDES.includes( side ) && showSideInLabel ? LABELS[ side ] : '';\n\tconst typeLabel = showSideInLabel ? type?.toLowerCase() : type;\n\n\tconst ariaLabel = sprintf(\n\t\t// translators: 1: The side of the block being modified (top, bottom, left, All sides etc.). 2. Type of spacing being modified (Padding, margin, etc)\n\t\t__( '%1$s %2$s' ),\n\t\tsideLabel,\n\t\ttypeLabel\n\t).trim();\n\n\treturn (\n\t\t<HStack className=\"spacing-sizes-control__wrapper\">\n\t\t\t{ icon && (\n\t\t\t\t<Icon\n\t\t\t\t\tclassName=\"spacing-sizes-control__icon\"\n\t\t\t\t\ticon={ icon }\n\t\t\t\t\tsize={ 24 }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ showCustomValueControl && (\n\t\t\t\t<>\n\t\t\t\t\t<UnitControl\n\t\t\t\t\t\tonMouseOver={ onMouseOver }\n\t\t\t\t\t\tonMouseOut={ onMouseOut }\n\t\t\t\t\t\tonFocus={ onMouseOver }\n\t\t\t\t\t\tonBlur={ onMouseOut }\n\t\t\t\t\t\tonChange={ ( newSize ) =>\n\t\t\t\t\t\t\tonChange( getNewCustomValue( newSize ) )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tvalue={ currentValue }\n\t\t\t\t\t\tunits={ units }\n\t\t\t\t\t\tmin={ minValue }\n\t\t\t\t\t\tplaceholder={ allPlaceholder }\n\t\t\t\t\t\tdisableUnits={ isMixed }\n\t\t\t\t\t\tlabel={ ariaLabel }\n\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\tclassName=\"spacing-sizes-control__custom-value-input\"\n\t\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\t\tonDragStart={ () => {\n\t\t\t\t\t\t\tif ( value?.charAt( 0 ) === '-' ) {\n\t\t\t\t\t\t\t\tsetMinValue( 0 );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tonDrag={ () => {\n\t\t\t\t\t\t\tif ( value?.charAt( 0 ) === '-' ) {\n\t\t\t\t\t\t\t\tsetMinValue( 0 );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tonDragEnd={ () => {\n\t\t\t\t\t\t\tsetMinValue( minimumCustomValue );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t\t<RangeControl\n\t\t\t\t\t\tonMouseOver={ onMouseOver }\n\t\t\t\t\t\tonMouseOut={ onMouseOut }\n\t\t\t\t\t\tonFocus={ onMouseOver }\n\t\t\t\t\t\tonBlur={ onMouseOut }\n\t\t\t\t\t\tvalue={ customRangeValue }\n\t\t\t\t\t\tmin={ 0 }\n\t\t\t\t\t\tmax={ CUSTOM_VALUE_SETTINGS[ selectedUnit ]?.max ?? 10 }\n\t\t\t\t\t\tstep={\n\t\t\t\t\t\t\tCUSTOM_VALUE_SETTINGS[ selectedUnit ]?.steps ?? 0.1\n\t\t\t\t\t\t}\n\t\t\t\t\t\twithInputField={ false }\n\t\t\t\t\t\tonChange={ handleCustomValueSliderChange }\n\t\t\t\t\t\tclassName=\"spacing-sizes-control__custom-value-range\"\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t) }\n\t\t\t{ showRangeControl && ! showCustomValueControl && (\n\t\t\t\t<RangeControl\n\t\t\t\t\tonMouseOver={ onMouseOver }\n\t\t\t\t\tonMouseOut={ onMouseOut }\n\t\t\t\t\tclassName=\"spacing-sizes-control__range-control\"\n\t\t\t\t\tvalue={ currentValue }\n\t\t\t\t\tonChange={ ( newSize ) =>\n\t\t\t\t\t\tonChange( getNewPresetValue( newSize ) )\n\t\t\t\t\t}\n\t\t\t\t\tonMouseDown={ ( event ) => {\n\t\t\t\t\t\t// If mouse down is near start of range set initial value to 0, which\n\t\t\t\t\t\t// prevents the user have to drag right then left to get 0 setting.\n\t\t\t\t\t\tif ( event?.nativeEvent?.offsetX < 35 ) {\n\t\t\t\t\t\t\tsetInitialValue();\n\t\t\t\t\t\t}\n\t\t\t\t\t} }\n\t\t\t\t\twithInputField={ false }\n\t\t\t\t\taria-valuenow={ currentValue }\n\t\t\t\t\taria-valuetext={ spacingSizes[ currentValue ]?.name }\n\t\t\t\t\trenderTooltipContent={ customTooltipContent }\n\t\t\t\t\tmin={ 0 }\n\t\t\t\t\tmax={ spacingSizes.length - 1 }\n\t\t\t\t\tmarks={ marks }\n\t\t\t\t\tlabel={ ariaLabel }\n\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tonFocus={ onMouseOver }\n\t\t\t\t\tonBlur={ onMouseOut }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ ! showRangeControl && ! showCustomValueControl && (\n\t\t\t\t<CustomSelectControl\n\t\t\t\t\tclassName=\"spacing-sizes-control__custom-select-control\"\n\t\t\t\t\tvalue={\n\t\t\t\t\t\t// passing empty string as a fallback to continue using the\n\t\t\t\t\t\t// component in controlled mode\n\t\t\t\t\t\toptions.find(\n\t\t\t\t\t\t\t( option ) => option.key === currentValue\n\t\t\t\t\t\t) || ''\n\t\t\t\t\t}\n\t\t\t\t\tonChange={ ( selection ) => {\n\t\t\t\t\t\tonChange(\n\t\t\t\t\t\t\tgetNewPresetValue(\n\t\t\t\t\t\t\t\tselection.selectedItem.key,\n\t\t\t\t\t\t\t\t'selectList'\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\toptions={ options }\n\t\t\t\t\tlabel={ ariaLabel }\n\t\t\t\t\thideLabelFromVision\n\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\tonMouseOver={ onMouseOver }\n\t\t\t\t\tonMouseOut={ onMouseOut }\n\t\t\t\t\tonFocus={ onMouseOver }\n\t\t\t\t\tonBlur={ onMouseOut }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ ! disableCustomSpacingSizes && (\n\t\t\t\t<Button\n\t\t\t\t\tlabel={\n\t\t\t\t\t\tshowCustomValueControl\n\t\t\t\t\t\t\t? __( 'Use size preset' )\n\t\t\t\t\t\t\t: __( 'Set custom size' )\n\t\t\t\t\t}\n\t\t\t\t\ticon={ settings }\n\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\tsetShowCustomValueControl( ! showCustomValueControl );\n\t\t\t\t\t} }\n\t\t\t\t\tisPressed={ showCustomValueControl }\n\t\t\t\t\tsize=\"small\"\n\t\t\t\t\tclassName=\"spacing-sizes-control__custom-toggle\"\n\t\t\t\t\ticonSize={ 24 }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</HStack>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SACCA,MAAM,EACNC,IAAI,EACJC,YAAY,EACZC,oBAAoB,IAAIC,MAAM,EAC9BC,yBAAyB,IAAIC,WAAW,EACxCC,4BAA4B,IAAIC,cAAc,EAC9CC,8CAA8C,IAAIC,gCAAgC,EAClFC,WAAW,IAAIC,qBAAqB,QAC9B,uBAAuB;AAC9B,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,QAAQ,EAAEC,OAAO,QAAQ,oBAAoB;AACtD,SAASC,WAAW,QAAQ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;MACvB8D,MAAM,EAAG/D;IAAY,CACrB,CACD,EACC,CAAEY,yBAAyB,iBAC5BtD,IAAA,CAAChC,MAAM;MACN+H,KAAK,EACJrC,sBAAsB,GACnBzE,EAAE,CAAE,iBAAkB,CAAC,GACvBA,EAAE,CAAE,iBAAkB,CACzB;MACDqD,IAAI,EAAGnD,QAAU;MACjB2I,OAAO,EAAGA,CAAA,KAAM;QACfnE,yBAAyB,CAAE,CAAED,sBAAuB,CAAC;MACtD,CAAG;MACHqE,SAAS,EAAGrE,sBAAwB;MACpCY,IAAI,EAAC,OAAO;MACZgC,SAAS,EAAC,sCAAsC;MAChD0B,QAAQ,EAAG;IAAI,CACf,CACD;EAAA,CACM,CAAC;AAEX","ignoreList":[]}
|
|
@@ -215,7 +215,7 @@ const ImageURLInputUI = ({
|
|
|
215
215
|
icon: linkOff,
|
|
216
216
|
label: __('Disable expand on click'),
|
|
217
217
|
onClick: () => {
|
|
218
|
-
onSetLightbox(false);
|
|
218
|
+
onSetLightbox?.(false);
|
|
219
219
|
},
|
|
220
220
|
size: "compact"
|
|
221
221
|
})]
|
|
@@ -240,7 +240,7 @@ const ImageURLInputUI = ({
|
|
|
240
240
|
label: __('Remove link'),
|
|
241
241
|
onClick: () => {
|
|
242
242
|
onLinkRemove();
|
|
243
|
-
resetLightbox();
|
|
243
|
+
resetLightbox?.();
|
|
244
244
|
},
|
|
245
245
|
size: "compact"
|
|
246
246
|
})]
|
|
@@ -283,7 +283,7 @@ const ImageURLInputUI = ({
|
|
|
283
283
|
linkDestination: LINK_DESTINATION_NONE,
|
|
284
284
|
href: ''
|
|
285
285
|
});
|
|
286
|
-
onSetLightbox(true);
|
|
286
|
+
onSetLightbox?.(true);
|
|
287
287
|
stopEditLink();
|
|
288
288
|
},
|
|
289
289
|
children: __('Expand on click')
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__","useRef","useEffect","useState","focus","ToolbarButton","NavigableMenu","Button","MenuItem","ToggleControl","TextControl","__experimentalVStack","VStack","Icon","link","linkIcon","image","page","fullscreen","linkOff","URLPopover","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","LINK_DESTINATION_NONE","LINK_DESTINATION_CUSTOM","LINK_DESTINATION_MEDIA","LINK_DESTINATION_ATTACHMENT","NEW_TAB_REL","ImageURLInputUI","linkDestination","onChangeUrl","url","mediaType","mediaUrl","mediaLink","linkTarget","linkClass","rel","showLightboxSetting","lightboxEnabled","onSetLightbox","resetLightbox","isOpen","setIsOpen","popoverAnchor","setPopoverAnchor","openLinkUI","isEditingLink","setIsEditingLink","urlInput","setUrlInput","autocompleteRef","wrapperRef","current","nextFocusTarget","focusable","find","startEditLink","stopEditLink","closeLinkUI","getUpdatedLinkTargetSettings","value","newLinkTarget","undefined","updatedRel","rels","split","forEach","relVal","includes","push","join","filter","length","onFocusOutside","event","autocompleteElement","contains","target","onSubmitLinkChange","selectedDestination","getLinkDestinations","destination","href","lightbox","enabled","preventDefault","onLinkRemove","linkDestinations","title","icon","onSetHref","linkDestinationInput","onSetNewTab","updatedLinkTarget","onSetLinkRel","onSetLinkClass","advancedOptions","spacing","children","__nextHasNoMarginBottom","label","onChange","checked","linkEditorValue","hideLightboxPanel","showLinkEditor","urlLabel","PopoverChildren","className","onClick","size","LinkEditor","onChangeInputValue","onSubmit","LinkViewer","onEditLinkClick","ref","isActive","anchor","onClose","renderSettings","additionalControls","map","iconPosition","info","offset","__experimentalImageURLInputUI"],"sources":["@wordpress/block-editor/src/components/url-popover/image-url-input-ui.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useRef, useEffect, useState } from '@wordpress/element';\nimport { focus } from '@wordpress/dom';\nimport {\n\tToolbarButton,\n\tNavigableMenu,\n\tButton,\n\tMenuItem,\n\tToggleControl,\n\tTextControl,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport {\n\tIcon,\n\tlink as linkIcon,\n\timage,\n\tpage,\n\tfullscreen,\n\tlinkOff,\n} from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport URLPopover from './index';\n\nconst LINK_DESTINATION_NONE = 'none';\nconst LINK_DESTINATION_CUSTOM = 'custom';\nconst LINK_DESTINATION_MEDIA = 'media';\nconst LINK_DESTINATION_ATTACHMENT = 'attachment';\nconst NEW_TAB_REL = [ 'noreferrer', 'noopener' ];\n\nconst ImageURLInputUI = ( {\n\tlinkDestination,\n\tonChangeUrl,\n\turl,\n\tmediaType = 'image',\n\tmediaUrl,\n\tmediaLink,\n\tlinkTarget,\n\tlinkClass,\n\trel,\n\tshowLightboxSetting,\n\tlightboxEnabled,\n\tonSetLightbox,\n\tresetLightbox,\n} ) => {\n\tconst [ isOpen, setIsOpen ] = useState( false );\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the popover's anchor updates.\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\tconst openLinkUI = () => {\n\t\tsetIsOpen( true );\n\t};\n\n\tconst [ isEditingLink, setIsEditingLink ] = useState( false );\n\tconst [ urlInput, setUrlInput ] = useState( null );\n\n\tconst autocompleteRef = useRef( null );\n\tconst wrapperRef = useRef();\n\n\tuseEffect( () => {\n\t\tif ( ! wrapperRef.current ) {\n\t\t\treturn;\n\t\t}\n\t\tconst nextFocusTarget =\n\t\t\tfocus.focusable.find( wrapperRef.current )[ 0 ] ||\n\t\t\twrapperRef.current;\n\t\tnextFocusTarget.focus();\n\t}, [ isEditingLink, url, lightboxEnabled ] );\n\n\tconst startEditLink = () => {\n\t\tif (\n\t\t\tlinkDestination === LINK_DESTINATION_MEDIA ||\n\t\t\tlinkDestination === LINK_DESTINATION_ATTACHMENT\n\t\t) {\n\t\t\tsetUrlInput( '' );\n\t\t}\n\t\tsetIsEditingLink( true );\n\t};\n\n\tconst stopEditLink = () => {\n\t\tsetIsEditingLink( false );\n\t};\n\n\tconst closeLinkUI = () => {\n\t\tsetUrlInput( null );\n\t\tstopEditLink();\n\t\tsetIsOpen( false );\n\t};\n\n\tconst getUpdatedLinkTargetSettings = ( value ) => {\n\t\tconst newLinkTarget = value ? '_blank' : undefined;\n\n\t\tlet updatedRel;\n\t\tif ( newLinkTarget ) {\n\t\t\tconst rels = ( rel ?? '' ).split( ' ' );\n\t\t\tNEW_TAB_REL.forEach( ( relVal ) => {\n\t\t\t\tif ( ! rels.includes( relVal ) ) {\n\t\t\t\t\trels.push( relVal );\n\t\t\t\t}\n\t\t\t} );\n\t\t\tupdatedRel = rels.join( ' ' );\n\t\t} else {\n\t\t\tconst rels = ( rel ?? '' )\n\t\t\t\t.split( ' ' )\n\t\t\t\t.filter(\n\t\t\t\t\t( relVal ) => NEW_TAB_REL.includes( relVal ) === false\n\t\t\t\t);\n\t\t\tupdatedRel = rels.length ? rels.join( ' ' ) : undefined;\n\t\t}\n\n\t\treturn {\n\t\t\tlinkTarget: newLinkTarget,\n\t\t\trel: updatedRel,\n\t\t};\n\t};\n\n\tconst onFocusOutside = () => {\n\t\treturn ( event ) => {\n\t\t\t// The autocomplete suggestions list renders in a separate popover (in a portal),\n\t\t\t// so onFocusOutside fails to detect that a click on a suggestion occurred in the\n\t\t\t// LinkContainer. Detect clicks on autocomplete suggestions using a ref here, and\n\t\t\t// return to avoid the popover being closed.\n\t\t\tconst autocompleteElement = autocompleteRef.current;\n\t\t\tif (\n\t\t\t\tautocompleteElement &&\n\t\t\t\tautocompleteElement.contains( event.target )\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tsetIsOpen( false );\n\t\t\tsetUrlInput( null );\n\t\t\tstopEditLink();\n\t\t};\n\t};\n\n\tconst onSubmitLinkChange = () => {\n\t\treturn ( event ) => {\n\t\t\tif ( urlInput ) {\n\t\t\t\t// It is possible the entered URL actually matches a named link destination.\n\t\t\t\t// This check will ensure our link destination is correct.\n\t\t\t\tconst selectedDestination =\n\t\t\t\t\tgetLinkDestinations().find(\n\t\t\t\t\t\t( destination ) => destination.url === urlInput\n\t\t\t\t\t)?.linkDestination || LINK_DESTINATION_CUSTOM;\n\n\t\t\t\tonChangeUrl( {\n\t\t\t\t\thref: urlInput,\n\t\t\t\t\tlinkDestination: selectedDestination,\n\t\t\t\t\tlightbox: { enabled: false },\n\t\t\t\t} );\n\t\t\t}\n\t\t\tstopEditLink();\n\t\t\tsetUrlInput( null );\n\t\t\tevent.preventDefault();\n\t\t};\n\t};\n\n\tconst onLinkRemove = () => {\n\t\tonChangeUrl( {\n\t\t\tlinkDestination: LINK_DESTINATION_NONE,\n\t\t\thref: '',\n\t\t} );\n\t};\n\n\tconst getLinkDestinations = () => {\n\t\tconst linkDestinations = [\n\t\t\t{\n\t\t\t\tlinkDestination: LINK_DESTINATION_MEDIA,\n\t\t\t\ttitle: __( 'Link to image file' ),\n\t\t\t\turl: mediaType === 'image' ? mediaUrl : undefined,\n\t\t\t\ticon: image,\n\t\t\t},\n\t\t];\n\t\tif ( mediaType === 'image' && mediaLink ) {\n\t\t\tlinkDestinations.push( {\n\t\t\t\tlinkDestination: LINK_DESTINATION_ATTACHMENT,\n\t\t\t\ttitle: __( 'Link to attachment page' ),\n\t\t\t\turl: mediaType === 'image' ? mediaLink : undefined,\n\t\t\t\ticon: page,\n\t\t\t} );\n\t\t}\n\t\treturn linkDestinations;\n\t};\n\n\tconst onSetHref = ( value ) => {\n\t\tconst linkDestinations = getLinkDestinations();\n\t\tlet linkDestinationInput;\n\t\tif ( ! value ) {\n\t\t\tlinkDestinationInput = LINK_DESTINATION_NONE;\n\t\t} else {\n\t\t\tlinkDestinationInput = (\n\t\t\t\tlinkDestinations.find( ( destination ) => {\n\t\t\t\t\treturn destination.url === value;\n\t\t\t\t} ) || { linkDestination: LINK_DESTINATION_CUSTOM }\n\t\t\t).linkDestination;\n\t\t}\n\t\tonChangeUrl( {\n\t\t\tlinkDestination: linkDestinationInput,\n\t\t\thref: value,\n\t\t} );\n\t};\n\n\tconst onSetNewTab = ( value ) => {\n\t\tconst updatedLinkTarget = getUpdatedLinkTargetSettings( value );\n\t\tonChangeUrl( updatedLinkTarget );\n\t};\n\n\tconst onSetLinkRel = ( value ) => {\n\t\tonChangeUrl( { rel: value } );\n\t};\n\n\tconst onSetLinkClass = ( value ) => {\n\t\tonChangeUrl( { linkClass: value } );\n\t};\n\n\tconst advancedOptions = (\n\t\t<VStack spacing=\"3\">\n\t\t\t<ToggleControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tlabel={ __( 'Open in new tab' ) }\n\t\t\t\tonChange={ onSetNewTab }\n\t\t\t\tchecked={ linkTarget === '_blank' }\n\t\t\t/>\n\t\t\t<TextControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tlabel={ __( 'Link rel' ) }\n\t\t\t\tvalue={ rel ?? '' }\n\t\t\t\tonChange={ onSetLinkRel }\n\t\t\t/>\n\t\t\t<TextControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tlabel={ __( 'Link CSS class' ) }\n\t\t\t\tvalue={ linkClass || '' }\n\t\t\t\tonChange={ onSetLinkClass }\n\t\t\t/>\n\t\t</VStack>\n\t);\n\n\tconst linkEditorValue = urlInput !== null ? urlInput : url;\n\tconst hideLightboxPanel =\n\t\t! lightboxEnabled || ( lightboxEnabled && ! showLightboxSetting );\n\tconst showLinkEditor = ! linkEditorValue && hideLightboxPanel;\n\n\tconst urlLabel = (\n\t\tgetLinkDestinations().find(\n\t\t\t( destination ) => destination.linkDestination === linkDestination\n\t\t) || {}\n\t).title;\n\n\tconst PopoverChildren = () => {\n\t\tif (\n\t\t\tlightboxEnabled &&\n\t\t\tshowLightboxSetting &&\n\t\t\t! url &&\n\t\t\t! isEditingLink\n\t\t) {\n\t\t\treturn (\n\t\t\t\t<div className=\"block-editor-url-popover__expand-on-click\">\n\t\t\t\t\t<Icon icon={ fullscreen } />\n\t\t\t\t\t<div className=\"text\">\n\t\t\t\t\t\t<p>{ __( 'Expand on click' ) }</p>\n\t\t\t\t\t\t<p className=\"description\">\n\t\t\t\t\t\t\t{ __( 'Scales the image with a lightbox effect' ) }\n\t\t\t\t\t\t</p>\n\t\t\t\t\t</div>\n\t\t\t\t\t<Button\n\t\t\t\t\t\ticon={ linkOff }\n\t\t\t\t\t\tlabel={ __( 'Disable expand on click' ) }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tonSetLightbox( false );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t);\n\t\t} else if ( ! url || isEditingLink ) {\n\t\t\treturn (\n\t\t\t\t<URLPopover.LinkEditor\n\t\t\t\t\tclassName=\"block-editor-format-toolbar__link-container-content\"\n\t\t\t\t\tvalue={ linkEditorValue }\n\t\t\t\t\tonChangeInputValue={ setUrlInput }\n\t\t\t\t\tonSubmit={ onSubmitLinkChange() }\n\t\t\t\t\tautocompleteRef={ autocompleteRef }\n\t\t\t\t/>\n\t\t\t);\n\t\t} else if ( url && ! isEditingLink ) {\n\t\t\treturn (\n\t\t\t\t<>\n\t\t\t\t\t<URLPopover.LinkViewer\n\t\t\t\t\t\tclassName=\"block-editor-format-toolbar__link-container-content\"\n\t\t\t\t\t\turl={ url }\n\t\t\t\t\t\tonEditLinkClick={ startEditLink }\n\t\t\t\t\t\turlLabel={ urlLabel }\n\t\t\t\t\t/>\n\t\t\t\t\t<Button\n\t\t\t\t\t\ticon={ linkOff }\n\t\t\t\t\t\tlabel={ __( 'Remove link' ) }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tonLinkRemove();\n\t\t\t\t\t\t\tresetLightbox();\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t);\n\t\t}\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<ToolbarButton\n\t\t\t\ticon={ linkIcon }\n\t\t\t\tclassName=\"components-toolbar__control\"\n\t\t\t\tlabel={ __( 'Link' ) }\n\t\t\t\taria-expanded={ isOpen }\n\t\t\t\tonClick={ openLinkUI }\n\t\t\t\tref={ setPopoverAnchor }\n\t\t\t\tisActive={\n\t\t\t\t\t!! url || ( lightboxEnabled && showLightboxSetting )\n\t\t\t\t}\n\t\t\t/>\n\t\t\t{ isOpen && (\n\t\t\t\t<URLPopover\n\t\t\t\t\tref={ wrapperRef }\n\t\t\t\t\tanchor={ popoverAnchor }\n\t\t\t\t\tonFocusOutside={ onFocusOutside() }\n\t\t\t\t\tonClose={ closeLinkUI }\n\t\t\t\t\trenderSettings={\n\t\t\t\t\t\thideLightboxPanel ? () => advancedOptions : null\n\t\t\t\t\t}\n\t\t\t\t\tadditionalControls={\n\t\t\t\t\t\tshowLinkEditor && (\n\t\t\t\t\t\t\t<NavigableMenu>\n\t\t\t\t\t\t\t\t{ getLinkDestinations().map( ( link ) => (\n\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\tkey={ link.linkDestination }\n\t\t\t\t\t\t\t\t\t\ticon={ link.icon }\n\t\t\t\t\t\t\t\t\t\ticonPosition=\"left\"\n\t\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\t\tsetUrlInput( null );\n\t\t\t\t\t\t\t\t\t\t\tonSetHref( link.url );\n\t\t\t\t\t\t\t\t\t\t\tstopEditLink();\n\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ link.title }\n\t\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t) ) }\n\t\t\t\t\t\t\t\t{ showLightboxSetting && (\n\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\tkey=\"expand-on-click\"\n\t\t\t\t\t\t\t\t\t\tclassName=\"block-editor-url-popover__expand-on-click\"\n\t\t\t\t\t\t\t\t\t\ticon={ fullscreen }\n\t\t\t\t\t\t\t\t\t\tinfo={ __(\n\t\t\t\t\t\t\t\t\t\t\t'Scale the image with a lightbox effect.'\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\ticonPosition=\"left\"\n\t\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\t\tsetUrlInput( null );\n\t\t\t\t\t\t\t\t\t\t\tonChangeUrl( {\n\t\t\t\t\t\t\t\t\t\t\t\tlinkDestination:\n\t\t\t\t\t\t\t\t\t\t\t\t\tLINK_DESTINATION_NONE,\n\t\t\t\t\t\t\t\t\t\t\t\thref: '',\n\t\t\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t\t\t\tonSetLightbox( true );\n\t\t\t\t\t\t\t\t\t\t\tstopEditLink();\n\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ __( 'Expand on click' ) }\n\t\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</NavigableMenu>\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t\toffset={ 13 }\n\t\t\t\t>\n\t\t\t\t\t{ PopoverChildren() }\n\t\t\t\t</URLPopover>\n\t\t\t) }\n\t\t</>\n\t);\n};\n\nexport { ImageURLInputUI as __experimentalImageURLInputUI };\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,MAAM,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,oBAAoB;AAChE,SAASC,KAAK,QAAQ,gBAAgB;AACtC,SACCC,aAAa,EACbC,aAAa,EACbC,MAAM,EACNC,QAAQ,EACRC,aAAa,EACbC,WAAW,EACXC,oBAAoB,IAAIC,MAAM,QACxB,uBAAuB;AAC9B,SACCC,IAAI,EACJC,IAAI,IAAIC,QAAQ,EAChBC,KAAK,EACLC,IAAI,EACJC,UAAU,EACVC,OAAO,QACD,kBAAkB;;AAEzB;AACA;AACA;AACA,OAAOC,UAAU,MAAM,SAAS;AAAC,SAAAC,GA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+E;QAAK,GATN/E,IAAI,CAACmB,eAUF,CACT,CAAC,EACDS,mBAAmB,iBACpBpB,IAAA,CAACd,QAAQ;UAERyG,SAAS,EAAC,2CAA2C;UACrDnB,IAAI,EAAG5E,UAAY;UACnB+G,IAAI,EAAGjI,EAAE,CACR,yCACD,CAAG;UACHgI,YAAY,EAAC,MAAM;UACnBd,OAAO,EAAGA,CAAA,KAAM;YACf5D,WAAW,CAAE,IAAK,CAAC;YACnBpB,WAAW,CAAE;cACZD,eAAe,EACdN,qBAAqB;cACtB4D,IAAI,EAAE;YACP,CAAE,CAAC;YACH3C,aAAa,CAAE,IAAK,CAAC;YACrBkB,YAAY,CAAC,CAAC;UACf,CAAG;UAAAyC,QAAA,EAEDvG,EAAE,CAAE,iBAAkB;QAAC,GAlBrB,iBAmBK,CACV;MAAA,CACa,CAEhB;MACDkI,MAAM,EAAG,EAAI;MAAA3B,QAAA,EAEXS,eAAe,CAAC;IAAC,CACR,CACZ;EAAA,CACA,CAAC;AAEL,CAAC;AAED,SAAShF,eAAe,IAAImG,6BAA6B","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["__","useRef","useEffect","useState","focus","ToolbarButton","NavigableMenu","Button","MenuItem","ToggleControl","TextControl","__experimentalVStack","VStack","Icon","link","linkIcon","image","page","fullscreen","linkOff","URLPopover","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","LINK_DESTINATION_NONE","LINK_DESTINATION_CUSTOM","LINK_DESTINATION_MEDIA","LINK_DESTINATION_ATTACHMENT","NEW_TAB_REL","ImageURLInputUI","linkDestination","onChangeUrl","url","mediaType","mediaUrl","mediaLink","linkTarget","linkClass","rel","showLightboxSetting","lightboxEnabled","onSetLightbox","resetLightbox","isOpen","setIsOpen","popoverAnchor","setPopoverAnchor","openLinkUI","isEditingLink","setIsEditingLink","urlInput","setUrlInput","autocompleteRef","wrapperRef","current","nextFocusTarget","focusable","find","startEditLink","stopEditLink","closeLinkUI","getUpdatedLinkTargetSettings","value","newLinkTarget","undefined","updatedRel","rels","split","forEach","relVal","includes","push","join","filter","length","onFocusOutside","event","autocompleteElement","contains","target","onSubmitLinkChange","selectedDestination","getLinkDestinations","destination","href","lightbox","enabled","preventDefault","onLinkRemove","linkDestinations","title","icon","onSetHref","linkDestinationInput","onSetNewTab","updatedLinkTarget","onSetLinkRel","onSetLinkClass","advancedOptions","spacing","children","__nextHasNoMarginBottom","label","onChange","checked","linkEditorValue","hideLightboxPanel","showLinkEditor","urlLabel","PopoverChildren","className","onClick","size","LinkEditor","onChangeInputValue","onSubmit","LinkViewer","onEditLinkClick","ref","isActive","anchor","onClose","renderSettings","additionalControls","map","iconPosition","info","offset","__experimentalImageURLInputUI"],"sources":["@wordpress/block-editor/src/components/url-popover/image-url-input-ui.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useRef, useEffect, useState } from '@wordpress/element';\nimport { focus } from '@wordpress/dom';\nimport {\n\tToolbarButton,\n\tNavigableMenu,\n\tButton,\n\tMenuItem,\n\tToggleControl,\n\tTextControl,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport {\n\tIcon,\n\tlink as linkIcon,\n\timage,\n\tpage,\n\tfullscreen,\n\tlinkOff,\n} from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport URLPopover from './index';\n\nconst LINK_DESTINATION_NONE = 'none';\nconst LINK_DESTINATION_CUSTOM = 'custom';\nconst LINK_DESTINATION_MEDIA = 'media';\nconst LINK_DESTINATION_ATTACHMENT = 'attachment';\nconst NEW_TAB_REL = [ 'noreferrer', 'noopener' ];\n\nconst ImageURLInputUI = ( {\n\tlinkDestination,\n\tonChangeUrl,\n\turl,\n\tmediaType = 'image',\n\tmediaUrl,\n\tmediaLink,\n\tlinkTarget,\n\tlinkClass,\n\trel,\n\tshowLightboxSetting,\n\tlightboxEnabled,\n\tonSetLightbox,\n\tresetLightbox,\n} ) => {\n\tconst [ isOpen, setIsOpen ] = useState( false );\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the popover's anchor updates.\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\tconst openLinkUI = () => {\n\t\tsetIsOpen( true );\n\t};\n\n\tconst [ isEditingLink, setIsEditingLink ] = useState( false );\n\tconst [ urlInput, setUrlInput ] = useState( null );\n\n\tconst autocompleteRef = useRef( null );\n\tconst wrapperRef = useRef();\n\n\tuseEffect( () => {\n\t\tif ( ! wrapperRef.current ) {\n\t\t\treturn;\n\t\t}\n\t\tconst nextFocusTarget =\n\t\t\tfocus.focusable.find( wrapperRef.current )[ 0 ] ||\n\t\t\twrapperRef.current;\n\t\tnextFocusTarget.focus();\n\t}, [ isEditingLink, url, lightboxEnabled ] );\n\n\tconst startEditLink = () => {\n\t\tif (\n\t\t\tlinkDestination === LINK_DESTINATION_MEDIA ||\n\t\t\tlinkDestination === LINK_DESTINATION_ATTACHMENT\n\t\t) {\n\t\t\tsetUrlInput( '' );\n\t\t}\n\t\tsetIsEditingLink( true );\n\t};\n\n\tconst stopEditLink = () => {\n\t\tsetIsEditingLink( false );\n\t};\n\n\tconst closeLinkUI = () => {\n\t\tsetUrlInput( null );\n\t\tstopEditLink();\n\t\tsetIsOpen( false );\n\t};\n\n\tconst getUpdatedLinkTargetSettings = ( value ) => {\n\t\tconst newLinkTarget = value ? '_blank' : undefined;\n\n\t\tlet updatedRel;\n\t\tif ( newLinkTarget ) {\n\t\t\tconst rels = ( rel ?? '' ).split( ' ' );\n\t\t\tNEW_TAB_REL.forEach( ( relVal ) => {\n\t\t\t\tif ( ! rels.includes( relVal ) ) {\n\t\t\t\t\trels.push( relVal );\n\t\t\t\t}\n\t\t\t} );\n\t\t\tupdatedRel = rels.join( ' ' );\n\t\t} else {\n\t\t\tconst rels = ( rel ?? '' )\n\t\t\t\t.split( ' ' )\n\t\t\t\t.filter(\n\t\t\t\t\t( relVal ) => NEW_TAB_REL.includes( relVal ) === false\n\t\t\t\t);\n\t\t\tupdatedRel = rels.length ? rels.join( ' ' ) : undefined;\n\t\t}\n\n\t\treturn {\n\t\t\tlinkTarget: newLinkTarget,\n\t\t\trel: updatedRel,\n\t\t};\n\t};\n\n\tconst onFocusOutside = () => {\n\t\treturn ( event ) => {\n\t\t\t// The autocomplete suggestions list renders in a separate popover (in a portal),\n\t\t\t// so onFocusOutside fails to detect that a click on a suggestion occurred in the\n\t\t\t// LinkContainer. Detect clicks on autocomplete suggestions using a ref here, and\n\t\t\t// return to avoid the popover being closed.\n\t\t\tconst autocompleteElement = autocompleteRef.current;\n\t\t\tif (\n\t\t\t\tautocompleteElement &&\n\t\t\t\tautocompleteElement.contains( event.target )\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tsetIsOpen( false );\n\t\t\tsetUrlInput( null );\n\t\t\tstopEditLink();\n\t\t};\n\t};\n\n\tconst onSubmitLinkChange = () => {\n\t\treturn ( event ) => {\n\t\t\tif ( urlInput ) {\n\t\t\t\t// It is possible the entered URL actually matches a named link destination.\n\t\t\t\t// This check will ensure our link destination is correct.\n\t\t\t\tconst selectedDestination =\n\t\t\t\t\tgetLinkDestinations().find(\n\t\t\t\t\t\t( destination ) => destination.url === urlInput\n\t\t\t\t\t)?.linkDestination || LINK_DESTINATION_CUSTOM;\n\n\t\t\t\tonChangeUrl( {\n\t\t\t\t\thref: urlInput,\n\t\t\t\t\tlinkDestination: selectedDestination,\n\t\t\t\t\tlightbox: { enabled: false },\n\t\t\t\t} );\n\t\t\t}\n\t\t\tstopEditLink();\n\t\t\tsetUrlInput( null );\n\t\t\tevent.preventDefault();\n\t\t};\n\t};\n\n\tconst onLinkRemove = () => {\n\t\tonChangeUrl( {\n\t\t\tlinkDestination: LINK_DESTINATION_NONE,\n\t\t\thref: '',\n\t\t} );\n\t};\n\n\tconst getLinkDestinations = () => {\n\t\tconst linkDestinations = [\n\t\t\t{\n\t\t\t\tlinkDestination: LINK_DESTINATION_MEDIA,\n\t\t\t\ttitle: __( 'Link to image file' ),\n\t\t\t\turl: mediaType === 'image' ? mediaUrl : undefined,\n\t\t\t\ticon: image,\n\t\t\t},\n\t\t];\n\t\tif ( mediaType === 'image' && mediaLink ) {\n\t\t\tlinkDestinations.push( {\n\t\t\t\tlinkDestination: LINK_DESTINATION_ATTACHMENT,\n\t\t\t\ttitle: __( 'Link to attachment page' ),\n\t\t\t\turl: mediaType === 'image' ? mediaLink : undefined,\n\t\t\t\ticon: page,\n\t\t\t} );\n\t\t}\n\t\treturn linkDestinations;\n\t};\n\n\tconst onSetHref = ( value ) => {\n\t\tconst linkDestinations = getLinkDestinations();\n\t\tlet linkDestinationInput;\n\t\tif ( ! value ) {\n\t\t\tlinkDestinationInput = LINK_DESTINATION_NONE;\n\t\t} else {\n\t\t\tlinkDestinationInput = (\n\t\t\t\tlinkDestinations.find( ( destination ) => {\n\t\t\t\t\treturn destination.url === value;\n\t\t\t\t} ) || { linkDestination: LINK_DESTINATION_CUSTOM }\n\t\t\t).linkDestination;\n\t\t}\n\t\tonChangeUrl( {\n\t\t\tlinkDestination: linkDestinationInput,\n\t\t\thref: value,\n\t\t} );\n\t};\n\n\tconst onSetNewTab = ( value ) => {\n\t\tconst updatedLinkTarget = getUpdatedLinkTargetSettings( value );\n\t\tonChangeUrl( updatedLinkTarget );\n\t};\n\n\tconst onSetLinkRel = ( value ) => {\n\t\tonChangeUrl( { rel: value } );\n\t};\n\n\tconst onSetLinkClass = ( value ) => {\n\t\tonChangeUrl( { linkClass: value } );\n\t};\n\n\tconst advancedOptions = (\n\t\t<VStack spacing=\"3\">\n\t\t\t<ToggleControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tlabel={ __( 'Open in new tab' ) }\n\t\t\t\tonChange={ onSetNewTab }\n\t\t\t\tchecked={ linkTarget === '_blank' }\n\t\t\t/>\n\t\t\t<TextControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tlabel={ __( 'Link rel' ) }\n\t\t\t\tvalue={ rel ?? '' }\n\t\t\t\tonChange={ onSetLinkRel }\n\t\t\t/>\n\t\t\t<TextControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tlabel={ __( 'Link CSS class' ) }\n\t\t\t\tvalue={ linkClass || '' }\n\t\t\t\tonChange={ onSetLinkClass }\n\t\t\t/>\n\t\t</VStack>\n\t);\n\n\tconst linkEditorValue = urlInput !== null ? urlInput : url;\n\tconst hideLightboxPanel =\n\t\t! lightboxEnabled || ( lightboxEnabled && ! showLightboxSetting );\n\tconst showLinkEditor = ! linkEditorValue && hideLightboxPanel;\n\n\tconst urlLabel = (\n\t\tgetLinkDestinations().find(\n\t\t\t( destination ) => destination.linkDestination === linkDestination\n\t\t) || {}\n\t).title;\n\n\tconst PopoverChildren = () => {\n\t\tif (\n\t\t\tlightboxEnabled &&\n\t\t\tshowLightboxSetting &&\n\t\t\t! url &&\n\t\t\t! isEditingLink\n\t\t) {\n\t\t\treturn (\n\t\t\t\t<div className=\"block-editor-url-popover__expand-on-click\">\n\t\t\t\t\t<Icon icon={ fullscreen } />\n\t\t\t\t\t<div className=\"text\">\n\t\t\t\t\t\t<p>{ __( 'Expand on click' ) }</p>\n\t\t\t\t\t\t<p className=\"description\">\n\t\t\t\t\t\t\t{ __( 'Scales the image with a lightbox effect' ) }\n\t\t\t\t\t\t</p>\n\t\t\t\t\t</div>\n\t\t\t\t\t<Button\n\t\t\t\t\t\ticon={ linkOff }\n\t\t\t\t\t\tlabel={ __( 'Disable expand on click' ) }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tonSetLightbox?.( false );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t);\n\t\t} else if ( ! url || isEditingLink ) {\n\t\t\treturn (\n\t\t\t\t<URLPopover.LinkEditor\n\t\t\t\t\tclassName=\"block-editor-format-toolbar__link-container-content\"\n\t\t\t\t\tvalue={ linkEditorValue }\n\t\t\t\t\tonChangeInputValue={ setUrlInput }\n\t\t\t\t\tonSubmit={ onSubmitLinkChange() }\n\t\t\t\t\tautocompleteRef={ autocompleteRef }\n\t\t\t\t/>\n\t\t\t);\n\t\t} else if ( url && ! isEditingLink ) {\n\t\t\treturn (\n\t\t\t\t<>\n\t\t\t\t\t<URLPopover.LinkViewer\n\t\t\t\t\t\tclassName=\"block-editor-format-toolbar__link-container-content\"\n\t\t\t\t\t\turl={ url }\n\t\t\t\t\t\tonEditLinkClick={ startEditLink }\n\t\t\t\t\t\turlLabel={ urlLabel }\n\t\t\t\t\t/>\n\t\t\t\t\t<Button\n\t\t\t\t\t\ticon={ linkOff }\n\t\t\t\t\t\tlabel={ __( 'Remove link' ) }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tonLinkRemove();\n\t\t\t\t\t\t\tresetLightbox?.();\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t);\n\t\t}\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<ToolbarButton\n\t\t\t\ticon={ linkIcon }\n\t\t\t\tclassName=\"components-toolbar__control\"\n\t\t\t\tlabel={ __( 'Link' ) }\n\t\t\t\taria-expanded={ isOpen }\n\t\t\t\tonClick={ openLinkUI }\n\t\t\t\tref={ setPopoverAnchor }\n\t\t\t\tisActive={\n\t\t\t\t\t!! url || ( lightboxEnabled && showLightboxSetting )\n\t\t\t\t}\n\t\t\t/>\n\t\t\t{ isOpen && (\n\t\t\t\t<URLPopover\n\t\t\t\t\tref={ wrapperRef }\n\t\t\t\t\tanchor={ popoverAnchor }\n\t\t\t\t\tonFocusOutside={ onFocusOutside() }\n\t\t\t\t\tonClose={ closeLinkUI }\n\t\t\t\t\trenderSettings={\n\t\t\t\t\t\thideLightboxPanel ? () => advancedOptions : null\n\t\t\t\t\t}\n\t\t\t\t\tadditionalControls={\n\t\t\t\t\t\tshowLinkEditor && (\n\t\t\t\t\t\t\t<NavigableMenu>\n\t\t\t\t\t\t\t\t{ getLinkDestinations().map( ( link ) => (\n\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\tkey={ link.linkDestination }\n\t\t\t\t\t\t\t\t\t\ticon={ link.icon }\n\t\t\t\t\t\t\t\t\t\ticonPosition=\"left\"\n\t\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\t\tsetUrlInput( null );\n\t\t\t\t\t\t\t\t\t\t\tonSetHref( link.url );\n\t\t\t\t\t\t\t\t\t\t\tstopEditLink();\n\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ link.title }\n\t\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t) ) }\n\t\t\t\t\t\t\t\t{ showLightboxSetting && (\n\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\tkey=\"expand-on-click\"\n\t\t\t\t\t\t\t\t\t\tclassName=\"block-editor-url-popover__expand-on-click\"\n\t\t\t\t\t\t\t\t\t\ticon={ fullscreen }\n\t\t\t\t\t\t\t\t\t\tinfo={ __(\n\t\t\t\t\t\t\t\t\t\t\t'Scale the image with a lightbox effect.'\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\ticonPosition=\"left\"\n\t\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\t\tsetUrlInput( null );\n\t\t\t\t\t\t\t\t\t\t\tonChangeUrl( {\n\t\t\t\t\t\t\t\t\t\t\t\tlinkDestination:\n\t\t\t\t\t\t\t\t\t\t\t\t\tLINK_DESTINATION_NONE,\n\t\t\t\t\t\t\t\t\t\t\t\thref: '',\n\t\t\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t\t\t\tonSetLightbox?.( true );\n\t\t\t\t\t\t\t\t\t\t\tstopEditLink();\n\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ __( 'Expand on click' ) }\n\t\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</NavigableMenu>\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t\toffset={ 13 }\n\t\t\t\t>\n\t\t\t\t\t{ PopoverChildren() }\n\t\t\t\t</URLPopover>\n\t\t\t) }\n\t\t</>\n\t);\n};\n\nexport { ImageURLInputUI as __experimentalImageURLInputUI };\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,MAAM,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,oBAAoB;AAChE,SAASC,KAAK,QAAQ,gBAAgB;AACtC,SACCC,aAAa,EACbC,aAAa,EACbC,MAAM,EACNC,QAAQ,EACRC,aAAa,EACbC,WAAW,EACXC,oBAAoB,IAAIC,MAAM,QACxB,uBAAuB;AAC9B,SACCC,IAAI,EACJC,IAAI,IAAIC,QAAQ,EAChBC,KAAK,EACLC,IAAI,EACJC,UAAU,EACVC,OAAO,QACD,kBAAkB;;AAEzB;AACA;AACA;AACA,OAAOC,UAAU,MAAM,SAAS;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAAA,SAAAC,QAAA,IAAAC,SAAA;AAEjC,MAAMC,qBAAqB,GAAG,MAAM;AACpC,MAAMC,uBAAuB,GAAG,QAAQ;AACxC,MAAMC,sBAAsB,GAAG,OAAO;AACtC,MAAMC,2BAA2B,GAAG,YAAY;AAChD,MAAMC,WAAW,GAAG,CAAE,YAAY,EAAE,UAAU,CAAE;AAEhD,MAAMC,eAAe,GAAGA,CAAE;EACzBC,eAAe;EACfC,WAAW;EACXC,GAAG;EACHC,SAAS,GAAG,OAAO;EACnBC,QAAQ;EACRC,SAAS;EACTC,UAAU;EACVC,SAAS;EACTC,GAAG;EACHC,mBAAmB;EACnBC,eAAe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AAE,CAAE,iBAAkB;QAAC,GAlBrB,iBAmBK,CACV;MAAA,CACa,CAEhB;MACDkI,MAAM,EAAG,EAAI;MAAA3B,QAAA,EAEXS,eAAe,CAAC;IAAC,CACR,CACZ;EAAA,CACA,CAAC;AAEL,CAAC;AAED,SAAShF,eAAe,IAAImG,6BAA6B","ignoreList":[]}
|
|
@@ -33,15 +33,12 @@ function GridTools({
|
|
|
33
33
|
isDragging: isDraggingBlocks()
|
|
34
34
|
};
|
|
35
35
|
});
|
|
36
|
-
if (!isSelected && !isDragging) {
|
|
37
|
-
return null;
|
|
38
|
-
}
|
|
39
36
|
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
40
|
-
children: [/*#__PURE__*/_jsx(
|
|
37
|
+
children: [/*#__PURE__*/_jsx(GridLayoutSync, {
|
|
38
|
+
clientId: clientId
|
|
39
|
+
}), (isSelected || isDragging) && /*#__PURE__*/_jsx(GridVisualizer, {
|
|
41
40
|
clientId: clientId,
|
|
42
41
|
parentLayout: layout
|
|
43
|
-
}), /*#__PURE__*/_jsx(GridLayoutSync, {
|
|
44
|
-
clientId: clientId
|
|
45
42
|
})]
|
|
46
43
|
});
|
|
47
44
|
}
|
|
@@ -49,7 +46,7 @@ const addGridVisualizerToBlockEdit = createHigherOrderComponent(BlockEdit => pro
|
|
|
49
46
|
if (props.attributes.layout?.type !== 'grid') {
|
|
50
47
|
return /*#__PURE__*/_jsx(BlockEdit, {
|
|
51
48
|
...props
|
|
52
|
-
});
|
|
49
|
+
}, "edit");
|
|
53
50
|
}
|
|
54
51
|
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
55
52
|
children: [/*#__PURE__*/_jsx(GridTools, {
|
|
@@ -57,7 +54,7 @@ const addGridVisualizerToBlockEdit = createHigherOrderComponent(BlockEdit => pro
|
|
|
57
54
|
layout: props.attributes.layout
|
|
58
55
|
}), /*#__PURE__*/_jsx(BlockEdit, {
|
|
59
56
|
...props
|
|
60
|
-
})]
|
|
57
|
+
}, "edit")]
|
|
61
58
|
});
|
|
62
59
|
}, 'addGridVisualizerToBlockEdit');
|
|
63
60
|
addFilter('editor.BlockEdit', 'core/editor/grid-visualizer', addGridVisualizerToBlockEdit);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createHigherOrderComponent","addFilter","useSelect","GridVisualizer","useGridLayoutSync","store","blockEditorStore","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","GridLayoutSync","props","GridTools","clientId","layout","isSelected","isDragging","select","isBlockSelected","isDraggingBlocks","children","parentLayout","addGridVisualizerToBlockEdit","BlockEdit","attributes","type"],"sources":["@wordpress/block-editor/src/hooks/grid-visualizer.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport { addFilter } from '@wordpress/hooks';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { GridVisualizer, useGridLayoutSync } from '../components/grid';\nimport { store as blockEditorStore } from '../store';\n\nfunction GridLayoutSync( props ) {\n\tuseGridLayoutSync( props );\n}\n\nfunction GridTools( { clientId, layout } ) {\n\tconst { isSelected, isDragging } = useSelect( ( select ) => {\n\t\tconst { isBlockSelected, isDraggingBlocks } =\n\t\t\tselect( blockEditorStore );\n\n\t\treturn {\n\t\t\tisSelected: isBlockSelected( clientId ),\n\t\t\tisDragging: isDraggingBlocks(),\n\t\t};\n\t} );\n\n\
|
|
1
|
+
{"version":3,"names":["createHigherOrderComponent","addFilter","useSelect","GridVisualizer","useGridLayoutSync","store","blockEditorStore","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","GridLayoutSync","props","GridTools","clientId","layout","isSelected","isDragging","select","isBlockSelected","isDraggingBlocks","children","parentLayout","addGridVisualizerToBlockEdit","BlockEdit","attributes","type"],"sources":["@wordpress/block-editor/src/hooks/grid-visualizer.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport { addFilter } from '@wordpress/hooks';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { GridVisualizer, useGridLayoutSync } from '../components/grid';\nimport { store as blockEditorStore } from '../store';\n\nfunction GridLayoutSync( props ) {\n\tuseGridLayoutSync( props );\n}\n\nfunction GridTools( { clientId, layout } ) {\n\tconst { isSelected, isDragging } = useSelect( ( select ) => {\n\t\tconst { isBlockSelected, isDraggingBlocks } =\n\t\t\tselect( blockEditorStore );\n\n\t\treturn {\n\t\t\tisSelected: isBlockSelected( clientId ),\n\t\t\tisDragging: isDraggingBlocks(),\n\t\t};\n\t} );\n\n\treturn (\n\t\t<>\n\t\t\t<GridLayoutSync clientId={ clientId } />\n\t\t\t{ ( isSelected || isDragging ) && (\n\t\t\t\t<GridVisualizer clientId={ clientId } parentLayout={ layout } />\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nconst addGridVisualizerToBlockEdit = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tif ( props.attributes.layout?.type !== 'grid' ) {\n\t\t\treturn <BlockEdit key=\"edit\" { ...props } />;\n\t\t}\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<GridTools\n\t\t\t\t\tclientId={ props.clientId }\n\t\t\t\t\tlayout={ props.attributes.layout }\n\t\t\t\t/>\n\t\t\t\t<BlockEdit key=\"edit\" { ...props } />\n\t\t\t</>\n\t\t);\n\t},\n\t'addGridVisualizerToBlockEdit'\n);\n\naddFilter(\n\t'editor.BlockEdit',\n\t'core/editor/grid-visualizer',\n\taddGridVisualizerToBlockEdit\n);\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,0BAA0B,QAAQ,oBAAoB;AAC/D,SAASC,SAAS,QAAQ,kBAAkB;AAC5C,SAASC,SAAS,QAAQ,iBAAiB;;AAE3C;AACA;AACA;AACA,SAASC,cAAc,EAAEC,iBAAiB,QAAQ,oBAAoB;AACtE,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,UAAU;AAAC,SAAAC,GAAA,IAAAC,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B,CAAC;EAAA,CACpC,CAAC;AAEL,CAAC,EACD,8BACD,CAAC;AAEDb,SAAS,CACR,kBAAkB,EAClB,6BAA6B,EAC7BwB,4BACD,CAAC","ignoreList":[]}
|
|
@@ -114,9 +114,16 @@ function useBlockPropsChildLayoutStyles({
|
|
|
114
114
|
if (!['px', 'rem', 'em'].includes(parentColumnUnit)) {
|
|
115
115
|
parentColumnUnit = 'rem';
|
|
116
116
|
}
|
|
117
|
-
|
|
117
|
+
let numColsToBreakAt = 2;
|
|
118
|
+
if (columnSpan && columnStart) {
|
|
119
|
+
numColsToBreakAt = columnSpan + columnStart - 1;
|
|
120
|
+
} else if (columnSpan) {
|
|
121
|
+
numColsToBreakAt = columnSpan;
|
|
122
|
+
} else {
|
|
123
|
+
numColsToBreakAt = columnStart;
|
|
124
|
+
}
|
|
118
125
|
const defaultGapValue = parentColumnUnit === 'px' ? 24 : 1.5;
|
|
119
|
-
const containerQueryValue =
|
|
126
|
+
const containerQueryValue = numColsToBreakAt * parentColumnValue + (numColsToBreakAt - 1) * defaultGapValue;
|
|
120
127
|
// For blocks that only span one column, we want to remove any rowStart values as
|
|
121
128
|
// the container reduces in size, so that blocks are still arranged in markup order.
|
|
122
129
|
const minimumContainerQueryValue = parentColumnValue * 2 + defaultGapValue - 1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useInstanceId","useSelect","useState","store","blockEditorStore","useStyleOverride","useLayout","GridVisualizer","GridItemResizer","GridItemMovers","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","useBlockPropsChildLayoutStyles","style","_style$layout","shouldRenderChildLayoutStyles","select","getSettings","disableLayoutStyles","layout","selfStretch","flexSize","columnStart","rowStart","columnSpan","rowSpan","parentLayout","columnCount","minimumColumnWidth","id","selector","process","env","NODE_ENV","Error","css","parentColumnValue","parseFloat","isNaN","parentColumnUnit","replace","includes","highestNumber","Math","max","defaultGapValue","containerQueryValue","minimumContainerQueryValue","gridColumnValue","className","ChildLayoutControlsPure","clientId","setAttributes","type","parentLayoutType","allowSizingOnChildren","isManualPlacement","rootClientId","getBlockRootClientId","resizerBounds","setResizerBounds","updateLayout","children","contentRef","bounds","onChange","window","__experimentalEnableGridInteractivity","gridClientId","blockClientId","useBlockProps","edit","attributeKeys","hasSupport"],"sources":["@wordpress/block-editor/src/hooks/layout-child.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useInstanceId } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\nimport { useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../store';\nimport { useStyleOverride } from './utils';\nimport { useLayout } from '../components/block-list/layout';\nimport {\n\tGridVisualizer,\n\tGridItemResizer,\n\tGridItemMovers,\n} from '../components/grid';\n\nfunction useBlockPropsChildLayoutStyles( { style } ) {\n\tconst shouldRenderChildLayoutStyles = useSelect( ( select ) => {\n\t\treturn ! select( blockEditorStore ).getSettings().disableLayoutStyles;\n\t} );\n\tconst layout = style?.layout ?? {};\n\tconst {\n\t\tselfStretch,\n\t\tflexSize,\n\t\tcolumnStart,\n\t\trowStart,\n\t\tcolumnSpan,\n\t\trowSpan,\n\t} = layout;\n\tconst parentLayout = useLayout() || {};\n\tconst { columnCount, minimumColumnWidth } = parentLayout;\n\tconst id = useInstanceId( useBlockPropsChildLayoutStyles );\n\tconst selector = `.wp-container-content-${ id }`;\n\n\t// Check that the grid layout attributes are of the correct type, so that we don't accidentally\n\t// write code that stores a string attribute instead of a number.\n\tif ( process.env.NODE_ENV === 'development' ) {\n\t\tif ( columnStart && typeof columnStart !== 'number' ) {\n\t\t\tthrow new Error( 'columnStart must be a number' );\n\t\t}\n\t\tif ( rowStart && typeof rowStart !== 'number' ) {\n\t\t\tthrow new Error( 'rowStart must be a number' );\n\t\t}\n\t\tif ( columnSpan && typeof columnSpan !== 'number' ) {\n\t\t\tthrow new Error( 'columnSpan must be a number' );\n\t\t}\n\t\tif ( rowSpan && typeof rowSpan !== 'number' ) {\n\t\t\tthrow new Error( 'rowSpan must be a number' );\n\t\t}\n\t}\n\n\tlet css = '';\n\tif ( shouldRenderChildLayoutStyles ) {\n\t\tif ( selfStretch === 'fixed' && flexSize ) {\n\t\t\tcss = `${ selector } {\n\t\t\t\tflex-basis: ${ flexSize };\n\t\t\t\tbox-sizing: border-box;\n\t\t\t}`;\n\t\t} else if ( selfStretch === 'fill' ) {\n\t\t\tcss = `${ selector } {\n\t\t\t\tflex-grow: 1;\n\t\t\t}`;\n\t\t} else if ( columnStart && columnSpan ) {\n\t\t\tcss = `${ selector } {\n\t\t\t\tgrid-column: ${ columnStart } / span ${ columnSpan };\n\t\t\t}`;\n\t\t} else if ( columnStart ) {\n\t\t\tcss = `${ selector } {\n\t\t\t\tgrid-column: ${ columnStart };\n\t\t\t}`;\n\t\t} else if ( columnSpan ) {\n\t\t\tcss = `${ selector } {\n\t\t\t\tgrid-column: span ${ columnSpan };\n\t\t\t}`;\n\t\t}\n\t\tif ( rowStart && rowSpan ) {\n\t\t\tcss += `${ selector } {\n\t\t\t\tgrid-row: ${ rowStart } / span ${ rowSpan };\n\t\t\t}`;\n\t\t} else if ( rowStart ) {\n\t\t\tcss += `${ selector } {\n\t\t\t\tgrid-row: ${ rowStart };\n\t\t\t}`;\n\t\t} else if ( rowSpan ) {\n\t\t\tcss += `${ selector } {\n\t\t\t\tgrid-row: span ${ rowSpan };\n\t\t\t}`;\n\t\t}\n\t\t/**\n\t\t * If minimumColumnWidth is set on the parent, or if no\n\t\t * columnCount is set, the grid is responsive so a\n\t\t * container query is needed for the span to resize.\n\t\t */\n\t\tif (\n\t\t\t( columnSpan || columnStart ) &&\n\t\t\t( minimumColumnWidth || ! columnCount )\n\t\t) {\n\t\t\tlet parentColumnValue = parseFloat( minimumColumnWidth );\n\t\t\t/**\n\t\t\t * 12rem is the default minimumColumnWidth value.\n\t\t\t * If parentColumnValue is not a number, default to 12.\n\t\t\t */\n\t\t\tif ( isNaN( parentColumnValue ) ) {\n\t\t\t\tparentColumnValue = 12;\n\t\t\t}\n\n\t\t\tlet parentColumnUnit = minimumColumnWidth?.replace(\n\t\t\t\tparentColumnValue,\n\t\t\t\t''\n\t\t\t);\n\t\t\t/**\n\t\t\t * Check that parent column unit is either 'px', 'rem' or 'em'.\n\t\t\t * If not, default to 'rem'.\n\t\t\t */\n\t\t\tif ( ! [ 'px', 'rem', 'em' ].includes( parentColumnUnit ) ) {\n\t\t\t\tparentColumnUnit = 'rem';\n\t\t\t}\n\n\t\t\tconst highestNumber = Math.max( columnSpan, columnStart );\n\t\t\tconst defaultGapValue = parentColumnUnit === 'px' ? 24 : 1.5;\n\t\t\tconst containerQueryValue =\n\t\t\t\thighestNumber * parentColumnValue +\n\t\t\t\t( highestNumber - 1 ) * defaultGapValue;\n\t\t\t// For blocks that only span one column, we want to remove any rowStart values as\n\t\t\t// the container reduces in size, so that blocks are still arranged in markup order.\n\t\t\tconst minimumContainerQueryValue =\n\t\t\t\tparentColumnValue * 2 + defaultGapValue - 1;\n\t\t\t// If a span is set we want to preserve it as long as possible, otherwise we just reset the value.\n\t\t\tconst gridColumnValue =\n\t\t\t\tcolumnSpan && columnSpan > 1 ? '1/-1' : 'auto';\n\n\t\t\tcss += `@container (max-width: ${ Math.max(\n\t\t\t\tcontainerQueryValue,\n\t\t\t\tminimumContainerQueryValue\n\t\t\t) }${ parentColumnUnit }) {\n\t\t\t\t${ selector } {\n\t\t\t\t\tgrid-column: ${ gridColumnValue };\n\t\t\t\t\tgrid-row: auto;\n\t\t\t\t}\n\t\t\t}`;\n\t\t}\n\t}\n\n\tuseStyleOverride( { css } );\n\n\t// Only attach a container class if there is generated CSS to be attached.\n\tif ( ! css ) {\n\t\treturn;\n\t}\n\n\t// Attach a `wp-container-content` id-based classname.\n\treturn { className: `wp-container-content-${ id }` };\n}\n\nfunction ChildLayoutControlsPure( { clientId, style, setAttributes } ) {\n\tconst parentLayout = useLayout() || {};\n\tconst {\n\t\ttype: parentLayoutType = 'default',\n\t\tallowSizingOnChildren = false,\n\t\tisManualPlacement,\n\t} = parentLayout;\n\n\tconst rootClientId = useSelect(\n\t\t( select ) => {\n\t\t\treturn select( blockEditorStore ).getBlockRootClientId( clientId );\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\t// Use useState() instead of useRef() so that GridItemResizer updates when ref is set.\n\tconst [ resizerBounds, setResizerBounds ] = useState();\n\n\tif ( parentLayoutType !== 'grid' ) {\n\t\treturn null;\n\t}\n\n\tfunction updateLayout( layout ) {\n\t\tsetAttributes( {\n\t\t\tstyle: {\n\t\t\t\t...style,\n\t\t\t\tlayout: {\n\t\t\t\t\t...style?.layout,\n\t\t\t\t\t...layout,\n\t\t\t\t},\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<GridVisualizer\n\t\t\t\tclientId={ rootClientId }\n\t\t\t\tcontentRef={ setResizerBounds }\n\t\t\t\tparentLayout={ parentLayout }\n\t\t\t/>\n\t\t\t{ allowSizingOnChildren && (\n\t\t\t\t<GridItemResizer\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t// Don't allow resizing beyond the grid visualizer.\n\t\t\t\t\tbounds={ resizerBounds }\n\t\t\t\t\tonChange={ updateLayout }\n\t\t\t\t\tparentLayout={ parentLayout }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ isManualPlacement &&\n\t\t\t\twindow.__experimentalEnableGridInteractivity && (\n\t\t\t\t\t<GridItemMovers\n\t\t\t\t\t\tlayout={ style?.layout }\n\t\t\t\t\t\tparentLayout={ parentLayout }\n\t\t\t\t\t\tonChange={ updateLayout }\n\t\t\t\t\t\tgridClientId={ rootClientId }\n\t\t\t\t\t\tblockClientId={ clientId }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default {\n\tuseBlockProps: useBlockPropsChildLayoutStyles,\n\tedit: ChildLayoutControlsPure,\n\tattributeKeys: [ 'style' ],\n\thasSupport() {\n\t\treturn true;\n\t},\n};\n"],"mappings":"AAA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CAC7B,CACD,EACC8B,iBAAiB,IAClBU,MAAM,CAACC,qCAAqC,iBAC3C5D,IAAA,CAACF,cAAc;MACdc,MAAM,EAAGN,KAAK,EAAEM,MAAQ;MACxBO,YAAY,EAAGA,YAAc;MAC7BuC,QAAQ,EAAGJ,YAAc;MACzBO,YAAY,EAAGX,YAAc;MAC7BY,aAAa,EAAGlB;IAAU,CAC1B,CACD;EAAA,CACD,CAAC;AAEL;AAEA,eAAe;EACdmB,aAAa,EAAE1D,8BAA8B;EAC7C2D,IAAI,EAAErB,uBAAuB;EAC7BsB,aAAa,EAAE,CAAE,OAAO,CAAE;EAC1BC,UAAUA,CAAA,EAAG;IACZ,OAAO,IAAI;EACZ;AACD,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["useInstanceId","useSelect","useState","store","blockEditorStore","useStyleOverride","useLayout","GridVisualizer","GridItemResizer","GridItemMovers","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","useBlockPropsChildLayoutStyles","style","_style$layout","shouldRenderChildLayoutStyles","select","getSettings","disableLayoutStyles","layout","selfStretch","flexSize","columnStart","rowStart","columnSpan","rowSpan","parentLayout","columnCount","minimumColumnWidth","id","selector","process","env","NODE_ENV","Error","css","parentColumnValue","parseFloat","isNaN","parentColumnUnit","replace","includes","numColsToBreakAt","defaultGapValue","containerQueryValue","minimumContainerQueryValue","gridColumnValue","Math","max","className","ChildLayoutControlsPure","clientId","setAttributes","type","parentLayoutType","allowSizingOnChildren","isManualPlacement","rootClientId","getBlockRootClientId","resizerBounds","setResizerBounds","updateLayout","children","contentRef","bounds","onChange","window","__experimentalEnableGridInteractivity","gridClientId","blockClientId","useBlockProps","edit","attributeKeys","hasSupport"],"sources":["@wordpress/block-editor/src/hooks/layout-child.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useInstanceId } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\nimport { useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../store';\nimport { useStyleOverride } from './utils';\nimport { useLayout } from '../components/block-list/layout';\nimport {\n\tGridVisualizer,\n\tGridItemResizer,\n\tGridItemMovers,\n} from '../components/grid';\n\nfunction useBlockPropsChildLayoutStyles( { style } ) {\n\tconst shouldRenderChildLayoutStyles = useSelect( ( select ) => {\n\t\treturn ! select( blockEditorStore ).getSettings().disableLayoutStyles;\n\t} );\n\tconst layout = style?.layout ?? {};\n\tconst {\n\t\tselfStretch,\n\t\tflexSize,\n\t\tcolumnStart,\n\t\trowStart,\n\t\tcolumnSpan,\n\t\trowSpan,\n\t} = layout;\n\tconst parentLayout = useLayout() || {};\n\tconst { columnCount, minimumColumnWidth } = parentLayout;\n\tconst id = useInstanceId( useBlockPropsChildLayoutStyles );\n\tconst selector = `.wp-container-content-${ id }`;\n\n\t// Check that the grid layout attributes are of the correct type, so that we don't accidentally\n\t// write code that stores a string attribute instead of a number.\n\tif ( process.env.NODE_ENV === 'development' ) {\n\t\tif ( columnStart && typeof columnStart !== 'number' ) {\n\t\t\tthrow new Error( 'columnStart must be a number' );\n\t\t}\n\t\tif ( rowStart && typeof rowStart !== 'number' ) {\n\t\t\tthrow new Error( 'rowStart must be a number' );\n\t\t}\n\t\tif ( columnSpan && typeof columnSpan !== 'number' ) {\n\t\t\tthrow new Error( 'columnSpan must be a number' );\n\t\t}\n\t\tif ( rowSpan && typeof rowSpan !== 'number' ) {\n\t\t\tthrow new Error( 'rowSpan must be a number' );\n\t\t}\n\t}\n\n\tlet css = '';\n\tif ( shouldRenderChildLayoutStyles ) {\n\t\tif ( selfStretch === 'fixed' && flexSize ) {\n\t\t\tcss = `${ selector } {\n\t\t\t\tflex-basis: ${ flexSize };\n\t\t\t\tbox-sizing: border-box;\n\t\t\t}`;\n\t\t} else if ( selfStretch === 'fill' ) {\n\t\t\tcss = `${ selector } {\n\t\t\t\tflex-grow: 1;\n\t\t\t}`;\n\t\t} else if ( columnStart && columnSpan ) {\n\t\t\tcss = `${ selector } {\n\t\t\t\tgrid-column: ${ columnStart } / span ${ columnSpan };\n\t\t\t}`;\n\t\t} else if ( columnStart ) {\n\t\t\tcss = `${ selector } {\n\t\t\t\tgrid-column: ${ columnStart };\n\t\t\t}`;\n\t\t} else if ( columnSpan ) {\n\t\t\tcss = `${ selector } {\n\t\t\t\tgrid-column: span ${ columnSpan };\n\t\t\t}`;\n\t\t}\n\t\tif ( rowStart && rowSpan ) {\n\t\t\tcss += `${ selector } {\n\t\t\t\tgrid-row: ${ rowStart } / span ${ rowSpan };\n\t\t\t}`;\n\t\t} else if ( rowStart ) {\n\t\t\tcss += `${ selector } {\n\t\t\t\tgrid-row: ${ rowStart };\n\t\t\t}`;\n\t\t} else if ( rowSpan ) {\n\t\t\tcss += `${ selector } {\n\t\t\t\tgrid-row: span ${ rowSpan };\n\t\t\t}`;\n\t\t}\n\t\t/**\n\t\t * If minimumColumnWidth is set on the parent, or if no\n\t\t * columnCount is set, the grid is responsive so a\n\t\t * container query is needed for the span to resize.\n\t\t */\n\t\tif (\n\t\t\t( columnSpan || columnStart ) &&\n\t\t\t( minimumColumnWidth || ! columnCount )\n\t\t) {\n\t\t\tlet parentColumnValue = parseFloat( minimumColumnWidth );\n\t\t\t/**\n\t\t\t * 12rem is the default minimumColumnWidth value.\n\t\t\t * If parentColumnValue is not a number, default to 12.\n\t\t\t */\n\t\t\tif ( isNaN( parentColumnValue ) ) {\n\t\t\t\tparentColumnValue = 12;\n\t\t\t}\n\n\t\t\tlet parentColumnUnit = minimumColumnWidth?.replace(\n\t\t\t\tparentColumnValue,\n\t\t\t\t''\n\t\t\t);\n\t\t\t/**\n\t\t\t * Check that parent column unit is either 'px', 'rem' or 'em'.\n\t\t\t * If not, default to 'rem'.\n\t\t\t */\n\t\t\tif ( ! [ 'px', 'rem', 'em' ].includes( parentColumnUnit ) ) {\n\t\t\t\tparentColumnUnit = 'rem';\n\t\t\t}\n\n\t\t\tlet numColsToBreakAt = 2;\n\n\t\t\tif ( columnSpan && columnStart ) {\n\t\t\t\tnumColsToBreakAt = columnSpan + columnStart - 1;\n\t\t\t} else if ( columnSpan ) {\n\t\t\t\tnumColsToBreakAt = columnSpan;\n\t\t\t} else {\n\t\t\t\tnumColsToBreakAt = columnStart;\n\t\t\t}\n\n\t\t\tconst defaultGapValue = parentColumnUnit === 'px' ? 24 : 1.5;\n\t\t\tconst containerQueryValue =\n\t\t\t\tnumColsToBreakAt * parentColumnValue +\n\t\t\t\t( numColsToBreakAt - 1 ) * defaultGapValue;\n\t\t\t// For blocks that only span one column, we want to remove any rowStart values as\n\t\t\t// the container reduces in size, so that blocks are still arranged in markup order.\n\t\t\tconst minimumContainerQueryValue =\n\t\t\t\tparentColumnValue * 2 + defaultGapValue - 1;\n\t\t\t// If a span is set we want to preserve it as long as possible, otherwise we just reset the value.\n\t\t\tconst gridColumnValue =\n\t\t\t\tcolumnSpan && columnSpan > 1 ? '1/-1' : 'auto';\n\n\t\t\tcss += `@container (max-width: ${ Math.max(\n\t\t\t\tcontainerQueryValue,\n\t\t\t\tminimumContainerQueryValue\n\t\t\t) }${ parentColumnUnit }) {\n\t\t\t\t${ selector } {\n\t\t\t\t\tgrid-column: ${ gridColumnValue };\n\t\t\t\t\tgrid-row: auto;\n\t\t\t\t}\n\t\t\t}`;\n\t\t}\n\t}\n\n\tuseStyleOverride( { css } );\n\n\t// Only attach a container class if there is generated CSS to be attached.\n\tif ( ! css ) {\n\t\treturn;\n\t}\n\n\t// Attach a `wp-container-content` id-based classname.\n\treturn { className: `wp-container-content-${ id }` };\n}\n\nfunction ChildLayoutControlsPure( { clientId, style, setAttributes } ) {\n\tconst parentLayout = useLayout() || {};\n\tconst {\n\t\ttype: parentLayoutType = 'default',\n\t\tallowSizingOnChildren = false,\n\t\tisManualPlacement,\n\t} = parentLayout;\n\n\tconst rootClientId = useSelect(\n\t\t( select ) => {\n\t\t\treturn select( blockEditorStore ).getBlockRootClientId( clientId );\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\t// Use useState() instead of useRef() so that GridItemResizer updates when ref is set.\n\tconst [ resizerBounds, setResizerBounds ] = useState();\n\n\tif ( parentLayoutType !== 'grid' ) {\n\t\treturn null;\n\t}\n\n\tfunction updateLayout( layout ) {\n\t\tsetAttributes( {\n\t\t\tstyle: {\n\t\t\t\t...style,\n\t\t\t\tlayout: {\n\t\t\t\t\t...style?.layout,\n\t\t\t\t\t...layout,\n\t\t\t\t},\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<GridVisualizer\n\t\t\t\tclientId={ rootClientId }\n\t\t\t\tcontentRef={ setResizerBounds }\n\t\t\t\tparentLayout={ parentLayout }\n\t\t\t/>\n\t\t\t{ allowSizingOnChildren && (\n\t\t\t\t<GridItemResizer\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t// Don't allow resizing beyond the grid visualizer.\n\t\t\t\t\tbounds={ resizerBounds }\n\t\t\t\t\tonChange={ updateLayout }\n\t\t\t\t\tparentLayout={ parentLayout }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ isManualPlacement &&\n\t\t\t\twindow.__experimentalEnableGridInteractivity && (\n\t\t\t\t\t<GridItemMovers\n\t\t\t\t\t\tlayout={ style?.layout }\n\t\t\t\t\t\tparentLayout={ parentLayout }\n\t\t\t\t\t\tonChange={ updateLayout }\n\t\t\t\t\t\tgridClientId={ rootClientId }\n\t\t\t\t\t\tblockClientId={ clientId }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default {\n\tuseBlockProps: useBlockPropsChildLayoutStyles,\n\tedit: ChildLayoutControlsPure,\n\tattributeKeys: [ 'style' ],\n\thasSupport() {\n\t\treturn true;\n\t},\n};\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,aAAa,QAAQ,oBAAoB;AAClD,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,QAAQ,QAAQ,oBAAoB;;AAE7C;AACA;AACA;AACA,SAASC,KAAK,IAAIC,gBAAgB,QA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Y,EAAGA;IAAc,CAC7B,CACD,EACC8B,iBAAiB,IAClBU,MAAM,CAACC,qCAAqC,iBAC3C5D,IAAA,CAACF,cAAc;MACdc,MAAM,EAAGN,KAAK,EAAEM,MAAQ;MACxBO,YAAY,EAAGA,YAAc;MAC7BuC,QAAQ,EAAGJ,YAAc;MACzBO,YAAY,EAAGX,YAAc;MAC7BY,aAAa,EAAGlB;IAAU,CAC1B,CACD;EAAA,CACD,CAAC;AAEL;AAEA,eAAe;EACdmB,aAAa,EAAE1D,8BAA8B;EAC7C2D,IAAI,EAAErB,uBAAuB;EAC7BsB,aAAa,EAAE,CAAE,OAAO,CAAE;EAC1BC,UAAUA,CAAA,EAAG;IACZ,OAAO,IAAI;EACZ;AACD,CAAC","ignoreList":[]}
|
|
@@ -8,7 +8,7 @@ import clsx from 'clsx';
|
|
|
8
8
|
*/
|
|
9
9
|
import { __, _x, sprintf } from '@wordpress/i18n';
|
|
10
10
|
import { getBlockSupport, hasBlockSupport } from '@wordpress/blocks';
|
|
11
|
-
import { BaseControl,
|
|
11
|
+
import { BaseControl, CustomSelectControl } from '@wordpress/components';
|
|
12
12
|
import { useInstanceId } from '@wordpress/compose';
|
|
13
13
|
import { useSelect } from '@wordpress/data';
|
|
14
14
|
import { useMemo, Platform } from '@wordpress/element';
|
|
@@ -20,12 +20,8 @@ import { useSettings } from '../components/use-settings';
|
|
|
20
20
|
import InspectorControls from '../components/inspector-controls';
|
|
21
21
|
import useBlockDisplayInformation from '../components/use-block-display-information';
|
|
22
22
|
import { cleanEmptyObject, useStyleOverride } from './utils';
|
|
23
|
-
import { unlock } from '../lock-unlock';
|
|
24
23
|
import { store as blockEditorStore } from '../store';
|
|
25
24
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
26
|
-
const {
|
|
27
|
-
CustomSelectControlV2Legacy: CustomSelectControl
|
|
28
|
-
} = unlock(componentsPrivateApis);
|
|
29
25
|
const POSITION_SUPPORT_KEY = 'position';
|
|
30
26
|
const DEFAULT_OPTION = {
|
|
31
27
|
key: 'default',
|
|
@@ -36,13 +32,13 @@ const STICKY_OPTION = {
|
|
|
36
32
|
key: 'sticky',
|
|
37
33
|
value: 'sticky',
|
|
38
34
|
name: _x('Sticky', 'Name for the value of the CSS position property'),
|
|
39
|
-
|
|
35
|
+
hint: __('The block will stick to the top of the window instead of scrolling.')
|
|
40
36
|
};
|
|
41
37
|
const FIXED_OPTION = {
|
|
42
38
|
key: 'fixed',
|
|
43
39
|
value: 'fixed',
|
|
44
40
|
name: _x('Fixed', 'Name for the value of the CSS position property'),
|
|
45
|
-
|
|
41
|
+
hint: __('The block will not move when the page is scrolled.')
|
|
46
42
|
};
|
|
47
43
|
const POSITION_SIDES = ['top', 'right', 'bottom', 'left'];
|
|
48
44
|
const VALID_POSITION_TYPES = ['sticky', 'fixed'];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["clsx","__","_x","sprintf","getBlockSupport","hasBlockSupport","BaseControl","privateApis","componentsPrivateApis","useInstanceId","useSelect","useMemo","Platform","useSettings","InspectorControls","useBlockDisplayInformation","cleanEmptyObject","useStyleOverride","unlock","store","blockEditorStore","jsx","_jsx","CustomSelectControlV2Legacy","CustomSelectControl","POSITION_SUPPORT_KEY","DEFAULT_OPTION","key","value","name","STICKY_OPTION","__experimentalHint","FIXED_OPTION","POSITION_SIDES","VALID_POSITION_TYPES","getPositionCSS","selector","style","output","type","positionType","position","includes","forEach","side","undefined","hasStickyPositionSupport","blockType","support","sticky","hasFixedPositionSupport","fixed","hasPositionSupport","hasPositionValue","props","attributes","hasStickyOrFixedPositionValue","resetPosition","setAttributes","top","right","bottom","left","useIsPositionDisabled","blockName","allowFixed","allowSticky","isDisabled","PositionPanelPure","clientId","firstParentClientId","select","getBlockParents","parents","length","blockInformation","stickyHelpText","title","options","availableOptions","push","onChangeType","next","placementValue","newStyle","selectedOption","find","option","web","group","children","__nextHasNoMarginBottom","help","__next40pxDefaultSize","label","hideLabelFromVision","describedBy","onChange","selectedItem","size","native","edit","Edit","isPositionDisabled","useBlockProps","attributeKeys","hasSupport","hasPositionBlockSupport","allowPositionStyles","id","positionSelector","css","className"],"sources":["@wordpress/block-editor/src/hooks/position.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport { getBlockSupport, hasBlockSupport } from '@wordpress/blocks';\nimport {\n\tBaseControl,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { useInstanceId } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\nimport { useMemo, Platform } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { useSettings } from '../components/use-settings';\nimport InspectorControls from '../components/inspector-controls';\nimport useBlockDisplayInformation from '../components/use-block-display-information';\nimport { cleanEmptyObject, useStyleOverride } from './utils';\nimport { unlock } from '../lock-unlock';\nimport { store as blockEditorStore } from '../store';\n\nconst { CustomSelectControlV2Legacy: CustomSelectControl } = unlock(\n\tcomponentsPrivateApis\n);\n\nconst POSITION_SUPPORT_KEY = 'position';\n\nconst DEFAULT_OPTION = {\n\tkey: 'default',\n\tvalue: '',\n\tname: __( 'Default' ),\n};\n\nconst STICKY_OPTION = {\n\tkey: 'sticky',\n\tvalue: 'sticky',\n\tname: _x( 'Sticky', 'Name for the value of the CSS position property' ),\n\t__experimentalHint: __(\n\t\t'The block will stick to the top of the window instead of scrolling.'\n\t),\n};\n\nconst FIXED_OPTION = {\n\tkey: 'fixed',\n\tvalue: 'fixed',\n\tname: _x( 'Fixed', 'Name for the value of the CSS position property' ),\n\t__experimentalHint: __(\n\t\t'The block will not move when the page is scrolled.'\n\t),\n};\n\nconst POSITION_SIDES = [ 'top', 'right', 'bottom', 'left' ];\nconst VALID_POSITION_TYPES = [ 'sticky', 'fixed' ];\n\n/**\n * Get calculated position CSS.\n *\n * @param {Object} props Component props.\n * @param {string} props.selector Selector to use.\n * @param {Object} props.style Style object.\n * @return {string} The generated CSS rules.\n */\nexport function getPositionCSS( { selector, style } ) {\n\tlet output = '';\n\n\tconst { type: positionType } = style?.position || {};\n\n\tif ( ! VALID_POSITION_TYPES.includes( positionType ) ) {\n\t\treturn output;\n\t}\n\n\toutput += `${ selector } {`;\n\toutput += `position: ${ positionType };`;\n\n\tPOSITION_SIDES.forEach( ( side ) => {\n\t\tif ( style?.position?.[ side ] !== undefined ) {\n\t\t\toutput += `${ side }: ${ style.position[ side ] };`;\n\t\t}\n\t} );\n\n\tif ( positionType === 'sticky' || positionType === 'fixed' ) {\n\t\t// TODO: Replace hard-coded z-index value with a z-index preset approach in theme.json.\n\t\toutput += `z-index: 10`;\n\t}\n\toutput += `}`;\n\n\treturn output;\n}\n\n/**\n * Determines if there is sticky position support.\n *\n * @param {string|Object} blockType Block name or Block Type object.\n *\n * @return {boolean} Whether there is support.\n */\nexport function hasStickyPositionSupport( blockType ) {\n\tconst support = getBlockSupport( blockType, POSITION_SUPPORT_KEY );\n\treturn !! ( true === support || support?.sticky );\n}\n\n/**\n * Determines if there is fixed position support.\n *\n * @param {string|Object} blockType Block name or Block Type object.\n *\n * @return {boolean} Whether there is support.\n */\nexport function hasFixedPositionSupport( blockType ) {\n\tconst support = getBlockSupport( blockType, POSITION_SUPPORT_KEY );\n\treturn !! ( true === support || support?.fixed );\n}\n\n/**\n * Determines if there is position support.\n *\n * @param {string|Object} blockType Block name or Block Type object.\n *\n * @return {boolean} Whether there is support.\n */\nexport function hasPositionSupport( blockType ) {\n\tconst support = getBlockSupport( blockType, POSITION_SUPPORT_KEY );\n\treturn !! support;\n}\n\n/**\n * Checks if there is a current value in the position block support attributes.\n *\n * @param {Object} props Block props.\n * @return {boolean} Whether or not the block has a position value set.\n */\nexport function hasPositionValue( props ) {\n\treturn props.attributes.style?.position?.type !== undefined;\n}\n\n/**\n * Checks if the block is currently set to a sticky or fixed position.\n * This check is helpful for determining how to position block toolbars or other elements.\n *\n * @param {Object} attributes Block attributes.\n * @return {boolean} Whether or not the block is set to a sticky or fixed position.\n */\nexport function hasStickyOrFixedPositionValue( attributes ) {\n\tconst positionType = attributes?.style?.position?.type;\n\treturn positionType === 'sticky' || positionType === 'fixed';\n}\n\n/**\n * Resets the position block support attributes. This can be used when disabling\n * the position support controls for a block via a `ToolsPanel`.\n *\n * @param {Object} props Block props.\n * @param {Object} props.attributes Block's attributes.\n * @param {Object} props.setAttributes Function to set block's attributes.\n */\nexport function resetPosition( { attributes = {}, setAttributes } ) {\n\tconst { style = {} } = attributes;\n\n\tsetAttributes( {\n\t\tstyle: cleanEmptyObject( {\n\t\t\t...style,\n\t\t\tposition: {\n\t\t\t\t...style?.position,\n\t\t\t\ttype: undefined,\n\t\t\t\ttop: undefined,\n\t\t\t\tright: undefined,\n\t\t\t\tbottom: undefined,\n\t\t\t\tleft: undefined,\n\t\t\t},\n\t\t} ),\n\t} );\n}\n\n/**\n * Custom hook that checks if position settings have been disabled.\n *\n * @param {string} name The name of the block.\n *\n * @return {boolean} Whether padding setting is disabled.\n */\nexport function useIsPositionDisabled( { name: blockName } = {} ) {\n\tconst [ allowFixed, allowSticky ] = useSettings(\n\t\t'position.fixed',\n\t\t'position.sticky'\n\t);\n\tconst isDisabled = ! allowFixed && ! allowSticky;\n\n\treturn ! hasPositionSupport( blockName ) || isDisabled;\n}\n\n/*\n * Position controls rendered in an inspector control panel.\n *\n * @param {Object} props\n *\n * @return {Element} Position panel.\n */\nexport function PositionPanelPure( {\n\tstyle = {},\n\tclientId,\n\tname: blockName,\n\tsetAttributes,\n} ) {\n\tconst allowFixed = hasFixedPositionSupport( blockName );\n\tconst allowSticky = hasStickyPositionSupport( blockName );\n\tconst value = style?.position?.type;\n\n\tconst { firstParentClientId } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockParents } = select( blockEditorStore );\n\t\t\tconst parents = getBlockParents( clientId );\n\t\t\treturn { firstParentClientId: parents[ parents.length - 1 ] };\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst blockInformation = useBlockDisplayInformation( firstParentClientId );\n\tconst stickyHelpText =\n\t\tallowSticky && value === STICKY_OPTION.value && blockInformation\n\t\t\t? sprintf(\n\t\t\t\t\t/* translators: %s: the name of the parent block. */\n\t\t\t\t\t__(\n\t\t\t\t\t\t'The block will stick to the scrollable area of the parent %s block.'\n\t\t\t\t\t),\n\t\t\t\t\tblockInformation.title\n\t\t\t )\n\t\t\t: null;\n\n\tconst options = useMemo( () => {\n\t\tconst availableOptions = [ DEFAULT_OPTION ];\n\t\t// Display options if they are allowed, or if a block already has a valid value set.\n\t\t// This allows for a block to be switched off from a position type that is not allowed.\n\t\tif ( allowSticky || value === STICKY_OPTION.value ) {\n\t\t\tavailableOptions.push( STICKY_OPTION );\n\t\t}\n\t\tif ( allowFixed || value === FIXED_OPTION.value ) {\n\t\t\tavailableOptions.push( FIXED_OPTION );\n\t\t}\n\t\treturn availableOptions;\n\t}, [ allowFixed, allowSticky, value ] );\n\n\tconst onChangeType = ( next ) => {\n\t\t// For now, use a hard-coded `0px` value for the position.\n\t\t// `0px` is preferred over `0` as it can be used in `calc()` functions.\n\t\t// In the future, it could be useful to allow for an offset value.\n\t\tconst placementValue = '0px';\n\n\t\tconst newStyle = {\n\t\t\t...style,\n\t\t\tposition: {\n\t\t\t\t...style?.position,\n\t\t\t\ttype: next,\n\t\t\t\ttop:\n\t\t\t\t\tnext === 'sticky' || next === 'fixed'\n\t\t\t\t\t\t? placementValue\n\t\t\t\t\t\t: undefined,\n\t\t\t},\n\t\t};\n\n\t\tsetAttributes( {\n\t\t\tstyle: cleanEmptyObject( newStyle ),\n\t\t} );\n\t};\n\n\tconst selectedOption = value\n\t\t? options.find( ( option ) => option.value === value ) || DEFAULT_OPTION\n\t\t: DEFAULT_OPTION;\n\n\t// Only display position controls if there is at least one option to choose from.\n\treturn Platform.select( {\n\t\tweb:\n\t\t\toptions.length > 1 ? (\n\t\t\t\t<InspectorControls group=\"position\">\n\t\t\t\t\t<BaseControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\thelp={ stickyHelpText }\n\t\t\t\t\t>\n\t\t\t\t\t\t<CustomSelectControl\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tlabel={ __( 'Position' ) }\n\t\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\t\tdescribedBy={ sprintf(\n\t\t\t\t\t\t\t\t// translators: %s: Currently selected position.\n\t\t\t\t\t\t\t\t__( 'Currently selected position: %s' ),\n\t\t\t\t\t\t\t\tselectedOption.name\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\toptions={ options }\n\t\t\t\t\t\t\tvalue={ selectedOption }\n\t\t\t\t\t\t\tonChange={ ( { selectedItem } ) => {\n\t\t\t\t\t\t\t\tonChangeType( selectedItem.value );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t</BaseControl>\n\t\t\t\t</InspectorControls>\n\t\t\t) : null,\n\t\tnative: null,\n\t} );\n}\n\nexport default {\n\tedit: function Edit( props ) {\n\t\tconst isPositionDisabled = useIsPositionDisabled( props );\n\t\tif ( isPositionDisabled ) {\n\t\t\treturn null;\n\t\t}\n\t\treturn <PositionPanelPure { ...props } />;\n\t},\n\tuseBlockProps,\n\tattributeKeys: [ 'style' ],\n\thasSupport( name ) {\n\t\treturn hasBlockSupport( name, POSITION_SUPPORT_KEY );\n\t},\n};\n\nfunction useBlockProps( { name, style } ) {\n\tconst hasPositionBlockSupport = hasBlockSupport(\n\t\tname,\n\t\tPOSITION_SUPPORT_KEY\n\t);\n\tconst isPositionDisabled = useIsPositionDisabled( { name } );\n\tconst allowPositionStyles = hasPositionBlockSupport && ! isPositionDisabled;\n\n\tconst id = useInstanceId( useBlockProps );\n\n\t// Higher specificity to override defaults in editor UI.\n\tconst positionSelector = `.wp-container-${ id }.wp-container-${ id }`;\n\n\t// Get CSS string for the current position values.\n\tlet css;\n\tif ( allowPositionStyles ) {\n\t\tcss =\n\t\t\tgetPositionCSS( {\n\t\t\t\tselector: positionSelector,\n\t\t\t\tstyle,\n\t\t\t} ) || '';\n\t}\n\n\t// Attach a `wp-container-` id-based class name.\n\tconst className = clsx( {\n\t\t[ `wp-container-${ id }` ]: allowPositionStyles && !! css, // Only attach a container class if there is generated CSS to be attached.\n\t\t[ `is-position-${ style?.position?.type }` ]:\n\t\t\tallowPositionStyles && !! css && !! style?.position?.type,\n\t} );\n\n\tuseStyleOverride( { css } );\n\n\treturn { className };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,EAAE,EAAEC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AACjD,SAASC,eAAe,EAAEC,eAAe,QAAQ,mBAAmB;AACpE,SACCC,WAAW,EACXC,WAAW,IAAIC,qBAAqB,QAC9B,uBAAuB;AAC9B,SAASC,aAAa,QAAQ,oBAAoB;AAClD,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,OAAO,EAAEC,QAAQ,QAAQ,oBAAoB;;AAEtD;AACA;AACA;AACA,SAASC,WAAW,QAAQ,4BAA4B;AACxD,OAAOC,iBAAiB,MAAM,kCAAkC;AAChE,OAAOC,0BAA0B,MAAM,6CAA6C;AACpF,SAASC,gBAAgB,EAAEC,gBAAgB,QAAQ,SAAS;AAC5D,SAASC,MAAM,QAAQ,gBAAgB;AACvC,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,UAAU;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAErD,MAAM;EAAEC,2BAA2B,EAAEC;AAAoB,CAAC,GAAGN,MAAM,CAClEV,qBACD,CAAC;AAED,MAAMiB,oBAAoB,GAAG,UAAU;AAEvC,MAAMC,cAAc,GAAG;EACtBC,GAAG,EAAE,SAAS;EACdC,KAAK,EAAE,EAAE;EACTC,IAAI,EAAE5B,EAAE,CAAE,SAAU;AACrB,CAAC;AAED,MAAM6B,aAAa,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,OAAOxB,eAAe,CAAEwB,IAAI,EAAEJ,oBAAqB,CAAC;EACrD;AACD,CAAC;AAED,SAAS+E,aAAaA,CAAE;EAAE3E,IAAI;EAAEQ;AAAM,CAAC,EAAG;EACzC,MAAMsE,uBAAuB,GAAGtG,eAAe,CAC9CwB,IAAI,EACJJ,oBACD,CAAC;EACD,MAAM8E,kBAAkB,GAAGxC,qBAAqB,CAAE;IAAElC;EAAK,CAAE,CAAC;EAC5D,MAAM+E,mBAAmB,GAAGD,uBAAuB,IAAI,CAAEJ,kBAAkB;EAE3E,MAAMM,EAAE,GAAGpG,aAAa,CAAE+F,aAAc,CAAC;;EAEzC;EACA,MAAMM,gBAAgB,GAAI,iBAAiBD,EAAI,iBAAiBA,EAAI,EAAC;;EAErE;EACA,IAAIE,GAAG;EACP,IAAKH,mBAAmB,EAAG;IAC1BG,GAAG,GACF5E,cAAc,CAAE;MACfC,QAAQ,EAAE0E,gBAAgB;MAC1BzE;IACD,CAAE,CAAC,IAAI,EAAE;EACX;;EAEA;EACA,MAAM2E,SAAS,GAAGhH,IAAI,CAAE;IACvB,CAAG,gBAAgB6G,EAAI,EAAC,GAAID,mBAAmB,IAAI,CAAC,CAAEG,GAAG;IAAE;IAC3D,CAAG,eAAe1E,KAAK,EAAEI,QAAQ,EAAEF,IAAM,EAAC,GACzCqE,mBAAmB,IAAI,CAAC,CAAEG,GAAG,IAAI,CAAC,CAAE1E,KAAK,EAAEI,QAAQ,EAAEF;EACvD,CAAE,CAAC;EAEHtB,gBAAgB,CAAE;IAAE8F;EAAI,CAAE,CAAC;EAE3B,OAAO;IAAEC;EAAU,CAAC;AACrB","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["clsx","__","_x","sprintf","getBlockSupport","hasBlockSupport","BaseControl","CustomSelectControl","useInstanceId","useSelect","useMemo","Platform","useSettings","InspectorControls","useBlockDisplayInformation","cleanEmptyObject","useStyleOverride","store","blockEditorStore","jsx","_jsx","POSITION_SUPPORT_KEY","DEFAULT_OPTION","key","value","name","STICKY_OPTION","hint","FIXED_OPTION","POSITION_SIDES","VALID_POSITION_TYPES","getPositionCSS","selector","style","output","type","positionType","position","includes","forEach","side","undefined","hasStickyPositionSupport","blockType","support","sticky","hasFixedPositionSupport","fixed","hasPositionSupport","hasPositionValue","props","attributes","hasStickyOrFixedPositionValue","resetPosition","setAttributes","top","right","bottom","left","useIsPositionDisabled","blockName","allowFixed","allowSticky","isDisabled","PositionPanelPure","clientId","firstParentClientId","select","getBlockParents","parents","length","blockInformation","stickyHelpText","title","options","availableOptions","push","onChangeType","next","placementValue","newStyle","selectedOption","find","option","web","group","children","__nextHasNoMarginBottom","help","__next40pxDefaultSize","label","hideLabelFromVision","describedBy","onChange","selectedItem","size","native","edit","Edit","isPositionDisabled","useBlockProps","attributeKeys","hasSupport","hasPositionBlockSupport","allowPositionStyles","id","positionSelector","css","className"],"sources":["@wordpress/block-editor/src/hooks/position.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport { getBlockSupport, hasBlockSupport } from '@wordpress/blocks';\nimport { BaseControl, CustomSelectControl } from '@wordpress/components';\nimport { useInstanceId } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\nimport { useMemo, Platform } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { useSettings } from '../components/use-settings';\nimport InspectorControls from '../components/inspector-controls';\nimport useBlockDisplayInformation from '../components/use-block-display-information';\nimport { cleanEmptyObject, useStyleOverride } from './utils';\nimport { store as blockEditorStore } from '../store';\n\nconst POSITION_SUPPORT_KEY = 'position';\n\nconst DEFAULT_OPTION = {\n\tkey: 'default',\n\tvalue: '',\n\tname: __( 'Default' ),\n};\n\nconst STICKY_OPTION = {\n\tkey: 'sticky',\n\tvalue: 'sticky',\n\tname: _x( 'Sticky', 'Name for the value of the CSS position property' ),\n\thint: __(\n\t\t'The block will stick to the top of the window instead of scrolling.'\n\t),\n};\n\nconst FIXED_OPTION = {\n\tkey: 'fixed',\n\tvalue: 'fixed',\n\tname: _x( 'Fixed', 'Name for the value of the CSS position property' ),\n\thint: __( 'The block will not move when the page is scrolled.' ),\n};\n\nconst POSITION_SIDES = [ 'top', 'right', 'bottom', 'left' ];\nconst VALID_POSITION_TYPES = [ 'sticky', 'fixed' ];\n\n/**\n * Get calculated position CSS.\n *\n * @param {Object} props Component props.\n * @param {string} props.selector Selector to use.\n * @param {Object} props.style Style object.\n * @return {string} The generated CSS rules.\n */\nexport function getPositionCSS( { selector, style } ) {\n\tlet output = '';\n\n\tconst { type: positionType } = style?.position || {};\n\n\tif ( ! VALID_POSITION_TYPES.includes( positionType ) ) {\n\t\treturn output;\n\t}\n\n\toutput += `${ selector } {`;\n\toutput += `position: ${ positionType };`;\n\n\tPOSITION_SIDES.forEach( ( side ) => {\n\t\tif ( style?.position?.[ side ] !== undefined ) {\n\t\t\toutput += `${ side }: ${ style.position[ side ] };`;\n\t\t}\n\t} );\n\n\tif ( positionType === 'sticky' || positionType === 'fixed' ) {\n\t\t// TODO: Replace hard-coded z-index value with a z-index preset approach in theme.json.\n\t\toutput += `z-index: 10`;\n\t}\n\toutput += `}`;\n\n\treturn output;\n}\n\n/**\n * Determines if there is sticky position support.\n *\n * @param {string|Object} blockType Block name or Block Type object.\n *\n * @return {boolean} Whether there is support.\n */\nexport function hasStickyPositionSupport( blockType ) {\n\tconst support = getBlockSupport( blockType, POSITION_SUPPORT_KEY );\n\treturn !! ( true === support || support?.sticky );\n}\n\n/**\n * Determines if there is fixed position support.\n *\n * @param {string|Object} blockType Block name or Block Type object.\n *\n * @return {boolean} Whether there is support.\n */\nexport function hasFixedPositionSupport( blockType ) {\n\tconst support = getBlockSupport( blockType, POSITION_SUPPORT_KEY );\n\treturn !! ( true === support || support?.fixed );\n}\n\n/**\n * Determines if there is position support.\n *\n * @param {string|Object} blockType Block name or Block Type object.\n *\n * @return {boolean} Whether there is support.\n */\nexport function hasPositionSupport( blockType ) {\n\tconst support = getBlockSupport( blockType, POSITION_SUPPORT_KEY );\n\treturn !! support;\n}\n\n/**\n * Checks if there is a current value in the position block support attributes.\n *\n * @param {Object} props Block props.\n * @return {boolean} Whether or not the block has a position value set.\n */\nexport function hasPositionValue( props ) {\n\treturn props.attributes.style?.position?.type !== undefined;\n}\n\n/**\n * Checks if the block is currently set to a sticky or fixed position.\n * This check is helpful for determining how to position block toolbars or other elements.\n *\n * @param {Object} attributes Block attributes.\n * @return {boolean} Whether or not the block is set to a sticky or fixed position.\n */\nexport function hasStickyOrFixedPositionValue( attributes ) {\n\tconst positionType = attributes?.style?.position?.type;\n\treturn positionType === 'sticky' || positionType === 'fixed';\n}\n\n/**\n * Resets the position block support attributes. This can be used when disabling\n * the position support controls for a block via a `ToolsPanel`.\n *\n * @param {Object} props Block props.\n * @param {Object} props.attributes Block's attributes.\n * @param {Object} props.setAttributes Function to set block's attributes.\n */\nexport function resetPosition( { attributes = {}, setAttributes } ) {\n\tconst { style = {} } = attributes;\n\n\tsetAttributes( {\n\t\tstyle: cleanEmptyObject( {\n\t\t\t...style,\n\t\t\tposition: {\n\t\t\t\t...style?.position,\n\t\t\t\ttype: undefined,\n\t\t\t\ttop: undefined,\n\t\t\t\tright: undefined,\n\t\t\t\tbottom: undefined,\n\t\t\t\tleft: undefined,\n\t\t\t},\n\t\t} ),\n\t} );\n}\n\n/**\n * Custom hook that checks if position settings have been disabled.\n *\n * @param {string} name The name of the block.\n *\n * @return {boolean} Whether padding setting is disabled.\n */\nexport function useIsPositionDisabled( { name: blockName } = {} ) {\n\tconst [ allowFixed, allowSticky ] = useSettings(\n\t\t'position.fixed',\n\t\t'position.sticky'\n\t);\n\tconst isDisabled = ! allowFixed && ! allowSticky;\n\n\treturn ! hasPositionSupport( blockName ) || isDisabled;\n}\n\n/*\n * Position controls rendered in an inspector control panel.\n *\n * @param {Object} props\n *\n * @return {Element} Position panel.\n */\nexport function PositionPanelPure( {\n\tstyle = {},\n\tclientId,\n\tname: blockName,\n\tsetAttributes,\n} ) {\n\tconst allowFixed = hasFixedPositionSupport( blockName );\n\tconst allowSticky = hasStickyPositionSupport( blockName );\n\tconst value = style?.position?.type;\n\n\tconst { firstParentClientId } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockParents } = select( blockEditorStore );\n\t\t\tconst parents = getBlockParents( clientId );\n\t\t\treturn { firstParentClientId: parents[ parents.length - 1 ] };\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst blockInformation = useBlockDisplayInformation( firstParentClientId );\n\tconst stickyHelpText =\n\t\tallowSticky && value === STICKY_OPTION.value && blockInformation\n\t\t\t? sprintf(\n\t\t\t\t\t/* translators: %s: the name of the parent block. */\n\t\t\t\t\t__(\n\t\t\t\t\t\t'The block will stick to the scrollable area of the parent %s block.'\n\t\t\t\t\t),\n\t\t\t\t\tblockInformation.title\n\t\t\t )\n\t\t\t: null;\n\n\tconst options = useMemo( () => {\n\t\tconst availableOptions = [ DEFAULT_OPTION ];\n\t\t// Display options if they are allowed, or if a block already has a valid value set.\n\t\t// This allows for a block to be switched off from a position type that is not allowed.\n\t\tif ( allowSticky || value === STICKY_OPTION.value ) {\n\t\t\tavailableOptions.push( STICKY_OPTION );\n\t\t}\n\t\tif ( allowFixed || value === FIXED_OPTION.value ) {\n\t\t\tavailableOptions.push( FIXED_OPTION );\n\t\t}\n\t\treturn availableOptions;\n\t}, [ allowFixed, allowSticky, value ] );\n\n\tconst onChangeType = ( next ) => {\n\t\t// For now, use a hard-coded `0px` value for the position.\n\t\t// `0px` is preferred over `0` as it can be used in `calc()` functions.\n\t\t// In the future, it could be useful to allow for an offset value.\n\t\tconst placementValue = '0px';\n\n\t\tconst newStyle = {\n\t\t\t...style,\n\t\t\tposition: {\n\t\t\t\t...style?.position,\n\t\t\t\ttype: next,\n\t\t\t\ttop:\n\t\t\t\t\tnext === 'sticky' || next === 'fixed'\n\t\t\t\t\t\t? placementValue\n\t\t\t\t\t\t: undefined,\n\t\t\t},\n\t\t};\n\n\t\tsetAttributes( {\n\t\t\tstyle: cleanEmptyObject( newStyle ),\n\t\t} );\n\t};\n\n\tconst selectedOption = value\n\t\t? options.find( ( option ) => option.value === value ) || DEFAULT_OPTION\n\t\t: DEFAULT_OPTION;\n\n\t// Only display position controls if there is at least one option to choose from.\n\treturn Platform.select( {\n\t\tweb:\n\t\t\toptions.length > 1 ? (\n\t\t\t\t<InspectorControls group=\"position\">\n\t\t\t\t\t<BaseControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\thelp={ stickyHelpText }\n\t\t\t\t\t>\n\t\t\t\t\t\t<CustomSelectControl\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tlabel={ __( 'Position' ) }\n\t\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\t\tdescribedBy={ sprintf(\n\t\t\t\t\t\t\t\t// translators: %s: Currently selected position.\n\t\t\t\t\t\t\t\t__( 'Currently selected position: %s' ),\n\t\t\t\t\t\t\t\tselectedOption.name\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\toptions={ options }\n\t\t\t\t\t\t\tvalue={ selectedOption }\n\t\t\t\t\t\t\tonChange={ ( { selectedItem } ) => {\n\t\t\t\t\t\t\t\tonChangeType( selectedItem.value );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t</BaseControl>\n\t\t\t\t</InspectorControls>\n\t\t\t) : null,\n\t\tnative: null,\n\t} );\n}\n\nexport default {\n\tedit: function Edit( props ) {\n\t\tconst isPositionDisabled = useIsPositionDisabled( props );\n\t\tif ( isPositionDisabled ) {\n\t\t\treturn null;\n\t\t}\n\t\treturn <PositionPanelPure { ...props } />;\n\t},\n\tuseBlockProps,\n\tattributeKeys: [ 'style' ],\n\thasSupport( name ) {\n\t\treturn hasBlockSupport( name, POSITION_SUPPORT_KEY );\n\t},\n};\n\nfunction useBlockProps( { name, style } ) {\n\tconst hasPositionBlockSupport = hasBlockSupport(\n\t\tname,\n\t\tPOSITION_SUPPORT_KEY\n\t);\n\tconst isPositionDisabled = useIsPositionDisabled( { name } );\n\tconst allowPositionStyles = hasPositionBlockSupport && ! isPositionDisabled;\n\n\tconst id = useInstanceId( useBlockProps );\n\n\t// Higher specificity to override defaults in editor UI.\n\tconst positionSelector = `.wp-container-${ id }.wp-container-${ id }`;\n\n\t// Get CSS string for the current position values.\n\tlet css;\n\tif ( allowPositionStyles ) {\n\t\tcss =\n\t\t\tgetPositionCSS( {\n\t\t\t\tselector: positionSelector,\n\t\t\t\tstyle,\n\t\t\t} ) || '';\n\t}\n\n\t// Attach a `wp-container-` id-based class name.\n\tconst className = clsx( {\n\t\t[ `wp-container-${ id }` ]: allowPositionStyles && !! css, // Only attach a container class if there is generated CSS to be attached.\n\t\t[ `is-position-${ style?.position?.type }` ]:\n\t\t\tallowPositionStyles && !! css && !! style?.position?.type,\n\t} );\n\n\tuseStyleOverride( { css } );\n\n\treturn { className };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,EAAE,EAAEC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AACjD,SAASC,eAAe,EAAEC,eAAe,QAAQ,mBAAmB;AACpE,SAASC,WAAW,EAAEC,mBAAmB,QAAQ,uBAAuB;AACxE,SAASC,aAAa,QAAQ,oBAAoB;AAClD,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,OAAO,EAAEC,QAAQ,QAAQ,oBAAoB;;AAEtD;AACA;AACA;AACA,SAASC,WAAW,QAAQ,4BAA4B;AACxD,OAAOC,iBAAiB,MAAM,kCAAkC;AAChE,OAAOC,0BAA0B,MAAM,6CAA6C;AACpF,SAASC,gBAAgB,EAAEC,gBAAgB,QAAQ,SAAS;AAC5D,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,UAAU;AAAC,SAAAC,GAAA,IAA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