@wordpress/boot 0.4.0 → 0.4.1-next.ba3aee3a2.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/LICENSE.md +1 -1
- package/build-module/components/app/{index.js → index.mjs} +9 -5
- package/build-module/components/app/index.mjs.map +7 -0
- package/build-module/components/app/{router.js → router.mjs} +43 -40
- package/build-module/components/app/router.mjs.map +7 -0
- package/build-module/components/app/{use-route-title.js → use-route-title.mjs} +2 -2
- package/build-module/components/canvas/{back-button.js → back-button.mjs} +2 -2
- package/build-module/components/canvas/{index.js → index.mjs} +2 -2
- package/build-module/components/canvas-renderer/{index.js → index.mjs} +2 -2
- package/build-module/components/navigation/drilldown-item/{index.js → index.mjs} +2 -2
- package/build-module/components/navigation/dropdown-item/{index.js → index.mjs} +4 -4
- package/build-module/components/navigation/{index.js → index.mjs} +7 -7
- package/build-module/components/navigation/{items.js → items.mjs} +1 -1
- package/build-module/components/navigation/navigation-item/index.mjs +184 -0
- package/build-module/components/navigation/navigation-item/index.mjs.map +7 -0
- package/build-module/components/navigation/navigation-screen/{index.js → index.mjs} +1 -1
- package/build-module/components/navigation/{path-matching.js → path-matching.mjs} +1 -1
- package/build-module/components/navigation/{router-link-item.js → router-link-item.mjs} +2 -2
- package/build-module/components/navigation/{use-sidebar-parent.js → use-sidebar-parent.mjs} +4 -4
- package/build-module/components/root/index.mjs +425 -0
- package/build-module/components/root/index.mjs.map +7 -0
- package/build-module/components/root/single-page.mjs +334 -0
- package/build-module/components/root/single-page.mjs.map +7 -0
- package/build-module/components/save-button/{index.js → index.mjs} +2 -2
- package/build-module/components/save-panel/{index.js → index.mjs} +2 -2
- package/build-module/components/save-panel/{use-save-shortcut.js → use-save-shortcut.mjs} +1 -1
- package/build-module/components/sidebar/{index.js → index.mjs} +4 -4
- package/build-module/components/site-hub/index.mjs +179 -0
- package/build-module/components/site-hub/index.mjs.map +7 -0
- package/build-module/components/site-icon/{index.js → index.mjs} +3 -3
- package/build-module/components/site-icon/index.mjs.map +7 -0
- package/build-module/components/site-icon-link/{index.js → index.mjs} +6 -5
- package/build-module/components/site-icon-link/index.mjs.map +7 -0
- package/build-module/components/user-theme-provider/index.mjs +33 -0
- package/build-module/components/user-theme-provider/index.mjs.map +7 -0
- package/build-module/index.mjs +708 -0
- package/build-module/index.mjs.map +7 -0
- package/build-module/{lock-unlock.js → lock-unlock.mjs} +1 -1
- package/build-module/store/{actions.js → actions.mjs} +8 -1
- package/build-module/store/{actions.js.map → actions.mjs.map} +2 -2
- package/build-module/store/{index.js → index.mjs} +4 -4
- package/build-module/store/{reducer.js → reducer.mjs} +8 -2
- package/build-module/store/reducer.mjs.map +7 -0
- package/build-module/store/{selectors.js → selectors.mjs} +5 -1
- package/build-module/store/{selectors.js.map → selectors.mjs.map} +2 -2
- package/build-module/store/types.mjs +1 -0
- package/build-style/style-rtl.css +39 -71
- package/build-style/style.css +39 -71
- package/build-types/components/app/index.d.ts +2 -1
- package/build-types/components/app/index.d.ts.map +1 -1
- package/build-types/components/app/router.d.ts.map +1 -1
- package/build-types/components/navigation/items.d.ts +1 -1
- package/build-types/components/root/index.d.ts.map +1 -1
- package/build-types/components/root/single-page.d.ts.map +1 -1
- package/build-types/components/site-hub/index.d.ts.map +1 -1
- package/build-types/components/site-icon-link/index.d.ts.map +1 -1
- package/build-types/components/user-theme-provider/index.d.ts +6 -0
- package/build-types/components/user-theme-provider/index.d.ts.map +1 -0
- package/build-types/store/actions.d.ts +5 -1
- package/build-types/store/actions.d.ts.map +1 -1
- package/build-types/store/reducer.d.ts.map +1 -1
- package/build-types/store/selectors.d.ts +1 -0
- package/build-types/store/selectors.d.ts.map +1 -1
- package/build-types/store/types.d.ts +1 -0
- package/build-types/store/types.d.ts.map +1 -1
- package/package.json +33 -25
- package/src/components/app/index.tsx +6 -0
- package/src/components/app/router.tsx +54 -51
- package/src/components/root/index.tsx +44 -49
- package/src/components/root/single-page.tsx +34 -32
- package/src/components/root/style.scss +1 -0
- package/src/components/site-hub/index.tsx +13 -3
- package/src/components/site-hub/style.scss +21 -6
- package/src/components/site-icon/style.scss +1 -1
- package/src/components/site-icon-link/index.tsx +18 -15
- package/src/components/user-theme-provider/index.tsx +35 -0
- package/src/components/user-theme-provider/test/index.test.ts +11 -0
- package/src/store/actions.ts +9 -1
- package/src/store/reducer.ts +7 -0
- package/src/store/selectors.ts +4 -0
- package/src/store/types.ts +1 -0
- package/src/style.scss +19 -34
- package/build-module/components/app/index.js.map +0 -7
- package/build-module/components/app/router.js.map +0 -7
- package/build-module/components/navigation/navigation-item/index.js +0 -180
- package/build-module/components/navigation/navigation-item/index.js.map +0 -7
- package/build-module/components/root/index.js +0 -433
- package/build-module/components/root/index.js.map +0 -7
- package/build-module/components/root/single-page.js +0 -334
- package/build-module/components/root/single-page.js.map +0 -7
- package/build-module/components/site-hub/index.js +0 -153
- package/build-module/components/site-hub/index.js.map +0 -7
- package/build-module/components/site-icon/index.js.map +0 -7
- package/build-module/components/site-icon-link/index.js.map +0 -7
- package/build-module/index.js +0 -740
- package/build-module/index.js.map +0 -7
- package/build-module/store/reducer.js.map +0 -7
- package/build-module/store/types.js +0 -1
- package/tsconfig.json +0 -27
- package/tsconfig.tsbuildinfo +0 -1
- /package/build-module/components/app/{use-route-title.js.map → use-route-title.mjs.map} +0 -0
- /package/build-module/components/canvas/{back-button.js.map → back-button.mjs.map} +0 -0
- /package/build-module/components/canvas/{index.js.map → index.mjs.map} +0 -0
- /package/build-module/components/canvas-renderer/{index.js.map → index.mjs.map} +0 -0
- /package/build-module/components/navigation/drilldown-item/{index.js.map → index.mjs.map} +0 -0
- /package/build-module/components/navigation/dropdown-item/{index.js.map → index.mjs.map} +0 -0
- /package/build-module/components/navigation/{index.js.map → index.mjs.map} +0 -0
- /package/build-module/components/navigation/{items.js.map → items.mjs.map} +0 -0
- /package/build-module/components/navigation/navigation-screen/{index.js.map → index.mjs.map} +0 -0
- /package/build-module/components/navigation/{path-matching.js.map → path-matching.mjs.map} +0 -0
- /package/build-module/components/navigation/{router-link-item.js.map → router-link-item.mjs.map} +0 -0
- /package/build-module/components/navigation/{use-sidebar-parent.js.map → use-sidebar-parent.mjs.map} +0 -0
- /package/build-module/components/save-button/{index.js.map → index.mjs.map} +0 -0
- /package/build-module/components/save-panel/{index.js.map → index.mjs.map} +0 -0
- /package/build-module/components/save-panel/{use-save-shortcut.js.map → use-save-shortcut.mjs.map} +0 -0
- /package/build-module/components/sidebar/{index.js.map → index.mjs.map} +0 -0
- /package/build-module/{lock-unlock.js.map → lock-unlock.mjs.map} +0 -0
- /package/build-module/store/{index.js.map → index.mjs.map} +0 -0
- /package/build-module/store/{types.js.map → types.mjs.map} +0 -0
package/build-style/style.css
CHANGED
|
@@ -140,18 +140,20 @@
|
|
|
140
140
|
--wpds-font-family-heading: -apple-system, system-ui, "Segoe UI", "Roboto",
|
|
141
141
|
"Oxygen-Sans", "Ubuntu", "Cantarell", "Helvetica Neue", sans-serif; /* Headings font family */
|
|
142
142
|
--wpds-font-family-mono: "Menlo", "Consolas", monaco, monospace; /* Monospace font family */
|
|
143
|
-
--wpds-font-line-height-
|
|
144
|
-
--wpds-font-line-height-
|
|
145
|
-
--wpds-font-line-height-
|
|
146
|
-
--wpds-font-line-height-
|
|
147
|
-
--wpds-font-line-height-
|
|
148
|
-
--wpds-font-line-height-
|
|
149
|
-
--wpds-font-size-
|
|
150
|
-
--wpds-font-size-
|
|
151
|
-
--wpds-font-size-
|
|
152
|
-
--wpds-font-size-
|
|
153
|
-
--wpds-font-size-
|
|
154
|
-
--wpds-font-size-
|
|
143
|
+
--wpds-font-line-height-2xl: 40px; /* 2X large line height */
|
|
144
|
+
--wpds-font-line-height-lg: 28px; /* Large line height */
|
|
145
|
+
--wpds-font-line-height-md: 24px; /* Medium line height */
|
|
146
|
+
--wpds-font-line-height-sm: 20px; /* Small line height */
|
|
147
|
+
--wpds-font-line-height-xl: 32px; /* Extra large line height */
|
|
148
|
+
--wpds-font-line-height-xs: 16px; /* Extra small line height */
|
|
149
|
+
--wpds-font-size-2xl: 32px; /* 2X large font size */
|
|
150
|
+
--wpds-font-size-lg: 15px; /* Large font size */
|
|
151
|
+
--wpds-font-size-md: 13px; /* Medium font size */
|
|
152
|
+
--wpds-font-size-sm: 12px; /* Small font size */
|
|
153
|
+
--wpds-font-size-xl: 20px; /* Extra large font size */
|
|
154
|
+
--wpds-font-size-xs: 11px; /* Extra small font size */
|
|
155
|
+
--wpds-font-weight-medium: 499; /* Medium font weight for emphasis and headings */
|
|
156
|
+
--wpds-font-weight-regular: 400; /* Regular font weight for body text */
|
|
155
157
|
}
|
|
156
158
|
|
|
157
159
|
[data-wpds-theme-provider-id][data-wpds-density=default] {
|
|
@@ -287,6 +289,10 @@
|
|
|
287
289
|
/**
|
|
288
290
|
* Reset the WP Admin page styles for Gutenberg-like pages.
|
|
289
291
|
*/
|
|
292
|
+
/**
|
|
293
|
+
* Creates a checkerboard pattern background to indicate transparency.
|
|
294
|
+
* @param {String} $size - The size of the squares in the checkerboard pattern. Default is 12px.
|
|
295
|
+
*/
|
|
290
296
|
.admin-ui-page {
|
|
291
297
|
display: flex;
|
|
292
298
|
height: 100%;
|
|
@@ -450,70 +456,32 @@
|
|
|
450
456
|
/**
|
|
451
457
|
* Reset the WP Admin page styles for Gutenberg-like pages.
|
|
452
458
|
*/
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
}
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
padding-bottom: 0;
|
|
467
|
-
}
|
|
468
|
-
body:has(.boot-layout-container) {
|
|
469
|
-
/* We hide legacy notices in Gutenberg Based Pages, because they were not designed in a way that scaled well.
|
|
470
|
-
Plugins can use Gutenberg notices if they need to pass on information to the user when they are editing. */
|
|
471
|
-
}
|
|
472
|
-
body:has(.boot-layout-container) #wpbody-content > div:not(.boot-layout-container):not(#screen-meta) {
|
|
473
|
-
display: none;
|
|
474
|
-
}
|
|
475
|
-
body:has(.boot-layout-container) #wpfooter {
|
|
476
|
-
display: none;
|
|
477
|
-
}
|
|
478
|
-
body:has(.boot-layout-container) .a11y-speak-region {
|
|
479
|
-
left: -1px;
|
|
480
|
-
top: -1px;
|
|
481
|
-
}
|
|
482
|
-
body:has(.boot-layout-container) ul#adminmenu a.wp-has-current-submenu::after,
|
|
483
|
-
body:has(.boot-layout-container) ul#adminmenu > li.current > a.current::after {
|
|
484
|
-
border-right-color: #fff;
|
|
485
|
-
}
|
|
486
|
-
body:has(.boot-layout-container) .media-frame select.attachment-filters:last-of-type {
|
|
487
|
-
width: auto;
|
|
488
|
-
max-width: 100%;
|
|
489
|
-
}
|
|
490
|
-
|
|
491
|
-
#wpcontent {
|
|
492
|
-
padding-left: 0;
|
|
493
|
-
}
|
|
494
|
-
|
|
495
|
-
#wpbody-content {
|
|
496
|
-
padding-bottom: 0;
|
|
497
|
-
}
|
|
498
|
-
|
|
499
|
-
#wpfooter {
|
|
500
|
-
display: none;
|
|
459
|
+
/**
|
|
460
|
+
* Creates a checkerboard pattern background to indicate transparency.
|
|
461
|
+
* @param {String} $size - The size of the squares in the checkerboard pattern. Default is 12px.
|
|
462
|
+
*/
|
|
463
|
+
@media (min-width: 600px) {
|
|
464
|
+
.boot-layout-container .boot-layout {
|
|
465
|
+
position: absolute;
|
|
466
|
+
top: 0;
|
|
467
|
+
right: 0;
|
|
468
|
+
bottom: 0;
|
|
469
|
+
left: 0;
|
|
470
|
+
min-height: calc(100vh - 46px);
|
|
471
|
+
}
|
|
501
472
|
}
|
|
502
|
-
|
|
503
473
|
@media (min-width: 782px) {
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
height: calc(100% + 32px);
|
|
474
|
+
.boot-layout-container .boot-layout {
|
|
475
|
+
min-height: calc(100vh - 32px);
|
|
507
476
|
}
|
|
508
|
-
body:has(.boot-layout.has-full-canvas)
|
|
509
|
-
|
|
510
|
-
display: none;
|
|
511
|
-
}
|
|
512
|
-
body:has(.boot-layout.has-full-canvas) #wpcontent,
|
|
513
|
-
body:has(.boot-layout.has-full-canvas) #wpfooter {
|
|
514
|
-
margin-left: 0;
|
|
477
|
+
body:has(.boot-layout.has-full-canvas) .boot-layout-container .boot-layout {
|
|
478
|
+
min-height: 100vh;
|
|
515
479
|
}
|
|
516
480
|
}
|
|
481
|
+
.boot-layout-container .boot-layout img {
|
|
482
|
+
max-width: 100%;
|
|
483
|
+
height: auto;
|
|
484
|
+
}
|
|
517
485
|
|
|
518
486
|
.boot-layout .components-editor-notices__snackbar {
|
|
519
487
|
position: fixed;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { MenuItem, Route } from '../../store/types';
|
|
2
|
-
export declare function init({ mountId, menuItems, routes, initModules, }: {
|
|
2
|
+
export declare function init({ mountId, menuItems, routes, initModules, dashboardLink, }: {
|
|
3
3
|
mountId: string;
|
|
4
4
|
menuItems?: MenuItem[];
|
|
5
5
|
routes?: Route[];
|
|
6
6
|
initModules?: string[];
|
|
7
|
+
dashboardLink?: string;
|
|
7
8
|
}): Promise<void>;
|
|
8
9
|
export declare function initSinglePage({ mountId, routes, }: {
|
|
9
10
|
mountId: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/app/index.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAQzD,wBAAsB,IAAI,CAAE,EAC3B,OAAO,EACP,SAAS,EACT,MAAM,EACN,WAAW,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/app/index.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAQzD,wBAAsB,IAAI,CAAE,EAC3B,OAAO,EACP,SAAS,EACT,MAAM,EACN,WAAW,EACX,aAAa,GACb,EAAE;IACF,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,QAAQ,EAAE,CAAC;IACvB,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;CACvB,iBA4BA;AAED,wBAAsB,cAAc,CAAE,EACrC,OAAO,EACP,MAAM,GACN,EAAE;IACF,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC;CACjB,iBAeA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../../src/components/app/router.tsx"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAmB3C,OAAO,KAAK,EAAE,KAAK,EAAmC,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../../src/components/app/router.tsx"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAmB3C,OAAO,KAAK,EAAE,KAAK,EAAmC,MAAM,mBAAmB,CAAC;AA4KhF,UAAU,WAAW;IACpB,MAAM,EAAE,KAAK,EAAE,CAAC;IAChB,aAAa,CAAC,EAAE,aAAa,CAAC;CAC9B;AAED,MAAM,CAAC,OAAO,UAAU,MAAM,CAAE,EAC/B,MAAM,EACN,aAAoB,GACpB,EAAE,WAAW,+BAiCb"}
|
|
@@ -12,5 +12,5 @@ import type { IconType } from '../../store/types';
|
|
|
12
12
|
* @param shouldShowPlaceholder - Whether to show placeholder when no icon is provided
|
|
13
13
|
* @return The converted icon as a JSX element
|
|
14
14
|
*/
|
|
15
|
-
export declare function wrapIcon(icon?: IconType, shouldShowPlaceholder?: boolean): string | number | true |
|
|
15
|
+
export declare function wrapIcon(icon?: IconType, shouldShowPlaceholder?: boolean): string | number | true | import("react").JSX.Element | Iterable<import("react").ReactNode> | null;
|
|
16
16
|
//# sourceMappingURL=items.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/root/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/root/index.tsx"],"names":[],"mappings":"AA+BA,OAAO,cAAc,CAAC;AAKtB,MAAM,CAAC,OAAO,UAAU,IAAI,gCAuJ3B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"single-page.d.ts","sourceRoot":"","sources":["../../../src/components/root/single-page.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"single-page.d.ts","sourceRoot":"","sources":["../../../src/components/root/single-page.tsx"],"names":[],"mappings":"AAmBA,OAAO,cAAc,CAAC;AAMtB;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,cAAc,gCAiDrC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/site-hub/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/site-hub/index.tsx"],"names":[],"mappings":"AAyBA,OAAO,cAAc,CAAC;AAEtB,iBAAS,OAAO,gCA+Cf;AAED,eAAe,OAAO,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/site-icon-link/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/site-icon-link/index.tsx"],"names":[],"mappings":"AAWA,OAAO,cAAc,CAAC;AAItB,iBAAS,YAAY,CAAE,EACtB,EAAE,EACF,YAAY,EACZ,GAAG,KAAK,EACR,EAAE;IACF,EAAE,EAAE,MAAM,CAAC;IACX,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,OAAO,CAAC;CACvB,+BAuBA;AAED,eAAe,YAAY,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type ThemeProvider as ThemeProviderType } from '@wordpress/theme';
|
|
2
|
+
declare const ThemeProvider: typeof ThemeProviderType;
|
|
3
|
+
export declare function getAdminThemePrimaryColor(): string | undefined;
|
|
4
|
+
export declare function UserThemeProvider({ color, ...restProps }: React.ComponentProps<typeof ThemeProvider>): import("react").JSX.Element;
|
|
5
|
+
export {};
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/user-theme-provider/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,aAAa,IAAI,iBAAiB,EAEvC,MAAM,kBAAkB,CAAC;AAG1B,QAAA,MAAM,aAAa,EAAE,OAAO,iBACa,CAAC;AAa1C,wBAAgB,yBAAyB,IAAI,MAAM,GAAG,SAAS,CAK9D;AAED,wBAAgB,iBAAiB,CAAE,EAClC,KAAK,EACL,GAAG,SAAS,EACZ,EAAE,KAAK,CAAC,cAAc,CAAE,OAAO,aAAa,CAAE,+BAI9C"}
|
|
@@ -16,5 +16,9 @@ export declare function registerRoute(route: Route): {
|
|
|
16
16
|
type: "REGISTER_ROUTE";
|
|
17
17
|
route: Route;
|
|
18
18
|
};
|
|
19
|
-
export
|
|
19
|
+
export declare function setDashboardLink(dashboardLink: string): {
|
|
20
|
+
type: "SET_DASHBOARD_LINK";
|
|
21
|
+
dashboardLink: string;
|
|
22
|
+
};
|
|
23
|
+
export type Action = ReturnType<typeof registerMenuItem> | ReturnType<typeof updateMenuItem> | ReturnType<typeof registerRoute> | ReturnType<typeof setDashboardLink>;
|
|
20
24
|
//# sourceMappingURL=actions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../src/store/actions.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAE/C,wBAAgB,gBAAgB,CAAE,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ;;;;EAM/D;AAED,wBAAgB,cAAc,CAAE,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,CAAE,QAAQ,CAAE;;;;EAMvE;AAED,wBAAgB,aAAa,CAAE,KAAK,EAAE,KAAK;;;EAK1C;AAED,MAAM,MAAM,MAAM,GACf,UAAU,CAAE,OAAO,gBAAgB,CAAE,GACrC,UAAU,CAAE,OAAO,cAAc,CAAE,GACnC,UAAU,CAAE,OAAO,aAAa,CAAE,CAAC"}
|
|
1
|
+
{"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../src/store/actions.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAE/C,wBAAgB,gBAAgB,CAAE,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ;;;;EAM/D;AAED,wBAAgB,cAAc,CAAE,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,CAAE,QAAQ,CAAE;;;;EAMvE;AAED,wBAAgB,aAAa,CAAE,KAAK,EAAE,KAAK;;;EAK1C;AAED,wBAAgB,gBAAgB,CAAE,aAAa,EAAE,MAAM;;;EAKtD;AAED,MAAM,MAAM,MAAM,GACf,UAAU,CAAE,OAAO,gBAAgB,CAAE,GACrC,UAAU,CAAE,OAAO,cAAc,CAAE,GACnC,UAAU,CAAE,OAAO,aAAa,CAAE,GAClC,UAAU,CAAE,OAAO,gBAAgB,CAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reducer.d.ts","sourceRoot":"","sources":["../../src/store/reducer.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"reducer.d.ts","sourceRoot":"","sources":["../../src/store/reducer.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAQrC,wBAAgB,OAAO,CAAE,KAAK,EAAE,KAAK,YAAe,EAAE,MAAM,EAAE,MAAM,GAAI,KAAK,CAqC5E"}
|
|
@@ -4,4 +4,5 @@
|
|
|
4
4
|
import type { State } from './types';
|
|
5
5
|
export declare function getMenuItems(state: State): import("./types").MenuItem[];
|
|
6
6
|
export declare function getRoutes(state: State): import("./types").Route[];
|
|
7
|
+
export declare function getDashboardLink(state: State): string | undefined;
|
|
7
8
|
//# sourceMappingURL=selectors.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"selectors.d.ts","sourceRoot":"","sources":["../../src/store/selectors.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAErC,wBAAgB,YAAY,CAAE,KAAK,EAAE,KAAK,gCAEzC;AAED,wBAAgB,SAAS,CAAE,KAAK,EAAE,KAAK,6BAEtC"}
|
|
1
|
+
{"version":3,"file":"selectors.d.ts","sourceRoot":"","sources":["../../src/store/selectors.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAErC,wBAAgB,YAAY,CAAE,KAAK,EAAE,KAAK,gCAEzC;AAED,wBAAgB,SAAS,CAAE,KAAK,EAAE,KAAK,6BAEtC;AAED,wBAAgB,gBAAgB,CAAE,KA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ACH,IAAI,EAAE,MAAM,CAAC;IAEb;;;;;;;OAOG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,KAAK;IACrB,SAAS,EAAE,MAAM,CAAE,MAAM,EAAE,QAAQ,CAAE,CAAC;IACtC,MAAM,EAAE,KAAK,EAAE,CAAC;IAChB,aAAa,CAAC,EAAE,MAAM,CAAC;CACvB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/boot",
|
|
3
|
-
"version": "0.4.0",
|
|
3
|
+
"version": "0.4.1-next.ba3aee3a2.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",
|
|
@@ -22,38 +22,46 @@
|
|
|
22
22
|
"node": ">=18.12.0",
|
|
23
23
|
"npm": ">=8.19.2"
|
|
24
24
|
},
|
|
25
|
-
"
|
|
25
|
+
"files": [
|
|
26
|
+
"src",
|
|
27
|
+
"build-module",
|
|
28
|
+
"build-style",
|
|
29
|
+
"build-types",
|
|
30
|
+
"*.md"
|
|
31
|
+
],
|
|
32
|
+
"module": "build-module/index.mjs",
|
|
26
33
|
"exports": {
|
|
27
34
|
".": {
|
|
28
35
|
"types": "./build-types/index.d.ts",
|
|
29
|
-
"import": "./build-module/index.
|
|
36
|
+
"import": "./build-module/index.mjs"
|
|
30
37
|
},
|
|
31
38
|
"./package.json": "./package.json"
|
|
32
39
|
},
|
|
33
40
|
"react-native": "src/index",
|
|
34
|
-
"wpScriptModuleExports": "./build-module/index.
|
|
41
|
+
"wpScriptModuleExports": "./build-module/index.mjs",
|
|
35
42
|
"types": "build-types",
|
|
36
43
|
"dependencies": {
|
|
37
|
-
"@wordpress/a11y": "^4.37.0",
|
|
38
|
-
"@wordpress/admin-ui": "^1.5.0",
|
|
39
|
-
"@wordpress/
|
|
40
|
-
"@wordpress/
|
|
41
|
-
"@wordpress/
|
|
42
|
-
"@wordpress/
|
|
43
|
-
"@wordpress/data": "^
|
|
44
|
-
"@wordpress/
|
|
45
|
-
"@wordpress/
|
|
46
|
-
"@wordpress/
|
|
47
|
-
"@wordpress/
|
|
48
|
-
"@wordpress/
|
|
49
|
-
"@wordpress/
|
|
50
|
-
"@wordpress/
|
|
51
|
-
"@wordpress/
|
|
52
|
-
"@wordpress/
|
|
53
|
-
"@wordpress/
|
|
54
|
-
"@wordpress/
|
|
55
|
-
"@wordpress/
|
|
56
|
-
"@wordpress/
|
|
44
|
+
"@wordpress/a11y": "^4.37.1-next.ba3aee3a2.0",
|
|
45
|
+
"@wordpress/admin-ui": "^1.5.1-next.ba3aee3a2.0",
|
|
46
|
+
"@wordpress/base-styles": "^6.13.2-next.ba3aee3a2.0",
|
|
47
|
+
"@wordpress/commands": "^1.37.1-next.ba3aee3a2.0",
|
|
48
|
+
"@wordpress/components": "^32.0.1-next.ba3aee3a2.0",
|
|
49
|
+
"@wordpress/compose": "^7.37.1-next.ba3aee3a2.0",
|
|
50
|
+
"@wordpress/core-data": "^7.37.1-next.ba3aee3a2.0",
|
|
51
|
+
"@wordpress/data": "^10.37.1-next.ba3aee3a2.0",
|
|
52
|
+
"@wordpress/editor": "^14.37.1-next.ba3aee3a2.0",
|
|
53
|
+
"@wordpress/element": "^6.37.1-next.ba3aee3a2.0",
|
|
54
|
+
"@wordpress/html-entities": "^4.37.1-next.ba3aee3a2.0",
|
|
55
|
+
"@wordpress/i18n": "^6.10.1-next.ba3aee3a2.0",
|
|
56
|
+
"@wordpress/icons": "^11.4.1-next.ba3aee3a2.0",
|
|
57
|
+
"@wordpress/keyboard-shortcuts": "^5.37.1-next.ba3aee3a2.0",
|
|
58
|
+
"@wordpress/keycodes": "^4.38.1-next.ba3aee3a2.0",
|
|
59
|
+
"@wordpress/lazy-editor": "^1.3.1-next.ba3aee3a2.0",
|
|
60
|
+
"@wordpress/primitives": "^4.37.1-next.ba3aee3a2.0",
|
|
61
|
+
"@wordpress/private-apis": "^1.37.1-next.ba3aee3a2.0",
|
|
62
|
+
"@wordpress/route": "^0.3.1-next.ba3aee3a2.0",
|
|
63
|
+
"@wordpress/theme": "^0.5.1-next.ba3aee3a2.0",
|
|
64
|
+
"@wordpress/url": "^4.37.1-next.ba3aee3a2.0",
|
|
57
65
|
"clsx": "^2.1.1"
|
|
58
66
|
},
|
|
59
67
|
"peerDependencies": {
|
|
@@ -63,5 +71,5 @@
|
|
|
63
71
|
"publishConfig": {
|
|
64
72
|
"access": "public"
|
|
65
73
|
},
|
|
66
|
-
"gitHead": "
|
|
74
|
+
"gitHead": "67d2e486fcd40c753591cf911ca0659132f519ca"
|
|
67
75
|
}
|
|
@@ -23,11 +23,13 @@ export async function init( {
|
|
|
23
23
|
menuItems,
|
|
24
24
|
routes,
|
|
25
25
|
initModules,
|
|
26
|
+
dashboardLink,
|
|
26
27
|
}: {
|
|
27
28
|
mountId: string;
|
|
28
29
|
menuItems?: MenuItem[];
|
|
29
30
|
routes?: Route[];
|
|
30
31
|
initModules?: string[];
|
|
32
|
+
dashboardLink?: string;
|
|
31
33
|
} ) {
|
|
32
34
|
( menuItems ?? [] ).forEach( ( menuItem ) => {
|
|
33
35
|
dispatch( store ).registerMenuItem( menuItem.id, menuItem );
|
|
@@ -37,6 +39,10 @@ export async function init( {
|
|
|
37
39
|
dispatch( store ).registerRoute( route );
|
|
38
40
|
} );
|
|
39
41
|
|
|
42
|
+
if ( dashboardLink ) {
|
|
43
|
+
dispatch( store ).setDashboardLink( dashboardLink );
|
|
44
|
+
}
|
|
45
|
+
|
|
40
46
|
for ( const moduleId of initModules ?? [] ) {
|
|
41
47
|
const module = await import( moduleId );
|
|
42
48
|
await module.init();
|
|
@@ -7,7 +7,7 @@ import type { ComponentType } from 'react';
|
|
|
7
7
|
* WordPress dependencies
|
|
8
8
|
*/
|
|
9
9
|
import { __ } from '@wordpress/i18n';
|
|
10
|
-
import {
|
|
10
|
+
import { useMemo } from '@wordpress/element';
|
|
11
11
|
import { Page } from '@wordpress/admin-ui';
|
|
12
12
|
import {
|
|
13
13
|
privateApis as routePrivateApis,
|
|
@@ -52,29 +52,33 @@ function NotFoundComponent() {
|
|
|
52
52
|
* @param parentRoute Parent route.
|
|
53
53
|
* @return Tanstack Route.
|
|
54
54
|
*/
|
|
55
|
-
|
|
56
|
-
route: Route,
|
|
57
|
-
parentRoute: AnyRoute
|
|
58
|
-
) {
|
|
59
|
-
let routeConfig: RouteConfig = {};
|
|
60
|
-
|
|
61
|
-
if ( route.route_module ) {
|
|
62
|
-
const module = await import( route.route_module );
|
|
63
|
-
routeConfig = module.route || {};
|
|
64
|
-
}
|
|
65
|
-
|
|
55
|
+
function createRouteFromDefinition( route: Route, parentRoute: AnyRoute ) {
|
|
66
56
|
// Create route without component initially
|
|
67
57
|
let tanstackRoute = createRoute( {
|
|
68
58
|
getParentRoute: () => parentRoute,
|
|
69
59
|
path: route.path,
|
|
70
|
-
beforeLoad:
|
|
71
|
-
|
|
72
|
-
|
|
60
|
+
beforeLoad: async ( opts: any ) => {
|
|
61
|
+
// Import route module here (lazy)
|
|
62
|
+
if ( route.route_module ) {
|
|
63
|
+
const module = await import( route.route_module );
|
|
64
|
+
const routeConfig = module.route || {};
|
|
65
|
+
|
|
66
|
+
if ( routeConfig.beforeLoad ) {
|
|
67
|
+
return routeConfig.beforeLoad( {
|
|
73
68
|
params: opts.params || {},
|
|
74
69
|
search: opts.search || {},
|
|
75
|
-
} )
|
|
76
|
-
|
|
70
|
+
} );
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
},
|
|
77
74
|
loader: async ( opts: any ) => {
|
|
75
|
+
// Import route module here (lazy)
|
|
76
|
+
let routeConfig: RouteConfig = {};
|
|
77
|
+
if ( route.route_module ) {
|
|
78
|
+
const module = await import( route.route_module );
|
|
79
|
+
routeConfig = module.route || {};
|
|
80
|
+
}
|
|
81
|
+
|
|
78
82
|
const context: RouteLoaderContext = {
|
|
79
83
|
params: opts.params || {},
|
|
80
84
|
search: opts.deps || {},
|
|
@@ -154,7 +158,7 @@ async function createRouteFromDefinition(
|
|
|
154
158
|
* @param rootComponent Root component to use for the router.
|
|
155
159
|
* @return Router tree.
|
|
156
160
|
*/
|
|
157
|
-
|
|
161
|
+
function createRouteTree(
|
|
158
162
|
routes: Route[],
|
|
159
163
|
rootComponent: ComponentType = Root
|
|
160
164
|
) {
|
|
@@ -163,9 +167,9 @@ async function createRouteTree(
|
|
|
163
167
|
context: () => ( {} ),
|
|
164
168
|
} );
|
|
165
169
|
|
|
166
|
-
// Create routes from definitions
|
|
167
|
-
const dynamicRoutes =
|
|
168
|
-
|
|
170
|
+
// Create routes from definitions (now synchronous)
|
|
171
|
+
const dynamicRoutes = routes.map( ( route ) =>
|
|
172
|
+
createRouteFromDefinition( route, rootRoute )
|
|
169
173
|
);
|
|
170
174
|
|
|
171
175
|
return rootRoute.addChildren( dynamicRoutes );
|
|
@@ -197,37 +201,36 @@ export default function Router( {
|
|
|
197
201
|
routes,
|
|
198
202
|
rootComponent = Root,
|
|
199
203
|
}: RouterProps ) {
|
|
200
|
-
const
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
204
|
+
const router = useMemo( () => {
|
|
205
|
+
const history = createPathHistory();
|
|
206
|
+
const routeTree = createRouteTree( routes, rootComponent );
|
|
207
|
+
|
|
208
|
+
return createRouter( {
|
|
209
|
+
history,
|
|
210
|
+
routeTree,
|
|
211
|
+
defaultPreload: 'intent',
|
|
212
|
+
defaultNotFoundComponent: NotFoundComponent,
|
|
213
|
+
defaultViewTransition: {
|
|
214
|
+
types: ( {
|
|
215
|
+
fromLocation,
|
|
216
|
+
}: {
|
|
217
|
+
fromLocation?: unknown;
|
|
218
|
+
toLocation: unknown;
|
|
219
|
+
pathChanged: boolean;
|
|
220
|
+
hrefChanged: boolean;
|
|
221
|
+
hashChanged: boolean;
|
|
222
|
+
} ) => {
|
|
223
|
+
// Disable view transition on initial navigation (no previous location)
|
|
224
|
+
if ( ! fromLocation ) {
|
|
225
|
+
return false;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
// Enable with navigation type for subsequent navigations
|
|
229
|
+
return [ 'navigate' ];
|
|
230
|
+
},
|
|
231
|
+
},
|
|
232
|
+
} );
|
|
226
233
|
}, [ routes, rootComponent ] );
|
|
227
234
|
|
|
228
|
-
if ( ! router ) {
|
|
229
|
-
return <div>Loading routes...</div>;
|
|
230
|
-
}
|
|
231
|
-
|
|
232
235
|
return <RouterProvider router={ router } />;
|
|
233
236
|
}
|
|
@@ -7,9 +7,6 @@ import clsx from 'clsx';
|
|
|
7
7
|
* WordPress dependencies
|
|
8
8
|
*/
|
|
9
9
|
import { privateApis as routePrivateApis } from '@wordpress/route';
|
|
10
|
-
// @ts-expect-error Commands is not typed properly.
|
|
11
|
-
import { CommandMenu } from '@wordpress/commands';
|
|
12
|
-
import { privateApis as themePrivateApis } from '@wordpress/theme';
|
|
13
10
|
import { EditorSnackbars } from '@wordpress/editor';
|
|
14
11
|
import { useViewportMatch, useReducedMotion } from '@wordpress/compose';
|
|
15
12
|
import {
|
|
@@ -33,8 +30,8 @@ import useRouteTitle from '../app/use-route-title';
|
|
|
33
30
|
import { unlock } from '../../lock-unlock';
|
|
34
31
|
import type { CanvasData } from '../../store/types';
|
|
35
32
|
import './style.scss';
|
|
33
|
+
import { UserThemeProvider } from '../user-theme-provider';
|
|
36
34
|
|
|
37
|
-
const { ThemeProvider } = unlock( themePrivateApis );
|
|
38
35
|
const { useLocation, useMatches, Outlet } = unlock( routePrivateApis );
|
|
39
36
|
|
|
40
37
|
export default function Root() {
|
|
@@ -62,18 +59,14 @@ export default function Root() {
|
|
|
62
59
|
|
|
63
60
|
return (
|
|
64
61
|
<SlotFillProvider>
|
|
65
|
-
<
|
|
66
|
-
|
|
67
|
-
color={ { bg: '#f8f8f8', primary: '#3858e9' } }
|
|
68
|
-
>
|
|
69
|
-
<ThemeProvider color={ { bg: '#1d2327', primary: '#3858e9' } }>
|
|
62
|
+
<UserThemeProvider isRoot color={ { bg: '#f8f8f8' } }>
|
|
63
|
+
<UserThemeProvider color={ { bg: '#1d2327' } }>
|
|
70
64
|
<div
|
|
71
65
|
className={ clsx( 'boot-layout', {
|
|
72
66
|
'has-canvas': !! canvas || canvas === null,
|
|
73
67
|
'has-full-canvas': isFullScreen,
|
|
74
68
|
} ) }
|
|
75
69
|
>
|
|
76
|
-
<CommandMenu />
|
|
77
70
|
<SavePanel />
|
|
78
71
|
<EditorSnackbars />
|
|
79
72
|
{ isMobileViewport && (
|
|
@@ -146,48 +139,50 @@ export default function Root() {
|
|
|
146
139
|
</div>
|
|
147
140
|
) }
|
|
148
141
|
<div className="boot-layout__surfaces">
|
|
149
|
-
<
|
|
150
|
-
color={ { bg: '#ffffff', primary: '#3858e9' } }
|
|
151
|
-
>
|
|
142
|
+
<UserThemeProvider color={ { bg: '#ffffff' } }>
|
|
152
143
|
<Outlet />
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
144
|
+
{ /* Render Canvas in Root to prevent remounting on route changes */ }
|
|
145
|
+
{ ( canvas || canvas === null ) && (
|
|
146
|
+
<div
|
|
147
|
+
className={ clsx(
|
|
148
|
+
'boot-layout__canvas',
|
|
149
|
+
{
|
|
150
|
+
'has-mobile-drawer':
|
|
151
|
+
canvas?.isPreview &&
|
|
152
|
+
isMobileViewport,
|
|
153
|
+
}
|
|
154
|
+
) }
|
|
155
|
+
>
|
|
156
|
+
{ canvas?.isPreview &&
|
|
157
|
+
isMobileViewport && (
|
|
158
|
+
<div className="boot-layout__mobile-sidebar-drawer">
|
|
159
|
+
<Button
|
|
160
|
+
icon={ menu }
|
|
161
|
+
onClick={ () =>
|
|
162
|
+
setIsMobileSidebarOpen(
|
|
163
|
+
true
|
|
164
|
+
)
|
|
165
|
+
}
|
|
166
|
+
label={ __(
|
|
167
|
+
'Open navigation panel'
|
|
168
|
+
) }
|
|
169
|
+
size="compact"
|
|
170
|
+
/>
|
|
171
|
+
</div>
|
|
172
|
+
) }
|
|
173
|
+
<CanvasRenderer
|
|
174
|
+
canvas={ canvas }
|
|
175
|
+
routeContentModule={
|
|
176
|
+
routeContentModule
|
|
177
|
+
}
|
|
178
|
+
/>
|
|
179
|
+
</div>
|
|
180
|
+
) }
|
|
181
|
+
</UserThemeProvider>
|
|
187
182
|
</div>
|
|
188
183
|
</div>
|
|
189
|
-
</
|
|
190
|
-
</
|
|
184
|
+
</UserThemeProvider>
|
|
185
|
+
</UserThemeProvider>
|
|
191
186
|
</SlotFillProvider>
|
|
192
187
|
);
|
|
193
188
|
}
|