@peers-app/peers-ui 0.14.0 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/publish.yml +8 -5
- package/babel.config.js +4 -4
- package/biome.json +191 -0
- package/dist/command-palette/command-palette-ui.d.ts +1 -2
- package/dist/command-palette/command-palette-ui.js +175 -244
- package/dist/command-palette/command-palette.js +65 -64
- package/dist/components/chat-overlay.d.ts +2 -2
- package/dist/components/chat-overlay.js +160 -217
- package/dist/components/checkbox.d.ts +5 -4
- package/dist/components/checkbox.js +4 -7
- package/dist/components/group-switcher.d.ts +1 -2
- package/dist/components/group-switcher.js +119 -159
- package/dist/components/input-date.d.ts +3 -3
- package/dist/components/input-date.js +6 -6
- package/dist/components/input-number.d.ts +7 -6
- package/dist/components/input-number.js +25 -20
- package/dist/components/input.d.ts +5 -4
- package/dist/components/input.js +4 -7
- package/dist/components/inverse-lazy-list.d.ts +3 -3
- package/dist/components/inverse-lazy-list.js +13 -47
- package/dist/components/io-schema-values.d.ts +5 -6
- package/dist/components/io-schema-values.js +28 -65
- package/dist/components/io-schema.d.ts +4 -5
- package/dist/components/io-schema.js +42 -79
- package/dist/components/lazy-list.d.ts +3 -3
- package/dist/components/lazy-list.js +38 -58
- package/dist/components/list-screen.d.ts +3 -8
- package/dist/components/list-screen.js +28 -23
- package/dist/components/loading-indicator.d.ts +1 -2
- package/dist/components/loading-indicator.js +2 -6
- package/dist/components/markdown-editor/autolink-plugin.js +5 -8
- package/dist/components/markdown-editor/editor-inline.d.ts +2 -3
- package/dist/components/markdown-editor/editor-inline.js +2 -6
- package/dist/components/markdown-editor/editor.d.ts +6 -6
- package/dist/components/markdown-editor/editor.js +9 -19
- package/dist/components/markdown-editor/markdown-plugin.d.ts +1 -1
- package/dist/components/markdown-editor/markdown-plugin.js +20 -21
- package/dist/components/markdown-editor/mention-node.d.ts +2 -2
- package/dist/components/markdown-editor/mention-node.js +24 -24
- package/dist/components/markdown-editor/mentions-plugin.d.ts +2 -2
- package/dist/components/markdown-editor/mentions-plugin.js +61 -62
- package/dist/components/markdown-editor/theme.js +28 -28
- package/dist/components/markdown-editor/toolbar.d.ts +2 -3
- package/dist/components/markdown-editor/toolbar.js +32 -49
- package/dist/components/markdown-with-mentions.d.ts +1 -1
- package/dist/components/markdown-with-mentions.js +43 -43
- package/dist/components/message-logs/message-logs.d.ts +1 -2
- package/dist/components/message-logs/message-logs.js +91 -116
- package/dist/components/messages/avatar.d.ts +3 -4
- package/dist/components/messages/avatar.js +37 -46
- package/dist/components/messages/channel-message-list.d.ts +5 -6
- package/dist/components/messages/channel-message-list.js +34 -34
- package/dist/components/messages/channel-view.d.ts +1 -2
- package/dist/components/messages/channel-view.js +23 -57
- package/dist/components/messages/message-compose.d.ts +3 -4
- package/dist/components/messages/message-compose.js +27 -38
- package/dist/components/messages/message-display.d.ts +2 -3
- package/dist/components/messages/message-display.js +42 -95
- package/dist/components/messages/thread-message-list.d.ts +4 -5
- package/dist/components/messages/thread-message-list.js +29 -29
- package/dist/components/router.d.ts +1 -2
- package/dist/components/router.js +58 -66
- package/dist/components/save-button.d.ts +3 -3
- package/dist/components/save-button.js +23 -33
- package/dist/components/sortable-list.d.ts +11 -12
- package/dist/components/sortable-list.js +42 -22
- package/dist/components/tabs.d.ts +3 -3
- package/dist/components/tabs.js +16 -47
- package/dist/components/tooltip.d.ts +4 -4
- package/dist/components/tooltip.js +4 -9
- package/dist/components/trust-level-badge.d.ts +2 -3
- package/dist/components/trust-level-badge.js +16 -16
- package/dist/components/trust-level-dropdown.d.ts +3 -4
- package/dist/components/trust-level-dropdown.js +32 -55
- package/dist/components/typeahead.d.ts +3 -3
- package/dist/components/typeahead.js +48 -89
- package/dist/components/voice-indicator.d.ts +2 -2
- package/dist/components/voice-indicator.js +93 -106
- package/dist/components/voice-subscribe-events.d.ts +32 -0
- package/dist/components/voice-subscribe-events.js +2 -0
- package/dist/globals.d.ts +3 -5
- package/dist/globals.js +22 -33
- package/dist/hooks.d.ts +5 -5
- package/dist/hooks.js +22 -12
- package/dist/hooks.test.js +129 -145
- package/dist/index.d.ts +9 -8
- package/dist/index.js +13 -12
- package/dist/mention-configs.d.ts +2 -2
- package/dist/mention-configs.js +55 -42
- package/dist/screens/assistants/assistant-config.d.ts +2 -3
- package/dist/screens/assistants/assistant-config.js +9 -22
- package/dist/screens/assistants/assistant-details.d.ts +1 -2
- package/dist/screens/assistants/assistant-details.js +13 -28
- package/dist/screens/assistants/assistant-info.d.ts +2 -3
- package/dist/screens/assistants/assistant-info.js +3 -17
- package/dist/screens/assistants/assistant-list.d.ts +1 -2
- package/dist/screens/assistants/assistant-list.js +15 -56
- package/dist/screens/assistants/assistant-tools.d.ts +2 -3
- package/dist/screens/assistants/assistant-tools.js +10 -24
- package/dist/screens/console-logs/console-logs-list.d.ts +1 -2
- package/dist/screens/console-logs/console-logs-list.js +130 -134
- package/dist/screens/console-logs/log-display.d.ts +2 -3
- package/dist/screens/console-logs/log-display.js +40 -42
- package/dist/screens/console-logs/log-filters.d.ts +1 -2
- package/dist/screens/console-logs/log-filters.js +2 -24
- package/dist/screens/console-logs/mobile-log-card.d.ts +2 -3
- package/dist/screens/console-logs/mobile-log-card.js +64 -67
- package/dist/screens/console-logs/resizable-table-header.d.ts +1 -2
- package/dist/screens/console-logs/resizable-table-header.js +31 -67
- package/dist/screens/contacts/contact-details.d.ts +1 -2
- package/dist/screens/contacts/contact-details.js +16 -46
- package/dist/screens/contacts/contact-list.d.ts +1 -2
- package/dist/screens/contacts/contact-list.js +44 -103
- package/dist/screens/contacts/index.d.ts +4 -4
- package/dist/screens/contacts/index.js +1 -1
- package/dist/screens/contacts/user-connect.d.ts +1 -2
- package/dist/screens/contacts/user-connect.js +85 -186
- package/dist/screens/data-explorer/data-explorer.d.ts +1 -2
- package/dist/screens/data-explorer/data-explorer.js +61 -181
- package/dist/screens/data-explorer/index.d.ts +2 -2
- package/dist/screens/data-explorer/query-executor.d.ts +1 -2
- package/dist/screens/data-explorer/query-executor.js +56 -166
- package/dist/screens/groups/group-details.d.ts +1 -2
- package/dist/screens/groups/group-details.js +27 -122
- package/dist/screens/groups/group-invite-listener.d.ts +2 -3
- package/dist/screens/groups/group-invite-listener.js +8 -104
- package/dist/screens/groups/group-list.d.ts +1 -2
- package/dist/screens/groups/group-list.js +56 -133
- package/dist/screens/groups/group-members.d.ts +2 -3
- package/dist/screens/groups/group-members.js +62 -132
- package/dist/screens/groups/index.d.ts +4 -4
- package/dist/screens/groups/index.js +1 -1
- package/dist/screens/join-group/index.d.ts +2 -2
- package/dist/screens/join-group/join-group.d.ts +1 -2
- package/dist/screens/join-group/join-group.js +9 -109
- package/dist/screens/network-viewer/connection-troubleshooter.d.ts +2 -3
- package/dist/screens/network-viewer/connection-troubleshooter.js +89 -193
- package/dist/screens/network-viewer/cpu-usage-graph.d.ts +1 -2
- package/dist/screens/network-viewer/cpu-usage-graph.js +60 -99
- package/dist/screens/network-viewer/device-details-modal.d.ts +1 -2
- package/dist/screens/network-viewer/device-details-modal.js +25 -177
- package/dist/screens/network-viewer/group-details-modal.d.ts +1 -2
- package/dist/screens/network-viewer/group-details-modal.js +31 -142
- package/dist/screens/network-viewer/index.d.ts +4 -4
- package/dist/screens/network-viewer/index.js +3 -3
- package/dist/screens/network-viewer/network-viewer-ipc.d.ts +22 -0
- package/dist/screens/network-viewer/network-viewer-ipc.js +6 -0
- package/dist/screens/network-viewer/network-viewer.d.ts +1 -2
- package/dist/screens/network-viewer/network-viewer.js +91 -296
- package/dist/screens/network-viewer/usage-graph.d.ts +1 -2
- package/dist/screens/network-viewer/usage-graph.js +78 -110
- package/dist/screens/packages/package-details.d.ts +1 -2
- package/dist/screens/packages/package-details.js +35 -41
- package/dist/screens/packages/package-info.d.ts +2 -2
- package/dist/screens/packages/package-info.js +33 -86
- package/dist/screens/packages/package-list.d.ts +1 -2
- package/dist/screens/packages/package-list.js +42 -106
- package/dist/screens/packages/package-new-local.d.ts +1 -2
- package/dist/screens/packages/package-new-local.js +13 -19
- package/dist/screens/packages/package-versions.d.ts +2 -3
- package/dist/screens/packages/package-versions.js +29 -96
- package/dist/screens/peer-types/peer-type-details.d.ts +3 -4
- package/dist/screens/peer-types/peer-type-details.js +26 -78
- package/dist/screens/peer-types/peer-type-list.d.ts +1 -2
- package/dist/screens/peer-types/peer-type-list.js +13 -24
- package/dist/screens/search/global-search.d.ts +1 -2
- package/dist/screens/search/global-search.js +104 -182
- package/dist/screens/settings/color-mode-dropdown.d.ts +3 -4
- package/dist/screens/settings/color-mode-dropdown.js +18 -37
- package/dist/screens/settings/settings-page.d.ts +1 -1
- package/dist/screens/settings/settings-page.js +86 -213
- package/dist/screens/settings/voice-settings-agent.d.ts +1 -1
- package/dist/screens/settings/voice-settings-agent.js +7 -44
- package/dist/screens/settings/voice-settings-api-keys.d.ts +2 -2
- package/dist/screens/settings/voice-settings-api-keys.js +2 -29
- package/dist/screens/settings/voice-settings-output.d.ts +2 -2
- package/dist/screens/settings/voice-settings-output.js +2 -40
- package/dist/screens/settings/voice-settings-providers.d.ts +2 -2
- package/dist/screens/settings/voice-settings-providers.js +2 -19
- package/dist/screens/settings/voice-settings-types.d.ts +4 -4
- package/dist/screens/settings/voice-settings-types.js +31 -31
- package/dist/screens/settings/voice-settings-wake-word.d.ts +2 -2
- package/dist/screens/settings/voice-settings-wake-word.js +2 -33
- package/dist/screens/settings/voice-settings.d.ts +1 -1
- package/dist/screens/settings/voice-settings.js +35 -112
- package/dist/screens/setup-user.d.ts +1 -2
- package/dist/screens/setup-user.js +38 -116
- package/dist/screens/tools/tool-code.d.ts +2 -3
- package/dist/screens/tools/tool-code.js +9 -13
- package/dist/screens/tools/tool-details.d.ts +1 -2
- package/dist/screens/tools/tool-details.js +26 -39
- package/dist/screens/tools/tool-info.d.ts +2 -3
- package/dist/screens/tools/tool-info.js +9 -48
- package/dist/screens/tools/tool-list.d.ts +1 -2
- package/dist/screens/tools/tool-list.js +33 -65
- package/dist/screens/tools/tool-schema.d.ts +2 -3
- package/dist/screens/tools/tool-schema.js +2 -13
- package/dist/screens/tools/tool-test-details.d.ts +1 -2
- package/dist/screens/tools/tool-test-details.js +12 -28
- package/dist/screens/tools/tool-test-list.d.ts +1 -2
- package/dist/screens/tools/tool-test-list.js +17 -56
- package/dist/screens/variables/variable-details.d.ts +1 -2
- package/dist/screens/variables/variable-details.js +19 -86
- package/dist/screens/variables/variable-list.d.ts +1 -2
- package/dist/screens/variables/variable-list.js +16 -27
- package/dist/screens/welcome-modal.d.ts +1 -2
- package/dist/screens/welcome-modal.js +44 -111
- package/dist/screens/workflows/workflow-details.d.ts +1 -2
- package/dist/screens/workflows/workflow-details.js +17 -31
- package/dist/screens/workflows/workflow-info.d.ts +2 -3
- package/dist/screens/workflows/workflow-info.js +2 -9
- package/dist/screens/workflows/workflow-instructions.d.ts +2 -3
- package/dist/screens/workflows/workflow-instructions.js +23 -55
- package/dist/screens/workflows/workflow-list.d.ts +1 -2
- package/dist/screens/workflows/workflow-list.js +23 -62
- package/dist/setupTests.d.ts +1 -1
- package/dist/setupTests.js +10 -11
- package/dist/system-apps/assistants.app.d.ts +1 -1
- package/dist/system-apps/assistants.app.js +3 -3
- package/dist/system-apps/console-logs.app.d.ts +1 -1
- package/dist/system-apps/console-logs.app.js +3 -3
- package/dist/system-apps/contacts.app.d.ts +1 -1
- package/dist/system-apps/contacts.app.js +4 -4
- package/dist/system-apps/data-explorer.app.d.ts +1 -1
- package/dist/system-apps/data-explorer.app.js +4 -4
- package/dist/system-apps/groups.app.d.ts +1 -1
- package/dist/system-apps/groups.app.js +4 -4
- package/dist/system-apps/index.d.ts +17 -17
- package/dist/system-apps/index.js +52 -52
- package/dist/system-apps/join-group.app.d.ts +1 -1
- package/dist/system-apps/join-group.app.js +4 -4
- package/dist/system-apps/mobile-settings.app.d.ts +1 -1
- package/dist/system-apps/mobile-settings.app.js +3 -3
- package/dist/system-apps/network-viewer.app.d.ts +1 -1
- package/dist/system-apps/network-viewer.app.js +4 -4
- package/dist/system-apps/packages.app.d.ts +1 -1
- package/dist/system-apps/packages.app.js +3 -3
- package/dist/system-apps/search.app.d.ts +1 -1
- package/dist/system-apps/search.app.js +4 -4
- package/dist/system-apps/settings.app.d.ts +1 -1
- package/dist/system-apps/settings.app.js +3 -3
- package/dist/system-apps/threads.app.d.ts +1 -1
- package/dist/system-apps/threads.app.js +3 -3
- package/dist/system-apps/tools.app.d.ts +1 -1
- package/dist/system-apps/tools.app.js +3 -3
- package/dist/system-apps/types.app.d.ts +1 -1
- package/dist/system-apps/types.app.js +3 -3
- package/dist/system-apps/variables.app.d.ts +1 -1
- package/dist/system-apps/variables.app.js +3 -3
- package/dist/system-apps/workflows.app.d.ts +1 -1
- package/dist/system-apps/workflows.app.js +3 -3
- package/dist/tabs-layout/tabs-layout.d.ts +2 -3
- package/dist/tabs-layout/tabs-layout.js +215 -246
- package/dist/tabs-layout/tabs-state.d.ts +2 -2
- package/dist/tabs-layout/tabs-state.js +73 -61
- package/dist/ui-defaults/index.d.ts +2 -2
- package/dist/ui-defaults/list-screen.d.ts +2 -3
- package/dist/ui-defaults/list-screen.js +33 -37
- package/dist/ui-defaults/markdown-field.js +24 -56
- package/dist/ui-router/routes-loader.d.ts +1 -1
- package/dist/ui-router/routes-loader.js +17 -13
- package/dist/ui-router/ui-loader.d.ts +6 -6
- package/dist/ui-router/ui-loader.js +172 -268
- package/dist/utils.js +49 -39
- package/jest.config.js +16 -16
- package/package.json +16 -14
- package/src/command-palette/command-palette-ui.tsx +261 -237
- package/src/command-palette/command-palette.ts +81 -78
- package/src/components/chat-overlay.tsx +366 -261
- package/src/components/checkbox.tsx +15 -12
- package/src/components/group-switcher.tsx +150 -105
- package/src/components/input-date.tsx +17 -16
- package/src/components/input-number.tsx +47 -31
- package/src/components/input.tsx +15 -12
- package/src/components/inverse-lazy-list.tsx +14 -13
- package/src/components/io-schema-values.tsx +51 -69
- package/src/components/io-schema.tsx +94 -69
- package/src/components/lazy-list.tsx +51 -34
- package/src/components/list-screen.tsx +51 -35
- package/src/components/loading-indicator.tsx +2 -4
- package/src/components/markdown-editor/autolink-plugin.tsx +4 -11
- package/src/components/markdown-editor/editor-inline.tsx +3 -4
- package/src/components/markdown-editor/editor.tsx +53 -51
- package/src/components/markdown-editor/markdown-plugin.tsx +48 -40
- package/src/components/markdown-editor/mention-node.ts +39 -38
- package/src/components/markdown-editor/mentions-plugin.tsx +99 -101
- package/src/components/markdown-editor/theme.ts +28 -29
- package/src/components/markdown-editor/toolbar.tsx +53 -47
- package/src/components/markdown-with-mentions.tsx +56 -46
- package/src/components/message-logs/message-logs.tsx +225 -165
- package/src/components/messages/avatar.tsx +70 -52
- package/src/components/messages/channel-message-list.tsx +80 -68
- package/src/components/messages/channel-view.tsx +34 -33
- package/src/components/messages/message-compose.tsx +84 -67
- package/src/components/messages/message-display.tsx +103 -89
- package/src/components/messages/thread-message-list.tsx +53 -44
- package/src/components/router.tsx +42 -43
- package/src/components/save-button.tsx +43 -39
- package/src/components/sortable-list.tsx +77 -49
- package/src/components/tabs.tsx +31 -31
- package/src/components/tooltip.tsx +21 -28
- package/src/components/trust-level-badge.tsx +15 -11
- package/src/components/trust-level-dropdown.tsx +49 -19
- package/src/components/typeahead.tsx +57 -59
- package/src/components/voice-indicator.tsx +158 -141
- package/src/components/voice-subscribe-events.ts +20 -0
- package/src/globals.tsx +42 -40
- package/src/hooks.test.tsx +141 -134
- package/src/hooks.ts +80 -48
- package/src/index.tsx +17 -10
- package/src/mention-configs.ts +122 -68
- package/src/screens/assistants/assistant-config.tsx +28 -18
- package/src/screens/assistants/assistant-details.tsx +35 -36
- package/src/screens/assistants/assistant-info.tsx +16 -11
- package/src/screens/assistants/assistant-list.tsx +37 -34
- package/src/screens/assistants/assistant-tools.tsx +41 -20
- package/src/screens/console-logs/console-logs-list.tsx +173 -140
- package/src/screens/console-logs/log-display.tsx +65 -38
- package/src/screens/console-logs/log-filters.tsx +4 -3
- package/src/screens/console-logs/mobile-log-card.tsx +78 -71
- package/src/screens/console-logs/resizable-table-header.tsx +29 -21
- package/src/screens/contacts/contact-details.tsx +29 -30
- package/src/screens/contacts/contact-list.tsx +71 -60
- package/src/screens/contacts/index.ts +5 -5
- package/src/screens/contacts/user-connect.tsx +177 -171
- package/src/screens/data-explorer/data-explorer.tsx +134 -98
- package/src/screens/data-explorer/index.ts +2 -3
- package/src/screens/data-explorer/query-executor.tsx +90 -80
- package/src/screens/groups/group-details.tsx +120 -101
- package/src/screens/groups/group-invite-listener.tsx +34 -37
- package/src/screens/groups/group-list.tsx +119 -103
- package/src/screens/groups/group-members.tsx +225 -164
- package/src/screens/groups/index.ts +5 -6
- package/src/screens/join-group/index.ts +2 -2
- package/src/screens/join-group/join-group.tsx +41 -39
- package/src/screens/network-viewer/connection-troubleshooter.tsx +145 -104
- package/src/screens/network-viewer/cpu-usage-graph.tsx +39 -43
- package/src/screens/network-viewer/device-details-modal.tsx +46 -59
- package/src/screens/network-viewer/group-details-modal.tsx +68 -49
- package/src/screens/network-viewer/index.ts +4 -5
- package/src/screens/network-viewer/network-viewer-ipc.ts +23 -0
- package/src/screens/network-viewer/network-viewer.tsx +261 -236
- package/src/screens/network-viewer/usage-graph.tsx +57 -49
- package/src/screens/packages/package-details.tsx +43 -35
- package/src/screens/packages/package-info.tsx +107 -66
- package/src/screens/packages/package-list.tsx +175 -98
- package/src/screens/packages/package-new-local.tsx +28 -26
- package/src/screens/packages/package-versions.tsx +102 -77
- package/src/screens/peer-types/peer-type-details.tsx +60 -50
- package/src/screens/peer-types/peer-type-list.tsx +20 -30
- package/src/screens/search/global-search.tsx +153 -137
- package/src/screens/settings/color-mode-dropdown.tsx +52 -35
- package/src/screens/settings/settings-page.tsx +215 -141
- package/src/screens/settings/voice-settings-agent.tsx +13 -12
- package/src/screens/settings/voice-settings-api-keys.tsx +14 -12
- package/src/screens/settings/voice-settings-output.tsx +12 -11
- package/src/screens/settings/voice-settings-providers.tsx +7 -3
- package/src/screens/settings/voice-settings-types.ts +52 -49
- package/src/screens/settings/voice-settings-wake-word.tsx +25 -9
- package/src/screens/settings/voice-settings.tsx +66 -43
- package/src/screens/setup-user.tsx +88 -41
- package/src/screens/tools/tool-code.tsx +12 -17
- package/src/screens/tools/tool-details.tsx +28 -28
- package/src/screens/tools/tool-info.tsx +14 -19
- package/src/screens/tools/tool-list.tsx +58 -40
- package/src/screens/tools/tool-schema.tsx +16 -9
- package/src/screens/tools/tool-test-details.tsx +11 -22
- package/src/screens/tools/tool-test-list.tsx +29 -30
- package/src/screens/variables/variable-details.tsx +63 -51
- package/src/screens/variables/variable-list.tsx +29 -30
- package/src/screens/welcome-modal.tsx +68 -48
- package/src/screens/workflows/workflow-details.tsx +40 -30
- package/src/screens/workflows/workflow-info.tsx +4 -11
- package/src/screens/workflows/workflow-instructions.tsx +35 -28
- package/src/screens/workflows/workflow-list.tsx +50 -40
- package/src/setupTests.ts +14 -13
- package/src/system-apps/assistants.app.ts +5 -5
- package/src/system-apps/console-logs.app.ts +4 -4
- package/src/system-apps/contacts.app.ts +6 -6
- package/src/system-apps/data-explorer.app.ts +5 -5
- package/src/system-apps/groups.app.ts +6 -6
- package/src/system-apps/index.ts +49 -49
- package/src/system-apps/join-group.app.ts +5 -5
- package/src/system-apps/mobile-settings.app.ts +4 -5
- package/src/system-apps/network-viewer.app.ts +5 -5
- package/src/system-apps/packages.app.ts +5 -5
- package/src/system-apps/search.app.ts +6 -6
- package/src/system-apps/settings.app.ts +5 -5
- package/src/system-apps/threads.app.ts +5 -5
- package/src/system-apps/tools.app.ts +5 -5
- package/src/system-apps/types.app.ts +5 -5
- package/src/system-apps/variables.app.ts +5 -5
- package/src/system-apps/workflows.app.ts +5 -5
- package/src/tabs-layout/tabs-layout.tsx +345 -254
- package/src/tabs-layout/tabs-state.ts +100 -81
- package/src/ui-defaults/index.ts +2 -3
- package/src/ui-defaults/list-screen.tsx +45 -40
- package/src/ui-defaults/markdown-field.tsx +22 -26
- package/src/ui-router/routes-loader.ts +40 -24
- package/src/ui-router/ui-loader.tsx +312 -214
- package/src/utils.ts +68 -81
- package/tsconfig.json +5 -10
- package/dist/components/input-datetime.d.ts +0 -7
- package/dist/components/input-datetime.js +0 -35
- package/dist/components/lazy-sortable-list.d.ts +0 -29
- package/dist/components/lazy-sortable-list.js +0 -12
- package/dist/components/left-bar.d.ts +0 -5
- package/dist/components/left-bar.js +0 -207
- package/dist/components/main-content-container.d.ts +0 -2
- package/dist/components/main-content-container.js +0 -92
- package/dist/components/messages/thread-view.d.ts +0 -6
- package/dist/components/messages/thread-view.js +0 -174
- package/dist/components/off-canvas.d.ts +0 -13
- package/dist/components/off-canvas.js +0 -89
- package/dist/components/text-list-editor.tsx/text-list-editor.d.ts +0 -6
- package/dist/components/text-list-editor.tsx/text-list-editor.js +0 -13
- package/dist/components/top-bar.d.ts +0 -2
- package/dist/components/top-bar.js +0 -51
- package/dist/components/typeahead/mentions-plugin.d.ts +0 -7
- package/dist/components/typeahead/mentions-plugin.js +0 -203
- package/dist/components/typeahead/typeahead-editor.d.ts +0 -15
- package/dist/components/typeahead/typeahead-editor.js +0 -134
- package/dist/components/typeahead/typeahead.d.ts +0 -12
- package/dist/components/typeahead/typeahead.js +0 -94
- package/dist/screens/profile.d.ts +0 -2
- package/dist/screens/profile.js +0 -76
- package/src/components/input-datetime.tsx +0 -41
- package/src/components/lazy-sortable-list.tsx +0 -51
- package/src/components/left-bar.tsx +0 -322
- package/src/components/main-content-container.tsx +0 -79
- package/src/components/messages/thread-view.tsx +0 -214
- package/src/components/off-canvas.tsx +0 -83
- package/src/components/text-list-editor.tsx/text-list-editor.tsx +0 -13
- package/src/components/top-bar.tsx +0 -119
- package/src/components/typeahead/mentions-plugin.tsx +0 -265
- package/src/components/typeahead/typeahead-editor.tsx +0 -140
- package/src/components/typeahead/typeahead.tsx +0 -77
- package/src/screens/profile.tsx +0 -75
|
@@ -1,4 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
groupDeviceVar,
|
|
3
|
+
groupUserVar,
|
|
4
|
+
type IAppNav,
|
|
5
|
+
type IPackage,
|
|
6
|
+
newid,
|
|
7
|
+
type Observable,
|
|
8
|
+
observable,
|
|
9
|
+
} from "@peers-app/peers-sdk";
|
|
2
10
|
import { _mainContentPath } from "../globals";
|
|
3
11
|
import { systemPackage } from "../system-apps";
|
|
4
12
|
import { allPackages } from "../ui-router/routes-loader";
|
|
@@ -12,79 +20,79 @@ export interface TabState {
|
|
|
12
20
|
}
|
|
13
21
|
|
|
14
22
|
export const launcherApp: TabState = {
|
|
15
|
-
tabId:
|
|
16
|
-
packageId:
|
|
17
|
-
path:
|
|
18
|
-
title:
|
|
19
|
-
iconClassName:
|
|
23
|
+
tabId: "launcher",
|
|
24
|
+
packageId: "launcher",
|
|
25
|
+
path: "",
|
|
26
|
+
title: "Apps",
|
|
27
|
+
iconClassName: "bi-grid-3x3-gap",
|
|
20
28
|
};
|
|
21
29
|
|
|
22
30
|
// Persistent vars for storage (write-only, no subscription to avoid oscillation)
|
|
23
|
-
const _persistentActiveTabs = groupDeviceVar<TabState[]>(
|
|
31
|
+
const _persistentActiveTabs = groupDeviceVar<TabState[]>("activeTabs", {
|
|
24
32
|
defaultValue: [launcherApp],
|
|
25
33
|
});
|
|
26
34
|
|
|
27
|
-
const _persistentActiveTabId = groupDeviceVar<string>(
|
|
28
|
-
defaultValue:
|
|
35
|
+
const _persistentActiveTabId = groupDeviceVar<string>("activeTabId", {
|
|
36
|
+
defaultValue: "launcher",
|
|
29
37
|
});
|
|
30
38
|
|
|
31
|
-
const _persistentRecentlyUsedApps = groupUserVar<string[]>(
|
|
39
|
+
const _persistentRecentlyUsedApps = groupUserVar<string[]>("recentlyUsedApps", {
|
|
32
40
|
defaultValue: [],
|
|
33
41
|
});
|
|
34
42
|
|
|
35
43
|
// In-memory observables for UI state (loaded once, then write-through to persistent vars)
|
|
36
44
|
export const activeTabs: Observable<TabState[]> & { loadingPromise: Promise<void> } = (() => {
|
|
37
45
|
const obs = observable<TabState[]>([launcherApp]);
|
|
38
|
-
|
|
46
|
+
|
|
39
47
|
// Write-through to persistent var on change
|
|
40
|
-
obs.subscribe(value => {
|
|
48
|
+
obs.subscribe((value) => {
|
|
41
49
|
_persistentActiveTabs(value);
|
|
42
50
|
});
|
|
43
|
-
|
|
51
|
+
|
|
44
52
|
// Load initial value once
|
|
45
53
|
const loadingPromise = _persistentActiveTabs.loadingPromise.then(() => {
|
|
46
54
|
obs(_persistentActiveTabs());
|
|
47
55
|
});
|
|
48
|
-
|
|
56
|
+
|
|
49
57
|
return Object.assign(obs, { loadingPromise });
|
|
50
58
|
})();
|
|
51
59
|
|
|
52
60
|
export const activeTabId: Observable<string> & { loadingPromise: Promise<void> } = (() => {
|
|
53
|
-
const obs = observable<string>(
|
|
54
|
-
|
|
61
|
+
const obs = observable<string>("launcher");
|
|
62
|
+
|
|
55
63
|
// Write-through to persistent var on change
|
|
56
|
-
obs.subscribe(value => {
|
|
64
|
+
obs.subscribe((value) => {
|
|
57
65
|
_persistentActiveTabId(value);
|
|
58
66
|
});
|
|
59
|
-
|
|
67
|
+
|
|
60
68
|
// Load initial value once
|
|
61
69
|
const loadingPromise = _persistentActiveTabId.loadingPromise.then(() => {
|
|
62
70
|
obs(_persistentActiveTabId());
|
|
63
71
|
});
|
|
64
|
-
|
|
72
|
+
|
|
65
73
|
return Object.assign(obs, { loadingPromise });
|
|
66
74
|
})();
|
|
67
75
|
|
|
68
76
|
export const recentlyUsedApps: Observable<string[]> & { loadingPromise: Promise<void> } = (() => {
|
|
69
77
|
const obs = observable<string[]>([]);
|
|
70
|
-
|
|
78
|
+
|
|
71
79
|
// Write-through to persistent var on change
|
|
72
|
-
obs.subscribe(value => {
|
|
80
|
+
obs.subscribe((value) => {
|
|
73
81
|
_persistentRecentlyUsedApps(value);
|
|
74
82
|
});
|
|
75
|
-
|
|
83
|
+
|
|
76
84
|
// Load initial value once
|
|
77
85
|
const loadingPromise = _persistentRecentlyUsedApps.loadingPromise.then(() => {
|
|
78
86
|
obs(_persistentRecentlyUsedApps());
|
|
79
87
|
});
|
|
80
|
-
|
|
88
|
+
|
|
81
89
|
return Object.assign(obs, { loadingPromise });
|
|
82
90
|
})();
|
|
83
91
|
|
|
84
92
|
export const initializedTabs = new Set<string>();
|
|
85
93
|
|
|
86
94
|
export function goToTabPath(path: string) {
|
|
87
|
-
const tab = activeTabs().find(t => t.path === path);
|
|
95
|
+
const tab = activeTabs().find((t) => t.path === path);
|
|
88
96
|
if (tab) {
|
|
89
97
|
activeTabId(tab.tabId);
|
|
90
98
|
} else {
|
|
@@ -94,32 +102,43 @@ export function goToTabPath(path: string) {
|
|
|
94
102
|
path: path,
|
|
95
103
|
title: appInfo.navItem.displayName || appInfo.navItem.name,
|
|
96
104
|
packageId: appInfo.package.packageId,
|
|
97
|
-
iconClassName: appInfo.navItem.iconClassName
|
|
105
|
+
iconClassName: appInfo.navItem.iconClassName,
|
|
98
106
|
});
|
|
99
107
|
} else {
|
|
100
|
-
//
|
|
108
|
+
// No app matched — navigate by updating the active tab's path (e.g. deep link).
|
|
109
|
+
// Must replace the tab object (immutable): TabContentRenderer is memoized on tab.path,
|
|
110
|
+
// and mutating in place makes prev/next props compare equal so Router never re-renders.
|
|
101
111
|
const currentTabId = activeTabId();
|
|
102
112
|
const currentTabs = activeTabs();
|
|
103
|
-
const
|
|
104
|
-
if (
|
|
105
|
-
|
|
106
|
-
|
|
113
|
+
const idx = currentTabs.findIndex((t) => t.tabId === currentTabId);
|
|
114
|
+
if (idx >= 0 && currentTabs[idx].path !== "") {
|
|
115
|
+
const prev = currentTabs[idx];
|
|
116
|
+
const newTabs = [...currentTabs];
|
|
117
|
+
newTabs[idx] = { ...prev, path };
|
|
118
|
+
activeTabs(newTabs);
|
|
119
|
+
if (prev.packageId !== "launcher") {
|
|
120
|
+
_mainContentPath(path);
|
|
121
|
+
}
|
|
107
122
|
} else {
|
|
108
123
|
openNewTab({
|
|
109
124
|
path: path,
|
|
110
125
|
title: "New Tab",
|
|
111
|
-
packageId:
|
|
112
|
-
iconClassName:
|
|
126
|
+
packageId: "system-apps",
|
|
127
|
+
iconClassName: "bi-question-circle",
|
|
113
128
|
});
|
|
114
129
|
}
|
|
115
130
|
}
|
|
116
131
|
}
|
|
117
132
|
}
|
|
118
133
|
|
|
119
|
-
export const handleMainPathChanged = (
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
134
|
+
export const handleMainPathChanged = (
|
|
135
|
+
oldPath: string,
|
|
136
|
+
newPath: string,
|
|
137
|
+
setNewMainPath: (path: string) => void,
|
|
138
|
+
) => {
|
|
139
|
+
const oldPathPart = oldPath.toLowerCase().trim().split("?")[0];
|
|
140
|
+
const newPathPart = newPath.toLowerCase().trim().split("?")[0];
|
|
141
|
+
const currentTab = activeTabs().find((t) => t.tabId === activeTabId());
|
|
123
142
|
if (oldPathPart === newPathPart || (currentTab && currentTab.path === newPath)) {
|
|
124
143
|
// nothing to do
|
|
125
144
|
setNewMainPath(newPath);
|
|
@@ -127,81 +146,81 @@ export const handleMainPathChanged = (oldPath: string, newPath: string, setNewMa
|
|
|
127
146
|
}
|
|
128
147
|
|
|
129
148
|
const appInfo = determineAppFromPath(newPath);
|
|
130
|
-
if (appInfo && oldPath !==
|
|
149
|
+
if (appInfo && oldPath !== "") {
|
|
131
150
|
openNewTab({
|
|
132
151
|
path: newPath,
|
|
133
152
|
title: appInfo.navItem.displayName || appInfo.navItem.name,
|
|
134
153
|
packageId: appInfo.package.packageId,
|
|
135
|
-
iconClassName: appInfo.navItem.iconClassName
|
|
154
|
+
iconClassName: appInfo.navItem.iconClassName,
|
|
136
155
|
});
|
|
137
156
|
} else {
|
|
138
157
|
setNewMainPath(newPath);
|
|
139
158
|
}
|
|
159
|
+
};
|
|
140
160
|
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
type AppInfo = { navItem: IAppNav, package: IPackage };
|
|
161
|
+
type AppInfo = { navItem: IAppNav; package: IPackage };
|
|
144
162
|
|
|
145
163
|
export function determineAppFromPath(path: string): AppInfo | undefined {
|
|
146
164
|
const launcherInfo = {
|
|
147
165
|
navItem: {
|
|
148
|
-
name:
|
|
149
|
-
navigationPath:
|
|
150
|
-
iconClassName: launcherApp.iconClassName ||
|
|
166
|
+
name: "Apps",
|
|
167
|
+
navigationPath: "",
|
|
168
|
+
iconClassName: launcherApp.iconClassName || "bi-grid-3x3-gap",
|
|
151
169
|
},
|
|
152
|
-
package: systemPackage
|
|
170
|
+
package: systemPackage,
|
|
153
171
|
};
|
|
154
|
-
if (!path || path ===
|
|
172
|
+
if (!path || path === "" || path === "/") {
|
|
155
173
|
return launcherInfo;
|
|
156
174
|
}
|
|
157
175
|
|
|
158
176
|
// Remove leading/trailing slashes and query params
|
|
159
|
-
path = path.toLowerCase().trim().split(
|
|
160
|
-
if (path.startsWith(
|
|
177
|
+
path = path.toLowerCase().trim().split("?")[0];
|
|
178
|
+
if (path.startsWith("/")) {
|
|
161
179
|
path = path.substring(1);
|
|
162
180
|
}
|
|
163
|
-
const rootPath = path.split(
|
|
181
|
+
const rootPath = path.split("/")[0];
|
|
164
182
|
const _allPackages = [systemPackage, ...allPackages()]; // WARNING allPackages might not be loaded yet
|
|
165
183
|
|
|
166
|
-
|
|
167
184
|
const allAppInfos: AppInfo[] = _allPackages
|
|
168
|
-
.filter(pkg => (pkg.appNavs?.length ?? 0) > 0)
|
|
169
|
-
.flatMap(pkg =>
|
|
170
|
-
|
|
171
|
-
|
|
185
|
+
.filter((pkg) => (pkg.appNavs?.length ?? 0) > 0)
|
|
186
|
+
.flatMap((pkg) => {
|
|
187
|
+
const navs = pkg.appNavs;
|
|
188
|
+
if (!navs) return [];
|
|
189
|
+
return navs.map((navItem) => ({ navItem, package: pkg as IPackage }));
|
|
190
|
+
});
|
|
172
191
|
|
|
173
192
|
// Find the most relevant app based on path
|
|
174
193
|
for (const appInfo of allAppInfos) {
|
|
175
194
|
const navPath = appInfo.navItem.navigationPath || appInfo.navItem.name.toLowerCase();
|
|
176
195
|
|
|
177
196
|
// Check for exact match or path starting with nav path
|
|
178
|
-
if (rootPath === navPath || rootPath.startsWith(navPath
|
|
197
|
+
if (rootPath === navPath || rootPath.startsWith(`${navPath}/`)) {
|
|
179
198
|
// Return the first matching app
|
|
180
199
|
return {
|
|
181
200
|
navItem: appInfo.navItem,
|
|
182
|
-
package: appInfo.package
|
|
201
|
+
package: appInfo.package,
|
|
183
202
|
};
|
|
184
203
|
}
|
|
185
204
|
}
|
|
186
205
|
|
|
187
206
|
// look for package-specific routes
|
|
188
207
|
// uri in format of "package-nav/{packageId}/{path}"
|
|
189
|
-
const packageNavPrefix =
|
|
208
|
+
const packageNavPrefix = "package-nav/";
|
|
190
209
|
if (path.startsWith(packageNavPrefix)) {
|
|
191
|
-
const parts = path.substring(packageNavPrefix.length).split(
|
|
210
|
+
const parts = path.substring(packageNavPrefix.length).split("/");
|
|
192
211
|
if (parts.length > 0) {
|
|
193
212
|
const packageId = parts[0];
|
|
194
|
-
const pkg = _allPackages.find(p => p.packageId === packageId);
|
|
213
|
+
const pkg = _allPackages.find((p) => p.packageId === packageId);
|
|
195
214
|
if (pkg) {
|
|
196
|
-
const subPath = parts.slice(1).join(
|
|
197
|
-
const navItem = pkg.appNavs?.find(n => {
|
|
215
|
+
const subPath = parts.slice(1).join("/");
|
|
216
|
+
const navItem = pkg.appNavs?.find((n) => {
|
|
198
217
|
const navPath = n.navigationPath || n.name.toLowerCase();
|
|
199
|
-
return subPath === navPath || subPath.startsWith(navPath
|
|
218
|
+
return subPath === navPath || subPath.startsWith(`${navPath}/`);
|
|
200
219
|
});
|
|
201
220
|
if (navItem) {
|
|
202
221
|
return {
|
|
203
222
|
navItem,
|
|
204
|
-
package: pkg
|
|
223
|
+
package: pkg,
|
|
205
224
|
};
|
|
206
225
|
}
|
|
207
226
|
}
|
|
@@ -218,7 +237,7 @@ export const updateActiveTabTitle = (newTitle: string) => {
|
|
|
218
237
|
// using setTimeout to get around a race condition for setting title on new tabs
|
|
219
238
|
setTimeout(() => {
|
|
220
239
|
const currentTabs = activeTabs();
|
|
221
|
-
const activeTab = currentTabs.find(t => t.tabId === activeTabId());
|
|
240
|
+
const activeTab = currentTabs.find((t) => t.tabId === activeTabId());
|
|
222
241
|
if (activeTab) {
|
|
223
242
|
activeTab.title = newTitle;
|
|
224
243
|
activeTabs([...currentTabs]);
|
|
@@ -227,15 +246,15 @@ export const updateActiveTabTitle = (newTitle: string) => {
|
|
|
227
246
|
};
|
|
228
247
|
|
|
229
248
|
// Global function to open content in new tab
|
|
230
|
-
export const openNewTab = (tab: Omit<TabState,
|
|
249
|
+
export const openNewTab = (tab: Omit<TabState, "tabId">, forceNew = false) => {
|
|
231
250
|
const newTab: TabState = {
|
|
232
251
|
...tab,
|
|
233
252
|
tabId: newid(),
|
|
234
253
|
};
|
|
235
254
|
|
|
236
255
|
const currentTabs = activeTabs();
|
|
237
|
-
const existingTabIndex = currentTabs.findIndex(
|
|
238
|
-
t.packageId === tab.packageId && t.path === tab.path
|
|
256
|
+
const existingTabIndex = currentTabs.findIndex(
|
|
257
|
+
(t) => t.packageId === tab.packageId && t.path === tab.path,
|
|
239
258
|
);
|
|
240
259
|
|
|
241
260
|
if (existingTabIndex >= 0 && !forceNew) {
|
|
@@ -248,9 +267,9 @@ export const openNewTab = (tab: Omit<TabState, 'tabId'>, forceNew = false) => {
|
|
|
248
267
|
}
|
|
249
268
|
|
|
250
269
|
// Update recently used (track by path instead of packageId)
|
|
251
|
-
if (tab.path && tab.packageId !==
|
|
270
|
+
if (tab.path && tab.packageId !== "launcher") {
|
|
252
271
|
const recent = recentlyUsedApps();
|
|
253
|
-
const filtered = recent.filter(path => path !== tab.path);
|
|
272
|
+
const filtered = recent.filter((path) => path !== tab.path);
|
|
254
273
|
recentlyUsedApps([tab.path, ...filtered].slice(0, 8));
|
|
255
274
|
}
|
|
256
275
|
};
|
|
@@ -259,17 +278,17 @@ export const openNewTab = (tab: Omit<TabState, 'tabId'>, forceNew = false) => {
|
|
|
259
278
|
export const closeCurrentTab = () => {
|
|
260
279
|
const currentTabs = activeTabs();
|
|
261
280
|
const _activeTabId = activeTabId();
|
|
262
|
-
const tabToClose = currentTabs.find(t => t.tabId === _activeTabId);
|
|
281
|
+
const tabToClose = currentTabs.find((t) => t.tabId === _activeTabId);
|
|
263
282
|
|
|
264
283
|
if (!tabToClose || tabToClose.tabId === "launcher") return;
|
|
265
284
|
|
|
266
|
-
const closedIndex = currentTabs.findIndex(t => t.tabId === _activeTabId);
|
|
267
|
-
const newTabs = currentTabs.filter(t => t.tabId !== _activeTabId);
|
|
285
|
+
const closedIndex = currentTabs.findIndex((t) => t.tabId === _activeTabId);
|
|
286
|
+
const newTabs = currentTabs.filter((t) => t.tabId !== _activeTabId);
|
|
268
287
|
activeTabs(newTabs);
|
|
269
288
|
initializedTabs.delete(_activeTabId);
|
|
270
289
|
|
|
271
290
|
if (newTabs.length === 0) {
|
|
272
|
-
activeTabId(
|
|
291
|
+
activeTabId("launcher");
|
|
273
292
|
} else if (closedIndex < newTabs.length) {
|
|
274
293
|
activeTabId(newTabs[closedIndex].tabId);
|
|
275
294
|
} else {
|
|
@@ -281,7 +300,7 @@ export const closeCurrentTab = () => {
|
|
|
281
300
|
export const switchToNextTab = () => {
|
|
282
301
|
const currentTabs = activeTabs();
|
|
283
302
|
const activeTab = activeTabId();
|
|
284
|
-
const currentIndex = currentTabs.findIndex(tab => tab.tabId === activeTab);
|
|
303
|
+
const currentIndex = currentTabs.findIndex((tab) => tab.tabId === activeTab);
|
|
285
304
|
|
|
286
305
|
if (currentIndex === -1) return;
|
|
287
306
|
|
|
@@ -293,7 +312,7 @@ export const switchToNextTab = () => {
|
|
|
293
312
|
export const switchToPreviousTab = () => {
|
|
294
313
|
const currentTabs = activeTabs();
|
|
295
314
|
const activeTab = activeTabId();
|
|
296
|
-
const currentIndex = currentTabs.findIndex(tab => tab.tabId === activeTab);
|
|
315
|
+
const currentIndex = currentTabs.findIndex((tab) => tab.tabId === activeTab);
|
|
297
316
|
|
|
298
317
|
if (currentIndex === -1) return;
|
|
299
318
|
|
|
@@ -303,19 +322,19 @@ export const switchToPreviousTab = () => {
|
|
|
303
322
|
|
|
304
323
|
// Keyboard shortcuts are now handled by the command palette system
|
|
305
324
|
|
|
306
|
-
activeTabId.subscribe(newActiveTab => {
|
|
325
|
+
activeTabId.subscribe((newActiveTab) => {
|
|
307
326
|
const currentTabs = activeTabs();
|
|
308
|
-
const activeTab = currentTabs.find(t => t.tabId === newActiveTab);
|
|
327
|
+
const activeTab = currentTabs.find((t) => t.tabId === newActiveTab);
|
|
309
328
|
|
|
310
329
|
if (!activeTab) {
|
|
311
|
-
console.warn(
|
|
330
|
+
console.warn("Active tab not found:", newActiveTab);
|
|
312
331
|
return;
|
|
313
332
|
}
|
|
314
333
|
|
|
315
334
|
// Update mainContentPath for the new active tab
|
|
316
|
-
if (activeTab.packageId !==
|
|
335
|
+
if (activeTab.packageId !== "launcher") {
|
|
317
336
|
_mainContentPath(activeTab.path);
|
|
318
337
|
} else {
|
|
319
|
-
_mainContentPath(
|
|
338
|
+
_mainContentPath(""); // Launcher or fallback
|
|
320
339
|
}
|
|
321
|
-
});
|
|
340
|
+
});
|
package/src/ui-defaults/index.ts
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import './markdown-field'
|
|
1
|
+
import "./list-screen";
|
|
2
|
+
import "./markdown-field";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { FieldType,
|
|
1
|
+
import { FieldType, getAllTables, getIconClassName, newid, z } from "@peers-app/peers-sdk";
|
|
2
|
+
// biome-ignore lint/correctness/noUnusedImports: classic JSX (`jsx: react`) needs React in scope for emit
|
|
2
3
|
import React from "react";
|
|
3
|
-
import { z } from "zod";
|
|
4
4
|
import { ListScreen } from "../components/list-screen";
|
|
5
5
|
import { mainContentPath } from "../globals";
|
|
6
6
|
import { registerInternalPeersUI } from "../ui-router/ui-loader";
|
|
@@ -11,31 +11,35 @@ const propsSchema = z.object({
|
|
|
11
11
|
|
|
12
12
|
type IProps = z.infer<typeof propsSchema>;
|
|
13
13
|
|
|
14
|
-
export const DefaultListScreen = (
|
|
15
|
-
const path =
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
export const DefaultListScreen = (_props: IProps) => {
|
|
15
|
+
const path =
|
|
16
|
+
mainContentPath().toLowerCase().trim().split("?")[0].split("#").pop()?.split("/")[0] || "";
|
|
17
|
+
const fuzzyTableName = (
|
|
18
|
+
{
|
|
19
|
+
variables: "persistent_vars",
|
|
20
|
+
}[path] || path
|
|
21
|
+
)
|
|
22
|
+
.replace(/[_-]/g, "")
|
|
23
|
+
.trim();
|
|
19
24
|
|
|
20
25
|
const allTables = getAllTables();
|
|
21
|
-
const tableName = Object.keys(allTables).find(
|
|
22
|
-
|
|
26
|
+
const tableName = Object.keys(allTables).find(
|
|
27
|
+
(t) => t.toLowerCase().replace(/[_-]/g, "").trim() === fuzzyTableName,
|
|
28
|
+
);
|
|
29
|
+
const table = allTables[tableName || ""];
|
|
23
30
|
if (!table) {
|
|
24
|
-
return
|
|
25
|
-
<div className="m-4">
|
|
26
|
-
Table not found for path: "{path}"
|
|
27
|
-
</div>
|
|
28
|
-
);
|
|
31
|
+
return <div className="m-4">Table not found for path: "{path}"</div>;
|
|
29
32
|
}
|
|
30
|
-
const idField = table.metaData.fields.find(f => f.name === table.metaData.primaryKeyName);
|
|
33
|
+
const idField = table.metaData.fields.find((f) => f.name === table.metaData.primaryKeyName);
|
|
31
34
|
if (!idField) {
|
|
32
|
-
throw new Error(
|
|
35
|
+
throw new Error("No primary key field found for table");
|
|
33
36
|
}
|
|
34
|
-
const nameField =
|
|
35
|
-
table.metaData.fields.find(f => f.name ===
|
|
36
|
-
table.metaData.fields.find(f => f.
|
|
37
|
+
const nameField =
|
|
38
|
+
table.metaData.fields.find((f) => f.name === "name") ||
|
|
39
|
+
table.metaData.fields.find((f) => f.name === "title") ||
|
|
40
|
+
table.metaData.fields.find((f) => f.type === FieldType.string);
|
|
37
41
|
if (!nameField) {
|
|
38
|
-
throw new Error(
|
|
42
|
+
throw new Error("No name field found to create new record with");
|
|
39
43
|
}
|
|
40
44
|
|
|
41
45
|
return (
|
|
@@ -45,45 +49,46 @@ export const DefaultListScreen = (props: IProps) => {
|
|
|
45
49
|
table,
|
|
46
50
|
sortBy: [`-${idField.name}`],
|
|
47
51
|
newRecord: async (text: string) => {
|
|
48
|
-
text = text.trim().replace(/\s+/g,
|
|
52
|
+
text = text.trim().replace(/\s+/g, "_");
|
|
49
53
|
let item = table.initRecord({
|
|
50
54
|
[idField.name]: newid(),
|
|
51
55
|
[nameField?.name]: text,
|
|
52
|
-
|
|
53
|
-
})
|
|
56
|
+
});
|
|
54
57
|
item = await table.insert(item);
|
|
55
58
|
mainContentPath(`${path}/${item[idField.name]}`);
|
|
56
59
|
return item;
|
|
57
60
|
},
|
|
58
|
-
renderItem: (item
|
|
61
|
+
renderItem: (item) => {
|
|
62
|
+
const row = item as Record<string, unknown>;
|
|
63
|
+
const rowId = row[idField.name];
|
|
64
|
+
const displayName = row.name;
|
|
59
65
|
return (
|
|
60
|
-
<div
|
|
61
|
-
key={item[idField.name]}
|
|
62
|
-
className='container-fluid pb-4'
|
|
63
|
-
>
|
|
66
|
+
<div key={String(rowId)} className="container-fluid pb-4">
|
|
64
67
|
<i className={getIconClassName(table)}></i>
|
|
65
|
-
<a href={`#${path}/${
|
|
66
|
-
{
|
|
68
|
+
<a href={`#${path}/${String(rowId)}`}>
|
|
69
|
+
{typeof displayName === "string" ? displayName : "<empty-name>"}
|
|
67
70
|
</a>
|
|
68
|
-
<div style={{ paddingLeft:
|
|
71
|
+
<div style={{ paddingLeft: "20px" }}>
|
|
69
72
|
{/* <MarkdownWithMentions content={item.description || ''} /> */}
|
|
70
73
|
</div>
|
|
71
74
|
</div>
|
|
72
|
-
)
|
|
75
|
+
);
|
|
73
76
|
},
|
|
74
77
|
}}
|
|
75
78
|
/>
|
|
76
79
|
);
|
|
77
|
-
}
|
|
80
|
+
};
|
|
78
81
|
|
|
79
82
|
registerInternalPeersUI({
|
|
80
83
|
peersUIId: "00m5fql0x5v48vyrk5bllzdrr",
|
|
81
84
|
component: DefaultListScreen,
|
|
82
|
-
routes: [
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
85
|
+
routes: [
|
|
86
|
+
{
|
|
87
|
+
isMatch: (_props, context) => context.path.split("/").length === 1,
|
|
88
|
+
uiEditMode: "view",
|
|
89
|
+
uiCategory: "screen",
|
|
90
|
+
uiSubcategory: "list",
|
|
91
|
+
priority: -Number.MAX_SAFE_INTEGER,
|
|
92
|
+
},
|
|
93
|
+
],
|
|
89
94
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Observable, observable } from "@peers-app/peers-sdk";
|
|
1
|
+
import { type Observable, observable, z } from "@peers-app/peers-sdk";
|
|
2
|
+
// biome-ignore lint/correctness/noUnusedImports: classic JSX (`jsx: react`) needs React in scope for emit
|
|
2
3
|
import React, { useEffect, useRef, useState } from "react";
|
|
3
|
-
import { z } from "zod";
|
|
4
4
|
import { MarkdownEditorInline } from "../components/markdown-editor/editor-inline";
|
|
5
5
|
import { MarkdownWithMentions } from "../components/markdown-with-mentions";
|
|
6
6
|
import { registerInternalPeersUI } from "../ui-router/ui-loader";
|
|
@@ -14,8 +14,8 @@ interface IMarkdownFieldProps {
|
|
|
14
14
|
* Markdown field component for viewing markdown content
|
|
15
15
|
*/
|
|
16
16
|
const MarkdownFieldView = (props: IMarkdownFieldProps) => {
|
|
17
|
-
const value = typeof props.value ===
|
|
18
|
-
|
|
17
|
+
const value = typeof props.value === "function" ? props.value() : props.value;
|
|
18
|
+
|
|
19
19
|
if (!value) {
|
|
20
20
|
return null;
|
|
21
21
|
}
|
|
@@ -32,30 +32,26 @@ const MarkdownFieldEdit = (props: IMarkdownFieldProps) => {
|
|
|
32
32
|
|
|
33
33
|
// Create an observable for the editor that calls onChange when it changes
|
|
34
34
|
const [valueObs] = useState(() => {
|
|
35
|
-
const initialValue = typeof props.value ===
|
|
36
|
-
const obs = observable(initialValue ||
|
|
37
|
-
|
|
35
|
+
const initialValue = typeof props.value === "function" ? props.value() : props.value;
|
|
36
|
+
const obs = observable(initialValue || "");
|
|
37
|
+
|
|
38
38
|
// Subscribe to changes and call onChange
|
|
39
39
|
obs.subscribe((newValue) => {
|
|
40
40
|
onChangeRef.current?.(newValue);
|
|
41
41
|
});
|
|
42
|
-
|
|
42
|
+
|
|
43
43
|
return obs;
|
|
44
44
|
});
|
|
45
45
|
|
|
46
46
|
// Sync external value changes to the observable
|
|
47
47
|
useEffect(() => {
|
|
48
|
-
const currentValue = typeof props.value ===
|
|
48
|
+
const currentValue = typeof props.value === "function" ? props.value() : props.value;
|
|
49
49
|
if (currentValue !== valueObs()) {
|
|
50
|
-
valueObs(currentValue ||
|
|
50
|
+
valueObs(currentValue || "");
|
|
51
51
|
}
|
|
52
|
-
}, [props.value]);
|
|
52
|
+
}, [props.value, valueObs]);
|
|
53
53
|
|
|
54
|
-
return
|
|
55
|
-
<MarkdownEditorInline
|
|
56
|
-
value={valueObs}
|
|
57
|
-
/>
|
|
58
|
-
);
|
|
54
|
+
return <MarkdownEditorInline value={valueObs} />;
|
|
59
55
|
};
|
|
60
56
|
|
|
61
57
|
// Schema for markdown field props
|
|
@@ -70,11 +66,11 @@ registerInternalPeersUI({
|
|
|
70
66
|
propsSchema: markdownFieldPropsSchema,
|
|
71
67
|
routes: [
|
|
72
68
|
{
|
|
73
|
-
uiCategory:
|
|
74
|
-
uiSubcategory:
|
|
75
|
-
uiEditMode:
|
|
76
|
-
}
|
|
77
|
-
]
|
|
69
|
+
uiCategory: "field",
|
|
70
|
+
uiSubcategory: "markdown",
|
|
71
|
+
uiEditMode: "view",
|
|
72
|
+
},
|
|
73
|
+
],
|
|
78
74
|
});
|
|
79
75
|
|
|
80
76
|
// Register the edit mode component
|
|
@@ -83,9 +79,9 @@ registerInternalPeersUI({
|
|
|
83
79
|
propsSchema: markdownFieldPropsSchema,
|
|
84
80
|
routes: [
|
|
85
81
|
{
|
|
86
|
-
uiCategory:
|
|
87
|
-
uiSubcategory:
|
|
88
|
-
uiEditMode:
|
|
89
|
-
}
|
|
90
|
-
]
|
|
82
|
+
uiCategory: "field",
|
|
83
|
+
uiSubcategory: "markdown",
|
|
84
|
+
uiEditMode: "edit",
|
|
85
|
+
},
|
|
86
|
+
],
|
|
91
87
|
});
|