@wordpress/boot 0.19.0 → 0.21.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 (174) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/README.md +4 -0
  3. package/build-module/components/app/index.mjs.map +2 -2
  4. package/build-module/components/app/router.mjs +100 -4
  5. package/build-module/components/app/router.mjs.map +3 -3
  6. package/build-module/components/app/use-route-title.mjs.map +2 -2
  7. package/build-module/components/canvas/back-button.mjs.map +2 -2
  8. package/build-module/components/canvas/index.mjs +72 -13
  9. package/build-module/components/canvas/index.mjs.map +2 -2
  10. package/build-module/components/canvas/site-preview.mjs +50 -0
  11. package/build-module/components/canvas/site-preview.mjs.map +7 -0
  12. package/build-module/components/canvas/use-navigate-to-entity-record.mjs +122 -0
  13. package/build-module/components/canvas/use-navigate-to-entity-record.mjs.map +7 -0
  14. package/build-module/components/canvas/viewport.mjs +18 -0
  15. package/build-module/components/canvas/viewport.mjs.map +7 -0
  16. package/build-module/components/canvas-renderer/index.mjs.map +2 -2
  17. package/build-module/components/error-boundary/index.mjs +129 -0
  18. package/build-module/components/error-boundary/index.mjs.map +7 -0
  19. package/build-module/components/navigation/drilldown-item/index.mjs +91 -1
  20. package/build-module/components/navigation/drilldown-item/index.mjs.map +3 -3
  21. package/build-module/components/navigation/dropdown-item/index.mjs +99 -12
  22. package/build-module/components/navigation/dropdown-item/index.mjs.map +4 -4
  23. package/build-module/components/navigation/index.mjs +1 -2
  24. package/build-module/components/navigation/index.mjs.map +2 -2
  25. package/build-module/components/navigation/items.mjs.map +2 -2
  26. package/build-module/components/navigation/navigation-item/index.mjs +88 -15
  27. package/build-module/components/navigation/navigation-item/index.mjs.map +3 -3
  28. package/build-module/components/navigation/navigation-screen/index.mjs +111 -38
  29. package/build-module/components/navigation/navigation-screen/index.mjs.map +3 -3
  30. package/build-module/components/navigation/path-matching.mjs.map +2 -2
  31. package/build-module/components/navigation/router-link-item.mjs.map +2 -2
  32. package/build-module/components/navigation/use-sidebar-parent.mjs +1 -1
  33. package/build-module/components/navigation/use-sidebar-parent.mjs.map +2 -2
  34. package/build-module/components/plugin-area/index.mjs +29 -0
  35. package/build-module/components/plugin-area/index.mjs.map +7 -0
  36. package/build-module/components/root/index.mjs +220 -122
  37. package/build-module/components/root/index.mjs.map +3 -3
  38. package/build-module/components/root/single-page.mjs +139 -47
  39. package/build-module/components/root/single-page.mjs.map +3 -3
  40. package/build-module/components/root/use-sync-body-background.mjs.map +2 -2
  41. package/build-module/components/save-button/index.mjs +127 -16
  42. package/build-module/components/save-button/index.mjs.map +3 -3
  43. package/build-module/components/save-panel/index.mjs +91 -1
  44. package/build-module/components/save-panel/index.mjs.map +3 -3
  45. package/build-module/components/save-panel/use-save-shortcut.mjs.map +2 -2
  46. package/build-module/components/sidebar/index.mjs +90 -10
  47. package/build-module/components/sidebar/index.mjs.map +3 -3
  48. package/build-module/index.mjs +0 -16
  49. package/build-module/index.mjs.map +3 -3
  50. package/build-module/lock-unlock.mjs.map +2 -2
  51. package/build-module/store/actions.mjs +8 -0
  52. package/build-module/store/actions.mjs.map +2 -2
  53. package/build-module/store/index.mjs.map +2 -2
  54. package/build-module/store/reducer.mjs +16 -1
  55. package/build-module/store/reducer.mjs.map +2 -2
  56. package/build-module/store/selectors.mjs +9 -0
  57. package/build-module/store/selectors.mjs.map +2 -2
  58. package/build-types/components/app/index.d.ts.map +1 -1
  59. package/build-types/components/app/router.d.ts +0 -3
  60. package/build-types/components/app/router.d.ts.map +1 -1
  61. package/build-types/components/app/use-route-title.d.ts.map +1 -1
  62. package/build-types/components/canvas/back-button.d.ts.map +1 -1
  63. package/build-types/components/canvas/index.d.ts +0 -3
  64. package/build-types/components/canvas/index.d.ts.map +1 -1
  65. package/build-types/components/canvas/site-preview.d.ts +10 -0
  66. package/build-types/components/canvas/site-preview.d.ts.map +1 -0
  67. package/build-types/components/canvas/use-navigate-to-entity-record.d.ts +40 -0
  68. package/build-types/components/canvas/use-navigate-to-entity-record.d.ts.map +1 -0
  69. package/build-types/components/canvas/viewport.d.ts +15 -0
  70. package/build-types/components/canvas/viewport.d.ts.map +1 -0
  71. package/build-types/components/canvas-renderer/index.d.ts.map +1 -1
  72. package/build-types/components/error-boundary/index.d.ts +22 -0
  73. package/build-types/components/error-boundary/index.d.ts.map +1 -0
  74. package/build-types/components/navigation/drilldown-item/index.d.ts.map +1 -1
  75. package/build-types/components/navigation/dropdown-item/index.d.ts +0 -1
  76. package/build-types/components/navigation/dropdown-item/index.d.ts.map +1 -1
  77. package/build-types/components/navigation/index.d.ts.map +1 -1
  78. package/build-types/components/navigation/items.d.ts +0 -3
  79. package/build-types/components/navigation/items.d.ts.map +1 -1
  80. package/build-types/components/navigation/navigation-item/index.d.ts +0 -1
  81. package/build-types/components/navigation/navigation-item/index.d.ts.map +1 -1
  82. package/build-types/components/navigation/navigation-screen/index.d.ts +0 -7
  83. package/build-types/components/navigation/navigation-screen/index.d.ts.map +1 -1
  84. package/build-types/components/navigation/path-matching.d.ts +0 -3
  85. package/build-types/components/navigation/path-matching.d.ts.map +1 -1
  86. package/build-types/components/navigation/router-link-item.d.ts.map +1 -1
  87. package/build-types/components/navigation/use-sidebar-parent.d.ts.map +1 -1
  88. package/build-types/components/plugin-area/index.d.ts +12 -0
  89. package/build-types/components/plugin-area/index.d.ts.map +1 -0
  90. package/build-types/components/root/index.d.ts +0 -1
  91. package/build-types/components/root/index.d.ts.map +1 -1
  92. package/build-types/components/root/single-page.d.ts +0 -1
  93. package/build-types/components/root/single-page.d.ts.map +1 -1
  94. package/build-types/components/root/use-sync-body-background.d.ts +1 -1
  95. package/build-types/components/root/use-sync-body-background.d.ts.map +1 -1
  96. package/build-types/components/save-button/index.d.ts +0 -4
  97. package/build-types/components/save-button/index.d.ts.map +1 -1
  98. package/build-types/components/save-panel/index.d.ts.map +1 -1
  99. package/build-types/components/save-panel/use-save-shortcut.d.ts.map +1 -1
  100. package/build-types/components/sidebar/index.d.ts +0 -1
  101. package/build-types/components/sidebar/index.d.ts.map +1 -1
  102. package/build-types/index.d.ts +0 -5
  103. package/build-types/index.d.ts.map +1 -1
  104. package/build-types/lock-unlock.d.ts.map +1 -1
  105. package/build-types/store/actions.d.ts +15 -5
  106. package/build-types/store/actions.d.ts.map +1 -1
  107. package/build-types/store/index.d.ts.map +1 -1
  108. package/build-types/store/reducer.d.ts +0 -3
  109. package/build-types/store/reducer.d.ts.map +1 -1
  110. package/build-types/store/selectors.d.ts +12 -3
  111. package/build-types/store/selectors.d.ts.map +1 -1
  112. package/build-types/store/types.d.ts +34 -6
  113. package/build-types/store/types.d.ts.map +1 -1
  114. package/package.json +28 -25
  115. package/src/components/app/index.tsx +0 -7
  116. package/src/components/app/router.tsx +19 -18
  117. package/src/components/app/use-route-title.ts +0 -7
  118. package/src/components/canvas/back-button.tsx +0 -3
  119. package/src/components/canvas/index.tsx +117 -22
  120. package/src/components/canvas/site-preview.tsx +64 -0
  121. package/src/components/canvas/use-navigate-to-entity-record.ts +220 -0
  122. package/src/components/canvas/viewport.ts +34 -0
  123. package/src/components/canvas-renderer/index.tsx +0 -7
  124. package/src/components/error-boundary/index.tsx +71 -0
  125. package/src/components/error-boundary/style.module.scss +13 -0
  126. package/src/components/navigation/drilldown-item/index.tsx +2 -13
  127. package/src/components/navigation/dropdown-item/index.tsx +11 -19
  128. package/src/components/navigation/dropdown-item/{style.scss → style.module.scss} +6 -2
  129. package/src/components/navigation/index.tsx +1 -9
  130. package/src/components/navigation/items.tsx +0 -7
  131. package/src/components/navigation/navigation-item/index.tsx +3 -18
  132. package/src/components/navigation/navigation-item/{style.scss → style.module.scss} +7 -14
  133. package/src/components/navigation/navigation-screen/index.tsx +6 -26
  134. package/src/components/navigation/navigation-screen/{style.scss → style.module.scss} +10 -9
  135. package/src/components/navigation/path-matching.ts +0 -3
  136. package/src/components/navigation/router-link-item.tsx +0 -11
  137. package/src/components/navigation/use-sidebar-parent.ts +1 -13
  138. package/src/components/plugin-area/index.tsx +34 -0
  139. package/src/components/root/{style.scss → _layout.module.scss} +71 -40
  140. package/src/components/root/_view-transitions.module.scss +205 -0
  141. package/src/components/root/index.tsx +44 -35
  142. package/src/components/root/single-page.tsx +15 -18
  143. package/src/components/root/style.module.scss +2 -0
  144. package/src/components/root/use-sync-body-background.ts +1 -4
  145. package/src/components/save-button/index.tsx +36 -21
  146. package/src/components/save-button/style.module.scss +10 -0
  147. package/src/components/save-panel/index.tsx +2 -8
  148. package/src/components/save-panel/style.module.scss +7 -0
  149. package/src/components/save-panel/use-save-shortcut.ts +0 -3
  150. package/src/components/sidebar/index.tsx +5 -12
  151. package/src/components/sidebar/style.module.scss +29 -0
  152. package/src/index.tsx +0 -5
  153. package/src/lock-unlock.ts +0 -3
  154. package/src/store/actions.ts +18 -4
  155. package/src/store/index.ts +0 -7
  156. package/src/store/reducer.ts +19 -3
  157. package/src/store/selectors.ts +28 -3
  158. package/src/store/types.ts +37 -6
  159. package/build-style/style-rtl.css +0 -132
  160. package/build-style/style.css +0 -132
  161. package/build-style/view-transitions-rtl.css +0 -189
  162. package/build-style/view-transitions.css +0 -189
  163. package/build-types/components/site-hub/index.d.ts +0 -4
  164. package/build-types/components/site-hub/index.d.ts.map +0 -1
  165. package/build-types/components/site-icon/index.d.ts +0 -9
  166. package/build-types/components/site-icon/index.d.ts.map +0 -1
  167. package/build-types/components/site-icon-link/index.d.ts +0 -8
  168. package/build-types/components/site-icon-link/index.d.ts.map +0 -1
  169. package/build-types/components/user-theme-provider/index.d.ts +0 -6
  170. package/build-types/components/user-theme-provider/index.d.ts.map +0 -1
  171. package/src/components/save-button/style.scss +0 -9
  172. package/src/components/sidebar/style.scss +0 -23
  173. package/src/style.scss +0 -33
  174. package/src/view-transitions.scss +0 -221
@@ -15,13 +15,99 @@ import { STORE_NAME } from "../../../store/index.mjs";
15
15
  import NavigationItem from "../navigation-item/index.mjs";
16
16
  import { wrapIcon } from "../items.mjs";
17
17
 
18
- // packages/boot/src/components/navigation/dropdown-item/style.scss
19
- if (typeof document !== "undefined" && process.env.NODE_ENV !== "test" && !document.head.querySelector("style[data-wp-hash='608eff82f3']")) {
20
- const style = document.createElement("style");
21
- style.setAttribute("data-wp-hash", "608eff82f3");
22
- style.appendChild(document.createTextNode(".boot-dropdown-item__children{display:flex;flex-direction:column;margin-block-end:2px;margin-block-start:-2px;margin-inline-start:30px;overflow:hidden;padding:2px}.boot-dropdown-item__chevron.is-up{transform:rotate(180deg)}"));
23
- document.head.appendChild(style);
18
+ // packages/style-runtime/src/index.ts
19
+ var STYLE_HASH_ATTRIBUTE = "data-wp-hash";
20
+ function getRuntime() {
21
+ const globalScope = globalThis;
22
+ if (globalScope.__wpStyleRuntime) {
23
+ return globalScope.__wpStyleRuntime;
24
+ }
25
+ globalScope.__wpStyleRuntime = {
26
+ documents: /* @__PURE__ */ new Map(),
27
+ styles: /* @__PURE__ */ new Map(),
28
+ injectedStyles: /* @__PURE__ */ new WeakMap()
29
+ };
30
+ if (typeof document !== "undefined") {
31
+ registerDocument(document);
32
+ }
33
+ return globalScope.__wpStyleRuntime;
24
34
  }
35
+ function documentContainsStyleHash(targetDocument, hash) {
36
+ if (!targetDocument.head) {
37
+ return false;
38
+ }
39
+ for (const style of targetDocument.head.querySelectorAll(
40
+ `style[${STYLE_HASH_ATTRIBUTE}]`
41
+ )) {
42
+ if (style.getAttribute(STYLE_HASH_ATTRIBUTE) === hash) {
43
+ return true;
44
+ }
45
+ }
46
+ return false;
47
+ }
48
+ function injectStyle(targetDocument, hash, css) {
49
+ if (!targetDocument.head) {
50
+ return;
51
+ }
52
+ const runtime = getRuntime();
53
+ let injectedStyles = runtime.injectedStyles.get(targetDocument);
54
+ if (!injectedStyles) {
55
+ injectedStyles = /* @__PURE__ */ new Set();
56
+ runtime.injectedStyles.set(targetDocument, injectedStyles);
57
+ }
58
+ if (injectedStyles.has(hash)) {
59
+ return;
60
+ }
61
+ if (documentContainsStyleHash(targetDocument, hash)) {
62
+ injectedStyles.add(hash);
63
+ return;
64
+ }
65
+ const style = targetDocument.createElement("style");
66
+ style.setAttribute(STYLE_HASH_ATTRIBUTE, hash);
67
+ style.appendChild(targetDocument.createTextNode(css));
68
+ targetDocument.head.appendChild(style);
69
+ injectedStyles.add(hash);
70
+ }
71
+ function registerDocument(targetDocument) {
72
+ const runtime = getRuntime();
73
+ runtime.documents.set(
74
+ targetDocument,
75
+ (runtime.documents.get(targetDocument) ?? 0) + 1
76
+ );
77
+ for (const [hash, css] of runtime.styles) {
78
+ injectStyle(targetDocument, hash, css);
79
+ }
80
+ return () => {
81
+ const count = runtime.documents.get(targetDocument);
82
+ if (count === void 0) {
83
+ return;
84
+ }
85
+ if (count <= 1) {
86
+ runtime.documents.delete(targetDocument);
87
+ return;
88
+ }
89
+ runtime.documents.set(targetDocument, count - 1);
90
+ };
91
+ }
92
+ function registerStyle(hash, css) {
93
+ const runtime = getRuntime();
94
+ runtime.styles.set(hash, css);
95
+ for (const targetDocument of runtime.documents.keys()) {
96
+ injectStyle(targetDocument, hash, css);
97
+ }
98
+ }
99
+
100
+ // packages/boot/src/components/navigation/navigation-item/style.module.scss
101
+ if (typeof process === "undefined" || process.env.NODE_ENV !== "test") {
102
+ registerStyle("74796ab776", ".d5331ded354c389a__item.d5331ded354c389a__item{align-items:center;border:none;border-radius:var(--wpds-border-radius-sm,2px);color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);display:flex;font-family:-apple-system,system-ui,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;font-size:13px;font-weight:var(--wpds-typography-font-weight-default,400);line-height:20px;margin-block-end:4px;margin-inline:12px;min-height:32px;padding-block:0;padding-inline:4px;width:calc(100% - 24px)}.d5331ded354c389a__item.d5331ded354c389a__item:focus,.d5331ded354c389a__item.d5331ded354c389a__item:hover,.d5331ded354c389a__item.d5331ded354c389a__item[aria-current=true]{color:var(--wpds-color-foreground-interactive-brand-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 52%,#000))}.d5331ded354c389a__item.d5331ded354c389a__item svg:last-child{padding:4px}.d5331ded354c389a__item.d5331ded354c389a__item[aria-current=page],.d5331ded354c389a__item.d5331ded354c389a__item[data-status=active]{color:var(--wpds-color-foreground-interactive-brand-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 52%,#000));font-weight:var(--wpds-typography-font-weight-emphasis,600)}.d5331ded354c389a__item.d5331ded354c389a__item:focus-visible{transform:translateZ(0)}.d5331ded354c389a__item._44ce5374f19a05f7__is-compact{min-height:24px}");
103
+ }
104
+ var style_module_default = { "item": "d5331ded354c389a__item", "is-compact": "_44ce5374f19a05f7__is-compact" };
105
+
106
+ // packages/boot/src/components/navigation/dropdown-item/style.module.scss
107
+ if (typeof process === "undefined" || process.env.NODE_ENV !== "test") {
108
+ registerStyle("1a6b086e6c", "._093b894bfb82e8de__dropdown{display:block}._5954dba25ac6e16f__dropdown-children{display:flex;flex-direction:column;margin-block-end:2px;margin-block-start:-2px;margin-inline-start:30px;overflow:hidden;padding:2px}._9a14116ec9dae0e2__chevron.a9ebdaa3f36d6986__is-up{transform:rotate(180deg)}");
109
+ }
110
+ var style_module_default2 = { "dropdown": "_093b894bfb82e8de__dropdown", "dropdown-children": "_5954dba25ac6e16f__dropdown-children", "chevron": "_9a14116ec9dae0e2__chevron", "is-up": "a9ebdaa3f36d6986__is-up" };
25
111
 
26
112
  // packages/boot/src/components/navigation/dropdown-item/index.tsx
27
113
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -36,18 +122,18 @@ function DropdownItem({
36
122
  }) {
37
123
  const menuItems = useSelect(
38
124
  (select) => (
39
- // @ts-ignore
125
+ // @ts-expect-error Store types are not available when selecting by store name.
40
126
  select(STORE_NAME).getMenuItems()
41
127
  ),
42
128
  []
43
129
  );
44
130
  const items = menuItems.filter((item) => item.parent === id);
45
131
  const disableMotion = useReducedMotion();
46
- return /* @__PURE__ */ jsxs("div", { className: "boot-dropdown-item", children: [
132
+ return /* @__PURE__ */ jsxs("div", { className: style_module_default2.dropdown, children: [
47
133
  /* @__PURE__ */ jsx(
48
134
  Item,
49
135
  {
50
- className: clsx("boot-navigation-item", className),
136
+ className: clsx(style_module_default.item, className),
51
137
  onClick: (e) => {
52
138
  e.preventDefault();
53
139
  e.stopPropagation();
@@ -67,8 +153,8 @@ function DropdownItem({
67
153
  WCIcon,
68
154
  {
69
155
  icon: chevronDownSmall,
70
- className: clsx("boot-dropdown-item__chevron", {
71
- "is-up": isExpanded
156
+ className: clsx(style_module_default2.chevron, {
157
+ [style_module_default2["is-up"]]: isExpanded
72
158
  })
73
159
  }
74
160
  )
@@ -88,10 +174,11 @@ function DropdownItem({
88
174
  duration: disableMotion ? 0 : ANIMATION_DURATION,
89
175
  ease: "easeOut"
90
176
  },
91
- className: "boot-dropdown-item__children",
177
+ className: style_module_default2["dropdown-children"],
92
178
  children: items.map((item, index) => /* @__PURE__ */ jsx(
93
179
  NavigationItem,
94
180
  {
181
+ className: style_module_default["is-compact"],
95
182
  to: item.to,
96
183
  shouldShowPlaceholder: false,
97
184
  children: item.label
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../../../src/components/navigation/dropdown-item/index.tsx", "../../../../src/components/navigation/dropdown-item/style.scss"],
4
- "sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\nimport type { ReactNode } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tFlexBlock,\n\t__experimentalItem as Item,\n\t// @ts-ignore\n\t__experimentalHStack as HStack,\n\tIcon as WCIcon,\n\t__unstableMotion as motion,\n\t__unstableAnimatePresence as AnimatePresence,\n} from '@wordpress/components';\nimport { chevronDownSmall } from '@wordpress/icons';\nimport { useReducedMotion } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { STORE_NAME } from '../../../store';\nimport NavigationItem from '../navigation-item';\nimport { wrapIcon } from '../items';\nimport type { IconType, MenuItem } from '../../../store/types';\nimport './style.scss';\n\nconst ANIMATION_DURATION = 0.2;\n\ninterface DropdownItemProps {\n\t/**\n\t * Optional CSS class name.\n\t */\n\tclassName?: string;\n\t/**\n\t * Identifier of the parent menu item.\n\t */\n\tid: string;\n\t/**\n\t * Icon to display with the dropdown item.\n\t */\n\ticon?: IconType;\n\t/**\n\t * Whether to show placeholder icons for alignment.\n\t */\n\tshouldShowPlaceholder?: boolean;\n\t/**\n\t * Content to display inside the dropdown item.\n\t */\n\tchildren: ReactNode;\n\t/**\n\t * Whether this dropdown is currently expanded.\n\t */\n\tisExpanded: boolean;\n\t/**\n\t * Function to toggle this dropdown's expanded state.\n\t */\n\tonToggle: () => void;\n}\n\nexport default function DropdownItem( {\n\tclassName,\n\tid,\n\ticon,\n\tchildren,\n\tisExpanded,\n\tonToggle,\n}: DropdownItemProps ) {\n\tconst menuItems: MenuItem[] = useSelect(\n\t\t( select ) =>\n\t\t\t// @ts-ignore\n\t\t\tselect( STORE_NAME ).getMenuItems(),\n\t\t[]\n\t);\n\tconst items = menuItems.filter( ( item ) => item.parent === id );\n\tconst disableMotion = useReducedMotion();\n\treturn (\n\t\t<div className=\"boot-dropdown-item\">\n\t\t\t<Item\n\t\t\t\tclassName={ clsx( 'boot-navigation-item', className ) }\n\t\t\t\tonClick={ ( e ) => {\n\t\t\t\t\te.preventDefault();\n\t\t\t\t\te.stopPropagation();\n\t\t\t\t\tonToggle();\n\t\t\t\t} }\n\t\t\t\tonMouseDown={ ( e ) => e.preventDefault() }\n\t\t\t>\n\t\t\t\t<HStack\n\t\t\t\t\tjustify=\"flex-start\"\n\t\t\t\t\tspacing={ 2 }\n\t\t\t\t\tstyle={ { flexGrow: '1' } }\n\t\t\t\t>\n\t\t\t\t\t{ wrapIcon( icon, false ) }\n\t\t\t\t\t<FlexBlock>{ children }</FlexBlock>\n\t\t\t\t\t<WCIcon\n\t\t\t\t\t\ticon={ chevronDownSmall }\n\t\t\t\t\t\tclassName={ clsx( 'boot-dropdown-item__chevron', {\n\t\t\t\t\t\t\t'is-up': isExpanded,\n\t\t\t\t\t\t} ) }\n\t\t\t\t\t/>\n\t\t\t\t</HStack>\n\t\t\t</Item>\n\t\t\t<AnimatePresence initial={ false }>\n\t\t\t\t{ isExpanded && (\n\t\t\t\t\t<motion.div\n\t\t\t\t\t\tinitial={ { height: 0 } }\n\t\t\t\t\t\tanimate={ { height: 'auto' } }\n\t\t\t\t\t\texit={ { height: 0 } }\n\t\t\t\t\t\ttransition={ {\n\t\t\t\t\t\t\ttype: 'tween',\n\t\t\t\t\t\t\tduration: disableMotion ? 0 : ANIMATION_DURATION,\n\t\t\t\t\t\t\tease: 'easeOut',\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tclassName=\"boot-dropdown-item__children\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ items.map( ( item, index ) => (\n\t\t\t\t\t\t\t<NavigationItem\n\t\t\t\t\t\t\t\tkey={ index }\n\t\t\t\t\t\t\t\tto={ item.to }\n\t\t\t\t\t\t\t\tshouldShowPlaceholder={ false }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ item.label }\n\t\t\t\t\t\t\t</NavigationItem>\n\t\t\t\t\t\t) ) }\n\t\t\t\t\t</motion.div>\n\t\t\t\t) }\n\t\t\t</AnimatePresence>\n\t\t</div>\n\t);\n}\n", "if (typeof document !== 'undefined' && process.env.NODE_ENV !== 'test' && !document.head.querySelector(\"style[data-wp-hash='608eff82f3']\")) {\n\tconst style = document.createElement(\"style\");\n\tstyle.setAttribute(\"data-wp-hash\", \"608eff82f3\");\n\tstyle.appendChild(document.createTextNode(\".boot-dropdown-item__children{display:flex;flex-direction:column;margin-block-end:2px;margin-block-start:-2px;margin-inline-start:30px;overflow:hidden;padding:2px}.boot-dropdown-item__chevron.is-up{transform:rotate(180deg)}\"));\n\tdocument.head.appendChild(style);\n}\n"],
5
- "mappings": ";AAGA,OAAO,UAAU;AAMjB;AAAA,EACC;AAAA,EACA,sBAAsB;AAAA,EAEtB,wBAAwB;AAAA,EACx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BACA,MAAO;AAAA,kBACP,WAAY,KAAM,+BAA+B;AAAA,oBAChD,SAAS;AAAA,kBACV,CAAE;AAAA;AAAA,cACH;AAAA;AAAA;AAAA,QACD;AAAA;AAAA,IACD;AAAA,IACA,oBAAC,mBAAgB,SAAU,OACxB,wBACD;AAAA,MAAC,OAAO;AAAA,MAAP;AAAA,QACA,SAAU,EAAE,QAAQ,EAAE;AAAA,QACtB,SAAU,EAAE,QAAQ,OAAO;AAAA,QAC3B,MAAO,EAAE,QAAQ,EAAE;AAAA,QACnB,YAAa;AAAA,UACZ,MAAM;AAAA,UACN,UAAU,gBAAgB,IAAI;AAAA,UAC9B,MAAM;AAAA,QACP;AAAA,QACA,WAAU;AAAA,QAER,gBAAM,IAAK,CAAE,MAAM,UACpB;AAAA,UAAC;AAAA;AAAA,YAEA,IAAK,KAAK;AAAA,YACV,uBAAwB;AAAA,YAEtB,eAAK;AAAA;AAAA,UAJD;AAAA,QAKP,CACC;AAAA;AAAA,IACH,GAEF;AAAA,KACD;AAEF;",
6
- "names": []
3
+ "sources": ["../../../../src/components/navigation/dropdown-item/index.tsx", "../../../../../style-runtime/src/index.ts", "../../../../src/components/navigation/navigation-item/style.module.scss", "../../../../src/components/navigation/dropdown-item/style.module.scss"],
4
+ "sourcesContent": ["import clsx from 'clsx';\nimport type { ReactNode } from 'react';\nimport {\n\tFlexBlock,\n\t__experimentalItem as Item,\n\t__experimentalHStack as HStack,\n\tIcon as WCIcon,\n\t__unstableMotion as motion,\n\t__unstableAnimatePresence as AnimatePresence,\n} from '@wordpress/components';\nimport { chevronDownSmall } from '@wordpress/icons';\nimport { useReducedMotion } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\nimport { STORE_NAME } from '../../../store';\nimport NavigationItem from '../navigation-item';\nimport { wrapIcon } from '../items';\nimport type { IconType, MenuItem } from '../../../store/types';\nimport navigationItemStyles from '../navigation-item/style.module.scss';\nimport styles from './style.module.scss';\n\nconst ANIMATION_DURATION = 0.2;\n\ninterface DropdownItemProps {\n\t/**\n\t * Optional CSS class name.\n\t */\n\tclassName?: string;\n\t/**\n\t * Identifier of the parent menu item.\n\t */\n\tid: string;\n\t/**\n\t * Icon to display with the dropdown item.\n\t */\n\ticon?: IconType;\n\t/**\n\t * Whether to show placeholder icons for alignment.\n\t */\n\tshouldShowPlaceholder?: boolean;\n\t/**\n\t * Content to display inside the dropdown item.\n\t */\n\tchildren: ReactNode;\n\t/**\n\t * Whether this dropdown is currently expanded.\n\t */\n\tisExpanded: boolean;\n\t/**\n\t * Function to toggle this dropdown's expanded state.\n\t */\n\tonToggle: () => void;\n}\n\nexport default function DropdownItem( {\n\tclassName,\n\tid,\n\ticon,\n\tchildren,\n\tisExpanded,\n\tonToggle,\n}: DropdownItemProps ) {\n\tconst menuItems: MenuItem[] = useSelect(\n\t\t( select ) =>\n\t\t\t// @ts-expect-error Store types are not available when selecting by store name.\n\t\t\tselect( STORE_NAME ).getMenuItems(),\n\t\t[]\n\t);\n\tconst items = menuItems.filter( ( item ) => item.parent === id );\n\tconst disableMotion = useReducedMotion();\n\treturn (\n\t\t<div className={ styles.dropdown }>\n\t\t\t<Item\n\t\t\t\tclassName={ clsx( navigationItemStyles.item, className ) }\n\t\t\t\tonClick={ ( e ) => {\n\t\t\t\t\te.preventDefault();\n\t\t\t\t\te.stopPropagation();\n\t\t\t\t\tonToggle();\n\t\t\t\t} }\n\t\t\t\tonMouseDown={ ( e ) => e.preventDefault() }\n\t\t\t>\n\t\t\t\t<HStack\n\t\t\t\t\tjustify=\"flex-start\"\n\t\t\t\t\tspacing={ 2 }\n\t\t\t\t\tstyle={ { flexGrow: '1' } }\n\t\t\t\t>\n\t\t\t\t\t{ wrapIcon( icon, false ) }\n\t\t\t\t\t<FlexBlock>{ children }</FlexBlock>\n\t\t\t\t\t<WCIcon\n\t\t\t\t\t\ticon={ chevronDownSmall }\n\t\t\t\t\t\tclassName={ clsx( styles.chevron, {\n\t\t\t\t\t\t\t[ styles[ 'is-up' ] ]: isExpanded,\n\t\t\t\t\t\t} ) }\n\t\t\t\t\t/>\n\t\t\t\t</HStack>\n\t\t\t</Item>\n\t\t\t<AnimatePresence initial={ false }>\n\t\t\t\t{ isExpanded && (\n\t\t\t\t\t<motion.div\n\t\t\t\t\t\tinitial={ { height: 0 } }\n\t\t\t\t\t\tanimate={ { height: 'auto' } }\n\t\t\t\t\t\texit={ { height: 0 } }\n\t\t\t\t\t\ttransition={ {\n\t\t\t\t\t\t\ttype: 'tween',\n\t\t\t\t\t\t\tduration: disableMotion ? 0 : ANIMATION_DURATION,\n\t\t\t\t\t\t\tease: 'easeOut',\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tclassName={ styles[ 'dropdown-children' ] }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ items.map( ( item, index ) => (\n\t\t\t\t\t\t\t<NavigationItem\n\t\t\t\t\t\t\t\tkey={ index }\n\t\t\t\t\t\t\t\tclassName={\n\t\t\t\t\t\t\t\t\tnavigationItemStyles[ 'is-compact' ]\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tto={ item.to }\n\t\t\t\t\t\t\t\tshouldShowPlaceholder={ false }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ item.label }\n\t\t\t\t\t\t\t</NavigationItem>\n\t\t\t\t\t\t) ) }\n\t\t\t\t\t</motion.div>\n\t\t\t\t) }\n\t\t\t</AnimatePresence>\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(\"74796ab776\", \".d5331ded354c389a__item.d5331ded354c389a__item{align-items:center;border:none;border-radius:var(--wpds-border-radius-sm,2px);color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);display:flex;font-family:-apple-system,system-ui,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;font-size:13px;font-weight:var(--wpds-typography-font-weight-default,400);line-height:20px;margin-block-end:4px;margin-inline:12px;min-height:32px;padding-block:0;padding-inline:4px;width:calc(100% - 24px)}.d5331ded354c389a__item.d5331ded354c389a__item:focus,.d5331ded354c389a__item.d5331ded354c389a__item:hover,.d5331ded354c389a__item.d5331ded354c389a__item[aria-current=true]{color:var(--wpds-color-foreground-interactive-brand-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 52%,#000))}.d5331ded354c389a__item.d5331ded354c389a__item svg:last-child{padding:4px}.d5331ded354c389a__item.d5331ded354c389a__item[aria-current=page],.d5331ded354c389a__item.d5331ded354c389a__item[data-status=active]{color:var(--wpds-color-foreground-interactive-brand-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 52%,#000));font-weight:var(--wpds-typography-font-weight-emphasis,600)}.d5331ded354c389a__item.d5331ded354c389a__item:focus-visible{transform:translateZ(0)}.d5331ded354c389a__item._44ce5374f19a05f7__is-compact{min-height:24px}\");\n}\nexport default {\"item\":\"d5331ded354c389a__item\",\"is-compact\":\"_44ce5374f19a05f7__is-compact\"};\n", "import { registerStyle } from '@wordpress/style-runtime';\nif (typeof process === 'undefined' || process.env.NODE_ENV !== 'test') {\n\tregisterStyle(\"1a6b086e6c\", \"._093b894bfb82e8de__dropdown{display:block}._5954dba25ac6e16f__dropdown-children{display:flex;flex-direction:column;margin-block-end:2px;margin-block-start:-2px;margin-inline-start:30px;overflow:hidden;padding:2px}._9a14116ec9dae0e2__chevron.a9ebdaa3f36d6986__is-up{transform:rotate(180deg)}\");\n}\nexport default {\"dropdown\":\"_093b894bfb82e8de__dropdown\",\"dropdown-children\":\"_5954dba25ac6e16f__dropdown-children\",\"chevron\":\"_9a14116ec9dae0e2__chevron\",\"is-up\":\"a9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M;AAAA,UACN,UAAU,gBAAgB,IAAI;AAAA,UAC9B,MAAM;AAAA,QACP;AAAA,QACA,WAAYA,sBAAQ,mBAAoB;AAAA,QAEtC,gBAAM,IAAK,CAAE,MAAM,UACpB;AAAA,UAAC;AAAA;AAAA,YAEA,WACC,qBAAsB,YAAa;AAAA,YAEpC,IAAK,KAAK;AAAA,YACV,uBAAwB;AAAA,YAEtB,eAAK;AAAA;AAAA,UAPD;AAAA,QAQP,CACC;AAAA;AAAA,IACH,GAEF;AAAA,KACD;AAEF;",
6
+ "names": ["style_module_default", "style_module_default"]
7
7
  }
@@ -14,7 +14,7 @@ function Navigation() {
14
14
  const [parentId, setParentId, parentDropdownId, setParentDropdownId] = useSidebarParent();
15
15
  const menuItems = useSelect(
16
16
  (select) => (
17
- // @ts-ignore
17
+ // @ts-expect-error Store types are not available when selecting by store name.
18
18
  select(STORE_NAME).getMenuItems()
19
19
  ),
20
20
  []
@@ -57,7 +57,6 @@ function Navigation() {
57
57
  DropdownItem,
58
58
  {
59
59
  id: item.id,
60
- className: "boot-navigation-item",
61
60
  icon: item.icon,
62
61
  shouldShowPlaceholder: hasRealIcons,
63
62
  isExpanded: parentDropdownId === item.id,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/navigation/index.tsx"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useState, useMemo, useRef } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { STORE_NAME } from '../../store';\nimport NavigationItem from './navigation-item';\nimport DrilldownItem from './drilldown-item';\nimport DropdownItem from './dropdown-item';\nimport NavigationScreen from './navigation-screen';\nimport { useSidebarParent } from './use-sidebar-parent';\nimport type { MenuItem } from '../../store/types';\n\nfunction Navigation() {\n\tconst backButtonRef = useRef< HTMLButtonElement >( null );\n\tconst [ animationDirection, setAnimationDirection ] = useState<\n\t\t'forward' | 'backward' | null\n\t>( null );\n\tconst [ parentId, setParentId, parentDropdownId, setParentDropdownId ] =\n\t\tuseSidebarParent();\n\tconst menuItems = useSelect(\n\t\t( select ) =>\n\t\t\t// @ts-ignore\n\t\t\tselect( STORE_NAME ).getMenuItems() as MenuItem[],\n\t\t[]\n\t);\n\tconst parent = useMemo(\n\t\t() => menuItems.find( ( item ) => item.id === parentId ),\n\t\t[ menuItems, parentId ]\n\t);\n\t// Create a unique key for the current navigation state\n\t// The sidebar will animate when the key changes.\n\tconst navigationKey = parent ? `drilldown-${ parent.id }` : 'root';\n\n\t// We use transitions to handle navigation clicks\n\t// This allows smooth animations and non blocking navigation.\n\tconst handleNavigate = ( {\n\t\tid,\n\t\tdirection,\n\t}: {\n\t\tid?: string;\n\t\tdirection: 'forward' | 'backward';\n\t} ) => {\n\t\tsetAnimationDirection( direction );\n\t\tsetParentId( id );\n\t};\n\n\tconst handleDropdownToggle = ( dropdownId: string ) => {\n\t\tsetParentDropdownId(\n\t\t\tparentDropdownId === dropdownId ? undefined : dropdownId\n\t\t);\n\t};\n\n\tconst items = useMemo(\n\t\t() => menuItems.filter( ( item ) => item.parent === parentId ),\n\t\t[ menuItems, parentId ]\n\t);\n\n\tconst hasRealIcons = items.some( ( item ) => !! item.icon );\n\n\treturn (\n\t\t<NavigationScreen\n\t\t\tisRoot={ ! parent }\n\t\t\ttitle={ parent ? parent.label : '' }\n\t\t\tbackMenuItem={ parent?.parent }\n\t\t\tbackButtonRef={ backButtonRef }\n\t\t\tanimationDirection={ animationDirection || undefined }\n\t\t\tnavigationKey={ navigationKey }\n\t\t\tonNavigate={ handleNavigate }\n\t\t\tcontent={\n\t\t\t\t<div role=\"list\">\n\t\t\t\t\t{ items.map( ( item: MenuItem ) => {\n\t\t\t\t\t\tif ( item.parent_type === 'dropdown' ) {\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t<DropdownItem\n\t\t\t\t\t\t\t\t\tkey={ item.id }\n\t\t\t\t\t\t\t\t\tid={ item.id }\n\t\t\t\t\t\t\t\t\tclassName=\"boot-navigation-item\"\n\t\t\t\t\t\t\t\t\ticon={ item.icon }\n\t\t\t\t\t\t\t\t\tshouldShowPlaceholder={ hasRealIcons }\n\t\t\t\t\t\t\t\t\tisExpanded={ parentDropdownId === item.id }\n\t\t\t\t\t\t\t\t\tonToggle={ () =>\n\t\t\t\t\t\t\t\t\t\thandleDropdownToggle( item.id )\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ item.label }\n\t\t\t\t\t\t\t\t</DropdownItem>\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif ( item.parent_type === 'drilldown' ) {\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t<DrilldownItem\n\t\t\t\t\t\t\t\t\tkey={ item.id }\n\t\t\t\t\t\t\t\t\tid={ item.id }\n\t\t\t\t\t\t\t\t\ticon={ item.icon }\n\t\t\t\t\t\t\t\t\tshouldShowPlaceholder={ hasRealIcons }\n\t\t\t\t\t\t\t\t\tonNavigate={ handleNavigate }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ item.label }\n\t\t\t\t\t\t\t\t</DrilldownItem>\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<NavigationItem\n\t\t\t\t\t\t\t\tkey={ item.id }\n\t\t\t\t\t\t\t\tto={ item.to }\n\t\t\t\t\t\t\t\ticon={ item.icon }\n\t\t\t\t\t\t\t\tshouldShowPlaceholder={ hasRealIcons }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ item.label }\n\t\t\t\t\t\t\t</NavigationItem>\n\t\t\t\t\t\t);\n\t\t\t\t\t} ) }\n\t\t\t\t</div>\n\t\t\t}\n\t\t/>\n\t);\n}\n\nexport default Navigation;\n"],
5
- "mappings": ";AAGA,SAAS,UAAU,SAAS,cAAc;AAC1C,SAAS,iBAA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AE,SAAoB;AAClC,YAAK,KAAK,gBAAgB,YAAa;AACtC,iBACC;AAAA,YAAC;AAAA;AAAA,cAEA,IAAK,KAAK;AAAA,cACV,WAAU;AAAA,cACV,MAAO,KAAK;AAAA,cACZ,uBAAwB;AAAA,cACxB,YAAa,qBAAqB,KAAK;AAAA,cACvC,UAAW,MACV,qBAAsB,KAAK,EAAG;AAAA,cAG7B,eAAK;AAAA;AAAA,YAVD,KAAK;AAAA,UAWZ;AAAA,QAEF;AAEA,YAAK,KAAK,gBAAgB,aAAc;AACvC,iBACC;AAAA,YAAC;AAAA;AAAA,cAEA,IAAK,KAAK;AAAA,cACV,MAAO,KAAK;AAAA,cACZ,uBAAwB;AAAA,cACxB,YAAa;AAAA,cAEX,eAAK;AAAA;AAAA,YAND,KAAK;AAAA,UAOZ;AAAA,QAEF;AAEA,eACC;AAAA,UAAC;AAAA;AAAA,YAEA,IAAK,KAAK;AAAA,YACV,MAAO,KAAK;AAAA,YACZ,uBAAwB;AAAA,YAEtB,eAAK;AAAA;AAAA,UALD,KAAK;AAAA,QAMZ;AAAA,MAEF,CAAE,GACH;AAAA;AAAA,EAEF;AAEF;AAEA,IAAO,qBAAQ;",
4
+ "sourcesContent": ["import { useState, useMemo, useRef } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { STORE_NAME } from '../../store';\nimport NavigationItem from './navigation-item';\nimport DrilldownItem from './drilldown-item';\nimport DropdownItem from './dropdown-item';\nimport NavigationScreen from './navigation-screen';\nimport { useSidebarParent } from './use-sidebar-parent';\nimport type { MenuItem } from '../../store/types';\n\nfunction Navigation() {\n\tconst backButtonRef = useRef< HTMLButtonElement >( null );\n\tconst [ animationDirection, setAnimationDirection ] = useState<\n\t\t'forward' | 'backward' | null\n\t>( null );\n\tconst [ parentId, setParentId, parentDropdownId, setParentDropdownId ] =\n\t\tuseSidebarParent();\n\tconst menuItems = useSelect(\n\t\t( select ) =>\n\t\t\t// @ts-expect-error Store types are not available when selecting by store name.\n\t\t\tselect( STORE_NAME ).getMenuItems() as MenuItem[],\n\t\t[]\n\t);\n\tconst parent = useMemo(\n\t\t() => menuItems.find( ( item ) => item.id === parentId ),\n\t\t[ menuItems, parentId ]\n\t);\n\t// Create a unique key for the current navigation state\n\t// The sidebar will animate when the key changes.\n\tconst navigationKey = parent ? `drilldown-${ parent.id }` : 'root';\n\n\t// We use transitions to handle navigation clicks\n\t// This allows smooth animations and non blocking navigation.\n\tconst handleNavigate = ( {\n\t\tid,\n\t\tdirection,\n\t}: {\n\t\tid?: string;\n\t\tdirection: 'forward' | 'backward';\n\t} ) => {\n\t\tsetAnimationDirection( direction );\n\t\tsetParentId( id );\n\t};\n\n\tconst handleDropdownToggle = ( dropdownId: string ) => {\n\t\tsetParentDropdownId(\n\t\t\tparentDropdownId === dropdownId ? undefined : dropdownId\n\t\t);\n\t};\n\n\tconst items = useMemo(\n\t\t() => menuItems.filter( ( item ) => item.parent === parentId ),\n\t\t[ menuItems, parentId ]\n\t);\n\n\tconst hasRealIcons = items.some( ( item ) => !! item.icon );\n\n\treturn (\n\t\t<NavigationScreen\n\t\t\tisRoot={ ! parent }\n\t\t\ttitle={ parent ? parent.label : '' }\n\t\t\tbackMenuItem={ parent?.parent }\n\t\t\tbackButtonRef={ backButtonRef }\n\t\t\tanimationDirection={ animationDirection || undefined }\n\t\t\tnavigationKey={ navigationKey }\n\t\t\tonNavigate={ handleNavigate }\n\t\t\tcontent={\n\t\t\t\t<div role=\"list\">\n\t\t\t\t\t{ items.map( ( item: MenuItem ) => {\n\t\t\t\t\t\tif ( item.parent_type === 'dropdown' ) {\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t<DropdownItem\n\t\t\t\t\t\t\t\t\tkey={ item.id }\n\t\t\t\t\t\t\t\t\tid={ item.id }\n\t\t\t\t\t\t\t\t\ticon={ item.icon }\n\t\t\t\t\t\t\t\t\tshouldShowPlaceholder={ hasRealIcons }\n\t\t\t\t\t\t\t\t\tisExpanded={ parentDropdownId === item.id }\n\t\t\t\t\t\t\t\t\tonToggle={ () =>\n\t\t\t\t\t\t\t\t\t\thandleDropdownToggle( item.id )\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ item.label }\n\t\t\t\t\t\t\t\t</DropdownItem>\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif ( item.parent_type === 'drilldown' ) {\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t<DrilldownItem\n\t\t\t\t\t\t\t\t\tkey={ item.id }\n\t\t\t\t\t\t\t\t\tid={ item.id }\n\t\t\t\t\t\t\t\t\ticon={ item.icon }\n\t\t\t\t\t\t\t\t\tshouldShowPlaceholder={ hasRealIcons }\n\t\t\t\t\t\t\t\t\tonNavigate={ handleNavigate }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ item.label }\n\t\t\t\t\t\t\t\t</DrilldownItem>\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<NavigationItem\n\t\t\t\t\t\t\t\tkey={ item.id }\n\t\t\t\t\t\t\t\tto={ item.to }\n\t\t\t\t\t\t\t\ticon={ item.icon }\n\t\t\t\t\t\t\t\tshouldShowPlaceholder={ hasRealIcons }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ item.label }\n\t\t\t\t\t\t\t</NavigationItem>\n\t\t\t\t\t\t);\n\t\t\t\t\t} ) }\n\t\t\t\t</div>\n\t\t\t}\n\t\t/>\n\t);\n}\n\nexport default Navigation;\n"],
5
+ "mappings": ";AAAA,SAAS,UAAU,SAAS,cAAc;AAC1C,SAAS,iBAAiB;AAC1B,SAAS,kBAAkB;AAC3B,OAAO,oBAAoB;AAC3B,OAAO,mBAAmB;AAC1B,OAAO,kBAAkB;AACzB,OAAO,sBAAsB;AAC7B,SAAS,wBAAwB;AAgEzB;AA7DR,SAA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,YAAa,qBAAqB,KAAK;AAAA,cACvC,UAAW,MACV,qBAAsB,KAAK,EAAG;AAAA,cAG7B,eAAK;AAAA;AAAA,YATD,KAAK;AAAA,UAUZ;AAAA,QAEF;AAEA,YAAK,KAAK,gBAAgB,aAAc;AACvC,iBACC;AAAA,YAAC;AAAA;AAAA,cAEA,IAAK,KAAK;AAAA,cACV,MAAO,KAAK;AAAA,cACZ,uBAAwB;AAAA,cACxB,YAAa;AAAA,cAEX,eAAK;AAAA;AAAA,YAND,KAAK;AAAA,UAOZ;AAAA,QAEF;AAEA,eACC;AAAA,UAAC;AAAA;AAAA,YAEA,IAAK,KAAK;AAAA,YACV,MAAO,KAAK;AAAA,YACZ,uBAAwB;AAAA,YAEtB,eAAK;AAAA;AAAA,UALD,KAAK;AAAA,QAMZ;AAAA,MAEF,CAAE,GACH;AAAA;AAAA,EAEF;AAEF;AAEA,IAAO,qBAAQ;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/navigation/items.tsx"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { isValidElement } from '@wordpress/element';\nimport { Dashicon, Icon as WCIcon } from '@wordpress/components';\nimport { SVG } from '@wordpress/primitives';\n\n/**\n * Internal dependencies\n */\nimport type { IconType } from '../../store/types';\n\n/**\n * Type guard for verifying whether a given element\n * is a valid SVG element for the Icon component.\n *\n * @param element - The element to check\n */\nfunction isSvg( element: unknown ): element is React.JSX.Element {\n\treturn (\n\t\tisValidElement( element ) &&\n\t\t( element.type === SVG || element.type === 'svg' )\n\t);\n}\n\n/**\n * Converts the given IconType into a renderable component:\n * - Dashicon string into a Dashicon component\n * - JSX SVG element into an Icon component\n * - Data URL into an img element\n *\n * @param icon - The icon to convert\n * @param shouldShowPlaceholder - Whether to show placeholder when no icon is provided\n * @return The converted icon as a JSX element\n */\nexport function wrapIcon(\n\ticon?: IconType,\n\tshouldShowPlaceholder: boolean = true\n) {\n\tif ( isSvg( icon ) ) {\n\t\treturn <WCIcon icon={ icon } />;\n\t}\n\n\tif ( typeof icon === 'string' && icon.startsWith( 'dashicons-' ) ) {\n\t\tconst iconKey = icon.replace(\n\t\t\t/^dashicons-/,\n\t\t\t''\n\t\t) as React.ComponentProps< typeof Dashicon >[ 'icon' ];\n\n\t\treturn (\n\t\t\t<Dashicon\n\t\t\t\tstyle={ { padding: '2px' } }\n\t\t\t\ticon={ iconKey }\n\t\t\t\taria-hidden=\"true\"\n\t\t\t/>\n\t\t);\n\t}\n\n\t// Handle data URLs (SVG images)\n\tif ( typeof icon === 'string' && icon.startsWith( 'data:' ) ) {\n\t\treturn (\n\t\t\t<img\n\t\t\t\tsrc={ icon }\n\t\t\t\talt=\"\"\n\t\t\t\taria-hidden=\"true\"\n\t\t\t\tstyle={ {\n\t\t\t\t\twidth: '20px',\n\t\t\t\t\theight: '20px',\n\t\t\t\t\tdisplay: 'block',\n\t\t\t\t\tpadding: '2px',\n\t\t\t\t} }\n\t\t\t/>\n\t\t);\n\t}\n\n\t// If icon is provided and valid, return it as-is\n\tif ( icon ) {\n\t\treturn icon;\n\t}\n\n\t// Return empty 24px placeholder for alignment when no icon is provided\n\t// Only if shouldShowPlaceholder is true\n\tif ( shouldShowPlaceholder ) {\n\t\treturn (\n\t\t\t<div\n\t\t\t\tstyle={ { width: '24px', height: '24px' } }\n\t\t\t\taria-hidden=\"true\"\n\t\t\t/>\n\t\t);\n\t}\n\n\treturn null;\n}\n"],
5
- "mappings": ";AAGA,SAAS,sBAAsB;AAC/B,SAAS,UAAU,QAAQ,cAAc;AACzC,SAAS,WAAW;AAmCX;AAtBT,SAAS,MAAO,SAAiD;AAChE,SACC,eAAgB,OAAQ,MACtB,QAAQ,SAAS,OAAO,QAAQ,SAAS;AAE7C;AAYO,SAAS,SACf,MACA,wBAAiC,MAChC;AACD,MAAK,MAAO,IAAK,GAAI;AACpB,WAAO,oBAAC,UAAO,MAAc;AAAA,EAC9B;AAEA,MAAK,OAAO,SAAS,YAAY,KAAK,WAAY,YAAa,GAAI;AAClE,UAAM,UAAU,KAAK;AAAA,MACpB;AAAA,MACA;AAAA,IACD;AAEA,WACC;AAAA,MAAC;AAAA;AAAA,QACA,OAAQ,EAAE,SAAS,MAAM;AAAA,QACzB,MAAO;AAAA,QACP,eAAY;AAAA;AAAA,IACb;AAAA,EAEF;AAGA,MAAK,OAAO,SAAS,YAAY,KAAK,WAAY,OAAQ,GAAI;AAC7D,WACC;AAAA,MAAC;AAAA;AAAA,QACA,KAAM;AAAA,QACN,KAAI;AAAA,QACJ,eAAY;AAAA,QACZ,OAAQ;AAAA,UACP,OAAO;AAAA,UACP,QAAQ;AAAA,UACR,SAAS;AAAA,UACT,SAAS;AAAA,QACV;AAAA;AAAA,IACD;AAAA,EAEF;AAGA,MAAK,MAAO;AACX,WAAO;AAAA,EACR;AAIA,MAAK,uBAAwB;AAC5B,WACC;AAAA,MAAC;AAAA;AAAA,QACA,OAAQ,EAAE,OAAO,QAAQ,QAAQ,OAAO;AAAA,QACxC,eAAY;AAAA;AAAA,IACb;AAAA,EAEF;AAEA,SAAO;AACR;",
4
+ "sourcesContent": ["import { isValidElement } from '@wordpress/element';\nimport { Dashicon, Icon as WCIcon } from '@wordpress/components';\nimport { SVG } from '@wordpress/primitives';\nimport type { IconType } from '../../store/types';\n\n/**\n * Type guard for verifying whether a given element\n * is a valid SVG element for the Icon component.\n *\n * @param element - The element to check\n */\nfunction isSvg( element: unknown ): element is React.JSX.Element {\n\treturn (\n\t\tisValidElement( element ) &&\n\t\t( element.type === SVG || element.type === 'svg' )\n\t);\n}\n\n/**\n * Converts the given IconType into a renderable component:\n * - Dashicon string into a Dashicon component\n * - JSX SVG element into an Icon component\n * - Data URL into an img element\n *\n * @param icon - The icon to convert\n * @param shouldShowPlaceholder - Whether to show placeholder when no icon is provided\n * @return The converted icon as a JSX element\n */\nexport function wrapIcon(\n\ticon?: IconType,\n\tshouldShowPlaceholder: boolean = true\n) {\n\tif ( isSvg( icon ) ) {\n\t\treturn <WCIcon icon={ icon } />;\n\t}\n\n\tif ( typeof icon === 'string' && icon.startsWith( 'dashicons-' ) ) {\n\t\tconst iconKey = icon.replace(\n\t\t\t/^dashicons-/,\n\t\t\t''\n\t\t) as React.ComponentProps< typeof Dashicon >[ 'icon' ];\n\n\t\treturn (\n\t\t\t<Dashicon\n\t\t\t\tstyle={ { padding: '2px' } }\n\t\t\t\ticon={ iconKey }\n\t\t\t\taria-hidden=\"true\"\n\t\t\t/>\n\t\t);\n\t}\n\n\t// Handle data URLs (SVG images)\n\tif ( typeof icon === 'string' && icon.startsWith( 'data:' ) ) {\n\t\treturn (\n\t\t\t<img\n\t\t\t\tsrc={ icon }\n\t\t\t\talt=\"\"\n\t\t\t\taria-hidden=\"true\"\n\t\t\t\tstyle={ {\n\t\t\t\t\twidth: '20px',\n\t\t\t\t\theight: '20px',\n\t\t\t\t\tdisplay: 'block',\n\t\t\t\t\tpadding: '2px',\n\t\t\t\t} }\n\t\t\t/>\n\t\t);\n\t}\n\n\t// If icon is provided and valid, return it as-is\n\tif ( icon ) {\n\t\treturn icon;\n\t}\n\n\t// Return empty 24px placeholder for alignment when no icon is provided\n\t// Only if shouldShowPlaceholder is true\n\tif ( shouldShowPlaceholder ) {\n\t\treturn (\n\t\t\t<div\n\t\t\t\tstyle={ { width: '24px', height: '24px' } }\n\t\t\t\taria-hidden=\"true\"\n\t\t\t/>\n\t\t);\n\t}\n\n\treturn null;\n}\n"],
5
+ "mappings": ";AAAA,SAAS,sBAAsB;AAC/B,SAAS,UAAU,QAAQ,cAAc;AACzC,SAAS,WAAW;AA+BX;AAtBT,SAAS,MAAO,SAAiD;AAChE,SACC,eAAgB,OAAQ,MACtB,QAAQ,SAAS,OAAO,QAAQ,SAAS;AAE7C;AAYO,SAAS,SACf,MACA,wBAAiC,MAChC;AACD,MAAK,MAAO,IAAK,GAAI;AACpB,WAAO,oBAAC,UAAO,MAAc;AAAA,EAC9B;AAEA,MAAK,OAAO,SAAS,YAAY,KAAK,WAAY,YAAa,GAAI;AAClE,UAAM,UAAU,KAAK;AAAA,MACpB;AAAA,MACA;AAAA,IACD;AAEA,WACC;AAAA,MAAC;AAAA;AAAA,QACA,OAAQ,EAAE,SAAS,MAAM;AAAA,QACzB,MAAO;AAAA,QACP,eAAY;AAAA;AAAA,IACb;AAAA,EAEF;AAGA,MAAK,OAAO,SAAS,YAAY,KAAK,WAAY,OAAQ,GAAI;AAC7D,WACC;AAAA,MAAC;AAAA;AAAA,QACA,KAAM;AAAA,QACN,KAAI;AAAA,QACJ,eAAY;AAAA,QACZ,OAAQ;AAAA,UACP,OAAO;AAAA,UACP,QAAQ;AAAA,UACR,SAAS;AAAA,UACT,SAAS;AAAA,QACV;AAAA;AAAA,IACD;AAAA,EAEF;AAGA,MAAK,MAAO;AACX,WAAO;AAAA,EACR;AAIA,MAAK,uBAAwB;AAC5B,WACC;AAAA,MAAC;AAAA;AAAA,QACA,OAAQ,EAAE,OAAO,QAAQ,QAAQ,OAAO;AAAA,QACxC,eAAY;AAAA;AAAA,IACb;AAAA,EAEF;AAEA,SAAO;AACR;",
6
6
  "names": []
7
7
  }
@@ -8,13 +8,93 @@ import {
8
8
  import RouterLinkItem from "../router-link-item.mjs";
9
9
  import { wrapIcon } from "../items.mjs";
10
10
 
11
- // packages/boot/src/components/navigation/navigation-item/style.scss
12
- if (typeof document !== "undefined" && process.env.NODE_ENV !== "test" && !document.head.querySelector("style[data-wp-hash='4e60007e70']")) {
13
- const style = document.createElement("style");
14
- style.setAttribute("data-wp-hash", "4e60007e70");
15
- style.appendChild(document.createTextNode(".boot-navigation-item.components-item{align-items:center;border:none;color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);display:flex;font-family:-apple-system,system-ui,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;font-size:13px;font-weight:var(--wpds-typography-font-weight-default,400);line-height:20px;margin-block-end:4px;margin-inline:12px;min-height:32px;padding-block:0;padding-inline:4px;width:calc(100% - 24px)}.boot-dropdown-item__children .boot-navigation-item.components-item{min-height:24px}.boot-navigation-item.components-item{border-radius:var(--wpds-border-radius-sm,2px)}.boot-navigation-item.components-item.active,.boot-navigation-item.components-item:focus,.boot-navigation-item.components-item:hover,.boot-navigation-item.components-item[aria-current=true]{color:var(--wpds-color-foreground-interactive-brand-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 52%,#000))}.boot-navigation-item.components-item.active{font-weight:var(--wpds-typography-font-weight-emphasis,600)}.boot-navigation-item.components-item svg:last-child{padding:4px}.boot-navigation-item.components-item[aria-current=true]{color:var(--wpds-color-foreground-interactive-brand-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 52%,#000));font-weight:var(--wpds-typography-font-weight-emphasis,600)}.boot-navigation-item.components-item:focus-visible{transform:translateZ(0)}.boot-navigation-item.components-item.with-suffix{padding-right:16px}"));
16
- document.head.appendChild(style);
11
+ // packages/style-runtime/src/index.ts
12
+ var STYLE_HASH_ATTRIBUTE = "data-wp-hash";
13
+ function getRuntime() {
14
+ const globalScope = globalThis;
15
+ if (globalScope.__wpStyleRuntime) {
16
+ return globalScope.__wpStyleRuntime;
17
+ }
18
+ globalScope.__wpStyleRuntime = {
19
+ documents: /* @__PURE__ */ new Map(),
20
+ styles: /* @__PURE__ */ new Map(),
21
+ injectedStyles: /* @__PURE__ */ new WeakMap()
22
+ };
23
+ if (typeof document !== "undefined") {
24
+ registerDocument(document);
25
+ }
26
+ return globalScope.__wpStyleRuntime;
27
+ }
28
+ function documentContainsStyleHash(targetDocument, hash) {
29
+ if (!targetDocument.head) {
30
+ return false;
31
+ }
32
+ for (const style of targetDocument.head.querySelectorAll(
33
+ `style[${STYLE_HASH_ATTRIBUTE}]`
34
+ )) {
35
+ if (style.getAttribute(STYLE_HASH_ATTRIBUTE) === hash) {
36
+ return true;
37
+ }
38
+ }
39
+ return false;
40
+ }
41
+ function injectStyle(targetDocument, hash, css) {
42
+ if (!targetDocument.head) {
43
+ return;
44
+ }
45
+ const runtime = getRuntime();
46
+ let injectedStyles = runtime.injectedStyles.get(targetDocument);
47
+ if (!injectedStyles) {
48
+ injectedStyles = /* @__PURE__ */ new Set();
49
+ runtime.injectedStyles.set(targetDocument, injectedStyles);
50
+ }
51
+ if (injectedStyles.has(hash)) {
52
+ return;
53
+ }
54
+ if (documentContainsStyleHash(targetDocument, hash)) {
55
+ injectedStyles.add(hash);
56
+ return;
57
+ }
58
+ const style = targetDocument.createElement("style");
59
+ style.setAttribute(STYLE_HASH_ATTRIBUTE, hash);
60
+ style.appendChild(targetDocument.createTextNode(css));
61
+ targetDocument.head.appendChild(style);
62
+ injectedStyles.add(hash);
17
63
  }
64
+ function registerDocument(targetDocument) {
65
+ const runtime = getRuntime();
66
+ runtime.documents.set(
67
+ targetDocument,
68
+ (runtime.documents.get(targetDocument) ?? 0) + 1
69
+ );
70
+ for (const [hash, css] of runtime.styles) {
71
+ injectStyle(targetDocument, hash, css);
72
+ }
73
+ return () => {
74
+ const count = runtime.documents.get(targetDocument);
75
+ if (count === void 0) {
76
+ return;
77
+ }
78
+ if (count <= 1) {
79
+ runtime.documents.delete(targetDocument);
80
+ return;
81
+ }
82
+ runtime.documents.set(targetDocument, count - 1);
83
+ };
84
+ }
85
+ function registerStyle(hash, css) {
86
+ const runtime = getRuntime();
87
+ runtime.styles.set(hash, css);
88
+ for (const targetDocument of runtime.documents.keys()) {
89
+ injectStyle(targetDocument, hash, css);
90
+ }
91
+ }
92
+
93
+ // packages/boot/src/components/navigation/navigation-item/style.module.scss
94
+ if (typeof process === "undefined" || process.env.NODE_ENV !== "test") {
95
+ registerStyle("74796ab776", ".d5331ded354c389a__item.d5331ded354c389a__item{align-items:center;border:none;border-radius:var(--wpds-border-radius-sm,2px);color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);display:flex;font-family:-apple-system,system-ui,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;font-size:13px;font-weight:var(--wpds-typography-font-weight-default,400);line-height:20px;margin-block-end:4px;margin-inline:12px;min-height:32px;padding-block:0;padding-inline:4px;width:calc(100% - 24px)}.d5331ded354c389a__item.d5331ded354c389a__item:focus,.d5331ded354c389a__item.d5331ded354c389a__item:hover,.d5331ded354c389a__item.d5331ded354c389a__item[aria-current=true]{color:var(--wpds-color-foreground-interactive-brand-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 52%,#000))}.d5331ded354c389a__item.d5331ded354c389a__item svg:last-child{padding:4px}.d5331ded354c389a__item.d5331ded354c389a__item[aria-current=page],.d5331ded354c389a__item.d5331ded354c389a__item[data-status=active]{color:var(--wpds-color-foreground-interactive-brand-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 52%,#000));font-weight:var(--wpds-typography-font-weight-emphasis,600)}.d5331ded354c389a__item.d5331ded354c389a__item:focus-visible{transform:translateZ(0)}.d5331ded354c389a__item._44ce5374f19a05f7__is-compact{min-height:24px}");
96
+ }
97
+ var style_module_default = { "item": "d5331ded354c389a__item", "is-compact": "_44ce5374f19a05f7__is-compact" };
18
98
 
19
99
  // packages/boot/src/components/navigation/navigation-item/index.tsx
20
100
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -38,19 +118,12 @@ function NavigationItem({
38
118
  {
39
119
  as: "a",
40
120
  href: to,
41
- className: clsx("boot-navigation-item", className),
121
+ className: clsx(style_module_default.item, className),
42
122
  children: content
43
123
  }
44
124
  );
45
125
  }
46
- return /* @__PURE__ */ jsx(
47
- RouterLinkItem,
48
- {
49
- to,
50
- className: clsx("boot-navigation-item", className),
51
- children: content
52
- }
53
- );
126
+ return /* @__PURE__ */ jsx(RouterLinkItem, { to, className: clsx(style_module_default.item, className), children: content });
54
127
  }
55
128
  export {
56
129
  NavigationItem as default
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../../../src/components/navigation/navigation-item/index.tsx", "../../../../src/components/navigation/navigation-item/style.scss"],
4
- "sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\nimport type { ReactNode } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tFlexBlock,\n\t__experimentalItem as Item,\n\t// @ts-ignore\n\t__experimentalHStack as HStack,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport RouterLinkItem from '../router-link-item';\nimport { wrapIcon } from '../items';\nimport type { IconType } from '../../../store/types';\nimport './style.scss';\n\ninterface NavigationItemProps {\n\t/**\n\t * Optional CSS class name.\n\t */\n\tclassName?: string;\n\t/**\n\t * Icon to display with the navigation item.\n\t */\n\ticon?: IconType;\n\t/**\n\t * Whether to show placeholder icons for alignment.\n\t */\n\tshouldShowPlaceholder?: boolean;\n\t/**\n\t * Content to display inside the navigation item.\n\t */\n\tchildren: ReactNode;\n\t/**\n\t * The path to navigate to.\n\t */\n\tto: string;\n}\n\nexport default function NavigationItem( {\n\tclassName,\n\ticon,\n\tshouldShowPlaceholder = true,\n\tchildren,\n\tto,\n}: NavigationItemProps ) {\n\t// Check if the 'to' prop is an external URL\n\tconst isExternal = ! String(\n\t\tnew URL( to, window.location.origin )\n\t).startsWith( window.location.origin );\n\n\tconst content = (\n\t\t<HStack justify=\"flex-start\" spacing={ 2 } style={ { flexGrow: '1' } }>\n\t\t\t{ wrapIcon( icon, shouldShowPlaceholder ) }\n\t\t\t<FlexBlock>{ children }</FlexBlock>\n\t\t</HStack>\n\t);\n\n\tif ( isExternal ) {\n\t\t// Render as a regular anchor tag for external URLs\n\t\treturn (\n\t\t\t<Item\n\t\t\t\tas=\"a\"\n\t\t\t\thref={ to }\n\t\t\t\tclassName={ clsx( 'boot-navigation-item', className ) }\n\t\t\t>\n\t\t\t\t{ content }\n\t\t\t</Item>\n\t\t);\n\t}\n\n\treturn (\n\t\t<RouterLinkItem\n\t\t\tto={ to }\n\t\t\tclassName={ clsx( 'boot-navigation-item', className ) }\n\t\t>\n\t\t\t{ content }\n\t\t</RouterLinkItem>\n\t);\n}\n", "if (typeof document !== 'undefined' && process.env.NODE_ENV !== 'test' && !document.head.querySelector(\"style[data-wp-hash='4e60007e70']\")) {\n\tconst style = document.createElement(\"style\");\n\tstyle.setAttribute(\"data-wp-hash\", \"4e60007e70\");\n\tstyle.appendChild(document.createTextNode(\".boot-navigation-item.components-item{align-items:center;border:none;color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);display:flex;font-family:-apple-system,system-ui,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;font-size:13px;font-weight:var(--wpds-typography-font-weight-default,400);line-height:20px;margin-block-end:4px;margin-inline:12px;min-height:32px;padding-block:0;padding-inline:4px;width:calc(100% - 24px)}.boot-dropdown-item__children .boot-navigation-item.components-item{min-height:24px}.boot-navigation-item.components-item{border-radius:var(--wpds-border-radius-sm,2px)}.boot-navigation-item.components-item.active,.boot-navigation-item.components-item:focus,.boot-navigation-item.components-item:hover,.boot-navigation-item.components-item[aria-current=true]{color:var(--wpds-color-foreground-interactive-brand-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 52%,#000))}.boot-navigation-item.components-item.active{font-weight:var(--wpds-typography-font-weight-emphasis,600)}.boot-navigation-item.components-item svg:last-child{padding:4px}.boot-navigation-item.components-item[aria-current=true]{color:var(--wpds-color-foreground-interactive-brand-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 52%,#000));font-weight:var(--wpds-typography-font-weight-emphasis,600)}.boot-navigation-item.components-item:focus-visible{transform:translateZ(0)}.boot-navigation-item.components-item.with-suffix{padding-right:16px}\"));\n\tdocument.head.appendChild(style);\n}\n"],
5
- "mappings": ";AAGA,OAAO,UAAU;AAMjB;AAAA,EACC;AAAA,EACA,sBAAsB;AAAA,EAEtB,wBAAwB;AAAA,OAClB;AAKP,OAAO,oBAAoB;AAC3B,SAAS,gBAAgB;;;ACpBzB,IAAI,OAAO,aAAa,eAAe,QAAQ,IAAI,aAAa,UAAU,CAAC,SAAS,KAAK,cAAc,kCAAkC,GAAG;AAC3I,QAAM,QAAQ,SAAS,cAAc,OAAO;AAC5C,QAAM,aAAa,gBAAgB,YAAY;AAC/C,QAAM,YAAY,SAAS,eAAe,69CAA69C,CAAC;AACxgD,WAAS,KAAK,YAAY,KAAK;AAChC;;;ADuDE,SAEC,KAFD;AAba,SAAR,eAAiC;AAAA,EACvC;AAAA,EACA;AAAA,EACA,wBAAwB;AAAA,EACxB;AAAA,EACA;AACD,GAAyB;AAExB,QAAM,aAAa,CAAE;AAAA,IACpB,IAAI,IAAK,IAAI,OAAO,SAAS,MAAO;AAAA,EACrC,EAAE,WAAY,OAAO,SAAS,MAAO;AAErC,QAAM,UACL,qBAAC,UAAO,SAAQ,cAAa,SAAU,GAAI,OAAQ,EAAE,UAAU,IAAI,GAChE;AAAA,aAAU,MAAM,qBAAsB;AAAA,IACxC,oBAAC,aAAY,UAAU;AAAA,KACxB;AAGD,MAAK,YAAa;AAEjB,WACC;AAAA,MAAC;AAAA;AAAA,QACA,IAAG;AAAA,QACH,MAAO;AAAA,QACP,WAAY,KAAM,wBAAwB,SAAU;AAAA,QAElD;AAAA;AAAA,IACH;AAAA,EAEF;AAEA,SACC;AAAA,IAAC;AAAA;AAAA,MACA;AAAA,MACA,WAAY,KAAM,wBAAwB,SAAU;AAAA,MAElD;AAAA;AAAA,EACH;AAEF;",
3
+ "sources": ["../../../../src/components/navigation/navigation-item/index.tsx", "../../../../../style-runtime/src/index.ts", "../../../../src/components/navigation/navigation-item/style.module.scss"],
4
+ "sourcesContent": ["import clsx from 'clsx';\nimport type { ReactNode } from 'react';\nimport {\n\tFlexBlock,\n\t__experimentalItem as Item,\n\t__experimentalHStack as HStack,\n} from '@wordpress/components';\nimport RouterLinkItem from '../router-link-item';\nimport { wrapIcon } from '../items';\nimport type { IconType } from '../../../store/types';\nimport styles from './style.module.scss';\n\ninterface NavigationItemProps {\n\t/**\n\t * Optional CSS class name.\n\t */\n\tclassName?: string;\n\t/**\n\t * Icon to display with the navigation item.\n\t */\n\ticon?: IconType;\n\t/**\n\t * Whether to show placeholder icons for alignment.\n\t */\n\tshouldShowPlaceholder?: boolean;\n\t/**\n\t * Content to display inside the navigation item.\n\t */\n\tchildren: ReactNode;\n\t/**\n\t * The path to navigate to.\n\t */\n\tto: string;\n}\n\nexport default function NavigationItem( {\n\tclassName,\n\ticon,\n\tshouldShowPlaceholder = true,\n\tchildren,\n\tto,\n}: NavigationItemProps ) {\n\t// Check if the 'to' prop is an external URL\n\tconst isExternal = ! String(\n\t\tnew URL( to, window.location.origin )\n\t).startsWith( window.location.origin );\n\n\tconst content = (\n\t\t<HStack justify=\"flex-start\" spacing={ 2 } style={ { flexGrow: '1' } }>\n\t\t\t{ wrapIcon( icon, shouldShowPlaceholder ) }\n\t\t\t<FlexBlock>{ children }</FlexBlock>\n\t\t</HStack>\n\t);\n\n\tif ( isExternal ) {\n\t\t// Render as a regular anchor tag for external URLs\n\t\treturn (\n\t\t\t<Item\n\t\t\t\tas=\"a\"\n\t\t\t\thref={ to }\n\t\t\t\tclassName={ clsx( styles.item, className ) }\n\t\t\t>\n\t\t\t\t{ content }\n\t\t\t</Item>\n\t\t);\n\t}\n\n\treturn (\n\t\t<RouterLinkItem to={ to } className={ clsx( styles.item, className ) }>\n\t\t\t{ content }\n\t\t</RouterLinkItem>\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(\"74796ab776\", \".d5331ded354c389a__item.d5331ded354c389a__item{align-items:center;border:none;border-radius:var(--wpds-border-radius-sm,2px);color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);display:flex;font-family:-apple-system,system-ui,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;font-size:13px;font-weight:var(--wpds-typography-font-weight-default,400);line-height:20px;margin-block-end:4px;margin-inline:12px;min-height:32px;padding-block:0;padding-inline:4px;width:calc(100% - 24px)}.d5331ded354c389a__item.d5331ded354c389a__item:focus,.d5331ded354c389a__item.d5331ded354c389a__item:hover,.d5331ded354c389a__item.d5331ded354c389a__item[aria-current=true]{color:var(--wpds-color-foreground-interactive-brand-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 52%,#000))}.d5331ded354c389a__item.d5331ded354c389a__item svg:last-child{padding:4px}.d5331ded354c389a__item.d5331ded354c389a__item[aria-current=page],.d5331ded354c389a__item.d5331ded354c389a__item[data-status=active]{color:var(--wpds-color-foreground-interactive-brand-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 52%,#000));font-weight:var(--wpds-typography-font-weight-emphasis,600)}.d5331ded354c389a__item.d5331ded354c389a__item:focus-visible{transform:translateZ(0)}.d5331ded354c389a__item._44ce5374f19a05f7__is-compact{min-height:24px}\");\n}\nexport default {\"item\":\"d5331ded354c389a__item\",\"is-compact\":\"_44ce5374f19a05f7__is-compact\"};\n"],
5
+ "mappings": ";AAAA,OAAO,UAAU;AAEjB;AAAA,EACC;AAAA,EACA,sBAAsB;AAAA,EACtB,wBAAwB;AAAA,OAClB;AACP,OAAO,oBAAoB;AAC3B,SAAS,gBAAgB;;;ACEzB,IAAM,uBAAuB;AAU7B,SAAS,aAAa;AACrB,QAAM,cAAc;AAEpB,MAAK,YAAY,kBAAmB;AACnC,WAAO,YAAY;AAAA,EACpB;AAEA,cAAY,mBAAmB;AAAA,IAC9B,WAAW,oBAAI,IAAI;AAAA,IACnB,QAAQ,oBAAI,IAAI;AAAA,IAChB,gBAAgB,oBAAI,QAAQ;AAAA,EAC7B;AAEA,MAAK,OAAO,aAAa,aAAc;AACtC,qBAAkB,QAAS;AAAA,EAC5B;AAEA,SAAO,YAAY;AACpB;AAUA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