@wordpress/components 40.0.0 → 40.1.1-next.v.202609031004.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 (291) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/build/border-box-control/border-box-control/component.cjs +37 -5
  3. package/build/border-box-control/border-box-control/component.cjs.map +3 -3
  4. package/build/border-box-control/border-box-control/hook.cjs +24 -3
  5. package/build/border-box-control/border-box-control/hook.cjs.map +3 -3
  6. package/build/border-box-control/border-box-control-linked-button/hook.cjs +2 -2
  7. package/build/border-box-control/border-box-control-linked-button/hook.cjs.map +2 -2
  8. package/build/border-box-control/border-box-control-split-controls/hook.cjs +2 -2
  9. package/build/border-box-control/border-box-control-split-controls/hook.cjs.map +2 -2
  10. package/build/border-box-control/border-box-control-visualizer/hook.cjs +2 -2
  11. package/build/border-box-control/border-box-control-visualizer/hook.cjs.map +2 -2
  12. package/build/color-palette/index.cjs +1 -1
  13. package/build/color-palette/index.cjs.map +2 -2
  14. package/build/context/context-system-provider.cjs +2 -5
  15. package/build/context/context-system-provider.cjs.map +3 -3
  16. package/build/context/use-context-system.cjs +7 -2
  17. package/build/context/use-context-system.cjs.map +2 -2
  18. package/build/icon/index.cjs +30 -12
  19. package/build/icon/index.cjs.map +2 -2
  20. package/build/item-group/item/hook.cjs +1 -1
  21. package/build/item-group/item/hook.cjs.map +2 -2
  22. package/build/item-group/item-group/hook.cjs +1 -1
  23. package/build/item-group/item-group/hook.cjs.map +2 -2
  24. package/build/resizable-box/index.cjs.map +1 -1
  25. package/build/snackbar/index.cjs +8 -5
  26. package/build/snackbar/index.cjs.map +2 -2
  27. package/build/tools-panel/tools-panel/hook.cjs +102 -106
  28. package/build/tools-panel/tools-panel/hook.cjs.map +2 -2
  29. package/build/tools-panel/tools-panel-item/hook.cjs +33 -33
  30. package/build/tools-panel/tools-panel-item/hook.cjs.map +2 -2
  31. package/build-module/border-box-control/border-box-control/component.mjs +38 -6
  32. package/build-module/border-box-control/border-box-control/component.mjs.map +2 -2
  33. package/build-module/border-box-control/border-box-control/hook.mjs +14 -3
  34. package/build-module/border-box-control/border-box-control/hook.mjs.map +2 -2
  35. package/build-module/border-box-control/border-box-control-linked-button/hook.mjs +2 -2
  36. package/build-module/border-box-control/border-box-control-linked-button/hook.mjs.map +2 -2
  37. package/build-module/border-box-control/border-box-control-split-controls/hook.mjs +2 -2
  38. package/build-module/border-box-control/border-box-control-split-controls/hook.mjs.map +2 -2
  39. package/build-module/border-box-control/border-box-control-visualizer/hook.mjs +2 -2
  40. package/build-module/border-box-control/border-box-control-visualizer/hook.mjs.map +2 -2
  41. package/build-module/color-palette/index.mjs +1 -1
  42. package/build-module/color-palette/index.mjs.map +2 -2
  43. package/build-module/context/context-system-provider.mjs +2 -5
  44. package/build-module/context/context-system-provider.mjs.map +3 -3
  45. package/build-module/context/use-context-system.mjs +7 -2
  46. package/build-module/context/use-context-system.mjs.map +2 -2
  47. package/build-module/icon/index.mjs +30 -12
  48. package/build-module/icon/index.mjs.map +2 -2
  49. package/build-module/item-group/item/hook.mjs +1 -1
  50. package/build-module/item-group/item/hook.mjs.map +2 -2
  51. package/build-module/item-group/item-group/hook.mjs +1 -1
  52. package/build-module/item-group/item-group/hook.mjs.map +2 -2
  53. package/build-module/resizable-box/index.mjs.map +1 -1
  54. package/build-module/snackbar/index.mjs +8 -5
  55. package/build-module/snackbar/index.mjs.map +2 -2
  56. package/build-module/tools-panel/tools-panel/hook.mjs +103 -107
  57. package/build-module/tools-panel/tools-panel/hook.mjs.map +2 -2
  58. package/build-module/tools-panel/tools-panel-item/hook.mjs +35 -35
  59. package/build-module/tools-panel/tools-panel-item/hook.mjs.map +2 -2
  60. package/build-style/style-rtl.css +7 -35
  61. package/build-style/style.css +7 -35
  62. package/build-types/border-box-control/border-box-control/component.d.ts +4 -0
  63. package/build-types/border-box-control/border-box-control/component.d.ts.map +1 -1
  64. package/build-types/border-box-control/border-box-control/hook.d.ts +4 -2
  65. package/build-types/border-box-control/border-box-control/hook.d.ts.map +1 -1
  66. package/build-types/border-box-control/types.d.ts +6 -2
  67. package/build-types/border-box-control/types.d.ts.map +1 -1
  68. package/build-types/composite/types.d.ts +1 -1
  69. package/build-types/context/context-system-provider.d.ts +8 -6
  70. package/build-types/context/context-system-provider.d.ts.map +1 -1
  71. package/build-types/context/use-context-system.d.ts.map +1 -1
  72. package/build-types/icon/index.d.ts.map +1 -1
  73. package/build-types/popover/types.d.ts +6 -2
  74. package/build-types/popover/types.d.ts.map +1 -1
  75. package/build-types/snackbar/index.d.ts.map +1 -1
  76. package/build-types/tools-panel/tools-panel/hook.d.ts +4 -4
  77. package/build-types/tools-panel/tools-panel/hook.d.ts.map +1 -1
  78. package/build-types/tools-panel/tools-panel-item/hook.d.ts.map +1 -1
  79. package/build-types/tools-panel/types.d.ts +52 -9
  80. package/build-types/tools-panel/types.d.ts.map +1 -1
  81. package/package.json +26 -25
  82. package/src/angle-picker-control/style.module.scss +1 -1
  83. package/src/autocomplete/test/get-autocomplete-match.ts +2 -1
  84. package/src/base-control/stories/index.story.tsx +2 -2
  85. package/src/border-box-control/border-box-control/README.md +5 -3
  86. package/src/border-box-control/border-box-control/component.tsx +83 -15
  87. package/src/border-box-control/border-box-control/hook.ts +19 -1
  88. package/src/border-box-control/stories/index.story.tsx +10 -0
  89. package/src/border-box-control/style.module.scss +34 -3
  90. package/src/border-box-control/test/{index.tsx → index.jsdom.test.tsx} +133 -0
  91. package/src/border-box-control/test/utils.ts +11 -0
  92. package/src/border-box-control/types.ts +6 -2
  93. package/src/border-control/test/{index.js → index.jsdom.test.tsx} +20 -13
  94. package/src/checkbox-control/style.scss +2 -2
  95. package/src/checkbox-control/test/__snapshots__/{index.tsx.snap → index.jsdom.test.tsx.snap} +8 -5
  96. package/src/color-palette/index.tsx +1 -1
  97. package/src/composite/README.md +1 -1
  98. package/src/composite/types.ts +1 -1
  99. package/src/context/{context-system-provider.js → context-system-provider.tsx} +19 -5
  100. package/src/context/stories/{ComponentsProvider.stories.jsx → ComponentsProvider.stories.tsx} +2 -2
  101. package/src/context/test/__snapshots__/{context-system-provider.js.snap → context-system-provider.jsdom.test.tsx.snap} +3 -3
  102. package/src/context/test/context-connect.tsx +1 -2
  103. package/src/context/test/{context-system-provider.js → context-system-provider.jsdom.test.tsx} +81 -43
  104. package/src/context/test/wordpress-component.tsx +1 -2
  105. package/src/context/use-context-system.js +13 -4
  106. package/src/custom-gradient-picker/test/serializer.ts +1 -0
  107. package/src/date-time/test/utils.test.ts +9 -0
  108. package/src/draggable/style.module.scss +1 -1
  109. package/src/dropdown/style.module.scss +2 -2
  110. package/src/font-size-picker/test/utils.ts +1 -0
  111. package/src/icon/index.tsx +28 -12
  112. package/src/icon/test/{index.tsx → index.jsdom.test.tsx} +66 -0
  113. package/src/input-control/test/{index.js → index.jsdom.test.tsx} +16 -10
  114. package/src/item-group/style.module.scss +1 -2
  115. package/src/navigator/test/router.ts +1 -0
  116. package/src/notice/test/__snapshots__/{index.tsx.snap → index.jsdom.test.tsx.snap} +5 -2
  117. package/src/popover/README.md +2 -2
  118. package/src/popover/test/{index.tsx → index.jsdom.test.tsx} +23 -0
  119. package/src/popover/types.ts +9 -3
  120. package/src/query-controls/test/terms.ts +1 -0
  121. package/src/resizable-box/index.tsx +1 -1
  122. package/src/slot-fill/test/{index.js → index.jsdom.test.tsx} +3 -3
  123. package/src/slot-fill/test/{slot.js → slot.jsdom.test.tsx} +17 -9
  124. package/src/snackbar/index.tsx +10 -6
  125. package/src/snackbar/test/{index.tsx → index.jsdom.test.tsx} +28 -2
  126. package/src/snackbar/test/list.jsdom.test.tsx +99 -0
  127. package/src/surface/style.module.scss +2 -2
  128. package/src/textarea-control/style.module.scss +1 -1
  129. package/src/tip/style.scss +1 -1
  130. package/src/toggle-group-control/toggle-group-control/style.module.scss +1 -1
  131. package/src/tools-panel/test/{index.tsx → index.jsdom.test.tsx} +528 -9
  132. package/src/tools-panel/tools-panel/hook.ts +195 -180
  133. package/src/tools-panel/tools-panel-item/README.md +42 -1
  134. package/src/tools-panel/tools-panel-item/hook.ts +97 -69
  135. package/src/tools-panel/types.ts +54 -9
  136. package/src/truncate/style.module.scss +0 -1
  137. package/src/unit-control/test/utils.ts +1 -0
  138. package/src/utils/hooks/test/{use-controlled-state.js → use-controlled-state.jsdom.test.tsx} +17 -3
  139. package/src/utils/hooks/test/{use-controlled-value.js → use-controlled-value.jsdom.test.tsx} +3 -1
  140. package/src/utils/hooks/test/{use-cx.js → use-cx.jsdom.test.tsx} +3 -1
  141. package/src/utils/test/colors.js +1 -0
  142. package/src/utils/test/{get-node-text.js → get-node-text.tsx} +1 -0
  143. package/src/utils/test/math.js +1 -0
  144. package/src/utils/test/rtl.js +1 -0
  145. package/src/utils/test/space.js +1 -0
  146. package/src/utils/test/strings.js +1 -0
  147. package/src/utils/test/unit-values.js +1 -0
  148. package/src/view/test/{index.js → index.jsdom.test.tsx} +5 -1
  149. package/src/snackbar/test/list.tsx +0 -39
  150. /package/src/alignment-matrix-control/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  151. /package/src/autocomplete/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  152. /package/src/badge/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  153. /package/src/base-control/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  154. /package/src/box-control/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  155. /package/src/button/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  156. /package/src/card/test/__snapshots__/{index.tsx.snap → index.jsdom.test.tsx.snap} +0 -0
  157. /package/src/card/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  158. /package/src/checkbox-control/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  159. /package/src/circular-option-picker/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  160. /package/src/color-indicator/test/__snapshots__/{index.tsx.snap → index.jsdom.test.tsx.snap} +0 -0
  161. /package/src/color-indicator/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  162. /package/src/color-palette/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  163. /package/src/color-palette/test/{utils.ts → utils.jsdom.test.ts} +0 -0
  164. /package/src/color-picker/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  165. /package/src/combobox-control/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  166. /package/src/composite/legacy/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  167. /package/src/composite/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  168. /package/src/confirm-dialog/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  169. /package/src/content-editable-control/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  170. /package/src/custom-gradient-picker/gradient-bar/test/{utils.ts → utils.jsdom.test.ts} +0 -0
  171. /package/src/custom-gradient-picker/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  172. /package/src/custom-select-control/test/__snapshots__/{index.tsx.snap → index.jsdom.test.tsx.snap} +0 -0
  173. /package/src/custom-select-control/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  174. /package/src/custom-select-control-v2/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  175. /package/src/date-time/date-picker/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  176. /package/src/date-time/date-picker/test/{use-lilius.ts → use-lilius.jsdom.test.ts} +0 -0
  177. /package/src/date-time/date-time/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  178. /package/src/date-time/time-picker/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  179. /package/src/date-time/time-picker/time-input/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  180. /package/src/disabled/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  181. /package/src/divider/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  182. /package/src/dropdown/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  183. /package/src/dropdown-menu/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  184. /package/src/duotone-picker/test/{custom-duotone-bar.tsx → custom-duotone-bar.jsdom.test.tsx} +0 -0
  185. /package/src/duotone-picker/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  186. /package/src/elevation/test/__snapshots__/{index.tsx.snap → index.jsdom.test.tsx.snap} +0 -0
  187. /package/src/elevation/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  188. /package/src/external-link/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  189. /package/src/flex/test/__snapshots__/{index.tsx.snap → index.jsdom.test.tsx.snap} +0 -0
  190. /package/src/flex/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  191. /package/src/focal-point-picker/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  192. /package/src/focal-point-picker/test/{media.tsx → media.jsdom.test.tsx} +0 -0
  193. /package/src/font-size-picker/test/{font-size-picker-select.tsx → font-size-picker-select.jsdom.test.tsx} +0 -0
  194. /package/src/font-size-picker/test/{font-size-picker-toggle-group.tsx → font-size-picker-toggle-group.jsdom.test.tsx} +0 -0
  195. /package/src/font-size-picker/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  196. /package/src/form-file-upload/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  197. /package/src/form-toggle/test/__snapshots__/{index.tsx.snap → index.jsdom.test.tsx.snap} +0 -0
  198. /package/src/form-toggle/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  199. /package/src/form-token-field/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  200. /package/src/gradient-picker/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  201. /package/src/grid/test/{grid.tsx → grid.jsdom.test.tsx} +0 -0
  202. /package/src/guide/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  203. /package/src/h-stack/test/__snapshots__/{index.tsx.snap → index.jsdom.test.tsx.snap} +0 -0
  204. /package/src/h-stack/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  205. /package/src/heading/test/__snapshots__/{index.tsx.snap → index.jsdom.test.tsx.snap} +0 -0
  206. /package/src/heading/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  207. /package/src/higher-order/with-fallback-styles/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  208. /package/src/higher-order/with-filters/test/__snapshots__/{index.tsx.snap → index.jsdom.test.tsx.snap} +0 -0
  209. /package/src/higher-order/with-filters/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  210. /package/src/higher-order/with-focus-outside/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  211. /package/src/higher-order/with-focus-return/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  212. /package/src/higher-order/with-notices/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  213. /package/src/higher-order/with-spoken-messages/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  214. /package/src/input-control/test/__snapshots__/{index.js.snap → index.jsdom.test.tsx.snap} +0 -0
  215. /package/src/isolated-event-container/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  216. /package/src/item-group/test/__snapshots__/{index.js.snap → index.jsdom.test.tsx.snap} +0 -0
  217. /package/src/item-group/test/{index.js → index.jsdom.test.tsx} +0 -0
  218. /package/src/keyboard-shortcuts/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  219. /package/src/menu/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  220. /package/src/menu-group/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  221. /package/src/menu-item/test/__snapshots__/{index.js.snap → index.jsdom.test.tsx.snap} +0 -0
  222. /package/src/menu-item/test/{index.js → index.jsdom.test.tsx} +0 -0
  223. /package/src/modal/test/{aria-helper.ts → aria-helper.jsdom.test.ts} +0 -0
  224. /package/src/modal/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  225. /package/src/navigable-container/test/{navigable-menu.tsx → navigable-menu.jsdom.test.tsx} +0 -0
  226. /package/src/navigable-container/test/{tababble-container.tsx → tababble-container.jsdom.test.tsx} +0 -0
  227. /package/src/navigator/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  228. /package/src/notice/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  229. /package/src/notice/test/{list.tsx → list.jsdom.test.tsx} +0 -0
  230. /package/src/number-control/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  231. /package/src/palette-edit/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  232. /package/src/panel/test/__snapshots__/{body.tsx.snap → body.jsdom.test.tsx.snap} +0 -0
  233. /package/src/panel/test/__snapshots__/{header.tsx.snap → header.jsdom.test.tsx.snap} +0 -0
  234. /package/src/panel/test/__snapshots__/{index.tsx.snap → index.jsdom.test.tsx.snap} +0 -0
  235. /package/src/panel/test/__snapshots__/{row.tsx.snap → row.jsdom.test.tsx.snap} +0 -0
  236. /package/src/panel/test/{body.tsx → body.jsdom.test.tsx} +0 -0
  237. /package/src/panel/test/{header.tsx → header.jsdom.test.tsx} +0 -0
  238. /package/src/panel/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  239. /package/src/panel/test/{row.tsx → row.jsdom.test.tsx} +0 -0
  240. /package/src/placeholder/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  241. /package/src/progress-bar/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  242. /package/src/radio-control/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  243. /package/src/range-control/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  244. /package/src/resizable-box/resize-tooltip/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  245. /package/src/resizable-box/resize-tooltip/test/{label.tsx → label.jsdom.test.tsx} +0 -0
  246. /package/src/sandbox/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  247. /package/src/scroll-lock/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  248. /package/src/scrollable/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  249. /package/src/search-control/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  250. /package/src/select-control/test/__snapshots__/{select-control.tsx.snap → select-control.jsdom.test.tsx.snap} +0 -0
  251. /package/src/select-control/test/{select-control.tsx → select-control.jsdom.test.tsx} +0 -0
  252. /package/src/shortcut/test/__snapshots__/{index.tsx.snap → index.jsdom.test.tsx.snap} +0 -0
  253. /package/src/shortcut/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  254. /package/src/slot-fill/test/__snapshots__/{slot.js.snap → slot.jsdom.test.tsx.snap} +0 -0
  255. /package/src/spacer/test/__snapshots__/{index.tsx.snap → index.jsdom.test.tsx.snap} +0 -0
  256. /package/src/spacer/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  257. /package/src/style-provider/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  258. /package/src/surface/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  259. /package/src/tab-panel/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  260. /package/src/tabs/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  261. /package/src/text/test/__snapshots__/{index.tsx.snap → index.jsdom.test.tsx.snap} +0 -0
  262. /package/src/text/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  263. /package/src/text-control/test/{text-control.tsx → text-control.jsdom.test.tsx} +0 -0
  264. /package/src/text-highlight/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  265. /package/src/toggle-control/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  266. /package/src/toggle-group-control/test/__snapshots__/{index.tsx.snap → index.jsdom.test.tsx.snap} +0 -0
  267. /package/src/toggle-group-control/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  268. /package/src/toolbar/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  269. /package/src/toolbar/test/{toolbar-group.tsx → toolbar-group.jsdom.test.tsx} +0 -0
  270. /package/src/tooltip/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  271. /package/src/tree-grid/test/__snapshots__/{cell.tsx.snap → cell.jsdom.test.tsx.snap} +0 -0
  272. /package/src/tree-grid/test/__snapshots__/{index.tsx.snap → index.jsdom.test.tsx.snap} +0 -0
  273. /package/src/tree-grid/test/__snapshots__/{roving-tab-index-item.tsx.snap → roving-tab-index-item.jsdom.test.tsx.snap} +0 -0
  274. /package/src/tree-grid/test/__snapshots__/{roving-tab-index.tsx.snap → roving-tab-index.jsdom.test.tsx.snap} +0 -0
  275. /package/src/tree-grid/test/__snapshots__/{row.tsx.snap → row.jsdom.test.tsx.snap} +0 -0
  276. /package/src/tree-grid/test/{cell.tsx → cell.jsdom.test.tsx} +0 -0
  277. /package/src/tree-grid/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  278. /package/src/tree-grid/test/{roving-tab-index-item.tsx → roving-tab-index-item.jsdom.test.tsx} +0 -0
  279. /package/src/tree-grid/test/{roving-tab-index.tsx → roving-tab-index.jsdom.test.tsx} +0 -0
  280. /package/src/tree-grid/test/{row.tsx → row.jsdom.test.tsx} +0 -0
  281. /package/src/truncate/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  282. /package/src/unit-control/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  283. /package/src/utils/test/{polymorphic-element.tsx → polymorphic-element.jsdom.test.tsx} +0 -0
  284. /package/src/v-stack/test/__snapshots__/{index.tsx.snap → index.jsdom.test.tsx.snap} +0 -0
  285. /package/src/v-stack/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  286. /package/src/validated-form-controls/test/{content-editable-control.tsx → content-editable-control.jsdom.test.tsx} +0 -0
  287. /package/src/validated-form-controls/test/{custom-select-control.tsx → custom-select-control.jsdom.test.tsx} +0 -0
  288. /package/src/validated-form-controls/test/{input-control.tsx → input-control.jsdom.test.tsx} +0 -0
  289. /package/src/validated-form-controls/test/{range-control.tsx → range-control.jsdom.test.tsx} +0 -0
  290. /package/src/validated-form-controls/test/{textarea-control.tsx → textarea-control.jsdom.test.tsx} +0 -0
  291. /package/src/view/test/__snapshots__/{index.js.snap → index.jsdom.test.tsx.snap} +0 -0
@@ -121,62 +121,20 @@ var style_module_default = { "tools-panel": "_62d714739f4dc308__tools-panel", "t
121
121
 
122
122
  // packages/components/src/tools-panel/tools-panel/hook.ts
123
123
  var import_context = require("../../context/index.cjs");
124
- function emptyMenuItems() {
125
- return {
126
- default: {},
127
- optional: {}
128
- };
129
- }
130
124
  function emptyState() {
131
125
  return {
132
126
  panelItems: [],
133
127
  menuItemOrder: [],
134
- menuItems: emptyMenuItems()
128
+ menuItemValues: {}
135
129
  };
136
130
  }
137
- var generateMenuItems = ({
138
- panelItems,
139
- shouldReset,
140
- currentMenuItems,
141
- menuItemOrder
142
- }) => {
143
- const newMenuItems = emptyMenuItems();
144
- const menuItems = emptyMenuItems();
145
- panelItems.forEach(({
146
- hasValue,
147
- isShownByDefault,
148
- label
149
- }) => {
150
- const group = isShownByDefault ? "default" : "optional";
151
- const existingItemValue = currentMenuItems?.[group]?.[label];
152
- const value = existingItemValue ? existingItemValue : hasValue();
153
- newMenuItems[group][label] = shouldReset ? false : value;
154
- });
155
- menuItemOrder.forEach((key) => {
156
- if (newMenuItems.default.hasOwnProperty(key)) {
157
- menuItems.default[key] = newMenuItems.default[key];
158
- }
159
- if (newMenuItems.optional.hasOwnProperty(key)) {
160
- menuItems.optional[key] = newMenuItems.optional[key];
161
- }
162
- });
163
- Object.keys(newMenuItems.default).forEach((key) => {
164
- if (!menuItems.default.hasOwnProperty(key)) {
165
- menuItems.default[key] = newMenuItems.default[key];
166
- }
167
- });
168
- Object.keys(newMenuItems.optional).forEach((key) => {
169
- if (!menuItems.optional.hasOwnProperty(key)) {
170
- menuItems.optional[key] = newMenuItems.optional[key];
171
- }
172
- });
173
- return menuItems;
174
- };
131
+ var getSeedValue = (item) => item.hasValue() || !item.isShownByDefault && !!item.defaultShown;
132
+ var getMenuGroup = (item) => item.isShownByDefault ? "default" : "optional";
175
133
  function panelItemsReducer(panelItems, action) {
176
134
  switch (action.type) {
177
135
  case "REGISTER_PANEL": {
136
+ const existingIndex = panelItems.findIndex((item) => item.label === action.item.label);
178
137
  const newItems = [...panelItems];
179
- const existingIndex = newItems.findIndex((oldItem) => oldItem.label === action.item.label);
180
138
  if (existingIndex !== -1) {
181
139
  newItems.splice(existingIndex, 1);
182
140
  }
@@ -185,12 +143,15 @@ function panelItemsReducer(panelItems, action) {
185
143
  }
186
144
  case "UNREGISTER_PANEL": {
187
145
  const index = panelItems.findIndex((item) => item.label === action.label);
188
- if (index !== -1) {
189
- const newItems = [...panelItems];
190
- newItems.splice(index, 1);
191
- return newItems;
146
+ if (index === -1) {
147
+ return panelItems;
192
148
  }
193
- return panelItems;
149
+ if (action.item && panelItems[index] !== action.item) {
150
+ return panelItems;
151
+ }
152
+ const newItems = [...panelItems];
153
+ newItems.splice(index, 1);
154
+ return newItems;
194
155
  }
195
156
  default:
196
157
  return panelItems;
@@ -208,66 +169,74 @@ function menuItemOrderReducer(menuItemOrder, action) {
208
169
  return menuItemOrder;
209
170
  }
210
171
  }
211
- function menuItemsReducer(state, action) {
172
+ function menuItemValuesReducer(state, action) {
173
+ const values = state.menuItemValues;
212
174
  switch (action.type) {
213
- case "REGISTER_PANEL":
214
- case "UNREGISTER_PANEL":
215
- return generateMenuItems({
216
- currentMenuItems: state.menuItems,
217
- panelItems: state.panelItems,
218
- menuItemOrder: state.menuItemOrder,
219
- shouldReset: false
220
- });
221
- case "RESET_ALL":
222
- return generateMenuItems({
223
- panelItems: state.panelItems,
224
- menuItemOrder: state.menuItemOrder,
225
- shouldReset: true
226
- });
175
+ case "REGISTER_PANEL": {
176
+ if (!values.hasOwnProperty(action.item.label)) {
177
+ return values;
178
+ }
179
+ const {
180
+ [action.item.label]: unusedValue,
181
+ ...rest
182
+ } = values;
183
+ return rest;
184
+ }
227
185
  case "UPDATE_VALUE": {
228
- const oldValue = state.menuItems[action.group][action.label];
229
- if (action.value === oldValue) {
230
- return state.menuItems;
186
+ if (values[action.label] === action.value) {
187
+ return values;
231
188
  }
232
189
  return {
233
- ...state.menuItems,
234
- [action.group]: {
235
- ...state.menuItems[action.group],
236
- [action.label]: action.value
237
- }
190
+ ...values,
191
+ [action.label]: action.value
238
192
  };
239
193
  }
240
194
  case "TOGGLE_VALUE": {
241
- const currentItem = state.panelItems.find((item) => item.label === action.label);
242
- if (!currentItem) {
243
- return state.menuItems;
195
+ const item = state.panelItems.find(({
196
+ label
197
+ }) => label === action.label);
198
+ if (!item) {
199
+ return values;
200
+ }
201
+ const current = values[action.label] ?? getSeedValue(item);
202
+ return {
203
+ ...values,
204
+ [action.label]: !current
205
+ };
206
+ }
207
+ case "RESET_ALL": {
208
+ const hidden = state.panelItems.filter((item) => !item.isShownByDefault && values[item.label] !== false);
209
+ if (!hidden.length) {
210
+ return values;
244
211
  }
245
- const menuGroup = currentItem.isShownByDefault ? "default" : "optional";
246
- const newMenuItems = {
247
- ...state.menuItems,
248
- [menuGroup]: {
249
- ...state.menuItems[menuGroup],
250
- [action.label]: !state.menuItems[menuGroup][action.label]
251
- }
212
+ const next = {
213
+ ...values
252
214
  };
253
- return newMenuItems;
215
+ hidden.forEach(({
216
+ label
217
+ }) => {
218
+ next[label] = false;
219
+ });
220
+ return next;
254
221
  }
255
222
  default:
256
- return state.menuItems;
223
+ return values;
257
224
  }
258
225
  }
259
226
  function panelReducer(state, action) {
260
227
  const panelItems = panelItemsReducer(state.panelItems, action);
261
228
  const menuItemOrder = menuItemOrderReducer(state.menuItemOrder, action);
262
- const menuItems = menuItemsReducer({
263
- panelItems,
264
- menuItemOrder,
265
- menuItems: state.menuItems
229
+ const menuItemValues = menuItemValuesReducer({
230
+ ...state,
231
+ panelItems
266
232
  }, action);
233
+ if (panelItems === state.panelItems && menuItemOrder === state.menuItemOrder && menuItemValues === state.menuItemValues) {
234
+ return state;
235
+ }
267
236
  return {
268
237
  panelItems,
269
238
  menuItemOrder,
270
- menuItems
239
+ menuItemValues
271
240
  };
272
241
  }
273
242
  function resetAllFiltersReducer(filters, action) {
@@ -293,28 +262,29 @@ function useToolsPanel(props) {
293
262
  __experimentalLastVisibleItemClass,
294
263
  ...otherProps
295
264
  } = (0, import_context.useContextSystem)(props, "ToolsPanel");
296
- const isResettingRef = (0, import_element.useRef)(false);
297
- const wasResetting = isResettingRef.current;
265
+ const [isResetting, setIsResetting] = (0, import_element.useState)(false);
298
266
  (0, import_element.useEffect)(() => {
299
- if (wasResetting) {
300
- isResettingRef.current = false;
267
+ if (isResetting) {
268
+ setIsResetting(false);
301
269
  }
302
- }, [wasResetting]);
270
+ }, [isResetting]);
303
271
  const [{
304
272
  panelItems,
305
- menuItems
273
+ menuItemOrder,
274
+ menuItemValues
306
275
  }, panelDispatch] = (0, import_element.useReducer)(panelReducer, void 0, emptyState);
307
- const [resetAllFilters, dispatchResetAllFilters] = (0, import_element.useReducer)(resetAllFiltersReducer, []);
276
+ const [externalResetAllFilters, dispatchResetAllFilters] = (0, import_element.useReducer)(resetAllFiltersReducer, []);
308
277
  const registerPanelItem = (0, import_element.useCallback)((item) => {
309
278
  panelDispatch({
310
279
  type: "REGISTER_PANEL",
311
280
  item
312
281
  });
313
282
  }, []);
314
- const deregisterPanelItem = (0, import_element.useCallback)((label) => {
283
+ const deregisterPanelItem = (0, import_element.useCallback)((label, item) => {
315
284
  panelDispatch({
316
285
  type: "UNREGISTER_PANEL",
317
- label
286
+ label,
287
+ item
318
288
  });
319
289
  }, []);
320
290
  const registerResetAllFilter = (0, import_element.useCallback)((filter) => {
@@ -329,27 +299,53 @@ function useToolsPanel(props) {
329
299
  filter
330
300
  });
331
301
  }, []);
332
- const flagItemCustomization = (0, import_element.useCallback)((value, label, group = "default") => {
302
+ const flagItemCustomization = (0, import_element.useCallback)((value, label) => {
333
303
  panelDispatch({
334
304
  type: "UPDATE_VALUE",
335
- group,
336
305
  label,
337
306
  value
338
307
  });
339
308
  }, []);
309
+ const menuItems = (0, import_element.useMemo)(() => {
310
+ const result = {
311
+ default: {},
312
+ optional: {}
313
+ };
314
+ const byLabel = new Map(panelItems.map((item) => [item.label, item]));
315
+ menuItemOrder.forEach((label) => {
316
+ const item = byLabel.get(label);
317
+ if (!item) {
318
+ return;
319
+ }
320
+ result[getMenuGroup(item)][label] = menuItemValues[label] ?? getSeedValue(item);
321
+ });
322
+ return result;
323
+ }, [panelItems, menuItemOrder, menuItemValues]);
340
324
  const areAllOptionalControlsHidden = (0, import_element.useMemo)(() => {
341
325
  return isMenuItemTypeEmpty(menuItems.default) && !isMenuItemTypeEmpty(menuItems.optional) && Object.values(menuItems.optional).every((isSelected) => !isSelected);
342
326
  }, [menuItems]);
343
327
  const classes = (0, import_clsx.default)(style_module_default["tools-panel"], hasInnerWrapper && style_module_default["tools-panel-with-inner-wrapper"], areAllOptionalControlsHidden && style_module_default["tools-panel-hidden-inner-wrapper"], className);
344
328
  const toggleItem = (0, import_element.useCallback)((label) => {
329
+ const currentItem = panelItems.find((item) => item.label === label);
330
+ if (!currentItem) {
331
+ return;
332
+ }
345
333
  panelDispatch({
346
334
  type: "TOGGLE_VALUE",
347
335
  label
348
336
  });
349
- }, []);
337
+ if (currentItem.isShownByDefault) {
338
+ return;
339
+ }
340
+ currentItem.onShownChange?.(!menuItems.optional[label]);
341
+ }, [menuItems, panelItems]);
342
+ const resetAllFilters = (0, import_element.useMemo)(() => {
343
+ const itemFilters = panelItems.map((item) => item.resetAllFilter).filter((filter) => !!filter);
344
+ return [...itemFilters, ...externalResetAllFilters];
345
+ }, [panelItems, externalResetAllFilters]);
350
346
  const resetAllItems = (0, import_element.useCallback)(() => {
351
347
  if (typeof resetAll === "function") {
352
- isResettingRef.current = true;
348
+ setIsResetting(true);
353
349
  resetAll(resetAllFilters);
354
350
  }
355
351
  panelDispatch({
@@ -371,7 +367,7 @@ function useToolsPanel(props) {
371
367
  firstDisplayedItem,
372
368
  flagItemCustomization,
373
369
  hasMenuItems,
374
- isResetting: isResettingRef.current,
370
+ isResetting,
375
371
  lastDisplayedItem,
376
372
  menuItems,
377
373
  panelId,
@@ -380,7 +376,7 @@ function useToolsPanel(props) {
380
376
  shouldRenderPlaceholderItems,
381
377
  __experimentalFirstVisibleItemClass,
382
378
  __experimentalLastVisibleItemClass
383
- }), [areAllOptionalControlsHidden, deregisterPanelItem, deregisterResetAllFilter, firstDisplayedItem, flagItemCustomization, lastDisplayedItem, menuItems, panelId, hasMenuItems, registerResetAllFilter, registerPanelItem, shouldRenderPlaceholderItems, __experimentalFirstVisibleItemClass, __experimentalLastVisibleItemClass]);
379
+ }), [areAllOptionalControlsHidden, deregisterPanelItem, deregisterResetAllFilter, firstDisplayedItem, flagItemCustomization, isResetting, lastDisplayedItem, menuItems, panelId, hasMenuItems, registerResetAllFilter, registerPanelItem, shouldRenderPlaceholderItems, __experimentalFirstVisibleItemClass, __experimentalLastVisibleItemClass]);
384
380
  return {
385
381
  ...otherProps,
386
382
  headingLevel,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/tools-panel/tools-panel/hook.ts", "../../../../style-runtime/src/index.ts", "../../../src/tools-panel/style.module.scss"],
4
- "sourcesContent": ["import clsx from 'clsx';\nimport { useCallback, useEffect, useMemo, useReducer, useRef } from '@wordpress/element';\nimport styles from '../style.module.scss';\nimport { useContextSystem } from '../../context';\nfunction emptyMenuItems() {\n return {\n default: {},\n optional: {}\n };\n}\nfunction emptyState() {\n return {\n panelItems: [],\n menuItemOrder: [],\n menuItems: emptyMenuItems()\n };\n}\nconst generateMenuItems = ({\n panelItems,\n shouldReset,\n currentMenuItems,\n menuItemOrder\n}) => {\n const newMenuItems = emptyMenuItems();\n const menuItems = emptyMenuItems();\n panelItems.forEach(({\n hasValue,\n isShownByDefault,\n label\n }) => {\n const group = isShownByDefault ? 'default' : 'optional';\n\n // If a menu item for this label has already been flagged as customized\n // (for default controls), or toggled on (for optional controls), do not\n // overwrite its value as those controls would lose that state.\n const existingItemValue = currentMenuItems?.[group]?.[label];\n const value = existingItemValue ? existingItemValue : hasValue();\n newMenuItems[group][label] = shouldReset ? false : value;\n });\n\n // Loop the known, previously registered items first to maintain menu order.\n menuItemOrder.forEach(key => {\n if (newMenuItems.default.hasOwnProperty(key)) {\n menuItems.default[key] = newMenuItems.default[key];\n }\n if (newMenuItems.optional.hasOwnProperty(key)) {\n menuItems.optional[key] = newMenuItems.optional[key];\n }\n });\n\n // Loop newMenuItems object adding any that aren't in the known items order.\n Object.keys(newMenuItems.default).forEach(key => {\n if (!menuItems.default.hasOwnProperty(key)) {\n menuItems.default[key] = newMenuItems.default[key];\n }\n });\n Object.keys(newMenuItems.optional).forEach(key => {\n if (!menuItems.optional.hasOwnProperty(key)) {\n menuItems.optional[key] = newMenuItems.optional[key];\n }\n });\n return menuItems;\n};\nfunction panelItemsReducer(panelItems, action) {\n switch (action.type) {\n case 'REGISTER_PANEL':\n {\n const newItems = [...panelItems];\n // If an item with this label has already been registered, remove it\n // first. This can happen when an item is moved between the default\n // and optional groups.\n const existingIndex = newItems.findIndex(oldItem => oldItem.label === action.item.label);\n if (existingIndex !== -1) {\n newItems.splice(existingIndex, 1);\n }\n newItems.push(action.item);\n return newItems;\n }\n case 'UNREGISTER_PANEL':\n {\n const index = panelItems.findIndex(item => item.label === action.label);\n if (index !== -1) {\n const newItems = [...panelItems];\n newItems.splice(index, 1);\n return newItems;\n }\n return panelItems;\n }\n default:\n return panelItems;\n }\n}\nfunction menuItemOrderReducer(menuItemOrder, action) {\n switch (action.type) {\n case 'REGISTER_PANEL':\n {\n // Track the initial order of item registration. This is used for\n // maintaining menu item order later.\n if (menuItemOrder.includes(action.item.label)) {\n return menuItemOrder;\n }\n return [...menuItemOrder, action.item.label];\n }\n default:\n return menuItemOrder;\n }\n}\nfunction menuItemsReducer(state, action) {\n switch (action.type) {\n case 'REGISTER_PANEL':\n case 'UNREGISTER_PANEL':\n // generate new menu items from original `menuItems` and updated `panelItems` and `menuItemOrder`\n return generateMenuItems({\n currentMenuItems: state.menuItems,\n panelItems: state.panelItems,\n menuItemOrder: state.menuItemOrder,\n shouldReset: false\n });\n case 'RESET_ALL':\n return generateMenuItems({\n panelItems: state.panelItems,\n menuItemOrder: state.menuItemOrder,\n shouldReset: true\n });\n case 'UPDATE_VALUE':\n {\n const oldValue = state.menuItems[action.group][action.label];\n if (action.value === oldValue) {\n return state.menuItems;\n }\n return {\n ...state.menuItems,\n [action.group]: {\n ...state.menuItems[action.group],\n [action.label]: action.value\n }\n };\n }\n case 'TOGGLE_VALUE':\n {\n const currentItem = state.panelItems.find(item => item.label === action.label);\n if (!currentItem) {\n return state.menuItems;\n }\n const menuGroup = currentItem.isShownByDefault ? 'default' : 'optional';\n const newMenuItems = {\n ...state.menuItems,\n [menuGroup]: {\n ...state.menuItems[menuGroup],\n [action.label]: !state.menuItems[menuGroup][action.label]\n }\n };\n return newMenuItems;\n }\n default:\n return state.menuItems;\n }\n}\nfunction panelReducer(state, action) {\n const panelItems = panelItemsReducer(state.panelItems, action);\n const menuItemOrder = menuItemOrderReducer(state.menuItemOrder, action);\n // `menuItemsReducer` is a bit unusual because it generates new state from original `menuItems`\n // and the updated `panelItems` and `menuItemOrder`.\n const menuItems = menuItemsReducer({\n panelItems,\n menuItemOrder,\n menuItems: state.menuItems\n }, action);\n return {\n panelItems,\n menuItemOrder,\n menuItems\n };\n}\nfunction resetAllFiltersReducer(filters, action) {\n switch (action.type) {\n case 'REGISTER':\n return [...filters, action.filter];\n case 'UNREGISTER':\n return filters.filter(f => f !== action.filter);\n default:\n return filters;\n }\n}\nconst isMenuItemTypeEmpty = obj => Object.keys(obj).length === 0;\nexport function useToolsPanel(props) {\n const {\n className,\n headingLevel = 2,\n resetAll,\n panelId,\n hasInnerWrapper = false,\n shouldRenderPlaceholderItems = false,\n __experimentalFirstVisibleItemClass,\n __experimentalLastVisibleItemClass,\n ...otherProps\n } = useContextSystem(props, 'ToolsPanel');\n const isResettingRef = useRef(false);\n const wasResetting = isResettingRef.current;\n\n // `isResettingRef` is cleared via this hook to effectively batch together\n // the resetAll task. Without this, the flag is cleared after the first\n // control updates and forces a rerender with subsequent controls then\n // believing they need to reset, unfortunately using stale data.\n useEffect(() => {\n if (wasResetting) {\n isResettingRef.current = false;\n }\n }, [wasResetting]);\n\n // Allow panel items to register themselves.\n const [{\n panelItems,\n menuItems\n }, panelDispatch] = useReducer(panelReducer, undefined, emptyState);\n const [resetAllFilters, dispatchResetAllFilters] = useReducer(resetAllFiltersReducer, []);\n const registerPanelItem = useCallback(item => {\n // Add item to panel items.\n panelDispatch({\n type: 'REGISTER_PANEL',\n item\n });\n }, []);\n\n // Panels need to deregister on unmount to avoid orphans in menu state.\n // This is an issue when panel items are being injected via SlotFills.\n const deregisterPanelItem = useCallback(label => {\n // When switching selections between components injecting matching\n // controls, e.g. both panels have a \"padding\" control, the\n // deregistration of the first panel doesn't occur until after the\n // registration of the next.\n panelDispatch({\n type: 'UNREGISTER_PANEL',\n label\n });\n }, []);\n const registerResetAllFilter = useCallback(filter => {\n dispatchResetAllFilters({\n type: 'REGISTER',\n filter\n });\n }, []);\n const deregisterResetAllFilter = useCallback(filter => {\n dispatchResetAllFilters({\n type: 'UNREGISTER',\n filter\n });\n }, []);\n\n // Updates the status of the panel’s menu items. For default items the\n // value represents whether it differs from the default and for optional\n // items whether the item is shown.\n const flagItemCustomization = useCallback((value, label, group = 'default') => {\n panelDispatch({\n type: 'UPDATE_VALUE',\n group,\n label,\n value\n });\n }, []);\n\n // Whether all optional menu items are hidden or not must be tracked\n // in order to later determine if the panel display is empty and handle\n // conditional display of a plus icon to indicate the presence of further\n // menu items.\n const areAllOptionalControlsHidden = useMemo(() => {\n return isMenuItemTypeEmpty(menuItems.default) && !isMenuItemTypeEmpty(menuItems.optional) && Object.values(menuItems.optional).every(isSelected => !isSelected);\n }, [menuItems]);\n const classes = clsx(styles['tools-panel'], hasInnerWrapper && styles['tools-panel-with-inner-wrapper'], areAllOptionalControlsHidden && styles['tools-panel-hidden-inner-wrapper'], className);\n\n // Toggle the checked state of a menu item which is then used to determine\n // display of the item within the panel.\n const toggleItem = useCallback(label => {\n panelDispatch({\n type: 'TOGGLE_VALUE',\n label\n });\n }, []);\n\n // Resets display of children and executes resetAll callback if available.\n const resetAllItems = useCallback(() => {\n if (typeof resetAll === 'function') {\n isResettingRef.current = true;\n resetAll(resetAllFilters);\n }\n\n // Turn off display of all non-default items.\n panelDispatch({\n type: 'RESET_ALL'\n });\n }, [resetAllFilters, resetAll]);\n\n // Assist ItemGroup styling when there are potentially hidden placeholder\n // items by identifying first & last items that are toggled on for display.\n const getFirstVisibleItemLabel = items => {\n const optionalItems = menuItems.optional || {};\n const firstItem = items.find(item => item.isShownByDefault || optionalItems[item.label]);\n return firstItem?.label;\n };\n const firstDisplayedItem = getFirstVisibleItemLabel(panelItems);\n const lastDisplayedItem = getFirstVisibleItemLabel([...panelItems].reverse());\n const hasMenuItems = panelItems.length > 0;\n const panelContext = useMemo(() => ({\n areAllOptionalControlsHidden,\n deregisterPanelItem,\n deregisterResetAllFilter,\n firstDisplayedItem,\n flagItemCustomization,\n hasMenuItems,\n isResetting: isResettingRef.current,\n lastDisplayedItem,\n menuItems,\n panelId,\n registerPanelItem,\n registerResetAllFilter,\n shouldRenderPlaceholderItems,\n __experimentalFirstVisibleItemClass,\n __experimentalLastVisibleItemClass\n }), [areAllOptionalControlsHidden, deregisterPanelItem, deregisterResetAllFilter, firstDisplayedItem, flagItemCustomization, lastDisplayedItem, menuItems, panelId, hasMenuItems, registerResetAllFilter, registerPanelItem, shouldRenderPlaceholderItems, __experimentalFirstVisibleItemClass, __experimentalLastVisibleItemClass]);\n return {\n ...otherProps,\n headingLevel,\n panelContext,\n resetAllItems,\n toggleItem,\n className: classes\n };\n}", "const 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 const globalScope = globalThis;\n if (globalScope.__wpStyleRuntime) {\n return globalScope.__wpStyleRuntime;\n }\n globalScope.__wpStyleRuntime = {\n documents: new Map(),\n styles: new Map(),\n injectedStyles: new WeakMap()\n };\n if (typeof document !== 'undefined') {\n registerDocument(document);\n }\n return 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(targetDocument, hash) {\n if (!targetDocument.head) {\n return false;\n }\n for (const style of targetDocument.head.querySelectorAll(`style[${STYLE_HASH_ATTRIBUTE}]`)) {\n if (style.getAttribute(STYLE_HASH_ATTRIBUTE) === hash) {\n return true;\n }\n }\n return 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, hash, css) {\n if (!targetDocument.head) {\n return;\n }\n const runtime = getRuntime();\n let injectedStyles = runtime.injectedStyles.get(targetDocument);\n if (!injectedStyles) {\n injectedStyles = new Set();\n runtime.injectedStyles.set(targetDocument, injectedStyles);\n }\n if (injectedStyles.has(hash)) {\n return;\n }\n\n // Older generated CSS module output can still inject matching style tags\n // after this document's cache is created, so keep the DOM as the fallback\n // source of truth on cache misses.\n if (documentContainsStyleHash(targetDocument, hash)) {\n injectedStyles.add(hash);\n return;\n }\n const style = targetDocument.createElement('style');\n style.setAttribute(STYLE_HASH_ATTRIBUTE, hash);\n style.appendChild(targetDocument.createTextNode(css));\n targetDocument.head.appendChild(style);\n injectedStyles.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) {\n const runtime = getRuntime();\n runtime.documents.set(targetDocument, (runtime.documents.get(targetDocument) ?? 0) + 1);\n for (const [hash, css] of runtime.styles) {\n injectStyle(targetDocument, hash, css);\n }\n return () => {\n const count = runtime.documents.get(targetDocument);\n if (count === undefined) {\n return;\n }\n if (count <= 1) {\n runtime.documents.delete(targetDocument);\n return;\n }\n runtime.documents.set(targetDocument, count - 1);\n };\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, css) {\n const runtime = getRuntime();\n runtime.styles.set(hash, css);\n for (const targetDocument of runtime.documents.keys()) {\n injectStyle(targetDocument, hash, css);\n }\n}", "import { registerStyle } from '@wordpress/style-runtime';\nif (typeof process === 'undefined' || process.env.NODE_ENV !== 'test') {\n\tregisterStyle(\"29b739f451\", \"._62d714739f4dc308__tools-panel{border-top:1px solid #ddd;margin-top:-1px;padding:16px}._40db7f4f897b683d__tools-panel-with-inner-wrapper>div:not(:first-of-type){column-gap:16px;display:grid;grid-column:1/-1;grid-template-columns:repeat(2,minmax(0,1fr));row-gap:16px}._95a15674966f30a3__tools-panel-hidden-inner-wrapper>div:not(:first-of-type){display:none}._322a049b9b7d8674__tools-panel-header{gap:8px;grid-column:1/-1}._322a049b9b7d8674__tools-panel-header .components-dropdown-menu{line-height:0;margin:-4px 0}._322a049b9b7d8674__tools-panel-header._322a049b9b7d8674__tools-panel-header._322a049b9b7d8674__tools-panel-header._322a049b9b7d8674__tools-panel-header .components-dropdown-menu__toggle{min-width:24px;padding:0}.b92a382d3b30104d__tools-panel-heading.b92a382d3b30104d__tools-panel-heading{font-size:inherit;line-height:normal;margin:0}._8005d68fffa9db91__tools-panel-item{grid-column:1/-1}._8005d68fffa9db91__tools-panel-item>div,._8005d68fffa9db91__tools-panel-item>fieldset{margin-bottom:0;max-width:100%;padding-bottom:0}._8005d68fffa9db91__tools-panel-item .components-base-control__help,._8005d68fffa9db91__tools-panel-item._8005d68fffa9db91__tools-panel-item .components-base-control,._8005d68fffa9db91__tools-panel-item._8005d68fffa9db91__tools-panel-item .components-base-control .components-base-control__field:last-child{margin-bottom:0}._4f55e1a6e373746e__tools-panel-item-placeholder{display:none}.d40032517bff9e12__dropdown-menu{min-width:200px}.f135b96aa96ca6bb__reset-label{color:var(--wp-components-color-accent-darker-10,var(--wp-admin-theme-color-darker-10,#2145e6));font-size:var(--wpds-typography-font-size-xs,11px);font-weight:var(--wpds-typography-font-weight-emphasis,600);line-height:1.4;margin-inline-start:12px;text-transform:uppercase}._69b138dfa5570d9c__default-controls-item{color:#1e1e1e}._69b138dfa5570d9c__default-controls-item._69b138dfa5570d9c__default-controls-item[aria-disabled=true]{color:#757575;opacity:1}._69b138dfa5570d9c__default-controls-item._69b138dfa5570d9c__default-controls-item[aria-disabled=true]:hover{color:#757575}._69b138dfa5570d9c__default-controls-item._69b138dfa5570d9c__default-controls-item[aria-disabled=true] .f135b96aa96ca6bb__reset-label{opacity:.3}\");\n}\nexport default {\"tools-panel\":\"_62d714739f4dc308__tools-panel\",\"tools-panel-with-inner-wrapper\":\"_40db7f4f897b683d__tools-panel-with-inner-wrapper\",\"tools-panel-hidden-inner-wrapper\":\"_95a15674966f30a3__tools-panel-hidden-inner-wrapper\",\"tools-panel-header\":\"_322a049b9b7d8674__tools-panel-header\",\"tools-panel-heading\":\"b92a382d3b30104d__tools-panel-heading\",\"tools-panel-item\":\"_8005d68fffa9db91__tools-panel-item\",\"tools-panel-item-placeholder\":\"_4f55e1a6e373746e__tools-panel-item-placeholder\",\"dropdown-menu\":\"d40032517bff9e12__dropdown-menu\",\"reset-label\":\"f135b96aa96ca6bb__reset-label\",\"default-controls-item\":\"_69b138dfa5570d9c__default-controls-item\"};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AACjB,qBAAoE;;;ACDpE,IAAM,uBAAuB;AAU7B,SAAS,aAAa;AACpB,QAAM,cAAc;AACpB,MAAI,YAAY,kBAAkB;AAChC,WAAO,YAAY;AAAA,EACrB;AACA,cAAY,mBAAmB;AAAA,IAC7B,WAAW,oBAAI,IAAI;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UAAU;AACzB,eAAS,eAAe;AAAA,IAC1B;AAGA,kBAAc;AAAA,MACZ,MAAM;AAAA,IACR,CAAC;AAAA,EACH,GAAG,CAAC,iBAAiB,QAAQ,CAAC;AAI9B,QAAM,2BAA2B,WAAS;AACxC,UAAM,gBAAgB,UAAU,YAAY,CAAC;AAC7C,UAAM,YAAY,MAAM,KAAK,UAAQ,KAAK,oBAAoB,cAAc,KAAK,KAAK,CAAC;AACvF,WAAO,WAAW;AAAA,EACpB;AACA,QAAM,qBAAqB,yBAAyB,UAAU;AAC9D,QAAM,oBAAoB,yBAAyB,CAAC,GAAG,UAAU,EAAE,QAAQ,CAAC;AAC5E,QAAM,eAAe,WAAW,SAAS;AACzC,QAAM,mBAAe,wBAAQ,OAAO;AAAA,IAClC;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,aAAa,eAAe;AAAA,IAC5B;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI,CAAC,8BAA8B,qBAAqB,0BAA0B,oBAAoB,uBAAuB,mBAAmB,WAAW,SAAS,cAAc,wBAAwB,mBAAmB,8BAA8B,qCAAqC,kCAAkC,CAAC;AACnU,SAAO;AAAA,IACL,GAAG;AAAA,IACH;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,WAAW;AAAA,EACb;AACF;",
4
+ "sourcesContent": ["import clsx from 'clsx';\nimport { useCallback, useEffect, useMemo, useReducer, useState } from '@wordpress/element';\nimport styles from '../style.module.scss';\nimport { useContextSystem } from '../../context';\nfunction emptyState() {\n return {\n panelItems: [],\n menuItemOrder: [],\n menuItemValues: {}\n };\n}\n\n// An item is always shown while it has a value. `defaultShown` only opts an\n// optional item in when it has none.\nconst getSeedValue = item => item.hasValue() || !item.isShownByDefault && !!item.defaultShown;\nconst getMenuGroup = item => item.isShownByDefault ? 'default' : 'optional';\nfunction panelItemsReducer(panelItems, action) {\n switch (action.type) {\n case 'REGISTER_PANEL':\n {\n // An existing registration is replaced rather than appended, so\n // that an item moving between the default and optional groups\n // doesn't end up in the list twice.\n const existingIndex = panelItems.findIndex(item => item.label === action.item.label);\n const newItems = [...panelItems];\n if (existingIndex !== -1) {\n newItems.splice(existingIndex, 1);\n }\n newItems.push(action.item);\n return newItems;\n }\n case 'UNREGISTER_PANEL':\n {\n const index = panelItems.findIndex(item => item.label === action.label);\n if (index === -1) {\n return panelItems;\n }\n // A replacement may already hold this label, in which case this is\n // a late cleanup for a registration that is no longer current.\n if (action.item && panelItems[index] !== action.item) {\n return panelItems;\n }\n const newItems = [...panelItems];\n newItems.splice(index, 1);\n return newItems;\n }\n default:\n return panelItems;\n }\n}\nfunction menuItemOrderReducer(menuItemOrder, action) {\n switch (action.type) {\n case 'REGISTER_PANEL':\n {\n // Append-only: an item that unregisters and comes back keeps its\n // original place in the menu.\n if (menuItemOrder.includes(action.item.label)) {\n return menuItemOrder;\n }\n return [...menuItemOrder, action.item.label];\n }\n default:\n return menuItemOrder;\n }\n}\nfunction menuItemValuesReducer(state, action) {\n const values = state.menuItemValues;\n switch (action.type) {\n case 'REGISTER_PANEL':\n {\n // A new registration starts from its own value rather than\n // inheriting what an item it replaces recorded under the same\n // label. Clearing here rather than on deregistration covers both\n // orderings, since the two are not guaranteed to arrive in one.\n // Relies on re-registering also re-reporting the value.\n if (!values.hasOwnProperty(action.item.label)) {\n return values;\n }\n const {\n [action.item.label]: unusedValue,\n ...rest\n } = values;\n return rest;\n }\n case 'UPDATE_VALUE':\n {\n if (values[action.label] === action.value) {\n return values;\n }\n return {\n ...values,\n [action.label]: action.value\n };\n }\n case 'TOGGLE_VALUE':\n {\n const item = state.panelItems.find(({\n label\n }) => label === action.label);\n if (!item) {\n return values;\n }\n const current = values[action.label] ?? getSeedValue(item);\n return {\n ...values,\n [action.label]: !current\n };\n }\n case 'RESET_ALL':\n {\n // Optional items are set to false so they hide right away.\n // Default items are left alone: a reset can leave a value in\n // place, since `onDeselect` and `resetAllFilter` are optional and\n // `resetAll` need not cover every attribute. Each item reports its\n // value again if the reset changed it.\n const hidden = state.panelItems.filter(item => !item.isShownByDefault && values[item.label] !== false);\n if (!hidden.length) {\n return values;\n }\n const next = {\n ...values\n };\n hidden.forEach(({\n label\n }) => {\n next[label] = false;\n });\n return next;\n }\n default:\n return values;\n }\n}\nfunction panelReducer(state, action) {\n const panelItems = panelItemsReducer(state.panelItems, action);\n const menuItemOrder = menuItemOrderReducer(state.menuItemOrder, action);\n const menuItemValues = menuItemValuesReducer({\n ...state,\n panelItems\n }, action);\n\n // Items dispatch far more often than they change anything. Holding onto\n // the existing state lets React skip the render.\n if (panelItems === state.panelItems && menuItemOrder === state.menuItemOrder && menuItemValues === state.menuItemValues) {\n return state;\n }\n return {\n panelItems,\n menuItemOrder,\n menuItemValues\n };\n}\nfunction resetAllFiltersReducer(filters, action) {\n switch (action.type) {\n case 'REGISTER':\n return [...filters, action.filter];\n case 'UNREGISTER':\n return filters.filter(f => f !== action.filter);\n default:\n return filters;\n }\n}\nconst isMenuItemTypeEmpty = obj => Object.keys(obj).length === 0;\nexport function useToolsPanel(props) {\n const {\n className,\n headingLevel = 2,\n resetAll,\n panelId,\n hasInnerWrapper = false,\n shouldRenderPlaceholderItems = false,\n __experimentalFirstVisibleItemClass,\n __experimentalLastVisibleItemClass,\n ...otherProps\n } = useContextSystem(props, 'ToolsPanel');\n\n // Marks the render that follows a reset so items can tell a reset apart\n // from the user switching them off. Clearing it from an effect rather than\n // as each control updates keeps the whole reset within one pass; otherwise\n // later controls see it already cleared and reset themselves again from\n // stale data.\n const [isResetting, setIsResetting] = useState(false);\n useEffect(() => {\n if (isResetting) {\n setIsResetting(false);\n }\n }, [isResetting]);\n const [{\n panelItems,\n menuItemOrder,\n menuItemValues\n }, panelDispatch] = useReducer(panelReducer, undefined, emptyState);\n\n // Reset all filters registered against the context directly, by consumers\n // that aren't themselves a panel item. Items supply theirs when they\n // register.\n const [externalResetAllFilters, dispatchResetAllFilters] = useReducer(resetAllFiltersReducer, []);\n const registerPanelItem = useCallback(item => {\n panelDispatch({\n type: 'REGISTER_PANEL',\n item\n });\n }, []);\n const deregisterPanelItem = useCallback((label, item) => {\n panelDispatch({\n type: 'UNREGISTER_PANEL',\n label,\n item\n });\n }, []);\n const registerResetAllFilter = useCallback(filter => {\n dispatchResetAllFilters({\n type: 'REGISTER',\n filter\n });\n }, []);\n const deregisterResetAllFilter = useCallback(filter => {\n dispatchResetAllFilters({\n type: 'UNREGISTER',\n filter\n });\n }, []);\n\n // Argument order is unchanged from before this hook derived the menu; only\n // the group argument is gone, since it follows from `isShownByDefault`.\n const flagItemCustomization = useCallback((value, label) => {\n panelDispatch({\n type: 'UPDATE_VALUE',\n label,\n value\n });\n }, []);\n\n // Derived during render so the panel can never paint a half-built menu.\n // See: https://github.com/WordPress/gutenberg/pull/65564\n const menuItems = useMemo(() => {\n const result = {\n default: {},\n optional: {}\n };\n const byLabel = new Map(panelItems.map(item => [item.label, item]));\n\n // `menuItemOrder` holds every registered label, so it alone drives\n // the menu.\n menuItemOrder.forEach(label => {\n const item = byLabel.get(label);\n if (!item) {\n return;\n }\n result[getMenuGroup(item)][label] = menuItemValues[label] ?? getSeedValue(item);\n });\n return result;\n }, [panelItems, menuItemOrder, menuItemValues]);\n\n // Drives the plus icon and the empty panel styling.\n const areAllOptionalControlsHidden = useMemo(() => {\n return isMenuItemTypeEmpty(menuItems.default) && !isMenuItemTypeEmpty(menuItems.optional) && Object.values(menuItems.optional).every(isSelected => !isSelected);\n }, [menuItems]);\n const classes = clsx(styles['tools-panel'], hasInnerWrapper && styles['tools-panel-with-inner-wrapper'], areAllOptionalControlsHidden && styles['tools-panel-hidden-inner-wrapper'], className);\n\n // `onShownChange` is invoked from here rather than in response to the\n // resulting state change, so that it only ever reports an explicit menu\n // action by the user.\n const toggleItem = useCallback(label => {\n const currentItem = panelItems.find(item => item.label === label);\n if (!currentItem) {\n return;\n }\n panelDispatch({\n type: 'TOGGLE_VALUE',\n label\n });\n\n // Default items stay visible when toggled off, which resets them\n // instead of hiding them. Only optional items have a show or hide\n // transition to report.\n if (currentItem.isShownByDefault) {\n return;\n }\n currentItem.onShownChange?.(!menuItems.optional[label]);\n }, [menuItems, panelItems]);\n const resetAllFilters = useMemo(() => {\n const itemFilters = panelItems.map(item => item.resetAllFilter).filter(filter => !!filter);\n return [...itemFilters, ...externalResetAllFilters];\n }, [panelItems, externalResetAllFilters]);\n const resetAllItems = useCallback(() => {\n if (typeof resetAll === 'function') {\n setIsResetting(true);\n resetAll(resetAllFilters);\n }\n panelDispatch({\n type: 'RESET_ALL'\n });\n }, [resetAllFilters, resetAll]);\n\n // Lets `ItemGroup` style the visible ends of the panel when hidden\n // placeholder items sit among the children.\n const getFirstVisibleItemLabel = items => {\n const optionalItems = menuItems.optional || {};\n const firstItem = items.find(item => item.isShownByDefault || optionalItems[item.label]);\n return firstItem?.label;\n };\n const firstDisplayedItem = getFirstVisibleItemLabel(panelItems);\n const lastDisplayedItem = getFirstVisibleItemLabel([...panelItems].reverse());\n const hasMenuItems = panelItems.length > 0;\n const panelContext = useMemo(() => ({\n areAllOptionalControlsHidden,\n deregisterPanelItem,\n deregisterResetAllFilter,\n firstDisplayedItem,\n flagItemCustomization,\n hasMenuItems,\n isResetting,\n lastDisplayedItem,\n menuItems,\n panelId,\n registerPanelItem,\n registerResetAllFilter,\n shouldRenderPlaceholderItems,\n __experimentalFirstVisibleItemClass,\n __experimentalLastVisibleItemClass\n }), [areAllOptionalControlsHidden, deregisterPanelItem, deregisterResetAllFilter, firstDisplayedItem, flagItemCustomization, isResetting, lastDisplayedItem, menuItems, panelId, hasMenuItems, registerResetAllFilter, registerPanelItem, shouldRenderPlaceholderItems, __experimentalFirstVisibleItemClass, __experimentalLastVisibleItemClass]);\n return {\n ...otherProps,\n headingLevel,\n panelContext,\n resetAllItems,\n toggleItem,\n className: classes\n };\n}", "const 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 const globalScope = globalThis;\n if (globalScope.__wpStyleRuntime) {\n return globalScope.__wpStyleRuntime;\n }\n globalScope.__wpStyleRuntime = {\n documents: new Map(),\n styles: new Map(),\n injectedStyles: new WeakMap()\n };\n if (typeof document !== 'undefined') {\n registerDocument(document);\n }\n return 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(targetDocument, hash) {\n if (!targetDocument.head) {\n return false;\n }\n for (const style of targetDocument.head.querySelectorAll(`style[${STYLE_HASH_ATTRIBUTE}]`)) {\n if (style.getAttribute(STYLE_HASH_ATTRIBUTE) === hash) {\n return true;\n }\n }\n return 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, hash, css) {\n if (!targetDocument.head) {\n return;\n }\n const runtime = getRuntime();\n let injectedStyles = runtime.injectedStyles.get(targetDocument);\n if (!injectedStyles) {\n injectedStyles = new Set();\n runtime.injectedStyles.set(targetDocument, injectedStyles);\n }\n if (injectedStyles.has(hash)) {\n return;\n }\n\n // Older generated CSS module output can still inject matching style tags\n // after this document's cache is created, so keep the DOM as the fallback\n // source of truth on cache misses.\n if (documentContainsStyleHash(targetDocument, hash)) {\n injectedStyles.add(hash);\n return;\n }\n const style = targetDocument.createElement('style');\n style.setAttribute(STYLE_HASH_ATTRIBUTE, hash);\n style.appendChild(targetDocument.createTextNode(css));\n targetDocument.head.appendChild(style);\n injectedStyles.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) {\n const runtime = getRuntime();\n runtime.documents.set(targetDocument, (runtime.documents.get(targetDocument) ?? 0) + 1);\n for (const [hash, css] of runtime.styles) {\n injectStyle(targetDocument, hash, css);\n }\n return () => {\n const count = runtime.documents.get(targetDocument);\n if (count === undefined) {\n return;\n }\n if (count <= 1) {\n runtime.documents.delete(targetDocument);\n return;\n }\n runtime.documents.set(targetDocument, count - 1);\n };\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, css) {\n const runtime = getRuntime();\n runtime.styles.set(hash, css);\n for (const targetDocument of runtime.documents.keys()) {\n injectStyle(targetDocument, hash, css);\n }\n}", "import { registerStyle } from '@wordpress/style-runtime';\nif (typeof process === 'undefined' || process.env.NODE_ENV !== 'test') {\n\tregisterStyle(\"29b739f451\", \"._62d714739f4dc308__tools-panel{border-top:1px solid #ddd;margin-top:-1px;padding:16px}._40db7f4f897b683d__tools-panel-with-inner-wrapper>div:not(:first-of-type){column-gap:16px;display:grid;grid-column:1/-1;grid-template-columns:repeat(2,minmax(0,1fr));row-gap:16px}._95a15674966f30a3__tools-panel-hidden-inner-wrapper>div:not(:first-of-type){display:none}._322a049b9b7d8674__tools-panel-header{gap:8px;grid-column:1/-1}._322a049b9b7d8674__tools-panel-header .components-dropdown-menu{line-height:0;margin:-4px 0}._322a049b9b7d8674__tools-panel-header._322a049b9b7d8674__tools-panel-header._322a049b9b7d8674__tools-panel-header._322a049b9b7d8674__tools-panel-header .components-dropdown-menu__toggle{min-width:24px;padding:0}.b92a382d3b30104d__tools-panel-heading.b92a382d3b30104d__tools-panel-heading{font-size:inherit;line-height:normal;margin:0}._8005d68fffa9db91__tools-panel-item{grid-column:1/-1}._8005d68fffa9db91__tools-panel-item>div,._8005d68fffa9db91__tools-panel-item>fieldset{margin-bottom:0;max-width:100%;padding-bottom:0}._8005d68fffa9db91__tools-panel-item .components-base-control__help,._8005d68fffa9db91__tools-panel-item._8005d68fffa9db91__tools-panel-item .components-base-control,._8005d68fffa9db91__tools-panel-item._8005d68fffa9db91__tools-panel-item .components-base-control .components-base-control__field:last-child{margin-bottom:0}._4f55e1a6e373746e__tools-panel-item-placeholder{display:none}.d40032517bff9e12__dropdown-menu{min-width:200px}.f135b96aa96ca6bb__reset-label{color:var(--wp-components-color-accent-darker-10,var(--wp-admin-theme-color-darker-10,#2145e6));font-size:var(--wpds-typography-font-size-xs,11px);font-weight:var(--wpds-typography-font-weight-emphasis,600);line-height:1.4;margin-inline-start:12px;text-transform:uppercase}._69b138dfa5570d9c__default-controls-item{color:#1e1e1e}._69b138dfa5570d9c__default-controls-item._69b138dfa5570d9c__default-controls-item[aria-disabled=true]{color:#757575;opacity:1}._69b138dfa5570d9c__default-controls-item._69b138dfa5570d9c__default-controls-item[aria-disabled=true]:hover{color:#757575}._69b138dfa5570d9c__default-controls-item._69b138dfa5570d9c__default-controls-item[aria-disabled=true] .f135b96aa96ca6bb__reset-label{opacity:.3}\");\n}\nexport default {\"tools-panel\":\"_62d714739f4dc308__tools-panel\",\"tools-panel-with-inner-wrapper\":\"_40db7f4f897b683d__tools-panel-with-inner-wrapper\",\"tools-panel-hidden-inner-wrapper\":\"_95a15674966f30a3__tools-panel-hidden-inner-wrapper\",\"tools-panel-header\":\"_322a049b9b7d8674__tools-panel-header\",\"tools-panel-heading\":\"b92a382d3b30104d__tools-panel-heading\",\"tools-panel-item\":\"_8005d68fffa9db91__tools-panel-item\",\"tools-panel-item-placeholder\":\"_4f55e1a6e373746e__tools-panel-item-placeholder\",\"dropdown-menu\":\"d40032517bff9e12__dropdown-menu\",\"reset-label\":\"f135b96aa96ca6bb__reset-label\",\"default-controls-item\":\"_69b138dfa5570d9c__default-controls-item\"};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AACjB,qBAAsE;;;ACDtE,IAAM,uBAAuB;AAU7B,SAAS,aAAa;AACpB,QAAM,cAAc;AACpB,MAAI,YAAY,kBAAkB;AAChC,WAAO,YAAY;AAAA,EACrB;AACA,cAAY,mBAAmB;AAAA,IAC7B,WAAW,oBAAI,IAAI;AAAA,IACnB,QAAQ,oBAAI,IAAI;AAAA,IAChB,gBAAgB,oBAAI,QAAQ;AAAA,EAC9B;AACA,MAAI,OAAO,aAAa,aAAa;AACnC,qBAAiB,QAAQ;AAAA,EAC3B;AACA,SAAO,YAAY;AACrB;AAUA,SAAS,0BAA0B,gBAAgB,MAAM;AACvD,MAAI,CAAC,eAAe,MAAM;AACxB,WAAO;AAAA,EACT;AACA,aAAW,SAAS,eAAe,KAAK,iBAAiB,SAAS,oBAAoB,GAAG,GAAG;AAC1F,QAAI,MAAM,aAAa,oBAAoB,MAAM,MAAM;AACrD,aAAO;AAAA,IACT;AAAA,EACF;AACA,SAAO;AACT;AAUA,SAAS,YAAY,gBAAgB,MAAM,KAAK;AAC9C,MAAI,CAAC,eAAe,MAAM;AACxB;AAAA,EACF;AACA,QAAM,UAAU,WAAW;AAC3B,MAAI,iBAAiB,QAAQ,eAAe,IAAI,cAAc;AAC9D,MAAI,CAAC,gBAAgB;AACnB,qBAAiB,oBAAI,IAAI;AACzB,YAAQ,eAAe,IAAI,gBAAgB,cAAc;AAAA,EAC3D;AACA,MAAI,eAAe,IAAI,IAAI,GAAG;AAC5B;AAAA,EACF;AAKA,MAAI,0BAA0B,gBAAgB,IAAI,GAAG;AACnD,mBAAe,IAAI,IAAI;AACvB;AAAA,EACF;AACA,QAAM,QAAQ,e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V,SAAO;AAAA,IACL,GAAG;AAAA,IACH;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,WAAW;AAAA,EACb;AACF;",
6
6
  "names": ["clsx"]
7
7
  }
@@ -128,6 +128,7 @@ var noop = () => {
128
128
  function useToolsPanelItem(props) {
129
129
  const {
130
130
  className,
131
+ defaultShown,
131
132
  hasValue,
132
133
  isShownByDefault = false,
133
134
  label,
@@ -135,13 +136,12 @@ function useToolsPanelItem(props) {
135
136
  resetAllFilter = noop,
136
137
  onDeselect,
137
138
  onSelect,
139
+ onShownChange,
138
140
  ...otherProps
139
141
  } = (0, import_context2.useContextSystem)(props, "ToolsPanelItem");
140
142
  const {
141
143
  panelId: currentPanelId,
142
144
  menuItems,
143
- registerResetAllFilter,
144
- deregisterResetAllFilter,
145
145
  registerPanelItem,
146
146
  deregisterPanelItem,
147
147
  flagItemCustomization,
@@ -153,47 +153,47 @@ function useToolsPanelItem(props) {
153
153
  __experimentalLastVisibleItemClass
154
154
  } = (0, import_context.useToolsPanelContext)();
155
155
  const hasValueCallback = (0, import_element.useCallback)(hasValue, [panelId]);
156
- const resetAllFilterCallback = (0, import_element.useCallback)(resetAllFilter, [panelId]);
157
- const previousPanelId = (0, import_compose.usePrevious)(currentPanelId);
156
+ const resetAllFilterCallback = (0, import_compose.useEvent)(resetAllFilter);
157
+ const defaultShownRef = (0, import_element.useRef)(defaultShown);
158
+ (0, import_element.useLayoutEffect)(() => {
159
+ defaultShownRef.current = defaultShown;
160
+ });
161
+ const onShownChangeCallback = (0, import_compose.useEvent)(onShownChange);
158
162
  const hasMatchingPanel = currentPanelId === panelId || currentPanelId === null;
159
163
  (0, import_element.useLayoutEffect)(() => {
160
- if (hasMatchingPanel && previousPanelId !== null) {
161
- registerPanelItem({
162
- hasValue: hasValueCallback,
163
- isShownByDefault,
164
- label,
165
- panelId
166
- });
164
+ if (!hasMatchingPanel) {
165
+ return;
167
166
  }
168
- return () => {
169
- if (previousPanelId === null && !!currentPanelId || currentPanelId === panelId) {
170
- deregisterPanelItem(label);
171
- }
167
+ const item = {
168
+ defaultShown: defaultShownRef.current,
169
+ hasValue: hasValueCallback,
170
+ isShownByDefault,
171
+ label,
172
+ onShownChange: onShownChangeCallback,
173
+ panelId,
174
+ resetAllFilter: resetAllFilterCallback
172
175
  };
173
- }, [currentPanelId, hasMatchingPanel, isShownByDefault, label, hasValueCallback, panelId, previousPanelId, registerPanelItem, deregisterPanelItem]);
174
- (0, import_element.useEffect)(() => {
175
- if (hasMatchingPanel) {
176
- registerResetAllFilter(resetAllFilterCallback);
177
- }
176
+ registerPanelItem(item);
178
177
  return () => {
179
- if (hasMatchingPanel) {
180
- deregisterResetAllFilter(resetAllFilterCallback);
181
- }
178
+ deregisterPanelItem(label, item);
182
179
  };
183
- }, [registerResetAllFilter, deregisterResetAllFilter, resetAllFilterCallback, hasMatchingPanel]);
180
+ }, [deregisterPanelItem, hasMatchingPanel, hasValueCallback, isShownByDefault, label, onShownChangeCallback, panelId, registerPanelItem, resetAllFilterCallback]);
184
181
  const menuGroup = isShownByDefault ? "default" : "optional";
185
182
  const isMenuItemChecked = menuItems?.[menuGroup]?.[label];
186
- const wasMenuItemChecked = (0, import_compose.usePrevious)(isMenuItemChecked);
187
- const isRegistered = menuItems?.[menuGroup]?.[label] !== void 0;
183
+ const isRegistered = isMenuItemChecked !== void 0;
184
+ const wasMenuItemCheckedRef = (0, import_element.useRef)(void 0);
188
185
  const isValueSet = hasValue();
189
- (0, import_element.useEffect)(() => {
190
- if (!isShownByDefault && !isValueSet) {
186
+ (0, import_element.useLayoutEffect)(() => {
187
+ if (!hasMatchingPanel || !isShownByDefault && !isValueSet) {
191
188
  return;
192
189
  }
193
- flagItemCustomization(isValueSet, label, menuGroup);
194
- }, [isValueSet, menuGroup, label, flagItemCustomization, isShownByDefault]);
190
+ flagItemCustomization(isValueSet, label);
191
+ }, [hasMatchingPanel, isValueSet, label, flagItemCustomization, isShownByDefault]);
195
192
  (0, import_element.useEffect)(() => {
196
- if (!isRegistered || isResetting || !hasMatchingPanel) {
193
+ const wasMenuItemChecked = wasMenuItemCheckedRef.current;
194
+ wasMenuItemCheckedRef.current = isMenuItemChecked;
195
+ const wasRegistered = wasMenuItemChecked !== void 0;
196
+ if (!isRegistered || !wasRegistered || isResetting || !hasMatchingPanel) {
197
197
  return;
198
198
  }
199
199
  if (isMenuItemChecked && !isValueSet && !wasMenuItemChecked) {
@@ -202,8 +202,8 @@ function useToolsPanelItem(props) {
202
202
  if (!isMenuItemChecked && isValueSet && wasMenuItemChecked) {
203
203
  onDeselect?.();
204
204
  }
205
- }, [hasMatchingPanel, isMenuItemChecked, isRegistered, isResetting, isValueSet, wasMenuItemChecked, onSelect, onDeselect]);
206
- const isShown = isShownByDefault ? menuItems?.[menuGroup]?.[label] !== void 0 : isMenuItemChecked;
205
+ }, [hasMatchingPanel, isMenuItemChecked, isRegistered, isResetting, isValueSet, onSelect, onDeselect]);
206
+ const isShown = isShownByDefault ? isRegistered : isMenuItemChecked;
207
207
  const shouldApplyPlaceholderStyles = shouldRenderPlaceholder && !isShown;
208
208
  const classes = (0, import_clsx.default)(style_module_default["tools-panel-item"], shouldApplyPlaceholderStyles && style_module_default["tools-panel-item-placeholder"], !shouldApplyPlaceholderStyles && className, firstDisplayedItem === label && __experimentalFirstVisibleItemClass, lastDisplayedItem === label && __experimentalLastVisibleItemClass);
209
209
  return {