@wordpress/editor 14.48.2-next.v.202606191442.0 → 14.49.1

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.
Files changed (94) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/README.md +5 -13
  3. package/build/components/autosave-monitor/index.cjs +40 -83
  4. package/build/components/autosave-monitor/index.cjs.map +3 -3
  5. package/build/components/post-publish-panel/postpublish.cjs +0 -1
  6. package/build/components/post-publish-panel/postpublish.cjs.map +2 -2
  7. package/build/components/post-status/index.cjs +0 -1
  8. package/build/components/post-status/index.cjs.map +2 -2
  9. package/build/components/post-taxonomies/hierarchical-term-selector.cjs +0 -1
  10. package/build/components/post-taxonomies/hierarchical-term-selector.cjs.map +2 -2
  11. package/build/components/post-template/create-new-template-modal.cjs +0 -1
  12. package/build/components/post-template/create-new-template-modal.cjs.map +2 -2
  13. package/build/components/post-text-editor/utils.cjs +2 -2
  14. package/build/components/post-text-editor/utils.cjs.map +1 -1
  15. package/build/components/post-visibility/index.cjs +0 -1
  16. package/build/components/post-visibility/index.cjs.map +2 -2
  17. package/build/components/provider/disable-non-page-content-blocks.cjs +23 -3
  18. package/build/components/provider/disable-non-page-content-blocks.cjs.map +2 -2
  19. package/build/components/provider/navigation-block-editing-mode.cjs +9 -2
  20. package/build/components/provider/navigation-block-editing-mode.cjs.map +2 -2
  21. package/build/components/provider/use-block-editor-settings.cjs +2 -1
  22. package/build/components/provider/use-block-editor-settings.cjs.map +2 -2
  23. package/build/components/sidebar/dataform-post-summary.cjs +87 -32
  24. package/build/components/sidebar/dataform-post-summary.cjs.map +3 -3
  25. package/build/components/sidebar/post-summary.cjs +8 -6
  26. package/build/components/sidebar/post-summary.cjs.map +3 -3
  27. package/build/dataviews/store/private-actions.cjs +3 -1
  28. package/build/dataviews/store/private-actions.cjs.map +2 -2
  29. package/build/store/private-actions.cjs +2 -2
  30. package/build/store/private-actions.cjs.map +2 -2
  31. package/build-module/components/autosave-monitor/index.mjs +42 -81
  32. package/build-module/components/autosave-monitor/index.mjs.map +2 -2
  33. package/build-module/components/post-publish-panel/postpublish.mjs +0 -1
  34. package/build-module/components/post-publish-panel/postpublish.mjs.map +2 -2
  35. package/build-module/components/post-status/index.mjs +0 -1
  36. package/build-module/components/post-status/index.mjs.map +2 -2
  37. package/build-module/components/post-taxonomies/hierarchical-term-selector.mjs +0 -1
  38. package/build-module/components/post-taxonomies/hierarchical-term-selector.mjs.map +2 -2
  39. package/build-module/components/post-template/create-new-template-modal.mjs +0 -1
  40. package/build-module/components/post-template/create-new-template-modal.mjs.map +2 -2
  41. package/build-module/components/post-text-editor/utils.mjs +2 -2
  42. package/build-module/components/post-text-editor/utils.mjs.map +1 -1
  43. package/build-module/components/post-visibility/index.mjs +0 -1
  44. package/build-module/components/post-visibility/index.mjs.map +2 -2
  45. package/build-module/components/provider/disable-non-page-content-blocks.mjs +23 -3
  46. package/build-module/components/provider/disable-non-page-content-blocks.mjs.map +2 -2
  47. package/build-module/components/provider/navigation-block-editing-mode.mjs +10 -3
  48. package/build-module/components/provider/navigation-block-editing-mode.mjs.map +2 -2
  49. package/build-module/components/provider/use-block-editor-settings.mjs +2 -1
  50. package/build-module/components/provider/use-block-editor-settings.mjs.map +2 -2
  51. package/build-module/components/sidebar/dataform-post-summary.mjs +88 -33
  52. package/build-module/components/sidebar/dataform-post-summary.mjs.map +2 -2
  53. package/build-module/components/sidebar/post-summary.mjs +8 -6
  54. package/build-module/components/sidebar/post-summary.mjs.map +2 -2
  55. package/build-module/dataviews/store/private-actions.mjs +5 -1
  56. package/build-module/dataviews/store/private-actions.mjs.map +2 -2
  57. package/build-module/store/private-actions.mjs +2 -2
  58. package/build-module/store/private-actions.mjs.map +2 -2
  59. package/build-style/style-rtl.css +29 -33
  60. package/build-style/style.css +29 -33
  61. package/build-types/components/autosave-monitor/index.d.ts +11 -29
  62. package/build-types/components/autosave-monitor/index.d.ts.map +1 -1
  63. package/build-types/components/post-publish-panel/postpublish.d.ts.map +1 -1
  64. package/build-types/components/post-status/index.d.ts.map +1 -1
  65. package/build-types/components/post-taxonomies/hierarchical-term-selector.d.ts.map +1 -1
  66. package/build-types/components/post-template/create-new-template-modal.d.ts.map +1 -1
  67. package/build-types/components/post-visibility/index.d.ts.map +1 -1
  68. package/build-types/components/provider/disable-non-page-content-blocks.d.ts.map +1 -1
  69. package/build-types/components/provider/navigation-block-editing-mode.d.ts.map +1 -1
  70. package/build-types/components/provider/use-block-editor-settings.d.ts.map +1 -1
  71. package/build-types/components/sidebar/dataform-post-summary.d.ts.map +1 -1
  72. package/build-types/components/sidebar/post-summary.d.ts.map +1 -1
  73. package/build-types/dataviews/store/private-actions.d.ts.map +1 -1
  74. package/build-types/utils/get-template-part-icon.d.ts.map +1 -1
  75. package/package.json +46 -46
  76. package/src/components/autosave-monitor/index.js +69 -104
  77. package/src/components/autosave-monitor/test/index.js +137 -122
  78. package/src/components/plugin-post-publish-panel/test/__snapshots__/index.js.snap +1 -0
  79. package/src/components/post-publish-panel/postpublish.js +0 -1
  80. package/src/components/post-publish-panel/test/__snapshots__/index.js.snap +7 -2
  81. package/src/components/post-saved-state/test/__snapshots__/index.js.snap +1 -0
  82. package/src/components/post-status/index.js +0 -1
  83. package/src/components/post-taxonomies/hierarchical-term-selector.js +0 -1
  84. package/src/components/post-template/create-new-template-modal.js +0 -1
  85. package/src/components/post-text-editor/utils.js +2 -2
  86. package/src/components/post-visibility/index.js +0 -1
  87. package/src/components/provider/disable-non-page-content-blocks.js +23 -6
  88. package/src/components/provider/navigation-block-editing-mode.js +10 -4
  89. package/src/components/provider/use-block-editor-settings.js +3 -1
  90. package/src/components/sidebar/dataform-post-summary.js +133 -49
  91. package/src/components/sidebar/post-summary.js +12 -10
  92. package/src/dataviews/store/private-actions.ts +8 -1
  93. package/src/store/private-actions.js +2 -2
  94. package/src/store/test/actions.js +2 -2
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/sidebar/dataform-post-summary.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { DataForm } from '@wordpress/dataviews';\nimport { __experimentalVStack as VStack } from '@wordpress/components';\nimport { useMemo } from '@wordpress/element';\nimport { useViewConfig } from '@wordpress/views';\n\n/**\n * Internal dependencies\n */\nimport PostCardPanel from '../post-card-panel';\nimport PostPanelSection from '../post-panel-section';\nimport { store as editorStore } from '../../store';\nimport PostTrash from '../post-trash';\nimport usePostFields from '../post-fields';\nimport { usePostTemplatePanelMode } from '../post-template/hooks';\nimport revisionsField from '../../dataviews/fields/revisions';\n\nconst EMPTY_FORM = { layout: { type: 'panel' }, fields: [] };\n\n// Some post types expose summary fields that edit entities other than the one\n// being edited. Keyed by the post type that needs them, the related records are\n// merged into the form data under a `${ kind }_${ name }` namespace key so that\n// a single DataForm can read and write all of them, and edits to those keys are\n// routed back to their entity.\n//\n// The fields themselves are namespace-agnostic: they read and write a plain\n// record. The `fields` list ties each one to the entity it edits, and this\n// component overrides their `getValue`/`setValue`/`render` to operate on the\n// namespaced record, plus their `isVisible` to only show where that record is\n// present (e.g. the `home`/`index` template summary).\n//\n// Currently only `wp_template` uses this: `posts_per_page` and\n// `default_comment_status` target `root/site`, and `posts_page_title` targets\n// the posts page (the `page` assigned as `page_for_posts`).\nconst ENTITIES = {\n\twp_template: {\n\t\troot_site: {\n\t\t\tkind: 'root',\n\t\t\tname: 'site',\n\t\t\tfields: [ 'posts_per_page', 'default_comment_status' ],\n\t\t\tisVisible: ( item ) =>\n\t\t\t\t[ 'home', 'index' ].includes( item.slug ?? '' ),\n\t\t},\n\t\tposttype_page: {\n\t\t\tkind: 'postType',\n\t\t\tname: 'page',\n\t\t\tgetId: ( select ) =>\n\t\t\t\tselect( coreDataStore ).getEditedEntityRecord( 'root', 'site' )\n\t\t\t\t\t?.page_for_posts,\n\t\t\tfields: [ 'posts_page_title' ],\n\t\t\tisVisible: ( item ) =>\n\t\t\t\t[ 'home', 'index' ].includes( item.slug ?? '' ),\n\t\t},\n\t},\n};\n\n// Rebinds a namespace-agnostic field to the namespaced record it edits. Every\n// field callback that receives the form `item` is redirected to the\n// `item[ namespace ]` sub-record so the field operates on its own entity:\n// `getValue`/`setValue`/`render` here, and the rest indirectly because they all\n// funnel through the (remapped) `getValue` (default `render`, `getValueFormatted`\n// and `isValid` range/`custom` validation). Edits are wrapped back under the\n// namespace key. The caller-supplied `isVisible` encodes entity-specific\n// conditions (e.g. only for `home`/`index` templates); the generic guard\n// `!! item[ namespace ]` ensures the field is hidden when the sub-record\n// hasn't been fetched.\nfunction bindFieldToNamespace( field, namespace, isVisible = () => true ) {\n\tconst subItem = ( item ) => item?.[ namespace ] ?? {};\n\treturn {\n\t\t...field,\n\t\tgetValue: ( { item } ) =>\n\t\t\tfield.getValue\n\t\t\t\t? field.getValue( { item: subItem( item ) } )\n\t\t\t\t: subItem( item )[ field.id ],\n\t\tsetValue: ( { item, value } ) => ( {\n\t\t\t[ namespace ]: field.setValue( { item: subItem( item ), value } ),\n\t\t} ),\n\t\trender: field.render\n\t\t\t? ( props ) =>\n\t\t\t\t\tfield.render( { ...props, item: subItem( props.item ) } )\n\t\t\t: undefined,\n\t\tisVisible: ( item ) => isVisible( item ) && !! item[ namespace ],\n\t};\n}\n\nexport default function DataFormPostSummary( { onActionPerformed } ) {\n\tconst { postType, postId } = useSelect( ( select ) => {\n\t\tconst { getCurrentPostType, getCurrentPostId } = select( editorStore );\n\t\treturn {\n\t\t\tpostType: getCurrentPostType(),\n\t\t\tpostId: getCurrentPostId(),\n\t\t};\n\t}, [] );\n\tconst { form: formConfig } = useViewConfig( {\n\t\tkind: 'postType',\n\t\tname: postType,\n\t} );\n\tconst form = formConfig ?? EMPTY_FORM;\n\tconst record = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! postType || ! postId ) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\treturn select( coreDataStore ).getEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tpostType,\n\t\t\t\tpostId\n\t\t\t);\n\t\t},\n\t\t[ postType, postId ]\n\t);\n\n\tconst templatePanelMode = usePostTemplatePanelMode();\n\n\t// Assemble every piece of supplementary data merged into the form `data`\n\t// alongside the post record: read-only editor data that the post's own\n\t// fields consume (e.g. the `template` field's `available_templates` in\n\t// classic themes), and the records of other entities targeted by namespaced\n\t// fields (keyed by `${ kind }_${ name }`) together with the id used to\n\t// persist edits back to each one.\n\tconst { entityData, entityIds, availableTemplates } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedEntityRecord, canUser, getCurrentTheme } =\n\t\t\t\tselect( coreDataStore );\n\n\t\t\tconst _availableTemplates = getCurrentTheme()?.is_block_theme\n\t\t\t\t? null\n\t\t\t\t: select( editorStore ).getEditorSettings()\n\t\t\t\t\t\t.availableTemplates ?? {};\n\n\t\t\tconst extra = {};\n\t\t\tconst ids = {};\n\n\t\t\t// Other entities the current post type needs merged into its form.\n\t\t\tfor ( const [ key, entity ] of Object.entries(\n\t\t\t\tENTITIES[ postType ] ?? {}\n\t\t\t) ) {\n\t\t\t\tif (\n\t\t\t\t\t! canUser( 'read', {\n\t\t\t\t\t\tkind: entity.kind,\n\t\t\t\t\t\tname: entity.name,\n\t\t\t\t\t} )\n\t\t\t\t) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tconst id = entity.getId ? entity.getId( select ) : undefined;\n\t\t\t\t// Entities resolved through another record need a valid id.\n\t\t\t\tif ( entity.getId && ! id ) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\textra[ key ] = getEditedEntityRecord(\n\t\t\t\t\tentity.kind,\n\t\t\t\t\tentity.name,\n\t\t\t\t\tid\n\t\t\t\t);\n\t\t\t\tids[ key ] = id;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tentityData: extra,\n\t\t\t\tentityIds: ids,\n\t\t\t\tavailableTemplates: _availableTemplates,\n\t\t\t};\n\t\t},\n\t\t[ postType ]\n\t);\n\n\t// Merge the supplementary data onto the record only when there is any.\n\tconst data = useMemo( () => {\n\t\tif ( ! record ) {\n\t\t\treturn record;\n\t\t}\n\t\tconst extra = { ...entityData };\n\t\tif ( availableTemplates && Object.keys( availableTemplates ).length ) {\n\t\t\textra.available_templates = availableTemplates;\n\t\t}\n\t\tif ( ! Object.keys( extra ).length ) {\n\t\t\treturn record;\n\t\t}\n\t\treturn { ...record, ...extra };\n\t}, [ record, entityData, availableTemplates ] );\n\n\tconst { editEntityRecord } = useDispatch( coreDataStore );\n\n\t// Map of namespaced field id to the namespace key its entity is merged under.\n\tconst fieldNamespaces = useMemo( () => {\n\t\tconst map = {};\n\t\tfor ( const [ namespace, entity ] of Object.entries(\n\t\t\tENTITIES[ postType ] ?? {}\n\t\t) ) {\n\t\t\tfor ( const id of entity.fields ?? [] ) {\n\t\t\t\tmap[ id ] = namespace;\n\t\t\t}\n\t\t}\n\t\treturn map;\n\t}, [ postType ] );\n\n\tconst _fields = usePostFields( { postType } );\n\tconst fields = useMemo(\n\t\t() =>\n\t\t\t_fields\n\t\t\t\t?.map( ( field ) => {\n\t\t\t\t\tconst namespace = fieldNamespaces[ field.id ];\n\t\t\t\t\tif ( namespace ) {\n\t\t\t\t\t\treturn bindFieldToNamespace(\n\t\t\t\t\t\t\tfield,\n\t\t\t\t\t\t\tnamespace,\n\t\t\t\t\t\t\tENTITIES[ postType ]?.[ namespace ]?.isVisible\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tif ( field.id === 'status' ) {\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t...field,\n\t\t\t\t\t\t\telements: field.elements.filter(\n\t\t\t\t\t\t\t\t( element ) => element.value !== 'trash'\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\tif ( field.id === 'template' ) {\n\t\t\t\t\t\t// `usePostTemplatePanelMode` is reused in the Post Template panel to match\n\t\t\t\t\t\t// the existing behavior. If the panel rendered nothing we should exclude the\n\t\t\t\t\t\t// template field from the form.\n\t\t\t\t\t\tif ( ! templatePanelMode ) {\n\t\t\t\t\t\t\treturn null;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// In classic themes without available templates we need to make the field read-only.\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\ttemplatePanelMode === 'classic' &&\n\t\t\t\t\t\t\tObject.keys( availableTemplates ?? {} ).length === 0\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t...field,\n\t\t\t\t\t\t\t\treadOnly: true,\n\t\t\t\t\t\t\t\trender: () => __( 'Default template' ),\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn field;\n\t\t\t\t\t}\n\t\t\t\t\treturn field;\n\t\t\t\t} )\n\t\t\t\t.filter( Boolean )\n\t\t\t\t// Editor-only field, injected here rather than registered\n\t\t\t\t// so it never leaks into the site editor list / quick-edit fields.\n\t\t\t\t.concat( revisionsField ),\n\t\t[\n\t\t\t_fields,\n\t\t\ttemplatePanelMode,\n\t\t\tavailableTemplates,\n\t\t\tfieldNamespaces,\n\t\t\tpostType,\n\t\t]\n\t);\n\n\tconst onChange = ( edits ) => {\n\t\t// Route edits that target another entity (merged in under a namespace)\n\t\t// back to that entity; collect the rest for the post being edited.\n\t\tconst entities = ENTITIES[ postType ] ?? {};\n\t\tconst baseEdits = {};\n\t\tfor ( const [ key, value ] of Object.entries( edits ) ) {\n\t\t\tconst entity = entities[ key ];\n\t\t\tif ( entity ) {\n\t\t\t\teditEntityRecord(\n\t\t\t\t\tentity.kind,\n\t\t\t\t\tentity.name,\n\t\t\t\t\tentityIds[ key ],\n\t\t\t\t\tvalue\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tbaseEdits[ key ] = value;\n\t\t\t}\n\t\t}\n\n\t\tif ( ! Object.keys( baseEdits ).length ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (\n\t\t\tbaseEdits.status &&\n\t\t\tbaseEdits.status !== 'future' &&\n\t\t\trecord?.status === 'future' &&\n\t\t\tnew Date( record.date ) > new Date()\n\t\t) {\n\t\t\tbaseEdits.date = null;\n\t\t}\n\t\tif (\n\t\t\tbaseEdits.status &&\n\t\t\tbaseEdits.status === 'private' &&\n\t\t\trecord?.password\n\t\t) {\n\t\t\tbaseEdits.password = '';\n\t\t}\n\n\t\teditEntityRecord( 'postType', postType, postId, baseEdits );\n\t};\n\treturn (\n\t\t<PostPanelSection className=\"editor-post-summary\">\n\t\t\t<VStack spacing={ 4 }>\n\t\t\t\t<PostCardPanel\n\t\t\t\t\tpostType={ postType }\n\t\t\t\t\tpostId={ postId }\n\t\t\t\t\tonActionPerformed={ onActionPerformed }\n\t\t\t\t/>\n\t\t\t\t<DataForm\n\t\t\t\t\tdata={ data }\n\t\t\t\t\tfields={ fields }\n\t\t\t\t\tform={ form }\n\t\t\t\t\tonChange={ onChange }\n\t\t\t\t/>\n\t\t\t\t<PostTrash onActionPerformed={ onActionPerformed } />\n\t\t\t</VStack>\n\t\t</PostPanelSection>\n\t);\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAmB;AACnB,kBAAuC;AACvC,uBAAuC;AACvC,uBAAyB;AACzB,wBAA+C;AAC/C,qBAAwB;AACxB,mBAA8B;AAK9B,6BAA0B;AAC1B,gCAA6B;AAC7B,mBAAqC;AACrC,wBAAsB;AACtB,yBAA0B;AAC1B,mBAAyC;AACzC,uBAA2B;AAyRxB;AAvRH,IAAM,aAAa,EAAE,QAAQ,EAAE,MAAM,QAAQ,GAAG,QAAQ,CAAC,EAAE;AAiB3D,IAAM,WAAW;AAAA,EAChB,aAAa;AAAA,IACZ,WAAW;AAAA,MACV,MAAM;AAAA,MACN,MAAM;AAAA,MACN,QAAQ,CAAE,kBAAkB,wBA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AAAA,QACA;AAAA;AAAA,IACD;AAAA,IACA;AAAA,MAAC;AAAA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA;AAAA,IACD;AAAA,IACA,4CAAC,kBAAAC,SAAA,EAAU,mBAAwC;AAAA,KACpD,GACD;AAEF;",
6
- "names": ["coreDataStore", "editorStore", "usePostFields", "revisionsField", "PostPanelSection", "VStack", "PostCardPanel", "PostTrash"]
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useDispatch, useSelect, useRegistry } from '@wordpress/data';\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { DataForm } from '@wordpress/dataviews';\nimport { Stack } from '@wordpress/ui';\nimport { useMemo } from '@wordpress/element';\nimport { useViewConfig } from '@wordpress/views';\n\n/**\n * Internal dependencies\n */\nimport PostCardPanel from '../post-card-panel';\nimport PostPanelSection from '../post-panel-section';\nimport { store as editorStore } from '../../store';\nimport PostTrash from '../post-trash';\nimport usePostFields from '../post-fields';\nimport { usePostTemplatePanelMode } from '../post-template/hooks';\nimport revisionsField from '../../dataviews/fields/revisions';\n\nconst EMPTY_FORM = { layout: { type: 'panel' }, fields: [] };\nconst VIEW_CONFIG_FIELDS = [ 'form' ];\n\n/**\n * Bridges the legacy editor-panel visibility controls onto the DataForm summary,\n * returning the form with the hidden fields removed. The new inspector has no\n * concept of the Preferences → Panels switches or of `removeEditorPanel`, so we\n * reproduce their effect on the form.\n *\n * @param {Object} form The DataForm summary form configuration.\n * @return {Object} The form with the hidden fields removed.\n */\nfunction useInspectorPanelVisibility( form ) {\n\tconst {\n\t\tisPostStatusRemoved,\n\t\tfeaturedImageEnabled,\n\t\texcerptEnabled,\n\t\tdiscussionEnabled,\n\t\tpageAttributesEnabled,\n\t} = useSelect( ( select ) => {\n\t\tconst { isEditorPanelRemoved, isEditorPanelEnabled } =\n\t\t\tselect( editorStore );\n\t\treturn {\n\t\t\tisPostStatusRemoved: isEditorPanelRemoved( 'post-status' ),\n\t\t\tfeaturedImageEnabled: isEditorPanelEnabled( 'featured-image' ),\n\t\t\texcerptEnabled: isEditorPanelEnabled( 'post-excerpt' ),\n\t\t\tdiscussionEnabled: isEditorPanelEnabled( 'discussion-panel' ),\n\t\t\tpageAttributesEnabled: isEditorPanelEnabled( 'page-attributes' ),\n\t\t};\n\t}, [] );\n\n\tconst visibleForm = useMemo( () => {\n\t\tif ( ! form.fields?.length ) {\n\t\t\treturn form;\n\t\t}\n\t\t// `featured_media`/`excerpt` are their own top-level panels and\n\t\t// `post-content-info` is always shown, so they survive. Everything else\n\t\t// belongs to the `post-status` summary panel: `discussion`/`parent` honor\n\t\t// their own switch, but every one of them is hidden while the `post-status`\n\t\t// panel is removed.\n\t\tconst visibilityById = {\n\t\t\tfeatured_media: featuredImageEnabled,\n\t\t\texcerpt: excerptEnabled,\n\t\t\t'post-content-info': true,\n\t\t\tdiscussion: discussionEnabled && ! isPostStatusRemoved,\n\t\t\tparent: pageAttributesEnabled && ! isPostStatusRemoved,\n\t\t};\n\t\tconst isFieldVisible = ( id ) =>\n\t\t\tid in visibilityById ? visibilityById[ id ] : ! isPostStatusRemoved;\n\t\t// Recurse into `children` so a panel-tied field is dropped wherever it\n\t\t// sits in the form: the PHP view-config filter can nest such a field\n\t\t// inside another field's group.\n\t\tconst filterFields = ( fields ) =>\n\t\t\tfields.reduce( ( acc, field ) => {\n\t\t\t\tconst id = typeof field === 'string' ? field : field.id;\n\t\t\t\tif ( ! isFieldVisible( id ) ) {\n\t\t\t\t\treturn acc;\n\t\t\t\t}\n\t\t\t\tif (\n\t\t\t\t\ttypeof field !== 'string' &&\n\t\t\t\t\tArray.isArray( field.children )\n\t\t\t\t) {\n\t\t\t\t\tconst children = filterFields( field.children );\n\t\t\t\t\t// A group whose children were all removed would render as\n\t\t\t\t\t// an empty panel, so drop it too.\n\t\t\t\t\tif ( ! children.length ) {\n\t\t\t\t\t\treturn acc;\n\t\t\t\t\t}\n\t\t\t\t\tacc.push( { ...field, children } );\n\t\t\t\t\treturn acc;\n\t\t\t\t}\n\t\t\t\tacc.push( field );\n\t\t\t\treturn acc;\n\t\t\t}, [] );\n\t\treturn { ...form, fields: filterFields( form.fields ) };\n\t}, [\n\t\tform,\n\t\tisPostStatusRemoved,\n\t\tfeaturedImageEnabled,\n\t\texcerptEnabled,\n\t\tdiscussionEnabled,\n\t\tpageAttributesEnabled,\n\t] );\n\n\treturn visibleForm;\n}\n\n// Some post types expose summary fields that edit entities other than the one\n// being edited. Keyed by the post type that needs them, the related records are\n// merged into the form data under a `${ kind }_${ name }` namespace key so that\n// a single DataForm can read and write all of them, and edits to those keys are\n// routed back to their entity.\n//\n// The fields themselves are namespace-agnostic: they read and write a plain\n// record. The `fields` list ties each one to the entity it edits, and this\n// component overrides their `getValue`/`setValue`/`render` to operate on the\n// namespaced record, plus their `isVisible` to only show where that record is\n// present (e.g. the `home`/`index` template summary).\n//\n// Currently only `wp_template` uses this: `posts_per_page` and\n// `default_comment_status` target `root/site`, and `posts_page_title` targets\n// the posts page (the `page` assigned as `page_for_posts`).\nconst ENTITIES = {\n\twp_template: {\n\t\troot_site: {\n\t\t\tkind: 'root',\n\t\t\tname: 'site',\n\t\t\tfields: [ 'posts_per_page', 'default_comment_status' ],\n\t\t\tisVisible: ( item ) =>\n\t\t\t\t[ 'home', 'index' ].includes( item.slug ?? '' ),\n\t\t},\n\t\tposttype_page: {\n\t\t\tkind: 'postType',\n\t\t\tname: 'page',\n\t\t\tgetId: ( select ) =>\n\t\t\t\tselect( coreDataStore ).getEditedEntityRecord( 'root', 'site' )\n\t\t\t\t\t?.page_for_posts,\n\t\t\tfields: [ 'posts_page_title' ],\n\t\t\tisVisible: ( item ) =>\n\t\t\t\t[ 'home', 'index' ].includes( item.slug ?? '' ),\n\t\t},\n\t},\n};\n\n// Rebinds a namespace-agnostic field to the namespaced record it edits. Every\n// field callback that receives the form `item` is redirected to the\n// `item[ namespace ]` sub-record so the field operates on its own entity:\n// `getValue`/`setValue`/`render` here, and the rest indirectly because they all\n// funnel through the (remapped) `getValue` (default `render`, `getValueFormatted`\n// and `isValid` range/`custom` validation). Edits are wrapped back under the\n// namespace key. The caller-supplied `isVisible` encodes entity-specific\n// conditions (e.g. only for `home`/`index` templates); the generic guard\n// `!! item[ namespace ]` ensures the field is hidden when the sub-record\n// hasn't been fetched.\nfunction bindFieldToNamespace( field, namespace, isVisible = () => true ) {\n\tconst subItem = ( item ) => item?.[ namespace ] ?? {};\n\treturn {\n\t\t...field,\n\t\tgetValue: ( { item } ) =>\n\t\t\tfield.getValue\n\t\t\t\t? field.getValue( { item: subItem( item ) } )\n\t\t\t\t: subItem( item )[ field.id ],\n\t\tsetValue: ( { item, value } ) => ( {\n\t\t\t[ namespace ]: field.setValue( { item: subItem( item ), value } ),\n\t\t} ),\n\t\trender: field.render\n\t\t\t? ( props ) =>\n\t\t\t\t\tfield.render( { ...props, item: subItem( props.item ) } )\n\t\t\t: undefined,\n\t\tisVisible: ( item ) => isVisible( item ) && !! item[ namespace ],\n\t};\n}\n\nexport default function DataFormPostSummary( { onActionPerformed } ) {\n\tconst { postType, postId, isPostStatusRemoved, availableTemplates } =\n\t\tuseSelect( ( select ) => {\n\t\t\tconst {\n\t\t\t\tgetCurrentPostType,\n\t\t\t\tgetCurrentPostId,\n\t\t\t\tisEditorPanelRemoved,\n\t\t\t\tgetEditorSettings,\n\t\t\t} = select( editorStore );\n\t\t\tconst _availableTemplates = select(\n\t\t\t\tcoreDataStore\n\t\t\t).getCurrentTheme()?.is_block_theme\n\t\t\t\t? null\n\t\t\t\t: getEditorSettings().availableTemplates ?? null;\n\t\t\treturn {\n\t\t\t\tpostType: getCurrentPostType(),\n\t\t\t\tpostId: getCurrentPostId(),\n\t\t\t\tisPostStatusRemoved: isEditorPanelRemoved( 'post-status' ),\n\t\t\t\tavailableTemplates: _availableTemplates,\n\t\t\t};\n\t\t}, [] );\n\tconst { form: formConfig } = useViewConfig( {\n\t\tkind: 'postType',\n\t\tname: postType,\n\t\tfields: VIEW_CONFIG_FIELDS,\n\t} );\n\t// Bridge the legacy editor-panel visibility (Preferences → Panels and\n\t// programmatic panel removal) onto the form by dropping hidden fields.\n\tconst form = useInspectorPanelVisibility( formConfig ?? EMPTY_FORM );\n\tconst record = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! postType || ! postId ) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\treturn select( coreDataStore ).getEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tpostType,\n\t\t\t\tpostId\n\t\t\t);\n\t\t},\n\t\t[ postType, postId ]\n\t);\n\n\tconst templatePanelMode = usePostTemplatePanelMode();\n\n\tconst entityRecords = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedEntityRecord, canUser } = select( coreDataStore );\n\n\t\t\tconst records = {};\n\n\t\t\t// Other entities the current post type needs merged into its form.\n\t\t\tfor ( const [ namespace, entity ] of Object.entries(\n\t\t\t\tENTITIES[ postType ] ?? {}\n\t\t\t) ) {\n\t\t\t\tif (\n\t\t\t\t\t! canUser( 'read', {\n\t\t\t\t\t\tkind: entity.kind,\n\t\t\t\t\t\tname: entity.name,\n\t\t\t\t\t} )\n\t\t\t\t) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tconst id = entity.getId ? entity.getId( select ) : undefined;\n\t\t\t\t// Entities resolved through another record need a valid id.\n\t\t\t\tif ( entity.getId && ! id ) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\trecords[ namespace ] = getEditedEntityRecord(\n\t\t\t\t\tentity.kind,\n\t\t\t\t\tentity.name,\n\t\t\t\t\tid\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn records;\n\t\t},\n\t\t[ postType ]\n\t);\n\n\t// Merge the supplementary data onto the record.\n\tconst data = useMemo( () => {\n\t\tif ( ! record ) {\n\t\t\treturn record;\n\t\t}\n\t\tconst extra = { ...entityRecords };\n\t\tif ( availableTemplates && Object.keys( availableTemplates ).length ) {\n\t\t\textra.available_templates = availableTemplates;\n\t\t}\n\t\treturn { ...record, ...extra };\n\t}, [ record, entityRecords, availableTemplates ] );\n\n\tconst { editEntityRecord } = useDispatch( coreDataStore );\n\tconst registry = useRegistry();\n\n\t// Map of namespaced field id to the namespace key its entity is merged under.\n\tconst fieldNamespaces = useMemo( () => {\n\t\tconst map = {};\n\t\tfor ( const [ namespace, entity ] of Object.entries(\n\t\t\tENTITIES[ postType ] ?? {}\n\t\t) ) {\n\t\t\tfor ( const id of entity.fields ?? [] ) {\n\t\t\t\tmap[ id ] = namespace;\n\t\t\t}\n\t\t}\n\t\treturn map;\n\t}, [ postType ] );\n\n\tconst _fields = usePostFields( { postType } );\n\tconst fields = useMemo(\n\t\t() =>\n\t\t\t_fields\n\t\t\t\t?.map( ( field ) => {\n\t\t\t\t\tconst namespace = fieldNamespaces[ field.id ];\n\t\t\t\t\tif ( namespace ) {\n\t\t\t\t\t\treturn bindFieldToNamespace(\n\t\t\t\t\t\t\tfield,\n\t\t\t\t\t\t\tnamespace,\n\t\t\t\t\t\t\tENTITIES[ postType ]?.[ namespace ]?.isVisible\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tif ( field.id === 'status' ) {\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t...field,\n\t\t\t\t\t\t\telements: field.elements.filter(\n\t\t\t\t\t\t\t\t( element ) => element.value !== 'trash'\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\tif ( field.id === 'template' ) {\n\t\t\t\t\t\t// `usePostTemplatePanelMode` is reused in the Post Template panel to match\n\t\t\t\t\t\t// the existing behavior. If the panel rendered nothing we should exclude the\n\t\t\t\t\t\t// template field from the form.\n\t\t\t\t\t\tif ( ! templatePanelMode ) {\n\t\t\t\t\t\t\treturn null;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// In classic themes without available templates we need to make the field read-only.\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\ttemplatePanelMode === 'classic' &&\n\t\t\t\t\t\t\tObject.keys( availableTemplates ?? {} ).length === 0\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t...field,\n\t\t\t\t\t\t\t\treadOnly: true,\n\t\t\t\t\t\t\t\trender: () => __( 'Default template' ),\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn field;\n\t\t\t\t\t}\n\t\t\t\t\treturn field;\n\t\t\t\t} )\n\t\t\t\t.filter( Boolean )\n\t\t\t\t// Editor-only field, injected here rather than registered\n\t\t\t\t// so it never leaks into the site editor list / quick-edit fields.\n\t\t\t\t.concat( revisionsField ),\n\t\t[\n\t\t\t_fields,\n\t\t\ttemplatePanelMode,\n\t\t\tavailableTemplates,\n\t\t\tfieldNamespaces,\n\t\t\tpostType,\n\t\t]\n\t);\n\n\tconst onChange = ( edits ) => {\n\t\t// Route edits that target another entity (merged in under a namespace)\n\t\t// back to that entity; collect the rest for the post being edited.\n\t\tconst entities = ENTITIES[ postType ] ?? {};\n\t\tconst baseEdits = {};\n\t\tfor ( const [ key, value ] of Object.entries( edits ) ) {\n\t\t\tconst entity = entities[ key ];\n\t\t\tif ( entity ) {\n\t\t\t\t// Resolve the id the same way it was resolved to read the\n\t\t\t\t// record, so the save targets the right entity regardless of\n\t\t\t\t// its key field (`undefined` for the `root/site` singleton).\n\t\t\t\tconst id = entity.getId\n\t\t\t\t\t? entity.getId( registry.select )\n\t\t\t\t\t: undefined;\n\t\t\t\teditEntityRecord( entity.kind, entity.name, id, value );\n\t\t\t} else {\n\t\t\t\tbaseEdits[ key ] = value;\n\t\t\t}\n\t\t}\n\n\t\tif ( ! Object.keys( baseEdits ).length ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (\n\t\t\tbaseEdits.status &&\n\t\t\tbaseEdits.status !== 'future' &&\n\t\t\trecord?.status === 'future' &&\n\t\t\tnew Date( record.date ) > new Date()\n\t\t) {\n\t\t\tbaseEdits.date = null;\n\t\t}\n\t\tif (\n\t\t\tbaseEdits.status &&\n\t\t\tbaseEdits.status === 'private' &&\n\t\t\trecord?.password\n\t\t) {\n\t\t\tbaseEdits.password = '';\n\t\t}\n\n\t\teditEntityRecord( 'postType', postType, postId, baseEdits );\n\t};\n\treturn (\n\t\t<PostPanelSection className=\"editor-post-summary\">\n\t\t\t<Stack direction=\"column\" gap=\"lg\">\n\t\t\t\t<PostCardPanel\n\t\t\t\t\tpostType={ postType }\n\t\t\t\t\tpostId={ postId }\n\t\t\t\t\tonActionPerformed={ onActionPerformed }\n\t\t\t\t/>\n\t\t\t\t<DataForm\n\t\t\t\t\tdata={ data }\n\t\t\t\t\tfields={ fields }\n\t\t\t\t\tform={ form }\n\t\t\t\t\tonChange={ onChange }\n\t\t\t\t/>\n\t\t\t\t{ ! isPostStatusRemoved && (\n\t\t\t\t\t<PostTrash onActionPerformed={ onActionPerformed } />\n\t\t\t\t) }\n\t\t\t</Stack>\n\t\t</PostPanelSection>\n\t);\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAmB;AACnB,kBAAoD;AACpD,uBAAuC;AACvC,uBAAyB;AACzB,gBAAsB;AACtB,qBAAwB;AACxB,mBAA8B;AAK9B,6BAA0B;AAC1B,gCAA6B;AAC7B,mBAAqC;AACrC,wBAAsB;AACtB,yBAA0B;AAC1B,mBAAyC;AACzC,uBAA2B;AA2WxB;AAzWH,IAAM,aAAa,EAAE,QAAQ,EAAE,MAAM,QAAQ,GAAG,QAAQ,CAAC,EAAE;AAC3D,IAAM,qBAAqB,CAAE,MAAO;AAWpC,SAAS,4BAA6B,MAAO;AAC5C,QAAM;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD,QAAI,uBAAW,CAAE,WAAY;AAC5B,UAAM,EAAE,sBAAsB,qBAAqB,IAClD,OAAQ,aAAAA,KA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,MAC7B;AAAA;AAAA,MAAC,uBAAAC;AAAA,MAAA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA;AAAA,IACD;AAAA,IACA;AAAA,MAAC;AAAA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA;AAAA,IACD;AAAA,IACE,CAAE,uBACH,4CAAC,kBAAAC,SAAA,EAAU,mBAAwC;AAAA,KAErD,GACD;AAEF;",
6
+ "names": ["editorStore", "coreDataStore", "usePostFields", "revisionsField", "PostPanelSection", "PostCardPanel", "PostTrash"]
7
7
  }
@@ -33,7 +33,7 @@ __export(post_summary_exports, {
33
33
  default: () => PostSummary
34
34
  });
35
35
  module.exports = __toCommonJS(post_summary_exports);
36
- var import_components = require("@wordpress/components");
36
+ var import_ui = require("@wordpress/ui");
37
37
  var import_data = require("@wordpress/data");
38
38
  var import_dataform_post_summary = __toESM(require("./dataform-post-summary.cjs"));
39
39
  var import_plugin_post_status_info = __toESM(require("../plugin-post-status-info/index.cjs"));
@@ -65,7 +65,9 @@ function PostSummary({ onActionPerformed }) {
65
65
  (select) => select(import_store.store).getCurrentPostType(),
66
66
  []
67
67
  );
68
- if (window?.__experimentalDataFormInspector && ["page", "post", "wp_template"].includes(postType)) {
68
+ if (window?.__experimentalDataFormInspector && ["page", "post", "wp_template", "wp_template_part"].includes(
69
+ postType
70
+ )) {
69
71
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dataform_post_summary.default, { onActionPerformed });
70
72
  }
71
73
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ClassicPostSummary, { onActionPerformed });
@@ -86,7 +88,7 @@ function ClassicPostSummary({ onActionPerformed }) {
86
88
  },
87
89
  []
88
90
  );
89
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_post_panel_section.default, { className: "editor-post-summary", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_post_status_info.default.Slot, { children: (fills) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_components.__experimentalVStack, { spacing: 4, children: [
91
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_post_panel_section.default, { className: "editor-post-summary", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_post_status_info.default.Slot, { children: (fills) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_ui.Stack, { direction: "column", gap: "lg", children: [
90
92
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
91
93
  import_post_card_panel.default,
92
94
  {
@@ -97,12 +99,12 @@ function ClassicPostSummary({ onActionPerformed }) {
97
99
  ),
98
100
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_panel5.default, { withPanelBody: false }),
99
101
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_panel4.PrivatePostExcerptPanel, {}),
100
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_components.__experimentalVStack, { spacing: 1, children: [
102
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_ui.Stack, { direction: "column", gap: "xs", children: [
101
103
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_post_content_information.default, {}),
102
104
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_post_last_edited_panel.default, {})
103
105
  ] }),
104
- !isRemovedPostStatusPanel && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_components.__experimentalVStack, { spacing: 4, children: [
105
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_components.__experimentalVStack, { spacing: 1, children: [
106
+ !isRemovedPostStatusPanel && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_ui.Stack, { direction: "column", gap: "lg", children: [
107
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_ui.Stack, { direction: "column", gap: "xs", children: [
106
108
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_post_status.default, {}),
107
109
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_panel7.default, {}),
108
110
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_panel9.default, {}),
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/sidebar/post-summary.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __experimentalVStack as VStack } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport DataFormPostSummary from './dataform-post-summary';\nimport PluginPostStatusInfo from '../plugin-post-status-info';\nimport PostAuthorPanel from '../post-author/panel';\nimport PostCardPanel from '../post-card-panel';\nimport PostContentInformation from '../post-content-information';\nimport PageAttributesPanel from '../page-attributes/panel';\nimport PostDiscussionPanel from '../post-discussion/panel';\nimport { PrivatePostExcerptPanel as PostExcerptPanel } from '../post-excerpt/panel';\nimport PostFeaturedImagePanel from '../post-featured-image/panel';\nimport PostFormatPanel from '../post-format/panel';\nimport PostLastEditedPanel from '../post-last-edited-panel';\nimport PostPanelSection from '../post-panel-section';\nimport PostSchedulePanel from '../post-schedule/panel';\nimport PostStatusPanel from '../post-status';\nimport PostSyncStatus from '../post-sync-status';\nimport PostTemplatePanel from '../post-template/panel';\nimport PostURLPanel from '../post-url/panel';\nimport BlogTitle from '../blog-title';\nimport PostsPerPage from '../posts-per-page';\nimport SiteDiscussion from '../site-discussion';\nimport { store as editorStore } from '../../store';\nimport { PrivatePostLastRevision } from '../post-last-revision';\nimport PostTrash from '../post-trash';\n\n/**\n * Module Constants\n */\nconst PANEL_NAME = 'post-status';\n\nexport default function PostSummary( { onActionPerformed } ) {\n\tconst postType = useSelect(\n\t\t( select ) => select( editorStore ).getCurrentPostType(),\n\t\t[]\n\t);\n\tif (\n\t\twindow?.__experimentalDataFormInspector &&\n\t\t[ 'page', 'post', 'wp_template' ].includes( postType )\n\t) {\n\t\treturn <DataFormPostSummary onActionPerformed={ onActionPerformed } />;\n\t}\n\treturn <ClassicPostSummary onActionPerformed={ onActionPerformed } />;\n}\n\nfunction ClassicPostSummary( { onActionPerformed } ) {\n\tconst { isRemovedPostStatusPanel, postType, postId } = useSelect(\n\t\t( select ) => {\n\t\t\t// We use isEditorPanelRemoved to hide the panel if it was programmatically removed. We do\n\t\t\t// not use isEditorPanelEnabled since this panel should not be disabled through the UI.\n\t\t\tconst {\n\t\t\t\tisEditorPanelRemoved,\n\t\t\t\tgetCurrentPostType,\n\t\t\t\tgetCurrentPostId,\n\t\t\t} = select( editorStore );\n\t\t\treturn {\n\t\t\t\tisRemovedPostStatusPanel: isEditorPanelRemoved( PANEL_NAME ),\n\t\t\t\tpostType: getCurrentPostType(),\n\t\t\t\tpostId: getCurrentPostId(),\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\treturn (\n\t\t<PostPanelSection className=\"editor-post-summary\">\n\t\t\t<PluginPostStatusInfo.Slot>\n\t\t\t\t{ ( fills ) => (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<VStack spacing={ 4 }>\n\t\t\t\t\t\t\t<PostCardPanel\n\t\t\t\t\t\t\t\tpostType={ postType }\n\t\t\t\t\t\t\t\tpostId={ postId }\n\t\t\t\t\t\t\t\tonActionPerformed={ onActionPerformed }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<PostFeaturedImagePanel withPanelBody={ false } />\n\t\t\t\t\t\t\t<PostExcerptPanel />\n\t\t\t\t\t\t\t<VStack spacing={ 1 }>\n\t\t\t\t\t\t\t\t<PostContentInformation />\n\t\t\t\t\t\t\t\t<PostLastEditedPanel />\n\t\t\t\t\t\t\t</VStack>\n\t\t\t\t\t\t\t{ ! isRemovedPostStatusPanel && (\n\t\t\t\t\t\t\t\t<VStack spacing={ 4 }>\n\t\t\t\t\t\t\t\t\t<VStack spacing={ 1 }>\n\t\t\t\t\t\t\t\t\t\t<PostStatusPanel />\n\t\t\t\t\t\t\t\t\t\t<PostSchedulePanel />\n\t\t\t\t\t\t\t\t\t\t<PostURLPanel />\n\t\t\t\t\t\t\t\t\t\t<PostAuthorPanel />\n\t\t\t\t\t\t\t\t\t\t<PostTemplatePanel />\n\t\t\t\t\t\t\t\t\t\t<PostDiscussionPanel />\n\t\t\t\t\t\t\t\t\t\t<PrivatePostLastRevision />\n\t\t\t\t\t\t\t\t\t\t<PageAttributesPanel />\n\t\t\t\t\t\t\t\t\t\t<PostSyncStatus />\n\t\t\t\t\t\t\t\t\t\t<BlogTitle />\n\t\t\t\t\t\t\t\t\t\t<PostsPerPage />\n\t\t\t\t\t\t\t\t\t\t<SiteDiscussion />\n\t\t\t\t\t\t\t\t\t\t<PostFormatPanel />\n\t\t\t\t\t\t\t\t\t\t{ fills }\n\t\t\t\t\t\t\t\t\t</VStack>\n\t\t\t\t\t\t\t\t\t<PostTrash\n\t\t\t\t\t\t\t\t\t\tonActionPerformed={ onActionPerformed }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</VStack>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</VStack>\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t</PluginPostStatusInfo.Slot>\n\t\t</PostPanelSection>\n\t);\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAA+C;AAC/C,kBAA0B;AAK1B,mCAAgC;AAChC,qCAAiC;AACjC,mBAA4B;AAC5B,6BAA0B;AAC1B,sCAAmC;AACnC,IAAAA,gBAAgC;AAChC,IAAAA,gBAAgC;AAChC,IAAAA,gBAA4D;AAC5D,IAAAA,gBAAmC;AACnC,IAAAA,gBAA4B;AAC5B,oCAAgC;AAChC,gCAA6B;AAC7B,IAAAA,gBAA8B;AAC9B,yBAA4B;AAC5B,8BAA2B;AAC3B,IAAAA,gBAA8B;AAC9B,IAAAA,gBAAyB;AACzB,wBAAsB;AACtB,4BAAyB;AACzB,6BAA2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AAC,kBAAAL,sBAAA,EAAO,SAAU,GACjB;AAAA,mDAAC,kBAAAA,sBAAA,EAAO,SAAU,GACjB;AAAA,oDAAC,mBAAAM,SAAA,EAAgB;AAAA,QACjB,4CAAC,cAAAC,SAAA,EAAkB;AAAA,QACnB,4CAAC,cAAAC,SAAA,EAAa;AAAA,QACd,4CAAC,aAAAC,SAAA,EAAgB;AAAA,QACjB,4CAAC,cAAAC,SAAA,EAAkB;AAAA,QACnB,4CAAC,cAAAC,SAAA,EAAoB;AAAA,QACrB,4CAAC,qDAAwB;AAAA,QACzB,4CAAC,cAAAC,SAAA,EAAoB;AAAA,QACrB,4CAAC,wBAAAC,SAAA,EAAe;AAAA,QAChB,4CAAC,kBAAAC,SAAA,EAAU;AAAA,QACX,4CAAC,sBAAAC,SAAA,EAAa;AAAA,QACd,4CAAC,uBAAAC,SAAA,EAAe;AAAA,QAChB,4CAAC,cAAAC,SAAA,EAAgB;AAAA,QACf;AAAA,SACH;AAAA,MACA;AAAA,QAAC,kBAAAC;AAAA,QAAA;AAAA,UACA;AAAA;AAAA,MACD;AAAA,OACD;AAAA,KAEF,GACD,GAEF,GACD;AAEF;",
6
- "names": ["import_panel", "editorStore", "DataFormPostSummary", "PostPanelSection", "PluginPostStatusInfo", "VStack", "PostCardPanel", "PostFeaturedImagePanel", "PostExcerptPanel", "PostContentInformation", "PostLastEditedPanel", "PostStatusPanel", "PostSchedulePanel", "PostURLPanel", "PostAuthorPanel", "PostTemplatePanel", "PostDiscussionPanel", "PageAttributesPanel", "PostSyncStatus", "BlogTitle", "PostsPerPage", "SiteDiscussion", "PostFormatPanel", "PostTrash"]
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { Stack } from '@wordpress/ui';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport DataFormPostSummary from './dataform-post-summary';\nimport PluginPostStatusInfo from '../plugin-post-status-info';\nimport PostAuthorPanel from '../post-author/panel';\nimport PostCardPanel from '../post-card-panel';\nimport PostContentInformation from '../post-content-information';\nimport PageAttributesPanel from '../page-attributes/panel';\nimport PostDiscussionPanel from '../post-discussion/panel';\nimport { PrivatePostExcerptPanel as PostExcerptPanel } from '../post-excerpt/panel';\nimport PostFeaturedImagePanel from '../post-featured-image/panel';\nimport PostFormatPanel from '../post-format/panel';\nimport PostLastEditedPanel from '../post-last-edited-panel';\nimport PostPanelSection from '../post-panel-section';\nimport PostSchedulePanel from '../post-schedule/panel';\nimport PostStatusPanel from '../post-status';\nimport PostSyncStatus from '../post-sync-status';\nimport PostTemplatePanel from '../post-template/panel';\nimport PostURLPanel from '../post-url/panel';\nimport BlogTitle from '../blog-title';\nimport PostsPerPage from '../posts-per-page';\nimport SiteDiscussion from '../site-discussion';\nimport { store as editorStore } from '../../store';\nimport { PrivatePostLastRevision } from '../post-last-revision';\nimport PostTrash from '../post-trash';\n\n/**\n * Module Constants\n */\nconst PANEL_NAME = 'post-status';\n\nexport default function PostSummary( { onActionPerformed } ) {\n\tconst postType = useSelect(\n\t\t( select ) => select( editorStore ).getCurrentPostType(),\n\t\t[]\n\t);\n\tif (\n\t\twindow?.__experimentalDataFormInspector &&\n\t\t[ 'page', 'post', 'wp_template', 'wp_template_part' ].includes(\n\t\t\tpostType\n\t\t)\n\t) {\n\t\treturn <DataFormPostSummary onActionPerformed={ onActionPerformed } />;\n\t}\n\treturn <ClassicPostSummary onActionPerformed={ onActionPerformed } />;\n}\n\nfunction ClassicPostSummary( { onActionPerformed } ) {\n\tconst { isRemovedPostStatusPanel, postType, postId } = useSelect(\n\t\t( select ) => {\n\t\t\t// We use isEditorPanelRemoved to hide the panel if it was programmatically removed. We do\n\t\t\t// not use isEditorPanelEnabled since this panel should not be disabled through the UI.\n\t\t\tconst {\n\t\t\t\tisEditorPanelRemoved,\n\t\t\t\tgetCurrentPostType,\n\t\t\t\tgetCurrentPostId,\n\t\t\t} = select( editorStore );\n\t\t\treturn {\n\t\t\t\tisRemovedPostStatusPanel: isEditorPanelRemoved( PANEL_NAME ),\n\t\t\t\tpostType: getCurrentPostType(),\n\t\t\t\tpostId: getCurrentPostId(),\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\treturn (\n\t\t<PostPanelSection className=\"editor-post-summary\">\n\t\t\t<PluginPostStatusInfo.Slot>\n\t\t\t\t{ ( fills ) => (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<Stack direction=\"column\" gap=\"lg\">\n\t\t\t\t\t\t\t<PostCardPanel\n\t\t\t\t\t\t\t\tpostType={ postType }\n\t\t\t\t\t\t\t\tpostId={ postId }\n\t\t\t\t\t\t\t\tonActionPerformed={ onActionPerformed }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<PostFeaturedImagePanel withPanelBody={ false } />\n\t\t\t\t\t\t\t<PostExcerptPanel />\n\t\t\t\t\t\t\t<Stack direction=\"column\" gap=\"xs\">\n\t\t\t\t\t\t\t\t<PostContentInformation />\n\t\t\t\t\t\t\t\t<PostLastEditedPanel />\n\t\t\t\t\t\t\t</Stack>\n\t\t\t\t\t\t\t{ ! isRemovedPostStatusPanel && (\n\t\t\t\t\t\t\t\t<Stack direction=\"column\" gap=\"lg\">\n\t\t\t\t\t\t\t\t\t<Stack direction=\"column\" gap=\"xs\">\n\t\t\t\t\t\t\t\t\t\t<PostStatusPanel />\n\t\t\t\t\t\t\t\t\t\t<PostSchedulePanel />\n\t\t\t\t\t\t\t\t\t\t<PostURLPanel />\n\t\t\t\t\t\t\t\t\t\t<PostAuthorPanel />\n\t\t\t\t\t\t\t\t\t\t<PostTemplatePanel />\n\t\t\t\t\t\t\t\t\t\t<PostDiscussionPanel />\n\t\t\t\t\t\t\t\t\t\t<PrivatePostLastRevision />\n\t\t\t\t\t\t\t\t\t\t<PageAttributesPanel />\n\t\t\t\t\t\t\t\t\t\t<PostSyncStatus />\n\t\t\t\t\t\t\t\t\t\t<BlogTitle />\n\t\t\t\t\t\t\t\t\t\t<PostsPerPage />\n\t\t\t\t\t\t\t\t\t\t<SiteDiscussion />\n\t\t\t\t\t\t\t\t\t\t<PostFormatPanel />\n\t\t\t\t\t\t\t\t\t\t{ fills }\n\t\t\t\t\t\t\t\t\t</Stack>\n\t\t\t\t\t\t\t\t\t<PostTrash\n\t\t\t\t\t\t\t\t\t\tonActionPerformed={ onActionPerformed }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</Stack>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</Stack>\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t</PluginPostStatusInfo.Slot>\n\t\t</PostPanelSection>\n\t);\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,gBAAsB;AACtB,kBAA0B;AAK1B,mCAAgC;AAChC,qCAAiC;AACjC,mBAA4B;AAC5B,6BAA0B;AAC1B,sCAAmC;AACnC,IAAAA,gBAAgC;AAChC,IAAAA,gBAAgC;AAChC,IAAAA,gBAA4D;AAC5D,IAAAA,gBAAmC;AACnC,IAAAA,gBAA4B;AAC5B,oCAAgC;AAChC,gCAA6B;AAC7B,IAAAA,gBAA8B;AAC9B,yBAA4B;AAC5B,8BAA2B;AAC3B,IAAAA,gBAA8B;AAC9B,IAAAA,gBAAyB;AACzB,wBAAsB;AACtB,4BAAyB;AACzB,6BAA2B;AAC3B,mBAAqC;AACrC,gCAAwC;AACxC,wBAAsB;AAkBb;AAbT,IAAM,aAAa;AAEJ,SAAR,YAA8B,EAAE,kBAAkB,GAAI;AAC5D,QAAM,eAAW;AAAA,IAChB,CAAE,WAAY,OAAQ,aAAAC,KAAY,EAAE,mBAAmB;AAAA,IACvD,CAAC;AAAA,EACF;AACA,MACC,QAAQ,mCACR,CAAE,QAAQ,QAAQ,eAAe,kBAAmB,EAAE;AAAA,IACrD;AAAA,EACD,GACC;AACD,WAAO,4CAAC,6BAAAC,SAAA,EAAoB,mBAAwC;AAAA,EACrE;AACA,SAAO,4CAAC,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EAAoB;AAAA,QACrB,4CAAC,wBAAAC,SAAA,EAAe;AAAA,QAChB,4CAAC,kBAAAC,SAAA,EAAU;AAAA,QACX,4CAAC,sBAAAC,SAAA,EAAa;AAAA,QACd,4CAAC,uBAAAC,SAAA,EAAe;AAAA,QAChB,4CAAC,cAAAC,SAAA,EAAgB;AAAA,QACf;AAAA,SACH;AAAA,MACA;AAAA,QAAC,kBAAAC;AAAA,QAAA;AAAA,UACA;AAAA;AAAA,MACD;AAAA,OACD;AAAA,KAEF,GACD,GAEF,GACD;AAEF;",
6
+ "names": ["import_panel", "editorStore", "DataFormPostSummary", "PostPanelSection", "PluginPostStatusInfo", "PostCardPanel", "PostFeaturedImagePanel", "PostExcerptPanel", "PostContentInformation", "PostLastEditedPanel", "PostStatusPanel", "PostSchedulePanel", "PostURLPanel", "PostAuthorPanel", "PostTemplatePanel", "PostDiscussionPanel", "PageAttributesPanel", "PostSyncStatus", "BlogTitle", "PostsPerPage", "SiteDiscussion", "PostFormatPanel", "PostTrash"]
7
7
  }
@@ -159,7 +159,9 @@ var registerPostTypeSchema = (postType) => async ({ registry }) => {
159
159
  } else {
160
160
  fields = [
161
161
  postTypeConfig.supports?.thumbnail && currentTheme?.theme_supports?.["post-thumbnails"] && import_fields.featuredImageField,
162
- postTypeConfig.supports?.author && import_fields.authorField,
162
+ !import_constants.DESIGN_POST_TYPES.includes(postTypeConfig.slug) && postTypeConfig.supports?.author && import_fields.authorField,
163
+ postTypeConfig.slug === "wp_template" && import_fields.templateAuthorField,
164
+ postTypeConfig.slug === "wp_template_part" && import_fields.templatePartAuthorField,
163
165
  !import_constants.DESIGN_POST_TYPES.includes(postTypeConfig.slug) && import_fields.statusField,
164
166
  !import_constants.DESIGN_POST_TYPES.includes(postTypeConfig.slug) && import_fields.dateField,
165
167
  !import_constants.DESIGN_POST_TYPES.includes(postTypeConfig.slug) && import_fields.scheduledDateField,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/dataviews/store/private-actions.ts"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { store as coreStore } from '@wordpress/core-data';\nimport type { Action, Field } from '@wordpress/dataviews';\nimport { doAction } from '@wordpress/hooks';\nimport type { PostType } from '@wordpress/fields';\nimport {\n\tviewPost,\n\tviewPostRevisions,\n\tduplicatePost,\n\tduplicatePattern,\n\treorderPage,\n\texportPattern,\n\tpermanentlyDeletePost,\n\trestorePost,\n\ttrashPost,\n\trenamePost,\n\tresetPost,\n\tdeletePost,\n\tduplicateTemplatePart,\n\texcerptField,\n\tfeaturedImageField,\n\tdateField,\n\tparentField,\n\tpasswordField,\n\tcommentStatusField,\n\tpingStatusField,\n\tdiscussionField,\n\tslugField,\n\tstatusField,\n\tauthorField,\n\ttitleField,\n\ttemplateField,\n\ttemplateTitleField,\n\tpageTitleField,\n\tpatternTitleField,\n\tnotesField,\n\tscheduledDateField,\n\tlastEditedDateField,\n\tformatField,\n\tpostContentInfoField,\n\tstickyField,\n\tdescriptionField,\n\treadOnlyDescriptionField,\n\tpostsPerPageField,\n\tsiteDiscussionField,\n\tpostsPageTitleField,\n} from '@wordpress/fields';\nimport {\n\taltTextField,\n\tattachedToField,\n\tauthorField as mediaAuthorField,\n\tcaptionField,\n\tdateAddedField,\n\tdescriptionField as mediaDescriptionField,\n\tfilenameField,\n\tfilesizeField,\n\tmediaDimensionsField,\n\tmimeTypeField,\n} from '@wordpress/media-fields';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport { ATTACHMENT_POST_TYPE, DESIGN_POST_TYPES } from '../../store/constants';\nimport postPreviewField from '../fields/content-preview';\nimport { unlock } from '../../lock-unlock';\n\ndeclare global {\n\tinterface Window {\n\t\t__experimentalTemplateActivate?: boolean;\n\t}\n}\n\n/**\n * Check if a post type supports editor notes.\n *\n * @param supports The post type supports object.\n * @return Whether editor notes are supported.\n */\nfunction hasEditorNotesSupport( supports?: PostType[ 'supports' ] ): boolean {\n\tconst editor = supports?.editor;\n\tif ( Array.isArray( editor ) ) {\n\t\treturn !! editor[ 0 ]?.notes;\n\t}\n\treturn false;\n}\n\nexport function registerEntityAction< Item >(\n\tkind: string,\n\tname: string,\n\tconfig: Action< Item >\n) {\n\treturn {\n\t\ttype: 'REGISTER_ENTITY_ACTION' as const,\n\t\tkind,\n\t\tname,\n\t\tconfig,\n\t};\n}\n\nexport function unregisterEntityAction(\n\tkind: string,\n\tname: string,\n\tactionId: string\n) {\n\treturn {\n\t\ttype: 'UNREGISTER_ENTITY_ACTION' as const,\n\t\tkind,\n\t\tname,\n\t\tactionId,\n\t};\n}\n\nexport function registerEntityField< Item >(\n\tkind: string,\n\tname: string,\n\tconfig: Field< Item >\n) {\n\treturn {\n\t\ttype: 'REGISTER_ENTITY_FIELD' as const,\n\t\tkind,\n\t\tname,\n\t\tconfig,\n\t};\n}\n\nexport function unregisterEntityField(\n\tkind: string,\n\tname: string,\n\tfieldId: string\n) {\n\treturn {\n\t\ttype: 'UNREGISTER_ENTITY_FIELD' as const,\n\t\tkind,\n\t\tname,\n\t\tfieldId,\n\t};\n}\n\nexport function setIsReady( kind: string, name: string ) {\n\treturn {\n\t\ttype: 'SET_IS_READY' as const,\n\t\tkind,\n\t\tname,\n\t};\n}\n\n/*\n * Media fields for the attachment post type.\n *\n * Field order follows a logical grouping:\n * 1. Metadata fields in panels (date, author, file info)\n * 2. Core editable fields (title, alt text, caption, description)\n *\n * Note: media_thumbnail is not included as it's shown in the canvas preview\n */\nconst ORDERED_MEDIA_FIELDS = [\n\t// Metadata in panels (collapsed by default).\n\tdateAddedField,\n\tmediaAuthorField,\n\tfilenameField,\n\tmimeTypeField,\n\tfilesizeField,\n\tmediaDimensionsField,\n\tattachedToField,\n\t// Regular layout fields (always visible).\n\ttitleField,\n\taltTextField,\n\tcaptionField,\n\tmediaDescriptionField,\n];\n\nexport const registerPostTypeSchema =\n\t( postType: string ) =>\n\tasync ( { registry }: { registry: any } ) => {\n\t\tconst isReady = unlock( registry.select( editorStore ) ).isEntityReady(\n\t\t\t'postType',\n\t\t\tpostType\n\t\t);\n\t\tif ( isReady ) {\n\t\t\treturn;\n\t\t}\n\n\t\tunlock( registry.dispatch( editorStore ) ).setIsReady(\n\t\t\t'postType',\n\t\t\tpostType\n\t\t);\n\n\t\tconst postTypeConfig = ( await registry\n\t\t\t.resolveSelect( coreStore )\n\t\t\t.getPostType( postType ) ) as PostType;\n\n\t\tconst canCreate = await registry\n\t\t\t.resolveSelect( coreStore )\n\t\t\t.canUser( 'create', {\n\t\t\t\tkind: 'postType',\n\t\t\t\tname: postType,\n\t\t\t} );\n\t\tconst currentTheme = await registry\n\t\t\t.resolveSelect( coreStore )\n\t\t\t.getCurrentTheme();\n\t\tconst { disablePostFormats } = registry\n\t\t\t.select( editorStore )\n\t\t\t.getEditorSettings();\n\n\t\tlet canDuplicate =\n\t\t\t! [ 'wp_block', 'wp_template_part' ].includes(\n\t\t\t\tpostTypeConfig.slug\n\t\t\t) &&\n\t\t\tcanCreate &&\n\t\t\tduplicatePost;\n\n\t\t// @ts-ignore\n\t\tif ( ! globalThis.IS_GUTENBERG_PLUGIN ) {\n\t\t\t// Outside Gutenberg, disable duplication except for wp_template.\n\t\t\tif ( 'wp_template' !== postTypeConfig.slug ) {\n\t\t\t\tcanDuplicate = undefined;\n\t\t\t}\n\t\t}\n\n\t\t// When template activation experiment is disabled, templates cannot be duplicated.\n\t\t// @ts-ignore\n\t\tif (\n\t\t\tpostTypeConfig.slug === 'wp_template' &&\n\t\t\t! window?.__experimentalTemplateActivate\n\t\t) {\n\t\t\tcanDuplicate = undefined;\n\t\t}\n\n\t\tconst actions = [\n\t\t\tpostTypeConfig.viewable ? viewPost : undefined,\n\t\t\t!! postTypeConfig.supports?.revisions\n\t\t\t\t? viewPostRevisions\n\t\t\t\t: undefined,\n\t\t\t// @ts-ignore\n\t\t\tcanDuplicate,\n\t\t\tpostTypeConfig.slug === 'wp_template_part' &&\n\t\t\tcanCreate &&\n\t\t\tcurrentTheme?.is_block_theme\n\t\t\t\t? duplicateTemplatePart\n\t\t\t\t: undefined,\n\t\t\tcanCreate && postTypeConfig.slug === 'wp_block'\n\t\t\t\t? duplicatePattern\n\t\t\t\t: undefined,\n\t\t\tpostTypeConfig.supports?.title ? renamePost : undefined,\n\t\t\tpostTypeConfig.supports?.[ 'page-attributes' ]\n\t\t\t\t? reorderPage\n\t\t\t\t: undefined,\n\t\t\tpostTypeConfig.slug === 'wp_block' ? exportPattern : undefined,\n\t\t\trestorePost,\n\t\t\tresetPost,\n\t\t\tdeletePost,\n\t\t\ttrashPost,\n\t\t\tpermanentlyDeletePost,\n\t\t].filter( Boolean );\n\n\t\t// Handle attachment post type separately with media-specific fields\n\t\tlet fields;\n\n\t\tif ( postType === ATTACHMENT_POST_TYPE ) {\n\t\t\tfields = ORDERED_MEDIA_FIELDS;\n\t\t} else {\n\t\t\tfields = [\n\t\t\t\tpostTypeConfig.supports?.thumbnail &&\n\t\t\t\t\tcurrentTheme?.theme_supports?.[ 'post-thumbnails' ] &&\n\t\t\t\t\tfeaturedImageField,\n\t\t\t\tpostTypeConfig.supports?.author && authorField,\n\t\t\t\t! DESIGN_POST_TYPES.includes( postTypeConfig.slug ) &&\n\t\t\t\t\tstatusField,\n\t\t\t\t! DESIGN_POST_TYPES.includes( postTypeConfig.slug ) &&\n\t\t\t\t\tdateField,\n\t\t\t\t! DESIGN_POST_TYPES.includes( postTypeConfig.slug ) &&\n\t\t\t\t\tscheduledDateField,\n\t\t\t\tlastEditedDateField,\n\t\t\t\t! DESIGN_POST_TYPES.includes( postTypeConfig.slug ) &&\n\t\t\t\t\tslugField,\n\t\t\t\t! DESIGN_POST_TYPES.includes( postTypeConfig.slug ) &&\n\t\t\t\t\tpostTypeConfig.supports?.excerpt &&\n\t\t\t\t\texcerptField,\n\t\t\t\tpostTypeConfig.supports?.[ 'page-attributes' ] && parentField,\n\t\t\t\tpostTypeConfig.supports?.comments && commentStatusField,\n\t\t\t\tpostTypeConfig.supports?.trackbacks && pingStatusField,\n\t\t\t\t( postTypeConfig.supports?.comments ||\n\t\t\t\t\tpostTypeConfig.supports?.trackbacks ) &&\n\t\t\t\t\tdiscussionField,\n\t\t\t\t! DESIGN_POST_TYPES.includes( postTypeConfig.slug ) &&\n\t\t\t\t\ttemplateField,\n\t\t\t\tpostTypeConfig.supports?.[ 'post-formats' ] &&\n\t\t\t\t\t! disablePostFormats &&\n\t\t\t\t\tformatField,\n\t\t\t\t! DESIGN_POST_TYPES.includes( postTypeConfig.slug ) &&\n\t\t\t\t\tpostTypeConfig.supports?.editor &&\n\t\t\t\t\tpostContentInfoField,\n\t\t\t\t! DESIGN_POST_TYPES.includes( postTypeConfig.slug ) &&\n\t\t\t\t\tpasswordField,\n\t\t\t\tpostTypeConfig.slug === 'post' && stickyField,\n\t\t\t\tpostTypeConfig.slug === 'wp_template' && descriptionField,\n\t\t\t\tpostTypeConfig.slug === 'wp_template' &&\n\t\t\t\t\treadOnlyDescriptionField,\n\t\t\t\t// The `home`/`index` template summary exposes a few fields that\n\t\t\t\t// target other entities (`root/site` and the posts page).\n\t\t\t\t// `DataFormPostSummary` overrides them to read/write the right\n\t\t\t\t// entity and to control their visibility.\n\t\t\t\tpostTypeConfig.slug === 'wp_template' && postsPageTitleField,\n\t\t\t\tpostTypeConfig.slug === 'wp_template' && postsPerPageField,\n\t\t\t\tpostTypeConfig.slug === 'wp_template' && siteDiscussionField,\n\t\t\t\tpostTypeConfig.supports?.editor &&\n\t\t\t\t\tpostTypeConfig.viewable &&\n\t\t\t\t\tpostPreviewField,\n\t\t\t\thasEditorNotesSupport( postTypeConfig.supports ) && notesField,\n\t\t\t].filter( Boolean );\n\t\t\tif ( postTypeConfig.supports?.title ) {\n\t\t\t\tlet _titleField;\n\t\t\t\tif ( postType === 'page' ) {\n\t\t\t\t\t_titleField = pageTitleField;\n\t\t\t\t} else if ( postType === 'wp_template' ) {\n\t\t\t\t\t_titleField = templateTitleField;\n\t\t\t\t} else if ( postType === 'wp_block' ) {\n\t\t\t\t\t_titleField = patternTitleField;\n\t\t\t\t} else {\n\t\t\t\t\t_titleField = titleField;\n\t\t\t\t}\n\t\t\t\tfields.push( _titleField );\n\t\t\t}\n\t\t}\n\n\t\tregistry.batch( () => {\n\t\t\tactions.forEach( ( action ) => {\n\t\t\t\tunlock( registry.dispatch( editorStore ) ).registerEntityAction(\n\t\t\t\t\t'postType',\n\t\t\t\t\tpostType,\n\t\t\t\t\taction\n\t\t\t\t);\n\t\t\t} );\n\t\t\tfields.forEach( ( field ) => {\n\t\t\t\tunlock( registry.dispatch( editorStore ) ).registerEntityField(\n\t\t\t\t\t'postType',\n\t\t\t\t\tpostType,\n\t\t\t\t\tfield\n\t\t\t\t);\n\t\t\t} );\n\t\t} );\n\n\t\tdoAction( 'core.registerPostTypeSchema', postType );\n\t};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,uBAAmC;AAEnC,mBAAyB;AAEzB,oBAyCO;AACP,0BAWO;AAKP,mBAAqC;AACrC,uBAAwD;AACxD,6BAA6B;AAC7B,yBAAuB;AAcvB,SAAS,sBAAuB,UAA6C;AAC5E,QAAM,SAAS,UAAU;AACzB,MAAK,MAAM,QAAS,MAAO,GAAI;AAC9B,WAAO,CAAC,CAAE,OAAQ,CAAE,GAAG;AAAA,EACxB;AACA,SAAO;AACR;AAEO,SAAS,qBACf,MACA,MACA,QACC;AACD,SAAO;AAAA,IACN,MAAM;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,EACD;AACD;AAEO,SAAS,uBACf,MACA,MACA,UACC;AACD,SAAO;AAAA,IACN,MAAM;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,EACD;AACD;AAEO,SAAS,oBACf,MACA,MACA,QACC;AACD,SAAO;AAAA,IACN,MAAM;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,EACD;AACD;AAEO,SAAS,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AAA,MACD,eAAe,SAAS,UAAU;AAAA,MAClC,eAAe,SAAS,iBAAiB;AAAA,MACzC,eAAe,SAAS,iBACvB;AAAA;AAAA;AAAA;AAAA;AAAA,MAKD,eAAe,SAAS,iBAAiB;AAAA,MACzC,eAAe,SAAS,iBAAiB;AAAA,MACzC,eAAe,SAAS,iBAAiB;AAAA,MACzC,eAAe,UAAU,UACxB,eAAe,YACf,uBAAAE;AAAA,MACD,sBAAuB,eAAe,QAAS,KAAK;AAAA,IACrD,EAAE,OAAQ,OAAQ;AAClB,QAAK,eAAe,UAAU,OAAQ;AACrC,UAAI;AACJ,UAAK,aAAa,QAAS;AAC1B,sBAAc;AAAA,MACf,WAAY,aAAa,eAAgB;AACxC,sBAAc;AAAA,MACf,WAAY,aAAa,YAAa;AACrC,sBAAc;AAAA,MACf,OAAO;AACN,sBAAc;AAAA,MACf;AACA,aAAO,KAAM,WAAY;AAAA,IAC1B;AAAA,EACD;AAEA,WAAS,MAAO,MAAM;AACrB,YAAQ,QAAS,CAAE,WAAY;AAC9B,qCAAQ,SAAS,SAAU,aAAAF,KAAY,CAAE,EAAE;AAAA,QAC1C;AAAA,QACA;AAAA,QACA;AAAA,MACD;AAAA,IACD,CAAE;AACF,WAAO,QAAS,CAAE,UAAW;AAC5B,qCAAQ,SAAS,SAAU,aAAAA,KAAY,CAAE,EAAE;AAAA,QAC1C;AAAA,QACA;AAAA,QACA;AAAA,MACD;AAAA,IACD,CAAE;AAAA,EACH,CAAE;AAEF,6BAAU,+BAA+B,QAAS;AACnD;",
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { store as coreStore } from '@wordpress/core-data';\nimport type { Action, Field } from '@wordpress/dataviews';\nimport { doAction } from '@wordpress/hooks';\nimport type { PostType } from '@wordpress/fields';\nimport {\n\tviewPost,\n\tviewPostRevisions,\n\tduplicatePost,\n\tduplicatePattern,\n\treorderPage,\n\texportPattern,\n\tpermanentlyDeletePost,\n\trestorePost,\n\ttrashPost,\n\trenamePost,\n\tresetPost,\n\tdeletePost,\n\tduplicateTemplatePart,\n\texcerptField,\n\tfeaturedImageField,\n\tdateField,\n\tparentField,\n\tpasswordField,\n\tcommentStatusField,\n\tpingStatusField,\n\tdiscussionField,\n\tslugField,\n\tstatusField,\n\tauthorField,\n\ttemplateAuthorField,\n\ttemplatePartAuthorField,\n\ttitleField,\n\ttemplateField,\n\ttemplateTitleField,\n\tpageTitleField,\n\tpatternTitleField,\n\tnotesField,\n\tscheduledDateField,\n\tlastEditedDateField,\n\tformatField,\n\tpostContentInfoField,\n\tstickyField,\n\tdescriptionField,\n\treadOnlyDescriptionField,\n\tpostsPerPageField,\n\tsiteDiscussionField,\n\tpostsPageTitleField,\n} from '@wordpress/fields';\nimport {\n\taltTextField,\n\tattachedToField,\n\tauthorField as mediaAuthorField,\n\tcaptionField,\n\tdateAddedField,\n\tdescriptionField as mediaDescriptionField,\n\tfilenameField,\n\tfilesizeField,\n\tmediaDimensionsField,\n\tmimeTypeField,\n} from '@wordpress/media-fields';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport { ATTACHMENT_POST_TYPE, DESIGN_POST_TYPES } from '../../store/constants';\nimport postPreviewField from '../fields/content-preview';\nimport { unlock } from '../../lock-unlock';\n\ndeclare global {\n\tinterface Window {\n\t\t__experimentalTemplateActivate?: boolean;\n\t}\n}\n\n/**\n * Check if a post type supports editor notes.\n *\n * @param supports The post type supports object.\n * @return Whether editor notes are supported.\n */\nfunction hasEditorNotesSupport( supports?: PostType[ 'supports' ] ): boolean {\n\tconst editor = supports?.editor;\n\tif ( Array.isArray( editor ) ) {\n\t\treturn !! editor[ 0 ]?.notes;\n\t}\n\treturn false;\n}\n\nexport function registerEntityAction< Item >(\n\tkind: string,\n\tname: string,\n\tconfig: Action< Item >\n) {\n\treturn {\n\t\ttype: 'REGISTER_ENTITY_ACTION' as const,\n\t\tkind,\n\t\tname,\n\t\tconfig,\n\t};\n}\n\nexport function unregisterEntityAction(\n\tkind: string,\n\tname: string,\n\tactionId: string\n) {\n\treturn {\n\t\ttype: 'UNREGISTER_ENTITY_ACTION' as const,\n\t\tkind,\n\t\tname,\n\t\tactionId,\n\t};\n}\n\nexport function registerEntityField< Item >(\n\tkind: string,\n\tname: string,\n\tconfig: Field< Item >\n) {\n\treturn {\n\t\ttype: 'REGISTER_ENTITY_FIELD' as const,\n\t\tkind,\n\t\tname,\n\t\tconfig,\n\t};\n}\n\nexport function unregisterEntityField(\n\tkind: string,\n\tname: string,\n\tfieldId: string\n) {\n\treturn {\n\t\ttype: 'UNREGISTER_ENTITY_FIELD' as const,\n\t\tkind,\n\t\tname,\n\t\tfieldId,\n\t};\n}\n\nexport function setIsReady( kind: string, name: string ) {\n\treturn {\n\t\ttype: 'SET_IS_READY' as const,\n\t\tkind,\n\t\tname,\n\t};\n}\n\n/*\n * Media fields for the attachment post type.\n *\n * Field order follows a logical grouping:\n * 1. Metadata fields in panels (date, author, file info)\n * 2. Core editable fields (title, alt text, caption, description)\n *\n * Note: media_thumbnail is not included as it's shown in the canvas preview\n */\nconst ORDERED_MEDIA_FIELDS = [\n\t// Metadata in panels (collapsed by default).\n\tdateAddedField,\n\tmediaAuthorField,\n\tfilenameField,\n\tmimeTypeField,\n\tfilesizeField,\n\tmediaDimensionsField,\n\tattachedToField,\n\t// Regular layout fields (always visible).\n\ttitleField,\n\taltTextField,\n\tcaptionField,\n\tmediaDescriptionField,\n];\n\nexport const registerPostTypeSchema =\n\t( postType: string ) =>\n\tasync ( { registry }: { registry: any } ) => {\n\t\tconst isReady = unlock( registry.select( editorStore ) ).isEntityReady(\n\t\t\t'postType',\n\t\t\tpostType\n\t\t);\n\t\tif ( isReady ) {\n\t\t\treturn;\n\t\t}\n\n\t\tunlock( registry.dispatch( editorStore ) ).setIsReady(\n\t\t\t'postType',\n\t\t\tpostType\n\t\t);\n\n\t\tconst postTypeConfig = ( await registry\n\t\t\t.resolveSelect( coreStore )\n\t\t\t.getPostType( postType ) ) as PostType;\n\n\t\tconst canCreate = await registry\n\t\t\t.resolveSelect( coreStore )\n\t\t\t.canUser( 'create', {\n\t\t\t\tkind: 'postType',\n\t\t\t\tname: postType,\n\t\t\t} );\n\t\tconst currentTheme = await registry\n\t\t\t.resolveSelect( coreStore )\n\t\t\t.getCurrentTheme();\n\t\tconst { disablePostFormats } = registry\n\t\t\t.select( editorStore )\n\t\t\t.getEditorSettings();\n\n\t\tlet canDuplicate =\n\t\t\t! [ 'wp_block', 'wp_template_part' ].includes(\n\t\t\t\tpostTypeConfig.slug\n\t\t\t) &&\n\t\t\tcanCreate &&\n\t\t\tduplicatePost;\n\n\t\t// @ts-ignore\n\t\tif ( ! globalThis.IS_GUTENBERG_PLUGIN ) {\n\t\t\t// Outside Gutenberg, disable duplication except for wp_template.\n\t\t\tif ( 'wp_template' !== postTypeConfig.slug ) {\n\t\t\t\tcanDuplicate = undefined;\n\t\t\t}\n\t\t}\n\n\t\t// When template activation experiment is disabled, templates cannot be duplicated.\n\t\t// @ts-ignore\n\t\tif (\n\t\t\tpostTypeConfig.slug === 'wp_template' &&\n\t\t\t! window?.__experimentalTemplateActivate\n\t\t) {\n\t\t\tcanDuplicate = undefined;\n\t\t}\n\n\t\tconst actions = [\n\t\t\tpostTypeConfig.viewable ? viewPost : undefined,\n\t\t\t!! postTypeConfig.supports?.revisions\n\t\t\t\t? viewPostRevisions\n\t\t\t\t: undefined,\n\t\t\t// @ts-ignore\n\t\t\tcanDuplicate,\n\t\t\tpostTypeConfig.slug === 'wp_template_part' &&\n\t\t\tcanCreate &&\n\t\t\tcurrentTheme?.is_block_theme\n\t\t\t\t? duplicateTemplatePart\n\t\t\t\t: undefined,\n\t\t\tcanCreate && postTypeConfig.slug === 'wp_block'\n\t\t\t\t? duplicatePattern\n\t\t\t\t: undefined,\n\t\t\tpostTypeConfig.supports?.title ? renamePost : undefined,\n\t\t\tpostTypeConfig.supports?.[ 'page-attributes' ]\n\t\t\t\t? reorderPage\n\t\t\t\t: undefined,\n\t\t\tpostTypeConfig.slug === 'wp_block' ? exportPattern : undefined,\n\t\t\trestorePost,\n\t\t\tresetPost,\n\t\t\tdeletePost,\n\t\t\ttrashPost,\n\t\t\tpermanentlyDeletePost,\n\t\t].filter( Boolean );\n\n\t\t// Handle attachment post type separately with media-specific fields\n\t\tlet fields;\n\n\t\tif ( postType === ATTACHMENT_POST_TYPE ) {\n\t\t\tfields = ORDERED_MEDIA_FIELDS;\n\t\t} else {\n\t\t\tfields = [\n\t\t\t\tpostTypeConfig.supports?.thumbnail &&\n\t\t\t\t\tcurrentTheme?.theme_supports?.[ 'post-thumbnails' ] &&\n\t\t\t\t\tfeaturedImageField,\n\t\t\t\t! DESIGN_POST_TYPES.includes( postTypeConfig.slug ) &&\n\t\t\t\t\tpostTypeConfig.supports?.author &&\n\t\t\t\t\tauthorField,\n\t\t\t\tpostTypeConfig.slug === 'wp_template' && templateAuthorField,\n\t\t\t\tpostTypeConfig.slug === 'wp_template_part' &&\n\t\t\t\t\ttemplatePartAuthorField,\n\t\t\t\t! DESIGN_POST_TYPES.includes( postTypeConfig.slug ) &&\n\t\t\t\t\tstatusField,\n\t\t\t\t! DESIGN_POST_TYPES.includes( postTypeConfig.slug ) &&\n\t\t\t\t\tdateField,\n\t\t\t\t! DESIGN_POST_TYPES.includes( postTypeConfig.slug ) &&\n\t\t\t\t\tscheduledDateField,\n\t\t\t\tlastEditedDateField,\n\t\t\t\t! DESIGN_POST_TYPES.includes( postTypeConfig.slug ) &&\n\t\t\t\t\tslugField,\n\t\t\t\t! DESIGN_POST_TYPES.includes( postTypeConfig.slug ) &&\n\t\t\t\t\tpostTypeConfig.supports?.excerpt &&\n\t\t\t\t\texcerptField,\n\t\t\t\tpostTypeConfig.supports?.[ 'page-attributes' ] && parentField,\n\t\t\t\tpostTypeConfig.supports?.comments && commentStatusField,\n\t\t\t\tpostTypeConfig.supports?.trackbacks && pingStatusField,\n\t\t\t\t( postTypeConfig.supports?.comments ||\n\t\t\t\t\tpostTypeConfig.supports?.trackbacks ) &&\n\t\t\t\t\tdiscussionField,\n\t\t\t\t! DESIGN_POST_TYPES.includes( postTypeConfig.slug ) &&\n\t\t\t\t\ttemplateField,\n\t\t\t\tpostTypeConfig.supports?.[ 'post-formats' ] &&\n\t\t\t\t\t! disablePostFormats &&\n\t\t\t\t\tformatField,\n\t\t\t\t! DESIGN_POST_TYPES.includes( postTypeConfig.slug ) &&\n\t\t\t\t\tpostTypeConfig.supports?.editor &&\n\t\t\t\t\tpostContentInfoField,\n\t\t\t\t! DESIGN_POST_TYPES.includes( postTypeConfig.slug ) &&\n\t\t\t\t\tpasswordField,\n\t\t\t\tpostTypeConfig.slug === 'post' && stickyField,\n\t\t\t\tpostTypeConfig.slug === 'wp_template' && descriptionField,\n\t\t\t\tpostTypeConfig.slug === 'wp_template' &&\n\t\t\t\t\treadOnlyDescriptionField,\n\t\t\t\t// The `home`/`index` template summary exposes a few fields that\n\t\t\t\t// target other entities (`root/site` and the posts page).\n\t\t\t\t// `DataFormPostSummary` overrides them to read/write the right\n\t\t\t\t// entity and to control their visibility.\n\t\t\t\tpostTypeConfig.slug === 'wp_template' && postsPageTitleField,\n\t\t\t\tpostTypeConfig.slug === 'wp_template' && postsPerPageField,\n\t\t\t\tpostTypeConfig.slug === 'wp_template' && siteDiscussionField,\n\t\t\t\tpostTypeConfig.supports?.editor &&\n\t\t\t\t\tpostTypeConfig.viewable &&\n\t\t\t\t\tpostPreviewField,\n\t\t\t\thasEditorNotesSupport( postTypeConfig.supports ) && notesField,\n\t\t\t].filter( Boolean );\n\t\t\tif ( postTypeConfig.supports?.title ) {\n\t\t\t\tlet _titleField;\n\t\t\t\tif ( postType === 'page' ) {\n\t\t\t\t\t_titleField = pageTitleField;\n\t\t\t\t} else if ( postType === 'wp_template' ) {\n\t\t\t\t\t_titleField = templateTitleField;\n\t\t\t\t} else if ( postType === 'wp_block' ) {\n\t\t\t\t\t_titleField = patternTitleField;\n\t\t\t\t} else {\n\t\t\t\t\t_titleField = titleField;\n\t\t\t\t}\n\t\t\t\tfields.push( _titleField );\n\t\t\t}\n\t\t}\n\n\t\tregistry.batch( () => {\n\t\t\tactions.forEach( ( action ) => {\n\t\t\t\tunlock( registry.dispatch( editorStore ) ).registerEntityAction(\n\t\t\t\t\t'postType',\n\t\t\t\t\tpostType,\n\t\t\t\t\taction\n\t\t\t\t);\n\t\t\t} );\n\t\t\tfields.forEach( ( field ) => {\n\t\t\t\tunlock( registry.dispatch( editorStore ) ).registerEntityField(\n\t\t\t\t\t'postType',\n\t\t\t\t\tpostType,\n\t\t\t\t\tfield\n\t\t\t\t);\n\t\t\t} );\n\t\t} );\n\n\t\tdoAction( 'core.registerPostTypeSchema', postType );\n\t};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,uBAAmC;AAEnC,mBAAyB;AAEzB,oBA2CO;AACP,0BAWO;AAKP,mBAAqC;AACrC,uBAAwD;AACxD,6BAA6B;AAC7B,yBAAuB;AAcvB,SAAS,sBAAuB,UAA6C;AAC5E,QAAM,SAAS,UAAU;AACzB,MAAK,MAAM,QAAS,MAAO,GAAI;AAC9B,WAAO,CAAC,CAAE,OAAQ,CAAE,GAAG;AAAA,EACxB;AACA,SAAO;AACR;AAEO,SAAS,qBACf,MACA,MACA,QACC;AACD,SAAO;AAAA,IACN,MAAM;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,EACD;AACD;AAEO,SAAS,uBACf,MACA,MACA,UACC;AACD,SAAO;AAAA,IACN,MAAM;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,EACD;AACD;AAEO,SAAS,oBACf,MACA,MACA,QACC;AACD,SAAO;AAAA,IACN,MAAM;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,EACD;AACD;AAEO,SAAS,sBACf,MACA,MACA,SACC;AACD,SAAO;AAAA,IACN,MAAM;AAAA,IACN;AAAA,IACA;AAAA,IAC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U,eAAe,IAAK,KACjD;AAAA,MACD,eAAe,SAAS,UAAU;AAAA,MAClC,eAAe,SAAS,iBAAiB;AAAA,MACzC,eAAe,SAAS,iBACvB;AAAA;AAAA;AAAA;AAAA;AAAA,MAKD,eAAe,SAAS,iBAAiB;AAAA,MACzC,eAAe,SAAS,iBAAiB;AAAA,MACzC,eAAe,SAAS,iBAAiB;AAAA,MACzC,eAAe,UAAU,UACxB,eAAe,YACf,uBAAAE;AAAA,MACD,sBAAuB,eAAe,QAAS,KAAK;AAAA,IACrD,EAAE,OAAQ,OAAQ;AAClB,QAAK,eAAe,UAAU,OAAQ;AACrC,UAAI;AACJ,UAAK,aAAa,QAAS;AAC1B,sBAAc;AAAA,MACf,WAAY,aAAa,eAAgB;AACxC,sBAAc;AAAA,MACf,WAAY,aAAa,YAAa;AACrC,sBAAc;AAAA,MACf,OAAO;AACN,sBAAc;AAAA,MACf;AACA,aAAO,KAAM,WAAY;AAAA,IAC1B;AAAA,EACD;AAEA,WAAS,MAAO,MAAM;AACrB,YAAQ,QAAS,CAAE,WAAY;AAC9B,qCAAQ,SAAS,SAAU,aAAAF,KAAY,CAAE,EAAE;AAAA,QAC1C;AAAA,QACA;AAAA,QACA;AAAA,MACD;AAAA,IACD,CAAE;AACF,WAAO,QAAS,CAAE,UAAW;AAC5B,qCAAQ,SAAS,SAAU,aAAAA,KAAY,CAAE,EAAE;AAAA,QAC1C;AAAA,QACA;AAAA,QACA;AAAA,MACD;AAAA,IACD,CAAE;AAAA,EACH,CAAE;AAEF,6BAAU,+BAA+B,QAAS;AACnD;",
6
6
  "names": ["mediaAuthorField", "mediaDescriptionField", "editorStore", "coreStore", "postPreviewField"]
7
7
  }
@@ -65,8 +65,8 @@ var import_private_selectors = require("./private-selectors.cjs");
65
65
  var import_lock_unlock = require("../lock-unlock.cjs");
66
66
  __reExport(private_actions_exports, require("../dataviews/store/private-actions.cjs"), module.exports);
67
67
  var DEVICE_TYPE_BY_VIEWPORT_STATE = {
68
- mobile: "Mobile",
69
- tablet: "Tablet"
68
+ "@mobile": "Mobile",
69
+ "@tablet": "Tablet"
70
70
  };
71
71
  var updateDeviceTypeForViewportState = ({ viewport = "default", showStateOnCanvas = true } = {}) => ({ dispatch, registry }) => {
72
72
  if (!showStateOnCanvas) {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/store/private-actions.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { addQueryArgs } from '@wordpress/url';\nimport apiFetch from '@wordpress/api-fetch';\nimport { parse, __unstableSerializeAndClean } from '@wordpress/blocks';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { dateI18n, getSettings as getDateSettings } from '@wordpress/date';\n\n/**\n * Internal dependencies\n */\nimport isTemplateRevertable from './utils/is-template-revertable';\nimport { buildRevisionsPageQuery } from './private-selectors';\nimport { unlock } from '../lock-unlock';\nexport * from '../dataviews/store/private-actions';\n\nconst DEVICE_TYPE_BY_VIEWPORT_STATE = {\n\tmobile: 'Mobile',\n\ttablet: 'Tablet',\n};\n\n/**\n * Updates the editor preview device in response to a block-editor viewport\n * state signal.\n *\n * @param {Object} options Viewport state change options.\n * @param {string} options.viewport Selected viewport state.\n * @param {boolean} options.showStateOnCanvas Whether canvas preview is enabled.\n */\nexport const updateDeviceTypeForViewportState =\n\t( { viewport = 'default', showStateOnCanvas = true } = {} ) =>\n\t( { dispatch, registry } ) => {\n\t\tif ( ! showStateOnCanvas ) {\n\t\t\treturn;\n\t\t}\n\n\t\tdispatch.setDeviceType(\n\t\t\tDEVICE_TYPE_BY_VIEWPORT_STATE[ viewport ] ?? 'Desktop'\n\t\t);\n\t\tunlock( registry.dispatch( blockEditorStore ) ).resetZoomLevel();\n\t};\n\n/**\n * Returns an action object used to set which template is currently being used/edited.\n *\n * @param {string} id Template Id.\n *\n * @return {Object} Action object.\n */\nexport function setCurrentTemplateId( id ) {\n\treturn {\n\t\ttype: 'SET_CURRENT_TEMPLATE_ID',\n\t\tid,\n\t};\n}\n\n/**\n * Create a block based template.\n *\n * @param {?Object} template Template to create and assign.\n */\nexport const createTemplate =\n\t( template ) =>\n\tasync ( { select, dispatch, registry } ) => {\n\t\tconst savedTemplate = await registry\n\t\t\t.dispatch( coreStore )\n\t\t\t.saveEntityRecord( 'postType', 'wp_template', template );\n\t\tregistry\n\t\t\t.dispatch( coreStore )\n\t\t\t.editEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tselect.getCurrentPostType(),\n\t\t\t\tselect.getCurrentPostId(),\n\t\t\t\t{\n\t\t\t\t\ttemplate: savedTemplate.slug,\n\t\t\t\t}\n\t\t\t);\n\t\tregistry\n\t\t\t.dispatch( noticesStore )\n\t\t\t.createSuccessNotice(\n\t\t\t\t__( \"Custom template created. You're in template mode now.\" ),\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\tactions: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: __( 'Go back' ),\n\t\t\t\t\t\t\tonClick: () =>\n\t\t\t\t\t\t\t\tdispatch.setRenderingMode(\n\t\t\t\t\t\t\t\t\tselect.getEditorSettings()\n\t\t\t\t\t\t\t\t\t\t.defaultRenderingMode\n\t\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\treturn savedTemplate;\n\t};\n\n/**\n * Update the provided block types to be visible.\n *\n * @param {string[]} blockNames Names of block types to show.\n */\nexport const showBlockTypes =\n\t( blockNames ) =>\n\t( { registry } ) => {\n\t\tconst existingBlockNames =\n\t\t\tregistry\n\t\t\t\t.select( preferencesStore )\n\t\t\t\t.get( 'core', 'hiddenBlockTypes' ) ?? [];\n\n\t\tconst newBlockNames = existingBlockNames.filter(\n\t\t\t( type ) =>\n\t\t\t\t! (\n\t\t\t\t\tArray.isArray( blockNames ) ? blockNames : [ blockNames ]\n\t\t\t\t).includes( type )\n\t\t);\n\n\t\tregistry\n\t\t\t.dispatch( preferencesStore )\n\t\t\t.set( 'core', 'hiddenBlockTypes', newBlockNames );\n\t};\n\n/**\n * Update the provided block types to be hidden.\n *\n * @param {string[]} blockNames Names of block types to hide.\n */\nexport const hideBlockTypes =\n\t( blockNames ) =>\n\t( { registry } ) => {\n\t\tconst existingBlockNames =\n\t\t\tregistry\n\t\t\t\t.select( preferencesStore )\n\t\t\t\t.get( 'core', 'hiddenBlockTypes' ) ?? [];\n\n\t\tconst mergedBlockNames = new Set( [\n\t\t\t...existingBlockNames,\n\t\t\t...( Array.isArray( blockNames ) ? blockNames : [ blockNames ] ),\n\t\t] );\n\n\t\tregistry\n\t\t\t.dispatch( preferencesStore )\n\t\t\t.set( 'core', 'hiddenBlockTypes', [ ...mergedBlockNames ] );\n\t};\n\n/**\n * Save entity records marked as dirty.\n *\n * @param {Object} options Options for the action.\n * @param {Function} [options.onSave] Callback when saving happens.\n * @param {object[]} [options.dirtyEntityRecords] Array of dirty entities.\n * @param {object[]} [options.entitiesToSkip] Array of entities to skip saving.\n * @param {Function} [options.close] Callback when the actions is called. It should be consolidated with `onSave`.\n * @param {string} [options.successNoticeContent] Optional custom success notice content. Defaults to 'Site updated.'.\n */\nexport const saveDirtyEntities =\n\t( {\n\t\tonSave,\n\t\tdirtyEntityRecords = [],\n\t\tentitiesToSkip = [],\n\t\tclose,\n\t\tsuccessNoticeContent,\n\t} = {} ) =>\n\t( { registry } ) => {\n\t\tconst PUBLISH_ON_SAVE_ENTITIES = [\n\t\t\t{ kind: 'postType', name: 'wp_navigation' },\n\t\t];\n\t\tconst saveNoticeId = 'site-editor-save-success';\n\t\tconst homeUrl = registry\n\t\t\t.select( coreStore )\n\t\t\t.getEntityRecord( 'root', '__unstableBase' )?.home;\n\t\tregistry.dispatch( noticesStore ).removeNotice( saveNoticeId );\n\t\tconst entitiesToSave = dirtyEntityRecords.filter(\n\t\t\t( { kind, name, key, property } ) => {\n\t\t\t\treturn ! entitiesToSkip.some(\n\t\t\t\t\t( elt ) =>\n\t\t\t\t\t\telt.kind === kind &&\n\t\t\t\t\t\telt.name === name &&\n\t\t\t\t\t\telt.key === key &&\n\t\t\t\t\t\telt.property === property\n\t\t\t\t);\n\t\t\t}\n\t\t);\n\t\tclose?.( entitiesToSave );\n\t\tconst siteItemsToSave = [];\n\t\tconst pendingSavedRecords = [];\n\t\tentitiesToSave.forEach( ( { kind, name, key, property } ) => {\n\t\t\tif ( 'root' === kind && 'site' === name ) {\n\t\t\t\tsiteItemsToSave.push( property );\n\t\t\t} else {\n\t\t\t\tif (\n\t\t\t\t\tPUBLISH_ON_SAVE_ENTITIES.some(\n\t\t\t\t\t\t( typeToPublish ) =>\n\t\t\t\t\t\t\ttypeToPublish.kind === kind &&\n\t\t\t\t\t\t\ttypeToPublish.name === name\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\tregistry\n\t\t\t\t\t\t.dispatch( coreStore )\n\t\t\t\t\t\t.editEntityRecord( kind, name, key, {\n\t\t\t\t\t\t\tstatus: 'publish',\n\t\t\t\t\t\t} );\n\t\t\t\t}\n\n\t\t\t\tpendingSavedRecords.push(\n\t\t\t\t\tregistry\n\t\t\t\t\t\t.dispatch( coreStore )\n\t\t\t\t\t\t.saveEditedEntityRecord( kind, name, key )\n\t\t\t\t);\n\t\t\t}\n\t\t} );\n\t\tif ( siteItemsToSave.length ) {\n\t\t\tpendingSavedRecords.push(\n\t\t\t\tregistry\n\t\t\t\t\t.dispatch( coreStore )\n\t\t\t\t\t.__experimentalSaveSpecifiedEntityEdits(\n\t\t\t\t\t\t'root',\n\t\t\t\t\t\t'site',\n\t\t\t\t\t\tundefined,\n\t\t\t\t\t\tsiteItemsToSave\n\t\t\t\t\t)\n\t\t\t);\n\t\t}\n\t\tregistry\n\t\t\t.dispatch( blockEditorStore )\n\t\t\t.__unstableMarkLastChangeAsPersistent();\n\t\tPromise.all( pendingSavedRecords )\n\t\t\t.then( ( values ) => {\n\t\t\t\treturn onSave ? onSave( values ) : values;\n\t\t\t} )\n\t\t\t.then( ( values ) => {\n\t\t\t\tif (\n\t\t\t\t\tvalues.some( ( value ) => typeof value === 'undefined' )\n\t\t\t\t) {\n\t\t\t\t\tregistry\n\t\t\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t\t\t.createErrorNotice( __( 'Saving failed.' ) );\n\t\t\t\t} else {\n\t\t\t\t\tregistry\n\t\t\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t\t\t.createSuccessNotice(\n\t\t\t\t\t\t\tsuccessNoticeContent || __( 'Site updated.' ),\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\t\tid: saveNoticeId,\n\t\t\t\t\t\t\t\tactions: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tlabel: __( 'View site' ),\n\t\t\t\t\t\t\t\t\t\turl: homeUrl,\n\t\t\t\t\t\t\t\t\t\topenInNewTab: true,\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}\n\t\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t} )\n\t\t\t.catch( ( error ) =>\n\t\t\t\tregistry\n\t\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t\t.createErrorNotice(\n\t\t\t\t\t\t`${ __( 'Saving failed.' ) } ${ error }`\n\t\t\t\t\t)\n\t\t\t);\n\t};\n\n/**\n * Reverts a template to its original theme-provided file.\n *\n * @param {Object} template The template to revert.\n * @param {Object} [options]\n * @param {boolean} [options.allowUndo] Whether to allow the user to undo\n * reverting the template. Default true.\n */\nexport const revertTemplate =\n\t( template, { allowUndo = true } = {} ) =>\n\tasync ( { registry } ) => {\n\t\tconst noticeId = 'edit-site-template-reverted';\n\t\tregistry.dispatch( noticesStore ).removeNotice( noticeId );\n\t\tif ( ! isTemplateRevertable( template ) ) {\n\t\t\tregistry\n\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t.createErrorNotice( __( 'This template is not revertable.' ), {\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t} );\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tconst templateEntityConfig = registry\n\t\t\t\t.select( coreStore )\n\t\t\t\t.getEntityConfig( 'postType', template.type );\n\n\t\t\tif ( ! templateEntityConfig ) {\n\t\t\t\tregistry\n\t\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t\t.createErrorNotice(\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'The editor has encountered an unexpected error. Please reload.'\n\t\t\t\t\t\t),\n\t\t\t\t\t\t{ type: 'snackbar' }\n\t\t\t\t\t);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst fileTemplatePath = addQueryArgs(\n\t\t\t\t`${ templateEntityConfig.baseURL }/${ template.id }`,\n\t\t\t\t{ context: 'edit', source: template.origin }\n\t\t\t);\n\n\t\t\tconst fileTemplate = await apiFetch( { path: fileTemplatePath } );\n\t\t\tif ( ! fileTemplate ) {\n\t\t\t\tregistry\n\t\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t\t.createErrorNotice(\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'The editor has encountered an unexpected error. Please reload.'\n\t\t\t\t\t\t),\n\t\t\t\t\t\t{ type: 'snackbar' }\n\t\t\t\t\t);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst serializeBlocks = ( {\n\t\t\t\tblocks: blocksForSerialization = [],\n\t\t\t} ) => __unstableSerializeAndClean( blocksForSerialization );\n\n\t\t\tconst edited = registry\n\t\t\t\t.select( coreStore )\n\t\t\t\t.getEditedEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\ttemplate.type,\n\t\t\t\t\ttemplate.id\n\t\t\t\t);\n\n\t\t\t// We are fixing up the undo level here to make sure we can undo\n\t\t\t// the revert in the header toolbar correctly.\n\t\t\tregistry.dispatch( coreStore ).editEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\ttemplate.type,\n\t\t\t\ttemplate.id,\n\t\t\t\t{\n\t\t\t\t\tcontent: serializeBlocks, // Required to make the `undo` behave correctly.\n\t\t\t\t\tblocks: edited.blocks, // Required to revert the blocks in the editor.\n\t\t\t\t\tsource: 'custom', // required to avoid turning the editor into a dirty state\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tundoIgnore: true, // Required to merge this edit with the last undo level.\n\t\t\t\t}\n\t\t\t);\n\n\t\t\tconst blocks = parse( fileTemplate?.content?.raw );\n\t\t\tregistry\n\t\t\t\t.dispatch( coreStore )\n\t\t\t\t.editEntityRecord( 'postType', template.type, fileTemplate.id, {\n\t\t\t\t\tcontent: serializeBlocks,\n\t\t\t\t\tblocks,\n\t\t\t\t\tsource: 'theme',\n\t\t\t\t} );\n\n\t\t\tif ( allowUndo ) {\n\t\t\t\tconst undoRevert = () => {\n\t\t\t\t\tregistry\n\t\t\t\t\t\t.dispatch( coreStore )\n\t\t\t\t\t\t.editEntityRecord(\n\t\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t\ttemplate.type,\n\t\t\t\t\t\t\tedited.id,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tcontent: serializeBlocks,\n\t\t\t\t\t\t\t\tblocks: edited.blocks,\n\t\t\t\t\t\t\t\tsource: 'custom',\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t);\n\t\t\t\t};\n\n\t\t\t\tregistry\n\t\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t\t.createSuccessNotice( __( 'Template reset.' ), {\n\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\tid: noticeId,\n\t\t\t\t\t\tactions: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tlabel: __( 'Undo' ),\n\t\t\t\t\t\t\t\tonClick: undoRevert,\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}\n\t\t} catch ( error ) {\n\t\t\tconst errorMessage =\n\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t? error.message\n\t\t\t\t\t: __( 'Template revert failed. Please reload.' );\n\t\t\tregistry\n\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t.createErrorNotice( errorMessage, { type: 'snackbar' } );\n\t\t}\n\t};\n\n/**\n * Action that removes an array of templates, template parts or patterns.\n *\n * @param {Array} items An array of template,template part or pattern objects to remove.\n */\nexport const removeTemplates =\n\t( items ) =>\n\tasync ( { registry } ) => {\n\t\tconst isResetting = items.every( ( item ) => item?.has_theme_file );\n\n\t\tconst promiseResult = await Promise.allSettled(\n\t\t\titems.map( ( item ) => {\n\t\t\t\treturn registry\n\t\t\t\t\t.dispatch( coreStore )\n\t\t\t\t\t.deleteEntityRecord(\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\titem.type,\n\t\t\t\t\t\titem.id,\n\t\t\t\t\t\t{ force: true },\n\t\t\t\t\t\t{ throwOnError: true }\n\t\t\t\t\t);\n\t\t\t} )\n\t\t);\n\n\t\t// If all the promises were fulfilled with success.\n\t\tif ( promiseResult.every( ( { status } ) => status === 'fulfilled' ) ) {\n\t\t\tlet successMessage;\n\n\t\t\tif ( items.length === 1 ) {\n\t\t\t\t// Depending on how the entity was retrieved its title might be\n\t\t\t\t// an object or simple string.\n\t\t\t\tlet title;\n\t\t\t\tif ( typeof items[ 0 ].title === 'string' ) {\n\t\t\t\t\ttitle = items[ 0 ].title;\n\t\t\t\t} else if ( typeof items[ 0 ].title?.rendered === 'string' ) {\n\t\t\t\t\ttitle = items[ 0 ].title?.rendered;\n\t\t\t\t} else if ( typeof items[ 0 ].title?.raw === 'string' ) {\n\t\t\t\t\ttitle = items[ 0 ].title?.raw;\n\t\t\t\t}\n\t\t\t\tsuccessMessage = isResetting\n\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t/* translators: %s: The template/part's name. */\n\t\t\t\t\t\t\t__( '\"%s\" reset.' ),\n\t\t\t\t\t\t\tdecodeEntities( title )\n\t\t\t\t\t )\n\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t/* translators: %s: The template/part's name. */\n\t\t\t\t\t\t\t_x( '\"%s\" deleted.', 'template part' ),\n\t\t\t\t\t\t\tdecodeEntities( title )\n\t\t\t\t\t );\n\t\t\t} else {\n\t\t\t\tsuccessMessage = isResetting\n\t\t\t\t\t? __( 'Items reset.' )\n\t\t\t\t\t: __( 'Items deleted.' );\n\t\t\t}\n\n\t\t\tregistry\n\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t.createSuccessNotice( successMessage, {\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\tid: 'editor-template-deleted-success',\n\t\t\t\t} );\n\t\t} else {\n\t\t\t// If there was at lease one failure.\n\t\t\tlet errorMessage;\n\t\t\t// If we were trying to delete a single template.\n\t\t\tif ( promiseResult.length === 1 ) {\n\t\t\t\tif ( promiseResult[ 0 ].reason?.message ) {\n\t\t\t\t\terrorMessage = promiseResult[ 0 ].reason.message;\n\t\t\t\t} else {\n\t\t\t\t\terrorMessage = isResetting\n\t\t\t\t\t\t? __( 'An error occurred while reverting the item.' )\n\t\t\t\t\t\t: __( 'An error occurred while deleting the item.' );\n\t\t\t\t}\n\t\t\t\t// If we were trying to delete a multiple templates\n\t\t\t} else {\n\t\t\t\tconst errorMessages = new Set();\n\t\t\t\tconst failedPromises = promiseResult.filter(\n\t\t\t\t\t( { status } ) => status === 'rejected'\n\t\t\t\t);\n\t\t\t\tfor ( const failedPromise of failedPromises ) {\n\t\t\t\t\tif ( failedPromise.reason?.message ) {\n\t\t\t\t\t\terrorMessages.add( failedPromise.reason.message );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif ( errorMessages.size === 0 ) {\n\t\t\t\t\terrorMessage = __(\n\t\t\t\t\t\t'An error occurred while deleting the items.'\n\t\t\t\t\t);\n\t\t\t\t} else if ( errorMessages.size === 1 ) {\n\t\t\t\t\terrorMessage = isResetting\n\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t/* translators: %s: an error message */\n\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t'An error occurred while reverting the items: %s'\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t[ ...errorMessages ][ 0 ]\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t\t/* translators: %s: an error message */\n\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t'An error occurred while deleting the items: %s'\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t[ ...errorMessages ][ 0 ]\n\t\t\t\t\t\t );\n\t\t\t\t} else {\n\t\t\t\t\terrorMessage = isResetting\n\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t/* translators: %s: a list of comma separated error messages */\n\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t'Some errors occurred while reverting the items: %s'\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t[ ...errorMessages ].join( ',' )\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t\t/* translators: %s: a list of comma separated error messages */\n\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t'Some errors occurred while deleting the items: %s'\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t[ ...errorMessages ].join( ',' )\n\t\t\t\t\t\t );\n\t\t\t\t}\n\t\t\t}\n\t\t\tregistry\n\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t.createErrorNotice( errorMessage, { type: 'snackbar' } );\n\t\t}\n\t};\n\n/**\n * Set the default rendering mode preference for the current post type.\n *\n * @param {string} mode The rendering mode to set as default.\n */\nexport const setDefaultRenderingMode =\n\t( mode ) =>\n\t( { select, registry } ) => {\n\t\tconst postType = select.getCurrentPostType();\n\t\tconst theme = registry\n\t\t\t.select( coreStore )\n\t\t\t.getCurrentTheme()?.stylesheet;\n\t\tconst renderingModes =\n\t\t\tregistry\n\t\t\t\t.select( preferencesStore )\n\t\t\t\t.get( 'core', 'renderingModes' )?.[ theme ] ?? {};\n\n\t\tif ( renderingModes[ postType ] === mode ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst newModes = {\n\t\t\t[ theme ]: {\n\t\t\t\t...renderingModes,\n\t\t\t\t[ postType ]: mode,\n\t\t\t},\n\t\t};\n\n\t\tregistry\n\t\t\t.dispatch( preferencesStore )\n\t\t\t.set( 'core', 'renderingModes', newModes );\n\t};\n\n/**\n * Set the current global styles navigation path.\n *\n * @param {string} path The navigation path.\n * @return {Object} Action object.\n */\nexport function setStylesPath( path ) {\n\treturn {\n\t\ttype: 'SET_STYLES_PATH',\n\t\tpath,\n\t};\n}\n\n/**\n * Set whether the stylebook is visible.\n *\n * @param {boolean} show Whether to show the stylebook.\n * @return {Object} Action object.\n */\nexport function setShowStylebook( show ) {\n\treturn {\n\t\ttype: 'SET_SHOW_STYLEBOOK',\n\t\tshow,\n\t};\n}\n\n/**\n * Reset the global styles navigation to initial state.\n *\n * @return {Object} Action object.\n */\nexport function resetStylesNavigation() {\n\treturn {\n\t\ttype: 'RESET_STYLES_NAVIGATION',\n\t};\n}\n\n/**\n * Set the current revision ID for revisions preview mode.\n * Pass a revision ID to enter revisions mode, or null to exit.\n *\n * @param {number|null} revisionId The revision ID, or null to exit revisions mode.\n * @return {Object} Action object.\n */\nexport function setCurrentRevisionId( revisionId ) {\n\treturn {\n\t\ttype: 'SET_CURRENT_REVISION_ID',\n\t\trevisionId,\n\t};\n}\n\n/**\n * Set the current revisions page number and select the newest\n * revision on that page once it loads.\n *\n * @param {number} page The page number.\n */\nexport const setRevisionPage =\n\t( page ) =>\n\tasync ( { dispatch, select, registry } ) => {\n\t\tconst postType = select.getCurrentPostType();\n\t\tconst postId = select.getCurrentPostId();\n\t\tconst entityConfig = registry\n\t\t\t.select( coreStore )\n\t\t\t.getEntityConfig( 'postType', postType );\n\t\tconst revisionKey = entityConfig?.revisionKey || 'id';\n\n\t\tconst revisions = await registry\n\t\t\t.resolveSelect( coreStore )\n\t\t\t.getRevisions(\n\t\t\t\t'postType',\n\t\t\t\tpostType,\n\t\t\t\tpostId,\n\t\t\t\tbuildRevisionsPageQuery( revisionKey, page )\n\t\t\t);\n\n\t\tregistry.batch( () => {\n\t\t\tdispatch( { type: 'SET_REVISION_PAGE', page } );\n\t\t\tif ( revisions?.length ) {\n\t\t\t\tdispatch.setCurrentRevisionId( revisions[ 0 ][ revisionKey ] );\n\t\t\t}\n\t\t} );\n\t};\n\n/**\n * Set whether the revision diff highlighting is shown.\n *\n * @param {boolean} showDiff Whether to show diff highlighting.\n * @return {Object} Action object.\n */\nexport function setShowRevisionDiff( showDiff ) {\n\treturn {\n\t\ttype: 'SET_SHOW_REVISION_DIFF',\n\t\tshowDiff,\n\t};\n}\n\n/**\n * Restore a revision by replacing the current content with the revision's content\n * and auto-saving.\n *\n * @param {number} revisionId The revision ID to restore.\n */\nexport const restoreRevision =\n\t( revisionId ) =>\n\tasync ( { select, dispatch, registry } ) => {\n\t\tconst postType = select.getCurrentPostType();\n\t\tconst postId = select.getCurrentPostId();\n\n\t\tconst entityConfig = registry\n\t\t\t.select( coreStore )\n\t\t\t.getEntityConfig( 'postType', postType );\n\t\tconst revisionKey = entityConfig?.revisionKey || 'id';\n\n\t\t// Use resolveSelect to ensure the revision is fetched if not yet\n\t\t// in the store. The _fields parameter matches the query used by\n\t\t// getRevisions so the result is served from cache without an\n\t\t// extra API call.\n\t\tconst revision = await registry\n\t\t\t.resolveSelect( coreStore )\n\t\t\t.getRevision( 'postType', postType, postId, revisionId, {\n\t\t\t\tcontext: 'edit',\n\t\t\t\t_fields: [\n\t\t\t\t\t...new Set( [\n\t\t\t\t\t\t'id',\n\t\t\t\t\t\t'date',\n\t\t\t\t\t\t'modified',\n\t\t\t\t\t\t'author',\n\t\t\t\t\t\t'meta',\n\t\t\t\t\t\t'title.raw',\n\t\t\t\t\t\t'excerpt.raw',\n\t\t\t\t\t\t'content.raw',\n\t\t\t\t\t\trevisionKey,\n\t\t\t\t\t] ),\n\t\t\t\t].join(),\n\t\t\t} );\n\n\t\tif ( ! revision ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Build the edits object with all restorable fields from the revision.\n\t\tconst edits = {\n\t\t\tblocks: undefined,\n\t\t\tcontent: revision.content.raw,\n\t\t};\n\t\tif ( revision.title?.raw !== undefined ) {\n\t\t\tedits.title = revision.title.raw;\n\t\t}\n\t\tif ( revision.excerpt?.raw !== undefined ) {\n\t\t\tedits.excerpt = revision.excerpt.raw;\n\t\t}\n\t\tif ( revision.meta !== undefined ) {\n\t\t\tedits.meta = revision.meta;\n\t\t}\n\n\t\t// Apply edits and save.\n\t\tdispatch.editPost( edits );\n\n\t\t// Exit revisions mode.\n\t\tdispatch.setCurrentRevisionId( null );\n\n\t\t// Save the post to persist the restored revision.\n\t\tawait dispatch.savePost();\n\n\t\t// Show success notice.\n\t\tregistry.dispatch( noticesStore ).createSuccessNotice(\n\t\t\tsprintf(\n\t\t\t\t/* translators: %s: Date and time of the revision. */\n\t\t\t\t__( 'Restored to revision from %s.' ),\n\t\t\t\tdateI18n( getDateSettings().formats.datetime, revision.date )\n\t\t\t),\n\t\t\t{\n\t\t\t\ttype: 'snackbar',\n\t\t\t\tid: 'editor-revision-restored',\n\t\t\t}\n\t\t);\n\t};\n\n/**\n * Select a note by its ID, or clear the selection.\n *\n * @param {undefined|number|'new'} noteId The note ID to select, 'new' to open the new note form, or undefined to clear.\n * @param {Object} [options] Optional options for the selection.\n * @param {boolean} [options.focus] Whether to focus the selected note. Default false.\n * @return {Object} Action object.\n */\nexport function selectNote( noteId, options = { focus: false } ) {\n\treturn {\n\t\ttype: 'SELECT_NOTE',\n\t\tnoteId,\n\t\toptions,\n\t};\n}\n"],
5
- "mappings": ";;;;;;;;;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AAA,QACjC;AAAA;AAAA,UAEC,gBAAI,+BAAgC;AAAA,UACpC,0BAAU,YAAAI,aAAgB,EAAE,QAAQ,UAAU,SAAS,IAAK;AAAA,IAC7D;AAAA,IACA;AAAA,MACC,MAAM;AAAA,MACN,IAAI;AAAA,IACL;AAAA,EACD;AACD;AAUM,SAAS,WAAY,QAAQ,UAAU,EAAE,OAAO,MAAM,GAAI;AAChE,SAAO;AAAA,IACN,MAAM;AAAA,IACN;AAAA,IACA;AAAA,EACD;AACD;",
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { addQueryArgs } from '@wordpress/url';\nimport apiFetch from '@wordpress/api-fetch';\nimport { parse, __unstableSerializeAndClean } from '@wordpress/blocks';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { dateI18n, getSettings as getDateSettings } from '@wordpress/date';\n\n/**\n * Internal dependencies\n */\nimport isTemplateRevertable from './utils/is-template-revertable';\nimport { buildRevisionsPageQuery } from './private-selectors';\nimport { unlock } from '../lock-unlock';\nexport * from '../dataviews/store/private-actions';\n\nconst DEVICE_TYPE_BY_VIEWPORT_STATE = {\n\t'@mobile': 'Mobile',\n\t'@tablet': 'Tablet',\n};\n\n/**\n * Updates the editor preview device in response to a block-editor viewport\n * state signal.\n *\n * @param {Object} options Viewport state change options.\n * @param {string} options.viewport Selected viewport state.\n * @param {boolean} options.showStateOnCanvas Whether canvas preview is enabled.\n */\nexport const updateDeviceTypeForViewportState =\n\t( { viewport = 'default', showStateOnCanvas = true } = {} ) =>\n\t( { dispatch, registry } ) => {\n\t\tif ( ! showStateOnCanvas ) {\n\t\t\treturn;\n\t\t}\n\n\t\tdispatch.setDeviceType(\n\t\t\tDEVICE_TYPE_BY_VIEWPORT_STATE[ viewport ] ?? 'Desktop'\n\t\t);\n\t\tunlock( registry.dispatch( blockEditorStore ) ).resetZoomLevel();\n\t};\n\n/**\n * Returns an action object used to set which template is currently being used/edited.\n *\n * @param {string} id Template Id.\n *\n * @return {Object} Action object.\n */\nexport function setCurrentTemplateId( id ) {\n\treturn {\n\t\ttype: 'SET_CURRENT_TEMPLATE_ID',\n\t\tid,\n\t};\n}\n\n/**\n * Create a block based template.\n *\n * @param {?Object} template Template to create and assign.\n */\nexport const createTemplate =\n\t( template ) =>\n\tasync ( { select, dispatch, registry } ) => {\n\t\tconst savedTemplate = await registry\n\t\t\t.dispatch( coreStore )\n\t\t\t.saveEntityRecord( 'postType', 'wp_template', template );\n\t\tregistry\n\t\t\t.dispatch( coreStore )\n\t\t\t.editEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tselect.getCurrentPostType(),\n\t\t\t\tselect.getCurrentPostId(),\n\t\t\t\t{\n\t\t\t\t\ttemplate: savedTemplate.slug,\n\t\t\t\t}\n\t\t\t);\n\t\tregistry\n\t\t\t.dispatch( noticesStore )\n\t\t\t.createSuccessNotice(\n\t\t\t\t__( \"Custom template created. You're in template mode now.\" ),\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\tactions: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: __( 'Go back' ),\n\t\t\t\t\t\t\tonClick: () =>\n\t\t\t\t\t\t\t\tdispatch.setRenderingMode(\n\t\t\t\t\t\t\t\t\tselect.getEditorSettings()\n\t\t\t\t\t\t\t\t\t\t.defaultRenderingMode\n\t\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\treturn savedTemplate;\n\t};\n\n/**\n * Update the provided block types to be visible.\n *\n * @param {string[]} blockNames Names of block types to show.\n */\nexport const showBlockTypes =\n\t( blockNames ) =>\n\t( { registry } ) => {\n\t\tconst existingBlockNames =\n\t\t\tregistry\n\t\t\t\t.select( preferencesStore )\n\t\t\t\t.get( 'core', 'hiddenBlockTypes' ) ?? [];\n\n\t\tconst newBlockNames = existingBlockNames.filter(\n\t\t\t( type ) =>\n\t\t\t\t! (\n\t\t\t\t\tArray.isArray( blockNames ) ? blockNames : [ blockNames ]\n\t\t\t\t).includes( type )\n\t\t);\n\n\t\tregistry\n\t\t\t.dispatch( preferencesStore )\n\t\t\t.set( 'core', 'hiddenBlockTypes', newBlockNames );\n\t};\n\n/**\n * Update the provided block types to be hidden.\n *\n * @param {string[]} blockNames Names of block types to hide.\n */\nexport const hideBlockTypes =\n\t( blockNames ) =>\n\t( { registry } ) => {\n\t\tconst existingBlockNames =\n\t\t\tregistry\n\t\t\t\t.select( preferencesStore )\n\t\t\t\t.get( 'core', 'hiddenBlockTypes' ) ?? [];\n\n\t\tconst mergedBlockNames = new Set( [\n\t\t\t...existingBlockNames,\n\t\t\t...( Array.isArray( blockNames ) ? blockNames : [ blockNames ] ),\n\t\t] );\n\n\t\tregistry\n\t\t\t.dispatch( preferencesStore )\n\t\t\t.set( 'core', 'hiddenBlockTypes', [ ...mergedBlockNames ] );\n\t};\n\n/**\n * Save entity records marked as dirty.\n *\n * @param {Object} options Options for the action.\n * @param {Function} [options.onSave] Callback when saving happens.\n * @param {object[]} [options.dirtyEntityRecords] Array of dirty entities.\n * @param {object[]} [options.entitiesToSkip] Array of entities to skip saving.\n * @param {Function} [options.close] Callback when the actions is called. It should be consolidated with `onSave`.\n * @param {string} [options.successNoticeContent] Optional custom success notice content. Defaults to 'Site updated.'.\n */\nexport const saveDirtyEntities =\n\t( {\n\t\tonSave,\n\t\tdirtyEntityRecords = [],\n\t\tentitiesToSkip = [],\n\t\tclose,\n\t\tsuccessNoticeContent,\n\t} = {} ) =>\n\t( { registry } ) => {\n\t\tconst PUBLISH_ON_SAVE_ENTITIES = [\n\t\t\t{ kind: 'postType', name: 'wp_navigation' },\n\t\t];\n\t\tconst saveNoticeId = 'site-editor-save-success';\n\t\tconst homeUrl = registry\n\t\t\t.select( coreStore )\n\t\t\t.getEntityRecord( 'root', '__unstableBase' )?.home;\n\t\tregistry.dispatch( noticesStore ).removeNotice( saveNoticeId );\n\t\tconst entitiesToSave = dirtyEntityRecords.filter(\n\t\t\t( { kind, name, key, property } ) => {\n\t\t\t\treturn ! entitiesToSkip.some(\n\t\t\t\t\t( elt ) =>\n\t\t\t\t\t\telt.kind === kind &&\n\t\t\t\t\t\telt.name === name &&\n\t\t\t\t\t\telt.key === key &&\n\t\t\t\t\t\telt.property === property\n\t\t\t\t);\n\t\t\t}\n\t\t);\n\t\tclose?.( entitiesToSave );\n\t\tconst siteItemsToSave = [];\n\t\tconst pendingSavedRecords = [];\n\t\tentitiesToSave.forEach( ( { kind, name, key, property } ) => {\n\t\t\tif ( 'root' === kind && 'site' === name ) {\n\t\t\t\tsiteItemsToSave.push( property );\n\t\t\t} else {\n\t\t\t\tif (\n\t\t\t\t\tPUBLISH_ON_SAVE_ENTITIES.some(\n\t\t\t\t\t\t( typeToPublish ) =>\n\t\t\t\t\t\t\ttypeToPublish.kind === kind &&\n\t\t\t\t\t\t\ttypeToPublish.name === name\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\tregistry\n\t\t\t\t\t\t.dispatch( coreStore )\n\t\t\t\t\t\t.editEntityRecord( kind, name, key, {\n\t\t\t\t\t\t\tstatus: 'publish',\n\t\t\t\t\t\t} );\n\t\t\t\t}\n\n\t\t\t\tpendingSavedRecords.push(\n\t\t\t\t\tregistry\n\t\t\t\t\t\t.dispatch( coreStore )\n\t\t\t\t\t\t.saveEditedEntityRecord( kind, name, key )\n\t\t\t\t);\n\t\t\t}\n\t\t} );\n\t\tif ( siteItemsToSave.length ) {\n\t\t\tpendingSavedRecords.push(\n\t\t\t\tregistry\n\t\t\t\t\t.dispatch( coreStore )\n\t\t\t\t\t.__experimentalSaveSpecifiedEntityEdits(\n\t\t\t\t\t\t'root',\n\t\t\t\t\t\t'site',\n\t\t\t\t\t\tundefined,\n\t\t\t\t\t\tsiteItemsToSave\n\t\t\t\t\t)\n\t\t\t);\n\t\t}\n\t\tregistry\n\t\t\t.dispatch( blockEditorStore )\n\t\t\t.__unstableMarkLastChangeAsPersistent();\n\t\tPromise.all( pendingSavedRecords )\n\t\t\t.then( ( values ) => {\n\t\t\t\treturn onSave ? onSave( values ) : values;\n\t\t\t} )\n\t\t\t.then( ( values ) => {\n\t\t\t\tif (\n\t\t\t\t\tvalues.some( ( value ) => typeof value === 'undefined' )\n\t\t\t\t) {\n\t\t\t\t\tregistry\n\t\t\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t\t\t.createErrorNotice( __( 'Saving failed.' ) );\n\t\t\t\t} else {\n\t\t\t\t\tregistry\n\t\t\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t\t\t.createSuccessNotice(\n\t\t\t\t\t\t\tsuccessNoticeContent || __( 'Site updated.' ),\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\t\tid: saveNoticeId,\n\t\t\t\t\t\t\t\tactions: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tlabel: __( 'View site' ),\n\t\t\t\t\t\t\t\t\t\turl: homeUrl,\n\t\t\t\t\t\t\t\t\t\topenInNewTab: true,\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}\n\t\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t} )\n\t\t\t.catch( ( error ) =>\n\t\t\t\tregistry\n\t\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t\t.createErrorNotice(\n\t\t\t\t\t\t`${ __( 'Saving failed.' ) } ${ error }`\n\t\t\t\t\t)\n\t\t\t);\n\t};\n\n/**\n * Reverts a template to its original theme-provided file.\n *\n * @param {Object} template The template to revert.\n * @param {Object} [options]\n * @param {boolean} [options.allowUndo] Whether to allow the user to undo\n * reverting the template. Default true.\n */\nexport const revertTemplate =\n\t( template, { allowUndo = true } = {} ) =>\n\tasync ( { registry } ) => {\n\t\tconst noticeId = 'edit-site-template-reverted';\n\t\tregistry.dispatch( noticesStore ).removeNotice( noticeId );\n\t\tif ( ! isTemplateRevertable( template ) ) {\n\t\t\tregistry\n\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t.createErrorNotice( __( 'This template is not revertable.' ), {\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t} );\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tconst templateEntityConfig = registry\n\t\t\t\t.select( coreStore )\n\t\t\t\t.getEntityConfig( 'postType', template.type );\n\n\t\t\tif ( ! templateEntityConfig ) {\n\t\t\t\tregistry\n\t\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t\t.createErrorNotice(\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'The editor has encountered an unexpected error. Please reload.'\n\t\t\t\t\t\t),\n\t\t\t\t\t\t{ type: 'snackbar' }\n\t\t\t\t\t);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst fileTemplatePath = addQueryArgs(\n\t\t\t\t`${ templateEntityConfig.baseURL }/${ template.id }`,\n\t\t\t\t{ context: 'edit', source: template.origin }\n\t\t\t);\n\n\t\t\tconst fileTemplate = await apiFetch( { path: fileTemplatePath } );\n\t\t\tif ( ! fileTemplate ) {\n\t\t\t\tregistry\n\t\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t\t.createErrorNotice(\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'The editor has encountered an unexpected error. Please reload.'\n\t\t\t\t\t\t),\n\t\t\t\t\t\t{ type: 'snackbar' }\n\t\t\t\t\t);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst serializeBlocks = ( {\n\t\t\t\tblocks: blocksForSerialization = [],\n\t\t\t} ) => __unstableSerializeAndClean( blocksForSerialization );\n\n\t\t\tconst edited = registry\n\t\t\t\t.select( coreStore )\n\t\t\t\t.getEditedEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\ttemplate.type,\n\t\t\t\t\ttemplate.id\n\t\t\t\t);\n\n\t\t\t// We are fixing up the undo level here to make sure we can undo\n\t\t\t// the revert in the header toolbar correctly.\n\t\t\tregistry.dispatch( coreStore ).editEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\ttemplate.type,\n\t\t\t\ttemplate.id,\n\t\t\t\t{\n\t\t\t\t\tcontent: serializeBlocks, // Required to make the `undo` behave correctly.\n\t\t\t\t\tblocks: edited.blocks, // Required to revert the blocks in the editor.\n\t\t\t\t\tsource: 'custom', // required to avoid turning the editor into a dirty state\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tundoIgnore: true, // Required to merge this edit with the last undo level.\n\t\t\t\t}\n\t\t\t);\n\n\t\t\tconst blocks = parse( fileTemplate?.content?.raw );\n\t\t\tregistry\n\t\t\t\t.dispatch( coreStore )\n\t\t\t\t.editEntityRecord( 'postType', template.type, fileTemplate.id, {\n\t\t\t\t\tcontent: serializeBlocks,\n\t\t\t\t\tblocks,\n\t\t\t\t\tsource: 'theme',\n\t\t\t\t} );\n\n\t\t\tif ( allowUndo ) {\n\t\t\t\tconst undoRevert = () => {\n\t\t\t\t\tregistry\n\t\t\t\t\t\t.dispatch( coreStore )\n\t\t\t\t\t\t.editEntityRecord(\n\t\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t\ttemplate.type,\n\t\t\t\t\t\t\tedited.id,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tcontent: serializeBlocks,\n\t\t\t\t\t\t\t\tblocks: edited.blocks,\n\t\t\t\t\t\t\t\tsource: 'custom',\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t);\n\t\t\t\t};\n\n\t\t\t\tregistry\n\t\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t\t.createSuccessNotice( __( 'Template reset.' ), {\n\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\tid: noticeId,\n\t\t\t\t\t\tactions: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tlabel: __( 'Undo' ),\n\t\t\t\t\t\t\t\tonClick: undoRevert,\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}\n\t\t} catch ( error ) {\n\t\t\tconst errorMessage =\n\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t? error.message\n\t\t\t\t\t: __( 'Template revert failed. Please reload.' );\n\t\t\tregistry\n\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t.createErrorNotice( errorMessage, { type: 'snackbar' } );\n\t\t}\n\t};\n\n/**\n * Action that removes an array of templates, template parts or patterns.\n *\n * @param {Array} items An array of template,template part or pattern objects to remove.\n */\nexport const removeTemplates =\n\t( items ) =>\n\tasync ( { registry } ) => {\n\t\tconst isResetting = items.every( ( item ) => item?.has_theme_file );\n\n\t\tconst promiseResult = await Promise.allSettled(\n\t\t\titems.map( ( item ) => {\n\t\t\t\treturn registry\n\t\t\t\t\t.dispatch( coreStore )\n\t\t\t\t\t.deleteEntityRecord(\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\titem.type,\n\t\t\t\t\t\titem.id,\n\t\t\t\t\t\t{ force: true },\n\t\t\t\t\t\t{ throwOnError: true }\n\t\t\t\t\t);\n\t\t\t} )\n\t\t);\n\n\t\t// If all the promises were fulfilled with success.\n\t\tif ( promiseResult.every( ( { status } ) => status === 'fulfilled' ) ) {\n\t\t\tlet successMessage;\n\n\t\t\tif ( items.length === 1 ) {\n\t\t\t\t// Depending on how the entity was retrieved its title might be\n\t\t\t\t// an object or simple string.\n\t\t\t\tlet title;\n\t\t\t\tif ( typeof items[ 0 ].title === 'string' ) {\n\t\t\t\t\ttitle = items[ 0 ].title;\n\t\t\t\t} else if ( typeof items[ 0 ].title?.rendered === 'string' ) {\n\t\t\t\t\ttitle = items[ 0 ].title?.rendered;\n\t\t\t\t} else if ( typeof items[ 0 ].title?.raw === 'string' ) {\n\t\t\t\t\ttitle = items[ 0 ].title?.raw;\n\t\t\t\t}\n\t\t\t\tsuccessMessage = isResetting\n\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t/* translators: %s: The template/part's name. */\n\t\t\t\t\t\t\t__( '\"%s\" reset.' ),\n\t\t\t\t\t\t\tdecodeEntities( title )\n\t\t\t\t\t )\n\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t/* translators: %s: The template/part's name. */\n\t\t\t\t\t\t\t_x( '\"%s\" deleted.', 'template part' ),\n\t\t\t\t\t\t\tdecodeEntities( title )\n\t\t\t\t\t );\n\t\t\t} else {\n\t\t\t\tsuccessMessage = isResetting\n\t\t\t\t\t? __( 'Items reset.' )\n\t\t\t\t\t: __( 'Items deleted.' );\n\t\t\t}\n\n\t\t\tregistry\n\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t.createSuccessNotice( successMessage, {\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\tid: 'editor-template-deleted-success',\n\t\t\t\t} );\n\t\t} else {\n\t\t\t// If there was at lease one failure.\n\t\t\tlet errorMessage;\n\t\t\t// If we were trying to delete a single template.\n\t\t\tif ( promiseResult.length === 1 ) {\n\t\t\t\tif ( promiseResult[ 0 ].reason?.message ) {\n\t\t\t\t\terrorMessage = promiseResult[ 0 ].reason.message;\n\t\t\t\t} else {\n\t\t\t\t\terrorMessage = isResetting\n\t\t\t\t\t\t? __( 'An error occurred while reverting the item.' )\n\t\t\t\t\t\t: __( 'An error occurred while deleting the item.' );\n\t\t\t\t}\n\t\t\t\t// If we were trying to delete a multiple templates\n\t\t\t} else {\n\t\t\t\tconst errorMessages = new Set();\n\t\t\t\tconst failedPromises = promiseResult.filter(\n\t\t\t\t\t( { status } ) => status === 'rejected'\n\t\t\t\t);\n\t\t\t\tfor ( const failedPromise of failedPromises ) {\n\t\t\t\t\tif ( failedPromise.reason?.message ) {\n\t\t\t\t\t\terrorMessages.add( failedPromise.reason.message );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif ( errorMessages.size === 0 ) {\n\t\t\t\t\terrorMessage = __(\n\t\t\t\t\t\t'An error occurred while deleting the items.'\n\t\t\t\t\t);\n\t\t\t\t} else if ( errorMessages.size === 1 ) {\n\t\t\t\t\terrorMessage = isResetting\n\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t/* translators: %s: an error message */\n\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t'An error occurred while reverting the items: %s'\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t[ ...errorMessages ][ 0 ]\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t\t/* translators: %s: an error message */\n\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t'An error occurred while deleting the items: %s'\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t[ ...errorMessages ][ 0 ]\n\t\t\t\t\t\t );\n\t\t\t\t} else {\n\t\t\t\t\terrorMessage = isResetting\n\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t/* translators: %s: a list of comma separated error messages */\n\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t'Some errors occurred while reverting the items: %s'\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t[ ...errorMessages ].join( ',' )\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t\t/* translators: %s: a list of comma separated error messages */\n\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t'Some errors occurred while deleting the items: %s'\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t[ ...errorMessages ].join( ',' )\n\t\t\t\t\t\t );\n\t\t\t\t}\n\t\t\t}\n\t\t\tregistry\n\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t.createErrorNotice( errorMessage, { type: 'snackbar' } );\n\t\t}\n\t};\n\n/**\n * Set the default rendering mode preference for the current post type.\n *\n * @param {string} mode The rendering mode to set as default.\n */\nexport const setDefaultRenderingMode =\n\t( mode ) =>\n\t( { select, registry } ) => {\n\t\tconst postType = select.getCurrentPostType();\n\t\tconst theme = registry\n\t\t\t.select( coreStore )\n\t\t\t.getCurrentTheme()?.stylesheet;\n\t\tconst renderingModes =\n\t\t\tregistry\n\t\t\t\t.select( preferencesStore )\n\t\t\t\t.get( 'core', 'renderingModes' )?.[ theme ] ?? {};\n\n\t\tif ( renderingModes[ postType ] === mode ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst newModes = {\n\t\t\t[ theme ]: {\n\t\t\t\t...renderingModes,\n\t\t\t\t[ postType ]: mode,\n\t\t\t},\n\t\t};\n\n\t\tregistry\n\t\t\t.dispatch( preferencesStore )\n\t\t\t.set( 'core', 'renderingModes', newModes );\n\t};\n\n/**\n * Set the current global styles navigation path.\n *\n * @param {string} path The navigation path.\n * @return {Object} Action object.\n */\nexport function setStylesPath( path ) {\n\treturn {\n\t\ttype: 'SET_STYLES_PATH',\n\t\tpath,\n\t};\n}\n\n/**\n * Set whether the stylebook is visible.\n *\n * @param {boolean} show Whether to show the stylebook.\n * @return {Object} Action object.\n */\nexport function setShowStylebook( show ) {\n\treturn {\n\t\ttype: 'SET_SHOW_STYLEBOOK',\n\t\tshow,\n\t};\n}\n\n/**\n * Reset the global styles navigation to initial state.\n *\n * @return {Object} Action object.\n */\nexport function resetStylesNavigation() {\n\treturn {\n\t\ttype: 'RESET_STYLES_NAVIGATION',\n\t};\n}\n\n/**\n * Set the current revision ID for revisions preview mode.\n * Pass a revision ID to enter revisions mode, or null to exit.\n *\n * @param {number|null} revisionId The revision ID, or null to exit revisions mode.\n * @return {Object} Action object.\n */\nexport function setCurrentRevisionId( revisionId ) {\n\treturn {\n\t\ttype: 'SET_CURRENT_REVISION_ID',\n\t\trevisionId,\n\t};\n}\n\n/**\n * Set the current revisions page number and select the newest\n * revision on that page once it loads.\n *\n * @param {number} page The page number.\n */\nexport const setRevisionPage =\n\t( page ) =>\n\tasync ( { dispatch, select, registry } ) => {\n\t\tconst postType = select.getCurrentPostType();\n\t\tconst postId = select.getCurrentPostId();\n\t\tconst entityConfig = registry\n\t\t\t.select( coreStore )\n\t\t\t.getEntityConfig( 'postType', postType );\n\t\tconst revisionKey = entityConfig?.revisionKey || 'id';\n\n\t\tconst revisions = await registry\n\t\t\t.resolveSelect( coreStore )\n\t\t\t.getRevisions(\n\t\t\t\t'postType',\n\t\t\t\tpostType,\n\t\t\t\tpostId,\n\t\t\t\tbuildRevisionsPageQuery( revisionKey, page )\n\t\t\t);\n\n\t\tregistry.batch( () => {\n\t\t\tdispatch( { type: 'SET_REVISION_PAGE', page } );\n\t\t\tif ( revisions?.length ) {\n\t\t\t\tdispatch.setCurrentRevisionId( revisions[ 0 ][ revisionKey ] );\n\t\t\t}\n\t\t} );\n\t};\n\n/**\n * Set whether the revision diff highlighting is shown.\n *\n * @param {boolean} showDiff Whether to show diff highlighting.\n * @return {Object} Action object.\n */\nexport function setShowRevisionDiff( showDiff ) {\n\treturn {\n\t\ttype: 'SET_SHOW_REVISION_DIFF',\n\t\tshowDiff,\n\t};\n}\n\n/**\n * Restore a revision by replacing the current content with the revision's content\n * and auto-saving.\n *\n * @param {number} revisionId The revision ID to restore.\n */\nexport const restoreRevision =\n\t( revisionId ) =>\n\tasync ( { select, dispatch, registry } ) => {\n\t\tconst postType = select.getCurrentPostType();\n\t\tconst postId = select.getCurrentPostId();\n\n\t\tconst entityConfig = registry\n\t\t\t.select( coreStore )\n\t\t\t.getEntityConfig( 'postType', postType );\n\t\tconst revisionKey = entityConfig?.revisionKey || 'id';\n\n\t\t// Use resolveSelect to ensure the revision is fetched if not yet\n\t\t// in the store. The _fields parameter matches the query used by\n\t\t// getRevisions so the result is served from cache without an\n\t\t// extra API call.\n\t\tconst revision = await registry\n\t\t\t.resolveSelect( coreStore )\n\t\t\t.getRevision( 'postType', postType, postId, revisionId, {\n\t\t\t\tcontext: 'edit',\n\t\t\t\t_fields: [\n\t\t\t\t\t...new Set( [\n\t\t\t\t\t\t'id',\n\t\t\t\t\t\t'date',\n\t\t\t\t\t\t'modified',\n\t\t\t\t\t\t'author',\n\t\t\t\t\t\t'meta',\n\t\t\t\t\t\t'title.raw',\n\t\t\t\t\t\t'excerpt.raw',\n\t\t\t\t\t\t'content.raw',\n\t\t\t\t\t\trevisionKey,\n\t\t\t\t\t] ),\n\t\t\t\t].join(),\n\t\t\t} );\n\n\t\tif ( ! revision ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Build the edits object with all restorable fields from the revision.\n\t\tconst edits = {\n\t\t\tblocks: undefined,\n\t\t\tcontent: revision.content.raw,\n\t\t};\n\t\tif ( revision.title?.raw !== undefined ) {\n\t\t\tedits.title = revision.title.raw;\n\t\t}\n\t\tif ( revision.excerpt?.raw !== undefined ) {\n\t\t\tedits.excerpt = revision.excerpt.raw;\n\t\t}\n\t\tif ( revision.meta !== undefined ) {\n\t\t\tedits.meta = revision.meta;\n\t\t}\n\n\t\t// Apply edits and save.\n\t\tdispatch.editPost( edits );\n\n\t\t// Exit revisions mode.\n\t\tdispatch.setCurrentRevisionId( null );\n\n\t\t// Save the post to persist the restored revision.\n\t\tawait dispatch.savePost();\n\n\t\t// Show success notice.\n\t\tregistry.dispatch( noticesStore ).createSuccessNotice(\n\t\t\tsprintf(\n\t\t\t\t/* translators: %s: Date and time of the revision. */\n\t\t\t\t__( 'Restored to revision from %s.' ),\n\t\t\t\tdateI18n( getDateSettings().formats.datetime, revision.date )\n\t\t\t),\n\t\t\t{\n\t\t\t\ttype: 'snackbar',\n\t\t\t\tid: 'editor-revision-restored',\n\t\t\t}\n\t\t);\n\t};\n\n/**\n * Select a note by its ID, or clear the selection.\n *\n * @param {undefined|number|'new'} noteId The note ID to select, 'new' to open the new note form, or undefined to clear.\n * @param {Object} [options] Optional options for the selection.\n * @param {boolean} [options.focus] Whether to focus the selected note. Default false.\n * @return {Object} Action object.\n */\nexport function selectNote( noteId, options = { focus: false } ) {\n\treturn {\n\t\ttype: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AsB,IAAK;AAGpC,QAAM,SAAS,SAAS;AAGxB,WAAS,SAAU,eAAAC,KAAa,EAAE;AAAA,QACjC;AAAA;AAAA,UAEC,gBAAI,+BAAgC;AAAA,UACpC,0BAAU,YAAAI,aAAgB,EAAE,QAAQ,UAAU,SAAS,IAAK;AAAA,IAC7D;AAAA,IACA;AAAA,MACC,MAAM;AAAA,MACN,IAAI;AAAA,IACL;AAAA,EACD;AACD;AAUM,SAAS,WAAY,QAAQ,UAAU,EAAE,OAAO,MAAM,GAAI;AAChE,SAAO;AAAA,IACN,MAAM;AAAA,IACN;AAAA,IACA;AAAA,EACD;AACD;",
6
6
  "names": ["blockEditorStore", "coreStore", "noticesStore", "preferencesStore", "isTemplateRevertable", "apiFetch", "getDateSettings"]
7
7
  }
@@ -1,92 +1,53 @@
1
1
  // packages/editor/src/components/autosave-monitor/index.js
2
- import { Component } from "@wordpress/element";
3
- import { compose } from "@wordpress/compose";
4
- import { withSelect, withDispatch } from "@wordpress/data";
2
+ import { useEffect, useRef } from "@wordpress/element";
3
+ import { useSelect, useDispatch } from "@wordpress/data";
5
4
  import { store as coreStore } from "@wordpress/core-data";
6
5
  import { store as editorStore } from "../../store/index.mjs";
7
- var AutosaveMonitor = class extends Component {
8
- constructor(props) {
9
- super(props);
10
- this.needsAutosave = !!(props.isDirty && props.isAutosaveable);
11
- }
12
- componentDidMount() {
13
- if (!this.props.disableIntervalChecks) {
14
- this.setAutosaveTimer();
15
- }
16
- }
17
- componentDidUpdate(prevProps) {
18
- if (this.props.disableIntervalChecks) {
19
- if (this.props.editsReference !== prevProps.editsReference) {
20
- this.props.autosave();
21
- }
22
- return;
23
- }
24
- if (this.props.interval !== prevProps.interval) {
25
- clearTimeout(this.timerId);
26
- this.setAutosaveTimer();
27
- }
28
- if (!this.props.isDirty) {
29
- this.needsAutosave = false;
6
+ function useInterval(callback, intervalInSeconds) {
7
+ const callbackRef = useRef(callback);
8
+ useEffect(() => {
9
+ callbackRef.current = callback;
10
+ }, [callback]);
11
+ useEffect(() => {
12
+ if (!intervalInSeconds) {
30
13
  return;
31
14
  }
32
- if (this.props.isAutosaving && !prevProps.isAutosaving) {
33
- this.needsAutosave = false;
34
- return;
35
- }
36
- if (this.props.editsReference !== prevProps.editsReference) {
37
- this.needsAutosave = true;
38
- }
39
- }
40
- componentWillUnmount() {
41
- clearTimeout(this.timerId);
42
- }
43
- setAutosaveTimer(timeout = this.props.interval * 1e3) {
44
- this.timerId = setTimeout(() => {
45
- this.autosaveTimerHandler();
46
- }, timeout);
47
- }
48
- autosaveTimerHandler() {
49
- if (!this.props.isAutosaveable) {
50
- this.setAutosaveTimer(1e3);
15
+ const id = setInterval(
16
+ () => callbackRef.current(),
17
+ intervalInSeconds * 1e3
18
+ );
19
+ return () => clearInterval(id);
20
+ }, [intervalInSeconds]);
21
+ }
22
+ function AutosaveMonitor({ interval, autosave }) {
23
+ const { autosave: autosaveAction } = useDispatch(editorStore);
24
+ const triggerAutosave = autosave ?? autosaveAction;
25
+ const { getReferenceByDistinctEdits } = useSelect(coreStore);
26
+ const { isEditedPostDirty, isEditedPostAutosaveable, isAutosavingPost } = useSelect(editorStore);
27
+ const autosaveInterval = useSelect(
28
+ (select) => {
29
+ if (interval !== void 0) {
30
+ return interval;
31
+ }
32
+ return select(editorStore).getEditorSettings().autosaveInterval;
33
+ },
34
+ [interval]
35
+ );
36
+ const lastEditsReferenceRef = useRef();
37
+ useInterval(() => {
38
+ if (!isEditedPostAutosaveable()) {
51
39
  return;
52
40
  }
53
- if (this.needsAutosave) {
54
- this.needsAutosave = false;
55
- this.props.autosave();
56
- }
57
- this.setAutosaveTimer();
58
- }
59
- render() {
60
- return null;
61
- }
62
- };
63
- var autosave_monitor_default = compose([
64
- withSelect((select, ownProps) => {
65
- const { getReferenceByDistinctEdits } = select(coreStore);
66
- const {
67
- isEditedPostDirty,
68
- isEditedPostAutosaveable,
69
- isAutosavingPost,
70
- getEditorSettings
71
- } = select(editorStore);
72
- const { interval = getEditorSettings().autosaveInterval } = ownProps;
73
- return {
74
- editsReference: getReferenceByDistinctEdits(),
75
- isDirty: isEditedPostDirty(),
76
- isAutosaveable: isEditedPostAutosaveable(),
77
- isAutosaving: isAutosavingPost(),
78
- interval
79
- };
80
- }),
81
- withDispatch((dispatch, ownProps) => ({
82
- autosave() {
83
- const { autosave = dispatch(editorStore).autosave } = ownProps;
84
- autosave();
41
+ const editsReference = getReferenceByDistinctEdits();
42
+ const hasNewEdits = editsReference !== lastEditsReferenceRef.current;
43
+ if (hasNewEdits && isEditedPostDirty() && !isAutosavingPost()) {
44
+ lastEditsReferenceRef.current = editsReference;
45
+ triggerAutosave();
85
46
  }
86
- }))
87
- ])(AutosaveMonitor);
47
+ }, autosaveInterval);
48
+ return null;
49
+ }
88
50
  export {
89
- AutosaveMonitor,
90
- autosave_monitor_default as default
51
+ AutosaveMonitor as default
91
52
  };
92
53
  //# sourceMappingURL=index.mjs.map