@wordpress/widget-dashboard 0.1.1 → 0.3.1-next.v.202607070741.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (269) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/README.md +10 -16
  3. package/build/components/actions/actions.cjs +2 -19
  4. package/build/components/actions/actions.cjs.map +3 -3
  5. package/build/components/commands/commands.cjs +1 -60
  6. package/build/components/commands/commands.cjs.map +2 -2
  7. package/build/{utils/grid-model-change → components/widget-attribute-controls}/index.cjs +7 -9
  8. package/build/components/widget-attribute-controls/index.cjs.map +7 -0
  9. package/build/components/widget-attribute-controls/widget-attribute-controls.cjs +93 -0
  10. package/build/components/widget-attribute-controls/widget-attribute-controls.cjs.map +7 -0
  11. package/build/components/widget-chrome/widget-chrome.cjs +16 -63
  12. package/build/components/widget-chrome/widget-chrome.cjs.map +2 -2
  13. package/build/components/{layout-settings → widget-frame}/index.cjs +9 -7
  14. package/build/components/widget-frame/index.cjs.map +7 -0
  15. package/build/components/widget-frame/widget-frame.cjs +193 -0
  16. package/build/components/widget-frame/widget-frame.cjs.map +7 -0
  17. package/build/{utils/migrate-layout → components/widget-header}/index.cjs +7 -7
  18. package/build/components/widget-header/index.cjs.map +7 -0
  19. package/build/components/widget-header/widget-header-infotip.cjs +166 -0
  20. package/build/components/widget-header/widget-header-infotip.cjs.map +7 -0
  21. package/build/components/widget-header/widget-header.cjs +173 -0
  22. package/build/components/widget-header/widget-header.cjs.map +7 -0
  23. package/build/components/{widget-settings/utils/get-admin-menu-inset.cjs → widget-layout-controls/index.cjs} +8 -18
  24. package/build/components/widget-layout-controls/index.cjs.map +7 -0
  25. package/build/components/{widgets/widget-layout-toolbar.cjs → widget-layout-controls/widget-layout-controls.cjs} +9 -100
  26. package/build/components/widget-layout-controls/widget-layout-controls.cjs.map +7 -0
  27. package/build/components/widget-picker/widget-picker.cjs +5 -93
  28. package/build/components/widget-picker/widget-picker.cjs.map +3 -3
  29. package/build/components/widget-preview-chrome/index.cjs +31 -0
  30. package/build/components/widget-preview-chrome/index.cjs.map +7 -0
  31. package/build/components/{widget-settings/widget-settings-toolbar.cjs → widget-preview-chrome/widget-preview-chrome.cjs} +41 -23
  32. package/build/components/widget-preview-chrome/widget-preview-chrome.cjs.map +7 -0
  33. package/build/components/widget-settings/index.cjs +3 -3
  34. package/build/components/widget-settings/index.cjs.map +1 -1
  35. package/build/components/widget-settings/utils/index.cjs +0 -3
  36. package/build/components/widget-settings/utils/index.cjs.map +2 -2
  37. package/build/components/widget-settings/widget-settings-trigger.cjs +22 -28
  38. package/build/components/widget-settings/widget-settings-trigger.cjs.map +2 -2
  39. package/build/components/widget-settings/widget-settings.cjs +40 -57
  40. package/build/components/widget-settings/widget-settings.cjs.map +2 -2
  41. package/build/components/widget-toolbar/widget-toolbar.cjs +7 -4
  42. package/build/components/widget-toolbar/widget-toolbar.cjs.map +2 -2
  43. package/build/components/widgets/widgets.cjs +14 -7
  44. package/build/components/widgets/widgets.cjs.map +2 -2
  45. package/build/context/dashboard-context.cjs +31 -80
  46. package/build/context/dashboard-context.cjs.map +2 -2
  47. package/build/context/ui-context.cjs +2 -18
  48. package/build/context/ui-context.cjs.map +2 -2
  49. package/build/types.cjs.map +1 -1
  50. package/build/utils/index.cjs +2 -5
  51. package/build/utils/index.cjs.map +2 -2
  52. package/build/widget-dashboard.cjs +0 -4
  53. package/build/widget-dashboard.cjs.map +2 -2
  54. package/build-module/components/actions/actions.mjs +3 -20
  55. package/build-module/components/actions/actions.mjs.map +2 -2
  56. package/build-module/components/commands/commands.mjs +2 -67
  57. package/build-module/components/commands/commands.mjs.map +2 -2
  58. package/build-module/components/widget-attribute-controls/index.mjs +6 -0
  59. package/build-module/components/widget-attribute-controls/index.mjs.map +7 -0
  60. package/build-module/components/widget-attribute-controls/widget-attribute-controls.mjs +68 -0
  61. package/build-module/components/widget-attribute-controls/widget-attribute-controls.mjs.map +7 -0
  62. package/build-module/components/widget-chrome/widget-chrome.mjs +17 -70
  63. package/build-module/components/widget-chrome/widget-chrome.mjs.map +2 -2
  64. package/build-module/components/widget-frame/index.mjs +7 -0
  65. package/build-module/components/widget-frame/index.mjs.map +7 -0
  66. package/build-module/components/widget-frame/widget-frame.mjs +157 -0
  67. package/build-module/components/widget-frame/widget-frame.mjs.map +7 -0
  68. package/build-module/components/widget-header/index.mjs +6 -0
  69. package/build-module/components/widget-header/index.mjs.map +7 -0
  70. package/build-module/components/widget-header/widget-header-infotip.mjs +141 -0
  71. package/build-module/components/widget-header/widget-header-infotip.mjs.map +7 -0
  72. package/build-module/components/widget-header/widget-header.mjs +138 -0
  73. package/build-module/components/widget-header/widget-header.mjs.map +7 -0
  74. package/build-module/components/widget-layout-controls/index.mjs +6 -0
  75. package/build-module/components/widget-layout-controls/index.mjs.map +7 -0
  76. package/build-module/components/widget-layout-controls/widget-layout-controls.mjs +90 -0
  77. package/build-module/components/widget-layout-controls/widget-layout-controls.mjs.map +7 -0
  78. package/build-module/components/widget-picker/widget-picker.mjs +6 -94
  79. package/build-module/components/widget-picker/widget-picker.mjs.map +3 -3
  80. package/build-module/components/widget-preview-chrome/index.mjs +6 -0
  81. package/build-module/components/widget-preview-chrome/index.mjs.map +7 -0
  82. package/build-module/components/{widget-settings/widget-settings-toolbar.mjs → widget-preview-chrome/widget-preview-chrome.mjs} +37 -19
  83. package/build-module/components/widget-preview-chrome/widget-preview-chrome.mjs.map +7 -0
  84. package/build-module/components/widget-settings/index.mjs +2 -2
  85. package/build-module/components/widget-settings/index.mjs.map +1 -1
  86. package/build-module/components/widget-settings/utils/index.mjs +0 -2
  87. package/build-module/components/widget-settings/utils/index.mjs.map +2 -2
  88. package/build-module/components/widget-settings/widget-settings-trigger.mjs +23 -29
  89. package/build-module/components/widget-settings/widget-settings-trigger.mjs.map +2 -2
  90. package/build-module/components/widget-settings/widget-settings.mjs +40 -57
  91. package/build-module/components/widget-settings/widget-settings.mjs.map +2 -2
  92. package/build-module/components/widget-toolbar/widget-toolbar.mjs +7 -4
  93. package/build-module/components/widget-toolbar/widget-toolbar.mjs.map +2 -2
  94. package/build-module/components/widgets/widgets.mjs +14 -7
  95. package/build-module/components/widgets/widgets.mjs.map +2 -2
  96. package/build-module/context/dashboard-context.mjs +31 -80
  97. package/build-module/context/dashboard-context.mjs.map +2 -2
  98. package/build-module/context/ui-context.mjs +2 -18
  99. package/build-module/context/ui-context.mjs.map +2 -2
  100. package/build-module/types.mjs.map +1 -1
  101. package/build-module/utils/index.mjs +1 -3
  102. package/build-module/utils/index.mjs.map +2 -2
  103. package/build-module/widget-dashboard.mjs +0 -4
  104. package/build-module/widget-dashboard.mjs.map +2 -2
  105. package/build-types/components/actions/actions.d.ts.map +1 -1
  106. package/build-types/components/commands/commands.d.ts.map +1 -1
  107. package/build-types/components/widget-attribute-controls/index.d.ts +2 -0
  108. package/build-types/components/widget-attribute-controls/index.d.ts.map +1 -0
  109. package/build-types/components/widget-attribute-controls/widget-attribute-controls.d.ts +23 -0
  110. package/build-types/components/widget-attribute-controls/widget-attribute-controls.d.ts.map +1 -0
  111. package/build-types/components/widget-chrome/widget-chrome.d.ts +8 -8
  112. package/build-types/components/widget-chrome/widget-chrome.d.ts.map +1 -1
  113. package/build-types/components/widget-frame/index.d.ts +3 -0
  114. package/build-types/components/widget-frame/index.d.ts.map +1 -0
  115. package/build-types/components/widget-frame/widget-frame.d.ts +25 -0
  116. package/build-types/components/widget-frame/widget-frame.d.ts.map +1 -0
  117. package/build-types/components/widget-header/index.d.ts +3 -0
  118. package/build-types/components/widget-header/index.d.ts.map +1 -0
  119. package/build-types/components/widget-header/widget-header-infotip.d.ts +20 -0
  120. package/build-types/components/widget-header/widget-header-infotip.d.ts.map +1 -0
  121. package/build-types/components/widget-header/widget-header.d.ts +38 -0
  122. package/build-types/components/widget-header/widget-header.d.ts.map +1 -0
  123. package/build-types/components/widget-layout-controls/index.d.ts +3 -0
  124. package/build-types/components/widget-layout-controls/index.d.ts.map +1 -0
  125. package/build-types/components/widget-layout-controls/widget-layout-controls.d.ts +14 -0
  126. package/build-types/components/widget-layout-controls/widget-layout-controls.d.ts.map +1 -0
  127. package/build-types/components/widget-picker/widget-picker.d.ts.map +1 -1
  128. package/build-types/components/widget-preview-chrome/index.d.ts +3 -0
  129. package/build-types/components/widget-preview-chrome/index.d.ts.map +1 -0
  130. package/build-types/components/widget-preview-chrome/widget-preview-chrome.d.ts +15 -0
  131. package/build-types/components/widget-preview-chrome/widget-preview-chrome.d.ts.map +1 -0
  132. package/build-types/components/widget-settings/index.d.ts +2 -2
  133. package/build-types/components/widget-settings/utils/index.d.ts +0 -1
  134. package/build-types/components/widget-settings/utils/index.d.ts.map +1 -1
  135. package/build-types/components/widget-settings/widget-settings-trigger.d.ts +4 -3
  136. package/build-types/components/widget-settings/widget-settings-trigger.d.ts.map +1 -1
  137. package/build-types/components/widget-settings/widget-settings.d.ts +2 -2
  138. package/build-types/components/widget-settings/widget-settings.d.ts.map +1 -1
  139. package/build-types/components/widget-toolbar/widget-toolbar.d.ts +10 -7
  140. package/build-types/components/widget-toolbar/widget-toolbar.d.ts.map +1 -1
  141. package/build-types/components/widgets/widgets.d.ts.map +1 -1
  142. package/build-types/context/dashboard-context.d.ts +23 -40
  143. package/build-types/context/dashboard-context.d.ts.map +1 -1
  144. package/build-types/context/ui-context.d.ts +0 -18
  145. package/build-types/context/ui-context.d.ts.map +1 -1
  146. package/build-types/types.d.ts +9 -15
  147. package/build-types/types.d.ts.map +1 -1
  148. package/build-types/utils/index.d.ts +0 -1
  149. package/build-types/utils/index.d.ts.map +1 -1
  150. package/build-types/widget-dashboard.d.ts +5 -5
  151. package/build-types/widget-dashboard.d.ts.map +1 -1
  152. package/package.json +17 -17
  153. package/src/components/actions/actions.tsx +2 -22
  154. package/src/components/commands/commands.tsx +3 -70
  155. package/src/components/widget-attribute-controls/index.ts +1 -0
  156. package/src/components/widget-attribute-controls/widget-attribute-controls.tsx +108 -0
  157. package/src/components/widget-chrome/widget-chrome.module.css +3 -68
  158. package/src/components/widget-chrome/widget-chrome.tsx +19 -130
  159. package/src/components/widget-frame/index.ts +2 -0
  160. package/src/components/widget-frame/widget-frame.module.css +17 -0
  161. package/src/components/widget-frame/widget-frame.tsx +138 -0
  162. package/src/components/widget-header/index.ts +2 -0
  163. package/src/components/widget-header/widget-header-infotip.tsx +82 -0
  164. package/src/components/widget-header/widget-header.module.css +76 -0
  165. package/src/components/widget-header/widget-header.tsx +101 -0
  166. package/src/components/widget-layout-controls/index.ts +2 -0
  167. package/src/components/{widgets/widget-layout-toolbar.tsx → widget-layout-controls/widget-layout-controls.tsx} +12 -13
  168. package/src/components/widget-picker/widget-picker.tsx +5 -10
  169. package/src/components/widget-preview-chrome/index.ts +2 -0
  170. package/src/components/widget-preview-chrome/widget-preview-chrome.module.css +22 -0
  171. package/src/components/widget-preview-chrome/widget-preview-chrome.tsx +65 -0
  172. package/src/components/widget-settings/index.ts +2 -2
  173. package/src/components/widget-settings/utils/index.ts +0 -1
  174. package/src/components/widget-settings/widget-settings-trigger.tsx +36 -43
  175. package/src/components/widget-settings/widget-settings.tsx +7 -26
  176. package/src/components/widget-toolbar/widget-toolbar.module.css +6 -9
  177. package/src/components/widget-toolbar/widget-toolbar.tsx +14 -8
  178. package/src/components/widgets/widgets.module.css +0 -1
  179. package/src/components/widgets/widgets.tsx +30 -8
  180. package/src/context/dashboard-context.tsx +70 -133
  181. package/src/context/ui-context.tsx +1 -39
  182. package/src/test/actions.test.tsx +7 -77
  183. package/src/test/commands.test.tsx +6 -45
  184. package/src/test/staging.test.tsx +82 -144
  185. package/src/test/widget-dashboard.test.tsx +24 -0
  186. package/src/types.ts +9 -16
  187. package/src/utils/index.ts +0 -1
  188. package/src/widget-dashboard.tsx +4 -8
  189. package/build/components/layout-settings/index.cjs.map +0 -7
  190. package/build/components/layout-settings/layout-model-edit-field/index.cjs +0 -186
  191. package/build/components/layout-settings/layout-model-edit-field/index.cjs.map +0 -7
  192. package/build/components/layout-settings/layout-model-edit-field/thumbnail-grid.cjs +0 -53
  193. package/build/components/layout-settings/layout-model-edit-field/thumbnail-grid.cjs.map +0 -7
  194. package/build/components/layout-settings/layout-model-edit-field/thumbnail-masonry.cjs +0 -53
  195. package/build/components/layout-settings/layout-model-edit-field/thumbnail-masonry.cjs.map +0 -7
  196. package/build/components/layout-settings/layout-settings.cjs +0 -207
  197. package/build/components/layout-settings/layout-settings.cjs.map +0 -7
  198. package/build/components/widget-settings/utils/get-admin-menu-inset.cjs.map +0 -7
  199. package/build/components/widget-settings/widget-settings-toolbar.cjs.map +0 -7
  200. package/build/components/widgets/widget-layout-toolbar.cjs.map +0 -7
  201. package/build/utils/grid-model-change/grid-model-change.cjs +0 -56
  202. package/build/utils/grid-model-change/grid-model-change.cjs.map +0 -7
  203. package/build/utils/grid-model-change/index.cjs.map +0 -7
  204. package/build/utils/migrate-layout/index.cjs.map +0 -7
  205. package/build/utils/migrate-layout/migrate-layout.cjs +0 -94
  206. package/build/utils/migrate-layout/migrate-layout.cjs.map +0 -7
  207. package/build-module/components/layout-settings/index.mjs +0 -6
  208. package/build-module/components/layout-settings/index.mjs.map +0 -7
  209. package/build-module/components/layout-settings/layout-model-edit-field/index.mjs +0 -151
  210. package/build-module/components/layout-settings/layout-model-edit-field/index.mjs.map +0 -7
  211. package/build-module/components/layout-settings/layout-model-edit-field/thumbnail-grid.mjs +0 -28
  212. package/build-module/components/layout-settings/layout-model-edit-field/thumbnail-grid.mjs.map +0 -7
  213. package/build-module/components/layout-settings/layout-model-edit-field/thumbnail-masonry.mjs +0 -28
  214. package/build-module/components/layout-settings/layout-model-edit-field/thumbnail-masonry.mjs.map +0 -7
  215. package/build-module/components/layout-settings/layout-settings.mjs +0 -187
  216. package/build-module/components/layout-settings/layout-settings.mjs.map +0 -7
  217. package/build-module/components/widget-settings/utils/get-admin-menu-inset.mjs +0 -16
  218. package/build-module/components/widget-settings/utils/get-admin-menu-inset.mjs.map +0 -7
  219. package/build-module/components/widget-settings/widget-settings-toolbar.mjs.map +0 -7
  220. package/build-module/components/widgets/widget-layout-toolbar.mjs +0 -181
  221. package/build-module/components/widgets/widget-layout-toolbar.mjs.map +0 -7
  222. package/build-module/utils/grid-model-change/grid-model-change.mjs +0 -30
  223. package/build-module/utils/grid-model-change/grid-model-change.mjs.map +0 -7
  224. package/build-module/utils/grid-model-change/index.mjs +0 -7
  225. package/build-module/utils/grid-model-change/index.mjs.map +0 -7
  226. package/build-module/utils/migrate-layout/index.mjs +0 -6
  227. package/build-module/utils/migrate-layout/index.mjs.map +0 -7
  228. package/build-module/utils/migrate-layout/migrate-layout.mjs +0 -69
  229. package/build-module/utils/migrate-layout/migrate-layout.mjs.map +0 -7
  230. package/build-types/components/layout-settings/index.d.ts +0 -2
  231. package/build-types/components/layout-settings/index.d.ts.map +0 -1
  232. package/build-types/components/layout-settings/layout-model-edit-field/index.d.ts +0 -17
  233. package/build-types/components/layout-settings/layout-model-edit-field/index.d.ts.map +0 -1
  234. package/build-types/components/layout-settings/layout-model-edit-field/thumbnail-grid.d.ts +0 -6
  235. package/build-types/components/layout-settings/layout-model-edit-field/thumbnail-grid.d.ts.map +0 -1
  236. package/build-types/components/layout-settings/layout-model-edit-field/thumbnail-masonry.d.ts +0 -6
  237. package/build-types/components/layout-settings/layout-model-edit-field/thumbnail-masonry.d.ts.map +0 -1
  238. package/build-types/components/layout-settings/layout-settings.d.ts +0 -14
  239. package/build-types/components/layout-settings/layout-settings.d.ts.map +0 -1
  240. package/build-types/components/widget-settings/utils/get-admin-menu-inset.d.ts +0 -17
  241. package/build-types/components/widget-settings/utils/get-admin-menu-inset.d.ts.map +0 -1
  242. package/build-types/components/widget-settings/widget-settings-toolbar.d.ts +0 -20
  243. package/build-types/components/widget-settings/widget-settings-toolbar.d.ts.map +0 -1
  244. package/build-types/components/widgets/widget-layout-toolbar.d.ts +0 -14
  245. package/build-types/components/widgets/widget-layout-toolbar.d.ts.map +0 -1
  246. package/build-types/utils/grid-model-change/grid-model-change.d.ts +0 -20
  247. package/build-types/utils/grid-model-change/grid-model-change.d.ts.map +0 -1
  248. package/build-types/utils/grid-model-change/index.d.ts +0 -2
  249. package/build-types/utils/grid-model-change/index.d.ts.map +0 -1
  250. package/build-types/utils/migrate-layout/index.d.ts +0 -2
  251. package/build-types/utils/migrate-layout/index.d.ts.map +0 -1
  252. package/build-types/utils/migrate-layout/migrate-layout.d.ts +0 -36
  253. package/build-types/utils/migrate-layout/migrate-layout.d.ts.map +0 -1
  254. package/src/components/layout-settings/index.ts +0 -1
  255. package/src/components/layout-settings/layout-model-edit-field/index.tsx +0 -98
  256. package/src/components/layout-settings/layout-model-edit-field/style.module.css +0 -34
  257. package/src/components/layout-settings/layout-model-edit-field/thumbnail-grid.tsx +0 -28
  258. package/src/components/layout-settings/layout-model-edit-field/thumbnail-masonry.tsx +0 -28
  259. package/src/components/layout-settings/layout-settings.tsx +0 -217
  260. package/src/components/widget-picker/widget-picker.module.css +0 -11
  261. package/src/components/widget-settings/utils/get-admin-menu-inset.ts +0 -30
  262. package/src/components/widget-settings/widget-settings-toolbar.module.css +0 -25
  263. package/src/components/widget-settings/widget-settings-toolbar.tsx +0 -45
  264. package/src/components/widgets/widget-layout-toolbar.module.css +0 -6
  265. package/src/utils/grid-model-change/grid-model-change.ts +0 -53
  266. package/src/utils/grid-model-change/index.ts +0 -1
  267. package/src/utils/migrate-layout/index.ts +0 -1
  268. package/src/utils/migrate-layout/migrate-layout.ts +0 -156
  269. package/src/utils/migrate-layout/test/migrate-layout.test.ts +0 -114
@@ -28,104 +28,16 @@ var import_element = require("@wordpress/element");
28
28
  var import_i18n = require("@wordpress/i18n");
29
29
  var import_dashboard_context = require("../../context/dashboard-context.cjs");
30
30
  var import_create_dashboard_widget = require("../../utils/create-dashboard-widget/index.cjs");
31
- var import_widget_render = require("../widget-render/index.cjs");
32
-
33
- // packages/style-runtime/src/index.ts
34
- var STYLE_HASH_ATTRIBUTE = "data-wp-hash";
35
- function getRuntime() {
36
- const globalScope = globalThis;
37
- if (globalScope.__wpStyleRuntime) {
38
- return globalScope.__wpStyleRuntime;
39
- }
40
- globalScope.__wpStyleRuntime = {
41
- documents: /* @__PURE__ */ new Map(),
42
- styles: /* @__PURE__ */ new Map(),
43
- injectedStyles: /* @__PURE__ */ new WeakMap()
44
- };
45
- if (typeof document !== "undefined") {
46
- registerDocument(document);
47
- }
48
- return globalScope.__wpStyleRuntime;
49
- }
50
- function documentContainsStyleHash(targetDocument, hash) {
51
- if (!targetDocument.head) {
52
- return false;
53
- }
54
- for (const style of targetDocument.head.querySelectorAll(
55
- `style[${STYLE_HASH_ATTRIBUTE}]`
56
- )) {
57
- if (style.getAttribute(STYLE_HASH_ATTRIBUTE) === hash) {
58
- return true;
59
- }
60
- }
61
- return false;
62
- }
63
- function injectStyle(targetDocument, hash, css) {
64
- if (!targetDocument.head) {
65
- return;
66
- }
67
- const runtime = getRuntime();
68
- let injectedStyles = runtime.injectedStyles.get(targetDocument);
69
- if (!injectedStyles) {
70
- injectedStyles = /* @__PURE__ */ new Set();
71
- runtime.injectedStyles.set(targetDocument, injectedStyles);
72
- }
73
- if (injectedStyles.has(hash)) {
74
- return;
75
- }
76
- if (documentContainsStyleHash(targetDocument, hash)) {
77
- injectedStyles.add(hash);
78
- return;
79
- }
80
- const style = targetDocument.createElement("style");
81
- style.setAttribute(STYLE_HASH_ATTRIBUTE, hash);
82
- style.appendChild(targetDocument.createTextNode(css));
83
- targetDocument.head.appendChild(style);
84
- injectedStyles.add(hash);
85
- }
86
- function registerDocument(targetDocument) {
87
- const runtime = getRuntime();
88
- runtime.documents.set(
89
- targetDocument,
90
- (runtime.documents.get(targetDocument) ?? 0) + 1
91
- );
92
- for (const [hash, css] of runtime.styles) {
93
- injectStyle(targetDocument, hash, css);
94
- }
95
- return () => {
96
- const count = runtime.documents.get(targetDocument);
97
- if (count === void 0) {
98
- return;
99
- }
100
- if (count <= 1) {
101
- runtime.documents.delete(targetDocument);
102
- return;
103
- }
104
- runtime.documents.set(targetDocument, count - 1);
105
- };
106
- }
107
- function registerStyle(hash, css) {
108
- const runtime = getRuntime();
109
- runtime.styles.set(hash, css);
110
- for (const targetDocument of runtime.documents.keys()) {
111
- injectStyle(targetDocument, hash, css);
112
- }
113
- }
114
-
115
- // packages/widget-dashboard/src/components/widget-picker/widget-picker.module.css
116
- if (typeof process === "undefined" || process.env.NODE_ENV !== "test") {
117
- registerStyle("93a9ea86b0", "._623aa9eba189276f__preview{height:125%;overflow:hidden;padding:0;pointer-events:none;transform:scale(.8);transform-origin:top left;user-select:none;width:125%}");
118
- }
119
- var widget_picker_default = { "preview": "_623aa9eba189276f__preview" };
120
-
121
- // packages/widget-dashboard/src/components/widget-picker/widget-picker.tsx
31
+ var import_widget_preview_chrome = require("../widget-preview-chrome/index.cjs");
122
32
  var import_jsx_runtime = require("react/jsx-runtime");
123
33
  var DEFAULT_VIEW = {
124
34
  type: "pickerGrid",
125
35
  page: 1,
126
36
  search: "",
127
37
  mediaField: "preview",
128
- titleField: "title"
38
+ titleField: "title",
39
+ // Larger default tile than the built-in 230.
40
+ layout: { previewSize: 290 }
129
41
  };
130
42
  var getItemId = (item) => item.name;
131
43
  function WidgetPreview({ item }) {
@@ -133,7 +45,7 @@ function WidgetPreview({ item }) {
133
45
  () => (0, import_create_dashboard_widget.createDashboardWidget)(item, item.example?.attributes),
134
46
  [item]
135
47
  );
136
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: widget_picker_default.preview, ...{ inert: "" }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_element.Suspense, { fallback: null, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_widget_render.WidgetRender, { widget: exampleWidget, widgetType: item }) }) });
48
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_widget_preview_chrome.WidgetPreviewChrome, { widget: exampleWidget, widgetType: item });
137
49
  }
138
50
  var fields = [
139
51
  {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../../src/components/widget-picker/widget-picker.tsx", "../../../../style-runtime/src/index.ts", "../../../src/components/widget-picker/widget-picker.module.css"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { DataViewsPicker, filterSortAndPaginate } from '@wordpress/dataviews';\nimport type { Field, View } from '@wordpress/dataviews';\nimport { Suspense, useMemo, useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport type { WidgetType } from '@wordpress/widget-primitives';\n\n/**\n * Internal dependencies\n */\nimport { useDashboardInternalContext } from '../../context/dashboard-context';\nimport { createDashboardWidget } from '../../utils/create-dashboard-widget';\nimport { WidgetRender } from '../widget-render';\nimport styles from './widget-picker.module.css';\n\nconst DEFAULT_VIEW: View = {\n\ttype: 'pickerGrid',\n\tpage: 1,\n\tsearch: '',\n\tmediaField: 'preview',\n\ttitleField: 'title',\n};\n\nconst getItemId = ( item: WidgetType ) => item.name;\n\nfunction WidgetPreview( { item }: { item: WidgetType } ) {\n\tconst exampleWidget = useMemo(\n\t\t() => createDashboardWidget( item, item.example?.attributes ),\n\t\t[ item ]\n\t);\n\n\treturn (\n\t\t<div className={ styles.preview } { ...{ inert: '' } }>\n\t\t\t<Suspense fallback={ null }>\n\t\t\t\t<WidgetRender widget={ exampleWidget } widgetType={ item } />\n\t\t\t</Suspense>\n\t\t</div>\n\t);\n}\n\nconst fields: Field< WidgetType >[] = [\n\t{\n\t\tid: 'title',\n\t\ttype: 'text',\n\t\tlabel: __( 'Title' ),\n\t\tfilterBy: false,\n\t},\n\t{\n\t\tid: 'preview',\n\t\ttype: 'media',\n\t\trender: WidgetPreview,\n\t},\n\t{\n\t\tid: 'name',\n\t\ttype: 'text',\n\t\tenableGlobalSearch: true,\n\t\tenableHiding: false,\n\t\tenableSorting: false,\n\t\tfilterBy: false,\n\t\tgetValue: ( { item } ) =>\n\t\t\t`${ item.name.replace( /[\\/,\\-_]/g, ' ' ) } ${ item.title }`,\n\t},\n];\n\ninterface WidgetPickerProps {\n\t/**\n\t * Called with the widget types selected by the user. The picker keeps\n\t * its own selection state; consumers receive the resolved list when\n\t * the \"Select\" action fires.\n\t */\n\tonSelect: ( widgetTypes: WidgetType[] ) => void;\n\n\t/**\n\t * Accessible label for the picker's item list.\n\t *\n\t * @default __( 'Widget list' )\n\t */\n\titemListLabel?: string;\n}\n\n/**\n * DataViews-driven widget type picker. Lists `widgetTypes` from the dashboard\n * context as a grid of live previews, supports search via `name`/`title`, and\n * exposes a single \"Select\" action with bulk support so users can insert one\n * or several widgets at once.\n *\n * @param {WidgetPickerProps} props Component props.\n */\nexport function WidgetPicker( {\n\tonSelect,\n\titemListLabel = __( 'Widget list' ),\n}: WidgetPickerProps ) {\n\tconst { widgetTypes: registeredTypes } = useDashboardInternalContext();\n\tconst [ selection, setSelection ] = useState< string[] >( [] );\n\tconst [ view, setView ] = useState< View >( DEFAULT_VIEW );\n\n\tconst { data: widgetTypes } = filterSortAndPaginate(\n\t\tregisteredTypes,\n\t\tview,\n\t\tfields\n\t);\n\n\tconst actions = useMemo(\n\t\t() => [\n\t\t\t{\n\t\t\t\tid: 'select',\n\t\t\t\tlabel: __( 'Select' ),\n\t\t\t\tisPrimary: true,\n\t\t\t\tsupportsBulk: true,\n\t\t\t\tcallback: ( items: WidgetType[] ) => onSelect( items ),\n\t\t\t},\n\t\t],\n\t\t[ onSelect ]\n\t);\n\n\treturn (\n\t\t<DataViewsPicker\n\t\t\tdata={ widgetTypes }\n\t\t\tfields={ fields }\n\t\t\tview={ view }\n\t\t\tactions={ actions }\n\t\t\tdefaultLayouts={ { pickerGrid: {} } }\n\t\t\tonChangeView={ setView }\n\t\t\tisLoading={ false }\n\t\t\tpaginationInfo={ {\n\t\t\t\ttotalItems: widgetTypes.length,\n\t\t\t\ttotalPages: 1,\n\t\t\t} }\n\t\t\tselection={ selection }\n\t\t\tonChangeSelection={ setSelection }\n\t\t\tgetItemId={ getItemId }\n\t\t\titemListLabel={ itemListLabel }\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(\"93a9ea86b0\", \"._623aa9eba189276f__preview{height:125%;overflow:hidden;padding:0;pointer-events:none;transform:scale(.8);transform-origin:top left;user-select:none;width:125%}\");\n}\nexport default {\"preview\":\"_623aa9eba189276f__preview\"};\n"],
5
- "mappings": "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",
3
+ "sources": ["../../../src/components/widget-picker/widget-picker.tsx"],
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { DataViewsPicker, filterSortAndPaginate } from '@wordpress/dataviews';\nimport type { Field, View } from '@wordpress/dataviews';\nimport { useMemo, useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport type { WidgetType } from '@wordpress/widget-primitives';\n\n/**\n * Internal dependencies\n */\nimport { useDashboardInternalContext } from '../../context/dashboard-context';\nimport { createDashboardWidget } from '../../utils/create-dashboard-widget';\nimport { WidgetPreviewChrome } from '../widget-preview-chrome';\n\nconst DEFAULT_VIEW: View = {\n\ttype: 'pickerGrid',\n\tpage: 1,\n\tsearch: '',\n\tmediaField: 'preview',\n\ttitleField: 'title',\n\t// Larger default tile than the built-in 230.\n\tlayout: { previewSize: 290 },\n};\n\nconst getItemId = ( item: WidgetType ) => item.name;\n\nfunction WidgetPreview( { item }: { item: WidgetType } ) {\n\tconst exampleWidget = useMemo(\n\t\t() => createDashboardWidget( item, item.example?.attributes ),\n\t\t[ item ]\n\t);\n\n\treturn <WidgetPreviewChrome widget={ exampleWidget } widgetType={ item } />;\n}\n\nconst fields: Field< WidgetType >[] = [\n\t{\n\t\tid: 'title',\n\t\ttype: 'text',\n\t\tlabel: __( 'Title' ),\n\t\tfilterBy: false,\n\t},\n\t{\n\t\tid: 'preview',\n\t\ttype: 'media',\n\t\trender: WidgetPreview,\n\t},\n\t{\n\t\tid: 'name',\n\t\ttype: 'text',\n\t\tenableGlobalSearch: true,\n\t\tenableHiding: false,\n\t\tenableSorting: false,\n\t\tfilterBy: false,\n\t\tgetValue: ( { item } ) =>\n\t\t\t`${ item.name.replace( /[\\/,\\-_]/g, ' ' ) } ${ item.title }`,\n\t},\n];\n\ninterface WidgetPickerProps {\n\t/**\n\t * Called with the widget types selected by the user. The picker keeps\n\t * its own selection state; consumers receive the resolved list when\n\t * the \"Select\" action fires.\n\t */\n\tonSelect: ( widgetTypes: WidgetType[] ) => void;\n\n\t/**\n\t * Accessible label for the picker's item list.\n\t *\n\t * @default __( 'Widget list' )\n\t */\n\titemListLabel?: string;\n}\n\n/**\n * DataViews-driven widget type picker. Lists `widgetTypes` from the dashboard\n * context as a grid of live previews, supports search via `name`/`title`, and\n * exposes a single \"Select\" action with bulk support so users can insert one\n * or several widgets at once.\n *\n * @param {WidgetPickerProps} props Component props.\n */\nexport function WidgetPicker( {\n\tonSelect,\n\titemListLabel = __( 'Widget list' ),\n}: WidgetPickerProps ) {\n\tconst { widgetTypes: registeredTypes } = useDashboardInternalContext();\n\tconst [ selection, setSelection ] = useState< string[] >( [] );\n\tconst [ view, setView ] = useState< View >( DEFAULT_VIEW );\n\n\tconst { data: widgetTypes } = filterSortAndPaginate(\n\t\tregisteredTypes,\n\t\tview,\n\t\tfields\n\t);\n\n\tconst actions = useMemo(\n\t\t() => [\n\t\t\t{\n\t\t\t\tid: 'select',\n\t\t\t\tlabel: __( 'Select' ),\n\t\t\t\tisPrimary: true,\n\t\t\t\tsupportsBulk: true,\n\t\t\t\tcallback: ( items: WidgetType[] ) => onSelect( items ),\n\t\t\t},\n\t\t],\n\t\t[ onSelect ]\n\t);\n\n\treturn (\n\t\t<DataViewsPicker\n\t\t\tdata={ widgetTypes }\n\t\t\tfields={ fields }\n\t\t\tview={ view }\n\t\t\tactions={ actions }\n\t\t\tdefaultLayouts={ { pickerGrid: {} } }\n\t\t\tonChangeView={ setView }\n\t\t\tisLoading={ false }\n\t\t\tpaginationInfo={ {\n\t\t\t\ttotalItems: widgetTypes.length,\n\t\t\t\ttotalPages: 1,\n\t\t\t} }\n\t\t\tselection={ selection }\n\t\t\tonChangeSelection={ setSelection }\n\t\t\tgetItemId={ getItemId }\n\t\t\titemListLabel={ itemListLabel }\n\t\t/>\n\t);\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,uBAAuD;AAEvD,qBAAkC;AAClC,kBAAmB;AAMnB,+BAA4C;AAC5C,qCAAsC;AACtC,mCAAoC;AAoB5B;AAlBR,IAAM,eAAqB;AAAA,EAC1B,MAAM;AAAA,EACN,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,YAAY;AAAA,EACZ,YAAY;AAAA;AAAA,EAEZ,QAAQ,EAAE,aAAa,IAAI;AAC5B;AAEA,IAAM,YAAY,CAAE,SAAsB,KAAK;AAE/C,SAAS,cAAe,EAAE,KAAK,GAA0B;AACxD,QAAM,oBAAgB;AAAA,IACrB,UAAM,sDAAuB,MAAM,KAAK,SAAS,UAAW;AAAA,IAC5D,CAAE,IAAK;AAAA,EACR;AAEA,SAAO,4CAAC,oDAAoB,QAAS,eAAgB,YAAa,MAAO;AAC1E;AAEA,IAAM,SAAgC;AAAA,EACrC;AAAA,IACC,IAAI;AAAA,IACJ,MAAM;AAAA,IACN,WAAO,gBAAI,OAAQ;AAAA,IACnB,UAAU;AAAA,EACX;AAAA,EACA;AAAA,IACC,IAAI;AAAA,IACJ,MAAM;AAAA,IACN,QAAQ;AAAA,EACT;AAAA,EACA;AAAA,IACC,IAAI;AAAA,IACJ,MAAM;AAAA,IACN,oBAAoB;AAAA,IACpB,cAAc;AAAA,IACd,eAAe;AAAA,IACf,UAAU;AAAA,IACV,UAAU,CAAE,EAAE,KAAK,MAClB,GAAI,KAAK,KAAK,QAAS,aAAa,GAAI,CAAE,IAAK,KAAK,KAAM;AAAA,EAC5D;AACD;AA0BO,SAAS,aAAc;AAAA,EAC7B;AAAA,EACA,oBAAgB,gBAAI,aAAc;AACnC,GAAuB;AACtB,QAAM,EAAE,aAAa,gBAAgB,QAAI,sDAA4B;AACrE,QAAM,CAAE,WAAW,YAAa,QAAI,yBAAsB,CAAC,CAAE;AAC7D,QAAM,CAAE,MAAM,OAAQ,QAAI,yBAAkB,YAAa;AAEzD,QAAM,EAAE,MAAM,YAAY,QAAI;AAAA,IAC7B;AAAA,IACA;AAAA,IACA;AAAA,EACD;AAEA,QAAM,cAAU;AAAA,IACf,MAAM;AAAA,MACL;AAAA,QACC,IAAI;AAAA,QACJ,WAAO,gBAAI,QAAS;AAAA,QACpB,WAAW;AAAA,QACX,cAAc;AAAA,QACd,UAAU,CAAE,UAAyB,SAAU,KAAM;AAAA,MACtD;AAAA,IACD;AAAA,IACA,CAAE,QAAS;AAAA,EACZ;AAEA,SACC;AAAA,IAAC;AAAA;AAAA,MACA,MAAO;AAAA,MACP;AAAA,MACA;AAAA,MACA;AAAA,MACA,gBAAiB,EAAE,YAAY,CAAC,EAAE;AAAA,MAClC,cAAe;AAAA,MACf,WAAY;AAAA,MACZ,gBAAiB;AAAA,QAChB,YAAY,YAAY;AAAA,QACxB,YAAY;AAAA,MACb;AAAA,MACA;AAAA,MACA,mBAAoB;AAAA,MACpB;AAAA,MACA;AAAA;AAAA,EACD;AAEF;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // packages/widget-dashboard/src/components/widget-preview-chrome/index.ts
21
+ var widget_preview_chrome_exports = {};
22
+ __export(widget_preview_chrome_exports, {
23
+ WidgetPreviewChrome: () => import_widget_preview_chrome.WidgetPreviewChrome
24
+ });
25
+ module.exports = __toCommonJS(widget_preview_chrome_exports);
26
+ var import_widget_preview_chrome = require("./widget-preview-chrome.cjs");
27
+ // Annotate the CommonJS export names for ESM import in node:
28
+ 0 && (module.exports = {
29
+ WidgetPreviewChrome
30
+ });
31
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/widget-preview-chrome/index.ts"],
4
+ "sourcesContent": ["export { WidgetPreviewChrome } from './widget-preview-chrome';\nexport type { WidgetPreviewChromeProps } from './widget-preview-chrome';\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mCAAoC;",
6
+ "names": []
7
+ }
@@ -17,14 +17,16 @@ 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/components/widget-settings/widget-settings-toolbar.tsx
21
- var widget_settings_toolbar_exports = {};
22
- __export(widget_settings_toolbar_exports, {
23
- WidgetSettingsToolbar: () => WidgetSettingsToolbar
20
+ // packages/widget-dashboard/src/components/widget-preview-chrome/widget-preview-chrome.tsx
21
+ var widget_preview_chrome_exports = {};
22
+ __export(widget_preview_chrome_exports, {
23
+ WidgetPreviewChrome: () => WidgetPreviewChrome
24
24
  });
25
- module.exports = __toCommonJS(widget_settings_toolbar_exports);
26
- var import_widget_toolbar = require("../widget-toolbar/index.cjs");
27
- var import_widget_settings_trigger = require("./widget-settings-trigger.cjs");
25
+ module.exports = __toCommonJS(widget_preview_chrome_exports);
26
+ var import_element = require("@wordpress/element");
27
+ var import_ui = require("@wordpress/ui");
28
+ var import_widget_context = require("../../context/widget-context.cjs");
29
+ var import_widget_frame = require("../widget-frame/index.cjs");
28
30
 
29
31
  // packages/style-runtime/src/index.ts
30
32
  var STYLE_HASH_ATTRIBUTE = "data-wp-hash";
@@ -108,31 +110,47 @@ function registerStyle(hash, css) {
108
110
  }
109
111
  }
110
112
 
111
- // packages/widget-dashboard/src/components/widget-settings/widget-settings-toolbar.module.css
113
+ // packages/widget-dashboard/src/components/widget-preview-chrome/widget-preview-chrome.module.css
112
114
  if (typeof process === "undefined" || process.env.NODE_ENV !== "test") {
113
- registerStyle("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))}}");
115
+ registerStyle("c47f6c464f", "._23cdee3dfcd79c9c__viewport{background:var(--wpds-color-background-surface-neutral-weak,#f4f4f4);border-radius:var(--wpds-border-radius-md,4px);inset:0;overflow:hidden;pointer-events:none;position:absolute;user-select:none}._5312b3880a174b72__canvas{display:grid;height:100%;width:100%}._8b8693cb129db8d2__card{height:100%;min-height:0}");
114
116
  }
115
- var widget_settings_toolbar_default = { "widgetSettingsToolbar": "_931c420497181bdb__widgetSettingsToolbar" };
117
+ var widget_preview_chrome_default = { "viewport": "_23cdee3dfcd79c9c__viewport", "canvas": "_5312b3880a174b72__canvas", "card": "_8b8693cb129db8d2__card" };
116
118
 
117
- // packages/widget-dashboard/src/components/widget-settings/widget-settings-toolbar.tsx
119
+ // packages/widget-dashboard/src/components/widget-preview-chrome/widget-preview-chrome.tsx
118
120
  var import_jsx_runtime = require("react/jsx-runtime");
119
- function WidgetSettingsToolbar({
121
+ function WidgetPreviewChrome({
120
122
  widget,
121
- widgetType
123
+ widgetType,
124
+ index = 0
122
125
  }) {
123
- if (!widgetType.attributes?.length) {
124
- return null;
125
- }
126
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_widget_toolbar.WidgetToolbar, { className: widget_settings_toolbar_default.widgetSettingsToolbar, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
127
- import_widget_settings_trigger.WidgetSettingsTrigger,
126
+ const titleId = (0, import_element.useId)();
127
+ const contextValue = (0, import_element.useMemo)(
128
+ () => ({
129
+ uuid: widget.uuid,
130
+ name: widget.type,
131
+ index
132
+ }),
133
+ [widget.uuid, widget.type, index]
134
+ );
135
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_widget_context.WidgetContextProvider, { value: contextValue, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: widget_preview_chrome_default.viewport, ...{ inert: "" }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: widget_preview_chrome_default.canvas, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
136
+ import_ui.Card.Root,
128
137
  {
129
- widget,
130
- widgetType
138
+ render: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("section", {}),
139
+ className: widget_preview_chrome_default.card,
140
+ "aria-labelledby": widgetType.title ? titleId : void 0,
141
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
142
+ import_widget_frame.WidgetFrame,
143
+ {
144
+ widget,
145
+ widgetType,
146
+ titleId
147
+ }
148
+ )
131
149
  }
132
- ) });
150
+ ) }) }) });
133
151
  }
134
152
  // Annotate the CommonJS export names for ESM import in node:
135
153
  0 && (module.exports = {
136
- WidgetSettingsToolbar
154
+ WidgetPreviewChrome
137
155
  });
138
- //# sourceMappingURL=widget-settings-toolbar.cjs.map
156
+ //# sourceMappingURL=widget-preview-chrome.cjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/widget-preview-chrome/widget-preview-chrome.tsx", "../../../../style-runtime/src/index.ts", "../../../src/components/widget-preview-chrome/widget-preview-chrome.module.css"],
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useId, useMemo } from '@wordpress/element';\nimport { Card } from '@wordpress/ui';\nimport type { WidgetType } from '@wordpress/widget-primitives';\n\n/**\n * Internal dependencies\n */\nimport { WidgetContextProvider } from '../../context/widget-context';\nimport { WidgetFrame } from '../widget-frame';\nimport styles from './widget-preview-chrome.module.css';\nimport type { DashboardWidget } from '../../types';\n\nexport interface WidgetPreviewChromeProps {\n\twidget: DashboardWidget< unknown >;\n\twidgetType: WidgetType;\n\tindex?: number;\n}\n\n/**\n * Catalog host-chrome: the faithful `WidgetFrame` in a viewport that scales the\n * card to fill the tile at any zoom; inert so the picker owns selection.\n *\n * @param {WidgetPreviewChromeProps} props Component props.\n */\nexport function WidgetPreviewChrome( {\n\twidget,\n\twidgetType,\n\tindex = 0,\n}: WidgetPreviewChromeProps ) {\n\tconst titleId = useId();\n\n\tconst contextValue = useMemo(\n\t\t() => ( {\n\t\t\tuuid: widget.uuid,\n\t\t\tname: widget.type,\n\t\t\tindex,\n\t\t} ),\n\t\t[ widget.uuid, widget.type, index ]\n\t);\n\n\treturn (\n\t\t<WidgetContextProvider value={ contextValue }>\n\t\t\t<div className={ styles.viewport } { ...{ inert: '' } }>\n\t\t\t\t<div className={ styles.canvas }>\n\t\t\t\t\t<Card.Root\n\t\t\t\t\t\trender={ <section /> }\n\t\t\t\t\t\tclassName={ styles.card }\n\t\t\t\t\t\taria-labelledby={\n\t\t\t\t\t\t\twidgetType.title ? titleId : undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<WidgetFrame\n\t\t\t\t\t\t\twidget={ widget }\n\t\t\t\t\t\t\twidgetType={ widgetType }\n\t\t\t\t\t\t\ttitleId={ titleId }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</Card.Root>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</WidgetContextProvider>\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(\"c47f6c464f\", \"._23cdee3dfcd79c9c__viewport{background:var(--wpds-color-background-surface-neutral-weak,#f4f4f4);border-radius:var(--wpds-border-radius-md,4px);inset:0;overflow:hidden;pointer-events:none;position:absolute;user-select:none}._5312b3880a174b72__canvas{display:grid;height:100%;width:100%}._8b8693cb129db8d2__card{height:100%;min-height:0}\");\n}\nexport default {\"viewport\":\"_23cdee3dfcd79c9c__viewport\",\"canvas\":\"_5312b3880a174b72__canvas\",\"card\":\"_8b8693cb129db8d2__card\"};\n"],
5
+ "mappings": "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",
6
+ "names": []
7
+ }
@@ -21,17 +21,17 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
21
21
  var widget_settings_exports = {};
22
22
  __export(widget_settings_exports, {
23
23
  WidgetSettings: () => import_widget_settings.WidgetSettings,
24
- WidgetSettingsToolbar: () => import_widget_settings_toolbar.WidgetSettingsToolbar,
24
+ WidgetSettingsTrigger: () => import_widget_settings_trigger.WidgetSettingsTrigger,
25
25
  getWidgetSettingsTitle: () => import_utils.getWidgetSettingsTitle
26
26
  });
27
27
  module.exports = __toCommonJS(widget_settings_exports);
28
28
  var import_widget_settings = require("./widget-settings.cjs");
29
29
  var import_utils = require("./utils/index.cjs");
30
- var import_widget_settings_toolbar = require("./widget-settings-toolbar.cjs");
30
+ var import_widget_settings_trigger = require("./widget-settings-trigger.cjs");
31
31
  // Annotate the CommonJS export names for ESM import in node:
32
32
  0 && (module.exports = {
33
33
  WidgetSettings,
34
- WidgetSettingsToolbar,
34
+ WidgetSettingsTrigger,
35
35
  getWidgetSettingsTitle
36
36
  });
37
37
  //# sourceMappingURL=index.cjs.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/widget-settings/index.ts"],
4
- "sourcesContent": ["export { WidgetSettings } from './widget-settings';\nexport { getWidgetSettingsTitle } from './utils';\nexport { WidgetSettingsToolbar } from './widget-settings-toolbar';\nexport type { WidgetSettingsToolbarProps } from './widget-settings-toolbar';\n"],
4
+ "sourcesContent": ["export { WidgetSettings } from './widget-settings';\nexport { getWidgetSettingsTitle } from './utils';\nexport { WidgetSettingsTrigger } from './widget-settings-trigger';\nexport type { WidgetSettingsTriggerProps } from './widget-settings-trigger';\n"],
5
5
  "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,6BAA+B;AAC/B,mBAAuC;AACvC,qCAAsC;",
6
6
  "names": []
7
7
  }
@@ -20,15 +20,12 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // packages/widget-dashboard/src/components/widget-settings/utils/index.ts
21
21
  var utils_exports = {};
22
22
  __export(utils_exports, {
23
- getAdminMenuInset: () => import_get_admin_menu_inset.getAdminMenuInset,
24
23
  getWidgetSettingsTitle: () => import_get_widget_settings.getWidgetSettingsTitle
25
24
  });
26
25
  module.exports = __toCommonJS(utils_exports);
27
- var import_get_admin_menu_inset = require("./get-admin-menu-inset.cjs");
28
26
  var import_get_widget_settings = require("./get-widget-settings.cjs");
29
27
  // Annotate the CommonJS export names for ESM import in node:
30
28
  0 && (module.exports = {
31
- getAdminMenuInset,
32
29
  getWidgetSettingsTitle
33
30
  });
34
31
  //# sourceMappingURL=index.cjs.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/components/widget-settings/utils/index.ts"],
4
- "sourcesContent": ["export { getAdminMenuInset } from './get-admin-menu-inset';\nexport { getWidgetSettingsTitle } from './get-widget-settings';\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kCAAkC;AAClC,iCAAuC;",
4
+ "sourcesContent": ["export { getWidgetSettingsTitle } from './get-widget-settings';\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iCAAuC;",
6
6
  "names": []
7
7
  }
@@ -27,51 +27,45 @@ var import_element = require("@wordpress/element");
27
27
  var import_i18n = require("@wordpress/i18n");
28
28
  var import_icons = require("@wordpress/icons");
29
29
  var import_ui = require("@wordpress/ui");
30
+ var import_dashboard_context = require("../../context/dashboard-context.cjs");
30
31
  var import_ui_context = require("../../context/ui-context.cjs");
31
- var import_utils = require("./utils/index.cjs");
32
32
  var import_jsx_runtime = require("react/jsx-runtime");
33
33
  function WidgetSettingsTrigger({
34
34
  widget,
35
35
  widgetType
36
36
  }) {
37
- const {
37
+ const { settingsWidgetUuid, setSettingsWidgetUuid } = (0, import_ui_context.useDashboardUIContext)();
38
+ const { cancel, flushAutoSave } = (0, import_dashboard_context.useDashboardInternalContext)();
39
+ const toggle = (0, import_element.useCallback)(() => {
40
+ if (settingsWidgetUuid === widget.uuid) {
41
+ cancel();
42
+ setSettingsWidgetUuid(null);
43
+ return;
44
+ }
45
+ flushAutoSave();
46
+ setSettingsWidgetUuid(widget.uuid);
47
+ }, [
48
+ cancel,
49
+ flushAutoSave,
50
+ settingsWidgetUuid,
38
51
  setSettingsWidgetUuid,
39
- setSettingsDrawerSide,
40
- setSettingsDrawerInset
41
- } = (0, import_ui_context.useDashboardUIContext)();
42
- const open = (0, import_element.useCallback)(
43
- (event) => {
44
- const adminMenuInset = (0, import_utils.getAdminMenuInset)();
45
- const tile = event.currentTarget.closest(
46
- "[data-wp-grid-item-key]"
47
- );
48
- const rect = (tile ?? event.currentTarget).getBoundingClientRect();
49
- const widgetCenter = rect.left + rect.width / 2;
50
- const contentCenter = (adminMenuInset + window.innerWidth) / 2;
51
- const side = widgetCenter > contentCenter ? "left" : "right";
52
- setSettingsDrawerSide(side);
53
- setSettingsDrawerInset(side === "left" ? adminMenuInset : 0);
54
- setSettingsWidgetUuid(widget.uuid);
55
- },
56
- [
57
- setSettingsDrawerSide,
58
- setSettingsDrawerInset,
59
- setSettingsWidgetUuid,
60
- widget.uuid
61
- ]
52
+ widget.uuid
53
+ ]);
54
+ const hasNonPromotedAttributes = widgetType.attributes?.some(
55
+ (attribute) => attribute.relevance !== "high"
62
56
  );
63
- if (!widgetType.attributes?.length) {
57
+ if (!hasNonPromotedAttributes) {
64
58
  return null;
65
59
  }
66
60
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
67
61
  import_ui.IconButton,
68
62
  {
69
- icon: import_icons.cog,
63
+ icon: import_icons.moreVertical,
70
64
  label: (0, import_i18n.__)("Widget settings"),
71
65
  variant: "minimal",
72
66
  tone: "neutral",
73
67
  size: "compact",
74
- onClick: open
68
+ onClick: toggle
75
69
  }
76
70
  );
77
71
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/widget-settings/widget-settings-trigger.tsx"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useCallback } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { cog } from '@wordpress/icons';\n// Dashboard is still experimental.\n// eslint-disable-next-line @wordpress/use-recommended-components\nimport { IconButton } from '@wordpress/ui';\nimport type { WidgetType } from '@wordpress/widget-primitives';\n\n/**\n * Internal dependencies\n */\nimport { useDashboardUIContext } from '../../context/ui-context';\nimport { getAdminMenuInset } from './utils';\nimport type { DashboardWidget } from '../../types';\n\nexport interface WidgetSettingsTriggerProps {\n\t/**\n\t * The instance whose settings drawer this gear opens.\n\t */\n\twidget: DashboardWidget< unknown >;\n\n\t/**\n\t * The instance's widget type, used for the accessible label and the\n\t * attributes guard.\n\t */\n\twidgetType: WidgetType;\n}\n\n/**\n * Per-instance gear that opens the shared settings drawer by writing the\n * instance `uuid` to the UI context; the single `WidgetSettings` at the root\n * reacts to it. Returns `null` when the type declares no attributes, so chrome\n * can mount it unconditionally.\n *\n * @param {WidgetSettingsTriggerProps} props Component props.\n */\nexport function WidgetSettingsTrigger( {\n\twidget,\n\twidgetType,\n}: WidgetSettingsTriggerProps ): React.ReactNode {\n\tconst {\n\t\tsetSettingsWidgetUuid,\n\t\tsetSettingsDrawerSide,\n\t\tsetSettingsDrawerInset,\n\t} = useDashboardUIContext();\n\n\tconst open = useCallback(\n\t\t( event: React.MouseEvent< HTMLElement > ) => {\n\t\t\t// Open the drawer on the side away from the widget: compare the\n\t\t\t// tile's center against the midpoint of the usable content area\n\t\t\t// (which starts after the admin menu). Past it opens left.\n\t\t\tconst adminMenuInset = getAdminMenuInset();\n\t\t\t// The gear sits in the grid slot, outside the card, so reach the\n\t\t\t// tile via the grid item's data hook.\n\t\t\tconst tile = event.currentTarget.closest(\n\t\t\t\t'[data-wp-grid-item-key]'\n\t\t\t);\n\t\t\tconst rect = (\n\t\t\t\ttile ?? event.currentTarget\n\t\t\t).getBoundingClientRect();\n\t\t\tconst widgetCenter = rect.left + rect.width / 2;\n\t\t\tconst contentCenter = ( adminMenuInset + window.innerWidth ) / 2;\n\t\t\tconst side = widgetCenter > contentCenter ? 'left' : 'right';\n\n\t\t\tsetSettingsDrawerSide( side );\n\t\t\t// A left drawer would otherwise slide over the fixed admin menu;\n\t\t\t// offset it by the menu width so it lands clear of it.\n\t\t\tsetSettingsDrawerInset( side === 'left' ? adminMenuInset : 0 );\n\t\t\tsetSettingsWidgetUuid( widget.uuid );\n\t\t},\n\t\t[\n\t\t\tsetSettingsDrawerSide,\n\t\t\tsetSettingsDrawerInset,\n\t\t\tsetSettingsWidgetUuid,\n\t\t\twidget.uuid,\n\t\t]\n\t);\n\n\tif ( ! widgetType.attributes?.length ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<IconButton\n\t\t\ticon={ cog }\n\t\t\tlabel={ __( 'Widget settings' ) }\n\t\t\tvariant=\"minimal\"\n\t\t\ttone=\"neutral\"\n\t\t\tsize=\"compact\"\n\t\t\tonClick={ open }\n\t\t/>\n\t);\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,qBAA4B;AAC5B,kBAAmB;AACnB,mBAAoB;AAGpB,gBAA2B;AAM3B,wBAAsC;AACtC,mBAAkC;AAuEhC;AA/CK,SAAS,sBAAuB;AAAA,EACtC;AAAA,EACA;AACD,GAAiD;AAChD,QAAM;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,EACD,QAAI,yCAAsB;AAE1B,QAAM,WAAO;AAAA,IACZ,CAAE,UAA4C;AAI7C,YAAM,qBAAiB,gCAAkB;AAGzC,YAAM,OAAO,MAAM,cAAc;AAAA,QAChC;AAAA,MACD;AACA,YAAM,QACL,QAAQ,MAAM,eACb,sBAAsB;AACxB,YAAM,eAAe,KAAK,OAAO,KAAK,QAAQ;AAC9C,YAAM,iBAAkB,iBAAiB,OAAO,cAAe;AAC/D,YAAM,OAAO,eAAe,gBAAgB,SAAS;AAErD,4BAAuB,IAAK;AAG5B,6BAAwB,SAAS,SAAS,iBAAiB,CAAE;AAC7D,4BAAuB,OAAO,IAAK;AAAA,IACpC;AAAA,IACA;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA,OAAO;AAAA,IACR;AAAA,EACD;AAEA,MAAK,CAAE,WAAW,YAAY,QAAS;AACtC,WAAO;AAAA,EACR;AAEA,SACC;AAAA,IAAC;AAAA;AAAA,MACA,MAAO;AAAA,MACP,WAAQ,gBAAI,iBAAkB;AAAA,MAC9B,SAAQ;AAAA,MACR,MAAK;AAAA,MACL,MAAK;AAAA,MACL,SAAU;AAAA;AAAA,EACX;AAEF;",
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useCallback } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { moreVertical } from '@wordpress/icons';\n// Dashboard is still experimental.\n// eslint-disable-next-line @wordpress/use-recommended-components\nimport { IconButton } from '@wordpress/ui';\nimport type { WidgetType } from '@wordpress/widget-primitives';\n\n/**\n * Internal dependencies\n */\nimport { useDashboardInternalContext } from '../../context/dashboard-context';\nimport { useDashboardUIContext } from '../../context/ui-context';\nimport type { DashboardWidget } from '../../types';\n\nexport interface WidgetSettingsTriggerProps {\n\t/**\n\t * The instance whose settings drawer this gear opens.\n\t */\n\twidget: DashboardWidget< unknown >;\n\n\t/**\n\t * The instance's widget type, used for the accessible label and the\n\t * attributes guard.\n\t */\n\twidgetType: WidgetType;\n}\n\n/**\n * Per-instance gear that toggles the shared settings drawer by writing the\n * instance `uuid` to the UI context; the single `WidgetSettings` at the root\n * reacts to it. Clicking the gear of the instance whose drawer is already\n * open closes it. Returns `null` when no attribute needs the drawer (none, or\n * all already promoted inline), so chrome can mount it unconditionally.\n *\n * @param {WidgetSettingsTriggerProps} props Component props.\n */\nexport function WidgetSettingsTrigger( {\n\twidget,\n\twidgetType,\n}: WidgetSettingsTriggerProps ): React.ReactNode {\n\tconst { settingsWidgetUuid, setSettingsWidgetUuid } =\n\t\tuseDashboardUIContext();\n\tconst { cancel, flushAutoSave } = useDashboardInternalContext();\n\n\tconst toggle = useCallback( () => {\n\t\t// Re-clicking the open instance's gear closes the drawer, discarding\n\t\t// staged edits like any other non-Save exit.\n\t\tif ( settingsWidgetUuid === widget.uuid ) {\n\t\t\tcancel();\n\t\t\tsetSettingsWidgetUuid( null );\n\t\t\treturn;\n\t\t}\n\t\t// Persist any pending inline edit before opening, so the drawer's edits\n\t\t// stay isolated and its Cancel discards only the drawer's own changes.\n\t\tflushAutoSave();\n\t\tsetSettingsWidgetUuid( widget.uuid );\n\t}, [\n\t\tcancel,\n\t\tflushAutoSave,\n\t\tsettingsWidgetUuid,\n\t\tsetSettingsWidgetUuid,\n\t\twidget.uuid,\n\t] );\n\n\t// Surface the drawer only when there are attributes not already promoted\n\t// inline; if every attribute is high-relevance, the drawer would just\n\t// repeat the toolbar.\n\tconst hasNonPromotedAttributes = widgetType.attributes?.some(\n\t\t( attribute ) => attribute.relevance !== 'high'\n\t);\n\tif ( ! hasNonPromotedAttributes ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<IconButton\n\t\t\ticon={ moreVertical }\n\t\t\tlabel={ __( 'Widget settings' ) }\n\t\t\tvariant=\"minimal\"\n\t\t\ttone=\"neutral\"\n\t\t\tsize=\"compact\"\n\t\t\tonClick={ toggle }\n\t\t/>\n\t);\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,qBAA4B;AAC5B,kBAAmB;AACnB,mBAA6B;AAG7B,gBAA2B;AAM3B,+BAA4C;AAC5C,wBAAsC;AAgEpC;AAvCK,SAAS,sBAAuB;AAAA,EACtC;AAAA,EACA;AACD,GAAiD;AAChD,QAAM,EAAE,oBAAoB,sBAAsB,QACjD,yCAAsB;AACvB,QAAM,EAAE,QAAQ,cAAc,QAAI,sDAA4B;AAE9D,QAAM,aAAS,4BAAa,MAAM;AAGjC,QAAK,uBAAuB,OAAO,MAAO;AACzC,aAAO;AACP,4BAAuB,IAAK;AAC5B;AAAA,IACD;AAGA,kBAAc;AACd,0BAAuB,OAAO,IAAK;AAAA,EACpC,GAAG;AAAA,IACF;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO;AAAA,EACR,CAAE;AAKF,QAAM,2BAA2B,WAAW,YAAY;AAAA,IACvD,CAAE,cAAe,UAAU,cAAc;AAAA,EAC1C;AACA,MAAK,CAAE,0BAA2B;AACjC,WAAO;AAAA,EACR;AAEA,SACC;AAAA,IAAC;AAAA;AAAA,MACA,MAAO;AAAA,MACP,WAAQ,gBAAI,iBAAkB;AAAA,MAC9B,SAAQ;AAAA,MACR,MAAK;AAAA,MACL,MAAK;AAAA,MACL,SAAU;AAAA;AAAA,EACX;AAEF;",
6
6
  "names": []
7
7
  }
@@ -130,12 +130,7 @@ function WidgetSettings() {
130
130
  cancel: cancelStaging,
131
131
  hasUncommittedChanges
132
132
  } = (0, import_dashboard_context.useDashboardInternalContext)();
133
- const {
134
- settingsWidgetUuid,
135
- setSettingsWidgetUuid,
136
- settingsDrawerSide,
137
- settingsDrawerInset
138
- } = (0, import_ui_context.useDashboardUIContext)();
133
+ const { settingsWidgetUuid, setSettingsWidgetUuid } = (0, import_ui_context.useDashboardUIContext)();
139
134
  const open = settingsWidgetUuid !== null;
140
135
  const [lastWidgetUuid, setLastWidgetUuid] = (0, import_element.useState)(
141
136
  settingsWidgetUuid
@@ -195,10 +190,6 @@ function WidgetSettings() {
195
190
  },
196
191
  [cancelStaging, close]
197
192
  );
198
- const popupStyle = (0, import_element.useMemo)(
199
- () => settingsDrawerSide === "left" && settingsDrawerInset > 0 ? { marginLeft: settingsDrawerInset } : {},
200
- [settingsDrawerSide, settingsDrawerInset]
201
- );
202
193
  const hasForm = !!widget && !!widgetType && fields.length > 0;
203
194
  if (!hasForm) {
204
195
  return null;
@@ -210,55 +201,47 @@ function WidgetSettings() {
210
201
  {
211
202
  open,
212
203
  onOpenChange: handleOpenChange,
213
- swipeDirection: settingsDrawerSide,
204
+ swipeDirection: "right",
214
205
  modal: false,
215
206
  disablePointerDismissal: true,
216
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
217
- import_ui.Drawer.Popup,
218
- {
219
- size: "medium",
220
- className: widget_settings_default.popup,
221
- style: popupStyle,
222
- children: [
223
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_ui.Drawer.Header, { children: [
224
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ui.Drawer.Title, { children: title }),
225
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ui.Drawer.CloseIcon, {})
226
- ] }),
227
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ui.Drawer.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
228
- import_dataviews.DataForm,
229
- {
230
- data,
231
- fields,
232
- form,
233
- onChange: handleChange
234
- }
235
- ) }),
236
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_ui.Drawer.Footer, { children: [
237
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
238
- import_ui.Button,
239
- {
240
- variant: "minimal",
241
- tone: "brand",
242
- size: "compact",
243
- onClick: () => handleOpenChange(false),
244
- children: (0, import_i18n.__)("Cancel")
245
- }
246
- ),
247
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
248
- import_ui.Button,
249
- {
250
- variant: "solid",
251
- tone: "brand",
252
- size: "compact",
253
- onClick: handleSave,
254
- disabled: !hasUncommittedChanges,
255
- children: (0, import_i18n.__)("Save")
256
- }
257
- )
258
- ] })
259
- ]
260
- }
261
- )
207
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_ui.Drawer.Popup, { size: "medium", className: widget_settings_default.popup, children: [
208
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_ui.Drawer.Header, { children: [
209
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ui.Drawer.Title, { children: title }),
210
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ui.Drawer.CloseIcon, {})
211
+ ] }),
212
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ui.Drawer.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
213
+ import_dataviews.DataForm,
214
+ {
215
+ data,
216
+ fields,
217
+ form,
218
+ onChange: handleChange
219
+ }
220
+ ) }),
221
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_ui.Drawer.Footer, { children: [
222
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
223
+ import_ui.Button,
224
+ {
225
+ variant: "minimal",
226
+ tone: "brand",
227
+ size: "compact",
228
+ onClick: () => handleOpenChange(false),
229
+ children: (0, import_i18n.__)("Cancel")
230
+ }
231
+ ),
232
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
233
+ import_ui.Button,
234
+ {
235
+ variant: "solid",
236
+ tone: "brand",
237
+ size: "compact",
238
+ onClick: handleSave,
239
+ disabled: !hasUncommittedChanges,
240
+ children: (0, import_i18n.__)("Save")
241
+ }
242
+ )
243
+ ] })
244
+ ] })
262
245
  }
263
246
  );
264
247
  }