@wordpress/editor 14.44.0 → 14.45.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 +2 -0
- package/build/components/collab-sidebar/{comment-menu-item.cjs → add-note-menu-item.cjs} +17 -14
- package/build/components/collab-sidebar/add-note-menu-item.cjs.map +7 -0
- package/build/components/collab-sidebar/add-note.cjs +100 -0
- package/build/components/collab-sidebar/add-note.cjs.map +7 -0
- package/build/components/collab-sidebar/board-store.cjs +106 -0
- package/build/components/collab-sidebar/board-store.cjs.map +7 -0
- package/build/components/collab-sidebar/floating-container.cjs +63 -0
- package/build/components/collab-sidebar/floating-container.cjs.map +7 -0
- package/build/components/collab-sidebar/hooks.cjs +105 -140
- package/build/components/collab-sidebar/hooks.cjs.map +3 -3
- package/build/components/collab-sidebar/index.cjs +28 -90
- package/build/components/collab-sidebar/index.cjs.map +3 -3
- package/build/components/collab-sidebar/{comment-author-info.cjs → note-byline.cjs} +13 -9
- package/build/components/collab-sidebar/note-byline.cjs.map +7 -0
- package/build/components/collab-sidebar/note-card.cjs +58 -0
- package/build/components/collab-sidebar/note-card.cjs.map +7 -0
- package/build/components/collab-sidebar/{comment-form.cjs → note-form.cjs} +46 -45
- package/build/components/collab-sidebar/note-form.cjs.map +7 -0
- package/build/components/collab-sidebar/{comment-indicator-toolbar.cjs → note-indicator-toolbar.cjs} +31 -27
- package/build/components/collab-sidebar/note-indicator-toolbar.cjs.map +7 -0
- package/build/components/collab-sidebar/note-thread.cjs +321 -0
- package/build/components/collab-sidebar/note-thread.cjs.map +7 -0
- package/build/components/collab-sidebar/note.cjs +207 -0
- package/build/components/collab-sidebar/note.cjs.map +7 -0
- package/build/components/collab-sidebar/notes.cjs +237 -0
- package/build/components/collab-sidebar/notes.cjs.map +7 -0
- package/build/components/collab-sidebar/utils.cjs +80 -14
- package/build/components/collab-sidebar/utils.cjs.map +2 -2
- package/build/components/collaborators-presence/avatar/component.cjs.map +1 -1
- package/build/components/collaborators-presence/index.cjs +3 -3
- package/build/components/collaborators-presence/index.cjs.map +2 -2
- package/build/components/collaborators-presence/list.cjs +3 -3
- package/build/components/collaborators-presence/list.cjs.map +2 -2
- package/build/components/document-bar/index.cjs.map +3 -3
- package/build/components/error-boundary/index.cjs.map +3 -3
- package/build/components/list-view-sidebar/list-view-outline.cjs.map +3 -3
- package/build/components/media/media-editor-modal.cjs +93 -0
- package/build/components/media/media-editor-modal.cjs.map +7 -0
- package/build/components/media-categories/index.cjs +1 -1
- package/build/components/media-categories/index.cjs.map +1 -1
- package/build/components/more-menu/index.cjs +4 -3
- package/build/components/more-menu/index.cjs.map +2 -2
- package/build/components/post-actions/set-as-homepage.cjs.map +3 -3
- package/build/components/post-actions/set-as-posts-page.cjs.map +3 -3
- package/build/components/post-card-panel/index.cjs +2 -2
- package/build/components/post-card-panel/index.cjs.map +3 -3
- package/build/components/post-content-information/index.cjs.map +3 -3
- package/build/components/post-excerpt/panel.cjs.map +3 -3
- package/build/components/post-last-edited-panel/index.cjs.map +3 -3
- package/build/components/post-preview-button/index.cjs +3 -2
- package/build/components/post-preview-button/index.cjs.map +2 -2
- package/build/components/post-publish-button/index.cjs +2 -2
- package/build/components/post-publish-button/index.cjs.map +2 -2
- package/build/components/post-publish-button/label.cjs +4 -2
- package/build/components/post-publish-button/label.cjs.map +2 -2
- package/build/components/post-publish-panel/maybe-upload-media.cjs +1 -1
- package/build/components/post-publish-panel/maybe-upload-media.cjs.map +1 -1
- package/build/components/post-publish-panel/postpublish.cjs +3 -2
- package/build/components/post-publish-panel/postpublish.cjs.map +2 -2
- package/build/components/post-revisions-panel/index.cjs +2 -2
- package/build/components/post-revisions-panel/index.cjs.map +2 -2
- package/build/components/post-revisions-preview/diff-markers.cjs +1 -1
- package/build/components/post-revisions-preview/diff-markers.cjs.map +2 -2
- package/build/components/post-revisions-preview/revisions-slider.cjs +1 -0
- package/build/components/post-revisions-preview/revisions-slider.cjs.map +2 -2
- package/build/components/post-saved-state/index.cjs +4 -1
- package/build/components/post-saved-state/index.cjs.map +2 -2
- package/build/components/post-text-editor/index.cjs +3 -4
- package/build/components/post-text-editor/index.cjs.map +2 -2
- package/build/components/preview-dropdown/index.cjs +3 -2
- package/build/components/preview-dropdown/index.cjs.map +2 -2
- package/build/components/provider/index.cjs +3 -1
- package/build/components/provider/index.cjs.map +3 -3
- package/build/components/provider/use-block-editor-settings.cjs +7 -1
- package/build/components/provider/use-block-editor-settings.cjs.map +3 -3
- package/build/components/provider/use-upload-save-lock.cjs +2 -12
- package/build/components/provider/use-upload-save-lock.cjs.map +2 -2
- package/build/components/resizable-editor/resize-handle.cjs +2 -1
- package/build/components/resizable-editor/resize-handle.cjs.map +2 -2
- package/build/components/revision-created-panel/index.cjs.map +3 -3
- package/build/components/site-discussion/index.cjs.map +2 -2
- package/build/components/style-book/constants.cjs +1 -1
- package/build/components/style-book/constants.cjs.map +1 -1
- package/build/components/style-book/index.cjs +1 -1
- package/build/components/style-book/index.cjs.map +1 -1
- package/build/components/template-actions-panel/classic-theme-content.cjs.map +2 -2
- package/build/components/template-part-menu-items/convert-to-regular.cjs +54 -11
- package/build/components/template-part-menu-items/convert-to-regular.cjs.map +3 -3
- package/build/components/visual-editor/index.cjs +5 -22
- package/build/components/visual-editor/index.cjs.map +2 -2
- package/build/store/private-actions.cjs +0 -8
- package/build/store/private-actions.cjs.map +2 -2
- package/build/store/private-selectors.cjs +0 -5
- package/build/store/private-selectors.cjs.map +2 -2
- package/build/store/reducer.cjs +0 -10
- package/build/store/reducer.cjs.map +2 -2
- package/build/utils/media-finalize/index.cjs +3 -2
- package/build/utils/media-finalize/index.cjs.map +2 -2
- package/build/utils/media-upload/index.cjs +14 -25
- package/build/utils/media-upload/index.cjs.map +2 -2
- package/build-module/components/collab-sidebar/{comment-menu-item.mjs → add-note-menu-item.mjs} +10 -11
- package/build-module/components/collab-sidebar/add-note-menu-item.mjs.map +7 -0
- package/build-module/components/collab-sidebar/add-note.mjs +78 -0
- package/build-module/components/collab-sidebar/add-note.mjs.map +7 -0
- package/build-module/components/collab-sidebar/board-store.mjs +81 -0
- package/build-module/components/collab-sidebar/board-store.mjs.map +7 -0
- package/build-module/components/collab-sidebar/floating-container.mjs +28 -0
- package/build-module/components/collab-sidebar/floating-container.mjs.map +7 -0
- package/build-module/components/collab-sidebar/hooks.mjs +105 -144
- package/build-module/components/collab-sidebar/hooks.mjs.map +2 -2
- package/build-module/components/collab-sidebar/index.mjs +29 -95
- package/build-module/components/collab-sidebar/index.mjs.map +2 -2
- package/build-module/components/collab-sidebar/{comment-author-info.mjs → note-byline.mjs} +7 -7
- package/build-module/components/collab-sidebar/note-byline.mjs.map +7 -0
- package/build-module/components/collab-sidebar/note-card.mjs +33 -0
- package/build-module/components/collab-sidebar/note-card.mjs.map +7 -0
- package/build-module/components/collab-sidebar/note-form.mjs +84 -0
- package/build-module/components/collab-sidebar/note-form.mjs.map +7 -0
- package/build-module/components/collab-sidebar/{comment-indicator-toolbar.mjs → note-indicator-toolbar.mjs} +25 -29
- package/build-module/components/collab-sidebar/note-indicator-toolbar.mjs.map +7 -0
- package/build-module/components/collab-sidebar/note-thread.mjs +289 -0
- package/build-module/components/collab-sidebar/note-thread.mjs.map +7 -0
- package/build-module/components/collab-sidebar/note.mjs +176 -0
- package/build-module/components/collab-sidebar/note.mjs.map +7 -0
- package/build-module/components/collab-sidebar/notes.mjs +215 -0
- package/build-module/components/collab-sidebar/notes.mjs.map +7 -0
- package/build-module/components/collab-sidebar/utils.mjs +76 -10
- package/build-module/components/collab-sidebar/utils.mjs.map +2 -2
- package/build-module/components/collaborators-presence/avatar/component.mjs.map +1 -1
- package/build-module/components/collaborators-presence/index.mjs +3 -3
- package/build-module/components/collaborators-presence/index.mjs.map +2 -2
- package/build-module/components/collaborators-presence/list.mjs +3 -3
- package/build-module/components/collaborators-presence/list.mjs.map +2 -2
- package/build-module/components/document-bar/index.mjs +3 -3
- package/build-module/components/document-bar/index.mjs.map +2 -2
- package/build-module/components/error-boundary/index.mjs +2 -2
- package/build-module/components/error-boundary/index.mjs.map +2 -2
- package/build-module/components/list-view-sidebar/list-view-outline.mjs +5 -5
- package/build-module/components/list-view-sidebar/list-view-outline.mjs.map +2 -2
- package/build-module/components/media/media-editor-modal.mjs +62 -0
- package/build-module/components/media/media-editor-modal.mjs.map +7 -0
- package/build-module/components/media-categories/index.mjs +1 -1
- package/build-module/components/media-categories/index.mjs.map +1 -1
- package/build-module/components/more-menu/index.mjs +4 -8
- package/build-module/components/more-menu/index.mjs.map +2 -2
- package/build-module/components/post-actions/set-as-homepage.mjs +2 -2
- package/build-module/components/post-actions/set-as-homepage.mjs.map +2 -2
- package/build-module/components/post-actions/set-as-posts-page.mjs +2 -2
- package/build-module/components/post-actions/set-as-posts-page.mjs.map +2 -2
- package/build-module/components/post-card-panel/index.mjs +5 -5
- package/build-module/components/post-card-panel/index.mjs.map +2 -2
- package/build-module/components/post-content-information/index.mjs +2 -2
- package/build-module/components/post-content-information/index.mjs.map +2 -2
- package/build-module/components/post-excerpt/panel.mjs +2 -2
- package/build-module/components/post-excerpt/panel.mjs.map +2 -2
- package/build-module/components/post-last-edited-panel/index.mjs +2 -2
- package/build-module/components/post-last-edited-panel/index.mjs.map +2 -2
- package/build-module/components/post-preview-button/index.mjs +3 -2
- package/build-module/components/post-preview-button/index.mjs.map +2 -2
- package/build-module/components/post-publish-button/index.mjs +2 -2
- package/build-module/components/post-publish-button/index.mjs.map +2 -2
- package/build-module/components/post-publish-button/label.mjs +4 -2
- package/build-module/components/post-publish-button/label.mjs.map +2 -2
- package/build-module/components/post-publish-panel/maybe-upload-media.mjs +1 -1
- package/build-module/components/post-publish-panel/maybe-upload-media.mjs.map +1 -1
- package/build-module/components/post-publish-panel/postpublish.mjs +3 -3
- package/build-module/components/post-publish-panel/postpublish.mjs.map +2 -2
- package/build-module/components/post-revisions-panel/index.mjs +2 -2
- package/build-module/components/post-revisions-panel/index.mjs.map +2 -2
- package/build-module/components/post-revisions-preview/diff-markers.mjs +1 -1
- package/build-module/components/post-revisions-preview/diff-markers.mjs.map +2 -2
- package/build-module/components/post-revisions-preview/revisions-slider.mjs +1 -0
- package/build-module/components/post-revisions-preview/revisions-slider.mjs.map +2 -2
- package/build-module/components/post-saved-state/index.mjs +4 -1
- package/build-module/components/post-saved-state/index.mjs.map +2 -2
- package/build-module/components/post-text-editor/index.mjs +2 -3
- package/build-module/components/post-text-editor/index.mjs.map +2 -2
- package/build-module/components/preview-dropdown/index.mjs +2 -2
- package/build-module/components/preview-dropdown/index.mjs.map +2 -2
- package/build-module/components/provider/index.mjs +3 -1
- package/build-module/components/provider/index.mjs.map +2 -2
- package/build-module/components/provider/use-block-editor-settings.mjs +7 -1
- package/build-module/components/provider/use-block-editor-settings.mjs.map +2 -2
- package/build-module/components/provider/use-upload-save-lock.mjs +2 -12
- package/build-module/components/provider/use-upload-save-lock.mjs.map +2 -2
- package/build-module/components/resizable-editor/resize-handle.mjs +2 -5
- package/build-module/components/resizable-editor/resize-handle.mjs.map +2 -2
- package/build-module/components/revision-created-panel/index.mjs +2 -2
- package/build-module/components/revision-created-panel/index.mjs.map +2 -2
- package/build-module/components/site-discussion/index.mjs +2 -2
- package/build-module/components/site-discussion/index.mjs.map +2 -2
- package/build-module/components/style-book/constants.mjs +1 -1
- package/build-module/components/style-book/constants.mjs.map +1 -1
- package/build-module/components/style-book/index.mjs +1 -1
- package/build-module/components/style-book/index.mjs.map +1 -1
- package/build-module/components/template-actions-panel/classic-theme-content.mjs +2 -2
- package/build-module/components/template-actions-panel/classic-theme-content.mjs.map +2 -2
- package/build-module/components/template-part-menu-items/convert-to-regular.mjs +60 -14
- package/build-module/components/template-part-menu-items/convert-to-regular.mjs.map +2 -2
- package/build-module/components/visual-editor/index.mjs +5 -22
- package/build-module/components/visual-editor/index.mjs.map +2 -2
- package/build-module/store/private-actions.mjs +0 -7
- package/build-module/store/private-actions.mjs.map +2 -2
- package/build-module/store/private-selectors.mjs +0 -4
- package/build-module/store/private-selectors.mjs.map +2 -2
- package/build-module/store/reducer.mjs +0 -9
- package/build-module/store/reducer.mjs.map +2 -2
- package/build-module/utils/media-finalize/index.mjs +3 -2
- package/build-module/utils/media-finalize/index.mjs.map +2 -2
- package/build-module/utils/media-upload/index.mjs +14 -25
- package/build-module/utils/media-upload/index.mjs.map +2 -2
- package/build-style/style-rtl.css +397 -171
- package/build-style/style.css +397 -171
- package/build-types/components/collab-sidebar/add-note-menu-item.d.ts +5 -0
- package/build-types/components/collab-sidebar/add-note-menu-item.d.ts.map +1 -0
- package/build-types/components/collab-sidebar/add-note.d.ts +6 -0
- package/build-types/components/collab-sidebar/add-note.d.ts.map +1 -0
- package/build-types/components/collab-sidebar/board-store.d.ts +9 -0
- package/build-types/components/collab-sidebar/board-store.d.ts.map +1 -0
- package/build-types/components/collab-sidebar/floating-container.d.ts +8 -0
- package/build-types/components/collab-sidebar/floating-container.d.ts.map +1 -0
- package/build-types/components/collab-sidebar/hooks.d.ts +13 -22
- package/build-types/components/collab-sidebar/hooks.d.ts.map +1 -1
- package/build-types/components/collab-sidebar/index.d.ts.map +1 -1
- package/build-types/components/collab-sidebar/note-byline.d.ts +7 -0
- package/build-types/components/collab-sidebar/note-byline.d.ts.map +1 -0
- package/build-types/components/collab-sidebar/note-card.d.ts +8 -0
- package/build-types/components/collab-sidebar/note-card.d.ts.map +1 -0
- package/build-types/components/collab-sidebar/note-form.d.ts +7 -0
- package/build-types/components/collab-sidebar/note-form.d.ts.map +1 -0
- package/build-types/components/collab-sidebar/note-indicator-toolbar.d.ts +5 -0
- package/build-types/components/collab-sidebar/note-indicator-toolbar.d.ts.map +1 -0
- package/build-types/components/collab-sidebar/note-thread.d.ts +11 -0
- package/build-types/components/collab-sidebar/note-thread.d.ts.map +1 -0
- package/build-types/components/collab-sidebar/note.d.ts +9 -0
- package/build-types/components/collab-sidebar/note.d.ts.map +1 -0
- package/build-types/components/collab-sidebar/notes.d.ts +7 -0
- package/build-types/components/collab-sidebar/notes.d.ts.map +1 -0
- package/build-types/components/collab-sidebar/utils.d.ts +41 -17
- package/build-types/components/collab-sidebar/utils.d.ts.map +1 -1
- package/build-types/components/media/media-editor-modal.d.ts +11 -0
- package/build-types/components/media/media-editor-modal.d.ts.map +1 -0
- package/build-types/components/more-menu/index.d.ts.map +1 -1
- package/build-types/components/post-preview-button/index.d.ts.map +1 -1
- package/build-types/components/post-publish-button/index.d.ts.map +1 -1
- package/build-types/components/post-publish-button/label.d.ts.map +1 -1
- package/build-types/components/post-revisions-preview/revisions-slider.d.ts.map +1 -1
- package/build-types/components/post-saved-state/index.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-upload-save-lock.d.ts +0 -2
- package/build-types/components/provider/use-upload-save-lock.d.ts.map +1 -1
- package/build-types/components/resizable-editor/resize-handle.d.ts.map +1 -1
- package/build-types/components/style-book/constants.d.ts +1 -1
- package/build-types/components/style-book/constants.d.ts.map +1 -1
- package/build-types/components/template-part-menu-items/convert-to-regular.d.ts.map +1 -1
- package/build-types/components/visual-editor/index.d.ts.map +1 -1
- package/build-types/store/private-actions.d.ts +0 -7
- package/build-types/store/private-actions.d.ts.map +1 -1
- package/build-types/store/private-selectors.d.ts +0 -7
- package/build-types/store/private-selectors.d.ts.map +1 -1
- package/build-types/store/reducer.d.ts +0 -10
- package/build-types/store/reducer.d.ts.map +1 -1
- package/build-types/utils/media-finalize/index.d.ts +1 -1
- package/build-types/utils/media-finalize/index.d.ts.map +1 -1
- package/build-types/utils/media-upload/index.d.ts.map +1 -1
- package/package.json +46 -46
- package/src/components/collab-sidebar/README.md +117 -0
- package/src/components/collab-sidebar/{comment-menu-item.js → add-note-menu-item.js} +8 -10
- package/src/components/collab-sidebar/{add-comment.js → add-note.js} +26 -49
- package/src/components/collab-sidebar/board-store.js +85 -0
- package/src/components/collab-sidebar/floating-container.js +30 -0
- package/src/components/collab-sidebar/hooks.js +130 -178
- package/src/components/collab-sidebar/index.js +35 -106
- package/src/components/collab-sidebar/{comment-author-info.js → note-byline.js} +5 -6
- package/src/components/collab-sidebar/note-card.js +36 -0
- package/src/components/collab-sidebar/{comment-form.js → note-form.js} +29 -40
- package/src/components/collab-sidebar/{comment-indicator-toolbar.js → note-indicator-toolbar.js} +29 -32
- package/src/components/collab-sidebar/note-thread.js +331 -0
- package/src/components/collab-sidebar/note.js +209 -0
- package/src/components/collab-sidebar/notes.js +276 -0
- package/src/components/collab-sidebar/style.scss +21 -11
- package/src/components/collab-sidebar/test/utils.js +155 -0
- package/src/components/collab-sidebar/utils.js +125 -19
- package/src/components/collaborators-presence/avatar/component.tsx +1 -1
- package/src/components/collaborators-presence/styles/collaborators-list.scss +1 -1
- package/src/components/collaborators-presence/styles/collaborators-presence.scss +1 -1
- package/src/components/document-bar/index.js +4 -4
- package/src/components/document-outline/style.scss +1 -1
- package/src/components/error-boundary/index.js +3 -3
- package/src/components/list-view-sidebar/list-view-outline.js +6 -6
- package/src/components/media/media-editor-modal.js +95 -0
- package/src/components/media-categories/index.js +1 -1
- package/src/components/more-menu/index.js +4 -8
- package/src/components/post-actions/set-as-homepage.js +2 -2
- package/src/components/post-actions/set-as-posts-page.js +2 -2
- package/src/components/post-card-panel/index.js +7 -7
- package/src/components/post-content-information/index.js +3 -3
- package/src/components/post-excerpt/panel.js +3 -3
- package/src/components/post-last-edited-panel/index.js +3 -3
- package/src/components/post-preview-button/index.js +3 -2
- package/src/components/post-publish-button/index.js +6 -5
- package/src/components/post-publish-button/label.js +3 -1
- package/src/components/post-publish-panel/maybe-upload-media.js +1 -1
- package/src/components/post-publish-panel/postpublish.js +2 -2
- package/src/components/post-publish-panel/test/__snapshots__/index.js.snap +10 -16
- package/src/components/post-revisions-panel/index.js +3 -3
- package/src/components/post-revisions-preview/diff-markers.js +1 -1
- package/src/components/post-revisions-preview/revisions-slider.js +1 -0
- package/src/components/post-revisions-preview/style.scss +1 -1
- package/src/components/post-saved-state/index.js +4 -1
- package/src/components/post-saved-state/test/__snapshots__/index.js.snap +0 -1
- package/src/components/post-text-editor/index.js +3 -3
- package/src/components/preview-dropdown/index.js +2 -2
- package/src/components/provider/index.js +4 -0
- package/src/components/provider/use-block-editor-settings.js +10 -0
- package/src/components/provider/use-upload-save-lock.js +2 -17
- package/src/components/resizable-editor/resize-handle.js +2 -5
- package/src/components/revision-created-panel/index.js +3 -3
- package/src/components/site-discussion/index.js +3 -3
- package/src/components/style-book/constants.ts +1 -1
- package/src/components/style-book/index.js +1 -1
- package/src/components/template-actions-panel/classic-theme-content.js +3 -3
- package/src/components/template-actions-panel/style.scss +1 -1
- package/src/components/template-part-menu-items/convert-to-regular.js +74 -12
- package/src/components/visual-editor/index.js +2 -29
- package/src/store/private-actions.js +0 -13
- package/src/store/private-selectors.js +0 -10
- package/src/store/reducer.js +0 -16
- package/src/utils/media-finalize/index.js +2 -1
- package/src/utils/media-finalize/test/index.js +25 -1
- package/src/utils/media-upload/index.js +26 -29
- package/build/components/collab-sidebar/add-comment.cjs +0 -129
- package/build/components/collab-sidebar/add-comment.cjs.map +0 -7
- package/build/components/collab-sidebar/comment-author-info.cjs.map +0 -7
- package/build/components/collab-sidebar/comment-form.cjs.map +0 -7
- package/build/components/collab-sidebar/comment-indicator-toolbar.cjs.map +0 -7
- package/build/components/collab-sidebar/comment-menu-item.cjs.map +0 -7
- package/build/components/collab-sidebar/comments.cjs +0 -816
- package/build/components/collab-sidebar/comments.cjs.map +0 -7
- package/build-module/components/collab-sidebar/add-comment.mjs +0 -100
- package/build-module/components/collab-sidebar/add-comment.mjs.map +0 -7
- package/build-module/components/collab-sidebar/comment-author-info.mjs.map +0 -7
- package/build-module/components/collab-sidebar/comment-form.mjs +0 -90
- package/build-module/components/collab-sidebar/comment-form.mjs.map +0 -7
- package/build-module/components/collab-sidebar/comment-indicator-toolbar.mjs.map +0 -7
- package/build-module/components/collab-sidebar/comment-menu-item.mjs.map +0 -7
- package/build-module/components/collab-sidebar/comments.mjs +0 -799
- package/build-module/components/collab-sidebar/comments.mjs.map +0 -7
- package/build-types/components/collab-sidebar/add-comment.d.ts +0 -10
- package/build-types/components/collab-sidebar/add-comment.d.ts.map +0 -1
- package/build-types/components/collab-sidebar/comment-author-info.d.ts +0 -8
- package/build-types/components/collab-sidebar/comment-author-info.d.ts.map +0 -1
- package/build-types/components/collab-sidebar/comment-form.d.ts +0 -11
- package/build-types/components/collab-sidebar/comment-form.d.ts.map +0 -1
- package/build-types/components/collab-sidebar/comment-indicator-toolbar.d.ts +0 -6
- package/build-types/components/collab-sidebar/comment-indicator-toolbar.d.ts.map +0 -1
- package/build-types/components/collab-sidebar/comment-menu-item.d.ts +0 -6
- package/build-types/components/collab-sidebar/comment-menu-item.d.ts.map +0 -1
- package/build-types/components/collab-sidebar/comments.d.ts +0 -12
- package/build-types/components/collab-sidebar/comments.d.ts.map +0 -1
- package/src/components/collab-sidebar/comments.js +0 -985
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/collab-sidebar/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {
|
|
5
|
-
"mappings": ";AAGA,SAAS,UAAU;AACnB,SAAS,WAAW,mBAAmB;AACvC,SAAS,
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useRef } from '@wordpress/element';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { useShortcut } from '@wordpress/keyboard-shortcuts';\nimport { comment as commentIcon } from '@wordpress/icons';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport PluginSidebar from '../plugin-sidebar';\nimport {\n\tALL_NOTES_SIDEBAR,\n\tFLOATING_NOTES_SIDEBAR,\n\tSIDEBARS,\n} from './constants';\nimport { Notes } from './notes';\nimport { store as editorStore } from '../../store';\nimport { AddNoteMenuItem } from './add-note-menu-item';\nimport { NoteAvatarIndicator } from './note-indicator-toolbar';\nimport { useGlobalStylesContext } from '../global-styles-provider';\nimport { useNoteThreads, useEnableFloatingSidebar } from './hooks';\nimport PostTypeSupportCheck from '../post-type-support-check';\nimport { unlock } from '../../lock-unlock';\n\nfunction NotesSidebar( { postId } ) {\n\tconst { getActiveComplementaryArea } = useSelect( interfaceStore );\n\tconst { enableComplementaryArea } = useDispatch( interfaceStore );\n\tconst { toggleBlockSpotlight, selectBlock } = unlock(\n\t\tuseDispatch( blockEditorStore )\n\t);\n\tconst { selectNote } = unlock( useDispatch( editorStore ) );\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst sidebarRef = useRef( null );\n\n\tconst { clientId, noteId, isClassicBlock } = useSelect( ( select ) => {\n\t\tconst { getBlockAttributes, getSelectedBlockClientId, getBlockName } =\n\t\t\tselect( blockEditorStore );\n\t\tconst _clientId = getSelectedBlockClientId();\n\t\treturn {\n\t\t\tclientId: _clientId,\n\t\t\tnoteId: _clientId\n\t\t\t\t? getBlockAttributes( _clientId )?.metadata?.noteId\n\t\t\t\t: null,\n\t\t\tisClassicBlock: _clientId\n\t\t\t\t? getBlockName( _clientId ) === 'core/freeform'\n\t\t\t\t: false,\n\t\t};\n\t}, [] );\n\tconst { isDistractionFree } = useSelect( ( select ) => {\n\t\tconst { get } = select( preferencesStore );\n\t\treturn {\n\t\t\tisDistractionFree: get( 'core', 'distractionFree' ),\n\t\t};\n\t}, [] );\n\tconst selectedNote = useSelect(\n\t\t( select ) => unlock( select( editorStore ) ).getSelectedNote(),\n\t\t[]\n\t);\n\n\tconst { notes, unresolvedNotes } = useNoteThreads( postId );\n\n\t// Only enable the floating sidebar for large viewports.\n\tconst showFloatingSidebar = isLargeViewport;\n\t// Fallback to \"All notes\" sidebar on smaller viewports.\n\tconst showAllNotesSidebar = notes.length > 0 || ! showFloatingSidebar;\n\tuseEnableFloatingSidebar(\n\t\tshowFloatingSidebar &&\n\t\t\t( unresolvedNotes.length > 0 || selectedNote !== undefined )\n\t);\n\n\tuseShortcut(\n\t\t'core/editor/new-note',\n\t\t( event ) => {\n\t\t\tevent.preventDefault();\n\t\t\topenTheSidebar();\n\t\t},\n\t\t{\n\t\t\t// When multiple notes per block are supported. Remove note ID check.\n\t\t\t// See: https://github.com/WordPress/gutenberg/pull/75147.\n\t\t\tisDisabled:\n\t\t\t\tisDistractionFree || isClassicBlock || ! clientId || !! noteId,\n\t\t}\n\t);\n\n\t// Get the global styles to set the background color of the sidebar.\n\tconst { merged: GlobalStyles } = useGlobalStylesContext();\n\tconst backgroundColor = GlobalStyles?.styles?.color?.background;\n\n\t// Find the current thread for the selected block.\n\tconst currentThread = noteId\n\t\t? notes.find( ( thread ) => thread.id === noteId )\n\t\t: null;\n\n\tasync function openTheSidebar( selectedClientId ) {\n\t\tconst prevArea = await getActiveComplementaryArea( 'core' );\n\t\tconst activeNotesArea = SIDEBARS.find( ( name ) => name === prevArea );\n\t\tconst targetClientId =\n\t\t\tselectedClientId && selectedClientId !== clientId\n\t\t\t\t? selectedClientId\n\t\t\t\t: clientId;\n\t\tconst targetNote = notes.find(\n\t\t\t( note ) => note.blockClientId === targetClientId\n\t\t);\n\n\t\tif ( targetNote?.status === 'approved' ) {\n\t\t\tenableComplementaryArea( 'core', ALL_NOTES_SIDEBAR );\n\t\t} else if ( ! activeNotesArea || ! showAllNotesSidebar ) {\n\t\t\tenableComplementaryArea(\n\t\t\t\t'core',\n\t\t\t\tshowFloatingSidebar ? FLOATING_NOTES_SIDEBAR : ALL_NOTES_SIDEBAR\n\t\t\t);\n\t\t}\n\n\t\tconst currentArea = await getActiveComplementaryArea( 'core' );\n\t\t// Bail out if the current active area is not one of note sidebars.\n\t\tif ( ! SIDEBARS.includes( currentArea ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// A special case for the List View, where block selection isn't required to trigger an action.\n\t\t// The action won't do anything if the block is already selected.\n\t\tselectBlock( targetClientId, null );\n\t\ttoggleBlockSpotlight( targetClientId, true );\n\t\tselectNote( targetNote ? targetNote.id : 'new', { focus: true } );\n\t}\n\n\tif ( isDistractionFree ) {\n\t\treturn <AddNoteMenuItem isDistractionFree />;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{ !! currentThread && (\n\t\t\t\t<NoteAvatarIndicator\n\t\t\t\t\tnote={ currentThread }\n\t\t\t\t\tonClick={ openTheSidebar }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t<AddNoteMenuItem onClick={ openTheSidebar } />\n\t\t\t{ showAllNotesSidebar && (\n\t\t\t\t<PluginSidebar\n\t\t\t\t\tidentifier={ ALL_NOTES_SIDEBAR }\n\t\t\t\t\tname={ ALL_NOTES_SIDEBAR }\n\t\t\t\t\ttitle={ __( 'All notes' ) }\n\t\t\t\t\theader={\n\t\t\t\t\t\t<h2 className=\"interface-complementary-area-header__title\">\n\t\t\t\t\t\t\t{ __( 'All notes' ) }\n\t\t\t\t\t\t</h2>\n\t\t\t\t\t}\n\t\t\t\t\ticon={ commentIcon }\n\t\t\t\t\tcloseLabel={ __( 'Close Notes' ) }\n\t\t\t\t>\n\t\t\t\t\t<Notes notes={ notes } sidebarRef={ sidebarRef } />\n\t\t\t\t</PluginSidebar>\n\t\t\t) }\n\t\t\t{ isLargeViewport && (\n\t\t\t\t<PluginSidebar\n\t\t\t\t\tisPinnable={ false }\n\t\t\t\t\theader={ false }\n\t\t\t\t\tidentifier={ FLOATING_NOTES_SIDEBAR }\n\t\t\t\t\tclassName=\"editor-collab-sidebar\"\n\t\t\t\t\theaderClassName=\"editor-collab-sidebar__header\"\n\t\t\t\t\tbackgroundColor={ backgroundColor }\n\t\t\t\t>\n\t\t\t\t\t<Notes\n\t\t\t\t\t\tnotes={ unresolvedNotes }\n\t\t\t\t\t\tsidebarRef={ sidebarRef }\n\t\t\t\t\t\tstyles={ { backgroundColor } }\n\t\t\t\t\t\tisFloating\n\t\t\t\t\t/>\n\t\t\t\t</PluginSidebar>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default function NotesSidebarContainer() {\n\tconst { postId, editorMode, revisionsMode } = useSelect( ( select ) => {\n\t\tconst { getCurrentPostId, getEditorMode, isRevisionsMode } = unlock(\n\t\t\tselect( editorStore )\n\t\t);\n\t\treturn {\n\t\t\tpostId: getCurrentPostId(),\n\t\t\teditorMode: getEditorMode(),\n\t\t\trevisionsMode: isRevisionsMode(),\n\t\t};\n\t}, [] );\n\n\tif ( ! postId || typeof postId !== 'number' ) {\n\t\treturn null;\n\t}\n\n\t// Hide Notes sidebar for Code Editor and in-editor revision mode.\n\tif ( editorMode === 'text' || revisionsMode ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<PostTypeSupportCheck supportKeys=\"editor.notes\">\n\t\t\t<NotesSidebar postId={ postId } />\n\t\t</PostTypeSupportCheck>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";AAGA,SAAS,UAAU;AACnB,SAAS,WAAW,mBAAmB;AACvC,SAAS,cAAc;AACvB,SAAS,wBAAwB;AACjC,SAAS,mBAAmB;AAC5B,SAAS,WAAW,mBAAmB;AACvC,SAAS,SAAS,wBAAwB;AAC1C,SAAS,SAAS,sBAAsB;AACxC,SAAS,SAAS,wBAAwB;AAK1C,OAAO,mBAAmB;AAC1B;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,SAAS,aAAa;AACtB,SAAS,SAAS,mBAAmB;AACrC,SAAS,uBAAuB;AAChC,SAAS,2BAA2B;AACpC,SAAS,8BAA8B;AACvC,SAAS,gBAAgB,gCAAgC;AACzD,OAAO,0BAA0B;AACjC,SAAS,cAAc;AAyGd,SAIP,UAJO,KAIP,YAJO;AAvGT,SAAS,aAAc,EAAE,OAAO,GAAI;AACnC,QAAM,EAAE,2BAA2B,IAAI,UAAW,cAAe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O;AAAA,QACP,YAAa,GAAI,aAAc;AAAA,QAE/B,8BAAC,SAAM,OAAgB,YAA0B;AAAA;AAAA,IAClD;AAAA,IAEC,mBACD;AAAA,MAAC;AAAA;AAAA,QACA,YAAa;AAAA,QACb,QAAS;AAAA,QACT,YAAa;AAAA,QACb,WAAU;AAAA,QACV,iBAAgB;AAAA,QAChB;AAAA,QAEA;AAAA,UAAC;AAAA;AAAA,YACA,OAAQ;AAAA,YACR;AAAA,YACA,QAAS,EAAE,gBAAgB;AAAA,YAC3B,YAAU;AAAA;AAAA,QACX;AAAA;AAAA,IACD;AAAA,KAEF;AAEF;AAEe,SAAR,wBAAyC;AAC/C,QAAM,EAAE,QAAQ,YAAY,cAAc,IAAI,UAAW,CAAE,WAAY;AACtE,UAAM,EAAE,kBAAkB,eAAe,gBAAgB,IAAI;AAAA,MAC5D,OAAQ,WAAY;AAAA,IACrB;AACA,WAAO;AAAA,MACN,QAAQ,iBAAiB;AAAA,MACzB,YAAY,cAAc;AAAA,MAC1B,eAAe,gBAAgB;AAAA,IAChC;AAAA,EACD,GAAG,CAAC,CAAE;AAEN,MAAK,CAAE,UAAU,OAAO,WAAW,UAAW;AAC7C,WAAO;AAAA,EACR;AAGA,MAAK,eAAe,UAAU,eAAgB;AAC7C,WAAO;AAAA,EACR;AAEA,SACC,oBAAC,wBAAqB,aAAY,gBACjC,8BAAC,gBAAa,QAAkB,GACjC;AAEF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
// packages/editor/src/components/collab-sidebar/
|
|
2
|
-
import { Tooltip
|
|
1
|
+
// packages/editor/src/components/collab-sidebar/note-byline.js
|
|
2
|
+
import { Tooltip } from "@wordpress/components";
|
|
3
|
+
import { Stack } from "@wordpress/ui";
|
|
3
4
|
import { __, _x } from "@wordpress/i18n";
|
|
4
5
|
import {
|
|
5
6
|
dateI18n,
|
|
@@ -12,7 +13,7 @@ import { useSelect } from "@wordpress/data";
|
|
|
12
13
|
import { store as blockEditorStore } from "@wordpress/block-editor";
|
|
13
14
|
import { getAvatarBorderColor } from "./utils.mjs";
|
|
14
15
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
15
|
-
function
|
|
16
|
+
function NoteByline({ avatar, name, date, userId }) {
|
|
16
17
|
const hasAvatar = !!avatar;
|
|
17
18
|
const dateSettings = getDateSettings();
|
|
18
19
|
const {
|
|
@@ -70,7 +71,7 @@ function CommentAuthorInfo({ avatar, name, date, userId }) {
|
|
|
70
71
|
}
|
|
71
72
|
}
|
|
72
73
|
),
|
|
73
|
-
/* @__PURE__ */ jsxs(
|
|
74
|
+
/* @__PURE__ */ jsxs(Stack, { direction: "column", children: [
|
|
74
75
|
/* @__PURE__ */ jsx("span", { className: "editor-collab-sidebar-panel__user-name", children: name ?? currentUserName }),
|
|
75
76
|
date && /* @__PURE__ */ jsx(Tooltip, { text: tooltipText, children: /* @__PURE__ */ jsx(
|
|
76
77
|
"time",
|
|
@@ -83,8 +84,7 @@ function CommentAuthorInfo({ avatar, name, date, userId }) {
|
|
|
83
84
|
] })
|
|
84
85
|
] });
|
|
85
86
|
}
|
|
86
|
-
var comment_author_info_default = CommentAuthorInfo;
|
|
87
87
|
export {
|
|
88
|
-
|
|
88
|
+
NoteByline
|
|
89
89
|
};
|
|
90
|
-
//# sourceMappingURL=
|
|
90
|
+
//# sourceMappingURL=note-byline.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/collab-sidebar/note-byline.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { Tooltip } from '@wordpress/components';\nimport { Stack } from '@wordpress/ui';\nimport { __, _x } from '@wordpress/i18n';\nimport {\n\tdateI18n,\n\tgetSettings as getDateSettings,\n\thumanTimeDiff,\n\tgetDate,\n} from '@wordpress/date';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { getAvatarBorderColor } from './utils';\n\nexport function NoteByline( { avatar, name, date, userId } ) {\n\tconst hasAvatar = !! avatar;\n\tconst dateSettings = getDateSettings();\n\tconst {\n\t\tcurrentUserAvatar,\n\t\tcurrentUserName,\n\t\tcurrentUserId,\n\t\tdateFormat = dateSettings.formats.date,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst { canUser, getCurrentUser, getEntityRecord } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst siteSettings = canUser( 'read', {\n\t\t\t\tkind: 'root',\n\t\t\t\tname: 'site',\n\t\t\t} )\n\t\t\t\t? getEntityRecord( 'root', 'site' )\n\t\t\t\t: undefined;\n\n\t\t\tif ( hasAvatar ) {\n\t\t\t\treturn {\n\t\t\t\t\tdateFormat: siteSettings?.date_format,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tconst { getSettings } = select( blockEditorStore );\n\t\t\tconst { __experimentalDiscussionSettings } = getSettings();\n\t\t\tconst defaultAvatar = __experimentalDiscussionSettings?.avatarURL;\n\t\t\tconst userData = getCurrentUser();\n\t\t\treturn {\n\t\t\t\tcurrentUserAvatar:\n\t\t\t\t\tuserData?.avatar_urls?.[ 48 ] ?? defaultAvatar,\n\t\t\t\tcurrentUserName: userData?.name,\n\t\t\t\tcurrentUserId: userData?.id,\n\t\t\t\tdateFormat: siteSettings?.date_format,\n\t\t\t};\n\t\t},\n\t\t[ hasAvatar ]\n\t);\n\n\tconst commentDate = getDate( date );\n\tconst commentDateTime = dateI18n( 'c', commentDate );\n\tconst shouldShowHumanTimeDiff =\n\t\tMath.floor( ( new Date() - commentDate ) / ( 1000 * 60 * 60 * 24 ) ) <\n\t\t30;\n\n\tconst commentDateText = shouldShowHumanTimeDiff\n\t\t? humanTimeDiff( commentDate )\n\t\t: dateI18n( dateFormat, commentDate );\n\n\tconst tooltipText = dateI18n(\n\t\t// translators: Use a non-breaking space between 'g:i' and 'a' if appropriate.\n\t\t_x( 'F j, Y g:i\\xa0a', 'Note date full date format' ),\n\t\tdate\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t<img\n\t\t\t\tsrc={ avatar || currentUserAvatar }\n\t\t\t\tclassName=\"editor-collab-sidebar-panel__user-avatar\"\n\t\t\t\t// translators: alt text for user avatar image\n\t\t\t\talt={ __( 'User avatar' ) }\n\t\t\t\twidth={ 32 }\n\t\t\t\theight={ 32 }\n\t\t\t\tstyle={ {\n\t\t\t\t\tborderColor: getAvatarBorderColor(\n\t\t\t\t\t\tuserId ?? currentUserId\n\t\t\t\t\t),\n\t\t\t\t} }\n\t\t\t/>\n\t\t\t<Stack direction=\"column\">\n\t\t\t\t<span className=\"editor-collab-sidebar-panel__user-name\">\n\t\t\t\t\t{ name ?? currentUserName }\n\t\t\t\t</span>\n\t\t\t\t{ date && (\n\t\t\t\t\t<Tooltip text={ tooltipText }>\n\t\t\t\t\t\t<time\n\t\t\t\t\t\t\tdateTime={ commentDateTime }\n\t\t\t\t\t\t\tclassName=\"editor-collab-sidebar-panel__user-time\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ commentDateText }\n\t\t\t\t\t\t</time>\n\t\t\t\t\t</Tooltip>\n\t\t\t\t) }\n\t\t\t</Stack>\n\t\t</>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";AAGA,SAAS,eAAe;AACxB,SAAS,aAAa;AACtB,SAAS,IAAI,UAAU;AACvB;AAAA,EACC;AAAA,EACA,eAAe;AAAA,EACf;AAAA,EACA;AAAA,OACM;AACP,SAAS,SAAS,iBAAiB;AACnC,SAAS,iBAAiB;AAC1B,SAAS,SAAS,wBAAwB;AAK1C,SAAS,4BAA4B;AA2DnC,mBACC,KAaA,YAdD;AAzDK,SAAS,WAAY,EAAE,QAAQ,MAAM,MAAM,OAAO,GAAI;AAC5D,QAAM,YAAY,CAAC,CAAE;AACrB,QAAM,eAAe,gBAAgB;AACrC,QAAM;AAAA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C,SAAM,WAAU,UAChB;AAAA,0BAAC,UAAK,WAAU,0CACb,kBAAQ,iBACX;AAAA,MACE,QACD,oBAAC,WAAQ,MAAO,aACf;AAAA,QAAC;AAAA;AAAA,UACA,UAAW;AAAA,UACX,WAAU;AAAA,UAER;AAAA;AAAA,MACH,GACD;AAAA,OAEF;AAAA,KACD;AAEF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// packages/editor/src/components/collab-sidebar/note-card.js
|
|
2
|
+
import { FlexItem } from "@wordpress/components";
|
|
3
|
+
import { Stack } from "@wordpress/ui";
|
|
4
|
+
import { NoteByline } from "./note-byline.mjs";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
function NoteCard({ note, actions, className, children, ...props }) {
|
|
7
|
+
return /* @__PURE__ */ jsxs(Stack, { direction: "column", gap: "sm", className, ...props, children: [
|
|
8
|
+
/* @__PURE__ */ jsxs(Stack, { direction: "row", align: "center", justify: "flex-start", gap: "md", children: [
|
|
9
|
+
/* @__PURE__ */ jsx(
|
|
10
|
+
NoteByline,
|
|
11
|
+
{
|
|
12
|
+
avatar: note?.author_avatar_urls?.[48],
|
|
13
|
+
name: note?.author_name,
|
|
14
|
+
date: note?.date,
|
|
15
|
+
userId: note?.author
|
|
16
|
+
}
|
|
17
|
+
),
|
|
18
|
+
actions && /* @__PURE__ */ jsx(
|
|
19
|
+
FlexItem,
|
|
20
|
+
{
|
|
21
|
+
className: "editor-collab-sidebar-panel__note-actions",
|
|
22
|
+
onClick: (event) => event.stopPropagation(),
|
|
23
|
+
children: /* @__PURE__ */ jsx(Stack, { direction: "row", align: "center", children: actions })
|
|
24
|
+
}
|
|
25
|
+
)
|
|
26
|
+
] }),
|
|
27
|
+
children
|
|
28
|
+
] });
|
|
29
|
+
}
|
|
30
|
+
export {
|
|
31
|
+
NoteCard
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=note-card.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/collab-sidebar/note-card.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { FlexItem } from '@wordpress/components';\nimport { Stack } from '@wordpress/ui';\n\n/**\n * Internal dependencies\n */\nimport { NoteByline } from './note-byline';\n\nexport function NoteCard( { note, actions, className, children, ...props } ) {\n\treturn (\n\t\t<Stack direction=\"column\" gap=\"sm\" className={ className } { ...props }>\n\t\t\t<Stack direction=\"row\" align=\"center\" justify=\"flex-start\" gap=\"md\">\n\t\t\t\t<NoteByline\n\t\t\t\t\tavatar={ note?.author_avatar_urls?.[ 48 ] }\n\t\t\t\t\tname={ note?.author_name }\n\t\t\t\t\tdate={ note?.date }\n\t\t\t\t\tuserId={ note?.author }\n\t\t\t\t/>\n\t\t\t\t{ actions && (\n\t\t\t\t\t<FlexItem\n\t\t\t\t\t\tclassName=\"editor-collab-sidebar-panel__note-actions\"\n\t\t\t\t\t\tonClick={ ( event ) => event.stopPropagation() }\n\t\t\t\t\t>\n\t\t\t\t\t\t<Stack direction=\"row\" align=\"center\">\n\t\t\t\t\t\t\t{ actions }\n\t\t\t\t\t\t</Stack>\n\t\t\t\t\t</FlexItem>\n\t\t\t\t) }\n\t\t\t</Stack>\n\t\t\t{ children }\n\t\t</Stack>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";AAGA,SAAS,gBAAgB;AACzB,SAAS,aAAa;AAKtB,SAAS,kBAAkB;AAKxB,SACC,KADD;AAHI,SAAS,SAAU,EAAE,MAAM,SAAS,WAAW,UAAU,GAAG,MAAM,GAAI;AAC5E,SACC,qBAAC,SAAM,WAAU,UAAS,KAAI,MAAK,WAA0B,GAAG,OAC/D;AAAA,yBAAC,SAAM,WAAU,OAAM,OAAM,UAAS,SAAQ,cAAa,KAAI,MAC9D;AAAA;AAAA,QAAC;AAAA;AAAA,UACA,QAAS,MAAM,qBAAsB,EAAG;AAAA,UACxC,MAAO,MAAM;AAAA,UACb,MAAO,MAAM;AAAA,UACb,QAAS,MAAM;AAAA;AAAA,MAChB;AAAA,MACE,WACD;AAAA,QAAC;AAAA;AAAA,UACA,WAAU;AAAA,UACV,SAAU,CAAE,UAAW,MAAM,gBAAgB;AAAA,UAE7C,8BAAC,SAAM,WAAU,OAAM,OAAM,UAC1B,mBACH;AAAA;AAAA,MACD;AAAA,OAEF;AAAA,IACE;AAAA,KACH;AAEF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
// packages/editor/src/components/collab-sidebar/note-form.js
|
|
2
|
+
import TextareaAutosize from "react-autosize-textarea";
|
|
3
|
+
import { useState } from "@wordpress/element";
|
|
4
|
+
import {
|
|
5
|
+
__experimentalTruncate as Truncate,
|
|
6
|
+
Button
|
|
7
|
+
} from "@wordpress/components";
|
|
8
|
+
import { Stack, VisuallyHidden } from "@wordpress/ui";
|
|
9
|
+
import { __ } from "@wordpress/i18n";
|
|
10
|
+
import { useInstanceId } from "@wordpress/compose";
|
|
11
|
+
import { isKeyboardEvent } from "@wordpress/keycodes";
|
|
12
|
+
import { sanitizeNoteContent } from "./utils.mjs";
|
|
13
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
14
|
+
function NoteForm({ onSubmit, onCancel, note, labels }) {
|
|
15
|
+
const [inputComment, setInputComment] = useState(
|
|
16
|
+
note?.content?.raw ?? ""
|
|
17
|
+
);
|
|
18
|
+
const inputId = useInstanceId(NoteForm, "comment-input");
|
|
19
|
+
const isDisabled = inputComment === note?.content?.raw || !sanitizeNoteContent(inputComment).length;
|
|
20
|
+
return /* @__PURE__ */ jsxs(
|
|
21
|
+
Stack,
|
|
22
|
+
{
|
|
23
|
+
className: "editor-collab-sidebar-panel__note-form",
|
|
24
|
+
direction: "column",
|
|
25
|
+
gap: "lg",
|
|
26
|
+
render: /* @__PURE__ */ jsx("form", {}),
|
|
27
|
+
onSubmit: (event) => {
|
|
28
|
+
event.preventDefault();
|
|
29
|
+
onSubmit(inputComment);
|
|
30
|
+
setInputComment("");
|
|
31
|
+
},
|
|
32
|
+
children: [
|
|
33
|
+
/* @__PURE__ */ jsx(VisuallyHidden, { render: /* @__PURE__ */ jsx("label", { htmlFor: inputId }), children: labels?.input ?? __("Note") }),
|
|
34
|
+
/* @__PURE__ */ jsx(
|
|
35
|
+
TextareaAutosize,
|
|
36
|
+
{
|
|
37
|
+
id: inputId,
|
|
38
|
+
value: inputComment ?? "",
|
|
39
|
+
onChange: (comment) => setInputComment(comment.target.value),
|
|
40
|
+
rows: 1,
|
|
41
|
+
maxRows: 20,
|
|
42
|
+
onKeyDown: (event) => {
|
|
43
|
+
if (isKeyboardEvent.primary(event, "Enter") && !isDisabled) {
|
|
44
|
+
event.target.parentNode.requestSubmit();
|
|
45
|
+
}
|
|
46
|
+
if (event.key === "Escape") {
|
|
47
|
+
event.preventDefault();
|
|
48
|
+
onCancel(event);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
),
|
|
53
|
+
/* @__PURE__ */ jsxs(
|
|
54
|
+
Stack,
|
|
55
|
+
{
|
|
56
|
+
direction: "row",
|
|
57
|
+
align: "center",
|
|
58
|
+
justify: "flex-end",
|
|
59
|
+
gap: "sm",
|
|
60
|
+
wrap: "wrap",
|
|
61
|
+
children: [
|
|
62
|
+
/* @__PURE__ */ jsx(Button, { size: "compact", variant: "tertiary", onClick: onCancel, children: /* @__PURE__ */ jsx(Truncate, { children: __("Cancel") }) }),
|
|
63
|
+
/* @__PURE__ */ jsx(
|
|
64
|
+
Button,
|
|
65
|
+
{
|
|
66
|
+
size: "compact",
|
|
67
|
+
accessibleWhenDisabled: true,
|
|
68
|
+
variant: "primary",
|
|
69
|
+
type: "submit",
|
|
70
|
+
disabled: isDisabled,
|
|
71
|
+
children: /* @__PURE__ */ jsx(Truncate, { children: labels?.submit ?? __("Add note") })
|
|
72
|
+
}
|
|
73
|
+
)
|
|
74
|
+
]
|
|
75
|
+
}
|
|
76
|
+
)
|
|
77
|
+
]
|
|
78
|
+
}
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
export {
|
|
82
|
+
NoteForm
|
|
83
|
+
};
|
|
84
|
+
//# sourceMappingURL=note-form.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/collab-sidebar/note-form.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport TextareaAutosize from 'react-autosize-textarea';\n\n/**\n * WordPress dependencies\n */\nimport { useState } from '@wordpress/element';\nimport {\n\t__experimentalTruncate as Truncate,\n\tButton,\n} from '@wordpress/components';\nimport { Stack, VisuallyHidden } from '@wordpress/ui';\nimport { __ } from '@wordpress/i18n';\nimport { useInstanceId } from '@wordpress/compose';\nimport { isKeyboardEvent } from '@wordpress/keycodes';\n\n/**\n * Internal dependencies\n */\nimport { sanitizeNoteContent } from './utils';\n\nexport function NoteForm( { onSubmit, onCancel, note, labels } ) {\n\tconst [ inputComment, setInputComment ] = useState(\n\t\tnote?.content?.raw ?? ''\n\t);\n\n\tconst inputId = useInstanceId( NoteForm, 'comment-input' );\n\tconst isDisabled =\n\t\tinputComment === note?.content?.raw ||\n\t\t! sanitizeNoteContent( inputComment ).length;\n\n\treturn (\n\t\t<Stack\n\t\t\tclassName=\"editor-collab-sidebar-panel__note-form\"\n\t\t\tdirection=\"column\"\n\t\t\tgap=\"lg\"\n\t\t\trender={ <form /> }\n\t\t\tonSubmit={ ( event ) => {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tonSubmit( inputComment );\n\t\t\t\tsetInputComment( '' );\n\t\t\t} }\n\t\t>\n\t\t\t{ /* eslint-disable-next-line jsx-a11y/label-has-associated-control */ }\n\t\t\t<VisuallyHidden render={ <label htmlFor={ inputId } /> }>\n\t\t\t\t{ labels?.input ?? __( 'Note' ) }\n\t\t\t</VisuallyHidden>\n\t\t\t<TextareaAutosize\n\t\t\t\tid={ inputId }\n\t\t\t\tvalue={ inputComment ?? '' }\n\t\t\t\tonChange={ ( comment ) =>\n\t\t\t\t\tsetInputComment( comment.target.value )\n\t\t\t\t}\n\t\t\t\trows={ 1 }\n\t\t\t\tmaxRows={ 20 }\n\t\t\t\tonKeyDown={ ( event ) => {\n\t\t\t\t\tif (\n\t\t\t\t\t\tisKeyboardEvent.primary( event, 'Enter' ) &&\n\t\t\t\t\t\t! isDisabled\n\t\t\t\t\t) {\n\t\t\t\t\t\tevent.target.parentNode.requestSubmit();\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( event.key === 'Escape' ) {\n\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t// Passing event for reply forms.\n\t\t\t\t\t\tonCancel( event );\n\t\t\t\t\t}\n\t\t\t\t} }\n\t\t\t/>\n\t\t\t<Stack\n\t\t\t\tdirection=\"row\"\n\t\t\t\talign=\"center\"\n\t\t\t\tjustify=\"flex-end\"\n\t\t\t\tgap=\"sm\"\n\t\t\t\twrap=\"wrap\"\n\t\t\t>\n\t\t\t\t<Button size=\"compact\" variant=\"tertiary\" onClick={ onCancel }>\n\t\t\t\t\t<Truncate>{ __( 'Cancel' ) }</Truncate>\n\t\t\t\t</Button>\n\t\t\t\t<Button\n\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\tdisabled={ isDisabled }\n\t\t\t\t>\n\t\t\t\t\t<Truncate>{ labels?.submit ?? __( 'Add note' ) }</Truncate>\n\t\t\t\t</Button>\n\t\t\t</Stack>\n\t\t</Stack>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";AAGA,OAAO,sBAAsB;AAK7B,SAAS,gBAAgB;AACzB;AAAA,EACC,0BAA0B;AAAA,EAC1B;AAAA,OACM;AACP,SAAS,OAAO,sBAAsB;AACtC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SAAU,UACnD,8BAAC,YAAW,aAAI,QAAS,GAAG,GAC7B;AAAA,cACA;AAAA,gBAAC;AAAA;AAAA,kBACA,MAAK;AAAA,kBACL,wBAAsB;AAAA,kBACtB,SAAQ;AAAA,kBACR,MAAK;AAAA,kBACL,UAAW;AAAA,kBAEX,8BAAC,YAAW,kBAAQ,UAAU,GAAI,UAAW,GAAG;AAAA;AAAA,cACjD;AAAA;AAAA;AAAA,QACD;AAAA;AAAA;AAAA,EACD;AAEF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,38 +1,35 @@
|
|
|
1
|
-
// packages/editor/src/components/collab-sidebar/
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
__experimentalText as Text,
|
|
5
|
-
__experimentalHStack as HStack
|
|
6
|
-
} from "@wordpress/components";
|
|
1
|
+
// packages/editor/src/components/collab-sidebar/note-indicator-toolbar.js
|
|
2
|
+
import { ToolbarButton } from "@wordpress/components";
|
|
3
|
+
import { Stack } from "@wordpress/ui";
|
|
7
4
|
import { __, sprintf } from "@wordpress/i18n";
|
|
8
5
|
import { useMemo } from "@wordpress/element";
|
|
9
6
|
import { privateApis as blockEditorPrivateApis } from "@wordpress/block-editor";
|
|
10
7
|
import { unlock } from "../../lock-unlock.mjs";
|
|
11
8
|
import { getAvatarBorderColor } from "./utils.mjs";
|
|
12
9
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
13
|
-
var {
|
|
14
|
-
|
|
10
|
+
var { NoteIconToolbarSlotFill } = unlock(blockEditorPrivateApis);
|
|
11
|
+
function NoteAvatarIndicator({ onClick, note }) {
|
|
15
12
|
const threadParticipants = useMemo(() => {
|
|
16
|
-
if (!
|
|
13
|
+
if (!note) {
|
|
17
14
|
return [];
|
|
18
15
|
}
|
|
19
16
|
const participantsMap = /* @__PURE__ */ new Map();
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
if (
|
|
24
|
-
if (!participantsMap.has(
|
|
25
|
-
participantsMap.set(
|
|
26
|
-
name:
|
|
27
|
-
avatar:
|
|
28
|
-
id:
|
|
29
|
-
date:
|
|
17
|
+
const allNotes = [note, ...note.reply];
|
|
18
|
+
allNotes.sort((a, b) => new Date(a.date) - new Date(b.date));
|
|
19
|
+
allNotes.forEach((entry) => {
|
|
20
|
+
if (entry.author_name && entry.author_avatar_urls) {
|
|
21
|
+
if (!participantsMap.has(entry.author)) {
|
|
22
|
+
participantsMap.set(entry.author, {
|
|
23
|
+
name: entry.author_name,
|
|
24
|
+
avatar: entry.author_avatar_urls?.["48"] || entry.author_avatar_urls?.["96"],
|
|
25
|
+
id: entry.author,
|
|
26
|
+
date: entry.date
|
|
30
27
|
});
|
|
31
28
|
}
|
|
32
29
|
}
|
|
33
30
|
});
|
|
34
31
|
return Array.from(participantsMap.values());
|
|
35
|
-
}, [
|
|
32
|
+
}, [note]);
|
|
36
33
|
if (!threadParticipants.length) {
|
|
37
34
|
return null;
|
|
38
35
|
}
|
|
@@ -49,20 +46,20 @@ var CommentAvatarIndicator = ({ onClick, thread }) => {
|
|
|
49
46
|
__("+%s"),
|
|
50
47
|
overflowCount
|
|
51
48
|
);
|
|
52
|
-
return /* @__PURE__ */ jsx(
|
|
49
|
+
return /* @__PURE__ */ jsx(NoteIconToolbarSlotFill.Fill, { children: /* @__PURE__ */ jsx(
|
|
53
50
|
ToolbarButton,
|
|
54
51
|
{
|
|
55
|
-
className: "
|
|
52
|
+
className: "editor-note-indicator",
|
|
56
53
|
label: __("View notes"),
|
|
57
54
|
onClick: () => onClick(),
|
|
58
55
|
showTooltip: true,
|
|
59
|
-
children: /* @__PURE__ */ jsxs(
|
|
56
|
+
children: /* @__PURE__ */ jsxs(Stack, { direction: "row", align: "center", gap: "xs", children: [
|
|
60
57
|
visibleParticipants.map((participant) => /* @__PURE__ */ jsx(
|
|
61
58
|
"img",
|
|
62
59
|
{
|
|
63
60
|
src: participant.avatar,
|
|
64
61
|
alt: participant.name,
|
|
65
|
-
className: "
|
|
62
|
+
className: "editor-note-indicator__avatar",
|
|
66
63
|
style: {
|
|
67
64
|
borderColor: getAvatarBorderColor(
|
|
68
65
|
participant.id
|
|
@@ -71,13 +68,12 @@ var CommentAvatarIndicator = ({ onClick, thread }) => {
|
|
|
71
68
|
},
|
|
72
69
|
participant.id
|
|
73
70
|
)),
|
|
74
|
-
overflowCount > 0 && /* @__PURE__ */ jsx(
|
|
71
|
+
overflowCount > 0 && /* @__PURE__ */ jsx("span", { className: "editor-note-indicator__overflow", children: overflowText })
|
|
75
72
|
] })
|
|
76
73
|
}
|
|
77
74
|
) });
|
|
78
|
-
}
|
|
79
|
-
var comment_indicator_toolbar_default = CommentAvatarIndicator;
|
|
75
|
+
}
|
|
80
76
|
export {
|
|
81
|
-
|
|
77
|
+
NoteAvatarIndicator
|
|
82
78
|
};
|
|
83
|
-
//# sourceMappingURL=
|
|
79
|
+
//# sourceMappingURL=note-indicator-toolbar.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/collab-sidebar/note-indicator-toolbar.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { ToolbarButton } from '@wordpress/components';\nimport { Stack } from '@wordpress/ui';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useMemo } from '@wordpress/element';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { getAvatarBorderColor } from './utils';\n\nconst { NoteIconToolbarSlotFill } = unlock( blockEditorPrivateApis );\n\nexport function NoteAvatarIndicator( { onClick, note } ) {\n\tconst threadParticipants = useMemo( () => {\n\t\tif ( ! note ) {\n\t\t\treturn [];\n\t\t}\n\n\t\tconst participantsMap = new Map();\n\t\tconst allNotes = [ note, ...note.reply ];\n\n\t\t// Sort by date to show participants in chronological order.\n\t\tallNotes.sort( ( a, b ) => new Date( a.date ) - new Date( b.date ) );\n\n\t\tallNotes.forEach( ( entry ) => {\n\t\t\t// Track thread participants (original author + repliers).\n\t\t\tif ( entry.author_name && entry.author_avatar_urls ) {\n\t\t\t\tif ( ! participantsMap.has( entry.author ) ) {\n\t\t\t\t\tparticipantsMap.set( entry.author, {\n\t\t\t\t\t\tname: entry.author_name,\n\t\t\t\t\t\tavatar:\n\t\t\t\t\t\t\tentry.author_avatar_urls?.[ '48' ] ||\n\t\t\t\t\t\t\tentry.author_avatar_urls?.[ '96' ],\n\t\t\t\t\t\tid: entry.author,\n\t\t\t\t\t\tdate: entry.date,\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t}\n\t\t} );\n\n\t\treturn Array.from( participantsMap.values() );\n\t}, [ note ] );\n\n\tif ( ! threadParticipants.length ) {\n\t\treturn null;\n\t}\n\n\t// If there are more than 3 participants, show 2 avatars and a \"+n\" number.\n\tconst maxAvatars = 3;\n\tconst isOverflow = threadParticipants.length > maxAvatars;\n\tconst visibleParticipants = isOverflow\n\t\t? threadParticipants.slice( 0, maxAvatars - 1 )\n\t\t: threadParticipants;\n\tconst overflowCount = Math.max(\n\t\t0,\n\t\tthreadParticipants.length - visibleParticipants.length\n\t);\n\tconst threadHasMoreParticipants = threadParticipants.length > 100;\n\n\t// If we hit the note limit, show \"100+\" instead of exact overflow count.\n\tconst overflowText =\n\t\tthreadHasMoreParticipants && overflowCount > 0\n\t\t\t? __( '100+' )\n\t\t\t: sprintf(\n\t\t\t\t\t// translators: %s: Number of participants.\n\t\t\t\t\t__( '+%s' ),\n\t\t\t\t\toverflowCount\n\t\t\t );\n\n\treturn (\n\t\t<NoteIconToolbarSlotFill.Fill>\n\t\t\t<ToolbarButton\n\t\t\t\tclassName=\"editor-note-indicator\"\n\t\t\t\tlabel={ __( 'View notes' ) }\n\t\t\t\tonClick={ () => onClick() }\n\t\t\t\tshowTooltip\n\t\t\t>\n\t\t\t\t<Stack direction=\"row\" align=\"center\" gap=\"xs\">\n\t\t\t\t\t{ visibleParticipants.map( ( participant ) => (\n\t\t\t\t\t\t<img\n\t\t\t\t\t\t\tkey={ participant.id }\n\t\t\t\t\t\t\tsrc={ participant.avatar }\n\t\t\t\t\t\t\talt={ participant.name }\n\t\t\t\t\t\t\tclassName=\"editor-note-indicator__avatar\"\n\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\tborderColor: getAvatarBorderColor(\n\t\t\t\t\t\t\t\t\tparticipant.id\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) ) }\n\t\t\t\t\t{ overflowCount > 0 && (\n\t\t\t\t\t\t<span className=\"editor-note-indicator__overflow\">\n\t\t\t\t\t\t\t{ overflowText }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) }\n\t\t\t\t</Stack>\n\t\t\t</ToolbarButton>\n\t\t</NoteIconToolbarSlotFill.Fill>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";AAGA,SAAS,qBAAqB;AAC9B,SAAS,aAAa;AACtB,SAAS,IAAI,eAAe;AAC5B,SAAS,eAAe;AACxB,SAAS,eAAe,8BAA8B;AAKtD,SAAS,cAAc;AACvB,SAAS,4BAA4B;AAqEjC,SAEE,KAFF;AAnEJ,IAAM,EAAE,wBAAwB,IAAI,OAAQ,sBAAuB;AAE5D,SAAS,oBAAqB,EAAE,SAAS,KAAK,GAAI;AACxD,QAAM,qBAAqB,QAAS,MAAM;AACzC,QAAK,CAAE,MAAO;AACb,aAAO,CAAC;AAAA,IACT;AAEA,UAAM,kBAAkB,oBAAI,IAAI;AAChC,UAAM,WAAW,CAAE,MAAM,GAAG,KAAK,KAAM;AAGvC,aAAS,KAAM,CAAE,GAAG,MAAO,IAAI,KAAM,EAAE,IAAK,IAAI,IAAI,KAAM,EAAE,IAAK,CAAE;AAEnE,aAAS,QAAS,CAAE,UAAW;AAE9B,UAAK,MAAM,eAAe,MAAM,oBAAqB;AACpD,YAAK,CAAE,gBAAgB,IAAK,M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