kaizen-agent 1.86.0 → 1.87.1
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/README.md +1 -1
- package/cli/annotate-proxy.ts +6 -3
- package/cli/build-web.ts +46 -16
- package/cli/dev.ts +67 -0
- package/cli/docs.ts +1 -1
- package/cli/notes.ts +9 -3
- package/cli/ports.ts +121 -0
- package/cli/settings.ts +16 -17
- package/cli/state.ts +15 -29
- package/cli/task-service.ts +79 -17
- package/cli/tasks.ts +2 -2
- package/cli/term-image.ts +18 -0
- package/cli/ui-audit.allow.json +0 -1
- package/cli/ui-audit.ts +12 -12
- package/cli/web.ts +188 -58
- package/package.json +21 -4
- package/skills/kaizen/spec.md +10 -3
- package/tsconfig.json +16 -0
- package/web/README.md +105 -0
- package/web/{annotate.js → annotate/annotate.ts} +51 -50
- package/web/boot/boot.ts +7 -0
- package/web/components/annotate/annotate-bar.tsx +78 -0
- package/web/components/annotate/annotate-panel.tsx +20 -0
- package/web/components/annotate/annotate-settings.tsx +60 -0
- package/web/components/annotate/index.ts +1 -0
- package/web/components/annotate/notes-list.tsx +75 -0
- package/web/components/board/board-card.tsx +177 -0
- package/web/components/board/board-column.tsx +212 -0
- package/web/components/board/board-mode-switch.tsx +21 -0
- package/web/components/board/board-popups.tsx +45 -0
- package/web/components/board/card-footer.tsx +58 -0
- package/web/components/board/card-form.tsx +168 -0
- package/web/components/board/card-kids.tsx +53 -0
- package/web/components/board/clear-menu.tsx +36 -0
- package/web/components/board/filter-box.tsx +42 -0
- package/web/components/board/index.ts +6 -0
- package/web/components/board/run-form.tsx +129 -0
- package/web/components/board/severity-menu.tsx +44 -0
- package/web/components/board/status-strip.tsx +75 -0
- package/web/components/board/task-form.tsx +140 -0
- package/web/components/board/ws-card.tsx +38 -0
- package/web/components/context/context-panel.tsx +244 -0
- package/web/components/context/index.ts +1 -0
- package/web/components/decision/decision-bar.tsx +422 -0
- package/web/components/decision/index.ts +1 -0
- package/web/components/decision/inline-form.tsx +47 -0
- package/web/components/decision/plan-answers-form.tsx +78 -0
- package/web/components/decision/revise-form.tsx +65 -0
- package/web/components/decision/task-reply-form.tsx +48 -0
- package/web/components/footer/foot-bar.tsx +67 -0
- package/web/components/footer/index.ts +1 -0
- package/web/components/git/git-ask.tsx +88 -0
- package/web/components/git/git-commits.tsx +53 -0
- package/web/components/git/git-confirm.tsx +78 -0
- package/web/components/git/git-counts.tsx +10 -0
- package/web/components/git/git-files.tsx +113 -0
- package/web/components/git/git-head.tsx +70 -0
- package/web/components/git/git-icon.tsx +25 -0
- package/web/components/git/git-message.tsx +44 -0
- package/web/components/git/git-split.tsx +64 -0
- package/web/components/git/git-tab.tsx +55 -0
- package/web/components/git/index.ts +1 -0
- package/web/components/home/chat-list.tsx +57 -0
- package/web/components/home/home-composer.tsx +169 -0
- package/web/components/home/home-message.tsx +120 -0
- package/web/components/home/home-window.tsx +253 -0
- package/web/components/home/home-ws-add.tsx +47 -0
- package/web/components/home/index.ts +6 -0
- package/web/components/home/onboarding-dialog.tsx +371 -0
- package/web/components/icebox/board-chip.tsx +27 -0
- package/web/components/icebox/board-menu.tsx +41 -0
- package/web/components/icebox/bulk-bar.tsx +41 -0
- package/web/components/icebox/capture-box.tsx +155 -0
- package/web/components/icebox/choice-menu.tsx +39 -0
- package/web/components/icebox/collection-dialog.tsx +60 -0
- package/web/components/icebox/favicon.tsx +39 -0
- package/web/components/icebox/index.ts +10 -0
- package/web/components/icebox/kind-label.tsx +22 -0
- package/web/components/icebox/kind-menu.tsx +20 -0
- package/web/components/icebox/promote-form.tsx +93 -0
- package/web/components/icebox/reply-box.tsx +88 -0
- package/web/components/icebox/request-actions.tsx +141 -0
- package/web/components/icebox/request-badges.tsx +13 -0
- package/web/components/icebox/request-card.tsx +99 -0
- package/web/components/icebox/request-detail.tsx +43 -0
- package/web/components/icebox/request-images.tsx +33 -0
- package/web/components/icebox/request-phone-row.tsx +181 -0
- package/web/components/icebox/request-row.tsx +120 -0
- package/web/components/icebox/service-chip.tsx +58 -0
- package/web/components/icebox/snooze-menu.tsx +83 -0
- package/web/components/icebox/source-card.tsx +225 -0
- package/web/components/icebox/source-drawer.tsx +112 -0
- package/web/components/icebox/source-form.tsx +147 -0
- package/web/components/icebox/swipe-deck.tsx +242 -0
- package/web/components/layout/index.ts +1 -0
- package/web/components/layout/page-frame.tsx +44 -0
- package/web/components/markdown/index.ts +1 -0
- package/web/components/markdown/markdown.tsx +156 -0
- package/web/components/notebook/editor-pane.tsx +23 -0
- package/web/components/notebook/index.ts +5 -0
- package/web/components/notebook/note-body.tsx +172 -0
- package/web/components/notebook/note-tree.tsx +99 -0
- package/web/components/notebook/notes-head.tsx +37 -0
- package/web/components/notebook/notes-side.tsx +46 -0
- package/web/components/notes/index.ts +1 -0
- package/web/components/notes/note-composer.tsx +90 -0
- package/web/components/notes/notes-chat.tsx +58 -0
- package/web/components/panes/browser-pane.tsx +281 -0
- package/web/components/panes/index.ts +3 -0
- package/web/components/panes/preview-pane.tsx +91 -0
- package/web/components/panes/terminal-pane.tsx +52 -0
- package/web/components/phone/haptic.tsx +29 -0
- package/web/components/phone/index.ts +6 -0
- package/web/components/phone/phone-card.tsx +118 -0
- package/web/components/phone/phone-home.tsx +304 -0
- package/web/components/phone/phone-sheets.tsx +103 -0
- package/web/components/phone/qr-code.tsx +6 -0
- package/web/components/phone/usage-chips.tsx +85 -0
- package/web/components/phone/whatsapp-card.tsx +85 -0
- package/web/components/project/add-project-dialog.tsx +435 -0
- package/web/components/project/index.ts +3 -0
- package/web/components/project/project-bar.tsx +101 -0
- package/web/components/project/ws-menu.tsx +21 -0
- package/web/components/rail/agent-chips.tsx +110 -0
- package/web/components/rail/index.ts +4 -0
- package/web/components/rail/rail-filter.tsx +118 -0
- package/web/components/rail/rail-list.tsx +259 -0
- package/web/components/rail/source-marks.tsx +21 -0
- package/web/components/resources/index.ts +1 -0
- package/web/components/resources/resources-popup.tsx +490 -0
- package/web/components/run/doc-body.tsx +123 -0
- package/web/components/run/file-viewer.tsx +53 -0
- package/web/components/run/fix-form.tsx +88 -0
- package/web/components/run/index.ts +16 -0
- package/web/components/run/inline-md.tsx +30 -0
- package/web/components/run/key-hint.tsx +29 -0
- package/web/components/run/pane-gutter.tsx +52 -0
- package/web/components/run/pane-header.tsx +35 -0
- package/web/components/run/pane.tsx +140 -0
- package/web/components/run/panel-grip.tsx +49 -0
- package/web/components/run/panel-head.tsx +56 -0
- package/web/components/run/panel-tabs.tsx +35 -0
- package/web/components/run/phase-steps.tsx +37 -0
- package/web/components/run/project-notes.tsx +49 -0
- package/web/components/run/run-add-menu.tsx +80 -0
- package/web/components/run/run-bar.tsx +40 -0
- package/web/components/run/run-empty.tsx +10 -0
- package/web/components/run/run-footer.tsx +53 -0
- package/web/components/run/run-history.tsx +24 -0
- package/web/components/run/run-panes.tsx +78 -0
- package/web/components/run/run-picker.tsx +51 -0
- package/web/components/run/run-progress.tsx +30 -0
- package/web/components/run/run-tabs.tsx +147 -0
- package/web/components/run/run-wait.tsx +18 -0
- package/web/components/search/index.ts +1 -0
- package/web/components/search/search-palette.tsx +159 -0
- package/web/components/settings/account-rows.tsx +128 -0
- package/web/components/settings/agent-rows.tsx +249 -0
- package/web/components/settings/automation-rows.tsx +211 -0
- package/web/components/settings/browser-row.tsx +111 -0
- package/web/components/settings/cleanup-row.tsx +32 -0
- package/web/components/settings/commit-input.tsx +39 -0
- package/web/components/settings/index.ts +4 -0
- package/web/components/settings/integration-row.tsx +158 -0
- package/web/components/settings/mic-row.tsx +48 -0
- package/web/components/settings/orchestration-flow.tsx +87 -0
- package/web/components/settings/setting-row.tsx +131 -0
- package/web/components/settings/settings-item.tsx +78 -0
- package/web/components/settings/settings-loading.tsx +41 -0
- package/web/components/settings/settings-nav.tsx +119 -0
- package/web/components/settings/settings-scope.tsx +66 -0
- package/web/components/settings/settings-section.tsx +33 -0
- package/web/components/settings/skill-card.tsx +131 -0
- package/web/components/settings/stepper.tsx +74 -0
- package/web/components/settings/update-bar.tsx +167 -0
- package/web/components/shared/action-menu.tsx +76 -0
- package/web/components/shared/ask-host.tsx +18 -0
- package/web/components/shared/attach-button.tsx +23 -0
- package/web/components/shared/chip.tsx +19 -0
- package/web/components/shared/client-mark.tsx +15 -0
- package/web/components/shared/confirm-dialog.tsx +35 -0
- package/web/components/shared/empty-state.tsx +29 -0
- package/web/components/shared/field.tsx +77 -0
- package/web/components/shared/filter-popover.tsx +29 -0
- package/web/components/shared/form-frame.tsx +19 -0
- package/web/components/shared/icon-button.tsx +50 -0
- package/web/components/shared/index.ts +18 -0
- package/web/components/shared/mic-button.tsx +75 -0
- package/web/components/shared/pager.tsx +49 -0
- package/web/components/shared/picker.tsx +108 -0
- package/web/components/shared/project-mark.tsx +38 -0
- package/web/components/shared/segmented.tsx +43 -0
- package/web/components/shared/state-dot.tsx +4 -0
- package/web/components/shared/status-mark.tsx +26 -0
- package/web/components/shell/index.ts +3 -0
- package/web/components/shell/rail.tsx +259 -0
- package/web/components/shell/sprite.tsx +124 -0
- package/web/components/shell/wordmark.tsx +13 -0
- package/web/components/task/artifact-view.tsx +148 -0
- package/web/components/task/chat-bubble.tsx +43 -0
- package/web/components/task/filter-menu.tsx +38 -0
- package/web/components/task/index.ts +7 -0
- package/web/components/task/result-checks.tsx +34 -0
- package/web/components/task/result-view.tsx +113 -0
- package/web/components/task/status-badge.tsx +24 -0
- package/web/components/task/task-row.tsx +34 -0
- package/web/components/task/typing-dots.tsx +16 -0
- package/web/components/terminal/index.ts +3 -0
- package/web/components/terminal/terminal-bar.tsx +91 -0
- package/web/components/terminal/terminal-grid.tsx +149 -0
- package/web/components/terminal/terminal-modes.tsx +23 -0
- package/web/components/terminal/terminal-tile.tsx +139 -0
- package/web/dist/annotate.js +24 -0
- package/web/dist/board.css +718 -0
- package/web/dist/board.js +115 -0
- package/web/dist/boot.js +2 -0
- package/web/dist/notebook.css +319 -0
- package/web/dist/notebook.js +89 -0
- package/web/dist/popup.css +41 -0
- package/web/dist/popup.js +13 -0
- package/web/{term.js → dist/term.js} +48 -48
- package/web/dist/ui.css +3 -0
- package/web/dist/video.js +108 -0
- package/web/html/board.html +17 -0
- package/web/html/notes.html +14 -0
- package/web/html/popup.html +13 -0
- package/web/{video.html → html/video.html} +14 -15
- package/web/lib/annotate/index.ts +2 -0
- package/web/lib/annotate/notes.ts +105 -0
- package/web/lib/annotate/page.ts +121 -0
- package/web/lib/annotate/rules.ts +37 -0
- package/web/lib/annotate/session.ts +336 -0
- package/web/lib/board/board-actions.ts +119 -0
- package/web/lib/board/board-open.ts +12 -0
- package/web/lib/board/board-store.ts +159 -0
- package/web/lib/board/filter-box.ts +7 -0
- package/web/lib/board/index.ts +10 -0
- package/web/lib/board/nav.ts +29 -0
- package/web/lib/board/on-state.ts +90 -0
- package/web/lib/board/popups.ts +22 -0
- package/web/lib/board/snapshot.ts +105 -0
- package/web/lib/board/strip.ts +43 -0
- package/web/{board → lib/board}/ws-board.ts +1 -1
- package/web/lib/context/context-rules.ts +27 -0
- package/web/lib/context/context-store.ts +95 -0
- package/web/lib/context/feed.ts +28 -0
- package/web/lib/context/index.ts +3 -0
- package/web/lib/core/api.ts +86 -0
- package/web/lib/core/ask.ts +24 -0
- package/web/lib/core/board.ts +290 -0
- package/web/lib/core/brief.ts +31 -0
- package/web/lib/core/format.ts +8 -0
- package/web/lib/core/host.ts +107 -0
- package/web/lib/core/index.ts +16 -0
- package/web/{board → lib/core}/labels.ts +6 -5
- package/web/lib/core/layers.ts +7 -0
- package/web/lib/core/leave.ts +7 -0
- package/web/lib/core/motion.ts +10 -0
- package/web/{board/toast.ts → lib/core/notices.ts} +2 -20
- package/web/lib/core/notifier.ts +15 -0
- package/web/lib/core/store.ts +39 -0
- package/web/lib/core/term-handle.ts +8 -0
- package/web/lib/core/toast.ts +29 -0
- package/web/lib/core/utils.ts +15 -0
- package/web/lib/decision/index.ts +1 -0
- package/web/lib/decision/plan-questions.ts +39 -0
- package/web/lib/dictation/chunks.ts +93 -0
- package/web/lib/dictation/dictation-store.ts +22 -0
- package/web/lib/dictation/engine.ts +265 -0
- package/web/lib/dictation/index.ts +5 -0
- package/web/lib/dictation/mic.ts +42 -0
- package/web/lib/dictation/terminal-dictation.ts +50 -0
- package/web/lib/footer/footer-rules.ts +13 -0
- package/web/lib/footer/footer-store.ts +42 -0
- package/web/lib/footer/index.ts +2 -0
- package/web/lib/git/git-actions.ts +110 -0
- package/web/lib/git/git-panel.ts +43 -0
- package/web/lib/git/git-store.ts +47 -0
- package/web/lib/git/git.ts +170 -0
- package/web/lib/git/index.ts +4 -0
- package/web/lib/home/home-engine.ts +16 -0
- package/web/lib/home/home-events.ts +9 -0
- package/web/lib/home/home-store.ts +247 -0
- package/web/lib/home/home-window.ts +193 -0
- package/web/lib/home/home.ts +85 -0
- package/web/lib/home/index.ts +7 -0
- package/web/lib/home/onboarding.ts +199 -0
- package/web/lib/home/use-float-drag.ts +62 -0
- package/web/lib/icebox/icebox-actions.ts +518 -0
- package/web/lib/icebox/icebox-store.ts +112 -0
- package/web/lib/icebox/icebox-view.ts +48 -0
- package/web/lib/icebox/icebox.ts +273 -0
- package/web/lib/icebox/index.ts +8 -0
- package/web/lib/icebox/use-card-drag.ts +82 -0
- package/web/lib/icebox/use-ice-keys.ts +75 -0
- package/web/lib/icebox/use-icebox.ts +41 -0
- package/web/lib/icebox/use-row-swipe.ts +107 -0
- package/web/lib/markdown/index.ts +1 -0
- package/web/lib/markdown/markdown.ts +136 -0
- package/web/lib/notebook/autosave.ts +131 -0
- package/web/lib/notebook/deal.ts +58 -0
- package/web/lib/notebook/engine-complete.ts +128 -0
- package/web/lib/notebook/engine-preview.ts +287 -0
- package/web/lib/notebook/engine-types.ts +26 -0
- package/web/lib/notebook/engine-widgets.ts +218 -0
- package/web/lib/notebook/engine.ts +74 -0
- package/web/lib/notebook/index.ts +9 -0
- package/web/lib/notebook/kit-loader.ts +16 -0
- package/web/lib/notebook/kit.ts +12 -0
- package/web/{notes-lib.ts → lib/notebook/text.ts} +11 -10
- package/web/lib/notebook/vault-actions.ts +239 -0
- package/web/lib/notebook/vault-rules.ts +74 -0
- package/web/lib/notebook/vault-session.ts +73 -0
- package/web/lib/notebook/vault-store.ts +63 -0
- package/web/lib/notes/index.ts +4 -0
- package/web/lib/notes/md-html.ts +115 -0
- package/web/lib/notes/notes-actions.ts +32 -0
- package/web/lib/notes/notes-store.ts +22 -0
- package/web/lib/notes/notes.ts +58 -0
- package/web/{board → lib/notes}/rich.ts +1 -2
- package/web/lib/phone/index.ts +7 -0
- package/web/lib/phone/phone-actions.ts +77 -0
- package/web/lib/phone/phone-home.ts +102 -0
- package/web/lib/phone/phone-setup.ts +59 -0
- package/web/lib/phone/phone-sheet.ts +25 -0
- package/web/lib/phone/phone-store.ts +32 -0
- package/web/lib/phone/sheet-swipe.ts +55 -0
- package/web/lib/phone/use-phone-setup.ts +89 -0
- package/web/lib/project/add-project.ts +37 -0
- package/web/lib/project/branch.ts +14 -0
- package/web/lib/project/index.ts +5 -0
- package/web/lib/project/project-bar.ts +76 -0
- package/web/lib/project/project-pick.ts +36 -0
- package/web/lib/project/ws-menu.ts +8 -0
- package/web/lib/rail/agents.ts +63 -0
- package/web/lib/rail/card-links.ts +20 -0
- package/web/lib/rail/index.ts +7 -0
- package/web/lib/rail/rail-actions.ts +74 -0
- package/web/lib/rail/rail-boot.ts +99 -0
- package/web/lib/rail/rail-store.ts +85 -0
- package/web/lib/rail/rules.ts +241 -0
- package/web/lib/rail/source-marks.ts +17 -0
- package/web/lib/rail/use-rank-drag.ts +108 -0
- package/web/lib/resources/index.ts +3 -0
- package/web/lib/resources/resources-actions.ts +59 -0
- package/web/lib/resources/resources-store.ts +48 -0
- package/web/lib/resources/rules.ts +56 -0
- package/web/lib/router/index.ts +3 -0
- package/web/lib/router/route-rules.ts +96 -0
- package/web/lib/router/route-store.ts +115 -0
- package/web/lib/router/use-route-classes.ts +15 -0
- package/web/lib/run/browser.ts +53 -0
- package/web/lib/run/card-terminal.ts +32 -0
- package/web/lib/run/doc.ts +42 -0
- package/web/lib/run/grip.ts +8 -0
- package/web/lib/run/index.ts +19 -0
- package/web/lib/run/kept.ts +58 -0
- package/web/lib/run/layout-store.ts +156 -0
- package/web/lib/run/layout.ts +195 -0
- package/web/lib/run/panel-actions.ts +104 -0
- package/web/lib/run/panel-derive.ts +148 -0
- package/web/lib/run/panel-store.ts +125 -0
- package/web/lib/run/preview.ts +105 -0
- package/web/lib/run/run-actions.ts +118 -0
- package/web/lib/run/run-view-store.ts +134 -0
- package/web/lib/run/term-loader.ts +19 -0
- package/web/lib/run/use-panel-run.ts +125 -0
- package/web/lib/run/use-run-lifecycle.ts +70 -0
- package/web/lib/run/viewer.ts +12 -0
- package/web/lib/run/workspace.ts +281 -0
- package/web/lib/run/ws-actions.ts +293 -0
- package/web/lib/run/ws-derive.ts +50 -0
- package/web/lib/run/ws-draw.ts +102 -0
- package/web/lib/run/ws-store.ts +21 -0
- package/web/lib/run/ws-tabs.ts +125 -0
- package/web/lib/search/index.ts +3 -0
- package/web/lib/search/search-match.ts +48 -0
- package/web/lib/search/search-rows.ts +228 -0
- package/web/lib/search/search.ts +30 -0
- package/web/lib/search/use-search-rows.ts +22 -0
- package/web/lib/server/attention.ts +29 -0
- package/web/lib/server/index.ts +6 -0
- package/web/lib/server/poll-rules.ts +57 -0
- package/web/lib/server/poller.ts +210 -0
- package/web/lib/server/server-store.ts +39 -0
- package/web/lib/server/types.ts +31 -0
- package/web/lib/server/use-server.ts +19 -0
- package/web/lib/settings/agent-favicons.ts +14 -0
- package/web/lib/settings/index.ts +7 -0
- package/web/lib/settings/panel-settings.ts +29 -0
- package/web/lib/settings/settings-actions.ts +357 -0
- package/web/lib/settings/settings-store.ts +114 -0
- package/web/lib/settings/settings.ts +413 -0
- package/web/lib/settings/skill-icons.ts +24 -0
- package/web/lib/settings/update.ts +70 -0
- package/web/lib/shared/data-urls.ts +32 -0
- package/web/lib/shared/index.ts +4 -0
- package/web/lib/shared/use-draft.ts +38 -0
- package/web/lib/shared/use-narrow.ts +11 -0
- package/web/lib/shared/use-pager.ts +24 -0
- package/web/lib/shell/appearance.ts +97 -0
- package/web/lib/shell/help-store.ts +4 -0
- package/web/lib/shell/index.ts +4 -0
- package/web/lib/shell/shell-store.ts +23 -0
- package/web/lib/shell/stored-look.ts +47 -0
- package/web/lib/task/index.ts +7 -0
- package/web/lib/task/task-results.ts +92 -0
- package/web/lib/task/tasks.ts +134 -0
- package/web/lib/task/use-live-frame.ts +85 -0
- package/web/lib/task/use-saved-text.ts +25 -0
- package/web/lib/task/use-task.ts +161 -0
- package/web/lib/task/use-tasks.ts +50 -0
- package/web/{board → lib/task}/zoom.ts +25 -12
- package/web/lib/terminal/hidden-badge.ts +15 -0
- package/web/lib/terminal/index.ts +8 -0
- package/web/lib/terminal/layout.ts +138 -0
- package/web/{term-font.ts → lib/terminal/term-font.ts} +3 -2
- package/web/lib/terminal/terminal-store.ts +65 -0
- package/web/lib/terminal/terms-feed.ts +37 -0
- package/web/lib/terminal/use-arranged.ts +15 -0
- package/web/lib/terminal/use-terminal-keys.ts +37 -0
- package/web/lib/url/index.ts +1 -0
- package/web/lib/url/safe-url.ts +9 -0
- package/web/notebook/notebook.ts +27 -0
- package/web/notebook/notes-lib.ts +3 -0
- package/web/pages/board/App.tsx +76 -0
- package/web/pages/board/header.tsx +83 -0
- package/web/pages/board/help.tsx +59 -0
- package/web/pages/board/host-bridge.ts +94 -0
- package/web/pages/board/host.tsx +19 -0
- package/web/pages/board/keys.ts +112 -0
- package/web/pages/board/live.ts +39 -0
- package/web/pages/board/main.ts +32 -0
- package/web/pages/board/pages.tsx +86 -0
- package/web/pages/board/panel.tsx +157 -0
- package/web/pages/board/portal.tsx +39 -0
- package/web/pages/board/use-boot.ts +13 -0
- package/web/pages/board/views.ts +63 -0
- package/web/pages/board-page.tsx +62 -0
- package/web/pages/home-page.tsx +127 -0
- package/web/pages/icebox-page.tsx +440 -0
- package/web/pages/notebook/App.tsx +35 -0
- package/web/pages/notebook-page.tsx +50 -0
- package/web/pages/popup/App.tsx +207 -0
- package/web/pages/settings-page.tsx +111 -0
- package/web/pages/task-page.tsx +397 -0
- package/web/pages/tasks-page.tsx +151 -0
- package/web/pages/terminal-page.tsx +15 -0
- package/web/popup/popup.ts +7 -0
- package/web/{term.ts → term/term.ts} +48 -20
- package/web/ui/alert-dialog.tsx +39 -0
- package/web/ui/badge.tsx +20 -0
- package/web/ui/button.tsx +37 -0
- package/web/ui/checkbox.tsx +20 -0
- package/web/ui/command.tsx +41 -0
- package/web/ui/dialog.tsx +28 -0
- package/web/ui/dropdown-menu.tsx +54 -0
- package/web/ui/icon.tsx +17 -0
- package/web/ui/index.ts +21 -0
- package/web/ui/input.tsx +9 -0
- package/web/ui/label.tsx +7 -0
- package/web/ui/legacy/board.css +715 -0
- package/web/{notes.html → ui/legacy/notes.css} +23 -157
- package/web/ui/legacy/popup.css +40 -0
- package/web/ui/popover.tsx +28 -0
- package/web/ui/select.tsx +61 -0
- package/web/ui/sheet.tsx +43 -0
- package/web/ui/skeleton.tsx +6 -0
- package/web/ui/sonner.tsx +25 -0
- package/web/ui/spinner.tsx +12 -0
- package/web/ui/switch.tsx +18 -0
- package/web/ui/tabs.tsx +18 -0
- package/web/ui/textarea.tsx +14 -0
- package/web/ui/theme.css +125 -0
- package/web/ui/toggle.tsx +8 -0
- package/web/ui/tooltip.tsx +26 -0
- package/web/{video.ts → video/video.ts} +5 -5
- package/web/board/add-project.ts +0 -147
- package/web/board/agent-favicons.ts +0 -9
- package/web/board/agent-term.ts +0 -51
- package/web/board/annotate-lib.ts +0 -19
- package/web/board/annotate.ts +0 -221
- package/web/board/api.ts +0 -180
- package/web/board/approvals.ts +0 -109
- package/web/board/badge.ts +0 -115
- package/web/board/cards.ts +0 -1080
- package/web/board/chat.ts +0 -128
- package/web/board/context.ts +0 -248
- package/web/board/dictation.ts +0 -343
- package/web/board/dom.ts +0 -132
- package/web/board/drafts.ts +0 -21
- package/web/board/fixes.ts +0 -89
- package/web/board/git.ts +0 -416
- package/web/board/home-ws.ts +0 -266
- package/web/board/home.ts +0 -421
- package/web/board/icebox.ts +0 -1788
- package/web/board/keys.ts +0 -121
- package/web/board/live.ts +0 -87
- package/web/board/main.ts +0 -94
- package/web/board/markdown.ts +0 -210
- package/web/board/onboarding.ts +0 -227
- package/web/board/panel.ts +0 -437
- package/web/board/phone-setup.ts +0 -79
- package/web/board/phone.ts +0 -219
- package/web/board/projects.ts +0 -277
- package/web/board/resources.ts +0 -170
- package/web/board/run-pick.ts +0 -41
- package/web/board/run-view.ts +0 -1316
- package/web/board/search-match.ts +0 -20
- package/web/board/search.ts +0 -330
- package/web/board/settings-accounts.ts +0 -76
- package/web/board/settings-agents.ts +0 -102
- package/web/board/settings-automations.ts +0 -71
- package/web/board/settings-cleanup.ts +0 -42
- package/web/board/settings-orchestration.ts +0 -32
- package/web/board/settings-pages.ts +0 -62
- package/web/board/settings-skills.ts +0 -103
- package/web/board/settings-voice.ts +0 -28
- package/web/board/settings.ts +0 -490
- package/web/board/store.ts +0 -47
- package/web/board/task-page.ts +0 -628
- package/web/board/task-results.ts +0 -234
- package/web/board/tasks.ts +0 -242
- package/web/board/terms.ts +0 -390
- package/web/board/update.ts +0 -171
- package/web/board/viewer.ts +0 -47
- package/web/board/views.ts +0 -164
- package/web/board/whatsapp-setup.ts +0 -149
- package/web/board/workspace.ts +0 -650
- package/web/board/ws-board-ui.ts +0 -95
- package/web/board/ws-tabs.ts +0 -227
- package/web/board.html +0 -1563
- package/web/board.js +0 -505
- package/web/notebook.js +0 -519
- package/web/notebook.ts +0 -1254
- package/web/popup.html +0 -141
- package/web/video.js +0 -575
- /package/web/{term.css → dist/term.css} +0 -0
- /package/web/{board/term-sessions.ts → lib/terminal/sessions.ts} +0 -0
- /package/web/{board/terminal-viewport.ts → lib/terminal/viewport.ts} +0 -0
- /package/web/{term-paste.ts → term/term-paste.ts} +0 -0
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
// The Icebox's data and the pure rules over it: what a request, a source and a collection look like as the
|
|
2
|
+
// server sends them (GET /sources), and how the page narrows, groups and words them. No React and no DOM here,
|
|
3
|
+
// so every rule can be tested on its own (web/icebox.test.ts).
|
|
4
|
+
|
|
5
|
+
export type IceItem = {
|
|
6
|
+
id: string;
|
|
7
|
+
dir: string;
|
|
8
|
+
project?: string;
|
|
9
|
+
text: string;
|
|
10
|
+
notes?: string;
|
|
11
|
+
source: string;
|
|
12
|
+
category?: string;
|
|
13
|
+
at: string;
|
|
14
|
+
status: "new" | "promoted" | "dismissed" | "done" | string;
|
|
15
|
+
kind?: string;
|
|
16
|
+
sorted?: string;
|
|
17
|
+
board?: string;
|
|
18
|
+
tags?: string[];
|
|
19
|
+
images?: string[];
|
|
20
|
+
link?: { url: string; title?: string; summary?: string };
|
|
21
|
+
post?: string | null;
|
|
22
|
+
replied?: string;
|
|
23
|
+
written?: string;
|
|
24
|
+
writeError?: string;
|
|
25
|
+
idea?: string;
|
|
26
|
+
asleep?: boolean;
|
|
27
|
+
};
|
|
28
|
+
export type Source = {
|
|
29
|
+
url: string;
|
|
30
|
+
dir: string;
|
|
31
|
+
project?: string;
|
|
32
|
+
label?: string;
|
|
33
|
+
category?: string;
|
|
34
|
+
social?: string | null;
|
|
35
|
+
paused?: boolean;
|
|
36
|
+
writeback?: boolean;
|
|
37
|
+
last?: { at: string; ok: boolean; added: number; note: string };
|
|
38
|
+
};
|
|
39
|
+
export type Board = { dir: string; name: string; client?: boolean };
|
|
40
|
+
export type IceData = {
|
|
41
|
+
sources: Source[];
|
|
42
|
+
icebox: IceItem[];
|
|
43
|
+
dismissed: IceItem[];
|
|
44
|
+
boards: Board[];
|
|
45
|
+
failed: string[];
|
|
46
|
+
every?: string;
|
|
47
|
+
gatherer?: { use?: string; connected?: boolean; email?: string | null };
|
|
48
|
+
google?: { connected?: boolean; hasClient?: boolean };
|
|
49
|
+
error?: string;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
// Platforms a social source can follow, and what an item is: a client asked for it, you found it, or people say it.
|
|
53
|
+
export const PLAT: Record<string, string> = { x: "X", tiktok: "TikTok", instagram: "Instagram", threads: "Threads" };
|
|
54
|
+
export const KIND: Record<string, string> = { client: "Client", finding: "Finding", people: "People say" };
|
|
55
|
+
export const STYLES: Record<string, string> = { casual: "Casual", fun: "Fun", helpful: "Helpful", promo: "Promo" };
|
|
56
|
+
|
|
57
|
+
// A link from sources.json or a gathered post: the server checks it on the way in, this keeps a javascript: URL
|
|
58
|
+
// from ever being a clickable href.
|
|
59
|
+
export const webUrl = (u: string) => (/^https?:\/\//i.test(String(u)) ? u : "#");
|
|
60
|
+
export const hostOf = (u: string) => {
|
|
61
|
+
try {
|
|
62
|
+
return new URL(u).hostname;
|
|
63
|
+
} catch {
|
|
64
|
+
return u;
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
export const sameName = (a?: string, b?: string) => String(a || "").toLowerCase() === String(b || "").toLowerCase();
|
|
68
|
+
export const iceKey = (it: IceItem) => it.dir + " " + it.id;
|
|
69
|
+
export const srcKey = (it: IceItem) => it.dir + " " + it.source;
|
|
70
|
+
export const hue = (t: string) => [...t].reduce((a, c) => (a * 31 + c.charCodeAt(0)) % 360, 7);
|
|
71
|
+
|
|
72
|
+
export const ago = (at: string, now = Date.now()) => {
|
|
73
|
+
const m = Math.round((now - Date.parse(at)) / 60000);
|
|
74
|
+
return m < 1
|
|
75
|
+
? "just now"
|
|
76
|
+
: m < 60
|
|
77
|
+
? m + " min ago"
|
|
78
|
+
: m < 1440
|
|
79
|
+
? Math.round(m / 60) + " h ago"
|
|
80
|
+
: Math.round(m / 1440) + " d ago";
|
|
81
|
+
};
|
|
82
|
+
// The day a snooze lands on, said as the server works it out (1d, 1w, 1m or a date).
|
|
83
|
+
export const wakeDay = (until: string, from = new Date()) => {
|
|
84
|
+
const d = new Date(from);
|
|
85
|
+
if (until === "1d") d.setDate(d.getDate() + 1);
|
|
86
|
+
else if (until === "1w") d.setDate(d.getDate() + 7);
|
|
87
|
+
else if (until === "1m") d.setMonth(d.getMonth() + 1);
|
|
88
|
+
else return new Date(until + "T00:00:00");
|
|
89
|
+
return d;
|
|
90
|
+
};
|
|
91
|
+
export const ymd = (d: Date) => d.toLocaleDateString("sv");
|
|
92
|
+
export const snoozedLine = (n: number, until: string) =>
|
|
93
|
+
`${n > 1 ? n + " snoozed" : "Snoozed"} until ${wakeDay(until).toLocaleDateString(undefined, { weekday: "short", month: "short", day: "numeric" })}`;
|
|
94
|
+
|
|
95
|
+
export const srcType = (s: Source) => {
|
|
96
|
+
if (s.social) return "social";
|
|
97
|
+
const u = s.url;
|
|
98
|
+
if (u.includes("docs.google.com/spreadsheets") || u.endsWith(".csv") || u.endsWith(".tsv")) return "sheet";
|
|
99
|
+
if (u.includes("docs.google.com/document")) return "doc";
|
|
100
|
+
return "link";
|
|
101
|
+
};
|
|
102
|
+
// What a source is called when nothing names it: its platform, else its site.
|
|
103
|
+
export const platOf = (s?: Pick<Source, "url" | "social"> | null) =>
|
|
104
|
+
(s?.social && PLAT[s.social]) || (s ? hostOf(s.url).replace(/^www\./, "") : "") || "Other";
|
|
105
|
+
export const srcOf = (list: Source[], it: IceItem) => list.find((x) => x.dir === it.dir && x.url === it.source);
|
|
106
|
+
export const srcName = (list: Source[], it: IceItem) => {
|
|
107
|
+
const s = srcOf(list, it);
|
|
108
|
+
return s ? s.label || hostOf(s.url) : hostOf(it.source);
|
|
109
|
+
};
|
|
110
|
+
// An item with no category of its own takes its source's, else the source's platform or site.
|
|
111
|
+
export const catOf = (list: Source[], it: IceItem) =>
|
|
112
|
+
it.status === "dismissed"
|
|
113
|
+
? "Dismissed"
|
|
114
|
+
: it.status === "done"
|
|
115
|
+
? "Done"
|
|
116
|
+
: it.status === "promoted"
|
|
117
|
+
? "Promoted"
|
|
118
|
+
: it.category || srcOf(list, it)?.category || platOf(srcOf(list, it) || { url: it.source });
|
|
119
|
+
export const isWaiting = (it: IceItem) => !["promoted", "dismissed", "done"].includes(it.status);
|
|
120
|
+
export const isLive = (it: IceItem) => it.status === "new";
|
|
121
|
+
export const hiddenCat = (c: string) => c === "Dismissed" || c === "Done" || c === "Promoted";
|
|
122
|
+
export const pictures = (it: IceItem) => (it.images || []).filter((u) => /^https:\/\//.test(u));
|
|
123
|
+
// The favicon of the site a link is on, asked of that site itself (Google's own static host for Sheets and Docs,
|
|
124
|
+
// whose site icon is generic): nothing but the host reaches anyone. "" when there is none to ask for.
|
|
125
|
+
export function faviconUrl(u: string): string {
|
|
126
|
+
let origin = "";
|
|
127
|
+
try {
|
|
128
|
+
const x = new URL(u);
|
|
129
|
+
if (/^https?:$/.test(x.protocol)) origin = x.origin;
|
|
130
|
+
} catch {}
|
|
131
|
+
return !origin
|
|
132
|
+
? ""
|
|
133
|
+
: u.includes("docs.google.com/spreadsheets")
|
|
134
|
+
? "https://ssl.gstatic.com/docs/spreadsheets/favicon3.ico"
|
|
135
|
+
: u.includes("docs.google.com/document")
|
|
136
|
+
? "https://ssl.gstatic.com/docs/documents/images/kix-favicon7.ico"
|
|
137
|
+
: origin + "/favicon.ico";
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export type Filters = { board: string; kinds: string[]; cat: string; src: string };
|
|
141
|
+
export type Env = {
|
|
142
|
+
dir: string | null; // the one project the board shows, or null in All projects
|
|
143
|
+
shown: ReadonlySet<string>; // the "Showing" picker's projects; empty shows every one
|
|
144
|
+
showable: { dir: string; label: string }[];
|
|
145
|
+
};
|
|
146
|
+
export type Derived = {
|
|
147
|
+
list: Source[];
|
|
148
|
+
ice: IceItem[]; // awake items plus the dismissed ones that ride along
|
|
149
|
+
waiting: number;
|
|
150
|
+
many: boolean; // more than one project: rows name theirs
|
|
151
|
+
boards: Board[];
|
|
152
|
+
byCat: Map<string, { it: IceItem; n: number }>;
|
|
153
|
+
bySrc: Map<string, { it: IceItem; n: number }>;
|
|
154
|
+
filtered: IceItem[]; // newest first, every filter applied, before paging
|
|
155
|
+
board: string; // the filters as they hold, an unknown one cleared
|
|
156
|
+
cat: string;
|
|
157
|
+
src: string;
|
|
158
|
+
inProj: (it: IceItem) => boolean;
|
|
159
|
+
nOn: (b: Board) => number;
|
|
160
|
+
};
|
|
161
|
+
const count = (xs: IceItem[], f: (it: IceItem) => string) => {
|
|
162
|
+
const m = new Map<string, { it: IceItem; n: number }>();
|
|
163
|
+
xs.forEach((it) => {
|
|
164
|
+
const k = f(it);
|
|
165
|
+
m.set(k, { it, n: (m.get(k)?.n || 0) + 1 });
|
|
166
|
+
});
|
|
167
|
+
return m;
|
|
168
|
+
};
|
|
169
|
+
// Filters narrow in turn: project (the board's own pickers), then collection and kind, then category, then
|
|
170
|
+
// source; each chip counts what the filters before it leave. A snoozed item is left out until its date (the
|
|
171
|
+
// server says `asleep`); dismissed ones show only under their own category.
|
|
172
|
+
export function deriveIce(d: IceData, f: Filters, env: Env): Derived {
|
|
173
|
+
const list = d.sources || [],
|
|
174
|
+
awake = (d.icebox || []).filter((it) => !it.asleep),
|
|
175
|
+
ice = [...awake, ...(d.dismissed || [])],
|
|
176
|
+
waiting = awake.filter((it) => it.status === "new").length;
|
|
177
|
+
const projects = new Set(env.dir ? [] : ice.map((it) => it.dir));
|
|
178
|
+
if (!env.dir) for (const pd of env.shown) if (env.showable.some((x) => x.dir === pd)) projects.add(pd);
|
|
179
|
+
const inProj = (it: IceItem | Board) => !!env.dir || !env.shown.size || env.shown.has(it.dir),
|
|
180
|
+
pv = ice.filter(inProj);
|
|
181
|
+
// A board is its name: two projects' boards of one name are one chip in All projects.
|
|
182
|
+
const boards = [...new Map((d.boards || []).filter(inProj).map((b) => [b.name.toLowerCase(), b])).values()];
|
|
183
|
+
const board = f.board && boards.some((b) => sameName(b.name, f.board)) ? f.board : "";
|
|
184
|
+
const onBoard = (it: IceItem) => !board || sameName(it.board, board),
|
|
185
|
+
ofKind = (it: IceItem) => !f.kinds.length || f.kinds.includes(it.kind || ""),
|
|
186
|
+
base = pv.filter((it) => onBoard(it) && ofKind(it));
|
|
187
|
+
const byCat = count(base, (it) => catOf(list, it)),
|
|
188
|
+
cat = f.cat && byCat.has(f.cat) ? f.cat : "";
|
|
189
|
+
const cv = base.filter((it) => !cat || catOf(list, it) === cat),
|
|
190
|
+
bySrc = count(cv, srcKey),
|
|
191
|
+
src = f.src && bySrc.has(f.src) ? f.src : "";
|
|
192
|
+
const filtered = ice
|
|
193
|
+
.filter(
|
|
194
|
+
(it) =>
|
|
195
|
+
inProj(it) &&
|
|
196
|
+
onBoard(it) &&
|
|
197
|
+
ofKind(it) &&
|
|
198
|
+
(cat ? catOf(list, it) === cat : it.status === "new") &&
|
|
199
|
+
(!src || srcKey(it) === src),
|
|
200
|
+
)
|
|
201
|
+
.sort((a, b) => (Date.parse(b.at) || 0) - (Date.parse(a.at) || 0));
|
|
202
|
+
return {
|
|
203
|
+
list,
|
|
204
|
+
ice,
|
|
205
|
+
waiting,
|
|
206
|
+
many: projects.size > 1,
|
|
207
|
+
boards,
|
|
208
|
+
byCat,
|
|
209
|
+
bySrc,
|
|
210
|
+
filtered,
|
|
211
|
+
board,
|
|
212
|
+
cat,
|
|
213
|
+
src,
|
|
214
|
+
inProj,
|
|
215
|
+
nOn: (b) => pv.filter((it) => isWaiting(it) && sameName(it.board, b.name)).length,
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
// Sources group by platform: two Threads searches sit under one Threads.
|
|
219
|
+
export function srcGroups(list: Source[], bySrc: Derived["bySrc"]) {
|
|
220
|
+
const g = new Map<string, [string, IceItem][]>();
|
|
221
|
+
for (const [k, { it }] of bySrc) {
|
|
222
|
+
const p = platOf(srcOf(list, it) || { url: it.source });
|
|
223
|
+
g.has(p) || g.set(p, []);
|
|
224
|
+
g.get(p)!.push([k, it]);
|
|
225
|
+
}
|
|
226
|
+
return g;
|
|
227
|
+
}
|
|
228
|
+
// The rows' label for a source inside its platform group: "Threads: ai" sits under Threads as "ai".
|
|
229
|
+
export const subName = (name: string, group: string) =>
|
|
230
|
+
name.toLowerCase().startsWith(group.toLowerCase() + ":") ? name.slice(group.length + 1).trim() : name;
|
|
231
|
+
|
|
232
|
+
// The cursor steps to the next row that stays when rows go, else the one before; null when none stays.
|
|
233
|
+
export function stepPast(order: IceItem[], cur: string | null, gone: ReadonlySet<string>): string | null {
|
|
234
|
+
const at = order.findIndex((it) => iceKey(it) === cur);
|
|
235
|
+
if (at < 0 || !cur || !gone.has(cur)) return cur;
|
|
236
|
+
const stay = (it: IceItem) => !gone.has(iceKey(it)),
|
|
237
|
+
n = order.slice(at + 1).find(stay) ?? order.slice(0, at).reverse().find(stay);
|
|
238
|
+
return n ? iceKey(n) : null;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
// What Gather all says, from the server's per-source results.
|
|
242
|
+
export function gatherLine(rs: { url: string; ok: boolean; added: number }[], list: Source[]) {
|
|
243
|
+
const soc = (r: { url: string }) => list.some((s) => s.url === r.url && s.social),
|
|
244
|
+
n = rs.reduce((a, r) => a + r.added, 0),
|
|
245
|
+
bad = rs.filter((r) => !r.ok && !soc(r)).length,
|
|
246
|
+
ag = rs.filter(soc).length;
|
|
247
|
+
return (
|
|
248
|
+
(n ? `${n} new in the icebox` : "Nothing new") +
|
|
249
|
+
(bad ? `, ${bad} source${bad === 1 ? "" : "s"} could not be read` : "") +
|
|
250
|
+
(ag ? `; ${ag} social for /kaizen gather` : "")
|
|
251
|
+
);
|
|
252
|
+
}
|
|
253
|
+
// The long-press and swipe gestures: how far a drag must go before it decides.
|
|
254
|
+
export const SWIPE_AT = 0.35;
|
|
255
|
+
// The swipe deck: the waiting requests the filters show, least skipped first.
|
|
256
|
+
export function deckOf(filtered: IceItem[], skip: ReadonlyMap<string, number>) {
|
|
257
|
+
return filtered.filter(isWaiting).sort((a, b) => (skip.get(iceKey(a)) || 0) - (skip.get(iceKey(b)) || 0));
|
|
258
|
+
}
|
|
259
|
+
// A project shows by its folder name alone; the full path stays in the tooltip.
|
|
260
|
+
export const short = (l: string) => l.split(/[\\/]/).pop() || l;
|
|
261
|
+
// What a row, a card or a phone row needs to know about the page around it.
|
|
262
|
+
export type RowCtx = {
|
|
263
|
+
list: Source[];
|
|
264
|
+
many: boolean; // more than one project: rows name theirs
|
|
265
|
+
boards: Board[];
|
|
266
|
+
cur: string | null;
|
|
267
|
+
sel: ReadonlySet<string>;
|
|
268
|
+
open: string | null;
|
|
269
|
+
armed: string | null;
|
|
270
|
+
};
|
|
271
|
+
// The project a request is for, named: a swipe decides for that project's Tasks, so its card always names it.
|
|
272
|
+
export const pName = (it: IceItem, projects: { dir: string; label: string }[]) =>
|
|
273
|
+
it.project || projects.find((p) => p.dir === it.dir)?.label || "";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from "./icebox-actions.ts";
|
|
2
|
+
export * from "./icebox-store.ts";
|
|
3
|
+
export * from "./icebox-view.ts";
|
|
4
|
+
export * from "./icebox.ts";
|
|
5
|
+
export * from "./use-card-drag.ts";
|
|
6
|
+
export * from "./use-ice-keys.ts";
|
|
7
|
+
export * from "./use-icebox.ts";
|
|
8
|
+
export * from "./use-row-swipe.ts";
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
// The swipe card's gestures: it follows the pointer and tilts by its share of the width; past 100 px it decides, short
|
|
2
|
+
// of that it springs back. --p (-1..1) fades the PROMOTE and DISMISS stamps in. A thin imperative wrapper: styles are
|
|
3
|
+
// set on the element; the deck is told what was decided.
|
|
4
|
+
import { useRef, type PointerEvent } from "react";
|
|
5
|
+
import { host } from "@lib/core";
|
|
6
|
+
|
|
7
|
+
// A held or flying card is fixed to the window where it sits, so a scroll box or the page's own overflow cannot crop
|
|
8
|
+
// it on the way out.
|
|
9
|
+
const lift = (c: HTMLElement) => {
|
|
10
|
+
if (c.dataset.lift) return;
|
|
11
|
+
const r = c.getBoundingClientRect();
|
|
12
|
+
Object.assign(c.style, {
|
|
13
|
+
position: "fixed",
|
|
14
|
+
zIndex: "95",
|
|
15
|
+
margin: "0",
|
|
16
|
+
left: r.left + "px",
|
|
17
|
+
top: r.top + "px",
|
|
18
|
+
width: r.width + "px",
|
|
19
|
+
height: r.height + "px",
|
|
20
|
+
});
|
|
21
|
+
c.dataset.lift = "1";
|
|
22
|
+
};
|
|
23
|
+
const drop = (c: HTMLElement) => {
|
|
24
|
+
delete c.dataset.lift;
|
|
25
|
+
for (const k of ["position", "z-index", "margin", "left", "top", "width", "height", "transform"])
|
|
26
|
+
c.style.removeProperty(k);
|
|
27
|
+
c.style.removeProperty("--p");
|
|
28
|
+
};
|
|
29
|
+
// The card leaves to the side it was decided on. It hands back a way to bring the card home when the decision fails.
|
|
30
|
+
export async function flyCard(c: HTMLElement | null, dir: 1 | -1) {
|
|
31
|
+
if (!c) return;
|
|
32
|
+
if (!host.motion()) return () => drop(c);
|
|
33
|
+
lift(c);
|
|
34
|
+
await c
|
|
35
|
+
.animate(
|
|
36
|
+
[
|
|
37
|
+
{ transform: getComputedStyle(c).transform },
|
|
38
|
+
{ transform: `translateX(${dir * innerWidth}px) rotate(${dir * 30}deg)`, opacity: 0 },
|
|
39
|
+
],
|
|
40
|
+
{ duration: 320, easing: "cubic-bezier(.3,.6,.4,1)", fill: "forwards" },
|
|
41
|
+
)
|
|
42
|
+
.finished.catch(() => {});
|
|
43
|
+
return () => {
|
|
44
|
+
for (const a of c.getAnimations()) a.cancel();
|
|
45
|
+
drop(c);
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
export function useCardDrag(onDecide: (op: "promote" | "dismiss") => void) {
|
|
49
|
+
const ref = useRef<HTMLDivElement>(null);
|
|
50
|
+
const onPointerDown = (e: PointerEvent<HTMLDivElement>) => {
|
|
51
|
+
const card = ref.current;
|
|
52
|
+
if (!card || e.button || (e.target as Element).closest("a,button,summary,details")) return;
|
|
53
|
+
const x0 = e.clientX;
|
|
54
|
+
let dx = 0;
|
|
55
|
+
card.setPointerCapture(e.pointerId);
|
|
56
|
+
card.dataset.drag = "1";
|
|
57
|
+
lift(card);
|
|
58
|
+
card.onpointermove = (m) => {
|
|
59
|
+
dx = m.clientX - x0;
|
|
60
|
+
// Tilt by share of the card's width: a wide desktop card leans as much as a phone one.
|
|
61
|
+
card.style.transform = `translateX(${dx}px) rotate(${(dx / card.offsetWidth) * 18}deg)`;
|
|
62
|
+
card.style.setProperty("--p", String(Math.max(-1, Math.min(1, dx / 100))));
|
|
63
|
+
};
|
|
64
|
+
card.onpointerup = card.onpointercancel = () => {
|
|
65
|
+
card.onpointermove = card.onpointerup = card.onpointercancel = null;
|
|
66
|
+
delete card.dataset.drag;
|
|
67
|
+
if (Math.abs(dx) > 100) return onDecide(dx > 0 ? "promote" : "dismiss");
|
|
68
|
+
const from = card.style.transform;
|
|
69
|
+
card.style.removeProperty("--p");
|
|
70
|
+
const a =
|
|
71
|
+
host.motion() && from
|
|
72
|
+
? card.animate([{ transform: from }, { transform: "none" }], {
|
|
73
|
+
duration: 260,
|
|
74
|
+
easing: "cubic-bezier(.3,1.4,.5,1)",
|
|
75
|
+
})
|
|
76
|
+
: null;
|
|
77
|
+
card.style.transform = "";
|
|
78
|
+
(a ? a.finished.catch(() => {}) : Promise.resolve()).then(() => drop(card));
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
return { ref, onPointerDown };
|
|
82
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
// The Icebox's keys, read by the board's key handler (pages/board/keys.ts) while the Icebox shows. True when the key was
|
|
2
|
+
// used. j and k walk the cursor, o opens, x checks, p promotes, d dismisses, h snoozes a week (the checked ones when
|
|
3
|
+
// any are), Escape steps back one thing; in swipe mode the arrows decide and z undoes. A text field, a menu or a
|
|
4
|
+
// dialog keeps its own keys.
|
|
5
|
+
import { iceKey, isLive, type IceItem } from "./icebox.ts";
|
|
6
|
+
import { armPromote, bulkDo, exitSwipe, iceAct, snoozeAll, swGo, swUndo } from "./icebox-actions.ts";
|
|
7
|
+
import { getIce, iceEls, setIce } from "./icebox-store.ts";
|
|
8
|
+
import { toggleOpen, toggleSel } from "./icebox-view.ts";
|
|
9
|
+
import { getRoute } from "@lib/router";
|
|
10
|
+
import { flyCard } from "./use-card-drag.ts";
|
|
11
|
+
|
|
12
|
+
// An open popup (menu, popover, picker, select, dialog, the drawer) keeps its own keys; Radix marks them data-state=open.
|
|
13
|
+
const OVERLAY =
|
|
14
|
+
"[role=dialog][data-state=open],[role=alertdialog][data-state=open],[role=menu][data-state=open],[role=listbox][data-state=open]";
|
|
15
|
+
export function iceKeys(e: KeyboardEvent): boolean {
|
|
16
|
+
if (getRoute().page !== "icebox" || e.altKey || e.ctrlKey || e.metaKey) return false;
|
|
17
|
+
const t = e.target as Element | null,
|
|
18
|
+
k = e.key;
|
|
19
|
+
// A checkbox keeps the keys, for x then j.
|
|
20
|
+
if (t?.matches?.("input:not([type=checkbox]),select,textarea,[contenteditable]") || document.querySelector(OVERLAY))
|
|
21
|
+
return false;
|
|
22
|
+
const s = getIce();
|
|
23
|
+
if (s.swipe) {
|
|
24
|
+
const f = {
|
|
25
|
+
ArrowLeft: () => swGo("dismiss", (d) => flyCard(iceEls.swCard, d)),
|
|
26
|
+
ArrowRight: () => swGo("promote", (d) => flyCard(iceEls.swCard, d)),
|
|
27
|
+
ArrowDown: () => swGo("skip"),
|
|
28
|
+
z: swUndo,
|
|
29
|
+
Escape: exitSwipe,
|
|
30
|
+
}[k as "z"];
|
|
31
|
+
if (!f) return false;
|
|
32
|
+
e.preventDefault();
|
|
33
|
+
void f();
|
|
34
|
+
return true;
|
|
35
|
+
}
|
|
36
|
+
if (k === "Escape") {
|
|
37
|
+
if (s.open) setIce(s.armed ? { armed: null } : { open: null });
|
|
38
|
+
else if (s.sel.length) setIce({ sel: [] });
|
|
39
|
+
else return false;
|
|
40
|
+
return true;
|
|
41
|
+
}
|
|
42
|
+
const at = s.order.findIndex((it) => iceKey(it) === s.cur),
|
|
43
|
+
it: IceItem | undefined = s.order[at];
|
|
44
|
+
if (!it) return false;
|
|
45
|
+
if (k === "j" || k === "k") {
|
|
46
|
+
e.preventDefault();
|
|
47
|
+
const n = s.order[Math.max(0, Math.min(s.order.length - 1, at + (k === "j" ? 1 : -1)))]!;
|
|
48
|
+
setIce({ cur: iceKey(n) });
|
|
49
|
+
document.querySelector(`[data-key="${CSS.escape(iceKey(n))}"]`)?.scrollIntoView({ block: "nearest" });
|
|
50
|
+
return true;
|
|
51
|
+
}
|
|
52
|
+
const keys = new Set(s.sel);
|
|
53
|
+
if (k === "h") {
|
|
54
|
+
const its = keys.size ? s.order.filter((x) => keys.has(iceKey(x)) && isLive(x)) : isLive(it) ? [it] : [];
|
|
55
|
+
if (!its.length) return false;
|
|
56
|
+
e.preventDefault();
|
|
57
|
+
void snoozeAll(its, "1w");
|
|
58
|
+
return true;
|
|
59
|
+
}
|
|
60
|
+
const closed = it.status === "promoted" || it.status === "done";
|
|
61
|
+
const run =
|
|
62
|
+
k === "o"
|
|
63
|
+
? () => toggleOpen(it)
|
|
64
|
+
: k === "x"
|
|
65
|
+
? () => toggleSel(iceKey(it))
|
|
66
|
+
: k === "p" && !s.busy && (keys.size || !closed)
|
|
67
|
+
? () => (keys.size ? void bulkDo("promote") : armPromote(it))
|
|
68
|
+
: k === "d" && !s.busy && (keys.size || (!closed && it.status !== "dismissed"))
|
|
69
|
+
? () => (keys.size ? void bulkDo("dismiss") : void iceAct("dismiss", it, "Dismissed"))
|
|
70
|
+
: null;
|
|
71
|
+
if (!run) return false;
|
|
72
|
+
e.preventDefault();
|
|
73
|
+
run();
|
|
74
|
+
return true;
|
|
75
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// The Icebox's data: GET /sources, refreshed when the board says something changed (the server's event stream, counted in
|
|
2
|
+
// the server store), when its own state moved (a project switch) and when the "Showing" picker changes (the `useShown` store). One request at a time (a second asks for one more round), a stale answer is dropped. Every redraw
|
|
3
|
+
// is React's, so an open menu or a press in progress is never disturbed by a refresh.
|
|
4
|
+
import { useEffect } from "react";
|
|
5
|
+
import { getSources, host } from "@lib/core";
|
|
6
|
+
import { useShown } from "@lib/project";
|
|
7
|
+
import { getRoute } from "@lib/router";
|
|
8
|
+
import { onServer, onState } from "@lib/server";
|
|
9
|
+
import { setIce } from "./icebox-store.ts";
|
|
10
|
+
|
|
11
|
+
let sequence = 0,
|
|
12
|
+
loading = false,
|
|
13
|
+
again = false;
|
|
14
|
+
export async function refreshIce() {
|
|
15
|
+
if (getRoute().page !== "icebox") return;
|
|
16
|
+
if (loading) {
|
|
17
|
+
again = true;
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
loading = true;
|
|
21
|
+
do {
|
|
22
|
+
again = false;
|
|
23
|
+
const gen = ++sequence,
|
|
24
|
+
data = await getSources(host.scopeDir());
|
|
25
|
+
if (gen !== sequence || getRoute().page !== "icebox") continue;
|
|
26
|
+
setIce({ data, loaded: true });
|
|
27
|
+
} while (again);
|
|
28
|
+
loading = false;
|
|
29
|
+
}
|
|
30
|
+
// Mounted while the Icebox shows.
|
|
31
|
+
export function useIceData() {
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
const tick = () => void refreshIce();
|
|
34
|
+
tick();
|
|
35
|
+
const offs = [onState(tick), onServer((s) => s.changed, tick), useShown.subscribe((s, p) => s.shown !== p.shown && tick())];
|
|
36
|
+
return () => {
|
|
37
|
+
offs.forEach((f) => f());
|
|
38
|
+
sequence++; // an answer still on its way is dropped
|
|
39
|
+
};
|
|
40
|
+
}, []);
|
|
41
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
// The phone row's gestures: drag mostly sideways past 35 % of the row's width to decide (right makes a task, left
|
|
2
|
+
// dismisses), hold 500 ms to snooze. The page keeps scrolling: a drag counts only once it is mostly sideways
|
|
3
|
+
// (touch-action: pan-y hands every vertical move to the browser, which cancels the pointer). This is a thin
|
|
4
|
+
// imperative wrapper: it moves the foreground by style and tells the row what was decided.
|
|
5
|
+
import { useRef, type PointerEvent } from "react";
|
|
6
|
+
import { SWIPE_AT } from "./icebox.ts";
|
|
7
|
+
|
|
8
|
+
export function useRowSwipe({
|
|
9
|
+
onDecide,
|
|
10
|
+
onHold,
|
|
11
|
+
enabled,
|
|
12
|
+
}: {
|
|
13
|
+
onDecide: (op: "promote" | "dismiss") => Promise<boolean | void> | void; // false: it failed, the row comes back
|
|
14
|
+
onHold: () => void;
|
|
15
|
+
enabled: boolean;
|
|
16
|
+
}) {
|
|
17
|
+
const row = useRef<HTMLDivElement>(null),
|
|
18
|
+
fg = useRef<HTMLDivElement>(null);
|
|
19
|
+
// A tap after a drag or a hold must not also open the row. A hold redraws the page under the finger, so the click
|
|
20
|
+
// that follows its release lands on the new menu: it is eaten on the whole document until just after that release.
|
|
21
|
+
const eat = (hold: boolean) => {
|
|
22
|
+
const k = (c: Event) => {
|
|
23
|
+
c.stopPropagation();
|
|
24
|
+
c.preventDefault();
|
|
25
|
+
};
|
|
26
|
+
document.addEventListener("click", k, { capture: true, once: true });
|
|
27
|
+
let gone = false;
|
|
28
|
+
const off = () => {
|
|
29
|
+
if (gone) return;
|
|
30
|
+
gone = true;
|
|
31
|
+
document.removeEventListener("pointerup", off, { capture: true });
|
|
32
|
+
document.removeEventListener("pointercancel", off, { capture: true });
|
|
33
|
+
setTimeout(() => document.removeEventListener("click", k, { capture: true }), 60);
|
|
34
|
+
};
|
|
35
|
+
if (hold) {
|
|
36
|
+
// Released, cancelled by the browser, or left far too long: the blocker goes either way.
|
|
37
|
+
document.addEventListener("pointerup", off, { capture: true });
|
|
38
|
+
document.addEventListener("pointercancel", off, { capture: true });
|
|
39
|
+
setTimeout(off, 5000);
|
|
40
|
+
} else off();
|
|
41
|
+
};
|
|
42
|
+
const onPointerDown = (e: PointerEvent<HTMLDivElement>) => {
|
|
43
|
+
const r = row.current,
|
|
44
|
+
f = fg.current;
|
|
45
|
+
if (
|
|
46
|
+
!enabled ||
|
|
47
|
+
!r ||
|
|
48
|
+
!f ||
|
|
49
|
+
e.button ||
|
|
50
|
+
r.dataset.gone ||
|
|
51
|
+
(e.target as Element).closest("a,input,button,summary,[role=menuitem]")
|
|
52
|
+
)
|
|
53
|
+
return;
|
|
54
|
+
const x0 = e.clientX,
|
|
55
|
+
y0 = e.clientY;
|
|
56
|
+
let dx = 0,
|
|
57
|
+
mode = "";
|
|
58
|
+
const hold = setTimeout(() => {
|
|
59
|
+
if (mode) return;
|
|
60
|
+
mode = "hold";
|
|
61
|
+
eat(true);
|
|
62
|
+
navigator.vibrate?.(10);
|
|
63
|
+
onHold();
|
|
64
|
+
}, 500);
|
|
65
|
+
const home = () => {
|
|
66
|
+
f.style.transform = "";
|
|
67
|
+
f.style.opacity = "";
|
|
68
|
+
r.style.removeProperty("--p");
|
|
69
|
+
delete r.dataset.dir;
|
|
70
|
+
delete r.dataset.gone;
|
|
71
|
+
};
|
|
72
|
+
const end = (cancel: boolean) => {
|
|
73
|
+
clearTimeout(hold);
|
|
74
|
+
f.onpointermove = f.onpointerup = f.onpointercancel = null;
|
|
75
|
+
if (mode !== "drag") return;
|
|
76
|
+
delete r.dataset.drag;
|
|
77
|
+
eat(false);
|
|
78
|
+
if (!cancel && Math.abs(dx) > r.offsetWidth * SWIPE_AT) {
|
|
79
|
+
const op = dx > 0 ? "promote" : "dismiss";
|
|
80
|
+
r.dataset.gone = "1";
|
|
81
|
+
f.style.transform = `translateX(${(dx > 0 ? 1 : -1) * r.offsetWidth}px)`;
|
|
82
|
+
f.style.opacity = "0";
|
|
83
|
+
void Promise.resolve(onDecide(op)).then((ok) => ok === false && home());
|
|
84
|
+
} else home();
|
|
85
|
+
};
|
|
86
|
+
f.onpointermove = (m) => {
|
|
87
|
+
const mx = m.clientX - x0,
|
|
88
|
+
my = m.clientY - y0;
|
|
89
|
+
if (!mode) {
|
|
90
|
+
if (Math.hypot(mx, my) > 8) clearTimeout(hold);
|
|
91
|
+
if (Math.abs(mx) > 10 && Math.abs(mx) > Math.abs(my)) {
|
|
92
|
+
mode = "drag";
|
|
93
|
+
f.setPointerCapture(m.pointerId);
|
|
94
|
+
r.dataset.drag = "1";
|
|
95
|
+
} else if (Math.abs(my) > 10) mode = "scroll";
|
|
96
|
+
}
|
|
97
|
+
if (mode !== "drag") return;
|
|
98
|
+
dx = mx;
|
|
99
|
+
f.style.transform = `translateX(${dx}px)`;
|
|
100
|
+
r.dataset.dir = dx > 0 ? "pro" : "dis";
|
|
101
|
+
r.style.setProperty("--p", String(Math.min(1, Math.abs(dx) / (r.offsetWidth * SWIPE_AT))));
|
|
102
|
+
};
|
|
103
|
+
f.onpointerup = () => end(false);
|
|
104
|
+
f.onpointercancel = () => end(true);
|
|
105
|
+
};
|
|
106
|
+
return { row, fg, onPointerDown };
|
|
107
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./markdown.ts";
|