@wordpress/edit-site 6.30.1-next.a730c9c8c.0 → 6.31.1-next.233ccab9b.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/add-new-template/add-custom-template-modal-content.js +3 -2
- package/build/components/add-new-template/add-custom-template-modal-content.js.map +1 -1
- package/build/components/add-new-template/index.js +1 -5
- package/build/components/add-new-template/index.js.map +1 -1
- package/build/components/add-new-template/utils.js +26 -87
- package/build/components/add-new-template/utils.js.map +1 -1
- package/build/components/dataviews-actions/index.js +51 -1
- package/build/components/dataviews-actions/index.js.map +1 -1
- package/build/components/editor/index.js +1 -1
- package/build/components/editor/index.js.map +1 -1
- package/build/components/editor/use-resolve-edited-entity.js +42 -14
- package/build/components/editor/use-resolve-edited-entity.js.map +1 -1
- package/build/components/global-styles/screen-css.js +2 -3
- package/build/components/global-styles/screen-css.js.map +1 -1
- package/build/components/global-styles/screen-root.js +3 -35
- package/build/components/global-styles/screen-root.js.map +1 -1
- package/build/components/page-templates/fields.js +65 -5
- package/build/components/page-templates/fields.js.map +1 -1
- package/build/components/page-templates/hooks.js +1 -1
- package/build/components/page-templates/hooks.js.map +1 -1
- package/build/components/page-templates/index.js +103 -29
- package/build/components/page-templates/index.js.map +1 -1
- package/build/components/sidebar-global-styles-wrapper/index.js +45 -13
- package/build/components/sidebar-global-styles-wrapper/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-templates-browse/content.js +11 -5
- package/build/components/sidebar-navigation-screen-templates-browse/content.js.map +1 -1
- package/build/components/site-editor-routes/index.js +1 -1
- package/build/components/site-editor-routes/index.js.map +1 -1
- package/build/components/site-editor-routes/template-item.js +29 -23
- package/build/components/site-editor-routes/template-item.js.map +1 -1
- package/build-module/components/add-new-template/add-custom-template-modal-content.js +3 -2
- package/build-module/components/add-new-template/add-custom-template-modal-content.js.map +1 -1
- package/build-module/components/add-new-template/index.js +2 -6
- package/build-module/components/add-new-template/index.js.map +1 -1
- package/build-module/components/add-new-template/utils.js +26 -87
- package/build-module/components/add-new-template/utils.js.map +1 -1
- package/build-module/components/dataviews-actions/index.js +49 -0
- package/build-module/components/dataviews-actions/index.js.map +1 -1
- package/build-module/components/editor/index.js +1 -1
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/editor/use-resolve-edited-entity.js +42 -14
- package/build-module/components/editor/use-resolve-edited-entity.js.map +1 -1
- package/build-module/components/global-styles/screen-css.js +2 -3
- package/build-module/components/global-styles/screen-css.js.map +1 -1
- package/build-module/components/global-styles/screen-root.js +4 -36
- package/build-module/components/global-styles/screen-root.js.map +1 -1
- package/build-module/components/page-templates/fields.js +65 -5
- package/build-module/components/page-templates/fields.js.map +1 -1
- package/build-module/components/page-templates/hooks.js +1 -1
- package/build-module/components/page-templates/hooks.js.map +1 -1
- package/build-module/components/page-templates/index.js +105 -31
- package/build-module/components/page-templates/index.js.map +1 -1
- package/build-module/components/sidebar-global-styles-wrapper/index.js +48 -16
- package/build-module/components/sidebar-global-styles-wrapper/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-templates-browse/content.js +11 -5
- package/build-module/components/sidebar-navigation-screen-templates-browse/content.js.map +1 -1
- package/build-module/components/site-editor-routes/index.js +2 -2
- package/build-module/components/site-editor-routes/index.js.map +1 -1
- package/build-module/components/site-editor-routes/template-item.js +28 -22
- package/build-module/components/site-editor-routes/template-item.js.map +1 -1
- package/package.json +41 -41
- package/src/components/add-new-template/add-custom-template-modal-content.js +3 -4
- package/src/components/add-new-template/index.js +1 -8
- package/src/components/add-new-template/utils.js +36 -121
- package/src/components/dataviews-actions/index.js +51 -0
- package/src/components/editor/index.js +1 -0
- package/src/components/editor/use-resolve-edited-entity.js +54 -7
- package/src/components/global-styles/screen-css.js +4 -5
- package/src/components/global-styles/screen-root.js +5 -51
- package/src/components/page-templates/fields.js +70 -4
- package/src/components/page-templates/hooks.js +1 -1
- package/src/components/page-templates/index.js +160 -57
- package/src/components/sidebar-global-styles-wrapper/index.js +62 -16
- package/src/components/sidebar-navigation-screen-templates-browse/content.js +17 -7
- package/src/components/site-editor-routes/index.js +2 -1
- package/src/components/site-editor-routes/template-item.js +34 -26
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["clsx","Icon","__experimentalHStack","HStack","__","useState","useMemo","decodeEntities","parse","BlockPreview","privateApis","blockEditorPrivateApis","EditorProvider","useAddedBy","usePatternSettings","unlock","jsx","_jsx","jsxs","_jsxs","useGlobalStyle","PreviewField","item","settings","backgroundColor","blocks","content","raw","isEmpty","length","post","children","className","style","Async","previewField","label","id","render","enableSorting","descriptionField","description","enableGlobalSearch","AuthorField","isImageLoaded","setIsImageLoaded","text","icon","imageUrl","type","alignment","spacing","onLoad","alt","src","authorField","getValue","author_text"],"sources":["@wordpress/edit-site/src/components/page-templates/fields.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { Icon, __experimentalHStack as HStack } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useState, useMemo } from '@wordpress/element';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { parse } from '@wordpress/blocks';\nimport {\n\tBlockPreview,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { EditorProvider } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport { useAddedBy } from './hooks';\nimport usePatternSettings from '../page-patterns/use-pattern-settings';\nimport { unlock } from '../../lock-unlock';\n\nconst { useGlobalStyle } = unlock( blockEditorPrivateApis );\n\nfunction PreviewField( { item } ) {\n\tconst settings = usePatternSettings();\n\tconst [ backgroundColor = 'white' ] = useGlobalStyle( 'color.background' );\n\tconst blocks = useMemo( () => {\n\t\treturn parse( item.content.raw );\n\t}, [ item.content.raw ] );\n\n\tconst isEmpty = ! blocks?.length;\n\t// Wrap everything in a block editor provider to ensure 'styles' that are needed\n\t// for the previews are synced between the site editor store and the block editor store.\n\t// Additionally we need to have the `__experimentalBlockPatterns` setting in order to\n\t// render patterns inside the previews.\n\t// TODO: Same approach is used in the patterns list and it becomes obvious that some of\n\t// the block editor settings are needed in context where we don't have the block editor.\n\t// Explore how we can solve this in a better way.\n\treturn (\n\t\t<EditorProvider post={ item } settings={ settings }>\n\t\t\t<div\n\t\t\t\tclassName=\"page-templates-preview-field\"\n\t\t\t\tstyle={ { backgroundColor } }\n\t\t\t>\n\t\t\t\t{ isEmpty && __( 'Empty template' ) }\n\t\t\t\t{ ! isEmpty && (\n\t\t\t\t\t<BlockPreview.Async>\n\t\t\t\t\t\t<BlockPreview blocks={ blocks } />\n\t\t\t\t\t</BlockPreview.Async>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t</EditorProvider>\n\t);\n}\n\nexport const previewField = {\n\tlabel: __( 'Preview' ),\n\tid: 'preview',\n\trender: PreviewField,\n\tenableSorting: false,\n};\n\nexport const descriptionField = {\n\tlabel: __( 'Description' ),\n\tid: 'description',\n\trender: ( { item } ) => {\n\t\treturn item.description && decodeEntities( item.description );\n\t},\n\tenableSorting: false,\n\tenableGlobalSearch: true,\n};\n\nfunction AuthorField( { item } ) {\n\tconst [ isImageLoaded, setIsImageLoaded ] = useState( false );\n\tconst { text, icon, imageUrl } = useAddedBy( item.type, item.id );\n\n\treturn (\n\t\t<HStack alignment=\"left\" spacing={ 0 }>\n\t\t\t{ imageUrl && (\n\t\t\t\t<div\n\t\t\t\t\tclassName={ clsx( 'page-templates-author-field__avatar', {\n\t\t\t\t\t\t'is-loaded': isImageLoaded,\n\t\t\t\t\t} ) }\n\t\t\t\t>\n\t\t\t\t\t<img\n\t\t\t\t\t\tonLoad={ () => setIsImageLoaded( true ) }\n\t\t\t\t\t\talt=\"\"\n\t\t\t\t\t\tsrc={ imageUrl }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t{ ! imageUrl && (\n\t\t\t\t<div className=\"page-templates-author-field__icon\">\n\t\t\t\t\t<Icon icon={ icon } />\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t<span className=\"page-templates-author-field__name\">{ text }</span>\n\t\t</HStack>\n\t);\n}\n\nexport const authorField = {\n\tlabel: __( 'Author' ),\n\tid: 'author',\n\tgetValue: ( { item } ) => item.author_text,\n\trender: AuthorField,\n};\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,IAAI,EAAEC,oBAAoB,IAAIC,MAAM,QAAQ,uBAAuB;AAC5E,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,QAAQ,EAAEC,OAAO,QAAQ,oBAAoB;AACtD,SAASC,cAAc,QAAQ,0BAA0B;AACzD,SAASC,KAAK,QAAQ,mBAAmB;AACzC,SACCC,YAAY,EACZC,WAAW,IAAIC,sBAAsB,QAC/B,yBAAyB;AAChC,SAASC,cAAc,QAAQ,mBAAmB;;AAElD;AACA;AACA;AACA,SAASC,UAAU,QAAQ,SAAS;AACpC,OAAOC,kBAAkB,MAAM,uCAAuC;AACtE,SAASC,MAAM,QAAQ,mBAAmB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAE3C,MAAM;EAAEC;AAAe,CAAC,GAAGL,MAAM,CAAEJ,sBAAuB,CAAC;AAE3D,SAASU,YAAYA,CAAE;EAAEC;AAAK,CAAC,EAAG;EACjC,MAAMC,QAAQ,GAAGT,kBAAkB,CAAC,CAAC;EACrC,MAAM,CAAEU,eAAe,GAAG,OAAO,CAAE,GAAGJ,cAAc,CAAE,kBAAmB,CAAC;EAC1E,MAAMK,MAAM,GAAGnB,OAAO,CAAE,MAAM;IAC7B,OAAOE,KAAK,CAAEc,IAAI,CAACI,OAAO,CAACC,GAAI,CAAC;EACjC,CAAC,EAAE,CAAEL,IAAI,CAACI,OAAO,CAACC,GAAG,CAAG,CAAC;EAEzB,MAAMC,OAAO,GAAG,CAAEH,MAAM,EAAEI,MAAM;EACh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C+C,SAAS,EAAC,MAAM;IAACC,OAAO,EAAG,CAAG;IAAApB,QAAA,GACnCiB,QAAQ,iBACT/B,IAAA;MACCe,SAAS,EAAGhC,IAAI,CAAE,qCAAqC,EAAE;QACxD,WAAW,EAAE4C;MACd,CAAE,CAAG;MAAAb,QAAA,eAELd,IAAA;QACCmC,MAAM,EAAGA,CAAA,KAAMP,gBAAgB,CAAE,IAAK,CAAG;QACzCQ,GAAG,EAAC,EAAE;QACNC,GAAG,EAAGN;MAAU,CAChB;IAAC,CACE,CACL,EACC,CAAEA,QAAQ,iBACX/B,IAAA;MAAKe,SAAS,EAAC,mCAAmC;MAAAD,QAAA,eACjDd,IAAA,CAAChB,IAAI;QAAC8C,IAAI,EAAGA;MAAM,CAAE;IAAC,CAClB,CACL,eACD9B,IAAA;MAAMe,SAAS,EAAC,mCAAmC;MAAAD,QAAA,EAAGe;IAAI,CAAQ,CAAC;EAAA,CAC5D,CAAC;AAEX;AAEA,OAAO,MAAMS,WAAW,GAAG;EAC1BnB,KAAK,EAAEhC,EAAE,CAAE,QAAS,CAAC;EACrBiC,EAAE,EAAE,QAAQ;EACZmB,QAAQ,EAAEA,CAAE;IAAElC;EAAK,CAAC,KAAMA,IAAI,CAACmC,WAAW;EAC1CnB,MAAM,EAAEK;AACT,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["clsx","Icon","__experimentalHStack","HStack","privateApis","componentsPrivateApis","__","useState","useMemo","decodeEntities","parse","BlockPreview","blockEditorPrivateApis","EditorProvider","corePrivateApis","useAddedBy","useDefaultTemplateTypes","usePatternSettings","unlock","jsx","_jsx","jsxs","_jsxs","useGlobalStyle","Badge","useEntityRecordsWithPermissions","useAllDefaultTemplateTypes","defaultTemplateTypes","records","staticRecords","per_page","filter","record","is_custom","map","slug","title","rendered","description","PreviewField","item","settings","backgroundColor","blocks","content","raw","isEmpty","length","post","children","className","style","Async","previewField","label","id","render","enableSorting","descriptionField","RenderDescription","defaultTemplateType","find","type","enableGlobalSearch","AuthorField","isImageLoaded","setIsImageLoaded","text","icon","imageUrl","alignment","spacing","onLoad","alt","src","authorField","getValue","_item$author_text","author_text","author","activeField","_isActive","Render","isActive","intent","slugField"],"sources":["@wordpress/edit-site/src/components/page-templates/fields.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tIcon,\n\t__experimentalHStack as HStack,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useState, useMemo } from '@wordpress/element';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { parse } from '@wordpress/blocks';\nimport {\n\tBlockPreview,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { EditorProvider } from '@wordpress/editor';\nimport { privateApis as corePrivateApis } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { useAddedBy } from './hooks';\nimport { useDefaultTemplateTypes } from '../add-new-template/utils';\nimport usePatternSettings from '../page-patterns/use-pattern-settings';\nimport { unlock } from '../../lock-unlock';\n\nconst { useGlobalStyle } = unlock( blockEditorPrivateApis );\nconst { Badge } = unlock( componentsPrivateApis );\nconst { useEntityRecordsWithPermissions } = unlock( corePrivateApis );\n\nfunction useAllDefaultTemplateTypes() {\n\tconst defaultTemplateTypes = useDefaultTemplateTypes();\n\tconst { records: staticRecords } = useEntityRecordsWithPermissions(\n\t\t'postType',\n\t\t'wp_registered_template',\n\t\t{ per_page: -1 }\n\t);\n\treturn [\n\t\t...defaultTemplateTypes,\n\t\t...staticRecords\n\t\t\t?.filter( ( record ) => ! record.is_custom )\n\t\t\t.map( ( record ) => {\n\t\t\t\treturn {\n\t\t\t\t\tslug: record.slug,\n\t\t\t\t\ttitle: record.title.rendered,\n\t\t\t\t\tdescription: record.description,\n\t\t\t\t};\n\t\t\t} ),\n\t];\n}\n\nfunction PreviewField( { item } ) {\n\tconst settings = usePatternSettings();\n\tconst [ backgroundColor = 'white' ] = useGlobalStyle( 'color.background' );\n\tconst blocks = useMemo( () => {\n\t\treturn parse( item.content.raw );\n\t}, [ item.content.raw ] );\n\n\tconst isEmpty = ! blocks?.length;\n\t// Wrap everything in a block editor provider to ensure 'styles' that are needed\n\t// for the previews are synced between the site editor store and the block editor store.\n\t// Additionally we need to have the `__experimentalBlockPatterns` setting in order to\n\t// render patterns inside the previews.\n\t// TODO: Same approach is used in the patterns list and it becomes obvious that some of\n\t// the block editor settings are needed in context where we don't have the block editor.\n\t// Explore how we can solve this in a better way.\n\treturn (\n\t\t<EditorProvider post={ item } settings={ settings }>\n\t\t\t<div\n\t\t\t\tclassName=\"page-templates-preview-field\"\n\t\t\t\tstyle={ { backgroundColor } }\n\t\t\t>\n\t\t\t\t{ isEmpty && __( 'Empty template' ) }\n\t\t\t\t{ ! isEmpty && (\n\t\t\t\t\t<BlockPreview.Async>\n\t\t\t\t\t\t<BlockPreview blocks={ blocks } />\n\t\t\t\t\t</BlockPreview.Async>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t</EditorProvider>\n\t);\n}\n\nexport const previewField = {\n\tlabel: __( 'Preview' ),\n\tid: 'preview',\n\trender: PreviewField,\n\tenableSorting: false,\n};\n\nexport const descriptionField = {\n\tlabel: __( 'Description' ),\n\tid: 'description',\n\trender: function RenderDescription( { item } ) {\n\t\tconst defaultTemplateTypes = useAllDefaultTemplateTypes();\n\t\tconst defaultTemplateType = defaultTemplateTypes.find(\n\t\t\t( type ) => type.slug === item.slug\n\t\t);\n\t\treturn item.description\n\t\t\t? decodeEntities( item.description )\n\t\t\t: defaultTemplateType?.description;\n\t},\n\tenableSorting: false,\n\tenableGlobalSearch: true,\n};\n\nfunction AuthorField( { item } ) {\n\tconst [ isImageLoaded, setIsImageLoaded ] = useState( false );\n\tconst { text, icon, imageUrl } = useAddedBy( item.type, item.id );\n\n\treturn (\n\t\t<HStack alignment=\"left\" spacing={ 0 }>\n\t\t\t{ imageUrl && (\n\t\t\t\t<div\n\t\t\t\t\tclassName={ clsx( 'page-templates-author-field__avatar', {\n\t\t\t\t\t\t'is-loaded': isImageLoaded,\n\t\t\t\t\t} ) }\n\t\t\t\t>\n\t\t\t\t\t<img\n\t\t\t\t\t\tonLoad={ () => setIsImageLoaded( true ) }\n\t\t\t\t\t\talt=\"\"\n\t\t\t\t\t\tsrc={ imageUrl }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t{ ! imageUrl && (\n\t\t\t\t<div className=\"page-templates-author-field__icon\">\n\t\t\t\t\t<Icon icon={ icon } />\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t<span className=\"page-templates-author-field__name\">{ text }</span>\n\t\t</HStack>\n\t);\n}\n\nexport const authorField = {\n\tlabel: __( 'Author' ),\n\tid: 'author',\n\tgetValue: ( { item } ) => item.author_text ?? item.author,\n\trender: AuthorField,\n};\n\nexport const activeField = {\n\tlabel: __( 'Status' ),\n\tid: 'active',\n\tgetValue: ( { item } ) => item._isActive,\n\trender: function Render( { item } ) {\n\t\tconst isActive = item._isActive;\n\t\treturn (\n\t\t\t<Badge intent={ isActive ? 'success' : 'default' }>\n\t\t\t\t{ isActive ? __( 'Active' ) : __( 'Inactive' ) }\n\t\t\t</Badge>\n\t\t);\n\t},\n};\n\nexport const slugField = {\n\tlabel: __( 'Template Type' ),\n\tid: 'slug',\n\tgetValue: ( { item } ) => item.slug,\n\trender: function Render( { item } ) {\n\t\tconst defaultTemplateTypes = useAllDefaultTemplateTypes();\n\t\tconst defaultTemplateType = defaultTemplateTypes.find(\n\t\t\t( type ) => type.slug === item.slug\n\t\t);\n\t\treturn (\n\t\t\tdefaultTemplateType?.title ||\n\t\t\t// translators: %s is the slug of a custom template.\n\t\t\t__( 'Custom' )\n\t\t);\n\t},\n};\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SACCC,IAAI,EACJC,oBAAoB,IAAIC,MAAM,EAC9BC,WAA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AACkC,IAAI,CAClDC,IAAI,IAAMA,IAAI,CAAC3B,IAAI,KAAKK,IAAI,CAACL,IAChC,CAAC;IACD,OACCyB,mBAAmB,EAAExB,KAAK;IAC1B;IACA9B,EAAE,CAAE,QAAS,CAAC;EAEhB;AACD,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["store","coreStore","useSelect","commentAuthorAvatar","authorIcon","layout","themeIcon","plugins","pluginIcon","globe","globeIcon","TEMPLATE_ORIGINS","useAddedBy","postType","postId","select","getEntityRecord","getUser","getEditedEntityRecord","template","originalSource","original_source","authorText","author_text","type","icon","text","isCustomized","source","custom","siteData","imageUrl","site_logo","source_url","undefined","user","author","avatar_urls"],"sources":["@wordpress/edit-site/src/components/page-templates/hooks.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport {\n\tcommentAuthorAvatar as authorIcon,\n\tlayout as themeIcon,\n\tplugins as pluginIcon,\n\tglobe as globeIcon,\n} from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { TEMPLATE_ORIGINS } from '../../utils/constants';\n\n/** @typedef {'wp_template'|'wp_template_part'} TemplateType */\n\n/**\n * @typedef {'theme'|'plugin'|'site'|'user'} AddedByType\n *\n * @typedef AddedByData\n * @type {Object}\n * @property {AddedByType} type The type of the data.\n * @property {JSX.Element} icon The icon to display.\n * @property {string} [imageUrl] The optional image URL to display.\n * @property {string} [text] The text to display.\n * @property {boolean} isCustomized Whether the template has been customized.\n *\n * @param {TemplateType} postType The template post type.\n * @param {number} postId The template post id.\n * @return {AddedByData} The added by object or null.\n */\nexport function useAddedBy( postType, postId ) {\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecord, getUser, getEditedEntityRecord } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst template = getEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tpostType,\n\t\t\t\tpostId\n\t\t\t);\n\t\t\tconst originalSource = template?.original_source;\n\t\t\tconst authorText = template?.author_text;\n\n\t\t\tswitch ( originalSource ) {\n\t\t\t\tcase 'theme': {\n\t\t\t\t\treturn {\n\t\t\t\t\t\ttype: originalSource,\n\t\t\t\t\t\ticon: themeIcon,\n\t\t\t\t\t\ttext: authorText,\n\t\t\t\t\t\tisCustomized:\n\t\t\t\t\t\t\ttemplate.source === TEMPLATE_ORIGINS.custom,\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\tcase 'plugin': {\n\t\t\t\t\treturn {\n\t\t\t\t\t\ttype: originalSource,\n\t\t\t\t\t\ticon: pluginIcon,\n\t\t\t\t\t\ttext: authorText,\n\t\t\t\t\t\tisCustomized:\n\t\t\t\t\t\t\ttemplate.source === TEMPLATE_ORIGINS.custom,\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\tcase 'site': {\n\t\t\t\t\tconst siteData = getEntityRecord(\n\t\t\t\t\t\t'root',\n\t\t\t\t\t\t'__unstableBase'\n\t\t\t\t\t);\n\t\t\t\t\treturn {\n\t\t\t\t\t\ttype: originalSource,\n\t\t\t\t\t\ticon: globeIcon,\n\t\t\t\t\t\timageUrl: siteData?.site_logo\n\t\t\t\t\t\t\t? getEntityRecord(\n\t\t\t\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t\t\t\t'attachment',\n\t\t\t\t\t\t\t\t\tsiteData.site_logo\n\t\t\t\t\t\t\t )?.source_url\n\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t\ttext: authorText,\n\t\t\t\t\t\tisCustomized: false,\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\tdefault: {\n\t\t\t\t\tconst user = getUser( template.author );\n\t\t\t\t\treturn {\n\t\t\t\t\t\ttype: 'user',\n\t\t\t\t\t\ticon: authorIcon,\n\t\t\t\t\t\timageUrl: user?.avatar_urls?.[ 48 ],\n\t\t\t\t\t\ttext: authorText,\n\t\t\t\t\t\tisCustomized: false,\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QAAE;UACZ,MAAMC,QAAQ,GAAGd,eAAe,CAC/B,MAAM,EACN,gBACD,CAAC;UACD,OAAO;YACNQ,IAAI,EAAEJ,cAAc;YACpBK,IAAI,EAAEf,SAAS;YACfqB,QAAQ,EAAED,QAAQ,EAAEE,SAAS,GAC1BhB,eAAe,CACf,UAAU,EACV,YAAY,EACZc,QAAQ,CAACE,SACT,CAAC,EAAEC,UAAU,GACbC,SAAS;YACZR,IAAI,EAAEJ,UAAU;YAChBK,YAAY,EAAE;UACf,CAAC;QACF;MACA;QAAS;UACR,MAAMQ,IAAI,GAAGlB,OAAO,CAAEE,QAAQ,CAACiB,MAAO,CAAC;UACvC,OAAO;YACNZ,IAAI,EAAE,MAAM;YACZC,IAAI,EAAErB,UAAU;YAChB2B,QAAQ,EAAEI,IAAI,EAAEE,WAAW,GAAI,EAAE,CAAE;YACnCX,IAAI,EAAEJ,UAAU;
|
|
1
|
+
{"version":3,"names":["store","coreStore","useSelect","commentAuthorAvatar","authorIcon","layout","themeIcon","plugins","pluginIcon","globe","globeIcon","TEMPLATE_ORIGINS","useAddedBy","postType","postId","select","getEntityRecord","getUser","getEditedEntityRecord","template","originalSource","original_source","authorText","author_text","type","icon","text","isCustomized","source","custom","siteData","imageUrl","site_logo","source_url","undefined","user","author","avatar_urls","name"],"sources":["@wordpress/edit-site/src/components/page-templates/hooks.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport {\n\tcommentAuthorAvatar as authorIcon,\n\tlayout as themeIcon,\n\tplugins as pluginIcon,\n\tglobe as globeIcon,\n} from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { TEMPLATE_ORIGINS } from '../../utils/constants';\n\n/** @typedef {'wp_template'|'wp_template_part'} TemplateType */\n\n/**\n * @typedef {'theme'|'plugin'|'site'|'user'} AddedByType\n *\n * @typedef AddedByData\n * @type {Object}\n * @property {AddedByType} type The type of the data.\n * @property {JSX.Element} icon The icon to display.\n * @property {string} [imageUrl] The optional image URL to display.\n * @property {string} [text] The text to display.\n * @property {boolean} isCustomized Whether the template has been customized.\n *\n * @param {TemplateType} postType The template post type.\n * @param {number} postId The template post id.\n * @return {AddedByData} The added by object or null.\n */\nexport function useAddedBy( postType, postId ) {\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecord, getUser, getEditedEntityRecord } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst template = getEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tpostType,\n\t\t\t\tpostId\n\t\t\t);\n\t\t\tconst originalSource = template?.original_source;\n\t\t\tconst authorText = template?.author_text;\n\n\t\t\tswitch ( originalSource ) {\n\t\t\t\tcase 'theme': {\n\t\t\t\t\treturn {\n\t\t\t\t\t\ttype: originalSource,\n\t\t\t\t\t\ticon: themeIcon,\n\t\t\t\t\t\ttext: authorText,\n\t\t\t\t\t\tisCustomized:\n\t\t\t\t\t\t\ttemplate.source === TEMPLATE_ORIGINS.custom,\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\tcase 'plugin': {\n\t\t\t\t\treturn {\n\t\t\t\t\t\ttype: originalSource,\n\t\t\t\t\t\ticon: pluginIcon,\n\t\t\t\t\t\ttext: authorText,\n\t\t\t\t\t\tisCustomized:\n\t\t\t\t\t\t\ttemplate.source === TEMPLATE_ORIGINS.custom,\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\tcase 'site': {\n\t\t\t\t\tconst siteData = getEntityRecord(\n\t\t\t\t\t\t'root',\n\t\t\t\t\t\t'__unstableBase'\n\t\t\t\t\t);\n\t\t\t\t\treturn {\n\t\t\t\t\t\ttype: originalSource,\n\t\t\t\t\t\ticon: globeIcon,\n\t\t\t\t\t\timageUrl: siteData?.site_logo\n\t\t\t\t\t\t\t? getEntityRecord(\n\t\t\t\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t\t\t\t'attachment',\n\t\t\t\t\t\t\t\t\tsiteData.site_logo\n\t\t\t\t\t\t\t )?.source_url\n\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t\ttext: authorText,\n\t\t\t\t\t\tisCustomized: false,\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\tdefault: {\n\t\t\t\t\tconst user = getUser( template.author );\n\t\t\t\t\treturn {\n\t\t\t\t\t\ttype: 'user',\n\t\t\t\t\t\ticon: authorIcon,\n\t\t\t\t\t\timageUrl: user?.avatar_urls?.[ 48 ],\n\t\t\t\t\t\ttext: authorText ?? user?.name,\n\t\t\t\t\t\tisCustomized: false,\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t[ postType, postId ]\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SACCC,mBAAmB,IAAIC,UAAU,EACjCC,MAAM,IAAIC,SAAS,EACnBC,OAAO,IAAIC,UAAU,EACrBC,KAAK,IAAIC,SAAS,QACZ,kBAAkB;;AAEzB;AACA;AACA;AACA,SAASC,gBAAgB,QAAQ,uBAAuB;;AAExD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,UAAUA,CAAEC,QAAQ,EAAEC,MAAM,EAAG;EAC9C,OAAOZ,SAAS,CACba,MAAM,IAAM;IACb,MAAM;MAAEC,eAAe;MAAEC,OAAO;MAAEC;IAAsB,CAAC,GACxDH,MAAM,CAAEd,SAAU,CAAC;IACpB,MAAMkB,QAAQ,GAAGD,qBAAqB,CACrC,UAAU,EACVL,QAAQ,EACRC,MACD,CAAC;IACD,MAAMM,cAAc,GAAGD,QAAQ,EAAEE,eAAe;IAChD,MAAMC,UAAU,GAAGH,QAAQ,EAAEI,WAAW;IAExC,QAASH,cAAc;MACtB,KAAK,OAAO;QAAE;UACb,OAAO;YACNI,IAAI,EAAEJ,cAAc;YACpBK,IAAI,EAAEnB,SAAS;YACfoB,IAAI,EAAEJ,UAAU;YAChBK,YAAY,EACXR,QAAQ,CAACS,MAAM,KAAKjB,gBAAgB,CAACkB;UACvC,CAAC;QACF;MACA,KAAK,QAAQ;QAAE;UACd,OAAO;YACNL,IAAI,EAAEJ,cAAc;YACpBK,IAAI,EAAEjB,UAAU;YAChBkB,IAAI,EAAEJ,UAAU;YAChBK,YAAY,EACXR,QAAQ,CAACS,MAAM,KAAKjB,gBAAgB,CAACkB;UACvC,CAAC;QACF;MACA,KAAK,MAAM;QAAE;UACZ,MAAMC,QAAQ,GAAGd,eAAe,CAC/B,MAAM,EACN,gBACD,CAAC;UACD,OAAO;YACNQ,IAAI,EAAEJ,cAAc;YACpBK,IAAI,EAAEf,SAAS;YACfqB,QAAQ,EAAED,QAAQ,EAAEE,SAAS,GAC1BhB,eAAe,CACf,UAAU,EACV,YAAY,EACZc,QAAQ,CAACE,SACT,CAAC,EAAEC,UAAU,GACbC,SAAS;YACZR,IAAI,EAAEJ,UAAU;YAChBK,YAAY,EAAE;UACf,CAAC;QACF;MACA;QAAS;UACR,MAAMQ,IAAI,GAAGlB,OAAO,CAAEE,QAAQ,CAACiB,MAAO,CAAC;UACvC,OAAO;YACNZ,IAAI,EAAE,MAAM;YACZC,IAAI,EAAErB,UAAU;YAChB2B,QAAQ,EAAEI,IAAI,EAAEE,WAAW,GAAI,EAAE,CAAE;YACnCX,IAAI,EAAEJ,UAAU,aAAVA,UAAU,cAAVA,UAAU,GAAIa,IAAI,EAAEG,IAAI;YAC9BX,YAAY,EAAE;UACf,CAAC;QACF;IACD;EACD,CAAC,EACD,CAAEd,QAAQ,EAAEC,MAAM,CACnB,CAAC;AACF","ignoreList":[]}
|
|
@@ -3,11 +3,13 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { __ } from '@wordpress/i18n';
|
|
5
5
|
import { useState, useMemo, useCallback, useEffect } from '@wordpress/element';
|
|
6
|
-
import { privateApis as corePrivateApis } from '@wordpress/core-data';
|
|
6
|
+
import { privateApis as corePrivateApis, store as coreStore } from '@wordpress/core-data';
|
|
7
7
|
import { DataViews, filterSortAndPaginate } from '@wordpress/dataviews';
|
|
8
8
|
import { privateApis as routerPrivateApis } from '@wordpress/router';
|
|
9
9
|
import { privateApis as editorPrivateApis } from '@wordpress/editor';
|
|
10
10
|
import { addQueryArgs } from '@wordpress/url';
|
|
11
|
+
import { useSelect } from '@wordpress/data';
|
|
12
|
+
import { useEvent } from '@wordpress/compose';
|
|
11
13
|
|
|
12
14
|
/**
|
|
13
15
|
* Internal dependencies
|
|
@@ -16,9 +18,8 @@ import Page from '../page';
|
|
|
16
18
|
import AddNewTemplate from '../add-new-template';
|
|
17
19
|
import { TEMPLATE_POST_TYPE, OPERATOR_IS_ANY, LAYOUT_GRID, LAYOUT_TABLE, LAYOUT_LIST } from '../../utils/constants';
|
|
18
20
|
import { unlock } from '../../lock-unlock';
|
|
19
|
-
import { useEditPostAction } from '../dataviews-actions';
|
|
20
|
-
import { authorField, descriptionField, previewField } from './fields';
|
|
21
|
-
import { useEvent } from '@wordpress/compose';
|
|
21
|
+
import { useEditPostAction, useSetActiveTemplateAction } from '../dataviews-actions';
|
|
22
|
+
import { authorField, descriptionField, previewField, activeField, slugField } from './fields';
|
|
22
23
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
23
24
|
const {
|
|
24
25
|
usePostActions,
|
|
@@ -31,7 +32,6 @@ const {
|
|
|
31
32
|
const {
|
|
32
33
|
useEntityRecordsWithPermissions
|
|
33
34
|
} = unlock(corePrivateApis);
|
|
34
|
-
const EMPTY_ARRAY = [];
|
|
35
35
|
const defaultLayouts = {
|
|
36
36
|
[LAYOUT_TABLE]: {
|
|
37
37
|
showMedia: false
|
|
@@ -55,7 +55,7 @@ const DEFAULT_VIEW = {
|
|
|
55
55
|
titleField: 'title',
|
|
56
56
|
descriptionField: 'description',
|
|
57
57
|
mediaField: 'preview',
|
|
58
|
-
fields: ['author'],
|
|
58
|
+
fields: ['author', 'active', 'slug'],
|
|
59
59
|
filters: [],
|
|
60
60
|
...defaultLayouts[LAYOUT_GRID]
|
|
61
61
|
};
|
|
@@ -65,7 +65,7 @@ export default function PageTemplates() {
|
|
|
65
65
|
query
|
|
66
66
|
} = useLocation();
|
|
67
67
|
const {
|
|
68
|
-
activeView = '
|
|
68
|
+
activeView = 'active',
|
|
69
69
|
layout,
|
|
70
70
|
postId
|
|
71
71
|
} = query;
|
|
@@ -75,7 +75,7 @@ export default function PageTemplates() {
|
|
|
75
75
|
return {
|
|
76
76
|
...DEFAULT_VIEW,
|
|
77
77
|
type: usedType,
|
|
78
|
-
filters:
|
|
78
|
+
filters: !['active', 'user'].includes(activeView) ? [{
|
|
79
79
|
field: 'author',
|
|
80
80
|
operator: 'isAny',
|
|
81
81
|
value: [activeView]
|
|
@@ -97,19 +97,95 @@ export default function PageTemplates() {
|
|
|
97
97
|
useEffect(() => {
|
|
98
98
|
setView(currentView => ({
|
|
99
99
|
...currentView,
|
|
100
|
-
filters:
|
|
100
|
+
filters: !['active', 'user'].includes(activeView) ? [{
|
|
101
101
|
field: 'author',
|
|
102
102
|
operator: OPERATOR_IS_ANY,
|
|
103
103
|
value: [activeView]
|
|
104
104
|
}] : []
|
|
105
105
|
}));
|
|
106
106
|
}, [setView, activeView]);
|
|
107
|
+
const activeTemplatesOption = useSelect(select => select(coreStore).getEntityRecord('root', 'site')?.active_templates);
|
|
108
|
+
// Todo: this will have to be better so that we're not fetching all the
|
|
109
|
+
// records all the time. Active templates query will need to move server
|
|
110
|
+
// side.
|
|
107
111
|
const {
|
|
108
|
-
records,
|
|
109
|
-
isResolving:
|
|
112
|
+
records: userRecords,
|
|
113
|
+
isResolving: isLoadingUserRecords
|
|
110
114
|
} = useEntityRecordsWithPermissions('postType', TEMPLATE_POST_TYPE, {
|
|
111
115
|
per_page: -1
|
|
112
116
|
});
|
|
117
|
+
const {
|
|
118
|
+
records: staticRecords,
|
|
119
|
+
isResolving: isLoadingStaticData
|
|
120
|
+
} = useEntityRecordsWithPermissions('postType', 'wp_registered_template', {
|
|
121
|
+
per_page: -1
|
|
122
|
+
});
|
|
123
|
+
const activeTemplates = useMemo(() => {
|
|
124
|
+
const _active = [...staticRecords].filter(record => !record.is_custom);
|
|
125
|
+
if (activeTemplatesOption) {
|
|
126
|
+
for (const activeSlug in activeTemplatesOption) {
|
|
127
|
+
const activeId = activeTemplatesOption[activeSlug];
|
|
128
|
+
if (activeId === false) {
|
|
129
|
+
// Remove the template from the array.
|
|
130
|
+
const index = _active.findIndex(template => template.slug === activeSlug);
|
|
131
|
+
if (index !== -1) {
|
|
132
|
+
_active.splice(index, 1);
|
|
133
|
+
}
|
|
134
|
+
} else {
|
|
135
|
+
// Replace the template in the array.
|
|
136
|
+
const template = userRecords.find(({
|
|
137
|
+
id
|
|
138
|
+
}) => id === activeId);
|
|
139
|
+
if (template) {
|
|
140
|
+
const index = _active.findIndex(({
|
|
141
|
+
slug
|
|
142
|
+
}) => slug === template.slug);
|
|
143
|
+
if (index !== -1) {
|
|
144
|
+
_active[index] = template;
|
|
145
|
+
} else {
|
|
146
|
+
_active.push(template);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
return _active;
|
|
153
|
+
}, [userRecords, staticRecords, activeTemplatesOption]);
|
|
154
|
+
let _records;
|
|
155
|
+
let isLoadingData;
|
|
156
|
+
if (activeView === 'active') {
|
|
157
|
+
_records = activeTemplates;
|
|
158
|
+
isLoadingData = isLoadingUserRecords || isLoadingStaticData;
|
|
159
|
+
} else if (activeView === 'user') {
|
|
160
|
+
_records = userRecords;
|
|
161
|
+
isLoadingData = isLoadingUserRecords;
|
|
162
|
+
} else {
|
|
163
|
+
_records = staticRecords;
|
|
164
|
+
isLoadingData = isLoadingStaticData;
|
|
165
|
+
}
|
|
166
|
+
const records = useMemo(() => {
|
|
167
|
+
return _records.map(record => ({
|
|
168
|
+
...record,
|
|
169
|
+
_isActive: typeof record.id === 'string' ? activeTemplatesOption[record.slug] === record.id || activeTemplatesOption[record.slug] === undefined : Object.values(activeTemplatesOption).includes(record.id)
|
|
170
|
+
}));
|
|
171
|
+
}, [_records, activeTemplatesOption]);
|
|
172
|
+
const users = useSelect(select => {
|
|
173
|
+
const {
|
|
174
|
+
getUser
|
|
175
|
+
} = select(coreStore);
|
|
176
|
+
return records.reduce((acc, record) => {
|
|
177
|
+
if (record.author_text) {
|
|
178
|
+
if (!acc[record.author_text]) {
|
|
179
|
+
acc[record.author_text] = record.author_text;
|
|
180
|
+
}
|
|
181
|
+
} else if (record.author) {
|
|
182
|
+
if (!acc[record.author]) {
|
|
183
|
+
acc[record.author] = getUser(record.author);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
return acc;
|
|
187
|
+
}, {});
|
|
188
|
+
}, [records]);
|
|
113
189
|
const history = useHistory();
|
|
114
190
|
const onChangeSelection = useCallback(items => {
|
|
115
191
|
setSelection(items);
|
|
@@ -119,23 +195,22 @@ export default function PageTemplates() {
|
|
|
119
195
|
}));
|
|
120
196
|
}
|
|
121
197
|
}, [history, path, view?.type]);
|
|
122
|
-
const
|
|
123
|
-
|
|
124
|
-
|
|
198
|
+
const fields = useMemo(() => {
|
|
199
|
+
const _fields = [previewField, templateTitleField, descriptionField, activeField, slugField];
|
|
200
|
+
const elements = [];
|
|
201
|
+
for (const author in users) {
|
|
202
|
+
var _users$author$id, _users$author$name;
|
|
203
|
+
elements.push({
|
|
204
|
+
value: (_users$author$id = users[author]?.id) !== null && _users$author$id !== void 0 ? _users$author$id : author,
|
|
205
|
+
label: (_users$author$name = users[author]?.name) !== null && _users$author$name !== void 0 ? _users$author$name : author
|
|
206
|
+
});
|
|
125
207
|
}
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
208
|
+
_fields.push({
|
|
209
|
+
...authorField,
|
|
210
|
+
elements
|
|
129
211
|
});
|
|
130
|
-
return
|
|
131
|
-
|
|
132
|
-
label: author
|
|
133
|
-
}));
|
|
134
|
-
}, [records]);
|
|
135
|
-
const fields = useMemo(() => [previewField, templateTitleField, descriptionField, {
|
|
136
|
-
...authorField,
|
|
137
|
-
elements: authors
|
|
138
|
-
}], [authors]);
|
|
212
|
+
return _fields;
|
|
213
|
+
}, [users]);
|
|
139
214
|
const {
|
|
140
215
|
data,
|
|
141
216
|
paginationInfo
|
|
@@ -147,7 +222,8 @@ export default function PageTemplates() {
|
|
|
147
222
|
context: 'list'
|
|
148
223
|
});
|
|
149
224
|
const editAction = useEditPostAction();
|
|
150
|
-
const
|
|
225
|
+
const setActiveTemplateAction = useSetActiveTemplateAction();
|
|
226
|
+
const actions = useMemo(() => activeView === 'user' ? [setActiveTemplateAction, editAction, ...postTypeActions] : [setActiveTemplateAction, ...postTypeActions], [postTypeActions, setActiveTemplateAction, editAction, activeView]);
|
|
151
227
|
const onChangeView = useEvent(newView => {
|
|
152
228
|
setView(newView);
|
|
153
229
|
if (newView.type !== layout) {
|
|
@@ -170,10 +246,8 @@ export default function PageTemplates() {
|
|
|
170
246
|
onChangeView: onChangeView,
|
|
171
247
|
onChangeSelection: onChangeSelection,
|
|
172
248
|
isItemClickable: () => true,
|
|
173
|
-
onClickItem:
|
|
174
|
-
id
|
|
175
|
-
}) => {
|
|
176
|
-
history.navigate(`/wp_template/${id}?canvas=edit`);
|
|
249
|
+
onClickItem: item => {
|
|
250
|
+
history.navigate(`/${item.type}/${item.id}?canvas=edit`);
|
|
177
251
|
},
|
|
178
252
|
selection: selection,
|
|
179
253
|
defaultLayouts: defaultLayouts
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__","useState","useMemo","useCallback","useEffect","privateApis","corePrivateApis","DataViews","filterSortAndPaginate","routerPrivateApis","editorPrivateApis","addQueryArgs","Page","AddNewTemplate","TEMPLATE_POST_TYPE","OPERATOR_IS_ANY","LAYOUT_GRID","LAYOUT_TABLE","LAYOUT_LIST","unlock","useEditPostAction","authorField","descriptionField","previewField","useEvent","jsx","_jsx","usePostActions","templateTitleField","useHistory","useLocation","useEntityRecordsWithPermissions","EMPTY_ARRAY","defaultLayouts","showMedia","DEFAULT_VIEW","type","search","page","perPage","sort","field","direction","titleField","mediaField","fields","filters","PageTemplates","path","query","activeView","layout","postId","selection","setSelection","defaultView","usedType","operator","value","view","setView","currentView","records","isResolving","isLoadingData","per_page","history","onChangeSelection","items","navigate","length","undefined","authors","authorsSet","Set","forEach","template","add","author_text","Array","from","map","author","label","elements","data","paginationInfo","postTypeActions","postType","context","editAction","actions","onChangeView","newView","className","title","children","isLoading","isItemClickable","onClickItem","id"],"sources":["@wordpress/edit-site/src/components/page-templates/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useState, useMemo, useCallback, useEffect } from '@wordpress/element';\nimport { privateApis as corePrivateApis } from '@wordpress/core-data';\nimport { DataViews, filterSortAndPaginate } from '@wordpress/dataviews';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\nimport { addQueryArgs } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport Page from '../page';\nimport AddNewTemplate from '../add-new-template';\nimport {\n\tTEMPLATE_POST_TYPE,\n\tOPERATOR_IS_ANY,\n\tLAYOUT_GRID,\n\tLAYOUT_TABLE,\n\tLAYOUT_LIST,\n} from '../../utils/constants';\nimport { unlock } from '../../lock-unlock';\nimport { useEditPostAction } from '../dataviews-actions';\nimport { authorField, descriptionField, previewField } from './fields';\nimport { useEvent } from '@wordpress/compose';\n\nconst { usePostActions, templateTitleField } = unlock( editorPrivateApis );\nconst { useHistory, useLocation } = unlock( routerPrivateApis );\nconst { useEntityRecordsWithPermissions } = unlock( corePrivateApis );\n\nconst EMPTY_ARRAY = [];\n\nconst defaultLayouts = {\n\t[ LAYOUT_TABLE ]: {\n\t\tshowMedia: false,\n\t},\n\t[ LAYOUT_GRID ]: {\n\t\tshowMedia: true,\n\t},\n\t[ LAYOUT_LIST ]: {\n\t\tshowMedia: false,\n\t},\n};\n\nconst DEFAULT_VIEW = {\n\ttype: LAYOUT_GRID,\n\tsearch: '',\n\tpage: 1,\n\tperPage: 20,\n\tsort: {\n\t\tfield: 'title',\n\t\tdirection: 'asc',\n\t},\n\ttitleField: 'title',\n\tdescriptionField: 'description',\n\tmediaField: 'preview',\n\tfields: [ 'author' ],\n\tfilters: [],\n\t...defaultLayouts[ LAYOUT_GRID ],\n};\n\nexport default function PageTemplates() {\n\tconst { path, query } = useLocation();\n\tconst { activeView = 'all', layout, postId } = query;\n\tconst [ selection, setSelection ] = useState( [ postId ] );\n\n\tconst defaultView = useMemo( () => {\n\t\tconst usedType = layout ?? DEFAULT_VIEW.type;\n\t\treturn {\n\t\t\t...DEFAULT_VIEW,\n\t\t\ttype: usedType,\n\t\t\tfilters:\n\t\t\t\tactiveView !== 'all'\n\t\t\t\t\t? [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tfield: 'author',\n\t\t\t\t\t\t\t\toperator: 'isAny',\n\t\t\t\t\t\t\t\tvalue: [ activeView ],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t ]\n\t\t\t\t\t: [],\n\t\t\t...defaultLayouts[ usedType ],\n\t\t};\n\t}, [ layout, activeView ] );\n\tconst [ view, setView ] = useState( defaultView );\n\n\t// Sync the layout from the URL to the view state.\n\tuseEffect( () => {\n\t\tsetView( ( currentView ) => ( {\n\t\t\t...currentView,\n\t\t\ttype: layout ?? DEFAULT_VIEW.type,\n\t\t} ) );\n\t}, [ setView, layout ] );\n\n\t// Sync the active view from the URL to the view state.\n\tuseEffect( () => {\n\t\tsetView( ( currentView ) => ( {\n\t\t\t...currentView,\n\t\t\tfilters:\n\t\t\t\tactiveView !== 'all'\n\t\t\t\t\t? [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tfield: 'author',\n\t\t\t\t\t\t\t\toperator: OPERATOR_IS_ANY,\n\t\t\t\t\t\t\t\tvalue: [ activeView ],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t ]\n\t\t\t\t\t: [],\n\t\t} ) );\n\t}, [ setView, activeView ] );\n\n\tconst { records, isResolving: isLoadingData } =\n\t\tuseEntityRecordsWithPermissions( 'postType', TEMPLATE_POST_TYPE, {\n\t\t\tper_page: -1,\n\t\t} );\n\tconst history = useHistory();\n\tconst onChangeSelection = useCallback(\n\t\t( items ) => {\n\t\t\tsetSelection( items );\n\t\t\tif ( view?.type === LAYOUT_LIST ) {\n\t\t\t\thistory.navigate(\n\t\t\t\t\taddQueryArgs( path, {\n\t\t\t\t\t\tpostId: items.length === 1 ? items[ 0 ] : undefined,\n\t\t\t\t\t} )\n\t\t\t\t);\n\t\t\t}\n\t\t},\n\t\t[ history, path, view?.type ]\n\t);\n\n\tconst authors = useMemo( () => {\n\t\tif ( ! records ) {\n\t\t\treturn EMPTY_ARRAY;\n\t\t}\n\t\tconst authorsSet = new Set();\n\t\trecords.forEach( ( template ) => {\n\t\t\tauthorsSet.add( template.author_text );\n\t\t} );\n\t\treturn Array.from( authorsSet ).map( ( author ) => ( {\n\t\t\tvalue: author,\n\t\t\tlabel: author,\n\t\t} ) );\n\t}, [ records ] );\n\n\tconst fields = useMemo(\n\t\t() => [\n\t\t\tpreviewField,\n\t\t\ttemplateTitleField,\n\t\t\tdescriptionField,\n\t\t\t{\n\t\t\t\t...authorField,\n\t\t\t\telements: authors,\n\t\t\t},\n\t\t],\n\t\t[ authors ]\n\t);\n\n\tconst { data, paginationInfo } = useMemo( () => {\n\t\treturn filterSortAndPaginate( records, view, fields );\n\t}, [ records, view, fields ] );\n\n\tconst postTypeActions = usePostActions( {\n\t\tpostType: TEMPLATE_POST_TYPE,\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 onChangeView = useEvent( ( newView ) => {\n\t\tsetView( newView );\n\t\tif ( newView.type !== layout ) {\n\t\t\thistory.navigate(\n\t\t\t\taddQueryArgs( path, {\n\t\t\t\t\tlayout: newView.type,\n\t\t\t\t} )\n\t\t\t);\n\t\t}\n\t} );\n\n\treturn (\n\t\t<Page\n\t\t\tclassName=\"edit-site-page-templates\"\n\t\t\ttitle={ __( 'Templates' ) }\n\t\t\tactions={ <AddNewTemplate /> }\n\t\t>\n\t\t\t<DataViews\n\t\t\t\tkey={ activeView }\n\t\t\t\tpaginationInfo={ paginationInfo }\n\t\t\t\tfields={ fields }\n\t\t\t\tactions={ actions }\n\t\t\t\tdata={ data }\n\t\t\t\tisLoading={ isLoadingData }\n\t\t\t\tview={ view }\n\t\t\t\tonChangeView={ onChangeView }\n\t\t\t\tonChangeSelection={ onChangeSelection }\n\t\t\t\tisItemClickable={ () => true }\n\t\t\t\tonClickItem={ ( { id } ) => {\n\t\t\t\t\thistory.navigate( `/wp_template/${ id }?canvas=edit` );\n\t\t\t\t} }\n\t\t\t\tselection={ selection }\n\t\t\t\tdefaultLayouts={ defaultLayouts }\n\t\t\t/>\n\t\t</Page>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,QAAQ,EAAEC,OAAO,EAAEC,WAAW,EAAEC,SAAS,QAAQ,oBAAoB;AAC9E,SAASC,WAAW,IAAIC,eAAe,QAAQ,sBAAsB;AACrE,SAASC,SAAS,EAAEC,qBAAqB,QAAQ,sBAAsB;AACvE,SAASH,WAAW,IAAII,iBAAiB,QAAQ,mBAAmB;AACpE,SAASJ,WAAW,IAAIK,iBAAiB,QAAQ,mBAAmB;AACpE,SAASC,YAAY,QAAQ,gBAAgB;;AAE7C;AACA;AACA;AACA,OAAOC,IAAI,MAAM,SAAS;AAC1B,OAAOC,cAAc,MAAM,qBAAqB;AAChD,SACCC,kBAAkB,EAClBC,eAAe,EACfC,WAAW,EACXC,YAAY,EACZC,WAAW,QACL,uBAAuB;AAC9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,EAAGA,CAAA,KAAM,IAAM;MAC9BC,WAAW,EAAGA,CAAE;QAAEC;MAAG,CAAC,KAAM;QAC3BlC,OAAO,CAACG,QAAQ,CAAE,gBAAiB+B,EAAE,cAAgB,CAAC;MACvD,CAAG;MACH/C,SAAS,EAAGA,SAAW;MACvBpB,cAAc,EAAGA;IAAgB,GAd3BiB,UAeN;EAAC,CACG,CAAC;AAET","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["__","useState","useMemo","useCallback","useEffect","privateApis","corePrivateApis","store","coreStore","DataViews","filterSortAndPaginate","routerPrivateApis","editorPrivateApis","addQueryArgs","useSelect","useEvent","Page","AddNewTemplate","TEMPLATE_POST_TYPE","OPERATOR_IS_ANY","LAYOUT_GRID","LAYOUT_TABLE","LAYOUT_LIST","unlock","useEditPostAction","useSetActiveTemplateAction","authorField","descriptionField","previewField","activeField","slugField","jsx","_jsx","usePostActions","templateTitleField","useHistory","useLocation","useEntityRecordsWithPermissions","defaultLayouts","showMedia","DEFAULT_VIEW","type","search","page","perPage","sort","field","direction","titleField","mediaField","fields","filters","PageTemplates","path","query","activeView","layout","postId","selection","setSelection","defaultView","usedType","includes","operator","value","view","setView","currentView","activeTemplatesOption","select","getEntityRecord","active_templates","records","userRecords","isResolving","isLoadingUserRecords","per_page","staticRecords","isLoadingStaticData","activeTemplates","_active","filter","record","is_custom","activeSlug","activeId","index","findIndex","template","slug","splice","find","id","push","_records","isLoadingData","map","_isActive","undefined","Object","values","users","getUser","reduce","acc","author_text","author","history","onChangeSelection","items","navigate","length","_fields","elements","_users$author$id","_users$author$name","label","name","data","paginationInfo","postTypeActions","postType","context","editAction","setActiveTemplateAction","actions","onChangeView","newView","className","title","children","isLoading","isItemClickable","onClickItem","item"],"sources":["@wordpress/edit-site/src/components/page-templates/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useState, useMemo, useCallback, useEffect } from '@wordpress/element';\nimport {\n\tprivateApis as corePrivateApis,\n\tstore as coreStore,\n} from '@wordpress/core-data';\nimport { DataViews, filterSortAndPaginate } from '@wordpress/dataviews';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\nimport { addQueryArgs } from '@wordpress/url';\nimport { useSelect } from '@wordpress/data';\nimport { useEvent } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport Page from '../page';\nimport AddNewTemplate from '../add-new-template';\nimport {\n\tTEMPLATE_POST_TYPE,\n\tOPERATOR_IS_ANY,\n\tLAYOUT_GRID,\n\tLAYOUT_TABLE,\n\tLAYOUT_LIST,\n} from '../../utils/constants';\nimport { unlock } from '../../lock-unlock';\nimport {\n\tuseEditPostAction,\n\tuseSetActiveTemplateAction,\n} from '../dataviews-actions';\nimport {\n\tauthorField,\n\tdescriptionField,\n\tpreviewField,\n\tactiveField,\n\tslugField,\n} from './fields';\n\nconst { usePostActions, templateTitleField } = unlock( editorPrivateApis );\nconst { useHistory, useLocation } = unlock( routerPrivateApis );\nconst { useEntityRecordsWithPermissions } = unlock( corePrivateApis );\n\nconst defaultLayouts = {\n\t[ LAYOUT_TABLE ]: {\n\t\tshowMedia: false,\n\t},\n\t[ LAYOUT_GRID ]: {\n\t\tshowMedia: true,\n\t},\n\t[ LAYOUT_LIST ]: {\n\t\tshowMedia: false,\n\t},\n};\n\nconst DEFAULT_VIEW = {\n\ttype: LAYOUT_GRID,\n\tsearch: '',\n\tpage: 1,\n\tperPage: 20,\n\tsort: {\n\t\tfield: 'title',\n\t\tdirection: 'asc',\n\t},\n\ttitleField: 'title',\n\tdescriptionField: 'description',\n\tmediaField: 'preview',\n\tfields: [ 'author', 'active', 'slug' ],\n\tfilters: [],\n\t...defaultLayouts[ LAYOUT_GRID ],\n};\n\nexport default function PageTemplates() {\n\tconst { path, query } = useLocation();\n\tconst { activeView = 'active', layout, postId } = query;\n\tconst [ selection, setSelection ] = useState( [ postId ] );\n\tconst defaultView = useMemo( () => {\n\t\tconst usedType = layout ?? DEFAULT_VIEW.type;\n\t\treturn {\n\t\t\t...DEFAULT_VIEW,\n\t\t\ttype: usedType,\n\t\t\tfilters: ! [ 'active', 'user' ].includes( activeView )\n\t\t\t\t? [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tfield: 'author',\n\t\t\t\t\t\t\toperator: 'isAny',\n\t\t\t\t\t\t\tvalue: [ activeView ],\n\t\t\t\t\t\t},\n\t\t\t\t ]\n\t\t\t\t: [],\n\t\t\t...defaultLayouts[ usedType ],\n\t\t};\n\t}, [ layout, activeView ] );\n\tconst [ view, setView ] = useState( defaultView );\n\n\t// Sync the layout from the URL to the view state.\n\tuseEffect( () => {\n\t\tsetView( ( currentView ) => ( {\n\t\t\t...currentView,\n\t\t\ttype: layout ?? DEFAULT_VIEW.type,\n\t\t} ) );\n\t}, [ setView, layout ] );\n\n\t// Sync the active view from the URL to the view state.\n\tuseEffect( () => {\n\t\tsetView( ( currentView ) => ( {\n\t\t\t...currentView,\n\t\t\tfilters: ! [ 'active', 'user' ].includes( activeView )\n\t\t\t\t? [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tfield: 'author',\n\t\t\t\t\t\t\toperator: OPERATOR_IS_ANY,\n\t\t\t\t\t\t\tvalue: [ activeView ],\n\t\t\t\t\t\t},\n\t\t\t\t ]\n\t\t\t\t: [],\n\t\t} ) );\n\t}, [ setView, activeView ] );\n\n\tconst activeTemplatesOption = useSelect(\n\t\t( select ) =>\n\t\t\tselect( coreStore ).getEntityRecord( 'root', 'site' )\n\t\t\t\t?.active_templates\n\t);\n\t// Todo: this will have to be better so that we're not fetching all the\n\t// records all the time. Active templates query will need to move server\n\t// side.\n\tconst { records: userRecords, isResolving: isLoadingUserRecords } =\n\t\tuseEntityRecordsWithPermissions( 'postType', TEMPLATE_POST_TYPE, {\n\t\t\tper_page: -1,\n\t\t} );\n\tconst { records: staticRecords, isResolving: isLoadingStaticData } =\n\t\tuseEntityRecordsWithPermissions( 'postType', 'wp_registered_template', {\n\t\t\tper_page: -1,\n\t\t} );\n\n\tconst activeTemplates = useMemo( () => {\n\t\tconst _active = [ ...staticRecords ].filter(\n\t\t\t( record ) => ! record.is_custom\n\t\t);\n\t\tif ( activeTemplatesOption ) {\n\t\t\tfor ( const activeSlug in activeTemplatesOption ) {\n\t\t\t\tconst activeId = activeTemplatesOption[ activeSlug ];\n\t\t\t\tif ( activeId === false ) {\n\t\t\t\t\t// Remove the template from the array.\n\t\t\t\t\tconst index = _active.findIndex(\n\t\t\t\t\t\t( template ) => template.slug === activeSlug\n\t\t\t\t\t);\n\t\t\t\t\tif ( index !== -1 ) {\n\t\t\t\t\t\t_active.splice( index, 1 );\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t// Replace the template in the array.\n\t\t\t\t\tconst template = userRecords.find(\n\t\t\t\t\t\t( { id } ) => id === activeId\n\t\t\t\t\t);\n\t\t\t\t\tif ( template ) {\n\t\t\t\t\t\tconst index = _active.findIndex(\n\t\t\t\t\t\t\t( { slug } ) => slug === template.slug\n\t\t\t\t\t\t);\n\t\t\t\t\t\tif ( index !== -1 ) {\n\t\t\t\t\t\t\t_active[ index ] = template;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t_active.push( template );\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\treturn _active;\n\t}, [ userRecords, staticRecords, activeTemplatesOption ] );\n\n\tlet _records;\n\tlet isLoadingData;\n\tif ( activeView === 'active' ) {\n\t\t_records = activeTemplates;\n\t\tisLoadingData = isLoadingUserRecords || isLoadingStaticData;\n\t} else if ( activeView === 'user' ) {\n\t\t_records = userRecords;\n\t\tisLoadingData = isLoadingUserRecords;\n\t} else {\n\t\t_records = staticRecords;\n\t\tisLoadingData = isLoadingStaticData;\n\t}\n\n\tconst records = useMemo( () => {\n\t\treturn _records.map( ( record ) => ( {\n\t\t\t...record,\n\t\t\t_isActive:\n\t\t\t\ttypeof record.id === 'string'\n\t\t\t\t\t? activeTemplatesOption[ record.slug ] === record.id ||\n\t\t\t\t\t activeTemplatesOption[ record.slug ] === undefined\n\t\t\t\t\t: Object.values( activeTemplatesOption ).includes(\n\t\t\t\t\t\t\trecord.id\n\t\t\t\t\t ),\n\t\t} ) );\n\t}, [ _records, activeTemplatesOption ] );\n\n\tconst users = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getUser } = select( coreStore );\n\t\t\treturn records.reduce( ( acc, record ) => {\n\t\t\t\tif ( record.author_text ) {\n\t\t\t\t\tif ( ! acc[ record.author_text ] ) {\n\t\t\t\t\t\tacc[ record.author_text ] = record.author_text;\n\t\t\t\t\t}\n\t\t\t\t} else if ( record.author ) {\n\t\t\t\t\tif ( ! acc[ record.author ] ) {\n\t\t\t\t\t\tacc[ record.author ] = getUser( record.author );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn acc;\n\t\t\t}, {} );\n\t\t},\n\t\t[ records ]\n\t);\n\n\tconst history = useHistory();\n\tconst onChangeSelection = useCallback(\n\t\t( items ) => {\n\t\t\tsetSelection( items );\n\t\t\tif ( view?.type === LAYOUT_LIST ) {\n\t\t\t\thistory.navigate(\n\t\t\t\t\taddQueryArgs( path, {\n\t\t\t\t\t\tpostId: items.length === 1 ? items[ 0 ] : undefined,\n\t\t\t\t\t} )\n\t\t\t\t);\n\t\t\t}\n\t\t},\n\t\t[ history, path, view?.type ]\n\t);\n\n\tconst fields = useMemo( () => {\n\t\tconst _fields = [\n\t\t\tpreviewField,\n\t\t\ttemplateTitleField,\n\t\t\tdescriptionField,\n\t\t\tactiveField,\n\t\t\tslugField,\n\t\t];\n\t\tconst elements = [];\n\t\tfor ( const author in users ) {\n\t\t\telements.push( {\n\t\t\t\tvalue: users[ author ]?.id ?? author,\n\t\t\t\tlabel: users[ author ]?.name ?? author,\n\t\t\t} );\n\t\t}\n\t\t_fields.push( {\n\t\t\t...authorField,\n\t\t\telements,\n\t\t} );\n\t\treturn _fields;\n\t}, [ users ] );\n\n\tconst { data, paginationInfo } = useMemo( () => {\n\t\treturn filterSortAndPaginate( records, view, fields );\n\t}, [ records, view, fields ] );\n\n\tconst postTypeActions = usePostActions( {\n\t\tpostType: TEMPLATE_POST_TYPE,\n\t\tcontext: 'list',\n\t} );\n\tconst editAction = useEditPostAction();\n\tconst setActiveTemplateAction = useSetActiveTemplateAction();\n\tconst actions = useMemo(\n\t\t() =>\n\t\t\tactiveView === 'user'\n\t\t\t\t? [ setActiveTemplateAction, editAction, ...postTypeActions ]\n\t\t\t\t: [ setActiveTemplateAction, ...postTypeActions ],\n\t\t[ postTypeActions, setActiveTemplateAction, editAction, activeView ]\n\t);\n\n\tconst onChangeView = useEvent( ( newView ) => {\n\t\tsetView( newView );\n\t\tif ( newView.type !== layout ) {\n\t\t\thistory.navigate(\n\t\t\t\taddQueryArgs( path, {\n\t\t\t\t\tlayout: newView.type,\n\t\t\t\t} )\n\t\t\t);\n\t\t}\n\t} );\n\n\treturn (\n\t\t<Page\n\t\t\tclassName=\"edit-site-page-templates\"\n\t\t\ttitle={ __( 'Templates' ) }\n\t\t\tactions={ <AddNewTemplate /> }\n\t\t>\n\t\t\t<DataViews\n\t\t\t\tkey={ activeView }\n\t\t\t\tpaginationInfo={ paginationInfo }\n\t\t\t\tfields={ fields }\n\t\t\t\tactions={ actions }\n\t\t\t\tdata={ data }\n\t\t\t\tisLoading={ isLoadingData }\n\t\t\t\tview={ view }\n\t\t\t\tonChangeView={ onChangeView }\n\t\t\t\tonChangeSelection={ onChangeSelection }\n\t\t\t\tisItemClickable={ () => true }\n\t\t\t\tonClickItem={ ( item ) => {\n\t\t\t\t\thistory.navigate(\n\t\t\t\t\t\t`/${ item.type }/${ item.id }?canvas=edit`\n\t\t\t\t\t);\n\t\t\t\t} }\n\t\t\t\tselection={ selection }\n\t\t\t\tdefaultLayouts={ defaultLayouts }\n\t\t\t/>\n\t\t</Page>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,QA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AGA,OAAS;MACnBP,IAAI,EAAGA,IAAM;MACba,SAAS,EAAGpC,aAAe;MAC3B9B,IAAI,EAAGA,IAAM;MACb6D,YAAY,EAAGA,YAAc;MAC7BlB,iBAAiB,EAAGA,iBAAmB;MACvCwB,eAAe,EAAGA,CAAA,KAAM,IAAM;MAC9BC,WAAW,EAAKC,IAAI,IAAM;QACzB3B,OAAO,CAACG,QAAQ,CACf,IAAKwB,IAAI,CAAC7F,IAAI,IAAM6F,IAAI,CAAC1C,EAAE,cAC5B,CAAC;MACF,CAAG;MACHlC,SAAS,EAAGA,SAAW;MACvBpB,cAAc,EAAGA;IAAgB,GAhB3BiB,UAiBN;EAAC,CACG,CAAC;AAET","ignoreList":[]}
|
|
@@ -2,12 +2,14 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { __ } from '@wordpress/i18n';
|
|
5
|
+
import { useSelect } from '@wordpress/data';
|
|
6
|
+
import { store as coreStore } from '@wordpress/core-data';
|
|
5
7
|
import { useMemo, useState } from '@wordpress/element';
|
|
6
8
|
import { privateApis as routerPrivateApis } from '@wordpress/router';
|
|
7
9
|
import { useViewportMatch } from '@wordpress/compose';
|
|
8
|
-
import { Button } from '@wordpress/components';
|
|
10
|
+
import { Button, __experimentalHStack as HStack, DropdownMenu, MenuGroup, MenuItem } from '@wordpress/components';
|
|
9
11
|
import { addQueryArgs, removeQueryArgs } from '@wordpress/url';
|
|
10
|
-
import { seen } from '@wordpress/icons';
|
|
12
|
+
import { seen, moreVertical } from '@wordpress/icons';
|
|
11
13
|
|
|
12
14
|
/**
|
|
13
15
|
* Internal dependencies
|
|
@@ -15,7 +17,7 @@ import { seen } from '@wordpress/icons';
|
|
|
15
17
|
import GlobalStylesUI from '../global-styles/ui';
|
|
16
18
|
import Page from '../page';
|
|
17
19
|
import { unlock } from '../../lock-unlock';
|
|
18
|
-
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
20
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
19
21
|
const {
|
|
20
22
|
useLocation,
|
|
21
23
|
useHistory
|
|
@@ -26,19 +28,49 @@ const GlobalStylesPageActions = ({
|
|
|
26
28
|
path
|
|
27
29
|
}) => {
|
|
28
30
|
const history = useHistory();
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
31
|
+
const canEditCSS = useSelect(select => {
|
|
32
|
+
const {
|
|
33
|
+
getEntityRecord,
|
|
34
|
+
__experimentalGetCurrentGlobalStylesId
|
|
35
|
+
} = select(coreStore);
|
|
36
|
+
const globalStylesId = __experimentalGetCurrentGlobalStylesId();
|
|
37
|
+
const globalStyles = globalStylesId ? getEntityRecord('root', 'globalStyles', globalStylesId) : undefined;
|
|
38
|
+
return !!globalStyles?._links?.['wp:action-edit-css'];
|
|
39
|
+
}, []);
|
|
40
|
+
return /*#__PURE__*/_jsxs(HStack, {
|
|
41
|
+
children: [/*#__PURE__*/_jsx(Button, {
|
|
42
|
+
isPressed: isStyleBookOpened,
|
|
43
|
+
icon: seen,
|
|
44
|
+
label: __('Style Book'),
|
|
45
|
+
onClick: () => {
|
|
46
|
+
setIsStyleBookOpened(!isStyleBookOpened);
|
|
47
|
+
const updatedPath = !isStyleBookOpened ? addQueryArgs(path, {
|
|
48
|
+
preview: 'stylebook'
|
|
49
|
+
}) : removeQueryArgs(path, 'preview');
|
|
50
|
+
// Navigate to the updated path.
|
|
51
|
+
history.navigate(updatedPath);
|
|
52
|
+
},
|
|
53
|
+
size: "compact"
|
|
54
|
+
}), canEditCSS && /*#__PURE__*/_jsx(DropdownMenu, {
|
|
55
|
+
icon: moreVertical,
|
|
56
|
+
label: __('More'),
|
|
57
|
+
toggleProps: {
|
|
58
|
+
size: 'compact'
|
|
59
|
+
},
|
|
60
|
+
children: ({
|
|
61
|
+
onClose
|
|
62
|
+
}) => /*#__PURE__*/_jsx(MenuGroup, {
|
|
63
|
+
children: canEditCSS && /*#__PURE__*/_jsx(MenuItem, {
|
|
64
|
+
onClick: () => {
|
|
65
|
+
onClose();
|
|
66
|
+
history.navigate(addQueryArgs(path, {
|
|
67
|
+
section: '/css'
|
|
68
|
+
}));
|
|
69
|
+
},
|
|
70
|
+
children: __('Additional CSS')
|
|
71
|
+
})
|
|
72
|
+
})
|
|
73
|
+
})]
|
|
42
74
|
});
|
|
43
75
|
};
|
|
44
76
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__","useMemo","useState","privateApis","routerPrivateApis","useViewportMatch","Button","addQueryArgs","removeQueryArgs","seen","GlobalStylesUI","Page","unlock","jsx","_jsx","Fragment","_Fragment","useLocation","useHistory","GlobalStylesPageActions","isStyleBookOpened","setIsStyleBookOpened","path","history","isPressed","icon","label","onClick","updatedPath","preview","navigate","size","useSection","query","_query$section","
|
|
1
|
+
{"version":3,"names":["__","useSelect","store","coreStore","useMemo","useState","privateApis","routerPrivateApis","useViewportMatch","Button","__experimentalHStack","HStack","DropdownMenu","MenuGroup","MenuItem","addQueryArgs","removeQueryArgs","seen","moreVertical","GlobalStylesUI","Page","unlock","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","useLocation","useHistory","GlobalStylesPageActions","isStyleBookOpened","setIsStyleBookOpened","path","history","canEditCSS","select","getEntityRecord","__experimentalGetCurrentGlobalStylesId","globalStylesId","globalStyles","undefined","_links","children","isPressed","icon","label","onClick","updatedPath","preview","navigate","size","toggleProps","onClose","section","useSection","query","_query$section","updatedSection","GlobalStylesUIWrapper","includes","isMobileViewport","onChangeSection","actions","className","title","onPathChange"],"sources":["@wordpress/edit-site/src/components/sidebar-global-styles-wrapper/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useMemo, useState } from '@wordpress/element';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { useViewportMatch } from '@wordpress/compose';\nimport {\n\tButton,\n\t__experimentalHStack as HStack,\n\tDropdownMenu,\n\tMenuGroup,\n\tMenuItem,\n} from '@wordpress/components';\nimport { addQueryArgs, removeQueryArgs } from '@wordpress/url';\nimport { seen, moreVertical } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport GlobalStylesUI from '../global-styles/ui';\nimport Page from '../page';\nimport { unlock } from '../../lock-unlock';\n\nconst { useLocation, useHistory } = unlock( routerPrivateApis );\n\nconst GlobalStylesPageActions = ( {\n\tisStyleBookOpened,\n\tsetIsStyleBookOpened,\n\tpath,\n} ) => {\n\tconst history = useHistory();\n\tconst canEditCSS = 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 !! globalStyles?._links?.[ 'wp:action-edit-css' ];\n\t}, [] );\n\n\treturn (\n\t\t<HStack>\n\t\t\t<Button\n\t\t\t\tisPressed={ isStyleBookOpened }\n\t\t\t\ticon={ seen }\n\t\t\t\tlabel={ __( 'Style Book' ) }\n\t\t\t\tonClick={ () => {\n\t\t\t\t\tsetIsStyleBookOpened( ! isStyleBookOpened );\n\t\t\t\t\tconst updatedPath = ! isStyleBookOpened\n\t\t\t\t\t\t? addQueryArgs( path, { preview: 'stylebook' } )\n\t\t\t\t\t\t: removeQueryArgs( path, 'preview' );\n\t\t\t\t\t// Navigate to the updated path.\n\t\t\t\t\thistory.navigate( updatedPath );\n\t\t\t\t} }\n\t\t\t\tsize=\"compact\"\n\t\t\t/>\n\t\t\t{ canEditCSS && (\n\t\t\t\t<DropdownMenu\n\t\t\t\t\ticon={ moreVertical }\n\t\t\t\t\tlabel={ __( 'More' ) }\n\t\t\t\t\ttoggleProps={ { size: 'compact' } }\n\t\t\t\t>\n\t\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t{ canEditCSS && (\n\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t\t\thistory.navigate(\n\t\t\t\t\t\t\t\t\t\t\taddQueryArgs( path, {\n\t\t\t\t\t\t\t\t\t\t\t\tsection: '/css',\n\t\t\t\t\t\t\t\t\t\t\t} )\n\t\t\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>\n\t\t\t\t\t\t\t\t\t{ __( 'Additional CSS' ) }\n\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t) }\n\t\t\t\t</DropdownMenu>\n\t\t\t) }\n\t\t</HStack>\n\t);\n};\n\n/**\n * Hook to deal with navigation and location state.\n *\n * @return {Array} The current section and a function to update it.\n */\nexport const useSection = () => {\n\tconst { path, query } = useLocation();\n\tconst history = useHistory();\n\treturn useMemo( () => {\n\t\treturn [\n\t\t\tquery.section ?? '/',\n\t\t\t( updatedSection ) => {\n\t\t\t\thistory.navigate(\n\t\t\t\t\taddQueryArgs( path, {\n\t\t\t\t\t\tsection: updatedSection,\n\t\t\t\t\t} )\n\t\t\t\t);\n\t\t\t},\n\t\t];\n\t}, [ path, query.section, history ] );\n};\n\nexport default function GlobalStylesUIWrapper() {\n\tconst { path } = useLocation();\n\n\tconst [ isStyleBookOpened, setIsStyleBookOpened ] = useState(\n\t\tpath.includes( 'preview=stylebook' )\n\t);\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst [ section, onChangeSection ] = useSection();\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\tpath={ path }\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\n\t\t\t\t\tpath={ section }\n\t\t\t\t\tonPathChange={ onChangeSection }\n\t\t\t\t/>\n\t\t\t</Page>\n\t\t</>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,OAAO,EAAEC,QAAQ,QAAQ,oBAAoB;AACtD,SAASC,WAAW,IAAIC,iBAAiB,QAAQ,mBAAmB;AACpE,SAASC,gBAAgB,QAAQ,oBAAoB;AACrD,SACCC,MAAM,EACNC,oBAAoB,IAAIC,MAAM,EAC9BC,YAAY,EACZC,SAAS,EACTC,QAAQ,QACF,uBAAuB;AAC9B,SAASC,YAAY,EAAEC,eAAe,QAAQ,gBAAgB;AAC9D,SAASC,IAAI,EAAEC,YAAY,QAAQ,kBAAkB;;AAErD;AACA;AACA;AACA,OAAOC,cAAc,MAAM,qBAAqB;AAChD,OAAOC,IAAI,MAAM,SAAS;AAC1B,SAASC,MAAM,QAAQ,mBAAmB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA,EAAAC,QAAA,IAAAC,SAAA;AAE3C,MAAM;EAAEC,WAAW;EAAEC;AAAW,CAAC,GAAGR,MAAM,CAAEd,iBAAkB,CAAC;AAE/D,MAA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E8C,OAAO,EAAEQ,eAAe,CAAE,GAAGP,UAAU,CAAC,CAAC;EAEjD,oBACChC,IAAA,CAAAI,SAAA;IAAAgB,QAAA,eACCpB,IAAA,CAACH,IAAI;MACJ2C,OAAO,EACN,CAAEF,gBAAgB,gBACjBtC,IAAA,CAACO,uBAAuB;QACvBC,iBAAiB,EAAGA,iBAAmB;QACvCC,oBAAoB,EAAGA,oBAAsB;QAC7CC,IAAI,EAAGA;MAAM,CACb,CAAC,GACC,IACJ;MACD+B,SAAS,EAAC,kBAAkB;MAC5BC,KAAK,EAAGjE,EAAE,CAAE,QAAS,CAAG;MAAA2C,QAAA,eAExBpB,IAAA,CAACJ,cAAc;QACdc,IAAI,EAAGqB,OAAS;QAChBY,YAAY,EAAGJ;MAAiB,CAChC;IAAC,CACG;EAAC,CACN,CAAC;AAEL","ignoreList":[]}
|
|
@@ -14,7 +14,6 @@ import { addQueryArgs } from '@wordpress/url';
|
|
|
14
14
|
import SidebarNavigationItem from '../sidebar-navigation-item';
|
|
15
15
|
import { useAddedBy } from '../page-templates/hooks';
|
|
16
16
|
import { layout } from '@wordpress/icons';
|
|
17
|
-
import { TEMPLATE_POST_TYPE } from '../../utils/constants';
|
|
18
17
|
import { unlock } from '../../lock-unlock';
|
|
19
18
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
20
19
|
const {
|
|
@@ -41,12 +40,12 @@ function TemplateDataviewItem({
|
|
|
41
40
|
export default function DataviewsTemplatesSidebarContent() {
|
|
42
41
|
const {
|
|
43
42
|
query: {
|
|
44
|
-
activeView = '
|
|
43
|
+
activeView = 'active'
|
|
45
44
|
}
|
|
46
45
|
} = useLocation();
|
|
47
46
|
const {
|
|
48
47
|
records
|
|
49
|
-
} = useEntityRecords('postType',
|
|
48
|
+
} = useEntityRecords('postType', 'wp_registered_template', {
|
|
50
49
|
per_page: -1
|
|
51
50
|
});
|
|
52
51
|
const firstItemPerAuthorText = useMemo(() => {
|
|
@@ -65,8 +64,15 @@ export default function DataviewsTemplatesSidebarContent() {
|
|
|
65
64
|
children: [/*#__PURE__*/_jsx(SidebarNavigationItem, {
|
|
66
65
|
to: "/template",
|
|
67
66
|
icon: layout,
|
|
68
|
-
"aria-current": activeView === '
|
|
69
|
-
children: __('
|
|
67
|
+
"aria-current": activeView === 'active',
|
|
68
|
+
children: __('Active templates')
|
|
69
|
+
}), /*#__PURE__*/_jsx(SidebarNavigationItem, {
|
|
70
|
+
to: addQueryArgs('/template', {
|
|
71
|
+
activeView: 'user'
|
|
72
|
+
}),
|
|
73
|
+
icon: layout,
|
|
74
|
+
"aria-current": activeView === 'user',
|
|
75
|
+
children: __('Custom templates')
|
|
70
76
|
}), firstItemPerAuthorText.map(template => {
|
|
71
77
|
return /*#__PURE__*/_jsx(TemplateDataviewItem, {
|
|
72
78
|
template: template,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useEntityRecords","useMemo","__experimentalItemGroup","ItemGroup","__","privateApis","routerPrivateApis","addQueryArgs","SidebarNavigationItem","useAddedBy","layout","
|
|
1
|
+
{"version":3,"names":["useEntityRecords","useMemo","__experimentalItemGroup","ItemGroup","__","privateApis","routerPrivateApis","addQueryArgs","SidebarNavigationItem","useAddedBy","layout","unlock","jsx","_jsx","jsxs","_jsxs","useLocation","EMPTY_ARRAY","TemplateDataviewItem","template","isActive","text","icon","type","id","to","activeView","children","DataviewsTemplatesSidebarContent","query","records","per_page","firstItemPerAuthorText","_ref","firstItemPerAuthor","reduce","acc","author","author_text","Object","values","className","map"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-templates-browse/content.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEntityRecords } from '@wordpress/core-data';\nimport { useMemo } from '@wordpress/element';\nimport { __experimentalItemGroup as ItemGroup } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { addQueryArgs } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationItem from '../sidebar-navigation-item';\nimport { useAddedBy } from '../page-templates/hooks';\nimport { layout } from '@wordpress/icons';\nimport { unlock } from '../../lock-unlock';\n\nconst { useLocation } = unlock( routerPrivateApis );\n\nconst EMPTY_ARRAY = [];\n\nfunction TemplateDataviewItem( { template, isActive } ) {\n\tconst { text, icon } = useAddedBy( template.type, template.id );\n\n\treturn (\n\t\t<SidebarNavigationItem\n\t\t\tto={ addQueryArgs( '/template', { activeView: text } ) }\n\t\t\ticon={ icon }\n\t\t\taria-current={ isActive }\n\t\t>\n\t\t\t{ text }\n\t\t</SidebarNavigationItem>\n\t);\n}\n\nexport default function DataviewsTemplatesSidebarContent() {\n\tconst {\n\t\tquery: { activeView = 'active' },\n\t} = useLocation();\n\tconst { records } = useEntityRecords(\n\t\t'postType',\n\t\t'wp_registered_template',\n\t\t{\n\t\t\tper_page: -1,\n\t\t}\n\t);\n\tconst firstItemPerAuthorText = useMemo( () => {\n\t\tconst firstItemPerAuthor = records?.reduce( ( acc, template ) => {\n\t\t\tconst author = template.author_text;\n\t\t\tif ( author && ! acc[ author ] ) {\n\t\t\t\tacc[ author ] = template;\n\t\t\t}\n\t\t\treturn acc;\n\t\t}, {} );\n\t\treturn (\n\t\t\t( firstItemPerAuthor && Object.values( firstItemPerAuthor ) ) ??\n\t\t\tEMPTY_ARRAY\n\t\t);\n\t}, [ records ] );\n\n\treturn (\n\t\t<ItemGroup className=\"edit-site-sidebar-navigation-screen-templates-browse\">\n\t\t\t<SidebarNavigationItem\n\t\t\t\tto=\"/template\"\n\t\t\t\ticon={ layout }\n\t\t\t\taria-current={ activeView === 'active' }\n\t\t\t>\n\t\t\t\t{ __( 'Active templates' ) }\n\t\t\t</SidebarNavigationItem>\n\t\t\t<SidebarNavigationItem\n\t\t\t\tto={ addQueryArgs( '/template', { activeView: 'user' } ) }\n\t\t\t\ticon={ layout }\n\t\t\t\taria-current={ activeView === 'user' }\n\t\t\t>\n\t\t\t\t{ __( 'Custom templates' ) }\n\t\t\t</SidebarNavigationItem>\n\t\t\t{ firstItemPerAuthorText.map( ( template ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<TemplateDataviewItem\n\t\t\t\t\t\tkey={ template.author_text }\n\t\t\t\t\t\ttemplate={ template }\n\t\t\t\t\t\tisActive={ activeView === template.author_text }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</ItemGroup>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,gBAAgB,QAAQ,sBAAsB;AACvD,SAASC,OAAO,QAAQ,oBAAoB;AAC5C,SAASC,uBAAuB,IAAIC,SAAS,QAAQ,uBAAuB;AAC5E,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,WAAW,IAAIC,iBAAiB,QAAQ,mBAAmB;AACpE,SAASC,YAAY,QAAQ,gBAAgB;;AAE7C;AACA;AACA;AACA,OAAOC,qBAAqB,MAAM,4BAA4B;AAC9D,SAASC,UAAU,QAAQ,yBAAyB;AACpD,SAASC,MAAM,QAAQ,kBAAkB;AACzC,SAASC,MAAM,QAAQ,mBAAmB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAE3C,MAAM;EAAEC;AAAY,CAAC,GAAGL,MAAM,CAAEL,iBAAkB,CAAC;AAEnD,MAAMW,WAAW,GAAG,EAAE;AAEtB,SAASC,oBAAoBA,CAAE;EAAEC,QAAQ;EAAEC;AAAS,CAAC,EAAG;EACvD,MAAM;IAAEC,IAAI;IAAEC;EAAK,CAAC,GAAGb,UAAU,CAAEU,QAAQ,CAACI,IAAI,EAAEJ,QAAQ,CAACK,EAAG,CAAC;EAE/D,oBACCX,IAAA,CAACL,qBAAqB;IACrBiB,EAAE,EAAGlB,YAAY,CAAE,WAAW,EAAE;MAAEmB,UAAU,EAAEL;IAAK,CAAE,CAAG;IACxDC,IAAI,EAAGA,IAAM;IACb,gBAAeF,QAAU;IAAAO,QAAA,EAEvBN;EAA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,UAAU,KAAK,MAAQ;MAAAC,QAAA,EAEpCvB,EAAE,CAAE,kBAAmB;IAAC,CACJ,CAAC,EACtB4B,sBAAsB,CAACU,GAAG,CAAIvB,QAAQ,IAAM;MAC7C,oBACCN,IAAA,CAACK,oBAAoB;QAEpBC,QAAQ,EAAGA,QAAU;QACrBC,QAAQ,EAAGM,UAAU,KAAKP,QAAQ,CAACmB;MAAa,GAF1CnB,QAAQ,CAACmB,WAGf,CAAC;IAEJ,CAAE,CAAC;EAAA,CACO,CAAC;AAEd","ignoreList":[]}
|
|
@@ -17,12 +17,12 @@ import { patternsRoute } from './patterns';
|
|
|
17
17
|
import { patternItemRoute } from './pattern-item';
|
|
18
18
|
import { templatePartItemRoute } from './template-part-item';
|
|
19
19
|
import { templatesRoute } from './templates';
|
|
20
|
-
import { templateItemRoute } from './template-item';
|
|
20
|
+
import { templateItemRoute, staticTemplateItemRoute } from './template-item';
|
|
21
21
|
import { pagesRoute } from './pages';
|
|
22
22
|
import { pageItemRoute } from './page-item';
|
|
23
23
|
import { stylebookRoute } from './stylebook';
|
|
24
24
|
import { notFoundRoute } from './notfound';
|
|
25
|
-
const routes = [pageItemRoute, pagesRoute, templateItemRoute, templatesRoute, templatePartItemRoute, patternItemRoute, patternsRoute, navigationItemRoute, navigationRoute, stylesRoute, homeRoute, stylebookRoute, notFoundRoute];
|
|
25
|
+
const routes = [pageItemRoute, pagesRoute, templateItemRoute, staticTemplateItemRoute, templatesRoute, templatePartItemRoute, patternItemRoute, patternsRoute, navigationItemRoute, navigationRoute, stylesRoute, homeRoute, stylebookRoute, notFoundRoute];
|
|
26
26
|
export function useRegisterSiteEditorRoutes() {
|
|
27
27
|
const registry = useRegistry();
|
|
28
28
|
const {
|