@wordpress/editor 14.41.0 → 14.41.2-next.v.202603161435.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.
- package/CHANGELOG.md +6 -0
- package/build/components/collab-sidebar/index.cjs +7 -4
- package/build/components/collab-sidebar/index.cjs.map +2 -2
- package/build/components/collab-sidebar/utils.cjs +13 -15
- package/build/components/collab-sidebar/utils.cjs.map +2 -2
- package/build/components/collaborators-overlay/avatar-iframe-styles.cjs +141 -0
- package/build/components/collaborators-overlay/avatar-iframe-styles.cjs.map +7 -0
- package/build/components/collaborators-overlay/collaborator-styles.cjs +38 -2
- package/build/components/collaborators-overlay/collaborator-styles.cjs.map +2 -2
- package/build/components/collaborators-overlay/compute-selection.cjs +181 -0
- package/build/components/collaborators-overlay/compute-selection.cjs.map +7 -0
- package/build/components/collaborators-overlay/cursor-dom-utils.cjs +243 -0
- package/build/components/collaborators-overlay/cursor-dom-utils.cjs.map +7 -0
- package/build/components/collaborators-overlay/overlay-iframe-styles.cjs +148 -0
- package/build/components/collaborators-overlay/overlay-iframe-styles.cjs.map +7 -0
- package/build/components/collaborators-overlay/overlay.cjs +100 -229
- package/build/components/collaborators-overlay/overlay.cjs.map +3 -3
- package/build/components/collaborators-overlay/use-block-highlighting.cjs +90 -42
- package/build/components/collaborators-overlay/use-block-highlighting.cjs.map +2 -2
- package/build/components/collaborators-overlay/use-debounced-recompute.cjs +49 -0
- package/build/components/collaborators-overlay/use-debounced-recompute.cjs.map +7 -0
- package/build/components/collaborators-overlay/use-render-cursors.cjs +80 -171
- package/build/components/collaborators-overlay/use-render-cursors.cjs.map +3 -3
- package/build/components/collaborators-presence/avatar/component.cjs +121 -0
- package/build/components/collaborators-presence/avatar/component.cjs.map +7 -0
- package/build/components/collaborators-presence/avatar/index.cjs +37 -0
- package/build/components/collaborators-presence/avatar/index.cjs.map +7 -0
- package/build/components/collaborators-presence/avatar/types.cjs +19 -0
- package/build/components/collaborators-presence/avatar/types.cjs.map +7 -0
- package/build/components/collaborators-presence/avatar/use-image-loading-status.cjs +44 -0
- package/build/components/collaborators-presence/avatar/use-image-loading-status.cjs.map +7 -0
- package/build/components/collaborators-presence/avatar-group/component.cjs +78 -0
- package/build/components/collaborators-presence/avatar-group/component.cjs.map +7 -0
- package/build/components/collaborators-presence/avatar-group/index.cjs +37 -0
- package/build/components/collaborators-presence/avatar-group/index.cjs.map +7 -0
- package/build/components/collaborators-presence/avatar-group/types.cjs +19 -0
- package/build/components/collaborators-presence/avatar-group/types.cjs.map +7 -0
- package/build/components/collaborators-presence/index.cjs +54 -17
- package/build/components/collaborators-presence/index.cjs.map +3 -3
- package/build/components/collaborators-presence/list.cjs +43 -37
- package/build/components/collaborators-presence/list.cjs.map +3 -3
- package/build/components/collaborators-presence/use-collaborator-notifications.cjs +79 -107
- package/build/components/collaborators-presence/use-collaborator-notifications.cjs.map +3 -3
- package/build/components/editor-interface/index.cjs +9 -6
- package/build/components/editor-interface/index.cjs.map +2 -2
- package/build/components/entities-saved-states/hooks/use-is-dirty.cjs +14 -5
- package/build/components/entities-saved-states/hooks/use-is-dirty.cjs.map +2 -2
- package/build/components/global-styles/index.cjs +15 -24
- package/build/components/global-styles/index.cjs.map +3 -3
- package/build/components/global-styles-sidebar/index.cjs +6 -3
- package/build/components/global-styles-sidebar/index.cjs.map +2 -2
- package/build/components/inserter-sidebar/index.cjs +2 -1
- package/build/components/inserter-sidebar/index.cjs.map +2 -2
- package/build/components/page-attributes/parent.cjs +2 -1
- package/build/components/page-attributes/parent.cjs.map +2 -2
- package/build/components/post-revisions-preview/revisions-canvas.cjs +8 -58
- package/build/components/post-revisions-preview/revisions-canvas.cjs.map +3 -3
- package/build/components/post-revisions-preview/revisions-slider.cjs +5 -1
- package/build/components/post-revisions-preview/revisions-slider.cjs.map +2 -2
- package/build/components/post-url/panel.cjs +1 -0
- package/build/components/post-url/panel.cjs.map +2 -2
- package/build/components/preferences-modal/index.cjs +24 -0
- package/build/components/preferences-modal/index.cjs.map +2 -2
- package/build/components/provider/disable-non-page-content-blocks.cjs +31 -28
- package/build/components/provider/disable-non-page-content-blocks.cjs.map +3 -3
- package/build/components/provider/index.cjs +17 -5
- package/build/components/provider/index.cjs.map +2 -2
- package/build/components/provider/use-block-editor-settings.cjs +21 -6
- package/build/components/provider/use-block-editor-settings.cjs.map +3 -3
- package/build/components/provider/{use-post-content-blocks.cjs → use-post-content-block-types.cjs} +8 -19
- package/build/components/provider/use-post-content-block-types.cjs.map +7 -0
- package/build/components/provider/use-revision-blocks.cjs +106 -0
- package/build/components/provider/use-revision-blocks.cjs.map +7 -0
- package/build/components/sidebar/dataform-post-summary.cjs +182 -0
- package/build/components/sidebar/dataform-post-summary.cjs.map +7 -0
- package/build/components/sidebar/header.cjs +1 -1
- package/build/components/sidebar/header.cjs.map +2 -2
- package/build/components/sidebar/post-summary.cjs +11 -0
- package/build/components/sidebar/post-summary.cjs.map +3 -3
- package/build/components/sync-connection-modal/index.cjs +8 -5
- package/build/components/sync-connection-modal/index.cjs.map +2 -2
- package/build/components/template-content-panel/index.cjs +35 -31
- package/build/components/template-content-panel/index.cjs.map +3 -3
- package/build/components/visual-editor/index.cjs +1 -1
- package/build/components/visual-editor/index.cjs.map +2 -2
- package/build/dataviews/store/private-actions.cjs +4 -0
- package/build/dataviews/store/private-actions.cjs.map +2 -2
- package/build/store/private-actions.cjs +11 -2
- package/build/store/private-actions.cjs.map +2 -2
- package/build/store/private-selectors.cjs +52 -13
- package/build/store/private-selectors.cjs.map +2 -2
- package/build/store/reducer.cjs +12 -0
- package/build/store/reducer.cjs.map +2 -2
- package/build/utils/media-upload/on-success.cjs +46 -0
- package/build/utils/media-upload/on-success.cjs.map +7 -0
- package/build-module/components/collab-sidebar/index.mjs +7 -4
- package/build-module/components/collab-sidebar/index.mjs.map +2 -2
- package/build-module/components/collab-sidebar/utils.mjs +13 -15
- package/build-module/components/collab-sidebar/utils.mjs.map +2 -2
- package/build-module/components/collaborators-overlay/avatar-iframe-styles.mjs +128 -0
- package/build-module/components/collaborators-overlay/avatar-iframe-styles.mjs.map +7 -0
- package/build-module/components/collaborators-overlay/collaborator-styles.mjs +25 -1
- package/build-module/components/collaborators-overlay/collaborator-styles.mjs.map +2 -2
- package/build-module/components/collaborators-overlay/compute-selection.mjs +162 -0
- package/build-module/components/collaborators-overlay/compute-selection.mjs.map +7 -0
- package/build-module/components/collaborators-overlay/cursor-dom-utils.mjs +213 -0
- package/build-module/components/collaborators-overlay/cursor-dom-utils.mjs.map +7 -0
- package/build-module/components/collaborators-overlay/overlay-iframe-styles.mjs +130 -0
- package/build-module/components/collaborators-overlay/overlay-iframe-styles.mjs.map +7 -0
- package/build-module/components/collaborators-overlay/overlay.mjs +91 -230
- package/build-module/components/collaborators-overlay/overlay.mjs.map +2 -2
- package/build-module/components/collaborators-overlay/use-block-highlighting.mjs +91 -43
- package/build-module/components/collaborators-overlay/use-block-highlighting.mjs.map +2 -2
- package/build-module/components/collaborators-overlay/use-debounced-recompute.mjs +24 -0
- package/build-module/components/collaborators-overlay/use-debounced-recompute.mjs.map +7 -0
- package/build-module/components/collaborators-overlay/use-render-cursors.mjs +81 -172
- package/build-module/components/collaborators-overlay/use-render-cursors.mjs.map +2 -2
- package/build-module/components/collaborators-presence/avatar/component.mjs +90 -0
- package/build-module/components/collaborators-presence/avatar/component.mjs.map +7 -0
- package/build-module/components/collaborators-presence/avatar/index.mjs +6 -0
- package/build-module/components/collaborators-presence/avatar/index.mjs.map +7 -0
- package/build-module/components/collaborators-presence/avatar/types.mjs +1 -0
- package/build-module/components/collaborators-presence/avatar/types.mjs.map +7 -0
- package/build-module/components/collaborators-presence/avatar/use-image-loading-status.mjs +19 -0
- package/build-module/components/collaborators-presence/avatar/use-image-loading-status.mjs.map +7 -0
- package/build-module/components/collaborators-presence/avatar-group/component.mjs +47 -0
- package/build-module/components/collaborators-presence/avatar-group/component.mjs.map +7 -0
- package/build-module/components/collaborators-presence/avatar-group/index.mjs +6 -0
- package/build-module/components/collaborators-presence/avatar-group/index.mjs.map +7 -0
- package/build-module/components/collaborators-presence/avatar-group/types.mjs +1 -0
- package/build-module/components/collaborators-presence/avatar-group/types.mjs.map +7 -0
- package/build-module/components/collaborators-presence/index.mjs +45 -21
- package/build-module/components/collaborators-presence/index.mjs.map +2 -2
- package/build-module/components/collaborators-presence/list.mjs +35 -43
- package/build-module/components/collaborators-presence/list.mjs.map +2 -2
- package/build-module/components/collaborators-presence/use-collaborator-notifications.mjs +80 -108
- package/build-module/components/collaborators-presence/use-collaborator-notifications.mjs.map +2 -2
- package/build-module/components/editor-interface/index.mjs +10 -7
- package/build-module/components/editor-interface/index.mjs.map +2 -2
- package/build-module/components/entities-saved-states/hooks/use-is-dirty.mjs +14 -5
- package/build-module/components/entities-saved-states/hooks/use-is-dirty.mjs.map +2 -2
- package/build-module/components/global-styles/index.mjs +15 -24
- package/build-module/components/global-styles/index.mjs.map +2 -2
- package/build-module/components/global-styles-sidebar/index.mjs +6 -3
- package/build-module/components/global-styles-sidebar/index.mjs.map +2 -2
- package/build-module/components/inserter-sidebar/index.mjs +2 -1
- package/build-module/components/inserter-sidebar/index.mjs.map +2 -2
- package/build-module/components/page-attributes/parent.mjs +2 -1
- package/build-module/components/page-attributes/parent.mjs.map +2 -2
- package/build-module/components/post-revisions-preview/revisions-canvas.mjs +10 -63
- package/build-module/components/post-revisions-preview/revisions-canvas.mjs.map +2 -2
- package/build-module/components/post-revisions-preview/revisions-slider.mjs +5 -1
- package/build-module/components/post-revisions-preview/revisions-slider.mjs.map +2 -2
- package/build-module/components/post-url/panel.mjs +1 -0
- package/build-module/components/post-url/panel.mjs.map +2 -2
- package/build-module/components/preferences-modal/index.mjs +24 -0
- package/build-module/components/preferences-modal/index.mjs.map +2 -2
- package/build-module/components/provider/disable-non-page-content-blocks.mjs +31 -28
- package/build-module/components/provider/disable-non-page-content-blocks.mjs.map +2 -2
- package/build-module/components/provider/index.mjs +17 -5
- package/build-module/components/provider/index.mjs.map +2 -2
- package/build-module/components/provider/use-block-editor-settings.mjs +21 -6
- package/build-module/components/provider/use-block-editor-settings.mjs.map +2 -2
- package/build-module/components/provider/use-post-content-block-types.mjs +23 -0
- package/build-module/components/provider/use-post-content-block-types.mjs.map +7 -0
- package/build-module/components/provider/use-revision-blocks.mjs +81 -0
- package/build-module/components/provider/use-revision-blocks.mjs.map +7 -0
- package/build-module/components/sidebar/dataform-post-summary.mjs +151 -0
- package/build-module/components/sidebar/dataform-post-summary.mjs.map +7 -0
- package/build-module/components/sidebar/header.mjs +1 -1
- package/build-module/components/sidebar/header.mjs.map +2 -2
- package/build-module/components/sidebar/post-summary.mjs +11 -0
- package/build-module/components/sidebar/post-summary.mjs.map +2 -2
- package/build-module/components/sync-connection-modal/index.mjs +8 -5
- package/build-module/components/sync-connection-modal/index.mjs.map +2 -2
- package/build-module/components/template-content-panel/index.mjs +25 -31
- package/build-module/components/template-content-panel/index.mjs.map +2 -2
- package/build-module/components/visual-editor/index.mjs +1 -1
- package/build-module/components/visual-editor/index.mjs.map +2 -2
- package/build-module/dataviews/store/private-actions.mjs +8 -1
- package/build-module/dataviews/store/private-actions.mjs.map +2 -2
- package/build-module/store/private-actions.mjs +10 -2
- package/build-module/store/private-actions.mjs.map +2 -2
- package/build-module/store/private-selectors.mjs +50 -12
- package/build-module/store/private-selectors.mjs.map +2 -2
- package/build-module/store/reducer.mjs +11 -0
- package/build-module/store/reducer.mjs.map +2 -2
- package/build-module/utils/media-upload/on-success.mjs +25 -0
- package/build-module/utils/media-upload/on-success.mjs.map +7 -0
- package/build-style/style-rtl.css +961 -159
- package/build-style/style.css +961 -159
- package/build-types/components/collab-sidebar/index.d.ts.map +1 -1
- package/build-types/components/collab-sidebar/utils.d.ts.map +1 -1
- package/build-types/components/collaborators-overlay/avatar-iframe-styles.d.ts +11 -0
- package/build-types/components/collaborators-overlay/avatar-iframe-styles.d.ts.map +1 -0
- package/build-types/components/collaborators-overlay/collaborator-styles.d.ts +17 -2
- package/build-types/components/collaborators-overlay/collaborator-styles.d.ts.map +1 -1
- package/build-types/components/collaborators-overlay/compute-selection.d.ts +24 -0
- package/build-types/components/collaborators-overlay/compute-selection.d.ts.map +1 -0
- package/build-types/components/collaborators-overlay/cursor-dom-utils.d.ts +72 -0
- package/build-types/components/collaborators-overlay/cursor-dom-utils.d.ts.map +1 -0
- package/build-types/components/collaborators-overlay/overlay-iframe-styles.d.ts +6 -0
- package/build-types/components/collaborators-overlay/overlay-iframe-styles.d.ts.map +1 -0
- package/build-types/components/collaborators-overlay/overlay.d.ts.map +1 -1
- package/build-types/components/collaborators-overlay/use-block-highlighting.d.ts +21 -5
- package/build-types/components/collaborators-overlay/use-block-highlighting.d.ts.map +1 -1
- package/build-types/components/collaborators-overlay/use-debounced-recompute.d.ts +10 -0
- package/build-types/components/collaborators-overlay/use-debounced-recompute.d.ts.map +1 -0
- package/build-types/components/collaborators-overlay/use-render-cursors.d.ts +6 -1
- package/build-types/components/collaborators-overlay/use-render-cursors.d.ts.map +1 -1
- package/build-types/components/collaborators-presence/avatar/component.d.ts +7 -0
- package/build-types/components/collaborators-presence/avatar/component.d.ts.map +1 -0
- package/build-types/components/collaborators-presence/avatar/index.d.ts +3 -0
- package/build-types/components/collaborators-presence/avatar/index.d.ts.map +1 -0
- package/build-types/components/collaborators-presence/avatar/types.d.ts +66 -0
- package/build-types/components/collaborators-presence/avatar/types.d.ts.map +1 -0
- package/build-types/components/collaborators-presence/avatar/use-image-loading-status.d.ts +17 -0
- package/build-types/components/collaborators-presence/avatar/use-image-loading-status.d.ts.map +1 -0
- package/build-types/components/collaborators-presence/avatar-group/component.d.ts +7 -0
- package/build-types/components/collaborators-presence/avatar-group/component.d.ts.map +1 -0
- package/build-types/components/collaborators-presence/avatar-group/index.d.ts +3 -0
- package/build-types/components/collaborators-presence/avatar-group/index.d.ts.map +1 -0
- package/build-types/components/collaborators-presence/avatar-group/types.d.ts +14 -0
- package/build-types/components/collaborators-presence/avatar-group/types.d.ts.map +1 -0
- package/build-types/components/collaborators-presence/index.d.ts.map +1 -1
- package/build-types/components/collaborators-presence/list.d.ts +2 -1
- package/build-types/components/collaborators-presence/list.d.ts.map +1 -1
- package/build-types/components/collaborators-presence/use-collaborator-notifications.d.ts.map +1 -1
- package/build-types/components/editor-interface/index.d.ts.map +1 -1
- package/build-types/components/entities-saved-states/hooks/use-is-dirty.d.ts.map +1 -1
- package/build-types/components/global-styles/index.d.ts +2 -1
- package/build-types/components/global-styles/index.d.ts.map +1 -1
- package/build-types/components/global-styles-sidebar/index.d.ts.map +1 -1
- package/build-types/components/inserter-sidebar/index.d.ts.map +1 -1
- package/build-types/components/page-attributes/parent.d.ts.map +1 -1
- package/build-types/components/post-author/hook.d.ts +1 -1
- package/build-types/components/post-revisions-preview/revisions-canvas.d.ts +2 -5
- package/build-types/components/post-revisions-preview/revisions-canvas.d.ts.map +1 -1
- package/build-types/components/post-revisions-preview/revisions-slider.d.ts.map +1 -1
- package/build-types/components/provider/disable-non-page-content-blocks.d.ts.map +1 -1
- package/build-types/components/provider/index.d.ts.map +1 -1
- package/build-types/components/provider/use-block-editor-settings.d.ts.map +1 -1
- package/build-types/components/provider/use-post-content-block-types.d.ts +9 -0
- package/build-types/components/provider/use-post-content-block-types.d.ts.map +1 -0
- package/build-types/components/provider/use-revision-blocks.d.ts +10 -0
- package/build-types/components/provider/use-revision-blocks.d.ts.map +1 -0
- package/build-types/components/sidebar/dataform-post-summary.d.ts +4 -0
- package/build-types/components/sidebar/dataform-post-summary.d.ts.map +1 -0
- package/build-types/components/sidebar/post-summary.d.ts.map +1 -1
- package/build-types/components/sync-connection-modal/index.d.ts.map +1 -1
- package/build-types/components/template-content-panel/index.d.ts.map +1 -1
- package/build-types/dataviews/store/private-actions.d.ts.map +1 -1
- package/build-types/store/private-actions.d.ts +7 -0
- package/build-types/store/private-actions.d.ts.map +1 -1
- package/build-types/store/private-selectors.d.ts +7 -0
- package/build-types/store/private-selectors.d.ts.map +1 -1
- package/build-types/store/reducer.d.ts +14 -3
- package/build-types/store/reducer.d.ts.map +1 -1
- package/build-types/utils/media-upload/on-success.d.ts +9 -0
- package/build-types/utils/media-upload/on-success.d.ts.map +1 -0
- package/package.json +45 -44
- package/src/components/collab-sidebar/index.js +7 -4
- package/src/components/collab-sidebar/utils.js +9 -10
- package/src/components/collaborators-overlay/avatar-iframe-styles.ts +134 -0
- package/src/components/collaborators-overlay/collaborator-styles.ts +43 -2
- package/src/components/collaborators-overlay/compute-selection.ts +307 -0
- package/src/components/collaborators-overlay/cursor-dom-utils.ts +382 -0
- package/src/components/collaborators-overlay/overlay-iframe-styles.ts +131 -0
- package/src/components/collaborators-overlay/overlay.tsx +86 -226
- package/src/components/collaborators-overlay/use-block-highlighting.ts +147 -63
- package/src/components/collaborators-overlay/use-debounced-recompute.ts +32 -0
- package/src/components/collaborators-overlay/use-render-cursors.ts +113 -279
- package/src/components/collaborators-presence/avatar/component.tsx +123 -0
- package/src/components/collaborators-presence/avatar/index.ts +2 -0
- package/src/components/collaborators-presence/avatar/styles.scss +184 -0
- package/src/components/collaborators-presence/avatar/test/index.tsx +389 -0
- package/src/components/collaborators-presence/avatar/types.ts +66 -0
- package/src/components/collaborators-presence/avatar/use-image-loading-status.ts +36 -0
- package/src/components/collaborators-presence/avatar-group/component.tsx +55 -0
- package/src/components/collaborators-presence/avatar-group/index.ts +2 -0
- package/src/components/collaborators-presence/avatar-group/styles.scss +33 -0
- package/src/components/collaborators-presence/avatar-group/test/index.tsx +139 -0
- package/src/components/collaborators-presence/avatar-group/types.ts +13 -0
- package/src/components/collaborators-presence/index.tsx +34 -11
- package/src/components/collaborators-presence/list.tsx +44 -40
- package/src/components/collaborators-presence/styles/collaborators-list.scss +26 -19
- package/src/components/collaborators-presence/styles/collaborators-presence.scss +6 -2
- package/src/components/collaborators-presence/test/use-collaborator-notifications.ts +188 -246
- package/src/components/collaborators-presence/use-collaborator-notifications.ts +109 -166
- package/src/components/document-bar/style.scss +1 -1
- package/src/components/editor-interface/index.js +8 -6
- package/src/components/entities-saved-states/hooks/use-is-dirty.js +14 -5
- package/src/components/global-styles/index.js +20 -27
- package/src/components/global-styles-sidebar/index.js +3 -0
- package/src/components/inserter-sidebar/index.js +4 -1
- package/src/components/page-attributes/parent.js +2 -1
- package/src/components/post-publish-panel/test/__snapshots__/index.js.snap +2 -2
- package/src/components/post-revisions-preview/revisions-canvas.js +15 -84
- package/src/components/post-revisions-preview/revisions-slider.js +6 -1
- package/src/components/post-url/panel.js +1 -0
- package/src/components/post-url/style.scss +5 -0
- package/src/components/preferences-modal/index.js +18 -0
- package/src/components/provider/disable-non-page-content-blocks.js +42 -40
- package/src/components/provider/index.js +20 -2
- package/src/components/provider/use-block-editor-settings.js +24 -8
- package/src/components/provider/use-post-content-block-types.js +30 -0
- package/src/components/provider/use-revision-blocks.js +105 -0
- package/src/components/sidebar/dataform-post-summary.js +170 -0
- package/src/components/sidebar/header.js +1 -1
- package/src/components/sidebar/post-summary.js +15 -0
- package/src/components/sync-connection-modal/index.js +12 -6
- package/src/components/sync-connection-modal/style.scss +5 -0
- package/src/components/template-content-panel/index.js +30 -38
- package/src/components/visual-editor/index.js +1 -1
- package/src/dataviews/store/private-actions.ts +14 -0
- package/src/store/private-actions.js +21 -2
- package/src/store/private-selectors.js +75 -10
- package/src/store/reducer.js +19 -0
- package/src/style.scss +3 -0
- package/src/utils/media-upload/on-success.js +34 -0
- package/build/components/provider/use-post-content-blocks.cjs.map +0 -7
- package/build-module/components/provider/use-post-content-blocks.mjs +0 -34
- package/build-module/components/provider/use-post-content-blocks.mjs.map +0 -7
- package/build-types/components/provider/use-post-content-blocks.d.ts +0 -2
- package/build-types/components/provider/use-post-content-blocks.d.ts.map +0 -1
- package/src/components/provider/use-post-content-blocks.js +0 -42
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
5
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
8
|
var __export = (target, all) => {
|
|
7
9
|
for (var name in all)
|
|
@@ -15,6 +17,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
17
|
}
|
|
16
18
|
return to;
|
|
17
19
|
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
18
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
29
|
|
|
20
30
|
// packages/editor/src/components/collaborators-overlay/overlay.tsx
|
|
@@ -23,201 +33,16 @@ __export(overlay_exports, {
|
|
|
23
33
|
Overlay: () => Overlay
|
|
24
34
|
});
|
|
25
35
|
module.exports = __toCommonJS(overlay_exports);
|
|
26
|
-
var import_components = require("@wordpress/components");
|
|
27
36
|
var import_compose = require("@wordpress/compose");
|
|
28
37
|
var import_element = require("@wordpress/element");
|
|
29
|
-
var
|
|
38
|
+
var import_i18n = require("@wordpress/i18n");
|
|
39
|
+
var import_avatar = __toESM(require("../collaborators-presence/avatar/index.cjs"));
|
|
40
|
+
var import_avatar_iframe_styles = require("./avatar-iframe-styles.cjs");
|
|
41
|
+
var import_overlay_iframe_styles = require("./overlay-iframe-styles.cjs");
|
|
30
42
|
var import_use_block_highlighting = require("./use-block-highlighting.cjs");
|
|
31
43
|
var import_use_render_cursors = require("./use-render-cursors.cjs");
|
|
32
|
-
var import_collaborator_styles = require("./collaborator-styles.cjs");
|
|
33
44
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
34
|
-
var
|
|
35
|
-
var COLLABORATORS_OVERLAY_STYLES = `
|
|
36
|
-
.block-canvas-cover {
|
|
37
|
-
position: absolute;
|
|
38
|
-
top: 0;
|
|
39
|
-
left: 0;
|
|
40
|
-
width: 100%;
|
|
41
|
-
height: 100%;
|
|
42
|
-
pointer-events: none;
|
|
43
|
-
z-index: 20000;
|
|
44
|
-
}
|
|
45
|
-
.block-canvas-cover .collaborators-overlay-full {
|
|
46
|
-
position: absolute;
|
|
47
|
-
top: 0;
|
|
48
|
-
left: 0;
|
|
49
|
-
width: 100%;
|
|
50
|
-
height: 100%;
|
|
51
|
-
}
|
|
52
|
-
.block-canvas-cover .collaborators-overlay-fixed {
|
|
53
|
-
position: fixed;
|
|
54
|
-
width: 100%;
|
|
55
|
-
height: 100%;
|
|
56
|
-
}
|
|
57
|
-
.collaborators-overlay-user {
|
|
58
|
-
position: absolute;
|
|
59
|
-
}
|
|
60
|
-
.collaborators-overlay-user-cursor {
|
|
61
|
-
position: absolute;
|
|
62
|
-
width: 2px;
|
|
63
|
-
border-radius: 1px;
|
|
64
|
-
outline: 1px solid #fff;
|
|
65
|
-
box-shadow: ${import_collaborator_styles.ELEVATION_X_SMALL};
|
|
66
|
-
animation: collaborators-overlay-cursor-blink 1s infinite;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
/* \u2500\u2500 Avatar component (compiled from packages/components/src/avatar/styles.scss) \u2500\u2500 */
|
|
70
|
-
.components-avatar {
|
|
71
|
-
display: inline-flex;
|
|
72
|
-
align-items: center;
|
|
73
|
-
border-radius: 9999px;
|
|
74
|
-
overflow: clip;
|
|
75
|
-
flex-shrink: 0;
|
|
76
|
-
background-color: var(--wp-components-color-accent, var(--wp-admin-theme-color, #3858e9));
|
|
77
|
-
box-shadow: 0 0 0 var(--wp-admin-border-width-focus, 2px) #fff, ${import_collaborator_styles.ELEVATION_X_SMALL};
|
|
78
|
-
}
|
|
79
|
-
.components-avatar__image {
|
|
80
|
-
box-sizing: border-box;
|
|
81
|
-
position: relative;
|
|
82
|
-
width: 32px;
|
|
83
|
-
height: 32px;
|
|
84
|
-
border-radius: 9999px;
|
|
85
|
-
border: 0;
|
|
86
|
-
background-color: var(--wp-components-color-accent, var(--wp-admin-theme-color, #3858e9));
|
|
87
|
-
overflow: clip;
|
|
88
|
-
flex-shrink: 0;
|
|
89
|
-
font-size: 0;
|
|
90
|
-
color: #fff;
|
|
91
|
-
}
|
|
92
|
-
.is-small > .components-avatar__image {
|
|
93
|
-
width: 24px;
|
|
94
|
-
height: 24px;
|
|
95
|
-
}
|
|
96
|
-
.has-src > .components-avatar__image {
|
|
97
|
-
background-image: var(--components-avatar-url);
|
|
98
|
-
background-size: cover;
|
|
99
|
-
background-position: center;
|
|
100
|
-
}
|
|
101
|
-
.has-avatar-border-color > .components-avatar__image {
|
|
102
|
-
border: var(--wp-admin-border-width-focus, 2px) solid var(--components-avatar-outline-color);
|
|
103
|
-
box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus, 2px) #fff;
|
|
104
|
-
background-clip: padding-box;
|
|
105
|
-
}
|
|
106
|
-
.components-avatar:not(.has-src) > .components-avatar__image {
|
|
107
|
-
display: flex;
|
|
108
|
-
align-items: center;
|
|
109
|
-
justify-content: center;
|
|
110
|
-
font-size: 11px;
|
|
111
|
-
font-weight: 499;
|
|
112
|
-
border: 0;
|
|
113
|
-
box-shadow: none;
|
|
114
|
-
background-clip: border-box;
|
|
115
|
-
}
|
|
116
|
-
.components-avatar:not(.has-src).has-avatar-border-color > .components-avatar__image {
|
|
117
|
-
background-color: var(--components-avatar-outline-color);
|
|
118
|
-
}
|
|
119
|
-
.components-avatar__name {
|
|
120
|
-
font-size: 13px;
|
|
121
|
-
line-height: 20px;
|
|
122
|
-
color: #fff;
|
|
123
|
-
min-width: 0;
|
|
124
|
-
padding-bottom: 2px;
|
|
125
|
-
overflow: hidden;
|
|
126
|
-
opacity: 0;
|
|
127
|
-
white-space: nowrap;
|
|
128
|
-
transition: opacity 0.15s cubic-bezier(0.15, 0, 0.15, 1);
|
|
129
|
-
}
|
|
130
|
-
.components-avatar.has-badge {
|
|
131
|
-
display: inline-grid;
|
|
132
|
-
grid-template-columns: min-content 0fr;
|
|
133
|
-
column-gap: 0;
|
|
134
|
-
padding-inline-end: 0;
|
|
135
|
-
transition:
|
|
136
|
-
grid-template-columns 0.3s cubic-bezier(0.15, 0, 0.15, 1),
|
|
137
|
-
column-gap 0.3s cubic-bezier(0.15, 0, 0.15, 1),
|
|
138
|
-
padding-inline-end 0.3s cubic-bezier(0.15, 0, 0.15, 1);
|
|
139
|
-
}
|
|
140
|
-
.components-avatar.has-badge:hover {
|
|
141
|
-
grid-template-columns: min-content 1fr;
|
|
142
|
-
column-gap: 4px;
|
|
143
|
-
padding-inline-end: 8px;
|
|
144
|
-
transition-timing-function: cubic-bezier(0.85, 0, 0.85, 1);
|
|
145
|
-
}
|
|
146
|
-
.components-avatar.has-badge:hover .components-avatar__name {
|
|
147
|
-
opacity: 1;
|
|
148
|
-
transition-timing-function: cubic-bezier(0.85, 0, 0.85, 1);
|
|
149
|
-
}
|
|
150
|
-
.components-avatar.has-badge.has-avatar-border-color {
|
|
151
|
-
background-color: var(--components-avatar-outline-color);
|
|
152
|
-
}
|
|
153
|
-
/* \u2500\u2500 end Avatar \u2500\u2500 */
|
|
154
|
-
|
|
155
|
-
/* Overlay-specific positioning applied to the Avatar cursor label. */
|
|
156
|
-
.collaborators-overlay-user-label.components-avatar {
|
|
157
|
-
position: absolute;
|
|
158
|
-
transform: translate(-11px, -100%);
|
|
159
|
-
margin-top: -4px;
|
|
160
|
-
pointer-events: auto;
|
|
161
|
-
overflow: visible;
|
|
162
|
-
width: max-content;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
@keyframes collaborators-overlay-cursor-blink {
|
|
166
|
-
0%, 45% { opacity: 1; }
|
|
167
|
-
55%, 95% { opacity: 0; }
|
|
168
|
-
100% { opacity: 1; }
|
|
169
|
-
}
|
|
170
|
-
.collaborators-overlay-cursor-highlighted .collaborators-overlay-user-cursor {
|
|
171
|
-
animation: collaborators-overlay-cursor-highlight 0.6s ease-in-out 3;
|
|
172
|
-
}
|
|
173
|
-
.collaborators-overlay-cursor-highlighted .collaborators-overlay-user-label {
|
|
174
|
-
animation: collaborators-overlay-label-highlight 0.6s ease-in-out 3;
|
|
175
|
-
}
|
|
176
|
-
@keyframes collaborators-overlay-cursor-highlight {
|
|
177
|
-
0%, 100% {
|
|
178
|
-
transform: scale(1);
|
|
179
|
-
filter: drop-shadow(0 0 0 transparent);
|
|
180
|
-
}
|
|
181
|
-
50% {
|
|
182
|
-
transform: scale(1.2);
|
|
183
|
-
filter: drop-shadow(0 0 8px currentColor);
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
@keyframes collaborators-overlay-label-highlight {
|
|
187
|
-
0%, 100% {
|
|
188
|
-
transform: translate(-11px, -100%) scale(1);
|
|
189
|
-
filter: drop-shadow(0 0 0 transparent);
|
|
190
|
-
}
|
|
191
|
-
50% {
|
|
192
|
-
transform: translate(-11px, -100%) scale(1.1);
|
|
193
|
-
filter: drop-shadow(0 0 6px currentColor);
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
.block-editor-block-list__block.is-collaborator-selected:not(:focus)::after {
|
|
197
|
-
content: "";
|
|
198
|
-
position: absolute;
|
|
199
|
-
pointer-events: none;
|
|
200
|
-
top: 0;
|
|
201
|
-
right: 0;
|
|
202
|
-
bottom: 0;
|
|
203
|
-
left: 0;
|
|
204
|
-
outline-color: var(--collaborator-outline-color);
|
|
205
|
-
outline-style: solid;
|
|
206
|
-
outline-width: calc(var(--wp-admin-border-width-focus) / var(--wp-block-editor-iframe-zoom-out-scale, 1));
|
|
207
|
-
outline-offset: calc(-1 * var(--wp-admin-border-width-focus) / var(--wp-block-editor-iframe-zoom-out-scale, 1));
|
|
208
|
-
box-shadow: inset 0 0 0 calc(var(--wp-admin-border-width-focus, 2px) + 1px) #fff, 0 0 0 1px #fff, ${import_collaborator_styles.ELEVATION_X_SMALL};
|
|
209
|
-
z-index: 1;
|
|
210
|
-
}
|
|
211
|
-
@media (prefers-reduced-motion: reduce) {
|
|
212
|
-
.components-avatar.has-badge,
|
|
213
|
-
.components-avatar__name,
|
|
214
|
-
.collaborators-overlay-user-label,
|
|
215
|
-
.collaborators-overlay-user-cursor {
|
|
216
|
-
transition: none;
|
|
217
|
-
animation: none;
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
`;
|
|
45
|
+
var RERENDER_DELAY_MS = 500;
|
|
221
46
|
function Overlay({
|
|
222
47
|
blockEditorDocument,
|
|
223
48
|
postId,
|
|
@@ -228,54 +53,100 @@ function Overlay({
|
|
|
228
53
|
overlayElement,
|
|
229
54
|
blockEditorDocument ?? null,
|
|
230
55
|
postId ?? null,
|
|
231
|
-
postType ?? null
|
|
56
|
+
postType ?? null,
|
|
57
|
+
RERENDER_DELAY_MS
|
|
58
|
+
);
|
|
59
|
+
const { highlights, rerenderHighlightsAfterDelay } = (0, import_use_block_highlighting.useBlockHighlighting)(
|
|
60
|
+
overlayElement,
|
|
61
|
+
blockEditorDocument ?? null,
|
|
62
|
+
postId ?? null,
|
|
63
|
+
postType ?? null,
|
|
64
|
+
RERENDER_DELAY_MS
|
|
232
65
|
);
|
|
233
|
-
const
|
|
234
|
-
|
|
66
|
+
const onResize = (0, import_element.useCallback)(() => {
|
|
67
|
+
rerenderCursorsAfterDelay();
|
|
68
|
+
rerenderHighlightsAfterDelay();
|
|
69
|
+
}, [rerenderCursorsAfterDelay, rerenderHighlightsAfterDelay]);
|
|
70
|
+
const resizeObserverRef = (0, import_compose.useResizeObserver)(onResize);
|
|
71
|
+
(0, import_element.useEffect)(() => {
|
|
72
|
+
const cleanupCursors = rerenderCursorsAfterDelay();
|
|
73
|
+
const cleanupHighlights = rerenderHighlightsAfterDelay();
|
|
74
|
+
return () => {
|
|
75
|
+
cleanupCursors();
|
|
76
|
+
cleanupHighlights();
|
|
77
|
+
};
|
|
78
|
+
}, [rerenderCursorsAfterDelay, rerenderHighlightsAfterDelay]);
|
|
235
79
|
const mergedRef = (0, import_compose.useMergeRefs)([
|
|
236
80
|
setOverlayElement,
|
|
237
81
|
resizeObserverRef
|
|
238
82
|
]);
|
|
239
|
-
(0, import_use_block_highlighting.useBlockHighlighting)(
|
|
240
|
-
blockEditorDocument ?? null,
|
|
241
|
-
postId ?? null,
|
|
242
|
-
postType ?? null
|
|
243
|
-
);
|
|
244
83
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "collaborators-overlay-full", ref: mergedRef, children: [
|
|
245
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("style", { children:
|
|
246
|
-
cursors.map((cursor) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
84
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("style", { children: import_avatar_iframe_styles.AVATAR_IFRAME_STYLES + import_overlay_iframe_styles.OVERLAY_IFRAME_STYLES }),
|
|
85
|
+
cursors.map((cursor) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
|
|
86
|
+
!cursor.isMe && cursor.selectionRects?.map((rect, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
87
|
+
"div",
|
|
88
|
+
{
|
|
89
|
+
className: "collaborators-overlay-selection-rect",
|
|
90
|
+
style: {
|
|
91
|
+
left: `${rect.x}px`,
|
|
92
|
+
top: `${rect.y}px`,
|
|
93
|
+
width: `${rect.width}px`,
|
|
94
|
+
height: `${rect.height}px`,
|
|
95
|
+
backgroundColor: cursor.color
|
|
96
|
+
}
|
|
253
97
|
},
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
98
|
+
`${cursor.clientId}-sel-${index}`
|
|
99
|
+
)),
|
|
100
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
101
|
+
"div",
|
|
102
|
+
{
|
|
103
|
+
className: "collaborators-overlay-user",
|
|
104
|
+
style: {
|
|
105
|
+
left: `${cursor.x}px`,
|
|
106
|
+
top: `${cursor.y}px`
|
|
107
|
+
},
|
|
108
|
+
children: [
|
|
109
|
+
!cursor.isMe && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
110
|
+
"div",
|
|
111
|
+
{
|
|
112
|
+
className: "collaborators-overlay-user-cursor",
|
|
113
|
+
style: {
|
|
114
|
+
backgroundColor: cursor.color,
|
|
115
|
+
height: `${cursor.height}px`
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
),
|
|
119
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
120
|
+
import_avatar.default,
|
|
121
|
+
{
|
|
122
|
+
className: "collaborators-overlay-user-label",
|
|
123
|
+
variant: "badge",
|
|
124
|
+
size: "small",
|
|
125
|
+
src: cursor.avatarUrl,
|
|
126
|
+
name: cursor.userName,
|
|
127
|
+
label: cursor.isMe ? (0, import_i18n.__)("You") : void 0,
|
|
128
|
+
borderColor: cursor.color
|
|
262
129
|
}
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
130
|
+
)
|
|
131
|
+
]
|
|
132
|
+
}
|
|
133
|
+
)
|
|
134
|
+
] }, cursor.clientId)),
|
|
135
|
+
highlights.map((highlight) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
136
|
+
import_avatar.default,
|
|
137
|
+
{
|
|
138
|
+
className: "collaborators-overlay-block-label",
|
|
139
|
+
variant: "badge",
|
|
140
|
+
size: "small",
|
|
141
|
+
src: highlight.avatarUrl,
|
|
142
|
+
name: highlight.userName,
|
|
143
|
+
borderColor: highlight.color,
|
|
144
|
+
style: {
|
|
145
|
+
left: `${highlight.x}px`,
|
|
146
|
+
top: `${highlight.y}px`
|
|
147
|
+
}
|
|
277
148
|
},
|
|
278
|
-
|
|
149
|
+
highlight.blockId
|
|
279
150
|
))
|
|
280
151
|
] });
|
|
281
152
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/collaborators-overlay/overlay.tsx"],
|
|
4
|
-
"sourcesContent": ["import {
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["
|
|
4
|
+
"sourcesContent": ["import { useResizeObserver, useMergeRefs } from '@wordpress/compose';\nimport { useCallback, useEffect, useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\n\nimport Avatar from '../collaborators-presence/avatar';\nimport { AVATAR_IFRAME_STYLES } from './avatar-iframe-styles';\nimport { OVERLAY_IFRAME_STYLES } from './overlay-iframe-styles';\nimport { useBlockHighlighting } from './use-block-highlighting';\nimport { useRenderCursors } from './use-render-cursors';\n\nconst RERENDER_DELAY_MS = 500;\n\ninterface OverlayProps {\n\tblockEditorDocument?: Document;\n\tpostId: number | null;\n\tpostType: string | null;\n}\n\n/**\n * This component is responsible for rendering the overlay components within the editor iframe.\n *\n * @param props - The overlay props.\n * @param props.blockEditorDocument - The block editor document.\n * @param props.postId - The ID of the post.\n * @param props.postType - The type of the post.\n * @return The Overlay component.\n */\nexport function Overlay( {\n\tblockEditorDocument,\n\tpostId,\n\tpostType,\n}: OverlayProps ) {\n\t// Use state for the overlay element so that the hook re-runs once the ref is attached.\n\tconst [ overlayElement, setOverlayElement ] =\n\t\tuseState< HTMLDivElement | null >( null );\n\n\tconst { cursors, rerenderCursorsAfterDelay } = useRenderCursors(\n\t\toverlayElement,\n\t\tblockEditorDocument ?? null,\n\t\tpostId ?? null,\n\t\tpostType ?? null,\n\t\tRERENDER_DELAY_MS\n\t);\n\n\tconst { highlights, rerenderHighlightsAfterDelay } = useBlockHighlighting(\n\t\toverlayElement,\n\t\tblockEditorDocument ?? null,\n\t\tpostId ?? null,\n\t\tpostType ?? null,\n\t\tRERENDER_DELAY_MS\n\t);\n\n\t// Detect layout changes on overlay (e.g. turning on \"Show Template\") and window\n\t// resizes, and re-render the cursors and block highlights.\n\tconst onResize = useCallback( () => {\n\t\trerenderCursorsAfterDelay();\n\t\trerenderHighlightsAfterDelay();\n\t}, [ rerenderCursorsAfterDelay, rerenderHighlightsAfterDelay ] );\n\tconst resizeObserverRef = useResizeObserver( onResize );\n\n\t// Trigger the initial position computation on mount.\n\tuseEffect( () => {\n\t\tconst cleanupCursors = rerenderCursorsAfterDelay();\n\t\tconst cleanupHighlights = rerenderHighlightsAfterDelay();\n\t\treturn () => {\n\t\t\tcleanupCursors();\n\t\t\tcleanupHighlights();\n\t\t};\n\t}, [ rerenderCursorsAfterDelay, rerenderHighlightsAfterDelay ] );\n\n\t// Merge the refs to use the same element for both overlay and resize observation\n\tconst mergedRef = useMergeRefs< HTMLDivElement | null >( [\n\t\tsetOverlayElement,\n\t\tresizeObserverRef,\n\t] );\n\n\t// This is a full overlay that covers the entire iframe document. Good for\n\t// scrollable elements like cursor indicators.\n\treturn (\n\t\t<div className=\"collaborators-overlay-full\" ref={ mergedRef }>\n\t\t\t<style>{ AVATAR_IFRAME_STYLES + OVERLAY_IFRAME_STYLES }</style>\n\t\t\t{ cursors.map( ( cursor ) => (\n\t\t\t\t<div key={ cursor.clientId }>\n\t\t\t\t\t{ ! cursor.isMe &&\n\t\t\t\t\t\tcursor.selectionRects?.map( ( rect, index ) => (\n\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\tkey={ `${ cursor.clientId }-sel-${ index }` }\n\t\t\t\t\t\t\t\tclassName=\"collaborators-overlay-selection-rect\"\n\t\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\t\tleft: `${ rect.x }px`,\n\t\t\t\t\t\t\t\t\ttop: `${ rect.y }px`,\n\t\t\t\t\t\t\t\t\twidth: `${ rect.width }px`,\n\t\t\t\t\t\t\t\t\theight: `${ rect.height }px`,\n\t\t\t\t\t\t\t\t\tbackgroundColor: cursor.color,\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) ) }\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName=\"collaborators-overlay-user\"\n\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\tleft: `${ cursor.x }px`,\n\t\t\t\t\t\t\ttop: `${ cursor.y }px`,\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ ! cursor.isMe && (\n\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\tclassName=\"collaborators-overlay-user-cursor\"\n\t\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\t\tbackgroundColor: cursor.color,\n\t\t\t\t\t\t\t\t\theight: `${ cursor.height }px`,\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<Avatar\n\t\t\t\t\t\t\tclassName=\"collaborators-overlay-user-label\"\n\t\t\t\t\t\t\tvariant=\"badge\"\n\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\tsrc={ cursor.avatarUrl }\n\t\t\t\t\t\t\tname={ cursor.userName }\n\t\t\t\t\t\t\tlabel={ cursor.isMe ? __( 'You' ) : undefined }\n\t\t\t\t\t\t\tborderColor={ cursor.color }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t) ) }\n\t\t\t{ highlights.map( ( highlight ) => (\n\t\t\t\t<Avatar\n\t\t\t\t\tkey={ highlight.blockId }\n\t\t\t\t\tclassName=\"collaborators-overlay-block-label\"\n\t\t\t\t\tvariant=\"badge\"\n\t\t\t\t\tsize=\"small\"\n\t\t\t\t\tsrc={ highlight.avatarUrl }\n\t\t\t\t\tname={ highlight.userName }\n\t\t\t\t\tborderColor={ highlight.color }\n\t\t\t\t\tstyle={ {\n\t\t\t\t\t\tleft: `${ highlight.x }px`,\n\t\t\t\t\t\ttop: `${ highlight.y }px`,\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t) ) }\n\t\t</div>\n\t);\n}\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": ["Avatar"]
|
|
7
7
|
}
|
|
@@ -27,8 +27,10 @@ var import_core_data = require("@wordpress/core-data");
|
|
|
27
27
|
var import_element = require("@wordpress/element");
|
|
28
28
|
var import_lock_unlock = require("../../lock-unlock.cjs");
|
|
29
29
|
var import_utils = require("../collab-sidebar/utils.cjs");
|
|
30
|
+
var import_get_avatar_url = require("./get-avatar-url.cjs");
|
|
31
|
+
var import_use_debounced_recompute = require("./use-debounced-recompute.cjs");
|
|
30
32
|
var { useActiveCollaborators, useResolvedSelection } = (0, import_lock_unlock.unlock)(import_core_data.privateApis);
|
|
31
|
-
function useBlockHighlighting(blockEditorDocument, postId, postType) {
|
|
33
|
+
function useBlockHighlighting(overlayElement, blockEditorDocument, postId, postType, delayMs) {
|
|
32
34
|
const highlightedBlockIds = (0, import_element.useRef)(/* @__PURE__ */ new Set());
|
|
33
35
|
const userStates = useActiveCollaborators(
|
|
34
36
|
postId ?? null,
|
|
@@ -38,12 +40,55 @@ function useBlockHighlighting(blockEditorDocument, postId, postType) {
|
|
|
38
40
|
postId ?? null,
|
|
39
41
|
postType ?? null
|
|
40
42
|
);
|
|
43
|
+
const [highlights, setHighlights] = (0, import_element.useState)(
|
|
44
|
+
[]
|
|
45
|
+
);
|
|
46
|
+
const [recomputeToken, rerenderHighlightsAfterDelay] = (0, import_use_debounced_recompute.useDebouncedRecompute)(delayMs);
|
|
41
47
|
(0, import_element.useEffect)(() => {
|
|
42
|
-
if (blockEditorDocument
|
|
48
|
+
if (!blockEditorDocument) {
|
|
49
|
+
setHighlights([]);
|
|
43
50
|
return;
|
|
44
51
|
}
|
|
45
|
-
const
|
|
46
|
-
|
|
52
|
+
const currentHighlightedIds = highlightedBlockIds.current;
|
|
53
|
+
const seen = /* @__PURE__ */ new Set();
|
|
54
|
+
const blocksToHighlight = userStates.filter((userState) => {
|
|
55
|
+
const isWholeBlockSelected = userState.editorState?.selection?.type === import_core_data.SelectionType.WholeBlock;
|
|
56
|
+
return !userState.isMe && isWholeBlockSelected;
|
|
57
|
+
}).map((userState) => {
|
|
58
|
+
let localClientId;
|
|
59
|
+
try {
|
|
60
|
+
({ localClientId } = resolveSelection(
|
|
61
|
+
userState.editorState?.selection
|
|
62
|
+
));
|
|
63
|
+
} catch {
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
if (!localClientId) {
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
return {
|
|
70
|
+
blockId: localClientId,
|
|
71
|
+
color: userState.isMe ? "var(--wp-admin-theme-color)" : (0, import_utils.getAvatarBorderColor)(userState.collaboratorInfo.id),
|
|
72
|
+
userName: userState.collaboratorInfo.name,
|
|
73
|
+
avatarUrl: (0, import_get_avatar_url.getAvatarUrl)(
|
|
74
|
+
userState.collaboratorInfo.avatar_urls
|
|
75
|
+
)
|
|
76
|
+
};
|
|
77
|
+
}).filter((block) => {
|
|
78
|
+
if (!block) {
|
|
79
|
+
return false;
|
|
80
|
+
}
|
|
81
|
+
if (seen.has(block.blockId)) {
|
|
82
|
+
return false;
|
|
83
|
+
}
|
|
84
|
+
seen.add(block.blockId);
|
|
85
|
+
return true;
|
|
86
|
+
});
|
|
87
|
+
const selectedBlockIds = new Set(
|
|
88
|
+
blocksToHighlight.map((block) => block.blockId)
|
|
89
|
+
);
|
|
90
|
+
for (const blockId of currentHighlightedIds) {
|
|
91
|
+
if (!selectedBlockIds.has(blockId)) {
|
|
47
92
|
const blockElement = getBlockElementById(
|
|
48
93
|
blockEditorDocument,
|
|
49
94
|
blockId
|
|
@@ -54,37 +99,13 @@ function useBlockHighlighting(blockEditorDocument, postId, postType) {
|
|
|
54
99
|
"--collaborator-outline-color"
|
|
55
100
|
);
|
|
56
101
|
}
|
|
57
|
-
|
|
58
|
-
});
|
|
59
|
-
};
|
|
60
|
-
const blocksToHighlight = userStates.map((userState) => {
|
|
61
|
-
const isWholeBlockSelected = userState.editorState?.selection?.type === import_core_data.SelectionType.WholeBlock;
|
|
62
|
-
const shouldDrawUser = !userState.isMe;
|
|
63
|
-
if (isWholeBlockSelected && shouldDrawUser) {
|
|
64
|
-
const { localClientId } = resolveSelection(
|
|
65
|
-
userState.editorState?.selection
|
|
66
|
-
);
|
|
67
|
-
if (!localClientId) {
|
|
68
|
-
return null;
|
|
69
|
-
}
|
|
70
|
-
return {
|
|
71
|
-
blockId: localClientId,
|
|
72
|
-
color: (0, import_utils.getAvatarBorderColor)(
|
|
73
|
-
userState.collaboratorInfo.id
|
|
74
|
-
)
|
|
75
|
-
};
|
|
102
|
+
currentHighlightedIds.delete(blockId);
|
|
76
103
|
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
const
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
const blocksIdsToUnhighlight = Array.from(
|
|
83
|
-
highlightedBlockIds.current
|
|
84
|
-
).filter((blockId) => !selectedBlockIds.includes(blockId));
|
|
85
|
-
unhighlightBlocks(blocksIdsToUnhighlight);
|
|
86
|
-
blocksToHighlight.forEach((blockColorPair) => {
|
|
87
|
-
const { color, blockId } = blockColorPair;
|
|
104
|
+
}
|
|
105
|
+
const results = [];
|
|
106
|
+
const overlayRect = overlayElement?.getBoundingClientRect() ?? null;
|
|
107
|
+
blocksToHighlight.forEach((block) => {
|
|
108
|
+
const { color, blockId, userName, avatarUrl } = block;
|
|
88
109
|
const blockElement = getBlockElementById(
|
|
89
110
|
blockEditorDocument,
|
|
90
111
|
blockId
|
|
@@ -92,16 +113,43 @@ function useBlockHighlighting(blockEditorDocument, postId, postType) {
|
|
|
92
113
|
if (!blockElement) {
|
|
93
114
|
return;
|
|
94
115
|
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
116
|
+
blockElement.classList.add("is-collaborator-selected");
|
|
117
|
+
blockElement.style.setProperty(
|
|
118
|
+
"--collaborator-outline-color",
|
|
119
|
+
color
|
|
120
|
+
);
|
|
121
|
+
currentHighlightedIds.add(blockId);
|
|
122
|
+
if (overlayRect) {
|
|
123
|
+
const blockRect = blockElement.getBoundingClientRect();
|
|
124
|
+
results.push({
|
|
125
|
+
blockId,
|
|
126
|
+
userName,
|
|
127
|
+
avatarUrl,
|
|
128
|
+
color,
|
|
129
|
+
x: blockRect.left - overlayRect.left,
|
|
130
|
+
y: blockRect.top - overlayRect.top
|
|
131
|
+
});
|
|
102
132
|
}
|
|
103
133
|
});
|
|
104
|
-
|
|
134
|
+
setHighlights(results);
|
|
135
|
+
return () => {
|
|
136
|
+
for (const blockId of currentHighlightedIds) {
|
|
137
|
+
const el = getBlockElementById(blockEditorDocument, blockId);
|
|
138
|
+
if (el) {
|
|
139
|
+
el.classList.remove("is-collaborator-selected");
|
|
140
|
+
el.style.removeProperty("--collaborator-outline-color");
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
currentHighlightedIds.clear();
|
|
144
|
+
};
|
|
145
|
+
}, [
|
|
146
|
+
userStates,
|
|
147
|
+
blockEditorDocument,
|
|
148
|
+
overlayElement,
|
|
149
|
+
recomputeToken,
|
|
150
|
+
resolveSelection
|
|
151
|
+
]);
|
|
152
|
+
return { highlights, rerenderHighlightsAfterDelay };
|
|
105
153
|
}
|
|
106
154
|
var getBlockElementById = (blockEditorDocument, blockId) => {
|
|
107
155
|
return blockEditorDocument.querySelector(`[data-block="${blockId}"]`);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/collaborators-overlay/use-block-highlighting.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tprivateApis as coreDataPrivateApis,\n\tSelectionType,\n} from '@wordpress/core-data';\nimport { useEffect, useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { getAvatarBorderColor } from '../collab-sidebar/utils';\n\nconst { useActiveCollaborators, useResolvedSelection } =\n\tunlock( coreDataPrivateApis );\n\n/**\n * Custom hook for highlighting selected blocks in the editor\n * @param blockEditorDocument - Ref to the block editor document
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tprivateApis as coreDataPrivateApis,\n\tSelectionType,\n\ttype PostEditorAwarenessState as ActiveCollaborator,\n} from '@wordpress/core-data';\nimport { useEffect, useRef, useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { getAvatarBorderColor } from '../collab-sidebar/utils';\nimport { getAvatarUrl } from './get-avatar-url';\nimport { useDebouncedRecompute } from './use-debounced-recompute';\n\nconst { useActiveCollaborators, useResolvedSelection } =\n\tunlock( coreDataPrivateApis );\n\nexport interface BlockHighlightData {\n\tblockId: string;\n\tuserName: string;\n\tavatarUrl?: string;\n\tcolor: string;\n\tx: number;\n\ty: number;\n}\n\n/**\n * Custom hook for highlighting selected blocks in the editor and computing\n * their positions for rendering avatar labels in the overlay.\n *\n * @param overlayElement - The overlay element used as position reference.\n * @param blockEditorDocument - Ref to the block editor document.\n * @param postId - The ID of the post.\n * @param postType - The type of the post.\n * @param delayMs - Milliseconds to wait before recomputing highlight positions.\n * @return Highlight data for rendering and a delayed recompute function.\n */\nexport function useBlockHighlighting(\n\toverlayElement: HTMLElement | null,\n\tblockEditorDocument: Document | null,\n\tpostId: number | null,\n\tpostType: string | null,\n\tdelayMs: number\n): {\n\thighlights: BlockHighlightData[];\n\trerenderHighlightsAfterDelay: () => () => void;\n} {\n\tconst highlightedBlockIds = useRef< Set< string > >( new Set() );\n\tconst userStates: ActiveCollaborator[] = useActiveCollaborators(\n\t\tpostId ?? null,\n\t\tpostType ?? null\n\t);\n\tconst resolveSelection = useResolvedSelection(\n\t\tpostId ?? null,\n\t\tpostType ?? null\n\t);\n\n\tconst [ highlights, setHighlights ] = useState< BlockHighlightData[] >(\n\t\t[]\n\t);\n\n\t// Bump this counter to force the effect to re-run (e.g. after a layout shift).\n\tconst [ recomputeToken, rerenderHighlightsAfterDelay ] =\n\t\tuseDebouncedRecompute( delayMs );\n\n\t// All DOM mutations and position computations live inside useEffect.\n\tuseEffect( () => {\n\t\tif ( ! blockEditorDocument ) {\n\t\t\tsetHighlights( [] );\n\t\t\treturn;\n\t\t}\n\n\t\t// Capture the ref value so the cleanup closure sees the same Set\n\t\t// even if a later render replaces it.\n\t\tconst currentHighlightedIds = highlightedBlockIds.current;\n\n\t\t// Deduplicate by blockId \u2014 when multiple collaborators select the\n\t\t// same block, only the first one gets the highlight and avatar label.\n\t\tconst seen = new Set< string >();\n\t\tconst blocksToHighlight = userStates\n\t\t\t.filter( ( userState: ActiveCollaborator ) => {\n\t\t\t\tconst isWholeBlockSelected =\n\t\t\t\t\tuserState.editorState?.selection?.type ===\n\t\t\t\t\tSelectionType.WholeBlock;\n\n\t\t\t\treturn ! userState.isMe && isWholeBlockSelected;\n\t\t\t} )\n\t\t\t.map( ( userState ) => {\n\t\t\t\tlet localClientId;\n\t\t\t\ttry {\n\t\t\t\t\t( { localClientId } = resolveSelection(\n\t\t\t\t\t\tuserState.editorState?.selection\n\t\t\t\t\t) );\n\t\t\t\t} catch {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\n\t\t\t\tif ( ! localClientId ) {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\n\t\t\t\treturn {\n\t\t\t\t\tblockId: localClientId,\n\t\t\t\t\tcolor: userState.isMe\n\t\t\t\t\t\t? 'var(--wp-admin-theme-color)'\n\t\t\t\t\t\t: getAvatarBorderColor( userState.collaboratorInfo.id ),\n\t\t\t\t\tuserName: userState.collaboratorInfo.name,\n\t\t\t\t\tavatarUrl: getAvatarUrl(\n\t\t\t\t\t\tuserState.collaboratorInfo.avatar_urls\n\t\t\t\t\t),\n\t\t\t\t};\n\t\t\t} )\n\t\t\t.filter( ( block ): block is NonNullable< typeof block > => {\n\t\t\t\tif ( ! block ) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tif ( seen.has( block.blockId ) ) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tseen.add( block.blockId );\n\t\t\t\treturn true;\n\t\t\t} );\n\n\t\t// Unhighlight blocks that are no longer selected.\n\t\tconst selectedBlockIds = new Set(\n\t\t\tblocksToHighlight.map( ( block ) => block.blockId )\n\t\t);\n\n\t\tfor ( const blockId of currentHighlightedIds ) {\n\t\t\tif ( ! selectedBlockIds.has( blockId ) ) {\n\t\t\t\tconst blockElement = getBlockElementById(\n\t\t\t\t\tblockEditorDocument,\n\t\t\t\t\tblockId\n\t\t\t\t);\n\n\t\t\t\tif ( blockElement ) {\n\t\t\t\t\tblockElement.classList.remove( 'is-collaborator-selected' );\n\t\t\t\t\tblockElement.style.removeProperty(\n\t\t\t\t\t\t'--collaborator-outline-color'\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tcurrentHighlightedIds.delete( blockId );\n\t\t\t}\n\t\t}\n\n\t\t// Highlight blocks and compute positions for avatar labels.\n\t\tconst results: BlockHighlightData[] = [];\n\t\tconst overlayRect = overlayElement?.getBoundingClientRect() ?? null;\n\n\t\tblocksToHighlight.forEach( ( block ) => {\n\t\t\tconst { color, blockId, userName, avatarUrl } = block;\n\t\t\tconst blockElement = getBlockElementById(\n\t\t\t\tblockEditorDocument,\n\t\t\t\tblockId\n\t\t\t);\n\n\t\t\tif ( ! blockElement ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tblockElement.classList.add( 'is-collaborator-selected' );\n\t\t\tblockElement.style.setProperty(\n\t\t\t\t'--collaborator-outline-color',\n\t\t\t\tcolor\n\t\t\t);\n\t\t\tcurrentHighlightedIds.add( blockId );\n\n\t\t\tif ( overlayRect ) {\n\t\t\t\tconst blockRect = blockElement.getBoundingClientRect();\n\n\t\t\t\tresults.push( {\n\t\t\t\t\tblockId,\n\t\t\t\t\tuserName,\n\t\t\t\t\tavatarUrl,\n\t\t\t\t\tcolor,\n\t\t\t\t\tx: blockRect.left - overlayRect.left,\n\t\t\t\t\ty: blockRect.top - overlayRect.top,\n\t\t\t\t} );\n\t\t\t}\n\t\t} );\n\n\t\tsetHighlights( results );\n\n\t\t// Clean up all highlights on unmount.\n\t\treturn () => {\n\t\t\tfor ( const blockId of currentHighlightedIds ) {\n\t\t\t\tconst el = getBlockElementById( blockEditorDocument, blockId );\n\t\t\t\tif ( el ) {\n\t\t\t\t\tel.classList.remove( 'is-collaborator-selected' );\n\t\t\t\t\tel.style.removeProperty( '--collaborator-outline-color' );\n\t\t\t\t}\n\t\t\t}\n\t\t\tcurrentHighlightedIds.clear();\n\t\t};\n\t}, [\n\t\tuserStates,\n\t\tblockEditorDocument,\n\t\toverlayElement,\n\t\trecomputeToken,\n\t\tresolveSelection,\n\t] );\n\n\treturn { highlights, rerenderHighlightsAfterDelay };\n}\n\nconst getBlockElementById = (\n\tblockEditorDocument: Document,\n\tblockId: string\n): HTMLElement | null => {\n\treturn blockEditorDocument.querySelector( `[data-block=\"${ blockId }\"]` );\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,uBAIO;AACP,qBAA4C;AAK5C,yBAAuB;AACvB,mBAAqC;AACrC,4BAA6B;AAC7B,qCAAsC;AAEtC,IAAM,EAAE,wBAAwB,qBAAqB,QACpD,2BAAQ,iBAAAA,WAAoB;AAsBtB,SAAS,qBACf,gBACA,qBACA,QACA,UACA,SAIC;AACD,QAAM,0BAAsB,uBAAyB,oBAAI,IAAI,CAAE;AAC/D,QAAM,aAAmC;AAAA,IACxC,UAAU;AAAA,IACV,YAAY;AAAA,EACb;AACA,QAAM,mBAAmB;AAAA,IACxB,UAAU;AAAA,IACV,YAAY;AAAA,EACb;AAEA,QAAM,CAAE,YAAY,aAAc,QAAI;AAAA,IACrC,CAAC;AAAA,EACF;AAGA,QAAM,CAAE,gBAAgB,4BAA6B,QACpD,sDAAuB,OAAQ;AAGhC,gCAAW,MAAM;AAChB,QAAK,CAAE,qBAAsB;AAC5B,oBAAe,CAAC,CAAE;AAClB;AAAA,IACD;AAIA,UAAM,wBAAwB,oBAAoB;AAIlD,UAAM,OAAO,oBAAI,IAAc;AAC/B,UAAM,oBAAoB,WACxB,OAAQ,CAAE,cAAmC;AAC7C,YAAM,uBACL,UAAU,aAAa,WAAW,SAClC,+BAAc;AAEf,aAAO,CAAE,UAAU,QAAQ;AAAA,IAC5B,CAAE,EACD,IAAK,CAAE,cAAe;AACtB,UAAI;AACJ,UAAI;AACH,SAAE,EAAE,cAAc,IAAI;AAAA,UACrB,UAAU,aAAa;AAAA,QACxB;AAAA,MACD,QAAQ;AACP,eAAO;AAAA,MACR;AAEA,UAAK,CAAE,eAAgB;AACtB,eAAO;AAAA,MACR;AAEA,aAAO;AAAA,QACN,SAAS;AAAA,QACT,OAAO,UAAU,OACd,oCACA,mCAAsB,UAAU,iBAAiB,EAAG;AAAA,QACvD,UAAU,UAAU,iBAAiB;AAAA,QACrC,eAAW;AAAA,UACV,UAAU,iBAAiB;AAAA,QAC5B;AAAA,MACD;AAAA,IACD,CAAE,EACD,OAAQ,CAAE,UAAiD;AAC3D,UAAK,CAAE,OAAQ;AACd,eAAO;AAAA,MACR;AACA,UAAK,KAAK,IAAK,MAAM,OAAQ,GAAI;AAChC,eAAO;AAAA,MACR;AACA,WAAK,IAAK,MAAM,OAAQ;AACxB,aAAO;AAAA,IACR,CAAE;AAGH,UAAM,mBAAmB,IAAI;AAAA,MAC5B,kBAAkB,IAAK,CAAE,UAAW,MAAM,OAAQ;AAAA,IACnD;AAEA,eAAY,WAAW,uBAAwB;AAC9C,UAAK,CAAE,iBAAiB,IAAK,OAAQ,GAAI;AACxC,cAAM,eAAe;AAAA,UACpB;AAAA,UACA;AAAA,QACD;AAEA,YAAK,cAAe;AACnB,uBAAa,UAAU,OAAQ,0BAA2B;AAC1D,uBAAa,MAAM;AAAA,YAClB;AAAA,UACD;AAAA,QACD;AAEA,8BAAsB,OAAQ,OAAQ;AAAA,MACvC;AAAA,IACD;AAGA,UAAM,UAAgC,CAAC;AACvC,UAAM,cAAc,gBAAgB,sBAAsB,KAAK;AAE/D,sBAAkB,QAAS,CAAE,UAAW;AACvC,YAAM,EAAE,OAAO,SAAS,UAAU,UAAU,IAAI;AAChD,YAAM,eAAe;AAAA,QACpB;AAAA,QACA;AAAA,MACD;AAEA,UAAK,CAAE,cAAe;AACrB;AAAA,MACD;AAEA,mBAAa,UAAU,IAAK,0BAA2B;AACvD,mBAAa,MAAM;AAAA,QAClB;AAAA,QACA;AAAA,MACD;AACA,4BAAsB,IAAK,OAAQ;AAEnC,UAAK,aAAc;AAClB,cAAM,YAAY,aAAa,sBAAsB;AAErD,gBAAQ,KAAM;AAAA,UACb;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA,GAAG,UAAU,OAAO,YAAY;AAAA,UAChC,GAAG,UAAU,MAAM,YAAY;AAAA,QAChC,CAAE;AAAA,MACH;AAAA,IACD,CAAE;AAEF,kBAAe,OAAQ;AAGvB,WAAO,MAAM;AACZ,iBAAY,WAAW,uBAAwB;AAC9C,cAAM,KAAK,oBAAqB,qBAAqB,OAAQ;AAC7D,YAAK,IAAK;AACT,aAAG,UAAU,OAAQ,0BAA2B;AAChD,aAAG,MAAM,eAAgB,8BAA+B;AAAA,QACzD;AAAA,MACD;AACA,4BAAsB,MAAM;AAAA,IAC7B;AAAA,EACD,GAAG;AAAA,IACF;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD,CAAE;AAEF,SAAO,EAAE,YAAY,6BAA6B;AACnD;AAEA,IAAM,sBAAsB,CAC3B,qBACA,YACwB;AACxB,SAAO,oBAAoB,cAAe,gBAAiB,OAAQ,IAAK;AACzE;",
|
|
6
6
|
"names": ["coreDataPrivateApis"]
|
|
7
7
|
}
|