@nanocollective/nanocoder 1.13.7 → 1.13.9
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/app.js +6 -6
- package/dist/app.js.map +1 -1
- package/dist/components/status.d.ts.map +1 -1
- package/dist/components/status.js +8 -4
- package/dist/components/status.js.map +1 -1
- package/dist/components/user-input.d.ts.map +1 -1
- package/dist/components/user-input.js +35 -31
- package/dist/components/user-input.js.map +1 -1
- package/dist/components/user-message.d.ts.map +1 -1
- package/dist/components/user-message.js +0 -5
- package/dist/components/user-message.js.map +1 -1
- package/dist/components/welcome-message.d.ts.map +1 -1
- package/dist/components/welcome-message.js +9 -3
- package/dist/components/welcome-message.js.map +1 -1
- package/dist/hooks/__tests__/test-helpers.d.ts +5 -0
- package/dist/hooks/__tests__/test-helpers.d.ts.map +1 -0
- package/dist/hooks/__tests__/test-helpers.js +32 -0
- package/dist/hooks/__tests__/test-helpers.js.map +1 -0
- package/dist/hooks/__tests__/useInputState.deletion.spec.d.ts +2 -0
- package/dist/hooks/__tests__/useInputState.deletion.spec.d.ts.map +1 -0
- package/dist/hooks/__tests__/useInputState.deletion.spec.js +328 -0
- package/dist/hooks/__tests__/useInputState.deletion.spec.js.map +1 -0
- package/dist/hooks/__tests__/useInputState.state-management.spec.d.ts +2 -0
- package/dist/hooks/__tests__/useInputState.state-management.spec.d.ts.map +1 -0
- package/dist/hooks/__tests__/useInputState.state-management.spec.js +367 -0
- package/dist/hooks/__tests__/useInputState.state-management.spec.js.map +1 -0
- package/dist/hooks/__tests__/useInputState.undo-redo.spec.d.ts +2 -0
- package/dist/hooks/__tests__/useInputState.undo-redo.spec.d.ts.map +1 -0
- package/dist/hooks/__tests__/useInputState.undo-redo.spec.js +285 -0
- package/dist/hooks/__tests__/useInputState.undo-redo.spec.js.map +1 -0
- package/dist/hooks/__tests__/useToolHandler.cancellation.spec.d.ts +2 -0
- package/dist/hooks/__tests__/useToolHandler.cancellation.spec.d.ts.map +1 -0
- package/dist/hooks/__tests__/useToolHandler.cancellation.spec.js +227 -0
- package/dist/hooks/__tests__/useToolHandler.cancellation.spec.js.map +1 -0
- package/dist/hooks/__tests__/useToolHandler.execution.spec.d.ts +2 -0
- package/dist/hooks/__tests__/useToolHandler.execution.spec.d.ts.map +1 -0
- package/dist/hooks/__tests__/useToolHandler.execution.spec.js +264 -0
- package/dist/hooks/__tests__/useToolHandler.execution.spec.js.map +1 -0
- package/dist/hooks/__tests__/useToolHandler.validation.spec.d.ts +2 -0
- package/dist/hooks/__tests__/useToolHandler.validation.spec.d.ts.map +1 -0
- package/dist/hooks/__tests__/useToolHandler.validation.spec.js +149 -0
- package/dist/hooks/__tests__/useToolHandler.validation.spec.js.map +1 -0
- package/dist/{app/hooks → hooks}/useAppInitialization.d.ts +5 -5
- package/dist/hooks/useAppInitialization.d.ts.map +1 -0
- package/dist/{app/hooks → hooks}/useAppInitialization.js +15 -15
- package/dist/hooks/useAppInitialization.js.map +1 -0
- package/dist/{app/hooks → hooks}/useAppState.d.ts +6 -6
- package/dist/hooks/useAppState.d.ts.map +1 -0
- package/dist/{app/hooks → hooks}/useAppState.js +2 -2
- package/dist/hooks/useAppState.js.map +1 -0
- package/dist/{app/hooks → hooks}/useChatHandler.d.ts +2 -2
- package/dist/hooks/useChatHandler.d.ts.map +1 -0
- package/dist/{app/hooks → hooks}/useChatHandler.js +17 -11
- package/dist/hooks/useChatHandler.js.map +1 -0
- package/dist/hooks/useDirectoryTrust.d.ts.map +1 -0
- package/dist/{app/hooks → hooks}/useDirectoryTrust.js +3 -3
- package/dist/hooks/useDirectoryTrust.js.map +1 -0
- package/dist/hooks/useInputState.d.ts +10 -3
- package/dist/hooks/useInputState.d.ts.map +1 -1
- package/dist/hooks/useInputState.js +154 -15
- package/dist/hooks/useInputState.js.map +1 -1
- package/dist/{app/hooks → hooks}/useModeHandlers.d.ts +2 -2
- package/dist/hooks/useModeHandlers.d.ts.map +1 -0
- package/dist/{app/hooks → hooks}/useModeHandlers.js +4 -4
- package/dist/hooks/useModeHandlers.js.map +1 -0
- package/dist/hooks/useTerminalWidth.d.ts +15 -0
- package/dist/hooks/useTerminalWidth.d.ts.map +1 -1
- package/dist/hooks/useTerminalWidth.js +39 -0
- package/dist/hooks/useTerminalWidth.js.map +1 -1
- package/dist/{app/hooks → hooks}/useToolHandler.d.ts +2 -2
- package/dist/hooks/useToolHandler.d.ts.map +1 -0
- package/dist/{app/hooks → hooks}/useToolHandler.js +65 -5
- package/dist/hooks/useToolHandler.js.map +1 -0
- package/dist/hooks/useUIState.d.ts +0 -2
- package/dist/hooks/useUIState.d.ts.map +1 -1
- package/dist/hooks/useUIState.js +1 -11
- package/dist/hooks/useUIState.js.map +1 -1
- package/dist/integration/paste-roundtrip.spec.d.ts +2 -0
- package/dist/integration/paste-roundtrip.spec.d.ts.map +1 -0
- package/dist/integration/paste-roundtrip.spec.js +327 -0
- package/dist/integration/paste-roundtrip.spec.js.map +1 -0
- package/dist/prompt-history.d.ts +9 -3
- package/dist/prompt-history.d.ts.map +1 -1
- package/dist/prompt-history.js +56 -14
- package/dist/prompt-history.js.map +1 -1
- package/dist/recommendations/model-database.d.ts.map +1 -1
- package/dist/recommendations/model-database.js +14 -0
- package/dist/recommendations/model-database.js.map +1 -1
- package/dist/types/hooks.d.ts +29 -0
- package/dist/types/hooks.d.ts.map +1 -1
- package/dist/types/hooks.js +10 -1
- package/dist/types/hooks.js.map +1 -1
- package/dist/utils/atomic-deletion.d.ts +17 -0
- package/dist/utils/atomic-deletion.d.ts.map +1 -0
- package/dist/utils/atomic-deletion.js +89 -0
- package/dist/utils/atomic-deletion.js.map +1 -0
- package/dist/utils/atomic-deletion.spec.d.ts +2 -0
- package/dist/utils/atomic-deletion.spec.d.ts.map +1 -0
- package/dist/utils/atomic-deletion.spec.js +153 -0
- package/dist/utils/atomic-deletion.spec.js.map +1 -0
- package/dist/utils/paste-detection.d.ts +36 -0
- package/dist/utils/paste-detection.d.ts.map +1 -0
- package/dist/utils/paste-detection.js +83 -0
- package/dist/utils/paste-detection.js.map +1 -0
- package/dist/utils/paste-detection.spec.d.ts +2 -0
- package/dist/utils/paste-detection.spec.d.ts.map +1 -0
- package/dist/utils/paste-detection.spec.js +44 -0
- package/dist/utils/paste-detection.spec.js.map +1 -0
- package/dist/utils/paste-utils.d.ts +3 -0
- package/dist/utils/paste-utils.d.ts.map +1 -0
- package/dist/utils/paste-utils.js +33 -0
- package/dist/utils/paste-utils.js.map +1 -0
- package/dist/utils/paste-utils.spec.d.ts +2 -0
- package/dist/utils/paste-utils.spec.d.ts.map +1 -0
- package/dist/utils/paste-utils.spec.js +61 -0
- package/dist/utils/paste-utils.spec.js.map +1 -0
- package/dist/utils/prompt-assembly.spec.d.ts +2 -0
- package/dist/utils/prompt-assembly.spec.d.ts.map +1 -0
- package/dist/utils/prompt-assembly.spec.js +80 -0
- package/dist/utils/prompt-assembly.spec.js.map +1 -0
- package/dist/utils/prompt-processor.d.ts +11 -0
- package/dist/utils/prompt-processor.d.ts.map +1 -1
- package/dist/utils/prompt-processor.js +57 -0
- package/dist/utils/prompt-processor.js.map +1 -1
- package/package.json +18 -8
- package/source/app/prompts/main-prompt.md +18 -0
- package/dist/app/hooks/useAppInitialization.d.ts.map +0 -1
- package/dist/app/hooks/useAppInitialization.js.map +0 -1
- package/dist/app/hooks/useAppState.d.ts.map +0 -1
- package/dist/app/hooks/useAppState.js.map +0 -1
- package/dist/app/hooks/useChatHandler.d.ts.map +0 -1
- package/dist/app/hooks/useChatHandler.js.map +0 -1
- package/dist/app/hooks/useDirectoryTrust.d.ts.map +0 -1
- package/dist/app/hooks/useDirectoryTrust.js.map +0 -1
- package/dist/app/hooks/useModeHandlers.d.ts.map +0 -1
- package/dist/app/hooks/useModeHandlers.js.map +0 -1
- package/dist/app/hooks/useToolHandler.d.ts.map +0 -1
- package/dist/app/hooks/useToolHandler.js.map +0 -1
- /package/dist/{app/hooks → hooks}/useDirectoryTrust.d.ts +0 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { InputState } from '../types/hooks.js';
|
|
2
|
+
/**
|
|
3
|
+
* Detect if a text change represents a deletion that should be atomic
|
|
4
|
+
* Returns the modified InputState if atomic deletion occurred, null otherwise
|
|
5
|
+
*/
|
|
6
|
+
export declare function handleAtomicDeletion(previousState: InputState, newText: string): InputState | null;
|
|
7
|
+
/**
|
|
8
|
+
* Find placeholder at cursor position
|
|
9
|
+
* Returns placeholder ID if cursor is within a placeholder, null otherwise
|
|
10
|
+
*/
|
|
11
|
+
export declare function findPlaceholderAtPosition(text: string, position: number): string | null;
|
|
12
|
+
/**
|
|
13
|
+
* Check if a deletion would partially affect a placeholder
|
|
14
|
+
* Used to prevent partial placeholder deletions
|
|
15
|
+
*/
|
|
16
|
+
export declare function wouldPartiallyDeletePlaceholder(text: string, deletionStart: number, deletionLength: number): boolean;
|
|
17
|
+
//# sourceMappingURL=atomic-deletion.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"atomic-deletion.d.ts","sourceRoot":"","sources":["../../source/utils/atomic-deletion.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,mBAAmB,CAAC;AAElD;;;GAGG;AACH,wBAAgB,oBAAoB,CACnC,aAAa,EAAE,UAAU,EACzB,OAAO,EAAE,MAAM,GACb,UAAU,GAAG,IAAI,CAuDnB;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,CACxC,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,GACd,MAAM,GAAG,IAAI,CAcf;AAED;;;GAGG;AACH,wBAAgB,+BAA+B,CAC9C,IAAI,EAAE,MAAM,EACZ,aAAa,EAAE,MAAM,EACrB,cAAc,EAAE,MAAM,GACpB,OAAO,CA6BT"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Detect if a text change represents a deletion that should be atomic
|
|
3
|
+
* Returns the modified InputState if atomic deletion occurred, null otherwise
|
|
4
|
+
*/
|
|
5
|
+
export function handleAtomicDeletion(previousState, newText) {
|
|
6
|
+
const previousText = previousState.displayValue;
|
|
7
|
+
// Only handle deletions (text getting shorter)
|
|
8
|
+
if (newText.length >= previousText.length) {
|
|
9
|
+
return null;
|
|
10
|
+
}
|
|
11
|
+
// Find what was deleted
|
|
12
|
+
const deletedChars = previousText.length - newText.length;
|
|
13
|
+
// Find where the deletion occurred
|
|
14
|
+
let deletionStart = -1;
|
|
15
|
+
for (let i = 0; i < Math.min(previousText.length, newText.length); i++) {
|
|
16
|
+
if (previousText[i] !== newText[i]) {
|
|
17
|
+
deletionStart = i;
|
|
18
|
+
break;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
// If no difference found in common part, deletion was at the end
|
|
22
|
+
if (deletionStart === -1) {
|
|
23
|
+
deletionStart = newText.length;
|
|
24
|
+
}
|
|
25
|
+
// Check if any placeholder was affected by this deletion
|
|
26
|
+
const placeholderRegex = /\[Paste #(\d+): \d+ chars\]/g;
|
|
27
|
+
let match;
|
|
28
|
+
while ((match = placeholderRegex.exec(previousText)) !== null) {
|
|
29
|
+
const placeholderStart = match.index;
|
|
30
|
+
const placeholderEnd = placeholderStart + match[0].length;
|
|
31
|
+
const placeholderId = match[1];
|
|
32
|
+
// Check if deletion overlaps with this placeholder
|
|
33
|
+
const deletionEnd = deletionStart + deletedChars;
|
|
34
|
+
if ((deletionStart >= placeholderStart && deletionStart < placeholderEnd) ||
|
|
35
|
+
(deletionEnd > placeholderStart && deletionEnd <= placeholderEnd) ||
|
|
36
|
+
(deletionStart <= placeholderStart && deletionEnd >= placeholderEnd)) {
|
|
37
|
+
// Deletion affects this placeholder - remove it atomically
|
|
38
|
+
const newDisplayValue = previousText.replace(match[0], '');
|
|
39
|
+
const newPlaceholderContent = { ...previousState.placeholderContent };
|
|
40
|
+
delete newPlaceholderContent[placeholderId];
|
|
41
|
+
return {
|
|
42
|
+
displayValue: newDisplayValue,
|
|
43
|
+
placeholderContent: newPlaceholderContent,
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Find placeholder at cursor position
|
|
51
|
+
* Returns placeholder ID if cursor is within a placeholder, null otherwise
|
|
52
|
+
*/
|
|
53
|
+
export function findPlaceholderAtPosition(text, position) {
|
|
54
|
+
const placeholderRegex = /\[Paste #(\d+): \d+ chars\]/g;
|
|
55
|
+
let match;
|
|
56
|
+
while ((match = placeholderRegex.exec(text)) !== null) {
|
|
57
|
+
const placeholderStart = match.index;
|
|
58
|
+
const placeholderEnd = placeholderStart + match[0].length;
|
|
59
|
+
if (position >= placeholderStart && position <= placeholderEnd) {
|
|
60
|
+
return match[1]; // Return the placeholder ID
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Check if a deletion would partially affect a placeholder
|
|
67
|
+
* Used to prevent partial placeholder deletions
|
|
68
|
+
*/
|
|
69
|
+
export function wouldPartiallyDeletePlaceholder(text, deletionStart, deletionLength) {
|
|
70
|
+
const placeholderRegex = /\[Paste #(\d+): \d+ chars\]/g;
|
|
71
|
+
let match;
|
|
72
|
+
while ((match = placeholderRegex.exec(text)) !== null) {
|
|
73
|
+
const placeholderStart = match.index;
|
|
74
|
+
const placeholderEnd = placeholderStart + match[0].length;
|
|
75
|
+
const deletionEnd = deletionStart + deletionLength;
|
|
76
|
+
// Check for overlap
|
|
77
|
+
const overlapsStart = deletionStart >= placeholderStart && deletionStart < placeholderEnd;
|
|
78
|
+
const overlapsEnd = deletionEnd > placeholderStart && deletionEnd <= placeholderEnd;
|
|
79
|
+
const spansPast = deletionStart < placeholderStart && deletionEnd > placeholderStart;
|
|
80
|
+
const spansOver = deletionStart < placeholderEnd && deletionEnd > placeholderEnd;
|
|
81
|
+
const hasOverlap = overlapsStart || overlapsEnd || spansPast || spansOver;
|
|
82
|
+
const completeOverlap = deletionStart <= placeholderStart && deletionEnd >= placeholderEnd;
|
|
83
|
+
if (hasOverlap && !completeOverlap) {
|
|
84
|
+
return true;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return false;
|
|
88
|
+
}
|
|
89
|
+
//# sourceMappingURL=atomic-deletion.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"atomic-deletion.js","sourceRoot":"","sources":["../../source/utils/atomic-deletion.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,UAAU,oBAAoB,CACnC,aAAyB,EACzB,OAAe;IAEf,MAAM,YAAY,GAAG,aAAa,CAAC,YAAY,CAAC;IAEhD,+CAA+C;IAC/C,IAAI,OAAO,CAAC,MAAM,IAAI,YAAY,CAAC,MAAM,EAAE,CAAC;QAC3C,OAAO,IAAI,CAAC;IACb,CAAC;IAED,wBAAwB;IACxB,MAAM,YAAY,GAAG,YAAY,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAE1D,mCAAmC;IACnC,IAAI,aAAa,GAAG,CAAC,CAAC,CAAC;IACvB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QACxE,IAAI,YAAY,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;YACpC,aAAa,GAAG,CAAC,CAAC;YAClB,MAAM;QACP,CAAC;IACF,CAAC;IAED,iEAAiE;IACjE,IAAI,aAAa,KAAK,CAAC,CAAC,EAAE,CAAC;QAC1B,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC;IAChC,CAAC;IAED,yDAAyD;IACzD,MAAM,gBAAgB,GAAG,8BAA8B,CAAC;IACxD,IAAI,KAAK,CAAC;IAEV,OAAO,CAAC,KAAK,GAAG,gBAAgB,CAAC,IAAI,CAAC,YAA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"file":"atomic-deletion.spec.d.ts","sourceRoot":"","sources":["../../source/utils/atomic-deletion.spec.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import test from 'ava';
|
|
2
|
+
import { handleAtomicDeletion, findPlaceholderAtPosition, wouldPartiallyDeletePlaceholder, } from './atomic-deletion.js';
|
|
3
|
+
import { PlaceholderType } from '../types/hooks.js';
|
|
4
|
+
// Tests for atomic placeholder deletion
|
|
5
|
+
test('handleAtomicDeletion removes placeholder when backspaced', t => {
|
|
6
|
+
const previousState = {
|
|
7
|
+
displayValue: 'Analyze this: [Paste #123: 500 chars] code',
|
|
8
|
+
placeholderContent: {
|
|
9
|
+
'123': {
|
|
10
|
+
type: PlaceholderType.PASTE,
|
|
11
|
+
displayText: '[Paste #123: 500 chars]',
|
|
12
|
+
content: 'console.log("hello world");',
|
|
13
|
+
originalSize: 500,
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
// Simulate backspacing from the end of the placeholder
|
|
18
|
+
const newText = 'Analyze this: [Paste #123: 500 char code';
|
|
19
|
+
const result = handleAtomicDeletion(previousState, newText);
|
|
20
|
+
t.truthy(result);
|
|
21
|
+
t.is(result.displayValue, 'Analyze this: code');
|
|
22
|
+
t.deepEqual(result.placeholderContent, {});
|
|
23
|
+
});
|
|
24
|
+
test('handleAtomicDeletion removes placeholder when deleted from middle', t => {
|
|
25
|
+
const previousState = {
|
|
26
|
+
displayValue: 'Before [Paste #456: 200 chars] after',
|
|
27
|
+
placeholderContent: {
|
|
28
|
+
'456': {
|
|
29
|
+
type: PlaceholderType.PASTE,
|
|
30
|
+
displayText: '[Paste #456: 200 chars]',
|
|
31
|
+
content: 'function test() { return true; }',
|
|
32
|
+
originalSize: 200,
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
// Simulate deleting part of the placeholder
|
|
37
|
+
const newText = 'Before [Paste #456: 200 ch after';
|
|
38
|
+
const result = handleAtomicDeletion(previousState, newText);
|
|
39
|
+
t.truthy(result);
|
|
40
|
+
t.is(result.displayValue, 'Before after');
|
|
41
|
+
t.deepEqual(result.placeholderContent, {});
|
|
42
|
+
});
|
|
43
|
+
test('handleAtomicDeletion preserves other placeholders', t => {
|
|
44
|
+
const previousState = {
|
|
45
|
+
displayValue: 'First [Paste #111: 100 chars] second [Paste #222: 200 chars]',
|
|
46
|
+
placeholderContent: {
|
|
47
|
+
'111': {
|
|
48
|
+
type: PlaceholderType.PASTE,
|
|
49
|
+
displayText: '[Paste #111: 100 chars]',
|
|
50
|
+
content: 'first content',
|
|
51
|
+
originalSize: 100,
|
|
52
|
+
},
|
|
53
|
+
'222': {
|
|
54
|
+
type: PlaceholderType.PASTE,
|
|
55
|
+
displayText: '[Paste #222: 200 chars]',
|
|
56
|
+
content: 'second content',
|
|
57
|
+
originalSize: 200,
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
// Delete part of first placeholder
|
|
62
|
+
const newText = 'First [Paste #111: 100 ch second [Paste #222: 200 chars]';
|
|
63
|
+
const result = handleAtomicDeletion(previousState, newText);
|
|
64
|
+
t.truthy(result);
|
|
65
|
+
t.is(result.displayValue, 'First second [Paste #222: 200 chars]');
|
|
66
|
+
t.deepEqual(result.placeholderContent, {
|
|
67
|
+
'222': {
|
|
68
|
+
type: PlaceholderType.PASTE,
|
|
69
|
+
displayText: '[Paste #222: 200 chars]',
|
|
70
|
+
content: 'second content',
|
|
71
|
+
originalSize: 200,
|
|
72
|
+
},
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
test('handleAtomicDeletion returns null for normal deletions', t => {
|
|
76
|
+
const previousState = {
|
|
77
|
+
displayValue: 'Normal text here',
|
|
78
|
+
placeholderContent: {},
|
|
79
|
+
};
|
|
80
|
+
const newText = 'Normal text her';
|
|
81
|
+
const result = handleAtomicDeletion(previousState, newText);
|
|
82
|
+
t.is(result, null);
|
|
83
|
+
});
|
|
84
|
+
test('handleAtomicDeletion returns null for additions', t => {
|
|
85
|
+
const previousState = {
|
|
86
|
+
displayValue: 'Short text',
|
|
87
|
+
placeholderContent: {},
|
|
88
|
+
};
|
|
89
|
+
const newText = 'Short text with more';
|
|
90
|
+
const result = handleAtomicDeletion(previousState, newText);
|
|
91
|
+
t.is(result, null);
|
|
92
|
+
});
|
|
93
|
+
test('findPlaceholderAtPosition finds placeholder ID', t => {
|
|
94
|
+
const text = 'Before [Paste #789: 300 chars] after';
|
|
95
|
+
// Position inside the placeholder
|
|
96
|
+
const result1 = findPlaceholderAtPosition(text, 10); // Inside "[Paste #789: 300 chars]"
|
|
97
|
+
t.is(result1, '789');
|
|
98
|
+
// Position outside the placeholder
|
|
99
|
+
const result2 = findPlaceholderAtPosition(text, 0); // In "Before"
|
|
100
|
+
t.is(result2, null);
|
|
101
|
+
// Position after placeholder
|
|
102
|
+
const result3 = findPlaceholderAtPosition(text, 35); // In "after"
|
|
103
|
+
t.is(result3, null);
|
|
104
|
+
});
|
|
105
|
+
test('wouldPartiallyDeletePlaceholder detects partial deletion', t => {
|
|
106
|
+
const text = 'Text [Paste #123: 100 chars] more';
|
|
107
|
+
// 01234567890123456789012345678901234
|
|
108
|
+
// 0 1 2 3
|
|
109
|
+
// Placeholder is at position 5-28 (length 23)
|
|
110
|
+
// Partial deletion from middle of placeholder
|
|
111
|
+
const result1 = wouldPartiallyDeletePlaceholder(text, 8, 5); // Delete "Paste"
|
|
112
|
+
t.true(result1);
|
|
113
|
+
// Complete deletion of placeholder - delete from position 5, length 23
|
|
114
|
+
const result2 = wouldPartiallyDeletePlaceholder(text, 5, 23); // Delete entire "[Paste #123: 100 chars]"
|
|
115
|
+
t.false(result2);
|
|
116
|
+
// Deletion outside placeholder
|
|
117
|
+
const result3 = wouldPartiallyDeletePlaceholder(text, 0, 4); // Delete "Text"
|
|
118
|
+
t.false(result3);
|
|
119
|
+
});
|
|
120
|
+
// Integration test showing complete flow
|
|
121
|
+
test('atomic deletion works with multiple placeholders', t => {
|
|
122
|
+
const previousState = {
|
|
123
|
+
displayValue: 'Compare [Paste #111: 50 chars] with [Paste #222: 100 chars] output',
|
|
124
|
+
placeholderContent: {
|
|
125
|
+
'111': {
|
|
126
|
+
type: PlaceholderType.PASTE,
|
|
127
|
+
displayText: '[Paste #111: 50 chars]',
|
|
128
|
+
content: 'first code block',
|
|
129
|
+
originalSize: 50,
|
|
130
|
+
},
|
|
131
|
+
'222': {
|
|
132
|
+
type: PlaceholderType.PASTE,
|
|
133
|
+
displayText: '[Paste #222: 100 chars]',
|
|
134
|
+
content: 'second code block with more content',
|
|
135
|
+
originalSize: 100,
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
};
|
|
139
|
+
// Delete part of second placeholder
|
|
140
|
+
const newText = 'Compare [Paste #111: 50 chars] with [Paste #222: 100 ch output';
|
|
141
|
+
const result = handleAtomicDeletion(previousState, newText);
|
|
142
|
+
t.truthy(result);
|
|
143
|
+
t.is(result.displayValue, 'Compare [Paste #111: 50 chars] with output');
|
|
144
|
+
t.deepEqual(result.placeholderContent, {
|
|
145
|
+
'111': {
|
|
146
|
+
type: PlaceholderType.PASTE,
|
|
147
|
+
displayText: '[Paste #111: 50 chars]',
|
|
148
|
+
content: 'first code block',
|
|
149
|
+
originalSize: 50,
|
|
150
|
+
},
|
|
151
|
+
});
|
|
152
|
+
});
|
|
153
|
+
//# sourceMappingURL=atomic-deletion.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"atomic-deletion.spec.js","sourceRoot":"","sources":["../../source/utils/atomic-deletion.spec.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,KAAK,CAAC;AACvB,OAAO,EACN,oBAAoB,EACpB,yBAAyB,EACzB,+BAA+B,GAC/B,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAC;AAElD,wCAAwC;AACxC,IAAI,CAAC,0DAA0D,EAAE,CAAC,CAAC,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"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export interface PasteDetectionOptions {
|
|
2
|
+
timeThreshold: number;
|
|
3
|
+
charThreshold: number;
|
|
4
|
+
lineThreshold: number;
|
|
5
|
+
}
|
|
6
|
+
export declare const DEFAULT_PASTE_OPTIONS: PasteDetectionOptions;
|
|
7
|
+
export declare class PasteDetector {
|
|
8
|
+
private lastInputTime;
|
|
9
|
+
private lastInputLength;
|
|
10
|
+
/**
|
|
11
|
+
* Detect if a text change is likely a paste operation
|
|
12
|
+
* @param newText The new text content
|
|
13
|
+
* @param options Detection thresholds
|
|
14
|
+
* @returns Object with detection result and details
|
|
15
|
+
*/
|
|
16
|
+
detectPaste(newText: string, options?: PasteDetectionOptions): {
|
|
17
|
+
isPaste: boolean;
|
|
18
|
+
method: 'rate' | 'size' | 'lines' | 'none';
|
|
19
|
+
addedText: string;
|
|
20
|
+
details: {
|
|
21
|
+
timeElapsed: number;
|
|
22
|
+
charsAdded: number;
|
|
23
|
+
linesAdded: number;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Reset the detector state (call when input is cleared or submitted)
|
|
28
|
+
*/
|
|
29
|
+
reset(): void;
|
|
30
|
+
/**
|
|
31
|
+
* Update detector state without triggering detection
|
|
32
|
+
* Useful for manual input changes that shouldn't be considered pastes
|
|
33
|
+
*/
|
|
34
|
+
updateState(text: string): void;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=paste-detection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paste-detection.d.ts","sourceRoot":"","sources":["../../source/utils/paste-detection.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,qBAAqB;IAErC,aAAa,EAAE,MAAM,CAAC;IAEtB,aAAa,EAAE,MAAM,CAAC;IAEtB,aAAa,EAAE,MAAM,CAAC;CACtB;AAED,eAAO,MAAM,qBAAqB,EAAE,qBAInC,CAAC;AAEF,qBAAa,aAAa;IACzB,OAAO,CAAC,aAAa,CAAK;IAC1B,OAAO,CAAC,eAAe,CAAK;IAE5B;;;;;OAKG;IACH,WAAW,CACV,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,qBAA6C,GACpD;QACF,OAAO,EAAE,OAAO,CAAC;QACjB,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC;QAC3C,SAAS,EAAE,MAAM,CAAC;QAClB,OAAO,EAAE;YACR,WAAW,EAAE,MAAM,CAAC;YACpB,UAAU,EAAE,MAAM,CAAC;YACnB,UAAU,EAAE,MAAM,CAAC;SACnB,CAAC;KACF;IA4DD;;OAEG;IACH,KAAK,IAAI,IAAI;IAKb;;;OAGG;IACH,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;CAI/B"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
// CLI Paste Detection Utilities
|
|
2
|
+
// Since CLI applications don't receive direct paste events, we use heuristics
|
|
3
|
+
export const DEFAULT_PASTE_OPTIONS = {
|
|
4
|
+
timeThreshold: 16, // ~1 frame at 60fps
|
|
5
|
+
charThreshold: 50, // Characters added in single change
|
|
6
|
+
lineThreshold: 2, // Multiple lines added instantly
|
|
7
|
+
};
|
|
8
|
+
export class PasteDetector {
|
|
9
|
+
lastInputTime = 0;
|
|
10
|
+
lastInputLength = 0;
|
|
11
|
+
/**
|
|
12
|
+
* Detect if a text change is likely a paste operation
|
|
13
|
+
* @param newText The new text content
|
|
14
|
+
* @param options Detection thresholds
|
|
15
|
+
* @returns Object with detection result and details
|
|
16
|
+
*/
|
|
17
|
+
detectPaste(newText, options = DEFAULT_PASTE_OPTIONS) {
|
|
18
|
+
const currentTime = Date.now();
|
|
19
|
+
const timeElapsed = currentTime - this.lastInputTime;
|
|
20
|
+
const charsAdded = newText.length - this.lastInputLength;
|
|
21
|
+
const linesAdded = newText.split('\n').length - 1;
|
|
22
|
+
// Get the added text (assuming it's at the end)
|
|
23
|
+
const addedText = newText.slice(this.lastInputLength);
|
|
24
|
+
// Update tracking
|
|
25
|
+
this.lastInputTime = currentTime;
|
|
26
|
+
this.lastInputLength = newText.length;
|
|
27
|
+
const details = {
|
|
28
|
+
timeElapsed,
|
|
29
|
+
charsAdded,
|
|
30
|
+
linesAdded,
|
|
31
|
+
};
|
|
32
|
+
// Method 1: Rate-based detection (fast input)
|
|
33
|
+
if (timeElapsed < options.timeThreshold &&
|
|
34
|
+
charsAdded > options.charThreshold) {
|
|
35
|
+
return {
|
|
36
|
+
isPaste: true,
|
|
37
|
+
method: 'rate',
|
|
38
|
+
addedText,
|
|
39
|
+
details,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
// Method 2: Size-based detection (large single input)
|
|
43
|
+
if (charsAdded > options.charThreshold * 2) {
|
|
44
|
+
return {
|
|
45
|
+
isPaste: true,
|
|
46
|
+
method: 'size',
|
|
47
|
+
addedText,
|
|
48
|
+
details,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
// Method 3: Multi-line detection
|
|
52
|
+
if (linesAdded >= options.lineThreshold) {
|
|
53
|
+
return {
|
|
54
|
+
isPaste: true,
|
|
55
|
+
method: 'lines',
|
|
56
|
+
addedText,
|
|
57
|
+
details,
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
return {
|
|
61
|
+
isPaste: false,
|
|
62
|
+
method: 'none',
|
|
63
|
+
addedText,
|
|
64
|
+
details,
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Reset the detector state (call when input is cleared or submitted)
|
|
69
|
+
*/
|
|
70
|
+
reset() {
|
|
71
|
+
this.lastInputTime = 0;
|
|
72
|
+
this.lastInputLength = 0;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Update detector state without triggering detection
|
|
76
|
+
* Useful for manual input changes that shouldn't be considered pastes
|
|
77
|
+
*/
|
|
78
|
+
updateState(text) {
|
|
79
|
+
this.lastInputTime = Date.now();
|
|
80
|
+
this.lastInputLength = text.length;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=paste-detection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paste-detection.js","sourceRoot":"","sources":["../../source/utils/paste-detection.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,8EAA8E;AAW9E,MAAM,CAAC,MAAM,qBAAqB,GAA0B;IAC3D,aAAa,EAAE,EAAE,EAAE,oBAAoB;IACvC,aAAa,EAAE,EAAE,EAAE,oCAAoC;IACvD,aAAa,EAAE,CAAC,EAAE,iCAAiC;CACnD,CAAC;AAEF,MAAM,OAAO,aAAa;IACjB,aAAa,GAAG,CAAC,CAAC;IAClB,eAAe,GAAG,CAAC,CAAC;IAE5B;;;;;OAKG;IACH,WAAW,CACV,OAAe,EACf,UAAiC,qBAAqB;QAWtD,MAAM,WAAW,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAC/B,MAAM,WAAW,GAAG,WAAW,GAAG,IAAI,CAAC,aAAa,CAAC;QACrD,MAAM,UAAU,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,eAAe,CAAC;QACzD,MAAM,UAAU,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;QAElD,gDAAgD;QAChD,MAAM,SAAS,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QAEtD,kBAAkB;QAClB,IAAI,CAAC,aAAa,GAAG,WAAW,CAAC;QACjC,IAAI,CAAC,eAAe,GAAG,OAAO,CAAC,MAAM,CAAC;QAEtC,MAAM,OAAO,GAAG;YACf,WAAW;YACX,UAAU;YACV,UAAU;SACV,CAAC;QAEF,8CAA8C;QAC9C,IACC,WAAW,GAAG,OAAO,CAAC,aAAa;YACnC,UAAU,GAAG,OAAO,CAAC,aAAa,EACjC,CAAC;YACF,OAAO;gBACN,OAAO,EAAE,IAAI;gBACb,MAAM,EAAE,MAAM;gBACd,SAAS;gBACT,OAAO;aACP,CAAC;QACH,CAAC;QAED,sDAAsD;QACtD,IAAI,UAAU,GAAG,OAAO,CAAC,aAAa,GAAG,CAAC,EAAE,CAAC;YAC5C,OAAO;gBACN,OAAO,EAAE,IAAI;gBACb,MAAM,EAAE,MAAM;gBACd,SAAS;gBACT,OAAO;aACP,CAAC;QACH,CAAC;QAED,iCAAiC;QACjC,IAAI,UAAU,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC;YACzC,OAAO;gBACN,OAAO,EAAE,IAAI;gBACb,MAAM,EAAE,OAAO;gBACf,SAAS;gBACT,OAAO;aACP,CAAC;QACH,CAAC;QAED,OAAO;YACN,OAAO,EAAE,KAAK;YACd,MAAM,EAAE,MAAM;YACd,SAAS;YACT,OAAO;SACP,CAAC;IACH,CAAC;IAED;;OAEG;IACH,KAAK;QACJ,IAAI,CAAC,aAAa,GAAG,CAAC,CAAC;QACvB,IAAI,CAAC,eAAe,GAAG,CAAC,CAAC;IAC1B,CAAC;IAED;;;OAGG;IACH,WAAW,CAAC,IAAY;QACvB,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAChC,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,MAAM,CAAC;IACpC,CAAC;CACD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paste-detection.spec.d.ts","sourceRoot":"","sources":["../../source/utils/paste-detection.spec.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import test from 'ava';
|
|
2
|
+
import { PasteDetector } from './paste-detection.js';
|
|
3
|
+
// Tests for PasteDetector class
|
|
4
|
+
// Validates CLI paste detection logic
|
|
5
|
+
test('PasteDetector detects rapid input as paste', t => {
|
|
6
|
+
const detector = new PasteDetector();
|
|
7
|
+
// Simulate rapid input - use 110 chars to exceed 50*2=100 threshold
|
|
8
|
+
const result = detector.detectPaste('a'.repeat(110));
|
|
9
|
+
t.true(result.isPaste);
|
|
10
|
+
t.is(result.method, 'size'); // Large input detected as paste
|
|
11
|
+
t.is(result.addedText, 'a'.repeat(110));
|
|
12
|
+
});
|
|
13
|
+
test('PasteDetector detects multi-line input as paste', t => {
|
|
14
|
+
const detector = new PasteDetector();
|
|
15
|
+
const multiLineText = 'line1\nline2\nline3\nline4';
|
|
16
|
+
const result = detector.detectPaste(multiLineText);
|
|
17
|
+
t.true(result.isPaste);
|
|
18
|
+
t.is(result.method, 'lines');
|
|
19
|
+
t.is(result.addedText, multiLineText);
|
|
20
|
+
});
|
|
21
|
+
test('PasteDetector does not detect small input as paste', t => {
|
|
22
|
+
const detector = new PasteDetector();
|
|
23
|
+
const result = detector.detectPaste('small');
|
|
24
|
+
t.false(result.isPaste);
|
|
25
|
+
t.is(result.method, 'none');
|
|
26
|
+
});
|
|
27
|
+
test('PasteDetector tracks incremental changes correctly', t => {
|
|
28
|
+
const detector = new PasteDetector();
|
|
29
|
+
// First input
|
|
30
|
+
const result1 = detector.detectPaste('hello');
|
|
31
|
+
t.false(result1.isPaste);
|
|
32
|
+
// Add more text (incremental)
|
|
33
|
+
const result2 = detector.detectPaste('hello world');
|
|
34
|
+
t.false(result2.isPaste);
|
|
35
|
+
t.is(result2.addedText, ' world');
|
|
36
|
+
});
|
|
37
|
+
test('PasteDetector reset clears state', t => {
|
|
38
|
+
const detector = new PasteDetector();
|
|
39
|
+
detector.detectPaste('some text');
|
|
40
|
+
detector.reset();
|
|
41
|
+
const result = detector.detectPaste('new text');
|
|
42
|
+
t.is(result.addedText, 'new text'); // Should be full text, not just diff
|
|
43
|
+
});
|
|
44
|
+
//# sourceMappingURL=paste-detection.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paste-detection.spec.js","sourceRoot":"","sources":["../../source/utils/paste-detection.spec.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,KAAK,CAAC;AACvB,OAAO,EAAC,aAAa,EAAC,MAAM,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AM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAC7B,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,oDAAoD,EAAE,CAAC,CAAC,EAAE;IAC9D,MAAM,QAAQ,GAAG,IAAI,aAAa,EAAE,CAAC;IAErC,cAAc;IACd,MAAM,OAAO,GAAG,QAAQ,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IAC9C,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAEzB,8BAA8B;IAC9B,MAAM,OAAO,GAAG,QAAQ,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC;IACpD,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IACzB,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;AACnC,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,kCAAkC,EAAE,CAAC,CAAC,EAAE;IAC5C,MAAM,QAAQ,GAAG,IAAI,aAAa,EAAE,CAAC;IAErC,QAAQ,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;IAClC,QAAQ,CAAC,KAAK,EAAE,CAAC;IAEjB,MAAM,MAAM,GAAG,QAAQ,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;IAChD,CAAC,CAAC,EAAE,CAAC,MAAM,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC,qCAAqC;AAC1E,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { InputState, PlaceholderContent } from '../types/hooks.js';
|
|
2
|
+
export declare function handlePaste(pastedText: string, currentDisplayValue: string, currentPlaceholderContent: Record<string, PlaceholderContent>, detectionMethod?: 'rate' | 'size' | 'multiline'): InputState | null;
|
|
3
|
+
//# sourceMappingURL=paste-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paste-utils.d.ts","sourceRoot":"","sources":["../../source/utils/paste-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,UAAU,EAEV,kBAAkB,EAElB,MAAM,mBAAmB,CAAC;AAE3B,wBAAgB,WAAW,CAC1B,UAAU,EAAE,MAAM,EAClB,mBAAmB,EAAE,MAAM,EAC3B,yBAAyB,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,EAC7D,eAAe,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,WAAW,GAC7C,UAAU,GAAG,IAAI,CAqCnB"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { PlaceholderType, } from '../types/hooks.js';
|
|
2
|
+
export function handlePaste(pastedText, currentDisplayValue, currentPlaceholderContent, detectionMethod) {
|
|
3
|
+
const THRESHOLD = 80; // characters
|
|
4
|
+
if (pastedText.length < THRESHOLD) {
|
|
5
|
+
return null;
|
|
6
|
+
}
|
|
7
|
+
// Generate simple incrementing ID based on existing paste placeholders
|
|
8
|
+
const existingPasteCount = Object.values(currentPlaceholderContent).filter(content => content.type === PlaceholderType.PASTE).length;
|
|
9
|
+
const pasteId = (existingPasteCount + 1).toString();
|
|
10
|
+
const placeholder = `[Paste #${pasteId}: ${pastedText.length} chars]`;
|
|
11
|
+
const pasteContent = {
|
|
12
|
+
type: PlaceholderType.PASTE,
|
|
13
|
+
displayText: placeholder,
|
|
14
|
+
content: pastedText,
|
|
15
|
+
originalSize: pastedText.length,
|
|
16
|
+
detectionMethod,
|
|
17
|
+
timestamp: Date.now(),
|
|
18
|
+
};
|
|
19
|
+
const newPlaceholderContent = {
|
|
20
|
+
...currentPlaceholderContent,
|
|
21
|
+
[pasteId]: pasteContent,
|
|
22
|
+
};
|
|
23
|
+
// For CLI paste detection, we need to replace the pasted text in the display value
|
|
24
|
+
// If the pasted text is at the end, replace it. Otherwise append the placeholder.
|
|
25
|
+
const newDisplayValue = currentDisplayValue.includes(pastedText)
|
|
26
|
+
? currentDisplayValue.replace(pastedText, placeholder)
|
|
27
|
+
: currentDisplayValue + placeholder;
|
|
28
|
+
return {
|
|
29
|
+
displayValue: newDisplayValue,
|
|
30
|
+
placeholderContent: newPlaceholderContent,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=paste-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paste-utils.js","sourceRoot":"","sources":["../../source/utils/paste-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAIN,eAAe,GACf,MAAM,mBAAmB,CAAC;AAE3B,MAAM,UAAU,WAAW,CAC1B,UAAkB,EAClB,mBAA2B,EAC3B,yBAA6D,EAC7D,eAA+C;IAE/C,MAAM,SAAS,GAAG,EAAE,CAAC,CAAC,aAAa;IACnC,IAAI,UAAU,CAAC,MAAM,GAAG,SAAS,EAAE,CAAC;QACnC,OAAO,IAAI,CAAC;IACb,CAAC;IAED,uEAAuE;IACvE,MAAM,kBAAkB,GAAG,MAAM,CAAC,MAAM,CAAC,yBAAyB,CAAC,CAAC,MAAM,CACzE,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,KAAK,eAAe,CAAC,KAAK,CACjD,CAAC,MAAM,CAAC;IACT,MAAM,OAAO,GAAG,CAAC,kBAAkB,GAAG,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;IACpD,MAAM,WAAW,GAAG,WAAW,OAAO,KAAK,UAAU,CAAC,MAAM,SAAS,CAAC;IAEtE,MAAM,YAAY,GAA4B;QAC7C,IAAI,EAAE,eAAe,CAAC,KAAK;QAC3B,WAAW,EAAE,WAAW;QACxB,OAAO,EAAE,UAAU;QACnB,YAAY,EAAE,UAAU,CAAC,MAAM;QAC/B,eAAe;QACf,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;KACrB,CAAC;IAEF,MAAM,qBAAqB,GAAG;QAC7B,GAAG,yBAAyB;QAC5B,CAAC,OAAO,CAAC,EAAE,YAAY;KACvB,CAAC;IAEF,mFAAmF;IACnF,kFAAkF;IAClF,MAAM,eAAe,GAAG,mBAAmB,CAAC,QAAQ,CAAC,UAAU,CAAC;QAC/D,CAAC,CAAC,mBAAmB,CAAC,OAAO,CAAC,UAAU,EAAE,WAAW,CAAC;QACtD,CAAC,CAAC,mBAAmB,GAAG,WAAW,CAAC;IAErC,OAAO;QACN,YAAY,EAAE,eAAe;QAC7B,kBAAkB,EAAE,qBAAqB;KACzC,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paste-utils.spec.d.ts","sourceRoot":"","sources":["../../source/utils/paste-utils.spec.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import test from 'ava';
|
|
2
|
+
import { handlePaste } from './paste-utils.js';
|
|
3
|
+
import { PlaceholderType } from '../types/hooks.js';
|
|
4
|
+
// Tests for handlePaste utility function
|
|
5
|
+
// Validates paste handling logic and placeholder creation
|
|
6
|
+
test('handlePaste returns null for small pastes', t => {
|
|
7
|
+
const pastedText = 'small text';
|
|
8
|
+
const currentDisplayValue = 'existing content';
|
|
9
|
+
const currentPlaceholderContent = {};
|
|
10
|
+
const result = handlePaste(pastedText, currentDisplayValue, currentPlaceholderContent);
|
|
11
|
+
t.is(result, null);
|
|
12
|
+
});
|
|
13
|
+
test('handlePaste creates placeholder for large pastes', t => {
|
|
14
|
+
const pastedText = 'a'.repeat(600); // Above 500 char threshold
|
|
15
|
+
const currentDisplayValue = 'existing content';
|
|
16
|
+
const currentPlaceholderContent = {};
|
|
17
|
+
const result = handlePaste(pastedText, currentDisplayValue, currentPlaceholderContent);
|
|
18
|
+
t.truthy(result);
|
|
19
|
+
t.is(typeof result.displayValue, 'string');
|
|
20
|
+
t.true(result.displayValue.includes('[Paste #'));
|
|
21
|
+
t.true(result.displayValue.includes('600 chars]'));
|
|
22
|
+
// Should contain the pasted content in the map
|
|
23
|
+
const pasteIds = Object.keys(result.placeholderContent);
|
|
24
|
+
t.is(pasteIds.length, 1);
|
|
25
|
+
const pasteContent = result.placeholderContent[pasteIds[0]];
|
|
26
|
+
t.is(pasteContent.content, pastedText);
|
|
27
|
+
t.is(pasteContent.type, PlaceholderType.PASTE);
|
|
28
|
+
});
|
|
29
|
+
test('handlePaste replaces pasted text with placeholder in display value', t => {
|
|
30
|
+
const pastedText = 'x'.repeat(700);
|
|
31
|
+
const currentDisplayValue = `prefix ${pastedText} suffix`;
|
|
32
|
+
const currentPlaceholderContent = {};
|
|
33
|
+
const result = handlePaste(pastedText, currentDisplayValue, currentPlaceholderContent);
|
|
34
|
+
t.truthy(result);
|
|
35
|
+
t.true(result.displayValue.startsWith('prefix [Paste #'));
|
|
36
|
+
t.true(result.displayValue.endsWith('700 chars] suffix'));
|
|
37
|
+
t.false(result.displayValue.includes('x'.repeat(10))); // Original text should be gone
|
|
38
|
+
});
|
|
39
|
+
test('handlePaste preserves existing pasted content', t => {
|
|
40
|
+
const existingPlaceholderContent = {
|
|
41
|
+
'123': {
|
|
42
|
+
type: PlaceholderType.PASTE,
|
|
43
|
+
displayText: '[Paste #123: 24 chars]',
|
|
44
|
+
content: 'previous paste content',
|
|
45
|
+
originalSize: 24,
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
const pastedText = 'b'.repeat(800);
|
|
49
|
+
const currentDisplayValue = 'some text';
|
|
50
|
+
const result = handlePaste(pastedText, currentDisplayValue, existingPlaceholderContent);
|
|
51
|
+
t.truthy(result);
|
|
52
|
+
t.is(Object.keys(result.placeholderContent).length, 2);
|
|
53
|
+
const existingContent = result.placeholderContent['123'];
|
|
54
|
+
t.is(existingContent.content, 'previous paste content');
|
|
55
|
+
// Find the new paste ID
|
|
56
|
+
const newPasteId = Object.keys(result.placeholderContent).find(id => id !== '123');
|
|
57
|
+
t.truthy(newPasteId);
|
|
58
|
+
const newContent = result.placeholderContent[newPasteId];
|
|
59
|
+
t.is(newContent.content, pastedText);
|
|
60
|
+
});
|
|
61
|
+
//# sourceMappingURL=paste-utils.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|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