@peers-app/peers-ui 0.14.0 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/publish.yml +8 -5
- package/babel.config.js +4 -4
- package/biome.json +191 -0
- package/dist/command-palette/command-palette-ui.d.ts +1 -2
- package/dist/command-palette/command-palette-ui.js +175 -244
- package/dist/command-palette/command-palette.js +65 -64
- package/dist/components/chat-overlay.d.ts +2 -2
- package/dist/components/chat-overlay.js +160 -217
- package/dist/components/checkbox.d.ts +5 -4
- package/dist/components/checkbox.js +4 -7
- package/dist/components/group-switcher.d.ts +1 -2
- package/dist/components/group-switcher.js +119 -159
- package/dist/components/input-date.d.ts +3 -3
- package/dist/components/input-date.js +6 -6
- package/dist/components/input-number.d.ts +7 -6
- package/dist/components/input-number.js +25 -20
- package/dist/components/input.d.ts +5 -4
- package/dist/components/input.js +4 -7
- package/dist/components/inverse-lazy-list.d.ts +3 -3
- package/dist/components/inverse-lazy-list.js +13 -47
- package/dist/components/io-schema-values.d.ts +5 -6
- package/dist/components/io-schema-values.js +28 -65
- package/dist/components/io-schema.d.ts +4 -5
- package/dist/components/io-schema.js +42 -79
- package/dist/components/lazy-list.d.ts +3 -3
- package/dist/components/lazy-list.js +38 -58
- package/dist/components/list-screen.d.ts +3 -8
- package/dist/components/list-screen.js +28 -23
- package/dist/components/loading-indicator.d.ts +1 -2
- package/dist/components/loading-indicator.js +2 -6
- package/dist/components/markdown-editor/autolink-plugin.js +5 -8
- package/dist/components/markdown-editor/editor-inline.d.ts +2 -3
- package/dist/components/markdown-editor/editor-inline.js +2 -6
- package/dist/components/markdown-editor/editor.d.ts +6 -6
- package/dist/components/markdown-editor/editor.js +9 -19
- package/dist/components/markdown-editor/markdown-plugin.d.ts +1 -1
- package/dist/components/markdown-editor/markdown-plugin.js +20 -21
- package/dist/components/markdown-editor/mention-node.d.ts +2 -2
- package/dist/components/markdown-editor/mention-node.js +24 -24
- package/dist/components/markdown-editor/mentions-plugin.d.ts +2 -2
- package/dist/components/markdown-editor/mentions-plugin.js +61 -62
- package/dist/components/markdown-editor/theme.js +28 -28
- package/dist/components/markdown-editor/toolbar.d.ts +2 -3
- package/dist/components/markdown-editor/toolbar.js +32 -49
- package/dist/components/markdown-with-mentions.d.ts +1 -1
- package/dist/components/markdown-with-mentions.js +43 -43
- package/dist/components/message-logs/message-logs.d.ts +1 -2
- package/dist/components/message-logs/message-logs.js +91 -116
- package/dist/components/messages/avatar.d.ts +3 -4
- package/dist/components/messages/avatar.js +37 -46
- package/dist/components/messages/channel-message-list.d.ts +5 -6
- package/dist/components/messages/channel-message-list.js +34 -34
- package/dist/components/messages/channel-view.d.ts +1 -2
- package/dist/components/messages/channel-view.js +23 -57
- package/dist/components/messages/message-compose.d.ts +3 -4
- package/dist/components/messages/message-compose.js +27 -38
- package/dist/components/messages/message-display.d.ts +2 -3
- package/dist/components/messages/message-display.js +42 -95
- package/dist/components/messages/thread-message-list.d.ts +4 -5
- package/dist/components/messages/thread-message-list.js +29 -29
- package/dist/components/router.d.ts +1 -2
- package/dist/components/router.js +58 -66
- package/dist/components/save-button.d.ts +3 -3
- package/dist/components/save-button.js +23 -33
- package/dist/components/sortable-list.d.ts +11 -12
- package/dist/components/sortable-list.js +42 -22
- package/dist/components/tabs.d.ts +3 -3
- package/dist/components/tabs.js +16 -47
- package/dist/components/tooltip.d.ts +4 -4
- package/dist/components/tooltip.js +4 -9
- package/dist/components/trust-level-badge.d.ts +2 -3
- package/dist/components/trust-level-badge.js +16 -16
- package/dist/components/trust-level-dropdown.d.ts +3 -4
- package/dist/components/trust-level-dropdown.js +32 -55
- package/dist/components/typeahead.d.ts +3 -3
- package/dist/components/typeahead.js +48 -89
- package/dist/components/voice-indicator.d.ts +2 -2
- package/dist/components/voice-indicator.js +93 -106
- package/dist/components/voice-subscribe-events.d.ts +32 -0
- package/dist/components/voice-subscribe-events.js +2 -0
- package/dist/globals.d.ts +3 -5
- package/dist/globals.js +22 -33
- package/dist/hooks.d.ts +5 -5
- package/dist/hooks.js +22 -12
- package/dist/hooks.test.js +129 -145
- package/dist/index.d.ts +9 -8
- package/dist/index.js +13 -12
- package/dist/mention-configs.d.ts +2 -2
- package/dist/mention-configs.js +55 -42
- package/dist/screens/assistants/assistant-config.d.ts +2 -3
- package/dist/screens/assistants/assistant-config.js +9 -22
- package/dist/screens/assistants/assistant-details.d.ts +1 -2
- package/dist/screens/assistants/assistant-details.js +13 -28
- package/dist/screens/assistants/assistant-info.d.ts +2 -3
- package/dist/screens/assistants/assistant-info.js +3 -17
- package/dist/screens/assistants/assistant-list.d.ts +1 -2
- package/dist/screens/assistants/assistant-list.js +15 -56
- package/dist/screens/assistants/assistant-tools.d.ts +2 -3
- package/dist/screens/assistants/assistant-tools.js +10 -24
- package/dist/screens/console-logs/console-logs-list.d.ts +1 -2
- package/dist/screens/console-logs/console-logs-list.js +130 -134
- package/dist/screens/console-logs/log-display.d.ts +2 -3
- package/dist/screens/console-logs/log-display.js +40 -42
- package/dist/screens/console-logs/log-filters.d.ts +1 -2
- package/dist/screens/console-logs/log-filters.js +2 -24
- package/dist/screens/console-logs/mobile-log-card.d.ts +2 -3
- package/dist/screens/console-logs/mobile-log-card.js +64 -67
- package/dist/screens/console-logs/resizable-table-header.d.ts +1 -2
- package/dist/screens/console-logs/resizable-table-header.js +31 -67
- package/dist/screens/contacts/contact-details.d.ts +1 -2
- package/dist/screens/contacts/contact-details.js +16 -46
- package/dist/screens/contacts/contact-list.d.ts +1 -2
- package/dist/screens/contacts/contact-list.js +44 -103
- package/dist/screens/contacts/index.d.ts +4 -4
- package/dist/screens/contacts/index.js +1 -1
- package/dist/screens/contacts/user-connect.d.ts +1 -2
- package/dist/screens/contacts/user-connect.js +85 -186
- package/dist/screens/data-explorer/data-explorer.d.ts +1 -2
- package/dist/screens/data-explorer/data-explorer.js +61 -181
- package/dist/screens/data-explorer/index.d.ts +2 -2
- package/dist/screens/data-explorer/query-executor.d.ts +1 -2
- package/dist/screens/data-explorer/query-executor.js +56 -166
- package/dist/screens/groups/group-details.d.ts +1 -2
- package/dist/screens/groups/group-details.js +27 -122
- package/dist/screens/groups/group-invite-listener.d.ts +2 -3
- package/dist/screens/groups/group-invite-listener.js +8 -104
- package/dist/screens/groups/group-list.d.ts +1 -2
- package/dist/screens/groups/group-list.js +56 -133
- package/dist/screens/groups/group-members.d.ts +2 -3
- package/dist/screens/groups/group-members.js +62 -132
- package/dist/screens/groups/index.d.ts +4 -4
- package/dist/screens/groups/index.js +1 -1
- package/dist/screens/join-group/index.d.ts +2 -2
- package/dist/screens/join-group/join-group.d.ts +1 -2
- package/dist/screens/join-group/join-group.js +9 -109
- package/dist/screens/network-viewer/connection-troubleshooter.d.ts +2 -3
- package/dist/screens/network-viewer/connection-troubleshooter.js +89 -193
- package/dist/screens/network-viewer/cpu-usage-graph.d.ts +1 -2
- package/dist/screens/network-viewer/cpu-usage-graph.js +60 -99
- package/dist/screens/network-viewer/device-details-modal.d.ts +1 -2
- package/dist/screens/network-viewer/device-details-modal.js +25 -177
- package/dist/screens/network-viewer/group-details-modal.d.ts +1 -2
- package/dist/screens/network-viewer/group-details-modal.js +31 -142
- package/dist/screens/network-viewer/index.d.ts +4 -4
- package/dist/screens/network-viewer/index.js +3 -3
- package/dist/screens/network-viewer/network-viewer-ipc.d.ts +22 -0
- package/dist/screens/network-viewer/network-viewer-ipc.js +6 -0
- package/dist/screens/network-viewer/network-viewer.d.ts +1 -2
- package/dist/screens/network-viewer/network-viewer.js +91 -296
- package/dist/screens/network-viewer/usage-graph.d.ts +1 -2
- package/dist/screens/network-viewer/usage-graph.js +78 -110
- package/dist/screens/packages/package-details.d.ts +1 -2
- package/dist/screens/packages/package-details.js +35 -41
- package/dist/screens/packages/package-info.d.ts +2 -2
- package/dist/screens/packages/package-info.js +33 -86
- package/dist/screens/packages/package-list.d.ts +1 -2
- package/dist/screens/packages/package-list.js +42 -106
- package/dist/screens/packages/package-new-local.d.ts +1 -2
- package/dist/screens/packages/package-new-local.js +13 -19
- package/dist/screens/packages/package-versions.d.ts +2 -3
- package/dist/screens/packages/package-versions.js +29 -96
- package/dist/screens/peer-types/peer-type-details.d.ts +3 -4
- package/dist/screens/peer-types/peer-type-details.js +26 -78
- package/dist/screens/peer-types/peer-type-list.d.ts +1 -2
- package/dist/screens/peer-types/peer-type-list.js +13 -24
- package/dist/screens/search/global-search.d.ts +1 -2
- package/dist/screens/search/global-search.js +104 -182
- package/dist/screens/settings/color-mode-dropdown.d.ts +3 -4
- package/dist/screens/settings/color-mode-dropdown.js +18 -37
- package/dist/screens/settings/settings-page.d.ts +1 -1
- package/dist/screens/settings/settings-page.js +86 -213
- package/dist/screens/settings/voice-settings-agent.d.ts +1 -1
- package/dist/screens/settings/voice-settings-agent.js +7 -44
- package/dist/screens/settings/voice-settings-api-keys.d.ts +2 -2
- package/dist/screens/settings/voice-settings-api-keys.js +2 -29
- package/dist/screens/settings/voice-settings-output.d.ts +2 -2
- package/dist/screens/settings/voice-settings-output.js +2 -40
- package/dist/screens/settings/voice-settings-providers.d.ts +2 -2
- package/dist/screens/settings/voice-settings-providers.js +2 -19
- package/dist/screens/settings/voice-settings-types.d.ts +4 -4
- package/dist/screens/settings/voice-settings-types.js +31 -31
- package/dist/screens/settings/voice-settings-wake-word.d.ts +2 -2
- package/dist/screens/settings/voice-settings-wake-word.js +2 -33
- package/dist/screens/settings/voice-settings.d.ts +1 -1
- package/dist/screens/settings/voice-settings.js +35 -112
- package/dist/screens/setup-user.d.ts +1 -2
- package/dist/screens/setup-user.js +38 -116
- package/dist/screens/tools/tool-code.d.ts +2 -3
- package/dist/screens/tools/tool-code.js +9 -13
- package/dist/screens/tools/tool-details.d.ts +1 -2
- package/dist/screens/tools/tool-details.js +26 -39
- package/dist/screens/tools/tool-info.d.ts +2 -3
- package/dist/screens/tools/tool-info.js +9 -48
- package/dist/screens/tools/tool-list.d.ts +1 -2
- package/dist/screens/tools/tool-list.js +33 -65
- package/dist/screens/tools/tool-schema.d.ts +2 -3
- package/dist/screens/tools/tool-schema.js +2 -13
- package/dist/screens/tools/tool-test-details.d.ts +1 -2
- package/dist/screens/tools/tool-test-details.js +12 -28
- package/dist/screens/tools/tool-test-list.d.ts +1 -2
- package/dist/screens/tools/tool-test-list.js +17 -56
- package/dist/screens/variables/variable-details.d.ts +1 -2
- package/dist/screens/variables/variable-details.js +19 -86
- package/dist/screens/variables/variable-list.d.ts +1 -2
- package/dist/screens/variables/variable-list.js +16 -27
- package/dist/screens/welcome-modal.d.ts +1 -2
- package/dist/screens/welcome-modal.js +44 -111
- package/dist/screens/workflows/workflow-details.d.ts +1 -2
- package/dist/screens/workflows/workflow-details.js +17 -31
- package/dist/screens/workflows/workflow-info.d.ts +2 -3
- package/dist/screens/workflows/workflow-info.js +2 -9
- package/dist/screens/workflows/workflow-instructions.d.ts +2 -3
- package/dist/screens/workflows/workflow-instructions.js +23 -55
- package/dist/screens/workflows/workflow-list.d.ts +1 -2
- package/dist/screens/workflows/workflow-list.js +23 -62
- package/dist/setupTests.d.ts +1 -1
- package/dist/setupTests.js +10 -11
- package/dist/system-apps/assistants.app.d.ts +1 -1
- package/dist/system-apps/assistants.app.js +3 -3
- package/dist/system-apps/console-logs.app.d.ts +1 -1
- package/dist/system-apps/console-logs.app.js +3 -3
- package/dist/system-apps/contacts.app.d.ts +1 -1
- package/dist/system-apps/contacts.app.js +4 -4
- package/dist/system-apps/data-explorer.app.d.ts +1 -1
- package/dist/system-apps/data-explorer.app.js +4 -4
- package/dist/system-apps/groups.app.d.ts +1 -1
- package/dist/system-apps/groups.app.js +4 -4
- package/dist/system-apps/index.d.ts +17 -17
- package/dist/system-apps/index.js +52 -52
- package/dist/system-apps/join-group.app.d.ts +1 -1
- package/dist/system-apps/join-group.app.js +4 -4
- package/dist/system-apps/mobile-settings.app.d.ts +1 -1
- package/dist/system-apps/mobile-settings.app.js +3 -3
- package/dist/system-apps/network-viewer.app.d.ts +1 -1
- package/dist/system-apps/network-viewer.app.js +4 -4
- package/dist/system-apps/packages.app.d.ts +1 -1
- package/dist/system-apps/packages.app.js +3 -3
- package/dist/system-apps/search.app.d.ts +1 -1
- package/dist/system-apps/search.app.js +4 -4
- package/dist/system-apps/settings.app.d.ts +1 -1
- package/dist/system-apps/settings.app.js +3 -3
- package/dist/system-apps/threads.app.d.ts +1 -1
- package/dist/system-apps/threads.app.js +3 -3
- package/dist/system-apps/tools.app.d.ts +1 -1
- package/dist/system-apps/tools.app.js +3 -3
- package/dist/system-apps/types.app.d.ts +1 -1
- package/dist/system-apps/types.app.js +3 -3
- package/dist/system-apps/variables.app.d.ts +1 -1
- package/dist/system-apps/variables.app.js +3 -3
- package/dist/system-apps/workflows.app.d.ts +1 -1
- package/dist/system-apps/workflows.app.js +3 -3
- package/dist/tabs-layout/tabs-layout.d.ts +2 -3
- package/dist/tabs-layout/tabs-layout.js +215 -246
- package/dist/tabs-layout/tabs-state.d.ts +2 -2
- package/dist/tabs-layout/tabs-state.js +73 -61
- package/dist/ui-defaults/index.d.ts +2 -2
- package/dist/ui-defaults/list-screen.d.ts +2 -3
- package/dist/ui-defaults/list-screen.js +33 -37
- package/dist/ui-defaults/markdown-field.js +24 -56
- package/dist/ui-router/routes-loader.d.ts +1 -1
- package/dist/ui-router/routes-loader.js +17 -13
- package/dist/ui-router/ui-loader.d.ts +6 -6
- package/dist/ui-router/ui-loader.js +172 -268
- package/dist/utils.js +49 -39
- package/jest.config.js +16 -16
- package/package.json +16 -14
- package/src/command-palette/command-palette-ui.tsx +261 -237
- package/src/command-palette/command-palette.ts +81 -78
- package/src/components/chat-overlay.tsx +366 -261
- package/src/components/checkbox.tsx +15 -12
- package/src/components/group-switcher.tsx +150 -105
- package/src/components/input-date.tsx +17 -16
- package/src/components/input-number.tsx +47 -31
- package/src/components/input.tsx +15 -12
- package/src/components/inverse-lazy-list.tsx +14 -13
- package/src/components/io-schema-values.tsx +51 -69
- package/src/components/io-schema.tsx +94 -69
- package/src/components/lazy-list.tsx +51 -34
- package/src/components/list-screen.tsx +51 -35
- package/src/components/loading-indicator.tsx +2 -4
- package/src/components/markdown-editor/autolink-plugin.tsx +4 -11
- package/src/components/markdown-editor/editor-inline.tsx +3 -4
- package/src/components/markdown-editor/editor.tsx +53 -51
- package/src/components/markdown-editor/markdown-plugin.tsx +48 -40
- package/src/components/markdown-editor/mention-node.ts +39 -38
- package/src/components/markdown-editor/mentions-plugin.tsx +99 -101
- package/src/components/markdown-editor/theme.ts +28 -29
- package/src/components/markdown-editor/toolbar.tsx +53 -47
- package/src/components/markdown-with-mentions.tsx +56 -46
- package/src/components/message-logs/message-logs.tsx +225 -165
- package/src/components/messages/avatar.tsx +70 -52
- package/src/components/messages/channel-message-list.tsx +80 -68
- package/src/components/messages/channel-view.tsx +34 -33
- package/src/components/messages/message-compose.tsx +84 -67
- package/src/components/messages/message-display.tsx +103 -89
- package/src/components/messages/thread-message-list.tsx +53 -44
- package/src/components/router.tsx +42 -43
- package/src/components/save-button.tsx +43 -39
- package/src/components/sortable-list.tsx +77 -49
- package/src/components/tabs.tsx +31 -31
- package/src/components/tooltip.tsx +21 -28
- package/src/components/trust-level-badge.tsx +15 -11
- package/src/components/trust-level-dropdown.tsx +49 -19
- package/src/components/typeahead.tsx +57 -59
- package/src/components/voice-indicator.tsx +158 -141
- package/src/components/voice-subscribe-events.ts +20 -0
- package/src/globals.tsx +42 -40
- package/src/hooks.test.tsx +141 -134
- package/src/hooks.ts +80 -48
- package/src/index.tsx +17 -10
- package/src/mention-configs.ts +122 -68
- package/src/screens/assistants/assistant-config.tsx +28 -18
- package/src/screens/assistants/assistant-details.tsx +35 -36
- package/src/screens/assistants/assistant-info.tsx +16 -11
- package/src/screens/assistants/assistant-list.tsx +37 -34
- package/src/screens/assistants/assistant-tools.tsx +41 -20
- package/src/screens/console-logs/console-logs-list.tsx +173 -140
- package/src/screens/console-logs/log-display.tsx +65 -38
- package/src/screens/console-logs/log-filters.tsx +4 -3
- package/src/screens/console-logs/mobile-log-card.tsx +78 -71
- package/src/screens/console-logs/resizable-table-header.tsx +29 -21
- package/src/screens/contacts/contact-details.tsx +29 -30
- package/src/screens/contacts/contact-list.tsx +71 -60
- package/src/screens/contacts/index.ts +5 -5
- package/src/screens/contacts/user-connect.tsx +177 -171
- package/src/screens/data-explorer/data-explorer.tsx +134 -98
- package/src/screens/data-explorer/index.ts +2 -3
- package/src/screens/data-explorer/query-executor.tsx +90 -80
- package/src/screens/groups/group-details.tsx +120 -101
- package/src/screens/groups/group-invite-listener.tsx +34 -37
- package/src/screens/groups/group-list.tsx +119 -103
- package/src/screens/groups/group-members.tsx +225 -164
- package/src/screens/groups/index.ts +5 -6
- package/src/screens/join-group/index.ts +2 -2
- package/src/screens/join-group/join-group.tsx +41 -39
- package/src/screens/network-viewer/connection-troubleshooter.tsx +145 -104
- package/src/screens/network-viewer/cpu-usage-graph.tsx +39 -43
- package/src/screens/network-viewer/device-details-modal.tsx +46 -59
- package/src/screens/network-viewer/group-details-modal.tsx +68 -49
- package/src/screens/network-viewer/index.ts +4 -5
- package/src/screens/network-viewer/network-viewer-ipc.ts +23 -0
- package/src/screens/network-viewer/network-viewer.tsx +261 -236
- package/src/screens/network-viewer/usage-graph.tsx +57 -49
- package/src/screens/packages/package-details.tsx +43 -35
- package/src/screens/packages/package-info.tsx +107 -66
- package/src/screens/packages/package-list.tsx +175 -98
- package/src/screens/packages/package-new-local.tsx +28 -26
- package/src/screens/packages/package-versions.tsx +102 -77
- package/src/screens/peer-types/peer-type-details.tsx +60 -50
- package/src/screens/peer-types/peer-type-list.tsx +20 -30
- package/src/screens/search/global-search.tsx +153 -137
- package/src/screens/settings/color-mode-dropdown.tsx +52 -35
- package/src/screens/settings/settings-page.tsx +215 -141
- package/src/screens/settings/voice-settings-agent.tsx +13 -12
- package/src/screens/settings/voice-settings-api-keys.tsx +14 -12
- package/src/screens/settings/voice-settings-output.tsx +12 -11
- package/src/screens/settings/voice-settings-providers.tsx +7 -3
- package/src/screens/settings/voice-settings-types.ts +52 -49
- package/src/screens/settings/voice-settings-wake-word.tsx +25 -9
- package/src/screens/settings/voice-settings.tsx +66 -43
- package/src/screens/setup-user.tsx +88 -41
- package/src/screens/tools/tool-code.tsx +12 -17
- package/src/screens/tools/tool-details.tsx +28 -28
- package/src/screens/tools/tool-info.tsx +14 -19
- package/src/screens/tools/tool-list.tsx +58 -40
- package/src/screens/tools/tool-schema.tsx +16 -9
- package/src/screens/tools/tool-test-details.tsx +11 -22
- package/src/screens/tools/tool-test-list.tsx +29 -30
- package/src/screens/variables/variable-details.tsx +63 -51
- package/src/screens/variables/variable-list.tsx +29 -30
- package/src/screens/welcome-modal.tsx +68 -48
- package/src/screens/workflows/workflow-details.tsx +40 -30
- package/src/screens/workflows/workflow-info.tsx +4 -11
- package/src/screens/workflows/workflow-instructions.tsx +35 -28
- package/src/screens/workflows/workflow-list.tsx +50 -40
- package/src/setupTests.ts +14 -13
- package/src/system-apps/assistants.app.ts +5 -5
- package/src/system-apps/console-logs.app.ts +4 -4
- package/src/system-apps/contacts.app.ts +6 -6
- package/src/system-apps/data-explorer.app.ts +5 -5
- package/src/system-apps/groups.app.ts +6 -6
- package/src/system-apps/index.ts +49 -49
- package/src/system-apps/join-group.app.ts +5 -5
- package/src/system-apps/mobile-settings.app.ts +4 -5
- package/src/system-apps/network-viewer.app.ts +5 -5
- package/src/system-apps/packages.app.ts +5 -5
- package/src/system-apps/search.app.ts +6 -6
- package/src/system-apps/settings.app.ts +5 -5
- package/src/system-apps/threads.app.ts +5 -5
- package/src/system-apps/tools.app.ts +5 -5
- package/src/system-apps/types.app.ts +5 -5
- package/src/system-apps/variables.app.ts +5 -5
- package/src/system-apps/workflows.app.ts +5 -5
- package/src/tabs-layout/tabs-layout.tsx +345 -254
- package/src/tabs-layout/tabs-state.ts +100 -81
- package/src/ui-defaults/index.ts +2 -3
- package/src/ui-defaults/list-screen.tsx +45 -40
- package/src/ui-defaults/markdown-field.tsx +22 -26
- package/src/ui-router/routes-loader.ts +40 -24
- package/src/ui-router/ui-loader.tsx +312 -214
- package/src/utils.ts +68 -81
- package/tsconfig.json +5 -10
- package/dist/components/input-datetime.d.ts +0 -7
- package/dist/components/input-datetime.js +0 -35
- package/dist/components/lazy-sortable-list.d.ts +0 -29
- package/dist/components/lazy-sortable-list.js +0 -12
- package/dist/components/left-bar.d.ts +0 -5
- package/dist/components/left-bar.js +0 -207
- package/dist/components/main-content-container.d.ts +0 -2
- package/dist/components/main-content-container.js +0 -92
- package/dist/components/messages/thread-view.d.ts +0 -6
- package/dist/components/messages/thread-view.js +0 -174
- package/dist/components/off-canvas.d.ts +0 -13
- package/dist/components/off-canvas.js +0 -89
- package/dist/components/text-list-editor.tsx/text-list-editor.d.ts +0 -6
- package/dist/components/text-list-editor.tsx/text-list-editor.js +0 -13
- package/dist/components/top-bar.d.ts +0 -2
- package/dist/components/top-bar.js +0 -51
- package/dist/components/typeahead/mentions-plugin.d.ts +0 -7
- package/dist/components/typeahead/mentions-plugin.js +0 -203
- package/dist/components/typeahead/typeahead-editor.d.ts +0 -15
- package/dist/components/typeahead/typeahead-editor.js +0 -134
- package/dist/components/typeahead/typeahead.d.ts +0 -12
- package/dist/components/typeahead/typeahead.js +0 -94
- package/dist/screens/profile.d.ts +0 -2
- package/dist/screens/profile.js +0 -76
- package/src/components/input-datetime.tsx +0 -41
- package/src/components/lazy-sortable-list.tsx +0 -51
- package/src/components/left-bar.tsx +0 -322
- package/src/components/main-content-container.tsx +0 -79
- package/src/components/messages/thread-view.tsx +0 -214
- package/src/components/off-canvas.tsx +0 -83
- package/src/components/text-list-editor.tsx/text-list-editor.tsx +0 -13
- package/src/components/top-bar.tsx +0 -119
- package/src/components/typeahead/mentions-plugin.tsx +0 -265
- package/src/components/typeahead/typeahead-editor.tsx +0 -140
- package/src/components/typeahead/typeahead.tsx +0 -77
- package/src/screens/profile.tsx +0 -75
|
@@ -35,6 +35,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.peersSystemPackageId = exports.UIRouter = void 0;
|
|
37
37
|
exports.registerInternalPeersUI = registerInternalPeersUI;
|
|
38
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
38
39
|
const peers_sdk_1 = require("@peers-app/peers-sdk");
|
|
39
40
|
const lodash_1 = require("lodash");
|
|
40
41
|
const react_1 = __importStar(require("react"));
|
|
@@ -53,7 +54,7 @@ class UIErrorBoundary extends react_1.Component {
|
|
|
53
54
|
return { hasError: true, error, errorInfo: null };
|
|
54
55
|
}
|
|
55
56
|
componentDidCatch(error, errorInfo) {
|
|
56
|
-
console.error(
|
|
57
|
+
console.error("UIErrorBoundary caught an error:", error, errorInfo);
|
|
57
58
|
this.setState({
|
|
58
59
|
error,
|
|
59
60
|
errorInfo,
|
|
@@ -63,67 +64,37 @@ class UIErrorBoundary extends react_1.Component {
|
|
|
63
64
|
if (this.state.hasError) {
|
|
64
65
|
const { peersUIId, packageName, componentName } = this.props;
|
|
65
66
|
const { error, errorInfo } = this.state;
|
|
66
|
-
return (
|
|
67
|
-
padding:
|
|
68
|
-
border:
|
|
69
|
-
borderRadius:
|
|
70
|
-
backgroundColor:
|
|
71
|
-
color:
|
|
72
|
-
fontFamily:
|
|
73
|
-
margin:
|
|
74
|
-
} },
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
borderRadius:
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
maxHeight: '200px'
|
|
98
|
-
} },
|
|
99
|
-
react_1.default.createElement("strong", null, "Error:"),
|
|
100
|
-
" ",
|
|
101
|
-
error?.message || 'Unknown error',
|
|
102
|
-
error?.stack && (react_1.default.createElement(react_1.default.Fragment, null,
|
|
103
|
-
react_1.default.createElement("br", null),
|
|
104
|
-
react_1.default.createElement("br", null),
|
|
105
|
-
react_1.default.createElement("strong", null, "Stack Trace:"),
|
|
106
|
-
react_1.default.createElement("br", null),
|
|
107
|
-
error.stack)))),
|
|
108
|
-
errorInfo && (react_1.default.createElement("details", null,
|
|
109
|
-
react_1.default.createElement("summary", { style: { cursor: 'pointer', fontWeight: 'bold', marginBottom: '10px' } }, "Component Stack"),
|
|
110
|
-
react_1.default.createElement("div", { style: {
|
|
111
|
-
backgroundColor: '#fed7d7',
|
|
112
|
-
padding: '10px',
|
|
113
|
-
borderRadius: '4px',
|
|
114
|
-
whiteSpace: 'pre-wrap',
|
|
115
|
-
overflow: 'auto',
|
|
116
|
-
maxHeight: '200px'
|
|
117
|
-
} }, errorInfo.componentStack))),
|
|
118
|
-
react_1.default.createElement("button", { onClick: () => this.setState({ hasError: false, error: null, errorInfo: null }), style: {
|
|
119
|
-
marginTop: '15px',
|
|
120
|
-
padding: '8px 16px',
|
|
121
|
-
backgroundColor: '#c53030',
|
|
122
|
-
color: 'white',
|
|
123
|
-
border: 'none',
|
|
124
|
-
borderRadius: '4px',
|
|
125
|
-
cursor: 'pointer'
|
|
126
|
-
} }, "Try Again")));
|
|
67
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: {
|
|
68
|
+
padding: "20px",
|
|
69
|
+
border: "2px solid #ff6b6b",
|
|
70
|
+
borderRadius: "8px",
|
|
71
|
+
backgroundColor: "#fff5f5",
|
|
72
|
+
color: "#721c24",
|
|
73
|
+
fontFamily: "monospace",
|
|
74
|
+
margin: "10px 0",
|
|
75
|
+
}, children: [(0, jsx_runtime_1.jsx)("h3", { style: { color: "#c53030", marginTop: 0 }, children: "UI Component Error" }), (0, jsx_runtime_1.jsxs)("div", { style: { marginBottom: "15px" }, children: [peersUIId && ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("strong", { children: "Peers UI ID:" }), " ", peersUIId] })), packageName && ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("strong", { children: "Package:" }), " ", packageName] })), componentName && ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("strong", { children: "Component:" }), " ", componentName] }))] }), (0, jsx_runtime_1.jsxs)("details", { style: { marginBottom: "15px" }, children: [(0, jsx_runtime_1.jsx)("summary", { style: { cursor: "pointer", fontWeight: "bold", marginBottom: "10px" }, children: "Error Details" }), (0, jsx_runtime_1.jsxs)("div", { style: {
|
|
76
|
+
backgroundColor: "#fed7d7",
|
|
77
|
+
padding: "10px",
|
|
78
|
+
borderRadius: "4px",
|
|
79
|
+
whiteSpace: "pre-wrap",
|
|
80
|
+
overflow: "auto",
|
|
81
|
+
maxHeight: "200px",
|
|
82
|
+
}, children: [(0, jsx_runtime_1.jsx)("strong", { children: "Error:" }), " ", error?.message || "Unknown error", error?.stack && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("br", {}), (0, jsx_runtime_1.jsx)("br", {}), (0, jsx_runtime_1.jsx)("strong", { children: "Stack Trace:" }), (0, jsx_runtime_1.jsx)("br", {}), error.stack] }))] })] }), errorInfo && ((0, jsx_runtime_1.jsxs)("details", { children: [(0, jsx_runtime_1.jsx)("summary", { style: { cursor: "pointer", fontWeight: "bold", marginBottom: "10px" }, children: "Component Stack" }), (0, jsx_runtime_1.jsx)("div", { style: {
|
|
83
|
+
backgroundColor: "#fed7d7",
|
|
84
|
+
padding: "10px",
|
|
85
|
+
borderRadius: "4px",
|
|
86
|
+
whiteSpace: "pre-wrap",
|
|
87
|
+
overflow: "auto",
|
|
88
|
+
maxHeight: "200px",
|
|
89
|
+
}, children: errorInfo.componentStack })] })), (0, jsx_runtime_1.jsx)("button", { type: "button", onClick: () => this.setState({ hasError: false, error: null, errorInfo: null }), style: {
|
|
90
|
+
marginTop: "15px",
|
|
91
|
+
padding: "8px 16px",
|
|
92
|
+
backgroundColor: "#c53030",
|
|
93
|
+
color: "white",
|
|
94
|
+
border: "none",
|
|
95
|
+
borderRadius: "4px",
|
|
96
|
+
cursor: "pointer",
|
|
97
|
+
}, children: "Try Again" })] }));
|
|
127
98
|
}
|
|
128
99
|
return this.props.children;
|
|
129
100
|
}
|
|
@@ -131,12 +102,21 @@ class UIErrorBoundary extends react_1.Component {
|
|
|
131
102
|
const UIRouter = (props) => {
|
|
132
103
|
let matchingRoute;
|
|
133
104
|
const allRoutes = _window.getPeersUIRoutes();
|
|
134
|
-
const filteredRoutes = allRoutes.filter(r => {
|
|
135
|
-
if (props.uiEditMode &&
|
|
105
|
+
const filteredRoutes = allRoutes.filter((r) => {
|
|
106
|
+
if (props.uiEditMode &&
|
|
107
|
+
props.uiEditMode !== "*" &&
|
|
108
|
+
r.uiEditMode !== "*" &&
|
|
109
|
+
r.uiEditMode !== props.uiEditMode)
|
|
136
110
|
return false;
|
|
137
|
-
if (props.uiCategory &&
|
|
111
|
+
if (props.uiCategory &&
|
|
112
|
+
props.uiCategory !== "*" &&
|
|
113
|
+
r.uiCategory !== "*" &&
|
|
114
|
+
r.uiCategory !== props.uiCategory)
|
|
138
115
|
return false;
|
|
139
|
-
if (props.uiSubcategory &&
|
|
116
|
+
if (props.uiSubcategory &&
|
|
117
|
+
props.uiSubcategory !== "*" &&
|
|
118
|
+
r.uiSubcategory !== "*" &&
|
|
119
|
+
r.uiSubcategory !== props.uiSubcategory)
|
|
140
120
|
return false;
|
|
141
121
|
return true;
|
|
142
122
|
});
|
|
@@ -149,7 +129,7 @@ const UIRouter = (props) => {
|
|
|
149
129
|
// <todo> test this
|
|
150
130
|
if (route.path) {
|
|
151
131
|
// since `isMatch` can already be used to match the path, this might be overkill
|
|
152
|
-
// but if you just need a simple regex match this makes it nice instead of having to declare a whole function
|
|
132
|
+
// but if you just need a simple regex match this makes it nice instead of having to declare a whole function
|
|
153
133
|
const match = route.path.match(/^\/(.+)\/([gimsuy]{0,6})$/);
|
|
154
134
|
if (match) {
|
|
155
135
|
const [, pattern, flags] = match;
|
|
@@ -194,39 +174,21 @@ const UILoader = (args) => {
|
|
|
194
174
|
if (peersUI?.content) {
|
|
195
175
|
const parseResult = peersUI.propsSchema.safeParse(props);
|
|
196
176
|
if (!parseResult.success) {
|
|
197
|
-
console.error(
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
peersUI.peersUIId,
|
|
204
|
-
" ",
|
|
205
|
-
react_1.default.createElement("br", null),
|
|
206
|
-
"Component name: ",
|
|
207
|
-
peersUI.content?.name,
|
|
208
|
-
" ",
|
|
209
|
-
react_1.default.createElement("br", null),
|
|
210
|
-
"Props did not match schema ",
|
|
211
|
-
react_1.default.createElement("br", null),
|
|
212
|
-
"Errors: ",
|
|
213
|
-
JSON.stringify(parseResult.error, null, 2),
|
|
214
|
-
" ",
|
|
215
|
-
react_1.default.createElement("br", null),
|
|
216
|
-
react_1.default.createElement("br", null),
|
|
217
|
-
"Props ",
|
|
218
|
-
JSON.stringify((0, peers_sdk_1.toJSON)(props), null, 2),
|
|
219
|
-
react_1.default.createElement("br", null))));
|
|
177
|
+
console.error("props did not match schema", {
|
|
178
|
+
props,
|
|
179
|
+
schema: peersUI.propsSchema,
|
|
180
|
+
errors: parseResult.error,
|
|
181
|
+
});
|
|
182
|
+
return ((0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsxs)("pre", { children: ["Peers UI could not be loaded ", (0, jsx_runtime_1.jsx)("br", {}), "peersUIId: ", peersUI.peersUIId, " ", (0, jsx_runtime_1.jsx)("br", {}), "Component name: ", peersUI.content?.name, " ", (0, jsx_runtime_1.jsx)("br", {}), "Props did not match schema ", (0, jsx_runtime_1.jsx)("br", {}), "Errors: ", JSON.stringify(parseResult.error, null, 2), " ", (0, jsx_runtime_1.jsx)("br", {}), (0, jsx_runtime_1.jsx)("br", {}), "Props ", JSON.stringify((0, peers_sdk_1.toJSON)(props), null, 2), (0, jsx_runtime_1.jsx)("br", {})] }) }));
|
|
220
183
|
}
|
|
221
184
|
const Component = peersUI.content;
|
|
222
|
-
return (
|
|
223
|
-
react_1.default.createElement(Component, { ...args.props })));
|
|
185
|
+
return ((0, jsx_runtime_1.jsx)(UIErrorBoundary, { peersUIId: peersUIId, componentName: peersUI.content?.name, children: (0, jsx_runtime_1.jsx)(Component, { ...args.props }) }));
|
|
224
186
|
}
|
|
225
|
-
return
|
|
187
|
+
return (0, jsx_runtime_1.jsx)(UIAsyncLoader, { ...args });
|
|
226
188
|
};
|
|
227
189
|
const uiLoadingPromises = {};
|
|
228
190
|
// Check if we're running in a React Native WebView (has injectUIBundle available)
|
|
229
|
-
const isReactNativeWebView = typeof window.ReactNativeWebView !==
|
|
191
|
+
const isReactNativeWebView = typeof window.ReactNativeWebView !== "undefined";
|
|
230
192
|
async function resolveUiBundleFileId(pkg) {
|
|
231
193
|
if (!pkg.activePackageVersionId)
|
|
232
194
|
return undefined;
|
|
@@ -243,54 +205,50 @@ function loadUIBundle(pkg, forceRefresh) {
|
|
|
243
205
|
if (!importPromise || forceRefresh) {
|
|
244
206
|
const sTime = Date.now();
|
|
245
207
|
console.log(`loading ui bundle for ${pkg.name}`);
|
|
246
|
-
importPromise =
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
peersUIs[peersUIId] = _window.__peersUIs[peersUIId];
|
|
261
|
-
});
|
|
262
|
-
resolveLoad();
|
|
263
|
-
}
|
|
264
|
-
};
|
|
265
|
-
_window.__peersUIBundleError = (errorFileId, errorMsg) => {
|
|
266
|
-
if (errorFileId === uiBundleFileId) {
|
|
267
|
-
rejectLoad(new Error(errorMsg));
|
|
268
|
-
}
|
|
269
|
-
};
|
|
270
|
-
});
|
|
271
|
-
await peers_sdk_1.rpcServerCalls.injectUIBundle(uiBundleFileId);
|
|
272
|
-
await loadPromise;
|
|
273
|
-
console.log(`finished loading ui bundle for ${pkg.name}: ${(Date.now() - sTime).toFixed(0)}ms`);
|
|
274
|
-
}
|
|
275
|
-
else {
|
|
276
|
-
let bundleCode = await peers_sdk_1.rpcServerCalls.getFileContents(uiBundleFileId);
|
|
277
|
-
if (bundleCode) {
|
|
278
|
-
const exportUIs = (peerUIs) => {
|
|
279
|
-
peerUIs?.uis?.forEach(ui => {
|
|
280
|
-
peersUIs[ui.peersUIId] = ui;
|
|
208
|
+
importPromise = (async () => {
|
|
209
|
+
const uiBundleFileId = await resolveUiBundleFileId(pkg);
|
|
210
|
+
if (!uiBundleFileId) {
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
if (isReactNativeWebView && peers_sdk_1.rpcServerCalls.injectUIBundle) {
|
|
214
|
+
const _w = window;
|
|
215
|
+
_w.__peersUIs = _w.__peersUIs || {};
|
|
216
|
+
const loadPromise = new Promise((resolveLoad, rejectLoad) => {
|
|
217
|
+
_w.__peersUIBundleLoaded = (loadedFileId) => {
|
|
218
|
+
if (loadedFileId === uiBundleFileId) {
|
|
219
|
+
const store = _w.__peersUIs || {};
|
|
220
|
+
Object.keys(store).forEach((peersUIId) => {
|
|
221
|
+
peersUIs[peersUIId] = store[peersUIId];
|
|
281
222
|
});
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
223
|
+
resolveLoad();
|
|
224
|
+
}
|
|
225
|
+
};
|
|
226
|
+
_w.__peersUIBundleError = (errorFileId, errorMsg) => {
|
|
227
|
+
if (errorFileId === uiBundleFileId) {
|
|
228
|
+
rejectLoad(new Error(errorMsg));
|
|
229
|
+
}
|
|
230
|
+
};
|
|
231
|
+
});
|
|
232
|
+
await peers_sdk_1.rpcServerCalls.injectUIBundle(uiBundleFileId);
|
|
233
|
+
await loadPromise;
|
|
234
|
+
console.log(`finished loading ui bundle for ${pkg.name}: ${(Date.now() - sTime).toFixed(0)}ms`);
|
|
289
235
|
}
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
236
|
+
else {
|
|
237
|
+
const bundleCode = await peers_sdk_1.rpcServerCalls.getFileContents(uiBundleFileId);
|
|
238
|
+
if (bundleCode) {
|
|
239
|
+
const exportUIs = (peerUIs) => {
|
|
240
|
+
peerUIs?.uis?.forEach((ui) => {
|
|
241
|
+
peersUIs[ui.peersUIId] = ui;
|
|
242
|
+
});
|
|
243
|
+
};
|
|
244
|
+
const bundleFunction = new Function("exportUIs", bundleCode);
|
|
245
|
+
await bundleFunction(exportUIs);
|
|
246
|
+
}
|
|
247
|
+
console.log(`finished loading ui bundle for ${pkg.name}: ${(Date.now() - sTime).toFixed(0)}ms, ${bundleCode ? (bundleCode.length / 1000).toFixed(0) : "0"} KB`);
|
|
293
248
|
}
|
|
249
|
+
})().catch((err) => {
|
|
250
|
+
console.error(`Error while loading ui module for ${pkg.name}`, err);
|
|
251
|
+
throw err;
|
|
294
252
|
});
|
|
295
253
|
uiLoadingPromises[pkg.packageId] = importPromise;
|
|
296
254
|
}
|
|
@@ -301,88 +259,60 @@ const UIAsyncLoader = (props) => {
|
|
|
301
259
|
const [loaded, setLoaded] = react_1.default.useState(false);
|
|
302
260
|
const [loadError, setLoadError] = react_1.default.useState(null);
|
|
303
261
|
const allRoutes = _window.getPeersUIRoutes();
|
|
304
|
-
const uiPackageId = allRoutes.find(r => r.peersUIId === peersUIId)?.packageId;
|
|
262
|
+
const uiPackageId = allRoutes.find((r) => r.peersUIId === peersUIId)?.packageId;
|
|
305
263
|
(0, hooks_1.useObservable)(routes_loader_1.allPackages);
|
|
306
|
-
const pkg = (0, routes_loader_1.allPackages)().find(p => p.packageId === uiPackageId);
|
|
264
|
+
const pkg = (0, routes_loader_1.allPackages)().find((p) => p.packageId === uiPackageId);
|
|
307
265
|
(0, react_1.useEffect)(() => {
|
|
308
266
|
if (!pkg)
|
|
309
267
|
return;
|
|
268
|
+
const pkgRef = pkg;
|
|
310
269
|
setLoadError(null);
|
|
311
|
-
loadUIBundle(
|
|
270
|
+
loadUIBundle(pkgRef)
|
|
312
271
|
.then(() => setLoaded(true))
|
|
313
272
|
.catch((error) => {
|
|
314
|
-
console.error(`Failed to load UI bundle for package ${
|
|
273
|
+
console.error(`Failed to load UI bundle for package ${pkgRef.name}:`, error);
|
|
315
274
|
setLoadError(error);
|
|
316
275
|
});
|
|
317
|
-
}, [pkg?.packageId]);
|
|
276
|
+
}, [pkg?.packageId, pkg?.name, pkg]);
|
|
318
277
|
if (!pkg) {
|
|
319
|
-
return
|
|
320
|
-
"Could not find package that owns peersUIId ",
|
|
321
|
-
peersUIId);
|
|
278
|
+
return (0, jsx_runtime_1.jsxs)("div", { children: ["Could not find package that owns peersUIId ", peersUIId] });
|
|
322
279
|
}
|
|
323
280
|
if (loadError) {
|
|
324
|
-
return (
|
|
325
|
-
padding:
|
|
326
|
-
border:
|
|
327
|
-
borderRadius:
|
|
328
|
-
backgroundColor:
|
|
329
|
-
color:
|
|
330
|
-
fontFamily:
|
|
331
|
-
margin:
|
|
332
|
-
} },
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
backgroundColor:
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
} },
|
|
357
|
-
react_1.default.createElement("strong", null, "Error:"),
|
|
358
|
-
" ",
|
|
359
|
-
loadError.message || 'Unknown error',
|
|
360
|
-
loadError.stack && (react_1.default.createElement(react_1.default.Fragment, null,
|
|
361
|
-
react_1.default.createElement("br", null),
|
|
362
|
-
react_1.default.createElement("br", null),
|
|
363
|
-
react_1.default.createElement("strong", null, "Stack Trace:"),
|
|
364
|
-
react_1.default.createElement("br", null),
|
|
365
|
-
loadError.stack)))),
|
|
366
|
-
react_1.default.createElement("button", { onClick: () => {
|
|
367
|
-
setLoadError(null);
|
|
368
|
-
setLoaded(false);
|
|
369
|
-
if (pkg) {
|
|
370
|
-
loadUIBundle(pkg, true)
|
|
371
|
-
.then(() => setLoaded(true))
|
|
372
|
-
.catch(setLoadError);
|
|
373
|
-
}
|
|
374
|
-
}, style: {
|
|
375
|
-
marginTop: '15px',
|
|
376
|
-
padding: '8px 16px',
|
|
377
|
-
backgroundColor: '#c53030',
|
|
378
|
-
color: 'white',
|
|
379
|
-
border: 'none',
|
|
380
|
-
borderRadius: '4px',
|
|
381
|
-
cursor: 'pointer'
|
|
382
|
-
} }, "Retry Loading")));
|
|
281
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: {
|
|
282
|
+
padding: "20px",
|
|
283
|
+
border: "2px solid #ff6b6b",
|
|
284
|
+
borderRadius: "8px",
|
|
285
|
+
backgroundColor: "#fff5f5",
|
|
286
|
+
color: "#721c24",
|
|
287
|
+
fontFamily: "monospace",
|
|
288
|
+
margin: "10px 0",
|
|
289
|
+
}, children: [(0, jsx_runtime_1.jsx)("h3", { style: { color: "#c53030", marginTop: 0 }, children: "Bundle Loading Error" }), (0, jsx_runtime_1.jsxs)("div", { style: { marginBottom: "15px" }, children: [(0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("strong", { children: "Peers UI ID:" }), " ", peersUIId] }), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("strong", { children: "Package:" }), " ", pkg.name] }), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("strong", { children: "Package ID:" }), " ", pkg.packageId] })] }), (0, jsx_runtime_1.jsxs)("details", { style: { marginBottom: "15px" }, children: [(0, jsx_runtime_1.jsx)("summary", { style: { cursor: "pointer", fontWeight: "bold", marginBottom: "10px" }, children: "Error Details" }), (0, jsx_runtime_1.jsxs)("div", { style: {
|
|
290
|
+
backgroundColor: "#fed7d7",
|
|
291
|
+
padding: "10px",
|
|
292
|
+
borderRadius: "4px",
|
|
293
|
+
whiteSpace: "pre-wrap",
|
|
294
|
+
overflow: "auto",
|
|
295
|
+
maxHeight: "200px",
|
|
296
|
+
}, children: [(0, jsx_runtime_1.jsx)("strong", { children: "Error:" }), " ", loadError.message || "Unknown error", loadError.stack && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("br", {}), (0, jsx_runtime_1.jsx)("br", {}), (0, jsx_runtime_1.jsx)("strong", { children: "Stack Trace:" }), (0, jsx_runtime_1.jsx)("br", {}), loadError.stack] }))] })] }), (0, jsx_runtime_1.jsx)("button", { type: "button", onClick: () => {
|
|
297
|
+
setLoadError(null);
|
|
298
|
+
setLoaded(false);
|
|
299
|
+
if (pkg) {
|
|
300
|
+
loadUIBundle(pkg, true)
|
|
301
|
+
.then(() => setLoaded(true))
|
|
302
|
+
.catch(setLoadError);
|
|
303
|
+
}
|
|
304
|
+
}, style: {
|
|
305
|
+
marginTop: "15px",
|
|
306
|
+
padding: "8px 16px",
|
|
307
|
+
backgroundColor: "#c53030",
|
|
308
|
+
color: "white",
|
|
309
|
+
border: "none",
|
|
310
|
+
borderRadius: "4px",
|
|
311
|
+
cursor: "pointer",
|
|
312
|
+
}, children: "Retry Loading" })] }));
|
|
383
313
|
}
|
|
384
314
|
if (!loaded) {
|
|
385
|
-
return (
|
|
315
|
+
return (0, jsx_runtime_1.jsx)(loading_indicator_1.LoadingIndicator, {});
|
|
386
316
|
}
|
|
387
317
|
const peersUI = peersUIs[peersUIId];
|
|
388
318
|
if (peersUI?.content) {
|
|
@@ -390,98 +320,72 @@ const UIAsyncLoader = (props) => {
|
|
|
390
320
|
try {
|
|
391
321
|
peersUI.propsSchema.parse(_props);
|
|
392
322
|
const Component = peersUI.content;
|
|
393
|
-
return (
|
|
394
|
-
react_1.default.createElement(Component, { ..._props })));
|
|
323
|
+
return ((0, jsx_runtime_1.jsx)(UIErrorBoundary, { peersUIId: peersUIId, packageName: pkg.name, componentName: peersUI.content?.name, children: (0, jsx_runtime_1.jsx)(Component, { ..._props }) }));
|
|
395
324
|
}
|
|
396
325
|
catch (parseError) {
|
|
397
|
-
return (
|
|
398
|
-
padding:
|
|
399
|
-
border:
|
|
400
|
-
borderRadius:
|
|
401
|
-
backgroundColor:
|
|
402
|
-
color:
|
|
403
|
-
fontFamily:
|
|
404
|
-
margin:
|
|
405
|
-
} },
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
" ",
|
|
415
|
-
pkg.name),
|
|
416
|
-
react_1.default.createElement("div", null,
|
|
417
|
-
react_1.default.createElement("strong", null, "Component:"),
|
|
418
|
-
" ",
|
|
419
|
-
peersUI.content?.name)),
|
|
420
|
-
react_1.default.createElement("div", { style: {
|
|
421
|
-
backgroundColor: '#fed7d7',
|
|
422
|
-
padding: '10px',
|
|
423
|
-
borderRadius: '4px',
|
|
424
|
-
whiteSpace: 'pre-wrap',
|
|
425
|
-
overflow: 'auto',
|
|
426
|
-
maxHeight: '200px',
|
|
427
|
-
marginBottom: '15px'
|
|
428
|
-
} },
|
|
429
|
-
react_1.default.createElement("strong", null, "Error:"),
|
|
430
|
-
" Props did not match schema",
|
|
431
|
-
react_1.default.createElement("br", null),
|
|
432
|
-
react_1.default.createElement("strong", null, "Validation Error:"),
|
|
433
|
-
" ",
|
|
434
|
-
JSON.stringify(parseError, null, 2),
|
|
435
|
-
react_1.default.createElement("br", null),
|
|
436
|
-
react_1.default.createElement("br", null),
|
|
437
|
-
react_1.default.createElement("strong", null, "Props:"),
|
|
438
|
-
" ",
|
|
439
|
-
JSON.stringify((0, peers_sdk_1.toJSON)(_props), null, 2))));
|
|
326
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: {
|
|
327
|
+
padding: "20px",
|
|
328
|
+
border: "2px solid #ff6b6b",
|
|
329
|
+
borderRadius: "8px",
|
|
330
|
+
backgroundColor: "#fff5f5",
|
|
331
|
+
color: "#721c24",
|
|
332
|
+
fontFamily: "monospace",
|
|
333
|
+
margin: "10px 0",
|
|
334
|
+
}, children: [(0, jsx_runtime_1.jsx)("h3", { style: { color: "#c53030", marginTop: 0 }, children: "Props Validation Error" }), (0, jsx_runtime_1.jsxs)("div", { style: { marginBottom: "15px" }, children: [(0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("strong", { children: "Peers UI ID:" }), " ", peersUIId] }), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("strong", { children: "Package:" }), " ", pkg.name] }), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("strong", { children: "Component:" }), " ", peersUI.content?.name] })] }), (0, jsx_runtime_1.jsxs)("div", { style: {
|
|
335
|
+
backgroundColor: "#fed7d7",
|
|
336
|
+
padding: "10px",
|
|
337
|
+
borderRadius: "4px",
|
|
338
|
+
whiteSpace: "pre-wrap",
|
|
339
|
+
overflow: "auto",
|
|
340
|
+
maxHeight: "200px",
|
|
341
|
+
marginBottom: "15px",
|
|
342
|
+
}, children: [(0, jsx_runtime_1.jsx)("strong", { children: "Error:" }), " Props did not match schema", (0, jsx_runtime_1.jsx)("br", {}), (0, jsx_runtime_1.jsx)("strong", { children: "Validation Error:" }), " ", JSON.stringify(parseError, null, 2), (0, jsx_runtime_1.jsx)("br", {}), (0, jsx_runtime_1.jsx)("br", {}), (0, jsx_runtime_1.jsx)("strong", { children: "Props:" }), " ", JSON.stringify((0, peers_sdk_1.toJSON)(_props), null, 2)] })] }));
|
|
440
343
|
}
|
|
441
344
|
}
|
|
442
345
|
else {
|
|
443
|
-
return
|
|
346
|
+
return (0, jsx_runtime_1.jsx)("div", { children: "Component not found" });
|
|
444
347
|
}
|
|
445
348
|
};
|
|
446
349
|
let _window;
|
|
447
|
-
if (typeof window !==
|
|
350
|
+
if (typeof window !== "undefined") {
|
|
448
351
|
_window = window;
|
|
449
352
|
if (!_window.registerPeersUIRoute) {
|
|
450
353
|
let uiRoutes = [];
|
|
451
|
-
Object.defineProperty(window,
|
|
354
|
+
Object.defineProperty(window, "registerPeersUIRoute", {
|
|
452
355
|
value: (route) => {
|
|
453
|
-
uiRoutes = uiRoutes.filter(r => !(r.peersUIId === route.peersUIId));
|
|
356
|
+
uiRoutes = uiRoutes.filter((r) => !(r.peersUIId === route.peersUIId));
|
|
454
357
|
uiRoutes.push(route);
|
|
455
|
-
uiRoutes = (0, lodash_1.orderBy)(uiRoutes, r => r.priority ?? 0,
|
|
358
|
+
uiRoutes = (0, lodash_1.orderBy)(uiRoutes, (r) => r.priority ?? 0, "desc");
|
|
456
359
|
},
|
|
457
360
|
writable: false,
|
|
458
|
-
configurable: false
|
|
361
|
+
configurable: false,
|
|
459
362
|
});
|
|
460
|
-
Object.defineProperty(window,
|
|
363
|
+
Object.defineProperty(window, "getPeersUIRoutes", {
|
|
461
364
|
value: () => {
|
|
462
365
|
return [...uiRoutes];
|
|
463
366
|
},
|
|
464
367
|
writable: false,
|
|
465
|
-
configurable: false
|
|
368
|
+
configurable: false,
|
|
466
369
|
});
|
|
467
|
-
Object.defineProperty(window,
|
|
370
|
+
Object.defineProperty(window, "UIRouter", {
|
|
468
371
|
value: exports.UIRouter,
|
|
469
372
|
writable: false,
|
|
470
|
-
configurable: false
|
|
373
|
+
configurable: false,
|
|
471
374
|
});
|
|
472
|
-
Object.defineProperty(window,
|
|
375
|
+
Object.defineProperty(window, "UILoader", {
|
|
473
376
|
value: UILoader,
|
|
474
377
|
writable: false,
|
|
475
|
-
configurable: false
|
|
378
|
+
configurable: false,
|
|
476
379
|
});
|
|
477
380
|
}
|
|
478
381
|
}
|
|
479
|
-
exports.peersSystemPackageId =
|
|
382
|
+
exports.peersSystemPackageId = "000peers0system000package";
|
|
480
383
|
/**
|
|
481
384
|
* This is meant to make it easy to register components that are internal to peers
|
|
482
385
|
*/
|
|
483
386
|
async function registerInternalPeersUI(props) {
|
|
484
|
-
|
|
387
|
+
const routeWin = window;
|
|
388
|
+
while (!routeWin.registerPeersUIRoute) {
|
|
485
389
|
console.log("Waiting for registerPeersUIRoute to be defined on the window object");
|
|
486
390
|
await new Promise((resolve) => setTimeout(resolve, 20));
|
|
487
391
|
}
|
|
@@ -493,7 +397,7 @@ async function registerInternalPeersUI(props) {
|
|
|
493
397
|
};
|
|
494
398
|
peersUIs[peersUIId] = peersUI;
|
|
495
399
|
if (props.routes?.length) {
|
|
496
|
-
props.routes.forEach(route => {
|
|
400
|
+
props.routes.forEach((route) => {
|
|
497
401
|
_window.registerPeersUIRoute({
|
|
498
402
|
packageId: exports.peersSystemPackageId,
|
|
499
403
|
peersUIId,
|
|
@@ -511,7 +415,7 @@ const reloadPackage = (0, peers_sdk_1.debounceByArgs)(async (packageId) => {
|
|
|
511
415
|
(0, globals_1.packageReloaded)(Date.now());
|
|
512
416
|
}
|
|
513
417
|
}, 200);
|
|
514
|
-
(0, peers_sdk_1.getUserContext)().then(
|
|
418
|
+
(0, peers_sdk_1.getUserContext)().then((_userContext) => {
|
|
515
419
|
(0, peers_sdk_1.Packages)().dataChanged.subscribe(async (evt) => {
|
|
516
420
|
const pkg = evt.dataObject;
|
|
517
421
|
const loadingPromise = uiLoadingPromises[pkg.packageId];
|