@lapis-notes/history 0.1.4 → 0.2.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/CHANGELOG.md +19 -0
- package/README.md +1 -1
- package/dist/repository/NOTICE.md +11 -0
- package/dist/repository/components/RepositoryAuthorAvatar.svelte +77 -0
- package/dist/repository/components/RepositoryAuthorAvatar.svelte.d.ts +11 -0
- package/dist/repository/components/RepositoryBackupStatus.svelte +236 -0
- package/dist/repository/components/RepositoryBackupStatus.svelte.d.ts +11 -0
- package/dist/repository/components/RepositoryChangedFiles.svelte +104 -0
- package/dist/repository/components/RepositoryChangedFiles.svelte.d.ts +13 -0
- package/dist/repository/components/RepositoryCommitMessage.svelte +93 -0
- package/dist/repository/components/RepositoryCommitMessage.svelte.d.ts +6 -0
- package/dist/repository/components/RepositoryCommitPicker.svelte +205 -0
- package/dist/repository/components/RepositoryCommitPicker.svelte.d.ts +17 -0
- package/dist/repository/components/RepositoryComparisonBar.svelte +71 -0
- package/dist/repository/components/RepositoryComparisonBar.svelte.d.ts +9 -0
- package/dist/repository/components/RepositoryComparisonTime.svelte +32 -0
- package/dist/repository/components/RepositoryComparisonTime.svelte.d.ts +6 -0
- package/dist/repository/components/RepositoryDiff.svelte +56 -0
- package/dist/repository/components/RepositoryDiff.svelte.d.ts +11 -0
- package/dist/repository/components/RepositoryDiffColumn.svelte +78 -0
- package/dist/repository/components/RepositoryDiffColumn.svelte.d.ts +14 -0
- package/dist/repository/components/RepositoryDiffControls.svelte +117 -0
- package/dist/repository/components/RepositoryDiffControls.svelte.d.ts +8 -0
- package/dist/repository/components/RepositoryFileHistory.svelte +170 -0
- package/dist/repository/components/RepositoryFileHistory.svelte.d.ts +10 -0
- package/dist/repository/components/RepositoryFileTitle.svelte +30 -0
- package/dist/repository/components/RepositoryFileTitle.svelte.d.ts +6 -0
- package/dist/repository/components/RepositoryGraph.svelte +216 -0
- package/dist/repository/components/RepositoryGraph.svelte.d.ts +19 -0
- package/dist/repository/components/RepositoryGraphSvg.svelte +110 -0
- package/dist/repository/components/RepositoryGraphSvg.svelte.d.ts +11 -0
- package/dist/repository/components/RepositoryIdentifiers.svelte +221 -0
- package/dist/repository/components/RepositoryIdentifiers.svelte.d.ts +15 -0
- package/dist/repository/components/RepositoryLogHeader.svelte +90 -0
- package/dist/repository/components/RepositoryLogHeader.svelte.d.ts +23 -0
- package/dist/repository/components/RepositoryOperationArguments.svelte +52 -0
- package/dist/repository/components/RepositoryOperationArguments.svelte.d.ts +6 -0
- package/dist/repository/components/RepositoryOperationColumn.svelte +163 -0
- package/dist/repository/components/RepositoryOperationColumn.svelte.d.ts +11 -0
- package/dist/repository/components/RepositoryOperationFiles.svelte +245 -0
- package/dist/repository/components/RepositoryOperationFiles.svelte.d.ts +14 -0
- package/dist/repository/components/RepositoryOperationMessage.svelte +169 -0
- package/dist/repository/components/RepositoryOperationMessage.svelte.d.ts +10 -0
- package/dist/repository/components/RepositoryOperationOption.svelte +183 -0
- package/dist/repository/components/RepositoryOperationOption.svelte.d.ts +10 -0
- package/dist/repository/components/RepositoryOperationParentPicker.svelte +188 -0
- package/dist/repository/components/RepositoryOperationParentPicker.svelte.d.ts +14 -0
- package/dist/repository/components/RepositoryOperationPinPicker.svelte +170 -0
- package/dist/repository/components/RepositoryOperationPinPicker.svelte.d.ts +13 -0
- package/dist/repository/components/RepositoryOperationRail.svelte +136 -0
- package/dist/repository/components/RepositoryOperationRail.svelte.d.ts +9 -0
- package/dist/repository/components/RepositoryOperationTarget.svelte +99 -0
- package/dist/repository/components/RepositoryOperationTarget.svelte.d.ts +8 -0
- package/dist/repository/components/RepositoryOperations.svelte +199 -0
- package/dist/repository/components/RepositoryOperations.svelte.d.ts +12 -0
- package/dist/repository/components/RepositoryPanel.svelte +207 -0
- package/dist/repository/components/RepositoryPanel.svelte.d.ts +15 -0
- package/dist/repository/components/RepositoryParentSummary.svelte +52 -0
- package/dist/repository/components/RepositoryParentSummary.svelte.d.ts +10 -0
- package/dist/repository/components/RepositoryPickerSearch.svelte +51 -0
- package/dist/repository/components/RepositoryPickerSearch.svelte.d.ts +11 -0
- package/dist/repository/components/RepositoryRestoreDialog.svelte +81 -0
- package/dist/repository/components/RepositoryRestoreDialog.svelte.d.ts +7 -0
- package/dist/repository/components/RepositoryRevisionActions.svelte +53 -0
- package/dist/repository/components/RepositoryRevisionActions.svelte.d.ts +9 -0
- package/dist/repository/components/RepositoryRevisionFiles.svelte +110 -0
- package/dist/repository/components/RepositoryRevisionFiles.svelte.d.ts +14 -0
- package/dist/repository/components/RepositoryRevisionOption.svelte +60 -0
- package/dist/repository/components/RepositoryRevisionOption.svelte.d.ts +9 -0
- package/dist/repository/components/RepositoryRevisionPicker.svelte +165 -0
- package/dist/repository/components/RepositoryRevisionPicker.svelte.d.ts +14 -0
- package/dist/repository/components/RepositoryRevisions.svelte +115 -0
- package/dist/repository/components/RepositoryRevisions.svelte.d.ts +20 -0
- package/dist/repository/components/RepositoryShell.svelte +44 -0
- package/dist/repository/components/RepositoryShell.svelte.d.ts +11 -0
- package/dist/repository/components/RepositorySkeleton.svelte +138 -0
- package/dist/repository/components/RepositorySkeleton.svelte.d.ts +7 -0
- package/dist/repository/components/RepositorySourcePicker.svelte +114 -0
- package/dist/repository/components/RepositorySourcePicker.svelte.d.ts +7 -0
- package/dist/repository/components/RepositoryUpstreamActions.svelte +125 -0
- package/dist/repository/components/RepositoryUpstreamActions.svelte.d.ts +8 -0
- package/dist/repository/components/RepositoryWorkingCopyStatus.svelte +290 -0
- package/dist/repository/components/RepositoryWorkingCopyStatus.svelte.d.ts +11 -0
- package/dist/repository/components/RepositoryWorkspacePicker.svelte +158 -0
- package/dist/repository/components/RepositoryWorkspacePicker.svelte.d.ts +11 -0
- package/dist/repository/components/backup/AdoptionSettings.svelte +95 -0
- package/dist/repository/components/backup/AdoptionSettings.svelte.d.ts +7 -0
- package/dist/repository/components/backup/BackupCard.svelte +79 -0
- package/dist/repository/components/backup/BackupCard.svelte.d.ts +14 -0
- package/dist/repository/components/backup/BackupField.svelte +45 -0
- package/dist/repository/components/backup/BackupField.svelte.d.ts +10 -0
- package/dist/repository/components/backup/BackupSelect.svelte +71 -0
- package/dist/repository/components/backup/BackupSelect.svelte.d.ts +35 -0
- package/dist/repository/components/backup/BackupSettings.svelte +122 -0
- package/dist/repository/components/backup/BackupSettings.svelte.d.ts +18 -0
- package/dist/repository/components/backup/BackupSettingsField.svelte +13 -0
- package/dist/repository/components/backup/BackupSettingsField.svelte.d.ts +4 -0
- package/dist/repository/components/backup/ForgeAccounts.svelte +231 -0
- package/dist/repository/components/backup/ForgeAccounts.svelte.d.ts +9 -0
- package/dist/repository/components/backup/ForgeAuthorization.svelte +267 -0
- package/dist/repository/components/backup/ForgeAuthorization.svelte.d.ts +9 -0
- package/dist/repository/components/backup/ForgeIcon.svelte +21 -0
- package/dist/repository/components/backup/ForgeIcon.svelte.d.ts +7 -0
- package/dist/repository/components/backup/PublicationRecovery.svelte +129 -0
- package/dist/repository/components/backup/PublicationRecovery.svelte.d.ts +11 -0
- package/dist/repository/components/backup/RemoteSettings.svelte +288 -0
- package/dist/repository/components/backup/RemoteSettings.svelte.d.ts +11 -0
- package/dist/repository/components/backup/RepositorySettingsPage.svelte +51 -0
- package/dist/repository/components/backup/RepositorySettingsPage.svelte.d.ts +4 -0
- package/dist/repository/components/backup/StorageSettings.svelte +158 -0
- package/dist/repository/components/backup/StorageSettings.svelte.d.ts +7 -0
- package/dist/repository/components/backup/SyncConflictEditor.svelte +158 -0
- package/dist/repository/components/backup/SyncConflictEditor.svelte.d.ts +9 -0
- package/dist/repository/components/backup/SyncSettings.svelte +97 -0
- package/dist/repository/components/backup/SyncSettings.svelte.d.ts +9 -0
- package/dist/repository/components/backup/adoption-settings.d.ts +7 -0
- package/dist/repository/components/backup/adoption-settings.js +42 -0
- package/dist/repository/components/backup/backup-settings.d.ts +35 -0
- package/dist/repository/components/backup/backup-settings.js +96 -0
- package/dist/repository/components/backup/forge-icons.d.ts +10 -0
- package/dist/repository/components/backup/forge-icons.js +11 -0
- package/dist/repository/components/backup/remote-restore.d.ts +3 -0
- package/dist/repository/components/backup/remote-restore.js +17 -0
- package/dist/repository/components/backup/storage-settings.d.ts +8 -0
- package/dist/repository/components/backup/storage-settings.js +23 -0
- package/dist/repository/components/blame/RepositoryBlameCommitTitle.svelte +212 -0
- package/dist/repository/components/blame/RepositoryBlameCommitTitle.svelte.d.ts +14 -0
- package/dist/repository/components/blame/RepositoryBlameGroup.svelte +189 -0
- package/dist/repository/components/blame/RepositoryBlameGroup.svelte.d.ts +20 -0
- package/dist/repository/components/blame/RepositoryBlamePanel.svelte +148 -0
- package/dist/repository/components/blame/RepositoryBlamePanel.svelte.d.ts +13 -0
- package/dist/repository/components/blame/RepositoryBlameRows.svelte +137 -0
- package/dist/repository/components/blame/RepositoryBlameRows.svelte.d.ts +32 -0
- package/dist/repository/components/blame/RepositoryBlameView.svelte +121 -0
- package/dist/repository/components/blame/RepositoryBlameView.svelte.d.ts +16 -0
- package/dist/repository/components/blame/blame-view.d.ts +16 -0
- package/dist/repository/components/blame/blame-view.js +73 -0
- package/dist/repository/components/blame/editor-actions.d.ts +3 -0
- package/dist/repository/components/blame/editor-actions.js +53 -0
- package/dist/repository/components/conflicts/RepositoryConflictActions.svelte +83 -0
- package/dist/repository/components/conflicts/RepositoryConflictActions.svelte.d.ts +13 -0
- package/dist/repository/components/conflicts/RepositoryConflictBody.svelte +93 -0
- package/dist/repository/components/conflicts/RepositoryConflictBody.svelte.d.ts +16 -0
- package/dist/repository/components/conflicts/RepositoryConflictFileTree.svelte +84 -0
- package/dist/repository/components/conflicts/RepositoryConflictFileTree.svelte.d.ts +21 -0
- package/dist/repository/components/conflicts/RepositoryConflictPath.svelte +35 -0
- package/dist/repository/components/conflicts/RepositoryConflictPath.svelte.d.ts +9 -0
- package/dist/repository/components/conflicts/RepositoryConflictResolution.svelte +133 -0
- package/dist/repository/components/conflicts/RepositoryConflictResolution.svelte.d.ts +12 -0
- package/dist/repository/components/conflicts/RepositoryConflictSurface.svelte +105 -0
- package/dist/repository/components/conflicts/RepositoryConflictSurface.svelte.d.ts +23 -0
- package/dist/repository/components/conflicts/RepositoryConflictText.svelte +104 -0
- package/dist/repository/components/conflicts/RepositoryConflictText.svelte.d.ts +26 -0
- package/dist/repository/components/conflicts/RepositorySidebarToggleIcon.svelte +52 -0
- package/dist/repository/components/conflicts/RepositorySidebarToggleIcon.svelte.d.ts +7 -0
- package/dist/repository/components/conflicts/repository-conflict-file-tree.css +73 -0
- package/dist/repository/components/conflicts/repository-conflicts.css +125 -0
- package/dist/repository/components/file-history-view.d.ts +15 -0
- package/dist/repository/components/file-history-view.js +110 -0
- package/dist/repository/components/operation-view.d.ts +16 -0
- package/dist/repository/components/operation-view.js +95 -0
- package/dist/repository/components/repository-backup.d.ts +22 -0
- package/dist/repository/components/repository-backup.js +75 -0
- package/dist/repository/components/repository-column-chrome.css +35 -0
- package/dist/repository/components/repository-commit-picker.css +55 -0
- package/dist/repository/components/repository-feedback.d.ts +7 -0
- package/dist/repository/components/repository-feedback.js +40 -0
- package/dist/repository/components/repository-identifiers.css +199 -0
- package/dist/repository/components/repository-navigation.d.ts +4 -0
- package/dist/repository/components/repository-navigation.js +16 -0
- package/dist/repository/components/repository-operation-column.css +112 -0
- package/dist/repository/components/repository-picker-options.css +11 -0
- package/dist/repository/components/repository-plugin.d.ts +33 -0
- package/dist/repository/components/repository-plugin.js +191 -0
- package/dist/repository/components/repository-review-identifiers.css +50 -0
- package/dist/repository/components/repository-status.d.ts +13 -0
- package/dist/repository/components/repository-status.js +227 -0
- package/dist/repository/components/repository-sync.d.ts +13 -0
- package/dist/repository/components/repository-sync.js +93 -0
- package/dist/repository/components/repository-tools.d.ts +3 -0
- package/dist/repository/components/repository-tools.js +13 -0
- package/dist/repository/components/repository-view.d.ts +16 -0
- package/dist/repository/components/repository-view.js +140 -0
- package/dist/repository/components/restore-controller.d.ts +9 -0
- package/dist/repository/components/restore-controller.js +44 -0
- package/dist/repository/components/search/search-provider.d.ts +3 -0
- package/dist/repository/components/search/search-provider.js +185 -0
- package/dist/repository/controllers/adoption-controller.d.ts +29 -0
- package/dist/repository/controllers/adoption-controller.js +145 -0
- package/dist/repository/controllers/adoption.d.ts +30 -0
- package/dist/repository/controllers/adoption.js +21 -0
- package/dist/repository/controllers/ai-history.d.ts +57 -0
- package/dist/repository/controllers/ai-history.js +51 -0
- package/dist/repository/controllers/author.d.ts +2 -0
- package/dist/repository/controllers/author.js +11 -0
- package/dist/repository/controllers/background-work.d.ts +14 -0
- package/dist/repository/controllers/background-work.js +57 -0
- package/dist/repository/controllers/backup-follow.d.ts +5 -0
- package/dist/repository/controllers/backup-follow.js +29 -0
- package/dist/repository/controllers/backup.d.ts +39 -0
- package/dist/repository/controllers/backup.js +129 -0
- package/dist/repository/controllers/blame-chunks.d.ts +13 -0
- package/dist/repository/controllers/blame-chunks.js +51 -0
- package/dist/repository/controllers/blame-controller.d.ts +17 -0
- package/dist/repository/controllers/blame-controller.js +148 -0
- package/dist/repository/controllers/blame-model.d.ts +25 -0
- package/dist/repository/controllers/blame-model.js +31 -0
- package/dist/repository/controllers/blame-preferences.d.ts +3 -0
- package/dist/repository/controllers/blame-preferences.js +18 -0
- package/dist/repository/controllers/commit-cards.d.ts +4 -0
- package/dist/repository/controllers/commit-cards.js +38 -0
- package/dist/repository/controllers/conflict-menu.d.ts +2 -0
- package/dist/repository/controllers/conflict-menu.js +1 -0
- package/dist/repository/controllers/file-history-controller.d.ts +29 -0
- package/dist/repository/controllers/file-history-controller.js +182 -0
- package/dist/repository/controllers/forge-accounts.d.ts +48 -0
- package/dist/repository/controllers/forge-accounts.js +1 -0
- package/dist/repository/controllers/forge-controller.d.ts +24 -0
- package/dist/repository/controllers/forge-controller.js +168 -0
- package/dist/repository/controllers/graph/model.d.ts +20 -0
- package/dist/repository/controllers/graph/model.js +33 -0
- package/dist/repository/controllers/graph/repository-log-graph.d.ts +44 -0
- package/dist/repository/controllers/graph/repository-log-graph.js +182 -0
- package/dist/repository/controllers/graph/repository-log-lanes.d.ts +7 -0
- package/dist/repository/controllers/graph/repository-log-lanes.js +19 -0
- package/dist/repository/controllers/graph/revision-id.d.ts +3 -0
- package/dist/repository/controllers/graph/revision-id.js +10 -0
- package/dist/repository/controllers/history-canvas.d.ts +2 -0
- package/dist/repository/controllers/history-canvas.js +45 -0
- package/dist/repository/controllers/history-controller.d.ts +31 -0
- package/dist/repository/controllers/history-controller.js +238 -0
- package/dist/repository/controllers/history-files.d.ts +7 -0
- package/dist/repository/controllers/history-files.js +18 -0
- package/dist/repository/controllers/history-graph.d.ts +20 -0
- package/dist/repository/controllers/history-graph.js +89 -0
- package/dist/repository/controllers/history-index-controller.d.ts +22 -0
- package/dist/repository/controllers/history-index-controller.js +77 -0
- package/dist/repository/controllers/history-lifetime.d.ts +13 -0
- package/dist/repository/controllers/history-lifetime.js +40 -0
- package/dist/repository/controllers/history-reader.d.ts +22 -0
- package/dist/repository/controllers/history-reader.js +1 -0
- package/dist/repository/controllers/history-search-expression.d.ts +9 -0
- package/dist/repository/controllers/history-search-expression.js +86 -0
- package/dist/repository/controllers/history-selection.d.ts +5 -0
- package/dist/repository/controllers/history-selection.js +32 -0
- package/dist/repository/controllers/history-source.d.ts +10 -0
- package/dist/repository/controllers/history-source.js +7 -0
- package/dist/repository/controllers/history-state.d.ts +34 -0
- package/dist/repository/controllers/history-state.js +55 -0
- package/dist/repository/controllers/indexed-search-validation.d.ts +4 -0
- package/dist/repository/controllers/indexed-search-validation.js +64 -0
- package/dist/repository/controllers/indexed-search.d.ts +11 -0
- package/dist/repository/controllers/indexed-search.js +1 -0
- package/dist/repository/controllers/log-canvas.d.ts +2 -0
- package/dist/repository/controllers/log-canvas.js +25 -0
- package/dist/repository/controllers/native-indexed-search.d.ts +4 -0
- package/dist/repository/controllers/native-indexed-search.js +10 -0
- package/dist/repository/controllers/open-history-revision.d.ts +3 -0
- package/dist/repository/controllers/open-history-revision.js +8 -0
- package/dist/repository/controllers/operation-command.d.ts +2 -0
- package/dist/repository/controllers/operation-command.js +55 -0
- package/dist/repository/controllers/operation-controller.d.ts +33 -0
- package/dist/repository/controllers/operation-controller.js +267 -0
- package/dist/repository/controllers/operation-files.d.ts +33 -0
- package/dist/repository/controllers/operation-files.js +182 -0
- package/dist/repository/controllers/operation-graph.d.ts +17 -0
- package/dist/repository/controllers/operation-graph.js +50 -0
- package/dist/repository/controllers/operation-message.d.ts +5 -0
- package/dist/repository/controllers/operation-message.js +18 -0
- package/dist/repository/controllers/operation-metadata.d.ts +5 -0
- package/dist/repository/controllers/operation-metadata.js +26 -0
- package/dist/repository/controllers/operation-parent.d.ts +5 -0
- package/dist/repository/controllers/operation-parent.js +46 -0
- package/dist/repository/controllers/operation-state.d.ts +28 -0
- package/dist/repository/controllers/operation-state.js +26 -0
- package/dist/repository/controllers/parent-candidates.d.ts +4 -0
- package/dist/repository/controllers/parent-candidates.js +27 -0
- package/dist/repository/controllers/plugin-data.d.ts +9 -0
- package/dist/repository/controllers/plugin-data.js +33 -0
- package/dist/repository/controllers/preparation-queue.d.ts +9 -0
- package/dist/repository/controllers/preparation-queue.js +55 -0
- package/dist/repository/controllers/remote-controller.d.ts +23 -0
- package/dist/repository/controllers/remote-controller.js +98 -0
- package/dist/repository/controllers/remote.d.ts +48 -0
- package/dist/repository/controllers/remote.js +13 -0
- package/dist/repository/controllers/restore-recovery.d.ts +3 -0
- package/dist/repository/controllers/restore-recovery.js +32 -0
- package/dist/repository/controllers/restore.d.ts +66 -0
- package/dist/repository/controllers/restore.js +201 -0
- package/dist/repository/controllers/revision-comparison.d.ts +20 -0
- package/dist/repository/controllers/revision-comparison.js +89 -0
- package/dist/repository/controllers/search-controller.d.ts +19 -0
- package/dist/repository/controllers/search-controller.js +105 -0
- package/dist/repository/controllers/search-page.d.ts +2 -0
- package/dist/repository/controllers/search-page.js +39 -0
- package/dist/repository/controllers/search.d.ts +51 -0
- package/dist/repository/controllers/search.js +8 -0
- package/dist/repository/controllers/services.d.ts +7 -0
- package/dist/repository/controllers/services.js +24 -0
- package/dist/repository/controllers/storage-controller.d.ts +30 -0
- package/dist/repository/controllers/storage-controller.js +130 -0
- package/dist/repository/controllers/storage.d.ts +26 -0
- package/dist/repository/controllers/storage.js +1 -0
- package/dist/repository/controllers/sync-application.d.ts +17 -0
- package/dist/repository/controllers/sync-application.js +45 -0
- package/dist/repository/controllers/sync-controller.d.ts +31 -0
- package/dist/repository/controllers/sync-controller.js +300 -0
- package/dist/repository/controllers/sync-publication.d.ts +7 -0
- package/dist/repository/controllers/sync-publication.js +29 -0
- package/dist/repository/controllers/sync-recovery.d.ts +7 -0
- package/dist/repository/controllers/sync-recovery.js +27 -0
- package/dist/repository/controllers/sync.d.ts +62 -0
- package/dist/repository/controllers/sync.js +38 -0
- package/dist/repository/controllers/tags.d.ts +7 -0
- package/dist/repository/controllers/tags.js +71 -0
- package/dist/repository/controllers/transcript-paths.d.ts +2 -0
- package/dist/repository/controllers/transcript-paths.js +17 -0
- package/dist/repository/controllers/transcript-writers.d.ts +9 -0
- package/dist/repository/controllers/transcript-writers.js +37 -0
- package/dist/repository/controllers/working-copy-controller.d.ts +22 -0
- package/dist/repository/controllers/working-copy-controller.js +58 -0
- package/dist/repository/controllers/working-copy-status.d.ts +16 -0
- package/dist/repository/controllers/working-copy-status.js +57 -0
- package/dist/repository/controllers/workspaces.d.ts +7 -0
- package/dist/repository/controllers/workspaces.js +4 -0
- package/dist/repository/index.d.ts +9 -0
- package/dist/repository/index.js +6 -0
- package/manifest.json +2 -2
- package/package.json +41 -9
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import * as laneState from "./repository-log-lanes.js";
|
|
2
|
+
export const REPOSITORY_LOG_ROW_HEIGHT = 76;
|
|
3
|
+
export const REPOSITORY_LOG_LANE_WIDTH = 12;
|
|
4
|
+
export const REPOSITORY_LOG_NODE_RADIUS = 4;
|
|
5
|
+
export const REPOSITORY_LOG_LEFT_PAD = 8;
|
|
6
|
+
export const REPOSITORY_LOG_STROKE_WIDTH = 2.5;
|
|
7
|
+
export const REPOSITORY_LOG_LANE_COLORS = [
|
|
8
|
+
"var(--ui-log-lane-1, #2563eb)",
|
|
9
|
+
"var(--ui-log-lane-2, #16a34a)",
|
|
10
|
+
"var(--ui-log-lane-3, #d97706)",
|
|
11
|
+
"var(--ui-log-lane-4, #dc2626)",
|
|
12
|
+
"var(--ui-log-lane-5, #7c3aed)",
|
|
13
|
+
"var(--ui-log-lane-6, #0891b2)",
|
|
14
|
+
"var(--ui-log-lane-7, #db2777)",
|
|
15
|
+
"var(--ui-log-lane-8, #65a30d)",
|
|
16
|
+
];
|
|
17
|
+
const JJ_REVERSE_HEX = "zyxwvutsrqponmlk";
|
|
18
|
+
export const REPOSITORY_LOG_ID_PREFIX = 8;
|
|
19
|
+
export function encodeJjChangeId(hex) {
|
|
20
|
+
if (!/^[0-9a-fA-F]+$/u.test(hex) || hex.length % 2 !== 0)
|
|
21
|
+
return "";
|
|
22
|
+
return [...hex.toLowerCase()]
|
|
23
|
+
.map((digit) => JJ_REVERSE_HEX[Number.parseInt(digit, 16)] ?? "")
|
|
24
|
+
.join("");
|
|
25
|
+
}
|
|
26
|
+
export function shortestRepositoryLogPrefix(values, min = REPOSITORY_LOG_ID_PREFIX) {
|
|
27
|
+
const prefixes = new Map();
|
|
28
|
+
for (const value of values) {
|
|
29
|
+
if (!value)
|
|
30
|
+
continue;
|
|
31
|
+
let length = Math.min(Math.max(min, 1), value.length);
|
|
32
|
+
while (length < value.length &&
|
|
33
|
+
values.some((other) => other !== value && other.startsWith(value.slice(0, length)))) {
|
|
34
|
+
length += 1;
|
|
35
|
+
}
|
|
36
|
+
prefixes.set(value, value.slice(0, length));
|
|
37
|
+
}
|
|
38
|
+
return prefixes;
|
|
39
|
+
}
|
|
40
|
+
export function repositoryLogRowLabel(row) {
|
|
41
|
+
return [
|
|
42
|
+
row.revision.message,
|
|
43
|
+
row.changeIdShort,
|
|
44
|
+
row.commitIdShort,
|
|
45
|
+
row.revision.reason === "merge" ? "Merge" : "",
|
|
46
|
+
]
|
|
47
|
+
.filter(Boolean)
|
|
48
|
+
.join(" ");
|
|
49
|
+
}
|
|
50
|
+
export function tipRevisionIds(revisions) {
|
|
51
|
+
const referenced = new Set();
|
|
52
|
+
for (const revision of revisions) {
|
|
53
|
+
for (const parent of revision.parents)
|
|
54
|
+
referenced.add(parent);
|
|
55
|
+
}
|
|
56
|
+
return revisions
|
|
57
|
+
.filter((revision) => !referenced.has(revision.eventId))
|
|
58
|
+
.map((revision) => revision.eventId);
|
|
59
|
+
}
|
|
60
|
+
export function repositoryLogLaneX(lane) {
|
|
61
|
+
return (REPOSITORY_LOG_LEFT_PAD +
|
|
62
|
+
lane * REPOSITORY_LOG_LANE_WIDTH +
|
|
63
|
+
REPOSITORY_LOG_LANE_WIDTH / 2);
|
|
64
|
+
}
|
|
65
|
+
export function repositoryLogLaneStem(row, lane, rowHeight = REPOSITORY_LOG_ROW_HEIGHT) {
|
|
66
|
+
if (row.lanes[lane]?.hash == null)
|
|
67
|
+
return { y1: 0, y2: 0 };
|
|
68
|
+
const center = rowHeight / 2;
|
|
69
|
+
const isSplitCommitLane = row.splitFromLane != null && lane === row.commitLane;
|
|
70
|
+
const starts = row.commitStartsLane && row.commitLane === lane && !isSplitCommitLane;
|
|
71
|
+
const converge = row.convergingLanes.includes(lane);
|
|
72
|
+
return {
|
|
73
|
+
y1: row.isFirst || starts ? center : 0,
|
|
74
|
+
y2: isSplitCommitLane ? center : converge ? 0 : rowHeight,
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
export function repositoryLogSplitPath(parentX, commitX, rowHeight = REPOSITORY_LOG_ROW_HEIGHT) {
|
|
78
|
+
const centerY = rowHeight / 2;
|
|
79
|
+
return `M ${parentX} ${rowHeight} C ${parentX} ${rowHeight - 10}, ${commitX} ${centerY + 10}, ${commitX} ${centerY}`;
|
|
80
|
+
}
|
|
81
|
+
export function repositoryLogMergePath(commitX, parentX, rowHeight = REPOSITORY_LOG_ROW_HEIGHT) {
|
|
82
|
+
const centerY = rowHeight / 2;
|
|
83
|
+
return `M ${commitX} ${centerY} C ${commitX} ${centerY + 14}, ${parentX} ${centerY + 6}, ${parentX} ${rowHeight}`;
|
|
84
|
+
}
|
|
85
|
+
export function repositoryLogConvergePath(fromX, commitX, rowHeight = REPOSITORY_LOG_ROW_HEIGHT) {
|
|
86
|
+
const centerY = rowHeight / 2;
|
|
87
|
+
return `M ${fromX} 0 C ${fromX} 10, ${commitX} ${centerY - 10}, ${commitX} ${centerY}`;
|
|
88
|
+
}
|
|
89
|
+
export function repositoryLogContentLeft(row) {
|
|
90
|
+
const rightmost = Math.max(row.lanes.length - 1, row.mergeFromLanes.length ? Math.max(...row.mergeFromLanes) : 0, row.commitLane);
|
|
91
|
+
return (REPOSITORY_LOG_LEFT_PAD +
|
|
92
|
+
(rightmost + 1) * REPOSITORY_LOG_LANE_WIDTH +
|
|
93
|
+
REPOSITORY_LOG_LANE_WIDTH);
|
|
94
|
+
}
|
|
95
|
+
export function repositoryLogSvgWidth(rows) {
|
|
96
|
+
let maxLanes = 1;
|
|
97
|
+
for (const row of rows) {
|
|
98
|
+
maxLanes = Math.max(maxLanes, row.lanes.length, row.mergeFromLanes.length ? Math.max(...row.mergeFromLanes) + 1 : 0, row.commitLane + 1);
|
|
99
|
+
}
|
|
100
|
+
return (REPOSITORY_LOG_LEFT_PAD +
|
|
101
|
+
maxLanes * REPOSITORY_LOG_LANE_WIDTH +
|
|
102
|
+
REPOSITORY_LOG_LANE_WIDTH);
|
|
103
|
+
}
|
|
104
|
+
export function buildRepositoryLogGraph(revisions, devices = []) {
|
|
105
|
+
const lanes = [];
|
|
106
|
+
let colorIndex = 0;
|
|
107
|
+
const rows = [];
|
|
108
|
+
const tips = new Set(tipRevisionIds(revisions));
|
|
109
|
+
const aliasesByHead = new Map();
|
|
110
|
+
for (const device of devices) {
|
|
111
|
+
const aliases = aliasesByHead.get(device.revisionEventId) ?? [];
|
|
112
|
+
aliases.push(device.alias);
|
|
113
|
+
aliasesByHead.set(device.revisionEventId, aliases);
|
|
114
|
+
}
|
|
115
|
+
const changeIds = revisions.map((revision) => encodeJjChangeId(revision.changeId));
|
|
116
|
+
const changeShorts = shortestRepositoryLogPrefix(changeIds);
|
|
117
|
+
const commitShorts = shortestRepositoryLogPrefix(revisions.map((revision) => revision.eventId));
|
|
118
|
+
for (let commitIndex = 0; commitIndex < revisions.length; commitIndex += 1) {
|
|
119
|
+
const revision = revisions[commitIndex];
|
|
120
|
+
if (!revision)
|
|
121
|
+
continue;
|
|
122
|
+
let commitLane = lanes.findIndex((lane) => lane.hash === revision.eventId);
|
|
123
|
+
let commitStartsLane = false;
|
|
124
|
+
if (commitLane === -1) {
|
|
125
|
+
commitStartsLane = true;
|
|
126
|
+
commitLane = laneState.occupyRepositoryLogLane(lanes, revision.eventId, REPOSITORY_LOG_LANE_COLORS[colorIndex++ % REPOSITORY_LOG_LANE_COLORS.length] ?? REPOSITORY_LOG_LANE_COLORS[0]);
|
|
127
|
+
}
|
|
128
|
+
const currentLanes = lanes.map((lane) => ({ ...lane }));
|
|
129
|
+
const convergingLanes = currentLanes.flatMap((lane, index) => lane.hash === revision.eventId && index !== commitLane ? [index] : []);
|
|
130
|
+
const firstParent = revision.parents[0];
|
|
131
|
+
const otherParents = revision.parents.slice(1);
|
|
132
|
+
const firstParentLane = firstParent
|
|
133
|
+
? currentLanes.findIndex((lane) => lane.hash === firstParent)
|
|
134
|
+
: -1;
|
|
135
|
+
const splitFromLane = commitStartsLane &&
|
|
136
|
+
firstParentLane !== -1 &&
|
|
137
|
+
firstParentLane !== commitLane
|
|
138
|
+
? firstParentLane
|
|
139
|
+
: null;
|
|
140
|
+
const currentColor = lanes[commitLane]?.color ?? REPOSITORY_LOG_LANE_COLORS[0];
|
|
141
|
+
const continueLane = commitLane;
|
|
142
|
+
for (let index = lanes.length - 1; index >= 0; index -= 1) {
|
|
143
|
+
if (index !== continueLane && lanes[index]?.hash === revision.eventId) {
|
|
144
|
+
laneState.vacateRepositoryLogLane(lanes, index);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
if (firstParent) {
|
|
148
|
+
lanes[continueLane] = { hash: firstParent, color: currentColor };
|
|
149
|
+
}
|
|
150
|
+
else {
|
|
151
|
+
laneState.vacateRepositoryLogLane(lanes, continueLane);
|
|
152
|
+
}
|
|
153
|
+
laneState.trimRepositoryLogLanes(lanes);
|
|
154
|
+
const mergeFromLanes = [];
|
|
155
|
+
for (const parent of otherParents) {
|
|
156
|
+
const existing = lanes.findIndex((lane) => lane.hash === parent);
|
|
157
|
+
if (existing !== -1) {
|
|
158
|
+
mergeFromLanes.push(existing);
|
|
159
|
+
continue;
|
|
160
|
+
}
|
|
161
|
+
const parentLane = laneState.occupyRepositoryLogLane(lanes, parent, REPOSITORY_LOG_LANE_COLORS[colorIndex++ % REPOSITORY_LOG_LANE_COLORS.length] ?? REPOSITORY_LOG_LANE_COLORS[0]);
|
|
162
|
+
mergeFromLanes.push(parentLane);
|
|
163
|
+
}
|
|
164
|
+
rows.push({
|
|
165
|
+
revision,
|
|
166
|
+
commitLane,
|
|
167
|
+
lanes: currentLanes,
|
|
168
|
+
mergeFromLanes,
|
|
169
|
+
convergingLanes,
|
|
170
|
+
splitFromLane,
|
|
171
|
+
commitStartsLane,
|
|
172
|
+
isFirst: commitIndex === 0,
|
|
173
|
+
isTip: tips.has(revision.eventId),
|
|
174
|
+
deviceAliases: aliasesByHead.get(revision.eventId) ?? [],
|
|
175
|
+
changeIdShort: changeShorts.get(changeIds[commitIndex] ?? "") ?? "",
|
|
176
|
+
changeIdEncoded: changeIds[commitIndex] ?? "",
|
|
177
|
+
commitIdShort: commitShorts.get(revision.eventId) ??
|
|
178
|
+
revision.eventId.slice(0, REPOSITORY_LOG_ID_PREFIX),
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
return rows;
|
|
182
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type RepositoryLogGraphLane = {
|
|
2
|
+
hash: string | null;
|
|
3
|
+
color: string;
|
|
4
|
+
};
|
|
5
|
+
export declare function occupyRepositoryLogLane(lanes: RepositoryLogGraphLane[], hash: string, color: string): number;
|
|
6
|
+
export declare function vacateRepositoryLogLane(lanes: RepositoryLogGraphLane[], index: number): void;
|
|
7
|
+
export declare function trimRepositoryLogLanes(lanes: RepositoryLogGraphLane[]): void;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export function occupyRepositoryLogLane(lanes, hash, color) {
|
|
2
|
+
const vacant = lanes.findIndex((lane) => lane.hash == null);
|
|
3
|
+
const index = vacant === -1 ? lanes.length : vacant;
|
|
4
|
+
const lane = { hash, color };
|
|
5
|
+
if (vacant === -1)
|
|
6
|
+
lanes.push(lane);
|
|
7
|
+
else
|
|
8
|
+
lanes[index] = lane;
|
|
9
|
+
return index;
|
|
10
|
+
}
|
|
11
|
+
export function vacateRepositoryLogLane(lanes, index) {
|
|
12
|
+
const lane = lanes[index];
|
|
13
|
+
if (lane)
|
|
14
|
+
lanes[index] = { ...lane, hash: null };
|
|
15
|
+
}
|
|
16
|
+
export function trimRepositoryLogLanes(lanes) {
|
|
17
|
+
while (lanes.length > 0 && lanes.at(-1)?.hash == null)
|
|
18
|
+
lanes.pop();
|
|
19
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/** Keep a recognisable prefix and the final two characters without lengthening short IDs. */
|
|
2
|
+
export declare function abbreviateRevisionId(value: string, leadingChars?: number): string;
|
|
3
|
+
export declare function revisionLeadingChars(value: number, fallback: number): number;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** Keep a recognisable prefix and the final two characters without lengthening short IDs. */
|
|
2
|
+
export function abbreviateRevisionId(value, leadingChars = 5) {
|
|
3
|
+
const leading = revisionLeadingChars(leadingChars, 5);
|
|
4
|
+
return value.length <= leading + 4
|
|
5
|
+
? value
|
|
6
|
+
: `${value.slice(0, leading)}..${value.slice(-2)}`;
|
|
7
|
+
}
|
|
8
|
+
export function revisionLeadingChars(value, fallback) {
|
|
9
|
+
return Number.isFinite(value) ? Math.max(1, Math.floor(value)) : fallback;
|
|
10
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { createColumnCanvasController } from "@lapismd/design-core/shadcn/column-canvas";
|
|
2
|
+
/** Adaptation of jj-store's log/diff/evolution geometry. */
|
|
3
|
+
export function createHistoryCanvas() {
|
|
4
|
+
return createColumnCanvasController({
|
|
5
|
+
columns: {
|
|
6
|
+
revisions: {
|
|
7
|
+
defaultWidth: 480,
|
|
8
|
+
minWidth: 360,
|
|
9
|
+
maxWidth: 720,
|
|
10
|
+
collapsible: true,
|
|
11
|
+
resizable: true,
|
|
12
|
+
},
|
|
13
|
+
diff: {
|
|
14
|
+
defaultWidth: 560,
|
|
15
|
+
minWidth: 360,
|
|
16
|
+
maxWidth: 980,
|
|
17
|
+
pathLevel: 1,
|
|
18
|
+
closeable: true,
|
|
19
|
+
closed: true,
|
|
20
|
+
openOnSelect: false,
|
|
21
|
+
resizable: true,
|
|
22
|
+
},
|
|
23
|
+
evolution: {
|
|
24
|
+
defaultWidth: 480,
|
|
25
|
+
minWidth: 360,
|
|
26
|
+
maxWidth: 720,
|
|
27
|
+
pathLevel: 1,
|
|
28
|
+
closeable: true,
|
|
29
|
+
closed: true,
|
|
30
|
+
openOnSelect: false,
|
|
31
|
+
resizable: true,
|
|
32
|
+
},
|
|
33
|
+
"evolution-diff": {
|
|
34
|
+
defaultWidth: 560,
|
|
35
|
+
minWidth: 360,
|
|
36
|
+
maxWidth: 980,
|
|
37
|
+
pathLevel: 1,
|
|
38
|
+
closeable: true,
|
|
39
|
+
closed: true,
|
|
40
|
+
openOnSelect: false,
|
|
41
|
+
resizable: true,
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { LocalGraphCommit } from "@lapismd/jj-history";
|
|
2
|
+
import type { HistoryReader } from "./history-reader.js";
|
|
3
|
+
import { type HistoryState } from "./history-state.js";
|
|
4
|
+
import { pause } from "./history-selection.js";
|
|
5
|
+
export declare class HistoryController {
|
|
6
|
+
#private;
|
|
7
|
+
readonly reader: HistoryReader;
|
|
8
|
+
readonly feedback: {
|
|
9
|
+
report(error: unknown): void;
|
|
10
|
+
recovered(): void;
|
|
11
|
+
};
|
|
12
|
+
readonly wait: typeof pause;
|
|
13
|
+
constructor(reader: HistoryReader, feedback: HistoryController["feedback"], wait?: typeof pause);
|
|
14
|
+
get state(): HistoryState;
|
|
15
|
+
get pinned(): boolean;
|
|
16
|
+
subscribe(listener: (state: HistoryState) => void): () => void;
|
|
17
|
+
refresh(preferred?: string): Promise<void>;
|
|
18
|
+
selectOperation(operation: string): Promise<void>;
|
|
19
|
+
checkpointChanged(operation: string): Promise<void>;
|
|
20
|
+
selectWorkspace(workspace: string | null): Promise<void>;
|
|
21
|
+
moreCommits(): Promise<void>;
|
|
22
|
+
clearRevision(): Promise<void>;
|
|
23
|
+
selectRevision(revision: LocalGraphCommit): Promise<void>;
|
|
24
|
+
openRevision(id: string): Promise<void>;
|
|
25
|
+
loadParents(): Promise<void>;
|
|
26
|
+
loadConflicts(): Promise<void>;
|
|
27
|
+
selectBase(base: string): Promise<void>;
|
|
28
|
+
morePaths(): Promise<void>;
|
|
29
|
+
selectPath(path: string): Promise<void>;
|
|
30
|
+
close(): Promise<void>;
|
|
31
|
+
}
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
import { RevisionComparison } from "./revision-comparison.js";
|
|
2
|
+
import { HistoryGraph } from "./history-graph.js";
|
|
3
|
+
import { parentCandidates } from "./parent-candidates.js";
|
|
4
|
+
import { initialHistoryState, resetHistoryComparison, } from "./history-state.js";
|
|
5
|
+
import { check, pause, prepared } from "./history-selection.js";
|
|
6
|
+
import { HistoryLifetime } from "./history-lifetime.js";
|
|
7
|
+
export class HistoryController {
|
|
8
|
+
#state = initialHistoryState();
|
|
9
|
+
#listeners = new Set();
|
|
10
|
+
#lifetime;
|
|
11
|
+
#graph;
|
|
12
|
+
#files;
|
|
13
|
+
reader;
|
|
14
|
+
feedback;
|
|
15
|
+
wait;
|
|
16
|
+
#handle;
|
|
17
|
+
#selection = 0;
|
|
18
|
+
#comparison = 0;
|
|
19
|
+
#request = 0;
|
|
20
|
+
#abort = new AbortController();
|
|
21
|
+
#closed = false;
|
|
22
|
+
#pinned = false;
|
|
23
|
+
#closing;
|
|
24
|
+
constructor(reader, feedback, wait = pause) {
|
|
25
|
+
this.reader = reader;
|
|
26
|
+
this.feedback = feedback;
|
|
27
|
+
this.wait = wait;
|
|
28
|
+
this.#lifetime = new HistoryLifetime(reader);
|
|
29
|
+
this.#files = new RevisionComparison(reader, () => ({
|
|
30
|
+
handle: this.#handle,
|
|
31
|
+
state: this.#state,
|
|
32
|
+
closed: this.#closed,
|
|
33
|
+
}), (patch) => this.#set(patch));
|
|
34
|
+
this.#graph = new HistoryGraph(reader, () => ({
|
|
35
|
+
handle: this.#handle,
|
|
36
|
+
state: this.#state,
|
|
37
|
+
closed: this.#closed,
|
|
38
|
+
}), (patch) => this.#set(patch));
|
|
39
|
+
}
|
|
40
|
+
get state() {
|
|
41
|
+
return this.#state;
|
|
42
|
+
}
|
|
43
|
+
get pinned() {
|
|
44
|
+
return this.#pinned || !!this.#state.revision;
|
|
45
|
+
}
|
|
46
|
+
subscribe(listener) {
|
|
47
|
+
this.#listeners.add(listener);
|
|
48
|
+
listener(this.#state);
|
|
49
|
+
return () => this.#listeners.delete(listener);
|
|
50
|
+
}
|
|
51
|
+
#set(patch) {
|
|
52
|
+
if (this.#closed)
|
|
53
|
+
return;
|
|
54
|
+
this.#state = { ...this.#state, ...patch };
|
|
55
|
+
for (const listener of this.#listeners)
|
|
56
|
+
listener(this.#state);
|
|
57
|
+
}
|
|
58
|
+
#run(action) {
|
|
59
|
+
if (this.#closed)
|
|
60
|
+
return Promise.resolve();
|
|
61
|
+
return this.#lifetime.run(action);
|
|
62
|
+
}
|
|
63
|
+
async #action(action) {
|
|
64
|
+
const request = ++this.#request;
|
|
65
|
+
this.#set({ busy: true });
|
|
66
|
+
try {
|
|
67
|
+
await action();
|
|
68
|
+
if (!this.#closed && request === this.#request)
|
|
69
|
+
this.feedback.recovered();
|
|
70
|
+
}
|
|
71
|
+
catch (error) {
|
|
72
|
+
if (!this.#closed && request === this.#request) {
|
|
73
|
+
this.#set({ phase: this.#state.snapshot ? "ready" : "unavailable" });
|
|
74
|
+
this.feedback.report(error);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
finally {
|
|
78
|
+
if (request === this.#request)
|
|
79
|
+
this.#set({ busy: false });
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
refresh(preferred) {
|
|
83
|
+
if (preferred)
|
|
84
|
+
this.#pinned = true;
|
|
85
|
+
return this.#run(() => this.#action(async () => {
|
|
86
|
+
const selection = this.#selection;
|
|
87
|
+
const heads = await this.reader.heads();
|
|
88
|
+
if (selection !== this.#selection || this.#closed)
|
|
89
|
+
return;
|
|
90
|
+
this.#set({
|
|
91
|
+
heads: heads.heads,
|
|
92
|
+
headsReady: true,
|
|
93
|
+
phase: this.#state.snapshot ? "ready" : "idle",
|
|
94
|
+
});
|
|
95
|
+
if (preferred && !this.#state.operation)
|
|
96
|
+
await this.#selectOperation(preferred);
|
|
97
|
+
else if (this.#state.operation && !this.#state.snapshot)
|
|
98
|
+
await this.#selectOperation(this.#state.operation);
|
|
99
|
+
else if (this.#state.operation && !this.#state.commitsReady)
|
|
100
|
+
await this.#graph.load(false);
|
|
101
|
+
else if (!this.#state.operation && heads.heads.length === 1)
|
|
102
|
+
await this.#selectOperation(heads.heads[0]);
|
|
103
|
+
}));
|
|
104
|
+
}
|
|
105
|
+
selectOperation(operation) {
|
|
106
|
+
this.#pinned = true;
|
|
107
|
+
return this.#run(() => this.#action(() => this.#selectOperation(operation)));
|
|
108
|
+
}
|
|
109
|
+
checkpointChanged(operation) {
|
|
110
|
+
if (this.#closed ||
|
|
111
|
+
this.#pinned ||
|
|
112
|
+
this.#state.revision ||
|
|
113
|
+
this.#state.operation === operation)
|
|
114
|
+
return Promise.resolve();
|
|
115
|
+
return this.#run(() => this.#action(() => this.#selectOperation(operation)));
|
|
116
|
+
}
|
|
117
|
+
async #selectOperation(operation) {
|
|
118
|
+
const selection = ++this.#selection;
|
|
119
|
+
this.#comparison++;
|
|
120
|
+
this.#files.reset();
|
|
121
|
+
this.#abort.abort();
|
|
122
|
+
const abort = (this.#abort = new AbortController());
|
|
123
|
+
const prior = this.#handle;
|
|
124
|
+
this.#handle = undefined;
|
|
125
|
+
this.#set({
|
|
126
|
+
...initialHistoryState(),
|
|
127
|
+
heads: this.#state.heads,
|
|
128
|
+
headsReady: this.#state.headsReady,
|
|
129
|
+
operation,
|
|
130
|
+
phase: "loading",
|
|
131
|
+
busy: true,
|
|
132
|
+
});
|
|
133
|
+
if (prior)
|
|
134
|
+
await this.#lifetime.closeHandle(prior);
|
|
135
|
+
const handle = await this.reader.open(operation);
|
|
136
|
+
this.#lifetime.handles.add(handle);
|
|
137
|
+
if (this.#closed)
|
|
138
|
+
return;
|
|
139
|
+
if (selection !== this.#selection) {
|
|
140
|
+
await this.#lifetime.closeHandle(handle);
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
this.#handle = handle;
|
|
144
|
+
const snapshot = await prepared(this.reader, handle, abort.signal, this.wait);
|
|
145
|
+
check(snapshot.operation === operation);
|
|
146
|
+
if (selection !== this.#selection || this.#closed)
|
|
147
|
+
return;
|
|
148
|
+
this.#set({ snapshot, phase: "ready" });
|
|
149
|
+
await this.#graph.load(false);
|
|
150
|
+
}
|
|
151
|
+
selectWorkspace(workspace) {
|
|
152
|
+
this.#comparison++;
|
|
153
|
+
this.#files.reset();
|
|
154
|
+
return this.#run(() => this.#action(async () => {
|
|
155
|
+
this.#set({ ...resetHistoryComparison(), workspace });
|
|
156
|
+
await this.#graph.load(false);
|
|
157
|
+
}));
|
|
158
|
+
}
|
|
159
|
+
moreCommits() {
|
|
160
|
+
return this.#run(() => this.#action(() => this.#graph.load(true)));
|
|
161
|
+
}
|
|
162
|
+
clearRevision() {
|
|
163
|
+
this.#comparison++;
|
|
164
|
+
this.#files.reset();
|
|
165
|
+
this.#request++;
|
|
166
|
+
return this.#run(async () => this.#set({ ...resetHistoryComparison(), busy: false }));
|
|
167
|
+
}
|
|
168
|
+
selectRevision(revision) {
|
|
169
|
+
this.#comparison++;
|
|
170
|
+
this.#files.reset();
|
|
171
|
+
return this.#run(() => this.#action(async () => {
|
|
172
|
+
check(this.#state.commits.some((item) => item.id === revision.id));
|
|
173
|
+
this.#set({ ...resetHistoryComparison(), revision });
|
|
174
|
+
if (revision.parents.length === 1)
|
|
175
|
+
await this.#paths(revision.parents[0], false);
|
|
176
|
+
}));
|
|
177
|
+
}
|
|
178
|
+
openRevision(id) {
|
|
179
|
+
const comparison = ++this.#comparison;
|
|
180
|
+
this.#files.reset();
|
|
181
|
+
return this.#run(() => this.#action(async () => {
|
|
182
|
+
const revision = await this.#graph.exact(id, () => comparison === this.#comparison);
|
|
183
|
+
if (!revision)
|
|
184
|
+
return;
|
|
185
|
+
this.#set({ ...resetHistoryComparison(), revision });
|
|
186
|
+
if (revision.parents.length === 1)
|
|
187
|
+
await this.#paths(revision.parents[0], false);
|
|
188
|
+
}));
|
|
189
|
+
}
|
|
190
|
+
loadParents() {
|
|
191
|
+
return this.#run(() => this.#action(async () => {
|
|
192
|
+
const handle = this.#handle, revision = this.#state.revision, generation = this.#comparison;
|
|
193
|
+
if (!handle || !revision)
|
|
194
|
+
return;
|
|
195
|
+
const parentCommits = await parentCandidates(this.reader, handle, revision.parents, [...this.#state.commits, ...this.#state.parentCommits], () => !this.#closed &&
|
|
196
|
+
handle === this.#handle &&
|
|
197
|
+
generation === this.#comparison);
|
|
198
|
+
if (parentCommits)
|
|
199
|
+
this.#set({ parentCommits });
|
|
200
|
+
}));
|
|
201
|
+
}
|
|
202
|
+
loadConflicts() {
|
|
203
|
+
const comparison = this.#comparison;
|
|
204
|
+
return this.#run(() => this.#action(() => this.#graph.conflicts(() => comparison === this.#comparison)));
|
|
205
|
+
}
|
|
206
|
+
selectBase(base) {
|
|
207
|
+
return this.#run(() => this.#action(async () => {
|
|
208
|
+
check(this.#state.revision?.parents.includes(base));
|
|
209
|
+
await this.#paths(base, false);
|
|
210
|
+
}));
|
|
211
|
+
}
|
|
212
|
+
morePaths() {
|
|
213
|
+
return this.#run(() => this.#action(async () => {
|
|
214
|
+
if (this.#state.base && this.#state.nextPath)
|
|
215
|
+
await this.#paths(this.#state.base, true);
|
|
216
|
+
}));
|
|
217
|
+
}
|
|
218
|
+
async #paths(base, append) {
|
|
219
|
+
if (!append)
|
|
220
|
+
this.#comparison++;
|
|
221
|
+
await this.#files.paths(base, append);
|
|
222
|
+
}
|
|
223
|
+
selectPath(path) {
|
|
224
|
+
return this.#run(() => this.#action(() => this.#files.selectPath(path)));
|
|
225
|
+
}
|
|
226
|
+
close() {
|
|
227
|
+
this.#closed = true;
|
|
228
|
+
this.#selection++;
|
|
229
|
+
this.#abort.abort();
|
|
230
|
+
this.#listeners.clear();
|
|
231
|
+
return (this.#closing ??= (async () => {
|
|
232
|
+
await this.#lifetime.drain();
|
|
233
|
+
})().catch((error) => {
|
|
234
|
+
this.#closing = undefined;
|
|
235
|
+
throw error;
|
|
236
|
+
}));
|
|
237
|
+
}
|
|
238
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { LocalFileDiffChange } from "@lapismd/jj-history";
|
|
2
|
+
import type { FileListingFile } from "@lapismd/design-core/diff";
|
|
3
|
+
export declare function changeStats(change?: LocalFileDiffChange): {
|
|
4
|
+
additions: number;
|
|
5
|
+
deletions: number;
|
|
6
|
+
} | undefined;
|
|
7
|
+
export declare function listingFiles(paths: LocalFileDiffChange[], selected?: LocalFileDiffChange): FileListingFile[];
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export function changeStats(change) {
|
|
2
|
+
if (!change || change.content.status !== "text")
|
|
3
|
+
return undefined;
|
|
4
|
+
const lines = (value) => value ? value.split("\n").length - (value.endsWith("\n") ? 1 : 0) : 0;
|
|
5
|
+
return change.content.hunks.reduce((stats, hunk) => {
|
|
6
|
+
if (hunk.kind === "different") {
|
|
7
|
+
stats.additions += lines(hunk.after);
|
|
8
|
+
stats.deletions += lines(hunk.before);
|
|
9
|
+
}
|
|
10
|
+
return stats;
|
|
11
|
+
}, { additions: 0, deletions: 0 });
|
|
12
|
+
}
|
|
13
|
+
export function listingFiles(paths, selected) {
|
|
14
|
+
return paths.map((change) => ({
|
|
15
|
+
path: change.path,
|
|
16
|
+
...changeStats(selected?.path === change.path ? selected : change),
|
|
17
|
+
}));
|
|
18
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Handle } from "@lapismd/jj-history";
|
|
2
|
+
import type { HistoryReader } from "./history-reader.js";
|
|
3
|
+
import type { HistoryState } from "./history-state.js";
|
|
4
|
+
type Scope = {
|
|
5
|
+
handle?: Handle;
|
|
6
|
+
state: HistoryState;
|
|
7
|
+
closed: boolean;
|
|
8
|
+
};
|
|
9
|
+
/** Bounded commit paging; the controller retains its reader/lifetime authority. */
|
|
10
|
+
export declare class HistoryGraph {
|
|
11
|
+
#private;
|
|
12
|
+
readonly reader: HistoryReader;
|
|
13
|
+
readonly scope: () => Scope;
|
|
14
|
+
readonly publish: (state: Partial<HistoryState>) => void;
|
|
15
|
+
constructor(reader: HistoryReader, scope: () => Scope, publish: HistoryGraph["publish"]);
|
|
16
|
+
exact(id: string, current: () => boolean): Promise<import("@lapismd/jj-history").LocalGraphCommit | undefined>;
|
|
17
|
+
conflicts(current: () => boolean): Promise<void>;
|
|
18
|
+
load(append: boolean): Promise<void>;
|
|
19
|
+
}
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { check } from "./history-selection.js";
|
|
2
|
+
/** Bounded commit paging; the controller retains its reader/lifetime authority. */
|
|
3
|
+
export class HistoryGraph {
|
|
4
|
+
#epoch = 0;
|
|
5
|
+
reader;
|
|
6
|
+
scope;
|
|
7
|
+
publish;
|
|
8
|
+
constructor(reader, scope, publish) {
|
|
9
|
+
this.reader = reader;
|
|
10
|
+
this.scope = scope;
|
|
11
|
+
this.publish = publish;
|
|
12
|
+
}
|
|
13
|
+
async exact(id, current) {
|
|
14
|
+
const epoch = ++this.#epoch;
|
|
15
|
+
const { handle } = this.scope();
|
|
16
|
+
if (!handle || this.scope().closed)
|
|
17
|
+
return;
|
|
18
|
+
const response = await this.reader.read(handle, {
|
|
19
|
+
kind: "commit",
|
|
20
|
+
query: { commit: id },
|
|
21
|
+
});
|
|
22
|
+
if (epoch !== this.#epoch ||
|
|
23
|
+
this.scope().handle !== handle ||
|
|
24
|
+
this.scope().closed ||
|
|
25
|
+
!current())
|
|
26
|
+
return;
|
|
27
|
+
check(response.kind === "commit" &&
|
|
28
|
+
response.data.commit.id === id &&
|
|
29
|
+
response.data.object.key.id === id &&
|
|
30
|
+
response.data.object.data.kind === "commit");
|
|
31
|
+
this.publish({
|
|
32
|
+
commits: [response.data.commit],
|
|
33
|
+
commitsReady: true,
|
|
34
|
+
next: null,
|
|
35
|
+
});
|
|
36
|
+
return response.data.commit;
|
|
37
|
+
}
|
|
38
|
+
async conflicts(current) {
|
|
39
|
+
const { handle, state } = this.scope();
|
|
40
|
+
const revision = state.revision;
|
|
41
|
+
if (!handle || !revision?.conflicted || this.scope().closed)
|
|
42
|
+
return;
|
|
43
|
+
const response = await this.reader.read(handle, {
|
|
44
|
+
kind: "conflicts",
|
|
45
|
+
query: { commit: revision.id, path: "" },
|
|
46
|
+
});
|
|
47
|
+
if (!current() || this.scope().handle !== handle || this.scope().closed)
|
|
48
|
+
return;
|
|
49
|
+
check(response.kind === "conflicts" &&
|
|
50
|
+
response.data.commit === revision.id &&
|
|
51
|
+
response.data.change === revision.change_id);
|
|
52
|
+
this.publish({ conflicts: response.data.conflicts, conflictsReady: true });
|
|
53
|
+
}
|
|
54
|
+
async load(append) {
|
|
55
|
+
const epoch = append ? this.#epoch : ++this.#epoch;
|
|
56
|
+
const { handle, state, closed } = this.scope();
|
|
57
|
+
const operation = state.operation;
|
|
58
|
+
if (closed || !handle || !operation || (append && !state.next))
|
|
59
|
+
return;
|
|
60
|
+
const response = await this.reader.read(handle, {
|
|
61
|
+
kind: "graph",
|
|
62
|
+
query: [
|
|
63
|
+
{
|
|
64
|
+
graph: "log",
|
|
65
|
+
revset: "all()",
|
|
66
|
+
workspace: state.workspace,
|
|
67
|
+
user_email: "",
|
|
68
|
+
at_time_millis: Date.now(),
|
|
69
|
+
},
|
|
70
|
+
{ limit: 50, after: append ? state.next : null },
|
|
71
|
+
],
|
|
72
|
+
});
|
|
73
|
+
const current = this.scope();
|
|
74
|
+
if (epoch !== this.#epoch || current.handle !== handle || current.closed)
|
|
75
|
+
return;
|
|
76
|
+
check(response.kind === "graph" &&
|
|
77
|
+
response.data.operation === operation &&
|
|
78
|
+
response.data.data.graph === "log");
|
|
79
|
+
const commits = response.data.data.nodes.map((node) => node.commit);
|
|
80
|
+
const retained = append ? current.state.commits : [];
|
|
81
|
+
check(!commits.some((commit) => retained.some((item) => item.id === commit.id)));
|
|
82
|
+
const combined = [...retained, ...commits].slice(0, 200);
|
|
83
|
+
this.publish({
|
|
84
|
+
commits: combined,
|
|
85
|
+
commitsReady: true,
|
|
86
|
+
next: combined.length < 200 ? response.data.next : null,
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
}
|