@pierre/diffs 1.4.3 → 1.5.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/dist/components/CodeView.d.ts +2 -4
- package/dist/components/CodeView.d.ts.map +1 -1
- package/dist/components/CodeView.js +23 -12
- package/dist/components/CodeView.js.map +1 -1
- package/dist/components/File.d.ts +2 -0
- package/dist/components/File.d.ts.map +1 -1
- package/dist/components/File.js +6 -0
- package/dist/components/File.js.map +1 -1
- package/dist/components/FileDiff.d.ts +18 -1
- package/dist/components/FileDiff.d.ts.map +1 -1
- package/dist/components/FileDiff.js +47 -15
- package/dist/components/FileDiff.js.map +1 -1
- package/dist/components/VirtualizedFile.d.ts.map +1 -1
- package/dist/components/VirtualizedFile.js +11 -11
- package/dist/components/VirtualizedFile.js.map +1 -1
- package/dist/components/VirtualizedFileDiff.d.ts.map +1 -1
- package/dist/components/VirtualizedFileDiff.js +18 -17
- package/dist/components/VirtualizedFileDiff.js.map +1 -1
- package/dist/constants.d.ts +1 -3
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +1 -3
- package/dist/constants.js.map +1 -1
- package/dist/editor/editor.d.ts.map +1 -1
- package/dist/editor/editor.js +18 -5
- package/dist/editor/editor.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/react/utils/useFileDiffInstance.d.ts.map +1 -1
- package/dist/react/utils/useFileDiffInstance.js +47 -11
- package/dist/react/utils/useFileDiffInstance.js.map +1 -1
- package/dist/renderers/DiffHunksRenderer.d.ts.map +1 -1
- package/dist/renderers/DiffHunksRenderer.js +20 -13
- package/dist/renderers/DiffHunksRenderer.js.map +1 -1
- package/dist/renderers/FileRenderer.d.ts.map +1 -1
- package/dist/renderers/FileRenderer.js +30 -11
- package/dist/renderers/FileRenderer.js.map +1 -1
- package/dist/sprite.d.ts +2 -2
- package/dist/sprite.d.ts.map +1 -1
- package/dist/sprite.js +57 -0
- package/dist/sprite.js.map +1 -1
- package/dist/utils/editSessionHunks.d.ts +5 -4
- package/dist/utils/editSessionHunks.d.ts.map +1 -1
- package/dist/utils/editSessionHunks.js +32 -9
- package/dist/utils/editSessionHunks.js.map +1 -1
- package/dist/utils/parsePatchFiles.d.ts.map +1 -1
- package/dist/utils/parsePatchFiles.js +21 -13
- package/dist/utils/parsePatchFiles.js.map +1 -1
- package/dist/utils/parseQuotedDiffFileName.d.ts +8 -0
- package/dist/utils/parseQuotedDiffFileName.d.ts.map +1 -0
- package/dist/utils/parseQuotedDiffFileName.js +54 -0
- package/dist/utils/parseQuotedDiffFileName.js.map +1 -0
- package/dist/utils/realignChangeContent.d.ts +13 -10
- package/dist/utils/realignChangeContent.d.ts.map +1 -1
- package/dist/utils/realignChangeContent.js +23 -19
- package/dist/utils/realignChangeContent.js.map +1 -1
- package/dist/worker/worker-portable.js.map +1 -1
- package/dist/worker/worker.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editor.d.ts","names":[],"sources":["../../src/editor/editor.ts"],"mappings":";;;;;;;;;;;UAwOU;EACR,aAAa;EACb,eAAe;EACf,aAAa;;EAEb;;UAGQ,wBAAwB,qBAAqB;EACrD,MAAM;EACN,iBAAiB,eAAe;;EAEhC;;UAGQ,wBAAwB,qBAAqB;EACrD,UAAU;EACV,iBAAiB,mBAAmB;;EAEpC;;KAGG,oBACH,cAAc,YACd,eACE,uBACA,wBAAwB,eACxB,wBAAwB;KAEvB,gBACH,cAAc,YACd,aACA,SACE,uBACA,KAAK,aAAa,SAClB,SAAS,aAAa;UAkBT,cAAc,cAAc,YAAY,aAAa;;EAEpE;;;;;;EAMA;;;;;;EAMA,eAAe,mBAAmB,OAAO;;EAEzC,SAAS;;EAET;;EAEA;;;;;EAKA,eAAe;;EAEf,wBAAwB;;;;;EAKxB;;;;EAIA;;;;;;;IAOE;;;;IAIA,UAAU;;;;;;IAMV,6BAA6B;;;;;;IAM7B,6BAA6B;;;;;;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cACE,OAAO,wBAAwB,OAAO,aAAa;;EAGrD;;EAEA;EAEA;;UAGe,2BAA2B;;EAE1C;;EAEA;;EAEA;;cAiDW,OACX,cAAc,aAAa,YAC3B,yBACA;;WAyMkB,MAAM;;;;;;;EADxB,YACkB,MAAM,OACtB,UAAS,cAAc,OAAO,aAAa,QAC3C;EAkBF,WAAW,SAAS,cAAc,OAAO,aAAa;EAmBtD,mBACE,OAAO,wBAAwB,OAAO,aAAa;;EAMrD,sBAAsB;EAItB,UAAU,QAAQ,YAAY;EA6B9B,KAAK,UAAU,gBAAgB,OAAO,aAAa,QACjD,cAAc;aAAqB;cAAoC;;;;;;;;;;;EA4IzE,WAAW,OAAO,YAAY;;MAmE1B;;MAOA;;EAOJ;;EAKA;EAIA,WAAW;EAeX;;EAKA,gBAAgB;;;;;EA6BhB,gBAAgB,UAAU,OAAO;EAcjC,eAAe,YAAY,QAAQ;EA2BnC,cACE,aAAa;IAAU;;EAoCzB,WAAW,SAAS;EA8BpB,MAAM,UAAU;EAuChB;EAiBA,QAAQ;;EA2JR;;EAWA;;EAeA,sBAAsB,eAAe,eAAe;;EAoBpD,6BAA6B;;EAQ7B,iBAAiB,OAAO,oBAAoB,OAAO"}
|
package/dist/editor/editor.js
CHANGED
|
@@ -7,11 +7,11 @@ import { EditStack } from "./editStack.js";
|
|
|
7
7
|
import { getTextDocumentChangeTransaction } from "./textDocumentChangeTransaction.js";
|
|
8
8
|
import { TextDocument } from "./textDocument.js";
|
|
9
9
|
import { EditStateManager, cloneEditorViewState, toManagedEditState } from "./EditStateManager.js";
|
|
10
|
+
import { cloneRetainedDiffSessionSnapshot } from "./cloneRetainedDiffSessionSnapshot.js";
|
|
10
11
|
import { isMoveCursorShortcut, isPrimaryModifier } from "./platform.js";
|
|
11
12
|
import { resolveEditorCommandFromKeyboardEvent, resolveFindAgainShortcut } from "./command.js";
|
|
12
|
-
import { cloneRetainedDiffSessionSnapshot } from "./cloneRetainedDiffSessionSnapshot.js";
|
|
13
|
-
import editor_default from "./editor2.js";
|
|
14
13
|
import { buildEditPredictionRequest, matchesEditPredictionPattern, recordEditPrediction } from "./editPrediction.js";
|
|
14
|
+
import editor_default from "./editor2.js";
|
|
15
15
|
import { resolveBlockCommentEdits, resolveCommentConfig, resolveLineCommentEdits } from "./languages.js";
|
|
16
16
|
import { addEventListener, clampDomOffset, extend, getLineNumberAttr, h, lookupScrollContainer, round } from "./utils.js";
|
|
17
17
|
import { applyDocumentChangeToLineAnnotations, renderLineAnnotations } from "./lineAnnotations.js";
|
|
@@ -108,6 +108,7 @@ var Editor = class {
|
|
|
108
108
|
#resizeObserver;
|
|
109
109
|
#fileInstance;
|
|
110
110
|
#applyDocumentChange;
|
|
111
|
+
#applySuspendedDocumentChange;
|
|
111
112
|
#publishChange;
|
|
112
113
|
#isRendering = false;
|
|
113
114
|
#restoreEditorStateOnSync = false;
|
|
@@ -238,6 +239,7 @@ var Editor = class {
|
|
|
238
239
|
const previousSession = this.#editSession;
|
|
239
240
|
if (this.#isRendering) throw new Error("Editor.edit: the editor is already rendering its component");
|
|
240
241
|
if (this.#fileInstance != null && this.#fileInstance !== fileInstance) throw new Error("Editor.edit: a recycled edit session cannot attach to a different component");
|
|
242
|
+
if (fileInstance.type === "file-diff" && this.#editSession == null && !fileInstance.__canAttachEditor()) throw new Error("Editor.edit: a complete diff is required before editing");
|
|
241
243
|
const initialState = this.#initialState;
|
|
242
244
|
const initialEditorState = initialState?.editor;
|
|
243
245
|
const editStateKey = this.#editStateKey;
|
|
@@ -258,6 +260,7 @@ var Editor = class {
|
|
|
258
260
|
this.#initialize();
|
|
259
261
|
if (fileInstance.type === "file" && editor.type === "file") {
|
|
260
262
|
editor.#applyDocumentChange = fileInstance.applyDocumentChange.bind(fileInstance);
|
|
263
|
+
editor.#applySuspendedDocumentChange = fileInstance.applySuspendedDocumentChange.bind(fileInstance);
|
|
261
264
|
editor.#publishChange = (changes, file, lineAnnotations) => {
|
|
262
265
|
const event = {
|
|
263
266
|
changes,
|
|
@@ -273,6 +276,7 @@ var Editor = class {
|
|
|
273
276
|
else fileInstance.__resumeEditor(editor);
|
|
274
277
|
} else if (fileInstance.type === "file-diff" && editor.type === "file-diff") {
|
|
275
278
|
editor.#applyDocumentChange = fileInstance.applyDocumentChange.bind(fileInstance);
|
|
279
|
+
editor.#applySuspendedDocumentChange = fileInstance.applySuspendedDocumentChange.bind(fileInstance);
|
|
276
280
|
editor.#publishChange = (changes, file, lineAnnotations) => {
|
|
277
281
|
const event = {
|
|
278
282
|
changes,
|
|
@@ -298,6 +302,7 @@ var Editor = class {
|
|
|
298
302
|
if (this.#detach == null) {
|
|
299
303
|
this.#fileInstance = void 0;
|
|
300
304
|
this.#applyDocumentChange = void 0;
|
|
305
|
+
this.#applySuspendedDocumentChange = void 0;
|
|
301
306
|
this.#publishChange = void 0;
|
|
302
307
|
}
|
|
303
308
|
if (initialState != null && initialEditorState != null) initialState.editor = initialEditorState;
|
|
@@ -552,6 +557,7 @@ var Editor = class {
|
|
|
552
557
|
this.#editSession = void 0;
|
|
553
558
|
this.#fileInstance = void 0;
|
|
554
559
|
this.#applyDocumentChange = void 0;
|
|
560
|
+
this.#applySuspendedDocumentChange = void 0;
|
|
555
561
|
this.#publishChange = void 0;
|
|
556
562
|
}
|
|
557
563
|
}
|
|
@@ -566,8 +572,11 @@ var Editor = class {
|
|
|
566
572
|
editSession.editor = cloneEditorViewState(editorState);
|
|
567
573
|
if (editSession.type === "file") return false;
|
|
568
574
|
const capturedDiffSession = fileInstance.__captureDocumentSessionState();
|
|
569
|
-
|
|
570
|
-
|
|
575
|
+
if (capturedDiffSession == null) {
|
|
576
|
+
editSession.diffSession = void 0;
|
|
577
|
+
return false;
|
|
578
|
+
}
|
|
579
|
+
editSession.diffSession = capturedDiffSession.diffSession;
|
|
571
580
|
const document = editSession.document;
|
|
572
581
|
return capturedDiffSession.hasChanges || hasEditorState || document?.canUndo === true || document?.canRedo === true;
|
|
573
582
|
}
|
|
@@ -3407,7 +3416,11 @@ var Editor = class {
|
|
|
3407
3416
|
} else shouldUpdateBuffer = true;
|
|
3408
3417
|
}
|
|
3409
3418
|
}
|
|
3410
|
-
this.#rerender(change, newLineAnnotations, renderRange, shouldUpdateBuffer);
|
|
3419
|
+
if (this.#isRendering && this.#tokenizer != null && this.#contentElement != null) this.#rerender(change, newLineAnnotations, renderRange, shouldUpdateBuffer);
|
|
3420
|
+
else if (textDocument != null) {
|
|
3421
|
+
this.#applySuspendedDocumentChange?.(textDocument, newLineAnnotations);
|
|
3422
|
+
if (newLineAnnotations != null) this.#lineAnnotations = newLineAnnotations;
|
|
3423
|
+
}
|
|
3411
3424
|
if (newSelections != null) this.#updateSelections(newSelections);
|
|
3412
3425
|
this.#fileInstance?.__acknowledgeDocumentUpdate();
|
|
3413
3426
|
this.#checkpointEditSessionState();
|