@wordpress/block-editor 11.3.2 → 11.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/README.md +4 -4
- package/build/components/block-actions/index.js +2 -7
- package/build/components/block-actions/index.js.map +1 -1
- package/build/components/block-alignment-control/use-available-alignments.js +5 -3
- package/build/components/block-alignment-control/use-available-alignments.js.map +1 -1
- package/build/components/block-popover/inbetween.js +10 -33
- package/build/components/block-popover/inbetween.js.map +1 -1
- package/build/components/block-tools/selected-block-popover.js +2 -2
- package/build/components/block-tools/selected-block-popover.js.map +1 -1
- package/build/components/block-types-list/index.native.js +2 -0
- package/build/components/block-types-list/index.native.js.map +1 -1
- package/build/components/colors-gradients/control.js +6 -3
- package/build/components/colors-gradients/control.js.map +1 -1
- package/build/components/font-appearance-control/index.js +0 -3
- package/build/components/font-appearance-control/index.js.map +1 -1
- package/build/components/global-styles/hooks.js +106 -45
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/index.js +24 -0
- package/build/components/global-styles/index.js.map +1 -1
- package/build/components/global-styles/typography-panel.js +421 -0
- package/build/components/global-styles/typography-panel.js.map +1 -0
- package/build/components/global-styles/use-global-styles-output.js +6 -2
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/iframe/index.js +17 -11
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/image-editor/aspect-ratio-dropdown.js +2 -1
- package/build/components/image-editor/aspect-ratio-dropdown.js.map +1 -1
- package/build/components/image-size-control/index.js +6 -11
- package/build/components/image-size-control/index.js.map +1 -1
- package/build/components/inserter/block-patterns-tab.js +9 -15
- package/build/components/inserter/block-patterns-tab.js.map +1 -1
- package/build/components/inserter/block-types-tab.native.js +4 -1
- package/build/components/inserter/block-types-tab.native.js.map +1 -1
- package/build/components/inserter/reusable-blocks-tab.native.js +4 -1
- package/build/components/inserter/reusable-blocks-tab.native.js.map +1 -1
- package/build/components/inserter/search-results.native.js +4 -1
- package/build/components/inserter/search-results.native.js.map +1 -1
- package/build/components/link-control/index.js +15 -15
- package/build/components/link-control/index.js.map +1 -1
- package/build/components/link-control/settings-drawer.js +72 -30
- package/build/components/link-control/settings-drawer.js.map +1 -1
- package/build/components/link-control/settings.js +52 -0
- package/build/components/link-control/settings.js.map +1 -0
- package/build/components/list-view/index.js +6 -1
- package/build/components/list-view/index.js.map +1 -1
- package/build/components/off-canvas-editor/block-contents.js +5 -4
- package/build/components/off-canvas-editor/block-contents.js.map +1 -1
- package/build/components/off-canvas-editor/leaf-more-menu.js +116 -0
- package/build/components/off-canvas-editor/leaf-more-menu.js.map +1 -0
- package/build/components/off-canvas-editor/link-ui.js +1 -0
- package/build/components/off-canvas-editor/link-ui.js.map +1 -1
- package/build/components/provider/index.js +2 -2
- package/build/components/provider/index.js.map +1 -1
- package/build/components/rich-text/index.js +0 -2
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/url-input/index.js +2 -2
- package/build/components/url-input/index.js.map +1 -1
- package/build/components/url-popover/index.js +6 -1
- package/build/components/url-popover/index.js.map +1 -1
- package/build/hooks/dimensions.js +8 -2
- package/build/hooks/dimensions.js.map +1 -1
- package/build/hooks/font-family.js +2 -76
- package/build/hooks/font-family.js.map +1 -1
- package/build/hooks/font-size.js +3 -51
- package/build/hooks/font-size.js.map +1 -1
- package/build/hooks/gap.js +2 -1
- package/build/hooks/gap.js.map +1 -1
- package/build/hooks/index.js +2 -0
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/line-height.js +0 -42
- package/build/hooks/line-height.js.map +1 -1
- package/build/hooks/metadata.js +6 -0
- package/build/hooks/metadata.js.map +1 -1
- package/build/hooks/position.js +6 -1
- package/build/hooks/position.js.map +1 -1
- package/build/hooks/typography.js +112 -127
- package/build/hooks/typography.js.map +1 -1
- package/build/index.js +6 -6
- package/build/index.js.map +1 -1
- package/build/layouts/flow.js +23 -2
- package/build/layouts/flow.js.map +1 -1
- package/build/lock-unlock.js +19 -0
- package/build/lock-unlock.js.map +1 -0
- package/build/{experiments.js → private-apis.js} +12 -19
- package/build/private-apis.js.map +1 -0
- package/build/{experiments.native.js → private-apis.native.js} +9 -19
- package/build/private-apis.native.js.map +1 -0
- package/build/store/index.js +3 -3
- package/build/store/index.js.map +1 -1
- package/build/store/selectors.js +18 -1
- package/build/store/selectors.js.map +1 -1
- package/build-module/components/block-actions/index.js +2 -7
- package/build-module/components/block-actions/index.js.map +1 -1
- package/build-module/components/block-alignment-control/use-available-alignments.js +5 -3
- package/build-module/components/block-alignment-control/use-available-alignments.js.map +1 -1
- package/build-module/components/block-popover/inbetween.js +10 -33
- package/build-module/components/block-popover/inbetween.js.map +1 -1
- package/build-module/components/block-tools/selected-block-popover.js +1 -1
- package/build-module/components/block-tools/selected-block-popover.js.map +1 -1
- package/build-module/components/block-types-list/index.native.js +2 -0
- package/build-module/components/block-types-list/index.native.js.map +1 -1
- package/build-module/components/colors-gradients/control.js +6 -3
- package/build-module/components/colors-gradients/control.js.map +1 -1
- package/build-module/components/font-appearance-control/index.js +2 -1
- package/build-module/components/font-appearance-control/index.js.map +1 -1
- package/build-module/components/global-styles/hooks.js +100 -46
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/index.js +2 -1
- package/build-module/components/global-styles/index.js.map +1 -1
- package/build-module/components/global-styles/typography-panel.js +400 -0
- package/build-module/components/global-styles/typography-panel.js.map +1 -0
- package/build-module/components/global-styles/use-global-styles-output.js +6 -2
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/iframe/index.js +17 -11
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/image-editor/aspect-ratio-dropdown.js +2 -1
- package/build-module/components/image-editor/aspect-ratio-dropdown.js.map +1 -1
- package/build-module/components/image-size-control/index.js +7 -12
- package/build-module/components/image-size-control/index.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab.js +9 -15
- package/build-module/components/inserter/block-patterns-tab.js.map +1 -1
- package/build-module/components/inserter/block-types-tab.native.js +3 -1
- package/build-module/components/inserter/block-types-tab.native.js.map +1 -1
- package/build-module/components/inserter/reusable-blocks-tab.native.js +3 -1
- package/build-module/components/inserter/reusable-blocks-tab.native.js.map +1 -1
- package/build-module/components/inserter/search-results.native.js +3 -1
- package/build-module/components/inserter/search-results.native.js.map +1 -1
- package/build-module/components/link-control/index.js +16 -16
- package/build-module/components/link-control/index.js.map +1 -1
- package/build-module/components/link-control/settings-drawer.js +68 -30
- package/build-module/components/link-control/settings-drawer.js.map +1 -1
- package/build-module/components/link-control/settings.js +43 -0
- package/build-module/components/link-control/settings.js.map +1 -0
- package/build-module/components/list-view/index.js +6 -1
- package/build-module/components/list-view/index.js.map +1 -1
- package/build-module/components/off-canvas-editor/block-contents.js +4 -3
- package/build-module/components/off-canvas-editor/block-contents.js.map +1 -1
- package/build-module/components/off-canvas-editor/leaf-more-menu.js +99 -0
- package/build-module/components/off-canvas-editor/leaf-more-menu.js.map +1 -0
- package/build-module/components/off-canvas-editor/link-ui.js +1 -0
- package/build-module/components/off-canvas-editor/link-ui.js.map +1 -1
- package/build-module/components/provider/index.js +1 -1
- package/build-module/components/provider/index.js.map +1 -1
- package/build-module/components/rich-text/index.js +0 -2
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/url-input/index.js +2 -2
- package/build-module/components/url-input/index.js.map +1 -1
- package/build-module/components/url-popover/index.js +6 -2
- package/build-module/components/url-popover/index.js.map +1 -1
- package/build-module/hooks/dimensions.js +7 -1
- package/build-module/hooks/dimensions.js.map +1 -1
- package/build-module/hooks/font-family.js +3 -69
- package/build-module/hooks/font-family.js.map +1 -1
- package/build-module/hooks/font-size.js +6 -47
- package/build-module/hooks/font-size.js.map +1 -1
- package/build-module/hooks/gap.js +3 -2
- package/build-module/hooks/gap.js.map +1 -1
- package/build-module/hooks/index.js +1 -0
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/line-height.js +0 -38
- package/build-module/hooks/line-height.js.map +1 -1
- package/build-module/hooks/metadata.js +6 -0
- package/build-module/hooks/metadata.js.map +1 -1
- package/build-module/hooks/position.js +5 -1
- package/build-module/hooks/position.js.map +1 -1
- package/build-module/hooks/typography.js +110 -123
- package/build-module/hooks/typography.js.map +1 -1
- package/build-module/index.js +1 -1
- package/build-module/index.js.map +1 -1
- package/build-module/layouts/flow.js +23 -2
- package/build-module/layouts/flow.js.map +1 -1
- package/build-module/lock-unlock.js +9 -0
- package/build-module/lock-unlock.js.map +1 -0
- package/build-module/private-apis.js +19 -0
- package/build-module/private-apis.js.map +1 -0
- package/build-module/private-apis.native.js +15 -0
- package/build-module/private-apis.native.js.map +1 -0
- package/build-module/store/index.js +1 -1
- package/build-module/store/index.js.map +1 -1
- package/build-module/store/selectors.js +18 -1
- package/build-module/store/selectors.js.map +1 -1
- package/build-style/style-rtl.css +35 -22
- package/build-style/style.css +35 -22
- package/package.json +31 -31
- package/src/components/block-actions/index.js +0 -9
- package/src/components/block-alignment-control/use-available-alignments.js +17 -12
- package/src/components/block-popover/inbetween.js +21 -53
- package/src/components/block-tools/selected-block-popover.js +1 -1
- package/src/components/block-types-list/index.native.js +2 -0
- package/src/components/colors-gradients/control.js +3 -0
- package/src/components/font-appearance-control/index.js +1 -1
- package/src/components/global-styles/hooks.js +186 -66
- package/src/components/global-styles/index.js +5 -0
- package/src/components/global-styles/typography-panel.js +403 -0
- package/src/components/global-styles/use-global-styles-output.js +6 -2
- package/src/components/iframe/index.js +20 -18
- package/src/components/image-editor/aspect-ratio-dropdown.js +1 -0
- package/src/components/image-size-control/index.js +10 -12
- package/src/components/image-size-control/style.scss +3 -21
- package/src/components/inserter/block-patterns-tab.js +9 -23
- package/src/components/inserter/block-types-tab.native.js +2 -0
- package/src/components/inserter/reusable-blocks-tab.native.js +2 -0
- package/src/components/inserter/search-results.native.js +2 -0
- package/src/components/link-control/index.js +22 -22
- package/src/components/link-control/settings-drawer.js +85 -30
- package/src/components/link-control/settings.js +41 -0
- package/src/components/link-control/style.scss +39 -7
- package/src/components/link-control/test/index.js +213 -4
- package/src/components/list-view/index.js +5 -0
- package/src/components/off-canvas-editor/block-contents.js +3 -2
- package/src/components/off-canvas-editor/leaf-more-menu.js +115 -0
- package/src/components/off-canvas-editor/link-ui.js +1 -0
- package/src/components/provider/index.js +1 -1
- package/src/components/rich-text/index.js +0 -2
- package/src/components/url-input/index.js +3 -2
- package/src/components/url-popover/index.js +8 -2
- package/src/hooks/dimensions.js +13 -1
- package/src/hooks/font-family.js +0 -58
- package/src/hooks/font-size.js +1 -36
- package/src/hooks/gap.js +9 -2
- package/src/hooks/index.js +1 -0
- package/src/hooks/line-height.js +0 -33
- package/src/hooks/metadata.js +4 -0
- package/src/hooks/position.js +7 -1
- package/src/hooks/typography.js +133 -212
- package/src/index.js +1 -1
- package/src/layouts/flow.js +16 -1
- package/src/lock-unlock.js +10 -0
- package/src/private-apis.js +19 -0
- package/src/private-apis.native.js +15 -0
- package/src/store/index.js +1 -1
- package/src/store/selectors.js +16 -1
- package/tsconfig.json +20 -1
- package/build/experiments.js.map +0 -1
- package/build/experiments.native.js.map +0 -1
- package/build/hooks/font-appearance.js +0 -188
- package/build/hooks/font-appearance.js.map +0 -1
- package/build/hooks/letter-spacing.js +0 -129
- package/build/hooks/letter-spacing.js.map +0 -1
- package/build/hooks/text-decoration.js +0 -130
- package/build/hooks/text-decoration.js.map +0 -1
- package/build/hooks/text-transform.js +0 -130
- package/build/hooks/text-transform.js.map +0 -1
- package/build-module/experiments.js +0 -25
- package/build-module/experiments.js.map +0 -1
- package/build-module/experiments.native.js +0 -23
- package/build-module/experiments.native.js.map +0 -1
- package/build-module/hooks/font-appearance.js +0 -161
- package/build-module/hooks/font-appearance.js.map +0 -1
- package/build-module/hooks/letter-spacing.js +0 -107
- package/build-module/hooks/letter-spacing.js.map +0 -1
- package/build-module/hooks/text-decoration.js +0 -108
- package/build-module/hooks/text-decoration.js.map +0 -1
- package/build-module/hooks/text-transform.js +0 -108
- package/build-module/hooks/text-transform.js.map +0 -1
- package/src/experiments.js +0 -27
- package/src/experiments.native.js +0 -25
- package/src/hooks/font-appearance.js +0 -146
- package/src/hooks/letter-spacing.js +0 -101
- package/src/hooks/text-decoration.js +0 -102
- package/src/hooks/text-transform.js +0 -101
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/hooks/position.js"],"names":["classnames","__","sprintf","getBlockSupport","hasBlockSupport","BaseControl","CustomSelectControl","createHigherOrderComponent","useInstanceId","useSelect","useContext","useMemo","createPortal","Platform","addFilter","BlockList","useSetting","InspectorControls","cleanEmptyObject","store","blockEditorStore","POSITION_SUPPORT_KEY","OPTION_CLASSNAME","DEFAULT_OPTION","key","value","name","className","STICKY_OPTION","__experimentalHint","FIXED_OPTION","POSITION_SIDES","VALID_POSITION_TYPES","getPositionCSS","selector","style","output","type","positionType","position","includes","forEach","side","undefined","hasStickyPositionSupport","blockType","support","sticky","hasFixedPositionSupport","fixed","hasPositionSupport","hasPositionValue","props","attributes","hasStickyOrFixedPositionValue","resetPosition","setAttributes","top","right","bottom","left","useIsPositionDisabled","blockName","allowFixed","allowSticky","isDisabled","PositionPanel","clientId","hasParents","select","getBlockParents","parents","length","options","availableOptions","push","onChangeType","next","placementValue","newStyle","selectedOption","find","option","web","selectedItem","native","withInspectorControls","BlockEdit","positionSupport","showPositionControls","withPositionStyles","BlockListBlock","hasPositionBlockSupport","allowPositionStyles","id","element","__unstableElementContext","positionSelector","css"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SAASC,eAAT,EAA0BC,eAA1B,QAAiD,mBAAjD;AACA,SAASC,WAAT,EAAsBC,mBAAtB,QAAiD,uBAAjD;AACA,SAASC,0BAAT,EAAqCC,aAArC,QAA0D,oBAA1D;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SACCC,UADD,EAEC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,QAAnC,0DAAgB,sBAA6BF,IAAM,EAArD,GACCwD,mBAAmB,IACnB,CAAC,CAAEK,GADH,IAEA,CAAC,EAAE7C,UAAF,aAAEA,UAAF,qCAAEA,UAAU,CAAElB,KAAd,wEAAE,mBAAmBI,QAArB,kDAAE,sBAA6BF,IAA/B;AAL6C,GAApB,CAA5B;AAQA,SACC,8BACGwD,mBAAmB,IACpBE,OADC,IAED,CAAC,CAAEG,GAFF,IAGDtF,YAAY,CAAE,6BAASsF,GAAT,CAAF,EAA0BH,OAA1B,CAJd,EAKC,cAAC,cAAD,eAAqB3C,KAArB;AAA6B,IAAA,SAAS,EAAGzB;AAAzC,KALD,CADD;AASA,CA5C0D,CAArD;AA+CPb,SAAS,CACR,uBADQ,EAER,2CAFQ,EAGR4E,kBAHQ,CAAT;AAKA5E,SAAS,CACR,kBADQ,EAER,8CAFQ,EAGRwE,qBAHQ,CAAT","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { getBlockSupport, hasBlockSupport } from '@wordpress/blocks';\nimport { BaseControl, CustomSelectControl } from '@wordpress/components';\nimport { createHigherOrderComponent, useInstanceId } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\nimport {\n\tuseContext,\n\tuseMemo,\n\tcreatePortal,\n\tPlatform,\n} from '@wordpress/element';\nimport { addFilter } from '@wordpress/hooks';\n\n/**\n * Internal dependencies\n */\nimport BlockList from '../components/block-list';\nimport useSetting from '../components/use-setting';\nimport InspectorControls from '../components/inspector-controls';\nimport { cleanEmptyObject } from './utils';\nimport { store as blockEditorStore } from '../store';\n\nconst POSITION_SUPPORT_KEY = 'position';\n\nconst OPTION_CLASSNAME =\n\t'block-editor-hooks__position-selection__select-control__option';\n\nconst DEFAULT_OPTION = {\n\tkey: 'default',\n\tvalue: '',\n\tname: __( 'Default' ),\n\tclassName: OPTION_CLASSNAME,\n};\n\nconst STICKY_OPTION = {\n\tkey: 'sticky',\n\tvalue: 'sticky',\n\tname: __( 'Sticky' ),\n\tclassName: OPTION_CLASSNAME,\n\t__experimentalHint: __(\n\t\t'The block will stick to the top of the window instead of scrolling.'\n\t),\n};\n\nconst FIXED_OPTION = {\n\tkey: 'fixed',\n\tvalue: 'fixed',\n\tname: __( 'Fixed' ),\n\tclassName: OPTION_CLASSNAME,\n\t__experimentalHint: __(\n\t\t'The block will not move when the page is scrolled.'\n\t),\n};\n\nconst POSITION_SIDES = [ 'top', 'right', 'bottom', 'left' ];\nconst VALID_POSITION_TYPES = [ 'sticky', 'fixed' ];\n\n/**\n * Get calculated position CSS.\n *\n * @param {Object} props Component props.\n * @param {string} props.selector Selector to use.\n * @param {Object} props.style Style object.\n * @return {string} The generated CSS rules.\n */\nexport function getPositionCSS( { selector, style } ) {\n\tlet output = '';\n\n\tconst { type: positionType } = style?.position || {};\n\n\tif ( ! VALID_POSITION_TYPES.includes( positionType ) ) {\n\t\treturn output;\n\t}\n\n\toutput += `${ selector } {`;\n\toutput += `position: ${ positionType };`;\n\n\tPOSITION_SIDES.forEach( ( side ) => {\n\t\tif ( style?.position?.[ side ] !== undefined ) {\n\t\t\toutput += `${ side }: ${ style.position[ side ] };`;\n\t\t}\n\t} );\n\n\tif ( positionType === 'sticky' || positionType === 'fixed' ) {\n\t\t// TODO: Replace hard-coded z-index value with a z-index preset approach in theme.json.\n\t\toutput += `z-index: 10`;\n\t}\n\toutput += `}`;\n\n\treturn output;\n}\n\n/**\n * Determines if there is sticky position support.\n *\n * @param {string|Object} blockType Block name or Block Type object.\n *\n * @return {boolean} Whether there is support.\n */\nexport function hasStickyPositionSupport( blockType ) {\n\tconst support = getBlockSupport( blockType, POSITION_SUPPORT_KEY );\n\treturn !! ( true === support || support?.sticky );\n}\n\n/**\n * Determines if there is fixed position support.\n *\n * @param {string|Object} blockType Block name or Block Type object.\n *\n * @return {boolean} Whether there is support.\n */\nexport function hasFixedPositionSupport( blockType ) {\n\tconst support = getBlockSupport( blockType, POSITION_SUPPORT_KEY );\n\treturn !! ( true === support || support?.fixed );\n}\n\n/**\n * Determines if there is position support.\n *\n * @param {string|Object} blockType Block name or Block Type object.\n *\n * @return {boolean} Whether there is support.\n */\nexport function hasPositionSupport( blockType ) {\n\tconst support = getBlockSupport( blockType, POSITION_SUPPORT_KEY );\n\treturn !! support;\n}\n\n/**\n * Checks if there is a current value in the position block support attributes.\n *\n * @param {Object} props Block props.\n * @return {boolean} Whether or not the block has a position value set.\n */\nexport function hasPositionValue( props ) {\n\treturn props.attributes.style?.position?.type !== undefined;\n}\n\n/**\n * Checks if the block is currently set to a sticky or fixed position.\n * This check is helpful for determining how to position block toolbars or other elements.\n *\n * @param {Object} attributes Block attributes.\n * @return {boolean} Whether or not the block is set to a sticky or fixed position.\n */\nexport function hasStickyOrFixedPositionValue( attributes ) {\n\tconst positionType = attributes.style?.position?.type;\n\treturn positionType === 'sticky' || positionType === 'fixed';\n}\n\n/**\n * Resets the position block support attributes. This can be used when disabling\n * the position support controls for a block via a `ToolsPanel`.\n *\n * @param {Object} props Block props.\n * @param {Object} props.attributes Block's attributes.\n * @param {Object} props.setAttributes Function to set block's attributes.\n */\nexport function resetPosition( { attributes = {}, setAttributes } ) {\n\tconst { style = {} } = attributes;\n\n\tsetAttributes( {\n\t\tstyle: cleanEmptyObject( {\n\t\t\t...style,\n\t\t\tposition: {\n\t\t\t\t...style?.position,\n\t\t\t\ttype: undefined,\n\t\t\t\ttop: undefined,\n\t\t\t\tright: undefined,\n\t\t\t\tbottom: undefined,\n\t\t\t\tleft: undefined,\n\t\t\t},\n\t\t} ),\n\t} );\n}\n\n/**\n * Custom hook that checks if position settings have been disabled.\n *\n * @param {string} name The name of the block.\n *\n * @return {boolean} Whether padding setting is disabled.\n */\nexport function useIsPositionDisabled( { name: blockName } = {} ) {\n\tconst allowFixed = useSetting( 'position.fixed' );\n\tconst allowSticky = useSetting( 'position.sticky' );\n\tconst isDisabled = ! allowFixed && ! allowSticky;\n\n\treturn ! hasPositionSupport( blockName ) || isDisabled;\n}\n\n/*\n * Position controls rendered in an inspector control panel.\n *\n * @param {Object} props\n *\n * @return {WPElement} Position panel.\n */\nexport function PositionPanel( props ) {\n\tconst {\n\t\tattributes: { style = {} },\n\t\tclientId,\n\t\tname: blockName,\n\t\tsetAttributes,\n\t} = props;\n\n\tconst allowFixed = hasFixedPositionSupport( blockName );\n\tconst allowSticky = hasStickyPositionSupport( blockName );\n\tconst value = style?.position?.type;\n\n\tconst { hasParents } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockParents } = select( blockEditorStore );\n\t\t\tconst parents = getBlockParents( clientId );\n\t\t\treturn {\n\t\t\t\thasParents: parents.length,\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst options = useMemo( () => {\n\t\tconst availableOptions = [ DEFAULT_OPTION ];\n\t\t// Only display sticky option if the block has no parents (is at the root of the document),\n\t\t// or if the block already has a sticky position value set.\n\t\tif (\n\t\t\t( allowSticky && ! hasParents ) ||\n\t\t\tvalue === STICKY_OPTION.value\n\t\t) {\n\t\t\tavailableOptions.push( STICKY_OPTION );\n\t\t}\n\t\tif ( allowFixed || value === FIXED_OPTION.value ) {\n\t\t\tavailableOptions.push( FIXED_OPTION );\n\t\t}\n\t\treturn availableOptions;\n\t}, [ allowFixed, allowSticky, hasParents, value ] );\n\n\tconst onChangeType = ( next ) => {\n\t\t// For now, use a hard-coded `0px` value for the position.\n\t\t// `0px` is preferred over `0` as it can be used in `calc()` functions.\n\t\t// In the future, it could be useful to allow for an offset value.\n\t\tconst placementValue = '0px';\n\n\t\tconst newStyle = {\n\t\t\t...style,\n\t\t\tposition: {\n\t\t\t\t...style?.position,\n\t\t\t\ttype: next,\n\t\t\t\ttop:\n\t\t\t\t\tnext === 'sticky' || next === 'fixed'\n\t\t\t\t\t\t? placementValue\n\t\t\t\t\t\t: undefined,\n\t\t\t},\n\t\t};\n\n\t\tsetAttributes( {\n\t\t\tstyle: cleanEmptyObject( newStyle ),\n\t\t} );\n\t};\n\n\tconst selectedOption = value\n\t\t? options.find( ( option ) => option.value === value ) || DEFAULT_OPTION\n\t\t: DEFAULT_OPTION;\n\n\t// Only display position controls if there is at least one option to choose from.\n\treturn Platform.select( {\n\t\tweb:\n\t\t\toptions.length > 1 ? (\n\t\t\t\t<InspectorControls group=\"position\">\n\t\t\t\t\t<BaseControl className=\"block-editor-hooks__position-selection\">\n\t\t\t\t\t\t<CustomSelectControl\n\t\t\t\t\t\t\t__nextUnconstrainedWidth\n\t\t\t\t\t\t\t__next36pxDefaultSize\n\t\t\t\t\t\t\tclassName=\"block-editor-hooks__position-selection__select-control\"\n\t\t\t\t\t\t\tlabel={ __( 'Position' ) }\n\t\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\t\tdescribedBy={ sprintf(\n\t\t\t\t\t\t\t\t// translators: %s: Currently selected position.\n\t\t\t\t\t\t\t\t__( 'Currently selected position: %s' ),\n\t\t\t\t\t\t\t\tselectedOption.name\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\toptions={ options }\n\t\t\t\t\t\t\tvalue={ selectedOption }\n\t\t\t\t\t\t\t__experimentalShowSelectedHint\n\t\t\t\t\t\t\tonChange={ ( { selectedItem } ) => {\n\t\t\t\t\t\t\t\tonChangeType( selectedItem.value );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tsize={ '__unstable-large' }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</BaseControl>\n\t\t\t\t</InspectorControls>\n\t\t\t) : null,\n\t\tnative: null,\n\t} );\n}\n\n/**\n * Override the default edit UI to include position controls.\n *\n * @param {Function} BlockEdit Original component.\n *\n * @return {Function} Wrapped component.\n */\nexport const withInspectorControls = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tconst { name: blockName } = props;\n\t\tconst positionSupport = hasBlockSupport(\n\t\t\tblockName,\n\t\t\tPOSITION_SUPPORT_KEY\n\t\t);\n\t\tconst showPositionControls =\n\t\t\tpositionSupport && ! useIsPositionDisabled( props );\n\n\t\treturn [\n\t\t\tshowPositionControls && (\n\t\t\t\t<PositionPanel key=\"position\" { ...props } />\n\t\t\t),\n\t\t\t<BlockEdit key=\"edit\" { ...props } />,\n\t\t];\n\t},\n\t'withInspectorControls'\n);\n\n/**\n * Override the default block element to add the position styles.\n *\n * @param {Function} BlockListBlock Original component.\n *\n * @return {Function} Wrapped component.\n */\nexport const withPositionStyles = createHigherOrderComponent(\n\t( BlockListBlock ) => ( props ) => {\n\t\tconst { name, attributes } = props;\n\t\tconst hasPositionBlockSupport = hasBlockSupport(\n\t\t\tname,\n\t\t\tPOSITION_SUPPORT_KEY\n\t\t);\n\t\tconst allowPositionStyles =\n\t\t\thasPositionBlockSupport && ! useIsPositionDisabled( props );\n\n\t\tconst id = useInstanceId( BlockListBlock );\n\t\tconst element = useContext( BlockList.__unstableElementContext );\n\n\t\t// Higher specificity to override defaults in editor UI.\n\t\tconst positionSelector = `.wp-container-${ id }.wp-container-${ id }`;\n\n\t\t// Get CSS string for the current position values.\n\t\tlet css;\n\t\tif ( allowPositionStyles ) {\n\t\t\tcss =\n\t\t\t\tgetPositionCSS( {\n\t\t\t\t\tselector: positionSelector,\n\t\t\t\t\tstyle: attributes?.style,\n\t\t\t\t} ) || '';\n\t\t}\n\n\t\t// Attach a `wp-container-` id-based class name.\n\t\tconst className = classnames( props?.className, {\n\t\t\t[ `wp-container-${ id }` ]: allowPositionStyles && !! css, // Only attach a container class if there is generated CSS to be attached.\n\t\t\t[ `is-position-${ attributes?.style?.position?.type }` ]:\n\t\t\t\tallowPositionStyles &&\n\t\t\t\t!! css &&\n\t\t\t\t!! attributes?.style?.position?.type,\n\t\t} );\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ allowPositionStyles &&\n\t\t\t\t\telement &&\n\t\t\t\t\t!! css &&\n\t\t\t\t\tcreatePortal( <style>{ css }</style>, element ) }\n\t\t\t\t<BlockListBlock { ...props } className={ className } />\n\t\t\t</>\n\t\t);\n\t}\n);\n\naddFilter(\n\t'editor.BlockListBlock',\n\t'core/editor/position/with-position-styles',\n\twithPositionStyles\n);\naddFilter(\n\t'editor.BlockEdit',\n\t'core/editor/position/with-inspector-controls',\n\twithInspectorControls\n);\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/hooks/position.js"],"names":["classnames","__","sprintf","getBlockSupport","hasBlockSupport","BaseControl","privateApis","componentsPrivateApis","createHigherOrderComponent","useInstanceId","useSelect","useContext","useMemo","createPortal","Platform","addFilter","BlockList","useSetting","InspectorControls","cleanEmptyObject","unlock","store","blockEditorStore","CustomSelectControl","POSITION_SUPPORT_KEY","OPTION_CLASSNAME","DEFAULT_OPTION","key","value","name","className","STICKY_OPTION","__experimentalHint","FIXED_OPTION","POSITION_SIDES","VALID_POSITION_TYPES","getPositionCSS","selector","style","output","type","positionType","position","includes","forEach","side","undefined","hasStickyPositionSupport","blockType","support","sticky","hasFixedPositionSupport","fixed","hasPositionSupport","hasPositionValue","props","attributes","hasStickyOrFixedPositionValue","resetPosition","setAttributes","top","right","bottom","left","useIsPositionDisabled","blockName","allowFixed","allowSticky","isDisabled","PositionPanel","clientId","hasParents","select","getBlockParents","parents","length","options","availableOptions","push","onChangeType","next","placementValue","newStyle","selectedOption","find","option","web","selectedItem","native","withInspectorControls","BlockEdit","positionSupport","showPositionControls","withPositionStyles","BlockListBlock","hasPositionBlockSupport","allowPositionStyles","id","element","__unstableElementContext","positionSelector","css"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SAASC,eAAT,EAA0BC,eAA1B,QAAiD,mBAAjD;AACA,SACCC,WADD,EAECC,WAAW,IAAIC,qBAFhB,QAGO,uBAHP;AAIA,SAASC,0BAAT,EAAqCC,aAArC,QAA0D,oBAA1D;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SACCC,U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C,CAAEK,GADP;AACY;AAC3D,KAAG,eAAe7C,UAAhB,aAAgBA,UAAhB,6CAAgBA,UAAU,CAAElB,KAA5B,gFAAgB,mBAAmBI,QAAnC,0DAAgB,sBAA6BF,IAAM,EAArD,GACCwD,mBAAmB,IACnB,CAAC,CAAEK,GADH,IAEA,CAAC,EAAE7C,UAAF,aAAEA,UAAF,qCAAEA,UAAU,CAAElB,KAAd,wEAAE,mBAAmBI,QAArB,kDAAE,sBAA6BF,IAA/B;AAL6C,GAApB,CAA5B;AAQA,SACC,8BACGwD,mBAAmB,IACpBE,OADC,IAED,CAAC,CAAEG,GAFF,IAGDxF,YAAY,CAAE,6BAASwF,GAAT,CAAF,EAA0BH,OAA1B,CAJd,EAKC,cAAC,cAAD,eAAqB3C,KAArB;AAA6B,IAAA,SAAS,EAAGzB;AAAzC,KALD,CADD;AASA,CA5C0D,CAArD;AA+CPf,SAAS,CACR,uBADQ,EAER,2CAFQ,EAGR8E,kBAHQ,CAAT;AAKA9E,SAAS,CACR,kBADQ,EAER,8CAFQ,EAGR0E,qBAHQ,CAAT","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { getBlockSupport, hasBlockSupport } from '@wordpress/blocks';\nimport {\n\tBaseControl,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { createHigherOrderComponent, useInstanceId } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\nimport {\n\tuseContext,\n\tuseMemo,\n\tcreatePortal,\n\tPlatform,\n} from '@wordpress/element';\nimport { addFilter } from '@wordpress/hooks';\n\n/**\n * Internal dependencies\n */\nimport BlockList from '../components/block-list';\nimport useSetting from '../components/use-setting';\nimport InspectorControls from '../components/inspector-controls';\nimport { cleanEmptyObject } from './utils';\nimport { unlock } from '../lock-unlock';\nimport { store as blockEditorStore } from '../store';\n\nconst { CustomSelectControl } = unlock( componentsPrivateApis );\n\nconst POSITION_SUPPORT_KEY = 'position';\n\nconst OPTION_CLASSNAME =\n\t'block-editor-hooks__position-selection__select-control__option';\n\nconst DEFAULT_OPTION = {\n\tkey: 'default',\n\tvalue: '',\n\tname: __( 'Default' ),\n\tclassName: OPTION_CLASSNAME,\n};\n\nconst STICKY_OPTION = {\n\tkey: 'sticky',\n\tvalue: 'sticky',\n\tname: __( 'Sticky' ),\n\tclassName: OPTION_CLASSNAME,\n\t__experimentalHint: __(\n\t\t'The block will stick to the top of the window instead of scrolling.'\n\t),\n};\n\nconst FIXED_OPTION = {\n\tkey: 'fixed',\n\tvalue: 'fixed',\n\tname: __( 'Fixed' ),\n\tclassName: OPTION_CLASSNAME,\n\t__experimentalHint: __(\n\t\t'The block will not move when the page is scrolled.'\n\t),\n};\n\nconst POSITION_SIDES = [ 'top', 'right', 'bottom', 'left' ];\nconst VALID_POSITION_TYPES = [ 'sticky', 'fixed' ];\n\n/**\n * Get calculated position CSS.\n *\n * @param {Object} props Component props.\n * @param {string} props.selector Selector to use.\n * @param {Object} props.style Style object.\n * @return {string} The generated CSS rules.\n */\nexport function getPositionCSS( { selector, style } ) {\n\tlet output = '';\n\n\tconst { type: positionType } = style?.position || {};\n\n\tif ( ! VALID_POSITION_TYPES.includes( positionType ) ) {\n\t\treturn output;\n\t}\n\n\toutput += `${ selector } {`;\n\toutput += `position: ${ positionType };`;\n\n\tPOSITION_SIDES.forEach( ( side ) => {\n\t\tif ( style?.position?.[ side ] !== undefined ) {\n\t\t\toutput += `${ side }: ${ style.position[ side ] };`;\n\t\t}\n\t} );\n\n\tif ( positionType === 'sticky' || positionType === 'fixed' ) {\n\t\t// TODO: Replace hard-coded z-index value with a z-index preset approach in theme.json.\n\t\toutput += `z-index: 10`;\n\t}\n\toutput += `}`;\n\n\treturn output;\n}\n\n/**\n * Determines if there is sticky position support.\n *\n * @param {string|Object} blockType Block name or Block Type object.\n *\n * @return {boolean} Whether there is support.\n */\nexport function hasStickyPositionSupport( blockType ) {\n\tconst support = getBlockSupport( blockType, POSITION_SUPPORT_KEY );\n\treturn !! ( true === support || support?.sticky );\n}\n\n/**\n * Determines if there is fixed position support.\n *\n * @param {string|Object} blockType Block name or Block Type object.\n *\n * @return {boolean} Whether there is support.\n */\nexport function hasFixedPositionSupport( blockType ) {\n\tconst support = getBlockSupport( blockType, POSITION_SUPPORT_KEY );\n\treturn !! ( true === support || support?.fixed );\n}\n\n/**\n * Determines if there is position support.\n *\n * @param {string|Object} blockType Block name or Block Type object.\n *\n * @return {boolean} Whether there is support.\n */\nexport function hasPositionSupport( blockType ) {\n\tconst support = getBlockSupport( blockType, POSITION_SUPPORT_KEY );\n\treturn !! support;\n}\n\n/**\n * Checks if there is a current value in the position block support attributes.\n *\n * @param {Object} props Block props.\n * @return {boolean} Whether or not the block has a position value set.\n */\nexport function hasPositionValue( props ) {\n\treturn props.attributes.style?.position?.type !== undefined;\n}\n\n/**\n * Checks if the block is currently set to a sticky or fixed position.\n * This check is helpful for determining how to position block toolbars or other elements.\n *\n * @param {Object} attributes Block attributes.\n * @return {boolean} Whether or not the block is set to a sticky or fixed position.\n */\nexport function hasStickyOrFixedPositionValue( attributes ) {\n\tconst positionType = attributes.style?.position?.type;\n\treturn positionType === 'sticky' || positionType === 'fixed';\n}\n\n/**\n * Resets the position block support attributes. This can be used when disabling\n * the position support controls for a block via a `ToolsPanel`.\n *\n * @param {Object} props Block props.\n * @param {Object} props.attributes Block's attributes.\n * @param {Object} props.setAttributes Function to set block's attributes.\n */\nexport function resetPosition( { attributes = {}, setAttributes } ) {\n\tconst { style = {} } = attributes;\n\n\tsetAttributes( {\n\t\tstyle: cleanEmptyObject( {\n\t\t\t...style,\n\t\t\tposition: {\n\t\t\t\t...style?.position,\n\t\t\t\ttype: undefined,\n\t\t\t\ttop: undefined,\n\t\t\t\tright: undefined,\n\t\t\t\tbottom: undefined,\n\t\t\t\tleft: undefined,\n\t\t\t},\n\t\t} ),\n\t} );\n}\n\n/**\n * Custom hook that checks if position settings have been disabled.\n *\n * @param {string} name The name of the block.\n *\n * @return {boolean} Whether padding setting is disabled.\n */\nexport function useIsPositionDisabled( { name: blockName } = {} ) {\n\tconst allowFixed = useSetting( 'position.fixed' );\n\tconst allowSticky = useSetting( 'position.sticky' );\n\tconst isDisabled = ! allowFixed && ! allowSticky;\n\n\treturn ! hasPositionSupport( blockName ) || isDisabled;\n}\n\n/*\n * Position controls rendered in an inspector control panel.\n *\n * @param {Object} props\n *\n * @return {WPElement} Position panel.\n */\nexport function PositionPanel( props ) {\n\tconst {\n\t\tattributes: { style = {} },\n\t\tclientId,\n\t\tname: blockName,\n\t\tsetAttributes,\n\t} = props;\n\n\tconst allowFixed = hasFixedPositionSupport( blockName );\n\tconst allowSticky = hasStickyPositionSupport( blockName );\n\tconst value = style?.position?.type;\n\n\tconst { hasParents } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockParents } = select( blockEditorStore );\n\t\t\tconst parents = getBlockParents( clientId );\n\t\t\treturn {\n\t\t\t\thasParents: parents.length,\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst options = useMemo( () => {\n\t\tconst availableOptions = [ DEFAULT_OPTION ];\n\t\t// Only display sticky option if the block has no parents (is at the root of the document),\n\t\t// or if the block already has a sticky position value set.\n\t\tif (\n\t\t\t( allowSticky && ! hasParents ) ||\n\t\t\tvalue === STICKY_OPTION.value\n\t\t) {\n\t\t\tavailableOptions.push( STICKY_OPTION );\n\t\t}\n\t\tif ( allowFixed || value === FIXED_OPTION.value ) {\n\t\t\tavailableOptions.push( FIXED_OPTION );\n\t\t}\n\t\treturn availableOptions;\n\t}, [ allowFixed, allowSticky, hasParents, value ] );\n\n\tconst onChangeType = ( next ) => {\n\t\t// For now, use a hard-coded `0px` value for the position.\n\t\t// `0px` is preferred over `0` as it can be used in `calc()` functions.\n\t\t// In the future, it could be useful to allow for an offset value.\n\t\tconst placementValue = '0px';\n\n\t\tconst newStyle = {\n\t\t\t...style,\n\t\t\tposition: {\n\t\t\t\t...style?.position,\n\t\t\t\ttype: next,\n\t\t\t\ttop:\n\t\t\t\t\tnext === 'sticky' || next === 'fixed'\n\t\t\t\t\t\t? placementValue\n\t\t\t\t\t\t: undefined,\n\t\t\t},\n\t\t};\n\n\t\tsetAttributes( {\n\t\t\tstyle: cleanEmptyObject( newStyle ),\n\t\t} );\n\t};\n\n\tconst selectedOption = value\n\t\t? options.find( ( option ) => option.value === value ) || DEFAULT_OPTION\n\t\t: DEFAULT_OPTION;\n\n\t// Only display position controls if there is at least one option to choose from.\n\treturn Platform.select( {\n\t\tweb:\n\t\t\toptions.length > 1 ? (\n\t\t\t\t<InspectorControls group=\"position\">\n\t\t\t\t\t<BaseControl className=\"block-editor-hooks__position-selection\">\n\t\t\t\t\t\t<CustomSelectControl\n\t\t\t\t\t\t\t__nextUnconstrainedWidth\n\t\t\t\t\t\t\t__next36pxDefaultSize\n\t\t\t\t\t\t\tclassName=\"block-editor-hooks__position-selection__select-control\"\n\t\t\t\t\t\t\tlabel={ __( 'Position' ) }\n\t\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\t\tdescribedBy={ sprintf(\n\t\t\t\t\t\t\t\t// translators: %s: Currently selected position.\n\t\t\t\t\t\t\t\t__( 'Currently selected position: %s' ),\n\t\t\t\t\t\t\t\tselectedOption.name\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\toptions={ options }\n\t\t\t\t\t\t\tvalue={ selectedOption }\n\t\t\t\t\t\t\t__experimentalShowSelectedHint\n\t\t\t\t\t\t\tonChange={ ( { selectedItem } ) => {\n\t\t\t\t\t\t\t\tonChangeType( selectedItem.value );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tsize={ '__unstable-large' }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</BaseControl>\n\t\t\t\t</InspectorControls>\n\t\t\t) : null,\n\t\tnative: null,\n\t} );\n}\n\n/**\n * Override the default edit UI to include position controls.\n *\n * @param {Function} BlockEdit Original component.\n *\n * @return {Function} Wrapped component.\n */\nexport const withInspectorControls = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tconst { name: blockName } = props;\n\t\tconst positionSupport = hasBlockSupport(\n\t\t\tblockName,\n\t\t\tPOSITION_SUPPORT_KEY\n\t\t);\n\t\tconst showPositionControls =\n\t\t\tpositionSupport && ! useIsPositionDisabled( props );\n\n\t\treturn [\n\t\t\tshowPositionControls && (\n\t\t\t\t<PositionPanel key=\"position\" { ...props } />\n\t\t\t),\n\t\t\t<BlockEdit key=\"edit\" { ...props } />,\n\t\t];\n\t},\n\t'withInspectorControls'\n);\n\n/**\n * Override the default block element to add the position styles.\n *\n * @param {Function} BlockListBlock Original component.\n *\n * @return {Function} Wrapped component.\n */\nexport const withPositionStyles = createHigherOrderComponent(\n\t( BlockListBlock ) => ( props ) => {\n\t\tconst { name, attributes } = props;\n\t\tconst hasPositionBlockSupport = hasBlockSupport(\n\t\t\tname,\n\t\t\tPOSITION_SUPPORT_KEY\n\t\t);\n\t\tconst allowPositionStyles =\n\t\t\thasPositionBlockSupport && ! useIsPositionDisabled( props );\n\n\t\tconst id = useInstanceId( BlockListBlock );\n\t\tconst element = useContext( BlockList.__unstableElementContext );\n\n\t\t// Higher specificity to override defaults in editor UI.\n\t\tconst positionSelector = `.wp-container-${ id }.wp-container-${ id }`;\n\n\t\t// Get CSS string for the current position values.\n\t\tlet css;\n\t\tif ( allowPositionStyles ) {\n\t\t\tcss =\n\t\t\t\tgetPositionCSS( {\n\t\t\t\t\tselector: positionSelector,\n\t\t\t\t\tstyle: attributes?.style,\n\t\t\t\t} ) || '';\n\t\t}\n\n\t\t// Attach a `wp-container-` id-based class name.\n\t\tconst className = classnames( props?.className, {\n\t\t\t[ `wp-container-${ id }` ]: allowPositionStyles && !! css, // Only attach a container class if there is generated CSS to be attached.\n\t\t\t[ `is-position-${ attributes?.style?.position?.type }` ]:\n\t\t\t\tallowPositionStyles &&\n\t\t\t\t!! css &&\n\t\t\t\t!! attributes?.style?.position?.type,\n\t\t} );\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ allowPositionStyles &&\n\t\t\t\t\telement &&\n\t\t\t\t\t!! css &&\n\t\t\t\t\tcreatePortal( <style>{ css }</style>, element ) }\n\t\t\t\t<BlockListBlock { ...props } className={ className } />\n\t\t\t</>\n\t\t);\n\t}\n);\n\naddFilter(\n\t'editor.BlockListBlock',\n\t'core/editor/position/with-position-styles',\n\twithPositionStyles\n);\naddFilter(\n\t'editor.BlockEdit',\n\t'core/editor/position/with-inspector-controls',\n\twithInspectorControls\n);\n"]}
|
|
@@ -4,145 +4,132 @@ import { createElement } from "@wordpress/element";
|
|
|
4
4
|
* WordPress dependencies
|
|
5
5
|
*/
|
|
6
6
|
import { getBlockSupport, hasBlockSupport } from '@wordpress/blocks';
|
|
7
|
-
import {
|
|
8
|
-
import { __ } from '@wordpress/i18n';
|
|
7
|
+
import { useMemo } from '@wordpress/element';
|
|
9
8
|
/**
|
|
10
9
|
* Internal dependencies
|
|
11
10
|
*/
|
|
12
11
|
|
|
13
12
|
import InspectorControls from '../components/inspector-controls';
|
|
14
|
-
import {
|
|
15
|
-
import { LINE_HEIGHT_SUPPORT_KEY
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
|
|
13
|
+
import { default as StylesTypographyPanel, useHasTypographyPanel } from '../components/global-styles/typography-panel';
|
|
14
|
+
import { LINE_HEIGHT_SUPPORT_KEY } from './line-height';
|
|
15
|
+
import { FONT_FAMILY_SUPPORT_KEY } from './font-family';
|
|
16
|
+
import { FONT_SIZE_SUPPORT_KEY } from './font-size';
|
|
17
|
+
import { useSetting } from '../components';
|
|
18
|
+
import { cleanEmptyObject } from './utils';
|
|
19
|
+
import { overrideSettingsWithSupports, useSupportedStyles } from '../components/global-styles/hooks';
|
|
20
|
+
|
|
21
|
+
function omit(object, keys) {
|
|
22
|
+
return Object.fromEntries(Object.entries(object).filter(_ref => {
|
|
23
|
+
let [key] = _ref;
|
|
24
|
+
return !keys.includes(key);
|
|
25
|
+
}));
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const LETTER_SPACING_SUPPORT_KEY = 'typography.__experimentalLetterSpacing';
|
|
29
|
+
const TEXT_TRANSFORM_SUPPORT_KEY = 'typography.__experimentalTextTransform';
|
|
30
|
+
const TEXT_DECORATION_SUPPORT_KEY = 'typography.__experimentalTextDecoration';
|
|
31
|
+
const FONT_STYLE_SUPPORT_KEY = 'typography.__experimentalFontStyle';
|
|
32
|
+
const FONT_WEIGHT_SUPPORT_KEY = 'typography.__experimentalFontWeight';
|
|
22
33
|
export const TYPOGRAPHY_SUPPORT_KEY = 'typography';
|
|
23
34
|
export const TYPOGRAPHY_SUPPORT_KEYS = [LINE_HEIGHT_SUPPORT_KEY, FONT_SIZE_SUPPORT_KEY, FONT_STYLE_SUPPORT_KEY, FONT_WEIGHT_SUPPORT_KEY, FONT_FAMILY_SUPPORT_KEY, TEXT_DECORATION_SUPPORT_KEY, TEXT_TRANSFORM_SUPPORT_KEY, LETTER_SPACING_SUPPORT_KEY];
|
|
24
|
-
export function TypographyPanel(props) {
|
|
25
|
-
const {
|
|
26
|
-
clientId
|
|
27
|
-
} = props;
|
|
28
|
-
const isFontFamilyDisabled = useIsFontFamilyDisabled(props);
|
|
29
|
-
const isFontSizeDisabled = useIsFontSizeDisabled(props);
|
|
30
|
-
const isFontAppearanceDisabled = useIsFontAppearanceDisabled(props);
|
|
31
|
-
const isLineHeightDisabled = useIsLineHeightDisabled(props);
|
|
32
|
-
const isTextDecorationDisabled = useIsTextDecorationDisabled(props);
|
|
33
|
-
const isTextTransformDisabled = useIsTextTransformDisabled(props);
|
|
34
|
-
const isLetterSpacingDisabled = useIsLetterSpacingDisabled(props);
|
|
35
|
-
const hasFontStyles = !useIsFontStyleDisabled(props);
|
|
36
|
-
const hasFontWeights = !useIsFontWeightDisabled(props);
|
|
37
|
-
const isDisabled = useIsTypographyDisabled(props);
|
|
38
|
-
const isSupported = hasTypographySupport(props.name);
|
|
39
|
-
if (isDisabled || !isSupported) return null;
|
|
40
|
-
const defaultControls = getBlockSupport(props.name, [TYPOGRAPHY_SUPPORT_KEY, '__experimentalDefaultControls']);
|
|
41
35
|
|
|
42
|
-
|
|
43
|
-
|
|
36
|
+
function TypographyInspectorControl(_ref2) {
|
|
37
|
+
let {
|
|
38
|
+
children
|
|
39
|
+
} = _ref2;
|
|
40
|
+
return createElement(InspectorControls, {
|
|
41
|
+
group: "typography"
|
|
42
|
+
}, children);
|
|
43
|
+
}
|
|
44
44
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
45
|
+
function useBlockSettings(name) {
|
|
46
|
+
const fontFamilies = useSetting('typography.fontFamilies');
|
|
47
|
+
const fontSizes = useSetting('typography.fontSizes');
|
|
48
|
+
const customFontSize = useSetting('typography.customFontSize');
|
|
49
|
+
const fontStyle = useSetting('typography.fontStyle');
|
|
50
|
+
const fontWeight = useSetting('typography.fontWeight');
|
|
51
|
+
const lineHeight = useSetting('typography.lineHeight');
|
|
52
|
+
const textDecoration = useSetting('typography.textDecoration');
|
|
53
|
+
const textTransform = useSetting('typography.textTransform');
|
|
54
|
+
const letterSpacing = useSetting('typography.letterSpacing');
|
|
55
|
+
const supports = useSupportedStyles(name, null);
|
|
56
|
+
return useMemo(() => {
|
|
57
|
+
const rawSettings = {
|
|
58
|
+
typography: {
|
|
59
|
+
fontFamilies: {
|
|
60
|
+
custom: fontFamilies
|
|
61
|
+
},
|
|
62
|
+
fontSizes: {
|
|
63
|
+
custom: fontSizes
|
|
64
|
+
},
|
|
65
|
+
customFontSize,
|
|
66
|
+
fontStyle,
|
|
67
|
+
fontWeight,
|
|
68
|
+
lineHeight,
|
|
69
|
+
textDecoration,
|
|
70
|
+
textTransform,
|
|
71
|
+
letterSpacing
|
|
50
72
|
}
|
|
51
73
|
};
|
|
52
|
-
|
|
74
|
+
return overrideSettingsWithSupports(rawSettings, supports);
|
|
75
|
+
}, [fontFamilies, fontSizes, customFontSize, fontStyle, fontWeight, lineHeight, textDecoration, textTransform, letterSpacing, supports]);
|
|
76
|
+
}
|
|
53
77
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}, createElement(FontFamilyEdit, props)), !isFontSizeDisabled && createElement(ToolsPanelItem, {
|
|
66
|
-
hasValue: () => hasFontSizeValue(props)
|
|
67
|
-
/* translators: Ensure translation is distinct from "Letter case" */
|
|
68
|
-
,
|
|
69
|
-
label: __('Font size'),
|
|
70
|
-
onDeselect: () => resetFontSize(props),
|
|
71
|
-
isShownByDefault: defaultControls === null || defaultControls === void 0 ? void 0 : defaultControls.fontSize,
|
|
72
|
-
resetAllFilter: newAttributes => {
|
|
73
|
-
var _newAttributes$style2;
|
|
78
|
+
export function TypographyPanel(_ref3) {
|
|
79
|
+
let {
|
|
80
|
+
clientId,
|
|
81
|
+
name,
|
|
82
|
+
attributes,
|
|
83
|
+
setAttributes
|
|
84
|
+
} = _ref3;
|
|
85
|
+
const settings = useBlockSettings(name);
|
|
86
|
+
const isEnabled = useHasTypographyPanel(settings);
|
|
87
|
+
const value = useMemo(() => {
|
|
88
|
+
var _attributes$style, _attributes$style2, _attributes$style2$ty;
|
|
74
89
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
90
|
+
return { ...attributes.style,
|
|
91
|
+
typography: { ...((_attributes$style = attributes.style) === null || _attributes$style === void 0 ? void 0 : _attributes$style.typography),
|
|
92
|
+
fontFamily: attributes.fontFamily ? 'var:preset|font-family|' + attributes.fontFamily : undefined,
|
|
93
|
+
fontSize: attributes.fontSize ? 'var:preset|font-size|' + attributes.fontSize : (_attributes$style2 = attributes.style) === null || _attributes$style2 === void 0 ? void 0 : (_attributes$style2$ty = _attributes$style2.typography) === null || _attributes$style2$ty === void 0 ? void 0 : _attributes$style2$ty.fontSize
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
}, [attributes.style, attributes.fontSize, attributes.fontFamily]);
|
|
97
|
+
|
|
98
|
+
const onChange = newStyle => {
|
|
99
|
+
var _newStyle$typography, _newStyle$typography2;
|
|
100
|
+
|
|
101
|
+
const updatedStyle = { ...omit(newStyle, ['fontFamily'])
|
|
102
|
+
};
|
|
103
|
+
const fontSizeValue = newStyle === null || newStyle === void 0 ? void 0 : (_newStyle$typography = newStyle.typography) === null || _newStyle$typography === void 0 ? void 0 : _newStyle$typography.fontSize;
|
|
104
|
+
const fontFamilyValue = newStyle === null || newStyle === void 0 ? void 0 : (_newStyle$typography2 = newStyle.typography) === null || _newStyle$typography2 === void 0 ? void 0 : _newStyle$typography2.fontFamily;
|
|
105
|
+
const fontSizeSlug = fontSizeValue !== null && fontSizeValue !== void 0 && fontSizeValue.startsWith('var:preset|font-size|') ? fontSizeValue.substring('var:preset|font-size|'.length) : undefined;
|
|
106
|
+
const fontFamilySlug = fontFamilyValue !== null && fontFamilyValue !== void 0 && fontFamilyValue.startsWith('var:preset|font-family|') ? fontFamilyValue.substring('var:preset|font-family|'.length) : undefined;
|
|
107
|
+
updatedStyle.typography = { ...omit(updatedStyle.typography, ['fontFamily']),
|
|
108
|
+
fontSize: fontSizeSlug ? undefined : fontSizeValue
|
|
109
|
+
};
|
|
110
|
+
setAttributes({
|
|
111
|
+
style: cleanEmptyObject(updatedStyle),
|
|
112
|
+
fontFamily: fontFamilySlug,
|
|
113
|
+
fontSize: fontSizeSlug
|
|
114
|
+
});
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
if (!isEnabled) {
|
|
118
|
+
return null;
|
|
119
|
+
}
|
|
93
120
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
}, createElement(FontAppearanceEdit, props)), !isLineHeightDisabled && createElement(ToolsPanelItem, {
|
|
105
|
-
className: "single-column",
|
|
106
|
-
hasValue: () => hasLineHeightValue(props),
|
|
107
|
-
label: __('Line height'),
|
|
108
|
-
onDeselect: () => resetLineHeight(props),
|
|
109
|
-
isShownByDefault: defaultControls === null || defaultControls === void 0 ? void 0 : defaultControls.lineHeight,
|
|
110
|
-
resetAllFilter: createResetAllFilter('lineHeight'),
|
|
111
|
-
panelId: clientId
|
|
112
|
-
}, createElement(LineHeightEdit, props)), !isLetterSpacingDisabled && createElement(ToolsPanelItem, {
|
|
113
|
-
className: "single-column",
|
|
114
|
-
hasValue: () => hasLetterSpacingValue(props),
|
|
115
|
-
label: __('Letter spacing'),
|
|
116
|
-
onDeselect: () => resetLetterSpacing(props),
|
|
117
|
-
isShownByDefault: defaultControls === null || defaultControls === void 0 ? void 0 : defaultControls.letterSpacing,
|
|
118
|
-
resetAllFilter: createResetAllFilter('letterSpacing'),
|
|
119
|
-
panelId: clientId
|
|
120
|
-
}, createElement(LetterSpacingEdit, props)), !isTextDecorationDisabled && createElement(ToolsPanelItem, {
|
|
121
|
-
className: "single-column",
|
|
122
|
-
hasValue: () => hasTextDecorationValue(props),
|
|
123
|
-
label: __('Decoration'),
|
|
124
|
-
onDeselect: () => resetTextDecoration(props),
|
|
125
|
-
isShownByDefault: defaultControls === null || defaultControls === void 0 ? void 0 : defaultControls.textDecoration,
|
|
126
|
-
resetAllFilter: createResetAllFilter('textDecoration'),
|
|
127
|
-
panelId: clientId
|
|
128
|
-
}, createElement(TextDecorationEdit, props)), !isTextTransformDisabled && createElement(ToolsPanelItem, {
|
|
129
|
-
hasValue: () => hasTextTransformValue(props)
|
|
130
|
-
/* translators: Ensure translation is distinct from "Font size" */
|
|
131
|
-
,
|
|
132
|
-
label: __('Letter case'),
|
|
133
|
-
onDeselect: () => resetTextTransform(props),
|
|
134
|
-
isShownByDefault: defaultControls === null || defaultControls === void 0 ? void 0 : defaultControls.textTransform,
|
|
135
|
-
resetAllFilter: createResetAllFilter('textTransform'),
|
|
136
|
-
panelId: clientId
|
|
137
|
-
}, createElement(TextTransformEdit, props)));
|
|
121
|
+
const defaultControls = getBlockSupport(name, [TYPOGRAPHY_SUPPORT_KEY, '__experimentalDefaultControls']);
|
|
122
|
+
return createElement(StylesTypographyPanel, {
|
|
123
|
+
as: TypographyInspectorControl,
|
|
124
|
+
panelId: clientId,
|
|
125
|
+
name: name,
|
|
126
|
+
settings: settings,
|
|
127
|
+
value: value,
|
|
128
|
+
onChange: onChange,
|
|
129
|
+
defaultControls: defaultControls
|
|
130
|
+
});
|
|
138
131
|
}
|
|
139
132
|
export const hasTypographySupport = blockName => {
|
|
140
133
|
return TYPOGRAPHY_SUPPORT_KEYS.some(key => hasBlockSupport(blockName, key));
|
|
141
134
|
};
|
|
142
|
-
|
|
143
|
-
function useIsTypographyDisabled() {
|
|
144
|
-
let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
145
|
-
const configs = [useIsFontAppearanceDisabled(props), useIsFontSizeDisabled(props), useIsLineHeightDisabled(props), useIsFontFamilyDisabled(props), useIsTextDecorationDisabled(props), useIsTextTransformDisabled(props), useIsLetterSpacingDisabled(props)];
|
|
146
|
-
return configs.filter(Boolean).length === configs.length;
|
|
147
|
-
}
|
|
148
135
|
//# sourceMappingURL=typography.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/hooks/typography.js"],"names":["getBlockSupport","hasBlockSupport","__experimentalToolsPanelItem","ToolsPanelItem","__","InspectorControls","getFontAppearanceLabel","LINE_HEIGHT_SUPPORT_KEY","LineHeightEdit","hasLineHeightValue","resetLineHeight","useIsLineHeightDisabled","FONT_STYLE_SUPPORT_KEY","FONT_WEIGHT_SUPPORT_KEY","FontAppearanceEdit","hasFontAppearanceValue","resetFontAppearance","useIsFontAppearanceDisabled","useIsFontStyleDisabled","useIsFontWeightDisabled","FONT_FAMILY_SUPPORT_KEY","FontFamilyEdit","hasFontFamilyValue","resetFontFamily","useIsFontFamilyDisabled","FONT_SIZE_SUPPORT_KEY","FontSizeEdit","hasFontSizeValue","resetFontSize","useIsFontSizeDisabled","TEXT_DECORATION_SUPPORT_KEY","TextDecorationEdit","hasTextDecorationValue","resetTextDecoration","useIsTextDecorationDisabled","TEXT_TRANSFORM_SUPPORT_KEY","TextTransformEdit","hasTextTransformValue","resetTextTransform","useIsTextTransformDisabled","LETTER_SPACING_SUPPORT_KEY","LetterSpacingEdit","hasLetterSpacingValue","resetLetterSpacing","useIsLetterSpacingDisabled","TYPOGRAPHY_SUPPORT_KEY","TYPOGRAPHY_SUPPORT_KEYS","TypographyPanel","props","clientId","isFontFamilyDisabled","isFontSizeDisabled","isFontAppearanceDisabled","isLineHeightDisabled","isTextDecorationDisabled","isTextTransformDisabled","isLetterSpacingDisabled","hasFontStyles","hasFontWeights","isDisabled","useIsTypographyDisabled","isSupported","hasTypographySupport","name","defaultControls","createResetAllFilter","attribute","newAttributes","style","typography","undefined","fontFamily","fontSize","fontAppearance","fontStyle","fontWeight","lineHeight","letterSpacing","textDecoration","textTransform","blockName","some","key","configs","filter","Boolean","length"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,eAAT,EAA0BC,eAA1B,QAAiD,mBAAjD;AACA,SAASC,4BAA4B,IAAIC,cAAzC,QAA+D,uBAA/D;AACA,SAASC,EAAT,QAAmB,iBAAnB;AAEA;AACA;AACA;;AACA,OAAOC,iBAAP,MAA8B,kCAA9B;AACA,SAASC,sBAAT,QAAuC,uCAAvC;AAEA,SACCC,uBADD,EAECC,cAFD,EAGCC,kBAHD,EAICC,eAJD,EAKCC,uBALD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,0BAA0B,CAAES,KAAF,CANX,EAOfJ,0BAA0B,CAAEI,KAAF,CAPX,CAAhB;AAUA,SAAOmC,OAAO,CAACC,MAAR,CAAgBC,OAAhB,EAA0BC,MAA1B,KAAqCH,OAAO,CAACG,MAApD;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { getBlockSupport, hasBlockSupport } from '@wordpress/blocks';\nimport { __experimentalToolsPanelItem as ToolsPanelItem } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport InspectorControls from '../components/inspector-controls';\nimport { getFontAppearanceLabel } from '../components/font-appearance-control';\n\nimport {\n\tLINE_HEIGHT_SUPPORT_KEY,\n\tLineHeightEdit,\n\thasLineHeightValue,\n\tresetLineHeight,\n\tuseIsLineHeightDisabled,\n} from './line-height';\nimport {\n\tFONT_STYLE_SUPPORT_KEY,\n\tFONT_WEIGHT_SUPPORT_KEY,\n\tFontAppearanceEdit,\n\thasFontAppearanceValue,\n\tresetFontAppearance,\n\tuseIsFontAppearanceDisabled,\n\tuseIsFontStyleDisabled,\n\tuseIsFontWeightDisabled,\n} from './font-appearance';\nimport {\n\tFONT_FAMILY_SUPPORT_KEY,\n\tFontFamilyEdit,\n\thasFontFamilyValue,\n\tresetFontFamily,\n\tuseIsFontFamilyDisabled,\n} from './font-family';\nimport {\n\tFONT_SIZE_SUPPORT_KEY,\n\tFontSizeEdit,\n\thasFontSizeValue,\n\tresetFontSize,\n\tuseIsFontSizeDisabled,\n} from './font-size';\nimport {\n\tTEXT_DECORATION_SUPPORT_KEY,\n\tTextDecorationEdit,\n\thasTextDecorationValue,\n\tresetTextDecoration,\n\tuseIsTextDecorationDisabled,\n} from './text-decoration';\nimport {\n\tTEXT_TRANSFORM_SUPPORT_KEY,\n\tTextTransformEdit,\n\thasTextTransformValue,\n\tresetTextTransform,\n\tuseIsTextTransformDisabled,\n} from './text-transform';\nimport {\n\tLETTER_SPACING_SUPPORT_KEY,\n\tLetterSpacingEdit,\n\thasLetterSpacingValue,\n\tresetLetterSpacing,\n\tuseIsLetterSpacingDisabled,\n} from './letter-spacing';\n\nexport const TYPOGRAPHY_SUPPORT_KEY = 'typography';\nexport const TYPOGRAPHY_SUPPORT_KEYS = [\n\tLINE_HEIGHT_SUPPORT_KEY,\n\tFONT_SIZE_SUPPORT_KEY,\n\tFONT_STYLE_SUPPORT_KEY,\n\tFONT_WEIGHT_SUPPORT_KEY,\n\tFONT_FAMILY_SUPPORT_KEY,\n\tTEXT_DECORATION_SUPPORT_KEY,\n\tTEXT_TRANSFORM_SUPPORT_KEY,\n\tLETTER_SPACING_SUPPORT_KEY,\n];\n\nexport function TypographyPanel( props ) {\n\tconst { clientId } = props;\n\tconst isFontFamilyDisabled = useIsFontFamilyDisabled( props );\n\tconst isFontSizeDisabled = useIsFontSizeDisabled( props );\n\tconst isFontAppearanceDisabled = useIsFontAppearanceDisabled( props );\n\tconst isLineHeightDisabled = useIsLineHeightDisabled( props );\n\tconst isTextDecorationDisabled = useIsTextDecorationDisabled( props );\n\tconst isTextTransformDisabled = useIsTextTransformDisabled( props );\n\tconst isLetterSpacingDisabled = useIsLetterSpacingDisabled( props );\n\n\tconst hasFontStyles = ! useIsFontStyleDisabled( props );\n\tconst hasFontWeights = ! useIsFontWeightDisabled( props );\n\n\tconst isDisabled = useIsTypographyDisabled( props );\n\tconst isSupported = hasTypographySupport( props.name );\n\n\tif ( isDisabled || ! isSupported ) return null;\n\n\tconst defaultControls = getBlockSupport( props.name, [\n\t\tTYPOGRAPHY_SUPPORT_KEY,\n\t\t'__experimentalDefaultControls',\n\t] );\n\n\tconst createResetAllFilter = ( attribute ) => ( newAttributes ) => ( {\n\t\t...newAttributes,\n\t\tstyle: {\n\t\t\t...newAttributes.style,\n\t\t\ttypography: {\n\t\t\t\t...newAttributes.style?.typography,\n\t\t\t\t[ attribute ]: undefined,\n\t\t\t},\n\t\t},\n\t} );\n\n\treturn (\n\t\t<InspectorControls group=\"typography\">\n\t\t\t{ ! isFontFamilyDisabled && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\thasValue={ () => hasFontFamilyValue( props ) }\n\t\t\t\t\tlabel={ __( 'Font family' ) }\n\t\t\t\t\tonDeselect={ () => resetFontFamily( props ) }\n\t\t\t\t\tisShownByDefault={ defaultControls?.fontFamily }\n\t\t\t\t\tresetAllFilter={ ( newAttributes ) => ( {\n\t\t\t\t\t\t...newAttributes,\n\t\t\t\t\t\tfontFamily: undefined,\n\t\t\t\t\t} ) }\n\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t>\n\t\t\t\t\t<FontFamilyEdit { ...props } />\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t\t{ ! isFontSizeDisabled && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\thasValue={ () => hasFontSizeValue( props ) }\n\t\t\t\t\t/* translators: Ensure translation is distinct from \"Letter case\" */\n\t\t\t\t\tlabel={ __( 'Font size' ) }\n\t\t\t\t\tonDeselect={ () => resetFontSize( props ) }\n\t\t\t\t\tisShownByDefault={ defaultControls?.fontSize }\n\t\t\t\t\tresetAllFilter={ ( newAttributes ) => ( {\n\t\t\t\t\t\t...newAttributes,\n\t\t\t\t\t\tfontSize: undefined,\n\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\t...newAttributes.style,\n\t\t\t\t\t\t\ttypography: {\n\t\t\t\t\t\t\t\t...newAttributes.style?.typography,\n\t\t\t\t\t\t\t\tfontSize: undefined,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t} ) }\n\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t>\n\t\t\t\t\t<FontSizeEdit { ...props } />\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t\t{ ! isFontAppearanceDisabled && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\tclassName=\"single-column\"\n\t\t\t\t\thasValue={ () => hasFontAppearanceValue( props ) }\n\t\t\t\t\tlabel={ getFontAppearanceLabel(\n\t\t\t\t\t\thasFontStyles,\n\t\t\t\t\t\thasFontWeights\n\t\t\t\t\t) }\n\t\t\t\t\tonDeselect={ () => resetFontAppearance( props ) }\n\t\t\t\t\tisShownByDefault={ defaultControls?.fontAppearance }\n\t\t\t\t\tresetAllFilter={ ( newAttributes ) => ( {\n\t\t\t\t\t\t...newAttributes,\n\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\t...newAttributes.style,\n\t\t\t\t\t\t\ttypography: {\n\t\t\t\t\t\t\t\t...newAttributes.style?.typography,\n\t\t\t\t\t\t\t\tfontStyle: undefined,\n\t\t\t\t\t\t\t\tfontWeight: undefined,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t} ) }\n\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t>\n\t\t\t\t\t<FontAppearanceEdit { ...props } />\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t\t{ ! isLineHeightDisabled && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\tclassName=\"single-column\"\n\t\t\t\t\thasValue={ () => hasLineHeightValue( props ) }\n\t\t\t\t\tlabel={ __( 'Line height' ) }\n\t\t\t\t\tonDeselect={ () => resetLineHeight( props ) }\n\t\t\t\t\tisShownByDefault={ defaultControls?.lineHeight }\n\t\t\t\t\tresetAllFilter={ createResetAllFilter( 'lineHeight' ) }\n\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t>\n\t\t\t\t\t<LineHeightEdit { ...props } />\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t\t{ ! isLetterSpacingDisabled && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\tclassName=\"single-column\"\n\t\t\t\t\thasValue={ () => hasLetterSpacingValue( props ) }\n\t\t\t\t\tlabel={ __( 'Letter spacing' ) }\n\t\t\t\t\tonDeselect={ () => resetLetterSpacing( props ) }\n\t\t\t\t\tisShownByDefault={ defaultControls?.letterSpacing }\n\t\t\t\t\tresetAllFilter={ createResetAllFilter( 'letterSpacing' ) }\n\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t>\n\t\t\t\t\t<LetterSpacingEdit { ...props } />\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t\t{ ! isTextDecorationDisabled && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\tclassName=\"single-column\"\n\t\t\t\t\thasValue={ () => hasTextDecorationValue( props ) }\n\t\t\t\t\tlabel={ __( 'Decoration' ) }\n\t\t\t\t\tonDeselect={ () => resetTextDecoration( props ) }\n\t\t\t\t\tisShownByDefault={ defaultControls?.textDecoration }\n\t\t\t\t\tresetAllFilter={ createResetAllFilter( 'textDecoration' ) }\n\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t>\n\t\t\t\t\t<TextDecorationEdit { ...props } />\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t\t{ ! isTextTransformDisabled && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\thasValue={ () => hasTextTransformValue( props ) }\n\t\t\t\t\t/* translators: Ensure translation is distinct from \"Font size\" */\n\t\t\t\t\tlabel={ __( 'Letter case' ) }\n\t\t\t\t\tonDeselect={ () => resetTextTransform( props ) }\n\t\t\t\t\tisShownByDefault={ defaultControls?.textTransform }\n\t\t\t\t\tresetAllFilter={ createResetAllFilter( 'textTransform' ) }\n\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t>\n\t\t\t\t\t<TextTransformEdit { ...props } />\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t</InspectorControls>\n\t);\n}\n\nexport const hasTypographySupport = ( blockName ) => {\n\treturn TYPOGRAPHY_SUPPORT_KEYS.some( ( key ) =>\n\t\thasBlockSupport( blockName, key )\n\t);\n};\n\nfunction useIsTypographyDisabled( props = {} ) {\n\tconst configs = [\n\t\tuseIsFontAppearanceDisabled( props ),\n\t\tuseIsFontSizeDisabled( props ),\n\t\tuseIsLineHeightDisabled( props ),\n\t\tuseIsFontFamilyDisabled( props ),\n\t\tuseIsTextDecorationDisabled( props ),\n\t\tuseIsTextTransformDisabled( props ),\n\t\tuseIsLetterSpacingDisabled( props ),\n\t];\n\n\treturn configs.filter( Boolean ).length === configs.length;\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/hooks/typography.js"],"names":["getBlockSupport","hasBlockSupport","useMemo","InspectorControls","default","StylesTypographyPanel","useHasTypographyPanel","LINE_HEIGHT_SUPPORT_KEY","FONT_FAMILY_SUPPORT_KEY","FONT_SIZE_SUPPORT_KEY","useSetting","cleanEmptyObject","overrideSettingsWithSupports","useSupportedStyles","omit","object","keys","Object","fromEntries","entries","filter","key","includes","LETTER_SPACING_SUPPORT_KEY","TEXT_TRANSFORM_SUPPORT_KEY","TEXT_DECORATION_SUPPORT_KEY","FONT_STYLE_SUPPORT_KEY","FONT_WEIGHT_SUPPORT_KEY","TYPOGRAPHY_SUPPORT_KEY","TYPOGRAPHY_SUPPORT_KEYS","TypographyInspectorControl","children","useBlockSettings","name","fontFamilies","fontSizes","customFontSize","fontStyle","fontWeight","lineHeight","textDecoration","textTransform","letterSpacing","supports","rawSettings","typography","custom","TypographyPanel","clientId","attributes","setAttributes","settings","isEnabled","value","style","fontFamily","undefined","fontSize","onChange","newStyle","updatedStyle","fontSizeValue","fontFamilyValue","fontSizeSlug","startsWith","substring","length","fontFamilySlug","defaultControls","hasTypographySupport","blockName","some"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,eAAT,EAA0BC,eAA1B,QAAiD,mBAAjD;AACA,SAASC,OAAT,QAAwB,oBAAxB;AAEA;AACA;AACA;;AACA,OAAOC,iBAAP,MAA8B,kCAA9B;AACA,SACCC,OAAO,IAAIC,qBADZ,EAECC,qBAFD,QAGO,8CAHP;AAKA,SAASC,uBAAT,QAAwC,eAAxC;AACA,SAASC,uBAAT,QAAwC,eAAxC;AACA,SAASC,qBAAT,QAAsC,aAAtC;AACA,SAASC,UAAT,QAA2B,eAA3B;AACA,S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AAY,GAAGP,SAAH,GAAeK;AAFZ,KAA1B;AAIAX,IAAAA,aAAa,CAAE;AACdI,MAAAA,KAAK,EAAE3C,gBAAgB,CAAEiD,YAAF,CADT;AAEdL,MAAAA,UAAU,EAAEY,cAFE;AAGdV,MAAAA,QAAQ,EAAEM;AAHI,KAAF,CAAb;AAKA,GAvBD;;AAyBA,MAAK,CAAEX,SAAP,EAAmB;AAClB,WAAO,IAAP;AACA;;AAED,QAAMgB,eAAe,GAAGpE,eAAe,CAAEiC,IAAF,EAAQ,CAC9CL,sBAD8C,EAE9C,+BAF8C,CAAR,CAAvC;AAKA,SACC,cAAC,qBAAD;AACC,IAAA,EAAE,EAAGE,0BADN;AAEC,IAAA,OAAO,EAAGkB,QAFX;AAGC,IAAA,IAAI,EAAGf,IAHR;AAIC,IAAA,QAAQ,EAAGkB,QAJZ;AAKC,IAAA,KAAK,EAAGE,KALT;AAMC,IAAA,QAAQ,EAAGK,QANZ;AAOC,IAAA,eAAe,EAAGU;AAPnB,IADD;AAWA;AAED,OAAO,MAAMC,oBAAoB,GAAKC,SAAF,IAAiB;AACpD,SAAOzC,uBAAuB,CAAC0C,IAAxB,CAAgClD,GAAF,IACpCpB,eAAe,CAAEqE,SAAF,EAAajD,GAAb,CADT,CAAP;AAGA,CAJM","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { getBlockSupport, hasBlockSupport } from '@wordpress/blocks';\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport InspectorControls from '../components/inspector-controls';\nimport {\n\tdefault as StylesTypographyPanel,\n\tuseHasTypographyPanel,\n} from '../components/global-styles/typography-panel';\n\nimport { LINE_HEIGHT_SUPPORT_KEY } from './line-height';\nimport { FONT_FAMILY_SUPPORT_KEY } from './font-family';\nimport { FONT_SIZE_SUPPORT_KEY } from './font-size';\nimport { useSetting } from '../components';\nimport { cleanEmptyObject } from './utils';\nimport {\n\toverrideSettingsWithSupports,\n\tuseSupportedStyles,\n} from '../components/global-styles/hooks';\n\nfunction omit( object, keys ) {\n\treturn Object.fromEntries(\n\t\tObject.entries( object ).filter( ( [ key ] ) => ! keys.includes( key ) )\n\t);\n}\n\nconst LETTER_SPACING_SUPPORT_KEY = 'typography.__experimentalLetterSpacing';\nconst TEXT_TRANSFORM_SUPPORT_KEY = 'typography.__experimentalTextTransform';\nconst TEXT_DECORATION_SUPPORT_KEY = 'typography.__experimentalTextDecoration';\nconst FONT_STYLE_SUPPORT_KEY = 'typography.__experimentalFontStyle';\nconst FONT_WEIGHT_SUPPORT_KEY = 'typography.__experimentalFontWeight';\nexport const TYPOGRAPHY_SUPPORT_KEY = 'typography';\nexport const TYPOGRAPHY_SUPPORT_KEYS = [\n\tLINE_HEIGHT_SUPPORT_KEY,\n\tFONT_SIZE_SUPPORT_KEY,\n\tFONT_STYLE_SUPPORT_KEY,\n\tFONT_WEIGHT_SUPPORT_KEY,\n\tFONT_FAMILY_SUPPORT_KEY,\n\tTEXT_DECORATION_SUPPORT_KEY,\n\tTEXT_TRANSFORM_SUPPORT_KEY,\n\tLETTER_SPACING_SUPPORT_KEY,\n];\n\nfunction TypographyInspectorControl( { children } ) {\n\treturn (\n\t\t<InspectorControls group=\"typography\">{ children }</InspectorControls>\n\t);\n}\n\nfunction useBlockSettings( name ) {\n\tconst fontFamilies = useSetting( 'typography.fontFamilies' );\n\tconst fontSizes = useSetting( 'typography.fontSizes' );\n\tconst customFontSize = useSetting( 'typography.customFontSize' );\n\tconst fontStyle = useSetting( 'typography.fontStyle' );\n\tconst fontWeight = useSetting( 'typography.fontWeight' );\n\tconst lineHeight = useSetting( 'typography.lineHeight' );\n\tconst textDecoration = useSetting( 'typography.textDecoration' );\n\tconst textTransform = useSetting( 'typography.textTransform' );\n\tconst letterSpacing = useSetting( 'typography.letterSpacing' );\n\tconst supports = useSupportedStyles( name, null );\n\n\treturn useMemo( () => {\n\t\tconst rawSettings = {\n\t\t\ttypography: {\n\t\t\t\tfontFamilies: {\n\t\t\t\t\tcustom: fontFamilies,\n\t\t\t\t},\n\t\t\t\tfontSizes: {\n\t\t\t\t\tcustom: fontSizes,\n\t\t\t\t},\n\t\t\t\tcustomFontSize,\n\t\t\t\tfontStyle,\n\t\t\t\tfontWeight,\n\t\t\t\tlineHeight,\n\t\t\t\ttextDecoration,\n\t\t\t\ttextTransform,\n\t\t\t\tletterSpacing,\n\t\t\t},\n\t\t};\n\t\treturn overrideSettingsWithSupports( rawSettings, supports );\n\t}, [\n\t\tfontFamilies,\n\t\tfontSizes,\n\t\tcustomFontSize,\n\t\tfontStyle,\n\t\tfontWeight,\n\t\tlineHeight,\n\t\ttextDecoration,\n\t\ttextTransform,\n\t\tletterSpacing,\n\t\tsupports,\n\t] );\n}\n\nexport function TypographyPanel( {\n\tclientId,\n\tname,\n\tattributes,\n\tsetAttributes,\n} ) {\n\tconst settings = useBlockSettings( name );\n\tconst isEnabled = useHasTypographyPanel( settings );\n\tconst value = useMemo( () => {\n\t\treturn {\n\t\t\t...attributes.style,\n\t\t\ttypography: {\n\t\t\t\t...attributes.style?.typography,\n\t\t\t\tfontFamily: attributes.fontFamily\n\t\t\t\t\t? 'var:preset|font-family|' + attributes.fontFamily\n\t\t\t\t\t: undefined,\n\t\t\t\tfontSize: attributes.fontSize\n\t\t\t\t\t? 'var:preset|font-size|' + attributes.fontSize\n\t\t\t\t\t: attributes.style?.typography?.fontSize,\n\t\t\t},\n\t\t};\n\t}, [ attributes.style, attributes.fontSize, attributes.fontFamily ] );\n\n\tconst onChange = ( newStyle ) => {\n\t\tconst updatedStyle = { ...omit( newStyle, [ 'fontFamily' ] ) };\n\t\tconst fontSizeValue = newStyle?.typography?.fontSize;\n\t\tconst fontFamilyValue = newStyle?.typography?.fontFamily;\n\t\tconst fontSizeSlug = fontSizeValue?.startsWith(\n\t\t\t'var:preset|font-size|'\n\t\t)\n\t\t\t? fontSizeValue.substring( 'var:preset|font-size|'.length )\n\t\t\t: undefined;\n\t\tconst fontFamilySlug = fontFamilyValue?.startsWith(\n\t\t\t'var:preset|font-family|'\n\t\t)\n\t\t\t? fontFamilyValue.substring( 'var:preset|font-family|'.length )\n\t\t\t: undefined;\n\t\tupdatedStyle.typography = {\n\t\t\t...omit( updatedStyle.typography, [ 'fontFamily' ] ),\n\t\t\tfontSize: fontSizeSlug ? undefined : fontSizeValue,\n\t\t};\n\t\tsetAttributes( {\n\t\t\tstyle: cleanEmptyObject( updatedStyle ),\n\t\t\tfontFamily: fontFamilySlug,\n\t\t\tfontSize: fontSizeSlug,\n\t\t} );\n\t};\n\n\tif ( ! isEnabled ) {\n\t\treturn null;\n\t}\n\n\tconst defaultControls = getBlockSupport( name, [\n\t\tTYPOGRAPHY_SUPPORT_KEY,\n\t\t'__experimentalDefaultControls',\n\t] );\n\n\treturn (\n\t\t<StylesTypographyPanel\n\t\t\tas={ TypographyInspectorControl }\n\t\t\tpanelId={ clientId }\n\t\t\tname={ name }\n\t\t\tsettings={ settings }\n\t\t\tvalue={ value }\n\t\t\tonChange={ onChange }\n\t\t\tdefaultControls={ defaultControls }\n\t\t/>\n\t);\n}\n\nexport const hasTypographySupport = ( blockName ) => {\n\treturn TYPOGRAPHY_SUPPORT_KEYS.some( ( key ) =>\n\t\thasBlockSupport( blockName, key )\n\t);\n};\n"]}
|
package/build-module/index.js
CHANGED
|
@@ -8,5 +8,5 @@ export * from './elements';
|
|
|
8
8
|
export * from './utils';
|
|
9
9
|
export { storeConfig, store } from './store';
|
|
10
10
|
export { SETTINGS_DEFAULTS } from './store/defaults';
|
|
11
|
-
export {
|
|
11
|
+
export { privateApis } from './private-apis';
|
|
12
12
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/index.js"],"names":["getBorderClassesAndStyles","__experimentalGetBorderClassesAndStyles","useBorderProps","__experimentalUseBorderProps","getColorClassesAndStyles","__experimentalGetColorClassesAndStyles","getTypographyClassesAndStyles","useColorProps","__experimentalUseColorProps","useCustomSides","__experimentalUseCustomSides","getSpacingClassesAndStyles","__experimentalGetSpacingClassesAndStyles","getGapCSSValue","__experimentalGetGapCSSValue","useCachedTruthy","useLayoutClasses","__experimentaluseLayoutClasses","useLayoutStyles","__experimentaluseLayoutStyles","storeConfig","store","SETTINGS_DEFAULTS","
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/index.js"],"names":["getBorderClassesAndStyles","__experimentalGetBorderClassesAndStyles","useBorderProps","__experimentalUseBorderProps","getColorClassesAndStyles","__experimentalGetColorClassesAndStyles","getTypographyClassesAndStyles","useColorProps","__experimentalUseColorProps","useCustomSides","__experimentalUseCustomSides","getSpacingClassesAndStyles","__experimentalGetSpacingClassesAndStyles","getGapCSSValue","__experimentalGetGapCSSValue","useCachedTruthy","useLayoutClasses","__experimentaluseLayoutClasses","useLayoutStyles","__experimentaluseLayoutStyles","storeConfig","store","SETTINGS_DEFAULTS","privateApis"],"mappings":"AAAA;AACA;AACA;AACA,OAAO,SAAP;AACA,SACCA,yBAAyB,IAAIC,uCAD9B,EAECC,cAAc,IAAIC,4BAFnB,EAGCC,wBAAwB,IAAIC,sCAH7B,EAICC,6BAJD,EAKCC,aAAa,IAAIC,2BALlB,EAMCC,cAAc,IAAIC,4BANnB,EAOCC,0BAA0B,IAAIC,wCAP/B,EAQCC,cAAc,IAAIC,4BARnB,EASCC,eATD,EAUCC,gBAAgB,IAAIC,8BAVrB,EAWCC,eAAe,IAAIC,6BAXpB,QAYO,SAZP;AAaA,cAAc,cAAd;AACA,cAAc,YAAd;AACA,cAAc,SAAd;AACA,SAASC,WAAT,EAAsBC,KAAtB,QAAmC,SAAnC;AACA,SAASC,iBAAT,QAAkC,kBAAlC;AACA,SAASC,WAAT,QAA4B,gBAA5B","sourcesContent":["/**\n * Internal dependencies\n */\nimport './hooks';\nexport {\n\tgetBorderClassesAndStyles as __experimentalGetBorderClassesAndStyles,\n\tuseBorderProps as __experimentalUseBorderProps,\n\tgetColorClassesAndStyles as __experimentalGetColorClassesAndStyles,\n\tgetTypographyClassesAndStyles,\n\tuseColorProps as __experimentalUseColorProps,\n\tuseCustomSides as __experimentalUseCustomSides,\n\tgetSpacingClassesAndStyles as __experimentalGetSpacingClassesAndStyles,\n\tgetGapCSSValue as __experimentalGetGapCSSValue,\n\tuseCachedTruthy,\n\tuseLayoutClasses as __experimentaluseLayoutClasses,\n\tuseLayoutStyles as __experimentaluseLayoutStyles,\n} from './hooks';\nexport * from './components';\nexport * from './elements';\nexport * from './utils';\nexport { storeConfig, store } from './store';\nexport { SETTINGS_DEFAULTS } from './store/defaults';\nexport { privateApis } from './private-apis';\n"]}
|
|
@@ -55,7 +55,7 @@ export default {
|
|
|
55
55
|
return 'vertical';
|
|
56
56
|
},
|
|
57
57
|
|
|
58
|
-
getAlignments(layout) {
|
|
58
|
+
getAlignments(layout, isBlockBasedTheme) {
|
|
59
59
|
const alignmentInfo = getAlignmentsInfo(layout);
|
|
60
60
|
|
|
61
61
|
if (layout.alignments !== undefined) {
|
|
@@ -75,7 +75,28 @@ export default {
|
|
|
75
75
|
name: 'center'
|
|
76
76
|
}, {
|
|
77
77
|
name: 'right'
|
|
78
|
-
}];
|
|
78
|
+
}]; // This is for backwards compatibility with hybrid themes.
|
|
79
|
+
|
|
80
|
+
if (!isBlockBasedTheme) {
|
|
81
|
+
const {
|
|
82
|
+
contentSize,
|
|
83
|
+
wideSize
|
|
84
|
+
} = layout;
|
|
85
|
+
|
|
86
|
+
if (contentSize) {
|
|
87
|
+
alignments.unshift({
|
|
88
|
+
name: 'full'
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
if (wideSize) {
|
|
93
|
+
alignments.unshift({
|
|
94
|
+
name: 'wide',
|
|
95
|
+
info: alignmentInfo.wide
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
79
100
|
alignments.unshift({
|
|
80
101
|
name: 'none',
|
|
81
102
|
info: alignmentInfo.none
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/layouts/flow.js"],"names":["__","getBlockGapCSS","getAlignmentsInfo","getGapCSSValue","shouldSkipSerialization","name","label","inspectorControls","DefaultLayoutInspectorControls","toolBarControls","DefaultLayoutToolbarControls","getLayoutStyle","selector","style","blockName","hasBlockGapSupport","layoutDefinitions","blockGapStyleValue","spacing","blockGap","blockGapValue","top","output","getOrientation","getAlignments","layout","alignmentInfo","alignments","undefined","includes","unshift","map","alignment","info","none"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AAEA;AACA;AACA;;AACA,SAASC,cAAT,EAAyBC,iBAAzB,QAAkD,SAAlD;AACA,SAASC,cAAT,QAA+B,cAA/B;AACA,SAASC,uBAAT,QAAwC,gBAAxC;AAEA,eAAe;AACdC,EAAAA,IAAI,EAAE,SADQ;AAEdC,EAAAA,KAAK,EAAEN,EAAE,CAAE,MAAF,CAFK;AAGdO,EAAAA,iBAAiB,EAAE,SAASC,8BAAT,GAA0C;AAC5D,WAAO,IAAP;AACA,GALa;AAMdC,EAAAA,eAAe,EAAE,SAASC,4BAAT,GAAwC;AACxD,WAAO,IAAP;AACA,GARa;AASdC,EAAAA,cAAc,EAAE,SAASA,cAAT,OAMZ;AAAA;;AAAA,QANqC;AACxCC,MAAAA,QADwC;AAExCC,MAAAA,KAFwC;AAGxCC,MAAAA,SAHwC;AAIxCC,MAAAA,kBAJwC;AAKxCC,MAAAA;AALwC,KAMrC;AACH,UAAMC,kBAAkB,GAAGd,cAAc,CAAEU,KAAF,aAAEA,KAAF,yCAAEA,KAAK,CAAEK,OAAT,mDAAE,eAAgBC,QAAlB,CAAzC,CADG,CAGH;AACA;;AACA,QAAIC,aAAa,GAAG,EAApB;;AACA,QAAK,CAAEhB,uBAAuB,CAAEU,SAAF,EAAa,SAAb,EAAwB,UAAxB,CAA9B,EAAqE;AACpE;AACA,UAAKG,kBAAL,aAAKA,kBAAL,eAAKA,kBAAkB,CAAEI,GAAzB,EAA+B;AAC9BD,QAAAA,aAAa,GAAGjB,cAAc,CAAEc,kBAAF,aAAEA,kBAAF,uBAAEA,kBAAkB,CAAEI,GAAtB,CAA9B;AACA,OAFD,MAEO,IAAK,OAAOJ,kBAAP,KAA8B,QAAnC,EAA8C;AACpDG,QAAAA,aAAa,GAAGjB,cAAc,CAAEc,kBAAF,CAA9B;AACA;AACD;;AAED,QAAIK,MAAM,GAAG,EAAb,CAfG,CAiBH;;AACA,QAAKP,kBAAkB,IAAIK,aAA3B,EAA2C;AAC1CE,MAAAA,MAAM,IAAIrB,cAAc,CACvBW,QADuB,EAEvBI,iBAFuB,EAGvB,SAHuB,EAIvBI,aAJuB,CAAxB;AAMA;;AACD,WAAOE,MAAP;AACA,GA1Ca;;AA2CdC,EAAAA,cAAc,GAAG;AAChB,WAAO,UAAP;AACA,GA7Ca;;AA8CdC,EAAAA,aAAa,CAAEC,MAAF,
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/layouts/flow.js"],"names":["__","getBlockGapCSS","getAlignmentsInfo","getGapCSSValue","shouldSkipSerialization","name","label","inspectorControls","DefaultLayoutInspectorControls","toolBarControls","DefaultLayoutToolbarControls","getLayoutStyle","selector","style","blockName","hasBlockGapSupport","layoutDefinitions","blockGapStyleValue","spacing","blockGap","blockGapValue","top","output","getOrientation","getAlignments","layout","isBlockBasedTheme","alignmentInfo","alignments","undefined","includes","unshift","map","alignment","info","contentSize","wideSize","wide","none"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AAEA;AACA;AACA;;AACA,SAASC,cAAT,EAAyBC,iBAAzB,QAAkD,SAAlD;AACA,SAASC,cAAT,QAA+B,cAA/B;AACA,SAASC,uBAAT,QAAwC,gBAAxC;AAEA,eAAe;AACdC,EAAAA,IAAI,EAAE,SADQ;AAEdC,EAAAA,KAAK,EAAEN,EAAE,CAAE,MAAF,CAFK;AAGdO,EAAAA,iBAAiB,EAAE,SAASC,8BAAT,GAA0C;AAC5D,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CAAvC;;AACA,QAAKA,MAAM,CAACG,UAAP,KAAsBC,SAA3B,EAAuC;AACtC,UAAK,CAAEJ,MAAM,CAACG,UAAP,CAAkBE,QAAlB,CAA4B,MAA5B,CAAP,EAA8C;AAC7CL,QAAAA,MAAM,CAACG,UAAP,CAAkBG,OAAlB,CAA2B,MAA3B;AACA;;AACD,aAAON,MAAM,CAACG,UAAP,CAAkBI,GAAlB,CAAyBC,SAAF,KAAmB;AAChD5B,QAAAA,IAAI,EAAE4B,SAD0C;AAEhDC,QAAAA,IAAI,EAAEP,aAAa,CAAEM,SAAF;AAF6B,OAAnB,CAAvB,CAAP;AAIA;;AAED,UAAML,UAAU,GAAG,CAClB;AAAEvB,MAAAA,IAAI,EAAE;AAAR,KADkB,EAElB;AAAEA,MAAAA,IAAI,EAAE;AAAR,KAFkB,EAGlB;AAAEA,MAAAA,IAAI,EAAE;AAAR,KAHkB,CAAnB,CAZ0C,CAkB1C;;AACA,QAAK,CAAEqB,iBAAP,EAA2B;AAC1B,YAAM;AAAES,QAAAA,WAAF;AAAeC,QAAAA;AAAf,UAA4BX,MAAlC;;AACA,UAAKU,WAAL,EAAmB;AAClBP,QAAAA,UAAU,CAACG,OAAX,CAAoB;AAAE1B,UAAAA,IAAI,EAAE;AAAR,SAApB;AACA;;AAED,UAAK+B,QAAL,EAAgB;AACfR,QAAAA,UAAU,CAACG,OAAX,CAAoB;AACnB1B,UAAAA,IAAI,EAAE,MADa;AAEnB6B,UAAAA,IAAI,EAAEP,aAAa,CAACU;AAFD,SAApB;AAIA;AACD;;AAEDT,IAAAA,UAAU,CAACG,OAAX,CAAoB;AAAE1B,MAAAA,IAAI,EAAE,MAAR;AAAgB6B,MAAAA,IAAI,EAAEP,aAAa,CAACW;AAApC,KAApB;AAEA,WAAOV,UAAP;AACA;;AAlFa,CAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { getBlockGapCSS, getAlignmentsInfo } from './utils';\nimport { getGapCSSValue } from '../hooks/gap';\nimport { shouldSkipSerialization } from '../hooks/utils';\n\nexport default {\n\tname: 'default',\n\tlabel: __( 'Flow' ),\n\tinspectorControls: function DefaultLayoutInspectorControls() {\n\t\treturn null;\n\t},\n\ttoolBarControls: function DefaultLayoutToolbarControls() {\n\t\treturn null;\n\t},\n\tgetLayoutStyle: function getLayoutStyle( {\n\t\tselector,\n\t\tstyle,\n\t\tblockName,\n\t\thasBlockGapSupport,\n\t\tlayoutDefinitions,\n\t} ) {\n\t\tconst blockGapStyleValue = getGapCSSValue( style?.spacing?.blockGap );\n\n\t\t// If a block's block.json skips serialization for spacing or\n\t\t// spacing.blockGap, don't apply the user-defined value to the styles.\n\t\tlet blockGapValue = '';\n\t\tif ( ! shouldSkipSerialization( blockName, 'spacing', 'blockGap' ) ) {\n\t\t\t// If an object is provided only use the 'top' value for this kind of gap.\n\t\t\tif ( blockGapStyleValue?.top ) {\n\t\t\t\tblockGapValue = getGapCSSValue( blockGapStyleValue?.top );\n\t\t\t} else if ( typeof blockGapStyleValue === 'string' ) {\n\t\t\t\tblockGapValue = getGapCSSValue( blockGapStyleValue );\n\t\t\t}\n\t\t}\n\n\t\tlet output = '';\n\n\t\t// Output blockGap styles based on rules contained in layout definitions in theme.json.\n\t\tif ( hasBlockGapSupport && blockGapValue ) {\n\t\t\toutput += getBlockGapCSS(\n\t\t\t\tselector,\n\t\t\t\tlayoutDefinitions,\n\t\t\t\t'default',\n\t\t\t\tblockGapValue\n\t\t\t);\n\t\t}\n\t\treturn output;\n\t},\n\tgetOrientation() {\n\t\treturn 'vertical';\n\t},\n\tgetAlignments( layout, isBlockBasedTheme ) {\n\t\tconst alignmentInfo = getAlignmentsInfo( layout );\n\t\tif ( layout.alignments !== undefined ) {\n\t\t\tif ( ! layout.alignments.includes( 'none' ) ) {\n\t\t\t\tlayout.alignments.unshift( 'none' );\n\t\t\t}\n\t\t\treturn layout.alignments.map( ( alignment ) => ( {\n\t\t\t\tname: alignment,\n\t\t\t\tinfo: alignmentInfo[ alignment ],\n\t\t\t} ) );\n\t\t}\n\n\t\tconst alignments = [\n\t\t\t{ name: 'left' },\n\t\t\t{ name: 'center' },\n\t\t\t{ name: 'right' },\n\t\t];\n\n\t\t// This is for backwards compatibility with hybrid themes.\n\t\tif ( ! isBlockBasedTheme ) {\n\t\t\tconst { contentSize, wideSize } = layout;\n\t\t\tif ( contentSize ) {\n\t\t\t\talignments.unshift( { name: 'full' } );\n\t\t\t}\n\n\t\t\tif ( wideSize ) {\n\t\t\t\talignments.unshift( {\n\t\t\t\t\tname: 'wide',\n\t\t\t\t\tinfo: alignmentInfo.wide,\n\t\t\t\t} );\n\t\t\t}\n\t\t}\n\n\t\talignments.unshift( { name: 'none', info: alignmentInfo.none } );\n\n\t\treturn alignments;\n\t},\n};\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/private-apis';
|
|
5
|
+
export const {
|
|
6
|
+
lock,
|
|
7
|
+
unlock
|
|
8
|
+
} = __dangerousOptInToUnstableAPIsOnlyForCoreModules('I know using unstable features means my plugin or theme will inevitably break on the next WordPress release.', '@wordpress/block-editor');
|
|
9
|
+
//# sourceMappingURL=lock-unlock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/lock-unlock.js"],"names":["__dangerousOptInToUnstableAPIsOnlyForCoreModules","lock","unlock"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,gDAAT,QAAiE,yBAAjE;AAEA,OAAO,MAAM;AAAEC,EAAAA,IAAF;AAAQC,EAAAA;AAAR,IACZF,gDAAgD,CAC/C,8GAD+C,EAE/C,yBAF+C,CAD1C","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/private-apis';\n\nexport const { lock, unlock } =\n\t__dangerousOptInToUnstableAPIsOnlyForCoreModules(\n\t\t'I know using unstable features means my plugin or theme will inevitably break on the next WordPress release.',\n\t\t'@wordpress/block-editor'\n\t);\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal dependencies
|
|
3
|
+
*/
|
|
4
|
+
import * as globalStyles from './components/global-styles';
|
|
5
|
+
import { ExperimentalBlockEditorProvider } from './components/provider';
|
|
6
|
+
import { lock } from './lock-unlock';
|
|
7
|
+
import OffCanvasEditor from './components/off-canvas-editor';
|
|
8
|
+
import LeafMoreMenu from './components/off-canvas-editor/leaf-more-menu';
|
|
9
|
+
/**
|
|
10
|
+
* Private @wordpress/block-editor APIs.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
export const privateApis = {};
|
|
14
|
+
lock(privateApis, { ...globalStyles,
|
|
15
|
+
ExperimentalBlockEditorProvider,
|
|
16
|
+
LeafMoreMenu,
|
|
17
|
+
OffCanvasEditor
|
|
18
|
+
});
|
|
19
|
+
//# sourceMappingURL=private-apis.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/private-apis.js"],"names":["globalStyles","ExperimentalBlockEditorProvider","lock","OffCanvasEditor","LeafMoreMenu","privateApis"],"mappings":"AAAA;AACA;AACA;AACA,OAAO,KAAKA,YAAZ,MAA8B,4BAA9B;AACA,SAASC,+BAAT,QAAgD,uBAAhD;AACA,SAASC,IAAT,QAAqB,eAArB;AACA,OAAOC,eAAP,MAA4B,gCAA5B;AACA,OAAOC,YAAP,MAAyB,+CAAzB;AAEA;AACA;AACA;;AACA,OAAO,MAAMC,WAAW,GAAG,EAApB;AACPH,IAAI,CAAEG,WAAF,EAAe,EAClB,GAAGL,YADe;AAElBC,EAAAA,+BAFkB;AAGlBG,EAAAA,YAHkB;AAIlBD,EAAAA;AAJkB,CAAf,CAAJ","sourcesContent":["/**\n * Internal dependencies\n */\nimport * as globalStyles from './components/global-styles';\nimport { ExperimentalBlockEditorProvider } from './components/provider';\nimport { lock } from './lock-unlock';\nimport OffCanvasEditor from './components/off-canvas-editor';\nimport LeafMoreMenu from './components/off-canvas-editor/leaf-more-menu';\n\n/**\n * Private @wordpress/block-editor APIs.\n */\nexport const privateApis = {};\nlock( privateApis, {\n\t...globalStyles,\n\tExperimentalBlockEditorProvider,\n\tLeafMoreMenu,\n\tOffCanvasEditor,\n} );\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal dependencies
|
|
3
|
+
*/
|
|
4
|
+
import * as globalStyles from './components/global-styles';
|
|
5
|
+
import { ExperimentalBlockEditorProvider } from './components/provider';
|
|
6
|
+
import { lock } from './lock-unlock';
|
|
7
|
+
/**
|
|
8
|
+
* Private @wordpress/block-editor APIs.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
export const privateApis = {};
|
|
12
|
+
lock(privateApis, { ...globalStyles,
|
|
13
|
+
ExperimentalBlockEditorProvider
|
|
14
|
+
});
|
|
15
|
+
//# sourceMappingURL=private-apis.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/private-apis.native.js"],"names":["globalStyles","ExperimentalBlockEditorProvider","lock","privateApis"],"mappings":"AAAA;AACA;AACA;AACA,OAAO,KAAKA,YAAZ,MAA8B,4BAA9B;AACA,SAASC,+BAAT,QAAgD,uBAAhD;AACA,SAASC,IAAT,QAAqB,eAArB;AAEA;AACA;AACA;;AACA,OAAO,MAAMC,WAAW,GAAG,EAApB;AACPD,IAAI,CAAEC,WAAF,EAAe,EAClB,GAAGH,YADe;AAElBC,EAAAA;AAFkB,CAAf,CAAJ","sourcesContent":["/**\n * Internal dependencies\n */\nimport * as globalStyles from './components/global-styles';\nimport { ExperimentalBlockEditorProvider } from './components/provider';\nimport { lock } from './lock-unlock';\n\n/**\n * Private @wordpress/block-editor APIs.\n */\nexport const privateApis = {};\nlock( privateApis, {\n\t...globalStyles,\n\tExperimentalBlockEditorProvider,\n} );\n"]}
|
|
@@ -12,7 +12,7 @@ import * as privateActions from './private-actions';
|
|
|
12
12
|
import * as privateSelectors from './private-selectors';
|
|
13
13
|
import * as actions from './actions';
|
|
14
14
|
import { STORE_NAME } from './constants';
|
|
15
|
-
import { unlock } from '../
|
|
15
|
+
import { unlock } from '../lock-unlock';
|
|
16
16
|
/**
|
|
17
17
|
* Block editor data store configuration.
|
|
18
18
|
*
|