@openclaw/diffs 2026.9.4 → 2026.9.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/assets/activity.svg +3 -0
- package/assets/icon.png +0 -0
- package/dist/{browser.runtime-DTKAejqd.js → .setup/browser.runtime-VjaO3wrj.mjs} +1 -1
- package/dist/assets/viewer-runtime.js +50 -56
- package/dist/index.js +44 -18
- package/node_modules/@pierre/diffs/dist/components/CodeView.d.ts +117 -70
- package/node_modules/@pierre/diffs/dist/components/CodeView.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/components/CodeView.js +197 -65
- package/node_modules/@pierre/diffs/dist/components/CodeView.js.map +1 -1
- package/node_modules/@pierre/diffs/dist/components/File.d.ts +81 -29
- package/node_modules/@pierre/diffs/dist/components/File.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/components/File.js +244 -66
- package/node_modules/@pierre/diffs/dist/components/File.js.map +1 -1
- package/node_modules/@pierre/diffs/dist/components/FileDiff.d.ts +109 -57
- package/node_modules/@pierre/diffs/dist/components/FileDiff.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/components/FileDiff.js +445 -112
- package/node_modules/@pierre/diffs/dist/components/FileDiff.js.map +1 -1
- package/node_modules/@pierre/diffs/dist/components/FileStream.d.ts +1 -0
- package/node_modules/@pierre/diffs/dist/components/FileStream.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/components/FileStream.js +1 -1
- package/node_modules/@pierre/diffs/dist/components/UnresolvedFile.d.ts +3 -3
- package/node_modules/@pierre/diffs/dist/components/UnresolvedFile.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/components/UnresolvedFile.js +4 -3
- package/node_modules/@pierre/diffs/dist/components/UnresolvedFile.js.map +1 -1
- package/node_modules/@pierre/diffs/dist/components/VirtualizedFile.d.ts +18 -14
- package/node_modules/@pierre/diffs/dist/components/VirtualizedFile.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/components/VirtualizedFile.js +153 -62
- package/node_modules/@pierre/diffs/dist/components/VirtualizedFile.js.map +1 -1
- package/node_modules/@pierre/diffs/dist/components/VirtualizedFileDiff.d.ts +17 -16
- package/node_modules/@pierre/diffs/dist/components/VirtualizedFileDiff.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/components/VirtualizedFileDiff.js +197 -105
- package/node_modules/@pierre/diffs/dist/components/VirtualizedFileDiff.js.map +1 -1
- package/node_modules/@pierre/diffs/dist/components/Virtualizer.d.ts +1 -5
- package/node_modules/@pierre/diffs/dist/components/Virtualizer.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/components/Virtualizer.js.map +1 -1
- package/node_modules/@pierre/diffs/dist/components/VirtulizerDevelopment.d.ts +1 -2
- package/node_modules/@pierre/diffs/dist/components/VirtulizerDevelopment.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/components/web-components.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/components/web-components.js +2 -1
- package/node_modules/@pierre/diffs/dist/components/web-components.js.map +1 -1
- package/node_modules/@pierre/diffs/dist/constants.d.ts +0 -1
- package/node_modules/@pierre/diffs/dist/constants.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/edit/index.d.ts +7 -4
- package/node_modules/@pierre/diffs/dist/edit/index.js +5 -1
- package/node_modules/@pierre/diffs/dist/editor/EditStateManager.d.ts +55 -0
- package/node_modules/@pierre/diffs/dist/editor/EditStateManager.d.ts.map +1 -0
- package/node_modules/@pierre/diffs/dist/editor/EditStateManager.js +135 -0
- package/node_modules/@pierre/diffs/dist/editor/EditStateManager.js.map +1 -0
- package/node_modules/@pierre/diffs/dist/editor/cloneRetainedDiffSessionSnapshot.d.ts +6 -0
- package/node_modules/@pierre/diffs/dist/editor/cloneRetainedDiffSessionSnapshot.d.ts.map +1 -0
- package/node_modules/@pierre/diffs/dist/editor/cloneRetainedDiffSessionSnapshot.js +16 -0
- package/node_modules/@pierre/diffs/dist/editor/cloneRetainedDiffSessionSnapshot.js.map +1 -0
- package/node_modules/@pierre/diffs/dist/editor/command.d.ts +2 -1
- package/node_modules/@pierre/diffs/dist/editor/command.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/editor/editPrediction.d.ts +77 -0
- package/node_modules/@pierre/diffs/dist/editor/editPrediction.d.ts.map +1 -0
- package/node_modules/@pierre/diffs/dist/editor/editPrediction.js +365 -0
- package/node_modules/@pierre/diffs/dist/editor/editPrediction.js.map +1 -0
- package/node_modules/@pierre/diffs/dist/editor/editStack.d.ts +19 -41
- package/node_modules/@pierre/diffs/dist/editor/editStack.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/editor/editStack.js +67 -4
- package/node_modules/@pierre/diffs/dist/editor/editStack.js.map +1 -1
- package/node_modules/@pierre/diffs/dist/editor/editor.d.ts +117 -32
- package/node_modules/@pierre/diffs/dist/editor/editor.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/editor/editor.js +1125 -396
- package/node_modules/@pierre/diffs/dist/editor/editor.js.map +1 -1
- package/node_modules/@pierre/diffs/dist/editor/editor2.js +1 -1
- package/node_modules/@pierre/diffs/dist/editor/editor2.js.map +1 -1
- package/node_modules/@pierre/diffs/dist/editor/languages.d.ts +3 -4
- package/node_modules/@pierre/diffs/dist/editor/languages.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/editor/languages.js +1 -1
- package/node_modules/@pierre/diffs/dist/editor/languages.js.map +1 -1
- package/node_modules/@pierre/diffs/dist/editor/lineAnnotations.d.ts +3 -4
- package/node_modules/@pierre/diffs/dist/editor/lineAnnotations.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/editor/lineAnnotations.js +18 -8
- package/node_modules/@pierre/diffs/dist/editor/lineAnnotations.js.map +1 -1
- package/node_modules/@pierre/diffs/dist/editor/marker.d.ts +2 -3
- package/node_modules/@pierre/diffs/dist/editor/marker.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/editor/marker.js +5 -3
- package/node_modules/@pierre/diffs/dist/editor/marker.js.map +1 -1
- package/node_modules/@pierre/diffs/dist/editor/matchBrackets.d.ts +2 -3
- package/node_modules/@pierre/diffs/dist/editor/matchBrackets.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/editor/matchBrackets.js.map +1 -1
- package/node_modules/@pierre/diffs/dist/editor/pieceTable.d.ts +1 -2
- package/node_modules/@pierre/diffs/dist/editor/pieceTable.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/editor/pieceTable.js.map +1 -1
- package/node_modules/@pierre/diffs/dist/editor/platform.d.ts +1 -5
- package/node_modules/@pierre/diffs/dist/editor/platform.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/editor/platform.js.map +1 -1
- package/node_modules/@pierre/diffs/dist/editor/popover.d.ts +12 -12
- package/node_modules/@pierre/diffs/dist/editor/popover.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/editor/popover.js.map +1 -1
- package/node_modules/@pierre/diffs/dist/editor/searchPanel.d.ts +2 -3
- package/node_modules/@pierre/diffs/dist/editor/searchPanel.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/editor/searchPanel.js +17 -13
- package/node_modules/@pierre/diffs/dist/editor/searchPanel.js.map +1 -1
- package/node_modules/@pierre/diffs/dist/editor/selection.d.ts +32 -24
- package/node_modules/@pierre/diffs/dist/editor/selection.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/editor/selection.js +3 -3
- package/node_modules/@pierre/diffs/dist/editor/selection.js.map +1 -1
- package/node_modules/@pierre/diffs/dist/editor/selectionAction.d.ts +3 -4
- package/node_modules/@pierre/diffs/dist/editor/selectionAction.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/editor/selectionAction.js.map +1 -1
- package/node_modules/@pierre/diffs/dist/editor/sprite.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/editor/textDocument.d.ts +11 -9
- package/node_modules/@pierre/diffs/dist/editor/textDocument.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/editor/textDocument.js +28 -5
- package/node_modules/@pierre/diffs/dist/editor/textDocument.js.map +1 -1
- package/node_modules/@pierre/diffs/dist/editor/textDocumentChangeTransaction.d.ts +14 -0
- package/node_modules/@pierre/diffs/dist/editor/textDocumentChangeTransaction.d.ts.map +1 -0
- package/node_modules/@pierre/diffs/dist/editor/textDocumentChangeTransaction.js +12 -0
- package/node_modules/@pierre/diffs/dist/editor/textDocumentChangeTransaction.js.map +1 -0
- package/node_modules/@pierre/diffs/dist/editor/textMeasure.d.ts +5 -0
- package/node_modules/@pierre/diffs/dist/editor/textMeasure.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/editor/textMeasure.js +10 -0
- package/node_modules/@pierre/diffs/dist/editor/textMeasure.js.map +1 -1
- package/node_modules/@pierre/diffs/dist/editor/tokenizer.d.ts +2 -12
- package/node_modules/@pierre/diffs/dist/editor/tokenizer.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/editor/tokenizer.js +8 -4
- package/node_modules/@pierre/diffs/dist/editor/tokenizer.js.map +1 -1
- package/node_modules/@pierre/diffs/dist/editor/types.d.ts +266 -0
- package/node_modules/@pierre/diffs/dist/editor/types.d.ts.map +1 -0
- package/node_modules/@pierre/diffs/dist/editor/types.js +0 -0
- package/node_modules/@pierre/diffs/dist/editor/utils.d.ts +2 -1
- package/node_modules/@pierre/diffs/dist/editor/utils.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/editor/utils.js +15 -8
- package/node_modules/@pierre/diffs/dist/editor/utils.js.map +1 -1
- package/node_modules/@pierre/diffs/dist/highlighter/languages/areLanguagesAttached.d.ts +0 -1
- package/node_modules/@pierre/diffs/dist/highlighter/languages/areLanguagesAttached.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/highlighter/languages/attachResolvedLanguages.d.ts +1 -0
- package/node_modules/@pierre/diffs/dist/highlighter/languages/attachResolvedLanguages.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/highlighter/languages/cleanUpResolvedLanguages.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/highlighter/languages/constants.d.ts +1 -1
- package/node_modules/@pierre/diffs/dist/highlighter/languages/constants.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/highlighter/languages/getResolvedLanguages.d.ts +1 -0
- package/node_modules/@pierre/diffs/dist/highlighter/languages/getResolvedLanguages.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/highlighter/languages/getResolvedOrResolveLanguage.d.ts +1 -0
- package/node_modules/@pierre/diffs/dist/highlighter/languages/getResolvedOrResolveLanguage.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/highlighter/languages/hasResolvedLanguages.d.ts +0 -1
- package/node_modules/@pierre/diffs/dist/highlighter/languages/hasResolvedLanguages.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/highlighter/languages/registerCustomLanguage.d.ts +0 -1
- package/node_modules/@pierre/diffs/dist/highlighter/languages/registerCustomLanguage.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/highlighter/languages/resolveLanguage.d.ts +1 -0
- package/node_modules/@pierre/diffs/dist/highlighter/languages/resolveLanguage.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/highlighter/languages/resolveLanguages.d.ts +1 -0
- package/node_modules/@pierre/diffs/dist/highlighter/languages/resolveLanguages.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/highlighter/shared_highlighter.d.ts +7 -8
- package/node_modules/@pierre/diffs/dist/highlighter/shared_highlighter.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/highlighter/shared_highlighter.js +7 -3
- package/node_modules/@pierre/diffs/dist/highlighter/shared_highlighter.js.map +1 -1
- package/node_modules/@pierre/diffs/dist/highlighter/themes/areThemesAttached.d.ts +0 -1
- package/node_modules/@pierre/diffs/dist/highlighter/themes/areThemesAttached.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/highlighter/themes/areThemesAttached.js +1 -1
- package/node_modules/@pierre/diffs/dist/highlighter/themes/attachResolvedThemes.d.ts +0 -1
- package/node_modules/@pierre/diffs/dist/highlighter/themes/attachResolvedThemes.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/highlighter/themes/cleanUpResolvedThemes.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/highlighter/themes/constants.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/highlighter/themes/getResolvedOrResolveTheme.d.ts +0 -1
- package/node_modules/@pierre/diffs/dist/highlighter/themes/getResolvedOrResolveTheme.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/highlighter/themes/getResolvedThemes.d.ts +0 -1
- package/node_modules/@pierre/diffs/dist/highlighter/themes/getResolvedThemes.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/highlighter/themes/hasResolvedThemes.d.ts +0 -1
- package/node_modules/@pierre/diffs/dist/highlighter/themes/hasResolvedThemes.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/highlighter/themes/registerCustomCSSVariableTheme.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/highlighter/themes/registerCustomTheme.d.ts +0 -1
- package/node_modules/@pierre/diffs/dist/highlighter/themes/registerCustomTheme.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/highlighter/themes/resolveTheme.d.ts +0 -1
- package/node_modules/@pierre/diffs/dist/highlighter/themes/resolveTheme.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/highlighter/themes/resolveThemes.d.ts +0 -1
- package/node_modules/@pierre/diffs/dist/highlighter/themes/resolveThemes.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/highlighter/themes/themeResolution.d.ts +0 -1
- package/node_modules/@pierre/diffs/dist/highlighter/themes/themeResolution.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/highlighter/themes/themeResolver.d.ts +0 -1
- package/node_modules/@pierre/diffs/dist/highlighter/themes/themeResolver.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/index.d.ts +9 -6
- package/node_modules/@pierre/diffs/dist/index.js +22 -21
- package/node_modules/@pierre/diffs/dist/managers/InteractionManager.d.ts +2 -26
- package/node_modules/@pierre/diffs/dist/managers/InteractionManager.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/managers/InteractionManager.js +8 -3
- package/node_modules/@pierre/diffs/dist/managers/InteractionManager.js.map +1 -1
- package/node_modules/@pierre/diffs/dist/managers/ResizeManager.d.ts +1 -4
- package/node_modules/@pierre/diffs/dist/managers/ResizeManager.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/managers/ScrollSyncManager.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/managers/UniversalRenderingManager.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/node_modules/.pnpm/@types_hast@3.0.4/node_modules/@types/hast/index.d.ts +0 -1
- package/node_modules/@pierre/diffs/dist/node_modules/.pnpm/@types_hast@3.0.4/node_modules/@types/hast/index.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/node_modules/.pnpm/@types_unist@3.0.3/node_modules/@types/unist/index.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/react/CodeView.d.ts +45 -26
- package/node_modules/@pierre/diffs/dist/react/CodeView.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/react/CodeView.js +52 -45
- package/node_modules/@pierre/diffs/dist/react/CodeView.js.map +1 -1
- package/node_modules/@pierre/diffs/dist/react/EditContext.d.ts +8 -14
- package/node_modules/@pierre/diffs/dist/react/EditContext.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/react/EditContext.js +2 -9
- package/node_modules/@pierre/diffs/dist/react/EditContext.js.map +1 -1
- package/node_modules/@pierre/diffs/dist/react/File.d.ts +5 -23
- package/node_modules/@pierre/diffs/dist/react/File.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/react/File.js +19 -14
- package/node_modules/@pierre/diffs/dist/react/File.js.map +1 -1
- package/node_modules/@pierre/diffs/dist/react/FileDiff.d.ts +5 -22
- package/node_modules/@pierre/diffs/dist/react/FileDiff.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/react/FileDiff.js +19 -14
- package/node_modules/@pierre/diffs/dist/react/FileDiff.js.map +1 -1
- package/node_modules/@pierre/diffs/dist/react/MultiFileDiff.d.ts +3 -23
- package/node_modules/@pierre/diffs/dist/react/MultiFileDiff.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/react/MultiFileDiff.js +19 -22
- package/node_modules/@pierre/diffs/dist/react/MultiFileDiff.js.map +1 -1
- package/node_modules/@pierre/diffs/dist/react/PatchDiff.d.ts +2 -21
- package/node_modules/@pierre/diffs/dist/react/PatchDiff.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/react/PatchDiff.js +19 -14
- package/node_modules/@pierre/diffs/dist/react/PatchDiff.js.map +1 -1
- package/node_modules/@pierre/diffs/dist/react/UnresolvedFile.d.ts +4 -21
- package/node_modules/@pierre/diffs/dist/react/UnresolvedFile.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/react/UnresolvedFile.js +15 -14
- package/node_modules/@pierre/diffs/dist/react/UnresolvedFile.js.map +1 -1
- package/node_modules/@pierre/diffs/dist/react/Virtualizer.d.ts +1 -9
- package/node_modules/@pierre/diffs/dist/react/Virtualizer.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/react/Virtualizer.js.map +1 -1
- package/node_modules/@pierre/diffs/dist/react/WorkerPoolContext.d.ts +2 -6
- package/node_modules/@pierre/diffs/dist/react/WorkerPoolContext.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/react/constants.d.ts +0 -1
- package/node_modules/@pierre/diffs/dist/react/constants.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/react/index.d.ts +8 -5
- package/node_modules/@pierre/diffs/dist/react/jsx.d.ts +1 -0
- package/node_modules/@pierre/diffs/dist/react/jsx.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/react/types.d.ts +47 -10
- package/node_modules/@pierre/diffs/dist/react/types.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/react/utils/assignRef.d.ts +6 -0
- package/node_modules/@pierre/diffs/dist/react/utils/assignRef.d.ts.map +1 -0
- package/node_modules/@pierre/diffs/dist/react/utils/assignRef.js +9 -0
- package/node_modules/@pierre/diffs/dist/react/utils/assignRef.js.map +1 -0
- package/node_modules/@pierre/diffs/dist/react/utils/renderDiffChildren.d.ts +11 -24
- package/node_modules/@pierre/diffs/dist/react/utils/renderDiffChildren.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/react/utils/renderDiffChildren.js +2 -2
- package/node_modules/@pierre/diffs/dist/react/utils/renderDiffChildren.js.map +1 -1
- package/node_modules/@pierre/diffs/dist/react/utils/renderFileChildren.d.ts +11 -21
- package/node_modules/@pierre/diffs/dist/react/utils/renderFileChildren.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/react/utils/renderFileChildren.js +2 -2
- package/node_modules/@pierre/diffs/dist/react/utils/renderFileChildren.js.map +1 -1
- package/node_modules/@pierre/diffs/dist/react/utils/templateRender.d.ts +0 -1
- package/node_modules/@pierre/diffs/dist/react/utils/templateRender.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/react/utils/useFileDiffInstance.d.ts +16 -20
- package/node_modules/@pierre/diffs/dist/react/utils/useFileDiffInstance.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/react/utils/useFileDiffInstance.js +126 -22
- package/node_modules/@pierre/diffs/dist/react/utils/useFileDiffInstance.js.map +1 -1
- package/node_modules/@pierre/diffs/dist/react/utils/useFileInstance.d.ts +11 -19
- package/node_modules/@pierre/diffs/dist/react/utils/useFileInstance.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/react/utils/useFileInstance.js +88 -25
- package/node_modules/@pierre/diffs/dist/react/utils/useFileInstance.js.map +1 -1
- package/node_modules/@pierre/diffs/dist/react/utils/useStableCallback.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/react/utils/useUnresolvedFileInstance.d.ts +1 -12
- package/node_modules/@pierre/diffs/dist/react/utils/useUnresolvedFileInstance.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/renderers/DiffHunksRenderer.d.ts +34 -24
- package/node_modules/@pierre/diffs/dist/renderers/DiffHunksRenderer.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/renderers/DiffHunksRenderer.js +188 -118
- package/node_modules/@pierre/diffs/dist/renderers/DiffHunksRenderer.js.map +1 -1
- package/node_modules/@pierre/diffs/dist/renderers/FileRenderer.d.ts +28 -11
- package/node_modules/@pierre/diffs/dist/renderers/FileRenderer.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/renderers/FileRenderer.js +141 -67
- package/node_modules/@pierre/diffs/dist/renderers/FileRenderer.js.map +1 -1
- package/node_modules/@pierre/diffs/dist/renderers/UnresolvedFileHunksRenderer.d.ts +5 -11
- package/node_modules/@pierre/diffs/dist/renderers/UnresolvedFileHunksRenderer.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/renderers/UnresolvedFileHunksRenderer.js +2 -2
- package/node_modules/@pierre/diffs/dist/renderers/UnresolvedFileHunksRenderer.js.map +1 -1
- package/node_modules/@pierre/diffs/dist/shiki-stream/stream.d.ts +0 -1
- package/node_modules/@pierre/diffs/dist/shiki-stream/stream.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/shiki-stream/stream.js.map +1 -1
- package/node_modules/@pierre/diffs/dist/shiki-stream/tokenizer.d.ts +0 -1
- package/node_modules/@pierre/diffs/dist/shiki-stream/tokenizer.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/shiki-stream/tokenizer.js +2 -1
- package/node_modules/@pierre/diffs/dist/shiki-stream/tokenizer.js.map +1 -1
- package/node_modules/@pierre/diffs/dist/shiki-stream/types.d.ts +0 -1
- package/node_modules/@pierre/diffs/dist/shiki-stream/types.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/sprite.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/ssr/FileDiffReact.d.ts +1 -8
- package/node_modules/@pierre/diffs/dist/ssr/FileDiffReact.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/ssr/FileDiffReact.js +8 -3
- package/node_modules/@pierre/diffs/dist/ssr/FileDiffReact.js.map +1 -1
- package/node_modules/@pierre/diffs/dist/ssr/index.d.ts +2 -2
- package/node_modules/@pierre/diffs/dist/ssr/preloadDiffs.d.ts +19 -47
- package/node_modules/@pierre/diffs/dist/ssr/preloadDiffs.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/ssr/preloadDiffs.js +1 -1
- package/node_modules/@pierre/diffs/dist/ssr/preloadDiffs.js.map +1 -1
- package/node_modules/@pierre/diffs/dist/ssr/preloadFile.d.ts +5 -10
- package/node_modules/@pierre/diffs/dist/ssr/preloadFile.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/ssr/preloadFile.js.map +1 -1
- package/node_modules/@pierre/diffs/dist/ssr/preloadPatchFile.d.ts +3 -7
- package/node_modules/@pierre/diffs/dist/ssr/preloadPatchFile.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/ssr/preloadPatchFile.js.map +1 -1
- package/node_modules/@pierre/diffs/dist/ssr/renderHTML.d.ts +0 -1
- package/node_modules/@pierre/diffs/dist/ssr/renderHTML.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/string-import.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/style.js +1 -1
- package/node_modules/@pierre/diffs/dist/style.js.map +1 -1
- package/node_modules/@pierre/diffs/dist/types.d.ts +13 -264
- package/node_modules/@pierre/diffs/dist/types.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/annotationHelpers.d.ts +0 -1
- package/node_modules/@pierre/diffs/dist/utils/annotationHelpers.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/appendItems.d.ts +5 -0
- package/node_modules/@pierre/diffs/dist/utils/appendItems.d.ts.map +1 -0
- package/node_modules/@pierre/diffs/dist/utils/appendItems.js +8 -0
- package/node_modules/@pierre/diffs/dist/utils/appendItems.js.map +1 -0
- package/node_modules/@pierre/diffs/dist/utils/applyLineTextWithNewline.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/areDiffLineAnnotationsEqual.d.ts +0 -1
- package/node_modules/@pierre/diffs/dist/utils/areDiffLineAnnotationsEqual.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/areDiffRenderOptionsEqual.d.ts +0 -1
- package/node_modules/@pierre/diffs/dist/utils/areDiffRenderOptionsEqual.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/areDiffTargetsEqual.d.ts +0 -1
- package/node_modules/@pierre/diffs/dist/utils/areDiffTargetsEqual.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/areDiffTargetsEqual.js +1 -1
- package/node_modules/@pierre/diffs/dist/utils/areDiffTargetsEqual.js.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/areFileRenderOptionsEqual.d.ts +0 -1
- package/node_modules/@pierre/diffs/dist/utils/areFileRenderOptionsEqual.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/areFileTargetsEqual.d.ts +6 -0
- package/node_modules/@pierre/diffs/dist/utils/areFileTargetsEqual.d.ts.map +1 -0
- package/node_modules/@pierre/diffs/dist/utils/areFileTargetsEqual.js +8 -0
- package/node_modules/@pierre/diffs/dist/utils/areFileTargetsEqual.js.map +1 -0
- package/node_modules/@pierre/diffs/dist/utils/areFilesEqual.d.ts +0 -1
- package/node_modules/@pierre/diffs/dist/utils/areFilesEqual.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/areHunkDataEqual.d.ts +0 -1
- package/node_modules/@pierre/diffs/dist/utils/areHunkDataEqual.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/areLineAnnotationsEqual.d.ts +0 -1
- package/node_modules/@pierre/diffs/dist/utils/areLineAnnotationsEqual.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/areManagedSnapshotsEqual.d.ts +1 -2
- package/node_modules/@pierre/diffs/dist/utils/areManagedSnapshotsEqual.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/areManagedSnapshotsEqual.js.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/areMergeConflictActionsEqual.d.ts +0 -1
- package/node_modules/@pierre/diffs/dist/utils/areMergeConflictActionsEqual.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/areObjectsEqual.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/areOptionsEqual.d.ts +4 -3
- package/node_modules/@pierre/diffs/dist/utils/areOptionsEqual.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/areOptionsEqual.js.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/arePrePropertiesEqual.d.ts +0 -1
- package/node_modules/@pierre/diffs/dist/utils/arePrePropertiesEqual.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/areRenderRangesEqual.d.ts +0 -1
- package/node_modules/@pierre/diffs/dist/utils/areRenderRangesEqual.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/areSelectionPointsEqual.d.ts +0 -1
- package/node_modules/@pierre/diffs/dist/utils/areSelectionPointsEqual.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/areSelectionsEqual.d.ts +0 -1
- package/node_modules/@pierre/diffs/dist/utils/areSelectionsEqual.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/areThemesEqual.d.ts +0 -1
- package/node_modules/@pierre/diffs/dist/utils/areThemesEqual.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/areVirtualWindowSpecsEqual.d.ts +0 -1
- package/node_modules/@pierre/diffs/dist/utils/areVirtualWindowSpecsEqual.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/areWorkerStatsEqual.d.ts +1 -0
- package/node_modules/@pierre/diffs/dist/utils/areWorkerStatsEqual.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/awaitWithTimeout.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/cleanLastNewline.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/cloneFileDiffMetadata.d.ts +3 -3
- package/node_modules/@pierre/diffs/dist/utils/cloneFileDiffMetadata.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/cloneFileDiffMetadata.js +8 -5
- package/node_modules/@pierre/diffs/dist/utils/cloneFileDiffMetadata.js.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/composeCacheKey.d.ts +6 -0
- package/node_modules/@pierre/diffs/dist/utils/composeCacheKey.d.ts.map +1 -0
- package/node_modules/@pierre/diffs/dist/utils/composeCacheKey.js +10 -0
- package/node_modules/@pierre/diffs/dist/utils/composeCacheKey.js.map +1 -0
- package/node_modules/@pierre/diffs/dist/utils/computeEstimatedDiffHeights.d.ts +1 -11
- package/node_modules/@pierre/diffs/dist/utils/computeEstimatedDiffHeights.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/computeFileOffsets.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/computeFileOffsets.js +9 -8
- package/node_modules/@pierre/diffs/dist/utils/computeFileOffsets.js.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/computeVirtualFileMetrics.d.ts +0 -1
- package/node_modules/@pierre/diffs/dist/utils/computeVirtualFileMetrics.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/createAnnotationElement.d.ts +0 -1
- package/node_modules/@pierre/diffs/dist/utils/createAnnotationElement.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/createAnnotationWrapperNode.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/createCodeViewHeaderFooterHostElement.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/createContentColumn.d.ts +0 -1
- package/node_modules/@pierre/diffs/dist/utils/createContentColumn.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/createEmptyRowBuffer.d.ts +0 -1
- package/node_modules/@pierre/diffs/dist/utils/createEmptyRowBuffer.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/createFileHeaderElement.d.ts +1 -6
- package/node_modules/@pierre/diffs/dist/utils/createFileHeaderElement.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/createGutterUtilityContentNode.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/createGutterUtilityElement.d.ts +0 -1
- package/node_modules/@pierre/diffs/dist/utils/createGutterUtilityElement.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/createNoNewlineElement.d.ts +0 -1
- package/node_modules/@pierre/diffs/dist/utils/createNoNewlineElement.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/createPreElement.d.ts +1 -11
- package/node_modules/@pierre/diffs/dist/utils/createPreElement.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/createRowNodes.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/createSeparator.d.ts +1 -10
- package/node_modules/@pierre/diffs/dist/utils/createSeparator.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/createSeparator.js +12 -10
- package/node_modules/@pierre/diffs/dist/utils/createSeparator.js.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/createSpanNodeFromToken.d.ts +0 -1
- package/node_modules/@pierre/diffs/dist/utils/createSpanNodeFromToken.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/createSpanNodeFromToken.js +2 -1
- package/node_modules/@pierre/diffs/dist/utils/createSpanNodeFromToken.js.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/createStyleElement.d.ts +0 -1
- package/node_modules/@pierre/diffs/dist/utils/createStyleElement.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/createTransformerWithState.d.ts +0 -1
- package/node_modules/@pierre/diffs/dist/utils/createTransformerWithState.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/createUnsafeCSSStyleNode.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/createWindowFromScrollPosition.d.ts +1 -9
- package/node_modules/@pierre/diffs/dist/utils/createWindowFromScrollPosition.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/cssWrappers.d.ts +0 -1
- package/node_modules/@pierre/diffs/dist/utils/cssWrappers.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/cssWrappers.js +5 -3
- package/node_modules/@pierre/diffs/dist/utils/cssWrappers.js.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/detachString.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/diffAcceptRejectHunk.d.ts +0 -1
- package/node_modules/@pierre/diffs/dist/utils/diffAcceptRejectHunk.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/editSessionAnnotations.d.ts +68 -0
- package/node_modules/@pierre/diffs/dist/utils/editSessionAnnotations.d.ts.map +1 -0
- package/node_modules/@pierre/diffs/dist/utils/editSessionAnnotations.js +64 -0
- package/node_modules/@pierre/diffs/dist/utils/editSessionAnnotations.js.map +1 -0
- package/node_modules/@pierre/diffs/dist/utils/editSessionHunks.d.ts +5 -4
- package/node_modules/@pierre/diffs/dist/utils/editSessionHunks.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/editSessionHunks.js +7 -5
- package/node_modules/@pierre/diffs/dist/utils/editSessionHunks.js.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/formatCSSVariablePrefix.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/getDiffFileInput.d.ts +1 -5
- package/node_modules/@pierre/diffs/dist/utils/getDiffFileInput.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/getDiffHunksRendererOptions.d.ts +1 -2
- package/node_modules/@pierre/diffs/dist/utils/getDiffHunksRendererOptions.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/getDiffHunksRendererOptions.js.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/getFileRendererOptions.d.ts +1 -2
- package/node_modules/@pierre/diffs/dist/utils/getFileRendererOptions.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/getFileRendererOptions.js.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/getFiletypeFromFileName.d.ts +0 -1
- package/node_modules/@pierre/diffs/dist/utils/getFiletypeFromFileName.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/getFiletypeFromFileName.js.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/getHighlighterOptions.d.ts +1 -5
- package/node_modules/@pierre/diffs/dist/utils/getHighlighterOptions.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/getHighlighterOptions.js +1 -1
- package/node_modules/@pierre/diffs/dist/utils/getHighlighterOptions.js.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/getHighlighterThemeStyles.d.ts +1 -6
- package/node_modules/@pierre/diffs/dist/utils/getHighlighterThemeStyles.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/getHunkSeparatorSlotName.d.ts +0 -1
- package/node_modules/@pierre/diffs/dist/utils/getHunkSeparatorSlotName.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/getHunkSideBoundaries.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/getIconForType.d.ts +0 -1
- package/node_modules/@pierre/diffs/dist/utils/getIconForType.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/getLineAnnotationName.d.ts +0 -1
- package/node_modules/@pierre/diffs/dist/utils/getLineAnnotationName.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/getLineEndingType.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/getLineNodes.d.ts +0 -1
- package/node_modules/@pierre/diffs/dist/utils/getLineNodes.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/getMergeConflictActionSlotName.d.ts +1 -5
- package/node_modules/@pierre/diffs/dist/utils/getMergeConflictActionSlotName.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/getMergeConflictLineTypes.d.ts +0 -1
- package/node_modules/@pierre/diffs/dist/utils/getMergeConflictLineTypes.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/getOrCreateCodeNode.d.ts +1 -7
- package/node_modules/@pierre/diffs/dist/utils/getOrCreateCodeNode.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/getSingularPatch.d.ts +0 -1
- package/node_modules/@pierre/diffs/dist/utils/getSingularPatch.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/getThemes.d.ts +0 -1
- package/node_modules/@pierre/diffs/dist/utils/getThemes.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/getTotalLineCountFromHunks.d.ts +0 -1
- package/node_modules/@pierre/diffs/dist/utils/getTotalLineCountFromHunks.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/guardWebKitScrollDuringRebuild.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/hast_utils.d.ts +2 -12
- package/node_modules/@pierre/diffs/dist/utils/hast_utils.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/hostTheme.d.ts +1 -5
- package/node_modules/@pierre/diffs/dist/utils/hostTheme.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/hydratePartialDiff.d.ts +0 -1
- package/node_modules/@pierre/diffs/dist/utils/hydratePartialDiff.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/hydratePartialDiff.js +2 -1
- package/node_modules/@pierre/diffs/dist/utils/hydratePartialDiff.js.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/includesFileAnnotations.d.ts +0 -1
- package/node_modules/@pierre/diffs/dist/utils/includesFileAnnotations.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/isDefaultRenderRange.d.ts +0 -1
- package/node_modules/@pierre/diffs/dist/utils/isDefaultRenderRange.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/isDiffPlainText.d.ts +0 -1
- package/node_modules/@pierre/diffs/dist/utils/isDiffPlainText.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/isFilePlainText.d.ts +0 -1
- package/node_modules/@pierre/diffs/dist/utils/isFilePlainText.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/isGutterUtilityPath.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/isStyleNode.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/isWorkerContext.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/iterateOverDiff.d.ts +1 -10
- package/node_modules/@pierre/diffs/dist/utils/iterateOverDiff.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/iterateOverDiff.js +5 -3
- package/node_modules/@pierre/diffs/dist/utils/iterateOverDiff.js.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/lineAnnotationIdentity.d.ts +15 -0
- package/node_modules/@pierre/diffs/dist/utils/lineAnnotationIdentity.d.ts.map +1 -0
- package/node_modules/@pierre/diffs/dist/utils/lineAnnotationIdentity.js +17 -0
- package/node_modules/@pierre/diffs/dist/utils/lineAnnotationIdentity.js.map +1 -0
- package/node_modules/@pierre/diffs/dist/utils/normalizeDiffResolution.d.ts +0 -1
- package/node_modules/@pierre/diffs/dist/utils/normalizeDiffResolution.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/parseDiffDecorations.d.ts +2 -13
- package/node_modules/@pierre/diffs/dist/utils/parseDiffDecorations.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/parseDiffFromFile.d.ts +2 -3
- package/node_modules/@pierre/diffs/dist/utils/parseDiffFromFile.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/parseDiffFromFile.js +8 -7
- package/node_modules/@pierre/diffs/dist/utils/parseDiffFromFile.js.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/parseLineType.d.ts +0 -1
- package/node_modules/@pierre/diffs/dist/utils/parseLineType.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/parseMergeConflictDiffFromFile.d.ts +0 -1
- package/node_modules/@pierre/diffs/dist/utils/parseMergeConflictDiffFromFile.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/parsePatchFiles.d.ts +6 -4
- package/node_modules/@pierre/diffs/dist/utils/parsePatchFiles.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/parsePatchFiles.js +42 -14
- package/node_modules/@pierre/diffs/dist/utils/parsePatchFiles.js.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/platform.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/prefersReducedMotion.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/prerenderHTMLIfNecessary.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/processLine.d.ts +0 -1
- package/node_modules/@pierre/diffs/dist/utils/processLine.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/realignChangeContent.d.ts +0 -1
- package/node_modules/@pierre/diffs/dist/utils/realignChangeContent.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/renderDiffWithHighlighter.d.ts +1 -8
- package/node_modules/@pierre/diffs/dist/utils/renderDiffWithHighlighter.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/renderDiffWithHighlighter.js +6 -5
- package/node_modules/@pierre/diffs/dist/utils/renderDiffWithHighlighter.js.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/renderFileWithHighlighter.d.ts +1 -11
- package/node_modules/@pierre/diffs/dist/utils/renderFileWithHighlighter.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/renderFileWithHighlighter.js +7 -4
- package/node_modules/@pierre/diffs/dist/utils/renderFileWithHighlighter.js.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/resolveConflict.d.ts +0 -1
- package/node_modules/@pierre/diffs/dist/utils/resolveConflict.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/resolveRegion.d.ts +0 -1
- package/node_modules/@pierre/diffs/dist/utils/resolveRegion.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/roundToDevicePixel.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/scrollbarGutter.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/scrollbarGutter.js +2 -1
- package/node_modules/@pierre/diffs/dist/utils/scrollbarGutter.js.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/setLanguageOverride.d.ts +0 -1
- package/node_modules/@pierre/diffs/dist/utils/setLanguageOverride.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/setWrapperNodeProps.d.ts +1 -11
- package/node_modules/@pierre/diffs/dist/utils/setWrapperNodeProps.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/setWrapperNodeProps.js +1 -3
- package/node_modules/@pierre/diffs/dist/utils/setWrapperNodeProps.js.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/shouldUseTokenTransformer.d.ts +0 -1
- package/node_modules/@pierre/diffs/dist/utils/shouldUseTokenTransformer.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/splitFileContents.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/trimPatchContext.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/trimPatchContext.js +3 -2
- package/node_modules/@pierre/diffs/dist/utils/trimPatchContext.js.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/updateDiffHunks.d.ts +0 -1
- package/node_modules/@pierre/diffs/dist/utils/updateDiffHunks.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/updateDiffHunks.js +1 -1
- package/node_modules/@pierre/diffs/dist/utils/virtualDiffLayout.d.ts +10 -55
- package/node_modules/@pierre/diffs/dist/utils/virtualDiffLayout.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/utils/virtualDiffLayout.js +1 -1
- package/node_modules/@pierre/diffs/dist/utils/wrapTokenFragments.d.ts +0 -1
- package/node_modules/@pierre/diffs/dist/utils/wrapTokenFragments.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/worker/WorkerPoolManager.d.ts +6 -20
- package/node_modules/@pierre/diffs/dist/worker/WorkerPoolManager.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/worker/WorkerPoolManager.js +52 -11
- package/node_modules/@pierre/diffs/dist/worker/WorkerPoolManager.js.map +1 -1
- package/node_modules/@pierre/diffs/dist/worker/getOrCreateWorkerPoolSingleton.d.ts +1 -5
- package/node_modules/@pierre/diffs/dist/worker/getOrCreateWorkerPoolSingleton.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/worker/types.d.ts +5 -1
- package/node_modules/@pierre/diffs/dist/worker/types.d.ts.map +1 -1
- package/node_modules/@pierre/diffs/dist/worker/worker-portable.d.ts +1 -1
- package/node_modules/@pierre/diffs/dist/worker/worker-portable.js +125 -358
- package/node_modules/@pierre/diffs/dist/worker/worker-portable.js.map +1 -1
- package/node_modules/@pierre/diffs/dist/worker/worker.d.ts +1 -1
- package/node_modules/@pierre/diffs/dist/worker/worker.js +28 -17
- package/node_modules/@pierre/diffs/dist/worker/worker.js.map +1 -1
- package/node_modules/@pierre/diffs/node_modules/@ungap/structured-clone/cjs/deserialize.js +12 -2
- package/node_modules/@pierre/diffs/node_modules/@ungap/structured-clone/cjs/serialize.js +5 -1
- package/node_modules/@pierre/diffs/node_modules/@ungap/structured-clone/esm/deserialize.js +12 -2
- package/node_modules/@pierre/diffs/node_modules/@ungap/structured-clone/esm/serialize.js +5 -1
- package/node_modules/@pierre/diffs/node_modules/@ungap/structured-clone/package.json +1 -1
- package/node_modules/@pierre/diffs/node_modules/@ungap/structured-clone/structured-json.js +1 -1
- package/node_modules/@pierre/diffs/package.json +12 -5
- package/node_modules/playwright-core/browsers.json +9 -32
- package/node_modules/playwright-core/lib/coreBundle.js +5402 -4419
- package/node_modules/playwright-core/lib/server/electron/loader.js +0 -2
- package/node_modules/playwright-core/lib/serverRegistry.js +1674 -7082
- package/node_modules/playwright-core/lib/serverRegistry.js.LICENSE +8 -297
- package/node_modules/playwright-core/lib/tools/cli-client/help.json +19 -6
- package/node_modules/playwright-core/lib/tools/cli-client/minimist.js +1 -1
- package/node_modules/playwright-core/lib/tools/cli-client/output.js +9 -1
- package/node_modules/playwright-core/lib/tools/cli-client/program.js +17 -3
- package/node_modules/playwright-core/lib/tools/cli-client/registry.js +9 -5
- package/node_modules/playwright-core/lib/tools/cli-client/session.js +2 -1
- package/node_modules/playwright-core/lib/tools/skills/playwright-cli/SKILL.md +5 -0
- package/node_modules/playwright-core/lib/tools/skills/playwright-cli/references/tracing.md +1 -1
- package/node_modules/playwright-core/lib/tools/skills/playwright-component-testing/SKILL.md +4 -11
- package/node_modules/playwright-core/lib/tools/skills/playwright-component-testing/references/migration.md +6 -2
- package/node_modules/playwright-core/lib/tools/skills/playwright-component-testing/references/react.md +2 -0
- package/node_modules/playwright-core/lib/tools/skills/playwright-component-testing/references/typing.md +173 -0
- package/node_modules/playwright-core/lib/tools/skills/playwright-component-testing/references/vue.md +2 -0
- package/node_modules/playwright-core/lib/tools/skills/playwright-trace/SKILL.md +6 -3
- package/node_modules/playwright-core/lib/tools/utils/extension.js +13 -2
- package/node_modules/playwright-core/lib/utilsBundle.js +1934 -7341
- package/node_modules/playwright-core/lib/utilsBundle.js.LICENSE +8 -297
- package/node_modules/playwright-core/lib/vite/dashboard/assets/codeMirrorModule--QdMvsKi.css +1 -0
- package/node_modules/playwright-core/lib/vite/{recorder/assets/codeMirrorModule-CwYYHbcZ.js → dashboard/assets/codeMirrorModule-CQ8RZGBm.js} +1 -1
- package/node_modules/playwright-core/lib/vite/dashboard/assets/index-AwgwcYie.css +1 -0
- package/node_modules/playwright-core/lib/vite/dashboard/assets/index-hRvO4yU2.js +12 -0
- package/node_modules/playwright-core/lib/vite/dashboard/index.html +2 -2
- package/node_modules/playwright-core/lib/vite/htmlReport/report.css +1 -1
- package/node_modules/playwright-core/lib/vite/htmlReport/report.js +4 -4
- package/node_modules/playwright-core/lib/vite/recorder/assets/codeMirrorModule-CVQWJZAA.js +32 -0
- package/node_modules/playwright-core/lib/vite/recorder/assets/index-BZpYJZ-P.css +1 -0
- package/node_modules/playwright-core/lib/vite/recorder/assets/index-hrlLqLtq.js +129 -0
- package/node_modules/playwright-core/lib/vite/recorder/index.html +2 -2
- package/node_modules/playwright-core/lib/vite/traceViewer/assets/{codeMirrorModule-rXmQmLUY.js → codeMirrorModule-BbkfBe3n.js} +1 -1
- package/node_modules/playwright-core/lib/vite/traceViewer/assets/defaultSettingsView-Ds6CBOo0.js +182 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/assets/{xtermModule-BuZfJS5v.js → xtermModule-DywYcAf8.js} +1 -1
- package/node_modules/playwright-core/lib/vite/traceViewer/defaultSettingsView.Bqk9acqE.css +1 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/index.B4cLoZK3.js +1 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/index.html +3 -3
- package/node_modules/playwright-core/lib/vite/traceViewer/sw.bundle.js +3 -3
- package/node_modules/playwright-core/lib/vite/traceViewer/uiMode.CU5KtEkS.js +5 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/{uiMode.C7UW1sC9.css → uiMode.CyMfwkXJ.css} +1 -1
- package/node_modules/playwright-core/lib/vite/traceViewer/uiMode.html +4 -4
- package/node_modules/playwright-core/package.json +1 -1
- package/node_modules/playwright-core/types/protocol.d.ts +201 -398
- package/node_modules/playwright-core/types/types.d.ts +771 -327
- package/node_modules/typebox/build/compile/validator.d.mts +1 -1
- package/node_modules/typebox/build/compile/validator.mjs +1 -1
- package/node_modules/typebox/build/format/idna/idn-hostname.mjs +7 -5
- package/node_modules/typebox/build/format/iri.mjs +5 -1
- package/node_modules/typebox/build/guard/emit.mjs +2 -4
- package/node_modules/typebox/build/guard/guard.mjs +6 -18
- package/node_modules/typebox/build/guard/string.mjs +16 -24
- package/node_modules/typebox/build/schema/build.mjs +2 -2
- package/node_modules/typebox/build/schema/check.mjs +1 -1
- package/node_modules/typebox/build/schema/compile.d.mts +3 -2
- package/node_modules/typebox/build/schema/compile.mjs +8 -8
- package/node_modules/typebox/build/schema/engine/_context.d.mts +6 -7
- package/node_modules/typebox/build/schema/engine/_context.mjs +23 -15
- package/node_modules/typebox/build/schema/engine/_functions.d.mts +2 -2
- package/node_modules/typebox/build/schema/engine/_functions.mjs +1 -1
- package/node_modules/typebox/build/schema/engine/_reducer.d.mts +3 -3
- package/node_modules/typebox/build/schema/engine/_refine.d.mts +5 -5
- package/node_modules/typebox/build/schema/engine/_refine.mjs +4 -7
- package/node_modules/typebox/build/schema/engine/_stack.d.mts +34 -16
- package/node_modules/typebox/build/schema/engine/_stack.mjs +148 -104
- package/node_modules/typebox/build/schema/engine/additionalItems.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/additionalProperties.d.mts +8 -8
- package/node_modules/typebox/build/schema/engine/additionalProperties.mjs +26 -18
- package/node_modules/typebox/build/schema/engine/allOf.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/allOf.mjs +3 -3
- package/node_modules/typebox/build/schema/engine/anyOf.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/anyOf.mjs +5 -10
- package/node_modules/typebox/build/schema/engine/boolean.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/boolean.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/const.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/const.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/contains.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/contains.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/dependencies.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/dependencies.mjs +3 -6
- package/node_modules/typebox/build/schema/engine/dependentRequired.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/dependentRequired.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/dependentSchemas.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/dynamicRef.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/dynamicRef.mjs +11 -7
- package/node_modules/typebox/build/schema/engine/enum.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/enum.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/exclusiveMaximum.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/exclusiveMaximum.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/exclusiveMinimum.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/exclusiveMinimum.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/format.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/format.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/if.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/if.mjs +7 -15
- package/node_modules/typebox/build/schema/engine/items.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/items.mjs +1 -1
- package/node_modules/typebox/build/schema/engine/maxContains.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/maxContains.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/maxItems.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/maxItems.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/maxLength.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/maxLength.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/maxProperties.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/maxProperties.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/maximum.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/maximum.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/minContains.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/minContains.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/minItems.d.mts +5 -5
- package/node_modules/typebox/build/schema/engine/minItems.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/minLength.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/minLength.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/minProperties.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/minProperties.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/minimum.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/minimum.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/multipleOf.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/multipleOf.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/not.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/not.mjs +4 -8
- package/node_modules/typebox/build/schema/engine/oneOf.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/oneOf.mjs +6 -11
- package/node_modules/typebox/build/schema/engine/pattern.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/pattern.mjs +3 -7
- package/node_modules/typebox/build/schema/engine/patternProperties.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/patternProperties.mjs +1 -1
- package/node_modules/typebox/build/schema/engine/prefixItems.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/prefixItems.mjs +1 -1
- package/node_modules/typebox/build/schema/engine/properties.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/properties.mjs +1 -1
- package/node_modules/typebox/build/schema/engine/propertyNames.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/propertyNames.mjs +4 -10
- package/node_modules/typebox/build/schema/engine/recursiveRef.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/recursiveRef.mjs +11 -7
- package/node_modules/typebox/build/schema/engine/ref.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/ref.mjs +19 -15
- package/node_modules/typebox/build/schema/engine/required.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/required.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/schema.d.mts +7 -7
- package/node_modules/typebox/build/schema/engine/schema.mjs +137 -133
- package/node_modules/typebox/build/schema/engine/type.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/type.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/unevaluatedItems.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/unevaluatedItems.mjs +5 -9
- package/node_modules/typebox/build/schema/engine/unevaluatedProperties.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/unevaluatedProperties.mjs +5 -9
- package/node_modules/typebox/build/schema/engine/uniqueItems.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/uniqueItems.mjs +2 -6
- package/node_modules/typebox/build/schema/errors.d.mts +2 -2
- package/node_modules/typebox/build/schema/errors.mjs +8 -14
- package/node_modules/typebox/build/schema/intern/index.d.mts +1 -0
- package/node_modules/typebox/build/schema/intern/index.mjs +1 -0
- package/node_modules/typebox/build/schema/intern/intern.d.mts +11 -0
- package/node_modules/typebox/build/schema/intern/intern.mjs +293 -0
- package/node_modules/typebox/build/schema/meta/draft_2019_09.d.mts +2 -0
- package/node_modules/typebox/build/schema/meta/draft_2019_09.mjs +288 -0
- package/node_modules/typebox/build/schema/meta/draft_2020_12.d.mts +2 -0
- package/node_modules/typebox/build/schema/meta/draft_2020_12.mjs +300 -0
- package/node_modules/typebox/build/schema/meta/draft_3.d.mts +2 -0
- package/node_modules/typebox/build/schema/meta/draft_3.mjs +143 -0
- package/node_modules/typebox/build/schema/meta/draft_4.d.mts +2 -0
- package/node_modules/typebox/build/schema/meta/draft_4.mjs +149 -0
- package/node_modules/typebox/build/schema/meta/draft_6.d.mts +2 -0
- package/node_modules/typebox/build/schema/meta/draft_6.mjs +155 -0
- package/node_modules/typebox/build/schema/meta/draft_7.d.mts +2 -0
- package/node_modules/typebox/build/schema/meta/draft_7.mjs +172 -0
- package/node_modules/typebox/build/schema/meta/index.d.mts +2 -0
- package/node_modules/typebox/build/schema/meta/index.mjs +2 -0
- package/node_modules/typebox/build/schema/meta/meta.d.mts +9 -0
- package/node_modules/typebox/build/schema/meta/meta.mjs +15 -0
- package/node_modules/typebox/build/schema/meta/schema.d.mts +6 -0
- package/node_modules/typebox/build/schema/meta/schema.mjs +1 -0
- package/node_modules/typebox/build/schema/parse.d.mts +1 -0
- package/node_modules/typebox/build/schema/parse.mjs +10 -5
- package/node_modules/typebox/build/schema/resolve/resolve.d.mts +8 -3
- package/node_modules/typebox/build/schema/resolve/resolve.mjs +268 -139
- package/node_modules/typebox/build/schema/schema.d.mts +2 -0
- package/node_modules/typebox/build/schema/schema.mjs +2 -0
- package/node_modules/typebox/build/value/errors/errors.d.mts +2 -12
- package/node_modules/typebox/build/value/errors/errors.mjs +2 -7
- package/node_modules/typebox/package.json +1 -1
- package/node_modules/typebox/readme.md +59 -89
- package/node_modules/zod/README.md +29 -2
- package/node_modules/zod/compile.cjs +96 -0
- package/node_modules/zod/compile.d.cts +1 -0
- package/node_modules/zod/compile.d.ts +1 -0
- package/node_modules/zod/compile.js +52 -0
- package/node_modules/zod/index.cjs +21 -2
- package/node_modules/zod/index.d.cts +1 -2
- package/node_modules/zod/index.d.ts +1 -2
- package/node_modules/zod/index.js +5 -2
- package/node_modules/zod/locales/index.cjs +19 -0
- package/node_modules/zod/mini/index.cjs +19 -0
- package/node_modules/zod/package.json +20 -8
- package/node_modules/zod/src/compile.ts +56 -0
- package/node_modules/zod/src/index.ts +5 -2
- package/node_modules/zod/src/v3/ZodError.ts +22 -12
- package/node_modules/zod/src/v3/helpers/errorUtil.ts +1 -1
- package/node_modules/zod/src/v3/tests/error.test.ts +35 -0
- package/node_modules/zod/src/v3/tests/intersection.test.ts +18 -0
- package/node_modules/zod/src/v3/tests/language-server.test.ts +1 -2
- package/node_modules/zod/src/v3/tests/object.test.ts +3 -6
- package/node_modules/zod/src/v3/tests/readonly.test.ts +0 -80
- package/node_modules/zod/src/v3/tests/string.test.ts +6 -0
- package/node_modules/zod/src/v3/types.ts +5 -5
- package/node_modules/zod/src/v4/classic/checks.ts +1 -0
- package/node_modules/zod/src/v4/classic/compat.ts +26 -18
- package/node_modules/zod/src/v4/classic/deep-partial.ts +76 -0
- package/node_modules/zod/src/v4/classic/errors.ts +59 -44
- package/node_modules/zod/src/v4/classic/external.ts +14 -9
- package/node_modules/zod/src/v4/classic/from-json-schema.ts +363 -78
- package/node_modules/zod/src/v4/classic/in-out.ts +45 -0
- package/node_modules/zod/src/v4/classic/index.ts +2 -2
- package/node_modules/zod/src/v4/classic/iso.ts +2 -72
- package/node_modules/zod/src/v4/classic/parse.ts +10 -4
- package/node_modules/zod/src/v4/classic/schemas.ts +640 -375
- package/node_modules/zod/src/v4/classic/tests/apply.test.ts +27 -0
- package/node_modules/zod/src/v4/classic/tests/array.test.ts +2 -2
- package/node_modules/zod/src/v4/classic/tests/assignability.test.ts +186 -0
- package/node_modules/zod/src/v4/classic/tests/bigint.test.ts +36 -1
- package/node_modules/zod/src/v4/classic/tests/catch.test.ts +278 -0
- package/node_modules/zod/src/v4/classic/tests/codec-examples.test.ts +1 -2
- package/node_modules/zod/src/v4/classic/tests/codec.test.ts +2 -1
- package/node_modules/zod/src/v4/classic/tests/continuability.test.ts +3 -3
- package/node_modules/zod/src/v4/classic/tests/credit-card.test.ts +76 -0
- package/node_modules/zod/src/v4/classic/tests/cyclic-data.test.ts +985 -0
- package/node_modules/zod/src/v4/classic/tests/date.test.ts +30 -0
- package/node_modules/zod/src/v4/classic/tests/datetime.test.ts +32 -18
- package/node_modules/zod/src/v4/classic/tests/deep-partial.test.ts +380 -0
- package/node_modules/zod/src/v4/classic/tests/default-locale.test.ts +32 -0
- package/node_modules/zod/src/v4/classic/tests/default.test.ts +46 -0
- package/node_modules/zod/src/v4/classic/tests/detached-methods.test.ts +31 -7
- package/node_modules/zod/src/v4/classic/tests/discriminated-unions.test.ts +261 -13
- package/node_modules/zod/src/v4/classic/tests/enum.test.ts +20 -0
- package/node_modules/zod/src/v4/classic/tests/error-utils.test.ts +112 -2
- package/node_modules/zod/src/v4/classic/tests/error.test.ts +403 -6
- package/node_modules/zod/src/v4/classic/tests/from-json-schema.test.ts +582 -10
- package/node_modules/zod/src/v4/classic/tests/function.test.ts +31 -0
- package/node_modules/zod/src/v4/classic/tests/global-config.test.ts +2 -9
- package/node_modules/zod/src/v4/classic/tests/hash.test.ts +1 -2
- package/node_modules/zod/src/v4/classic/tests/iban.test.ts +81 -0
- package/node_modules/zod/src/v4/classic/tests/in-out.test.ts +159 -0
- package/node_modules/zod/src/v4/classic/tests/index.test.ts +21 -2
- package/node_modules/zod/src/v4/classic/tests/instance-footprint.test.ts +319 -0
- package/node_modules/zod/src/v4/classic/tests/instanceof.test.ts +67 -0
- package/node_modules/zod/src/v4/classic/tests/intersection.test.ts +136 -0
- package/node_modules/zod/src/v4/classic/tests/issue-schema.test.ts +215 -0
- package/node_modules/zod/src/v4/classic/tests/jitless-allows-eval.test.ts +3 -10
- package/node_modules/zod/src/v4/classic/tests/lazy.test.ts +36 -1
- package/node_modules/zod/src/v4/classic/tests/literal.test.ts +12 -1
- package/node_modules/zod/src/v4/classic/tests/map.test.ts +12 -0
- package/node_modules/zod/src/v4/classic/tests/number.test.ts +85 -9
- package/node_modules/zod/src/v4/classic/tests/object.test.ts +301 -12
- package/node_modules/zod/src/v4/classic/tests/optin-ladder.test.ts +235 -0
- package/node_modules/zod/src/v4/classic/tests/optional.test.ts +49 -16
- package/node_modules/zod/src/v4/classic/tests/partial.test.ts +51 -4
- package/node_modules/zod/src/v4/classic/tests/prefault.test.ts +70 -0
- package/node_modules/zod/src/v4/classic/tests/preprocess-types.test.ts +20 -2
- package/node_modules/zod/src/v4/classic/tests/properties.test.ts +141 -0
- package/node_modules/zod/src/v4/classic/tests/readonly.test.ts +0 -68
- package/node_modules/zod/src/v4/classic/tests/record.test.ts +186 -18
- package/node_modules/zod/src/v4/classic/tests/recursive-types.test.ts +79 -3
- package/node_modules/zod/src/v4/classic/tests/redos.test.ts +68 -0
- package/node_modules/zod/src/v4/classic/tests/refine.test.ts +60 -0
- package/node_modules/zod/src/v4/classic/tests/set.test.ts +9 -0
- package/node_modules/zod/src/v4/classic/tests/standard-schema.test.ts +19 -0
- package/node_modules/zod/src/v4/classic/tests/string.test.ts +222 -6
- package/node_modules/zod/src/v4/classic/tests/stringbool.test.ts +18 -0
- package/node_modules/zod/src/v4/classic/tests/template-literal.test.ts +44 -3
- package/node_modules/zod/src/v4/classic/tests/to-json-schema.test.ts +1812 -204
- package/node_modules/zod/src/v4/classic/tests/tuple.test.ts +45 -30
- package/node_modules/zod/src/v4/classic/tests/union.test.ts +39 -2
- package/node_modules/zod/src/v4/classic/tests/validate.test.ts +645 -0
- package/node_modules/zod/src/v4/classic/tests/validations.test.ts +2 -2
- package/node_modules/zod/src/v4/core/api.ts +87 -35
- package/node_modules/zod/src/v4/core/checks.ts +119 -146
- package/node_modules/zod/src/v4/core/compile.ts +2313 -0
- package/node_modules/zod/src/v4/core/core.ts +99 -22
- package/node_modules/zod/src/v4/core/doc.ts +17 -9
- package/node_modules/zod/src/v4/core/errors.ts +113 -25
- package/node_modules/zod/src/v4/core/index.ts +3 -0
- package/node_modules/zod/src/v4/core/json-schema-generator.ts +8 -3
- package/node_modules/zod/src/v4/core/json-schema-processors.ts +424 -156
- package/node_modules/zod/src/v4/core/json-schema.ts +2 -1
- package/node_modules/zod/src/v4/core/memoizer.ts +331 -0
- package/node_modules/zod/src/v4/core/parse.ts +164 -50
- package/node_modules/zod/src/v4/core/regexes.ts +42 -15
- package/node_modules/zod/src/v4/core/registries.ts +2 -2
- package/node_modules/zod/src/v4/core/schemas.ts +1000 -538
- package/node_modules/zod/src/v4/core/tests/cached.test.ts +54 -0
- package/node_modules/zod/src/v4/core/tests/compile-differential.test.ts +1004 -0
- package/node_modules/zod/src/v4/core/tests/compile-generative.test.ts +445 -0
- package/node_modules/zod/src/v4/core/tests/compile-global.test.ts +89 -0
- package/node_modules/zod/src/v4/core/tests/compile-off-by-default.test.ts +26 -0
- package/node_modules/zod/src/v4/core/tests/compile-stats.test.ts +34 -0
- package/node_modules/zod/src/v4/core/tests/compile.test.ts +2036 -0
- package/node_modules/zod/src/v4/core/tests/email-regex.test.ts +140 -0
- package/node_modules/zod/src/v4/core/tests/locales/el.test.ts +1 -2
- package/node_modules/zod/src/v4/core/tests/locales/es.test.ts +1 -2
- package/node_modules/zod/src/v4/core/tests/locales/fr.test.ts +3 -3
- package/node_modules/zod/src/v4/core/tests/locales/parity.test.ts +42 -0
- package/node_modules/zod/src/v4/core/tests/locales/tg.test.ts +85 -0
- package/node_modules/zod/src/v4/core/tests/locales/tk.test.ts +69 -0
- package/node_modules/zod/src/v4/core/tests/polyfill-collision.test.ts +46 -0
- package/node_modules/zod/src/v4/core/tests/treeshake.test.ts +51 -0
- package/node_modules/zod/src/v4/core/tests/url-no-canparse.test.ts +133 -0
- package/node_modules/zod/src/v4/core/to-json-schema.ts +283 -48
- package/node_modules/zod/src/v4/core/util.ts +454 -157
- package/node_modules/zod/src/v4/core/versions.ts +2 -2
- package/node_modules/zod/src/v4/core/visit.ts +193 -0
- package/node_modules/zod/src/v4/index.ts +3 -3
- package/node_modules/zod/src/v4/locales/ar.ts +5 -0
- package/node_modules/zod/src/v4/locales/az.ts +5 -0
- package/node_modules/zod/src/v4/locales/be.ts +12 -0
- package/node_modules/zod/src/v4/locales/bg.ts +5 -0
- package/node_modules/zod/src/v4/locales/bn.ts +123 -0
- package/node_modules/zod/src/v4/locales/ca.ts +5 -0
- package/node_modules/zod/src/v4/locales/ckb.ts +140 -0
- package/node_modules/zod/src/v4/locales/cs.ts +5 -0
- package/node_modules/zod/src/v4/locales/da.ts +7 -2
- package/node_modules/zod/src/v4/locales/de.ts +5 -0
- package/node_modules/zod/src/v4/locales/el.ts +3 -0
- package/node_modules/zod/src/v4/locales/en.ts +17 -4
- package/node_modules/zod/src/v4/locales/eo.ts +5 -0
- package/node_modules/zod/src/v4/locales/es.ts +4 -0
- package/node_modules/zod/src/v4/locales/fa.ts +5 -0
- package/node_modules/zod/src/v4/locales/fi.ts +5 -0
- package/node_modules/zod/src/v4/locales/fr-CA.ts +5 -0
- package/node_modules/zod/src/v4/locales/fr.ts +21 -14
- package/node_modules/zod/src/v4/locales/gu.ts +123 -0
- package/node_modules/zod/src/v4/locales/he.ts +8 -1
- package/node_modules/zod/src/v4/locales/hi.ts +126 -0
- package/node_modules/zod/src/v4/locales/hr.ts +4 -0
- package/node_modules/zod/src/v4/locales/hu.ts +5 -0
- package/node_modules/zod/src/v4/locales/hy.ts +11 -0
- package/node_modules/zod/src/v4/locales/id.ts +5 -0
- package/node_modules/zod/src/v4/locales/index.ts +11 -0
- package/node_modules/zod/src/v4/locales/is.ts +5 -0
- package/node_modules/zod/src/v4/locales/it.ts +5 -0
- package/node_modules/zod/src/v4/locales/ja.ts +5 -0
- package/node_modules/zod/src/v4/locales/ka.ts +5 -0
- package/node_modules/zod/src/v4/locales/km.ts +5 -0
- package/node_modules/zod/src/v4/locales/kn.ts +126 -0
- package/node_modules/zod/src/v4/locales/ko.ts +5 -0
- package/node_modules/zod/src/v4/locales/lt.ts +4 -0
- package/node_modules/zod/src/v4/locales/mk.ts +5 -0
- package/node_modules/zod/src/v4/locales/ms.ts +5 -0
- package/node_modules/zod/src/v4/locales/ne.ts +128 -0
- package/node_modules/zod/src/v4/locales/nl.ts +5 -0
- package/node_modules/zod/src/v4/locales/nn.ts +121 -0
- package/node_modules/zod/src/v4/locales/no.ts +7 -2
- package/node_modules/zod/src/v4/locales/ota.ts +5 -0
- package/node_modules/zod/src/v4/locales/pl.ts +5 -0
- package/node_modules/zod/src/v4/locales/ps.ts +5 -0
- package/node_modules/zod/src/v4/locales/pt-BR.ts +161 -0
- package/node_modules/zod/src/v4/locales/pt.ts +101 -58
- package/node_modules/zod/src/v4/locales/ro.ts +3 -0
- package/node_modules/zod/src/v4/locales/ru.ts +12 -0
- package/node_modules/zod/src/v4/locales/sk.ts +123 -0
- package/node_modules/zod/src/v4/locales/sl.ts +5 -0
- package/node_modules/zod/src/v4/locales/sv.ts +7 -2
- package/node_modules/zod/src/v4/locales/ta.ts +5 -0
- package/node_modules/zod/src/v4/locales/tg.ts +135 -0
- package/node_modules/zod/src/v4/locales/th.ts +5 -0
- package/node_modules/zod/src/v4/locales/tk.ts +113 -0
- package/node_modules/zod/src/v4/locales/tr.ts +5 -0
- package/node_modules/zod/src/v4/locales/uk.ts +5 -0
- package/node_modules/zod/src/v4/locales/ur.ts +5 -0
- package/node_modules/zod/src/v4/locales/uz.ts +3 -0
- package/node_modules/zod/src/v4/locales/vi.ts +5 -0
- package/node_modules/zod/src/v4/locales/yo.ts +5 -0
- package/node_modules/zod/src/v4/locales/zh-CN.ts +5 -0
- package/node_modules/zod/src/v4/locales/zh-TW.ts +5 -0
- package/node_modules/zod/src/v4/mini/checks.ts +1 -0
- package/node_modules/zod/src/v4/mini/deep-partial.ts +73 -0
- package/node_modules/zod/src/v4/mini/external.ts +12 -1
- package/node_modules/zod/src/v4/mini/in-out.ts +45 -0
- package/node_modules/zod/src/v4/mini/parse.ts +2 -0
- package/node_modules/zod/src/v4/mini/schemas.ts +167 -63
- package/node_modules/zod/src/v4/mini/tests/apply.test.ts +33 -0
- package/node_modules/zod/src/v4/mini/tests/assignability.test.ts +62 -1
- package/node_modules/zod/src/v4/mini/tests/checks.test.ts +14 -0
- package/node_modules/zod/src/v4/mini/tests/codec.test.ts +35 -1
- package/node_modules/zod/src/v4/mini/tests/computed.test.ts +11 -17
- package/node_modules/zod/src/v4/mini/tests/cyclic-data.test.ts +84 -0
- package/node_modules/zod/src/v4/mini/tests/deep-partial.test.ts +54 -0
- package/node_modules/zod/src/v4/mini/tests/error.test.ts +23 -4
- package/node_modules/zod/src/v4/mini/tests/functions.test.ts +9 -0
- package/node_modules/zod/src/v4/mini/tests/index.test.ts +158 -5
- package/node_modules/zod/src/v4/mini/tests/number.test.ts +14 -0
- package/node_modules/zod/src/v4/mini/tests/object.test.ts +65 -0
- package/node_modules/zod/src/v4/mini/tests/recursive-types.test.ts +16 -0
- package/node_modules/zod/src/v4/mini/tests/string.test.ts +44 -0
- package/node_modules/zod/v3/ZodError.cjs +41 -12
- package/node_modules/zod/v3/ZodError.d.cts +1 -1
- package/node_modules/zod/v3/ZodError.d.ts +1 -1
- package/node_modules/zod/v3/ZodError.js +22 -12
- package/node_modules/zod/v3/errors.cjs +19 -0
- package/node_modules/zod/v3/external.cjs +19 -0
- package/node_modules/zod/v3/helpers/enumUtil.cjs +19 -0
- package/node_modules/zod/v3/helpers/errorUtil.cjs +20 -1
- package/node_modules/zod/v3/helpers/errorUtil.js +1 -1
- package/node_modules/zod/v3/helpers/parseUtil.cjs +19 -0
- package/node_modules/zod/v3/helpers/partialUtil.cjs +19 -0
- package/node_modules/zod/v3/helpers/typeAliases.cjs +19 -0
- package/node_modules/zod/v3/helpers/util.cjs +19 -0
- package/node_modules/zod/v3/index.cjs +19 -0
- package/node_modules/zod/v3/standard-schema.cjs +19 -0
- package/node_modules/zod/v3/types.cjs +26 -5
- package/node_modules/zod/v3/types.js +7 -5
- package/node_modules/zod/v4/classic/checks.cjs +21 -1
- package/node_modules/zod/v4/classic/checks.d.cts +1 -1
- package/node_modules/zod/v4/classic/checks.d.ts +1 -1
- package/node_modules/zod/v4/classic/checks.js +1 -1
- package/node_modules/zod/v4/classic/coerce.cjs +19 -0
- package/node_modules/zod/v4/classic/compat.cjs +19 -0
- package/node_modules/zod/v4/classic/compat.d.cts +9 -11
- package/node_modules/zod/v4/classic/compat.d.ts +9 -11
- package/node_modules/zod/v4/classic/deep-partial.cjs +58 -0
- package/node_modules/zod/v4/classic/deep-partial.d.cts +14 -0
- package/node_modules/zod/v4/classic/deep-partial.d.ts +14 -0
- package/node_modules/zod/v4/classic/deep-partial.js +13 -0
- package/node_modules/zod/v4/classic/errors.cjs +62 -34
- package/node_modules/zod/v4/classic/errors.d.cts +3 -4
- package/node_modules/zod/v4/classic/errors.d.ts +3 -4
- package/node_modules/zod/v4/classic/errors.js +43 -34
- package/node_modules/zod/v4/classic/external.cjs +51 -27
- package/node_modules/zod/v4/classic/external.d.cts +5 -2
- package/node_modules/zod/v4/classic/external.d.ts +5 -2
- package/node_modules/zod/v4/classic/external.js +5 -8
- package/node_modules/zod/v4/classic/from-json-schema.cjs +376 -75
- package/node_modules/zod/v4/classic/from-json-schema.js +357 -75
- package/node_modules/zod/v4/classic/in-out.cjs +82 -0
- package/node_modules/zod/v4/classic/in-out.d.cts +8 -0
- package/node_modules/zod/v4/classic/in-out.d.ts +8 -0
- package/node_modules/zod/v4/classic/in-out.js +36 -0
- package/node_modules/zod/v4/classic/index.cjs +21 -2
- package/node_modules/zod/v4/classic/index.d.cts +1 -2
- package/node_modules/zod/v4/classic/index.d.ts +1 -2
- package/node_modules/zod/v4/classic/index.js +2 -2
- package/node_modules/zod/v4/classic/iso.cjs +30 -22
- package/node_modules/zod/v4/classic/iso.d.cts +2 -17
- package/node_modules/zod/v4/classic/iso.d.ts +2 -17
- package/node_modules/zod/v4/classic/iso.js +2 -17
- package/node_modules/zod/v4/classic/parse.cjs +23 -1
- package/node_modules/zod/v4/classic/parse.d.cts +17 -4
- package/node_modules/zod/v4/classic/parse.d.ts +17 -4
- package/node_modules/zod/v4/classic/parse.js +1 -0
- package/node_modules/zod/v4/classic/schemas.cjs +591 -426
- package/node_modules/zod/v4/classic/schemas.d.cts +68 -19
- package/node_modules/zod/v4/classic/schemas.d.ts +68 -19
- package/node_modules/zod/v4/classic/schemas.js +564 -424
- package/node_modules/zod/v4/core/api.cjs +66 -24
- package/node_modules/zod/v4/core/api.d.cts +22 -12
- package/node_modules/zod/v4/core/api.d.ts +22 -12
- package/node_modules/zod/v4/core/api.js +44 -24
- package/node_modules/zod/v4/core/checks.cjs +88 -128
- package/node_modules/zod/v4/core/checks.d.cts +29 -13
- package/node_modules/zod/v4/core/checks.d.ts +29 -13
- package/node_modules/zod/v4/core/checks.js +68 -127
- package/node_modules/zod/v4/core/compile.cjs +1908 -0
- package/node_modules/zod/v4/core/compile.d.cts +65 -0
- package/node_modules/zod/v4/core/compile.d.ts +65 -0
- package/node_modules/zod/v4/core/compile.js +1858 -0
- package/node_modules/zod/v4/core/core.cjs +101 -19
- package/node_modules/zod/v4/core/core.d.cts +16 -4
- package/node_modules/zod/v4/core/core.d.ts +16 -4
- package/node_modules/zod/v4/core/core.js +83 -20
- package/node_modules/zod/v4/core/doc.cjs +31 -9
- package/node_modules/zod/v4/core/doc.d.cts +3 -1
- package/node_modules/zod/v4/core/doc.d.ts +3 -1
- package/node_modules/zod/v4/core/doc.js +12 -9
- package/node_modules/zod/v4/core/errors.cjs +126 -25
- package/node_modules/zod/v4/core/errors.d.cts +4 -0
- package/node_modules/zod/v4/core/errors.d.ts +4 -0
- package/node_modules/zod/v4/core/errors.js +107 -25
- package/node_modules/zod/v4/core/index.cjs +24 -1
- package/node_modules/zod/v4/core/index.d.cts +3 -0
- package/node_modules/zod/v4/core/index.d.ts +3 -0
- package/node_modules/zod/v4/core/index.js +3 -0
- package/node_modules/zod/v4/core/json-schema-generator.cjs +24 -1
- package/node_modules/zod/v4/core/json-schema-generator.d.cts +2 -2
- package/node_modules/zod/v4/core/json-schema-generator.d.ts +2 -2
- package/node_modules/zod/v4/core/json-schema-generator.js +6 -2
- package/node_modules/zod/v4/core/json-schema-processors.cjs +441 -156
- package/node_modules/zod/v4/core/json-schema-processors.d.cts +16 -0
- package/node_modules/zod/v4/core/json-schema-processors.d.ts +16 -0
- package/node_modules/zod/v4/core/json-schema-processors.js +400 -158
- package/node_modules/zod/v4/core/json-schema.cjs +19 -0
- package/node_modules/zod/v4/core/json-schema.d.cts +2 -1
- package/node_modules/zod/v4/core/json-schema.d.ts +2 -1
- package/node_modules/zod/v4/core/memoizer.cjs +360 -0
- package/node_modules/zod/v4/core/memoizer.d.cts +15 -0
- package/node_modules/zod/v4/core/memoizer.d.ts +15 -0
- package/node_modules/zod/v4/core/memoizer.js +311 -0
- package/node_modules/zod/v4/core/parse.cjs +148 -46
- package/node_modules/zod/v4/core/parse.d.cts +14 -11
- package/node_modules/zod/v4/core/parse.d.ts +14 -11
- package/node_modules/zod/v4/core/parse.js +127 -45
- package/node_modules/zod/v4/core/regexes.cjs +54 -17
- package/node_modules/zod/v4/core/regexes.d.cts +5 -0
- package/node_modules/zod/v4/core/regexes.d.ts +5 -0
- package/node_modules/zod/v4/core/regexes.js +32 -15
- package/node_modules/zod/v4/core/registries.cjs +19 -0
- package/node_modules/zod/v4/core/registries.js +2 -2
- package/node_modules/zod/v4/core/schemas.cjs +785 -386
- package/node_modules/zod/v4/core/schemas.d.cts +123 -34
- package/node_modules/zod/v4/core/schemas.d.ts +123 -34
- package/node_modules/zod/v4/core/schemas.js +753 -386
- package/node_modules/zod/v4/core/standard-schema.cjs +19 -0
- package/node_modules/zod/v4/core/to-json-schema.cjs +269 -45
- package/node_modules/zod/v4/core/to-json-schema.d.cts +45 -5
- package/node_modules/zod/v4/core/to-json-schema.d.ts +45 -5
- package/node_modules/zod/v4/core/to-json-schema.js +247 -44
- package/node_modules/zod/v4/core/util.cjs +372 -157
- package/node_modules/zod/v4/core/util.d.cts +79 -1
- package/node_modules/zod/v4/core/util.d.ts +79 -1
- package/node_modules/zod/v4/core/util.js +341 -156
- package/node_modules/zod/v4/core/versions.cjs +21 -2
- package/node_modules/zod/v4/core/versions.d.cts +1 -1
- package/node_modules/zod/v4/core/versions.d.ts +1 -1
- package/node_modules/zod/v4/core/versions.js +2 -2
- package/node_modules/zod/v4/core/visit.cjs +214 -0
- package/node_modules/zod/v4/core/visit.d.cts +30 -0
- package/node_modules/zod/v4/core/visit.d.ts +30 -0
- package/node_modules/zod/v4/core/visit.js +169 -0
- package/node_modules/zod/v4/index.cjs +34 -5
- package/node_modules/zod/v4/index.d.cts +2 -2
- package/node_modules/zod/v4/index.d.ts +2 -2
- package/node_modules/zod/v4/index.js +3 -2
- package/node_modules/zod/v4/locales/ar.cjs +5 -0
- package/node_modules/zod/v4/locales/ar.js +5 -0
- package/node_modules/zod/v4/locales/az.cjs +5 -0
- package/node_modules/zod/v4/locales/az.js +5 -0
- package/node_modules/zod/v4/locales/be.cjs +12 -0
- package/node_modules/zod/v4/locales/be.js +12 -0
- package/node_modules/zod/v4/locales/bg.cjs +5 -0
- package/node_modules/zod/v4/locales/bg.js +5 -0
- package/node_modules/zod/v4/locales/bn.cjs +140 -0
- package/node_modules/zod/v4/locales/bn.d.cts +5 -0
- package/node_modules/zod/v4/locales/bn.d.ts +4 -0
- package/node_modules/zod/v4/locales/bn.js +113 -0
- package/node_modules/zod/v4/locales/ca.cjs +5 -0
- package/node_modules/zod/v4/locales/ca.js +5 -0
- package/node_modules/zod/v4/locales/ckb.cjs +160 -0
- package/node_modules/zod/v4/locales/ckb.d.cts +5 -0
- package/node_modules/zod/v4/locales/ckb.d.ts +4 -0
- package/node_modules/zod/v4/locales/ckb.js +133 -0
- package/node_modules/zod/v4/locales/cs.cjs +5 -0
- package/node_modules/zod/v4/locales/cs.js +5 -0
- package/node_modules/zod/v4/locales/da.cjs +7 -2
- package/node_modules/zod/v4/locales/da.js +7 -2
- package/node_modules/zod/v4/locales/de.cjs +5 -0
- package/node_modules/zod/v4/locales/de.js +5 -0
- package/node_modules/zod/v4/locales/el.cjs +3 -0
- package/node_modules/zod/v4/locales/el.js +3 -0
- package/node_modules/zod/v4/locales/en.cjs +16 -4
- package/node_modules/zod/v4/locales/en.js +16 -4
- package/node_modules/zod/v4/locales/eo.cjs +5 -0
- package/node_modules/zod/v4/locales/eo.js +5 -0
- package/node_modules/zod/v4/locales/es.cjs +4 -0
- package/node_modules/zod/v4/locales/es.js +4 -0
- package/node_modules/zod/v4/locales/fa.cjs +5 -0
- package/node_modules/zod/v4/locales/fa.js +5 -0
- package/node_modules/zod/v4/locales/fi.cjs +5 -0
- package/node_modules/zod/v4/locales/fi.js +5 -0
- package/node_modules/zod/v4/locales/fr-CA.cjs +5 -0
- package/node_modules/zod/v4/locales/fr-CA.js +5 -0
- package/node_modules/zod/v4/locales/fr.cjs +18 -14
- package/node_modules/zod/v4/locales/fr.js +18 -14
- package/node_modules/zod/v4/locales/gu.cjs +140 -0
- package/node_modules/zod/v4/locales/gu.d.cts +5 -0
- package/node_modules/zod/v4/locales/gu.d.ts +4 -0
- package/node_modules/zod/v4/locales/gu.js +113 -0
- package/node_modules/zod/v4/locales/he.cjs +7 -0
- package/node_modules/zod/v4/locales/he.js +7 -0
- package/node_modules/zod/v4/locales/hi.cjs +138 -0
- package/node_modules/zod/v4/locales/hi.d.cts +5 -0
- package/node_modules/zod/v4/locales/hi.d.ts +4 -0
- package/node_modules/zod/v4/locales/hi.js +111 -0
- package/node_modules/zod/v4/locales/hr.cjs +4 -0
- package/node_modules/zod/v4/locales/hr.js +4 -0
- package/node_modules/zod/v4/locales/hu.cjs +5 -0
- package/node_modules/zod/v4/locales/hu.js +5 -0
- package/node_modules/zod/v4/locales/hy.cjs +11 -0
- package/node_modules/zod/v4/locales/hy.js +11 -0
- package/node_modules/zod/v4/locales/id.cjs +5 -0
- package/node_modules/zod/v4/locales/id.js +5 -0
- package/node_modules/zod/v4/locales/index.cjs +43 -2
- package/node_modules/zod/v4/locales/index.d.cts +11 -0
- package/node_modules/zod/v4/locales/index.d.ts +11 -0
- package/node_modules/zod/v4/locales/index.js +11 -0
- package/node_modules/zod/v4/locales/is.cjs +5 -0
- package/node_modules/zod/v4/locales/is.js +5 -0
- package/node_modules/zod/v4/locales/it.cjs +5 -0
- package/node_modules/zod/v4/locales/it.js +5 -0
- package/node_modules/zod/v4/locales/ja.cjs +5 -0
- package/node_modules/zod/v4/locales/ja.js +5 -0
- package/node_modules/zod/v4/locales/ka.cjs +5 -0
- package/node_modules/zod/v4/locales/ka.js +5 -0
- package/node_modules/zod/v4/locales/km.cjs +5 -0
- package/node_modules/zod/v4/locales/km.js +5 -0
- package/node_modules/zod/v4/locales/kn.cjs +143 -0
- package/node_modules/zod/v4/locales/kn.d.cts +5 -0
- package/node_modules/zod/v4/locales/kn.d.ts +4 -0
- package/node_modules/zod/v4/locales/kn.js +116 -0
- package/node_modules/zod/v4/locales/ko.cjs +5 -0
- package/node_modules/zod/v4/locales/ko.js +5 -0
- package/node_modules/zod/v4/locales/lt.cjs +4 -0
- package/node_modules/zod/v4/locales/lt.js +4 -0
- package/node_modules/zod/v4/locales/mk.cjs +5 -0
- package/node_modules/zod/v4/locales/mk.js +5 -0
- package/node_modules/zod/v4/locales/ms.cjs +5 -0
- package/node_modules/zod/v4/locales/ms.js +5 -0
- package/node_modules/zod/v4/locales/ne.cjs +138 -0
- package/node_modules/zod/v4/locales/ne.d.cts +5 -0
- package/node_modules/zod/v4/locales/ne.d.ts +4 -0
- package/node_modules/zod/v4/locales/ne.js +111 -0
- package/node_modules/zod/v4/locales/nl.cjs +5 -0
- package/node_modules/zod/v4/locales/nl.js +5 -0
- package/node_modules/zod/v4/locales/nn.cjs +140 -0
- package/node_modules/zod/v4/locales/nn.d.cts +5 -0
- package/node_modules/zod/v4/locales/nn.d.ts +4 -0
- package/node_modules/zod/v4/locales/nn.js +113 -0
- package/node_modules/zod/v4/locales/no.cjs +7 -2
- package/node_modules/zod/v4/locales/no.js +7 -2
- package/node_modules/zod/v4/locales/ota.cjs +5 -0
- package/node_modules/zod/v4/locales/ota.js +5 -0
- package/node_modules/zod/v4/locales/pl.cjs +5 -0
- package/node_modules/zod/v4/locales/pl.js +5 -0
- package/node_modules/zod/v4/locales/ps.cjs +5 -0
- package/node_modules/zod/v4/locales/ps.js +5 -0
- package/node_modules/zod/v4/locales/pt-BR.cjs +170 -0
- package/node_modules/zod/v4/locales/pt-BR.d.cts +5 -0
- package/node_modules/zod/v4/locales/pt-BR.d.ts +4 -0
- package/node_modules/zod/v4/locales/pt-BR.js +143 -0
- package/node_modules/zod/v4/locales/pt.cjs +89 -55
- package/node_modules/zod/v4/locales/pt.js +89 -55
- package/node_modules/zod/v4/locales/ro.cjs +3 -0
- package/node_modules/zod/v4/locales/ro.js +3 -0
- package/node_modules/zod/v4/locales/ru.cjs +12 -0
- package/node_modules/zod/v4/locales/ru.js +12 -0
- package/node_modules/zod/v4/locales/sk.cjs +143 -0
- package/node_modules/zod/v4/locales/sk.d.cts +5 -0
- package/node_modules/zod/v4/locales/sk.d.ts +4 -0
- package/node_modules/zod/v4/locales/sk.js +116 -0
- package/node_modules/zod/v4/locales/sl.cjs +5 -0
- package/node_modules/zod/v4/locales/sl.js +5 -0
- package/node_modules/zod/v4/locales/sv.cjs +7 -2
- package/node_modules/zod/v4/locales/sv.js +7 -2
- package/node_modules/zod/v4/locales/ta.cjs +5 -0
- package/node_modules/zod/v4/locales/ta.js +5 -0
- package/node_modules/zod/v4/locales/tg.cjs +144 -0
- package/node_modules/zod/v4/locales/tg.d.cts +5 -0
- package/node_modules/zod/v4/locales/tg.d.ts +4 -0
- package/node_modules/zod/v4/locales/tg.js +117 -0
- package/node_modules/zod/v4/locales/th.cjs +5 -0
- package/node_modules/zod/v4/locales/th.js +5 -0
- package/node_modules/zod/v4/locales/tk.cjs +134 -0
- package/node_modules/zod/v4/locales/tk.d.cts +5 -0
- package/node_modules/zod/v4/locales/tk.d.ts +4 -0
- package/node_modules/zod/v4/locales/tk.js +107 -0
- package/node_modules/zod/v4/locales/tr.cjs +5 -0
- package/node_modules/zod/v4/locales/tr.js +5 -0
- package/node_modules/zod/v4/locales/uk.cjs +5 -0
- package/node_modules/zod/v4/locales/uk.js +5 -0
- package/node_modules/zod/v4/locales/ur.cjs +5 -0
- package/node_modules/zod/v4/locales/ur.js +5 -0
- package/node_modules/zod/v4/locales/uz.cjs +3 -0
- package/node_modules/zod/v4/locales/uz.js +3 -0
- package/node_modules/zod/v4/locales/vi.cjs +5 -0
- package/node_modules/zod/v4/locales/vi.js +5 -0
- package/node_modules/zod/v4/locales/yo.cjs +5 -0
- package/node_modules/zod/v4/locales/yo.js +5 -0
- package/node_modules/zod/v4/locales/zh-CN.cjs +5 -0
- package/node_modules/zod/v4/locales/zh-CN.js +5 -0
- package/node_modules/zod/v4/locales/zh-TW.cjs +5 -0
- package/node_modules/zod/v4/locales/zh-TW.js +5 -0
- package/node_modules/zod/v4/mini/checks.cjs +21 -1
- package/node_modules/zod/v4/mini/checks.d.cts +1 -1
- package/node_modules/zod/v4/mini/checks.d.ts +1 -1
- package/node_modules/zod/v4/mini/checks.js +1 -1
- package/node_modules/zod/v4/mini/coerce.cjs +19 -0
- package/node_modules/zod/v4/mini/deep-partial.cjs +58 -0
- package/node_modules/zod/v4/mini/deep-partial.d.cts +14 -0
- package/node_modules/zod/v4/mini/deep-partial.d.ts +14 -0
- package/node_modules/zod/v4/mini/deep-partial.js +13 -0
- package/node_modules/zod/v4/mini/external.cjs +33 -1
- package/node_modules/zod/v4/mini/external.d.cts +5 -2
- package/node_modules/zod/v4/mini/external.d.ts +5 -2
- package/node_modules/zod/v4/mini/external.js +3 -1
- package/node_modules/zod/v4/mini/in-out.cjs +82 -0
- package/node_modules/zod/v4/mini/in-out.d.cts +8 -0
- package/node_modules/zod/v4/mini/in-out.d.ts +8 -0
- package/node_modules/zod/v4/mini/in-out.js +36 -0
- package/node_modules/zod/v4/mini/index.cjs +19 -0
- package/node_modules/zod/v4/mini/iso.cjs +19 -0
- package/node_modules/zod/v4/mini/parse.cjs +22 -1
- package/node_modules/zod/v4/mini/parse.d.cts +1 -1
- package/node_modules/zod/v4/mini/parse.d.ts +1 -1
- package/node_modules/zod/v4/mini/parse.js +1 -1
- package/node_modules/zod/v4/mini/schemas.cjs +117 -53
- package/node_modules/zod/v4/mini/schemas.d.cts +49 -14
- package/node_modules/zod/v4/mini/schemas.d.ts +49 -14
- package/node_modules/zod/v4/mini/schemas.js +92 -51
- package/node_modules/zod/v4-mini/index.cjs +19 -0
- package/openclaw.plugin.json +19 -3
- package/package.json +10 -8
- package/node_modules/@pierre/diffs/dist/editor/stateStorage.d.ts +0 -15
- package/node_modules/@pierre/diffs/dist/editor/stateStorage.d.ts.map +0 -1
- package/node_modules/@pierre/diffs/dist/editor/stateStorage.js +0 -65
- package/node_modules/@pierre/diffs/dist/editor/stateStorage.js.map +0 -1
- package/node_modules/playwright-core/lib/vite/dashboard/assets/index-CyWAfh-p.js +0 -11
- package/node_modules/playwright-core/lib/vite/dashboard/assets/index-DhC616m4.css +0 -1
- package/node_modules/playwright-core/lib/vite/recorder/assets/index-DYjdXIbE.js +0 -129
- package/node_modules/playwright-core/lib/vite/recorder/assets/index-l_lX622x.css +0 -1
- package/node_modules/playwright-core/lib/vite/traceViewer/assets/defaultSettingsView-B-dXF5JN.js +0 -181
- package/node_modules/playwright-core/lib/vite/traceViewer/defaultSettingsView.BLFoOugd.css +0 -1
- package/node_modules/playwright-core/lib/vite/traceViewer/index.KZ4wOW1K.js +0 -1
- package/node_modules/playwright-core/lib/vite/traceViewer/uiMode.Dzuouizj.js +0 -5
- package/node_modules/zod/src/v4/core/config.ts +0 -15
- /package/dist/{viewer-assets-D3qrnaxI.js → .setup/viewer-assets-D3qrnaxI.mjs} +0 -0
|
@@ -1,23 +1,27 @@
|
|
|
1
1
|
import { dequeueRender, queueRender } from "../managers/UniversalRenderingManager.js";
|
|
2
2
|
import { isGutterUtilityPath } from "../utils/isGutterUtilityPath.js";
|
|
3
|
+
import { computeLineOffsets } from "../utils/computeFileOffsets.js";
|
|
3
4
|
import { getFiletypeFromFileName } from "../utils/getFiletypeFromFileName.js";
|
|
4
5
|
import { isSafari } from "../utils/platform.js";
|
|
6
|
+
import { EditStack } from "./editStack.js";
|
|
7
|
+
import { getTextDocumentChangeTransaction } from "./textDocumentChangeTransaction.js";
|
|
8
|
+
import { TextDocument } from "./textDocument.js";
|
|
9
|
+
import { EditStateManager, cloneEditorViewState, toManagedEditState } from "./EditStateManager.js";
|
|
5
10
|
import { isMoveCursorShortcut, isPrimaryModifier } from "./platform.js";
|
|
6
11
|
import { resolveEditorCommandFromKeyboardEvent, resolveFindAgainShortcut } from "./command.js";
|
|
12
|
+
import { cloneRetainedDiffSessionSnapshot } from "./cloneRetainedDiffSessionSnapshot.js";
|
|
7
13
|
import editor_default from "./editor2.js";
|
|
8
|
-
import {
|
|
14
|
+
import { buildEditPredictionRequest, matchesEditPredictionPattern, recordEditPrediction } from "./editPrediction.js";
|
|
9
15
|
import { resolveBlockCommentEdits, resolveCommentConfig, resolveLineCommentEdits } from "./languages.js";
|
|
10
16
|
import { addEventListener, clampDomOffset, extend, getLineNumberAttr, h, lookupScrollContainer, round } from "./utils.js";
|
|
11
17
|
import { applyDocumentChangeToLineAnnotations, renderLineAnnotations } from "./lineAnnotations.js";
|
|
12
18
|
import { PopoverManager } from "./popover.js";
|
|
13
|
-
import { applyDeleteCharacterToSelections, applyDeleteHardLineForwardToSelections, applyDeleteSoftLineBackwardToSelections, applyDeleteWordBackwardToSelections, applyTextChangeToSelections, applyTextReplaceToSelections, applyTransposeToSelections, comparePosition, convertSelection, createSelectionFrom, createSelectionFromAnchorAndFocusOffsets, expandCollapsedSelectionToWord, extendSelection, extendSelections, findNextMatch, getAutoSurroundReplacementTexts, getCaretPosition, getDocumentBoundarySelection, getDocumentFullSelection, getSelectedLineBlocks, getSelectionAnchor, getSelectionClipboardTexts, getSelectionText, isCollapsedSelection, isLineEditable, mapCursorMove, mapSelectionShift, mergeOverlappingSelections, remapSelectionsAfterEdits, resolveIndentEdits, resolveSelectionCut, selectionIntersects, shiftSelectionLines, snapCharacterToGraphemeBoundary } from "./selection.js";
|
|
19
|
+
import { applyDeleteCharacterToSelections, applyDeleteHardLineForwardToSelections, applyDeleteSoftLineBackwardToSelections, applyDeleteWordBackwardToSelections, applyTextChangeToSelections, applyTextReplaceToSelections, applyTransposeToSelections, comparePosition, convertSelection, createSelectionFrom, createSelectionFromAnchorAndFocusOffsets, expandCollapsedSelectionToWord, extendSelection, extendSelections, findNextMatch, getAutoSurroundReplacementTexts, getCaretPosition, getDocumentBoundarySelection, getDocumentFullSelection, getSelectedLineBlocks, getSelectionAnchor, getSelectionClipboardTexts, getSelectionText, isCollapsedSelection, isLineEditable, mapCursorMove, mapSelectionShift, mergeOverlappingSelections, remapOffsetThroughEdits, remapSelectionsAfterEdits, resolveIndentEdits, resolveSelectionCut, selectionIntersects, shiftSelectionLines, snapCharacterToGraphemeBoundary } from "./selection.js";
|
|
14
20
|
import { MarkerRenderer, markerSeverityDatasetKey } from "./marker.js";
|
|
15
21
|
import { findBracketMatchRanges } from "./matchBrackets.js";
|
|
16
22
|
import { createSpriteElement } from "./sprite.js";
|
|
17
23
|
import { SearchPanelWidget } from "./searchPanel.js";
|
|
18
24
|
import { SelectionActionWidget } from "./selectionAction.js";
|
|
19
|
-
import { cloneEditorState, createStateStorage } from "./stateStorage.js";
|
|
20
|
-
import { TextDocument } from "./textDocument.js";
|
|
21
25
|
import { Metrics, getExpandedAsciiTextColumns, getUnicodeMeasurementOffsets, snapTextOffsetToUnicodeBoundary } from "./textMeasure.js";
|
|
22
26
|
import { EditorTokenizer, renderLineTokens } from "./tokenizer.js";
|
|
23
27
|
//#region src/editor/editor.ts
|
|
@@ -33,29 +37,45 @@ function getShadowRootRange(shadowRoot) {
|
|
|
33
37
|
endOffset: range.endOffset
|
|
34
38
|
};
|
|
35
39
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
40
|
+
/** Describe replacing the complete document from its previous text. */
|
|
41
|
+
function createFullDocumentChange(previousContents, contents) {
|
|
42
|
+
const lineOffsets = computeLineOffsets(previousContents);
|
|
43
|
+
const lastLineOffset = lineOffsets[lineOffsets.length - 1] ?? 0;
|
|
44
|
+
return {
|
|
45
|
+
start: 0,
|
|
46
|
+
end: previousContents.length,
|
|
47
|
+
text: contents,
|
|
48
|
+
range: {
|
|
49
|
+
start: {
|
|
50
|
+
line: 0,
|
|
51
|
+
character: 0
|
|
52
|
+
},
|
|
53
|
+
end: {
|
|
54
|
+
line: lineOffsets.length - 1,
|
|
55
|
+
character: previousContents.length - lastLineOffset
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
};
|
|
39
59
|
}
|
|
40
|
-
function
|
|
41
|
-
return
|
|
60
|
+
function isVirtualizedEditorComponent(instance) {
|
|
61
|
+
return instance != null && "renderType" in instance && instance.renderType === "virtualized";
|
|
42
62
|
}
|
|
43
63
|
const MAX_EDIT_WIDEN_WINDOW_MULTIPLE = 2;
|
|
44
64
|
const MAX_WRAP_OFFSETS_CACHE_LINES = 1e4;
|
|
65
|
+
const EDIT_PREDICTION_DEBOUNCE_MS = 300;
|
|
66
|
+
const MAX_EDIT_PREDICTION_RESPONSE_EDITS = 256;
|
|
67
|
+
const MAX_EDIT_PREDICTION_RESPONSE_BYTES = 131072;
|
|
68
|
+
const editPredictionTextEncoder = new TextEncoder();
|
|
45
69
|
const SELECTION_ACTION_POPOVER_PLACEMENT_KEY = "selection-action";
|
|
46
70
|
const MULTI_SELECTION_CLIPBOARD_TYPE = "application/vnd.pierre.diffs-selections+json";
|
|
47
71
|
var Editor = class {
|
|
72
|
+
type;
|
|
48
73
|
#options;
|
|
74
|
+
#initialState;
|
|
75
|
+
#editSession;
|
|
49
76
|
#metrics = new Metrics();
|
|
50
77
|
#tokenizer;
|
|
51
78
|
#popoverManager;
|
|
52
|
-
#textDocumentCache = /* @__PURE__ */ new Map();
|
|
53
|
-
#stateStorage;
|
|
54
|
-
#stateStorageOption;
|
|
55
|
-
#pendingStateWrites = /* @__PURE__ */ new Map();
|
|
56
|
-
#pendingStateRestore;
|
|
57
|
-
#stateRestoreGeneration = 0;
|
|
58
|
-
#restoreStateOnNextSync = false;
|
|
59
79
|
#editorEventDisposes;
|
|
60
80
|
#globalEventDisposes;
|
|
61
81
|
#selectEventDisposes;
|
|
@@ -79,17 +99,25 @@ var Editor = class {
|
|
|
79
99
|
#fileContainer;
|
|
80
100
|
#gutterElement;
|
|
81
101
|
#contentElement;
|
|
102
|
+
#deletionsColumn;
|
|
82
103
|
#overlayElement;
|
|
83
104
|
#overlayElements;
|
|
105
|
+
#caretElements;
|
|
106
|
+
#caretHighlightElements;
|
|
84
107
|
#primaryCaretElement;
|
|
85
108
|
#resizeObserver;
|
|
86
109
|
#fileInstance;
|
|
87
|
-
#
|
|
110
|
+
#applyDocumentChange;
|
|
111
|
+
#publishChange;
|
|
112
|
+
#isRendering = false;
|
|
113
|
+
#restoreEditorStateOnSync = false;
|
|
88
114
|
#lineAnnotations;
|
|
89
|
-
#
|
|
115
|
+
#editStateKey;
|
|
116
|
+
#ownsVerticalViewport;
|
|
90
117
|
#renderRange;
|
|
91
118
|
#viewportWindowLines;
|
|
92
119
|
#markerRenderer;
|
|
120
|
+
#carets;
|
|
93
121
|
#searchPanel;
|
|
94
122
|
#selectionAction;
|
|
95
123
|
#canMountSelectionAction = true;
|
|
@@ -115,53 +143,170 @@ var Editor = class {
|
|
|
115
143
|
#retainSearchPanelFocus = false;
|
|
116
144
|
#fontRemeasureScheduled = false;
|
|
117
145
|
#themeSelectionRefreshFrame;
|
|
146
|
+
#editPredictionTimer;
|
|
147
|
+
#editPredictionAbortController;
|
|
148
|
+
#editPredictionGeneration = 0;
|
|
149
|
+
#editPredictionRevealed = false;
|
|
150
|
+
#retryEditPredictionOnRender = false;
|
|
151
|
+
#editPrediction;
|
|
152
|
+
#editPredictionHistory = [];
|
|
153
|
+
#editPredictionSpacers = /* @__PURE__ */ new Map();
|
|
154
|
+
#ghostTextRows = /* @__PURE__ */ new Map();
|
|
118
155
|
#onDeferTokenize = (lines, themeType) => {
|
|
156
|
+
if (!this.#isRendering) return;
|
|
119
157
|
this.#fileInstance?.updateRenderCache(lines, themeType);
|
|
120
158
|
if (this.#renderRange !== void 0 && this.#renderRange.totalLines !== Infinity) {
|
|
159
|
+
const predictionLines = this.#editPrediction === void 0 ? void 0 : new Set(this.#editPrediction.response.edits.map((edit) => edit.range.start.line));
|
|
160
|
+
let refreshPrediction = false;
|
|
121
161
|
const { startingLine, totalLines } = this.#renderRange;
|
|
122
|
-
const endLine = Math.min(startingLine + totalLines, this.#
|
|
162
|
+
const endLine = Math.min(startingLine + totalLines, (this.#editSession ?? this.#initialState)?.document?.lineCount ?? 0);
|
|
123
163
|
for (const [line, tokens] of lines) if (line >= startingLine && line < endLine) {
|
|
124
164
|
const lineElement = this.#getLineElement(line);
|
|
125
|
-
if (lineElement !== void 0)
|
|
165
|
+
if (lineElement !== void 0) {
|
|
166
|
+
lineElement.replaceChildren(...renderLineTokens(tokens));
|
|
167
|
+
refreshPrediction ||= predictionLines?.has(line) === true;
|
|
168
|
+
}
|
|
126
169
|
}
|
|
170
|
+
if (refreshPrediction && this.#selections !== void 0) this.#updateSelections(this.#selections);
|
|
127
171
|
}
|
|
128
172
|
};
|
|
129
|
-
|
|
173
|
+
/**
|
|
174
|
+
* @param type The component surface this editor can attach to.
|
|
175
|
+
* @param options Configure editor behavior and lifecycle callbacks.
|
|
176
|
+
* @param editStateKey Retain this editable draft and its undo/redo history
|
|
177
|
+
* in memory so a later editor using the same type and key can resume them.
|
|
178
|
+
*/
|
|
179
|
+
constructor(type, options = {}, editStateKey) {
|
|
180
|
+
this.type = type;
|
|
130
181
|
this.#options = options;
|
|
182
|
+
this.#ownsVerticalViewport = options.ownsVerticalViewport === true;
|
|
183
|
+
this.#initialState = options.initialState;
|
|
184
|
+
this.#editStateKey = editStateKey;
|
|
185
|
+
}
|
|
186
|
+
get #getTypedEditor() {
|
|
187
|
+
return this.type === "file" ? this : this;
|
|
131
188
|
}
|
|
132
189
|
setOptions(options) {
|
|
133
|
-
const
|
|
134
|
-
const
|
|
190
|
+
const previousRenderCaret = this.#options.renderCaret;
|
|
191
|
+
const previousEditPrediction = this.#options.editPrediction;
|
|
192
|
+
this.#options = {
|
|
135
193
|
...this.#options,
|
|
136
194
|
...options
|
|
137
195
|
};
|
|
138
|
-
if (
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
this.#options = nextOptions;
|
|
143
|
-
if (this.#options.persistState !== true) {
|
|
144
|
-
this.#textDocumentCache.clear();
|
|
145
|
-
this.#stateRestoreGeneration++;
|
|
146
|
-
this.#restoreStateOnNextSync = false;
|
|
196
|
+
if (previousRenderCaret !== this.#options.renderCaret) {
|
|
197
|
+
this.#caretElements?.forEach((element) => element.remove());
|
|
198
|
+
this.#caretElements = void 0;
|
|
199
|
+
this.#renderCarets();
|
|
147
200
|
}
|
|
148
|
-
if (
|
|
149
|
-
this.#
|
|
150
|
-
this.#
|
|
151
|
-
this.#
|
|
152
|
-
this.#pendingStateWrites.clear();
|
|
201
|
+
if (previousEditPrediction !== this.#options.editPrediction) {
|
|
202
|
+
this.#cancelEditPrediction(true);
|
|
203
|
+
this.#editPredictionHistory = [];
|
|
204
|
+
this.#scheduleEditPrediction();
|
|
153
205
|
}
|
|
154
206
|
}
|
|
207
|
+
__emitEditComplete(event) {
|
|
208
|
+
this.#options.onComplete?.(event);
|
|
209
|
+
}
|
|
210
|
+
/** @internal */
|
|
211
|
+
__getGhostTextRows() {
|
|
212
|
+
return this.#ghostTextRows;
|
|
213
|
+
}
|
|
214
|
+
setCarets(carets) {
|
|
215
|
+
const textDocument = this.#editSession?.document;
|
|
216
|
+
if (textDocument === void 0) return;
|
|
217
|
+
this.#caretElements?.forEach((element) => element.remove());
|
|
218
|
+
this.#caretElements = void 0;
|
|
219
|
+
this.#caretHighlightElements?.forEach((element) => element.remove());
|
|
220
|
+
this.#caretHighlightElements = void 0;
|
|
221
|
+
this.#carets = carets.length === 0 ? void 0 : carets.map((caret) => {
|
|
222
|
+
const anchor = textDocument.normalizePosition(caret.anchor);
|
|
223
|
+
const focus = textDocument.normalizePosition(caret.focus);
|
|
224
|
+
return {
|
|
225
|
+
caret: {
|
|
226
|
+
...caret,
|
|
227
|
+
anchor,
|
|
228
|
+
focus
|
|
229
|
+
},
|
|
230
|
+
anchorOffset: textDocument.offsetAt(anchor),
|
|
231
|
+
focusOffset: textDocument.offsetAt(focus)
|
|
232
|
+
};
|
|
233
|
+
});
|
|
234
|
+
this.#renderCarets();
|
|
235
|
+
}
|
|
155
236
|
edit(fileInstance) {
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
this.#
|
|
237
|
+
const editor = this.#getTypedEditor;
|
|
238
|
+
const previousSession = this.#editSession;
|
|
239
|
+
if (this.#isRendering) throw new Error("Editor.edit: the editor is already rendering its component");
|
|
240
|
+
if (this.#fileInstance != null && this.#fileInstance !== fileInstance) throw new Error("Editor.edit: a recycled edit session cannot attach to a different component");
|
|
241
|
+
const initialState = this.#initialState;
|
|
242
|
+
const initialEditorState = initialState?.editor;
|
|
243
|
+
const editStateKey = this.#editStateKey;
|
|
244
|
+
const editSession = getEditSession({
|
|
245
|
+
type: this.type,
|
|
246
|
+
editStateKey,
|
|
247
|
+
owner: this,
|
|
248
|
+
initialState,
|
|
249
|
+
previousSession
|
|
250
|
+
});
|
|
251
|
+
const previousDiffSession = editSession.diffSession;
|
|
252
|
+
this.#initialState = void 0;
|
|
253
|
+
this.#editSession = editSession;
|
|
161
254
|
this.#fileInstance = fileInstance;
|
|
162
|
-
this.#
|
|
163
|
-
this.#
|
|
164
|
-
|
|
255
|
+
this.#isRendering = true;
|
|
256
|
+
this.#restoreEditorStateOnSync = editSession.editor != null;
|
|
257
|
+
try {
|
|
258
|
+
this.#initialize();
|
|
259
|
+
if (fileInstance.type === "file" && editor.type === "file") {
|
|
260
|
+
editor.#applyDocumentChange = fileInstance.applyDocumentChange.bind(fileInstance);
|
|
261
|
+
editor.#publishChange = (changes, file, lineAnnotations) => {
|
|
262
|
+
const event = {
|
|
263
|
+
changes,
|
|
264
|
+
file,
|
|
265
|
+
editor,
|
|
266
|
+
lineAnnotations
|
|
267
|
+
};
|
|
268
|
+
fileInstance.__acceptEditorChange(event);
|
|
269
|
+
editor.#options.onChange?.(event);
|
|
270
|
+
fileInstance.emitEditChange(event);
|
|
271
|
+
};
|
|
272
|
+
if (this.#detach == null) this.#detach = fileInstance.__attachEditor(editor);
|
|
273
|
+
else fileInstance.__resumeEditor(editor);
|
|
274
|
+
} else if (fileInstance.type === "file-diff" && editor.type === "file-diff") {
|
|
275
|
+
editor.#applyDocumentChange = fileInstance.applyDocumentChange.bind(fileInstance);
|
|
276
|
+
editor.#publishChange = (changes, file, lineAnnotations) => {
|
|
277
|
+
const event = {
|
|
278
|
+
changes,
|
|
279
|
+
file,
|
|
280
|
+
editor,
|
|
281
|
+
lineAnnotations
|
|
282
|
+
};
|
|
283
|
+
fileInstance.__acceptEditorChange(event);
|
|
284
|
+
editor.#options.onChange?.(event);
|
|
285
|
+
fileInstance.emitEditChange(event);
|
|
286
|
+
};
|
|
287
|
+
if (this.#detach == null) this.#detach = fileInstance.__attachEditor(editor);
|
|
288
|
+
else fileInstance.__resumeEditor(editor);
|
|
289
|
+
} else throw new Error("Editor.edit: Impossible edit state");
|
|
290
|
+
} catch (error) {
|
|
291
|
+
this.cleanUp("recycle");
|
|
292
|
+
if (editSession.type === "file-diff" && editSession.diffSession == null) editSession.diffSession = previousDiffSession;
|
|
293
|
+
if (this.#detach == null && editStateKey != null) {
|
|
294
|
+
if (editor.type === "file") EditStateManager.releaseFile(editStateKey, editor);
|
|
295
|
+
else EditStateManager.releaseFileDiff(editStateKey, editor);
|
|
296
|
+
}
|
|
297
|
+
this.#editSession = previousSession;
|
|
298
|
+
if (this.#detach == null) {
|
|
299
|
+
this.#fileInstance = void 0;
|
|
300
|
+
this.#applyDocumentChange = void 0;
|
|
301
|
+
this.#publishChange = void 0;
|
|
302
|
+
}
|
|
303
|
+
if (initialState != null && initialEditorState != null) initialState.editor = initialEditorState;
|
|
304
|
+
this.#initialState = initialState;
|
|
305
|
+
throw error;
|
|
306
|
+
}
|
|
307
|
+
return () => {
|
|
308
|
+
this.cleanUp("complete");
|
|
309
|
+
};
|
|
165
310
|
}
|
|
166
311
|
/**
|
|
167
312
|
* Apply edits to current attached file. Every edit joins the undo timeline:
|
|
@@ -174,8 +319,8 @@ var Editor = class {
|
|
|
174
319
|
* are remapped during replay and the text edit still joins the undo timeline.
|
|
175
320
|
*/
|
|
176
321
|
applyEdits(edits, updateHistory = true) {
|
|
177
|
-
const textDocument = this.#
|
|
178
|
-
if (textDocument == null) throw new Error("Editor is not attached");
|
|
322
|
+
const textDocument = this.#editSession?.document;
|
|
323
|
+
if (textDocument == null) throw new Error("Editor.applyEdits: Editor is not attached");
|
|
179
324
|
const wasFocused = this.#contentHasFocus;
|
|
180
325
|
const selectionsBefore = this.#selections;
|
|
181
326
|
const selectionOffsetsBefore = selectionsBefore?.map((selection) => [textDocument.offsetAt(selection.start), textDocument.offsetAt(selection.end)]);
|
|
@@ -191,11 +336,11 @@ var Editor = class {
|
|
|
191
336
|
}
|
|
192
337
|
/** Whether there is an edit to undo. */
|
|
193
338
|
get canUndo() {
|
|
194
|
-
return this.#
|
|
339
|
+
return (this.#editSession ?? this.#initialState)?.document?.canUndo ?? false;
|
|
195
340
|
}
|
|
196
341
|
/** Whether there is an undone edit to redo. */
|
|
197
342
|
get canRedo() {
|
|
198
|
-
return this.#
|
|
343
|
+
return (this.#editSession ?? this.#initialState)?.document?.canRedo ?? false;
|
|
199
344
|
}
|
|
200
345
|
/** Undo the last edit. Does nothing when there is nothing to undo. */
|
|
201
346
|
undo() {
|
|
@@ -206,8 +351,9 @@ var Editor = class {
|
|
|
206
351
|
this.#runCommand("redo");
|
|
207
352
|
}
|
|
208
353
|
getFile() {
|
|
209
|
-
const
|
|
210
|
-
const
|
|
354
|
+
const editSession = this.#editSession ?? this.#initialState;
|
|
355
|
+
const fileInfo = editSession?.fileInfo;
|
|
356
|
+
const textDocument = editSession?.document;
|
|
211
357
|
if (fileInfo === void 0 || textDocument === void 0) return;
|
|
212
358
|
const file = { ...fileInfo };
|
|
213
359
|
Object.defineProperty(file, "contents", {
|
|
@@ -217,32 +363,56 @@ var Editor = class {
|
|
|
217
363
|
return file;
|
|
218
364
|
}
|
|
219
365
|
getText() {
|
|
220
|
-
return this.#
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
|
|
366
|
+
return (this.#editSession ?? this.#initialState)?.document?.getText() ?? "";
|
|
367
|
+
}
|
|
368
|
+
/** Return an isolated copy of selections and restorable view state. */
|
|
369
|
+
getViewState() {
|
|
370
|
+
const fileInstance = this.#isRendering ? this.#fileInstance : void 0;
|
|
371
|
+
if (!this.#isRendering && this.#editSession?.editor != null) return cloneEditorViewState(this.#editSession.editor);
|
|
372
|
+
const selections = this.#selections?.map((selection) => ({
|
|
373
|
+
...selection,
|
|
374
|
+
start: { ...selection.start },
|
|
375
|
+
end: { ...selection.end }
|
|
376
|
+
}));
|
|
377
|
+
if (fileInstance == null) return { selections };
|
|
378
|
+
const viewport = this.#getOwnedVerticalViewport();
|
|
379
|
+
const scrollLeft = fileInstance.getCodeScrollLeft();
|
|
380
|
+
if (viewport == null) return {
|
|
381
|
+
selections,
|
|
382
|
+
view: { scrollLeft }
|
|
383
|
+
};
|
|
224
384
|
return {
|
|
225
|
-
selections
|
|
226
|
-
view:
|
|
227
|
-
scrollLeft
|
|
228
|
-
scrollTop:
|
|
229
|
-
}
|
|
385
|
+
selections,
|
|
386
|
+
view: {
|
|
387
|
+
scrollLeft,
|
|
388
|
+
scrollTop: viewport.scrollTop
|
|
389
|
+
}
|
|
230
390
|
};
|
|
231
391
|
}
|
|
232
|
-
|
|
233
|
-
|
|
392
|
+
/**
|
|
393
|
+
* Return the objects that make up the active edit session, or undefined when
|
|
394
|
+
* no complete session exists.
|
|
395
|
+
*/
|
|
396
|
+
getEditState() {
|
|
397
|
+
const editSession = this.#editSession;
|
|
398
|
+
if (editSession == null) return;
|
|
399
|
+
if (this.#fileInstance == null) throw new Error(`Editor.getEditState: active ${this.type} session has no component`);
|
|
400
|
+
return toManagedEditState(editSession);
|
|
401
|
+
}
|
|
402
|
+
setViewState({ selections, view }) {
|
|
403
|
+
if (!this.#isRendering || this.#fileInstance === void 0 || this.#editSession?.document === void 0) throw new Error("Editor.setViewState: Editor is not attached");
|
|
234
404
|
this.#canMountSelectionAction = false;
|
|
235
405
|
this.#updateSelections(selections ?? []);
|
|
236
406
|
if (view != null) {
|
|
237
407
|
this.#fileInstance.setCodeScrollLeft(view.scrollLeft);
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
}
|
|
241
|
-
this.#
|
|
408
|
+
const viewport = this.#getOwnedVerticalViewport();
|
|
409
|
+
if (view.scrollTop !== void 0 && viewport != null) viewport.scrollTop = view.scrollTop;
|
|
410
|
+
} else if (this.#ownsVerticalViewport) this.#scrollToPrimaryCaret();
|
|
411
|
+
this.#checkpointEditSessionState();
|
|
242
412
|
}
|
|
243
413
|
setSelections(selections) {
|
|
244
|
-
const textDocument = this.#
|
|
245
|
-
if (textDocument === void 0) throw new Error("Text document is not initialized");
|
|
414
|
+
const textDocument = this.#editSession?.document;
|
|
415
|
+
if (textDocument === void 0) throw new Error("Editor.setSelections: Text document is not initialized");
|
|
246
416
|
const resolvedSelections = selections.map((selection) => {
|
|
247
417
|
let start = textDocument.normalizePosition(selection.start);
|
|
248
418
|
let end = textDocument.normalizePosition(selection.end);
|
|
@@ -264,8 +434,8 @@ var Editor = class {
|
|
|
264
434
|
this.#scrollToPrimaryCaret();
|
|
265
435
|
}
|
|
266
436
|
setMarkers(markers) {
|
|
267
|
-
const textDocument = this.#
|
|
268
|
-
if (textDocument === void 0) throw new Error("Text document is not initialized");
|
|
437
|
+
const textDocument = this.#editSession?.document;
|
|
438
|
+
if (textDocument === void 0) throw new Error("Editor.setMarkers: Text document is not initialized");
|
|
269
439
|
if (markers.length === 0) {
|
|
270
440
|
this.#markerRenderer?.cleanup();
|
|
271
441
|
this.#markerRenderer = void 0;
|
|
@@ -284,13 +454,14 @@ var Editor = class {
|
|
|
284
454
|
this.#markerRenderer.setMarkers(markers, textDocument);
|
|
285
455
|
if (this.#contentElement !== void 0) this.#markerRenderer.listenHover(this.#contentElement);
|
|
286
456
|
this.#updateSelections(this.#selections ?? []);
|
|
457
|
+
this.#renderCarets();
|
|
287
458
|
}
|
|
288
459
|
focus(options) {
|
|
289
460
|
const preventScroll = options?.preventScroll ?? false;
|
|
290
461
|
const lineNumber = options?.lineNumber;
|
|
291
462
|
if (lineNumber === "first-visible" || typeof lineNumber === "number") {
|
|
292
|
-
const textDocument = this.#
|
|
293
|
-
if (textDocument == null || this.#fileInstance == null) return;
|
|
463
|
+
const textDocument = this.#editSession?.document;
|
|
464
|
+
if (textDocument == null || !this.#isRendering || this.#fileInstance == null) return;
|
|
294
465
|
const targetLineNumber = lineNumber === "first-visible" ? this.#getFirstVisibleLineNumber(options?.offset) : lineNumber;
|
|
295
466
|
if (targetLineNumber == null) return;
|
|
296
467
|
const position = textDocument.normalizePosition({
|
|
@@ -312,27 +483,30 @@ var Editor = class {
|
|
|
312
483
|
this.#shouldIgnoreSelectionChange = false;
|
|
313
484
|
this.#contentElement?.blur();
|
|
314
485
|
}
|
|
315
|
-
cleanUp(
|
|
486
|
+
cleanUp(reason = "discard") {
|
|
487
|
+
const fileInstance = this.#fileInstance;
|
|
488
|
+
const recycle = reason === "recycle";
|
|
489
|
+
this.#cancelEditPrediction(true, false);
|
|
490
|
+
if (!recycle) this.#editPredictionHistory = [];
|
|
491
|
+
const editSession = this.#editSession;
|
|
492
|
+
if (fileInstance != null && editSession != null) {
|
|
493
|
+
const discardDiffState = !this.#checkpointEditSessionState();
|
|
494
|
+
if (!recycle) this.#releaseEditSession(discardDiffState);
|
|
495
|
+
}
|
|
316
496
|
this.#invalidateOnAttach();
|
|
317
497
|
if (!recycle) this.#attachState.delivered = false;
|
|
318
|
-
|
|
319
|
-
const shouldRestoreState = this.#options.persistState === true;
|
|
320
|
-
this.#stateRestoreGeneration++;
|
|
321
|
-
this.#persistCurrentState();
|
|
322
|
-
if (hadFileInstance) this.#restoreStateOnNextSync = shouldRestoreState;
|
|
498
|
+
this.#isRendering = false;
|
|
323
499
|
dequeueRender(this.#handleCustomPasteEvent);
|
|
324
500
|
this.#tokenizer?.cleanUp();
|
|
325
501
|
this.#tokenizer = void 0;
|
|
326
|
-
if (!recycle) {
|
|
327
|
-
this.#textDocument = void 0;
|
|
328
|
-
this.#fileInfo = void 0;
|
|
329
|
-
}
|
|
330
502
|
this.#globalEventDisposes?.forEach((dispose) => dispose());
|
|
331
503
|
this.#globalEventDisposes = void 0;
|
|
332
504
|
this.#editorEventDisposes?.forEach((dispose) => dispose());
|
|
333
505
|
this.#editorEventDisposes = void 0;
|
|
334
|
-
|
|
335
|
-
|
|
506
|
+
if (!recycle) {
|
|
507
|
+
this.#detach?.();
|
|
508
|
+
this.#detach = void 0;
|
|
509
|
+
}
|
|
336
510
|
this.#gutterWidthCache = void 0;
|
|
337
511
|
this.#contentWidthCache = void 0;
|
|
338
512
|
this.#lineYCache.clear();
|
|
@@ -351,6 +525,7 @@ var Editor = class {
|
|
|
351
525
|
this.#popoverManager?.cleanUp();
|
|
352
526
|
this.#popoverManager = void 0;
|
|
353
527
|
this.#gutterElement = void 0;
|
|
528
|
+
this.#deletionsColumn = void 0;
|
|
354
529
|
this.#contentElement?.removeAttribute("contentEditable");
|
|
355
530
|
this.#contentElement = void 0;
|
|
356
531
|
this.#replacementFocusRequest = void 0;
|
|
@@ -364,25 +539,44 @@ var Editor = class {
|
|
|
364
539
|
cancelAnimationFrame(this.#themeSelectionRefreshFrame);
|
|
365
540
|
this.#themeSelectionRefreshFrame = void 0;
|
|
366
541
|
}
|
|
367
|
-
this.#resetState();
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
this.#
|
|
378
|
-
this.#
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
542
|
+
this.#resetState(recycle);
|
|
543
|
+
if (!recycle) try {
|
|
544
|
+
if (fileInstance != null && editSession != null) {
|
|
545
|
+
const editor = this.#getTypedEditor;
|
|
546
|
+
const mode = reason === "complete" ? "install" : "discard";
|
|
547
|
+
if (fileInstance.type === "file" && editor.type === "file") fileInstance.__completeEditSession(editor, mode);
|
|
548
|
+
else if (fileInstance.type === "file-diff" && editor.type === "file-diff") fileInstance.__completeEditSession(editor, mode);
|
|
549
|
+
else throw new Error("Editor.cleanUp: Impossible edit state");
|
|
550
|
+
}
|
|
551
|
+
} finally {
|
|
552
|
+
this.#editSession = void 0;
|
|
553
|
+
this.#fileInstance = void 0;
|
|
554
|
+
this.#applyDocumentChange = void 0;
|
|
555
|
+
this.#publishChange = void 0;
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
#checkpointEditSessionState() {
|
|
559
|
+
const fileInstance = this.#fileInstance;
|
|
560
|
+
const editSession = this.#editSession;
|
|
561
|
+
if (fileInstance == null || editSession == null) return false;
|
|
562
|
+
const editorState = this.#isRendering ? this.getViewState() : editSession.editor ?? {};
|
|
563
|
+
const { view } = editorState;
|
|
564
|
+
const hasNonDefaultView = view != null && (view.scrollLeft !== 0 || (view.scrollTop ?? 0) !== 0);
|
|
565
|
+
const hasEditorState = editorState.selections != null || hasNonDefaultView;
|
|
566
|
+
editSession.editor = cloneEditorViewState(editorState);
|
|
567
|
+
if (editSession.type === "file") return false;
|
|
568
|
+
const capturedDiffSession = fileInstance.__captureDocumentSessionState();
|
|
569
|
+
editSession.diffSession = capturedDiffSession?.diffSession;
|
|
570
|
+
if (capturedDiffSession == null) return false;
|
|
571
|
+
const document = editSession.document;
|
|
572
|
+
return capturedDiffSession.hasChanges || hasEditorState || document?.canUndo === true || document?.canRedo === true;
|
|
573
|
+
}
|
|
574
|
+
#releaseEditSession(discardDiffState = false) {
|
|
575
|
+
const editStateKey = this.#editStateKey;
|
|
576
|
+
if (editStateKey == null) return;
|
|
577
|
+
const editor = this.#getTypedEditor;
|
|
578
|
+
if (editor.type === "file") EditStateManager.releaseFile(editStateKey, editor);
|
|
579
|
+
else EditStateManager.releaseFileDiff(editStateKey, editor, discardDiffState);
|
|
386
580
|
}
|
|
387
581
|
/** @internal */
|
|
388
582
|
__postponeBgTokenizeToNextFrame() {
|
|
@@ -401,9 +595,39 @@ var Editor = class {
|
|
|
401
595
|
if (contentElement != null && (this.#contentHasFocus || shadowActiveElement === contentElement || shadowActiveElement != null && contentElement.contains(shadowActiveElement))) this.#replacementFocusRequest = {};
|
|
402
596
|
}
|
|
403
597
|
/** @internal */
|
|
404
|
-
|
|
598
|
+
__getDocumentContents(fallbackFile) {
|
|
599
|
+
const fileInfo = this.#editSession?.fileInfo;
|
|
600
|
+
const textDocument = this.#editSession?.document;
|
|
601
|
+
if (textDocument == null) return fileInfo == null || fallbackFile == null ? void 0 : {
|
|
602
|
+
...fileInfo,
|
|
603
|
+
contents: fallbackFile.contents
|
|
604
|
+
};
|
|
605
|
+
const resolvedFileInfo = fileInfo ?? fallbackFile;
|
|
606
|
+
if (resolvedFileInfo == null) return;
|
|
607
|
+
return {
|
|
608
|
+
name: resolvedFileInfo.name,
|
|
609
|
+
lang: resolvedFileInfo.lang,
|
|
610
|
+
contents: textDocument.getText()
|
|
611
|
+
};
|
|
612
|
+
}
|
|
613
|
+
/** @internal */
|
|
614
|
+
__getDocumentSessionState() {
|
|
615
|
+
const snapshot = this.#editSession?.diffSession;
|
|
616
|
+
return snapshot != null ? cloneRetainedDiffSessionSnapshot(snapshot) : void 0;
|
|
617
|
+
}
|
|
618
|
+
/** @internal */
|
|
619
|
+
__syncRenderView(props) {
|
|
620
|
+
const { highlighter, fileContainer, renderRange, externalDocument = false } = props;
|
|
621
|
+
const renderView = props;
|
|
622
|
+
let fileOrDiff;
|
|
623
|
+
if ("file" in renderView && this.type === "file") fileOrDiff = renderView.file;
|
|
624
|
+
else if ("fileDiff" in renderView && this.type === "file-diff") fileOrDiff = renderView.fileDiff;
|
|
625
|
+
else throw new Error("Editor.__syncRenderView: Impossible render state");
|
|
626
|
+
const lineAnnotations = renderView.lineAnnotations;
|
|
627
|
+
const editStateKey = this.#editStateKey;
|
|
405
628
|
const fileInstance = this.#fileInstance;
|
|
406
|
-
|
|
629
|
+
const editSession = this.#editSession;
|
|
630
|
+
if (!this.#isRendering || fileInstance == null || editSession == null) return;
|
|
407
631
|
const shadowRoot = fileContainer.shadowRoot;
|
|
408
632
|
if (shadowRoot == null) {
|
|
409
633
|
console.error("[editor] Could not find the shadow root.");
|
|
@@ -412,16 +636,29 @@ var Editor = class {
|
|
|
412
636
|
let codeElement;
|
|
413
637
|
let gutterEl;
|
|
414
638
|
let contentEl;
|
|
415
|
-
|
|
416
|
-
|
|
639
|
+
let deletionsGutterEl;
|
|
640
|
+
let deletionsContentEl;
|
|
641
|
+
for (const el of shadowRoot.querySelectorAll("[data-code]")) {
|
|
642
|
+
const isDeletions = el.dataset.deletions != null;
|
|
643
|
+
if (!isDeletions) codeElement = el;
|
|
417
644
|
for (const child of el.children) {
|
|
418
|
-
|
|
419
|
-
const { gutter, content } =
|
|
420
|
-
if (gutter
|
|
421
|
-
|
|
645
|
+
if (!(child instanceof HTMLElement)) continue;
|
|
646
|
+
const { gutter, content } = child.dataset;
|
|
647
|
+
if (gutter != null) {
|
|
648
|
+
if (isDeletions) deletionsGutterEl = child;
|
|
649
|
+
else gutterEl = child;
|
|
650
|
+
} else if (content != null) {
|
|
651
|
+
if (isDeletions) deletionsContentEl = child;
|
|
652
|
+
else contentEl = child;
|
|
653
|
+
}
|
|
422
654
|
}
|
|
423
|
-
break;
|
|
424
655
|
}
|
|
656
|
+
if (deletionsContentEl == null) this.#deletionsColumn = void 0;
|
|
657
|
+
else if (deletionsGutterEl == null) throw new Error("Editor.__syncRenderView: the deletions column has no gutter");
|
|
658
|
+
else this.#deletionsColumn = {
|
|
659
|
+
content: deletionsContentEl,
|
|
660
|
+
gutter: deletionsGutterEl
|
|
661
|
+
};
|
|
425
662
|
if (codeElement === void 0 || contentEl === void 0) {
|
|
426
663
|
this.#replacementFocusRequest = void 0;
|
|
427
664
|
return;
|
|
@@ -434,45 +671,45 @@ var Editor = class {
|
|
|
434
671
|
if (this.#themeStyleElement !== void 0) shadowRoot.appendChild(this.#themeStyleElement);
|
|
435
672
|
if (this.#spriteElement !== void 0) shadowRoot.prepend(this.#spriteElement);
|
|
436
673
|
}
|
|
437
|
-
const
|
|
438
|
-
const
|
|
439
|
-
|
|
440
|
-
|
|
674
|
+
const languageId = fileOrDiff.lang ?? getFiletypeFromFileName(fileOrDiff.name);
|
|
675
|
+
const contents = "contents" in fileOrDiff ? fileOrDiff.contents : fileOrDiff.additionLines.join("");
|
|
676
|
+
const previousTextDocument = editSession.document;
|
|
677
|
+
const resetHistory = props.resetHistory ?? (previousTextDocument != null && editSession.fileInfo != null && (editSession.fileInfo.name !== fileOrDiff.name || previousTextDocument.languageId !== languageId));
|
|
678
|
+
const documentChanges = externalDocument && previousTextDocument !== void 0 && previousTextDocument.getText() !== contents ? [createFullDocumentChange(previousTextDocument.getText(), contents)] : void 0;
|
|
679
|
+
const resetForExternalDocument = externalDocument && resetHistory;
|
|
680
|
+
if (editSession.document == null || editSession.fileInfo == null || editStateKey == null && (editSession.fileInfo.name !== fileOrDiff.name || editSession.document.languageId !== languageId) || resetForExternalDocument) {
|
|
681
|
+
this.#cancelEditPrediction(true);
|
|
682
|
+
this.#editPredictionHistory = [];
|
|
441
683
|
this.#invalidateOnAttach();
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
const textDocument = reusableTextDocument ?? new TextDocument(fileOrDiff.name, contents, languageId, 0, editStack);
|
|
451
|
-
this.#fileInfo = {
|
|
684
|
+
const { name, lang } = fileOrDiff;
|
|
685
|
+
let textDocument = resetForExternalDocument || editStateKey == null && editSession.fileInfo != null ? void 0 : editSession.document;
|
|
686
|
+
if (previousTextDocument != null && textDocument == null) editSession.editor = void 0;
|
|
687
|
+
if (textDocument == null) {
|
|
688
|
+
const editStack = new EditStack({ maxEntries: this.#options.historyMaxEntries });
|
|
689
|
+
textDocument = new TextDocument(fileOrDiff.name, contents, languageId, 0, editStack);
|
|
690
|
+
}
|
|
691
|
+
editSession.fileInfo = {
|
|
452
692
|
name,
|
|
453
|
-
lang
|
|
454
|
-
cacheKey
|
|
693
|
+
lang
|
|
455
694
|
};
|
|
456
|
-
|
|
457
|
-
if (
|
|
458
|
-
this.#textDocumentCache.set(persistedCacheKey, textDocument);
|
|
459
|
-
persistedStateTarget = {
|
|
460
|
-
cacheKey: persistedCacheKey,
|
|
461
|
-
textDocument
|
|
462
|
-
};
|
|
463
|
-
}
|
|
695
|
+
editSession.document = textDocument;
|
|
696
|
+
if (resetForExternalDocument) editSession.diffSession = void 0;
|
|
464
697
|
this.#tokenizer?.cleanUp();
|
|
465
698
|
this.#tokenizer = void 0;
|
|
466
699
|
this.#resetState();
|
|
467
700
|
this.#wrapLineOffsetsCache.clear();
|
|
468
701
|
this.#selections = this.#initSelections;
|
|
469
|
-
if (this.#options.__debug === true) console.log(
|
|
702
|
+
if (this.#options.__debug === true) console.log("[diffs/editor] text document initialized from", fileOrDiff.name);
|
|
470
703
|
}
|
|
471
|
-
if (
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
704
|
+
if (externalDocument && !resetForExternalDocument) {
|
|
705
|
+
this.#applyExternalDocumentReplacement(editSession, contents, lineAnnotations);
|
|
706
|
+
const { name, lang } = fileOrDiff;
|
|
707
|
+
editSession.fileInfo = {
|
|
708
|
+
name,
|
|
709
|
+
lang
|
|
710
|
+
};
|
|
711
|
+
}
|
|
712
|
+
const textDocument = editSession.document;
|
|
476
713
|
if (this.#tokenizer == null && textDocument != null) this.#tokenizer = new EditorTokenizer({
|
|
477
714
|
highlighter,
|
|
478
715
|
textDocument,
|
|
@@ -516,178 +753,87 @@ var Editor = class {
|
|
|
516
753
|
this.#renderRange = renderRange;
|
|
517
754
|
this.#viewportWindowLines = renderRange?.totalLines;
|
|
518
755
|
this.#tokenizer?.prebuildStateStack(renderRange);
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
if (this.#initSelections !== void 0 && this.#primaryCaretElement !== void 0) {
|
|
522
|
-
this.#initSelections = void 0;
|
|
523
|
-
this.#scrollToPrimaryCaret(false, "center");
|
|
524
|
-
} else if (this.#scrollingToLine !== void 0) this.#scrollToLine(this.#scrollingToLine, this.#scrollingToLineChar, this.#scrollingToLineNoFocus);
|
|
525
|
-
else if (this.#replacementFocusRequest !== void 0) this.#restoreReplacementFocus();
|
|
526
|
-
else if (this.#selections !== void 0 && this.#selections.length > 0 && this.#contentHasFocus && !this.#retainSearchPanelFocus) this.focus({ preventScroll: true });
|
|
527
|
-
if (this.#retainSearchPanelFocus) this.#searchPanel?.focus();
|
|
528
|
-
if (this.#options.__debug === true && renderRange !== void 0) {
|
|
529
|
-
const { startingLine, totalLines } = renderRange;
|
|
530
|
-
console.log("[diffs/editor] render file:", fileOrDiff.name, "RenderRange:", startingLine + "-" + (startingLine + totalLines), "of", this.#textDocument?.lineCount, "lines");
|
|
531
|
-
}
|
|
532
|
-
if (persistedStateTarget !== void 0) {
|
|
533
|
-
this.#restoreStateOnNextSync = false;
|
|
534
|
-
this.#restorePersistedState(persistedStateTarget.cacheKey, persistedStateTarget.textDocument);
|
|
535
|
-
}
|
|
536
|
-
this.#scheduleOnAttach(fileInstance);
|
|
537
|
-
};
|
|
538
|
-
#getCachedTextDocument(file, cacheKey) {
|
|
539
|
-
const textDocument = this.#textDocumentCache.get(cacheKey);
|
|
540
|
-
const languageId = file.lang ?? getFiletypeFromFileName(file.name);
|
|
541
|
-
return textDocument?.languageId === languageId ? textDocument : void 0;
|
|
542
|
-
}
|
|
543
|
-
#getStateStorage() {
|
|
544
|
-
const option = this.#options.persistStateStorage ?? "inMemory";
|
|
545
|
-
if (this.#stateStorage === void 0 || this.#stateStorageOption !== option) {
|
|
546
|
-
this.#stateStorage = createStateStorage(option);
|
|
547
|
-
this.#stateStorageOption = option;
|
|
548
|
-
}
|
|
549
|
-
return this.#stateStorage;
|
|
550
|
-
}
|
|
551
|
-
#persistCurrentState() {
|
|
552
|
-
const fileInfo = this.#fileInfo;
|
|
553
|
-
const textDocument = this.#textDocument;
|
|
554
|
-
if (this.#options.persistState !== true || this.#fileInstance === void 0 || fileInfo === void 0 || textDocument === void 0) return;
|
|
555
|
-
const cacheKey = requirePersistedCacheKey(fileInfo);
|
|
556
|
-
this.#textDocumentCache.set(cacheKey, textDocument);
|
|
557
|
-
let storage;
|
|
756
|
+
const retainedEditorState = editSession.editor;
|
|
757
|
+
const restoreEditorStateOnSync = this.#restoreEditorStateOnSync;
|
|
558
758
|
try {
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
this.#
|
|
567
|
-
if (
|
|
568
|
-
this.#
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
#writeState(storage, cacheKey, state, waitFor) {
|
|
574
|
-
const previousWrite = this.#pendingStateWrites.get(cacheKey);
|
|
575
|
-
if (waitFor !== void 0 || previousWrite !== void 0) {
|
|
576
|
-
let pending = waitFor ?? Promise.resolve();
|
|
577
|
-
if (previousWrite !== void 0) pending = pending.then(() => previousWrite);
|
|
578
|
-
this.#trackStateWrite(cacheKey, pending.then(() => storage.set(cacheKey, state)));
|
|
579
|
-
return;
|
|
580
|
-
}
|
|
581
|
-
let result;
|
|
582
|
-
try {
|
|
583
|
-
result = storage.set(cacheKey, state);
|
|
584
|
-
} catch {
|
|
585
|
-
return;
|
|
586
|
-
}
|
|
587
|
-
if (!isPromise(result)) return;
|
|
588
|
-
this.#trackStateWrite(cacheKey, result);
|
|
589
|
-
}
|
|
590
|
-
#trackStateWrite(cacheKey, result) {
|
|
591
|
-
const pending = result.catch(() => {});
|
|
592
|
-
this.#pendingStateWrites.set(cacheKey, pending);
|
|
593
|
-
pending.finally(() => {
|
|
594
|
-
if (this.#pendingStateWrites.get(cacheKey) === pending) this.#pendingStateWrites.delete(cacheKey);
|
|
595
|
-
});
|
|
596
|
-
}
|
|
597
|
-
#restorePersistedState(cacheKey, textDocument) {
|
|
598
|
-
const generation = ++this.#stateRestoreGeneration;
|
|
599
|
-
const documentVersion = textDocument.version;
|
|
600
|
-
const selections = this.#selections;
|
|
601
|
-
const view = this.getState().view;
|
|
602
|
-
let inputWatch;
|
|
603
|
-
const applyState = (state) => {
|
|
604
|
-
const currentView = this.getState().view;
|
|
605
|
-
if (generation !== this.#stateRestoreGeneration || this.#textDocument !== textDocument || textDocument.version !== documentVersion || this.#selections !== selections || currentView?.scrollLeft !== view?.scrollLeft || this.#fileInfo === void 0 || requirePersistedCacheKey(this.#fileInfo) !== cacheKey) return;
|
|
606
|
-
const userScrolled = inputWatch?.userScrolled() === true;
|
|
607
|
-
if (state === void 0) {
|
|
608
|
-
this.#fileInstance?.setCodeScrollLeft(0);
|
|
609
|
-
if (!userScrolled) this.#setViewportScrollTop(0);
|
|
610
|
-
return;
|
|
759
|
+
this.#markerRenderer?.removePopover();
|
|
760
|
+
if (this.#selections !== void 0 || this.#matches !== void 0 || this.#markerRenderer !== void 0) this.#updateSelections(this.#selections ?? []);
|
|
761
|
+
this.#renderCarets();
|
|
762
|
+
if (this.#retryEditPredictionOnRender) this.#scheduleEditPrediction();
|
|
763
|
+
if (this.#initSelections !== void 0 && this.#primaryCaretElement !== void 0) {
|
|
764
|
+
this.#initSelections = void 0;
|
|
765
|
+
this.#scrollToPrimaryCaret(false, "center");
|
|
766
|
+
} else if (this.#scrollingToLine !== void 0) this.#scrollToLine(this.#scrollingToLine, this.#scrollingToLineChar, this.#scrollingToLineNoFocus);
|
|
767
|
+
else if (this.#replacementFocusRequest !== void 0) this.#restoreReplacementFocus();
|
|
768
|
+
else if (this.#selections !== void 0 && this.#selections.length > 0 && this.#contentHasFocus && !this.#retainSearchPanelFocus) this.focus({ preventScroll: true });
|
|
769
|
+
if (this.#retainSearchPanelFocus) this.#searchPanel?.focus();
|
|
770
|
+
if (restoreEditorStateOnSync) {
|
|
771
|
+
this.#restoreEditorStateOnSync = false;
|
|
772
|
+
if (retainedEditorState !== void 0) this.setViewState(retainedEditorState);
|
|
611
773
|
}
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
};
|
|
616
|
-
const readState = () => {
|
|
617
|
-
let result;
|
|
618
|
-
try {
|
|
619
|
-
result = this.#getStateStorage().get(cacheKey);
|
|
620
|
-
} catch {
|
|
621
|
-
return;
|
|
774
|
+
if (this.#options.__debug === true && renderRange !== void 0) {
|
|
775
|
+
const { startingLine, totalLines } = renderRange;
|
|
776
|
+
console.log("[diffs/editor] render file:", fileOrDiff.name, "RenderRange:", startingLine + "-" + (startingLine + totalLines), "of", editSession.document?.lineCount, "lines");
|
|
622
777
|
}
|
|
623
|
-
if (
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
778
|
+
if (externalDocument) fileInstance.__acknowledgeDocumentUpdate();
|
|
779
|
+
this.#checkpointEditSessionState();
|
|
780
|
+
} catch (error) {
|
|
781
|
+
this.#restoreEditorStateOnSync = restoreEditorStateOnSync;
|
|
782
|
+
editSession.editor = retainedEditorState;
|
|
783
|
+
throw error;
|
|
784
|
+
}
|
|
785
|
+
if (documentChanges != null) this.#emitChange(documentChanges, lineAnnotations);
|
|
786
|
+
this.#scheduleOnAttach(fileInstance);
|
|
787
|
+
}
|
|
788
|
+
#applyExternalDocumentReplacement(editSession, contents, lineAnnotations) {
|
|
789
|
+
const textDocument = editSession.document;
|
|
790
|
+
if (textDocument == null || textDocument.getText() === contents) return;
|
|
791
|
+
const selections = this.#selections;
|
|
792
|
+
const selectionOffsets = selections?.map((selection) => [textDocument.offsetAt(selection.start), textDocument.offsetAt(selection.end)]);
|
|
793
|
+
const replacement = {
|
|
794
|
+
start: 0,
|
|
795
|
+
end: textDocument.getText().length,
|
|
796
|
+
text: contents
|
|
627
797
|
};
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
cacheKey,
|
|
634
|
-
textDocument,
|
|
635
|
-
documentVersion,
|
|
636
|
-
selections,
|
|
637
|
-
view,
|
|
638
|
-
completion: result.catch(() => {})
|
|
639
|
-
};
|
|
640
|
-
this.#pendingStateRestore = pendingRestore;
|
|
641
|
-
pendingRestore.completion.finally(() => {
|
|
642
|
-
inputWatch?.dispose();
|
|
643
|
-
if (this.#pendingStateRestore === pendingRestore) this.#pendingStateRestore = void 0;
|
|
644
|
-
});
|
|
798
|
+
if (textDocument.applyResolvedEdits([replacement], true, selections, void 0, true) == null) return;
|
|
799
|
+
if (selections != null && selectionOffsets != null) {
|
|
800
|
+
const nextSelections = remapSelectionsAfterEdits(textDocument, selections, selectionOffsets, [replacement]);
|
|
801
|
+
textDocument.setLastUndoSelectionsAfter(nextSelections);
|
|
802
|
+
this.#selections = nextSelections;
|
|
645
803
|
}
|
|
804
|
+
if (this.#lineAnnotations != null || lineAnnotations != null) textDocument.setLastUndoLineAnnotations(this.#lineAnnotations ?? [], lineAnnotations ?? []);
|
|
805
|
+
this.#tokenizer?.cleanUp();
|
|
806
|
+
this.#tokenizer = void 0;
|
|
807
|
+
this.#resetCache();
|
|
808
|
+
this.#wrapLineOffsetsCache.clear();
|
|
809
|
+
this.#markerRenderer?.removePopover();
|
|
810
|
+
if (this.#searchPanel !== void 0 && this.#matches !== void 0) this.#searchPanel.updateMatches({ syncSelection: false });
|
|
646
811
|
}
|
|
647
|
-
#
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
"wheel",
|
|
653
|
-
"touchstart",
|
|
654
|
-
"mousedown"
|
|
655
|
-
];
|
|
656
|
-
const dispose = () => {
|
|
657
|
-
for (const type of eventTypes) viewport.removeEventListener(type, onInput, { capture: true });
|
|
658
|
-
};
|
|
659
|
-
const onInput = () => {
|
|
660
|
-
scrolled = true;
|
|
661
|
-
dispose();
|
|
662
|
-
};
|
|
663
|
-
for (const type of eventTypes) viewport.addEventListener(type, onInput, {
|
|
664
|
-
capture: true,
|
|
665
|
-
passive: true
|
|
666
|
-
});
|
|
667
|
-
return {
|
|
668
|
-
userScrolled: () => scrolled,
|
|
669
|
-
dispose
|
|
670
|
-
};
|
|
812
|
+
get #fileDiffInstance() {
|
|
813
|
+
return this.#fileInstance?.type === "file-diff" ? this.#fileInstance : void 0;
|
|
814
|
+
}
|
|
815
|
+
get #virtualizedInstance() {
|
|
816
|
+
return isVirtualizedEditorComponent(this.#fileInstance) ? this.#fileInstance : void 0;
|
|
671
817
|
}
|
|
672
818
|
#isLineRenderable(line) {
|
|
673
|
-
return this.#
|
|
819
|
+
return this.#fileDiffInstance?.isLineRenderable?.(line + 1) ?? true;
|
|
674
820
|
}
|
|
675
821
|
get #resolveRenderableLine() {
|
|
676
|
-
const fileInstance = this.#
|
|
677
|
-
if (fileInstance
|
|
822
|
+
const fileInstance = this.#fileDiffInstance;
|
|
823
|
+
if (fileInstance == null) return;
|
|
678
824
|
return (line, direction) => {
|
|
679
825
|
const nearest = fileInstance.getNearestRenderableLine(line + 1, direction);
|
|
680
826
|
return nearest == null ? void 0 : nearest - 1;
|
|
681
827
|
};
|
|
682
828
|
}
|
|
683
829
|
#revealLineIfCollapsed(line) {
|
|
684
|
-
if (!this.#isLineRenderable(line)) this.#
|
|
830
|
+
if (!this.#isLineRenderable(line)) this.#fileDiffInstance?.revealLine?.(line + 1);
|
|
685
831
|
}
|
|
686
832
|
get #diffSyle() {
|
|
687
|
-
return this.#
|
|
833
|
+
return this.#fileDiffInstance?.options.diffStyle ?? "split";
|
|
688
834
|
}
|
|
689
835
|
get #isDiff() {
|
|
690
|
-
return this
|
|
836
|
+
return this.type === "file-diff";
|
|
691
837
|
}
|
|
692
838
|
get #isWrap() {
|
|
693
839
|
return this.#fileInstance?.options.overflow === "wrap";
|
|
@@ -706,7 +852,7 @@ var Editor = class {
|
|
|
706
852
|
this.#lineElementsCache.clear();
|
|
707
853
|
this.#lastAccessedCharX = void 0;
|
|
708
854
|
}
|
|
709
|
-
#resetState() {
|
|
855
|
+
#resetState(preserveCarets = false) {
|
|
710
856
|
this.#setEditorActiveLineSafe(null);
|
|
711
857
|
this.#gutterWidthCache = void 0;
|
|
712
858
|
this.#contentWidthCache = void 0;
|
|
@@ -714,6 +860,11 @@ var Editor = class {
|
|
|
714
860
|
this.#suppressNativeSelectionSync = false;
|
|
715
861
|
this.#overlayElements?.forEach((el) => el.remove());
|
|
716
862
|
this.#overlayElements = void 0;
|
|
863
|
+
this.#caretElements?.forEach((element) => element.remove());
|
|
864
|
+
this.#caretElements = void 0;
|
|
865
|
+
this.#caretHighlightElements?.forEach((element) => element.remove());
|
|
866
|
+
this.#caretHighlightElements = void 0;
|
|
867
|
+
if (!preserveCarets) this.#carets = void 0;
|
|
717
868
|
this.#selections = void 0;
|
|
718
869
|
this.#scrollingToLine = void 0;
|
|
719
870
|
this.#markerRenderer?.cleanup();
|
|
@@ -734,13 +885,13 @@ var Editor = class {
|
|
|
734
885
|
}
|
|
735
886
|
#scheduleOnAttach(fileInstance) {
|
|
736
887
|
const attachState = this.#attachState;
|
|
737
|
-
const textDocument = this.#
|
|
888
|
+
const textDocument = this.#editSession?.document;
|
|
738
889
|
if (attachState.delivered || attachState.callback != null || textDocument == null) return;
|
|
739
890
|
const { generation } = attachState;
|
|
740
891
|
const callback = () => {
|
|
741
892
|
if (attachState.callback !== callback) return;
|
|
742
893
|
attachState.callback = void 0;
|
|
743
|
-
if (generation !== attachState.generation || this.#fileInstance !== fileInstance || this.#
|
|
894
|
+
if (generation !== attachState.generation || this.#fileInstance !== fileInstance || this.#editSession?.document !== textDocument) return;
|
|
744
895
|
const contentElement = this.#contentElement;
|
|
745
896
|
const shadowRoot = this.#fileContainer?.shadowRoot;
|
|
746
897
|
if (contentElement == null || shadowRoot == null || !shadowRoot.contains(contentElement)) return;
|
|
@@ -751,21 +902,16 @@ var Editor = class {
|
|
|
751
902
|
queueRender(callback);
|
|
752
903
|
}
|
|
753
904
|
#getScrollViewport() {
|
|
754
|
-
const viewport = this.#
|
|
755
|
-
if (viewport
|
|
905
|
+
const viewport = this.#virtualizedInstance?.getEditorViewport?.();
|
|
906
|
+
if (viewport != null) return viewport;
|
|
756
907
|
const fileContainer = this.#fileContainer;
|
|
757
908
|
if (this.#fileInstance == null || fileContainer == null) return;
|
|
758
909
|
return lookupScrollContainer(fileContainer);
|
|
759
910
|
}
|
|
760
|
-
#
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
}
|
|
765
|
-
#setViewportScrollTop(scrollTop) {
|
|
766
|
-
const viewport = this.#getScrollViewport();
|
|
767
|
-
if (viewport instanceof HTMLElement) viewport.scrollTop = scrollTop;
|
|
768
|
-
else if (viewport instanceof Document) viewport.defaultView?.scrollTo({ top: scrollTop });
|
|
911
|
+
#getOwnedVerticalViewport() {
|
|
912
|
+
if (!this.#ownsVerticalViewport) return;
|
|
913
|
+
const viewport = this.#virtualizedInstance?.getEditorViewport?.();
|
|
914
|
+
if (viewport instanceof HTMLElement) return viewport;
|
|
769
915
|
}
|
|
770
916
|
#initialize() {
|
|
771
917
|
this.#globalStyleElement = h("style", {
|
|
@@ -817,7 +963,9 @@ var Editor = class {
|
|
|
817
963
|
if (this.#selections !== void 0 && this.#selections.length > 1 && !this.#isContentMouseDown) return;
|
|
818
964
|
const selectionRaw = document.getSelection();
|
|
819
965
|
if (selectionRaw == null) return;
|
|
820
|
-
|
|
966
|
+
let composedRange;
|
|
967
|
+
if (typeof selectionRaw.getComposedRanges === "function") composedRange = selectionRaw.getComposedRanges({ shadowRoots: [shadowRoot] })?.[0];
|
|
968
|
+
else composedRange = getShadowRootRange(shadowRoot);
|
|
821
969
|
if (composedRange === void 0 || !this.#rangeBelongsToEditor(composedRange)) return;
|
|
822
970
|
let selection = convertSelection(composedRange, 0);
|
|
823
971
|
if (selection === void 0) return;
|
|
@@ -826,9 +974,10 @@ var Editor = class {
|
|
|
826
974
|
this.#updateSelections([extendSelection(primarySelection, selection)]);
|
|
827
975
|
return;
|
|
828
976
|
}
|
|
829
|
-
if (this.#isContentMouseDown)
|
|
830
|
-
|
|
831
|
-
|
|
977
|
+
if (this.#isContentMouseDown) {
|
|
978
|
+
if (this.#selectionStart !== void 0) selection = createSelectionFrom(this.#selectionStart, selection);
|
|
979
|
+
else this.#selectionStart = selection;
|
|
980
|
+
} else if (this.#selectionStart !== void 0) selection.direction = createSelectionFrom(this.#selectionStart, selection).direction;
|
|
832
981
|
else if (this.#selections !== void 0 && this.#selections.length === 1) {
|
|
833
982
|
const previous = this.#selections[0];
|
|
834
983
|
if (comparePosition(previous.start, selection.start) === 0 && comparePosition(previous.end, selection.end) === 0) selection.direction = previous.direction;
|
|
@@ -844,6 +993,10 @@ var Editor = class {
|
|
|
844
993
|
addEventListener(document, "pointercancel", finishMouseSelection, { passive: true }),
|
|
845
994
|
addEventListener(document, "keydown", (e) => {
|
|
846
995
|
if (e.key === "Shift") this.#selectionStart = this.#selections?.at(-1);
|
|
996
|
+
else if (e.key === "Alt" && !e.repeat && this.#contentHasFocus && this.#options.editPrediction?.mode === "subtle") {
|
|
997
|
+
this.#editPredictionRevealed = !this.#editPredictionRevealed;
|
|
998
|
+
this.#updateSelections(this.#selections ?? []);
|
|
999
|
+
}
|
|
847
1000
|
}, { passive: true }),
|
|
848
1001
|
addEventListener(document, "keyup", (e) => {
|
|
849
1002
|
if (e.key === "Shift") this.#selectionStart = void 0;
|
|
@@ -955,6 +1108,16 @@ var Editor = class {
|
|
|
955
1108
|
this.#canMountSelectionAction = true;
|
|
956
1109
|
this.#suppressNativeSelectionSync = false;
|
|
957
1110
|
if (e.isComposing || e.keyCode === 229) return;
|
|
1111
|
+
if (e.key === "Tab" && !e.shiftKey && !e.ctrlKey && !e.metaKey && !e.isComposing && !this.#isComposing && (!e.altKey || this.#options.editPrediction?.mode === "subtle") && this.#editPrediction?.rendered === true) {
|
|
1112
|
+
this.#acceptEditPrediction();
|
|
1113
|
+
e.preventDefault();
|
|
1114
|
+
return;
|
|
1115
|
+
}
|
|
1116
|
+
if (e.key === "Escape" && this.#editPrediction !== void 0) {
|
|
1117
|
+
this.#cancelEditPrediction(true);
|
|
1118
|
+
e.preventDefault();
|
|
1119
|
+
return;
|
|
1120
|
+
}
|
|
958
1121
|
const command = resolveEditorCommandFromKeyboardEvent(e, this.#options.keymap);
|
|
959
1122
|
if (command !== void 0) {
|
|
960
1123
|
e.preventDefault();
|
|
@@ -969,7 +1132,7 @@ var Editor = class {
|
|
|
969
1132
|
return;
|
|
970
1133
|
}
|
|
971
1134
|
const mvShortcut = isMoveCursorShortcut(e);
|
|
972
|
-
const textDocument = this.#
|
|
1135
|
+
const textDocument = this.#editSession?.document;
|
|
973
1136
|
if (this.#selections !== void 0 && this.#selections.length > 0 && mvShortcut !== void 0 && textDocument !== void 0) {
|
|
974
1137
|
const cursorMoveOptions = {
|
|
975
1138
|
getSoftLineOffsets: this.#isWrap ? (line) => this.#wrapLineTextOrWholeLine(line) : void 0,
|
|
@@ -1020,7 +1183,7 @@ var Editor = class {
|
|
|
1020
1183
|
if (!targetIsContentElement(e)) return;
|
|
1021
1184
|
e.preventDefault();
|
|
1022
1185
|
const clipboardData = e.clipboardData;
|
|
1023
|
-
const textDocument = this.#
|
|
1186
|
+
const textDocument = this.#editSession?.document;
|
|
1024
1187
|
if (clipboardData === null || textDocument === void 0) return;
|
|
1025
1188
|
let text = clipboardData.getData("text");
|
|
1026
1189
|
const selectionCount = this.#selections?.length ?? 0;
|
|
@@ -1035,7 +1198,10 @@ var Editor = class {
|
|
|
1035
1198
|
}),
|
|
1036
1199
|
addEventListener(contentEl, "beforeinput", (e) => {
|
|
1037
1200
|
if (!targetIsContentElement(e)) return;
|
|
1038
|
-
if (e.inputType === "insertCompositionText")
|
|
1201
|
+
if (e.inputType === "insertCompositionText") {
|
|
1202
|
+
this.#cancelEditPrediction(true);
|
|
1203
|
+
return;
|
|
1204
|
+
}
|
|
1039
1205
|
e.preventDefault();
|
|
1040
1206
|
this.#handleInput(e.inputType, e.data);
|
|
1041
1207
|
}),
|
|
@@ -1045,6 +1211,7 @@ var Editor = class {
|
|
|
1045
1211
|
}),
|
|
1046
1212
|
addEventListener(contentEl, "compositionstart", (e) => {
|
|
1047
1213
|
if (!targetIsContentElement(e)) return;
|
|
1214
|
+
this.#cancelEditPrediction(true);
|
|
1048
1215
|
this.#isComposing = true;
|
|
1049
1216
|
this.#shouldIgnoreSelectionChange = true;
|
|
1050
1217
|
}, { passive: true }),
|
|
@@ -1106,7 +1273,7 @@ var Editor = class {
|
|
|
1106
1273
|
return;
|
|
1107
1274
|
}
|
|
1108
1275
|
if (e.pointerType !== "mouse") return;
|
|
1109
|
-
const textDocument = this.#
|
|
1276
|
+
const textDocument = this.#editSession?.document;
|
|
1110
1277
|
const lineIndex = resolveEditableLine(gutterRow);
|
|
1111
1278
|
if (lineIndex === void 0 || textDocument === void 0) return;
|
|
1112
1279
|
this.#canMountSelectionAction = true;
|
|
@@ -1119,7 +1286,7 @@ var Editor = class {
|
|
|
1119
1286
|
this.#focus();
|
|
1120
1287
|
this.#replaceSelectEventListeners([addEventListener(document, "mousemove", (e) => {
|
|
1121
1288
|
if (!this.#isGutterMouseDown) return;
|
|
1122
|
-
const textDocument = this.#
|
|
1289
|
+
const textDocument = this.#editSession?.document;
|
|
1123
1290
|
const lineIndex = resolveEditableLine(resolveGutterTarget(e.composedPath()[0], true));
|
|
1124
1291
|
if (lineIndex === void 0 || textDocument === void 0) return;
|
|
1125
1292
|
const anchorLine = this.#selectionStart?.start.line ?? lineIndex;
|
|
@@ -1149,14 +1316,14 @@ var Editor = class {
|
|
|
1149
1316
|
if (Array.isArray(selectionTexts) && selectionTexts.length === selectionCount) text = selectionTexts;
|
|
1150
1317
|
} catch {}
|
|
1151
1318
|
}
|
|
1152
|
-
const textDocument = this.#
|
|
1153
|
-
if (textDocument
|
|
1319
|
+
const textDocument = this.#editSession?.document;
|
|
1320
|
+
if (textDocument != null) this.#replaceSelectionText(Array.isArray(text) ? text.map((t) => textDocument.normalizeEol(t)) : textDocument.normalizeEol(text), void 0, true, "document");
|
|
1154
1321
|
}
|
|
1155
1322
|
};
|
|
1156
1323
|
#computeContentOffset(contentEl) {
|
|
1157
1324
|
if (this.#isDiff && this.#diffSyle === "split" && this.#isWrap) {
|
|
1158
1325
|
this.#contentOffset = {
|
|
1159
|
-
top: contentEl.offsetTop,
|
|
1326
|
+
top: contentEl.offsetTop - this.#metrics.paddingTop,
|
|
1160
1327
|
left: contentEl.offsetLeft - this.#getGutterWidth()
|
|
1161
1328
|
};
|
|
1162
1329
|
if (this.#options.__debug === true) console.log("[diffs/editor] content offset:", this.#contentOffset);
|
|
@@ -1166,8 +1333,8 @@ var Editor = class {
|
|
|
1166
1333
|
if (this.#isDiff && this.#diffSyle === "split" && this.#isWrap) return this.#contentOffset;
|
|
1167
1334
|
}
|
|
1168
1335
|
#runCommand(command) {
|
|
1169
|
-
const textDocument = this.#
|
|
1170
|
-
if (textDocument
|
|
1336
|
+
const textDocument = this.#editSession?.document;
|
|
1337
|
+
if (textDocument == null) return;
|
|
1171
1338
|
switch (command) {
|
|
1172
1339
|
case "openSearchPanel":
|
|
1173
1340
|
this.#openSearchPanel("find");
|
|
@@ -1361,14 +1528,12 @@ var Editor = class {
|
|
|
1361
1528
|
}
|
|
1362
1529
|
break;
|
|
1363
1530
|
case "undo":
|
|
1364
|
-
case "redo":
|
|
1365
|
-
this.#applyHistoryChange(command);
|
|
1366
|
-
break;
|
|
1531
|
+
case "redo": this.#applyHistoryChange(command);
|
|
1367
1532
|
}
|
|
1368
1533
|
}
|
|
1369
1534
|
#applyHistoryChange(command) {
|
|
1370
|
-
const textDocument = this.#
|
|
1371
|
-
if (textDocument
|
|
1535
|
+
const textDocument = this.#editSession?.document;
|
|
1536
|
+
if (textDocument == null) return;
|
|
1372
1537
|
if (command === "undo" && !textDocument.canUndo || command === "redo" && !textDocument.canRedo) return;
|
|
1373
1538
|
const selections = this.#selections;
|
|
1374
1539
|
const selectionOffsets = selections?.map((selection) => [textDocument.offsetAt(selection.start), textDocument.offsetAt(selection.end)]);
|
|
@@ -1376,11 +1541,12 @@ var Editor = class {
|
|
|
1376
1541
|
if (result === void 0) return;
|
|
1377
1542
|
const [change, recordedSelections, lineAnnotations, selectionEdits] = result;
|
|
1378
1543
|
const nextSelections = recordedSelections ?? (selections !== void 0 && selectionOffsets !== void 0 && selectionEdits !== void 0 ? remapSelectionsAfterEdits(textDocument, selections, selectionOffsets, selectionEdits) : void 0);
|
|
1379
|
-
this.#
|
|
1544
|
+
const replayedLineAnnotations = lineAnnotations ?? (this.#lineAnnotations != null ? applyDocumentChangeToLineAnnotations(change, this.#lineAnnotations) : void 0);
|
|
1545
|
+
this.#applyChange(change, nextSelections, replayedLineAnnotations);
|
|
1380
1546
|
}
|
|
1381
1547
|
/** Applies one undoable command batch and records its resulting selections. */
|
|
1382
1548
|
#applyCommandEdits(edits, resolveNextSelections) {
|
|
1383
|
-
const textDocument = this.#
|
|
1549
|
+
const textDocument = this.#editSession?.document;
|
|
1384
1550
|
const selections = this.#selections;
|
|
1385
1551
|
if (textDocument === void 0 || selections === void 0) return;
|
|
1386
1552
|
const remapSelections = resolveNextSelections === void 0;
|
|
@@ -1405,7 +1571,7 @@ var Editor = class {
|
|
|
1405
1571
|
}
|
|
1406
1572
|
/** Copies selected line blocks and keeps the selection in the requested copy. */
|
|
1407
1573
|
#copySelectedLines(direction) {
|
|
1408
|
-
const textDocument = this.#
|
|
1574
|
+
const textDocument = this.#editSession?.document;
|
|
1409
1575
|
const selections = this.#selections;
|
|
1410
1576
|
if (textDocument === void 0 || selections === void 0) return;
|
|
1411
1577
|
const blocks = getSelectedLineBlocks(selections);
|
|
@@ -1498,7 +1664,7 @@ var Editor = class {
|
|
|
1498
1664
|
}
|
|
1499
1665
|
/** Inserts an indented blank line after each selection's final line. */
|
|
1500
1666
|
#insertBlankLine() {
|
|
1501
|
-
const textDocument = this.#
|
|
1667
|
+
const textDocument = this.#editSession?.document;
|
|
1502
1668
|
const selections = this.#selections;
|
|
1503
1669
|
if (textDocument === void 0 || selections === void 0) return;
|
|
1504
1670
|
const selectionLines = selections.map((selection) => getCaretPosition(selection).line);
|
|
@@ -1539,7 +1705,7 @@ var Editor = class {
|
|
|
1539
1705
|
this.#applyCommandEdits(edits, () => nextSelections);
|
|
1540
1706
|
}
|
|
1541
1707
|
#moveSelectedLines(direction) {
|
|
1542
|
-
const textDocument = this.#
|
|
1708
|
+
const textDocument = this.#editSession?.document;
|
|
1543
1709
|
const selections = this.#selections;
|
|
1544
1710
|
if (textDocument === void 0 || selections === void 0) return;
|
|
1545
1711
|
const blocks = getSelectedLineBlocks(selections);
|
|
@@ -1616,6 +1782,7 @@ var Editor = class {
|
|
|
1616
1782
|
}
|
|
1617
1783
|
this.#markerRenderer?.removePopover();
|
|
1618
1784
|
this.#computeContentOffset(this.#contentElement);
|
|
1785
|
+
this.#renderCarets();
|
|
1619
1786
|
};
|
|
1620
1787
|
#remeasureMetricsOnFontLoad() {
|
|
1621
1788
|
if (this.#fontRemeasureScheduled) return;
|
|
@@ -1629,19 +1796,21 @@ var Editor = class {
|
|
|
1629
1796
|
this.#resetCache();
|
|
1630
1797
|
this.#wrapLineOffsetsCache.clear();
|
|
1631
1798
|
if (this.#selections !== void 0 || this.#matches !== void 0 || this.#markerRenderer !== void 0) this.#updateSelections(this.#selections ?? []);
|
|
1799
|
+
this.#renderCarets();
|
|
1632
1800
|
this.#markerRenderer?.removePopover();
|
|
1633
1801
|
});
|
|
1634
1802
|
}
|
|
1635
1803
|
#rerender(change, newLineAnnotations, renderRange = this.#renderRange, shouldUpdateBuffer) {
|
|
1636
1804
|
const tokenizer = this.#tokenizer;
|
|
1637
1805
|
const fileInstance = this.#fileInstance;
|
|
1638
|
-
const
|
|
1806
|
+
const applyDocumentChange = this.#applyDocumentChange;
|
|
1807
|
+
const textDocument = this.#editSession?.document;
|
|
1639
1808
|
const gutterEl = this.#gutterElement;
|
|
1640
1809
|
const contentEl = this.#contentElement;
|
|
1641
|
-
if (tokenizer
|
|
1810
|
+
if (tokenizer == null || fileInstance == null || applyDocumentChange == null || textDocument == null || contentEl == null) return;
|
|
1642
1811
|
tokenizer.stopBackgroundTokenize();
|
|
1643
1812
|
const t = performance.now();
|
|
1644
|
-
const dirtyLines = tokenizer.tokenize(change, renderRange, !this.#isDiff &&
|
|
1813
|
+
const dirtyLines = tokenizer.tokenize(change, renderRange, !this.#isDiff && this.#virtualizedInstance != null);
|
|
1645
1814
|
const t2 = performance.now();
|
|
1646
1815
|
if (dirtyLines.size > 0) {
|
|
1647
1816
|
const children = contentEl.children;
|
|
@@ -1720,19 +1889,20 @@ var Editor = class {
|
|
|
1720
1889
|
shouldRefreshDiffsView: this.#isDiff && !didLineCountChange,
|
|
1721
1890
|
lineCountChangeInFlight: didLineCountChange
|
|
1722
1891
|
});
|
|
1723
|
-
if (didLineCountChange)
|
|
1892
|
+
if (didLineCountChange) applyDocumentChange(textDocument, newLineAnnotations, shouldUpdateBuffer);
|
|
1724
1893
|
if (didLineCountChange || this.#isDiff && this.#diffSyle === "unified") this.#resetCache();
|
|
1725
|
-
if (newLineAnnotations
|
|
1894
|
+
if (newLineAnnotations != null) {
|
|
1726
1895
|
this.#lineAnnotations = newLineAnnotations;
|
|
1727
|
-
renderLineAnnotations(newLineAnnotations, contentEl, gutterEl);
|
|
1896
|
+
if (!this.#isDiff || !didLineCountChange) renderLineAnnotations(newLineAnnotations, contentEl, gutterEl, fileInstance.getAnnotationSlotName);
|
|
1728
1897
|
}
|
|
1898
|
+
this.#renderCarets();
|
|
1729
1899
|
if (this.#options.__debug === true) console.log(`[diffs/editor] re-render in: ${round(performance.now() - t2)}ms,`, `tokenize in: ${round(t2 - t)}ms (${dirtyLines.size} dirty lines)`);
|
|
1730
1900
|
}
|
|
1731
1901
|
#handleInput(inputType, data) {
|
|
1732
1902
|
switch (inputType) {
|
|
1733
1903
|
case "insertText": {
|
|
1734
1904
|
const text = data ?? "";
|
|
1735
|
-
const textDocument = this.#
|
|
1905
|
+
const textDocument = this.#editSession?.document;
|
|
1736
1906
|
const selections = this.#selections;
|
|
1737
1907
|
const autoSurroundTexts = textDocument !== void 0 && selections !== void 0 ? getAutoSurroundReplacementTexts(textDocument, selections, text, this.#options.autoSurround) : void 0;
|
|
1738
1908
|
this.#replaceSelectionText(autoSurroundTexts ?? text);
|
|
@@ -1741,7 +1911,7 @@ var Editor = class {
|
|
|
1741
1911
|
case "insertCompositionText": break;
|
|
1742
1912
|
case "insertLineBreak":
|
|
1743
1913
|
case "insertParagraph":
|
|
1744
|
-
this.#replaceSelectionText(this.#
|
|
1914
|
+
this.#replaceSelectionText(this.#editSession?.document?.eol ?? "\n");
|
|
1745
1915
|
break;
|
|
1746
1916
|
case "deleteContentBackward":
|
|
1747
1917
|
this.#deleteSelectionText();
|
|
@@ -1759,9 +1929,7 @@ var Editor = class {
|
|
|
1759
1929
|
case "insertTranspose":
|
|
1760
1930
|
this.#insertTranspose();
|
|
1761
1931
|
break;
|
|
1762
|
-
default:
|
|
1763
|
-
console.warn(`[diffs] Unknown input type: ${inputType}`, data);
|
|
1764
|
-
break;
|
|
1932
|
+
default: console.warn(`[diffs] Unknown input type: ${inputType}`, data);
|
|
1765
1933
|
}
|
|
1766
1934
|
}
|
|
1767
1935
|
#focus(position, preventScroll = true, shouldFocus) {
|
|
@@ -1833,7 +2001,7 @@ var Editor = class {
|
|
|
1833
2001
|
#getFirstVisibleLineNumber(offset = 0) {
|
|
1834
2002
|
const contentElement = this.#contentElement;
|
|
1835
2003
|
const fileContainer = this.#fileContainer;
|
|
1836
|
-
if (this.#
|
|
2004
|
+
if (this.#editSession?.document == null || contentElement == null || fileContainer == null) return;
|
|
1837
2005
|
const viewport = this.#getScrollViewport();
|
|
1838
2006
|
if (viewport === void 0) return;
|
|
1839
2007
|
let viewportTop;
|
|
@@ -1950,7 +2118,7 @@ var Editor = class {
|
|
|
1950
2118
|
this.#scrollingToLineFixed = false;
|
|
1951
2119
|
this.#scrollingToLineNoFocus = false;
|
|
1952
2120
|
} else {
|
|
1953
|
-
const modelLinePosition = this.#
|
|
2121
|
+
const modelLinePosition = this.#virtualizedInstance?.getLinePosition?.(line + 1);
|
|
1954
2122
|
if (modelLinePosition !== void 0) {
|
|
1955
2123
|
virtualCaret.style.top = modelLinePosition.top + "px";
|
|
1956
2124
|
this.#fileContainer?.shadowRoot?.appendChild(virtualCaret);
|
|
@@ -2102,7 +2270,7 @@ var Editor = class {
|
|
|
2102
2270
|
#updateAltColumnSelections() {
|
|
2103
2271
|
const drag = this.#altColumnDrag;
|
|
2104
2272
|
const selectionStart = this.#selectionStart;
|
|
2105
|
-
const textDocument = this.#
|
|
2273
|
+
const textDocument = this.#editSession?.document;
|
|
2106
2274
|
if (drag === void 0 || drag.focusLine === void 0 || selectionStart === void 0 || textDocument === void 0) return false;
|
|
2107
2275
|
const anchor = selectionStart.direction === -1 ? selectionStart.end : selectionStart.start;
|
|
2108
2276
|
const scrollLeft = this.#contentElement?.parentElement?.scrollLeft ?? 0;
|
|
@@ -2141,8 +2309,451 @@ var Editor = class {
|
|
|
2141
2309
|
this.#updateSelections(selections);
|
|
2142
2310
|
return true;
|
|
2143
2311
|
}
|
|
2312
|
+
#removeRenderedEditPrediction() {
|
|
2313
|
+
for (const [key, element] of this.#overlayElements ?? []) if (key.startsWith("editPrediction")) {
|
|
2314
|
+
element.remove();
|
|
2315
|
+
this.#overlayElements?.delete(key);
|
|
2316
|
+
}
|
|
2317
|
+
}
|
|
2318
|
+
#composeEditPredictionGroup(textDocument, edits, startIndex) {
|
|
2319
|
+
const firstEdit = edits[startIndex];
|
|
2320
|
+
let endIndex = startIndex;
|
|
2321
|
+
let endLine = firstEdit.range.end.line;
|
|
2322
|
+
while (endIndex + 1 < edits.length && edits[endIndex + 1].range.start.line <= endLine) {
|
|
2323
|
+
endIndex++;
|
|
2324
|
+
endLine = Math.max(endLine, edits[endIndex].range.end.line);
|
|
2325
|
+
}
|
|
2326
|
+
if (endIndex === startIndex && (firstEdit.newText.length === 0 || comparePosition(firstEdit.range.start, firstEdit.range.end) === 0)) return {
|
|
2327
|
+
edit: firstEdit,
|
|
2328
|
+
endIndex
|
|
2329
|
+
};
|
|
2330
|
+
const start = firstEdit.range.start;
|
|
2331
|
+
const end = {
|
|
2332
|
+
line: endLine,
|
|
2333
|
+
character: textDocument.getLineLength(endLine)
|
|
2334
|
+
};
|
|
2335
|
+
const parts = [];
|
|
2336
|
+
let consumed = textDocument.offsetAt(start);
|
|
2337
|
+
for (let index = startIndex; index <= endIndex; index++) {
|
|
2338
|
+
const edit = edits[index];
|
|
2339
|
+
const editStart = textDocument.offsetAt(edit.range.start);
|
|
2340
|
+
const editEnd = textDocument.offsetAt(edit.range.end);
|
|
2341
|
+
parts.push(textDocument.getTextSlice(consumed, editStart), edit.newText);
|
|
2342
|
+
consumed = editEnd;
|
|
2343
|
+
}
|
|
2344
|
+
parts.push(textDocument.getTextSlice(consumed, textDocument.offsetAt(end)));
|
|
2345
|
+
return {
|
|
2346
|
+
edit: {
|
|
2347
|
+
range: {
|
|
2348
|
+
start,
|
|
2349
|
+
end
|
|
2350
|
+
},
|
|
2351
|
+
newText: parts.join("")
|
|
2352
|
+
},
|
|
2353
|
+
endIndex
|
|
2354
|
+
};
|
|
2355
|
+
}
|
|
2356
|
+
#getEditPredictionGroups() {
|
|
2357
|
+
const prediction = this.#editPrediction;
|
|
2358
|
+
const textDocument = this.#editSession?.document;
|
|
2359
|
+
if (prediction == null || textDocument == null || prediction.document !== textDocument || prediction.version !== textDocument.version || this.#options.editPrediction?.mode === "subtle" && !this.#editPredictionRevealed) return;
|
|
2360
|
+
const { edits } = prediction.response;
|
|
2361
|
+
const groups = [];
|
|
2362
|
+
let allVisible = edits.length > 0;
|
|
2363
|
+
for (let startIndex = 0; startIndex < edits.length;) {
|
|
2364
|
+
const { edit, endIndex } = this.#composeEditPredictionGroup(textDocument, edits, startIndex);
|
|
2365
|
+
for (let line = edit.range.start.line; allVisible && line <= edit.range.end.line; line++) allVisible = this.#isLineVisible(line);
|
|
2366
|
+
groups.push({
|
|
2367
|
+
edit,
|
|
2368
|
+
startIndex,
|
|
2369
|
+
endIndex
|
|
2370
|
+
});
|
|
2371
|
+
startIndex = endIndex + 1;
|
|
2372
|
+
}
|
|
2373
|
+
return {
|
|
2374
|
+
groups,
|
|
2375
|
+
allVisible
|
|
2376
|
+
};
|
|
2377
|
+
}
|
|
2378
|
+
#fillGhostTextElement(element, newText, anchorLeft, lineLeft, insertionSuffix) {
|
|
2379
|
+
if (this.#isWrap) {
|
|
2380
|
+
element.dataset.wrap = "";
|
|
2381
|
+
element.style.width = `calc(100cqw - ${lineLeft}px)`;
|
|
2382
|
+
} else {
|
|
2383
|
+
delete element.dataset.wrap;
|
|
2384
|
+
element.style.width = "max-content";
|
|
2385
|
+
}
|
|
2386
|
+
const lines = newText.split(/\r\n|\r|\n/);
|
|
2387
|
+
for (let lineIndex = 0; lineIndex < lines.length; lineIndex++) {
|
|
2388
|
+
const lineText = lines[lineIndex];
|
|
2389
|
+
const suffix = lineIndex === lines.length - 1 ? insertionSuffix : void 0;
|
|
2390
|
+
const isEmpty = lineText.length === 0 && suffix === void 0;
|
|
2391
|
+
const line = h("span", {
|
|
2392
|
+
dataset: isEmpty ? ["editPredictionLine", "empty"] : "editPredictionLine",
|
|
2393
|
+
textContent: isEmpty ? "" : lineText
|
|
2394
|
+
}, element);
|
|
2395
|
+
if (suffix !== void 0) h("span", { dataset: "editPredictionSuffix" }, line).append(suffix);
|
|
2396
|
+
if (lineIndex === 0 && anchorLeft !== lineLeft) line.style.textIndent = `${anchorLeft - lineLeft}px`;
|
|
2397
|
+
}
|
|
2398
|
+
}
|
|
2399
|
+
#cloneInsertionSuffix(group) {
|
|
2400
|
+
const prediction = this.#editPrediction;
|
|
2401
|
+
const textDocument = this.#editSession?.document;
|
|
2402
|
+
if (prediction == null || textDocument == null) return;
|
|
2403
|
+
const { edit, startIndex, endIndex } = group;
|
|
2404
|
+
const { start, end } = edit.range;
|
|
2405
|
+
if (!(comparePosition(start, end) === 0 && start.character < textDocument.getLineLength(start.line)) || prediction.response.edits[startIndex - 1]?.range.end.line === start.line || prediction.response.edits[endIndex + 1]?.range.start.line === start.line) return;
|
|
2406
|
+
const sourceLine = this.#getLineElement(start.line);
|
|
2407
|
+
if (sourceLine === void 0) return document.createTextNode(textDocument.getLineText(start.line).slice(start.character));
|
|
2408
|
+
const [suffixNode, suffixOffset] = getSelectionAnchor(sourceLine, start.character);
|
|
2409
|
+
const suffixRange = document.createRange();
|
|
2410
|
+
suffixRange.selectNodeContents(sourceLine);
|
|
2411
|
+
suffixRange.setStart(suffixNode, clampDomOffset(suffixNode, suffixOffset));
|
|
2412
|
+
const suffix = suffixRange.cloneContents();
|
|
2413
|
+
if (suffix.firstChild?.textContent === "") suffix.firstChild.remove();
|
|
2414
|
+
return suffix;
|
|
2415
|
+
}
|
|
2416
|
+
#measureGhostTextRows(group) {
|
|
2417
|
+
const { edit } = group;
|
|
2418
|
+
const { start } = edit.range;
|
|
2419
|
+
const [anchorLeft, anchorWrapLine] = this.#getCharX(start.line, start.character);
|
|
2420
|
+
let anchorVisualLines = 1;
|
|
2421
|
+
let ghostVisualLines = edit.newText.split(/\r\n|\r|\n/).length;
|
|
2422
|
+
const overlayElement = this.#overlayElement;
|
|
2423
|
+
if (this.#isWrap && overlayElement != null) {
|
|
2424
|
+
anchorVisualLines = Math.max(1, this.#wrapLineTextOrWholeLine(start.line).length - 1);
|
|
2425
|
+
const probe = h("span", {
|
|
2426
|
+
dataset: "editPrediction",
|
|
2427
|
+
style: { visibility: "hidden" }
|
|
2428
|
+
}, overlayElement);
|
|
2429
|
+
this.#fillGhostTextElement(probe, edit.newText, anchorLeft, this.#getCharX(start.line, 0)[0], this.#cloneInsertionSuffix(group));
|
|
2430
|
+
const { width, height } = probe.getBoundingClientRect();
|
|
2431
|
+
probe.remove();
|
|
2432
|
+
const { lineHeight } = this.#metrics;
|
|
2433
|
+
if (width > 0 && height > 0 && lineHeight > 0) ghostVisualLines = Math.round(height / lineHeight);
|
|
2434
|
+
}
|
|
2435
|
+
return Math.max(0, ghostVisualLines - (anchorVisualLines - anchorWrapLine));
|
|
2436
|
+
}
|
|
2437
|
+
#syncEditPredictionSpacers(notifyComponent = true) {
|
|
2438
|
+
const nextSpacers = /* @__PURE__ */ new Map();
|
|
2439
|
+
const ghostTextRows = /* @__PURE__ */ new Map();
|
|
2440
|
+
const previousRows = this.#ghostTextRows;
|
|
2441
|
+
let rowsChanged = false;
|
|
2442
|
+
const contentElement = this.#contentElement;
|
|
2443
|
+
const composed = this.#getEditPredictionGroups();
|
|
2444
|
+
if (contentElement != null && composed != null && composed.allVisible) {
|
|
2445
|
+
for (const group of composed.groups) {
|
|
2446
|
+
const { edit } = group;
|
|
2447
|
+
if (edit.newText.length === 0) continue;
|
|
2448
|
+
const count = this.#measureGhostTextRows(group);
|
|
2449
|
+
if (count > (ghostTextRows.get(edit.range.start.line) ?? 0)) ghostTextRows.set(edit.range.start.line, count);
|
|
2450
|
+
}
|
|
2451
|
+
if (ghostTextRows.size > 0) {
|
|
2452
|
+
let rowIndexes;
|
|
2453
|
+
const startingLine = this.#renderRange?.startingLine ?? 0;
|
|
2454
|
+
for (const [line, count] of ghostTextRows) {
|
|
2455
|
+
rowsChanged ||= previousRows.get(line) !== count;
|
|
2456
|
+
const lineElement = this.#getLineElement(line);
|
|
2457
|
+
if (lineElement === void 0) continue;
|
|
2458
|
+
let rowIndex = line - startingLine;
|
|
2459
|
+
if (contentElement.children[rowIndex] !== lineElement) {
|
|
2460
|
+
if (rowIndexes === void 0) {
|
|
2461
|
+
rowIndexes = /* @__PURE__ */ new Map();
|
|
2462
|
+
for (let index = 0; index < contentElement.children.length; index++) rowIndexes.set(contentElement.children[index], index);
|
|
2463
|
+
}
|
|
2464
|
+
rowIndex = rowIndexes.get(lineElement) ?? -1;
|
|
2465
|
+
}
|
|
2466
|
+
if (rowIndex < 0) continue;
|
|
2467
|
+
nextSpacers.set(lineElement, count);
|
|
2468
|
+
const gutterRow = this.#gutterElement?.children[rowIndex];
|
|
2469
|
+
if (gutterRow instanceof HTMLElement) nextSpacers.set(gutterRow, count);
|
|
2470
|
+
const partner = this.#deletionsColumnPartner(rowIndex);
|
|
2471
|
+
if (partner != null) {
|
|
2472
|
+
nextSpacers.set(partner.content, (nextSpacers.get(partner.content) ?? 0) + count);
|
|
2473
|
+
nextSpacers.set(partner.gutter, (nextSpacers.get(partner.gutter) ?? 0) + count);
|
|
2474
|
+
}
|
|
2475
|
+
}
|
|
2476
|
+
}
|
|
2477
|
+
}
|
|
2478
|
+
let changed = false;
|
|
2479
|
+
for (const [element, count] of this.#editPredictionSpacers) {
|
|
2480
|
+
if (nextSpacers.get(element) === count) continue;
|
|
2481
|
+
delete element.dataset.editPredictionSpacer;
|
|
2482
|
+
element.style.removeProperty("--diffs-edit-prediction-spacer-height");
|
|
2483
|
+
changed = true;
|
|
2484
|
+
}
|
|
2485
|
+
for (const [element, count] of nextSpacers) {
|
|
2486
|
+
if (this.#editPredictionSpacers.get(element) === count) continue;
|
|
2487
|
+
element.dataset.editPredictionSpacer = "";
|
|
2488
|
+
element.style.setProperty("--diffs-edit-prediction-spacer-height", `${count}lh`);
|
|
2489
|
+
changed = true;
|
|
2490
|
+
}
|
|
2491
|
+
this.#editPredictionSpacers = nextSpacers;
|
|
2492
|
+
if (rowsChanged || ghostTextRows.size !== previousRows.size) {
|
|
2493
|
+
this.#ghostTextRows = ghostTextRows;
|
|
2494
|
+
if (notifyComponent) this.#virtualizedInstance?.syncGhostTextRows();
|
|
2495
|
+
}
|
|
2496
|
+
if (changed) this.#resetCache();
|
|
2497
|
+
}
|
|
2498
|
+
#deletionsColumnPartner(rowIndex) {
|
|
2499
|
+
const deletionsColumn = this.#deletionsColumn;
|
|
2500
|
+
const contentElement = this.#contentElement;
|
|
2501
|
+
if (deletionsColumn == null || contentElement == null || !this.#isDiff || this.#diffSyle !== "split" || this.#isWrap) return;
|
|
2502
|
+
let track = 0;
|
|
2503
|
+
for (let index = 0; index < rowIndex; index++) track += gridTrackSpan(contentElement.children[index]);
|
|
2504
|
+
const { content, gutter } = deletionsColumn;
|
|
2505
|
+
let covered = 0;
|
|
2506
|
+
for (let index = 0; index < content.children.length; index++) {
|
|
2507
|
+
const child = content.children[index];
|
|
2508
|
+
covered += gridTrackSpan(child);
|
|
2509
|
+
if (covered > track) {
|
|
2510
|
+
const gutterChild = gutter.children[index];
|
|
2511
|
+
if (!(child instanceof HTMLElement) || !(gutterChild instanceof HTMLElement)) throw new Error("Editor: deletions column rows and gutter cells are out of step");
|
|
2512
|
+
return {
|
|
2513
|
+
content: child,
|
|
2514
|
+
gutter: gutterChild
|
|
2515
|
+
};
|
|
2516
|
+
}
|
|
2517
|
+
}
|
|
2518
|
+
}
|
|
2519
|
+
#cancelEditPrediction(removeRendered, notifyComponent = true) {
|
|
2520
|
+
if (this.#editPredictionTimer !== void 0) {
|
|
2521
|
+
clearTimeout(this.#editPredictionTimer);
|
|
2522
|
+
this.#editPredictionTimer = void 0;
|
|
2523
|
+
}
|
|
2524
|
+
this.#editPredictionAbortController?.abort();
|
|
2525
|
+
this.#editPredictionAbortController = void 0;
|
|
2526
|
+
this.#editPredictionGeneration++;
|
|
2527
|
+
this.#editPredictionRevealed = false;
|
|
2528
|
+
this.#retryEditPredictionOnRender = false;
|
|
2529
|
+
this.#editPrediction = void 0;
|
|
2530
|
+
this.#syncEditPredictionSpacers(notifyComponent);
|
|
2531
|
+
if (removeRendered) this.#removeRenderedEditPrediction();
|
|
2532
|
+
}
|
|
2533
|
+
#includesEditPredictionPath(path) {
|
|
2534
|
+
const options = this.#options.editPrediction;
|
|
2535
|
+
if (options === void 0) return false;
|
|
2536
|
+
const normalizedPath = path.replaceAll("\\", "/");
|
|
2537
|
+
return (options.include === void 0 || options.include.some((pattern) => matchesEditPredictionPattern(normalizedPath, pattern))) && options.exclude?.some((pattern) => matchesEditPredictionPattern(normalizedPath, pattern)) !== true;
|
|
2538
|
+
}
|
|
2539
|
+
#scheduleEditPrediction() {
|
|
2540
|
+
this.#cancelEditPrediction(true);
|
|
2541
|
+
const selection = this.#selections?.[0];
|
|
2542
|
+
if (this.#options.editPrediction === void 0 || this.#editSession?.document === void 0 || this.#editSession?.fileInfo === void 0 || this.#selections?.length !== 1 || selection === void 0 || !isCollapsedSelection(selection)) return;
|
|
2543
|
+
const document = this.#editSession?.document;
|
|
2544
|
+
const cursorOffset = document.offsetAt(getCaretPosition(selection));
|
|
2545
|
+
this.#editPredictionTimer = setTimeout(() => {
|
|
2546
|
+
this.#editPredictionTimer = void 0;
|
|
2547
|
+
const options = this.#options.editPrediction;
|
|
2548
|
+
const currentSelection = this.#selections?.[0];
|
|
2549
|
+
const path = this.#editSession?.fileInfo?.name;
|
|
2550
|
+
if (options === void 0 || path === void 0 || this.#editSession?.document !== document || this.#selections?.length !== 1 || currentSelection === void 0 || !isCollapsedSelection(currentSelection) || document.offsetAt(getCaretPosition(currentSelection)) !== cursorOffset) return;
|
|
2551
|
+
if (!this.#includesEditPredictionPath(path)) return;
|
|
2552
|
+
const isLineEditable = (line) => this.#isLineInRenderRange(line) && this.#isLineRenderable(line);
|
|
2553
|
+
if (!isLineEditable(getCaretPosition(currentSelection).line)) {
|
|
2554
|
+
this.#retryEditPredictionOnRender = true;
|
|
2555
|
+
return;
|
|
2556
|
+
}
|
|
2557
|
+
const request = buildEditPredictionRequest(path, document, cursorOffset, this.#editPredictionHistory, isLineEditable);
|
|
2558
|
+
if (request === void 0) return;
|
|
2559
|
+
const excerptStartOffset = document.offsetAt({
|
|
2560
|
+
line: request.excerptStartLine,
|
|
2561
|
+
character: 0
|
|
2562
|
+
});
|
|
2563
|
+
const editableStart = excerptStartOffset + request.editableRange.start;
|
|
2564
|
+
const editableEnd = excerptStartOffset + request.editableRange.end;
|
|
2565
|
+
const controller = new AbortController();
|
|
2566
|
+
const generation = ++this.#editPredictionGeneration;
|
|
2567
|
+
this.#editPredictionAbortController = controller;
|
|
2568
|
+
let prediction;
|
|
2569
|
+
try {
|
|
2570
|
+
prediction = options.provider.predict(request, { signal: controller.signal });
|
|
2571
|
+
} catch {
|
|
2572
|
+
this.#editPredictionAbortController = void 0;
|
|
2573
|
+
return;
|
|
2574
|
+
}
|
|
2575
|
+
Promise.resolve(prediction).then((response) => {
|
|
2576
|
+
const selection = this.#selections?.[0];
|
|
2577
|
+
if (controller.signal.aborted || generation !== this.#editPredictionGeneration || this.#editPredictionAbortController !== controller || this.#editSession?.document !== document || document.version !== request.version || this.#selections?.length !== 1 || selection === void 0 || !isCollapsedSelection(selection) || document.offsetAt(getCaretPosition(selection)) !== cursorOffset) return;
|
|
2578
|
+
if (response == null || !Array.isArray(response.edits) || response.edits.length === 0 || response.edits.length > MAX_EDIT_PREDICTION_RESPONSE_EDITS || response.newCursor == null) return;
|
|
2579
|
+
const resolvedEdits = [];
|
|
2580
|
+
let responseBytes = 0;
|
|
2581
|
+
for (const edit of response.edits) {
|
|
2582
|
+
if (edit == null || typeof edit.newText !== "string" || !isValidEditPredictionPosition(document, edit.range?.start) || !isValidEditPredictionPosition(document, edit.range?.end) || comparePosition(edit.range.start, edit.range.end) > 0) return;
|
|
2583
|
+
responseBytes += editPredictionTextEncoder.encode(edit.newText).byteLength;
|
|
2584
|
+
if (responseBytes > MAX_EDIT_PREDICTION_RESPONSE_BYTES) return;
|
|
2585
|
+
const start = document.offsetAt(edit.range.start);
|
|
2586
|
+
const end = document.offsetAt(edit.range.end);
|
|
2587
|
+
const resolvedEdit = document.resolveEdits([edit])[0];
|
|
2588
|
+
if (resolvedEdit.start !== start || resolvedEdit.end !== end) return;
|
|
2589
|
+
resolvedEdits.push(resolvedEdit);
|
|
2590
|
+
}
|
|
2591
|
+
resolvedEdits.sort((left, right) => {
|
|
2592
|
+
const startDelta = left.start - right.start;
|
|
2593
|
+
return startDelta === 0 ? left.end - right.end : startDelta;
|
|
2594
|
+
});
|
|
2595
|
+
for (let index = 0; index < resolvedEdits.length; index++) {
|
|
2596
|
+
const edit = resolvedEdits[index];
|
|
2597
|
+
if (edit.start < editableStart || edit.end > editableEnd || index > 0 && resolvedEdits[index - 1].end > edit.start) return;
|
|
2598
|
+
}
|
|
2599
|
+
const edits = resolvedEdits.filter((edit) => edit.text !== document.getTextSlice(edit.start, edit.end));
|
|
2600
|
+
if (edits.length === 0) return;
|
|
2601
|
+
const firstEditPosition = document.positionAt(edits[0].start);
|
|
2602
|
+
const lastEditPosition = document.positionAt(edits.at(-1).end);
|
|
2603
|
+
const affectedStart = document.offsetAt({
|
|
2604
|
+
line: firstEditPosition.line,
|
|
2605
|
+
character: 0
|
|
2606
|
+
});
|
|
2607
|
+
const affectedEnd = document.offsetAt({
|
|
2608
|
+
line: lastEditPosition.line,
|
|
2609
|
+
character: document.getLineLength(lastEditPosition.line)
|
|
2610
|
+
});
|
|
2611
|
+
const predictedParts = [];
|
|
2612
|
+
let consumed = affectedStart;
|
|
2613
|
+
for (const edit of edits) {
|
|
2614
|
+
predictedParts.push(document.getTextSlice(consumed, edit.start), edit.text);
|
|
2615
|
+
consumed = edit.end;
|
|
2616
|
+
}
|
|
2617
|
+
predictedParts.push(document.getTextSlice(consumed, affectedEnd));
|
|
2618
|
+
const predictedLines = predictedParts.join("").split(/\r\n|\r|\n/);
|
|
2619
|
+
const affectedEndLine = firstEditPosition.line + predictedLines.length - 1;
|
|
2620
|
+
const lineDelta = predictedLines.length - (lastEditPosition.line - firstEditPosition.line + 1);
|
|
2621
|
+
const newCursor = response.newCursor;
|
|
2622
|
+
if (!Number.isInteger(newCursor.line) || !Number.isInteger(newCursor.character) || newCursor.line < 0 || newCursor.character < 0) return;
|
|
2623
|
+
if (newCursor.line >= firstEditPosition.line && newCursor.line <= affectedEndLine) {
|
|
2624
|
+
const line = predictedLines[newCursor.line - firstEditPosition.line];
|
|
2625
|
+
if (newCursor.character > line.length || splitsSurrogatePair(line, newCursor.character)) return;
|
|
2626
|
+
} else {
|
|
2627
|
+
const originalLine = newCursor.line < firstEditPosition.line ? newCursor.line : newCursor.line - lineDelta;
|
|
2628
|
+
if (originalLine < 0 || originalLine >= document.lineCount || newCursor.character > document.getLineLength(originalLine)) return;
|
|
2629
|
+
const originalOffset = document.offsetAt({
|
|
2630
|
+
line: originalLine,
|
|
2631
|
+
character: newCursor.character
|
|
2632
|
+
});
|
|
2633
|
+
if (splitsSurrogatePair(document.charAt(originalOffset - 1) + document.charAt(originalOffset), 1)) return;
|
|
2634
|
+
}
|
|
2635
|
+
this.#editPrediction = {
|
|
2636
|
+
document,
|
|
2637
|
+
version: request.version,
|
|
2638
|
+
cursorOffset,
|
|
2639
|
+
rendered: false,
|
|
2640
|
+
response: {
|
|
2641
|
+
edits: edits.map((edit) => ({
|
|
2642
|
+
range: {
|
|
2643
|
+
start: document.positionAt(edit.start),
|
|
2644
|
+
end: document.positionAt(edit.end)
|
|
2645
|
+
},
|
|
2646
|
+
newText: edit.text
|
|
2647
|
+
})),
|
|
2648
|
+
newCursor: { ...newCursor }
|
|
2649
|
+
}
|
|
2650
|
+
};
|
|
2651
|
+
this.#updateSelections(this.#selections);
|
|
2652
|
+
}).catch(() => {}).finally(() => {
|
|
2653
|
+
if (this.#editPredictionAbortController === controller) this.#editPredictionAbortController = void 0;
|
|
2654
|
+
});
|
|
2655
|
+
}, EDIT_PREDICTION_DEBOUNCE_MS);
|
|
2656
|
+
}
|
|
2657
|
+
#recordEditPredictionHistory(change, source) {
|
|
2658
|
+
const textDocument = this.#editSession?.document;
|
|
2659
|
+
const path = this.#editSession?.fileInfo?.name;
|
|
2660
|
+
const transaction = getTextDocumentChangeTransaction(change);
|
|
2661
|
+
if (textDocument === void 0 || path === void 0 || transaction === void 0 || !this.#includesEditPredictionPath(path)) return;
|
|
2662
|
+
this.#editPredictionHistory = recordEditPrediction(this.#editPredictionHistory, path, textDocument, transaction, source);
|
|
2663
|
+
}
|
|
2664
|
+
#acceptEditPrediction() {
|
|
2665
|
+
const prediction = this.#editPrediction;
|
|
2666
|
+
const textDocument = this.#editSession?.document;
|
|
2667
|
+
const selection = this.#selections?.[0];
|
|
2668
|
+
if (prediction === void 0 || !prediction.rendered || textDocument === void 0 || prediction.document !== textDocument || prediction.version !== textDocument.version || this.#selections?.length !== 1 || selection === void 0 || !isCollapsedSelection(selection) || textDocument.offsetAt(getCaretPosition(selection)) !== prediction.cursorOffset) return;
|
|
2669
|
+
const { edits, newCursor } = prediction.response;
|
|
2670
|
+
this.#cancelEditPrediction(true);
|
|
2671
|
+
const change = textDocument.applyEdits(edits.map((edit) => ({
|
|
2672
|
+
range: {
|
|
2673
|
+
start: { ...edit.range.start },
|
|
2674
|
+
end: { ...edit.range.end }
|
|
2675
|
+
},
|
|
2676
|
+
newText: edit.newText
|
|
2677
|
+
})), true, this.#selections, void 0, true);
|
|
2678
|
+
if (change === void 0) {
|
|
2679
|
+
this.#scheduleEditPrediction();
|
|
2680
|
+
return;
|
|
2681
|
+
}
|
|
2682
|
+
const cursor = textDocument.normalizePosition(newCursor);
|
|
2683
|
+
const nextSelections = [{
|
|
2684
|
+
start: cursor,
|
|
2685
|
+
end: cursor,
|
|
2686
|
+
direction: 0
|
|
2687
|
+
}];
|
|
2688
|
+
textDocument.setLastUndoSelectionsAfter(nextSelections);
|
|
2689
|
+
this.#applyChange(change, nextSelections, this.#applyChangeToLineAnnotations(change), { editSource: "prediction" });
|
|
2690
|
+
}
|
|
2691
|
+
#renderEditPrediction(renderCtx) {
|
|
2692
|
+
const prediction = this.#editPrediction;
|
|
2693
|
+
const textDocument = this.#editSession?.document;
|
|
2694
|
+
if (prediction !== void 0) prediction.rendered = false;
|
|
2695
|
+
const composed = this.#getEditPredictionGroups();
|
|
2696
|
+
if (prediction == null || textDocument == null || composed == null || !composed.allVisible) return;
|
|
2697
|
+
for (const group of composed.groups) {
|
|
2698
|
+
const { edit, endIndex } = group;
|
|
2699
|
+
const { start, end } = edit.range;
|
|
2700
|
+
const isDeletion = edit.newText.length === 0;
|
|
2701
|
+
const isReplacement = comparePosition(start, end) !== 0;
|
|
2702
|
+
const lineLength = textDocument.getLineLength(start.line);
|
|
2703
|
+
const isMidLineInsertion = !isReplacement && start.character < lineLength;
|
|
2704
|
+
if (isReplacement) this.#renderSelection(renderCtx, isDeletion ? "editPredictionDeletion" : "editPredictionReplacement", {
|
|
2705
|
+
start,
|
|
2706
|
+
end
|
|
2707
|
+
});
|
|
2708
|
+
else if (isMidLineInsertion) this.#renderSelection(renderCtx, "editPredictionInsertion", {
|
|
2709
|
+
start,
|
|
2710
|
+
end: {
|
|
2711
|
+
line: start.line,
|
|
2712
|
+
character: lineLength
|
|
2713
|
+
}
|
|
2714
|
+
});
|
|
2715
|
+
if (isDeletion) continue;
|
|
2716
|
+
const [anchorLeft, anchorWrapLine] = this.#getCharX(start.line, start.character);
|
|
2717
|
+
const lineLeft = this.#getCharX(start.line, 0)[0];
|
|
2718
|
+
const anchorTop = this.#getLineY(start.line) + anchorWrapLine * this.#metrics.lineHeight;
|
|
2719
|
+
const key = `editPrediction-${endIndex}`;
|
|
2720
|
+
let element = this.#overlayElements?.get(key);
|
|
2721
|
+
if (element !== void 0) {
|
|
2722
|
+
this.#overlayElements?.delete(key);
|
|
2723
|
+
element.replaceChildren();
|
|
2724
|
+
} else element = h("span", {
|
|
2725
|
+
ariaHidden: "true",
|
|
2726
|
+
contentEditable: "false",
|
|
2727
|
+
dataset: "editPrediction"
|
|
2728
|
+
}, renderCtx.fragment);
|
|
2729
|
+
if (isReplacement) {
|
|
2730
|
+
element.dataset.replacement = "";
|
|
2731
|
+
const lineElement = this.#getLineElement(start.line);
|
|
2732
|
+
if (lineElement !== void 0) element.style.setProperty("--diffs-edit-prediction-bg", getComputedStyle(lineElement).getPropertyValue("--diffs-line-bg"));
|
|
2733
|
+
} else {
|
|
2734
|
+
delete element.dataset.replacement;
|
|
2735
|
+
element.style.removeProperty("--diffs-edit-prediction-bg");
|
|
2736
|
+
}
|
|
2737
|
+
this.#fillGhostTextElement(element, edit.newText, anchorLeft, lineLeft, this.#cloneInsertionSuffix(group));
|
|
2738
|
+
element.style.transform = `translateX(${lineLeft}px) translateY(${anchorTop}px)`;
|
|
2739
|
+
renderCtx.elements.set(key, element);
|
|
2740
|
+
}
|
|
2741
|
+
prediction.rendered = true;
|
|
2742
|
+
}
|
|
2144
2743
|
#updateSelections(selections) {
|
|
2145
2744
|
this.__postponeBgTokenizeToNextFrame();
|
|
2745
|
+
const previousSelections = this.#selections;
|
|
2746
|
+
let selectionsChanged = previousSelections?.length !== selections.length;
|
|
2747
|
+
if (!selectionsChanged && previousSelections !== void 0) for (let i = 0; i < selections.length; i++) {
|
|
2748
|
+
const previous = previousSelections[i];
|
|
2749
|
+
const next = selections[i];
|
|
2750
|
+
if (previous.direction !== next.direction || comparePosition(previous.start, next.start) !== 0 || comparePosition(previous.end, next.end) !== 0) {
|
|
2751
|
+
selectionsChanged = true;
|
|
2752
|
+
break;
|
|
2753
|
+
}
|
|
2754
|
+
}
|
|
2755
|
+
if (selectionsChanged) this.#cancelEditPrediction(true);
|
|
2756
|
+
this.#syncEditPredictionSpacers();
|
|
2146
2757
|
this.#primaryCaretElement = void 0;
|
|
2147
2758
|
this.#setEditorActiveLineSafe(null);
|
|
2148
2759
|
if (selections.length === 0 && this.#matches === void 0 && this.#markerRenderer === void 0) {
|
|
@@ -2151,6 +2762,7 @@ var Editor = class {
|
|
|
2151
2762
|
this.#overlayElements?.clear();
|
|
2152
2763
|
this.#selectionAction?.cleanup();
|
|
2153
2764
|
this.#selectionAction = void 0;
|
|
2765
|
+
if (selectionsChanged) this.#scheduleEditPrediction();
|
|
2154
2766
|
return;
|
|
2155
2767
|
}
|
|
2156
2768
|
const fragment = document.createDocumentFragment();
|
|
@@ -2169,14 +2781,14 @@ var Editor = class {
|
|
|
2169
2781
|
if (!isCollapsedSelection(selection)) this.#renderSelection(renderCtx, "selection", selection);
|
|
2170
2782
|
this.#renderCaret(renderCtx, selection, selection === primarySelection);
|
|
2171
2783
|
}
|
|
2172
|
-
const bracketMatchRanges = this.#options.matchBrackets !== false && this.#
|
|
2784
|
+
const bracketMatchRanges = this.#options.matchBrackets !== false && this.#editSession?.document != null && this.#tokenizer !== void 0 && isCollapsedSelection(primarySelection) ? findBracketMatchRanges(this.#editSession?.document, this.#tokenizer, primarySelection.start) : void 0;
|
|
2173
2785
|
if (bracketMatchRanges !== void 0) for (const range of bracketMatchRanges) this.#renderSelection(renderCtx, "bracketMatch", range);
|
|
2174
2786
|
}
|
|
2175
|
-
const textDocument = this.#
|
|
2787
|
+
const textDocument = this.#editSession?.document;
|
|
2176
2788
|
if (this.#matches !== void 0 && textDocument !== void 0) {
|
|
2177
2789
|
const matches = this.#matches;
|
|
2178
2790
|
const renderRange = this.#renderRange;
|
|
2179
|
-
const renderedLineRanges = renderRange
|
|
2791
|
+
const renderedLineRanges = renderRange != null && Number.isFinite(renderRange.totalLines) || this.#isDiff && this.#fileDiffInstance?.options.expandUnchanged !== true ? this.#getRenderedEditableLineRanges() : void 0;
|
|
2180
2792
|
const primarySelection = this.#selections?.at(-1);
|
|
2181
2793
|
const primaryStartOffset = primarySelection !== void 0 ? textDocument.offsetAt(primarySelection.start) : -1;
|
|
2182
2794
|
const primaryEndOffset = primarySelection !== void 0 ? textDocument.offsetAt(primarySelection.end) : -1;
|
|
@@ -2221,14 +2833,70 @@ var Editor = class {
|
|
|
2221
2833
|
}
|
|
2222
2834
|
}
|
|
2223
2835
|
if (this.#markerRenderer !== void 0 && textDocument !== void 0) for (const marker of this.#markerRenderer.markers) this.#renderSelection(renderCtx, "marker", marker, markerSeverityDatasetKey(marker.severity));
|
|
2836
|
+
this.#renderEditPrediction(renderCtx);
|
|
2224
2837
|
this.#overlayElement?.appendChild(fragment);
|
|
2225
2838
|
this.#overlayElements?.forEach((el) => el.remove());
|
|
2226
2839
|
this.#overlayElements?.clear();
|
|
2227
2840
|
this.#overlayElements = renderCtx.elements;
|
|
2228
2841
|
this.#updateSelectionActionPopover();
|
|
2842
|
+
if (selectionsChanged) this.#scheduleEditPrediction();
|
|
2229
2843
|
}
|
|
2230
|
-
#
|
|
2231
|
-
|
|
2844
|
+
#renderCarets() {
|
|
2845
|
+
const carets = this.#carets;
|
|
2846
|
+
const renderCaret = this.#options.renderCaret;
|
|
2847
|
+
const overlayElement = this.#overlayElement;
|
|
2848
|
+
this.#caretHighlightElements?.forEach((element) => element.remove());
|
|
2849
|
+
this.#caretHighlightElements = void 0;
|
|
2850
|
+
if (carets === void 0 || renderCaret === void 0 || overlayElement === void 0) {
|
|
2851
|
+
this.#caretElements?.forEach((element) => element.remove());
|
|
2852
|
+
this.#caretElements = void 0;
|
|
2853
|
+
return;
|
|
2854
|
+
}
|
|
2855
|
+
const elements = this.#caretElements ??= /* @__PURE__ */ new Map();
|
|
2856
|
+
for (const [trackedCaret, element] of elements) if (!this.#isLineVisible(trackedCaret.caret.focus.line)) {
|
|
2857
|
+
element.remove();
|
|
2858
|
+
elements.delete(trackedCaret);
|
|
2859
|
+
}
|
|
2860
|
+
const fragment = document.createDocumentFragment();
|
|
2861
|
+
const highlightElements = [];
|
|
2862
|
+
for (const trackedCaret of carets) {
|
|
2863
|
+
const { caret } = trackedCaret;
|
|
2864
|
+
const { line, character } = caret.focus;
|
|
2865
|
+
if (trackedCaret.anchorOffset !== trackedCaret.focusOffset) {
|
|
2866
|
+
const highlightContext = {
|
|
2867
|
+
fragment,
|
|
2868
|
+
elements: /* @__PURE__ */ new Map()
|
|
2869
|
+
};
|
|
2870
|
+
this.#renderSelection(highlightContext, "caretHighlight", trackedCaret.anchorOffset < trackedCaret.focusOffset ? {
|
|
2871
|
+
start: caret.anchor,
|
|
2872
|
+
end: caret.focus
|
|
2873
|
+
} : {
|
|
2874
|
+
start: caret.focus,
|
|
2875
|
+
end: caret.anchor
|
|
2876
|
+
}, void 0, caret.focus);
|
|
2877
|
+
for (const highlightElement of highlightContext.elements.values()) {
|
|
2878
|
+
highlightElement.style.setProperty("--diffs-caret-highlight-bg", `color-mix(in srgb, ${caret.metadata.color} 32%, transparent)`);
|
|
2879
|
+
highlightElements.push(highlightElement);
|
|
2880
|
+
}
|
|
2881
|
+
}
|
|
2882
|
+
if (!this.#isLineVisible(line)) continue;
|
|
2883
|
+
let element = elements.get(trackedCaret);
|
|
2884
|
+
if (element === void 0) {
|
|
2885
|
+
element = h("div", {
|
|
2886
|
+
dataset: "remoteCaret",
|
|
2887
|
+
children: [renderCaret(caret)]
|
|
2888
|
+
}, fragment);
|
|
2889
|
+
elements.set(trackedCaret, element);
|
|
2890
|
+
}
|
|
2891
|
+
const [left, wrapLine] = this.#getCharX(line, character);
|
|
2892
|
+
const top = this.#getLineY(line) + wrapLine * this.#metrics.lineHeight;
|
|
2893
|
+
element.style.transform = `translateX(${left}px) translateY(${top}px)`;
|
|
2894
|
+
}
|
|
2895
|
+
this.#caretHighlightElements = highlightElements;
|
|
2896
|
+
overlayElement.appendChild(fragment);
|
|
2897
|
+
}
|
|
2898
|
+
#renderSelection(renderCtx, type, range, extraDataset, connectedCaret) {
|
|
2899
|
+
if (this.#editSession?.document == null) return;
|
|
2232
2900
|
const { start, end } = range;
|
|
2233
2901
|
let firstLine = start.line;
|
|
2234
2902
|
let endLine = end.line + 1;
|
|
@@ -2241,12 +2909,18 @@ var Editor = class {
|
|
|
2241
2909
|
if (!this.#isLineVisible(line)) continue;
|
|
2242
2910
|
const isLastLine = line === end.line;
|
|
2243
2911
|
const startChar = line === start.line ? start.character : 0;
|
|
2244
|
-
const endChar = isLastLine ? end.character : this.#
|
|
2912
|
+
const endChar = isLastLine ? end.character : this.#editSession?.document.getLineLength(line);
|
|
2913
|
+
if (startChar === endChar && (type === "editPredictionDeletion" || type === "editPredictionReplacement")) {
|
|
2914
|
+
if (isLastLine && line !== start.line) continue;
|
|
2915
|
+
const [left, wrapLine] = this.#getCharX(line, startChar);
|
|
2916
|
+
this.#renderSelectionBlock(renderCtx, type, line, wrapLine, left, this.#metrics.ch, extraDataset);
|
|
2917
|
+
continue;
|
|
2918
|
+
}
|
|
2245
2919
|
if (this.#isWrap) {
|
|
2246
2920
|
const contentWidth = this.#getContentWidth();
|
|
2247
|
-
const lineText = this.#
|
|
2921
|
+
const lineText = this.#editSession?.document.getLineText(line);
|
|
2248
2922
|
if (2 * this.#metrics.ch + this.#metrics.measureTextWidth(lineText) > contentWidth) {
|
|
2249
|
-
this.#renderWrappedSelection(renderCtx, line, lineText, startChar, endChar, isLastLine, type, extraDataset);
|
|
2923
|
+
this.#renderWrappedSelection(renderCtx, line, lineText, startChar, endChar, isLastLine, type, extraDataset, connectedCaret);
|
|
2250
2924
|
continue;
|
|
2251
2925
|
}
|
|
2252
2926
|
}
|
|
@@ -2258,10 +2932,13 @@ var Editor = class {
|
|
|
2258
2932
|
if (!isLastLine && type === "selection") paddingEnd = this.#metrics.ch;
|
|
2259
2933
|
if (startChar === endChar) width = paddingEnd;
|
|
2260
2934
|
else width = this.#getCharX(line, endChar)[0] - left + paddingEnd;
|
|
2261
|
-
this.#renderSelectionBlock(renderCtx, type, line, 0, left, width, extraDataset
|
|
2935
|
+
this.#renderSelectionBlock(renderCtx, type, line, 0, left, width, extraDataset, {
|
|
2936
|
+
start: connectedCaret?.line === start.line && connectedCaret.character === start.character && line === start.line,
|
|
2937
|
+
end: connectedCaret?.line === end.line && connectedCaret.character === end.character && line === end.line
|
|
2938
|
+
});
|
|
2262
2939
|
}
|
|
2263
2940
|
}
|
|
2264
|
-
#renderWrappedSelection(renderCtx, line, lineText, startChar, endChar, isLastLine, type, extraDataset) {
|
|
2941
|
+
#renderWrappedSelection(renderCtx, line, lineText, startChar, endChar, isLastLine, type, extraDataset, connectedCaret) {
|
|
2265
2942
|
const wrapOffsets = this.#wrapLineTextOrWholeLine(line);
|
|
2266
2943
|
const segmentCount = wrapOffsets.length - 1;
|
|
2267
2944
|
const offsetLeft = this.#getGutterWidth() + this.#metrics.ch + (this.#activeContentOffset?.left ?? 0);
|
|
@@ -2276,7 +2953,10 @@ var Editor = class {
|
|
|
2276
2953
|
let paddingEnd = 0;
|
|
2277
2954
|
if (!isLastLine && wrapLine === segmentCount - 1 && type === "selection") paddingEnd = this.#metrics.ch;
|
|
2278
2955
|
const segmentWidth = wrapStartChar === wrapEndChar ? paddingEnd : this.#segmentTextWidth(lineText, segmentStart, wrapEndChar) - segmentStartWidth + paddingEnd;
|
|
2279
|
-
this.#renderSelectionBlock(renderCtx, type, line, wrapLine, segmentLeft, segmentWidth, extraDataset
|
|
2956
|
+
this.#renderSelectionBlock(renderCtx, type, line, wrapLine, segmentLeft, segmentWidth, extraDataset, {
|
|
2957
|
+
start: connectedCaret?.line === line && connectedCaret.character === startChar && wrapStartChar === startChar,
|
|
2958
|
+
end: connectedCaret?.line === line && connectedCaret.character === endChar && wrapEndChar === endChar
|
|
2959
|
+
});
|
|
2280
2960
|
}
|
|
2281
2961
|
}
|
|
2282
2962
|
#segmentTextWidth(lineText, segmentStart, character) {
|
|
@@ -2285,13 +2965,13 @@ var Editor = class {
|
|
|
2285
2965
|
const asciiColumns = getExpandedAsciiTextColumns(segmentText, this.#metrics.tabSize);
|
|
2286
2966
|
return asciiColumns !== -1 ? asciiColumns * this.#metrics.ch : this.#metrics.measureTextWidth(segmentText);
|
|
2287
2967
|
}
|
|
2288
|
-
#renderSelectionBlock(renderCtx, type, line, wrapLine, left, width, extraDataset) {
|
|
2968
|
+
#renderSelectionBlock(renderCtx, type, line, wrapLine, left, width, extraDataset, connectedCaretEdge) {
|
|
2289
2969
|
if (width === 0) return;
|
|
2290
2970
|
const { ch, lineHeight } = this.#metrics;
|
|
2291
2971
|
const y = this.#getLineY(line) + wrapLine * lineHeight;
|
|
2292
2972
|
const cacheKey = `${type}-${line}/${wrapLine}-${left}-${width} ${extraDataset ?? ""}`;
|
|
2293
2973
|
const overlayEls = this.#overlayElements;
|
|
2294
|
-
const rounded = (this.#options.roundedSelection ?? true) && type === "selection";
|
|
2974
|
+
const rounded = (this.#options.roundedSelection ?? true) && (type === "selection" || type === "caretHighlight");
|
|
2295
2975
|
const addRoundedCorner = (line, wrapLine, left, radius) => {
|
|
2296
2976
|
const top = this.#getLineY(line) + wrapLine * lineHeight;
|
|
2297
2977
|
const lineElement = this.#getLineElement(line);
|
|
@@ -2321,7 +3001,7 @@ var Editor = class {
|
|
|
2321
3001
|
cornerEl.style.cssText = css;
|
|
2322
3002
|
overlayEls.delete(cacheKey);
|
|
2323
3003
|
} else cornerEl = h("div", {
|
|
2324
|
-
dataset: "selectionRange",
|
|
3004
|
+
dataset: type === "caretHighlight" ? "caretHighlightRange" : "selectionRange",
|
|
2325
3005
|
style: { cssText: css },
|
|
2326
3006
|
children: [h("div", { dataset })]
|
|
2327
3007
|
}, renderCtx.fragment);
|
|
@@ -2366,6 +3046,14 @@ var Editor = class {
|
|
|
2366
3046
|
dataset.rbl = "";
|
|
2367
3047
|
dataset.rbr = "";
|
|
2368
3048
|
}
|
|
3049
|
+
if (connectedCaretEdge?.start === true) {
|
|
3050
|
+
delete dataset.rtl;
|
|
3051
|
+
delete dataset.rbl;
|
|
3052
|
+
}
|
|
3053
|
+
if (connectedCaretEdge?.end === true) {
|
|
3054
|
+
delete dataset.rtr;
|
|
3055
|
+
delete dataset.rbr;
|
|
3056
|
+
}
|
|
2369
3057
|
};
|
|
2370
3058
|
let rangeEl = renderCtx.elements.get(cacheKey);
|
|
2371
3059
|
if (rangeEl !== void 0) {
|
|
@@ -2378,6 +3066,10 @@ var Editor = class {
|
|
|
2378
3066
|
} else rangeEl = h("div", { dataset: extraDataset ? [type + "Range", extraDataset] : type + "Range" }, renderCtx.fragment);
|
|
2379
3067
|
rangeEl.style.width = `${width}px`;
|
|
2380
3068
|
rangeEl.style.transform = `translateX(${left}px) translateY(${y}px)`;
|
|
3069
|
+
if (type === "editPredictionInsertion" || type === "editPredictionReplacement") {
|
|
3070
|
+
const lineElement = this.#getLineElement(line);
|
|
3071
|
+
if (lineElement !== void 0) rangeEl.style.setProperty("--diffs-edit-prediction-bg", getComputedStyle(lineElement).getPropertyValue("--diffs-line-bg"));
|
|
3072
|
+
} else rangeEl.style.removeProperty("--diffs-edit-prediction-bg");
|
|
2381
3073
|
if (rounded) addRadiusStyle(rangeEl);
|
|
2382
3074
|
renderCtx.elements.set(cacheKey, rangeEl);
|
|
2383
3075
|
}
|
|
@@ -2387,9 +3079,11 @@ var Editor = class {
|
|
|
2387
3079
|
const [left, wrapLine] = this.#getCharX(line, character);
|
|
2388
3080
|
const cacheKey = "caret-" + line + "/" + wrapLine + ":" + character;
|
|
2389
3081
|
if (renderCtx.elements.has(cacheKey)) return;
|
|
3082
|
+
const x = left - 1;
|
|
3083
|
+
const y = this.#getLineY(line) + wrapLine * this.#metrics.lineHeight;
|
|
2390
3084
|
const caretEl = h("div", {
|
|
2391
3085
|
dataset: "caret",
|
|
2392
|
-
style: { transform: `translateX(${
|
|
3086
|
+
style: { transform: `translateX(${x}px) translateY(${y}px)` }
|
|
2393
3087
|
}, renderCtx.fragment);
|
|
2394
3088
|
renderCtx.elements.set(cacheKey, caretEl);
|
|
2395
3089
|
if (isPrimary) {
|
|
@@ -2400,7 +3094,7 @@ var Editor = class {
|
|
|
2400
3094
|
#updateSelectionActionPopover() {
|
|
2401
3095
|
const primarySelection = this.#selections?.at(-1);
|
|
2402
3096
|
const overlayElement = this.#overlayElement;
|
|
2403
|
-
const textDocument = this.#
|
|
3097
|
+
const textDocument = this.#editSession?.document;
|
|
2404
3098
|
const renderSelectionAction = this.#options.renderSelectionAction;
|
|
2405
3099
|
const cleanup = () => {
|
|
2406
3100
|
this.#selectionAction?.cleanup();
|
|
@@ -2424,7 +3118,7 @@ var Editor = class {
|
|
|
2424
3118
|
return getActiveSelection();
|
|
2425
3119
|
},
|
|
2426
3120
|
applyEdits: (edits) => this.applyEdits(edits),
|
|
2427
|
-
getSelectionText: () => this.#
|
|
3121
|
+
getSelectionText: () => this.#editSession?.document?.getText(getActiveSelection()) ?? "",
|
|
2428
3122
|
replaceSelectionText: (text) => {
|
|
2429
3123
|
this.#replaceSelectionText(text, [getActiveSelection()]);
|
|
2430
3124
|
},
|
|
@@ -2494,7 +3188,7 @@ var Editor = class {
|
|
|
2494
3188
|
}
|
|
2495
3189
|
#renderSearchPanel(mode) {
|
|
2496
3190
|
this.#searchPanel?.cleanup();
|
|
2497
|
-
const textDocument = this.#
|
|
3191
|
+
const textDocument = this.#editSession?.document;
|
|
2498
3192
|
const preElement = this.#fileContainer?.shadowRoot?.querySelector("pre");
|
|
2499
3193
|
const selections = this.#selections;
|
|
2500
3194
|
if (textDocument === void 0 || preElement == null) return;
|
|
@@ -2577,13 +3271,13 @@ var Editor = class {
|
|
|
2577
3271
|
this.#retainSearchPanelFocus = false;
|
|
2578
3272
|
}
|
|
2579
3273
|
#getSelectionText() {
|
|
2580
|
-
const textDocument = this.#
|
|
3274
|
+
const textDocument = this.#editSession?.document;
|
|
2581
3275
|
const selections = this.#selections;
|
|
2582
3276
|
if (textDocument === void 0 || selections === void 0) return "";
|
|
2583
3277
|
return getSelectionText(textDocument, selections);
|
|
2584
3278
|
}
|
|
2585
3279
|
#getSelectionClipboardTexts() {
|
|
2586
|
-
const textDocument = this.#
|
|
3280
|
+
const textDocument = this.#editSession?.document;
|
|
2587
3281
|
const selections = this.#selections;
|
|
2588
3282
|
if (textDocument === void 0 || selections === void 0) return [];
|
|
2589
3283
|
return getSelectionClipboardTexts(textDocument, selections);
|
|
@@ -2595,7 +3289,7 @@ var Editor = class {
|
|
|
2595
3289
|
if (selectionTexts.length > 1) clipboardData.setData(MULTI_SELECTION_CLIPBOARD_TYPE, JSON.stringify(selectionTexts));
|
|
2596
3290
|
}
|
|
2597
3291
|
#cutSelectionText() {
|
|
2598
|
-
const textDocument = this.#
|
|
3292
|
+
const textDocument = this.#editSession?.document;
|
|
2599
3293
|
const selections = this.#selections;
|
|
2600
3294
|
if (textDocument === void 0 || selections === void 0 || selections.length === 0) return "";
|
|
2601
3295
|
if (selections.some((selection) => isCollapsedSelection(selection))) {
|
|
@@ -2608,7 +3302,7 @@ var Editor = class {
|
|
|
2608
3302
|
return text;
|
|
2609
3303
|
}
|
|
2610
3304
|
#applySelectionCutEdits(edits, nextSelectionOffsets) {
|
|
2611
|
-
const textDocument = this.#
|
|
3305
|
+
const textDocument = this.#editSession?.document;
|
|
2612
3306
|
const selections = this.#selections;
|
|
2613
3307
|
if (textDocument === void 0 || selections === void 0 || edits.length === 0) return;
|
|
2614
3308
|
const change = textDocument.applyResolvedEdits(edits, true, selections, void 0, true);
|
|
@@ -2626,7 +3320,7 @@ var Editor = class {
|
|
|
2626
3320
|
}
|
|
2627
3321
|
#replaceSelectionText(text, selections = this.#selections, undoBoundary = false, textOrder = "selection") {
|
|
2628
3322
|
if (selections === void 0) return;
|
|
2629
|
-
const textDocument = this.#
|
|
3323
|
+
const textDocument = this.#editSession?.document;
|
|
2630
3324
|
const primarySelection = selections.at(-1);
|
|
2631
3325
|
if (textDocument === void 0 || primarySelection === void 0) return;
|
|
2632
3326
|
const { nextSelections, change } = Array.isArray(text) && text.length === selections.length ? applyTextReplaceToSelections(textDocument, selections, text, this.#lineAnnotations, undoBoundary, textOrder) : applyTextChangeToSelections(textDocument, selections, {
|
|
@@ -2638,16 +3332,16 @@ var Editor = class {
|
|
|
2638
3332
|
}
|
|
2639
3333
|
#deleteSelectionText(forward = false) {
|
|
2640
3334
|
const selections = this.#selections;
|
|
2641
|
-
const textDocument = this.#
|
|
3335
|
+
const textDocument = this.#editSession?.document;
|
|
2642
3336
|
if (selections === void 0 || textDocument === void 0) return;
|
|
2643
3337
|
const { nextSelections, change } = applyDeleteCharacterToSelections(textDocument, selections, forward, this.#lineAnnotations, this.#metrics.tabSize);
|
|
2644
3338
|
if (change !== void 0) this.#applyChange(change, nextSelections, this.#applyChangeToLineAnnotations(change));
|
|
2645
3339
|
}
|
|
2646
3340
|
#deleteSoftLineBackward() {
|
|
2647
3341
|
const selections = this.#selections;
|
|
2648
|
-
const textDocument = this.#
|
|
3342
|
+
const textDocument = this.#editSession?.document;
|
|
2649
3343
|
if (selections === void 0 || textDocument === void 0) return;
|
|
2650
|
-
const
|
|
3344
|
+
const getSoftLineStart = this.#isWrap ? (line, character) => {
|
|
2651
3345
|
const wrapOffsets = this.#wrapLineTextOrWholeLine(line);
|
|
2652
3346
|
for (let w = 0; w + 1 < wrapOffsets.length; w++) {
|
|
2653
3347
|
const segmentStart = wrapOffsets[w];
|
|
@@ -2655,40 +3349,39 @@ var Editor = class {
|
|
|
2655
3349
|
if (character >= segmentStart && character <= segmentEnd) return segmentStart;
|
|
2656
3350
|
}
|
|
2657
3351
|
return 0;
|
|
2658
|
-
} : void 0
|
|
3352
|
+
} : void 0;
|
|
3353
|
+
const { nextSelections, change } = applyDeleteSoftLineBackwardToSelections(textDocument, selections, getSoftLineStart, this.#lineAnnotations);
|
|
2659
3354
|
if (change !== void 0) this.#applyChange(change, nextSelections, this.#applyChangeToLineAnnotations(change));
|
|
2660
3355
|
}
|
|
2661
3356
|
#deleteWordBackward() {
|
|
2662
3357
|
const selections = this.#selections;
|
|
2663
|
-
const textDocument = this.#
|
|
3358
|
+
const textDocument = this.#editSession?.document;
|
|
2664
3359
|
if (selections === void 0 || textDocument === void 0) return;
|
|
2665
3360
|
const { nextSelections, change } = applyDeleteWordBackwardToSelections(textDocument, selections, this.#lineAnnotations);
|
|
2666
3361
|
if (change !== void 0) this.#applyChange(change, nextSelections, this.#applyChangeToLineAnnotations(change));
|
|
2667
3362
|
}
|
|
2668
3363
|
#deleteHardLineForward() {
|
|
2669
3364
|
const selections = this.#selections;
|
|
2670
|
-
const textDocument = this.#
|
|
3365
|
+
const textDocument = this.#editSession?.document;
|
|
2671
3366
|
if (selections === void 0 || textDocument === void 0) return;
|
|
2672
3367
|
const { nextSelections, change } = applyDeleteHardLineForwardToSelections(textDocument, selections, this.#lineAnnotations);
|
|
2673
3368
|
if (change !== void 0) this.#applyChange(change, nextSelections, this.#applyChangeToLineAnnotations(change));
|
|
2674
3369
|
}
|
|
2675
3370
|
#insertTranspose() {
|
|
2676
3371
|
const selections = this.#selections;
|
|
2677
|
-
const textDocument = this.#
|
|
3372
|
+
const textDocument = this.#editSession?.document;
|
|
2678
3373
|
if (selections === void 0 || textDocument === void 0) return;
|
|
2679
3374
|
const { nextSelections, change } = applyTransposeToSelections(textDocument, selections, this.#lineAnnotations);
|
|
2680
3375
|
if (change !== void 0) this.#applyChange(change, nextSelections, this.#applyChangeToLineAnnotations(change));
|
|
2681
3376
|
}
|
|
2682
3377
|
#applyChange(change, newSelections, newLineAnnotations, options) {
|
|
2683
|
-
|
|
2684
|
-
const
|
|
2685
|
-
if (
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
lineAnnotations
|
|
2691
|
-
});
|
|
3378
|
+
if (this.#editPrediction != null) this.#cancelEditPrediction(true);
|
|
3379
|
+
const textDocument = this.#editSession?.document;
|
|
3380
|
+
if (textDocument !== void 0 && this.#carets !== void 0) for (const trackedCaret of this.#carets) {
|
|
3381
|
+
trackedCaret.anchorOffset = remapOffsetThroughEdits(trackedCaret.anchorOffset, change.changes);
|
|
3382
|
+
trackedCaret.focusOffset = remapOffsetThroughEdits(trackedCaret.focusOffset, change.changes);
|
|
3383
|
+
trackedCaret.caret.anchor = textDocument.positionAt(trackedCaret.anchorOffset);
|
|
3384
|
+
trackedCaret.caret.focus = textDocument.positionAt(trackedCaret.focusOffset);
|
|
2692
3385
|
}
|
|
2693
3386
|
if (change.lineDelta !== 0 || this.#isWrap) {
|
|
2694
3387
|
for (const line of this.#lineYCache.keys()) if (line >= change.startLine) this.#lineYCache.delete(line);
|
|
@@ -2717,9 +3410,14 @@ var Editor = class {
|
|
|
2717
3410
|
}
|
|
2718
3411
|
}
|
|
2719
3412
|
this.#rerender(change, newLineAnnotations, renderRange, shouldUpdateBuffer);
|
|
3413
|
+
if (newSelections != null) this.#updateSelections(newSelections);
|
|
3414
|
+
this.#fileInstance?.__acknowledgeDocumentUpdate();
|
|
3415
|
+
this.#checkpointEditSessionState();
|
|
3416
|
+
this.#recordEditPredictionHistory(change, options?.editSource ?? "user");
|
|
3417
|
+
this.#scheduleEditPrediction();
|
|
3418
|
+
this.#emitChange(change.changes, newLineAnnotations ?? this.#lineAnnotations);
|
|
2720
3419
|
if (options?.skipSearchRefresh !== true && this.#searchPanel !== void 0 && this.#matches !== void 0) this.#searchPanel.updateMatches({ syncSelection: false });
|
|
2721
|
-
if (newSelections
|
|
2722
|
-
this.#updateSelections(newSelections);
|
|
3420
|
+
if (newSelections != null) {
|
|
2723
3421
|
if (options?.skipFocus !== true) {
|
|
2724
3422
|
const revealTarget = newSelections.at(-1);
|
|
2725
3423
|
if (revealTarget !== void 0) this.#revealLineIfCollapsed(getCaretPosition(revealTarget).line);
|
|
@@ -2737,11 +3435,17 @@ var Editor = class {
|
|
|
2737
3435
|
}
|
|
2738
3436
|
}
|
|
2739
3437
|
}
|
|
3438
|
+
#emitChange(changes, lineAnnotations) {
|
|
3439
|
+
const file = this.getFile();
|
|
3440
|
+
const publishChange = this.#publishChange;
|
|
3441
|
+
if (file == null || publishChange == null) return;
|
|
3442
|
+
publishChange(changes, file, lineAnnotations);
|
|
3443
|
+
}
|
|
2740
3444
|
#applyChangeToLineAnnotations(change) {
|
|
2741
|
-
if (this.#lineAnnotations
|
|
3445
|
+
if (this.#lineAnnotations != null) {
|
|
2742
3446
|
const nextLineAnnotations = applyDocumentChangeToLineAnnotations(change, this.#lineAnnotations);
|
|
2743
|
-
if (nextLineAnnotations
|
|
2744
|
-
this.#
|
|
3447
|
+
if (nextLineAnnotations != null) {
|
|
3448
|
+
this.#editSession?.document?.setLastUndoLineAnnotations(this.#lineAnnotations, nextLineAnnotations);
|
|
2745
3449
|
return nextLineAnnotations;
|
|
2746
3450
|
}
|
|
2747
3451
|
}
|
|
@@ -2762,11 +3466,15 @@ var Editor = class {
|
|
|
2762
3466
|
}
|
|
2763
3467
|
return ranges;
|
|
2764
3468
|
}
|
|
3469
|
+
#isLineInRenderRange(line) {
|
|
3470
|
+
const renderRange = this.#renderRange;
|
|
3471
|
+
return renderRange == null || line >= renderRange.startingLine && line < renderRange.startingLine + renderRange.totalLines;
|
|
3472
|
+
}
|
|
2765
3473
|
#getLineElement(line) {
|
|
2766
3474
|
let lineElement = this.#lineElementsCache.get(line);
|
|
2767
3475
|
if (lineElement !== void 0) return lineElement ?? void 0;
|
|
2768
3476
|
const renderRange = this.#renderRange;
|
|
2769
|
-
if (
|
|
3477
|
+
if (!this.#isLineInRenderRange(line)) return;
|
|
2770
3478
|
const contentElement = this.#contentElement;
|
|
2771
3479
|
if (contentElement === void 0) return;
|
|
2772
3480
|
if (renderRange !== void 0) {
|
|
@@ -2817,7 +3525,7 @@ var Editor = class {
|
|
|
2817
3525
|
}
|
|
2818
3526
|
#getCharX(line, char) {
|
|
2819
3527
|
if (this.#lastAccessedCharX !== void 0 && this.#lastAccessedCharX[0] === line && this.#lastAccessedCharX[1] === char) return [this.#lastAccessedCharX[2], this.#lastAccessedCharX[3]];
|
|
2820
|
-
const lineText = this.#
|
|
3528
|
+
const lineText = this.#editSession?.document?.getLineText(line);
|
|
2821
3529
|
const offsetLeft = this.#getGutterWidth() + this.#metrics.ch;
|
|
2822
3530
|
if (lineText === void 0 || lineText.length === 0 || char <= 0) return [offsetLeft + (this.#activeContentOffset?.left ?? 0), 0];
|
|
2823
3531
|
const boundedCharacter = snapTextOffsetToUnicodeBoundary(lineText, Math.min(char, lineText.length));
|
|
@@ -2863,7 +3571,7 @@ var Editor = class {
|
|
|
2863
3571
|
const cachedOffsets = this.#wrapLineOffsetsCache.get(line);
|
|
2864
3572
|
if (cachedOffsets !== void 0) return cachedOffsets;
|
|
2865
3573
|
if (this.#wrapLineOffsetsCache.size >= MAX_WRAP_OFFSETS_CACHE_LINES) this.#wrapLineOffsetsCache.clear();
|
|
2866
|
-
const lineText = this.#
|
|
3574
|
+
const lineText = this.#editSession?.document?.getLineText(line);
|
|
2867
3575
|
if (lineText === void 0 || lineText.length === 0) {
|
|
2868
3576
|
const offsets = new Uint32Array([0]);
|
|
2869
3577
|
this.#wrapLineOffsetsCache.set(line, offsets);
|
|
@@ -2901,7 +3609,8 @@ var Editor = class {
|
|
|
2901
3609
|
const measureGrapheme = (index) => {
|
|
2902
3610
|
range.setStart(textNode, graphemeStart(index));
|
|
2903
3611
|
range.setEnd(textNode, graphemeStart(index + 1));
|
|
2904
|
-
|
|
3612
|
+
const clientRects = range.getClientRects();
|
|
3613
|
+
return clientRects.item(clientRects.length - 1) ?? range.getBoundingClientRect();
|
|
2905
3614
|
};
|
|
2906
3615
|
starts.push(0);
|
|
2907
3616
|
let lastTop = measureGrapheme(0).top;
|
|
@@ -2933,7 +3642,7 @@ var Editor = class {
|
|
|
2933
3642
|
#wrapLineTextOrWholeLine(line) {
|
|
2934
3643
|
const offsets = this.#wrapLineText(line);
|
|
2935
3644
|
if (offsets !== void 0) return offsets;
|
|
2936
|
-
const length = this.#
|
|
3645
|
+
const length = this.#editSession?.document?.getLineText(line)?.length ?? 0;
|
|
2937
3646
|
return Uint32Array.of(0, length);
|
|
2938
3647
|
}
|
|
2939
3648
|
#rangeBelongsToEditor({ startContainer, endContainer }) {
|
|
@@ -2942,11 +3651,31 @@ var Editor = class {
|
|
|
2942
3651
|
return contentEl.contains(startContainer) && contentEl.contains(endContainer);
|
|
2943
3652
|
}
|
|
2944
3653
|
#isLineVisible(line) {
|
|
2945
|
-
const lineCount = this.#
|
|
3654
|
+
const lineCount = this.#editSession?.document?.lineCount ?? 0;
|
|
2946
3655
|
if (line < 0 || line >= lineCount) return false;
|
|
2947
3656
|
return this.#getLineElement(line) !== void 0;
|
|
2948
3657
|
}
|
|
2949
3658
|
};
|
|
3659
|
+
function getEditSession({ type, editStateKey, owner, initialState, previousSession }) {
|
|
3660
|
+
if (initialState != null && initialState.type !== type) throw new TypeError(`Editor: initialState: a ${initialState.type} state cannot initialize a ${type} editor`);
|
|
3661
|
+
const initialSession = initialState;
|
|
3662
|
+
if (editStateKey != null) return EditStateManager.activate(type, editStateKey, owner, initialSession);
|
|
3663
|
+
if (initialSession != null) return initialSession;
|
|
3664
|
+
if (previousSession != null) return previousSession;
|
|
3665
|
+
return type === "file" ? { type: "file" } : { type: "file-diff" };
|
|
3666
|
+
}
|
|
3667
|
+
function gridTrackSpan(child) {
|
|
3668
|
+
if (!(child instanceof HTMLElement)) return 1;
|
|
3669
|
+
return Number(child.dataset.bufferSize ?? 1);
|
|
3670
|
+
}
|
|
3671
|
+
function isValidEditPredictionPosition(document, position) {
|
|
3672
|
+
return position !== void 0 && Number.isInteger(position.line) && Number.isInteger(position.character) && position.line >= 0 && position.line < document.lineCount && position.character >= 0 && position.character <= document.getLineLength(position.line);
|
|
3673
|
+
}
|
|
3674
|
+
function splitsSurrogatePair(text, offset) {
|
|
3675
|
+
const previous = text.charCodeAt(offset - 1);
|
|
3676
|
+
const next = text.charCodeAt(offset);
|
|
3677
|
+
return offset > 0 && offset < text.length && previous >= 55296 && previous <= 56319 && next >= 56320 && next <= 57343;
|
|
3678
|
+
}
|
|
2950
3679
|
//#endregion
|
|
2951
3680
|
export { Editor };
|
|
2952
3681
|
|