@wordpress/block-library 9.0.3 → 9.0.5
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/block/index.js +5 -1
- package/build/block/index.js.map +1 -1
- package/build/image/image.js +14 -15
- package/build/image/image.js.map +1 -1
- package/build/list-item/hooks/use-merge.js +8 -1
- package/build/list-item/hooks/use-merge.js.map +1 -1
- package/build/media-text/edit.js +3 -2
- package/build/media-text/edit.js.map +1 -1
- package/build/query/edit/inspector-controls/index.js +3 -2
- package/build/query/edit/inspector-controls/index.js.map +1 -1
- package/build/utils/hooks.js +12 -0
- package/build/utils/hooks.js.map +1 -1
- package/build-module/block/index.js +5 -1
- package/build-module/block/index.js.map +1 -1
- package/build-module/image/image.js +9 -10
- package/build-module/image/image.js.map +1 -1
- package/build-module/list-item/hooks/use-merge.js +8 -1
- package/build-module/list-item/hooks/use-merge.js.map +1 -1
- package/build-module/media-text/edit.js +3 -2
- package/build-module/media-text/edit.js.map +1 -1
- package/build-module/query/edit/inspector-controls/index.js +3 -2
- package/build-module/query/edit/inspector-controls/index.js.map +1 -1
- package/build-module/utils/hooks.js +11 -0
- package/build-module/utils/hooks.js.map +1 -1
- package/build-style/audio/style-rtl.css +1 -1
- package/build-style/audio/style.css +1 -1
- package/build-style/audio/theme-rtl.css +2 -2
- package/build-style/audio/theme.css +2 -2
- package/build-style/editor-rtl.css +0 -12
- package/build-style/editor.css +0 -12
- package/build-style/embed/style-rtl.css +1 -1
- package/build-style/embed/style.css +1 -1
- package/build-style/embed/theme-rtl.css +2 -2
- package/build-style/embed/theme.css +2 -2
- package/build-style/image/editor-rtl.css +0 -12
- package/build-style/image/editor.css +0 -12
- package/build-style/image/style-rtl.css +1 -1
- package/build-style/image/style.css +1 -1
- package/build-style/navigation/style-rtl.css +1 -0
- package/build-style/navigation/style.css +1 -0
- package/build-style/reset-rtl.css +1 -5
- package/build-style/reset.css +1 -5
- package/build-style/social-links/style-rtl.css +91 -91
- package/build-style/social-links/style.css +91 -91
- package/build-style/style-rtl.css +96 -95
- package/build-style/style.css +96 -95
- package/build-style/table/theme-rtl.css +2 -2
- package/build-style/table/theme.css +2 -2
- package/build-style/theme-rtl.css +8 -8
- package/build-style/theme.css +8 -8
- package/build-style/video/style-rtl.css +1 -1
- package/build-style/video/style.css +1 -1
- package/build-style/video/theme-rtl.css +2 -2
- package/build-style/video/theme.css +2 -2
- package/package.json +12 -12
- package/src/audio/style.scss +1 -1
- package/src/audio/theme.scss +1 -1
- package/src/block/block.json +5 -1
- package/src/embed/style.scss +1 -1
- package/src/embed/theme.scss +1 -1
- package/src/image/editor.scss +0 -13
- package/src/image/image.js +21 -11
- package/src/image/style.scss +1 -1
- package/src/list-item/hooks/use-merge.js +19 -5
- package/src/media-text/edit.js +3 -2
- package/src/media-text/index.php +68 -18
- package/src/navigation/index.php +5 -3
- package/src/navigation/style.scss +1 -0
- package/src/query/edit/inspector-controls/index.js +3 -2
- package/src/reset.scss +11 -12
- package/src/social-links/style.scss +2 -2
- package/src/table/theme.scss +1 -1
- package/src/utils/hooks.js +14 -0
- package/src/video/style.scss +1 -1
- package/src/video/theme.scss +1 -1
- package/build/utils/constants.js +0 -15
- package/build/utils/constants.js.map +0 -1
- package/build-module/utils/constants.js +0 -9
- package/build-module/utils/constants.js.map +0 -1
- package/src/utils/constants.js +0 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["PanelBody","TextControl","SelectControl","RangeControl","ToggleControl","Notice","__experimentalToolsPanel","ToolsPanel","__experimentalToolsPanelItem","ToolsPanelItem","__","privateApis","blockEditorPrivateApis","debounce","useEffect","useState","useCallback","OrderControl","AuthorControl","ParentControl","TaxonomyControls","StickyControl","EnhancedPaginationControl","CreateNewPostLink","unlock","usePostTypes","useIsPostTypeHierarchical","useAllowedControls","isControlAllowed","useTaxonomies","TOOLSPANEL_DROPDOWNMENU_PROPS","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","BlockInfo","QueryInspectorControls","props","attributes","setQuery","setDisplayLayout","setAttributes","clientId","query","displayLayout","enhancedPagination","order","orderBy","author","authorIds","postType","sticky","inherit","taxQuery","parents","allowedControls","showSticky","setShowSticky","postTypesTaxonomiesMap","postTypesSelectOptions","taxonomies","isPostTypeHierarchical","onPostTypeChange","newValue","updateQuery","supportedTaxonomies","updatedTaxQuery","Object","entries","reduce","accumulator","taxonomySlug","terms","includes","keys","length","undefined","querySearch","setQuerySearch","search","onChangeDebounced","cancel","showInheritControl","showPostTypeControl","showColumnsControl","showOrderControl","showStickyControl","showSettingsPanel","showTaxControl","showAuthorControl","showSearchControl","showParentControl","showFiltersPanel","children","title","__nextHasNoMarginBottom","label","help","checked","onChange","value","options","columns","min","max","Math","status","isDismissible","className","resetAll","dropdownMenuProps","hasValue","values","some","onDeselect"],"sources":["@wordpress/block-library/src/query/edit/inspector-controls/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tPanelBody,\n\tTextControl,\n\tSelectControl,\n\tRangeControl,\n\tToggleControl,\n\tNotice,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\nimport { debounce } from '@wordpress/compose';\nimport { useEffect, useState, useCallback } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport OrderControl from './order-control';\nimport AuthorControl from './author-control';\nimport ParentControl from './parent-control';\nimport { TaxonomyControls } from './taxonomy-controls';\nimport StickyControl from './sticky-control';\nimport EnhancedPaginationControl from './enhanced-pagination-control';\nimport CreateNewPostLink from './create-new-post-link';\nimport { unlock } from '../../../lock-unlock';\nimport {\n\tusePostTypes,\n\tuseIsPostTypeHierarchical,\n\tuseAllowedControls,\n\tisControlAllowed,\n\tuseTaxonomies,\n} from '../../utils';\nimport { TOOLSPANEL_DROPDOWNMENU_PROPS } from '../../../utils/constants';\n\nconst { BlockInfo } = unlock( blockEditorPrivateApis );\n\nexport default function QueryInspectorControls( props ) {\n\tconst { attributes, setQuery, setDisplayLayout, setAttributes, clientId } =\n\t\tprops;\n\tconst { query, displayLayout, enhancedPagination } = attributes;\n\tconst {\n\t\torder,\n\t\torderBy,\n\t\tauthor: authorIds,\n\t\tpostType,\n\t\tsticky,\n\t\tinherit,\n\t\ttaxQuery,\n\t\tparents,\n\t} = query;\n\tconst allowedControls = useAllowedControls( attributes );\n\tconst [ showSticky, setShowSticky ] = useState( postType === 'post' );\n\tconst { postTypesTaxonomiesMap, postTypesSelectOptions } = usePostTypes();\n\tconst taxonomies = useTaxonomies( postType );\n\tconst isPostTypeHierarchical = useIsPostTypeHierarchical( postType );\n\tuseEffect( () => {\n\t\tsetShowSticky( postType === 'post' );\n\t}, [ postType ] );\n\tconst onPostTypeChange = ( newValue ) => {\n\t\tconst updateQuery = { postType: newValue };\n\t\t// We need to dynamically update the `taxQuery` property,\n\t\t// by removing any not supported taxonomy from the query.\n\t\tconst supportedTaxonomies = postTypesTaxonomiesMap[ newValue ];\n\t\tconst updatedTaxQuery = Object.entries( taxQuery || {} ).reduce(\n\t\t\t( accumulator, [ taxonomySlug, terms ] ) => {\n\t\t\t\tif ( supportedTaxonomies.includes( taxonomySlug ) ) {\n\t\t\t\t\taccumulator[ taxonomySlug ] = terms;\n\t\t\t\t}\n\t\t\t\treturn accumulator;\n\t\t\t},\n\t\t\t{}\n\t\t);\n\t\tupdateQuery.taxQuery = !! Object.keys( updatedTaxQuery ).length\n\t\t\t? updatedTaxQuery\n\t\t\t: undefined;\n\n\t\tif ( newValue !== 'post' ) {\n\t\t\tupdateQuery.sticky = '';\n\t\t}\n\t\t// We need to reset `parents` because they are tied to each post type.\n\t\tupdateQuery.parents = [];\n\t\tsetQuery( updateQuery );\n\t};\n\tconst [ querySearch, setQuerySearch ] = useState( query.search );\n\tconst onChangeDebounced = useCallback(\n\t\tdebounce( () => {\n\t\t\tif ( query.search !== querySearch ) {\n\t\t\t\tsetQuery( { search: querySearch } );\n\t\t\t}\n\t\t}, 250 ),\n\t\t[ querySearch, query.search ]\n\t);\n\tuseEffect( () => {\n\t\tonChangeDebounced();\n\t\treturn onChangeDebounced.cancel;\n\t}, [ querySearch, onChangeDebounced ] );\n\tconst showInheritControl = isControlAllowed( allowedControls, 'inherit' );\n\tconst showPostTypeControl =\n\t\t! inherit && isControlAllowed( allowedControls, 'postType' );\n\tconst showColumnsControl = false;\n\tconst showOrderControl =\n\t\t! inherit && isControlAllowed( allowedControls, 'order' );\n\tconst showStickyControl =\n\t\t! inherit &&\n\t\tshowSticky &&\n\t\tisControlAllowed( allowedControls, 'sticky' );\n\tconst showSettingsPanel =\n\t\tshowInheritControl ||\n\t\tshowPostTypeControl ||\n\t\tshowColumnsControl ||\n\t\tshowOrderControl ||\n\t\tshowStickyControl;\n\tconst showTaxControl =\n\t\t!! taxonomies?.length &&\n\t\tisControlAllowed( allowedControls, 'taxQuery' );\n\tconst showAuthorControl = isControlAllowed( allowedControls, 'author' );\n\tconst showSearchControl = isControlAllowed( allowedControls, 'search' );\n\tconst showParentControl =\n\t\tisControlAllowed( allowedControls, 'parents' ) &&\n\t\tisPostTypeHierarchical;\n\n\tconst showFiltersPanel =\n\t\tshowTaxControl ||\n\t\tshowAuthorControl ||\n\t\tshowSearchControl ||\n\t\tshowParentControl;\n\n\treturn (\n\t\t<>\n\t\t\t<BlockInfo>\n\t\t\t\t<CreateNewPostLink { ...props } />\n\t\t\t</BlockInfo>\n\t\t\t{ showSettingsPanel && (\n\t\t\t\t<PanelBody title={ __( 'Settings' ) }>\n\t\t\t\t\t{ showInheritControl && (\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\tlabel={ __( 'Inherit query from template' ) }\n\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t'Toggle to use the global query context that is set with the current template, such as an archive or search. Disable to customize the settings independently.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tchecked={ !! inherit }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tsetQuery( { inherit: !! value } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t{ showPostTypeControl && (\n\t\t\t\t\t\t<SelectControl\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\toptions={ postTypesSelectOptions }\n\t\t\t\t\t\t\tvalue={ postType }\n\t\t\t\t\t\t\tlabel={ __( 'Post type' ) }\n\t\t\t\t\t\t\tonChange={ onPostTypeChange }\n\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t'WordPress contains different types of content and they are divided into collections called “Post types”. By default there are a few different ones such as blog posts and pages, but plugins could add more.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t{ showColumnsControl && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<RangeControl\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\tlabel={ __( 'Columns' ) }\n\t\t\t\t\t\t\t\tvalue={ displayLayout.columns }\n\t\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\t\tsetDisplayLayout( {\n\t\t\t\t\t\t\t\t\t\tcolumns: value,\n\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tmin={ 2 }\n\t\t\t\t\t\t\t\tmax={ Math.max( 6, displayLayout.columns ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t{ displayLayout.columns > 6 && (\n\t\t\t\t\t\t\t\t<Notice\n\t\t\t\t\t\t\t\t\tstatus=\"warning\"\n\t\t\t\t\t\t\t\t\tisDismissible={ false }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t'This column count exceeds the recommended amount and may cause visual breakage.'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</Notice>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\t\t\t\t\t{ showOrderControl && (\n\t\t\t\t\t\t<OrderControl\n\t\t\t\t\t\t\t{ ...{ order, orderBy } }\n\t\t\t\t\t\t\tonChange={ setQuery }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t{ showStickyControl && (\n\t\t\t\t\t\t<StickyControl\n\t\t\t\t\t\t\tvalue={ sticky }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tsetQuery( { sticky: value } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t<EnhancedPaginationControl\n\t\t\t\t\t\tenhancedPagination={ enhancedPagination }\n\t\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t/>\n\t\t\t\t</PanelBody>\n\t\t\t) }\n\t\t\t{ ! inherit && showFiltersPanel && (\n\t\t\t\t<ToolsPanel\n\t\t\t\t\tclassName=\"block-library-query-toolspanel__filters\"\n\t\t\t\t\tlabel={ __( 'Filters' ) }\n\t\t\t\t\tresetAll={ () => {\n\t\t\t\t\t\tsetQuery( {\n\t\t\t\t\t\t\tauthor: '',\n\t\t\t\t\t\t\tparents: [],\n\t\t\t\t\t\t\tsearch: '',\n\t\t\t\t\t\t\ttaxQuery: null,\n\t\t\t\t\t\t} );\n\t\t\t\t\t\tsetQuerySearch( '' );\n\t\t\t\t\t} }\n\t\t\t\t\tdropdownMenuProps={ TOOLSPANEL_DROPDOWNMENU_PROPS }\n\t\t\t\t>\n\t\t\t\t\t{ showTaxControl && (\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\tlabel={ __( 'Taxonomies' ) }\n\t\t\t\t\t\t\thasValue={ () =>\n\t\t\t\t\t\t\t\tObject.values( taxQuery || {} ).some(\n\t\t\t\t\t\t\t\t\t( terms ) => !! terms.length\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tonDeselect={ () => setQuery( { taxQuery: null } ) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<TaxonomyControls\n\t\t\t\t\t\t\t\tonChange={ setQuery }\n\t\t\t\t\t\t\t\tquery={ query }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t) }\n\t\t\t\t\t{ showAuthorControl && (\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\thasValue={ () => !! authorIds }\n\t\t\t\t\t\t\tlabel={ __( 'Authors' ) }\n\t\t\t\t\t\t\tonDeselect={ () => setQuery( { author: '' } ) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<AuthorControl\n\t\t\t\t\t\t\t\tvalue={ authorIds }\n\t\t\t\t\t\t\t\tonChange={ setQuery }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t) }\n\t\t\t\t\t{ showSearchControl && (\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\thasValue={ () => !! querySearch }\n\t\t\t\t\t\t\tlabel={ __( 'Keyword' ) }\n\t\t\t\t\t\t\tonDeselect={ () => setQuerySearch( '' ) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\tlabel={ __( 'Keyword' ) }\n\t\t\t\t\t\t\t\tvalue={ querySearch }\n\t\t\t\t\t\t\t\tonChange={ setQuerySearch }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t) }\n\t\t\t\t\t{ showParentControl && (\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\thasValue={ () => !! parents?.length }\n\t\t\t\t\t\t\tlabel={ __( 'Parents' ) }\n\t\t\t\t\t\t\tonDeselect={ () => setQuery( { parents: [] } ) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<ParentControl\n\t\t\t\t\t\t\t\tparents={ parents }\n\t\t\t\t\t\t\t\tpostType={ postType }\n\t\t\t\t\t\t\t\tonChange={ setQuery }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t) }\n\t\t\t\t</ToolsPanel>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SACCA,SAAS,EACTC,WAAW,EACXC,aAAa,EACbC,YAAY,EACZC,aAAa,EACbC,MAAM,EACNC,wBAAwB,IAAIC,UAAU,EACtCC,4BAA4B,IAAIC,cAAc,QACxC,uBAAuB;AAC9B,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,WAAW,IAAIC,sBAAsB,QAAQ,yBAAyB;AAC/E,SAASC,QAAQ,QAAQ,oBAAoB;AAC7C,SAASC,SAAS,EAAEC,QAAQ,EAAEC,WAAW,QAAQ,oBAAoB;;AAErE;AACA;AACA;AACA,OAAOC,YAAY,MAAM,iBAAiB;AAC1C,OAAOC,aAAa,MAAM,kBAAkB;AAC5C,OAAOC,aAAa,MAAM,kBAAkB;AAC5C,SAASC,gBAAgB,QAAQ,qBAAqB;AACtD,OAAOC,aAAa,MAAM,kBAAkB;AAC5C,OAAOC,yBAAyB,MAAM,+BAA+B;AACrE,OAAOC,iBAAiB,MAAM,wBAAwB;AACtD,SAASC,MAAM,QAAQ,sBAAsB;AAC7C,SACCC,YAAY,EACZC,yBAAyB,EACzBC,kBAAkB,EAClBC,gBAAgB,EAChBC,aAAa,QACP,aAAa;AACpB,SAASC,6BAA6B,QAAQ,0BAA0B;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,QAAA,IAAAC,SAAA;AAAA,SAAAC,IAAA,IAAAC,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AAG5D;QAAU,CACrB;MAAC,CACa,CAChB,EACCmD,iBAAiB,iBAClB5D,IAAA,CAACvB,cAAc;QACdwG,QAAQ,EAAGA,CAAA,KAAM,CAAC,CAAElC,WAAa;QACjCmB,KAAK,EAAGxF,EAAE,CAAE,SAAU,CAAG;QACzB0G,UAAU,EAAGA,CAAA,KAAMpC,cAAc,CAAE,EAAG,CAAG;QAAAe,QAAA,eAEzC/D,IAAA,CAAC/B,WAAW;UACXgG,uBAAuB;UACvBC,KAAK,EAAGxF,EAAE,CAAE,SAAU,CAAG;UACzB4F,KAAK,EAAGvB,WAAa;UACrBsB,QAAQ,EAAGrB;QAAgB,CAC3B;MAAC,CACa,CAChB,EACCa,iBAAiB,iBAClB7D,IAAA,CAACvB,cAAc;QACdwG,QAAQ,EAAGA,CAAA,KAAM,CAAC,CAAEzD,OAAO,EAAEqB,MAAQ;QACrCqB,KAAK,EAAGxF,EAAE,CAAE,SAAU,CAAG;QACzB0G,UAAU,EAAGA,CAAA,KAAM3E,QAAQ,CAAE;UAAEe,OAAO,EAAE;QAAG,CAAE,CAAG;QAAAuC,QAAA,eAEhD/D,IAAA,CAACb,aAAa;UACbqC,OAAO,EAAGA,OAAS;UACnBJ,QAAQ,EAAGA,QAAU;UACrBiD,QAAQ,EAAG5D;QAAU,CACrB;MAAC,CACa,CAChB;IAAA,CACU,CACZ;EAAA,CACA,CAAC;AAEL","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["PanelBody","TextControl","SelectControl","RangeControl","ToggleControl","Notice","__experimentalToolsPanel","ToolsPanel","__experimentalToolsPanelItem","ToolsPanelItem","__","privateApis","blockEditorPrivateApis","debounce","useEffect","useState","useCallback","OrderControl","AuthorControl","ParentControl","TaxonomyControls","StickyControl","EnhancedPaginationControl","CreateNewPostLink","unlock","usePostTypes","useIsPostTypeHierarchical","useAllowedControls","isControlAllowed","useTaxonomies","useToolsPanelDropdownMenuProps","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","BlockInfo","QueryInspectorControls","props","attributes","setQuery","setDisplayLayout","setAttributes","clientId","query","displayLayout","enhancedPagination","order","orderBy","author","authorIds","postType","sticky","inherit","taxQuery","parents","allowedControls","showSticky","setShowSticky","postTypesTaxonomiesMap","postTypesSelectOptions","taxonomies","isPostTypeHierarchical","onPostTypeChange","newValue","updateQuery","supportedTaxonomies","updatedTaxQuery","Object","entries","reduce","accumulator","taxonomySlug","terms","includes","keys","length","undefined","querySearch","setQuerySearch","search","onChangeDebounced","cancel","showInheritControl","showPostTypeControl","showColumnsControl","showOrderControl","showStickyControl","showSettingsPanel","showTaxControl","showAuthorControl","showSearchControl","showParentControl","showFiltersPanel","dropdownMenuProps","children","title","__nextHasNoMarginBottom","label","help","checked","onChange","value","options","columns","min","max","Math","status","isDismissible","className","resetAll","hasValue","values","some","onDeselect"],"sources":["@wordpress/block-library/src/query/edit/inspector-controls/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tPanelBody,\n\tTextControl,\n\tSelectControl,\n\tRangeControl,\n\tToggleControl,\n\tNotice,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\nimport { debounce } from '@wordpress/compose';\nimport { useEffect, useState, useCallback } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport OrderControl from './order-control';\nimport AuthorControl from './author-control';\nimport ParentControl from './parent-control';\nimport { TaxonomyControls } from './taxonomy-controls';\nimport StickyControl from './sticky-control';\nimport EnhancedPaginationControl from './enhanced-pagination-control';\nimport CreateNewPostLink from './create-new-post-link';\nimport { unlock } from '../../../lock-unlock';\nimport {\n\tusePostTypes,\n\tuseIsPostTypeHierarchical,\n\tuseAllowedControls,\n\tisControlAllowed,\n\tuseTaxonomies,\n} from '../../utils';\nimport { useToolsPanelDropdownMenuProps } from '../../../utils/hooks';\n\nconst { BlockInfo } = unlock( blockEditorPrivateApis );\n\nexport default function QueryInspectorControls( props ) {\n\tconst { attributes, setQuery, setDisplayLayout, setAttributes, clientId } =\n\t\tprops;\n\tconst { query, displayLayout, enhancedPagination } = attributes;\n\tconst {\n\t\torder,\n\t\torderBy,\n\t\tauthor: authorIds,\n\t\tpostType,\n\t\tsticky,\n\t\tinherit,\n\t\ttaxQuery,\n\t\tparents,\n\t} = query;\n\tconst allowedControls = useAllowedControls( attributes );\n\tconst [ showSticky, setShowSticky ] = useState( postType === 'post' );\n\tconst { postTypesTaxonomiesMap, postTypesSelectOptions } = usePostTypes();\n\tconst taxonomies = useTaxonomies( postType );\n\tconst isPostTypeHierarchical = useIsPostTypeHierarchical( postType );\n\tuseEffect( () => {\n\t\tsetShowSticky( postType === 'post' );\n\t}, [ postType ] );\n\tconst onPostTypeChange = ( newValue ) => {\n\t\tconst updateQuery = { postType: newValue };\n\t\t// We need to dynamically update the `taxQuery` property,\n\t\t// by removing any not supported taxonomy from the query.\n\t\tconst supportedTaxonomies = postTypesTaxonomiesMap[ newValue ];\n\t\tconst updatedTaxQuery = Object.entries( taxQuery || {} ).reduce(\n\t\t\t( accumulator, [ taxonomySlug, terms ] ) => {\n\t\t\t\tif ( supportedTaxonomies.includes( taxonomySlug ) ) {\n\t\t\t\t\taccumulator[ taxonomySlug ] = terms;\n\t\t\t\t}\n\t\t\t\treturn accumulator;\n\t\t\t},\n\t\t\t{}\n\t\t);\n\t\tupdateQuery.taxQuery = !! Object.keys( updatedTaxQuery ).length\n\t\t\t? updatedTaxQuery\n\t\t\t: undefined;\n\n\t\tif ( newValue !== 'post' ) {\n\t\t\tupdateQuery.sticky = '';\n\t\t}\n\t\t// We need to reset `parents` because they are tied to each post type.\n\t\tupdateQuery.parents = [];\n\t\tsetQuery( updateQuery );\n\t};\n\tconst [ querySearch, setQuerySearch ] = useState( query.search );\n\tconst onChangeDebounced = useCallback(\n\t\tdebounce( () => {\n\t\t\tif ( query.search !== querySearch ) {\n\t\t\t\tsetQuery( { search: querySearch } );\n\t\t\t}\n\t\t}, 250 ),\n\t\t[ querySearch, query.search ]\n\t);\n\tuseEffect( () => {\n\t\tonChangeDebounced();\n\t\treturn onChangeDebounced.cancel;\n\t}, [ querySearch, onChangeDebounced ] );\n\tconst showInheritControl = isControlAllowed( allowedControls, 'inherit' );\n\tconst showPostTypeControl =\n\t\t! inherit && isControlAllowed( allowedControls, 'postType' );\n\tconst showColumnsControl = false;\n\tconst showOrderControl =\n\t\t! inherit && isControlAllowed( allowedControls, 'order' );\n\tconst showStickyControl =\n\t\t! inherit &&\n\t\tshowSticky &&\n\t\tisControlAllowed( allowedControls, 'sticky' );\n\tconst showSettingsPanel =\n\t\tshowInheritControl ||\n\t\tshowPostTypeControl ||\n\t\tshowColumnsControl ||\n\t\tshowOrderControl ||\n\t\tshowStickyControl;\n\tconst showTaxControl =\n\t\t!! taxonomies?.length &&\n\t\tisControlAllowed( allowedControls, 'taxQuery' );\n\tconst showAuthorControl = isControlAllowed( allowedControls, 'author' );\n\tconst showSearchControl = isControlAllowed( allowedControls, 'search' );\n\tconst showParentControl =\n\t\tisControlAllowed( allowedControls, 'parents' ) &&\n\t\tisPostTypeHierarchical;\n\n\tconst showFiltersPanel =\n\t\tshowTaxControl ||\n\t\tshowAuthorControl ||\n\t\tshowSearchControl ||\n\t\tshowParentControl;\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\treturn (\n\t\t<>\n\t\t\t<BlockInfo>\n\t\t\t\t<CreateNewPostLink { ...props } />\n\t\t\t</BlockInfo>\n\t\t\t{ showSettingsPanel && (\n\t\t\t\t<PanelBody title={ __( 'Settings' ) }>\n\t\t\t\t\t{ showInheritControl && (\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\tlabel={ __( 'Inherit query from template' ) }\n\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t'Toggle to use the global query context that is set with the current template, such as an archive or search. Disable to customize the settings independently.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tchecked={ !! inherit }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tsetQuery( { inherit: !! value } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t{ showPostTypeControl && (\n\t\t\t\t\t\t<SelectControl\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\toptions={ postTypesSelectOptions }\n\t\t\t\t\t\t\tvalue={ postType }\n\t\t\t\t\t\t\tlabel={ __( 'Post type' ) }\n\t\t\t\t\t\t\tonChange={ onPostTypeChange }\n\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t'WordPress contains different types of content and they are divided into collections called “Post types”. By default there are a few different ones such as blog posts and pages, but plugins could add more.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t{ showColumnsControl && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<RangeControl\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\tlabel={ __( 'Columns' ) }\n\t\t\t\t\t\t\t\tvalue={ displayLayout.columns }\n\t\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\t\tsetDisplayLayout( {\n\t\t\t\t\t\t\t\t\t\tcolumns: value,\n\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tmin={ 2 }\n\t\t\t\t\t\t\t\tmax={ Math.max( 6, displayLayout.columns ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t{ displayLayout.columns > 6 && (\n\t\t\t\t\t\t\t\t<Notice\n\t\t\t\t\t\t\t\t\tstatus=\"warning\"\n\t\t\t\t\t\t\t\t\tisDismissible={ false }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t'This column count exceeds the recommended amount and may cause visual breakage.'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</Notice>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\t\t\t\t\t{ showOrderControl && (\n\t\t\t\t\t\t<OrderControl\n\t\t\t\t\t\t\t{ ...{ order, orderBy } }\n\t\t\t\t\t\t\tonChange={ setQuery }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t{ showStickyControl && (\n\t\t\t\t\t\t<StickyControl\n\t\t\t\t\t\t\tvalue={ sticky }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tsetQuery( { sticky: value } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t<EnhancedPaginationControl\n\t\t\t\t\t\tenhancedPagination={ enhancedPagination }\n\t\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t/>\n\t\t\t\t</PanelBody>\n\t\t\t) }\n\t\t\t{ ! inherit && showFiltersPanel && (\n\t\t\t\t<ToolsPanel\n\t\t\t\t\tclassName=\"block-library-query-toolspanel__filters\"\n\t\t\t\t\tlabel={ __( 'Filters' ) }\n\t\t\t\t\tresetAll={ () => {\n\t\t\t\t\t\tsetQuery( {\n\t\t\t\t\t\t\tauthor: '',\n\t\t\t\t\t\t\tparents: [],\n\t\t\t\t\t\t\tsearch: '',\n\t\t\t\t\t\t\ttaxQuery: null,\n\t\t\t\t\t\t} );\n\t\t\t\t\t\tsetQuerySearch( '' );\n\t\t\t\t\t} }\n\t\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t\t>\n\t\t\t\t\t{ showTaxControl && (\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\tlabel={ __( 'Taxonomies' ) }\n\t\t\t\t\t\t\thasValue={ () =>\n\t\t\t\t\t\t\t\tObject.values( taxQuery || {} ).some(\n\t\t\t\t\t\t\t\t\t( terms ) => !! terms.length\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tonDeselect={ () => setQuery( { taxQuery: null } ) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<TaxonomyControls\n\t\t\t\t\t\t\t\tonChange={ setQuery }\n\t\t\t\t\t\t\t\tquery={ query }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t) }\n\t\t\t\t\t{ showAuthorControl && (\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\thasValue={ () => !! authorIds }\n\t\t\t\t\t\t\tlabel={ __( 'Authors' ) }\n\t\t\t\t\t\t\tonDeselect={ () => setQuery( { author: '' } ) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<AuthorControl\n\t\t\t\t\t\t\t\tvalue={ authorIds }\n\t\t\t\t\t\t\t\tonChange={ setQuery }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t) }\n\t\t\t\t\t{ showSearchControl && (\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\thasValue={ () => !! querySearch }\n\t\t\t\t\t\t\tlabel={ __( 'Keyword' ) }\n\t\t\t\t\t\t\tonDeselect={ () => setQuerySearch( '' ) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\tlabel={ __( 'Keyword' ) }\n\t\t\t\t\t\t\t\tvalue={ querySearch }\n\t\t\t\t\t\t\t\tonChange={ setQuerySearch }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t) }\n\t\t\t\t\t{ showParentControl && (\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\thasValue={ () => !! parents?.length }\n\t\t\t\t\t\t\tlabel={ __( 'Parents' ) }\n\t\t\t\t\t\t\tonDeselect={ () => setQuery( { parents: [] } ) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<ParentControl\n\t\t\t\t\t\t\t\tparents={ parents }\n\t\t\t\t\t\t\t\tpostType={ postType }\n\t\t\t\t\t\t\t\tonChange={ setQuery }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t) }\n\t\t\t\t</ToolsPanel>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SACCA,SAAS,EACTC,WAAW,EACXC,aAAa,EACbC,YAAY,EACZC,aAAa,EACbC,MAAM,EACNC,wBAAwB,IAAIC,UAAU,EACtCC,4BAA4B,IAAIC,cAAc,QACxC,uBAAuB;AAC9B,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,WAAW,IAAIC,sBAAsB,QAAQ,yBAAyB;AAC/E,SAASC,QAAQ,QAAQ,oBAAoB;AAC7C,SAASC,SAAS,EAAEC,QAAQ,EAAEC,WAAW,QAAQ,oBAAoB;;AAErE;AACA;AACA;AACA,OAAOC,YAAY,MAAM,iBAAiB;AAC1C,OAAOC,aAAa,MAAM,kBAAkB;AAC5C,OAAOC,aAAa,MAAM,kBAAkB;AAC5C,SAASC,gBAAgB,QAAQ,qBAAqB;AACtD,OAAOC,aAAa,MAAM,kBAAkB;AAC5C,OAAOC,yBAAyB,MAAM,+BAA+B;AACrE,OAAOC,iBAAiB,MAAM,wBAAwB;AACtD,SAASC,MAAM,QAAQ,sBAAsB;AAC7C,SACCC,YAAY,EACZC,yBAAyB,EACzBC,kBAAkB,EAClBC,gBAAgB,EAChBC,aAAa,QACP,aAAa;AACpB,SAASC,8BAA8B,QAAQ,sBAAsB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,QAAA,IAAAC,SAAA;AAAA,SAA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A,CAACd,aAAa;UACbqF,KAAK,EAAGpD,SAAW;UACnBmD,QAAQ,EAAG7D;QAAU,CACrB;MAAC,CACa,CAChB,EACCmD,iBAAiB,iBAClB5D,IAAA,CAACvB,cAAc;QACdwG,QAAQ,EAAGA,CAAA,KAAM,CAAC,CAAElC,WAAa;QACjCoB,KAAK,EAAGzF,EAAE,CAAE,SAAU,CAAG;QACzB0G,UAAU,EAAGA,CAAA,KAAMpC,cAAc,CAAE,EAAG,CAAG;QAAAgB,QAAA,eAEzChE,IAAA,CAAC/B,WAAW;UACXiG,uBAAuB;UACvBC,KAAK,EAAGzF,EAAE,CAAE,SAAU,CAAG;UACzB6F,KAAK,EAAGxB,WAAa;UACrBuB,QAAQ,EAAGtB;QAAgB,CAC3B;MAAC,CACa,CAChB,EACCa,iBAAiB,iBAClB7D,IAAA,CAACvB,cAAc;QACdwG,QAAQ,EAAGA,CAAA,KAAM,CAAC,CAAEzD,OAAO,EAAEqB,MAAQ;QACrCsB,KAAK,EAAGzF,EAAE,CAAE,SAAU,CAAG;QACzB0G,UAAU,EAAGA,CAAA,KAAM3E,QAAQ,CAAE;UAAEe,OAAO,EAAE;QAAG,CAAE,CAAG;QAAAwC,QAAA,eAEhDhE,IAAA,CAACb,aAAa;UACbqC,OAAO,EAAGA,OAAS;UACnBJ,QAAQ,EAAGA,QAAU;UACrBkD,QAAQ,EAAG7D;QAAU,CACrB;MAAC,CACa,CAChB;IAAA,CACU,CACZ;EAAA,CACA,CAAC;AAEL","ignoreList":[]}
|
|
@@ -6,6 +6,7 @@ import { useLayoutEffect, useEffect, useRef } from '@wordpress/element';
|
|
|
6
6
|
import { getBlobByURL, isBlobURL, revokeBlobURL } from '@wordpress/blob';
|
|
7
7
|
import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
8
8
|
import { store as coreStore } from '@wordpress/core-data';
|
|
9
|
+
import { useViewportMatch } from '@wordpress/compose';
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* Returns whether the current user can edit the given entity.
|
|
@@ -78,4 +79,14 @@ export function useUploadMediaFromBlobURL(args = {}) {
|
|
|
78
79
|
});
|
|
79
80
|
}, [getSettings]);
|
|
80
81
|
}
|
|
82
|
+
export function useToolsPanelDropdownMenuProps() {
|
|
83
|
+
const isMobile = useViewportMatch('medium', '<');
|
|
84
|
+
return !isMobile ? {
|
|
85
|
+
popoverProps: {
|
|
86
|
+
placement: 'left-start',
|
|
87
|
+
// For non-mobile, inner sidebar width (248px) - button width (24px) - border (1px) + padding (16px) + spacing (20px)
|
|
88
|
+
offset: 259
|
|
89
|
+
}
|
|
90
|
+
} : {};
|
|
91
|
+
}
|
|
81
92
|
//# sourceMappingURL=hooks.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useSelect","useLayoutEffect","useEffect","useRef","getBlobByURL","isBlobURL","revokeBlobURL","store","blockEditorStore","coreStore","useCanEditEntity","kind","name","recordId","select","canUserEditEntityRecord","useUploadMediaFromBlobURL","args","latestArgs","hasUploadStarted","getSettings","current","url","file","allowedTypes","onChange","onError","mediaUpload","filesList","onFileChange","media","message"],"sources":["@wordpress/block-library/src/utils/hooks.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { useLayoutEffect, useEffect, useRef } from '@wordpress/element';\nimport { getBlobByURL, isBlobURL, revokeBlobURL } from '@wordpress/blob';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Returns whether the current user can edit the given entity.\n *\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {string} recordId Record's id.\n */\nexport function useCanEditEntity( kind, name, recordId ) {\n\treturn useSelect(\n\t\t( select ) =>\n\t\t\tselect( coreStore ).canUserEditEntityRecord( kind, name, recordId ),\n\t\t[ kind, name, recordId ]\n\t);\n}\n\n/**\n * Handles uploading a media file from a blob URL on mount.\n *\n * @param {Object} args Upload media arguments.\n * @param {string} args.url Blob URL.\n * @param {?Array} args.allowedTypes Array of allowed media types.\n * @param {Function} args.onChange Function called when the media is uploaded.\n * @param {Function} args.onError Function called when an error happens.\n */\nexport function useUploadMediaFromBlobURL( args = {} ) {\n\tconst latestArgs = useRef( args );\n\tconst hasUploadStarted = useRef( false );\n\tconst { getSettings } = useSelect( blockEditorStore );\n\n\tuseLayoutEffect( () => {\n\t\tlatestArgs.current = args;\n\t} );\n\n\tuseEffect( () => {\n\t\t// Uploading is a special effect that can't be canceled via the cleanup method.\n\t\t// The extra check avoids duplicate uploads in development mode (React.StrictMode).\n\t\tif ( hasUploadStarted.current ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (\n\t\t\t! latestArgs.current.url ||\n\t\t\t! isBlobURL( latestArgs.current.url )\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst file = getBlobByURL( latestArgs.current.url );\n\t\tif ( ! file ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { url, allowedTypes, onChange, onError } = latestArgs.current;\n\t\tconst { mediaUpload } = getSettings();\n\n\t\thasUploadStarted.current = true;\n\n\t\tmediaUpload( {\n\t\t\tfilesList: [ file ],\n\t\t\tallowedTypes,\n\t\t\tonFileChange: ( [ media ] ) => {\n\t\t\t\tif ( isBlobURL( media?.url ) ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\trevokeBlobURL( url );\n\t\t\t\tonChange( media );\n\t\t\t\thasUploadStarted.current = false;\n\t\t\t},\n\t\t\tonError: ( message ) => {\n\t\t\t\trevokeBlobURL( url );\n\t\t\t\tonError( message );\n\t\t\t\thasUploadStarted.current = false;\n\t\t\t},\n\t\t} );\n\t}, [ getSettings ] );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,eAAe,EAAEC,SAAS,EAAEC,MAAM,QAAQ,oBAAoB;AACvE,SAASC,YAAY,EAAEC,SAAS,EAAEC,aAAa,QAAQ,iBAAiB;AACxE,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,yBAAyB;AACnE,SAASD,KAAK,IAAIE,SAAS,QAAQ,sBAAsB;;
|
|
1
|
+
{"version":3,"names":["useSelect","useLayoutEffect","useEffect","useRef","getBlobByURL","isBlobURL","revokeBlobURL","store","blockEditorStore","coreStore","useViewportMatch","useCanEditEntity","kind","name","recordId","select","canUserEditEntityRecord","useUploadMediaFromBlobURL","args","latestArgs","hasUploadStarted","getSettings","current","url","file","allowedTypes","onChange","onError","mediaUpload","filesList","onFileChange","media","message","useToolsPanelDropdownMenuProps","isMobile","popoverProps","placement","offset"],"sources":["@wordpress/block-library/src/utils/hooks.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { useLayoutEffect, useEffect, useRef } from '@wordpress/element';\nimport { getBlobByURL, isBlobURL, revokeBlobURL } from '@wordpress/blob';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useViewportMatch } from '@wordpress/compose';\n\n/**\n * Returns whether the current user can edit the given entity.\n *\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {string} recordId Record's id.\n */\nexport function useCanEditEntity( kind, name, recordId ) {\n\treturn useSelect(\n\t\t( select ) =>\n\t\t\tselect( coreStore ).canUserEditEntityRecord( kind, name, recordId ),\n\t\t[ kind, name, recordId ]\n\t);\n}\n\n/**\n * Handles uploading a media file from a blob URL on mount.\n *\n * @param {Object} args Upload media arguments.\n * @param {string} args.url Blob URL.\n * @param {?Array} args.allowedTypes Array of allowed media types.\n * @param {Function} args.onChange Function called when the media is uploaded.\n * @param {Function} args.onError Function called when an error happens.\n */\nexport function useUploadMediaFromBlobURL( args = {} ) {\n\tconst latestArgs = useRef( args );\n\tconst hasUploadStarted = useRef( false );\n\tconst { getSettings } = useSelect( blockEditorStore );\n\n\tuseLayoutEffect( () => {\n\t\tlatestArgs.current = args;\n\t} );\n\n\tuseEffect( () => {\n\t\t// Uploading is a special effect that can't be canceled via the cleanup method.\n\t\t// The extra check avoids duplicate uploads in development mode (React.StrictMode).\n\t\tif ( hasUploadStarted.current ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (\n\t\t\t! latestArgs.current.url ||\n\t\t\t! isBlobURL( latestArgs.current.url )\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst file = getBlobByURL( latestArgs.current.url );\n\t\tif ( ! file ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { url, allowedTypes, onChange, onError } = latestArgs.current;\n\t\tconst { mediaUpload } = getSettings();\n\n\t\thasUploadStarted.current = true;\n\n\t\tmediaUpload( {\n\t\t\tfilesList: [ file ],\n\t\t\tallowedTypes,\n\t\t\tonFileChange: ( [ media ] ) => {\n\t\t\t\tif ( isBlobURL( media?.url ) ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\trevokeBlobURL( url );\n\t\t\t\tonChange( media );\n\t\t\t\thasUploadStarted.current = false;\n\t\t\t},\n\t\t\tonError: ( message ) => {\n\t\t\t\trevokeBlobURL( url );\n\t\t\t\tonError( message );\n\t\t\t\thasUploadStarted.current = false;\n\t\t\t},\n\t\t} );\n\t}, [ getSettings ] );\n}\n\nexport function useToolsPanelDropdownMenuProps() {\n\tconst isMobile = useViewportMatch( 'medium', '<' );\n\treturn ! isMobile\n\t\t? {\n\t\t\t\tpopoverProps: {\n\t\t\t\t\tplacement: 'left-start',\n\t\t\t\t\t// For non-mobile, inner sidebar width (248px) - button width (24px) - border (1px) + padding (16px) + spacing (20px)\n\t\t\t\t\toffset: 259,\n\t\t\t\t},\n\t\t }\n\t\t: {};\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,eAAe,EAAEC,SAAS,EAAEC,MAAM,QAAQ,oBAAoB;AACvE,SAASC,YAAY,EAAEC,SAAS,EAAEC,aAAa,QAAQ,iBAAiB;AACxE,SAASC,KAAK,IAAIC,gBAAgB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AGP,WAAW,CAAC,CAAC;IAErCD,gBAAgB,CAACE,OAAO,GAAG,IAAI;IAE/BM,WAAW,CAAE;MACZC,SAAS,EAAE,CAAEL,IAAI,CAAE;MACnBC,YAAY;MACZK,YAAY,EAAEA,CAAE,CAAEC,KAAK,CAAE,KAAM;QAC9B,IAAK1B,SAAS,CAAE0B,KAAK,EAAER,GAAI,CAAC,EAAG;UAC9B;QACD;QAEAjB,aAAa,CAAEiB,GAAI,CAAC;QACpBG,QAAQ,CAAEK,KAAM,CAAC;QACjBX,gBAAgB,CAACE,OAAO,GAAG,KAAK;MACjC,CAAC;MACDK,OAAO,EAAIK,OAAO,IAAM;QACvB1B,aAAa,CAAEiB,GAAI,CAAC;QACpBI,OAAO,CAAEK,OAAQ,CAAC;QAClBZ,gBAAgB,CAACE,OAAO,GAAG,KAAK;MACjC;IACD,CAAE,CAAC;EACJ,CAAC,EAAE,CAAED,WAAW,CAAG,CAAC;AACrB;AAEA,OAAO,SAASY,8BAA8BA,CAAA,EAAG;EAChD,MAAMC,QAAQ,GAAGxB,gBAAgB,CAAE,QAAQ,EAAE,GAAI,CAAC;EAClD,OAAO,CAAEwB,QAAQ,GACd;IACAC,YAAY,EAAE;MACbC,SAAS,EAAE,YAAY;MACvB;MACAC,MAAM,EAAE;IACT;EACA,CAAC,GACD,CAAC,CAAC;AACN","ignoreList":[]}
|
|
@@ -86,12 +86,12 @@
|
|
|
86
86
|
/**
|
|
87
87
|
* Reset the WP Admin page styles for Gutenberg-like pages.
|
|
88
88
|
*/
|
|
89
|
-
.wp-block-audio figcaption {
|
|
89
|
+
.wp-block-audio :where(figcaption) {
|
|
90
90
|
color: #555;
|
|
91
91
|
font-size: 13px;
|
|
92
92
|
text-align: center;
|
|
93
93
|
}
|
|
94
|
-
.is-dark-theme .wp-block-audio figcaption {
|
|
94
|
+
.is-dark-theme .wp-block-audio :where(figcaption) {
|
|
95
95
|
color: rgba(255, 255, 255, 0.65);
|
|
96
96
|
}
|
|
97
97
|
|
|
@@ -86,12 +86,12 @@
|
|
|
86
86
|
/**
|
|
87
87
|
* Reset the WP Admin page styles for Gutenberg-like pages.
|
|
88
88
|
*/
|
|
89
|
-
.wp-block-audio figcaption {
|
|
89
|
+
.wp-block-audio :where(figcaption) {
|
|
90
90
|
color: #555;
|
|
91
91
|
font-size: 13px;
|
|
92
92
|
text-align: center;
|
|
93
93
|
}
|
|
94
|
-
.is-dark-theme .wp-block-audio figcaption {
|
|
94
|
+
.is-dark-theme .wp-block-audio :where(figcaption) {
|
|
95
95
|
color: rgba(255, 255, 255, 0.65);
|
|
96
96
|
}
|
|
97
97
|
|
|
@@ -1359,18 +1359,6 @@ figure.wp-block-image:not(.wp-block) {
|
|
|
1359
1359
|
overflow: visible !important;
|
|
1360
1360
|
}
|
|
1361
1361
|
|
|
1362
|
-
.wp-block-image__aspect-ratio {
|
|
1363
|
-
height: 46px;
|
|
1364
|
-
margin-bottom: -8px;
|
|
1365
|
-
display: flex;
|
|
1366
|
-
align-items: center;
|
|
1367
|
-
}
|
|
1368
|
-
.wp-block-image__aspect-ratio .components-button {
|
|
1369
|
-
width: 36px;
|
|
1370
|
-
padding-right: 0;
|
|
1371
|
-
padding-left: 0;
|
|
1372
|
-
}
|
|
1373
|
-
|
|
1374
1362
|
.wp-block-image__toolbar_content_textarea {
|
|
1375
1363
|
width: 250px;
|
|
1376
1364
|
}
|
package/build-style/editor.css
CHANGED
|
@@ -1368,18 +1368,6 @@ figure.wp-block-image:not(.wp-block) {
|
|
|
1368
1368
|
overflow: visible !important;
|
|
1369
1369
|
}
|
|
1370
1370
|
|
|
1371
|
-
.wp-block-image__aspect-ratio {
|
|
1372
|
-
height: 46px;
|
|
1373
|
-
margin-bottom: -8px;
|
|
1374
|
-
display: flex;
|
|
1375
|
-
align-items: center;
|
|
1376
|
-
}
|
|
1377
|
-
.wp-block-image__aspect-ratio .components-button {
|
|
1378
|
-
width: 36px;
|
|
1379
|
-
padding-left: 0;
|
|
1380
|
-
padding-right: 0;
|
|
1381
|
-
}
|
|
1382
|
-
|
|
1383
1371
|
.wp-block-image__toolbar_content_textarea {
|
|
1384
1372
|
width: 250px;
|
|
1385
1373
|
}
|
|
@@ -86,12 +86,12 @@
|
|
|
86
86
|
/**
|
|
87
87
|
* Reset the WP Admin page styles for Gutenberg-like pages.
|
|
88
88
|
*/
|
|
89
|
-
.wp-block-embed figcaption {
|
|
89
|
+
.wp-block-embed :where(figcaption) {
|
|
90
90
|
color: #555;
|
|
91
91
|
font-size: 13px;
|
|
92
92
|
text-align: center;
|
|
93
93
|
}
|
|
94
|
-
.is-dark-theme .wp-block-embed figcaption {
|
|
94
|
+
.is-dark-theme .wp-block-embed :where(figcaption) {
|
|
95
95
|
color: rgba(255, 255, 255, 0.65);
|
|
96
96
|
}
|
|
97
97
|
|
|
@@ -86,12 +86,12 @@
|
|
|
86
86
|
/**
|
|
87
87
|
* Reset the WP Admin page styles for Gutenberg-like pages.
|
|
88
88
|
*/
|
|
89
|
-
.wp-block-embed figcaption {
|
|
89
|
+
.wp-block-embed :where(figcaption) {
|
|
90
90
|
color: #555;
|
|
91
91
|
font-size: 13px;
|
|
92
92
|
text-align: center;
|
|
93
93
|
}
|
|
94
|
-
.is-dark-theme .wp-block-embed figcaption {
|
|
94
|
+
.is-dark-theme .wp-block-embed :where(figcaption) {
|
|
95
95
|
color: rgba(255, 255, 255, 0.65);
|
|
96
96
|
}
|
|
97
97
|
|
|
@@ -224,18 +224,6 @@ figure.wp-block-image:not(.wp-block) {
|
|
|
224
224
|
overflow: visible !important;
|
|
225
225
|
}
|
|
226
226
|
|
|
227
|
-
.wp-block-image__aspect-ratio {
|
|
228
|
-
height: 46px;
|
|
229
|
-
margin-bottom: -8px;
|
|
230
|
-
display: flex;
|
|
231
|
-
align-items: center;
|
|
232
|
-
}
|
|
233
|
-
.wp-block-image__aspect-ratio .components-button {
|
|
234
|
-
width: 36px;
|
|
235
|
-
padding-right: 0;
|
|
236
|
-
padding-left: 0;
|
|
237
|
-
}
|
|
238
|
-
|
|
239
227
|
.wp-block-image__toolbar_content_textarea {
|
|
240
228
|
width: 250px;
|
|
241
229
|
}
|
|
@@ -224,18 +224,6 @@ figure.wp-block-image:not(.wp-block) {
|
|
|
224
224
|
overflow: visible !important;
|
|
225
225
|
}
|
|
226
226
|
|
|
227
|
-
.wp-block-image__aspect-ratio {
|
|
228
|
-
height: 46px;
|
|
229
|
-
margin-bottom: -8px;
|
|
230
|
-
display: flex;
|
|
231
|
-
align-items: center;
|
|
232
|
-
}
|
|
233
|
-
.wp-block-image__aspect-ratio .components-button {
|
|
234
|
-
width: 36px;
|
|
235
|
-
padding-left: 0;
|
|
236
|
-
padding-right: 0;
|
|
237
|
-
}
|
|
238
|
-
|
|
239
227
|
.wp-block-image__toolbar_content_textarea {
|
|
240
228
|
width: 250px;
|
|
241
229
|
}
|
|
@@ -92,11 +92,7 @@
|
|
|
92
92
|
* These are only output in the editor, but styles here are prefixed .editor-styles-wrapper and affect the theming
|
|
93
93
|
* of the editor by themes.
|
|
94
94
|
*/
|
|
95
|
-
:where(.editor-styles-wrapper) {
|
|
96
|
-
/**
|
|
97
|
-
* The following styles revert to the browser defaults overriding the WPAdmin styles.
|
|
98
|
-
* This is only needed while the block editor is not being loaded in an iframe.
|
|
99
|
-
*/
|
|
95
|
+
html :where(.editor-styles-wrapper) {
|
|
100
96
|
font-family: serif;
|
|
101
97
|
font-size: initial;
|
|
102
98
|
line-height: initial;
|
package/build-style/reset.css
CHANGED
|
@@ -92,11 +92,7 @@
|
|
|
92
92
|
* These are only output in the editor, but styles here are prefixed .editor-styles-wrapper and affect the theming
|
|
93
93
|
* of the editor by themes.
|
|
94
94
|
*/
|
|
95
|
-
:where(.editor-styles-wrapper) {
|
|
96
|
-
/**
|
|
97
|
-
* The following styles revert to the browser defaults overriding the WPAdmin styles.
|
|
98
|
-
* This is only needed while the block editor is not being loaded in an iframe.
|
|
99
|
-
*/
|
|
95
|
+
html :where(.editor-styles-wrapper) {
|
|
100
96
|
font-family: serif;
|
|
101
97
|
font-size: initial;
|
|
102
98
|
line-height: initial;
|