@vibefield/rosetta-room 0.0.0-stage → 0.1.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 +247 -2
- package/dist/HistoryRoom.d.ts +98 -0
- package/dist/HistoryRoom.js +440 -0
- package/dist/TranscriptReader.d.ts +22 -0
- package/dist/TranscriptReader.js +72 -0
- package/dist/components/ColdStart.d.ts +4 -0
- package/dist/components/ColdStart.js +5 -0
- package/dist/components/FilterChips.d.ts +4 -0
- package/dist/components/FilterChips.js +5 -0
- package/dist/components/HostAct.d.ts +9 -0
- package/dist/components/HostAct.js +16 -0
- package/dist/components/HostMenu.d.ts +41 -0
- package/dist/components/HostMenu.js +216 -0
- package/dist/components/IngestStatus.d.ts +4 -0
- package/dist/components/IngestStatus.js +20 -0
- package/dist/components/ListActivityNotice.d.ts +5 -0
- package/dist/components/ListActivityNotice.js +4 -0
- package/dist/components/ListSections.d.ts +20 -0
- package/dist/components/ListSections.js +39 -0
- package/dist/components/RenameHeading.d.ts +9 -0
- package/dist/components/RenameHeading.js +75 -0
- package/dist/components/SearchStrip.d.ts +5 -0
- package/dist/components/SearchStrip.js +8 -0
- package/dist/components/SummaryMetrics.d.ts +13 -0
- package/dist/components/SummaryMetrics.js +9 -0
- package/dist/components/SummaryPanels.d.ts +35 -0
- package/dist/components/SummaryPanels.js +117 -0
- package/dist/components/Transcript.d.ts +46 -0
- package/dist/components/Transcript.js +358 -0
- package/dist/components/charts/ActivityChartDetail.d.ts +13 -0
- package/dist/components/charts/ActivityChartDetail.js +78 -0
- package/dist/components/charts/CalendarHeatmap.d.ts +16 -0
- package/dist/components/charts/CalendarHeatmap.js +55 -0
- package/dist/components/charts/DayActivityChart.d.ts +8 -0
- package/dist/components/charts/DayActivityChart.js +71 -0
- package/dist/components/charts/ModelsChartDetail.d.ts +7 -0
- package/dist/components/charts/ModelsChartDetail.js +19 -0
- package/dist/components/charts/ProjectChartDialog.d.ts +19 -0
- package/dist/components/charts/ProjectChartDialog.js +39 -0
- package/dist/components/charts/Streamgraph.d.ts +16 -0
- package/dist/components/charts/Streamgraph.js +94 -0
- package/dist/components/charts/Treemap.d.ts +26 -0
- package/dist/components/charts/Treemap.js +81 -0
- package/dist/components/charts/index.d.ts +9 -0
- package/dist/components/charts/index.js +4 -0
- package/dist/components/charts/streamgraph-layout.d.ts +23 -0
- package/dist/components/charts/streamgraph-layout.js +114 -0
- package/dist/components/charts/treemap-layout.d.ts +32 -0
- package/dist/components/charts/treemap-layout.js +140 -0
- package/dist/components/charts/types.d.ts +65 -0
- package/dist/components/charts/types.js +8 -0
- package/dist/components/file-viewer/FileViewerBrowsers.d.ts +10 -0
- package/dist/components/file-viewer/FileViewerBrowsers.js +65 -0
- package/dist/components/file-viewer/FileViewerDialog.d.ts +33 -0
- package/dist/components/file-viewer/FileViewerDialog.js +82 -0
- package/dist/components/file-viewer/FileViewerHeader.d.ts +26 -0
- package/dist/components/file-viewer/FileViewerHeader.js +17 -0
- package/dist/components/file-viewer/ImageGalleryDialog.d.ts +14 -0
- package/dist/components/file-viewer/ImageGalleryDialog.js +98 -0
- package/dist/components/file-viewer/diff/index.d.ts +2 -0
- package/dist/components/file-viewer/diff/index.js +2 -0
- package/dist/components/file-viewer/diff/parse.d.ts +2 -0
- package/dist/components/file-viewer/diff/parse.js +164 -0
- package/dist/components/file-viewer/diff/types.d.ts +44 -0
- package/dist/components/file-viewer/diff/types.js +7 -0
- package/dist/components/file-viewer/gallery-source.d.ts +11 -0
- package/dist/components/file-viewer/gallery-source.js +75 -0
- package/dist/components/file-viewer/image-resource.d.ts +19 -0
- package/dist/components/file-viewer/image-resource.js +60 -0
- package/dist/components/file-viewer/index.d.ts +5 -0
- package/dist/components/file-viewer/index.js +8 -0
- package/dist/components/file-viewer/markdown/blocks.d.ts +2 -0
- package/dist/components/file-viewer/markdown/blocks.js +277 -0
- package/dist/components/file-viewer/markdown/index.d.ts +4 -0
- package/dist/components/file-viewer/markdown/index.js +35 -0
- package/dist/components/file-viewer/markdown/inline.d.ts +10 -0
- package/dist/components/file-viewer/markdown/inline.js +178 -0
- package/dist/components/file-viewer/markdown/render.d.ts +9 -0
- package/dist/components/file-viewer/markdown/render.js +78 -0
- package/dist/components/file-viewer/markdown/types.d.ts +57 -0
- package/dist/components/file-viewer/markdown/types.js +11 -0
- package/dist/components/file-viewer/minimap/CodeMinimap.d.ts +10 -0
- package/dist/components/file-viewer/minimap/CodeMinimap.js +296 -0
- package/dist/components/file-viewer/minimap/layout.d.ts +60 -0
- package/dist/components/file-viewer/minimap/layout.js +117 -0
- package/dist/components/file-viewer/minimap/palette.d.ts +2 -0
- package/dist/components/file-viewer/minimap/palette.js +73 -0
- package/dist/components/file-viewer/minimap/raster.d.ts +19 -0
- package/dist/components/file-viewer/minimap/raster.js +122 -0
- package/dist/components/file-viewer/registry.d.ts +25 -0
- package/dist/components/file-viewer/registry.js +182 -0
- package/dist/components/file-viewer/syntax/grammars.d.ts +16 -0
- package/dist/components/file-viewer/syntax/grammars.js +221 -0
- package/dist/components/file-viewer/syntax/index.d.ts +8 -0
- package/dist/components/file-viewer/syntax/index.js +9 -0
- package/dist/components/file-viewer/syntax/languages.d.ts +14 -0
- package/dist/components/file-viewer/syntax/languages.js +115 -0
- package/dist/components/file-viewer/syntax/tokenize-config.d.ts +2 -0
- package/dist/components/file-viewer/syntax/tokenize-config.js +132 -0
- package/dist/components/file-viewer/syntax/tokenize-css.d.ts +2 -0
- package/dist/components/file-viewer/syntax/tokenize-css.js +169 -0
- package/dist/components/file-viewer/syntax/tokenize-markup.d.ts +2 -0
- package/dist/components/file-viewer/syntax/tokenize-markup.js +124 -0
- package/dist/components/file-viewer/syntax/tokenize.d.ts +9 -0
- package/dist/components/file-viewer/syntax/tokenize.js +289 -0
- package/dist/components/file-viewer/syntax/types.d.ts +74 -0
- package/dist/components/file-viewer/syntax/types.js +13 -0
- package/dist/components/file-viewer/types.d.ts +111 -0
- package/dist/components/file-viewer/types.js +8 -0
- package/dist/components/file-viewer/use-file-content.d.ts +26 -0
- package/dist/components/file-viewer/use-file-content.js +144 -0
- package/dist/components/file-viewer/views/BinaryView.d.ts +2 -0
- package/dist/components/file-viewer/views/BinaryView.js +34 -0
- package/dist/components/file-viewer/views/CodeView.d.ts +2 -0
- package/dist/components/file-viewer/views/CodeView.js +46 -0
- package/dist/components/file-viewer/views/DiffBody.d.ts +7 -0
- package/dist/components/file-viewer/views/DiffBody.js +77 -0
- package/dist/components/file-viewer/views/DiffView.d.ts +2 -0
- package/dist/components/file-viewer/views/DiffView.js +11 -0
- package/dist/components/file-viewer/views/ImageView.d.ts +9 -0
- package/dist/components/file-viewer/views/ImageView.js +28 -0
- package/dist/components/file-viewer/views/MarkdownView.d.ts +9 -0
- package/dist/components/file-viewer/views/MarkdownView.js +20 -0
- package/dist/components/file-viewer/views/SvgView.d.ts +9 -0
- package/dist/components/file-viewer/views/SvgView.js +10 -0
- package/dist/components/git/ChangeTree.d.ts +20 -0
- package/dist/components/git/ChangeTree.js +35 -0
- package/dist/components/git/CommitViewer.d.ts +12 -0
- package/dist/components/git/CommitViewer.js +85 -0
- package/dist/components/git/GitChanges.d.ts +17 -0
- package/dist/components/git/GitChanges.js +70 -0
- package/dist/components/git/GitHistory.d.ts +9 -0
- package/dist/components/git/GitHistory.js +58 -0
- package/dist/components/git/co-author.d.ts +14 -0
- package/dist/components/git/co-author.js +55 -0
- package/dist/components/git/git-file-source.d.ts +18 -0
- package/dist/components/git/git-file-source.js +53 -0
- package/dist/components/git/git-host.d.ts +24 -0
- package/dist/components/git/git-host.js +130 -0
- package/dist/components/git/index.d.ts +10 -0
- package/dist/components/git/index.js +12 -0
- package/dist/components/git/path-tree.d.ts +23 -0
- package/dist/components/git/path-tree.js +73 -0
- package/dist/components/git/session-files.d.ts +9 -0
- package/dist/components/git/session-files.js +50 -0
- package/dist/components/git/types.d.ts +92 -0
- package/dist/components/git/types.js +9 -0
- package/dist/components/projects/ProjectActivitySparkline.d.ts +6 -0
- package/dist/components/projects/ProjectActivitySparkline.js +12 -0
- package/dist/components/projects/ProjectList.d.ts +25 -0
- package/dist/components/projects/ProjectList.js +43 -0
- package/dist/components/projects/ProjectListItem.d.ts +19 -0
- package/dist/components/projects/ProjectListItem.js +78 -0
- package/dist/components/projects/ProjectsColumn.d.ts +19 -0
- package/dist/components/projects/ProjectsColumn.js +36 -0
- package/dist/components/projects/index.d.ts +8 -0
- package/dist/components/projects/index.js +4 -0
- package/dist/components/search/MatchStepper.d.ts +9 -0
- package/dist/components/search/MatchStepper.js +14 -0
- package/dist/components/search/SearchLauncher.d.ts +12 -0
- package/dist/components/search/SearchLauncher.js +13 -0
- package/dist/components/search/SearchSheet.d.ts +29 -0
- package/dist/components/search/SearchSheet.js +230 -0
- package/dist/components/search/index.d.ts +8 -0
- package/dist/components/search/index.js +4 -0
- package/dist/components/search/shortcut.d.ts +25 -0
- package/dist/components/search/shortcut.js +32 -0
- package/dist/components/sessions/SessionList.d.ts +24 -0
- package/dist/components/sessions/SessionList.js +76 -0
- package/dist/components/sessions/SessionListItem.d.ts +13 -0
- package/dist/components/sessions/SessionListItem.js +58 -0
- package/dist/components/sessions/SessionsColumn.d.ts +26 -0
- package/dist/components/sessions/SessionsColumn.js +32 -0
- package/dist/components/sessions/index.d.ts +9 -0
- package/dist/components/sessions/index.js +4 -0
- package/dist/components/sessions/session-display.d.ts +8 -0
- package/dist/components/sessions/session-display.js +18 -0
- package/dist/components/sessions/types.d.ts +7 -0
- package/dist/components/sessions/types.js +1 -0
- package/dist/components/transcript/Activity.d.ts +45 -0
- package/dist/components/transcript/Activity.js +75 -0
- package/dist/components/transcript/Anchor.d.ts +8 -0
- package/dist/components/transcript/Anchor.js +23 -0
- package/dist/components/transcript/Attachments.d.ts +21 -0
- package/dist/components/transcript/Attachments.js +138 -0
- package/dist/components/transcript/AuthoredMessage.d.ts +19 -0
- package/dist/components/transcript/AuthoredMessage.js +17 -0
- package/dist/components/transcript/Compaction.d.ts +9 -0
- package/dist/components/transcript/Compaction.js +50 -0
- package/dist/components/transcript/DayPill.d.ts +38 -0
- package/dist/components/transcript/DayPill.js +68 -0
- package/dist/components/transcript/Document.d.ts +32 -0
- package/dist/components/transcript/Document.js +503 -0
- package/dist/components/transcript/Favicon.d.ts +32 -0
- package/dist/components/transcript/Favicon.js +71 -0
- package/dist/components/transcript/HeadOfDocument.d.ts +19 -0
- package/dist/components/transcript/HeadOfDocument.js +44 -0
- package/dist/components/transcript/Ledger.d.ts +53 -0
- package/dist/components/transcript/Ledger.js +182 -0
- package/dist/components/transcript/LineDetail.d.ts +24 -0
- package/dist/components/transcript/LineDetail.js +81 -0
- package/dist/components/transcript/Marker.d.ts +33 -0
- package/dist/components/transcript/Marker.js +21 -0
- package/dist/components/transcript/MessagePreview.d.ts +12 -0
- package/dist/components/transcript/MessagePreview.js +58 -0
- package/dist/components/transcript/Prompt.d.ts +20 -0
- package/dist/components/transcript/Prompt.js +55 -0
- package/dist/components/transcript/Prose.d.ts +19 -0
- package/dist/components/transcript/Prose.js +109 -0
- package/dist/components/transcript/ReceiptPill.d.ts +10 -0
- package/dist/components/transcript/ReceiptPill.js +10 -0
- package/dist/components/transcript/ResponseHead.d.ts +9 -0
- package/dist/components/transcript/ResponseHead.js +36 -0
- package/dist/components/transcript/Subthread.d.ts +19 -0
- package/dist/components/transcript/Subthread.js +96 -0
- package/dist/components/transcript/Team.d.ts +53 -0
- package/dist/components/transcript/Team.js +185 -0
- package/dist/components/transcript/Thinking.d.ts +24 -0
- package/dist/components/transcript/Thinking.js +50 -0
- package/dist/components/transcript/TimelineMeta.d.ts +9 -0
- package/dist/components/transcript/TimelineMeta.js +161 -0
- package/dist/components/transcript/TranscriptLoading.d.ts +10 -0
- package/dist/components/transcript/TranscriptLoading.js +10 -0
- package/dist/components/transcript/WebDetail.d.ts +8 -0
- package/dist/components/transcript/WebDetail.js +29 -0
- package/dist/components/transcript/Workflow.d.ts +12 -0
- package/dist/components/transcript/Workflow.js +208 -0
- package/dist/components/transcript/activity-plan.d.ts +84 -0
- package/dist/components/transcript/activity-plan.js +209 -0
- package/dist/components/transcript/attachment-file-source.d.ts +23 -0
- package/dist/components/transcript/attachment-file-source.js +103 -0
- package/dist/components/transcript/attachment-gallery.d.ts +12 -0
- package/dist/components/transcript/attachment-gallery.js +33 -0
- package/dist/components/transcript/detail-parts.d.ts +50 -0
- package/dist/components/transcript/detail-parts.js +295 -0
- package/dist/components/transcript/disclosure-state.d.ts +6 -0
- package/dist/components/transcript/disclosure-state.js +32 -0
- package/dist/components/transcript/disclosure-store.d.ts +8 -0
- package/dist/components/transcript/disclosure-store.js +31 -0
- package/dist/components/transcript/document-model.d.ts +15 -0
- package/dist/components/transcript/document-model.js +104 -0
- package/dist/components/transcript/document-plan.d.ts +28 -0
- package/dist/components/transcript/document-plan.js +145 -0
- package/dist/components/transcript/fold-preference.d.ts +17 -0
- package/dist/components/transcript/fold-preference.js +63 -0
- package/dist/components/transcript/glyphs.d.ts +15 -0
- package/dist/components/transcript/glyphs.js +47 -0
- package/dist/components/transcript/index.d.ts +23 -0
- package/dist/components/transcript/index.js +22 -0
- package/dist/components/transcript/message-file-source.d.ts +15 -0
- package/dist/components/transcript/message-file-source.js +31 -0
- package/dist/components/transcript/message-preview.d.ts +9 -0
- package/dist/components/transcript/message-preview.js +46 -0
- package/dist/components/transcript/read-file-source.d.ts +7 -0
- package/dist/components/transcript/read-file-source.js +34 -0
- package/dist/components/transcript/reader-context.d.ts +13 -0
- package/dist/components/transcript/reader-context.js +55 -0
- package/dist/components/transcript/reading-identity.d.ts +2 -0
- package/dist/components/transcript/reading-identity.js +52 -0
- package/dist/components/transcript/scroll-to-row.d.ts +2 -0
- package/dist/components/transcript/scroll-to-row.js +13 -0
- package/dist/components/transcript/thread-index.d.ts +14 -0
- package/dist/components/transcript/thread-index.js +40 -0
- package/dist/components/transcript/thread-navigation.d.ts +5 -0
- package/dist/components/transcript/thread-navigation.js +3 -0
- package/dist/components/transcript/timeline-meta-file-source.d.ts +6 -0
- package/dist/components/transcript/timeline-meta-file-source.js +55 -0
- package/dist/components/transcript/timeline-meta-state.d.ts +12 -0
- package/dist/components/transcript/timeline-meta-state.js +24 -0
- package/dist/components/ui/ColumnHeading.d.ts +27 -0
- package/dist/components/ui/ColumnHeading.js +7 -0
- package/dist/components/ui/ConfirmDialog.d.ts +14 -0
- package/dist/components/ui/ConfirmDialog.js +22 -0
- package/dist/components/ui/DialogShell.d.ts +18 -0
- package/dist/components/ui/DialogShell.js +40 -0
- package/dist/components/ui/EmptyState.d.ts +10 -0
- package/dist/components/ui/EmptyState.js +6 -0
- package/dist/components/ui/ListSummaryHeader.d.ts +9 -0
- package/dist/components/ui/ListSummaryHeader.js +6 -0
- package/dist/components/ui/ListToolbar.d.ts +6 -0
- package/dist/components/ui/ListToolbar.js +5 -0
- package/dist/components/ui/ResultGroupHeader.d.ts +9 -0
- package/dist/components/ui/ResultGroupHeader.js +5 -0
- package/dist/components/ui/SegmentedControl.d.ts +16 -0
- package/dist/components/ui/SegmentedControl.js +9 -0
- package/dist/components/ui/SummaryMetric.d.ts +13 -0
- package/dist/components/ui/SummaryMetric.js +10 -0
- package/dist/components/ui/Veil.d.ts +7 -0
- package/dist/components/ui/Veil.js +5 -0
- package/dist/components/ui/index.d.ts +20 -0
- package/dist/components/ui/index.js +10 -0
- package/dist/components/worktree/WorktreeColumn.d.ts +22 -0
- package/dist/components/worktree/WorktreeColumn.js +170 -0
- package/dist/components/worktree/WorktreeFileTree.d.ts +19 -0
- package/dist/components/worktree/WorktreeFileTree.js +60 -0
- package/dist/components/worktree/WorktreeHeader.d.ts +32 -0
- package/dist/components/worktree/WorktreeHeader.js +81 -0
- package/dist/components/worktree/WorktreeList.d.ts +8 -0
- package/dist/components/worktree/WorktreeList.js +12 -0
- package/dist/components/worktree/index.d.ts +12 -0
- package/dist/components/worktree/index.js +7 -0
- package/dist/components/worktree/types.d.ts +17 -0
- package/dist/components/worktree/types.js +3 -0
- package/dist/components/worktree/use-worktree-guest.d.ts +21 -0
- package/dist/components/worktree/use-worktree-guest.js +92 -0
- package/dist/components/worktree/worktree-file-commands.d.ts +19 -0
- package/dist/components/worktree/worktree-file-commands.js +112 -0
- package/dist/components/worktree/worktree-file-source.d.ts +15 -0
- package/dist/components/worktree/worktree-file-source.js +75 -0
- package/dist/components/worktree/worktree-host.d.ts +31 -0
- package/dist/components/worktree/worktree-host.js +242 -0
- package/dist/fixtures/index.d.ts +24 -0
- package/dist/fixtures/index.js +292 -0
- package/dist/host-inputs.d.ts +231 -0
- package/dist/host-inputs.js +35 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.js +14 -0
- package/dist/lib/activity-details.d.ts +23 -0
- package/dist/lib/activity-details.js +78 -0
- package/dist/lib/activity-order.d.ts +32 -0
- package/dist/lib/activity-order.js +86 -0
- package/dist/lib/agent-paths.d.ts +6 -0
- package/dist/lib/agent-paths.js +19 -0
- package/dist/lib/agents.d.ts +15 -0
- package/dist/lib/agents.js +60 -0
- package/dist/lib/catalog-status.d.ts +3 -0
- package/dist/lib/catalog-status.js +10 -0
- package/dist/lib/chart-data.d.ts +14 -0
- package/dist/lib/chart-data.js +151 -0
- package/dist/lib/day-activity.d.ts +21 -0
- package/dist/lib/day-activity.js +56 -0
- package/dist/lib/format.d.ts +24 -0
- package/dist/lib/format.js +116 -0
- package/dist/lib/hooks.d.ts +118 -0
- package/dist/lib/hooks.js +608 -0
- package/dist/lib/icons.d.ts +21 -0
- package/dist/lib/icons.js +49 -0
- package/dist/lib/image-media.d.ts +6 -0
- package/dist/lib/image-media.js +30 -0
- package/dist/lib/ingest-activity.d.ts +50 -0
- package/dist/lib/ingest-activity.js +151 -0
- package/dist/lib/ingest.d.ts +25 -0
- package/dist/lib/ingest.js +70 -0
- package/dist/lib/model-labels.d.ts +5 -0
- package/dist/lib/model-labels.js +28 -0
- package/dist/lib/model.d.ts +73 -0
- package/dist/lib/model.js +141 -0
- package/dist/lib/motion.d.ts +13 -0
- package/dist/lib/motion.js +80 -0
- package/dist/lib/room-storage.d.ts +13 -0
- package/dist/lib/room-storage.js +40 -0
- package/dist/lib/search-results.d.ts +27 -0
- package/dist/lib/search-results.js +83 -0
- package/dist/lib/search-sheet.d.ts +119 -0
- package/dist/lib/search-sheet.js +282 -0
- package/dist/lib/sections.d.ts +19 -0
- package/dist/lib/sections.js +36 -0
- package/dist/lib/session-activity.d.ts +5 -0
- package/dist/lib/session-activity.js +15 -0
- package/dist/lib/session-leases.d.ts +15 -0
- package/dist/lib/session-leases.js +61 -0
- package/dist/lib/spend.d.ts +42 -0
- package/dist/lib/spend.js +112 -0
- package/dist/lib/tint.d.ts +9 -0
- package/dist/lib/tint.js +53 -0
- package/dist/lib/transcript/collaboration.d.ts +97 -0
- package/dist/lib/transcript/collaboration.js +423 -0
- package/dist/lib/transcript/families.d.ts +212 -0
- package/dist/lib/transcript/families.js +906 -0
- package/dist/lib/transcript/favicons.d.ts +54 -0
- package/dist/lib/transcript/favicons.js +183 -0
- package/dist/lib/transcript/head-of-document.d.ts +27 -0
- package/dist/lib/transcript/head-of-document.js +274 -0
- package/dist/lib/transcript/head-state.d.ts +182 -0
- package/dist/lib/transcript/head-state.js +305 -0
- package/dist/lib/transcript/history-window.d.ts +13 -0
- package/dist/lib/transcript/history-window.js +52 -0
- package/dist/lib/transcript/images.d.ts +8 -0
- package/dist/lib/transcript/images.js +60 -0
- package/dist/lib/transcript/index.d.ts +15 -0
- package/dist/lib/transcript/index.js +8 -0
- package/dist/lib/transcript/ledger.d.ts +143 -0
- package/dist/lib/transcript/ledger.js +513 -0
- package/dist/lib/transcript/protocol.d.ts +23 -0
- package/dist/lib/transcript/protocol.js +1 -0
- package/dist/lib/transcript/sittings.d.ts +75 -0
- package/dist/lib/transcript/sittings.js +147 -0
- package/dist/lib/transcript/tail-scroll.d.ts +36 -0
- package/dist/lib/transcript/tail-scroll.js +167 -0
- package/dist/lib/transcript/tail-state.d.ts +17 -0
- package/dist/lib/transcript/tail-state.js +30 -0
- package/dist/lib/transcript/turns.d.ts +192 -0
- package/dist/lib/transcript/turns.js +576 -0
- package/dist/lib/transcript/use-transcript-opening.d.ts +12 -0
- package/dist/lib/transcript/use-transcript-opening.js +31 -0
- package/dist/lib/transcript/use-transcript-tail.d.ts +25 -0
- package/dist/lib/transcript/use-transcript-tail.js +158 -0
- package/dist/lib/transcript/vocabulary.d.ts +119 -0
- package/dist/lib/transcript/vocabulary.js +293 -0
- package/dist/lib/transcript/web-address.d.ts +6 -0
- package/dist/lib/transcript/web-address.js +18 -0
- package/dist/lib/transcript/workflow.d.ts +31 -0
- package/dist/lib/transcript/workflow.js +133 -0
- package/dist/lib/use-activity-order.d.ts +2 -0
- package/dist/lib/use-activity-order.js +23 -0
- package/dist/lib/use-day-usage.d.ts +8 -0
- package/dist/lib/use-day-usage.js +31 -0
- package/dist/lib/use-deferred-list-order.d.ts +26 -0
- package/dist/lib/use-deferred-list-order.js +142 -0
- package/dist/lib/use-ingest-activity.d.ts +2 -0
- package/dist/lib/use-ingest-activity.js +49 -0
- package/dist/lib/use-list-motion.d.ts +4 -0
- package/dist/lib/use-list-motion.js +67 -0
- package/dist/ports.d.ts +222 -0
- package/dist/ports.js +3 -0
- package/dist/room-context.d.ts +60 -0
- package/dist/room-context.js +87 -0
- package/dist/styles/activity-chart.css +127 -0
- package/dist/styles/attachments.css +29 -0
- package/dist/styles/favicon.css +73 -0
- package/dist/styles/history-room.css +18 -0
- package/dist/styles/host-inputs.css +250 -0
- package/dist/styles/image-gallery.css +30 -0
- package/dist/styles/ingest.css +51 -0
- package/dist/styles/message-preview.css +34 -0
- package/dist/styles/models-chart.css +66 -0
- package/dist/styles/project-chart.css +19 -0
- package/dist/styles/reader.css +33 -0
- package/dist/styles/room.css +1411 -0
- package/dist/styles/search.css +252 -0
- package/dist/styles/transcript-activity.css +70 -0
- package/dist/styles/transcript-head.css +220 -0
- package/dist/styles/transcript-loading.css +57 -0
- package/dist/styles/transcript.css +1226 -0
- package/package.json +61 -4
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
// The minimap's one hot pass: syntax-coloured blocks written directly into
|
|
2
|
+
// a pane-sized pixel buffer. It deliberately knows nothing about Canvas or
|
|
3
|
+
// the DOM, so node:test can exercise the exact renderer without a browser.
|
|
4
|
+
import { MINIMAP_ROW_DEVICE_PIXELS } from "./layout.js";
|
|
5
|
+
export const MINIMAP_CHARACTER_DEVICE_PIXELS = 1;
|
|
6
|
+
export const MINIMAP_CHARACTER_HEIGHT_DEVICE_PIXELS = 2;
|
|
7
|
+
export const MINIMAP_LEFT_GUTTER_DEVICE_PIXELS = 2;
|
|
8
|
+
export const MINIMAP_MAX_COLUMNS = 96;
|
|
9
|
+
const endianProbe = new Uint32Array([0x01020304]);
|
|
10
|
+
const LITTLE_ENDIAN = new Uint8Array(endianProbe.buffer)[0] === 0x04;
|
|
11
|
+
const COMBINING_MARK = /\p{Mark}/u;
|
|
12
|
+
export function packRgba(red, green, blue, alpha = 255) {
|
|
13
|
+
const r = red & 0xff;
|
|
14
|
+
const g = green & 0xff;
|
|
15
|
+
const b = blue & 0xff;
|
|
16
|
+
const a = alpha & 0xff;
|
|
17
|
+
return LITTLE_ENDIAN
|
|
18
|
+
? ((a << 24) | (b << 16) | (g << 8) | r) >>> 0
|
|
19
|
+
: ((r << 24) | (g << 16) | (b << 8) | a) >>> 0;
|
|
20
|
+
}
|
|
21
|
+
/** A compact East Asian Width predicate. Unlike `codePoint > 0xff`, this
|
|
22
|
+
* leaves Greek, Cyrillic, Hebrew, combining marks, and ordinary symbols at
|
|
23
|
+
* their actual monospace width. */
|
|
24
|
+
function isFullWidthCodePoint(point) {
|
|
25
|
+
if (point < 0x1100)
|
|
26
|
+
return false;
|
|
27
|
+
return (point <= 0x115f ||
|
|
28
|
+
point === 0x2329 ||
|
|
29
|
+
point === 0x232a ||
|
|
30
|
+
(point >= 0x2e80 && point <= 0x303e) ||
|
|
31
|
+
(point >= 0x3040 && point <= 0xa4cf) ||
|
|
32
|
+
(point >= 0xac00 && point <= 0xd7a3) ||
|
|
33
|
+
(point >= 0xf900 && point <= 0xfaff) ||
|
|
34
|
+
(point >= 0xfe10 && point <= 0xfe19) ||
|
|
35
|
+
(point >= 0xfe30 && point <= 0xfe6f) ||
|
|
36
|
+
(point >= 0xff00 && point <= 0xff60) ||
|
|
37
|
+
(point >= 0xffe0 && point <= 0xffe6) ||
|
|
38
|
+
(point >= 0x1b000 && point <= 0x1b001) ||
|
|
39
|
+
(point >= 0x1f200 && point <= 0x1f251) ||
|
|
40
|
+
(point >= 0x20000 && point <= 0x3fffd));
|
|
41
|
+
}
|
|
42
|
+
function characterColumns(character) {
|
|
43
|
+
const point = character.codePointAt(0) ?? 0;
|
|
44
|
+
if (point === 0x200d || COMBINING_MARK.test(character))
|
|
45
|
+
return 0;
|
|
46
|
+
return isFullWidthCodePoint(point) ? 2 : 1;
|
|
47
|
+
}
|
|
48
|
+
function isGap(character) {
|
|
49
|
+
return (character === " " ||
|
|
50
|
+
character === "\t" ||
|
|
51
|
+
character === "\r" ||
|
|
52
|
+
character === "\n" ||
|
|
53
|
+
character === "\u00a0");
|
|
54
|
+
}
|
|
55
|
+
function paintRun(pixels, width, height, xFrom, xTo, y, color) {
|
|
56
|
+
const from = Math.max(0, Math.min(width, xFrom));
|
|
57
|
+
const to = Math.max(from, Math.min(width, xTo));
|
|
58
|
+
if (from === to)
|
|
59
|
+
return;
|
|
60
|
+
const bottom = Math.min(height, y + MINIMAP_CHARACTER_HEIGHT_DEVICE_PIXELS);
|
|
61
|
+
for (let pixelY = y; pixelY < bottom; pixelY += 1) {
|
|
62
|
+
pixels.fill(color, pixelY * width + from, pixelY * width + to);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
function rasterLine(pixels, width, height, y, line, tabColumns, palette) {
|
|
66
|
+
const maxX = Math.min(width, MINIMAP_LEFT_GUTTER_DEVICE_PIXELS +
|
|
67
|
+
MINIMAP_MAX_COLUMNS * MINIMAP_CHARACTER_DEVICE_PIXELS);
|
|
68
|
+
const tabs = Math.max(1, Math.floor(tabColumns));
|
|
69
|
+
let column = 0;
|
|
70
|
+
let x = MINIMAP_LEFT_GUTTER_DEVICE_PIXELS;
|
|
71
|
+
for (const token of line) {
|
|
72
|
+
if (x >= maxX)
|
|
73
|
+
return;
|
|
74
|
+
let runStart = -1;
|
|
75
|
+
const flush = () => {
|
|
76
|
+
if (runStart === -1)
|
|
77
|
+
return;
|
|
78
|
+
paintRun(pixels, width, height, runStart, Math.min(x, maxX), y, palette.token[token.kind]);
|
|
79
|
+
runStart = -1;
|
|
80
|
+
};
|
|
81
|
+
for (const character of token.text) {
|
|
82
|
+
if (isGap(character)) {
|
|
83
|
+
flush();
|
|
84
|
+
const advance = character === "\t" ? tabs - (column % tabs) : characterColumns(character);
|
|
85
|
+
column += advance;
|
|
86
|
+
x += advance * MINIMAP_CHARACTER_DEVICE_PIXELS;
|
|
87
|
+
if (x >= maxX)
|
|
88
|
+
return;
|
|
89
|
+
continue;
|
|
90
|
+
}
|
|
91
|
+
const advance = characterColumns(character);
|
|
92
|
+
if (advance === 0)
|
|
93
|
+
continue;
|
|
94
|
+
if (runStart === -1)
|
|
95
|
+
runStart = x;
|
|
96
|
+
column += advance;
|
|
97
|
+
x += advance * MINIMAP_CHARACTER_DEVICE_PIXELS;
|
|
98
|
+
if (x >= maxX) {
|
|
99
|
+
flush();
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
flush();
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
export function rasterizeMinimap(args) {
|
|
107
|
+
const width = Math.max(0, Math.floor(args.width));
|
|
108
|
+
const height = Math.max(0, Math.floor(args.height));
|
|
109
|
+
const pixelCount = width * height;
|
|
110
|
+
if (width === 0 || height === 0 || args.pixels.length < pixelCount)
|
|
111
|
+
return;
|
|
112
|
+
args.pixels.fill(args.palette.background, 0, pixelCount);
|
|
113
|
+
const availableRows = Math.floor(height / MINIMAP_ROW_DEVICE_PIXELS);
|
|
114
|
+
const rowCount = Math.min(availableRows, args.lineIndexes === null ? args.lines.length : args.lineIndexes.length);
|
|
115
|
+
for (let row = 0; row < rowCount; row += 1) {
|
|
116
|
+
const lineIndex = args.lineIndexes === null ? row : args.lineIndexes[row];
|
|
117
|
+
const line = args.lines[lineIndex];
|
|
118
|
+
if (line === undefined)
|
|
119
|
+
continue;
|
|
120
|
+
rasterLine(args.pixels, width, height, row * MINIMAP_ROW_DEVICE_PIXELS, line, args.tabColumns, args.palette);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { FileKind } from "./types.js";
|
|
2
|
+
export declare const BINARY_KIND: FileKind;
|
|
3
|
+
/**
|
|
4
|
+
* The kind for a change rather than a file.
|
|
5
|
+
*
|
|
6
|
+
* Chosen by the CALLER, not by the name: the same `main.rs` is a source file
|
|
7
|
+
* when the tree opens it and a diff when the git column does, and only the
|
|
8
|
+
* caller knows which act it is serving.
|
|
9
|
+
*/
|
|
10
|
+
export declare function diffKind(name: string): FileKind;
|
|
11
|
+
/** What a file name says the file is. Extension only — see `syntax/languages`
|
|
12
|
+
* for why the bytes get no vote here. */
|
|
13
|
+
export declare function resolveKind(name: string): FileKind;
|
|
14
|
+
/** Only for a source-proven image slot; extensionless tool captures need the
|
|
15
|
+
* same format hint whether opened from a loaded tile or reached with Next. */
|
|
16
|
+
export declare function imageKind(name: string, bytes?: Uint8Array): FileKind;
|
|
17
|
+
/**
|
|
18
|
+
* Does this look like something no one can read as text?
|
|
19
|
+
*
|
|
20
|
+
* The test git has used for decades: a NUL byte in the first pages. It is a
|
|
21
|
+
* heuristic and it is named as one — but it is the heuristic that is right
|
|
22
|
+
* about real files, and the alternative is showing a reader a screenful of
|
|
23
|
+
* replacement characters and calling it a document.
|
|
24
|
+
*/
|
|
25
|
+
export declare function looksBinary(bytes: Uint8Array): boolean;
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
// Which view a file gets, and what the dialog is allowed to do with it.
|
|
2
|
+
//
|
|
3
|
+
// One table, read once per open. Adding a format is an entry here — never a
|
|
4
|
+
// branch inside a view, and never a condition in the dialog, which is the
|
|
5
|
+
// point of the whole arrangement: the dialog knows there are views, and it
|
|
6
|
+
// does not know what any of them are.
|
|
7
|
+
import { extensionOf, languageFor, PLAIN_TEXT } from "./syntax/index.js";
|
|
8
|
+
import { BinaryView } from "./views/BinaryView.js";
|
|
9
|
+
import { CodeView } from "./views/CodeView.js";
|
|
10
|
+
import { DiffView } from "./views/DiffView.js";
|
|
11
|
+
import { ImageView, IMAGE_MODES } from "./views/ImageView.js";
|
|
12
|
+
import { MarkdownView, MARKDOWN_MODES } from "./views/MarkdownView.js";
|
|
13
|
+
import { SvgView, SVG_MODES } from "./views/SvgView.js";
|
|
14
|
+
import { imageMediaTypeFromBytes } from "../../lib/image-media.js";
|
|
15
|
+
const KB = 1024;
|
|
16
|
+
const MB = 1024 * KB;
|
|
17
|
+
/** Source is read whole so the highlighter can see block comments across the
|
|
18
|
+
* file. Two megabytes of it is a very large source file and a fast read; past
|
|
19
|
+
* that the honest move is to say the number rather than to freeze. */
|
|
20
|
+
const TEXT_LIMIT = 2 * MB;
|
|
21
|
+
/** An image is decoded by the compositor, not by us, so it can be larger. */
|
|
22
|
+
const IMAGE_LIMIT = 32 * MB;
|
|
23
|
+
/** A hex dump shows its first pages, but the read still crosses a port. */
|
|
24
|
+
const BINARY_LIMIT = 8 * MB;
|
|
25
|
+
const CODE = {
|
|
26
|
+
id: "code",
|
|
27
|
+
payload: "text",
|
|
28
|
+
maxBytes: TEXT_LIMIT,
|
|
29
|
+
actions: ["copy-path"],
|
|
30
|
+
Body: CodeView,
|
|
31
|
+
};
|
|
32
|
+
/** HTML is shown as source and never rendered. A page in a worktree is
|
|
33
|
+
* untrusted markup with scripts in it, and this room has a preload bridge; the
|
|
34
|
+
* place that can safely run it is a browser, which is what the extra act
|
|
35
|
+
* offers. That the safe answer and the useful one agree here is luck worth
|
|
36
|
+
* taking. */
|
|
37
|
+
const HTML = {
|
|
38
|
+
...CODE,
|
|
39
|
+
id: "html",
|
|
40
|
+
actions: ["copy-path", "open-in-browser"],
|
|
41
|
+
};
|
|
42
|
+
const MARKDOWN = {
|
|
43
|
+
id: "markdown",
|
|
44
|
+
payload: "text",
|
|
45
|
+
maxBytes: TEXT_LIMIT,
|
|
46
|
+
modes: MARKDOWN_MODES,
|
|
47
|
+
actions: ["copy-path"],
|
|
48
|
+
Body: MarkdownView,
|
|
49
|
+
};
|
|
50
|
+
const IMAGE = {
|
|
51
|
+
id: "image",
|
|
52
|
+
payload: "bytes",
|
|
53
|
+
maxBytes: IMAGE_LIMIT,
|
|
54
|
+
modes: IMAGE_MODES,
|
|
55
|
+
actions: ["copy-path"],
|
|
56
|
+
Body: ImageView,
|
|
57
|
+
};
|
|
58
|
+
/** SVG takes `text` as well as bytes, because its source half is the same
|
|
59
|
+
* code view every other file gets. */
|
|
60
|
+
const SVG = {
|
|
61
|
+
id: "svg",
|
|
62
|
+
payload: "text",
|
|
63
|
+
maxBytes: TEXT_LIMIT,
|
|
64
|
+
modes: SVG_MODES,
|
|
65
|
+
actions: ["copy-path", "open-in-browser"],
|
|
66
|
+
Body: SvgView,
|
|
67
|
+
};
|
|
68
|
+
/** A change, not a file. Its limit is `Infinity` because git bounds its own
|
|
69
|
+
* output host-side and a diff's size has nothing to do with the file's. */
|
|
70
|
+
const DIFF = {
|
|
71
|
+
id: "diff",
|
|
72
|
+
payload: "compare",
|
|
73
|
+
maxBytes: Number.POSITIVE_INFINITY,
|
|
74
|
+
actions: ["copy-path"],
|
|
75
|
+
Body: DiffView,
|
|
76
|
+
};
|
|
77
|
+
const BINARY = {
|
|
78
|
+
id: "binary",
|
|
79
|
+
payload: "bytes",
|
|
80
|
+
maxBytes: BINARY_LIMIT,
|
|
81
|
+
actions: ["copy-path"],
|
|
82
|
+
Body: BinaryView,
|
|
83
|
+
};
|
|
84
|
+
const IMAGE_TYPES = new Map([
|
|
85
|
+
["png", "image/png"],
|
|
86
|
+
["jpg", "image/jpeg"],
|
|
87
|
+
["jpeg", "image/jpeg"],
|
|
88
|
+
["gif", "image/gif"],
|
|
89
|
+
["webp", "image/webp"],
|
|
90
|
+
["avif", "image/avif"],
|
|
91
|
+
["bmp", "image/bmp"],
|
|
92
|
+
["ico", "image/x-icon"],
|
|
93
|
+
["apng", "image/apng"],
|
|
94
|
+
]);
|
|
95
|
+
/** Extensions worth refusing to decode as text before reading a byte. An
|
|
96
|
+
* unknown extension is NOT on this list: it is read as text and downgraded if
|
|
97
|
+
* the bytes disagree, because most unfamiliar extensions in a repository are
|
|
98
|
+
* somebody's config file. */
|
|
99
|
+
const BINARY_EXTENSIONS = new Set([
|
|
100
|
+
"zip", "gz", "tgz", "bz2", "xz", "zst", "7z", "rar", "tar", "jar", "war",
|
|
101
|
+
"pdf", "doc", "docx", "xls", "xlsx", "ppt", "pptx", "key", "numbers", "pages",
|
|
102
|
+
"so", "dylib", "dll", "a", "o", "obj", "exe", "bin", "wasm", "node", "rlib", "pdb",
|
|
103
|
+
"woff", "woff2", "ttf", "otf", "eot",
|
|
104
|
+
"mp3", "mp4", "m4a", "wav", "aiff", "flac", "ogg", "webm", "mov", "avi", "mkv",
|
|
105
|
+
"db", "sqlite", "sqlite3", "rdb", "pack", "idx", "class", "pyc", "pyo",
|
|
106
|
+
"psd", "sketch", "fig", "ai", "heic", "tiff", "tif", "dmg", "iso", "img",
|
|
107
|
+
]);
|
|
108
|
+
export const BINARY_KIND = {
|
|
109
|
+
viewer: BINARY,
|
|
110
|
+
label: "Binary",
|
|
111
|
+
language: null,
|
|
112
|
+
mime: null,
|
|
113
|
+
};
|
|
114
|
+
/** Text with no language behind it: read, shown, nothing claimed about it. */
|
|
115
|
+
const UNKNOWN_TEXT_KIND = {
|
|
116
|
+
viewer: CODE,
|
|
117
|
+
label: "Text",
|
|
118
|
+
language: PLAIN_TEXT,
|
|
119
|
+
mime: null,
|
|
120
|
+
};
|
|
121
|
+
/**
|
|
122
|
+
* The kind for a change rather than a file.
|
|
123
|
+
*
|
|
124
|
+
* Chosen by the CALLER, not by the name: the same `main.rs` is a source file
|
|
125
|
+
* when the tree opens it and a diff when the git column does, and only the
|
|
126
|
+
* caller knows which act it is serving.
|
|
127
|
+
*/
|
|
128
|
+
export function diffKind(name) {
|
|
129
|
+
return { viewer: DIFF, label: "Diff", language: languageFor(name), mime: null };
|
|
130
|
+
}
|
|
131
|
+
/** What a file name says the file is. Extension only — see `syntax/languages`
|
|
132
|
+
* for why the bytes get no vote here. */
|
|
133
|
+
export function resolveKind(name) {
|
|
134
|
+
const extension = extensionOf(name);
|
|
135
|
+
if (extension === "svg") {
|
|
136
|
+
return { viewer: SVG, label: "SVG", language: languageFor(name), mime: "image/svg+xml" };
|
|
137
|
+
}
|
|
138
|
+
const mime = IMAGE_TYPES.get(extension);
|
|
139
|
+
if (mime !== undefined) {
|
|
140
|
+
return { viewer: IMAGE, label: extension.toUpperCase(), language: null, mime };
|
|
141
|
+
}
|
|
142
|
+
if (BINARY_EXTENSIONS.has(extension)) {
|
|
143
|
+
return { ...BINARY_KIND, label: extension === "" ? "Binary" : extension.toUpperCase() };
|
|
144
|
+
}
|
|
145
|
+
const language = languageFor(name);
|
|
146
|
+
if (language === null)
|
|
147
|
+
return UNKNOWN_TEXT_KIND;
|
|
148
|
+
if (language.id === "markdown") {
|
|
149
|
+
return { viewer: MARKDOWN, label: language.label, language, mime: null };
|
|
150
|
+
}
|
|
151
|
+
if (language.id === "html") {
|
|
152
|
+
return { viewer: HTML, label: language.label, language, mime: "text/html" };
|
|
153
|
+
}
|
|
154
|
+
return { viewer: CODE, label: language.label, language, mime: null };
|
|
155
|
+
}
|
|
156
|
+
/** Only for a source-proven image slot; extensionless tool captures need the
|
|
157
|
+
* same format hint whether opened from a loaded tile or reached with Next. */
|
|
158
|
+
export function imageKind(name, bytes) {
|
|
159
|
+
const kind = resolveKind(name);
|
|
160
|
+
if (kind.viewer.id === "image" || kind.viewer.id === "svg")
|
|
161
|
+
return kind;
|
|
162
|
+
const mime = bytes ? imageMediaTypeFromBytes(bytes) : null;
|
|
163
|
+
if (mime === "image/svg+xml")
|
|
164
|
+
return resolveKind("image.svg");
|
|
165
|
+
return { viewer: IMAGE, label: mime?.split("/")[1].toUpperCase() ?? "Image", language: null, mime };
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Does this look like something no one can read as text?
|
|
169
|
+
*
|
|
170
|
+
* The test git has used for decades: a NUL byte in the first pages. It is a
|
|
171
|
+
* heuristic and it is named as one — but it is the heuristic that is right
|
|
172
|
+
* about real files, and the alternative is showing a reader a screenful of
|
|
173
|
+
* replacement characters and calling it a document.
|
|
174
|
+
*/
|
|
175
|
+
export function looksBinary(bytes) {
|
|
176
|
+
const end = Math.min(bytes.length, 8 * KB);
|
|
177
|
+
for (let at = 0; at < end; at += 1) {
|
|
178
|
+
if (bytes[at] === 0)
|
|
179
|
+
return true;
|
|
180
|
+
}
|
|
181
|
+
return false;
|
|
182
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Grammar } from "./types.js";
|
|
2
|
+
export declare const typescript: Grammar;
|
|
3
|
+
export declare const rust: Grammar;
|
|
4
|
+
export declare const python: Grammar;
|
|
5
|
+
export declare const go: Grammar;
|
|
6
|
+
export declare const c: Grammar;
|
|
7
|
+
export declare const java: Grammar;
|
|
8
|
+
export declare const swift: Grammar;
|
|
9
|
+
export declare const ruby: Grammar;
|
|
10
|
+
export declare const php: Grammar;
|
|
11
|
+
export declare const shell: Grammar;
|
|
12
|
+
export declare const sql: Grammar;
|
|
13
|
+
export declare const lua: Grammar;
|
|
14
|
+
export declare const json: Grammar;
|
|
15
|
+
/** Text with no grammar at all: no comments, no keywords, nothing claimed. */
|
|
16
|
+
export declare const plain: Grammar;
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
// The language tables. Data, not code: adding a language is an entry here,
|
|
2
|
+
// never a new branch in the tokenizer.
|
|
3
|
+
//
|
|
4
|
+
// The keyword lists are deliberately the language's OWN words — its
|
|
5
|
+
// declarations, control flow and modifiers — not its standard library. A
|
|
6
|
+
// highlighter that paints every library name it has heard of is making a
|
|
7
|
+
// claim about the code it cannot support, and it goes stale the first time
|
|
8
|
+
// the library does.
|
|
9
|
+
const words = (list) => new Set(list.trim().split(/\s+/));
|
|
10
|
+
/** `"…"` and `'…'`, backslash-escaped, one line each. */
|
|
11
|
+
const QUOTED = [
|
|
12
|
+
{ open: '"', escape: "\\" },
|
|
13
|
+
{ open: "'", escape: "\\" },
|
|
14
|
+
];
|
|
15
|
+
const SHARED_CONSTANTS = words("true false null undefined nil None True False NULL nullptr");
|
|
16
|
+
/* ── the C family ──────────────────────────────────────────────────────── */
|
|
17
|
+
export const typescript = {
|
|
18
|
+
lineComments: ["//"],
|
|
19
|
+
blockComments: [["/*", "*/"]],
|
|
20
|
+
strings: [{ open: "`", multiline: true, escape: "\\" }, ...QUOTED],
|
|
21
|
+
keywords: words(`
|
|
22
|
+
abstract as async await break case catch class const continue debugger declare default
|
|
23
|
+
delete do else enum export extends finally for from function get if implements import in
|
|
24
|
+
infer instanceof interface is keyof let namespace new of override package private protected
|
|
25
|
+
public readonly require return satisfies set static super switch this throw try type typeof
|
|
26
|
+
var void while with yield
|
|
27
|
+
`),
|
|
28
|
+
constants: SHARED_CONSTANTS,
|
|
29
|
+
types: words(`
|
|
30
|
+
any bigint boolean never number object string symbol unknown void
|
|
31
|
+
Array Promise Record Map Set ReadonlyArray Partial Readonly
|
|
32
|
+
`),
|
|
33
|
+
capitalIsType: true,
|
|
34
|
+
annotation: /@[A-Za-z_][A-Za-z0-9_.]*/y,
|
|
35
|
+
regexLiterals: true,
|
|
36
|
+
};
|
|
37
|
+
export const rust = {
|
|
38
|
+
lineComments: ["//"],
|
|
39
|
+
blockComments: [["/*", "*/"]],
|
|
40
|
+
// Rust string literals span lines, and `'a` is a lifetime rather than the
|
|
41
|
+
// opening of a character literal.
|
|
42
|
+
strings: [{ open: '"', multiline: true, escape: "\\" }, { open: "'", escape: "\\" }],
|
|
43
|
+
lifetimeQuote: true,
|
|
44
|
+
keywords: words(`
|
|
45
|
+
as async await box break const continue crate dyn else enum extern fn for if impl in let
|
|
46
|
+
loop match mod move mut pub ref return self Self static struct super trait type union
|
|
47
|
+
unsafe use where while
|
|
48
|
+
`),
|
|
49
|
+
constants: words("true false None Some Ok Err"),
|
|
50
|
+
types: words(`
|
|
51
|
+
bool char f32 f64 i8 i16 i32 i64 i128 isize str u8 u16 u32 u64 u128 usize
|
|
52
|
+
String Vec Option Result Box Rc Arc HashMap BTreeMap
|
|
53
|
+
`),
|
|
54
|
+
capitalIsType: true,
|
|
55
|
+
};
|
|
56
|
+
export const python = {
|
|
57
|
+
lineComments: ["#"],
|
|
58
|
+
// Docstrings first: `"""` must be tried before `"`, or every docstring
|
|
59
|
+
// opens and closes on its own first two characters.
|
|
60
|
+
strings: [
|
|
61
|
+
{ open: '"""', multiline: true, escape: "\\" },
|
|
62
|
+
{ open: "'''", multiline: true, escape: "\\" },
|
|
63
|
+
...QUOTED,
|
|
64
|
+
],
|
|
65
|
+
keywords: words(`
|
|
66
|
+
and as assert async await break class continue def del elif else except finally for from
|
|
67
|
+
global if import in is lambda match nonlocal not or pass raise return try while with yield
|
|
68
|
+
`),
|
|
69
|
+
constants: words("True False None NotImplemented Ellipsis self cls"),
|
|
70
|
+
types: words("bool bytes dict float frozenset int list object set str tuple type"),
|
|
71
|
+
capitalIsType: true,
|
|
72
|
+
annotation: /@[A-Za-z_][A-Za-z0-9_.]*/y,
|
|
73
|
+
};
|
|
74
|
+
export const go = {
|
|
75
|
+
lineComments: ["//"],
|
|
76
|
+
blockComments: [["/*", "*/"]],
|
|
77
|
+
strings: [{ open: "`", multiline: true }, ...QUOTED],
|
|
78
|
+
keywords: words(`
|
|
79
|
+
break case chan const continue default defer else fallthrough for func go goto if import
|
|
80
|
+
interface map package range return select struct switch type var
|
|
81
|
+
`),
|
|
82
|
+
constants: words("true false nil iota"),
|
|
83
|
+
types: words(`
|
|
84
|
+
bool byte complex64 complex128 error float32 float64 int int8 int16 int32 int64 rune string
|
|
85
|
+
uint uint8 uint16 uint32 uint64 uintptr any
|
|
86
|
+
`),
|
|
87
|
+
capitalIsType: true,
|
|
88
|
+
};
|
|
89
|
+
export const c = {
|
|
90
|
+
lineComments: ["//"],
|
|
91
|
+
blockComments: [["/*", "*/"]],
|
|
92
|
+
strings: QUOTED,
|
|
93
|
+
// `#include`, `#define` — the preprocessor is a second language spoken in
|
|
94
|
+
// the first one's file, and it earns its own mark.
|
|
95
|
+
annotation: /#[ \t]*[a-z]+/y,
|
|
96
|
+
keywords: words(`
|
|
97
|
+
alignas alignof auto break case catch class const consteval constexpr continue co_await
|
|
98
|
+
co_return co_yield decltype default delete do else enum explicit export extern final for
|
|
99
|
+
friend goto if inline mutable namespace new noexcept operator override private protected
|
|
100
|
+
public register return signed sizeof static static_assert struct switch template this
|
|
101
|
+
thread_local throw try typedef typename union unsigned using virtual volatile while
|
|
102
|
+
`),
|
|
103
|
+
constants: words("true false NULL nullptr"),
|
|
104
|
+
types: words("bool char double float int long short size_t ssize_t void wchar_t uint8_t uint16_t uint32_t uint64_t int8_t int16_t int32_t int64_t"),
|
|
105
|
+
capitalIsType: true,
|
|
106
|
+
};
|
|
107
|
+
export const java = {
|
|
108
|
+
lineComments: ["//"],
|
|
109
|
+
blockComments: [["/*", "*/"]],
|
|
110
|
+
strings: QUOTED,
|
|
111
|
+
annotation: /@[A-Za-z_][A-Za-z0-9_.]*/y,
|
|
112
|
+
keywords: words(`
|
|
113
|
+
abstract as assert break by case catch class companion const constructor continue crossinline
|
|
114
|
+
data default do else enum extends external final finally for fun goto if implements import
|
|
115
|
+
in infix init inline instanceof interface internal is lateinit native new object open
|
|
116
|
+
operator out override package private protected public reified return sealed static
|
|
117
|
+
strictfp super suspend switch synchronized tailrec this throw throws transient try typealias
|
|
118
|
+
val var vararg volatile when while
|
|
119
|
+
`),
|
|
120
|
+
constants: words("true false null this super it"),
|
|
121
|
+
types: words(`
|
|
122
|
+
boolean byte char double float int long short void var
|
|
123
|
+
Any Boolean Byte Char Double Float Int Long Nothing Short String Unit
|
|
124
|
+
`),
|
|
125
|
+
capitalIsType: true,
|
|
126
|
+
};
|
|
127
|
+
export const swift = {
|
|
128
|
+
lineComments: ["//"],
|
|
129
|
+
blockComments: [["/*", "*/"]],
|
|
130
|
+
strings: [{ open: '"""', multiline: true, escape: "\\" }, { open: '"', escape: "\\" }],
|
|
131
|
+
annotation: /@[A-Za-z_][A-Za-z0-9_]*/y,
|
|
132
|
+
keywords: words(`
|
|
133
|
+
actor as associatedtype async await break case catch class continue convenience default
|
|
134
|
+
defer deinit didSet do else enum extension fallthrough fileprivate final for func get guard
|
|
135
|
+
if import in indirect infix init inout internal is lazy let mutating nonisolated open
|
|
136
|
+
operator private protocol public repeat required rethrows return self set some static
|
|
137
|
+
struct subscript super switch throw throws try typealias var weak where while willSet
|
|
138
|
+
`),
|
|
139
|
+
constants: words("true false nil"),
|
|
140
|
+
types: words("Any Array Bool Character Data Dictionary Double Float Int Optional Result Set String UInt Void"),
|
|
141
|
+
capitalIsType: true,
|
|
142
|
+
};
|
|
143
|
+
export const ruby = {
|
|
144
|
+
lineComments: ["#"],
|
|
145
|
+
strings: QUOTED,
|
|
146
|
+
variableSigils: ["@@", "@", "$"],
|
|
147
|
+
keywords: words(`
|
|
148
|
+
alias and begin break case class def defined? do else elsif end ensure for if in module
|
|
149
|
+
next not or redo rescue retry return self super then unless until when while yield
|
|
150
|
+
`),
|
|
151
|
+
constants: words("true false nil __FILE__ __LINE__"),
|
|
152
|
+
capitalIsType: true,
|
|
153
|
+
};
|
|
154
|
+
export const php = {
|
|
155
|
+
lineComments: ["//", "#"],
|
|
156
|
+
blockComments: [["/*", "*/"]],
|
|
157
|
+
strings: QUOTED,
|
|
158
|
+
variableSigils: ["$"],
|
|
159
|
+
keywords: words(`
|
|
160
|
+
abstract and array as break callable case catch class clone const continue declare default
|
|
161
|
+
do echo else elseif empty enddeclare endfor endforeach endif endswitch endwhile enum extends
|
|
162
|
+
final finally fn for foreach function global goto if implements include include_once
|
|
163
|
+
instanceof insteadof interface isset list match namespace new or print private protected
|
|
164
|
+
public readonly require require_once return static switch throw trait try unset use var
|
|
165
|
+
while xor yield
|
|
166
|
+
`),
|
|
167
|
+
constants: words("true false null TRUE FALSE NULL"),
|
|
168
|
+
capitalIsType: true,
|
|
169
|
+
};
|
|
170
|
+
export const shell = {
|
|
171
|
+
lineComments: ["#"],
|
|
172
|
+
strings: [{ open: '"', multiline: true, escape: "\\" }, { open: "'", multiline: true }],
|
|
173
|
+
variableSigils: ["$"],
|
|
174
|
+
keywords: words(`
|
|
175
|
+
alias break case cd continue do done echo elif else esac exec exit export fi for function
|
|
176
|
+
if in local return set shift source then time trap unset until while
|
|
177
|
+
`),
|
|
178
|
+
constants: words("true false"),
|
|
179
|
+
};
|
|
180
|
+
export const sql = {
|
|
181
|
+
lineComments: ["--"],
|
|
182
|
+
blockComments: [["/*", "*/"]],
|
|
183
|
+
// SQL escapes a quote by doubling it, which a backslash rule gets wrong;
|
|
184
|
+
// no escape character is the honest setting.
|
|
185
|
+
strings: [{ open: "'" }, { open: '"' }],
|
|
186
|
+
keywords: words(`
|
|
187
|
+
ADD ALL ALTER AND AS ASC AUTOINCREMENT BEGIN BETWEEN BY CASCADE CASE CHECK COLLATE COLUMN
|
|
188
|
+
COMMIT CONFLICT CONSTRAINT CREATE CROSS DEFAULT DELETE DESC DISTINCT DROP ELSE END EXCEPT
|
|
189
|
+
EXISTS FOREIGN FROM FULL GROUP HAVING IF IN INDEX INNER INSERT INTERSECT INTO IS JOIN KEY
|
|
190
|
+
LEFT LIKE LIMIT NOT NULL OFFSET ON OR ORDER OUTER PRAGMA PRIMARY REFERENCES REPLACE RETURNING
|
|
191
|
+
RIGHT ROLLBACK SELECT SET TABLE THEN TRANSACTION UNION UNIQUE UPDATE USING VACUUM VALUES
|
|
192
|
+
VIEW WHEN WHERE WITH
|
|
193
|
+
add all alter and as asc begin between by case check collate column commit constraint create
|
|
194
|
+
cross default delete desc distinct drop else end except exists foreign from full group having
|
|
195
|
+
if in index inner insert intersect into is join key left like limit not null offset on or
|
|
196
|
+
order outer pragma primary references replace returning right rollback select set table then
|
|
197
|
+
transaction union unique update using values view when where with
|
|
198
|
+
`),
|
|
199
|
+
constants: words("TRUE FALSE NULL true false null"),
|
|
200
|
+
};
|
|
201
|
+
export const lua = {
|
|
202
|
+
lineComments: ["--"],
|
|
203
|
+
blockComments: [["--[[", "]]"]],
|
|
204
|
+
strings: [{ open: "[[", close: "]]", multiline: true }, ...QUOTED],
|
|
205
|
+
keywords: words(`
|
|
206
|
+
and break do else elseif end for function goto if in local not or repeat return then until
|
|
207
|
+
while
|
|
208
|
+
`),
|
|
209
|
+
constants: words("true false nil self"),
|
|
210
|
+
};
|
|
211
|
+
export const json = {
|
|
212
|
+
// JSONC and every `tsconfig.json` in the wild. Plain JSON has no comments,
|
|
213
|
+
// and a highlighter that shows one anyway is showing the file it has.
|
|
214
|
+
lineComments: ["//"],
|
|
215
|
+
blockComments: [["/*", "*/"]],
|
|
216
|
+
strings: [{ open: '"', escape: "\\" }],
|
|
217
|
+
constants: words("true false null"),
|
|
218
|
+
propertyBeforeColon: true,
|
|
219
|
+
};
|
|
220
|
+
/** Text with no grammar at all: no comments, no keywords, nothing claimed. */
|
|
221
|
+
export const plain = {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Language } from "./languages.js";
|
|
2
|
+
import type { TokenLine } from "./types.js";
|
|
3
|
+
export { extensionOf, languageFor, PLAIN_TEXT } from "./languages.js";
|
|
4
|
+
export type { Language } from "./languages.js";
|
|
5
|
+
export type { Token, TokenKind, TokenLine } from "./types.js";
|
|
6
|
+
/** Tokenize `text` and cut it into lines. Pure and synchronous: a viewer that
|
|
7
|
+
* has the bytes has the highlighting, with no second render to wait for. */
|
|
8
|
+
export declare function highlight(text: string, language: Language): readonly TokenLine[];
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// The highlighter's whole public surface: a language, and one function that
|
|
2
|
+
// turns text into lines of tokens.
|
|
3
|
+
import { splitLines } from "./tokenize.js";
|
|
4
|
+
export { extensionOf, languageFor, PLAIN_TEXT } from "./languages.js";
|
|
5
|
+
/** Tokenize `text` and cut it into lines. Pure and synchronous: a viewer that
|
|
6
|
+
* has the bytes has the highlighting, with no second render to wait for. */
|
|
7
|
+
export function highlight(text, language) {
|
|
8
|
+
return splitLines(language.tokenize(text));
|
|
9
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Token } from "./types.js";
|
|
2
|
+
export interface Language {
|
|
3
|
+
readonly id: string;
|
|
4
|
+
/** What the kind chip says: the language's own name, as its users spell it. */
|
|
5
|
+
readonly label: string;
|
|
6
|
+
readonly tokenize: (text: string) => readonly Token[];
|
|
7
|
+
}
|
|
8
|
+
export declare const PLAIN_TEXT: Language;
|
|
9
|
+
/** The last dot-segment of a name, lowercased. `""` when there is no dot. */
|
|
10
|
+
export declare function extensionOf(name: string): string;
|
|
11
|
+
/** The language a file name claims, or `null` when no entry matches — which
|
|
12
|
+
* is a different answer from "plain text", and the caller decides what to do
|
|
13
|
+
* with the difference. */
|
|
14
|
+
export declare function languageFor(name: string): Language | null;
|