@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
|
@@ -1,10 +1,7 @@
|
|
|
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.SaveButton = void 0;
|
|
7
|
-
const
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
5
|
const globals_1 = require("../globals");
|
|
9
6
|
const hooks_1 = require("../hooks");
|
|
10
7
|
const SaveButton = (props) => {
|
|
@@ -18,58 +15,51 @@ const SaveButton = (props) => {
|
|
|
18
15
|
if (!props.noBuiltInActions) {
|
|
19
16
|
if (q()) {
|
|
20
17
|
allActions.unshift({
|
|
21
|
-
label:
|
|
22
|
-
className:
|
|
18
|
+
label: "Discard Changes",
|
|
19
|
+
className: "text-bg-warning",
|
|
23
20
|
onClick: () => {
|
|
24
|
-
if (confirm(
|
|
25
|
-
doc.load()
|
|
26
|
-
.then(() => {
|
|
21
|
+
if (confirm("Are you sure you want to discard your changes?")) {
|
|
22
|
+
doc.load().then(() => {
|
|
27
23
|
setTimeout(() => doc.q(0), 100);
|
|
28
24
|
});
|
|
29
25
|
}
|
|
30
|
-
}
|
|
26
|
+
},
|
|
31
27
|
});
|
|
32
28
|
}
|
|
33
29
|
if (allActions.length) {
|
|
34
|
-
allActions.push(
|
|
30
|
+
allActions.push((0, jsx_runtime_1.jsx)("hr", { className: "dropdown-divider mt-3" }));
|
|
35
31
|
}
|
|
36
32
|
allActions.push({
|
|
37
|
-
label:
|
|
33
|
+
label: "Delete",
|
|
38
34
|
className: `text-bg-danger`,
|
|
39
35
|
onClick: async () => {
|
|
40
|
-
if (confirm(
|
|
36
|
+
if (confirm("Are you sure you want to delete this?")) {
|
|
41
37
|
await doc.delete();
|
|
42
|
-
const pathParts = (0, globals_1.mainContentPath)().split(
|
|
38
|
+
const pathParts = (0, globals_1.mainContentPath)().split("/");
|
|
43
39
|
pathParts.pop();
|
|
44
|
-
const path = pathParts.join(
|
|
40
|
+
const path = pathParts.join("/") ?? "";
|
|
45
41
|
(0, globals_1.mainContentPath)(path);
|
|
46
42
|
}
|
|
47
|
-
}
|
|
43
|
+
},
|
|
48
44
|
});
|
|
49
45
|
}
|
|
50
46
|
let className = `btn `;
|
|
51
47
|
if (q()) {
|
|
52
|
-
className +=
|
|
48
|
+
className += "btn-primary";
|
|
53
49
|
}
|
|
54
50
|
else {
|
|
55
|
-
className +=
|
|
51
|
+
className += "disabled";
|
|
56
52
|
}
|
|
57
53
|
if (!addActions?.length && props.noBuiltInActions) {
|
|
58
|
-
return (
|
|
54
|
+
return ((0, jsx_runtime_1.jsx)("button", { className: className, onClick: props.onClick ?? doc.save, disabled: !q(), children: (0, globals_1.isDesktop)() ? "Save Changes" : "Save" }));
|
|
59
55
|
}
|
|
60
|
-
return (
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
if (typeof action !== 'object' || action === null || !('label' in action)) {
|
|
69
|
-
return (react_1.default.createElement("li", { key: Math.random() }, action));
|
|
70
|
-
}
|
|
71
|
-
return (react_1.default.createElement("li", { key: action.label },
|
|
72
|
-
react_1.default.createElement("button", { className: `dropdown-item rounded mt-2 ${action.className || ''}`, onClick: action.onClick }, action.label)));
|
|
73
|
-
})))));
|
|
56
|
+
return ((0, jsx_runtime_1.jsx)("div", { style: { display: "inline-block" }, children: (0, jsx_runtime_1.jsxs)("div", { className: "input-group", children: [(0, jsx_runtime_1.jsx)("button", { className: className, onClick: props.onClick ?? doc.save, disabled: !q(), children: (0, globals_1.isDesktop)() ? "Save Changes" : "Save" }), (0, jsx_runtime_1.jsx)("button", { type: "button", "data-bs-toggle": "dropdown", "aria-expanded": "false",
|
|
57
|
+
// className={`btn dropdown-toggle dropdown-toggle-split ${q() ? 'btn-primary' : 'btn-secondary'}`}
|
|
58
|
+
className: `btn dropdown-toggle dropdown-toggle-split btn-secondary`, children: (0, jsx_runtime_1.jsx)("span", { className: "visually-hidden", children: "Toggle Dropdown" }) }), (0, jsx_runtime_1.jsx)("ul", { className: "dropdown-menu dropdown-menu-end", children: allActions.map((action) => {
|
|
59
|
+
if (typeof action !== "object" || action === null || !("label" in action)) {
|
|
60
|
+
return (0, jsx_runtime_1.jsx)("li", { children: action }, Math.random());
|
|
61
|
+
}
|
|
62
|
+
return ((0, jsx_runtime_1.jsx)("li", { children: (0, jsx_runtime_1.jsx)("button", { className: `dropdown-item rounded mt-2 ${action.className || ""}`, onClick: action.onClick, children: action.label }) }, action.label));
|
|
63
|
+
}) })] }) }));
|
|
74
64
|
};
|
|
75
65
|
exports.SaveButton = SaveButton;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { type Observable } from "@peers-app/peers-sdk";
|
|
2
|
+
import React from "react";
|
|
3
3
|
export interface ISortable {
|
|
4
4
|
sortOrder: number;
|
|
5
5
|
}
|
|
@@ -11,26 +11,25 @@ interface ISortableListProps<T extends ISortable> {
|
|
|
11
11
|
sortHandle: string;
|
|
12
12
|
}) => React.ReactNode;
|
|
13
13
|
listsGroup?: string;
|
|
14
|
-
onAdd?: (
|
|
15
|
-
onUpdate?: (
|
|
14
|
+
onAdd?: (itemId: string, sortOrder: number) => void;
|
|
15
|
+
onUpdate?: (args: {
|
|
16
16
|
items: T[];
|
|
17
17
|
ixMoved: number[];
|
|
18
|
-
}) =>
|
|
18
|
+
}) => void;
|
|
19
19
|
hidden?: boolean;
|
|
20
|
-
containerProps?: Record<string,
|
|
20
|
+
containerProps?: Record<string, unknown>;
|
|
21
21
|
dragHandleClassName?: string;
|
|
22
|
-
sortDirection?:
|
|
22
|
+
sortDirection?: "asc" | "desc";
|
|
23
23
|
minHeight?: string | number;
|
|
24
24
|
paddingBottom?: string | number;
|
|
25
25
|
}
|
|
26
|
-
export declare class SortableList<T extends ISortable> extends React.Component<ISortableListProps<T>,
|
|
27
|
-
constructor(props:
|
|
28
|
-
|
|
29
|
-
items: any[];
|
|
26
|
+
export declare class SortableList<T extends ISortable> extends React.Component<ISortableListProps<T>, Record<string, never>> {
|
|
27
|
+
constructor(props: ISortableListProps<T>);
|
|
28
|
+
items: T[];
|
|
30
29
|
listId: string;
|
|
31
30
|
sortHandle: string;
|
|
32
31
|
calculateSortOrder(index: number): number;
|
|
33
32
|
componentDidMount(): void;
|
|
34
|
-
render():
|
|
33
|
+
render(): import("react/jsx-runtime").JSX.Element;
|
|
35
34
|
}
|
|
36
35
|
export {};
|
|
@@ -4,16 +4,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.SortableList = void 0;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const peers_sdk_1 = require("@peers-app/peers-sdk");
|
|
9
|
+
const lodash_1 = require("lodash");
|
|
7
10
|
const react_1 = __importDefault(require("react"));
|
|
8
11
|
const sortablejs_1 = __importDefault(require("sortablejs"));
|
|
9
|
-
const lodash_1 = require("lodash");
|
|
10
|
-
const peers_sdk_1 = require("@peers-app/peers-sdk");
|
|
11
12
|
class SortableList extends react_1.default.Component {
|
|
12
13
|
constructor(props) {
|
|
13
14
|
super(props);
|
|
14
|
-
this.sortHandle =
|
|
15
|
+
this.sortHandle =
|
|
16
|
+
(this.props.dragHandleClassName && `.${this.props.dragHandleClassName}`) || this.sortHandle;
|
|
15
17
|
}
|
|
16
|
-
self;
|
|
17
18
|
items = [];
|
|
18
19
|
listId = `${Date.now()}_${Math.round(Math.random() * 100000)}`;
|
|
19
20
|
sortHandle = `.sort-handle-${this.listId}`;
|
|
@@ -21,39 +22,51 @@ class SortableList extends react_1.default.Component {
|
|
|
21
22
|
const items = this.items;
|
|
22
23
|
if (index === 0)
|
|
23
24
|
return Date.now();
|
|
24
|
-
if (index >= items.length)
|
|
25
|
-
|
|
25
|
+
if (index >= items.length) {
|
|
26
|
+
const tail = (0, lodash_1.last)(items);
|
|
27
|
+
return (tail?.sortOrder ?? Date.now()) - 10000;
|
|
28
|
+
}
|
|
26
29
|
const above = items[index - 1].sortOrder ?? Date.now();
|
|
27
30
|
const below = items[index].sortOrder ?? Number.MIN_VALUE;
|
|
28
31
|
if (above === below)
|
|
29
|
-
alert(
|
|
30
|
-
return above - (
|
|
32
|
+
alert("sort order has converged to the same number in this area. Try moving items to the top or bottom of the list to fix it");
|
|
33
|
+
return above - (above - below) / 2;
|
|
31
34
|
}
|
|
32
35
|
componentDidMount() {
|
|
33
|
-
const self = this;
|
|
34
36
|
const listDiv = document.getElementById(this.listId);
|
|
37
|
+
if (!listDiv) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
35
40
|
sortablejs_1.default.create(listDiv, {
|
|
36
41
|
handle: this.sortHandle,
|
|
37
42
|
group: { name: this.props.listsGroup || this.listId, put: !!this.props.onAdd },
|
|
38
43
|
animation: 100,
|
|
39
|
-
onUpdate: evt => {
|
|
40
|
-
const
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
+
onUpdate: (evt) => {
|
|
45
|
+
const oldIndex = evt.oldIndex;
|
|
46
|
+
const newIndex = evt.newIndex;
|
|
47
|
+
if (oldIndex === undefined || newIndex === undefined) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
const items = this.items;
|
|
51
|
+
const item = items.splice(oldIndex, 1)[0];
|
|
52
|
+
if (!item) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
item.sortOrder = this.calculateSortOrder(newIndex);
|
|
56
|
+
items.splice(newIndex, 0, item);
|
|
44
57
|
// console.log(items.map(i => i.toJS()));
|
|
45
58
|
if (this.props.onUpdate) {
|
|
46
|
-
this.props.onUpdate({ items, ixMoved: [
|
|
59
|
+
this.props.onUpdate({ items, ixMoved: [newIndex] });
|
|
47
60
|
}
|
|
48
61
|
},
|
|
49
|
-
onAdd: evt => {
|
|
62
|
+
onAdd: (evt) => {
|
|
50
63
|
const itemEl = evt.item; // dragged HTMLElement
|
|
51
64
|
if (evt.to !== evt.from) {
|
|
52
65
|
// first restore html hierarchy so html doesn't get out of sync with react
|
|
53
66
|
evt.to.removeChild(itemEl);
|
|
54
67
|
evt.from.appendChild(itemEl);
|
|
55
68
|
// now if we were given an `onAdd` function, call it
|
|
56
|
-
if (this.props.onAdd) {
|
|
69
|
+
if (this.props.onAdd && evt.newIndex !== undefined) {
|
|
57
70
|
const itemId = evt.item.id;
|
|
58
71
|
this.props.onAdd(itemId, this.calculateSortOrder(evt.newIndex));
|
|
59
72
|
}
|
|
@@ -63,15 +76,22 @@ class SortableList extends react_1.default.Component {
|
|
|
63
76
|
}
|
|
64
77
|
render() {
|
|
65
78
|
let items = (0, peers_sdk_1.unwrapObservable)(this.props.items);
|
|
66
|
-
if (this.props.sortDirection ===
|
|
67
|
-
items = (0, lodash_1.sortBy)(items, i => i.sortOrder ?? -Infinity);
|
|
79
|
+
if (this.props.sortDirection === "asc") {
|
|
80
|
+
items = (0, lodash_1.sortBy)(items, (i) => i.sortOrder ?? -Infinity);
|
|
68
81
|
}
|
|
69
82
|
else {
|
|
70
|
-
// @ts-
|
|
71
|
-
items = (0, lodash_1.sortBy)(items, i => -i.sortOrder ?? Infinity);
|
|
83
|
+
// @ts-expect-error
|
|
84
|
+
items = (0, lodash_1.sortBy)(items, (i) => -i.sortOrder ?? Infinity);
|
|
72
85
|
}
|
|
73
86
|
this.items = items;
|
|
74
|
-
return (
|
|
87
|
+
return ((0, jsx_runtime_1.jsx)("div", { id: this.listId, style: {
|
|
88
|
+
minHeight: this.props.minHeight ?? "25px",
|
|
89
|
+
paddingBottom: this.props.paddingBottom ?? "10px",
|
|
90
|
+
}, ...this.props.containerProps, children: items.map((item) => this.props.renderItem({
|
|
91
|
+
item,
|
|
92
|
+
listId: this.listId,
|
|
93
|
+
sortHandle: this.sortHandle.substring(1),
|
|
94
|
+
})) }));
|
|
75
95
|
}
|
|
76
96
|
}
|
|
77
97
|
exports.SortableList = SortableList;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import type React from "react";
|
|
2
2
|
interface ITabsProps {
|
|
3
3
|
tabs: {
|
|
4
4
|
name: string;
|
|
@@ -8,6 +8,6 @@ interface ITabsProps {
|
|
|
8
8
|
contentClassName?: string;
|
|
9
9
|
activeTabName?: string;
|
|
10
10
|
}
|
|
11
|
-
export declare const Tabs: (props: ITabsProps) =>
|
|
12
|
-
export declare const ScreenTabBody: (props: React.PropsWithChildren) =>
|
|
11
|
+
export declare const Tabs: (props: ITabsProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export declare const ScreenTabBody: (props: React.PropsWithChildren) => import("react/jsx-runtime").JSX.Element;
|
|
13
13
|
export {};
|
package/dist/components/tabs.js
CHANGED
|
@@ -1,70 +1,39 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
3
|
exports.ScreenTabBody = exports.Tabs = void 0;
|
|
37
|
-
const
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
38
6
|
const globals_1 = require("../globals");
|
|
39
|
-
let lastActive =
|
|
7
|
+
let lastActive = "";
|
|
40
8
|
const Tabs = (props) => {
|
|
41
9
|
const { tabs } = props;
|
|
42
10
|
const [activeTab, _setActiveTab] = (0, react_1.useState)(() => {
|
|
43
|
-
let activeTabName = tabs.find(tab => tab.active)?.name || (0, globals_1.queryParam)(
|
|
11
|
+
let activeTabName = tabs.find((tab) => tab.active)?.name || (0, globals_1.queryParam)("tab") || lastActive;
|
|
44
12
|
activeTabName = activeTabName.toLowerCase();
|
|
45
|
-
const _activeTab = tabs.find(tab => tab.name.toLowerCase() === activeTabName) || tabs[0];
|
|
13
|
+
const _activeTab = tabs.find((tab) => tab.name.toLowerCase() === activeTabName) || tabs[0];
|
|
46
14
|
lastActive = _activeTab.name;
|
|
47
15
|
return _activeTab;
|
|
48
16
|
});
|
|
49
17
|
// Allow parent to control the active tab imperatively
|
|
50
18
|
const resolvedActiveTab = props.activeTabName
|
|
51
|
-
? (tabs.find(tab => tab.name.toLowerCase() === props.activeTabName
|
|
19
|
+
? (tabs.find((tab) => tab.name.toLowerCase() === props.activeTabName?.toLowerCase()) ??
|
|
20
|
+
activeTab)
|
|
52
21
|
: activeTab;
|
|
53
22
|
function setActiveTab(tab) {
|
|
54
23
|
_setActiveTab(tab);
|
|
55
24
|
lastActive = tab.name;
|
|
56
25
|
}
|
|
57
|
-
return (
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
26
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("ul", { className: "nav nav-tabs", children: tabs.map((tab) => {
|
|
27
|
+
return ((0, jsx_runtime_1.jsx)("li", { className: "nav-item", children: (0, jsx_runtime_1.jsx)("a", { href: "#", className: `nav-link ${resolvedActiveTab.name === tab.name ? "active" : ""}`, onClick: (evt) => {
|
|
28
|
+
evt.preventDefault();
|
|
29
|
+
setActiveTab(tab);
|
|
30
|
+
}, children: tab.name }) }, tab.name));
|
|
31
|
+
}) }), (0, jsx_runtime_1.jsx)("div", { className: `tab-content ${props.contentClassName ?? "mt-3"}`, children: tabs.map((tab) => {
|
|
32
|
+
return ((0, jsx_runtime_1.jsx)("div", { hidden: resolvedActiveTab.name !== tab.name, children: tab.content }, tab.name));
|
|
33
|
+
}) })] }));
|
|
65
34
|
};
|
|
66
35
|
exports.Tabs = Tabs;
|
|
67
36
|
const ScreenTabBody = (props) => {
|
|
68
|
-
return (
|
|
37
|
+
return ((0, jsx_runtime_1.jsx)("div", { style: { maxHeight: "calc(100vh - 138px)", overflowY: "auto" }, children: props.children }));
|
|
69
38
|
};
|
|
70
39
|
exports.ScreenTabBody = ScreenTabBody;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { Observable } from "@peers-app/peers-sdk";
|
|
2
|
-
import React from
|
|
1
|
+
import type { Observable } from "@peers-app/peers-sdk";
|
|
2
|
+
import type React from "react";
|
|
3
3
|
interface IProps {
|
|
4
4
|
markdownContent?: string | Observable<string> | Observable<string | undefined>;
|
|
5
5
|
handle?: React.ReactNode;
|
|
6
6
|
handleClassName?: string;
|
|
7
|
-
positions?: (
|
|
7
|
+
positions?: ("right" | "bottom" | "left" | "top")[];
|
|
8
8
|
genericContent?: React.ReactNode;
|
|
9
9
|
}
|
|
10
|
-
export declare const Tooltip: (props: IProps) =>
|
|
10
|
+
export declare const Tooltip: (props: IProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
11
|
export {};
|
|
@@ -1,20 +1,15 @@
|
|
|
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.Tooltip = void 0;
|
|
7
|
-
const
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
5
|
const react_tiny_popover_1 = require("react-tiny-popover");
|
|
9
|
-
const markdown_with_mentions_1 = require("./markdown-with-mentions");
|
|
10
6
|
const hooks_1 = require("../hooks");
|
|
7
|
+
const markdown_with_mentions_1 = require("./markdown-with-mentions");
|
|
11
8
|
const Tooltip = (props) => {
|
|
12
9
|
const { handle } = props;
|
|
13
10
|
let [markdownContent] = (0, hooks_1.useObservable)(props.markdownContent);
|
|
14
|
-
markdownContent = markdownContent ??
|
|
11
|
+
markdownContent = markdownContent ?? "";
|
|
15
12
|
const showPopover = (0, hooks_1.useObservableState)(false);
|
|
16
|
-
return (
|
|
17
|
-
react_1.default.createElement(markdown_with_mentions_1.MarkdownWithMentions, { content: markdownContent }))) },
|
|
18
|
-
react_1.default.createElement("span", { className: props.handleClassName ?? 'p-2', onClick: () => showPopover(!showPopover()) }, handle ?? react_1.default.createElement("i", { className: "bi bi-info-circle", style: { cursor: 'pointer' } }))));
|
|
13
|
+
return ((0, jsx_runtime_1.jsx)(react_tiny_popover_1.Popover, { isOpen: showPopover(), onClickOutside: () => showPopover(false), positions: props.positions ?? ["right", "bottom", "left", "top"], content: () => ((0, jsx_runtime_1.jsx)("div", { className: "card p-2 bg-light-subtle", style: { maxWidth: 500, maxHeight: 400, overflowY: "auto", zIndex: 1000001 }, children: props.genericContent || (0, jsx_runtime_1.jsx)(markdown_with_mentions_1.MarkdownWithMentions, { content: markdownContent }) })), children: (0, jsx_runtime_1.jsx)("span", { className: props.handleClassName ?? "p-2", onClick: () => showPopover(!showPopover()), children: handle ?? (0, jsx_runtime_1.jsx)("i", { className: "bi bi-info-circle", style: { cursor: "pointer" } }) }) }));
|
|
19
14
|
};
|
|
20
15
|
exports.Tooltip = Tooltip;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { TrustLevel } from
|
|
2
|
-
import React from 'react';
|
|
1
|
+
import { TrustLevel } from "@peers-app/peers-sdk";
|
|
3
2
|
interface TrustLevelBadgeProps {
|
|
4
3
|
level: TrustLevel;
|
|
5
4
|
}
|
|
6
|
-
export declare const TrustLevelBadge: ({ level }: TrustLevelBadgeProps) =>
|
|
5
|
+
export declare const TrustLevelBadge: ({ level }: TrustLevelBadgeProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
6
|
export {};
|
|
@@ -1,27 +1,29 @@
|
|
|
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.TrustLevelBadge = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
5
|
const peers_sdk_1 = require("@peers-app/peers-sdk");
|
|
8
|
-
const react_1 = __importDefault(require("react"));
|
|
9
6
|
const TrustLevelBadge = ({ level }) => {
|
|
10
7
|
// Define trust level configurations with their numeric values
|
|
11
8
|
const trustLevelConfigs = [
|
|
12
|
-
{ value: peers_sdk_1.TrustLevel.Self, color:
|
|
13
|
-
{ value: peers_sdk_1.TrustLevel.Trusted, color:
|
|
14
|
-
{ value: peers_sdk_1.TrustLevel.Known, color:
|
|
15
|
-
{ value: peers_sdk_1.TrustLevel.NewDevice, color:
|
|
16
|
-
{ value: peers_sdk_1.TrustLevel.NewUser, color:
|
|
17
|
-
{ value: peers_sdk_1.TrustLevel.Unknown, color:
|
|
18
|
-
{
|
|
19
|
-
|
|
9
|
+
{ value: peers_sdk_1.TrustLevel.Self, color: "success", icon: "bi-shield-fill-check", text: "Self" },
|
|
10
|
+
{ value: peers_sdk_1.TrustLevel.Trusted, color: "success", icon: "bi-shield-check", text: "Trusted" },
|
|
11
|
+
{ value: peers_sdk_1.TrustLevel.Known, color: "primary", icon: "bi-shield-check", text: "Known" },
|
|
12
|
+
{ value: peers_sdk_1.TrustLevel.NewDevice, color: "info", icon: "bi-shield-plus", text: "New Device" },
|
|
13
|
+
{ value: peers_sdk_1.TrustLevel.NewUser, color: "info", icon: "bi-shield-plus", text: "New User" },
|
|
14
|
+
{ value: peers_sdk_1.TrustLevel.Unknown, color: "warning", icon: "bi-shield-exclamation", text: "Unknown" },
|
|
15
|
+
{
|
|
16
|
+
value: peers_sdk_1.TrustLevel.Untrusted,
|
|
17
|
+
color: "danger",
|
|
18
|
+
icon: "bi-shield-exclamation",
|
|
19
|
+
text: "Untrusted",
|
|
20
|
+
},
|
|
21
|
+
{ value: peers_sdk_1.TrustLevel.Malicious, color: "danger", icon: "bi-shield-x", text: "Malicious" },
|
|
20
22
|
];
|
|
21
23
|
// Sort by trust level value (ascending, so lowest first)
|
|
22
24
|
const sortedConfigs = trustLevelConfigs.sort((a, b) => a.value - b.value);
|
|
23
25
|
// Find the highest trust level that is at or below the current level
|
|
24
|
-
let config = { color:
|
|
26
|
+
let config = { color: "secondary", icon: "bi-shield", text: "Unknown" };
|
|
25
27
|
for (const trustConfig of sortedConfigs) {
|
|
26
28
|
if (level >= trustConfig.value) {
|
|
27
29
|
config = trustConfig;
|
|
@@ -30,8 +32,6 @@ const TrustLevelBadge = ({ level }) => {
|
|
|
30
32
|
break;
|
|
31
33
|
}
|
|
32
34
|
}
|
|
33
|
-
return (
|
|
34
|
-
react_1.default.createElement("i", { className: config.icon }),
|
|
35
|
-
config.text));
|
|
35
|
+
return ((0, jsx_runtime_1.jsxs)("span", { className: `badge bg-${config.color} d-flex align-items-center gap-1`, children: [(0, jsx_runtime_1.jsx)("i", { className: config.icon }), config.text] }));
|
|
36
36
|
};
|
|
37
37
|
exports.TrustLevelBadge = TrustLevelBadge;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { DataContext, TrustLevel } from
|
|
2
|
-
import React from 'react';
|
|
1
|
+
import { type DataContext, TrustLevel } from "@peers-app/peers-sdk";
|
|
3
2
|
interface TrustLevelDropdownProps {
|
|
4
3
|
userId: string;
|
|
5
4
|
dataContext?: DataContext;
|
|
6
5
|
onChange?: (newLevel: TrustLevel) => void;
|
|
7
|
-
type?:
|
|
6
|
+
type?: "user" | "device";
|
|
8
7
|
}
|
|
9
|
-
export declare const TrustLevelDropdown: ({ userId, dataContext, onChange, type }: TrustLevelDropdownProps) =>
|
|
8
|
+
export declare const TrustLevelDropdown: ({ userId, dataContext, onChange, type, }: TrustLevelDropdownProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
9
|
export {};
|
|
@@ -1,57 +1,42 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
3
|
exports.TrustLevelDropdown = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
37
5
|
const peers_sdk_1 = require("@peers-app/peers-sdk");
|
|
38
|
-
const react_1 =
|
|
6
|
+
const react_1 = require("react");
|
|
39
7
|
const loading_indicator_1 = require("./loading-indicator");
|
|
40
|
-
const TrustLevelDropdown = ({ userId, dataContext, onChange, type =
|
|
8
|
+
const TrustLevelDropdown = ({ userId, dataContext, onChange, type = "user", }) => {
|
|
41
9
|
const [trustLevel, setTrustLevelState] = (0, react_1.useState)(peers_sdk_1.TrustLevel.Unknown);
|
|
42
10
|
const [loading, setLoading] = (0, react_1.useState)(true);
|
|
43
11
|
const allTrustLevelConfigs = [
|
|
44
|
-
{ value: peers_sdk_1.TrustLevel.Self, color:
|
|
45
|
-
{ value: peers_sdk_1.TrustLevel.Trusted, color:
|
|
46
|
-
{ value: peers_sdk_1.TrustLevel.Known, color:
|
|
47
|
-
{
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
12
|
+
{ value: peers_sdk_1.TrustLevel.Self, color: "success", icon: "bi-shield-fill-check", text: "Self" },
|
|
13
|
+
{ value: peers_sdk_1.TrustLevel.Trusted, color: "success", icon: "bi-shield-check", text: "Trusted" },
|
|
14
|
+
{ value: peers_sdk_1.TrustLevel.Known, color: "primary", icon: "bi-shield-check", text: "Known" },
|
|
15
|
+
{
|
|
16
|
+
value: peers_sdk_1.TrustLevel.NewDevice,
|
|
17
|
+
color: "info",
|
|
18
|
+
icon: "bi-shield-plus",
|
|
19
|
+
text: "New Device",
|
|
20
|
+
showFor: "device",
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
value: peers_sdk_1.TrustLevel.NewUser,
|
|
24
|
+
color: "info",
|
|
25
|
+
icon: "bi-shield-plus",
|
|
26
|
+
text: "New User",
|
|
27
|
+
showFor: "user",
|
|
28
|
+
},
|
|
29
|
+
{ value: peers_sdk_1.TrustLevel.Unknown, color: "warning", icon: "bi-shield-exclamation", text: "Unknown" },
|
|
30
|
+
{
|
|
31
|
+
value: peers_sdk_1.TrustLevel.Untrusted,
|
|
32
|
+
color: "danger",
|
|
33
|
+
icon: "bi-shield-exclamation",
|
|
34
|
+
text: "Untrusted",
|
|
35
|
+
},
|
|
36
|
+
{ value: peers_sdk_1.TrustLevel.Malicious, color: "danger", icon: "bi-shield-x", text: "Malicious" },
|
|
52
37
|
];
|
|
53
38
|
// Filter configs based on type
|
|
54
|
-
const trustLevelConfigs = allTrustLevelConfigs.filter(config => !config.showFor || config.showFor === type);
|
|
39
|
+
const trustLevelConfigs = allTrustLevelConfigs.filter((config) => !config.showFor || config.showFor === type);
|
|
55
40
|
(0, react_1.useEffect)(() => {
|
|
56
41
|
async function loadTrustLevel() {
|
|
57
42
|
const userContext = await (0, peers_sdk_1.getUserContext)();
|
|
@@ -73,7 +58,7 @@ const TrustLevelDropdown = ({ userId, dataContext, onChange, type = 'user' }) =>
|
|
|
73
58
|
}
|
|
74
59
|
// Find current config
|
|
75
60
|
const sortedConfigs = trustLevelConfigs.sort((a, b) => a.value - b.value);
|
|
76
|
-
let currentConfig = { color:
|
|
61
|
+
let currentConfig = { color: "secondary", icon: "bi-shield", text: "Unknown" };
|
|
77
62
|
for (const config of sortedConfigs) {
|
|
78
63
|
if (trustLevel >= config.value) {
|
|
79
64
|
currentConfig = config;
|
|
@@ -83,16 +68,8 @@ const TrustLevelDropdown = ({ userId, dataContext, onChange, type = 'user' }) =>
|
|
|
83
68
|
}
|
|
84
69
|
}
|
|
85
70
|
if (loading) {
|
|
86
|
-
return
|
|
71
|
+
return (0, jsx_runtime_1.jsx)(loading_indicator_1.LoadingIndicator, {});
|
|
87
72
|
}
|
|
88
|
-
return (
|
|
89
|
-
react_1.default.createElement("button", { className: `btn btn-sm btn-${currentConfig.color} dropdown-toggle d-flex align-items-center gap-1`, type: "button", "data-bs-toggle": "dropdown", "data-bs-auto-close": "true", "data-bs-popper-config": '{"strategy":"fixed"}', "aria-expanded": "false" },
|
|
90
|
-
react_1.default.createElement("i", { className: currentConfig.icon }),
|
|
91
|
-
currentConfig.text),
|
|
92
|
-
react_1.default.createElement("ul", { className: "dropdown-menu" }, trustLevelConfigs.map((config) => (react_1.default.createElement("li", { key: config.value },
|
|
93
|
-
react_1.default.createElement("button", { className: "dropdown-item p-2", onClick: () => handleTrustLevelChange(config.value) },
|
|
94
|
-
react_1.default.createElement("span", { className: `badge bg-${config.color} d-flex align-items-center gap-2 w-100 py-2 px-3 fs-6 ${trustLevel === config.value ? 'border border-dark border-2' : ''}` },
|
|
95
|
-
react_1.default.createElement("i", { className: config.icon }),
|
|
96
|
-
config.text))))))));
|
|
73
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "dropdown", children: [(0, jsx_runtime_1.jsxs)("button", { className: `btn btn-sm btn-${currentConfig.color} dropdown-toggle d-flex align-items-center gap-1`, type: "button", "data-bs-toggle": "dropdown", "data-bs-auto-close": "true", "data-bs-popper-config": '{"strategy":"fixed"}', "aria-expanded": "false", children: [(0, jsx_runtime_1.jsx)("i", { className: currentConfig.icon }), currentConfig.text] }), (0, jsx_runtime_1.jsx)("ul", { className: "dropdown-menu", children: trustLevelConfigs.map((config) => ((0, jsx_runtime_1.jsx)("li", { children: (0, jsx_runtime_1.jsx)("button", { className: "dropdown-item p-2", onClick: () => handleTrustLevelChange(config.value), children: (0, jsx_runtime_1.jsxs)("span", { className: `badge bg-${config.color} d-flex align-items-center gap-2 w-100 py-2 px-3 fs-6 ${trustLevel === config.value ? "border border-dark border-2" : ""}`, children: [(0, jsx_runtime_1.jsx)("i", { className: config.icon }), config.text] }) }) }, config.value))) })] }));
|
|
97
74
|
};
|
|
98
75
|
exports.TrustLevelDropdown = TrustLevelDropdown;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import React from
|
|
1
|
+
import type React from "react";
|
|
2
2
|
export interface TypeaheadItem {
|
|
3
3
|
id: string;
|
|
4
|
-
[key: string]:
|
|
4
|
+
[key: string]: unknown;
|
|
5
5
|
}
|
|
6
6
|
interface TypeaheadProps<T extends TypeaheadItem> {
|
|
7
7
|
placeholder?: string;
|
|
@@ -18,5 +18,5 @@ interface TypeaheadProps<T extends TypeaheadItem> {
|
|
|
18
18
|
debounceMs?: number;
|
|
19
19
|
maxResults?: number;
|
|
20
20
|
}
|
|
21
|
-
export declare function Typeahead<T extends TypeaheadItem>(props: TypeaheadProps<T>):
|
|
21
|
+
export declare function Typeahead<T extends TypeaheadItem>(props: TypeaheadProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
22
22
|
export {};
|