@sixb/app 0.2.0 → 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/assets/connector-icons/README.md +1 -0
- package/assets/connector-icons/fleetio.ico +0 -0
- package/dist/agent/activity-label.d.ts.map +1 -1
- 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/background/background-card.d.ts +10 -0
- package/dist/agent/background/background-card.d.ts.map +1 -0
- package/dist/agent/background/background-tool-row.d.ts +9 -0
- package/dist/agent/background/background-tool-row.d.ts.map +1 -0
- package/dist/agent/background/context.d.ts +23 -0
- package/dist/agent/background/context.d.ts.map +1 -0
- package/dist/agent/background/interpret.d.ts +116 -0
- package/dist/agent/background/interpret.d.ts.map +1 -0
- package/dist/agent/bash/bash-tool-view.d.ts.map +1 -1
- package/dist/agent/bash/interpret.d.ts +4 -0
- package/dist/agent/bash/interpret.d.ts.map +1 -1
- package/dist/agent/components/composer-menu.d.ts +3 -1
- package/dist/agent/components/composer-menu.d.ts.map +1 -1
- package/dist/agent/components/composer-place.d.ts +13 -0
- package/dist/agent/components/composer-place.d.ts.map +1 -0
- package/dist/agent/components/composer.d.ts +23 -1
- package/dist/agent/components/composer.d.ts.map +1 -1
- package/dist/agent/components/computer-place.d.ts +3 -1
- package/dist/agent/components/computer-place.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/components/transcript.d.ts +6 -0
- package/dist/agent/components/transcript.d.ts.map +1 -1
- package/dist/agent/components/web-fetch-tool-view.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/child-parts.d.ts +2 -0
- package/dist/agent/delegation/child-parts.d.ts.map +1 -1
- 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 +24 -4
- package/dist/agent/hooks/use-agent-conversation.d.ts.map +1 -1
- package/dist/agent/hooks/use-new-thread-place.d.ts +70 -0
- package/dist/agent/hooks/use-new-thread-place.d.ts.map +1 -0
- package/dist/agent/hooks/use-thread-lists.d.ts +40 -0
- package/dist/agent/hooks/use-thread-lists.d.ts.map +1 -1
- package/dist/agent/i18n/en.d.ts +74 -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 +126 -0
- package/dist/agent/i18n/index.d.ts.map +1 -1
- package/dist/agent/observed-conversation.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/agent/utils/web-fetch.d.ts +33 -1
- package/dist/agent/utils/web-fetch.d.ts.map +1 -1
- package/dist/agent/utils/web-search.d.ts +14 -2
- package/dist/agent/utils/web-search.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-fw2bm6dq.js → chunk-001c4gnk.js} +8086 -3870
- 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-j9653e83.js → chunk-fwb9mxwm.js} +1 -1
- package/dist/{chunk-km25essq.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/shared.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 +2 -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 +8195 -4841
- package/dist/pages.js.map +58 -49
- 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/activity-label.ts +6 -2
- 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/agent.css +18 -0
- package/src/agent/artifact-card.tsx +84 -16
- package/src/agent/artifact-panel.tsx +63 -43
- package/src/agent/background/background-card.tsx +308 -0
- package/src/agent/background/background-tool-row.tsx +58 -0
- package/src/agent/background/context.ts +26 -0
- package/src/agent/background/interpret.ts +356 -0
- package/src/agent/bash/bash-tool-view.tsx +9 -4
- package/src/agent/bash/interpret.ts +21 -3
- package/src/agent/components/agent-message-body.tsx +1 -1
- package/src/agent/components/composer-menu.tsx +4 -1
- package/src/agent/components/composer-place.tsx +168 -0
- package/src/agent/components/composer.tsx +101 -3
- package/src/agent/components/computer-place.tsx +18 -1
- 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/components/transcript.tsx +33 -1
- package/src/agent/components/web-fetch-tool-view.tsx +94 -29
- package/src/agent/composer-insertion.ts +36 -0
- package/src/agent/delegation/child-parts.tsx +1 -1
- package/src/agent/hooks/use-agent-conversation.ts +101 -8
- package/src/agent/hooks/use-new-thread-place.ts +294 -0
- package/src/agent/i18n/en.ts +70 -3
- package/src/agent/i18n/fr.ts +70 -3
- package/src/agent/observed-conversation.tsx +3 -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 +29 -11
- package/src/agent/types.ts +4 -0
- package/src/agent/utils/web-fetch.ts +89 -10
- package/src/agent/utils/web-search.ts +67 -28
- 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/shared.tsx +1 -0
- 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 +2 -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 +17 -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-4mprsd2n.js.map +0 -10
- package/dist/chunk-fw2bm6dq.js.map +0 -182
- package/dist/chunk-zxthr2q5.js +0 -1487
- package/dist/chunk-zxthr2q5.js.map +0 -18
- /package/dist/{chunk-j9653e83.js.map → chunk-fwb9mxwm.js.map} +0 -0
- /package/dist/{chunk-km25essq.js.map → chunk-kes4ygmz.js.map} +0 -0
- /package/dist/{chunk-kwbw4dyk.js.map → chunk-ryed2jq8.js.map} +0 -0
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
import {
|
|
2
|
+
type AddArtifactCommentData,
|
|
3
|
+
addArtifactComment,
|
|
4
|
+
deleteArtifactComment,
|
|
5
|
+
isSixbApiError,
|
|
6
|
+
type ListArtifactCommentsResponse,
|
|
7
|
+
resolveArtifactComment,
|
|
8
|
+
} from "@sixb/client"
|
|
9
|
+
import { listArtifactCommentsOptions, listArtifactCommentsQueryKey } from "@sixb/client/hooks"
|
|
10
|
+
import { type QueryClient, useQuery } from "@tanstack/react-query"
|
|
11
|
+
import { useMemo } from "react"
|
|
12
|
+
import { useCurrentUser } from "../../../session"
|
|
13
|
+
import { useSharedGuest } from "../../../shared-session"
|
|
14
|
+
import { useArtifactMessages } from "../../messages"
|
|
15
|
+
|
|
16
|
+
// The comments on a canvas: read once, kept in step as anyone adds, resolves or deletes one by the
|
|
17
|
+
// `artifact.commented` events the viewer follows, and changed in place by the reader's own
|
|
18
|
+
// actions, so the panel answers at once.
|
|
19
|
+
|
|
20
|
+
export type ArtifactComment = ListArtifactCommentsResponse["comments"][number]
|
|
21
|
+
export type ArtifactCommentAnchor = ArtifactComment["anchor"]
|
|
22
|
+
|
|
23
|
+
/** A comment and its replies, oldest first. */
|
|
24
|
+
export interface CommentThread {
|
|
25
|
+
readonly comment: ArtifactComment
|
|
26
|
+
readonly replies: readonly ArtifactComment[]
|
|
27
|
+
/** Its place among the canvas's threads, from 1, as its pin shows it. */
|
|
28
|
+
readonly number: number
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** Why a comment action failed, in the reader's terms. */
|
|
32
|
+
export type CommentFailure = "full" | "invalid" | "notAllowed" | "gone" | "failed" | "name"
|
|
33
|
+
|
|
34
|
+
export class CommentActionError extends Error {
|
|
35
|
+
readonly name = "CommentActionError"
|
|
36
|
+
|
|
37
|
+
constructor(readonly failure: CommentFailure) {
|
|
38
|
+
super(`[SixbApp] The comment action failed: ${failure}.`)
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** The threads of these comments, in the order they were started; replies under each. */
|
|
43
|
+
export function commentThreads(comments: readonly ArtifactComment[]): CommentThread[] {
|
|
44
|
+
const replies = new Map<string, ArtifactComment[]>()
|
|
45
|
+
for (const comment of comments) {
|
|
46
|
+
if (!comment.parentId) continue
|
|
47
|
+
const list = replies.get(comment.parentId) ?? []
|
|
48
|
+
list.push(comment)
|
|
49
|
+
replies.set(comment.parentId, list)
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return comments
|
|
53
|
+
.filter((comment) => !comment.parentId)
|
|
54
|
+
.map((comment, index) => ({
|
|
55
|
+
comment,
|
|
56
|
+
replies: replies.get(comment.id) ?? [],
|
|
57
|
+
number: index + 1,
|
|
58
|
+
}))
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const NO_COMMENTS: readonly ArtifactComment[] = []
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* The comments on an artifact, as threads. They are read again whenever someone changes one, as
|
|
65
|
+
* `useArtifactUpdates` hears it on the events socket.
|
|
66
|
+
*/
|
|
67
|
+
export function useArtifactComments(artifactId: string | null): {
|
|
68
|
+
readonly threads: readonly CommentThread[]
|
|
69
|
+
readonly loading: boolean
|
|
70
|
+
readonly failed: boolean
|
|
71
|
+
} {
|
|
72
|
+
const query = useQuery({
|
|
73
|
+
...listArtifactCommentsOptions({ path: { artifactId: artifactId ?? "" } }),
|
|
74
|
+
enabled: artifactId !== null,
|
|
75
|
+
retry: false,
|
|
76
|
+
})
|
|
77
|
+
|
|
78
|
+
const comments = query.data?.comments ?? NO_COMMENTS
|
|
79
|
+
const threads = useMemo(() => commentThreads(comments), [comments])
|
|
80
|
+
return { threads, loading: query.isLoading, failed: query.isError }
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function commentsKey(artifactId: string) {
|
|
84
|
+
return listArtifactCommentsQueryKey({ path: { artifactId } })
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/** Changes the cached comments of an artifact, as a change the reader made shows at once. */
|
|
88
|
+
function updateCached(
|
|
89
|
+
queries: QueryClient,
|
|
90
|
+
artifactId: string,
|
|
91
|
+
update: (comments: readonly ArtifactComment[]) => readonly ArtifactComment[]
|
|
92
|
+
): void {
|
|
93
|
+
queries.setQueryData<ListArtifactCommentsResponse>(commentsKey(artifactId), (current) =>
|
|
94
|
+
current ? { ...current, comments: [...update(current.comments)] } : current
|
|
95
|
+
)
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/** Adds a comment, or a reply, as the reader; it shows in the panel as soon as it is taken. */
|
|
99
|
+
export async function addComment(
|
|
100
|
+
queries: QueryClient,
|
|
101
|
+
artifactId: string,
|
|
102
|
+
body: AddArtifactCommentData["body"]
|
|
103
|
+
): Promise<ArtifactComment> {
|
|
104
|
+
try {
|
|
105
|
+
const { data } = await addArtifactComment({
|
|
106
|
+
path: { artifactId },
|
|
107
|
+
body,
|
|
108
|
+
throwOnError: true,
|
|
109
|
+
})
|
|
110
|
+
updateCached(queries, artifactId, (comments) =>
|
|
111
|
+
comments.some((comment) => comment.id === data.id) ? comments : [...comments, data]
|
|
112
|
+
)
|
|
113
|
+
return data
|
|
114
|
+
} catch (error) {
|
|
115
|
+
throw commentError(error)
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/** Marks a comment resolved, or opens it again. */
|
|
120
|
+
export async function resolveComment(
|
|
121
|
+
queries: QueryClient,
|
|
122
|
+
artifactId: string,
|
|
123
|
+
commentId: string,
|
|
124
|
+
resolved: boolean
|
|
125
|
+
): Promise<void> {
|
|
126
|
+
try {
|
|
127
|
+
const { data } = await resolveArtifactComment({
|
|
128
|
+
path: { artifactId, commentId },
|
|
129
|
+
body: { resolved },
|
|
130
|
+
throwOnError: true,
|
|
131
|
+
})
|
|
132
|
+
updateCached(queries, artifactId, (comments) =>
|
|
133
|
+
comments.map((comment) => (comment.id === data.id ? data : comment))
|
|
134
|
+
)
|
|
135
|
+
} catch (error) {
|
|
136
|
+
throw commentError(error)
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/** Deletes a comment and its replies. */
|
|
141
|
+
export async function deleteComment(
|
|
142
|
+
queries: QueryClient,
|
|
143
|
+
artifactId: string,
|
|
144
|
+
commentId: string
|
|
145
|
+
): Promise<void> {
|
|
146
|
+
try {
|
|
147
|
+
await deleteArtifactComment({ path: { artifactId, commentId }, throwOnError: true })
|
|
148
|
+
updateCached(queries, artifactId, (comments) =>
|
|
149
|
+
comments.filter((comment) => comment.id !== commentId && comment.parentId !== commentId)
|
|
150
|
+
)
|
|
151
|
+
} catch (error) {
|
|
152
|
+
throw commentError(error)
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
function commentError(error: unknown): CommentActionError {
|
|
157
|
+
if (!isSixbApiError(error)) return new CommentActionError("failed")
|
|
158
|
+
switch (error.code) {
|
|
159
|
+
case "comments_full":
|
|
160
|
+
return new CommentActionError("full")
|
|
161
|
+
case "invalid_comment":
|
|
162
|
+
return new CommentActionError("invalid")
|
|
163
|
+
case "name_required":
|
|
164
|
+
case "invalid_name":
|
|
165
|
+
return new CommentActionError("name")
|
|
166
|
+
case "not_allowed":
|
|
167
|
+
return new CommentActionError("notAllowed")
|
|
168
|
+
case "comment_not_found":
|
|
169
|
+
case "artifact_not_found":
|
|
170
|
+
return new CommentActionError("gone")
|
|
171
|
+
default:
|
|
172
|
+
return new CommentActionError("failed")
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Whether the reader may resolve or delete a comment: its author, or whoever may change the
|
|
178
|
+
* artifact, as the API decides.
|
|
179
|
+
*/
|
|
180
|
+
export function canManageComment(
|
|
181
|
+
comment: Pick<ArtifactComment, "author">,
|
|
182
|
+
access: "owner" | "update" | "read",
|
|
183
|
+
userId: string | null
|
|
184
|
+
): boolean {
|
|
185
|
+
if (access === "owner" || access === "update") return true
|
|
186
|
+
return comment.author.type === "user" && comment.author.id === userId
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/** Who wrote a comment, as the panel says it. */
|
|
190
|
+
export interface CommentAuthor {
|
|
191
|
+
readonly name: string
|
|
192
|
+
readonly you: boolean
|
|
193
|
+
/** The Agent wrote it, for its author. */
|
|
194
|
+
readonly agent?: boolean
|
|
195
|
+
/** A shared link's visitor wrote it, under a name nobody vouches for. */
|
|
196
|
+
readonly guest?: boolean
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* Who wrote a comment: the reader themselves, else the name the API gives its author, and the
|
|
201
|
+
* Agent for them when its run wrote it. A shared link's guest is marked as one, for everyone, and
|
|
202
|
+
* is "you" to themselves. Null for an author the project cannot name.
|
|
203
|
+
*/
|
|
204
|
+
export function useCommentAuthors(): (
|
|
205
|
+
comment: Pick<ArtifactComment, "author" | "authorName" | "origin">
|
|
206
|
+
) => CommentAuthor | null {
|
|
207
|
+
const user = useCurrentUser()
|
|
208
|
+
const guest = useSharedGuest()
|
|
209
|
+
const messages = useArtifactMessages().canvas.comments
|
|
210
|
+
|
|
211
|
+
return ({ author, authorName, origin }) => {
|
|
212
|
+
if (author.type === "guest") {
|
|
213
|
+
const name = authorName ?? messages.guest
|
|
214
|
+
return { name, you: author.id === guest?.id, guest: true }
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
const own = author.type === "user" && author.id === user?.id
|
|
218
|
+
if (origin) {
|
|
219
|
+
const name = own ? messages.you.toLowerCase() : (authorName ?? messages.someone)
|
|
220
|
+
return { name: messages.agentFor(name), you: false, agent: true }
|
|
221
|
+
}
|
|
222
|
+
if (own) return { name: user.displayName ?? user.email ?? authorName ?? "", you: true }
|
|
223
|
+
return authorName ? { name: authorName, you: false } : null
|
|
224
|
+
}
|
|
225
|
+
}
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
type CanvasItem,
|
|
8
8
|
type CanvasShape,
|
|
9
9
|
type CanvasTextSize,
|
|
10
|
+
formatCanvas,
|
|
10
11
|
} from "@sixb/core/artifacts"
|
|
11
12
|
|
|
12
13
|
/**
|
|
@@ -67,19 +68,20 @@ export function resizeItem(id: string, box: Box): CanvasChange {
|
|
|
67
68
|
})
|
|
68
69
|
}
|
|
69
70
|
|
|
70
|
-
/** An item added at a point, its top left there
|
|
71
|
+
/** An item added at a point, its top left there, under a new id of its kind. */
|
|
71
72
|
export function addItem(
|
|
72
73
|
kind: NewItem,
|
|
73
74
|
at: { x: number; y: number },
|
|
74
75
|
text: string
|
|
75
76
|
): {
|
|
76
77
|
readonly change: CanvasChange
|
|
77
|
-
readonly id:
|
|
78
|
+
readonly id: string
|
|
78
79
|
} {
|
|
79
|
-
const id = (
|
|
80
|
+
const id = newItemId(kind)
|
|
80
81
|
const change: CanvasChange = (canvas) => {
|
|
81
82
|
if (canvas.items.length >= ARTIFACT_LIMITS.maxCanvasItems) return canvas
|
|
82
|
-
|
|
83
|
+
if (canvas.items.some((item) => item.id === id)) return canvas
|
|
84
|
+
const place = { id, x: position(at.x), y: position(at.y) }
|
|
83
85
|
const item: CanvasItem =
|
|
84
86
|
kind === "note"
|
|
85
87
|
? { ...place, type: "note", w: 240, text }
|
|
@@ -119,20 +121,27 @@ export function duplicateItems(ids: ReadonlySet<string>): {
|
|
|
119
121
|
readonly change: CanvasChange
|
|
120
122
|
readonly copies: (canvas: Canvas) => readonly string[]
|
|
121
123
|
} {
|
|
122
|
-
|
|
124
|
+
// Each copy's id, new once and then the same: the change and the copies it names agree.
|
|
125
|
+
const names = new Map<string, string>()
|
|
126
|
+
const copyOf = (id: string) => {
|
|
127
|
+
let name = names.get(id)
|
|
128
|
+
if (!name) {
|
|
129
|
+
name = newItemId(id)
|
|
130
|
+
names.set(id, name)
|
|
131
|
+
}
|
|
132
|
+
return name
|
|
133
|
+
}
|
|
134
|
+
/** Each item copied, by its id, and its copy's. */
|
|
123
135
|
const plan = (canvas: Canvas) => {
|
|
124
|
-
const taken = new Set(canvas.items.map((item) => item.id))
|
|
125
136
|
const renamed = new Map<string, string>()
|
|
126
137
|
for (const item of canvas.items) {
|
|
127
138
|
if (!ids.has(item.id) || item.type === "arrow") continue
|
|
128
|
-
|
|
129
|
-
taken.add(id)
|
|
130
|
-
renamed.set(item.id, id)
|
|
139
|
+
renamed.set(item.id, copyOf(item.id))
|
|
131
140
|
}
|
|
132
|
-
return
|
|
141
|
+
return renamed
|
|
133
142
|
}
|
|
134
143
|
const change: CanvasChange = (canvas) => {
|
|
135
|
-
const
|
|
144
|
+
const renamed = plan(canvas)
|
|
136
145
|
if (renamed.size === 0) return canvas
|
|
137
146
|
const copies: CanvasItem[] = []
|
|
138
147
|
for (const item of canvas.items) {
|
|
@@ -140,9 +149,7 @@ export function duplicateItems(ids: ReadonlySet<string>): {
|
|
|
140
149
|
const from = typeof item.from === "string" ? renamed.get(item.from) : undefined
|
|
141
150
|
const to = typeof item.to === "string" ? renamed.get(item.to) : undefined
|
|
142
151
|
if (!from || !to) continue
|
|
143
|
-
|
|
144
|
-
taken.add(id)
|
|
145
|
-
copies.push({ ...item, id, from, to })
|
|
152
|
+
copies.push({ ...item, id: copyOf(item.id), from, to })
|
|
146
153
|
continue
|
|
147
154
|
}
|
|
148
155
|
const id = renamed.get(item.id)
|
|
@@ -151,7 +158,7 @@ export function duplicateItems(ids: ReadonlySet<string>): {
|
|
|
151
158
|
const room = Math.max(0, ARTIFACT_LIMITS.maxCanvasItems - canvas.items.length)
|
|
152
159
|
return { ...canvas, items: [...canvas.items, ...copies.slice(0, room)] }
|
|
153
160
|
}
|
|
154
|
-
return { change, copies: (canvas) => [...plan(canvas).
|
|
161
|
+
return { change, copies: (canvas) => [...plan(canvas).values()] }
|
|
155
162
|
}
|
|
156
163
|
|
|
157
164
|
/**
|
|
@@ -191,8 +198,9 @@ export function setItemText(id: string, typed: string): CanvasChange {
|
|
|
191
198
|
}
|
|
192
199
|
}
|
|
193
200
|
|
|
194
|
-
/** An arrow from one item to another,
|
|
201
|
+
/** An arrow from one item to another, under a new id; none when they are one item. */
|
|
195
202
|
export function connectItems(from: string, to: string): CanvasChange {
|
|
203
|
+
const id = newItemId("arrow")
|
|
196
204
|
return (canvas) => {
|
|
197
205
|
if (from === to || canvas.items.length >= ARTIFACT_LIMITS.maxCanvasItems) return canvas
|
|
198
206
|
const exists = canvas.items.some(
|
|
@@ -200,7 +208,7 @@ export function connectItems(from: string, to: string): CanvasChange {
|
|
|
200
208
|
)
|
|
201
209
|
if (exists) return canvas
|
|
202
210
|
const arrow: CanvasArrow = {
|
|
203
|
-
id
|
|
211
|
+
id,
|
|
204
212
|
type: "arrow",
|
|
205
213
|
from,
|
|
206
214
|
to,
|
|
@@ -248,42 +256,25 @@ export function canvasFiles(original: Canvas, canvas: Canvas): Map<string, strin
|
|
|
248
256
|
return files
|
|
249
257
|
}
|
|
250
258
|
|
|
251
|
-
/**
|
|
252
|
-
* A canvas as `canvas.json` writes it, the inverse of `parseCanvas`: its items in order, each
|
|
253
|
-
* without what is a default, positions and sizes in whole pixels.
|
|
254
|
-
*/
|
|
255
|
-
export function formatCanvas(canvas: Canvas): string {
|
|
256
|
-
const items = canvas.items.map((item) => {
|
|
257
|
-
if (item.type === "arrow") {
|
|
258
|
-
const { dashed, ...rest } = item
|
|
259
|
-
return dashed ? item : rest
|
|
260
|
-
}
|
|
261
|
-
const rounded = Object.fromEntries(
|
|
262
|
-
Object.entries(item).map(([key, value]) => [
|
|
263
|
-
key,
|
|
264
|
-
typeof value === "number" && ["x", "y", "w", "h"].includes(key) ? Math.round(value) : value,
|
|
265
|
-
])
|
|
266
|
-
)
|
|
267
|
-
if (item.type === "text" && item.size === "m") {
|
|
268
|
-
const { size: _, ...rest } = rounded
|
|
269
|
-
return rest
|
|
270
|
-
}
|
|
271
|
-
return rounded
|
|
272
|
-
})
|
|
273
|
-
return `${JSON.stringify({ items }, null, 2)}\n`
|
|
274
|
-
}
|
|
275
|
-
|
|
276
259
|
/** How far a copy sits from what it copies, down and to the right. */
|
|
277
260
|
const STEP = 32
|
|
278
261
|
|
|
279
|
-
/** The
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
262
|
+
/** The letters and digits a new id ends in, after a dash, and how many. */
|
|
263
|
+
const ID_ALPHABET = "abcdefghijklmnopqrstuvwxyz0123456789"
|
|
264
|
+
const ID_SUFFIX = 6
|
|
265
|
+
/** A suffix a new id was given, letters and digits mixed, or a number. */
|
|
266
|
+
const RANDOM_SUFFIX = /-(?:(?=[a-z]*\d)(?=\d*[a-z])[a-z0-9]{6}|\d+)$/
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* A new item's id: what it is or what it copies, then a dash and six random letters and digits,
|
|
270
|
+
* as `note-k3m9q2`, so two people adding at once never name two items alike. A copy of a copy
|
|
271
|
+
* drops the suffix its original was given. Ids stay within what `canvas.json` takes: forty at most.
|
|
272
|
+
*/
|
|
273
|
+
export function newItemId(base: string): string {
|
|
274
|
+
const stem = base.replace(RANDOM_SUFFIX, "").slice(0, 40 - ID_SUFFIX - 1)
|
|
275
|
+
const bytes = crypto.getRandomValues(new Uint8Array(ID_SUFFIX))
|
|
276
|
+
const suffix = [...bytes].map((byte) => ID_ALPHABET[byte % ID_ALPHABET.length]).join("")
|
|
277
|
+
return `${stem || "item"}-${suffix}`
|
|
287
278
|
}
|
|
288
279
|
|
|
289
280
|
function joins(end: CanvasArrow["from"], ids: ReadonlySet<string>): boolean {
|
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
useRef,
|
|
20
20
|
useState,
|
|
21
21
|
} from "react"
|
|
22
|
+
import type { LiveCanvas } from "../../live/canvas"
|
|
22
23
|
import { useArtifactMessages } from "../../messages"
|
|
23
24
|
import {
|
|
24
25
|
addItem,
|
|
@@ -42,8 +43,25 @@ export interface CanvasEditor {
|
|
|
42
43
|
readonly apply: (change: CanvasChange) => void
|
|
43
44
|
readonly undo: () => void
|
|
44
45
|
readonly redo: () => void
|
|
46
|
+
/**
|
|
47
|
+
* Edits everyone sees as they are made: a drag moves its items for the others while it goes,
|
|
48
|
+
* and is one undo step from its start to its end, however long it pauses.
|
|
49
|
+
*/
|
|
50
|
+
readonly live?: {
|
|
51
|
+
readonly startDrag: () => void
|
|
52
|
+
readonly endDrag: () => void
|
|
53
|
+
/** Ends the undo step being made: a board's edit is one step of its own. */
|
|
54
|
+
readonly stopCapturing: () => void
|
|
55
|
+
/** Tells the others what is selected. */
|
|
56
|
+
readonly select: (ids: readonly string[]) => void
|
|
57
|
+
/** Edits what a board's page shows, as one step of the same undo. */
|
|
58
|
+
readonly editBoard: LiveCanvas["editBoard"]
|
|
59
|
+
}
|
|
45
60
|
}
|
|
46
61
|
|
|
62
|
+
/** How often a drag tells the others where its items are, at most. */
|
|
63
|
+
const DRAG_SHARE_MS = 50
|
|
64
|
+
|
|
47
65
|
/** The grid items snap to as they move and resize. */
|
|
48
66
|
const GRID = 8
|
|
49
67
|
/** What an item added from the toolbar first measures, to place it in the middle of the view. */
|
|
@@ -68,30 +86,72 @@ export function useBoardEditing(
|
|
|
68
86
|
const messages = useArtifactMessages().canvas.toolbar
|
|
69
87
|
const store = useStoreApi()
|
|
70
88
|
const graph = useMemo(() => canvasGraph(canvas), [canvas])
|
|
89
|
+
const read = useReadGraph(graph, store)
|
|
71
90
|
const editing = !!edit
|
|
72
91
|
const [nodes, setNodes] = useState<Node[]>(graph.nodes)
|
|
73
92
|
const [edges, setEdges] = useState<Edge[]>(graph.edges)
|
|
93
|
+
// Which of the graph's nodes and edges each one drawn now was made from: one whose item did
|
|
94
|
+
// not change is kept as it is, so React Flow draws again only the items that changed.
|
|
95
|
+
const [madeFrom] = useState(() => new WeakMap<object, object>())
|
|
74
96
|
const selected = useRef<ReadonlySet<string>>(new Set())
|
|
75
97
|
const [selection, setSelection] = useState<ReadonlySet<string>>(new Set())
|
|
76
98
|
const [typing, setTyping] = useState<string | null>(null)
|
|
77
99
|
const root = useRef<HTMLDivElement | null>(null)
|
|
78
100
|
|
|
79
|
-
//
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
)
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
101
|
+
// Editing, drawn from the canvas as it changes, what was selected still selected, what React
|
|
102
|
+
// Flow measured kept, and an item being dragged where the drag has it. Brought up to date as
|
|
103
|
+
// the board draws, not in an effect after it, so a change of the canvas is one commit. Read, the
|
|
104
|
+
// graph is drawn as it is, and nothing is kept.
|
|
105
|
+
const [drawnFrom, setDrawnFrom] = useState<{
|
|
106
|
+
readonly graph: typeof graph | null
|
|
107
|
+
readonly editing: boolean
|
|
108
|
+
}>({ graph: null, editing: false })
|
|
109
|
+
if (drawnFrom.graph !== graph || drawnFrom.editing !== editing) {
|
|
110
|
+
if (editing || drawnFrom.editing) setDrawnFrom({ graph, editing })
|
|
111
|
+
if (editing) {
|
|
112
|
+
const chosen = selected.current
|
|
113
|
+
setNodes((current) => {
|
|
114
|
+
const drawn = new Map(current.map((node) => [node.id, node]))
|
|
115
|
+
const next = graph.nodes.map((node) => {
|
|
116
|
+
const was = drawn.get(node.id)
|
|
117
|
+
const choose = node.type !== "point"
|
|
118
|
+
const isSelected = choose && chosen.has(node.id)
|
|
119
|
+
const same =
|
|
120
|
+
was &&
|
|
121
|
+
madeFrom.get(was) === node &&
|
|
122
|
+
!!was.draggable === choose &&
|
|
123
|
+
!!was.selected === isSelected &&
|
|
124
|
+
!was.dragging
|
|
125
|
+
if (same) return was
|
|
126
|
+
|
|
127
|
+
const next: Node = {
|
|
128
|
+
...node,
|
|
129
|
+
...(choose ? { draggable: true, selectable: true, selected: isSelected } : {}),
|
|
130
|
+
...(was?.measured ? { measured: was.measured } : {}),
|
|
131
|
+
...(was?.dragging ? { position: was.position, dragging: true } : {}),
|
|
132
|
+
}
|
|
133
|
+
madeFrom.set(next, node)
|
|
134
|
+
return next
|
|
135
|
+
})
|
|
136
|
+
return sameItems(current, next) ? current : next
|
|
137
|
+
})
|
|
138
|
+
setEdges((current) => {
|
|
139
|
+
const drawn = new Map(current.map((edge) => [edge.id, edge]))
|
|
140
|
+
const next = graph.edges.map((edge) => {
|
|
141
|
+
const was = drawn.get(edge.id)
|
|
142
|
+
const isSelected = chosen.has(edge.id)
|
|
143
|
+
const same =
|
|
144
|
+
was && madeFrom.get(was) === edge && !!was.selectable && !!was.selected === isSelected
|
|
145
|
+
if (same) return was
|
|
146
|
+
|
|
147
|
+
const next: Edge = { ...edge, selectable: true, selected: isSelected }
|
|
148
|
+
madeFrom.set(next, edge)
|
|
149
|
+
return next
|
|
150
|
+
})
|
|
151
|
+
return sameItems(current, next) ? current : next
|
|
152
|
+
})
|
|
153
|
+
}
|
|
154
|
+
}
|
|
95
155
|
useEffect(() => {
|
|
96
156
|
if (!editing) {
|
|
97
157
|
selected.current = new Set()
|
|
@@ -123,6 +183,16 @@ export function useBoardEditing(
|
|
|
123
183
|
|
|
124
184
|
const focusBoard = useCallback(() => root.current?.focus({ preventScroll: true }), [])
|
|
125
185
|
|
|
186
|
+
// The others see what this reader selects.
|
|
187
|
+
const share = edit?.live?.select
|
|
188
|
+
useEffect(() => {
|
|
189
|
+
share?.([...selection])
|
|
190
|
+
}, [share, selection])
|
|
191
|
+
useEffect(() => () => share?.([]), [share])
|
|
192
|
+
|
|
193
|
+
// A drag tells the others where its items are as it goes, a few times a second at most.
|
|
194
|
+
const dragShared = useRef(0)
|
|
195
|
+
|
|
126
196
|
const items: CanvasItemEditing | null = useMemo(
|
|
127
197
|
() =>
|
|
128
198
|
edit
|
|
@@ -141,7 +211,7 @@ export function useBoardEditing(
|
|
|
141
211
|
)
|
|
142
212
|
|
|
143
213
|
if (!edit) {
|
|
144
|
-
return { nodes:
|
|
214
|
+
return { nodes: read.nodes, edges: read.edges, editing: false as const, root }
|
|
145
215
|
}
|
|
146
216
|
|
|
147
217
|
const chosenItems = canvas.items.filter((item) => selection.has(item.id))
|
|
@@ -157,7 +227,7 @@ export function useBoardEditing(
|
|
|
157
227
|
}
|
|
158
228
|
const text = kind === "text" ? messages.newText : kind === "section" ? messages.newSection : ""
|
|
159
229
|
const added = addItem(kind, at, text)
|
|
160
|
-
const id = added.id
|
|
230
|
+
const id = added.id
|
|
161
231
|
edit.apply((current) => {
|
|
162
232
|
const next = added.change(current)
|
|
163
233
|
return shape && shape !== "rect" ? styleItems(new Set([id]), { shape })(next) : next
|
|
@@ -276,8 +346,18 @@ export function useBoardEditing(
|
|
|
276
346
|
setEdges((current) => applyEdgeChanges(changes, current))
|
|
277
347
|
if (changes.some((change) => change.type === "select")) chose(changes)
|
|
278
348
|
},
|
|
279
|
-
|
|
280
|
-
|
|
349
|
+
onNodeDragStart: () => edit.live?.startDrag(),
|
|
350
|
+
onNodeDrag: (_: unknown, __: Node, dragged: Node[]) => {
|
|
351
|
+
if (!edit.live) return
|
|
352
|
+
const now = performance.now()
|
|
353
|
+
if (now - dragShared.current < DRAG_SHARE_MS) return
|
|
354
|
+
dragShared.current = now
|
|
355
|
+
edit.apply(moveItems(new Map(dragged.map((node) => [node.id, node.position] as const))))
|
|
356
|
+
},
|
|
357
|
+
onNodeDragStop: (_: unknown, __: Node, dragged: Node[]) => {
|
|
358
|
+
edit.apply(moveItems(new Map(dragged.map((node) => [node.id, node.position] as const))))
|
|
359
|
+
edit.live?.endDrag()
|
|
360
|
+
},
|
|
281
361
|
onConnect: (connection: Connection) =>
|
|
282
362
|
edit.apply(connectItems(connection.source, connection.target)),
|
|
283
363
|
onNodeDoubleClick: (_: unknown, node: Node) => {
|
|
@@ -299,3 +379,48 @@ export function useBoardEditing(
|
|
|
299
379
|
},
|
|
300
380
|
}
|
|
301
381
|
}
|
|
382
|
+
|
|
383
|
+
/** Whether two lists hold the same items, in the same order. */
|
|
384
|
+
function sameItems<T>(left: readonly T[], right: readonly T[]): boolean {
|
|
385
|
+
return left.length === right.length && left.every((item, index) => item === right[index])
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
/**
|
|
389
|
+
* The graph as a read board hands it to React Flow. Its lists stay the ones given before while
|
|
390
|
+
* they hold the same items: React Flow takes a list in again, and works out every arrow's ends,
|
|
391
|
+
* whenever it is a new one. A node made again, as for an item someone moved, keeps the size React
|
|
392
|
+
* Flow measured while its own stays the same: without it, React Flow measures it again, in a
|
|
393
|
+
* commit of its own that redraws every arrow.
|
|
394
|
+
*/
|
|
395
|
+
function useReadGraph(
|
|
396
|
+
graph: { readonly nodes: Node[]; readonly edges: Edge[] },
|
|
397
|
+
store: ReturnType<typeof useStoreApi>
|
|
398
|
+
): { readonly nodes: Node[]; readonly edges: Edge[] } {
|
|
399
|
+
// Caches of what the graph draws as: one kept from a render that was thrown away is as good.
|
|
400
|
+
const [measuredFrom] = useState(() => new WeakMap<Node, Node>())
|
|
401
|
+
const last = useRef<{ readonly nodes: Node[]; readonly edges: Edge[] } | null>(null)
|
|
402
|
+
|
|
403
|
+
const { nodeLookup } = store.getState()
|
|
404
|
+
const measured = graph.nodes.map((node) => {
|
|
405
|
+
const kept = measuredFrom.get(node)
|
|
406
|
+
if (kept) return kept
|
|
407
|
+
|
|
408
|
+
const drawn = nodeLookup.get(node.id)
|
|
409
|
+
const same =
|
|
410
|
+
drawn?.measured.width !== undefined &&
|
|
411
|
+
drawn.measured.height !== undefined &&
|
|
412
|
+
drawn.internals.userNode.width === node.width &&
|
|
413
|
+
drawn.internals.userNode.height === node.height
|
|
414
|
+
const next = same ? { ...node, measured: { ...drawn.measured } } : node
|
|
415
|
+
measuredFrom.set(node, next)
|
|
416
|
+
return next
|
|
417
|
+
})
|
|
418
|
+
|
|
419
|
+
const nodes =
|
|
420
|
+
last.current && sameItems(last.current.nodes, measured) ? last.current.nodes : measured
|
|
421
|
+
const edges =
|
|
422
|
+
last.current && sameItems(last.current.edges, graph.edges) ? last.current.edges : graph.edges
|
|
423
|
+
if (nodes !== last.current?.nodes || edges !== last.current?.edges)
|
|
424
|
+
last.current = { nodes, edges }
|
|
425
|
+
return last.current
|
|
426
|
+
}
|