@wordpress/boot 0.25.0 → 0.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build-module/components/app/index.mjs +29 -53
- package/build-module/components/app/index.mjs.map +1 -7
- package/build-module/components/app/router.mjs +238 -214
- package/build-module/components/app/router.mjs.map +1 -7
- package/build-module/components/app/use-route-title.mjs +35 -42
- package/build-module/components/app/use-route-title.mjs.map +1 -7
- package/build-module/components/canvas/back-button.mjs +21 -20
- package/build-module/components/canvas/back-button.mjs.map +1 -7
- package/build-module/components/canvas/index.mjs +104 -130
- package/build-module/components/canvas/index.mjs.map +1 -7
- package/build-module/components/canvas/site-preview.mjs +36 -43
- package/build-module/components/canvas/site-preview.mjs.map +1 -7
- package/build-module/components/canvas/use-navigate-to-entity-record.mjs +109 -113
- package/build-module/components/canvas/use-navigate-to-entity-record.mjs.map +1 -7
- package/build-module/components/canvas/viewport.mjs +25 -13
- package/build-module/components/canvas/viewport.mjs.map +1 -7
- package/build-module/components/canvas-renderer/index.mjs +40 -32
- package/build-module/components/canvas-renderer/index.mjs.map +1 -7
- package/build-module/components/error-boundary/index.mjs +161 -109
- package/build-module/components/error-boundary/index.mjs.map +1 -7
- package/build-module/components/navigation/drilldown-item/index.mjs +124 -127
- package/build-module/components/navigation/drilldown-item/index.mjs.map +1 -7
- package/build-module/components/navigation/dropdown-item/index.mjs +156 -173
- package/build-module/components/navigation/dropdown-item/index.mjs.map +1 -7
- package/build-module/components/navigation/index.mjs +55 -90
- package/build-module/components/navigation/index.mjs.map +1 -7
- package/build-module/components/navigation/items.mjs +51 -53
- package/build-module/components/navigation/items.mjs.map +1 -7
- package/build-module/components/navigation/navigation-item/index.mjs +120 -114
- package/build-module/components/navigation/navigation-item/index.mjs.map +1 -7
- package/build-module/components/navigation/navigation-screen/index.mjs +192 -185
- package/build-module/components/navigation/navigation-screen/index.mjs.map +1 -7
- package/build-module/components/navigation/path-matching.mjs +74 -73
- package/build-module/components/navigation/path-matching.mjs.map +1 -7
- package/build-module/components/navigation/router-link-item.mjs +13 -11
- package/build-module/components/navigation/router-link-item.mjs.map +1 -7
- package/build-module/components/navigation/use-sidebar-parent.mjs +37 -48
- package/build-module/components/navigation/use-sidebar-parent.mjs.map +1 -7
- package/build-module/components/plugin-area/index.mjs +20 -24
- package/build-module/components/plugin-area/index.mjs.map +1 -7
- package/build-module/components/root/index.mjs +228 -243
- package/build-module/components/root/index.mjs.map +1 -7
- package/build-module/components/root/single-page.mjs +174 -148
- package/build-module/components/root/single-page.mjs.map +1 -7
- package/build-module/components/root/use-sync-body-background.mjs +28 -22
- package/build-module/components/root/use-sync-body-background.mjs.map +1 -7
- package/build-module/components/save-button/index.mjs +170 -214
- package/build-module/components/save-button/index.mjs.map +1 -7
- package/build-module/components/save-panel/index.mjs +110 -106
- package/build-module/components/save-panel/index.mjs.map +1 -7
- package/build-module/components/save-panel/use-save-shortcut.mjs +42 -51
- package/build-module/components/save-panel/use-save-shortcut.mjs.map +1 -7
- package/build-module/components/sidebar/index.mjs +126 -104
- package/build-module/components/sidebar/index.mjs.map +1 -7
- package/build-module/index.mjs +1 -7
- package/build-module/lock-unlock.mjs +5 -10
- package/build-module/lock-unlock.mjs.map +1 -7
- package/build-module/store/actions.mjs +34 -31
- package/build-module/store/actions.mjs.map +1 -7
- package/build-module/store/index.mjs +9 -11
- package/build-module/store/index.mjs.map +1 -7
- package/build-module/store/reducer.mjs +48 -55
- package/build-module/store/reducer.mjs.map +1 -7
- package/build-module/store/selectors.mjs +21 -16
- package/build-module/store/selectors.mjs.map +1 -7
- package/build-module/store/types.mjs +0 -1
- package/build-types/components/error-boundary/index.d.ts.map +1 -1
- package/build-types/components/root/index.d.ts.map +1 -1
- package/package.json +28 -28
- package/src/components/error-boundary/index.tsx +52 -6
- package/src/components/navigation/navigation-screen/index.tsx +2 -2
- package/src/components/root/_layout.module.scss +1 -1
- package/src/components/root/index.tsx +7 -3
- package/build-module/index.mjs.map +0 -7
- package/build-module/store/types.mjs.map +0 -7
|
@@ -1,50 +1,43 @@
|
|
|
1
|
-
// packages/boot/src/components/canvas/site-preview.tsx
|
|
2
1
|
import { __ } from "@wordpress/i18n";
|
|
3
2
|
import { useSelect } from "@wordpress/data";
|
|
4
|
-
import { store
|
|
3
|
+
import { store } from "@wordpress/core-data";
|
|
5
4
|
import { focus } from "@wordpress/dom";
|
|
6
5
|
import { addQueryArgs } from "@wordpress/url";
|
|
7
6
|
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
// packages/boot/src/components/canvas/site-preview.tsx
|
|
8
|
+
/**
|
|
9
|
+
* Renders the site's front end in an iframe.
|
|
10
|
+
*
|
|
11
|
+
* Shown where the canvas has no entity to edit, so that a route still says
|
|
12
|
+
* something about the site it is configuring.
|
|
13
|
+
*
|
|
14
|
+
* @return The preview, or nothing until the site's address is known.
|
|
15
|
+
*/
|
|
8
16
|
function SitePreview() {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
},
|
|
33
|
-
onLoad: (event) => {
|
|
34
|
-
const iframeDocument = event.target.contentDocument;
|
|
35
|
-
if (!iframeDocument) {
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
focus.focusable.find(iframeDocument.documentElement).forEach((element) => {
|
|
39
|
-
element.style.pointerEvents = "none";
|
|
40
|
-
element.tabIndex = -1;
|
|
41
|
-
element.setAttribute("aria-hidden", "true");
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
);
|
|
17
|
+
const siteUrl = useSelect((select) => {
|
|
18
|
+
return select(store).getEntityRecord("root", "__unstableBase")?.home;
|
|
19
|
+
}, []);
|
|
20
|
+
if (typeof siteUrl !== "string" || !siteUrl) return null;
|
|
21
|
+
return /* @__PURE__ */ jsx("iframe", {
|
|
22
|
+
src: addQueryArgs(siteUrl, { wp_site_preview: 1 }),
|
|
23
|
+
title: __("Site Preview"),
|
|
24
|
+
style: {
|
|
25
|
+
display: "block",
|
|
26
|
+
width: "100%",
|
|
27
|
+
height: "100%",
|
|
28
|
+
backgroundColor: "#fff"
|
|
29
|
+
},
|
|
30
|
+
onLoad: (event) => {
|
|
31
|
+
const iframeDocument = event.target.contentDocument;
|
|
32
|
+
if (!iframeDocument) return;
|
|
33
|
+
focus.focusable.find(iframeDocument.documentElement).forEach((element) => {
|
|
34
|
+
element.style.pointerEvents = "none";
|
|
35
|
+
element.tabIndex = -1;
|
|
36
|
+
element.setAttribute("aria-hidden", "true");
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
});
|
|
46
40
|
}
|
|
47
|
-
export {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
//# sourceMappingURL=site-preview.mjs.map
|
|
41
|
+
export { SitePreview as default };
|
|
42
|
+
|
|
43
|
+
//# sourceMappingURL=site-preview.mjs.map
|
|
@@ -1,7 +1 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/components/canvas/site-preview.tsx"],
|
|
4
|
-
"sourcesContent": ["import { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { focus } from '@wordpress/dom';\nimport { addQueryArgs } from '@wordpress/url';\n\n/**\n * Renders the site's front end in an iframe.\n *\n * Shown where the canvas has no entity to edit, so that a route still says\n * something about the site it is configuring.\n *\n * @return The preview, or nothing until the site's address is known.\n */\nexport default function SitePreview() {\n\tconst siteUrl = useSelect( ( select ) => {\n\t\tconst siteData = select( coreStore ).getEntityRecord(\n\t\t\t'root',\n\t\t\t'__unstableBase'\n\t\t) as { home?: unknown } | undefined;\n\t\treturn siteData?.home;\n\t}, [] );\n\n\t// `home` comes from the REST index. Without a usable URL the iframe would\n\t// resolve its `src` against the current admin page and embed that instead,\n\t// so render nothing until there is one.\n\tif ( typeof siteUrl !== 'string' || ! siteUrl ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<iframe\n\t\t\tsrc={ addQueryArgs( siteUrl, {\n\t\t\t\t// Parameter for hiding the admin bar.\n\t\t\t\twp_site_preview: 1,\n\t\t\t} ) }\n\t\t\ttitle={ __( 'Site Preview' ) }\n\t\t\tstyle={ {\n\t\t\t\tdisplay: 'block',\n\t\t\t\twidth: '100%',\n\t\t\t\theight: '100%',\n\t\t\t\tbackgroundColor: '#fff',\n\t\t\t} }\n\t\t\tonLoad={ ( event ) => {\n\t\t\t\tconst iframeDocument = ( event.target as HTMLIFrameElement )\n\t\t\t\t\t.contentDocument;\n\n\t\t\t\t// Not readable when the site is served from another origin.\n\t\t\t\tif ( ! iframeDocument ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Make interactive elements unclickable.\n\t\t\t\tfocus.focusable\n\t\t\t\t\t.find( iframeDocument.documentElement )\n\t\t\t\t\t.forEach( ( element ) => {\n\t\t\t\t\t\telement.style.pointerEvents = 'none';\n\t\t\t\t\t\telement.tabIndex = -1;\n\t\t\t\t\t\telement.setAttribute( 'aria-hidden', 'true' );\n\t\t\t\t\t} );\n\t\t\t} }\n\t\t/>\n\t);\n}\n"],
|
|
5
|
-
"mappings": ";AAAA,SAAS,UAAU;AACnB,SAAS,iBAAiB;AAC1B,SAAS,SAAS,iBAAiB;AACnC,SAAS,aAAa;AACtB,SAAS,oBAAoB;AA2B3B;AAjBa,SAAR,cAA+B;AACrC,QAAM,UAAU,UAAW,CAAE,WAAY;AACxC,UAAM,WAAW,OAAQ,SAAU,EAAE;AAAA,MACpC;AAAA,MACA;AAAA,IACD;AACA,WAAO,UAAU;AAAA,EAClB,GAAG,CAAC,CAAE;AAKN,MAAK,OAAO,YAAY,YAAY,CAAE,SAAU;AAC/C,WAAO;AAAA,EACR;AAEA,SACC;AAAA,IAAC;AAAA;AAAA,MACA,KAAM,aAAc,SAAS;AAAA;AAAA,QAE5B,iBAAiB;AAAA,MAClB,CAAE;AAAA,MACF,OAAQ,GAAI,cAAe;AAAA,MAC3B,OAAQ;AAAA,QACP,SAAS;AAAA,QACT,OAAO;AAAA,QACP,QAAQ;AAAA,QACR,iBAAiB;AAAA,MAClB;AAAA,MACA,QAAS,CAAE,UAAW;AACrB,cAAM,iBAAmB,MAAM,OAC7B;AAGF,YAAK,CAAE,gBAAiB;AACvB;AAAA,QACD;AAGA,cAAM,UACJ,KAAM,eAAe,eAAgB,EACrC,QAAS,CAAE,YAAa;AACxB,kBAAQ,MAAM,gBAAgB;AAC9B,kBAAQ,WAAW;AACnB,kBAAQ,aAAc,eAAe,MAAO;AAAA,QAC7C,CAAE;AAAA,MACJ;AAAA;AAAA,EACD;AAEF;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
1
|
+
{"version":3,"file":"site-preview.mjs","names":["coreStore"],"sources":["../../../src/components/canvas/site-preview.tsx"],"sourcesContent":["import { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { focus } from '@wordpress/dom';\nimport { addQueryArgs } from '@wordpress/url';\n\n/**\n * Renders the site's front end in an iframe.\n *\n * Shown where the canvas has no entity to edit, so that a route still says\n * something about the site it is configuring.\n *\n * @return The preview, or nothing until the site's address is known.\n */\nexport default function SitePreview() {\n\tconst siteUrl = useSelect( ( select ) => {\n\t\tconst siteData = select( coreStore ).getEntityRecord(\n\t\t\t'root',\n\t\t\t'__unstableBase'\n\t\t) as { home?: unknown } | undefined;\n\t\treturn siteData?.home;\n\t}, [] );\n\n\t// `home` comes from the REST index. Without a usable URL the iframe would\n\t// resolve its `src` against the current admin page and embed that instead,\n\t// so render nothing until there is one.\n\tif ( typeof siteUrl !== 'string' || ! siteUrl ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<iframe\n\t\t\tsrc={ addQueryArgs( siteUrl, {\n\t\t\t\t// Parameter for hiding the admin bar.\n\t\t\t\twp_site_preview: 1,\n\t\t\t} ) }\n\t\t\ttitle={ __( 'Site Preview' ) }\n\t\t\tstyle={ {\n\t\t\t\tdisplay: 'block',\n\t\t\t\twidth: '100%',\n\t\t\t\theight: '100%',\n\t\t\t\tbackgroundColor: '#fff',\n\t\t\t} }\n\t\t\tonLoad={ ( event ) => {\n\t\t\t\tconst iframeDocument = ( event.target as HTMLIFrameElement )\n\t\t\t\t\t.contentDocument;\n\n\t\t\t\t// Not readable when the site is served from another origin.\n\t\t\t\tif ( ! iframeDocument ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Make interactive elements unclickable.\n\t\t\t\tfocus.focusable\n\t\t\t\t\t.find( iframeDocument.documentElement )\n\t\t\t\t\t.forEach( ( element ) => {\n\t\t\t\t\t\telement.style.pointerEvents = 'none';\n\t\t\t\t\t\telement.tabIndex = -1;\n\t\t\t\t\t\telement.setAttribute( 'aria-hidden', 'true' );\n\t\t\t\t\t} );\n\t\t\t} }\n\t\t/>\n\t);\n}\n"],"mappings":";;;;;;;;;;;;;;;AAcA,SAAwB,cAAc;CACrC,MAAM,UAAU,WAAa,WAAY;EAKxC,OAJiB,OAAQA,KAAU,CAAC,CAAC,gBACpC,QACA,gBAEa,CAAC,EAAE;CAClB,GAAG,CAAC,CAAE;CAKN,IAAK,OAAO,YAAY,YAAY,CAAE,SACrC,OAAO;CAGR,OACC,oBAAC,UAAD;EACC,KAAM,aAAc,SAAS,EAE5B,iBAAiB,EAClB,CAAE;EACF,OAAQ,GAAI,cAAe;EAC3B,OAAQ;GACP,SAAS;GACT,OAAO;GACP,QAAQ;GACR,iBAAiB;EAClB;EACA,SAAW,UAAW;GACrB,MAAM,iBAAmB,MAAM,OAC7B;GAGF,IAAK,CAAE,gBACN;GAID,MAAM,UACJ,KAAM,eAAe,eAAgB,CAAC,CACtC,SAAW,YAAa;IACxB,QAAQ,MAAM,gBAAgB;IAC9B,QAAQ,WAAW;IACnB,QAAQ,aAAc,eAAe,MAAO;GAC7C,CAAE;EACJ;CACA,CAAA;AAEH"}
|
|
@@ -1,123 +1,119 @@
|
|
|
1
|
-
// packages/boot/src/components/canvas/use-navigate-to-entity-record.ts
|
|
2
1
|
import { useCallback, useMemo } from "@wordpress/element";
|
|
3
2
|
import { useDispatch, useRegistry, useSelect } from "@wordpress/data";
|
|
4
|
-
import { store
|
|
5
|
-
import { store as
|
|
6
|
-
import { store as
|
|
3
|
+
import { store } from "@wordpress/core-data";
|
|
4
|
+
import { store as store$1 } from "@wordpress/editor";
|
|
5
|
+
import { store as store$2 } from "@wordpress/notices";
|
|
7
6
|
import { decodeEntities } from "@wordpress/html-entities";
|
|
8
7
|
import { __, sprintf } from "@wordpress/i18n";
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
useSearch,
|
|
12
|
-
privateApis as routePrivateApis
|
|
13
|
-
} from "@wordpress/route";
|
|
14
|
-
import { store as bootStore } from "../../store/index.mjs";
|
|
8
|
+
import { privateApis, useNavigate, useSearch } from "@wordpress/route";
|
|
9
|
+
import { store as store$3 } from "../../store/index.mjs";
|
|
15
10
|
import { isValidViewport } from "./viewport.mjs";
|
|
16
11
|
import { unlock } from "../../lock-unlock.mjs";
|
|
17
|
-
|
|
12
|
+
// packages/boot/src/components/canvas/use-navigate-to-entity-record.ts
|
|
13
|
+
const { useCanGoBack, useRouter } = unlock(privateApis);
|
|
14
|
+
/**
|
|
15
|
+
* Builds the editor's entity navigation callbacks.
|
|
16
|
+
*
|
|
17
|
+
* The editor uses these to move between an entity and one nested inside it —
|
|
18
|
+
* a template part or a synced pattern reached from the block inspector. They
|
|
19
|
+
* are passed through the editor settings, where `onNavigateToEntityRecord`
|
|
20
|
+
* gates the inspector's edit affordance and `onNavigateToPreviousEntityRecord`
|
|
21
|
+
* gates the document bar's back button.
|
|
22
|
+
*
|
|
23
|
+
* @return The two callbacks, for spreading into the editor settings.
|
|
24
|
+
*/
|
|
18
25
|
function useNavigateToEntityRecord() {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
[navigate, registry, getEntityLink]
|
|
61
|
-
);
|
|
62
|
-
const isFocusMode = !!search.focusMode;
|
|
63
|
-
const onNavigateToPreviousEntityRecord = useMemo(
|
|
64
|
-
() => isFocusMode && canGoBack ? () => router.history.back() : void 0,
|
|
65
|
-
[isFocusMode, canGoBack, router]
|
|
66
|
-
);
|
|
67
|
-
return { onNavigateToEntityRecord, onNavigateToPreviousEntityRecord };
|
|
26
|
+
const navigate = useNavigate();
|
|
27
|
+
const search = useSearch({ strict: false });
|
|
28
|
+
const registry = useRegistry();
|
|
29
|
+
const getEntityLink = useSelect((select) => select(store$3).getEntityLink, []);
|
|
30
|
+
const router = useRouter();
|
|
31
|
+
const canGoBack = useCanGoBack();
|
|
32
|
+
const onNavigateToEntityRecord = useCallback((params) => {
|
|
33
|
+
const currentPostType = registry.select(store$1).getCurrentPostType();
|
|
34
|
+
const currentPostId = registry.select(store$1).getCurrentPostId();
|
|
35
|
+
const selectedBlock = registry.select(store).getEntityRecordEdits("postType", currentPostType, currentPostId)?.selection?.selectionStart?.clientId;
|
|
36
|
+
if (selectedBlock) navigate({
|
|
37
|
+
search: (previous) => ({
|
|
38
|
+
...previous,
|
|
39
|
+
selectedBlock
|
|
40
|
+
}),
|
|
41
|
+
replace: true
|
|
42
|
+
});
|
|
43
|
+
const requestedViewport = params.viewport?.toLowerCase();
|
|
44
|
+
const hasRequestedViewport = isValidViewport(requestedViewport);
|
|
45
|
+
const to = getEntityLink(params.postType, params.postId);
|
|
46
|
+
if (to) navigate({
|
|
47
|
+
to,
|
|
48
|
+
search: () => ({
|
|
49
|
+
focusMode: true,
|
|
50
|
+
...hasRequestedViewport ? { viewport: requestedViewport } : {}
|
|
51
|
+
})
|
|
52
|
+
});
|
|
53
|
+
}, [
|
|
54
|
+
navigate,
|
|
55
|
+
registry,
|
|
56
|
+
getEntityLink
|
|
57
|
+
]);
|
|
58
|
+
const isFocusMode = !!search.focusMode;
|
|
59
|
+
return {
|
|
60
|
+
onNavigateToEntityRecord,
|
|
61
|
+
onNavigateToPreviousEntityRecord: useMemo(() => isFocusMode && canGoBack ? () => router.history.back() : void 0, [
|
|
62
|
+
isFocusMode,
|
|
63
|
+
canGoBack,
|
|
64
|
+
router
|
|
65
|
+
])
|
|
66
|
+
};
|
|
68
67
|
}
|
|
68
|
+
/**
|
|
69
|
+
* Builds the callback the editor runs after a post action.
|
|
70
|
+
*
|
|
71
|
+
* Actions taken from inside the editor act on the entity being edited, so
|
|
72
|
+
* trashing or deleting one leaves the canvas showing something that is no
|
|
73
|
+
* longer there, and duplicating one gives no way to reach the copy.
|
|
74
|
+
*
|
|
75
|
+
* @param postType Post type rendered in the canvas.
|
|
76
|
+
* @return The callback, for passing to the editor.
|
|
77
|
+
*/
|
|
69
78
|
function useActionPerformed(postType) {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
onClick: () => navigate({ to })
|
|
108
|
-
}
|
|
109
|
-
]
|
|
110
|
-
}
|
|
111
|
-
);
|
|
112
|
-
break;
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
},
|
|
116
|
-
[navigate, createSuccessNotice, getEntityLink, postType]
|
|
117
|
-
);
|
|
79
|
+
const navigate = useNavigate();
|
|
80
|
+
const { createSuccessNotice } = useDispatch(store$2);
|
|
81
|
+
const getEntityLink = useSelect((select) => select(store$3).getEntityLink, []);
|
|
82
|
+
return useCallback((actionId, items) => {
|
|
83
|
+
switch (actionId) {
|
|
84
|
+
case "move-to-trash":
|
|
85
|
+
case "permanently-delete":
|
|
86
|
+
case "delete-post": {
|
|
87
|
+
const to = postType && getEntityLink(postType);
|
|
88
|
+
if (to) navigate({
|
|
89
|
+
to,
|
|
90
|
+
search: () => ({})
|
|
91
|
+
});
|
|
92
|
+
break;
|
|
93
|
+
}
|
|
94
|
+
case "duplicate-post": {
|
|
95
|
+
const newItem = items[0];
|
|
96
|
+
const to = getEntityLink(newItem.type, newItem.id);
|
|
97
|
+
if (!to) break;
|
|
98
|
+
const title = typeof newItem.title === "string" ? newItem.title : newItem.title?.rendered;
|
|
99
|
+
createSuccessNotice(sprintf(__("\"%s\" successfully created."), decodeEntities(title ?? "") || __("(no title)")), {
|
|
100
|
+
type: "snackbar",
|
|
101
|
+
id: "duplicate-post-action",
|
|
102
|
+
actions: [{
|
|
103
|
+
label: __("Edit"),
|
|
104
|
+
onClick: () => navigate({ to })
|
|
105
|
+
}]
|
|
106
|
+
});
|
|
107
|
+
break;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}, [
|
|
111
|
+
navigate,
|
|
112
|
+
createSuccessNotice,
|
|
113
|
+
getEntityLink,
|
|
114
|
+
postType
|
|
115
|
+
]);
|
|
118
116
|
}
|
|
119
|
-
export {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
};
|
|
123
|
-
//# sourceMappingURL=use-navigate-to-entity-record.mjs.map
|
|
117
|
+
export { useNavigateToEntityRecord as default, useActionPerformed };
|
|
118
|
+
|
|
119
|
+
//# sourceMappingURL=use-navigate-to-entity-record.mjs.map
|
|
@@ -1,7 +1 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 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 '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": "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",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
1
|
+
{"version":3,"file":"use-navigate-to-entity-record.mjs","names":["routePrivateApis","bootStore","editorStore","coreStore","noticesStore"],"sources":["../../../src/components/canvas/use-navigate-to-entity-record.ts"],"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"],"mappings":";;;;;;;;;;;;AAgBA,MAAM,EAAE,cAAc,cAAc,OAAQA,WAAiB;;;;;;;;;;;;AAgC7D,SAAwB,4BAA4B;CACnD,MAAM,WAAW,YAAY;CAC7B,MAAM,SAAS,UAAW,EAAE,QAAQ,MAAM,CAAE;CAC5C,MAAM,WAAW,YAAY;CAC7B,MAAM,gBAAgB,WACnB,WAAY,OAAQC,OAAU,CAAC,CAAC,eAClC,CAAC,CACF;CACA,MAAM,SAAS,UAAU;CACzB,MAAM,YAAY,aAAa;CAE/B,MAAM,2BAA2B,aAC9B,WAA4B;EAM7B,MAAM,kBACL,SAAS,OAAQC,OAAY,CAAC,CAC5B,mBAAmB;EACtB,MAAM,gBACL,SAAS,OAAQA,OAAY,CAAC,CAC5B,iBAAiB;EAQpB,MAAM,gBAPQ,SACZ,OAAQC,KAAU,CAAC,CACnB,qBACA,YACA,iBACA,aAEwB,CAAC,EAAE,WAAW,gBAAgB;EAExD,IAAK,eACJ,SAAU;GACT,SAAU,cAA2C;IACpD,GAAG;IACH;GACD;GACA,SAAS;EACV,CAAE;EAUH,MAAM,oBAAoB,OAAO,UAAU,YAAY;EACvD,MAAM,uBAAuB,gBAAiB,iBAAkB;EAQhE,MAAM,KAAK,cAAe,OAAO,UAAU,OAAO,MAAO;EAEzD,IAAK,IACJ,SAAU;GACT;GACA,eAAgB;IACf,WAAW;IACX,GAAK,uBACF,EAAE,UAAU,kBAAkB,IAC9B,CAAC;GACL;EACD,CAAE;CAEJ,GACA;EAAE;EAAU;EAAU;CAAc,CACrC;CASA,MAAM,cAAc,CAAC,CAAE,OAAO;CAO9B,OAAO;EAAE;EAA0B,kCANM,cAEvC,eAAe,kBAAkB,OAAO,QAAQ,KAAK,IAAI,KAAA,GAC1D;GAAE;GAAa;GAAW;EAAO,CAGgC;CAAE;AACrE;;;;;;;;;;;AAkBA,SAAgB,mBAAoB,UAAoB;CACvD,MAAM,WAAW,YAAY;CAC7B,MAAM,EAAE,wBAAwB,YAAaC,OAAa;CAC1D,MAAM,gBAAgB,WACnB,WAAY,OAAQH,OAAU,CAAC,CAAC,eAClC,CAAC,CACF;CAEA,OAAO,aACJ,UAAkB,UAAyB;EAC5C,QAAS,UAAT;GACC,KAAK;GACL,KAAK;GACL,KAAK,eAAe;IACnB,MAAM,KAAK,YAAY,cAAe,QAAS;IAE/C,IAAK,IACJ,SAAU;KAAE;KAAI,eAAgB,CAAC;IAAI,CAAE;IAExC;GACD;GAEA,KAAK,kBAAkB;IACtB,MAAM,UAAU,MAAO;IACvB,MAAM,KAAK,cAAe,QAAQ,MAAM,QAAQ,EAAG;IAEnD,IAAK,CAAE,IACN;IAGD,MAAM,QACL,OAAO,QAAQ,UAAU,WACtB,QAAQ,QACR,QAAQ,OAAO;IAOnB,oBACC,QAEC,GAAI,8BAA6B,GACjC,eAAgB,SAAS,EAAG,KAAK,GAAI,YAAa,CACnD,GACA;KACC,MAAM;KACN,IAAI;KACJ,SAAS,CACR;MACC,OAAO,GAAI,MAAO;MAClB,eAAe,SAAU,EAAE,GAAG,CAAE;KACjC,CACD;IACD,CACD;IACA;GACD;EACD;CACD,GACA;EAAE;EAAU;EAAqB;EAAe;CAAS,CAC1D;AACD"}
|
|
@@ -1,18 +1,30 @@
|
|
|
1
1
|
// packages/boot/src/components/canvas/viewport.ts
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
const DEFAULT_DEVICE_TYPE = "Desktop";
|
|
3
|
+
const VALID_VIEWPORTS = [
|
|
4
|
+
"desktop",
|
|
5
|
+
"tablet",
|
|
6
|
+
"mobile"
|
|
7
|
+
];
|
|
8
|
+
/**
|
|
9
|
+
* Whether a viewport is one an entity can be asked to be edited at.
|
|
10
|
+
*
|
|
11
|
+
* @param viewport Viewport, as written in the URL.
|
|
12
|
+
* @return Whether the editor has a width for it.
|
|
13
|
+
*/
|
|
4
14
|
function isValidViewport(viewport) {
|
|
5
|
-
|
|
15
|
+
return !!viewport && VALID_VIEWPORTS.includes(viewport.toLowerCase());
|
|
6
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* The device type a `viewport` search param names.
|
|
19
|
+
*
|
|
20
|
+
* @param viewport Viewport, as written in the URL.
|
|
21
|
+
* @return Device type, Desktop for a viewport the editor has no width for.
|
|
22
|
+
*/
|
|
7
23
|
function getDeviceType(viewport) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const value = viewport.toLowerCase();
|
|
12
|
-
return value.charAt(0).toUpperCase() + value.slice(1);
|
|
24
|
+
if (!isValidViewport(viewport)) return DEFAULT_DEVICE_TYPE;
|
|
25
|
+
const value = viewport.toLowerCase();
|
|
26
|
+
return value.charAt(0).toUpperCase() + value.slice(1);
|
|
13
27
|
}
|
|
14
|
-
export {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
};
|
|
18
|
-
//# sourceMappingURL=viewport.mjs.map
|
|
28
|
+
export { getDeviceType, isValidViewport };
|
|
29
|
+
|
|
30
|
+
//# sourceMappingURL=viewport.mjs.map
|
|
@@ -1,7 +1 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/components/canvas/viewport.ts"],
|
|
4
|
-
"sourcesContent": ["const DEFAULT_DEVICE_TYPE = 'Desktop';\n\n/*\n * Lowercase in the URL, PascalCase in the editor store. Duplicated in\n * packages/edit-site/src/components/block-editor/viewport.js, in the editor's\n * preview-dropdown choices, and in the block editor's block-visibility\n * constants. Update all four when adding a viewport type.\n */\nconst VALID_VIEWPORTS = [ 'desktop', 'tablet', 'mobile' ];\n\n/**\n * Whether a viewport is one an entity can be asked to be edited at.\n *\n * @param viewport Viewport, as written in the URL.\n * @return Whether the editor has a width for it.\n */\nexport function isValidViewport( viewport?: string ): viewport is string {\n\treturn !! viewport && VALID_VIEWPORTS.includes( viewport.toLowerCase() );\n}\n\n/**\n * The device type a `viewport` search param names.\n *\n * @param viewport Viewport, as written in the URL.\n * @return Device type, Desktop for a viewport the editor has no width for.\n */\nexport function getDeviceType( viewport?: string ) {\n\tif ( ! isValidViewport( viewport ) ) {\n\t\treturn DEFAULT_DEVICE_TYPE;\n\t}\n\n\tconst value = viewport.toLowerCase();\n\treturn value.charAt( 0 ).toUpperCase() + value.slice( 1 );\n}\n"],
|
|
5
|
-
"mappings": ";AAAA,IAAM,sBAAsB;AAQ5B,IAAM,kBAAkB,CAAE,WAAW,UAAU,QAAS;AAQjD,SAAS,gBAAiB,UAAwC;AACxE,SAAO,CAAC,CAAE,YAAY,gBAAgB,SAAU,SAAS,YAAY,CAAE;AACxE;AAQO,SAAS,cAAe,UAAoB;AAClD,MAAK,CAAE,gBAAiB,QAAS,GAAI;AACpC,WAAO;AAAA,EACR;AAEA,QAAM,QAAQ,SAAS,YAAY;AACnC,SAAO,MAAM,OAAQ,CAAE,EAAE,YAAY,IAAI,MAAM,MAAO,CAAE;AACzD;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
1
|
+
{"version":3,"file":"viewport.mjs","names":[],"sources":["../../../src/components/canvas/viewport.ts"],"sourcesContent":["const DEFAULT_DEVICE_TYPE = 'Desktop';\n\n/*\n * Lowercase in the URL, PascalCase in the editor store. Duplicated in\n * packages/edit-site/src/components/block-editor/viewport.js, in the editor's\n * preview-dropdown choices, and in the block editor's block-visibility\n * constants. Update all four when adding a viewport type.\n */\nconst VALID_VIEWPORTS = [ 'desktop', 'tablet', 'mobile' ];\n\n/**\n * Whether a viewport is one an entity can be asked to be edited at.\n *\n * @param viewport Viewport, as written in the URL.\n * @return Whether the editor has a width for it.\n */\nexport function isValidViewport( viewport?: string ): viewport is string {\n\treturn !! viewport && VALID_VIEWPORTS.includes( viewport.toLowerCase() );\n}\n\n/**\n * The device type a `viewport` search param names.\n *\n * @param viewport Viewport, as written in the URL.\n * @return Device type, Desktop for a viewport the editor has no width for.\n */\nexport function getDeviceType( viewport?: string ) {\n\tif ( ! isValidViewport( viewport ) ) {\n\t\treturn DEFAULT_DEVICE_TYPE;\n\t}\n\n\tconst value = viewport.toLowerCase();\n\treturn value.charAt( 0 ).toUpperCase() + value.slice( 1 );\n}\n"],"mappings":";AAAA,MAAM,sBAAsB;AAQ5B,MAAM,kBAAkB;CAAE;CAAW;CAAU;AAAS;;;;;;;AAQxD,SAAgB,gBAAiB,UAAwC;CACxE,OAAO,CAAC,CAAE,YAAY,gBAAgB,SAAU,SAAS,YAAY,CAAE;AACxE;;;;;;;AAQA,SAAgB,cAAe,UAAoB;CAClD,IAAK,CAAE,gBAAiB,QAAS,GAChC,OAAO;CAGR,MAAM,QAAQ,SAAS,YAAY;CACnC,OAAO,MAAM,OAAQ,CAAE,CAAC,CAAC,YAAY,IAAI,MAAM,MAAO,CAAE;AACzD"}
|
|
@@ -1,35 +1,43 @@
|
|
|
1
|
-
|
|
2
|
-
import { useState, useEffect } from "@wordpress/element";
|
|
1
|
+
import { useEffect, useState } from "@wordpress/element";
|
|
3
2
|
import Canvas from "../canvas/index.mjs";
|
|
4
3
|
import { jsx } from "react/jsx-runtime";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
4
|
+
// packages/boot/src/components/canvas-renderer/index.tsx
|
|
5
|
+
/**
|
|
6
|
+
* CanvasRenderer handles rendering of both default and custom canvas components.
|
|
7
|
+
* The logic here would have been way simpler if we just render the canvas within
|
|
8
|
+
* the RouteComponent like the other surfaces.
|
|
9
|
+
* The issue is that doing so forces the canvas to remount on every route change,
|
|
10
|
+
* which is not desirable for smooth transitions.
|
|
11
|
+
*
|
|
12
|
+
* - When canvas is undefined: No canvas is rendered
|
|
13
|
+
* - When canvas is null: Loads and renders custom canvas from contentModulePath
|
|
14
|
+
* - When canvas is CanvasData: Renders default Canvas component with editor
|
|
15
|
+
*
|
|
16
|
+
* This component is designed to be rendered at the Root level to prevent
|
|
17
|
+
* remounting when navigating between routes.
|
|
18
|
+
*
|
|
19
|
+
* @param props Component props
|
|
20
|
+
* @param props.canvas Canvas data from route loader
|
|
21
|
+
* @param props.routeContentModule Path to content module for custom canvas
|
|
22
|
+
* @return Canvas renderer
|
|
23
|
+
*/
|
|
24
|
+
function CanvasRenderer({ canvas, routeContentModule }) {
|
|
25
|
+
const [CustomCanvas, setCustomCanvas] = useState(null);
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
if (canvas === null && routeContentModule) import(routeContentModule).then((module) => {
|
|
28
|
+
setCustomCanvas(() => module.canvas);
|
|
29
|
+
}).catch((error) => {
|
|
30
|
+
console.error("Failed to load custom canvas:", error);
|
|
31
|
+
});
|
|
32
|
+
else setCustomCanvas(null);
|
|
33
|
+
}, [canvas, routeContentModule]);
|
|
34
|
+
if (canvas === void 0) return null;
|
|
35
|
+
if (canvas === null) {
|
|
36
|
+
if (!CustomCanvas) return null;
|
|
37
|
+
return /* @__PURE__ */ jsx(CustomCanvas, {});
|
|
38
|
+
}
|
|
39
|
+
return /* @__PURE__ */ jsx(Canvas, { canvas });
|
|
31
40
|
}
|
|
32
|
-
export {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
//# sourceMappingURL=index.mjs.map
|
|
41
|
+
export { CanvasRenderer as default };
|
|
42
|
+
|
|
43
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,7 +1 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/components/canvas-renderer/index.tsx"],
|
|
4
|
-
"sourcesContent": ["import { useState, useEffect } from '@wordpress/element';\nimport Canvas from '../canvas';\nimport type { CanvasData } from '../../store/types';\n\ninterface CanvasRendererProps {\n\tcanvas: CanvasData | null | undefined;\n\trouteContentModule?: string;\n}\n\n/**\n * CanvasRenderer handles rendering of both default and custom canvas components.\n * The logic here would have been way simpler if we just render the canvas within\n * the RouteComponent like the other surfaces.\n * The issue is that doing so forces the canvas to remount on every route change,\n * which is not desirable for smooth transitions.\n *\n * - When canvas is undefined: No canvas is rendered\n * - When canvas is null: Loads and renders custom canvas from contentModulePath\n * - When canvas is CanvasData: Renders default Canvas component with editor\n *\n * This component is designed to be rendered at the Root level to prevent\n * remounting when navigating between routes.\n *\n * @param props Component props\n * @param props.canvas Canvas data from route loader\n * @param props.routeContentModule Path to content module for custom canvas\n * @return Canvas renderer\n */\nexport default function CanvasRenderer( {\n\tcanvas,\n\trouteContentModule,\n}: CanvasRendererProps ) {\n\tconst [ CustomCanvas, setCustomCanvas ] = useState< any >( null );\n\n\tuseEffect( () => {\n\t\tif ( canvas === null && routeContentModule ) {\n\t\t\timport( routeContentModule )\n\t\t\t\t.then( ( module ) => {\n\t\t\t\t\tsetCustomCanvas( () => module.canvas );\n\t\t\t\t} )\n\t\t\t\t.catch( ( error ) => {\n\t\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\t\tconsole.error( 'Failed to load custom canvas:', error );\n\t\t\t\t} );\n\t\t} else {\n\t\t\tsetCustomCanvas( null );\n\t\t}\n\t}, [ canvas, routeContentModule ] );\n\n\t// No canvas\n\tif ( canvas === undefined ) {\n\t\treturn null;\n\t}\n\n\t// Custom canvas\n\tif ( canvas === null ) {\n\t\tif ( ! CustomCanvas ) {\n\t\t\treturn null; // Still loading\n\t\t}\n\t\treturn <CustomCanvas />;\n\t}\n\n\t// Default canvas\n\treturn <Canvas canvas={ canvas } />;\n}\n"],
|
|
5
|
-
"mappings": ";AAAA,SAAS,UAAU,iBAAiB;AACpC,OAAO,YAAY;AA0DV;AA/BM,SAAR,eAAiC;AAAA,EACvC;AAAA,EACA;AACD,GAAyB;AACxB,QAAM,CAAE,cAAc,eAAgB,IAAI,SAAiB,IAAK;AAEhE,YAAW,MAAM;AAChB,QAAK,WAAW,QAAQ,oBAAqB;AAC5C,aAAQ,oBACN,KAAM,CAAE,WAAY;AACpB,wBAAiB,MAAM,OAAO,MAAO;AAAA,MACtC,CAAE,EACD,MAAO,CAAE,UAAW;AAEpB,gBAAQ,MAAO,iCAAiC,KAAM;AAAA,MACvD,CAAE;AAAA,IACJ,OAAO;AACN,sBAAiB,IAAK;AAAA,IACvB;AAAA,EACD,GAAG,CAAE,QAAQ,kBAAmB,CAAE;AAGlC,MAAK,WAAW,QAAY;AAC3B,WAAO;AAAA,EACR;AAGA,MAAK,WAAW,MAAO;AACtB,QAAK,CAAE,cAAe;AACrB,aAAO;AAAA,IACR;AACA,WAAO,oBAAC,gBAAa;AAAA,EACtB;AAGA,SAAO,oBAAC,UAAO,QAAkB;AAClC;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../../src/components/canvas-renderer/index.tsx"],"sourcesContent":["import { useState, useEffect } from '@wordpress/element';\nimport Canvas from '../canvas';\nimport type { CanvasData } from '../../store/types';\n\ninterface CanvasRendererProps {\n\tcanvas: CanvasData | null | undefined;\n\trouteContentModule?: string;\n}\n\n/**\n * CanvasRenderer handles rendering of both default and custom canvas components.\n * The logic here would have been way simpler if we just render the canvas within\n * the RouteComponent like the other surfaces.\n * The issue is that doing so forces the canvas to remount on every route change,\n * which is not desirable for smooth transitions.\n *\n * - When canvas is undefined: No canvas is rendered\n * - When canvas is null: Loads and renders custom canvas from contentModulePath\n * - When canvas is CanvasData: Renders default Canvas component with editor\n *\n * This component is designed to be rendered at the Root level to prevent\n * remounting when navigating between routes.\n *\n * @param props Component props\n * @param props.canvas Canvas data from route loader\n * @param props.routeContentModule Path to content module for custom canvas\n * @return Canvas renderer\n */\nexport default function CanvasRenderer( {\n\tcanvas,\n\trouteContentModule,\n}: CanvasRendererProps ) {\n\tconst [ CustomCanvas, setCustomCanvas ] = useState< any >( null );\n\n\tuseEffect( () => {\n\t\tif ( canvas === null && routeContentModule ) {\n\t\t\timport( routeContentModule )\n\t\t\t\t.then( ( module ) => {\n\t\t\t\t\tsetCustomCanvas( () => module.canvas );\n\t\t\t\t} )\n\t\t\t\t.catch( ( error ) => {\n\t\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\t\tconsole.error( 'Failed to load custom canvas:', error );\n\t\t\t\t} );\n\t\t} else {\n\t\t\tsetCustomCanvas( null );\n\t\t}\n\t}, [ canvas, routeContentModule ] );\n\n\t// No canvas\n\tif ( canvas === undefined ) {\n\t\treturn null;\n\t}\n\n\t// Custom canvas\n\tif ( canvas === null ) {\n\t\tif ( ! CustomCanvas ) {\n\t\t\treturn null; // Still loading\n\t\t}\n\t\treturn <CustomCanvas />;\n\t}\n\n\t// Default canvas\n\treturn <Canvas canvas={ canvas } />;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AA4BA,SAAwB,eAAgB,EACvC,QACA,sBACwB;CACxB,MAAM,CAAE,cAAc,mBAAoB,SAAiB,IAAK;CAEhE,gBAAiB;EAChB,IAAK,WAAW,QAAQ,oBACvB,OAAQ,mBAAoB,CAC1B,MAAQ,WAAY;GACpB,sBAAuB,OAAO,MAAO;EACtC,CAAE,CAAC,CACF,OAAS,UAAW;GAEpB,QAAQ,MAAO,iCAAiC,KAAM;EACvD,CAAE;OAEH,gBAAiB,IAAK;CAExB,GAAG,CAAE,QAAQ,kBAAmB,CAAE;CAGlC,IAAK,WAAW,KAAA,GACf,OAAO;CAIR,IAAK,WAAW,MAAO;EACtB,IAAK,CAAE,cACN,OAAO;EAER,OAAO,oBAAC,cAAD,CAAe,CAAA;CACvB;CAGA,OAAO,oBAAC,QAAD,EAAiB,OAAU,CAAA;AACnC"}
|