@sixb/app 0.1.11 → 0.1.13
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/LICENSE +2 -0
- package/README.md +27 -26
- package/assets/connector-icons/README.md +29 -0
- package/assets/connector-icons/ace-iot.ico +0 -0
- package/assets/connector-icons/companycam.png +0 -0
- package/assets/connector-icons/exa.png +0 -0
- package/assets/connector-icons/github.svg +1 -0
- package/assets/connector-icons/google.ico +0 -0
- package/assets/connector-icons/googleads.svg +29 -0
- package/assets/connector-icons/linkedin.svg +1 -0
- package/assets/connector-icons/mercury.svg +1 -0
- package/assets/connector-icons/meta.svg +1 -0
- package/assets/connector-icons/microsoft.ico +0 -0
- package/assets/connector-icons/notion.svg +1 -0
- package/assets/connector-icons/pandadoc.png +0 -0
- package/assets/connector-icons/pennylane.ico +0 -0
- package/assets/connector-icons/pipedrive.png +0 -0
- package/assets/connector-icons/plaud.png +0 -0
- package/assets/connector-icons/quickbooks.svg +1 -0
- package/assets/connector-icons/stripe.svg +1 -0
- package/assets/connector-icons/teamleader.ico +0 -0
- package/assets/connector-icons/tiktok.svg +1 -0
- package/assets/connector-icons/unipile.png +0 -0
- package/dist/agent/activity-label.d.ts +5 -0
- package/dist/agent/activity-label.d.ts.map +1 -0
- package/dist/agent/agent-chat.d.ts +25 -0
- package/dist/agent/agent-chat.d.ts.map +1 -0
- package/dist/agent/agent-context-provider.d.ts +9 -0
- package/dist/agent/agent-context-provider.d.ts.map +1 -0
- package/dist/agent/agent-execution-trace.d.ts +9 -0
- package/dist/agent/agent-execution-trace.d.ts.map +1 -0
- package/dist/agent/agent-panel.d.ts +24 -0
- package/dist/agent/agent-panel.d.ts.map +1 -0
- package/dist/agent/agent-surface-state.d.ts +22 -0
- package/dist/agent/agent-surface-state.d.ts.map +1 -0
- package/dist/agent/agent-surface.d.ts +46 -0
- package/dist/agent/agent-surface.d.ts.map +1 -0
- package/dist/agent/agents-page.d.ts +4 -0
- package/dist/agent/agents-page.d.ts.map +1 -0
- package/dist/agent/artifact-card.d.ts +9 -0
- package/dist/agent/artifact-card.d.ts.map +1 -0
- package/dist/agent/artifact-panel-state.d.ts +16 -0
- package/dist/agent/artifact-panel-state.d.ts.map +1 -0
- package/dist/agent/artifact-panel.d.ts +38 -0
- package/dist/agent/artifact-panel.d.ts.map +1 -0
- package/dist/agent/bash/bash-tool-view.d.ts +17 -0
- package/dist/agent/bash/bash-tool-view.d.ts.map +1 -0
- package/dist/agent/bash/data.d.ts +35 -0
- package/dist/agent/bash/data.d.ts.map +1 -0
- package/dist/agent/bash/interpret.d.ts +84 -0
- package/dist/agent/bash/interpret.d.ts.map +1 -0
- package/dist/agent/bash/renderers.d.ts +31 -0
- package/dist/agent/bash/renderers.d.ts.map +1 -0
- package/dist/agent/bash/shell.d.ts +16 -0
- package/dist/agent/bash/shell.d.ts.map +1 -0
- package/dist/agent/components/activity-status.d.ts +13 -0
- package/dist/agent/components/activity-status.d.ts.map +1 -0
- package/dist/agent/components/agent-thread-switcher.d.ts +16 -0
- package/dist/agent/components/agent-thread-switcher.d.ts.map +1 -0
- package/dist/agent/components/composer.d.ts +47 -0
- package/dist/agent/components/composer.d.ts.map +1 -0
- package/dist/agent/components/context-chips.d.ts +7 -0
- package/dist/agent/components/context-chips.d.ts.map +1 -0
- package/dist/agent/components/context-picker.d.ts +16 -0
- package/dist/agent/components/context-picker.d.ts.map +1 -0
- package/dist/agent/components/conversation-panel.d.ts +82 -0
- package/dist/agent/components/conversation-panel.d.ts.map +1 -0
- package/dist/agent/components/file-attachment-card.d.ts +8 -0
- package/dist/agent/components/file-attachment-card.d.ts.map +1 -0
- package/dist/agent/components/message-parts.d.ts +14 -0
- package/dist/agent/components/message-parts.d.ts.map +1 -0
- package/dist/agent/components/message-view.d.ts +58 -0
- package/dist/agent/components/message-view.d.ts.map +1 -0
- package/dist/agent/components/model-controls.d.ts +20 -0
- package/dist/agent/components/model-controls.d.ts.map +1 -0
- package/dist/agent/components/model-picker-row.d.ts +8 -0
- package/dist/agent/components/model-picker-row.d.ts.map +1 -0
- package/dist/agent/components/provider-logo.d.ts +6 -0
- package/dist/agent/components/provider-logo.d.ts.map +1 -0
- package/dist/agent/components/provider-logos.d.ts +3 -0
- package/dist/agent/components/provider-logos.d.ts.map +1 -0
- package/dist/agent/components/reasoning-effort-slider.d.ts +11 -0
- package/dist/agent/components/reasoning-effort-slider.d.ts.map +1 -0
- package/dist/agent/components/sandbox-recovery.d.ts +6 -0
- package/dist/agent/components/sandbox-recovery.d.ts.map +1 -0
- package/dist/agent/components/thread-artifacts-menu.d.ts +8 -0
- package/dist/agent/components/thread-artifacts-menu.d.ts.map +1 -0
- package/dist/agent/components/transcript.d.ts +36 -0
- package/dist/agent/components/transcript.d.ts.map +1 -0
- package/dist/agent/components/web-fetch-tool-view.d.ts +5 -0
- package/dist/agent/components/web-fetch-tool-view.d.ts.map +1 -0
- package/dist/agent/components/web-search-tool-view.d.ts +5 -0
- package/dist/agent/components/web-search-tool-view.d.ts.map +1 -0
- package/dist/agent/components/web-sources.d.ts +9 -0
- package/dist/agent/components/web-sources.d.ts.map +1 -0
- package/dist/agent/format.d.ts +12 -0
- package/dist/agent/format.d.ts.map +1 -0
- package/dist/agent/hooks/use-agent-conversation.d.ts +337 -0
- package/dist/agent/hooks/use-agent-conversation.d.ts.map +1 -0
- package/dist/agent/hooks/use-thread-stream.d.ts +22 -0
- package/dist/agent/hooks/use-thread-stream.d.ts.map +1 -0
- package/dist/agent/i18n/en.d.ts +550 -0
- package/dist/agent/i18n/en.d.ts.map +1 -0
- package/dist/agent/i18n/fr.d.ts +4 -0
- package/dist/agent/i18n/fr.d.ts.map +1 -0
- package/dist/agent/i18n/index.d.ts +1079 -0
- package/dist/agent/i18n/index.d.ts.map +1 -0
- package/dist/agent/live-run.d.ts +48 -0
- package/dist/agent/live-run.d.ts.map +1 -0
- package/dist/agent/model-selection.d.ts +33 -0
- package/dist/agent/model-selection.d.ts.map +1 -0
- package/dist/agent/object-context-title.d.ts +22 -0
- package/dist/agent/object-context-title.d.ts.map +1 -0
- package/dist/agent/parts.d.ts +42 -0
- package/dist/agent/parts.d.ts.map +1 -0
- package/dist/agent/publish-artifact/interpret.d.ts +32 -0
- package/dist/agent/publish-artifact/interpret.d.ts.map +1 -0
- package/dist/agent/publish-artifact/publish-artifact-tool-view.d.ts +9 -0
- package/dist/agent/publish-artifact/publish-artifact-tool-view.d.ts.map +1 -0
- package/dist/agent/publish-artifact/use-live-publishes.d.ts +10 -0
- package/dist/agent/publish-artifact/use-live-publishes.d.ts.map +1 -0
- package/dist/agent/react-router.d.ts +7 -0
- package/dist/agent/react-router.d.ts.map +1 -0
- package/dist/agent/read/interpret.d.ts +24 -0
- package/dist/agent/read/interpret.d.ts.map +1 -0
- package/dist/agent/read/read-tool-view.d.ts +5 -0
- package/dist/agent/read/read-tool-view.d.ts.map +1 -0
- package/dist/agent/requester-settings.d.ts +15 -0
- package/dist/agent/requester-settings.d.ts.map +1 -0
- package/dist/agent/run-presentation.d.ts +70 -0
- package/dist/agent/run-presentation.d.ts.map +1 -0
- package/dist/agent/thread-navigation.d.ts +5 -0
- package/dist/agent/thread-navigation.d.ts.map +1 -0
- package/dist/agent/types.d.ts +22 -0
- package/dist/agent/types.d.ts.map +1 -0
- package/dist/agent/utils/context-display.d.ts +5 -0
- package/dist/agent/utils/context-display.d.ts.map +1 -0
- package/dist/agent/utils/context-mention.d.ts +12 -0
- package/dist/agent/utils/context-mention.d.ts.map +1 -0
- package/dist/agent/utils/web-fetch.d.ts +4 -0
- package/dist/agent/utils/web-fetch.d.ts.map +1 -0
- package/dist/agent/utils/web-search.d.ts +20 -0
- package/dist/agent/utils/web-search.d.ts.map +1 -0
- package/dist/agent/view-file/interpret.d.ts +9 -0
- package/dist/agent/view-file/interpret.d.ts.map +1 -0
- package/dist/agent/view-file/view-file-tool-view.d.ts +9 -0
- package/dist/agent/view-file/view-file-tool-view.d.ts.map +1 -0
- package/dist/artifacts/artifact-page.d.ts +7 -0
- package/dist/artifacts/artifact-page.d.ts.map +1 -0
- package/dist/artifacts/card-details.d.ts +15 -0
- package/dist/artifacts/card-details.d.ts.map +1 -0
- package/dist/artifacts/card-preview.d.ts +59 -0
- package/dist/artifacts/card-preview.d.ts.map +1 -0
- package/dist/artifacts/copy-feedback.d.ts +6 -0
- package/dist/artifacts/copy-feedback.d.ts.map +1 -0
- package/dist/artifacts/file-size.d.ts +11 -0
- package/dist/artifacts/file-size.d.ts.map +1 -0
- package/dist/artifacts/file-source.d.ts +45 -0
- package/dist/artifacts/file-source.d.ts.map +1 -0
- package/dist/artifacts/file-view.d.ts +9 -0
- package/dist/artifacts/file-view.d.ts.map +1 -0
- package/dist/artifacts/frame.d.ts +45 -0
- package/dist/artifacts/frame.d.ts.map +1 -0
- package/dist/artifacts/gallery.d.ts +6 -0
- package/dist/artifacts/gallery.d.ts.map +1 -0
- package/dist/artifacts/kind-icon.d.ts +8 -0
- package/dist/artifacts/kind-icon.d.ts.map +1 -0
- package/dist/artifacts/markdown-tree.d.ts +22 -0
- package/dist/artifacts/markdown-tree.d.ts.map +1 -0
- package/dist/artifacts/messages.d.ts +301 -0
- package/dist/artifacts/messages.d.ts.map +1 -0
- package/dist/artifacts/queries.d.ts +21 -0
- package/dist/artifacts/queries.d.ts.map +1 -0
- package/dist/artifacts/references/embed-tree.d.ts +17 -0
- package/dist/artifacts/references/embed-tree.d.ts.map +1 -0
- package/dist/artifacts/references/references.d.ts +50 -0
- package/dist/artifacts/references/references.d.ts.map +1 -0
- package/dist/artifacts/renderers/document-tree.d.ts +11 -0
- package/dist/artifacts/renderers/document-tree.d.ts.map +1 -0
- package/dist/artifacts/renderers/document.d.ts +17 -0
- package/dist/artifacts/renderers/document.d.ts.map +1 -0
- package/dist/artifacts/renderers/file.d.ts +10 -0
- package/dist/artifacts/renderers/file.d.ts.map +1 -0
- package/dist/artifacts/renderers/notice.d.ts +12 -0
- package/dist/artifacts/renderers/notice.d.ts.map +1 -0
- package/dist/artifacts/renderers/sheet/chart-data.d.ts +33 -0
- package/dist/artifacts/renderers/sheet/chart-data.d.ts.map +1 -0
- package/dist/artifacts/renderers/sheet/chart.d.ts +15 -0
- package/dist/artifacts/renderers/sheet/chart.d.ts.map +1 -0
- package/dist/artifacts/renderers/sheet/format.d.ts +35 -0
- package/dist/artifacts/renderers/sheet/format.d.ts.map +1 -0
- package/dist/artifacts/renderers/sheet/grid.d.ts +25 -0
- package/dist/artifacts/renderers/sheet/grid.d.ts.map +1 -0
- package/dist/artifacts/renderers/sheet/mini-chart.d.ts +7 -0
- package/dist/artifacts/renderers/sheet/mini-chart.d.ts.map +1 -0
- package/dist/artifacts/renderers/sheet/model.d.ts +29 -0
- package/dist/artifacts/renderers/sheet/model.d.ts.map +1 -0
- package/dist/artifacts/renderers/sheet/selection.d.ts +42 -0
- package/dist/artifacts/renderers/sheet/selection.d.ts.map +1 -0
- package/dist/artifacts/renderers/sheet/sheet.d.ts +17 -0
- package/dist/artifacts/renderers/sheet/sheet.d.ts.map +1 -0
- package/dist/artifacts/renderers/sheet/virtual.d.ts +13 -0
- package/dist/artifacts/renderers/sheet/virtual.d.ts.map +1 -0
- package/dist/artifacts/renderers/sheet/workbook.d.ts +24 -0
- package/dist/artifacts/renderers/sheet/workbook.d.ts.map +1 -0
- package/dist/artifacts/renderers/slides/navigation.d.ts +17 -0
- package/dist/artifacts/renderers/slides/navigation.d.ts.map +1 -0
- package/dist/artifacts/renderers/slides/slides.d.ts +14 -0
- package/dist/artifacts/renderers/slides/slides.d.ts.map +1 -0
- package/dist/artifacts/target.d.ts +29 -0
- package/dist/artifacts/target.d.ts.map +1 -0
- package/dist/artifacts/theme.d.ts +18 -0
- package/dist/artifacts/theme.d.ts.map +1 -0
- package/dist/artifacts/viewer.d.ts +19 -0
- package/dist/artifacts/viewer.d.ts.map +1 -0
- package/dist/chunk-3schcf10.js +251 -0
- package/dist/chunk-3schcf10.js.map +10 -0
- package/dist/chunk-6n5pdqp0.js +115 -0
- package/dist/chunk-6n5pdqp0.js.map +11 -0
- package/dist/chunk-c7gy61rx.js +276 -0
- package/dist/chunk-c7gy61rx.js.map +10 -0
- package/dist/chunk-g3f4cm8x.js +20 -0
- package/dist/chunk-g3f4cm8x.js.map +10 -0
- package/dist/chunk-gn3k23q5.js +149 -0
- package/dist/chunk-gn3k23q5.js.map +10 -0
- package/dist/chunk-md3p7qdt.js +379 -0
- package/dist/chunk-md3p7qdt.js.map +10 -0
- package/dist/chunk-ng0hdnrq.js +183 -0
- package/dist/chunk-ng0hdnrq.js.map +10 -0
- package/dist/chunk-xxpdn63v.js +15018 -0
- package/dist/chunk-xxpdn63v.js.map +105 -0
- package/dist/chunk-yvhzn4ye.js +98 -0
- package/dist/chunk-yvhzn4ye.js.map +10 -0
- package/dist/codegen.d.ts +8 -4
- package/dist/codegen.d.ts.map +1 -1
- package/dist/createCustomApp.d.ts +14 -7
- package/dist/createCustomApp.d.ts.map +1 -1
- package/dist/index.d.ts +31 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +962 -2891
- package/dist/index.js.map +14 -13
- package/dist/locale-messages.d.ts +74 -6
- package/dist/locale-messages.d.ts.map +1 -1
- package/dist/locale.d.ts +75 -8
- package/dist/locale.d.ts.map +1 -1
- package/dist/locale.js +10 -19
- package/dist/locale.js.map +3 -4
- package/dist/metadata.d.ts.map +1 -1
- package/dist/pages/data/connectors.d.ts +5 -0
- package/dist/pages/data/connectors.d.ts.map +1 -0
- package/dist/pages/data/datasets.d.ts +30 -0
- package/dist/pages/data/datasets.d.ts.map +1 -0
- package/dist/pages/data/live-updates.d.ts +13 -0
- package/dist/pages/data/live-updates.d.ts.map +1 -0
- package/dist/pages/data/messages.d.ts +354 -0
- package/dist/pages/data/messages.d.ts.map +1 -0
- package/dist/pages/data/pipeline-canvas.d.ts +34 -0
- package/dist/pages/data/pipeline-canvas.d.ts.map +1 -0
- package/dist/pages/data/pipelines.d.ts +9 -0
- package/dist/pages/data/pipelines.d.ts.map +1 -0
- package/dist/pages/data/projections.d.ts +10 -0
- package/dist/pages/data/projections.d.ts.map +1 -0
- package/dist/pages/data/schema.d.ts +20 -0
- package/dist/pages/data/schema.d.ts.map +1 -0
- package/dist/pages/data/shared.d.ts +13 -0
- package/dist/pages/data/shared.d.ts.map +1 -0
- package/dist/pages/data/sync-button.d.ts +15 -0
- package/dist/pages/data/sync-button.d.ts.map +1 -0
- package/dist/pages/data/syncs.d.ts +5 -0
- package/dist/pages/data/syncs.d.ts.map +1 -0
- package/dist/pages/home.d.ts +6 -0
- package/dist/pages/home.d.ts.map +1 -0
- package/dist/pages/mosaic.d.ts +5 -0
- package/dist/pages/mosaic.d.ts.map +1 -0
- package/dist/pages/observability/action-run.d.ts +19 -0
- package/dist/pages/observability/action-run.d.ts.map +1 -0
- package/dist/pages/observability/activity/calendar.d.ts +9 -0
- package/dist/pages/observability/activity/calendar.d.ts.map +1 -0
- package/dist/pages/observability/activity/connections.d.ts +7 -0
- package/dist/pages/observability/activity/connections.d.ts.map +1 -0
- package/dist/pages/observability/activity/format.d.ts +11 -0
- package/dist/pages/observability/activity/format.d.ts.map +1 -0
- package/dist/pages/observability/activity/messages.d.ts +231 -0
- package/dist/pages/observability/activity/messages.d.ts.map +1 -0
- package/dist/pages/observability/activity/meta-items.d.ts +10 -0
- package/dist/pages/observability/activity/meta-items.d.ts.map +1 -0
- package/dist/pages/observability/activity/page.d.ts +6 -0
- package/dist/pages/observability/activity/page.d.ts.map +1 -0
- package/dist/pages/observability/activity/period.d.ts +31 -0
- package/dist/pages/observability/activity/period.d.ts.map +1 -0
- package/dist/pages/observability/activity/steps.d.ts +44 -0
- package/dist/pages/observability/activity/steps.d.ts.map +1 -0
- package/dist/pages/observability/activity/timeline.d.ts +36 -0
- package/dist/pages/observability/activity/timeline.d.ts.map +1 -0
- package/dist/pages/observability/activity/users.d.ts +18 -0
- package/dist/pages/observability/activity/users.d.ts.map +1 -0
- package/dist/pages/observability/ai-usage/calls.d.ts +27 -0
- package/dist/pages/observability/ai-usage/calls.d.ts.map +1 -0
- package/dist/pages/observability/ai-usage/charts.d.ts +23 -0
- package/dist/pages/observability/ai-usage/charts.d.ts.map +1 -0
- package/dist/pages/observability/ai-usage/format.d.ts +101 -0
- package/dist/pages/observability/ai-usage/format.d.ts.map +1 -0
- package/dist/pages/observability/ai-usage/limits.d.ts +12 -0
- package/dist/pages/observability/ai-usage/limits.d.ts.map +1 -0
- package/dist/pages/observability/ai-usage/messages.d.ts +431 -0
- package/dist/pages/observability/ai-usage/messages.d.ts.map +1 -0
- package/dist/pages/observability/ai-usage/page.d.ts +6 -0
- package/dist/pages/observability/ai-usage/page.d.ts.map +1 -0
- package/dist/pages/observability/live-updates.d.ts +3 -0
- package/dist/pages/observability/live-updates.d.ts.map +1 -0
- package/dist/pages/observability/logs.d.ts +11 -0
- package/dist/pages/observability/logs.d.ts.map +1 -0
- package/dist/pages/observability/messages.d.ts +329 -0
- package/dist/pages/observability/messages.d.ts.map +1 -0
- package/dist/pages/observability/runs.d.ts +7 -0
- package/dist/pages/observability/runs.d.ts.map +1 -0
- package/dist/pages/observability/workflow-run.d.ts +6 -0
- package/dist/pages/observability/workflow-run.d.ts.map +1 -0
- package/dist/pages/ontology/actions.d.ts +3 -0
- package/dist/pages/ontology/actions.d.ts.map +1 -0
- package/dist/pages/ontology/components/action-button.d.ts +12 -0
- package/dist/pages/ontology/components/action-button.d.ts.map +1 -0
- package/dist/pages/ontology/components/action-param-null-control.d.ts +7 -0
- package/dist/pages/ontology/components/action-param-null-control.d.ts.map +1 -0
- package/dist/pages/ontology/components/collection-toolbar.d.ts +21 -0
- package/dist/pages/ontology/components/collection-toolbar.d.ts.map +1 -0
- package/dist/pages/ontology/components/common.d.ts +16 -0
- package/dist/pages/ontology/components/common.d.ts.map +1 -0
- package/dist/pages/ontology/components/file-ref-upload-field.d.ts +13 -0
- package/dist/pages/ontology/components/file-ref-upload-field.d.ts.map +1 -0
- package/dist/pages/ontology/components/object-filter-popover.d.ts +9 -0
- package/dist/pages/ontology/components/object-filter-popover.d.ts.map +1 -0
- package/dist/pages/ontology/components/object-icon.d.ts +7 -0
- package/dist/pages/ontology/components/object-icon.d.ts.map +1 -0
- package/dist/pages/ontology/components/object-query-bar.d.ts +21 -0
- package/dist/pages/ontology/components/object-query-bar.d.ts.map +1 -0
- package/dist/pages/ontology/components/telemetry-chart.d.ts +18 -0
- package/dist/pages/ontology/components/telemetry-chart.d.ts.map +1 -0
- package/dist/pages/ontology/components/telemetry-grid.d.ts +19 -0
- package/dist/pages/ontology/components/telemetry-grid.d.ts.map +1 -0
- package/dist/pages/ontology/components/telemetry-tile.d.ts +18 -0
- package/dist/pages/ontology/components/telemetry-tile.d.ts.map +1 -0
- package/dist/pages/ontology/components/telemetry-value.d.ts +10 -0
- package/dist/pages/ontology/components/telemetry-value.d.ts.map +1 -0
- package/dist/pages/ontology/components/usage-bar.d.ts +12 -0
- package/dist/pages/ontology/components/usage-bar.d.ts.map +1 -0
- package/dist/pages/ontology/graph.d.ts +6 -0
- package/dist/pages/ontology/graph.d.ts.map +1 -0
- package/dist/pages/ontology/hooks/object-live-updates.d.ts +5 -0
- package/dist/pages/ontology/hooks/object-live-updates.d.ts.map +1 -0
- package/dist/pages/ontology/hooks/object-telemetry-updates.d.ts +8 -0
- package/dist/pages/ontology/hooks/object-telemetry-updates.d.ts.map +1 -0
- package/dist/pages/ontology/hooks/object-type-counts.d.ts +5 -0
- package/dist/pages/ontology/hooks/object-type-counts.d.ts.map +1 -0
- package/dist/pages/ontology/hooks/rule-live-updates.d.ts +9 -0
- package/dist/pages/ontology/hooks/rule-live-updates.d.ts.map +1 -0
- package/dist/pages/ontology/hooks/workflow-live-updates.d.ts +6 -0
- package/dist/pages/ontology/hooks/workflow-live-updates.d.ts.map +1 -0
- package/dist/pages/ontology/lib/action-params.d.ts +55 -0
- package/dist/pages/ontology/lib/action-params.d.ts.map +1 -0
- package/dist/pages/ontology/lib/format-value.d.ts +3 -0
- package/dist/pages/ontology/lib/format-value.d.ts.map +1 -0
- package/dist/pages/ontology/lib/labels.d.ts +3 -0
- package/dist/pages/ontology/lib/labels.d.ts.map +1 -0
- package/dist/pages/ontology/lib/live-update-keys.d.ts +15 -0
- package/dist/pages/ontology/lib/live-update-keys.d.ts.map +1 -0
- package/dist/pages/ontology/lib/object-query.d.ts +72 -0
- package/dist/pages/ontology/lib/object-query.d.ts.map +1 -0
- package/dist/pages/ontology/lib/ontology-graph-layout.d.ts +68 -0
- package/dist/pages/ontology/lib/ontology-graph-layout.d.ts.map +1 -0
- package/dist/pages/ontology/lib/ontology-graph-links.d.ts +4 -0
- package/dist/pages/ontology/lib/ontology-graph-links.d.ts.map +1 -0
- package/dist/pages/ontology/lib/telemetry-history.d.ts +10 -0
- package/dist/pages/ontology/lib/telemetry-history.d.ts.map +1 -0
- package/dist/pages/ontology/lib/time.d.ts +3 -0
- package/dist/pages/ontology/lib/time.d.ts.map +1 -0
- package/dist/pages/ontology/lib/user-preferences.d.ts +8 -0
- package/dist/pages/ontology/lib/user-preferences.d.ts.map +1 -0
- package/dist/pages/ontology/object-page.d.ts +7 -0
- package/dist/pages/ontology/object-page.d.ts.map +1 -0
- package/dist/pages/ontology/object-type.d.ts +3 -0
- package/dist/pages/ontology/object-type.d.ts.map +1 -0
- package/dist/pages/ontology/object-types.d.ts +7 -0
- package/dist/pages/ontology/object-types.d.ts.map +1 -0
- package/dist/pages/ontology/objects.d.ts +6 -0
- package/dist/pages/ontology/objects.d.ts.map +1 -0
- package/dist/pages/ontology/rules.d.ts +32 -0
- package/dist/pages/ontology/rules.d.ts.map +1 -0
- package/dist/pages/ontology/workflow.d.ts +6 -0
- package/dist/pages/ontology/workflow.d.ts.map +1 -0
- package/dist/pages/ontology/workflows/agent-execution-panel.d.ts +17 -0
- package/dist/pages/ontology/workflows/agent-execution-panel.d.ts.map +1 -0
- package/dist/pages/ontology/workflows/intervention-panel.d.ts +5 -0
- package/dist/pages/ontology/workflows/intervention-panel.d.ts.map +1 -0
- package/dist/pages/ontology/workflows/node-execution-panel.d.ts +11 -0
- package/dist/pages/ontology/workflows/node-execution-panel.d.ts.map +1 -0
- package/dist/pages/ontology/workflows/request-run-dialog.d.ts +5 -0
- package/dist/pages/ontology/workflows/request-run-dialog.d.ts.map +1 -0
- package/dist/pages/ontology/workflows/run-debug-section.d.ts +11 -0
- package/dist/pages/ontology/workflows/run-debug-section.d.ts.map +1 -0
- package/dist/pages/ontology/workflows/run-input-form.d.ts +18 -0
- package/dist/pages/ontology/workflows/run-input-form.d.ts.map +1 -0
- package/dist/pages/ontology/workflows/run-progress.d.ts +15 -0
- package/dist/pages/ontology/workflows/run-progress.d.ts.map +1 -0
- package/dist/pages/ontology/workflows/schema-shape.d.ts +10 -0
- package/dist/pages/ontology/workflows/schema-shape.d.ts.map +1 -0
- package/dist/pages/ontology/workflows/status-badge.d.ts +5 -0
- package/dist/pages/ontology/workflows/status-badge.d.ts.map +1 -0
- package/dist/pages/ontology/workflows/utils.d.ts +29 -0
- package/dist/pages/ontology/workflows/utils.d.ts.map +1 -0
- package/dist/pages/ontology/workflows/workflow-card.d.ts +5 -0
- package/dist/pages/ontology/workflows/workflow-card.d.ts.map +1 -0
- package/dist/pages/ontology/workflows.d.ts +3 -0
- package/dist/pages/ontology/workflows.d.ts.map +1 -0
- package/dist/pages/routes.d.ts +26 -0
- package/dist/pages/routes.d.ts.map +1 -0
- package/dist/pages/section-page.d.ts +91 -0
- package/dist/pages/section-page.d.ts.map +1 -0
- package/dist/pages/section-ui.d.ts +212 -0
- package/dist/pages/section-ui.d.ts.map +1 -0
- package/dist/pages/settings/controls.d.ts +94 -0
- package/dist/pages/settings/controls.d.ts.map +1 -0
- package/dist/pages/settings/developers.d.ts +3 -0
- package/dist/pages/settings/developers.d.ts.map +1 -0
- package/dist/pages/settings/members.d.ts +3 -0
- package/dist/pages/settings/members.d.ts.map +1 -0
- package/dist/pages/settings/messages.d.ts +538 -0
- package/dist/pages/settings/messages.d.ts.map +1 -0
- package/dist/pages/settings/personal.d.ts +6 -0
- package/dist/pages/settings/personal.d.ts.map +1 -0
- package/dist/pages/settings/service-accounts.d.ts +3 -0
- package/dist/pages/settings/service-accounts.d.ts.map +1 -0
- package/dist/pages/settings/sessions.d.ts +3 -0
- package/dist/pages/settings/sessions.d.ts.map +1 -0
- package/dist/pages/values.d.ts +77 -0
- package/dist/pages/values.d.ts.map +1 -0
- package/dist/pages.d.ts +45 -0
- package/dist/pages.d.ts.map +1 -0
- package/dist/pages.js +26029 -0
- package/dist/pages.js.map +98 -0
- package/dist/runtime.d.ts +0 -2
- package/dist/runtime.d.ts.map +1 -1
- package/dist/sections/catalog.d.ts +37 -0
- package/dist/sections/catalog.d.ts.map +1 -0
- package/dist/sections/counts.d.ts +7 -0
- package/dist/sections/counts.d.ts.map +1 -0
- package/dist/sections/sections.d.ts +67 -0
- package/dist/sections/sections.d.ts.map +1 -0
- package/dist/server.d.ts +8 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +3036 -0
- package/dist/server.js.map +19 -0
- package/dist/session.d.ts +18 -0
- package/dist/session.d.ts.map +1 -0
- package/dist/shell/agent-dock.d.ts +7 -0
- package/dist/shell/agent-dock.d.ts.map +1 -0
- package/dist/shell/app-shell.d.ts +42 -0
- package/dist/shell/app-shell.d.ts.map +1 -0
- package/dist/shell/brand.d.ts +15 -0
- package/dist/shell/brand.d.ts.map +1 -0
- package/dist/shell/nav-items.d.ts +34 -0
- package/dist/shell/nav-items.d.ts.map +1 -0
- package/dist/shell/search-command.d.ts +12 -0
- package/dist/shell/search-command.d.ts.map +1 -0
- package/dist/shell/section-nav.d.ts +13 -0
- package/dist/shell/section-nav.d.ts.map +1 -0
- package/dist/shell/user-menu.d.ts +25 -0
- package/dist/shell/user-menu.d.ts.map +1 -0
- package/dist/tailwind.d.ts +4 -4
- package/dist/tailwind.d.ts.map +1 -1
- package/package.json +22 -21
- package/src/agent/activity-label.ts +70 -0
- package/src/agent/agent-chat.tsx +248 -0
- package/src/agent/agent-context-provider.tsx +92 -0
- package/src/agent/agent-execution-trace.tsx +316 -0
- package/src/agent/agent-panel.tsx +74 -0
- package/src/agent/agent-surface-state.ts +113 -0
- package/src/agent/agent-surface.tsx +363 -0
- package/src/agent/agent.css +231 -0
- package/src/agent/agents-page.ts +7 -0
- package/src/agent/artifact-card.tsx +190 -0
- package/src/agent/artifact-panel-state.ts +38 -0
- package/src/agent/artifact-panel.tsx +320 -0
- package/src/agent/bash/bash-tool-view.tsx +288 -0
- package/src/agent/bash/data.ts +137 -0
- package/src/agent/bash/interpret.ts +769 -0
- package/src/agent/bash/renderers.tsx +503 -0
- package/src/agent/bash/shell.ts +195 -0
- package/src/agent/components/activity-status.tsx +86 -0
- package/src/agent/components/agent-thread-switcher.tsx +346 -0
- package/src/agent/components/composer.tsx +870 -0
- package/src/agent/components/context-chips.tsx +63 -0
- package/src/agent/components/context-picker.tsx +88 -0
- package/src/agent/components/conversation-panel.tsx +352 -0
- package/src/agent/components/file-attachment-card.tsx +136 -0
- package/src/agent/components/message-parts.tsx +305 -0
- package/src/agent/components/message-view.tsx +422 -0
- package/src/agent/components/model-controls.tsx +204 -0
- package/src/agent/components/model-picker-row.tsx +136 -0
- package/src/agent/components/provider-logo.tsx +31 -0
- package/src/agent/components/provider-logos.ts +24 -0
- package/src/agent/components/reasoning-effort-slider.tsx +121 -0
- package/src/agent/components/sandbox-recovery.tsx +49 -0
- package/src/agent/components/thread-artifacts-menu.tsx +77 -0
- package/src/agent/components/transcript.tsx +239 -0
- package/src/agent/components/web-fetch-tool-view.tsx +69 -0
- package/src/agent/components/web-search-tool-view.tsx +37 -0
- package/src/agent/components/web-sources.tsx +159 -0
- package/src/agent/format.ts +60 -0
- package/src/agent/hooks/use-agent-conversation.ts +536 -0
- package/src/agent/hooks/use-thread-stream.ts +121 -0
- package/src/agent/i18n/en.ts +500 -0
- package/src/agent/i18n/fr.ts +530 -0
- package/src/agent/i18n/index.ts +14 -0
- package/src/agent/live-run.ts +257 -0
- package/src/agent/model-selection.ts +88 -0
- package/src/agent/object-context-title.ts +57 -0
- package/src/agent/parts.ts +119 -0
- package/src/agent/publish-artifact/interpret.ts +110 -0
- package/src/agent/publish-artifact/publish-artifact-tool-view.tsx +62 -0
- package/src/agent/publish-artifact/use-live-publishes.ts +45 -0
- package/src/agent/react-router.tsx +103 -0
- package/src/agent/read/interpret.ts +101 -0
- package/src/agent/read/read-tool-view.tsx +92 -0
- package/src/agent/requester-settings.ts +55 -0
- package/src/agent/run-presentation.ts +211 -0
- package/src/agent/thread-navigation.ts +11 -0
- package/src/agent/types.ts +37 -0
- package/src/agent/utils/context-display.ts +72 -0
- package/src/agent/utils/context-mention.ts +28 -0
- package/src/agent/utils/web-fetch.ts +20 -0
- package/src/agent/utils/web-search.ts +106 -0
- package/src/agent/view-file/interpret.ts +22 -0
- package/src/agent/view-file/view-file-tool-view.tsx +123 -0
- package/src/artifacts/artifact-page.tsx +61 -0
- package/src/artifacts/artifacts.css +172 -0
- package/src/artifacts/card-details.ts +92 -0
- package/src/artifacts/card-preview.tsx +612 -0
- package/src/artifacts/copy-feedback.ts +25 -0
- package/src/artifacts/file-size.ts +24 -0
- package/src/artifacts/file-source.ts +109 -0
- package/src/artifacts/file-view.ts +57 -0
- package/src/artifacts/frame.tsx +288 -0
- package/src/artifacts/gallery.tsx +405 -0
- package/src/artifacts/kind-icon.tsx +23 -0
- package/src/artifacts/markdown-tree.ts +32 -0
- package/src/artifacts/messages.ts +317 -0
- package/src/artifacts/queries.ts +85 -0
- package/src/artifacts/references/embed-tree.ts +86 -0
- package/src/artifacts/references/references.tsx +739 -0
- package/src/artifacts/renderers/document-tree.ts +157 -0
- package/src/artifacts/renderers/document.tsx +334 -0
- package/src/artifacts/renderers/file.tsx +160 -0
- package/src/artifacts/renderers/notice.tsx +38 -0
- package/src/artifacts/renderers/sheet/chart-data.ts +73 -0
- package/src/artifacts/renderers/sheet/chart.tsx +288 -0
- package/src/artifacts/renderers/sheet/format.ts +142 -0
- package/src/artifacts/renderers/sheet/grid.tsx +709 -0
- package/src/artifacts/renderers/sheet/mini-chart.tsx +241 -0
- package/src/artifacts/renderers/sheet/model.ts +136 -0
- package/src/artifacts/renderers/sheet/selection.ts +152 -0
- package/src/artifacts/renderers/sheet/sheet.tsx +471 -0
- package/src/artifacts/renderers/sheet/virtual.ts +49 -0
- package/src/artifacts/renderers/sheet/workbook.ts +57 -0
- package/src/artifacts/renderers/slides/navigation.ts +38 -0
- package/src/artifacts/renderers/slides/slides.tsx +441 -0
- package/src/artifacts/target.ts +76 -0
- package/src/artifacts/theme.ts +29 -0
- package/src/artifacts/viewer.tsx +476 -0
- package/src/build.ts +13 -2
- package/src/codegen.ts +98 -80
- package/src/createCustomApp.ts +175 -67
- package/src/index.ts +47 -16
- package/src/locale-messages.ts +128 -12
- package/src/locale.ts +1 -2
- package/src/metadata.ts +35 -1
- package/src/pages/canvas.css +43 -0
- package/src/pages/data/connectors.tsx +317 -0
- package/src/pages/data/datasets.tsx +731 -0
- package/src/pages/data/live-updates.ts +71 -0
- package/src/pages/data/messages.ts +349 -0
- package/src/pages/data/pipeline-canvas.tsx +288 -0
- package/src/pages/data/pipelines.tsx +710 -0
- package/src/pages/data/projections.tsx +482 -0
- package/src/pages/data/schema.tsx +62 -0
- package/src/pages/data/shared.tsx +78 -0
- package/src/pages/data/sync-button.tsx +103 -0
- package/src/pages/data/syncs.tsx +326 -0
- package/src/pages/home.tsx +64 -0
- package/src/pages/mosaic.tsx +97 -0
- package/src/pages/observability/action-run.tsx +229 -0
- package/src/pages/observability/activity/calendar.tsx +239 -0
- package/src/pages/observability/activity/connections.tsx +144 -0
- package/src/pages/observability/activity/format.ts +49 -0
- package/src/pages/observability/activity/messages.ts +255 -0
- package/src/pages/observability/activity/meta-items.tsx +23 -0
- package/src/pages/observability/activity/page.tsx +605 -0
- package/src/pages/observability/activity/period.ts +63 -0
- package/src/pages/observability/activity/steps.ts +102 -0
- package/src/pages/observability/activity/timeline.tsx +411 -0
- package/src/pages/observability/activity/users.tsx +133 -0
- package/src/pages/observability/ai-usage/calls.tsx +541 -0
- package/src/pages/observability/ai-usage/charts.tsx +126 -0
- package/src/pages/observability/ai-usage/format.ts +276 -0
- package/src/pages/observability/ai-usage/limits.tsx +629 -0
- package/src/pages/observability/ai-usage/messages.ts +446 -0
- package/src/pages/observability/ai-usage/page.tsx +814 -0
- package/src/pages/observability/live-updates.ts +19 -0
- package/src/pages/observability/logs.tsx +617 -0
- package/src/pages/observability/messages.ts +336 -0
- package/src/pages/observability/runs.tsx +732 -0
- package/src/pages/observability/workflow-run.tsx +323 -0
- package/src/pages/ontology/actions.tsx +749 -0
- package/src/pages/ontology/components/action-button.tsx +355 -0
- package/src/pages/ontology/components/action-param-null-control.tsx +35 -0
- package/src/pages/ontology/components/collection-toolbar.tsx +61 -0
- package/src/pages/ontology/components/common.tsx +60 -0
- package/src/pages/ontology/components/file-ref-upload-field.tsx +279 -0
- package/src/pages/ontology/components/object-filter-popover.tsx +311 -0
- package/src/pages/ontology/components/object-icon.tsx +133 -0
- package/src/pages/ontology/components/object-query-bar.tsx +217 -0
- package/src/pages/ontology/components/telemetry-chart.tsx +392 -0
- package/src/pages/ontology/components/telemetry-grid.tsx +137 -0
- package/src/pages/ontology/components/telemetry-tile.tsx +164 -0
- package/src/pages/ontology/components/telemetry-value.tsx +91 -0
- package/src/pages/ontology/components/usage-bar.tsx +64 -0
- package/src/pages/ontology/graph.tsx +1283 -0
- package/src/pages/ontology/hooks/object-live-updates.ts +53 -0
- package/src/pages/ontology/hooks/object-telemetry-updates.ts +45 -0
- package/src/pages/ontology/hooks/object-type-counts.ts +27 -0
- package/src/pages/ontology/hooks/rule-live-updates.ts +28 -0
- package/src/pages/ontology/hooks/workflow-live-updates.ts +20 -0
- package/src/pages/ontology/lib/action-params.ts +231 -0
- package/src/pages/ontology/lib/format-value.ts +34 -0
- package/src/pages/ontology/lib/labels.ts +50 -0
- package/src/pages/ontology/lib/live-update-keys.ts +62 -0
- package/src/pages/ontology/lib/object-query.ts +372 -0
- package/src/pages/ontology/lib/ontology-graph-layout.ts +1004 -0
- package/src/pages/ontology/lib/ontology-graph-links.ts +15 -0
- package/src/pages/ontology/lib/telemetry-history.ts +56 -0
- package/src/pages/ontology/lib/time.ts +23 -0
- package/src/pages/ontology/lib/user-preferences.ts +52 -0
- package/src/pages/ontology/object-page.tsx +1029 -0
- package/src/pages/ontology/object-type.tsx +910 -0
- package/src/pages/ontology/object-types.tsx +240 -0
- package/src/pages/ontology/objects.tsx +938 -0
- package/src/pages/ontology/rules.tsx +805 -0
- package/src/pages/ontology/workflow.tsx +1485 -0
- package/src/pages/ontology/workflows/agent-execution-panel.tsx +340 -0
- package/src/pages/ontology/workflows/intervention-panel.tsx +261 -0
- package/src/pages/ontology/workflows/node-execution-panel.tsx +86 -0
- package/src/pages/ontology/workflows/request-run-dialog.tsx +197 -0
- package/src/pages/ontology/workflows/run-debug-section.tsx +54 -0
- package/src/pages/ontology/workflows/run-input-form.tsx +900 -0
- package/src/pages/ontology/workflows/run-progress.tsx +83 -0
- package/src/pages/ontology/workflows/schema-shape.tsx +206 -0
- package/src/pages/ontology/workflows/status-badge.tsx +15 -0
- package/src/pages/ontology/workflows/utils.ts +107 -0
- package/src/pages/ontology/workflows/workflow-card.tsx +48 -0
- package/src/pages/ontology/workflows.tsx +143 -0
- package/src/pages/routes.ts +63 -0
- package/src/pages/section-page.tsx +272 -0
- package/src/pages/section-ui.tsx +773 -0
- package/src/pages/settings/controls.tsx +721 -0
- package/src/pages/settings/developers.tsx +163 -0
- package/src/pages/settings/members.tsx +1018 -0
- package/src/pages/settings/messages.ts +551 -0
- package/src/pages/settings/personal.tsx +97 -0
- package/src/pages/settings/service-accounts.tsx +623 -0
- package/src/pages/settings/sessions.tsx +183 -0
- package/src/pages/values.tsx +700 -0
- package/src/pages.ts +59 -0
- package/src/runtime.ts +0 -3
- package/src/sections/catalog.ts +182 -0
- package/src/sections/counts.ts +33 -0
- package/src/sections/sections.tsx +259 -0
- package/src/server.ts +19 -0
- package/src/session.ts +29 -0
- package/src/shell/agent-dock.tsx +32 -0
- package/src/shell/app-shell.tsx +142 -0
- package/src/shell/brand.tsx +47 -0
- package/src/shell/nav-items.tsx +136 -0
- package/src/shell/search-command.tsx +160 -0
- package/src/shell/section-nav.tsx +61 -0
- package/src/shell/user-menu.tsx +206 -0
- package/src/tailwind.ts +4 -4
- package/dist/agents.d.ts +0 -11
- package/dist/agents.d.ts.map +0 -1
- package/dist/agents.js +0 -41
- package/dist/agents.js.map +0 -10
- package/dist/auth.js +0 -3
- package/dist/auth.js.map +0 -9
- package/dist/browser.d.ts +0 -3
- package/dist/browser.d.ts.map +0 -1
- package/dist/browser.js +0 -9
- package/dist/browser.js.map +0 -9
- package/dist/chunk-cftmy40z.js +0 -70
- package/dist/chunk-cftmy40z.js.map +0 -10
- package/dist/chunk-e1gj8c1a.js +0 -8
- package/dist/chunk-e1gj8c1a.js.map +0 -10
- package/src/agents.ts +0 -48
- package/src/browser.ts +0 -2
|
@@ -0,0 +1,612 @@
|
|
|
1
|
+
import { type CsvTable, parseCsv, type WorkbookChart } from "@sixb/core/artifacts"
|
|
2
|
+
import { useLocale } from "@sixb/ui/lib/i18n"
|
|
3
|
+
import { cn } from "@sixb/ui/lib/utils"
|
|
4
|
+
import { AreaChart as AreaIcon, ChartColumn, ChartLine, ChartPie } from "lucide-react"
|
|
5
|
+
import { type ReactNode, useMemo } from "react"
|
|
6
|
+
import { fileExtension, versionSummary } from "./card-details"
|
|
7
|
+
import { formatFileSize } from "./file-size"
|
|
8
|
+
import type { FileSource } from "./file-source"
|
|
9
|
+
import { fileView } from "./file-view"
|
|
10
|
+
import { ArtifactKindIcon, type ArtifactKindName } from "./kind-icon"
|
|
11
|
+
import { useArtifactMessages } from "./messages"
|
|
12
|
+
import { type ArtifactVersion, useArtifactTheme, useFileText, versionFileSource } from "./queries"
|
|
13
|
+
import { chartData } from "./renderers/sheet/chart-data"
|
|
14
|
+
import { previewFormatter } from "./renderers/sheet/format"
|
|
15
|
+
import { MiniChart } from "./renderers/sheet/mini-chart"
|
|
16
|
+
import { fileSheetModel, type SheetModel } from "./renderers/sheet/model"
|
|
17
|
+
import { useSheetModel, useWorkbook } from "./renderers/sheet/workbook"
|
|
18
|
+
import { artifactThemeAttributes } from "./theme"
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* How much of a text a preview reads: a table's first rows, a document's opening, or a text's
|
|
22
|
+
* first lines. The file itself is fetched whole, so a chart, which draws every row, reads it all.
|
|
23
|
+
*/
|
|
24
|
+
const EXCERPT_CHARACTERS = 2_000
|
|
25
|
+
const PREVIEW_COLUMNS = 3
|
|
26
|
+
const TAB_LIMIT = 4
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* What a card shows of an artifact, at a size that reads: a workbook's first chart or first rows
|
|
30
|
+
* above its tabs, a document's title and lede in its own type and theme, an image, the start of a
|
|
31
|
+
* text, or a file's format. It fills the pane the card gives it.
|
|
32
|
+
*/
|
|
33
|
+
export function ArtifactPreview({
|
|
34
|
+
version,
|
|
35
|
+
kind,
|
|
36
|
+
loading,
|
|
37
|
+
}: {
|
|
38
|
+
readonly version: ArtifactVersion | undefined
|
|
39
|
+
readonly kind: ArtifactKindName
|
|
40
|
+
readonly loading: boolean
|
|
41
|
+
}) {
|
|
42
|
+
if (!version) return <Skeleton pulse={loading} />
|
|
43
|
+
return <VersionPreview version={version} kind={kind} />
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* A card's face, wherever an artifact shows as a card: its preview above its kind, its title, and
|
|
48
|
+
* what it holds. The control around it decides what a click does.
|
|
49
|
+
*/
|
|
50
|
+
export function ArtifactCardFace({
|
|
51
|
+
kind,
|
|
52
|
+
title,
|
|
53
|
+
version,
|
|
54
|
+
loading,
|
|
55
|
+
}: {
|
|
56
|
+
readonly kind: ArtifactKindName
|
|
57
|
+
readonly title: string
|
|
58
|
+
readonly version: ArtifactVersion | undefined
|
|
59
|
+
readonly loading: boolean
|
|
60
|
+
}) {
|
|
61
|
+
const locale = useLocale()
|
|
62
|
+
const messages = useArtifactMessages()
|
|
63
|
+
return (
|
|
64
|
+
<>
|
|
65
|
+
<span
|
|
66
|
+
aria-hidden="true"
|
|
67
|
+
className="relative block h-[7.75rem] overflow-hidden border-b border-border/70"
|
|
68
|
+
>
|
|
69
|
+
<ArtifactPreview kind={kind} version={version} loading={loading} />
|
|
70
|
+
</span>
|
|
71
|
+
<ArtifactLabel
|
|
72
|
+
title={title}
|
|
73
|
+
detail={version ? versionSummary(version, messages, locale) : messages.kinds[kind]}
|
|
74
|
+
icon={<ArtifactKindIcon kind={kind} className="size-4 shrink-0 text-muted-foreground" />}
|
|
75
|
+
className="px-3.5 py-3"
|
|
76
|
+
/>
|
|
77
|
+
</>
|
|
78
|
+
)
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* An artifact's title over a line about it, beside an icon, as its cards and lines show it. What
|
|
83
|
+
* comes `after` the line, such as a date, stays whole where the line itself is cut off.
|
|
84
|
+
*/
|
|
85
|
+
export function ArtifactLabel({
|
|
86
|
+
title,
|
|
87
|
+
detail,
|
|
88
|
+
after,
|
|
89
|
+
icon,
|
|
90
|
+
large = false,
|
|
91
|
+
className,
|
|
92
|
+
}: {
|
|
93
|
+
readonly title: string
|
|
94
|
+
readonly detail: string
|
|
95
|
+
readonly after?: ReactNode
|
|
96
|
+
readonly icon: ReactNode
|
|
97
|
+
/** The gallery's size, a step up from a conversation's. */
|
|
98
|
+
readonly large?: boolean
|
|
99
|
+
readonly className?: string
|
|
100
|
+
}) {
|
|
101
|
+
return (
|
|
102
|
+
<span className={cn("flex min-w-0 items-center gap-2.5", className)}>
|
|
103
|
+
{icon}
|
|
104
|
+
<span className={cn("flex min-w-0 flex-1 flex-col", large && "gap-0.5")}>
|
|
105
|
+
{/* `cn` drops a line height that comes before a font size, so each size comes first. */}
|
|
106
|
+
<span
|
|
107
|
+
className={cn(
|
|
108
|
+
large ? "text-[14px]" : "text-[13.5px]",
|
|
109
|
+
"truncate leading-snug font-medium text-foreground"
|
|
110
|
+
)}
|
|
111
|
+
title={title}
|
|
112
|
+
>
|
|
113
|
+
{title}
|
|
114
|
+
</span>
|
|
115
|
+
<span
|
|
116
|
+
className={cn(
|
|
117
|
+
large ? "text-[12.5px]" : "text-[12px]",
|
|
118
|
+
"flex min-w-0 items-center gap-1.5 leading-snug text-muted-foreground tabular-nums"
|
|
119
|
+
)}
|
|
120
|
+
>
|
|
121
|
+
<span className="truncate">{detail}</span>
|
|
122
|
+
{after}
|
|
123
|
+
</span>
|
|
124
|
+
</span>
|
|
125
|
+
</span>
|
|
126
|
+
)
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
function VersionPreview({
|
|
130
|
+
version,
|
|
131
|
+
kind,
|
|
132
|
+
}: {
|
|
133
|
+
readonly version: ArtifactVersion
|
|
134
|
+
readonly kind: ArtifactKindName
|
|
135
|
+
}) {
|
|
136
|
+
// The artifact's own theme, so a dark or branded document previews the way it opens. A file
|
|
137
|
+
// artifact named `theme.json` is that file, not a theme.
|
|
138
|
+
const ownTheme = useArtifactTheme(version)
|
|
139
|
+
const theme = artifactThemeAttributes(kind === "file" ? null : ownTheme)
|
|
140
|
+
const source = versionFileSource(version, version.entry)
|
|
141
|
+
return (
|
|
142
|
+
<div
|
|
143
|
+
className={cn("absolute inset-0 bg-card text-card-foreground", theme.className)}
|
|
144
|
+
style={theme.style}
|
|
145
|
+
>
|
|
146
|
+
{kind === "document" ? (
|
|
147
|
+
<DocumentPreview version={version} />
|
|
148
|
+
) : kind === "sheet" ? (
|
|
149
|
+
<WorkbookPreview version={version} />
|
|
150
|
+
) : kind === "slides" ? (
|
|
151
|
+
<DeckPreview version={version} />
|
|
152
|
+
) : source ? (
|
|
153
|
+
<FilePreview source={source} />
|
|
154
|
+
) : (
|
|
155
|
+
<Skeleton />
|
|
156
|
+
)}
|
|
157
|
+
</div>
|
|
158
|
+
)
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
function DocumentPreview({ version }: { readonly version: ArtifactVersion }) {
|
|
162
|
+
const { text, loading } = useFileText(versionFileSource(version, version.entry))
|
|
163
|
+
const opening = useMemo(() => (text === undefined ? null : documentOpening(text)), [text])
|
|
164
|
+
if (loading) return <Skeleton pulse />
|
|
165
|
+
const sections =
|
|
166
|
+
version.outline.kind === "document"
|
|
167
|
+
? version.outline.headings
|
|
168
|
+
.filter((heading) => heading.depth === 2)
|
|
169
|
+
.map((heading) => heading.text)
|
|
170
|
+
: []
|
|
171
|
+
// A document too large to preview, or one that did not load, still has its title and outline.
|
|
172
|
+
return (
|
|
173
|
+
<Opening title={opening?.title ?? version.title} lede={opening?.lede} sections={sections} />
|
|
174
|
+
)
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* A title set as the document sets it, and the lede beneath it; a document that opens without one
|
|
179
|
+
* shows the start of its outline instead.
|
|
180
|
+
*/
|
|
181
|
+
function Opening({
|
|
182
|
+
title,
|
|
183
|
+
lede,
|
|
184
|
+
sections = [],
|
|
185
|
+
}: {
|
|
186
|
+
readonly title: string
|
|
187
|
+
readonly lede?: string
|
|
188
|
+
readonly sections?: readonly string[]
|
|
189
|
+
}) {
|
|
190
|
+
return (
|
|
191
|
+
<Faded>
|
|
192
|
+
<span className="line-clamp-2 font-serif text-[18px] leading-[1.2] font-semibold tracking-[-0.01em] text-foreground">
|
|
193
|
+
{title}
|
|
194
|
+
</span>
|
|
195
|
+
{lede ? (
|
|
196
|
+
<span className="mt-1.5 line-clamp-3 text-[12px] leading-[1.5] text-muted-foreground">
|
|
197
|
+
{lede}
|
|
198
|
+
</span>
|
|
199
|
+
) : sections.length > 0 ? (
|
|
200
|
+
<span className="mt-2.5 flex flex-col gap-1 border-l border-border pl-2.5 text-[11.5px] leading-4 text-muted-foreground">
|
|
201
|
+
{sections.slice(0, 4).map((section, index) => (
|
|
202
|
+
<span key={`${index}:${section}`} className="truncate">
|
|
203
|
+
{section}
|
|
204
|
+
</span>
|
|
205
|
+
))}
|
|
206
|
+
</span>
|
|
207
|
+
) : null}
|
|
208
|
+
</Faded>
|
|
209
|
+
)
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/** A deck's first slide in miniature, on the ground a deck's card sets it on. */
|
|
213
|
+
function DeckPreview({ version }: { readonly version: ArtifactVersion }) {
|
|
214
|
+
return (
|
|
215
|
+
<span className="flex h-full items-center justify-center bg-muted/70 p-3">
|
|
216
|
+
<span className="relative aspect-video h-full max-w-full overflow-hidden rounded-[4px] bg-background shadow-[0_1px_2px_rgb(0_0_0/0.08),0_4px_14px_rgb(0_0_0/0.07)] ring-1 ring-black/[0.05] dark:ring-white/10">
|
|
217
|
+
<SlideFace version={version} />
|
|
218
|
+
</span>
|
|
219
|
+
</span>
|
|
220
|
+
)
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* A deck's first slide set as a title slide, from what publishing read of the deck: its title, and
|
|
225
|
+
* how many slides there are. It fills the slide it is put in, with type scaled to that slide's
|
|
226
|
+
* width, so it also stands in for a deck's live first slide until, or unless, that shows.
|
|
227
|
+
*/
|
|
228
|
+
export function SlideFace({ version }: { readonly version: ArtifactVersion }) {
|
|
229
|
+
const messages = useArtifactMessages().slides
|
|
230
|
+
const slides = version.outline.kind === "slides" ? version.outline.slides : []
|
|
231
|
+
const title = slides.find((slide) => slide.title)?.title ?? version.title
|
|
232
|
+
return (
|
|
233
|
+
<span className="@container absolute inset-0 flex flex-col justify-center px-[9%]">
|
|
234
|
+
<span className="line-clamp-3 text-[7.3cqw] leading-[1.15] font-semibold tracking-[-0.015em] text-foreground">
|
|
235
|
+
{title}
|
|
236
|
+
</span>
|
|
237
|
+
<span className="mt-[3.4cqw] h-[1.7cqw] w-1/3 rounded-full bg-foreground/15" />
|
|
238
|
+
<span className="absolute right-[6%] bottom-[7%] text-[4.5cqw] text-muted-foreground tabular-nums">
|
|
239
|
+
{messages.position(1, slides.length)}
|
|
240
|
+
</span>
|
|
241
|
+
</span>
|
|
242
|
+
)
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
/**
|
|
246
|
+
* A workbook as a spreadsheet app shows one: its first chart, or its first sheet's first rows,
|
|
247
|
+
* above its tabs.
|
|
248
|
+
*/
|
|
249
|
+
function WorkbookPreview({ version }: { readonly version: ArtifactVersion }) {
|
|
250
|
+
const locale = useLocale()
|
|
251
|
+
const { workbook, loading: reading } = useWorkbook(version)
|
|
252
|
+
const chart = workbook?.charts[0]
|
|
253
|
+
const sheets = workbook?.sheets
|
|
254
|
+
const sheet = sheets?.find((entry) => entry.name === chart?.sheet) ?? sheets?.[0]
|
|
255
|
+
// The whole sheet, as the viewer reads it: a chart draws every row, and its latest value is the
|
|
256
|
+
// last row's.
|
|
257
|
+
const { model, loading } = useSheetModel(version, sheet)
|
|
258
|
+
const latest = useMemo(
|
|
259
|
+
() => (chart && model ? latestValue(chart, model, locale) : undefined),
|
|
260
|
+
[chart, model, locale]
|
|
261
|
+
)
|
|
262
|
+
if (!workbook || !model) return <Skeleton pulse={reading || loading} />
|
|
263
|
+
|
|
264
|
+
const tabs = [
|
|
265
|
+
...workbook.sheets.map((entry) => ({
|
|
266
|
+
key: `sheet:${entry.name}`,
|
|
267
|
+
label: entry.name,
|
|
268
|
+
chart: undefined,
|
|
269
|
+
active: !chart && entry.name === sheet?.name,
|
|
270
|
+
})),
|
|
271
|
+
...workbook.charts.map((entry) => ({
|
|
272
|
+
key: `chart:${entry.name}`,
|
|
273
|
+
label: entry.title ?? entry.name,
|
|
274
|
+
chart: entry.type,
|
|
275
|
+
active: entry.name === chart?.name,
|
|
276
|
+
})),
|
|
277
|
+
]
|
|
278
|
+
return (
|
|
279
|
+
<span className="flex h-full flex-col">
|
|
280
|
+
{chart ? (
|
|
281
|
+
<span className="flex min-h-0 flex-1 flex-col px-4 pt-3 pb-2.5">
|
|
282
|
+
<span className="flex items-baseline gap-2 text-[11.5px]">
|
|
283
|
+
<span className="min-w-0 flex-1 truncate font-medium text-foreground">
|
|
284
|
+
{chart.title ?? chart.name}
|
|
285
|
+
</span>
|
|
286
|
+
{latest ? (
|
|
287
|
+
<span className="shrink-0 font-semibold text-foreground tabular-nums">{latest}</span>
|
|
288
|
+
) : null}
|
|
289
|
+
</span>
|
|
290
|
+
<span className="mt-2 min-h-0 flex-1">
|
|
291
|
+
<MiniChart chart={chart} model={model} />
|
|
292
|
+
</span>
|
|
293
|
+
</span>
|
|
294
|
+
) : (
|
|
295
|
+
<span className="min-h-0 flex-1 overflow-hidden">
|
|
296
|
+
<TablePreview model={model} rows={3} />
|
|
297
|
+
</span>
|
|
298
|
+
)}
|
|
299
|
+
<span className="flex h-[22px] shrink-0 items-stretch overflow-hidden border-t border-border/70 bg-muted/50 px-1.5 text-[10.5px] [mask-image:linear-gradient(to_right,black_85%,transparent)]">
|
|
300
|
+
{tabs.slice(0, TAB_LIMIT).map((tab) => (
|
|
301
|
+
<span
|
|
302
|
+
key={tab.key}
|
|
303
|
+
className={cn(
|
|
304
|
+
"flex max-w-28 shrink-0 items-center gap-1 px-2",
|
|
305
|
+
tab.active
|
|
306
|
+
? "bg-card font-medium text-foreground shadow-[1px_0_0_var(--border),-1px_0_0_var(--border)]"
|
|
307
|
+
: "text-muted-foreground"
|
|
308
|
+
)}
|
|
309
|
+
>
|
|
310
|
+
{tab.chart ? <ChartGlyph type={tab.chart} /> : null}
|
|
311
|
+
<span className="truncate">{tab.label}</span>
|
|
312
|
+
</span>
|
|
313
|
+
))}
|
|
314
|
+
{tabs.length > TAB_LIMIT ? (
|
|
315
|
+
<span className="flex shrink-0 items-center px-1.5 text-muted-foreground tabular-nums">
|
|
316
|
+
+{tabs.length - TAB_LIMIT}
|
|
317
|
+
</span>
|
|
318
|
+
) : null}
|
|
319
|
+
</span>
|
|
320
|
+
</span>
|
|
321
|
+
)
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
/** A chart's latest value, as its full view labels it: the last row's first series, for a glance. */
|
|
325
|
+
function latestValue(chart: WorkbookChart, model: SheetModel, locale: string): string | undefined {
|
|
326
|
+
if (chart.type === "pie") return undefined
|
|
327
|
+
const data = chartData(chart, model)
|
|
328
|
+
const series = data?.series[0]
|
|
329
|
+
const value = series ? data.rows.at(-1)?.[series.key] : undefined
|
|
330
|
+
return typeof value === "number" && series
|
|
331
|
+
? previewFormatter(series.column, locale)(String(value)).text
|
|
332
|
+
: undefined
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
function ChartGlyph({ type }: { readonly type: WorkbookChart["type"] }) {
|
|
336
|
+
const Icon =
|
|
337
|
+
type === "line"
|
|
338
|
+
? ChartLine
|
|
339
|
+
: type === "area"
|
|
340
|
+
? AreaIcon
|
|
341
|
+
: type === "pie"
|
|
342
|
+
? ChartPie
|
|
343
|
+
: ChartColumn
|
|
344
|
+
return <Icon className="size-3 shrink-0" aria-hidden="true" />
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
/** A table's first rows and columns, with numbers right-aligned and formatted for a glance. */
|
|
348
|
+
function TablePreview({
|
|
349
|
+
model,
|
|
350
|
+
rows: rowCount,
|
|
351
|
+
}: {
|
|
352
|
+
readonly model: SheetModel
|
|
353
|
+
readonly rows: number
|
|
354
|
+
}) {
|
|
355
|
+
const locale = useLocale()
|
|
356
|
+
const indexes = useMemo(() => previewColumns(model), [model])
|
|
357
|
+
const rows = useMemo(() => {
|
|
358
|
+
const formatters = indexes.map((index) => {
|
|
359
|
+
const column = model.columns[index]
|
|
360
|
+
return column ? previewFormatter(column, locale) : null
|
|
361
|
+
})
|
|
362
|
+
return model.rows
|
|
363
|
+
.slice(0, rowCount)
|
|
364
|
+
.map((row) =>
|
|
365
|
+
indexes.map((column, index) => formatters[index]?.(row[column] ?? "") ?? { text: "" })
|
|
366
|
+
)
|
|
367
|
+
}, [model, indexes, locale, rowCount])
|
|
368
|
+
const columns = indexes.flatMap((index) => model.columns[index] ?? [])
|
|
369
|
+
return (
|
|
370
|
+
<span
|
|
371
|
+
className="grid gap-x-3 gap-y-[3px] px-4 pt-3.5 text-[12px] leading-[18px] tabular-nums"
|
|
372
|
+
style={{
|
|
373
|
+
gridTemplateColumns: columns
|
|
374
|
+
.map((column, index) =>
|
|
375
|
+
index === 0 && !column.numeric ? "minmax(0,1.4fr)" : "minmax(0,1fr)"
|
|
376
|
+
)
|
|
377
|
+
.join(" "),
|
|
378
|
+
}}
|
|
379
|
+
>
|
|
380
|
+
{columns.map((column) => (
|
|
381
|
+
<span
|
|
382
|
+
key={column.name}
|
|
383
|
+
className={cn(
|
|
384
|
+
"min-w-0 truncate pb-0.5 text-[11px] font-medium text-muted-foreground",
|
|
385
|
+
column.numeric && "text-right"
|
|
386
|
+
)}
|
|
387
|
+
>
|
|
388
|
+
{column.name}
|
|
389
|
+
</span>
|
|
390
|
+
))}
|
|
391
|
+
{rows.flatMap((row, rowIndex) =>
|
|
392
|
+
row.map((cell, index) => (
|
|
393
|
+
<span
|
|
394
|
+
key={`${rowIndex}:${index}`}
|
|
395
|
+
className={cn(
|
|
396
|
+
"min-w-0 truncate",
|
|
397
|
+
columns[index]?.numeric && "text-right",
|
|
398
|
+
cell.negative ? "text-destructive" : "text-foreground"
|
|
399
|
+
)}
|
|
400
|
+
>
|
|
401
|
+
{cell.text}
|
|
402
|
+
</span>
|
|
403
|
+
))
|
|
404
|
+
)}
|
|
405
|
+
</span>
|
|
406
|
+
)
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
/**
|
|
410
|
+
* The columns a preview shows, in the sheet's order: the first, which usually names each row,
|
|
411
|
+
* then numbers, which read at a glance where text would be cut off, then whatever is left.
|
|
412
|
+
*/
|
|
413
|
+
export function previewColumns(model: SheetModel): number[] {
|
|
414
|
+
const rest = model.columns.map((_, index) => index).slice(1)
|
|
415
|
+
const numeric = rest.filter((index) => model.columns[index]?.numeric)
|
|
416
|
+
const others = rest.filter((index) => !model.columns[index]?.numeric)
|
|
417
|
+
const chosen = [...(model.columns.length > 0 ? [0] : []), ...numeric, ...others]
|
|
418
|
+
return chosen.slice(0, PREVIEW_COLUMNS).sort((a, b) => a - b)
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
/** A file as its type allows: the image, a table's first rows, a text's start, or its format. */
|
|
422
|
+
function FilePreview({ source }: { readonly source: FileSource }) {
|
|
423
|
+
const view = fileView(source.fileRef)
|
|
424
|
+
if (view === "image") {
|
|
425
|
+
return <img src={source.inlineUrl} alt="" className="absolute inset-0 size-full object-cover" />
|
|
426
|
+
}
|
|
427
|
+
if (view === "csv" || view === "tsv") return <FileTablePreview source={source} kind={view} />
|
|
428
|
+
if (view === "markdown" || view === "text") {
|
|
429
|
+
return <TextPreview source={source} markdown={view === "markdown"} />
|
|
430
|
+
}
|
|
431
|
+
return <FormatPreview source={source} />
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
function FileTablePreview({
|
|
435
|
+
source,
|
|
436
|
+
kind,
|
|
437
|
+
}: {
|
|
438
|
+
readonly source: FileSource
|
|
439
|
+
readonly kind: "csv" | "tsv"
|
|
440
|
+
}) {
|
|
441
|
+
const { text, loading } = useFileText(source)
|
|
442
|
+
const model = useMemo(() => {
|
|
443
|
+
const table = text === undefined ? null : tableStart(text, kind)
|
|
444
|
+
return table ? fileSheetModel(source.name, table) : null
|
|
445
|
+
}, [text, kind, source.name])
|
|
446
|
+
if (model) return <TablePreview model={model} rows={4} />
|
|
447
|
+
// A file too large to preview, or one that did not load, shows as its format.
|
|
448
|
+
return loading ? <Skeleton pulse /> : <FormatPreview source={source} />
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
function TextPreview({
|
|
452
|
+
source,
|
|
453
|
+
markdown,
|
|
454
|
+
}: {
|
|
455
|
+
readonly source: FileSource
|
|
456
|
+
readonly markdown: boolean
|
|
457
|
+
}) {
|
|
458
|
+
const { text, loading } = useFileText(source)
|
|
459
|
+
const opening = useMemo(
|
|
460
|
+
() => (markdown && text !== undefined ? documentOpening(text) : null),
|
|
461
|
+
[markdown, text]
|
|
462
|
+
)
|
|
463
|
+
if (text === undefined) return loading ? <Skeleton pulse /> : <FormatPreview source={source} />
|
|
464
|
+
if (opening?.title) return <Opening title={opening.title} lede={opening.lede} />
|
|
465
|
+
return (
|
|
466
|
+
<Faded>
|
|
467
|
+
<span className="font-mono text-[10.5px] leading-[1.55] whitespace-pre text-muted-foreground">
|
|
468
|
+
{excerpt(text).split("\n").slice(0, 8).join("\n")}
|
|
469
|
+
</span>
|
|
470
|
+
</Faded>
|
|
471
|
+
)
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
/** A file that does not show in place: its format on a page, with its name and size. */
|
|
475
|
+
function FormatPreview({ source }: { readonly source: FileSource }) {
|
|
476
|
+
const locale = useLocale()
|
|
477
|
+
const units = useArtifactMessages().files
|
|
478
|
+
const format = fileFormat(source.name)
|
|
479
|
+
return (
|
|
480
|
+
<span className="flex h-full flex-col items-center justify-center gap-2.5 px-4">
|
|
481
|
+
<span className="relative h-[52px] w-[42px] rounded-[5px] bg-background shadow-[0_1px_2px_rgb(0_0_0/0.08),0_3px_10px_rgb(0_0_0/0.06)] ring-1 ring-black/[0.07] dark:ring-white/10">
|
|
482
|
+
<span className="absolute inset-x-[7px] top-[9px] flex flex-col gap-[3px]">
|
|
483
|
+
<span className="h-[2px] w-full rounded-full bg-foreground/15" />
|
|
484
|
+
<span className="h-[2px] w-full rounded-full bg-foreground/15" />
|
|
485
|
+
<span className="h-[2px] w-2/3 rounded-full bg-foreground/15" />
|
|
486
|
+
</span>
|
|
487
|
+
{format ? (
|
|
488
|
+
<span
|
|
489
|
+
className={cn(
|
|
490
|
+
"absolute bottom-[6px] left-[5px] rounded-[3px] px-[3px] py-px text-[8px] leading-none font-semibold tracking-wide text-white uppercase",
|
|
491
|
+
format.className
|
|
492
|
+
)}
|
|
493
|
+
>
|
|
494
|
+
{format.text}
|
|
495
|
+
</span>
|
|
496
|
+
) : null}
|
|
497
|
+
</span>
|
|
498
|
+
<span className="flex max-w-full flex-col items-center text-center">
|
|
499
|
+
<span className="max-w-full truncate text-[11.5px] font-medium text-foreground">
|
|
500
|
+
{source.name}
|
|
501
|
+
</span>
|
|
502
|
+
<span className="text-[11px] text-muted-foreground tabular-nums">
|
|
503
|
+
{formatFileSize(source.fileRef.sizeBytes, locale, units)}
|
|
504
|
+
</span>
|
|
505
|
+
</span>
|
|
506
|
+
</span>
|
|
507
|
+
)
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
/** Content from the top of the pane, fading out where the pane cuts it off. */
|
|
511
|
+
function Faded({ children }: { readonly children: ReactNode }) {
|
|
512
|
+
return (
|
|
513
|
+
<span className="flex h-full flex-col px-4 pt-3.5 [mask-image:linear-gradient(to_bottom,black_70%,transparent)]">
|
|
514
|
+
{children}
|
|
515
|
+
</span>
|
|
516
|
+
)
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
function Skeleton({ pulse = false }: { readonly pulse?: boolean }) {
|
|
520
|
+
return (
|
|
521
|
+
<span className={cn("flex flex-col gap-2 px-4 pt-4", pulse && "animate-pulse")}>
|
|
522
|
+
<span className="h-3 w-2/3 rounded-full bg-muted" />
|
|
523
|
+
<span className="h-2 w-full rounded-full bg-muted" />
|
|
524
|
+
<span className="h-2 w-5/6 rounded-full bg-muted" />
|
|
525
|
+
<span className="h-2 w-3/4 rounded-full bg-muted" />
|
|
526
|
+
</span>
|
|
527
|
+
)
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
/**
|
|
531
|
+
* A Markdown text's opening as its document page sets it: the first `#` heading is the title,
|
|
532
|
+
* and the paragraph straight after it is the lede, in plain words.
|
|
533
|
+
*/
|
|
534
|
+
export function documentOpening(markdown: string): {
|
|
535
|
+
readonly title?: string
|
|
536
|
+
readonly lede?: string
|
|
537
|
+
} {
|
|
538
|
+
const lines = excerpt(markdown).split("\n")
|
|
539
|
+
const titleIndex = lines.findIndex((line) => /^#\s+\S/.test(line))
|
|
540
|
+
if (titleIndex === -1) return {}
|
|
541
|
+
const title = plainText(lines[titleIndex]?.replace(/^#\s+/, "").replace(/\s+#+\s*$/, "") ?? "")
|
|
542
|
+
let start = titleIndex + 1
|
|
543
|
+
while (start < lines.length && !lines[start]?.trim()) start += 1
|
|
544
|
+
const paragraph: string[] = []
|
|
545
|
+
for (let index = start; index < lines.length; index += 1) {
|
|
546
|
+
const line = lines[index] ?? ""
|
|
547
|
+
// The lede is a paragraph: a heading, list, quote, table, fence, image, or HTML block ends it
|
|
548
|
+
// before it starts. A list marker needs its space, so `**Bold**` still opens a paragraph.
|
|
549
|
+
if (!line.trim()) break
|
|
550
|
+
if (paragraph.length === 0 && /^\s*(#|>|\||```|~~~|[*+-]\s|\d+[.)]\s|!\[|<)/.test(line)) break
|
|
551
|
+
// A hard line break, as two trailing spaces or a backslash, reads as a space.
|
|
552
|
+
paragraph.push(line.trim().replace(/\\$/, ""))
|
|
553
|
+
}
|
|
554
|
+
const lede = plainText(paragraph.join(" "))
|
|
555
|
+
return { ...(title ? { title } : {}), ...(lede ? { lede } : {}) }
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
/** Markdown inline syntax reduced to its words. */
|
|
559
|
+
function plainText(markdown: string): string {
|
|
560
|
+
return markdown
|
|
561
|
+
.replace(/!\[([^\]]*)\]\([^)]*\)/g, "$1")
|
|
562
|
+
.replace(/\[\^[^\]]+\]/g, "")
|
|
563
|
+
.replace(/\[([^\]]+)\]\([^)]*\)/g, "$1")
|
|
564
|
+
.replace(/(\*\*|__|\*|_|~~|`)(?=\S)([\s\S]*?\S)\1/g, "$2")
|
|
565
|
+
.replace(/\\([\\`*_{}[\]()#+\-.!|~])/g, "$1")
|
|
566
|
+
.replace(/\s+/g, " ")
|
|
567
|
+
.trim()
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
/**
|
|
571
|
+
* The first rows of a table, read from the start of its text. The start can end inside a quoted
|
|
572
|
+
* field and read as no table, though the file itself is fine.
|
|
573
|
+
*/
|
|
574
|
+
function tableStart(text: string, kind: "csv" | "tsv"): CsvTable | null {
|
|
575
|
+
return parseTable(excerpt(text), kind)
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
function parseTable(text: string, kind: "csv" | "tsv"): CsvTable | null {
|
|
579
|
+
try {
|
|
580
|
+
const table = parseCsv(text, { delimiter: kind === "tsv" ? "\t" : "," })
|
|
581
|
+
return table.header.length > 0 ? table : null
|
|
582
|
+
} catch {
|
|
583
|
+
return null
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
/** The start of a text, cut at a line break so no half-read construct ends it. */
|
|
588
|
+
function excerpt(text: string): string {
|
|
589
|
+
if (text.length <= EXCERPT_CHARACTERS) return text
|
|
590
|
+
const cut = text.lastIndexOf("\n", EXCERPT_CHARACTERS)
|
|
591
|
+
return text.slice(0, cut > 0 ? cut : EXCERPT_CHARACTERS)
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
// Format labels in the colors their families are known by, so a PDF reads as a PDF at a glance.
|
|
595
|
+
const FORMAT_COLORS: readonly [RegExp, string][] = [
|
|
596
|
+
[/^pdf$/, "bg-[#e5484d]"],
|
|
597
|
+
[/^(docx?|rtf|odt|pages)$/, "bg-[#3e63dd]"],
|
|
598
|
+
[/^(xlsx?|ods|numbers|csv|tsv)$/, "bg-[#30a46c]"],
|
|
599
|
+
[/^(pptx?|odp|key)$/, "bg-[#f76b15]"],
|
|
600
|
+
[/^(html?|xml|json|ya?ml)$/, "bg-[#8e4ec6]"],
|
|
601
|
+
[/^(zip|tar|gz|tgz|7z|rar)$/, "bg-[#6f6e77]"],
|
|
602
|
+
]
|
|
603
|
+
|
|
604
|
+
function fileFormat(
|
|
605
|
+
name: string
|
|
606
|
+
): { readonly text: string; readonly className: string } | undefined {
|
|
607
|
+
const extension = fileExtension(name)
|
|
608
|
+
if (!extension) return undefined
|
|
609
|
+
const color =
|
|
610
|
+
FORMAT_COLORS.find(([pattern]) => pattern.test(extension))?.[1] ?? "bg-foreground/50"
|
|
611
|
+
return { text: extension, className: color }
|
|
612
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { useCallback, useEffect, useRef, useState } from "react"
|
|
2
|
+
|
|
3
|
+
const COPIED_MS = 1600
|
|
4
|
+
|
|
5
|
+
/** Copies text to the clipboard, and says so for a moment: `copied` is true until then. */
|
|
6
|
+
export function useCopyFeedback(): {
|
|
7
|
+
readonly copied: boolean
|
|
8
|
+
readonly copy: (text: string) => Promise<void>
|
|
9
|
+
} {
|
|
10
|
+
const [copied, setCopied] = useState(false)
|
|
11
|
+
const timer = useRef<ReturnType<typeof setTimeout> | undefined>(undefined)
|
|
12
|
+
useEffect(() => () => clearTimeout(timer.current), [])
|
|
13
|
+
const copy = useCallback(async (text: string) => {
|
|
14
|
+
try {
|
|
15
|
+
await navigator.clipboard.writeText(text)
|
|
16
|
+
} catch {
|
|
17
|
+
// The clipboard can be unavailable, such as on an insecure origin.
|
|
18
|
+
return
|
|
19
|
+
}
|
|
20
|
+
clearTimeout(timer.current)
|
|
21
|
+
setCopied(true)
|
|
22
|
+
timer.current = setTimeout(() => setCopied(false), COPIED_MS)
|
|
23
|
+
}, [])
|
|
24
|
+
return { copied, copy }
|
|
25
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export interface FileSizeUnits {
|
|
2
|
+
readonly unknownSize: string
|
|
3
|
+
readonly bytes: string
|
|
4
|
+
readonly kilobytes: string
|
|
5
|
+
readonly megabytes: string
|
|
6
|
+
readonly gigabytes: string
|
|
7
|
+
readonly terabytes: string
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/** A byte count in the largest unit that keeps it at least 1, in the reader's locale. */
|
|
11
|
+
export function formatFileSize(sizeBytes: number, locale: string, units: FileSizeUnits): string {
|
|
12
|
+
if (!Number.isFinite(sizeBytes) || sizeBytes < 0) return units.unknownSize
|
|
13
|
+
|
|
14
|
+
const names = [units.bytes, units.kilobytes, units.megabytes, units.gigabytes, units.terabytes]
|
|
15
|
+
let value = sizeBytes
|
|
16
|
+
let unitIndex = 0
|
|
17
|
+
while (value >= 1024 && unitIndex < names.length - 1) {
|
|
18
|
+
value /= 1024
|
|
19
|
+
unitIndex += 1
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const maximumFractionDigits = unitIndex === 0 || value >= 10 ? 0 : 1
|
|
23
|
+
return `${value.toLocaleString(locale, { maximumFractionDigits })} ${names[unitIndex]}`
|
|
24
|
+
}
|