@wordpress/editor 14.40.2-next.v.202602241322.0 → 14.40.2

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 (464) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/build/components/collab-sidebar/index.cjs +7 -4
  3. package/build/components/collab-sidebar/index.cjs.map +2 -2
  4. package/build/components/collab-sidebar/utils.cjs +13 -15
  5. package/build/components/collab-sidebar/utils.cjs.map +2 -2
  6. package/build/components/collaborators-overlay/avatar-iframe-styles.cjs +141 -0
  7. package/build/components/collaborators-overlay/avatar-iframe-styles.cjs.map +7 -0
  8. package/build/components/collaborators-overlay/collaborator-styles.cjs +38 -2
  9. package/build/components/collaborators-overlay/collaborator-styles.cjs.map +2 -2
  10. package/build/components/collaborators-overlay/compute-selection.cjs +185 -0
  11. package/build/components/collaborators-overlay/compute-selection.cjs.map +7 -0
  12. package/build/components/collaborators-overlay/cursor-dom-utils.cjs +243 -0
  13. package/build/components/collaborators-overlay/cursor-dom-utils.cjs.map +7 -0
  14. package/build/components/collaborators-overlay/cursor-registry.cjs +86 -0
  15. package/build/components/collaborators-overlay/cursor-registry.cjs.map +7 -0
  16. package/build/components/collaborators-overlay/index.cjs +7 -2
  17. package/build/components/collaborators-overlay/index.cjs.map +2 -2
  18. package/build/components/collaborators-overlay/overlay-iframe-styles.cjs +148 -0
  19. package/build/components/collaborators-overlay/overlay-iframe-styles.cjs.map +7 -0
  20. package/build/components/collaborators-overlay/overlay.cjs +146 -236
  21. package/build/components/collaborators-overlay/overlay.cjs.map +3 -3
  22. package/build/components/collaborators-overlay/timing-utils.cjs +46 -0
  23. package/build/components/collaborators-overlay/timing-utils.cjs.map +7 -0
  24. package/build/components/collaborators-overlay/use-block-highlighting.cjs +91 -42
  25. package/build/components/collaborators-overlay/use-block-highlighting.cjs.map +2 -2
  26. package/build/components/collaborators-overlay/use-debounced-recompute.cjs +49 -0
  27. package/build/components/collaborators-overlay/use-debounced-recompute.cjs.map +7 -0
  28. package/build/components/collaborators-overlay/use-render-cursors.cjs +82 -172
  29. package/build/components/collaborators-overlay/use-render-cursors.cjs.map +3 -3
  30. package/build/components/collaborators-presence/avatar/component.cjs +121 -0
  31. package/build/components/collaborators-presence/avatar/component.cjs.map +7 -0
  32. package/build/components/collaborators-presence/avatar/index.cjs +37 -0
  33. package/build/components/collaborators-presence/avatar/index.cjs.map +7 -0
  34. package/build/components/collaborators-presence/avatar/types.cjs +19 -0
  35. package/build/components/collaborators-presence/avatar/types.cjs.map +7 -0
  36. package/build/components/collaborators-presence/avatar/use-image-loading-status.cjs +44 -0
  37. package/build/components/collaborators-presence/avatar/use-image-loading-status.cjs.map +7 -0
  38. package/build/components/collaborators-presence/avatar-group/component.cjs +78 -0
  39. package/build/components/collaborators-presence/avatar-group/component.cjs.map +7 -0
  40. package/build/components/collaborators-presence/avatar-group/index.cjs +37 -0
  41. package/build/components/collaborators-presence/avatar-group/index.cjs.map +7 -0
  42. package/build/components/collaborators-presence/avatar-group/types.cjs +19 -0
  43. package/build/components/collaborators-presence/avatar-group/types.cjs.map +7 -0
  44. package/build/components/collaborators-presence/index.cjs +66 -19
  45. package/build/components/collaborators-presence/index.cjs.map +3 -3
  46. package/build/components/collaborators-presence/list.cjs +60 -38
  47. package/build/components/collaborators-presence/list.cjs.map +3 -3
  48. package/build/components/collaborators-presence/use-collaborator-notifications.cjs +149 -0
  49. package/build/components/collaborators-presence/use-collaborator-notifications.cjs.map +7 -0
  50. package/build/components/editor-interface/index.cjs +11 -6
  51. package/build/components/editor-interface/index.cjs.map +2 -2
  52. package/build/components/inserter-sidebar/index.cjs +2 -1
  53. package/build/components/inserter-sidebar/index.cjs.map +2 -2
  54. package/build/components/post-last-revision/index.cjs +27 -6
  55. package/build/components/post-last-revision/index.cjs.map +2 -2
  56. package/build/components/post-locked-modal/index.cjs +49 -17
  57. package/build/components/post-locked-modal/index.cjs.map +3 -3
  58. package/build/components/post-revisions-preview/block-diff.cjs +130 -34
  59. package/build/components/post-revisions-preview/block-diff.cjs.map +2 -2
  60. package/build/components/post-revisions-preview/diff-markers.cjs +6 -5
  61. package/build/components/post-revisions-preview/diff-markers.cjs.map +2 -2
  62. package/build/components/post-revisions-preview/revisions-canvas.cjs +16 -60
  63. package/build/components/post-revisions-preview/revisions-canvas.cjs.map +3 -3
  64. package/build/components/post-revisions-preview/revisions-header.cjs +33 -26
  65. package/build/components/post-revisions-preview/revisions-header.cjs.map +3 -3
  66. package/build/components/post-revisions-preview/revisions-slider.cjs +104 -39
  67. package/build/components/post-revisions-preview/revisions-slider.cjs.map +3 -3
  68. package/build/components/preferences-modal/index.cjs +36 -4
  69. package/build/components/preferences-modal/index.cjs.map +2 -2
  70. package/build/components/provider/disable-non-page-content-blocks.cjs +31 -28
  71. package/build/components/provider/disable-non-page-content-blocks.cjs.map +3 -3
  72. package/build/components/provider/index.cjs +17 -5
  73. package/build/components/provider/index.cjs.map +2 -2
  74. package/build/components/provider/use-block-editor-settings.cjs +20 -4
  75. package/build/components/provider/use-block-editor-settings.cjs.map +3 -3
  76. package/build/components/provider/{use-post-content-blocks.cjs → use-post-content-block-types.cjs} +8 -19
  77. package/build/components/provider/use-post-content-block-types.cjs.map +7 -0
  78. package/build/components/provider/use-revision-blocks.cjs +106 -0
  79. package/build/components/provider/use-revision-blocks.cjs.map +7 -0
  80. package/build/components/revision-block-diff/index.cjs +61 -0
  81. package/build/components/revision-block-diff/index.cjs.map +7 -0
  82. package/build/components/revision-diff-panel/index.cjs +68 -0
  83. package/build/components/revision-diff-panel/index.cjs.map +7 -0
  84. package/build/components/revision-fields-diff/index.cjs +96 -0
  85. package/build/components/revision-fields-diff/index.cjs.map +7 -0
  86. package/build/components/sidebar/header.cjs +1 -1
  87. package/build/components/sidebar/header.cjs.map +2 -2
  88. package/build/components/sidebar/index.cjs +7 -1
  89. package/build/components/sidebar/index.cjs.map +3 -3
  90. package/build/components/style-book/index.cjs +4 -3
  91. package/build/components/style-book/index.cjs.map +2 -2
  92. package/build/components/sync-connection-error-modal/index.cjs +187 -0
  93. package/build/components/sync-connection-error-modal/index.cjs.map +7 -0
  94. package/build/components/sync-connection-error-modal/use-retry-countdown.cjs +84 -0
  95. package/build/components/sync-connection-error-modal/use-retry-countdown.cjs.map +7 -0
  96. package/build/components/template-content-panel/index.cjs +35 -31
  97. package/build/components/template-content-panel/index.cjs.map +3 -3
  98. package/build/components/template-part-menu-items/convert-to-regular.cjs +54 -11
  99. package/build/components/template-part-menu-items/convert-to-regular.cjs.map +3 -3
  100. package/build/components/visual-editor/index.cjs +6 -15
  101. package/build/components/visual-editor/index.cjs.map +2 -2
  102. package/build/store/private-actions.cjs +46 -2
  103. package/build/store/private-actions.cjs.map +2 -2
  104. package/build/store/private-selectors.cjs +156 -21
  105. package/build/store/private-selectors.cjs.map +2 -2
  106. package/build/store/reducer.cjs +27 -0
  107. package/build/store/reducer.cjs.map +2 -2
  108. package/build/store/selectors.cjs +0 -14
  109. package/build/store/selectors.cjs.map +2 -2
  110. package/build/utils/media-finalize/index.cjs +43 -0
  111. package/build/utils/media-finalize/index.cjs.map +7 -0
  112. package/build/utils/media-upload/on-success.cjs +46 -0
  113. package/build/utils/media-upload/on-success.cjs.map +7 -0
  114. package/build/utils/sync-error-messages.cjs +32 -15
  115. package/build/utils/sync-error-messages.cjs.map +3 -3
  116. package/build-module/components/collab-sidebar/index.mjs +7 -4
  117. package/build-module/components/collab-sidebar/index.mjs.map +2 -2
  118. package/build-module/components/collab-sidebar/utils.mjs +13 -15
  119. package/build-module/components/collab-sidebar/utils.mjs.map +2 -2
  120. package/build-module/components/collaborators-overlay/avatar-iframe-styles.mjs +128 -0
  121. package/build-module/components/collaborators-overlay/avatar-iframe-styles.mjs.map +7 -0
  122. package/build-module/components/collaborators-overlay/collaborator-styles.mjs +25 -1
  123. package/build-module/components/collaborators-overlay/collaborator-styles.mjs.map +2 -2
  124. package/build-module/components/collaborators-overlay/compute-selection.mjs +166 -0
  125. package/build-module/components/collaborators-overlay/compute-selection.mjs.map +7 -0
  126. package/build-module/components/collaborators-overlay/cursor-dom-utils.mjs +213 -0
  127. package/build-module/components/collaborators-overlay/cursor-dom-utils.mjs.map +7 -0
  128. package/build-module/components/collaborators-overlay/cursor-registry.mjs +61 -0
  129. package/build-module/components/collaborators-overlay/cursor-registry.mjs.map +7 -0
  130. package/build-module/components/collaborators-overlay/index.mjs +7 -2
  131. package/build-module/components/collaborators-overlay/index.mjs.map +2 -2
  132. package/build-module/components/collaborators-overlay/overlay-iframe-styles.mjs +130 -0
  133. package/build-module/components/collaborators-overlay/overlay-iframe-styles.mjs.map +7 -0
  134. package/build-module/components/collaborators-overlay/overlay.mjs +137 -237
  135. package/build-module/components/collaborators-overlay/overlay.mjs.map +2 -2
  136. package/build-module/components/collaborators-overlay/timing-utils.mjs +21 -0
  137. package/build-module/components/collaborators-overlay/timing-utils.mjs.map +7 -0
  138. package/build-module/components/collaborators-overlay/use-block-highlighting.mjs +93 -45
  139. package/build-module/components/collaborators-overlay/use-block-highlighting.mjs.map +2 -2
  140. package/build-module/components/collaborators-overlay/use-debounced-recompute.mjs +24 -0
  141. package/build-module/components/collaborators-overlay/use-debounced-recompute.mjs.map +7 -0
  142. package/build-module/components/collaborators-overlay/use-render-cursors.mjs +83 -176
  143. package/build-module/components/collaborators-overlay/use-render-cursors.mjs.map +2 -2
  144. package/build-module/components/collaborators-presence/avatar/component.mjs +90 -0
  145. package/build-module/components/collaborators-presence/avatar/component.mjs.map +7 -0
  146. package/build-module/components/collaborators-presence/avatar/index.mjs +6 -0
  147. package/build-module/components/collaborators-presence/avatar/index.mjs.map +7 -0
  148. package/build-module/components/collaborators-presence/avatar/types.mjs +1 -0
  149. package/build-module/components/collaborators-presence/avatar/types.mjs.map +7 -0
  150. package/build-module/components/collaborators-presence/avatar/use-image-loading-status.mjs +19 -0
  151. package/build-module/components/collaborators-presence/avatar/use-image-loading-status.mjs.map +7 -0
  152. package/build-module/components/collaborators-presence/avatar-group/component.mjs +47 -0
  153. package/build-module/components/collaborators-presence/avatar-group/component.mjs.map +7 -0
  154. package/build-module/components/collaborators-presence/avatar-group/index.mjs +6 -0
  155. package/build-module/components/collaborators-presence/avatar-group/index.mjs.map +7 -0
  156. package/build-module/components/collaborators-presence/avatar-group/types.mjs +1 -0
  157. package/build-module/components/collaborators-presence/avatar-group/types.mjs.map +7 -0
  158. package/build-module/components/collaborators-presence/index.mjs +57 -23
  159. package/build-module/components/collaborators-presence/index.mjs.map +2 -2
  160. package/build-module/components/collaborators-presence/list.mjs +52 -44
  161. package/build-module/components/collaborators-presence/list.mjs.map +2 -2
  162. package/build-module/components/collaborators-presence/use-collaborator-notifications.mjs +126 -0
  163. package/build-module/components/collaborators-presence/use-collaborator-notifications.mjs.map +7 -0
  164. package/build-module/components/editor-interface/index.mjs +12 -7
  165. package/build-module/components/editor-interface/index.mjs.map +2 -2
  166. package/build-module/components/inserter-sidebar/index.mjs +2 -1
  167. package/build-module/components/inserter-sidebar/index.mjs.map +2 -2
  168. package/build-module/components/post-last-revision/index.mjs +27 -6
  169. package/build-module/components/post-last-revision/index.mjs.map +2 -2
  170. package/build-module/components/post-locked-modal/index.mjs +49 -17
  171. package/build-module/components/post-locked-modal/index.mjs.map +2 -2
  172. package/build-module/components/post-revisions-preview/block-diff.mjs +130 -34
  173. package/build-module/components/post-revisions-preview/block-diff.mjs.map +2 -2
  174. package/build-module/components/post-revisions-preview/diff-markers.mjs +6 -5
  175. package/build-module/components/post-revisions-preview/diff-markers.mjs.map +2 -2
  176. package/build-module/components/post-revisions-preview/revisions-canvas.mjs +18 -65
  177. package/build-module/components/post-revisions-preview/revisions-canvas.mjs.map +2 -2
  178. package/build-module/components/post-revisions-preview/revisions-header.mjs +36 -33
  179. package/build-module/components/post-revisions-preview/revisions-header.mjs.map +2 -2
  180. package/build-module/components/post-revisions-preview/revisions-slider.mjs +112 -42
  181. package/build-module/components/post-revisions-preview/revisions-slider.mjs.map +2 -2
  182. package/build-module/components/preferences-modal/index.mjs +36 -4
  183. package/build-module/components/preferences-modal/index.mjs.map +2 -2
  184. package/build-module/components/provider/disable-non-page-content-blocks.mjs +31 -28
  185. package/build-module/components/provider/disable-non-page-content-blocks.mjs.map +2 -2
  186. package/build-module/components/provider/index.mjs +17 -5
  187. package/build-module/components/provider/index.mjs.map +2 -2
  188. package/build-module/components/provider/use-block-editor-settings.mjs +20 -4
  189. package/build-module/components/provider/use-block-editor-settings.mjs.map +2 -2
  190. package/build-module/components/provider/use-post-content-block-types.mjs +23 -0
  191. package/build-module/components/provider/use-post-content-block-types.mjs.map +7 -0
  192. package/build-module/components/provider/use-revision-blocks.mjs +81 -0
  193. package/build-module/components/provider/use-revision-blocks.mjs.map +7 -0
  194. package/build-module/components/revision-block-diff/index.mjs +30 -0
  195. package/build-module/components/revision-block-diff/index.mjs.map +7 -0
  196. package/build-module/components/revision-diff-panel/index.mjs +37 -0
  197. package/build-module/components/revision-diff-panel/index.mjs.map +7 -0
  198. package/build-module/components/revision-fields-diff/index.mjs +65 -0
  199. package/build-module/components/revision-fields-diff/index.mjs.map +7 -0
  200. package/build-module/components/sidebar/header.mjs +1 -1
  201. package/build-module/components/sidebar/header.mjs.map +2 -2
  202. package/build-module/components/sidebar/index.mjs +7 -1
  203. package/build-module/components/sidebar/index.mjs.map +2 -2
  204. package/build-module/components/style-book/index.mjs +4 -3
  205. package/build-module/components/style-book/index.mjs.map +2 -2
  206. package/build-module/components/sync-connection-error-modal/index.mjs +170 -0
  207. package/build-module/components/sync-connection-error-modal/index.mjs.map +7 -0
  208. package/build-module/components/sync-connection-error-modal/use-retry-countdown.mjs +59 -0
  209. package/build-module/components/sync-connection-error-modal/use-retry-countdown.mjs.map +7 -0
  210. package/build-module/components/template-content-panel/index.mjs +25 -31
  211. package/build-module/components/template-content-panel/index.mjs.map +2 -2
  212. package/build-module/components/template-part-menu-items/convert-to-regular.mjs +60 -14
  213. package/build-module/components/template-part-menu-items/convert-to-regular.mjs.map +2 -2
  214. package/build-module/components/visual-editor/index.mjs +6 -15
  215. package/build-module/components/visual-editor/index.mjs.map +2 -2
  216. package/build-module/store/private-actions.mjs +44 -2
  217. package/build-module/store/private-actions.mjs.map +2 -2
  218. package/build-module/store/private-selectors.mjs +155 -21
  219. package/build-module/store/private-selectors.mjs.map +2 -2
  220. package/build-module/store/reducer.mjs +25 -0
  221. package/build-module/store/reducer.mjs.map +2 -2
  222. package/build-module/store/selectors.mjs +0 -13
  223. package/build-module/store/selectors.mjs.map +2 -2
  224. package/build-module/utils/media-finalize/index.mjs +12 -0
  225. package/build-module/utils/media-finalize/index.mjs.map +7 -0
  226. package/build-module/utils/media-upload/on-success.mjs +25 -0
  227. package/build-module/utils/media-upload/on-success.mjs.map +7 -0
  228. package/build-module/utils/sync-error-messages.mjs +27 -15
  229. package/build-module/utils/sync-error-messages.mjs.map +3 -3
  230. package/build-style/style-rtl.css +388 -132
  231. package/build-style/style.css +388 -132
  232. package/build-types/components/autocompleters/link.d.ts +8 -0
  233. package/build-types/components/autocompleters/link.d.ts.map +1 -0
  234. package/build-types/components/collab-sidebar/add-note-menu-item.d.ts +5 -0
  235. package/build-types/components/collab-sidebar/add-note-menu-item.d.ts.map +1 -0
  236. package/build-types/components/collab-sidebar/add-note.d.ts +6 -0
  237. package/build-types/components/collab-sidebar/add-note.d.ts.map +1 -0
  238. package/build-types/components/collab-sidebar/board-store.d.ts +9 -0
  239. package/build-types/components/collab-sidebar/board-store.d.ts.map +1 -0
  240. package/build-types/components/collab-sidebar/floating-container.d.ts +8 -0
  241. package/build-types/components/collab-sidebar/floating-container.d.ts.map +1 -0
  242. package/build-types/components/collab-sidebar/index.d.ts.map +1 -1
  243. package/build-types/components/collab-sidebar/note-byline.d.ts +10 -0
  244. package/build-types/components/collab-sidebar/note-byline.d.ts.map +1 -0
  245. package/build-types/components/collab-sidebar/note-card.d.ts +8 -0
  246. package/build-types/components/collab-sidebar/note-card.d.ts.map +1 -0
  247. package/build-types/components/collab-sidebar/note-form.d.ts +7 -0
  248. package/build-types/components/collab-sidebar/note-form.d.ts.map +1 -0
  249. package/build-types/components/collab-sidebar/note-indicator-toolbar.d.ts +5 -0
  250. package/build-types/components/collab-sidebar/note-indicator-toolbar.d.ts.map +1 -0
  251. package/build-types/components/collab-sidebar/note-thread.d.ts +11 -0
  252. package/build-types/components/collab-sidebar/note-thread.d.ts.map +1 -0
  253. package/build-types/components/collab-sidebar/note.d.ts +9 -0
  254. package/build-types/components/collab-sidebar/note.d.ts.map +1 -0
  255. package/build-types/components/collab-sidebar/notes.d.ts +7 -0
  256. package/build-types/components/collab-sidebar/notes.d.ts.map +1 -0
  257. package/build-types/components/collab-sidebar/utils.d.ts.map +1 -1
  258. package/build-types/components/collaborators-overlay/avatar-iframe-styles.d.ts +11 -0
  259. package/build-types/components/collaborators-overlay/avatar-iframe-styles.d.ts.map +1 -0
  260. package/build-types/components/collaborators-overlay/collaborator-styles.d.ts +17 -2
  261. package/build-types/components/collaborators-overlay/collaborator-styles.d.ts.map +1 -1
  262. package/build-types/components/collaborators-overlay/compute-selection.d.ts +24 -0
  263. package/build-types/components/collaborators-overlay/compute-selection.d.ts.map +1 -0
  264. package/build-types/components/collaborators-overlay/cursor-dom-utils.d.ts +72 -0
  265. package/build-types/components/collaborators-overlay/cursor-dom-utils.d.ts.map +1 -0
  266. package/build-types/components/collaborators-overlay/cursor-registry.d.ts +36 -0
  267. package/build-types/components/collaborators-overlay/cursor-registry.d.ts.map +1 -0
  268. package/build-types/components/collaborators-overlay/index.d.ts +7 -4
  269. package/build-types/components/collaborators-overlay/index.d.ts.map +1 -1
  270. package/build-types/components/collaborators-overlay/overlay-iframe-styles.d.ts +6 -0
  271. package/build-types/components/collaborators-overlay/overlay-iframe-styles.d.ts.map +1 -0
  272. package/build-types/components/collaborators-overlay/overlay.d.ts +4 -1
  273. package/build-types/components/collaborators-overlay/overlay.d.ts.map +1 -1
  274. package/build-types/components/collaborators-overlay/timing-utils.d.ts +11 -0
  275. package/build-types/components/collaborators-overlay/timing-utils.d.ts.map +1 -0
  276. package/build-types/components/collaborators-overlay/use-block-highlighting.d.ts +21 -5
  277. package/build-types/components/collaborators-overlay/use-block-highlighting.d.ts.map +1 -1
  278. package/build-types/components/collaborators-overlay/use-debounced-recompute.d.ts +10 -0
  279. package/build-types/components/collaborators-overlay/use-debounced-recompute.d.ts.map +1 -0
  280. package/build-types/components/collaborators-overlay/use-render-cursors.d.ts +6 -1
  281. package/build-types/components/collaborators-overlay/use-render-cursors.d.ts.map +1 -1
  282. package/build-types/components/collaborators-presence/avatar/component.d.ts +7 -0
  283. package/build-types/components/collaborators-presence/avatar/component.d.ts.map +1 -0
  284. package/build-types/components/collaborators-presence/avatar/index.d.ts +3 -0
  285. package/build-types/components/collaborators-presence/avatar/index.d.ts.map +1 -0
  286. package/build-types/components/collaborators-presence/avatar/types.d.ts +66 -0
  287. package/build-types/components/collaborators-presence/avatar/types.d.ts.map +1 -0
  288. package/build-types/components/collaborators-presence/avatar/use-image-loading-status.d.ts +17 -0
  289. package/build-types/components/collaborators-presence/avatar/use-image-loading-status.d.ts.map +1 -0
  290. package/build-types/components/collaborators-presence/avatar-group/component.d.ts +7 -0
  291. package/build-types/components/collaborators-presence/avatar-group/component.d.ts.map +1 -0
  292. package/build-types/components/collaborators-presence/avatar-group/index.d.ts +3 -0
  293. package/build-types/components/collaborators-presence/avatar-group/index.d.ts.map +1 -0
  294. package/build-types/components/collaborators-presence/avatar-group/types.d.ts +14 -0
  295. package/build-types/components/collaborators-presence/avatar-group/types.d.ts.map +1 -0
  296. package/build-types/components/collaborators-presence/index.d.ts.map +1 -1
  297. package/build-types/components/collaborators-presence/list.d.ts +6 -2
  298. package/build-types/components/collaborators-presence/list.d.ts.map +1 -1
  299. package/build-types/components/collaborators-presence/use-collaborator-notifications.d.ts +9 -0
  300. package/build-types/components/collaborators-presence/use-collaborator-notifications.d.ts.map +1 -0
  301. package/build-types/components/editor-interface/index.d.ts.map +1 -1
  302. package/build-types/components/inserter-sidebar/index.d.ts.map +1 -1
  303. package/build-types/components/media/media-editor-modal.d.ts +15 -0
  304. package/build-types/components/media/media-editor-modal.d.ts.map +1 -0
  305. package/build-types/components/post-last-revision/index.d.ts.map +1 -1
  306. package/build-types/components/post-locked-modal/index.d.ts.map +1 -1
  307. package/build-types/components/post-revisions-panel/index.d.ts +2 -0
  308. package/build-types/components/post-revisions-panel/index.d.ts.map +1 -0
  309. package/build-types/components/post-revisions-preview/block-diff.d.ts.map +1 -1
  310. package/build-types/components/post-revisions-preview/diff-markers.d.ts.map +1 -1
  311. package/build-types/components/post-revisions-preview/revisions-canvas.d.ts +2 -5
  312. package/build-types/components/post-revisions-preview/revisions-canvas.d.ts.map +1 -1
  313. package/build-types/components/post-revisions-preview/revisions-header.d.ts.map +1 -1
  314. package/build-types/components/post-revisions-preview/revisions-slider.d.ts +1 -1
  315. package/build-types/components/post-revisions-preview/revisions-slider.d.ts.map +1 -1
  316. package/build-types/components/post-text-editor/utils.d.ts +29 -0
  317. package/build-types/components/post-text-editor/utils.d.ts.map +1 -0
  318. package/build-types/components/provider/disable-non-page-content-blocks.d.ts.map +1 -1
  319. package/build-types/components/provider/index.d.ts.map +1 -1
  320. package/build-types/components/provider/use-block-editor-settings.d.ts.map +1 -1
  321. package/build-types/components/provider/use-network-reconnect.d.ts +8 -0
  322. package/build-types/components/provider/use-network-reconnect.d.ts.map +1 -0
  323. package/build-types/components/provider/use-post-content-block-types.d.ts +9 -0
  324. package/build-types/components/provider/use-post-content-block-types.d.ts.map +1 -0
  325. package/build-types/components/provider/use-revision-blocks.d.ts +10 -0
  326. package/build-types/components/provider/use-revision-blocks.d.ts.map +1 -0
  327. package/build-types/components/revision-block-diff/index.d.ts +6 -0
  328. package/build-types/components/revision-block-diff/index.d.ts.map +1 -0
  329. package/build-types/components/revision-diff-panel/index.d.ts +14 -0
  330. package/build-types/components/revision-diff-panel/index.d.ts.map +1 -0
  331. package/build-types/components/revision-fields-diff/index.d.ts +6 -0
  332. package/build-types/components/revision-fields-diff/index.d.ts.map +1 -0
  333. package/build-types/components/sidebar/dataform-post-summary.d.ts +4 -0
  334. package/build-types/components/sidebar/dataform-post-summary.d.ts.map +1 -0
  335. package/build-types/components/sidebar/index.d.ts.map +1 -1
  336. package/build-types/components/sidebar/post-revision-summary.d.ts +2 -0
  337. package/build-types/components/sidebar/post-revision-summary.d.ts.map +1 -0
  338. package/build-types/components/style-book/index.d.ts +2 -1
  339. package/build-types/components/style-book/index.d.ts.map +1 -1
  340. package/build-types/components/sync-connection-error-modal/index.d.ts +8 -0
  341. package/build-types/components/sync-connection-error-modal/index.d.ts.map +1 -0
  342. package/build-types/components/sync-connection-error-modal/use-retry-countdown.d.ts +11 -0
  343. package/build-types/components/sync-connection-error-modal/use-retry-countdown.d.ts.map +1 -0
  344. package/build-types/components/template-actions-panel/block-theme-content.d.ts +2 -0
  345. package/build-types/components/template-actions-panel/block-theme-content.d.ts.map +1 -0
  346. package/build-types/components/template-actions-panel/classic-theme-content.d.ts +2 -0
  347. package/build-types/components/template-actions-panel/classic-theme-content.d.ts.map +1 -0
  348. package/build-types/components/template-actions-panel/index.d.ts +2 -0
  349. package/build-types/components/template-actions-panel/index.d.ts.map +1 -0
  350. package/build-types/components/template-content-panel/index.d.ts.map +1 -1
  351. package/build-types/components/template-part-menu-items/convert-to-regular.d.ts.map +1 -1
  352. package/build-types/components/upload-progress-snackbar/index.d.ts +19 -0
  353. package/build-types/components/upload-progress-snackbar/index.d.ts.map +1 -0
  354. package/build-types/components/upload-progress-snackbar/stories/index.story.d.ts +28 -0
  355. package/build-types/components/upload-progress-snackbar/stories/index.story.d.ts.map +1 -0
  356. package/build-types/components/upload-progress-snackbar/tracker.d.ts +41 -0
  357. package/build-types/components/upload-progress-snackbar/tracker.d.ts.map +1 -0
  358. package/build-types/components/visual-editor/index.d.ts.map +1 -1
  359. package/build-types/store/private-actions.d.ts +12 -0
  360. package/build-types/store/private-actions.d.ts.map +1 -1
  361. package/build-types/store/private-selectors.d.ts +45 -0
  362. package/build-types/store/private-selectors.d.ts.map +1 -1
  363. package/build-types/store/reducer.d.ts +21 -0
  364. package/build-types/store/reducer.d.ts.map +1 -1
  365. package/build-types/store/selectors.d.ts +0 -10
  366. package/build-types/store/selectors.d.ts.map +1 -1
  367. package/build-types/utils/media-delete/index.d.ts +2 -0
  368. package/build-types/utils/media-delete/index.d.ts.map +1 -0
  369. package/build-types/utils/media-finalize/index.d.ts +2 -0
  370. package/build-types/utils/media-finalize/index.d.ts.map +1 -0
  371. package/build-types/utils/media-upload/on-success.d.ts +9 -0
  372. package/build-types/utils/media-upload/on-success.d.ts.map +1 -0
  373. package/build-types/utils/sync-error-messages.d.ts +17 -3
  374. package/build-types/utils/sync-error-messages.d.ts.map +1 -1
  375. package/package.json +45 -44
  376. package/src/components/collab-sidebar/index.js +7 -4
  377. package/src/components/collab-sidebar/utils.js +9 -10
  378. package/src/components/collaborators-overlay/avatar-iframe-styles.ts +134 -0
  379. package/src/components/collaborators-overlay/collaborator-styles.ts +43 -2
  380. package/src/components/collaborators-overlay/compute-selection.ts +315 -0
  381. package/src/components/collaborators-overlay/cursor-dom-utils.ts +382 -0
  382. package/src/components/collaborators-overlay/cursor-registry.ts +96 -0
  383. package/src/components/collaborators-overlay/index.tsx +12 -4
  384. package/src/components/collaborators-overlay/overlay-iframe-styles.ts +131 -0
  385. package/src/components/collaborators-overlay/overlay.tsx +145 -229
  386. package/src/components/collaborators-overlay/timing-utils.ts +30 -0
  387. package/src/components/collaborators-overlay/use-block-highlighting.ts +152 -64
  388. package/src/components/collaborators-overlay/use-debounced-recompute.ts +32 -0
  389. package/src/components/collaborators-overlay/use-render-cursors.ts +120 -282
  390. package/src/components/collaborators-presence/avatar/component.tsx +123 -0
  391. package/src/components/collaborators-presence/avatar/index.ts +2 -0
  392. package/src/components/collaborators-presence/avatar/styles.scss +184 -0
  393. package/src/components/collaborators-presence/avatar/test/index.tsx +389 -0
  394. package/src/components/collaborators-presence/avatar/types.ts +66 -0
  395. package/src/components/collaborators-presence/avatar/use-image-loading-status.ts +36 -0
  396. package/src/components/collaborators-presence/avatar-group/component.tsx +55 -0
  397. package/src/components/collaborators-presence/avatar-group/index.ts +2 -0
  398. package/src/components/collaborators-presence/avatar-group/styles.scss +33 -0
  399. package/src/components/collaborators-presence/avatar-group/test/index.tsx +139 -0
  400. package/src/components/collaborators-presence/avatar-group/types.ts +13 -0
  401. package/src/components/collaborators-presence/index.tsx +43 -12
  402. package/src/components/collaborators-presence/list.tsx +68 -40
  403. package/src/components/collaborators-presence/styles/collaborators-list.scss +26 -19
  404. package/src/components/collaborators-presence/styles/collaborators-presence.scss +6 -2
  405. package/src/components/collaborators-presence/test/use-collaborator-notifications.ts +397 -0
  406. package/src/components/collaborators-presence/use-collaborator-notifications.ts +203 -0
  407. package/src/components/document-bar/style.scss +1 -1
  408. package/src/components/editor-interface/index.js +13 -6
  409. package/src/components/inserter-sidebar/index.js +4 -1
  410. package/src/components/post-last-revision/index.js +35 -6
  411. package/src/components/post-last-revision/style.scss +0 -3
  412. package/src/components/post-locked-modal/index.js +69 -25
  413. package/src/components/post-panel-row/style.scss +1 -0
  414. package/src/components/post-revisions-preview/block-diff.js +224 -61
  415. package/src/components/post-revisions-preview/diff-markers.js +15 -12
  416. package/src/components/post-revisions-preview/revisions-canvas.js +23 -86
  417. package/src/components/post-revisions-preview/revisions-header.js +35 -37
  418. package/src/components/post-revisions-preview/revisions-slider.js +138 -62
  419. package/src/components/post-revisions-preview/style.scss +3 -3
  420. package/src/components/post-revisions-preview/test/block-diff.js +202 -35
  421. package/src/components/preferences-modal/index.js +37 -7
  422. package/src/components/provider/disable-non-page-content-blocks.js +42 -40
  423. package/src/components/provider/index.js +20 -2
  424. package/src/components/provider/use-block-editor-settings.js +21 -1
  425. package/src/components/provider/use-post-content-block-types.js +30 -0
  426. package/src/components/provider/use-revision-blocks.js +105 -0
  427. package/src/components/revision-block-diff/index.js +39 -0
  428. package/src/components/revision-diff-panel/index.js +59 -0
  429. package/src/components/revision-diff-panel/style.scss +13 -0
  430. package/src/components/revision-fields-diff/index.js +91 -0
  431. package/src/components/sidebar/header.js +1 -1
  432. package/src/components/sidebar/index.js +4 -0
  433. package/src/components/style-book/index.js +4 -2
  434. package/src/components/sync-connection-error-modal/index.tsx +253 -0
  435. package/src/components/sync-connection-error-modal/style.scss +14 -0
  436. package/src/components/sync-connection-error-modal/use-retry-countdown.ts +93 -0
  437. package/src/components/template-content-panel/index.js +30 -38
  438. package/src/components/template-part-menu-items/convert-to-regular.js +74 -12
  439. package/src/components/visual-editor/index.js +6 -23
  440. package/src/store/private-actions.js +70 -1
  441. package/src/store/private-selectors.js +216 -28
  442. package/src/store/reducer.js +41 -0
  443. package/src/store/selectors.js +0 -19
  444. package/src/style.scss +4 -1
  445. package/src/utils/media-finalize/index.js +11 -0
  446. package/src/utils/media-finalize/test/index.js +34 -0
  447. package/src/utils/media-upload/on-success.js +34 -0
  448. package/src/utils/sync-error-messages.ts +72 -0
  449. package/src/utils/test/sync-error-messages.js +34 -0
  450. package/build/components/provider/use-post-content-blocks.cjs.map +0 -7
  451. package/build/components/sync-connection-modal/index.cjs +0 -130
  452. package/build/components/sync-connection-modal/index.cjs.map +0 -7
  453. package/build-module/components/provider/use-post-content-blocks.mjs +0 -34
  454. package/build-module/components/provider/use-post-content-blocks.mjs.map +0 -7
  455. package/build-module/components/sync-connection-modal/index.mjs +0 -114
  456. package/build-module/components/sync-connection-modal/index.mjs.map +0 -7
  457. package/build-types/components/provider/use-post-content-blocks.d.ts +0 -2
  458. package/build-types/components/provider/use-post-content-blocks.d.ts.map +0 -1
  459. package/build-types/components/sync-connection-modal/index.d.ts +0 -8
  460. package/build-types/components/sync-connection-modal/index.d.ts.map +0 -1
  461. package/src/components/provider/use-post-content-blocks.js +0 -42
  462. package/src/components/sync-connection-modal/index.js +0 -140
  463. package/src/components/sync-connection-modal/style.scss +0 -11
  464. package/src/utils/sync-error-messages.js +0 -53
@@ -0,0 +1,213 @@
1
+ // packages/editor/src/components/collaborators-overlay/cursor-dom-utils.ts
2
+ var MAX_NODE_OFFSET_COUNT = 500;
3
+ var getCursorPosition = (absolutePositionIndex, blockElement, editorDocument, overlayRect) => {
4
+ if (absolutePositionIndex === null || !blockElement) {
5
+ return null;
6
+ }
7
+ return getOffsetPositionInBlock(
8
+ blockElement,
9
+ absolutePositionIndex,
10
+ editorDocument,
11
+ overlayRect
12
+ ) ?? null;
13
+ };
14
+ var getOffsetPositionInBlock = (blockElement, charOffset, editorDocument, overlayRect) => {
15
+ const { node, offset } = findInnerBlockOffset(
16
+ blockElement,
17
+ charOffset,
18
+ editorDocument
19
+ );
20
+ const cursorRange = editorDocument.createRange();
21
+ try {
22
+ cursorRange.setStart(node, offset);
23
+ } catch (error) {
24
+ return null;
25
+ }
26
+ cursorRange.collapse(true);
27
+ const cursorRect = cursorRange.getBoundingClientRect();
28
+ const blockRect = blockElement.getBoundingClientRect();
29
+ let cursorX = 0;
30
+ let cursorY = 0;
31
+ if (cursorRect.x === 0 && cursorRect.y === 0 && cursorRect.width === 0 && cursorRect.height === 0) {
32
+ cursorX = blockRect.left - overlayRect.left;
33
+ cursorY = blockRect.top - overlayRect.top;
34
+ } else {
35
+ cursorX = cursorRect.left - overlayRect.left;
36
+ cursorY = cursorRect.top - overlayRect.top;
37
+ }
38
+ let cursorHeight = cursorRect.height;
39
+ if (cursorHeight === 0) {
40
+ const view = editorDocument.defaultView ?? window;
41
+ cursorHeight = parseInt(view.getComputedStyle(blockElement).lineHeight, 10) || blockRect.height;
42
+ }
43
+ return {
44
+ x: cursorX,
45
+ y: cursorY,
46
+ height: cursorHeight
47
+ };
48
+ };
49
+ var getSelectionRects = (blockElement, startOffset, endOffset, editorDocument, overlayRect) => {
50
+ let normalizedStart = startOffset;
51
+ let normalizedEnd = endOffset;
52
+ if (normalizedStart > normalizedEnd) {
53
+ [normalizedStart, normalizedEnd] = [normalizedEnd, normalizedStart];
54
+ }
55
+ const startPos = findInnerBlockOffset(
56
+ blockElement,
57
+ normalizedStart,
58
+ editorDocument
59
+ );
60
+ const endPos = findInnerBlockOffset(
61
+ blockElement,
62
+ normalizedEnd,
63
+ editorDocument
64
+ );
65
+ const range = editorDocument.createRange();
66
+ try {
67
+ range.setStart(startPos.node, startPos.offset);
68
+ range.setEnd(endPos.node, endPos.offset);
69
+ } catch {
70
+ return null;
71
+ }
72
+ const clientRects = range.getClientRects();
73
+ const rects = [];
74
+ for (const rect of clientRects) {
75
+ if (rect.width === 0 && rect.height === 0) {
76
+ continue;
77
+ }
78
+ const x = rect.left - overlayRect.left;
79
+ const y = rect.top - overlayRect.top;
80
+ const isDuplicate = rects.some(
81
+ (r) => r.x === x && r.y === y && r.width === rect.width && r.height === rect.height
82
+ );
83
+ if (isDuplicate) {
84
+ continue;
85
+ }
86
+ rects.push({
87
+ x,
88
+ y,
89
+ width: rect.width,
90
+ height: rect.height
91
+ });
92
+ }
93
+ return rects.length > 0 ? rects : null;
94
+ };
95
+ var getFullBlockSelectionRects = (blockElement, editorDocument, overlayRect) => {
96
+ const range = editorDocument.createRange();
97
+ range.selectNodeContents(blockElement);
98
+ const clientRects = range.getClientRects();
99
+ const rects = [];
100
+ for (const rect of clientRects) {
101
+ if (rect.width === 0 && rect.height === 0) {
102
+ continue;
103
+ }
104
+ rects.push({
105
+ x: rect.left - overlayRect.left,
106
+ y: rect.top - overlayRect.top,
107
+ width: rect.width,
108
+ height: rect.height
109
+ });
110
+ }
111
+ if (rects.length === 0) {
112
+ const blockRect = blockElement.getBoundingClientRect();
113
+ if (blockRect.width > 0 && blockRect.height > 0) {
114
+ rects.push({
115
+ x: blockRect.left - overlayRect.left,
116
+ y: blockRect.top - overlayRect.top,
117
+ width: blockRect.width,
118
+ height: blockRect.height
119
+ });
120
+ }
121
+ }
122
+ return rects;
123
+ };
124
+ var getBlocksBetween = (startBlockId, endBlockId, editorDocument) => {
125
+ const allBlocks = editorDocument.querySelectorAll("[data-block]");
126
+ let startIndex = -1;
127
+ let endIndex = -1;
128
+ for (let i = 0; i < allBlocks.length; i++) {
129
+ const blockId = allBlocks[i].getAttribute("data-block");
130
+ if (blockId === startBlockId) {
131
+ startIndex = i;
132
+ }
133
+ if (blockId === endBlockId) {
134
+ endIndex = i;
135
+ }
136
+ }
137
+ if (startIndex === -1 || endIndex === -1) {
138
+ return [];
139
+ }
140
+ if (startIndex > endIndex) {
141
+ [startIndex, endIndex] = [endIndex, startIndex];
142
+ }
143
+ const result = [];
144
+ for (let i = startIndex + 1; i < endIndex; i++) {
145
+ result.push(allBlocks[i]);
146
+ }
147
+ return result;
148
+ };
149
+ var findInnerBlockOffset = (blockElement, offset, editorDocument) => {
150
+ const treeWalker = editorDocument.createTreeWalker(
151
+ blockElement,
152
+ NodeFilter.SHOW_TEXT | NodeFilter.SHOW_ELEMENT
153
+ // eslint-disable-line no-bitwise
154
+ );
155
+ let currentOffset = 0;
156
+ let lastTextNode = null;
157
+ let node = null;
158
+ let nodeCount = 1;
159
+ while (node = treeWalker.nextNode()) {
160
+ nodeCount++;
161
+ if (nodeCount > MAX_NODE_OFFSET_COUNT) {
162
+ if (lastTextNode) {
163
+ return { node: lastTextNode, offset: 0 };
164
+ }
165
+ return { node: blockElement, offset: 0 };
166
+ }
167
+ const nodeLength = node.nodeValue?.length ?? 0;
168
+ if (node.nodeType === Node.ELEMENT_NODE) {
169
+ if (node.nodeName === "BR") {
170
+ if (currentOffset + 1 >= offset) {
171
+ const nodeAfterBr = treeWalker.nextNode();
172
+ if (nodeAfterBr?.nodeType === Node.TEXT_NODE) {
173
+ return { node: nodeAfterBr, offset: 0 };
174
+ } else if (lastTextNode) {
175
+ return {
176
+ node: lastTextNode,
177
+ offset: lastTextNode.nodeValue?.length ?? 0
178
+ };
179
+ }
180
+ return { node: blockElement, offset: 0 };
181
+ }
182
+ currentOffset += 1;
183
+ continue;
184
+ } else {
185
+ continue;
186
+ }
187
+ }
188
+ if (nodeLength === 0) {
189
+ continue;
190
+ }
191
+ if (currentOffset + nodeLength >= offset) {
192
+ return { node, offset: offset - currentOffset };
193
+ }
194
+ currentOffset += nodeLength;
195
+ if (node.nodeType === Node.TEXT_NODE) {
196
+ lastTextNode = node;
197
+ }
198
+ }
199
+ if (lastTextNode && lastTextNode.nodeValue?.length) {
200
+ return { node: lastTextNode, offset: lastTextNode.nodeValue.length };
201
+ }
202
+ return { node: blockElement, offset: 0 };
203
+ };
204
+ var isNodeBefore = (a, b) => a.compareDocumentPosition(b) === Node.DOCUMENT_POSITION_FOLLOWING;
205
+ export {
206
+ findInnerBlockOffset,
207
+ getBlocksBetween,
208
+ getCursorPosition,
209
+ getFullBlockSelectionRects,
210
+ getSelectionRects,
211
+ isNodeBefore
212
+ };
213
+ //# sourceMappingURL=cursor-dom-utils.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/collaborators-overlay/cursor-dom-utils.ts"],
4
+ "sourcesContent": ["export interface SelectionRect {\n\tx: number;\n\ty: number;\n\twidth: number;\n\theight: number;\n}\n\nexport interface CursorCoords {\n\tx: number;\n\ty: number;\n\theight: number;\n}\n\nconst MAX_NODE_OFFSET_COUNT = 500;\n\n/**\n * Given a selection, returns the coordinates of the cursor in the block.\n *\n * @param absolutePositionIndex - The absolute position index\n * @param blockElement - The block element (or null if deleted)\n * @param editorDocument - The editor document\n * @param overlayRect - Pre-computed bounding rect of the overlay element\n * @return The position of the cursor\n */\nexport const getCursorPosition = (\n\tabsolutePositionIndex: number | null,\n\tblockElement: HTMLElement | null,\n\teditorDocument: Document,\n\toverlayRect: DOMRect\n): CursorCoords | null => {\n\tif ( absolutePositionIndex === null || ! blockElement ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\tgetOffsetPositionInBlock(\n\t\t\tblockElement,\n\t\t\tabsolutePositionIndex,\n\t\t\teditorDocument,\n\t\t\toverlayRect\n\t\t) ?? null\n\t);\n};\n\n/**\n * Given a block element and a character offset, returns the coordinates for drawing a visual cursor in the block.\n *\n * @param blockElement - The block element\n * @param charOffset - The character offset\n * @param editorDocument - The editor document\n * @param overlayRect - Pre-computed bounding rect of the overlay element\n * @return The position of the cursor\n */\nconst getOffsetPositionInBlock = (\n\tblockElement: HTMLElement,\n\tcharOffset: number,\n\teditorDocument: Document,\n\toverlayRect: DOMRect\n) => {\n\tconst { node, offset } = findInnerBlockOffset(\n\t\tblockElement,\n\t\tcharOffset,\n\t\teditorDocument\n\t);\n\n\tconst cursorRange = editorDocument.createRange();\n\n\ttry {\n\t\tcursorRange.setStart( node, offset );\n\t} catch ( error ) {\n\t\treturn null;\n\t}\n\n\t// Ensure the range only represents single point in the DOM.\n\tcursorRange.collapse( true );\n\n\tconst cursorRect = cursorRange.getBoundingClientRect();\n\tconst blockRect = blockElement.getBoundingClientRect();\n\n\tlet cursorX = 0;\n\tlet cursorY = 0;\n\n\tif (\n\t\tcursorRect.x === 0 &&\n\t\tcursorRect.y === 0 &&\n\t\tcursorRect.width === 0 &&\n\t\tcursorRect.height === 0\n\t) {\n\t\t// This can happen for empty blocks.\n\t\tcursorX = blockRect.left - overlayRect.left;\n\t\tcursorY = blockRect.top - overlayRect.top;\n\t} else {\n\t\tcursorX = cursorRect.left - overlayRect.left;\n\t\tcursorY = cursorRect.top - overlayRect.top;\n\t}\n\n\tlet cursorHeight = cursorRect.height;\n\tif ( cursorHeight === 0 ) {\n\t\tconst view = editorDocument.defaultView ?? window;\n\t\tcursorHeight =\n\t\t\tparseInt( view.getComputedStyle( blockElement ).lineHeight, 10 ) ||\n\t\t\tblockRect.height;\n\t}\n\n\treturn {\n\t\tx: cursorX,\n\t\ty: cursorY,\n\t\theight: cursorHeight,\n\t};\n};\n\n/**\n * Computes selection highlight rectangles for a text range within a single block.\n *\n * @param blockElement - The block element\n * @param startOffset - Start character offset within the block\n * @param endOffset - End character offset within the block\n * @param editorDocument - The editor document\n * @param overlayRect - Pre-computed bounding rect of the overlay element\n * @return Array of selection rectangles relative to the overlay, or null on failure\n */\nexport const getSelectionRects = (\n\tblockElement: HTMLElement,\n\tstartOffset: number,\n\tendOffset: number,\n\teditorDocument: Document,\n\toverlayRect: DOMRect\n): SelectionRect[] | null => {\n\t// Normalize direction.\n\tlet normalizedStart = startOffset;\n\tlet normalizedEnd = endOffset;\n\tif ( normalizedStart > normalizedEnd ) {\n\t\t[ normalizedStart, normalizedEnd ] = [ normalizedEnd, normalizedStart ];\n\t}\n\n\tconst startPos = findInnerBlockOffset(\n\t\tblockElement,\n\t\tnormalizedStart,\n\t\teditorDocument\n\t);\n\tconst endPos = findInnerBlockOffset(\n\t\tblockElement,\n\t\tnormalizedEnd,\n\t\teditorDocument\n\t);\n\n\tconst range = editorDocument.createRange();\n\ttry {\n\t\trange.setStart( startPos.node, startPos.offset );\n\t\trange.setEnd( endPos.node, endPos.offset );\n\t} catch {\n\t\treturn null;\n\t}\n\n\tconst clientRects = range.getClientRects();\n\tconst rects: SelectionRect[] = [];\n\n\tfor ( const rect of clientRects ) {\n\t\tif ( rect.width === 0 && rect.height === 0 ) {\n\t\t\tcontinue;\n\t\t}\n\t\tconst x = rect.left - overlayRect.left;\n\t\tconst y = rect.top - overlayRect.top;\n\n\t\t// Range.getClientRects() can return duplicate rects at inline\n\t\t// formatting boundaries (e.g. <em>, <strong>). Skip exact matches.\n\t\tconst isDuplicate = rects.some(\n\t\t\t( r ) =>\n\t\t\t\tr.x === x &&\n\t\t\t\tr.y === y &&\n\t\t\t\tr.width === rect.width &&\n\t\t\t\tr.height === rect.height\n\t\t);\n\t\tif ( isDuplicate ) {\n\t\t\tcontinue;\n\t\t}\n\n\t\trects.push( {\n\t\t\tx,\n\t\t\ty,\n\t\t\twidth: rect.width,\n\t\t\theight: rect.height,\n\t\t} );\n\t}\n\n\treturn rects.length > 0 ? rects : null;\n};\n\n/**\n * Computes selection highlight rectangles for the full content of a block.\n * Used for intermediate blocks in a multi-block selection.\n *\n * @param blockElement - The block element\n * @param editorDocument - The editor document\n * @param overlayRect - Pre-computed bounding rect of the overlay element\n * @return Array of selection rectangles relative to the overlay\n */\nexport const getFullBlockSelectionRects = (\n\tblockElement: HTMLElement,\n\teditorDocument: Document,\n\toverlayRect: DOMRect\n): SelectionRect[] => {\n\tconst range = editorDocument.createRange();\n\trange.selectNodeContents( blockElement );\n\tconst clientRects = range.getClientRects();\n\tconst rects: SelectionRect[] = [];\n\n\tfor ( const rect of clientRects ) {\n\t\tif ( rect.width === 0 && rect.height === 0 ) {\n\t\t\tcontinue;\n\t\t}\n\t\trects.push( {\n\t\t\tx: rect.left - overlayRect.left,\n\t\t\ty: rect.top - overlayRect.top,\n\t\t\twidth: rect.width,\n\t\t\theight: rect.height,\n\t\t} );\n\t}\n\n\t// Fallback: if getClientRects returned nothing, use the block's bounding rect.\n\tif ( rects.length === 0 ) {\n\t\tconst blockRect = blockElement.getBoundingClientRect();\n\t\tif ( blockRect.width > 0 && blockRect.height > 0 ) {\n\t\t\trects.push( {\n\t\t\t\tx: blockRect.left - overlayRect.left,\n\t\t\t\ty: blockRect.top - overlayRect.top,\n\t\t\t\twidth: blockRect.width,\n\t\t\t\theight: blockRect.height,\n\t\t\t} );\n\t\t}\n\t}\n\n\treturn rects;\n};\n\n/**\n * Finds all block elements between two blocks in DOM order (exclusive of start and end).\n *\n * @param startBlockId - The clientId of the start block\n * @param endBlockId - The clientId of the end block\n * @param editorDocument - The editor document\n * @return Array of intermediate block HTMLElements in document order\n */\nexport const getBlocksBetween = (\n\tstartBlockId: string,\n\tendBlockId: string,\n\teditorDocument: Document\n): HTMLElement[] => {\n\tconst allBlocks =\n\t\teditorDocument.querySelectorAll< HTMLElement >( '[data-block]' );\n\n\tlet startIndex = -1;\n\tlet endIndex = -1;\n\n\tfor ( let i = 0; i < allBlocks.length; i++ ) {\n\t\tconst blockId = allBlocks[ i ].getAttribute( 'data-block' );\n\t\tif ( blockId === startBlockId ) {\n\t\t\tstartIndex = i;\n\t\t}\n\t\tif ( blockId === endBlockId ) {\n\t\t\tendIndex = i;\n\t\t}\n\t}\n\n\tif ( startIndex === -1 || endIndex === -1 ) {\n\t\treturn [];\n\t}\n\n\t// Normalize order.\n\tif ( startIndex > endIndex ) {\n\t\t[ startIndex, endIndex ] = [ endIndex, startIndex ];\n\t}\n\n\tconst result: HTMLElement[] = [];\n\tfor ( let i = startIndex + 1; i < endIndex; i++ ) {\n\t\tresult.push( allBlocks[ i ] );\n\t}\n\treturn result;\n};\n\n/**\n * Given a block element and a character offset, returns an exact inner node and offset for use in a range.\n *\n * @param blockElement - The block element\n * @param offset - The character offset\n * @param editorDocument - The editor document\n * @return The node and offset of the character at the offset\n */\nexport const findInnerBlockOffset = (\n\tblockElement: HTMLElement,\n\toffset: number,\n\teditorDocument: Document\n) => {\n\tconst treeWalker = editorDocument.createTreeWalker(\n\t\tblockElement,\n\t\tNodeFilter.SHOW_TEXT | NodeFilter.SHOW_ELEMENT // eslint-disable-line no-bitwise\n\t);\n\n\tlet currentOffset = 0;\n\tlet lastTextNode: Node | null = null;\n\n\tlet node: Node | null = null;\n\tlet nodeCount = 1;\n\n\twhile ( ( node = treeWalker.nextNode() ) ) {\n\t\tnodeCount++;\n\n\t\tif ( nodeCount > MAX_NODE_OFFSET_COUNT ) {\n\t\t\t// If we've walked too many nodes, return the last text node or the beginning of the block.\n\t\t\tif ( lastTextNode ) {\n\t\t\t\treturn { node: lastTextNode, offset: 0 };\n\t\t\t}\n\t\t\treturn { node: blockElement, offset: 0 };\n\t\t}\n\n\t\tconst nodeLength = node.nodeValue?.length ?? 0;\n\n\t\tif ( node.nodeType === Node.ELEMENT_NODE ) {\n\t\t\tif ( node.nodeName === 'BR' ) {\n\t\t\t\t// Treat <br> as a single \"\\n\" character.\n\n\t\t\t\tif ( currentOffset + 1 >= offset ) {\n\t\t\t\t\t// If the <br> occurs right on the target offset, return the next text node.\n\t\t\t\t\tconst nodeAfterBr = treeWalker.nextNode();\n\n\t\t\t\t\tif ( nodeAfterBr?.nodeType === Node.TEXT_NODE ) {\n\t\t\t\t\t\treturn { node: nodeAfterBr, offset: 0 };\n\t\t\t\t\t} else if ( lastTextNode ) {\n\t\t\t\t\t\t// If there's no text node after the <br>, return the end offset of the last text node.\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tnode: lastTextNode,\n\t\t\t\t\t\t\toffset: lastTextNode.nodeValue?.length ?? 0,\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t\t// Just in case, if there's no last text node, return the beginning of the block.\n\t\t\t\t\treturn { node: blockElement, offset: 0 };\n\t\t\t\t}\n\n\t\t\t\t// The <br> is before the target offset. Count it as a single character.\n\t\t\t\tcurrentOffset += 1;\n\t\t\t\tcontinue;\n\t\t\t} else {\n\t\t\t\t// Skip other element types.\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\n\t\tif ( nodeLength === 0 ) {\n\t\t\t// Skip empty nodes.\n\t\t\tcontinue;\n\t\t}\n\n\t\tif ( currentOffset + nodeLength >= offset ) {\n\t\t\t// This node exceeds the target offset. Return the node and the position of the offset within it.\n\t\t\treturn { node, offset: offset - currentOffset };\n\t\t}\n\n\t\tcurrentOffset += nodeLength;\n\n\t\tif ( node.nodeType === Node.TEXT_NODE ) {\n\t\t\tlastTextNode = node;\n\t\t}\n\t}\n\n\tif ( lastTextNode && lastTextNode.nodeValue?.length ) {\n\t\t// We didn't reach the target offset. Return the last text node's last character.\n\t\treturn { node: lastTextNode, offset: lastTextNode.nodeValue.length };\n\t}\n\n\t// We didn't find any text nodes. Return the beginning of the block.\n\treturn { node: blockElement, offset: 0 };\n};\n\n/**\n * Check if node `a` precedes node `b` in document order.\n *\n * @param a - First node.\n * @param b - Second node.\n * @return True if `a` comes before `b`.\n */\nexport const isNodeBefore = ( a: Node, b: Node ): boolean =>\n\ta.compareDocumentPosition( b ) === Node.DOCUMENT_POSITION_FOLLOWING;\n"],
5
+ "mappings": "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",
6
+ "names": []
7
+ }
@@ -0,0 +1,61 @@
1
+ // packages/editor/src/components/collaborators-overlay/cursor-registry.ts
2
+ function highlightCursor(element, duration) {
3
+ element.classList.add("collaborators-overlay-cursor-highlighted");
4
+ setTimeout(() => {
5
+ element.classList.remove("collaborators-overlay-cursor-highlighted");
6
+ }, duration);
7
+ }
8
+ function createCursorRegistry() {
9
+ const cursorMap = /* @__PURE__ */ new Map();
10
+ return {
11
+ /**
12
+ * Register a cursor element when it's created.
13
+ *
14
+ * @param clientId - The clientId of the cursor to register.
15
+ * @param element - The cursor element to register.
16
+ */
17
+ registerCursor(clientId, element) {
18
+ cursorMap.set(clientId, element);
19
+ },
20
+ /**
21
+ * Unregister a cursor element when it's removed.
22
+ *
23
+ * @param clientId - The clientId of the cursor to unregister.
24
+ */
25
+ unregisterCursor(clientId) {
26
+ cursorMap.delete(clientId);
27
+ },
28
+ /**
29
+ * Scroll to a cursor by clientId.
30
+ *
31
+ * @param clientId - The clientId of the cursor to scroll to.
32
+ * @param options - The options for the scroll.
33
+ * @return true if cursor was found and scrolled to, false otherwise.
34
+ */
35
+ scrollToCursor(clientId, options) {
36
+ const cursorElement = cursorMap.get(clientId);
37
+ if (!cursorElement) {
38
+ return false;
39
+ }
40
+ cursorElement.scrollIntoView({
41
+ behavior: options?.behavior ?? "smooth",
42
+ block: options?.block ?? "center",
43
+ inline: options?.inline ?? "nearest"
44
+ });
45
+ if (options?.highlightDuration) {
46
+ highlightCursor(cursorElement, options.highlightDuration);
47
+ }
48
+ return true;
49
+ },
50
+ /**
51
+ * Clear the registry.
52
+ */
53
+ removeAll() {
54
+ cursorMap.clear();
55
+ }
56
+ };
57
+ }
58
+ export {
59
+ createCursorRegistry
60
+ };
61
+ //# sourceMappingURL=cursor-registry.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/collaborators-overlay/cursor-registry.ts"],
4
+ "sourcesContent": ["interface ScrollToCursorOptions {\n\tbehavior?: ScrollBehavior;\n\tblock?: ScrollLogicalPosition;\n\tinline?: ScrollLogicalPosition;\n\thighlightDuration?: number;\n}\n\n/**\n * Cursor Registry\n * ===\n * This registry stores references to cursor elements so that we can access them\n * in different parts of the component tree. This would more ideally be solved\n * with React context or state in the awareness store, but:\n *\n * 1. EditorPresence and BlockCanvasCover slot/fill break context propagation. We\n * don't currently have a way to provide context to both the slot and fill.\n * 2. Storing pointers to the cursor elements in the awareness store might be a\n * better solution, but would require broader refactoring.\n *\n * For now, we create a single instance of this registry and pass it down to the\n * components that need it. It's important that we create a single instance and\n * not a new instance per component or render; use useState with a lazy\n * initializer to accomplish this.\n */\n\nfunction highlightCursor( element: HTMLElement, duration: number ): void {\n\telement.classList.add( 'collaborators-overlay-cursor-highlighted' );\n\n\tsetTimeout( () => {\n\t\telement.classList.remove( 'collaborators-overlay-cursor-highlighted' );\n\t}, duration );\n}\n\nexport function createCursorRegistry() {\n\tconst cursorMap = new Map< number, HTMLElement >();\n\n\treturn {\n\t\t/**\n\t\t * Register a cursor element when it's created.\n\t\t *\n\t\t * @param clientId - The clientId of the cursor to register.\n\t\t * @param element - The cursor element to register.\n\t\t */\n\t\tregisterCursor( clientId: number, element: HTMLElement ): void {\n\t\t\tcursorMap.set( clientId, element );\n\t\t},\n\n\t\t/**\n\t\t * Unregister a cursor element when it's removed.\n\t\t *\n\t\t * @param clientId - The clientId of the cursor to unregister.\n\t\t */\n\t\tunregisterCursor( clientId: number ): void {\n\t\t\tcursorMap.delete( clientId );\n\t\t},\n\n\t\t/**\n\t\t * Scroll to a cursor by clientId.\n\t\t *\n\t\t * @param clientId - The clientId of the cursor to scroll to.\n\t\t * @param options - The options for the scroll.\n\t\t * @return true if cursor was found and scrolled to, false otherwise.\n\t\t */\n\t\tscrollToCursor(\n\t\t\tclientId: number,\n\t\t\toptions?: ScrollToCursorOptions\n\t\t): boolean {\n\t\t\tconst cursorElement = cursorMap.get( clientId );\n\n\t\t\tif ( ! cursorElement ) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tcursorElement.scrollIntoView( {\n\t\t\t\tbehavior: options?.behavior ?? 'smooth',\n\t\t\t\tblock: options?.block ?? 'center',\n\t\t\t\tinline: options?.inline ?? 'nearest',\n\t\t\t} );\n\n\t\t\tif ( options?.highlightDuration ) {\n\t\t\t\thighlightCursor( cursorElement, options.highlightDuration );\n\t\t\t}\n\n\t\t\treturn true;\n\t\t},\n\n\t\t/**\n\t\t * Clear the registry.\n\t\t */\n\t\tremoveAll(): void {\n\t\t\tcursorMap.clear();\n\t\t},\n\t};\n}\n\nexport type CursorRegistry = ReturnType< typeof createCursorRegistry >;\n"],
5
+ "mappings": ";AAyBA,SAAS,gBAAiB,SAAsB,UAAyB;AACxE,UAAQ,UAAU,IAAK,0CAA2C;AAElE,aAAY,MAAM;AACjB,YAAQ,UAAU,OAAQ,0CAA2C;AAAA,EACtE,GAAG,QAAS;AACb;AAEO,SAAS,uBAAuB;AACtC,QAAM,YAAY,oBAAI,IAA2B;AAEjD,SAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAON,eAAgB,UAAkB,SAA6B;AAC9D,gBAAU,IAAK,UAAU,OAAQ;AAAA,IAClC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAOA,iBAAkB,UAAyB;AAC1C,gBAAU,OAAQ,QAAS;AAAA,IAC5B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IASA,eACC,UACA,SACU;AACV,YAAM,gBAAgB,UAAU,IAAK,QAAS;AAE9C,UAAK,CAAE,eAAgB;AACtB,eAAO;AAAA,MACR;AAEA,oBAAc,eAAgB;AAAA,QAC7B,UAAU,SAAS,YAAY;AAAA,QAC/B,OAAO,SAAS,SAAS;AAAA,QACzB,QAAQ,SAAS,UAAU;AAAA,MAC5B,CAAE;AAEF,UAAK,SAAS,mBAAoB;AACjC,wBAAiB,eAAe,QAAQ,iBAAkB;AAAA,MAC3D;AAEA,aAAO;AAAA,IACR;AAAA;AAAA;AAAA;AAAA,IAKA,YAAkB;AACjB,gBAAU,MAAM;AAAA,IACjB;AAAA,EACD;AACD;",
6
+ "names": []
7
+ }
@@ -4,7 +4,11 @@ import { unlock } from "../../lock-unlock.mjs";
4
4
  import { Overlay } from "./overlay.mjs";
5
5
  import { jsx } from "react/jsx-runtime";
6
6
  var { BlockCanvasCover } = unlock(privateApis);
7
- function CollaboratorsOverlay({ postId, postType }) {
7
+ function CollaboratorsOverlay({
8
+ postId,
9
+ postType,
10
+ cursorRegistry
11
+ }) {
8
12
  return /* @__PURE__ */ jsx(BlockCanvasCover.Fill, { children: ({
9
13
  containerRef
10
14
  }) => /* @__PURE__ */ jsx(
@@ -12,7 +16,8 @@ function CollaboratorsOverlay({ postId, postType }) {
12
16
  {
13
17
  blockEditorDocument: containerRef.current?.ownerDocument,
14
18
  postId,
15
- postType
19
+ postType,
20
+ cursorRegistry
16
21
  }
17
22
  ) });
18
23
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/collaborators-overlay/index.tsx"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\n// @ts-expect-error No exported types\nimport { privateApis } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { Overlay } from './overlay';\n\nconst { BlockCanvasCover } = unlock( privateApis );\n\ninterface Props {\n\tpostId: number | null;\n\tpostType: string | null;\n}\n\n/**\n * Collaborators Overlay component\n * @param props - The props for the CollaboratorsOverlay component\n * @param props.postId - The ID of the post\n * @param props.postType - The type of the post\n * @return The CollaboratorsOverlay component\n */\nexport function CollaboratorsOverlay( { postId, postType }: Props ) {\n\treturn (\n\t\t<BlockCanvasCover.Fill>\n\t\t\t{ ( {\n\t\t\t\tcontainerRef,\n\t\t\t}: {\n\t\t\t\tcontainerRef: React.MutableRefObject< HTMLElement | null >;\n\t\t\t} ) => (\n\t\t\t\t<Overlay\n\t\t\t\t\tblockEditorDocument={ containerRef.current?.ownerDocument }\n\t\t\t\t\tpostId={ postId }\n\t\t\t\t\tpostType={ postType }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</BlockCanvasCover.Fill>\n\t);\n}\n"],
5
- "mappings": ";AAIA,SAAS,mBAAmB;AAK5B,SAAS,cAAc;AACvB,SAAS,eAAe;AAwBpB;AAtBJ,IAAM,EAAE,iBAAiB,IAAI,OAAQ,WAAY;AAc1C,SAAS,qBAAsB,EAAE,QAAQ,SAAS,GAAW;AACnE,SACC,oBAAC,iBAAiB,MAAjB,EACE,WAAE;AAAA,IACH;AAAA,EACD,MAGC;AAAA,IAAC;AAAA;AAAA,MACA,qBAAsB,aAAa,SAAS;AAAA,MAC5C;AAAA,MACA;AAAA;AAAA,EACD,GAEF;AAEF;",
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\n// @ts-expect-error No exported types\nimport { privateApis } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { Overlay } from './overlay';\nimport { type CursorRegistry } from './cursor-registry';\n\nconst { BlockCanvasCover } = unlock( privateApis );\n\ninterface Props {\n\tpostId: number | null;\n\tpostType: string | null;\n\tcursorRegistry?: CursorRegistry;\n}\n\n/**\n * Collaborators Overlay component\n * @param props - The props for the CollaboratorsOverlay component\n * @param props.postId - The ID of the post\n * @param props.postType - The type of the post\n * @param props.cursorRegistry - The shared cursor registry\n * @return The CollaboratorsOverlay component\n */\nexport function CollaboratorsOverlay( {\n\tpostId,\n\tpostType,\n\tcursorRegistry,\n}: Props ) {\n\treturn (\n\t\t<BlockCanvasCover.Fill>\n\t\t\t{ ( {\n\t\t\t\tcontainerRef,\n\t\t\t}: {\n\t\t\t\tcontainerRef: React.MutableRefObject< HTMLElement | null >;\n\t\t\t} ) => (\n\t\t\t\t<Overlay\n\t\t\t\t\tblockEditorDocument={ containerRef.current?.ownerDocument }\n\t\t\t\t\tpostId={ postId }\n\t\t\t\t\tpostType={ postType }\n\t\t\t\t\tcursorRegistry={ cursorRegistry }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</BlockCanvasCover.Fill>\n\t);\n}\n"],
5
+ "mappings": ";AAIA,SAAS,mBAAmB;AAK5B,SAAS,cAAc;AACvB,SAAS,eAAe;AA+BpB;AA5BJ,IAAM,EAAE,iBAAiB,IAAI,OAAQ,WAAY;AAgB1C,SAAS,qBAAsB;AAAA,EACrC;AAAA,EACA;AAAA,EACA;AACD,GAAW;AACV,SACC,oBAAC,iBAAiB,MAAjB,EACE,WAAE;AAAA,IACH;AAAA,EACD,MAGC;AAAA,IAAC;AAAA;AAAA,MACA,qBAAsB,aAAa,SAAS;AAAA,MAC5C;AAAA,MACA;AAAA,MACA;AAAA;AAAA,EACD,GAEF;AAEF;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,130 @@
1
+ // packages/editor/src/components/collaborators-overlay/overlay-iframe-styles.ts
2
+ import {
3
+ BORDER_WIDTH,
4
+ BORDER_WIDTH_FOCUS_FALLBACK,
5
+ ELEVATION_X_SMALL,
6
+ GRID_UNIT_05,
7
+ GRID_UNIT_10,
8
+ WHITE
9
+ } from "./collaborator-styles.mjs";
10
+ var OVERLAY_IFRAME_STYLES = `
11
+ .block-canvas-cover {
12
+ position: absolute;
13
+ top: 0;
14
+ left: 0;
15
+ width: 100%;
16
+ height: 100%;
17
+ pointer-events: none;
18
+ z-index: 20000;
19
+ }
20
+ .block-canvas-cover .collaborators-overlay-full {
21
+ position: absolute;
22
+ top: 0;
23
+ left: 0;
24
+ width: 100%;
25
+ height: 100%;
26
+ }
27
+ .block-canvas-cover .collaborators-overlay-fixed {
28
+ position: fixed;
29
+ width: 100%;
30
+ height: 100%;
31
+ }
32
+ .collaborators-overlay-user {
33
+ position: absolute;
34
+ }
35
+ /* Cursor lines render below avatar labels across all users. The parent
36
+ .collaborators-overlay-user has no z-index so it does not create a
37
+ stacking context \u2014 children participate in the shared overlay context. */
38
+ .collaborators-overlay-user-cursor {
39
+ position: absolute;
40
+ z-index: 0;
41
+ width: ${BORDER_WIDTH_FOCUS_FALLBACK};
42
+ border-radius: ${BORDER_WIDTH};
43
+ outline: ${BORDER_WIDTH} solid ${WHITE};
44
+ box-shadow: ${ELEVATION_X_SMALL};
45
+ animation: collaborators-overlay-cursor-blink 1s infinite;
46
+ }
47
+ .collaborators-overlay-selection-rect {
48
+ position: absolute;
49
+ opacity: 0.15;
50
+ pointer-events: none;
51
+ border-radius: 2px;
52
+ }
53
+
54
+ /* Overlay-specific positioning applied to the Avatar cursor label. */
55
+ .collaborators-overlay-user-label.editor-avatar {
56
+ position: absolute;
57
+ z-index: 1;
58
+ transform: translate(-11px, -100%);
59
+ margin-top: -${GRID_UNIT_05};
60
+ pointer-events: auto;
61
+ overflow: visible;
62
+ width: max-content;
63
+ }
64
+ /* Avatar positioned above a highlighted block as a label. */
65
+ .collaborators-overlay-block-label.editor-avatar {
66
+ position: absolute;
67
+ z-index: 1;
68
+ transform: translateY(calc(-100% - ${GRID_UNIT_10}));
69
+ pointer-events: auto;
70
+ overflow: visible;
71
+ width: max-content;
72
+ }
73
+
74
+ @keyframes collaborators-overlay-cursor-blink {
75
+ 0%, 45% { opacity: 1; }
76
+ 55%, 95% { opacity: 0; }
77
+ 100% { opacity: 1; }
78
+ }
79
+ .collaborators-overlay-cursor-highlighted .collaborators-overlay-user-cursor {
80
+ animation: collaborators-overlay-cursor-highlight 0.6s ease-in-out 3;
81
+ }
82
+ .collaborators-overlay-cursor-highlighted .collaborators-overlay-user-label {
83
+ animation: collaborators-overlay-label-highlight 0.6s ease-in-out 3;
84
+ }
85
+ @keyframes collaborators-overlay-cursor-highlight {
86
+ 0%, 100% {
87
+ transform: scale(1);
88
+ filter: drop-shadow(0 0 0 transparent);
89
+ }
90
+ 50% {
91
+ transform: scale(1.2);
92
+ filter: drop-shadow(0 0 8px currentColor);
93
+ }
94
+ }
95
+ @keyframes collaborators-overlay-label-highlight {
96
+ 0%, 100% {
97
+ transform: translate(-11px, -100%) scale(1);
98
+ filter: drop-shadow(0 0 0 transparent);
99
+ }
100
+ 50% {
101
+ transform: translate(-11px, -100%) scale(1.1);
102
+ filter: drop-shadow(0 0 6px currentColor);
103
+ }
104
+ }
105
+ .block-editor-block-list__block.is-collaborator-selected:not(:focus)::after {
106
+ content: "";
107
+ position: absolute;
108
+ pointer-events: none;
109
+ top: 0;
110
+ right: 0;
111
+ bottom: 0;
112
+ left: 0;
113
+ outline-color: var(--collaborator-outline-color);
114
+ outline-style: solid;
115
+ outline-width: calc(var(--wp-admin-border-width-focus) / var(--wp-block-editor-iframe-zoom-out-scale, 1));
116
+ outline-offset: calc(-1 * var(--wp-admin-border-width-focus) / var(--wp-block-editor-iframe-zoom-out-scale, 1));
117
+ box-shadow: inset 0 0 0 calc((var(--wp-admin-border-width-focus) / var(--wp-block-editor-iframe-zoom-out-scale, 1)) + 0.5px) rgba(${WHITE}, 0.7);
118
+ z-index: 1;
119
+ }
120
+ @media (prefers-reduced-motion: reduce) {
121
+ .collaborators-overlay-user-label,
122
+ .collaborators-overlay-user-cursor {
123
+ animation: none;
124
+ }
125
+ }
126
+ `;
127
+ export {
128
+ OVERLAY_IFRAME_STYLES
129
+ };
130
+ //# sourceMappingURL=overlay-iframe-styles.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/collaborators-overlay/overlay-iframe-styles.ts"],
4
+ "sourcesContent": ["/**\n * CSS for the collaborators overlay \u2014 cursor indicators, block highlights,\n * and positioning of Avatar labels inside the editor canvas iframe.\n */\n\nimport {\n\tBORDER_WIDTH,\n\tBORDER_WIDTH_FOCUS_FALLBACK,\n\tELEVATION_X_SMALL,\n\tGRID_UNIT_05,\n\tGRID_UNIT_10,\n\tWHITE,\n} from './collaborator-styles';\n\nexport const OVERLAY_IFRAME_STYLES = `\n.block-canvas-cover {\n\tposition: absolute;\n\ttop: 0;\n\tleft: 0;\n\twidth: 100%;\n\theight: 100%;\n\tpointer-events: none;\n\tz-index: 20000;\n}\n.block-canvas-cover .collaborators-overlay-full {\n\tposition: absolute;\n\ttop: 0;\n\tleft: 0;\n\twidth: 100%;\n\theight: 100%;\n}\n.block-canvas-cover .collaborators-overlay-fixed {\n\tposition: fixed;\n\twidth: 100%;\n\theight: 100%;\n}\n.collaborators-overlay-user {\n\tposition: absolute;\n}\n/* Cursor lines render below avatar labels across all users. The parent\n .collaborators-overlay-user has no z-index so it does not create a\n stacking context \u2014 children participate in the shared overlay context. */\n.collaborators-overlay-user-cursor {\n\tposition: absolute;\n\tz-index: 0;\n\twidth: ${ BORDER_WIDTH_FOCUS_FALLBACK };\n\tborder-radius: ${ BORDER_WIDTH };\n\toutline: ${ BORDER_WIDTH } solid ${ WHITE };\n\tbox-shadow: ${ ELEVATION_X_SMALL };\n\tanimation: collaborators-overlay-cursor-blink 1s infinite;\n}\n.collaborators-overlay-selection-rect {\n\tposition: absolute;\n\topacity: 0.15;\n\tpointer-events: none;\n\tborder-radius: 2px;\n}\n\n/* Overlay-specific positioning applied to the Avatar cursor label. */\n.collaborators-overlay-user-label.editor-avatar {\n\tposition: absolute;\n\tz-index: 1;\n\ttransform: translate(-11px, -100%);\n\tmargin-top: -${ GRID_UNIT_05 };\n\tpointer-events: auto;\n\toverflow: visible;\n\twidth: max-content;\n}\n/* Avatar positioned above a highlighted block as a label. */\n.collaborators-overlay-block-label.editor-avatar {\n\tposition: absolute;\n\tz-index: 1;\n\ttransform: translateY(calc(-100% - ${ GRID_UNIT_10 }));\n\tpointer-events: auto;\n\toverflow: visible;\n\twidth: max-content;\n}\n\n@keyframes collaborators-overlay-cursor-blink {\n\t0%, 45% { opacity: 1; }\n\t55%, 95% { opacity: 0; }\n\t100% { opacity: 1; }\n}\n.collaborators-overlay-cursor-highlighted .collaborators-overlay-user-cursor {\n\tanimation: collaborators-overlay-cursor-highlight 0.6s ease-in-out 3;\n}\n.collaborators-overlay-cursor-highlighted .collaborators-overlay-user-label {\n\tanimation: collaborators-overlay-label-highlight 0.6s ease-in-out 3;\n}\n@keyframes collaborators-overlay-cursor-highlight {\n\t0%, 100% {\n\t\ttransform: scale(1);\n\t\tfilter: drop-shadow(0 0 0 transparent);\n\t}\n\t50% {\n\t\ttransform: scale(1.2);\n\t\tfilter: drop-shadow(0 0 8px currentColor);\n\t}\n}\n@keyframes collaborators-overlay-label-highlight {\n\t0%, 100% {\n\t\ttransform: translate(-11px, -100%) scale(1);\n\t\tfilter: drop-shadow(0 0 0 transparent);\n\t}\n\t50% {\n\t\ttransform: translate(-11px, -100%) scale(1.1);\n\t\tfilter: drop-shadow(0 0 6px currentColor);\n\t}\n}\n.block-editor-block-list__block.is-collaborator-selected:not(:focus)::after {\n\tcontent: \"\";\n\tposition: absolute;\n\tpointer-events: none;\n\ttop: 0;\n\tright: 0;\n\tbottom: 0;\n\tleft: 0;\n\toutline-color: var(--collaborator-outline-color);\n\toutline-style: solid;\n\toutline-width: calc(var(--wp-admin-border-width-focus) / var(--wp-block-editor-iframe-zoom-out-scale, 1));\n\toutline-offset: calc(-1 * var(--wp-admin-border-width-focus) / var(--wp-block-editor-iframe-zoom-out-scale, 1));\n\tbox-shadow: inset 0 0 0 calc((var(--wp-admin-border-width-focus) / var(--wp-block-editor-iframe-zoom-out-scale, 1)) + 0.5px) rgba(${ WHITE }, 0.7);\n\tz-index: 1;\n}\n@media (prefers-reduced-motion: reduce) {\n\t.collaborators-overlay-user-label,\n\t.collaborators-overlay-user-cursor {\n\t\tanimation: none;\n\t}\n}\n`;\n"],
5
+ "mappings": ";AAKA;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AAEA,IAAM,wBAAwB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,UA+B1B,2BAA4B;AAAA,kBACpB,YAAa;AAAA,YACnB,YAAa,UAAW,KAAM;AAAA,eAC3B,iBAAkB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAejB,YAAa;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sCASS,YAAa;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qIAiDkF,KAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;",
6
+ "names": []
7
+ }