@wordpress/edit-site 6.11.0 → 6.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/build/components/app/index.js +0 -2
- package/build/components/app/index.js.map +1 -1
- package/build/components/block-editor/use-editor-iframe-props.js +6 -8
- package/build/components/block-editor/use-editor-iframe-props.js.map +1 -1
- package/build/components/editor/index.js +9 -4
- package/build/components/editor/index.js.map +1 -1
- package/build/components/editor/use-editor-title.js +29 -12
- package/build/components/editor/use-editor-title.js.map +1 -1
- package/build/components/global-styles/screen-revisions/revisions-buttons.js +24 -22
- package/build/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
- package/build/components/global-styles/shadows-edit-panel.js +2 -3
- package/build/components/global-styles/shadows-edit-panel.js.map +1 -1
- package/build/components/global-styles/ui.js +42 -2
- package/build/components/global-styles/ui.js.map +1 -1
- package/build/components/global-styles-renderer/index.js +6 -8
- package/build/components/global-styles-renderer/index.js.map +1 -1
- package/build/components/layout/hooks.js +1 -10
- package/build/components/layout/hooks.js.map +1 -1
- package/build/components/layout/index.js +1 -0
- package/build/components/layout/index.js.map +1 -1
- package/build/components/page-patterns/fields.js +3 -7
- package/build/components/page-patterns/fields.js.map +1 -1
- package/build/components/page-templates/fields.js +1 -2
- package/build/components/page-templates/fields.js.map +1 -1
- package/build/components/post-edit/index.js +14 -8
- package/build/components/post-edit/index.js.map +1 -1
- package/build/components/post-fields/index.js +3 -197
- package/build/components/post-fields/index.js.map +1 -1
- package/build/components/post-list/index.js +11 -1
- package/build/components/post-list/index.js.map +1 -1
- package/build/components/sidebar/index.js +11 -3
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar-global-styles-wrapper/index.js +129 -0
- package/build/components/sidebar-global-styles-wrapper/index.js.map +1 -0
- package/build/components/sidebar-navigation-screen-global-styles/index.js +14 -72
- package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-main/index.js +43 -42
- package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build/components/site-editor-routes/styles-edit.js +6 -1
- package/build/components/site-editor-routes/styles-edit.js.map +1 -1
- package/build/components/site-editor-routes/styles-view.js +8 -2
- package/build/components/site-editor-routes/styles-view.js.map +1 -1
- package/build/components/site-hub/index.js +19 -6
- package/build/components/site-hub/index.js.map +1 -1
- package/build/components/style-book/constants.js +10 -3
- package/build/components/style-book/constants.js.map +1 -1
- package/build/components/style-book/examples.js +71 -1
- package/build/components/style-book/examples.js.map +1 -1
- package/build/components/style-book/index.js +70 -11
- package/build/components/style-book/index.js.map +1 -1
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +32 -32
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build/components/welcome-guide/index.js +4 -2
- package/build/components/welcome-guide/index.js.map +1 -1
- package/build/components/welcome-guide/page.js +1 -9
- package/build/components/welcome-guide/page.js.map +1 -1
- package/build/components/welcome-guide/template.js +1 -12
- package/build/components/welcome-guide/template.js.map +1 -1
- package/build/hooks/commands/use-common-commands.js +15 -15
- package/build/hooks/commands/use-common-commands.js.map +1 -1
- package/build/index.js +1 -0
- package/build/index.js.map +1 -1
- package/build/posts.js +1 -0
- package/build/posts.js.map +1 -1
- package/build-module/components/app/index.js +0 -2
- package/build-module/components/app/index.js.map +1 -1
- package/build-module/components/block-editor/use-editor-iframe-props.js +6 -8
- package/build-module/components/block-editor/use-editor-iframe-props.js.map +1 -1
- package/build-module/components/editor/index.js +9 -4
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/editor/use-editor-title.js +29 -12
- package/build-module/components/editor/use-editor-title.js.map +1 -1
- package/build-module/components/global-styles/screen-revisions/revisions-buttons.js +25 -23
- package/build-module/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
- package/build-module/components/global-styles/shadows-edit-panel.js +2 -3
- package/build-module/components/global-styles/shadows-edit-panel.js.map +1 -1
- package/build-module/components/global-styles/ui.js +43 -3
- package/build-module/components/global-styles/ui.js.map +1 -1
- package/build-module/components/global-styles-renderer/index.js +6 -8
- package/build-module/components/global-styles-renderer/index.js.map +1 -1
- package/build-module/components/layout/hooks.js +1 -9
- package/build-module/components/layout/hooks.js.map +1 -1
- package/build-module/components/layout/index.js +1 -0
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/page-patterns/fields.js +4 -8
- package/build-module/components/page-patterns/fields.js.map +1 -1
- package/build-module/components/page-templates/fields.js +1 -2
- package/build-module/components/page-templates/fields.js.map +1 -1
- package/build-module/components/post-edit/index.js +14 -8
- package/build-module/components/post-edit/index.js.map +1 -1
- package/build-module/components/post-fields/index.js +7 -202
- package/build-module/components/post-fields/index.js.map +1 -1
- package/build-module/components/post-list/index.js +11 -1
- package/build-module/components/post-list/index.js.map +1 -1
- package/build-module/components/sidebar/index.js +11 -3
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar-global-styles-wrapper/index.js +121 -0
- package/build-module/components/sidebar-global-styles-wrapper/index.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js +15 -73
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-main/index.js +43 -43
- package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build-module/components/site-editor-routes/styles-edit.js +6 -1
- package/build-module/components/site-editor-routes/styles-edit.js.map +1 -1
- package/build-module/components/site-editor-routes/styles-view.js +8 -2
- package/build-module/components/site-editor-routes/styles-view.js.map +1 -1
- package/build-module/components/site-hub/index.js +19 -6
- package/build-module/components/site-hub/index.js.map +1 -1
- package/build-module/components/style-book/constants.js +10 -3
- package/build-module/components/style-book/constants.js.map +1 -1
- package/build-module/components/style-book/examples.js +71 -1
- package/build-module/components/style-book/examples.js.map +1 -1
- package/build-module/components/style-book/index.js +71 -12
- package/build-module/components/style-book/index.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +32 -32
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build-module/components/welcome-guide/index.js +4 -2
- package/build-module/components/welcome-guide/index.js.map +1 -1
- package/build-module/components/welcome-guide/page.js +1 -9
- package/build-module/components/welcome-guide/page.js.map +1 -1
- package/build-module/components/welcome-guide/template.js +1 -11
- package/build-module/components/welcome-guide/template.js.map +1 -1
- package/build-module/hooks/commands/use-common-commands.js +15 -15
- package/build-module/hooks/commands/use-common-commands.js.map +1 -1
- package/build-module/index.js +1 -0
- package/build-module/index.js.map +1 -1
- package/build-module/posts.js +1 -0
- package/build-module/posts.js.map +1 -1
- package/build-style/posts-rtl.css +54 -5
- package/build-style/posts.css +54 -5
- package/build-style/style-rtl.css +109 -28
- package/build-style/style.css +109 -28
- package/package.json +3 -4
- package/src/components/app/index.js +0 -2
- package/src/components/block-editor/use-editor-iframe-props.js +2 -3
- package/src/components/editor/index.js +16 -4
- package/src/components/editor/use-editor-title.js +37 -13
- package/src/components/editor-canvas-container/style.scss +0 -1
- package/src/components/global-styles/screen-revisions/revisions-buttons.js +28 -31
- package/src/components/global-styles/screen-revisions/style.scss +11 -17
- package/src/components/global-styles/shadows-edit-panel.js +4 -2
- package/src/components/global-styles/ui.js +42 -2
- package/src/components/global-styles-renderer/index.js +4 -10
- package/src/components/layout/hooks.js +1 -7
- package/src/components/layout/index.js +6 -1
- package/src/components/page-patterns/fields.js +6 -12
- package/src/components/page-patterns/style.scss +0 -5
- package/src/components/page-templates/fields.js +2 -3
- package/src/components/post-edit/index.js +38 -30
- package/src/components/post-edit/style.scss +7 -0
- package/src/components/post-fields/index.js +19 -273
- package/src/components/post-list/index.js +9 -3
- package/src/components/post-list/style.scss +29 -3
- package/src/components/sidebar/index.js +23 -7
- package/src/components/sidebar-global-styles-wrapper/index.js +150 -0
- package/src/components/sidebar-global-styles-wrapper/style.scss +35 -0
- package/src/components/sidebar-navigation-item/style.scss +2 -2
- package/src/components/sidebar-navigation-screen-global-styles/index.js +13 -88
- package/src/components/sidebar-navigation-screen-main/index.js +46 -45
- package/src/components/site-editor-routes/styles-edit.js +10 -1
- package/src/components/site-editor-routes/styles-view.js +11 -1
- package/src/components/site-hub/index.js +33 -16
- package/src/components/site-icon/style.scss +16 -0
- package/src/components/style-book/constants.ts +11 -3
- package/src/components/style-book/examples.tsx +105 -1
- package/src/components/style-book/index.js +86 -8
- package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +54 -64
- package/src/components/welcome-guide/index.js +3 -3
- package/src/components/welcome-guide/page.js +1 -7
- package/src/components/welcome-guide/template.js +1 -8
- package/src/hooks/commands/use-common-commands.js +253 -246
- package/src/index.js +1 -0
- package/src/posts.js +1 -0
- package/src/style.scss +2 -3
- package/build/components/async/index.js +0 -51
- package/build/components/async/index.js.map +0 -1
- package/build/components/use-edited-entity-record/index.js +0 -60
- package/build/components/use-edited-entity-record/index.js.map +0 -1
- package/build/hooks/commands/use-edit-mode-commands.js +0 -179
- package/build/hooks/commands/use-edit-mode-commands.js.map +0 -1
- package/build-module/components/async/index.js +0 -44
- package/build-module/components/async/index.js.map +0 -1
- package/build-module/components/use-edited-entity-record/index.js +0 -53
- package/build-module/components/use-edited-entity-record/index.js.map +0 -1
- package/build-module/hooks/commands/use-edit-mode-commands.js +0 -171
- package/build-module/hooks/commands/use-edit-mode-commands.js.map +0 -1
- package/src/components/async/index.js +0 -43
- package/src/components/use-edited-entity-record/index.js +0 -58
- package/src/hooks/commands/use-edit-mode-commands.js +0 -168
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_components","require","_coreData","_element","_router","_data","_dataviews","_editor","_i18n","_icons","_page","_interopRequireDefault","_defaultViews","_constants","_addNewPost","_lockUnlock","_dataviewsActions","_compose","_postFields","_jsxRuntime","usePostActions","unlock","editorPrivateApis","useLocation","useHistory","routerPrivateApis","useEntityRecordsWithPermissions","coreDataPrivateApis","EMPTY_ARRAY","getDefaultView","defaultViews","activeView","find","slug","view","getCustomView","editedEntityRecord","content","undefined","JSON","parse","layout","defaultLayouts","type","useView","postType","params","isCustom","history","useDefaultViews","editEntityRecord","useDispatch","coreStore","useSelect","select","getEditedEntityRecord","Number","setView","useState","initialView","_getCustomView","LAYOUT_LIST","_getDefaultView","setViewWithUrlUpdate","useCallback","newView","getLocationWithParams","push","id","stringify","useEffect","prevView","DEFAULT_STATUSES","getItemId","item","toString","PostList","_postId$split","_data$map","_usePrevious","location","postId","quickEdit","selection","setSelection","split","onChangeSelection","items","_params$isCustom","join","getActiveViewFilters","views","match","_found$filters","found","filters","isLoading","isLoadingFields","fields","_fields","usePostFields","useMemo","activeViewFilters","map","field","elements","includes","queryArgs","forEach","filter","operator","OPERATOR_IS_ANY","status","value","author","OPERATOR_IS_NONE","author_exclude","per_page","perPage","page","_embed","order","sort","direction","orderby","search","records","isResolving","isLoadingData","totalItems","totalPages","data","filterSortAndPaginate","ids","record","prevIds","usePrevious","deletedIds","postIdWasDeleted","paginationInfo","labels","canCreateRecord","getPostType","canUser","kind","name","postTypeActions","context","editAction","useEditPostAction","actions","showAddPostModal","setShowAddPostModal","openModal","closeModal","handleNewPage","canvas","jsx","default","title","add_new_item","jsxs","Fragment","children","Button","variant","onClick","__next40pxDefaultSize","onSave","onClose","DataViews","onChangeView","header","window","__experimentalQuickEditDataViews","size","isPressed","icon","drawerRight","label","__"],"sources":["@wordpress/edit-site/src/components/post-list/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Button } from '@wordpress/components';\nimport {\n\tstore as coreStore,\n\tprivateApis as coreDataPrivateApis,\n} from '@wordpress/core-data';\nimport { useState, useMemo, useCallback, useEffect } from '@wordpress/element';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { DataViews, filterSortAndPaginate } from '@wordpress/dataviews';\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\nimport { __ } from '@wordpress/i18n';\nimport { drawerRight } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport Page from '../page';\nimport {\n\tuseDefaultViews,\n\tdefaultLayouts,\n} from '../sidebar-dataviews/default-views';\nimport {\n\tOPERATOR_IS_ANY,\n\tOPERATOR_IS_NONE,\n\tLAYOUT_LIST,\n} from '../../utils/constants';\n\nimport AddNewPostModal from '../add-new-post';\nimport { unlock } from '../../lock-unlock';\nimport { useEditPostAction } from '../dataviews-actions';\nimport { usePrevious } from '@wordpress/compose';\nimport usePostFields from '../post-fields';\n\nconst { usePostActions } = unlock( editorPrivateApis );\nconst { useLocation, useHistory } = unlock( routerPrivateApis );\nconst { useEntityRecordsWithPermissions } = unlock( coreDataPrivateApis );\nconst EMPTY_ARRAY = [];\n\nconst getDefaultView = ( defaultViews, activeView ) => {\n\treturn defaultViews.find( ( { slug } ) => slug === activeView )?.view;\n};\n\nconst getCustomView = ( editedEntityRecord ) => {\n\tif ( ! editedEntityRecord?.content ) {\n\t\treturn undefined;\n\t}\n\n\tconst content = JSON.parse( editedEntityRecord.content );\n\tif ( ! content ) {\n\t\treturn undefined;\n\t}\n\n\treturn {\n\t\t...content,\n\t\tlayout: defaultLayouts[ content.type ]?.layout,\n\t};\n};\n\n/**\n * This function abstracts working with default & custom views by\n * providing a [ state, setState ] tuple based on the URL parameters.\n *\n * Consumers use the provided tuple to work with state\n * and don't have to deal with the specifics of default & custom views.\n *\n * @param {string} postType Post type to retrieve default views for.\n * @return {Array} The [ state, setState ] tuple.\n */\nfunction useView( postType ) {\n\tconst {\n\t\tparams: { activeView = 'all', isCustom = 'false', layout },\n\t} = useLocation();\n\tconst history = useHistory();\n\n\tconst defaultViews = useDefaultViews( { postType } );\n\tconst { editEntityRecord } = useDispatch( coreStore );\n\tconst editedEntityRecord = useSelect(\n\t\t( select ) => {\n\t\t\tif ( isCustom !== 'true' ) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tconst { getEditedEntityRecord } = select( coreStore );\n\t\t\treturn getEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t'wp_dataviews',\n\t\t\t\tNumber( activeView )\n\t\t\t);\n\t\t},\n\t\t[ activeView, isCustom ]\n\t);\n\tconst [ view, setView ] = useState( () => {\n\t\tlet initialView;\n\t\tif ( isCustom === 'true' ) {\n\t\t\tinitialView = getCustomView( editedEntityRecord ) ?? {\n\t\t\t\ttype: layout ?? LAYOUT_LIST,\n\t\t\t};\n\t\t} else {\n\t\t\tinitialView = getDefaultView( defaultViews, activeView ) ?? {\n\t\t\t\ttype: layout ?? LAYOUT_LIST,\n\t\t\t};\n\t\t}\n\n\t\tconst type = layout ?? initialView.type;\n\t\treturn {\n\t\t\t...initialView,\n\t\t\ttype,\n\t\t};\n\t} );\n\n\tconst setViewWithUrlUpdate = useCallback(\n\t\t( newView ) => {\n\t\t\tconst { params } = history.getLocationWithParams();\n\n\t\t\tif ( newView.type === LAYOUT_LIST && ! params?.layout ) {\n\t\t\t\t// Skip updating the layout URL param if\n\t\t\t\t// it is not present and the newView.type is LAYOUT_LIST.\n\t\t\t} else if ( newView.type !== params?.layout ) {\n\t\t\t\thistory.push( {\n\t\t\t\t\t...params,\n\t\t\t\t\tlayout: newView.type,\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\tsetView( newView );\n\n\t\t\tif ( isCustom === 'true' && editedEntityRecord?.id ) {\n\t\t\t\teditEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\t'wp_dataviews',\n\t\t\t\t\teditedEntityRecord?.id,\n\t\t\t\t\t{\n\t\t\t\t\t\tcontent: JSON.stringify( newView ),\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t}\n\t\t},\n\t\t[ history, isCustom, editEntityRecord, editedEntityRecord?.id ]\n\t);\n\n\t// When layout URL param changes, update the view type\n\t// without affecting any other config.\n\tuseEffect( () => {\n\t\tsetView( ( prevView ) => ( {\n\t\t\t...prevView,\n\t\t\ttype: layout ?? LAYOUT_LIST,\n\t\t} ) );\n\t}, [ layout ] );\n\n\t// When activeView or isCustom URL parameters change, reset the view.\n\tuseEffect( () => {\n\t\tlet newView;\n\t\tif ( isCustom === 'true' ) {\n\t\t\tnewView = getCustomView( editedEntityRecord );\n\t\t} else {\n\t\t\tnewView = getDefaultView( defaultViews, activeView );\n\t\t}\n\n\t\tif ( newView ) {\n\t\t\tconst type = layout ?? newView.type;\n\t\t\tsetView( {\n\t\t\t\t...newView,\n\t\t\t\ttype,\n\t\t\t} );\n\t\t}\n\t}, [ activeView, isCustom, layout, defaultViews, editedEntityRecord ] );\n\n\treturn [ view, setViewWithUrlUpdate, setViewWithUrlUpdate ];\n}\n\nconst DEFAULT_STATUSES = 'draft,future,pending,private,publish'; // All but 'trash'.\n\nfunction getItemId( item ) {\n\treturn item.id.toString();\n}\n\nexport default function PostList( { postType } ) {\n\tconst [ view, setView ] = useView( postType );\n\tconst defaultViews = useDefaultViews( { postType } );\n\tconst history = useHistory();\n\tconst location = useLocation();\n\tconst {\n\t\tpostId,\n\t\tquickEdit = false,\n\t\tisCustom,\n\t\tactiveView = 'all',\n\t} = location.params;\n\tconst [ selection, setSelection ] = useState( postId?.split( ',' ) ?? [] );\n\tconst onChangeSelection = useCallback(\n\t\t( items ) => {\n\t\t\tsetSelection( items );\n\t\t\tconst { params } = history.getLocationWithParams();\n\t\t\tif ( ( params.isCustom ?? 'false' ) === 'false' ) {\n\t\t\t\thistory.push( {\n\t\t\t\t\t...params,\n\t\t\t\t\tpostId: items.join( ',' ),\n\t\t\t\t} );\n\t\t\t}\n\t\t},\n\t\t[ history ]\n\t);\n\n\tconst getActiveViewFilters = ( views, match ) => {\n\t\tconst found = views.find( ( { slug } ) => slug === match );\n\t\treturn found?.filters ?? [];\n\t};\n\n\tconst { isLoading: isLoadingFields, fields: _fields } = usePostFields(\n\t\tview.type\n\t);\n\tconst fields = useMemo( () => {\n\t\tconst activeViewFilters = getActiveViewFilters(\n\t\t\tdefaultViews,\n\t\t\tactiveView\n\t\t).map( ( { field } ) => field );\n\t\treturn _fields.map( ( field ) => ( {\n\t\t\t...field,\n\t\t\telements: activeViewFilters.includes( field.id )\n\t\t\t\t? []\n\t\t\t\t: field.elements,\n\t\t} ) );\n\t}, [ _fields, defaultViews, activeView ] );\n\n\tconst queryArgs = useMemo( () => {\n\t\tconst filters = {};\n\t\tview.filters?.forEach( ( filter ) => {\n\t\t\tif (\n\t\t\t\tfilter.field === 'status' &&\n\t\t\t\tfilter.operator === OPERATOR_IS_ANY\n\t\t\t) {\n\t\t\t\tfilters.status = filter.value;\n\t\t\t}\n\t\t\tif (\n\t\t\t\tfilter.field === 'author' &&\n\t\t\t\tfilter.operator === OPERATOR_IS_ANY\n\t\t\t) {\n\t\t\t\tfilters.author = filter.value;\n\t\t\t} else if (\n\t\t\t\tfilter.field === 'author' &&\n\t\t\t\tfilter.operator === OPERATOR_IS_NONE\n\t\t\t) {\n\t\t\t\tfilters.author_exclude = filter.value;\n\t\t\t}\n\t\t} );\n\n\t\t// The bundled views want data filtered without displaying the filter.\n\t\tconst activeViewFilters = getActiveViewFilters(\n\t\t\tdefaultViews,\n\t\t\tactiveView\n\t\t);\n\t\tactiveViewFilters.forEach( ( filter ) => {\n\t\t\tif (\n\t\t\t\tfilter.field === 'status' &&\n\t\t\t\tfilter.operator === OPERATOR_IS_ANY\n\t\t\t) {\n\t\t\t\tfilters.status = filter.value;\n\t\t\t}\n\t\t\tif (\n\t\t\t\tfilter.field === 'author' &&\n\t\t\t\tfilter.operator === OPERATOR_IS_ANY\n\t\t\t) {\n\t\t\t\tfilters.author = filter.value;\n\t\t\t} else if (\n\t\t\t\tfilter.field === 'author' &&\n\t\t\t\tfilter.operator === OPERATOR_IS_NONE\n\t\t\t) {\n\t\t\t\tfilters.author_exclude = filter.value;\n\t\t\t}\n\t\t} );\n\n\t\t// We want to provide a different default item for the status filter\n\t\t// than the REST API provides.\n\t\tif ( ! filters.status || filters.status === '' ) {\n\t\t\tfilters.status = DEFAULT_STATUSES;\n\t\t}\n\n\t\treturn {\n\t\t\tper_page: view.perPage,\n\t\t\tpage: view.page,\n\t\t\t_embed: 'author',\n\t\t\torder: view.sort?.direction,\n\t\t\torderby: view.sort?.field,\n\t\t\tsearch: view.search,\n\t\t\t...filters,\n\t\t};\n\t}, [ view, activeView, defaultViews ] );\n\tconst {\n\t\trecords,\n\t\tisResolving: isLoadingData,\n\t\ttotalItems,\n\t\ttotalPages,\n\t} = useEntityRecordsWithPermissions( 'postType', postType, queryArgs );\n\n\t// The REST API sort the authors by ID, but we want to sort them by name.\n\tconst data = useMemo( () => {\n\t\tif ( ! isLoadingFields && view?.sort?.field === 'author' ) {\n\t\t\treturn filterSortAndPaginate(\n\t\t\t\trecords,\n\t\t\t\t{ sort: { ...view.sort } },\n\t\t\t\tfields\n\t\t\t).data;\n\t\t}\n\n\t\treturn records;\n\t}, [ records, fields, isLoadingFields, view?.sort ] );\n\n\tconst ids = data?.map( ( record ) => getItemId( record ) ) ?? [];\n\tconst prevIds = usePrevious( ids ) ?? [];\n\tconst deletedIds = prevIds.filter( ( id ) => ! ids.includes( id ) );\n\tconst postIdWasDeleted = deletedIds.includes( postId );\n\n\tuseEffect( () => {\n\t\tif ( postIdWasDeleted ) {\n\t\t\thistory.push( {\n\t\t\t\t...history.getLocationWithParams().params,\n\t\t\t\tpostId: undefined,\n\t\t\t} );\n\t\t}\n\t}, [ postIdWasDeleted, history ] );\n\n\tconst paginationInfo = useMemo(\n\t\t() => ( {\n\t\t\ttotalItems,\n\t\t\ttotalPages,\n\t\t} ),\n\t\t[ totalItems, totalPages ]\n\t);\n\n\tconst { labels, canCreateRecord } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getPostType, canUser } = select( coreStore );\n\t\t\treturn {\n\t\t\t\tlabels: getPostType( postType )?.labels,\n\t\t\t\tcanCreateRecord: canUser( 'create', {\n\t\t\t\t\tkind: 'postType',\n\t\t\t\t\tname: postType,\n\t\t\t\t} ),\n\t\t\t};\n\t\t},\n\t\t[ postType ]\n\t);\n\n\tconst postTypeActions = usePostActions( {\n\t\tpostType,\n\t\tcontext: 'list',\n\t} );\n\tconst editAction = useEditPostAction();\n\tconst actions = useMemo(\n\t\t() => [ editAction, ...postTypeActions ],\n\t\t[ postTypeActions, editAction ]\n\t);\n\n\tconst [ showAddPostModal, setShowAddPostModal ] = useState( false );\n\n\tconst openModal = () => setShowAddPostModal( true );\n\tconst closeModal = () => setShowAddPostModal( false );\n\tconst handleNewPage = ( { type, id } ) => {\n\t\thistory.push( {\n\t\t\tpostId: id,\n\t\t\tpostType: type,\n\t\t\tcanvas: 'edit',\n\t\t} );\n\t\tcloseModal();\n\t};\n\n\treturn (\n\t\t<Page\n\t\t\ttitle={ labels?.name }\n\t\t\tactions={\n\t\t\t\tlabels?.add_new_item &&\n\t\t\t\tcanCreateRecord && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\tonClick={ openModal }\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ labels.add_new_item }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t{ showAddPostModal && (\n\t\t\t\t\t\t\t<AddNewPostModal\n\t\t\t\t\t\t\t\tpostType={ postType }\n\t\t\t\t\t\t\t\tonSave={ handleNewPage }\n\t\t\t\t\t\t\t\tonClose={ closeModal }\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)\n\t\t\t}\n\t\t>\n\t\t\t<DataViews\n\t\t\t\tkey={ activeView + isCustom }\n\t\t\t\tpaginationInfo={ paginationInfo }\n\t\t\t\tfields={ fields }\n\t\t\t\tactions={ actions }\n\t\t\t\tdata={ data || EMPTY_ARRAY }\n\t\t\t\tisLoading={ isLoadingData || isLoadingFields }\n\t\t\t\tview={ view }\n\t\t\t\tonChangeView={ setView }\n\t\t\t\tselection={ selection }\n\t\t\t\tonChangeSelection={ onChangeSelection }\n\t\t\t\tgetItemId={ getItemId }\n\t\t\t\tdefaultLayouts={ defaultLayouts }\n\t\t\t\theader={\n\t\t\t\t\twindow.__experimentalQuickEditDataViews &&\n\t\t\t\t\tview.type !== LAYOUT_LIST &&\n\t\t\t\t\tpostType === 'page' && (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t\tisPressed={ quickEdit }\n\t\t\t\t\t\t\ticon={ drawerRight }\n\t\t\t\t\t\t\tlabel={ __( 'Details' ) }\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\thistory.push( {\n\t\t\t\t\t\t\t\t\t...location.params,\n\t\t\t\t\t\t\t\t\tquickEdit: quickEdit ? undefined : true,\n\t\t\t\t\t\t\t\t} );\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}\n\t\t\t/>\n\t\t</Page>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AAIA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,UAAA,GAAAL,OAAA;AACA,IAAAM,OAAA,GAAAN,OAAA;AACA,IAAAO,KAAA,GAAAP,OAAA;AACA,IAAAQ,MAAA,GAAAR,OAAA;AAKA,IAAAS,KAAA,GAAAC,sBAAA,CAAAV,OAAA;AACA,IAAAW,aAAA,GAAAX,OAAA;AAIA,IAAAY,UAAA,GAAAZ,OAAA;AAMA,IAAAa,WAAA,GAAAH,sBAAA,CAAAV,OAAA;AACA,IAAAc,WAAA,GAAAd,OAAA;AACA,IAAAe,iBAAA,GAAAf,OAAA;AACA,IAAAgB,QAAA,GAAAhB,OAAA;AACA,IAAAiB,WAAA,GAAAP,sBAAA,CAAAV,OAAA;AAA2C,IAAAkB,WAAA,GAAAlB,OAAA;AAlC3C;AACA;AACA;;AAcA;AACA;AACA;;AA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AGA,IAAI,IAAIvG,WAAa;MAC5BoE,SAAS,EAAGgC,aAAa,IAAI/B,eAAiB;MAC9C/D,IAAI,EAAGA,IAAM;MACbyI,YAAY,EAAGlH,OAAS;MACxB0B,SAAS,EAAGA,SAAW;MACvBG,iBAAiB,EAAGA,iBAAmB;MACvCb,SAAS,EAAGA,SAAW;MACvB/B,cAAc,EAAGA,4BAAgB;MACjCkI,MAAM,EACLC,MAAM,CAACC,gCAAgC,IACvC5I,IAAI,CAACS,IAAI,KAAKkB,sBAAW,IACzBhB,QAAQ,KAAK,MAAM,iBAClB,IAAA1B,WAAA,CAAA0I,GAAA,EAAC7J,WAAA,CAAAoK,MAAM;QACNW,IAAI,EAAC,SAAS;QACdC,SAAS,EAAG9F,SAAW;QACvB+F,IAAI,EAAGC,kBAAa;QACpBC,KAAK,EAAG,IAAAC,QAAE,EAAE,SAAU,CAAG;QACzBd,OAAO,EAAGA,CAAA,KAAM;UACftH,OAAO,CAACmB,IAAI,CAAE;YACb,GAAGa,QAAQ,CAAClC,MAAM;YAClBoC,SAAS,EAAEA,SAAS,GAAG5C,SAAS,GAAG;UACpC,CAAE,CAAC;QACJ;MAAG,CACH;IAEF,GA7BKP,UAAU,GAAGgB,QA8BnB;EAAC,CACG,CAAC;AAET","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_components","require","_coreData","_element","_router","_data","_dataviews","_editor","_i18n","_icons","_page","_interopRequireDefault","_defaultViews","_constants","_addNewPost","_lockUnlock","_dataviewsActions","_compose","_postFields","_jsxRuntime","usePostActions","unlock","editorPrivateApis","useLocation","useHistory","routerPrivateApis","useEntityRecordsWithPermissions","coreDataPrivateApis","EMPTY_ARRAY","getDefaultView","defaultViews","activeView","find","slug","view","getCustomView","editedEntityRecord","content","undefined","JSON","parse","layout","defaultLayouts","type","useView","postType","params","isCustom","history","useDefaultViews","editEntityRecord","useDispatch","coreStore","useSelect","select","getEditedEntityRecord","Number","setView","useState","initialView","_getCustomView","LAYOUT_LIST","_getDefaultView","setViewWithUrlUpdate","useCallback","newView","getLocationWithParams","push","id","stringify","useEffect","prevView","DEFAULT_STATUSES","getItemId","item","toString","PostList","_postId$split","_data$map","_usePrevious","location","postId","quickEdit","selection","setSelection","split","onChangeSelection","items","_params$isCustom","join","getActiveViewFilters","views","match","_found$filters","found","filters","isLoading","isLoadingFields","fields","_fields","usePostFields","useMemo","activeViewFilters","map","field","elements","includes","queryArgs","forEach","filter","operator","OPERATOR_IS_ANY","status","value","author","OPERATOR_IS_NONE","author_exclude","per_page","perPage","page","_embed","order","sort","direction","orderby","search","records","isResolving","isLoadingData","totalItems","totalPages","data","filterSortAndPaginate","ids","record","prevIds","usePrevious","deletedIds","postIdWasDeleted","paginationInfo","labels","canCreateRecord","getPostType","canUser","kind","name","postTypeActions","context","editAction","useEditPostAction","actions","showAddPostModal","setShowAddPostModal","openModal","closeModal","handleNewPage","canvas","jsx","default","title","add_new_item","jsxs","Fragment","children","Button","variant","onClick","__next40pxDefaultSize","onSave","onClose","DataViews","onChangeView","isItemClickable","onClickItem","header","window","__experimentalQuickEditDataViews","size","isPressed","icon","drawerRight","label","__"],"sources":["@wordpress/edit-site/src/components/post-list/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Button } from '@wordpress/components';\nimport {\n\tstore as coreStore,\n\tprivateApis as coreDataPrivateApis,\n} from '@wordpress/core-data';\nimport { useState, useMemo, useCallback, useEffect } from '@wordpress/element';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { DataViews, filterSortAndPaginate } from '@wordpress/dataviews';\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\nimport { __ } from '@wordpress/i18n';\nimport { drawerRight } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport Page from '../page';\nimport {\n\tuseDefaultViews,\n\tdefaultLayouts,\n} from '../sidebar-dataviews/default-views';\nimport {\n\tOPERATOR_IS_ANY,\n\tOPERATOR_IS_NONE,\n\tLAYOUT_LIST,\n} from '../../utils/constants';\n\nimport AddNewPostModal from '../add-new-post';\nimport { unlock } from '../../lock-unlock';\nimport { useEditPostAction } from '../dataviews-actions';\nimport { usePrevious } from '@wordpress/compose';\nimport usePostFields from '../post-fields';\n\nconst { usePostActions } = unlock( editorPrivateApis );\nconst { useLocation, useHistory } = unlock( routerPrivateApis );\nconst { useEntityRecordsWithPermissions } = unlock( coreDataPrivateApis );\nconst EMPTY_ARRAY = [];\n\nconst getDefaultView = ( defaultViews, activeView ) => {\n\treturn defaultViews.find( ( { slug } ) => slug === activeView )?.view;\n};\n\nconst getCustomView = ( editedEntityRecord ) => {\n\tif ( ! editedEntityRecord?.content ) {\n\t\treturn undefined;\n\t}\n\n\tconst content = JSON.parse( editedEntityRecord.content );\n\tif ( ! content ) {\n\t\treturn undefined;\n\t}\n\n\treturn {\n\t\t...content,\n\t\tlayout: defaultLayouts[ content.type ]?.layout,\n\t};\n};\n\n/**\n * This function abstracts working with default & custom views by\n * providing a [ state, setState ] tuple based on the URL parameters.\n *\n * Consumers use the provided tuple to work with state\n * and don't have to deal with the specifics of default & custom views.\n *\n * @param {string} postType Post type to retrieve default views for.\n * @return {Array} The [ state, setState ] tuple.\n */\nfunction useView( postType ) {\n\tconst {\n\t\tparams: { activeView = 'all', isCustom = 'false', layout },\n\t} = useLocation();\n\tconst history = useHistory();\n\n\tconst defaultViews = useDefaultViews( { postType } );\n\tconst { editEntityRecord } = useDispatch( coreStore );\n\tconst editedEntityRecord = useSelect(\n\t\t( select ) => {\n\t\t\tif ( isCustom !== 'true' ) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tconst { getEditedEntityRecord } = select( coreStore );\n\t\t\treturn getEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t'wp_dataviews',\n\t\t\t\tNumber( activeView )\n\t\t\t);\n\t\t},\n\t\t[ activeView, isCustom ]\n\t);\n\tconst [ view, setView ] = useState( () => {\n\t\tlet initialView;\n\t\tif ( isCustom === 'true' ) {\n\t\t\tinitialView = getCustomView( editedEntityRecord ) ?? {\n\t\t\t\ttype: layout ?? LAYOUT_LIST,\n\t\t\t};\n\t\t} else {\n\t\t\tinitialView = getDefaultView( defaultViews, activeView ) ?? {\n\t\t\t\ttype: layout ?? LAYOUT_LIST,\n\t\t\t};\n\t\t}\n\n\t\tconst type = layout ?? initialView.type;\n\t\treturn {\n\t\t\t...initialView,\n\t\t\ttype,\n\t\t};\n\t} );\n\n\tconst setViewWithUrlUpdate = useCallback(\n\t\t( newView ) => {\n\t\t\tconst { params } = history.getLocationWithParams();\n\n\t\t\tif ( newView.type === LAYOUT_LIST && ! params?.layout ) {\n\t\t\t\t// Skip updating the layout URL param if\n\t\t\t\t// it is not present and the newView.type is LAYOUT_LIST.\n\t\t\t} else if ( newView.type !== params?.layout ) {\n\t\t\t\thistory.push( {\n\t\t\t\t\t...params,\n\t\t\t\t\tlayout: newView.type,\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\tsetView( newView );\n\n\t\t\tif ( isCustom === 'true' && editedEntityRecord?.id ) {\n\t\t\t\teditEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\t'wp_dataviews',\n\t\t\t\t\teditedEntityRecord?.id,\n\t\t\t\t\t{\n\t\t\t\t\t\tcontent: JSON.stringify( newView ),\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t}\n\t\t},\n\t\t[ history, isCustom, editEntityRecord, editedEntityRecord?.id ]\n\t);\n\n\t// When layout URL param changes, update the view type\n\t// without affecting any other config.\n\tuseEffect( () => {\n\t\tsetView( ( prevView ) => ( {\n\t\t\t...prevView,\n\t\t\ttype: layout ?? LAYOUT_LIST,\n\t\t} ) );\n\t}, [ layout ] );\n\n\t// When activeView or isCustom URL parameters change, reset the view.\n\tuseEffect( () => {\n\t\tlet newView;\n\t\tif ( isCustom === 'true' ) {\n\t\t\tnewView = getCustomView( editedEntityRecord );\n\t\t} else {\n\t\t\tnewView = getDefaultView( defaultViews, activeView );\n\t\t}\n\n\t\tif ( newView ) {\n\t\t\tconst type = layout ?? newView.type;\n\t\t\tsetView( {\n\t\t\t\t...newView,\n\t\t\t\ttype,\n\t\t\t} );\n\t\t}\n\t}, [ activeView, isCustom, layout, defaultViews, editedEntityRecord ] );\n\n\treturn [ view, setViewWithUrlUpdate, setViewWithUrlUpdate ];\n}\n\nconst DEFAULT_STATUSES = 'draft,future,pending,private,publish'; // All but 'trash'.\n\nfunction getItemId( item ) {\n\treturn item.id.toString();\n}\n\nexport default function PostList( { postType } ) {\n\tconst [ view, setView ] = useView( postType );\n\tconst defaultViews = useDefaultViews( { postType } );\n\tconst history = useHistory();\n\tconst location = useLocation();\n\tconst {\n\t\tpostId,\n\t\tquickEdit = false,\n\t\tisCustom,\n\t\tactiveView = 'all',\n\t} = location.params;\n\tconst [ selection, setSelection ] = useState( postId?.split( ',' ) ?? [] );\n\tconst onChangeSelection = useCallback(\n\t\t( items ) => {\n\t\t\tsetSelection( items );\n\t\t\tconst { params } = history.getLocationWithParams();\n\t\t\tif ( ( params.isCustom ?? 'false' ) === 'false' ) {\n\t\t\t\thistory.push( {\n\t\t\t\t\t...params,\n\t\t\t\t\tpostId: items.join( ',' ),\n\t\t\t\t} );\n\t\t\t}\n\t\t},\n\t\t[ history ]\n\t);\n\n\tconst getActiveViewFilters = ( views, match ) => {\n\t\tconst found = views.find( ( { slug } ) => slug === match );\n\t\treturn found?.filters ?? [];\n\t};\n\n\tconst { isLoading: isLoadingFields, fields: _fields } = usePostFields();\n\tconst fields = useMemo( () => {\n\t\tconst activeViewFilters = getActiveViewFilters(\n\t\t\tdefaultViews,\n\t\t\tactiveView\n\t\t).map( ( { field } ) => field );\n\t\treturn _fields.map( ( field ) => ( {\n\t\t\t...field,\n\t\t\telements: activeViewFilters.includes( field.id )\n\t\t\t\t? []\n\t\t\t\t: field.elements,\n\t\t} ) );\n\t}, [ _fields, defaultViews, activeView ] );\n\n\tconst queryArgs = useMemo( () => {\n\t\tconst filters = {};\n\t\tview.filters?.forEach( ( filter ) => {\n\t\t\tif (\n\t\t\t\tfilter.field === 'status' &&\n\t\t\t\tfilter.operator === OPERATOR_IS_ANY\n\t\t\t) {\n\t\t\t\tfilters.status = filter.value;\n\t\t\t}\n\t\t\tif (\n\t\t\t\tfilter.field === 'author' &&\n\t\t\t\tfilter.operator === OPERATOR_IS_ANY\n\t\t\t) {\n\t\t\t\tfilters.author = filter.value;\n\t\t\t} else if (\n\t\t\t\tfilter.field === 'author' &&\n\t\t\t\tfilter.operator === OPERATOR_IS_NONE\n\t\t\t) {\n\t\t\t\tfilters.author_exclude = filter.value;\n\t\t\t}\n\t\t} );\n\n\t\t// The bundled views want data filtered without displaying the filter.\n\t\tconst activeViewFilters = getActiveViewFilters(\n\t\t\tdefaultViews,\n\t\t\tactiveView\n\t\t);\n\t\tactiveViewFilters.forEach( ( filter ) => {\n\t\t\tif (\n\t\t\t\tfilter.field === 'status' &&\n\t\t\t\tfilter.operator === OPERATOR_IS_ANY\n\t\t\t) {\n\t\t\t\tfilters.status = filter.value;\n\t\t\t}\n\t\t\tif (\n\t\t\t\tfilter.field === 'author' &&\n\t\t\t\tfilter.operator === OPERATOR_IS_ANY\n\t\t\t) {\n\t\t\t\tfilters.author = filter.value;\n\t\t\t} else if (\n\t\t\t\tfilter.field === 'author' &&\n\t\t\t\tfilter.operator === OPERATOR_IS_NONE\n\t\t\t) {\n\t\t\t\tfilters.author_exclude = filter.value;\n\t\t\t}\n\t\t} );\n\n\t\t// We want to provide a different default item for the status filter\n\t\t// than the REST API provides.\n\t\tif ( ! filters.status || filters.status === '' ) {\n\t\t\tfilters.status = DEFAULT_STATUSES;\n\t\t}\n\n\t\treturn {\n\t\t\tper_page: view.perPage,\n\t\t\tpage: view.page,\n\t\t\t_embed: 'author',\n\t\t\torder: view.sort?.direction,\n\t\t\torderby: view.sort?.field,\n\t\t\tsearch: view.search,\n\t\t\t...filters,\n\t\t};\n\t}, [ view, activeView, defaultViews ] );\n\tconst {\n\t\trecords,\n\t\tisResolving: isLoadingData,\n\t\ttotalItems,\n\t\ttotalPages,\n\t} = useEntityRecordsWithPermissions( 'postType', postType, queryArgs );\n\n\t// The REST API sort the authors by ID, but we want to sort them by name.\n\tconst data = useMemo( () => {\n\t\tif ( ! isLoadingFields && view?.sort?.field === 'author' ) {\n\t\t\treturn filterSortAndPaginate(\n\t\t\t\trecords,\n\t\t\t\t{ sort: { ...view.sort } },\n\t\t\t\tfields\n\t\t\t).data;\n\t\t}\n\n\t\treturn records;\n\t}, [ records, fields, isLoadingFields, view?.sort ] );\n\n\tconst ids = data?.map( ( record ) => getItemId( record ) ) ?? [];\n\tconst prevIds = usePrevious( ids ) ?? [];\n\tconst deletedIds = prevIds.filter( ( id ) => ! ids.includes( id ) );\n\tconst postIdWasDeleted = deletedIds.includes( postId );\n\n\tuseEffect( () => {\n\t\tif ( postIdWasDeleted ) {\n\t\t\thistory.push( {\n\t\t\t\t...history.getLocationWithParams().params,\n\t\t\t\tpostId: undefined,\n\t\t\t} );\n\t\t}\n\t}, [ postIdWasDeleted, history ] );\n\n\tconst paginationInfo = useMemo(\n\t\t() => ( {\n\t\t\ttotalItems,\n\t\t\ttotalPages,\n\t\t} ),\n\t\t[ totalItems, totalPages ]\n\t);\n\n\tconst { labels, canCreateRecord } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getPostType, canUser } = select( coreStore );\n\t\t\treturn {\n\t\t\t\tlabels: getPostType( postType )?.labels,\n\t\t\t\tcanCreateRecord: canUser( 'create', {\n\t\t\t\t\tkind: 'postType',\n\t\t\t\t\tname: postType,\n\t\t\t\t} ),\n\t\t\t};\n\t\t},\n\t\t[ postType ]\n\t);\n\n\tconst postTypeActions = usePostActions( {\n\t\tpostType,\n\t\tcontext: 'list',\n\t} );\n\tconst editAction = useEditPostAction();\n\tconst actions = useMemo(\n\t\t() => [ editAction, ...postTypeActions ],\n\t\t[ postTypeActions, editAction ]\n\t);\n\n\tconst [ showAddPostModal, setShowAddPostModal ] = useState( false );\n\n\tconst openModal = () => setShowAddPostModal( true );\n\tconst closeModal = () => setShowAddPostModal( false );\n\tconst handleNewPage = ( { type, id } ) => {\n\t\thistory.push( {\n\t\t\tpostId: id,\n\t\t\tpostType: type,\n\t\t\tcanvas: 'edit',\n\t\t} );\n\t\tcloseModal();\n\t};\n\n\treturn (\n\t\t<Page\n\t\t\ttitle={ labels?.name }\n\t\t\tactions={\n\t\t\t\tlabels?.add_new_item &&\n\t\t\t\tcanCreateRecord && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\tonClick={ openModal }\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ labels.add_new_item }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t{ showAddPostModal && (\n\t\t\t\t\t\t\t<AddNewPostModal\n\t\t\t\t\t\t\t\tpostType={ postType }\n\t\t\t\t\t\t\t\tonSave={ handleNewPage }\n\t\t\t\t\t\t\t\tonClose={ closeModal }\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)\n\t\t\t}\n\t\t>\n\t\t\t<DataViews\n\t\t\t\tkey={ activeView + isCustom }\n\t\t\t\tpaginationInfo={ paginationInfo }\n\t\t\t\tfields={ fields }\n\t\t\t\tactions={ actions }\n\t\t\t\tdata={ data || EMPTY_ARRAY }\n\t\t\t\tisLoading={ isLoadingData || isLoadingFields }\n\t\t\t\tview={ view }\n\t\t\t\tonChangeView={ setView }\n\t\t\t\tselection={ selection }\n\t\t\t\tonChangeSelection={ onChangeSelection }\n\t\t\t\tisItemClickable={ ( item ) => item.status !== 'trash' }\n\t\t\t\tonClickItem={ ( { id } ) => {\n\t\t\t\t\thistory.push( {\n\t\t\t\t\t\tpostId: id,\n\t\t\t\t\t\tpostType,\n\t\t\t\t\t\tcanvas: 'edit',\n\t\t\t\t\t} );\n\t\t\t\t} }\n\t\t\t\tgetItemId={ getItemId }\n\t\t\t\tdefaultLayouts={ defaultLayouts }\n\t\t\t\theader={\n\t\t\t\t\twindow.__experimentalQuickEditDataViews &&\n\t\t\t\t\tview.type !== LAYOUT_LIST &&\n\t\t\t\t\tpostType === 'page' && (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t\tisPressed={ quickEdit }\n\t\t\t\t\t\t\ticon={ drawerRight }\n\t\t\t\t\t\t\tlabel={ __( 'Details' ) }\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\thistory.push( {\n\t\t\t\t\t\t\t\t\t...location.params,\n\t\t\t\t\t\t\t\t\tquickEdit: quickEdit ? undefined : true,\n\t\t\t\t\t\t\t\t} );\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}\n\t\t\t/>\n\t\t</Page>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AAIA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,UAAA,GAAAL,OAAA;AACA,IAAAM,OAAA,GAAAN,OAAA;AACA,IAAAO,KAAA,GAAAP,OAAA;AACA,IAAAQ,MAAA,GAAAR,OAAA;AAKA,IAAAS,KAAA,GAAAC,sBAAA,CAAAV,OAAA;AACA,IAAAW,aAAA,GAAAX,OAAA;AAIA,IAAAY,UAAA,GAAAZ,OAAA;AAMA,IAAAa,WAAA,GAAAH,sBAAA,CAAAV,OAAA;AACA,IAAAc,WAAA,GAAAd,OAAA;AACA,IAAAe,iBAAA,GAAAf,OAAA;AACA,IAAAgB,QAAA,GAAAhB,OAAA;AACA,IAAAiB,WAAA,GAAAP,sBAAA,CAAAV,OAAA;AAA2C,IAAAkB,WAAA,GAAAlB,OAAA;A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S;MACnBnB,IAAI,EAAGA,IAAI,IAAIvG,WAAa;MAC5BoE,SAAS,EAAGgC,aAAa,IAAI/B,eAAiB;MAC9C/D,IAAI,EAAGA,IAAM;MACbyI,YAAY,EAAGlH,OAAS;MACxB0B,SAAS,EAAGA,SAAW;MACvBG,iBAAiB,EAAGA,iBAAmB;MACvCsF,eAAe,EAAKlG,IAAI,IAAMA,IAAI,CAACsC,MAAM,KAAK,OAAS;MACvD6D,WAAW,EAAGA,CAAE;QAAEzG;MAAG,CAAC,KAAM;QAC3BpB,OAAO,CAACmB,IAAI,CAAE;UACbc,MAAM,EAAEb,EAAE;UACVvB,QAAQ;UACR+G,MAAM,EAAE;QACT,CAAE,CAAC;MACJ,CAAG;MACHnF,SAAS,EAAGA,SAAW;MACvB/B,cAAc,EAAGA,4BAAgB;MACjCoI,MAAM,EACLC,MAAM,CAACC,gCAAgC,IACvC9I,IAAI,CAACS,IAAI,KAAKkB,sBAAW,IACzBhB,QAAQ,KAAK,MAAM,iBAClB,IAAA1B,WAAA,CAAA0I,GAAA,EAAC7J,WAAA,CAAAoK,MAAM;QACNa,IAAI,EAAC,SAAS;QACdC,SAAS,EAAGhG,SAAW;QACvBiG,IAAI,EAAGC,kBAAa;QACpBC,KAAK,EAAG,IAAAC,QAAE,EAAE,SAAU,CAAG;QACzBhB,OAAO,EAAGA,CAAA,KAAM;UACftH,OAAO,CAACmB,IAAI,CAAE;YACb,GAAGa,QAAQ,CAAClC,MAAM;YAClBoC,SAAS,EAAEA,SAAS,GAAG5C,SAAS,GAAG;UACpC,CAAE,CAAC;QACJ;MAAG,CACH;IAEF,GArCKP,UAAU,GAAGgB,QAsCnB;EAAC,CACG,CAAC;AAET","ignoreList":[]}
|
|
@@ -54,7 +54,8 @@ function createNavState() {
|
|
|
54
54
|
};
|
|
55
55
|
}
|
|
56
56
|
function SidebarContentWrapper({
|
|
57
|
-
children
|
|
57
|
+
children,
|
|
58
|
+
shouldAnimate
|
|
58
59
|
}) {
|
|
59
60
|
const navState = (0, _element.useContext)(SidebarNavigationContext);
|
|
60
61
|
const wrapperRef = (0, _element.useRef)();
|
|
@@ -67,10 +68,15 @@ function SidebarContentWrapper({
|
|
|
67
68
|
focusSidebarElement(wrapperRef.current, direction, focusSelector);
|
|
68
69
|
setNavAnimation(direction);
|
|
69
70
|
}, [navState]);
|
|
70
|
-
const wrapperCls = (0, _clsx.default)('edit-site-sidebar__screen-wrapper',
|
|
71
|
+
const wrapperCls = (0, _clsx.default)('edit-site-sidebar__screen-wrapper',
|
|
72
|
+
/*
|
|
73
|
+
* Some panes do not have sub-panes and therefore
|
|
74
|
+
* should not animate when clicked on.
|
|
75
|
+
*/
|
|
76
|
+
shouldAnimate ? {
|
|
71
77
|
'slide-from-left': navAnimation === 'back',
|
|
72
78
|
'slide-from-right': navAnimation === 'forward'
|
|
73
|
-
});
|
|
79
|
+
} : {});
|
|
74
80
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
75
81
|
ref: wrapperRef,
|
|
76
82
|
className: wrapperCls,
|
|
@@ -79,6 +85,7 @@ function SidebarContentWrapper({
|
|
|
79
85
|
}
|
|
80
86
|
function SidebarContent({
|
|
81
87
|
routeKey,
|
|
88
|
+
shouldAnimate,
|
|
82
89
|
children
|
|
83
90
|
}) {
|
|
84
91
|
const [navState] = (0, _element.useState)(createNavState);
|
|
@@ -87,6 +94,7 @@ function SidebarContent({
|
|
|
87
94
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
88
95
|
className: "edit-site-sidebar__content",
|
|
89
96
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(SidebarContentWrapper, {
|
|
97
|
+
shouldAnimate: shouldAnimate,
|
|
90
98
|
children: children
|
|
91
99
|
}, routeKey)
|
|
92
100
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_clsx","_interopRequireDefault","require","_element","_dom","_jsxRuntime","SidebarNavigationContext","exports","createContext","focusSidebarElement","el","direction","focusSelector","elementToFocus","querySelector","firstTabbable","focus","tabbable","find","createNavState","state","get","navigate","SidebarContentWrapper","children","navState","useContext","wrapperRef","useRef","navAnimation","setNavAnimation","useState","useLayoutEffect","current","wrapperCls","clsx","jsx","ref","className","SidebarContent","routeKey","Provider","value"],"sources":["@wordpress/edit-site/src/components/sidebar/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tcreateContext,\n\tuseContext,\n\tuseState,\n\tuseRef,\n\tuseLayoutEffect,\n} from '@wordpress/element';\nimport { focus } from '@wordpress/dom';\n\nexport const SidebarNavigationContext = createContext( () => {} );\n// Focus a sidebar element after a navigation. The element to focus is either\n// specified by `focusSelector` (when navigating back) or it is the first\n// tabbable element (usually the \"Back\" button).\nfunction focusSidebarElement( el, direction, focusSelector ) {\n\tlet elementToFocus;\n\tif ( direction === 'back' && focusSelector ) {\n\t\telementToFocus = el.querySelector( focusSelector );\n\t}\n\tif ( direction !== null && ! elementToFocus ) {\n\t\tconst [ firstTabbable ] = focus.tabbable.find( el );\n\t\telementToFocus = firstTabbable ?? el;\n\t}\n\telementToFocus?.focus();\n}\n\n// Navigation state that is updated when navigating back or forward. Helps us\n// manage the animations and also focus.\nfunction createNavState() {\n\tlet state = {\n\t\tdirection: null,\n\t\tfocusSelector: null,\n\t};\n\n\treturn {\n\t\tget() {\n\t\t\treturn state;\n\t\t},\n\t\tnavigate( direction, focusSelector = null ) {\n\t\t\tstate = {\n\t\t\t\tdirection,\n\t\t\t\tfocusSelector:\n\t\t\t\t\tdirection === 'forward' && focusSelector\n\t\t\t\t\t\t? focusSelector\n\t\t\t\t\t\t: state.focusSelector,\n\t\t\t};\n\t\t},\n\t};\n}\n\nfunction SidebarContentWrapper( { children } ) {\n\tconst navState = useContext( SidebarNavigationContext );\n\tconst wrapperRef = useRef();\n\tconst [ navAnimation, setNavAnimation ] = useState( null );\n\n\tuseLayoutEffect( () => {\n\t\tconst { direction, focusSelector } = navState.get();\n\t\tfocusSidebarElement( wrapperRef.current, direction, focusSelector );\n\t\tsetNavAnimation( direction );\n\t}, [ navState ] );\n\n\tconst wrapperCls = clsx(
|
|
1
|
+
{"version":3,"names":["_clsx","_interopRequireDefault","require","_element","_dom","_jsxRuntime","SidebarNavigationContext","exports","createContext","focusSidebarElement","el","direction","focusSelector","elementToFocus","querySelector","firstTabbable","focus","tabbable","find","createNavState","state","get","navigate","SidebarContentWrapper","children","shouldAnimate","navState","useContext","wrapperRef","useRef","navAnimation","setNavAnimation","useState","useLayoutEffect","current","wrapperCls","clsx","jsx","ref","className","SidebarContent","routeKey","Provider","value"],"sources":["@wordpress/edit-site/src/components/sidebar/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tcreateContext,\n\tuseContext,\n\tuseState,\n\tuseRef,\n\tuseLayoutEffect,\n} from '@wordpress/element';\nimport { focus } from '@wordpress/dom';\n\nexport const SidebarNavigationContext = createContext( () => {} );\n// Focus a sidebar element after a navigation. The element to focus is either\n// specified by `focusSelector` (when navigating back) or it is the first\n// tabbable element (usually the \"Back\" button).\nfunction focusSidebarElement( el, direction, focusSelector ) {\n\tlet elementToFocus;\n\tif ( direction === 'back' && focusSelector ) {\n\t\telementToFocus = el.querySelector( focusSelector );\n\t}\n\tif ( direction !== null && ! elementToFocus ) {\n\t\tconst [ firstTabbable ] = focus.tabbable.find( el );\n\t\telementToFocus = firstTabbable ?? el;\n\t}\n\telementToFocus?.focus();\n}\n\n// Navigation state that is updated when navigating back or forward. Helps us\n// manage the animations and also focus.\nfunction createNavState() {\n\tlet state = {\n\t\tdirection: null,\n\t\tfocusSelector: null,\n\t};\n\n\treturn {\n\t\tget() {\n\t\t\treturn state;\n\t\t},\n\t\tnavigate( direction, focusSelector = null ) {\n\t\t\tstate = {\n\t\t\t\tdirection,\n\t\t\t\tfocusSelector:\n\t\t\t\t\tdirection === 'forward' && focusSelector\n\t\t\t\t\t\t? focusSelector\n\t\t\t\t\t\t: state.focusSelector,\n\t\t\t};\n\t\t},\n\t};\n}\n\nfunction SidebarContentWrapper( { children, shouldAnimate } ) {\n\tconst navState = useContext( SidebarNavigationContext );\n\tconst wrapperRef = useRef();\n\tconst [ navAnimation, setNavAnimation ] = useState( null );\n\n\tuseLayoutEffect( () => {\n\t\tconst { direction, focusSelector } = navState.get();\n\t\tfocusSidebarElement( wrapperRef.current, direction, focusSelector );\n\t\tsetNavAnimation( direction );\n\t}, [ navState ] );\n\n\tconst wrapperCls = clsx(\n\t\t'edit-site-sidebar__screen-wrapper',\n\t\t/*\n\t\t * Some panes do not have sub-panes and therefore\n\t\t * should not animate when clicked on.\n\t\t */\n\t\tshouldAnimate\n\t\t\t? {\n\t\t\t\t\t'slide-from-left': navAnimation === 'back',\n\t\t\t\t\t'slide-from-right': navAnimation === 'forward',\n\t\t\t }\n\t\t\t: {}\n\t);\n\n\treturn (\n\t\t<div ref={ wrapperRef } className={ wrapperCls }>\n\t\t\t{ children }\n\t\t</div>\n\t);\n}\n\nexport default function SidebarContent( {\n\trouteKey,\n\tshouldAnimate,\n\tchildren,\n} ) {\n\tconst [ navState ] = useState( createNavState );\n\n\treturn (\n\t\t<SidebarNavigationContext.Provider value={ navState }>\n\t\t\t<div className=\"edit-site-sidebar__content\">\n\t\t\t\t<SidebarContentWrapper\n\t\t\t\t\tshouldAnimate={ shouldAnimate }\n\t\t\t\t\tkey={ routeKey }\n\t\t\t\t>\n\t\t\t\t\t{ children }\n\t\t\t\t</SidebarContentWrapper>\n\t\t\t</div>\n\t\t</SidebarNavigationContext.Provider>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AAOA,IAAAE,IAAA,GAAAF,OAAA;AAAuC,IAAAG,WAAA,GAAAH,OAAA;AAfvC;AACA;AACA;;AAGA;AACA;AACA;;AAUO,MAAMI,wB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
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = GlobalStylesUIWrapper;
|
|
8
|
+
var _i18n = require("@wordpress/i18n");
|
|
9
|
+
var _element = require("@wordpress/element");
|
|
10
|
+
var _router = require("@wordpress/router");
|
|
11
|
+
var _compose = require("@wordpress/compose");
|
|
12
|
+
var _components = require("@wordpress/components");
|
|
13
|
+
var _ui = _interopRequireDefault(require("../global-styles/ui"));
|
|
14
|
+
var _page = _interopRequireDefault(require("../page"));
|
|
15
|
+
var _lockUnlock = require("../../lock-unlock");
|
|
16
|
+
var _styleBook = _interopRequireDefault(require("../style-book"));
|
|
17
|
+
var _constants = require("../style-book/constants");
|
|
18
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
|
+
/**
|
|
20
|
+
* WordPress dependencies
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Internal dependencies
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
const {
|
|
28
|
+
useLocation,
|
|
29
|
+
useHistory
|
|
30
|
+
} = (0, _lockUnlock.unlock)(_router.privateApis);
|
|
31
|
+
const {
|
|
32
|
+
Menu
|
|
33
|
+
} = (0, _lockUnlock.unlock)(_components.privateApis);
|
|
34
|
+
const GLOBAL_STYLES_PATH_PREFIX = '/wp_global_styles';
|
|
35
|
+
const GlobalStylesPageActions = ({
|
|
36
|
+
isStyleBookOpened,
|
|
37
|
+
setIsStyleBookOpened
|
|
38
|
+
}) => {
|
|
39
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(Menu, {
|
|
40
|
+
trigger: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
|
|
41
|
+
__next40pxDefaultSize: true,
|
|
42
|
+
variant: "tertiary",
|
|
43
|
+
size: "compact",
|
|
44
|
+
children: (0, _i18n.__)('Preview')
|
|
45
|
+
}),
|
|
46
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(Menu.RadioItem, {
|
|
47
|
+
value: true,
|
|
48
|
+
checked: isStyleBookOpened,
|
|
49
|
+
name: "styles-preview-actions",
|
|
50
|
+
onChange: () => setIsStyleBookOpened(true),
|
|
51
|
+
defaultChecked: true,
|
|
52
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(Menu.ItemLabel, {
|
|
53
|
+
children: (0, _i18n.__)('Style book')
|
|
54
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(Menu.ItemHelpText, {
|
|
55
|
+
children: (0, _i18n.__)('Preview blocks and styles.')
|
|
56
|
+
})]
|
|
57
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(Menu.RadioItem, {
|
|
58
|
+
value: false,
|
|
59
|
+
checked: !isStyleBookOpened,
|
|
60
|
+
name: "styles-preview-actions",
|
|
61
|
+
onChange: () => setIsStyleBookOpened(false),
|
|
62
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(Menu.ItemLabel, {
|
|
63
|
+
children: (0, _i18n.__)('Site')
|
|
64
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(Menu.ItemHelpText, {
|
|
65
|
+
children: (0, _i18n.__)('Preview your site.')
|
|
66
|
+
})]
|
|
67
|
+
})]
|
|
68
|
+
});
|
|
69
|
+
};
|
|
70
|
+
function GlobalStylesUIWrapper() {
|
|
71
|
+
const {
|
|
72
|
+
params
|
|
73
|
+
} = useLocation();
|
|
74
|
+
const history = useHistory();
|
|
75
|
+
const {
|
|
76
|
+
canvas = 'view'
|
|
77
|
+
} = params;
|
|
78
|
+
const [isStyleBookOpened, setIsStyleBookOpened] = (0, _element.useState)(false);
|
|
79
|
+
const isMobileViewport = (0, _compose.useViewportMatch)('medium', '<');
|
|
80
|
+
const pathWithPrefix = params.path;
|
|
81
|
+
const [path, onPathChange] = (0, _element.useMemo)(() => {
|
|
82
|
+
const processedPath = pathWithPrefix.substring(GLOBAL_STYLES_PATH_PREFIX.length);
|
|
83
|
+
return [processedPath ? processedPath : '/', newPath => {
|
|
84
|
+
history.push({
|
|
85
|
+
path: !newPath || newPath === '/' ? GLOBAL_STYLES_PATH_PREFIX : `${GLOBAL_STYLES_PATH_PREFIX}${newPath}`
|
|
86
|
+
});
|
|
87
|
+
}];
|
|
88
|
+
}, [pathWithPrefix, history]);
|
|
89
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
90
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_page.default, {
|
|
91
|
+
actions: !isMobileViewport ? /*#__PURE__*/(0, _jsxRuntime.jsx)(GlobalStylesPageActions, {
|
|
92
|
+
isStyleBookOpened: isStyleBookOpened,
|
|
93
|
+
setIsStyleBookOpened: setIsStyleBookOpened
|
|
94
|
+
}) : null,
|
|
95
|
+
className: "edit-site-styles",
|
|
96
|
+
title: (0, _i18n.__)('Styles'),
|
|
97
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ui.default, {
|
|
98
|
+
path: path,
|
|
99
|
+
onPathChange: onPathChange
|
|
100
|
+
})
|
|
101
|
+
}), canvas === 'view' && isStyleBookOpened && /*#__PURE__*/(0, _jsxRuntime.jsx)(_styleBook.default, {
|
|
102
|
+
enableResizing: false,
|
|
103
|
+
showCloseButton: false,
|
|
104
|
+
showTabs: false,
|
|
105
|
+
isSelected: blockName =>
|
|
106
|
+
// Match '/blocks/core%2Fbutton' and
|
|
107
|
+
// '/blocks/core%2Fbutton/typography', but not
|
|
108
|
+
// '/blocks/core%2Fbuttons'.
|
|
109
|
+
path === `/wp_global_styles/blocks/${encodeURIComponent(blockName)}` || path.startsWith(`/wp_global_styles/blocks/${encodeURIComponent(blockName)}/`),
|
|
110
|
+
path: path,
|
|
111
|
+
onSelect: blockName => {
|
|
112
|
+
if (_constants.STYLE_BOOK_COLOR_GROUPS.find(group => group.slug === blockName)) {
|
|
113
|
+
// Go to color palettes Global Styles.
|
|
114
|
+
onPathChange('/colors/palette');
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
if (blockName === 'typography') {
|
|
118
|
+
// Go to typography Global Styles.
|
|
119
|
+
onPathChange('/typography');
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// Now go to the selected block.
|
|
124
|
+
onPathChange(`/blocks/${encodeURIComponent(blockName)}`);
|
|
125
|
+
}
|
|
126
|
+
})]
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_i18n","require","_element","_router","_compose","_components","_ui","_interopRequireDefault","_page","_lockUnlock","_styleBook","_constants","_jsxRuntime","useLocation","useHistory","unlock","routerPrivateApis","Menu","componentsPrivateApis","GLOBAL_STYLES_PATH_PREFIX","GlobalStylesPageActions","isStyleBookOpened","setIsStyleBookOpened","jsxs","trigger","jsx","Button","__next40pxDefaultSize","variant","size","children","__","RadioItem","value","checked","name","onChange","defaultChecked","ItemLabel","ItemHelpText","GlobalStylesUIWrapper","params","history","canvas","useState","isMobileViewport","useViewportMatch","pathWithPrefix","path","onPathChange","useMemo","processedPath","substring","length","newPath","push","Fragment","default","actions","className","title","enableResizing","showCloseButton","showTabs","isSelected","blockName","encodeURIComponent","startsWith","onSelect","STYLE_BOOK_COLOR_GROUPS","find","group","slug"],"sources":["@wordpress/edit-site/src/components/sidebar-global-styles-wrapper/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useMemo, useState } from '@wordpress/element';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { useViewportMatch } from '@wordpress/compose';\nimport {\n\tButton,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport GlobalStylesUI from '../global-styles/ui';\nimport Page from '../page';\nimport { unlock } from '../../lock-unlock';\nimport StyleBook from '../style-book';\nimport { STYLE_BOOK_COLOR_GROUPS } from '../style-book/constants';\n\nconst { useLocation, useHistory } = unlock( routerPrivateApis );\nconst { Menu } = unlock( componentsPrivateApis );\nconst GLOBAL_STYLES_PATH_PREFIX = '/wp_global_styles';\n\nconst GlobalStylesPageActions = ( {\n\tisStyleBookOpened,\n\tsetIsStyleBookOpened,\n} ) => {\n\treturn (\n\t\t<Menu\n\t\t\ttrigger={\n\t\t\t\t<Button __next40pxDefaultSize variant=\"tertiary\" size=\"compact\">\n\t\t\t\t\t{ __( 'Preview' ) }\n\t\t\t\t</Button>\n\t\t\t}\n\t\t>\n\t\t\t<Menu.RadioItem\n\t\t\t\tvalue\n\t\t\t\tchecked={ isStyleBookOpened }\n\t\t\t\tname=\"styles-preview-actions\"\n\t\t\t\tonChange={ () => setIsStyleBookOpened( true ) }\n\t\t\t\tdefaultChecked\n\t\t\t>\n\t\t\t\t<Menu.ItemLabel>{ __( 'Style book' ) }</Menu.ItemLabel>\n\t\t\t\t<Menu.ItemHelpText>\n\t\t\t\t\t{ __( 'Preview blocks and styles.' ) }\n\t\t\t\t</Menu.ItemHelpText>\n\t\t\t</Menu.RadioItem>\n\t\t\t<Menu.RadioItem\n\t\t\t\tvalue={ false }\n\t\t\t\tchecked={ ! isStyleBookOpened }\n\t\t\t\tname=\"styles-preview-actions\"\n\t\t\t\tonChange={ () => setIsStyleBookOpened( false ) }\n\t\t\t>\n\t\t\t\t<Menu.ItemLabel>{ __( 'Site' ) }</Menu.ItemLabel>\n\t\t\t\t<Menu.ItemHelpText>\n\t\t\t\t\t{ __( 'Preview your site.' ) }\n\t\t\t\t</Menu.ItemHelpText>\n\t\t\t</Menu.RadioItem>\n\t\t</Menu>\n\t);\n};\n\nexport default function GlobalStylesUIWrapper() {\n\tconst { params } = useLocation();\n\tconst history = useHistory();\n\tconst { canvas = 'view' } = params;\n\tconst [ isStyleBookOpened, setIsStyleBookOpened ] = useState( false );\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst pathWithPrefix = params.path;\n\tconst [ path, onPathChange ] = useMemo( () => {\n\t\tconst processedPath = pathWithPrefix.substring(\n\t\t\tGLOBAL_STYLES_PATH_PREFIX.length\n\t\t);\n\t\treturn [\n\t\t\tprocessedPath ? processedPath : '/',\n\t\t\t( newPath ) => {\n\t\t\t\thistory.push( {\n\t\t\t\t\tpath:\n\t\t\t\t\t\t! newPath || newPath === '/'\n\t\t\t\t\t\t\t? GLOBAL_STYLES_PATH_PREFIX\n\t\t\t\t\t\t\t: `${ GLOBAL_STYLES_PATH_PREFIX }${ newPath }`,\n\t\t\t\t} );\n\t\t\t},\n\t\t];\n\t}, [ pathWithPrefix, history ] );\n\n\treturn (\n\t\t<>\n\t\t\t<Page\n\t\t\t\tactions={\n\t\t\t\t\t! isMobileViewport ? (\n\t\t\t\t\t\t<GlobalStylesPageActions\n\t\t\t\t\t\t\tisStyleBookOpened={ isStyleBookOpened }\n\t\t\t\t\t\t\tsetIsStyleBookOpened={ setIsStyleBookOpened }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) : null\n\t\t\t\t}\n\t\t\t\tclassName=\"edit-site-styles\"\n\t\t\t\ttitle={ __( 'Styles' ) }\n\t\t\t>\n\t\t\t\t<GlobalStylesUI path={ path } onPathChange={ onPathChange } />\n\t\t\t</Page>\n\t\t\t{ canvas === 'view' && isStyleBookOpened && (\n\t\t\t\t<StyleBook\n\t\t\t\t\tenableResizing={ false }\n\t\t\t\t\tshowCloseButton={ false }\n\t\t\t\t\tshowTabs={ false }\n\t\t\t\t\tisSelected={ ( blockName ) =>\n\t\t\t\t\t\t// Match '/blocks/core%2Fbutton' and\n\t\t\t\t\t\t// '/blocks/core%2Fbutton/typography', but not\n\t\t\t\t\t\t// '/blocks/core%2Fbuttons'.\n\t\t\t\t\t\tpath ===\n\t\t\t\t\t\t\t`/wp_global_styles/blocks/${ encodeURIComponent(\n\t\t\t\t\t\t\t\tblockName\n\t\t\t\t\t\t\t) }` ||\n\t\t\t\t\t\tpath.startsWith(\n\t\t\t\t\t\t\t`/wp_global_styles/blocks/${ encodeURIComponent(\n\t\t\t\t\t\t\t\tblockName\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\tpath={ path }\n\t\t\t\t\tonSelect={ ( blockName ) => {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tSTYLE_BOOK_COLOR_GROUPS.find(\n\t\t\t\t\t\t\t\t( group ) => group.slug === blockName\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t// Go to color palettes Global Styles.\n\t\t\t\t\t\t\tonPathChange( '/colors/palette' );\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif ( blockName === 'typography' ) {\n\t\t\t\t\t\t\t// Go to typography Global Styles.\n\t\t\t\t\t\t\tonPathChange( '/typography' );\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Now go to the selected block.\n\t\t\t\t\t\tonPathChange(\n\t\t\t\t\t\t\t`/blocks/${ encodeURIComponent( blockName ) }`\n\t\t\t\t\t\t);\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAJ,OAAA;AAQA,IAAAK,GAAA,GAAAC,sBAAA,CAAAN,OAAA;AACA,IAAAO,KAAA,GAAAD,sBAAA,CAAAN,OAAA;AACA,IAAAQ,WAAA,GAAAR,OAAA;AACA,IAAAS,UAAA,GAAAH,sBAAA,CAAAN,OAAA;AACA,IAAAU,UAAA,GAAAV,OAAA;AAAkE,IAAAW,WAAA,GAAAX,OAAA;AAnBlE;AACA;AACA;;AAUA;AACA;AACA;;AAOA,MAAM;EAAEY,WAAW;EAAEC;AAAW,CA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18 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.SidebarNavigationItemGlobalStyles = SidebarNavigationItemGlobalStyles;
|
|
8
8
|
exports.default = SidebarNavigationScreenGlobalStyles;
|
|
9
9
|
var _i18n = require("@wordpress/i18n");
|
|
10
|
-
var _icons = require("@wordpress/icons");
|
|
11
10
|
var _data = require("@wordpress/data");
|
|
12
11
|
var _coreData = require("@wordpress/core-data");
|
|
13
|
-
var _compose = require("@wordpress/compose");
|
|
14
12
|
var _element = require("@wordpress/element");
|
|
15
|
-
var _editor = require("@wordpress/editor");
|
|
16
13
|
var _preferences = require("@wordpress/preferences");
|
|
17
14
|
var _router = require("@wordpress/router");
|
|
18
15
|
var _sidebarNavigationScreen = _interopRequireDefault(require("../sidebar-navigation-screen"));
|
|
19
16
|
var _lockUnlock = require("../../lock-unlock");
|
|
20
17
|
var _store = require("../../store");
|
|
21
|
-
var _sidebarButton = _interopRequireDefault(require("../sidebar-button"));
|
|
22
18
|
var _sidebarNavigationItem = _interopRequireDefault(require("../sidebar-navigation-item"));
|
|
23
|
-
var _styleBook = _interopRequireDefault(require("../style-book"));
|
|
24
19
|
var _useGlobalStylesRevisions = _interopRequireDefault(require("../global-styles/screen-revisions/use-global-styles-revisions"));
|
|
25
20
|
var _sidebarNavigationScreenDetailsFooter = _interopRequireDefault(require("../sidebar-navigation-screen-details-footer"));
|
|
26
|
-
var
|
|
21
|
+
var _sidebarNavigationScreenMain = require("../sidebar-navigation-screen-main");
|
|
27
22
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
28
23
|
/**
|
|
29
24
|
* WordPress dependencies
|
|
@@ -38,10 +33,6 @@ const {
|
|
|
38
33
|
useHistory
|
|
39
34
|
} = (0, _lockUnlock.unlock)(_router.privateApis);
|
|
40
35
|
function SidebarNavigationItemGlobalStyles(props) {
|
|
41
|
-
const {
|
|
42
|
-
openGeneralSidebar
|
|
43
|
-
} = (0, _data.useDispatch)(_store.store);
|
|
44
|
-
const history = useHistory();
|
|
45
36
|
const {
|
|
46
37
|
params
|
|
47
38
|
} = useLocation();
|
|
@@ -52,34 +43,19 @@ function SidebarNavigationItemGlobalStyles(props) {
|
|
|
52
43
|
params: {
|
|
53
44
|
path: '/wp_global_styles'
|
|
54
45
|
},
|
|
55
|
-
uid: "global-styles-navigation-item"
|
|
46
|
+
uid: "global-styles-navigation-item",
|
|
47
|
+
"aria-current": params.path && params.path.startsWith('/wp_global_styles')
|
|
56
48
|
});
|
|
57
49
|
}
|
|
58
50
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_sidebarNavigationItem.default, {
|
|
59
|
-
...props
|
|
60
|
-
onClick: () => {
|
|
61
|
-
// Switch to edit mode.
|
|
62
|
-
history.push({
|
|
63
|
-
...params,
|
|
64
|
-
canvas: 'edit'
|
|
65
|
-
}, undefined, {
|
|
66
|
-
transition: 'canvas-mode-edit-transition'
|
|
67
|
-
});
|
|
68
|
-
// Open global styles sidebar.
|
|
69
|
-
openGeneralSidebar('edit-site/global-styles');
|
|
70
|
-
}
|
|
51
|
+
...props
|
|
71
52
|
});
|
|
72
53
|
}
|
|
73
|
-
function SidebarNavigationScreenGlobalStyles({
|
|
74
|
-
backPath
|
|
75
|
-
}) {
|
|
54
|
+
function SidebarNavigationScreenGlobalStyles() {
|
|
76
55
|
const history = useHistory();
|
|
77
56
|
const {
|
|
78
57
|
params
|
|
79
58
|
} = useLocation();
|
|
80
|
-
const {
|
|
81
|
-
canvas = 'view'
|
|
82
|
-
} = params;
|
|
83
59
|
const {
|
|
84
60
|
revisions,
|
|
85
61
|
isLoading: isLoadingRevisions
|
|
@@ -87,21 +63,13 @@ function SidebarNavigationScreenGlobalStyles({
|
|
|
87
63
|
const {
|
|
88
64
|
openGeneralSidebar
|
|
89
65
|
} = (0, _data.useDispatch)(_store.store);
|
|
90
|
-
const {
|
|
91
|
-
setIsListViewOpened
|
|
92
|
-
} = (0, _data.useDispatch)(_editor.store);
|
|
93
|
-
const isMobileViewport = (0, _compose.useViewportMatch)('medium', '<');
|
|
94
66
|
const {
|
|
95
67
|
setEditorCanvasContainerView
|
|
96
68
|
} = (0, _lockUnlock.unlock)((0, _data.useDispatch)(_store.store));
|
|
97
69
|
const {
|
|
98
|
-
isStyleBookOpened,
|
|
99
70
|
revisionsCount
|
|
100
71
|
} = (0, _data.useSelect)(select => {
|
|
101
72
|
var _globalStyles$_links$;
|
|
102
|
-
const {
|
|
103
|
-
getEditorCanvasContainerView
|
|
104
|
-
} = (0, _lockUnlock.unlock)(select(_store.store));
|
|
105
73
|
const {
|
|
106
74
|
getEntityRecord,
|
|
107
75
|
__experimentalGetCurrentGlobalStylesId
|
|
@@ -109,7 +77,6 @@ function SidebarNavigationScreenGlobalStyles({
|
|
|
109
77
|
const globalStylesId = __experimentalGetCurrentGlobalStylesId();
|
|
110
78
|
const globalStyles = globalStylesId ? getEntityRecord('root', 'globalStyles', globalStylesId) : undefined;
|
|
111
79
|
return {
|
|
112
|
-
isStyleBookOpened: 'style-book' === getEditorCanvasContainerView(),
|
|
113
80
|
revisionsCount: (_globalStyles$_links$ = globalStyles?._links?.['version-history']?.[0]?.count) !== null && _globalStyles$_links$ !== void 0 ? _globalStyles$_links$ : 0
|
|
114
81
|
};
|
|
115
82
|
}, []);
|
|
@@ -125,14 +92,6 @@ function SidebarNavigationScreenGlobalStyles({
|
|
|
125
92
|
});
|
|
126
93
|
return Promise.all([setPreference('core', 'distractionFree', false), openGeneralSidebar('edit-site/global-styles')]);
|
|
127
94
|
}, [history, params, openGeneralSidebar, setPreference]);
|
|
128
|
-
const openStyleBook = (0, _element.useCallback)(async () => {
|
|
129
|
-
await openGlobalStyles();
|
|
130
|
-
// Open the Style Book once the canvas mode is set to edit,
|
|
131
|
-
// and the global styles sidebar is open. This ensures that
|
|
132
|
-
// the Style Book is not prematurely closed.
|
|
133
|
-
setEditorCanvasContainerView('style-book');
|
|
134
|
-
setIsListViewOpened(false);
|
|
135
|
-
}, [openGlobalStyles, setEditorCanvasContainerView, setIsListViewOpened]);
|
|
136
95
|
const openRevisions = (0, _element.useCallback)(async () => {
|
|
137
96
|
await openGlobalStyles();
|
|
138
97
|
// Open the global styles revisions once the canvas mode is set to edit,
|
|
@@ -146,36 +105,19 @@ function SidebarNavigationScreenGlobalStyles({
|
|
|
146
105
|
const hasRevisions = revisionsCount > 0;
|
|
147
106
|
const modifiedDateTime = revisions?.[0]?.modified;
|
|
148
107
|
const shouldShowGlobalStylesFooter = hasRevisions && !isLoadingRevisions && modifiedDateTime;
|
|
149
|
-
return /*#__PURE__*/(0, _jsxRuntime.
|
|
150
|
-
children:
|
|
151
|
-
title: (0, _i18n.__)('
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
content: /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
108
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
109
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_sidebarNavigationScreen.default, {
|
|
110
|
+
title: (0, _i18n.__)('Design'),
|
|
111
|
+
isRoot: true,
|
|
112
|
+
description: (0, _i18n.__)('Customize the appearance of your website using the block editor.'),
|
|
113
|
+
content: /*#__PURE__*/(0, _jsxRuntime.jsx)(_sidebarNavigationScreenMain.MainSidebarNavigationContent, {
|
|
114
|
+
activeItem: "styles-navigation-item"
|
|
115
|
+
}),
|
|
155
116
|
footer: shouldShowGlobalStylesFooter && /*#__PURE__*/(0, _jsxRuntime.jsx)(_sidebarNavigationScreenDetailsFooter.default, {
|
|
156
117
|
record: revisions?.[0],
|
|
157
118
|
onClick: openRevisions
|
|
158
|
-
}),
|
|
159
|
-
actions: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
160
|
-
children: [!isMobileViewport && /*#__PURE__*/(0, _jsxRuntime.jsx)(_sidebarButton.default, {
|
|
161
|
-
icon: _icons.seen,
|
|
162
|
-
label: (0, _i18n.__)('Style Book'),
|
|
163
|
-
onClick: () => setEditorCanvasContainerView(!isStyleBookOpened ? 'style-book' : undefined),
|
|
164
|
-
isPressed: isStyleBookOpened
|
|
165
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_sidebarButton.default, {
|
|
166
|
-
icon: _icons.edit,
|
|
167
|
-
label: (0, _i18n.__)('Edit styles'),
|
|
168
|
-
onClick: async () => await openGlobalStyles()
|
|
169
|
-
})]
|
|
170
119
|
})
|
|
171
|
-
})
|
|
172
|
-
enableResizing: false,
|
|
173
|
-
isSelected: () => false,
|
|
174
|
-
onClick: openStyleBook,
|
|
175
|
-
onSelect: openStyleBook,
|
|
176
|
-
showCloseButton: false,
|
|
177
|
-
showTabs: false
|
|
178
|
-
})]
|
|
120
|
+
})
|
|
179
121
|
});
|
|
180
122
|
}
|
|
181
123
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_i18n","require","_icons","_data","_coreData","_compose","_element","_editor","_preferences","_router","_sidebarNavigationScreen","_interopRequireDefault","_lockUnlock","_store","_sidebarButton","_sidebarNavigationItem","_styleBook","_useGlobalStylesRevisions","_sidebarNavigationScreenDetailsFooter","_content","_jsxRuntime","useLocation","useHistory","unlock","routerPrivateApis","SidebarNavigationItemGlobalStyles","props","openGeneralSidebar","useDispatch","editSiteStore","history","params","hasGlobalStyleVariations","useSelect","select","coreStore","__experimentalGetCurrentThemeGlobalStylesVariations","length","jsx","default","path","uid","onClick","push","canvas","undefined","transition","SidebarNavigationScreenGlobalStyles","backPath","revisions","isLoading","isLoadingRevisions","useGlobalStylesRevisions","setIsListViewOpened","editorStore","isMobileViewport","useViewportMatch","setEditorCanvasContainerView","isStyleBookOpened","revisionsCount","_globalStyles$_links$","getEditorCanvasContainerView","getEntityRecord","__experimentalGetCurrentGlobalStylesId","globalStylesId","globalStyles","_links","count","set","setPreference","preferencesStore","openGlobalStyles","useCallback","Promise","all","openStyleBook","openRevisions","hasRevisions","modifiedDateTime","modified","shouldShowGlobalStylesFooter","jsxs","Fragment","children","title","__","description","content","footer","record","actions","icon","seen","label","isPressed","edit","enableResizing","isSelected","onSelect","showCloseButton","showTabs"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-global-styles/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { edit, seen } from '@wordpress/icons';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { useCallback } from '@wordpress/element';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport { unlock } from '../../lock-unlock';\nimport { store as editSiteStore } from '../../store';\nimport SidebarButton from '../sidebar-button';\nimport SidebarNavigationItem from '../sidebar-navigation-item';\nimport StyleBook from '../style-book';\nimport useGlobalStylesRevisions from '../global-styles/screen-revisions/use-global-styles-revisions';\nimport SidebarNavigationScreenDetailsFooter from '../sidebar-navigation-screen-details-footer';\nimport SidebarNavigationScreenGlobalStylesContent from './content';\n\nconst { useLocation, useHistory } = unlock( routerPrivateApis );\n\nexport function SidebarNavigationItemGlobalStyles( props ) {\n\tconst { openGeneralSidebar } = useDispatch( editSiteStore );\n\tconst history = useHistory();\n\tconst { params } = useLocation();\n\tconst hasGlobalStyleVariations = useSelect(\n\t\t( select ) =>\n\t\t\t!! select(\n\t\t\t\tcoreStore\n\t\t\t).__experimentalGetCurrentThemeGlobalStylesVariations()?.length,\n\t\t[]\n\t);\n\tif ( hasGlobalStyleVariations ) {\n\t\treturn (\n\t\t\t<SidebarNavigationItem\n\t\t\t\t{ ...props }\n\t\t\t\tparams={ { path: '/wp_global_styles' } }\n\t\t\t\tuid=\"global-styles-navigation-item\"\n\t\t\t/>\n\t\t);\n\t}\n\treturn (\n\t\t<SidebarNavigationItem\n\t\t\t{ ...props }\n\t\t\tonClick={ () => {\n\t\t\t\t// Switch to edit mode.\n\t\t\t\thistory.push(\n\t\t\t\t\t{\n\t\t\t\t\t\t...params,\n\t\t\t\t\t\tcanvas: 'edit',\n\t\t\t\t\t},\n\t\t\t\t\tundefined,\n\t\t\t\t\t{\n\t\t\t\t\t\ttransition: 'canvas-mode-edit-transition',\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t\t// Open global styles sidebar.\n\t\t\t\topenGeneralSidebar( 'edit-site/global-styles' );\n\t\t\t} }\n\t\t/>\n\t);\n}\n\nexport default function SidebarNavigationScreenGlobalStyles( { backPath } ) {\n\tconst history = useHistory();\n\tconst { params } = useLocation();\n\tconst { canvas = 'view' } = params;\n\tconst { revisions, isLoading: isLoadingRevisions } =\n\t\tuseGlobalStylesRevisions();\n\tconst { openGeneralSidebar } = useDispatch( editSiteStore );\n\tconst { setIsListViewOpened } = useDispatch( editorStore );\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst { setEditorCanvasContainerView } = unlock(\n\t\tuseDispatch( editSiteStore )\n\t);\n\tconst { isStyleBookOpened, revisionsCount } = useSelect( ( select ) => {\n\t\tconst { getEditorCanvasContainerView } = unlock(\n\t\t\tselect( editSiteStore )\n\t\t);\n\t\tconst { getEntityRecord, __experimentalGetCurrentGlobalStylesId } =\n\t\t\tselect( coreStore );\n\t\tconst globalStylesId = __experimentalGetCurrentGlobalStylesId();\n\t\tconst globalStyles = globalStylesId\n\t\t\t? getEntityRecord( 'root', 'globalStyles', globalStylesId )\n\t\t\t: undefined;\n\t\treturn {\n\t\t\tisStyleBookOpened: 'style-book' === getEditorCanvasContainerView(),\n\t\t\trevisionsCount:\n\t\t\t\tglobalStyles?._links?.[ 'version-history' ]?.[ 0 ]?.count ?? 0,\n\t\t};\n\t}, [] );\n\tconst { set: setPreference } = useDispatch( preferencesStore );\n\n\tconst openGlobalStyles = useCallback( async () => {\n\t\thistory.push(\n\t\t\t{\n\t\t\t\t...params,\n\t\t\t\tcanvas: 'edit',\n\t\t\t},\n\t\t\tundefined,\n\t\t\t{\n\t\t\t\ttransition: 'canvas-mode-edit-transition',\n\t\t\t}\n\t\t);\n\t\treturn Promise.all( [\n\t\t\tsetPreference( 'core', 'distractionFree', false ),\n\t\t\topenGeneralSidebar( 'edit-site/global-styles' ),\n\t\t] );\n\t}, [ history, params, openGeneralSidebar, setPreference ] );\n\n\tconst openStyleBook = useCallback( async () => {\n\t\tawait openGlobalStyles();\n\t\t// Open the Style Book once the canvas mode is set to edit,\n\t\t// and the global styles sidebar is open. This ensures that\n\t\t// the Style Book is not prematurely closed.\n\t\tsetEditorCanvasContainerView( 'style-book' );\n\t\tsetIsListViewOpened( false );\n\t}, [\n\t\topenGlobalStyles,\n\t\tsetEditorCanvasContainerView,\n\t\tsetIsListViewOpened,\n\t] );\n\n\tconst openRevisions = useCallback( async () => {\n\t\tawait openGlobalStyles();\n\t\t// Open the global styles revisions once the canvas mode is set to edit,\n\t\t// and the global styles sidebar is open. The global styles UI is responsible\n\t\t// for redirecting to the revisions screen once the editor canvas container\n\t\t// has been set to 'global-styles-revisions'.\n\t\tsetEditorCanvasContainerView( 'global-styles-revisions' );\n\t}, [ openGlobalStyles, setEditorCanvasContainerView ] );\n\n\t// If there are no revisions, do not render a footer.\n\tconst hasRevisions = revisionsCount > 0;\n\tconst modifiedDateTime = revisions?.[ 0 ]?.modified;\n\tconst shouldShowGlobalStylesFooter =\n\t\thasRevisions && ! isLoadingRevisions && modifiedDateTime;\n\n\treturn (\n\t\t<>\n\t\t\t<SidebarNavigationScreen\n\t\t\t\ttitle={ __( 'Styles' ) }\n\t\t\t\tdescription={ __(\n\t\t\t\t\t'Choose a different style combination for the theme styles.'\n\t\t\t\t) }\n\t\t\t\tbackPath={ backPath }\n\t\t\t\tcontent={ <SidebarNavigationScreenGlobalStylesContent /> }\n\t\t\t\tfooter={\n\t\t\t\t\tshouldShowGlobalStylesFooter && (\n\t\t\t\t\t\t<SidebarNavigationScreenDetailsFooter\n\t\t\t\t\t\t\trecord={ revisions?.[ 0 ] }\n\t\t\t\t\t\t\tonClick={ openRevisions }\n\t\t\t\t\t\t/>\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\tactions={\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ ! isMobileViewport && (\n\t\t\t\t\t\t\t<SidebarButton\n\t\t\t\t\t\t\t\ticon={ seen }\n\t\t\t\t\t\t\t\tlabel={ __( 'Style Book' ) }\n\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\tsetEditorCanvasContainerView(\n\t\t\t\t\t\t\t\t\t\t! isStyleBookOpened\n\t\t\t\t\t\t\t\t\t\t\t? 'style-book'\n\t\t\t\t\t\t\t\t\t\t\t: undefined\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\tisPressed={ isStyleBookOpened }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<SidebarButton\n\t\t\t\t\t\t\ticon={ edit }\n\t\t\t\t\t\t\tlabel={ __( 'Edit styles' ) }\n\t\t\t\t\t\t\tonClick={ async () => await openGlobalStyles() }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</>\n\t\t\t\t}\n\t\t\t/>\n\t\t\t{ isStyleBookOpened && ! isMobileViewport && canvas === 'view' && (\n\t\t\t\t<StyleBook\n\t\t\t\t\tenableResizing={ false }\n\t\t\t\t\tisSelected={ () => false }\n\t\t\t\t\tonClick={ openStyleBook }\n\t\t\t\t\tonSelect={ openStyleBook }\n\t\t\t\t\tshowCloseButton={ false }\n\t\t\t\t\tshowTabs={ false }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,QA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e,4BAA4B,CAC3B,CAAEC,iBAAiB,GAChB,YAAY,GACZb,SACJ,CACA;UACDiD,SAAS,EAAGpC;QAAmB,CAC/B,CACD,eACD,IAAAtC,WAAA,CAAAkB,GAAA,EAACxB,cAAA,CAAAyB,OAAa;UACboD,IAAI,EAAGI,WAAM;UACbF,KAAK,EAAG,IAAAR,QAAE,EAAE,aAAc,CAAG;UAC7B3C,OAAO,EAAG,MAAAA,CAAA,KAAY,MAAM6B,gBAAgB,CAAC;QAAG,CAChD,CAAC;MAAA,CACD;IACF,CACD,CAAC,EACAb,iBAAiB,IAAI,CAAEH,gBAAgB,IAAIX,MAAM,KAAK,MAAM,iBAC7D,IAAAxB,WAAA,CAAAkB,GAAA,EAACtB,UAAA,CAAAuB,OAAS;MACTyD,cAAc,EAAG,KAAO;MACxBC,UAAU,EAAGA,CAAA,KAAM,KAAO;MAC1BvD,OAAO,EAAGiC,aAAe;MACzBuB,QAAQ,EAAGvB,aAAe;MAC1BwB,eAAe,EAAG,KAAO;MACzBC,QAAQ,EAAG;IAAO,CAClB,CACD;EAAA,CACA,CAAC;AAEL","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_i18n","require","_data","_coreData","_element","_preferences","_router","_sidebarNavigationScreen","_interopRequireDefault","_lockUnlock","_store","_sidebarNavigationItem","_useGlobalStylesRevisions","_sidebarNavigationScreenDetailsFooter","_sidebarNavigationScreenMain","_jsxRuntime","useLocation","useHistory","unlock","routerPrivateApis","SidebarNavigationItemGlobalStyles","props","params","hasGlobalStyleVariations","useSelect","select","coreStore","__experimentalGetCurrentThemeGlobalStylesVariations","length","jsx","default","path","uid","startsWith","SidebarNavigationScreenGlobalStyles","history","revisions","isLoading","isLoadingRevisions","useGlobalStylesRevisions","openGeneralSidebar","useDispatch","editSiteStore","setEditorCanvasContainerView","revisionsCount","_globalStyles$_links$","getEntityRecord","__experimentalGetCurrentGlobalStylesId","globalStylesId","globalStyles","undefined","_links","count","set","setPreference","preferencesStore","openGlobalStyles","useCallback","push","canvas","transition","Promise","all","openRevisions","hasRevisions","modifiedDateTime","modified","shouldShowGlobalStylesFooter","Fragment","children","title","__","isRoot","description","content","MainSidebarNavigationContent","activeItem","footer","record","onClick"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-global-styles/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useCallback } from '@wordpress/element';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport { unlock } from '../../lock-unlock';\nimport { store as editSiteStore } from '../../store';\nimport SidebarNavigationItem from '../sidebar-navigation-item';\nimport useGlobalStylesRevisions from '../global-styles/screen-revisions/use-global-styles-revisions';\nimport SidebarNavigationScreenDetailsFooter from '../sidebar-navigation-screen-details-footer';\nimport { MainSidebarNavigationContent } from '../sidebar-navigation-screen-main';\n\nconst { useLocation, useHistory } = unlock( routerPrivateApis );\n\nexport function SidebarNavigationItemGlobalStyles( props ) {\n\tconst { params } = useLocation();\n\tconst hasGlobalStyleVariations = useSelect(\n\t\t( select ) =>\n\t\t\t!! select(\n\t\t\t\tcoreStore\n\t\t\t).__experimentalGetCurrentThemeGlobalStylesVariations()?.length,\n\t\t[]\n\t);\n\tif ( hasGlobalStyleVariations ) {\n\t\treturn (\n\t\t\t<SidebarNavigationItem\n\t\t\t\t{ ...props }\n\t\t\t\tparams={ { path: '/wp_global_styles' } }\n\t\t\t\tuid=\"global-styles-navigation-item\"\n\t\t\t\taria-current={\n\t\t\t\t\tparams.path && params.path.startsWith( '/wp_global_styles' )\n\t\t\t\t}\n\t\t\t/>\n\t\t);\n\t}\n\treturn <SidebarNavigationItem { ...props } />;\n}\n\nexport default function SidebarNavigationScreenGlobalStyles() {\n\tconst history = useHistory();\n\tconst { params } = useLocation();\n\tconst { revisions, isLoading: isLoadingRevisions } =\n\t\tuseGlobalStylesRevisions();\n\tconst { openGeneralSidebar } = useDispatch( editSiteStore );\n\tconst { setEditorCanvasContainerView } = unlock(\n\t\tuseDispatch( editSiteStore )\n\t);\n\tconst { revisionsCount } = useSelect( ( select ) => {\n\t\tconst { getEntityRecord, __experimentalGetCurrentGlobalStylesId } =\n\t\t\tselect( coreStore );\n\t\tconst globalStylesId = __experimentalGetCurrentGlobalStylesId();\n\t\tconst globalStyles = globalStylesId\n\t\t\t? getEntityRecord( 'root', 'globalStyles', globalStylesId )\n\t\t\t: undefined;\n\t\treturn {\n\t\t\trevisionsCount:\n\t\t\t\tglobalStyles?._links?.[ 'version-history' ]?.[ 0 ]?.count ?? 0,\n\t\t};\n\t}, [] );\n\tconst { set: setPreference } = useDispatch( preferencesStore );\n\n\tconst openGlobalStyles = useCallback( async () => {\n\t\thistory.push(\n\t\t\t{\n\t\t\t\t...params,\n\t\t\t\tcanvas: 'edit',\n\t\t\t},\n\t\t\tundefined,\n\t\t\t{\n\t\t\t\ttransition: 'canvas-mode-edit-transition',\n\t\t\t}\n\t\t);\n\t\treturn Promise.all( [\n\t\t\tsetPreference( 'core', 'distractionFree', false ),\n\t\t\topenGeneralSidebar( 'edit-site/global-styles' ),\n\t\t] );\n\t}, [ history, params, openGeneralSidebar, setPreference ] );\n\n\tconst openRevisions = useCallback( async () => {\n\t\tawait openGlobalStyles();\n\t\t// Open the global styles revisions once the canvas mode is set to edit,\n\t\t// and the global styles sidebar is open. The global styles UI is responsible\n\t\t// for redirecting to the revisions screen once the editor canvas container\n\t\t// has been set to 'global-styles-revisions'.\n\t\tsetEditorCanvasContainerView( 'global-styles-revisions' );\n\t}, [ openGlobalStyles, setEditorCanvasContainerView ] );\n\n\t// If there are no revisions, do not render a footer.\n\tconst hasRevisions = revisionsCount > 0;\n\tconst modifiedDateTime = revisions?.[ 0 ]?.modified;\n\tconst shouldShowGlobalStylesFooter =\n\t\thasRevisions && ! isLoadingRevisions && modifiedDateTime;\n\treturn (\n\t\t<>\n\t\t\t<SidebarNavigationScreen\n\t\t\t\ttitle={ __( 'Design' ) }\n\t\t\t\tisRoot\n\t\t\t\tdescription={ __(\n\t\t\t\t\t'Customize the appearance of your website using the block editor.'\n\t\t\t\t) }\n\t\t\t\tcontent={\n\t\t\t\t\t<MainSidebarNavigationContent activeItem=\"styles-navigation-item\" />\n\t\t\t\t}\n\t\t\t\tfooter={\n\t\t\t\t\tshouldShowGlobalStylesFooter && (\n\t\t\t\t\t\t<SidebarNavigationScreenDetailsFooter\n\t\t\t\t\t\t\trecord={ revisions?.[ 0 ] }\n\t\t\t\t\t\t\tonClick={ openRevisions }\n\t\t\t\t\t\t/>\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t/>\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AAKA,IAAAM,wBAAA,GAAAC,sBAAA,CAAAP,OAAA;AACA,IAAAQ,WAAA,GAAAR,OAAA;AACA,IAAAS,MAAA,GAAAT,OAAA;AACA,IAAAU,sBAAA,GAAAH,sBAAA,CAAAP,OAAA;AACA,IAAAW,yBAAA,GAAAJ,sBAAA,CAAAP,OAAA;AACA,IAAAY,qCAAA,GAAAL,sBAAA,CAAAP,OAAA;AACA,IAAAa,4BAAA,GAAAb,OAAA;AAAiF,IAAAc,WAAA,GAAAd,OAAA;AAnBjF;AACA;AACA;;AAQA;AACA;AACA;;AASA,MAAM;EAAEe,WAAW;EAAEC;AAAW,CAAC,GAAG,IAAAC,kBAAM,EAAEC,mBAAkB,CAAC;AAExD,SAASC,iCAAiCA,CAAEC,KAAK,EAAG;EAC1D,MAAM;IAAEC;E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