@wordpress/components 21.1.0 → 21.2.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 (309) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/build/border-box-control/utils.js +42 -2
  3. package/build/border-box-control/utils.js.map +1 -1
  4. package/build/combobox-control/index.js +0 -1
  5. package/build/combobox-control/index.js.map +1 -1
  6. package/build/custom-select-control/index.js +4 -2
  7. package/build/custom-select-control/index.js.map +1 -1
  8. package/build/draggable/index.js +3 -6
  9. package/build/draggable/index.js.map +1 -1
  10. package/build/font-size-picker/index.js +46 -55
  11. package/build/font-size-picker/index.js.map +1 -1
  12. package/build/font-size-picker/styles.js +73 -0
  13. package/build/font-size-picker/styles.js.map +1 -0
  14. package/build/font-size-picker/types.js +6 -0
  15. package/build/font-size-picker/types.js.map +1 -0
  16. package/build/font-size-picker/utils.js +17 -15
  17. package/build/font-size-picker/utils.js.map +1 -1
  18. package/build/form-token-field/token-input.js +20 -1
  19. package/build/form-token-field/token-input.js.map +1 -1
  20. package/build/index.js +12 -0
  21. package/build/index.js.map +1 -1
  22. package/build/menu-item/index.js +4 -3
  23. package/build/menu-item/index.js.map +1 -1
  24. package/build/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js +10 -3
  25. package/build/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js.map +1 -1
  26. package/build/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js +12 -3
  27. package/build/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js.map +1 -1
  28. package/build/mobile/bottom-sheet/sub-sheet/index.native.js +4 -1
  29. package/build/mobile/bottom-sheet/sub-sheet/index.native.js.map +1 -1
  30. package/build/mobile/color-settings/index.native.js +3 -1
  31. package/build/mobile/color-settings/index.native.js.map +1 -1
  32. package/build/mobile/color-settings/picker-screen.native.js +3 -1
  33. package/build/mobile/color-settings/picker-screen.native.js.map +1 -1
  34. package/build/mobile/image/index.native.js +3 -1
  35. package/build/mobile/image/index.native.js.map +1 -1
  36. package/build/mobile/keyboard-avoiding-view/index.ios.js +3 -1
  37. package/build/mobile/keyboard-avoiding-view/index.ios.js.map +1 -1
  38. package/build/mobile/link-picker/index.native.js +3 -1
  39. package/build/mobile/link-picker/index.native.js.map +1 -1
  40. package/build/mobile/link-picker/link-picker-results.native.js +3 -1
  41. package/build/mobile/link-picker/link-picker-results.native.js.map +1 -1
  42. package/build/mobile/link-picker/link-picker-screen.native.js +3 -1
  43. package/build/mobile/link-picker/link-picker-screen.native.js.map +1 -1
  44. package/build/mobile/link-settings/index.native.js +24 -6
  45. package/build/mobile/link-settings/index.native.js.map +1 -1
  46. package/build/mobile/link-settings/link-settings-screen.native.js +3 -1
  47. package/build/mobile/link-settings/link-settings-screen.native.js.map +1 -1
  48. package/build/mobile/segmented-control/index.native.js +6 -2
  49. package/build/mobile/segmented-control/index.native.js.map +1 -1
  50. package/build/mobile/utils/use-unit-converter-to-mobile.native.js +6 -2
  51. package/build/mobile/utils/use-unit-converter-to-mobile.native.js.map +1 -1
  52. package/build/navigator/navigator-screen/component.js +8 -1
  53. package/build/navigator/navigator-screen/component.js.map +1 -1
  54. package/build/notice/index.native.js +15 -19
  55. package/build/notice/index.native.js.map +1 -1
  56. package/build/notice/list.native.js +2 -3
  57. package/build/notice/list.native.js.map +1 -1
  58. package/build/palette-edit/index.js +1 -1
  59. package/build/palette-edit/index.js.map +1 -1
  60. package/build/popover/index.js +29 -32
  61. package/build/popover/index.js.map +1 -1
  62. package/build/popover/limit-shift.js +145 -0
  63. package/build/popover/limit-shift.js.map +1 -0
  64. package/build/popover/utils.js +55 -15
  65. package/build/popover/utils.js.map +1 -1
  66. package/build/resizable-box/resize-tooltip/utils.js +12 -14
  67. package/build/resizable-box/resize-tooltip/utils.js.map +1 -1
  68. package/build/sandbox/index.js +13 -8
  69. package/build/sandbox/index.js.map +1 -1
  70. package/build/sandbox/index.native.js +3 -1
  71. package/build/sandbox/index.native.js.map +1 -1
  72. package/build/search-control/index.native.js +6 -2
  73. package/build/search-control/index.native.js.map +1 -1
  74. package/build/slot-fill/bubbles-virtually/slot-fill-context.js +8 -2
  75. package/build/slot-fill/bubbles-virtually/slot-fill-context.js.map +1 -1
  76. package/build/slot-fill/bubbles-virtually/slot-fill-provider.js +31 -41
  77. package/build/slot-fill/bubbles-virtually/slot-fill-provider.js.map +1 -1
  78. package/build/slot-fill/bubbles-virtually/use-slot-fills.js +39 -0
  79. package/build/slot-fill/bubbles-virtually/use-slot-fills.js.map +1 -0
  80. package/build/slot-fill/bubbles-virtually/use-slot.js +13 -4
  81. package/build/slot-fill/bubbles-virtually/use-slot.js.map +1 -1
  82. package/build/slot-fill/index.js +8 -0
  83. package/build/slot-fill/index.js.map +1 -1
  84. package/build/toggle-group-control/toggle-group-control-option-base/styles.js +8 -8
  85. package/build/toggle-group-control/toggle-group-control-option-base/styles.js.map +1 -1
  86. package/build/tools-panel/styles.js +27 -12
  87. package/build/tools-panel/styles.js.map +1 -1
  88. package/build/tools-panel/tools-panel-header/component.js +19 -6
  89. package/build/tools-panel/tools-panel-header/component.js.map +1 -1
  90. package/build/tools-panel/tools-panel-header/hook.js +4 -0
  91. package/build/tools-panel/tools-panel-header/hook.js.map +1 -1
  92. package/build-module/border-box-control/utils.js +36 -1
  93. package/build-module/border-box-control/utils.js.map +1 -1
  94. package/build-module/combobox-control/index.js +0 -1
  95. package/build-module/combobox-control/index.js.map +1 -1
  96. package/build-module/custom-select-control/index.js +2 -1
  97. package/build-module/custom-select-control/index.js.map +1 -1
  98. package/build-module/draggable/index.js +2 -5
  99. package/build-module/draggable/index.js.map +1 -1
  100. package/build-module/font-size-picker/index.js +45 -53
  101. package/build-module/font-size-picker/index.js.map +1 -1
  102. package/build-module/font-size-picker/styles.js +62 -0
  103. package/build-module/font-size-picker/styles.js.map +1 -0
  104. package/build-module/font-size-picker/types.js +2 -0
  105. package/build-module/font-size-picker/types.js.map +1 -0
  106. package/build-module/font-size-picker/utils.js +21 -15
  107. package/build-module/font-size-picker/utils.js.map +1 -1
  108. package/build-module/form-token-field/token-input.js +21 -2
  109. package/build-module/form-token-field/token-input.js.map +1 -1
  110. package/build-module/index.js +2 -2
  111. package/build-module/index.js.map +1 -1
  112. package/build-module/menu-item/index.js +4 -3
  113. package/build-module/menu-item/index.js.map +1 -1
  114. package/build-module/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js +10 -3
  115. package/build-module/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js.map +1 -1
  116. package/build-module/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js +12 -3
  117. package/build-module/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js.map +1 -1
  118. package/build-module/mobile/bottom-sheet/sub-sheet/index.native.js +4 -1
  119. package/build-module/mobile/bottom-sheet/sub-sheet/index.native.js.map +1 -1
  120. package/build-module/mobile/color-settings/index.native.js +3 -1
  121. package/build-module/mobile/color-settings/index.native.js.map +1 -1
  122. package/build-module/mobile/color-settings/picker-screen.native.js +3 -1
  123. package/build-module/mobile/color-settings/picker-screen.native.js.map +1 -1
  124. package/build-module/mobile/image/index.native.js +3 -1
  125. package/build-module/mobile/image/index.native.js.map +1 -1
  126. package/build-module/mobile/keyboard-avoiding-view/index.ios.js +3 -1
  127. package/build-module/mobile/keyboard-avoiding-view/index.ios.js.map +1 -1
  128. package/build-module/mobile/link-picker/index.native.js +3 -1
  129. package/build-module/mobile/link-picker/index.native.js.map +1 -1
  130. package/build-module/mobile/link-picker/link-picker-results.native.js +3 -1
  131. package/build-module/mobile/link-picker/link-picker-results.native.js.map +1 -1
  132. package/build-module/mobile/link-picker/link-picker-screen.native.js +3 -1
  133. package/build-module/mobile/link-picker/link-picker-screen.native.js.map +1 -1
  134. package/build-module/mobile/link-settings/index.native.js +24 -6
  135. package/build-module/mobile/link-settings/index.native.js.map +1 -1
  136. package/build-module/mobile/link-settings/link-settings-screen.native.js +3 -1
  137. package/build-module/mobile/link-settings/link-settings-screen.native.js.map +1 -1
  138. package/build-module/mobile/segmented-control/index.native.js +6 -2
  139. package/build-module/mobile/segmented-control/index.native.js.map +1 -1
  140. package/build-module/mobile/utils/use-unit-converter-to-mobile.native.js +6 -2
  141. package/build-module/mobile/utils/use-unit-converter-to-mobile.native.js.map +1 -1
  142. package/build-module/navigator/navigator-screen/component.js +8 -1
  143. package/build-module/navigator/navigator-screen/component.js.map +1 -1
  144. package/build-module/notice/index.native.js +16 -21
  145. package/build-module/notice/index.native.js.map +1 -1
  146. package/build-module/notice/list.native.js +3 -3
  147. package/build-module/notice/list.native.js.map +1 -1
  148. package/build-module/palette-edit/index.js +1 -1
  149. package/build-module/palette-edit/index.js.map +1 -1
  150. package/build-module/popover/index.js +31 -35
  151. package/build-module/popover/index.js.map +1 -1
  152. package/build-module/popover/limit-shift.js +136 -0
  153. package/build-module/popover/limit-shift.js.map +1 -0
  154. package/build-module/popover/utils.js +55 -15
  155. package/build-module/popover/utils.js.map +1 -1
  156. package/build-module/resizable-box/resize-tooltip/utils.js +13 -15
  157. package/build-module/resizable-box/resize-tooltip/utils.js.map +1 -1
  158. package/build-module/sandbox/index.js +13 -8
  159. package/build-module/sandbox/index.js.map +1 -1
  160. package/build-module/sandbox/index.native.js +3 -1
  161. package/build-module/sandbox/index.native.js.map +1 -1
  162. package/build-module/search-control/index.native.js +6 -2
  163. package/build-module/search-control/index.native.js.map +1 -1
  164. package/build-module/slot-fill/bubbles-virtually/slot-fill-context.js +7 -2
  165. package/build-module/slot-fill/bubbles-virtually/slot-fill-context.js.map +1 -1
  166. package/build-module/slot-fill/bubbles-virtually/slot-fill-provider.js +30 -42
  167. package/build-module/slot-fill/bubbles-virtually/slot-fill-provider.js.map +1 -1
  168. package/build-module/slot-fill/bubbles-virtually/use-slot-fills.js +27 -0
  169. package/build-module/slot-fill/bubbles-virtually/use-slot-fills.js.map +1 -0
  170. package/build-module/slot-fill/bubbles-virtually/use-slot.js +13 -5
  171. package/build-module/slot-fill/bubbles-virtually/use-slot.js.map +1 -1
  172. package/build-module/slot-fill/index.js +1 -0
  173. package/build-module/slot-fill/index.js.map +1 -1
  174. package/build-module/toggle-group-control/toggle-group-control-option-base/styles.js +7 -7
  175. package/build-module/toggle-group-control/toggle-group-control-option-base/styles.js.map +1 -1
  176. package/build-module/tools-panel/styles.js +23 -12
  177. package/build-module/tools-panel/styles.js.map +1 -1
  178. package/build-module/tools-panel/tools-panel-header/component.js +19 -7
  179. package/build-module/tools-panel/tools-panel-header/component.js.map +1 -1
  180. package/build-module/tools-panel/tools-panel-header/hook.js +4 -0
  181. package/build-module/tools-panel/tools-panel-header/hook.js.map +1 -1
  182. package/build-style/style-rtl.css +14 -100
  183. package/build-style/style.css +14 -100
  184. package/build-types/border-box-control/utils.d.ts +1 -3
  185. package/build-types/border-box-control/utils.d.ts.map +1 -1
  186. package/build-types/custom-select-control/index.d.ts +13 -0
  187. package/build-types/custom-select-control/index.d.ts.map +1 -0
  188. package/build-types/custom-select-control/styles.d.ts +9 -0
  189. package/build-types/custom-select-control/styles.d.ts.map +1 -0
  190. package/build-types/draggable/index.d.ts.map +1 -1
  191. package/build-types/external-link/styles/external-link-styles.d.ts +1 -1
  192. package/build-types/focal-point-picker/styles/focal-point-style.d.ts +3 -3
  193. package/build-types/font-size-picker/index.d.ts +5 -0
  194. package/build-types/font-size-picker/index.d.ts.map +1 -0
  195. package/build-types/font-size-picker/stories/e2e/index.d.ts +16 -0
  196. package/build-types/font-size-picker/stories/e2e/index.d.ts.map +1 -0
  197. package/build-types/font-size-picker/stories/index.d.ts +31 -0
  198. package/build-types/font-size-picker/stories/index.d.ts.map +1 -0
  199. package/build-types/font-size-picker/styles.d.ts +27 -0
  200. package/build-types/font-size-picker/styles.d.ts.map +1 -0
  201. package/build-types/font-size-picker/test/index.d.ts +2 -0
  202. package/build-types/font-size-picker/test/index.d.ts.map +1 -0
  203. package/build-types/font-size-picker/test/utils.d.ts +2 -0
  204. package/build-types/font-size-picker/test/utils.d.ts.map +1 -0
  205. package/build-types/font-size-picker/types.d.ts +93 -0
  206. package/build-types/font-size-picker/types.d.ts.map +1 -0
  207. package/build-types/font-size-picker/utils.d.ts +41 -0
  208. package/build-types/font-size-picker/utils.d.ts.map +1 -0
  209. package/build-types/form-token-field/token-input.d.ts.map +1 -1
  210. package/build-types/menu-item/index.d.ts.map +1 -1
  211. package/build-types/navigator/navigator-screen/component.d.ts.map +1 -1
  212. package/build-types/popover/index.d.ts.map +1 -1
  213. package/build-types/popover/limit-shift.d.ts +87 -0
  214. package/build-types/popover/limit-shift.d.ts.map +1 -0
  215. package/build-types/popover/test/index.d.ts +2 -0
  216. package/build-types/popover/test/index.d.ts.map +1 -0
  217. package/build-types/popover/types.d.ts +1 -1
  218. package/build-types/popover/types.d.ts.map +1 -1
  219. package/build-types/popover/utils.d.ts.map +1 -1
  220. package/build-types/range-control/types.d.ts +0 -32
  221. package/build-types/range-control/types.d.ts.map +1 -1
  222. package/build-types/slot-fill/bubbles-virtually/slot-fill-context.d.ts +2 -2
  223. package/build-types/slot-fill/bubbles-virtually/slot-fill-context.d.ts.map +1 -1
  224. package/build-types/slot-fill/bubbles-virtually/slot-fill-provider.d.ts.map +1 -1
  225. package/build-types/slot-fill/bubbles-virtually/use-slot-fills.d.ts +2 -0
  226. package/build-types/slot-fill/bubbles-virtually/use-slot-fills.d.ts.map +1 -0
  227. package/build-types/slot-fill/bubbles-virtually/use-slot.d.ts.map +1 -1
  228. package/build-types/slot-fill/index.d.ts +1 -0
  229. package/build-types/slot-fill/index.d.ts.map +1 -1
  230. package/build-types/spinner/index.d.ts +1 -1
  231. package/build-types/toggle-group-control/toggle-group-control-option-base/styles.d.ts +1 -1
  232. package/build-types/toggle-group-control/toggle-group-control-option-base/styles.d.ts.map +1 -1
  233. package/build-types/tools-panel/styles.d.ts +6 -0
  234. package/build-types/tools-panel/styles.d.ts.map +1 -1
  235. package/build-types/tools-panel/tools-panel-header/component.d.ts.map +1 -1
  236. package/build-types/tools-panel/tools-panel-header/hook.d.ts +1 -0
  237. package/build-types/tools-panel/tools-panel-header/hook.d.ts.map +1 -1
  238. package/build-types/tools-panel/types.d.ts +1 -0
  239. package/build-types/tools-panel/types.d.ts.map +1 -1
  240. package/package.json +19 -18
  241. package/src/alignment-matrix-control/test/index.js +17 -62
  242. package/src/border-box-control/test/utils.js +48 -0
  243. package/src/border-box-control/utils.ts +44 -1
  244. package/src/combobox-control/index.js +0 -5
  245. package/src/custom-select-control/index.js +2 -1
  246. package/src/draggable/index.js +2 -5
  247. package/src/font-size-picker/{index.js → index.tsx} +113 -79
  248. package/src/font-size-picker/stories/e2e/{index.js → index.tsx} +13 -4
  249. package/src/font-size-picker/stories/{index.js → index.tsx} +42 -36
  250. package/src/font-size-picker/styles.ts +44 -0
  251. package/src/font-size-picker/test/{index.js → index.tsx} +1 -1
  252. package/src/font-size-picker/test/{utils.js → utils.ts} +6 -2
  253. package/src/font-size-picker/types.ts +98 -0
  254. package/src/font-size-picker/{utils.js → utils.ts} +51 -27
  255. package/src/form-token-field/test/index.tsx +22 -1
  256. package/src/form-token-field/token-input.tsx +25 -3
  257. package/src/index.js +2 -1
  258. package/src/menu-item/README.md +7 -0
  259. package/src/menu-item/index.js +11 -5
  260. package/src/menu-item/style.scss +1 -0
  261. package/src/menu-item/test/index.js +36 -0
  262. package/src/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js +9 -0
  263. package/src/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js +11 -0
  264. package/src/mobile/bottom-sheet/sub-sheet/index.native.js +3 -0
  265. package/src/mobile/color-settings/index.native.js +3 -0
  266. package/src/mobile/color-settings/picker-screen.native.js +3 -0
  267. package/src/mobile/image/index.native.js +3 -0
  268. package/src/mobile/keyboard-avoiding-view/index.ios.js +3 -0
  269. package/src/mobile/link-picker/index.native.js +3 -0
  270. package/src/mobile/link-picker/link-picker-results.native.js +3 -0
  271. package/src/mobile/link-picker/link-picker-screen.native.js +3 -0
  272. package/src/mobile/link-settings/index.native.js +18 -0
  273. package/src/mobile/link-settings/link-settings-screen.native.js +3 -0
  274. package/src/mobile/segmented-control/index.native.js +6 -0
  275. package/src/mobile/utils/use-unit-converter-to-mobile.native.js +6 -0
  276. package/src/navigator/navigator-screen/component.tsx +8 -1
  277. package/src/navigator/test/index.js +119 -54
  278. package/src/notice/index.native.js +17 -20
  279. package/src/notice/list.native.js +7 -3
  280. package/src/palette-edit/index.js +1 -1
  281. package/src/placeholder/style.scss +3 -3
  282. package/src/popover/index.tsx +26 -42
  283. package/src/popover/limit-shift.ts +205 -0
  284. package/src/popover/test/index.tsx +230 -0
  285. package/src/popover/types.ts +1 -0
  286. package/src/popover/utils.ts +58 -16
  287. package/src/range-control/types.ts +0 -33
  288. package/src/resizable-box/resize-tooltip/utils.ts +13 -13
  289. package/src/sandbox/index.js +13 -7
  290. package/src/sandbox/index.native.js +3 -0
  291. package/src/search-control/index.native.js +6 -0
  292. package/src/slot-fill/bubbles-virtually/slot-fill-context.js +6 -2
  293. package/src/slot-fill/bubbles-virtually/slot-fill-provider.js +51 -58
  294. package/src/slot-fill/bubbles-virtually/use-slot-fills.js +24 -0
  295. package/src/slot-fill/bubbles-virtually/use-slot.js +11 -6
  296. package/src/slot-fill/index.js +1 -0
  297. package/src/style.scss +0 -1
  298. package/src/toggle-group-control/test/__snapshots__/index.tsx.snap +1 -0
  299. package/src/toggle-group-control/toggle-group-control-option-base/styles.ts +9 -7
  300. package/src/tools-panel/stories/index.js +27 -0
  301. package/src/tools-panel/styles.ts +28 -1
  302. package/src/tools-panel/tools-panel-header/component.tsx +12 -5
  303. package/src/tools-panel/tools-panel-header/hook.ts +5 -0
  304. package/src/tools-panel/types.ts +1 -0
  305. package/tsconfig.json +0 -2
  306. package/tsconfig.tsbuildinfo +1 -1
  307. package/src/font-size-picker/style.scss +0 -78
  308. package/src/popover/test/__snapshots__/index.js.snap +0 -34
  309. package/src/popover/test/index.js +0 -164
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/sandbox/index.native.js"],"names":["observeAndResizeJS","style","EMPTY_ARRAY","Sandbox","containerStyle","customJS","html","lang","providerUrl","scripts","styles","title","type","url","colorScheme","ref","height","setHeight","contentHtml","setContentHtml","getHtmlDoc","windowSize","Dimensions","get","isLandscape","setIsLandscape","width","wasLandscape","key","Platform","select","android","ios","htmlDoc","__html","map","rules","i","src","updateContentHtml","forceRerender","newContentHtml","setImmediate","checkMessageForResize","event","data","nativeEvent","JSON","parse","e","action","getSizeStyle","contentHeight","Math","ceil","aspectRatio","onChangeDimensions","dimensions","window","dimensionsChangeSubscription","addEventListener","remove","current","sandboxStyles","baseUrl","isAndroid","workaroundStyles","webView","StyleSheet","create","opacity"],"mappings":";;;;;;;;;AASA;;AANA;;AACA;;AAaA;;AAKA;;AAtBA;AACA;AACA;;AAIA;AACA;AACA;;AAWA;AACA;AACA;AAGA,MAAMA,kBAAkB,GAAI;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OA5DA;AA8DA,MAAMC,KAAK,GAAI;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAjEA;AAmEA,MAAMC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B;AAKC,IAAA,GAAG,EAAGwB,GALP;AAMC,IAAA,GAAG,EAAGb,GANP;AAOC,IAAA,MAAM,EAAG;AAAEiD,MAAAA,OAAO,EAAExD,WAAX;AAAwBF,MAAAA,IAAI,EAAEY;AAA9B,KAPV,CAQC;AACA;AATD;AAUC,IAAA,eAAe,EAAG,CAAE,GAAF,CAVnB;AAWC,IAAA,KAAK,EAAG,CACP6C,eAAe,0BAAf,CADO,EAEPZ,YAAY,EAFL,EAGPtB,kBAASoC,SAAT,IAAsBC,gBAAgB,CAACC,OAHhC,CAXT;AAgBC,IAAA,SAAS,EAAGxB,qBAhBb;AAiBC,IAAA,aAAa,EAAG,KAjBjB;AAkBC,IAAA,sBAAsB,EAAG,KAlB1B;AAmBC,IAAA,8BAA8B,EAAG,KAnBlC;AAoBC,IAAA,4BAA4B,EAAG;AApBhC,IADD;AAwBA;;AAED,MAAMuB,gBAAgB,GAAGE,wBAAWC,MAAX,CAAmB;AAC3CF,EAAAA,OAAO,EAAE;AACR;AACF;AACA;AACA;AACA;AACEG,IAAAA,OAAO,EAAE;AAND;AADkC,CAAnB,CAAzB;;eAWe,mBAAMnE,OAAN,C","sourcesContent":["/**\n * External dependencies\n */\nimport { Dimensions, StyleSheet } from 'react-native';\nimport { WebView } from 'react-native-webview';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tPlatform,\n\trenderToString,\n\tmemo,\n\tuseRef,\n\tuseState,\n\tuseEffect,\n} from '@wordpress/element';\nimport { usePreferredColorScheme } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport sandboxStyles from './style.scss';\n\nconst observeAndResizeJS = `\n\t( function() {\n\t\tvar observer;\n\n\t\tif ( ! window.MutationObserver || ! document.body || ! window.parent ) {\n\t\t\treturn;\n\t\t}\n\n\t\tfunction sendResize() {\n\t\t\tvar clientBoundingRect = document.body.getBoundingClientRect();\n\n\t\t\t// The function postMessage is exposed by the react-native-webview library\n\t\t\t// to communicate between React Native and the WebView, in this case,\n\t\t\t// we use it for notifying resize changes.\n window.ReactNativeWebView.postMessage(JSON.stringify( {\n action: 'resize',\n\t\t\t\twidth: clientBoundingRect.width,\n\t\t\t\theight: clientBoundingRect.height,\n }));\n\t\t}\n\n\t\tobserver = new MutationObserver( sendResize );\n\t\tobserver.observe( document.body, {\n\t\t\tattributes: true,\n\t\t\tattributeOldValue: false,\n\t\t\tcharacterData: true,\n\t\t\tcharacterDataOldValue: false,\n\t\t\tchildList: true,\n\t\t\tsubtree: true\n\t\t} );\n\n\t\twindow.addEventListener( 'load', sendResize, true );\n\n\t\t// Hack: Remove viewport unit styles, as these are relative\n\t\t// the iframe root and interfere with our mechanism for\n\t\t// determining the unconstrained page bounds.\n\t\tfunction removeViewportStyles( ruleOrNode ) {\n\t\t\tif( ruleOrNode.style ) {\n\t\t\t\t[ 'width', 'height', 'minHeight', 'maxHeight' ].forEach( function( style ) {\n\t\t\t\t\tif ( /^\\\\d+(vmin|vmax|vh|vw)$/.test( ruleOrNode.style[ style ] ) ) {\n\t\t\t\t\t\truleOrNode.style[ style ] = '';\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t}\n\t\t}\n\n\t\tArray.prototype.forEach.call( document.querySelectorAll( '[style]' ), removeViewportStyles );\n\t\tArray.prototype.forEach.call( document.styleSheets, function( stylesheet ) {\n\t\t\tArray.prototype.forEach.call( stylesheet.cssRules || stylesheet.rules, removeViewportStyles );\n\t\t} );\n\n\t\tdocument.body.style.position = 'absolute';\n\t\tdocument.body.style.width = '100%';\n\t\tdocument.body.setAttribute( 'data-resizable-iframe-connected', '' );\n\n\t\tsendResize();\n\n\t\t// Resize events can change the width of elements with 100% width, but we don't\n\t\t// get an DOM mutations for that, so do the resize when the window is resized, too.\n\t\twindow.addEventListener( 'resize', sendResize, true );\n} )();`;\n\nconst style = `\n\tbody {\n\t\tmargin: 0;\n\t}\n\thtml,\n\tbody,\n\tbody > div,\n\tbody > div iframe {\n\t\twidth: 100%;\n\t}\n\tbody > div > * {\n\t\tmargin-top: 0 !important; /* Has to have !important to override inline styles. */\n\t\tmargin-bottom: 0 !important;\n\t}\n\n\t.wp-block-embed__wrapper {\n\t\tposition: relative;\n\t}\n\n\tbody.wp-has-aspect-ratio > div iframe {\n\t\theight: 100%;\n\t\toverflow: hidden; /* If it has an aspect ratio, it shouldn't scroll. */\n\t}\n\n\t/**\n\t * Add responsiveness to embeds with aspect ratios.\n\t *\n\t * These styles have been copied from the web version (https://github.com/WordPress/gutenberg/blob/7901895ca20cf61e402925e31571d659dab64721/packages/block-library/src/embed/style.scss#L42-L89) and\n\t * adapted for the native version.\n\t */\n\t.wp-has-aspect-ratio.wp-block-embed__wrapper::before {\n\t\tcontent: \"\";\n\t\tdisplay: block;\n\t\tpadding-top: 50%; // Default to 2:1 aspect ratio.\n\t}\n\t.wp-has-aspect-ratio iframe {\n\t\tposition: absolute;\n\t\ttop: 0;\n\t\tright: 0;\n\t\tbottom: 0;\n\t\tleft: 0;\n\t\theight: 100%;\n\t\twidth: 100%;\n\t}\n\t.wp-embed-aspect-21-9.wp-block-embed__wrapper::before {\n\t\tpadding-top: 42.85%; // 9 / 21 * 100\n\t}\n\t.wp-embed-aspect-18-9.wp-block-embed__wrapper::before {\n\t\tpadding-top: 50%; // 9 / 18 * 100\n\t}\n\t.wp-embed-aspect-16-9.wp-block-embed__wrapper::before {\n\t\tpadding-top: 56.25%; // 9 / 16 * 100\n\t}\n\t.wp-embed-aspect-4-3.wp-block-embed__wrapper::before {\n\t\tpadding-top: 75%; // 3 / 4 * 100\n\t}\n\t.wp-embed-aspect-1-1.wp-block-embed__wrapper::before {\n\t\tpadding-top: 100%; // 1 / 1 * 100\n\t}\n\t.wp-embed-aspect-9-16.wp-block-embed__wrapper::before {\n\t\tpadding-top: 177.77%; // 16 / 9 * 100\n\t}\n\t.wp-embed-aspect-1-2.wp-block-embed__wrapper::before {\n\t\tpadding-top: 200%; // 2 / 1 * 100\n\t}\n`;\n\nconst EMPTY_ARRAY = [];\n\nfunction Sandbox( {\n\tcontainerStyle,\n\tcustomJS,\n\thtml = '',\n\tlang = 'en',\n\tproviderUrl = '',\n\tscripts = EMPTY_ARRAY,\n\tstyles = EMPTY_ARRAY,\n\ttitle = '',\n\ttype,\n\turl,\n} ) {\n\tconst colorScheme = usePreferredColorScheme();\n\tconst ref = useRef();\n\tconst [ height, setHeight ] = useState( 0 );\n\tconst [ contentHtml, setContentHtml ] = useState( getHtmlDoc() );\n\n\tconst windowSize = Dimensions.get( 'window' );\n\tconst [ isLandscape, setIsLandscape ] = useState(\n\t\twindowSize.width >= windowSize.height\n\t);\n\tconst wasLandscape = useRef( isLandscape );\n\t// On Android, we need to recreate the WebView on any of the following actions, otherwise it disappears:\n\t// - Device rotation\n\t// - Light/dark mode changes\n\t// For this purpose, the key prop used in the WebView will be updated with the value of the actions.\n\tconst key = Platform.select( {\n\t\tandroid: `${ url }-${\n\t\t\tisLandscape ? 'landscape' : 'portrait'\n\t\t}-${ colorScheme }`,\n\t\tios: url,\n\t} );\n\n\tfunction getHtmlDoc() {\n\t\t// Put the html snippet into a html document, and update the state to refresh the WebView,\n\t\t// we can use this in the future to inject custom styles or scripts.\n\t\t// Scripts go into the body rather than the head, to support embedded content such as Instagram\n\t\t// that expect the scripts to be part of the body.\n\t\tconst htmlDoc = (\n\t\t\t<html lang={ lang }>\n\t\t\t\t<head>\n\t\t\t\t\t<title>{ title }</title>\n\t\t\t\t\t<meta\n\t\t\t\t\t\tname=\"viewport\"\n\t\t\t\t\t\tcontent=\"width=device-width, initial-scale=1\"\n\t\t\t\t\t></meta>\n\t\t\t\t\t<style dangerouslySetInnerHTML={ { __html: style } } />\n\t\t\t\t\t{ styles.map( ( rules, i ) => (\n\t\t\t\t\t\t<style\n\t\t\t\t\t\t\tkey={ i }\n\t\t\t\t\t\t\tdangerouslySetInnerHTML={ { __html: rules } }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) ) }\n\t\t\t\t</head>\n\t\t\t\t<body\n\t\t\t\t\tdata-resizable-iframe-connected=\"data-resizable-iframe-connected\"\n\t\t\t\t\tclassName={ type }\n\t\t\t\t>\n\t\t\t\t\t<div dangerouslySetInnerHTML={ { __html: html } } />\n\t\t\t\t\t<script\n\t\t\t\t\t\ttype=\"text/javascript\"\n\t\t\t\t\t\tdangerouslySetInnerHTML={ {\n\t\t\t\t\t\t\t__html: customJS || observeAndResizeJS,\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t\t{ scripts.map( ( src ) => (\n\t\t\t\t\t\t<script key={ src } src={ src } />\n\t\t\t\t\t) ) }\n\t\t\t\t</body>\n\t\t\t</html>\n\t\t);\n\t\treturn '<!DOCTYPE html>' + renderToString( htmlDoc );\n\t}\n\n\tfunction updateContentHtml( forceRerender = false ) {\n\t\tconst newContentHtml = getHtmlDoc();\n\n\t\tif ( forceRerender && contentHtml === newContentHtml ) {\n\t\t\t// The re-render is forced by updating the state with empty HTML,\n\t\t\t// waiting for the JS code to be executed with \"setImmediate\" and then\n\t\t\t// setting the content HTML again.\n\t\t\tsetContentHtml( '' );\n\t\t\tsetImmediate( () => setContentHtml( newContentHtml ) );\n\t\t} else {\n\t\t\tsetContentHtml( newContentHtml );\n\t\t}\n\t}\n\n\tfunction checkMessageForResize( event ) {\n\t\t// Attempt to parse the message data as JSON if passed as string.\n\t\tlet data = event.nativeEvent.data || {};\n\n\t\tif ( 'string' === typeof data ) {\n\t\t\ttry {\n\t\t\t\tdata = JSON.parse( data );\n\t\t\t} catch ( e ) {}\n\t\t}\n\n\t\t// Update the state only if the message is formatted as we expect,\n\t\t// i.e. as an object with a 'resize' action.\n\t\tif ( 'resize' !== data.action ) {\n\t\t\treturn;\n\t\t}\n\n\t\tsetHeight( data.height );\n\t}\n\n\tfunction getSizeStyle() {\n\t\tconst contentHeight = Math.ceil( height );\n\n\t\treturn contentHeight ? { height: contentHeight } : { aspectRatio: 1 };\n\t}\n\n\tfunction onChangeDimensions( dimensions ) {\n\t\tsetIsLandscape( dimensions.window.width >= dimensions.window.height );\n\t}\n\n\tuseEffect( () => {\n\t\tconst dimensionsChangeSubscription = Dimensions.addEventListener(\n\t\t\t'change',\n\t\t\tonChangeDimensions\n\t\t);\n\t\treturn () => {\n\t\t\tdimensionsChangeSubscription.remove();\n\t\t};\n\t}, [] );\n\n\tuseEffect( () => {\n\t\tupdateContentHtml();\n\t}, [ html, title, type, styles, scripts ] );\n\n\tuseEffect( () => {\n\t\t// When device orientation changes we have to recalculate the size,\n\t\t// for this purpose we reset the current size value.\n\t\tif ( wasLandscape.current !== isLandscape ) {\n\t\t\tsetHeight( 0 );\n\t\t}\n\t\twasLandscape.current = isLandscape;\n\t}, [ isLandscape ] );\n\n\treturn (\n\t\t<WebView\n\t\t\tcontainerStyle={ [\n\t\t\t\tsandboxStyles[ 'sandbox-webview__container' ],\n\t\t\t\tcontainerStyle,\n\t\t\t] }\n\t\t\tkey={ key }\n\t\t\tref={ ref }\n\t\t\tsource={ { baseUrl: providerUrl, html: contentHtml } }\n\t\t\t// Wildcard value is required for static HTML\n\t\t\t// Reference: https://github.com/react-native-webview/react-native-webview/blob/master/docs/Reference.md#source\n\t\t\toriginWhitelist={ [ '*' ] }\n\t\t\tstyle={ [\n\t\t\t\tsandboxStyles[ 'sandbox-webview__content' ],\n\t\t\t\tgetSizeStyle(),\n\t\t\t\tPlatform.isAndroid && workaroundStyles.webView,\n\t\t\t] }\n\t\t\tonMessage={ checkMessageForResize }\n\t\t\tscrollEnabled={ false }\n\t\t\tsetBuiltInZoomControls={ false }\n\t\t\tshowsHorizontalScrollIndicator={ false }\n\t\t\tshowsVerticalScrollIndicator={ false }\n\t\t/>\n\t);\n}\n\nconst workaroundStyles = StyleSheet.create( {\n\twebView: {\n\t\t/**\n\t\t * The slight opacity below is a workaround for an Android crash caused from combining Android\n\t\t * 12's new scroll overflow behavior and webviews.\n\t\t * https://github.com/react-native-webview/react-native-webview/issues/1915#issuecomment-808869253\n\t\t */\n\t\topacity: 0.99,\n\t},\n} );\n\nexport default memo( Sandbox );\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/sandbox/index.native.js"],"names":["observeAndResizeJS","style","EMPTY_ARRAY","Sandbox","containerStyle","customJS","html","lang","providerUrl","scripts","styles","title","type","url","colorScheme","ref","height","setHeight","contentHtml","setContentHtml","getHtmlDoc","windowSize","Dimensions","get","isLandscape","setIsLandscape","width","wasLandscape","key","Platform","select","android","ios","htmlDoc","__html","map","rules","i","src","updateContentHtml","forceRerender","newContentHtml","setImmediate","checkMessageForResize","event","data","nativeEvent","JSON","parse","e","action","getSizeStyle","contentHeight","Math","ceil","aspectRatio","onChangeDimensions","dimensions","window","dimensionsChangeSubscription","addEventListener","remove","current","sandboxStyles","baseUrl","isAndroid","workaroundStyles","webView","StyleSheet","create","opacity"],"mappings":";;;;;;;;;AASA;;AANA;;AACA;;AAaA;;AAKA;;AAtBA;AACA;AACA;;AAIA;AACA;AACA;;AAWA;AACA;AACA;AAGA,MAAMA,kBAAkB,GAAI;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OA5DA;AA8DA,MAAMC,KAAK,GAAI;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAjE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4BAAf,CADgB,EAEhB3D,cAFgB,CADlB;AAKC,IAAA,GAAG,EAAGwB,GALP;AAMC,IAAA,GAAG,EAAGb,GANP;AAOC,IAAA,MAAM,EAAG;AAAEiD,MAAAA,OAAO,EAAExD,WAAX;AAAwBF,MAAAA,IAAI,EAAEY;AAA9B,KAPV,CAQC;AACA;AATD;AAUC,IAAA,eAAe,EAAG,CAAE,GAAF,CAVnB;AAWC,IAAA,KAAK,EAAG,CACP6C,eAAe,0BAAf,CADO,EAEPZ,YAAY,EAFL,EAGPtB,kBAASoC,SAAT,IAAsBC,gBAAgB,CAACC,OAHhC,CAXT;AAgBC,IAAA,SAAS,EAAGxB,qBAhBb;AAiBC,IAAA,aAAa,EAAG,KAjBjB;AAkBC,IAAA,sBAAsB,EAAG,KAlB1B;AAmBC,IAAA,8BAA8B,EAAG,KAnBlC;AAoBC,IAAA,4BAA4B,EAAG;AApBhC,IADD;AAwBA;;AAED,MAAMuB,gBAAgB,GAAGE,wBAAWC,MAAX,CAAmB;AAC3CF,EAAAA,OAAO,EAAE;AACR;AACF;AACA;AACA;AACA;AACEG,IAAAA,OAAO,EAAE;AAND;AADkC,CAAnB,CAAzB;;eAWe,mBAAMnE,OAAN,C","sourcesContent":["/**\n * External dependencies\n */\nimport { Dimensions, StyleSheet } from 'react-native';\nimport { WebView } from 'react-native-webview';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tPlatform,\n\trenderToString,\n\tmemo,\n\tuseRef,\n\tuseState,\n\tuseEffect,\n} from '@wordpress/element';\nimport { usePreferredColorScheme } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport sandboxStyles from './style.scss';\n\nconst observeAndResizeJS = `\n\t( function() {\n\t\tvar observer;\n\n\t\tif ( ! window.MutationObserver || ! document.body || ! window.parent ) {\n\t\t\treturn;\n\t\t}\n\n\t\tfunction sendResize() {\n\t\t\tvar clientBoundingRect = document.body.getBoundingClientRect();\n\n\t\t\t// The function postMessage is exposed by the react-native-webview library\n\t\t\t// to communicate between React Native and the WebView, in this case,\n\t\t\t// we use it for notifying resize changes.\n window.ReactNativeWebView.postMessage(JSON.stringify( {\n action: 'resize',\n\t\t\t\twidth: clientBoundingRect.width,\n\t\t\t\theight: clientBoundingRect.height,\n }));\n\t\t}\n\n\t\tobserver = new MutationObserver( sendResize );\n\t\tobserver.observe( document.body, {\n\t\t\tattributes: true,\n\t\t\tattributeOldValue: false,\n\t\t\tcharacterData: true,\n\t\t\tcharacterDataOldValue: false,\n\t\t\tchildList: true,\n\t\t\tsubtree: true\n\t\t} );\n\n\t\twindow.addEventListener( 'load', sendResize, true );\n\n\t\t// Hack: Remove viewport unit styles, as these are relative\n\t\t// the iframe root and interfere with our mechanism for\n\t\t// determining the unconstrained page bounds.\n\t\tfunction removeViewportStyles( ruleOrNode ) {\n\t\t\tif( ruleOrNode.style ) {\n\t\t\t\t[ 'width', 'height', 'minHeight', 'maxHeight' ].forEach( function( style ) {\n\t\t\t\t\tif ( /^\\\\d+(vmin|vmax|vh|vw)$/.test( ruleOrNode.style[ style ] ) ) {\n\t\t\t\t\t\truleOrNode.style[ style ] = '';\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t}\n\t\t}\n\n\t\tArray.prototype.forEach.call( document.querySelectorAll( '[style]' ), removeViewportStyles );\n\t\tArray.prototype.forEach.call( document.styleSheets, function( stylesheet ) {\n\t\t\tArray.prototype.forEach.call( stylesheet.cssRules || stylesheet.rules, removeViewportStyles );\n\t\t} );\n\n\t\tdocument.body.style.position = 'absolute';\n\t\tdocument.body.style.width = '100%';\n\t\tdocument.body.setAttribute( 'data-resizable-iframe-connected', '' );\n\n\t\tsendResize();\n\n\t\t// Resize events can change the width of elements with 100% width, but we don't\n\t\t// get an DOM mutations for that, so do the resize when the window is resized, too.\n\t\twindow.addEventListener( 'resize', sendResize, true );\n} )();`;\n\nconst style = `\n\tbody {\n\t\tmargin: 0;\n\t}\n\thtml,\n\tbody,\n\tbody > div,\n\tbody > div iframe {\n\t\twidth: 100%;\n\t}\n\tbody > div > * {\n\t\tmargin-top: 0 !important; /* Has to have !important to override inline styles. */\n\t\tmargin-bottom: 0 !important;\n\t}\n\n\t.wp-block-embed__wrapper {\n\t\tposition: relative;\n\t}\n\n\tbody.wp-has-aspect-ratio > div iframe {\n\t\theight: 100%;\n\t\toverflow: hidden; /* If it has an aspect ratio, it shouldn't scroll. */\n\t}\n\n\t/**\n\t * Add responsiveness to embeds with aspect ratios.\n\t *\n\t * These styles have been copied from the web version (https://github.com/WordPress/gutenberg/blob/7901895ca20cf61e402925e31571d659dab64721/packages/block-library/src/embed/style.scss#L42-L89) and\n\t * adapted for the native version.\n\t */\n\t.wp-has-aspect-ratio.wp-block-embed__wrapper::before {\n\t\tcontent: \"\";\n\t\tdisplay: block;\n\t\tpadding-top: 50%; // Default to 2:1 aspect ratio.\n\t}\n\t.wp-has-aspect-ratio iframe {\n\t\tposition: absolute;\n\t\ttop: 0;\n\t\tright: 0;\n\t\tbottom: 0;\n\t\tleft: 0;\n\t\theight: 100%;\n\t\twidth: 100%;\n\t}\n\t.wp-embed-aspect-21-9.wp-block-embed__wrapper::before {\n\t\tpadding-top: 42.85%; // 9 / 21 * 100\n\t}\n\t.wp-embed-aspect-18-9.wp-block-embed__wrapper::before {\n\t\tpadding-top: 50%; // 9 / 18 * 100\n\t}\n\t.wp-embed-aspect-16-9.wp-block-embed__wrapper::before {\n\t\tpadding-top: 56.25%; // 9 / 16 * 100\n\t}\n\t.wp-embed-aspect-4-3.wp-block-embed__wrapper::before {\n\t\tpadding-top: 75%; // 3 / 4 * 100\n\t}\n\t.wp-embed-aspect-1-1.wp-block-embed__wrapper::before {\n\t\tpadding-top: 100%; // 1 / 1 * 100\n\t}\n\t.wp-embed-aspect-9-16.wp-block-embed__wrapper::before {\n\t\tpadding-top: 177.77%; // 16 / 9 * 100\n\t}\n\t.wp-embed-aspect-1-2.wp-block-embed__wrapper::before {\n\t\tpadding-top: 200%; // 2 / 1 * 100\n\t}\n`;\n\nconst EMPTY_ARRAY = [];\n\nfunction Sandbox( {\n\tcontainerStyle,\n\tcustomJS,\n\thtml = '',\n\tlang = 'en',\n\tproviderUrl = '',\n\tscripts = EMPTY_ARRAY,\n\tstyles = EMPTY_ARRAY,\n\ttitle = '',\n\ttype,\n\turl,\n} ) {\n\tconst colorScheme = usePreferredColorScheme();\n\tconst ref = useRef();\n\tconst [ height, setHeight ] = useState( 0 );\n\tconst [ contentHtml, setContentHtml ] = useState( getHtmlDoc() );\n\n\tconst windowSize = Dimensions.get( 'window' );\n\tconst [ isLandscape, setIsLandscape ] = useState(\n\t\twindowSize.width >= windowSize.height\n\t);\n\tconst wasLandscape = useRef( isLandscape );\n\t// On Android, we need to recreate the WebView on any of the following actions, otherwise it disappears:\n\t// - Device rotation\n\t// - Light/dark mode changes\n\t// For this purpose, the key prop used in the WebView will be updated with the value of the actions.\n\tconst key = Platform.select( {\n\t\tandroid: `${ url }-${\n\t\t\tisLandscape ? 'landscape' : 'portrait'\n\t\t}-${ colorScheme }`,\n\t\tios: url,\n\t} );\n\n\tfunction getHtmlDoc() {\n\t\t// Put the html snippet into a html document, and update the state to refresh the WebView,\n\t\t// we can use this in the future to inject custom styles or scripts.\n\t\t// Scripts go into the body rather than the head, to support embedded content such as Instagram\n\t\t// that expect the scripts to be part of the body.\n\t\tconst htmlDoc = (\n\t\t\t<html lang={ lang }>\n\t\t\t\t<head>\n\t\t\t\t\t<title>{ title }</title>\n\t\t\t\t\t<meta\n\t\t\t\t\t\tname=\"viewport\"\n\t\t\t\t\t\tcontent=\"width=device-width, initial-scale=1\"\n\t\t\t\t\t></meta>\n\t\t\t\t\t<style dangerouslySetInnerHTML={ { __html: style } } />\n\t\t\t\t\t{ styles.map( ( rules, i ) => (\n\t\t\t\t\t\t<style\n\t\t\t\t\t\t\tkey={ i }\n\t\t\t\t\t\t\tdangerouslySetInnerHTML={ { __html: rules } }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) ) }\n\t\t\t\t</head>\n\t\t\t\t<body\n\t\t\t\t\tdata-resizable-iframe-connected=\"data-resizable-iframe-connected\"\n\t\t\t\t\tclassName={ type }\n\t\t\t\t>\n\t\t\t\t\t<div dangerouslySetInnerHTML={ { __html: html } } />\n\t\t\t\t\t<script\n\t\t\t\t\t\ttype=\"text/javascript\"\n\t\t\t\t\t\tdangerouslySetInnerHTML={ {\n\t\t\t\t\t\t\t__html: customJS || observeAndResizeJS,\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t\t{ scripts.map( ( src ) => (\n\t\t\t\t\t\t<script key={ src } src={ src } />\n\t\t\t\t\t) ) }\n\t\t\t\t</body>\n\t\t\t</html>\n\t\t);\n\t\treturn '<!DOCTYPE html>' + renderToString( htmlDoc );\n\t}\n\n\tfunction updateContentHtml( forceRerender = false ) {\n\t\tconst newContentHtml = getHtmlDoc();\n\n\t\tif ( forceRerender && contentHtml === newContentHtml ) {\n\t\t\t// The re-render is forced by updating the state with empty HTML,\n\t\t\t// waiting for the JS code to be executed with \"setImmediate\" and then\n\t\t\t// setting the content HTML again.\n\t\t\tsetContentHtml( '' );\n\t\t\tsetImmediate( () => setContentHtml( newContentHtml ) );\n\t\t} else {\n\t\t\tsetContentHtml( newContentHtml );\n\t\t}\n\t}\n\n\tfunction checkMessageForResize( event ) {\n\t\t// Attempt to parse the message data as JSON if passed as string.\n\t\tlet data = event.nativeEvent.data || {};\n\n\t\tif ( 'string' === typeof data ) {\n\t\t\ttry {\n\t\t\t\tdata = JSON.parse( data );\n\t\t\t} catch ( e ) {}\n\t\t}\n\n\t\t// Update the state only if the message is formatted as we expect,\n\t\t// i.e. as an object with a 'resize' action.\n\t\tif ( 'resize' !== data.action ) {\n\t\t\treturn;\n\t\t}\n\n\t\tsetHeight( data.height );\n\t}\n\n\tfunction getSizeStyle() {\n\t\tconst contentHeight = Math.ceil( height );\n\n\t\treturn contentHeight ? { height: contentHeight } : { aspectRatio: 1 };\n\t}\n\n\tfunction onChangeDimensions( dimensions ) {\n\t\tsetIsLandscape( dimensions.window.width >= dimensions.window.height );\n\t}\n\n\tuseEffect( () => {\n\t\tconst dimensionsChangeSubscription = Dimensions.addEventListener(\n\t\t\t'change',\n\t\t\tonChangeDimensions\n\t\t);\n\t\treturn () => {\n\t\t\tdimensionsChangeSubscription.remove();\n\t\t};\n\t}, [] );\n\n\tuseEffect( () => {\n\t\tupdateContentHtml();\n\t\t// Disable reason: deferring this refactor to the native team.\n\t\t// see https://github.com/WordPress/gutenberg/pull/41166\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [ html, title, type, styles, scripts ] );\n\n\tuseEffect( () => {\n\t\t// When device orientation changes we have to recalculate the size,\n\t\t// for this purpose we reset the current size value.\n\t\tif ( wasLandscape.current !== isLandscape ) {\n\t\t\tsetHeight( 0 );\n\t\t}\n\t\twasLandscape.current = isLandscape;\n\t}, [ isLandscape ] );\n\n\treturn (\n\t\t<WebView\n\t\t\tcontainerStyle={ [\n\t\t\t\tsandboxStyles[ 'sandbox-webview__container' ],\n\t\t\t\tcontainerStyle,\n\t\t\t] }\n\t\t\tkey={ key }\n\t\t\tref={ ref }\n\t\t\tsource={ { baseUrl: providerUrl, html: contentHtml } }\n\t\t\t// Wildcard value is required for static HTML\n\t\t\t// Reference: https://github.com/react-native-webview/react-native-webview/blob/master/docs/Reference.md#source\n\t\t\toriginWhitelist={ [ '*' ] }\n\t\t\tstyle={ [\n\t\t\t\tsandboxStyles[ 'sandbox-webview__content' ],\n\t\t\t\tgetSizeStyle(),\n\t\t\t\tPlatform.isAndroid && workaroundStyles.webView,\n\t\t\t] }\n\t\t\tonMessage={ checkMessageForResize }\n\t\t\tscrollEnabled={ false }\n\t\t\tsetBuiltInZoomControls={ false }\n\t\t\tshowsHorizontalScrollIndicator={ false }\n\t\t\tshowsVerticalScrollIndicator={ false }\n\t\t/>\n\t);\n}\n\nconst workaroundStyles = StyleSheet.create( {\n\twebView: {\n\t\t/**\n\t\t * The slight opacity below is a workaround for an Android crash caused from combining Android\n\t\t * 12's new scroll overflow behavior and webviews.\n\t\t * https://github.com/react-native-webview/react-native-webview/issues/1915#issuecomment-808869253\n\t\t */\n\t\topacity: 0.99,\n\t},\n} );\n\nexport default memo( Sandbox );\n"]}
@@ -96,7 +96,9 @@ function SearchControl(_ref) {
96
96
  mergeFutureStyles(activeStyles, [isActive]);
97
97
  mergeFutureStyles(darkStyles, [isDark]);
98
98
  mergeFutureStyles(activeDarkStyles, [isActive, isDark]);
99
- setCurrentStyles(futureStyles);
99
+ setCurrentStyles(futureStyles); // Disable reason: deferring this refactor to the native team.
100
+ // see https://github.com/WordPress/gutenberg/pull/41166
101
+ // eslint-disable-next-line react-hooks/exhaustive-deps
100
102
  }, [isActive, isDark]);
101
103
  (0, _element.useEffect)(() => {
102
104
  const keyboardHideSubscription = _reactNative.Keyboard.addListener('keyboardDidHide', () => {
@@ -108,7 +110,9 @@ function SearchControl(_ref) {
108
110
  return () => {
109
111
  clearTimeout(onCancelTimer.current);
110
112
  keyboardHideSubscription.remove();
111
- };
113
+ }; // Disable reason: deferring this refactor to the native team.
114
+ // see https://github.com/WordPress/gutenberg/pull/41166
115
+ // eslint-disable-next-line react-hooks/exhaustive-deps
112
116
  }, []);
113
117
  const {
114
118
  'search-control__container': containerStyle,
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/search-control/index.native.js"],"names":["baseStyles","allStyles","selector","platformStyles","selectModifiedStyles","styles","modifier","modifierMatcher","RegExp","modifierSelectors","Object","keys","filter","match","reduce","modifiedStyles","modifierSelector","blockElementSelector","split","mergeStyles","updateStyles","selectors","forEach","SearchControl","value","onChange","placeholder","isActive","setIsActive","currentStyles","setCurrentStyles","isDark","inputRef","onCancelTimer","isIOS","Platform","OS","darkStyles","activeStyles","activeDarkStyles","futureStyles","mergeFutureStyles","shouldUseConditions","shouldUseModified","every","should","updatedStyles","keyboardHideSubscription","Keyboard","addListener","onCancel","clearTimeout","current","remove","containerStyle","innerContainerStyle","inputContainerStyle","formInputStyle","placeholderStyle","inputButtonStyle","inputButtonLeftStyle","inputButtonRightStyle","cancelButtonStyle","cancelButtonTextStyle","iconStyle","rightIconStyle","clearInput","setTimeout","blur","renderLeftButton","button","arrowLeftIcon","Gridicons","search","color","renderRightButton","cancelCircleFilledIcon","closeIcon","renderCancel","focus"],"mappings":";;;;;;;;;AAgBA;;AAbA;;AAcA;;AACA;;AACA;;AAUA;;AACA;;AA9BA;AACA;AACA;;AAWA;AACA;AACA;;AAWA;AACA;AACA;AAIA;AACA,MAAMA,UAAU,GAAG,EAAE,GAAGC;AAAL,CAAnB;;AACA,KAAM,MAAMC,QAAZ,IAAwBC,sBAAxB,EAAyC;AACxCH,EAAAA,UAAU,CAAEE,QAAF,CAAV,GAAyB,EACxB,GAAGF,UAAU,CAAEE,QAAF,CADW;AAExB,OAAGC,uBAAgBD,QAAhB;AAFqB,GAAzB;AAIA;;AAED,SAASE,oBAAT,CAA+BC,MAA/B,EAAuCC,QAAvC,EAAkD;AACjD,QAAMC,eAAe,GAAG,IAAIC,MAAJ,CAAa,KAAKF,QAAU,GAA5B,CAAxB;AACA,QAAMG,iBAAiB,GAAGC,MAAM,CAACC,IAAP,CAAaN,MAAb,EAAsBO,MAAtB,CAAgCV,QAAF,IACvDA,QAAQ,CAACW,KAAT,CAAgBN,eAAhB,CADyB,CAA1B;AAIA,SAAOE,iBAAiB,CAACK,MAAlB,CAA0B,CAAEC,cAAF,EAAkBC,gBAAlB,KAAwC;AACxE,UAAMC,oBAAoB,GAAGD,gBAAgB,CAACE,KAAjB,CAAwB,IAAxB,EAAgC,CAAhC,CAA7B;AACAH,IAAAA,cAAc,CAAEE,oBAAF,CAAd,GAAyCZ,MAAM,CAAEW,gBAAF,CAA/C;AACA,WAAOD,cAAP;AACA,GAJM,EAIJ,EAJI,CAAP;AAKA;;AAED,SAASI,WAAT,CAAsBd,MAAtB,EAA8Be,YAA9B,EAA4CC,SAA5C,EAAwD;AACvDA,EAAAA,SAAS,CAACC,OAAV,CAAqBpB,QA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dependencies\n */\nimport {\n\tTextInput,\n\tText,\n\tView,\n\tTouchableOpacity,\n\tPlatform,\n\tuseColorScheme,\n\tKeyboard,\n} from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { useState, useRef, useMemo, useEffect } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { Button, Gridicons } from '@wordpress/components';\nimport {\n\tIcon,\n\tcancelCircleFilled as cancelCircleFilledIcon,\n\tarrowLeft as arrowLeftIcon,\n\tclose as closeIcon,\n} from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport allStyles from './style.scss';\nimport platformStyles from './platform-style.scss';\n\n// Merge platform specific styles with the default styles.\nconst baseStyles = { ...allStyles };\nfor ( const selector in platformStyles ) {\n\tbaseStyles[ selector ] = {\n\t\t...baseStyles[ selector ],\n\t\t...platformStyles[ selector ],\n\t};\n}\n\nfunction selectModifiedStyles( styles, modifier ) {\n\tconst modifierMatcher = new RegExp( `--${ modifier }$` );\n\tconst modifierSelectors = Object.keys( styles ).filter( ( selector ) =>\n\t\tselector.match( modifierMatcher )\n\t);\n\n\treturn modifierSelectors.reduce( ( modifiedStyles, modifierSelector ) => {\n\t\tconst blockElementSelector = modifierSelector.split( '--' )[ 0 ];\n\t\tmodifiedStyles[ blockElementSelector ] = styles[ modifierSelector ];\n\t\treturn modifiedStyles;\n\t}, {} );\n}\n\nfunction mergeStyles( styles, updateStyles, selectors ) {\n\tselectors.forEach( ( selector ) => {\n\t\tstyles[ selector ] = {\n\t\t\t...styles[ selector ],\n\t\t\t...updateStyles[ selector ],\n\t\t};\n\t} );\n\n\treturn styles;\n}\n\nfunction SearchControl( {\n\tvalue,\n\tonChange,\n\tplaceholder = __( 'Search blocks' ),\n} ) {\n\tconst [ isActive, setIsActive ] = useState( false );\n\tconst [ currentStyles, setCurrentStyles ] = useState( baseStyles );\n\n\tconst isDark = useColorScheme() === 'dark';\n\tconst inputRef = useRef();\n\tconst onCancelTimer = useRef();\n\n\tconst isIOS = Platform.OS === 'ios';\n\n\tconst darkStyles = useMemo( () => {\n\t\treturn selectModifiedStyles( baseStyles, 'dark' );\n\t}, [] );\n\n\tconst activeStyles = useMemo( () => {\n\t\treturn selectModifiedStyles( baseStyles, 'active' );\n\t}, [] );\n\n\tconst activeDarkStyles = useMemo( () => {\n\t\treturn selectModifiedStyles( baseStyles, 'active-dark' );\n\t}, [] );\n\n\tuseEffect( () => {\n\t\tlet futureStyles = { ...baseStyles };\n\n\t\tfunction mergeFutureStyles( modifiedStyles, shouldUseConditions ) {\n\t\t\tconst shouldUseModified = shouldUseConditions.every(\n\t\t\t\t( should ) => should\n\t\t\t);\n\n\t\t\tconst updatedStyles = shouldUseModified\n\t\t\t\t? modifiedStyles\n\t\t\t\t: futureStyles;\n\n\t\t\tconst selectors = Object.keys( modifiedStyles );\n\n\t\t\tfutureStyles = mergeStyles(\n\t\t\t\tfutureStyles,\n\t\t\t\tupdatedStyles,\n\t\t\t\tselectors\n\t\t\t);\n\t\t}\n\n\t\tmergeFutureStyles( activeStyles, [ isActive ] );\n\t\tmergeFutureStyles( darkStyles, [ isDark ] );\n\t\tmergeFutureStyles( activeDarkStyles, [ isActive, isDark ] );\n\n\t\tsetCurrentStyles( futureStyles );\n\t}, [ isActive, isDark ] );\n\n\tuseEffect( () => {\n\t\tconst keyboardHideSubscription = Keyboard.addListener(\n\t\t\t'keyboardDidHide',\n\t\t\t() => {\n\t\t\t\tif ( ! isIOS ) {\n\t\t\t\t\tonCancel();\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t\treturn () => {\n\t\t\tclearTimeout( onCancelTimer.current );\n\t\t\tkeyboardHideSubscription.remove();\n\t\t};\n\t}, [] );\n\n\tconst {\n\t\t'search-control__container': containerStyle,\n\t\t'search-control__inner-container': innerContainerStyle,\n\t\t'search-control__input-container': inputContainerStyle,\n\t\t'search-control__form-input': formInputStyle,\n\t\t'search-control__form-input-placeholder': placeholderStyle,\n\t\t'search-control__input-button': inputButtonStyle,\n\t\t'search-control__input-button-left': inputButtonLeftStyle,\n\t\t'search-control__input-button-right': inputButtonRightStyle,\n\t\t'search-control__cancel-button': cancelButtonStyle,\n\t\t'search-control__cancel-button-text': cancelButtonTextStyle,\n\t\t'search-control__icon': iconStyle,\n\t\t'search-control__right-icon': rightIconStyle,\n\t} = currentStyles;\n\n\tfunction clearInput() {\n\t\tonChange( '' );\n\t}\n\n\tfunction onCancel() {\n\t\tonCancelTimer.current = setTimeout( () => {\n\t\t\tinputRef.current.blur();\n\t\t\tclearInput();\n\t\t\tsetIsActive( false );\n\t\t}, 0 );\n\t}\n\n\tfunction renderLeftButton() {\n\t\tconst button =\n\t\t\t! isIOS && isActive ? (\n\t\t\t\t<Button\n\t\t\t\t\tlabel={ __( 'Cancel search' ) }\n\t\t\t\t\ticon={ arrowLeftIcon }\n\t\t\t\t\tonClick={ onCancel }\n\t\t\t\t\tstyle={ iconStyle }\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<Icon icon={ Gridicons.search } fill={ iconStyle?.color } />\n\t\t\t);\n\n\t\treturn (\n\t\t\t<View style={ [ inputButtonStyle, inputButtonLeftStyle ] }>\n\t\t\t\t{ button }\n\t\t\t</View>\n\t\t);\n\t}\n\n\tfunction renderRightButton() {\n\t\tlet button;\n\n\t\t// Add a View element to properly center the input placeholder via flexbox.\n\t\tif ( isIOS && ! isActive ) {\n\t\t\tbutton = <View />;\n\t\t}\n\n\t\tif ( !! value ) {\n\t\t\tbutton = (\n\t\t\t\t<Button\n\t\t\t\t\tlabel={ __( 'Clear search' ) }\n\t\t\t\t\ticon={ isIOS ? cancelCircleFilledIcon : closeIcon }\n\t\t\t\t\tonClick={ clearInput }\n\t\t\t\t\tstyle={ [ iconStyle, rightIconStyle ] }\n\t\t\t\t/>\n\t\t\t);\n\t\t}\n\n\t\treturn (\n\t\t\t<View style={ [ inputButtonStyle, inputButtonRightStyle ] }>\n\t\t\t\t{ button }\n\t\t\t</View>\n\t\t);\n\t}\n\n\tfunction renderCancel() {\n\t\tif ( ! isIOS ) {\n\t\t\treturn null;\n\t\t}\n\t\treturn (\n\t\t\t<View style={ cancelButtonStyle }>\n\t\t\t\t<Text\n\t\t\t\t\tonPress={ onCancel }\n\t\t\t\t\tstyle={ cancelButtonTextStyle }\n\t\t\t\t\taccessible={ true }\n\t\t\t\t\taccessibilityRole={ 'button' }\n\t\t\t\t\taccessibilityLabel={ __( 'Cancel search' ) }\n\t\t\t\t\taccessibilityHint={ __( 'Cancel search' ) }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t</Text>\n\t\t\t</View>\n\t\t);\n\t}\n\n\treturn (\n\t\t<TouchableOpacity\n\t\t\tstyle={ containerStyle }\n\t\t\tonPress={ () => {\n\t\t\t\tsetIsActive( true );\n\t\t\t\tinputRef.current.focus();\n\t\t\t} }\n\t\t\tactiveOpacity={ 1 }\n\t\t>\n\t\t\t<View style={ innerContainerStyle }>\n\t\t\t\t<View style={ inputContainerStyle }>\n\t\t\t\t\t{ renderLeftButton() }\n\t\t\t\t\t<TextInput\n\t\t\t\t\t\tref={ inputRef }\n\t\t\t\t\t\tstyle={ formInputStyle }\n\t\t\t\t\t\tplaceholderTextColor={ placeholderStyle?.color }\n\t\t\t\t\t\tonChangeText={ onChange }\n\t\t\t\t\t\tonFocus={ () => setIsActive( true ) }\n\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\tplaceholder={ placeholder }\n\t\t\t\t\t/>\n\t\t\t\t\t{ renderRightButton() }\n\t\t\t\t</View>\n\t\t\t\t{ isActive && renderCancel() }\n\t\t\t</View>\n\t\t</TouchableOpacity>\n\t);\n}\n\nexport default SearchControl;\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/search-control/index.native.js"],"names":["baseStyles","allStyles","selector","platformStyles","selectModifiedStyles","styles","modifier","modifierMatcher","RegExp","modifierSelectors","Object","keys","filter","match","reduce","modifiedStyles","modifierSelector","blockElementSelector","split","mergeStyles","updateStyles","selectors","forEach","SearchControl","value","onChange","placeholder","isActive","setIsActive","currentStyles","setCurrentStyles","isDark","inputRef","onCancelTimer","isIOS","Platform","OS","darkStyles","activeStyles","activeDarkStyles","futureStyles","mergeFutureStyles","shouldUseConditions","shouldUseModified","every","should","updatedStyles","keyboardHideSubscription","Keyboard","addListener","onCancel","clearTimeout","current","remove","containerStyle","innerContainerStyle","inputContainerStyle","formInputStyle","placeholderStyle","inputButtonStyle","inputButtonLeftStyle","inputButtonRightStyle","cancelButtonStyle","cancelButtonTextStyle","iconStyle","rightIconStyle","clearInput","setTimeout","blur","renderLeftButton","button","arrowLeftIcon","Gridicons","search","color","renderRightButton","cancelCircleFilledIcon","closeIcon","renderCancel","focus"],"mappings":";;;;;;;;;AAgBA;;AAbA;;AAcA;;AACA;;AACA;;AAUA;;AACA;;AA9BA;AACA;AACA;;AAWA;AACA;AACA;;AAWA;AACA;AACA;AAIA;AACA,MAAMA,UAAU,GAAG,EAAE,GAAGC;AAAL,CAAnB;;AACA,KAAM,MAAMC,QAAZ,IAAwBC,sBAAxB,EAAyC;AACxCH,EAAAA,UAAU,CAAEE,QAAF,CAAV,GAAyB,EACxB,GAAGF,UAAU,CAAEE,QAAF,CADW;AAExB,OAAGC,uBAAgBD,QAAhB;AAFqB,GAAzB;AAIA;;AAED,SAASE,oBAAT,CAA+BC,MAA/B,EAAuCC,QAAvC,EAAkD;AACjD,QAAMC,eAAe,GAAG,IAAIC,MAAJ,CAAa,KAAKF,QAAU,GAA5B,CAAxB;AACA,QAAMG,iBAAiB,GAAGC,MAAM,CAACC,IAAP,CAAaN,MAAb,EAAsBO,MAAtB,CAAgCV,QAAF,IACvDA,QAAQ,CAACW,KAAT,CAAgBN,eAAhB,CADyB,CAA1B;AAIA,SAAOE,iBAAiB,CAACK,MAAlB,CAA0B,CAAEC,cAAF,EAAkBC,gBAAlB,KAAwC;AACxE,UAAMC,oBAAoB,GAAGD,gBAAgB,CAACE,KAAjB,CAAwB,IAAxB,EAAgC,CAAhC,CAA7B;AACAH,IAAAA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B,CAAEgB,KAH1C;AAIC,IAAA,YAAY,EAAGjD,QAJhB;AAKC,IAAA,OAAO,EAAG,MAAMG,WAAW,CAAE,IAAF,CAL5B;AAMC,IAAA,KAAK,EAAGJ,KANT;AAOC,IAAA,WAAW,EAAGE;AAPf,IAFD,EAWGiD,iBAAiB,EAXpB,CADD,EAcGhD,QAAQ,IAAImD,YAAY,EAd3B,CARD,CADD;AA2BA;;eAEcvD,a","sourcesContent":["/**\n * External dependencies\n */\nimport {\n\tTextInput,\n\tText,\n\tView,\n\tTouchableOpacity,\n\tPlatform,\n\tuseColorScheme,\n\tKeyboard,\n} from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { useState, useRef, useMemo, useEffect } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { Button, Gridicons } from '@wordpress/components';\nimport {\n\tIcon,\n\tcancelCircleFilled as cancelCircleFilledIcon,\n\tarrowLeft as arrowLeftIcon,\n\tclose as closeIcon,\n} from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport allStyles from './style.scss';\nimport platformStyles from './platform-style.scss';\n\n// Merge platform specific styles with the default styles.\nconst baseStyles = { ...allStyles };\nfor ( const selector in platformStyles ) {\n\tbaseStyles[ selector ] = {\n\t\t...baseStyles[ selector ],\n\t\t...platformStyles[ selector ],\n\t};\n}\n\nfunction selectModifiedStyles( styles, modifier ) {\n\tconst modifierMatcher = new RegExp( `--${ modifier }$` );\n\tconst modifierSelectors = Object.keys( styles ).filter( ( selector ) =>\n\t\tselector.match( modifierMatcher )\n\t);\n\n\treturn modifierSelectors.reduce( ( modifiedStyles, modifierSelector ) => {\n\t\tconst blockElementSelector = modifierSelector.split( '--' )[ 0 ];\n\t\tmodifiedStyles[ blockElementSelector ] = styles[ modifierSelector ];\n\t\treturn modifiedStyles;\n\t}, {} );\n}\n\nfunction mergeStyles( styles, updateStyles, selectors ) {\n\tselectors.forEach( ( selector ) => {\n\t\tstyles[ selector ] = {\n\t\t\t...styles[ selector ],\n\t\t\t...updateStyles[ selector ],\n\t\t};\n\t} );\n\n\treturn styles;\n}\n\nfunction SearchControl( {\n\tvalue,\n\tonChange,\n\tplaceholder = __( 'Search blocks' ),\n} ) {\n\tconst [ isActive, setIsActive ] = useState( false );\n\tconst [ currentStyles, setCurrentStyles ] = useState( baseStyles );\n\n\tconst isDark = useColorScheme() === 'dark';\n\tconst inputRef = useRef();\n\tconst onCancelTimer = useRef();\n\n\tconst isIOS = Platform.OS === 'ios';\n\n\tconst darkStyles = useMemo( () => {\n\t\treturn selectModifiedStyles( baseStyles, 'dark' );\n\t}, [] );\n\n\tconst activeStyles = useMemo( () => {\n\t\treturn selectModifiedStyles( baseStyles, 'active' );\n\t}, [] );\n\n\tconst activeDarkStyles = useMemo( () => {\n\t\treturn selectModifiedStyles( baseStyles, 'active-dark' );\n\t}, [] );\n\n\tuseEffect( () => {\n\t\tlet futureStyles = { ...baseStyles };\n\n\t\tfunction mergeFutureStyles( modifiedStyles, shouldUseConditions ) {\n\t\t\tconst shouldUseModified = shouldUseConditions.every(\n\t\t\t\t( should ) => should\n\t\t\t);\n\n\t\t\tconst updatedStyles = shouldUseModified\n\t\t\t\t? modifiedStyles\n\t\t\t\t: futureStyles;\n\n\t\t\tconst selectors = Object.keys( modifiedStyles );\n\n\t\t\tfutureStyles = mergeStyles(\n\t\t\t\tfutureStyles,\n\t\t\t\tupdatedStyles,\n\t\t\t\tselectors\n\t\t\t);\n\t\t}\n\n\t\tmergeFutureStyles( activeStyles, [ isActive ] );\n\t\tmergeFutureStyles( darkStyles, [ isDark ] );\n\t\tmergeFutureStyles( activeDarkStyles, [ isActive, isDark ] );\n\n\t\tsetCurrentStyles( futureStyles );\n\t\t// Disable reason: deferring this refactor to the native team.\n\t\t// see https://github.com/WordPress/gutenberg/pull/41166\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [ isActive, isDark ] );\n\n\tuseEffect( () => {\n\t\tconst keyboardHideSubscription = Keyboard.addListener(\n\t\t\t'keyboardDidHide',\n\t\t\t() => {\n\t\t\t\tif ( ! isIOS ) {\n\t\t\t\t\tonCancel();\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t\treturn () => {\n\t\t\tclearTimeout( onCancelTimer.current );\n\t\t\tkeyboardHideSubscription.remove();\n\t\t};\n\t\t// Disable reason: deferring this refactor to the native team.\n\t\t// see https://github.com/WordPress/gutenberg/pull/41166\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [] );\n\n\tconst {\n\t\t'search-control__container': containerStyle,\n\t\t'search-control__inner-container': innerContainerStyle,\n\t\t'search-control__input-container': inputContainerStyle,\n\t\t'search-control__form-input': formInputStyle,\n\t\t'search-control__form-input-placeholder': placeholderStyle,\n\t\t'search-control__input-button': inputButtonStyle,\n\t\t'search-control__input-button-left': inputButtonLeftStyle,\n\t\t'search-control__input-button-right': inputButtonRightStyle,\n\t\t'search-control__cancel-button': cancelButtonStyle,\n\t\t'search-control__cancel-button-text': cancelButtonTextStyle,\n\t\t'search-control__icon': iconStyle,\n\t\t'search-control__right-icon': rightIconStyle,\n\t} = currentStyles;\n\n\tfunction clearInput() {\n\t\tonChange( '' );\n\t}\n\n\tfunction onCancel() {\n\t\tonCancelTimer.current = setTimeout( () => {\n\t\t\tinputRef.current.blur();\n\t\t\tclearInput();\n\t\t\tsetIsActive( false );\n\t\t}, 0 );\n\t}\n\n\tfunction renderLeftButton() {\n\t\tconst button =\n\t\t\t! isIOS && isActive ? (\n\t\t\t\t<Button\n\t\t\t\t\tlabel={ __( 'Cancel search' ) }\n\t\t\t\t\ticon={ arrowLeftIcon }\n\t\t\t\t\tonClick={ onCancel }\n\t\t\t\t\tstyle={ iconStyle }\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<Icon icon={ Gridicons.search } fill={ iconStyle?.color } />\n\t\t\t);\n\n\t\treturn (\n\t\t\t<View style={ [ inputButtonStyle, inputButtonLeftStyle ] }>\n\t\t\t\t{ button }\n\t\t\t</View>\n\t\t);\n\t}\n\n\tfunction renderRightButton() {\n\t\tlet button;\n\n\t\t// Add a View element to properly center the input placeholder via flexbox.\n\t\tif ( isIOS && ! isActive ) {\n\t\t\tbutton = <View />;\n\t\t}\n\n\t\tif ( !! value ) {\n\t\t\tbutton = (\n\t\t\t\t<Button\n\t\t\t\t\tlabel={ __( 'Clear search' ) }\n\t\t\t\t\ticon={ isIOS ? cancelCircleFilledIcon : closeIcon }\n\t\t\t\t\tonClick={ clearInput }\n\t\t\t\t\tstyle={ [ iconStyle, rightIconStyle ] }\n\t\t\t\t/>\n\t\t\t);\n\t\t}\n\n\t\treturn (\n\t\t\t<View style={ [ inputButtonStyle, inputButtonRightStyle ] }>\n\t\t\t\t{ button }\n\t\t\t</View>\n\t\t);\n\t}\n\n\tfunction renderCancel() {\n\t\tif ( ! isIOS ) {\n\t\t\treturn null;\n\t\t}\n\t\treturn (\n\t\t\t<View style={ cancelButtonStyle }>\n\t\t\t\t<Text\n\t\t\t\t\tonPress={ onCancel }\n\t\t\t\t\tstyle={ cancelButtonTextStyle }\n\t\t\t\t\taccessible={ true }\n\t\t\t\t\taccessibilityRole={ 'button' }\n\t\t\t\t\taccessibilityLabel={ __( 'Cancel search' ) }\n\t\t\t\t\taccessibilityHint={ __( 'Cancel search' ) }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t</Text>\n\t\t\t</View>\n\t\t);\n\t}\n\n\treturn (\n\t\t<TouchableOpacity\n\t\t\tstyle={ containerStyle }\n\t\t\tonPress={ () => {\n\t\t\t\tsetIsActive( true );\n\t\t\t\tinputRef.current.focus();\n\t\t\t} }\n\t\t\tactiveOpacity={ 1 }\n\t\t>\n\t\t\t<View style={ innerContainerStyle }>\n\t\t\t\t<View style={ inputContainerStyle }>\n\t\t\t\t\t{ renderLeftButton() }\n\t\t\t\t\t<TextInput\n\t\t\t\t\t\tref={ inputRef }\n\t\t\t\t\t\tstyle={ formInputStyle }\n\t\t\t\t\t\tplaceholderTextColor={ placeholderStyle?.color }\n\t\t\t\t\t\tonChangeText={ onChange }\n\t\t\t\t\t\tonFocus={ () => setIsActive( true ) }\n\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\tplaceholder={ placeholder }\n\t\t\t\t\t/>\n\t\t\t\t\t{ renderRightButton() }\n\t\t\t\t</View>\n\t\t\t\t{ isActive && renderCancel() }\n\t\t\t</View>\n\t\t</TouchableOpacity>\n\t);\n}\n\nexport default SearchControl;\n"]}
@@ -7,18 +7,24 @@ Object.defineProperty(exports, "__esModule", {
7
7
  });
8
8
  exports.default = void 0;
9
9
 
10
+ var _utils = require("valtio/utils");
11
+
10
12
  var _element = require("@wordpress/element");
11
13
 
12
14
  var _warning = _interopRequireDefault(require("@wordpress/warning"));
13
15
 
14
16
  // @ts-nocheck
15
17
 
18
+ /**
19
+ * External dependencies
20
+ */
21
+
16
22
  /**
17
23
  * WordPress dependencies
18
24
  */
19
25
  const SlotFillContext = (0, _element.createContext)({
20
- slots: {},
21
- fills: {},
26
+ slots: (0, _utils.proxyMap)(),
27
+ fills: (0, _utils.proxyMap)(),
22
28
  registerSlot: () => {
23
29
  typeof process !== "undefined" && process.env && process.env.NODE_ENV !== "production" ? (0, _warning.default)('Components must be wrapped within `SlotFillProvider`. ' + 'See https://developer.wordpress.org/block-editor/components/slot-fill/') : void 0;
24
30
  },
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/slot-fill/bubbles-virtually/slot-fill-context.js"],"names":["SlotFillContext","slots","fills","registerSlot","updateSlot","unregisterSlot","registerFill","unregisterFill"],"mappings":";;;;;;;;;AAIA;;AACA;;AALA;;AACA;AACA;AACA;AAIA,MAAMA,eAAe,GAAG,4BAAe;AACtCC,EAAAA,KAAK,EAAE,EAD+B;AAEtCC,EAAAA,KAAK,EAAE,EAF+B;AAGtCC,EAAAA,YAAY,EAAE,MAAM;AACnB,mHACC,2DACC,wEAFF;AAIA,GARqC;AAStCC,EAAAA,UAAU,EAAE,MAAM,CAAE,CATkB;AAUtCC,EAAAA,cAAc,EAAE,MAAM,CAAE,CAVc;AAWtCC,EAAAA,YAAY,EAAE,MAAM,CAAE,CAXgB;AAYtCC,EAAAA,cAAc,EAAE,MAAM,CAAE;AAZc,CAAf,CAAxB;eAeeP,e","sourcesContent":["// @ts-nocheck\n/**\n * WordPress dependencies\n */\nimport { createContext } from '@wordpress/element';\nimport warning from '@wordpress/warning';\n\nconst SlotFillContext = createContext( {\n\tslots: {},\n\tfills: {},\n\tregisterSlot: () => {\n\t\twarning(\n\t\t\t'Components must be wrapped within `SlotFillProvider`. ' +\n\t\t\t\t'See https://developer.wordpress.org/block-editor/components/slot-fill/'\n\t\t);\n\t},\n\tupdateSlot: () => {},\n\tunregisterSlot: () => {},\n\tregisterFill: () => {},\n\tunregisterFill: () => {},\n} );\n\nexport default SlotFillContext;\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/slot-fill/bubbles-virtually/slot-fill-context.js"],"names":["SlotFillContext","slots","fills","registerSlot","updateSlot","unregisterSlot","registerFill","unregisterFill"],"mappings":";;;;;;;;;AAIA;;AAIA;;AACA;;AATA;;AACA;AACA;AACA;;AAEA;AACA;AACA;AAIA,MAAMA,eAAe,GAAG,4BAAe;AACtCC,EAAAA,KAAK,EAAE,sBAD+B;AAEtCC,EAAAA,KAAK,EAAE,sBAF+B;AAGtCC,EAAAA,YAAY,EAAE,MAAM;AACnB,mHACC,2DACC,wEAFF;AAIA,GARqC;AAStCC,EAAAA,UAAU,EAAE,MAAM,CAAE,CATkB;AAUtCC,EAAAA,cAAc,EAAE,MAAM,CAAE,CAVc;AAWtCC,EAAAA,YAAY,EAAE,MAAM,CAAE,CAXgB;AAYtCC,EAAAA,cAAc,EAAE,MAAM,CAAE;AAZc,CAAf,CAAxB;eAeeP,e","sourcesContent":["// @ts-nocheck\n/**\n * External dependencies\n */\nimport { proxyMap } from 'valtio/utils';\n/**\n * WordPress dependencies\n */\nimport { createContext } from '@wordpress/element';\nimport warning from '@wordpress/warning';\n\nconst SlotFillContext = createContext( {\n\tslots: proxyMap(),\n\tfills: proxyMap(),\n\tregisterSlot: () => {\n\t\twarning(\n\t\t\t'Components must be wrapped within `SlotFillProvider`. ' +\n\t\t\t\t'See https://developer.wordpress.org/block-editor/components/slot-fill/'\n\t\t);\n\t},\n\tupdateSlot: () => {},\n\tunregisterSlot: () => {},\n\tregisterFill: () => {},\n\tunregisterFill: () => {},\n} );\n\nexport default SlotFillContext;\n"]}
@@ -9,12 +9,20 @@ exports.default = SlotFillProvider;
9
9
 
10
10
  var _element = require("@wordpress/element");
11
11
 
12
+ var _valtio = require("valtio");
13
+
14
+ var _utils = require("valtio/utils");
15
+
12
16
  var _isShallowEqual = _interopRequireDefault(require("@wordpress/is-shallow-equal"));
13
17
 
14
18
  var _slotFillContext = _interopRequireDefault(require("./slot-fill-context"));
15
19
 
16
20
  // @ts-nocheck
17
21
 
22
+ /**
23
+ * External dependencies
24
+ */
25
+
18
26
  /**
19
27
  * WordPress dependencies
20
28
  */
@@ -23,36 +31,26 @@ var _slotFillContext = _interopRequireDefault(require("./slot-fill-context"));
23
31
  * Internal dependencies
24
32
  */
25
33
  function useSlotRegistry() {
26
- const [slots, setSlots] = (0, _element.useState)({});
27
- const [fills, setFills] = (0, _element.useState)({});
34
+ const slots = (0, _element.useRef)((0, _utils.proxyMap)());
35
+ const fills = (0, _element.useRef)((0, _utils.proxyMap)());
28
36
  const registerSlot = (0, _element.useCallback)((name, ref, fillProps) => {
29
- setSlots(prevSlots => {
30
- const slot = prevSlots[name] || {};
31
- return { ...prevSlots,
32
- [name]: { ...slot,
33
- ref: ref || slot.ref,
34
- fillProps: fillProps || slot.fillProps || {}
35
- }
36
- };
37
- });
37
+ const slot = slots.current.get(name) || {};
38
+ slots.current.set(name, (0, _valtio.ref)({ ...slot,
39
+ ref: ref || slot.ref,
40
+ fillProps: fillProps || slot.fillProps || {}
41
+ }));
38
42
  }, []);
39
43
  const unregisterSlot = (0, _element.useCallback)((name, ref) => {
40
- setSlots(prevSlots => {
41
- const {
42
- [name]: slot,
43
- ...nextSlots
44
- } = prevSlots; // Make sure we're not unregistering a slot registered by another element
45
- // See https://github.com/WordPress/gutenberg/pull/19242#issuecomment-590295412
46
-
47
- if ((slot === null || slot === void 0 ? void 0 : slot.ref) === ref) {
48
- return nextSlots;
49
- }
44
+ var _slots$current$get;
50
45
 
51
- return prevSlots;
52
- });
46
+ // Make sure we're not unregistering a slot registered by another element
47
+ // See https://github.com/WordPress/gutenberg/pull/19242#issuecomment-590295412
48
+ if (((_slots$current$get = slots.current.get(name)) === null || _slots$current$get === void 0 ? void 0 : _slots$current$get.ref) === ref) {
49
+ slots.current.delete(name);
50
+ }
53
51
  }, []);
54
52
  const updateSlot = (0, _element.useCallback)((name, fillProps) => {
55
- const slot = slots[name];
53
+ const slot = slots.current.get(name);
56
54
 
57
55
  if (!slot) {
58
56
  return;
@@ -60,40 +58,32 @@ function useSlotRegistry() {
60
58
 
61
59
  if (!(0, _isShallowEqual.default)(slot.fillProps, fillProps)) {
62
60
  slot.fillProps = fillProps;
63
- const slotFills = fills[name];
61
+ const slotFills = fills.current.get(name);
64
62
 
65
63
  if (slotFills) {
66
64
  // Force update fills.
67
65
  slotFills.map(fill => fill.current.rerender());
68
66
  }
69
67
  }
70
- }, [slots, fills]);
68
+ }, []);
71
69
  const registerFill = (0, _element.useCallback)((name, ref) => {
72
- setFills(prevFills => ({ ...prevFills,
73
- [name]: [...(prevFills[name] || []), ref]
74
- }));
70
+ fills.current.set(name, (0, _valtio.ref)([...(fills.current.get(name) || []), ref]));
75
71
  }, []);
76
72
  const unregisterFill = (0, _element.useCallback)((name, ref) => {
77
- setFills(prevFills => {
78
- if (prevFills[name]) {
79
- return { ...prevFills,
80
- [name]: prevFills[name].filter(fillRef => fillRef !== ref)
81
- };
82
- }
83
-
84
- return prevFills;
85
- });
73
+ if (fills.current.get(name)) {
74
+ fills.current.set(name, fills.current.get(name).filter(fillRef => fillRef !== ref));
75
+ }
86
76
  }, []); // Memoizing the return value so it can be directly passed to Provider value
87
77
 
88
78
  const registry = (0, _element.useMemo)(() => ({
89
- slots,
90
- fills,
79
+ slots: slots.current,
80
+ fills: fills.current,
91
81
  registerSlot,
92
82
  updateSlot,
93
83
  unregisterSlot,
94
84
  registerFill,
95
85
  unregisterFill
96
- }), [slots, fills, registerSlot, updateSlot, unregisterSlot, registerFill, unregisterFill]);
86
+ }), [registerSlot, updateSlot, unregisterSlot, registerFill, unregisterFill]);
97
87
  return registry;
98
88
  }
99
89
 
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/slot-fill/bubbles-virtually/slot-fill-provider.js"],"names":["useSlotRegistry","slots","setSlots","fills","setFills","registerSlot","name","ref","fillProps","prevSlots","slot","unregisterSlot","nextSlots","updateSlot","slotFills","map","fill","current","rerender","registerFill","prevFills","unregisterFill","filter","fillRef","registry","SlotFillProvider","children"],"mappings":";;;;;;;;;AAIA;;AACA;;AAKA;;AAVA;;AACA;AACA;AACA;;AAIA;AACA;AACA;AAGA,SAASA,eAAT,GAA2B;AAC1B,QAAM,CAAEC,KAAF,EAASC,QAAT,IAAsB,uBAAU,EAAV,CAA5B;AACA,QAAM,CAAEC,KAAF,EAASC,QAAT,IAAsB,uBAAU,EAAV,CAA5B;AAEA,QAAMC,YAAY,GAAG,0BAAa,CAAEC,IAAF,EAAQC,GAAR,EAAaC,SAAb,KAA4B;AAC7DN,IAAAA,QAAQ,CAAIO,SAAF,IAAiB;AAC1B,YAAMC,IAAI,GAAGD,SAAS,CAAEH,IAAF,CAAT,IAAqB,EAAlC;AACA,aAAO,EACN,GAAGG,SADG;AAEN,SAAEH,IAAF,GAAU,EACT,GAAGI,IADM;AAETH,UAAAA,GAAG,EAAEA,GAAG,IAAIG,IAAI,CAACH,GAFR;AAGTC,UAAAA,SAAS,EAAEA,SAAS,IAAIE,IAAI,CAACF,SAAlB,IAA+B;AAHjC;AAFJ,OAAP;AAQA,KAVO,CAAR;AAWA,GAZoB,EAYlB,EAZkB,CAAr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AAMc,cAAc,GAAG,0BAAa,CAAEf,IAAF,EAAQC,GAAR,KAAiB;AACpDH,IAAAA,QAAQ,CAAIgB,SAAF,IAAiB;AAC1B,UAAKA,SAAS,CAAEd,IAAF,CAAd,EAAyB;AACxB,eAAO,EACN,GAAGc,SADG;AAEN,WAAEd,IAAF,GAAUc,SAAS,CAAEd,IAAF,CAAT,CAAkBgB,MAAlB,CACPC,OAAF,IAAeA,OAAO,KAAKhB,GADlB;AAFJ,SAAP;AAMA;;AACD,aAAOa,SAAP;AACA,KAVO,CAAR;AAWA,GAZsB,EAYpB,EAZoB,CAAvB,CAvD0B,CAqE1B;;AACA,QAAMI,QAAQ,GAAG,sBAChB,OAAQ;AACPvB,IAAAA,KADO;AAEPE,IAAAA,KAFO;AAGPE,IAAAA,YAHO;AAIPQ,IAAAA,UAJO;AAKPF,IAAAA,cALO;AAMPQ,IAAAA,YANO;AAOPE,IAAAA;AAPO,GAAR,CADgB,EAUhB,CACCpB,KADD,EAECE,KAFD,EAGCE,YAHD,EAICQ,UAJD,EAKCF,cALD,EAMCQ,YAND,EAOCE,cAPD,CAVgB,CAAjB;AAqBA,SAAOG,QAAP;AACA;;AAEc,SAASC,gBAAT,OAA0C;AAAA,MAAf;AAAEC,IAAAA;AAAF,GAAe;AACxD,QAAMF,QAAQ,GAAGxB,eAAe,EAAhC;AACA,SACC,4BAAC,wBAAD,CAAiB,QAAjB;AAA0B,IAAA,KAAK,EAAGwB;AAAlC,KACGE,QADH,CADD;AAKA","sourcesContent":["// @ts-nocheck\n/**\n * WordPress dependencies\n */\nimport { useMemo, useCallback, useState } from '@wordpress/element';\nimport isShallowEqual from '@wordpress/is-shallow-equal';\n\n/**\n * Internal dependencies\n */\nimport SlotFillContext from './slot-fill-context';\n\nfunction useSlotRegistry() {\n\tconst [ slots, setSlots ] = useState( {} );\n\tconst [ fills, setFills ] = useState( {} );\n\n\tconst registerSlot = useCallback( ( name, ref, fillProps ) => {\n\t\tsetSlots( ( prevSlots ) => {\n\t\t\tconst slot = prevSlots[ name ] || {};\n\t\t\treturn {\n\t\t\t\t...prevSlots,\n\t\t\t\t[ name ]: {\n\t\t\t\t\t...slot,\n\t\t\t\t\tref: ref || slot.ref,\n\t\t\t\t\tfillProps: fillProps || slot.fillProps || {},\n\t\t\t\t},\n\t\t\t};\n\t\t} );\n\t}, [] );\n\n\tconst unregisterSlot = useCallback( ( name, ref ) => {\n\t\tsetSlots( ( prevSlots ) => {\n\t\t\tconst { [ name ]: slot, ...nextSlots } = prevSlots;\n\t\t\t// Make sure we're not unregistering a slot registered by another element\n\t\t\t// See https://github.com/WordPress/gutenberg/pull/19242#issuecomment-590295412\n\t\t\tif ( slot?.ref === ref ) {\n\t\t\t\treturn nextSlots;\n\t\t\t}\n\t\t\treturn prevSlots;\n\t\t} );\n\t}, [] );\n\n\tconst updateSlot = useCallback(\n\t\t( name, fillProps ) => {\n\t\t\tconst slot = slots[ name ];\n\t\t\tif ( ! slot ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif ( ! isShallowEqual( slot.fillProps, fillProps ) ) {\n\t\t\t\tslot.fillProps = fillProps;\n\t\t\t\tconst slotFills = fills[ name ];\n\t\t\t\tif ( slotFills ) {\n\t\t\t\t\t// Force update fills.\n\t\t\t\t\tslotFills.map( ( fill ) => fill.current.rerender() );\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t[ slots, fills ]\n\t);\n\n\tconst registerFill = useCallback( ( name, ref ) => {\n\t\tsetFills( ( prevFills ) => ( {\n\t\t\t...prevFills,\n\t\t\t[ name ]: [ ...( prevFills[ name ] || [] ), ref ],\n\t\t} ) );\n\t}, [] );\n\n\tconst unregisterFill = useCallback( ( name, ref ) => {\n\t\tsetFills( ( prevFills ) => {\n\t\t\tif ( prevFills[ name ] ) {\n\t\t\t\treturn {\n\t\t\t\t\t...prevFills,\n\t\t\t\t\t[ name ]: prevFills[ name ].filter(\n\t\t\t\t\t\t( fillRef ) => fillRef !== ref\n\t\t\t\t\t),\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn prevFills;\n\t\t} );\n\t}, [] );\n\n\t// Memoizing the return value so it can be directly passed to Provider value\n\tconst registry = useMemo(\n\t\t() => ( {\n\t\t\tslots,\n\t\t\tfills,\n\t\t\tregisterSlot,\n\t\t\tupdateSlot,\n\t\t\tunregisterSlot,\n\t\t\tregisterFill,\n\t\t\tunregisterFill,\n\t\t} ),\n\t\t[\n\t\t\tslots,\n\t\t\tfills,\n\t\t\tregisterSlot,\n\t\t\tupdateSlot,\n\t\t\tunregisterSlot,\n\t\t\tregisterFill,\n\t\t\tunregisterFill,\n\t\t]\n\t);\n\n\treturn registry;\n}\n\nexport default function SlotFillProvider( { children } ) {\n\tconst registry = useSlotRegistry();\n\treturn (\n\t\t<SlotFillContext.Provider value={ registry }>\n\t\t\t{ children }\n\t\t</SlotFillContext.Provider>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/slot-fill/bubbles-virtually/slot-fill-provider.js"],"names":["useSlotRegistry","slots","fills","registerSlot","name","ref","fillProps","slot","current","get","set","unregisterSlot","delete","updateSlot","slotFills","map","fill","rerender","registerFill","unregisterFill","filter","fillRef","registry","SlotFillProvider","children"],"mappings":";;;;;;;;;AAUA;;AANA;;AACA;;AAMA;;AAKA;;AAhBA;;AACA;AACA;AACA;;AAIA;AACA;AACA;;AAIA;AACA;AACA;AAGA,SAASA,eAAT,GAA2B;AAC1B,QAAMC,KAAK,GAAG,qBAAQ,sBAAR,CAAd;AACA,QAAMC,KAAK,GAAG,qBAAQ,sBAAR,CAAd;AAEA,QAAMC,YAAY,GAAG,0BAAa,CAAEC,IAAF,EAAQC,GAAR,EAAaC,SAAb,KAA4B;AAC7D,UAAMC,IAAI,GAAGN,KAAK,CAACO,OAAN,CAAcC,GAAd,CAAmBL,IAAnB,KAA6B,EAA1C;AACAH,IAAAA,KAAK,CAACO,OAAN,CAAcE,GAAd,CACCN,IADD,EAEC,iBAAQ,EACP,GAAGG,IADI;AAEPF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,CAAF,EAA0CC,GAA1C,CAAR,CAFD;AAIA,GALoB,EAKlB,EALkB,CAArB;AAOA,QAAMc,cAAc,GAAG,0BAAa,CAAEf,IAAF,EAAQC,GAAR,KAAiB;AACpD,QAAKH,KAAK,CAACM,OAAN,CAAcC,GAAd,CAAmBL,IAAnB,CAAL,EAAiC;AAChCF,MAAAA,KAAK,CAACM,OAAN,CAAcE,GAAd,CACCN,IADD,EAECF,KAAK,CAACM,OAAN,CACEC,GADF,CACOL,IADP,EAEEgB,MAFF,CAEYC,OAAF,IAAeA,OAAO,KAAKhB,GAFrC,CAFD;AAMA;AACD,GATsB,EASpB,EAToB,CAAvB,CA/C0B,CA0D1B;;AACA,QAAMiB,QAAQ,GAAG,sBAChB,OAAQ;AACPrB,IAAAA,KAAK,EAAEA,KAAK,CAACO,OADN;AAEPN,IAAAA,KAAK,EAAEA,KAAK,CAACM,OAFN;AAGPL,IAAAA,YAHO;AAIPU,IAAAA,UAJO;AAKPF,IAAAA,cALO;AAMPO,IAAAA,YANO;AAOPC,IAAAA;AAPO,GAAR,CADgB,EAUhB,CACChB,YADD,EAECU,UAFD,EAGCF,cAHD,EAICO,YAJD,EAKCC,cALD,CAVgB,CAAjB;AAmBA,SAAOG,QAAP;AACA;;AAEc,SAASC,gBAAT,OAA0C;AAAA,MAAf;AAAEC,IAAAA;AAAF,GAAe;AACxD,QAAMF,QAAQ,GAAGtB,eAAe,EAAhC;AACA,SACC,4BAAC,wBAAD,CAAiB,QAAjB;AAA0B,IAAA,KAAK,EAAGsB;AAAlC,KACGE,QADH,CADD;AAKA","sourcesContent":["// @ts-nocheck\n/**\n * External dependencies\n */\nimport { ref as valRef } from 'valtio';\nimport { proxyMap } from 'valtio/utils';\n\n/**\n * WordPress dependencies\n */\nimport { useMemo, useCallback, useRef } from '@wordpress/element';\nimport isShallowEqual from '@wordpress/is-shallow-equal';\n\n/**\n * Internal dependencies\n */\nimport SlotFillContext from './slot-fill-context';\n\nfunction useSlotRegistry() {\n\tconst slots = useRef( proxyMap() );\n\tconst fills = useRef( proxyMap() );\n\n\tconst registerSlot = useCallback( ( name, ref, fillProps ) => {\n\t\tconst slot = slots.current.get( name ) || {};\n\t\tslots.current.set(\n\t\t\tname,\n\t\t\tvalRef( {\n\t\t\t\t...slot,\n\t\t\t\tref: ref || slot.ref,\n\t\t\t\tfillProps: fillProps || slot.fillProps || {},\n\t\t\t} )\n\t\t);\n\t}, [] );\n\n\tconst unregisterSlot = useCallback( ( name, ref ) => {\n\t\t// Make sure we're not unregistering a slot registered by another element\n\t\t// See https://github.com/WordPress/gutenberg/pull/19242#issuecomment-590295412\n\t\tif ( slots.current.get( name )?.ref === ref ) {\n\t\t\tslots.current.delete( name );\n\t\t}\n\t}, [] );\n\n\tconst updateSlot = useCallback( ( name, fillProps ) => {\n\t\tconst slot = slots.current.get( name );\n\t\tif ( ! slot ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( ! isShallowEqual( slot.fillProps, fillProps ) ) {\n\t\t\tslot.fillProps = fillProps;\n\t\t\tconst slotFills = fills.current.get( name );\n\t\t\tif ( slotFills ) {\n\t\t\t\t// Force update fills.\n\t\t\t\tslotFills.map( ( fill ) => fill.current.rerender() );\n\t\t\t}\n\t\t}\n\t}, [] );\n\n\tconst registerFill = useCallback( ( name, ref ) => {\n\t\tfills.current.set(\n\t\t\tname,\n\t\t\tvalRef( [ ...( fills.current.get( name ) || [] ), ref ] )\n\t\t);\n\t}, [] );\n\n\tconst unregisterFill = useCallback( ( name, ref ) => {\n\t\tif ( fills.current.get( name ) ) {\n\t\t\tfills.current.set(\n\t\t\t\tname,\n\t\t\t\tfills.current\n\t\t\t\t\t.get( name )\n\t\t\t\t\t.filter( ( fillRef ) => fillRef !== ref )\n\t\t\t);\n\t\t}\n\t}, [] );\n\n\t// Memoizing the return value so it can be directly passed to Provider value\n\tconst registry = useMemo(\n\t\t() => ( {\n\t\t\tslots: slots.current,\n\t\t\tfills: fills.current,\n\t\t\tregisterSlot,\n\t\t\tupdateSlot,\n\t\t\tunregisterSlot,\n\t\t\tregisterFill,\n\t\t\tunregisterFill,\n\t\t} ),\n\t\t[\n\t\t\tregisterSlot,\n\t\t\tupdateSlot,\n\t\t\tunregisterSlot,\n\t\t\tregisterFill,\n\t\t\tunregisterFill,\n\t\t]\n\t);\n\n\treturn registry;\n}\n\nexport default function SlotFillProvider( { children } ) {\n\tconst registry = useSlotRegistry();\n\treturn (\n\t\t<SlotFillContext.Provider value={ registry }>\n\t\t\t{ children }\n\t\t</SlotFillContext.Provider>\n\t);\n}\n"]}
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = useSlotFills;
9
+
10
+ var _valtio = require("valtio");
11
+
12
+ var _element = require("@wordpress/element");
13
+
14
+ var _slotFillContext = _interopRequireDefault(require("./slot-fill-context"));
15
+
16
+ // @ts-nocheck
17
+
18
+ /**
19
+ * External dependencies
20
+ */
21
+
22
+ /**
23
+ * WordPress dependencies
24
+ */
25
+
26
+ /**
27
+ * Internal dependencies
28
+ */
29
+ function useSlotFills(name) {
30
+ const registry = (0, _element.useContext)(_slotFillContext.default);
31
+ const fills = (0, _valtio.useSnapshot)(registry.fills, {
32
+ sync: true
33
+ }); // The important bit here is that this call ensures that the hook
34
+ // only causes a re-render if the "fills" of a given slot name
35
+ // change change, not any fills.
36
+
37
+ return fills.get(name);
38
+ }
39
+ //# sourceMappingURL=use-slot-fills.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/components/src/slot-fill/bubbles-virtually/use-slot-fills.js"],"names":["useSlotFills","name","registry","SlotFillContext","fills","sync","get"],"mappings":";;;;;;;;;AAIA;;AAKA;;AAKA;;AAdA;;AACA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;AAGe,SAASA,YAAT,CAAuBC,IAAvB,EAA8B;AAC5C,QAAMC,QAAQ,GAAG,yBAAYC,wBAAZ,CAAjB;AACA,QAAMC,KAAK,GAAG,yBAAaF,QAAQ,CAACE,KAAtB,EAA6B;AAAEC,IAAAA,IAAI,EAAE;AAAR,GAA7B,CAAd,CAF4C,CAG5C;AACA;AACA;;AACA,SAAOD,KAAK,CAACE,GAAN,CAAWL,IAAX,CAAP;AACA","sourcesContent":["// @ts-nocheck\n/**\n * External dependencies\n */\nimport { useSnapshot } from 'valtio';\n\n/**\n * WordPress dependencies\n */\nimport { useContext } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport SlotFillContext from './slot-fill-context';\n\nexport default function useSlotFills( name ) {\n\tconst registry = useContext( SlotFillContext );\n\tconst fills = useSnapshot( registry.fills, { sync: true } );\n\t// The important bit here is that this call ensures that the hook\n\t// only causes a re-render if the \"fills\" of a given slot name\n\t// change change, not any fills.\n\treturn fills.get( name );\n}\n"]}
@@ -7,12 +7,18 @@ Object.defineProperty(exports, "__esModule", {
7
7
  });
8
8
  exports.default = useSlot;
9
9
 
10
+ var _valtio = require("valtio");
11
+
10
12
  var _element = require("@wordpress/element");
11
13
 
12
14
  var _slotFillContext = _interopRequireDefault(require("./slot-fill-context"));
13
15
 
14
16
  // @ts-nocheck
15
17
 
18
+ /**
19
+ * External dependencies
20
+ */
21
+
16
22
  /**
17
23
  * WordPress dependencies
18
24
  */
@@ -22,9 +28,13 @@ var _slotFillContext = _interopRequireDefault(require("./slot-fill-context"));
22
28
  */
23
29
  function useSlot(name) {
24
30
  const registry = (0, _element.useContext)(_slotFillContext.default);
25
- const slot = registry.slots[name] || {};
26
- const slotFills = registry.fills[name];
27
- const fills = (0, _element.useMemo)(() => slotFills || [], [slotFills]);
31
+ const slots = (0, _valtio.useSnapshot)(registry.slots, {
32
+ sync: true
33
+ }); // The important bit here is that this call ensures
34
+ // the hook only causes a re-render if the slot
35
+ // with the given name change, not any other slot.
36
+
37
+ const slot = slots.get(name);
28
38
  const updateSlot = (0, _element.useCallback)(fillProps => {
29
39
  registry.updateSlot(name, fillProps);
30
40
  }, [name, registry.updateSlot]);
@@ -40,7 +50,6 @@ function useSlot(name) {
40
50
  return { ...slot,
41
51
  updateSlot,
42
52
  unregisterSlot,
43
- fills,
44
53
  registerFill,
45
54
  unregisterFill
46
55
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/slot-fill/bubbles-virtually/use-slot.js"],"names":["useSlot","name","registry","SlotFillContext","slot","slots","slotFills","fills","updateSlot","fillProps","unregisterSlot","slotRef","registerFill","fillRef","unregisterFill"],"mappings":";;;;;;;;;AAIA;;AAKA;;AATA;;AACA;AACA;AACA;;AAGA;AACA;AACA;AAGe,SAASA,OAAT,CAAkBC,IAAlB,EAAyB;AACvC,QAAMC,QAAQ,GAAG,yBAAYC,wBAAZ,CAAjB;AAEA,QAAMC,IAAI,GAAGF,QAAQ,CAACG,KAAT,CAAgBJ,IAAhB,KAA0B,EAAvC;AACA,QAAMK,SAAS,GAAGJ,QAAQ,CAACK,KAAT,CAAgBN,IAAhB,CAAlB;AACA,QAAMM,KAAK,GAAG,sBAAS,MAAMD,SAAS,IAAI,EAA5B,EAAgC,CAAEA,SAAF,CAAhC,CAAd;AAEA,QAAME,UAAU,GAAG,0BAChBC,SAAF,IAAiB;AAChBP,IAAAA,QAAQ,CAACM,UAAT,CAAqBP,IAArB,EAA2BQ,SAA3B;AACA,GAHiB,EAIlB,CAAER,IAAF,EAAQC,QAAQ,CAACM,UAAjB,CAJkB,CAAnB;AAOA,QAAME,cAAc,GAAG,0BACpBC,OAAF,IAAe;AACdT,IAAAA,QAAQ,CAACQ,cAAT,CAAyBT,IAAzB,EAA+BU,OAA/B;AACA,GAHqB,EAItB,CAAEV,IAAF,EAAQC,QAAQ,CAACQ,cAAjB,CAJsB,CAAvB;AAOA,QAAME,YAAY,GAAG,0BAClBC,OAAF,IAAe;AACdX,IAAAA,QAAQ,CAACU,YAAT,CAAuBX,IAAvB,EAA6BY,OAA7B;AACA,GAHmB,EAIpB,CAAEZ,IAAF,EAAQC,QAAQ,CAACU,YAAjB,CAJoB,CAArB;AAOA,QAAME,cAAc,GAAG,0BACpBD,OAAF,IAAe;AACdX,IAAAA,QAAQ,CAACY,cAAT,CAAyBb,IAAzB,EAA+BY,OAA/B;AACA,GAHqB,EAItB,CAAEZ,IAAF,EAAQC,QAAQ,CAACY,cAAjB,CAJsB,CAAvB;AAOA,SAAO,EACN,GAAGV,IADG;AAENI,IAAAA,UAFM;AAGNE,IAAAA,cAHM;AAINH,IAAAA,KAJM;AAKNK,IAAAA,YALM;AAMNE,IAAAA;AANM,GAAP;AAQA","sourcesContent":["// @ts-nocheck\n/**\n * WordPress dependencies\n */\nimport { useCallback, useContext, useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport SlotFillContext from './slot-fill-context';\n\nexport default function useSlot( name ) {\n\tconst registry = useContext( SlotFillContext );\n\n\tconst slot = registry.slots[ name ] || {};\n\tconst slotFills = registry.fills[ name ];\n\tconst fills = useMemo( () => slotFills || [], [ slotFills ] );\n\n\tconst updateSlot = useCallback(\n\t\t( fillProps ) => {\n\t\t\tregistry.updateSlot( name, fillProps );\n\t\t},\n\t\t[ name, registry.updateSlot ]\n\t);\n\n\tconst unregisterSlot = useCallback(\n\t\t( slotRef ) => {\n\t\t\tregistry.unregisterSlot( name, slotRef );\n\t\t},\n\t\t[ name, registry.unregisterSlot ]\n\t);\n\n\tconst registerFill = useCallback(\n\t\t( fillRef ) => {\n\t\t\tregistry.registerFill( name, fillRef );\n\t\t},\n\t\t[ name, registry.registerFill ]\n\t);\n\n\tconst unregisterFill = useCallback(\n\t\t( fillRef ) => {\n\t\t\tregistry.unregisterFill( name, fillRef );\n\t\t},\n\t\t[ name, registry.unregisterFill ]\n\t);\n\n\treturn {\n\t\t...slot,\n\t\tupdateSlot,\n\t\tunregisterSlot,\n\t\tfills,\n\t\tregisterFill,\n\t\tunregisterFill,\n\t};\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/slot-fill/bubbles-virtually/use-slot.js"],"names":["useSlot","name","registry","SlotFillContext","slots","sync","slot","get","updateSlot","fillProps","unregisterSlot","slotRef","registerFill","fillRef","unregisterFill"],"mappings":";;;;;;;;;AAIA;;AAKA;;AAKA;;AAdA;;AACA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;AAGe,SAASA,OAAT,CAAkBC,IAAlB,EAAyB;AACvC,QAAMC,QAAQ,GAAG,yBAAYC,wBAAZ,CAAjB;AACA,QAAMC,KAAK,GAAG,yBAAaF,QAAQ,CAACE,KAAtB,EAA6B;AAAEC,IAAAA,IAAI,EAAE;AAAR,GAA7B,CAAd,CAFuC,CAGvC;AACA;AACA;;AACA,QAAMC,IAAI,GAAGF,KAAK,CAACG,GAAN,CAAWN,IAAX,CAAb;AAEA,QAAMO,UAAU,GAAG,0BAChBC,SAAF,IAAiB;AAChBP,IAAAA,QAAQ,CAACM,UAAT,CAAqBP,IAArB,EAA2BQ,SAA3B;AACA,GAHiB,EAIlB,CAAER,IAAF,EAAQC,QAAQ,CAACM,UAAjB,CAJkB,CAAnB;AAOA,QAAME,cAAc,GAAG,0BACpBC,OAAF,IAAe;AACdT,IAAAA,QAAQ,CAACQ,cAAT,CAAyBT,IAAzB,EAA+BU,OAA/B;AACA,GAHqB,EAItB,CAAEV,IAAF,EAAQC,QAAQ,CAACQ,cAAjB,CAJsB,CAAvB;AAOA,QAAME,YAAY,GAAG,0BAClBC,OAAF,IAAe;AACdX,IAAAA,QAAQ,CAACU,YAAT,CAAuBX,IAAvB,EAA6BY,OAA7B;AACA,GAHmB,EAIpB,CAAEZ,IAAF,EAAQC,QAAQ,CAACU,YAAjB,CAJoB,CAArB;AAOA,QAAME,cAAc,GAAG,0BACpBD,OAAF,IAAe;AACdX,IAAAA,QAAQ,CAACY,cAAT,CAAyBb,IAAzB,EAA+BY,OAA/B;AACA,GAHqB,EAItB,CAAEZ,IAAF,EAAQC,QAAQ,CAACY,cAAjB,CAJsB,CAAvB;AAOA,SAAO,EACN,GAAGR,IADG;AAENE,IAAAA,UAFM;AAGNE,IAAAA,cAHM;AAINE,IAAAA,YAJM;AAKNE,IAAAA;AALM,GAAP;AAOA","sourcesContent":["// @ts-nocheck\n/**\n * External dependencies\n */\nimport { useSnapshot } from 'valtio';\n\n/**\n * WordPress dependencies\n */\nimport { useCallback, useContext } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport SlotFillContext from './slot-fill-context';\n\nexport default function useSlot( name ) {\n\tconst registry = useContext( SlotFillContext );\n\tconst slots = useSnapshot( registry.slots, { sync: true } );\n\t// The important bit here is that this call ensures\n\t// the hook only causes a re-render if the slot\n\t// with the given name change, not any other slot.\n\tconst slot = slots.get( name );\n\n\tconst updateSlot = useCallback(\n\t\t( fillProps ) => {\n\t\t\tregistry.updateSlot( name, fillProps );\n\t\t},\n\t\t[ name, registry.updateSlot ]\n\t);\n\n\tconst unregisterSlot = useCallback(\n\t\t( slotRef ) => {\n\t\t\tregistry.unregisterSlot( name, slotRef );\n\t\t},\n\t\t[ name, registry.unregisterSlot ]\n\t);\n\n\tconst registerFill = useCallback(\n\t\t( fillRef ) => {\n\t\t\tregistry.registerFill( name, fillRef );\n\t\t},\n\t\t[ name, registry.registerFill ]\n\t);\n\n\tconst unregisterFill = useCallback(\n\t\t( fillRef ) => {\n\t\t\tregistry.unregisterFill( name, fillRef );\n\t\t},\n\t\t[ name, registry.unregisterFill ]\n\t);\n\n\treturn {\n\t\t...slot,\n\t\tupdateSlot,\n\t\tunregisterSlot,\n\t\tregisterFill,\n\t\tunregisterFill,\n\t};\n}\n"]}
@@ -15,6 +15,12 @@ Object.defineProperty(exports, "useSlot", {
15
15
  return _useSlot.default;
16
16
  }
17
17
  });
18
+ Object.defineProperty(exports, "useSlotFills", {
19
+ enumerable: true,
20
+ get: function () {
21
+ return _useSlotFills.default;
22
+ }
23
+ });
18
24
 
19
25
  var _element = require("@wordpress/element");
20
26
 
@@ -34,6 +40,8 @@ var _provider = _interopRequireDefault(require("./provider"));
34
40
 
35
41
  var _useSlot = _interopRequireDefault(require("./bubbles-virtually/use-slot"));
36
42
 
43
+ var _useSlotFills = _interopRequireDefault(require("./bubbles-virtually/use-slot-fills"));
44
+
37
45
  // @ts-nocheck
38
46
 
39
47
  /**
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/slot-fill/index.js"],"names":["Fill","props","Slot","ref","bubblesVirtually","Provider","children","createSlotFill","name","FillComponent","displayName","SlotComponent","__unstableName"],"mappings":";;;;;;;;;;;;;;;;;;AAIA;;;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAfA;;AACA;AACA;AACA;;AAGA;AACA;AACA;AASO,SAASA,IAAT,CAAeC,KAAf,EAAuB;AAC7B;AACA;AACA;AACA,SACC,qDACC,4BAAC,aAAD,EAAeA,KAAf,CADD,EAEC,4BAAC,cAAD,EAA2BA,KAA3B,CAFD,CADD;AAMA;;AACM,MAAMC,IAAI,GAAG,yBAAY,OAAkCC,GAAlC,KAA2C;AAAA,MAAzC;AAAEC,IAAAA,gBAAF;AAAoB,OAAGH;AAAvB,GAAyC;;AAC1E,MAAKG,gBAAL,EAAwB;AACvB,WAAO,4BAAC,cAAD,6BAA2BH,KAA3B;AAAmC,MAAA,GAAG,EAAGE;AAAzC,OAAP;AACA;;AACD,SAAO,4BAAC,aAAD,EAAeF,KAAf,CAAP;AACA,CALmB,CAAb;;;AAOA,SAASI,QAAT,QAA4C;AAAA,MAAzB;AAAEC,IAAAA,QAAF;AAAY,OAAGL;AAAf,GAAyB;AAClD,SACC,4BAAC,iBAAD,EAAuBA,KAAvB,EACC,4BAAC,yBAAD,QACGK,QADH,CADD,CADD;AAOA;;AAEM,SAASC,cAAT,CAAyBC,IAAzB,EAAgC;AACtC,QAAMC,aAAa,GAAKR,KAAF,IAAa,4BAAC,IAAD;AAAM,IAAA,IAAI,EAAGO;AAAb,KAAyBP,KAAzB,EAAnC;;AACAQ,EAAAA,aAAa,CAACC,WAAd,GAA4BF,IAAI,GAAG,MAAnC;;AAEA,QAAMG,aAAa,GAAKV,KAAF,IAAa,4BAAC,IAAD;AAAM,IAAA,IAAI,EAAGO;AAAb,KAAyBP,KAAzB,EAAnC;;AACAU,EAAAA,aAAa,CAACD,WAAd,GAA4BF,IAAI,GAAG,MAAnC;AACAG,EAAAA,aAAa,CAACC,cAAd,GAA+BJ,IAA/B;AAEA,SAAO;AACNR,IAAAA,IAAI,EAAES,aADA;AAENP,IAAAA,IAAI,EAAES;AAFA,GAAP;AAIA","sourcesContent":["// @ts-nocheck\n/**\n * WordPress dependencies\n */\nimport { forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport BaseFill from './fill';\nimport BaseSlot from './slot';\nimport BubblesVirtuallyFill from './bubbles-virtually/fill';\nimport BubblesVirtuallySlot from './bubbles-virtually/slot';\nimport BubblesVirtuallySlotFillProvider from './bubbles-virtually/slot-fill-provider';\nimport SlotFillProvider from './provider';\nimport useSlot from './bubbles-virtually/use-slot';\n\nexport function Fill( props ) {\n\t// We're adding both Fills here so they can register themselves before\n\t// their respective slot has been registered. Only the Fill that has a slot\n\t// will render. The other one will return null.\n\treturn (\n\t\t<>\n\t\t\t<BaseFill { ...props } />\n\t\t\t<BubblesVirtuallyFill { ...props } />\n\t\t</>\n\t);\n}\nexport const Slot = forwardRef( ( { bubblesVirtually, ...props }, ref ) => {\n\tif ( bubblesVirtually ) {\n\t\treturn <BubblesVirtuallySlot { ...props } ref={ ref } />;\n\t}\n\treturn <BaseSlot { ...props } />;\n} );\n\nexport function Provider( { children, ...props } ) {\n\treturn (\n\t\t<SlotFillProvider { ...props }>\n\t\t\t<BubblesVirtuallySlotFillProvider>\n\t\t\t\t{ children }\n\t\t\t</BubblesVirtuallySlotFillProvider>\n\t\t</SlotFillProvider>\n\t);\n}\n\nexport function createSlotFill( name ) {\n\tconst FillComponent = ( props ) => <Fill name={ name } { ...props } />;\n\tFillComponent.displayName = name + 'Fill';\n\n\tconst SlotComponent = ( props ) => <Slot name={ name } { ...props } />;\n\tSlotComponent.displayName = name + 'Slot';\n\tSlotComponent.__unstableName = name;\n\n\treturn {\n\t\tFill: FillComponent,\n\t\tSlot: SlotComponent,\n\t};\n}\n\nexport { useSlot };\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/slot-fill/index.js"],"names":["Fill","props","Slot","ref","bubblesVirtually","Provider","children","createSlotFill","name","FillComponent","displayName","SlotComponent","__unstableName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAIA;;;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAhBA;;AACA;AACA;AACA;;AAGA;AACA;AACA;AAUO,SAASA,IAAT,CAAeC,KAAf,EAAuB;AAC7B;AACA;AACA;AACA,SACC,qDACC,4BAAC,aAAD,EAAeA,KAAf,CADD,EAEC,4BAAC,cAAD,EAA2BA,KAA3B,CAFD,CADD;AAMA;;AACM,MAAMC,IAAI,GAAG,yBAAY,OAAkCC,GAAlC,KAA2C;AAAA,MAAzC;AAAEC,IAAAA,gBAAF;AAAoB,OAAGH;AAAvB,GAAyC;;AAC1E,MAAKG,gBAAL,EAAwB;AACvB,WAAO,4BAAC,cAAD,6BAA2BH,KAA3B;AAAmC,MAAA,GAAG,EAAGE;AAAzC,OAAP;AACA;;AACD,SAAO,4BAAC,aAAD,EAAeF,KAAf,CAAP;AACA,CALmB,CAAb;;;AAOA,SAASI,QAAT,QAA4C;AAAA,MAAzB;AAAEC,IAAAA,QAAF;AAAY,OAAGL;AAAf,GAAyB;AAClD,SACC,4BAAC,iBAAD,EAAuBA,KAAvB,EACC,4BAAC,yBAAD,QACGK,QADH,CADD,CADD;AAOA;;AAEM,SAASC,cAAT,CAAyBC,IAAzB,EAAgC;AACtC,QAAMC,aAAa,GAAKR,KAAF,IAAa,4BAAC,IAAD;AAAM,IAAA,IAAI,EAAGO;AAAb,KAAyBP,KAAzB,EAAnC;;AACAQ,EAAAA,aAAa,CAACC,WAAd,GAA4BF,IAAI,GAAG,MAAnC;;AAEA,QAAMG,aAAa,GAAKV,KAAF,IAAa,4BAAC,IAAD;AAAM,IAAA,IAAI,EAAGO;AAAb,KAAyBP,KAAzB,EAAnC;;AACAU,EAAAA,aAAa,CAACD,WAAd,GAA4BF,IAAI,GAAG,MAAnC;AACAG,EAAAA,aAAa,CAACC,cAAd,GAA+BJ,IAA/B;AAEA,SAAO;AACNR,IAAAA,IAAI,EAAES,aADA;AAENP,IAAAA,IAAI,EAAES;AAFA,GAAP;AAIA","sourcesContent":["// @ts-nocheck\n/**\n * WordPress dependencies\n */\nimport { forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport BaseFill from './fill';\nimport BaseSlot from './slot';\nimport BubblesVirtuallyFill from './bubbles-virtually/fill';\nimport BubblesVirtuallySlot from './bubbles-virtually/slot';\nimport BubblesVirtuallySlotFillProvider from './bubbles-virtually/slot-fill-provider';\nimport SlotFillProvider from './provider';\nimport useSlot from './bubbles-virtually/use-slot';\nexport { default as useSlotFills } from './bubbles-virtually/use-slot-fills';\n\nexport function Fill( props ) {\n\t// We're adding both Fills here so they can register themselves before\n\t// their respective slot has been registered. Only the Fill that has a slot\n\t// will render. The other one will return null.\n\treturn (\n\t\t<>\n\t\t\t<BaseFill { ...props } />\n\t\t\t<BubblesVirtuallyFill { ...props } />\n\t\t</>\n\t);\n}\nexport const Slot = forwardRef( ( { bubblesVirtually, ...props }, ref ) => {\n\tif ( bubblesVirtually ) {\n\t\treturn <BubblesVirtuallySlot { ...props } ref={ ref } />;\n\t}\n\treturn <BaseSlot { ...props } />;\n} );\n\nexport function Provider( { children, ...props } ) {\n\treturn (\n\t\t<SlotFillProvider { ...props }>\n\t\t\t<BubblesVirtuallySlotFillProvider>\n\t\t\t\t{ children }\n\t\t\t</BubblesVirtuallySlotFillProvider>\n\t\t</SlotFillProvider>\n\t);\n}\n\nexport function createSlotFill( name ) {\n\tconst FillComponent = ( props ) => <Fill name={ name } { ...props } />;\n\tFillComponent.displayName = name + 'Fill';\n\n\tconst SlotComponent = ( props ) => <Slot name={ name } { ...props } />;\n\tSlotComponent.displayName = name + 'Slot';\n\tSlotComponent.__unstableName = name;\n\n\treturn {\n\t\tFill: FillComponent,\n\t\tSlot: SlotComponent,\n\t};\n}\n\nexport { useSlot };\n"]}