@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,64 +1,40 @@
|
|
|
1
|
-
|
|
2
|
-
import { createRoot, StrictMode } from "@wordpress/element";
|
|
1
|
+
import { StrictMode, createRoot } from "@wordpress/element";
|
|
3
2
|
import { dispatch, useSelect } from "@wordpress/data";
|
|
4
3
|
import Router from "./router.mjs";
|
|
5
4
|
import RootSinglePage from "../root/single-page.mjs";
|
|
6
5
|
import { store } from "../../store/index.mjs";
|
|
7
6
|
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
// packages/boot/src/components/app/index.tsx
|
|
8
8
|
function App({ rootComponent }) {
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
const routes = useSelect((select) => select(store).getRoutes(), []);
|
|
10
|
+
return /* @__PURE__ */ jsx(Router, {
|
|
11
|
+
routes,
|
|
12
|
+
rootComponent
|
|
13
|
+
});
|
|
11
14
|
}
|
|
12
15
|
async function runInitModules(initModules) {
|
|
13
|
-
|
|
14
|
-
const module = await import(moduleId);
|
|
15
|
-
await module.init();
|
|
16
|
-
}
|
|
16
|
+
for (const moduleId of initModules ?? []) await (await import(moduleId)).init();
|
|
17
17
|
}
|
|
18
|
-
async function init({
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
})
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
dispatch(store).registerRoute(route);
|
|
30
|
-
});
|
|
31
|
-
if (dashboardLink) {
|
|
32
|
-
dispatch(store).setDashboardLink(dashboardLink);
|
|
33
|
-
}
|
|
34
|
-
await runInitModules(initModules);
|
|
35
|
-
const rootElement = document.getElementById(mountId);
|
|
36
|
-
if (rootElement) {
|
|
37
|
-
const root = createRoot(rootElement);
|
|
38
|
-
root.render(
|
|
39
|
-
/* @__PURE__ */ jsx(StrictMode, { children: /* @__PURE__ */ jsx(App, {}) })
|
|
40
|
-
);
|
|
41
|
-
}
|
|
18
|
+
async function init({ mountId, menuItems, routes, initModules, dashboardLink }) {
|
|
19
|
+
(menuItems ?? []).forEach((menuItem) => {
|
|
20
|
+
dispatch(store).registerMenuItem(menuItem.id, menuItem);
|
|
21
|
+
});
|
|
22
|
+
(routes ?? []).forEach((route) => {
|
|
23
|
+
dispatch(store).registerRoute(route);
|
|
24
|
+
});
|
|
25
|
+
if (dashboardLink) dispatch(store).setDashboardLink(dashboardLink);
|
|
26
|
+
await runInitModules(initModules);
|
|
27
|
+
const rootElement = document.getElementById(mountId);
|
|
28
|
+
if (rootElement) createRoot(rootElement).render(/* @__PURE__ */ jsx(StrictMode, { children: /* @__PURE__ */ jsx(App, {}) }));
|
|
42
29
|
}
|
|
43
|
-
async function initSinglePage({
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
});
|
|
51
|
-
await runInitModules(initModules);
|
|
52
|
-
const rootElement = document.getElementById(mountId);
|
|
53
|
-
if (rootElement) {
|
|
54
|
-
const root = createRoot(rootElement);
|
|
55
|
-
root.render(
|
|
56
|
-
/* @__PURE__ */ jsx(StrictMode, { children: /* @__PURE__ */ jsx(App, { rootComponent: RootSinglePage }) })
|
|
57
|
-
);
|
|
58
|
-
}
|
|
30
|
+
async function initSinglePage({ mountId, routes, initModules }) {
|
|
31
|
+
(routes ?? []).forEach((route) => {
|
|
32
|
+
dispatch(store).registerRoute(route);
|
|
33
|
+
});
|
|
34
|
+
await runInitModules(initModules);
|
|
35
|
+
const rootElement = document.getElementById(mountId);
|
|
36
|
+
if (rootElement) createRoot(rootElement).render(/* @__PURE__ */ jsx(StrictMode, { children: /* @__PURE__ */ jsx(App, { rootComponent: RootSinglePage }) }));
|
|
59
37
|
}
|
|
60
|
-
export {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
};
|
|
64
|
-
//# sourceMappingURL=index.mjs.map
|
|
38
|
+
export { init, initSinglePage };
|
|
39
|
+
|
|
40
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,7 +1 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/components/app/index.tsx"],
|
|
4
|
-
"sourcesContent": ["import { createRoot, StrictMode, type ComponentType } from '@wordpress/element';\nimport { dispatch, useSelect } from '@wordpress/data';\nimport Router from './router';\nimport RootSinglePage from '../root/single-page';\nimport { store } from '../../store';\nimport type { MenuItem, Route } from '../../store/types';\n\ninterface AppProps {\n\trootComponent?: ComponentType;\n}\n\nfunction App( { rootComponent }: AppProps ) {\n\tconst routes = useSelect( ( select ) => select( store ).getRoutes(), [] );\n\n\treturn <Router routes={ routes } rootComponent={ rootComponent } />;\n}\n\n/*\n * Import and run page init modules.\n * Each module must export an async `init` function,\n * awaited before the app renders so startup tasks finish first.\n */\nasync function runInitModules( initModules?: string[] ) {\n\tfor ( const moduleId of initModules ?? [] ) {\n\t\tconst module = await import( moduleId );\n\t\tawait module.init();\n\t}\n}\n\ninterface InitProps {\n\tmountId: string;\n\tmenuItems?: MenuItem[];\n\troutes?: Route[];\n\tinitModules?: string[];\n\tdashboardLink?: string;\n}\n\nexport async function init( {\n\tmountId,\n\tmenuItems,\n\troutes,\n\tinitModules,\n\tdashboardLink,\n}: InitProps ) {\n\t( menuItems ?? [] ).forEach( ( menuItem ) => {\n\t\tdispatch( store ).registerMenuItem( menuItem.id, menuItem );\n\t} );\n\n\t( routes ?? [] ).forEach( ( route ) => {\n\t\tdispatch( store ).registerRoute( route );\n\t} );\n\n\tif ( dashboardLink ) {\n\t\tdispatch( store ).setDashboardLink( dashboardLink );\n\t}\n\n\tawait runInitModules( initModules );\n\n\t// Render the app\n\tconst rootElement = document.getElementById( mountId );\n\tif ( rootElement ) {\n\t\tconst root = createRoot( rootElement );\n\t\troot.render(\n\t\t\t<StrictMode>\n\t\t\t\t<App />\n\t\t\t</StrictMode>\n\t\t);\n\t}\n}\n\ninterface InitSinglePageProps {\n\tmountId: string;\n\troutes?: Route[];\n\tinitModules?: string[];\n}\n\nexport async function initSinglePage( {\n\tmountId,\n\troutes,\n\tinitModules,\n}: InitSinglePageProps ) {\n\t( routes ?? [] ).forEach( ( route ) => {\n\t\tdispatch( store ).registerRoute( route );\n\t} );\n\n\tawait runInitModules( initModules );\n\n\t// Render the app without sidebar\n\tconst rootElement = document.getElementById( mountId );\n\tif ( rootElement ) {\n\t\tconst root = createRoot( rootElement );\n\t\troot.render(\n\t\t\t<StrictMode>\n\t\t\t\t<App rootComponent={ RootSinglePage } />\n\t\t\t</StrictMode>\n\t\t);\n\t}\n}\n"],
|
|
5
|
-
"mappings": ";AAAA,SAAS,YAAY,kBAAsC;AAC3D,SAAS,UAAU,iBAAiB;AACpC,OAAO,YAAY;AACnB,OAAO,oBAAoB;AAC3B,SAAS,aAAa;AAUd;AAHR,SAAS,IAAK,EAAE,cAAc,GAAc;AAC3C,QAAM,SAAS,UAAW,CAAE,WAAY,OAAQ,KAAM,EAAE,UAAU,GAAG,CAAC,CAAE;AAExE,SAAO,oBAAC,UAAO,QAAkB,eAAgC;AAClE;AAOA,eAAe,eAAgB,aAAyB;AACvD,aAAY,YAAY,eAAe,CAAC,GAAI;AAC3C,UAAM,SAAS,MAAM,OAAQ;AAC7B,UAAM,OAAO,KAAK;AAAA,EACnB;AACD;AAUA,eAAsB,KAAM;AAAA,EAC3B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAAe;AACd,GAAE,aAAa,CAAC,GAAI,QAAS,CAAE,aAAc;AAC5C,aAAU,KAAM,EAAE,iBAAkB,SAAS,IAAI,QAAS;AAAA,EAC3D,CAAE;AAEF,GAAE,UAAU,CAAC,GAAI,QAAS,CAAE,UAAW;AACtC,aAAU,KAAM,EAAE,cAAe,KAAM;AAAA,EACxC,CAAE;AAEF,MAAK,eAAgB;AACpB,aAAU,KAAM,EAAE,iBAAkB,aAAc;AAAA,EACnD;AAEA,QAAM,eAAgB,WAAY;AAGlC,QAAM,cAAc,SAAS,eAAgB,OAAQ;AACrD,MAAK,aAAc;AAClB,UAAM,OAAO,WAAY,WAAY;AACrC,SAAK;AAAA,MACJ,oBAAC,cACA,8BAAC,OAAI,GACN;AAAA,IACD;AAAA,EACD;AACD;AAQA,eAAsB,eAAgB;AAAA,EACrC;AAAA,EACA;AAAA,EACA;AACD,GAAyB;AACxB,GAAE,UAAU,CAAC,GAAI,QAAS,CAAE,UAAW;AACtC,aAAU,KAAM,EAAE,cAAe,KAAM;AAAA,EACxC,CAAE;AAEF,QAAM,eAAgB,WAAY;AAGlC,QAAM,cAAc,SAAS,eAAgB,OAAQ;AACrD,MAAK,aAAc;AAClB,UAAM,OAAO,WAAY,WAAY;AACrC,SAAK;AAAA,MACJ,oBAAC,cACA,8BAAC,OAAI,eAAgB,gBAAiB,GACvC;AAAA,IACD;AAAA,EACD;AACD;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../../src/components/app/index.tsx"],"sourcesContent":["import { createRoot, StrictMode, type ComponentType } from '@wordpress/element';\nimport { dispatch, useSelect } from '@wordpress/data';\nimport Router from './router';\nimport RootSinglePage from '../root/single-page';\nimport { store } from '../../store';\nimport type { MenuItem, Route } from '../../store/types';\n\ninterface AppProps {\n\trootComponent?: ComponentType;\n}\n\nfunction App( { rootComponent }: AppProps ) {\n\tconst routes = useSelect( ( select ) => select( store ).getRoutes(), [] );\n\n\treturn <Router routes={ routes } rootComponent={ rootComponent } />;\n}\n\n/*\n * Import and run page init modules.\n * Each module must export an async `init` function,\n * awaited before the app renders so startup tasks finish first.\n */\nasync function runInitModules( initModules?: string[] ) {\n\tfor ( const moduleId of initModules ?? [] ) {\n\t\tconst module = await import( moduleId );\n\t\tawait module.init();\n\t}\n}\n\ninterface InitProps {\n\tmountId: string;\n\tmenuItems?: MenuItem[];\n\troutes?: Route[];\n\tinitModules?: string[];\n\tdashboardLink?: string;\n}\n\nexport async function init( {\n\tmountId,\n\tmenuItems,\n\troutes,\n\tinitModules,\n\tdashboardLink,\n}: InitProps ) {\n\t( menuItems ?? [] ).forEach( ( menuItem ) => {\n\t\tdispatch( store ).registerMenuItem( menuItem.id, menuItem );\n\t} );\n\n\t( routes ?? [] ).forEach( ( route ) => {\n\t\tdispatch( store ).registerRoute( route );\n\t} );\n\n\tif ( dashboardLink ) {\n\t\tdispatch( store ).setDashboardLink( dashboardLink );\n\t}\n\n\tawait runInitModules( initModules );\n\n\t// Render the app\n\tconst rootElement = document.getElementById( mountId );\n\tif ( rootElement ) {\n\t\tconst root = createRoot( rootElement );\n\t\troot.render(\n\t\t\t<StrictMode>\n\t\t\t\t<App />\n\t\t\t</StrictMode>\n\t\t);\n\t}\n}\n\ninterface InitSinglePageProps {\n\tmountId: string;\n\troutes?: Route[];\n\tinitModules?: string[];\n}\n\nexport async function initSinglePage( {\n\tmountId,\n\troutes,\n\tinitModules,\n}: InitSinglePageProps ) {\n\t( routes ?? [] ).forEach( ( route ) => {\n\t\tdispatch( store ).registerRoute( route );\n\t} );\n\n\tawait runInitModules( initModules );\n\n\t// Render the app without sidebar\n\tconst rootElement = document.getElementById( mountId );\n\tif ( rootElement ) {\n\t\tconst root = createRoot( rootElement );\n\t\troot.render(\n\t\t\t<StrictMode>\n\t\t\t\t<App rootComponent={ RootSinglePage } />\n\t\t\t</StrictMode>\n\t\t);\n\t}\n}\n"],"mappings":";;;;;;;AAWA,SAAS,IAAK,EAAE,iBAA4B;CAC3C,MAAM,SAAS,WAAa,WAAY,OAAQ,KAAM,CAAC,CAAC,UAAU,GAAG,CAAC,CAAE;CAExE,OAAO,oBAAC,QAAD;EAAiB;EAAyB;CAAiB,CAAA;AACnE;AAOA,eAAe,eAAgB,aAAyB;CACvD,KAAM,MAAM,YAAY,eAAe,CAAC,GAEvC,OAAM,MADe,OAAQ,UAAA,CAChB,KAAK;AAEpB;AAUA,eAAsB,KAAM,EAC3B,SACA,WACA,QACA,aACA,iBACc;CACd,CAAE,aAAa,CAAC,EAAA,CAAI,SAAW,aAAc;EAC5C,SAAU,KAAM,CAAC,CAAC,iBAAkB,SAAS,IAAI,QAAS;CAC3D,CAAE;CAEF,CAAE,UAAU,CAAC,EAAA,CAAI,SAAW,UAAW;EACtC,SAAU,KAAM,CAAC,CAAC,cAAe,KAAM;CACxC,CAAE;CAEF,IAAK,eACJ,SAAU,KAAM,CAAC,CAAC,iBAAkB,aAAc;CAGnD,MAAM,eAAgB,WAAY;CAGlC,MAAM,cAAc,SAAS,eAAgB,OAAQ;CACrD,IAAK,aAEJ,WADyB,WACtB,CAAC,CAAC,OACJ,oBAAC,YAAD,EAAA,UACC,oBAAC,KAAD,CAAM,CAAA,EACK,CAAA,CACb;AAEF;AAQA,eAAsB,eAAgB,EACrC,SACA,QACA,eACwB;CACxB,CAAE,UAAU,CAAC,EAAA,CAAI,SAAW,UAAW;EACtC,SAAU,KAAM,CAAC,CAAC,cAAe,KAAM;CACxC,CAAE;CAEF,MAAM,eAAgB,WAAY;CAGlC,MAAM,cAAc,SAAS,eAAgB,OAAQ;CACrD,IAAK,aAEJ,WADyB,WACtB,CAAC,CAAC,OACJ,oBAAC,YAAD,EAAA,UACC,oBAAC,KAAD,EAAK,eAAgB,eAAkB,CAAA,EAC5B,CAAA,CACb;AAEF"}
|