@wordpress/widget-dashboard 0.2.0 → 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 +30 -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
@@ -34,14 +34,13 @@ __export(widget_chrome_exports, {
34
34
  });
35
35
  module.exports = __toCommonJS(widget_chrome_exports);
36
36
  var import_clsx = __toESM(require("clsx"));
37
- var import_components = require("@wordpress/components");
38
37
  var import_element = require("@wordpress/element");
39
38
  var import_i18n = require("@wordpress/i18n");
40
39
  var import_icons = require("@wordpress/icons");
41
40
  var import_ui = require("@wordpress/ui");
42
41
  var import_dashboard_context = require("../../context/dashboard-context.cjs");
43
42
  var import_widget_context = require("../../context/widget-context.cjs");
44
- var import_widget_render = require("../widget-render/index.cjs");
43
+ var import_widget_frame = require("../widget-frame/index.cjs");
45
44
 
46
45
  // packages/style-runtime/src/index.ts
47
46
  var STYLE_HASH_ATTRIBUTE = "data-wp-hash";
@@ -127,38 +126,23 @@ function registerStyle(hash, css) {
127
126
 
128
127
  // packages/widget-dashboard/src/components/widget-chrome/widget-chrome.module.css
129
128
  if (typeof process === "undefined" || process.env.NODE_ENV !== "test") {
130
- registerStyle("345dedc0b8", "._79b45ce7d3422efe__widgetChrome{contain:layout;height:100%}._79b45ce7d3422efe__widgetChrome:has(._9f0be51a1b96c8d7__widgetChromeContent :focus-visible){outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9));outline-offset:2px}.d85f7657585b9203__widgetChromeHeaderIcon{color:var(--wpds-color-foreground-content-neutral,#1e1e1e);display:inline-flex}._9f0be51a1b96c8d7__widgetChromeContent{flex:1;height:100%;min-height:0;min-width:0;overflow-y:auto}._21770471c9c2115b__widgetChromeContentBleed{padding-block:0}._229727240ac2aa18__widgetChromeBleedScroll{height:100%;margin-block-end:0;overflow-y:auto}._3c919e86d1bb80ab__loading,._9b694d63bdec1a98__unavailable{height:100%}");
129
+ registerStyle("9c052414dc", ".c10bdb70b86e7888__widget-chrome:has(:focus-visible){outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9));outline-offset:var(--wp-widget-dashboard-tile-focus-offset,2px)}._05be5860e5abb8bb__widget-chrome-header-icon{color:var(--wpds-color-foreground-content-neutral,#1e1e1e);display:inline-flex}.a7e5c80edbcdf3f5__widget-chrome-content{flex:1;height:100%;min-height:0;min-width:0}._9b694d63bdec1a98__unavailable{height:100%}");
131
130
  }
132
- var widget_chrome_default = { "widgetChrome": "_79b45ce7d3422efe__widgetChrome", "widgetChromeContent": "_9f0be51a1b96c8d7__widgetChromeContent", "widgetChromeHeaderIcon": "d85f7657585b9203__widgetChromeHeaderIcon", "widgetChromeContentBleed": "_21770471c9c2115b__widgetChromeContentBleed", "widgetChromeBleedScroll": "_229727240ac2aa18__widgetChromeBleedScroll", "loading": "_3c919e86d1bb80ab__loading", "unavailable": "_9b694d63bdec1a98__unavailable" };
131
+ var widget_chrome_default = { "widget-chrome": "c10bdb70b86e7888__widget-chrome", "widget-chrome-header-icon": "_05be5860e5abb8bb__widget-chrome-header-icon", "widget-chrome-content": "a7e5c80edbcdf3f5__widget-chrome-content", "unavailable": "_9b694d63bdec1a98__unavailable" };
133
132
 
134
133
  // packages/widget-dashboard/src/components/widget-chrome/widget-chrome.tsx
135
134
  var import_jsx_runtime = require("react/jsx-runtime");
136
- var WidgetErrorBoundary = class extends import_element.Component {
137
- state = { hasError: false };
138
- static getDerivedStateFromError() {
139
- return { hasError: true };
140
- }
141
- render() {
142
- if (this.state.hasError) {
143
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ui.Notice.Root, { intent: "error", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ui.Notice.Description, { children: (0, import_i18n.__)("This widget encountered an error.") }) });
144
- }
145
- return this.props.children;
146
- }
147
- };
148
- function LoadingOverlay() {
149
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ui.Stack, { justify: "center", align: "center", className: widget_chrome_default.loading, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.Spinner, {}) });
150
- }
151
135
  function UnavailableWidget({ widgetTypeName }) {
152
136
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
153
137
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ui.Card.Header, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
154
138
  "span",
155
139
  {
156
- className: widget_chrome_default.widgetChromeHeaderIcon,
140
+ className: widget_chrome_default["widget-chrome-header-icon"],
157
141
  "aria-hidden": "true",
158
142
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ui.Icon, { icon: import_icons.plugins })
159
143
  }
160
144
  ) }),
161
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ui.Card.Content, { className: widget_chrome_default.widgetChromeContent, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
145
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ui.Card.Content, { className: widget_chrome_default["widget-chrome-content"], children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
162
146
  import_ui.Stack,
163
147
  {
164
148
  direction: "column",
@@ -174,24 +158,8 @@ function UnavailableWidget({ widgetTypeName }) {
174
158
  ) })
175
159
  ] });
176
160
  }
177
- function Header({ titleId, widgetType }) {
178
- if (!widgetType.title) {
179
- return null;
180
- }
181
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ui.Card.Header, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_ui.Stack, { direction: "row", align: "center", gap: "sm", children: [
182
- widgetType.icon && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
183
- "span",
184
- {
185
- className: widget_chrome_default.widgetChromeHeaderIcon,
186
- "aria-hidden": "true",
187
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ui.Icon, { icon: widgetType.icon })
188
- }
189
- ),
190
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ui.Card.Title, { id: titleId, render: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", {}), children: widgetType.title })
191
- ] }) });
192
- }
193
161
  var WidgetChrome = (0, import_element.forwardRef)(
194
- function WidgetChrome2({ widget, index, className }, ref) {
162
+ function WidgetChrome2({ widget, index, className, headerToolbar }, ref) {
195
163
  const { widgetTypes, isResolvingWidgetTypes, editMode } = (0, import_dashboard_context.useDashboardInternalContext)();
196
164
  const widgetType = widgetTypes.find((t) => t.name === widget.type);
197
165
  const titleId = (0, import_element.useId)();
@@ -210,14 +178,17 @@ var WidgetChrome = (0, import_element.forwardRef)(
210
178
  {
211
179
  render: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("section", {}),
212
180
  ref,
213
- className: (0, import_clsx.default)(widget_chrome_default.widgetChrome, className),
181
+ className: (0, import_clsx.default)(
182
+ widget_chrome_default["widget-chrome"],
183
+ className
184
+ ),
214
185
  "aria-busy": "true",
215
186
  "aria-label": (0, import_i18n.__)("Loading"),
216
187
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
217
188
  import_ui.Card.Content,
218
189
  {
219
- className: widget_chrome_default.widgetChromeContent,
220
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(LoadingOverlay, {})
190
+ className: widget_chrome_default["widget-chrome-content"],
191
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_widget_frame.LoadingOverlay, {})
221
192
  }
222
193
  )
223
194
  }
@@ -228,44 +199,32 @@ var WidgetChrome = (0, import_element.forwardRef)(
228
199
  {
229
200
  render: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("section", {}),
230
201
  ref,
231
- className: (0, import_clsx.default)(widget_chrome_default.widgetChrome, className),
202
+ className: (0, import_clsx.default)(
203
+ widget_chrome_default["widget-chrome"],
204
+ className
205
+ ),
232
206
  "aria-label": (0, import_i18n.__)("Missing widget"),
233
207
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(UnavailableWidget, { widgetTypeName: widget.type })
234
208
  }
235
209
  ) });
236
210
  }
237
- const { presentation } = widgetType;
238
- const isHeaderHidden = presentation === "full-bleed";
239
- const isBodyBleeding = presentation === "full-bleed" || presentation === "content-bleed";
240
- const header = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Header, { titleId, widgetType });
241
- const body = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(WidgetErrorBoundary, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_element.Suspense, { fallback: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(LoadingOverlay, {}), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_widget_render.WidgetRender, { widget, widgetType }) }) });
242
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_widget_context.WidgetContextProvider, { value: contextValue, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
211
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_widget_context.WidgetContextProvider, { value: contextValue, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
243
212
  import_ui.Card.Root,
244
213
  {
245
214
  render: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("section", {}),
246
215
  ref,
247
- className: (0, import_clsx.default)(widget_chrome_default.widgetChrome, className),
216
+ className: (0, import_clsx.default)(widget_chrome_default["widget-chrome"], className),
248
217
  "aria-labelledby": widgetType.title ? titleId : void 0,
249
- ...editMode ? { inert: "true" } : {},
250
- children: [
251
- isHeaderHidden ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ui.VisuallyHidden, { children: header }) : header,
252
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
253
- import_ui.Card.Content,
254
- {
255
- className: (0, import_clsx.default)(
256
- widget_chrome_default.widgetChromeContent,
257
- isBodyBleeding && widget_chrome_default.widgetChromeContentBleed
258
- ),
259
- children: isBodyBleeding ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
260
- import_ui.Card.FullBleed,
261
- {
262
- className: widget_chrome_default.widgetChromeBleedScroll,
263
- children: body
264
- }
265
- ) : body
266
- }
267
- )
268
- ]
218
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
219
+ import_widget_frame.WidgetFrame,
220
+ {
221
+ widget,
222
+ widgetType,
223
+ titleId,
224
+ editMode,
225
+ headerToolbar
226
+ }
227
+ )
269
228
  }
270
229
  ) });
271
230
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/widget-chrome/widget-chrome.tsx", "../../../../style-runtime/src/index.ts", "../../../src/components/widget-chrome/widget-chrome.module.css"],
4
- "sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\nimport type { ReactNode } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { Spinner } from '@wordpress/components';\nimport {\n\tComponent,\n\tSuspense,\n\tforwardRef,\n\tuseId,\n\tuseMemo,\n} from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { plugins } from '@wordpress/icons';\n// eslint-disable-next-line @wordpress/use-recommended-components\nimport { Card, Icon, Stack, Notice, Text, VisuallyHidden } from '@wordpress/ui';\nimport type { WidgetType } from '@wordpress/widget-primitives';\n\n/**\n * Internal dependencies\n */\nimport { useDashboardInternalContext } from '../../context/dashboard-context';\nimport { WidgetContextProvider } from '../../context/widget-context';\nimport { WidgetRender } from '../widget-render';\nimport styles from './widget-chrome.module.css';\nimport type { DashboardWidget } from '../../types';\n\ninterface ErrorBoundaryProps {\n\tchildren: ReactNode;\n}\n\ninterface ErrorBoundaryState {\n\thasError: boolean;\n}\n\nclass WidgetErrorBoundary extends Component<\n\tErrorBoundaryProps,\n\tErrorBoundaryState\n> {\n\tstate: ErrorBoundaryState = { hasError: false };\n\n\tstatic getDerivedStateFromError(): ErrorBoundaryState {\n\t\treturn { hasError: true };\n\t}\n\n\trender() {\n\t\tif ( this.state.hasError ) {\n\t\t\treturn (\n\t\t\t\t<Notice.Root intent=\"error\">\n\t\t\t\t\t<Notice.Description>\n\t\t\t\t\t\t{ __( 'This widget encountered an error.' ) }\n\t\t\t\t\t</Notice.Description>\n\t\t\t\t</Notice.Root>\n\t\t\t);\n\t\t}\n\t\treturn this.props.children;\n\t}\n}\n\nfunction LoadingOverlay() {\n\treturn (\n\t\t<Stack justify=\"center\" align=\"center\" className={ styles.loading }>\n\t\t\t<Spinner />\n\t\t</Stack>\n\t);\n}\n\ninterface UnavailableWidgetProps {\n\twidgetTypeName: string;\n}\n\nfunction UnavailableWidget( { widgetTypeName }: UnavailableWidgetProps ) {\n\treturn (\n\t\t<>\n\t\t\t<Card.Header>\n\t\t\t\t<span\n\t\t\t\t\tclassName={ styles.widgetChromeHeaderIcon }\n\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t>\n\t\t\t\t\t<Icon icon={ plugins } />\n\t\t\t\t</span>\n\t\t\t</Card.Header>\n\t\t\t<Card.Content className={ styles.widgetChromeContent }>\n\t\t\t\t<Stack\n\t\t\t\t\tdirection=\"column\"\n\t\t\t\t\tjustify=\"center\"\n\t\t\t\t\talign=\"center\"\n\t\t\t\t\tgap=\"md\"\n\t\t\t\t\tclassName={ styles.unavailable }\n\t\t\t\t>\n\t\t\t\t\t<Text>{ __( 'Widget is no longer available.' ) }</Text>\n\t\t\t\t\t<Text render={ <code /> }>{ widgetTypeName }</Text>\n\t\t\t\t</Stack>\n\t\t\t</Card.Content>\n\t\t</>\n\t);\n}\n\ninterface HeaderProps {\n\ttitleId: string;\n\twidgetType: WidgetType;\n}\n\nfunction Header( { titleId, widgetType }: HeaderProps ) {\n\tif ( ! widgetType.title ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Card.Header>\n\t\t\t<Stack direction=\"row\" align=\"center\" gap=\"sm\">\n\t\t\t\t{ widgetType.icon && (\n\t\t\t\t\t<span\n\t\t\t\t\t\tclassName={ styles.widgetChromeHeaderIcon }\n\t\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<Icon icon={ widgetType.icon } />\n\t\t\t\t\t</span>\n\t\t\t\t) }\n\t\t\t\t<Card.Title id={ titleId } render={ <h2 /> }>\n\t\t\t\t\t{ widgetType.title }\n\t\t\t\t</Card.Title>\n\t\t\t</Stack>\n\t\t</Card.Header>\n\t);\n}\n\nexport interface WidgetChromeProps {\n\twidget: DashboardWidget< unknown >;\n\tindex: number;\n\t/**\n\t * Lifted by the surrounding `@wordpress/grid` surface into a sibling\n\t * slot of the grid item; not rendered by `WidgetChrome` itself.\n\t * Living outside `Card.Root` is what keeps these controls interactive\n\t * while edit mode applies `inert` to the chrome.\n\t */\n\tactionableArea?: ReactNode;\n\tclassName?: string;\n}\n\n/**\n * Per-instance wrapper. Owns the chrome around a widget instance: identity\n * context, header (title + icon), edit-mode `inert` attribute, and the\n * error/loading boundaries that keep neighbours mounted when one widget fails\n * or is still resolving.\n */\nexport const WidgetChrome = forwardRef< HTMLDivElement, WidgetChromeProps >(\n\tfunction WidgetChrome( { widget, index, className }, ref ) {\n\t\tconst { widgetTypes, isResolvingWidgetTypes, editMode } =\n\t\t\tuseDashboardInternalContext();\n\t\tconst widgetType = widgetTypes.find( ( t ) => t.name === widget.type );\n\t\tconst titleId = useId();\n\n\t\tconst contextValue = useMemo(\n\t\t\t() => ( {\n\t\t\t\tuuid: widget.uuid,\n\t\t\t\tname: widget.type,\n\t\t\t\tindex,\n\t\t\t} ),\n\t\t\t[ widget.uuid, widget.type, index ]\n\t\t);\n\n\t\tif ( ! widgetType ) {\n\t\t\tif ( isResolvingWidgetTypes ) {\n\t\t\t\treturn (\n\t\t\t\t\t<WidgetContextProvider value={ contextValue }>\n\t\t\t\t\t\t<Card.Root\n\t\t\t\t\t\t\trender={ <section /> }\n\t\t\t\t\t\t\tref={ ref }\n\t\t\t\t\t\t\tclassName={ clsx( styles.widgetChrome, className ) }\n\t\t\t\t\t\t\taria-busy=\"true\"\n\t\t\t\t\t\t\taria-label={ __( 'Loading' ) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<Card.Content\n\t\t\t\t\t\t\t\tclassName={ styles.widgetChromeContent }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<LoadingOverlay />\n\t\t\t\t\t\t\t</Card.Content>\n\t\t\t\t\t\t</Card.Root>\n\t\t\t\t\t</WidgetContextProvider>\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn (\n\t\t\t\t<WidgetContextProvider value={ contextValue }>\n\t\t\t\t\t<Card.Root\n\t\t\t\t\t\trender={ <section /> }\n\t\t\t\t\t\tref={ ref }\n\t\t\t\t\t\tclassName={ clsx( styles.widgetChrome, className ) }\n\t\t\t\t\t\taria-label={ __( 'Missing widget' ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t<UnavailableWidget widgetTypeName={ widget.type } />\n\t\t\t\t\t</Card.Root>\n\t\t\t\t</WidgetContextProvider>\n\t\t\t);\n\t\t}\n\n\t\t// `presentation` encodes two independent axes. `full-bleed` hides\n\t\t// the header; both `full-bleed` and `content-bleed` let the body\n\t\t// break out of the content padding.\n\t\tconst { presentation } = widgetType;\n\t\tconst isHeaderHidden = presentation === 'full-bleed';\n\t\tconst isBodyBleeding =\n\t\t\tpresentation === 'full-bleed' || presentation === 'content-bleed';\n\t\tconst header = <Header titleId={ titleId } widgetType={ widgetType } />;\n\n\t\tconst body = (\n\t\t\t<WidgetErrorBoundary>\n\t\t\t\t<Suspense fallback={ <LoadingOverlay /> }>\n\t\t\t\t\t<WidgetRender widget={ widget } widgetType={ widgetType } />\n\t\t\t\t</Suspense>\n\t\t\t</WidgetErrorBoundary>\n\t\t);\n\n\t\treturn (\n\t\t\t<WidgetContextProvider value={ contextValue }>\n\t\t\t\t<Card.Root\n\t\t\t\t\trender={ <section /> }\n\t\t\t\t\tref={ ref }\n\t\t\t\t\tclassName={ clsx( styles.widgetChrome, className ) }\n\t\t\t\t\taria-labelledby={ widgetType.title ? titleId : undefined }\n\t\t\t\t\t{ ...( editMode ? { inert: 'true' } : {} ) }\n\t\t\t\t>\n\t\t\t\t\t{ isHeaderHidden ? (\n\t\t\t\t\t\t<VisuallyHidden>{ header }</VisuallyHidden>\n\t\t\t\t\t) : (\n\t\t\t\t\t\theader\n\t\t\t\t\t) }\n\n\t\t\t\t\t<Card.Content\n\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\tstyles.widgetChromeContent,\n\t\t\t\t\t\t\tisBodyBleeding && styles.widgetChromeContentBleed\n\t\t\t\t\t\t) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ isBodyBleeding ? (\n\t\t\t\t\t\t\t<Card.FullBleed\n\t\t\t\t\t\t\t\tclassName={ styles.widgetChromeBleedScroll }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ body }\n\t\t\t\t\t\t\t</Card.FullBleed>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\tbody\n\t\t\t\t\t\t) }\n\t\t\t\t\t</Card.Content>\n\t\t\t\t</Card.Root>\n\t\t\t</WidgetContextProvider>\n\t\t);\n\t}\n);\n", "type GlobalScopeWithStyleRuntime = typeof globalThis & {\n\t// This global is shared by separately bundled copies of this package.\n\t// Keep its shape backward compatible after release.\n\t__wpStyleRuntime?: {\n\t\tdocuments: Map< Document, number >;\n\t\tstyles: Map< string, string >;\n\t\tinjectedStyles: WeakMap< Document, Set< string > >;\n\t};\n};\n\nconst STYLE_HASH_ATTRIBUTE = 'data-wp-hash';\n\n/**\n * Returns the shared style runtime registry.\n *\n * The registry is stored on `globalThis` so separately bundled copies of this\n * package can coordinate through the same document and style maps.\n *\n * @return The shared runtime registry.\n */\nfunction getRuntime() {\n\tconst globalScope = globalThis as GlobalScopeWithStyleRuntime;\n\n\tif ( globalScope.__wpStyleRuntime ) {\n\t\treturn globalScope.__wpStyleRuntime;\n\t}\n\n\tglobalScope.__wpStyleRuntime = {\n\t\tdocuments: new Map(),\n\t\tstyles: new Map(),\n\t\tinjectedStyles: new WeakMap(),\n\t};\n\n\tif ( typeof document !== 'undefined' ) {\n\t\tregisterDocument( document );\n\t}\n\n\treturn globalScope.__wpStyleRuntime;\n}\n\n/**\n * Checks whether a document already contains a style tag for a hash.\n *\n * @param targetDocument Document to inspect.\n * @param hash Stable hash for the transformed CSS.\n *\n * @return Whether the style hash already exists in the document.\n */\nfunction documentContainsStyleHash(\n\ttargetDocument: Document,\n\thash: string\n): boolean {\n\tif ( ! targetDocument.head ) {\n\t\treturn false;\n\t}\n\n\tfor ( const style of targetDocument.head.querySelectorAll(\n\t\t`style[${ STYLE_HASH_ATTRIBUTE }]`\n\t) ) {\n\t\tif ( style.getAttribute( STYLE_HASH_ATTRIBUTE ) === hash ) {\n\t\t\treturn true;\n\t\t}\n\t}\n\n\treturn false;\n}\n\n/**\n * Injects a registered style into a document, unless that document already\n * contains a style tag for the same hash.\n *\n * @param targetDocument Document to inject the style into.\n * @param hash Stable hash for the transformed CSS.\n * @param css CSS text to inject.\n */\nfunction injectStyle( targetDocument: Document, hash: string, css: string ) {\n\tif ( ! targetDocument.head ) {\n\t\treturn;\n\t}\n\n\tconst runtime = getRuntime();\n\tlet injectedStyles = runtime.injectedStyles.get( targetDocument );\n\n\tif ( ! injectedStyles ) {\n\t\tinjectedStyles = new Set();\n\t\truntime.injectedStyles.set( targetDocument, injectedStyles );\n\t}\n\n\tif ( injectedStyles.has( hash ) ) {\n\t\treturn;\n\t}\n\n\t// Older generated CSS module output can still inject matching style tags\n\t// after this document's cache is created, so keep the DOM as the fallback\n\t// source of truth on cache misses.\n\tif ( documentContainsStyleHash( targetDocument, hash ) ) {\n\t\tinjectedStyles.add( hash );\n\t\treturn;\n\t}\n\n\tconst style = targetDocument.createElement( 'style' );\n\tstyle.setAttribute( STYLE_HASH_ATTRIBUTE, hash );\n\tstyle.appendChild( targetDocument.createTextNode( css ) );\n\ttargetDocument.head.appendChild( style );\n\tinjectedStyles.add( hash );\n}\n\n/**\n * Registers a document as a style injection target.\n *\n * Existing registered styles are replayed into the document immediately.\n * Documents are reference-counted so multiple providers can safely register the\n * same document without one cleanup removing it while another registration is\n * still active.\n *\n * @param targetDocument Document to receive registered styles.\n * @return Cleanup function that unregisters this document registration.\n */\nexport function registerDocument( targetDocument: Document ) {\n\tconst runtime = getRuntime();\n\n\truntime.documents.set(\n\t\ttargetDocument,\n\t\t( runtime.documents.get( targetDocument ) ?? 0 ) + 1\n\t);\n\n\tfor ( const [ hash, css ] of runtime.styles ) {\n\t\tinjectStyle( targetDocument, hash, css );\n\t}\n\n\treturn () => {\n\t\tconst count = runtime.documents.get( targetDocument );\n\n\t\tif ( count === undefined ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( count <= 1 ) {\n\t\t\truntime.documents.delete( targetDocument );\n\t\t\treturn;\n\t\t}\n\n\t\truntime.documents.set( targetDocument, count - 1 );\n\t};\n}\n\n/**\n * Registers a style and injects it into all registered documents.\n *\n * The hash is used as the deduplication key, so calling this repeatedly with\n * the same hash will not add duplicate style tags to a document.\n * Registered styles are retained for the lifetime of the page so they can be\n * replayed into documents that are registered later.\n *\n * @param hash Stable hash for the transformed CSS.\n * @param css CSS text to inject.\n */\nexport function registerStyle( hash: string, css: string ) {\n\tconst runtime = getRuntime();\n\n\truntime.styles.set( hash, css );\n\n\tfor ( const targetDocument of runtime.documents.keys() ) {\n\t\tinjectStyle( targetDocument, hash, css );\n\t}\n}\n", "import { registerStyle } from '@wordpress/style-runtime';\nif (typeof process === 'undefined' || process.env.NODE_ENV !== 'test') {\n\tregisterStyle(\"345dedc0b8\", \"._79b45ce7d3422efe__widgetChrome{contain:layout;height:100%}._79b45ce7d3422efe__widgetChrome:has(._9f0be51a1b96c8d7__widgetChromeContent :focus-visible){outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9));outline-offset:2px}.d85f7657585b9203__widgetChromeHeaderIcon{color:var(--wpds-color-foreground-content-neutral,#1e1e1e);display:inline-flex}._9f0be51a1b96c8d7__widgetChromeContent{flex:1;height:100%;min-height:0;min-width:0;overflow-y:auto}._21770471c9c2115b__widgetChromeContentBleed{padding-block:0}._229727240ac2aa18__widgetChromeBleedScroll{height:100%;margin-block-end:0;overflow-y:auto}._3c919e86d1bb80ab__loading,._9b694d63bdec1a98__unavailable{height:100%}\");\n}\nexport default {\"widgetChrome\":\"_79b45ce7d3422efe__widgetChrome\",\"widgetChromeContent\":\"_9f0be51a1b96c8d7__widgetChromeContent\",\"widgetChromeHeaderIcon\":\"d85f7657585b9203__widgetChromeHeaderIcon\",\"widgetChromeContentBleed\":\"_21770471c9c2115b__widgetChromeContentBleed\",\"widgetChromeBleedScroll\":\"_229727240ac2aa18__widgetChromeBleedScroll\",\"loading\":\"_3c919e86d1bb80ab__loading\",\"unavailable\":\"_9b694d63bdec1a98__unavailable\"};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAMjB,wBAAwB;AACxB,qBAMO;AACP,kBAAmB;AACnB,mBAAwB;AAExB,gBAAgE;AAMhE,+BAA4C;AAC5C,4BAAsC;AACtC,2BAA6B;;;AClB7B,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,M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;AAAA,cAC1B;AAAA,cAEE,2BACD;AAAA,gBAAC,eAAK;AAAA,gBAAL;AAAA,kBACA,WAAY,sBAAO;AAAA,kBAEjB;AAAA;AAAA,cACH,IAEA;AAAA;AAAA,UAEF;AAAA;AAAA;AAAA,IACD,GACD;AAAA,EAEF;AACD;",
4
+ "sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\nimport type { ReactNode } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { forwardRef, useId, useMemo } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { plugins } from '@wordpress/icons';\nimport { Card, Icon, Stack, Text } from '@wordpress/ui';\n\n/**\n * Internal dependencies\n */\nimport { useDashboardInternalContext } from '../../context/dashboard-context';\nimport { WidgetContextProvider } from '../../context/widget-context';\nimport { LoadingOverlay, WidgetFrame } from '../widget-frame';\nimport styles from './widget-chrome.module.css';\nimport type { DashboardWidget } from '../../types';\n\ninterface UnavailableWidgetProps {\n\twidgetTypeName: string;\n}\n\nfunction UnavailableWidget( { widgetTypeName }: UnavailableWidgetProps ) {\n\treturn (\n\t\t<>\n\t\t\t<Card.Header>\n\t\t\t\t<span\n\t\t\t\t\tclassName={ styles[ 'widget-chrome-header-icon' ] }\n\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t>\n\t\t\t\t\t<Icon icon={ plugins } />\n\t\t\t\t</span>\n\t\t\t</Card.Header>\n\t\t\t<Card.Content className={ styles[ 'widget-chrome-content' ] }>\n\t\t\t\t<Stack\n\t\t\t\t\tdirection=\"column\"\n\t\t\t\t\tjustify=\"center\"\n\t\t\t\t\talign=\"center\"\n\t\t\t\t\tgap=\"md\"\n\t\t\t\t\tclassName={ styles.unavailable }\n\t\t\t\t>\n\t\t\t\t\t<Text>{ __( 'Widget is no longer available.' ) }</Text>\n\t\t\t\t\t<Text render={ <code /> }>{ widgetTypeName }</Text>\n\t\t\t\t</Stack>\n\t\t\t</Card.Content>\n\t\t</>\n\t);\n}\n\nexport interface WidgetChromeProps {\n\twidget: DashboardWidget< unknown >;\n\tindex: number;\n\t/**\n\t * Lifted by `@wordpress/grid` into a sibling slot outside `Card.Root`,\n\t * for full-bleed widgets with no in-card header to host the toolbar.\n\t */\n\tactionableArea?: ReactNode;\n\t/**\n\t * Toolbar rendered in the in-card header (framed and content-bleed).\n\t */\n\theaderToolbar?: ReactNode;\n\tclassName?: string;\n}\n\n/**\n * Dashboard chrome: wraps `WidgetFrame` in the grid tile's `Card.Root`, owning\n * the missing and resolving states.\n */\nexport const WidgetChrome = forwardRef< HTMLDivElement, WidgetChromeProps >(\n\tfunction WidgetChrome( { widget, index, className, headerToolbar }, ref ) {\n\t\tconst { widgetTypes, isResolvingWidgetTypes, editMode } =\n\t\t\tuseDashboardInternalContext();\n\t\tconst widgetType = widgetTypes.find( ( t ) => t.name === widget.type );\n\t\tconst titleId = useId();\n\n\t\tconst contextValue = useMemo(\n\t\t\t() => ( {\n\t\t\t\tuuid: widget.uuid,\n\t\t\t\tname: widget.type,\n\t\t\t\tindex,\n\t\t\t} ),\n\t\t\t[ widget.uuid, widget.type, index ]\n\t\t);\n\n\t\tif ( ! widgetType ) {\n\t\t\tif ( isResolvingWidgetTypes ) {\n\t\t\t\treturn (\n\t\t\t\t\t<WidgetContextProvider value={ contextValue }>\n\t\t\t\t\t\t<Card.Root\n\t\t\t\t\t\t\trender={ <section /> }\n\t\t\t\t\t\t\tref={ ref }\n\t\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t\tstyles[ 'widget-chrome' ],\n\t\t\t\t\t\t\t\tclassName\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\taria-busy=\"true\"\n\t\t\t\t\t\t\taria-label={ __( 'Loading' ) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<Card.Content\n\t\t\t\t\t\t\t\tclassName={ styles[ 'widget-chrome-content' ] }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<LoadingOverlay />\n\t\t\t\t\t\t\t</Card.Content>\n\t\t\t\t\t\t</Card.Root>\n\t\t\t\t\t</WidgetContextProvider>\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn (\n\t\t\t\t<WidgetContextProvider value={ contextValue }>\n\t\t\t\t\t<Card.Root\n\t\t\t\t\t\trender={ <section /> }\n\t\t\t\t\t\tref={ ref }\n\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\tstyles[ 'widget-chrome' ],\n\t\t\t\t\t\t\tclassName\n\t\t\t\t\t\t) }\n\t\t\t\t\t\taria-label={ __( 'Missing widget' ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t<UnavailableWidget widgetTypeName={ widget.type } />\n\t\t\t\t\t</Card.Root>\n\t\t\t\t</WidgetContextProvider>\n\t\t\t);\n\t\t}\n\n\t\treturn (\n\t\t\t<WidgetContextProvider value={ contextValue }>\n\t\t\t\t<Card.Root\n\t\t\t\t\trender={ <section /> }\n\t\t\t\t\tref={ ref }\n\t\t\t\t\tclassName={ clsx( styles[ 'widget-chrome' ], className ) }\n\t\t\t\t\taria-labelledby={ widgetType.title ? titleId : undefined }\n\t\t\t\t>\n\t\t\t\t\t<WidgetFrame\n\t\t\t\t\t\twidget={ widget }\n\t\t\t\t\t\twidgetType={ widgetType }\n\t\t\t\t\t\ttitleId={ titleId }\n\t\t\t\t\t\teditMode={ editMode }\n\t\t\t\t\t\theaderToolbar={ headerToolbar }\n\t\t\t\t\t/>\n\t\t\t\t</Card.Root>\n\t\t\t</WidgetContextProvider>\n\t\t);\n\t}\n);\n", "type GlobalScopeWithStyleRuntime = typeof globalThis & {\n\t// This global is shared by separately bundled copies of this package.\n\t// Keep its shape backward compatible after release.\n\t__wpStyleRuntime?: {\n\t\tdocuments: Map< Document, number >;\n\t\tstyles: Map< string, string >;\n\t\tinjectedStyles: WeakMap< Document, Set< string > >;\n\t};\n};\n\nconst STYLE_HASH_ATTRIBUTE = 'data-wp-hash';\n\n/**\n * Returns the shared style runtime registry.\n *\n * The registry is stored on `globalThis` so separately bundled copies of this\n * package can coordinate through the same document and style maps.\n *\n * @return The shared runtime registry.\n */\nfunction getRuntime() {\n\tconst globalScope = globalThis as GlobalScopeWithStyleRuntime;\n\n\tif ( globalScope.__wpStyleRuntime ) {\n\t\treturn globalScope.__wpStyleRuntime;\n\t}\n\n\tglobalScope.__wpStyleRuntime = {\n\t\tdocuments: new Map(),\n\t\tstyles: new Map(),\n\t\tinjectedStyles: new WeakMap(),\n\t};\n\n\tif ( typeof document !== 'undefined' ) {\n\t\tregisterDocument( document );\n\t}\n\n\treturn globalScope.__wpStyleRuntime;\n}\n\n/**\n * Checks whether a document already contains a style tag for a hash.\n *\n * @param targetDocument Document to inspect.\n * @param hash Stable hash for the transformed CSS.\n *\n * @return Whether the style hash already exists in the document.\n */\nfunction documentContainsStyleHash(\n\ttargetDocument: Document,\n\thash: string\n): boolean {\n\tif ( ! targetDocument.head ) {\n\t\treturn false;\n\t}\n\n\tfor ( const style of targetDocument.head.querySelectorAll(\n\t\t`style[${ STYLE_HASH_ATTRIBUTE }]`\n\t) ) {\n\t\tif ( style.getAttribute( STYLE_HASH_ATTRIBUTE ) === hash ) {\n\t\t\treturn true;\n\t\t}\n\t}\n\n\treturn false;\n}\n\n/**\n * Injects a registered style into a document, unless that document already\n * contains a style tag for the same hash.\n *\n * @param targetDocument Document to inject the style into.\n * @param hash Stable hash for the transformed CSS.\n * @param css CSS text to inject.\n */\nfunction injectStyle( targetDocument: Document, hash: string, css: string ) {\n\tif ( ! targetDocument.head ) {\n\t\treturn;\n\t}\n\n\tconst runtime = getRuntime();\n\tlet injectedStyles = runtime.injectedStyles.get( targetDocument );\n\n\tif ( ! injectedStyles ) {\n\t\tinjectedStyles = new Set();\n\t\truntime.injectedStyles.set( targetDocument, injectedStyles );\n\t}\n\n\tif ( injectedStyles.has( hash ) ) {\n\t\treturn;\n\t}\n\n\t// Older generated CSS module output can still inject matching style tags\n\t// after this document's cache is created, so keep the DOM as the fallback\n\t// source of truth on cache misses.\n\tif ( documentContainsStyleHash( targetDocument, hash ) ) {\n\t\tinjectedStyles.add( hash );\n\t\treturn;\n\t}\n\n\tconst style = targetDocument.createElement( 'style' );\n\tstyle.setAttribute( STYLE_HASH_ATTRIBUTE, hash );\n\tstyle.appendChild( targetDocument.createTextNode( css ) );\n\ttargetDocument.head.appendChild( style );\n\tinjectedStyles.add( hash );\n}\n\n/**\n * Registers a document as a style injection target.\n *\n * Existing registered styles are replayed into the document immediately.\n * Documents are reference-counted so multiple providers can safely register the\n * same document without one cleanup removing it while another registration is\n * still active.\n *\n * @param targetDocument Document to receive registered styles.\n * @return Cleanup function that unregisters this document registration.\n */\nexport function registerDocument( targetDocument: Document ) {\n\tconst runtime = getRuntime();\n\n\truntime.documents.set(\n\t\ttargetDocument,\n\t\t( runtime.documents.get( targetDocument ) ?? 0 ) + 1\n\t);\n\n\tfor ( const [ hash, css ] of runtime.styles ) {\n\t\tinjectStyle( targetDocument, hash, css );\n\t}\n\n\treturn () => {\n\t\tconst count = runtime.documents.get( targetDocument );\n\n\t\tif ( count === undefined ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( count <= 1 ) {\n\t\t\truntime.documents.delete( targetDocument );\n\t\t\treturn;\n\t\t}\n\n\t\truntime.documents.set( targetDocument, count - 1 );\n\t};\n}\n\n/**\n * Registers a style and injects it into all registered documents.\n *\n * The hash is used as the deduplication key, so calling this repeatedly with\n * the same hash will not add duplicate style tags to a document.\n * Registered styles are retained for the lifetime of the page so they can be\n * replayed into documents that are registered later.\n *\n * @param hash Stable hash for the transformed CSS.\n * @param css CSS text to inject.\n */\nexport function registerStyle( hash: string, css: string ) {\n\tconst runtime = getRuntime();\n\n\truntime.styles.set( hash, css );\n\n\tfor ( const targetDocument of runtime.documents.keys() ) {\n\t\tinjectStyle( targetDocument, hash, css );\n\t}\n}\n", "import { registerStyle } from '@wordpress/style-runtime';\nif (typeof process === 'undefined' || process.env.NODE_ENV !== 'test') {\n\tregisterStyle(\"9c052414dc\", \".c10bdb70b86e7888__widget-chrome:has(:focus-visible){outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9));outline-offset:var(--wp-widget-dashboard-tile-focus-offset,2px)}._05be5860e5abb8bb__widget-chrome-header-icon{color:var(--wpds-color-foreground-content-neutral,#1e1e1e);display:inline-flex}.a7e5c80edbcdf3f5__widget-chrome-content{flex:1;height:100%;min-height:0;min-width:0}._9b694d63bdec1a98__unavailable{height:100%}\");\n}\nexport default {\"widget-chrome\":\"c10bdb70b86e7888__widget-chrome\",\"widget-chrome-header-icon\":\"_05be5860e5abb8bb__widget-chrome-header-icon\",\"widget-chrome-content\":\"a7e5c80edbcdf3f5__widget-chrome-content\",\"unavailable\":\"_9b694d63bdec1a98__unavailable\"};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAMjB,qBAA2C;AAC3C,kBAAmB;AACnB,mBAAwB;AACxB,gBAAwC;AAKxC,+BAA4C;AAC5C,4BAAsC;AACtC,0BAA4C;;;ACT5C,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,oBAA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=> __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
 
20
- // packages/widget-dashboard/src/components/layout-settings/index.ts
21
- var layout_settings_exports = {};
22
- __export(layout_settings_exports, {
23
- LayoutSettings: () => import_layout_settings.LayoutSettings
20
+ // packages/widget-dashboard/src/components/widget-frame/index.ts
21
+ var widget_frame_exports = {};
22
+ __export(widget_frame_exports, {
23
+ LoadingOverlay: () => import_widget_frame.LoadingOverlay,
24
+ WidgetFrame: () => import_widget_frame.WidgetFrame
24
25
  });
25
- module.exports = __toCommonJS(layout_settings_exports);
26
- var import_layout_settings = require("./layout-settings.cjs");
26
+ module.exports = __toCommonJS(widget_frame_exports);
27
+ var import_widget_frame = require("./widget-frame.cjs");
27
28
  // Annotate the CommonJS export names for ESM import in node:
28
29
  0 && (module.exports = {
29
- LayoutSettings
30
+ LoadingOverlay,
31
+ WidgetFrame
30
32
  });
31
33
  //# sourceMappingURL=index.cjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/widget-frame/index.ts"],
4
+ "sourcesContent": ["export { WidgetFrame, LoadingOverlay } from './widget-frame';\nexport type { WidgetFrameProps } from './widget-frame';\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAA4C;",
6
+ "names": []
7
+ }
@@ -0,0 +1,193 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // packages/widget-dashboard/src/components/widget-frame/widget-frame.tsx
31
+ var widget_frame_exports = {};
32
+ __export(widget_frame_exports, {
33
+ LoadingOverlay: () => LoadingOverlay,
34
+ WidgetFrame: () => WidgetFrame
35
+ });
36
+ module.exports = __toCommonJS(widget_frame_exports);
37
+ var import_clsx = __toESM(require("clsx"));
38
+ var import_components = require("@wordpress/components");
39
+ var import_element = require("@wordpress/element");
40
+ var import_i18n = require("@wordpress/i18n");
41
+ var import_ui = require("@wordpress/ui");
42
+ var import_widget_header = require("../widget-header/index.cjs");
43
+ var import_widget_render = require("../widget-render/index.cjs");
44
+
45
+ // packages/style-runtime/src/index.ts
46
+ var STYLE_HASH_ATTRIBUTE = "data-wp-hash";
47
+ function getRuntime() {
48
+ const globalScope = globalThis;
49
+ if (globalScope.__wpStyleRuntime) {
50
+ return globalScope.__wpStyleRuntime;
51
+ }
52
+ globalScope.__wpStyleRuntime = {
53
+ documents: /* @__PURE__ */ new Map(),
54
+ styles: /* @__PURE__ */ new Map(),
55
+ injectedStyles: /* @__PURE__ */ new WeakMap()
56
+ };
57
+ if (typeof document !== "undefined") {
58
+ registerDocument(document);
59
+ }
60
+ return globalScope.__wpStyleRuntime;
61
+ }
62
+ function documentContainsStyleHash(targetDocument, hash) {
63
+ if (!targetDocument.head) {
64
+ return false;
65
+ }
66
+ for (const style of targetDocument.head.querySelectorAll(
67
+ `style[${STYLE_HASH_ATTRIBUTE}]`
68
+ )) {
69
+ if (style.getAttribute(STYLE_HASH_ATTRIBUTE) === hash) {
70
+ return true;
71
+ }
72
+ }
73
+ return false;
74
+ }
75
+ function injectStyle(targetDocument, hash, css) {
76
+ if (!targetDocument.head) {
77
+ return;
78
+ }
79
+ const runtime = getRuntime();
80
+ let injectedStyles = runtime.injectedStyles.get(targetDocument);
81
+ if (!injectedStyles) {
82
+ injectedStyles = /* @__PURE__ */ new Set();
83
+ runtime.injectedStyles.set(targetDocument, injectedStyles);
84
+ }
85
+ if (injectedStyles.has(hash)) {
86
+ return;
87
+ }
88
+ if (documentContainsStyleHash(targetDocument, hash)) {
89
+ injectedStyles.add(hash);
90
+ return;
91
+ }
92
+ const style = targetDocument.createElement("style");
93
+ style.setAttribute(STYLE_HASH_ATTRIBUTE, hash);
94
+ style.appendChild(targetDocument.createTextNode(css));
95
+ targetDocument.head.appendChild(style);
96
+ injectedStyles.add(hash);
97
+ }
98
+ function registerDocument(targetDocument) {
99
+ const runtime = getRuntime();
100
+ runtime.documents.set(
101
+ targetDocument,
102
+ (runtime.documents.get(targetDocument) ?? 0) + 1
103
+ );
104
+ for (const [hash, css] of runtime.styles) {
105
+ injectStyle(targetDocument, hash, css);
106
+ }
107
+ return () => {
108
+ const count = runtime.documents.get(targetDocument);
109
+ if (count === void 0) {
110
+ return;
111
+ }
112
+ if (count <= 1) {
113
+ runtime.documents.delete(targetDocument);
114
+ return;
115
+ }
116
+ runtime.documents.set(targetDocument, count - 1);
117
+ };
118
+ }
119
+ function registerStyle(hash, css) {
120
+ const runtime = getRuntime();
121
+ runtime.styles.set(hash, css);
122
+ for (const targetDocument of runtime.documents.keys()) {
123
+ injectStyle(targetDocument, hash, css);
124
+ }
125
+ }
126
+
127
+ // packages/widget-dashboard/src/components/widget-frame/widget-frame.module.css
128
+ if (typeof process === "undefined" || process.env.NODE_ENV !== "test") {
129
+ registerStyle("ca39d884d8", "._5848d9de101def77__content{flex:1;height:100%;min-height:0;min-width:0;overflow-y:auto}._998dd9aeb82b1f6a__bleed-content{padding:0}._605aa8383905f0a9__loading{height:100%}");
130
+ }
131
+ var widget_frame_default = { "content": "_5848d9de101def77__content", "bleed-content": "_998dd9aeb82b1f6a__bleed-content", "loading": "_605aa8383905f0a9__loading" };
132
+
133
+ // packages/widget-dashboard/src/components/widget-frame/widget-frame.tsx
134
+ var import_jsx_runtime = require("react/jsx-runtime");
135
+ var WidgetErrorBoundary = class extends import_element.Component {
136
+ state = { hasError: false };
137
+ static getDerivedStateFromError() {
138
+ return { hasError: true };
139
+ }
140
+ render() {
141
+ if (this.state.hasError) {
142
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ui.Notice.Root, { intent: "error", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ui.Notice.Description, { children: (0, import_i18n.__)("This widget encountered an error.") }) });
143
+ }
144
+ return this.props.children;
145
+ }
146
+ };
147
+ function LoadingOverlay() {
148
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ui.Stack, { justify: "center", align: "center", className: widget_frame_default.loading, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.Spinner, {}) });
149
+ }
150
+ function WidgetFrame({
151
+ widget,
152
+ widgetType,
153
+ titleId,
154
+ editMode = false,
155
+ headerToolbar
156
+ }) {
157
+ const { presentation } = widgetType;
158
+ const isHeaderHidden = presentation === "full-bleed";
159
+ const isBodyBleeding = presentation === "full-bleed" || presentation === "content-bleed";
160
+ const body = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(WidgetErrorBoundary, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_element.Suspense, { fallback: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(LoadingOverlay, {}), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_widget_render.WidgetRender, { widget, widgetType }) }) });
161
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
162
+ !isHeaderHidden && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
163
+ import_widget_header.WidgetHeader,
164
+ {
165
+ showIdentity: true,
166
+ widgetType,
167
+ titleId,
168
+ editMode,
169
+ children: headerToolbar
170
+ }
171
+ ),
172
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
173
+ import_ui.Card.Content,
174
+ {
175
+ className: (0, import_clsx.default)(
176
+ widget_frame_default.content,
177
+ isBodyBleeding && widget_frame_default["bleed-content"]
178
+ ),
179
+ ...editMode ? { inert: "true" } : {},
180
+ children: [
181
+ isHeaderHidden && widgetType.title && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ui.VisuallyHidden, { render: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", { id: titleId }), children: widgetType.title }),
182
+ body
183
+ ]
184
+ }
185
+ )
186
+ ] });
187
+ }
188
+ // Annotate the CommonJS export names for ESM import in node:
189
+ 0 && (module.exports = {
190
+ LoadingOverlay,
191
+ WidgetFrame
192
+ });
193
+ //# sourceMappingURL=widget-frame.cjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/widget-frame/widget-frame.tsx", "../../../../style-runtime/src/index.ts", "../../../src/components/widget-frame/widget-frame.module.css"],
4
+ "sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\nimport type { ReactNode } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { Spinner } from '@wordpress/components';\nimport { Component, Suspense } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\n// eslint-disable-next-line @wordpress/use-recommended-components\nimport { Card, Notice, Stack, VisuallyHidden } from '@wordpress/ui';\nimport type { WidgetType } from '@wordpress/widget-primitives';\n\n/**\n * Internal dependencies\n */\nimport { WidgetHeader } from '../widget-header';\nimport { WidgetRender } from '../widget-render';\nimport styles from './widget-frame.module.css';\nimport type { DashboardWidget } from '../../types';\n\ninterface ErrorBoundaryProps {\n\tchildren: ReactNode;\n}\n\ninterface ErrorBoundaryState {\n\thasError: boolean;\n}\n\nclass WidgetErrorBoundary extends Component<\n\tErrorBoundaryProps,\n\tErrorBoundaryState\n> {\n\tstate: ErrorBoundaryState = { hasError: false };\n\n\tstatic getDerivedStateFromError(): ErrorBoundaryState {\n\t\treturn { hasError: true };\n\t}\n\n\trender() {\n\t\tif ( this.state.hasError ) {\n\t\t\treturn (\n\t\t\t\t<Notice.Root intent=\"error\">\n\t\t\t\t\t<Notice.Description>\n\t\t\t\t\t\t{ __( 'This widget encountered an error.' ) }\n\t\t\t\t\t</Notice.Description>\n\t\t\t\t</Notice.Root>\n\t\t\t);\n\t\t}\n\t\treturn this.props.children;\n\t}\n}\n\n/* Centered spinner for resolving and Suspense waits. */\nexport function LoadingOverlay() {\n\treturn (\n\t\t<Stack justify=\"center\" align=\"center\" className={ styles.loading }>\n\t\t\t<Spinner />\n\t\t</Stack>\n\t);\n}\n\nexport interface WidgetFrameProps {\n\twidget: DashboardWidget< unknown >;\n\twidgetType: WidgetType;\n\ttitleId: string;\n\n\t/**\n\t * Inert the body and identity while customizing.\n\t */\n\teditMode?: boolean;\n\n\t/**\n\t * Toolbar shown beside the identity in the in-card header.\n\t */\n\theaderToolbar?: ReactNode;\n}\n\n/**\n * Shared framing: `presentation` into header + content, with the error/loading\n * boundaries. Hosts supply the `Card.Root` and their own concerns.\n *\n * @param {WidgetFrameProps} props Component props.\n */\nexport function WidgetFrame( {\n\twidget,\n\twidgetType,\n\ttitleId,\n\teditMode = false,\n\theaderToolbar,\n}: WidgetFrameProps ) {\n\t// full-bleed hides the header; full-bleed and content-bleed bleed the body.\n\tconst { presentation } = widgetType;\n\tconst isHeaderHidden = presentation === 'full-bleed';\n\tconst isBodyBleeding =\n\t\tpresentation === 'full-bleed' || presentation === 'content-bleed';\n\n\tconst body = (\n\t\t<WidgetErrorBoundary>\n\t\t\t<Suspense fallback={ <LoadingOverlay /> }>\n\t\t\t\t<WidgetRender widget={ widget } widgetType={ widgetType } />\n\t\t\t</Suspense>\n\t\t</WidgetErrorBoundary>\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t{ ! isHeaderHidden && (\n\t\t\t\t<WidgetHeader\n\t\t\t\t\tshowIdentity\n\t\t\t\t\twidgetType={ widgetType }\n\t\t\t\t\ttitleId={ titleId }\n\t\t\t\t\teditMode={ editMode }\n\t\t\t\t>\n\t\t\t\t\t{ headerToolbar }\n\t\t\t\t</WidgetHeader>\n\t\t\t) }\n\n\t\t\t<Card.Content\n\t\t\t\tclassName={ clsx(\n\t\t\t\t\tstyles.content,\n\t\t\t\t\tisBodyBleeding && styles[ 'bleed-content' ]\n\t\t\t\t) }\n\t\t\t\t{ ...( editMode ? { inert: 'true' } : {} ) }\n\t\t\t>\n\t\t\t\t{ isHeaderHidden && widgetType.title && (\n\t\t\t\t\t<VisuallyHidden render={ <h2 id={ titleId } /> }>\n\t\t\t\t\t\t{ widgetType.title }\n\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t) }\n\t\t\t\t{ body }\n\t\t\t</Card.Content>\n\t\t</>\n\t);\n}\n", "type GlobalScopeWithStyleRuntime = typeof globalThis & {\n\t// This global is shared by separately bundled copies of this package.\n\t// Keep its shape backward compatible after release.\n\t__wpStyleRuntime?: {\n\t\tdocuments: Map< Document, number >;\n\t\tstyles: Map< string, string >;\n\t\tinjectedStyles: WeakMap< Document, Set< string > >;\n\t};\n};\n\nconst STYLE_HASH_ATTRIBUTE = 'data-wp-hash';\n\n/**\n * Returns the shared style runtime registry.\n *\n * The registry is stored on `globalThis` so separately bundled copies of this\n * package can coordinate through the same document and style maps.\n *\n * @return The shared runtime registry.\n */\nfunction getRuntime() {\n\tconst globalScope = globalThis as GlobalScopeWithStyleRuntime;\n\n\tif ( globalScope.__wpStyleRuntime ) {\n\t\treturn globalScope.__wpStyleRuntime;\n\t}\n\n\tglobalScope.__wpStyleRuntime = {\n\t\tdocuments: new Map(),\n\t\tstyles: new Map(),\n\t\tinjectedStyles: new WeakMap(),\n\t};\n\n\tif ( typeof document !== 'undefined' ) {\n\t\tregisterDocument( document );\n\t}\n\n\treturn globalScope.__wpStyleRuntime;\n}\n\n/**\n * Checks whether a document already contains a style tag for a hash.\n *\n * @param targetDocument Document to inspect.\n * @param hash Stable hash for the transformed CSS.\n *\n * @return Whether the style hash already exists in the document.\n */\nfunction documentContainsStyleHash(\n\ttargetDocument: Document,\n\thash: string\n): boolean {\n\tif ( ! targetDocument.head ) {\n\t\treturn false;\n\t}\n\n\tfor ( const style of targetDocument.head.querySelectorAll(\n\t\t`style[${ STYLE_HASH_ATTRIBUTE }]`\n\t) ) {\n\t\tif ( style.getAttribute( STYLE_HASH_ATTRIBUTE ) === hash ) {\n\t\t\treturn true;\n\t\t}\n\t}\n\n\treturn false;\n}\n\n/**\n * Injects a registered style into a document, unless that document already\n * contains a style tag for the same hash.\n *\n * @param targetDocument Document to inject the style into.\n * @param hash Stable hash for the transformed CSS.\n * @param css CSS text to inject.\n */\nfunction injectStyle( targetDocument: Document, hash: string, css: string ) {\n\tif ( ! targetDocument.head ) {\n\t\treturn;\n\t}\n\n\tconst runtime = getRuntime();\n\tlet injectedStyles = runtime.injectedStyles.get( targetDocument );\n\n\tif ( ! injectedStyles ) {\n\t\tinjectedStyles = new Set();\n\t\truntime.injectedStyles.set( targetDocument, injectedStyles );\n\t}\n\n\tif ( injectedStyles.has( hash ) ) {\n\t\treturn;\n\t}\n\n\t// Older generated CSS module output can still inject matching style tags\n\t// after this document's cache is created, so keep the DOM as the fallback\n\t// source of truth on cache misses.\n\tif ( documentContainsStyleHash( targetDocument, hash ) ) {\n\t\tinjectedStyles.add( hash );\n\t\treturn;\n\t}\n\n\tconst style = targetDocument.createElement( 'style' );\n\tstyle.setAttribute( STYLE_HASH_ATTRIBUTE, hash );\n\tstyle.appendChild( targetDocument.createTextNode( css ) );\n\ttargetDocument.head.appendChild( style );\n\tinjectedStyles.add( hash );\n}\n\n/**\n * Registers a document as a style injection target.\n *\n * Existing registered styles are replayed into the document immediately.\n * Documents are reference-counted so multiple providers can safely register the\n * same document without one cleanup removing it while another registration is\n * still active.\n *\n * @param targetDocument Document to receive registered styles.\n * @return Cleanup function that unregisters this document registration.\n */\nexport function registerDocument( targetDocument: Document ) {\n\tconst runtime = getRuntime();\n\n\truntime.documents.set(\n\t\ttargetDocument,\n\t\t( runtime.documents.get( targetDocument ) ?? 0 ) + 1\n\t);\n\n\tfor ( const [ hash, css ] of runtime.styles ) {\n\t\tinjectStyle( targetDocument, hash, css );\n\t}\n\n\treturn () => {\n\t\tconst count = runtime.documents.get( targetDocument );\n\n\t\tif ( count === undefined ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( count <= 1 ) {\n\t\t\truntime.documents.delete( targetDocument );\n\t\t\treturn;\n\t\t}\n\n\t\truntime.documents.set( targetDocument, count - 1 );\n\t};\n}\n\n/**\n * Registers a style and injects it into all registered documents.\n *\n * The hash is used as the deduplication key, so calling this repeatedly with\n * the same hash will not add duplicate style tags to a document.\n * Registered styles are retained for the lifetime of the page so they can be\n * replayed into documents that are registered later.\n *\n * @param hash Stable hash for the transformed CSS.\n * @param css CSS text to inject.\n */\nexport function registerStyle( hash: string, css: string ) {\n\tconst runtime = getRuntime();\n\n\truntime.styles.set( hash, css );\n\n\tfor ( const targetDocument of runtime.documents.keys() ) {\n\t\tinjectStyle( targetDocument, hash, css );\n\t}\n}\n", "import { registerStyle } from '@wordpress/style-runtime';\nif (typeof process === 'undefined' || process.env.NODE_ENV !== 'test') {\n\tregisterStyle(\"ca39d884d8\", \"._5848d9de101def77__content{flex:1;height:100%;min-height:0;min-width:0;overflow-y:auto}._998dd9aeb82b1f6a__bleed-content{padding:0}._605aa8383905f0a9__loading{height:100%}\");\n}\nexport default {\"content\":\"_5848d9de101def77__content\",\"bleed-content\":\"_998dd9aeb82b1f6a__bleed-content\",\"loading\":\"_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EAAY,QAAO,SACnB,sDAAC,iBAAO,aAAP,EACE,8BAAI,mCAAoC,GAC3C,GACD;AAAA,IAEF;AACA,WAAO,KAAK,MAAM;AAAA,EACnB;AACD;AAGO,SAAS,iBAAiB;AAChC,SACC,4CAAC,mBAAM,SAAQ,UAAS,OAAM,UAAS,WAAY,qBAAO,SACzD,sDAAC,6BAAQ,GACV;AAEF;AAwBO,SAAS,YAAa;AAAA,EAC5B;AAAA,EACA;AAAA,EACA;AAAA,EACA,WAAW;AAAA,EACX;AACD,GAAsB;AAErB,QAAM,EAAE,aAAa,IAAI;AACzB,QAAM,iBAAiB,iBAAiB;AACxC,QAAM,iBACL,iBAAiB,gBAAgB,iBAAiB;AAEnD,QAAM,OACL,4CAAC,uBACA,sDAAC,2BAAS,UAAW,4CAAC,kBAAe,GACpC,sDAAC,qCAAa,QAAkB,YAA0B,GAC3D,GACD;AAGD,SACC,4EACG;AAAA,KAAE,kBACH;AAAA,MAAC;AAAA;AAAA,QACA,cAAY;AAAA,QACZ;AAAA,QACA;AAAA,QACA;AAAA,QAEE;AAAA;AAAA,IACH;AAAA,IAGD;AAAA,MAAC,eAAK;AAAA,MAAL;AAAA,QACA,eAAY,YAAAA;AAAA,UACX,qBAAO;AAAA,UACP,kBAAkB,qBAAQ,eAAgB;AAAA,QAC3C;AAAA,QACE,GAAK,WAAW,EAAE,OAAO,OAAO,IAAI,CAAC;AAAA,QAErC;AAAA,4BAAkB,WAAW,SAC9B,4CAAC,4BAAe,QAAS,4CAAC,QAAG,IAAK,SAAU,GACzC,qBAAW,OACd;AAAA,UAEC;AAAA;AAAA;AAAA,IACH;AAAA,KACD;AAEF;",
6
+ "names": ["clsx"]
7
+ }
@@ -17,15 +17,15 @@ var __copyProps = (to, from, except, desc) => {
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
 
20
- // packages/widget-dashboard/src/utils/migrate-layout/index.ts
21
- var migrate_layout_exports = {};
22
- __export(migrate_layout_exports, {
23
- migrateLayout: () => import_migrate_layout.migrateLayout
20
+ // packages/widget-dashboard/src/components/widget-header/index.ts
21
+ var widget_header_exports = {};
22
+ __export(widget_header_exports, {
23
+ WidgetHeader: () => import_widget_header.WidgetHeader
24
24
  });
25
- module.exports = __toCommonJS(migrate_layout_exports);
26
- var import_migrate_layout = require("./migrate-layout.cjs");
25
+ module.exports = __toCommonJS(widget_header_exports);
26
+ var import_widget_header = require("./widget-header.cjs");
27
27
  // Annotate the CommonJS export names for ESM import in node:
28
28
  0 && (module.exports = {
29
- migrateLayout
29
+ WidgetHeader
30
30
  });
31
31
  //# sourceMappingURL=index.cjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/widget-header/index.ts"],
4
+ "sourcesContent": ["export { WidgetHeader } from './widget-header';\nexport type { WidgetHeaderProps } from './widget-header';\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,2BAA6B;",
6
+ "names": []
7
+ }