@wordpress/widget-dashboard 0.1.1 → 0.3.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 (283) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/README.md +29 -16
  3. package/build/components/actions/actions.cjs +6 -23
  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 +28 -69
  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 +176 -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/widget-resize-handle.cjs +4 -4
  44. package/build/components/widgets/widget-resize-handle.cjs.map +2 -2
  45. package/build/components/widgets/widgets.cjs +18 -11
  46. package/build/components/widgets/widgets.cjs.map +2 -2
  47. package/build/context/dashboard-context.cjs +31 -80
  48. package/build/context/dashboard-context.cjs.map +2 -2
  49. package/build/context/ui-context.cjs +2 -18
  50. package/build/context/ui-context.cjs.map +2 -2
  51. package/build/types.cjs.map +1 -1
  52. package/build/utils/index.cjs +2 -5
  53. package/build/utils/index.cjs.map +2 -2
  54. package/build/widget-dashboard.cjs +0 -4
  55. package/build/widget-dashboard.cjs.map +2 -2
  56. package/build-module/components/actions/actions.mjs +7 -24
  57. package/build-module/components/actions/actions.mjs.map +2 -2
  58. package/build-module/components/commands/commands.mjs +2 -67
  59. package/build-module/components/commands/commands.mjs.map +2 -2
  60. package/build-module/components/widget-attribute-controls/index.mjs +6 -0
  61. package/build-module/components/widget-attribute-controls/index.mjs.map +7 -0
  62. package/build-module/components/widget-attribute-controls/widget-attribute-controls.mjs +68 -0
  63. package/build-module/components/widget-attribute-controls/widget-attribute-controls.mjs.map +7 -0
  64. package/build-module/components/widget-chrome/widget-chrome.mjs +29 -76
  65. package/build-module/components/widget-chrome/widget-chrome.mjs.map +2 -2
  66. package/build-module/components/widget-frame/index.mjs +7 -0
  67. package/build-module/components/widget-frame/index.mjs.map +7 -0
  68. package/build-module/components/widget-frame/widget-frame.mjs +157 -0
  69. package/build-module/components/widget-frame/widget-frame.mjs.map +7 -0
  70. package/build-module/components/widget-header/index.mjs +6 -0
  71. package/build-module/components/widget-header/index.mjs.map +7 -0
  72. package/build-module/components/widget-header/widget-header-infotip.mjs +141 -0
  73. package/build-module/components/widget-header/widget-header-infotip.mjs.map +7 -0
  74. package/build-module/components/widget-header/widget-header.mjs +141 -0
  75. package/build-module/components/widget-header/widget-header.mjs.map +7 -0
  76. package/build-module/components/widget-layout-controls/index.mjs +6 -0
  77. package/build-module/components/widget-layout-controls/index.mjs.map +7 -0
  78. package/build-module/components/widget-layout-controls/widget-layout-controls.mjs +90 -0
  79. package/build-module/components/widget-layout-controls/widget-layout-controls.mjs.map +7 -0
  80. package/build-module/components/widget-picker/widget-picker.mjs +6 -94
  81. package/build-module/components/widget-picker/widget-picker.mjs.map +3 -3
  82. package/build-module/components/widget-preview-chrome/index.mjs +6 -0
  83. package/build-module/components/widget-preview-chrome/index.mjs.map +7 -0
  84. package/build-module/components/{widget-settings/widget-settings-toolbar.mjs → widget-preview-chrome/widget-preview-chrome.mjs} +37 -19
  85. package/build-module/components/widget-preview-chrome/widget-preview-chrome.mjs.map +7 -0
  86. package/build-module/components/widget-settings/index.mjs +2 -2
  87. package/build-module/components/widget-settings/index.mjs.map +1 -1
  88. package/build-module/components/widget-settings/utils/index.mjs +0 -2
  89. package/build-module/components/widget-settings/utils/index.mjs.map +2 -2
  90. package/build-module/components/widget-settings/widget-settings-trigger.mjs +23 -29
  91. package/build-module/components/widget-settings/widget-settings-trigger.mjs.map +2 -2
  92. package/build-module/components/widget-settings/widget-settings.mjs +40 -57
  93. package/build-module/components/widget-settings/widget-settings.mjs.map +2 -2
  94. package/build-module/components/widget-toolbar/widget-toolbar.mjs +7 -4
  95. package/build-module/components/widget-toolbar/widget-toolbar.mjs.map +2 -2
  96. package/build-module/components/widgets/widget-resize-handle.mjs +4 -4
  97. package/build-module/components/widgets/widget-resize-handle.mjs.map +2 -2
  98. package/build-module/components/widgets/widgets.mjs +18 -11
  99. package/build-module/components/widgets/widgets.mjs.map +2 -2
  100. package/build-module/context/dashboard-context.mjs +31 -80
  101. package/build-module/context/dashboard-context.mjs.map +2 -2
  102. package/build-module/context/ui-context.mjs +2 -18
  103. package/build-module/context/ui-context.mjs.map +2 -2
  104. package/build-module/types.mjs.map +1 -1
  105. package/build-module/utils/index.mjs +1 -3
  106. package/build-module/utils/index.mjs.map +2 -2
  107. package/build-module/widget-dashboard.mjs +0 -4
  108. package/build-module/widget-dashboard.mjs.map +2 -2
  109. package/build-types/components/actions/actions.d.ts.map +1 -1
  110. package/build-types/components/commands/commands.d.ts.map +1 -1
  111. package/build-types/components/commands/use-pending-when-edit-mode.d.ts +1 -1
  112. package/build-types/components/commands/use-pending-when-edit-mode.d.ts.map +1 -1
  113. package/build-types/components/no-widgets-state/no-widgets-state.d.ts +1 -1
  114. package/build-types/components/no-widgets-state/no-widgets-state.d.ts.map +1 -1
  115. package/build-types/components/widget-attribute-controls/index.d.ts +2 -0
  116. package/build-types/components/widget-attribute-controls/index.d.ts.map +1 -0
  117. package/build-types/components/widget-attribute-controls/widget-attribute-controls.d.ts +23 -0
  118. package/build-types/components/widget-attribute-controls/widget-attribute-controls.d.ts.map +1 -0
  119. package/build-types/components/widget-chrome/widget-chrome.d.ts +8 -8
  120. package/build-types/components/widget-chrome/widget-chrome.d.ts.map +1 -1
  121. package/build-types/components/widget-frame/index.d.ts +3 -0
  122. package/build-types/components/widget-frame/index.d.ts.map +1 -0
  123. package/build-types/components/widget-frame/widget-frame.d.ts +25 -0
  124. package/build-types/components/widget-frame/widget-frame.d.ts.map +1 -0
  125. package/build-types/components/widget-header/index.d.ts +3 -0
  126. package/build-types/components/widget-header/index.d.ts.map +1 -0
  127. package/build-types/components/widget-header/widget-header-infotip.d.ts +20 -0
  128. package/build-types/components/widget-header/widget-header-infotip.d.ts.map +1 -0
  129. package/build-types/components/widget-header/widget-header.d.ts +38 -0
  130. package/build-types/components/widget-header/widget-header.d.ts.map +1 -0
  131. package/build-types/components/widget-layout-controls/index.d.ts +3 -0
  132. package/build-types/components/widget-layout-controls/index.d.ts.map +1 -0
  133. package/build-types/components/widget-layout-controls/widget-layout-controls.d.ts +14 -0
  134. package/build-types/components/widget-layout-controls/widget-layout-controls.d.ts.map +1 -0
  135. package/build-types/components/widget-picker/widget-picker.d.ts +1 -1
  136. package/build-types/components/widget-picker/widget-picker.d.ts.map +1 -1
  137. package/build-types/components/widget-preview-chrome/index.d.ts +3 -0
  138. package/build-types/components/widget-preview-chrome/index.d.ts.map +1 -0
  139. package/build-types/components/widget-preview-chrome/widget-preview-chrome.d.ts +15 -0
  140. package/build-types/components/widget-preview-chrome/widget-preview-chrome.d.ts.map +1 -0
  141. package/build-types/components/widget-settings/index.d.ts +2 -2
  142. package/build-types/components/widget-settings/utils/index.d.ts +0 -1
  143. package/build-types/components/widget-settings/utils/index.d.ts.map +1 -1
  144. package/build-types/components/widget-settings/widget-settings-trigger.d.ts +7 -5
  145. package/build-types/components/widget-settings/widget-settings-trigger.d.ts.map +1 -1
  146. package/build-types/components/widget-settings/widget-settings.d.ts +5 -4
  147. package/build-types/components/widget-settings/widget-settings.d.ts.map +1 -1
  148. package/build-types/components/widget-toolbar/widget-toolbar.d.ts +10 -7
  149. package/build-types/components/widget-toolbar/widget-toolbar.d.ts.map +1 -1
  150. package/build-types/components/widgets/widgets.d.ts.map +1 -1
  151. package/build-types/context/dashboard-context.d.ts +23 -40
  152. package/build-types/context/dashboard-context.d.ts.map +1 -1
  153. package/build-types/context/ui-context.d.ts +0 -18
  154. package/build-types/context/ui-context.d.ts.map +1 -1
  155. package/build-types/context/widget-context.d.ts +1 -1
  156. package/build-types/context/widget-context.d.ts.map +1 -1
  157. package/build-types/types.d.ts +9 -15
  158. package/build-types/types.d.ts.map +1 -1
  159. package/build-types/utils/index.d.ts +0 -1
  160. package/build-types/utils/index.d.ts.map +1 -1
  161. package/build-types/widget-dashboard.d.ts +5 -5
  162. package/build-types/widget-dashboard.d.ts.map +1 -1
  163. package/package.json +20 -20
  164. package/src/components/actions/actions.module.css +7 -7
  165. package/src/components/actions/actions.tsx +5 -25
  166. package/src/components/commands/commands.tsx +3 -70
  167. package/src/components/widget-attribute-controls/index.ts +1 -0
  168. package/src/components/widget-attribute-controls/widget-attribute-controls.tsx +108 -0
  169. package/src/components/widget-chrome/widget-chrome.module.css +6 -71
  170. package/src/components/widget-chrome/widget-chrome.tsx +31 -136
  171. package/src/components/widget-frame/index.ts +2 -0
  172. package/src/components/widget-frame/widget-frame.module.css +17 -0
  173. package/src/components/widget-frame/widget-frame.tsx +138 -0
  174. package/src/components/widget-header/index.ts +2 -0
  175. package/src/components/widget-header/widget-header-infotip.tsx +82 -0
  176. package/src/components/widget-header/widget-header.module.css +59 -0
  177. package/src/components/widget-header/widget-header.tsx +104 -0
  178. package/src/components/widget-layout-controls/index.ts +2 -0
  179. package/src/components/{widgets/widget-layout-toolbar.tsx → widget-layout-controls/widget-layout-controls.tsx} +12 -13
  180. package/src/components/widget-picker/widget-picker.tsx +5 -10
  181. package/src/components/widget-preview-chrome/index.ts +2 -0
  182. package/src/components/widget-preview-chrome/widget-preview-chrome.module.css +22 -0
  183. package/src/components/widget-preview-chrome/widget-preview-chrome.tsx +65 -0
  184. package/src/components/widget-settings/index.ts +2 -2
  185. package/src/components/widget-settings/utils/index.ts +0 -1
  186. package/src/components/widget-settings/widget-settings-trigger.tsx +39 -44
  187. package/src/components/widget-settings/widget-settings.tsx +10 -28
  188. package/src/components/widget-toolbar/widget-toolbar.module.css +13 -10
  189. package/src/components/widget-toolbar/widget-toolbar.tsx +14 -8
  190. package/src/components/widgets/widget-resize-handle.module.css +21 -21
  191. package/src/components/widgets/widget-resize-handle.tsx +2 -2
  192. package/src/components/widgets/widgets.module.css +20 -11
  193. package/src/components/widgets/widgets.tsx +33 -10
  194. package/src/context/dashboard-context.tsx +70 -133
  195. package/src/context/ui-context.tsx +1 -39
  196. package/src/test/actions.test.tsx +7 -77
  197. package/src/test/commands.test.tsx +6 -45
  198. package/src/test/staging.test.tsx +82 -144
  199. package/src/test/widget-dashboard.test.tsx +24 -0
  200. package/src/types.ts +9 -16
  201. package/src/utils/index.ts +0 -1
  202. package/src/widget-dashboard.tsx +4 -8
  203. package/build/components/layout-settings/index.cjs.map +0 -7
  204. package/build/components/layout-settings/layout-model-edit-field/index.cjs +0 -186
  205. package/build/components/layout-settings/layout-model-edit-field/index.cjs.map +0 -7
  206. package/build/components/layout-settings/layout-model-edit-field/thumbnail-grid.cjs +0 -53
  207. package/build/components/layout-settings/layout-model-edit-field/thumbnail-grid.cjs.map +0 -7
  208. package/build/components/layout-settings/layout-model-edit-field/thumbnail-masonry.cjs +0 -53
  209. package/build/components/layout-settings/layout-model-edit-field/thumbnail-masonry.cjs.map +0 -7
  210. package/build/components/layout-settings/layout-settings.cjs +0 -207
  211. package/build/components/layout-settings/layout-settings.cjs.map +0 -7
  212. package/build/components/widget-settings/utils/get-admin-menu-inset.cjs.map +0 -7
  213. package/build/components/widget-settings/widget-settings-toolbar.cjs.map +0 -7
  214. package/build/components/widgets/widget-layout-toolbar.cjs.map +0 -7
  215. package/build/utils/grid-model-change/grid-model-change.cjs +0 -56
  216. package/build/utils/grid-model-change/grid-model-change.cjs.map +0 -7
  217. package/build/utils/grid-model-change/index.cjs.map +0 -7
  218. package/build/utils/migrate-layout/index.cjs.map +0 -7
  219. package/build/utils/migrate-layout/migrate-layout.cjs +0 -94
  220. package/build/utils/migrate-layout/migrate-layout.cjs.map +0 -7
  221. package/build-module/components/layout-settings/index.mjs +0 -6
  222. package/build-module/components/layout-settings/index.mjs.map +0 -7
  223. package/build-module/components/layout-settings/layout-model-edit-field/index.mjs +0 -151
  224. package/build-module/components/layout-settings/layout-model-edit-field/index.mjs.map +0 -7
  225. package/build-module/components/layout-settings/layout-model-edit-field/thumbnail-grid.mjs +0 -28
  226. package/build-module/components/layout-settings/layout-model-edit-field/thumbnail-grid.mjs.map +0 -7
  227. package/build-module/components/layout-settings/layout-model-edit-field/thumbnail-masonry.mjs +0 -28
  228. package/build-module/components/layout-settings/layout-model-edit-field/thumbnail-masonry.mjs.map +0 -7
  229. package/build-module/components/layout-settings/layout-settings.mjs +0 -187
  230. package/build-module/components/layout-settings/layout-settings.mjs.map +0 -7
  231. package/build-module/components/widget-settings/utils/get-admin-menu-inset.mjs +0 -16
  232. package/build-module/components/widget-settings/utils/get-admin-menu-inset.mjs.map +0 -7
  233. package/build-module/components/widget-settings/widget-settings-toolbar.mjs.map +0 -7
  234. package/build-module/components/widgets/widget-layout-toolbar.mjs +0 -181
  235. package/build-module/components/widgets/widget-layout-toolbar.mjs.map +0 -7
  236. package/build-module/utils/grid-model-change/grid-model-change.mjs +0 -30
  237. package/build-module/utils/grid-model-change/grid-model-change.mjs.map +0 -7
  238. package/build-module/utils/grid-model-change/index.mjs +0 -7
  239. package/build-module/utils/grid-model-change/index.mjs.map +0 -7
  240. package/build-module/utils/migrate-layout/index.mjs +0 -6
  241. package/build-module/utils/migrate-layout/index.mjs.map +0 -7
  242. package/build-module/utils/migrate-layout/migrate-layout.mjs +0 -69
  243. package/build-module/utils/migrate-layout/migrate-layout.mjs.map +0 -7
  244. package/build-types/components/layout-settings/index.d.ts +0 -2
  245. package/build-types/components/layout-settings/index.d.ts.map +0 -1
  246. package/build-types/components/layout-settings/layout-model-edit-field/index.d.ts +0 -17
  247. package/build-types/components/layout-settings/layout-model-edit-field/index.d.ts.map +0 -1
  248. package/build-types/components/layout-settings/layout-model-edit-field/thumbnail-grid.d.ts +0 -6
  249. package/build-types/components/layout-settings/layout-model-edit-field/thumbnail-grid.d.ts.map +0 -1
  250. package/build-types/components/layout-settings/layout-model-edit-field/thumbnail-masonry.d.ts +0 -6
  251. package/build-types/components/layout-settings/layout-model-edit-field/thumbnail-masonry.d.ts.map +0 -1
  252. package/build-types/components/layout-settings/layout-settings.d.ts +0 -14
  253. package/build-types/components/layout-settings/layout-settings.d.ts.map +0 -1
  254. package/build-types/components/widget-settings/utils/get-admin-menu-inset.d.ts +0 -17
  255. package/build-types/components/widget-settings/utils/get-admin-menu-inset.d.ts.map +0 -1
  256. package/build-types/components/widget-settings/widget-settings-toolbar.d.ts +0 -20
  257. package/build-types/components/widget-settings/widget-settings-toolbar.d.ts.map +0 -1
  258. package/build-types/components/widgets/widget-layout-toolbar.d.ts +0 -14
  259. package/build-types/components/widgets/widget-layout-toolbar.d.ts.map +0 -1
  260. package/build-types/utils/grid-model-change/grid-model-change.d.ts +0 -20
  261. package/build-types/utils/grid-model-change/grid-model-change.d.ts.map +0 -1
  262. package/build-types/utils/grid-model-change/index.d.ts +0 -2
  263. package/build-types/utils/grid-model-change/index.d.ts.map +0 -1
  264. package/build-types/utils/migrate-layout/index.d.ts +0 -2
  265. package/build-types/utils/migrate-layout/index.d.ts.map +0 -1
  266. package/build-types/utils/migrate-layout/migrate-layout.d.ts +0 -36
  267. package/build-types/utils/migrate-layout/migrate-layout.d.ts.map +0 -1
  268. package/src/components/layout-settings/index.ts +0 -1
  269. package/src/components/layout-settings/layout-model-edit-field/index.tsx +0 -98
  270. package/src/components/layout-settings/layout-model-edit-field/style.module.css +0 -34
  271. package/src/components/layout-settings/layout-model-edit-field/thumbnail-grid.tsx +0 -28
  272. package/src/components/layout-settings/layout-model-edit-field/thumbnail-masonry.tsx +0 -28
  273. package/src/components/layout-settings/layout-settings.tsx +0 -217
  274. package/src/components/widget-picker/widget-picker.module.css +0 -11
  275. package/src/components/widget-settings/utils/get-admin-menu-inset.ts +0 -30
  276. package/src/components/widget-settings/widget-settings-toolbar.module.css +0 -25
  277. package/src/components/widget-settings/widget-settings-toolbar.tsx +0 -45
  278. package/src/components/widgets/widget-layout-toolbar.module.css +0 -6
  279. package/src/utils/grid-model-change/grid-model-change.ts +0 -53
  280. package/src/utils/grid-model-change/index.ts +0 -1
  281. package/src/utils/migrate-layout/index.ts +0 -1
  282. package/src/utils/migrate-layout/migrate-layout.ts +0 -156
  283. package/src/utils/migrate-layout/test/migrate-layout.test.ts +0 -114
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/components/widget-settings/widget-settings-toolbar.tsx", "../../../../style-runtime/src/index.ts", "../../../src/components/widget-settings/widget-settings-toolbar.module.css"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport type { WidgetType } from '@wordpress/widget-primitives';\n\n/**\n * Internal dependencies\n */\nimport { WidgetToolbar } from '../widget-toolbar';\nimport { WidgetSettingsTrigger } from './widget-settings-trigger';\nimport styles from './widget-settings-toolbar.module.css';\nimport type { DashboardWidget } from '../../types';\n\nexport interface WidgetSettingsToolbarProps {\n\t/** The instance whose settings this toolbar configures. */\n\twidget: DashboardWidget< unknown >;\n\n\t/** The instance's widget type, for the trigger label and guard. */\n\twidgetType: WidgetType;\n}\n\n/**\n * Normal-mode per-tile toolbar: the gear that opens the settings drawer. Lives\n * in the grid's `actionableArea` slot, so it shows for every `presentation`.\n * Returns `null` when the type has no attributes.\n *\n * @param {WidgetSettingsToolbarProps} props Component props.\n */\nexport function WidgetSettingsToolbar( {\n\twidget,\n\twidgetType,\n}: WidgetSettingsToolbarProps ): React.ReactNode {\n\tif ( ! widgetType.attributes?.length ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<WidgetToolbar className={ styles.widgetSettingsToolbar }>\n\t\t\t<WidgetSettingsTrigger\n\t\t\t\twidget={ widget }\n\t\t\t\twidgetType={ widgetType }\n\t\t\t/>\n\t\t</WidgetToolbar>\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(\"76555dc7e2\", \"._931c420497181bdb__widgetSettingsToolbar{background:color-mix(in srgb,var(--wpds-color-background-surface-neutral,#fcfcfc) 40%,transparent);opacity:0;pointer-events:none}[data-wp-grid-item-key]:focus-within ._931c420497181bdb__widgetSettingsToolbar,[data-wp-grid-item-key]:hover ._931c420497181bdb__widgetSettingsToolbar{opacity:1;pointer-events:auto}@media not (prefers-reduced-motion){._931c420497181bdb__widgetSettingsToolbar{transition:opacity var(--wpds-motion-duration-sm,.1s) var(--wpds-motion-easing-subtle,cubic-bezier(.15,0,.15,1))}}\");\n}\nexport default {\"widgetSettingsToolbar\":\"_931c420497181bdb__widgetSettingsToolbar\"};\n"],
5
- "mappings": ";AAQA,SAAS,qBAAqB;AAC9B,SAAS,6BAA6B;;;ACCtC,IAAM,uBAAuB;AAU7B,SAAS,aAAa;AACrB,QAAM,cAAc;AAEpB,MAAK,YAAY,kBAAmB;AACnC,WAAO,YAAY;AAAA,EACpB;AAEA,cAAY,mBAAmB;AAAA,IAC9B,WAAW,oBAAI,IAAI;AAAA,IACnB,QAAQ,oBAAI,IAAI;AAAA,IAChB,gBAAgB,oBAAI,QAAQ;AAAA,EAC7B;AAEA,MAAK,OAAO,aAAa,aAAc;AACtC,qBAAkB,QAAS;AAAA,EAC5B;AAEA,SAAO,YAAY;AACpB;AAUA,SAAS,0BACR,gBACA,MACU;AACV,MAAK,CAAE,eAAe,MAAO;AAC5B,WAAO;AAAA,EACR;AAEA,aAAY,SAAS,eAAe,KAAK;AAAA,IACxC,SAAU,oBAAqB;AAAA,EAChC,GAAI;AACH,QAAK,MAAM,aAAc,oBAAqB,MAAM,MAAO;AAC1D,aAAO;AAAA,IACR;AAAA,EACD;AAEA,SAAO;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gB,MAAM,GAAI;AAAA,EACxC;AACD;;;ACpKA,IAAI,OAAO,YAAY,eAAe,QAAQ,IAAI,aAAa,QAAQ;AACtE,gBAAc,cAAc,kiBAAkiB;AAC/jB;AACA,IAAO,kCAAQ,EAAC,yBAAwB,2CAA0C;;;AFkC/E;AAVI,SAAS,sBAAuB;AAAA,EACtC;AAAA,EACA;AACD,GAAiD;AAChD,MAAK,CAAE,WAAW,YAAY,QAAS;AACtC,WAAO;AAAA,EACR;AAEA,SACC,oBAAC,iBAAc,WAAY,gCAAO,uBACjC;AAAA,IAAC;AAAA;AAAA,MACA;AAAA,MACA;AAAA;AAAA,EACD,GACD;AAEF;",
6
- "names": []
7
- }
@@ -1,181 +0,0 @@
1
- // packages/widget-dashboard/src/components/widgets/widget-layout-toolbar.tsx
2
- import { privateApis as componentsPrivateApis } from "@wordpress/components";
3
- import { __ } from "@wordpress/i18n";
4
- import { moreVertical, trash } from "@wordpress/icons";
5
- import { IconButton } from "@wordpress/ui";
6
- import { unlock } from "../../lock-unlock.mjs";
7
- import { useDashboardInternalContext } from "../../context/dashboard-context.mjs";
8
- import { WidgetToolbar } from "../widget-toolbar/index.mjs";
9
-
10
- // packages/style-runtime/src/index.ts
11
- var STYLE_HASH_ATTRIBUTE = "data-wp-hash";
12
- function getRuntime() {
13
- const globalScope = globalThis;
14
- if (globalScope.__wpStyleRuntime) {
15
- return globalScope.__wpStyleRuntime;
16
- }
17
- globalScope.__wpStyleRuntime = {
18
- documents: /* @__PURE__ */ new Map(),
19
- styles: /* @__PURE__ */ new Map(),
20
- injectedStyles: /* @__PURE__ */ new WeakMap()
21
- };
22
- if (typeof document !== "undefined") {
23
- registerDocument(document);
24
- }
25
- return globalScope.__wpStyleRuntime;
26
- }
27
- function documentContainsStyleHash(targetDocument, hash) {
28
- if (!targetDocument.head) {
29
- return false;
30
- }
31
- for (const style of targetDocument.head.querySelectorAll(
32
- `style[${STYLE_HASH_ATTRIBUTE}]`
33
- )) {
34
- if (style.getAttribute(STYLE_HASH_ATTRIBUTE) === hash) {
35
- return true;
36
- }
37
- }
38
- return false;
39
- }
40
- function injectStyle(targetDocument, hash, css) {
41
- if (!targetDocument.head) {
42
- return;
43
- }
44
- const runtime = getRuntime();
45
- let injectedStyles = runtime.injectedStyles.get(targetDocument);
46
- if (!injectedStyles) {
47
- injectedStyles = /* @__PURE__ */ new Set();
48
- runtime.injectedStyles.set(targetDocument, injectedStyles);
49
- }
50
- if (injectedStyles.has(hash)) {
51
- return;
52
- }
53
- if (documentContainsStyleHash(targetDocument, hash)) {
54
- injectedStyles.add(hash);
55
- return;
56
- }
57
- const style = targetDocument.createElement("style");
58
- style.setAttribute(STYLE_HASH_ATTRIBUTE, hash);
59
- style.appendChild(targetDocument.createTextNode(css));
60
- targetDocument.head.appendChild(style);
61
- injectedStyles.add(hash);
62
- }
63
- function registerDocument(targetDocument) {
64
- const runtime = getRuntime();
65
- runtime.documents.set(
66
- targetDocument,
67
- (runtime.documents.get(targetDocument) ?? 0) + 1
68
- );
69
- for (const [hash, css] of runtime.styles) {
70
- injectStyle(targetDocument, hash, css);
71
- }
72
- return () => {
73
- const count = runtime.documents.get(targetDocument);
74
- if (count === void 0) {
75
- return;
76
- }
77
- if (count <= 1) {
78
- runtime.documents.delete(targetDocument);
79
- return;
80
- }
81
- runtime.documents.set(targetDocument, count - 1);
82
- };
83
- }
84
- function registerStyle(hash, css) {
85
- const runtime = getRuntime();
86
- runtime.styles.set(hash, css);
87
- for (const targetDocument of runtime.documents.keys()) {
88
- injectStyle(targetDocument, hash, css);
89
- }
90
- }
91
-
92
- // packages/widget-dashboard/src/components/widgets/widget-layout-toolbar.module.css
93
- if (typeof process === "undefined" || process.env.NODE_ENV !== "test") {
94
- registerStyle("2696f7462d", "._6f7360b4588de00a__widgetLayoutToolbar{background:var(--wpds-color-background-surface-neutral-strong,#fff);border:1px solid var(--wpds-color-stroke-surface-neutral-weak,#f0f0f0);box-shadow:var(--wpds-elevation-xs,0 1px 1px 0 #00000008,0 1px 2px 0 #00000005,0 3px 3px 0 #00000005,0 4px 4px 0 #00000003)}");
95
- }
96
- var widget_layout_toolbar_default = { "widgetLayoutToolbar": "_6f7360b4588de00a__widgetLayoutToolbar" };
97
-
98
- // packages/widget-dashboard/src/components/widgets/widget-layout-toolbar.tsx
99
- import { jsx, jsxs } from "react/jsx-runtime";
100
- var { Menu } = unlock(componentsPrivateApis);
101
- function WidgetLayoutToolbar({
102
- widget
103
- }) {
104
- const { layout, onLayoutChange } = useDashboardInternalContext();
105
- const width = widget.placement?.width;
106
- const updateWidth = (nextWidth) => {
107
- const nextLayout = layout.map(
108
- (currentWidget) => currentWidget.uuid === widget.uuid ? {
109
- ...currentWidget,
110
- placement: {
111
- ...currentWidget.placement,
112
- width: nextWidth
113
- }
114
- } : currentWidget
115
- );
116
- onLayoutChange(nextLayout);
117
- };
118
- const onNamedWidthChange = (nextWidth) => {
119
- updateWidth(nextWidth);
120
- };
121
- const onRemove = () => {
122
- onLayoutChange(
123
- layout.filter(
124
- (currentWidget) => currentWidget.uuid !== widget.uuid
125
- )
126
- );
127
- };
128
- return /* @__PURE__ */ jsxs(WidgetToolbar, { className: widget_layout_toolbar_default.widgetLayoutToolbar, children: [
129
- /* @__PURE__ */ jsxs(Menu, { children: [
130
- /* @__PURE__ */ jsx(
131
- Menu.TriggerButton,
132
- {
133
- render: /* @__PURE__ */ jsx(
134
- IconButton,
135
- {
136
- icon: moreVertical,
137
- label: __("Widget options"),
138
- size: "compact",
139
- variant: "minimal",
140
- tone: "neutral"
141
- }
142
- )
143
- }
144
- ),
145
- /* @__PURE__ */ jsx(Menu.Popover, { children: /* @__PURE__ */ jsxs(Menu.Group, { children: [
146
- /* @__PURE__ */ jsx(Menu.GroupLabel, { children: __("Width") }),
147
- /* @__PURE__ */ jsx(
148
- Menu.Item,
149
- {
150
- disabled: width === "fill",
151
- onClick: () => onNamedWidthChange("fill"),
152
- children: /* @__PURE__ */ jsx(Menu.ItemLabel, { children: __("Use available width") })
153
- }
154
- ),
155
- /* @__PURE__ */ jsx(
156
- Menu.Item,
157
- {
158
- disabled: width === "full",
159
- onClick: () => onNamedWidthChange("full"),
160
- children: /* @__PURE__ */ jsx(Menu.ItemLabel, { children: __("Make full width") })
161
- }
162
- )
163
- ] }) })
164
- ] }),
165
- /* @__PURE__ */ jsx(
166
- IconButton,
167
- {
168
- icon: trash,
169
- label: __("Remove"),
170
- size: "compact",
171
- variant: "minimal",
172
- tone: "neutral",
173
- onClick: onRemove
174
- }
175
- )
176
- ] });
177
- }
178
- export {
179
- WidgetLayoutToolbar
180
- };
181
- //# sourceMappingURL=widget-layout-toolbar.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/components/widgets/widget-layout-toolbar.tsx", "../../../../style-runtime/src/index.ts", "../../../src/components/widgets/widget-layout-toolbar.module.css"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { privateApis as componentsPrivateApis } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { moreVertical, trash } from '@wordpress/icons';\n// Dashboard is still experimental.\n// eslint-disable-next-line @wordpress/use-recommended-components\nimport { IconButton } from '@wordpress/ui';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { useDashboardInternalContext } from '../../context/dashboard-context';\nimport { WidgetToolbar } from '../widget-toolbar';\nimport styles from './widget-layout-toolbar.module.css';\nimport type { DashboardWidget, GridTilePlacement } from '../../types';\n\nconst { Menu } = unlock( componentsPrivateApis );\n\ntype NamedGridWidth = Exclude<\n\tNonNullable< GridTilePlacement[ 'width' ] >,\n\tnumber\n>;\n\nexport interface WidgetLayoutToolbarProps {\n\t/** The instance this toolbar manages within the layout. */\n\twidget: DashboardWidget< unknown >;\n}\n\n/**\n * Customize-mode per-tile toolbar: a width menu and removal, editing the\n * widget's place in the layout. Lives in the grid's `actionableArea` slot, so\n * it stays interactive while the card is `inert`.\n *\n * @param {WidgetLayoutToolbarProps} props Component props.\n */\nexport function WidgetLayoutToolbar( {\n\twidget,\n}: WidgetLayoutToolbarProps ): React.ReactNode {\n\tconst { layout, onLayoutChange } = useDashboardInternalContext();\n\tconst width = widget.placement?.width;\n\n\tconst updateWidth = ( nextWidth: GridTilePlacement[ 'width' ] ) => {\n\t\tconst nextLayout = layout.map( ( currentWidget ) =>\n\t\t\tcurrentWidget.uuid === widget.uuid\n\t\t\t\t? {\n\t\t\t\t\t\t...currentWidget,\n\t\t\t\t\t\tplacement: {\n\t\t\t\t\t\t\t...currentWidget.placement,\n\t\t\t\t\t\t\twidth: nextWidth,\n\t\t\t\t\t\t},\n\t\t\t\t }\n\t\t\t\t: currentWidget\n\t\t);\n\t\tonLayoutChange( nextLayout );\n\t};\n\n\tconst onNamedWidthChange = ( nextWidth: NamedGridWidth ) => {\n\t\tupdateWidth( nextWidth );\n\t};\n\n\tconst onRemove = () => {\n\t\tonLayoutChange(\n\t\t\tlayout.filter(\n\t\t\t\t( currentWidget ) => currentWidget.uuid !== widget.uuid\n\t\t\t)\n\t\t);\n\t};\n\n\treturn (\n\t\t<WidgetToolbar className={ styles.widgetLayoutToolbar }>\n\t\t\t<Menu>\n\t\t\t\t<Menu.TriggerButton\n\t\t\t\t\trender={\n\t\t\t\t\t\t<IconButton\n\t\t\t\t\t\t\ticon={ moreVertical }\n\t\t\t\t\t\t\tlabel={ __( 'Widget options' ) }\n\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t\tvariant=\"minimal\"\n\t\t\t\t\t\t\ttone=\"neutral\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t\t<Menu.Popover>\n\t\t\t\t\t<Menu.Group>\n\t\t\t\t\t\t<Menu.GroupLabel>{ __( 'Width' ) }</Menu.GroupLabel>\n\t\t\t\t\t\t<Menu.Item\n\t\t\t\t\t\t\tdisabled={ width === 'fill' }\n\t\t\t\t\t\t\tonClick={ () => onNamedWidthChange( 'fill' ) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<Menu.ItemLabel>\n\t\t\t\t\t\t\t\t{ __( 'Use available width' ) }\n\t\t\t\t\t\t\t</Menu.ItemLabel>\n\t\t\t\t\t\t</Menu.Item>\n\t\t\t\t\t\t<Menu.Item\n\t\t\t\t\t\t\tdisabled={ width === 'full' }\n\t\t\t\t\t\t\tonClick={ () => onNamedWidthChange( 'full' ) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<Menu.ItemLabel>\n\t\t\t\t\t\t\t\t{ __( 'Make full width' ) }\n\t\t\t\t\t\t\t</Menu.ItemLabel>\n\t\t\t\t\t\t</Menu.Item>\n\t\t\t\t\t</Menu.Group>\n\t\t\t\t</Menu.Popover>\n\t\t\t</Menu>\n\t\t\t<IconButton\n\t\t\t\ticon={ trash }\n\t\t\t\tlabel={ __( 'Remove' ) }\n\t\t\t\tsize=\"compact\"\n\t\t\t\tvariant=\"minimal\"\n\t\t\t\ttone=\"neutral\"\n\t\t\t\tonClick={ onRemove }\n\t\t\t/>\n\t\t</WidgetToolbar>\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(\"2696f7462d\", \"._6f7360b4588de00a__widgetLayoutToolbar{background:var(--wpds-color-background-surface-neutral-strong,#fff);border:1px solid var(--wpds-color-stroke-surface-neutral-weak,#f0f0f0);box-shadow:var(--wpds-elevation-xs,0 1px 1px 0 #00000008,0 1px 2px 0 #00000005,0 3px 3px 0 #00000005,0 4px 4px 0 #00000003)}\");\n}\nexport default {\"widgetLayoutToolbar\":\"_6f7360b4588de00a__widgetLayoutToolbar\"};\n"],
5
- "mappings": ";AAGA,SAAS,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AA,KACD;AAEF;",
6
- "names": []
7
- }
@@ -1,30 +0,0 @@
1
- // packages/widget-dashboard/src/utils/grid-model-change/grid-model-change.ts
2
- import { migrateLayout } from "../migrate-layout/index.mjs";
3
- import { WIDGET_DASHBOARD_COLUMN_COUNT } from "../../types.mjs";
4
- function getGridModel(settings) {
5
- return settings.model ?? "grid";
6
- }
7
- function computeGridModelChange({
8
- layout,
9
- gridSettings,
10
- targetModel
11
- }) {
12
- const currentModel = getGridModel(gridSettings);
13
- if (currentModel === targetModel) {
14
- return null;
15
- }
16
- return {
17
- layout: migrateLayout(layout, currentModel, targetModel, {
18
- columns: WIDGET_DASHBOARD_COLUMN_COUNT
19
- }),
20
- gridSettings: {
21
- ...gridSettings,
22
- model: targetModel
23
- }
24
- };
25
- }
26
- export {
27
- computeGridModelChange,
28
- getGridModel
29
- };
30
- //# sourceMappingURL=grid-model-change.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/utils/grid-model-change/grid-model-change.ts"],
4
- "sourcesContent": ["/**\n * Internal dependencies\n */\nimport { migrateLayout } from '../migrate-layout';\nimport type {\n\tDashboardWidget,\n\tWidgetGridModel,\n\tWidgetGridSettings,\n} from '../../types';\nimport { WIDGET_DASHBOARD_COLUMN_COUNT } from '../../types';\n\nexport function getGridModel( settings: WidgetGridSettings ): WidgetGridModel {\n\treturn settings.model ?? 'grid';\n}\n\ntype ComputeGridModelChangeProps = {\n\tlayout: DashboardWidget[];\n\tgridSettings: WidgetGridSettings;\n\ttargetModel: WidgetGridModel;\n};\n\ntype ComputeGridModelChangeResult = {\n\tlayout: DashboardWidget[];\n\tgridSettings: WidgetGridSettings;\n} | null;\n\n/**\n * Computes the staged layout and grid settings after a layout-model change.\n *\n * @param {ComputeGridModelChangeProps} params Layout, current settings, and target model.\n * @return {ComputeGridModelChangeResult} Migrated layout and settings, or `null` when the model is unchanged.\n */\nexport function computeGridModelChange( {\n\tlayout,\n\tgridSettings,\n\ttargetModel,\n}: ComputeGridModelChangeProps ): ComputeGridModelChangeResult {\n\tconst currentModel = getGridModel( gridSettings );\n\n\tif ( currentModel === targetModel ) {\n\t\treturn null;\n\t}\n\n\treturn {\n\t\tlayout: migrateLayout( layout, currentModel, targetModel, {\n\t\t\tcolumns: WIDGET_DASHBOARD_COLUMN_COUNT,\n\t\t} ),\n\t\tgridSettings: {\n\t\t\t...gridSettings,\n\t\t\tmodel: targetModel,\n\t\t} as WidgetGridSettings,\n\t};\n}\n"],
5
- "mappings": ";AAGA,SAAS,qBAAqB;AAM9B,SAAS,qCAAqC;AAEvC,SAAS,aAAc,UAAgD;AAC7E,SAAO,SAAS,SAAS;AAC1B;AAmBO,SAAS,uBAAwB;AAAA,EACvC;AAAA,EACA;AAAA,EACA;AACD,GAA+D;AAC9D,QAAM,eAAe,aAAc,YAAa;AAEhD,MAAK,iBAAiB,aAAc;AACnC,WAAO;AAAA,EACR;AAEA,SAAO;AAAA,IACN,QAAQ,cAAe,QAAQ,cAAc,aAAa;AAAA,MACzD,SAAS;AAAA,IACV,CAAE;AAAA,IACF,cAAc;AAAA,MACb,GAAG;AAAA,MACH,OAAO;AAAA,IACR;AAAA,EACD;AACD;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- // packages/widget-dashboard/src/utils/grid-model-change/index.ts
2
- import { computeGridModelChange, getGridModel } from "./grid-model-change.mjs";
3
- export {
4
- computeGridModelChange,
5
- getGridModel
6
- };
7
- //# sourceMappingURL=index.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/utils/grid-model-change/index.ts"],
4
- "sourcesContent": ["export { computeGridModelChange, getGridModel } from './grid-model-change';\n"],
5
- "mappings": ";AAAA,SAAS,wBAAwB,oBAAoB;",
6
- "names": []
7
- }
@@ -1,6 +0,0 @@
1
- // packages/widget-dashboard/src/utils/migrate-layout/index.ts
2
- import { migrateLayout } from "./migrate-layout.mjs";
3
- export {
4
- migrateLayout
5
- };
6
- //# sourceMappingURL=index.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/utils/migrate-layout/index.ts"],
4
- "sourcesContent": ["export { migrateLayout } from './migrate-layout';\n"],
5
- "mappings": ";AAAA,SAAS,qBAAqB;",
6
- "names": []
7
- }
@@ -1,69 +0,0 @@
1
- // packages/widget-dashboard/src/utils/migrate-layout/migrate-layout.ts
2
- var FALLBACK_COLUMNS = 6;
3
- function gridWidthToMasonryWidth(width, targetColumns) {
4
- if (width === "full") {
5
- return targetColumns;
6
- }
7
- if (width === "fill" || width === void 0) {
8
- return 1;
9
- }
10
- return width;
11
- }
12
- function migratePlacementGridToMasonry(placement, context) {
13
- if (!placement) {
14
- return {};
15
- }
16
- const next = {};
17
- const width = gridWidthToMasonryWidth(placement.width, context.columns);
18
- if (width !== 1) {
19
- next.width = width;
20
- }
21
- if (placement.order !== void 0) {
22
- next.order = placement.order;
23
- }
24
- return next;
25
- }
26
- function migratePlacementMasonryToGrid(placement) {
27
- if (!placement) {
28
- return { height: 1 };
29
- }
30
- const next = { height: 1 };
31
- if (placement.width !== void 0) {
32
- next.width = placement.width;
33
- }
34
- if (placement.order !== void 0) {
35
- next.order = placement.order;
36
- }
37
- return next;
38
- }
39
- function migrateLayout(widgets, from, to, context = {}) {
40
- const resolvedFrom = from ?? "grid";
41
- if (resolvedFrom === to) {
42
- return widgets;
43
- }
44
- const resolvedContext = {
45
- columns: context.columns ?? FALLBACK_COLUMNS
46
- };
47
- if (resolvedFrom === "grid" && to === "masonry") {
48
- return widgets.map((widget) => ({
49
- ...widget,
50
- placement: migratePlacementGridToMasonry(
51
- widget.placement,
52
- resolvedContext
53
- )
54
- }));
55
- }
56
- if (resolvedFrom === "masonry" && to === "grid") {
57
- return widgets.map((widget) => ({
58
- ...widget,
59
- placement: migratePlacementMasonryToGrid(
60
- widget.placement
61
- )
62
- }));
63
- }
64
- return widgets;
65
- }
66
- export {
67
- migrateLayout
68
- };
69
- //# sourceMappingURL=migrate-layout.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/utils/migrate-layout/migrate-layout.ts"],
4
- "sourcesContent": ["/**\n * Internal dependencies\n */\nimport type {\n\tDashboardWidget,\n\tGridTilePlacement,\n\tMasonryTilePlacement,\n\tWidgetGridModel,\n} from '../../types';\n\ninterface MigrationContext {\n\t/**\n\t * Column count of the currently-mounted grid surface. Used to\n\t * resolve `'full'` widths to a concrete numeric span when going\n\t * from the 2D grid model to masonry. When the surface is in\n\t * responsive mode and the runtime column count is unknown,\n\t * callers should pass a sensible fallback (e.g., the default of\n\t * 6 used by `@wordpress/grid`).\n\t */\n\tcolumns: number;\n}\n\nconst FALLBACK_COLUMNS = 6;\n\n/**\n * Coerces a `'fill'`/`'full'`/numeric width into a concrete numeric\n * span when migrating from `'grid'` to `'masonry'`. `'fill'` collapses\n * to a single column; resolving it against per-row remainder would\n * require either DOM measurement or replicating CSS-Grid's auto-flow\n * placement, both of which were judged not worth the complexity for\n * a one-shot migration the user can correct visually in staging.\n *\n * @param width Source width from a grid placement.\n * @param targetColumns Column count to use for `'full'` widths.\n */\nfunction gridWidthToMasonryWidth(\n\twidth: GridTilePlacement[ 'width' ],\n\ttargetColumns: number\n): number {\n\tif ( width === 'full' ) {\n\t\treturn targetColumns;\n\t}\n\tif ( width === 'fill' || width === undefined ) {\n\t\treturn 1;\n\t}\n\treturn width;\n}\n\n/**\n * Transforms a single placement from the 2D grid shape to the masonry\n * shape. Drops `height` (masonry derives heights from content),\n * preserves `order`, leaves `lane` unset so the auto-flow placer\n * arranges items by source order.\n *\n * @param placement Source grid placement.\n * @param context Migration context (column count).\n */\nfunction migratePlacementGridToMasonry(\n\tplacement: GridTilePlacement | undefined,\n\tcontext: MigrationContext\n): MasonryTilePlacement {\n\tif ( ! placement ) {\n\t\treturn {};\n\t}\n\n\tconst next: MasonryTilePlacement = {};\n\tconst width = gridWidthToMasonryWidth( placement.width, context.columns );\n\tif ( width !== 1 ) {\n\t\tnext.width = width;\n\t}\n\tif ( placement.order !== undefined ) {\n\t\tnext.order = placement.order;\n\t}\n\treturn next;\n}\n\n/**\n * Transforms a single placement from the masonry shape to the 2D grid\n * shape. Preserves the numeric width, drops `lane` (the 2D grid\n * auto-packs and has no pin-to-column concept), and seeds `height: 1`\n * since masonry never persisted a height. The user is expected to\n * resize tiles vertically after the migration.\n *\n * @param placement Source masonry placement.\n */\nfunction migratePlacementMasonryToGrid(\n\tplacement: MasonryTilePlacement | undefined\n): GridTilePlacement {\n\tif ( ! placement ) {\n\t\treturn { height: 1 };\n\t}\n\n\tconst next: GridTilePlacement = { height: 1 };\n\tif ( placement.width !== undefined ) {\n\t\tnext.width = placement.width;\n\t}\n\tif ( placement.order !== undefined ) {\n\t\tnext.order = placement.order;\n\t}\n\treturn next;\n}\n\n/**\n * Migrates every widget's `placement` between grid models.\n *\n * The two storage shapes overlap on `width` and `order` but diverge\n * on the rest: 2D grid carries `height` and discriminated string\n * widths (`'fill'`/`'full'`), lanes carries `lane` and only numeric\n * widths. Each conversion loses information that the target model\n * cannot represent. The caller is responsible for surfacing the\n * result to the user in a way that lets them correct visually.\n *\n * When `from === to`, the input is returned unchanged.\n *\n * @param widgets Widgets to migrate.\n * @param from Source model. `undefined` is treated as `'grid'`.\n * @param to Target model.\n * @param context Information that depends on the live render (today\n * only `columns`).\n */\nexport function migrateLayout(\n\twidgets: DashboardWidget[],\n\tfrom: WidgetGridModel | undefined,\n\tto: WidgetGridModel,\n\tcontext: Partial< MigrationContext > = {}\n): DashboardWidget[] {\n\tconst resolvedFrom: WidgetGridModel = from ?? 'grid';\n\tif ( resolvedFrom === to ) {\n\t\treturn widgets;\n\t}\n\n\tconst resolvedContext: MigrationContext = {\n\t\tcolumns: context.columns ?? FALLBACK_COLUMNS,\n\t};\n\n\tif ( resolvedFrom === 'grid' && to === 'masonry' ) {\n\t\treturn widgets.map( ( widget ) => ( {\n\t\t\t...widget,\n\t\t\tplacement: migratePlacementGridToMasonry(\n\t\t\t\twidget.placement as GridTilePlacement | undefined,\n\t\t\t\tresolvedContext\n\t\t\t),\n\t\t} ) );\n\t}\n\n\tif ( resolvedFrom === 'masonry' && to === 'grid' ) {\n\t\treturn widgets.map( ( widget ) => ( {\n\t\t\t...widget,\n\t\t\tplacement: migratePlacementMasonryToGrid(\n\t\t\t\twidget.placement as MasonryTilePlacement | undefined\n\t\t\t),\n\t\t} ) );\n\t}\n\n\treturn widgets;\n}\n"],
5
- "mappings": ";AAsBA,IAAM,mBAAmB;AAazB,SAAS,wBACR,OACA,eACS;AACT,MAAK,UAAU,QAAS;AACvB,WAAO;AAAA,EACR;AACA,MAAK,UAAU,UAAU,UAAU,QAAY;AAC9C,WAAO;AAAA,EACR;AACA,SAAO;AACR;AAWA,SAAS,8BACR,WACA,SACuB;AACvB,MAAK,CAAE,WAAY;AAClB,WAAO,CAAC;AAAA,EACT;AAEA,QAAM,OAA6B,CAAC;AACpC,QAAM,QAAQ,wBAAyB,UAAU,OAAO,QAAQ,OAAQ;AACxE,MAAK,UAAU,GAAI;AAClB,SAAK,QAAQ;AAAA,EACd;AACA,MAAK,UAAU,UAAU,QAAY;AACpC,SAAK,QAAQ,UAAU;AAAA,EACxB;AACA,SAAO;AACR;AAWA,SAAS,8BACR,WACoB;AACpB,MAAK,CAAE,WAAY;AAClB,WAAO,EAAE,QAAQ,EAAE;AAAA,EACpB;AAEA,QAAM,OAA0B,EAAE,QAAQ,EAAE;AAC5C,MAAK,UAAU,UAAU,QAAY;AACpC,SAAK,QAAQ,UAAU;AAAA,EACxB;AACA,MAAK,UAAU,UAAU,QAAY;AACpC,SAAK,QAAQ,UAAU;AAAA,EACxB;AACA,SAAO;AACR;AAoBO,SAAS,cACf,SACA,MACA,IACA,UAAuC,CAAC,GACpB;AACpB,QAAM,eAAgC,QAAQ;AAC9C,MAAK,iBAAiB,IAAK;AAC1B,WAAO;AAAA,EACR;AAEA,QAAM,kBAAoC;AAAA,IACzC,SAAS,QAAQ,WAAW;AAAA,EAC7B;AAEA,MAAK,iBAAiB,UAAU,OAAO,WAAY;AAClD,WAAO,QAAQ,IAAK,CAAE,YAAc;AAAA,MACnC,GAAG;AAAA,MACH,WAAW;AAAA,QACV,OAAO;AAAA,QACP;AAAA,MACD;AAAA,IACD,EAAI;AAAA,EACL;AAEA,MAAK,iBAAiB,aAAa,OAAO,QAAS;AAClD,WAAO,QAAQ,IAAK,CAAE,YAAc;AAAA,MACnC,GAAG;AAAA,MACH,WAAW;AAAA,QACV,OAAO;AAAA,MACR;AAAA,IACD,EAAI;AAAA,EACL;AAEA,SAAO;AACR;",
6
- "names": []
7
- }
@@ -1,2 +0,0 @@
1
- export { LayoutSettings } from './layout-settings';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/layout-settings/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC"}
@@ -1,17 +0,0 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import type { DataFormControlProps } from '@wordpress/dataviews';
5
- /**
6
- * Internal dependencies
7
- */
8
- import type { WidgetGridSettings } from '../../../types';
9
- /**
10
- * Card-style picker for the layout model: each option (`grid`, `masonry`)
11
- * renders as a thumbnail card in a radio group. Wired as the `Edit` control
12
- * for the `model` field of the layout settings DataForm.
13
- *
14
- * @param {DataFormControlProps< WidgetGridSettings >} props DataForm control props.
15
- */
16
- export declare function LayoutModelEditField({ data, field, onChange }: DataFormControlProps<WidgetGridSettings>): React.ReactNode;
17
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/layout-settings/layout-model-edit-field/index.tsx"],"names":[],"mappings":"AAKA;;GAEG;AACH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAMjE;;GAEG;AACH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAqBzD;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAE,EACrC,IAAI,EACJ,KAAK,EACL,QAAQ,EACR,EAAE,oBAAoB,CAAE,kBAAkB,CAAE,GAAI,KAAK,CAAC,SAAS,CAgD/D"}
@@ -1,6 +0,0 @@
1
- interface GridThumbnailProps {
2
- className?: string;
3
- }
4
- export declare function GridThumbnail({ className }: GridThumbnailProps): React.ReactNode;
5
- export {};
6
- //# sourceMappingURL=thumbnail-grid.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"thumbnail-grid.d.ts","sourceRoot":"","sources":["../../../../src/components/layout-settings/layout-model-edit-field/thumbnail-grid.tsx"],"names":[],"mappings":"AAKA,UAAU,kBAAkB;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,wBAAgB,aAAa,CAAE,EAC9B,SAAS,EACT,EAAE,kBAAkB,GAAI,KAAK,CAAC,SAAS,CAgBvC"}
@@ -1,6 +0,0 @@
1
- interface MasonryThumbnailProps {
2
- className?: string;
3
- }
4
- export declare function MasonryThumbnail({ className }: MasonryThumbnailProps): React.ReactNode;
5
- export {};
6
- //# sourceMappingURL=thumbnail-masonry.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"thumbnail-masonry.d.ts","sourceRoot":"","sources":["../../../../src/components/layout-settings/layout-model-edit-field/thumbnail-masonry.tsx"],"names":[],"mappings":"AAKA,UAAU,qBAAqB;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,wBAAgB,gBAAgB,CAAE,EACjC,SAAS,EACT,EAAE,qBAAqB,GAAI,KAAK,CAAC,SAAS,CAgB1C"}
@@ -1,14 +0,0 @@
1
- /**
2
- * Modal side drawer for grid-level settings (layout model and row height),
3
- * mounted by the engine and shown while `layoutSettingsOpen` is set in the
4
- * shared UI context. Renders nothing when grid settings are not editable.
5
- *
6
- * Edits, including Reset, apply to the staging copy and preview live behind
7
- * the drawer. Save commits them; Cancel and any other dismissal (X, Escape)
8
- * revert them. Either way only grid settings change, so in-progress widget
9
- * layout edits survive and customize mode stays active.
10
- *
11
- * Tile gap is deliberately not exposed; spacing stays a design-system concern.
12
- */
13
- export declare function LayoutSettings(): React.ReactNode;
14
- //# sourceMappingURL=layout-settings.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"layout-settings.d.ts","sourceRoot":"","sources":["../../../src/components/layout-settings/layout-settings.tsx"],"names":[],"mappings":"AAiFA;;;;;;;;;;;GAWG;AACH,wBAAgB,cAAc,IAAI,KAAK,CAAC,SAAS,CA2HhD"}
@@ -1,17 +0,0 @@
1
- /**
2
- * Width, in pixels, taken up by the WordPress admin menu
3
- * (`#adminmenuback`) on the inline-start edge of the viewport.
4
- *
5
- * The settings drawer portals to the document body and anchors to a
6
- * viewport edge, so a left-anchored drawer would slide over the fixed
7
- * admin menu. Offsetting the drawer by this value keeps the menu
8
- * uncovered (and reachable) instead of raising the drawer's z-index over
9
- * it.
10
- *
11
- * Defensive: returns `0` when the element is absent (outside wp-admin, or
12
- * in tests/Storybook), so the drawer just anchors to the viewport edge.
13
- *
14
- * @return {number} The admin menu's right edge in px, or `0`.
15
- */
16
- export declare function getAdminMenuInset(): number;
17
- //# sourceMappingURL=get-admin-menu-inset.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-admin-menu-inset.d.ts","sourceRoot":"","sources":["../../../../src/components/widget-settings/utils/get-admin-menu-inset.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CAW1C"}
@@ -1,20 +0,0 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import type { WidgetType } from '@wordpress/widget-primitives';
5
- import type { DashboardWidget } from '../../types';
6
- export interface WidgetSettingsToolbarProps {
7
- /** The instance whose settings this toolbar configures. */
8
- widget: DashboardWidget<unknown>;
9
- /** The instance's widget type, for the trigger label and guard. */
10
- widgetType: WidgetType;
11
- }
12
- /**
13
- * Normal-mode per-tile toolbar: the gear that opens the settings drawer. Lives
14
- * in the grid's `actionableArea` slot, so it shows for every `presentation`.
15
- * Returns `null` when the type has no attributes.
16
- *
17
- * @param {WidgetSettingsToolbarProps} props Component props.
18
- */
19
- export declare function WidgetSettingsToolbar({ widget, widgetType }: WidgetSettingsToolbarProps): React.ReactNode;
20
- //# sourceMappingURL=widget-settings-toolbar.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"widget-settings-toolbar.d.ts","sourceRoot":"","sources":["../../../src/components/widget-settings/widget-settings-toolbar.tsx"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAQ/D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD,MAAM,WAAW,0BAA0B;IAC1C,2DAA2D;IAC3D,MAAM,EAAE,eAAe,CAAE,OAAO,CAAE,CAAC;IAEnC,mEAAmE;IACnE,UAAU,EAAE,UAAU,CAAC;CACvB;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAE,EACtC,MAAM,EACN,UAAU,EACV,EAAE,0BAA0B,GAAI,KAAK,CAAC,SAAS,CAa/C"}
@@ -1,14 +0,0 @@
1
- import type { DashboardWidget } from '../../types';
2
- export interface WidgetLayoutToolbarProps {
3
- /** The instance this toolbar manages within the layout. */
4
- widget: DashboardWidget<unknown>;
5
- }
6
- /**
7
- * Customize-mode per-tile toolbar: a width menu and removal, editing the
8
- * widget's place in the layout. Lives in the grid's `actionableArea` slot, so
9
- * it stays interactive while the card is `inert`.
10
- *
11
- * @param {WidgetLayoutToolbarProps} props Component props.
12
- */
13
- export declare function WidgetLayoutToolbar({ widget }: WidgetLayoutToolbarProps): React.ReactNode;
14
- //# sourceMappingURL=widget-layout-toolbar.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"widget-layout-toolbar.d.ts","sourceRoot":"","sources":["../../../src/components/widgets/widget-layout-toolbar.tsx"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,eAAe,EAAqB,MAAM,aAAa,CAAC;AAStE,MAAM,WAAW,wBAAwB;IACxC,2DAA2D;IAC3D,MAAM,EAAE,eAAe,CAAE,OAAO,CAAE,CAAC;CACnC;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAE,EACpC,MAAM,EACN,EAAE,wBAAwB,GAAI,KAAK,CAAC,SAAS,CA6E7C"}
@@ -1,20 +0,0 @@
1
- import type { DashboardWidget, WidgetGridModel, WidgetGridSettings } from '../../types';
2
- export declare function getGridModel(settings: WidgetGridSettings): WidgetGridModel;
3
- type ComputeGridModelChangeProps = {
4
- layout: DashboardWidget[];
5
- gridSettings: WidgetGridSettings;
6
- targetModel: WidgetGridModel;
7
- };
8
- type ComputeGridModelChangeResult = {
9
- layout: DashboardWidget[];
10
- gridSettings: WidgetGridSettings;
11
- } | null;
12
- /**
13
- * Computes the staged layout and grid settings after a layout-model change.
14
- *
15
- * @param {ComputeGridModelChangeProps} params Layout, current settings, and target model.
16
- * @return {ComputeGridModelChangeResult} Migrated layout and settings, or `null` when the model is unchanged.
17
- */
18
- export declare function computeGridModelChange({ layout, gridSettings, targetModel }: ComputeGridModelChangeProps): ComputeGridModelChangeResult;
19
- export {};
20
- //# sourceMappingURL=grid-model-change.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"grid-model-change.d.ts","sourceRoot":"","sources":["../../../src/utils/grid-model-change/grid-model-change.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACX,eAAe,EACf,eAAe,EACf,kBAAkB,EAClB,MAAM,aAAa,CAAC;AAGrB,wBAAgB,YAAY,CAAE,QAAQ,EAAE,kBAAkB,GAAI,eAAe,CAE5E;AAED,KAAK,2BAA2B,GAAG;IAClC,MAAM,EAAE,eAAe,EAAE,CAAC;IAC1B,YAAY,EAAE,kBAAkB,CAAC;IACjC,WAAW,EAAE,eAAe,CAAC;CAC7B,CAAC;AAEF,KAAK,4BAA4B,GAAG;IACnC,MAAM,EAAE,eAAe,EAAE,CAAC;IAC1B,YAAY,EAAE,kBAAkB,CAAC;CACjC,GAAG,IAAI,CAAC;AAET;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAE,EACvC,MAAM,EACN,YAAY,EACZ,WAAW,EACX,EAAE,2BAA2B,GAAI,4BAA4B,CAgB7D"}
@@ -1,2 +0,0 @@
1
- export { computeGridModelChange, getGridModel } from './grid-model-change';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/grid-model-change/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC"}
@@ -1,2 +0,0 @@
1
- export { migrateLayout } from './migrate-layout';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/migrate-layout/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC"}
@@ -1,36 +0,0 @@
1
- /**
2
- * Internal dependencies
3
- */
4
- import type { DashboardWidget, WidgetGridModel } from '../../types';
5
- interface MigrationContext {
6
- /**
7
- * Column count of the currently-mounted grid surface. Used to
8
- * resolve `'full'` widths to a concrete numeric span when going
9
- * from the 2D grid model to masonry. When the surface is in
10
- * responsive mode and the runtime column count is unknown,
11
- * callers should pass a sensible fallback (e.g., the default of
12
- * 6 used by `@wordpress/grid`).
13
- */
14
- columns: number;
15
- }
16
- /**
17
- * Migrates every widget's `placement` between grid models.
18
- *
19
- * The two storage shapes overlap on `width` and `order` but diverge
20
- * on the rest: 2D grid carries `height` and discriminated string
21
- * widths (`'fill'`/`'full'`), lanes carries `lane` and only numeric
22
- * widths. Each conversion loses information that the target model
23
- * cannot represent. The caller is responsible for surfacing the
24
- * result to the user in a way that lets them correct visually.
25
- *
26
- * When `from === to`, the input is returned unchanged.
27
- *
28
- * @param widgets Widgets to migrate.
29
- * @param from Source model. `undefined` is treated as `'grid'`.
30
- * @param to Target model.
31
- * @param context Information that depends on the live render (today
32
- * only `columns`).
33
- */
34
- export declare function migrateLayout(widgets: DashboardWidget[], from: WidgetGridModel | undefined, to: WidgetGridModel, context?: Partial<MigrationContext>): DashboardWidget[];
35
- export {};
36
- //# sourceMappingURL=migrate-layout.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"migrate-layout.d.ts","sourceRoot":"","sources":["../../../src/utils/migrate-layout/migrate-layout.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EACX,eAAe,EAGf,eAAe,EACf,MAAM,aAAa,CAAC;AAErB,UAAU,gBAAgB;IACzB;;;;;;;OAOG;IACH,OAAO,EAAE,MAAM,CAAC;CAChB;AAkFD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,aAAa,CAC5B,OAAO,EAAE,eAAe,EAAE,EAC1B,IAAI,EAAE,eAAe,GAAG,SAAS,EACjC,EAAE,EAAE,eAAe,EACnB,OAAO,GAAE,OAAO,CAAE,gBAAgB,CAAO,GACvC,eAAe,EAAE,CA8BnB"}