@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
|
@@ -34,34 +34,38 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.ListScreen = ListScreen;
|
|
37
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
37
38
|
const peers_sdk_1 = require("@peers-app/peers-sdk");
|
|
38
39
|
const _ = __importStar(require("lodash"));
|
|
39
|
-
const react_1 =
|
|
40
|
+
const react_1 = require("react");
|
|
40
41
|
const globals_1 = require("../globals");
|
|
41
42
|
const hooks_1 = require("../hooks");
|
|
42
43
|
const input_1 = require("./input");
|
|
43
44
|
const lazy_list_1 = require("./lazy-list");
|
|
44
45
|
const loading_indicator_1 = require("./loading-indicator");
|
|
45
46
|
function ListScreen(props) {
|
|
46
|
-
const { table, newRecord, sortBy
|
|
47
|
-
const [searchTextObs] = (0, react_1.useState)(() => (0, peers_sdk_1.observable)(
|
|
47
|
+
const { table, newRecord, sortBy } = props;
|
|
48
|
+
const [searchTextObs] = (0, react_1.useState)(() => (0, peers_sdk_1.observable)(""));
|
|
48
49
|
const [searchText] = (0, hooks_1.useObservable)(searchTextObs);
|
|
49
50
|
const [cursorObs] = (0, react_1.useState)(() => (0, peers_sdk_1.observable)());
|
|
50
|
-
|
|
51
|
+
const newCursor = (0, react_1.useCallback)(async () => {
|
|
51
52
|
const filter = props.getFilter ? props.getFilter(searchText) : null;
|
|
52
|
-
const cursor = await table.cursor(filter || {}, {
|
|
53
|
+
const cursor = await table.cursor(filter || {}, {
|
|
54
|
+
sortBy,
|
|
55
|
+
...(filter ? {} : { textSearch: searchText }),
|
|
56
|
+
});
|
|
53
57
|
cursorObs(cursor);
|
|
54
58
|
return cursor;
|
|
55
|
-
}
|
|
59
|
+
}, [table, searchText, props.getFilter, sortBy, cursorObs]);
|
|
56
60
|
(0, react_1.useEffect)(() => {
|
|
57
|
-
newCursor();
|
|
58
|
-
}, [
|
|
61
|
+
void newCursor();
|
|
62
|
+
}, [newCursor]);
|
|
59
63
|
const idFieldName = table.metaData.primaryKeyName;
|
|
60
64
|
async function loadMore(existing) {
|
|
61
65
|
let moreMatches = [];
|
|
62
|
-
|
|
66
|
+
const cursor = cursorObs() || (await newCursor());
|
|
63
67
|
for await (const nextRecord of cursor) {
|
|
64
|
-
if (existing.find(e => e[idFieldName] === nextRecord[idFieldName]))
|
|
68
|
+
if (existing.find((e) => e[idFieldName] === nextRecord[idFieldName]))
|
|
65
69
|
continue;
|
|
66
70
|
moreMatches.push(nextRecord);
|
|
67
71
|
if (searchText.length && moreMatches.length > 5)
|
|
@@ -73,9 +77,16 @@ function ListScreen(props) {
|
|
|
73
77
|
cursorObs(undefined);
|
|
74
78
|
}
|
|
75
79
|
// if we're using default textSearch, list items with the most words matched in the name first
|
|
76
|
-
if (!props.getFilter &&
|
|
77
|
-
|
|
78
|
-
|
|
80
|
+
if (!props.getFilter &&
|
|
81
|
+
moreMatches &&
|
|
82
|
+
searchText &&
|
|
83
|
+
table.metaData.fields.find((f) => f.name === "name")) {
|
|
84
|
+
const words = searchText.toLowerCase().split(" ");
|
|
85
|
+
moreMatches = _.sortBy(moreMatches, (r) => {
|
|
86
|
+
const nameVal = r.name;
|
|
87
|
+
const nameStr = typeof nameVal === "string" ? nameVal : String(nameVal ?? "");
|
|
88
|
+
return words.filter((w) => nameStr.toLowerCase().includes(w)).length;
|
|
89
|
+
}).reverse();
|
|
79
90
|
}
|
|
80
91
|
return moreMatches;
|
|
81
92
|
}
|
|
@@ -85,16 +96,10 @@ function ListScreen(props) {
|
|
|
85
96
|
const name = searchText.trim();
|
|
86
97
|
if (!name)
|
|
87
98
|
return;
|
|
88
|
-
searchTextObs(
|
|
99
|
+
searchTextObs("");
|
|
89
100
|
await newRecord(name);
|
|
90
101
|
}
|
|
91
|
-
return (
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
react_1.default.createElement("div", { className: "peers-list-container" },
|
|
95
|
-
react_1.default.createElement(lazy_list_1.LazyList, { resetTrigger: searchText, loadMore: loadMore, scrollThreshold: 0.6, renderItems: (notes) => {
|
|
96
|
-
return notes.map(props.renderItem);
|
|
97
|
-
}, loadingIndicator: react_1.default.createElement("div", { className: "d-flex justify-content-center", style: { height: 200 } },
|
|
98
|
-
react_1.default.createElement(loading_indicator_1.LoadingIndicator, null)), endOfList: react_1.default.createElement("div", { className: "d-flex justify-content-center", style: { height: 200 } }) }))));
|
|
102
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "container-fluid", children: [(0, jsx_runtime_1.jsx)("div", { className: "input-group mt-3 mb-3", children: (0, jsx_runtime_1.jsx)(input_1.Input, { value: searchTextObs, className: "form-control", placeholder: `Search or create ${props.placeholderName || table.metaData.name}`, autoFocus: !!(0, globals_1.isDesktop)(), onKeyUp: (evt) => searchSubmit(evt) }) }), (0, jsx_runtime_1.jsx)("div", { className: "peers-list-container", children: (0, jsx_runtime_1.jsx)(lazy_list_1.LazyList, { resetTrigger: searchText, loadMore: loadMore, scrollThreshold: 0.6, renderItems: (notes) => {
|
|
103
|
+
return notes.map(props.renderItem);
|
|
104
|
+
}, loadingIndicator: (0, jsx_runtime_1.jsx)("div", { className: "d-flex justify-content-center", style: { height: 200 }, children: (0, jsx_runtime_1.jsx)(loading_indicator_1.LoadingIndicator, {}) }), endOfList: (0, jsx_runtime_1.jsx)("div", { className: "d-flex justify-content-center", style: { height: 200 } }) }) })] }));
|
|
99
105
|
}
|
|
100
|
-
;
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const LoadingIndicator: () => React.JSX.Element;
|
|
1
|
+
export declare const LoadingIndicator: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,12 +1,8 @@
|
|
|
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.LoadingIndicator = void 0;
|
|
7
|
-
const
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
5
|
const LoadingIndicator = () => {
|
|
9
|
-
return (
|
|
10
|
-
react_1.default.createElement("span", { className: "visually-hidden" }, "Loading...")));
|
|
6
|
+
return ((0, jsx_runtime_1.jsx)("span", { className: "spinner-grow spinner-grow-sm text-secondary m-4", role: "status", children: (0, jsx_runtime_1.jsx)("span", { className: "visually-hidden", children: "Loading..." }) }));
|
|
11
7
|
};
|
|
12
8
|
exports.LoadingIndicator = LoadingIndicator;
|
|
@@ -1,29 +1,26 @@
|
|
|
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.LexicalAutoLinkPlugin = LexicalAutoLinkPlugin;
|
|
7
4
|
exports.default = LinkPlugin;
|
|
8
|
-
const
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
9
6
|
const LexicalAutoLinkPlugin_1 = require("@lexical/react/LexicalAutoLinkPlugin");
|
|
10
7
|
const URL_REGEX = /((https?:\/\/(www\.)?)|(www\.))[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)(?<![-.+():%])/;
|
|
11
8
|
const EMAIL_REGEX = /(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))/;
|
|
12
9
|
const MATCHERS = [
|
|
13
10
|
(0, LexicalAutoLinkPlugin_1.createLinkMatcherWithRegExp)(URL_REGEX, (text) => {
|
|
14
|
-
return text.startsWith(
|
|
11
|
+
return text.startsWith("http") ? text : `https://${text}`;
|
|
15
12
|
}),
|
|
16
13
|
(0, LexicalAutoLinkPlugin_1.createLinkMatcherWithRegExp)(EMAIL_REGEX, (text) => {
|
|
17
14
|
return `mailto:${text}`;
|
|
18
15
|
}),
|
|
19
16
|
];
|
|
20
17
|
function LexicalAutoLinkPlugin() {
|
|
21
|
-
return
|
|
18
|
+
return (0, jsx_runtime_1.jsx)(LexicalAutoLinkPlugin_1.AutoLinkPlugin, { matchers: MATCHERS });
|
|
22
19
|
}
|
|
23
20
|
const LexicalLinkPlugin_1 = require("@lexical/react/LexicalLinkPlugin");
|
|
24
21
|
function LinkPlugin() {
|
|
25
22
|
const validateUrl = (url) => {
|
|
26
|
-
return url.startsWith(
|
|
23
|
+
return url.startsWith("http://") || url.startsWith("https://") || url.startsWith("mailto:");
|
|
27
24
|
};
|
|
28
|
-
return
|
|
25
|
+
return (0, jsx_runtime_1.jsx)(LexicalLinkPlugin_1.LinkPlugin, { validateUrl: validateUrl });
|
|
29
26
|
}
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
export declare const MarkdownEditorInline: (props: IMarkdownEditorProps) => React.JSX.Element;
|
|
1
|
+
import { type IMarkdownEditorProps } from "./editor";
|
|
2
|
+
export declare const MarkdownEditorInline: (props: IMarkdownEditorProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,13 +1,9 @@
|
|
|
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.MarkdownEditorInline = void 0;
|
|
7
|
-
const
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
5
|
const editor_1 = require("./editor");
|
|
9
6
|
const MarkdownEditorInline = (props) => {
|
|
10
|
-
return (
|
|
11
|
-
react_1.default.createElement(editor_1.MarkdownEditor, { ...props })));
|
|
7
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: "border rounded border-dark-subtle", children: (0, jsx_runtime_1.jsx)(editor_1.MarkdownEditor, { ...props }) }));
|
|
12
8
|
};
|
|
13
9
|
exports.MarkdownEditorInline = MarkdownEditorInline;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Observable } from "@peers-app/peers-sdk";
|
|
2
|
-
import React from
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { type Observable } from "@peers-app/peers-sdk";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { type IMentionConfig } from "../../mention-configs";
|
|
4
|
+
import { type IToolbarControl } from "./toolbar";
|
|
5
5
|
export interface IEditorEffects {
|
|
6
|
-
onKeyDown?: (e: React.KeyboardEvent) =>
|
|
6
|
+
onKeyDown?: (e: React.KeyboardEvent) => boolean | undefined;
|
|
7
7
|
focus?: () => void;
|
|
8
8
|
}
|
|
9
9
|
export interface IMarkdownEditorProps {
|
|
@@ -15,4 +15,4 @@ export interface IMarkdownEditorProps {
|
|
|
15
15
|
maxHeight?: string | number;
|
|
16
16
|
mentionConfigs?: IMentionConfig[];
|
|
17
17
|
}
|
|
18
|
-
export declare function MarkdownEditor(props: IMarkdownEditorProps):
|
|
18
|
+
export declare function MarkdownEditor(props: IMarkdownEditorProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -37,12 +37,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.MarkdownEditor = MarkdownEditor;
|
|
40
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
40
41
|
const code_1 = require("@lexical/code");
|
|
41
42
|
const link_1 = require("@lexical/link");
|
|
42
43
|
const list_1 = require("@lexical/list");
|
|
43
44
|
const LexicalAutoFocusPlugin_1 = require("@lexical/react/LexicalAutoFocusPlugin");
|
|
44
45
|
const LexicalCheckListPlugin_1 = require("@lexical/react/LexicalCheckListPlugin");
|
|
45
46
|
const LexicalComposer_1 = require("@lexical/react/LexicalComposer");
|
|
47
|
+
const LexicalComposerContext_1 = require("@lexical/react/LexicalComposerContext");
|
|
46
48
|
const LexicalContentEditable_1 = require("@lexical/react/LexicalContentEditable");
|
|
47
49
|
const LexicalErrorBoundary_1 = require("@lexical/react/LexicalErrorBoundary");
|
|
48
50
|
const LexicalHistoryPlugin_1 = require("@lexical/react/LexicalHistoryPlugin");
|
|
@@ -52,18 +54,17 @@ const LexicalRichTextPlugin_1 = require("@lexical/react/LexicalRichTextPlugin");
|
|
|
52
54
|
const LexicalTabIndentationPlugin_1 = require("@lexical/react/LexicalTabIndentationPlugin");
|
|
53
55
|
const rich_text_1 = require("@lexical/rich-text");
|
|
54
56
|
const peers_sdk_1 = require("@peers-app/peers-sdk");
|
|
57
|
+
const lexical_1 = require("lexical");
|
|
55
58
|
const react_1 = __importStar(require("react"));
|
|
59
|
+
const mention_configs_1 = require("../../mention-configs");
|
|
56
60
|
const autolink_plugin_1 = require("./autolink-plugin");
|
|
57
61
|
const markdown_plugin_1 = require("./markdown-plugin");
|
|
58
62
|
const mention_node_1 = require("./mention-node");
|
|
59
63
|
const mentions_plugin_1 = require("./mentions-plugin");
|
|
60
64
|
const theme_1 = __importDefault(require("./theme"));
|
|
61
65
|
const toolbar_1 = require("./toolbar");
|
|
62
|
-
const lexical_1 = require("lexical");
|
|
63
|
-
const LexicalComposerContext_1 = require("@lexical/react/LexicalComposerContext");
|
|
64
|
-
const mention_configs_1 = require("../../mention-configs");
|
|
65
66
|
const editorConfig = {
|
|
66
|
-
namespace:
|
|
67
|
+
namespace: "PeersEditor",
|
|
67
68
|
nodes: [
|
|
68
69
|
rich_text_1.HeadingNode,
|
|
69
70
|
rich_text_1.QuoteNode,
|
|
@@ -71,6 +72,7 @@ const editorConfig = {
|
|
|
71
72
|
list_1.ListNode,
|
|
72
73
|
list_1.ListItemNode,
|
|
73
74
|
mention_node_1.MentionNode,
|
|
75
|
+
// biome-ignore lint/suspicious/noExplicitAny: Lexical node registry typing is narrower than runtime; AutoLinkNode is required for links.
|
|
74
76
|
link_1.AutoLinkNode,
|
|
75
77
|
link_1.LinkNode,
|
|
76
78
|
],
|
|
@@ -108,24 +110,12 @@ function MarkdownEditor(props) {
|
|
|
108
110
|
};
|
|
109
111
|
}
|
|
110
112
|
const _mentionConfigs = props.mentionConfigs ?? mention_configs_1.mentionConfigs;
|
|
111
|
-
return (
|
|
112
|
-
react_1.default.createElement("div", { className: "editor-container" },
|
|
113
|
-
props.hideToolbar ? null : react_1.default.createElement(toolbar_1.ToolbarPlugin, { topRightControls: props.topRightControls }),
|
|
114
|
-
react_1.default.createElement("div", { className: "editor-inner", ref: editorRef, style: { maxHeight: props.maxHeight, overflowY: 'auto' } },
|
|
115
|
-
react_1.default.createElement(LexicalRichTextPlugin_1.RichTextPlugin, { contentEditable: react_1.default.createElement(LexicalContentEditable_1.ContentEditable, { className: "editor-input p-2" }), placeholder: null, ErrorBoundary: LexicalErrorBoundary_1.LexicalErrorBoundary }),
|
|
116
|
-
react_1.default.createElement(LexicalHistoryPlugin_1.HistoryPlugin, null),
|
|
117
|
-
props.autoFocus && react_1.default.createElement(LexicalAutoFocusPlugin_1.AutoFocusPlugin, { defaultSelection: 'rootEnd' }),
|
|
118
|
-
react_1.default.createElement(LexicalListPlugin_1.ListPlugin, null),
|
|
119
|
-
_mentionConfigs.length > 0 && (react_1.default.createElement(mentions_plugin_1.MentionsPlugin, { mentionConfigs: _mentionConfigs, mentionsOpen: mentionsOpen })),
|
|
120
|
-
react_1.default.createElement(autolink_plugin_1.LexicalAutoLinkPlugin, null),
|
|
121
|
-
react_1.default.createElement(markdown_plugin_1.MarkdownPlugin, { markdownObs: props.value }),
|
|
122
|
-
react_1.default.createElement(LexicalMarkdownShortcutPlugin_1.MarkdownShortcutPlugin, { transformers: markdown_plugin_1.customMarkdownTransformers }),
|
|
123
|
-
react_1.default.createElement(LexicalCheckListPlugin_1.CheckListPlugin, null),
|
|
124
|
-
react_1.default.createElement(LexicalTabIndentationPlugin_1.TabIndentationPlugin, null),
|
|
125
|
-
react_1.default.createElement(OnKeyDownPlugin, { effects: props.effects, mentionsOpen: mentionsOpen })))));
|
|
113
|
+
return ((0, jsx_runtime_1.jsx)(LexicalComposer_1.LexicalComposer, { initialConfig: { ...editorConfig }, children: (0, jsx_runtime_1.jsxs)("div", { className: "editor-container", children: [props.hideToolbar ? null : (0, jsx_runtime_1.jsx)(toolbar_1.ToolbarPlugin, { topRightControls: props.topRightControls }), (0, jsx_runtime_1.jsxs)("div", { className: "editor-inner", ref: editorRef, style: { maxHeight: props.maxHeight, overflowY: "auto" }, children: [(0, jsx_runtime_1.jsx)(LexicalRichTextPlugin_1.RichTextPlugin, { contentEditable: (0, jsx_runtime_1.jsx)(LexicalContentEditable_1.ContentEditable, { className: "editor-input p-2" }), placeholder: null, ErrorBoundary: LexicalErrorBoundary_1.LexicalErrorBoundary }), (0, jsx_runtime_1.jsx)(LexicalHistoryPlugin_1.HistoryPlugin, {}), props.autoFocus && (0, jsx_runtime_1.jsx)(LexicalAutoFocusPlugin_1.AutoFocusPlugin, { defaultSelection: "rootEnd" }), (0, jsx_runtime_1.jsx)(LexicalListPlugin_1.ListPlugin, {}), _mentionConfigs.length > 0 && ((0, jsx_runtime_1.jsx)(mentions_plugin_1.MentionsPlugin, { mentionConfigs: _mentionConfigs, mentionsOpen: mentionsOpen })), (0, jsx_runtime_1.jsx)(autolink_plugin_1.LexicalAutoLinkPlugin, {}), (0, jsx_runtime_1.jsx)(markdown_plugin_1.MarkdownPlugin, { markdownObs: props.value }), (0, jsx_runtime_1.jsx)(LexicalMarkdownShortcutPlugin_1.MarkdownShortcutPlugin, { transformers: markdown_plugin_1.customMarkdownTransformers }), (0, jsx_runtime_1.jsx)(LexicalCheckListPlugin_1.CheckListPlugin, {}), (0, jsx_runtime_1.jsx)(LexicalTabIndentationPlugin_1.TabIndentationPlugin, {}), (0, jsx_runtime_1.jsx)(OnKeyDownPlugin, { effects: props.effects, mentionsOpen: mentionsOpen })] })] }) }));
|
|
126
114
|
}
|
|
127
115
|
const OnKeyDownPlugin = (props) => {
|
|
128
116
|
const [editor] = (0, LexicalComposerContext_1.useLexicalComposerContext)();
|
|
117
|
+
// Intentionally `[editor]` only: `props.effects` is a stable object ref whose `onKeyDown` is
|
|
118
|
+
// imperatively reassigned by callers each render; the closure reads the latest value at event time.
|
|
129
119
|
(0, react_1.useEffect)(() => {
|
|
130
120
|
const removeListener = editor.registerCommand(lexical_1.KEY_DOWN_COMMAND, (event) => {
|
|
131
121
|
if (props.mentionsOpen()) {
|
|
@@ -26,7 +26,7 @@ const listReplace = (listType) => {
|
|
|
26
26
|
return (parentNode, children, match) => {
|
|
27
27
|
const previousNode = parentNode.getPreviousSibling();
|
|
28
28
|
const nextNode = parentNode.getNextSibling();
|
|
29
|
-
const listItem = (0, list_1.$createListItemNode)(listType ===
|
|
29
|
+
const listItem = (0, list_1.$createListItemNode)(listType === "check" ? match[3] === "x" : undefined);
|
|
30
30
|
if ((0, list_1.$isListNode)(nextNode) && nextNode.getListType() === listType) {
|
|
31
31
|
const firstChild = nextNode.getFirstChild();
|
|
32
32
|
if (firstChild !== null) {
|
|
@@ -38,13 +38,12 @@ const listReplace = (listType) => {
|
|
|
38
38
|
}
|
|
39
39
|
parentNode.remove();
|
|
40
40
|
}
|
|
41
|
-
else if ((0, list_1.$isListNode)(previousNode) &&
|
|
42
|
-
previousNode.getListType() === listType) {
|
|
41
|
+
else if ((0, list_1.$isListNode)(previousNode) && previousNode.getListType() === listType) {
|
|
43
42
|
previousNode.append(listItem);
|
|
44
43
|
parentNode.remove();
|
|
45
44
|
}
|
|
46
45
|
else {
|
|
47
|
-
const list = (0, list_1.$createListNode)(listType, listType ===
|
|
46
|
+
const list = (0, list_1.$createListNode)(listType, listType === "number" ? Number(match[2]) : undefined);
|
|
48
47
|
list.append(listItem);
|
|
49
48
|
parentNode.replace(list);
|
|
50
49
|
}
|
|
@@ -69,18 +68,18 @@ const listExport = (listNode, exportChildren, depth) => {
|
|
|
69
68
|
continue;
|
|
70
69
|
}
|
|
71
70
|
}
|
|
72
|
-
const indent =
|
|
71
|
+
const indent = " ".repeat(depth * LIST_INDENT_SIZE);
|
|
73
72
|
const listType = listNode.getListType();
|
|
74
|
-
const prefix = listType ===
|
|
73
|
+
const prefix = listType === "number"
|
|
75
74
|
? `${listNode.getStart() + index}. `
|
|
76
|
-
: listType ===
|
|
77
|
-
? `- [${listItemNode.getChecked() ?
|
|
78
|
-
:
|
|
75
|
+
: listType === "check"
|
|
76
|
+
? `- [${listItemNode.getChecked() ? "x" : " "}] `
|
|
77
|
+
: "- ";
|
|
79
78
|
output.push(indent + prefix + exportChildren(listItemNode));
|
|
80
79
|
index++;
|
|
81
80
|
}
|
|
82
81
|
}
|
|
83
|
-
return output.join(
|
|
82
|
+
return output.join("\n");
|
|
84
83
|
};
|
|
85
84
|
const CHECK_LIST_TRANSFORMER = {
|
|
86
85
|
dependencies: [list_1.ListNode, list_1.ListItemNode],
|
|
@@ -88,12 +87,12 @@ const CHECK_LIST_TRANSFORMER = {
|
|
|
88
87
|
return (0, list_1.$isListNode)(node) ? listExport(node, exportChildren, 0) : null;
|
|
89
88
|
},
|
|
90
89
|
regExp: /^(\s*)(?:-\s)?\s?(\[(\s|x)?\])\s/i,
|
|
91
|
-
replace: listReplace(
|
|
92
|
-
type:
|
|
90
|
+
replace: listReplace("check"),
|
|
91
|
+
type: "element",
|
|
93
92
|
};
|
|
94
93
|
const MENTION_TRANSFORMER = {
|
|
95
|
-
type:
|
|
96
|
-
trigger:
|
|
94
|
+
type: "text-match",
|
|
95
|
+
trigger: "<",
|
|
97
96
|
dependencies: [mention_node_1.MentionNode],
|
|
98
97
|
importRegExp: (0, peers_sdk_1.mentionRegex)(),
|
|
99
98
|
regExp: (0, peers_sdk_1.mentionRegex)(),
|
|
@@ -105,10 +104,10 @@ const MENTION_TRANSFORMER = {
|
|
|
105
104
|
},
|
|
106
105
|
replace: (textNode, match) => {
|
|
107
106
|
const kind = match[2];
|
|
108
|
-
const name = match[3].replace(/_/g,
|
|
107
|
+
const name = match[3].replace(/_/g, " ");
|
|
109
108
|
const id = match[4];
|
|
110
109
|
const data = {
|
|
111
|
-
kind
|
|
110
|
+
kind,
|
|
112
111
|
name,
|
|
113
112
|
id,
|
|
114
113
|
clickable: false,
|
|
@@ -120,10 +119,10 @@ const MENTION_TRANSFORMER = {
|
|
|
120
119
|
exports.customMarkdownTransformers = [
|
|
121
120
|
MENTION_TRANSFORMER,
|
|
122
121
|
CHECK_LIST_TRANSFORMER, // This needs to be first or checklists will be treated as unordered lists
|
|
123
|
-
...markdown_1.TRANSFORMERS.filter(transformer => {
|
|
122
|
+
...markdown_1.TRANSFORMERS.filter((transformer) => {
|
|
124
123
|
const t = transformer;
|
|
125
124
|
// disable headings for this markdown since these are inline messages
|
|
126
|
-
if (t.dependencies?.[0]?.name ===
|
|
125
|
+
if (t.dependencies?.[0]?.name === "HeadingNode") {
|
|
127
126
|
return false;
|
|
128
127
|
}
|
|
129
128
|
return true;
|
|
@@ -133,9 +132,9 @@ function MarkdownPlugin(props) {
|
|
|
133
132
|
const [editor] = (0, LexicalComposerContext_1.useLexicalComposerContext)();
|
|
134
133
|
const { markdownObs } = props;
|
|
135
134
|
(0, react_1.useEffect)(() => {
|
|
136
|
-
let markdown =
|
|
135
|
+
let markdown = "";
|
|
137
136
|
function setMarkdown() {
|
|
138
|
-
const newMarkdown = markdownObs() ||
|
|
137
|
+
const newMarkdown = markdownObs() || "";
|
|
139
138
|
if (newMarkdown === markdown) {
|
|
140
139
|
return;
|
|
141
140
|
}
|
|
@@ -161,6 +160,6 @@ function MarkdownPlugin(props) {
|
|
|
161
160
|
sub.dispose();
|
|
162
161
|
sub2Dispose();
|
|
163
162
|
};
|
|
164
|
-
}, [editor]);
|
|
163
|
+
}, [editor, markdownObs]);
|
|
165
164
|
return null;
|
|
166
165
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import type { IMentionData } from "@peers-app/peers-sdk";
|
|
2
|
+
import { type DOMConversionMap, type DOMExportOutput, type EditorConfig, type LexicalNode, type NodeKey, type SerializedTextNode, type Spread, TextNode } from "lexical";
|
|
3
3
|
export type SerializedMentionNode = Spread<{
|
|
4
4
|
data: IMentionData;
|
|
5
5
|
}, SerializedTextNode>;
|
|
@@ -8,15 +8,15 @@ const globals_1 = require("../../globals");
|
|
|
8
8
|
const mention_configs_1 = require("../../mention-configs");
|
|
9
9
|
function $convertMentionElement(domNode) {
|
|
10
10
|
const mentionName = domNode.textContent?.substring(1);
|
|
11
|
-
const dataKind = domNode.getAttribute(
|
|
12
|
-
const dataId = domNode.getAttribute(
|
|
13
|
-
const clickable = domNode.getAttribute(
|
|
11
|
+
const dataKind = domNode.getAttribute("data-kind") ?? "";
|
|
12
|
+
const dataId = domNode.getAttribute("data-id") ?? "";
|
|
13
|
+
const clickable = domNode.getAttribute("data-clickable");
|
|
14
14
|
if (mentionName && dataId) {
|
|
15
15
|
const data = {
|
|
16
16
|
kind: dataKind,
|
|
17
17
|
name: mentionName,
|
|
18
18
|
id: dataId,
|
|
19
|
-
clickable: clickable ===
|
|
19
|
+
clickable: clickable === "true" ? true : clickable === "false" ? false : undefined,
|
|
20
20
|
};
|
|
21
21
|
const node = $createMentionNode(data);
|
|
22
22
|
return {
|
|
@@ -28,7 +28,7 @@ function $convertMentionElement(domNode) {
|
|
|
28
28
|
class MentionNode extends lexical_1.TextNode {
|
|
29
29
|
data;
|
|
30
30
|
static getType() {
|
|
31
|
-
return
|
|
31
|
+
return "mention";
|
|
32
32
|
}
|
|
33
33
|
static clone(node) {
|
|
34
34
|
return new MentionNode(node.data, node.__key);
|
|
@@ -45,14 +45,14 @@ class MentionNode extends lexical_1.TextNode {
|
|
|
45
45
|
}
|
|
46
46
|
constructor(data, key) {
|
|
47
47
|
// const prefix = (data.kind === 'assistant' || data.kind === 'user') ? '@' : '$';
|
|
48
|
-
const prefix = data.kind ===
|
|
48
|
+
const prefix = data.kind === "user" ? "@" : "";
|
|
49
49
|
super(prefix + data.name, key);
|
|
50
50
|
this.data = data;
|
|
51
51
|
}
|
|
52
52
|
exportJSON() {
|
|
53
53
|
return {
|
|
54
54
|
...super.exportJSON(),
|
|
55
|
-
type:
|
|
55
|
+
type: "mention",
|
|
56
56
|
version: 1,
|
|
57
57
|
data: this.data,
|
|
58
58
|
};
|
|
@@ -60,22 +60,22 @@ class MentionNode extends lexical_1.TextNode {
|
|
|
60
60
|
createDOM(config) {
|
|
61
61
|
const dom = super.createDOM(config);
|
|
62
62
|
const kind = this.data.kind;
|
|
63
|
-
const mentionConfig = mention_configs_1.mentionConfigs.find(c => c.kind === kind);
|
|
63
|
+
const mentionConfig = mention_configs_1.mentionConfigs.find((c) => c.kind === kind);
|
|
64
64
|
if (mentionConfig) {
|
|
65
|
-
dom.className = mentionConfig.styleClass ||
|
|
65
|
+
dom.className = mentionConfig.styleClass || "mention-default-default";
|
|
66
66
|
}
|
|
67
67
|
else {
|
|
68
68
|
dom.className = `mention-${this.data.kind}`;
|
|
69
69
|
}
|
|
70
70
|
dom.textContent = this.__text;
|
|
71
|
-
dom.setAttribute(
|
|
72
|
-
dom.setAttribute(
|
|
73
|
-
dom.setAttribute(
|
|
71
|
+
dom.setAttribute("data-kind", this.data.kind);
|
|
72
|
+
dom.setAttribute("data-id", this.data.id);
|
|
73
|
+
dom.setAttribute("data-clickable", this.data.clickable === undefined ? "" : String(this.data.clickable));
|
|
74
74
|
// currently ignoring `clickable` attribute
|
|
75
75
|
// if (this.data.clickable !== false) {...
|
|
76
76
|
const onClick = mentionConfig?.onClick;
|
|
77
|
-
dom.style.cursor =
|
|
78
|
-
dom.addEventListener(
|
|
77
|
+
dom.style.cursor = "pointer";
|
|
78
|
+
dom.addEventListener("click", () => {
|
|
79
79
|
if (onClick) {
|
|
80
80
|
onClick(this.data);
|
|
81
81
|
}
|
|
@@ -85,9 +85,9 @@ class MentionNode extends lexical_1.TextNode {
|
|
|
85
85
|
(0, globals_1.mainContentPath)(href);
|
|
86
86
|
}
|
|
87
87
|
});
|
|
88
|
-
if (mentionConfig && kind !==
|
|
89
|
-
const iconSpan = document.createElement(
|
|
90
|
-
iconSpan.className =
|
|
88
|
+
if (mentionConfig && kind !== "user") {
|
|
89
|
+
const iconSpan = document.createElement("i");
|
|
90
|
+
iconSpan.className = `pe-1 ${mentionConfig.iconClass}`;
|
|
91
91
|
dom.prepend(iconSpan);
|
|
92
92
|
return dom;
|
|
93
93
|
}
|
|
@@ -118,18 +118,18 @@ class MentionNode extends lexical_1.TextNode {
|
|
|
118
118
|
return dom;
|
|
119
119
|
}
|
|
120
120
|
exportDOM() {
|
|
121
|
-
const element = document.createElement(
|
|
122
|
-
element.setAttribute(
|
|
121
|
+
const element = document.createElement("span");
|
|
122
|
+
element.setAttribute("data-lexical-mention", "true");
|
|
123
123
|
element.textContent = this.__text;
|
|
124
|
-
element.setAttribute(
|
|
125
|
-
element.setAttribute(
|
|
126
|
-
element.setAttribute(
|
|
124
|
+
element.setAttribute("data-kind", this.data.kind);
|
|
125
|
+
element.setAttribute("data-id", this.data.id);
|
|
126
|
+
element.setAttribute("data-clickable", this.data.clickable === undefined ? "" : String(this.data.clickable));
|
|
127
127
|
return { element };
|
|
128
128
|
}
|
|
129
129
|
static importDOM() {
|
|
130
130
|
return {
|
|
131
131
|
span: (domNode) => {
|
|
132
|
-
if (!domNode.hasAttribute(
|
|
132
|
+
if (!domNode.hasAttribute("data-lexical-mention")) {
|
|
133
133
|
return null;
|
|
134
134
|
}
|
|
135
135
|
return {
|
|
@@ -152,7 +152,7 @@ class MentionNode extends lexical_1.TextNode {
|
|
|
152
152
|
exports.MentionNode = MentionNode;
|
|
153
153
|
function $createMentionNode(data) {
|
|
154
154
|
const mentionNode = new MentionNode(data);
|
|
155
|
-
mentionNode.setMode(
|
|
155
|
+
mentionNode.setMode("segmented").toggleDirectionless();
|
|
156
156
|
return (0, lexical_1.$applyNodeReplacement)(mentionNode);
|
|
157
157
|
}
|
|
158
158
|
function $isMentionNode(node) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Observable } from "@peers-app/peers-sdk";
|
|
2
|
-
import { IMentionConfig } from
|
|
1
|
+
import { type Observable } from "@peers-app/peers-sdk";
|
|
2
|
+
import type { IMentionConfig } from "../../mention-configs";
|
|
3
3
|
export declare const MENTIONS_MAX_RESULTS = 10;
|
|
4
4
|
export declare function MentionsPlugin(props: {
|
|
5
5
|
mentionConfigs?: IMentionConfig[];
|