@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,201 @@
|
|
|
1
|
+
import { isIOS, PHONE_QUERY } from "@sixb/ui/components"
|
|
2
|
+
import { useQueryClient } from "@tanstack/react-query"
|
|
3
|
+
import { type CSSProperties, useEffect, useRef } from "react"
|
|
4
|
+
import { appScroller } from "./routes"
|
|
5
|
+
|
|
6
|
+
// How far the page travels, after resistance, before a release refreshes, and where it rests
|
|
7
|
+
// while the refresh runs.
|
|
8
|
+
const TRIGGER = 72
|
|
9
|
+
const REST = 56
|
|
10
|
+
const MAX_PULL = 140
|
|
11
|
+
const MIN_SPIN_MS = 650
|
|
12
|
+
const TICKS = 8
|
|
13
|
+
const SETTLE = "transform 380ms cubic-bezier(0.32, 0.72, 0, 1), opacity 240ms ease"
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Pull down at the top of any page to refresh what it shows, as native lists do. Installed web
|
|
17
|
+
* apps lose the browser's own pull-to-refresh, so this restores it for the app's data: the page
|
|
18
|
+
* follows the finger with a rubber band, the activity indicator draws its ticks in the gap under
|
|
19
|
+
* the top bar as the pull arms, and every query on screen refetches without reloading the app.
|
|
20
|
+
* An element that owns vertical drags opts out with `data-no-pull-refresh`.
|
|
21
|
+
*/
|
|
22
|
+
export function PullToRefresh() {
|
|
23
|
+
const queryClient = useQueryClient()
|
|
24
|
+
const indicator = useRef<HTMLDivElement>(null)
|
|
25
|
+
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
const phone = window.matchMedia(PHONE_QUERY)
|
|
28
|
+
const element = indicator.current
|
|
29
|
+
if (!element) return
|
|
30
|
+
|
|
31
|
+
let scroller: HTMLElement | null = null
|
|
32
|
+
let content: HTMLElement[] = []
|
|
33
|
+
let startY = 0
|
|
34
|
+
let startX = 0
|
|
35
|
+
let pull = 0
|
|
36
|
+
let pulling = false
|
|
37
|
+
let refreshing = false
|
|
38
|
+
|
|
39
|
+
const move = (distance: number, transition: string) => {
|
|
40
|
+
for (const child of content) {
|
|
41
|
+
child.style.transition = transition
|
|
42
|
+
child.style.transform = distance > 0 ? `translate3d(0, ${distance}px, 0)` : ""
|
|
43
|
+
}
|
|
44
|
+
element.style.transition = transition
|
|
45
|
+
element.style.transform = `translate3d(-50%, ${Math.max(0, distance / 2 - 14)}px, 0)`
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const show = (distance: number) => {
|
|
49
|
+
move(distance, "none")
|
|
50
|
+
const progress = Math.min(distance / TRIGGER, 1)
|
|
51
|
+
element.style.setProperty("--pull-progress", String(progress))
|
|
52
|
+
element.style.opacity = String(Math.min(distance / 28, 1))
|
|
53
|
+
element.toggleAttribute("data-armed", distance >= TRIGGER)
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const hide = () => {
|
|
57
|
+
move(0, SETTLE)
|
|
58
|
+
element.style.opacity = "0"
|
|
59
|
+
element.removeAttribute("data-armed")
|
|
60
|
+
element.removeAttribute("data-refreshing")
|
|
61
|
+
const settled = content
|
|
62
|
+
window.setTimeout(() => {
|
|
63
|
+
for (const child of settled) child.style.transition = ""
|
|
64
|
+
}, 400)
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// Moves are only blocked while a pull may start, so every other scroll starts without waiting
|
|
68
|
+
// on script.
|
|
69
|
+
const track = (page: HTMLElement | null) => {
|
|
70
|
+
if (page && !scroller) document.addEventListener("touchmove", onMove, { passive: false })
|
|
71
|
+
if (!page && scroller) document.removeEventListener("touchmove", onMove)
|
|
72
|
+
scroller = page
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const onStart = (event: TouchEvent) => {
|
|
76
|
+
track(null)
|
|
77
|
+
if (!phone.matches || refreshing || event.touches.length !== 1) return
|
|
78
|
+
const target = event.target instanceof Element ? event.target : null
|
|
79
|
+
const page = appScroller()
|
|
80
|
+
if (!target || !page || !page.contains(target)) return
|
|
81
|
+
if (
|
|
82
|
+
target.closest(
|
|
83
|
+
'[role="dialog"], [data-no-pull-refresh], input, textarea, [contenteditable="true"]'
|
|
84
|
+
)
|
|
85
|
+
)
|
|
86
|
+
return
|
|
87
|
+
if (scrolledAbove(target, page)) return
|
|
88
|
+
track(page)
|
|
89
|
+
startY = event.touches[0].clientY
|
|
90
|
+
startX = event.touches[0].clientX
|
|
91
|
+
pulling = false
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const onMove = (event: TouchEvent) => {
|
|
95
|
+
if (!scroller) return
|
|
96
|
+
const touch = event.touches[0]
|
|
97
|
+
const dy = touch.clientY - startY
|
|
98
|
+
if (!pulling) {
|
|
99
|
+
if (Math.abs(touch.clientX - startX) > Math.abs(dy) || dy < 0) return track(null)
|
|
100
|
+
if (dy < 6) return
|
|
101
|
+
pulling = true
|
|
102
|
+
content = [...scroller.children].filter(
|
|
103
|
+
(child): child is HTMLElement => child instanceof HTMLElement
|
|
104
|
+
)
|
|
105
|
+
}
|
|
106
|
+
event.preventDefault()
|
|
107
|
+
// Resistance grows with distance, as a rubber band does.
|
|
108
|
+
const travel = dy - 6
|
|
109
|
+
pull = Math.min(MAX_PULL, travel * 0.55 - Math.max(0, travel - TRIGGER * 1.6) * 0.18)
|
|
110
|
+
show(Math.max(0, pull))
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
const onEnd = async () => {
|
|
114
|
+
const wasPulling = scroller !== null && pulling
|
|
115
|
+
track(null)
|
|
116
|
+
if (!wasPulling) return
|
|
117
|
+
pulling = false
|
|
118
|
+
if (pull < TRIGGER) {
|
|
119
|
+
hide()
|
|
120
|
+
return
|
|
121
|
+
}
|
|
122
|
+
refreshing = true
|
|
123
|
+
haptic()
|
|
124
|
+
move(REST, SETTLE)
|
|
125
|
+
element.style.setProperty("--pull-progress", "1")
|
|
126
|
+
element.setAttribute("data-refreshing", "")
|
|
127
|
+
const started = performance.now()
|
|
128
|
+
try {
|
|
129
|
+
await queryClient.refetchQueries({ type: "active" })
|
|
130
|
+
} finally {
|
|
131
|
+
const wait = MIN_SPIN_MS - (performance.now() - started)
|
|
132
|
+
if (wait > 0) await new Promise((resolve) => setTimeout(resolve, wait))
|
|
133
|
+
refreshing = false
|
|
134
|
+
hide()
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
document.addEventListener("touchstart", onStart, { passive: true })
|
|
139
|
+
document.addEventListener("touchend", onEnd)
|
|
140
|
+
document.addEventListener("touchcancel", onEnd)
|
|
141
|
+
return () => {
|
|
142
|
+
track(null)
|
|
143
|
+
document.removeEventListener("touchstart", onStart)
|
|
144
|
+
document.removeEventListener("touchend", onEnd)
|
|
145
|
+
document.removeEventListener("touchcancel", onEnd)
|
|
146
|
+
for (const child of content) {
|
|
147
|
+
child.style.transition = ""
|
|
148
|
+
child.style.transform = ""
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}, [queryClient])
|
|
152
|
+
|
|
153
|
+
return (
|
|
154
|
+
<div ref={indicator} className="pull-refresh" aria-hidden="true">
|
|
155
|
+
<svg viewBox="0 0 28 28" className="pull-refresh-spinner">
|
|
156
|
+
{Array.from({ length: TICKS }, (_, tick) => (
|
|
157
|
+
<line
|
|
158
|
+
key={tick}
|
|
159
|
+
x1="14"
|
|
160
|
+
y1="3.5"
|
|
161
|
+
x2="14"
|
|
162
|
+
y2="8.5"
|
|
163
|
+
transform={`rotate(${tick * (360 / TICKS)} 14 14)`}
|
|
164
|
+
style={{ "--tick": tick } as CSSProperties}
|
|
165
|
+
/>
|
|
166
|
+
))}
|
|
167
|
+
</svg>
|
|
168
|
+
</div>
|
|
169
|
+
)
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/** Whether the page, or a pane between it and the touch, is scrolled away from its top. */
|
|
173
|
+
function scrolledAbove(target: Element, page: HTMLElement): boolean {
|
|
174
|
+
for (let node: Element | null = target; node; node = node.parentElement) {
|
|
175
|
+
if (node.scrollTop > 0) return true
|
|
176
|
+
if (node === page) return false
|
|
177
|
+
}
|
|
178
|
+
return false
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* A light tap of the Taptic Engine where the platform allows a web page one, else nothing. iOS has
|
|
183
|
+
* no vibration API for the web, but toggling a native switch plays the system's selection haptic,
|
|
184
|
+
* including one toggled through its label from script while a touch is being handled.
|
|
185
|
+
*/
|
|
186
|
+
function haptic(): void {
|
|
187
|
+
if (isIOS()) {
|
|
188
|
+
const label = document.createElement("label")
|
|
189
|
+
label.ariaHidden = "true"
|
|
190
|
+
label.style.display = "none"
|
|
191
|
+
const input = document.createElement("input")
|
|
192
|
+
input.type = "checkbox"
|
|
193
|
+
input.setAttribute("switch", "")
|
|
194
|
+
label.append(input)
|
|
195
|
+
document.head.append(label)
|
|
196
|
+
label.click()
|
|
197
|
+
label.remove()
|
|
198
|
+
return
|
|
199
|
+
}
|
|
200
|
+
navigator.vibrate?.(8)
|
|
201
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Where a screen sits in a phone's navigation, read from its address alone: `/quotes` is a
|
|
3
|
+
* top-level screen, `/quotes/q-1` a record pushed on it, and its first segment is its section.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/** The page's scroll container, which the shell marks with `data-app-scroll`. */
|
|
7
|
+
export function appScroller(): HTMLElement | null {
|
|
8
|
+
return document.querySelector<HTMLElement>("[data-app-scroll]")
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function normalizePath(pathname: string): string {
|
|
12
|
+
return pathname.length > 1 ? pathname.replace(/\/+$/, "") : pathname
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/** A top-level screen, such as Home or a list: it shows its title, never a back button. */
|
|
16
|
+
export function isRootPath(pathname: string): boolean {
|
|
17
|
+
return normalizePath(pathname).split("/").filter(Boolean).length <= 1
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/** The section a screen belongs to: its first segment, or "" for Home. */
|
|
21
|
+
export function sectionOf(pathname: string): string {
|
|
22
|
+
return normalizePath(pathname).split("/")[1] ?? ""
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** The screen above this one: the address without its last segment. */
|
|
26
|
+
export function parentPath(pathname: string): string {
|
|
27
|
+
return normalizePath(pathname).replace(/\/[^/]+$/, "") || "/"
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** This history entry's place in the app's history, as the router counts it. */
|
|
31
|
+
export function historyIndex(state: unknown = window.history.state): number {
|
|
32
|
+
const index = (state as { idx?: unknown } | null)?.idx
|
|
33
|
+
return typeof index === "number" ? index : 0
|
|
34
|
+
}
|
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
import { PHONE_QUERY } from "@sixb/ui/components"
|
|
2
|
+
import { appScroller, historyIndex, isRootPath, normalizePath, sectionOf } from "./routes"
|
|
3
|
+
|
|
4
|
+
/*
|
|
5
|
+
* Native screen transitions on a phone.
|
|
6
|
+
*
|
|
7
|
+
* React swaps a page's content in place, so the screen being left is gone before anything can
|
|
8
|
+
* move. Native navigation keeps both on screen: a pushed screen slides in over the current one,
|
|
9
|
+
* which drifts left and dims; Back does the reverse. So the moment the router changes the URL,
|
|
10
|
+
* before React renders the next page, the current screen is copied into an inert "ghost" laid
|
|
11
|
+
* exactly over it. Once the next page has rendered, the two move together and the ghost is
|
|
12
|
+
* dropped.
|
|
13
|
+
*
|
|
14
|
+
* The back swipe is iOS's own in the installed app, as in Safari: it animates the change itself, so
|
|
15
|
+
* a Back it drives is not animated again.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
type ScreenMotion = "push" | "pop"
|
|
19
|
+
|
|
20
|
+
const DURATION_MS = 480
|
|
21
|
+
const EASING = "cubic-bezier(0.32, 0.72, 0, 1)"
|
|
22
|
+
// How far the screen underneath sits to the left, as a share of the width.
|
|
23
|
+
const PARALLAX = 0.3
|
|
24
|
+
// A copy larger than this costs more than the transition is worth.
|
|
25
|
+
const MAX_NODES = 6000
|
|
26
|
+
const ID_REFERENCES =
|
|
27
|
+
'[fill^="url"], [stroke^="url"], [clip-path], [mask], [filter], [marker-start], [marker-mid], [marker-end], [style*="url("], [href^="#"], [*|href^="#"]'
|
|
28
|
+
|
|
29
|
+
interface Pending {
|
|
30
|
+
readonly motion: ScreenMotion
|
|
31
|
+
readonly ghost: HTMLElement
|
|
32
|
+
// The address it was copied for; a different one committing means it no longer applies.
|
|
33
|
+
readonly to: string
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
let pending: Pending | null = null
|
|
37
|
+
let lastPath = "/"
|
|
38
|
+
let lastIndex = 0
|
|
39
|
+
let stopCurrent: (() => void) | null = null
|
|
40
|
+
let copies = 0
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Watch the router's history calls so the screen can be copied before React replaces it.
|
|
44
|
+
* Returns the function that stops watching.
|
|
45
|
+
*/
|
|
46
|
+
export function watchScreenChanges(): () => void {
|
|
47
|
+
lastPath = normalizePath(window.location.pathname)
|
|
48
|
+
lastIndex = historyIndex()
|
|
49
|
+
const history = window.history
|
|
50
|
+
const pushState = history.pushState
|
|
51
|
+
const replaceState = history.replaceState
|
|
52
|
+
|
|
53
|
+
// Going up to a screen above, such as a tab's first screen or a record after saving its form,
|
|
54
|
+
// moves back the way Back does, even when it is a new history entry.
|
|
55
|
+
history.pushState = function (this: History, ...args: Parameters<History["pushState"]>) {
|
|
56
|
+
const to = targetPath(args[2])
|
|
57
|
+
prepare(to, goesUp(lastPath, to) ? "pop" : "push")
|
|
58
|
+
pushState.apply(this, args)
|
|
59
|
+
}
|
|
60
|
+
history.replaceState = function (this: History, ...args: Parameters<History["replaceState"]>) {
|
|
61
|
+
const to = targetPath(args[2])
|
|
62
|
+
if (to !== lastPath && goesUp(lastPath, to)) prepare(to, "pop")
|
|
63
|
+
replaceState.apply(this, args)
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// Capturing, so the copy is taken before the router reacts to Back. A Back the system animated
|
|
67
|
+
// itself, as iOS's back swipe does, is not animated again.
|
|
68
|
+
const onPopState = (event: PopStateEvent) => {
|
|
69
|
+
if (event.hasUAVisualTransition) {
|
|
70
|
+
clearPending()
|
|
71
|
+
return
|
|
72
|
+
}
|
|
73
|
+
const index = historyIndex()
|
|
74
|
+
prepare(normalizePath(window.location.pathname), index < lastIndex ? "pop" : "push")
|
|
75
|
+
}
|
|
76
|
+
window.addEventListener("popstate", onPopState, true)
|
|
77
|
+
|
|
78
|
+
return () => {
|
|
79
|
+
history.pushState = pushState
|
|
80
|
+
history.replaceState = replaceState
|
|
81
|
+
window.removeEventListener("popstate", onPopState, true)
|
|
82
|
+
// A screen without the shell, such as a print view, unmounts this; nothing carries over.
|
|
83
|
+
settleScreenMotion()
|
|
84
|
+
clearPending()
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Called once the next page has rendered, before the browser paints it: moves the screens. Reads
|
|
90
|
+
* the address itself, as the history calls it watches carry it, router basename and all.
|
|
91
|
+
*/
|
|
92
|
+
export function runScreenMotion(): void {
|
|
93
|
+
const to = normalizePath(window.location.pathname)
|
|
94
|
+
lastPath = to
|
|
95
|
+
lastIndex = historyIndex()
|
|
96
|
+
|
|
97
|
+
const current = pending
|
|
98
|
+
pending = null
|
|
99
|
+
if (!current) return
|
|
100
|
+
const scroller = appScroller()
|
|
101
|
+
if (current.to !== to || !scroller || !scroller.parentElement) {
|
|
102
|
+
current.ghost.remove()
|
|
103
|
+
return
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
slide(scroller, current.ghost, current.motion, () => current.ghost.remove())
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Lay a screen copy under or over the page scroller, at the scroller's own scroll position, with
|
|
111
|
+
* the dimming layer between them.
|
|
112
|
+
*/
|
|
113
|
+
function mountGhost(
|
|
114
|
+
ghost: HTMLElement,
|
|
115
|
+
scroller: HTMLElement,
|
|
116
|
+
place: "under" | "over"
|
|
117
|
+
): { readonly dim: HTMLElement; readonly remove: () => void } {
|
|
118
|
+
const parent = scroller.parentElement as HTMLElement
|
|
119
|
+
const dim = document.createElement("div")
|
|
120
|
+
dim.className = "screen-dim"
|
|
121
|
+
dim.setAttribute("aria-hidden", "true")
|
|
122
|
+
scroller.dataset.screenMoving = place === "under" ? "over" : "under"
|
|
123
|
+
// Over the scroller alone: its parent can also hold a panel beside it, such as the agent dock.
|
|
124
|
+
const box = `top:${scroller.offsetTop}px;left:${scroller.offsetLeft}px;width:${scroller.offsetWidth}px;height:${scroller.offsetHeight}px`
|
|
125
|
+
dim.style.cssText = box
|
|
126
|
+
ghost.style.cssText += `;${box}`
|
|
127
|
+
parent.append(dim)
|
|
128
|
+
ghost.dataset.place = place
|
|
129
|
+
parent.append(ghost)
|
|
130
|
+
ghost.scrollTop = Number(ghost.dataset.scrollTop ?? 0)
|
|
131
|
+
return {
|
|
132
|
+
dim,
|
|
133
|
+
remove: () => {
|
|
134
|
+
dim.remove()
|
|
135
|
+
ghost.remove()
|
|
136
|
+
delete scroller.dataset.screenMoving
|
|
137
|
+
},
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/** End any transition still running, leaving the current screen in place. */
|
|
142
|
+
function settleScreenMotion(): void {
|
|
143
|
+
stopCurrent?.()
|
|
144
|
+
stopCurrent = null
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
function clearPending() {
|
|
148
|
+
pending?.ghost.remove()
|
|
149
|
+
pending = null
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
function prepare(to: string, motion: ScreenMotion) {
|
|
153
|
+
settleScreenMotion()
|
|
154
|
+
clearPending()
|
|
155
|
+
if (!movesScreen(lastPath, to)) return
|
|
156
|
+
const scroller = appScroller()
|
|
157
|
+
if (!scroller || !scroller.parentElement) return
|
|
158
|
+
const ghost = copyScreen(scroller)
|
|
159
|
+
if (!ghost) return
|
|
160
|
+
pending = { motion, ghost, to }
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Screens within a section push and pop. Moving between sections, or between top-level screens,
|
|
165
|
+
* swaps in place, as switching tabs does natively.
|
|
166
|
+
*/
|
|
167
|
+
function movesScreen(from: string, to: string): boolean {
|
|
168
|
+
if (from === to) return false
|
|
169
|
+
if (!window.matchMedia(PHONE_QUERY).matches) return false
|
|
170
|
+
if (window.matchMedia("(prefers-reduced-motion: reduce)").matches) return false
|
|
171
|
+
if (sectionOf(from) !== sectionOf(to)) return false
|
|
172
|
+
if (isRootPath(from) && isRootPath(to)) return false
|
|
173
|
+
return true
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/** Whether `to` sits above `from`: a top-level screen, or a parent address. */
|
|
177
|
+
function goesUp(from: string, to: string): boolean {
|
|
178
|
+
return (isRootPath(to) && !isRootPath(from)) || from.startsWith(`${to === "/" ? "" : to}/`)
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
function copyScreen(scroller: HTMLElement): HTMLElement | null {
|
|
182
|
+
if (scroller.getElementsByTagName("*").length > MAX_NODES) return null
|
|
183
|
+
const ghost = scroller.cloneNode(true) as HTMLElement
|
|
184
|
+
// Keeps the scroller's own styles; lookups find the real scroller first, as it comes first.
|
|
185
|
+
ghost.dataset.appScroll = "ghost"
|
|
186
|
+
ghost.removeAttribute("data-screen-moving")
|
|
187
|
+
const style = getComputedStyle(scroller)
|
|
188
|
+
ghost.style.paddingTop = style.paddingTop
|
|
189
|
+
ghost.style.paddingBottom = style.paddingBottom
|
|
190
|
+
ghost.removeAttribute("id")
|
|
191
|
+
ghost.classList.add("screen-ghost")
|
|
192
|
+
ghost.setAttribute("aria-hidden", "true")
|
|
193
|
+
ghost.inert = true
|
|
194
|
+
ghost.dataset.scrollTop = String(scroller.scrollTop)
|
|
195
|
+
|
|
196
|
+
// Copies of frames and media would load again; a canvas copies blank, so paint it in.
|
|
197
|
+
for (const media of ghost.querySelectorAll("iframe, video, audio, object, embed")) {
|
|
198
|
+
const stand = document.createElement("div")
|
|
199
|
+
stand.className = (media as HTMLElement).className
|
|
200
|
+
stand.style.cssText = (media as HTMLElement).style.cssText
|
|
201
|
+
media.replaceWith(stand)
|
|
202
|
+
}
|
|
203
|
+
const sources = scroller.querySelectorAll("canvas")
|
|
204
|
+
ghost.querySelectorAll("canvas").forEach((canvas, index) => {
|
|
205
|
+
const source = sources[index]
|
|
206
|
+
if (!source || source.width === 0 || source.height === 0) return
|
|
207
|
+
try {
|
|
208
|
+
canvas.getContext("2d")?.drawImage(source, 0, 0)
|
|
209
|
+
} catch {
|
|
210
|
+
// A tainted or WebGL canvas stays blank in the copy.
|
|
211
|
+
}
|
|
212
|
+
})
|
|
213
|
+
renameIds(ghost)
|
|
214
|
+
return ghost
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* Ids must stay unique on the page, so the copy's get a suffix, and what points at them inside
|
|
219
|
+
* it, such as a chart's gradient fill, follows.
|
|
220
|
+
*/
|
|
221
|
+
function renameIds(ghost: HTMLElement) {
|
|
222
|
+
const suffix = `-screen-${++copies}`
|
|
223
|
+
const renamed = new Set<string>()
|
|
224
|
+
for (const element of ghost.querySelectorAll("[id]")) {
|
|
225
|
+
renamed.add(element.id)
|
|
226
|
+
element.id += suffix
|
|
227
|
+
}
|
|
228
|
+
if (!renamed.size) return
|
|
229
|
+
const reference = /url\(\s*(['"]?)#([^'")\s]+)\1\s*\)/g
|
|
230
|
+
const follow = (value: string) =>
|
|
231
|
+
value.replace(reference, (match, quote: string, id: string) =>
|
|
232
|
+
renamed.has(id) ? `url(${quote}#${id}${suffix}${quote})` : match
|
|
233
|
+
)
|
|
234
|
+
// Only what can point at an id: an SVG paint, clip, mask or filter, a style, or a local href.
|
|
235
|
+
for (const element of ghost.querySelectorAll(ID_REFERENCES)) {
|
|
236
|
+
for (const { name, value } of [...element.attributes]) {
|
|
237
|
+
if (value.includes("url(")) {
|
|
238
|
+
element.setAttribute(name, follow(value))
|
|
239
|
+
} else if (
|
|
240
|
+
(name === "href" || name === "xlink:href") &&
|
|
241
|
+
value.startsWith("#") &&
|
|
242
|
+
renamed.has(value.slice(1))
|
|
243
|
+
) {
|
|
244
|
+
element.setAttribute(name, `${value}${suffix}`)
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
function slide(scroller: HTMLElement, ghost: HTMLElement, motion: ScreenMotion, done: () => void) {
|
|
251
|
+
const width = scroller.offsetWidth
|
|
252
|
+
const { dim, remove } = mountGhost(ghost, scroller, motion === "push" ? "under" : "over")
|
|
253
|
+
const timing: KeyframeAnimationOptions = { duration: DURATION_MS, easing: EASING }
|
|
254
|
+
const away = `translate3d(${-width * PARALLAX}px, 0, 0)`
|
|
255
|
+
const off = `translate3d(${width}px, 0, 0)`
|
|
256
|
+
const still = "translate3d(0, 0, 0)"
|
|
257
|
+
|
|
258
|
+
const animations =
|
|
259
|
+
motion === "push"
|
|
260
|
+
? [
|
|
261
|
+
scroller.animate({ transform: [off, still] }, timing),
|
|
262
|
+
ghost.animate({ transform: [still, away] }, timing),
|
|
263
|
+
dim.animate({ opacity: [0, 1] }, timing),
|
|
264
|
+
]
|
|
265
|
+
: [
|
|
266
|
+
scroller.animate({ transform: [away, still] }, timing),
|
|
267
|
+
ghost.animate({ transform: [still, off] }, timing),
|
|
268
|
+
dim.animate({ opacity: [1, 0] }, timing),
|
|
269
|
+
]
|
|
270
|
+
|
|
271
|
+
let finished = false
|
|
272
|
+
const finish = () => {
|
|
273
|
+
if (finished) return
|
|
274
|
+
finished = true
|
|
275
|
+
for (const animation of animations) animation.cancel()
|
|
276
|
+
remove()
|
|
277
|
+
done()
|
|
278
|
+
if (stopCurrent === finish) stopCurrent = null
|
|
279
|
+
}
|
|
280
|
+
void Promise.all(animations.map((animation) => animation.finished)).then(finish, finish)
|
|
281
|
+
// A new navigation mid-flight ends this one at once.
|
|
282
|
+
stopCurrent = finish
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
function targetPath(url: string | URL | null | undefined): string {
|
|
286
|
+
if (url == null) return lastPath
|
|
287
|
+
try {
|
|
288
|
+
return normalizePath(new URL(String(url), window.location.href).pathname)
|
|
289
|
+
} catch {
|
|
290
|
+
return lastPath
|
|
291
|
+
}
|
|
292
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { useEffect, useLayoutEffect, useRef } from "react"
|
|
2
|
+
import { useLocation, useNavigationType } from "react-router-dom"
|
|
3
|
+
import { appScroller } from "./routes"
|
|
4
|
+
|
|
5
|
+
// Data can take a moment to arrive; until the page is tall enough the saved position can't apply.
|
|
6
|
+
const RESTORE_WINDOW_MS = 1500
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* The app scrolls inside one container that stays mounted between pages, so the browser can't
|
|
10
|
+
* manage its position. A new screen starts at the top; Back comes back to where the screen was
|
|
11
|
+
* left. Changing only the query string, such as a filter, keeps the position.
|
|
12
|
+
*/
|
|
13
|
+
export function ScrollRestoration() {
|
|
14
|
+
const location = useLocation()
|
|
15
|
+
const navigationType = useNavigationType()
|
|
16
|
+
const positions = useRef(new Map<string, number>())
|
|
17
|
+
const previousPath = useRef(location.pathname)
|
|
18
|
+
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
const scroller = appScroller()
|
|
21
|
+
if (!scroller) return
|
|
22
|
+
const key = location.key
|
|
23
|
+
const path = location.pathname + location.search
|
|
24
|
+
const save = () => {
|
|
25
|
+
// The next screen resets the scroller before this listener is gone; that isn't this screen.
|
|
26
|
+
if (window.location.pathname + window.location.search !== path) return
|
|
27
|
+
positions.current.set(key, scroller.scrollTop)
|
|
28
|
+
}
|
|
29
|
+
scroller.addEventListener("scroll", save, { passive: true })
|
|
30
|
+
return () => scroller.removeEventListener("scroll", save)
|
|
31
|
+
}, [location.key, location.pathname, location.search])
|
|
32
|
+
|
|
33
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: runs once per navigation, keyed by it.
|
|
34
|
+
useLayoutEffect(() => {
|
|
35
|
+
const scroller = appScroller()
|
|
36
|
+
const samePath = previousPath.current === location.pathname
|
|
37
|
+
previousPath.current = location.pathname
|
|
38
|
+
if (!scroller || (navigationType !== "POP" && samePath)) return
|
|
39
|
+
|
|
40
|
+
const target = navigationType === "POP" ? (positions.current.get(location.key) ?? 0) : 0
|
|
41
|
+
scroller.scrollTop = target
|
|
42
|
+
if (target === 0) return
|
|
43
|
+
|
|
44
|
+
let frame = 0
|
|
45
|
+
let interrupted = false
|
|
46
|
+
const started = performance.now()
|
|
47
|
+
const interrupt = () => {
|
|
48
|
+
interrupted = true
|
|
49
|
+
}
|
|
50
|
+
const retry = () => {
|
|
51
|
+
if (interrupted) return
|
|
52
|
+
if (scroller.scrollHeight - scroller.clientHeight >= target) {
|
|
53
|
+
scroller.scrollTop = target
|
|
54
|
+
return
|
|
55
|
+
}
|
|
56
|
+
if (performance.now() - started < RESTORE_WINDOW_MS) frame = requestAnimationFrame(retry)
|
|
57
|
+
}
|
|
58
|
+
scroller.addEventListener("touchstart", interrupt, { passive: true })
|
|
59
|
+
scroller.addEventListener("wheel", interrupt, { passive: true })
|
|
60
|
+
frame = requestAnimationFrame(retry)
|
|
61
|
+
|
|
62
|
+
return () => {
|
|
63
|
+
cancelAnimationFrame(frame)
|
|
64
|
+
scroller.removeEventListener("touchstart", interrupt)
|
|
65
|
+
scroller.removeEventListener("wheel", interrupt)
|
|
66
|
+
}
|
|
67
|
+
}, [location.key])
|
|
68
|
+
|
|
69
|
+
return null
|
|
70
|
+
}
|