@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
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/components/widgets/widget-layout-toolbar.tsx", "../../../../style-runtime/src/index.ts", "../../../src/components/widgets/widget-layout-toolbar.module.css"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { privateApis as componentsPrivateApis } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { moreVertical, trash } from '@wordpress/icons';\n// Dashboard is still experimental.\n// eslint-disable-next-line @wordpress/use-recommended-components\nimport { IconButton } from '@wordpress/ui';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { useDashboardInternalContext } from '../../context/dashboard-context';\nimport { WidgetToolbar } from '../widget-toolbar';\nimport styles from './widget-layout-toolbar.module.css';\nimport type { DashboardWidget, GridTilePlacement } from '../../types';\n\nconst { Menu } = unlock( componentsPrivateApis );\n\ntype NamedGridWidth = Exclude<\n\tNonNullable< GridTilePlacement[ 'width' ] >,\n\tnumber\n>;\n\nexport interface WidgetLayoutToolbarProps {\n\t/** The instance this toolbar manages within the layout. */\n\twidget: DashboardWidget< unknown >;\n}\n\n/**\n * Customize-mode per-tile toolbar: a width menu and removal, editing the\n * widget's place in the layout. Lives in the grid's `actionableArea` slot, so\n * it stays interactive while the card is `inert`.\n *\n * @param {WidgetLayoutToolbarProps} props Component props.\n */\nexport function WidgetLayoutToolbar( {\n\twidget,\n}: WidgetLayoutToolbarProps ): React.ReactNode {\n\tconst { layout, onLayoutChange } = useDashboardInternalContext();\n\tconst width = widget.placement?.width;\n\n\tconst updateWidth = ( nextWidth: GridTilePlacement[ 'width' ] ) => {\n\t\tconst nextLayout = layout.map( ( currentWidget ) =>\n\t\t\tcurrentWidget.uuid === widget.uuid\n\t\t\t\t? {\n\t\t\t\t\t\t...currentWidget,\n\t\t\t\t\t\tplacement: {\n\t\t\t\t\t\t\t...currentWidget.placement,\n\t\t\t\t\t\t\twidth: nextWidth,\n\t\t\t\t\t\t},\n\t\t\t\t }\n\t\t\t\t: currentWidget\n\t\t);\n\t\tonLayoutChange( nextLayout );\n\t};\n\n\tconst onNamedWidthChange = ( nextWidth: NamedGridWidth ) => {\n\t\tupdateWidth( nextWidth );\n\t};\n\n\tconst onRemove = () => {\n\t\tonLayoutChange(\n\t\t\tlayout.filter(\n\t\t\t\t( currentWidget ) => currentWidget.uuid !== widget.uuid\n\t\t\t)\n\t\t);\n\t};\n\n\treturn (\n\t\t<WidgetToolbar className={ styles.widgetLayoutToolbar }>\n\t\t\t<Menu>\n\t\t\t\t<Menu.TriggerButton\n\t\t\t\t\trender={\n\t\t\t\t\t\t<IconButton\n\t\t\t\t\t\t\ticon={ moreVertical }\n\t\t\t\t\t\t\tlabel={ __( 'Widget options' ) }\n\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t\tvariant=\"minimal\"\n\t\t\t\t\t\t\ttone=\"neutral\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t\t<Menu.Popover>\n\t\t\t\t\t<Menu.Group>\n\t\t\t\t\t\t<Menu.GroupLabel>{ __( 'Width' ) }</Menu.GroupLabel>\n\t\t\t\t\t\t<Menu.Item\n\t\t\t\t\t\t\tdisabled={ width === 'fill' }\n\t\t\t\t\t\t\tonClick={ () => onNamedWidthChange( 'fill' ) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<Menu.ItemLabel>\n\t\t\t\t\t\t\t\t{ __( 'Use available width' ) }\n\t\t\t\t\t\t\t</Menu.ItemLabel>\n\t\t\t\t\t\t</Menu.Item>\n\t\t\t\t\t\t<Menu.Item\n\t\t\t\t\t\t\tdisabled={ width === 'full' }\n\t\t\t\t\t\t\tonClick={ () => onNamedWidthChange( 'full' ) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<Menu.ItemLabel>\n\t\t\t\t\t\t\t\t{ __( 'Make full width' ) }\n\t\t\t\t\t\t\t</Menu.ItemLabel>\n\t\t\t\t\t\t</Menu.Item>\n\t\t\t\t\t</Menu.Group>\n\t\t\t\t</Menu.Popover>\n\t\t\t</Menu>\n\t\t\t<IconButton\n\t\t\t\ticon={ trash }\n\t\t\t\tlabel={ __( 'Remove' ) }\n\t\t\t\tsize=\"compact\"\n\t\t\t\tvariant=\"minimal\"\n\t\t\t\ttone=\"neutral\"\n\t\t\t\tonClick={ onRemove }\n\t\t\t/>\n\t\t</WidgetToolbar>\n\t);\n}\n", "type GlobalScopeWithStyleRuntime = typeof globalThis & {\n\t// This global is shared by separately bundled copies of this package.\n\t// Keep its shape backward compatible after release.\n\t__wpStyleRuntime?: {\n\t\tdocuments: Map< Document, number >;\n\t\tstyles: Map< string, string >;\n\t\tinjectedStyles: WeakMap< Document, Set< string > >;\n\t};\n};\n\nconst STYLE_HASH_ATTRIBUTE = 'data-wp-hash';\n\n/**\n * Returns the shared style runtime registry.\n *\n * The registry is stored on `globalThis` so separately bundled copies of this\n * package can coordinate through the same document and style maps.\n *\n * @return The shared runtime registry.\n */\nfunction getRuntime() {\n\tconst globalScope = globalThis as GlobalScopeWithStyleRuntime;\n\n\tif ( globalScope.__wpStyleRuntime ) {\n\t\treturn globalScope.__wpStyleRuntime;\n\t}\n\n\tglobalScope.__wpStyleRuntime = {\n\t\tdocuments: new Map(),\n\t\tstyles: new Map(),\n\t\tinjectedStyles: new WeakMap(),\n\t};\n\n\tif ( typeof document !== 'undefined' ) {\n\t\tregisterDocument( document );\n\t}\n\n\treturn globalScope.__wpStyleRuntime;\n}\n\n/**\n * Checks whether a document already contains a style tag for a hash.\n *\n * @param targetDocument Document to inspect.\n * @param hash Stable hash for the transformed CSS.\n *\n * @return Whether the style hash already exists in the document.\n */\nfunction documentContainsStyleHash(\n\ttargetDocument: Document,\n\thash: string\n): boolean {\n\tif ( ! targetDocument.head ) {\n\t\treturn false;\n\t}\n\n\tfor ( const style of targetDocument.head.querySelectorAll(\n\t\t`style[${ STYLE_HASH_ATTRIBUTE }]`\n\t) ) {\n\t\tif ( style.getAttribute( STYLE_HASH_ATTRIBUTE ) === hash ) {\n\t\t\treturn true;\n\t\t}\n\t}\n\n\treturn false;\n}\n\n/**\n * Injects a registered style into a document, unless that document already\n * contains a style tag for the same hash.\n *\n * @param targetDocument Document to inject the style into.\n * @param hash Stable hash for the transformed CSS.\n * @param css CSS text to inject.\n */\nfunction injectStyle( targetDocument: Document, hash: string, css: string ) {\n\tif ( ! targetDocument.head ) {\n\t\treturn;\n\t}\n\n\tconst runtime = getRuntime();\n\tlet injectedStyles = runtime.injectedStyles.get( targetDocument );\n\n\tif ( ! injectedStyles ) {\n\t\tinjectedStyles = new Set();\n\t\truntime.injectedStyles.set( targetDocument, injectedStyles );\n\t}\n\n\tif ( injectedStyles.has( hash ) ) {\n\t\treturn;\n\t}\n\n\t// Older generated CSS module output can still inject matching style tags\n\t// after this document's cache is created, so keep the DOM as the fallback\n\t// source of truth on cache misses.\n\tif ( documentContainsStyleHash( targetDocument, hash ) ) {\n\t\tinjectedStyles.add( hash );\n\t\treturn;\n\t}\n\n\tconst style = targetDocument.createElement( 'style' );\n\tstyle.setAttribute( STYLE_HASH_ATTRIBUTE, hash );\n\tstyle.appendChild( targetDocument.createTextNode( css ) );\n\ttargetDocument.head.appendChild( style );\n\tinjectedStyles.add( hash );\n}\n\n/**\n * Registers a document as a style injection target.\n *\n * Existing registered styles are replayed into the document immediately.\n * Documents are reference-counted so multiple providers can safely register the\n * same document without one cleanup removing it while another registration is\n * still active.\n *\n * @param targetDocument Document to receive registered styles.\n * @return Cleanup function that unregisters this document registration.\n */\nexport function registerDocument( targetDocument: Document ) {\n\tconst runtime = getRuntime();\n\n\truntime.documents.set(\n\t\ttargetDocument,\n\t\t( runtime.documents.get( targetDocument ) ?? 0 ) + 1\n\t);\n\n\tfor ( const [ hash, css ] of runtime.styles ) {\n\t\tinjectStyle( targetDocument, hash, css );\n\t}\n\n\treturn () => {\n\t\tconst count = runtime.documents.get( targetDocument );\n\n\t\tif ( count === undefined ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( count <= 1 ) {\n\t\t\truntime.documents.delete( targetDocument );\n\t\t\treturn;\n\t\t}\n\n\t\truntime.documents.set( targetDocument, count - 1 );\n\t};\n}\n\n/**\n * Registers a style and injects it into all registered documents.\n *\n * The hash is used as the deduplication key, so calling this repeatedly with\n * the same hash will not add duplicate style tags to a document.\n * Registered styles are retained for the lifetime of the page so they can be\n * replayed into documents that are registered later.\n *\n * @param hash Stable hash for the transformed CSS.\n * @param css CSS text to inject.\n */\nexport function registerStyle( hash: string, css: string ) {\n\tconst runtime = getRuntime();\n\n\truntime.styles.set( hash, css );\n\n\tfor ( const targetDocument of runtime.documents.keys() ) {\n\t\tinjectStyle( targetDocument, hash, css );\n\t}\n}\n", "import { registerStyle } from '@wordpress/style-runtime';\nif (typeof process === 'undefined' || process.env.NODE_ENV !== 'test') {\n\tregisterStyle(\"2696f7462d\", \"._6f7360b4588de00a__widgetLayoutToolbar{background:var(--wpds-color-background-surface-neutral-strong,#fff);border:1px solid var(--wpds-color-stroke-surface-neutral-weak,#f0f0f0);box-shadow:var(--wpds-elevation-xs,0 1px 1px 0 #00000008,0 1px 2px 0 #00000005,0 3px 3px 0 #00000005,0 4px 4px 0 #00000003)}\");\n}\nexport default {\"widgetLayoutToolbar\":\"_6f7360b4588de00a__widgetLayoutToolbar\"};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAAqD;AACrD,kBAAmB;AACnB,mBAAoC;AAGpC,gBAA2B;AAK3B,yBAAuB;AACvB,+BAA4C;AAC5C,4BAA8B;;;ACL9B,IAAM,uBAAuB;AAU7B,SAAS,aAAa;AACrB,QAAM,cAAc;AAEpB,MAAK,YAAY,kBAAmB;AACnC,WAAO,YAAY;AAAA,EACpB;AAEA,cAAY,mBAAmB;AAAA,IAC9B,WAAW,oBAAI,IAAI;AAAA,IACnB,QAAQ,oBAAI,IAAI;AAAA,IAChB,gBAAgB,oBAAI,QAAQ;AAAA,EAC7B;AAEA,MAAK,OAAO,aAAa,aAAc;AACtC,qBAAkB,QAAS;AAAA,EAC5B;AAEA,SAAO,YAAY;AACpB;AAUA,SAAS,0BACR,gBACA,MACU;AACV,MAAK,CAAE,eAAe,MAAO;AAC5B,WAAO;AAAA,EACR;AAEA,aAAY,SAAS,eAAe,KAAK;AAAA,IACxC,SAAU,oBAAqB;AAAA,EAChC,GAAI;AACH,QAAK,MAAM,aAAc,oBAAqB,MAAM,MAAO;AAC1D,aAAO;AAA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AAA,UAAC,KAAK;AAAA,UAAL;AAAA,YACA,UAAW,UAAU;AAAA,YACrB,SAAU,MAAM,mBAAoB,MAAO;AAAA,YAE3C,sDAAC,KAAK,WAAL,EACE,8BAAI,qBAAsB,GAC7B;AAAA;AAAA,QACD;AAAA,QACA;AAAA,UAAC,KAAK;AAAA,UAAL;AAAA,YACA,UAAW,UAAU;AAAA,YACrB,SAAU,MAAM,mBAAoB,MAAO;AAAA,YAE3C,sDAAC,KAAK,WAAL,EACE,8BAAI,iBAAkB,GACzB;AAAA;AAAA,QACD;AAAA,SACD,GACD;AAAA,OACD;AAAA,IACA;AAAA,MAAC;AAAA;AAAA,QACA,MAAO;AAAA,QACP,WAAQ,gBAAI,QAAS;AAAA,QACrB,MAAK;AAAA,QACL,SAAQ;AAAA,QACR,MAAK;AAAA,QACL,SAAU;AAAA;AAAA,IACX;AAAA,KACD;AAEF;",
6
- "names": ["componentsPrivateApis"]
7
- }
@@ -1,56 +0,0 @@
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/utils/grid-model-change/grid-model-change.ts
21
- var grid_model_change_exports = {};
22
- __export(grid_model_change_exports, {
23
- computeGridModelChange: () => computeGridModelChange,
24
- getGridModel: () => getGridModel
25
- });
26
- module.exports = __toCommonJS(grid_model_change_exports);
27
- var import_migrate_layout = require("../migrate-layout/index.cjs");
28
- var import_types = require("../../types.cjs");
29
- function getGridModel(settings) {
30
- return settings.model ?? "grid";
31
- }
32
- function computeGridModelChange({
33
- layout,
34
- gridSettings,
35
- targetModel
36
- }) {
37
- const currentModel = getGridModel(gridSettings);
38
- if (currentModel === targetModel) {
39
- return null;
40
- }
41
- return {
42
- layout: (0, import_migrate_layout.migrateLayout)(layout, currentModel, targetModel, {
43
- columns: import_types.WIDGET_DASHBOARD_COLUMN_COUNT
44
- }),
45
- gridSettings: {
46
- ...gridSettings,
47
- model: targetModel
48
- }
49
- };
50
- }
51
- // Annotate the CommonJS export names for ESM import in node:
52
- 0 && (module.exports = {
53
- computeGridModelChange,
54
- getGridModel
55
- });
56
- //# sourceMappingURL=grid-model-change.cjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/utils/grid-model-change/grid-model-change.ts"],
4
- "sourcesContent": ["/**\n * Internal dependencies\n */\nimport { migrateLayout } from '../migrate-layout';\nimport type {\n\tDashboardWidget,\n\tWidgetGridModel,\n\tWidgetGridSettings,\n} from '../../types';\nimport { WIDGET_DASHBOARD_COLUMN_COUNT } from '../../types';\n\nexport function getGridModel( settings: WidgetGridSettings ): WidgetGridModel {\n\treturn settings.model ?? 'grid';\n}\n\ntype ComputeGridModelChangeProps = {\n\tlayout: DashboardWidget[];\n\tgridSettings: WidgetGridSettings;\n\ttargetModel: WidgetGridModel;\n};\n\ntype ComputeGridModelChangeResult = {\n\tlayout: DashboardWidget[];\n\tgridSettings: WidgetGridSettings;\n} | null;\n\n/**\n * Computes the staged layout and grid settings after a layout-model change.\n *\n * @param {ComputeGridModelChangeProps} params Layout, current settings, and target model.\n * @return {ComputeGridModelChangeResult} Migrated layout and settings, or `null` when the model is unchanged.\n */\nexport function computeGridModelChange( {\n\tlayout,\n\tgridSettings,\n\ttargetModel,\n}: ComputeGridModelChangeProps ): ComputeGridModelChangeResult {\n\tconst currentModel = getGridModel( gridSettings );\n\n\tif ( currentModel === targetModel ) {\n\t\treturn null;\n\t}\n\n\treturn {\n\t\tlayout: migrateLayout( layout, currentModel, targetModel, {\n\t\t\tcolumns: WIDGET_DASHBOARD_COLUMN_COUNT,\n\t\t} ),\n\t\tgridSettings: {\n\t\t\t...gridSettings,\n\t\t\tmodel: targetModel,\n\t\t} as WidgetGridSettings,\n\t};\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,4BAA8B;AAM9B,mBAA8C;AAEvC,SAAS,aAAc,UAAgD;AAC7E,SAAO,SAAS,SAAS;AAC1B;AAmBO,SAAS,uBAAwB;AAAA,EACvC;AAAA,EACA;AAAA,EACA;AACD,GAA+D;AAC9D,QAAM,eAAe,aAAc,YAAa;AAEhD,MAAK,iBAAiB,aAAc;AACnC,WAAO;AAAA,EACR;AAEA,SAAO;AAAA,IACN,YAAQ,qCAAe,QAAQ,cAAc,aAAa;AAAA,MACzD,SAAS;AAAA,IACV,CAAE;AAAA,IACF,cAAc;AAAA,MACb,GAAG;AAAA,MACH,OAAO;AAAA,IACR;AAAA,EACD;AACD;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/utils/grid-model-change/index.ts"],
4
- "sourcesContent": ["export { computeGridModelChange, getGridModel } from './grid-model-change';\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,+BAAqD;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/utils/migrate-layout/index.ts"],
4
- "sourcesContent": ["export { migrateLayout } from './migrate-layout';\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,4BAA8B;",
6
- "names": []
7
- }
@@ -1,94 +0,0 @@
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/utils/migrate-layout/migrate-layout.ts
21
- var migrate_layout_exports = {};
22
- __export(migrate_layout_exports, {
23
- migrateLayout: () => migrateLayout
24
- });
25
- module.exports = __toCommonJS(migrate_layout_exports);
26
- var FALLBACK_COLUMNS = 6;
27
- function gridWidthToMasonryWidth(width, targetColumns) {
28
- if (width === "full") {
29
- return targetColumns;
30
- }
31
- if (width === "fill" || width === void 0) {
32
- return 1;
33
- }
34
- return width;
35
- }
36
- function migratePlacementGridToMasonry(placement, context) {
37
- if (!placement) {
38
- return {};
39
- }
40
- const next = {};
41
- const width = gridWidthToMasonryWidth(placement.width, context.columns);
42
- if (width !== 1) {
43
- next.width = width;
44
- }
45
- if (placement.order !== void 0) {
46
- next.order = placement.order;
47
- }
48
- return next;
49
- }
50
- function migratePlacementMasonryToGrid(placement) {
51
- if (!placement) {
52
- return { height: 1 };
53
- }
54
- const next = { height: 1 };
55
- if (placement.width !== void 0) {
56
- next.width = placement.width;
57
- }
58
- if (placement.order !== void 0) {
59
- next.order = placement.order;
60
- }
61
- return next;
62
- }
63
- function migrateLayout(widgets, from, to, context = {}) {
64
- const resolvedFrom = from ?? "grid";
65
- if (resolvedFrom === to) {
66
- return widgets;
67
- }
68
- const resolvedContext = {
69
- columns: context.columns ?? FALLBACK_COLUMNS
70
- };
71
- if (resolvedFrom === "grid" && to === "masonry") {
72
- return widgets.map((widget) => ({
73
- ...widget,
74
- placement: migratePlacementGridToMasonry(
75
- widget.placement,
76
- resolvedContext
77
- )
78
- }));
79
- }
80
- if (resolvedFrom === "masonry" && to === "grid") {
81
- return widgets.map((widget) => ({
82
- ...widget,
83
- placement: migratePlacementMasonryToGrid(
84
- widget.placement
85
- )
86
- }));
87
- }
88
- return widgets;
89
- }
90
- // Annotate the CommonJS export names for ESM import in node:
91
- 0 && (module.exports = {
92
- migrateLayout
93
- });
94
- //# sourceMappingURL=migrate-layout.cjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/utils/migrate-layout/migrate-layout.ts"],
4
- "sourcesContent": ["/**\n * Internal dependencies\n */\nimport type {\n\tDashboardWidget,\n\tGridTilePlacement,\n\tMasonryTilePlacement,\n\tWidgetGridModel,\n} from '../../types';\n\ninterface MigrationContext {\n\t/**\n\t * Column count of the currently-mounted grid surface. Used to\n\t * resolve `'full'` widths to a concrete numeric span when going\n\t * from the 2D grid model to masonry. When the surface is in\n\t * responsive mode and the runtime column count is unknown,\n\t * callers should pass a sensible fallback (e.g., the default of\n\t * 6 used by `@wordpress/grid`).\n\t */\n\tcolumns: number;\n}\n\nconst FALLBACK_COLUMNS = 6;\n\n/**\n * Coerces a `'fill'`/`'full'`/numeric width into a concrete numeric\n * span when migrating from `'grid'` to `'masonry'`. `'fill'` collapses\n * to a single column; resolving it against per-row remainder would\n * require either DOM measurement or replicating CSS-Grid's auto-flow\n * placement, both of which were judged not worth the complexity for\n * a one-shot migration the user can correct visually in staging.\n *\n * @param width Source width from a grid placement.\n * @param targetColumns Column count to use for `'full'` widths.\n */\nfunction gridWidthToMasonryWidth(\n\twidth: GridTilePlacement[ 'width' ],\n\ttargetColumns: number\n): number {\n\tif ( width === 'full' ) {\n\t\treturn targetColumns;\n\t}\n\tif ( width === 'fill' || width === undefined ) {\n\t\treturn 1;\n\t}\n\treturn width;\n}\n\n/**\n * Transforms a single placement from the 2D grid shape to the masonry\n * shape. Drops `height` (masonry derives heights from content),\n * preserves `order`, leaves `lane` unset so the auto-flow placer\n * arranges items by source order.\n *\n * @param placement Source grid placement.\n * @param context Migration context (column count).\n */\nfunction migratePlacementGridToMasonry(\n\tplacement: GridTilePlacement | undefined,\n\tcontext: MigrationContext\n): MasonryTilePlacement {\n\tif ( ! placement ) {\n\t\treturn {};\n\t}\n\n\tconst next: MasonryTilePlacement = {};\n\tconst width = gridWidthToMasonryWidth( placement.width, context.columns );\n\tif ( width !== 1 ) {\n\t\tnext.width = width;\n\t}\n\tif ( placement.order !== undefined ) {\n\t\tnext.order = placement.order;\n\t}\n\treturn next;\n}\n\n/**\n * Transforms a single placement from the masonry shape to the 2D grid\n * shape. Preserves the numeric width, drops `lane` (the 2D grid\n * auto-packs and has no pin-to-column concept), and seeds `height: 1`\n * since masonry never persisted a height. The user is expected to\n * resize tiles vertically after the migration.\n *\n * @param placement Source masonry placement.\n */\nfunction migratePlacementMasonryToGrid(\n\tplacement: MasonryTilePlacement | undefined\n): GridTilePlacement {\n\tif ( ! placement ) {\n\t\treturn { height: 1 };\n\t}\n\n\tconst next: GridTilePlacement = { height: 1 };\n\tif ( placement.width !== undefined ) {\n\t\tnext.width = placement.width;\n\t}\n\tif ( placement.order !== undefined ) {\n\t\tnext.order = placement.order;\n\t}\n\treturn next;\n}\n\n/**\n * Migrates every widget's `placement` between grid models.\n *\n * The two storage shapes overlap on `width` and `order` but diverge\n * on the rest: 2D grid carries `height` and discriminated string\n * widths (`'fill'`/`'full'`), lanes carries `lane` and only numeric\n * widths. Each conversion loses information that the target model\n * cannot represent. The caller is responsible for surfacing the\n * result to the user in a way that lets them correct visually.\n *\n * When `from === to`, the input is returned unchanged.\n *\n * @param widgets Widgets to migrate.\n * @param from Source model. `undefined` is treated as `'grid'`.\n * @param to Target model.\n * @param context Information that depends on the live render (today\n * only `columns`).\n */\nexport function migrateLayout(\n\twidgets: DashboardWidget[],\n\tfrom: WidgetGridModel | undefined,\n\tto: WidgetGridModel,\n\tcontext: Partial< MigrationContext > = {}\n): DashboardWidget[] {\n\tconst resolvedFrom: WidgetGridModel = from ?? 'grid';\n\tif ( resolvedFrom === to ) {\n\t\treturn widgets;\n\t}\n\n\tconst resolvedContext: MigrationContext = {\n\t\tcolumns: context.columns ?? FALLBACK_COLUMNS,\n\t};\n\n\tif ( resolvedFrom === 'grid' && to === 'masonry' ) {\n\t\treturn widgets.map( ( widget ) => ( {\n\t\t\t...widget,\n\t\t\tplacement: migratePlacementGridToMasonry(\n\t\t\t\twidget.placement as GridTilePlacement | undefined,\n\t\t\t\tresolvedContext\n\t\t\t),\n\t\t} ) );\n\t}\n\n\tif ( resolvedFrom === 'masonry' && to === 'grid' ) {\n\t\treturn widgets.map( ( widget ) => ( {\n\t\t\t...widget,\n\t\t\tplacement: migratePlacementMasonryToGrid(\n\t\t\t\twidget.placement as MasonryTilePlacement | undefined\n\t\t\t),\n\t\t} ) );\n\t}\n\n\treturn widgets;\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAsBA,IAAM,mBAAmB;AAazB,SAAS,wBACR,OACA,eACS;AACT,MAAK,UAAU,QAAS;AACvB,WAAO;AAAA,EACR;AACA,MAAK,UAAU,UAAU,UAAU,QAAY;AAC9C,WAAO;AAAA,EACR;AACA,SAAO;AACR;AAWA,SAAS,8BACR,WACA,SACuB;AACvB,MAAK,CAAE,WAAY;AAClB,WAAO,CAAC;AAAA,EACT;AAEA,QAAM,OAA6B,CAAC;AACpC,QAAM,QAAQ,wBAAyB,UAAU,OAAO,QAAQ,OAAQ;AACxE,MAAK,UAAU,GAAI;AAClB,SAAK,QAAQ;AAAA,EACd;AACA,MAAK,UAAU,UAAU,QAAY;AACpC,SAAK,QAAQ,UAAU;AAAA,EACxB;AACA,SAAO;AACR;AAWA,SAAS,8BACR,WACoB;AACpB,MAAK,CAAE,WAAY;AAClB,WAAO,EAAE,QAAQ,EAAE;AAAA,EACpB;AAEA,QAAM,OAA0B,EAAE,QAAQ,EAAE;AAC5C,MAAK,UAAU,UAAU,QAAY;AACpC,SAAK,QAAQ,UAAU;AAAA,EACxB;AACA,MAAK,UAAU,UAAU,QAAY;AACpC,SAAK,QAAQ,UAAU;AAAA,EACxB;AACA,SAAO;AACR;AAoBO,SAAS,cACf,SACA,MACA,IACA,UAAuC,CAAC,GACpB;AACpB,QAAM,eAAgC,QAAQ;AAC9C,MAAK,iBAAiB,IAAK;AAC1B,WAAO;AAAA,EACR;AAEA,QAAM,kBAAoC;AAAA,IACzC,SAAS,QAAQ,WAAW;AAAA,EAC7B;AAEA,MAAK,iBAAiB,UAAU,OAAO,WAAY;AAClD,WAAO,QAAQ,IAAK,CAAE,YAAc;AAAA,MACnC,GAAG;AAAA,MACH,WAAW;AAAA,QACV,OAAO;AAAA,QACP;AAAA,MACD;AAAA,IACD,EAAI;AAAA,EACL;AAEA,MAAK,iBAAiB,aAAa,OAAO,QAAS;AAClD,WAAO,QAAQ,IAAK,CAAE,YAAc;AAAA,MACnC,GAAG;AAAA,MACH,WAAW;AAAA,QACV,OAAO;AAAA,MACR;AAAA,IACD,EAAI;AAAA,EACL;AAEA,SAAO;AACR;",
6
- "names": []
7
- }
@@ -1,6 +0,0 @@
1
- // packages/widget-dashboard/src/components/layout-settings/index.ts
2
- import { LayoutSettings } from "./layout-settings.mjs";
3
- export {
4
- LayoutSettings
5
- };
6
- //# sourceMappingURL=index.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/components/layout-settings/index.ts"],
4
- "sourcesContent": ["export { LayoutSettings } from './layout-settings';\n"],
5
- "mappings": ";AAAA,SAAS,sBAAsB;",
6
- "names": []
7
- }
@@ -1,151 +0,0 @@
1
- // packages/widget-dashboard/src/components/layout-settings/layout-model-edit-field/index.tsx
2
- import clsx from "clsx";
3
- import { useCallback } from "@wordpress/element";
4
- import { Button, Fieldset, Stack, Text } from "@wordpress/ui";
5
- import { GridThumbnail } from "./thumbnail-grid.mjs";
6
- import { MasonryThumbnail } from "./thumbnail-masonry.mjs";
7
-
8
- // packages/style-runtime/src/index.ts
9
- var STYLE_HASH_ATTRIBUTE = "data-wp-hash";
10
- function getRuntime() {
11
- const globalScope = globalThis;
12
- if (globalScope.__wpStyleRuntime) {
13
- return globalScope.__wpStyleRuntime;
14
- }
15
- globalScope.__wpStyleRuntime = {
16
- documents: /* @__PURE__ */ new Map(),
17
- styles: /* @__PURE__ */ new Map(),
18
- injectedStyles: /* @__PURE__ */ new WeakMap()
19
- };
20
- if (typeof document !== "undefined") {
21
- registerDocument(document);
22
- }
23
- return globalScope.__wpStyleRuntime;
24
- }
25
- function documentContainsStyleHash(targetDocument, hash) {
26
- if (!targetDocument.head) {
27
- return false;
28
- }
29
- for (const style of targetDocument.head.querySelectorAll(
30
- `style[${STYLE_HASH_ATTRIBUTE}]`
31
- )) {
32
- if (style.getAttribute(STYLE_HASH_ATTRIBUTE) === hash) {
33
- return true;
34
- }
35
- }
36
- return false;
37
- }
38
- function injectStyle(targetDocument, hash, css) {
39
- if (!targetDocument.head) {
40
- return;
41
- }
42
- const runtime = getRuntime();
43
- let injectedStyles = runtime.injectedStyles.get(targetDocument);
44
- if (!injectedStyles) {
45
- injectedStyles = /* @__PURE__ */ new Set();
46
- runtime.injectedStyles.set(targetDocument, injectedStyles);
47
- }
48
- if (injectedStyles.has(hash)) {
49
- return;
50
- }
51
- if (documentContainsStyleHash(targetDocument, hash)) {
52
- injectedStyles.add(hash);
53
- return;
54
- }
55
- const style = targetDocument.createElement("style");
56
- style.setAttribute(STYLE_HASH_ATTRIBUTE, hash);
57
- style.appendChild(targetDocument.createTextNode(css));
58
- targetDocument.head.appendChild(style);
59
- injectedStyles.add(hash);
60
- }
61
- function registerDocument(targetDocument) {
62
- const runtime = getRuntime();
63
- runtime.documents.set(
64
- targetDocument,
65
- (runtime.documents.get(targetDocument) ?? 0) + 1
66
- );
67
- for (const [hash, css] of runtime.styles) {
68
- injectStyle(targetDocument, hash, css);
69
- }
70
- return () => {
71
- const count = runtime.documents.get(targetDocument);
72
- if (count === void 0) {
73
- return;
74
- }
75
- if (count <= 1) {
76
- runtime.documents.delete(targetDocument);
77
- return;
78
- }
79
- runtime.documents.set(targetDocument, count - 1);
80
- };
81
- }
82
- function registerStyle(hash, css) {
83
- const runtime = getRuntime();
84
- runtime.styles.set(hash, css);
85
- for (const targetDocument of runtime.documents.keys()) {
86
- injectStyle(targetDocument, hash, css);
87
- }
88
- }
89
-
90
- // packages/widget-dashboard/src/components/layout-settings/layout-model-edit-field/style.module.css
91
- if (typeof process === "undefined" || process.env.NODE_ENV !== "test") {
92
- registerStyle("1e741045ea", ".a197e5fadbd013d8__option{background:transparent;border:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral,#dbdbdb);border-radius:var(--wpds-border-radius-md,4px);color:inherit;cursor:var(--wpds-cursor-control,pointer);flex:1;padding:var(--wpds-dimension-padding-md,12px);text-align:center;transition:border-color var(--wpds-motion-duration-sm,.1s) var(--wpds-motion-easing-subtle,cubic-bezier(.15,0,.15,1)),background-color var(--wpds-motion-duration-sm,.1s) var(--wpds-motion-easing-subtle,cubic-bezier(.15,0,.15,1))}.a197e5fadbd013d8__option:hover{border-color:var(--wpds-color-stroke-surface-neutral-strong,#8d8d8d)}._90dfb85f4fe1f83c__optionSelected,._90dfb85f4fe1f83c__optionSelected:hover{background-color:color-mix(in srgb,var(--wpds-color-background-surface-brand,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 9%,#fff)) 6%,transparent);border-color:var(--wpds-color-stroke-interactive-brand,var(--wp-admin-theme-color,#3858e9))}._8dc1e0008b2c61a8__thumbnail{block-size:auto;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:block;inline-size:100%}._90dfb85f4fe1f83c__optionSelected ._8dc1e0008b2c61a8__thumbnail{color:var(--wpds-color-foreground-interactive-brand,var(--wp-admin-theme-color,#3858e9))}");
93
- }
94
- var style_default = { "option": "a197e5fadbd013d8__option", "optionSelected": "_90dfb85f4fe1f83c__optionSelected", "thumbnail": "_8dc1e0008b2c61a8__thumbnail" };
95
-
96
- // packages/widget-dashboard/src/components/layout-settings/layout-model-edit-field/index.tsx
97
- import { jsx, jsxs } from "react/jsx-runtime";
98
- function ModelThumbnail({
99
- model,
100
- className
101
- }) {
102
- return model === "masonry" ? /* @__PURE__ */ jsx(MasonryThumbnail, { className }) : /* @__PURE__ */ jsx(GridThumbnail, { className });
103
- }
104
- function LayoutModelEditField({
105
- data,
106
- field,
107
- onChange
108
- }) {
109
- const { getValue, setValue, elements = [] } = field;
110
- const value = getValue({ item: data });
111
- const disabled = field.isDisabled({ item: data, field });
112
- const onSelect = useCallback(
113
- (nextValue) => onChange(setValue({ item: data, value: nextValue })),
114
- [data, onChange, setValue]
115
- );
116
- return /* @__PURE__ */ jsxs(Fieldset.Root, { children: [
117
- /* @__PURE__ */ jsx(Fieldset.Legend, { children: field.label }),
118
- /* @__PURE__ */ jsx(Stack, { direction: "row", gap: "md", role: "radiogroup", children: elements.map((option) => {
119
- const isSelected = value === option.value;
120
- return /* @__PURE__ */ jsx(
121
- Button,
122
- {
123
- variant: "unstyled",
124
- role: "radio",
125
- "aria-checked": isSelected,
126
- disabled,
127
- className: clsx(style_default.option, {
128
- [style_default.optionSelected]: isSelected
129
- }),
130
- onClick: () => onSelect(option.value),
131
- children: /* @__PURE__ */ jsxs(Stack, { direction: "column", gap: "sm", align: "stretch", children: [
132
- /* @__PURE__ */ jsx(
133
- ModelThumbnail,
134
- {
135
- model: String(option.value),
136
- className: style_default.thumbnail
137
- }
138
- ),
139
- /* @__PURE__ */ jsx(Text, { children: option.label })
140
- ] })
141
- },
142
- String(option.value)
143
- );
144
- }) }),
145
- typeof field.description === "string" && /* @__PURE__ */ jsx(Fieldset.Description, { children: field.description })
146
- ] });
147
- }
148
- export {
149
- LayoutModelEditField
150
- };
151
- //# sourceMappingURL=index.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../src/components/layout-settings/layout-model-edit-field/index.tsx", "../../../../../style-runtime/src/index.ts", "../../../../src/components/layout-settings/layout-model-edit-field/style.module.css"],
4
- "sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport type { DataFormControlProps } from '@wordpress/dataviews';\nimport { useCallback } from '@wordpress/element';\n/* eslint-disable @wordpress/use-recommended-components */\nimport { Button, Fieldset, Stack, Text } from '@wordpress/ui';\n/* eslint-enable @wordpress/use-recommended-components */\n\n/**\n * Internal dependencies\n */\nimport type { WidgetGridSettings } from '../../../types';\nimport { GridThumbnail } from './thumbnail-grid';\nimport { MasonryThumbnail } from './thumbnail-masonry';\nimport styles from './style.module.css';\n\ninterface ModelThumbnailProps {\n\tmodel: string;\n\tclassName?: string;\n}\n\nfunction ModelThumbnail( {\n\tmodel,\n\tclassName,\n}: ModelThumbnailProps ): React.ReactNode {\n\treturn model === 'masonry' ? (\n\t\t<MasonryThumbnail className={ className } />\n\t) : (\n\t\t<GridThumbnail className={ className } />\n\t);\n}\n\n/**\n * Card-style picker for the layout model: each option (`grid`, `masonry`)\n * renders as a thumbnail card in a radio group. Wired as the `Edit` control\n * for the `model` field of the layout settings DataForm.\n *\n * @param {DataFormControlProps< WidgetGridSettings >} props DataForm control props.\n */\nexport function LayoutModelEditField( {\n\tdata,\n\tfield,\n\tonChange,\n}: DataFormControlProps< WidgetGridSettings > ): React.ReactNode {\n\tconst { getValue, setValue, elements = [] } = field;\n\tconst value = getValue( { item: data } );\n\tconst disabled = field.isDisabled( { item: data, field } );\n\n\tconst onSelect = useCallback(\n\t\t( nextValue: string | number | undefined ) =>\n\t\t\tonChange( setValue( { item: data, value: nextValue } ) ),\n\t\t[ data, onChange, setValue ]\n\t);\n\n\treturn (\n\t\t<Fieldset.Root>\n\t\t\t<Fieldset.Legend>{ field.label }</Fieldset.Legend>\n\t\t\t<Stack direction=\"row\" gap=\"md\" role=\"radiogroup\">\n\t\t\t\t{ elements.map( ( option ) => {\n\t\t\t\t\tconst isSelected = value === option.value;\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tkey={ String( option.value ) }\n\t\t\t\t\t\t\tvariant=\"unstyled\"\n\t\t\t\t\t\t\trole=\"radio\"\n\t\t\t\t\t\t\taria-checked={ isSelected }\n\t\t\t\t\t\t\tdisabled={ disabled }\n\t\t\t\t\t\t\tclassName={ clsx( styles.option, {\n\t\t\t\t\t\t\t\t[ styles.optionSelected ]: isSelected,\n\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t\tonClick={ () => onSelect( option.value ) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<Stack direction=\"column\" gap=\"sm\" align=\"stretch\">\n\t\t\t\t\t\t\t\t<ModelThumbnail\n\t\t\t\t\t\t\t\t\tmodel={ String( option.value ) }\n\t\t\t\t\t\t\t\t\tclassName={ styles.thumbnail }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t<Text>{ option.label }</Text>\n\t\t\t\t\t\t\t</Stack>\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t);\n\t\t\t\t} ) }\n\t\t\t</Stack>\n\t\t\t{ typeof field.description === 'string' && (\n\t\t\t\t<Fieldset.Description>\n\t\t\t\t\t{ field.description }\n\t\t\t\t</Fieldset.Description>\n\t\t\t) }\n\t\t</Fieldset.Root>\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(\"1e741045ea\", \".a197e5fadbd013d8__option{background:transparent;border:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral,#dbdbdb);border-radius:var(--wpds-border-radius-md,4px);color:inherit;cursor:var(--wpds-cursor-control,pointer);flex:1;padding:var(--wpds-dimension-padding-md,12px);text-align:center;transition:border-color var(--wpds-motion-duration-sm,.1s) var(--wpds-motion-easing-subtle,cubic-bezier(.15,0,.15,1)),background-color var(--wpds-motion-duration-sm,.1s) var(--wpds-motion-easing-subtle,cubic-bezier(.15,0,.15,1))}.a197e5fadbd013d8__option:hover{border-color:var(--wpds-color-stroke-surface-neutral-strong,#8d8d8d)}._90dfb85f4fe1f83c__optionSelected,._90dfb85f4fe1f83c__optionSelected:hover{background-color:color-mix(in srgb,var(--wpds-color-background-surface-brand,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 9%,#fff)) 6%,transparent);border-color:var(--wpds-color-stroke-interactive-brand,var(--wp-admin-theme-color,#3858e9))}._8dc1e0008b2c61a8__thumbnail{block-size:auto;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:block;inline-size:100%}._90dfb85f4fe1f83c__optionSelected ._8dc1e0008b2c61a8__thumbnail{color:var(--wpds-color-foreground-interactive-brand,var(--wp-admin-theme-color,#3858e9))}\");\n}\nexport default {\"option\":\"a197e5fadbd013d8__option\",\"optionSelected\":\"_90dfb85f4fe1f83c__optionSelected\",\"thumbnail\":\"_8dc1e0008b2c61a8__thumbnail\"};\n"],
5
- "mappings": ";AAGA,OAAO,UAAU;AAMjB,SAAS,mBAAmB;AAE5B,SAAS,QAAQ,UAAU,OAAO,YAAY;AAO9C,SAAS,qBAAqB;AAC9B,SAAS,wBAAwB;;;ACTjC,IAAM,uBAAuB;AAU7B,SAAS,aAAa;AACrB,QAAM,cAAc;AAEpB,MAAK,YAAY,kBAAmB;AACnC,WAAO,YAAY;AAAA,EACpB;AAEA,cAAY,mBAAmB;AAAA,IAC9B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,EAAkB,gBAAM,OAAO;AAAA,IAChC,oBAAC,SAAM,WAAU,OAAM,KAAI,MAAK,MAAK,cAClC,mBAAS,IAAK,CAAE,WAAY;AAC7B,YAAM,aAAa,UAAU,OAAO;AAEpC,aACC;AAAA,QAAC;AAAA;AAAA,UAEA,SAAQ;AAAA,UACR,MAAK;AAAA,UACL,gBAAe;AAAA,UACf;AAAA,UACA,WAAY,KAAM,cAAO,QAAQ;AAAA,YAChC,CAAE,cAAO,cAAe,GAAG;AAAA,UAC5B,CAAE;AAAA,UACF,SAAU,MAAM,SAAU,OAAO,KAAM;AAAA,UAEvC,+BAAC,SAAM,WAAU,UAAS,KAAI,MAAK,OAAM,WACxC;AAAA;AAAA,cAAC;AAAA;AAAA,gBACA,OAAQ,OAAQ,OAAO,KAAM;AAAA,gBAC7B,WAAY,cAAO;AAAA;AAAA,YACpB;AAAA,YACA,oBAAC,QAAO,iBAAO,OAAO;AAAA,aACvB;AAAA;AAAA,QAhBM,OAAQ,OAAO,KAAM;AAAA,MAiB5B;AAAA,IAEF,CAAE,GACH;AAAA,IACE,OAAO,MAAM,gBAAgB,YAC9B,oBAAC,SAAS,aAAT,EACE,gBAAM,aACT;AAAA,KAEF;AAEF;",
6
- "names": []
7
- }
@@ -1,28 +0,0 @@
1
- // packages/widget-dashboard/src/components/layout-settings/layout-model-edit-field/thumbnail-grid.tsx
2
- import { SVG, Rect } from "@wordpress/primitives";
3
- import { jsx, jsxs } from "react/jsx-runtime";
4
- function GridThumbnail({
5
- className
6
- }) {
7
- return /* @__PURE__ */ jsxs(
8
- SVG,
9
- {
10
- className,
11
- viewBox: "0 0 40 24",
12
- fill: "currentColor",
13
- "aria-hidden": "true",
14
- children: [
15
- /* @__PURE__ */ jsx(Rect, { x: "2", y: "1.25", width: "11", height: "10", rx: "1.5" }),
16
- /* @__PURE__ */ jsx(Rect, { x: "14.5", y: "1.25", width: "11", height: "10", rx: "1.5" }),
17
- /* @__PURE__ */ jsx(Rect, { x: "27", y: "1.25", width: "11", height: "10", rx: "1.5" }),
18
- /* @__PURE__ */ jsx(Rect, { x: "2", y: "12.75", width: "11", height: "10", rx: "1.5" }),
19
- /* @__PURE__ */ jsx(Rect, { x: "14.5", y: "12.75", width: "11", height: "10", rx: "1.5" }),
20
- /* @__PURE__ */ jsx(Rect, { x: "27", y: "12.75", width: "11", height: "10", rx: "1.5" })
21
- ]
22
- }
23
- );
24
- }
25
- export {
26
- GridThumbnail
27
- };
28
- //# sourceMappingURL=thumbnail-grid.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../src/components/layout-settings/layout-model-edit-field/thumbnail-grid.tsx"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { SVG, Rect } from '@wordpress/primitives';\n\ninterface GridThumbnailProps {\n\tclassName?: string;\n}\n\nexport function GridThumbnail( {\n\tclassName,\n}: GridThumbnailProps ): React.ReactNode {\n\treturn (\n\t\t<SVG\n\t\t\tclassName={ className }\n\t\t\tviewBox=\"0 0 40 24\"\n\t\t\tfill=\"currentColor\"\n\t\t\taria-hidden=\"true\"\n\t\t>\n\t\t\t<Rect x=\"2\" y=\"1.25\" width=\"11\" height=\"10\" rx=\"1.5\" />\n\t\t\t<Rect x=\"14.5\" y=\"1.25\" width=\"11\" height=\"10\" rx=\"1.5\" />\n\t\t\t<Rect x=\"27\" y=\"1.25\" width=\"11\" height=\"10\" rx=\"1.5\" />\n\t\t\t<Rect x=\"2\" y=\"12.75\" width=\"11\" height=\"10\" rx=\"1.5\" />\n\t\t\t<Rect x=\"14.5\" y=\"12.75\" width=\"11\" height=\"10\" rx=\"1.5\" />\n\t\t\t<Rect x=\"27\" y=\"12.75\" width=\"11\" height=\"10\" rx=\"1.5\" />\n\t\t</SVG>\n\t);\n}\n"],
5
- "mappings": ";AAGA,SAAS,KAAK,YAAY;AAUxB,SAMC,KAND;AAJK,SAAS,cAAe;AAAA,EAC9B;AACD,GAAyC;AACxC,SACC;AAAA,IAAC;AAAA;AAAA,MACA;AAAA,MACA,SAAQ;AAAA,MACR,MAAK;AAAA,MACL,eAAY;AAAA,MAEZ;AAAA,4BAAC,QAAK,GAAE,KAAI,GAAE,QAAO,OAAM,MAAK,QAAO,MAAK,IAAG,OAAM;AAAA,QACrD,oBAAC,QAAK,GAAE,QAAO,GAAE,QAAO,OAAM,MAAK,QAAO,MAAK,IAAG,OAAM;AAAA,QACxD,oBAAC,QAAK,GAAE,MAAK,GAAE,QAAO,OAAM,MAAK,QAAO,MAAK,IAAG,OAAM;AAAA,QACtD,oBAAC,QAAK,GAAE,KAAI,GAAE,SAAQ,OAAM,MAAK,QAAO,MAAK,IAAG,OAAM;AAAA,QACtD,oBAAC,QAAK,GAAE,QAAO,GAAE,SAAQ,OAAM,MAAK,QAAO,MAAK,IAAG,OAAM;AAAA,QACzD,oBAAC,QAAK,GAAE,MAAK,GAAE,SAAQ,OAAM,MAAK,QAAO,MAAK,IAAG,OAAM;AAAA;AAAA;AAAA,EACxD;AAEF;",
6
- "names": []
7
- }
@@ -1,28 +0,0 @@
1
- // packages/widget-dashboard/src/components/layout-settings/layout-model-edit-field/thumbnail-masonry.tsx
2
- import { SVG, Rect } from "@wordpress/primitives";
3
- import { jsx, jsxs } from "react/jsx-runtime";
4
- function MasonryThumbnail({
5
- className
6
- }) {
7
- return /* @__PURE__ */ jsxs(
8
- SVG,
9
- {
10
- className,
11
- viewBox: "0 0 40 24",
12
- fill: "currentColor",
13
- "aria-hidden": "true",
14
- children: [
15
- /* @__PURE__ */ jsx(Rect, { x: "2", y: "0.75", width: "11", height: "13", rx: "1.5" }),
16
- /* @__PURE__ */ jsx(Rect, { x: "2", y: "15.25", width: "11", height: "8", rx: "1.5" }),
17
- /* @__PURE__ */ jsx(Rect, { x: "14.5", y: "0.75", width: "11", height: "8", rx: "1.5" }),
18
- /* @__PURE__ */ jsx(Rect, { x: "14.5", y: "10.25", width: "11", height: "13", rx: "1.5" }),
19
- /* @__PURE__ */ jsx(Rect, { x: "27", y: "0.75", width: "11", height: "10", rx: "1.5" }),
20
- /* @__PURE__ */ jsx(Rect, { x: "27", y: "12.25", width: "11", height: "11", rx: "1.5" })
21
- ]
22
- }
23
- );
24
- }
25
- export {
26
- MasonryThumbnail
27
- };
28
- //# sourceMappingURL=thumbnail-masonry.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../src/components/layout-settings/layout-model-edit-field/thumbnail-masonry.tsx"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { SVG, Rect } from '@wordpress/primitives';\n\ninterface MasonryThumbnailProps {\n\tclassName?: string;\n}\n\nexport function MasonryThumbnail( {\n\tclassName,\n}: MasonryThumbnailProps ): React.ReactNode {\n\treturn (\n\t\t<SVG\n\t\t\tclassName={ className }\n\t\t\tviewBox=\"0 0 40 24\"\n\t\t\tfill=\"currentColor\"\n\t\t\taria-hidden=\"true\"\n\t\t>\n\t\t\t<Rect x=\"2\" y=\"0.75\" width=\"11\" height=\"13\" rx=\"1.5\" />\n\t\t\t<Rect x=\"2\" y=\"15.25\" width=\"11\" height=\"8\" rx=\"1.5\" />\n\t\t\t<Rect x=\"14.5\" y=\"0.75\" width=\"11\" height=\"8\" rx=\"1.5\" />\n\t\t\t<Rect x=\"14.5\" y=\"10.25\" width=\"11\" height=\"13\" rx=\"1.5\" />\n\t\t\t<Rect x=\"27\" y=\"0.75\" width=\"11\" height=\"10\" rx=\"1.5\" />\n\t\t\t<Rect x=\"27\" y=\"12.25\" width=\"11\" height=\"11\" rx=\"1.5\" />\n\t\t</SVG>\n\t);\n}\n"],
5
- "mappings": ";AAGA,SAAS,KAAK,YAAY;AAUxB,SAMC,KAND;AAJK,SAAS,iBAAkB;AAAA,EACjC;AACD,GAA4C;AAC3C,SACC;AAAA,IAAC;AAAA;AAAA,MACA;AAAA,MACA,SAAQ;AAAA,MACR,MAAK;AAAA,MACL,eAAY;AAAA,MAEZ;AAAA,4BAAC,QAAK,GAAE,KAAI,GAAE,QAAO,OAAM,MAAK,QAAO,MAAK,IAAG,OAAM;AAAA,QACrD,oBAAC,QAAK,GAAE,KAAI,GAAE,SAAQ,OAAM,MAAK,QAAO,KAAI,IAAG,OAAM;AAAA,QACrD,oBAAC,QAAK,GAAE,QAAO,GAAE,QAAO,OAAM,MAAK,QAAO,KAAI,IAAG,OAAM;AAAA,QACvD,oBAAC,QAAK,GAAE,QAAO,GAAE,SAAQ,OAAM,MAAK,QAAO,MAAK,IAAG,OAAM;AAAA,QACzD,oBAAC,QAAK,GAAE,MAAK,GAAE,QAAO,OAAM,MAAK,QAAO,MAAK,IAAG,OAAM;AAAA,QACtD,oBAAC,QAAK,GAAE,MAAK,GAAE,SAAQ,OAAM,MAAK,QAAO,MAAK,IAAG,OAAM;AAAA;AAAA;AAAA,EACxD;AAEF;",
6
- "names": []
7
- }