@sixb/app 0.2.1 → 0.2.3
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/dist/agent/agent-chat.d.ts +9 -2
- package/dist/agent/agent-chat.d.ts.map +1 -1
- package/dist/agent/agent-panel.d.ts +9 -1
- package/dist/agent/agent-panel.d.ts.map +1 -1
- package/dist/agent/agent-surface.d.ts.map +1 -1
- package/dist/agent/artifact-card.d.ts +3 -1
- package/dist/agent/artifact-card.d.ts.map +1 -1
- package/dist/agent/artifact-panel.d.ts +7 -1
- package/dist/agent/artifact-panel.d.ts.map +1 -1
- package/dist/agent/components/composer-place.d.ts +3 -1
- package/dist/agent/components/composer-place.d.ts.map +1 -1
- package/dist/agent/components/composer.d.ts +20 -1
- package/dist/agent/components/composer.d.ts.map +1 -1
- package/dist/agent/components/context-chips.d.ts.map +1 -1
- package/dist/agent/components/context-meter.d.ts +1 -1
- package/dist/agent/components/conversation-panel.d.ts +3 -1
- package/dist/agent/components/conversation-panel.d.ts.map +1 -1
- package/dist/agent/components/message-parts.d.ts +3 -1
- package/dist/agent/components/message-parts.d.ts.map +1 -1
- package/dist/agent/components/thread-artifacts-menu.d.ts.map +1 -1
- package/dist/agent/composer-insertion.d.ts +24 -0
- package/dist/agent/composer-insertion.d.ts.map +1 -0
- package/dist/agent/delegation/use-children.d.ts +5 -5
- package/dist/agent/delegation/use-children.d.ts.map +1 -1
- package/dist/agent/hooks/use-agent-conversation.d.ts +10 -4
- package/dist/agent/hooks/use-agent-conversation.d.ts.map +1 -1
- package/dist/agent/hooks/use-new-thread-place.d.ts +39 -17
- package/dist/agent/hooks/use-new-thread-place.d.ts.map +1 -1
- package/dist/agent/hooks/use-thread-lists.d.ts.map +1 -1
- package/dist/agent/i18n/en.d.ts +14 -0
- package/dist/agent/i18n/en.d.ts.map +1 -1
- package/dist/agent/i18n/fr.d.ts.map +1 -1
- package/dist/agent/i18n/index.d.ts +20 -0
- package/dist/agent/i18n/index.d.ts.map +1 -1
- package/dist/agent/publish-artifact/interpret.d.ts +8 -2
- package/dist/agent/publish-artifact/interpret.d.ts.map +1 -1
- package/dist/agent/publish-artifact/open-artifact-tool-view.d.ts +9 -0
- package/dist/agent/publish-artifact/open-artifact-tool-view.d.ts.map +1 -0
- package/dist/agent/publish-artifact/publish-artifact-tool-view.d.ts +4 -2
- package/dist/agent/publish-artifact/publish-artifact-tool-view.d.ts.map +1 -1
- package/dist/agent/publish-artifact/use-live-publishes.d.ts +3 -3
- package/dist/agent/publish-artifact/use-live-publishes.d.ts.map +1 -1
- package/dist/agent/tool-views/built-in.d.ts.map +1 -1
- package/dist/agent/types.d.ts +3 -1
- package/dist/agent/types.d.ts.map +1 -1
- package/dist/artifacts/artifact-page.d.ts.map +1 -1
- package/dist/artifacts/artifact-viewer.d.ts +16 -0
- package/dist/artifacts/artifact-viewer.d.ts.map +1 -0
- package/dist/artifacts/card-details.d.ts +1 -1
- package/dist/artifacts/card-details.d.ts.map +1 -1
- package/dist/artifacts/card-preview.d.ts.map +1 -1
- package/dist/artifacts/comments-context.d.ts +48 -0
- package/dist/artifacts/comments-context.d.ts.map +1 -0
- package/dist/artifacts/edit-session.d.ts +6 -6
- package/dist/artifacts/edit-session.d.ts.map +1 -1
- package/dist/artifacts/file-source.d.ts.map +1 -1
- package/dist/artifacts/frame.d.ts +10 -2
- package/dist/artifacts/frame.d.ts.map +1 -1
- package/dist/artifacts/guest-badge.d.ts +8 -0
- package/dist/artifacts/guest-badge.d.ts.map +1 -0
- package/dist/artifacts/held-artifact.d.ts +19 -0
- package/dist/artifacts/held-artifact.d.ts.map +1 -0
- package/dist/artifacts/holders.d.ts +10 -0
- package/dist/artifacts/holders.d.ts.map +1 -0
- package/dist/artifacts/live/boards.d.ts +15 -0
- package/dist/artifacts/live/boards.d.ts.map +1 -0
- package/dist/artifacts/live/canvas.d.ts +79 -0
- package/dist/artifacts/live/canvas.d.ts.map +1 -0
- package/dist/artifacts/live/header.d.ts +29 -0
- package/dist/artifacts/live/header.d.ts.map +1 -0
- package/dist/artifacts/live/hooks.d.ts +21 -0
- package/dist/artifacts/live/hooks.d.ts.map +1 -0
- package/dist/artifacts/live/presence.d.ts +32 -0
- package/dist/artifacts/live/presence.d.ts.map +1 -0
- package/dist/artifacts/live/session.d.ts +130 -0
- package/dist/artifacts/live/session.d.ts.map +1 -0
- package/dist/artifacts/live/view.d.ts +28 -0
- package/dist/artifacts/live/view.d.ts.map +1 -0
- package/dist/artifacts/messages.d.ts +424 -14
- package/dist/artifacts/messages.d.ts.map +1 -1
- package/dist/artifacts/page-queries.d.ts +2 -2
- package/dist/artifacts/page-queries.d.ts.map +1 -1
- package/dist/artifacts/page-state.d.ts.map +1 -1
- package/dist/artifacts/publish-edit.d.ts +24 -14
- package/dist/artifacts/publish-edit.d.ts.map +1 -1
- package/dist/artifacts/queries.d.ts +490 -9
- package/dist/artifacts/queries.d.ts.map +1 -1
- package/dist/artifacts/references/references.d.ts.map +1 -1
- package/dist/artifacts/renderers/canvas/arrows.d.ts +0 -18
- package/dist/artifacts/renderers/canvas/arrows.d.ts.map +1 -1
- package/dist/artifacts/renderers/canvas/board-editor.d.ts +43 -0
- package/dist/artifacts/renderers/canvas/board-editor.d.ts.map +1 -0
- package/dist/artifacts/renderers/canvas/board-properties.d.ts +37 -0
- package/dist/artifacts/renderers/canvas/board-properties.d.ts.map +1 -0
- package/dist/artifacts/renderers/canvas/board-source.d.ts +18 -0
- package/dist/artifacts/renderers/canvas/board-source.d.ts.map +1 -0
- package/dist/artifacts/renderers/canvas/board.d.ts +64 -19
- package/dist/artifacts/renderers/canvas/board.d.ts.map +1 -1
- package/dist/artifacts/renderers/canvas/canvas.d.ts +13 -4
- package/dist/artifacts/renderers/canvas/canvas.d.ts.map +1 -1
- package/dist/artifacts/renderers/canvas/comment-pins.d.ts +84 -0
- package/dist/artifacts/renderers/canvas/comment-pins.d.ts.map +1 -0
- package/dist/artifacts/renderers/canvas/commenting.d.ts +58 -0
- package/dist/artifacts/renderers/canvas/commenting.d.ts.map +1 -0
- package/dist/artifacts/renderers/canvas/comments-panel.d.ts +27 -0
- package/dist/artifacts/renderers/canvas/comments-panel.d.ts.map +1 -0
- package/dist/artifacts/renderers/canvas/comments.d.ts +56 -0
- package/dist/artifacts/renderers/canvas/comments.d.ts.map +1 -0
- package/dist/artifacts/renderers/canvas/draft.d.ts +7 -6
- package/dist/artifacts/renderers/canvas/draft.d.ts.map +1 -1
- package/dist/artifacts/renderers/canvas/edit-mode.d.ts +19 -2
- package/dist/artifacts/renderers/canvas/edit-mode.d.ts.map +1 -1
- package/dist/artifacts/renderers/canvas/focus.d.ts +40 -5
- package/dist/artifacts/renderers/canvas/focus.d.ts.map +1 -1
- package/dist/artifacts/renderers/canvas/items.d.ts +47 -4
- package/dist/artifacts/renderers/canvas/items.d.ts.map +1 -1
- package/dist/artifacts/renderers/canvas/layout.d.ts +5 -8
- package/dist/artifacts/renderers/canvas/layout.d.ts.map +1 -1
- package/dist/artifacts/renderers/canvas/presence.d.ts +21 -0
- package/dist/artifacts/renderers/canvas/presence.d.ts.map +1 -0
- package/dist/artifacts/renderers/canvas/previews.d.ts +54 -0
- package/dist/artifacts/renderers/canvas/previews.d.ts.map +1 -0
- package/dist/artifacts/renderers/canvas/renderer.d.ts +11 -2
- package/dist/artifacts/renderers/canvas/renderer.d.ts.map +1 -1
- package/dist/artifacts/renderers/canvas/thumbnail.d.ts +5 -2
- package/dist/artifacts/renderers/canvas/thumbnail.d.ts.map +1 -1
- package/dist/artifacts/version-menu.d.ts +19 -0
- package/dist/artifacts/version-menu.d.ts.map +1 -0
- package/dist/artifacts/view-context.d.ts +43 -0
- package/dist/artifacts/view-context.d.ts.map +1 -0
- package/dist/artifacts/viewer.d.ts.map +1 -1
- package/dist/build.d.ts +5 -0
- package/dist/build.d.ts.map +1 -1
- package/dist/{chunk-ytadd0b5.js → chunk-001c4gnk.js} +6871 -3756
- package/dist/chunk-001c4gnk.js.map +204 -0
- package/dist/chunk-00wggsst.js +7 -0
- package/dist/chunk-00wggsst.js.map +10 -0
- package/dist/chunk-5crvhjp2.js +4704 -0
- package/dist/chunk-5crvhjp2.js.map +28 -0
- package/dist/{chunk-q69001w3.js → chunk-694m74s7.js} +7 -1
- package/dist/{chunk-q69001w3.js.map → chunk-694m74s7.js.map} +3 -3
- package/dist/{chunk-4mprsd2n.js → chunk-fg6thecb.js} +25 -1
- package/dist/chunk-fg6thecb.js.map +10 -0
- package/dist/{chunk-j8g956dt.js → chunk-fwb9mxwm.js} +1 -1
- package/dist/{chunk-7fj9cfkw.js → chunk-kes4ygmz.js} +1 -1
- package/dist/{chunk-kwbw4dyk.js → chunk-ryed2jq8.js} +1 -1
- package/dist/codegen.d.ts.map +1 -1
- package/dist/createCustomApp.d.ts.map +1 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +930 -309
- package/dist/index.js.map +15 -10
- package/dist/locale-messages.d.ts +12 -0
- package/dist/locale-messages.d.ts.map +1 -1
- package/dist/locale.d.ts +12 -0
- package/dist/locale.d.ts.map +1 -1
- package/dist/locale.js +1 -1
- package/dist/metadata.d.ts +8 -0
- package/dist/metadata.d.ts.map +1 -1
- package/dist/pages/console/action-run.d.ts.map +1 -1
- package/dist/pages/console/data/connectors.d.ts.map +1 -1
- package/dist/pages/console/data/datasets.d.ts.map +1 -1
- package/dist/pages/console/data/lake-health.d.ts +3 -0
- package/dist/pages/console/data/lake-health.d.ts.map +1 -0
- package/dist/pages/console/data/messages.d.ts +98 -2
- package/dist/pages/console/data/messages.d.ts.map +1 -1
- package/dist/pages/console/data/pipelines.d.ts.map +1 -1
- package/dist/pages/console/data/projections.d.ts.map +1 -1
- package/dist/pages/console/data/syncs.d.ts.map +1 -1
- package/dist/pages/console/ontology/action-runs.d.ts.map +1 -1
- package/dist/pages/console/ontology/actions.d.ts.map +1 -1
- package/dist/pages/console/ontology/components/action-button.d.ts.map +1 -1
- package/dist/pages/console/ontology/components/artifact-picker.d.ts +36 -0
- package/dist/pages/console/ontology/components/artifact-picker.d.ts.map +1 -0
- package/dist/pages/console/ontology/components/object-query-bar.d.ts.map +1 -1
- package/dist/pages/console/ontology/lib/action-params.d.ts +2 -0
- package/dist/pages/console/ontology/lib/action-params.d.ts.map +1 -1
- package/dist/pages/console/ontology/lineage/properties-panel.d.ts +2 -1
- package/dist/pages/console/ontology/lineage/properties-panel.d.ts.map +1 -1
- package/dist/pages/console/ontology/object-page.d.ts.map +1 -1
- package/dist/pages/console/ontology/object-type.d.ts.map +1 -1
- package/dist/pages/console/ontology/object-types.d.ts.map +1 -1
- package/dist/pages/console/ontology/objects.d.ts.map +1 -1
- package/dist/pages/console/ontology/rules.d.ts.map +1 -1
- package/dist/pages/console/ontology/workflow.d.ts.map +1 -1
- package/dist/pages/console/ontology/workflows/run-input-form.d.ts.map +1 -1
- package/dist/pages/console/ontology/workflows/schema-shape.d.ts.map +1 -1
- package/dist/pages/console/ontology/workflows.d.ts.map +1 -1
- package/dist/pages/console/skeletons.d.ts +30 -0
- package/dist/pages/console/skeletons.d.ts.map +1 -0
- package/dist/pages/console/workflow-run.d.ts.map +1 -1
- package/dist/pages/section-page.d.ts +11 -1
- package/dist/pages/section-page.d.ts.map +1 -1
- package/dist/pages/section-ui.d.ts +25 -3
- package/dist/pages/section-ui.d.ts.map +1 -1
- package/dist/pages/settings/activity/calendar.d.ts.map +1 -1
- package/dist/pages/settings/activity/connections.d.ts.map +1 -1
- package/dist/pages/settings/activity/page.d.ts.map +1 -1
- package/dist/pages/settings/activity/thread.d.ts.map +1 -1
- package/dist/pages/settings/activity/timeline.d.ts +2 -0
- package/dist/pages/settings/activity/timeline.d.ts.map +1 -1
- package/dist/pages/settings/controls.d.ts +4 -0
- package/dist/pages/settings/controls.d.ts.map +1 -1
- package/dist/pages/settings/members.d.ts.map +1 -1
- package/dist/pages/settings/memory-history.d.ts +2 -0
- package/dist/pages/settings/memory-history.d.ts.map +1 -1
- package/dist/pages/settings/memory.d.ts.map +1 -1
- package/dist/pages/settings/service-accounts.d.ts.map +1 -1
- package/dist/pages/settings/sessions.d.ts.map +1 -1
- package/dist/pages/settings/usage/breakdown.d.ts.map +1 -1
- package/dist/pages/settings/usage/limits.d.ts.map +1 -1
- package/dist/pages/settings/usage/messages.d.ts +0 -2
- package/dist/pages/settings/usage/messages.d.ts.map +1 -1
- package/dist/pages/settings/usage/runs.d.ts +8 -2
- package/dist/pages/settings/usage/runs.d.ts.map +1 -1
- package/dist/pages/settings/usage/spend-chart.d.ts.map +1 -1
- package/dist/pages/settings/usage/spend-model.d.ts +5 -0
- package/dist/pages/settings/usage/spend-model.d.ts.map +1 -1
- package/dist/pages/values.d.ts +6 -0
- package/dist/pages/values.d.ts.map +1 -1
- package/dist/pages.d.ts +4 -0
- package/dist/pages.d.ts.map +1 -1
- package/dist/pages.js +8188 -4841
- package/dist/pages.js.map +56 -47
- package/dist/sections/catalog.d.ts.map +1 -1
- package/dist/sections/sections.d.ts.map +1 -1
- package/dist/server.js +294 -23
- package/dist/server.js.map +8 -7
- package/dist/service-worker.d.ts +39 -0
- package/dist/service-worker.d.ts.map +1 -0
- package/dist/shared-session.d.ts +25 -0
- package/dist/shared-session.d.ts.map +1 -0
- package/dist/shell/app-return.d.ts +35 -0
- package/dist/shell/app-return.d.ts.map +1 -0
- package/dist/shell/app-shell.d.ts +1 -1
- package/dist/shell/app-shell.d.ts.map +1 -1
- package/dist/shell/nav-items.d.ts +2 -0
- package/dist/shell/nav-items.d.ts.map +1 -1
- package/dist/shell/phone/back.d.ts +6 -0
- package/dist/shell/phone/back.d.ts.map +1 -0
- package/dist/shell/phone/launch.d.ts +7 -0
- package/dist/shell/phone/launch.d.ts.map +1 -0
- package/dist/shell/phone/more-sheet.d.ts +36 -0
- package/dist/shell/phone/more-sheet.d.ts.map +1 -0
- package/dist/shell/phone/phone-foundations.d.ts +9 -0
- package/dist/shell/phone/phone-foundations.d.ts.map +1 -0
- package/dist/shell/phone/pull-to-refresh.d.ts +9 -0
- package/dist/shell/phone/pull-to-refresh.d.ts.map +1 -0
- package/dist/shell/phone/routes.d.ts +12 -0
- package/dist/shell/phone/routes.d.ts.map +1 -0
- package/dist/shell/phone/screen-motion.d.ts +11 -0
- package/dist/shell/phone/screen-motion.d.ts.map +1 -0
- package/dist/shell/phone/scroll-restoration.d.ts +7 -0
- package/dist/shell/phone/scroll-restoration.d.ts.map +1 -0
- package/dist/shell/phone/startup-image.d.ts +17 -0
- package/dist/shell/phone/startup-image.d.ts.map +1 -0
- package/dist/shell/phone/tab-bar.d.ts +14 -0
- package/dist/shell/phone/tab-bar.d.ts.map +1 -0
- package/dist/shell/phone/top-bar.d.ts +24 -0
- package/dist/shell/phone/top-bar.d.ts.map +1 -0
- package/dist/shell/search-command.d.ts +3 -1
- package/dist/shell/search-command.d.ts.map +1 -1
- package/dist/shell/user-menu.d.ts +2 -0
- package/dist/shell/user-menu.d.ts.map +1 -1
- package/package.json +8 -5
- package/src/agent/agent-chat.tsx +51 -8
- package/src/agent/agent-panel.tsx +12 -0
- package/src/agent/agent-surface.tsx +4 -0
- package/src/agent/artifact-card.tsx +84 -16
- package/src/agent/artifact-panel.tsx +63 -43
- package/src/agent/components/agent-message-body.tsx +1 -1
- package/src/agent/components/composer-place.tsx +77 -53
- package/src/agent/components/composer.tsx +92 -7
- package/src/agent/components/context-chips.tsx +72 -2
- package/src/agent/components/conversation-panel.tsx +3 -2
- package/src/agent/components/message-parts.tsx +6 -1
- package/src/agent/components/thread-artifacts-menu.tsx +22 -5
- package/src/agent/composer-insertion.ts +36 -0
- package/src/agent/hooks/use-agent-conversation.ts +41 -10
- package/src/agent/hooks/use-new-thread-place.ts +149 -25
- package/src/agent/i18n/en.ts +14 -0
- package/src/agent/i18n/fr.ts +12 -0
- package/src/agent/publish-artifact/interpret.ts +27 -5
- package/src/agent/publish-artifact/open-artifact-tool-view.tsx +49 -0
- package/src/agent/publish-artifact/publish-artifact-tool-view.tsx +14 -8
- package/src/agent/publish-artifact/use-live-publishes.ts +7 -11
- package/src/agent/react-router.tsx +2 -2
- package/src/agent/tool-views/built-in.tsx +3 -0
- package/src/agent/types.ts +4 -0
- package/src/artifacts/artifact-page.tsx +42 -17
- package/src/artifacts/artifact-viewer.tsx +56 -0
- package/src/artifacts/artifacts.css +80 -0
- package/src/artifacts/card-details.ts +2 -2
- package/src/artifacts/card-preview.tsx +17 -3
- package/src/artifacts/comments-context.ts +125 -0
- package/src/artifacts/edit-session.tsx +6 -6
- package/src/artifacts/file-source.ts +10 -3
- package/src/artifacts/frame.tsx +50 -12
- package/src/artifacts/gallery.tsx +9 -11
- package/src/artifacts/guest-badge.tsx +21 -0
- package/src/artifacts/held-artifact.tsx +241 -0
- package/src/artifacts/holders.tsx +170 -0
- package/src/artifacts/live/boards.ts +95 -0
- package/src/artifacts/live/canvas.ts +402 -0
- package/src/artifacts/live/header.tsx +137 -0
- package/src/artifacts/live/hooks.ts +94 -0
- package/src/artifacts/live/presence.ts +147 -0
- package/src/artifacts/live/session.ts +520 -0
- package/src/artifacts/live/view.ts +81 -0
- package/src/artifacts/messages.ts +415 -24
- package/src/artifacts/page-queries.ts +2 -3
- package/src/artifacts/page-state.ts +16 -7
- package/src/artifacts/publish-edit.ts +50 -22
- package/src/artifacts/queries.ts +108 -10
- package/src/artifacts/references/references.tsx +6 -9
- package/src/artifacts/renderers/canvas/arrows.tsx +12 -39
- package/src/artifacts/renderers/canvas/board-editor.tsx +817 -0
- package/src/artifacts/renderers/canvas/board-properties.tsx +488 -0
- package/src/artifacts/renderers/canvas/board-source.ts +110 -0
- package/src/artifacts/renderers/canvas/board.tsx +309 -33
- package/src/artifacts/renderers/canvas/canvas.tsx +387 -72
- package/src/artifacts/renderers/canvas/comment-pins.tsx +465 -0
- package/src/artifacts/renderers/canvas/commenting.tsx +319 -0
- package/src/artifacts/renderers/canvas/comments-panel.tsx +574 -0
- package/src/artifacts/renderers/canvas/comments.ts +225 -0
- package/src/artifacts/renderers/canvas/draft.ts +41 -50
- package/src/artifacts/renderers/canvas/edit-mode.tsx +145 -20
- package/src/artifacts/renderers/canvas/focus.tsx +175 -24
- package/src/artifacts/renderers/canvas/items.tsx +179 -52
- package/src/artifacts/renderers/canvas/layout.ts +99 -47
- package/src/artifacts/renderers/canvas/presence.tsx +184 -0
- package/src/artifacts/renderers/canvas/previews.ts +127 -0
- package/src/artifacts/renderers/canvas/renderer.tsx +87 -22
- package/src/artifacts/renderers/canvas/thumbnail.tsx +56 -15
- package/src/artifacts/renderers/canvas/toolbar.tsx +1 -1
- package/src/artifacts/renderers/slides/slides.tsx +1 -1
- package/src/artifacts/version-menu.tsx +438 -0
- package/src/artifacts/view-context.ts +102 -0
- package/src/artifacts/viewer.tsx +205 -147
- package/src/build.ts +96 -11
- package/src/codegen.ts +83 -5
- package/src/createCustomApp.ts +20 -7
- package/src/index.ts +12 -0
- package/src/locale-messages.ts +24 -0
- package/src/metadata.ts +12 -0
- package/src/pages/console/action-run.tsx +20 -0
- package/src/pages/console/data/connectors.tsx +27 -3
- package/src/pages/console/data/datasets.tsx +30 -1
- package/src/pages/console/data/lake-health.tsx +299 -0
- package/src/pages/console/data/messages.ts +143 -2
- package/src/pages/console/data/pipelines.tsx +91 -3
- package/src/pages/console/data/projections.tsx +23 -4
- package/src/pages/console/data/syncs.tsx +39 -2
- package/src/pages/console/ontology/action-runs.tsx +8 -2
- package/src/pages/console/ontology/actions.tsx +39 -15
- package/src/pages/console/ontology/components/action-button.tsx +10 -0
- package/src/pages/console/ontology/components/artifact-picker.tsx +522 -0
- package/src/pages/console/ontology/components/object-query-bar.tsx +21 -5
- package/src/pages/console/ontology/lib/action-params.ts +10 -0
- package/src/pages/console/ontology/lineage/properties-panel.tsx +32 -24
- package/src/pages/console/ontology/object-page.tsx +2 -0
- package/src/pages/console/ontology/object-type.tsx +73 -14
- package/src/pages/console/ontology/object-types.tsx +56 -7
- package/src/pages/console/ontology/objects.tsx +167 -19
- package/src/pages/console/ontology/rules.tsx +186 -30
- package/src/pages/console/ontology/workflow.tsx +130 -74
- package/src/pages/console/ontology/workflows/run-input-form.tsx +21 -2
- package/src/pages/console/ontology/workflows/schema-shape.tsx +3 -0
- package/src/pages/console/ontology/workflows.tsx +34 -21
- package/src/pages/console/skeletons.tsx +99 -0
- package/src/pages/console/workflow-run.tsx +20 -0
- package/src/pages/section-page.tsx +37 -7
- package/src/pages/section-ui.tsx +96 -13
- package/src/pages/settings/activity/calendar.tsx +13 -6
- package/src/pages/settings/activity/connections.tsx +26 -9
- package/src/pages/settings/activity/page.tsx +31 -4
- package/src/pages/settings/activity/thread.tsx +32 -18
- package/src/pages/settings/activity/timeline.tsx +39 -0
- package/src/pages/settings/controls.tsx +19 -1
- package/src/pages/settings/developers.tsx +2 -2
- package/src/pages/settings/members.tsx +42 -9
- package/src/pages/settings/memory-history.tsx +76 -10
- package/src/pages/settings/memory.tsx +47 -5
- package/src/pages/settings/service-accounts.tsx +7 -2
- package/src/pages/settings/sessions.tsx +6 -2
- package/src/pages/settings/usage/breakdown.tsx +62 -2
- package/src/pages/settings/usage/limits.tsx +45 -3
- package/src/pages/settings/usage/messages.ts +0 -2
- package/src/pages/settings/usage/page.tsx +99 -52
- package/src/pages/settings/usage/runs.tsx +105 -8
- package/src/pages/settings/usage/spend-chart.tsx +79 -45
- package/src/pages/settings/usage/spend-model.ts +16 -0
- package/src/pages/values.tsx +72 -6
- package/src/pages.ts +4 -0
- package/src/sections/catalog.ts +6 -0
- package/src/sections/sections.tsx +2 -0
- package/src/service-worker.ts +176 -0
- package/src/shared-session.ts +73 -0
- package/src/shell/app-return.ts +115 -0
- package/src/shell/app-shell.tsx +125 -27
- package/src/shell/nav-items.tsx +2 -0
- package/src/shell/phone/back.ts +16 -0
- package/src/shell/phone/launch.ts +6 -0
- package/src/shell/phone/more-sheet.tsx +249 -0
- package/src/shell/phone/phone-foundations.tsx +43 -0
- package/src/shell/phone/phone.css +660 -0
- package/src/shell/phone/pull-to-refresh.tsx +201 -0
- package/src/shell/phone/routes.ts +34 -0
- package/src/shell/phone/screen-motion.ts +292 -0
- package/src/shell/phone/scroll-restoration.tsx +70 -0
- package/src/shell/phone/startup-image.ts +119 -0
- package/src/shell/phone/tab-bar.tsx +95 -0
- package/src/shell/phone/top-bar.tsx +195 -0
- package/src/shell/search-command.tsx +30 -14
- package/src/shell/user-menu.tsx +2 -1
- package/dist/chunk-4j3c3p72.js +0 -1487
- package/dist/chunk-4j3c3p72.js.map +0 -18
- package/dist/chunk-4mprsd2n.js.map +0 -10
- package/dist/chunk-ytadd0b5.js.map +0 -188
- /package/dist/{chunk-j8g956dt.js.map → chunk-fwb9mxwm.js.map} +0 -0
- /package/dist/{chunk-7fj9cfkw.js.map → chunk-kes4ygmz.js.map} +0 -0
- /package/dist/{chunk-kwbw4dyk.js.map → chunk-ryed2jq8.js.map} +0 -0
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { Canvas, CanvasArrow, CanvasEnd, CanvasItem } from "@sixb/core/artifacts"
|
|
1
|
+
import type { Canvas, CanvasArrow, CanvasEnd, CanvasItem, CanvasNote } from "@sixb/core/artifacts"
|
|
2
|
+
import { ARTIFACT_LIMITS, CANVAS_TEXT_PIXELS, canvasNoteFontSize } from "@sixb/core/artifacts"
|
|
2
3
|
import type { Edge, Node } from "@xyflow/react"
|
|
3
4
|
|
|
4
5
|
/** What a node on the board draws: one of the canvas's items, or an arrow's end at a point. */
|
|
@@ -22,11 +23,26 @@ export interface Box {
|
|
|
22
23
|
readonly height: number
|
|
23
24
|
}
|
|
24
25
|
|
|
26
|
+
/** Over every item: an arrow to a point on a board shows on it. */
|
|
27
|
+
const ARROW_Z_INDEX = ARTIFACT_LIMITS.maxCanvasItems + 1
|
|
28
|
+
|
|
29
|
+
/** What an item drew as, at the place it had in the canvas's order. */
|
|
30
|
+
interface Drawn {
|
|
31
|
+
readonly order: number
|
|
32
|
+
readonly nodes: readonly CanvasFlowNode[]
|
|
33
|
+
readonly edges: readonly CanvasFlowEdge[]
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const drawn = new WeakMap<CanvasItem, Drawn>()
|
|
37
|
+
|
|
25
38
|
/**
|
|
26
39
|
* The canvas as React Flow's nodes and edges. Each item is a node of its type at its place and
|
|
27
40
|
* size; a note and a text without a width are measured once drawn. Sections draw
|
|
28
41
|
* behind everything, the rest in the order the canvas lists them. An arrow is an edge between two
|
|
29
42
|
* items, drawn over them all, and its end at a bare point is an invisible node there.
|
|
43
|
+
*
|
|
44
|
+
* An item that is the same object as before, at the same place in the order, draws as the same
|
|
45
|
+
* nodes and edge: React Flow draws again only what changed.
|
|
30
46
|
*/
|
|
31
47
|
export function canvasGraph(canvas: Canvas): {
|
|
32
48
|
readonly nodes: CanvasFlowNode[]
|
|
@@ -35,59 +51,79 @@ export function canvasGraph(canvas: Canvas): {
|
|
|
35
51
|
const nodes: CanvasFlowNode[] = []
|
|
36
52
|
const edges: CanvasFlowEdge[] = []
|
|
37
53
|
canvas.items.forEach((item, order) => {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
54
|
+
let entry = drawn.get(item)
|
|
55
|
+
if (!entry || entry.order !== order) {
|
|
56
|
+
entry = { order, ...itemGraph(item, order) }
|
|
57
|
+
drawn.set(item, entry)
|
|
58
|
+
}
|
|
59
|
+
nodes.push(...entry.nodes)
|
|
60
|
+
edges.push(...entry.edges)
|
|
61
|
+
})
|
|
62
|
+
return { nodes, edges }
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/** One item's nodes and edges. */
|
|
66
|
+
function itemGraph(
|
|
67
|
+
item: CanvasItem,
|
|
68
|
+
order: number
|
|
69
|
+
): { readonly nodes: CanvasFlowNode[]; readonly edges: CanvasFlowEdge[] } {
|
|
70
|
+
const nodes: CanvasFlowNode[] = []
|
|
71
|
+
const edges: CanvasFlowEdge[] = []
|
|
72
|
+
if (item.type === "arrow") {
|
|
73
|
+
const end = (side: "from" | "to", value: CanvasEnd) => {
|
|
74
|
+
if (typeof value === "string") return value
|
|
75
|
+
const id = `${item.id}:${side}`
|
|
76
|
+
nodes.push({
|
|
77
|
+
id,
|
|
78
|
+
type: "point",
|
|
79
|
+
position: { x: value.x, y: value.y },
|
|
80
|
+
width: 1,
|
|
81
|
+
height: 1,
|
|
82
|
+
data: { item: null },
|
|
63
83
|
selectable: false,
|
|
84
|
+
focusable: false,
|
|
64
85
|
})
|
|
65
|
-
return
|
|
86
|
+
return id
|
|
66
87
|
}
|
|
67
|
-
|
|
68
|
-
const height = "h" in item && item.type !== "note" ? item.h : undefined
|
|
69
|
-
const width = "w" in item ? item.w : undefined
|
|
70
|
-
nodes.push({
|
|
88
|
+
edges.push({
|
|
71
89
|
id: item.id,
|
|
72
|
-
type:
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
...(
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
draggable: false,
|
|
79
|
-
connectable: false,
|
|
90
|
+
type: "floating",
|
|
91
|
+
source: end("from", item.from),
|
|
92
|
+
target: end("to", item.to),
|
|
93
|
+
data: { ...(item.label ? { label: item.label } : {}), dashed: item.dashed },
|
|
94
|
+
zIndex: ARROW_Z_INDEX,
|
|
95
|
+
focusable: false,
|
|
80
96
|
selectable: false,
|
|
81
|
-
// Boards are the items a reader opens; the rest are read where they lie.
|
|
82
|
-
focusable: item.type === "board",
|
|
83
97
|
})
|
|
98
|
+
return { nodes, edges }
|
|
99
|
+
}
|
|
100
|
+
// A note grows to hold its text, its height only the least it takes: it is measured.
|
|
101
|
+
const height = "h" in item && item.type !== "note" ? item.h : undefined
|
|
102
|
+
const width = "w" in item ? item.w : undefined
|
|
103
|
+
nodes.push({
|
|
104
|
+
id: item.id,
|
|
105
|
+
type: item.type,
|
|
106
|
+
position: { x: item.x, y: item.y },
|
|
107
|
+
...(width === undefined ? {} : { width }),
|
|
108
|
+
...(height === undefined ? {} : { height }),
|
|
109
|
+
data: { item },
|
|
110
|
+
zIndex: item.type === "section" ? -1 : order,
|
|
111
|
+
draggable: false,
|
|
112
|
+
connectable: false,
|
|
113
|
+
selectable: false,
|
|
114
|
+
// Boards are the items a reader opens; the rest are read where they lie. React Flow lets an
|
|
115
|
+
// item it can't select or drag take no pointer, so a board takes it back: a double-click
|
|
116
|
+
// reaches it, and a drag across it still pans.
|
|
117
|
+
focusable: item.type === "board",
|
|
118
|
+
...(item.type === "board" ? { style: { pointerEvents: "all" } } : {}),
|
|
84
119
|
})
|
|
85
120
|
return { nodes, edges }
|
|
86
121
|
}
|
|
87
122
|
|
|
88
123
|
/**
|
|
89
124
|
* The extent of every item with a size, for a picture of the whole canvas. Notes without a
|
|
90
|
-
* height count as
|
|
125
|
+
* height count as tall as their words, and texts as a line of their size, near enough for a
|
|
126
|
+
* thumbnail.
|
|
91
127
|
*/
|
|
92
128
|
export function canvasExtent(canvas: Canvas): Box {
|
|
93
129
|
let left = Number.POSITIVE_INFINITY
|
|
@@ -107,16 +143,13 @@ export function canvasExtent(canvas: Canvas): Box {
|
|
|
107
143
|
: { x: 0, y: 0, width: 1, height: 1 }
|
|
108
144
|
}
|
|
109
145
|
|
|
110
|
-
/** The size a text of each size draws at, in pixels. */
|
|
111
|
-
export const TEXT_SIZES = { s: 14, m: 18, l: 28, xl: 44 } as const
|
|
112
|
-
|
|
113
146
|
/** An item's box as a thumbnail draws it, before anything is measured. */
|
|
114
147
|
export function approximateBox(item: CanvasItem): Box | null {
|
|
115
148
|
switch (item.type) {
|
|
116
149
|
case "arrow":
|
|
117
150
|
return null
|
|
118
151
|
case "text": {
|
|
119
|
-
const size =
|
|
152
|
+
const size = CANVAS_TEXT_PIXELS[item.size]
|
|
120
153
|
return {
|
|
121
154
|
x: item.x,
|
|
122
155
|
y: item.y,
|
|
@@ -125,8 +158,27 @@ export function approximateBox(item: CanvasItem): Box | null {
|
|
|
125
158
|
}
|
|
126
159
|
}
|
|
127
160
|
case "note":
|
|
128
|
-
return { x: item.x, y: item.y, width: item.w, height: item.h ?? item
|
|
161
|
+
return { x: item.x, y: item.y, width: item.w, height: item.h ?? noteHeight(item) }
|
|
129
162
|
default:
|
|
130
163
|
return { x: item.x, y: item.y, width: item.w, height: item.h }
|
|
131
164
|
}
|
|
132
165
|
}
|
|
166
|
+
|
|
167
|
+
/** Roughly how wide a character of a note's words is, against its type's size. */
|
|
168
|
+
const NOTE_CHARACTER_WIDTH = 0.55
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* How tall a note without a height draws: as many lines as its words take at its width, inside
|
|
172
|
+
* its padding, and never shorter than the least a note is. A thumbnail can't measure it.
|
|
173
|
+
*/
|
|
174
|
+
function noteHeight(note: CanvasNote): number {
|
|
175
|
+
const size = canvasNoteFontSize(note.w)
|
|
176
|
+
|
|
177
|
+
// The note's own padding: 1em on each side, 0.85em above and below.
|
|
178
|
+
const perLine = Math.max(1, Math.floor((note.w - size * 2) / (size * NOTE_CHARACTER_WIDTH)))
|
|
179
|
+
const lines = note.text
|
|
180
|
+
.split("\n")
|
|
181
|
+
.reduce((count, paragraph) => count + Math.max(1, Math.ceil(paragraph.length / perLine)), 0)
|
|
182
|
+
|
|
183
|
+
return Math.max(Math.min(note.w, 112), lines * size * 1.4 + size * 1.7)
|
|
184
|
+
}
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import type { ArtifactLiveUser } from "@sixb/core/artifacts/live"
|
|
2
|
+
import { type InternalNode, useStore, ViewportPortal } from "@xyflow/react"
|
|
3
|
+
import { Sparkles } from "lucide-react"
|
|
4
|
+
import { memo, useCallback } from "react"
|
|
5
|
+
import { livePersonName, useLivePresence } from "../../live/presence"
|
|
6
|
+
import type { LiveArtifact } from "../../live/session"
|
|
7
|
+
import { useArtifactMessages } from "../../messages"
|
|
8
|
+
import { NAME_SCALE_VALUE } from "./items"
|
|
9
|
+
|
|
10
|
+
/** An item's box on the canvas, as React Flow measured it. */
|
|
11
|
+
interface Box {
|
|
12
|
+
readonly x: number
|
|
13
|
+
readonly y: number
|
|
14
|
+
readonly w: number
|
|
15
|
+
readonly h: number
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* How far down the board view a selection's top must be for its name to show above it: the
|
|
20
|
+
* toolbar, while editing, and a name's height. Higher, the name shows under the selection's top
|
|
21
|
+
* edge, never under the toolbar nor off the view.
|
|
22
|
+
*/
|
|
23
|
+
export const NAME_CLEARANCE = 96
|
|
24
|
+
|
|
25
|
+
/** Whether a selection's name goes under its top edge, where the view puts its box now. */
|
|
26
|
+
export function nameBelow(box: { readonly y: number }, transform: readonly number[]): boolean {
|
|
27
|
+
const [, panY = 0, zoom = 1] = transform
|
|
28
|
+
return box.y * zoom + panY < NAME_CLEARANCE
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Over the canvas, where the others are: each person's selection outlined in their color, their
|
|
33
|
+
* name above it, or just under its top edge near the top of the view, and each board an Agent
|
|
34
|
+
* turn is changing, its outline shimmering and a badge saying so, kept within the board. Drawn
|
|
35
|
+
* in the canvas's own coordinates, it takes no pointer.
|
|
36
|
+
*/
|
|
37
|
+
export const PresenceLayer = memo(function PresenceLayer({
|
|
38
|
+
live,
|
|
39
|
+
}: {
|
|
40
|
+
readonly live: LiveArtifact
|
|
41
|
+
}) {
|
|
42
|
+
const messages = useArtifactMessages().canvas.live
|
|
43
|
+
const all = useArtifactMessages()
|
|
44
|
+
const guestLabel = all.canvas.comments.guest
|
|
45
|
+
const labels = { guest: guestLabel, teamMember: all.live.teamMember }
|
|
46
|
+
const { peers, agents } = useLivePresence(live)
|
|
47
|
+
|
|
48
|
+
// One outline per item someone selected: the first person who did names it.
|
|
49
|
+
const selected = new Map<string, ArtifactLiveUser>()
|
|
50
|
+
for (const peer of peers) {
|
|
51
|
+
for (const id of peer.selection) if (!selected.has(id)) selected.set(id, peer.user)
|
|
52
|
+
}
|
|
53
|
+
const changing = [...new Set(agents.flatMap((agent) => agent.boards))]
|
|
54
|
+
const boxes = useBoxes([...selected.keys(), ...changing])
|
|
55
|
+
// The selections whose names go under their top edge: read again as the view moves, drawn
|
|
56
|
+
// again only as one of them crosses.
|
|
57
|
+
const below = useStore(
|
|
58
|
+
useCallback(
|
|
59
|
+
(state: { readonly transform: readonly number[] }) =>
|
|
60
|
+
[...boxes]
|
|
61
|
+
.filter(([, box]) => nameBelow(box, state.transform))
|
|
62
|
+
.map(([id]) => id)
|
|
63
|
+
.join("\n"),
|
|
64
|
+
[boxes]
|
|
65
|
+
)
|
|
66
|
+
)
|
|
67
|
+
|
|
68
|
+
if (boxes.size === 0) return null
|
|
69
|
+
return (
|
|
70
|
+
<ViewportPortal>
|
|
71
|
+
{changing.map((id) => {
|
|
72
|
+
const box = boxes.get(id)
|
|
73
|
+
return box ? (
|
|
74
|
+
<div
|
|
75
|
+
key={`agent:${id}`}
|
|
76
|
+
data-agent-board={id}
|
|
77
|
+
className="sixb-agent-board pointer-events-none absolute rounded-[12px]"
|
|
78
|
+
style={place(box, 4)}
|
|
79
|
+
>
|
|
80
|
+
{/*
|
|
81
|
+
* The badge's lane: the board's width less its margins, at the badge's scale, so the
|
|
82
|
+
* badge never reaches past the board. Narrow, its words truncate, then leave the icon.
|
|
83
|
+
*/}
|
|
84
|
+
<div
|
|
85
|
+
className="@container absolute top-3 right-3 flex origin-top-right justify-end"
|
|
86
|
+
style={{
|
|
87
|
+
width: `calc(${Math.max(box.w - 16, 0)}px / ${NAME_SCALE_VALUE})`,
|
|
88
|
+
transform: `scale(${NAME_SCALE_VALUE})`,
|
|
89
|
+
}}
|
|
90
|
+
>
|
|
91
|
+
<span
|
|
92
|
+
title={messages.agentChanging}
|
|
93
|
+
className="flex max-w-full min-w-0 items-center gap-1.5 rounded-full bg-background/95 px-2.5 py-1 text-[12px] font-medium whitespace-nowrap text-primary shadow-[0_1px_2px_rgb(0_0_0/0.08),0_6px_16px_-8px_rgb(0_0_0/0.3)] ring-1 ring-[color-mix(in_oklab,var(--primary)_25%,transparent)] @max-[8rem]:px-1.5"
|
|
94
|
+
>
|
|
95
|
+
<Sparkles
|
|
96
|
+
className="size-3.5 shrink-0 motion-safe:animate-pulse"
|
|
97
|
+
aria-hidden="true"
|
|
98
|
+
/>
|
|
99
|
+
<span className="min-w-0 truncate @max-[8rem]:sr-only">
|
|
100
|
+
{messages.agentChanging}
|
|
101
|
+
</span>
|
|
102
|
+
</span>
|
|
103
|
+
</div>
|
|
104
|
+
</div>
|
|
105
|
+
) : null
|
|
106
|
+
})}
|
|
107
|
+
{[...selected].map(([id, user]) => {
|
|
108
|
+
const box = boxes.get(id)
|
|
109
|
+
return box ? (
|
|
110
|
+
<div
|
|
111
|
+
key={`peer:${id}`}
|
|
112
|
+
data-peer-selection={id}
|
|
113
|
+
className="pointer-events-none absolute rounded-[6px]"
|
|
114
|
+
style={{
|
|
115
|
+
...place(box, 3),
|
|
116
|
+
boxShadow: `0 0 0 calc(2px * ${NAME_SCALE_VALUE}) ${user.color}`,
|
|
117
|
+
}}
|
|
118
|
+
>
|
|
119
|
+
<span
|
|
120
|
+
data-name={below.split("\n").includes(id) ? "below" : "above"}
|
|
121
|
+
className="absolute left-0 rounded-[4px] px-1.5 py-px text-[11px] leading-4 font-medium whitespace-nowrap text-white data-[name=above]:bottom-full data-[name=above]:mb-1 data-[name=above]:origin-bottom-left data-[name=below]:top-1 data-[name=below]:left-1 data-[name=below]:origin-top-left"
|
|
122
|
+
style={{ backgroundColor: user.color, transform: `scale(${NAME_SCALE_VALUE})` }}
|
|
123
|
+
>
|
|
124
|
+
{livePersonName(user, labels)}
|
|
125
|
+
{user.guest && user.name ? <span className="opacity-75"> · {guestLabel}</span> : null}
|
|
126
|
+
</span>
|
|
127
|
+
</div>
|
|
128
|
+
) : null
|
|
129
|
+
})}
|
|
130
|
+
</ViewportPortal>
|
|
131
|
+
)
|
|
132
|
+
})
|
|
133
|
+
|
|
134
|
+
/** A box drawn `margin` pixels around an item. */
|
|
135
|
+
function place(box: Box, margin: number) {
|
|
136
|
+
return {
|
|
137
|
+
transform: `translate(${box.x - margin}px, ${box.y - margin}px)`,
|
|
138
|
+
width: box.w + margin * 2,
|
|
139
|
+
height: box.h + margin * 2,
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/** The boxes of these items, read again only as one of them moves or changes size. */
|
|
144
|
+
function useBoxes(ids: readonly string[]): ReadonlyMap<string, Box> {
|
|
145
|
+
const key = ids.join("\n")
|
|
146
|
+
const select = useCallback(
|
|
147
|
+
(state: { readonly nodeLookup: ReadonlyMap<string, InternalNode> }) => {
|
|
148
|
+
const boxes = new Map<string, Box>()
|
|
149
|
+
for (const id of key ? key.split("\n") : []) {
|
|
150
|
+
const node = state.nodeLookup.get(id)
|
|
151
|
+
const box = node ? boxOf(node) : null
|
|
152
|
+
if (box) boxes.set(id, box)
|
|
153
|
+
}
|
|
154
|
+
return boxes
|
|
155
|
+
},
|
|
156
|
+
[key]
|
|
157
|
+
)
|
|
158
|
+
return useStore(select, sameBoxes)
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
function boxOf(node: InternalNode): Box | null {
|
|
162
|
+
const w = node.measured.width ?? node.width
|
|
163
|
+
const h = node.measured.height ?? node.height
|
|
164
|
+
if (w === undefined || h === undefined) return null
|
|
165
|
+
const { x, y } = node.internals.positionAbsolute
|
|
166
|
+
return { x, y, w, h }
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
function sameBoxes(left: ReadonlyMap<string, Box>, right: ReadonlyMap<string, Box>): boolean {
|
|
170
|
+
if (left.size !== right.size) return false
|
|
171
|
+
for (const [id, box] of left) {
|
|
172
|
+
const other = right.get(id)
|
|
173
|
+
if (
|
|
174
|
+
!other ||
|
|
175
|
+
other.x !== box.x ||
|
|
176
|
+
other.y !== box.y ||
|
|
177
|
+
other.w !== box.w ||
|
|
178
|
+
other.h !== box.h
|
|
179
|
+
) {
|
|
180
|
+
return false
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
return true
|
|
184
|
+
}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { client, getArtifactVersion, withSharedAccess } from "@sixb/client"
|
|
2
|
+
import { BOARD_PREVIEW_WAIT_MS, SMALL_BOARD_PREVIEW_WIDTH } from "@sixb/core/artifacts"
|
|
3
|
+
import { type Query, useQuery } from "@tanstack/react-query"
|
|
4
|
+
import type { ArtifactVersion } from "../../queries"
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Whether a board's picture can be shown: `ready`, `pending` while it is rendered, `none` when
|
|
8
|
+
* none will come and the board shows its outline.
|
|
9
|
+
*/
|
|
10
|
+
export type BoardPreviewStatus = "ready" | "pending" | "none"
|
|
11
|
+
|
|
12
|
+
export type BoardPreviews = Readonly<Record<string, BoardPreviewStatus>>
|
|
13
|
+
|
|
14
|
+
const NO_PREVIEWS: BoardPreviews = {}
|
|
15
|
+
|
|
16
|
+
/** The first look again for pictures still rendered, and the longest between two. */
|
|
17
|
+
const FIRST_CHECK_MS = 2_000
|
|
18
|
+
const LONGEST_CHECK_MS = 30_000
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* How long to wait before asking the version again which pictures are ready: never when none is
|
|
22
|
+
* pending or the version's last write is past the server's wait, else a little longer each time
|
|
23
|
+
* it is asked. An open version waits from its last write, as the server does.
|
|
24
|
+
*/
|
|
25
|
+
export function nextPreviewCheck(
|
|
26
|
+
previews: BoardPreviews,
|
|
27
|
+
version: Pick<ArtifactVersion, "updatedAt">,
|
|
28
|
+
checks: number,
|
|
29
|
+
now: number
|
|
30
|
+
): number | false {
|
|
31
|
+
if (!Object.values(previews).includes("pending")) return false
|
|
32
|
+
|
|
33
|
+
if (now - Date.parse(version.updatedAt) >= BOARD_PREVIEW_WAIT_MS) return false
|
|
34
|
+
|
|
35
|
+
return Math.min(LONGEST_CHECK_MS, FIRST_CHECK_MS * 1.5 ** checks)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* A canvas version's boards and whether each one's picture is ready, asked again while some are
|
|
40
|
+
* rendered, as {@link nextPreviewCheck} says. Its own query, so the viewer's version stays as it
|
|
41
|
+
* was read. Without a version, a canvas drawn on its own, no board has a picture.
|
|
42
|
+
*/
|
|
43
|
+
export function useBoardPreviews(version: ArtifactVersion | undefined): BoardPreviews {
|
|
44
|
+
return useQuery(boardPreviewsQuery(version)).data ?? NO_PREVIEWS
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* The query {@link useBoardPreviews} runs. The version's own answer starts it when it holds one:
|
|
49
|
+
* one without it, such as a version seeded from elsewhere, is asked rather than read as none.
|
|
50
|
+
*/
|
|
51
|
+
export function boardPreviewsQuery(version: ArtifactVersion | undefined) {
|
|
52
|
+
return {
|
|
53
|
+
// A revision's boards are pictured once: an open version that changed asks again.
|
|
54
|
+
queryKey: ["artifact-board-previews", version?.artifactId, version?.version, version?.revision],
|
|
55
|
+
queryFn: async (): Promise<BoardPreviews> => {
|
|
56
|
+
if (!version) return NO_PREVIEWS
|
|
57
|
+
|
|
58
|
+
const { data } = await getArtifactVersion({
|
|
59
|
+
path: { artifactId: version.artifactId, version: String(version.version) },
|
|
60
|
+
throwOnError: true,
|
|
61
|
+
})
|
|
62
|
+
return data.boardPreviews ?? NO_PREVIEWS
|
|
63
|
+
},
|
|
64
|
+
...(version?.boardPreviews ? { initialData: version.boardPreviews } : {}),
|
|
65
|
+
enabled: version !== undefined,
|
|
66
|
+
staleTime: Number.POSITIVE_INFINITY,
|
|
67
|
+
retry: false,
|
|
68
|
+
refetchInterval: (current: Query<BoardPreviews>) =>
|
|
69
|
+
version
|
|
70
|
+
? nextPreviewCheck(
|
|
71
|
+
current.state.data ?? NO_PREVIEWS,
|
|
72
|
+
version,
|
|
73
|
+
current.state.dataUpdateCount,
|
|
74
|
+
Date.now()
|
|
75
|
+
)
|
|
76
|
+
: false,
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/** A board's picture at its own size, or one at most {@link SMALL_BOARD_PREVIEW_WIDTH} wide. */
|
|
81
|
+
export type BoardPreviewSize = "small" | "full"
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* The picture a board's tile shows, from how wide it is on screen: the small one while that
|
|
85
|
+
* covers it pixel for pixel, the full one past it, so a canvas fitted to a hundred boards holds a
|
|
86
|
+
* hundred small pictures, not a hundred screens.
|
|
87
|
+
*/
|
|
88
|
+
export function boardPreviewSize(screenWidth: number, pixelRatio: number): BoardPreviewSize {
|
|
89
|
+
return screenWidth * pixelRatio <= SMALL_BOARD_PREVIEW_WIDTH ? "small" : "full"
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Where a board's picture is, in the reader's mode, at a size, of what the board shows: the
|
|
94
|
+
* server picks the mode a canvas pins, and the full size is its default. Named by the board's
|
|
95
|
+
* render key, the picture stays the same while the board does, however often an open canvas
|
|
96
|
+
* changes around it, as it does edited live; without one, by the revision shown. Either way it is
|
|
97
|
+
* kept for good, and one the version moved past is not found, never shown.
|
|
98
|
+
*/
|
|
99
|
+
export function boardPreviewUrl(
|
|
100
|
+
version: Pick<ArtifactVersion, "artifactId" | "version" | "revision" | "outline">,
|
|
101
|
+
board: string,
|
|
102
|
+
mode: "light" | "dark",
|
|
103
|
+
size: BoardPreviewSize = "full"
|
|
104
|
+
): string {
|
|
105
|
+
const artifact = `/api/artifacts/${encodeURIComponent(version.artifactId)}`
|
|
106
|
+
const path = `${artifact}/versions/${version.version}/boards/${encodeURIComponent(board)}/preview`
|
|
107
|
+
const url = new URL(path, client.getConfig().baseUrl || window.location.origin)
|
|
108
|
+
url.searchParams.set("theme", mode)
|
|
109
|
+
if (size === "small") url.searchParams.set("size", "small")
|
|
110
|
+
const key = renderKeyOf(version, board)
|
|
111
|
+
if (key) url.searchParams.set("key", key)
|
|
112
|
+
else url.searchParams.set("revision", String(version.revision))
|
|
113
|
+
// An `<img>` sends no header: a shared link's session names its grant in the address.
|
|
114
|
+
return withSharedAccess(url.toString())
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/** The render key a version's outline gives a board, if it gives one. */
|
|
118
|
+
export function renderKeyOf(
|
|
119
|
+
version: Pick<ArtifactVersion, "outline">,
|
|
120
|
+
board: string
|
|
121
|
+
): string | undefined {
|
|
122
|
+
if (version.outline.kind !== "canvas") return undefined
|
|
123
|
+
const item = version.outline.items.find(
|
|
124
|
+
(candidate) => candidate.type === "board" && candidate.id === board
|
|
125
|
+
)
|
|
126
|
+
return item?.type === "board" ? item.renderKey : undefined
|
|
127
|
+
}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { CANVAS_FILE, type Canvas, parseCanvas } from "@sixb/core/artifacts"
|
|
2
2
|
import { useOptionalTheme } from "@sixb/ui/hooks"
|
|
3
|
-
import {
|
|
4
|
-
import { lazy, Suspense, useEffect, useMemo, useState } from "react"
|
|
3
|
+
import { lazy, Suspense, useEffect, useMemo, useState, useSyncExternalStore } from "react"
|
|
5
4
|
import { useArtifactEditing, useReportDraft } from "../../edit-session"
|
|
6
5
|
import { type History, recordChange, redoChange, startHistory, undoChange } from "../../history"
|
|
6
|
+
import { type LiveCanvas, liveCanvasOf } from "../../live/canvas"
|
|
7
|
+
import { useLiveArtifactState, useViewerLiveArtifact } from "../../live/hooks"
|
|
8
|
+
import { shareSelection } from "../../live/presence"
|
|
9
|
+
import type { LiveArtifact } from "../../live/session"
|
|
7
10
|
import { useArtifactMessages } from "../../messages"
|
|
8
11
|
import { type ArtifactVersion, useFileText, versionFileSource } from "../../queries"
|
|
9
12
|
import { useArtifactThemeAttributes } from "../../theme"
|
|
@@ -17,8 +20,13 @@ const CanvasBoard = lazy(() => import("./canvas"))
|
|
|
17
20
|
* A version's `canvas.json`, parsed once it is read: undefined until then, and null when it
|
|
18
21
|
* cannot be read or does not parse.
|
|
19
22
|
*/
|
|
20
|
-
export function useCanvas(
|
|
21
|
-
|
|
23
|
+
export function useCanvas(
|
|
24
|
+
version: ArtifactVersion,
|
|
25
|
+
options: { readonly enabled?: boolean } = {}
|
|
26
|
+
): Canvas | null | undefined {
|
|
27
|
+
const file = useFileText(
|
|
28
|
+
options.enabled === false ? null : versionFileSource(version, CANVAS_FILE)
|
|
29
|
+
)
|
|
22
30
|
return useMemo(() => {
|
|
23
31
|
if (file.text === undefined) return file.loading ? undefined : null
|
|
24
32
|
const parsed = parseCanvas(file.text)
|
|
@@ -26,7 +34,27 @@ export function useCanvas(version: ArtifactVersion): Canvas | null | undefined {
|
|
|
26
34
|
}, [file.text, file.loading])
|
|
27
35
|
}
|
|
28
36
|
|
|
29
|
-
/**
|
|
37
|
+
/** The mode a canvas's boards draw in: the one its theme.json pins, else the app's. */
|
|
38
|
+
export function useCanvasMode(version: ArtifactVersion): "light" | "dark" {
|
|
39
|
+
const theme = useArtifactThemeAttributes(version)
|
|
40
|
+
const app = useOptionalTheme()?.resolvedTheme
|
|
41
|
+
|
|
42
|
+
if (theme.className === "dark" || theme.className === "light") return theme.className
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
app ??
|
|
46
|
+
(typeof document !== "undefined" && document.documentElement.classList.contains("dark")
|
|
47
|
+
? "dark"
|
|
48
|
+
: "light")
|
|
49
|
+
)
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* A canvas artifact: its board, in the app's theme or its own, opened where an address points.
|
|
54
|
+
* Held live by the viewer, it is drawn from its live document once that holds it, everyone's
|
|
55
|
+
* changes as they make them, and edited there; else from the version's `canvas.json`, edited as
|
|
56
|
+
* a draft the header saves.
|
|
57
|
+
*/
|
|
30
58
|
export function CanvasRenderer({
|
|
31
59
|
version,
|
|
32
60
|
part,
|
|
@@ -36,33 +64,33 @@ export function CanvasRenderer({
|
|
|
36
64
|
}) {
|
|
37
65
|
const messages = useArtifactMessages()
|
|
38
66
|
const theme = useArtifactThemeAttributes(version)
|
|
39
|
-
const
|
|
40
|
-
const
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
67
|
+
const mode = useCanvasMode(version)
|
|
68
|
+
const live = useViewerLiveArtifact()
|
|
69
|
+
const liveState = useLiveArtifactState(live)
|
|
70
|
+
const liveCanvas = live && liveState.synced && !liveState.left ? liveCanvasOf(live) : null
|
|
71
|
+
const fromDocument = useLiveCanvas(liveCanvas)
|
|
72
|
+
const fromVersion = useCanvas(version, { enabled: !fromDocument })
|
|
73
|
+
const canvas = fromDocument ?? fromVersion
|
|
74
|
+
const editing = useArtifactEditing()
|
|
75
|
+
const liveEdit = useLiveEditor(
|
|
76
|
+
live,
|
|
77
|
+
fromDocument && editing && liveState.access === "edit" ? liveCanvas : null
|
|
78
|
+
)
|
|
79
|
+
const draft = useCanvasDraft(fromDocument ? undefined : canvas)
|
|
50
80
|
const loading = <ViewerLoading label={messages.viewer.loading} />
|
|
51
81
|
if (canvas === undefined) return loading
|
|
52
82
|
if (canvas === null) return <ViewerNotice title={messages.canvas.loadFailed} />
|
|
53
83
|
return (
|
|
54
|
-
<div
|
|
55
|
-
data-sixb-artifact=""
|
|
56
|
-
className={cn("flex min-h-0 flex-1 flex-col", theme.className)}
|
|
57
|
-
style={theme.style}
|
|
58
|
-
>
|
|
84
|
+
<div data-sixb-artifact="" className="flex min-h-0 flex-1 flex-col">
|
|
59
85
|
<Suspense fallback={loading}>
|
|
60
86
|
<CanvasBoard
|
|
61
87
|
canvas={draft.canvas ?? canvas}
|
|
62
|
-
{...(draft.edit ? { edit: draft.edit } : {})}
|
|
88
|
+
{...(liveEdit ? { edit: liveEdit } : draft.edit ? { edit: draft.edit } : {})}
|
|
89
|
+
{...(fromDocument && live ? { live } : {})}
|
|
63
90
|
version={version}
|
|
64
91
|
title={version.title}
|
|
65
92
|
mode={mode}
|
|
93
|
+
theme={theme}
|
|
66
94
|
{...(part ? { focus: part } : {})}
|
|
67
95
|
/>
|
|
68
96
|
</Suspense>
|
|
@@ -70,6 +98,43 @@ export function CanvasRenderer({
|
|
|
70
98
|
)
|
|
71
99
|
}
|
|
72
100
|
|
|
101
|
+
const noSubscription = () => () => {}
|
|
102
|
+
const nothing = () => null
|
|
103
|
+
|
|
104
|
+
/** The canvas a live document holds, as it changes; null while there is none. */
|
|
105
|
+
function useLiveCanvas(canvas: LiveCanvas | null): Canvas | null {
|
|
106
|
+
return useSyncExternalStore(
|
|
107
|
+
canvas?.subscribe ?? noSubscription,
|
|
108
|
+
canvas?.getCanvas ?? nothing,
|
|
109
|
+
nothing
|
|
110
|
+
)
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Editing the live document: each change written for everyone at once, this reader's own taken
|
|
115
|
+
* back by undo, and what they select shown to the others. Null while not editing.
|
|
116
|
+
*/
|
|
117
|
+
function useLiveEditor(live: LiveArtifact | null, canvas: LiveCanvas | null): CanvasEditor | null {
|
|
118
|
+
return useMemo<CanvasEditor | null>(
|
|
119
|
+
() =>
|
|
120
|
+
live && canvas
|
|
121
|
+
? {
|
|
122
|
+
apply: (change) => canvas.apply(change),
|
|
123
|
+
undo: () => canvas.undo(),
|
|
124
|
+
redo: () => canvas.redo(),
|
|
125
|
+
live: {
|
|
126
|
+
startDrag: () => canvas.startDrag(),
|
|
127
|
+
endDrag: () => canvas.endDrag(),
|
|
128
|
+
stopCapturing: () => canvas.stopCapturing(),
|
|
129
|
+
select: (ids) => shareSelection(live, ids),
|
|
130
|
+
editBoard: (path, make, files) => canvas.editBoard(path, make, files),
|
|
131
|
+
},
|
|
132
|
+
}
|
|
133
|
+
: null,
|
|
134
|
+
[live, canvas]
|
|
135
|
+
)
|
|
136
|
+
}
|
|
137
|
+
|
|
73
138
|
/**
|
|
74
139
|
* The canvas as the reader arranges it, while the viewer is editing: each change a step for undo,
|
|
75
140
|
* and the draft reported to the header's Save. Leaving editing drops it.
|