@wordpress/block-editor 15.22.1 → 15.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/build/components/block-inspector/index.cjs +18 -35
- package/build/components/block-inspector/index.cjs.map +2 -2
- package/build/components/use-resize-canvas/index.cjs +16 -53
- package/build/components/use-resize-canvas/index.cjs.map +3 -3
- package/build/hooks/states.cjs +13 -21
- package/build/hooks/states.cjs.map +2 -2
- package/build/private-apis.cjs +0 -1
- package/build/private-apis.cjs.map +2 -2
- package/build/store/private-actions.cjs +16 -0
- package/build/store/private-actions.cjs.map +2 -2
- package/build/store/private-keys.cjs +0 -3
- package/build/store/private-keys.cjs.map +2 -2
- package/build/store/private-selectors.cjs +24 -6
- package/build/store/private-selectors.cjs.map +2 -2
- package/build/store/reducer.cjs +19 -3
- package/build/store/reducer.cjs.map +2 -2
- package/build-module/components/block-inspector/index.mjs +18 -35
- package/build-module/components/block-inspector/index.mjs.map +2 -2
- package/build-module/components/use-resize-canvas/index.mjs +6 -53
- package/build-module/components/use-resize-canvas/index.mjs.map +2 -2
- package/build-module/hooks/states.mjs +13 -21
- package/build-module/hooks/states.mjs.map +2 -2
- package/build-module/private-apis.mjs +0 -2
- package/build-module/private-apis.mjs.map +2 -2
- package/build-module/store/private-actions.mjs +14 -0
- package/build-module/store/private-actions.mjs.map +2 -2
- package/build-module/store/private-keys.mjs +0 -2
- package/build-module/store/private-keys.mjs.map +2 -2
- package/build-module/store/private-selectors.mjs +22 -6
- package/build-module/store/private-selectors.mjs.map +2 -2
- package/build-module/store/reducer.mjs +17 -3
- package/build-module/store/reducer.mjs.map +2 -2
- package/package.json +39 -39
- package/src/components/block-inspector/index.js +23 -43
- package/src/components/use-resize-canvas/index.js +10 -71
- package/src/hooks/states.js +30 -26
- package/src/private-apis.js +0 -2
- package/src/store/private-actions.js +31 -0
- package/src/store/private-keys.js +0 -1
- package/src/store/private-selectors.js +43 -7
- package/src/store/reducer.js +37 -2
- package/src/store/test/private-selectors.js +14 -10
- package/src/store/test/reducer.js +30 -2
- package/src/components/use-resize-canvas/README.md +0 -37
package/CHANGELOG.md
CHANGED
|
@@ -61,7 +61,6 @@ var import_content_tab = __toESM(require("../inspector-controls-tabs/content-tab
|
|
|
61
61
|
var import_viewport_visibility_info = __toESM(require("../block-visibility/viewport-visibility-info.cjs"));
|
|
62
62
|
var import_lock_unlock = require("../../lock-unlock.cjs");
|
|
63
63
|
var import_block_style_state = require("../../hooks/block-style-state.cjs");
|
|
64
|
-
var import_private_keys = require("../../store/private-keys.cjs");
|
|
65
64
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
66
65
|
function StyleInspectorSlots({
|
|
67
66
|
blockName,
|
|
@@ -183,7 +182,7 @@ function BlockInspector() {
|
|
|
183
182
|
blockEditingMode,
|
|
184
183
|
selectedBlockStyleState,
|
|
185
184
|
showStateOnCanvas,
|
|
186
|
-
|
|
185
|
+
isResponsiveEditing
|
|
187
186
|
} = (0, import_data.useSelect)((select) => {
|
|
188
187
|
const {
|
|
189
188
|
getSelectedBlockClientId,
|
|
@@ -196,9 +195,9 @@ function BlockInspector() {
|
|
|
196
195
|
isWithinEditedContentOnlySection,
|
|
197
196
|
getBlockEditingMode,
|
|
198
197
|
getSelectedBlockStyleState,
|
|
199
|
-
isSelectedBlockStyleStateShownOnCanvas
|
|
198
|
+
isSelectedBlockStyleStateShownOnCanvas,
|
|
199
|
+
isResponsiveEditing: _isResponsiveEditing
|
|
200
200
|
} = (0, import_lock_unlock.unlock)(select(import_store.store));
|
|
201
|
-
const blockEditorSettings = select(import_store.store).getSettings();
|
|
202
201
|
const { getBlockStyles } = select(import_blocks.store);
|
|
203
202
|
const _selectedBlockClientId = getSelectedBlockClientId();
|
|
204
203
|
const isWithinEditedSection = isWithinEditedContentOnlySection(
|
|
@@ -229,7 +228,7 @@ function BlockInspector() {
|
|
|
229
228
|
showStateOnCanvas: isSelectedBlockStyleStateShownOnCanvas(
|
|
230
229
|
_renderedBlockClientId
|
|
231
230
|
),
|
|
232
|
-
|
|
231
|
+
isResponsiveEditing: _isResponsiveEditing()
|
|
233
232
|
};
|
|
234
233
|
}, []);
|
|
235
234
|
const contentClientIds = (0, import_data.useSelect)(
|
|
@@ -319,7 +318,7 @@ function BlockInspector() {
|
|
|
319
318
|
blockEditingMode,
|
|
320
319
|
selectedBlockStyleState,
|
|
321
320
|
showStateOnCanvas,
|
|
322
|
-
|
|
321
|
+
isResponsiveEditing,
|
|
323
322
|
isBlockStyleStateSelected
|
|
324
323
|
}
|
|
325
324
|
)
|
|
@@ -368,11 +367,13 @@ var BlockInspectorSingleBlock = ({
|
|
|
368
367
|
blockEditingMode,
|
|
369
368
|
selectedBlockStyleState,
|
|
370
369
|
showStateOnCanvas,
|
|
371
|
-
|
|
370
|
+
isResponsiveEditing,
|
|
372
371
|
isBlockStyleStateSelected
|
|
373
372
|
}) => {
|
|
374
373
|
const listViewRef = (0, import_element.useRef)(null);
|
|
375
374
|
const hasMultipleTabs = availableTabs?.length > 1;
|
|
375
|
+
const hasPseudoState = (0, import_block_style_state.hasPseudoBlockStyleState)(selectedBlockStyleState);
|
|
376
|
+
const isEditingStyleState = isBlockStyleStateSelected || isResponsiveEditing;
|
|
376
377
|
const hasParentChildBlockCards = editedContentOnlySection && editedContentOnlySection !== renderedBlockClientId;
|
|
377
378
|
const parentBlockInformation = (0, import_use_block_display_information.default)(
|
|
378
379
|
editedContentOnlySection
|
|
@@ -386,29 +387,10 @@ var BlockInspectorSingleBlock = ({
|
|
|
386
387
|
setSelectedBlockStyleStateCanvasPreview
|
|
387
388
|
} = (0, import_lock_unlock.unlock)((0, import_data.useDispatch)(import_store.store));
|
|
388
389
|
const onBlockStyleStateChange = (value) => {
|
|
389
|
-
|
|
390
|
-
...selectedBlockStyleState,
|
|
391
|
-
...value
|
|
392
|
-
};
|
|
393
|
-
setSelectedBlockStyleState(
|
|
394
|
-
renderedBlockClientId,
|
|
395
|
-
nextSelectedBlockStyleState
|
|
396
|
-
);
|
|
397
|
-
if (value.viewport) {
|
|
398
|
-
onViewportStateChange?.({
|
|
399
|
-
viewport: nextSelectedBlockStyleState.viewport,
|
|
400
|
-
showStateOnCanvas
|
|
401
|
-
});
|
|
402
|
-
}
|
|
390
|
+
setSelectedBlockStyleState(renderedBlockClientId, value);
|
|
403
391
|
};
|
|
404
392
|
const onShowStateOnCanvasChange = (value) => {
|
|
405
393
|
setSelectedBlockStyleStateCanvasPreview(renderedBlockClientId, value);
|
|
406
|
-
if (value) {
|
|
407
|
-
onViewportStateChange?.({
|
|
408
|
-
viewport: selectedBlockStyleState.viewport,
|
|
409
|
-
showStateOnCanvas: value
|
|
410
|
-
});
|
|
411
|
-
}
|
|
412
394
|
};
|
|
413
395
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "block-editor-block-inspector", children: [
|
|
414
396
|
hasParentChildBlockCards && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
@@ -437,8 +419,8 @@ var BlockInspectorSingleBlock = ({
|
|
|
437
419
|
)
|
|
438
420
|
}
|
|
439
421
|
),
|
|
440
|
-
blockEditingMode === "default" &&
|
|
441
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
422
|
+
blockEditingMode === "default" && isEditingStyleState && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_components.__experimentalSpacer, { paddingX: 4, paddingY: 2, children: [
|
|
423
|
+
hasPseudoState && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
442
424
|
import_components.ToggleControl,
|
|
443
425
|
{
|
|
444
426
|
label: (0, import_i18n.__)("Show state on canvas"),
|
|
@@ -450,27 +432,28 @@ var BlockInspectorSingleBlock = ({
|
|
|
450
432
|
import_states.BlockStateBadges,
|
|
451
433
|
{
|
|
452
434
|
name: blockName,
|
|
453
|
-
value: selectedBlockStyleState
|
|
435
|
+
value: selectedBlockStyleState,
|
|
436
|
+
isResponsiveEditing
|
|
454
437
|
}
|
|
455
438
|
)
|
|
456
439
|
] }),
|
|
457
440
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_viewport_visibility_info.default, { clientId: renderedBlockClientId }),
|
|
458
441
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_edit_contents.default, { clientId: renderedBlockClientId }),
|
|
459
|
-
!
|
|
442
|
+
!isEditingStyleState && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
460
443
|
import_block_variation_transforms.default,
|
|
461
444
|
{
|
|
462
445
|
blockClientId: renderedBlockClientId
|
|
463
446
|
}
|
|
464
447
|
),
|
|
465
448
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_inspector_pre_tabs_slot_fill.BlockInspectorPreTabsSlot, {}),
|
|
466
|
-
|
|
449
|
+
isEditingStyleState && !isSectionBlock && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
467
450
|
StyleStateInspectorSlots,
|
|
468
451
|
{
|
|
469
452
|
blockName,
|
|
470
453
|
selectedBlockStyleState
|
|
471
454
|
}
|
|
472
455
|
),
|
|
473
|
-
!
|
|
456
|
+
!isEditingStyleState && hasMultipleTabs && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
474
457
|
import_inspector_controls_tabs.default,
|
|
475
458
|
{
|
|
476
459
|
hasBlockStyles,
|
|
@@ -481,7 +464,7 @@ var BlockInspectorSingleBlock = ({
|
|
|
481
464
|
contentClientIds
|
|
482
465
|
}
|
|
483
466
|
) }),
|
|
484
|
-
!
|
|
467
|
+
!isEditingStyleState && !hasMultipleTabs && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
485
468
|
hasBlockStyles && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_block_styles.default, { clientId: renderedBlockClientId }),
|
|
486
469
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_content_tab.default, { contentClientIds }),
|
|
487
470
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_inspector_controls.default.Slot, { group: "content" }),
|
|
@@ -489,7 +472,7 @@ var BlockInspectorSingleBlock = ({
|
|
|
489
472
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_list_view_content_popover.ListViewContentPopover, { listViewRef }),
|
|
490
473
|
!isSectionBlock && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StyleInspectorSlots, { blockName })
|
|
491
474
|
] }),
|
|
492
|
-
!
|
|
475
|
+
!isEditingStyleState && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_last_item.default.Slot, {}),
|
|
493
476
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_skip_to_selected_block.default, {}, "back")
|
|
494
477
|
] });
|
|
495
478
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/block-inspector/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tgetBlockType,\n\tgetUnregisteredTypeHandlerName,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\nimport {\n\tToggleControl,\n\t__experimentalSpacer as Spacer,\n\t__unstableMotion as motion,\n} from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport EditContents from './edit-contents';\nimport SkipToSelectedBlock from '../skip-to-selected-block';\nimport BlockCard from '../block-card';\nimport MultiSelectionInspector from '../multi-selection-inspector';\nimport BlockVariationTransforms from '../block-variation-transforms';\nimport useBlockDisplayInformation from '../use-block-display-information';\nimport { store as blockEditorStore } from '../../store';\nimport BlockStyles from '../block-styles';\nimport { ListViewContentPopover } from '../inspector-controls/list-view-content-popover';\nimport InspectorControls from '../inspector-controls';\nimport { BlockInspectorPreTabsSlot } from './inspector-pre-tabs-slot-fill';\nimport { default as InspectorControlsTabs } from '../inspector-controls-tabs';\nimport useInspectorControlsTabs from '../inspector-controls-tabs/use-inspector-controls-tabs';\nimport InspectorControlsLastItem from '../inspector-controls/last-item';\nimport AdvancedControls from '../inspector-controls-tabs/advanced-controls-panel';\nimport PositionControls from '../inspector-controls-tabs/position-controls-panel';\nimport useBlockInspectorAnimationSettings from './useBlockInspectorAnimationSettings';\nimport { useBorderPanelLabel } from '../../hooks/border';\nimport { BlockStateBadges, BlockStatesControl } from '../../hooks/states';\nimport ContentTab from '../inspector-controls-tabs/content-tab';\nimport ViewportVisibilityInfo from '../block-visibility/viewport-visibility-info';\nimport { unlock } from '../../lock-unlock';\nimport {\n\thasPseudoBlockStyleState,\n\thasViewportBlockStyleState,\n\tisDefaultBlockStyleState,\n} from '../../hooks/block-style-state';\nimport { onViewportStateChangeKey } from '../../store/private-keys';\n\nfunction StyleInspectorSlots( {\n\tblockName,\n\tshowAdvancedControls = true,\n\tshowPositionControls = true,\n\tshowBindingsControls = true,\n} ) {\n\tconst borderPanelLabel = useBorderPanelLabel( { blockName } );\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls.Slot />\n\t\t\t<InspectorControls.Slot\n\t\t\t\tgroup=\"typography\"\n\t\t\t\tlabel={ __( 'Typography' ) }\n\t\t\t/>\n\t\t\t<InspectorControls.Slot\n\t\t\t\tgroup=\"color\"\n\t\t\t\tlabel={ __( 'Color' ) }\n\t\t\t\tclassName=\"color-block-support-panel__inner-wrapper\"\n\t\t\t/>\n\t\t\t<InspectorControls.Slot\n\t\t\t\tgroup=\"background\"\n\t\t\t\tlabel={ __( 'Background' ) }\n\t\t\t\tclassName=\"background-block-support-panel__inner-wrapper\"\n\t\t\t/>\n\t\t\t<InspectorControls.Slot group=\"layout\" label={ __( 'Layout' ) } />\n\t\t\t<InspectorControls.Slot\n\t\t\t\tgroup=\"dimensions\"\n\t\t\t\tlabel={ __( 'Dimensions' ) }\n\t\t\t/>\n\t\t\t<InspectorControls.Slot group=\"border\" label={ borderPanelLabel } />\n\t\t\t<InspectorControls.Slot\n\t\t\t\tgroup=\"elements\"\n\t\t\t\tlabel={ __( 'Elements' ) }\n\t\t\t\tclassName=\"elements-block-support-panel__inner-wrapper\"\n\t\t\t/>\n\t\t\t{ showPositionControls && <PositionControls /> }\n\t\t\t<InspectorControls.Slot group=\"styles\" />\n\t\t\t{ showBindingsControls && (\n\t\t\t\t<InspectorControls.Slot group=\"bindings\" />\n\t\t\t) }\n\t\t\t{ showAdvancedControls && (\n\t\t\t\t<div>\n\t\t\t\t\t<AdvancedControls />\n\t\t\t\t</div>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nfunction StyleStateInspectorSlots( { blockName, selectedBlockStyleState } ) {\n\tconst borderPanelLabel = useBorderPanelLabel( { blockName } );\n\tconst showLayoutControls =\n\t\thasViewportBlockStyleState( selectedBlockStyleState ) &&\n\t\t! hasPseudoBlockStyleState( selectedBlockStyleState );\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls.Slot\n\t\t\t\tgroup=\"typography\"\n\t\t\t\tlabel={ __( 'Typography' ) }\n\t\t\t/>\n\t\t\t<InspectorControls.Slot\n\t\t\t\tgroup=\"color\"\n\t\t\t\tlabel={ __( 'Color' ) }\n\t\t\t\tclassName=\"color-block-support-panel__inner-wrapper\"\n\t\t\t/>\n\t\t\t<InspectorControls.Slot\n\t\t\t\tgroup=\"background\"\n\t\t\t\tlabel={ __( 'Background' ) }\n\t\t\t\tclassName=\"background-block-support-panel__inner-wrapper\"\n\t\t\t/>\n\t\t\t{ showLayoutControls && (\n\t\t\t\t<InspectorControls.Slot\n\t\t\t\t\tgroup=\"layout\"\n\t\t\t\t\tlabel={ __( 'Layout' ) }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t<InspectorControls.Slot\n\t\t\t\tgroup=\"dimensions\"\n\t\t\t\tlabel={ __( 'Dimensions' ) }\n\t\t\t/>\n\t\t\t<InspectorControls.Slot group=\"border\" label={ borderPanelLabel } />\n\t\t\t<InspectorControls.Slot\n\t\t\t\tgroup=\"elements\"\n\t\t\t\tlabel={ __( 'Elements' ) }\n\t\t\t\tclassName=\"elements-block-support-panel__inner-wrapper\"\n\t\t\t/>\n\t\t</>\n\t);\n}\n\nfunction BlockInspector() {\n\tconst {\n\t\tselectedBlockCount,\n\t\trenderedBlockName,\n\t\trenderedBlockClientId,\n\t\tblockType,\n\t\tisSectionBlock,\n\t\tisSectionBlockInSelection,\n\t\thasBlockStyles,\n\t\teditedContentOnlySection,\n\t\tblockEditingMode,\n\t\tselectedBlockStyleState,\n\t\tshowStateOnCanvas,\n\t\tonViewportStateChange,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetSelectedBlockClientId,\n\t\t\tgetSelectedBlockClientIds,\n\t\t\tgetSelectedBlockCount,\n\t\t\tgetBlockName,\n\t\t\tgetParentSectionBlock,\n\t\t\tisSectionBlock: _isSectionBlock,\n\t\t\tgetEditedContentOnlySection,\n\t\t\tisWithinEditedContentOnlySection,\n\t\t\tgetBlockEditingMode,\n\t\t\tgetSelectedBlockStyleState,\n\t\t\tisSelectedBlockStyleStateShownOnCanvas,\n\t\t} = unlock( select( blockEditorStore ) );\n\t\tconst blockEditorSettings = select( blockEditorStore ).getSettings();\n\t\tconst { getBlockStyles } = select( blocksStore );\n\t\tconst _selectedBlockClientId = getSelectedBlockClientId();\n\t\tconst isWithinEditedSection = isWithinEditedContentOnlySection(\n\t\t\t_selectedBlockClientId\n\t\t);\n\t\tconst _renderedBlockClientId = isWithinEditedSection\n\t\t\t? _selectedBlockClientId\n\t\t\t: getParentSectionBlock( _selectedBlockClientId ) ||\n\t\t\t _selectedBlockClientId;\n\t\tconst _renderedBlockName =\n\t\t\t_renderedBlockClientId && getBlockName( _renderedBlockClientId );\n\t\tconst _blockType =\n\t\t\t_renderedBlockName && getBlockType( _renderedBlockName );\n\t\tconst selectedBlockClientIds = getSelectedBlockClientIds();\n\t\tconst _isSectionBlockInSelection = selectedBlockClientIds.some(\n\t\t\t( id ) => _isSectionBlock( id )\n\t\t);\n\t\tconst blockStyles =\n\t\t\t_renderedBlockName && getBlockStyles( _renderedBlockName );\n\t\tconst _hasBlockStyles = blockStyles && blockStyles.length > 0;\n\n\t\treturn {\n\t\t\tselectedBlockCount: getSelectedBlockCount(),\n\t\t\trenderedBlockClientId: _renderedBlockClientId,\n\t\t\trenderedBlockName: _renderedBlockName,\n\t\t\tblockType: _blockType,\n\t\t\tisSectionBlockInSelection: _isSectionBlockInSelection,\n\t\t\tisSectionBlock: _isSectionBlock( _renderedBlockClientId ),\n\t\t\thasBlockStyles: _hasBlockStyles,\n\t\t\teditedContentOnlySection: getEditedContentOnlySection(),\n\t\t\tblockEditingMode: getBlockEditingMode( _renderedBlockClientId ),\n\t\t\tselectedBlockStyleState: getSelectedBlockStyleState(\n\t\t\t\t_renderedBlockClientId\n\t\t\t),\n\t\t\tshowStateOnCanvas: isSelectedBlockStyleStateShownOnCanvas(\n\t\t\t\t_renderedBlockClientId\n\t\t\t),\n\t\t\tonViewportStateChange:\n\t\t\t\tblockEditorSettings?.[ onViewportStateChangeKey ],\n\t\t};\n\t}, [] );\n\n\t// Separate useSelect for contentClientIds with proper dependencies\n\tconst contentClientIds = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! isSectionBlock || ! renderedBlockClientId ) {\n\t\t\t\treturn [];\n\t\t\t}\n\n\t\t\tconst {\n\t\t\t\tgetClientIdsOfDescendants,\n\t\t\t\tgetBlockEditingMode,\n\t\t\t\tshouldRenderBlockListView,\n\t\t\t} = unlock( select( blockEditorStore ) );\n\n\t\t\tconst descendants = getClientIdsOfDescendants(\n\t\t\t\trenderedBlockClientId\n\t\t\t);\n\n\t\t\t// Exclude items from the content tab that are already present in the\n\t\t\t// List View tab.\n\t\t\tconst listViewDescendants = new Set();\n\t\t\tdescendants.forEach( ( clientId ) => {\n\t\t\t\tif ( shouldRenderBlockListView( clientId ) ) {\n\t\t\t\t\tconst listViewChildren =\n\t\t\t\t\t\tgetClientIdsOfDescendants( clientId );\n\t\t\t\t\tlistViewChildren.forEach( ( childId ) =>\n\t\t\t\t\t\tlistViewDescendants.add( childId )\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t} );\n\n\t\t\treturn descendants.filter( ( current ) => {\n\t\t\t\treturn (\n\t\t\t\t\t! listViewDescendants.has( current ) &&\n\t\t\t\t\tgetBlockEditingMode( current ) === 'contentOnly'\n\t\t\t\t);\n\t\t\t} );\n\t\t},\n\t\t[ isSectionBlock, renderedBlockClientId ]\n\t);\n\n\tconst availableTabs = useInspectorControlsTabs(\n\t\tblockType?.name,\n\t\tcontentClientIds,\n\t\tisSectionBlock,\n\t\thasBlockStyles\n\t);\n\tconst hasMultipleTabs = availableTabs?.length > 1;\n\n\t// The block inspector animation settings will be completely\n\t// removed in the future to create an API which allows the block\n\t// inspector to transition between what it\n\t// displays based on the relationship between the selected block\n\t// and its parent, and only enable it if the parent is controlling\n\t// its children blocks.\n\tconst blockInspectorAnimationSettings =\n\t\tuseBlockInspectorAnimationSettings( blockType );\n\n\tconst hasSelectedBlocks = selectedBlockCount > 1;\n\tconst isBlockStyleStateSelected = ! isDefaultBlockStyleState(\n\t\tselectedBlockStyleState\n\t);\n\n\tif ( hasSelectedBlocks && ! isSectionBlockInSelection ) {\n\t\treturn (\n\t\t\t<div className=\"block-editor-block-inspector\">\n\t\t\t\t<MultiSelectionInspector />\n\t\t\t\t{ hasMultipleTabs ? (\n\t\t\t\t\t<InspectorControlsTabs tabs={ availableTabs } />\n\t\t\t\t) : (\n\t\t\t\t\t<StyleInspectorSlots\n\t\t\t\t\t\tblockName={ renderedBlockName }\n\t\t\t\t\t\tshowAdvancedControls={ false }\n\t\t\t\t\t\tshowPositionControls={ false }\n\t\t\t\t\t\tshowBindingsControls={ false }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t);\n\t}\n\n\tif ( hasSelectedBlocks && isSectionBlockInSelection ) {\n\t\treturn (\n\t\t\t<div className=\"block-editor-block-inspector\">\n\t\t\t\t<MultiSelectionInspector />\n\t\t\t</div>\n\t\t);\n\t}\n\n\tconst isRenderedBlockUnregistered =\n\t\trenderedBlockName === getUnregisteredTypeHandlerName();\n\n\t/*\n\t * If the rendered block is of an unregistered type, avoid showing it as an actual selection\n\t * because we want the user to focus on the unregistered block warning, not block settings.\n\t */\n\tconst shouldShowWarning =\n\t\t! blockType || ! renderedBlockClientId || isRenderedBlockUnregistered;\n\n\tif ( shouldShowWarning ) {\n\t\treturn (\n\t\t\t<span className=\"block-editor-block-inspector__no-blocks\">\n\t\t\t\t{ __( 'No block selected.' ) }\n\t\t\t</span>\n\t\t);\n\t}\n\n\treturn (\n\t\t<BlockInspectorSingleBlockWrapper\n\t\t\tanimate={ blockInspectorAnimationSettings }\n\t\t\twrapper={ ( children ) => (\n\t\t\t\t<AnimatedContainer\n\t\t\t\t\tblockInspectorAnimationSettings={\n\t\t\t\t\t\tblockInspectorAnimationSettings\n\t\t\t\t\t}\n\t\t\t\t\trenderedBlockClientId={ renderedBlockClientId }\n\t\t\t\t>\n\t\t\t\t\t{ children }\n\t\t\t\t</AnimatedContainer>\n\t\t\t) }\n\t\t>\n\t\t\t<BlockInspectorSingleBlock\n\t\t\t\trenderedBlockClientId={ renderedBlockClientId }\n\t\t\t\tblockName={ blockType.name }\n\t\t\t\tisSectionBlock={ isSectionBlock }\n\t\t\t\tavailableTabs={ availableTabs }\n\t\t\t\tcontentClientIds={ contentClientIds }\n\t\t\t\thasBlockStyles={ hasBlockStyles }\n\t\t\t\teditedContentOnlySection={ editedContentOnlySection }\n\t\t\t\tblockEditingMode={ blockEditingMode }\n\t\t\t\tselectedBlockStyleState={ selectedBlockStyleState }\n\t\t\t\tshowStateOnCanvas={ showStateOnCanvas }\n\t\t\t\tonViewportStateChange={ onViewportStateChange }\n\t\t\t\tisBlockStyleStateSelected={ isBlockStyleStateSelected }\n\t\t\t/>\n\t\t</BlockInspectorSingleBlockWrapper>\n\t);\n}\n\nconst BlockInspectorSingleBlockWrapper = ( { animate, wrapper, children } ) => {\n\treturn animate ? wrapper( children ) : children;\n};\n\nconst AnimatedContainer = ( {\n\tblockInspectorAnimationSettings,\n\trenderedBlockClientId,\n\tchildren,\n} ) => {\n\tconst animationOrigin =\n\t\tblockInspectorAnimationSettings &&\n\t\tblockInspectorAnimationSettings.enterDirection === 'leftToRight'\n\t\t\t? -50\n\t\t\t: 50;\n\n\treturn (\n\t\t<motion.div\n\t\t\tanimate={ {\n\t\t\t\tx: 0,\n\t\t\t\topacity: 1,\n\t\t\t\ttransition: {\n\t\t\t\t\tease: 'easeInOut',\n\t\t\t\t\tduration: 0.14,\n\t\t\t\t},\n\t\t\t} }\n\t\t\tinitial={ {\n\t\t\t\tx: animationOrigin,\n\t\t\t\topacity: 0,\n\t\t\t} }\n\t\t\tkey={ renderedBlockClientId }\n\t\t>\n\t\t\t{ children }\n\t\t</motion.div>\n\t);\n};\n\nconst BlockInspectorSingleBlock = ( {\n\t// The block that is displayed in the inspector. This is the block whose\n\t// controls and information are shown to the user.\n\trenderedBlockClientId,\n\tblockName,\n\tisSectionBlock,\n\tavailableTabs,\n\tcontentClientIds,\n\thasBlockStyles,\n\teditedContentOnlySection,\n\tblockEditingMode,\n\tselectedBlockStyleState,\n\tshowStateOnCanvas,\n\tonViewportStateChange,\n\tisBlockStyleStateSelected,\n} ) => {\n\tconst listViewRef = useRef( null );\n\tconst hasMultipleTabs = availableTabs?.length > 1;\n\tconst hasParentChildBlockCards =\n\t\teditedContentOnlySection &&\n\t\teditedContentOnlySection !== renderedBlockClientId;\n\tconst parentBlockInformation = useBlockDisplayInformation(\n\t\teditedContentOnlySection\n\t);\n\tconst blockInformation = useBlockDisplayInformation(\n\t\trenderedBlockClientId\n\t);\n\tconst isBlockSynced = blockInformation.isSynced;\n\tconst {\n\t\tsetSelectedBlockStyleState,\n\t\tsetSelectedBlockStyleStateCanvasPreview,\n\t} = unlock( useDispatch( blockEditorStore ) );\n\tconst onBlockStyleStateChange = ( value ) => {\n\t\tconst nextSelectedBlockStyleState = {\n\t\t\t...selectedBlockStyleState,\n\t\t\t...value,\n\t\t};\n\n\t\tsetSelectedBlockStyleState(\n\t\t\trenderedBlockClientId,\n\t\t\tnextSelectedBlockStyleState\n\t\t);\n\n\t\tif ( value.viewport ) {\n\t\t\tonViewportStateChange?.( {\n\t\t\t\tviewport: nextSelectedBlockStyleState.viewport,\n\t\t\t\tshowStateOnCanvas,\n\t\t\t} );\n\t\t}\n\t};\n\tconst onShowStateOnCanvasChange = ( value ) => {\n\t\tsetSelectedBlockStyleStateCanvasPreview( renderedBlockClientId, value );\n\n\t\tif ( value ) {\n\t\t\tonViewportStateChange?.( {\n\t\t\t\tviewport: selectedBlockStyleState.viewport,\n\t\t\t\tshowStateOnCanvas: value,\n\t\t\t} );\n\t\t}\n\t};\n\n\treturn (\n\t\t<div className=\"block-editor-block-inspector\">\n\t\t\t{ hasParentChildBlockCards && (\n\t\t\t\t<BlockCard\n\t\t\t\t\t{ ...parentBlockInformation }\n\t\t\t\t\tclassName={\n\t\t\t\t\t\tparentBlockInformation?.isSynced && 'is-synced'\n\t\t\t\t\t}\n\t\t\t\t\tparentClientId={ editedContentOnlySection }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t<BlockCard\n\t\t\t\t{ ...blockInformation }\n\t\t\t\tallowParentNavigation\n\t\t\t\tclassName={ isBlockSynced && 'is-synced' }\n\t\t\t\tisChild={ hasParentChildBlockCards }\n\t\t\t\tclientId={ renderedBlockClientId }\n\t\t\t\tcontrols={\n\t\t\t\t\tblockEditingMode === 'default' && (\n\t\t\t\t\t\t<BlockStatesControl\n\t\t\t\t\t\t\tname={ blockName }\n\t\t\t\t\t\t\tvalue={ selectedBlockStyleState }\n\t\t\t\t\t\t\tonChange={ onBlockStyleStateChange }\n\t\t\t\t\t\t/>\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t/>\n\t\t\t{ blockEditingMode === 'default' && isBlockStyleStateSelected && (\n\t\t\t\t<Spacer paddingX={ 4 } paddingY={ 2 }>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\tlabel={ __( 'Show state on canvas' ) }\n\t\t\t\t\t\tchecked={ showStateOnCanvas }\n\t\t\t\t\t\tonChange={ onShowStateOnCanvasChange }\n\t\t\t\t\t/>\n\t\t\t\t\t<BlockStateBadges\n\t\t\t\t\t\tname={ blockName }\n\t\t\t\t\t\tvalue={ selectedBlockStyleState }\n\t\t\t\t\t/>\n\t\t\t\t</Spacer>\n\t\t\t) }\n\t\t\t<ViewportVisibilityInfo clientId={ renderedBlockClientId } />\n\t\t\t<EditContents clientId={ renderedBlockClientId } />\n\t\t\t{ ! isBlockStyleStateSelected && (\n\t\t\t\t<BlockVariationTransforms\n\t\t\t\t\tblockClientId={ renderedBlockClientId }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t<BlockInspectorPreTabsSlot />\n\t\t\t{ isBlockStyleStateSelected && ! isSectionBlock && (\n\t\t\t\t<StyleStateInspectorSlots\n\t\t\t\t\tblockName={ blockName }\n\t\t\t\t\tselectedBlockStyleState={ selectedBlockStyleState }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ ! isBlockStyleStateSelected && hasMultipleTabs && (\n\t\t\t\t<>\n\t\t\t\t\t<InspectorControlsTabs\n\t\t\t\t\t\thasBlockStyles={ hasBlockStyles }\n\t\t\t\t\t\tclientId={ renderedBlockClientId }\n\t\t\t\t\t\tblockName={ blockName }\n\t\t\t\t\t\ttabs={ availableTabs }\n\t\t\t\t\t\tisSectionBlock={ isSectionBlock }\n\t\t\t\t\t\tcontentClientIds={ contentClientIds }\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t) }\n\t\t\t{ ! isBlockStyleStateSelected && ! hasMultipleTabs && (\n\t\t\t\t<>\n\t\t\t\t\t{ hasBlockStyles && (\n\t\t\t\t\t\t<BlockStyles clientId={ renderedBlockClientId } />\n\t\t\t\t\t) }\n\t\t\t\t\t<ContentTab contentClientIds={ contentClientIds } />\n\t\t\t\t\t<InspectorControls.Slot group=\"content\" />\n\t\t\t\t\t<InspectorControls.Slot group=\"list\" ref={ listViewRef } />\n\t\t\t\t\t<ListViewContentPopover listViewRef={ listViewRef } />\n\t\t\t\t\t{ ! isSectionBlock && (\n\t\t\t\t\t\t<StyleInspectorSlots blockName={ blockName } />\n\t\t\t\t\t) }\n\t\t\t\t</>\n\t\t\t) }\n\t\t\t{ ! isBlockStyleStateSelected && (\n\t\t\t\t<InspectorControlsLastItem.Slot />\n\t\t\t) }\n\t\t\t<SkipToSelectedBlock key=\"back\" />\n\t\t</div>\n\t);\n};\n\n/**\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-inspector/README.md\n */\nexport default BlockInspector;\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAmB;AACnB,oBAIO;AACP,wBAIO;AACP,kBAAuC;AACvC,qBAAuB;AAKvB,2BAAyB;AACzB,oCAAgC;AAChC,wBAAsB;AACtB,uCAAoC;AACpC,wCAAqC;AACrC,2CAAuC;AACvC,mBAA0C;AAC1C,0BAAwB;AACxB,uCAAuC;AACvC,gCAA8B;AAC9B,0CAA0C;AAC1C,qCAAiD;AACjD,yCAAqC;AACrC,uBAAsC;AACtC,qCAA6B;AAC7B,qCAA6B;AAC7B,gDAA+C;AAC/C,oBAAoC;AACpC,oBAAqD;AACrD,yBAAuB;AACvB,sCAAmC;AACnC,yBAAuB;AACvB,+BAIO;
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tgetBlockType,\n\tgetUnregisteredTypeHandlerName,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\nimport {\n\tToggleControl,\n\t__experimentalSpacer as Spacer,\n\t__unstableMotion as motion,\n} from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport EditContents from './edit-contents';\nimport SkipToSelectedBlock from '../skip-to-selected-block';\nimport BlockCard from '../block-card';\nimport MultiSelectionInspector from '../multi-selection-inspector';\nimport BlockVariationTransforms from '../block-variation-transforms';\nimport useBlockDisplayInformation from '../use-block-display-information';\nimport { store as blockEditorStore } from '../../store';\nimport BlockStyles from '../block-styles';\nimport { ListViewContentPopover } from '../inspector-controls/list-view-content-popover';\nimport InspectorControls from '../inspector-controls';\nimport { BlockInspectorPreTabsSlot } from './inspector-pre-tabs-slot-fill';\nimport { default as InspectorControlsTabs } from '../inspector-controls-tabs';\nimport useInspectorControlsTabs from '../inspector-controls-tabs/use-inspector-controls-tabs';\nimport InspectorControlsLastItem from '../inspector-controls/last-item';\nimport AdvancedControls from '../inspector-controls-tabs/advanced-controls-panel';\nimport PositionControls from '../inspector-controls-tabs/position-controls-panel';\nimport useBlockInspectorAnimationSettings from './useBlockInspectorAnimationSettings';\nimport { useBorderPanelLabel } from '../../hooks/border';\nimport { BlockStateBadges, BlockStatesControl } from '../../hooks/states';\nimport ContentTab from '../inspector-controls-tabs/content-tab';\nimport ViewportVisibilityInfo from '../block-visibility/viewport-visibility-info';\nimport { unlock } from '../../lock-unlock';\nimport {\n\thasPseudoBlockStyleState,\n\thasViewportBlockStyleState,\n\tisDefaultBlockStyleState,\n} from '../../hooks/block-style-state';\n\nfunction StyleInspectorSlots( {\n\tblockName,\n\tshowAdvancedControls = true,\n\tshowPositionControls = true,\n\tshowBindingsControls = true,\n} ) {\n\tconst borderPanelLabel = useBorderPanelLabel( { blockName } );\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls.Slot />\n\t\t\t<InspectorControls.Slot\n\t\t\t\tgroup=\"typography\"\n\t\t\t\tlabel={ __( 'Typography' ) }\n\t\t\t/>\n\t\t\t<InspectorControls.Slot\n\t\t\t\tgroup=\"color\"\n\t\t\t\tlabel={ __( 'Color' ) }\n\t\t\t\tclassName=\"color-block-support-panel__inner-wrapper\"\n\t\t\t/>\n\t\t\t<InspectorControls.Slot\n\t\t\t\tgroup=\"background\"\n\t\t\t\tlabel={ __( 'Background' ) }\n\t\t\t\tclassName=\"background-block-support-panel__inner-wrapper\"\n\t\t\t/>\n\t\t\t<InspectorControls.Slot group=\"layout\" label={ __( 'Layout' ) } />\n\t\t\t<InspectorControls.Slot\n\t\t\t\tgroup=\"dimensions\"\n\t\t\t\tlabel={ __( 'Dimensions' ) }\n\t\t\t/>\n\t\t\t<InspectorControls.Slot group=\"border\" label={ borderPanelLabel } />\n\t\t\t<InspectorControls.Slot\n\t\t\t\tgroup=\"elements\"\n\t\t\t\tlabel={ __( 'Elements' ) }\n\t\t\t\tclassName=\"elements-block-support-panel__inner-wrapper\"\n\t\t\t/>\n\t\t\t{ showPositionControls && <PositionControls /> }\n\t\t\t<InspectorControls.Slot group=\"styles\" />\n\t\t\t{ showBindingsControls && (\n\t\t\t\t<InspectorControls.Slot group=\"bindings\" />\n\t\t\t) }\n\t\t\t{ showAdvancedControls && (\n\t\t\t\t<div>\n\t\t\t\t\t<AdvancedControls />\n\t\t\t\t</div>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nfunction StyleStateInspectorSlots( { blockName, selectedBlockStyleState } ) {\n\tconst borderPanelLabel = useBorderPanelLabel( { blockName } );\n\tconst showLayoutControls =\n\t\thasViewportBlockStyleState( selectedBlockStyleState ) &&\n\t\t! hasPseudoBlockStyleState( selectedBlockStyleState );\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls.Slot\n\t\t\t\tgroup=\"typography\"\n\t\t\t\tlabel={ __( 'Typography' ) }\n\t\t\t/>\n\t\t\t<InspectorControls.Slot\n\t\t\t\tgroup=\"color\"\n\t\t\t\tlabel={ __( 'Color' ) }\n\t\t\t\tclassName=\"color-block-support-panel__inner-wrapper\"\n\t\t\t/>\n\t\t\t<InspectorControls.Slot\n\t\t\t\tgroup=\"background\"\n\t\t\t\tlabel={ __( 'Background' ) }\n\t\t\t\tclassName=\"background-block-support-panel__inner-wrapper\"\n\t\t\t/>\n\t\t\t{ showLayoutControls && (\n\t\t\t\t<InspectorControls.Slot\n\t\t\t\t\tgroup=\"layout\"\n\t\t\t\t\tlabel={ __( 'Layout' ) }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t<InspectorControls.Slot\n\t\t\t\tgroup=\"dimensions\"\n\t\t\t\tlabel={ __( 'Dimensions' ) }\n\t\t\t/>\n\t\t\t<InspectorControls.Slot group=\"border\" label={ borderPanelLabel } />\n\t\t\t<InspectorControls.Slot\n\t\t\t\tgroup=\"elements\"\n\t\t\t\tlabel={ __( 'Elements' ) }\n\t\t\t\tclassName=\"elements-block-support-panel__inner-wrapper\"\n\t\t\t/>\n\t\t</>\n\t);\n}\n\nfunction BlockInspector() {\n\tconst {\n\t\tselectedBlockCount,\n\t\trenderedBlockName,\n\t\trenderedBlockClientId,\n\t\tblockType,\n\t\tisSectionBlock,\n\t\tisSectionBlockInSelection,\n\t\thasBlockStyles,\n\t\teditedContentOnlySection,\n\t\tblockEditingMode,\n\t\tselectedBlockStyleState,\n\t\tshowStateOnCanvas,\n\t\tisResponsiveEditing,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetSelectedBlockClientId,\n\t\t\tgetSelectedBlockClientIds,\n\t\t\tgetSelectedBlockCount,\n\t\t\tgetBlockName,\n\t\t\tgetParentSectionBlock,\n\t\t\tisSectionBlock: _isSectionBlock,\n\t\t\tgetEditedContentOnlySection,\n\t\t\tisWithinEditedContentOnlySection,\n\t\t\tgetBlockEditingMode,\n\t\t\tgetSelectedBlockStyleState,\n\t\t\tisSelectedBlockStyleStateShownOnCanvas,\n\t\t\tisResponsiveEditing: _isResponsiveEditing,\n\t\t} = unlock( select( blockEditorStore ) );\n\t\tconst { getBlockStyles } = select( blocksStore );\n\t\tconst _selectedBlockClientId = getSelectedBlockClientId();\n\t\tconst isWithinEditedSection = isWithinEditedContentOnlySection(\n\t\t\t_selectedBlockClientId\n\t\t);\n\t\tconst _renderedBlockClientId = isWithinEditedSection\n\t\t\t? _selectedBlockClientId\n\t\t\t: getParentSectionBlock( _selectedBlockClientId ) ||\n\t\t\t _selectedBlockClientId;\n\t\tconst _renderedBlockName =\n\t\t\t_renderedBlockClientId && getBlockName( _renderedBlockClientId );\n\t\tconst _blockType =\n\t\t\t_renderedBlockName && getBlockType( _renderedBlockName );\n\t\tconst selectedBlockClientIds = getSelectedBlockClientIds();\n\t\tconst _isSectionBlockInSelection = selectedBlockClientIds.some(\n\t\t\t( id ) => _isSectionBlock( id )\n\t\t);\n\t\tconst blockStyles =\n\t\t\t_renderedBlockName && getBlockStyles( _renderedBlockName );\n\t\tconst _hasBlockStyles = blockStyles && blockStyles.length > 0;\n\n\t\treturn {\n\t\t\tselectedBlockCount: getSelectedBlockCount(),\n\t\t\trenderedBlockClientId: _renderedBlockClientId,\n\t\t\trenderedBlockName: _renderedBlockName,\n\t\t\tblockType: _blockType,\n\t\t\tisSectionBlockInSelection: _isSectionBlockInSelection,\n\t\t\tisSectionBlock: _isSectionBlock( _renderedBlockClientId ),\n\t\t\thasBlockStyles: _hasBlockStyles,\n\t\t\teditedContentOnlySection: getEditedContentOnlySection(),\n\t\t\tblockEditingMode: getBlockEditingMode( _renderedBlockClientId ),\n\t\t\tselectedBlockStyleState: getSelectedBlockStyleState(\n\t\t\t\t_renderedBlockClientId\n\t\t\t),\n\t\t\tshowStateOnCanvas: isSelectedBlockStyleStateShownOnCanvas(\n\t\t\t\t_renderedBlockClientId\n\t\t\t),\n\t\t\tisResponsiveEditing: _isResponsiveEditing(),\n\t\t};\n\t}, [] );\n\n\t// Separate useSelect for contentClientIds with proper dependencies\n\tconst contentClientIds = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! isSectionBlock || ! renderedBlockClientId ) {\n\t\t\t\treturn [];\n\t\t\t}\n\n\t\t\tconst {\n\t\t\t\tgetClientIdsOfDescendants,\n\t\t\t\tgetBlockEditingMode,\n\t\t\t\tshouldRenderBlockListView,\n\t\t\t} = unlock( select( blockEditorStore ) );\n\n\t\t\tconst descendants = getClientIdsOfDescendants(\n\t\t\t\trenderedBlockClientId\n\t\t\t);\n\n\t\t\t// Exclude items from the content tab that are already present in the\n\t\t\t// List View tab.\n\t\t\tconst listViewDescendants = new Set();\n\t\t\tdescendants.forEach( ( clientId ) => {\n\t\t\t\tif ( shouldRenderBlockListView( clientId ) ) {\n\t\t\t\t\tconst listViewChildren =\n\t\t\t\t\t\tgetClientIdsOfDescendants( clientId );\n\t\t\t\t\tlistViewChildren.forEach( ( childId ) =>\n\t\t\t\t\t\tlistViewDescendants.add( childId )\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t} );\n\n\t\t\treturn descendants.filter( ( current ) => {\n\t\t\t\treturn (\n\t\t\t\t\t! listViewDescendants.has( current ) &&\n\t\t\t\t\tgetBlockEditingMode( current ) === 'contentOnly'\n\t\t\t\t);\n\t\t\t} );\n\t\t},\n\t\t[ isSectionBlock, renderedBlockClientId ]\n\t);\n\n\tconst availableTabs = useInspectorControlsTabs(\n\t\tblockType?.name,\n\t\tcontentClientIds,\n\t\tisSectionBlock,\n\t\thasBlockStyles\n\t);\n\tconst hasMultipleTabs = availableTabs?.length > 1;\n\n\t// The block inspector animation settings will be completely\n\t// removed in the future to create an API which allows the block\n\t// inspector to transition between what it\n\t// displays based on the relationship between the selected block\n\t// and its parent, and only enable it if the parent is controlling\n\t// its children blocks.\n\tconst blockInspectorAnimationSettings =\n\t\tuseBlockInspectorAnimationSettings( blockType );\n\n\tconst hasSelectedBlocks = selectedBlockCount > 1;\n\tconst isBlockStyleStateSelected = ! isDefaultBlockStyleState(\n\t\tselectedBlockStyleState\n\t);\n\n\tif ( hasSelectedBlocks && ! isSectionBlockInSelection ) {\n\t\treturn (\n\t\t\t<div className=\"block-editor-block-inspector\">\n\t\t\t\t<MultiSelectionInspector />\n\t\t\t\t{ hasMultipleTabs ? (\n\t\t\t\t\t<InspectorControlsTabs tabs={ availableTabs } />\n\t\t\t\t) : (\n\t\t\t\t\t<StyleInspectorSlots\n\t\t\t\t\t\tblockName={ renderedBlockName }\n\t\t\t\t\t\tshowAdvancedControls={ false }\n\t\t\t\t\t\tshowPositionControls={ false }\n\t\t\t\t\t\tshowBindingsControls={ false }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t);\n\t}\n\n\tif ( hasSelectedBlocks && isSectionBlockInSelection ) {\n\t\treturn (\n\t\t\t<div className=\"block-editor-block-inspector\">\n\t\t\t\t<MultiSelectionInspector />\n\t\t\t</div>\n\t\t);\n\t}\n\n\tconst isRenderedBlockUnregistered =\n\t\trenderedBlockName === getUnregisteredTypeHandlerName();\n\n\t/*\n\t * If the rendered block is of an unregistered type, avoid showing it as an actual selection\n\t * because we want the user to focus on the unregistered block warning, not block settings.\n\t */\n\tconst shouldShowWarning =\n\t\t! blockType || ! renderedBlockClientId || isRenderedBlockUnregistered;\n\n\tif ( shouldShowWarning ) {\n\t\treturn (\n\t\t\t<span className=\"block-editor-block-inspector__no-blocks\">\n\t\t\t\t{ __( 'No block selected.' ) }\n\t\t\t</span>\n\t\t);\n\t}\n\n\treturn (\n\t\t<BlockInspectorSingleBlockWrapper\n\t\t\tanimate={ blockInspectorAnimationSettings }\n\t\t\twrapper={ ( children ) => (\n\t\t\t\t<AnimatedContainer\n\t\t\t\t\tblockInspectorAnimationSettings={\n\t\t\t\t\t\tblockInspectorAnimationSettings\n\t\t\t\t\t}\n\t\t\t\t\trenderedBlockClientId={ renderedBlockClientId }\n\t\t\t\t>\n\t\t\t\t\t{ children }\n\t\t\t\t</AnimatedContainer>\n\t\t\t) }\n\t\t>\n\t\t\t<BlockInspectorSingleBlock\n\t\t\t\trenderedBlockClientId={ renderedBlockClientId }\n\t\t\t\tblockName={ blockType.name }\n\t\t\t\tisSectionBlock={ isSectionBlock }\n\t\t\t\tavailableTabs={ availableTabs }\n\t\t\t\tcontentClientIds={ contentClientIds }\n\t\t\t\thasBlockStyles={ hasBlockStyles }\n\t\t\t\teditedContentOnlySection={ editedContentOnlySection }\n\t\t\t\tblockEditingMode={ blockEditingMode }\n\t\t\t\tselectedBlockStyleState={ selectedBlockStyleState }\n\t\t\t\tshowStateOnCanvas={ showStateOnCanvas }\n\t\t\t\tisResponsiveEditing={ isResponsiveEditing }\n\t\t\t\tisBlockStyleStateSelected={ isBlockStyleStateSelected }\n\t\t\t/>\n\t\t</BlockInspectorSingleBlockWrapper>\n\t);\n}\n\nconst BlockInspectorSingleBlockWrapper = ( { animate, wrapper, children } ) => {\n\treturn animate ? wrapper( children ) : children;\n};\n\nconst AnimatedContainer = ( {\n\tblockInspectorAnimationSettings,\n\trenderedBlockClientId,\n\tchildren,\n} ) => {\n\tconst animationOrigin =\n\t\tblockInspectorAnimationSettings &&\n\t\tblockInspectorAnimationSettings.enterDirection === 'leftToRight'\n\t\t\t? -50\n\t\t\t: 50;\n\n\treturn (\n\t\t<motion.div\n\t\t\tanimate={ {\n\t\t\t\tx: 0,\n\t\t\t\topacity: 1,\n\t\t\t\ttransition: {\n\t\t\t\t\tease: 'easeInOut',\n\t\t\t\t\tduration: 0.14,\n\t\t\t\t},\n\t\t\t} }\n\t\t\tinitial={ {\n\t\t\t\tx: animationOrigin,\n\t\t\t\topacity: 0,\n\t\t\t} }\n\t\t\tkey={ renderedBlockClientId }\n\t\t>\n\t\t\t{ children }\n\t\t</motion.div>\n\t);\n};\n\nconst BlockInspectorSingleBlock = ( {\n\t// The block that is displayed in the inspector. This is the block whose\n\t// controls and information are shown to the user.\n\trenderedBlockClientId,\n\tblockName,\n\tisSectionBlock,\n\tavailableTabs,\n\tcontentClientIds,\n\thasBlockStyles,\n\teditedContentOnlySection,\n\tblockEditingMode,\n\tselectedBlockStyleState,\n\tshowStateOnCanvas,\n\tisResponsiveEditing,\n\tisBlockStyleStateSelected,\n} ) => {\n\tconst listViewRef = useRef( null );\n\tconst hasMultipleTabs = availableTabs?.length > 1;\n\tconst hasPseudoState = hasPseudoBlockStyleState( selectedBlockStyleState );\n\tconst isEditingStyleState =\n\t\tisBlockStyleStateSelected || isResponsiveEditing;\n\tconst hasParentChildBlockCards =\n\t\teditedContentOnlySection &&\n\t\teditedContentOnlySection !== renderedBlockClientId;\n\tconst parentBlockInformation = useBlockDisplayInformation(\n\t\teditedContentOnlySection\n\t);\n\tconst blockInformation = useBlockDisplayInformation(\n\t\trenderedBlockClientId\n\t);\n\tconst isBlockSynced = blockInformation.isSynced;\n\tconst {\n\t\tsetSelectedBlockStyleState,\n\t\tsetSelectedBlockStyleStateCanvasPreview,\n\t} = unlock( useDispatch( blockEditorStore ) );\n\tconst onBlockStyleStateChange = ( value ) => {\n\t\tsetSelectedBlockStyleState( renderedBlockClientId, value );\n\t};\n\tconst onShowStateOnCanvasChange = ( value ) => {\n\t\tsetSelectedBlockStyleStateCanvasPreview( renderedBlockClientId, value );\n\t};\n\n\treturn (\n\t\t<div className=\"block-editor-block-inspector\">\n\t\t\t{ hasParentChildBlockCards && (\n\t\t\t\t<BlockCard\n\t\t\t\t\t{ ...parentBlockInformation }\n\t\t\t\t\tclassName={\n\t\t\t\t\t\tparentBlockInformation?.isSynced && 'is-synced'\n\t\t\t\t\t}\n\t\t\t\t\tparentClientId={ editedContentOnlySection }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t<BlockCard\n\t\t\t\t{ ...blockInformation }\n\t\t\t\tallowParentNavigation\n\t\t\t\tclassName={ isBlockSynced && 'is-synced' }\n\t\t\t\tisChild={ hasParentChildBlockCards }\n\t\t\t\tclientId={ renderedBlockClientId }\n\t\t\t\tcontrols={\n\t\t\t\t\tblockEditingMode === 'default' && (\n\t\t\t\t\t\t<BlockStatesControl\n\t\t\t\t\t\t\tname={ blockName }\n\t\t\t\t\t\t\tvalue={ selectedBlockStyleState }\n\t\t\t\t\t\t\tonChange={ onBlockStyleStateChange }\n\t\t\t\t\t\t/>\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t/>\n\t\t\t{ blockEditingMode === 'default' && isEditingStyleState && (\n\t\t\t\t<Spacer paddingX={ 4 } paddingY={ 2 }>\n\t\t\t\t\t{ hasPseudoState && (\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\tlabel={ __( 'Show state on canvas' ) }\n\t\t\t\t\t\t\tchecked={ showStateOnCanvas }\n\t\t\t\t\t\t\tonChange={ onShowStateOnCanvasChange }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t<BlockStateBadges\n\t\t\t\t\t\tname={ blockName }\n\t\t\t\t\t\tvalue={ selectedBlockStyleState }\n\t\t\t\t\t\tisResponsiveEditing={ isResponsiveEditing }\n\t\t\t\t\t/>\n\t\t\t\t</Spacer>\n\t\t\t) }\n\t\t\t<ViewportVisibilityInfo clientId={ renderedBlockClientId } />\n\t\t\t<EditContents clientId={ renderedBlockClientId } />\n\t\t\t{ ! isEditingStyleState && (\n\t\t\t\t<BlockVariationTransforms\n\t\t\t\t\tblockClientId={ renderedBlockClientId }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t<BlockInspectorPreTabsSlot />\n\t\t\t{ isEditingStyleState && ! isSectionBlock && (\n\t\t\t\t<StyleStateInspectorSlots\n\t\t\t\t\tblockName={ blockName }\n\t\t\t\t\tselectedBlockStyleState={ selectedBlockStyleState }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ ! isEditingStyleState && hasMultipleTabs && (\n\t\t\t\t<>\n\t\t\t\t\t<InspectorControlsTabs\n\t\t\t\t\t\thasBlockStyles={ hasBlockStyles }\n\t\t\t\t\t\tclientId={ renderedBlockClientId }\n\t\t\t\t\t\tblockName={ blockName }\n\t\t\t\t\t\ttabs={ availableTabs }\n\t\t\t\t\t\tisSectionBlock={ isSectionBlock }\n\t\t\t\t\t\tcontentClientIds={ contentClientIds }\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t) }\n\t\t\t{ ! isEditingStyleState && ! hasMultipleTabs && (\n\t\t\t\t<>\n\t\t\t\t\t{ hasBlockStyles && (\n\t\t\t\t\t\t<BlockStyles clientId={ renderedBlockClientId } />\n\t\t\t\t\t) }\n\t\t\t\t\t<ContentTab contentClientIds={ contentClientIds } />\n\t\t\t\t\t<InspectorControls.Slot group=\"content\" />\n\t\t\t\t\t<InspectorControls.Slot group=\"list\" ref={ listViewRef } />\n\t\t\t\t\t<ListViewContentPopover listViewRef={ listViewRef } />\n\t\t\t\t\t{ ! isSectionBlock && (\n\t\t\t\t\t\t<StyleInspectorSlots blockName={ blockName } />\n\t\t\t\t\t) }\n\t\t\t\t</>\n\t\t\t) }\n\t\t\t{ ! isEditingStyleState && <InspectorControlsLastItem.Slot /> }\n\t\t\t<SkipToSelectedBlock key=\"back\" />\n\t\t</div>\n\t);\n};\n\n/**\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-inspector/README.md\n */\nexport default BlockInspector;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAmB;AACnB,oBAIO;AACP,wBAIO;AACP,kBAAuC;AACvC,qBAAuB;AAKvB,2BAAyB;AACzB,oCAAgC;AAChC,wBAAsB;AACtB,uCAAoC;AACpC,wCAAqC;AACrC,2CAAuC;AACvC,mBAA0C;AAC1C,0BAAwB;AACxB,uCAAuC;AACvC,gCAA8B;AAC9B,0CAA0C;AAC1C,qCAAiD;AACjD,yCAAqC;AACrC,uBAAsC;AACtC,qCAA6B;AAC7B,qCAA6B;AAC7B,gDAA+C;AAC/C,oBAAoC;AACpC,oBAAqD;AACrD,yBAAuB;AACvB,sCAAmC;AACnC,yBAAuB;AACvB,+BAIO;AAUL;AARF,SAAS,oBAAqB;AAAA,EAC7B;AAAA,EACA,uBAAuB;AAAA,EACvB,uBAAuB;AAAA,EACvB,uBAAuB;AACxB,GAAI;AACH,QAAM,uBAAmB,mCAAqB,EAAE,UAAU,CAAE;AAC5D,SACC,4EACC;AAAA,gDAAC,0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AAAA,MAAA;AAAA,QACA,eAAgB;AAAA;AAAA,IACjB;AAAA,IAED,4CAAC,iEAA0B;AAAA,IACzB,uBAAuB,CAAE,kBAC1B;AAAA,MAAC;AAAA;AAAA,QACA;AAAA,QACA;AAAA;AAAA,IACD;AAAA,IAEC,CAAE,uBAAuB,mBAC1B,2EACC;AAAA,MAAC,+BAAAP;AAAA,MAAA;AAAA,QACA;AAAA,QACA,UAAW;AAAA,QACX;AAAA,QACA,MAAO;AAAA,QACP;AAAA,QACA;AAAA;AAAA,IACD,GACD;AAAA,IAEC,CAAE,uBAAuB,CAAE,mBAC5B,4EACG;AAAA,wBACD,4CAAC,oBAAAQ,SAAA,EAAY,UAAW,uBAAwB;AAAA,MAEjD,4CAAC,mBAAAC,SAAA,EAAW,kBAAsC;AAAA,MAClD,4CAAC,0BAAAjB,QAAkB,MAAlB,EAAuB,OAAM,WAAU;AAAA,MACxC,4CAAC,0BAAAA,QAAkB,MAAlB,EAAuB,OAAM,QAAO,KAAM,aAAc;AAAA,MACzD,4CAAC,2DAAuB,aAA4B;AAAA,MAClD,CAAE,kBACH,4CAAC,uBAAoB,WAAwB;AAAA,OAE/C;AAAA,IAEC,CAAE,uBAAuB,4CAAC,iBAAAkB,QAA0B,MAA1B,EAA+B;AAAA,IAC3D,4CAAC,8BAAAC,SAAA,IAAwB,MAAO;AAAA,KACjC;AAEF;AAKA,IAAO,0BAAQ;",
|
|
6
6
|
"names": ["InspectorControls", "PositionControls", "AdvancedControls", "blockEditorStore", "blocksStore", "useInspectorControlsTabs", "useBlockInspectorAnimationSettings", "MultiSelectionInspector", "InspectorControlsTabs", "motion", "useBlockDisplayInformation", "BlockCard", "Spacer", "ViewportVisibilityInfo", "EditContents", "BlockVariationTransforms", "BlockStyles", "ContentTab", "InspectorControlsLastItem", "SkipToSelectedBlock"]
|
|
7
7
|
}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
5
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
8
|
var __export = (target, all) => {
|
|
7
9
|
for (var name in all)
|
|
@@ -15,6 +17,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
17
|
}
|
|
16
18
|
return to;
|
|
17
19
|
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
18
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
29
|
|
|
20
30
|
// packages/block-editor/src/components/use-resize-canvas/index.js
|
|
@@ -23,58 +33,11 @@ __export(use_resize_canvas_exports, {
|
|
|
23
33
|
default: () => useResizeCanvas
|
|
24
34
|
});
|
|
25
35
|
module.exports = __toCommonJS(use_resize_canvas_exports);
|
|
26
|
-
var
|
|
27
|
-
function useResizeCanvas(
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
const resizeListener = () => updateActualWidth(window.innerWidth);
|
|
34
|
-
window.addEventListener("resize", resizeListener);
|
|
35
|
-
return () => {
|
|
36
|
-
window.removeEventListener("resize", resizeListener);
|
|
37
|
-
};
|
|
38
|
-
}, [deviceType]);
|
|
39
|
-
const getCanvasWidth = (device) => {
|
|
40
|
-
let deviceWidth;
|
|
41
|
-
switch (device) {
|
|
42
|
-
case "Tablet":
|
|
43
|
-
deviceWidth = 782 - 1;
|
|
44
|
-
break;
|
|
45
|
-
case "Mobile":
|
|
46
|
-
deviceWidth = 480 - 1;
|
|
47
|
-
break;
|
|
48
|
-
default:
|
|
49
|
-
return null;
|
|
50
|
-
}
|
|
51
|
-
return deviceWidth < actualWidth ? deviceWidth : actualWidth;
|
|
52
|
-
};
|
|
53
|
-
const contentInlineStyles = (device) => {
|
|
54
|
-
const height = device === "Mobile" ? "768px" : "1024px";
|
|
55
|
-
const marginVertical = "40px";
|
|
56
|
-
const marginHorizontal = "auto";
|
|
57
|
-
switch (device) {
|
|
58
|
-
case "Tablet":
|
|
59
|
-
case "Mobile":
|
|
60
|
-
return {
|
|
61
|
-
width: getCanvasWidth(device),
|
|
62
|
-
// Keeping margin styles separate to avoid warnings
|
|
63
|
-
// when those props get overridden in the iframe component
|
|
64
|
-
marginTop: marginVertical,
|
|
65
|
-
marginBottom: marginVertical,
|
|
66
|
-
marginLeft: marginHorizontal,
|
|
67
|
-
marginRight: marginHorizontal,
|
|
68
|
-
height,
|
|
69
|
-
overflowY: "auto"
|
|
70
|
-
};
|
|
71
|
-
default:
|
|
72
|
-
return {
|
|
73
|
-
marginLeft: marginHorizontal,
|
|
74
|
-
marginRight: marginHorizontal
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
return contentInlineStyles(deviceType);
|
|
36
|
+
var import_deprecated = __toESM(require("@wordpress/deprecated"));
|
|
37
|
+
function useResizeCanvas() {
|
|
38
|
+
(0, import_deprecated.default)("wp.blockEditor.useResizeCanvas", {
|
|
39
|
+
since: "7.1",
|
|
40
|
+
hint: "Device preview is now handled by the editor canvas. This hook no longer does anything."
|
|
41
|
+
});
|
|
79
42
|
}
|
|
80
43
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/use-resize-canvas/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": []
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Previously returned inline styles that sized the editor canvas to emulate a\n * device preview width. Device preview is now handled by the editor's resizable\n * canvas, so this hook is a no-op kept for backward compatibility.\n *\n * @deprecated\n */\nexport default function useResizeCanvas() {\n\tdeprecated( 'wp.blockEditor.useResizeCanvas', {\n\t\tsince: '7.1',\n\t\thint: 'Device preview is now handled by the editor canvas. This hook no longer does anything.',\n\t} );\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAAuB;AASR,SAAR,kBAAmC;AACzC,wBAAAA,SAAY,kCAAkC;AAAA,IAC7C,OAAO;AAAA,IACP,MAAM;AAAA,EACP,CAAE;AACH;",
|
|
6
|
+
"names": ["deprecated"]
|
|
7
7
|
}
|
package/build/hooks/states.cjs
CHANGED
|
@@ -37,7 +37,6 @@ __export(states_exports, {
|
|
|
37
37
|
VALID_BLOCK_PSEUDO_STATES: () => VALID_BLOCK_PSEUDO_STATES
|
|
38
38
|
});
|
|
39
39
|
module.exports = __toCommonJS(states_exports);
|
|
40
|
-
var import_blocks = require("@wordpress/blocks");
|
|
41
40
|
var import_i18n = require("@wordpress/i18n");
|
|
42
41
|
var import_state_control = __toESM(require("../components/global-styles/state-control.cjs"));
|
|
43
42
|
var import_state_control_badges = __toESM(require("../components/global-styles/state-control-badges.cjs"));
|
|
@@ -53,6 +52,15 @@ var RESPONSIVE_STATE_LABELS = {
|
|
|
53
52
|
"@tablet": (0, import_i18n.__)("Tablet"),
|
|
54
53
|
"@mobile": (0, import_i18n.__)("Mobile")
|
|
55
54
|
};
|
|
55
|
+
var DEVICE_STATE_OPTIONS = [
|
|
56
|
+
{ value: "default", label: (0, import_i18n.__)("Desktop") },
|
|
57
|
+
...Object.entries(RESPONSIVE_STATE_LABELS).map(
|
|
58
|
+
([value, label]) => ({
|
|
59
|
+
value,
|
|
60
|
+
label
|
|
61
|
+
})
|
|
62
|
+
)
|
|
63
|
+
];
|
|
56
64
|
var VALID_BLOCK_PSEUDO_STATES = {
|
|
57
65
|
"core/button": [":hover", ":focus", ":focus-visible", ":active"],
|
|
58
66
|
"core/navigation-link": [":hover", ":focus", ":focus-visible", ":active"]
|
|
@@ -65,48 +73,32 @@ function getPseudoStateOptions(name) {
|
|
|
65
73
|
}));
|
|
66
74
|
}
|
|
67
75
|
var DEFAULT_STATE_VALUE = "default";
|
|
68
|
-
function getViewportStateOptions(name) {
|
|
69
|
-
if (!(0, import_blocks.getBlockType)(name)?.attributes?.style) {
|
|
70
|
-
return [];
|
|
71
|
-
}
|
|
72
|
-
return Object.entries(RESPONSIVE_STATE_LABELS).map(
|
|
73
|
-
([value, label]) => ({
|
|
74
|
-
value,
|
|
75
|
-
label
|
|
76
|
-
})
|
|
77
|
-
);
|
|
78
|
-
}
|
|
79
76
|
function BlockStatesControl({ name, value, onChange }) {
|
|
80
|
-
const viewportStateOptions = getViewportStateOptions(name);
|
|
81
77
|
const pseudoStateOptions = getPseudoStateOptions(name);
|
|
82
78
|
const dropdownMenuProps = (0, import_utils.useToolsPanelDropdownMenuProps)();
|
|
83
|
-
if (!
|
|
79
|
+
if (!pseudoStateOptions.length) {
|
|
84
80
|
return null;
|
|
85
81
|
}
|
|
86
82
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
87
83
|
import_state_control.default,
|
|
88
84
|
{
|
|
89
|
-
viewportStates: viewportStateOptions,
|
|
90
85
|
pseudoStates: pseudoStateOptions,
|
|
91
|
-
viewportValue: value?.viewport ?? DEFAULT_STATE_VALUE,
|
|
92
86
|
pseudoStateValue: value?.pseudo ?? DEFAULT_STATE_VALUE,
|
|
93
|
-
onChangeViewport: (viewport) => onChange({ viewport }),
|
|
94
87
|
onChangePseudoState: (pseudo) => onChange({ pseudo }),
|
|
95
88
|
popoverProps: dropdownMenuProps.popoverProps,
|
|
96
89
|
showText: false
|
|
97
90
|
}
|
|
98
91
|
);
|
|
99
92
|
}
|
|
100
|
-
function BlockStateBadges({ name, value }) {
|
|
101
|
-
const viewportStateOptions = getViewportStateOptions(name);
|
|
93
|
+
function BlockStateBadges({ name, value, isResponsiveEditing }) {
|
|
102
94
|
const pseudoStateOptions = getPseudoStateOptions(name);
|
|
103
|
-
if (!
|
|
95
|
+
if (!pseudoStateOptions.length && !isResponsiveEditing) {
|
|
104
96
|
return null;
|
|
105
97
|
}
|
|
106
98
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
107
99
|
import_state_control_badges.default,
|
|
108
100
|
{
|
|
109
|
-
viewportStates:
|
|
101
|
+
viewportStates: isResponsiveEditing ? DEVICE_STATE_OPTIONS : [],
|
|
110
102
|
pseudoStates: pseudoStateOptions,
|
|
111
103
|
viewportValue: value?.viewport ?? DEFAULT_STATE_VALUE,
|
|
112
104
|
pseudoStateValue: value?.pseudo ?? DEFAULT_STATE_VALUE
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/hooks/states.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport StateControl from '../components/global-styles/state-control';\nimport StateControlBadges from '../components/global-styles/state-control-badges';\nimport { useToolsPanelDropdownMenuProps } from '../components/global-styles/utils';\n\nexport const PSEUDO_STATE_LABELS = {\n\t':hover': __( 'Hover' ),\n\t':focus': __( 'Focus' ),\n\t':focus-visible': __( 'Focus-visible' ),\n\t':active': __( 'Active' ),\n};\n\nexport const RESPONSIVE_STATE_LABELS = {\n\t'@tablet': __( 'Tablet' ),\n\t'@mobile': __( 'Mobile' ),\n};\n\n// Viewport states are selected globally via the editor's device preview\n// (Responsive editing). 'default' maps to the Desktop device, the remaining\n// options are derived from the shared responsive-state labels.\nconst DEVICE_STATE_OPTIONS = [\n\t{ value: 'default', label: __( 'Desktop' ) },\n\t...Object.entries( RESPONSIVE_STATE_LABELS ).map(\n\t\t( [ value, label ] ) => ( {\n\t\t\tvalue,\n\t\t\tlabel,\n\t\t} )\n\t),\n];\n\n// Keep in sync with WP_Theme_JSON_Gutenberg::VALID_BLOCK_PSEUDO_SELECTORS\n// and packages/global-styles-engine/src/core/render.tsx.\nexport const VALID_BLOCK_PSEUDO_STATES = {\n\t'core/button': [ ':hover', ':focus', ':focus-visible', ':active' ],\n\t'core/navigation-link': [ ':hover', ':focus', ':focus-visible', ':active' ],\n};\n\nfunction getPseudoStateOptions( name ) {\n\tconst validStates = VALID_BLOCK_PSEUDO_STATES[ name ] ?? [];\n\n\treturn validStates\n\t\t.filter( ( state ) => PSEUDO_STATE_LABELS[ state ] )\n\t\t.map( ( state ) => ( {\n\t\t\tvalue: state,\n\t\t\tlabel: PSEUDO_STATE_LABELS[ state ],\n\t\t} ) );\n}\n\nconst DEFAULT_STATE_VALUE = 'default';\n\n/**\n * Renders a pseudo-state selector in the block card header.\n *\n * Viewport states are selected globally via the editor's device preview\n * (Responsive editing), so only pseudo-states are exposed here.\n *\n * @param {Object} props Component props.\n * @param {string} props.name Block name.\n * @param {Object} props.value Currently selected style-state value.\n * @param {Function} props.onChange Callback when style-state selection changes.\n * @return {Element|null} State control component, or null if not applicable.\n */\nexport function BlockStatesControl( { name, value, onChange } ) {\n\tconst pseudoStateOptions = getPseudoStateOptions( name );\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\tif ( ! pseudoStateOptions.length ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<StateControl\n\t\t\tpseudoStates={ pseudoStateOptions }\n\t\t\tpseudoStateValue={ value?.pseudo ?? DEFAULT_STATE_VALUE }\n\t\t\tonChangePseudoState={ ( pseudo ) => onChange( { pseudo } ) }\n\t\t\tpopoverProps={ dropdownMenuProps.popoverProps }\n\t\t\tshowText={ false }\n\t\t/>\n\t);\n}\n\n/**\n * Renders badges for the active style states of a block.\n *\n * @param {Object} props Component props.\n * @param {string} props.name Block name.\n * @param {Object} props.value Currently selected style-state value.\n * @param {boolean} props.isResponsiveEditing Whether Responsive editing is enabled.\n * @return {Element|null} Badges component, or null if there is nothing to show.\n */\nexport function BlockStateBadges( { name, value, isResponsiveEditing } ) {\n\tconst pseudoStateOptions = getPseudoStateOptions( name );\n\n\tif ( ! pseudoStateOptions.length && ! isResponsiveEditing ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<StateControlBadges\n\t\t\tviewportStates={ isResponsiveEditing ? DEVICE_STATE_OPTIONS : [] }\n\t\t\tpseudoStates={ pseudoStateOptions }\n\t\t\tviewportValue={ value?.viewport ?? DEFAULT_STATE_VALUE }\n\t\t\tpseudoStateValue={ value?.pseudo ?? DEFAULT_STATE_VALUE }\n\t\t/>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAmB;AAKnB,2BAAyB;AACzB,kCAA+B;AAC/B,mBAA+C;AAoE7C;AAlEK,IAAM,sBAAsB;AAAA,EAClC,cAAU,gBAAI,OAAQ;AAAA,EACtB,cAAU,gBAAI,OAAQ;AAAA,EACtB,sBAAkB,gBAAI,eAAgB;AAAA,EACtC,eAAW,gBAAI,QAAS;AACzB;AAEO,IAAM,0BAA0B;AAAA,EACtC,eAAW,gBAAI,QAAS;AAAA,EACxB,eA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sB,uBAAuB,CAAC;AAAA,MAC/D,cAAe;AAAA,MACf,eAAgB,OAAO,YAAY;AAAA,MACnC,kBAAmB,OAAO,UAAU;AAAA;AAAA,EACrC;AAEF;",
|
|
6
6
|
"names": ["StateControl", "StateControlBadges"]
|
|
7
7
|
}
|
package/build/private-apis.cjs
CHANGED
|
@@ -130,7 +130,6 @@ var privateApis = {};
|
|
|
130
130
|
mediaEditKey: import_private_keys.mediaEditKey,
|
|
131
131
|
getMediaSelectKey: import_private_keys.getMediaSelectKey,
|
|
132
132
|
deviceTypeKey: import_private_keys.deviceTypeKey,
|
|
133
|
-
onViewportStateChangeKey: import_private_keys.onViewportStateChangeKey,
|
|
134
133
|
isIsolatedEditorKey: import_private_keys.isIsolatedEditorKey,
|
|
135
134
|
isNavigationOverlayContextKey: import_private_keys.isNavigationOverlayContextKey,
|
|
136
135
|
isNavigationPostEditorKey: import_private_keys.isNavigationPostEditorKey,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/private-apis.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport * as globalStyles from './components/global-styles';\nimport { ExperimentalBlockEditorProvider } from './components/provider';\nimport { lock } from './lock-unlock';\nimport { getRichTextValues } from './components/rich-text/get-rich-text-values';\nimport ResizableBoxPopover from './components/resizable-box-popover';\nimport { default as PrivateQuickInserter } from './components/inserter/quick-inserter';\nimport {\n\textractWords,\n\tgetNormalizedSearchTerms,\n\tnormalizeString,\n} from './components/inserter/search-items';\nimport { PrivateListView } from './components/list-view';\nimport InspectorControlsLastItem from './components/inspector-controls/last-item';\nimport { useHasBlockToolbar } from './components/block-toolbar/use-has-block-toolbar';\nimport { cleanEmptyObject, usePrivateStyleOverride } from './hooks/utils';\nimport {\n\tgetStyleForState,\n\tisDefaultBlockStyleState,\n\tsetStyleForState,\n} from './hooks/block-style-state';\nimport BlockQuickNavigation from './components/block-quick-navigation';\nimport { LayoutStyle } from './components/block-list/layout';\nimport BlockManager from './components/block-manager';\nimport { BlockRemovalWarningModal } from './components/block-removal-warning-modal';\nimport {\n\tsetBackgroundStyleDefaults,\n\tuseLayoutClasses,\n\tuseLayoutStyles,\n\tBlockStyleVariationOverridesWithConfig,\n\tuseZoomOut,\n} from './hooks';\nimport DimensionsTool from './components/dimensions-tool';\nimport ResolutionTool from './components/resolution-tool';\nimport TextAlignmentControl from './components/text-alignment-control';\nimport { usesContextKey } from './components/rich-text/format-edit';\nimport {\n\tExperimentalBlockCanvas,\n\tBlockCanvasCover,\n} from './components/block-canvas';\nimport { getDuotoneFilter } from './components/duotone/utils';\nimport { useFlashEditableBlocks } from './components/use-flash-editable-blocks';\nimport {\n\tselectBlockPatternsKey,\n\treusableBlocksSelectKey,\n\tuserPatternCategoriesSelectKey,\n\tglobalStylesDataKey,\n\tglobalStylesLinksDataKey,\n\tsectionRootClientIdKey,\n\tmediaEditKey,\n\tgetMediaSelectKey,\n\tdeviceTypeKey,\n\
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,mBAA8B;AAC9B,sBAAgD;AAChD,yBAAqB;AACrB,kCAAkC;AAClC,mCAAgC;AAChC,4BAAgD;AAChD,0BAIO;AACP,uBAAgC;AAChC,uBAAsC;AACtC,mCAAmC;AACnC,mBAA0D;AAC1D,+BAIO;AACP,oCAAiC;AACjC,oBAA4B;AAC5B,2BAAyB;AACzB,yCAAyC;AACzC,mBAMO;AACP,6BAA2B;AAC3B,6BAA2B;AAC3B,oCAAiC;AACjC,yBAA+B;AAC/B,0BAGO;AACP,IAAAA,gBAAiC;AACjC,uCAAuC;AACvC,
|
|
4
|
+
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport * as globalStyles from './components/global-styles';\nimport { ExperimentalBlockEditorProvider } from './components/provider';\nimport { lock } from './lock-unlock';\nimport { getRichTextValues } from './components/rich-text/get-rich-text-values';\nimport ResizableBoxPopover from './components/resizable-box-popover';\nimport { default as PrivateQuickInserter } from './components/inserter/quick-inserter';\nimport {\n\textractWords,\n\tgetNormalizedSearchTerms,\n\tnormalizeString,\n} from './components/inserter/search-items';\nimport { PrivateListView } from './components/list-view';\nimport InspectorControlsLastItem from './components/inspector-controls/last-item';\nimport { useHasBlockToolbar } from './components/block-toolbar/use-has-block-toolbar';\nimport { cleanEmptyObject, usePrivateStyleOverride } from './hooks/utils';\nimport {\n\tgetStyleForState,\n\tisDefaultBlockStyleState,\n\tsetStyleForState,\n} from './hooks/block-style-state';\nimport BlockQuickNavigation from './components/block-quick-navigation';\nimport { LayoutStyle } from './components/block-list/layout';\nimport BlockManager from './components/block-manager';\nimport { BlockRemovalWarningModal } from './components/block-removal-warning-modal';\nimport {\n\tsetBackgroundStyleDefaults,\n\tuseLayoutClasses,\n\tuseLayoutStyles,\n\tBlockStyleVariationOverridesWithConfig,\n\tuseZoomOut,\n} from './hooks';\nimport DimensionsTool from './components/dimensions-tool';\nimport ResolutionTool from './components/resolution-tool';\nimport TextAlignmentControl from './components/text-alignment-control';\nimport { usesContextKey } from './components/rich-text/format-edit';\nimport {\n\tExperimentalBlockCanvas,\n\tBlockCanvasCover,\n} from './components/block-canvas';\nimport { getDuotoneFilter } from './components/duotone/utils';\nimport { useFlashEditableBlocks } from './components/use-flash-editable-blocks';\nimport {\n\tselectBlockPatternsKey,\n\treusableBlocksSelectKey,\n\tuserPatternCategoriesSelectKey,\n\tglobalStylesDataKey,\n\tglobalStylesLinksDataKey,\n\tsectionRootClientIdKey,\n\tmediaEditKey,\n\tgetMediaSelectKey,\n\tdeviceTypeKey,\n\tisIsolatedEditorKey,\n\tisNavigationOverlayContextKey,\n\tisNavigationPostEditorKey,\n\tmediaUploadOnSuccessKey,\n\topenMediaEditorModalKey,\n} from './store/private-keys';\nimport { requiresWrapperOnCopy } from './components/writing-flow/utils';\nimport { PrivateRichText } from './components/rich-text/';\nimport { PrivateBlockPopover } from './components/block-popover';\nimport { PrivateInserterLibrary } from './components/inserter/library';\nimport { PrivatePublishDateTimePicker } from './components/publish-date-time-picker';\nimport useSpacingSizes from './components/spacing-sizes-control/hooks/use-spacing-sizes';\nimport useBlockDisplayTitle from './components/block-title/use-block-display-title';\nimport TabbedSidebar from './components/tabbed-sidebar';\nimport NoteIconSlotFill from './components/collab/note-icon-slot';\nimport NoteIconToolbarSlotFill from './components/collab/note-icon-toolbar-slot';\nimport HTMLElementControl from './components/html-element-control';\nimport {\n\tuseBlockElementRef,\n\tuseBlockElement,\n} from './components/block-list/use-block-props/use-block-refs';\nimport { LinkPicker } from './components/link-picker';\nimport useRemoteUrlData from './components/link-control/use-rich-url-data';\nimport { PrivateBlockContext } from './components/block-list/private-block-context';\nimport useListViewPanelState from './components/use-list-view-panel-state';\nimport {\n\tisHashLink,\n\tisRelativePath,\n} from './components/link-control/is-url-like';\n\n/**\n * Private @wordpress/block-editor APIs.\n */\nexport const privateApis = {};\nlock( privateApis, {\n\t...globalStyles,\n\tExperimentalBlockCanvas,\n\tBlockCanvasCover,\n\tExperimentalBlockEditorProvider,\n\tgetDuotoneFilter,\n\tgetRichTextValues,\n\tPrivateQuickInserter,\n\textractWords,\n\tgetNormalizedSearchTerms,\n\tnormalizeString,\n\tPrivateListView,\n\tResizableBoxPopover,\n\tInspectorControlsLastItem,\n\tuseHasBlockToolbar,\n\tcleanEmptyObject,\n\tgetStyleForState,\n\tisDefaultBlockStyleState,\n\tsetStyleForState,\n\tusePrivateStyleOverride,\n\tBlockQuickNavigation,\n\tLayoutStyle,\n\tBlockManager,\n\tBlockRemovalWarningModal,\n\tuseLayoutClasses,\n\tuseLayoutStyles,\n\tDimensionsTool,\n\tResolutionTool,\n\tTabbedSidebar,\n\tTextAlignmentControl,\n\tusesContextKey,\n\tuseFlashEditableBlocks,\n\tHTMLElementControl,\n\tuseZoomOut,\n\tglobalStylesDataKey,\n\tglobalStylesLinksDataKey,\n\tselectBlockPatternsKey,\n\trequiresWrapperOnCopy,\n\tPrivateRichText,\n\tPrivateInserterLibrary,\n\treusableBlocksSelectKey,\n\tuserPatternCategoriesSelectKey,\n\tPrivateBlockPopover,\n\tPrivatePublishDateTimePicker,\n\tuseSpacingSizes,\n\tuseBlockDisplayTitle,\n\tBlockStyleVariationOverridesWithConfig,\n\tsetBackgroundStyleDefaults,\n\tsectionRootClientIdKey,\n\tNoteIconSlotFill,\n\tNoteIconToolbarSlotFill,\n\tmediaEditKey,\n\tgetMediaSelectKey,\n\tdeviceTypeKey,\n\tisIsolatedEditorKey,\n\tisNavigationOverlayContextKey,\n\tisNavigationPostEditorKey,\n\tmediaUploadOnSuccessKey,\n\topenMediaEditorModalKey,\n\tuseBlockElement,\n\tuseBlockElementRef,\n\tLinkPicker,\n\tuseRemoteUrlData,\n\tPrivateBlockContext,\n\tuseListViewPanelState,\n\tisHashLink,\n\tisRelativePath,\n} );\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,mBAA8B;AAC9B,sBAAgD;AAChD,yBAAqB;AACrB,kCAAkC;AAClC,mCAAgC;AAChC,4BAAgD;AAChD,0BAIO;AACP,uBAAgC;AAChC,uBAAsC;AACtC,mCAAmC;AACnC,mBAA0D;AAC1D,+BAIO;AACP,oCAAiC;AACjC,oBAA4B;AAC5B,2BAAyB;AACzB,yCAAyC;AACzC,mBAMO;AACP,6BAA2B;AAC3B,6BAA2B;AAC3B,oCAAiC;AACjC,yBAA+B;AAC/B,0BAGO;AACP,IAAAA,gBAAiC;AACjC,uCAAuC;AACvC,0BAeO;AACP,IAAAA,gBAAsC;AACtC,uBAAgC;AAChC,2BAAoC;AACpC,qBAAuC;AACvC,sCAA6C;AAC7C,+BAA4B;AAC5B,qCAAiC;AACjC,4BAA0B;AAC1B,4BAA6B;AAC7B,oCAAoC;AACpC,kCAA+B;AAC/B,4BAGO;AACP,yBAA2B;AAC3B,+BAA6B;AAC7B,mCAAoC;AACpC,uCAAkC;AAClC,yBAGO;AAKA,IAAM,cAAc,CAAC;AAAA,IAC5B,yBAAM,aAAa;AAAA,EAClB,GAAG;AAAA,EACH;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,4CAAAC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,kDAAAC;AAAA,EACA,4CAAAC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,oDAAAC;AAAA,EACA;AAAA,EACA,mCAAAC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,uCAAAC;AAAA,EACA,uCAAAC;AAAA,EACA,qCAAAC;AAAA,EACA,oDAAAC;AAAA,EACA;AAAA,EACA;AAAA,EACA,gDAAAC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,0CAAAC;AAAA,EACA,qDAAAC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,wCAAAC;AAAA,EACA,uDAAAC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,2CAAAC;AAAA,EACA;AAAA,EACA,wDAAAC;AAAA,EACA;AAAA,EACA;AACD,CAAE;",
|
|
6
6
|
"names": ["import_utils", "PrivateQuickInserter", "ResizableBoxPopover", "InspectorControlsLastItem", "BlockQuickNavigation", "BlockManager", "DimensionsTool", "ResolutionTool", "TabbedSidebar", "TextAlignmentControl", "HTMLElementControl", "useSpacingSizes", "useBlockDisplayTitle", "NoteIconSlotFill", "NoteIconToolbarSlotFill", "useRemoteUrlData", "useListViewPanelState"]
|
|
7
7
|
}
|
|
@@ -47,9 +47,11 @@ __export(private_actions_exports, {
|
|
|
47
47
|
setBlockRemovalRules: () => setBlockRemovalRules,
|
|
48
48
|
setInsertionPoint: () => setInsertionPoint,
|
|
49
49
|
setLastFocus: () => setLastFocus,
|
|
50
|
+
setResponsiveEditing: () => setResponsiveEditing,
|
|
50
51
|
setSelectedBlockStyleState: () => setSelectedBlockStyleState,
|
|
51
52
|
setSelectedBlockStyleStateCanvasPreview: () => setSelectedBlockStyleStateCanvasPreview,
|
|
52
53
|
setStyleOverride: () => setStyleOverride,
|
|
54
|
+
setStyleStateViewport: () => setStyleStateViewport,
|
|
53
55
|
setZoomLevel: () => setZoomLevel,
|
|
54
56
|
showBlockInterface: () => showBlockInterface,
|
|
55
57
|
showViewportModal: () => showViewportModal,
|
|
@@ -328,6 +330,18 @@ function setSelectedBlockStyleStateCanvasPreview(clientId, value) {
|
|
|
328
330
|
value
|
|
329
331
|
};
|
|
330
332
|
}
|
|
333
|
+
function setStyleStateViewport(viewport) {
|
|
334
|
+
return {
|
|
335
|
+
type: "SET_STYLE_STATE_VIEWPORT",
|
|
336
|
+
viewport
|
|
337
|
+
};
|
|
338
|
+
}
|
|
339
|
+
function setResponsiveEditing(enabled) {
|
|
340
|
+
return {
|
|
341
|
+
type: "SET_RESPONSIVE_EDITING",
|
|
342
|
+
enabled
|
|
343
|
+
};
|
|
344
|
+
}
|
|
331
345
|
// Annotate the CommonJS export names for ESM import in node:
|
|
332
346
|
0 && (module.exports = {
|
|
333
347
|
__experimentalUpdateSettings,
|
|
@@ -347,9 +361,11 @@ function setSelectedBlockStyleStateCanvasPreview(clientId, value) {
|
|
|
347
361
|
setBlockRemovalRules,
|
|
348
362
|
setInsertionPoint,
|
|
349
363
|
setLastFocus,
|
|
364
|
+
setResponsiveEditing,
|
|
350
365
|
setSelectedBlockStyleState,
|
|
351
366
|
setSelectedBlockStyleStateCanvasPreview,
|
|
352
367
|
setStyleOverride,
|
|
368
|
+
setStyleStateViewport,
|
|
353
369
|
setZoomLevel,
|
|
354
370
|
showBlockInterface,
|
|
355
371
|
showViewportModal,
|