@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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokenizer.js","names":["#isCleanedUp","#textDocument","#grammar","#highlighter","#ensureActiveTheme","#scheduleStatePrebuild","#tokenizerId","#backgroundJobId","#backgroundPrebuildEndLine","#backgroundPrebuild","#backgroundTokenize","#themeType","#matchBrackets","#ensureGrammar","#bracketIgnoredRanges","#buildStateStack","#stateStack","#tokenizeLineAt","#mediaQueryList","#resolveSystemThemeType","#emitThemeChange","#disposes","#tokenizeMaxLineLength","#setStyle","#onDeferTokenize","#onThemeChange","#debug","#colorMap","#setTheme","#themeName","#comparisonStateStack","#comparisonStateStackStart","#comparisonLineChanges","#scheduleBackgroundTokenize","#detachMessageListener","#shiftComparisonStateStack","#getPreviousEndState","#prebuildStateStack","#pendingPrebuildEndLine","#isStopped","#isPaused","#lastLine","#backgroundChangedLineRanges","#backgroundChangedRangeIndex","#postTokenizeMessage","#isMessageListenerAttached","#onMessage","#attachMessageListener","#cacheBracketIgnoredRanges"],"sources":["../../src/editor/tokenizer.ts"],"sourcesContent":["import { colorUtils } from '@pierre/theming/color';\nimport {\n EncodedTokenMetadata,\n type IGrammar,\n INITIAL,\n type StateStack,\n} from 'shiki/textmate';\n\nimport { DEFAULT_THEMES } from '../constants';\nimport type {\n BaseCodeOptions,\n DiffsHighlighter,\n HighlightedToken,\n RenderRange,\n} from '../types';\nimport type { TextDocument, TextDocumentChange } from './textDocument';\nimport { addEventListener, debounce, h } from './utils';\n\nconst TOKENIZE_TIME_LIMIT = 500;\nlet nextTokenizerId = 0;\n\nexport interface EditorTokenizerProps {\n highlighter: DiffsHighlighter;\n textDocument: TextDocument<unknown>;\n codeOptions: BaseCodeOptions;\n matchBrackets?: boolean;\n setStyle: (style: string) => void;\n onDeferTokenize: (\n lines: Map<number, Array<HighlightedToken>>,\n themeType: 'dark' | 'light'\n ) => void;\n // Fired after the active theme (light/dark mode or theme name) changes and the\n // new theme CSS has been applied. Lets the editor recompute overlay pieces\n // that captured a resolved theme color, e.g. rounded selection corner masks.\n onThemeChange?: () => void;\n __debug?: boolean;\n}\n\n/** Stoppable code tokenizer for the editor */\nexport class EditorTokenizer {\n #highlighter: DiffsHighlighter;\n #grammar: IGrammar | undefined;\n #mediaQueryList: MediaQueryList;\n #themeType: 'light' | 'dark' = 'dark';\n // The resolved name of the theme currently applied to the editor (e.g.\n // `github-light`). Tracked so `syncTheme` can detect a host-driven theme swap\n // even when the light/dark mode itself is unchanged.\n #themeName = '';\n #colorMap: string[];\n #textDocument: TextDocument<unknown>;\n #tokenizeMaxLineLength: number;\n #setStyle: EditorTokenizerProps['setStyle'];\n #onDeferTokenize: EditorTokenizerProps['onDeferTokenize'];\n #onThemeChange: EditorTokenizerProps['onThemeChange'];\n #matchBrackets: boolean;\n #debug: boolean;\n #disposes?: (() => void)[];\n #isCleanedUp = false;\n\n // state\n #stateStack: StateStack[] = [INITIAL]; // cached state stack by line index\n #comparisonStateStack: StateStack[] = [];\n #comparisonStateStackStart = 0;\n #comparisonLineChanges: NonNullable<\n TextDocumentChange['changedLineChanges']\n > = [];\n #lastLine: number = -1;\n #isStopped: boolean = true;\n #isPaused: boolean = false;\n #backgroundJobId: number = 0;\n #tokenizerId = ++nextTokenizerId;\n #backgroundPrebuildEndLine = -1;\n #pendingPrebuildEndLine = -1;\n #backgroundChangedLineRanges: readonly [number, number][] | undefined;\n #backgroundChangedRangeIndex: number = 0;\n #bracketIgnoredRanges: ([number, number][] | null | undefined)[] = [];\n #isMessageListenerAttached: boolean = false;\n\n #prebuildStateStack = debounce(async (renderRange?: RenderRange) => {\n // Drop work scheduled before cleanUp; a late timer must not call setTheme\n // on a highlighter that tests (or hosts) have already disposed.\n if (this.#isCleanedUp) {\n return;\n }\n const { startingLine = 0, totalLines = Infinity } = renderRange ?? {};\n const endLine = Math.min(\n totalLines === Infinity ? Infinity : startingLine + totalLines,\n this.#textDocument.lineCount\n );\n if (\n this.#grammar === undefined &&\n !isGrammarlessLanguage(this.#textDocument.languageId)\n ) {\n await this.#highlighter.loadLanguage(this.#textDocument.languageId);\n if (this.#isCleanedUp) {\n return;\n }\n this.#grammar = this.#highlighter.getLanguage(\n this.#textDocument.languageId\n );\n }\n this.#ensureActiveTheme();\n this.#scheduleStatePrebuild(endLine);\n }, 500);\n\n #onMessage = ({ data }: MessageEvent<unknown>) => {\n if (typeof data !== 'object' || data === null) {\n return;\n }\n const { type, tokenizerId, jobId } = data as {\n type?: unknown;\n tokenizerId?: unknown;\n jobId?: unknown;\n };\n if (\n type === 'tokenize' &&\n tokenizerId === this.#tokenizerId &&\n typeof jobId === 'number' &&\n jobId === this.#backgroundJobId\n ) {\n if (this.#backgroundPrebuildEndLine >= 0) {\n this.#backgroundPrebuild(jobId);\n } else {\n this.#backgroundTokenize(jobId);\n }\n }\n };\n\n get themeType(): 'light' | 'dark' {\n return this.#themeType;\n }\n\n getStringCommentRegexpRangesInLine(\n lineIndex: number\n ): [number, number][] | null {\n if (\n !this.#matchBrackets ||\n lineIndex < 0 ||\n lineIndex >= this.#textDocument.lineCount\n ) {\n return null;\n }\n this.#ensureGrammar();\n if (this.#grammar === undefined) {\n return null;\n }\n if (this.#bracketIgnoredRanges[lineIndex] === undefined) {\n this.#buildStateStack(lineIndex);\n const state = this.#stateStack[lineIndex] ?? INITIAL;\n const result = this.#tokenizeLineAt(lineIndex, state);\n this.#stateStack[lineIndex + 1] = result.state;\n }\n return this.#bracketIgnoredRanges[lineIndex] ?? null;\n }\n\n constructor({\n codeOptions,\n highlighter,\n textDocument,\n matchBrackets,\n setStyle,\n onDeferTokenize,\n onThemeChange,\n __debug,\n }: EditorTokenizerProps) {\n const {\n themeType: themeTypeOption = 'system',\n theme = DEFAULT_THEMES,\n tokenizeMaxLineLength = 1000,\n } = codeOptions;\n this.#mediaQueryList = window.matchMedia('(prefers-color-scheme: dark)');\n let themeType: 'light' | 'dark' | undefined;\n if (themeTypeOption === 'system') {\n // Prefer the host document's computed color-scheme (page CSS/classes can\n // force light/dark while the OS media query differs) over matchMedia.\n themeType = this.#resolveSystemThemeType();\n } else {\n themeType = themeTypeOption;\n }\n // Only track the document/system color scheme when the surface follows it\n // (`themeType: 'system'`). A surface pinned to an explicit 'dark'/'light'\n // theme keeps that theme regardless of the page, so re-tokenizing after an\n // edit must emit the same `--diffs-token-{theme}` variable the SSR markup\n // used; otherwise the edited tokens fall back to the default foreground.\n if (typeof theme !== 'string' && themeTypeOption === 'system') {\n const observer = new MutationObserver((mutations) => {\n for (const { type, attributeName } of mutations) {\n if (\n type === 'attributes' &&\n attributeName !== null &&\n (attributeName === 'class' || attributeName.startsWith('data-'))\n ) {\n const themeType = this.#resolveSystemThemeType();\n this.#emitThemeChange(theme[themeType], themeType);\n break;\n }\n }\n });\n observer.observe(document.documentElement, { attributes: true });\n observer.observe(document.body, { attributes: true });\n this.#disposes = [\n addEventListener(this.#mediaQueryList, 'change', () => {\n // Re-read computed color-scheme so a host-forced scheme still wins\n // when the OS preference changes underneath it.\n const themeType = this.#resolveSystemThemeType();\n this.#emitThemeChange(theme[themeType], themeType);\n }),\n () => observer.disconnect(),\n ];\n }\n this.#highlighter = highlighter;\n this.#textDocument = textDocument;\n this.#tokenizeMaxLineLength = tokenizeMaxLineLength;\n this.#setStyle = setStyle;\n this.#onDeferTokenize = onDeferTokenize;\n this.#onThemeChange = onThemeChange;\n this.#matchBrackets = matchBrackets !== false;\n this.#debug = __debug ?? false;\n this.#ensureGrammar();\n this.#colorMap = [];\n this.#setTheme(\n typeof theme === 'string' ? theme : theme[themeType],\n typeof theme === 'string' ? undefined : themeType\n );\n }\n\n // By default, diffs components support dual themes, but the tokenizer only renders\n // the preferred theme. When the theme type is changed, the tokenizer will re-tokenize the document.\n #emitThemeChange(themeName: string, themeType: 'light' | 'dark') {\n if (themeName === this.#themeName && themeType === this.#themeType) {\n return;\n }\n this.#setTheme(themeName, themeType);\n this.stopBackgroundTokenize();\n this.#stateStack = [INITIAL];\n this.#comparisonStateStack = [];\n this.#comparisonStateStackStart = 0;\n this.#comparisonLineChanges = [];\n if (this.#grammar !== undefined && this.#textDocument.lineCount > 0) {\n this.#scheduleBackgroundTokenize(0);\n }\n // The theme CSS is now applied, so overlay pieces that captured a resolved\n // theme color (e.g. rounded selection corner masks) can recompute against\n // the new colors instead of keeping the old light/dark value.\n this.#onThemeChange?.();\n }\n\n // Respect an explicit host color-scheme override. When the computed value\n // advertises support for both schemes, let the OS preference choose one.\n #resolveSystemThemeType(): 'light' | 'dark' {\n try {\n if (\n typeof document !== 'undefined' &&\n typeof getComputedStyle === 'function' &&\n document.body != null\n ) {\n const colorSchemes = getComputedStyle(document.body).colorScheme.split(\n /\\s+/\n );\n const supportsDark = colorSchemes.includes('dark');\n const supportsLight = colorSchemes.includes('light');\n // A single host-forced scheme wins. `light dark` only declares support\n // for both schemes, so the media query still selects the active one.\n if (supportsDark !== supportsLight) {\n return supportsDark ? 'dark' : 'light';\n }\n }\n } catch {\n // jsdom and similar harnesses may lack getComputedStyle or throw; fall\n // through to the OS media query.\n }\n return this.#mediaQueryList.matches ? 'dark' : 'light';\n }\n\n // Re-apply the editor's theme from the surface's current code options. Edit\n // mode reuses a single tokenizer across re-renders, so when the host swaps the\n // theme — a theme picker, a light/dark toggle, etc. — we must recompute the\n // active theme and re-tokenize. Without this the editor keeps rendering the\n // theme it captured when it first attached (stale line-highlight background\n // and token colors). System-driven changes are still handled by the\n // observers wired up in the constructor; this covers explicit `themeType`/\n // `theme` option changes that those observers don't see.\n syncTheme(codeOptions: BaseCodeOptions): void {\n const { themeType = 'system', theme = DEFAULT_THEMES } = codeOptions;\n // A single pinned theme does not follow the themeType option or system\n // scheme flips; its own classification stays authoritative.\n if (typeof theme === 'string') {\n const pinnedThemeType = this.#highlighter.getTheme(theme).type;\n if (theme === this.#themeName && pinnedThemeType === this.#themeType) {\n return;\n }\n this.#emitThemeChange(theme, pinnedThemeType);\n return;\n }\n const nextThemeType =\n themeType === 'system' ? this.#resolveSystemThemeType() : themeType;\n const nextThemeName = theme[nextThemeType];\n if (\n nextThemeType === this.#themeType &&\n nextThemeName === this.#themeName\n ) {\n return;\n }\n this.#emitThemeChange(nextThemeName, nextThemeType);\n }\n\n #setTheme(themeName: string, themeType?: 'light' | 'dark') {\n const { theme, colorMap } = this.#highlighter.setTheme(themeName);\n const { colors = {} } = this.#highlighter.getTheme(themeName);\n const selectionBackground = colors['editor.selectionBackground'];\n const themeLineHighlightBackground =\n colors['editor.lineHighlightBackground'];\n const lineHighlightBackground =\n themeLineHighlightBackground != null &&\n themeLineHighlightBackground.trim() !== '' &&\n !colorUtils.isFullyTransparent(themeLineHighlightBackground)\n ? themeLineHighlightBackground\n : undefined;\n // A usable theme background opts into the semantic active-line mix.\n // Missing backgrounds retain the resolved row color and rely on a border.\n const lineHighlightBorder =\n colors['editor.lineHighlightBorder'] ??\n (lineHighlightBackground == null\n ? 'color-mix(in lab, var(--diffs-bg) 70%, var(--diffs-fg))'\n : 'transparent');\n const activeLineSourceMix =\n lineHighlightBackground == null ? '100%' : '85%';\n const cursorForeground = colors['editorCursor.foreground'];\n const findMatchBackground = colors['editor.findMatchBackground'];\n const findMatchHighlightBackground =\n colors['editor.findMatchHighlightBackground'];\n const bracketMatchBackground = colors['editorBracketMatch.background'];\n const bracketMatchBorder = colors['editorBracketMatch.border'];\n const hintForeground = colors['editorHint.foreground'];\n const infoForeground = colors['editorInfo.foreground'];\n const warningForeground = colors['editorWarning.foreground'];\n const errorForeground = colors['editorError.foreground'];\n this.#setStyle(`:host {\n --diffs-editor-selection-bg: ${selectionBackground ?? 'var(--diffs-line-bg)'};\n --diffs-editor-line-highlight-border: ${lineHighlightBorder};\n --diffs-editor-active-line-source-mix: ${activeLineSourceMix};\n --diffs-editor-match-bg: ${findMatchBackground ?? 'initial'};\n --diffs-editor-match-highlight-bg: ${findMatchHighlightBackground ?? 'initial'};\n --diffs-editor-bracket-match-bg: ${bracketMatchBackground ?? 'initial'};\n --diffs-editor-bracket-match-border: ${bracketMatchBorder ?? 'initial'};\n --diffs-editor-cursor-fg: ${cursorForeground ?? 'initial'};\n --diffs-editor-hint-fg: ${hintForeground ?? 'initial'};\n --diffs-editor-info-fg: ${infoForeground ?? 'initial'};\n --diffs-editor-warning-fg: ${warningForeground ?? 'initial'};\n --diffs-editor-error-fg: ${errorForeground ?? 'initial'};\n }`);\n this.#themeName = themeName;\n this.#themeType = themeType ?? theme.type;\n this.#colorMap = colorMap;\n }\n\n // The shared highlighter is also used for dual-theme SSR (`themes: {dark,light}`),\n // which leaves its active theme on whichever pass finished last (usually light).\n // The tokenizer caches a single-theme colorMap from construction; if we tokenize\n // without re-activating that theme, grammar color indices are looked up in the\n // wrong map — property names resolve to a near-foreground gray while types and\n // comments (stable across maps) still look correct. Re-apply before every\n // tokenize path so a first edit after load matches a later file-switch re-attach.\n #ensureActiveTheme(): void {\n if (this.#themeName === '') {\n return;\n }\n const { colorMap } = this.#highlighter.setTheme(this.#themeName);\n this.#colorMap = colorMap;\n }\n\n cleanUp(): void {\n this.#isCleanedUp = true;\n this.stopBackgroundTokenize();\n this.#detachMessageListener();\n this.#disposes?.forEach((dispose) => dispose());\n this.#disposes = undefined;\n }\n\n // to use `tokenize`, call `prebuildStateStackMap` first to prebuild\n // the state stack map for the given render range.\n tokenize(\n change: TextDocumentChange,\n renderRange?: RenderRange,\n hostRealignsRows = false\n ): Map<number, Array<HighlightedToken>> {\n this.#ensureGrammar();\n this.#ensureActiveTheme();\n if (\n this.#grammar === undefined &&\n !isGrammarlessLanguage(this.#textDocument.languageId)\n ) {\n throw new Error(\n `Grammar for language \"${this.#textDocument.languageId}\" not loaded`\n );\n }\n\n const { lineCount } = this.#textDocument;\n const { startingLine = 0, totalLines = Infinity } = renderRange ?? {};\n const renderRangeEndLine =\n totalLines === Infinity\n ? lineCount\n : Math.min(startingLine + totalLines, lineCount);\n\n const dirtyStart = change.startLine;\n const viewStart = Math.max(startingLine, dirtyStart);\n const crossesRenderRangeEnd =\n renderRange !== undefined &&\n totalLines !== Infinity &&\n change.lineDelta > 0 &&\n dirtyStart < renderRangeEndLine &&\n change.endLine >= renderRangeEndLine;\n const canReuseCachedStates =\n change.lineDelta === 0 &&\n (change.changedLineChanges?.every(([, , lineDelta]) => lineDelta === 0) ??\n true);\n if (this.#matchBrackets && !canReuseCachedStates) {\n // Structural edits shift cache indexes, so only the untouched prefix is\n // safe. Same-line edits overwrite every range they re-tokenize and can\n // retain the untouched suffix once grammar state reconverges.\n this.#bracketIgnoredRanges.length = Math.min(\n this.#bracketIgnoredRanges.length,\n change.startLine\n );\n }\n const canReuseShiftedStates =\n hostRealignsRows && change.lineDelta !== 0 && dirtyStart >= startingLine;\n const canCacheTokenizedStates =\n canReuseCachedStates ||\n renderRange === undefined ||\n dirtyStart >= viewStart;\n const changedLineRanges: readonly [number, number][] =\n change.changedLineRanges ?? [[dirtyStart, change.endLine]];\n this.#comparisonStateStack = [];\n this.#comparisonStateStackStart = 0;\n this.#comparisonLineChanges = [];\n let offscreenSyncEnd = -1;\n if (dirtyStart < viewStart) {\n for (const [rangeStart, rangeEnd] of changedLineRanges) {\n if (rangeStart < viewStart) {\n offscreenSyncEnd = Math.max(\n offscreenSyncEnd,\n Math.min(rangeEnd, viewStart - 1)\n );\n }\n }\n }\n const shouldFlushOffscreenLines =\n offscreenSyncEnd >= dirtyStart &&\n (canReuseCachedStates || change.lineDelta < 0);\n if (canReuseCachedStates) {\n this.#buildStateStack(dirtyStart);\n } else {\n this.#shiftComparisonStateStack(change);\n if (renderRange === undefined || dirtyStart >= viewStart) {\n this.#buildStateStack(viewStart);\n }\n }\n\n let changedRangeIndex = 0;\n let currentChangedRangeEnd = changedLineRanges[changedRangeIndex][1];\n let backgroundStartLine: number | undefined;\n let backgroundChangedRangeIndex = 0;\n let line = canReuseCachedStates\n ? changedLineRanges[changedRangeIndex][0]\n : viewStart;\n let settled = false;\n const dirtyLines: Map<number, Array<HighlightedToken>> = new Map();\n const offscreenDirtyLines:\n | Map<number, Array<HighlightedToken>>\n | undefined = shouldFlushOffscreenLines ? new Map() : undefined;\n if (offscreenDirtyLines !== undefined && !canReuseCachedStates) {\n const offscreenEnd = Math.min(\n offscreenSyncEnd + 1,\n viewStart,\n renderRangeEndLine\n );\n if (offscreenEnd > dirtyStart) {\n this.#buildStateStack(offscreenEnd);\n let offscreenLine = dirtyStart;\n let offscreenState = this.#stateStack[offscreenLine] ?? INITIAL;\n for (; offscreenLine < offscreenEnd; offscreenLine++) {\n const resolved = this.#tokenizeLineAt(offscreenLine, offscreenState);\n offscreenState = resolved.state;\n offscreenDirtyLines.set(offscreenLine, resolved.resolvedTokens);\n }\n this.#stateStack[offscreenEnd] = offscreenState;\n }\n }\n // Seed the loop's grammar state after the offscreen flush, not before it.\n // When a delete's removed lines reach the viewport's first line, the flush\n // rebuilds the cached state up to `line`; reading it earlier would capture\n // the truncated INITIAL state and color the viewport as if outside an open\n // construct (block comment, template literal) it is actually inside.\n let state = this.#stateStack[line] ?? INITIAL;\n for (; line < renderRangeEndLine; ) {\n const previousNextState = canReuseCachedStates\n ? this.#stateStack[line + 1]\n : canReuseShiftedStates\n ? this.#getPreviousEndState(line + 1)\n : undefined;\n if (canCacheTokenizedStates) {\n this.#stateStack[line] = state;\n }\n\n const { resolvedTokens, state: nextState } = this.#tokenizeLineAt(\n line,\n state\n );\n state = nextState;\n\n if (line >= viewStart) {\n dirtyLines.set(line, resolvedTokens);\n } else {\n offscreenDirtyLines?.set(line, resolvedTokens);\n }\n\n if (canCacheTokenizedStates) {\n this.#stateStack[line + 1] = state;\n }\n settled =\n line >= currentChangedRangeEnd &&\n (canReuseCachedStates || canReuseShiftedStates) &&\n previousNextState !== undefined &&\n state.equals(previousNextState);\n if (settled) {\n changedRangeIndex++;\n const nextRange = changedLineRanges[changedRangeIndex];\n if (nextRange === undefined) {\n break;\n }\n if (nextRange[0] >= renderRangeEndLine) {\n backgroundStartLine = nextRange[0];\n backgroundChangedRangeIndex = changedRangeIndex;\n break;\n }\n let nextState: StateStack | undefined = this.#stateStack[nextRange[0]];\n if (canReuseShiftedStates) {\n for (\n let stateLine = line + 2;\n stateLine <= nextRange[0];\n stateLine++\n ) {\n nextState = this.#getPreviousEndState(stateLine);\n if (nextState === undefined) {\n break;\n }\n this.#stateStack[stateLine] = nextState;\n }\n }\n if (nextState === undefined) {\n currentChangedRangeEnd = nextRange[1];\n line++;\n } else {\n line = nextRange[0];\n state = nextState;\n currentChangedRangeEnd = nextRange[1];\n }\n settled = false;\n continue;\n }\n line++;\n }\n\n if (canCacheTokenizedStates) {\n if (line < renderRangeEndLine) {\n this.#stateStack[line + 1] = state;\n } else {\n this.#stateStack[line] = state;\n }\n }\n\n if (settled && canReuseShiftedStates && backgroundStartLine === undefined) {\n for (let stateLine = line + 2; stateLine <= lineCount; stateLine++) {\n const previousState = this.#getPreviousEndState(stateLine);\n if (previousState === undefined) {\n break;\n }\n this.#stateStack[stateLine] = previousState;\n }\n this.#comparisonStateStack = [];\n this.#comparisonStateStackStart = 0;\n this.#comparisonLineChanges = [];\n }\n\n if (offscreenDirtyLines !== undefined && offscreenDirtyLines.size > 0) {\n this.#onDeferTokenize(offscreenDirtyLines, this.#themeType);\n }\n\n if (backgroundStartLine !== undefined) {\n if (this.#matchBrackets && canReuseCachedStates) {\n this.#bracketIgnoredRanges.length = Math.min(\n this.#bracketIgnoredRanges.length,\n backgroundStartLine\n );\n }\n this.#scheduleBackgroundTokenize(\n backgroundStartLine,\n changedLineRanges,\n backgroundChangedRangeIndex\n );\n } else if (!settled && line < lineCount) {\n const backgroundLine =\n crossesRenderRangeEnd && dirtyStart >= viewStart\n ? renderRangeEndLine\n : dirtyStart < viewStart && !canReuseCachedStates\n ? dirtyStart\n : line;\n if (this.#matchBrackets && canReuseCachedStates) {\n this.#bracketIgnoredRanges.length = Math.min(\n this.#bracketIgnoredRanges.length,\n backgroundLine\n );\n }\n this.#scheduleBackgroundTokenize(\n backgroundLine,\n changedLineRanges,\n changedRangeIndex\n );\n }\n\n return dirtyLines;\n }\n\n prebuildStateStack(renderRange?: RenderRange): void {\n this.#ensureGrammar();\n this.#prebuildStateStack(renderRange);\n }\n\n stopBackgroundTokenize(): void {\n this.#pendingPrebuildEndLine = -1;\n if (this.#isStopped) {\n return;\n }\n this.#isStopped = true;\n this.#isPaused = false;\n this.#lastLine = -1;\n this.#backgroundPrebuildEndLine = -1;\n this.#backgroundChangedLineRanges = undefined;\n this.#backgroundChangedRangeIndex = 0;\n this.#comparisonStateStack = [];\n this.#comparisonStateStackStart = 0;\n this.#comparisonLineChanges = [];\n this.#detachMessageListener();\n }\n\n pauseBackgroundTokenize(): void {\n if (this.#isStopped || this.#isPaused) {\n return;\n }\n if (this.#debug) {\n console.log('[diffs/editor] background tokenization paused', {\n jobId: this.#backgroundJobId,\n });\n }\n this.#isPaused = true;\n }\n\n resumeBackgroundTokenize(): void {\n if (\n this.#isStopped ||\n !this.#isPaused ||\n this.#grammar === undefined ||\n this.#lastLine < 0\n ) {\n return;\n }\n if (this.#debug) {\n console.log('[diffs/editor] background tokenization resumed', {\n jobId: this.#backgroundJobId,\n });\n }\n this.#isPaused = false;\n this.#postTokenizeMessage(this.#backgroundJobId);\n }\n\n #ensureGrammar(): void {\n if (\n this.#grammar === undefined &&\n !isGrammarlessLanguage(this.#textDocument.languageId) &&\n this.#highlighter\n .getLoadedLanguages()\n .includes(this.#textDocument.languageId)\n ) {\n this.#grammar = this.#highlighter.getLanguage(\n this.#textDocument.languageId\n );\n }\n }\n\n #attachMessageListener(): void {\n if (this.#isMessageListenerAttached) {\n return;\n }\n globalThis.addEventListener('message', this.#onMessage);\n this.#isMessageListenerAttached = true;\n }\n\n #detachMessageListener(): void {\n if (!this.#isMessageListenerAttached) {\n return;\n }\n globalThis.removeEventListener('message', this.#onMessage);\n this.#isMessageListenerAttached = false;\n }\n\n #postTokenizeMessage(jobId: number): void {\n // use `postMessage` instead of `setTimeout(fn, 0)` to avoid 4ms delay\n globalThis.postMessage({\n type: 'tokenize',\n tokenizerId: this.#tokenizerId,\n jobId,\n });\n }\n\n #scheduleBackgroundTokenize(\n startLine: number,\n changedLineRanges?: readonly [number, number][],\n changedRangeIndex = 0\n ): void {\n if (isGrammarlessLanguage(this.#textDocument.languageId)) {\n return;\n }\n\n const jobId = ++this.#backgroundJobId;\n\n if (this.#debug) {\n console.log('[diffs/editor] background tokenization scheduled', {\n jobId,\n startLine,\n changedLineRanges,\n changedRangeIndex,\n });\n }\n\n this.#isStopped = false;\n this.#isPaused = false;\n this.#lastLine = startLine;\n if (this.#backgroundPrebuildEndLine >= 0) {\n this.#pendingPrebuildEndLine = Math.max(\n this.#pendingPrebuildEndLine,\n this.#backgroundPrebuildEndLine\n );\n }\n this.#backgroundPrebuildEndLine = -1;\n this.#backgroundChangedLineRanges = changedLineRanges;\n this.#backgroundChangedRangeIndex = changedRangeIndex;\n this.#attachMessageListener();\n this.#postTokenizeMessage(jobId);\n }\n\n #scheduleStatePrebuild(endLine: number): void {\n if (this.#grammar === undefined || this.#stateStack.length > endLine) {\n return;\n }\n // Extend an active prebuild, or retain the target until the foreground\n // edit job reconverges and releases the state cache.\n if (!this.#isStopped) {\n if (this.#backgroundPrebuildEndLine >= 0) {\n this.#backgroundPrebuildEndLine = Math.max(\n this.#backgroundPrebuildEndLine,\n endLine\n );\n } else {\n this.#pendingPrebuildEndLine = Math.max(\n this.#pendingPrebuildEndLine,\n endLine\n );\n }\n return;\n }\n\n const jobId = ++this.#backgroundJobId;\n this.#isStopped = false;\n this.#isPaused = false;\n this.#lastLine = this.#stateStack.length - 1;\n this.#backgroundPrebuildEndLine = endLine;\n this.#pendingPrebuildEndLine = -1;\n this.#backgroundChangedLineRanges = undefined;\n this.#backgroundChangedRangeIndex = 0;\n this.#attachMessageListener();\n this.#postTokenizeMessage(jobId);\n }\n\n #tokenizeLineAt(\n line: number,\n state: StateStack\n ): { resolvedTokens: Array<HighlightedToken>; state: StateStack } {\n const lineText = this.#textDocument.getLineText(line);\n if (lineText.length > this.#tokenizeMaxLineLength) {\n console.warn(\n `[diffs] Line(${line}) too long to tokenize: ${lineText.length}`\n );\n this.#cacheBracketIgnoredRanges(line, null);\n return { resolvedTokens: [[0, '', lineText]], state };\n }\n if (\n this.#grammar === undefined ||\n lineText === '' ||\n lineText.trim() === ''\n ) {\n this.#cacheBracketIgnoredRanges(line, null);\n return { resolvedTokens: [[0, '', lineText]], state };\n }\n const result = tokenizeLine(\n this.#grammar,\n this.#colorMap,\n lineText,\n state,\n TOKENIZE_TIME_LIMIT,\n this.#matchBrackets\n );\n this.#cacheBracketIgnoredRanges(line, result.bracketIgnoredRanges);\n return {\n resolvedTokens: result.resolvedTokens,\n state: result.ruleStack,\n };\n }\n\n #cacheBracketIgnoredRanges(\n line: number,\n ranges: [number, number][] | null\n ): void {\n if (this.#matchBrackets) {\n this.#bracketIgnoredRanges[line] = ranges;\n }\n }\n\n // Preserve old end states as comparison-only sentinels, copying whichever\n // side of the edit is smaller. Index shifts are resolved lazily on lookup.\n #shiftComparisonStateStack(change: TextDocumentChange): void {\n const lineChanges =\n change.changedLineChanges ??\n ([[change.startLine, change.endLine, change.lineDelta]] as const);\n const comparisonStart = change.startLine + 1;\n const comparisonLength = this.#stateStack.length - comparisonStart;\n if (comparisonStart <= comparisonLength) {\n this.#comparisonStateStack = this.#stateStack;\n this.#comparisonStateStackStart = 0;\n this.#stateStack = this.#stateStack.slice(0, comparisonStart);\n } else {\n this.#comparisonStateStackStart = comparisonStart;\n this.#comparisonStateStack = this.#stateStack.slice(comparisonStart);\n this.#stateStack.length = Math.min(\n this.#stateStack.length,\n comparisonStart\n );\n }\n this.#comparisonLineChanges = lineChanges;\n }\n\n #getPreviousEndState(line: number): StateStack | undefined {\n let previousLine = line;\n for (\n let index = this.#comparisonLineChanges.length - 1;\n index >= 0;\n index--\n ) {\n const [startLine, endLine, lineDelta] =\n this.#comparisonLineChanges[index];\n if (lineDelta === 0) {\n continue;\n }\n if (previousLine > endLine) {\n previousLine -= lineDelta;\n } else if (previousLine > startLine) {\n return this.#stateStack[line];\n }\n }\n return (\n this.#comparisonStateStack[\n previousLine - this.#comparisonStateStackStart\n ] ?? this.#stateStack[line]\n );\n }\n\n #buildStateStack(endAt: number, timeBudget?: number): boolean {\n const boundedEndAt = Math.min(\n Math.max(0, endAt),\n this.#textDocument.lineCount\n );\n if (this.#stateStack.length > boundedEndAt || this.#grammar === undefined) {\n return true;\n }\n const startedAt = timeBudget === undefined ? 0 : performance.now();\n let line = this.#stateStack.length - 1;\n let state = this.#stateStack[line] ?? INITIAL;\n while (line < boundedEndAt) {\n this.#stateStack[line] = state;\n const lineText = this.#textDocument.getLineText(line);\n if (\n lineText.length <= this.#tokenizeMaxLineLength &&\n lineText !== '' &&\n lineText.trim() !== ''\n ) {\n const result = tokenizeLine(\n this.#grammar,\n this.#colorMap,\n lineText,\n state,\n TOKENIZE_TIME_LIMIT,\n this.#matchBrackets,\n false\n );\n this.#cacheBracketIgnoredRanges(line, result.bracketIgnoredRanges);\n state = result.ruleStack;\n } else {\n this.#cacheBracketIgnoredRanges(line, null);\n }\n line++;\n this.#stateStack[line] = state;\n if (\n timeBudget !== undefined &&\n performance.now() - startedAt > timeBudget\n ) {\n break;\n }\n }\n return line >= boundedEndAt;\n }\n\n #backgroundPrebuild(jobId: number): void {\n if (\n this.#isStopped ||\n this.#isPaused ||\n this.#grammar === undefined ||\n jobId !== this.#backgroundJobId\n ) {\n return;\n }\n\n this.#ensureActiveTheme();\n // State prebuilds intentionally omit rendered tokens and yield between\n // short chunks so a deep viewport does not monopolize the main thread.\n const complete = this.#buildStateStack(this.#backgroundPrebuildEndLine, 1);\n if (this.#isStopped || this.#isPaused || jobId !== this.#backgroundJobId) {\n return;\n }\n if (complete) {\n this.stopBackgroundTokenize();\n return;\n }\n this.#lastLine = this.#stateStack.length - 1;\n this.#postTokenizeMessage(jobId);\n }\n\n #backgroundTokenize(jobId: number) {\n if (\n this.#isStopped ||\n this.#isPaused ||\n this.#grammar === undefined ||\n jobId !== this.#backgroundJobId\n ) {\n return;\n }\n\n this.#ensureActiveTheme();\n\n const t = performance.now();\n const lines = new Map<number, Array<HighlightedToken>>();\n const totalLines = this.#textDocument.lineCount;\n const changedLineRanges = this.#backgroundChangedLineRanges;\n\n let line = this.#lastLine;\n let state = this.#stateStack[line] ?? INITIAL;\n let settled = false;\n let changedRangeIndex = this.#backgroundChangedRangeIndex;\n let currentChangedRangeEnd = changedLineRanges?.[changedRangeIndex]?.[1];\n for (; line < totalLines; ) {\n this.#stateStack[line] = state;\n\n const previousNextState =\n currentChangedRangeEnd !== undefined\n ? this.#getPreviousEndState(line + 1)\n : undefined;\n const lineText = this.#textDocument.getLineText(line);\n if (lineText.length > this.#tokenizeMaxLineLength) {\n console.warn(\n `[diffs] Line(${line}) too long to tokenize: ${lineText.length}`\n );\n lines.set(line, [[0, '', lineText]]);\n this.#cacheBracketIgnoredRanges(line, null);\n } else if (lineText === '' || lineText.trim() === '') {\n lines.set(line, [[0, '', lineText]]);\n this.#cacheBracketIgnoredRanges(line, null);\n } else {\n const ret = tokenizeLine(\n this.#grammar,\n this.#colorMap,\n lineText,\n state,\n TOKENIZE_TIME_LIMIT,\n this.#matchBrackets\n );\n lines.set(line, ret.resolvedTokens);\n this.#cacheBracketIgnoredRanges(line, ret.bracketIgnoredRanges);\n state = ret.ruleStack;\n }\n\n this.#stateStack[line + 1] = state;\n settled =\n currentChangedRangeEnd !== undefined &&\n line >= currentChangedRangeEnd &&\n previousNextState !== undefined &&\n state.equals(previousNextState);\n line++;\n if (settled) {\n changedRangeIndex++;\n const nextRange = changedLineRanges?.[changedRangeIndex];\n if (nextRange === undefined) {\n break;\n }\n currentChangedRangeEnd = nextRange[1];\n if (this.#stateStack[nextRange[0]] === undefined) {\n settled = false;\n } else {\n line = nextRange[0];\n state = this.#stateStack[line] ?? state;\n settled = false;\n continue;\n }\n }\n\n // limit the time of partial tokenize to 1ms\n if (performance.now() - t > 1) {\n break;\n }\n }\n\n this.#onDeferTokenize(lines, this.#themeType);\n if (this.#isStopped || this.#isPaused || jobId !== this.#backgroundJobId) {\n return;\n }\n\n if (settled || line >= totalLines) {\n const pendingPrebuildEndLine = this.#pendingPrebuildEndLine;\n this.stopBackgroundTokenize();\n if (pendingPrebuildEndLine >= 0) {\n this.#scheduleStatePrebuild(pendingPrebuildEndLine);\n }\n return;\n }\n\n this.#lastLine = line;\n this.#backgroundChangedRangeIndex = changedRangeIndex;\n this.#postTokenizeMessage(jobId);\n }\n}\n\nfunction tokenizeLine(\n grammar: IGrammar,\n colorMap: string[],\n lineText: string,\n stateStack: StateStack,\n timeLimit?: number,\n collectBracketIgnoredRanges = true,\n resolveTokens = true\n): {\n ruleStack: StateStack;\n resolvedTokens: Array<HighlightedToken>;\n bracketIgnoredRanges: [number, number][];\n} {\n const result = grammar.tokenizeLine2(lineText, stateStack, timeLimit);\n if (result.stoppedEarly) {\n console.warn(\n `[diffs] Time limit reached when tokenizing line: ${lineText.substring(0, 100)}`\n );\n }\n const rawTokens = result.tokens;\n const tokensLength = rawTokens.length / 2;\n const resolvedTokens: Array<HighlightedToken> = [];\n const bracketIgnoredRanges: [number, number][] = [];\n if (!resolveTokens && !collectBracketIgnoredRanges) {\n return {\n ruleStack: result.ruleStack,\n resolvedTokens,\n bracketIgnoredRanges,\n };\n }\n for (let j = 0; j < tokensLength; j++) {\n const offset = rawTokens[2 * j];\n const nextOffset =\n j + 1 < tokensLength ? rawTokens[2 * j + 2] : lineText.length;\n if (offset === nextOffset) {\n // should never reach here, skip if happens anyway\n continue;\n }\n const metadata = rawTokens[2 * j + 1];\n if (resolveTokens) {\n const fg = EncodedTokenMetadata.getForeground(metadata);\n resolvedTokens.push([\n offset,\n colorMap[fg],\n lineText.slice(offset, nextOffset),\n ]);\n }\n if (\n collectBracketIgnoredRanges &&\n EncodedTokenMetadata.getTokenType(metadata) > 0\n ) {\n bracketIgnoredRanges.push([offset, nextOffset]);\n }\n }\n return {\n ruleStack: result.ruleStack,\n resolvedTokens,\n bracketIgnoredRanges,\n };\n}\n\nexport function renderLineTokens(\n tokens: Array<HighlightedToken>\n): (HTMLElement | string)[] {\n return tokens.map(([char, fg, textContent]) => {\n if (char === 0 && fg === '') {\n if (textContent === '') {\n return h('br');\n }\n return textContent;\n }\n return h('span', {\n dataset: {\n char: char.toString(),\n },\n style: `color:${fg};`,\n textContent: textContent,\n });\n });\n}\n\n// Shiki special-cases `text` and `ansi` in codeToHast but does not expose grammars.\nfunction isGrammarlessLanguage(languageId: string): boolean {\n return languageId === 'text' || languageId === 'ansi';\n}\n"],"mappings":";;;;;AAkBA,MAAM,sBAAsB;AAC5B,IAAI,kBAAkB;;AAoBtB,IAAa,kBAAb,MAA6B;CAC3B;CACA;CACA;CACA,aAA+B;CAI/B,aAAa;CACb;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA,eAAe;CAGf,cAA4B,CAAC,OAAO;CACpC,wBAAsC,CAAC;CACvC,6BAA6B;CAC7B,yBAEI,CAAC;CACL,YAAoB;CACpB,aAAsB;CACtB,YAAqB;CACrB,mBAA2B;CAC3B,eAAe,EAAE;CACjB,6BAA6B;CAC7B,0BAA0B;CAC1B;CACA,+BAAuC;CACvC,wBAAmE,CAAC;CACpE,6BAAs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,IAAI,KAAK,SAAS;EACzD,IAAI,WAAW,YAEb;EAEF,MAAM,WAAW,UAAU,IAAI,IAAI;EACnC,IAAI,eAAe;GACjB,MAAM,KAAK,qBAAqB,cAAc,QAAQ;GACtD,eAAe,KAAK;IAClB;IACA,SAAS;IACT,SAAS,MAAM,QAAQ,UAAU;GACnC,CAAC;EACH;EACA,IACE,+BACA,qBAAqB,aAAa,QAAQ,IAAI,GAE9C,qBAAqB,KAAK,CAAC,QAAQ,UAAU,CAAC;CAElD;CACA,OAAO;EACL,WAAW,OAAO;EAClB;EACA;CACF;AACF;AAEA,SAAgB,iBACd,QAC0B;CAC1B,OAAO,OAAO,KAAK,CAAC,MAAM,IAAI,iBAAiB;EAC7C,IAAI,SAAS,KAAK,OAAO,IAAI;GAC3B,IAAI,gBAAgB,IAClB,OAAO,EAAE,IAAI;GAEf,OAAO;EACT;EACA,OAAO,EAAE,QAAQ;GACf,SAAS,EACP,MAAM,KAAK,SAAS,EACtB;GACA,OAAO,SAAS,GAAG;GACN;EACf,CAAC;CACH,CAAC;AACH;AAGA,SAAS,sBAAsB,YAA6B;CAC1D,OAAO,eAAe,UAAU,eAAe;AACjD"}
|
|
1
|
+
{"version":3,"file":"tokenizer.js","names":[],"sources":["../../src/editor/tokenizer.ts"],"sourcesContent":["import { colorUtils } from '@pierre/theming/color';\nimport {\n EncodedTokenMetadata,\n type IGrammar,\n INITIAL,\n type StateStack,\n} from 'shiki/textmate';\n\nimport { DEFAULT_THEMES } from '../constants';\nimport type {\n BaseCodeOptions,\n DiffsHighlighter,\n HighlightedToken,\n RenderRange,\n} from '../types';\nimport type { TextDocument, TextDocumentChange } from './textDocument';\nimport { addEventListener, debounce, h } from './utils';\n\nconst TOKENIZE_TIME_LIMIT = 500;\nlet nextTokenizerId = 0;\n\nexport interface EditorTokenizerProps {\n highlighter: DiffsHighlighter;\n textDocument: TextDocument;\n codeOptions: BaseCodeOptions;\n matchBrackets?: boolean;\n setStyle: (style: string) => void;\n onDeferTokenize: (\n lines: Map<number, Array<HighlightedToken>>,\n themeType: 'dark' | 'light'\n ) => void;\n // Fired after the active theme (light/dark mode or theme name) changes and the\n // new theme CSS has been applied. Lets the editor recompute overlay pieces\n // that captured a resolved theme color, e.g. rounded selection corner masks.\n onThemeChange?: () => void;\n __debug?: boolean;\n}\n\n/** Stoppable code tokenizer for the editor */\nexport class EditorTokenizer {\n #highlighter: DiffsHighlighter;\n #grammar: IGrammar | undefined;\n #mediaQueryList: MediaQueryList;\n #themeType: 'light' | 'dark' = 'dark';\n // The resolved name of the theme currently applied to the editor (e.g.\n // `github-light`). Tracked so `syncTheme` can detect a host-driven theme swap\n // even when the light/dark mode itself is unchanged.\n #themeName = '';\n #colorMap: string[];\n #textDocument: TextDocument;\n #tokenizeMaxLineLength: number;\n #setStyle: EditorTokenizerProps['setStyle'];\n #onDeferTokenize: EditorTokenizerProps['onDeferTokenize'];\n #onThemeChange: EditorTokenizerProps['onThemeChange'];\n #matchBrackets: boolean;\n #debug: boolean;\n #disposes?: (() => void)[];\n #isCleanedUp = false;\n\n // state\n #stateStack: StateStack[] = [INITIAL]; // cached state stack by line index\n #comparisonStateStack: StateStack[] = [];\n #comparisonStateStackStart = 0;\n #comparisonLineChanges: NonNullable<\n TextDocumentChange['changedLineChanges']\n > = [];\n #lastLine: number = -1;\n #isStopped: boolean = true;\n #isPaused: boolean = false;\n #backgroundJobId: number = 0;\n #tokenizerId = ++nextTokenizerId;\n #backgroundPrebuildEndLine = -1;\n #pendingPrebuildEndLine = -1;\n #backgroundChangedLineRanges: readonly [number, number][] | undefined;\n #backgroundChangedRangeIndex: number = 0;\n #bracketIgnoredRanges: ([number, number][] | null | undefined)[] = [];\n #isMessageListenerAttached: boolean = false;\n\n #prebuildStateStack = debounce(async (renderRange?: RenderRange) => {\n // Drop work scheduled before cleanUp; a late timer must not call setTheme\n // on a highlighter that tests (or hosts) have already disposed.\n if (this.#isCleanedUp) {\n return;\n }\n const { startingLine = 0, totalLines = Infinity } = renderRange ?? {};\n const endLine = Math.min(\n totalLines === Infinity ? Infinity : startingLine + totalLines,\n this.#textDocument.lineCount\n );\n if (\n this.#grammar === undefined &&\n !isGrammarlessLanguage(this.#textDocument.languageId)\n ) {\n await this.#highlighter.loadLanguage(this.#textDocument.languageId);\n if (this.#isCleanedUp) {\n return;\n }\n this.#grammar = this.#highlighter.getLanguage(\n this.#textDocument.languageId\n );\n }\n this.#ensureActiveTheme();\n this.#scheduleStatePrebuild(endLine);\n }, 500);\n\n #onMessage = ({ data }: MessageEvent<unknown>) => {\n if (typeof data !== 'object' || data === null) {\n return;\n }\n const { type, tokenizerId, jobId } = data as {\n type?: unknown;\n tokenizerId?: unknown;\n jobId?: unknown;\n };\n if (\n type === 'tokenize' &&\n tokenizerId === this.#tokenizerId &&\n typeof jobId === 'number' &&\n jobId === this.#backgroundJobId\n ) {\n if (this.#backgroundPrebuildEndLine >= 0) {\n this.#backgroundPrebuild(jobId);\n } else {\n this.#backgroundTokenize(jobId);\n }\n }\n };\n\n get themeType(): 'light' | 'dark' {\n return this.#themeType;\n }\n\n getStringCommentRegexpRangesInLine(\n lineIndex: number\n ): [number, number][] | null {\n if (\n !this.#matchBrackets ||\n lineIndex < 0 ||\n lineIndex >= this.#textDocument.lineCount\n ) {\n return null;\n }\n this.#ensureGrammar();\n if (this.#grammar === undefined) {\n return null;\n }\n if (this.#bracketIgnoredRanges[lineIndex] === undefined) {\n this.#buildStateStack(lineIndex);\n const state = this.#stateStack[lineIndex] ?? INITIAL;\n const result = this.#tokenizeLineAt(lineIndex, state);\n this.#stateStack[lineIndex + 1] = result.state;\n }\n return this.#bracketIgnoredRanges[lineIndex] ?? null;\n }\n\n constructor({\n codeOptions,\n highlighter,\n textDocument,\n matchBrackets,\n setStyle,\n onDeferTokenize,\n onThemeChange,\n __debug,\n }: EditorTokenizerProps) {\n const {\n themeType: themeTypeOption = 'system',\n theme = DEFAULT_THEMES,\n tokenizeMaxLineLength = 1000,\n } = codeOptions;\n this.#mediaQueryList = window.matchMedia('(prefers-color-scheme: dark)');\n let themeType: 'light' | 'dark' | undefined;\n if (themeTypeOption === 'system') {\n // Prefer the host document's computed color-scheme (page CSS/classes can\n // force light/dark while the OS media query differs) over matchMedia.\n themeType = this.#resolveSystemThemeType();\n } else {\n themeType = themeTypeOption;\n }\n // Only track the document/system color scheme when the surface follows it\n // (`themeType: 'system'`). A surface pinned to an explicit 'dark'/'light'\n // theme keeps that theme regardless of the page, so re-tokenizing after an\n // edit must emit the same `--diffs-token-{theme}` variable the SSR markup\n // used; otherwise the edited tokens fall back to the default foreground.\n if (typeof theme !== 'string' && themeTypeOption === 'system') {\n const observer = new MutationObserver((mutations) => {\n for (const { type, attributeName } of mutations) {\n if (\n type === 'attributes' &&\n attributeName !== null &&\n (attributeName === 'class' || attributeName.startsWith('data-'))\n ) {\n const themeType = this.#resolveSystemThemeType();\n this.#emitThemeChange(theme[themeType], themeType);\n break;\n }\n }\n });\n observer.observe(document.documentElement, { attributes: true });\n observer.observe(document.body, { attributes: true });\n this.#disposes = [\n addEventListener(this.#mediaQueryList, 'change', () => {\n // Re-read computed color-scheme so a host-forced scheme still wins\n // when the OS preference changes underneath it.\n const themeType = this.#resolveSystemThemeType();\n this.#emitThemeChange(theme[themeType], themeType);\n }),\n () => observer.disconnect(),\n ];\n }\n this.#highlighter = highlighter;\n this.#textDocument = textDocument;\n this.#tokenizeMaxLineLength = tokenizeMaxLineLength;\n this.#setStyle = setStyle;\n this.#onDeferTokenize = onDeferTokenize;\n this.#onThemeChange = onThemeChange;\n this.#matchBrackets = matchBrackets !== false;\n this.#debug = __debug ?? false;\n this.#ensureGrammar();\n this.#colorMap = [];\n this.#setTheme(\n typeof theme === 'string' ? theme : theme[themeType],\n typeof theme === 'string' ? undefined : themeType\n );\n }\n\n // By default, diffs components support dual themes, but the tokenizer only renders\n // the preferred theme. When the theme type is changed, the tokenizer will re-tokenize the document.\n #emitThemeChange(themeName: string, themeType: 'light' | 'dark') {\n if (themeName === this.#themeName && themeType === this.#themeType) {\n return;\n }\n this.#setTheme(themeName, themeType);\n this.stopBackgroundTokenize();\n this.#stateStack = [INITIAL];\n this.#comparisonStateStack = [];\n this.#comparisonStateStackStart = 0;\n this.#comparisonLineChanges = [];\n if (this.#grammar !== undefined && this.#textDocument.lineCount > 0) {\n this.#scheduleBackgroundTokenize(0);\n }\n // The theme CSS is now applied, so overlay pieces that captured a resolved\n // theme color (e.g. rounded selection corner masks) can recompute against\n // the new colors instead of keeping the old light/dark value.\n this.#onThemeChange?.();\n }\n\n // Respect an explicit host color-scheme override. When the computed value\n // advertises support for both schemes, let the OS preference choose one.\n #resolveSystemThemeType(): 'light' | 'dark' {\n try {\n if (\n typeof document !== 'undefined' &&\n typeof getComputedStyle === 'function' &&\n document.body != null\n ) {\n const colorSchemes = getComputedStyle(document.body).colorScheme.split(\n /\\s+/\n );\n const supportsDark = colorSchemes.includes('dark');\n const supportsLight = colorSchemes.includes('light');\n // A single host-forced scheme wins. `light dark` only declares support\n // for both schemes, so the media query still selects the active one.\n if (supportsDark !== supportsLight) {\n return supportsDark ? 'dark' : 'light';\n }\n }\n } catch {\n // jsdom and similar harnesses may lack getComputedStyle or throw; fall\n // through to the OS media query.\n }\n return this.#mediaQueryList.matches ? 'dark' : 'light';\n }\n\n // Re-apply the editor's theme from the surface's current code options. Edit\n // mode reuses a single tokenizer across re-renders, so when the host swaps the\n // theme — a theme picker, a light/dark toggle, etc. — we must recompute the\n // active theme and re-tokenize. Without this the editor keeps rendering the\n // theme it captured when it first attached (stale line-highlight background\n // and token colors). System-driven changes are still handled by the\n // observers wired up in the constructor; this covers explicit `themeType`/\n // `theme` option changes that those observers don't see.\n syncTheme(codeOptions: BaseCodeOptions): void {\n const { themeType = 'system', theme = DEFAULT_THEMES } = codeOptions;\n // A single pinned theme does not follow the themeType option or system\n // scheme flips; its own classification stays authoritative.\n if (typeof theme === 'string') {\n const pinnedThemeType = this.#highlighter.getTheme(theme).type;\n if (theme === this.#themeName && pinnedThemeType === this.#themeType) {\n return;\n }\n this.#emitThemeChange(theme, pinnedThemeType);\n return;\n }\n const nextThemeType =\n themeType === 'system' ? this.#resolveSystemThemeType() : themeType;\n const nextThemeName = theme[nextThemeType];\n if (\n nextThemeType === this.#themeType &&\n nextThemeName === this.#themeName\n ) {\n return;\n }\n this.#emitThemeChange(nextThemeName, nextThemeType);\n }\n\n #setTheme(themeName: string, themeType?: 'light' | 'dark') {\n const { theme, colorMap } = this.#highlighter.setTheme(themeName);\n const { colors = {} } = this.#highlighter.getTheme(themeName);\n const selectionBackground = colors['editor.selectionBackground'];\n const themeLineHighlightBackground =\n colors['editor.lineHighlightBackground'];\n const lineHighlightBackground =\n themeLineHighlightBackground != null &&\n themeLineHighlightBackground.trim() !== '' &&\n !colorUtils.isFullyTransparent(themeLineHighlightBackground)\n ? themeLineHighlightBackground\n : undefined;\n // A usable theme background opts into the semantic active-line mix.\n // Missing backgrounds retain the resolved row color and rely on a border.\n const lineHighlightBorder =\n colors['editor.lineHighlightBorder'] ??\n (lineHighlightBackground == null\n ? 'color-mix(in lab, var(--diffs-bg) 70%, var(--diffs-fg))'\n : 'transparent');\n const activeLineSourceMix =\n lineHighlightBackground == null ? '100%' : '85%';\n const cursorForeground = colors['editorCursor.foreground'];\n const findMatchBackground = colors['editor.findMatchBackground'];\n const findMatchHighlightBackground =\n colors['editor.findMatchHighlightBackground'];\n const bracketMatchBackground = colors['editorBracketMatch.background'];\n const bracketMatchBorder = colors['editorBracketMatch.border'];\n const hintForeground = colors['editorHint.foreground'];\n const infoForeground = colors['editorInfo.foreground'];\n const warningForeground = colors['editorWarning.foreground'];\n const errorForeground = colors['editorError.foreground'];\n this.#setStyle(`:host {\n --diffs-editor-selection-bg: ${selectionBackground ?? 'var(--diffs-line-bg)'};\n --diffs-editor-line-highlight-border: ${lineHighlightBorder};\n --diffs-editor-active-line-source-mix: ${activeLineSourceMix};\n --diffs-editor-match-bg: ${findMatchBackground ?? 'initial'};\n --diffs-editor-match-highlight-bg: ${findMatchHighlightBackground ?? 'initial'};\n --diffs-editor-bracket-match-bg: ${bracketMatchBackground ?? 'initial'};\n --diffs-editor-bracket-match-border: ${bracketMatchBorder ?? 'initial'};\n --diffs-editor-cursor-fg: ${cursorForeground ?? 'initial'};\n --diffs-editor-hint-fg: ${hintForeground ?? 'initial'};\n --diffs-editor-info-fg: ${infoForeground ?? 'initial'};\n --diffs-editor-warning-fg: ${warningForeground ?? 'initial'};\n --diffs-editor-error-fg: ${errorForeground ?? 'initial'};\n }`);\n this.#themeName = themeName;\n this.#themeType = themeType ?? theme.type;\n this.#colorMap = colorMap;\n }\n\n // The shared highlighter is also used for dual-theme SSR (`themes: {dark,light}`),\n // which leaves its active theme on whichever pass finished last (usually light).\n // The tokenizer caches a single-theme colorMap from construction; if we tokenize\n // without re-activating that theme, grammar color indices are looked up in the\n // wrong map — property names resolve to a near-foreground gray while types and\n // comments (stable across maps) still look correct. Re-apply before every\n // tokenize path so a first edit after load matches a later file-switch re-attach.\n #ensureActiveTheme(): void {\n if (this.#themeName === '') {\n return;\n }\n const { colorMap } = this.#highlighter.setTheme(this.#themeName);\n this.#colorMap = colorMap;\n }\n\n cleanUp(): void {\n this.#isCleanedUp = true;\n this.stopBackgroundTokenize();\n this.#detachMessageListener();\n this.#disposes?.forEach((dispose) => dispose());\n this.#disposes = undefined;\n }\n\n // to use `tokenize`, call `prebuildStateStackMap` first to prebuild\n // the state stack map for the given render range.\n tokenize(\n change: TextDocumentChange,\n renderRange?: RenderRange,\n hostRealignsRows = false\n ): Map<number, Array<HighlightedToken>> {\n this.#ensureGrammar();\n this.#ensureActiveTheme();\n if (\n this.#grammar === undefined &&\n !isGrammarlessLanguage(this.#textDocument.languageId)\n ) {\n throw new Error(\n `Grammar for language \"${this.#textDocument.languageId}\" not loaded`\n );\n }\n\n const { lineCount } = this.#textDocument;\n const { startingLine = 0, totalLines = Infinity } = renderRange ?? {};\n const renderRangeEndLine =\n totalLines === Infinity\n ? lineCount\n : Math.min(startingLine + totalLines, lineCount);\n\n const dirtyStart = change.startLine;\n const viewStart = Math.max(startingLine, dirtyStart);\n const crossesRenderRangeEnd =\n renderRange !== undefined &&\n totalLines !== Infinity &&\n change.lineDelta > 0 &&\n dirtyStart < renderRangeEndLine &&\n change.endLine >= renderRangeEndLine;\n const canReuseCachedStates =\n change.lineDelta === 0 &&\n (change.changedLineChanges?.every(([, , lineDelta]) => lineDelta === 0) ??\n true);\n if (this.#matchBrackets && !canReuseCachedStates) {\n // Structural edits shift cache indexes, so only the untouched prefix is\n // safe. Same-line edits overwrite every range they re-tokenize and can\n // retain the untouched suffix once grammar state reconverges.\n this.#bracketIgnoredRanges.length = Math.min(\n this.#bracketIgnoredRanges.length,\n change.startLine\n );\n }\n const canReuseShiftedStates =\n hostRealignsRows && change.lineDelta !== 0 && dirtyStart >= startingLine;\n const canCacheTokenizedStates =\n canReuseCachedStates ||\n renderRange === undefined ||\n dirtyStart >= viewStart;\n const changedLineRanges: readonly [number, number][] =\n change.changedLineRanges ?? [[dirtyStart, change.endLine]];\n this.#comparisonStateStack = [];\n this.#comparisonStateStackStart = 0;\n this.#comparisonLineChanges = [];\n let offscreenSyncEnd = -1;\n if (dirtyStart < viewStart) {\n for (const [rangeStart, rangeEnd] of changedLineRanges) {\n if (rangeStart < viewStart) {\n offscreenSyncEnd = Math.max(\n offscreenSyncEnd,\n Math.min(rangeEnd, viewStart - 1)\n );\n }\n }\n }\n const shouldFlushOffscreenLines =\n offscreenSyncEnd >= dirtyStart &&\n (canReuseCachedStates || change.lineDelta < 0);\n if (canReuseCachedStates) {\n this.#buildStateStack(dirtyStart);\n } else {\n this.#shiftComparisonStateStack(change);\n if (renderRange === undefined || dirtyStart >= viewStart) {\n this.#buildStateStack(viewStart);\n }\n }\n\n let changedRangeIndex = 0;\n let currentChangedRangeEnd = changedLineRanges[changedRangeIndex][1];\n let backgroundStartLine: number | undefined;\n let backgroundChangedRangeIndex = 0;\n let line = canReuseCachedStates\n ? changedLineRanges[changedRangeIndex][0]\n : viewStart;\n let settled = false;\n const dirtyLines: Map<number, Array<HighlightedToken>> = new Map();\n const offscreenDirtyLines:\n | Map<number, Array<HighlightedToken>>\n | undefined = shouldFlushOffscreenLines ? new Map() : undefined;\n if (offscreenDirtyLines !== undefined && !canReuseCachedStates) {\n const offscreenEnd = Math.min(\n offscreenSyncEnd + 1,\n viewStart,\n renderRangeEndLine\n );\n if (offscreenEnd > dirtyStart) {\n this.#buildStateStack(offscreenEnd);\n let offscreenLine = dirtyStart;\n let offscreenState = this.#stateStack[offscreenLine] ?? INITIAL;\n for (; offscreenLine < offscreenEnd; offscreenLine++) {\n const resolved = this.#tokenizeLineAt(offscreenLine, offscreenState);\n offscreenState = resolved.state;\n offscreenDirtyLines.set(offscreenLine, resolved.resolvedTokens);\n }\n this.#stateStack[offscreenEnd] = offscreenState;\n }\n }\n // Seed the loop's grammar state after the offscreen flush, not before it.\n // When a delete's removed lines reach the viewport's first line, the flush\n // rebuilds the cached state up to `line`; reading it earlier would capture\n // the truncated INITIAL state and color the viewport as if outside an open\n // construct (block comment, template literal) it is actually inside.\n let state = this.#stateStack[line] ?? INITIAL;\n for (; line < renderRangeEndLine; ) {\n const previousNextState = canReuseCachedStates\n ? this.#stateStack[line + 1]\n : canReuseShiftedStates\n ? this.#getPreviousEndState(line + 1)\n : undefined;\n if (canCacheTokenizedStates) {\n this.#stateStack[line] = state;\n }\n\n const { resolvedTokens, state: nextState } = this.#tokenizeLineAt(\n line,\n state\n );\n state = nextState;\n\n if (line >= viewStart) {\n dirtyLines.set(line, resolvedTokens);\n } else {\n offscreenDirtyLines?.set(line, resolvedTokens);\n }\n\n if (canCacheTokenizedStates) {\n this.#stateStack[line + 1] = state;\n }\n settled =\n line >= currentChangedRangeEnd &&\n (canReuseCachedStates || canReuseShiftedStates) &&\n previousNextState !== undefined &&\n state.equals(previousNextState);\n if (settled) {\n changedRangeIndex++;\n const nextRange = changedLineRanges[changedRangeIndex];\n if (nextRange === undefined) {\n break;\n }\n if (nextRange[0] >= renderRangeEndLine) {\n backgroundStartLine = nextRange[0];\n backgroundChangedRangeIndex = changedRangeIndex;\n break;\n }\n let nextState: StateStack | undefined = this.#stateStack[nextRange[0]];\n if (canReuseShiftedStates) {\n for (\n let stateLine = line + 2;\n stateLine <= nextRange[0];\n stateLine++\n ) {\n nextState = this.#getPreviousEndState(stateLine);\n if (nextState === undefined) {\n break;\n }\n this.#stateStack[stateLine] = nextState;\n }\n }\n if (nextState === undefined) {\n currentChangedRangeEnd = nextRange[1];\n line++;\n } else {\n line = nextRange[0];\n state = nextState;\n currentChangedRangeEnd = nextRange[1];\n }\n settled = false;\n continue;\n }\n line++;\n }\n\n if (canCacheTokenizedStates) {\n if (line < renderRangeEndLine) {\n this.#stateStack[line + 1] = state;\n } else {\n this.#stateStack[line] = state;\n }\n }\n\n if (settled && canReuseShiftedStates && backgroundStartLine === undefined) {\n for (let stateLine = line + 2; stateLine <= lineCount; stateLine++) {\n const previousState = this.#getPreviousEndState(stateLine);\n if (previousState === undefined) {\n break;\n }\n this.#stateStack[stateLine] = previousState;\n }\n this.#comparisonStateStack = [];\n this.#comparisonStateStackStart = 0;\n this.#comparisonLineChanges = [];\n }\n\n if (offscreenDirtyLines !== undefined && offscreenDirtyLines.size > 0) {\n this.#onDeferTokenize(offscreenDirtyLines, this.#themeType);\n }\n\n if (backgroundStartLine !== undefined) {\n if (this.#matchBrackets && canReuseCachedStates) {\n this.#bracketIgnoredRanges.length = Math.min(\n this.#bracketIgnoredRanges.length,\n backgroundStartLine\n );\n }\n this.#scheduleBackgroundTokenize(\n backgroundStartLine,\n changedLineRanges,\n backgroundChangedRangeIndex\n );\n } else if (!settled && line < lineCount) {\n const backgroundLine =\n crossesRenderRangeEnd && dirtyStart >= viewStart\n ? renderRangeEndLine\n : dirtyStart < viewStart && !canReuseCachedStates\n ? dirtyStart\n : line;\n if (this.#matchBrackets && canReuseCachedStates) {\n this.#bracketIgnoredRanges.length = Math.min(\n this.#bracketIgnoredRanges.length,\n backgroundLine\n );\n }\n this.#scheduleBackgroundTokenize(\n backgroundLine,\n changedLineRanges,\n changedRangeIndex\n );\n }\n\n return dirtyLines;\n }\n\n prebuildStateStack(renderRange?: RenderRange): void {\n this.#ensureGrammar();\n this.#prebuildStateStack(renderRange);\n }\n\n stopBackgroundTokenize(): void {\n this.#pendingPrebuildEndLine = -1;\n if (this.#isStopped) {\n return;\n }\n this.#isStopped = true;\n this.#isPaused = false;\n this.#lastLine = -1;\n this.#backgroundPrebuildEndLine = -1;\n this.#backgroundChangedLineRanges = undefined;\n this.#backgroundChangedRangeIndex = 0;\n this.#comparisonStateStack = [];\n this.#comparisonStateStackStart = 0;\n this.#comparisonLineChanges = [];\n this.#detachMessageListener();\n }\n\n pauseBackgroundTokenize(): void {\n if (this.#isStopped || this.#isPaused) {\n return;\n }\n if (this.#debug) {\n console.log('[diffs/editor] background tokenization paused', {\n jobId: this.#backgroundJobId,\n });\n }\n this.#isPaused = true;\n }\n\n resumeBackgroundTokenize(): void {\n if (\n this.#isStopped ||\n !this.#isPaused ||\n this.#grammar === undefined ||\n this.#lastLine < 0\n ) {\n return;\n }\n if (this.#debug) {\n console.log('[diffs/editor] background tokenization resumed', {\n jobId: this.#backgroundJobId,\n });\n }\n this.#isPaused = false;\n this.#postTokenizeMessage(this.#backgroundJobId);\n }\n\n #ensureGrammar(): void {\n if (\n this.#grammar === undefined &&\n !isGrammarlessLanguage(this.#textDocument.languageId) &&\n this.#highlighter\n .getLoadedLanguages()\n .includes(this.#textDocument.languageId)\n ) {\n this.#grammar = this.#highlighter.getLanguage(\n this.#textDocument.languageId\n );\n }\n }\n\n #attachMessageListener(): void {\n if (this.#isMessageListenerAttached) {\n return;\n }\n globalThis.addEventListener('message', this.#onMessage);\n this.#isMessageListenerAttached = true;\n }\n\n #detachMessageListener(): void {\n if (!this.#isMessageListenerAttached) {\n return;\n }\n globalThis.removeEventListener('message', this.#onMessage);\n this.#isMessageListenerAttached = false;\n }\n\n #postTokenizeMessage(jobId: number): void {\n // use `postMessage` instead of `setTimeout(fn, 0)` to avoid 4ms delay\n globalThis.postMessage({\n type: 'tokenize',\n tokenizerId: this.#tokenizerId,\n jobId,\n });\n }\n\n #scheduleBackgroundTokenize(\n startLine: number,\n changedLineRanges?: readonly [number, number][],\n changedRangeIndex = 0\n ): void {\n if (isGrammarlessLanguage(this.#textDocument.languageId)) {\n return;\n }\n\n const jobId = ++this.#backgroundJobId;\n\n if (this.#debug) {\n console.log('[diffs/editor] background tokenization scheduled', {\n jobId,\n startLine,\n changedLineRanges,\n changedRangeIndex,\n });\n }\n\n this.#isStopped = false;\n this.#isPaused = false;\n this.#lastLine = startLine;\n if (this.#backgroundPrebuildEndLine >= 0) {\n this.#pendingPrebuildEndLine = Math.max(\n this.#pendingPrebuildEndLine,\n this.#backgroundPrebuildEndLine\n );\n }\n this.#backgroundPrebuildEndLine = -1;\n this.#backgroundChangedLineRanges = changedLineRanges;\n this.#backgroundChangedRangeIndex = changedRangeIndex;\n this.#attachMessageListener();\n this.#postTokenizeMessage(jobId);\n }\n\n #scheduleStatePrebuild(endLine: number): void {\n if (this.#grammar === undefined || this.#stateStack.length > endLine) {\n return;\n }\n // Extend an active prebuild, or retain the target until the foreground\n // edit job reconverges and releases the state cache.\n if (!this.#isStopped) {\n if (this.#backgroundPrebuildEndLine >= 0) {\n this.#backgroundPrebuildEndLine = Math.max(\n this.#backgroundPrebuildEndLine,\n endLine\n );\n } else {\n this.#pendingPrebuildEndLine = Math.max(\n this.#pendingPrebuildEndLine,\n endLine\n );\n }\n return;\n }\n\n const jobId = ++this.#backgroundJobId;\n this.#isStopped = false;\n this.#isPaused = false;\n this.#lastLine = this.#stateStack.length - 1;\n this.#backgroundPrebuildEndLine = endLine;\n this.#pendingPrebuildEndLine = -1;\n this.#backgroundChangedLineRanges = undefined;\n this.#backgroundChangedRangeIndex = 0;\n this.#attachMessageListener();\n this.#postTokenizeMessage(jobId);\n }\n\n #tokenizeLineAt(\n line: number,\n state: StateStack\n ): { resolvedTokens: Array<HighlightedToken>; state: StateStack } {\n const lineText = this.#textDocument.getLineText(line);\n if (lineText.length > this.#tokenizeMaxLineLength) {\n console.warn(\n `[diffs] Line(${line}) too long to tokenize: ${lineText.length}`\n );\n this.#cacheBracketIgnoredRanges(line, null);\n return { resolvedTokens: [[0, '', lineText]], state };\n }\n if (\n this.#grammar === undefined ||\n lineText === '' ||\n lineText.trim() === ''\n ) {\n this.#cacheBracketIgnoredRanges(line, null);\n return { resolvedTokens: [[0, '', lineText]], state };\n }\n const result = tokenizeLine(\n this.#grammar,\n this.#colorMap,\n lineText,\n state,\n TOKENIZE_TIME_LIMIT,\n this.#matchBrackets\n );\n this.#cacheBracketIgnoredRanges(line, result.bracketIgnoredRanges);\n return {\n resolvedTokens: result.resolvedTokens,\n state: result.ruleStack,\n };\n }\n\n #cacheBracketIgnoredRanges(\n line: number,\n ranges: [number, number][] | null\n ): void {\n if (this.#matchBrackets) {\n this.#bracketIgnoredRanges[line] = ranges;\n }\n }\n\n // Preserve old end states as comparison-only sentinels, copying whichever\n // side of the edit is smaller. Index shifts are resolved lazily on lookup.\n #shiftComparisonStateStack(change: TextDocumentChange): void {\n const lineChanges =\n change.changedLineChanges ??\n ([[change.startLine, change.endLine, change.lineDelta]] as const);\n const comparisonStart = change.startLine + 1;\n const comparisonLength = this.#stateStack.length - comparisonStart;\n if (comparisonStart <= comparisonLength) {\n this.#comparisonStateStack = this.#stateStack;\n this.#comparisonStateStackStart = 0;\n this.#stateStack = this.#stateStack.slice(0, comparisonStart);\n } else {\n this.#comparisonStateStackStart = comparisonStart;\n this.#comparisonStateStack = this.#stateStack.slice(comparisonStart);\n this.#stateStack.length = Math.min(\n this.#stateStack.length,\n comparisonStart\n );\n }\n this.#comparisonLineChanges = lineChanges;\n }\n\n #getPreviousEndState(line: number): StateStack | undefined {\n let previousLine = line;\n for (\n let index = this.#comparisonLineChanges.length - 1;\n index >= 0;\n index--\n ) {\n const [startLine, endLine, lineDelta] =\n this.#comparisonLineChanges[index];\n if (lineDelta === 0) {\n continue;\n }\n if (previousLine > endLine) {\n previousLine -= lineDelta;\n } else if (previousLine > startLine) {\n return this.#stateStack[line];\n }\n }\n return (\n this.#comparisonStateStack[\n previousLine - this.#comparisonStateStackStart\n ] ?? this.#stateStack[line]\n );\n }\n\n #buildStateStack(endAt: number, timeBudget?: number): boolean {\n const boundedEndAt = Math.min(\n Math.max(0, endAt),\n this.#textDocument.lineCount\n );\n if (this.#stateStack.length > boundedEndAt || this.#grammar === undefined) {\n return true;\n }\n const startedAt = timeBudget === undefined ? 0 : performance.now();\n let line = this.#stateStack.length - 1;\n let state = this.#stateStack[line] ?? INITIAL;\n while (line < boundedEndAt) {\n this.#stateStack[line] = state;\n const lineText = this.#textDocument.getLineText(line);\n if (\n lineText.length <= this.#tokenizeMaxLineLength &&\n lineText !== '' &&\n lineText.trim() !== ''\n ) {\n const result = tokenizeLine(\n this.#grammar,\n this.#colorMap,\n lineText,\n state,\n TOKENIZE_TIME_LIMIT,\n this.#matchBrackets,\n false\n );\n this.#cacheBracketIgnoredRanges(line, result.bracketIgnoredRanges);\n state = result.ruleStack;\n } else {\n this.#cacheBracketIgnoredRanges(line, null);\n }\n line++;\n this.#stateStack[line] = state;\n if (\n timeBudget !== undefined &&\n performance.now() - startedAt > timeBudget\n ) {\n break;\n }\n }\n return line >= boundedEndAt;\n }\n\n #backgroundPrebuild(jobId: number): void {\n if (\n this.#isStopped ||\n this.#isPaused ||\n this.#grammar === undefined ||\n jobId !== this.#backgroundJobId\n ) {\n return;\n }\n\n this.#ensureActiveTheme();\n // State prebuilds intentionally omit rendered tokens and yield between\n // short chunks so a deep viewport does not monopolize the main thread.\n const complete = this.#buildStateStack(this.#backgroundPrebuildEndLine, 1);\n if (this.#isStopped || this.#isPaused || jobId !== this.#backgroundJobId) {\n return;\n }\n if (complete) {\n this.stopBackgroundTokenize();\n return;\n }\n this.#lastLine = this.#stateStack.length - 1;\n this.#postTokenizeMessage(jobId);\n }\n\n #backgroundTokenize(jobId: number) {\n if (\n this.#isStopped ||\n this.#isPaused ||\n this.#grammar === undefined ||\n jobId !== this.#backgroundJobId\n ) {\n return;\n }\n\n this.#ensureActiveTheme();\n\n const t = performance.now();\n const lines = new Map<number, Array<HighlightedToken>>();\n const totalLines = this.#textDocument.lineCount;\n const changedLineRanges = this.#backgroundChangedLineRanges;\n\n let line = this.#lastLine;\n let state = this.#stateStack[line] ?? INITIAL;\n let settled = false;\n let changedRangeIndex = this.#backgroundChangedRangeIndex;\n let currentChangedRangeEnd = changedLineRanges?.[changedRangeIndex]?.[1];\n for (; line < totalLines; ) {\n this.#stateStack[line] = state;\n\n const previousNextState =\n currentChangedRangeEnd !== undefined\n ? this.#getPreviousEndState(line + 1)\n : undefined;\n const lineText = this.#textDocument.getLineText(line);\n if (lineText.length > this.#tokenizeMaxLineLength) {\n console.warn(\n `[diffs] Line(${line}) too long to tokenize: ${lineText.length}`\n );\n lines.set(line, [[0, '', lineText]]);\n this.#cacheBracketIgnoredRanges(line, null);\n } else if (lineText === '' || lineText.trim() === '') {\n lines.set(line, [[0, '', lineText]]);\n this.#cacheBracketIgnoredRanges(line, null);\n } else {\n const ret = tokenizeLine(\n this.#grammar,\n this.#colorMap,\n lineText,\n state,\n TOKENIZE_TIME_LIMIT,\n this.#matchBrackets\n );\n lines.set(line, ret.resolvedTokens);\n this.#cacheBracketIgnoredRanges(line, ret.bracketIgnoredRanges);\n state = ret.ruleStack;\n }\n\n this.#stateStack[line + 1] = state;\n settled =\n currentChangedRangeEnd !== undefined &&\n line >= currentChangedRangeEnd &&\n previousNextState !== undefined &&\n state.equals(previousNextState);\n line++;\n if (settled) {\n changedRangeIndex++;\n const nextRange = changedLineRanges?.[changedRangeIndex];\n if (nextRange === undefined) {\n break;\n }\n currentChangedRangeEnd = nextRange[1];\n if (this.#stateStack[nextRange[0]] === undefined) {\n settled = false;\n } else {\n line = nextRange[0];\n state = this.#stateStack[line] ?? state;\n settled = false;\n continue;\n }\n }\n\n // limit the time of partial tokenize to 1ms\n if (performance.now() - t > 1) {\n break;\n }\n }\n\n this.#onDeferTokenize(lines, this.#themeType);\n if (this.#isStopped || this.#isPaused || jobId !== this.#backgroundJobId) {\n return;\n }\n\n if (settled || line >= totalLines) {\n const pendingPrebuildEndLine = this.#pendingPrebuildEndLine;\n this.stopBackgroundTokenize();\n if (pendingPrebuildEndLine >= 0) {\n this.#scheduleStatePrebuild(pendingPrebuildEndLine);\n }\n return;\n }\n\n this.#lastLine = line;\n this.#backgroundChangedRangeIndex = changedRangeIndex;\n this.#postTokenizeMessage(jobId);\n }\n}\n\nfunction tokenizeLine(\n grammar: IGrammar,\n colorMap: string[],\n lineText: string,\n stateStack: StateStack,\n timeLimit?: number,\n collectBracketIgnoredRanges = true,\n resolveTokens = true\n): {\n ruleStack: StateStack;\n resolvedTokens: Array<HighlightedToken>;\n bracketIgnoredRanges: [number, number][];\n} {\n const result = grammar.tokenizeLine2(lineText, stateStack, timeLimit);\n if (result.stoppedEarly) {\n console.warn(\n `[diffs] Time limit reached when tokenizing line: ${lineText.substring(0, 100)}`\n );\n }\n const rawTokens = result.tokens;\n const tokensLength = rawTokens.length / 2;\n const resolvedTokens: Array<HighlightedToken> = [];\n const bracketIgnoredRanges: [number, number][] = [];\n if (!resolveTokens && !collectBracketIgnoredRanges) {\n return {\n ruleStack: result.ruleStack,\n resolvedTokens,\n bracketIgnoredRanges,\n };\n }\n for (let j = 0; j < tokensLength; j++) {\n const offset = rawTokens[2 * j];\n const nextOffset =\n j + 1 < tokensLength ? rawTokens[2 * j + 2] : lineText.length;\n if (offset === nextOffset) {\n // should never reach here, skip if happens anyway\n continue;\n }\n const metadata = rawTokens[2 * j + 1];\n if (resolveTokens) {\n const fg = EncodedTokenMetadata.getForeground(metadata);\n resolvedTokens.push([\n offset,\n colorMap[fg],\n lineText.slice(offset, nextOffset),\n ]);\n }\n if (\n collectBracketIgnoredRanges &&\n EncodedTokenMetadata.getTokenType(metadata) > 0\n ) {\n bracketIgnoredRanges.push([offset, nextOffset]);\n }\n }\n return {\n ruleStack: result.ruleStack,\n resolvedTokens,\n bracketIgnoredRanges,\n };\n}\n\nexport function renderLineTokens(\n tokens: Array<HighlightedToken>\n): (HTMLElement | string)[] {\n return tokens.map(([char, fg, textContent]) => {\n if (char === 0 && fg === '') {\n if (textContent === '') {\n return h('br');\n }\n return textContent;\n }\n return h('span', {\n dataset: {\n char: char.toString(),\n },\n style: `color:${fg};`,\n textContent: textContent,\n });\n });\n}\n\n// Shiki special-cases `text` and `ansi` in codeToHast but does not expose grammars.\nfunction isGrammarlessLanguage(languageId: string): boolean {\n return languageId === 'text' || languageId === 'ansi';\n}\n"],"mappings":";;;;;AAkBA,MAAM,sBAAsB;AAC5B,IAAI,kBAAkB;;AAoBtB,IAAa,kBAAb,MAA6B;CAC3B;CACA;CACA;CACA,aAA+B;CAI/B,aAAa;CACb;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA,eAAe;CAGf,cAA4B,CAAC,OAAO;CACpC,wBAAsC,CAAC;CACvC,6BAA6B;CAC7B,yBAEI,CAAC;CACL,YAAoB;CACpB,aAAsB;CACtB,YAAqB;CACrB,mBAA2B;CAC3B,eAAe,EAAE;CACjB,6BAA6B;CAC7B,0BAA0B;CAC1B;CACA,+BAAuC;CACvC,wBAAmE,CAAC;CACpE,6BAAsC;CAEtC,sBAAsB,SAAS,OAAO,gBAA8B;EAGlE,IAAI,KAAK,cACP;EAEF,MAAM,EAAE,eAAe,GAAG,aAAa,aAAa,eAAe,CAAC;EACpE,MAAM,UAAU,KAAK,IACnB,eAAe,WAAW,WAAW,eAAe,YACpD,KAAK,cAAc,SACrB;EACA,IACE,KAAK,aAAa,KAAA,KAClB,CAAC,sBAAsB,KAAK,cAAc,UAAU,GACpD;GACA,MAAM,KAAK,aAAa,aAAa,KAAK,cAAc,UAAU;GAClE,IAAI,KAAK,cACP;GAEF,KAAK,WAAW,KAAK,aAAa,YAChC,KAAK,cAAc,UACrB;EACF;EACA,KAAK,mBAAmB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AI,OAAO,cACT,QAAQ,KACN,oDAAoD,SAAS,UAAU,GAAG,GAAG,GAC/E;CAEF,MAAM,YAAY,OAAO;CACzB,MAAM,eAAe,UAAU,SAAS;CACxC,MAAM,iBAA0C,CAAC;CACjD,MAAM,uBAA2C,CAAC;CAClD,IAAI,CAAC,iBAAiB,CAAC,6BACrB,OAAO;EACL,WAAW,OAAO;EAClB;EACA;CACF;CAEF,KAAK,IAAI,IAAI,GAAG,IAAI,cAAc,KAAK;EACrC,MAAM,SAAS,UAAU,IAAI;EAC7B,MAAM,aACJ,IAAI,IAAI,eAAe,UAAU,IAAI,IAAI,KAAK,SAAS;EACzD,IAAI,WAAW,YAEb;EAEF,MAAM,WAAW,UAAU,IAAI,IAAI;EACnC,IAAI,eAAe;GACjB,MAAM,KAAK,qBAAqB,cAAc,QAAQ;GACtD,eAAe,KAAK;IAClB;IACA,SAAS;IACT,SAAS,MAAM,QAAQ,UAAU;GACnC,CAAC;EACH;EACA,IACE,+BACA,qBAAqB,aAAa,QAAQ,IAAI,GAE9C,qBAAqB,KAAK,CAAC,QAAQ,UAAU,CAAC;CAElD;CACA,OAAO;EACL,WAAW,OAAO;EAClB;EACA;CACF;AACF;AAEA,SAAgB,iBACd,QAC0B;CAC1B,OAAO,OAAO,KAAK,CAAC,MAAM,IAAI,iBAAiB;EAC7C,IAAI,SAAS,KAAK,OAAO,IAAI;GAC3B,IAAI,gBAAgB,IAClB,OAAO,EAAE,IAAI;GAEf,OAAO;EACT;EACA,OAAO,EAAE,QAAQ;GACf,SAAS,EACP,MAAM,KAAK,SAAS,EACtB;GACA,OAAO,SAAS,GAAG;GACN;EACf,CAAC;CACH,CAAC;AACH;AAGA,SAAS,sBAAsB,YAA6B;CAC1D,OAAO,eAAe,UAAU,eAAe;AACjD"}
|
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
import { ChangeTypes, DiffLineAnnotation, FileContents, FileDiffMetadata, Hunk, LineAnnotation, SelectionSide } from "../types.js";
|
|
2
|
+
import { TextDocument } from "./textDocument.js";
|
|
3
|
+
import { Editor, EditorOptions } from "./editor.js";
|
|
4
|
+
//#region src/editor/types.d.ts
|
|
5
|
+
/** FileDiff baseline and hunk state needed to resume an editing session. */
|
|
6
|
+
interface RetainedDiffSessionSnapshot {
|
|
7
|
+
oldFile: {
|
|
8
|
+
name: string;
|
|
9
|
+
lines: string[];
|
|
10
|
+
} | null;
|
|
11
|
+
type: ChangeTypes;
|
|
12
|
+
hunks: Hunk[];
|
|
13
|
+
}
|
|
14
|
+
/** @internal Current diff state and whether the document changed while editing. */
|
|
15
|
+
interface CapturedDiffSessionState {
|
|
16
|
+
diffSession: RetainedDiffSessionSnapshot;
|
|
17
|
+
hasChanges: boolean;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* An edit-completion handler's decision: `'accept'` installs the completed
|
|
21
|
+
* value the event carries, `'reject'` restores the external input. The event
|
|
22
|
+
* is frozen, so re-key the accepted value in place (`event.file.cacheKey =
|
|
23
|
+
* '…'`) before returning `'accept'`.
|
|
24
|
+
*/
|
|
25
|
+
type EditCompletionDecision = 'accept' | 'reject';
|
|
26
|
+
interface EditorActiveLineOptions {
|
|
27
|
+
lineNumberOnly?: boolean;
|
|
28
|
+
side?: SelectionSide;
|
|
29
|
+
}
|
|
30
|
+
type EditorType = 'file' | 'file-diff';
|
|
31
|
+
/** Creates an editor whose editor type matches the supplied options. */
|
|
32
|
+
type EditorFactory<LAnnotation, Caret> = <EType extends EditorType>(editorType: EType, options: EditorOptions<EType, LAnnotation, Caret>, editStateKey?: string) => Editor<EType, LAnnotation, Caret>;
|
|
33
|
+
/**
|
|
34
|
+
* Position in a text document expressed as zero-based line and character offset.
|
|
35
|
+
* The offsets are based on a UTF-16 string representation. So a string of the form
|
|
36
|
+
* `a𐐀b` the character offset of the character `a` is 0, the character offset of `𐐀`
|
|
37
|
+
* is 1 and the character offset of b is 3 since `𐐀` is represented using two code
|
|
38
|
+
* units in UTF-16.
|
|
39
|
+
*
|
|
40
|
+
* Positions are line end character agnostic. So you can not specify a position that
|
|
41
|
+
* denotes `\r|\n` or `\n|` where `|` represents the character offset.
|
|
42
|
+
*/
|
|
43
|
+
interface Position {
|
|
44
|
+
/**
|
|
45
|
+
* Line position in a document (zero-based).
|
|
46
|
+
*
|
|
47
|
+
* If a line number is greater than the number of lines in a document, it
|
|
48
|
+
* defaults back to the number of lines in the document.
|
|
49
|
+
* If a line number is negative, it defaults to 0.
|
|
50
|
+
*
|
|
51
|
+
* The above two properties are implementation specific.
|
|
52
|
+
*/
|
|
53
|
+
readonly line: number;
|
|
54
|
+
/**
|
|
55
|
+
* Character offset on a line in a document (zero-based).
|
|
56
|
+
*
|
|
57
|
+
* The meaning of this offset is determined by the negotiated
|
|
58
|
+
* `PositionEncodingKind`.
|
|
59
|
+
*
|
|
60
|
+
* If the character value is greater than the line length it defaults back
|
|
61
|
+
* to the line length. This property is implementation specific.
|
|
62
|
+
*/
|
|
63
|
+
readonly character: number;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* A range in a text document expressed as (zero-based) start and end positions.
|
|
67
|
+
*
|
|
68
|
+
* If you want to specify a range that contains a line including the line ending
|
|
69
|
+
* character(s) then use an end position denoting the start of the next line.
|
|
70
|
+
* For example:
|
|
71
|
+
* ```ts
|
|
72
|
+
* {
|
|
73
|
+
* start: { line: 5, character: 23 }
|
|
74
|
+
* end : { line 6, character : 0 }
|
|
75
|
+
* }
|
|
76
|
+
* ```
|
|
77
|
+
*/
|
|
78
|
+
interface Range {
|
|
79
|
+
/**
|
|
80
|
+
* The range's start position.
|
|
81
|
+
*/
|
|
82
|
+
readonly start: Position;
|
|
83
|
+
/**
|
|
84
|
+
* The range's end position.
|
|
85
|
+
*/
|
|
86
|
+
readonly end: Position;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* A text edit applicable to a text document.
|
|
90
|
+
*/
|
|
91
|
+
interface TextEdit {
|
|
92
|
+
/**
|
|
93
|
+
* The range of the text document to be manipulated. To insert
|
|
94
|
+
* text into a document create a range where start === end.
|
|
95
|
+
*/
|
|
96
|
+
readonly range: Range;
|
|
97
|
+
/**
|
|
98
|
+
* The string to be inserted. For delete operations use an
|
|
99
|
+
* empty string.
|
|
100
|
+
*/
|
|
101
|
+
readonly newText: string;
|
|
102
|
+
}
|
|
103
|
+
/** Different with `TextEdit`, the range has been resolved to offsets. */
|
|
104
|
+
interface ResolvedTextEdit {
|
|
105
|
+
/** The start offset of the text change. */
|
|
106
|
+
readonly start: number;
|
|
107
|
+
/** The end offset of the text change. */
|
|
108
|
+
readonly end: number;
|
|
109
|
+
/** The string to be inserted. For delete operations use an empty string. */
|
|
110
|
+
readonly text: string;
|
|
111
|
+
}
|
|
112
|
+
/** A normalized text change reported by the editor. */
|
|
113
|
+
interface EditorChange extends ResolvedTextEdit {
|
|
114
|
+
/** The replaced range in the document before the change. */
|
|
115
|
+
range: Range;
|
|
116
|
+
}
|
|
117
|
+
type EditorLineAnnotation<EType extends EditorType = EditorType, LAnnotation = unknown> = EType extends 'file' ? LineAnnotation<LAnnotation> & {
|
|
118
|
+
side?: never;
|
|
119
|
+
} : DiffLineAnnotation<LAnnotation>;
|
|
120
|
+
/** The document and normalized edits reported after an editor change. */
|
|
121
|
+
type EditorChangeEvent<EType extends EditorType, LAnnotation, Caret> = EType extends EditorType ? {
|
|
122
|
+
changes: EditorChange[];
|
|
123
|
+
file: FileContents;
|
|
124
|
+
editor: Editor<EType, LAnnotation, Caret>;
|
|
125
|
+
lineAnnotations?: EditorLineAnnotation<EType, LAnnotation>[];
|
|
126
|
+
} : never;
|
|
127
|
+
/**
|
|
128
|
+
* The direction of a selection.
|
|
129
|
+
* -1: backward
|
|
130
|
+
* 0: none
|
|
131
|
+
* 1: forward
|
|
132
|
+
*/
|
|
133
|
+
type SelectionDirection = -1 | 0 | 1;
|
|
134
|
+
interface EditorSelection extends Range {
|
|
135
|
+
direction: SelectionDirection;
|
|
136
|
+
}
|
|
137
|
+
/** Visual metadata shared by a remote caret and its optional highlight. */
|
|
138
|
+
interface CaretMetadata {
|
|
139
|
+
/** CSS color used for the caret and its derived highlight tint. */
|
|
140
|
+
color: string;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* A non-editable, externally owned selection. This follows the browser's
|
|
144
|
+
* anchor/focus model: matching positions render a caret, and differing
|
|
145
|
+
* positions render a highlighted selection with its caret at `focus`.
|
|
146
|
+
*/
|
|
147
|
+
interface EditorCaret<T> {
|
|
148
|
+
anchor: Position;
|
|
149
|
+
focus: Position;
|
|
150
|
+
metadata: T & CaretMetadata;
|
|
151
|
+
}
|
|
152
|
+
interface EditorViewportState {
|
|
153
|
+
/** Horizontal position owned by the current editable code scroller. */
|
|
154
|
+
scrollLeft: number;
|
|
155
|
+
/** Vertical position of the editor viewport. */
|
|
156
|
+
scrollTop?: number;
|
|
157
|
+
}
|
|
158
|
+
interface EditorViewState {
|
|
159
|
+
selections?: EditorSelection[];
|
|
160
|
+
view?: EditorViewportState;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* `onEditComplete` event argument when a file edit session ends.
|
|
164
|
+
*
|
|
165
|
+
* `file` is a fresh FileContents with the final contents and no `cacheKey` set;
|
|
166
|
+
* accepting installs it.
|
|
167
|
+
*
|
|
168
|
+
* `originalFile` is the last `file` the component was given externally; a
|
|
169
|
+
* revert restores it.
|
|
170
|
+
*
|
|
171
|
+
* `lineAnnotations` is the completed annotation collection, potentially
|
|
172
|
+
* modified based on the edit changes to keep annotations aligned to their
|
|
173
|
+
* intended targets.
|
|
174
|
+
*
|
|
175
|
+
* `originalLineAnnotations` is the last collection provided to the component
|
|
176
|
+
* externally, which a revert keeps.
|
|
177
|
+
*/
|
|
178
|
+
interface FileEditCompleteEvent<LAnnotation, Caret> {
|
|
179
|
+
file: FileContents;
|
|
180
|
+
editor: Editor<'file', LAnnotation, Caret>;
|
|
181
|
+
lineAnnotations: LineAnnotation<LAnnotation>[] | undefined;
|
|
182
|
+
originalFile: FileContents;
|
|
183
|
+
originalLineAnnotations: LineAnnotation<LAnnotation>[];
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* `onEditComplete` event argument when a diff edit session ends.
|
|
187
|
+
*
|
|
188
|
+
* `fileDiff` is a freshly computed diff of the final contents with no
|
|
189
|
+
* `cacheKey` set; accepting installs it.
|
|
190
|
+
*
|
|
191
|
+
* `originalFileDiff` is the last `fileDiff` the component was given externally;
|
|
192
|
+
* a revert restores it.
|
|
193
|
+
*
|
|
194
|
+
* `oldFile`/`newFile` are the completed contents as a file pair, for updating
|
|
195
|
+
* file-pair or patch inputs. `null` marks the absent side of an added file (a
|
|
196
|
+
* deleted file cannot be edited).
|
|
197
|
+
*
|
|
198
|
+
* `lineAnnotations` is the completed annotation collection, potentially
|
|
199
|
+
* modified based on the edit changes to keep annotations aligned to their
|
|
200
|
+
* intended targets.
|
|
201
|
+
*
|
|
202
|
+
* `originalLineAnnotations` is the last collection provided to the component
|
|
203
|
+
* externally, which a revert keeps.
|
|
204
|
+
*/
|
|
205
|
+
interface FileDiffEditCompleteEvent<LAnnotation, Caret> {
|
|
206
|
+
fileDiff: FileDiffMetadata;
|
|
207
|
+
editor: Editor<'file-diff', LAnnotation, Caret>;
|
|
208
|
+
originalFileDiff: FileDiffMetadata;
|
|
209
|
+
oldFile: FileContents | null;
|
|
210
|
+
newFile: FileContents | null;
|
|
211
|
+
lineAnnotations: DiffLineAnnotation<LAnnotation>[] | undefined;
|
|
212
|
+
originalLineAnnotations: DiffLineAnnotation<LAnnotation>[];
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* The exact frozen file or diff completion event observed by the editor before
|
|
216
|
+
* the corresponding component completion callback.
|
|
217
|
+
*/
|
|
218
|
+
type EditorEditCompleteEvent<EType extends EditorType, LAnnotation, Caret> = EType extends 'file' ? FileEditCompleteEvent<LAnnotation, Caret> : FileDiffEditCompleteEvent<LAnnotation, Caret>;
|
|
219
|
+
type EditHistoryCoalescingMode = 'insert' | 'backspace' | 'delete';
|
|
220
|
+
/** One reversible document transaction. */
|
|
221
|
+
interface EditHistoryEntry<EType extends EditorType, LAnnotation = unknown> {
|
|
222
|
+
forwardEdits: ResolvedTextEdit[];
|
|
223
|
+
inverseEdits: ResolvedTextEdit[];
|
|
224
|
+
versionBefore: number;
|
|
225
|
+
versionAfter: number;
|
|
226
|
+
selectionsBefore?: EditorSelection[];
|
|
227
|
+
selectionsAfter?: EditorSelection[];
|
|
228
|
+
lineAnnotationsBefore?: EditorLineAnnotation<EType, LAnnotation>[];
|
|
229
|
+
lineAnnotationsAfter?: EditorLineAnnotation<EType, LAnnotation>[];
|
|
230
|
+
coalescingMode?: EditHistoryCoalescingMode;
|
|
231
|
+
undoBoundary?: boolean;
|
|
232
|
+
}
|
|
233
|
+
/** Undo and redo history for a document. */
|
|
234
|
+
interface EditHistoryState<EType extends EditorType, LAnnotation = unknown> {
|
|
235
|
+
undoStack: EditHistoryEntry<EType, LAnnotation>[];
|
|
236
|
+
redoStack: EditHistoryEntry<EType, LAnnotation>[];
|
|
237
|
+
maxEntries: number;
|
|
238
|
+
canCoalesce: boolean;
|
|
239
|
+
}
|
|
240
|
+
interface EditStateBase<EType extends EditorType, LAnnotation> {
|
|
241
|
+
document: TextDocument<EType, LAnnotation>;
|
|
242
|
+
fileInfo: Pick<FileContents, 'name' | 'lang'>;
|
|
243
|
+
editor: EditorViewState;
|
|
244
|
+
}
|
|
245
|
+
interface FileEditState<LAnnotation = unknown> extends EditStateBase<'file', LAnnotation> {
|
|
246
|
+
type: 'file';
|
|
247
|
+
diffSession?: never;
|
|
248
|
+
}
|
|
249
|
+
interface FileDiffEditState<LAnnotation = unknown> extends EditStateBase<'file-diff', LAnnotation> {
|
|
250
|
+
type: 'file-diff';
|
|
251
|
+
diffSession: RetainedDiffSessionSnapshot;
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* The editor-owned objects that make up a complete session. This state is
|
|
255
|
+
* transferred by reference when supplied as `initialState`.
|
|
256
|
+
*/
|
|
257
|
+
type EditState<EType extends EditorType = EditorType, LAnnotation = unknown> = EType extends 'file' ? FileEditState<LAnnotation> : FileDiffEditState<LAnnotation>;
|
|
258
|
+
/** State supplied to a new editor, completed from the attached component. */
|
|
259
|
+
type EditorInitialState<EType extends EditorType = EditorType, LAnnotation = unknown> = EType extends 'file' ? {
|
|
260
|
+
type: 'file';
|
|
261
|
+
} & Partial<Omit<FileEditState<LAnnotation>, 'type'>> : {
|
|
262
|
+
type: 'file-diff';
|
|
263
|
+
} & Partial<Omit<FileDiffEditState<LAnnotation>, 'type'>>;
|
|
264
|
+
//#endregion
|
|
265
|
+
export { CapturedDiffSessionState, CaretMetadata, EditCompletionDecision, EditHistoryCoalescingMode, EditHistoryEntry, EditHistoryState, EditState, EditorActiveLineOptions, EditorCaret, EditorChange, EditorChangeEvent, EditorEditCompleteEvent, EditorFactory, EditorInitialState, EditorLineAnnotation, EditorSelection, EditorType, EditorViewState, EditorViewportState, FileDiffEditCompleteEvent, FileDiffEditState, FileEditCompleteEvent, FileEditState, Position, Range, ResolvedTextEdit, RetainedDiffSessionSnapshot, SelectionDirection, TextEdit };
|
|
266
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","names":[],"sources":["../../src/editor/types.ts"],"mappings":";;;;;UAaiB;EACf;IAAW;IAAc;;EACzB,MAAM;EACN,OAAO;;;UAIQ;EACf,aAAa;EACb;;;;;;;;KASU;UAEK;EACf;EACA,OAAO;;KAGG;;KAGA,cAAc,aAAa,UAAU,cAAc,YAC7D,YAAY,OACZ,SAAS,cAAc,OAAO,aAAa,QAC3C,0BACG,OAAO,OAAO,aAAa;;;;;;;;;;;UAYf;;;;;;;;;;WAUN;;;;;;;;;;WAUA;;;;;;;;;;;;;;;UAgBM;;;;WAIN,OAAO;;;;WAIP,KAAK;;;;;UAMC;;;;;WAKN,OAAO;;;;;WAKP;;;UAIM;;WAEN;;WAE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cAAc,aAAa,YAC3B,yBACE,uBACA,cAAc,eACd,kBAAkB;;KAGV,mBACV,cAAc,aAAa,YAC3B,yBACE;EACE;IAAiB,QAAQ,KAAK,cAAc;EAC5C;IAAsB,QACtB,KAAK,kBAAkB"}
|
|
File without changes
|
|
@@ -4,6 +4,7 @@ declare function h<K extends keyof HTMLElementTagNameMap>(tagName: K, props?: {
|
|
|
4
4
|
dataset?: DOMStringMap | string[] | string;
|
|
5
5
|
children?: (Node | string)[];
|
|
6
6
|
} & Partial<Omit<HTMLElementTagNameMap[K], 'style' | 'dataset' | 'children'>>, parent?: Element | ShadowRoot | DocumentFragment): HTMLElementTagNameMap[K];
|
|
7
|
+
declare function isPromise<T>(value: T | Promise<T>): value is Promise<T>;
|
|
7
8
|
declare function addEventListener<K extends keyof HTMLElementEventMap>(el: HTMLElement, event: K, listener: (this: HTMLElement, evt: HTMLElementEventMap[K]) => void, options?: AddEventListenerOptions): () => void;
|
|
8
9
|
declare function addEventListener<K extends keyof DocumentEventMap>(el: Document, event: K, listener: (this: Document, evt: DocumentEventMap[K]) => void, options?: AddEventListenerOptions): () => void;
|
|
9
10
|
declare function addEventListener<K extends keyof WindowEventMap>(el: Window, event: K, listener: (this: Window, evt: WindowEventMap[K]) => void, options?: AddEventListenerOptions): () => void;
|
|
@@ -18,5 +19,5 @@ declare function createSegmenter(options: Intl.SegmenterOptions): Intl.Segmenter
|
|
|
18
19
|
declare function getGraphemeSegmenter(): Intl.Segmenter | undefined;
|
|
19
20
|
declare function lookupScrollContainer(element: HTMLElement): HTMLElement | Document;
|
|
20
21
|
//#endregion
|
|
21
|
-
export { addEventListener, clampDomOffset, createSegmenter, debounce, endsWithLineBreak, extend, getGraphemeSegmenter, getLineNumberAttr, h, lookupScrollContainer, round };
|
|
22
|
+
export { addEventListener, clampDomOffset, createSegmenter, debounce, endsWithLineBreak, extend, getGraphemeSegmenter, getLineNumberAttr, h, isPromise, lookupScrollContainer, round };
|
|
22
23
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","names":[],"sources":["../../src/editor/utils.ts"],"mappings":";iBAAgB,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","names":[],"sources":["../../src/editor/utils.ts"],"mappings":";iBAAgB,EAAE,gBAAgB,uBAChC,SAAS,GACT;EACE,iBAAiB,QAAQ;EACzB,UAAU;EACV,YAAY;IACV,QAAQ,KAAK,sBAAsB,wCACvC,SAAS,UAAU,aAAa,mBAC/B,sBAAsB;iBA+BT,UAAU,GAAG,OAAO,IAAI,QAAQ,KAAK,SAAS,QAAQ;iBAStD,iBAAiB,gBAAgB,qBAC/C,IAAI,aACJ,OAAO,GACP,WAAW,MAAM,aAAa,KAAK,oBAAoB,aACvD,UAAU;iBAEI,iBAAiB,gBAAgB,kBAC/C,IAAI,UACJ,OAAO,GACP,WAAW,MAAM,UAAU,KAAK,iBAAiB,aACjD,UAAU;iBAEI,iBAAiB,gBAAgB,gBAC/C,IAAI,QACJ,OAAO,GACP,WAAW,MAAM,QAAQ,KAAK,eAAe,aAC7C,UAAU;iBAEI,iBAAiB,gBAAgB,wBAC/C,IAAI,gBACJ,OAAO,GACP,WAAW,MAAM,gBAAgB,KAAK,uBAAuB,aAC7D,UAAU;iBAYI,kBACd,IAAI,aACJ;iBAac,eAAe,MAAM,MAAM;iBAW3B,OAAO,kBAAkB,KAAK,GAAG,OAAO,QAAQ,KAAK;iBAKrD,SAAS,cAAc,sBACrC,MAAM,GACN,mBACK,MAAM,WAAW;iBAQR,MAAM,eAAe;iBAIrB,kBAAkB;iBAMlB,gBACd,SAAS,KAAK,mBACb,KAAK;iBAYQ,wBAAwB,KAAK;iBAS7B,sBACd,SAAS,cACR,cAAc"}
|
|
@@ -3,17 +3,24 @@ function h(tagName, props, parent) {
|
|
|
3
3
|
const { style, dataset, children, ...attrs } = props ?? {};
|
|
4
4
|
const el = document.createElement(tagName);
|
|
5
5
|
Object.assign(el, attrs);
|
|
6
|
-
if (style !== void 0)
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
if (style !== void 0) {
|
|
7
|
+
if (typeof style === "string") el.style.cssText = style;
|
|
8
|
+
else Object.assign(el.style, style);
|
|
9
|
+
}
|
|
10
|
+
if (dataset !== void 0) {
|
|
11
|
+
if (typeof dataset === "string") el.dataset[dataset] = "";
|
|
12
|
+
else if (Array.isArray(dataset)) dataset.forEach((key) => {
|
|
13
|
+
el.dataset[key] = "";
|
|
14
|
+
});
|
|
15
|
+
else Object.assign(el.dataset, dataset);
|
|
16
|
+
}
|
|
13
17
|
if (children !== void 0) el.replaceChildren(...children);
|
|
14
18
|
if (parent !== void 0) parent.appendChild(el);
|
|
15
19
|
return el;
|
|
16
20
|
}
|
|
21
|
+
function isPromise(value) {
|
|
22
|
+
return typeof value === "object" && value !== null && "then" in value && typeof value.then === "function";
|
|
23
|
+
}
|
|
17
24
|
function addEventListener(el, event, listener, options) {
|
|
18
25
|
el.addEventListener(event, listener, options);
|
|
19
26
|
return () => el.removeEventListener(event, listener, options);
|
|
@@ -73,6 +80,6 @@ function lookupScrollContainer(element) {
|
|
|
73
80
|
return ownerDocument;
|
|
74
81
|
}
|
|
75
82
|
//#endregion
|
|
76
|
-
export { addEventListener, clampDomOffset, createSegmenter, debounce, endsWithLineBreak, extend, getGraphemeSegmenter, getLineNumberAttr, h, lookupScrollContainer, round };
|
|
83
|
+
export { addEventListener, clampDomOffset, createSegmenter, debounce, endsWithLineBreak, extend, getGraphemeSegmenter, getLineNumberAttr, h, isPromise, lookupScrollContainer, round };
|
|
77
84
|
|
|
78
85
|
//# sourceMappingURL=utils.js.map
|