@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
package/src/utils.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import DOMPurify from
|
|
2
|
-
import _ from
|
|
3
|
-
|
|
1
|
+
import DOMPurify from "dompurify";
|
|
2
|
+
import _ from "lodash";
|
|
4
3
|
|
|
5
4
|
export function htmlToText(html: string): string {
|
|
6
|
-
|
|
5
|
+
const doc = new DOMParser().parseFromString(html, "text/html");
|
|
7
6
|
return doc.body.textContent || "";
|
|
8
7
|
}
|
|
9
8
|
|
|
@@ -11,75 +10,81 @@ export function htmlToText(html: string): string {
|
|
|
11
10
|
export function stripMentions(text: string): string {
|
|
12
11
|
// Replace <type:name:id> with just the readable name part
|
|
13
12
|
// Convert underscores to spaces for better readability
|
|
14
|
-
return text.replace(/<[@$]([^:]+):([^:]+):([^>]+)>/g, (
|
|
15
|
-
return name.replace(/_/g,
|
|
13
|
+
return text.replace(/<[@$]([^:]+):([^:]+):([^>]+)>/g, (_match, _type, name, _id) => {
|
|
14
|
+
return name.replace(/_/g, " ");
|
|
16
15
|
});
|
|
17
16
|
}
|
|
18
17
|
|
|
19
|
-
|
|
20
18
|
export function trimAndSanitizeHtml(value: string) {
|
|
21
19
|
let sanitizedValue: string = DOMPurify.sanitize(value);
|
|
22
20
|
// removes empty paragraphs
|
|
23
21
|
// return sanitizedValue.replace(/\<p\>\<br\>\<\/p\>/ig, '').trim()
|
|
24
22
|
|
|
25
|
-
const singleBlankLine =
|
|
23
|
+
const singleBlankLine = "<p><br></p>";
|
|
26
24
|
const doubleBlankLine = singleBlankLine + singleBlankLine;
|
|
27
25
|
|
|
28
26
|
// collapse lots of blank lines into one
|
|
29
27
|
while (sanitizedValue.includes(doubleBlankLine)) {
|
|
30
|
-
// @ts-ignore
|
|
31
28
|
sanitizedValue = sanitizedValue.replaceAll(doubleBlankLine, singleBlankLine);
|
|
32
29
|
}
|
|
33
30
|
|
|
34
|
-
// remove trailing blank line
|
|
31
|
+
// remove trailing blank line
|
|
35
32
|
if (sanitizedValue.endsWith(singleBlankLine)) {
|
|
36
33
|
sanitizedValue = sanitizedValue.substr(0, sanitizedValue.length - singleBlankLine.length);
|
|
37
34
|
}
|
|
38
35
|
return sanitizedValue;
|
|
39
36
|
}
|
|
40
37
|
|
|
41
|
-
|
|
42
|
-
export function isObject(x: any): x is Record<string,any> {
|
|
38
|
+
export function isObject(x: any): x is Record<string, any> {
|
|
43
39
|
return _.isObject(x) && !_.isArray(x) && !_.isDate(x) && x !== null;
|
|
44
40
|
}
|
|
45
41
|
|
|
46
42
|
export function js(jsCode: string, externalReferences?: any) {
|
|
47
43
|
const hideGlobals = [
|
|
48
|
-
|
|
44
|
+
"process",
|
|
45
|
+
"global", //,'setTimeout','setInterval','setImmediate','clearImmediate','clearInterval','clearTimeout'
|
|
49
46
|
];
|
|
50
47
|
const common = module.exports;
|
|
51
|
-
const refNames = [
|
|
48
|
+
const refNames = ["console", "common"];
|
|
52
49
|
const refValues = [console, common];
|
|
53
|
-
_.keys(externalReferences).forEach(key => {
|
|
50
|
+
_.keys(externalReferences).forEach((key) => {
|
|
54
51
|
refNames.push(key);
|
|
55
52
|
refValues.push(externalReferences[key]);
|
|
56
|
-
})
|
|
57
|
-
const compiledJs = Function.apply(null, [
|
|
53
|
+
});
|
|
54
|
+
const compiledJs = Function.apply(null, [
|
|
55
|
+
...refNames,
|
|
56
|
+
...hideGlobals,
|
|
57
|
+
`"use strict"; ${jsCode.trim()}`,
|
|
58
|
+
]);
|
|
58
59
|
return compiledJs.apply(null, refValues);
|
|
59
60
|
}
|
|
60
61
|
|
|
61
62
|
// must be done this way so TypeScript doesn't rewrite async keyword
|
|
62
63
|
// export const AsyncFunction = eval('Object.getPrototypeOf(async function () { }).constructor');
|
|
63
|
-
export const AsyncFunction = Object.getPrototypeOf(async
|
|
64
|
+
export const AsyncFunction = Object.getPrototypeOf(async () => {}).constructor;
|
|
64
65
|
|
|
65
66
|
export function jsAsync(jsCode: string, externalReferences: any = {}) {
|
|
66
|
-
jsCode = String(jsCode).trim()
|
|
67
|
+
jsCode = String(jsCode).trim();
|
|
67
68
|
const hideGlobals = [
|
|
68
|
-
|
|
69
|
+
"process",
|
|
70
|
+
"global", //,'setTimeout','setInterval','setImmediate','clearImmediate','clearInterval','clearTimeout'
|
|
69
71
|
];
|
|
70
72
|
const utils = module.exports;
|
|
71
|
-
const refNames = [
|
|
73
|
+
const refNames = ["utils", "utils_1", "Promise", "console"];
|
|
72
74
|
const refValues = [utils, utils, Promise, console];
|
|
73
|
-
_.keys(externalReferences).forEach(key => {
|
|
75
|
+
_.keys(externalReferences).forEach((key) => {
|
|
74
76
|
refNames.push(key);
|
|
75
77
|
refValues.push(externalReferences[key]);
|
|
76
|
-
})
|
|
77
|
-
const compiledJs = AsyncFunction.apply(null, [
|
|
78
|
+
});
|
|
79
|
+
const compiledJs = AsyncFunction.apply(null, [
|
|
80
|
+
...refNames,
|
|
81
|
+
...hideGlobals,
|
|
82
|
+
`"use strict";\n${jsCode}`,
|
|
83
|
+
]);
|
|
78
84
|
return compiledJs.apply(null, refValues);
|
|
79
85
|
}
|
|
80
86
|
|
|
81
87
|
export function toJSON(obj: any) {
|
|
82
|
-
|
|
83
88
|
//console.log('toJSON');
|
|
84
89
|
const knownObjs: any[] = [];
|
|
85
90
|
const objRefs: any[] = [];
|
|
@@ -87,30 +92,23 @@ export function toJSON(obj: any) {
|
|
|
87
92
|
let refCount = 0;
|
|
88
93
|
|
|
89
94
|
function recurse(obj: any) {
|
|
90
|
-
|
|
91
95
|
// stringify values
|
|
92
|
-
if (Number.isNaN(obj))
|
|
93
|
-
|
|
94
|
-
if (obj ===
|
|
95
|
-
|
|
96
|
-
if (obj === Infinity)
|
|
97
|
-
return "Infinity";
|
|
98
|
-
if (obj instanceof RegExp)
|
|
99
|
-
return ("__REGEXP " + obj.toString());
|
|
96
|
+
if (Number.isNaN(obj)) return "NaN";
|
|
97
|
+
if (obj === undefined) return "undefined";
|
|
98
|
+
if (obj === Infinity) return "Infinity";
|
|
99
|
+
if (obj instanceof RegExp) return `__REGEXP ${obj.toString()}`;
|
|
100
100
|
// if(isDate(obj))
|
|
101
101
|
// return "__DATE " + obj.toISOString();
|
|
102
|
-
if (_.isDate(obj))
|
|
103
|
-
|
|
104
|
-
if (_.isFunction(obj))
|
|
105
|
-
return '__FUNCTION ' + obj.toString();
|
|
102
|
+
if (_.isDate(obj)) return obj.toISOString();
|
|
103
|
+
if (_.isFunction(obj)) return `__FUNCTION ${obj.toString()}`;
|
|
106
104
|
if (_.isElement(obj)) {
|
|
107
|
-
return
|
|
105
|
+
return `__HTML ${obj.outerHTML}`;
|
|
108
106
|
}
|
|
109
|
-
if (typeof window !==
|
|
107
|
+
if (typeof window !== "undefined" && window && obj === window) {
|
|
110
108
|
return "__WINDOW";
|
|
111
109
|
}
|
|
112
110
|
if (_.isError(obj)) {
|
|
113
|
-
return
|
|
111
|
+
return `__ERROR ${obj.stack}`;
|
|
114
112
|
}
|
|
115
113
|
|
|
116
114
|
// non-objects can just be returned at this point
|
|
@@ -125,33 +123,32 @@ export function toJSON(obj: any) {
|
|
|
125
123
|
|
|
126
124
|
var nObj = newObjs[iObj];
|
|
127
125
|
if (_.isArray(nObj) && (!_.isString(nObj[0]) || !nObj[0].match(/^__this_ref:/)))
|
|
128
|
-
nObj.unshift(
|
|
129
|
-
else if (isObject(nObj) && !nObj.__this_ref)
|
|
130
|
-
nObj.__this_ref = ref;
|
|
126
|
+
nObj.unshift(`__this_ref:${ref}`);
|
|
127
|
+
else if (isObject(nObj) && !nObj.__this_ref) nObj.__this_ref = ref;
|
|
131
128
|
return ref;
|
|
132
129
|
}
|
|
133
130
|
|
|
134
131
|
// capture references in case we need them later
|
|
135
132
|
refCount++;
|
|
136
|
-
var newRef =
|
|
137
|
-
var
|
|
133
|
+
var newRef = `__duplicate_ref_${_.isArray(obj) ? "ary_" : "obj_"}${refCount}`;
|
|
134
|
+
var outObj: any[] | any = _.isArray(obj) ? [] : {};
|
|
138
135
|
knownObjs.push(obj);
|
|
139
136
|
objRefs.push(newRef);
|
|
140
|
-
newObjs.push(
|
|
137
|
+
newObjs.push(outObj);
|
|
141
138
|
|
|
142
139
|
// recurse on properties
|
|
143
140
|
if (_.isArray(obj))
|
|
144
|
-
for (var i = 0; i < obj.length; i++)
|
|
145
|
-
nObj.push(recurse(obj[i])); // use push so offset from reference capture doesn't mess things up
|
|
141
|
+
for (var i = 0; i < obj.length; i++) outObj.push(recurse(obj[i])); // use push so offset from reference capture doesn't mess things up
|
|
146
142
|
else
|
|
147
143
|
for (var key in obj) {
|
|
148
|
-
if (!(obj
|
|
144
|
+
if (!Object.hasOwn(obj as object, key)) continue;
|
|
149
145
|
var value = recurse(obj[key]);
|
|
150
|
-
if (key[0]
|
|
151
|
-
|
|
152
|
-
|
|
146
|
+
if (key[0] === "$")
|
|
147
|
+
// escape leading dollar signs
|
|
148
|
+
key = `__DOLLAR_${key.substr(1)}`;
|
|
149
|
+
outObj[key] = value;
|
|
153
150
|
}
|
|
154
|
-
return
|
|
151
|
+
return outObj;
|
|
155
152
|
}
|
|
156
153
|
obj = recurse(obj);
|
|
157
154
|
return obj;
|
|
@@ -162,33 +159,28 @@ export function fromJSON(obj: any, externalReferences?: any) {
|
|
|
162
159
|
var dup_refs: any = {};
|
|
163
160
|
|
|
164
161
|
function recurse(obj: any) {
|
|
165
|
-
|
|
166
162
|
if (_.isString(obj)) {
|
|
167
|
-
|
|
168
163
|
// restore values
|
|
169
|
-
if (obj === "undefined")
|
|
170
|
-
|
|
171
|
-
if (obj === "
|
|
172
|
-
return NaN;
|
|
173
|
-
if (obj === "Infinity")
|
|
174
|
-
return Infinity;
|
|
164
|
+
if (obj === "undefined") return undefined;
|
|
165
|
+
if (obj === "NaN") return NaN;
|
|
166
|
+
if (obj === "Infinity") return Infinity;
|
|
175
167
|
if (obj.match(/^__REGEXP /)) {
|
|
176
168
|
var m: any = obj.split("__REGEXP ")[1].match(/\/(.*)\/(.*)?/);
|
|
177
169
|
return new RegExp(m[1], m[2] || "");
|
|
178
170
|
}
|
|
179
|
-
if (obj.match(/^\d{4}-\d{2}-\d{2}T\d{2}
|
|
180
|
-
return new Date(obj)
|
|
171
|
+
if (obj.match(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/)) {
|
|
172
|
+
return new Date(obj);
|
|
181
173
|
}
|
|
182
174
|
if (obj.match(/^__FUNCTION /)) {
|
|
183
175
|
return js(obj.substring(11), externalReferences);
|
|
184
176
|
}
|
|
185
177
|
if (obj.match(/^__HTML /)) {
|
|
186
|
-
//@ts-
|
|
187
|
-
if (typeof $ !==
|
|
178
|
+
//@ts-expect-error
|
|
179
|
+
if (typeof $ !== "undefined") return $(obj.substring(7))[0];
|
|
188
180
|
else return obj;
|
|
189
181
|
}
|
|
190
182
|
if (obj.startsWith("__ERROR ")) {
|
|
191
|
-
|
|
183
|
+
const error = new Error();
|
|
192
184
|
error.stack = obj.substring(8);
|
|
193
185
|
return error;
|
|
194
186
|
}
|
|
@@ -198,20 +190,18 @@ export function fromJSON(obj: any, externalReferences?: any) {
|
|
|
198
190
|
|
|
199
191
|
// deal with duplicate refs
|
|
200
192
|
if (obj.match(/^__duplicate_ref_/)) {
|
|
201
|
-
if (!dup_refs[obj])
|
|
202
|
-
dup_refs[obj] = obj.match(/_obj_/) ? {} : [];
|
|
193
|
+
if (!dup_refs[obj]) dup_refs[obj] = obj.match(/_obj_/) ? {} : [];
|
|
203
194
|
return dup_refs[obj];
|
|
204
195
|
}
|
|
205
196
|
}
|
|
206
197
|
|
|
207
|
-
if (!(isObject(obj) || _.isArray(obj)))
|
|
208
|
-
return obj;
|
|
198
|
+
if (!(isObject(obj) || _.isArray(obj))) return obj;
|
|
209
199
|
|
|
210
200
|
// deal with objects that have duplicate refs
|
|
211
201
|
var dup_ref = null;
|
|
212
202
|
obj = _.clone(obj); // don't mess up the original JSON object
|
|
213
203
|
if (_.isArray(obj) && _.isString(obj[0]) && obj[0].match(/^__this_ref:/))
|
|
214
|
-
dup_ref = obj.shift().split(
|
|
204
|
+
dup_ref = obj.shift().split(":")[1];
|
|
215
205
|
else if (obj.__this_ref) {
|
|
216
206
|
dup_ref = obj.__this_ref;
|
|
217
207
|
delete obj.__this_ref;
|
|
@@ -219,18 +209,15 @@ export function fromJSON(obj: any, externalReferences?: any) {
|
|
|
219
209
|
|
|
220
210
|
var mObj: any = _.isArray(obj) ? [] : {};
|
|
221
211
|
if (dup_ref)
|
|
222
|
-
if (!dup_refs[dup_ref])
|
|
223
|
-
|
|
224
|
-
else
|
|
225
|
-
mObj = dup_refs[dup_ref];
|
|
212
|
+
if (!dup_refs[dup_ref]) dup_refs[dup_ref] = mObj;
|
|
213
|
+
else mObj = dup_refs[dup_ref];
|
|
226
214
|
|
|
227
215
|
// restore keys and recurse on objects
|
|
228
216
|
for (var key in obj) {
|
|
229
|
-
if (!
|
|
217
|
+
if (!Object.hasOwn(obj, key)) continue;
|
|
230
218
|
|
|
231
219
|
var value = recurse(obj[key]);
|
|
232
|
-
if (key.match(/^__DOLLAR_/))
|
|
233
|
-
key = '$' + key.substr(9);
|
|
220
|
+
if (key.match(/^__DOLLAR_/)) key = `$${key.substr(9)}`;
|
|
234
221
|
mObj[key] = value;
|
|
235
222
|
}
|
|
236
223
|
return mObj;
|
|
@@ -262,5 +249,5 @@ export function fromJSON(obj: any, externalReferences?: any) {
|
|
|
262
249
|
// return true;
|
|
263
250
|
// }
|
|
264
251
|
|
|
265
|
-
// @ts-
|
|
266
|
-
if (typeof window !==
|
|
252
|
+
// @ts-expect-error
|
|
253
|
+
if (typeof window !== "undefined") window.utils = module.exports;
|
package/tsconfig.json
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
"compilerOptions": {
|
|
3
3
|
"target": "ES2022",
|
|
4
4
|
"module": "CommonJS",
|
|
5
|
-
"jsx": "react",
|
|
5
|
+
"jsx": "react-jsx",
|
|
6
6
|
"declaration": true,
|
|
7
|
-
"emitDeclarationOnly": false,
|
|
7
|
+
"emitDeclarationOnly": false,
|
|
8
8
|
"outDir": "./dist",
|
|
9
9
|
"strict": true,
|
|
10
10
|
"noImplicitAny": true,
|
|
@@ -12,11 +12,6 @@
|
|
|
12
12
|
"esModuleInterop": true,
|
|
13
13
|
"types": ["jest", "node"]
|
|
14
14
|
},
|
|
15
|
-
"include": [
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
],
|
|
19
|
-
"exclude": [
|
|
20
|
-
"node_modules"
|
|
21
|
-
]
|
|
22
|
-
}
|
|
15
|
+
"include": ["src/**/*.ts", "src/**/*.tsx"],
|
|
16
|
+
"exclude": ["node_modules"]
|
|
17
|
+
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { Observable } from "@peers-app/peers-sdk";
|
|
2
|
-
import React from "react";
|
|
3
|
-
interface IProps extends React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement> {
|
|
4
|
-
datetime: Observable<Date | undefined> | Date | undefined;
|
|
5
|
-
}
|
|
6
|
-
export declare const InputDatetime: (props: IProps) => React.JSX.Element;
|
|
7
|
-
export {};
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.InputDatetime = void 0;
|
|
7
|
-
const react_1 = __importDefault(require("react"));
|
|
8
|
-
const hooks_1 = require("../hooks");
|
|
9
|
-
const InputDatetime = (props) => {
|
|
10
|
-
const [datetime, setDatetime] = (0, hooks_1.useObservable)(props.datetime);
|
|
11
|
-
const inputProps = { ...props };
|
|
12
|
-
// @ts-ignore
|
|
13
|
-
delete inputProps.datetime;
|
|
14
|
-
return (react_1.default.createElement("input", { ...inputProps, type: 'datetime-local', value: (() => {
|
|
15
|
-
if (!datetime)
|
|
16
|
-
return;
|
|
17
|
-
if (String(datetime) === 'Invalid Date')
|
|
18
|
-
return;
|
|
19
|
-
return datetime.toISOString?.()?.substring(0, 16);
|
|
20
|
-
})(), onChange: e => {
|
|
21
|
-
let value = e.target.value;
|
|
22
|
-
if (value) {
|
|
23
|
-
value += (new Date()).toISOString().substring(value.length);
|
|
24
|
-
const dt = new Date(value);
|
|
25
|
-
if (String(dt) !== 'Invalid Date') {
|
|
26
|
-
setDatetime(new Date(value));
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
setDatetime(undefined);
|
|
31
|
-
if (props.onChange)
|
|
32
|
-
props.onChange(e);
|
|
33
|
-
} }));
|
|
34
|
-
};
|
|
35
|
-
exports.InputDatetime = InputDatetime;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { ISortable } from './sortable-list';
|
|
3
|
-
interface IProps<T> {
|
|
4
|
-
loadMore: (existingItems: T[]) => Promise<T[]>;
|
|
5
|
-
filterItems?: (existingItems: T[]) => T[];
|
|
6
|
-
renderItem: (props: {
|
|
7
|
-
item: T;
|
|
8
|
-
listId: string;
|
|
9
|
-
sortHandle: string;
|
|
10
|
-
}) => React.ReactNode;
|
|
11
|
-
listsGroup?: string;
|
|
12
|
-
onAdd?: ((itemId: string, sortOrder: number) => any);
|
|
13
|
-
onUpdate?: ((args: {
|
|
14
|
-
items: T[];
|
|
15
|
-
ixMoved: number[];
|
|
16
|
-
}) => any);
|
|
17
|
-
hidden?: boolean;
|
|
18
|
-
containerProps?: Record<string, any>;
|
|
19
|
-
dragHandleClassName?: string;
|
|
20
|
-
sortDirection?: 'asc' | 'desc';
|
|
21
|
-
minHeight?: string | number;
|
|
22
|
-
paddingBottom?: string | number;
|
|
23
|
-
endOfList?: React.ReactNode;
|
|
24
|
-
loadingIndicator?: React.ReactNode;
|
|
25
|
-
scrollThreshold?: string | number;
|
|
26
|
-
lazyListStyle?: React.CSSProperties;
|
|
27
|
-
}
|
|
28
|
-
export declare function LazySortableList<T extends ISortable>(props: IProps<T>): React.JSX.Element;
|
|
29
|
-
export {};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.LazySortableList = LazySortableList;
|
|
7
|
-
const react_1 = __importDefault(require("react"));
|
|
8
|
-
const lazy_list_1 = require("./lazy-list");
|
|
9
|
-
const sortable_list_1 = require("./sortable-list");
|
|
10
|
-
function LazySortableList(props) {
|
|
11
|
-
return (react_1.default.createElement(lazy_list_1.LazyList, { lazyListStyle: props.lazyListStyle, loadMore: props.loadMore, filterItems: props.filterItems, endOfList: props.endOfList, loadingIndicator: props.loadingIndicator, scrollThreshold: props.scrollThreshold, renderItems: items => (react_1.default.createElement(sortable_list_1.SortableList, { items: items, sortDirection: props.sortDirection, renderItem: props.renderItem, listsGroup: props.listsGroup, onAdd: props.onAdd, onUpdate: props.onUpdate, hidden: props.hidden, containerProps: props.containerProps, dragHandleClassName: props.dragHandleClassName, minHeight: props.minHeight, paddingBottom: props.paddingBottom })) }));
|
|
12
|
-
}
|
|
@@ -1,207 +0,0 @@
|
|
|
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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.LeftBarContent = exports.LeftBar = void 0;
|
|
37
|
-
const peers_sdk_1 = require("@peers-app/peers-sdk");
|
|
38
|
-
const react_1 = __importStar(require("react"));
|
|
39
|
-
const globals_1 = require("../globals");
|
|
40
|
-
const hooks_1 = require("../hooks");
|
|
41
|
-
const off_canvas_1 = require("./off-canvas");
|
|
42
|
-
// import { useObservable } from 'peers-ui';
|
|
43
|
-
const offCanvasEffects = { hide: () => { } };
|
|
44
|
-
const LEFT_BAR_WIDTH_KEY = 'leftBarWidth';
|
|
45
|
-
const DEFAULT_LEFT_BAR_WIDTH = 300;
|
|
46
|
-
function getStoredLeftBarWidth() {
|
|
47
|
-
const stored = localStorage.getItem(LEFT_BAR_WIDTH_KEY);
|
|
48
|
-
return stored ? parseInt(stored, 10) : DEFAULT_LEFT_BAR_WIDTH;
|
|
49
|
-
}
|
|
50
|
-
function setStoredLeftBarWidth(width) {
|
|
51
|
-
localStorage.setItem(LEFT_BAR_WIDTH_KEY, String(width));
|
|
52
|
-
document.documentElement.style.setProperty('--left-bar-width', `${width}px`);
|
|
53
|
-
}
|
|
54
|
-
// Set initial CSS variable on load
|
|
55
|
-
setStoredLeftBarWidth(getStoredLeftBarWidth());
|
|
56
|
-
const LeftBar = () => {
|
|
57
|
-
const [_isDesktop] = (0, hooks_1.useObservable)(globals_1.isDesktop);
|
|
58
|
-
const [width, setWidth] = (0, react_1.useState)(() => getStoredLeftBarWidth());
|
|
59
|
-
const isDragging = (0, react_1.useRef)(false);
|
|
60
|
-
const startX = (0, react_1.useRef)(0);
|
|
61
|
-
const startWidth = (0, react_1.useRef)(0);
|
|
62
|
-
const onMouseMove = (0, react_1.useCallback)((e) => {
|
|
63
|
-
if (!isDragging.current)
|
|
64
|
-
return;
|
|
65
|
-
const delta = e.clientX - startX.current;
|
|
66
|
-
const newWidth = Math.max(150, Math.min(600, startWidth.current + delta));
|
|
67
|
-
setWidth(newWidth);
|
|
68
|
-
setStoredLeftBarWidth(newWidth);
|
|
69
|
-
}, []);
|
|
70
|
-
const onMouseUp = (0, react_1.useCallback)(() => {
|
|
71
|
-
isDragging.current = false;
|
|
72
|
-
document.removeEventListener('mousemove', onMouseMove);
|
|
73
|
-
document.removeEventListener('mouseup', onMouseUp);
|
|
74
|
-
document.body.style.cursor = '';
|
|
75
|
-
document.body.style.userSelect = '';
|
|
76
|
-
}, [onMouseMove]);
|
|
77
|
-
const onMouseDown = (0, react_1.useCallback)((e) => {
|
|
78
|
-
e.preventDefault();
|
|
79
|
-
isDragging.current = true;
|
|
80
|
-
startX.current = e.clientX;
|
|
81
|
-
startWidth.current = width;
|
|
82
|
-
document.addEventListener('mousemove', onMouseMove);
|
|
83
|
-
document.addEventListener('mouseup', onMouseUp);
|
|
84
|
-
document.body.style.cursor = 'col-resize';
|
|
85
|
-
document.body.style.userSelect = 'none';
|
|
86
|
-
}, [width, onMouseMove, onMouseUp]);
|
|
87
|
-
(0, react_1.useEffect)(() => {
|
|
88
|
-
return () => {
|
|
89
|
-
document.removeEventListener('mousemove', onMouseMove);
|
|
90
|
-
document.removeEventListener('mouseup', onMouseUp);
|
|
91
|
-
};
|
|
92
|
-
}, [onMouseMove, onMouseUp]);
|
|
93
|
-
// const [usersAndGroups, setUsersAndGroups] = useState<(IUser | IGroup)[]>([]);
|
|
94
|
-
if (_isDesktop) {
|
|
95
|
-
return (react_1.default.createElement("div", { className: 'left-bar-desktop', style: { position: 'fixed', top: 0, left: 0, width, display: 'flex', flexDirection: 'row' } },
|
|
96
|
-
react_1.default.createElement(exports.LeftBarContent, { width: width }),
|
|
97
|
-
react_1.default.createElement("div", { onMouseDown: onMouseDown, title: "Drag to resize", style: {
|
|
98
|
-
position: 'absolute',
|
|
99
|
-
top: 0,
|
|
100
|
-
right: '-3px',
|
|
101
|
-
width: '6px',
|
|
102
|
-
height: '100%',
|
|
103
|
-
cursor: 'col-resize',
|
|
104
|
-
zIndex: 200,
|
|
105
|
-
backgroundColor: 'transparent',
|
|
106
|
-
}, onMouseEnter: e => { e.target.style.backgroundColor = 'rgba(128,128,128,0.4)'; }, onMouseLeave: e => { e.target.style.backgroundColor = 'transparent'; } })));
|
|
107
|
-
}
|
|
108
|
-
else {
|
|
109
|
-
return (react_1.default.createElement(off_canvas_1.OffCanvas, { id: "leftBar", position: "left", keepOpen: _isDesktop, effects: offCanvasEffects },
|
|
110
|
-
react_1.default.createElement(exports.LeftBarContent, { width: DEFAULT_LEFT_BAR_WIDTH })));
|
|
111
|
-
}
|
|
112
|
-
};
|
|
113
|
-
exports.LeftBar = LeftBar;
|
|
114
|
-
const LeftBarContent = ({ width } = {}) => {
|
|
115
|
-
const [_isDesktop] = (0, hooks_1.useObservable)(globals_1.isDesktop);
|
|
116
|
-
const barWidth = width ?? DEFAULT_LEFT_BAR_WIDTH;
|
|
117
|
-
const packagesWithNavItems = (0, hooks_1.usePromise)(async () => {
|
|
118
|
-
const packages = await (0, peers_sdk_1.Packages)().list();
|
|
119
|
-
return packages.filter(pkg => pkg.appNavs?.length);
|
|
120
|
-
}, []);
|
|
121
|
-
const containerClassName = `d-flex flex-column flex-shrink-0 p-2 text-white ` + (_isDesktop ? 'bg-dark-subtle' : 'bg-dark');
|
|
122
|
-
const content = (react_1.default.createElement("div", { className: containerClassName, style: { width: barWidth, height: "calc(100vh - 25px)" } },
|
|
123
|
-
react_1.default.createElement("div", { className: "clearfix" },
|
|
124
|
-
react_1.default.createElement("div", { className: "dropdown", style: { display: 'inline-block', width: '200px' } },
|
|
125
|
-
react_1.default.createElement("a", { id: "dropdownUser1", "data-bs-toggle": "dropdown", "aria-expanded": "false", className: "d-flex align-items-center text-white text-decoration-none", href: "#", tabIndex: -1 },
|
|
126
|
-
react_1.default.createElement("span", { className: "fs-4" }, "Peers"),
|
|
127
|
-
"\u00A0\u00A0\u00A0",
|
|
128
|
-
react_1.default.createElement("i", { className: "bi bi-three-dots-vertical", style: { fontSize: '12pt' } })),
|
|
129
|
-
react_1.default.createElement("ul", { className: "dropdown-menu dropdown-menu-end dropdown-menu-dark text-small shadow", style: { border: '1px grey solid' }, "aria-labelledby": "dropdownUser1" },
|
|
130
|
-
react_1.default.createElement("li", null,
|
|
131
|
-
react_1.default.createElement("a", { className: "dropdown-item", href: "#settings" }, "Profile & Settings"))))),
|
|
132
|
-
react_1.default.createElement("hr", { className: 'p-0' }),
|
|
133
|
-
react_1.default.createElement(MenuSection, { menuItems: [
|
|
134
|
-
// { text: "Shell", icon: "bi bi-robot" },
|
|
135
|
-
// { text: "Threads", icon: "bi bi-terminal", path: "shell" },
|
|
136
|
-
// { text: "Journal", icon: "bi bi-journal-text" },
|
|
137
|
-
// { text: "Journal", icon: "bi bi-journal-bookmark" },
|
|
138
|
-
// { text: "Tasks", icon: "bi bi-list-task" },
|
|
139
|
-
// { text: "Calendar", icon: "bi bi-calendar-week", link: "calendar" },
|
|
140
|
-
// { text: "AI Models", icon: "bi bi-cpu" },
|
|
141
|
-
{ text: "Variables", icon: "bi bi-braces" },
|
|
142
|
-
{ text: "Types", icon: "bi bi-code-square", path: "peer-types" },
|
|
143
|
-
{ text: "Assistants", icon: "bi bi-person-fill-gear" },
|
|
144
|
-
{ text: "Tools", icon: "bi bi-tools" },
|
|
145
|
-
{ text: "Workflows", icon: "bi bi-database-fill-gear" },
|
|
146
|
-
{ text: "Events", icon: "bi bi-lightning-charge-fill" },
|
|
147
|
-
{ text: "Packages", icon: "bi bi-box-fill" },
|
|
148
|
-
// { text: "Notes", icon: "bi bi-collection" },
|
|
149
|
-
] }),
|
|
150
|
-
react_1.default.createElement("hr", null),
|
|
151
|
-
react_1.default.createElement(MenuSection, { menuItems: [
|
|
152
|
-
{ text: "Threads", icon: "bi bi-cpu", path: "shell" },
|
|
153
|
-
] }),
|
|
154
|
-
(packagesWithNavItems?.length ?? 0) > 0 && packagesWithNavItems?.map(p => react_1.default.createElement(PackageNavItems, { key: p.packageId, pkg: p }))));
|
|
155
|
-
return content;
|
|
156
|
-
};
|
|
157
|
-
exports.LeftBarContent = LeftBarContent;
|
|
158
|
-
function MenuItem(props) {
|
|
159
|
-
(0, hooks_1.useObservable)(globals_1.mainContentPath);
|
|
160
|
-
const link = props.path ?? props.text.replace(/\s/g, '-').toLowerCase();
|
|
161
|
-
const href = window.location.href.split('#')[1]?.trim() ?? '';
|
|
162
|
-
// let isActive = href.endsWith(link);
|
|
163
|
-
let isActive = href.split('/')[0] === link || href.startsWith(link);
|
|
164
|
-
if (link === 'shell' && !href) {
|
|
165
|
-
isActive = true;
|
|
166
|
-
}
|
|
167
|
-
return (react_1.default.createElement("div", { className: `nav-link text-white ${isActive && 'active' || ''} ${props.className || ''}`,
|
|
168
|
-
// onClick={() => window.location = (window.origin + props.link) as any}
|
|
169
|
-
style: { cursor: "pointer", marginLeft: `${props.left || 0}px` }, onClick: () => {
|
|
170
|
-
offCanvasEffects.hide?.();
|
|
171
|
-
(0, globals_1.mainContentPath)(link);
|
|
172
|
-
} },
|
|
173
|
-
react_1.default.createElement("a", { className: `text-white`, style: { textDecoration: 'none' } },
|
|
174
|
-
react_1.default.createElement("i", { className: props.icon }),
|
|
175
|
-
"\u00A0",
|
|
176
|
-
props.text)));
|
|
177
|
-
}
|
|
178
|
-
function MenuSection(props) {
|
|
179
|
-
return (react_1.default.createElement("div", { className: "nav flex-column nav-pills me-3", id: "v-pills-tab", role: "tablist", "aria-orientation": "vertical" }, props.menuItems.map(mi => react_1.default.createElement(MenuItem, { key: mi.text + mi.path, ...mi }))));
|
|
180
|
-
}
|
|
181
|
-
function PackageNavItems(props) {
|
|
182
|
-
const pkg = props.pkg;
|
|
183
|
-
if (!pkg.appNavs || pkg.appNavs.length === 0) {
|
|
184
|
-
return null;
|
|
185
|
-
}
|
|
186
|
-
// if (pkg.appNavs?.length === 1 && pkg.appNavs[0].name === pkg.name) {
|
|
187
|
-
// const iconClassName = pkg.appNavs[0].iconClassName || "bi bi-question-square";
|
|
188
|
-
// // this package only has one nav item and it's named the same as the package so just show it as a top level item
|
|
189
|
-
// return <MenuItem
|
|
190
|
-
// text={pkg.name}
|
|
191
|
-
// icon={iconClassName}
|
|
192
|
-
// />
|
|
193
|
-
// }
|
|
194
|
-
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
195
|
-
pkg.appNavs.length !== 1 || pkg.appNavs[0].name !== pkg.name && (react_1.default.createElement("label", { style: { color: 'silver' } }, pkg.name)),
|
|
196
|
-
react_1.default.createElement(MenuSection, { menuItems: pkg.appNavs.map(ni => {
|
|
197
|
-
let path = `package-nav/${pkg.packageId}/${(ni.navigationPath ?? ni.name).replace(/[^a-zA-Z0-9]/g, '-').toLowerCase()}`;
|
|
198
|
-
while (path.includes('//')) {
|
|
199
|
-
path = path.replace('//', '/');
|
|
200
|
-
}
|
|
201
|
-
return {
|
|
202
|
-
text: ni.name,
|
|
203
|
-
icon: ni.iconClassName || "bi bi-box-seam",
|
|
204
|
-
path,
|
|
205
|
-
};
|
|
206
|
-
}) })));
|
|
207
|
-
}
|