@wordpress/block-editor 14.3.12 → 14.3.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/components/block-popover/index.js +1 -1
- package/build/components/block-popover/index.js.map +1 -1
- package/build/components/block-tools/use-block-toolbar-popover-props.js +1 -1
- package/build/components/block-tools/use-block-toolbar-popover-props.js.map +1 -1
- package/build/utils/dom.js +27 -22
- package/build/utils/dom.js.map +1 -1
- package/build-module/components/block-popover/index.js +2 -2
- package/build-module/components/block-popover/index.js.map +1 -1
- package/build-module/components/block-tools/use-block-toolbar-popover-props.js +2 -2
- package/build-module/components/block-tools/use-block-toolbar-popover-props.js.map +1 -1
- package/build-module/utils/dom.js +25 -21
- package/build-module/utils/dom.js.map +1 -1
- package/build-types/utils/dom.d.ts +7 -9
- package/build-types/utils/dom.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/components/block-popover/index.js +4 -4
- package/src/components/block-tools/use-block-toolbar-popover-props.js +2 -2
- package/src/utils/dom.js +26 -21
- package/src/utils/test/dom.js +224 -0
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -71,7 +71,7 @@ function BlockPopover({
|
|
|
71
71
|
}
|
|
72
72
|
return {
|
|
73
73
|
getBoundingClientRect() {
|
|
74
|
-
return lastSelectedElement ? (0, _dom.rectUnion)((0, _dom.
|
|
74
|
+
return lastSelectedElement ? (0, _dom.rectUnion)((0, _dom.getElementBounds)(selectedElement), (0, _dom.getElementBounds)(lastSelectedElement)) : (0, _dom.getElementBounds)(selectedElement);
|
|
75
75
|
},
|
|
76
76
|
contextElement: selectedElement
|
|
77
77
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_clsx","_interopRequireDefault","require","_compose","_components","_element","_useBlockRefs","_usePopoverScroll","_dom","_jsxRuntime","MAX_POPOVER_RECOMPUTE_COUNTER","Number","MAX_SAFE_INTEGER","BlockPopover","clientId","bottomClientId","children","__unstablePopoverSlot","__unstableContentRef","shift","props","ref","selectedElement","useBlockElement","lastSelectedElement","mergedRefs","useMergeRefs","usePopoverScroll","popoverDimensionsRecomputeCounter","forceRecomputePopoverDimensions","useReducer","s","useLayoutEffect","observer","window","MutationObserver","observe","attributes","disconnect","popoverAnchor","useMemo","undefined","getBoundingClientRect","rectUnion","
|
|
1
|
+
{"version":3,"names":["_clsx","_interopRequireDefault","require","_compose","_components","_element","_useBlockRefs","_usePopoverScroll","_dom","_jsxRuntime","MAX_POPOVER_RECOMPUTE_COUNTER","Number","MAX_SAFE_INTEGER","BlockPopover","clientId","bottomClientId","children","__unstablePopoverSlot","__unstableContentRef","shift","props","ref","selectedElement","useBlockElement","lastSelectedElement","mergedRefs","useMergeRefs","usePopoverScroll","popoverDimensionsRecomputeCounter","forceRecomputePopoverDimensions","useReducer","s","useLayoutEffect","observer","window","MutationObserver","observe","attributes","disconnect","popoverAnchor","useMemo","undefined","getBoundingClientRect","rectUnion","getElementBounds","contextElement","jsx","Popover","animate","focusOnMount","anchor","__unstableSlotName","inline","placement","resize","flip","className","clsx","variant","PrivateBlockPopover","exports","forwardRef","PublicBlockPopover","_default","default"],"sources":["@wordpress/block-editor/src/components/block-popover/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useMergeRefs } from '@wordpress/compose';\nimport { Popover } from '@wordpress/components';\nimport {\n\tforwardRef,\n\tuseMemo,\n\tuseReducer,\n\tuseLayoutEffect,\n} from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { useBlockElement } from '../block-list/use-block-props/use-block-refs';\nimport usePopoverScroll from './use-popover-scroll';\nimport { rectUnion, getElementBounds } from '../../utils/dom';\n\nconst MAX_POPOVER_RECOMPUTE_COUNTER = Number.MAX_SAFE_INTEGER;\n\nfunction BlockPopover(\n\t{\n\t\tclientId,\n\t\tbottomClientId,\n\t\tchildren,\n\t\t__unstablePopoverSlot,\n\t\t__unstableContentRef,\n\t\tshift = true,\n\t\t...props\n\t},\n\tref\n) {\n\tconst selectedElement = useBlockElement( clientId );\n\tconst lastSelectedElement = useBlockElement( bottomClientId ?? clientId );\n\tconst mergedRefs = useMergeRefs( [\n\t\tref,\n\t\tusePopoverScroll( __unstableContentRef ),\n\t] );\n\n\tconst [\n\t\tpopoverDimensionsRecomputeCounter,\n\t\tforceRecomputePopoverDimensions,\n\t] = useReducer(\n\t\t// Module is there to make sure that the counter doesn't overflow.\n\t\t( s ) => ( s + 1 ) % MAX_POPOVER_RECOMPUTE_COUNTER,\n\t\t0\n\t);\n\n\t// When blocks are moved up/down, they are animated to their new position by\n\t// updating the `transform` property manually (i.e. without using CSS\n\t// transitions or animations). The animation, which can also scroll the block\n\t// editor, can sometimes cause the position of the Popover to get out of sync.\n\t// A MutationObserver is therefore used to make sure that changes to the\n\t// selectedElement's attribute (i.e. `transform`) can be tracked and used to\n\t// trigger the Popover to rerender.\n\tuseLayoutEffect( () => {\n\t\tif ( ! selectedElement ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst observer = new window.MutationObserver(\n\t\t\tforceRecomputePopoverDimensions\n\t\t);\n\t\tobserver.observe( selectedElement, { attributes: true } );\n\n\t\treturn () => {\n\t\t\tobserver.disconnect();\n\t\t};\n\t}, [ selectedElement ] );\n\n\tconst popoverAnchor = useMemo( () => {\n\t\tif (\n\t\t\t// popoverDimensionsRecomputeCounter is by definition always equal or greater\n\t\t\t// than 0. This check is only there to satisfy the correctness of the\n\t\t\t// exhaustive-deps rule for the `useMemo` hook.\n\t\t\tpopoverDimensionsRecomputeCounter < 0 ||\n\t\t\t! selectedElement ||\n\t\t\t( bottomClientId && ! lastSelectedElement )\n\t\t) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\treturn {\n\t\t\tgetBoundingClientRect() {\n\t\t\t\treturn lastSelectedElement\n\t\t\t\t\t? rectUnion(\n\t\t\t\t\t\t\tgetElementBounds( selectedElement ),\n\t\t\t\t\t\t\tgetElementBounds( lastSelectedElement )\n\t\t\t\t\t )\n\t\t\t\t\t: getElementBounds( selectedElement );\n\t\t\t},\n\t\t\tcontextElement: selectedElement,\n\t\t};\n\t}, [\n\t\tpopoverDimensionsRecomputeCounter,\n\t\tselectedElement,\n\t\tbottomClientId,\n\t\tlastSelectedElement,\n\t] );\n\n\tif ( ! selectedElement || ( bottomClientId && ! lastSelectedElement ) ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Popover\n\t\t\tref={ mergedRefs }\n\t\t\tanimate={ false }\n\t\t\tfocusOnMount={ false }\n\t\t\tanchor={ popoverAnchor }\n\t\t\t// Render in the old slot if needed for backward compatibility,\n\t\t\t// otherwise render in place (not in the default popover slot).\n\t\t\t__unstableSlotName={ __unstablePopoverSlot }\n\t\t\tinline={ ! __unstablePopoverSlot }\n\t\t\tplacement=\"top-start\"\n\t\t\tresize={ false }\n\t\t\tflip={ false }\n\t\t\tshift={ shift }\n\t\t\t{ ...props }\n\t\t\tclassName={ clsx( 'block-editor-block-popover', props.className ) }\n\t\t\tvariant=\"unstyled\"\n\t\t>\n\t\t\t{ children }\n\t\t</Popover>\n\t);\n}\n\nexport const PrivateBlockPopover = forwardRef( BlockPopover );\n\nconst PublicBlockPopover = (\n\t{ clientId, bottomClientId, children, ...props },\n\tref\n) => (\n\t<PrivateBlockPopover\n\t\t{ ...props }\n\t\tbottomClientId={ bottomClientId }\n\t\tclientId={ clientId }\n\t\t__unstableContentRef={ undefined }\n\t\t__unstablePopoverSlot={ undefined }\n\t\tref={ ref }\n\t>\n\t\t{ children }\n\t</PrivateBlockPopover>\n);\n\n/**\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-popover/README.md\n */\nexport default forwardRef( PublicBlockPopover );\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AAU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BAAkB,GAAGA,CAC1B;EAAEhD,QAAQ;EAAEC,cAAc;EAAEC,QAAQ;EAAE,GAAGI;AAAM,CAAC,EAChDC,GAAG,kBAEH,IAAAZ,WAAA,CAAAqC,GAAA,EAACa,mBAAmB;EAAA,GACdvC,KAAK;EACVL,cAAc,EAAGA,cAAgB;EACjCD,QAAQ,EAAGA,QAAU;EACrBI,oBAAoB,EAAGuB,SAAW;EAClCxB,qBAAqB,EAAGwB,SAAW;EACnCpB,GAAG,EAAGA,GAAK;EAAAL,QAAA,EAETA;AAAQ,CACU,CACrB;;AAED;AACA;AACA;AAFA,IAAA+C,QAAA,GAAAH,OAAA,CAAAI,OAAA,GAGe,IAAAH,mBAAU,EAAEC,kBAAmB,CAAC","ignoreList":[]}
|
|
@@ -62,7 +62,7 @@ function getProps(contentElement, selectedBlockElement, scrollContainer, toolbar
|
|
|
62
62
|
|
|
63
63
|
// Get how far the content area has been scrolled.
|
|
64
64
|
const scrollTop = scrollContainer?.scrollTop || 0;
|
|
65
|
-
const blockRect = (0, _dom2.
|
|
65
|
+
const blockRect = (0, _dom2.getElementBounds)(selectedBlockElement);
|
|
66
66
|
const contentRect = contentElement.getBoundingClientRect();
|
|
67
67
|
|
|
68
68
|
// Get the vertical position of top of the visible content area.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_compose","require","_data","_dom","_element","_store","_useBlockRefs","_position","_dom2","COMMON_PROPS","placement","DEFAULT_PROPS","flip","shift","RESTRICTED_HEIGHT_PROPS","getProps","contentElement","selectedBlockElement","scrollContainer","toolbarHeight","isSticky","scrollTop","blockRect","getVisibleElementBounds","contentRect","getBoundingClientRect","topOfContentElementInViewport","top","viewportHeight","ownerDocument","documentElement","clientHeight","restrictedTopArea","hasSpaceForToolbarAbove","isBlockTallerThanViewport","height","useBlockToolbarPopoverProps","clientId","useBlockElement","setToolbarHeight","useState","blockIndex","useSelect","select","getBlockIndex","getBlockAttributes","blockEditorStore","hasStickyOrFixedPositionValue","useMemo","getScrollContainer","props","setProps","popoverRef","useRefEffect","popoverNode","offsetHeight","updateProps","useCallback","useLayoutEffect","contentView","defaultView","addEventHandler","resizeObserver","blockView","ResizeObserver","observe","removeEventHandler","disconnect","ref"],"sources":["@wordpress/block-editor/src/components/block-tools/use-block-toolbar-popover-props.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useRefEffect } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\nimport { getScrollContainer } from '@wordpress/dom';\nimport {\n\tuseCallback,\n\tuseLayoutEffect,\n\tuseMemo,\n\tuseState,\n} from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { useBlockElement } from '../block-list/use-block-props/use-block-refs';\nimport { hasStickyOrFixedPositionValue } from '../../hooks/position';\nimport { getVisibleElementBounds } from '../../utils/dom';\n\nconst COMMON_PROPS = {\n\tplacement: 'top-start',\n};\n\n// By default the toolbar sets the `shift` prop. If the user scrolls the page\n// down the toolbar will stay on screen by adopting a sticky position at the\n// top of the viewport.\nconst DEFAULT_PROPS = {\n\t...COMMON_PROPS,\n\tflip: false,\n\tshift: true,\n};\n\n// When there isn't enough height between the top of the block and the editor\n// canvas, the `shift` prop is set to `false`, as it will cause the block to be\n// obscured. The `flip` behavior is enabled, which positions the toolbar below\n// the block. This only happens if the block is smaller than the viewport, as\n// otherwise the toolbar will be off-screen.\nconst RESTRICTED_HEIGHT_PROPS = {\n\t...COMMON_PROPS,\n\tflip: true,\n\tshift: false,\n};\n\n/**\n * Get the popover props for the block toolbar, determined by the space at the top of the canvas and the toolbar height.\n *\n * @param {Element} contentElement The DOM element that represents the editor content or canvas.\n * @param {Element} selectedBlockElement The outer DOM element of the first selected block.\n * @param {Element} scrollContainer The scrollable container for the contentElement.\n * @param {number} toolbarHeight The height of the toolbar in pixels.\n * @param {boolean} isSticky Whether or not the selected block is sticky or fixed.\n *\n * @return {Object} The popover props used to determine the position of the toolbar.\n */\nfunction getProps(\n\tcontentElement,\n\tselectedBlockElement,\n\tscrollContainer,\n\ttoolbarHeight,\n\tisSticky\n) {\n\tif ( ! contentElement || ! selectedBlockElement ) {\n\t\treturn DEFAULT_PROPS;\n\t}\n\n\t// Get how far the content area has been scrolled.\n\tconst scrollTop = scrollContainer?.scrollTop || 0;\n\n\tconst blockRect = getVisibleElementBounds( selectedBlockElement );\n\tconst contentRect = contentElement.getBoundingClientRect();\n\n\t// Get the vertical position of top of the visible content area.\n\tconst topOfContentElementInViewport = scrollTop + contentRect.top;\n\n\t// The document element's clientHeight represents the viewport height.\n\tconst viewportHeight =\n\t\tcontentElement.ownerDocument.documentElement.clientHeight;\n\n\t// The restricted height area is calculated as the sum of the\n\t// vertical position of the visible content area, plus the height\n\t// of the block toolbar.\n\tconst restrictedTopArea = topOfContentElementInViewport + toolbarHeight;\n\tconst hasSpaceForToolbarAbove = blockRect.top > restrictedTopArea;\n\n\tconst isBlockTallerThanViewport =\n\t\tblockRect.height > viewportHeight - toolbarHeight;\n\n\t// Sticky blocks are treated as if they will never have enough space for the toolbar above.\n\tif (\n\t\t! isSticky &&\n\t\t( hasSpaceForToolbarAbove || isBlockTallerThanViewport )\n\t) {\n\t\treturn DEFAULT_PROPS;\n\t}\n\n\treturn RESTRICTED_HEIGHT_PROPS;\n}\n\n/**\n * Determines the desired popover positioning behavior, returning a set of appropriate props.\n *\n * @param {Object} elements\n * @param {Element} elements.contentElement The DOM element that represents the editor content or canvas.\n * @param {string} elements.clientId The clientId of the first selected block.\n *\n * @return {Object} The popover props used to determine the position of the toolbar.\n */\nexport default function useBlockToolbarPopoverProps( {\n\tcontentElement,\n\tclientId,\n} ) {\n\tconst selectedBlockElement = useBlockElement( clientId );\n\tconst [ toolbarHeight, setToolbarHeight ] = useState( 0 );\n\tconst { blockIndex, isSticky } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockIndex, getBlockAttributes } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\treturn {\n\t\t\t\tblockIndex: getBlockIndex( clientId ),\n\t\t\t\tisSticky: hasStickyOrFixedPositionValue(\n\t\t\t\t\tgetBlockAttributes( clientId )\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\tconst scrollContainer = useMemo( () => {\n\t\tif ( ! contentElement ) {\n\t\t\treturn;\n\t\t}\n\t\treturn getScrollContainer( contentElement );\n\t}, [ contentElement ] );\n\tconst [ props, setProps ] = useState( () =>\n\t\tgetProps(\n\t\t\tcontentElement,\n\t\t\tselectedBlockElement,\n\t\t\tscrollContainer,\n\t\t\ttoolbarHeight,\n\t\t\tisSticky\n\t\t)\n\t);\n\n\tconst popoverRef = useRefEffect( ( popoverNode ) => {\n\t\tsetToolbarHeight( popoverNode.offsetHeight );\n\t}, [] );\n\n\tconst updateProps = useCallback(\n\t\t() =>\n\t\t\tsetProps(\n\t\t\t\tgetProps(\n\t\t\t\t\tcontentElement,\n\t\t\t\t\tselectedBlockElement,\n\t\t\t\t\tscrollContainer,\n\t\t\t\t\ttoolbarHeight,\n\t\t\t\t\tisSticky\n\t\t\t\t)\n\t\t\t),\n\t\t[ contentElement, selectedBlockElement, scrollContainer, toolbarHeight ]\n\t);\n\n\t// Update props when the block is moved. This also ensures the props are\n\t// correct on initial mount, and when the selected block or content element\n\t// changes (since the callback ref will update).\n\tuseLayoutEffect( updateProps, [ blockIndex, updateProps ] );\n\n\t// Update props when the viewport is resized or the block is resized.\n\tuseLayoutEffect( () => {\n\t\tif ( ! contentElement || ! selectedBlockElement ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Update the toolbar props on viewport resize.\n\t\tconst contentView = contentElement?.ownerDocument?.defaultView;\n\t\tcontentView?.addEventHandler?.( 'resize', updateProps );\n\n\t\t// Update the toolbar props on block resize.\n\t\tlet resizeObserver;\n\t\tconst blockView = selectedBlockElement?.ownerDocument?.defaultView;\n\t\tif ( blockView.ResizeObserver ) {\n\t\t\tresizeObserver = new blockView.ResizeObserver( updateProps );\n\t\t\tresizeObserver.observe( selectedBlockElement );\n\t\t}\n\n\t\treturn () => {\n\t\t\tcontentView?.removeEventHandler?.( 'resize', updateProps );\n\n\t\t\tif ( resizeObserver ) {\n\t\t\t\tresizeObserver.disconnect();\n\t\t\t}\n\t\t};\n\t}, [ updateProps, contentElement, selectedBlockElement ] );\n\n\treturn {\n\t\t...props,\n\t\tref: popoverRef,\n\t};\n}\n"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,IAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AAUA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,aAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AACA,IAAAO,KAAA,GAAAP,OAAA;AAnBA;AACA;AACA;;AAWA;AACA;AACA;;AAMA,MAAMQ,YAAY,GAAG;EACpBC,SAAS,EAAE;AACZ,CAAC;;AAED;AACA;AACA;AACA,MAAMC,aAAa,GAAG;EACrB,GAAGF,YAAY;EACfG,IAAI,EAAE,KAAK;EACXC,KAAK,EAAE;AACR,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA,MAAMC,uBAAuB,GAAG;EAC/B,GAAGL,YAAY;EACfG,IAAI,EAAE,IAAI;EACVC,KAAK,EAAE;AACR,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASE,QAAQA,CAChBC,cAAc,EACdC,oBAAoB,EACpBC,eAAe,EACfC,aAAa,EACbC,QAAQ,EACP;EACD,IAAK,CAAEJ,cAAc,IAAI,CAAEC,oBAAoB,EAAG;IACjD,OAAON,aAAa;EACrB;;EAEA;EACA,MAAMU,SAAS,GAAGH,eAAe,EAAEG,SAAS,IAAI,CAAC;EAEjD,MAAMC,SAAS,GAAG,IAAAC,6BAAuB,EAAEN,oBAAqB,CAAC;EACjE,MAAMO,WAAW,GAAGR,cAAc,CAACS,qBAAqB,CAA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1D,IAAKM,cAAc,EAAG;QACrBA,cAAc,CAACK,UAAU,CAAC,CAAC;MAC5B;IACD,CAAC;EACF,CAAC,EAAE,CAAEX,WAAW,EAAExC,cAAc,EAAEC,oBAAoB,CAAG,CAAC;EAE1D,OAAO;IACN,GAAGiC,KAAK;IACRkB,GAAG,EAAEhB;EACN,CAAC;AACF","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_compose","require","_data","_dom","_element","_store","_useBlockRefs","_position","_dom2","COMMON_PROPS","placement","DEFAULT_PROPS","flip","shift","RESTRICTED_HEIGHT_PROPS","getProps","contentElement","selectedBlockElement","scrollContainer","toolbarHeight","isSticky","scrollTop","blockRect","getElementBounds","contentRect","getBoundingClientRect","topOfContentElementInViewport","top","viewportHeight","ownerDocument","documentElement","clientHeight","restrictedTopArea","hasSpaceForToolbarAbove","isBlockTallerThanViewport","height","useBlockToolbarPopoverProps","clientId","useBlockElement","setToolbarHeight","useState","blockIndex","useSelect","select","getBlockIndex","getBlockAttributes","blockEditorStore","hasStickyOrFixedPositionValue","useMemo","getScrollContainer","props","setProps","popoverRef","useRefEffect","popoverNode","offsetHeight","updateProps","useCallback","useLayoutEffect","contentView","defaultView","addEventHandler","resizeObserver","blockView","ResizeObserver","observe","removeEventHandler","disconnect","ref"],"sources":["@wordpress/block-editor/src/components/block-tools/use-block-toolbar-popover-props.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useRefEffect } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\nimport { getScrollContainer } from '@wordpress/dom';\nimport {\n\tuseCallback,\n\tuseLayoutEffect,\n\tuseMemo,\n\tuseState,\n} from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { useBlockElement } from '../block-list/use-block-props/use-block-refs';\nimport { hasStickyOrFixedPositionValue } from '../../hooks/position';\nimport { getElementBounds } from '../../utils/dom';\n\nconst COMMON_PROPS = {\n\tplacement: 'top-start',\n};\n\n// By default the toolbar sets the `shift` prop. If the user scrolls the page\n// down the toolbar will stay on screen by adopting a sticky position at the\n// top of the viewport.\nconst DEFAULT_PROPS = {\n\t...COMMON_PROPS,\n\tflip: false,\n\tshift: true,\n};\n\n// When there isn't enough height between the top of the block and the editor\n// canvas, the `shift` prop is set to `false`, as it will cause the block to be\n// obscured. The `flip` behavior is enabled, which positions the toolbar below\n// the block. This only happens if the block is smaller than the viewport, as\n// otherwise the toolbar will be off-screen.\nconst RESTRICTED_HEIGHT_PROPS = {\n\t...COMMON_PROPS,\n\tflip: true,\n\tshift: false,\n};\n\n/**\n * Get the popover props for the block toolbar, determined by the space at the top of the canvas and the toolbar height.\n *\n * @param {Element} contentElement The DOM element that represents the editor content or canvas.\n * @param {Element} selectedBlockElement The outer DOM element of the first selected block.\n * @param {Element} scrollContainer The scrollable container for the contentElement.\n * @param {number} toolbarHeight The height of the toolbar in pixels.\n * @param {boolean} isSticky Whether or not the selected block is sticky or fixed.\n *\n * @return {Object} The popover props used to determine the position of the toolbar.\n */\nfunction getProps(\n\tcontentElement,\n\tselectedBlockElement,\n\tscrollContainer,\n\ttoolbarHeight,\n\tisSticky\n) {\n\tif ( ! contentElement || ! selectedBlockElement ) {\n\t\treturn DEFAULT_PROPS;\n\t}\n\n\t// Get how far the content area has been scrolled.\n\tconst scrollTop = scrollContainer?.scrollTop || 0;\n\n\tconst blockRect = getElementBounds( selectedBlockElement );\n\tconst contentRect = contentElement.getBoundingClientRect();\n\n\t// Get the vertical position of top of the visible content area.\n\tconst topOfContentElementInViewport = scrollTop + contentRect.top;\n\n\t// The document element's clientHeight represents the viewport height.\n\tconst viewportHeight =\n\t\tcontentElement.ownerDocument.documentElement.clientHeight;\n\n\t// The restricted height area is calculated as the sum of the\n\t// vertical position of the visible content area, plus the height\n\t// of the block toolbar.\n\tconst restrictedTopArea = topOfContentElementInViewport + toolbarHeight;\n\tconst hasSpaceForToolbarAbove = blockRect.top > restrictedTopArea;\n\n\tconst isBlockTallerThanViewport =\n\t\tblockRect.height > viewportHeight - toolbarHeight;\n\n\t// Sticky blocks are treated as if they will never have enough space for the toolbar above.\n\tif (\n\t\t! isSticky &&\n\t\t( hasSpaceForToolbarAbove || isBlockTallerThanViewport )\n\t) {\n\t\treturn DEFAULT_PROPS;\n\t}\n\n\treturn RESTRICTED_HEIGHT_PROPS;\n}\n\n/**\n * Determines the desired popover positioning behavior, returning a set of appropriate props.\n *\n * @param {Object} elements\n * @param {Element} elements.contentElement The DOM element that represents the editor content or canvas.\n * @param {string} elements.clientId The clientId of the first selected block.\n *\n * @return {Object} The popover props used to determine the position of the toolbar.\n */\nexport default function useBlockToolbarPopoverProps( {\n\tcontentElement,\n\tclientId,\n} ) {\n\tconst selectedBlockElement = useBlockElement( clientId );\n\tconst [ toolbarHeight, setToolbarHeight ] = useState( 0 );\n\tconst { blockIndex, isSticky } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockIndex, getBlockAttributes } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\treturn {\n\t\t\t\tblockIndex: getBlockIndex( clientId ),\n\t\t\t\tisSticky: hasStickyOrFixedPositionValue(\n\t\t\t\t\tgetBlockAttributes( clientId )\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\tconst scrollContainer = useMemo( () => {\n\t\tif ( ! contentElement ) {\n\t\t\treturn;\n\t\t}\n\t\treturn getScrollContainer( contentElement );\n\t}, [ contentElement ] );\n\tconst [ props, setProps ] = useState( () =>\n\t\tgetProps(\n\t\t\tcontentElement,\n\t\t\tselectedBlockElement,\n\t\t\tscrollContainer,\n\t\t\ttoolbarHeight,\n\t\t\tisSticky\n\t\t)\n\t);\n\n\tconst popoverRef = useRefEffect( ( popoverNode ) => {\n\t\tsetToolbarHeight( popoverNode.offsetHeight );\n\t}, [] );\n\n\tconst updateProps = useCallback(\n\t\t() =>\n\t\t\tsetProps(\n\t\t\t\tgetProps(\n\t\t\t\t\tcontentElement,\n\t\t\t\t\tselectedBlockElement,\n\t\t\t\t\tscrollContainer,\n\t\t\t\t\ttoolbarHeight,\n\t\t\t\t\tisSticky\n\t\t\t\t)\n\t\t\t),\n\t\t[ contentElement, selectedBlockElement, scrollContainer, toolbarHeight ]\n\t);\n\n\t// Update props when the block is moved. This also ensures the props are\n\t// correct on initial mount, and when the selected block or content element\n\t// changes (since the callback ref will update).\n\tuseLayoutEffect( updateProps, [ blockIndex, updateProps ] );\n\n\t// Update props when the viewport is resized or the block is resized.\n\tuseLayoutEffect( () => {\n\t\tif ( ! contentElement || ! selectedBlockElement ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Update the toolbar props on viewport resize.\n\t\tconst contentView = contentElement?.ownerDocument?.defaultView;\n\t\tcontentView?.addEventHandler?.( 'resize', updateProps );\n\n\t\t// Update the toolbar props on block resize.\n\t\tlet resizeObserver;\n\t\tconst blockView = selectedBlockElement?.ownerDocument?.defaultView;\n\t\tif ( blockView.ResizeObserver ) {\n\t\t\tresizeObserver = new blockView.ResizeObserver( updateProps );\n\t\t\tresizeObserver.observe( selectedBlockElement );\n\t\t}\n\n\t\treturn () => {\n\t\t\tcontentView?.removeEventHandler?.( 'resize', updateProps );\n\n\t\t\tif ( resizeObserver ) {\n\t\t\t\tresizeObserver.disconnect();\n\t\t\t}\n\t\t};\n\t}, [ updateProps, contentElement, selectedBlockElement ] );\n\n\treturn {\n\t\t...props,\n\t\tref: popoverRef,\n\t};\n}\n"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,IAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AAUA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,aAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AACA,IAAAO,KAAA,GAAAP,OAAA;AAnBA;AACA;AACA;;AAWA;AACA;AACA;;AAMA,MAAMQ,YAAY,GAAG;EACpBC,SAAS,EAAE;AACZ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EACA,IAAAuC,wBAAe,EAAEF,WAAW,EAAE,CAAEf,UAAU,EAAEe,WAAW,CAAG,CAAC;;EAE3D;EACA,IAAAE,wBAAe,EAAE,MAAM;IACtB,IAAK,CAAE1C,cAAc,IAAI,CAAEC,oBAAoB,EAAG;MACjD;IACD;;IAEA;IACA,MAAM0C,WAAW,GAAG3C,cAAc,EAAEa,aAAa,EAAE+B,WAAW;IAC9DD,WAAW,EAAEE,eAAe,GAAI,QAAQ,EAAEL,WAAY,CAAC;;IAEvD;IACA,IAAIM,cAAc;IAClB,MAAMC,SAAS,GAAG9C,oBAAoB,EAAEY,aAAa,EAAE+B,WAAW;IAClE,IAAKG,SAAS,CAACC,cAAc,EAAG;MAC/BF,cAAc,GAAG,IAAIC,SAAS,CAACC,cAAc,CAAER,WAAY,CAAC;MAC5DM,cAAc,CAACG,OAAO,CAAEhD,oBAAqB,CAAC;IAC/C;IAEA,OAAO,MAAM;MACZ0C,WAAW,EAAEO,kBAAkB,GAAI,QAAQ,EAAEV,WAAY,CAAC;MAE1D,IAAKM,cAAc,EAAG;QACrBA,cAAc,CAACK,UAAU,CAAC,CAAC;MAC5B;IACD,CAAC;EACF,CAAC,EAAE,CAAEX,WAAW,EAAExC,cAAc,EAAEC,oBAAoB,CAAG,CAAC;EAE1D,OAAO;IACN,GAAGiC,KAAK;IACRkB,GAAG,EAAEhB;EACN,CAAC;AACF","ignoreList":[]}
|
package/build/utils/dom.js
CHANGED
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
exports.WITH_OVERFLOW_ELEMENT_BLOCKS = void 0;
|
|
6
7
|
exports.getBlockClientId = getBlockClientId;
|
|
7
|
-
exports.
|
|
8
|
+
exports.getElementBounds = getElementBounds;
|
|
8
9
|
exports.isInSameBlock = isInSameBlock;
|
|
9
10
|
exports.isInsideRootBlock = isInsideRootBlock;
|
|
10
11
|
exports.rectUnion = rectUnion;
|
|
@@ -123,41 +124,45 @@ function isScrollable(element) {
|
|
|
123
124
|
const style = window.getComputedStyle(element);
|
|
124
125
|
return style.overflowX === 'auto' || style.overflowX === 'scroll' || style.overflowY === 'auto' || style.overflowY === 'scroll';
|
|
125
126
|
}
|
|
126
|
-
|
|
127
|
+
const WITH_OVERFLOW_ELEMENT_BLOCKS = exports.WITH_OVERFLOW_ELEMENT_BLOCKS = ['core/navigation'];
|
|
127
128
|
/**
|
|
128
|
-
* Returns the
|
|
129
|
-
*
|
|
130
|
-
* Visible nested elements, including elements that overflow the parent, are
|
|
131
|
-
* taken into account.
|
|
132
|
-
*
|
|
133
|
-
* This function is useful for calculating the visible area of a block that
|
|
134
|
-
* contains nested elements that overflow the block, e.g. the Navigation block,
|
|
135
|
-
* which can contain overflowing Submenu blocks.
|
|
129
|
+
* Returns the bounding rectangle of an element, with special handling for blocks
|
|
130
|
+
* that have visible overflowing children (defined in WITH_OVERFLOW_ELEMENT_BLOCKS).
|
|
136
131
|
*
|
|
132
|
+
* For blocks like Navigation that can have overflowing elements (e.g. submenus),
|
|
133
|
+
* this function calculates the combined bounds of both the parent and its visible
|
|
134
|
+
* children. The returned rect may extend beyond the viewport.
|
|
137
135
|
* The returned rect represents the full extent of the element and its visible
|
|
138
136
|
* children, which may extend beyond the viewport.
|
|
139
137
|
*
|
|
140
138
|
* @param {Element} element Element.
|
|
141
139
|
* @return {DOMRect} Bounding client rect of the element and its visible children.
|
|
142
140
|
*/
|
|
143
|
-
function
|
|
141
|
+
function getElementBounds(element) {
|
|
144
142
|
const viewport = element.ownerDocument.defaultView;
|
|
145
143
|
if (!viewport) {
|
|
146
144
|
return new window.DOMRectReadOnly();
|
|
147
145
|
}
|
|
148
146
|
let bounds = element.getBoundingClientRect();
|
|
149
|
-
const
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
147
|
+
const dataType = element.getAttribute('data-type');
|
|
148
|
+
|
|
149
|
+
/*
|
|
150
|
+
* For blocks with overflowing elements (like Navigation), include the bounds
|
|
151
|
+
* of visible children that extend beyond the parent container.
|
|
152
|
+
*/
|
|
153
|
+
if (dataType && WITH_OVERFLOW_ELEMENT_BLOCKS.includes(dataType)) {
|
|
154
|
+
const stack = [element];
|
|
155
|
+
let currentElement;
|
|
156
|
+
while (currentElement = stack.pop()) {
|
|
157
|
+
// Children won’t affect bounds unless the element is not scrollable.
|
|
158
|
+
if (!isScrollable(currentElement)) {
|
|
159
|
+
for (const child of currentElement.children) {
|
|
160
|
+
if (isElementVisible(child)) {
|
|
161
|
+
const childBounds = child.getBoundingClientRect();
|
|
162
|
+
bounds = rectUnion(bounds, childBounds);
|
|
163
|
+
stack.push(child);
|
|
164
|
+
}
|
|
158
165
|
}
|
|
159
|
-
bounds = rectUnion(bounds, childBounds);
|
|
160
|
-
stack.push(child);
|
|
161
166
|
}
|
|
162
167
|
}
|
|
163
168
|
}
|
package/build/utils/dom.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["BLOCK_SELECTOR","APPENDER_SELECTOR","BLOCK_APPENDER_CLASS","isInSameBlock","a","b","closest","isInsideRootBlock","blockElement","element","parentBlock","join","getBlockClientId","node","nodeType","ELEMENT_NODE","parentNode","elementNode","blockNode","id","slice","length","rectUnion","rect1","rect2","left","Math","min","right","max","bottom","top","window","DOMRectReadOnly","isElementVisible","viewport","ownerDocument","defaultView","classList","contains","bounds","getBoundingClientRect","width","height","checkVisibility","opacityProperty","contentVisibilityAuto","visibilityProperty","style","getComputedStyle","display","visibility","opacity","isScrollable","overflowX","overflowY","getVisibleElementBounds","stack","currentElement","pop","child","children","childBounds","push","innerWidth"],"sources":["@wordpress/block-editor/src/utils/dom.js"],"sourcesContent":["const BLOCK_SELECTOR = '.block-editor-block-list__block';\nconst APPENDER_SELECTOR = '.block-list-appender';\nconst BLOCK_APPENDER_CLASS = '.block-editor-button-block-appender';\n\n/**\n * Returns true if two elements are contained within the same block.\n *\n * @param {Element} a First element.\n * @param {Element} b Second element.\n *\n * @return {boolean} Whether elements are in the same block.\n */\nexport function isInSameBlock( a, b ) {\n\treturn a.closest( BLOCK_SELECTOR ) === b.closest( BLOCK_SELECTOR );\n}\n\n/**\n * Returns true if an element is considered part of the block and not its inner\n * blocks or appender.\n *\n * @param {Element} blockElement Block container element.\n * @param {Element} element Element.\n *\n * @return {boolean} Whether an element is considered part of the block and not\n * its inner blocks or appender.\n */\nexport function isInsideRootBlock( blockElement, element ) {\n\tconst parentBlock = element.closest(\n\t\t[ BLOCK_SELECTOR, APPENDER_SELECTOR, BLOCK_APPENDER_CLASS ].join( ',' )\n\t);\n\treturn parentBlock === blockElement;\n}\n\n/**\n * Finds the block client ID given any DOM node inside the block.\n *\n * @param {Node?} node DOM node.\n *\n * @return {string|undefined} Client ID or undefined if the node is not part of\n * a block.\n */\nexport function getBlockClientId( node ) {\n\twhile ( node && node.nodeType !== node.ELEMENT_NODE ) {\n\t\tnode = node.parentNode;\n\t}\n\n\tif ( ! node ) {\n\t\treturn;\n\t}\n\n\tconst elementNode = /** @type {Element} */ ( node );\n\tconst blockNode = elementNode.closest( BLOCK_SELECTOR );\n\n\tif ( ! blockNode ) {\n\t\treturn;\n\t}\n\n\treturn blockNode.id.slice( 'block-'.length );\n}\n\n/**\n * Calculates the union of two rectangles.\n *\n * @param {DOMRect} rect1 First rectangle.\n * @param {DOMRect} rect2 Second rectangle.\n * @return {DOMRect} Union of the two rectangles.\n */\nexport function rectUnion( rect1, rect2 ) {\n\tconst left = Math.min( rect1.left, rect2.left );\n\tconst right = Math.max( rect1.right, rect2.right );\n\tconst bottom = Math.max( rect1.bottom, rect2.bottom );\n\tconst top = Math.min( rect1.top, rect2.top );\n\n\treturn new window.DOMRectReadOnly( left, top, right - left, bottom - top );\n}\n\n/**\n * Returns whether an element is visible.\n *\n * @param {Element} element Element.\n * @return {boolean} Whether the element is visible.\n */\nfunction isElementVisible( element ) {\n\tconst viewport = element.ownerDocument.defaultView;\n\tif ( ! viewport ) {\n\t\treturn false;\n\t}\n\n\t// Check for <VisuallyHidden> component.\n\tif ( element.classList.contains( 'components-visually-hidden' ) ) {\n\t\treturn false;\n\t}\n\n\tconst bounds = element.getBoundingClientRect();\n\tif ( bounds.width === 0 || bounds.height === 0 ) {\n\t\treturn false;\n\t}\n\n\t// Older browsers, e.g. Safari < 17.4 may not support the `checkVisibility` method.\n\tif ( element.checkVisibility ) {\n\t\treturn element.checkVisibility?.( {\n\t\t\topacityProperty: true,\n\t\t\tcontentVisibilityAuto: true,\n\t\t\tvisibilityProperty: true,\n\t\t} );\n\t}\n\n\tconst style = viewport.getComputedStyle( element );\n\n\tif (\n\t\tstyle.display === 'none' ||\n\t\tstyle.visibility === 'hidden' ||\n\t\tstyle.opacity === '0'\n\t) {\n\t\treturn false;\n\t}\n\n\treturn true;\n}\n\n/**\n * Checks if the element is scrollable.\n *\n * @param {Element} element Element.\n * @return {boolean} True if the element is scrollable.\n */\nfunction isScrollable( element ) {\n\tconst style = window.getComputedStyle( element );\n\treturn (\n\t\tstyle.overflowX === 'auto' ||\n\t\tstyle.overflowX === 'scroll' ||\n\t\tstyle.overflowY === 'auto' ||\n\t\tstyle.overflowY === 'scroll'\n\t);\n}\n\n/**\n * Returns the rect of the element including all visible nested elements.\n *\n * Visible nested elements, including elements that overflow the parent, are\n * taken into account.\n *\n * This function is useful for calculating the visible area of a block that\n * contains nested elements that overflow the block, e.g. the Navigation block,\n * which can contain overflowing Submenu blocks.\n *\n * The returned rect represents the full extent of the element and its visible\n * children, which may extend beyond the viewport.\n *\n * @param {Element} element Element.\n * @return {DOMRect} Bounding client rect of the element and its visible children.\n */\nexport function getVisibleElementBounds( element ) {\n\tconst viewport = element.ownerDocument.defaultView;\n\n\tif ( ! viewport ) {\n\t\treturn new window.DOMRectReadOnly();\n\t}\n\n\tlet bounds = element.getBoundingClientRect();\n\tconst stack = [ element ];\n\tlet currentElement;\n\n\twhile ( ( currentElement = stack.pop() ) ) {\n\t\tfor ( const child of currentElement.children ) {\n\t\t\tif ( isElementVisible( child ) ) {\n\t\t\t\tlet childBounds = child.getBoundingClientRect();\n\t\t\t\t// If the parent is scrollable, use parent's scrollable bounds.\n\t\t\t\tif ( isScrollable( currentElement ) ) {\n\t\t\t\t\tchildBounds = currentElement.getBoundingClientRect();\n\t\t\t\t}\n\t\t\t\tbounds = rectUnion( bounds, childBounds );\n\t\t\t\tstack.push( child );\n\t\t\t}\n\t\t}\n\t}\n\n\t/*\n\t * Take into account the outer horizontal limits of the container in which\n\t * an element is supposed to be \"visible\". For example, if an element is\n\t * positioned -10px to the left of the window x value (0), this function\n\t * discounts the negative overhang because it's not visible and therefore\n\t * not to be counted in the visibility calculations. Top and bottom values\n\t * are not accounted for to accommodate vertical scroll.\n\t */\n\tconst left = Math.max( bounds.left, 0 );\n\tconst right = Math.min( bounds.right, viewport.innerWidth );\n\tbounds = new window.DOMRectReadOnly(\n\t\tleft,\n\t\tbounds.top,\n\t\tright - left,\n\t\tbounds.height\n\t);\n\n\treturn bounds;\n}\n"],"mappings":";;;;;;;;;;AAAA,MAAMA,cAAc,GAAG,iCAAiC;AACxD,MAAMC,iBAAiB,GAAG,sBAAsB;AAChD,MAAMC,oBAAoB,GAAG,qCAAqC;;AAElE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,aAAaA,CAAEC,CAAC,EAAEC,CAAC,EAAG;EACrC,OAAOD,CAAC,CAACE,OAAO,CAAEN,cAAe,CAAC,KAAKK,CAAC,CAACC,OAAO,CAAEN,cAAe,CAAC;AACnE;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASO,iBAAiBA,CAAEC,YAAY,EAAEC,OAAO,EAAG;EAC1D,MAAMC,WAAW,GAAGD,OAAO,CAACH,OAAO,CAClC,CAAEN,cAAc,EAAEC,iBAAiB,EAAEC,oBAAoB,CAAE,CAACS,IAAI,CAAE,GAAI,CAC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S","isInSameBlock","a","b","closest","isInsideRootBlock","blockElement","element","parentBlock","join","getBlockClientId","node","nodeType","ELEMENT_NODE","parentNode","elementNode","blockNode","id","slice","length","rectUnion","rect1","rect2","left","Math","min","right","max","bottom","top","window","DOMRectReadOnly","isElementVisible","viewport","ownerDocument","defaultView","classList","contains","bounds","getBoundingClientRect","width","height","checkVisibility","opacityProperty","contentVisibilityAuto","visibilityProperty","style","getComputedStyle","display","visibility","opacity","isScrollable","overflowX","overflowY","WITH_OVERFLOW_ELEMENT_BLOCKS","exports","getElementBounds","dataType","getAttribute","includes","stack","currentElement","pop","child","children","childBounds","push","innerWidth"],"sources":["@wordpress/block-editor/src/utils/dom.js"],"sourcesContent":["const BLOCK_SELECTOR = '.block-editor-block-list__block';\nconst APPENDER_SELECTOR = '.block-list-appender';\nconst BLOCK_APPENDER_CLASS = '.block-editor-button-block-appender';\n\n/**\n * Returns true if two elements are contained within the same block.\n *\n * @param {Element} a First element.\n * @param {Element} b Second element.\n *\n * @return {boolean} Whether elements are in the same block.\n */\nexport function isInSameBlock( a, b ) {\n\treturn a.closest( BLOCK_SELECTOR ) === b.closest( BLOCK_SELECTOR );\n}\n\n/**\n * Returns true if an element is considered part of the block and not its inner\n * blocks or appender.\n *\n * @param {Element} blockElement Block container element.\n * @param {Element} element Element.\n *\n * @return {boolean} Whether an element is considered part of the block and not\n * its inner blocks or appender.\n */\nexport function isInsideRootBlock( blockElement, element ) {\n\tconst parentBlock = element.closest(\n\t\t[ BLOCK_SELECTOR, APPENDER_SELECTOR, BLOCK_APPENDER_CLASS ].join( ',' )\n\t);\n\treturn parentBlock === blockElement;\n}\n\n/**\n * Finds the block client ID given any DOM node inside the block.\n *\n * @param {Node?} node DOM node.\n *\n * @return {string|undefined} Client ID or undefined if the node is not part of\n * a block.\n */\nexport function getBlockClientId( node ) {\n\twhile ( node && node.nodeType !== node.ELEMENT_NODE ) {\n\t\tnode = node.parentNode;\n\t}\n\n\tif ( ! node ) {\n\t\treturn;\n\t}\n\n\tconst elementNode = /** @type {Element} */ ( node );\n\tconst blockNode = elementNode.closest( BLOCK_SELECTOR );\n\n\tif ( ! blockNode ) {\n\t\treturn;\n\t}\n\n\treturn blockNode.id.slice( 'block-'.length );\n}\n\n/**\n * Calculates the union of two rectangles.\n *\n * @param {DOMRect} rect1 First rectangle.\n * @param {DOMRect} rect2 Second rectangle.\n * @return {DOMRect} Union of the two rectangles.\n */\nexport function rectUnion( rect1, rect2 ) {\n\tconst left = Math.min( rect1.left, rect2.left );\n\tconst right = Math.max( rect1.right, rect2.right );\n\tconst bottom = Math.max( rect1.bottom, rect2.bottom );\n\tconst top = Math.min( rect1.top, rect2.top );\n\n\treturn new window.DOMRectReadOnly( left, top, right - left, bottom - top );\n}\n\n/**\n * Returns whether an element is visible.\n *\n * @param {Element} element Element.\n * @return {boolean} Whether the element is visible.\n */\nfunction isElementVisible( element ) {\n\tconst viewport = element.ownerDocument.defaultView;\n\tif ( ! viewport ) {\n\t\treturn false;\n\t}\n\n\t// Check for <VisuallyHidden> component.\n\tif ( element.classList.contains( 'components-visually-hidden' ) ) {\n\t\treturn false;\n\t}\n\n\tconst bounds = element.getBoundingClientRect();\n\tif ( bounds.width === 0 || bounds.height === 0 ) {\n\t\treturn false;\n\t}\n\n\t// Older browsers, e.g. Safari < 17.4 may not support the `checkVisibility` method.\n\tif ( element.checkVisibility ) {\n\t\treturn element.checkVisibility?.( {\n\t\t\topacityProperty: true,\n\t\t\tcontentVisibilityAuto: true,\n\t\t\tvisibilityProperty: true,\n\t\t} );\n\t}\n\n\tconst style = viewport.getComputedStyle( element );\n\n\tif (\n\t\tstyle.display === 'none' ||\n\t\tstyle.visibility === 'hidden' ||\n\t\tstyle.opacity === '0'\n\t) {\n\t\treturn false;\n\t}\n\n\treturn true;\n}\n\n/**\n * Checks if the element is scrollable.\n *\n * @param {Element} element Element.\n * @return {boolean} True if the element is scrollable.\n */\nfunction isScrollable( element ) {\n\tconst style = window.getComputedStyle( element );\n\treturn (\n\t\tstyle.overflowX === 'auto' ||\n\t\tstyle.overflowX === 'scroll' ||\n\t\tstyle.overflowY === 'auto' ||\n\t\tstyle.overflowY === 'scroll'\n\t);\n}\n\nexport const WITH_OVERFLOW_ELEMENT_BLOCKS = [ 'core/navigation' ];\n/**\n * Returns the bounding rectangle of an element, with special handling for blocks\n * that have visible overflowing children (defined in WITH_OVERFLOW_ELEMENT_BLOCKS).\n *\n * For blocks like Navigation that can have overflowing elements (e.g. submenus),\n * this function calculates the combined bounds of both the parent and its visible\n * children. The returned rect may extend beyond the viewport.\n * The returned rect represents the full extent of the element and its visible\n * children, which may extend beyond the viewport.\n *\n * @param {Element} element Element.\n * @return {DOMRect} Bounding client rect of the element and its visible children.\n */\nexport function getElementBounds( element ) {\n\tconst viewport = element.ownerDocument.defaultView;\n\n\tif ( ! viewport ) {\n\t\treturn new window.DOMRectReadOnly();\n\t}\n\n\tlet bounds = element.getBoundingClientRect();\n\tconst dataType = element.getAttribute( 'data-type' );\n\n\t/*\n\t * For blocks with overflowing elements (like Navigation), include the bounds\n\t * of visible children that extend beyond the parent container.\n\t */\n\tif ( dataType && WITH_OVERFLOW_ELEMENT_BLOCKS.includes( dataType ) ) {\n\t\tconst stack = [ element ];\n\t\tlet currentElement;\n\n\t\twhile ( ( currentElement = stack.pop() ) ) {\n\t\t\t// Children won’t affect bounds unless the element is not scrollable.\n\t\t\tif ( ! isScrollable( currentElement ) ) {\n\t\t\t\tfor ( const child of currentElement.children ) {\n\t\t\t\t\tif ( isElementVisible( child ) ) {\n\t\t\t\t\t\tconst childBounds = child.getBoundingClientRect();\n\t\t\t\t\t\tbounds = rectUnion( bounds, childBounds );\n\t\t\t\t\t\tstack.push( child );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t/*\n\t * Take into account the outer horizontal limits of the container in which\n\t * an element is supposed to be \"visible\". For example, if an element is\n\t * positioned -10px to the left of the window x value (0), this function\n\t * discounts the negative overhang because it's not visible and therefore\n\t * not to be counted in the visibility calculations. Top and bottom values\n\t * are not accounted for to accommodate vertical scroll.\n\t */\n\tconst left = Math.max( bounds.left, 0 );\n\tconst right = Math.min( bounds.right, viewport.innerWidth );\n\tbounds = new window.DOMRectReadOnly(\n\t\tleft,\n\t\tbounds.top,\n\t\tright - left,\n\t\tbounds.height\n\t);\n\n\treturn bounds;\n}\n"],"mappings":";;;;;;;;;;;AAAA,MAAMA,cAAc,GAAG,iCAAiC;AACxD,MAAMC,iBAAiB,GAAG,sBAAsB;AAChD,MAAMC,oBAAoB,GAAG,qCAAqC;;AAElE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,aAAaA,CAAEC,CAAC,EAAEC,CAAC,EAAG;EACrC,OAAOD,CAAC,CAACE,OAAO,CAAEN,cAAe,CAAC,KAAKK,CAAC,CAACC,OAAO,CAAEN,cAAe,CAAC;AACnE;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASO,iBAAiBA,CAAEC,YAAY,EAAEC,OAAO,EAAG;EAC1D,MAAMC,WAAW,GAAGD,OAAO,CAACH,OAAO,CAClC,CAAEN,cAAc,EAAEC,iBAAiB,EAAEC,oBAAoB,CAAE,CAACS,IAAI,CAAE,GAAI,CACvE,CAAC;EACD,OAAOD,WAAW,KAAKF,YAAY;AACpC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASI,gBAAgBA,CAAEC,IAAI,EAAG;EACxC,OAAQA,IAAI,IAAIA,IAAI,CAACC,QAAQ,KAAKD,IAAI,CAACE,YAAY,EAAG;IACrDF,IAAI,GAAGA,IAAI,CAACG,UAAU;EACvB;EAEA,IAAK,CAAEH,IAAI,EAAG;IACb;EACD;EAEA,MAAMI,WAAW,GAAG,sBAAyBJ,IAAM;EACnD,MAAMK,SAAS,GAAGD,WAAW,CAACX,OAAO,CAAEN,cAAe,CAAC;EAEvD,IAAK,CAAEkB,SAAS,EAAG;IAClB;EACD;EAEA,OAAOA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MG,KAAK,GAAG,CAAErD,OAAO,CAAE;IACzB,IAAIsD,cAAc;IAElB,OAAUA,cAAc,GAAGD,KAAK,CAACE,GAAG,CAAC,CAAC,EAAK;MAC1C;MACA,IAAK,CAAEX,YAAY,CAAEU,cAAe,CAAC,EAAG;QACvC,KAAM,MAAME,KAAK,IAAIF,cAAc,CAACG,QAAQ,EAAG;UAC9C,IAAKhC,gBAAgB,CAAE+B,KAAM,CAAC,EAAG;YAChC,MAAME,WAAW,GAAGF,KAAK,CAACxB,qBAAqB,CAAC,CAAC;YACjDD,MAAM,GAAGlB,SAAS,CAAEkB,MAAM,EAAE2B,WAAY,CAAC;YACzCL,KAAK,CAACM,IAAI,CAAEH,KAAM,CAAC;UACpB;QACD;MACD;IACD;EACD;;EAEA;AACD;AACA;AACA;AACA;AACA;AACA;AACA;EACC,MAAMxC,IAAI,GAAGC,IAAI,CAACG,GAAG,CAAEW,MAAM,CAACf,IAAI,EAAE,CAAE,CAAC;EACvC,MAAMG,KAAK,GAAGF,IAAI,CAACC,GAAG,CAAEa,MAAM,CAACZ,KAAK,EAAEO,QAAQ,CAACkC,UAAW,CAAC;EAC3D7B,MAAM,GAAG,IAAIR,MAAM,CAACC,eAAe,CAClCR,IAAI,EACJe,MAAM,CAACT,GAAG,EACVH,KAAK,GAAGH,IAAI,EACZe,MAAM,CAACG,MACR,CAAC;EAED,OAAOH,MAAM;AACd","ignoreList":[]}
|
|
@@ -15,7 +15,7 @@ import { forwardRef, useMemo, useReducer, useLayoutEffect } from '@wordpress/ele
|
|
|
15
15
|
*/
|
|
16
16
|
import { useBlockElement } from '../block-list/use-block-props/use-block-refs';
|
|
17
17
|
import usePopoverScroll from './use-popover-scroll';
|
|
18
|
-
import { rectUnion,
|
|
18
|
+
import { rectUnion, getElementBounds } from '../../utils/dom';
|
|
19
19
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
20
20
|
const MAX_POPOVER_RECOMPUTE_COUNTER = Number.MAX_SAFE_INTEGER;
|
|
21
21
|
function BlockPopover({
|
|
@@ -63,7 +63,7 @@ function BlockPopover({
|
|
|
63
63
|
}
|
|
64
64
|
return {
|
|
65
65
|
getBoundingClientRect() {
|
|
66
|
-
return lastSelectedElement ? rectUnion(
|
|
66
|
+
return lastSelectedElement ? rectUnion(getElementBounds(selectedElement), getElementBounds(lastSelectedElement)) : getElementBounds(selectedElement);
|
|
67
67
|
},
|
|
68
68
|
contextElement: selectedElement
|
|
69
69
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["clsx","useMergeRefs","Popover","forwardRef","useMemo","useReducer","useLayoutEffect","useBlockElement","usePopoverScroll","rectUnion","
|
|
1
|
+
{"version":3,"names":["clsx","useMergeRefs","Popover","forwardRef","useMemo","useReducer","useLayoutEffect","useBlockElement","usePopoverScroll","rectUnion","getElementBounds","jsx","_jsx","MAX_POPOVER_RECOMPUTE_COUNTER","Number","MAX_SAFE_INTEGER","BlockPopover","clientId","bottomClientId","children","__unstablePopoverSlot","__unstableContentRef","shift","props","ref","selectedElement","lastSelectedElement","mergedRefs","popoverDimensionsRecomputeCounter","forceRecomputePopoverDimensions","s","observer","window","MutationObserver","observe","attributes","disconnect","popoverAnchor","undefined","getBoundingClientRect","contextElement","animate","focusOnMount","anchor","__unstableSlotName","inline","placement","resize","flip","className","variant","PrivateBlockPopover","PublicBlockPopover"],"sources":["@wordpress/block-editor/src/components/block-popover/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useMergeRefs } from '@wordpress/compose';\nimport { Popover } from '@wordpress/components';\nimport {\n\tforwardRef,\n\tuseMemo,\n\tuseReducer,\n\tuseLayoutEffect,\n} from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { useBlockElement } from '../block-list/use-block-props/use-block-refs';\nimport usePopoverScroll from './use-popover-scroll';\nimport { rectUnion, getElementBounds } from '../../utils/dom';\n\nconst MAX_POPOVER_RECOMPUTE_COUNTER = Number.MAX_SAFE_INTEGER;\n\nfunction BlockPopover(\n\t{\n\t\tclientId,\n\t\tbottomClientId,\n\t\tchildren,\n\t\t__unstablePopoverSlot,\n\t\t__unstableContentRef,\n\t\tshift = true,\n\t\t...props\n\t},\n\tref\n) {\n\tconst selectedElement = useBlockElement( clientId );\n\tconst lastSelectedElement = useBlockElement( bottomClientId ?? clientId );\n\tconst mergedRefs = useMergeRefs( [\n\t\tref,\n\t\tusePopoverScroll( __unstableContentRef ),\n\t] );\n\n\tconst [\n\t\tpopoverDimensionsRecomputeCounter,\n\t\tforceRecomputePopoverDimensions,\n\t] = useReducer(\n\t\t// Module is there to make sure that the counter doesn't overflow.\n\t\t( s ) => ( s + 1 ) % MAX_POPOVER_RECOMPUTE_COUNTER,\n\t\t0\n\t);\n\n\t// When blocks are moved up/down, they are animated to their new position by\n\t// updating the `transform` property manually (i.e. without using CSS\n\t// transitions or animations). The animation, which can also scroll the block\n\t// editor, can sometimes cause the position of the Popover to get out of sync.\n\t// A MutationObserver is therefore used to make sure that changes to the\n\t// selectedElement's attribute (i.e. `transform`) can be tracked and used to\n\t// trigger the Popover to rerender.\n\tuseLayoutEffect( () => {\n\t\tif ( ! selectedElement ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst observer = new window.MutationObserver(\n\t\t\tforceRecomputePopoverDimensions\n\t\t);\n\t\tobserver.observe( selectedElement, { attributes: true } );\n\n\t\treturn () => {\n\t\t\tobserver.disconnect();\n\t\t};\n\t}, [ selectedElement ] );\n\n\tconst popoverAnchor = useMemo( () => {\n\t\tif (\n\t\t\t// popoverDimensionsRecomputeCounter is by definition always equal or greater\n\t\t\t// than 0. This check is only there to satisfy the correctness of the\n\t\t\t// exhaustive-deps rule for the `useMemo` hook.\n\t\t\tpopoverDimensionsRecomputeCounter < 0 ||\n\t\t\t! selectedElement ||\n\t\t\t( bottomClientId && ! lastSelectedElement )\n\t\t) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\treturn {\n\t\t\tgetBoundingClientRect() {\n\t\t\t\treturn lastSelectedElement\n\t\t\t\t\t? rectUnion(\n\t\t\t\t\t\t\tgetElementBounds( selectedElement ),\n\t\t\t\t\t\t\tgetElementBounds( lastSelectedElement )\n\t\t\t\t\t )\n\t\t\t\t\t: getElementBounds( selectedElement );\n\t\t\t},\n\t\t\tcontextElement: selectedElement,\n\t\t};\n\t}, [\n\t\tpopoverDimensionsRecomputeCounter,\n\t\tselectedElement,\n\t\tbottomClientId,\n\t\tlastSelectedElement,\n\t] );\n\n\tif ( ! selectedElement || ( bottomClientId && ! lastSelectedElement ) ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Popover\n\t\t\tref={ mergedRefs }\n\t\t\tanimate={ false }\n\t\t\tfocusOnMount={ false }\n\t\t\tanchor={ popoverAnchor }\n\t\t\t// Render in the old slot if needed for backward compatibility,\n\t\t\t// otherwise render in place (not in the default popover slot).\n\t\t\t__unstableSlotName={ __unstablePopoverSlot }\n\t\t\tinline={ ! __unstablePopoverSlot }\n\t\t\tplacement=\"top-start\"\n\t\t\tresize={ false }\n\t\t\tflip={ false }\n\t\t\tshift={ shift }\n\t\t\t{ ...props }\n\t\t\tclassName={ clsx( 'block-editor-block-popover', props.className ) }\n\t\t\tvariant=\"unstyled\"\n\t\t>\n\t\t\t{ children }\n\t\t</Popover>\n\t);\n}\n\nexport const PrivateBlockPopover = forwardRef( BlockPopover );\n\nconst PublicBlockPopover = (\n\t{ clientId, bottomClientId, children, ...props },\n\tref\n) => (\n\t<PrivateBlockPopover\n\t\t{ ...props }\n\t\tbottomClientId={ bottomClientId }\n\t\tclientId={ clientId }\n\t\t__unstableContentRef={ undefined }\n\t\t__unstablePopoverSlot={ undefined }\n\t\tref={ ref }\n\t>\n\t\t{ children }\n\t</PrivateBlockPopover>\n);\n\n/**\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-popover/README.md\n */\nexport default forwardRef( PublicBlockPopover );\n"],"mappings":"AAAA;AACA;AACA;A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AC;AAE7D,MAAMoC,kBAAkB,GAAGA,CAC1B;EAAEnC,QAAQ;EAAEC,cAAc;EAAEC,QAAQ;EAAE,GAAGI;AAAM,CAAC,EAChDC,GAAG,kBAEHZ,IAAA,CAACuC,mBAAmB;EAAA,GACd5B,KAAK;EACVL,cAAc,EAAGA,cAAgB;EACjCD,QAAQ,EAAGA,QAAU;EACrBI,oBAAoB,EAAGiB,SAAW;EAClClB,qBAAqB,EAAGkB,SAAW;EACnCd,GAAG,EAAGA,GAAK;EAAAL,QAAA,EAETA;AAAQ,CACU,CACrB;;AAED;AACA;AACA;AACA,eAAehB,UAAU,CAAEiD,kBAAmB,CAAC","ignoreList":[]}
|
|
@@ -12,7 +12,7 @@ import { useCallback, useLayoutEffect, useMemo, useState } from '@wordpress/elem
|
|
|
12
12
|
import { store as blockEditorStore } from '../../store';
|
|
13
13
|
import { useBlockElement } from '../block-list/use-block-props/use-block-refs';
|
|
14
14
|
import { hasStickyOrFixedPositionValue } from '../../hooks/position';
|
|
15
|
-
import {
|
|
15
|
+
import { getElementBounds } from '../../utils/dom';
|
|
16
16
|
const COMMON_PROPS = {
|
|
17
17
|
placement: 'top-start'
|
|
18
18
|
};
|
|
@@ -55,7 +55,7 @@ function getProps(contentElement, selectedBlockElement, scrollContainer, toolbar
|
|
|
55
55
|
|
|
56
56
|
// Get how far the content area has been scrolled.
|
|
57
57
|
const scrollTop = scrollContainer?.scrollTop || 0;
|
|
58
|
-
const blockRect =
|
|
58
|
+
const blockRect = getElementBounds(selectedBlockElement);
|
|
59
59
|
const contentRect = contentElement.getBoundingClientRect();
|
|
60
60
|
|
|
61
61
|
// Get the vertical position of top of the visible content area.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useRefEffect","useSelect","getScrollContainer","useCallback","useLayoutEffect","useMemo","useState","store","blockEditorStore","useBlockElement","hasStickyOrFixedPositionValue","getVisibleElementBounds","COMMON_PROPS","placement","DEFAULT_PROPS","flip","shift","RESTRICTED_HEIGHT_PROPS","getProps","contentElement","selectedBlockElement","scrollContainer","toolbarHeight","isSticky","scrollTop","blockRect","contentRect","getBoundingClientRect","topOfContentElementInViewport","top","viewportHeight","ownerDocument","documentElement","clientHeight","restrictedTopArea","hasSpaceForToolbarAbove","isBlockTallerThanViewport","height","useBlockToolbarPopoverProps","clientId","setToolbarHeight","blockIndex","select","getBlockIndex","getBlockAttributes","props","setProps","popoverRef","popoverNode","offsetHeight","updateProps","contentView","defaultView","addEventHandler","resizeObserver","blockView","ResizeObserver","observe","removeEventHandler","disconnect","ref"],"sources":["@wordpress/block-editor/src/components/block-tools/use-block-toolbar-popover-props.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useRefEffect } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\nimport { getScrollContainer } from '@wordpress/dom';\nimport {\n\tuseCallback,\n\tuseLayoutEffect,\n\tuseMemo,\n\tuseState,\n} from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { useBlockElement } from '../block-list/use-block-props/use-block-refs';\nimport { hasStickyOrFixedPositionValue } from '../../hooks/position';\nimport { getVisibleElementBounds } from '../../utils/dom';\n\nconst COMMON_PROPS = {\n\tplacement: 'top-start',\n};\n\n// By default the toolbar sets the `shift` prop. If the user scrolls the page\n// down the toolbar will stay on screen by adopting a sticky position at the\n// top of the viewport.\nconst DEFAULT_PROPS = {\n\t...COMMON_PROPS,\n\tflip: false,\n\tshift: true,\n};\n\n// When there isn't enough height between the top of the block and the editor\n// canvas, the `shift` prop is set to `false`, as it will cause the block to be\n// obscured. The `flip` behavior is enabled, which positions the toolbar below\n// the block. This only happens if the block is smaller than the viewport, as\n// otherwise the toolbar will be off-screen.\nconst RESTRICTED_HEIGHT_PROPS = {\n\t...COMMON_PROPS,\n\tflip: true,\n\tshift: false,\n};\n\n/**\n * Get the popover props for the block toolbar, determined by the space at the top of the canvas and the toolbar height.\n *\n * @param {Element} contentElement The DOM element that represents the editor content or canvas.\n * @param {Element} selectedBlockElement The outer DOM element of the first selected block.\n * @param {Element} scrollContainer The scrollable container for the contentElement.\n * @param {number} toolbarHeight The height of the toolbar in pixels.\n * @param {boolean} isSticky Whether or not the selected block is sticky or fixed.\n *\n * @return {Object} The popover props used to determine the position of the toolbar.\n */\nfunction getProps(\n\tcontentElement,\n\tselectedBlockElement,\n\tscrollContainer,\n\ttoolbarHeight,\n\tisSticky\n) {\n\tif ( ! contentElement || ! selectedBlockElement ) {\n\t\treturn DEFAULT_PROPS;\n\t}\n\n\t// Get how far the content area has been scrolled.\n\tconst scrollTop = scrollContainer?.scrollTop || 0;\n\n\tconst blockRect = getVisibleElementBounds( selectedBlockElement );\n\tconst contentRect = contentElement.getBoundingClientRect();\n\n\t// Get the vertical position of top of the visible content area.\n\tconst topOfContentElementInViewport = scrollTop + contentRect.top;\n\n\t// The document element's clientHeight represents the viewport height.\n\tconst viewportHeight =\n\t\tcontentElement.ownerDocument.documentElement.clientHeight;\n\n\t// The restricted height area is calculated as the sum of the\n\t// vertical position of the visible content area, plus the height\n\t// of the block toolbar.\n\tconst restrictedTopArea = topOfContentElementInViewport + toolbarHeight;\n\tconst hasSpaceForToolbarAbove = blockRect.top > restrictedTopArea;\n\n\tconst isBlockTallerThanViewport =\n\t\tblockRect.height > viewportHeight - toolbarHeight;\n\n\t// Sticky blocks are treated as if they will never have enough space for the toolbar above.\n\tif (\n\t\t! isSticky &&\n\t\t( hasSpaceForToolbarAbove || isBlockTallerThanViewport )\n\t) {\n\t\treturn DEFAULT_PROPS;\n\t}\n\n\treturn RESTRICTED_HEIGHT_PROPS;\n}\n\n/**\n * Determines the desired popover positioning behavior, returning a set of appropriate props.\n *\n * @param {Object} elements\n * @param {Element} elements.contentElement The DOM element that represents the editor content or canvas.\n * @param {string} elements.clientId The clientId of the first selected block.\n *\n * @return {Object} The popover props used to determine the position of the toolbar.\n */\nexport default function useBlockToolbarPopoverProps( {\n\tcontentElement,\n\tclientId,\n} ) {\n\tconst selectedBlockElement = useBlockElement( clientId );\n\tconst [ toolbarHeight, setToolbarHeight ] = useState( 0 );\n\tconst { blockIndex, isSticky } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockIndex, getBlockAttributes } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\treturn {\n\t\t\t\tblockIndex: getBlockIndex( clientId ),\n\t\t\t\tisSticky: hasStickyOrFixedPositionValue(\n\t\t\t\t\tgetBlockAttributes( clientId )\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\tconst scrollContainer = useMemo( () => {\n\t\tif ( ! contentElement ) {\n\t\t\treturn;\n\t\t}\n\t\treturn getScrollContainer( contentElement );\n\t}, [ contentElement ] );\n\tconst [ props, setProps ] = useState( () =>\n\t\tgetProps(\n\t\t\tcontentElement,\n\t\t\tselectedBlockElement,\n\t\t\tscrollContainer,\n\t\t\ttoolbarHeight,\n\t\t\tisSticky\n\t\t)\n\t);\n\n\tconst popoverRef = useRefEffect( ( popoverNode ) => {\n\t\tsetToolbarHeight( popoverNode.offsetHeight );\n\t}, [] );\n\n\tconst updateProps = useCallback(\n\t\t() =>\n\t\t\tsetProps(\n\t\t\t\tgetProps(\n\t\t\t\t\tcontentElement,\n\t\t\t\t\tselectedBlockElement,\n\t\t\t\t\tscrollContainer,\n\t\t\t\t\ttoolbarHeight,\n\t\t\t\t\tisSticky\n\t\t\t\t)\n\t\t\t),\n\t\t[ contentElement, selectedBlockElement, scrollContainer, toolbarHeight ]\n\t);\n\n\t// Update props when the block is moved. This also ensures the props are\n\t// correct on initial mount, and when the selected block or content element\n\t// changes (since the callback ref will update).\n\tuseLayoutEffect( updateProps, [ blockIndex, updateProps ] );\n\n\t// Update props when the viewport is resized or the block is resized.\n\tuseLayoutEffect( () => {\n\t\tif ( ! contentElement || ! selectedBlockElement ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Update the toolbar props on viewport resize.\n\t\tconst contentView = contentElement?.ownerDocument?.defaultView;\n\t\tcontentView?.addEventHandler?.( 'resize', updateProps );\n\n\t\t// Update the toolbar props on block resize.\n\t\tlet resizeObserver;\n\t\tconst blockView = selectedBlockElement?.ownerDocument?.defaultView;\n\t\tif ( blockView.ResizeObserver ) {\n\t\t\tresizeObserver = new blockView.ResizeObserver( updateProps );\n\t\t\tresizeObserver.observe( selectedBlockElement );\n\t\t}\n\n\t\treturn () => {\n\t\t\tcontentView?.removeEventHandler?.( 'resize', updateProps );\n\n\t\t\tif ( resizeObserver ) {\n\t\t\t\tresizeObserver.disconnect();\n\t\t\t}\n\t\t};\n\t}, [ updateProps, contentElement, selectedBlockElement ] );\n\n\treturn {\n\t\t...props,\n\t\tref: popoverRef,\n\t};\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,YAAY,QAAQ,oBAAoB;AACjD,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,kBAAkB,QAAQ,gBAAgB;AACnD,SACCC,WAAW,EACXC,eAAe,EACfC,OAAO,EACPC,QAAQ,QACF,oBAAoB;;AAE3B;AACA;AACA;AACA,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AACvD,SAASC,eAAe,QAAQ,8CAA8C;AAC9E,SAASC,6BAA6B,QAAQ,sBAAsB;AACpE,SAASC,uBAAuB,QAAQ,iBAAiB;AAEzD,MAAMC,YAAY,GAAG;EACpBC,SAAS,EAAE;AACZ,CAAC;;AAED;AACA;AACA;AACA,MAAMC,aAAa,GAAG;EACrB,GAAGF,YAAY;EACfG,IAAI,EAAE,KAAK;EACXC,KAAK,EAAE;AACR,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA,MAAMC,uBAAuB,GAAG;EAC/B,GAAGL,YAAY;EACfG,IAAI,EAAE,IAAI;EACVC,KAAK,EAAE;AACR,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASE,QAAQA,CAChBC,cAAc,EACdC,oBAAoB,EACpBC,eAAe,EACfC,aAAa,EACb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MAC/BF,cAAc,GAAG,IAAIC,SAAS,CAACC,cAAc,CAAEN,WAAY,CAAC;MAC5DI,cAAc,CAACG,OAAO,CAAErC,oBAAqB,CAAC;IAC/C;IAEA,OAAO,MAAM;MACZ+B,WAAW,EAAEO,kBAAkB,GAAI,QAAQ,EAAER,WAAY,CAAC;MAE1D,IAAKI,cAAc,EAAG;QACrBA,cAAc,CAACK,UAAU,CAAC,CAAC;MAC5B;IACD,CAAC;EACF,CAAC,EAAE,CAAET,WAAW,EAAE/B,cAAc,EAAEC,oBAAoB,CAAG,CAAC;EAE1D,OAAO;IACN,GAAGyB,KAAK;IACRe,GAAG,EAAEb;EACN,CAAC;AACF","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["useRefEffect","useSelect","getScrollContainer","useCallback","useLayoutEffect","useMemo","useState","store","blockEditorStore","useBlockElement","hasStickyOrFixedPositionValue","getElementBounds","COMMON_PROPS","placement","DEFAULT_PROPS","flip","shift","RESTRICTED_HEIGHT_PROPS","getProps","contentElement","selectedBlockElement","scrollContainer","toolbarHeight","isSticky","scrollTop","blockRect","contentRect","getBoundingClientRect","topOfContentElementInViewport","top","viewportHeight","ownerDocument","documentElement","clientHeight","restrictedTopArea","hasSpaceForToolbarAbove","isBlockTallerThanViewport","height","useBlockToolbarPopoverProps","clientId","setToolbarHeight","blockIndex","select","getBlockIndex","getBlockAttributes","props","setProps","popoverRef","popoverNode","offsetHeight","updateProps","contentView","defaultView","addEventHandler","resizeObserver","blockView","ResizeObserver","observe","removeEventHandler","disconnect","ref"],"sources":["@wordpress/block-editor/src/components/block-tools/use-block-toolbar-popover-props.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useRefEffect } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\nimport { getScrollContainer } from '@wordpress/dom';\nimport {\n\tuseCallback,\n\tuseLayoutEffect,\n\tuseMemo,\n\tuseState,\n} from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { useBlockElement } from '../block-list/use-block-props/use-block-refs';\nimport { hasStickyOrFixedPositionValue } from '../../hooks/position';\nimport { getElementBounds } from '../../utils/dom';\n\nconst COMMON_PROPS = {\n\tplacement: 'top-start',\n};\n\n// By default the toolbar sets the `shift` prop. If the user scrolls the page\n// down the toolbar will stay on screen by adopting a sticky position at the\n// top of the viewport.\nconst DEFAULT_PROPS = {\n\t...COMMON_PROPS,\n\tflip: false,\n\tshift: true,\n};\n\n// When there isn't enough height between the top of the block and the editor\n// canvas, the `shift` prop is set to `false`, as it will cause the block to be\n// obscured. The `flip` behavior is enabled, which positions the toolbar below\n// the block. This only happens if the block is smaller than the viewport, as\n// otherwise the toolbar will be off-screen.\nconst RESTRICTED_HEIGHT_PROPS = {\n\t...COMMON_PROPS,\n\tflip: true,\n\tshift: false,\n};\n\n/**\n * Get the popover props for the block toolbar, determined by the space at the top of the canvas and the toolbar height.\n *\n * @param {Element} contentElement The DOM element that represents the editor content or canvas.\n * @param {Element} selectedBlockElement The outer DOM element of the first selected block.\n * @param {Element} scrollContainer The scrollable container for the contentElement.\n * @param {number} toolbarHeight The height of the toolbar in pixels.\n * @param {boolean} isSticky Whether or not the selected block is sticky or fixed.\n *\n * @return {Object} The popover props used to determine the position of the toolbar.\n */\nfunction getProps(\n\tcontentElement,\n\tselectedBlockElement,\n\tscrollContainer,\n\ttoolbarHeight,\n\tisSticky\n) {\n\tif ( ! contentElement || ! selectedBlockElement ) {\n\t\treturn DEFAULT_PROPS;\n\t}\n\n\t// Get how far the content area has been scrolled.\n\tconst scrollTop = scrollContainer?.scrollTop || 0;\n\n\tconst blockRect = getElementBounds( selectedBlockElement );\n\tconst contentRect = contentElement.getBoundingClientRect();\n\n\t// Get the vertical position of top of the visible content area.\n\tconst topOfContentElementInViewport = scrollTop + contentRect.top;\n\n\t// The document element's clientHeight represents the viewport height.\n\tconst viewportHeight =\n\t\tcontentElement.ownerDocument.documentElement.clientHeight;\n\n\t// The restricted height area is calculated as the sum of the\n\t// vertical position of the visible content area, plus the height\n\t// of the block toolbar.\n\tconst restrictedTopArea = topOfContentElementInViewport + toolbarHeight;\n\tconst hasSpaceForToolbarAbove = blockRect.top > restrictedTopArea;\n\n\tconst isBlockTallerThanViewport =\n\t\tblockRect.height > viewportHeight - toolbarHeight;\n\n\t// Sticky blocks are treated as if they will never have enough space for the toolbar above.\n\tif (\n\t\t! isSticky &&\n\t\t( hasSpaceForToolbarAbove || isBlockTallerThanViewport )\n\t) {\n\t\treturn DEFAULT_PROPS;\n\t}\n\n\treturn RESTRICTED_HEIGHT_PROPS;\n}\n\n/**\n * Determines the desired popover positioning behavior, returning a set of appropriate props.\n *\n * @param {Object} elements\n * @param {Element} elements.contentElement The DOM element that represents the editor content or canvas.\n * @param {string} elements.clientId The clientId of the first selected block.\n *\n * @return {Object} The popover props used to determine the position of the toolbar.\n */\nexport default function useBlockToolbarPopoverProps( {\n\tcontentElement,\n\tclientId,\n} ) {\n\tconst selectedBlockElement = useBlockElement( clientId );\n\tconst [ toolbarHeight, setToolbarHeight ] = useState( 0 );\n\tconst { blockIndex, isSticky } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockIndex, getBlockAttributes } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\treturn {\n\t\t\t\tblockIndex: getBlockIndex( clientId ),\n\t\t\t\tisSticky: hasStickyOrFixedPositionValue(\n\t\t\t\t\tgetBlockAttributes( clientId )\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\tconst scrollContainer = useMemo( () => {\n\t\tif ( ! contentElement ) {\n\t\t\treturn;\n\t\t}\n\t\treturn getScrollContainer( contentElement );\n\t}, [ contentElement ] );\n\tconst [ props, setProps ] = useState( () =>\n\t\tgetProps(\n\t\t\tcontentElement,\n\t\t\tselectedBlockElement,\n\t\t\tscrollContainer,\n\t\t\ttoolbarHeight,\n\t\t\tisSticky\n\t\t)\n\t);\n\n\tconst popoverRef = useRefEffect( ( popoverNode ) => {\n\t\tsetToolbarHeight( popoverNode.offsetHeight );\n\t}, [] );\n\n\tconst updateProps = useCallback(\n\t\t() =>\n\t\t\tsetProps(\n\t\t\t\tgetProps(\n\t\t\t\t\tcontentElement,\n\t\t\t\t\tselectedBlockElement,\n\t\t\t\t\tscrollContainer,\n\t\t\t\t\ttoolbarHeight,\n\t\t\t\t\tisSticky\n\t\t\t\t)\n\t\t\t),\n\t\t[ contentElement, selectedBlockElement, scrollContainer, toolbarHeight ]\n\t);\n\n\t// Update props when the block is moved. This also ensures the props are\n\t// correct on initial mount, and when the selected block or content element\n\t// changes (since the callback ref will update).\n\tuseLayoutEffect( updateProps, [ blockIndex, updateProps ] );\n\n\t// Update props when the viewport is resized or the block is resized.\n\tuseLayoutEffect( () => {\n\t\tif ( ! contentElement || ! selectedBlockElement ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Update the toolbar props on viewport resize.\n\t\tconst contentView = contentElement?.ownerDocument?.defaultView;\n\t\tcontentView?.addEventHandler?.( 'resize', updateProps );\n\n\t\t// Update the toolbar props on block resize.\n\t\tlet resizeObserver;\n\t\tconst blockView = selectedBlockElement?.ownerDocument?.defaultView;\n\t\tif ( blockView.ResizeObserver ) {\n\t\t\tresizeObserver = new blockView.ResizeObserver( updateProps );\n\t\t\tresizeObserver.observe( selectedBlockElement );\n\t\t}\n\n\t\treturn () => {\n\t\t\tcontentView?.removeEventHandler?.( 'resize', updateProps );\n\n\t\t\tif ( resizeObserver ) {\n\t\t\t\tresizeObserver.disconnect();\n\t\t\t}\n\t\t};\n\t}, [ updateProps, contentElement, selectedBlockElement ] );\n\n\treturn {\n\t\t...props,\n\t\tref: popoverRef,\n\t};\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,YAAY,QAAQ,oBAAoB;AACjD,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,kBAAkB,QAAQ,gBAAgB;AACnD,SACCC,WAAW,EACXC,eAAe,EACfC,OAAO,EACPC,QAAQ,QACF,oBAAo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P5B,QAAQ,CACPC,cAAc,EACdC,oBAAoB,EACpBC,eAAe,EACfC,aAAa,EACbC,QACD,CACD,CAAC,EACF,CAAEJ,cAAc,EAAEC,oBAAoB,EAAEC,eAAe,EAAEC,aAAa,CACvE,CAAC;;EAED;EACA;EACA;EACAlB,eAAe,CAAE8C,WAAW,EAAE,CAAET,UAAU,EAAES,WAAW,CAAG,CAAC;;EAE3D;EACA9C,eAAe,CAAE,MAAM;IACtB,IAAK,CAAEe,cAAc,IAAI,CAAEC,oBAAoB,EAAG;MACjD;IACD;;IAEA;IACA,MAAM+B,WAAW,GAAGhC,cAAc,EAAEY,aAAa,EAAEqB,WAAW;IAC9DD,WAAW,EAAEE,eAAe,GAAI,QAAQ,EAAEH,WAAY,CAAC;;IAEvD;IACA,IAAII,cAAc;IAClB,MAAMC,SAAS,GAAGnC,oBAAoB,EAAEW,aAAa,EAAEqB,WAAW;IAClE,IAAKG,SAAS,CAACC,cAAc,EAAG;MAC/BF,cAAc,GAAG,IAAIC,SAAS,CAACC,cAAc,CAAEN,WAAY,CAAC;MAC5DI,cAAc,CAACG,OAAO,CAAErC,oBAAqB,CAAC;IAC/C;IAEA,OAAO,MAAM;MACZ+B,WAAW,EAAEO,kBAAkB,GAAI,QAAQ,EAAER,WAAY,CAAC;MAE1D,IAAKI,cAAc,EAAG;QACrBA,cAAc,CAACK,UAAU,CAAC,CAAC;MAC5B;IACD,CAAC;EACF,CAAC,EAAE,CAAET,WAAW,EAAE/B,cAAc,EAAEC,oBAAoB,CAAG,CAAC;EAE1D,OAAO;IACN,GAAGyB,KAAK;IACRe,GAAG,EAAEb;EACN,CAAC;AACF","ignoreList":[]}
|
|
@@ -113,41 +113,45 @@ function isScrollable(element) {
|
|
|
113
113
|
const style = window.getComputedStyle(element);
|
|
114
114
|
return style.overflowX === 'auto' || style.overflowX === 'scroll' || style.overflowY === 'auto' || style.overflowY === 'scroll';
|
|
115
115
|
}
|
|
116
|
-
|
|
116
|
+
export const WITH_OVERFLOW_ELEMENT_BLOCKS = ['core/navigation'];
|
|
117
117
|
/**
|
|
118
|
-
* Returns the
|
|
119
|
-
*
|
|
120
|
-
* Visible nested elements, including elements that overflow the parent, are
|
|
121
|
-
* taken into account.
|
|
122
|
-
*
|
|
123
|
-
* This function is useful for calculating the visible area of a block that
|
|
124
|
-
* contains nested elements that overflow the block, e.g. the Navigation block,
|
|
125
|
-
* which can contain overflowing Submenu blocks.
|
|
118
|
+
* Returns the bounding rectangle of an element, with special handling for blocks
|
|
119
|
+
* that have visible overflowing children (defined in WITH_OVERFLOW_ELEMENT_BLOCKS).
|
|
126
120
|
*
|
|
121
|
+
* For blocks like Navigation that can have overflowing elements (e.g. submenus),
|
|
122
|
+
* this function calculates the combined bounds of both the parent and its visible
|
|
123
|
+
* children. The returned rect may extend beyond the viewport.
|
|
127
124
|
* The returned rect represents the full extent of the element and its visible
|
|
128
125
|
* children, which may extend beyond the viewport.
|
|
129
126
|
*
|
|
130
127
|
* @param {Element} element Element.
|
|
131
128
|
* @return {DOMRect} Bounding client rect of the element and its visible children.
|
|
132
129
|
*/
|
|
133
|
-
export function
|
|
130
|
+
export function getElementBounds(element) {
|
|
134
131
|
const viewport = element.ownerDocument.defaultView;
|
|
135
132
|
if (!viewport) {
|
|
136
133
|
return new window.DOMRectReadOnly();
|
|
137
134
|
}
|
|
138
135
|
let bounds = element.getBoundingClientRect();
|
|
139
|
-
const
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
136
|
+
const dataType = element.getAttribute('data-type');
|
|
137
|
+
|
|
138
|
+
/*
|
|
139
|
+
* For blocks with overflowing elements (like Navigation), include the bounds
|
|
140
|
+
* of visible children that extend beyond the parent container.
|
|
141
|
+
*/
|
|
142
|
+
if (dataType && WITH_OVERFLOW_ELEMENT_BLOCKS.includes(dataType)) {
|
|
143
|
+
const stack = [element];
|
|
144
|
+
let currentElement;
|
|
145
|
+
while (currentElement = stack.pop()) {
|
|
146
|
+
// Children won’t affect bounds unless the element is not scrollable.
|
|
147
|
+
if (!isScrollable(currentElement)) {
|
|
148
|
+
for (const child of currentElement.children) {
|
|
149
|
+
if (isElementVisible(child)) {
|
|
150
|
+
const childBounds = child.getBoundingClientRect();
|
|
151
|
+
bounds = rectUnion(bounds, childBounds);
|
|
152
|
+
stack.push(child);
|
|
153
|
+
}
|
|
148
154
|
}
|
|
149
|
-
bounds = rectUnion(bounds, childBounds);
|
|
150
|
-
stack.push(child);
|
|
151
155
|
}
|
|
152
156
|
}
|
|
153
157
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["BLOCK_SELECTOR","APPENDER_SELECTOR","BLOCK_APPENDER_CLASS","isInSameBlock","a","b","closest","isInsideRootBlock","blockElement","element","parentBlock","join","getBlockClientId","node","nodeType","ELEMENT_NODE","parentNode","elementNode","blockNode","id","slice","length","rectUnion","rect1","rect2","left","Math","min","right","max","bottom","top","window","DOMRectReadOnly","isElementVisible","viewport","ownerDocument","defaultView","classList","contains","bounds","getBoundingClientRect","width","height","checkVisibility","opacityProperty","contentVisibilityAuto","visibilityProperty","style","getComputedStyle","display","visibility","opacity","isScrollable","overflowX","overflowY","getVisibleElementBounds","stack","currentElement","pop","child","children","childBounds","push","innerWidth"],"sources":["@wordpress/block-editor/src/utils/dom.js"],"sourcesContent":["const BLOCK_SELECTOR = '.block-editor-block-list__block';\nconst APPENDER_SELECTOR = '.block-list-appender';\nconst BLOCK_APPENDER_CLASS = '.block-editor-button-block-appender';\n\n/**\n * Returns true if two elements are contained within the same block.\n *\n * @param {Element} a First element.\n * @param {Element} b Second element.\n *\n * @return {boolean} Whether elements are in the same block.\n */\nexport function isInSameBlock( a, b ) {\n\treturn a.closest( BLOCK_SELECTOR ) === b.closest( BLOCK_SELECTOR );\n}\n\n/**\n * Returns true if an element is considered part of the block and not its inner\n * blocks or appender.\n *\n * @param {Element} blockElement Block container element.\n * @param {Element} element Element.\n *\n * @return {boolean} Whether an element is considered part of the block and not\n * its inner blocks or appender.\n */\nexport function isInsideRootBlock( blockElement, element ) {\n\tconst parentBlock = element.closest(\n\t\t[ BLOCK_SELECTOR, APPENDER_SELECTOR, BLOCK_APPENDER_CLASS ].join( ',' )\n\t);\n\treturn parentBlock === blockElement;\n}\n\n/**\n * Finds the block client ID given any DOM node inside the block.\n *\n * @param {Node?} node DOM node.\n *\n * @return {string|undefined} Client ID or undefined if the node is not part of\n * a block.\n */\nexport function getBlockClientId( node ) {\n\twhile ( node && node.nodeType !== node.ELEMENT_NODE ) {\n\t\tnode = node.parentNode;\n\t}\n\n\tif ( ! node ) {\n\t\treturn;\n\t}\n\n\tconst elementNode = /** @type {Element} */ ( node );\n\tconst blockNode = elementNode.closest( BLOCK_SELECTOR );\n\n\tif ( ! blockNode ) {\n\t\treturn;\n\t}\n\n\treturn blockNode.id.slice( 'block-'.length );\n}\n\n/**\n * Calculates the union of two rectangles.\n *\n * @param {DOMRect} rect1 First rectangle.\n * @param {DOMRect} rect2 Second rectangle.\n * @return {DOMRect} Union of the two rectangles.\n */\nexport function rectUnion( rect1, rect2 ) {\n\tconst left = Math.min( rect1.left, rect2.left );\n\tconst right = Math.max( rect1.right, rect2.right );\n\tconst bottom = Math.max( rect1.bottom, rect2.bottom );\n\tconst top = Math.min( rect1.top, rect2.top );\n\n\treturn new window.DOMRectReadOnly( left, top, right - left, bottom - top );\n}\n\n/**\n * Returns whether an element is visible.\n *\n * @param {Element} element Element.\n * @return {boolean} Whether the element is visible.\n */\nfunction isElementVisible( element ) {\n\tconst viewport = element.ownerDocument.defaultView;\n\tif ( ! viewport ) {\n\t\treturn false;\n\t}\n\n\t// Check for <VisuallyHidden> component.\n\tif ( element.classList.contains( 'components-visually-hidden' ) ) {\n\t\treturn false;\n\t}\n\n\tconst bounds = element.getBoundingClientRect();\n\tif ( bounds.width === 0 || bounds.height === 0 ) {\n\t\treturn false;\n\t}\n\n\t// Older browsers, e.g. Safari < 17.4 may not support the `checkVisibility` method.\n\tif ( element.checkVisibility ) {\n\t\treturn element.checkVisibility?.( {\n\t\t\topacityProperty: true,\n\t\t\tcontentVisibilityAuto: true,\n\t\t\tvisibilityProperty: true,\n\t\t} );\n\t}\n\n\tconst style = viewport.getComputedStyle( element );\n\n\tif (\n\t\tstyle.display === 'none' ||\n\t\tstyle.visibility === 'hidden' ||\n\t\tstyle.opacity === '0'\n\t) {\n\t\treturn false;\n\t}\n\n\treturn true;\n}\n\n/**\n * Checks if the element is scrollable.\n *\n * @param {Element} element Element.\n * @return {boolean} True if the element is scrollable.\n */\nfunction isScrollable( element ) {\n\tconst style = window.getComputedStyle( element );\n\treturn (\n\t\tstyle.overflowX === 'auto' ||\n\t\tstyle.overflowX === 'scroll' ||\n\t\tstyle.overflowY === 'auto' ||\n\t\tstyle.overflowY === 'scroll'\n\t);\n}\n\n/**\n * Returns the rect of the element including all visible nested elements.\n *\n * Visible nested elements, including elements that overflow the parent, are\n * taken into account.\n *\n * This function is useful for calculating the visible area of a block that\n * contains nested elements that overflow the block, e.g. the Navigation block,\n * which can contain overflowing Submenu blocks.\n *\n * The returned rect represents the full extent of the element and its visible\n * children, which may extend beyond the viewport.\n *\n * @param {Element} element Element.\n * @return {DOMRect} Bounding client rect of the element and its visible children.\n */\nexport function getVisibleElementBounds( element ) {\n\tconst viewport = element.ownerDocument.defaultView;\n\n\tif ( ! viewport ) {\n\t\treturn new window.DOMRectReadOnly();\n\t}\n\n\tlet bounds = element.getBoundingClientRect();\n\tconst stack = [ element ];\n\tlet currentElement;\n\n\twhile ( ( currentElement = stack.pop() ) ) {\n\t\tfor ( const child of currentElement.children ) {\n\t\t\tif ( isElementVisible( child ) ) {\n\t\t\t\tlet childBounds = child.getBoundingClientRect();\n\t\t\t\t// If the parent is scrollable, use parent's scrollable bounds.\n\t\t\t\tif ( isScrollable( currentElement ) ) {\n\t\t\t\t\tchildBounds = currentElement.getBoundingClientRect();\n\t\t\t\t}\n\t\t\t\tbounds = rectUnion( bounds, childBounds );\n\t\t\t\tstack.push( child );\n\t\t\t}\n\t\t}\n\t}\n\n\t/*\n\t * Take into account the outer horizontal limits of the container in which\n\t * an element is supposed to be \"visible\". For example, if an element is\n\t * positioned -10px to the left of the window x value (0), this function\n\t * discounts the negative overhang because it's not visible and therefore\n\t * not to be counted in the visibility calculations. Top and bottom values\n\t * are not accounted for to accommodate vertical scroll.\n\t */\n\tconst left = Math.max( bounds.left, 0 );\n\tconst right = Math.min( bounds.right, viewport.innerWidth );\n\tbounds = new window.DOMRectReadOnly(\n\t\tleft,\n\t\tbounds.top,\n\t\tright - left,\n\t\tbounds.height\n\t);\n\n\treturn bounds;\n}\n"],"mappings":"AAAA,MAAMA,cAAc,GAAG,iCAAiC;AACxD,MAAMC,iBAAiB,GAAG,sBAAsB;AAChD,MAAMC,oBAAoB,GAAG,qCAAqC;;AAElE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,aAAaA,CAAEC,CAAC,EAAEC,CAAC,EAAG;EACrC,OAAOD,CAAC,CAACE,OAAO,CAAEN,cAAe,CAAC,KAAKK,CAAC,CAACC,OAAO,CAAEN,cAAe,CAAC;AACnE;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASO,iBAAiBA,CAAEC,YAAY,EAAEC,OAAO,EAAG;EAC1D,MAAMC,WAAW,GAAGD,OAAO,CAACH,OAAO,CAClC,CAAEN,cAAc,EAAEC,iBAAiB,EAAEC,oBAAoB,CAAE,CAACS,IAAI,CAAE,GAAI,CACvE,CAAC;EACD,OAAOD,WAAW,KAAKF,YAAY;AACpC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASI,gBAAgBA,CAAEC,IAAI,EAAG;EACxC,OAAQA,IAAI,IAAIA,IAAI,CAACC,QAAQ,KAAKD,IAAI,CAACE,YAAY,EAAG;IACrDF,IAAI,GAAGA,IAAI,CAACG,UAAU;EACvB;EAEA,IA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AAEhD,OAAO,CAAE;EACzB,IAAIiD,cAAc;EAElB,OAAUA,cAAc,GAAGD,KAAK,CAACE,GAAG,CAAC,CAAC,EAAK;IAC1C,KAAM,MAAMC,KAAK,IAAIF,cAAc,CAACG,QAAQ,EAAG;MAC9C,IAAK3B,gBAAgB,CAAE0B,KAAM,CAAC,EAAG;QAChC,IAAIE,WAAW,GAAGF,KAAK,CAACnB,qBAAqB,CAAC,CAAC;QAC/C;QACA,IAAKY,YAAY,CAAEK,cAAe,CAAC,EAAG;UACrCI,WAAW,GAAGJ,cAAc,CAACjB,qBAAqB,CAAC,CAAC;QACrD;QACAD,MAAM,GAAGlB,SAAS,CAAEkB,MAAM,EAAEsB,WAAY,CAAC;QACzCL,KAAK,CAACM,IAAI,CAAEH,KAAM,CAAC;MACpB;IACD;EACD;;EAEA;AACD;AACA;AACA;AACA;AACA;AACA;AACA;EACC,MAAMnC,IAAI,GAAGC,IAAI,CAACG,GAAG,CAAEW,MAAM,CAACf,IAAI,EAAE,CAAE,CAAC;EACvC,MAAMG,KAAK,GAAGF,IAAI,CAACC,GAAG,CAAEa,MAAM,CAACZ,KAAK,EAAEO,QAAQ,CAAC6B,UAAW,CAAC;EAC3DxB,MAAM,GAAG,IAAIR,MAAM,CAACC,eAAe,CAClCR,IAAI,EACJe,MAAM,CAACT,GAAG,EACVH,KAAK,GAAGH,IAAI,EACZe,MAAM,CAACG,MACR,CAAC;EAED,OAAOH,MAAM;AACd","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["BLOCK_SELECTOR","APPENDER_SELECTOR","BLOCK_APPENDER_CLASS","isInSameBlock","a","b","closest","isInsideRootBlock","blockElement","element","parentBlock","join","getBlockClientId","node","nodeType","ELEMENT_NODE","parentNode","elementNode","blockNode","id","slice","length","rectUnion","rect1","rect2","left","Math","min","right","max","bottom","top","window","DOMRectReadOnly","isElementVisible","viewport","ownerDocument","defaultView","classList","contains","bounds","getBoundingClientRect","width","height","checkVisibility","opacityProperty","contentVisibilityAuto","visibilityProperty","style","getComputedStyle","display","visibility","opacity","isScrollable","overflowX","overflowY","WITH_OVERFLOW_ELEMENT_BLOCKS","getElementBounds","dataType","getAttribute","includes","stack","currentElement","pop","child","children","childBounds","push","innerWidth"],"sources":["@wordpress/block-editor/src/utils/dom.js"],"sourcesContent":["const BLOCK_SELECTOR = '.block-editor-block-list__block';\nconst APPENDER_SELECTOR = '.block-list-appender';\nconst BLOCK_APPENDER_CLASS = '.block-editor-button-block-appender';\n\n/**\n * Returns true if two elements are contained within the same block.\n *\n * @param {Element} a First element.\n * @param {Element} b Second element.\n *\n * @return {boolean} Whether elements are in the same block.\n */\nexport function isInSameBlock( a, b ) {\n\treturn a.closest( BLOCK_SELECTOR ) === b.closest( BLOCK_SELECTOR );\n}\n\n/**\n * Returns true if an element is considered part of the block and not its inner\n * blocks or appender.\n *\n * @param {Element} blockElement Block container element.\n * @param {Element} element Element.\n *\n * @return {boolean} Whether an element is considered part of the block and not\n * its inner blocks or appender.\n */\nexport function isInsideRootBlock( blockElement, element ) {\n\tconst parentBlock = element.closest(\n\t\t[ BLOCK_SELECTOR, APPENDER_SELECTOR, BLOCK_APPENDER_CLASS ].join( ',' )\n\t);\n\treturn parentBlock === blockElement;\n}\n\n/**\n * Finds the block client ID given any DOM node inside the block.\n *\n * @param {Node?} node DOM node.\n *\n * @return {string|undefined} Client ID or undefined if the node is not part of\n * a block.\n */\nexport function getBlockClientId( node ) {\n\twhile ( node && node.nodeType !== node.ELEMENT_NODE ) {\n\t\tnode = node.parentNode;\n\t}\n\n\tif ( ! node ) {\n\t\treturn;\n\t}\n\n\tconst elementNode = /** @type {Element} */ ( node );\n\tconst blockNode = elementNode.closest( BLOCK_SELECTOR );\n\n\tif ( ! blockNode ) {\n\t\treturn;\n\t}\n\n\treturn blockNode.id.slice( 'block-'.length );\n}\n\n/**\n * Calculates the union of two rectangles.\n *\n * @param {DOMRect} rect1 First rectangle.\n * @param {DOMRect} rect2 Second rectangle.\n * @return {DOMRect} Union of the two rectangles.\n */\nexport function rectUnion( rect1, rect2 ) {\n\tconst left = Math.min( rect1.left, rect2.left );\n\tconst right = Math.max( rect1.right, rect2.right );\n\tconst bottom = Math.max( rect1.bottom, rect2.bottom );\n\tconst top = Math.min( rect1.top, rect2.top );\n\n\treturn new window.DOMRectReadOnly( left, top, right - left, bottom - top );\n}\n\n/**\n * Returns whether an element is visible.\n *\n * @param {Element} element Element.\n * @return {boolean} Whether the element is visible.\n */\nfunction isElementVisible( element ) {\n\tconst viewport = element.ownerDocument.defaultView;\n\tif ( ! viewport ) {\n\t\treturn false;\n\t}\n\n\t// Check for <VisuallyHidden> component.\n\tif ( element.classList.contains( 'components-visually-hidden' ) ) {\n\t\treturn false;\n\t}\n\n\tconst bounds = element.getBoundingClientRect();\n\tif ( bounds.width === 0 || bounds.height === 0 ) {\n\t\treturn false;\n\t}\n\n\t// Older browsers, e.g. Safari < 17.4 may not support the `checkVisibility` method.\n\tif ( element.checkVisibility ) {\n\t\treturn element.checkVisibility?.( {\n\t\t\topacityProperty: true,\n\t\t\tcontentVisibilityAuto: true,\n\t\t\tvisibilityProperty: true,\n\t\t} );\n\t}\n\n\tconst style = viewport.getComputedStyle( element );\n\n\tif (\n\t\tstyle.display === 'none' ||\n\t\tstyle.visibility === 'hidden' ||\n\t\tstyle.opacity === '0'\n\t) {\n\t\treturn false;\n\t}\n\n\treturn true;\n}\n\n/**\n * Checks if the element is scrollable.\n *\n * @param {Element} element Element.\n * @return {boolean} True if the element is scrollable.\n */\nfunction isScrollable( element ) {\n\tconst style = window.getComputedStyle( element );\n\treturn (\n\t\tstyle.overflowX === 'auto' ||\n\t\tstyle.overflowX === 'scroll' ||\n\t\tstyle.overflowY === 'auto' ||\n\t\tstyle.overflowY === 'scroll'\n\t);\n}\n\nexport const WITH_OVERFLOW_ELEMENT_BLOCKS = [ 'core/navigation' ];\n/**\n * Returns the bounding rectangle of an element, with special handling for blocks\n * that have visible overflowing children (defined in WITH_OVERFLOW_ELEMENT_BLOCKS).\n *\n * For blocks like Navigation that can have overflowing elements (e.g. submenus),\n * this function calculates the combined bounds of both the parent and its visible\n * children. The returned rect may extend beyond the viewport.\n * The returned rect represents the full extent of the element and its visible\n * children, which may extend beyond the viewport.\n *\n * @param {Element} element Element.\n * @return {DOMRect} Bounding client rect of the element and its visible children.\n */\nexport function getElementBounds( element ) {\n\tconst viewport = element.ownerDocument.defaultView;\n\n\tif ( ! viewport ) {\n\t\treturn new window.DOMRectReadOnly();\n\t}\n\n\tlet bounds = element.getBoundingClientRect();\n\tconst dataType = element.getAttribute( 'data-type' );\n\n\t/*\n\t * For blocks with overflowing elements (like Navigation), include the bounds\n\t * of visible children that extend beyond the parent container.\n\t */\n\tif ( dataType && WITH_OVERFLOW_ELEMENT_BLOCKS.includes( dataType ) ) {\n\t\tconst stack = [ element ];\n\t\tlet currentElement;\n\n\t\twhile ( ( currentElement = stack.pop() ) ) {\n\t\t\t// Children won’t affect bounds unless the element is not scrollable.\n\t\t\tif ( ! isScrollable( currentElement ) ) {\n\t\t\t\tfor ( const child of currentElement.children ) {\n\t\t\t\t\tif ( isElementVisible( child ) ) {\n\t\t\t\t\t\tconst childBounds = child.getBoundingClientRect();\n\t\t\t\t\t\tbounds = rectUnion( bounds, childBounds );\n\t\t\t\t\t\tstack.push( child );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t/*\n\t * Take into account the outer horizontal limits of the container in which\n\t * an element is supposed to be \"visible\". For example, if an element is\n\t * positioned -10px to the left of the window x value (0), this function\n\t * discounts the negative overhang because it's not visible and therefore\n\t * not to be counted in the visibility calculations. Top and bottom values\n\t * are not accounted for to accommodate vertical scroll.\n\t */\n\tconst left = Math.max( bounds.left, 0 );\n\tconst right = Math.min( bounds.right, viewport.innerWidth );\n\tbounds = new window.DOMRectReadOnly(\n\t\tleft,\n\t\tbounds.top,\n\t\tright - left,\n\t\tbounds.height\n\t);\n\n\treturn bounds;\n}\n"],"mappings":"AAAA,MAAMA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B,CAAE8B,KAAM,CAAC,EAAG;YAChC,MAAME,WAAW,GAAGF,KAAK,CAACvB,qBAAqB,CAAC,CAAC;YACjDD,MAAM,GAAGlB,SAAS,CAAEkB,MAAM,EAAE0B,WAAY,CAAC;YACzCL,KAAK,CAACM,IAAI,CAAEH,KAAM,CAAC;UACpB;QACD;MACD;IACD;EACD;;EAEA;AACD;AACA;AACA;AACA;AACA;AACA;AACA;EACC,MAAMvC,IAAI,GAAGC,IAAI,CAACG,GAAG,CAAEW,MAAM,CAACf,IAAI,EAAE,CAAE,CAAC;EACvC,MAAMG,KAAK,GAAGF,IAAI,CAACC,GAAG,CAAEa,MAAM,CAACZ,KAAK,EAAEO,QAAQ,CAACiC,UAAW,CAAC;EAC3D5B,MAAM,GAAG,IAAIR,MAAM,CAACC,eAAe,CAClCR,IAAI,EACJe,MAAM,CAACT,GAAG,EACVH,KAAK,GAAGH,IAAI,EACZe,MAAM,CAACG,MACR,CAAC;EAED,OAAOH,MAAM;AACd","ignoreList":[]}
|
|
@@ -36,20 +36,18 @@ export function getBlockClientId(node: Node | null): string | undefined;
|
|
|
36
36
|
*/
|
|
37
37
|
export function rectUnion(rect1: DOMRect, rect2: DOMRect): DOMRect;
|
|
38
38
|
/**
|
|
39
|
-
* Returns the
|
|
40
|
-
*
|
|
41
|
-
* Visible nested elements, including elements that overflow the parent, are
|
|
42
|
-
* taken into account.
|
|
43
|
-
*
|
|
44
|
-
* This function is useful for calculating the visible area of a block that
|
|
45
|
-
* contains nested elements that overflow the block, e.g. the Navigation block,
|
|
46
|
-
* which can contain overflowing Submenu blocks.
|
|
39
|
+
* Returns the bounding rectangle of an element, with special handling for blocks
|
|
40
|
+
* that have visible overflowing children (defined in WITH_OVERFLOW_ELEMENT_BLOCKS).
|
|
47
41
|
*
|
|
42
|
+
* For blocks like Navigation that can have overflowing elements (e.g. submenus),
|
|
43
|
+
* this function calculates the combined bounds of both the parent and its visible
|
|
44
|
+
* children. The returned rect may extend beyond the viewport.
|
|
48
45
|
* The returned rect represents the full extent of the element and its visible
|
|
49
46
|
* children, which may extend beyond the viewport.
|
|
50
47
|
*
|
|
51
48
|
* @param {Element} element Element.
|
|
52
49
|
* @return {DOMRect} Bounding client rect of the element and its visible children.
|
|
53
50
|
*/
|
|
54
|
-
export function
|
|
51
|
+
export function getElementBounds(element: Element): DOMRect;
|
|
52
|
+
export const WITH_OVERFLOW_ELEMENT_BLOCKS: string[];
|
|
55
53
|
//# sourceMappingURL=dom.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dom.d.ts","sourceRoot":"","sources":["../../src/utils/dom.js"],"names":[],"mappings":"AAIA;;;;;;;GAOG;AACH,iCALW,OAAO,KACP,OAAO,GAEN,OAAO,CAIlB;AAED;;;;;;;;;GASG;AACH,gDANW,OAAO,WACP,OAAO,GAEN,OAAO,CAQlB;AAED;;;;;;;GAOG;AACH,uCALW,IAAI,OAAC,GAEJ,MAAM,GAAC,SAAS,CAoB3B;AAED;;;;;;GAMG;AACH,iCAJW,OAAO,SACP,OAAO,GACN,OAAO,CASlB;
|
|
1
|
+
{"version":3,"file":"dom.d.ts","sourceRoot":"","sources":["../../src/utils/dom.js"],"names":[],"mappings":"AAIA;;;;;;;GAOG;AACH,iCALW,OAAO,KACP,OAAO,GAEN,OAAO,CAIlB;AAED;;;;;;;;;GASG;AACH,gDANW,OAAO,WACP,OAAO,GAEN,OAAO,CAQlB;AAED;;;;;;;GAOG;AACH,uCALW,IAAI,OAAC,GAEJ,MAAM,GAAC,SAAS,CAoB3B;AAED;;;;;;GAMG;AACH,iCAJW,OAAO,SACP,OAAO,GACN,OAAO,CASlB;AA+DD;;;;;;;;;;;;GAYG;AACH,0CAHW,OAAO,GACN,OAAO,CAoDlB;AAhED,oDAAkE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/block-editor",
|
|
3
|
-
"version": "14.3.
|
|
3
|
+
"version": "14.3.13",
|
|
4
4
|
"description": "Generic block editor.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -88,5 +88,5 @@
|
|
|
88
88
|
"publishConfig": {
|
|
89
89
|
"access": "public"
|
|
90
90
|
},
|
|
91
|
-
"gitHead": "
|
|
91
|
+
"gitHead": "b7fe267e2fb0c3cb1a37a9dda16f7eebcf5089c9"
|
|
92
92
|
}
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
*/
|
|
21
21
|
import { useBlockElement } from '../block-list/use-block-props/use-block-refs';
|
|
22
22
|
import usePopoverScroll from './use-popover-scroll';
|
|
23
|
-
import { rectUnion,
|
|
23
|
+
import { rectUnion, getElementBounds } from '../../utils/dom';
|
|
24
24
|
|
|
25
25
|
const MAX_POPOVER_RECOMPUTE_COUNTER = Number.MAX_SAFE_INTEGER;
|
|
26
26
|
|
|
@@ -90,10 +90,10 @@ function BlockPopover(
|
|
|
90
90
|
getBoundingClientRect() {
|
|
91
91
|
return lastSelectedElement
|
|
92
92
|
? rectUnion(
|
|
93
|
-
|
|
94
|
-
|
|
93
|
+
getElementBounds( selectedElement ),
|
|
94
|
+
getElementBounds( lastSelectedElement )
|
|
95
95
|
)
|
|
96
|
-
:
|
|
96
|
+
: getElementBounds( selectedElement );
|
|
97
97
|
},
|
|
98
98
|
contextElement: selectedElement,
|
|
99
99
|
};
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
import { store as blockEditorStore } from '../../store';
|
|
18
18
|
import { useBlockElement } from '../block-list/use-block-props/use-block-refs';
|
|
19
19
|
import { hasStickyOrFixedPositionValue } from '../../hooks/position';
|
|
20
|
-
import {
|
|
20
|
+
import { getElementBounds } from '../../utils/dom';
|
|
21
21
|
|
|
22
22
|
const COMMON_PROPS = {
|
|
23
23
|
placement: 'top-start',
|
|
@@ -68,7 +68,7 @@ function getProps(
|
|
|
68
68
|
// Get how far the content area has been scrolled.
|
|
69
69
|
const scrollTop = scrollContainer?.scrollTop || 0;
|
|
70
70
|
|
|
71
|
-
const blockRect =
|
|
71
|
+
const blockRect = getElementBounds( selectedBlockElement );
|
|
72
72
|
const contentRect = contentElement.getBoundingClientRect();
|
|
73
73
|
|
|
74
74
|
// Get the vertical position of top of the visible content area.
|
package/src/utils/dom.js
CHANGED
|
@@ -134,23 +134,21 @@ function isScrollable( element ) {
|
|
|
134
134
|
);
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
+
export const WITH_OVERFLOW_ELEMENT_BLOCKS = [ 'core/navigation' ];
|
|
137
138
|
/**
|
|
138
|
-
* Returns the
|
|
139
|
-
*
|
|
140
|
-
* Visible nested elements, including elements that overflow the parent, are
|
|
141
|
-
* taken into account.
|
|
142
|
-
*
|
|
143
|
-
* This function is useful for calculating the visible area of a block that
|
|
144
|
-
* contains nested elements that overflow the block, e.g. the Navigation block,
|
|
145
|
-
* which can contain overflowing Submenu blocks.
|
|
139
|
+
* Returns the bounding rectangle of an element, with special handling for blocks
|
|
140
|
+
* that have visible overflowing children (defined in WITH_OVERFLOW_ELEMENT_BLOCKS).
|
|
146
141
|
*
|
|
142
|
+
* For blocks like Navigation that can have overflowing elements (e.g. submenus),
|
|
143
|
+
* this function calculates the combined bounds of both the parent and its visible
|
|
144
|
+
* children. The returned rect may extend beyond the viewport.
|
|
147
145
|
* The returned rect represents the full extent of the element and its visible
|
|
148
146
|
* children, which may extend beyond the viewport.
|
|
149
147
|
*
|
|
150
148
|
* @param {Element} element Element.
|
|
151
149
|
* @return {DOMRect} Bounding client rect of the element and its visible children.
|
|
152
150
|
*/
|
|
153
|
-
export function
|
|
151
|
+
export function getElementBounds( element ) {
|
|
154
152
|
const viewport = element.ownerDocument.defaultView;
|
|
155
153
|
|
|
156
154
|
if ( ! viewport ) {
|
|
@@ -158,19 +156,26 @@ export function getVisibleElementBounds( element ) {
|
|
|
158
156
|
}
|
|
159
157
|
|
|
160
158
|
let bounds = element.getBoundingClientRect();
|
|
161
|
-
const
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
159
|
+
const dataType = element.getAttribute( 'data-type' );
|
|
160
|
+
|
|
161
|
+
/*
|
|
162
|
+
* For blocks with overflowing elements (like Navigation), include the bounds
|
|
163
|
+
* of visible children that extend beyond the parent container.
|
|
164
|
+
*/
|
|
165
|
+
if ( dataType && WITH_OVERFLOW_ELEMENT_BLOCKS.includes( dataType ) ) {
|
|
166
|
+
const stack = [ element ];
|
|
167
|
+
let currentElement;
|
|
168
|
+
|
|
169
|
+
while ( ( currentElement = stack.pop() ) ) {
|
|
170
|
+
// Children won’t affect bounds unless the element is not scrollable.
|
|
171
|
+
if ( ! isScrollable( currentElement ) ) {
|
|
172
|
+
for ( const child of currentElement.children ) {
|
|
173
|
+
if ( isElementVisible( child ) ) {
|
|
174
|
+
const childBounds = child.getBoundingClientRect();
|
|
175
|
+
bounds = rectUnion( bounds, childBounds );
|
|
176
|
+
stack.push( child );
|
|
177
|
+
}
|
|
171
178
|
}
|
|
172
|
-
bounds = rectUnion( bounds, childBounds );
|
|
173
|
-
stack.push( child );
|
|
174
179
|
}
|
|
175
180
|
}
|
|
176
181
|
}
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { getElementBounds, WITH_OVERFLOW_ELEMENT_BLOCKS } from '../dom';
|
|
5
|
+
describe( 'dom', () => {
|
|
6
|
+
describe( 'getElementBounds', () => {
|
|
7
|
+
it( 'should return a DOMRectReadOnly object if the viewport is not available', () => {
|
|
8
|
+
const element = {
|
|
9
|
+
ownerDocument: {
|
|
10
|
+
defaultView: null,
|
|
11
|
+
},
|
|
12
|
+
};
|
|
13
|
+
expect( getElementBounds( element ) ).toEqual(
|
|
14
|
+
new window.DOMRectReadOnly()
|
|
15
|
+
);
|
|
16
|
+
} );
|
|
17
|
+
it( 'should return a DOMRectReadOnly object if the viewport is available', () => {
|
|
18
|
+
const element = {
|
|
19
|
+
ownerDocument: {
|
|
20
|
+
defaultView: {
|
|
21
|
+
getComputedStyle: () => ( {
|
|
22
|
+
display: 'block',
|
|
23
|
+
visibility: 'visible',
|
|
24
|
+
opacity: '1',
|
|
25
|
+
} ),
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
getBoundingClientRect: () => ( {
|
|
29
|
+
left: 0,
|
|
30
|
+
top: 0,
|
|
31
|
+
right: 100,
|
|
32
|
+
bottom: 100,
|
|
33
|
+
width: 100,
|
|
34
|
+
height: 100,
|
|
35
|
+
} ),
|
|
36
|
+
getAttribute: ( x ) => x,
|
|
37
|
+
};
|
|
38
|
+
expect( getElementBounds( element ) ).toEqual(
|
|
39
|
+
new window.DOMRectReadOnly( 0, 0, 100, 100 )
|
|
40
|
+
);
|
|
41
|
+
} );
|
|
42
|
+
it( 'should clip left and right values when an element is larger than the viewport width', () => {
|
|
43
|
+
const element = window.document.createElement( 'div' );
|
|
44
|
+
element.getBoundingClientRect = jest.fn().mockReturnValue( {
|
|
45
|
+
left: -10,
|
|
46
|
+
top: 0,
|
|
47
|
+
right: window.innerWidth + 10,
|
|
48
|
+
bottom: 100,
|
|
49
|
+
width: window.innerWidth,
|
|
50
|
+
height: 100,
|
|
51
|
+
} );
|
|
52
|
+
expect( getElementBounds( element ).toJSON() ).toEqual( {
|
|
53
|
+
left: 0, // Reset to min left bound.
|
|
54
|
+
top: 0,
|
|
55
|
+
right: window.innerWidth, // Reset to max right bound.
|
|
56
|
+
bottom: 100,
|
|
57
|
+
width: window.innerWidth,
|
|
58
|
+
height: 100,
|
|
59
|
+
x: 0,
|
|
60
|
+
y: 0,
|
|
61
|
+
} );
|
|
62
|
+
} );
|
|
63
|
+
it( 'should return the parent DOMRectReadOnly object if the parent block type is not supported', () => {
|
|
64
|
+
const element = window.document.createElement( 'div' );
|
|
65
|
+
element.getBoundingClientRect = jest.fn().mockReturnValue( {
|
|
66
|
+
left: 0,
|
|
67
|
+
top: 0,
|
|
68
|
+
right: 100,
|
|
69
|
+
bottom: 100,
|
|
70
|
+
width: 100,
|
|
71
|
+
height: 100,
|
|
72
|
+
} );
|
|
73
|
+
element.setAttribute( 'data-type', 'test' );
|
|
74
|
+
const childElement = window.document.createElement( 'div' );
|
|
75
|
+
childElement.getBoundingClientRect = jest.fn().mockReturnValue( {
|
|
76
|
+
left: 0,
|
|
77
|
+
top: 0,
|
|
78
|
+
right: 333,
|
|
79
|
+
bottom: 333,
|
|
80
|
+
width: 333,
|
|
81
|
+
height: 333,
|
|
82
|
+
x: 0,
|
|
83
|
+
y: 0,
|
|
84
|
+
} );
|
|
85
|
+
element.appendChild( childElement );
|
|
86
|
+
|
|
87
|
+
expect( getElementBounds( element ).toJSON() ).toEqual( {
|
|
88
|
+
left: 0,
|
|
89
|
+
top: 0,
|
|
90
|
+
right: 100,
|
|
91
|
+
bottom: 100,
|
|
92
|
+
width: 100,
|
|
93
|
+
height: 100,
|
|
94
|
+
x: 0,
|
|
95
|
+
y: 0,
|
|
96
|
+
} );
|
|
97
|
+
} );
|
|
98
|
+
describe( 'With known block type', () => {
|
|
99
|
+
it( 'should return the child DOMRectReadOnly object if it is visible and a known block type', () => {
|
|
100
|
+
const element = window.document.createElement( 'div' );
|
|
101
|
+
element.getBoundingClientRect = jest.fn().mockReturnValue( {
|
|
102
|
+
left: 0,
|
|
103
|
+
top: 0,
|
|
104
|
+
right: 100,
|
|
105
|
+
bottom: 100,
|
|
106
|
+
width: 100,
|
|
107
|
+
height: 100,
|
|
108
|
+
} );
|
|
109
|
+
element.setAttribute(
|
|
110
|
+
'data-type',
|
|
111
|
+
WITH_OVERFLOW_ELEMENT_BLOCKS[ 0 ]
|
|
112
|
+
);
|
|
113
|
+
const childElement = window.document.createElement( 'div' );
|
|
114
|
+
childElement.getBoundingClientRect = jest
|
|
115
|
+
.fn()
|
|
116
|
+
.mockReturnValue( {
|
|
117
|
+
left: 0,
|
|
118
|
+
top: 0,
|
|
119
|
+
right: 333,
|
|
120
|
+
bottom: 333,
|
|
121
|
+
width: 333,
|
|
122
|
+
height: 333,
|
|
123
|
+
x: 0,
|
|
124
|
+
y: 0,
|
|
125
|
+
} );
|
|
126
|
+
element.appendChild( childElement );
|
|
127
|
+
|
|
128
|
+
expect( getElementBounds( element ).toJSON() ).toEqual( {
|
|
129
|
+
left: 0,
|
|
130
|
+
top: 0,
|
|
131
|
+
right: 333,
|
|
132
|
+
bottom: 333,
|
|
133
|
+
width: 333,
|
|
134
|
+
height: 333,
|
|
135
|
+
x: 0,
|
|
136
|
+
y: 0,
|
|
137
|
+
} );
|
|
138
|
+
} );
|
|
139
|
+
it( 'should return the parent DOMRectReadOnly if the child is scrollable', () => {
|
|
140
|
+
const element = window.document.createElement( 'div' );
|
|
141
|
+
element.setAttribute(
|
|
142
|
+
'data-type',
|
|
143
|
+
WITH_OVERFLOW_ELEMENT_BLOCKS[ 0 ]
|
|
144
|
+
);
|
|
145
|
+
element.style.overflowX = 'auto';
|
|
146
|
+
element.style.overflowY = 'auto';
|
|
147
|
+
element.getBoundingClientRect = jest.fn().mockReturnValue( {
|
|
148
|
+
left: 0,
|
|
149
|
+
top: 0,
|
|
150
|
+
right: 100,
|
|
151
|
+
bottom: 100,
|
|
152
|
+
width: 100,
|
|
153
|
+
height: 100,
|
|
154
|
+
} );
|
|
155
|
+
const childElement = window.document.createElement( 'div' );
|
|
156
|
+
childElement.getBoundingClientRect = jest
|
|
157
|
+
.fn()
|
|
158
|
+
.mockReturnValue( {
|
|
159
|
+
left: 0,
|
|
160
|
+
top: 0,
|
|
161
|
+
right: 333,
|
|
162
|
+
bottom: 333,
|
|
163
|
+
width: 333,
|
|
164
|
+
height: 333,
|
|
165
|
+
x: 0,
|
|
166
|
+
y: 0,
|
|
167
|
+
} );
|
|
168
|
+
element.appendChild( childElement );
|
|
169
|
+
|
|
170
|
+
expect( getElementBounds( element ).toJSON() ).toEqual( {
|
|
171
|
+
left: 0,
|
|
172
|
+
top: 0,
|
|
173
|
+
right: 100,
|
|
174
|
+
bottom: 100,
|
|
175
|
+
width: 100,
|
|
176
|
+
height: 100,
|
|
177
|
+
x: 0,
|
|
178
|
+
y: 0,
|
|
179
|
+
} );
|
|
180
|
+
} );
|
|
181
|
+
it( 'should return the parent DOMRectReadOnly object if the child element is not visible', () => {
|
|
182
|
+
const element = window.document.createElement( 'div' );
|
|
183
|
+
element.getBoundingClientRect = jest.fn().mockReturnValue( {
|
|
184
|
+
left: 0,
|
|
185
|
+
top: 0,
|
|
186
|
+
right: 100,
|
|
187
|
+
bottom: 100,
|
|
188
|
+
width: 100,
|
|
189
|
+
height: 100,
|
|
190
|
+
} );
|
|
191
|
+
element.setAttribute(
|
|
192
|
+
'data-type',
|
|
193
|
+
WITH_OVERFLOW_ELEMENT_BLOCKS[ 0 ]
|
|
194
|
+
);
|
|
195
|
+
const childElement = window.document.createElement( 'div' );
|
|
196
|
+
childElement.getBoundingClientRect = jest
|
|
197
|
+
.fn()
|
|
198
|
+
.mockReturnValue( {
|
|
199
|
+
left: 0,
|
|
200
|
+
top: 0,
|
|
201
|
+
right: 333,
|
|
202
|
+
bottom: 333,
|
|
203
|
+
width: 333,
|
|
204
|
+
height: 333,
|
|
205
|
+
x: 0,
|
|
206
|
+
y: 0,
|
|
207
|
+
} );
|
|
208
|
+
childElement.style.display = 'none';
|
|
209
|
+
element.appendChild( childElement );
|
|
210
|
+
|
|
211
|
+
expect( getElementBounds( element ).toJSON() ).toEqual( {
|
|
212
|
+
left: 0,
|
|
213
|
+
top: 0,
|
|
214
|
+
right: 100,
|
|
215
|
+
bottom: 100,
|
|
216
|
+
width: 100,
|
|
217
|
+
height: 100,
|
|
218
|
+
x: 0,
|
|
219
|
+
y: 0,
|
|
220
|
+
} );
|
|
221
|
+
} );
|
|
222
|
+
} );
|
|
223
|
+
} );
|
|
224
|
+
} );
|
package/tsconfig.tsbuildinfo
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"program":{"fileNames":["../../node_modules/typescript/lib/lib.es5.d.ts","../../node_modules/typescript/lib/lib.es2015.d.ts","../../node_modules/typescript/lib/lib.es2016.d.ts","../../node_modules/typescript/lib/lib.es2017.d.ts","../../node_modules/typescript/lib/lib.es2018.d.ts","../../node_modules/typescript/lib/lib.es2019.d.ts","../../node_modules/typescript/lib/lib.es2020.d.ts","../../node_modules/typescript/lib/lib.es2021.d.ts","../../node_modules/typescript/lib/lib.es2022.d.ts","../../node_modules/typescript/lib/lib.es2023.d.ts","../../node_modules/typescript/lib/lib.esnext.d.ts","../../node_modules/typescript/lib/lib.dom.d.ts","../../node_modules/typescript/lib/lib.dom.iterable.d.ts","../../node_modules/typescript/lib/lib.es2015.core.d.ts","../../node_modules/typescript/lib/lib.es2015.collection.d.ts","../../node_modules/typescript/lib/lib.es2015.generator.d.ts","../../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../node_modules/typescript/lib/lib.es2015.promise.d.ts","../../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../node_modules/typescript/lib/lib.es2016.intl.d.ts","../../node_modules/typescript/lib/lib.es2017.date.d.ts","../../node_modules/typescript/lib/lib.es2017.object.d.ts","../../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../node_modules/typescript/lib/lib.es2017.string.d.ts","../../node_modules/typescript/lib/lib.es2017.intl.d.ts","../../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../node_modules/typescript/lib/lib.es2018.intl.d.ts","../../node_modules/typescript/lib/lib.es2018.promise.d.ts","../../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../node_modules/typescript/lib/lib.es2019.array.d.ts","../../node_modules/typescript/lib/lib.es2019.object.d.ts","../../node_modules/typescript/lib/lib.es2019.string.d.ts","../../node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../node_modules/typescript/lib/lib.es2019.intl.d.ts","../../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../node_modules/typescript/lib/lib.es2020.date.d.ts","../../node_modules/typescript/lib/lib.es2020.promise.d.ts","../../node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../node_modules/typescript/lib/lib.es2020.string.d.ts","../../node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../node_modules/typescript/lib/lib.es2020.intl.d.ts","../../node_modules/typescript/lib/lib.es2020.number.d.ts","../../node_modules/typescript/lib/lib.es2021.promise.d.ts","../../node_modules/typescript/lib/lib.es2021.string.d.ts","../../node_modules/typescript/lib/lib.es2021.weakref.d.ts","../../node_modules/typescript/lib/lib.es2021.intl.d.ts","../../node_modules/typescript/lib/lib.es2022.array.d.ts","../../node_modules/typescript/lib/lib.es2022.error.d.ts","../../node_modules/typescript/lib/lib.es2022.intl.d.ts","../../node_modules/typescript/lib/lib.es2022.object.d.ts","../../node_modules/typescript/lib/lib.es2022.sharedmemory.d.ts","../../node_modules/typescript/lib/lib.es2022.string.d.ts","../../node_modules/typescript/lib/lib.es2022.regexp.d.ts","../../node_modules/typescript/lib/lib.es2023.array.d.ts","../../node_modules/typescript/lib/lib.es2023.collection.d.ts","../../node_modules/typescript/lib/lib.es2023.intl.d.ts","../../node_modules/typescript/lib/lib.esnext.array.d.ts","../../node_modules/typescript/lib/lib.esnext.collection.d.ts","../../node_modules/typescript/lib/lib.esnext.intl.d.ts","../../node_modules/typescript/lib/lib.esnext.disposable.d.ts","../../node_modules/typescript/lib/lib.esnext.string.d.ts","../../node_modules/typescript/lib/lib.esnext.promise.d.ts","../../node_modules/typescript/lib/lib.esnext.decorators.d.ts","../../node_modules/typescript/lib/lib.esnext.object.d.ts","../../node_modules/typescript/lib/lib.esnext.regexp.d.ts","../../node_modules/typescript/lib/lib.decorators.d.ts","../../node_modules/typescript/lib/lib.decorators.legacy.d.ts","../../node_modules/@types/react/global.d.ts","../../node_modules/csstype/index.d.ts","../../node_modules/@types/prop-types/index.d.ts","../../node_modules/@types/react/index.d.ts","../element/build-types/create-interpolate-element.d.ts","../element/build-types/react.d.ts","../../node_modules/@types/react-dom/index.d.ts","../../node_modules/@types/react-dom/client.d.ts","../element/build-types/react-platform.d.ts","../element/build-types/utils.d.ts","../element/build-types/platform.d.ts","../element/build-types/serialize.d.ts","../element/build-types/raw-html.d.ts","../element/build-types/index.d.ts","./src/components/block-context/index.js","./src/utils/dom.js"],"fileInfos":[{"version":"44e584d4f6444f58791784f1d530875970993129442a847597db702a073ca68c","affectsGlobalScope":true},"45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4","3facaf05f0c5fc569c5649dd359892c98a85557e3e0c847964caeb67076f4d75","9a68c0c07ae2fa71b44384a839b7b8d81662a236d4b9ac30916718f7510b1b2d","5e1c4c362065a6b95ff952c0eab010f04dcd2c3494e813b493ecfd4fcb9fc0d8","68d73b4a11549f9c0b7d352d10e91e5dca8faa3322bfb77b661839c42b1ddec7","5efce4fc3c29ea84e8928f97adec086e3dc876365e0982cc8479a07954a3efd4","feecb1be483ed332fad555aff858affd90a48ab19ba7272ee084704eb7167569","5514e54f17d6d74ecefedc73c504eadffdeda79c7ea205cf9febead32d45c4bc","27bdc30a0e32783366a5abeda841bc22757c1797de8681bbe81fbc735eeb1c10","17edc026abf73c5c2dd508652d63f68ec4efd9d4856e3469890d27598209feb5",{"version":"4af6b0c727b7a2896463d512fafd23634229adf69ac7c00e2ae15a09cb084fad","affectsGlobalScope":true},{"version":"9c00a480825408b6a24c63c1b71362232927247595d7c97659bc24dc68ae0757","affectsGlobalScope":true},{"version":"6920e1448680767498a0b77c6a00a8e77d14d62c3da8967b171f1ddffa3c18e4","affectsGlobalScope":true},{"version":"dc2df20b1bcdc8c2d34af4926e2c3ab15ffe1160a63e58b7e09833f616efff44","affectsGlobalScope":true},{"version":"4443e68b35f3332f753eacc66a04ac1d2053b8b035a0e0ac1d455392b5e243b3","affectsGlobalScope":true},{"version":"bc47685641087c015972a3f072480889f0d6c65515f12bd85222f49a98952ed7","affectsGlobalScope":true},{"version":"0dc1e7ceda9b8b9b455c3a2d67b0412feab00bd2f66656cd8850e8831b08b537","affectsGlobalScope":true},{"version":"ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671","affectsGlobalScope":true},{"version":"8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0","affectsGlobalScope":true},{"version":"4ff2a353abf8a80ee399af572debb8faab2d33ad38c4b4474cff7f26e7653b8d","affectsGlobalScope":true},{"version":"93495ff27b8746f55d19fcbcdbaccc99fd95f19d057aed1bd2c0cafe1335fbf0","affectsGlobalScope":true},{"version":"6fc23bb8c3965964be8c597310a2878b53a0306edb71d4b5a4dfe760186bcc01","affectsGlobalScope":true},{"version":"ea011c76963fb15ef1cdd7ce6a6808b46322c527de2077b6cfdf23ae6f5f9ec7","affectsGlobalScope":true},{"version":"38f0219c9e23c915ef9790ab1d680440d95419ad264816fa15009a8851e79119","affectsGlobalScope":true},{"version":"bb42a7797d996412ecdc5b2787720de477103a0b2e53058569069a0e2bae6c7e","affectsGlobalScope":true},{"version":"4738f2420687fd85629c9efb470793bb753709c2379e5f85bc1815d875ceadcd","affectsGlobalScope":true},{"version":"2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893","affectsGlobalScope":true},{"version":"4de680d5bb41c17f7f68e0419412ca23c98d5749dcaaea1896172f06435891fc","affectsGlobalScope":true},{"version":"9fc46429fbe091ac5ad2608c657201eb68b6f1b8341bd6d670047d32ed0a88fa","affectsGlobalScope":true},{"version":"61c37c1de663cf4171e1192466e52c7a382afa58da01b1dc75058f032ddf0839","affectsGlobalScope":true},{"version":"b541a838a13f9234aba650a825393ffc2292dc0fc87681a5d81ef0c96d281e7a","affectsGlobalScope":true},{"version":"9e9fbd7030c440b33d021da145d3232984c8bb7916f277e8ffd3dc2e3eae2bdb","affectsGlobalScope":true},{"version":"811ec78f7fefcabbda4bfa93b3eb67d9ae166ef95f9bff989d964061cbf81a0c","affectsGlobalScope":true},{"version":"717937616a17072082152a2ef351cb51f98802fb4b2fdabd32399843875974ca","affectsGlobalScope":true},{"version":"d7e7d9b7b50e5f22c915b525acc5a49a7a6584cf8f62d0569e557c5cfc4b2ac2","affectsGlobalScope":true},{"version":"71c37f4c9543f31dfced6c7840e068c5a5aacb7b89111a4364b1d5276b852557","affectsGlobalScope":true},{"version":"576711e016cf4f1804676043e6a0a5414252560eb57de9faceee34d79798c850","affectsGlobalScope":true},{"version":"89c1b1281ba7b8a96efc676b11b264de7a8374c5ea1e6617f11880a13fc56dc6","affectsGlobalScope":true},{"version":"74f7fa2d027d5b33eb0471c8e82a6c87216223181ec31247c357a3e8e2fddc5b","affectsGlobalScope":true},{"version":"ae37d6ccd1560b0203ab88d46987393adaaa78c919e51acf32fb82c86502e98c","affectsGlobalScope":true},{"version":"063600664504610fe3e99b717a1223f8b1900087fab0b4cad1496a114744f8df","affectsGlobalScope":true},{"version":"934019d7e3c81950f9a8426d093458b65d5aff2c7c1511233c0fd5b941e608ab","affectsGlobalScope":true},{"version":"bf14a426dbbf1022d11bd08d6b8e709a2e9d246f0c6c1032f3b2edb9a902adbe","affectsGlobalScope":true},{"version":"5e07ed3809d48205d5b985642a59f2eba47c402374a7cf8006b686f79efadcbd","affectsGlobalScope":true},{"version":"2b72d528b2e2fe3c57889ca7baef5e13a56c957b946906d03767c642f386bbc3","affectsGlobalScope":true},{"version":"479553e3779be7d4f68e9f40cdb82d038e5ef7592010100410723ceced22a0f7","affectsGlobalScope":true},{"version":"368af93f74c9c932edd84c58883e736c9e3d53cec1fe24c0b0ff451f529ceab1","affectsGlobalScope":true},{"version":"af3dd424cf267428f30ccfc376f47a2c0114546b55c44d8c0f1d57d841e28d74","affectsGlobalScope":true},{"version":"995c005ab91a498455ea8dfb63aa9f83fa2ea793c3d8aa344be4a1678d06d399","affectsGlobalScope":true},{"version":"d3d7b04b45033f57351c8434f60b6be1ea71a2dfec2d0a0c3c83badbb0e3e693","affectsGlobalScope":true},{"version":"956d27abdea9652e8368ce029bb1e0b9174e9678a273529f426df4b3d90abd60","affectsGlobalScope":true},{"version":"4fa6ed14e98aa80b91f61b9805c653ee82af3502dc21c9da5268d3857772ca05","affectsGlobalScope":true},{"version":"e6633e05da3ff36e6da2ec170d0d03ccf33de50ca4dc6f5aeecb572cedd162fb","affectsGlobalScope":true},{"version":"d8670852241d4c6e03f2b89d67497a4bbefe29ecaa5a444e2c11a9b05e6fccc6","affectsGlobalScope":true},{"version":"8444af78980e3b20b49324f4a16ba35024fef3ee069a0eb67616ea6ca821c47a","affectsGlobalScope":true},{"version":"caccc56c72713969e1cfe5c3d44e5bab151544d9d2b373d7dbe5a1e4166652be","affectsGlobalScope":true},{"version":"3287d9d085fbd618c3971944b65b4be57859f5415f495b33a6adc994edd2f004","affectsGlobalScope":true},{"version":"b4b67b1a91182421f5df999988c690f14d813b9850b40acd06ed44691f6727ad","affectsGlobalScope":true},{"version":"08a58483392df5fcc1db57d782e87734f77ae9eab42516028acbfe46f29a3ef7","affectsGlobalScope":true},{"version":"436aaf437562f276ec2ddbee2f2cdedac7664c1e4c1d2c36839ddd582eeb3d0a","affectsGlobalScope":true},{"version":"8e3c06ea092138bf9fa5e874a1fdbc9d54805d074bee1de31b99a11e2fec239d","affectsGlobalScope":true},{"version":"0b11f3ca66aa33124202c80b70cd203219c3d4460cfc165e0707aa9ec710fc53","affectsGlobalScope":true},{"version":"6a3f5a0129cc80cf439ab71164334d649b47059a4f5afca90282362407d0c87f","affectsGlobalScope":true},{"version":"811c71eee4aa0ac5f7adf713323a5c41b0cf6c4e17367a34fbce379e12bbf0a4","affectsGlobalScope":true},{"version":"15b98a533864d324e5f57cd3cfc0579b231df58c1c0f6063ea0fcb13c3c74ff9","affectsGlobalScope":true},{"version":"0a6282c8827e4b9a95f4bf4f5c205673ada31b982f50572d27103df8ceb8013c","affectsGlobalScope":true},{"version":"ac77cb3e8c6d3565793eb90a8373ee8033146315a3dbead3bde8db5eaf5e5ec6","affectsGlobalScope":true},{"version":"d4b1d2c51d058fc21ec2629fff7a76249dec2e36e12960ea056e3ef89174080f","affectsGlobalScope":true},{"version":"2fef54945a13095fdb9b84f705f2b5994597640c46afeb2ce78352fab4cb3279","affectsGlobalScope":true},{"version":"56e4ed5aab5f5920980066a9409bfaf53e6d21d3f8d020c17e4de584d29600ad","affectsGlobalScope":true},{"version":"33358442698bb565130f52ba79bfd3d4d484ac85fe33f3cb1759c54d18201393","affectsGlobalScope":true},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true},{"version":"55461596dc873b866911ef4e640fae4c39da7ac1fbc7ef5e649cb2f2fb42c349","affectsGlobalScope":true},"4c68749a564a6facdf675416d75789ee5a557afda8960e0803cf6711fa569288","f7b46d22a307739c145e5fddf537818038fdfffd580d79ed717f4d4d37249380",{"version":"8ca4709dbd22a34bcc1ebf93e1877645bdb02ebd3f3d9a211a299a8db2ee4ba1","affectsGlobalScope":true},"4c506b14512049dfe6f4ceb172b13c6af03663f85ba61fc57efbe6c2e7be9f44","4405cd67ec5f7f748fd793be0ce5842fa0808955b8e37518c011abfa5ab63ba5","adb17fea4d847e1267ae1241fa1ac3917c7e332999ebdab388a24d82d4f58240","05321b823dd3781d0b6aac8700bfdc0c9181d56479fe52ba6a40c9196fd661a8","472c14cdec534a465e866b6e1feee2d4e0d89c15fdc33ba80ff034fa0e80f3c1","4d807d55c784b72f71c092c34c84d09b95c29500c30252538fd5cf9a0a788c0e","df43a3968118d4b16618d7a0ac8ba89337fcce3c39e39984087ac34bf0cf250c","4714d89e7ea47b8f79a4d448a11674b2a724f93ab03cfa6879dafbab0f0c5a15","cb9a03b327570c1eae5c82a48604ef697ad1a6264ed0490743a3449de61a4fff","af88a0b0f808a6721401550621bfe67c46c6fd55000305058e7c73600d119a9b",{"version":"0a41b61ddcb640fa2a07cb7a04ecddf540b8199f70d3cf5f2d8903be722529eb","signature":"3dd80666c91b4c1ddb04cbf93038f90420af9bc18d7978acb4b9d7a302238f19"},{"version":"f531fb882daf97b248456e8f3d645c7dd6d6cfba9da6bf725bf54da02d21ae52","signature":"f6104a0c5a67150c41196a7cc40a44078eabbbc89d0bb46470f3773679395241"}],"root":[88,89],"options":{"allowJs":true,"allowSyntheticDefaultImports":true,"checkJs":true,"composite":true,"declaration":true,"declarationDir":"./build-types","declarationMap":true,"emitDeclarationOnly":true,"esModuleInterop":false,"jsx":1,"module":99,"noFallthroughCasesInSwitch":true,"noImplicitReturns":true,"rootDir":"./src","skipDefaultLibCheck":true,"strict":true,"target":99},"fileIdsList":[[77],[74,75,76],[77,87],[78,79,82,83,84,85,86],[80,81]],"referencedMap":[[81,1],[80,1],[77,2],[88,3],[78,1],[87,4],[86,1],[82,5],[79,1],[85,1]],"latestChangedDtsFile":"./build-types/utils/dom.d.ts"},"version":"5.5.3"}
|
|
1
|
+
{"program":{"fileNames":["../../node_modules/typescript/lib/lib.es5.d.ts","../../node_modules/typescript/lib/lib.es2015.d.ts","../../node_modules/typescript/lib/lib.es2016.d.ts","../../node_modules/typescript/lib/lib.es2017.d.ts","../../node_modules/typescript/lib/lib.es2018.d.ts","../../node_modules/typescript/lib/lib.es2019.d.ts","../../node_modules/typescript/lib/lib.es2020.d.ts","../../node_modules/typescript/lib/lib.es2021.d.ts","../../node_modules/typescript/lib/lib.es2022.d.ts","../../node_modules/typescript/lib/lib.es2023.d.ts","../../node_modules/typescript/lib/lib.esnext.d.ts","../../node_modules/typescript/lib/lib.dom.d.ts","../../node_modules/typescript/lib/lib.dom.iterable.d.ts","../../node_modules/typescript/lib/lib.es2015.core.d.ts","../../node_modules/typescript/lib/lib.es2015.collection.d.ts","../../node_modules/typescript/lib/lib.es2015.generator.d.ts","../../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../node_modules/typescript/lib/lib.es2015.promise.d.ts","../../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../node_modules/typescript/lib/lib.es2016.intl.d.ts","../../node_modules/typescript/lib/lib.es2017.date.d.ts","../../node_modules/typescript/lib/lib.es2017.object.d.ts","../../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../node_modules/typescript/lib/lib.es2017.string.d.ts","../../node_modules/typescript/lib/lib.es2017.intl.d.ts","../../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../node_modules/typescript/lib/lib.es2018.intl.d.ts","../../node_modules/typescript/lib/lib.es2018.promise.d.ts","../../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../node_modules/typescript/lib/lib.es2019.array.d.ts","../../node_modules/typescript/lib/lib.es2019.object.d.ts","../../node_modules/typescript/lib/lib.es2019.string.d.ts","../../node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../node_modules/typescript/lib/lib.es2019.intl.d.ts","../../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../node_modules/typescript/lib/lib.es2020.date.d.ts","../../node_modules/typescript/lib/lib.es2020.promise.d.ts","../../node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../node_modules/typescript/lib/lib.es2020.string.d.ts","../../node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../node_modules/typescript/lib/lib.es2020.intl.d.ts","../../node_modules/typescript/lib/lib.es2020.number.d.ts","../../node_modules/typescript/lib/lib.es2021.promise.d.ts","../../node_modules/typescript/lib/lib.es2021.string.d.ts","../../node_modules/typescript/lib/lib.es2021.weakref.d.ts","../../node_modules/typescript/lib/lib.es2021.intl.d.ts","../../node_modules/typescript/lib/lib.es2022.array.d.ts","../../node_modules/typescript/lib/lib.es2022.error.d.ts","../../node_modules/typescript/lib/lib.es2022.intl.d.ts","../../node_modules/typescript/lib/lib.es2022.object.d.ts","../../node_modules/typescript/lib/lib.es2022.sharedmemory.d.ts","../../node_modules/typescript/lib/lib.es2022.string.d.ts","../../node_modules/typescript/lib/lib.es2022.regexp.d.ts","../../node_modules/typescript/lib/lib.es2023.array.d.ts","../../node_modules/typescript/lib/lib.es2023.collection.d.ts","../../node_modules/typescript/lib/lib.es2023.intl.d.ts","../../node_modules/typescript/lib/lib.esnext.array.d.ts","../../node_modules/typescript/lib/lib.esnext.collection.d.ts","../../node_modules/typescript/lib/lib.esnext.intl.d.ts","../../node_modules/typescript/lib/lib.esnext.disposable.d.ts","../../node_modules/typescript/lib/lib.esnext.string.d.ts","../../node_modules/typescript/lib/lib.esnext.promise.d.ts","../../node_modules/typescript/lib/lib.esnext.decorators.d.ts","../../node_modules/typescript/lib/lib.esnext.object.d.ts","../../node_modules/typescript/lib/lib.esnext.regexp.d.ts","../../node_modules/typescript/lib/lib.decorators.d.ts","../../node_modules/typescript/lib/lib.decorators.legacy.d.ts","../../node_modules/@types/react/global.d.ts","../../node_modules/csstype/index.d.ts","../../node_modules/@types/prop-types/index.d.ts","../../node_modules/@types/react/index.d.ts","../element/build-types/create-interpolate-element.d.ts","../element/build-types/react.d.ts","../../node_modules/@types/react-dom/index.d.ts","../../node_modules/@types/react-dom/client.d.ts","../element/build-types/react-platform.d.ts","../element/build-types/utils.d.ts","../element/build-types/platform.d.ts","../element/build-types/serialize.d.ts","../element/build-types/raw-html.d.ts","../element/build-types/index.d.ts","./src/components/block-context/index.js","./src/utils/dom.js"],"fileInfos":[{"version":"44e584d4f6444f58791784f1d530875970993129442a847597db702a073ca68c","affectsGlobalScope":true},"45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4","3facaf05f0c5fc569c5649dd359892c98a85557e3e0c847964caeb67076f4d75","9a68c0c07ae2fa71b44384a839b7b8d81662a236d4b9ac30916718f7510b1b2d","5e1c4c362065a6b95ff952c0eab010f04dcd2c3494e813b493ecfd4fcb9fc0d8","68d73b4a11549f9c0b7d352d10e91e5dca8faa3322bfb77b661839c42b1ddec7","5efce4fc3c29ea84e8928f97adec086e3dc876365e0982cc8479a07954a3efd4","feecb1be483ed332fad555aff858affd90a48ab19ba7272ee084704eb7167569","5514e54f17d6d74ecefedc73c504eadffdeda79c7ea205cf9febead32d45c4bc","27bdc30a0e32783366a5abeda841bc22757c1797de8681bbe81fbc735eeb1c10","17edc026abf73c5c2dd508652d63f68ec4efd9d4856e3469890d27598209feb5",{"version":"4af6b0c727b7a2896463d512fafd23634229adf69ac7c00e2ae15a09cb084fad","affectsGlobalScope":true},{"version":"9c00a480825408b6a24c63c1b71362232927247595d7c97659bc24dc68ae0757","affectsGlobalScope":true},{"version":"6920e1448680767498a0b77c6a00a8e77d14d62c3da8967b171f1ddffa3c18e4","affectsGlobalScope":true},{"version":"dc2df20b1bcdc8c2d34af4926e2c3ab15ffe1160a63e58b7e09833f616efff44","affectsGlobalScope":true},{"version":"4443e68b35f3332f753eacc66a04ac1d2053b8b035a0e0ac1d455392b5e243b3","affectsGlobalScope":true},{"version":"bc47685641087c015972a3f072480889f0d6c65515f12bd85222f49a98952ed7","affectsGlobalScope":true},{"version":"0dc1e7ceda9b8b9b455c3a2d67b0412feab00bd2f66656cd8850e8831b08b537","affectsGlobalScope":true},{"version":"ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671","affectsGlobalScope":true},{"version":"8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0","affectsGlobalScope":true},{"version":"4ff2a353abf8a80ee399af572debb8faab2d33ad38c4b4474cff7f26e7653b8d","affectsGlobalScope":true},{"version":"93495ff27b8746f55d19fcbcdbaccc99fd95f19d057aed1bd2c0cafe1335fbf0","affectsGlobalScope":true},{"version":"6fc23bb8c3965964be8c597310a2878b53a0306edb71d4b5a4dfe760186bcc01","affectsGlobalScope":true},{"version":"ea011c76963fb15ef1cdd7ce6a6808b46322c527de2077b6cfdf23ae6f5f9ec7","affectsGlobalScope":true},{"version":"38f0219c9e23c915ef9790ab1d680440d95419ad264816fa15009a8851e79119","affectsGlobalScope":true},{"version":"bb42a7797d996412ecdc5b2787720de477103a0b2e53058569069a0e2bae6c7e","affectsGlobalScope":true},{"version":"4738f2420687fd85629c9efb470793bb753709c2379e5f85bc1815d875ceadcd","affectsGlobalScope":true},{"version":"2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893","affectsGlobalScope":true},{"version":"4de680d5bb41c17f7f68e0419412ca23c98d5749dcaaea1896172f06435891fc","affectsGlobalScope":true},{"version":"9fc46429fbe091ac5ad2608c657201eb68b6f1b8341bd6d670047d32ed0a88fa","affectsGlobalScope":true},{"version":"61c37c1de663cf4171e1192466e52c7a382afa58da01b1dc75058f032ddf0839","affectsGlobalScope":true},{"version":"b541a838a13f9234aba650a825393ffc2292dc0fc87681a5d81ef0c96d281e7a","affectsGlobalScope":true},{"version":"9e9fbd7030c440b33d021da145d3232984c8bb7916f277e8ffd3dc2e3eae2bdb","affectsGlobalScope":true},{"version":"811ec78f7fefcabbda4bfa93b3eb67d9ae166ef95f9bff989d964061cbf81a0c","affectsGlobalScope":true},{"version":"717937616a17072082152a2ef351cb51f98802fb4b2fdabd32399843875974ca","affectsGlobalScope":true},{"version":"d7e7d9b7b50e5f22c915b525acc5a49a7a6584cf8f62d0569e557c5cfc4b2ac2","affectsGlobalScope":true},{"version":"71c37f4c9543f31dfced6c7840e068c5a5aacb7b89111a4364b1d5276b852557","affectsGlobalScope":true},{"version":"576711e016cf4f1804676043e6a0a5414252560eb57de9faceee34d79798c850","affectsGlobalScope":true},{"version":"89c1b1281ba7b8a96efc676b11b264de7a8374c5ea1e6617f11880a13fc56dc6","affectsGlobalScope":true},{"version":"74f7fa2d027d5b33eb0471c8e82a6c87216223181ec31247c357a3e8e2fddc5b","affectsGlobalScope":true},{"version":"ae37d6ccd1560b0203ab88d46987393adaaa78c919e51acf32fb82c86502e98c","affectsGlobalScope":true},{"version":"063600664504610fe3e99b717a1223f8b1900087fab0b4cad1496a114744f8df","affectsGlobalScope":true},{"version":"934019d7e3c81950f9a8426d093458b65d5aff2c7c1511233c0fd5b941e608ab","affectsGlobalScope":true},{"version":"bf14a426dbbf1022d11bd08d6b8e709a2e9d246f0c6c1032f3b2edb9a902adbe","affectsGlobalScope":true},{"version":"5e07ed3809d48205d5b985642a59f2eba47c402374a7cf8006b686f79efadcbd","affectsGlobalScope":true},{"version":"2b72d528b2e2fe3c57889ca7baef5e13a56c957b946906d03767c642f386bbc3","affectsGlobalScope":true},{"version":"479553e3779be7d4f68e9f40cdb82d038e5ef7592010100410723ceced22a0f7","affectsGlobalScope":true},{"version":"368af93f74c9c932edd84c58883e736c9e3d53cec1fe24c0b0ff451f529ceab1","affectsGlobalScope":true},{"version":"af3dd424cf267428f30ccfc376f47a2c0114546b55c44d8c0f1d57d841e28d74","affectsGlobalScope":true},{"version":"995c005ab91a498455ea8dfb63aa9f83fa2ea793c3d8aa344be4a1678d06d399","affectsGlobalScope":true},{"version":"d3d7b04b45033f57351c8434f60b6be1ea71a2dfec2d0a0c3c83badbb0e3e693","affectsGlobalScope":true},{"version":"956d27abdea9652e8368ce029bb1e0b9174e9678a273529f426df4b3d90abd60","affectsGlobalScope":true},{"version":"4fa6ed14e98aa80b91f61b9805c653ee82af3502dc21c9da5268d3857772ca05","affectsGlobalScope":true},{"version":"e6633e05da3ff36e6da2ec170d0d03ccf33de50ca4dc6f5aeecb572cedd162fb","affectsGlobalScope":true},{"version":"d8670852241d4c6e03f2b89d67497a4bbefe29ecaa5a444e2c11a9b05e6fccc6","affectsGlobalScope":true},{"version":"8444af78980e3b20b49324f4a16ba35024fef3ee069a0eb67616ea6ca821c47a","affectsGlobalScope":true},{"version":"caccc56c72713969e1cfe5c3d44e5bab151544d9d2b373d7dbe5a1e4166652be","affectsGlobalScope":true},{"version":"3287d9d085fbd618c3971944b65b4be57859f5415f495b33a6adc994edd2f004","affectsGlobalScope":true},{"version":"b4b67b1a91182421f5df999988c690f14d813b9850b40acd06ed44691f6727ad","affectsGlobalScope":true},{"version":"08a58483392df5fcc1db57d782e87734f77ae9eab42516028acbfe46f29a3ef7","affectsGlobalScope":true},{"version":"436aaf437562f276ec2ddbee2f2cdedac7664c1e4c1d2c36839ddd582eeb3d0a","affectsGlobalScope":true},{"version":"8e3c06ea092138bf9fa5e874a1fdbc9d54805d074bee1de31b99a11e2fec239d","affectsGlobalScope":true},{"version":"0b11f3ca66aa33124202c80b70cd203219c3d4460cfc165e0707aa9ec710fc53","affectsGlobalScope":true},{"version":"6a3f5a0129cc80cf439ab71164334d649b47059a4f5afca90282362407d0c87f","affectsGlobalScope":true},{"version":"811c71eee4aa0ac5f7adf713323a5c41b0cf6c4e17367a34fbce379e12bbf0a4","affectsGlobalScope":true},{"version":"15b98a533864d324e5f57cd3cfc0579b231df58c1c0f6063ea0fcb13c3c74ff9","affectsGlobalScope":true},{"version":"0a6282c8827e4b9a95f4bf4f5c205673ada31b982f50572d27103df8ceb8013c","affectsGlobalScope":true},{"version":"ac77cb3e8c6d3565793eb90a8373ee8033146315a3dbead3bde8db5eaf5e5ec6","affectsGlobalScope":true},{"version":"d4b1d2c51d058fc21ec2629fff7a76249dec2e36e12960ea056e3ef89174080f","affectsGlobalScope":true},{"version":"2fef54945a13095fdb9b84f705f2b5994597640c46afeb2ce78352fab4cb3279","affectsGlobalScope":true},{"version":"56e4ed5aab5f5920980066a9409bfaf53e6d21d3f8d020c17e4de584d29600ad","affectsGlobalScope":true},{"version":"33358442698bb565130f52ba79bfd3d4d484ac85fe33f3cb1759c54d18201393","affectsGlobalScope":true},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true},{"version":"55461596dc873b866911ef4e640fae4c39da7ac1fbc7ef5e649cb2f2fb42c349","affectsGlobalScope":true},"4c68749a564a6facdf675416d75789ee5a557afda8960e0803cf6711fa569288","f7b46d22a307739c145e5fddf537818038fdfffd580d79ed717f4d4d37249380",{"version":"8ca4709dbd22a34bcc1ebf93e1877645bdb02ebd3f3d9a211a299a8db2ee4ba1","affectsGlobalScope":true},"4c506b14512049dfe6f4ceb172b13c6af03663f85ba61fc57efbe6c2e7be9f44","4405cd67ec5f7f748fd793be0ce5842fa0808955b8e37518c011abfa5ab63ba5","adb17fea4d847e1267ae1241fa1ac3917c7e332999ebdab388a24d82d4f58240","05321b823dd3781d0b6aac8700bfdc0c9181d56479fe52ba6a40c9196fd661a8","472c14cdec534a465e866b6e1feee2d4e0d89c15fdc33ba80ff034fa0e80f3c1","4d807d55c784b72f71c092c34c84d09b95c29500c30252538fd5cf9a0a788c0e","df43a3968118d4b16618d7a0ac8ba89337fcce3c39e39984087ac34bf0cf250c","4714d89e7ea47b8f79a4d448a11674b2a724f93ab03cfa6879dafbab0f0c5a15","cb9a03b327570c1eae5c82a48604ef697ad1a6264ed0490743a3449de61a4fff","af88a0b0f808a6721401550621bfe67c46c6fd55000305058e7c73600d119a9b",{"version":"0a41b61ddcb640fa2a07cb7a04ecddf540b8199f70d3cf5f2d8903be722529eb","signature":"3dd80666c91b4c1ddb04cbf93038f90420af9bc18d7978acb4b9d7a302238f19"},{"version":"e757e00105e7eb8c10520c9033ae8005c04725113f26893732184904ae75b6db","signature":"6144eb6dda3faf523032f1a739fbfa47f4aea6605695f1e1d698fad2d737f080"}],"root":[88,89],"options":{"allowJs":true,"allowSyntheticDefaultImports":true,"checkJs":true,"composite":true,"declaration":true,"declarationDir":"./build-types","declarationMap":true,"emitDeclarationOnly":true,"esModuleInterop":false,"jsx":1,"module":99,"noFallthroughCasesInSwitch":true,"noImplicitReturns":true,"rootDir":"./src","skipDefaultLibCheck":true,"strict":true,"target":99},"fileIdsList":[[77],[74,75,76],[77,87],[78,79,82,83,84,85,86],[80,81]],"referencedMap":[[81,1],[80,1],[77,2],[88,3],[78,1],[87,4],[86,1],[82,5],[79,1],[85,1]],"latestChangedDtsFile":"./build-types/utils/dom.d.ts"},"version":"5.5.3"}
|