@wordpress/widget-dashboard 0.2.0 → 0.3.1-next.v.202607070741.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 (269) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/README.md +10 -16
  3. package/build/components/actions/actions.cjs +2 -19
  4. package/build/components/actions/actions.cjs.map +3 -3
  5. package/build/components/commands/commands.cjs +1 -60
  6. package/build/components/commands/commands.cjs.map +2 -2
  7. package/build/{utils/grid-model-change → components/widget-attribute-controls}/index.cjs +7 -9
  8. package/build/components/widget-attribute-controls/index.cjs.map +7 -0
  9. package/build/components/widget-attribute-controls/widget-attribute-controls.cjs +93 -0
  10. package/build/components/widget-attribute-controls/widget-attribute-controls.cjs.map +7 -0
  11. package/build/components/widget-chrome/widget-chrome.cjs +16 -63
  12. package/build/components/widget-chrome/widget-chrome.cjs.map +2 -2
  13. package/build/components/{layout-settings → widget-frame}/index.cjs +9 -7
  14. package/build/components/widget-frame/index.cjs.map +7 -0
  15. package/build/components/widget-frame/widget-frame.cjs +193 -0
  16. package/build/components/widget-frame/widget-frame.cjs.map +7 -0
  17. package/build/{utils/migrate-layout → components/widget-header}/index.cjs +7 -7
  18. package/build/components/widget-header/index.cjs.map +7 -0
  19. package/build/components/widget-header/widget-header-infotip.cjs +166 -0
  20. package/build/components/widget-header/widget-header-infotip.cjs.map +7 -0
  21. package/build/components/widget-header/widget-header.cjs +173 -0
  22. package/build/components/widget-header/widget-header.cjs.map +7 -0
  23. package/build/components/{widget-settings/utils/get-admin-menu-inset.cjs → widget-layout-controls/index.cjs} +8 -18
  24. package/build/components/widget-layout-controls/index.cjs.map +7 -0
  25. package/build/components/{widgets/widget-layout-toolbar.cjs → widget-layout-controls/widget-layout-controls.cjs} +9 -100
  26. package/build/components/widget-layout-controls/widget-layout-controls.cjs.map +7 -0
  27. package/build/components/widget-picker/widget-picker.cjs +5 -93
  28. package/build/components/widget-picker/widget-picker.cjs.map +3 -3
  29. package/build/components/widget-preview-chrome/index.cjs +31 -0
  30. package/build/components/widget-preview-chrome/index.cjs.map +7 -0
  31. package/build/components/{widget-settings/widget-settings-toolbar.cjs → widget-preview-chrome/widget-preview-chrome.cjs} +41 -23
  32. package/build/components/widget-preview-chrome/widget-preview-chrome.cjs.map +7 -0
  33. package/build/components/widget-settings/index.cjs +3 -3
  34. package/build/components/widget-settings/index.cjs.map +1 -1
  35. package/build/components/widget-settings/utils/index.cjs +0 -3
  36. package/build/components/widget-settings/utils/index.cjs.map +2 -2
  37. package/build/components/widget-settings/widget-settings-trigger.cjs +22 -28
  38. package/build/components/widget-settings/widget-settings-trigger.cjs.map +2 -2
  39. package/build/components/widget-settings/widget-settings.cjs +40 -57
  40. package/build/components/widget-settings/widget-settings.cjs.map +2 -2
  41. package/build/components/widget-toolbar/widget-toolbar.cjs +7 -4
  42. package/build/components/widget-toolbar/widget-toolbar.cjs.map +2 -2
  43. package/build/components/widgets/widgets.cjs +14 -7
  44. package/build/components/widgets/widgets.cjs.map +2 -2
  45. package/build/context/dashboard-context.cjs +31 -80
  46. package/build/context/dashboard-context.cjs.map +2 -2
  47. package/build/context/ui-context.cjs +2 -18
  48. package/build/context/ui-context.cjs.map +2 -2
  49. package/build/types.cjs.map +1 -1
  50. package/build/utils/index.cjs +2 -5
  51. package/build/utils/index.cjs.map +2 -2
  52. package/build/widget-dashboard.cjs +0 -4
  53. package/build/widget-dashboard.cjs.map +2 -2
  54. package/build-module/components/actions/actions.mjs +3 -20
  55. package/build-module/components/actions/actions.mjs.map +2 -2
  56. package/build-module/components/commands/commands.mjs +2 -67
  57. package/build-module/components/commands/commands.mjs.map +2 -2
  58. package/build-module/components/widget-attribute-controls/index.mjs +6 -0
  59. package/build-module/components/widget-attribute-controls/index.mjs.map +7 -0
  60. package/build-module/components/widget-attribute-controls/widget-attribute-controls.mjs +68 -0
  61. package/build-module/components/widget-attribute-controls/widget-attribute-controls.mjs.map +7 -0
  62. package/build-module/components/widget-chrome/widget-chrome.mjs +17 -70
  63. package/build-module/components/widget-chrome/widget-chrome.mjs.map +2 -2
  64. package/build-module/components/widget-frame/index.mjs +7 -0
  65. package/build-module/components/widget-frame/index.mjs.map +7 -0
  66. package/build-module/components/widget-frame/widget-frame.mjs +157 -0
  67. package/build-module/components/widget-frame/widget-frame.mjs.map +7 -0
  68. package/build-module/components/widget-header/index.mjs +6 -0
  69. package/build-module/components/widget-header/index.mjs.map +7 -0
  70. package/build-module/components/widget-header/widget-header-infotip.mjs +141 -0
  71. package/build-module/components/widget-header/widget-header-infotip.mjs.map +7 -0
  72. package/build-module/components/widget-header/widget-header.mjs +138 -0
  73. package/build-module/components/widget-header/widget-header.mjs.map +7 -0
  74. package/build-module/components/widget-layout-controls/index.mjs +6 -0
  75. package/build-module/components/widget-layout-controls/index.mjs.map +7 -0
  76. package/build-module/components/widget-layout-controls/widget-layout-controls.mjs +90 -0
  77. package/build-module/components/widget-layout-controls/widget-layout-controls.mjs.map +7 -0
  78. package/build-module/components/widget-picker/widget-picker.mjs +6 -94
  79. package/build-module/components/widget-picker/widget-picker.mjs.map +3 -3
  80. package/build-module/components/widget-preview-chrome/index.mjs +6 -0
  81. package/build-module/components/widget-preview-chrome/index.mjs.map +7 -0
  82. package/build-module/components/{widget-settings/widget-settings-toolbar.mjs → widget-preview-chrome/widget-preview-chrome.mjs} +37 -19
  83. package/build-module/components/widget-preview-chrome/widget-preview-chrome.mjs.map +7 -0
  84. package/build-module/components/widget-settings/index.mjs +2 -2
  85. package/build-module/components/widget-settings/index.mjs.map +1 -1
  86. package/build-module/components/widget-settings/utils/index.mjs +0 -2
  87. package/build-module/components/widget-settings/utils/index.mjs.map +2 -2
  88. package/build-module/components/widget-settings/widget-settings-trigger.mjs +23 -29
  89. package/build-module/components/widget-settings/widget-settings-trigger.mjs.map +2 -2
  90. package/build-module/components/widget-settings/widget-settings.mjs +40 -57
  91. package/build-module/components/widget-settings/widget-settings.mjs.map +2 -2
  92. package/build-module/components/widget-toolbar/widget-toolbar.mjs +7 -4
  93. package/build-module/components/widget-toolbar/widget-toolbar.mjs.map +2 -2
  94. package/build-module/components/widgets/widgets.mjs +14 -7
  95. package/build-module/components/widgets/widgets.mjs.map +2 -2
  96. package/build-module/context/dashboard-context.mjs +31 -80
  97. package/build-module/context/dashboard-context.mjs.map +2 -2
  98. package/build-module/context/ui-context.mjs +2 -18
  99. package/build-module/context/ui-context.mjs.map +2 -2
  100. package/build-module/types.mjs.map +1 -1
  101. package/build-module/utils/index.mjs +1 -3
  102. package/build-module/utils/index.mjs.map +2 -2
  103. package/build-module/widget-dashboard.mjs +0 -4
  104. package/build-module/widget-dashboard.mjs.map +2 -2
  105. package/build-types/components/actions/actions.d.ts.map +1 -1
  106. package/build-types/components/commands/commands.d.ts.map +1 -1
  107. package/build-types/components/widget-attribute-controls/index.d.ts +2 -0
  108. package/build-types/components/widget-attribute-controls/index.d.ts.map +1 -0
  109. package/build-types/components/widget-attribute-controls/widget-attribute-controls.d.ts +23 -0
  110. package/build-types/components/widget-attribute-controls/widget-attribute-controls.d.ts.map +1 -0
  111. package/build-types/components/widget-chrome/widget-chrome.d.ts +8 -8
  112. package/build-types/components/widget-chrome/widget-chrome.d.ts.map +1 -1
  113. package/build-types/components/widget-frame/index.d.ts +3 -0
  114. package/build-types/components/widget-frame/index.d.ts.map +1 -0
  115. package/build-types/components/widget-frame/widget-frame.d.ts +25 -0
  116. package/build-types/components/widget-frame/widget-frame.d.ts.map +1 -0
  117. package/build-types/components/widget-header/index.d.ts +3 -0
  118. package/build-types/components/widget-header/index.d.ts.map +1 -0
  119. package/build-types/components/widget-header/widget-header-infotip.d.ts +20 -0
  120. package/build-types/components/widget-header/widget-header-infotip.d.ts.map +1 -0
  121. package/build-types/components/widget-header/widget-header.d.ts +38 -0
  122. package/build-types/components/widget-header/widget-header.d.ts.map +1 -0
  123. package/build-types/components/widget-layout-controls/index.d.ts +3 -0
  124. package/build-types/components/widget-layout-controls/index.d.ts.map +1 -0
  125. package/build-types/components/widget-layout-controls/widget-layout-controls.d.ts +14 -0
  126. package/build-types/components/widget-layout-controls/widget-layout-controls.d.ts.map +1 -0
  127. package/build-types/components/widget-picker/widget-picker.d.ts.map +1 -1
  128. package/build-types/components/widget-preview-chrome/index.d.ts +3 -0
  129. package/build-types/components/widget-preview-chrome/index.d.ts.map +1 -0
  130. package/build-types/components/widget-preview-chrome/widget-preview-chrome.d.ts +15 -0
  131. package/build-types/components/widget-preview-chrome/widget-preview-chrome.d.ts.map +1 -0
  132. package/build-types/components/widget-settings/index.d.ts +2 -2
  133. package/build-types/components/widget-settings/utils/index.d.ts +0 -1
  134. package/build-types/components/widget-settings/utils/index.d.ts.map +1 -1
  135. package/build-types/components/widget-settings/widget-settings-trigger.d.ts +4 -3
  136. package/build-types/components/widget-settings/widget-settings-trigger.d.ts.map +1 -1
  137. package/build-types/components/widget-settings/widget-settings.d.ts +2 -2
  138. package/build-types/components/widget-settings/widget-settings.d.ts.map +1 -1
  139. package/build-types/components/widget-toolbar/widget-toolbar.d.ts +10 -7
  140. package/build-types/components/widget-toolbar/widget-toolbar.d.ts.map +1 -1
  141. package/build-types/components/widgets/widgets.d.ts.map +1 -1
  142. package/build-types/context/dashboard-context.d.ts +23 -40
  143. package/build-types/context/dashboard-context.d.ts.map +1 -1
  144. package/build-types/context/ui-context.d.ts +0 -18
  145. package/build-types/context/ui-context.d.ts.map +1 -1
  146. package/build-types/types.d.ts +9 -15
  147. package/build-types/types.d.ts.map +1 -1
  148. package/build-types/utils/index.d.ts +0 -1
  149. package/build-types/utils/index.d.ts.map +1 -1
  150. package/build-types/widget-dashboard.d.ts +5 -5
  151. package/build-types/widget-dashboard.d.ts.map +1 -1
  152. package/package.json +17 -17
  153. package/src/components/actions/actions.tsx +2 -22
  154. package/src/components/commands/commands.tsx +3 -70
  155. package/src/components/widget-attribute-controls/index.ts +1 -0
  156. package/src/components/widget-attribute-controls/widget-attribute-controls.tsx +108 -0
  157. package/src/components/widget-chrome/widget-chrome.module.css +3 -68
  158. package/src/components/widget-chrome/widget-chrome.tsx +19 -130
  159. package/src/components/widget-frame/index.ts +2 -0
  160. package/src/components/widget-frame/widget-frame.module.css +17 -0
  161. package/src/components/widget-frame/widget-frame.tsx +138 -0
  162. package/src/components/widget-header/index.ts +2 -0
  163. package/src/components/widget-header/widget-header-infotip.tsx +82 -0
  164. package/src/components/widget-header/widget-header.module.css +76 -0
  165. package/src/components/widget-header/widget-header.tsx +101 -0
  166. package/src/components/widget-layout-controls/index.ts +2 -0
  167. package/src/components/{widgets/widget-layout-toolbar.tsx → widget-layout-controls/widget-layout-controls.tsx} +12 -13
  168. package/src/components/widget-picker/widget-picker.tsx +5 -10
  169. package/src/components/widget-preview-chrome/index.ts +2 -0
  170. package/src/components/widget-preview-chrome/widget-preview-chrome.module.css +22 -0
  171. package/src/components/widget-preview-chrome/widget-preview-chrome.tsx +65 -0
  172. package/src/components/widget-settings/index.ts +2 -2
  173. package/src/components/widget-settings/utils/index.ts +0 -1
  174. package/src/components/widget-settings/widget-settings-trigger.tsx +36 -43
  175. package/src/components/widget-settings/widget-settings.tsx +7 -26
  176. package/src/components/widget-toolbar/widget-toolbar.module.css +6 -9
  177. package/src/components/widget-toolbar/widget-toolbar.tsx +14 -8
  178. package/src/components/widgets/widgets.module.css +0 -1
  179. package/src/components/widgets/widgets.tsx +30 -8
  180. package/src/context/dashboard-context.tsx +70 -133
  181. package/src/context/ui-context.tsx +1 -39
  182. package/src/test/actions.test.tsx +7 -77
  183. package/src/test/commands.test.tsx +6 -45
  184. package/src/test/staging.test.tsx +82 -144
  185. package/src/test/widget-dashboard.test.tsx +24 -0
  186. package/src/types.ts +9 -16
  187. package/src/utils/index.ts +0 -1
  188. package/src/widget-dashboard.tsx +4 -8
  189. package/build/components/layout-settings/index.cjs.map +0 -7
  190. package/build/components/layout-settings/layout-model-edit-field/index.cjs +0 -186
  191. package/build/components/layout-settings/layout-model-edit-field/index.cjs.map +0 -7
  192. package/build/components/layout-settings/layout-model-edit-field/thumbnail-grid.cjs +0 -53
  193. package/build/components/layout-settings/layout-model-edit-field/thumbnail-grid.cjs.map +0 -7
  194. package/build/components/layout-settings/layout-model-edit-field/thumbnail-masonry.cjs +0 -53
  195. package/build/components/layout-settings/layout-model-edit-field/thumbnail-masonry.cjs.map +0 -7
  196. package/build/components/layout-settings/layout-settings.cjs +0 -207
  197. package/build/components/layout-settings/layout-settings.cjs.map +0 -7
  198. package/build/components/widget-settings/utils/get-admin-menu-inset.cjs.map +0 -7
  199. package/build/components/widget-settings/widget-settings-toolbar.cjs.map +0 -7
  200. package/build/components/widgets/widget-layout-toolbar.cjs.map +0 -7
  201. package/build/utils/grid-model-change/grid-model-change.cjs +0 -56
  202. package/build/utils/grid-model-change/grid-model-change.cjs.map +0 -7
  203. package/build/utils/grid-model-change/index.cjs.map +0 -7
  204. package/build/utils/migrate-layout/index.cjs.map +0 -7
  205. package/build/utils/migrate-layout/migrate-layout.cjs +0 -94
  206. package/build/utils/migrate-layout/migrate-layout.cjs.map +0 -7
  207. package/build-module/components/layout-settings/index.mjs +0 -6
  208. package/build-module/components/layout-settings/index.mjs.map +0 -7
  209. package/build-module/components/layout-settings/layout-model-edit-field/index.mjs +0 -151
  210. package/build-module/components/layout-settings/layout-model-edit-field/index.mjs.map +0 -7
  211. package/build-module/components/layout-settings/layout-model-edit-field/thumbnail-grid.mjs +0 -28
  212. package/build-module/components/layout-settings/layout-model-edit-field/thumbnail-grid.mjs.map +0 -7
  213. package/build-module/components/layout-settings/layout-model-edit-field/thumbnail-masonry.mjs +0 -28
  214. package/build-module/components/layout-settings/layout-model-edit-field/thumbnail-masonry.mjs.map +0 -7
  215. package/build-module/components/layout-settings/layout-settings.mjs +0 -187
  216. package/build-module/components/layout-settings/layout-settings.mjs.map +0 -7
  217. package/build-module/components/widget-settings/utils/get-admin-menu-inset.mjs +0 -16
  218. package/build-module/components/widget-settings/utils/get-admin-menu-inset.mjs.map +0 -7
  219. package/build-module/components/widget-settings/widget-settings-toolbar.mjs.map +0 -7
  220. package/build-module/components/widgets/widget-layout-toolbar.mjs +0 -181
  221. package/build-module/components/widgets/widget-layout-toolbar.mjs.map +0 -7
  222. package/build-module/utils/grid-model-change/grid-model-change.mjs +0 -30
  223. package/build-module/utils/grid-model-change/grid-model-change.mjs.map +0 -7
  224. package/build-module/utils/grid-model-change/index.mjs +0 -7
  225. package/build-module/utils/grid-model-change/index.mjs.map +0 -7
  226. package/build-module/utils/migrate-layout/index.mjs +0 -6
  227. package/build-module/utils/migrate-layout/index.mjs.map +0 -7
  228. package/build-module/utils/migrate-layout/migrate-layout.mjs +0 -69
  229. package/build-module/utils/migrate-layout/migrate-layout.mjs.map +0 -7
  230. package/build-types/components/layout-settings/index.d.ts +0 -2
  231. package/build-types/components/layout-settings/index.d.ts.map +0 -1
  232. package/build-types/components/layout-settings/layout-model-edit-field/index.d.ts +0 -17
  233. package/build-types/components/layout-settings/layout-model-edit-field/index.d.ts.map +0 -1
  234. package/build-types/components/layout-settings/layout-model-edit-field/thumbnail-grid.d.ts +0 -6
  235. package/build-types/components/layout-settings/layout-model-edit-field/thumbnail-grid.d.ts.map +0 -1
  236. package/build-types/components/layout-settings/layout-model-edit-field/thumbnail-masonry.d.ts +0 -6
  237. package/build-types/components/layout-settings/layout-model-edit-field/thumbnail-masonry.d.ts.map +0 -1
  238. package/build-types/components/layout-settings/layout-settings.d.ts +0 -14
  239. package/build-types/components/layout-settings/layout-settings.d.ts.map +0 -1
  240. package/build-types/components/widget-settings/utils/get-admin-menu-inset.d.ts +0 -17
  241. package/build-types/components/widget-settings/utils/get-admin-menu-inset.d.ts.map +0 -1
  242. package/build-types/components/widget-settings/widget-settings-toolbar.d.ts +0 -20
  243. package/build-types/components/widget-settings/widget-settings-toolbar.d.ts.map +0 -1
  244. package/build-types/components/widgets/widget-layout-toolbar.d.ts +0 -14
  245. package/build-types/components/widgets/widget-layout-toolbar.d.ts.map +0 -1
  246. package/build-types/utils/grid-model-change/grid-model-change.d.ts +0 -20
  247. package/build-types/utils/grid-model-change/grid-model-change.d.ts.map +0 -1
  248. package/build-types/utils/grid-model-change/index.d.ts +0 -2
  249. package/build-types/utils/grid-model-change/index.d.ts.map +0 -1
  250. package/build-types/utils/migrate-layout/index.d.ts +0 -2
  251. package/build-types/utils/migrate-layout/index.d.ts.map +0 -1
  252. package/build-types/utils/migrate-layout/migrate-layout.d.ts +0 -36
  253. package/build-types/utils/migrate-layout/migrate-layout.d.ts.map +0 -1
  254. package/src/components/layout-settings/index.ts +0 -1
  255. package/src/components/layout-settings/layout-model-edit-field/index.tsx +0 -98
  256. package/src/components/layout-settings/layout-model-edit-field/style.module.css +0 -34
  257. package/src/components/layout-settings/layout-model-edit-field/thumbnail-grid.tsx +0 -28
  258. package/src/components/layout-settings/layout-model-edit-field/thumbnail-masonry.tsx +0 -28
  259. package/src/components/layout-settings/layout-settings.tsx +0 -217
  260. package/src/components/widget-picker/widget-picker.module.css +0 -11
  261. package/src/components/widget-settings/utils/get-admin-menu-inset.ts +0 -30
  262. package/src/components/widget-settings/widget-settings-toolbar.module.css +0 -25
  263. package/src/components/widget-settings/widget-settings-toolbar.tsx +0 -45
  264. package/src/components/widgets/widget-layout-toolbar.module.css +0 -6
  265. package/src/utils/grid-model-change/grid-model-change.ts +0 -53
  266. package/src/utils/grid-model-change/index.ts +0 -1
  267. package/src/utils/migrate-layout/index.ts +0 -1
  268. package/src/utils/migrate-layout/migrate-layout.ts +0 -156
  269. package/src/utils/migrate-layout/test/migrate-layout.test.ts +0 -114
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/context/ui-context.tsx"],
4
- "sourcesContent": ["/**\n * External dependencies\n */\nimport type { ReactNode } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tcreateContext,\n\tuseContext,\n\tuseMemo,\n\tuseState,\n} from '@wordpress/element';\n\ntype DrawerSide = 'left' | 'right';\n\ninterface DashboardUIContextValue {\n\tinserterOpen: boolean;\n\tsetInserterOpen: ( next: boolean ) => void;\n\n\tlayoutSettingsOpen: boolean;\n\tsetLayoutSettingsOpen: ( next: boolean ) => void;\n\tresetDialogOpen: boolean;\n\tsetResetDialogOpen: ( next: boolean ) => void;\n\n\t/**\n\t * `uuid` of the instance whose settings drawer is open, or `null`\n\t * when no settings drawer is showing. The per-instance gear in the\n\t * chrome sets it; the single `WidgetSettings` at the root reads\n\t * it.\n\t */\n\tsettingsWidgetUuid: string | null;\n\tsetSettingsWidgetUuid: ( next: string | null ) => void;\n\n\t/**\n\t * Edge the settings drawer slides in from. The gear sets it from the\n\t * widget's on-screen position so the drawer opens on the side away\n\t * from the widget, trying not to cover it.\n\t */\n\tsettingsDrawerSide: DrawerSide;\n\tsetSettingsDrawerSide: ( next: DrawerSide ) => void;\n\n\t/**\n\t * Inline-start inset (px) the settings drawer is offset by when it\n\t * opens from the left, so it clears fixed page chrome (the WordPress\n\t * admin menu) instead of sliding over it. `0` when there's nothing to\n\t * clear.\n\t */\n\tsettingsDrawerInset: number;\n\tsetSettingsDrawerInset: ( next: number ) => void;\n}\n\nconst Context = createContext< DashboardUIContextValue | null >( null );\n\n/**\n * Accesses the shared UI state: overlay open flags and the active settings\n * instance with its placement. Throws when called outside `WidgetDashboard`.\n */\nexport function useDashboardUIContext(): DashboardUIContextValue {\n\tconst ctx = useContext( Context );\n\tif ( ! ctx ) {\n\t\tthrow new Error(\n\t\t\t'Dashboard compound used outside a WidgetDashboard subtree.'\n\t\t);\n\t}\n\treturn ctx;\n}\n\ninterface ProviderProps {\n\tchildren: ReactNode;\n}\n\n/**\n * Holds transient UI state shared across compounds (the inserter modal and\n * the per-instance settings drawer). Kept separate from the data context so\n * that data mutations don't churn the UI state and vice-versa.\n *\n * @param {ProviderProps} props Component props.\n */\nexport function WidgetDashboardUIProvider( { children }: ProviderProps ) {\n\tconst [ inserterOpen, setInserterOpen ] = useState( false );\n\tconst [ layoutSettingsOpen, setLayoutSettingsOpen ] = useState( false );\n\tconst [ resetDialogOpen, setResetDialogOpen ] = useState( false );\n\tconst [ settingsWidgetUuid, setSettingsWidgetUuid ] = useState<\n\t\tstring | null\n\t>( null );\n\tconst [ settingsDrawerSide, setSettingsDrawerSide ] =\n\t\tuseState< DrawerSide >( 'right' );\n\tconst [ settingsDrawerInset, setSettingsDrawerInset ] = useState( 0 );\n\n\tconst value = useMemo< DashboardUIContextValue >(\n\t\t() => ( {\n\t\t\tinserterOpen,\n\t\t\tsetInserterOpen,\n\t\t\tlayoutSettingsOpen,\n\t\t\tsetLayoutSettingsOpen,\n\t\t\tresetDialogOpen,\n\t\t\tsetResetDialogOpen,\n\t\t\tsettingsWidgetUuid,\n\t\t\tsetSettingsWidgetUuid,\n\t\t\tsettingsDrawerSide,\n\t\t\tsetSettingsDrawerSide,\n\t\t\tsettingsDrawerInset,\n\t\t\tsetSettingsDrawerInset,\n\t\t} ),\n\t\t[\n\t\t\tinserterOpen,\n\t\t\tlayoutSettingsOpen,\n\t\t\tresetDialogOpen,\n\t\t\tsettingsWidgetUuid,\n\t\t\tsettingsDrawerSide,\n\t\t\tsettingsDrawerInset,\n\t\t]\n\t);\n\n\treturn <Context.Provider value={ value }>{ children }</Context.Provider>;\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQA,qBAKO;AAuGC;AA/DR,IAAM,cAAU,8BAAiD,IAAK;AAM/D,SAAS,wBAAiD;AAChE,QAAM,UAAM,2BAAY,OAAQ;AAChC,MAAK,CAAE,KAAM;AACZ,UAAM,IAAI;AAAA,MACT;AAAA,IACD;AAAA,EACD;AACA,SAAO;AACR;AAaO,SAAS,0BAA2B,EAAE,SAAS,GAAmB;AACxE,QAAM,CAAE,cAAc,eAAgB,QAAI,yBAAU,KAAM;AAC1D,QAAM,CAAE,oBAAoB,qBAAsB,QAAI,yBAAU,KAAM;AACtE,QAAM,CAAE,iBAAiB,kBAAmB,QAAI,yBAAU,KAAM;AAChE,QAAM,CAAE,oBAAoB,qBAAsB,QAAI,yBAEnD,IAAK;AACR,QAAM,CAAE,oBAAoB,qBAAsB,QACjD,yBAAwB,OAAQ;AACjC,QAAM,CAAE,qBAAqB,sBAAuB,QAAI,yBAAU,CAAE;AAEpE,QAAM,YAAQ;AAAA,IACb,OAAQ;AAAA,MACP;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACD;AAAA,IACA;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACD;AAAA,EACD;AAEA,SAAO,4CAAC,QAAQ,UAAR,EAAiB,OAAkB,UAAU;AACtD;",
4
+ "sourcesContent": ["/**\n * External dependencies\n */\nimport type { ReactNode } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tcreateContext,\n\tuseContext,\n\tuseMemo,\n\tuseState,\n} from '@wordpress/element';\n\ninterface DashboardUIContextValue {\n\tinserterOpen: boolean;\n\tsetInserterOpen: ( next: boolean ) => void;\n\n\tresetDialogOpen: boolean;\n\tsetResetDialogOpen: ( next: boolean ) => void;\n\n\t/**\n\t * `uuid` of the instance whose settings drawer is open, or `null`\n\t * when no settings drawer is showing. The per-instance gear in the\n\t * chrome sets it; the single `WidgetSettings` at the root reads\n\t * it.\n\t */\n\tsettingsWidgetUuid: string | null;\n\tsetSettingsWidgetUuid: ( next: string | null ) => void;\n}\n\nconst Context = createContext< DashboardUIContextValue | null >( null );\n\n/**\n * Accesses the shared UI state: overlay open flags and the active settings\n * instance with its placement. Throws when called outside `WidgetDashboard`.\n */\nexport function useDashboardUIContext(): DashboardUIContextValue {\n\tconst ctx = useContext( Context );\n\tif ( ! ctx ) {\n\t\tthrow new Error(\n\t\t\t'Dashboard compound used outside a WidgetDashboard subtree.'\n\t\t);\n\t}\n\treturn ctx;\n}\n\ninterface ProviderProps {\n\tchildren: ReactNode;\n}\n\n/**\n * Holds transient UI state shared across compounds (the inserter modal and\n * the per-instance settings drawer). Kept separate from the data context so\n * that data mutations don't churn the UI state and vice-versa.\n *\n * @param {ProviderProps} props Component props.\n */\nexport function WidgetDashboardUIProvider( { children }: ProviderProps ) {\n\tconst [ inserterOpen, setInserterOpen ] = useState( false );\n\tconst [ resetDialogOpen, setResetDialogOpen ] = useState( false );\n\tconst [ settingsWidgetUuid, setSettingsWidgetUuid ] = useState<\n\t\tstring | null\n\t>( null );\n\n\tconst value = useMemo< DashboardUIContextValue >(\n\t\t() => ( {\n\t\t\tinserterOpen,\n\t\t\tsetInserterOpen,\n\t\t\tresetDialogOpen,\n\t\t\tsetResetDialogOpen,\n\t\t\tsettingsWidgetUuid,\n\t\t\tsetSettingsWidgetUuid,\n\t\t} ),\n\t\t[ inserterOpen, resetDialogOpen, settingsWidgetUuid ]\n\t);\n\n\treturn <Context.Provider value={ value }>{ children }</Context.Provider>;\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQA,qBAKO;AAiEC;AA9CR,IAAM,cAAU,8BAAiD,IAAK;AAM/D,SAAS,wBAAiD;AAChE,QAAM,UAAM,2BAAY,OAAQ;AAChC,MAAK,CAAE,KAAM;AACZ,UAAM,IAAI;AAAA,MACT;AAAA,IACD;AAAA,EACD;AACA,SAAO;AACR;AAaO,SAAS,0BAA2B,EAAE,SAAS,GAAmB;AACxE,QAAM,CAAE,cAAc,eAAgB,QAAI,yBAAU,KAAM;AAC1D,QAAM,CAAE,iBAAiB,kBAAmB,QAAI,yBAAU,KAAM;AAChE,QAAM,CAAE,oBAAoB,qBAAsB,QAAI,yBAEnD,IAAK;AAER,QAAM,YAAQ;AAAA,IACb,OAAQ;AAAA,MACP;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACD;AAAA,IACA,CAAE,cAAc,iBAAiB,kBAAmB;AAAA,EACrD;AAEA,SAAO,4CAAC,QAAQ,UAAR,EAAiB,OAAkB,UAAU;AACtD;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/types.ts"],
4
- "sourcesContent": ["/**\n * Dashboard-specific types: `DashboardWidget`, grid settings, and the\n * `WidgetDashboard` prop bag.\n *\n * The widget contract types (`WidgetName`, `WidgetType`, `WidgetRenderProps`,\n * `ResolveWidgetModule`) live in `@wordpress/widget-primitives` and are\n * imported from there directly; this module does not re-export them.\n */\n\n/**\n * External dependencies\n */\nimport type { ReactNode } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport type {\n\tDashboardGridLayoutItem,\n\tDashboardLanesLayoutItem,\n} from '@wordpress/grid';\nimport type {\n\tWidgetName,\n\tWidgetType,\n\tResolveWidgetModule,\n} from '@wordpress/widget-primitives';\n\nexport type GridTilePlacement = Omit< DashboardGridLayoutItem, 'key' >;\nexport type MasonryTilePlacement = Omit< DashboardLanesLayoutItem, 'key' >;\n\n/**\n * Storage shape for a widget's placement.\n *\n * Structurally a union of every supported per-model shape, but the\n * intended invariant is stronger than the type suggests: every\n * placement in a given layout must match the shape of the currently\n * active `gridSettings.model`. `migrateLayout` is the only correct\n * way to transition placements across model changes; the render\n * layer is allowed to trust the active model and treat each\n * placement as the matching shape.\n *\n * The type system cannot enforce that invariant on its own (there is\n * no discriminator on the placement itself), so consider this union a\n * declaration of which shapes are *valid*, not which shape any given\n * placement happens to be at runtime.\n */\nexport type DashboardTilePlacement = GridTilePlacement | MasonryTilePlacement;\n\n/**\n * A widget placed on the dashboard.\n *\n * A `WidgetType` describes the blueprint. A `DashboardWidget` is a\n * concrete placement of that type on a specific dashboard: its unique\n * id, the type it references, user-configured attributes, and its\n * `placement` in the grid.\n */\nexport interface DashboardWidget< Item = unknown > {\n\t/**\n\t * Unique instance identifier.\n\t */\n\tuuid: string;\n\n\t/**\n\t * Widget type name — must match a `WidgetType.name` in `widgetTypes`.\n\t */\n\ttype: WidgetName;\n\n\t/**\n\t * User-configured attributes for this instance.\n\t */\n\tattributes?: Item;\n\n\t/**\n\t * Grid-model-specific placement (column/row spans, ordering,\n\t * etc.). Must match the shape implied by the dashboard's active\n\t * `gridSettings.model`; see `DashboardTilePlacement` for the\n\t * invariant and `migrateLayout` for the transition mechanism.\n\t */\n\tplacement?: DashboardTilePlacement;\n}\n\n/**\n * Identity of a widget within the rendering tree. Returned by\n * `useWidgetContext()`; `null` when called outside a widget render subtree.\n */\nexport interface WidgetContextValue {\n\t/**\n\t * Widget instance id.\n\t */\n\tuuid: string;\n\n\t/**\n\t * Widget type name.\n\t */\n\tname: WidgetName;\n\n\t/**\n\t * Index of the widget in the `layout` array.\n\t */\n\tindex: number;\n}\n\n/**\n * Identifier for the active grid model. Drives which `@wordpress/grid`\n * surface the dashboard mounts and which per-model settings the\n * `WidgetGridSettings` union admits.\n *\n * Model names describe user-facing concepts. The mapping to the\n * underlying `@wordpress/grid` component is an implementation detail\n * resolved in the render layer; `'masonry'` is rendered today through\n * `DashboardLanes` (skyline placement) but could swap to a future\n * native `display: grid-lanes` path without affecting the model name.\n */\nexport type WidgetGridModel = 'grid' | 'masonry';\n\n/**\n * Maximum column count for the widget dashboard on wide containers.\n * Not exposed in layout settings; container width steps the count down\n * to two and one column at fixed breakpoints.\n */\nexport const WIDGET_DASHBOARD_COLUMN_COUNT = 4;\n\n/**\n * Settings common to every grid model. Column count is resolved from\n * the dashboard container width (see\n * `utils/resolve-dashboard-column-count`). `columns` and `minColumnWidth`\n * on this type remain for persisted payloads and `@wordpress/grid`\n * compatibility; the dashboard ignores user-facing values for both.\n *\n * `spacing` is intentionally absent: the gap between tiles is\n * presentational and lives with the design-system theme/density, not\n * with per-dashboard settings. The grid surface keeps the prop for\n * programmatic overrides, but the dashboard does not propagate it.\n */\ninterface BaseWidgetGridSettings {\n\t/**\n\t * Target column count (cap). The dashboard always uses\n\t * {@link WIDGET_DASHBOARD_COLUMN_COUNT}; persisted values are ignored.\n\t */\n\tcolumns?: number;\n\n\t/**\n\t * Per-tile minimum width in pixels. Unused by the dashboard; column\n\t * count is derived from container width instead.\n\t */\n\tminColumnWidth?: number;\n}\n\n/**\n * 2D packed grid settings. Items declare explicit width and height\n * spans; rows use a uniform track height via `rowHeight`.\n */\nexport interface WidgetGridLayoutSettings extends BaseWidgetGridSettings {\n\tmodel?: 'grid';\n\n\t/**\n\t * Row height in pixels (`200` small, `300` medium, `400` large). Every\n\t * tile in a row fills the row vertically.\n\t */\n\trowHeight?: number;\n}\n\n/**\n * Masonry settings. Heights are content-driven; resize is\n * horizontal-only. `flowTolerance` tunes how aggressively the placer\n * preserves source order vs. minimizing empty regions.\n */\nexport interface WidgetMasonryLayoutSettings extends BaseWidgetGridSettings {\n\tmodel: 'masonry';\n\n\t/**\n\t * Pixel tolerance for source-order tiebreaking when two candidate\n\t * columns have similar baselines.\n\t */\n\tflowTolerance?: number;\n}\n\n/**\n * Discriminated union of supported grid-model configurations.\n *\n * When `model` is omitted the dashboard treats the settings as the\n * 2D packed grid (`'grid'`) for backwards compatibility with the\n * pre-union shape.\n */\nexport type WidgetGridSettings =\n\t| WidgetGridLayoutSettings\n\t| WidgetMasonryLayoutSettings;\n\n/**\n * Props for `WidgetDashboard`.\n *\n * The consumer owns the committed layout state; the dashboard maintains\n * a staging copy internally for in-progress edits, and `onLayoutChange`\n * fires only when the user commits via the Done action.\n */\nexport interface WidgetDashboardProps {\n\t/**\n\t * Widget instances to render. Consumer owns this state.\n\t */\n\tlayout: DashboardWidget[];\n\n\t/**\n\t * Called when the user commits in-progress edits via the Done action.\n\t * Receives the full layout array as it should be persisted. In-progress\n\t * mutations (reorder, resize, add, remove, attribute edits) accumulate\n\t * in the dashboard's internal staging layer and do not fire this\n\t * callback until commit.\n\t */\n\tonLayoutChange: ( layout: DashboardWidget[] ) => void;\n\n\t/**\n\t * Called when the layout is reset to the default.\n\t */\n\tonLayoutReset?: () => void;\n\n\t/**\n\t * Widget types available for rendering. The dashboard never queries a\n\t * store directly — consumers scope and filter via this prop.\n\t */\n\twidgetTypes: WidgetType[];\n\n\t/**\n\t * When true, widget types are still loading. Instances whose type is\n\t * not yet in `widgetTypes` show a loading state instead of missing.\n\t */\n\tisResolvingWidgetTypes?: boolean;\n\n\t/**\n\t * Whether the dashboard is in edit mode (enables drag/resize).\n\t */\n\teditMode?: boolean;\n\n\t/**\n\t * Called when edit mode toggles via `WidgetDashboard.Actions`.\n\t */\n\tonEditChange?: ( next: boolean ) => void;\n\n\t/**\n\t * Overrides the default `import()` resolution of\n\t * `WidgetType.renderModule`. Useful for tests, Storybook, or future\n\t * remote-URL loading.\n\t */\n\tresolveWidgetModule?: ResolveWidgetModule;\n\n\t/**\n\t * Grid model configuration. See `WidgetGridSettings` for the shape.\n\t */\n\tgridSettings?: WidgetGridSettings;\n\n\t/**\n\t * Called when the user commits in-progress grid-settings edits via\n\t * the Done action. The dashboard maintains a staging copy of\n\t * settings internally; mutations stay local until commit. When\n\t * omitted, the `Layout settings` button in the customize toolbar is\n\t * hidden, since there is nowhere to persist the change.\n\t */\n\tonGridSettingsChange?: ( gridSettings: WidgetGridSettings ) => void;\n\n\tchildren?: ReactNode;\n}\n"],
4
+ "sourcesContent": ["/**\n * Dashboard-specific types: `DashboardWidget`, grid settings, and the\n * `WidgetDashboard` prop bag.\n *\n * The widget contract types (`WidgetName`, `WidgetType`, `WidgetRenderProps`,\n * `ResolveWidgetModule`) live in `@wordpress/widget-primitives` and are\n * imported from there directly; this module does not re-export them.\n */\n\n/**\n * External dependencies\n */\nimport type { ReactNode } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport type {\n\tDashboardGridLayoutItem,\n\tDashboardLanesLayoutItem,\n} from '@wordpress/grid';\nimport type {\n\tWidgetName,\n\tWidgetType,\n\tResolveWidgetModule,\n} from '@wordpress/widget-primitives';\n\nexport type GridTilePlacement = Omit< DashboardGridLayoutItem, 'key' >;\nexport type MasonryTilePlacement = Omit< DashboardLanesLayoutItem, 'key' >;\n\n/**\n * Storage shape for a widget's placement.\n *\n * Structurally a union of every supported per-model shape, but the\n * intended invariant is stronger than the type suggests: every\n * placement in a given layout must match the shape of the currently\n * active `gridSettings.model`. Consumers that switch the model must\n * supply placements in the new shape; the render layer is allowed to\n * trust the active model and treat each placement as the matching\n * shape.\n *\n * The type system cannot enforce that invariant on its own (there is\n * no discriminator on the placement itself), so consider this union a\n * declaration of which shapes are *valid*, not which shape any given\n * placement happens to be at runtime.\n */\nexport type DashboardTilePlacement = GridTilePlacement | MasonryTilePlacement;\n\n/**\n * A widget placed on the dashboard.\n *\n * A `WidgetType` describes the blueprint. A `DashboardWidget` is a\n * concrete placement of that type on a specific dashboard: its unique\n * id, the type it references, user-configured attributes, and its\n * `placement` in the grid.\n */\nexport interface DashboardWidget< Item = unknown > {\n\t/**\n\t * Unique instance identifier.\n\t */\n\tuuid: string;\n\n\t/**\n\t * Widget type name — must match a `WidgetType.name` in `widgetTypes`.\n\t */\n\ttype: WidgetName;\n\n\t/**\n\t * User-configured attributes for this instance.\n\t */\n\tattributes?: Item;\n\n\t/**\n\t * Grid-model-specific placement (column/row spans, ordering,\n\t * etc.). Must match the shape implied by the dashboard's active\n\t * `gridSettings.model`; see `DashboardTilePlacement` for the\n\t * invariant.\n\t */\n\tplacement?: DashboardTilePlacement;\n}\n\n/**\n * Identity of a widget within the rendering tree. Returned by\n * `useWidgetContext()`; `null` when called outside a widget render subtree.\n */\nexport interface WidgetContextValue {\n\t/**\n\t * Widget instance id.\n\t */\n\tuuid: string;\n\n\t/**\n\t * Widget type name.\n\t */\n\tname: WidgetName;\n\n\t/**\n\t * Index of the widget in the `layout` array.\n\t */\n\tindex: number;\n}\n\n/**\n * Identifier for the active grid model. Drives which `@wordpress/grid`\n * surface the dashboard mounts and which per-model settings the\n * `WidgetGridSettings` union admits.\n *\n * Model names describe user-facing concepts. The mapping to the\n * underlying `@wordpress/grid` component is an implementation detail\n * resolved in the render layer; `'masonry'` is rendered today through\n * `DashboardLanes` (skyline placement) but could swap to a future\n * native `display: grid-lanes` path without affecting the model name.\n */\nexport type WidgetGridModel = 'grid' | 'masonry';\n\n/**\n * Maximum column count for the widget dashboard on wide containers.\n * Not user-configurable; container width steps the count down to two\n * and one column at fixed breakpoints.\n */\nexport const WIDGET_DASHBOARD_COLUMN_COUNT = 4;\n\n/**\n * Settings common to every grid model. Column count is resolved from\n * the dashboard container width (see\n * `utils/resolve-dashboard-column-count`). `columns` and `minColumnWidth`\n * on this type remain for persisted payloads and `@wordpress/grid`\n * compatibility; the dashboard ignores user-facing values for both.\n *\n * `spacing` is intentionally absent: the gap between tiles is\n * presentational and lives with the design-system theme/density, not\n * with per-dashboard settings. The grid surface keeps the prop for\n * programmatic overrides, but the dashboard does not propagate it.\n */\ninterface BaseWidgetGridSettings {\n\t/**\n\t * Target column count (cap). The dashboard always uses\n\t * {@link WIDGET_DASHBOARD_COLUMN_COUNT}; persisted values are ignored.\n\t */\n\tcolumns?: number;\n\n\t/**\n\t * Per-tile minimum width in pixels. Unused by the dashboard; column\n\t * count is derived from container width instead.\n\t */\n\tminColumnWidth?: number;\n}\n\n/**\n * 2D packed grid settings. Items declare explicit width and height\n * spans; rows use a uniform track height via `rowHeight`.\n */\nexport interface WidgetGridLayoutSettings extends BaseWidgetGridSettings {\n\tmodel?: 'grid';\n\n\t/**\n\t * Row height in pixels (`200` small, `300` medium, `400` large). Every\n\t * tile in a row fills the row vertically.\n\t */\n\trowHeight?: number;\n}\n\n/**\n * Masonry settings. Heights are content-driven; resize is\n * horizontal-only. `flowTolerance` tunes how aggressively the placer\n * preserves source order vs. minimizing empty regions.\n */\nexport interface WidgetMasonryLayoutSettings extends BaseWidgetGridSettings {\n\tmodel: 'masonry';\n\n\t/**\n\t * Pixel tolerance for source-order tiebreaking when two candidate\n\t * columns have similar baselines.\n\t */\n\tflowTolerance?: number;\n}\n\n/**\n * Discriminated union of supported grid-model configurations.\n *\n * When `model` is omitted the dashboard treats the settings as the\n * 2D packed grid (`'grid'`) for backwards compatibility with the\n * pre-union shape.\n */\nexport type WidgetGridSettings =\n\t| WidgetGridLayoutSettings\n\t| WidgetMasonryLayoutSettings;\n\n/**\n * Props for `WidgetDashboard`.\n *\n * The consumer owns the committed layout state; the dashboard maintains\n * a staging copy internally for in-progress edits, and `onLayoutChange`\n * fires only when the user commits via the Done action.\n */\nexport interface WidgetDashboardProps {\n\t/**\n\t * Widget instances to render. Consumer owns this state.\n\t */\n\tlayout: DashboardWidget[];\n\n\t/**\n\t * Called when the user commits in-progress edits via the Done action.\n\t * Receives the full layout array as it should be persisted. In-progress\n\t * mutations (reorder, resize, add, remove, attribute edits) accumulate\n\t * in the dashboard's internal staging layer and do not fire this\n\t * callback until commit.\n\t */\n\tonLayoutChange: ( layout: DashboardWidget[] ) => void;\n\n\t/**\n\t * Called when the layout is reset to the default.\n\t */\n\tonLayoutReset?: () => void;\n\n\t/**\n\t * Widget types available for rendering. The dashboard never queries a\n\t * store directly — consumers scope and filter via this prop.\n\t */\n\twidgetTypes: WidgetType[];\n\n\t/**\n\t * When true, widget types are still loading. Instances whose type is\n\t * not yet in `widgetTypes` show a loading state instead of missing.\n\t */\n\tisResolvingWidgetTypes?: boolean;\n\n\t/**\n\t * Whether the dashboard is in edit mode (enables drag/resize).\n\t */\n\teditMode?: boolean;\n\n\t/**\n\t * Called when edit mode toggles via `WidgetDashboard.Actions`.\n\t */\n\tonEditChange?: ( next: boolean ) => void;\n\n\t/**\n\t * Overrides the default `import()` resolution of\n\t * `WidgetType.renderModule`. Useful for tests, Storybook, or future\n\t * remote-URL loading.\n\t */\n\tresolveWidgetModule?: ResolveWidgetModule;\n\n\t/**\n\t * Grid model configuration. See `WidgetGridSettings` for the shape.\n\t * Read-only for the dashboard: the consumer owns the settings and\n\t * their persistence.\n\t */\n\tgridSettings?: WidgetGridSettings;\n\n\tchildren?: ReactNode;\n}\n"],
5
5
  "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAwHO,IAAM,gCAAgC;",
6
6
  "names": []
7
7
  }
@@ -20,15 +20,12 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // packages/widget-dashboard/src/utils/index.ts
21
21
  var utils_exports = {};
22
22
  __export(utils_exports, {
23
- createDashboardWidget: () => import_create_dashboard_widget.createDashboardWidget,
24
- migrateLayout: () => import_migrate_layout.migrateLayout
23
+ createDashboardWidget: () => import_create_dashboard_widget.createDashboardWidget
25
24
  });
26
25
  module.exports = __toCommonJS(utils_exports);
27
26
  var import_create_dashboard_widget = require("./create-dashboard-widget/index.cjs");
28
- var import_migrate_layout = require("./migrate-layout/index.cjs");
29
27
  // Annotate the CommonJS export names for ESM import in node:
30
28
  0 && (module.exports = {
31
- createDashboardWidget,
32
- migrateLayout
29
+ createDashboardWidget
33
30
  });
34
31
  //# sourceMappingURL=index.cjs.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/utils/index.ts"],
4
- "sourcesContent": ["export { createDashboardWidget } from './create-dashboard-widget';\nexport { migrateLayout } from './migrate-layout';\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qCAAsC;AACtC,4BAA8B;",
4
+ "sourcesContent": ["export { createDashboardWidget } from './create-dashboard-widget';\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qCAAsC;",
6
6
  "names": []
7
7
  }
@@ -27,7 +27,6 @@ var import_dashboard_context = require("./context/dashboard-context.cjs");
27
27
  var import_ui_context = require("./context/ui-context.cjs");
28
28
  var import_actions = require("./components/actions/index.cjs");
29
29
  var import_commands = require("./components/commands/index.cjs");
30
- var import_layout_settings = require("./components/layout-settings/index.cjs");
31
30
  var import_no_widgets_state = require("./components/no-widgets-state/index.cjs");
32
31
  var import_reset_confirmation = require("./components/reset-confirmation/index.cjs");
33
32
  var import_widget_chrome = require("./components/widget-chrome/index.cjs");
@@ -46,7 +45,6 @@ var WidgetDashboard = Object.assign(
46
45
  onEditChange,
47
46
  resolveWidgetModule,
48
47
  gridSettings,
49
- onGridSettingsChange,
50
48
  children
51
49
  }) {
52
50
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
@@ -61,7 +59,6 @@ var WidgetDashboard = Object.assign(
61
59
  onEditChange,
62
60
  resolveWidgetModule,
63
61
  gridSettings,
64
- onGridSettingsChange,
65
62
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_ui_context.WidgetDashboardUIProvider, { children: [
66
63
  children ?? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
67
64
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_no_widgets_state.NoWidgetsState, {}),
@@ -70,7 +67,6 @@ var WidgetDashboard = Object.assign(
70
67
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_commands.Commands, {})
71
68
  ] }),
72
69
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_widget_inserter.WidgetInserter, {}),
73
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_layout_settings.LayoutSettings, {}),
74
70
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_widget_settings.WidgetSettings, {}),
75
71
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_reset_confirmation.ResetConfirmation, {})
76
72
  ] })
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/widget-dashboard.tsx"],
4
- "sourcesContent": ["/**\n * Internal dependencies\n */\nimport { WidgetDashboardProvider } from './context/dashboard-context';\nimport { WidgetDashboardUIProvider } from './context/ui-context';\nimport { Actions } from './components/actions';\nimport { Commands } from './components/commands';\nimport { LayoutSettings } from './components/layout-settings';\nimport { NoWidgetsState } from './components/no-widgets-state';\nimport { ResetConfirmation } from './components/reset-confirmation';\nimport { WidgetChrome } from './components/widget-chrome';\nimport { WidgetInserter } from './components/widget-inserter';\nimport { WidgetSettings } from './components/widget-settings';\nimport { Widgets } from './components/widgets';\nimport type { WidgetDashboardProps } from './types';\n\n/**\n * Stateless rendering engine for widget dashboards.\n *\n * The consumer owns `layout` and `editMode` state; every mutation fires\n * `onLayoutChange` with the fully updated array. The engine never queries a\n * widget store; types flow in via the `widgetTypes` prop.\n *\n * ```tsx\n * import { WidgetDashboard } from '@wordpress/widget-dashboard';\n *\n * function MyDashboard() {\n * \tconst [ layout, setLayout ] = useState( defaultLayout );\n * \tconst [ editMode, setEditMode ] = useState( false );\n * \treturn (\n * \t\t<WidgetDashboard\n * \t\t\tlayout={ layout }\n * \t\t\tonLayoutChange={ setLayout }\n * \t\t\twidgetTypes={ widgetTypes }\n * \t\t\teditMode={ editMode }\n * \t\t\tonEditChange={ setEditMode }\n * \t\t>\n * \t\t\t<WidgetDashboard.NoWidgetsState>\n * \t\t\t\t<p>No widgets yet.</p>\n * \t\t\t</WidgetDashboard.NoWidgetsState>\n * \t\t\t<WidgetDashboard.Actions />\n * \t\t\t<WidgetDashboard.Widgets />\n * \t\t\t<WidgetDashboard.Commands />\n * \t\t</WidgetDashboard>\n * \t);\n * }\n * ```\n *\n * Children compose the dashboard's triggers and chrome: `Actions`,\n * `Widgets`, `Commands`, `NoWidgetsState`. The targets they open (the\n * widget inserter, the layout and widget settings editors, the reset\n * confirmation) are mounted by the engine and driven by shared UI state, so\n * a trigger works wherever it is composed without a matching target in the\n * tree. Omitting `children` renders the default arrangement.\n */\nexport const WidgetDashboard = Object.assign(\n\tfunction WidgetDashboard( {\n\t\tlayout,\n\t\tonLayoutChange,\n\t\tonLayoutReset,\n\t\twidgetTypes,\n\t\tisResolvingWidgetTypes,\n\t\teditMode,\n\t\tonEditChange,\n\t\tresolveWidgetModule,\n\t\tgridSettings,\n\t\tonGridSettingsChange,\n\t\tchildren,\n\t}: WidgetDashboardProps ) {\n\t\treturn (\n\t\t\t<WidgetDashboardProvider\n\t\t\t\tlayout={ layout }\n\t\t\t\tonLayoutChange={ onLayoutChange }\n\t\t\t\tonLayoutReset={ onLayoutReset }\n\t\t\t\twidgetTypes={ widgetTypes }\n\t\t\t\tisResolvingWidgetTypes={ isResolvingWidgetTypes }\n\t\t\t\teditMode={ editMode }\n\t\t\t\tonEditChange={ onEditChange }\n\t\t\t\tresolveWidgetModule={ resolveWidgetModule }\n\t\t\t\tgridSettings={ gridSettings }\n\t\t\t\tonGridSettingsChange={ onGridSettingsChange }\n\t\t\t>\n\t\t\t\t<WidgetDashboardUIProvider>\n\t\t\t\t\t{ children ?? (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<NoWidgetsState />\n\t\t\t\t\t\t\t<Actions />\n\t\t\t\t\t\t\t<Widgets />\n\t\t\t\t\t\t\t<Commands />\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\n\t\t\t\t\t<WidgetInserter />\n\t\t\t\t\t<LayoutSettings />\n\t\t\t\t\t<WidgetSettings />\n\t\t\t\t\t<ResetConfirmation />\n\t\t\t\t</WidgetDashboardUIProvider>\n\t\t\t</WidgetDashboardProvider>\n\t\t);\n\t},\n\t{ Actions, Widgets, WidgetChrome, NoWidgetsState, Commands }\n);\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,+BAAwC;AACxC,wBAA0C;AAC1C,qBAAwB;AACxB,sBAAyB;AACzB,6BAA+B;AAC/B,8BAA+B;AAC/B,gCAAkC;AAClC,2BAA6B;AAC7B,6BAA+B;AAC/B,6BAA+B;AAC/B,qBAAwB;AAuElB;AA7BC,IAAM,kBAAkB,OAAO;AAAA,EACrC,SAASA,iBAAiB;AAAA,IACzB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD,GAA0B;AACzB,WACC;AAAA,MAAC;AAAA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QAEA,uDAAC,+CACE;AAAA,sBACD,4EACC;AAAA,wDAAC,0CAAe;AAAA,YAChB,4CAAC,0BAAQ;AAAA,YACT,4CAAC,0BAAQ;AAAA,YACT,4CAAC,4BAAS;AAAA,aACX;AAAA,UAGD,4CAAC,yCAAe;AAAA,UAChB,4CAAC,yCAAe;AAAA,UAChB,4CAAC,yCAAe;AAAA,UAChB,4CAAC,+CAAkB;AAAA,WACpB;AAAA;AAAA,IACD;AAAA,EAEF;AAAA,EACA,EAAE,iCAAS,iCAAS,iDAAc,wDAAgB,mCAAS;AAC5D;",
4
+ "sourcesContent": ["/**\n * Internal dependencies\n */\nimport { WidgetDashboardProvider } from './context/dashboard-context';\nimport { WidgetDashboardUIProvider } from './context/ui-context';\nimport { Actions } from './components/actions';\nimport { Commands } from './components/commands';\nimport { NoWidgetsState } from './components/no-widgets-state';\nimport { ResetConfirmation } from './components/reset-confirmation';\nimport { WidgetChrome } from './components/widget-chrome';\nimport { WidgetInserter } from './components/widget-inserter';\nimport { WidgetSettings } from './components/widget-settings';\nimport { Widgets } from './components/widgets';\nimport type { WidgetDashboardProps } from './types';\n\n/**\n * Stateless rendering engine for widget dashboards.\n *\n * The consumer owns `layout` and `editMode` state; every mutation fires\n * `onLayoutChange` with the fully updated array. The engine never queries a\n * widget store; types flow in via the `widgetTypes` prop.\n *\n * ```tsx\n * import { WidgetDashboard } from '@wordpress/widget-dashboard';\n *\n * function MyDashboard() {\n * \tconst [ layout, setLayout ] = useState( defaultLayout );\n * \tconst [ editMode, setEditMode ] = useState( false );\n * \treturn (\n * \t\t<WidgetDashboard\n * \t\t\tlayout={ layout }\n * \t\t\tonLayoutChange={ setLayout }\n * \t\t\twidgetTypes={ widgetTypes }\n * \t\t\teditMode={ editMode }\n * \t\t\tonEditChange={ setEditMode }\n * \t\t>\n * \t\t\t<WidgetDashboard.NoWidgetsState>\n * \t\t\t\t<p>No widgets yet.</p>\n * \t\t\t</WidgetDashboard.NoWidgetsState>\n * \t\t\t<WidgetDashboard.Actions />\n * \t\t\t<WidgetDashboard.Widgets />\n * \t\t\t<WidgetDashboard.Commands />\n * \t\t</WidgetDashboard>\n * \t);\n * }\n * ```\n *\n * Children compose the dashboard's triggers and chrome: `Actions`,\n * `Widgets`, `Commands`, `NoWidgetsState`. The targets they open (the\n * widget inserter, the widget settings editor, the reset confirmation) are\n * mounted by the engine and driven by shared UI state, so a trigger works\n * wherever it is composed without a matching target in the tree. Omitting\n * `children` renders the default arrangement.\n */\nexport const WidgetDashboard = Object.assign(\n\tfunction WidgetDashboard( {\n\t\tlayout,\n\t\tonLayoutChange,\n\t\tonLayoutReset,\n\t\twidgetTypes,\n\t\tisResolvingWidgetTypes,\n\t\teditMode,\n\t\tonEditChange,\n\t\tresolveWidgetModule,\n\t\tgridSettings,\n\t\tchildren,\n\t}: WidgetDashboardProps ) {\n\t\treturn (\n\t\t\t<WidgetDashboardProvider\n\t\t\t\tlayout={ layout }\n\t\t\t\tonLayoutChange={ onLayoutChange }\n\t\t\t\tonLayoutReset={ onLayoutReset }\n\t\t\t\twidgetTypes={ widgetTypes }\n\t\t\t\tisResolvingWidgetTypes={ isResolvingWidgetTypes }\n\t\t\t\teditMode={ editMode }\n\t\t\t\tonEditChange={ onEditChange }\n\t\t\t\tresolveWidgetModule={ resolveWidgetModule }\n\t\t\t\tgridSettings={ gridSettings }\n\t\t\t>\n\t\t\t\t<WidgetDashboardUIProvider>\n\t\t\t\t\t{ children ?? (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<NoWidgetsState />\n\t\t\t\t\t\t\t<Actions />\n\t\t\t\t\t\t\t<Widgets />\n\t\t\t\t\t\t\t<Commands />\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\n\t\t\t\t\t<WidgetInserter />\n\t\t\t\t\t<WidgetSettings />\n\t\t\t\t\t<ResetConfirmation />\n\t\t\t\t</WidgetDashboardUIProvider>\n\t\t\t</WidgetDashboardProvider>\n\t\t);\n\t},\n\t{ Actions, Widgets, WidgetChrome, NoWidgetsState, Commands }\n);\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,+BAAwC;AACxC,wBAA0C;AAC1C,qBAAwB;AACxB,sBAAyB;AACzB,8BAA+B;AAC/B,gCAAkC;AAClC,2BAA6B;AAC7B,6BAA+B;AAC/B,6BAA+B;AAC/B,qBAAwB;AAqElB;AA3BC,IAAM,kBAAkB,OAAO;AAAA,EACrC,SAASA,iBAAiB;AAAA,IACzB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD,GAA0B;AACzB,WACC;AAAA,MAAC;AAAA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QAEA,uDAAC,+CACE;AAAA,sBACD,4EACC;AAAA,wDAAC,0CAAe;AAAA,YAChB,4CAAC,0BAAQ;AAAA,YACT,4CAAC,0BAAQ;AAAA,YACT,4CAAC,4BAAS;AAAA,aACX;AAAA,UAGD,4CAAC,yCAAe;AAAA,UAChB,4CAAC,yCAAe;AAAA,UAChB,4CAAC,+CAAkB;AAAA,WACpB;AAAA;AAAA,IACD;AAAA,EAEF;AAAA,EACA,EAAE,iCAAS,iCAAS,iDAAc,wDAAgB,mCAAS;AAC5D;",
6
6
  "names": ["WidgetDashboard"]
7
7
  }
@@ -2,7 +2,7 @@
2
2
  import { useSelect } from "@wordpress/data";
3
3
  import { useCallback, useEffect, useState } from "@wordpress/element";
4
4
  import { __ } from "@wordpress/i18n";
5
- import { layout as layoutIcon, plus } from "@wordpress/icons";
5
+ import { plus } from "@wordpress/icons";
6
6
  import { store as viewportStore } from "@wordpress/viewport";
7
7
  import { Button, Stack } from "@wordpress/ui";
8
8
  import { useDashboardInternalContext } from "../../context/dashboard-context.mjs";
@@ -106,8 +106,7 @@ function Actions() {
106
106
  onLayoutReset,
107
107
  commit,
108
108
  cancel: cancelStaging,
109
- hasUncommittedChanges,
110
- canEditGridSettings
109
+ hasUncommittedChanges
111
110
  } = useDashboardInternalContext();
112
111
  const [isEditActionsMounted, setIsEditActionsMounted] = useState(editMode);
113
112
  const [isExitingEditActions, setIsExitingEditActions] = useState(false);
@@ -127,7 +126,7 @@ function Actions() {
127
126
  }, 220);
128
127
  return () => clearTimeout(exitTimeout);
129
128
  }, [editMode, isEditActionsMounted]);
130
- const { setInserterOpen, setLayoutSettingsOpen, setResetDialogOpen } = useDashboardUIContext();
129
+ const { setInserterOpen, setResetDialogOpen } = useDashboardUIContext();
131
130
  const isMobileViewport = useSelect(
132
131
  (select) => select(viewportStore).isViewportMatch("< small"),
133
132
  []
@@ -144,9 +143,6 @@ function Actions() {
144
143
  const done = useCallback(() => {
145
144
  commit();
146
145
  }, [commit]);
147
- const openLayoutSettings = useCallback(() => {
148
- setLayoutSettingsOpen(true);
149
- }, [setLayoutSettingsOpen]);
150
146
  const menuItems = [
151
147
  {
152
148
  label: __("Reset to default"),
@@ -178,19 +174,6 @@ function Actions() {
178
174
  ]
179
175
  }
180
176
  ),
181
- canEditGridSettings && /* @__PURE__ */ jsxs(
182
- Button,
183
- {
184
- variant: "minimal",
185
- tone: "brand",
186
- size: "compact",
187
- onClick: openLayoutSettings,
188
- children: [
189
- !isMobileViewport && /* @__PURE__ */ jsx(Button.Icon, { icon: layoutIcon }),
190
- __("Layout settings")
191
- ]
192
- }
193
- ),
194
177
  /* @__PURE__ */ jsx(
195
178
  "div",
196
179
  {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/actions/actions.tsx", "../../../../style-runtime/src/index.ts", "../../../src/components/actions/actions.module.css"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { useCallback, useEffect, useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { layout as layoutIcon, plus } from '@wordpress/icons';\nimport { store as viewportStore } from '@wordpress/viewport';\n// eslint-disable-next-line @wordpress/use-recommended-components\nimport { Button, Stack } from '@wordpress/ui';\n\n/**\n * Internal dependencies\n */\nimport { useDashboardInternalContext } from '../../context/dashboard-context';\nimport { useDashboardUIContext } from '../../context/ui-context';\nimport { ActionsMenu } from '../actions-menu';\nimport type { ActionsMenuItem } from '../actions-menu';\nimport styles from './actions.module.css';\n\n/**\n * Edit toolbar for the dashboard. In customize mode it surfaces Add widget,\n * Layout settings (when grid settings are editable), Cancel, and Done;\n * otherwise a single Customize button. Buttons and the overflow menu are\n * triggers that flip the shared UI state the overlays react to.\n *\n * Returns `null` when mounted without `onEditChange`, so hosts that don't\n * expose edit mode can keep `Actions` in their tree unconditionally.\n */\nexport function Actions(): React.ReactNode {\n\tconst {\n\t\teditMode,\n\t\tonEditChange,\n\t\tonLayoutReset,\n\t\tcommit,\n\t\tcancel: cancelStaging,\n\t\thasUncommittedChanges,\n\t\tcanEditGridSettings,\n\t} = useDashboardInternalContext();\n\n\tconst [ isEditActionsMounted, setIsEditActionsMounted ] =\n\t\tuseState( editMode );\n\tconst [ isExitingEditActions, setIsExitingEditActions ] = useState( false );\n\n\tuseEffect( () => {\n\t\tif ( editMode ) {\n\t\t\tsetIsEditActionsMounted( true );\n\t\t\tsetIsExitingEditActions( false );\n\t\t\treturn;\n\t\t}\n\n\t\tif ( ! isEditActionsMounted ) {\n\t\t\treturn;\n\t\t}\n\n\t\tsetIsExitingEditActions( true );\n\t\tconst exitTimeout = setTimeout( () => {\n\t\t\tsetIsEditActionsMounted( false );\n\t\t\tsetIsExitingEditActions( false );\n\t\t}, 220 );\n\n\t\treturn () => clearTimeout( exitTimeout );\n\t}, [ editMode, isEditActionsMounted ] );\n\n\tconst { setInserterOpen, setLayoutSettingsOpen, setResetDialogOpen } =\n\t\tuseDashboardUIContext();\n\t// @TODO: switch to using Admin UI declaratively for mobile viewport support once available.\n\t// https://github.com/WordPress/gutenberg/issues/77628\n\tconst isMobileViewport = useSelect(\n\t\t( select ) => select( viewportStore ).isViewportMatch( '< small' ),\n\t\t[]\n\t);\n\n\tconst handleEditMode = useCallback( () => {\n\t\tonEditChange?.( ! editMode );\n\t}, [ editMode, onEditChange ] );\n\n\tconst insert = useCallback( () => {\n\t\tsetInserterOpen( true );\n\t}, [ setInserterOpen ] );\n\n\tconst cancel = useCallback( () => {\n\t\tcancelStaging();\n\t}, [ cancelStaging ] );\n\n\tconst done = useCallback( () => {\n\t\tcommit();\n\t}, [ commit ] );\n\n\tconst openLayoutSettings = useCallback( () => {\n\t\tsetLayoutSettingsOpen( true );\n\t}, [ setLayoutSettingsOpen ] );\n\n\tconst menuItems: ActionsMenuItem[] = [\n\t\t{\n\t\t\tlabel: __( 'Reset to default' ),\n\t\t\tonClick: () => setResetDialogOpen( true ),\n\t\t\tdisabled: ! onLayoutReset,\n\t\t},\n\t];\n\n\tif ( ! onEditChange ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Stack direction=\"row\" gap=\"sm\">\n\t\t\t{ isEditActionsMounted ? (\n\t\t\t\t<Stack\n\t\t\t\t\tdirection=\"row\"\n\t\t\t\t\tgap=\"sm\"\n\t\t\t\t\tclassName={\n\t\t\t\t\t\tisExitingEditActions\n\t\t\t\t\t\t\t? styles.editActionsExit\n\t\t\t\t\t\t\t: styles.editActionsEnter\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"minimal\"\n\t\t\t\t\t\ttone=\"brand\"\n\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\tonClick={ insert }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ ! isMobileViewport && <Button.Icon icon={ plus } /> }\n\t\t\t\t\t\t{ __( 'Add widget' ) }\n\t\t\t\t\t</Button>\n\n\t\t\t\t\t{ canEditGridSettings && (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"minimal\"\n\t\t\t\t\t\t\ttone=\"brand\"\n\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t\tonClick={ openLayoutSettings }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ ! isMobileViewport && (\n\t\t\t\t\t\t\t\t<Button.Icon icon={ layoutIcon } />\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t{ __( 'Layout settings' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t) }\n\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName={ styles.editActionsDivider }\n\t\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\t/>\n\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"minimal\"\n\t\t\t\t\t\ttone=\"brand\"\n\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\tonClick={ cancel }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t</Button>\n\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"solid\"\n\t\t\t\t\t\ttone=\"brand\"\n\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\tonClick={ done }\n\t\t\t\t\t\tdisabled={ ! hasUncommittedChanges }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Done' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</Stack>\n\t\t\t) : (\n\t\t\t\t<Button\n\t\t\t\t\tvariant=\"minimal\"\n\t\t\t\t\ttone=\"brand\"\n\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\tonClick={ handleEditMode }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Customize' ) }\n\t\t\t\t</Button>\n\t\t\t) }\n\n\t\t\t<ActionsMenu items={ menuItems } />\n\t\t</Stack>\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(\"207feb9ccc\", \"._273463df7651817f__editActionsEnter,._3cd6628039136a20__editActionsExit{align-items:center;display:inline-flex;gap:var(--wp--preset--spacing--20);transform-origin:right center}._572540719be6c8a3__editActionsDivider{align-self:center;background-color:var(--wpds-color-stroke-surface-neutral,#dbdbdb);flex-shrink:0;height:var(--wpds-dimension-size-2xs,16px);width:1px}@media not (prefers-reduced-motion){._273463df7651817f__editActionsEnter,._3cd6628039136a20__editActionsExit{will-change:opacity,transform}._273463df7651817f__editActionsEnter{animation:_332d3153b716aa20__actions-slide-in var(--wpds-motion-duration-md,.2s) var(--wpds-motion-easing-expressive,cubic-bezier(.25,0,0,1)) forwards}._3cd6628039136a20__editActionsExit{animation:_4dff70702a4b0f40__actions-fold-out var(--wpds-motion-duration-sm,.1s) var(--wpds-motion-easing-balanced,cubic-bezier(.4,0,.2,1)) forwards}@keyframes _332d3153b716aa20__actions-slide-in{0%{opacity:0;transform:translateX(12px) scaleX(.92)}to{opacity:1;transform:translateX(0) scaleX(1)}}@keyframes _4dff70702a4b0f40__actions-fold-out{0%{opacity:1;transform:translateX(0) scaleX(1)}to{opacity:0;transform:translateX(12px) scaleX(.92)}}}\");\n}\nexport default {\"editActionsEnter\":\"_273463df7651817f__editActionsEnter\",\"editActionsExit\":\"_3cd6628039136a20__editActionsExit\",\"editActionsDivider\":\"_572540719be6c8a3__editActionsDivider\",\"actions-slide-in\":\"_332d3153b716aa20__actions-slide-in\",\"actions-fold-out\":\"_4dff70702a4b0f40__actions-fold-out\"};\n"],
5
- "mappings": ";AAGA,SAAS,iBAAiB;AAC1B,SAAS,aAAa,WAAW,gBAAgB;AACj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AA,MAAC;AAAA;AAAA,QACA,WAAU;AAAA,QACV,KAAI;AAAA,QACJ,WACC,uBACG,gBAAO,kBACP,gBAAO;AAAA,QAGX;AAAA;AAAA,YAAC;AAAA;AAAA,cACA,SAAQ;AAAA,cACR,MAAK;AAAA,cACL,MAAK;AAAA,cACL,SAAU;AAAA,cAER;AAAA,iBAAE,oBAAoB,oBAAC,OAAO,MAAP,EAAY,MAAO,MAAO;AAAA,gBACjD,GAAI,YAAa;AAAA;AAAA;AAAA,UACpB;AAAA,UAEE,uBACD;AAAA,YAAC;AAAA;AAAA,cACA,SAAQ;AAAA,cACR,MAAK;AAAA,cACL,MAAK;AAAA,cACL,SAAU;AAAA,cAER;AAAA,iBAAE,oBACH,oBAAC,OAAO,MAAP,EAAY,MAAO,YAAa;AAAA,gBAEhC,GAAI,iBAAkB;AAAA;AAAA;AAAA,UACzB;AAAA,UAGD;AAAA,YAAC;AAAA;AAAA,cACA,WAAY,gBAAO;AAAA,cACnB,eAAY;AAAA;AAAA,UACb;AAAA,UAEA;AAAA,YAAC;AAAA;AAAA,cACA,SAAQ;AAAA,cACR,MAAK;AAAA,cACL,MAAK;AAAA,cACL,SAAU;AAAA,cAER,aAAI,QAAS;AAAA;AAAA,UAChB;AAAA,UAEA;AAAA,YAAC;AAAA;AAAA,cACA,SAAQ;AAAA,cACR,MAAK;AAAA,cACL,MAAK;AAAA,cACL,SAAU;AAAA,cACV,UAAW,CAAE;AAAA,cAEX,aAAI,MAAO;AAAA;AAAA,UACd;AAAA;AAAA;AAAA,IACD,IAEA;AAAA,MAAC;AAAA;AAAA,QACA,SAAQ;AAAA,QACR,MAAK;AAAA,QACL,MAAK;AAAA,QACL,SAAU;AAAA,QAER,aAAI,WAAY;AAAA;AAAA,IACnB;AAAA,IAGD,oBAAC,eAAY,OAAQ,WAAY;AAAA,KAClC;AAEF;",
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { useCallback, useEffect, useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { plus } from '@wordpress/icons';\nimport { store as viewportStore } from '@wordpress/viewport';\n// eslint-disable-next-line @wordpress/use-recommended-components\nimport { Button, Stack } from '@wordpress/ui';\n\n/**\n * Internal dependencies\n */\nimport { useDashboardInternalContext } from '../../context/dashboard-context';\nimport { useDashboardUIContext } from '../../context/ui-context';\nimport { ActionsMenu } from '../actions-menu';\nimport type { ActionsMenuItem } from '../actions-menu';\nimport styles from './actions.module.css';\n\n/**\n * Edit toolbar for the dashboard. In customize mode it surfaces Add widget,\n * Layout settings (when grid settings are editable), Cancel, and Done;\n * otherwise a single Customize button. Buttons and the overflow menu are\n * triggers that flip the shared UI state the overlays react to.\n *\n * Returns `null` when mounted without `onEditChange`, so hosts that don't\n * expose edit mode can keep `Actions` in their tree unconditionally.\n */\nexport function Actions(): React.ReactNode {\n\tconst {\n\t\teditMode,\n\t\tonEditChange,\n\t\tonLayoutReset,\n\t\tcommit,\n\t\tcancel: cancelStaging,\n\t\thasUncommittedChanges,\n\t} = useDashboardInternalContext();\n\n\tconst [ isEditActionsMounted, setIsEditActionsMounted ] =\n\t\tuseState( editMode );\n\tconst [ isExitingEditActions, setIsExitingEditActions ] = useState( false );\n\n\tuseEffect( () => {\n\t\tif ( editMode ) {\n\t\t\tsetIsEditActionsMounted( true );\n\t\t\tsetIsExitingEditActions( false );\n\t\t\treturn;\n\t\t}\n\n\t\tif ( ! isEditActionsMounted ) {\n\t\t\treturn;\n\t\t}\n\n\t\tsetIsExitingEditActions( true );\n\t\tconst exitTimeout = setTimeout( () => {\n\t\t\tsetIsEditActionsMounted( false );\n\t\t\tsetIsExitingEditActions( false );\n\t\t}, 220 );\n\n\t\treturn () => clearTimeout( exitTimeout );\n\t}, [ editMode, isEditActionsMounted ] );\n\n\tconst { setInserterOpen, setResetDialogOpen } = useDashboardUIContext();\n\t// @TODO: switch to using Admin UI declaratively for mobile viewport support once available.\n\t// https://github.com/WordPress/gutenberg/issues/77628\n\tconst isMobileViewport = useSelect(\n\t\t( select ) => select( viewportStore ).isViewportMatch( '< small' ),\n\t\t[]\n\t);\n\n\tconst handleEditMode = useCallback( () => {\n\t\tonEditChange?.( ! editMode );\n\t}, [ editMode, onEditChange ] );\n\n\tconst insert = useCallback( () => {\n\t\tsetInserterOpen( true );\n\t}, [ setInserterOpen ] );\n\n\tconst cancel = useCallback( () => {\n\t\tcancelStaging();\n\t}, [ cancelStaging ] );\n\n\tconst done = useCallback( () => {\n\t\tcommit();\n\t}, [ commit ] );\n\n\tconst menuItems: ActionsMenuItem[] = [\n\t\t{\n\t\t\tlabel: __( 'Reset to default' ),\n\t\t\tonClick: () => setResetDialogOpen( true ),\n\t\t\tdisabled: ! onLayoutReset,\n\t\t},\n\t];\n\n\tif ( ! onEditChange ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Stack direction=\"row\" gap=\"sm\">\n\t\t\t{ isEditActionsMounted ? (\n\t\t\t\t<Stack\n\t\t\t\t\tdirection=\"row\"\n\t\t\t\t\tgap=\"sm\"\n\t\t\t\t\tclassName={\n\t\t\t\t\t\tisExitingEditActions\n\t\t\t\t\t\t\t? styles.editActionsExit\n\t\t\t\t\t\t\t: styles.editActionsEnter\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"minimal\"\n\t\t\t\t\t\ttone=\"brand\"\n\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\tonClick={ insert }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ ! isMobileViewport && <Button.Icon icon={ plus } /> }\n\t\t\t\t\t\t{ __( 'Add widget' ) }\n\t\t\t\t\t</Button>\n\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName={ styles.editActionsDivider }\n\t\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\t/>\n\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"minimal\"\n\t\t\t\t\t\ttone=\"brand\"\n\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\tonClick={ cancel }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t</Button>\n\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"solid\"\n\t\t\t\t\t\ttone=\"brand\"\n\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\tonClick={ done }\n\t\t\t\t\t\tdisabled={ ! hasUncommittedChanges }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Done' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</Stack>\n\t\t\t) : (\n\t\t\t\t<Button\n\t\t\t\t\tvariant=\"minimal\"\n\t\t\t\t\ttone=\"brand\"\n\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\tonClick={ handleEditMode }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Customize' ) }\n\t\t\t\t</Button>\n\t\t\t) }\n\n\t\t\t<ActionsMenu items={ menuItems } />\n\t\t</Stack>\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(\"207feb9ccc\", \"._273463df7651817f__editActionsEnter,._3cd6628039136a20__editActionsExit{align-items:center;display:inline-flex;gap:var(--wp--preset--spacing--20);transform-origin:right center}._572540719be6c8a3__editActionsDivider{align-self:center;background-color:var(--wpds-color-stroke-surface-neutral,#dbdbdb);flex-shrink:0;height:var(--wpds-dimension-size-2xs,16px);width:1px}@media not (prefers-reduced-motion){._273463df7651817f__editActionsEnter,._3cd6628039136a20__editActionsExit{will-change:opacity,transform}._273463df7651817f__editActionsEnter{animation:_332d3153b716aa20__actions-slide-in var(--wpds-motion-duration-md,.2s) var(--wpds-motion-easing-expressive,cubic-bezier(.25,0,0,1)) forwards}._3cd6628039136a20__editActionsExit{animation:_4dff70702a4b0f40__actions-fold-out var(--wpds-motion-duration-sm,.1s) var(--wpds-motion-easing-balanced,cubic-bezier(.4,0,.2,1)) forwards}@keyframes _332d3153b716aa20__actions-slide-in{0%{opacity:0;transform:translateX(12px) scaleX(.92)}to{opacity:1;transform:translateX(0) scaleX(1)}}@keyframes _4dff70702a4b0f40__actions-fold-out{0%{opacity:1;transform:translateX(0) scaleX(1)}to{opacity:0;transform:translateX(12px) scaleX(.92)}}}\");\n}\nexport default {\"editActionsEnter\":\"_273463df7651817f__editActionsEnter\",\"editActionsExit\":\"_3cd6628039136a20__editActionsExit\",\"editActionsDivider\":\"_572540719be6c8a3__editActionsDivider\",\"actions-slide-in\":\"_332d3153b716aa20__actions-slide-in\",\"actions-fold-out\":\"_4dff70702a4b0f40__actions-fold-out\"};\n"],
5
+ "mappings": ";AAGA,SAAS,iBAAiB;AAC1B,SAAS,aAAa,WAAW,gBAAgB;AACjD,SAAS,UAAU;AACnB,SAAS,YAAY;AACrB,SAAS,SAAS,qBAAqB;AAEvC,SAAS,QAAQ,aAAa;AAK9B,SAAS,mCAAmC;AAC5C,SAAS,6BAA6B;AACtC,SAAS,mBAAmB;;;ACN5B,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;A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;AAAA;AAAA,UACd;AAAA;AAAA;AAAA,IACD,IAEA;AAAA,MAAC;AAAA;AAAA,QACA,SAAQ;AAAA,QACR,MAAK;AAAA,QACL,MAAK;AAAA,QACL,SAAU;AAAA,QAER,aAAI,WAAY;AAAA;AAAA,IACnB;AAAA,IAGD,oBAAC,eAAY,OAAQ,WAAY;AAAA,KAClC;AAEF;",
6
6
  "names": []
7
7
  }
@@ -5,52 +5,21 @@ import {
5
5
  useCommands,
6
6
  privateApis as commandsPrivateApis
7
7
  } from "@wordpress/commands";
8
- import {
9
- columns,
10
- grid,
11
- layout as layoutIcon,
12
- plus,
13
- trash
14
- } from "@wordpress/icons";
8
+ import { layout as layoutIcon, plus, trash } from "@wordpress/icons";
15
9
  import { unlock } from "../../lock-unlock.mjs";
16
10
  import { useDashboardInternalContext } from "../../context/dashboard-context.mjs";
17
11
  import { useDashboardUIContext } from "../../context/ui-context.mjs";
18
- import { getGridModel } from "../../utils/grid-model-change/index.mjs";
19
12
  import { usePendingWhenEditMode } from "./use-pending-when-edit-mode.mjs";
20
13
  var { useCommandContext } = unlock(commandsPrivateApis);
21
14
  var DASHBOARD_COMMAND_CONTEXT = "dashboard";
22
15
  function Commands() {
23
- const {
24
- editMode,
25
- onEditChange,
26
- onLayoutReset,
27
- gridSettings,
28
- canEditGridSettings,
29
- commitGridModelChange
30
- } = useDashboardInternalContext();
16
+ const { editMode, onEditChange, onLayoutReset } = useDashboardInternalContext();
31
17
  const { setInserterOpen, setResetDialogOpen } = useDashboardUIContext();
32
18
  useCommandContext(DASHBOARD_COMMAND_CONTEXT);
33
19
  const runWhenInEditMode = usePendingWhenEditMode({
34
20
  editMode,
35
21
  onEditChange
36
22
  });
37
- const gridModel = getGridModel(gridSettings);
38
- const isGridLayout = gridModel === "grid";
39
- const isMasonryLayout = gridModel === "masonry";
40
- const switchToMasonry = useCallback(
41
- ({ close }) => {
42
- close();
43
- commitGridModelChange("masonry");
44
- },
45
- [commitGridModelChange]
46
- );
47
- const switchToGrid = useCallback(
48
- ({ close }) => {
49
- close();
50
- commitGridModelChange("grid");
51
- },
52
- [commitGridModelChange]
53
- );
54
23
  const resetToDefault = useCallback(
55
24
  ({ close }) => {
56
25
  close();
@@ -96,35 +65,6 @@ function Commands() {
96
65
  disabled: !onEditChange,
97
66
  callback: addWidgets
98
67
  },
99
- {
100
- name: "core/dashboard/switch-to-masonry-layout",
101
- label: __("Switch dashboard to masonry layout"),
102
- icon: columns,
103
- category: "command",
104
- context: DASHBOARD_COMMAND_CONTEXT,
105
- keywords: [
106
- __("layout"),
107
- __("layout model"),
108
- __("masonry")
109
- ],
110
- disabled: !canEditGridSettings || isMasonryLayout || editMode,
111
- callback: switchToMasonry
112
- },
113
- {
114
- name: "core/dashboard/switch-to-grid-layout",
115
- label: __("Switch dashboard to grid layout"),
116
- icon: grid,
117
- category: "command",
118
- context: DASHBOARD_COMMAND_CONTEXT,
119
- keywords: [
120
- __("layout"),
121
- __("layout model"),
122
- __("grid"),
123
- __("standard grid")
124
- ],
125
- disabled: !canEditGridSettings || isGridLayout || editMode,
126
- callback: switchToGrid
127
- },
128
68
  {
129
69
  name: "core/dashboard/reset-to-default",
130
70
  label: __("Reset dashboard widgets to default"),
@@ -141,11 +81,6 @@ function Commands() {
141
81
  editMode,
142
82
  customize,
143
83
  addWidgets,
144
- canEditGridSettings,
145
- isMasonryLayout,
146
- isGridLayout,
147
- switchToMasonry,
148
- switchToGrid,
149
84
  onLayoutReset,
150
85
  resetToDefault
151
86
  ]
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/commands/commands.tsx"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useCallback, useMemo } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tuseCommands,\n\tprivateApis as commandsPrivateApis,\n} from '@wordpress/commands';\nimport {\n\tcolumns,\n\tgrid,\n\tlayout as layoutIcon,\n\tplus,\n\ttrash,\n} from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { useDashboardInternalContext } from '../../context/dashboard-context';\nimport { useDashboardUIContext } from '../../context/ui-context';\nimport { getGridModel } from '../../utils/grid-model-change';\nimport { usePendingWhenEditMode } from './use-pending-when-edit-mode';\n\nconst { useCommandContext } = unlock( commandsPrivateApis );\n\nexport const DASHBOARD_COMMAND_CONTEXT = 'dashboard';\n\ntype CommandCallback = ( options: { close: () => void } ) => void;\n\n/**\n * Registers dashboard-specific command palette commands and sets the\n * active command context so they surface under Suggestions by default.\n */\nexport function Commands() {\n\tconst {\n\t\teditMode,\n\t\tonEditChange,\n\t\tonLayoutReset,\n\t\tgridSettings,\n\t\tcanEditGridSettings,\n\t\tcommitGridModelChange,\n\t} = useDashboardInternalContext();\n\n\tconst { setInserterOpen, setResetDialogOpen } = useDashboardUIContext();\n\n\tuseCommandContext( DASHBOARD_COMMAND_CONTEXT );\n\n\tconst runWhenInEditMode = usePendingWhenEditMode( {\n\t\teditMode,\n\t\tonEditChange,\n\t} );\n\n\tconst gridModel = getGridModel( gridSettings );\n\tconst isGridLayout = gridModel === 'grid';\n\tconst isMasonryLayout = gridModel === 'masonry';\n\n\tconst switchToMasonry = useCallback< CommandCallback >(\n\t\t( { close } ) => {\n\t\t\tclose();\n\t\t\tcommitGridModelChange( 'masonry' );\n\t\t},\n\t\t[ commitGridModelChange ]\n\t);\n\n\tconst switchToGrid = useCallback< CommandCallback >(\n\t\t( { close } ) => {\n\t\t\tclose();\n\t\t\tcommitGridModelChange( 'grid' );\n\t\t},\n\t\t[ commitGridModelChange ]\n\t);\n\n\tconst resetToDefault = useCallback< CommandCallback >(\n\t\t( { close } ) => {\n\t\t\tclose();\n\t\t\tsetResetDialogOpen( true );\n\t\t},\n\t\t[ setResetDialogOpen ]\n\t);\n\n\tconst addWidgets = useCallback< CommandCallback >(\n\t\t( { close } ) => {\n\t\t\tclose();\n\t\t\trunWhenInEditMode( () => {\n\t\t\t\tsetInserterOpen( true );\n\t\t\t} );\n\t\t},\n\t\t[ runWhenInEditMode, setInserterOpen ]\n\t);\n\n\tconst customize = useCallback< CommandCallback >(\n\t\t( { close } ) => {\n\t\t\tclose();\n\t\t\tonEditChange?.( true );\n\t\t},\n\t\t[ onEditChange ]\n\t);\n\n\tconst commands = useMemo(\n\t\t() => [\n\t\t\t{\n\t\t\t\tname: 'core/dashboard/customize',\n\t\t\t\tlabel: __( 'Customize dashboard' ),\n\t\t\t\ticon: layoutIcon,\n\t\t\t\tcategory: 'command',\n\t\t\t\tcontext: DASHBOARD_COMMAND_CONTEXT,\n\t\t\t\tkeywords: [ __( 'edit' ), __( 'widgets' ), __( 'layout' ) ],\n\t\t\t\tdisabled: ! onEditChange || editMode,\n\t\t\t\tcallback: customize,\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'core/dashboard/add-widgets',\n\t\t\t\tlabel: __( 'Add dashboard widgets' ),\n\t\t\t\ticon: plus,\n\t\t\t\tcategory: 'command',\n\t\t\t\tcontext: DASHBOARD_COMMAND_CONTEXT,\n\t\t\t\tkeywords: [ __( 'widgets' ), __( 'inserter' ) ],\n\t\t\t\tdisabled: ! onEditChange,\n\t\t\t\tcallback: addWidgets,\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'core/dashboard/switch-to-masonry-layout',\n\t\t\t\tlabel: __( 'Switch dashboard to masonry layout' ),\n\t\t\t\ticon: columns,\n\t\t\t\tcategory: 'command',\n\t\t\t\tcontext: DASHBOARD_COMMAND_CONTEXT,\n\t\t\t\tkeywords: [\n\t\t\t\t\t__( 'layout' ),\n\t\t\t\t\t__( 'layout model' ),\n\t\t\t\t\t__( 'masonry' ),\n\t\t\t\t],\n\t\t\t\tdisabled: ! canEditGridSettings || isMasonryLayout || editMode,\n\t\t\t\tcallback: switchToMasonry,\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'core/dashboard/switch-to-grid-layout',\n\t\t\t\tlabel: __( 'Switch dashboard to grid layout' ),\n\t\t\t\ticon: grid,\n\t\t\t\tcategory: 'command',\n\t\t\t\tcontext: DASHBOARD_COMMAND_CONTEXT,\n\t\t\t\tkeywords: [\n\t\t\t\t\t__( 'layout' ),\n\t\t\t\t\t__( 'layout model' ),\n\t\t\t\t\t__( 'grid' ),\n\t\t\t\t\t__( 'standard grid' ),\n\t\t\t\t],\n\t\t\t\tdisabled: ! canEditGridSettings || isGridLayout || editMode,\n\t\t\t\tcallback: switchToGrid,\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'core/dashboard/reset-to-default',\n\t\t\t\tlabel: __( 'Reset dashboard widgets to default' ),\n\t\t\t\ticon: trash,\n\t\t\t\tcategory: 'command',\n\t\t\t\tcontext: DASHBOARD_COMMAND_CONTEXT,\n\t\t\t\tkeywords: [ __( 'reset' ), __( 'default' ) ],\n\t\t\t\tdisabled: ! onLayoutReset,\n\t\t\t\tcallback: resetToDefault,\n\t\t\t},\n\t\t],\n\t\t[\n\t\t\tonEditChange,\n\t\t\teditMode,\n\t\t\tcustomize,\n\t\t\taddWidgets,\n\t\t\tcanEditGridSettings,\n\t\t\tisMasonryLayout,\n\t\t\tisGridLayout,\n\t\t\tswitchToMasonry,\n\t\t\tswitchToGrid,\n\t\t\tonLayoutReset,\n\t\t\tresetToDefault,\n\t\t]\n\t);\n\n\tuseCommands( commands );\n\n\treturn null;\n}\n"],
5
- "mappings": ";AAGA,SAAS,aAAa,eAAe;AACrC,SAAS,UAAU;AACnB;AAAA,EACC;AAAA,EACA,eAAe;AAAA,OACT;AACP;AAAA,EACC;AAAA,EACA;AAAA,EACA,UAAU;AAAA,EACV;AAAA,EACA;AAAA,OACM;AAKP,SAAS,cAAc;AACvB,SAAS,mCAAmC;AAC5C,SAAS,6BAA6B;AACtC,SAAS,oBAAoB;AAC7B,SAAS,8BAA8B;AAEvC,IAAM,EAAE,kBAAkB,IAAI,OAAQ,mBAAoB;AAEnD,IAAM,4BAA4B;AAQlC,SAAS,WAAW;AAC1B,QAAM;AAAA,IACL;AAA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AA,MACA;AAAA,MACA;AAAA,IACD;AAAA,EACD;AAEA,cAAa,QAAS;AAEtB,SAAO;AACR;",
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useCallback, useMemo } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tuseCommands,\n\tprivateApis as commandsPrivateApis,\n} from '@wordpress/commands';\nimport { layout as layoutIcon, plus, trash } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { useDashboardInternalContext } from '../../context/dashboard-context';\nimport { useDashboardUIContext } from '../../context/ui-context';\nimport { usePendingWhenEditMode } from './use-pending-when-edit-mode';\n\nconst { useCommandContext } = unlock( commandsPrivateApis );\n\nexport const DASHBOARD_COMMAND_CONTEXT = 'dashboard';\n\ntype CommandCallback = ( options: { close: () => void } ) => void;\n\n/**\n * Registers dashboard-specific command palette commands and sets the\n * active command context so they surface under Suggestions by default.\n */\nexport function Commands() {\n\tconst { editMode, onEditChange, onLayoutReset } =\n\t\tuseDashboardInternalContext();\n\n\tconst { setInserterOpen, setResetDialogOpen } = useDashboardUIContext();\n\n\tuseCommandContext( DASHBOARD_COMMAND_CONTEXT );\n\n\tconst runWhenInEditMode = usePendingWhenEditMode( {\n\t\teditMode,\n\t\tonEditChange,\n\t} );\n\n\tconst resetToDefault = useCallback< CommandCallback >(\n\t\t( { close } ) => {\n\t\t\tclose();\n\t\t\tsetResetDialogOpen( true );\n\t\t},\n\t\t[ setResetDialogOpen ]\n\t);\n\n\tconst addWidgets = useCallback< CommandCallback >(\n\t\t( { close } ) => {\n\t\t\tclose();\n\t\t\trunWhenInEditMode( () => {\n\t\t\t\tsetInserterOpen( true );\n\t\t\t} );\n\t\t},\n\t\t[ runWhenInEditMode, setInserterOpen ]\n\t);\n\n\tconst customize = useCallback< CommandCallback >(\n\t\t( { close } ) => {\n\t\t\tclose();\n\t\t\tonEditChange?.( true );\n\t\t},\n\t\t[ onEditChange ]\n\t);\n\n\tconst commands = useMemo(\n\t\t() => [\n\t\t\t{\n\t\t\t\tname: 'core/dashboard/customize',\n\t\t\t\tlabel: __( 'Customize dashboard' ),\n\t\t\t\ticon: layoutIcon,\n\t\t\t\tcategory: 'command',\n\t\t\t\tcontext: DASHBOARD_COMMAND_CONTEXT,\n\t\t\t\tkeywords: [ __( 'edit' ), __( 'widgets' ), __( 'layout' ) ],\n\t\t\t\tdisabled: ! onEditChange || editMode,\n\t\t\t\tcallback: customize,\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'core/dashboard/add-widgets',\n\t\t\t\tlabel: __( 'Add dashboard widgets' ),\n\t\t\t\ticon: plus,\n\t\t\t\tcategory: 'command',\n\t\t\t\tcontext: DASHBOARD_COMMAND_CONTEXT,\n\t\t\t\tkeywords: [ __( 'widgets' ), __( 'inserter' ) ],\n\t\t\t\tdisabled: ! onEditChange,\n\t\t\t\tcallback: addWidgets,\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'core/dashboard/reset-to-default',\n\t\t\t\tlabel: __( 'Reset dashboard widgets to default' ),\n\t\t\t\ticon: trash,\n\t\t\t\tcategory: 'command',\n\t\t\t\tcontext: DASHBOARD_COMMAND_CONTEXT,\n\t\t\t\tkeywords: [ __( 'reset' ), __( 'default' ) ],\n\t\t\t\tdisabled: ! onLayoutReset,\n\t\t\t\tcallback: resetToDefault,\n\t\t\t},\n\t\t],\n\t\t[\n\t\t\tonEditChange,\n\t\t\teditMode,\n\t\t\tcustomize,\n\t\t\taddWidgets,\n\t\t\tonLayoutReset,\n\t\t\tresetToDefault,\n\t\t]\n\t);\n\n\tuseCommands( commands );\n\n\treturn null;\n}\n"],
5
+ "mappings": ";AAGA,SAAS,aAAa,eAAe;AACrC,SAAS,UAAU;AACnB;AAAA,EACC;AAAA,EACA,eAAe;AAAA,OACT;AACP,SAAS,UAAU,YAAY,MAAM,aAAa;AAKlD,SAAS,cAAc;AACvB,SAAS,mCAAmC;AAC5C,SAAS,6BAA6B;AACtC,SAA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AAA,QACZ,UAAU;AAAA,MACX;AAAA,MACA;AAAA,QACC,MAAM;AAAA,QACN,OAAO,GAAI,oCAAqC;AAAA,QAChD,MAAM;AAAA,QACN,UAAU;AAAA,QACV,SAAS;AAAA,QACT,UAAU,CAAE,GAAI,OAAQ,GAAG,GAAI,SAAU,CAAE;AAAA,QAC3C,UAAU,CAAE;AAAA,QACZ,UAAU;AAAA,MACX;AAAA,IACD;AAAA,IACA;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACD;AAAA,EACD;AAEA,cAAa,QAAS;AAEtB,SAAO;AACR;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,6 @@
1
+ // packages/widget-dashboard/src/components/widget-attribute-controls/index.ts
2
+ import { WidgetAttributeControls } from "./widget-attribute-controls.mjs";
3
+ export {
4
+ WidgetAttributeControls
5
+ };
6
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/widget-attribute-controls/index.ts"],
4
+ "sourcesContent": ["export { WidgetAttributeControls } from './widget-attribute-controls';\n"],
5
+ "mappings": ";AAAA,SAAS,+BAA+B;",
6
+ "names": []
7
+ }
@@ -0,0 +1,68 @@
1
+ // packages/widget-dashboard/src/components/widget-attribute-controls/widget-attribute-controls.tsx
2
+ import { DataForm } from "@wordpress/dataviews";
3
+ import { useCallback, useMemo } from "@wordpress/element";
4
+ import { useDashboardInternalContext } from "../../context/dashboard-context.mjs";
5
+ import { WidgetSettingsTrigger } from "../widget-settings/index.mjs";
6
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
7
+ function WidgetAttributeControls({
8
+ widget,
9
+ widgetType
10
+ }) {
11
+ const { layout, onLayoutChange, scheduleAutoSave } = useDashboardInternalContext();
12
+ const fields = useMemo(
13
+ () => (widgetType.attributes ?? []).filter(
14
+ (attribute) => attribute.relevance === "high"
15
+ ),
16
+ [widgetType.attributes]
17
+ );
18
+ const form = useMemo(
19
+ () => ({
20
+ layout: { type: "row", alignment: "center" },
21
+ fields: fields.map((field) => ({
22
+ id: field.id,
23
+ layout: { type: "regular", labelPosition: "none" }
24
+ }))
25
+ }),
26
+ [fields]
27
+ );
28
+ const handleChange = useCallback(
29
+ (edits) => {
30
+ onLayoutChange(
31
+ layout.map(
32
+ (instance) => instance.uuid === widget.uuid ? {
33
+ ...instance,
34
+ attributes: {
35
+ ...instance.attributes,
36
+ ...edits
37
+ }
38
+ } : instance
39
+ )
40
+ );
41
+ scheduleAutoSave();
42
+ },
43
+ [layout, onLayoutChange, widget.uuid, scheduleAutoSave]
44
+ );
45
+ const data = widget.attributes ?? widgetType.example?.attributes ?? {};
46
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
47
+ fields.length > 0 && /* @__PURE__ */ jsx(
48
+ DataForm,
49
+ {
50
+ data,
51
+ fields,
52
+ form,
53
+ onChange: handleChange
54
+ }
55
+ ),
56
+ /* @__PURE__ */ jsx(
57
+ WidgetSettingsTrigger,
58
+ {
59
+ widget,
60
+ widgetType
61
+ }
62
+ )
63
+ ] });
64
+ }
65
+ export {
66
+ WidgetAttributeControls
67
+ };
68
+ //# sourceMappingURL=widget-attribute-controls.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/widget-attribute-controls/widget-attribute-controls.tsx"],
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { DataForm } from '@wordpress/dataviews';\nimport type { Field, Form } from '@wordpress/dataviews';\nimport { useCallback, useMemo } from '@wordpress/element';\nimport type { WidgetType } from '@wordpress/widget-primitives';\n\n/**\n * Internal dependencies\n */\nimport { useDashboardInternalContext } from '../../context/dashboard-context';\nimport { WidgetSettingsTrigger } from '../widget-settings';\nimport type { DashboardWidget } from '../../types';\n\ntype WidgetAttributes = Record< string, unknown >;\n\ntype WidgetAttributeControlsProps = {\n\t/**\n\t * The instance whose attributes these controls edit.\n\t */\n\twidget: DashboardWidget< unknown >;\n\n\t/**\n\t * The instance's widget type, source of the attribute schema.\n\t */\n\twidgetType: WidgetType;\n};\n\n/**\n * Normal-mode controls: the `relevance: 'high'` attributes inline, plus the\n * settings trigger that opens the full settings drawer when needed. Inline\n * controls appear only for the high-relevance fields; edits stage live and\n * auto-save on the dashboard's shared debounce.\n *\n * @param {WidgetAttributeControlsProps} props Component props.\n */\nexport function WidgetAttributeControls( {\n\twidget,\n\twidgetType,\n}: WidgetAttributeControlsProps ): React.ReactNode {\n\tconst { layout, onLayoutChange, scheduleAutoSave } =\n\t\tuseDashboardInternalContext();\n\n\tconst fields = useMemo< Field< WidgetAttributes >[] >(\n\t\t() =>\n\t\t\t( widgetType.attributes ?? [] ).filter(\n\t\t\t\t( attribute ) => attribute.relevance === 'high'\n\t\t\t) as Field< WidgetAttributes >[],\n\t\t[ widgetType.attributes ]\n\t);\n\n\t// A `row` top-level layout lays the controls out horizontally; each field\n\t// carries `labelPosition: 'none'` so the control renders bare.\n\tconst form = useMemo< Form >(\n\t\t() => ( {\n\t\t\tlayout: { type: 'row', alignment: 'center' },\n\t\t\tfields: fields.map( ( field ) => ( {\n\t\t\t\tid: field.id,\n\t\t\t\tlayout: { type: 'regular', labelPosition: 'none' },\n\t\t\t} ) ),\n\t\t} ),\n\t\t[ fields ]\n\t);\n\n\tconst handleChange = useCallback(\n\t\t( edits: Record< string, unknown > ) => {\n\t\t\tonLayoutChange(\n\t\t\t\tlayout.map( ( instance ) =>\n\t\t\t\t\tinstance.uuid === widget.uuid\n\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t...instance,\n\t\t\t\t\t\t\t\tattributes: {\n\t\t\t\t\t\t\t\t\t...( instance.attributes as object ),\n\t\t\t\t\t\t\t\t\t...edits,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t }\n\t\t\t\t\t\t: instance\n\t\t\t\t)\n\t\t\t);\n\n\t\t\tscheduleAutoSave();\n\t\t},\n\t\t[ layout, onLayoutChange, widget.uuid, scheduleAutoSave ]\n\t);\n\n\tconst data = ( widget.attributes ??\n\t\twidgetType.example?.attributes ??\n\t\t{} ) as WidgetAttributes;\n\n\treturn (\n\t\t<>\n\t\t\t{ fields.length > 0 && (\n\t\t\t\t<DataForm< WidgetAttributes >\n\t\t\t\t\tdata={ data }\n\t\t\t\t\tfields={ fields }\n\t\t\t\t\tform={ form }\n\t\t\t\t\tonChange={ handleChange }\n\t\t\t\t/>\n\t\t\t) }\n\n\t\t\t<WidgetSettingsTrigger\n\t\t\t\twidget={ widget }\n\t\t\t\twidgetType={ widgetType }\n\t\t\t/>\n\t\t</>\n\t);\n}\n"],
5
+ "mappings": ";AAGA,SAAS,gBAAgB;AAEzB,SAAS,aAAa,eAAe;AAMrC,SAAS,mCAAmC;AAC5C,SAAS,6BAA6B;AA+EpC,mBAEE,KAFF;AAtDK,SAAS,wBAAyB;AAAA,EACxC;AAAA,EACA;AACD,GAAmD;AAClD,QAAM,EAAE,QAAQ,gBAAgB,iBAAiB,IAChD,4BAA4B;AAE7B,QAAM,SAAS;AAAA,IACd,OACG,WAAW,cAAc,CAAC,GAAI;AAAA,MAC/B,CAAE,cAAe,UAAU,cAAc;AAAA,IAC1C;AAAA,IACD,CAAE,WAAW,UAAW;AAAA,EACzB;AAIA,QAAM,OAAO;AAAA,IACZ,OAAQ;AAAA,MACP,QAAQ,EAAE,MAAM,OAAO,WAAW,SAAS;AAAA,MAC3C,QAAQ,OAAO,IAAK,CAAE,WAAa;AAAA,QAClC,IAAI,MAAM;AAAA,QACV,QAAQ,EAAE,MAAM,WAAW,eAAe,OAAO;AAAA,MAClD,EAAI;AAAA,IACL;AAAA,IACA,CAAE,MAAO;AAAA,EACV;AAEA,QAAM,eAAe;AAAA,IACpB,CAAE,UAAsC;AACvC;AAAA,QACC,OAAO;AAAA,UAAK,CAAE,aACb,SAAS,SAAS,OAAO,OACtB;AAAA,YACA,GAAG;AAAA,YACH,YAAY;AAAA,cACX,GAAK,SAAS;AAAA,cACd,G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