@wordpress/boot 0.23.0 → 0.25.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,9 @@
1
1
  // packages/boot/src/components/canvas/index.tsx
2
2
  import { useState, useEffect, useMemo } from "@wordpress/element";
3
- import { Spinner } from "@wordpress/components";
3
+ import { Spinner as WCSpinner } from "@wordpress/components";
4
4
  import { useNavigate, useSearch } from "@wordpress/route";
5
5
  import { __ } from "@wordpress/i18n";
6
+ import { inertValue } from "@wordpress/react-inert-value";
6
7
  import { useSelect } from "@wordpress/data";
7
8
  import { store as coreStore } from "@wordpress/core-data";
8
9
  import { store as bootStore } from "../../store/index.mjs";
@@ -81,7 +82,7 @@ function Canvas({ canvas }) {
81
82
  height: "100%",
82
83
  padding: "2rem"
83
84
  },
84
- children: /* @__PURE__ */ jsx(Spinner, {})
85
+ children: /* @__PURE__ */ jsx(WCSpinner, {})
85
86
  }
86
87
  );
87
88
  }
@@ -91,7 +92,7 @@ function Canvas({ canvas }) {
91
92
  "div",
92
93
  {
93
94
  style: { height: "100%" },
94
- inert: canvas.isPreview ? "true" : void 0,
95
+ inert: inertValue(canvas.isPreview),
95
96
  children: /* @__PURE__ */ jsx(
96
97
  Editor,
97
98
  {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/canvas/index.tsx"],
4
- "sourcesContent": ["import { useState, useEffect, useMemo } from '@wordpress/element';\nimport { Spinner } from '@wordpress/components';\nimport { useNavigate, useSearch } from '@wordpress/route';\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as bootStore } from '../../store';\nimport type { CanvasData } from '../../store/types';\nimport BootBackButton from './back-button';\nimport SitePreview from './site-preview';\nimport useNavigateToEntityRecord, {\n\tuseActionPerformed,\n} from './use-navigate-to-entity-record';\nimport { getDeviceType } from './viewport';\n\ninterface CanvasProps {\n\tcanvas: CanvasData;\n}\n\n/**\n * Canvas component that dynamically loads and renders the lazy editor.\n *\n * @param {Object} props - Component props\n * @param {Object} props.canvas - Canvas data containing postType and postId\n * @return Canvas surface with editor\n */\nexport default function Canvas( { canvas }: CanvasProps ) {\n\tconst [ Editor, setEditor ] = useState< any >( null );\n\tconst navigate = useNavigate();\n\tconst { onNavigateToEntityRecord, onNavigateToPreviousEntityRecord } =\n\t\tuseNavigateToEntityRecord();\n\tconst onActionPerformed = useActionPerformed( canvas.postType );\n\n\t/*\n\t * An entity can be asked to be edited at a particular width — a navigation\n\t * overlay meant for mobile — and carries the width it was left at when\n\t * returned to. Anything else opens at the default.\n\t */\n\tconst viewport = useSearch( {\n\t\tstrict: false,\n\t\tselect: ( search ) => ( search as { viewport?: string } ).viewport,\n\t} ) as string | undefined;\n\n\t/*\n\t * Where clicking a previewed canvas goes, resolved the same way the editor\n\t * resolves anywhere else it sends you to edit an entity, and whether it\n\t * should go anywhere at all: a trashed entity has to be restored before it\n\t * can be edited.\n\t *\n\t * The record is the one the editor loads for this canvas, so reading it\n\t * here costs no request of its own.\n\t */\n\t/*\n\t * A route that names no entity leaves the editor to resolve one, which it\n\t * does from the block templates only a block theme has. `undefined` while\n\t * the theme is still being read.\n\t */\n\tconst hasEntity = !! ( canvas.postType && canvas.postId );\n\tconst isBlockTheme = useSelect(\n\t\t( select ) =>\n\t\t\t(\n\t\t\t\tselect( coreStore ).getCurrentTheme() as\n\t\t\t\t\t{ is_block_theme?: boolean } | undefined\n\t\t\t )?.is_block_theme,\n\t\t[]\n\t);\n\n\tconst { editLink, isTrashed } = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! canvas.postType || ! canvas.postId ) {\n\t\t\t\treturn { editLink: undefined, isTrashed: false };\n\t\t\t}\n\n\t\t\tconst record = select( coreStore ).getEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tcanvas.postType,\n\t\t\t\tcanvas.postId\n\t\t\t) as { status?: string } | undefined;\n\n\t\t\treturn {\n\t\t\t\teditLink: select( bootStore ).getEntityLink(\n\t\t\t\t\tcanvas.postType,\n\t\t\t\t\tcanvas.postId\n\t\t\t\t),\n\t\t\t\tisTrashed: record?.status === 'trash',\n\t\t\t};\n\t\t},\n\t\t[ canvas.postType, canvas.postId ]\n\t);\n\n\t/*\n\t * Memoized because the editor provider pushes these settings into the store\n\t * whenever their identity changes, and the callbacks have to stay stable for\n\t * the block inspector to keep offering the same affordance.\n\t */\n\tconst settings = useMemo(\n\t\t() => ( {\n\t\t\tisPreviewMode: canvas.isPreview,\n\t\t\tstyles: canvas.isPreview\n\t\t\t\t? [ { css: 'body{min-height:100vh;}' } ]\n\t\t\t\t: [],\n\t\t\tonNavigateToEntityRecord,\n\t\t\tonNavigateToPreviousEntityRecord,\n\t\t} ),\n\t\t[\n\t\t\tcanvas.isPreview,\n\t\t\tonNavigateToEntityRecord,\n\t\t\tonNavigateToPreviousEntityRecord,\n\t\t]\n\t);\n\n\tuseEffect( () => {\n\t\t// Dynamically import the lazy-editor module\n\t\timport( '@wordpress/lazy-editor' )\n\t\t\t.then( ( module ) => {\n\t\t\t\tsetEditor( () => module.Editor );\n\t\t\t} )\n\t\t\t.catch( ( error ) => {\n\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\tconsole.error( 'Failed to load lazy editor:', error );\n\t\t\t} );\n\t}, [] );\n\n\t// Nothing for the editor to open, so show the site the route configures.\n\tif ( ! hasEntity && isBlockTheme === false ) {\n\t\treturn <SitePreview />;\n\t}\n\n\t// Show spinner while loading the editor module, and until it is known which\n\t// of the two this canvas is, so the wrong one is never shown first.\n\tif ( ! Editor || ( ! hasEntity && isBlockTheme === undefined ) ) {\n\t\treturn (\n\t\t\t<div\n\t\t\t\tstyle={ {\n\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\tjustifyContent: 'center',\n\t\t\t\t\talignItems: 'center',\n\t\t\t\t\theight: '100%',\n\t\t\t\t\tpadding: '2rem',\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<Spinner />\n\t\t\t</div>\n\t\t);\n\t}\n\n\t// Render back button in full-screen mode (when not preview)\n\t// Uses render prop pattern to receive fillProps from Slot\n\tconst backButton = ! canvas.isPreview\n\t\t? ( { length }: { length: number } ) => (\n\t\t\t\t<BootBackButton length={ length } />\n\t\t\t)\n\t\t: undefined;\n\n\t// Render the editor with canvas data\n\treturn (\n\t\t<div style={ { height: '100%', position: 'relative' } }>\n\t\t\t<div\n\t\t\t\tstyle={ { height: '100%' } }\n\t\t\t\t// @ts-expect-error inert not typed properly\n\t\t\t\tinert={ canvas.isPreview ? 'true' : undefined }\n\t\t\t>\n\t\t\t\t<Editor\n\t\t\t\t\tpostType={ canvas.postType }\n\t\t\t\t\tpostId={ canvas.postId }\n\t\t\t\t\trenderingMode={ canvas.renderingMode }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t\tbackButton={ backButton }\n\t\t\t\t\tonActionPerformed={ onActionPerformed }\n\t\t\t\t\tinitialViewport={ getDeviceType( viewport ) }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t\t{ canvas.isPreview && editLink && (\n\t\t\t\t<div\n\t\t\t\t\tonClick={\n\t\t\t\t\t\tisTrashed\n\t\t\t\t\t\t\t? undefined\n\t\t\t\t\t\t\t: () => navigate( { to: editLink } )\n\t\t\t\t\t}\n\t\t\t\t\tonKeyDown={ ( e ) => {\n\t\t\t\t\t\tif ( isTrashed ) {\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif ( e.key === 'Enter' || e.key === ' ' ) {\n\t\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\t\tnavigate( { to: editLink } );\n\t\t\t\t\t\t}\n\t\t\t\t\t} }\n\t\t\t\t\tstyle={ {\n\t\t\t\t\t\tposition: 'absolute',\n\t\t\t\t\t\tinset: 0,\n\t\t\t\t\t\tcursor: isTrashed ? 'default' : 'pointer',\n\t\t\t\t\t\tzIndex: 1,\n\t\t\t\t\t} }\n\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AA;AAAA,YACA,UAAW,OAAO;AAAA,YAClB,QAAS,OAAO;AAAA,YAChB,eAAgB,OAAO;AAAA,YACvB;AAAA,YACA;AAAA,YACA;AAAA,YACA,iBAAkB,cAAe,QAAS;AAAA;AAAA,QAC3C;AAAA;AAAA,IACD;AAAA,IACE,OAAO,aAAa,YACrB;AAAA,MAAC;AAAA;AAAA,QACA,SACC,YACG,SACA,MAAM,SAAU,EAAE,IAAI,SAAS,CAAE;AAAA,QAErC,WAAY,CAAE,MAAO;AACpB,cAAK,WAAY;AAChB;AAAA,UACD;AACA,cAAK,EAAE,QAAQ,WAAW,EAAE,QAAQ,KAAM;AACzC,cAAE,eAAe;AACjB,qBAAU,EAAE,IAAI,SAAS,CAAE;AAAA,UAC5B;AAAA,QACD;AAAA,QACA,OAAQ;AAAA,UACP,UAAU;AAAA,UACV,OAAO;AAAA,UACP,QAAQ,YAAY,YAAY;AAAA,UAChC,QAAQ;AAAA,QACT;AAAA,QACA,MAAK;AAAA,QACL,UAAW;AAAA,QACX,iBAAgB;AAAA,QAChB,cAAa,GAAI,MAAO;AAAA;AAAA,IACzB;AAAA,KAEF;AAEF;",
4
+ "sourcesContent": ["import { useState, useEffect, useMemo } from '@wordpress/element';\nimport { Spinner as WCSpinner } from '@wordpress/components';\nimport { useNavigate, useSearch } from '@wordpress/route';\nimport { __ } from '@wordpress/i18n';\nimport { inertValue } from '@wordpress/react-inert-value';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as bootStore } from '../../store';\nimport type { CanvasData } from '../../store/types';\nimport BootBackButton from './back-button';\nimport SitePreview from './site-preview';\nimport useNavigateToEntityRecord, {\n\tuseActionPerformed,\n} from './use-navigate-to-entity-record';\nimport { getDeviceType } from './viewport';\n\ninterface CanvasProps {\n\tcanvas: CanvasData;\n}\n\n/**\n * Canvas component that dynamically loads and renders the lazy editor.\n *\n * @param {Object} props - Component props\n * @param {Object} props.canvas - Canvas data containing postType and postId\n * @return Canvas surface with editor\n */\nexport default function Canvas( { canvas }: CanvasProps ) {\n\tconst [ Editor, setEditor ] = useState< any >( null );\n\tconst navigate = useNavigate();\n\tconst { onNavigateToEntityRecord, onNavigateToPreviousEntityRecord } =\n\t\tuseNavigateToEntityRecord();\n\tconst onActionPerformed = useActionPerformed( canvas.postType );\n\n\t/*\n\t * An entity can be asked to be edited at a particular width — a navigation\n\t * overlay meant for mobile — and carries the width it was left at when\n\t * returned to. Anything else opens at the default.\n\t */\n\tconst viewport = useSearch( {\n\t\tstrict: false,\n\t\tselect: ( search ) => ( search as { viewport?: string } ).viewport,\n\t} ) as string | undefined;\n\n\t/*\n\t * Where clicking a previewed canvas goes, resolved the same way the editor\n\t * resolves anywhere else it sends you to edit an entity, and whether it\n\t * should go anywhere at all: a trashed entity has to be restored before it\n\t * can be edited.\n\t *\n\t * The record is the one the editor loads for this canvas, so reading it\n\t * here costs no request of its own.\n\t */\n\t/*\n\t * A route that names no entity leaves the editor to resolve one, which it\n\t * does from the block templates only a block theme has. `undefined` while\n\t * the theme is still being read.\n\t */\n\tconst hasEntity = !! ( canvas.postType && canvas.postId );\n\tconst isBlockTheme = useSelect(\n\t\t( select ) =>\n\t\t\t(\n\t\t\t\tselect( coreStore ).getCurrentTheme() as\n\t\t\t\t\t{ is_block_theme?: boolean } | undefined\n\t\t\t )?.is_block_theme,\n\t\t[]\n\t);\n\n\tconst { editLink, isTrashed } = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! canvas.postType || ! canvas.postId ) {\n\t\t\t\treturn { editLink: undefined, isTrashed: false };\n\t\t\t}\n\n\t\t\tconst record = select( coreStore ).getEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tcanvas.postType,\n\t\t\t\tcanvas.postId\n\t\t\t) as { status?: string } | undefined;\n\n\t\t\treturn {\n\t\t\t\teditLink: select( bootStore ).getEntityLink(\n\t\t\t\t\tcanvas.postType,\n\t\t\t\t\tcanvas.postId\n\t\t\t\t),\n\t\t\t\tisTrashed: record?.status === 'trash',\n\t\t\t};\n\t\t},\n\t\t[ canvas.postType, canvas.postId ]\n\t);\n\n\t/*\n\t * Memoized because the editor provider pushes these settings into the store\n\t * whenever their identity changes, and the callbacks have to stay stable for\n\t * the block inspector to keep offering the same affordance.\n\t */\n\tconst settings = useMemo(\n\t\t() => ( {\n\t\t\tisPreviewMode: canvas.isPreview,\n\t\t\tstyles: canvas.isPreview\n\t\t\t\t? [ { css: 'body{min-height:100vh;}' } ]\n\t\t\t\t: [],\n\t\t\tonNavigateToEntityRecord,\n\t\t\tonNavigateToPreviousEntityRecord,\n\t\t} ),\n\t\t[\n\t\t\tcanvas.isPreview,\n\t\t\tonNavigateToEntityRecord,\n\t\t\tonNavigateToPreviousEntityRecord,\n\t\t]\n\t);\n\n\tuseEffect( () => {\n\t\t// Dynamically import the lazy-editor module\n\t\timport( '@wordpress/lazy-editor' )\n\t\t\t.then( ( module ) => {\n\t\t\t\tsetEditor( () => module.Editor );\n\t\t\t} )\n\t\t\t.catch( ( error ) => {\n\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\tconsole.error( 'Failed to load lazy editor:', error );\n\t\t\t} );\n\t}, [] );\n\n\t// Nothing for the editor to open, so show the site the route configures.\n\tif ( ! hasEntity && isBlockTheme === false ) {\n\t\treturn <SitePreview />;\n\t}\n\n\t// Show spinner while loading the editor module, and until it is known which\n\t// of the two this canvas is, so the wrong one is never shown first.\n\tif ( ! Editor || ( ! hasEntity && isBlockTheme === undefined ) ) {\n\t\treturn (\n\t\t\t<div\n\t\t\t\tstyle={ {\n\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\tjustifyContent: 'center',\n\t\t\t\t\talignItems: 'center',\n\t\t\t\t\theight: '100%',\n\t\t\t\t\tpadding: '2rem',\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<WCSpinner />\n\t\t\t</div>\n\t\t);\n\t}\n\n\t// Render back button in full-screen mode (when not preview)\n\t// Uses render prop pattern to receive fillProps from Slot\n\tconst backButton = ! canvas.isPreview\n\t\t? ( { length }: { length: number } ) => (\n\t\t\t\t<BootBackButton length={ length } />\n\t\t\t)\n\t\t: undefined;\n\n\t// Render the editor with canvas data\n\treturn (\n\t\t<div style={ { height: '100%', position: 'relative' } }>\n\t\t\t<div\n\t\t\t\tstyle={ { height: '100%' } }\n\t\t\t\tinert={ inertValue( canvas.isPreview ) }\n\t\t\t>\n\t\t\t\t<Editor\n\t\t\t\t\tpostType={ canvas.postType }\n\t\t\t\t\tpostId={ canvas.postId }\n\t\t\t\t\trenderingMode={ canvas.renderingMode }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t\tbackButton={ backButton }\n\t\t\t\t\tonActionPerformed={ onActionPerformed }\n\t\t\t\t\tinitialViewport={ getDeviceType( viewport ) }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t\t{ canvas.isPreview && editLink && (\n\t\t\t\t<div\n\t\t\t\t\tonClick={\n\t\t\t\t\t\tisTrashed\n\t\t\t\t\t\t\t? undefined\n\t\t\t\t\t\t\t: () => navigate( { to: editLink } )\n\t\t\t\t\t}\n\t\t\t\t\tonKeyDown={ ( e ) => {\n\t\t\t\t\t\tif ( isTrashed ) {\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif ( e.key === 'Enter' || e.key === ' ' ) {\n\t\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\t\tnavigate( { to: editLink } );\n\t\t\t\t\t\t}\n\t\t\t\t\t} }\n\t\t\t\t\tstyle={ {\n\t\t\t\t\t\tposition: 'absolute',\n\t\t\t\t\t\tinset: 0,\n\t\t\t\t\t\tcursor: isTrashed ? 'default' : 'pointer',\n\t\t\t\t\t\tzIndex: 1,\n\t\t\t\t\t} }\n\t\t\t\t\trole=\"button\"\n\t\t\t\t\ttabIndex={ 0 }\n\t\t\t\t\taria-disabled={ isTrashed }\n\t\t\t\t\taria-label={ __( 'Edit' ) }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</div>\n\t);\n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,cAAe,QAAS;AAAA;AAAA,QAC3C;AAAA;AAAA,IACD;AAAA,IACE,OAAO,aAAa,YACrB;AAAA,MAAC;AAAA;AAAA,QACA,SACC,YACG,SACA,MAAM,SAAU,EAAE,IAAI,SAAS,CAAE;AAAA,QAErC,WAAY,CAAE,MAAO;AACpB,cAAK,WAAY;AAChB;AAAA,UACD;AACA,cAAK,EAAE,QAAQ,WAAW,EAAE,QAAQ,KAAM;AACzC,cAAE,eAAe;AACjB,qBAAU,EAAE,IAAI,SAAS,CAAE;AAAA,UAC5B;AAAA,QACD;AAAA,QACA,OAAQ;AAAA,UACP,UAAU;AAAA,UACV,OAAO;AAAA,UACP,QAAQ,YAAY,YAAY;AAAA,UAChC,QAAQ;AAAA,QACT;AAAA,QACA,MAAK;AAAA,QACL,UAAW;AAAA,QACX,iBAAgB;AAAA,QAChB,cAAa,GAAI,MAAO;AAAA;AAAA,IACzB;AAAA,KAEF;AAEF;",
6
6
  "names": []
7
7
  }
@@ -77,6 +77,7 @@ function useActionPerformed(postType) {
77
77
  (actionId, items) => {
78
78
  switch (actionId) {
79
79
  case "move-to-trash":
80
+ case "permanently-delete":
80
81
  case "delete-post": {
81
82
  const to = postType && getEntityLink(postType);
82
83
  if (to) {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/canvas/use-navigate-to-entity-record.ts"],
4
- "sourcesContent": ["import { useCallback, useMemo } from '@wordpress/element';\nimport { useDispatch, useRegistry, useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tuseNavigate,\n\tuseSearch,\n\tprivateApis as routePrivateApis,\n} from '@wordpress/route';\nimport { store as bootStore } from '../../store';\nimport { isValidViewport } from './viewport';\nimport { unlock } from '../../lock-unlock';\n\nconst { useCanGoBack, useRouter } = unlock( routePrivateApis );\n\n/*\n * The route tree is assembled from routes registered at runtime, so TanStack has\n * no search schema to infer and types `search` against a placeholder. Describe\n * the two calls this module makes instead.\n */\ntype Navigate = ( options: {\n\tto?: string;\n\treplace?: boolean;\n\tsearch?: (\n\t\tprevious: Record< string, unknown >\n\t) => Record< string, unknown >;\n} ) => void;\n\ninterface NavigateParams {\n\tpostType: string;\n\tpostId: string;\n\tviewport?: string;\n}\n\n/**\n * Builds the editor's entity navigation callbacks.\n *\n * The editor uses these to move between an entity and one nested inside it —\n * a template part or a synced pattern reached from the block inspector. They\n * are passed through the editor settings, where `onNavigateToEntityRecord`\n * gates the inspector's edit affordance and `onNavigateToPreviousEntityRecord`\n * gates the document bar's back button.\n *\n * @return The two callbacks, for spreading into the editor settings.\n */\nexport default function useNavigateToEntityRecord() {\n\tconst navigate = useNavigate() as Navigate;\n\tconst search = useSearch( { strict: false } ) as { focusMode?: unknown };\n\tconst registry = useRegistry();\n\tconst getEntityLink = useSelect(\n\t\t( select ) => select( bootStore ).getEntityLink,\n\t\t[]\n\t);\n\tconst router = useRouter();\n\tconst canGoBack = useCanGoBack();\n\n\tconst onNavigateToEntityRecord = useCallback(\n\t\t( params: NavigateParams ) => {\n\t\t\t/*\n\t\t\t * Stash the block selected in the entity being left, so returning to\n\t\t\t * it can restore the user's place. The edits hold the external\n\t\t\t * client ID, which `onChangeSelection` has already resolved.\n\t\t\t */\n\t\t\tconst currentPostType = (\n\t\t\t\tregistry.select( editorStore ) as any\n\t\t\t ).getCurrentPostType();\n\t\t\tconst currentPostId = (\n\t\t\t\tregistry.select( editorStore ) as any\n\t\t\t ).getCurrentPostId();\n\t\t\tconst edits = registry\n\t\t\t\t.select( coreStore )\n\t\t\t\t.getEntityRecordEdits(\n\t\t\t\t\t'postType',\n\t\t\t\t\tcurrentPostType,\n\t\t\t\t\tcurrentPostId\n\t\t\t\t) as { selection?: { selectionStart?: { clientId?: string } } };\n\t\t\tconst selectedBlock = edits?.selection?.selectionStart?.clientId;\n\n\t\t\tif ( selectedBlock ) {\n\t\t\t\tnavigate( {\n\t\t\t\t\tsearch: ( previous: Record< string, unknown > ) => ( {\n\t\t\t\t\t\t...previous,\n\t\t\t\t\t\tselectedBlock,\n\t\t\t\t\t} ),\n\t\t\t\t\treplace: true,\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\t/*\n\t\t\t * An entity can ask to be edited at a particular width — a\n\t\t\t * navigation overlay meant for mobile. The width is where the entity\n\t\t\t * opens, not something the entity being left carries away: a width\n\t\t\t * set from the device preview is view state, and an entity that asks\n\t\t\t * for none opens at the default.\n\t\t\t */\n\t\t\tconst requestedViewport = params.viewport?.toLowerCase();\n\t\t\tconst hasRequestedViewport = isValidViewport( requestedViewport );\n\n\t\t\t/*\n\t\t\t * `focusMode` marks the entity as one navigated into rather than\n\t\t\t * opened directly, which is what offers the way back out. The search\n\t\t\t * is replaced rather than extended so the block stashed above stays\n\t\t\t * with the entity it belongs to.\n\t\t\t */\n\t\t\tconst to = getEntityLink( params.postType, params.postId );\n\n\t\t\tif ( to ) {\n\t\t\t\tnavigate( {\n\t\t\t\t\tto,\n\t\t\t\t\tsearch: () => ( {\n\t\t\t\t\t\tfocusMode: true,\n\t\t\t\t\t\t...( hasRequestedViewport\n\t\t\t\t\t\t\t? { viewport: requestedViewport }\n\t\t\t\t\t\t\t: {} ),\n\t\t\t\t\t} ),\n\t\t\t\t} );\n\t\t\t}\n\t\t},\n\t\t[ navigate, registry, getEntityLink ]\n\t);\n\n\t/*\n\t * Only entities navigated into offer a way back out. The editor reads this\n\t * as the entity being a focused one, giving it the document bar's back\n\t * button and the surrounding padding, so an entity opened directly — from a\n\t * list, say — must not have it. `canGoBack` covers reloading such a URL,\n\t * where the marker survives but the history to return to does not.\n\t */\n\tconst isFocusMode = !! search.focusMode;\n\tconst onNavigateToPreviousEntityRecord = useMemo(\n\t\t() =>\n\t\t\tisFocusMode && canGoBack ? () => router.history.back() : undefined,\n\t\t[ isFocusMode, canGoBack, router ]\n\t);\n\n\treturn { onNavigateToEntityRecord, onNavigateToPreviousEntityRecord };\n}\n\ninterface ActionItem {\n\tid: string | number;\n\ttype: string;\n\ttitle?: string | { rendered?: string };\n}\n\n/**\n * Builds the callback the editor runs after a post action.\n *\n * Actions taken from inside the editor act on the entity being edited, so\n * trashing or deleting one leaves the canvas showing something that is no\n * longer there, and duplicating one gives no way to reach the copy.\n *\n * @param postType Post type rendered in the canvas.\n * @return The callback, for passing to the editor.\n */\nexport function useActionPerformed( postType?: string ) {\n\tconst navigate = useNavigate() as Navigate;\n\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\tconst getEntityLink = useSelect(\n\t\t( select ) => select( bootStore ).getEntityLink,\n\t\t[]\n\t);\n\n\treturn useCallback(\n\t\t( actionId: string, items: ActionItem[] ) => {\n\t\t\tswitch ( actionId ) {\n\t\t\t\tcase 'move-to-trash':\n\t\t\t\tcase 'delete-post': {\n\t\t\t\t\tconst to = postType && getEntityLink( postType );\n\n\t\t\t\t\tif ( to ) {\n\t\t\t\t\t\tnavigate( { to, search: () => ( {} ) } );\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tcase 'duplicate-post': {\n\t\t\t\t\tconst newItem = items[ 0 ];\n\t\t\t\t\tconst to = getEntityLink( newItem.type, newItem.id );\n\n\t\t\t\t\tif ( ! to ) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst title =\n\t\t\t\t\t\ttypeof newItem.title === 'string'\n\t\t\t\t\t\t\t? newItem.title\n\t\t\t\t\t\t\t: newItem.title?.rendered;\n\n\t\t\t\t\t/*\n\t\t\t\t\t * The action has already announced the copy under this id.\n\t\t\t\t\t * Reissuing it under the same id replaces that notice rather\n\t\t\t\t\t * than stacking a second one, and adds the way to reach it.\n\t\t\t\t\t */\n\t\t\t\t\tcreateSuccessNotice(\n\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t// translators: %s: Title of the created post, e.g: \"Hello world\".\n\t\t\t\t\t\t\t__( '\"%s\" successfully created.' ),\n\t\t\t\t\t\t\tdecodeEntities( title ?? '' ) || __( '(no title)' )\n\t\t\t\t\t\t),\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\tid: 'duplicate-post-action',\n\t\t\t\t\t\t\tactions: [\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tlabel: __( 'Edit' ),\n\t\t\t\t\t\t\t\t\tonClick: () => navigate( { to } ),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t],\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t[ navigate, createSuccessNotice, getEntityLink, postType ]\n\t);\n}\n"],
5
- "mappings": ";AAAA,SAAS,aAAa,eAAe;AACrC,SAAS,aAAa,aAAa,iBAAiB;AACpD,SAAS,SAAS,iBAAiB;AACnC,SAAS,SAAS,mBAAmB;AACrC,SAAS,SAAS,oBAAoB;AACtC,SAAS,sBAAsB;AAC/B,SAAS,IAAI,eAAe;AAC5B;AAAA,EACC;AAAA,EACA;AAAA,EACA,eAAe;AAAA,OACT;AACP,SAAS,SAAS,iBAAiB;AACnC,SAAS,uBAAuB;AAChC,SAAS,cAAc;AAEvB,IAAM,EAAE,cAAc,UAAU,IAAI,OAAQ,gBAAiB;AAgC9C,SAAR,4BAA6C;AACnD,QAAM,WAAW,YAAY;AAC7B,QAAM,SAAS,UAAW,EAAE,QAAQ,MAAM,CAAE;AAC5C,QAAM,WAAW,YAAY;AAC7B,QAAM,gBAAgB;AAAA,IACrB,CAAE,WAAY,OAAQ,SAAU,EAAE;AAAA,IAClC,CAAC;AAAA,EACF;AACA,QAAM,SAAS,UAAU;AACzB,QAAM,YAAY,aAAa;AAE/B,QAAM,2BAA2B;AAAA,IAChC,CAAE,WAA4B;AAM7B,YAAM,kBACL,SAAS,OAA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AAK,YAAY,cAAe,QAAS;AAE/C,cAAK,IAAK;AACT,qBAAU,EAAE,IAAI,QAAQ,OAAQ,CAAC,GAAI,CAAE;AAAA,UACxC;AACA;AAAA,QACD;AAAA,QAEA,KAAK,kBAAkB;AACtB,gBAAM,UAAU,MAAO,CAAE;AACzB,gBAAM,KAAK,cAAe,QAAQ,MAAM,QAAQ,EAAG;AAEnD,cAAK,CAAE,IAAK;AACX;AAAA,UACD;AAEA,gBAAM,QACL,OAAO,QAAQ,UAAU,WACtB,QAAQ,QACR,QAAQ,OAAO;AAOnB;AAAA,YACC;AAAA;AAAA,cAEC,GAAI,4BAA6B;AAAA,cACjC,eAAgB,SAAS,EAAG,KAAK,GAAI,YAAa;AAAA,YACnD;AAAA,YACA;AAAA,cACC,MAAM;AAAA,cACN,IAAI;AAAA,cACJ,SAAS;AAAA,gBACR;AAAA,kBACC,OAAO,GAAI,MAAO;AAAA,kBAClB,SAAS,MAAM,SAAU,EAAE,GAAG,CAAE;AAAA,gBACjC;AAAA,cACD;AAAA,YACD;AAAA,UACD;AACA;AAAA,QACD;AAAA,MACD;AAAA,IACD;AAAA,IACA,CAAE,UAAU,qBAAqB,eAAe,QAAS;AAAA,EAC1D;AACD;",
4
+ "sourcesContent": ["import { useCallback, useMemo } from '@wordpress/element';\nimport { useDispatch, useRegistry, useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tuseNavigate,\n\tuseSearch,\n\tprivateApis as routePrivateApis,\n} from '@wordpress/route';\nimport { store as bootStore } from '../../store';\nimport { isValidViewport } from './viewport';\nimport { unlock } from '../../lock-unlock';\n\nconst { useCanGoBack, useRouter } = unlock( routePrivateApis );\n\n/*\n * The route tree is assembled from routes registered at runtime, so TanStack has\n * no search schema to infer and types `search` against a placeholder. Describe\n * the two calls this module makes instead.\n */\ntype Navigate = ( options: {\n\tto?: string;\n\treplace?: boolean;\n\tsearch?: (\n\t\tprevious: Record< string, unknown >\n\t) => Record< string, unknown >;\n} ) => void;\n\ninterface NavigateParams {\n\tpostType: string;\n\tpostId: string;\n\tviewport?: string;\n}\n\n/**\n * Builds the editor's entity navigation callbacks.\n *\n * The editor uses these to move between an entity and one nested inside it —\n * a template part or a synced pattern reached from the block inspector. They\n * are passed through the editor settings, where `onNavigateToEntityRecord`\n * gates the inspector's edit affordance and `onNavigateToPreviousEntityRecord`\n * gates the document bar's back button.\n *\n * @return The two callbacks, for spreading into the editor settings.\n */\nexport default function useNavigateToEntityRecord() {\n\tconst navigate = useNavigate() as Navigate;\n\tconst search = useSearch( { strict: false } ) as { focusMode?: unknown };\n\tconst registry = useRegistry();\n\tconst getEntityLink = useSelect(\n\t\t( select ) => select( bootStore ).getEntityLink,\n\t\t[]\n\t);\n\tconst router = useRouter();\n\tconst canGoBack = useCanGoBack();\n\n\tconst onNavigateToEntityRecord = useCallback(\n\t\t( params: NavigateParams ) => {\n\t\t\t/*\n\t\t\t * Stash the block selected in the entity being left, so returning to\n\t\t\t * it can restore the user's place. The edits hold the external\n\t\t\t * client ID, which `onChangeSelection` has already resolved.\n\t\t\t */\n\t\t\tconst currentPostType = (\n\t\t\t\tregistry.select( editorStore ) as any\n\t\t\t ).getCurrentPostType();\n\t\t\tconst currentPostId = (\n\t\t\t\tregistry.select( editorStore ) as any\n\t\t\t ).getCurrentPostId();\n\t\t\tconst edits = registry\n\t\t\t\t.select( coreStore )\n\t\t\t\t.getEntityRecordEdits(\n\t\t\t\t\t'postType',\n\t\t\t\t\tcurrentPostType,\n\t\t\t\t\tcurrentPostId\n\t\t\t\t) as { selection?: { selectionStart?: { clientId?: string } } };\n\t\t\tconst selectedBlock = edits?.selection?.selectionStart?.clientId;\n\n\t\t\tif ( selectedBlock ) {\n\t\t\t\tnavigate( {\n\t\t\t\t\tsearch: ( previous: Record< string, unknown > ) => ( {\n\t\t\t\t\t\t...previous,\n\t\t\t\t\t\tselectedBlock,\n\t\t\t\t\t} ),\n\t\t\t\t\treplace: true,\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\t/*\n\t\t\t * An entity can ask to be edited at a particular width — a\n\t\t\t * navigation overlay meant for mobile. The width is where the entity\n\t\t\t * opens, not something the entity being left carries away: a width\n\t\t\t * set from the device preview is view state, and an entity that asks\n\t\t\t * for none opens at the default.\n\t\t\t */\n\t\t\tconst requestedViewport = params.viewport?.toLowerCase();\n\t\t\tconst hasRequestedViewport = isValidViewport( requestedViewport );\n\n\t\t\t/*\n\t\t\t * `focusMode` marks the entity as one navigated into rather than\n\t\t\t * opened directly, which is what offers the way back out. The search\n\t\t\t * is replaced rather than extended so the block stashed above stays\n\t\t\t * with the entity it belongs to.\n\t\t\t */\n\t\t\tconst to = getEntityLink( params.postType, params.postId );\n\n\t\t\tif ( to ) {\n\t\t\t\tnavigate( {\n\t\t\t\t\tto,\n\t\t\t\t\tsearch: () => ( {\n\t\t\t\t\t\tfocusMode: true,\n\t\t\t\t\t\t...( hasRequestedViewport\n\t\t\t\t\t\t\t? { viewport: requestedViewport }\n\t\t\t\t\t\t\t: {} ),\n\t\t\t\t\t} ),\n\t\t\t\t} );\n\t\t\t}\n\t\t},\n\t\t[ navigate, registry, getEntityLink ]\n\t);\n\n\t/*\n\t * Only entities navigated into offer a way back out. The editor reads this\n\t * as the entity being a focused one, giving it the document bar's back\n\t * button and the surrounding padding, so an entity opened directly — from a\n\t * list, say — must not have it. `canGoBack` covers reloading such a URL,\n\t * where the marker survives but the history to return to does not.\n\t */\n\tconst isFocusMode = !! search.focusMode;\n\tconst onNavigateToPreviousEntityRecord = useMemo(\n\t\t() =>\n\t\t\tisFocusMode && canGoBack ? () => router.history.back() : undefined,\n\t\t[ isFocusMode, canGoBack, router ]\n\t);\n\n\treturn { onNavigateToEntityRecord, onNavigateToPreviousEntityRecord };\n}\n\ninterface ActionItem {\n\tid: string | number;\n\ttype: string;\n\ttitle?: string | { rendered?: string };\n}\n\n/**\n * Builds the callback the editor runs after a post action.\n *\n * Actions taken from inside the editor act on the entity being edited, so\n * trashing or deleting one leaves the canvas showing something that is no\n * longer there, and duplicating one gives no way to reach the copy.\n *\n * @param postType Post type rendered in the canvas.\n * @return The callback, for passing to the editor.\n */\nexport function useActionPerformed( postType?: string ) {\n\tconst navigate = useNavigate() as Navigate;\n\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\tconst getEntityLink = useSelect(\n\t\t( select ) => select( bootStore ).getEntityLink,\n\t\t[]\n\t);\n\n\treturn useCallback(\n\t\t( actionId: string, items: ActionItem[] ) => {\n\t\t\tswitch ( actionId ) {\n\t\t\t\tcase 'move-to-trash':\n\t\t\t\tcase 'permanently-delete':\n\t\t\t\tcase 'delete-post': {\n\t\t\t\t\tconst to = postType && getEntityLink( postType );\n\n\t\t\t\t\tif ( to ) {\n\t\t\t\t\t\tnavigate( { to, search: () => ( {} ) } );\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tcase 'duplicate-post': {\n\t\t\t\t\tconst newItem = items[ 0 ];\n\t\t\t\t\tconst to = getEntityLink( newItem.type, newItem.id );\n\n\t\t\t\t\tif ( ! to ) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst title =\n\t\t\t\t\t\ttypeof newItem.title === 'string'\n\t\t\t\t\t\t\t? newItem.title\n\t\t\t\t\t\t\t: newItem.title?.rendered;\n\n\t\t\t\t\t/*\n\t\t\t\t\t * The action has already announced the copy under this id.\n\t\t\t\t\t * Reissuing it under the same id replaces that notice rather\n\t\t\t\t\t * than stacking a second one, and adds the way to reach it.\n\t\t\t\t\t */\n\t\t\t\t\tcreateSuccessNotice(\n\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t// translators: %s: Title of the created post, e.g: \"Hello world\".\n\t\t\t\t\t\t\t__( '\"%s\" successfully created.' ),\n\t\t\t\t\t\t\tdecodeEntities( title ?? '' ) || __( '(no title)' )\n\t\t\t\t\t\t),\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\tid: 'duplicate-post-action',\n\t\t\t\t\t\t\tactions: [\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tlabel: __( 'Edit' ),\n\t\t\t\t\t\t\t\t\tonClick: () => navigate( { to } ),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t],\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t[ navigate, createSuccessNotice, getEntityLink, postType ]\n\t);\n}\n"],
5
+ "mappings": ";AAAA,SAAS,aAAa,eAAe;AACrC,SAAS,aAAa,aAAa,iBAAiB;AACpD,SAAS,SAAS,iBAAiB;AACnC,SAAS,SAAS,mBAAmB;AACrC,SAAS,SAAS,oBAAoB;AACtC,SAAS,sBAAsB;AAC/B,SAAS,IAAI,eAAe;AAC5B;AAAA,EACC;AAAA,EACA;AAAA,EACA,eAAe;AAAA,OACT;AACP,SAAS,SAAS,iBAAiB;AACnC,SAAS,uBAAuB;AAChC,SAAS,cAAc;AAEvB,IAAM,EAAE,cAAc,UAAU,IAAI,OAAQ,gBAAiB;AAgC9C,SAAR,4BAA6C;AACnD,QAAM,WAAW,YAAY;AAC7B,QAAM,SAAS,UAAW,EAAE,QAAQ,MAAM,CAAE;AAC5C,QAAM,WAAW,YAAY;AAC7B,QAAM,gBAAgB;AAAA,IACrB,CAAE,WAAY,OAAQ,SAAU,EAAE;AAAA,IAClC,CAAC;AAAA,EACF;AACA,QAAM,SAAS,UAAU;AACzB,QAAM,YAAY,aAAa;AAE/B,QAAM,2BAA2B;AAAA,IAChC,CAAE,WAA4B;AAM7B,YAAM,kBACL,SAAS,OAAQ,WAAY,EAC3B,mBAAmB;AACtB,YAAM,gBACL,SAAS,OAAQ,WAAY,EAC3B,iB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AAE,IAAI,QAAQ,OAAQ,CAAC,GAAI,CAAE;AAAA,UACxC;AACA;AAAA,QACD;AAAA,QAEA,KAAK,kBAAkB;AACtB,gBAAM,UAAU,MAAO,CAAE;AACzB,gBAAM,KAAK,cAAe,QAAQ,MAAM,QAAQ,EAAG;AAEnD,cAAK,CAAE,IAAK;AACX;AAAA,UACD;AAEA,gBAAM,QACL,OAAO,QAAQ,UAAU,WACtB,QAAQ,QACR,QAAQ,OAAO;AAOnB;AAAA,YACC;AAAA;AAAA,cAEC,GAAI,4BAA6B;AAAA,cACjC,eAAgB,SAAS,EAAG,KAAK,GAAI,YAAa;AAAA,YACnD;AAAA,YACA;AAAA,cACC,MAAM;AAAA,cACN,IAAI;AAAA,cACJ,SAAS;AAAA,gBACR;AAAA,kBACC,OAAO,GAAI,MAAO;AAAA,kBAClB,SAAS,MAAM,SAAU,EAAE,GAAG,CAAE;AAAA,gBACjC;AAAA,cACD;AAAA,YACD;AAAA,UACD;AACA;AAAA,QACD;AAAA,MACD;AAAA,IACD;AAAA,IACA,CAAE,UAAU,qBAAqB,eAAe,QAAS;AAAA,EAC1D;AACD;",
6
6
  "names": []
7
7
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/canvas/index.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAQpD,UAAU,WAAW;IACpB,MAAM,EAAE,UAAU,CAAC;CACnB;AAED;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,MAAM,CAAE,EAAE,MAAM,EAAE,EAAE,WAAW,+BAgLtD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/canvas/index.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAQpD,UAAU,WAAW;IACpB,MAAM,EAAE,UAAU,CAAC;CACnB;AAED;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,MAAM,CAAE,EAAE,MAAM,EAAE,EAAE,WAAW,+BA+KtD"}
@@ -1 +1 @@
1
- {"version":3,"file":"use-navigate-to-entity-record.d.ts","sourceRoot":"","sources":["../../../src/components/canvas/use-navigate-to-entity-record.ts"],"names":[],"mappings":"AA+BA,UAAU,cAAc;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;;;GAUG;AACH,MAAM,CAAC,OAAO,UAAU,yBAAyB;uCAYrC,cAAc;;EA+EzB;AAED,UAAU,UAAU;IACnB,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,GAAG;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CACvC;AAED;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAAE,QAAQ,CAAC,EAAE,MAAM,cASvC,MAAM,SAAS,UAAU,EAAE,UAqDxC"}
1
+ {"version":3,"file":"use-navigate-to-entity-record.d.ts","sourceRoot":"","sources":["../../../src/components/canvas/use-navigate-to-entity-record.ts"],"names":[],"mappings":"AA+BA,UAAU,cAAc;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;;;GAUG;AACH,MAAM,CAAC,OAAO,UAAU,yBAAyB;uCAYrC,cAAc;;EA+EzB;AAED,UAAU,UAAU;IACnB,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,GAAG;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CACvC;AAED;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAAE,QAAQ,CAAC,EAAE,MAAM,cASvC,MAAM,SAAS,UAAU,EAAE,UAsDxC"}
@@ -16,7 +16,7 @@ interface State {
16
16
  export default class ErrorBoundary extends Component<Props, State> {
17
17
  constructor(props: Props);
18
18
  static getDerivedStateFromError(error: Error): State;
19
- render(): string | number | boolean | import("react").JSX.Element | Iterable<ReactNode> | null | undefined;
19
+ render(): string | number | bigint | boolean | import("react").JSX.Element | Iterable<ReactNode> | Promise<string | number | bigint | boolean | Iterable<ReactNode> | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | import("react").ReactPortal | null | undefined> | null | undefined;
20
20
  }
21
21
  export {};
22
22
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/error-boundary/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAQ/C,UAAU,KAAK;IACd,QAAQ,EAAE,SAAS,CAAC;CACpB;AAED,UAAU,KAAK;IACd,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;CACpB;AAYD;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,SAAS,CAAE,KAAK,EAAE,KAAK,CAAE;IACnE,YAAa,KAAK,EAAE,KAAK,EAGxB;IAED,MAAM,CAAC,wBAAwB,CAAE,KAAK,EAAE,KAAK,GAAI,KAAK,CAErD;IAED,MAAM,qGAyBL;CACD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/error-boundary/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAQ/C,UAAU,KAAK;IACd,QAAQ,EAAE,SAAS,CAAC;CACpB;AAED,UAAU,KAAK;IACd,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;CACpB;AAYD;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,SAAS,CAAE,KAAK,EAAE,KAAK,CAAE;IACnE,YAAa,KAAK,EAAE,KAAK,EAGxB;IAED,MAAM,CAAC,wBAAwB,CAAE,KAAK,EAAE,KAAK,GAAI,KAAK,CAErD;IAED,MAAM,gUAyBL;CACD"}
@@ -9,5 +9,5 @@ import type { IconType } from '../../store/types';
9
9
  * @param shouldShowPlaceholder - Whether to show placeholder when no icon is provided
10
10
  * @return The converted icon as a JSX element
11
11
  */
12
- export declare function wrapIcon(icon?: IconType, shouldShowPlaceholder?: boolean): string | number | true | import("react").JSX.Element | Iterable<import("react").ReactNode> | null;
12
+ export declare function wrapIcon(icon?: IconType, shouldShowPlaceholder?: boolean): string | number | bigint | true | import("react").JSX.Element | Iterable<import("react").ReactNode> | Promise<string | number | bigint | boolean | Iterable<import("react").ReactNode> | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | import("react").ReactPortal | null | undefined> | null;
13
13
  //# sourceMappingURL=items.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"items.d.ts","sourceRoot":"","sources":["../../../src/components/navigation/items.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAelD;;;;;;;;;GASG;AACH,wBAAgB,QAAQ,CACvB,IAAI,CAAC,EAAE,QAAQ,EACf,qBAAqB,GAAE,OAAc,qGAuDrC"}
1
+ {"version":3,"file":"items.d.ts","sourceRoot":"","sources":["../../../src/components/navigation/items.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAelD;;;;;;;;;GASG;AACH,wBAAgB,QAAQ,CACvB,IAAI,CAAC,EAAE,QAAQ,EACf,qBAAqB,GAAE,OAAc,gVAuDrC"}
@@ -9,5 +9,5 @@
9
9
  *
10
10
  * @return Ref to attach to the layout root element.
11
11
  */
12
- export default function useSyncBodyBackground(): import("react").MutableRefObject<HTMLDivElement | null>;
12
+ export default function useSyncBodyBackground(): import("react").RefObject<HTMLDivElement | null>;
13
13
  //# sourceMappingURL=use-sync-body-background.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-sync-body-background.d.ts","sourceRoot":"","sources":["../../../src/components/root/use-sync-body-background.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;GAUG;AACH,MAAM,CAAC,OAAO,UAAU,qBAAqB,4DAuB5C"}
1
+ {"version":3,"file":"use-sync-body-background.d.ts","sourceRoot":"","sources":["../../../src/components/root/use-sync-body-background.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;GAUG;AACH,MAAM,CAAC,OAAO,UAAU,qBAAqB,qDAuB5C"}
@@ -3,7 +3,7 @@ import type { ReactNode, ComponentType } from 'react';
3
3
  * Icon type supporting multiple formats:
4
4
  * - Dashicon strings (e.g., "dashicons-admin-generic")
5
5
  * - JSX elements
6
- * - SVG icons from @wordpress/icons
6
+ * - SVG icons from `@wordpress/icons`
7
7
  * - Data URLs for images
8
8
  */
9
9
  export type IconType = string | React.JSX.Element | ReactNode;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/boot",
3
- "version": "0.23.0",
3
+ "version": "0.25.0",
4
4
  "description": "Minimal boot package for WordPress admin pages.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -19,14 +19,13 @@
19
19
  "url": "https://github.com/WordPress/gutenberg/issues"
20
20
  },
21
21
  "engines": {
22
- "node": ">=18.12.0"
22
+ "node": ">=22.13.0"
23
23
  },
24
24
  "files": [
25
25
  "src",
26
26
  "build-module",
27
27
  "build-style",
28
- "build-types",
29
- "*.md"
28
+ "build-types"
30
29
  ],
31
30
  "module": "build-module/index.mjs",
32
31
  "exports": {
@@ -39,31 +38,32 @@
39
38
  "wpScriptModuleExports": "./build-module/index.mjs",
40
39
  "types": "build-types",
41
40
  "dependencies": {
42
- "@wordpress/a11y": "^4.56.0",
43
- "@wordpress/admin-ui": "^2.11.0",
44
- "@wordpress/base-styles": "^13.2.0",
45
- "@wordpress/components": "^41.0.0",
46
- "@wordpress/compose": "^8.9.0",
47
- "@wordpress/core-data": "^8.1.0",
48
- "@wordpress/data": "^10.56.0",
49
- "@wordpress/dom": "^4.56.0",
50
- "@wordpress/editor": "^15.1.0",
51
- "@wordpress/element": "^8.8.0",
52
- "@wordpress/html-entities": "^4.56.0",
53
- "@wordpress/i18n": "^6.29.0",
54
- "@wordpress/icons": "^17.0.0",
55
- "@wordpress/keyboard-shortcuts": "^5.56.0",
56
- "@wordpress/keycodes": "^4.56.0",
57
- "@wordpress/lazy-editor": "^1.22.0",
58
- "@wordpress/notices": "^5.56.0",
59
- "@wordpress/plugins": "^7.56.0",
60
- "@wordpress/primitives": "^4.56.0",
61
- "@wordpress/private-apis": "^1.56.0",
62
- "@wordpress/route": "^0.22.0",
63
- "@wordpress/style-runtime": "^0.12.0",
64
- "@wordpress/theme": "^2.2.0",
65
- "@wordpress/ui": "^0.23.0",
66
- "@wordpress/url": "^4.56.0",
41
+ "@wordpress/a11y": "^5.0.0",
42
+ "@wordpress/admin-ui": "^3.0.0",
43
+ "@wordpress/base-styles": "^14.0.0",
44
+ "@wordpress/components": "^43.0.0",
45
+ "@wordpress/compose": "^9.0.0",
46
+ "@wordpress/core-data": "^9.0.0",
47
+ "@wordpress/data": "^11.0.0",
48
+ "@wordpress/dom": "^5.0.0",
49
+ "@wordpress/editor": "^16.0.0",
50
+ "@wordpress/element": "^10.0.0",
51
+ "@wordpress/html-entities": "^5.0.0",
52
+ "@wordpress/i18n": "^7.0.0",
53
+ "@wordpress/icons": "^19.0.0",
54
+ "@wordpress/keyboard-shortcuts": "^6.0.0",
55
+ "@wordpress/keycodes": "^5.0.0",
56
+ "@wordpress/lazy-editor": "^2.0.0",
57
+ "@wordpress/notices": "^6.0.0",
58
+ "@wordpress/plugins": "^8.0.0",
59
+ "@wordpress/primitives": "^5.0.0",
60
+ "@wordpress/private-apis": "^3.0.0",
61
+ "@wordpress/react-inert-value": "^2.0.0",
62
+ "@wordpress/route": "^0.24.0",
63
+ "@wordpress/style-runtime": "^0.14.0",
64
+ "@wordpress/theme": "^3.0.0",
65
+ "@wordpress/ui": "^0.25.0",
66
+ "@wordpress/url": "^5.0.0",
67
67
  "clsx": "^2.1.1"
68
68
  },
69
69
  "peerDependencies": {
@@ -79,5 +79,5 @@
79
79
  "publishConfig": {
80
80
  "access": "public"
81
81
  },
82
- "gitHead": "56d8058eda6e30c4cc8bfc37818fa6ed972f7dc2"
82
+ "gitHead": "8d30f92cbbde3ddf781c8799443c649befbbcb88"
83
83
  }
@@ -1,7 +1,8 @@
1
1
  import { useState, useEffect, useMemo } from '@wordpress/element';
2
- import { Spinner } from '@wordpress/components';
2
+ import { Spinner as WCSpinner } from '@wordpress/components';
3
3
  import { useNavigate, useSearch } from '@wordpress/route';
4
4
  import { __ } from '@wordpress/i18n';
5
+ import { inertValue } from '@wordpress/react-inert-value';
5
6
  import { useSelect } from '@wordpress/data';
6
7
  import { store as coreStore } from '@wordpress/core-data';
7
8
  import { store as bootStore } from '../../store';
@@ -139,7 +140,7 @@ export default function Canvas( { canvas }: CanvasProps ) {
139
140
  padding: '2rem',
140
141
  } }
141
142
  >
142
- <Spinner />
143
+ <WCSpinner />
143
144
  </div>
144
145
  );
145
146
  }
@@ -157,8 +158,7 @@ export default function Canvas( { canvas }: CanvasProps ) {
157
158
  <div style={ { height: '100%', position: 'relative' } }>
158
159
  <div
159
160
  style={ { height: '100%' } }
160
- // @ts-expect-error inert not typed properly
161
- inert={ canvas.isPreview ? 'true' : undefined }
161
+ inert={ inertValue( canvas.isPreview ) }
162
162
  >
163
163
  <Editor
164
164
  postType={ canvas.postType }
@@ -167,6 +167,7 @@ export function useActionPerformed( postType?: string ) {
167
167
  ( actionId: string, items: ActionItem[] ) => {
168
168
  switch ( actionId ) {
169
169
  case 'move-to-trash':
170
+ case 'permanently-delete':
170
171
  case 'delete-post': {
171
172
  const to = postType && getEntityLink( postType );
172
173
 
@@ -4,7 +4,7 @@ import type { ReactNode, ComponentType } from 'react';
4
4
  * Icon type supporting multiple formats:
5
5
  * - Dashicon strings (e.g., "dashicons-admin-generic")
6
6
  * - JSX elements
7
- * - SVG icons from @wordpress/icons
7
+ * - SVG icons from `@wordpress/icons`
8
8
  * - Data URLs for images
9
9
  */
10
10
  export type IconType = string | React.JSX.Element | ReactNode;
package/CHANGELOG.md DELETED
@@ -1,75 +0,0 @@
1
- <!-- Learn how to maintain this file at https://github.com/WordPress/gutenberg/tree/HEAD/packages#maintaining-changelogs. -->
2
-
3
- ## Unreleased
4
-
5
- ## 0.23.0 (2026-09-23)
6
-
7
- ## 0.22.0 (2026-09-10)
8
-
9
- ### Internal
10
-
11
- - Remove unused dependency `@wordpress/commands` ([#82103](https://github.com/WordPress/gutenberg/pull/82103)).
12
-
13
- ## 0.21.0 (2026-08-26)
14
-
15
- ### Bug Fixes
16
-
17
- - Seed content-surface `ThemeProvider` backgrounds with `#fcfcfc` instead of `#ffffff`, matching the design system default and preserving room for stronger and weaker neutral surface tokens ([#81646](https://github.com/WordPress/gutenberg/pull/81646)).
18
- - Restore bottom-centered snackbar notices after the CSS Modules migration ([#81995](https://github.com/WordPress/gutenberg/pull/81995)).
19
- - Mount the plugins registered with `registerPlugin`, so the sidebars, panels and menu items they fill render ([#81754](https://github.com/WordPress/gutenberg/pull/81754)).
20
- - Canvas: Show the site's front end where a route names no entity and the theme has no block templates to resolve one from, instead of an editor with nothing open. Was previously handled by the home route alone, leaving `/identity` broken on a classic theme ([#81749](https://github.com/WordPress/gutenberg/pull/81749)).
21
- - Canvas: Open an entity at the width its `viewport` param asks for through the editor provider, so the width comes from the theme's breakpoints rather than the defaults ([#81750](https://github.com/WordPress/gutenberg/pull/81750)).
22
- - Canvas: Stop writing the current width into the `viewport` search param when leaving an entity. The param says where an entity opens; a width set from the device preview is view state and no longer follows the user between entities ([#81750](https://github.com/WordPress/gutenberg/pull/81750)).
23
- - Canvas: Do not offer to edit a trashed entity from its preview ([#81632](https://github.com/WordPress/gutenberg/pull/81632)).
24
- - Translate the click-to-edit label on a previewed canvas, and name the action rather than the gesture ([#81620](https://github.com/WordPress/gutenberg/pull/81620)).
25
-
26
- ### Enhancements
27
-
28
- - Save button: Use the shared UI keyboard shortcut utilities for its tooltip and accessibility metadata. ([#81826](https://github.com/WordPress/gutenberg/pull/81826))
29
- - Contain a failure to the surface it happened in, so a stage, inspector or canvas that throws leaves the rest of the screen working ([#81622](https://github.com/WordPress/gutenberg/pull/81622)).
30
- - Warn before leaving the page with unsaved changes ([#81625](https://github.com/WordPress/gutenberg/pull/81625)).
31
- - Open an entity at the width its `viewport` search param asks for, so a navigation overlay meant for mobile is edited at mobile width ([#81617](https://github.com/WordPress/gutenberg/pull/81617)).
32
- - Add a `stage` visibility function to a route's config, mirroring `inspector`, so a route can hide its stage and leave the canvas to fill the surfaces area.
33
- - Pass the editor's entity navigation callbacks from the canvas, so a template part or synced pattern can be opened from the block inspector and navigated back out of, restoring the block that was selected ([#81590](https://github.com/WordPress/gutenberg/pull/81590)).
34
- - Add `registerEntityLinks` and `getEntityLink`, so an application declares where each post type is listed and edited and the canvas resolves every link through them ([#81590](https://github.com/WordPress/gutenberg/pull/81590)).
35
- - Run the editor's post actions from the canvas, returning to the list when an entity is trashed or deleted and offering a way to reach a duplicate ([#81590](https://github.com/WordPress/gutenberg/pull/81590)).
36
-
37
- ### Breaking Changes
38
-
39
- - Remove `editLink` from a route's canvas data. Register the post type's `edit` path with `registerEntityLinks` instead ([#81590](https://github.com/WordPress/gutenberg/pull/81590)).
40
-
41
- ### Internal
42
-
43
- - Migrate Boot styles to CSS Modules and encapsulate its internal DOM classes ([#81756](https://github.com/WordPress/gutenberg/pull/81756)).
44
-
45
- ## 0.20.0 (2026-08-12)
46
-
47
- ### Bug Fixes
48
-
49
- - Adjust the specificity of the responsive image default in the layout container so components can size their own images ([#80845](https://github.com/WordPress/gutenberg/pull/80845)).
50
- - Ignore `updateMenuItem` for menu items that were never registered, instead of adding a partial entry that renders as an empty navigation row ([#81581](https://github.com/WordPress/gutenberg/pull/81581)).
51
-
52
- ## 0.19.0 (2026-07-29)
53
-
54
- ## 0.18.0 (2026-07-14)
55
-
56
- ### Enhancements
57
-
58
- - Use the emphasis font-weight token for UI emphasis ([#80093](https://github.com/WordPress/gutenberg/pull/80093)).
59
- - Widen React peer dependency ranges to `^18 || ^19` to support both React 18 and React 19 environments ([#80024](https://github.com/WordPress/gutenberg/pull/80024)).
60
-
61
- ## 0.17.0 (2026-07-01)
62
-
63
- ## 0.16.0 (2026-06-24)
64
-
65
- ### Enhancements
66
-
67
- - `initSinglePage` now accepts an `initModules` option and runs page init modules before rendering, matching `init`.
68
-
69
- ## 0.15.1 (2026-06-16)
70
-
71
- ## 0.15.0 (2026-06-10)
72
-
73
- ### Code Quality
74
-
75
- - Add missing `@types/react` dependency. [#78882](https://github.com/WordPress/gutenberg/pull/78882).