@wordpress/boot 0.2.0 → 0.2.1-next.dc3f6d3c1.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.js +6 -1
- package/build-module/components/app/index.js.map +2 -2
- package/build-module/components/app/router.js +42 -27
- package/build-module/components/app/router.js.map +2 -2
- package/build-module/components/canvas/back-button.js +1 -1
- package/build-module/components/canvas/back-button.js.map +1 -1
- package/build-module/components/canvas/index.js +42 -17
- package/build-module/components/canvas/index.js.map +2 -2
- package/build-module/components/navigation/dropdown-item/index.js +1 -1
- package/build-module/components/navigation/dropdown-item/index.js.map +1 -1
- package/build-module/components/navigation/navigation-item/index.js +1 -1
- package/build-module/components/navigation/navigation-item/index.js.map +1 -1
- package/build-module/components/navigation/navigation-screen/index.js +1 -1
- package/build-module/components/navigation/navigation-screen/index.js.map +1 -1
- package/build-module/components/navigation/router-link-item.js +3 -1
- package/build-module/components/navigation/router-link-item.js.map +2 -2
- package/build-module/components/navigation/use-sidebar-parent.js +3 -1
- package/build-module/components/navigation/use-sidebar-parent.js.map +2 -2
- package/build-module/components/root/index.js +6 -9
- package/build-module/components/root/index.js.map +2 -2
- package/build-module/components/root/single-page.js +6 -9
- package/build-module/components/root/single-page.js.map +2 -2
- package/build-module/components/save-button/index.js +116 -0
- package/build-module/components/save-button/index.js.map +7 -0
- package/build-module/components/sidebar/index.js +8 -2
- package/build-module/components/sidebar/index.js.map +2 -2
- package/build-module/components/site-hub/index.js +1 -1
- package/build-module/components/site-hub/index.js.map +1 -1
- package/build-module/components/site-icon/index.js +1 -1
- package/build-module/components/site-icon/index.js.map +1 -1
- package/build-module/components/site-icon-link/index.js +4 -2
- package/build-module/components/site-icon-link/index.js.map +2 -2
- package/build-module/index.js +75 -53
- package/build-module/index.js.map +2 -2
- package/build-module/store/actions.js +9 -1
- package/build-module/store/actions.js.map +2 -2
- package/build-module/store/reducer.js +11 -0
- package/build-module/store/reducer.js.map +2 -2
- package/build-style/style-rtl.css +71 -51
- package/build-style/style.css +71 -51
- 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 +3 -0
- package/build-types/components/app/router.d.ts.map +1 -1
- package/build-types/components/canvas/index.d.ts.map +1 -1
- package/build-types/components/navigation/router-link-item.d.ts +1 -3
- package/build-types/components/navigation/router-link-item.d.ts.map +1 -1
- package/build-types/components/navigation/use-sidebar-parent.d.ts.map +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/save-button/index.d.ts +6 -0
- package/build-types/components/save-button/index.d.ts.map +1 -0
- package/build-types/components/sidebar/index.d.ts.map +1 -1
- package/build-types/components/site-icon-link/index.d.ts.map +1 -1
- package/build-types/index.d.ts +1 -0
- package/build-types/index.d.ts.map +1 -1
- package/build-types/store/actions.d.ts +6 -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/types.d.ts +23 -3
- package/build-types/store/types.d.ts.map +1 -1
- package/package.json +21 -22
- package/src/components/app/index.tsx +7 -0
- package/src/components/app/router.tsx +67 -35
- package/src/components/canvas/index.tsx +35 -11
- package/src/components/navigation/router-link-item.tsx +8 -1
- package/src/components/navigation/use-sidebar-parent.ts +8 -5
- package/src/components/root/index.tsx +4 -8
- package/src/components/root/single-page.tsx +4 -8
- package/src/components/save-button/index.tsx +121 -0
- package/src/components/save-button/style.scss +3 -0
- package/src/components/sidebar/index.tsx +4 -0
- package/src/components/sidebar/style.scss +4 -0
- package/src/components/site-icon-link/index.tsx +5 -2
- package/src/index.tsx +1 -0
- package/src/store/actions.ts +9 -0
- package/src/store/reducer.ts +12 -0
- package/src/store/types.ts +25 -3
- package/tsconfig.json +1 -0
- package/tsconfig.tsbuildinfo +1 -1
package/src/store/actions.ts
CHANGED
|
@@ -11,6 +11,14 @@ export function registerMenuItem( id: string, menuItem: MenuItem ) {
|
|
|
11
11
|
};
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
+
export function updateMenuItem( id: string, updates: Partial< MenuItem > ) {
|
|
15
|
+
return {
|
|
16
|
+
type: 'UPDATE_MENU_ITEM' as const,
|
|
17
|
+
id,
|
|
18
|
+
updates,
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
|
|
14
22
|
export function registerRoute( route: Route ) {
|
|
15
23
|
return {
|
|
16
24
|
type: 'REGISTER_ROUTE' as const,
|
|
@@ -20,4 +28,5 @@ export function registerRoute( route: Route ) {
|
|
|
20
28
|
|
|
21
29
|
export type Action =
|
|
22
30
|
| ReturnType< typeof registerMenuItem >
|
|
31
|
+
| ReturnType< typeof updateMenuItem >
|
|
23
32
|
| ReturnType< typeof registerRoute >;
|
package/src/store/reducer.ts
CHANGED
|
@@ -20,6 +20,18 @@ export function reducer( state: State = initialState, action: Action ): State {
|
|
|
20
20
|
},
|
|
21
21
|
};
|
|
22
22
|
|
|
23
|
+
case 'UPDATE_MENU_ITEM':
|
|
24
|
+
return {
|
|
25
|
+
...state,
|
|
26
|
+
menuItems: {
|
|
27
|
+
...state.menuItems,
|
|
28
|
+
[ action.id ]: {
|
|
29
|
+
...state.menuItems[ action.id ],
|
|
30
|
+
...action.updates,
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
|
|
23
35
|
case 'REGISTER_ROUTE':
|
|
24
36
|
return {
|
|
25
37
|
...state,
|
package/src/store/types.ts
CHANGED
|
@@ -42,9 +42,25 @@ export interface RouteLoaderContext {
|
|
|
42
42
|
* Canvas data returned by route's canvas function.
|
|
43
43
|
*/
|
|
44
44
|
export interface CanvasData {
|
|
45
|
+
/**
|
|
46
|
+
* Post type to render in the canvas.
|
|
47
|
+
*/
|
|
45
48
|
postType: string;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Post ID to render in the canvas.
|
|
52
|
+
*/
|
|
46
53
|
postId: string;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Indicates if the canvas is in preview mode.
|
|
57
|
+
*/
|
|
47
58
|
isPreview?: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Optional edit link for click-to-edit navigation.
|
|
61
|
+
* When provided with isPreview: true, clicking the canvas navigates to this URL.
|
|
62
|
+
*/
|
|
63
|
+
editLink?: string;
|
|
48
64
|
}
|
|
49
65
|
|
|
50
66
|
/**
|
|
@@ -58,8 +74,11 @@ export interface Route {
|
|
|
58
74
|
path: string;
|
|
59
75
|
|
|
60
76
|
/**
|
|
61
|
-
* Module path for lazy loading the route's surfaces
|
|
62
|
-
* The module
|
|
77
|
+
* Module path for lazy loading the route's surfaces.
|
|
78
|
+
* The module can export:
|
|
79
|
+
* - stage?: Main content component (ComponentType)
|
|
80
|
+
* - inspector?: Sidebar component (ComponentType)
|
|
81
|
+
* - canvas?: Custom canvas component (ComponentType)
|
|
63
82
|
* This enables code splitting for better performance.
|
|
64
83
|
*/
|
|
65
84
|
content_module?: string;
|
|
@@ -69,7 +88,10 @@ export interface Route {
|
|
|
69
88
|
* The module should export a named export `route` containing:
|
|
70
89
|
* - beforeLoad?: Pre-navigation hook (authentication, validation, redirects)
|
|
71
90
|
* - loader?: Data preloading function
|
|
72
|
-
* - canvas?: Function that returns canvas data for rendering
|
|
91
|
+
* - canvas?: Function that returns canvas data for rendering
|
|
92
|
+
* - Returns CanvasData to use default editor canvas
|
|
93
|
+
* - Returns null to use custom canvas component from content_module
|
|
94
|
+
* - Returns undefined to show no canvas
|
|
73
95
|
*/
|
|
74
96
|
route_module?: string;
|
|
75
97
|
}
|