@peers-app/peers-ui 0.14.0 → 0.15.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/.github/workflows/publish.yml +8 -5
- package/babel.config.js +4 -4
- package/biome.json +191 -0
- package/dist/command-palette/command-palette-ui.d.ts +1 -2
- package/dist/command-palette/command-palette-ui.js +175 -244
- package/dist/command-palette/command-palette.js +65 -64
- package/dist/components/chat-overlay.d.ts +2 -2
- package/dist/components/chat-overlay.js +160 -217
- package/dist/components/checkbox.d.ts +5 -4
- package/dist/components/checkbox.js +4 -7
- package/dist/components/group-switcher.d.ts +1 -2
- package/dist/components/group-switcher.js +119 -159
- package/dist/components/input-date.d.ts +3 -3
- package/dist/components/input-date.js +6 -6
- package/dist/components/input-number.d.ts +7 -6
- package/dist/components/input-number.js +25 -20
- package/dist/components/input.d.ts +5 -4
- package/dist/components/input.js +4 -7
- package/dist/components/inverse-lazy-list.d.ts +3 -3
- package/dist/components/inverse-lazy-list.js +13 -47
- package/dist/components/io-schema-values.d.ts +5 -6
- package/dist/components/io-schema-values.js +28 -65
- package/dist/components/io-schema.d.ts +4 -5
- package/dist/components/io-schema.js +42 -79
- package/dist/components/lazy-list.d.ts +3 -3
- package/dist/components/lazy-list.js +38 -58
- package/dist/components/list-screen.d.ts +3 -8
- package/dist/components/list-screen.js +28 -23
- package/dist/components/loading-indicator.d.ts +1 -2
- package/dist/components/loading-indicator.js +2 -6
- package/dist/components/markdown-editor/autolink-plugin.js +5 -8
- package/dist/components/markdown-editor/editor-inline.d.ts +2 -3
- package/dist/components/markdown-editor/editor-inline.js +2 -6
- package/dist/components/markdown-editor/editor.d.ts +6 -6
- package/dist/components/markdown-editor/editor.js +9 -19
- package/dist/components/markdown-editor/markdown-plugin.d.ts +1 -1
- package/dist/components/markdown-editor/markdown-plugin.js +20 -21
- package/dist/components/markdown-editor/mention-node.d.ts +2 -2
- package/dist/components/markdown-editor/mention-node.js +24 -24
- package/dist/components/markdown-editor/mentions-plugin.d.ts +2 -2
- package/dist/components/markdown-editor/mentions-plugin.js +61 -62
- package/dist/components/markdown-editor/theme.js +28 -28
- package/dist/components/markdown-editor/toolbar.d.ts +2 -3
- package/dist/components/markdown-editor/toolbar.js +32 -49
- package/dist/components/markdown-with-mentions.d.ts +1 -1
- package/dist/components/markdown-with-mentions.js +43 -43
- package/dist/components/message-logs/message-logs.d.ts +1 -2
- package/dist/components/message-logs/message-logs.js +91 -116
- package/dist/components/messages/avatar.d.ts +3 -4
- package/dist/components/messages/avatar.js +37 -46
- package/dist/components/messages/channel-message-list.d.ts +5 -6
- package/dist/components/messages/channel-message-list.js +34 -34
- package/dist/components/messages/channel-view.d.ts +1 -2
- package/dist/components/messages/channel-view.js +23 -57
- package/dist/components/messages/message-compose.d.ts +3 -4
- package/dist/components/messages/message-compose.js +27 -38
- package/dist/components/messages/message-display.d.ts +2 -3
- package/dist/components/messages/message-display.js +42 -95
- package/dist/components/messages/thread-message-list.d.ts +4 -5
- package/dist/components/messages/thread-message-list.js +29 -29
- package/dist/components/router.d.ts +1 -2
- package/dist/components/router.js +58 -66
- package/dist/components/save-button.d.ts +3 -3
- package/dist/components/save-button.js +23 -33
- package/dist/components/sortable-list.d.ts +11 -12
- package/dist/components/sortable-list.js +42 -22
- package/dist/components/tabs.d.ts +3 -3
- package/dist/components/tabs.js +16 -47
- package/dist/components/tooltip.d.ts +4 -4
- package/dist/components/tooltip.js +4 -9
- package/dist/components/trust-level-badge.d.ts +2 -3
- package/dist/components/trust-level-badge.js +16 -16
- package/dist/components/trust-level-dropdown.d.ts +3 -4
- package/dist/components/trust-level-dropdown.js +32 -55
- package/dist/components/typeahead.d.ts +3 -3
- package/dist/components/typeahead.js +48 -89
- package/dist/components/voice-indicator.d.ts +2 -2
- package/dist/components/voice-indicator.js +93 -106
- package/dist/components/voice-subscribe-events.d.ts +32 -0
- package/dist/components/voice-subscribe-events.js +2 -0
- package/dist/globals.d.ts +3 -5
- package/dist/globals.js +22 -33
- package/dist/hooks.d.ts +5 -5
- package/dist/hooks.js +22 -12
- package/dist/hooks.test.js +129 -145
- package/dist/index.d.ts +9 -8
- package/dist/index.js +13 -12
- package/dist/mention-configs.d.ts +2 -2
- package/dist/mention-configs.js +55 -42
- package/dist/screens/assistants/assistant-config.d.ts +2 -3
- package/dist/screens/assistants/assistant-config.js +9 -22
- package/dist/screens/assistants/assistant-details.d.ts +1 -2
- package/dist/screens/assistants/assistant-details.js +13 -28
- package/dist/screens/assistants/assistant-info.d.ts +2 -3
- package/dist/screens/assistants/assistant-info.js +3 -17
- package/dist/screens/assistants/assistant-list.d.ts +1 -2
- package/dist/screens/assistants/assistant-list.js +15 -56
- package/dist/screens/assistants/assistant-tools.d.ts +2 -3
- package/dist/screens/assistants/assistant-tools.js +10 -24
- package/dist/screens/console-logs/console-logs-list.d.ts +1 -2
- package/dist/screens/console-logs/console-logs-list.js +130 -134
- package/dist/screens/console-logs/log-display.d.ts +2 -3
- package/dist/screens/console-logs/log-display.js +40 -42
- package/dist/screens/console-logs/log-filters.d.ts +1 -2
- package/dist/screens/console-logs/log-filters.js +2 -24
- package/dist/screens/console-logs/mobile-log-card.d.ts +2 -3
- package/dist/screens/console-logs/mobile-log-card.js +64 -67
- package/dist/screens/console-logs/resizable-table-header.d.ts +1 -2
- package/dist/screens/console-logs/resizable-table-header.js +31 -67
- package/dist/screens/contacts/contact-details.d.ts +1 -2
- package/dist/screens/contacts/contact-details.js +16 -46
- package/dist/screens/contacts/contact-list.d.ts +1 -2
- package/dist/screens/contacts/contact-list.js +44 -103
- package/dist/screens/contacts/index.d.ts +4 -4
- package/dist/screens/contacts/index.js +1 -1
- package/dist/screens/contacts/user-connect.d.ts +1 -2
- package/dist/screens/contacts/user-connect.js +85 -186
- package/dist/screens/data-explorer/data-explorer.d.ts +1 -2
- package/dist/screens/data-explorer/data-explorer.js +61 -181
- package/dist/screens/data-explorer/index.d.ts +2 -2
- package/dist/screens/data-explorer/query-executor.d.ts +1 -2
- package/dist/screens/data-explorer/query-executor.js +56 -166
- package/dist/screens/groups/group-details.d.ts +1 -2
- package/dist/screens/groups/group-details.js +27 -122
- package/dist/screens/groups/group-invite-listener.d.ts +2 -3
- package/dist/screens/groups/group-invite-listener.js +8 -104
- package/dist/screens/groups/group-list.d.ts +1 -2
- package/dist/screens/groups/group-list.js +56 -133
- package/dist/screens/groups/group-members.d.ts +2 -3
- package/dist/screens/groups/group-members.js +62 -132
- package/dist/screens/groups/index.d.ts +4 -4
- package/dist/screens/groups/index.js +1 -1
- package/dist/screens/join-group/index.d.ts +2 -2
- package/dist/screens/join-group/join-group.d.ts +1 -2
- package/dist/screens/join-group/join-group.js +9 -109
- package/dist/screens/network-viewer/connection-troubleshooter.d.ts +2 -3
- package/dist/screens/network-viewer/connection-troubleshooter.js +89 -193
- package/dist/screens/network-viewer/cpu-usage-graph.d.ts +1 -2
- package/dist/screens/network-viewer/cpu-usage-graph.js +60 -99
- package/dist/screens/network-viewer/device-details-modal.d.ts +1 -2
- package/dist/screens/network-viewer/device-details-modal.js +25 -177
- package/dist/screens/network-viewer/group-details-modal.d.ts +1 -2
- package/dist/screens/network-viewer/group-details-modal.js +31 -142
- package/dist/screens/network-viewer/index.d.ts +4 -4
- package/dist/screens/network-viewer/index.js +3 -3
- package/dist/screens/network-viewer/network-viewer-ipc.d.ts +22 -0
- package/dist/screens/network-viewer/network-viewer-ipc.js +6 -0
- package/dist/screens/network-viewer/network-viewer.d.ts +1 -2
- package/dist/screens/network-viewer/network-viewer.js +91 -296
- package/dist/screens/network-viewer/usage-graph.d.ts +1 -2
- package/dist/screens/network-viewer/usage-graph.js +78 -110
- package/dist/screens/packages/package-details.d.ts +1 -2
- package/dist/screens/packages/package-details.js +35 -41
- package/dist/screens/packages/package-info.d.ts +2 -2
- package/dist/screens/packages/package-info.js +33 -86
- package/dist/screens/packages/package-list.d.ts +1 -2
- package/dist/screens/packages/package-list.js +42 -106
- package/dist/screens/packages/package-new-local.d.ts +1 -2
- package/dist/screens/packages/package-new-local.js +13 -19
- package/dist/screens/packages/package-versions.d.ts +2 -3
- package/dist/screens/packages/package-versions.js +29 -96
- package/dist/screens/peer-types/peer-type-details.d.ts +3 -4
- package/dist/screens/peer-types/peer-type-details.js +26 -78
- package/dist/screens/peer-types/peer-type-list.d.ts +1 -2
- package/dist/screens/peer-types/peer-type-list.js +13 -24
- package/dist/screens/search/global-search.d.ts +1 -2
- package/dist/screens/search/global-search.js +104 -182
- package/dist/screens/settings/color-mode-dropdown.d.ts +3 -4
- package/dist/screens/settings/color-mode-dropdown.js +18 -37
- package/dist/screens/settings/settings-page.d.ts +1 -1
- package/dist/screens/settings/settings-page.js +86 -213
- package/dist/screens/settings/voice-settings-agent.d.ts +1 -1
- package/dist/screens/settings/voice-settings-agent.js +7 -44
- package/dist/screens/settings/voice-settings-api-keys.d.ts +2 -2
- package/dist/screens/settings/voice-settings-api-keys.js +2 -29
- package/dist/screens/settings/voice-settings-output.d.ts +2 -2
- package/dist/screens/settings/voice-settings-output.js +2 -40
- package/dist/screens/settings/voice-settings-providers.d.ts +2 -2
- package/dist/screens/settings/voice-settings-providers.js +2 -19
- package/dist/screens/settings/voice-settings-types.d.ts +4 -4
- package/dist/screens/settings/voice-settings-types.js +31 -31
- package/dist/screens/settings/voice-settings-wake-word.d.ts +2 -2
- package/dist/screens/settings/voice-settings-wake-word.js +2 -33
- package/dist/screens/settings/voice-settings.d.ts +1 -1
- package/dist/screens/settings/voice-settings.js +35 -112
- package/dist/screens/setup-user.d.ts +1 -2
- package/dist/screens/setup-user.js +38 -116
- package/dist/screens/tools/tool-code.d.ts +2 -3
- package/dist/screens/tools/tool-code.js +9 -13
- package/dist/screens/tools/tool-details.d.ts +1 -2
- package/dist/screens/tools/tool-details.js +26 -39
- package/dist/screens/tools/tool-info.d.ts +2 -3
- package/dist/screens/tools/tool-info.js +9 -48
- package/dist/screens/tools/tool-list.d.ts +1 -2
- package/dist/screens/tools/tool-list.js +33 -65
- package/dist/screens/tools/tool-schema.d.ts +2 -3
- package/dist/screens/tools/tool-schema.js +2 -13
- package/dist/screens/tools/tool-test-details.d.ts +1 -2
- package/dist/screens/tools/tool-test-details.js +12 -28
- package/dist/screens/tools/tool-test-list.d.ts +1 -2
- package/dist/screens/tools/tool-test-list.js +17 -56
- package/dist/screens/variables/variable-details.d.ts +1 -2
- package/dist/screens/variables/variable-details.js +19 -86
- package/dist/screens/variables/variable-list.d.ts +1 -2
- package/dist/screens/variables/variable-list.js +16 -27
- package/dist/screens/welcome-modal.d.ts +1 -2
- package/dist/screens/welcome-modal.js +44 -111
- package/dist/screens/workflows/workflow-details.d.ts +1 -2
- package/dist/screens/workflows/workflow-details.js +17 -31
- package/dist/screens/workflows/workflow-info.d.ts +2 -3
- package/dist/screens/workflows/workflow-info.js +2 -9
- package/dist/screens/workflows/workflow-instructions.d.ts +2 -3
- package/dist/screens/workflows/workflow-instructions.js +23 -55
- package/dist/screens/workflows/workflow-list.d.ts +1 -2
- package/dist/screens/workflows/workflow-list.js +23 -62
- package/dist/setupTests.d.ts +1 -1
- package/dist/setupTests.js +10 -11
- package/dist/system-apps/assistants.app.d.ts +1 -1
- package/dist/system-apps/assistants.app.js +3 -3
- package/dist/system-apps/console-logs.app.d.ts +1 -1
- package/dist/system-apps/console-logs.app.js +3 -3
- package/dist/system-apps/contacts.app.d.ts +1 -1
- package/dist/system-apps/contacts.app.js +4 -4
- package/dist/system-apps/data-explorer.app.d.ts +1 -1
- package/dist/system-apps/data-explorer.app.js +4 -4
- package/dist/system-apps/groups.app.d.ts +1 -1
- package/dist/system-apps/groups.app.js +4 -4
- package/dist/system-apps/index.d.ts +17 -17
- package/dist/system-apps/index.js +52 -52
- package/dist/system-apps/join-group.app.d.ts +1 -1
- package/dist/system-apps/join-group.app.js +4 -4
- package/dist/system-apps/mobile-settings.app.d.ts +1 -1
- package/dist/system-apps/mobile-settings.app.js +3 -3
- package/dist/system-apps/network-viewer.app.d.ts +1 -1
- package/dist/system-apps/network-viewer.app.js +4 -4
- package/dist/system-apps/packages.app.d.ts +1 -1
- package/dist/system-apps/packages.app.js +3 -3
- package/dist/system-apps/search.app.d.ts +1 -1
- package/dist/system-apps/search.app.js +4 -4
- package/dist/system-apps/settings.app.d.ts +1 -1
- package/dist/system-apps/settings.app.js +3 -3
- package/dist/system-apps/threads.app.d.ts +1 -1
- package/dist/system-apps/threads.app.js +3 -3
- package/dist/system-apps/tools.app.d.ts +1 -1
- package/dist/system-apps/tools.app.js +3 -3
- package/dist/system-apps/types.app.d.ts +1 -1
- package/dist/system-apps/types.app.js +3 -3
- package/dist/system-apps/variables.app.d.ts +1 -1
- package/dist/system-apps/variables.app.js +3 -3
- package/dist/system-apps/workflows.app.d.ts +1 -1
- package/dist/system-apps/workflows.app.js +3 -3
- package/dist/tabs-layout/tabs-layout.d.ts +2 -3
- package/dist/tabs-layout/tabs-layout.js +215 -246
- package/dist/tabs-layout/tabs-state.d.ts +2 -2
- package/dist/tabs-layout/tabs-state.js +73 -61
- package/dist/ui-defaults/index.d.ts +2 -2
- package/dist/ui-defaults/list-screen.d.ts +2 -3
- package/dist/ui-defaults/list-screen.js +33 -37
- package/dist/ui-defaults/markdown-field.js +24 -56
- package/dist/ui-router/routes-loader.d.ts +1 -1
- package/dist/ui-router/routes-loader.js +17 -13
- package/dist/ui-router/ui-loader.d.ts +6 -6
- package/dist/ui-router/ui-loader.js +172 -268
- package/dist/utils.js +49 -39
- package/jest.config.js +16 -16
- package/package.json +16 -14
- package/src/command-palette/command-palette-ui.tsx +261 -237
- package/src/command-palette/command-palette.ts +81 -78
- package/src/components/chat-overlay.tsx +366 -261
- package/src/components/checkbox.tsx +15 -12
- package/src/components/group-switcher.tsx +150 -105
- package/src/components/input-date.tsx +17 -16
- package/src/components/input-number.tsx +47 -31
- package/src/components/input.tsx +15 -12
- package/src/components/inverse-lazy-list.tsx +14 -13
- package/src/components/io-schema-values.tsx +51 -69
- package/src/components/io-schema.tsx +94 -69
- package/src/components/lazy-list.tsx +51 -34
- package/src/components/list-screen.tsx +51 -35
- package/src/components/loading-indicator.tsx +2 -4
- package/src/components/markdown-editor/autolink-plugin.tsx +4 -11
- package/src/components/markdown-editor/editor-inline.tsx +3 -4
- package/src/components/markdown-editor/editor.tsx +53 -51
- package/src/components/markdown-editor/markdown-plugin.tsx +48 -40
- package/src/components/markdown-editor/mention-node.ts +39 -38
- package/src/components/markdown-editor/mentions-plugin.tsx +99 -101
- package/src/components/markdown-editor/theme.ts +28 -29
- package/src/components/markdown-editor/toolbar.tsx +53 -47
- package/src/components/markdown-with-mentions.tsx +56 -46
- package/src/components/message-logs/message-logs.tsx +225 -165
- package/src/components/messages/avatar.tsx +70 -52
- package/src/components/messages/channel-message-list.tsx +80 -68
- package/src/components/messages/channel-view.tsx +34 -33
- package/src/components/messages/message-compose.tsx +84 -67
- package/src/components/messages/message-display.tsx +103 -89
- package/src/components/messages/thread-message-list.tsx +53 -44
- package/src/components/router.tsx +42 -43
- package/src/components/save-button.tsx +43 -39
- package/src/components/sortable-list.tsx +77 -49
- package/src/components/tabs.tsx +31 -31
- package/src/components/tooltip.tsx +21 -28
- package/src/components/trust-level-badge.tsx +15 -11
- package/src/components/trust-level-dropdown.tsx +49 -19
- package/src/components/typeahead.tsx +57 -59
- package/src/components/voice-indicator.tsx +158 -141
- package/src/components/voice-subscribe-events.ts +20 -0
- package/src/globals.tsx +42 -40
- package/src/hooks.test.tsx +141 -134
- package/src/hooks.ts +80 -48
- package/src/index.tsx +17 -10
- package/src/mention-configs.ts +122 -68
- package/src/screens/assistants/assistant-config.tsx +28 -18
- package/src/screens/assistants/assistant-details.tsx +35 -36
- package/src/screens/assistants/assistant-info.tsx +16 -11
- package/src/screens/assistants/assistant-list.tsx +37 -34
- package/src/screens/assistants/assistant-tools.tsx +41 -20
- package/src/screens/console-logs/console-logs-list.tsx +173 -140
- package/src/screens/console-logs/log-display.tsx +65 -38
- package/src/screens/console-logs/log-filters.tsx +4 -3
- package/src/screens/console-logs/mobile-log-card.tsx +78 -71
- package/src/screens/console-logs/resizable-table-header.tsx +29 -21
- package/src/screens/contacts/contact-details.tsx +29 -30
- package/src/screens/contacts/contact-list.tsx +71 -60
- package/src/screens/contacts/index.ts +5 -5
- package/src/screens/contacts/user-connect.tsx +177 -171
- package/src/screens/data-explorer/data-explorer.tsx +134 -98
- package/src/screens/data-explorer/index.ts +2 -3
- package/src/screens/data-explorer/query-executor.tsx +90 -80
- package/src/screens/groups/group-details.tsx +120 -101
- package/src/screens/groups/group-invite-listener.tsx +34 -37
- package/src/screens/groups/group-list.tsx +119 -103
- package/src/screens/groups/group-members.tsx +225 -164
- package/src/screens/groups/index.ts +5 -6
- package/src/screens/join-group/index.ts +2 -2
- package/src/screens/join-group/join-group.tsx +41 -39
- package/src/screens/network-viewer/connection-troubleshooter.tsx +145 -104
- package/src/screens/network-viewer/cpu-usage-graph.tsx +39 -43
- package/src/screens/network-viewer/device-details-modal.tsx +46 -59
- package/src/screens/network-viewer/group-details-modal.tsx +68 -49
- package/src/screens/network-viewer/index.ts +4 -5
- package/src/screens/network-viewer/network-viewer-ipc.ts +23 -0
- package/src/screens/network-viewer/network-viewer.tsx +261 -236
- package/src/screens/network-viewer/usage-graph.tsx +57 -49
- package/src/screens/packages/package-details.tsx +43 -35
- package/src/screens/packages/package-info.tsx +107 -66
- package/src/screens/packages/package-list.tsx +175 -98
- package/src/screens/packages/package-new-local.tsx +28 -26
- package/src/screens/packages/package-versions.tsx +102 -77
- package/src/screens/peer-types/peer-type-details.tsx +60 -50
- package/src/screens/peer-types/peer-type-list.tsx +20 -30
- package/src/screens/search/global-search.tsx +153 -137
- package/src/screens/settings/color-mode-dropdown.tsx +52 -35
- package/src/screens/settings/settings-page.tsx +215 -141
- package/src/screens/settings/voice-settings-agent.tsx +13 -12
- package/src/screens/settings/voice-settings-api-keys.tsx +14 -12
- package/src/screens/settings/voice-settings-output.tsx +12 -11
- package/src/screens/settings/voice-settings-providers.tsx +7 -3
- package/src/screens/settings/voice-settings-types.ts +52 -49
- package/src/screens/settings/voice-settings-wake-word.tsx +25 -9
- package/src/screens/settings/voice-settings.tsx +66 -43
- package/src/screens/setup-user.tsx +88 -41
- package/src/screens/tools/tool-code.tsx +12 -17
- package/src/screens/tools/tool-details.tsx +28 -28
- package/src/screens/tools/tool-info.tsx +14 -19
- package/src/screens/tools/tool-list.tsx +58 -40
- package/src/screens/tools/tool-schema.tsx +16 -9
- package/src/screens/tools/tool-test-details.tsx +11 -22
- package/src/screens/tools/tool-test-list.tsx +29 -30
- package/src/screens/variables/variable-details.tsx +63 -51
- package/src/screens/variables/variable-list.tsx +29 -30
- package/src/screens/welcome-modal.tsx +68 -48
- package/src/screens/workflows/workflow-details.tsx +40 -30
- package/src/screens/workflows/workflow-info.tsx +4 -11
- package/src/screens/workflows/workflow-instructions.tsx +35 -28
- package/src/screens/workflows/workflow-list.tsx +50 -40
- package/src/setupTests.ts +14 -13
- package/src/system-apps/assistants.app.ts +5 -5
- package/src/system-apps/console-logs.app.ts +4 -4
- package/src/system-apps/contacts.app.ts +6 -6
- package/src/system-apps/data-explorer.app.ts +5 -5
- package/src/system-apps/groups.app.ts +6 -6
- package/src/system-apps/index.ts +49 -49
- package/src/system-apps/join-group.app.ts +5 -5
- package/src/system-apps/mobile-settings.app.ts +4 -5
- package/src/system-apps/network-viewer.app.ts +5 -5
- package/src/system-apps/packages.app.ts +5 -5
- package/src/system-apps/search.app.ts +6 -6
- package/src/system-apps/settings.app.ts +5 -5
- package/src/system-apps/threads.app.ts +5 -5
- package/src/system-apps/tools.app.ts +5 -5
- package/src/system-apps/types.app.ts +5 -5
- package/src/system-apps/variables.app.ts +5 -5
- package/src/system-apps/workflows.app.ts +5 -5
- package/src/tabs-layout/tabs-layout.tsx +345 -254
- package/src/tabs-layout/tabs-state.ts +100 -81
- package/src/ui-defaults/index.ts +2 -3
- package/src/ui-defaults/list-screen.tsx +45 -40
- package/src/ui-defaults/markdown-field.tsx +22 -26
- package/src/ui-router/routes-loader.ts +40 -24
- package/src/ui-router/ui-loader.tsx +312 -214
- package/src/utils.ts +68 -81
- package/tsconfig.json +5 -10
- package/dist/components/input-datetime.d.ts +0 -7
- package/dist/components/input-datetime.js +0 -35
- package/dist/components/lazy-sortable-list.d.ts +0 -29
- package/dist/components/lazy-sortable-list.js +0 -12
- package/dist/components/left-bar.d.ts +0 -5
- package/dist/components/left-bar.js +0 -207
- package/dist/components/main-content-container.d.ts +0 -2
- package/dist/components/main-content-container.js +0 -92
- package/dist/components/messages/thread-view.d.ts +0 -6
- package/dist/components/messages/thread-view.js +0 -174
- package/dist/components/off-canvas.d.ts +0 -13
- package/dist/components/off-canvas.js +0 -89
- package/dist/components/text-list-editor.tsx/text-list-editor.d.ts +0 -6
- package/dist/components/text-list-editor.tsx/text-list-editor.js +0 -13
- package/dist/components/top-bar.d.ts +0 -2
- package/dist/components/top-bar.js +0 -51
- package/dist/components/typeahead/mentions-plugin.d.ts +0 -7
- package/dist/components/typeahead/mentions-plugin.js +0 -203
- package/dist/components/typeahead/typeahead-editor.d.ts +0 -15
- package/dist/components/typeahead/typeahead-editor.js +0 -134
- package/dist/components/typeahead/typeahead.d.ts +0 -12
- package/dist/components/typeahead/typeahead.js +0 -94
- package/dist/screens/profile.d.ts +0 -2
- package/dist/screens/profile.js +0 -76
- package/src/components/input-datetime.tsx +0 -41
- package/src/components/lazy-sortable-list.tsx +0 -51
- package/src/components/left-bar.tsx +0 -322
- package/src/components/main-content-container.tsx +0 -79
- package/src/components/messages/thread-view.tsx +0 -214
- package/src/components/off-canvas.tsx +0 -83
- package/src/components/text-list-editor.tsx/text-list-editor.tsx +0 -13
- package/src/components/top-bar.tsx +0 -119
- package/src/components/typeahead/mentions-plugin.tsx +0 -265
- package/src/components/typeahead/typeahead-editor.tsx +0 -140
- package/src/components/typeahead/typeahead.tsx +0 -77
- package/src/screens/profile.tsx +0 -75
|
@@ -35,6 +35,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.MENTIONS_MAX_RESULTS = void 0;
|
|
37
37
|
exports.MentionsPlugin = MentionsPlugin;
|
|
38
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
38
39
|
const LexicalComposerContext_1 = require("@lexical/react/LexicalComposerContext");
|
|
39
40
|
const LexicalTypeaheadMenuPlugin_1 = require("@lexical/react/LexicalTypeaheadMenuPlugin");
|
|
40
41
|
const peers_sdk_1 = require("@peers-app/peers-sdk");
|
|
@@ -44,50 +45,50 @@ const React = __importStar(require("react"));
|
|
|
44
45
|
const react_1 = require("react");
|
|
45
46
|
const ReactDOM = __importStar(require("react-dom"));
|
|
46
47
|
const mention_node_1 = require("./mention-node");
|
|
47
|
-
const PUNCTUATION =
|
|
48
|
-
const NAME =
|
|
48
|
+
const PUNCTUATION = "\\.,\\+\\*\\?\\$\\@\\|#{}\\(\\)\\^\\-\\[\\]\\\\/!%'\"~=<>_:;";
|
|
49
|
+
const NAME = `\\b[A-Z][^\\s${PUNCTUATION}]`;
|
|
49
50
|
const DocumentMentionsRegex = {
|
|
50
51
|
NAME,
|
|
51
52
|
PUNCTUATION,
|
|
52
53
|
};
|
|
53
54
|
const PUNC = DocumentMentionsRegex.PUNCTUATION;
|
|
54
|
-
const TRIGGERS = [
|
|
55
|
+
const TRIGGERS = ["@", "<"].join("");
|
|
55
56
|
// Chars we expect to see in a mention (non-space, non-punctuation).
|
|
56
|
-
const VALID_CHARS =
|
|
57
|
+
const VALID_CHARS = `[^${TRIGGERS}${PUNC}\\s]`;
|
|
57
58
|
// Non-standard series of chars. Each series must be preceded and followed by
|
|
58
59
|
// a valid char.
|
|
59
|
-
const VALID_JOINS =
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
60
|
+
const VALID_JOINS = "(?:" +
|
|
61
|
+
"\\.[ |$]|" + // E.g. "r. " in "Mr. Smith"
|
|
62
|
+
" |" + // E.g. " " in "Josh Duck"
|
|
63
|
+
"[" +
|
|
63
64
|
PUNC +
|
|
64
|
-
|
|
65
|
-
|
|
65
|
+
"]|" + // E.g. "-' in "Salier-Hellendag"
|
|
66
|
+
")";
|
|
66
67
|
const LENGTH_LIMIT = 75;
|
|
67
|
-
const AtSignMentionsRegex = new RegExp(
|
|
68
|
-
|
|
68
|
+
const AtSignMentionsRegex = new RegExp("(^|\\s|\\()(" +
|
|
69
|
+
"[" +
|
|
69
70
|
TRIGGERS +
|
|
70
|
-
|
|
71
|
-
|
|
71
|
+
"]" +
|
|
72
|
+
"((?:" +
|
|
72
73
|
VALID_CHARS +
|
|
73
74
|
VALID_JOINS +
|
|
74
|
-
|
|
75
|
+
"){0," +
|
|
75
76
|
LENGTH_LIMIT +
|
|
76
|
-
|
|
77
|
-
|
|
77
|
+
"})" +
|
|
78
|
+
")$");
|
|
78
79
|
// 50 is the longest alias length limit.
|
|
79
80
|
const ALIAS_LENGTH_LIMIT = 50;
|
|
80
81
|
// Regex used to match alias.
|
|
81
|
-
const AtSignMentionsRegexAliasRegex = new RegExp(
|
|
82
|
-
|
|
82
|
+
const AtSignMentionsRegexAliasRegex = new RegExp("(^|\\s|\\()(" +
|
|
83
|
+
"[" +
|
|
83
84
|
TRIGGERS +
|
|
84
|
-
|
|
85
|
-
|
|
85
|
+
"]" +
|
|
86
|
+
"((?:" +
|
|
86
87
|
VALID_CHARS +
|
|
87
|
-
|
|
88
|
+
"){0," +
|
|
88
89
|
ALIAS_LENGTH_LIMIT +
|
|
89
|
-
|
|
90
|
-
|
|
90
|
+
"})" +
|
|
91
|
+
")$");
|
|
91
92
|
// At most, 5 suggestions are shown in the popup.
|
|
92
93
|
const SUGGESTION_LIST_LENGTH_LIMIT = 10;
|
|
93
94
|
exports.MENTIONS_MAX_RESULTS = 10;
|
|
@@ -102,31 +103,31 @@ function useMentionLookupService(mentionString, mentionConfigs = []) {
|
|
|
102
103
|
const prefix = mentionString[0];
|
|
103
104
|
mentionString = mentionString.slice(1);
|
|
104
105
|
// TODO simplify how users can include completed tasks in their search
|
|
105
|
-
|
|
106
|
+
const searchCompletedTasks = prefix === "$" && mentionString.startsWith("done");
|
|
106
107
|
if (searchCompletedTasks) {
|
|
107
108
|
mentionString = mentionString.slice(4);
|
|
108
109
|
}
|
|
109
|
-
let kind =
|
|
110
|
-
if (mentionString.includes(
|
|
111
|
-
const parts = mentionString.split(
|
|
110
|
+
let kind = "";
|
|
111
|
+
if (mentionString.includes(":")) {
|
|
112
|
+
const parts = mentionString.split(":");
|
|
112
113
|
kind = parts[0];
|
|
113
|
-
mentionString = parts[1] ||
|
|
114
|
+
mentionString = parts[1] || "";
|
|
114
115
|
}
|
|
115
|
-
const config = mentionConfigs?.find(c => c.kind === kind);
|
|
116
|
+
const config = mentionConfigs?.find((c) => c.kind === kind);
|
|
116
117
|
if (config) {
|
|
117
118
|
const results = await config.query(mentionString);
|
|
118
119
|
setResults(results);
|
|
119
120
|
return;
|
|
120
121
|
}
|
|
121
|
-
const results = await Promise.all(mentionConfigs?.map(c => c.query(mentionString ||
|
|
122
|
+
const results = await Promise.all(mentionConfigs?.map((c) => c.query(mentionString || "")));
|
|
122
123
|
let allResults = results.flat();
|
|
123
|
-
allResults = (0, lodash_1.uniqBy)(allResults,
|
|
124
|
+
allResults = (0, lodash_1.uniqBy)(allResults, "id");
|
|
124
125
|
let filteredResults = allResults;
|
|
125
|
-
if (prefix ===
|
|
126
|
-
filteredResults = filteredResults.filter((result) => result.kind ===
|
|
126
|
+
if (prefix === "@") {
|
|
127
|
+
filteredResults = filteredResults.filter((result) => result.kind === "user" || result.kind === "assistant");
|
|
127
128
|
}
|
|
128
129
|
else {
|
|
129
|
-
filteredResults = filteredResults.filter((result) => result.kind !==
|
|
130
|
+
filteredResults = filteredResults.filter((result) => result.kind !== "user" && result.kind !== "assistant");
|
|
130
131
|
}
|
|
131
132
|
if (kind) {
|
|
132
133
|
filteredResults = allResults.filter((result) => result.kind.toLowerCase() === kind.toLowerCase());
|
|
@@ -134,13 +135,13 @@ function useMentionLookupService(mentionString, mentionConfigs = []) {
|
|
|
134
135
|
else if (!filteredResults.length) {
|
|
135
136
|
filteredResults = allResults;
|
|
136
137
|
}
|
|
137
|
-
filteredResults = (0, lodash_1.sortBy)(filteredResults, r => {
|
|
138
|
-
return r.name.toLowerCase().indexOf((mentionString).toLowerCase());
|
|
138
|
+
filteredResults = (0, lodash_1.sortBy)(filteredResults, (r) => {
|
|
139
|
+
return r.name.toLowerCase().indexOf((mentionString ?? "").toLowerCase());
|
|
139
140
|
});
|
|
140
141
|
filteredResults = filteredResults.slice(0, SUGGESTION_LIST_LENGTH_LIMIT);
|
|
141
142
|
setResults(filteredResults);
|
|
142
143
|
})();
|
|
143
|
-
}, [mentionString]);
|
|
144
|
+
}, [mentionString, mentionConfigs?.find, mentionConfigs?.map]);
|
|
144
145
|
return results;
|
|
145
146
|
}
|
|
146
147
|
function checkForAtSignMentions(text, minMatchLength) {
|
|
@@ -184,13 +185,11 @@ class MentionTypeaheadOption extends LexicalTypeaheadMenuPlugin_1.MenuOption {
|
|
|
184
185
|
}
|
|
185
186
|
}
|
|
186
187
|
function MentionsTypeaheadMenuItem({ index, isSelected, onClick, onMouseEnter, option, }) {
|
|
187
|
-
let className =
|
|
188
|
+
let className = "item";
|
|
188
189
|
if (isSelected) {
|
|
189
|
-
className +=
|
|
190
|
+
className += " selected";
|
|
190
191
|
}
|
|
191
|
-
return (
|
|
192
|
-
option.picture,
|
|
193
|
-
React.createElement("span", { className: "text" }, option.name)));
|
|
192
|
+
return ((0, jsx_runtime_1.jsxs)("li", { tabIndex: -1, className: className, ref: option.setRefElement, "aria-selected": isSelected, id: `typeahead-item-${index}`, onMouseEnter: onMouseEnter, onClick: onClick, "data-kind": option.data.kind, "data-id": option.id, "data-user-id": option.userId || undefined, children: [option.picture, (0, jsx_runtime_1.jsx)("span", { className: "text", children: option.name })] }, option.key));
|
|
194
193
|
}
|
|
195
194
|
function MentionsPlugin(props) {
|
|
196
195
|
const [editor] = (0, LexicalComposerContext_1.useLexicalComposerContext)();
|
|
@@ -203,27 +202,28 @@ function MentionsPlugin(props) {
|
|
|
203
202
|
props.mentionsOpen(finalMentionsOpen);
|
|
204
203
|
}
|
|
205
204
|
}
|
|
206
|
-
const checkForSlashTriggerMatch = (0, LexicalTypeaheadMenuPlugin_1.useBasicTypeaheadTriggerMatch)(
|
|
205
|
+
const checkForSlashTriggerMatch = (0, LexicalTypeaheadMenuPlugin_1.useBasicTypeaheadTriggerMatch)("/", {
|
|
207
206
|
minLength: 0,
|
|
208
207
|
});
|
|
209
208
|
const options = (0, react_1.useMemo)(() => results
|
|
210
209
|
.map((result) => {
|
|
211
|
-
|
|
212
|
-
|
|
210
|
+
const picKey = `mention-pic-${result.kind}-${result.id}`;
|
|
211
|
+
let picture = (0, jsx_runtime_1.jsx)("i", { className: "bi bi-question pe-1" }, picKey);
|
|
212
|
+
const config = props.mentionConfigs?.find((c) => c.kind === result.kind);
|
|
213
213
|
if (config) {
|
|
214
214
|
if (config.picture) {
|
|
215
215
|
picture = config.picture(result);
|
|
216
216
|
}
|
|
217
217
|
else {
|
|
218
|
-
picture =
|
|
218
|
+
picture = (0, jsx_runtime_1.jsx)("i", { className: `${config.iconClass} pe-1` }, picKey);
|
|
219
219
|
}
|
|
220
220
|
}
|
|
221
221
|
else {
|
|
222
|
-
picture =
|
|
222
|
+
picture = (0, jsx_runtime_1.jsx)("i", { className: "bi bi-question pe-1" }, picKey);
|
|
223
223
|
}
|
|
224
224
|
return new MentionTypeaheadOption(result, picture);
|
|
225
225
|
})
|
|
226
|
-
.slice(0, SUGGESTION_LIST_LENGTH_LIMIT), [results]);
|
|
226
|
+
.slice(0, SUGGESTION_LIST_LENGTH_LIMIT), [results, props.mentionConfigs?.find]);
|
|
227
227
|
const onSelectOption = (0, react_1.useCallback)((selectedOption, nodeToReplace, closeMenu) => {
|
|
228
228
|
editor.update(() => {
|
|
229
229
|
const mentionNode = (0, mention_node_1.$createMentionNode)(selectedOption.data);
|
|
@@ -233,7 +233,7 @@ function MentionsPlugin(props) {
|
|
|
233
233
|
mentionNode.selectNext(); // Move cursor to the position after the mention
|
|
234
234
|
const selection = (0, lexical_1.$getSelection)();
|
|
235
235
|
if (selection !== null) {
|
|
236
|
-
selection.insertText(
|
|
236
|
+
selection.insertText(" "); // Insert a space after the mention
|
|
237
237
|
}
|
|
238
238
|
closeMenu();
|
|
239
239
|
});
|
|
@@ -245,24 +245,23 @@ function MentionsPlugin(props) {
|
|
|
245
245
|
}
|
|
246
246
|
return getPossibleQueryMatch(text);
|
|
247
247
|
}, [checkForSlashTriggerMatch, editor]);
|
|
248
|
-
const
|
|
249
|
-
return (
|
|
248
|
+
const _popoverRef = React.useRef(null);
|
|
249
|
+
return ((0, jsx_runtime_1.jsx)(LexicalTypeaheadMenuPlugin_1.LexicalTypeaheadMenuPlugin, { onQueryChange: setQueryString, onSelectOption: onSelectOption, triggerFn: checkForMentionMatch, options: options, onOpen: () => _mentionsOpen(true), onClose: () => _mentionsOpen(false), menuRenderFn: (anchorElementRef, { selectedIndex, selectOptionAndCleanUp, setHighlightedIndex }) => {
|
|
250
250
|
if (!(anchorElementRef.current && results.length)) {
|
|
251
251
|
return null;
|
|
252
252
|
}
|
|
253
253
|
// distance from the top of the viewport to the top of the anchor element
|
|
254
254
|
const anchorTop = anchorElementRef.current.getBoundingClientRect().top;
|
|
255
255
|
const viewportHeight = window.innerHeight;
|
|
256
|
-
let className =
|
|
257
|
-
if (anchorTop >
|
|
258
|
-
className +=
|
|
256
|
+
let className = "typeahead-popover mentions-menu";
|
|
257
|
+
if (anchorTop > viewportHeight / 2) {
|
|
258
|
+
className += " mentions-menu-popup";
|
|
259
259
|
}
|
|
260
|
-
return ReactDOM.createPortal(
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
}, key: option.key, option: option }))))), anchorElementRef.current);
|
|
260
|
+
return ReactDOM.createPortal((0, jsx_runtime_1.jsx)("div", { className: className, children: (0, jsx_runtime_1.jsx)("ul", { children: options.map((option, i) => ((0, jsx_runtime_1.jsx)(MentionsTypeaheadMenuItem, { index: i, isSelected: selectedIndex === i, onClick: () => {
|
|
261
|
+
setHighlightedIndex(i);
|
|
262
|
+
selectOptionAndCleanUp(option);
|
|
263
|
+
}, onMouseEnter: () => {
|
|
264
|
+
setHighlightedIndex(i);
|
|
265
|
+
}, option: option }, option.key))) }) }), anchorElementRef.current);
|
|
267
266
|
} }));
|
|
268
267
|
}
|
|
@@ -8,41 +8,41 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
8
8
|
*
|
|
9
9
|
*/
|
|
10
10
|
exports.default = {
|
|
11
|
-
code:
|
|
11
|
+
code: "editor-code",
|
|
12
12
|
heading: {
|
|
13
|
-
h1:
|
|
14
|
-
h2:
|
|
15
|
-
h3:
|
|
16
|
-
h4:
|
|
17
|
-
h5:
|
|
13
|
+
h1: "editor-heading-h1",
|
|
14
|
+
h2: "editor-heading-h2",
|
|
15
|
+
h3: "editor-heading-h3",
|
|
16
|
+
h4: "editor-heading-h4",
|
|
17
|
+
h5: "editor-heading-h5",
|
|
18
18
|
},
|
|
19
|
-
image:
|
|
20
|
-
link:
|
|
19
|
+
image: "editor-image",
|
|
20
|
+
link: "editor-link",
|
|
21
21
|
list: {
|
|
22
|
-
listitem:
|
|
22
|
+
listitem: "editor-listitem",
|
|
23
23
|
nested: {
|
|
24
24
|
// listitem: 'editor-nested-listitem',
|
|
25
|
-
listitem:
|
|
25
|
+
listitem: "PlaygroundEditorTheme__nestedListItem",
|
|
26
26
|
},
|
|
27
|
-
ol:
|
|
28
|
-
ul:
|
|
29
|
-
checklist:
|
|
30
|
-
listitemChecked:
|
|
31
|
-
listitemUnchecked:
|
|
27
|
+
ol: "editor-list-ol",
|
|
28
|
+
ul: "editor-list-ul",
|
|
29
|
+
checklist: "PlaygroundEditorTheme__checklist",
|
|
30
|
+
listitemChecked: "PlaygroundEditorTheme__listItemChecked",
|
|
31
|
+
listitemUnchecked: "PlaygroundEditorTheme__listItemUnchecked",
|
|
32
32
|
},
|
|
33
|
-
ltr:
|
|
34
|
-
paragraph:
|
|
35
|
-
placeholder:
|
|
36
|
-
quote:
|
|
37
|
-
rtl:
|
|
33
|
+
ltr: "ltr",
|
|
34
|
+
paragraph: "editor-paragraph",
|
|
35
|
+
placeholder: "editor-placeholder",
|
|
36
|
+
quote: "editor-quote",
|
|
37
|
+
rtl: "rtl",
|
|
38
38
|
text: {
|
|
39
|
-
bold:
|
|
40
|
-
code:
|
|
41
|
-
hashtag:
|
|
42
|
-
italic:
|
|
43
|
-
overflowed:
|
|
44
|
-
strikethrough:
|
|
45
|
-
underline:
|
|
46
|
-
underlineStrikethrough:
|
|
39
|
+
bold: "editor-text-bold",
|
|
40
|
+
code: "editor-text-code",
|
|
41
|
+
hashtag: "editor-text-hashtag",
|
|
42
|
+
italic: "editor-text-italic",
|
|
43
|
+
overflowed: "editor-text-overflowed",
|
|
44
|
+
strikethrough: "editor-text-strikethrough",
|
|
45
|
+
underline: "editor-text-underline",
|
|
46
|
+
underlineStrikethrough: "editor-text-underlineStrikethrough",
|
|
47
47
|
},
|
|
48
48
|
};
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
export interface IToolbarControl {
|
|
3
2
|
iconClass: string;
|
|
4
|
-
onClick: () =>
|
|
3
|
+
onClick: () => void;
|
|
5
4
|
title?: string;
|
|
6
5
|
}
|
|
7
6
|
export interface IToolbarProps {
|
|
8
7
|
topRightControls?: IToolbarControl[];
|
|
9
8
|
}
|
|
10
|
-
export declare function ToolbarPlugin(props: IToolbarProps):
|
|
9
|
+
export declare function ToolbarPlugin(props: IToolbarProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,53 +1,51 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.ToolbarPlugin = ToolbarPlugin;
|
|
7
|
-
const
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const list_1 = require("@lexical/list");
|
|
8
6
|
const LexicalComposerContext_1 = require("@lexical/react/LexicalComposerContext");
|
|
9
7
|
const utils_1 = require("@lexical/utils");
|
|
10
8
|
const lexical_1 = require("lexical");
|
|
11
|
-
const
|
|
12
|
-
const react_2 = require("react");
|
|
9
|
+
const react_1 = require("react");
|
|
13
10
|
const LowPriority = 1;
|
|
14
11
|
function Divider() {
|
|
15
|
-
return
|
|
12
|
+
return (0, jsx_runtime_1.jsx)("span", { className: "tool-bar-divider" });
|
|
16
13
|
}
|
|
17
14
|
function ToolbarPlugin(props) {
|
|
18
15
|
const [editor] = (0, LexicalComposerContext_1.useLexicalComposerContext)();
|
|
19
|
-
const toolbarRef = (0,
|
|
20
|
-
const [
|
|
21
|
-
const [
|
|
22
|
-
const [isBold, setIsBold] = (0,
|
|
23
|
-
const [isItalic, setIsItalic] = (0,
|
|
24
|
-
const [
|
|
25
|
-
const [isStrikethrough, setIsStrikethrough] = (0,
|
|
16
|
+
const toolbarRef = (0, react_1.useRef)(null);
|
|
17
|
+
const [_canUndo, setCanUndo] = (0, react_1.useState)(false);
|
|
18
|
+
const [_canRedo, setCanRedo] = (0, react_1.useState)(false);
|
|
19
|
+
const [isBold, setIsBold] = (0, react_1.useState)(false);
|
|
20
|
+
const [isItalic, setIsItalic] = (0, react_1.useState)(false);
|
|
21
|
+
const [_isUnderline, setIsUnderline] = (0, react_1.useState)(false);
|
|
22
|
+
const [isStrikethrough, setIsStrikethrough] = (0, react_1.useState)(false);
|
|
26
23
|
// New state for list types
|
|
27
|
-
const [isUnorderedList, setIsUnorderedList] = (0,
|
|
28
|
-
const [isOrderedList, setIsOrderedList] = (0,
|
|
29
|
-
const [isCheckList, setIsCheckList] = (0,
|
|
30
|
-
const $updateToolbar = (0,
|
|
24
|
+
const [isUnorderedList, setIsUnorderedList] = (0, react_1.useState)(false);
|
|
25
|
+
const [isOrderedList, setIsOrderedList] = (0, react_1.useState)(false);
|
|
26
|
+
const [isCheckList, setIsCheckList] = (0, react_1.useState)(false);
|
|
27
|
+
const $updateToolbar = (0, react_1.useCallback)(() => {
|
|
31
28
|
const selection = (0, lexical_1.$getSelection)();
|
|
32
29
|
if ((0, lexical_1.$isRangeSelection)(selection)) {
|
|
33
30
|
// Update text format
|
|
34
|
-
setIsBold(selection.hasFormat(
|
|
35
|
-
setIsItalic(selection.hasFormat(
|
|
36
|
-
setIsUnderline(selection.hasFormat(
|
|
37
|
-
setIsStrikethrough(selection.hasFormat(
|
|
31
|
+
setIsBold(selection.hasFormat("bold"));
|
|
32
|
+
setIsItalic(selection.hasFormat("italic"));
|
|
33
|
+
setIsUnderline(selection.hasFormat("underline"));
|
|
34
|
+
setIsStrikethrough(selection.hasFormat("strikethrough"));
|
|
38
35
|
// Update list format
|
|
39
36
|
const anchorNode = selection.anchor.getNode();
|
|
40
|
-
const element = anchorNode.getKey() ===
|
|
37
|
+
const element = anchorNode.getKey() === "root" ? anchorNode : anchorNode.getTopLevelElementOrThrow();
|
|
41
38
|
const elementKey = element.getKey();
|
|
42
39
|
const elementDOM = editor.getElementByKey(elementKey);
|
|
43
40
|
if (elementDOM !== null) {
|
|
44
|
-
setIsUnorderedList(elementDOM.tagName ===
|
|
45
|
-
setIsOrderedList(elementDOM.tagName ===
|
|
46
|
-
setIsCheckList(elementDOM.tagName ===
|
|
41
|
+
setIsUnorderedList(elementDOM.tagName === "UL");
|
|
42
|
+
setIsOrderedList(elementDOM.tagName === "OL");
|
|
43
|
+
setIsCheckList(elementDOM.tagName === "UL" &&
|
|
44
|
+
elementDOM.classList.contains("PlaygroundEditorTheme__checklist"));
|
|
47
45
|
}
|
|
48
46
|
}
|
|
49
47
|
}, [editor]);
|
|
50
|
-
(0,
|
|
48
|
+
(0, react_1.useEffect)(() => {
|
|
51
49
|
return (0, utils_1.mergeRegister)(editor.registerUpdateListener(({ editorState }) => {
|
|
52
50
|
editorState.read(() => {
|
|
53
51
|
$updateToolbar();
|
|
@@ -87,26 +85,11 @@ function ToolbarPlugin(props) {
|
|
|
87
85
|
editor.dispatchCommand(list_1.INSERT_CHECK_LIST_COMMAND, undefined);
|
|
88
86
|
}
|
|
89
87
|
};
|
|
90
|
-
return (
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
}, className: 'toolbar-item spaced ' + (isItalic ? 'active' : ''), "aria-label": "Format Italics" },
|
|
98
|
-
react_1.default.createElement("i", { className: "bi bi-type-italic" })),
|
|
99
|
-
react_1.default.createElement("button", { tabIndex: -1, onClick: () => {
|
|
100
|
-
editor.dispatchCommand(lexical_1.FORMAT_TEXT_COMMAND, 'strikethrough');
|
|
101
|
-
}, className: 'toolbar-item spaced ' + (isStrikethrough ? 'active' : ''), "aria-label": "Format Strikethrough" },
|
|
102
|
-
react_1.default.createElement("i", { className: "bi bi-type-strikethrough" })),
|
|
103
|
-
react_1.default.createElement(Divider, null),
|
|
104
|
-
react_1.default.createElement("button", { tabIndex: -1, onClick: insertUnorderedList, className: 'toolbar-item spaced ' + (isUnorderedList ? 'active' : ''), "aria-label": "Insert Unordered List" },
|
|
105
|
-
react_1.default.createElement("i", { className: "bi bi-list-ul" })),
|
|
106
|
-
react_1.default.createElement("button", { tabIndex: -1, onClick: insertOrderedList, className: 'toolbar-item spaced ' + (isOrderedList ? 'active' : ''), "aria-label": "Insert Ordered List" },
|
|
107
|
-
react_1.default.createElement("i", { className: "bi bi-list-ol" })),
|
|
108
|
-
react_1.default.createElement("button", { tabIndex: -1, onClick: insertCheckList, className: 'toolbar-item spaced ' + (isCheckList ? 'active' : ''), "aria-label": "Insert Check List" },
|
|
109
|
-
react_1.default.createElement("i", { className: "bi bi-list-check" })),
|
|
110
|
-
(props.topRightControls?.length ?? 0) > 0 && (react_1.default.createElement("div", { className: 'float-end' }, props.topRightControls?.map((control, i) => (react_1.default.createElement("button", { key: i, tabIndex: -1, onClick: control.onClick, className: 'toolbar-item spaced active', "aria-label": "Insert Check List", title: control.title },
|
|
111
|
-
react_1.default.createElement("i", { className: control.iconClass }))))))));
|
|
88
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "toolbar", ref: toolbarRef, children: [(0, jsx_runtime_1.jsx)("button", { onClick: () => {
|
|
89
|
+
editor.dispatchCommand(lexical_1.FORMAT_TEXT_COMMAND, "bold");
|
|
90
|
+
}, tabIndex: -1, className: `toolbar-item spaced ${isBold ? "active" : ""}`, "aria-label": "Format Bold", children: (0, jsx_runtime_1.jsx)("i", { className: "bi bi-type-bold" }) }), (0, jsx_runtime_1.jsx)("button", { tabIndex: -1, onClick: () => {
|
|
91
|
+
editor.dispatchCommand(lexical_1.FORMAT_TEXT_COMMAND, "italic");
|
|
92
|
+
}, className: `toolbar-item spaced ${isItalic ? "active" : ""}`, "aria-label": "Format Italics", children: (0, jsx_runtime_1.jsx)("i", { className: "bi bi-type-italic" }) }), (0, jsx_runtime_1.jsx)("button", { tabIndex: -1, onClick: () => {
|
|
93
|
+
editor.dispatchCommand(lexical_1.FORMAT_TEXT_COMMAND, "strikethrough");
|
|
94
|
+
}, className: `toolbar-item spaced ${isStrikethrough ? "active" : ""}`, "aria-label": "Format Strikethrough", children: (0, jsx_runtime_1.jsx)("i", { className: "bi bi-type-strikethrough" }) }), (0, jsx_runtime_1.jsx)(Divider, {}), (0, jsx_runtime_1.jsx)("button", { tabIndex: -1, onClick: insertUnorderedList, className: `toolbar-item spaced ${isUnorderedList ? "active" : ""}`, "aria-label": "Insert Unordered List", children: (0, jsx_runtime_1.jsx)("i", { className: "bi bi-list-ul" }) }), (0, jsx_runtime_1.jsx)("button", { tabIndex: -1, onClick: insertOrderedList, className: `toolbar-item spaced ${isOrderedList ? "active" : ""}`, "aria-label": "Insert Ordered List", children: (0, jsx_runtime_1.jsx)("i", { className: "bi bi-list-ol" }) }), (0, jsx_runtime_1.jsx)("button", { tabIndex: -1, onClick: insertCheckList, className: `toolbar-item spaced ${isCheckList ? "active" : ""}`, "aria-label": "Insert Check List", children: (0, jsx_runtime_1.jsx)("i", { className: "bi bi-list-check" }) }), (props.topRightControls?.length ?? 0) > 0 && ((0, jsx_runtime_1.jsx)("div", { className: "float-end", children: props.topRightControls?.map((control) => ((0, jsx_runtime_1.jsx)("button", { tabIndex: -1, onClick: control.onClick, className: "toolbar-item spaced active", "aria-label": "Insert Check List", title: control.title, children: (0, jsx_runtime_1.jsx)("i", { className: control.iconClass }) }, control.title))) }))] }));
|
|
112
95
|
}
|
|
@@ -4,21 +4,22 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.MarkdownWithMentions = void 0;
|
|
7
|
-
const
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
8
|
// import { FileListDisplay } from './file-list-display';
|
|
9
9
|
const peers_sdk_1 = require("@peers-app/peers-sdk");
|
|
10
|
+
const react_1 = __importDefault(require("react"));
|
|
10
11
|
const react_markdown_1 = __importDefault(require("react-markdown"));
|
|
11
12
|
const remark_gfm_1 = __importDefault(require("remark-gfm"));
|
|
12
13
|
const mention_configs_1 = require("../mention-configs");
|
|
13
14
|
// Custom Link Renderer
|
|
14
15
|
const LinkRenderer = (props) => {
|
|
15
16
|
const { href } = props;
|
|
16
|
-
return (
|
|
17
|
-
if (href?.startsWith(
|
|
17
|
+
return ((0, jsx_runtime_1.jsx)("a", { href: href, onClick: (e) => {
|
|
18
|
+
if (href?.startsWith("http")) {
|
|
18
19
|
e.preventDefault();
|
|
19
20
|
peers_sdk_1.rpcServerCalls.openLinkInBrowser(href);
|
|
20
21
|
}
|
|
21
|
-
}
|
|
22
|
+
}, children: props.children }));
|
|
22
23
|
};
|
|
23
24
|
const processTextWithMentions = (text) => {
|
|
24
25
|
const parts = [];
|
|
@@ -26,35 +27,36 @@ const processTextWithMentions = (text) => {
|
|
|
26
27
|
let match;
|
|
27
28
|
let cnt = 0;
|
|
28
29
|
const regex = (0, peers_sdk_1.mentionRegex)();
|
|
29
|
-
|
|
30
|
+
match = regex.exec(text);
|
|
31
|
+
while (match !== null) {
|
|
30
32
|
cnt++;
|
|
31
33
|
if (match.index > lastIndex) {
|
|
32
34
|
parts.push(text.slice(lastIndex, match.index));
|
|
33
35
|
}
|
|
34
36
|
text = text.slice(match.index + match[0].length);
|
|
35
37
|
const kind = match[2];
|
|
36
|
-
const name = match[3].replace(/_/g,
|
|
38
|
+
const name = match[3].replace(/_/g, " ");
|
|
37
39
|
const id = match[4];
|
|
38
40
|
const data = {
|
|
39
41
|
kind,
|
|
40
42
|
name,
|
|
41
43
|
id,
|
|
42
44
|
};
|
|
43
|
-
const style = { cursor:
|
|
45
|
+
const style = { cursor: "pointer" };
|
|
44
46
|
if (name.length < 20) {
|
|
45
|
-
style.whiteSpace =
|
|
47
|
+
style.whiteSpace = "nowrap";
|
|
46
48
|
}
|
|
47
|
-
const mentionConfig = mention_configs_1.mentionConfigs.find(c => c.kind === kind);
|
|
48
|
-
const mentionClass = mentionConfig
|
|
49
|
+
const mentionConfig = mention_configs_1.mentionConfigs.find((c) => c.kind === kind);
|
|
50
|
+
const mentionClass = mentionConfig
|
|
51
|
+
? mentionConfig.styleClass || "mention-default-default"
|
|
52
|
+
: `mention-${kind}`;
|
|
49
53
|
const onClick = mentionConfig?.onClick;
|
|
50
|
-
const href = !onClick && `#${kind}s/${id}` || undefined;
|
|
51
|
-
const icon = (kind ===
|
|
52
|
-
mentionConfig?.iconClass &&
|
|
53
|
-
|
|
54
|
-
parts.push(react_1.default.createElement("a", { key: cnt, className: mentionClass, "data-kind": kind, "data-id": id, style: style, href: href, onClick: onClick && (() => onClick(data)) },
|
|
55
|
-
icon,
|
|
56
|
-
data.name));
|
|
54
|
+
const href = (!onClick && `#${kind}s/${id}`) || undefined;
|
|
55
|
+
const icon = (kind === "user" && "@") ||
|
|
56
|
+
(mentionConfig?.iconClass && (0, jsx_runtime_1.jsx)("i", { className: `pe-1 ${mentionConfig.iconClass}` })) || ((0, jsx_runtime_1.jsx)("i", { className: `pe-1 bi bi-question` }));
|
|
57
|
+
parts.push((0, jsx_runtime_1.jsxs)("a", { className: mentionClass, "data-kind": kind, "data-id": id, style: style, href: href, onClick: onClick && (() => onClick(data)), children: [icon, data.name] }, cnt));
|
|
57
58
|
lastIndex = regex.lastIndex;
|
|
59
|
+
match = regex.exec(text);
|
|
58
60
|
}
|
|
59
61
|
if (lastIndex < text.length) {
|
|
60
62
|
parts.push(text.slice(lastIndex));
|
|
@@ -103,38 +105,36 @@ const processTextWithMentions = (text) => {
|
|
|
103
105
|
// );
|
|
104
106
|
// };
|
|
105
107
|
const createElementWithMentions = (Element) => {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
})));
|
|
108
|
+
return ({ node: _node, ...props }) => {
|
|
109
|
+
return ((0, jsx_runtime_1.jsx)(Element, { ...props, children: react_1.default.Children.map(props.children, (child) => {
|
|
110
|
+
if (typeof child === "string") {
|
|
111
|
+
return processTextWithMentions(child);
|
|
112
|
+
}
|
|
113
|
+
return child;
|
|
114
|
+
}) }));
|
|
114
115
|
};
|
|
115
116
|
};
|
|
116
117
|
const MarkdownWithMentions = ({ content }) => {
|
|
117
118
|
const components = {
|
|
118
|
-
p: createElementWithMentions(
|
|
119
|
-
h1: createElementWithMentions(
|
|
120
|
-
h2: createElementWithMentions(
|
|
121
|
-
h3: createElementWithMentions(
|
|
122
|
-
h4: createElementWithMentions(
|
|
123
|
-
h5: createElementWithMentions(
|
|
124
|
-
h6: createElementWithMentions(
|
|
125
|
-
li: createElementWithMentions(
|
|
119
|
+
p: createElementWithMentions("p"),
|
|
120
|
+
h1: createElementWithMentions("h1"),
|
|
121
|
+
h2: createElementWithMentions("h2"),
|
|
122
|
+
h3: createElementWithMentions("h3"),
|
|
123
|
+
h4: createElementWithMentions("h4"),
|
|
124
|
+
h5: createElementWithMentions("h5"),
|
|
125
|
+
h6: createElementWithMentions("h6"),
|
|
126
|
+
li: createElementWithMentions("li"),
|
|
126
127
|
// a: createElementWithMentions('a'),
|
|
127
128
|
a: LinkRenderer,
|
|
128
|
-
strong: createElementWithMentions(
|
|
129
|
-
em: createElementWithMentions(
|
|
130
|
-
blockquote: createElementWithMentions(
|
|
131
|
-
code: createElementWithMentions(
|
|
132
|
-
td: createElementWithMentions(
|
|
133
|
-
th: createElementWithMentions(
|
|
129
|
+
strong: createElementWithMentions("strong"),
|
|
130
|
+
em: createElementWithMentions("em"),
|
|
131
|
+
blockquote: createElementWithMentions("blockquote"),
|
|
132
|
+
code: createElementWithMentions("code"),
|
|
133
|
+
td: createElementWithMentions("td"),
|
|
134
|
+
th: createElementWithMentions("th"),
|
|
134
135
|
};
|
|
135
|
-
return (
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
components: components }, content)));
|
|
136
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: "markdown", children: (0, jsx_runtime_1.jsx)(react_markdown_1.default, { remarkPlugins: [remark_gfm_1.default],
|
|
137
|
+
// @ts-expect-error
|
|
138
|
+
components: components, children: content }) }));
|
|
139
139
|
};
|
|
140
140
|
exports.MarkdownWithMentions = MarkdownWithMentions;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
interface MessageLogsProps {
|
|
3
2
|
messageId: string;
|
|
4
3
|
}
|
|
5
|
-
export declare const MessageLogs: ({ messageId }: MessageLogsProps) => false |
|
|
4
|
+
export declare const MessageLogs: ({ messageId }: MessageLogsProps) => false | import("react/jsx-runtime").JSX.Element;
|
|
6
5
|
export {};
|