@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.
Files changed (75) hide show
  1. package/build-module/components/app/index.mjs +29 -53
  2. package/build-module/components/app/index.mjs.map +1 -7
  3. package/build-module/components/app/router.mjs +238 -214
  4. package/build-module/components/app/router.mjs.map +1 -7
  5. package/build-module/components/app/use-route-title.mjs +35 -42
  6. package/build-module/components/app/use-route-title.mjs.map +1 -7
  7. package/build-module/components/canvas/back-button.mjs +21 -20
  8. package/build-module/components/canvas/back-button.mjs.map +1 -7
  9. package/build-module/components/canvas/index.mjs +104 -130
  10. package/build-module/components/canvas/index.mjs.map +1 -7
  11. package/build-module/components/canvas/site-preview.mjs +36 -43
  12. package/build-module/components/canvas/site-preview.mjs.map +1 -7
  13. package/build-module/components/canvas/use-navigate-to-entity-record.mjs +109 -113
  14. package/build-module/components/canvas/use-navigate-to-entity-record.mjs.map +1 -7
  15. package/build-module/components/canvas/viewport.mjs +25 -13
  16. package/build-module/components/canvas/viewport.mjs.map +1 -7
  17. package/build-module/components/canvas-renderer/index.mjs +40 -32
  18. package/build-module/components/canvas-renderer/index.mjs.map +1 -7
  19. package/build-module/components/error-boundary/index.mjs +161 -109
  20. package/build-module/components/error-boundary/index.mjs.map +1 -7
  21. package/build-module/components/navigation/drilldown-item/index.mjs +124 -127
  22. package/build-module/components/navigation/drilldown-item/index.mjs.map +1 -7
  23. package/build-module/components/navigation/dropdown-item/index.mjs +156 -173
  24. package/build-module/components/navigation/dropdown-item/index.mjs.map +1 -7
  25. package/build-module/components/navigation/index.mjs +55 -90
  26. package/build-module/components/navigation/index.mjs.map +1 -7
  27. package/build-module/components/navigation/items.mjs +51 -53
  28. package/build-module/components/navigation/items.mjs.map +1 -7
  29. package/build-module/components/navigation/navigation-item/index.mjs +120 -114
  30. package/build-module/components/navigation/navigation-item/index.mjs.map +1 -7
  31. package/build-module/components/navigation/navigation-screen/index.mjs +192 -185
  32. package/build-module/components/navigation/navigation-screen/index.mjs.map +1 -7
  33. package/build-module/components/navigation/path-matching.mjs +74 -73
  34. package/build-module/components/navigation/path-matching.mjs.map +1 -7
  35. package/build-module/components/navigation/router-link-item.mjs +13 -11
  36. package/build-module/components/navigation/router-link-item.mjs.map +1 -7
  37. package/build-module/components/navigation/use-sidebar-parent.mjs +37 -48
  38. package/build-module/components/navigation/use-sidebar-parent.mjs.map +1 -7
  39. package/build-module/components/plugin-area/index.mjs +20 -24
  40. package/build-module/components/plugin-area/index.mjs.map +1 -7
  41. package/build-module/components/root/index.mjs +228 -243
  42. package/build-module/components/root/index.mjs.map +1 -7
  43. package/build-module/components/root/single-page.mjs +174 -148
  44. package/build-module/components/root/single-page.mjs.map +1 -7
  45. package/build-module/components/root/use-sync-body-background.mjs +28 -22
  46. package/build-module/components/root/use-sync-body-background.mjs.map +1 -7
  47. package/build-module/components/save-button/index.mjs +170 -214
  48. package/build-module/components/save-button/index.mjs.map +1 -7
  49. package/build-module/components/save-panel/index.mjs +110 -106
  50. package/build-module/components/save-panel/index.mjs.map +1 -7
  51. package/build-module/components/save-panel/use-save-shortcut.mjs +42 -51
  52. package/build-module/components/save-panel/use-save-shortcut.mjs.map +1 -7
  53. package/build-module/components/sidebar/index.mjs +126 -104
  54. package/build-module/components/sidebar/index.mjs.map +1 -7
  55. package/build-module/index.mjs +1 -7
  56. package/build-module/lock-unlock.mjs +5 -10
  57. package/build-module/lock-unlock.mjs.map +1 -7
  58. package/build-module/store/actions.mjs +34 -31
  59. package/build-module/store/actions.mjs.map +1 -7
  60. package/build-module/store/index.mjs +9 -11
  61. package/build-module/store/index.mjs.map +1 -7
  62. package/build-module/store/reducer.mjs +48 -55
  63. package/build-module/store/reducer.mjs.map +1 -7
  64. package/build-module/store/selectors.mjs +21 -16
  65. package/build-module/store/selectors.mjs.map +1 -7
  66. package/build-module/store/types.mjs +0 -1
  67. package/build-types/components/error-boundary/index.d.ts.map +1 -1
  68. package/build-types/components/root/index.d.ts.map +1 -1
  69. package/package.json +28 -28
  70. package/src/components/error-boundary/index.tsx +52 -6
  71. package/src/components/navigation/navigation-screen/index.tsx +2 -2
  72. package/src/components/root/_layout.module.scss +1 -1
  73. package/src/components/root/index.tsx +7 -3
  74. package/build-module/index.mjs.map +0 -7
  75. package/build-module/store/types.mjs.map +0 -7
@@ -1,127 +1,149 @@
1
- // packages/boot/src/components/sidebar/index.tsx
2
1
  import { Button } from "@wordpress/components";
3
2
  import { useSelect } from "@wordpress/data";
4
3
  import { __, isRTL } from "@wordpress/i18n";
5
4
  import { chevronLeft, chevronRight } from "@wordpress/icons";
6
5
  import Navigation from "../navigation/index.mjs";
7
6
  import SaveButton from "../save-button/index.mjs";
8
- import { store as bootStore } from "../../store/index.mjs";
9
-
7
+ import { store } from "../../store/index.mjs";
8
+ import { jsx, jsxs } from "react/jsx-runtime";
10
9
  // packages/style-runtime/src/index.ts
11
- var STYLE_HASH_ATTRIBUTE = "data-wp-hash";
10
+ const STYLE_HASH_ATTRIBUTE = "data-wp-hash";
11
+ /**
12
+ * Returns the shared style runtime registry.
13
+ *
14
+ * The registry is stored on `globalThis` so separately bundled copies of this
15
+ * package can coordinate through the same document and style maps.
16
+ *
17
+ * @return The shared runtime registry.
18
+ */
12
19
  function getRuntime() {
13
- const globalScope = globalThis;
14
- if (globalScope.__wpStyleRuntime) {
15
- return globalScope.__wpStyleRuntime;
16
- }
17
- globalScope.__wpStyleRuntime = {
18
- documents: /* @__PURE__ */ new Map(),
19
- styles: /* @__PURE__ */ new Map(),
20
- injectedStyles: /* @__PURE__ */ new WeakMap()
21
- };
22
- if (typeof document !== "undefined") {
23
- registerDocument(document);
24
- }
25
- return globalScope.__wpStyleRuntime;
20
+ const globalScope = globalThis;
21
+ if (globalScope.__wpStyleRuntime) return globalScope.__wpStyleRuntime;
22
+ globalScope.__wpStyleRuntime = {
23
+ documents: /* @__PURE__ */ new Map(),
24
+ styles: /* @__PURE__ */ new Map(),
25
+ injectedStyles: /* @__PURE__ */ new WeakMap()
26
+ };
27
+ if (typeof document !== "undefined") registerDocument(document);
28
+ return globalScope.__wpStyleRuntime;
26
29
  }
30
+ /**
31
+ * Checks whether a document already contains a style tag for a hash.
32
+ *
33
+ * @param targetDocument Document to inspect.
34
+ * @param hash Stable hash for the transformed CSS.
35
+ *
36
+ * @return Whether the style hash already exists in the document.
37
+ */
27
38
  function documentContainsStyleHash(targetDocument, hash) {
28
- if (!targetDocument.head) {
29
- return false;
30
- }
31
- for (const style of targetDocument.head.querySelectorAll(
32
- `style[${STYLE_HASH_ATTRIBUTE}]`
33
- )) {
34
- if (style.getAttribute(STYLE_HASH_ATTRIBUTE) === hash) {
35
- return true;
36
- }
37
- }
38
- return false;
39
+ if (!targetDocument.head) return false;
40
+ for (const style of targetDocument.head.querySelectorAll(`style[${STYLE_HASH_ATTRIBUTE}]`)) if (style.getAttribute(STYLE_HASH_ATTRIBUTE) === hash) return true;
41
+ return false;
39
42
  }
43
+ /**
44
+ * Injects a registered style into a document, unless that document already
45
+ * contains a style tag for the same hash.
46
+ *
47
+ * @param targetDocument Document to inject the style into.
48
+ * @param hash Stable hash for the transformed CSS.
49
+ * @param css CSS text to inject.
50
+ */
40
51
  function injectStyle(targetDocument, hash, css) {
41
- if (!targetDocument.head) {
42
- return;
43
- }
44
- const runtime = getRuntime();
45
- let injectedStyles = runtime.injectedStyles.get(targetDocument);
46
- if (!injectedStyles) {
47
- injectedStyles = /* @__PURE__ */ new Set();
48
- runtime.injectedStyles.set(targetDocument, injectedStyles);
49
- }
50
- if (injectedStyles.has(hash)) {
51
- return;
52
- }
53
- if (documentContainsStyleHash(targetDocument, hash)) {
54
- injectedStyles.add(hash);
55
- return;
56
- }
57
- const style = targetDocument.createElement("style");
58
- style.setAttribute(STYLE_HASH_ATTRIBUTE, hash);
59
- style.appendChild(targetDocument.createTextNode(css));
60
- targetDocument.head.appendChild(style);
61
- injectedStyles.add(hash);
52
+ if (!targetDocument.head) return;
53
+ const runtime = getRuntime();
54
+ let injectedStyles = runtime.injectedStyles.get(targetDocument);
55
+ if (!injectedStyles) {
56
+ injectedStyles = /* @__PURE__ */ new Set();
57
+ runtime.injectedStyles.set(targetDocument, injectedStyles);
58
+ }
59
+ if (injectedStyles.has(hash)) return;
60
+ if (documentContainsStyleHash(targetDocument, hash)) {
61
+ injectedStyles.add(hash);
62
+ return;
63
+ }
64
+ const style = targetDocument.createElement("style");
65
+ style.setAttribute(STYLE_HASH_ATTRIBUTE, hash);
66
+ style.appendChild(targetDocument.createTextNode(css));
67
+ targetDocument.head.appendChild(style);
68
+ injectedStyles.add(hash);
62
69
  }
70
+ /**
71
+ * Registers a document as a style injection target.
72
+ *
73
+ * Existing registered styles are replayed into the document immediately.
74
+ * Documents are reference-counted so multiple providers can safely register the
75
+ * same document without one cleanup removing it while another registration is
76
+ * still active.
77
+ *
78
+ * @param targetDocument Document to receive registered styles.
79
+ * @return Cleanup function that unregisters this document registration.
80
+ */
63
81
  function registerDocument(targetDocument) {
64
- const runtime = getRuntime();
65
- runtime.documents.set(
66
- targetDocument,
67
- (runtime.documents.get(targetDocument) ?? 0) + 1
68
- );
69
- for (const [hash, css] of runtime.styles) {
70
- injectStyle(targetDocument, hash, css);
71
- }
72
- return () => {
73
- const count = runtime.documents.get(targetDocument);
74
- if (count === void 0) {
75
- return;
76
- }
77
- if (count <= 1) {
78
- runtime.documents.delete(targetDocument);
79
- return;
80
- }
81
- runtime.documents.set(targetDocument, count - 1);
82
- };
82
+ const runtime = getRuntime();
83
+ runtime.documents.set(targetDocument, (runtime.documents.get(targetDocument) ?? 0) + 1);
84
+ for (const [hash, css] of runtime.styles) injectStyle(targetDocument, hash, css);
85
+ return () => {
86
+ const count = runtime.documents.get(targetDocument);
87
+ if (count === void 0) return;
88
+ if (count <= 1) {
89
+ runtime.documents.delete(targetDocument);
90
+ return;
91
+ }
92
+ runtime.documents.set(targetDocument, count - 1);
93
+ };
83
94
  }
95
+ /**
96
+ * Registers a style and injects it into all registered documents.
97
+ *
98
+ * The hash is used as the deduplication key, so calling this repeatedly with
99
+ * the same hash will not add duplicate style tags to a document.
100
+ * Registered styles are retained for the lifetime of the page so they can be
101
+ * replayed into documents that are registered later.
102
+ *
103
+ * @param hash Stable hash for the transformed CSS.
104
+ * @param css CSS text to inject.
105
+ */
84
106
  function registerStyle(hash, css) {
85
- const runtime = getRuntime();
86
- runtime.styles.set(hash, css);
87
- for (const targetDocument of runtime.documents.keys()) {
88
- injectStyle(targetDocument, hash, css);
89
- }
107
+ const runtime = getRuntime();
108
+ runtime.styles.set(hash, css);
109
+ for (const targetDocument of runtime.documents.keys()) injectStyle(targetDocument, hash, css);
90
110
  }
91
-
92
111
  // packages/boot/src/components/sidebar/style.module.scss
93
- if (typeof process === "undefined" || process.env.NODE_ENV !== "test") {
94
- registerStyle("2f8ba86269", "._52f77809bed01e5e__scrollable{display:flex;flex-direction:column;height:100%;overflow:auto;position:relative}._6d2e23af506664fb__content{contain:content;flex-grow:1;position:relative}.c95a8ac9c6876d6e__footer{padding-block-end:8px;padding-block-start:16px;padding-inline-end:8px;padding-inline-start:16px}._28ec24681975e557__back-button{margin-block-end:8px;margin-block-start:16px;margin-inline-end:12px;margin-inline-start:12px}");
95
- }
96
- var style_module_default = { "scrollable": "_52f77809bed01e5e__scrollable", "content": "_6d2e23af506664fb__content", "footer": "c95a8ac9c6876d6e__footer", "back-button": "_28ec24681975e557__back-button" };
97
-
112
+ if (typeof process === "undefined" || process.env.NODE_ENV !== "test") registerStyle("040f861d87", ".e805c0d27c9fe7b6__scrollable{display:flex;flex-direction:column;height:100%;overflow:auto;position:relative}._16abc09ab6556b14__content{contain:content;flex-grow:1;position:relative}._7d16636622fe90e5__footer{padding-block-end:8px;padding-block-start:16px;padding-inline-end:8px;padding-inline-start:16px}._6058c5869f31f9bd__back-button{margin-block-end:8px;margin-block-start:16px;margin-inline-end:12px;margin-inline-start:12px}");
113
+ var style_module_default = {
114
+ "scrollable": "e805c0d27c9fe7b6__scrollable",
115
+ "content": "_16abc09ab6556b14__content",
116
+ "footer": "_7d16636622fe90e5__footer",
117
+ "back-button": "_6058c5869f31f9bd__back-button"
118
+ };
98
119
  // packages/boot/src/components/sidebar/index.tsx
99
- import { jsx, jsxs } from "react/jsx-runtime";
100
120
  function DashboardBackButton() {
101
- const dashboardLink = useSelect(
102
- (select) => select(bootStore).getDashboardLink(),
103
- []
104
- );
105
- return /* @__PURE__ */ jsx(
106
- Button,
107
- {
108
- __next40pxDefaultSize: true,
109
- className: style_module_default["back-button"],
110
- href: dashboardLink || "/",
111
- icon: isRTL() ? chevronRight : chevronLeft,
112
- label: __("Go to the Dashboard"),
113
- children: __("Dashboard")
114
- }
115
- );
121
+ const dashboardLink = useSelect((select) => select(store).getDashboardLink(), []);
122
+ return /* @__PURE__ */ jsx(Button, {
123
+ __next40pxDefaultSize: true,
124
+ className: style_module_default["back-button"],
125
+ href: dashboardLink || "/",
126
+ icon: isRTL() ? chevronRight : chevronLeft,
127
+ label: __("Go to the Dashboard"),
128
+ children: __("Dashboard")
129
+ });
116
130
  }
117
131
  function Sidebar() {
118
- return /* @__PURE__ */ jsxs("div", { className: style_module_default.scrollable, children: [
119
- /* @__PURE__ */ jsx(DashboardBackButton, {}),
120
- /* @__PURE__ */ jsx("div", { className: style_module_default.content, children: /* @__PURE__ */ jsx(Navigation, {}) }),
121
- /* @__PURE__ */ jsx("div", { className: style_module_default.footer, children: /* @__PURE__ */ jsx(SaveButton, {}) })
122
- ] });
132
+ return /* @__PURE__ */ jsxs("div", {
133
+ className: style_module_default.scrollable,
134
+ children: [
135
+ /* @__PURE__ */ jsx(DashboardBackButton, {}),
136
+ /* @__PURE__ */ jsx("div", {
137
+ className: style_module_default.content,
138
+ children: /* @__PURE__ */ jsx(Navigation, {})
139
+ }),
140
+ /* @__PURE__ */ jsx("div", {
141
+ className: style_module_default.footer,
142
+ children: /* @__PURE__ */ jsx(SaveButton, {})
143
+ })
144
+ ]
145
+ });
123
146
  }
124
- export {
125
- Sidebar as default
126
- };
127
- //# sourceMappingURL=index.mjs.map
147
+ export { Sidebar as default };
148
+
149
+ //# sourceMappingURL=index.mjs.map
@@ -1,7 +1 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/components/sidebar/index.tsx", "../../../../style-runtime/src/index.ts", "../../../src/components/sidebar/style.module.scss"],
4
- "sourcesContent": ["import { Button } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { __, isRTL } from '@wordpress/i18n';\nimport { chevronLeft, chevronRight } from '@wordpress/icons';\nimport Navigation from '../navigation';\nimport SaveButton from '../save-button';\nimport { store as bootStore } from '../../store';\nimport styles from './style.module.scss';\n\nfunction DashboardBackButton() {\n\tconst dashboardLink = useSelect(\n\t\t( select ) => select( bootStore ).getDashboardLink(),\n\t\t[]\n\t);\n\treturn (\n\t\t<Button\n\t\t\t__next40pxDefaultSize\n\t\t\tclassName={ styles[ 'back-button' ] }\n\t\t\thref={ dashboardLink || '/' }\n\t\t\ticon={ isRTL() ? chevronRight : chevronLeft }\n\t\t\tlabel={ __( 'Go to the Dashboard' ) }\n\t\t>\n\t\t\t{ __( 'Dashboard' ) }\n\t\t</Button>\n\t);\n}\n\nexport default function Sidebar() {\n\treturn (\n\t\t<div className={ styles.scrollable }>\n\t\t\t<DashboardBackButton />\n\t\t\t<div className={ styles.content }>\n\t\t\t\t<Navigation />\n\t\t\t</div>\n\t\t\t<div className={ styles.footer }>\n\t\t\t\t<SaveButton />\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n", "type GlobalScopeWithStyleRuntime = typeof globalThis & {\n\t// This global is shared by separately bundled copies of this package.\n\t// Keep its shape backward compatible after release.\n\t__wpStyleRuntime?: {\n\t\tdocuments: Map< Document, number >;\n\t\tstyles: Map< string, string >;\n\t\tinjectedStyles: WeakMap< Document, Set< string > >;\n\t};\n};\n\nconst STYLE_HASH_ATTRIBUTE = 'data-wp-hash';\n\n/**\n * Returns the shared style runtime registry.\n *\n * The registry is stored on `globalThis` so separately bundled copies of this\n * package can coordinate through the same document and style maps.\n *\n * @return The shared runtime registry.\n */\nfunction getRuntime() {\n\tconst globalScope = globalThis as GlobalScopeWithStyleRuntime;\n\n\tif ( globalScope.__wpStyleRuntime ) {\n\t\treturn globalScope.__wpStyleRuntime;\n\t}\n\n\tglobalScope.__wpStyleRuntime = {\n\t\tdocuments: new Map(),\n\t\tstyles: new Map(),\n\t\tinjectedStyles: new WeakMap(),\n\t};\n\n\tif ( typeof document !== 'undefined' ) {\n\t\tregisterDocument( document );\n\t}\n\n\treturn globalScope.__wpStyleRuntime;\n}\n\n/**\n * Checks whether a document already contains a style tag for a hash.\n *\n * @param targetDocument Document to inspect.\n * @param hash Stable hash for the transformed CSS.\n *\n * @return Whether the style hash already exists in the document.\n */\nfunction documentContainsStyleHash(\n\ttargetDocument: Document,\n\thash: string\n): boolean {\n\tif ( ! targetDocument.head ) {\n\t\treturn false;\n\t}\n\n\tfor ( const style of targetDocument.head.querySelectorAll(\n\t\t`style[${ STYLE_HASH_ATTRIBUTE }]`\n\t) ) {\n\t\tif ( style.getAttribute( STYLE_HASH_ATTRIBUTE ) === hash ) {\n\t\t\treturn true;\n\t\t}\n\t}\n\n\treturn false;\n}\n\n/**\n * Injects a registered style into a document, unless that document already\n * contains a style tag for the same hash.\n *\n * @param targetDocument Document to inject the style into.\n * @param hash Stable hash for the transformed CSS.\n * @param css CSS text to inject.\n */\nfunction injectStyle( targetDocument: Document, hash: string, css: string ) {\n\tif ( ! targetDocument.head ) {\n\t\treturn;\n\t}\n\n\tconst runtime = getRuntime();\n\tlet injectedStyles = runtime.injectedStyles.get( targetDocument );\n\n\tif ( ! injectedStyles ) {\n\t\tinjectedStyles = new Set();\n\t\truntime.injectedStyles.set( targetDocument, injectedStyles );\n\t}\n\n\tif ( injectedStyles.has( hash ) ) {\n\t\treturn;\n\t}\n\n\t// Older generated CSS module output can still inject matching style tags\n\t// after this document's cache is created, so keep the DOM as the fallback\n\t// source of truth on cache misses.\n\tif ( documentContainsStyleHash( targetDocument, hash ) ) {\n\t\tinjectedStyles.add( hash );\n\t\treturn;\n\t}\n\n\tconst style = targetDocument.createElement( 'style' );\n\tstyle.setAttribute( STYLE_HASH_ATTRIBUTE, hash );\n\tstyle.appendChild( targetDocument.createTextNode( css ) );\n\ttargetDocument.head.appendChild( style );\n\tinjectedStyles.add( hash );\n}\n\n/**\n * Registers a document as a style injection target.\n *\n * Existing registered styles are replayed into the document immediately.\n * Documents are reference-counted so multiple providers can safely register the\n * same document without one cleanup removing it while another registration is\n * still active.\n *\n * @param targetDocument Document to receive registered styles.\n * @return Cleanup function that unregisters this document registration.\n */\nexport function registerDocument( targetDocument: Document ) {\n\tconst runtime = getRuntime();\n\n\truntime.documents.set(\n\t\ttargetDocument,\n\t\t( runtime.documents.get( targetDocument ) ?? 0 ) + 1\n\t);\n\n\tfor ( const [ hash, css ] of runtime.styles ) {\n\t\tinjectStyle( targetDocument, hash, css );\n\t}\n\n\treturn () => {\n\t\tconst count = runtime.documents.get( targetDocument );\n\n\t\tif ( count === undefined ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( count <= 1 ) {\n\t\t\truntime.documents.delete( targetDocument );\n\t\t\treturn;\n\t\t}\n\n\t\truntime.documents.set( targetDocument, count - 1 );\n\t};\n}\n\n/**\n * Registers a style and injects it into all registered documents.\n *\n * The hash is used as the deduplication key, so calling this repeatedly with\n * the same hash will not add duplicate style tags to a document.\n * Registered styles are retained for the lifetime of the page so they can be\n * replayed into documents that are registered later.\n *\n * @param hash Stable hash for the transformed CSS.\n * @param css CSS text to inject.\n */\nexport function registerStyle( hash: string, css: string ) {\n\tconst runtime = getRuntime();\n\n\truntime.styles.set( hash, css );\n\n\tfor ( const targetDocument of runtime.documents.keys() ) {\n\t\tinjectStyle( targetDocument, hash, css );\n\t}\n}\n", "import { registerStyle } from '@wordpress/style-runtime';\nif (typeof process === 'undefined' || process.env.NODE_ENV !== 'test') {\n\tregisterStyle(\"2f8ba86269\", \"._52f77809bed01e5e__scrollable{display:flex;flex-direction:column;height:100%;overflow:auto;position:relative}._6d2e23af506664fb__content{contain:content;flex-grow:1;position:relative}.c95a8ac9c6876d6e__footer{padding-block-end:8px;padding-block-start:16px;padding-inline-end:8px;padding-inline-start:16px}._28ec24681975e557__back-button{margin-block-end:8px;margin-block-start:16px;margin-inline-end:12px;margin-inline-start:12px}\");\n}\nexport default {\"scrollable\":\"_52f77809bed01e5e__scrollable\",\"content\":\"_6d2e23af506664fb__content\",\"footer\":\"c95a8ac9c6876d6e__footer\",\"back-button\":\"_28ec24681975e557__back-button\"};\n"],
5
- "mappings": "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",
6
- "names": []
7
- }
1
+ {"version":3,"file":"index.mjs","names":["bootStore","styles"],"sources":["../../../../style-runtime/src/index.ts","../../../src/components/sidebar/style.module.scss","../../../src/components/sidebar/index.tsx"],"sourcesContent":["type GlobalScopeWithStyleRuntime = typeof globalThis & {\n\t// This global is shared by separately bundled copies of this package.\n\t// Keep its shape backward compatible after release.\n\t__wpStyleRuntime?: {\n\t\tdocuments: Map< Document, number >;\n\t\tstyles: Map< string, string >;\n\t\tinjectedStyles: WeakMap< Document, Set< string > >;\n\t};\n};\n\nconst STYLE_HASH_ATTRIBUTE = 'data-wp-hash';\n\n/**\n * Returns the shared style runtime registry.\n *\n * The registry is stored on `globalThis` so separately bundled copies of this\n * package can coordinate through the same document and style maps.\n *\n * @return The shared runtime registry.\n */\nfunction getRuntime() {\n\tconst globalScope = globalThis as GlobalScopeWithStyleRuntime;\n\n\tif ( globalScope.__wpStyleRuntime ) {\n\t\treturn globalScope.__wpStyleRuntime;\n\t}\n\n\tglobalScope.__wpStyleRuntime = {\n\t\tdocuments: new Map(),\n\t\tstyles: new Map(),\n\t\tinjectedStyles: new WeakMap(),\n\t};\n\n\tif ( typeof document !== 'undefined' ) {\n\t\tregisterDocument( document );\n\t}\n\n\treturn globalScope.__wpStyleRuntime;\n}\n\n/**\n * Checks whether a document already contains a style tag for a hash.\n *\n * @param targetDocument Document to inspect.\n * @param hash Stable hash for the transformed CSS.\n *\n * @return Whether the style hash already exists in the document.\n */\nfunction documentContainsStyleHash(\n\ttargetDocument: Document,\n\thash: string\n): boolean {\n\tif ( ! targetDocument.head ) {\n\t\treturn false;\n\t}\n\n\tfor ( const style of targetDocument.head.querySelectorAll(\n\t\t`style[${ STYLE_HASH_ATTRIBUTE }]`\n\t) ) {\n\t\tif ( style.getAttribute( STYLE_HASH_ATTRIBUTE ) === hash ) {\n\t\t\treturn true;\n\t\t}\n\t}\n\n\treturn false;\n}\n\n/**\n * Injects a registered style into a document, unless that document already\n * contains a style tag for the same hash.\n *\n * @param targetDocument Document to inject the style into.\n * @param hash Stable hash for the transformed CSS.\n * @param css CSS text to inject.\n */\nfunction injectStyle( targetDocument: Document, hash: string, css: string ) {\n\tif ( ! targetDocument.head ) {\n\t\treturn;\n\t}\n\n\tconst runtime = getRuntime();\n\tlet injectedStyles = runtime.injectedStyles.get( targetDocument );\n\n\tif ( ! injectedStyles ) {\n\t\tinjectedStyles = new Set();\n\t\truntime.injectedStyles.set( targetDocument, injectedStyles );\n\t}\n\n\tif ( injectedStyles.has( hash ) ) {\n\t\treturn;\n\t}\n\n\t// Older generated CSS module output can still inject matching style tags\n\t// after this document's cache is created, so keep the DOM as the fallback\n\t// source of truth on cache misses.\n\tif ( documentContainsStyleHash( targetDocument, hash ) ) {\n\t\tinjectedStyles.add( hash );\n\t\treturn;\n\t}\n\n\tconst style = targetDocument.createElement( 'style' );\n\tstyle.setAttribute( STYLE_HASH_ATTRIBUTE, hash );\n\tstyle.appendChild( targetDocument.createTextNode( css ) );\n\ttargetDocument.head.appendChild( style );\n\tinjectedStyles.add( hash );\n}\n\n/**\n * Registers a document as a style injection target.\n *\n * Existing registered styles are replayed into the document immediately.\n * Documents are reference-counted so multiple providers can safely register the\n * same document without one cleanup removing it while another registration is\n * still active.\n *\n * @param targetDocument Document to receive registered styles.\n * @return Cleanup function that unregisters this document registration.\n */\nexport function registerDocument( targetDocument: Document ) {\n\tconst runtime = getRuntime();\n\n\truntime.documents.set(\n\t\ttargetDocument,\n\t\t( runtime.documents.get( targetDocument ) ?? 0 ) + 1\n\t);\n\n\tfor ( const [ hash, css ] of runtime.styles ) {\n\t\tinjectStyle( targetDocument, hash, css );\n\t}\n\n\treturn () => {\n\t\tconst count = runtime.documents.get( targetDocument );\n\n\t\tif ( count === undefined ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( count <= 1 ) {\n\t\t\truntime.documents.delete( targetDocument );\n\t\t\treturn;\n\t\t}\n\n\t\truntime.documents.set( targetDocument, count - 1 );\n\t};\n}\n\n/**\n * Registers a style and injects it into all registered documents.\n *\n * The hash is used as the deduplication key, so calling this repeatedly with\n * the same hash will not add duplicate style tags to a document.\n * Registered styles are retained for the lifetime of the page so they can be\n * replayed into documents that are registered later.\n *\n * @param hash Stable hash for the transformed CSS.\n * @param css CSS text to inject.\n */\nexport function registerStyle( hash: string, css: string ) {\n\tconst runtime = getRuntime();\n\n\truntime.styles.set( hash, css );\n\n\tfor ( const targetDocument of runtime.documents.keys() ) {\n\t\tinjectStyle( targetDocument, hash, css );\n\t}\n}\n","import { registerStyle } from '@wordpress/style-runtime';\nif (typeof process === 'undefined' || process.env.NODE_ENV !== 'test') {\n\tregisterStyle(\"040f861d87\", \".e805c0d27c9fe7b6__scrollable{display:flex;flex-direction:column;height:100%;overflow:auto;position:relative}._16abc09ab6556b14__content{contain:content;flex-grow:1;position:relative}._7d16636622fe90e5__footer{padding-block-end:8px;padding-block-start:16px;padding-inline-end:8px;padding-inline-start:16px}._6058c5869f31f9bd__back-button{margin-block-end:8px;margin-block-start:16px;margin-inline-end:12px;margin-inline-start:12px}\");\n}\nexport default {\"scrollable\":\"e805c0d27c9fe7b6__scrollable\",\"content\":\"_16abc09ab6556b14__content\",\"footer\":\"_7d16636622fe90e5__footer\",\"back-button\":\"_6058c5869f31f9bd__back-button\"};\n","import { Button } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { __, isRTL } from '@wordpress/i18n';\nimport { chevronLeft, chevronRight } from '@wordpress/icons';\nimport Navigation from '../navigation';\nimport SaveButton from '../save-button';\nimport { store as bootStore } from '../../store';\nimport styles from './style.module.scss';\n\nfunction DashboardBackButton() {\n\tconst dashboardLink = useSelect(\n\t\t( select ) => select( bootStore ).getDashboardLink(),\n\t\t[]\n\t);\n\treturn (\n\t\t<Button\n\t\t\t__next40pxDefaultSize\n\t\t\tclassName={ styles[ 'back-button' ] }\n\t\t\thref={ dashboardLink || '/' }\n\t\t\ticon={ isRTL() ? chevronRight : chevronLeft }\n\t\t\tlabel={ __( 'Go to the Dashboard' ) }\n\t\t>\n\t\t\t{ __( 'Dashboard' ) }\n\t\t</Button>\n\t);\n}\n\nexport default function Sidebar() {\n\treturn (\n\t\t<div className={ styles.scrollable }>\n\t\t\t<DashboardBackButton />\n\t\t\t<div className={ styles.content }>\n\t\t\t\t<Navigation />\n\t\t\t</div>\n\t\t\t<div className={ styles.footer }>\n\t\t\t\t<SaveButton />\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n"],"mappings":"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"}
@@ -1,9 +1,3 @@
1
- // packages/boot/src/index.tsx
2
1
  import { init, initSinglePage } from "./components/app/index.mjs";
3
2
  import { store } from "./store/index.mjs";
4
- export {
5
- init,
6
- initSinglePage,
7
- store
8
- };
9
- //# sourceMappingURL=index.mjs.map
3
+ export { init, initSinglePage, store };
@@ -1,11 +1,6 @@
1
- // packages/boot/src/lock-unlock.ts
2
1
  import { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from "@wordpress/private-apis";
3
- var { lock, unlock } = __dangerousOptInToUnstableAPIsOnlyForCoreModules(
4
- "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.",
5
- "@wordpress/boot"
6
- );
7
- export {
8
- lock,
9
- unlock
10
- };
11
- //# sourceMappingURL=lock-unlock.mjs.map
2
+ // packages/boot/src/lock-unlock.ts
3
+ const { lock, unlock } = __dangerousOptInToUnstableAPIsOnlyForCoreModules("I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.", "@wordpress/boot");
4
+ export { lock, unlock };
5
+
6
+ //# sourceMappingURL=lock-unlock.mjs.map
@@ -1,7 +1 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/lock-unlock.ts"],
4
- "sourcesContent": ["import { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/private-apis';\nexport const { lock, unlock } =\n\t__dangerousOptInToUnstableAPIsOnlyForCoreModules(\n\t\t'I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.',\n\t\t'@wordpress/boot'\n\t);\n"],
5
- "mappings": ";AAAA,SAAS,wDAAwD;AAC1D,IAAM,EAAE,MAAM,OAAO,IAC3B;AAAA,EACC;AAAA,EACA;AACD;",
6
- "names": []
7
- }
1
+ {"version":3,"file":"lock-unlock.mjs","names":[],"sources":["../src/lock-unlock.ts"],"sourcesContent":["import { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/private-apis';\nexport const { lock, unlock } =\n\t__dangerousOptInToUnstableAPIsOnlyForCoreModules(\n\t\t'I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.',\n\t\t'@wordpress/boot'\n\t);\n"],"mappings":";;AACA,MAAa,EAAE,MAAM,WACpB,iDACC,iIACA,iBACD"}
@@ -1,42 +1,45 @@
1
1
  // packages/boot/src/store/actions.ts
2
2
  function registerMenuItem(id, menuItem) {
3
- return {
4
- type: "REGISTER_MENU_ITEM",
5
- id,
6
- menuItem
7
- };
3
+ return {
4
+ type: "REGISTER_MENU_ITEM",
5
+ id,
6
+ menuItem
7
+ };
8
8
  }
9
9
  function updateMenuItem(id, updates) {
10
- return {
11
- type: "UPDATE_MENU_ITEM",
12
- id,
13
- updates
14
- };
10
+ return {
11
+ type: "UPDATE_MENU_ITEM",
12
+ id,
13
+ updates
14
+ };
15
15
  }
16
16
  function registerRoute(route) {
17
- return {
18
- type: "REGISTER_ROUTE",
19
- route
20
- };
17
+ return {
18
+ type: "REGISTER_ROUTE",
19
+ route
20
+ };
21
21
  }
22
+ /**
23
+ * Registers where entities of a post type are listed and edited.
24
+ *
25
+ * Register `default` to cover post types with no entry of their own.
26
+ *
27
+ * @param postType Post type the links belong to, or `default`.
28
+ * @param links Paths to list and edit an entity of that post type.
29
+ */
22
30
  function registerEntityLinks(postType, links) {
23
- return {
24
- type: "REGISTER_ENTITY_LINKS",
25
- postType,
26
- links
27
- };
31
+ return {
32
+ type: "REGISTER_ENTITY_LINKS",
33
+ postType,
34
+ links
35
+ };
28
36
  }
29
37
  function setDashboardLink(dashboardLink) {
30
- return {
31
- type: "SET_DASHBOARD_LINK",
32
- dashboardLink
33
- };
38
+ return {
39
+ type: "SET_DASHBOARD_LINK",
40
+ dashboardLink
41
+ };
34
42
  }
35
- export {
36
- registerEntityLinks,
37
- registerMenuItem,
38
- registerRoute,
39
- setDashboardLink,
40
- updateMenuItem
41
- };
42
- //# sourceMappingURL=actions.mjs.map
43
+ export { registerEntityLinks, registerMenuItem, registerRoute, setDashboardLink, updateMenuItem };
44
+
45
+ //# sourceMappingURL=actions.mjs.map
@@ -1,7 +1 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/store/actions.ts"],
4
- "sourcesContent": ["import type { EntityLinks, MenuItem, Route } from './types';\n\nexport function registerMenuItem( id: string, menuItem: MenuItem ) {\n\treturn {\n\t\ttype: 'REGISTER_MENU_ITEM' as const,\n\t\tid,\n\t\tmenuItem,\n\t};\n}\n\nexport function updateMenuItem( id: string, updates: Partial< MenuItem > ) {\n\treturn {\n\t\ttype: 'UPDATE_MENU_ITEM' as const,\n\t\tid,\n\t\tupdates,\n\t};\n}\n\nexport function registerRoute( route: Route ) {\n\treturn {\n\t\ttype: 'REGISTER_ROUTE' as const,\n\t\troute,\n\t};\n}\n\n/**\n * Registers where entities of a post type are listed and edited.\n *\n * Register `default` to cover post types with no entry of their own.\n *\n * @param postType Post type the links belong to, or `default`.\n * @param links Paths to list and edit an entity of that post type.\n */\nexport function registerEntityLinks( postType: string, links: EntityLinks ) {\n\treturn {\n\t\ttype: 'REGISTER_ENTITY_LINKS' as const,\n\t\tpostType,\n\t\tlinks,\n\t};\n}\n\nexport function setDashboardLink( dashboardLink: string ) {\n\treturn {\n\t\ttype: 'SET_DASHBOARD_LINK' as const,\n\t\tdashboardLink,\n\t};\n}\n\nexport type Action =\n\t| ReturnType< typeof registerMenuItem >\n\t| ReturnType< typeof updateMenuItem >\n\t| ReturnType< typeof registerRoute >\n\t| ReturnType< typeof registerEntityLinks >\n\t| ReturnType< typeof setDashboardLink >;\n"],
5
- "mappings": ";AAEO,SAAS,iBAAkB,IAAY,UAAqB;AAClE,SAAO;AAAA,IACN,MAAM;AAAA,IACN;AAAA,IACA;AAAA,EACD;AACD;AAEO,SAAS,eAAgB,IAAY,SAA+B;AAC1E,SAAO;AAAA,IACN,MAAM;AAAA,IACN;AAAA,IACA;AAAA,EACD;AACD;AAEO,SAAS,cAAe,OAAe;AAC7C,SAAO;AAAA,IACN,MAAM;AAAA,IACN;AAAA,EACD;AACD;AAUO,SAAS,oBAAqB,UAAkB,OAAqB;AAC3E,SAAO;AAAA,IACN,MAAM;AAAA,IACN;AAAA,IACA;AAAA,EACD;AACD;AAEO,SAAS,iBAAkB,eAAwB;AACzD,SAAO;AAAA,IACN,MAAM;AAAA,IACN;AAAA,EACD;AACD;",
6
- "names": []
7
- }
1
+ {"version":3,"file":"actions.mjs","names":[],"sources":["../../src/store/actions.ts"],"sourcesContent":["import type { EntityLinks, MenuItem, Route } from './types';\n\nexport function registerMenuItem( id: string, menuItem: MenuItem ) {\n\treturn {\n\t\ttype: 'REGISTER_MENU_ITEM' as const,\n\t\tid,\n\t\tmenuItem,\n\t};\n}\n\nexport function updateMenuItem( id: string, updates: Partial< MenuItem > ) {\n\treturn {\n\t\ttype: 'UPDATE_MENU_ITEM' as const,\n\t\tid,\n\t\tupdates,\n\t};\n}\n\nexport function registerRoute( route: Route ) {\n\treturn {\n\t\ttype: 'REGISTER_ROUTE' as const,\n\t\troute,\n\t};\n}\n\n/**\n * Registers where entities of a post type are listed and edited.\n *\n * Register `default` to cover post types with no entry of their own.\n *\n * @param postType Post type the links belong to, or `default`.\n * @param links Paths to list and edit an entity of that post type.\n */\nexport function registerEntityLinks( postType: string, links: EntityLinks ) {\n\treturn {\n\t\ttype: 'REGISTER_ENTITY_LINKS' as const,\n\t\tpostType,\n\t\tlinks,\n\t};\n}\n\nexport function setDashboardLink( dashboardLink: string ) {\n\treturn {\n\t\ttype: 'SET_DASHBOARD_LINK' as const,\n\t\tdashboardLink,\n\t};\n}\n\nexport type Action =\n\t| ReturnType< typeof registerMenuItem >\n\t| ReturnType< typeof updateMenuItem >\n\t| ReturnType< typeof registerRoute >\n\t| ReturnType< typeof registerEntityLinks >\n\t| ReturnType< typeof setDashboardLink >;\n"],"mappings":";AAEA,SAAgB,iBAAkB,IAAY,UAAqB;CAClE,OAAO;EACN,MAAM;EACN;EACA;CACD;AACD;AAEA,SAAgB,eAAgB,IAAY,SAA+B;CAC1E,OAAO;EACN,MAAM;EACN;EACA;CACD;AACD;AAEA,SAAgB,cAAe,OAAe;CAC7C,OAAO;EACN,MAAM;EACN;CACD;AACD;;;;;;;;;AAUA,SAAgB,oBAAqB,UAAkB,OAAqB;CAC3E,OAAO;EACN,MAAM;EACN;EACA;CACD;AACD;AAEA,SAAgB,iBAAkB,eAAwB;CACzD,OAAO;EACN,MAAM;EACN;CACD;AACD"}
@@ -1,17 +1,15 @@
1
- // packages/boot/src/store/index.ts
2
1
  import { createReduxStore, register } from "@wordpress/data";
3
2
  import { reducer } from "./reducer.mjs";
4
3
  import * as actions from "./actions.mjs";
5
4
  import * as selectors from "./selectors.mjs";
6
- var STORE_NAME = "wordpress/boot";
7
- var store = createReduxStore(STORE_NAME, {
8
- reducer,
9
- actions,
10
- selectors
5
+ // packages/boot/src/store/index.ts
6
+ const STORE_NAME = "wordpress/boot";
7
+ const store = createReduxStore(STORE_NAME, {
8
+ reducer,
9
+ actions,
10
+ selectors
11
11
  });
12
12
  register(store);
13
- export {
14
- STORE_NAME,
15
- store
16
- };
17
- //# sourceMappingURL=index.mjs.map
13
+ export { STORE_NAME, store };
14
+
15
+ //# sourceMappingURL=index.mjs.map
@@ -1,7 +1 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/store/index.ts"],
4
- "sourcesContent": ["import { createReduxStore, register } from '@wordpress/data';\nimport { reducer } from './reducer';\nimport * as actions from './actions';\nimport * as selectors from './selectors';\n\nconst STORE_NAME = 'wordpress/boot';\n\nexport const store = createReduxStore( STORE_NAME, {\n\treducer,\n\tactions,\n\tselectors,\n} );\n\nregister( store );\n\nexport { STORE_NAME };\n"],
5
- "mappings": ";AAAA,SAAS,kBAAkB,gBAAgB;AAC3C,SAAS,eAAe;AACxB,YAAY,aAAa;AACzB,YAAY,eAAe;AAE3B,IAAM,aAAa;AAEZ,IAAM,QAAQ,iBAAkB,YAAY;AAAA,EAClD;AAAA,EACA;AAAA,EACA;AACD,CAAE;AAEF,SAAU,KAAM;",
6
- "names": []
7
- }
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../src/store/index.ts"],"sourcesContent":["import { createReduxStore, register } from '@wordpress/data';\nimport { reducer } from './reducer';\nimport * as actions from './actions';\nimport * as selectors from './selectors';\n\nconst STORE_NAME = 'wordpress/boot';\n\nexport const store = createReduxStore( STORE_NAME, {\n\treducer,\n\tactions,\n\tselectors,\n} );\n\nregister( store );\n\nexport { STORE_NAME };\n"],"mappings":";;;;;AAKA,MAAM,aAAa;AAEnB,MAAa,QAAQ,iBAAkB,YAAY;CAClD;CACA;CACA;AACD,CAAE;AAEF,SAAU,KAAM"}
@@ -1,59 +1,52 @@
1
1
  // packages/boot/src/store/reducer.ts
2
- var initialState = {
3
- menuItems: {},
4
- routes: [],
5
- dashboardLink: void 0,
6
- entityLinks: {}
2
+ const initialState = {
3
+ menuItems: {},
4
+ routes: [],
5
+ dashboardLink: void 0,
6
+ entityLinks: {}
7
7
  };
8
8
  function reducer(state = initialState, action) {
9
- switch (action.type) {
10
- case "REGISTER_MENU_ITEM":
11
- return {
12
- ...state,
13
- menuItems: {
14
- ...state.menuItems,
15
- [action.id]: action.menuItem
16
- }
17
- };
18
- case "UPDATE_MENU_ITEM":
19
- if (!state.menuItems[action.id]) {
20
- return state;
21
- }
22
- return {
23
- ...state,
24
- menuItems: {
25
- ...state.menuItems,
26
- [action.id]: {
27
- ...state.menuItems[action.id],
28
- ...action.updates
29
- }
30
- }
31
- };
32
- case "REGISTER_ROUTE":
33
- return {
34
- ...state,
35
- routes: [...state.routes, action.route]
36
- };
37
- case "REGISTER_ENTITY_LINKS":
38
- return {
39
- ...state,
40
- entityLinks: {
41
- ...state.entityLinks,
42
- [action.postType]: {
43
- ...state.entityLinks[action.postType],
44
- ...action.links
45
- }
46
- }
47
- };
48
- case "SET_DASHBOARD_LINK":
49
- return {
50
- ...state,
51
- dashboardLink: action.dashboardLink
52
- };
53
- }
54
- return state;
9
+ switch (action.type) {
10
+ case "REGISTER_MENU_ITEM": return {
11
+ ...state,
12
+ menuItems: {
13
+ ...state.menuItems,
14
+ [action.id]: action.menuItem
15
+ }
16
+ };
17
+ case "UPDATE_MENU_ITEM":
18
+ if (!state.menuItems[action.id]) return state;
19
+ return {
20
+ ...state,
21
+ menuItems: {
22
+ ...state.menuItems,
23
+ [action.id]: {
24
+ ...state.menuItems[action.id],
25
+ ...action.updates
26
+ }
27
+ }
28
+ };
29
+ case "REGISTER_ROUTE": return {
30
+ ...state,
31
+ routes: [...state.routes, action.route]
32
+ };
33
+ case "REGISTER_ENTITY_LINKS": return {
34
+ ...state,
35
+ entityLinks: {
36
+ ...state.entityLinks,
37
+ [action.postType]: {
38
+ ...state.entityLinks[action.postType],
39
+ ...action.links
40
+ }
41
+ }
42
+ };
43
+ case "SET_DASHBOARD_LINK": return {
44
+ ...state,
45
+ dashboardLink: action.dashboardLink
46
+ };
47
+ }
48
+ return state;
55
49
  }
56
- export {
57
- reducer
58
- };
59
- //# sourceMappingURL=reducer.mjs.map
50
+ export { reducer };
51
+
52
+ //# sourceMappingURL=reducer.mjs.map
@@ -1,7 +1 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/store/reducer.ts"],
4
- "sourcesContent": ["import type { Action } from './actions';\nimport type { State } from './types';\n\nconst initialState: State = {\n\tmenuItems: {},\n\troutes: [],\n\tdashboardLink: undefined,\n\tentityLinks: {},\n};\n\nexport function reducer( state: State = initialState, action: Action ): State {\n\tswitch ( action.type ) {\n\t\tcase 'REGISTER_MENU_ITEM':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\tmenuItems: {\n\t\t\t\t\t...state.menuItems,\n\t\t\t\t\t[ action.id ]: action.menuItem,\n\t\t\t\t},\n\t\t\t};\n\n\t\tcase 'UPDATE_MENU_ITEM':\n\t\t\t// Updating an item that was never registered would add a partial\n\t\t\t// entry to the menu, which renders as an empty navigation row.\n\t\t\tif ( ! state.menuItems[ action.id ] ) {\n\t\t\t\treturn state;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\tmenuItems: {\n\t\t\t\t\t...state.menuItems,\n\t\t\t\t\t[ action.id ]: {\n\t\t\t\t\t\t...state.menuItems[ action.id ],\n\t\t\t\t\t\t...action.updates,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t};\n\n\t\tcase 'REGISTER_ROUTE':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\troutes: [ ...state.routes, action.route ],\n\t\t\t};\n\n\t\tcase 'REGISTER_ENTITY_LINKS':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\tentityLinks: {\n\t\t\t\t\t...state.entityLinks,\n\t\t\t\t\t[ action.postType ]: {\n\t\t\t\t\t\t...state.entityLinks[ action.postType ],\n\t\t\t\t\t\t...action.links,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t};\n\n\t\tcase 'SET_DASHBOARD_LINK':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\tdashboardLink: action.dashboardLink,\n\t\t\t};\n\t}\n\n\treturn state;\n}\n"],
5
- "mappings": ";AAGA,IAAM,eAAsB;AAAA,EAC3B,WAAW,CAAC;AAAA,EACZ,QAAQ,CAAC;AAAA,EACT,eAAe;AAAA,EACf,aAAa,CAAC;AACf;AAEO,SAAS,QAAS,QAAe,cAAc,QAAwB;AAC7E,UAAS,OAAO,MAAO;AAAA,IACtB,KAAK;AACJ,aAAO;AAAA,QACN,GAAG;AAAA,QACH,WAAW;AAAA,UACV,GAAG,MAAM;AAAA,UACT,CAAE,OAAO,EAAG,GAAG,OAAO;AAAA,QACvB;AAAA,MACD;AAAA,IAED,KAAK;AAGJ,UAAK,CAAE,MAAM,UAAW,OAAO,EAAG,GAAI;AACrC,eAAO;AAAA,MACR;AAEA,aAAO;AAAA,QACN,GAAG;AAAA,QACH,WAAW;AAAA,UACV,GAAG,MAAM;AAAA,UACT,CAAE,OAAO,EAAG,GAAG;AAAA,YACd,GAAG,MAAM,UAAW,OAAO,EAAG;AAAA,YAC9B,GAAG,OAAO;AAAA,UACX;AAAA,QACD;AAAA,MACD;AAAA,IAED,KAAK;AACJ,aAAO;AAAA,QACN,GAAG;AAAA,QACH,QAAQ,CAAE,GAAG,MAAM,QAAQ,OAAO,KAAM;AAAA,MACzC;AAAA,IAED,KAAK;AACJ,aAAO;AAAA,QACN,GAAG;AAAA,QACH,aAAa;AAAA,UACZ,GAAG,MAAM;AAAA,UACT,CAAE,OAAO,QAAS,GAAG;AAAA,YACpB,GAAG,MAAM,YAAa,OAAO,QAAS;AAAA,YACtC,GAAG,OAAO;AAAA,UACX;AAAA,QACD;AAAA,MACD;AAAA,IAED,KAAK;AACJ,aAAO;AAAA,QACN,GAAG;AAAA,QACH,eAAe,OAAO;AAAA,MACvB;AAAA,EACF;AAEA,SAAO;AACR;",
6
- "names": []
7
- }
1
+ {"version":3,"file":"reducer.mjs","names":[],"sources":["../../src/store/reducer.ts"],"sourcesContent":["import type { Action } from './actions';\nimport type { State } from './types';\n\nconst initialState: State = {\n\tmenuItems: {},\n\troutes: [],\n\tdashboardLink: undefined,\n\tentityLinks: {},\n};\n\nexport function reducer( state: State = initialState, action: Action ): State {\n\tswitch ( action.type ) {\n\t\tcase 'REGISTER_MENU_ITEM':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\tmenuItems: {\n\t\t\t\t\t...state.menuItems,\n\t\t\t\t\t[ action.id ]: action.menuItem,\n\t\t\t\t},\n\t\t\t};\n\n\t\tcase 'UPDATE_MENU_ITEM':\n\t\t\t// Updating an item that was never registered would add a partial\n\t\t\t// entry to the menu, which renders as an empty navigation row.\n\t\t\tif ( ! state.menuItems[ action.id ] ) {\n\t\t\t\treturn state;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\tmenuItems: {\n\t\t\t\t\t...state.menuItems,\n\t\t\t\t\t[ action.id ]: {\n\t\t\t\t\t\t...state.menuItems[ action.id ],\n\t\t\t\t\t\t...action.updates,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t};\n\n\t\tcase 'REGISTER_ROUTE':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\troutes: [ ...state.routes, action.route ],\n\t\t\t};\n\n\t\tcase 'REGISTER_ENTITY_LINKS':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\tentityLinks: {\n\t\t\t\t\t...state.entityLinks,\n\t\t\t\t\t[ action.postType ]: {\n\t\t\t\t\t\t...state.entityLinks[ action.postType ],\n\t\t\t\t\t\t...action.links,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t};\n\n\t\tcase 'SET_DASHBOARD_LINK':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\tdashboardLink: action.dashboardLink,\n\t\t\t};\n\t}\n\n\treturn state;\n}\n"],"mappings":";AAGA,MAAM,eAAsB;CAC3B,WAAW,CAAC;CACZ,QAAQ,CAAC;CACT,eAAe,KAAA;CACf,aAAa,CAAC;AACf;AAEA,SAAgB,QAAS,QAAe,cAAc,QAAwB;CAC7E,QAAS,OAAO,MAAhB;EACC,KAAK,sBACJ,OAAO;GACN,GAAG;GACH,WAAW;IACV,GAAG,MAAM;KACP,OAAO,KAAM,OAAO;GACvB;EACD;EAED,KAAK;GAGJ,IAAK,CAAE,MAAM,UAAW,OAAO,KAC9B,OAAO;GAGR,OAAO;IACN,GAAG;IACH,WAAW;KACV,GAAG,MAAM;MACP,OAAO,KAAM;MACd,GAAG,MAAM,UAAW,OAAO;MAC3B,GAAG,OAAO;KACX;IACD;GACD;EAED,KAAK,kBACJ,OAAO;GACN,GAAG;GACH,QAAQ,CAAE,GAAG,MAAM,QAAQ,OAAO,KAAM;EACzC;EAED,KAAK,yBACJ,OAAO;GACN,GAAG;GACH,aAAa;IACZ,GAAG,MAAM;KACP,OAAO,WAAY;KACpB,GAAG,MAAM,YAAa,OAAO;KAC7B,GAAG,OAAO;IACX;GACD;EACD;EAED,KAAK,sBACJ,OAAO;GACN,GAAG;GACH,eAAe,OAAO;EACvB;CACF;CAEA,OAAO;AACR"}