kaizen-agent 1.86.0 → 1.87.0
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 +44 -14
- package/cli/tasks.ts +1 -1
- 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 +182 -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 +103 -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 +132 -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 +383 -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,287 @@
|
|
|
1
|
+
// The live preview: markdown hidden and typeset on every line the cursor is not on (decorations from the syntax tree, plus
|
|
2
|
+
// wikilinks and tags, which are not markdown), the highlight style, and what a click on the typeset parts does.
|
|
3
|
+
import { EditorView, Decoration, ViewPlugin, type DecorationSet, type ViewUpdate } from "@codemirror/view";
|
|
4
|
+
import { StateEffect, type Range } from "@codemirror/state";
|
|
5
|
+
import { syntaxTree, HighlightStyle } from "@codemirror/language";
|
|
6
|
+
import { tags as t } from "@lezer/highlight";
|
|
7
|
+
import { wikilinks, tags, resolve, safeUrl, boardLink, resolveRun, anchorWords, type BoardLink } from "./text.ts";
|
|
8
|
+
import { Bullet, BoardChip, Check, Img, Rule } from "./engine-widgets.ts";
|
|
9
|
+
import type { Board, EditorHost } from "./engine-types.ts";
|
|
10
|
+
|
|
11
|
+
// A link to the board: where it goes, what the chip says, and whether it is there.
|
|
12
|
+
export function boardTarget(l: BoardLink, board: Board, dir: string) {
|
|
13
|
+
const q = (o: Record<string, string>) => "/?" + new URLSearchParams({ all: "1", dir, ...o }).toString();
|
|
14
|
+
if (l.kind === "idea") {
|
|
15
|
+
const t = l.text.toLowerCase();
|
|
16
|
+
const task =
|
|
17
|
+
board.ideas.find((i) => i.text.toLowerCase() === t) ??
|
|
18
|
+
board.ideas.find((i) => i.text.toLowerCase().startsWith(t));
|
|
19
|
+
return {
|
|
20
|
+
name: task?.text ?? l.text,
|
|
21
|
+
sub: "idea",
|
|
22
|
+
status: task?.status ?? "",
|
|
23
|
+
href: task ? q({ idea: task.text }) : null,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
const id = resolveRun(
|
|
27
|
+
l.id,
|
|
28
|
+
board.runs.map((r) => r.id),
|
|
29
|
+
),
|
|
30
|
+
run = board.runs.find((r) => r.id === id);
|
|
31
|
+
const item = l.item && run && (l.item.type === "finding" ? run.findings : run.backlog).some((x) => x.n === l.item!.n);
|
|
32
|
+
const ok = !!run && (!l.item || item);
|
|
33
|
+
return {
|
|
34
|
+
name: run?.short ?? l.id,
|
|
35
|
+
sub: anchorWords(l),
|
|
36
|
+
status: run?.status ?? "",
|
|
37
|
+
href: ok
|
|
38
|
+
? q({ run: run!.id, ...(l.tab ? { tab: l.tab } : {}), ...(l.item ? { item: `${l.item.type}-${l.item.n}` } : {}) })
|
|
39
|
+
: null,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
// Leave for the board only once the note is on disk.
|
|
43
|
+
|
|
44
|
+
const hide = Decoration.replace({});
|
|
45
|
+
export const refresh = StateEffect.define<null>(); // the list of notes changed: redraw missing links
|
|
46
|
+
|
|
47
|
+
function build(view: EditorView, host: EditorHost): DecorationSet {
|
|
48
|
+
const { state } = view,
|
|
49
|
+
doc = state.doc,
|
|
50
|
+
out: Range<Decoration>[] = [];
|
|
51
|
+
const live = new Set<number>();
|
|
52
|
+
// Only a focused editor has a cursor line: a note just opened reads fully typeset.
|
|
53
|
+
if (view.hasFocus)
|
|
54
|
+
for (const r of state.selection.ranges)
|
|
55
|
+
for (let l = doc.lineAt(r.from).number; l <= doc.lineAt(r.to).number; l++) live.add(l);
|
|
56
|
+
const on = (pos: number) => live.has(doc.lineAt(pos).number);
|
|
57
|
+
// A plugin may not replace a line break: anything that would is left as written.
|
|
58
|
+
const put = (d: Decoration, from: number, to: number) => {
|
|
59
|
+
if (doc.lineAt(from).number === doc.lineAt(to).number) out.push(d.range(from, to));
|
|
60
|
+
};
|
|
61
|
+
const lines = (from: number, to: number, cls: string) => {
|
|
62
|
+
for (let l = doc.lineAt(from).number; l <= doc.lineAt(to).number; l++)
|
|
63
|
+
out.push(Decoration.line({ class: cls }).range(doc.line(l).from));
|
|
64
|
+
};
|
|
65
|
+
for (const { from, to } of view.visibleRanges) {
|
|
66
|
+
syntaxTree(state).iterate({
|
|
67
|
+
from,
|
|
68
|
+
to,
|
|
69
|
+
enter(n) {
|
|
70
|
+
const name = n.name;
|
|
71
|
+
const h = /^ATXHeading(\d)$/.exec(name);
|
|
72
|
+
if (h) {
|
|
73
|
+
lines(n.from, n.from, `cm-h cm-h${Math.min(+h[1]!, 4)}`);
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
if (name === "HeaderMark" && n.node.parent?.name.startsWith("ATX")) {
|
|
77
|
+
if (!on(n.from))
|
|
78
|
+
put(
|
|
79
|
+
hide,
|
|
80
|
+
n.from,
|
|
81
|
+
Math.min(n.to + (doc.sliceString(n.to, n.to + 1) === " " ? 1 : 0), doc.lineAt(n.from).to),
|
|
82
|
+
);
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
if (
|
|
86
|
+
name === "EmphasisMark" ||
|
|
87
|
+
name === "StrikethroughMark" ||
|
|
88
|
+
(name === "CodeMark" && n.node.parent?.name === "InlineCode")
|
|
89
|
+
) {
|
|
90
|
+
if (!on(n.from)) put(hide, n.from, n.to);
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
if (name === "Blockquote") {
|
|
94
|
+
lines(n.from, n.to, "cm-quote");
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
if (name === "QuoteMark") {
|
|
98
|
+
if (!on(n.from))
|
|
99
|
+
put(
|
|
100
|
+
hide,
|
|
101
|
+
n.from,
|
|
102
|
+
Math.min(n.to + (doc.sliceString(n.to, n.to + 1) === " " ? 1 : 0), doc.lineAt(n.from).to),
|
|
103
|
+
);
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
if (name === "FencedCode") {
|
|
107
|
+
lines(n.from, n.to, "cm-fence");
|
|
108
|
+
out.push(
|
|
109
|
+
Decoration.line({ class: "cm-fence-a" }).range(doc.lineAt(n.from).from),
|
|
110
|
+
Decoration.line({ class: "cm-fence-z" }).range(doc.lineAt(n.to).from),
|
|
111
|
+
);
|
|
112
|
+
return false;
|
|
113
|
+
}
|
|
114
|
+
if (name === "HorizontalRule") {
|
|
115
|
+
if (!on(n.from)) put(Decoration.replace({ widget: new Rule() }), n.from, n.to);
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
if (name === "ListMark" && n.node.parent?.parent?.name === "BulletList") {
|
|
119
|
+
if (on(n.from)) return;
|
|
120
|
+
const task = n.node.nextSibling?.name === "Task";
|
|
121
|
+
put(
|
|
122
|
+
task ? hide : Decoration.replace({ widget: new Bullet() }),
|
|
123
|
+
n.from,
|
|
124
|
+
task ? Math.min(n.to + 1, doc.lineAt(n.from).to) : n.to,
|
|
125
|
+
);
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
if (name === "TaskMarker") {
|
|
129
|
+
if (!on(n.from))
|
|
130
|
+
put(
|
|
131
|
+
Decoration.replace({ widget: new Check(/x/i.test(doc.sliceString(n.from, n.to)), n.from) }),
|
|
132
|
+
n.from,
|
|
133
|
+
n.to,
|
|
134
|
+
);
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
if (name === "Image") {
|
|
138
|
+
const url = n.node.getChild("URL"),
|
|
139
|
+
marks = n.node.getChildren("LinkMark");
|
|
140
|
+
if (on(n.from) || !url || marks.length < 2) return false;
|
|
141
|
+
const src = safeUrl(doc.sliceString(url.from, url.to));
|
|
142
|
+
if (src && /^https?:/i.test(src))
|
|
143
|
+
put(
|
|
144
|
+
Decoration.replace({ widget: new Img(src, doc.sliceString(marks[0]!.to, marks[1]!.from)) }),
|
|
145
|
+
n.from,
|
|
146
|
+
n.to,
|
|
147
|
+
);
|
|
148
|
+
return false;
|
|
149
|
+
}
|
|
150
|
+
if (name === "Link") {
|
|
151
|
+
const url = n.node.getChild("URL"),
|
|
152
|
+
marks = n.node.getChildren("LinkMark");
|
|
153
|
+
// Only the inline form `[text](url)`; a reference link stays as written.
|
|
154
|
+
if (!url || marks.length < 4) return;
|
|
155
|
+
const href = safeUrl(doc.sliceString(url.from, url.to));
|
|
156
|
+
const text = { from: marks[0]!.to, to: marks[1]!.from };
|
|
157
|
+
// A link to somewhere safeUrl refuses stays as written, so what it points at is visible.
|
|
158
|
+
if (on(n.from) || !href) {
|
|
159
|
+
out.push(Decoration.mark({ class: "cm-link-src" }).range(n.from, n.to));
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
if (text.to > text.from)
|
|
163
|
+
out.push(
|
|
164
|
+
Decoration.mark({ class: "cm-link", attributes: { "data-href": href } }).range(text.from, text.to),
|
|
165
|
+
);
|
|
166
|
+
put(hide, marks[0]!.from, marks[0]!.to);
|
|
167
|
+
put(hide, marks[1]!.from, n.to);
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
if (name === "URL" && n.node.parent?.name !== "Link" && n.node.parent?.name !== "Image") {
|
|
171
|
+
const href = safeUrl(doc.sliceString(n.from, n.to));
|
|
172
|
+
out.push(
|
|
173
|
+
Decoration.mark({ class: "cm-link", attributes: href && !on(n.from) ? { "data-href": href } : {} }).range(
|
|
174
|
+
n.from,
|
|
175
|
+
n.to,
|
|
176
|
+
),
|
|
177
|
+
);
|
|
178
|
+
}
|
|
179
|
+
},
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
// Wikilinks and tags are not markdown: found by notes-lib over the text.
|
|
183
|
+
// ponytail: the whole note is scanned on each redraw; limit to visible ranges if notes reach megabytes.
|
|
184
|
+
const text = doc.toString(),
|
|
185
|
+
names = host.names();
|
|
186
|
+
for (const w of wikilinks(text)) {
|
|
187
|
+
const bl = boardLink(w);
|
|
188
|
+
if (bl) {
|
|
189
|
+
if (on(w.from)) {
|
|
190
|
+
out.push(Decoration.mark({ class: "cm-wiki" }).range(w.from, w.to));
|
|
191
|
+
continue;
|
|
192
|
+
}
|
|
193
|
+
const t = boardTarget(bl, host.board(), host.dir());
|
|
194
|
+
put(
|
|
195
|
+
Decoration.replace({
|
|
196
|
+
widget: new BoardChip(w.label !== w.target ? w.label : t.name, t.sub, t.status, t.href, host),
|
|
197
|
+
}),
|
|
198
|
+
w.from,
|
|
199
|
+
w.to,
|
|
200
|
+
);
|
|
201
|
+
continue;
|
|
202
|
+
}
|
|
203
|
+
const target = resolve(w.name, names);
|
|
204
|
+
const cls = "cm-wiki" + (target ? "" : " cm-wiki-missing");
|
|
205
|
+
if (on(w.from)) {
|
|
206
|
+
out.push(Decoration.mark({ class: cls }).range(w.from, w.to));
|
|
207
|
+
continue;
|
|
208
|
+
}
|
|
209
|
+
const labelAt = text.lastIndexOf(w.label, w.to - 2);
|
|
210
|
+
const lf = labelAt > w.from ? labelAt : w.from + 2,
|
|
211
|
+
lt = lf + w.label.length;
|
|
212
|
+
put(hide, w.from, lf);
|
|
213
|
+
out.push(Decoration.mark({ class: cls, attributes: { "data-note": target ?? w.name } }).range(lf, lt));
|
|
214
|
+
put(hide, lt, w.to);
|
|
215
|
+
}
|
|
216
|
+
for (const g of tags(text))
|
|
217
|
+
out.push(
|
|
218
|
+
Decoration.mark({ class: "cm-tag", attributes: on(g.from) ? {} : { "data-tag": g.tag } }).range(g.from, g.to),
|
|
219
|
+
);
|
|
220
|
+
return Decoration.set(out, true);
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
export const preview = (host: EditorHost) =>
|
|
224
|
+
ViewPlugin.fromClass(
|
|
225
|
+
class {
|
|
226
|
+
decorations: DecorationSet;
|
|
227
|
+
constructor(view: EditorView) {
|
|
228
|
+
this.decorations = build(view, host);
|
|
229
|
+
}
|
|
230
|
+
update(u: ViewUpdate) {
|
|
231
|
+
if (
|
|
232
|
+
u.docChanged ||
|
|
233
|
+
u.viewportChanged ||
|
|
234
|
+
u.selectionSet ||
|
|
235
|
+
u.focusChanged ||
|
|
236
|
+
syntaxTree(u.startState) !== syntaxTree(u.state) ||
|
|
237
|
+
u.transactions.some((tr) => tr.effects.some((e) => e.is(refresh)))
|
|
238
|
+
)
|
|
239
|
+
this.decorations = build(u.view, host);
|
|
240
|
+
}
|
|
241
|
+
},
|
|
242
|
+
{ decorations: (v) => v.decorations },
|
|
243
|
+
);
|
|
244
|
+
|
|
245
|
+
export const look = HighlightStyle.define([
|
|
246
|
+
{ tag: t.emphasis, fontStyle: "italic" },
|
|
247
|
+
{ tag: t.strong, fontWeight: "600" },
|
|
248
|
+
{ tag: t.strikethrough, textDecoration: "line-through" },
|
|
249
|
+
{
|
|
250
|
+
tag: t.monospace,
|
|
251
|
+
fontFamily: "var(--mono)",
|
|
252
|
+
fontSize: "0.86em",
|
|
253
|
+
background: "var(--bg)",
|
|
254
|
+
borderRadius: "var(--r-s)",
|
|
255
|
+
padding: "1px 4px",
|
|
256
|
+
},
|
|
257
|
+
{ tag: [t.processingInstruction, t.meta, t.url, t.labelName, t.contentSeparator], color: "var(--dim)" },
|
|
258
|
+
{ tag: t.link, color: "var(--accent)" },
|
|
259
|
+
{ tag: t.quote, color: "var(--dim)" },
|
|
260
|
+
]);
|
|
261
|
+
|
|
262
|
+
// Clicks on what the preview drew: a link opens, a wikilink opens its note, a tag filters.
|
|
263
|
+
export const clicks = (host: EditorHost) =>
|
|
264
|
+
EditorView.domEventHandlers({
|
|
265
|
+
mousedown(e) {
|
|
266
|
+
const el = (e.target as HTMLElement).closest?.("[data-href],[data-note],[data-tag]") as HTMLElement | null;
|
|
267
|
+
if (!el || e.button !== 0) return false;
|
|
268
|
+
e.preventDefault();
|
|
269
|
+
const href = el.dataset.href;
|
|
270
|
+
// A relative link is a note (`[x](Other%20note.md)`), as in Obsidian; the rest open in a tab.
|
|
271
|
+
if (href && !/^[a-z][a-z0-9+.-]*:/i.test(href)) {
|
|
272
|
+
let name = href;
|
|
273
|
+
try {
|
|
274
|
+
name = decodeURIComponent(href);
|
|
275
|
+
} catch {
|
|
276
|
+
/* as written */
|
|
277
|
+
}
|
|
278
|
+
const hit = resolve(name.split("#")[0]!, host.names());
|
|
279
|
+
hit ? host.openNote(hit) : host.toast(`No note named ${name}`);
|
|
280
|
+
} else if (href) window.open(href, "_blank", "noopener");
|
|
281
|
+
else if (el.dataset.note) host.openOrCreate(el.dataset.note);
|
|
282
|
+
else if (el.dataset.tag) {
|
|
283
|
+
host.search("#" + el.dataset.tag);
|
|
284
|
+
}
|
|
285
|
+
return true;
|
|
286
|
+
},
|
|
287
|
+
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// What the editor engine asks of the page, and the shapes it is handed. The engine never reaches for the page's state:
|
|
2
|
+
// every read goes through these functions, so one editor can be made per note and thrown away with it.
|
|
3
|
+
import type { WidgetHost } from "./engine-widgets.ts";
|
|
4
|
+
|
|
5
|
+
export type Board = {
|
|
6
|
+
runs: {
|
|
7
|
+
id: string;
|
|
8
|
+
short: string;
|
|
9
|
+
title: string;
|
|
10
|
+
status: string;
|
|
11
|
+
findings: { n: number; text: string; done: boolean }[];
|
|
12
|
+
backlog: { n: number; status: string; text: string }[];
|
|
13
|
+
}[];
|
|
14
|
+
ideas: { text: string; status: string }[];
|
|
15
|
+
};
|
|
16
|
+
export type EditorHost = WidgetHost & {
|
|
17
|
+
names(): string[]; // every note's name, for links and completion
|
|
18
|
+
board(): Board; // what [[run:...]] and [[idea:...]] can name, from /links
|
|
19
|
+
dir(): string; // the state dir whose notes are shown
|
|
20
|
+
edited(): void; // the person typed (never a load)
|
|
21
|
+
save(): void; // Mod-s
|
|
22
|
+
openNote(name: string): void;
|
|
23
|
+
openOrCreate(name: string): void;
|
|
24
|
+
search(query: string): void; // a #tag in the text was clicked
|
|
25
|
+
};
|
|
26
|
+
export const emptyBoard = (): Board => ({ runs: [], ideas: [] });
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
// The live preview's widgets: what replaces markdown the cursor is not on (a checkbox, a bullet, a rule, an image, a table,
|
|
2
|
+
// a chip for a link to the board), and the table decorations. Cells and chips are text nodes: nothing in a note becomes markup.
|
|
3
|
+
import { EditorView, Decoration, WidgetType, type DecorationSet } from "@codemirror/view";
|
|
4
|
+
import { EditorState, StateEffect, StateField, type Range } from "@codemirror/state";
|
|
5
|
+
import { syntaxTree } from "@codemirror/language";
|
|
6
|
+
import { parseTable } from "./text.ts";
|
|
7
|
+
|
|
8
|
+
// What the page lets a widget do: leave for the board (the note is written first) and say something.
|
|
9
|
+
export type WidgetHost = { go(href: string): void; toast(msg: string): void };
|
|
10
|
+
|
|
11
|
+
export class Check extends WidgetType {
|
|
12
|
+
constructor(
|
|
13
|
+
readonly on: boolean,
|
|
14
|
+
readonly at: number,
|
|
15
|
+
) {
|
|
16
|
+
super();
|
|
17
|
+
}
|
|
18
|
+
eq(o: Check) {
|
|
19
|
+
return o.on === this.on && o.at === this.at;
|
|
20
|
+
}
|
|
21
|
+
toDOM(view: EditorView) {
|
|
22
|
+
const b = document.createElement("input");
|
|
23
|
+
b.type = "checkbox";
|
|
24
|
+
b.checked = this.on;
|
|
25
|
+
b.className = "cm-task";
|
|
26
|
+
b.setAttribute("aria-label", this.on ? "done" : "to do");
|
|
27
|
+
b.addEventListener("mousedown", (e) => {
|
|
28
|
+
e.preventDefault();
|
|
29
|
+
view.dispatch({ changes: { from: this.at, to: this.at + 3, insert: this.on ? "[ ]" : "[x]" } });
|
|
30
|
+
});
|
|
31
|
+
return b;
|
|
32
|
+
}
|
|
33
|
+
ignoreEvent() {
|
|
34
|
+
return true;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
export class Bullet extends WidgetType {
|
|
38
|
+
eq() {
|
|
39
|
+
return true;
|
|
40
|
+
}
|
|
41
|
+
toDOM() {
|
|
42
|
+
const s = document.createElement("span");
|
|
43
|
+
s.className = "cm-bullet";
|
|
44
|
+
s.textContent = "•";
|
|
45
|
+
return s;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
export class Rule extends WidgetType {
|
|
49
|
+
eq() {
|
|
50
|
+
return true;
|
|
51
|
+
}
|
|
52
|
+
toDOM() {
|
|
53
|
+
const s = document.createElement("span");
|
|
54
|
+
s.className = "cm-rule";
|
|
55
|
+
return s;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
export class Img extends WidgetType {
|
|
59
|
+
constructor(
|
|
60
|
+
readonly src: string,
|
|
61
|
+
readonly alt: string,
|
|
62
|
+
) {
|
|
63
|
+
super();
|
|
64
|
+
}
|
|
65
|
+
eq(o: Img) {
|
|
66
|
+
return o.src === this.src && o.alt === this.alt;
|
|
67
|
+
}
|
|
68
|
+
toDOM() {
|
|
69
|
+
const i = document.createElement("img");
|
|
70
|
+
i.src = this.src;
|
|
71
|
+
i.alt = this.alt;
|
|
72
|
+
i.className = "cm-img";
|
|
73
|
+
return i;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// A table the cursor is not in is drawn as one; clicking it puts the cursor in its
|
|
78
|
+
// source. Cells are text nodes: nothing in a note becomes markup.
|
|
79
|
+
export class TableView extends WidgetType {
|
|
80
|
+
constructor(
|
|
81
|
+
readonly src: string,
|
|
82
|
+
readonly at: number,
|
|
83
|
+
) {
|
|
84
|
+
super();
|
|
85
|
+
}
|
|
86
|
+
eq(o: TableView) {
|
|
87
|
+
return o.src === this.src && o.at === this.at;
|
|
88
|
+
}
|
|
89
|
+
toDOM(view: EditorView) {
|
|
90
|
+
const t = parseTable(this.src),
|
|
91
|
+
wrap = document.createElement("div"),
|
|
92
|
+
table = document.createElement("table");
|
|
93
|
+
wrap.className = "cm-table";
|
|
94
|
+
const row = (cells: string[], tag: "th" | "td") => {
|
|
95
|
+
const tr = document.createElement("tr");
|
|
96
|
+
cells.forEach((c, i) => {
|
|
97
|
+
const el = document.createElement(tag);
|
|
98
|
+
el.textContent = c;
|
|
99
|
+
if (t.align[i]) el.style.textAlign = t.align[i]!;
|
|
100
|
+
tr.append(el);
|
|
101
|
+
});
|
|
102
|
+
return tr;
|
|
103
|
+
};
|
|
104
|
+
const head = document.createElement("thead"),
|
|
105
|
+
body = document.createElement("tbody");
|
|
106
|
+
head.append(row(t.head, "th"));
|
|
107
|
+
t.rows.forEach((r) => body.append(row(r, "td")));
|
|
108
|
+
table.append(head, body);
|
|
109
|
+
wrap.append(table);
|
|
110
|
+
wrap.addEventListener("mousedown", (e) => {
|
|
111
|
+
e.preventDefault();
|
|
112
|
+
view.dispatch({ selection: { anchor: this.at } });
|
|
113
|
+
view.focus();
|
|
114
|
+
});
|
|
115
|
+
return wrap;
|
|
116
|
+
}
|
|
117
|
+
ignoreEvent() {
|
|
118
|
+
return true;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
// Whether the editor has focus, as state: an unfocused editor shows every table drawn.
|
|
122
|
+
export const focusSet = StateEffect.define<boolean>();
|
|
123
|
+
export const focused = StateField.define<boolean>({
|
|
124
|
+
create: () => false,
|
|
125
|
+
update: (v, tr) => tr.effects.reduce((f, e) => (e.is(focusSet) ? e.value : f), v),
|
|
126
|
+
});
|
|
127
|
+
// Block widgets may span lines, which a view plugin may not do: tables live in a field.
|
|
128
|
+
function tables(state: EditorState) {
|
|
129
|
+
const out: Range<Decoration>[] = [],
|
|
130
|
+
sel = state.selection.main,
|
|
131
|
+
live = state.field(focused, false);
|
|
132
|
+
syntaxTree(state).iterate({
|
|
133
|
+
enter(n) {
|
|
134
|
+
if (n.name !== "Table") return;
|
|
135
|
+
const from = state.doc.lineAt(n.from).from,
|
|
136
|
+
to = state.doc.lineAt(n.to).to;
|
|
137
|
+
if (live && sel.to >= from && sel.from <= to) return false;
|
|
138
|
+
out.push(
|
|
139
|
+
Decoration.replace({ widget: new TableView(state.sliceDoc(from, to), from), block: true }).range(from, to),
|
|
140
|
+
);
|
|
141
|
+
return false;
|
|
142
|
+
},
|
|
143
|
+
});
|
|
144
|
+
return Decoration.set(out);
|
|
145
|
+
}
|
|
146
|
+
export const tableField = StateField.define<DecorationSet>({
|
|
147
|
+
create: tables,
|
|
148
|
+
update: (v, tr) =>
|
|
149
|
+
tr.docChanged ||
|
|
150
|
+
tr.selection ||
|
|
151
|
+
tr.effects.some((e) => e.is(focusSet)) ||
|
|
152
|
+
syntaxTree(tr.startState) !== syntaxTree(tr.state)
|
|
153
|
+
? tables(tr.state)
|
|
154
|
+
: v,
|
|
155
|
+
provide: (f) => EditorView.decorations.from(f),
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
// A link to the board is a chip: the card's state icon, its name, and what the link points at inside it.
|
|
159
|
+
export const ICON: Record<string, string> = {
|
|
160
|
+
idea: "idea",
|
|
161
|
+
starting: "idea",
|
|
162
|
+
running: "run",
|
|
163
|
+
stalled: "stall",
|
|
164
|
+
waiting: "wait",
|
|
165
|
+
done: "done",
|
|
166
|
+
abandoned: "aband",
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
// An <svg><use href="#id"/></svg> from the page's sprite sheet.
|
|
170
|
+
function sprite(id: string) {
|
|
171
|
+
const ns = "http://www.w3.org/2000/svg",
|
|
172
|
+
s = document.createElementNS(ns, "svg"),
|
|
173
|
+
u = document.createElementNS(ns, "use");
|
|
174
|
+
u.setAttribute("href", "#" + id);
|
|
175
|
+
s.append(u);
|
|
176
|
+
return s;
|
|
177
|
+
}
|
|
178
|
+
export class BoardChip extends WidgetType {
|
|
179
|
+
constructor(
|
|
180
|
+
readonly name: string,
|
|
181
|
+
readonly sub: string,
|
|
182
|
+
readonly status: string,
|
|
183
|
+
readonly href: string | null,
|
|
184
|
+
readonly host: WidgetHost,
|
|
185
|
+
) {
|
|
186
|
+
super();
|
|
187
|
+
}
|
|
188
|
+
eq(o: BoardChip) {
|
|
189
|
+
return o.name === this.name && o.sub === this.sub && o.status === this.status && o.href === this.href;
|
|
190
|
+
}
|
|
191
|
+
toDOM() {
|
|
192
|
+
const c = document.createElement("span");
|
|
193
|
+
c.className = "cm-board" + (this.href ? "" : " cm-board-missing");
|
|
194
|
+
c.title = this.href ? "Open on the board" : "Not on the board";
|
|
195
|
+
if (this.status) {
|
|
196
|
+
const ic = document.createElement("span");
|
|
197
|
+
ic.className = "st d-" + (ICON[this.status] ?? "idea");
|
|
198
|
+
ic.append(sprite("s-" + (ICON[this.status] ?? "idea")));
|
|
199
|
+
c.append(ic);
|
|
200
|
+
}
|
|
201
|
+
c.append(this.name);
|
|
202
|
+
if (this.sub) {
|
|
203
|
+
const s = document.createElement("span");
|
|
204
|
+
s.className = "sub";
|
|
205
|
+
s.textContent = "› " + this.sub;
|
|
206
|
+
c.append(s);
|
|
207
|
+
}
|
|
208
|
+
c.addEventListener("mousedown", (e) => {
|
|
209
|
+
e.preventDefault();
|
|
210
|
+
if (this.href) this.host.go(this.href);
|
|
211
|
+
else this.host.toast("That is not on the board");
|
|
212
|
+
});
|
|
213
|
+
return c;
|
|
214
|
+
}
|
|
215
|
+
ignoreEvent() {
|
|
216
|
+
return true;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
// The note editor: CodeMirror 6 with the live preview, the `/` and `[[` menus and the markdown keys, made once per open
|
|
2
|
+
// note (the page keys it by name) and thrown away with it, so its cursor, scroll and undo history live exactly as long as the
|
|
3
|
+
// note stays open. The page reaches it only through the handle `createEditor` returns and the `EditorHost` it hands in.
|
|
4
|
+
import { EditorView, keymap } from "@codemirror/view";
|
|
5
|
+
import { EditorState } from "@codemirror/state";
|
|
6
|
+
import { defaultKeymap, history, historyKeymap, indentWithTab } from "@codemirror/commands";
|
|
7
|
+
import { syntaxHighlighting } from "@codemirror/language";
|
|
8
|
+
import { markdown, markdownLanguage, markdownKeymap } from "@codemirror/lang-markdown";
|
|
9
|
+
import { autocompletion } from "@codemirror/autocomplete";
|
|
10
|
+
import { focused, focusSet, tableField } from "./engine-widgets.ts";
|
|
11
|
+
import { clicks, look, preview, refresh } from "./engine-preview.ts";
|
|
12
|
+
import { links, slash } from "./engine-complete.ts";
|
|
13
|
+
import type { EditorHost } from "./engine-types.ts";
|
|
14
|
+
|
|
15
|
+
export type EditorHandle = {
|
|
16
|
+
text(): string; // the note as it would be written
|
|
17
|
+
replace(text: string): void; // someone else's version: not the person's edit, cursor kept
|
|
18
|
+
refresh(): void; // the list of notes or the board's items changed: redraw links
|
|
19
|
+
focus(): void;
|
|
20
|
+
destroy(): void;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const exts = (host: EditorHost, crlf: boolean, typed: () => boolean) => [
|
|
24
|
+
autocompletion({ override: [slash, links(host)], icons: false }),
|
|
25
|
+
history(),
|
|
26
|
+
keymap.of([
|
|
27
|
+
...markdownKeymap,
|
|
28
|
+
...defaultKeymap,
|
|
29
|
+
...historyKeymap,
|
|
30
|
+
indentWithTab,
|
|
31
|
+
{
|
|
32
|
+
key: "Mod-s",
|
|
33
|
+
run: () => {
|
|
34
|
+
host.save();
|
|
35
|
+
return true;
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
]),
|
|
39
|
+
markdown({ base: markdownLanguage }),
|
|
40
|
+
syntaxHighlighting(look),
|
|
41
|
+
EditorView.lineWrapping,
|
|
42
|
+
EditorView.contentAttributes.of({ "aria-label": "Note", spellcheck: "true" }),
|
|
43
|
+
focused,
|
|
44
|
+
EditorView.focusChangeEffect.of((_s, on) => focusSet.of(on)),
|
|
45
|
+
tableField,
|
|
46
|
+
preview(host),
|
|
47
|
+
clicks(host),
|
|
48
|
+
EditorView.updateListener.of((u) => {
|
|
49
|
+
if (u.docChanged && typed()) host.edited();
|
|
50
|
+
}),
|
|
51
|
+
crlf ? EditorState.lineSeparator.of("\r\n") : [],
|
|
52
|
+
];
|
|
53
|
+
|
|
54
|
+
export function createEditor(parent: HTMLElement, text: string, host: EditorHost): EditorHandle {
|
|
55
|
+
let loading = false; // a replace in progress is not the person's edit
|
|
56
|
+
const view = new EditorView({
|
|
57
|
+
parent,
|
|
58
|
+
state: EditorState.create({ doc: text, extensions: exts(host, text.includes("\r\n"), () => !loading) }),
|
|
59
|
+
});
|
|
60
|
+
return {
|
|
61
|
+
text: () => view.state.sliceDoc(),
|
|
62
|
+
replace(next) {
|
|
63
|
+
loading = true;
|
|
64
|
+
view.dispatch({
|
|
65
|
+
changes: { from: 0, to: view.state.doc.length, insert: next },
|
|
66
|
+
selection: { anchor: Math.min(view.state.selection.main.head, next.length) },
|
|
67
|
+
});
|
|
68
|
+
loading = false;
|
|
69
|
+
},
|
|
70
|
+
refresh: () => view.dispatch({ effects: refresh.of(null) }),
|
|
71
|
+
focus: () => view.focus(),
|
|
72
|
+
destroy: () => view.destroy(),
|
|
73
|
+
};
|
|
74
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from "./autosave.ts";
|
|
2
|
+
export * from "./deal.ts";
|
|
3
|
+
export * from "./engine.ts";
|
|
4
|
+
export * from "./engine-types.ts";
|
|
5
|
+
export * from "./text.ts";
|
|
6
|
+
export * from "./vault-actions.ts";
|
|
7
|
+
export * from "./vault-rules.ts";
|
|
8
|
+
export * from "./vault-session.ts";
|
|
9
|
+
export * from "./vault-store.ts";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// The Notebook page carries the React kit in its own bundle (kit.ts, mounted by notebook.ts) and registers it as
|
|
2
|
+
// `window.kzKit` before anything asks. Code shared with the board and Video bundles (workspace.ts, search.ts) reaches the
|
|
3
|
+
// kit's stores through it instead of importing them, so the Video bundle never carries React.
|
|
4
|
+
import type { Kit } from "./kit.ts";
|
|
5
|
+
|
|
6
|
+
declare global {
|
|
7
|
+
interface Window {
|
|
8
|
+
kzKit?: Kit;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
// A page marks itself `<html data-kit>` when it carries the kit and its stylesheet is layered so the kit's classes can win
|
|
12
|
+
// (notes.html). A page without it (Video) keeps the old way: send the person to the board.
|
|
13
|
+
export const kitHere = () => document.documentElement.hasAttribute("data-kit");
|
|
14
|
+
export const kitLive = (): Kit | null => window.kzKit ?? null;
|
|
15
|
+
export const loadKit = (): Promise<Kit> =>
|
|
16
|
+
window.kzKit ? Promise.resolve(window.kzKit) : Promise.reject(new Error("this page has no kit"));
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// What the Notebook page lends the code the board and Video bundles share (workspace.ts, search.ts): its kit stores,
|
|
2
|
+
// registered as `window.kzKit` before anything asks (kit-loader.ts), which hands over what only the page knows through
|
|
3
|
+
// `setHost`. The popups themselves are drawn by the page (pages/notebook/App.tsx). notebook.ts calls `registerKit()` once at
|
|
4
|
+
// start, except in ?embed=1, where there is no side menu to search from or list projects in.
|
|
5
|
+
import { ask, setHost, toast } from "@lib/core";
|
|
6
|
+
import { openAdd, openWsMenu } from "@lib/project";
|
|
7
|
+
import { useSearch } from "@lib/search";
|
|
8
|
+
|
|
9
|
+
const kit = { useSearch, openAdd, openWsMenu, ask, toast, setHost };
|
|
10
|
+
export type Kit = typeof kit;
|
|
11
|
+
|
|
12
|
+
export const registerKit = () => void (window.kzKit ??= kit);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// The notebook's text rules, with no DOM and no CodeMirror: the page uses them for the
|
|
2
|
-
// sidebar and backlinks, the editor for its decorations, and cli/notes.test.ts runs them.
|
|
2
|
+
// sidebar and backlinks, the editor for its decorations, and cli/notes.test.ts runs them (through notebook/notes-lib.ts).
|
|
3
3
|
|
|
4
4
|
// Code is where `[[x]]` and `#x` are literal: fences and inline spans are blanked to
|
|
5
5
|
// spaces of the same length, so offsets found in what is left still point into `text`.
|
|
@@ -107,15 +107,7 @@ export function resolve(name: string, names: string[]): string | null {
|
|
|
107
107
|
return [...names].sort().find((x) => x.toLowerCase().split("/").pop() === n) ?? null;
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
-
|
|
111
|
-
// else (javascript:, data:, vbscript:, file:) is null and the page leaves it as text.
|
|
112
|
-
export function safeUrl(u: string): string | null {
|
|
113
|
-
const s = u.trim();
|
|
114
|
-
if (!s || /[\x00-\x1f]/.test(s)) return null;
|
|
115
|
-
const scheme = /^([a-z][a-z0-9+.-]*):/i.exec(s);
|
|
116
|
-
if (!scheme) return s.startsWith("//") ? null : s;
|
|
117
|
-
return ["http", "https", "mailto"].includes(scheme[1]!.toLowerCase()) ? s : null;
|
|
118
|
-
}
|
|
110
|
+
export { safeUrl } from "@lib/url";
|
|
119
111
|
|
|
120
112
|
// The sidebar's tree: folders first, then notes, each by name.
|
|
121
113
|
export type Tree = { folders: Map<string, Tree>; notes: string[] };
|
|
@@ -169,3 +161,12 @@ export function parseTable(src: string): Table {
|
|
|
169
161
|
});
|
|
170
162
|
return { head, align, rows };
|
|
171
163
|
}
|
|
164
|
+
|
|
165
|
+
// The project the notebook opens: the one its address names (a run's note tab, a board link)
|
|
166
|
+
// even when the picker leaves it out, as it does a project outside the Projects folder;
|
|
167
|
+
// /vault checks it. Then the one open last, the board's, the first listed.
|
|
168
|
+
export function pickProject<P extends { dir: string; label: string }>(want: string | null, kept: string | null, cur: string | null, projects: P[]) {
|
|
169
|
+
if (want && !projects.some((p) => p.dir === want)) projects = [...projects, { dir: want, label: want.replace(/[\\/]\.kaizen$/, "") } as P];
|
|
170
|
+
const dir = [want, kept, cur].find((d) => !!d && projects.some((p) => p.dir === d)) ?? projects[0]?.dir ?? "";
|
|
171
|
+
return { dir, projects };
|
|
172
|
+
}
|