@wordpress/boot 0.20.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 (126) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/README.md +4 -0
  3. package/build-module/components/app/router.mjs +100 -4
  4. package/build-module/components/app/router.mjs.map +3 -3
  5. package/build-module/components/canvas/index.mjs +72 -13
  6. package/build-module/components/canvas/index.mjs.map +2 -2
  7. package/build-module/components/canvas/site-preview.mjs +50 -0
  8. package/build-module/components/canvas/site-preview.mjs.map +7 -0
  9. package/build-module/components/canvas/use-navigate-to-entity-record.mjs +122 -0
  10. package/build-module/components/canvas/use-navigate-to-entity-record.mjs.map +7 -0
  11. package/build-module/components/canvas/viewport.mjs +18 -0
  12. package/build-module/components/canvas/viewport.mjs.map +7 -0
  13. package/build-module/components/error-boundary/index.mjs +129 -0
  14. package/build-module/components/error-boundary/index.mjs.map +7 -0
  15. package/build-module/components/navigation/drilldown-item/index.mjs +91 -1
  16. package/build-module/components/navigation/drilldown-item/index.mjs.map +3 -3
  17. package/build-module/components/navigation/dropdown-item/index.mjs +98 -11
  18. package/build-module/components/navigation/dropdown-item/index.mjs.map +4 -4
  19. package/build-module/components/navigation/index.mjs +0 -1
  20. package/build-module/components/navigation/index.mjs.map +2 -2
  21. package/build-module/components/navigation/navigation-item/index.mjs +88 -15
  22. package/build-module/components/navigation/navigation-item/index.mjs.map +3 -3
  23. package/build-module/components/navigation/navigation-screen/index.mjs +111 -38
  24. package/build-module/components/navigation/navigation-screen/index.mjs.map +3 -3
  25. package/build-module/components/plugin-area/index.mjs +29 -0
  26. package/build-module/components/plugin-area/index.mjs.map +7 -0
  27. package/build-module/components/root/index.mjs +220 -122
  28. package/build-module/components/root/index.mjs.map +3 -3
  29. package/build-module/components/root/single-page.mjs +139 -47
  30. package/build-module/components/root/single-page.mjs.map +3 -3
  31. package/build-module/components/root/use-sync-body-background.mjs.map +1 -1
  32. package/build-module/components/save-button/index.mjs +127 -16
  33. package/build-module/components/save-button/index.mjs.map +3 -3
  34. package/build-module/components/save-panel/index.mjs +91 -1
  35. package/build-module/components/save-panel/index.mjs.map +3 -3
  36. package/build-module/components/sidebar/index.mjs +90 -10
  37. package/build-module/components/sidebar/index.mjs.map +3 -3
  38. package/build-module/index.mjs +0 -16
  39. package/build-module/index.mjs.map +3 -3
  40. package/build-module/store/actions.mjs +8 -0
  41. package/build-module/store/actions.mjs.map +2 -2
  42. package/build-module/store/reducer.mjs +16 -1
  43. package/build-module/store/reducer.mjs.map +2 -2
  44. package/build-module/store/selectors.mjs +9 -0
  45. package/build-module/store/selectors.mjs.map +2 -2
  46. package/build-types/components/app/router.d.ts.map +1 -1
  47. package/build-types/components/canvas/index.d.ts.map +1 -1
  48. package/build-types/components/canvas/site-preview.d.ts +10 -0
  49. package/build-types/components/canvas/site-preview.d.ts.map +1 -0
  50. package/build-types/components/canvas/use-navigate-to-entity-record.d.ts +40 -0
  51. package/build-types/components/canvas/use-navigate-to-entity-record.d.ts.map +1 -0
  52. package/build-types/components/canvas/viewport.d.ts +15 -0
  53. package/build-types/components/canvas/viewport.d.ts.map +1 -0
  54. package/build-types/components/error-boundary/index.d.ts +22 -0
  55. package/build-types/components/error-boundary/index.d.ts.map +1 -0
  56. package/build-types/components/navigation/drilldown-item/index.d.ts.map +1 -1
  57. package/build-types/components/navigation/dropdown-item/index.d.ts +0 -1
  58. package/build-types/components/navigation/dropdown-item/index.d.ts.map +1 -1
  59. package/build-types/components/navigation/index.d.ts.map +1 -1
  60. package/build-types/components/navigation/navigation-item/index.d.ts +0 -1
  61. package/build-types/components/navigation/navigation-item/index.d.ts.map +1 -1
  62. package/build-types/components/navigation/navigation-screen/index.d.ts +0 -1
  63. package/build-types/components/navigation/navigation-screen/index.d.ts.map +1 -1
  64. package/build-types/components/plugin-area/index.d.ts +12 -0
  65. package/build-types/components/plugin-area/index.d.ts.map +1 -0
  66. package/build-types/components/root/index.d.ts +0 -1
  67. package/build-types/components/root/index.d.ts.map +1 -1
  68. package/build-types/components/root/single-page.d.ts +0 -1
  69. package/build-types/components/root/single-page.d.ts.map +1 -1
  70. package/build-types/components/root/use-sync-body-background.d.ts +1 -1
  71. package/build-types/components/save-button/index.d.ts +0 -1
  72. package/build-types/components/save-button/index.d.ts.map +1 -1
  73. package/build-types/components/save-panel/index.d.ts.map +1 -1
  74. package/build-types/components/sidebar/index.d.ts +0 -1
  75. package/build-types/components/sidebar/index.d.ts.map +1 -1
  76. package/build-types/index.d.ts +0 -2
  77. package/build-types/index.d.ts.map +1 -1
  78. package/build-types/store/actions.d.ts +15 -2
  79. package/build-types/store/actions.d.ts.map +1 -1
  80. package/build-types/store/reducer.d.ts.map +1 -1
  81. package/build-types/store/selectors.d.ts +12 -0
  82. package/build-types/store/selectors.d.ts.map +1 -1
  83. package/build-types/store/types.d.ts +34 -3
  84. package/build-types/store/types.d.ts.map +1 -1
  85. package/package.json +28 -25
  86. package/src/components/app/router.tsx +19 -7
  87. package/src/components/canvas/index.tsx +117 -15
  88. package/src/components/canvas/site-preview.tsx +64 -0
  89. package/src/components/canvas/use-navigate-to-entity-record.ts +220 -0
  90. package/src/components/canvas/viewport.ts +34 -0
  91. package/src/components/error-boundary/index.tsx +71 -0
  92. package/src/components/error-boundary/style.module.scss +13 -0
  93. package/src/components/navigation/drilldown-item/index.tsx +2 -1
  94. package/src/components/navigation/dropdown-item/index.tsx +10 -6
  95. package/src/components/navigation/dropdown-item/{style.scss → style.module.scss} +6 -2
  96. package/src/components/navigation/index.tsx +0 -1
  97. package/src/components/navigation/navigation-item/index.tsx +3 -6
  98. package/src/components/navigation/navigation-item/{style.scss → style.module.scss} +7 -14
  99. package/src/components/navigation/navigation-screen/index.tsx +6 -15
  100. package/src/components/navigation/navigation-screen/{style.scss → style.module.scss} +10 -9
  101. package/src/components/plugin-area/index.tsx +34 -0
  102. package/src/components/root/{style.scss → _layout.module.scss} +71 -40
  103. package/src/components/root/_view-transitions.module.scss +205 -0
  104. package/src/components/root/index.tsx +44 -24
  105. package/src/components/root/single-page.tsx +15 -7
  106. package/src/components/root/style.module.scss +2 -0
  107. package/src/components/root/use-sync-body-background.ts +1 -1
  108. package/src/components/save-button/index.tsx +36 -14
  109. package/src/components/save-button/style.module.scss +10 -0
  110. package/src/components/save-panel/index.tsx +2 -1
  111. package/src/components/save-panel/style.module.scss +7 -0
  112. package/src/components/sidebar/index.tsx +5 -5
  113. package/src/components/sidebar/style.module.scss +29 -0
  114. package/src/index.tsx +0 -2
  115. package/src/store/actions.ts +18 -1
  116. package/src/store/reducer.ts +19 -0
  117. package/src/store/selectors.ts +28 -0
  118. package/src/store/types.ts +37 -3
  119. package/build-style/style-rtl.css +0 -133
  120. package/build-style/style.css +0 -133
  121. package/build-style/view-transitions-rtl.css +0 -189
  122. package/build-style/view-transitions.css +0 -189
  123. package/src/components/save-button/style.scss +0 -9
  124. package/src/components/sidebar/style.scss +0 -23
  125. package/src/style.scss +0 -34
  126. package/src/view-transitions.scss +0 -221
@@ -0,0 +1,122 @@
1
+ // packages/boot/src/components/canvas/use-navigate-to-entity-record.ts
2
+ import { useCallback, useMemo } from "@wordpress/element";
3
+ import { useDispatch, useRegistry, useSelect } from "@wordpress/data";
4
+ import { store as coreStore } from "@wordpress/core-data";
5
+ import { store as editorStore } from "@wordpress/editor";
6
+ import { store as noticesStore } from "@wordpress/notices";
7
+ import { decodeEntities } from "@wordpress/html-entities";
8
+ import { __, sprintf } from "@wordpress/i18n";
9
+ import {
10
+ useNavigate,
11
+ useSearch,
12
+ privateApis as routePrivateApis
13
+ } from "@wordpress/route";
14
+ import { store as bootStore } from "../../store/index.mjs";
15
+ import { isValidViewport } from "./viewport.mjs";
16
+ import { unlock } from "../../lock-unlock.mjs";
17
+ var { useCanGoBack, useRouter } = unlock(routePrivateApis);
18
+ function useNavigateToEntityRecord() {
19
+ const navigate = useNavigate();
20
+ const search = useSearch({ strict: false });
21
+ const registry = useRegistry();
22
+ const getEntityLink = useSelect(
23
+ (select) => select(bootStore).getEntityLink,
24
+ []
25
+ );
26
+ const router = useRouter();
27
+ const canGoBack = useCanGoBack();
28
+ const onNavigateToEntityRecord = useCallback(
29
+ (params) => {
30
+ const currentPostType = registry.select(editorStore).getCurrentPostType();
31
+ const currentPostId = registry.select(editorStore).getCurrentPostId();
32
+ const edits = registry.select(coreStore).getEntityRecordEdits(
33
+ "postType",
34
+ currentPostType,
35
+ currentPostId
36
+ );
37
+ const selectedBlock = edits?.selection?.selectionStart?.clientId;
38
+ if (selectedBlock) {
39
+ navigate({
40
+ search: (previous) => ({
41
+ ...previous,
42
+ selectedBlock
43
+ }),
44
+ replace: true
45
+ });
46
+ }
47
+ const requestedViewport = params.viewport?.toLowerCase();
48
+ const hasRequestedViewport = isValidViewport(requestedViewport);
49
+ const to = getEntityLink(params.postType, params.postId);
50
+ if (to) {
51
+ navigate({
52
+ to,
53
+ search: () => ({
54
+ focusMode: true,
55
+ ...hasRequestedViewport ? { viewport: requestedViewport } : {}
56
+ })
57
+ });
58
+ }
59
+ },
60
+ [navigate, registry, getEntityLink]
61
+ );
62
+ const isFocusMode = !!search.focusMode;
63
+ const onNavigateToPreviousEntityRecord = useMemo(
64
+ () => isFocusMode && canGoBack ? () => router.history.back() : void 0,
65
+ [isFocusMode, canGoBack, router]
66
+ );
67
+ return { onNavigateToEntityRecord, onNavigateToPreviousEntityRecord };
68
+ }
69
+ function useActionPerformed(postType) {
70
+ const navigate = useNavigate();
71
+ const { createSuccessNotice } = useDispatch(noticesStore);
72
+ const getEntityLink = useSelect(
73
+ (select) => select(bootStore).getEntityLink,
74
+ []
75
+ );
76
+ return useCallback(
77
+ (actionId, items) => {
78
+ switch (actionId) {
79
+ case "move-to-trash":
80
+ case "delete-post": {
81
+ const to = postType && getEntityLink(postType);
82
+ if (to) {
83
+ navigate({ to, search: () => ({}) });
84
+ }
85
+ break;
86
+ }
87
+ case "duplicate-post": {
88
+ const newItem = items[0];
89
+ const to = getEntityLink(newItem.type, newItem.id);
90
+ if (!to) {
91
+ break;
92
+ }
93
+ const title = typeof newItem.title === "string" ? newItem.title : newItem.title?.rendered;
94
+ createSuccessNotice(
95
+ sprintf(
96
+ // translators: %s: Title of the created post, e.g: "Hello world".
97
+ __('"%s" successfully created.'),
98
+ decodeEntities(title ?? "") || __("(no title)")
99
+ ),
100
+ {
101
+ type: "snackbar",
102
+ id: "duplicate-post-action",
103
+ actions: [
104
+ {
105
+ label: __("Edit"),
106
+ onClick: () => navigate({ to })
107
+ }
108
+ ]
109
+ }
110
+ );
111
+ break;
112
+ }
113
+ }
114
+ },
115
+ [navigate, createSuccessNotice, getEntityLink, postType]
116
+ );
117
+ }
118
+ export {
119
+ useNavigateToEntityRecord as default,
120
+ useActionPerformed
121
+ };
122
+ //# sourceMappingURL=use-navigate-to-entity-record.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/canvas/use-navigate-to-entity-record.ts"],
4
+ "sourcesContent": ["import { useCallback, useMemo } from '@wordpress/element';\nimport { useDispatch, useRegistry, useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tuseNavigate,\n\tuseSearch,\n\tprivateApis as routePrivateApis,\n} from '@wordpress/route';\nimport { store as bootStore } from '../../store';\nimport { isValidViewport } from './viewport';\nimport { unlock } from '../../lock-unlock';\n\nconst { useCanGoBack, useRouter } = unlock( routePrivateApis );\n\n/*\n * The route tree is assembled from routes registered at runtime, so TanStack has\n * no search schema to infer and types `search` against a placeholder. Describe\n * the two calls this module makes instead.\n */\ntype Navigate = ( options: {\n\tto?: string;\n\treplace?: boolean;\n\tsearch?: (\n\t\tprevious: Record< string, unknown >\n\t) => Record< string, unknown >;\n} ) => void;\n\ninterface NavigateParams {\n\tpostType: string;\n\tpostId: string;\n\tviewport?: string;\n}\n\n/**\n * Builds the editor's entity navigation callbacks.\n *\n * The editor uses these to move between an entity and one nested inside it —\n * a template part or a synced pattern reached from the block inspector. They\n * are passed through the editor settings, where `onNavigateToEntityRecord`\n * gates the inspector's edit affordance and `onNavigateToPreviousEntityRecord`\n * gates the document bar's back button.\n *\n * @return The two callbacks, for spreading into the editor settings.\n */\nexport default function useNavigateToEntityRecord() {\n\tconst navigate = useNavigate() as Navigate;\n\tconst search = useSearch( { strict: false } ) as { focusMode?: unknown };\n\tconst registry = useRegistry();\n\tconst getEntityLink = useSelect(\n\t\t( select ) => select( bootStore ).getEntityLink,\n\t\t[]\n\t);\n\tconst router = useRouter();\n\tconst canGoBack = useCanGoBack();\n\n\tconst onNavigateToEntityRecord = useCallback(\n\t\t( params: NavigateParams ) => {\n\t\t\t/*\n\t\t\t * Stash the block selected in the entity being left, so returning to\n\t\t\t * it can restore the user's place. The edits hold the external\n\t\t\t * client ID, which `onChangeSelection` has already resolved.\n\t\t\t */\n\t\t\tconst currentPostType = (\n\t\t\t\tregistry.select( editorStore ) as any\n\t\t\t ).getCurrentPostType();\n\t\t\tconst currentPostId = (\n\t\t\t\tregistry.select( editorStore ) as any\n\t\t\t ).getCurrentPostId();\n\t\t\tconst edits = registry\n\t\t\t\t.select( coreStore )\n\t\t\t\t.getEntityRecordEdits(\n\t\t\t\t\t'postType',\n\t\t\t\t\tcurrentPostType,\n\t\t\t\t\tcurrentPostId\n\t\t\t\t) as { selection?: { selectionStart?: { clientId?: string } } };\n\t\t\tconst selectedBlock = edits?.selection?.selectionStart?.clientId;\n\n\t\t\tif ( selectedBlock ) {\n\t\t\t\tnavigate( {\n\t\t\t\t\tsearch: ( previous: Record< string, unknown > ) => ( {\n\t\t\t\t\t\t...previous,\n\t\t\t\t\t\tselectedBlock,\n\t\t\t\t\t} ),\n\t\t\t\t\treplace: true,\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\t/*\n\t\t\t * An entity can ask to be edited at a particular width — a\n\t\t\t * navigation overlay meant for mobile. The width is where the entity\n\t\t\t * opens, not something the entity being left carries away: a width\n\t\t\t * set from the device preview is view state, and an entity that asks\n\t\t\t * for none opens at the default.\n\t\t\t */\n\t\t\tconst requestedViewport = params.viewport?.toLowerCase();\n\t\t\tconst hasRequestedViewport = isValidViewport( requestedViewport );\n\n\t\t\t/*\n\t\t\t * `focusMode` marks the entity as one navigated into rather than\n\t\t\t * opened directly, which is what offers the way back out. The search\n\t\t\t * is replaced rather than extended so the block stashed above stays\n\t\t\t * with the entity it belongs to.\n\t\t\t */\n\t\t\tconst to = getEntityLink( params.postType, params.postId );\n\n\t\t\tif ( to ) {\n\t\t\t\tnavigate( {\n\t\t\t\t\tto,\n\t\t\t\t\tsearch: () => ( {\n\t\t\t\t\t\tfocusMode: true,\n\t\t\t\t\t\t...( hasRequestedViewport\n\t\t\t\t\t\t\t? { viewport: requestedViewport }\n\t\t\t\t\t\t\t: {} ),\n\t\t\t\t\t} ),\n\t\t\t\t} );\n\t\t\t}\n\t\t},\n\t\t[ navigate, registry, getEntityLink ]\n\t);\n\n\t/*\n\t * Only entities navigated into offer a way back out. The editor reads this\n\t * as the entity being a focused one, giving it the document bar's back\n\t * button and the surrounding padding, so an entity opened directly — from a\n\t * list, say — must not have it. `canGoBack` covers reloading such a URL,\n\t * where the marker survives but the history to return to does not.\n\t */\n\tconst isFocusMode = !! search.focusMode;\n\tconst onNavigateToPreviousEntityRecord = useMemo(\n\t\t() =>\n\t\t\tisFocusMode && canGoBack ? () => router.history.back() : undefined,\n\t\t[ isFocusMode, canGoBack, router ]\n\t);\n\n\treturn { onNavigateToEntityRecord, onNavigateToPreviousEntityRecord };\n}\n\ninterface ActionItem {\n\tid: string | number;\n\ttype: string;\n\ttitle?: string | { rendered?: string };\n}\n\n/**\n * Builds the callback the editor runs after a post action.\n *\n * Actions taken from inside the editor act on the entity being edited, so\n * trashing or deleting one leaves the canvas showing something that is no\n * longer there, and duplicating one gives no way to reach the copy.\n *\n * @param postType Post type rendered in the canvas.\n * @return The callback, for passing to the editor.\n */\nexport function useActionPerformed( postType?: string ) {\n\tconst navigate = useNavigate() as Navigate;\n\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\tconst getEntityLink = useSelect(\n\t\t( select ) => select( bootStore ).getEntityLink,\n\t\t[]\n\t);\n\n\treturn useCallback(\n\t\t( actionId: string, items: ActionItem[] ) => {\n\t\t\tswitch ( actionId ) {\n\t\t\t\tcase 'move-to-trash':\n\t\t\t\tcase 'delete-post': {\n\t\t\t\t\tconst to = postType && getEntityLink( postType );\n\n\t\t\t\t\tif ( to ) {\n\t\t\t\t\t\tnavigate( { to, search: () => ( {} ) } );\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tcase 'duplicate-post': {\n\t\t\t\t\tconst newItem = items[ 0 ];\n\t\t\t\t\tconst to = getEntityLink( newItem.type, newItem.id );\n\n\t\t\t\t\tif ( ! to ) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst title =\n\t\t\t\t\t\ttypeof newItem.title === 'string'\n\t\t\t\t\t\t\t? newItem.title\n\t\t\t\t\t\t\t: newItem.title?.rendered;\n\n\t\t\t\t\t/*\n\t\t\t\t\t * The action has already announced the copy under this id.\n\t\t\t\t\t * Reissuing it under the same id replaces that notice rather\n\t\t\t\t\t * than stacking a second one, and adds the way to reach it.\n\t\t\t\t\t */\n\t\t\t\t\tcreateSuccessNotice(\n\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t// translators: %s: Title of the created post, e.g: \"Hello world\".\n\t\t\t\t\t\t\t__( '\"%s\" successfully created.' ),\n\t\t\t\t\t\t\tdecodeEntities( title ?? '' ) || __( '(no title)' )\n\t\t\t\t\t\t),\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\tid: 'duplicate-post-action',\n\t\t\t\t\t\t\tactions: [\n\t\t\t\t\t\t\t\t{\n\t\t\t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AA,UACD;AAEA,gBAAM,QACL,OAAO,QAAQ,UAAU,WACtB,QAAQ,QACR,QAAQ,OAAO;AAOnB;AAAA,YACC;AAAA;AAAA,cAEC,GAAI,4BAA6B;AAAA,cACjC,eAAgB,SAAS,EAAG,KAAK,GAAI,YAAa;AAAA,YACnD;AAAA,YACA;AAAA,cACC,MAAM;AAAA,cACN,IAAI;AAAA,cACJ,SAAS;AAAA,gBACR;AAAA,kBACC,OAAO,GAAI,MAAO;AAAA,kBAClB,SAAS,MAAM,SAAU,EAAE,GAAG,CAAE;AAAA,gBACjC;AAAA,cACD;AAAA,YACD;AAAA,UACD;AACA;AAAA,QACD;AAAA,MACD;AAAA,IACD;AAAA,IACA,CAAE,UAAU,qBAAqB,eAAe,QAAS;AAAA,EAC1D;AACD;",
6
+ "names": []
7
+ }
@@ -0,0 +1,18 @@
1
+ // packages/boot/src/components/canvas/viewport.ts
2
+ var DEFAULT_DEVICE_TYPE = "Desktop";
3
+ var VALID_VIEWPORTS = ["desktop", "tablet", "mobile"];
4
+ function isValidViewport(viewport) {
5
+ return !!viewport && VALID_VIEWPORTS.includes(viewport.toLowerCase());
6
+ }
7
+ function getDeviceType(viewport) {
8
+ if (!isValidViewport(viewport)) {
9
+ return DEFAULT_DEVICE_TYPE;
10
+ }
11
+ const value = viewport.toLowerCase();
12
+ return value.charAt(0).toUpperCase() + value.slice(1);
13
+ }
14
+ export {
15
+ getDeviceType,
16
+ isValidViewport
17
+ };
18
+ //# sourceMappingURL=viewport.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/canvas/viewport.ts"],
4
+ "sourcesContent": ["const DEFAULT_DEVICE_TYPE = 'Desktop';\n\n/*\n * Lowercase in the URL, PascalCase in the editor store. Duplicated in\n * packages/edit-site/src/components/block-editor/viewport.js, in the editor's\n * preview-dropdown choices, and in the block editor's block-visibility\n * constants. Update all four when adding a viewport type.\n */\nconst VALID_VIEWPORTS = [ 'desktop', 'tablet', 'mobile' ];\n\n/**\n * Whether a viewport is one an entity can be asked to be edited at.\n *\n * @param viewport Viewport, as written in the URL.\n * @return Whether the editor has a width for it.\n */\nexport function isValidViewport( viewport?: string ): viewport is string {\n\treturn !! viewport && VALID_VIEWPORTS.includes( viewport.toLowerCase() );\n}\n\n/**\n * The device type a `viewport` search param names.\n *\n * @param viewport Viewport, as written in the URL.\n * @return Device type, Desktop for a viewport the editor has no width for.\n */\nexport function getDeviceType( viewport?: string ) {\n\tif ( ! isValidViewport( viewport ) ) {\n\t\treturn DEFAULT_DEVICE_TYPE;\n\t}\n\n\tconst value = viewport.toLowerCase();\n\treturn value.charAt( 0 ).toUpperCase() + value.slice( 1 );\n}\n"],
5
+ "mappings": ";AAAA,IAAM,sBAAsB;AAQ5B,IAAM,kBAAkB,CAAE,WAAW,UAAU,QAAS;AAQjD,SAAS,gBAAiB,UAAwC;AACxE,SAAO,CAAC,CAAE,YAAY,gBAAgB,SAAU,SAAS,YAAY,CAAE;AACxE;AAQO,SAAS,cAAe,UAAoB;AAClD,MAAK,CAAE,gBAAiB,QAAS,GAAI;AACpC,WAAO;AAAA,EACR;AAEA,QAAM,QAAQ,SAAS,YAAY;AACnC,SAAO,MAAM,OAAQ,CAAE,EAAE,YAAY,IAAI,MAAM,MAAO,CAAE;AACzD;",
6
+ "names": []
7
+ }
@@ -0,0 +1,129 @@
1
+ // packages/boot/src/components/error-boundary/index.tsx
2
+ import { Component } from "@wordpress/element";
3
+ import { __ } from "@wordpress/i18n";
4
+ import { Button } from "@wordpress/components";
5
+ import { EmptyState } from "@wordpress/ui";
6
+ import { useCopyToClipboard } from "@wordpress/compose";
7
+ import { caution } from "@wordpress/icons";
8
+
9
+ // packages/style-runtime/src/index.ts
10
+ var STYLE_HASH_ATTRIBUTE = "data-wp-hash";
11
+ function getRuntime() {
12
+ const globalScope = globalThis;
13
+ if (globalScope.__wpStyleRuntime) {
14
+ return globalScope.__wpStyleRuntime;
15
+ }
16
+ globalScope.__wpStyleRuntime = {
17
+ documents: /* @__PURE__ */ new Map(),
18
+ styles: /* @__PURE__ */ new Map(),
19
+ injectedStyles: /* @__PURE__ */ new WeakMap()
20
+ };
21
+ if (typeof document !== "undefined") {
22
+ registerDocument(document);
23
+ }
24
+ return globalScope.__wpStyleRuntime;
25
+ }
26
+ function documentContainsStyleHash(targetDocument, hash) {
27
+ if (!targetDocument.head) {
28
+ return false;
29
+ }
30
+ for (const style of targetDocument.head.querySelectorAll(
31
+ `style[${STYLE_HASH_ATTRIBUTE}]`
32
+ )) {
33
+ if (style.getAttribute(STYLE_HASH_ATTRIBUTE) === hash) {
34
+ return true;
35
+ }
36
+ }
37
+ return false;
38
+ }
39
+ function injectStyle(targetDocument, hash, css) {
40
+ if (!targetDocument.head) {
41
+ return;
42
+ }
43
+ const runtime = getRuntime();
44
+ let injectedStyles = runtime.injectedStyles.get(targetDocument);
45
+ if (!injectedStyles) {
46
+ injectedStyles = /* @__PURE__ */ new Set();
47
+ runtime.injectedStyles.set(targetDocument, injectedStyles);
48
+ }
49
+ if (injectedStyles.has(hash)) {
50
+ return;
51
+ }
52
+ if (documentContainsStyleHash(targetDocument, hash)) {
53
+ injectedStyles.add(hash);
54
+ return;
55
+ }
56
+ const style = targetDocument.createElement("style");
57
+ style.setAttribute(STYLE_HASH_ATTRIBUTE, hash);
58
+ style.appendChild(targetDocument.createTextNode(css));
59
+ targetDocument.head.appendChild(style);
60
+ injectedStyles.add(hash);
61
+ }
62
+ function registerDocument(targetDocument) {
63
+ const runtime = getRuntime();
64
+ runtime.documents.set(
65
+ targetDocument,
66
+ (runtime.documents.get(targetDocument) ?? 0) + 1
67
+ );
68
+ for (const [hash, css] of runtime.styles) {
69
+ injectStyle(targetDocument, hash, css);
70
+ }
71
+ return () => {
72
+ const count = runtime.documents.get(targetDocument);
73
+ if (count === void 0) {
74
+ return;
75
+ }
76
+ if (count <= 1) {
77
+ runtime.documents.delete(targetDocument);
78
+ return;
79
+ }
80
+ runtime.documents.set(targetDocument, count - 1);
81
+ };
82
+ }
83
+ function registerStyle(hash, css) {
84
+ const runtime = getRuntime();
85
+ runtime.styles.set(hash, css);
86
+ for (const targetDocument of runtime.documents.keys()) {
87
+ injectStyle(targetDocument, hash, css);
88
+ }
89
+ }
90
+
91
+ // packages/boot/src/components/error-boundary/style.module.scss
92
+ if (typeof process === "undefined" || process.env.NODE_ENV !== "test") {
93
+ registerStyle("4780fe0b1b", "._4d71ad18128c9cb8__error-boundary{align-items:center;box-sizing:border-box;display:flex;justify-content:center;min-height:100%;padding:16px}");
94
+ }
95
+ var style_module_default = { "error-boundary": "_4d71ad18128c9cb8__error-boundary" };
96
+
97
+ // packages/boot/src/components/error-boundary/index.tsx
98
+ import { jsx, jsxs } from "react/jsx-runtime";
99
+ function CopyErrorButton({ error }) {
100
+ const ref = useCopyToClipboard(() => error.stack ?? String(error));
101
+ return /* @__PURE__ */ jsx(Button, { __next40pxDefaultSize: true, variant: "secondary", ref, children: __("Copy error") });
102
+ }
103
+ var ErrorBoundary = class extends Component {
104
+ constructor(props) {
105
+ super(props);
106
+ this.state = { error: null };
107
+ }
108
+ static getDerivedStateFromError(error) {
109
+ return { error };
110
+ }
111
+ render() {
112
+ const { error } = this.state;
113
+ if (!error) {
114
+ return this.props.children;
115
+ }
116
+ return /* @__PURE__ */ jsx("div", { className: style_module_default["error-boundary"], children: /* @__PURE__ */ jsxs(EmptyState.Root, { children: [
117
+ /* @__PURE__ */ jsx(EmptyState.Icon, { icon: caution }),
118
+ /* @__PURE__ */ jsx(EmptyState.Title, { children: __("Something went wrong") }),
119
+ /* @__PURE__ */ jsx(EmptyState.Description, { children: __(
120
+ "This part of the screen could not be displayed. Reloading the page may help."
121
+ ) }),
122
+ /* @__PURE__ */ jsx(EmptyState.Actions, { children: /* @__PURE__ */ jsx(CopyErrorButton, { error }) })
123
+ ] }) });
124
+ }
125
+ };
126
+ export {
127
+ ErrorBoundary as default
128
+ };
129
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/error-boundary/index.tsx", "../../../../style-runtime/src/index.ts", "../../../src/components/error-boundary/style.module.scss"],
4
+ "sourcesContent": ["import type { ReactNode } from 'react';\nimport { Component } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { Button } from '@wordpress/components';\nimport { EmptyState } from '@wordpress/ui';\nimport { useCopyToClipboard } from '@wordpress/compose';\nimport { caution } from '@wordpress/icons';\nimport styles from './style.module.scss';\n\ninterface Props {\n\tchildren: ReactNode;\n}\n\ninterface State {\n\terror: Error | null;\n}\n\nfunction CopyErrorButton( { error }: { error: Error } ) {\n\tconst ref = useCopyToClipboard( () => error.stack ?? String( error ) );\n\n\treturn (\n\t\t<Button __next40pxDefaultSize variant=\"secondary\" ref={ ref }>\n\t\t\t{ __( 'Copy error' ) }\n\t\t</Button>\n\t);\n}\n\n/**\n * Contains a failure to one surface, so a screen keeps working around it.\n *\n * Wrapping each surface separately means a stage that throws leaves the\n * navigation, the canvas and the way to save reachable, rather than taking the\n * whole screen down with it.\n */\nexport default class ErrorBoundary extends Component< Props, State > {\n\tconstructor( props: Props ) {\n\t\tsuper( props );\n\t\tthis.state = { error: null };\n\t}\n\n\tstatic getDerivedStateFromError( error: Error ): State {\n\t\treturn { error };\n\t}\n\n\trender() {\n\t\tconst { error } = this.state;\n\n\t\tif ( ! error ) {\n\t\t\treturn this.props.children;\n\t\t}\n\n\t\treturn (\n\t\t\t<div className={ styles[ 'error-boundary' ] }>\n\t\t\t\t<EmptyState.Root>\n\t\t\t\t\t<EmptyState.Icon icon={ caution } />\n\t\t\t\t\t<EmptyState.Title>\n\t\t\t\t\t\t{ __( 'Something went wrong' ) }\n\t\t\t\t\t</EmptyState.Title>\n\t\t\t\t\t<EmptyState.Description>\n\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t'This part of the screen could not be displayed. Reloading the page may help.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t</EmptyState.Description>\n\t\t\t\t\t<EmptyState.Actions>\n\t\t\t\t\t\t<CopyErrorButton error={ error } />\n\t\t\t\t\t</EmptyState.Actions>\n\t\t\t\t</EmptyState.Root>\n\t\t\t</div>\n\t\t);\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(\"4780fe0b1b\", \"._4d71ad18128c9cb8__error-boundary{align-items:center;box-sizing:border-box;display:flex;justify-content:center;min-height:100%;padding:16px}\");\n}\nexport default {\"error-boundary\":\"_4d71ad18128c9cb8__error-boundary\"};\n"],
5
+ "mappings": ";AACA,SAAS,iBAAiB;AAC1B,SAAS,UAAU;AACnB,SAAS,cAAc;AACvB,SAAS,kBAAkB;AAC3B,SAAS,0BAA0B;AACnC,SAAS,eAAe;;;ACIxB,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,SAAS,0BACR,gBACA,MACU;AACV,MAAK,CAAE,eAAe,MAAO;AAC5B,WAAO;AAAA,EACR;AAEA,aAAY,SAAS,eAAe,KAAK;AAAA,IACxC,SAAU,oBAAqB;AAAA,EAChC,GAAI;AACH,QAAK,MAAM,aAAc,oBAAqB,MAAM,MAAO;AAC1D,aAA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UAAU,KAAK,GAAI;AACxD,gBAAa,gBAAgB,MAAM,GAAI;AAAA,EACxC;AACD;;;ACpKA,IAAI,OAAO,YAAY,eAAe,QAAQ,IAAI,aAAa,QAAQ;AACtE,gBAAc,cAAc,+IAA+I;AAC5K;AACA,IAAO,uBAAQ,EAAC,kBAAiB,oCAAmC;;;AFiBlE,cAgCE,YAhCF;AAJF,SAAS,gBAAiB,EAAE,MAAM,GAAsB;AACvD,QAAM,MAAM,mBAAoB,MAAM,MAAM,SAAS,OAAQ,KAAM,CAAE;AAErE,SACC,oBAAC,UAAO,uBAAqB,MAAC,SAAQ,aAAY,KAC/C,aAAI,YAAa,GACpB;AAEF;AASA,IAAqB,gBAArB,cAA2C,UAA0B;AAAA,EACpE,YAAa,OAAe;AAC3B,UAAO,KAAM;AACb,SAAK,QAAQ,EAAE,OAAO,KAAK;AAAA,EAC5B;AAAA,EAEA,OAAO,yBAA0B,OAAsB;AACtD,WAAO,EAAE,MAAM;AAAA,EAChB;AAAA,EAEA,SAAS;AACR,UAAM,EAAE,MAAM,IAAI,KAAK;AAEvB,QAAK,CAAE,OAAQ;AACd,aAAO,KAAK,MAAM;AAAA,IACnB;AAEA,WACC,oBAAC,SAAI,WAAY,qBAAQ,gBAAiB,GACzC,+BAAC,WAAW,MAAX,EACA;AAAA,0BAAC,WAAW,MAAX,EAAgB,MAAO,SAAU;AAAA,MAClC,oBAAC,WAAW,OAAX,EACE,aAAI,sBAAuB,GAC9B;AAAA,MACA,oBAAC,WAAW,aAAX,EACE;AAAA,QACD;AAAA,MACD,GACD;AAAA,MACA,oBAAC,WAAW,SAAX,EACA,8BAAC,mBAAgB,OAAgB,GAClC;AAAA,OACD,GACD;AAAA,EAEF;AACD;",
6
+ "names": []
7
+ }
@@ -9,6 +9,96 @@ import {
9
9
  import { isRTL } from "@wordpress/i18n";
10
10
  import { chevronRightSmall, chevronLeftSmall } from "@wordpress/icons";
11
11
  import { wrapIcon } from "../items.mjs";
12
+
13
+ // packages/style-runtime/src/index.ts
14
+ var STYLE_HASH_ATTRIBUTE = "data-wp-hash";
15
+ function getRuntime() {
16
+ const globalScope = globalThis;
17
+ if (globalScope.__wpStyleRuntime) {
18
+ return globalScope.__wpStyleRuntime;
19
+ }
20
+ globalScope.__wpStyleRuntime = {
21
+ documents: /* @__PURE__ */ new Map(),
22
+ styles: /* @__PURE__ */ new Map(),
23
+ injectedStyles: /* @__PURE__ */ new WeakMap()
24
+ };
25
+ if (typeof document !== "undefined") {
26
+ registerDocument(document);
27
+ }
28
+ return globalScope.__wpStyleRuntime;
29
+ }
30
+ function documentContainsStyleHash(targetDocument, hash) {
31
+ if (!targetDocument.head) {
32
+ return false;
33
+ }
34
+ for (const style of targetDocument.head.querySelectorAll(
35
+ `style[${STYLE_HASH_ATTRIBUTE}]`
36
+ )) {
37
+ if (style.getAttribute(STYLE_HASH_ATTRIBUTE) === hash) {
38
+ return true;
39
+ }
40
+ }
41
+ return false;
42
+ }
43
+ function injectStyle(targetDocument, hash, css) {
44
+ if (!targetDocument.head) {
45
+ return;
46
+ }
47
+ const runtime = getRuntime();
48
+ let injectedStyles = runtime.injectedStyles.get(targetDocument);
49
+ if (!injectedStyles) {
50
+ injectedStyles = /* @__PURE__ */ new Set();
51
+ runtime.injectedStyles.set(targetDocument, injectedStyles);
52
+ }
53
+ if (injectedStyles.has(hash)) {
54
+ return;
55
+ }
56
+ if (documentContainsStyleHash(targetDocument, hash)) {
57
+ injectedStyles.add(hash);
58
+ return;
59
+ }
60
+ const style = targetDocument.createElement("style");
61
+ style.setAttribute(STYLE_HASH_ATTRIBUTE, hash);
62
+ style.appendChild(targetDocument.createTextNode(css));
63
+ targetDocument.head.appendChild(style);
64
+ injectedStyles.add(hash);
65
+ }
66
+ function registerDocument(targetDocument) {
67
+ const runtime = getRuntime();
68
+ runtime.documents.set(
69
+ targetDocument,
70
+ (runtime.documents.get(targetDocument) ?? 0) + 1
71
+ );
72
+ for (const [hash, css] of runtime.styles) {
73
+ injectStyle(targetDocument, hash, css);
74
+ }
75
+ return () => {
76
+ const count = runtime.documents.get(targetDocument);
77
+ if (count === void 0) {
78
+ return;
79
+ }
80
+ if (count <= 1) {
81
+ runtime.documents.delete(targetDocument);
82
+ return;
83
+ }
84
+ runtime.documents.set(targetDocument, count - 1);
85
+ };
86
+ }
87
+ function registerStyle(hash, css) {
88
+ const runtime = getRuntime();
89
+ runtime.styles.set(hash, css);
90
+ for (const targetDocument of runtime.documents.keys()) {
91
+ injectStyle(targetDocument, hash, css);
92
+ }
93
+ }
94
+
95
+ // packages/boot/src/components/navigation/navigation-item/style.module.scss
96
+ if (typeof process === "undefined" || process.env.NODE_ENV !== "test") {
97
+ 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}");
98
+ }
99
+ var style_module_default = { "item": "d5331ded354c389a__item", "is-compact": "_44ce5374f19a05f7__is-compact" };
100
+
101
+ // packages/boot/src/components/navigation/drilldown-item/index.tsx
12
102
  import { jsx, jsxs } from "react/jsx-runtime";
13
103
  function DrilldownItem({
14
104
  className,
@@ -25,7 +115,7 @@ function DrilldownItem({
25
115
  return /* @__PURE__ */ jsx(
26
116
  Item,
27
117
  {
28
- className: clsx("boot-navigation-item", className),
118
+ className: clsx(style_module_default.item, className),
29
119
  onClick: handleClick,
30
120
  children: /* @__PURE__ */ jsxs(
31
121
  HStack,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../../../src/components/navigation/drilldown-item/index.tsx"],
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} from '@wordpress/components';\nimport { isRTL } from '@wordpress/i18n';\nimport { chevronRightSmall, chevronLeftSmall } from '@wordpress/icons';\nimport { wrapIcon } from '../items';\nimport type { IconType } from '../../../store/types';\n\ninterface DrilldownItemProps {\n\t/**\n\t * Optional CSS class name.\n\t */\n\tclassName?: string;\n\t/**\n\t * Identifier of the navigation item.\n\t */\n\tid: 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 * Function to handle sidebar navigation when the item is clicked.\n\t */\n\tonNavigate: ( {\n\t\tid,\n\t\tdirection,\n\t}: {\n\t\tid?: string;\n\t\tdirection: 'forward' | 'backward';\n\t} ) => void;\n}\n\nexport default function DrilldownItem( {\n\tclassName,\n\tid,\n\ticon,\n\tshouldShowPlaceholder = true,\n\tchildren,\n\tonNavigate,\n}: DrilldownItemProps ) {\n\tconst handleClick = ( e: React.MouseEvent ) => {\n\t\te.preventDefault();\n\t\tonNavigate( { id, direction: 'forward' } );\n\t};\n\n\treturn (\n\t\t<Item\n\t\t\tclassName={ clsx( 'boot-navigation-item', className ) }\n\t\t\tonClick={ handleClick }\n\t\t>\n\t\t\t<HStack\n\t\t\t\tjustify=\"flex-start\"\n\t\t\t\tspacing={ 2 }\n\t\t\t\tstyle={ { flexGrow: '1' } }\n\t\t\t>\n\t\t\t\t{ wrapIcon( icon, shouldShowPlaceholder ) }\n\t\t\t\t<FlexBlock>{ children }</FlexBlock>\n\t\t\t\t<WCIcon\n\t\t\t\t\ticon={ isRTL() ? chevronLeftSmall : chevronRightSmall }\n\t\t\t\t/>\n\t\t\t</HStack>\n\t\t</Item>\n\t);\n}\n"],
5
- "mappings": ";AAAA,OAAO,UAAU;AAEjB;AAAA,EACC;AAAA,EACA,sBAAsB;AAAA,EACtB,wBAAwB;AAAA,EACxB,QAAQ;AAAA,OACF;AACP,SAAS,aAAa;AACtB,SAAS,mBAAmB,wBAAwB;AACpD,SAAS,gBAAgB;AAsDtB,SAMC,KAND;AAlBY,SAAR,cAAgC;AAAA,EACtC;AAAA,EACA;AAAA,EACA;AAAA,EACA,wBAAwB;AAAA,EACxB;AAAA,EACA;AACD,GAAwB;AACvB,QAAM,cAAc,CAAE,MAAyB;AAC9C,MAAE,eAAe;AACjB,eAAY,EAAE,IAAI,WAAW,UAAU,CAAE;AAAA,EAC1C;AAEA,SACC;AAAA,IAAC;AAAA;AAAA,MACA,WAAY,KAAM,wBAAwB,SAAU;AAAA,MACpD,SAAU;AAAA,MAEV;AAAA,QAAC;AAAA;AAAA,UACA,SAAQ;AAAA,UACR,SAAU;AAAA,UACV,OAAQ,EAAE,UAAU,IAAI;AAAA,UAEtB;AAAA,qBAAU,MAAM,qBAAsB;AAAA,YACxC,oBAAC,aAAY,UAAU;AAAA,YACvB;AAAA,cAAC;AAAA;AAAA,gBACA,MAAO,MAAM,IAAI,mBAAmB;AAAA;AAAA,YACrC;AAAA;AAAA;AAAA,MACD;AAAA;AAAA,EACD;AAEF;",
3
+ "sources": ["../../../../src/components/navigation/drilldown-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\tIcon as WCIcon,\n} from '@wordpress/components';\nimport { isRTL } from '@wordpress/i18n';\nimport { chevronRightSmall, chevronLeftSmall } from '@wordpress/icons';\nimport { wrapIcon } from '../items';\nimport type { IconType } from '../../../store/types';\nimport styles from '../navigation-item/style.module.scss';\n\ninterface DrilldownItemProps {\n\t/**\n\t * Optional CSS class name.\n\t */\n\tclassName?: string;\n\t/**\n\t * Identifier of the navigation item.\n\t */\n\tid: 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 * Function to handle sidebar navigation when the item is clicked.\n\t */\n\tonNavigate: ( {\n\t\tid,\n\t\tdirection,\n\t}: {\n\t\tid?: string;\n\t\tdirection: 'forward' | 'backward';\n\t} ) => void;\n}\n\nexport default function DrilldownItem( {\n\tclassName,\n\tid,\n\ticon,\n\tshouldShowPlaceholder = true,\n\tchildren,\n\tonNavigate,\n}: DrilldownItemProps ) {\n\tconst handleClick = ( e: React.MouseEvent ) => {\n\t\te.preventDefault();\n\t\tonNavigate( { id, direction: 'forward' } );\n\t};\n\n\treturn (\n\t\t<Item\n\t\t\tclassName={ clsx( styles.item, className ) }\n\t\t\tonClick={ handleClick }\n\t\t>\n\t\t\t<HStack\n\t\t\t\tjustify=\"flex-start\"\n\t\t\t\tspacing={ 2 }\n\t\t\t\tstyle={ { flexGrow: '1' } }\n\t\t\t>\n\t\t\t\t{ wrapIcon( icon, shouldShowPlaceholder ) }\n\t\t\t\t<FlexBlock>{ children }</FlexBlock>\n\t\t\t\t<WCIcon\n\t\t\t\t\ticon={ isRTL() ? chevronLeftSmall : chevronRightSmall }\n\t\t\t\t/>\n\t\t\t</HStack>\n\t\t</Item>\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,EACxB,QAAQ;AAAA,OACF;AACP,SAAS,aAAa;AACtB,SAAS,mBAAmB,wBAAwB;AACpD,SAAS,gBAAgB;;;ACAzB,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,SAAS,0BACR,gBACA,MACU;AACV,MAAK,CAAE,eAAe,MAAO;AAC5B,WAAO;AAAA,EACR;AAEA,aAAY,SAAS,eAAe,KAAK;AAAA,IACxC,SAAU,oBAAqB;AAAA,EAChC,GAAI;AACH,QAAK,MAAM,aAAc,oBAAqB,MAAM,MAAO;AAC1D,aAAO;AAAA,IACR;AAAA,EACD;AAEA,SAAO;AACR;AAUA,SAAS,YAAa,gBAA0B,MAAc,KAAc;AAC3E,MAAK,CAAE,eAAe,MAAO;AAC5B;AAAA,EACD;AAEA,QAAM,UAAU,WAAW;AAC3B,MAAI,iBAAiB,QAAQ,eAAe,IAAK,cAAe;AAEhE,MAAK,CAAE,gBAAiB;AACvB,qBAAiB,oBAAI,IAAI;AACzB,YAAQ,eAAe,IAAK,gBAAgB,cAAe;AAAA,EAC5D;AAEA,MAAK,eAAe,IAAK,IAAK,GAAI;AACjC;AAAA,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QAAM,cAAc,CAAE,MAAyB;AAC9C,MAAE,eAAe;AACjB,eAAY,EAAE,IAAI,WAAW,UAAU,CAAE;AAAA,EAC1C;AAEA,SACC;AAAA,IAAC;AAAA;AAAA,MACA,WAAY,KAAM,qBAAO,MAAM,SAAU;AAAA,MACzC,SAAU;AAAA,MAEV;AAAA,QAAC;AAAA;AAAA,UACA,SAAQ;AAAA,UACR,SAAU;AAAA,UACV,OAAQ,EAAE,UAAU,IAAI;AAAA,UAEtB;AAAA,qBAAU,MAAM,qBAAsB;AAAA,YACxC,oBAAC,aAAY,UAAU;AAAA,YACvB;AAAA,cAAC;AAAA;AAAA,gBACA,MAAO,MAAM,IAAI,mBAAmB;AAAA;AAAA,YACrC;AAAA;AAAA;AAAA,MACD;AAAA;AAAA,EACD;AAEF;",
6
6
  "names": []
7
7
  }
@@ -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";
@@ -43,11 +129,11 @@ function DropdownItem({
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