@pierre/diffs 1.3.0-beta.3 → 1.3.0-beta.4

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.
Files changed (132) hide show
  1. package/dist/components/CodeView.d.ts.map +1 -1
  2. package/dist/components/File.d.ts +2 -2
  3. package/dist/components/File.d.ts.map +1 -1
  4. package/dist/components/File.js +11 -11
  5. package/dist/components/File.js.map +1 -1
  6. package/dist/components/FileDiff.d.ts +7 -4
  7. package/dist/components/FileDiff.d.ts.map +1 -1
  8. package/dist/components/FileDiff.js +56 -47
  9. package/dist/components/FileDiff.js.map +1 -1
  10. package/dist/components/UnresolvedFile.d.ts.map +1 -1
  11. package/dist/components/UnresolvedFile.js +1 -1
  12. package/dist/components/VirtualizedFile.d.ts +1 -1
  13. package/dist/components/VirtualizedFile.d.ts.map +1 -1
  14. package/dist/components/VirtualizedFile.js +7 -3
  15. package/dist/components/VirtualizedFile.js.map +1 -1
  16. package/dist/components/VirtualizedFileDiff.d.ts +2 -1
  17. package/dist/components/VirtualizedFileDiff.d.ts.map +1 -1
  18. package/dist/components/VirtualizedFileDiff.js +14 -0
  19. package/dist/components/VirtualizedFileDiff.js.map +1 -1
  20. package/dist/components/VirtulizerDevelopment.d.ts.map +1 -1
  21. package/dist/editor/editStack.d.ts +1 -1
  22. package/dist/editor/editor.d.ts +10 -8
  23. package/dist/editor/editor.d.ts.map +1 -1
  24. package/dist/editor/editor.js +386 -339
  25. package/dist/editor/editor.js.map +1 -1
  26. package/dist/editor/editor2.js +1 -1
  27. package/dist/editor/editor2.js.map +1 -1
  28. package/dist/editor/lineAnnotations.d.ts +2 -1
  29. package/dist/editor/lineAnnotations.d.ts.map +1 -1
  30. package/dist/editor/lineAnnotations.js +111 -1
  31. package/dist/editor/lineAnnotations.js.map +1 -1
  32. package/dist/editor/marker.d.ts +33 -0
  33. package/dist/editor/marker.d.ts.map +1 -0
  34. package/dist/editor/marker.js +185 -0
  35. package/dist/editor/marker.js.map +1 -0
  36. package/dist/editor/pieceTable.d.ts +2 -2
  37. package/dist/editor/pieceTable.d.ts.map +1 -1
  38. package/dist/editor/pieceTable.js +42 -11
  39. package/dist/editor/pieceTable.js.map +1 -1
  40. package/dist/editor/searchPanel.js +2 -2
  41. package/dist/editor/searchPanel.js.map +1 -1
  42. package/dist/editor/selection.d.ts +19 -3
  43. package/dist/editor/selection.d.ts.map +1 -1
  44. package/dist/editor/selection.js +188 -37
  45. package/dist/editor/selection.js.map +1 -1
  46. package/dist/editor/{quickEdit.d.ts → selectionAction.d.ts} +8 -8
  47. package/dist/editor/selectionAction.d.ts.map +1 -0
  48. package/dist/editor/{quickEdit.js → selectionAction.js} +18 -18
  49. package/dist/editor/selectionAction.js.map +1 -0
  50. package/dist/editor/sprite.d.ts +3 -2
  51. package/dist/editor/sprite.d.ts.map +1 -1
  52. package/dist/editor/sprite.js +9 -2
  53. package/dist/editor/sprite.js.map +1 -1
  54. package/dist/editor/textDocument.d.ts +4 -4
  55. package/dist/editor/textDocument.d.ts.map +1 -1
  56. package/dist/editor/textDocument.js +7 -7
  57. package/dist/editor/textDocument.js.map +1 -1
  58. package/dist/editor/tokenzier.js +11 -3
  59. package/dist/editor/tokenzier.js.map +1 -1
  60. package/dist/editor/utils.d.ts +3 -1
  61. package/dist/editor/utils.d.ts.map +1 -1
  62. package/dist/editor/utils.js +16 -1
  63. package/dist/editor/utils.js.map +1 -1
  64. package/dist/highlighter/shared_highlighter.js +3 -29
  65. package/dist/highlighter/shared_highlighter.js.map +1 -1
  66. package/dist/highlighter/themes/attachResolvedThemes.js +4 -3
  67. package/dist/highlighter/themes/attachResolvedThemes.js.map +1 -1
  68. package/dist/highlighter/themes/cleanUpResolvedThemes.js +3 -2
  69. package/dist/highlighter/themes/cleanUpResolvedThemes.js.map +1 -1
  70. package/dist/highlighter/themes/constants.d.ts +1 -7
  71. package/dist/highlighter/themes/constants.d.ts.map +1 -1
  72. package/dist/highlighter/themes/constants.js +1 -4
  73. package/dist/highlighter/themes/constants.js.map +1 -1
  74. package/dist/highlighter/themes/getResolvedOrResolveTheme.js +2 -2
  75. package/dist/highlighter/themes/getResolvedOrResolveTheme.js.map +1 -1
  76. package/dist/highlighter/themes/getResolvedThemes.js +2 -8
  77. package/dist/highlighter/themes/getResolvedThemes.js.map +1 -1
  78. package/dist/highlighter/themes/hasResolvedThemes.js +2 -3
  79. package/dist/highlighter/themes/hasResolvedThemes.js.map +1 -1
  80. package/dist/highlighter/themes/registerCustomCSSVariableTheme.js +1 -1
  81. package/dist/highlighter/themes/registerCustomTheme.d.ts +5 -3
  82. package/dist/highlighter/themes/registerCustomTheme.d.ts.map +1 -1
  83. package/dist/highlighter/themes/registerCustomTheme.js +15 -5
  84. package/dist/highlighter/themes/registerCustomTheme.js.map +1 -1
  85. package/dist/highlighter/themes/resolveTheme.js +6 -27
  86. package/dist/highlighter/themes/resolveTheme.js.map +1 -1
  87. package/dist/highlighter/themes/resolveThemes.js +5 -12
  88. package/dist/highlighter/themes/resolveThemes.js.map +1 -1
  89. package/dist/highlighter/themes/themeResolution.d.ts +8 -0
  90. package/dist/highlighter/themes/themeResolution.d.ts.map +1 -0
  91. package/dist/highlighter/themes/themeResolution.js +22 -0
  92. package/dist/highlighter/themes/themeResolution.js.map +1 -0
  93. package/dist/highlighter/themes/themeResolver.d.ts +8 -0
  94. package/dist/highlighter/themes/themeResolver.d.ts.map +1 -0
  95. package/dist/highlighter/themes/themeResolver.js +8 -0
  96. package/dist/highlighter/themes/themeResolver.js.map +1 -0
  97. package/dist/index.d.ts +4 -4
  98. package/dist/index.js +3 -3
  99. package/dist/react/index.d.ts +2 -2
  100. package/dist/react/jsx.d.ts.map +1 -1
  101. package/dist/react/utils/useFileDiffInstance.js +1 -0
  102. package/dist/react/utils/useFileDiffInstance.js.map +1 -1
  103. package/dist/renderers/DiffHunksRenderer.d.ts +4 -1
  104. package/dist/renderers/DiffHunksRenderer.d.ts.map +1 -1
  105. package/dist/renderers/DiffHunksRenderer.js +134 -10
  106. package/dist/renderers/DiffHunksRenderer.js.map +1 -1
  107. package/dist/renderers/FileRenderer.d.ts +2 -2
  108. package/dist/renderers/FileRenderer.d.ts.map +1 -1
  109. package/dist/renderers/FileRenderer.js +5 -5
  110. package/dist/renderers/FileRenderer.js.map +1 -1
  111. package/dist/ssr/index.d.ts +2 -2
  112. package/dist/types.d.ts +9 -7
  113. package/dist/types.d.ts.map +1 -1
  114. package/dist/utils/getHighlighterThemeStyles.js +16 -12
  115. package/dist/utils/getHighlighterThemeStyles.js.map +1 -1
  116. package/dist/utils/parsePatchFiles.js +93 -4
  117. package/dist/utils/parsePatchFiles.js.map +1 -1
  118. package/dist/utils/updateDiffHunks.d.ts +13 -0
  119. package/dist/utils/updateDiffHunks.d.ts.map +1 -0
  120. package/dist/utils/updateDiffHunks.js +171 -0
  121. package/dist/utils/updateDiffHunks.js.map +1 -0
  122. package/dist/utils/virtualDiffLayout.d.ts +2 -1
  123. package/dist/utils/virtualDiffLayout.d.ts.map +1 -1
  124. package/dist/utils/virtualDiffLayout.js +9 -1
  125. package/dist/utils/virtualDiffLayout.js.map +1 -1
  126. package/dist/worker/worker-portable.js +727 -22
  127. package/dist/worker/worker-portable.js.map +1 -1
  128. package/dist/worker/worker.js +23 -15
  129. package/dist/worker/worker.js.map +1 -1
  130. package/package.json +2 -1
  131. package/dist/editor/quickEdit.d.ts.map +0 -1
  132. package/dist/editor/quickEdit.js.map +0 -1
@@ -1,8 +1,8 @@
1
- import { TextDocument, TextEdit } from "./textDocument.js";
2
1
  import { EditorSelection } from "./selection.js";
2
+ import { TextDocument, TextEdit } from "./textDocument.js";
3
3
 
4
- //#region src/editor/quickEdit.d.ts
5
- interface QuickEditContext<LAnnotation> {
4
+ //#region src/editor/selectionAction.d.ts
5
+ interface SelectionActionContext<LAnnotation> {
6
6
  /** The current selection. */
7
7
  selection: EditorSelection;
8
8
  /** The text document. */
@@ -13,17 +13,17 @@ interface QuickEditContext<LAnnotation> {
13
13
  getSelectionText: () => string;
14
14
  /** Replaces the text of the current selection. */
15
15
  replaceSelectionText: (text: string) => void;
16
- /** Closes the quick edit. */
16
+ /** Closes the selection action. */
17
17
  close: () => void;
18
18
  }
19
- declare class QuickEditWidget {
19
+ declare class SelectionActionWidget {
20
20
  #private;
21
21
  line: number;
22
22
  static renderIcon(x: number, y: number, container: HTMLElement | DocumentFragment, onclick: () => void): HTMLElement;
23
- constructor(line: number, quickEditElement: HTMLElement, fileContainer: HTMLElement, leadingWhitespaces: number | undefined, handleDomResize: () => void);
23
+ constructor(line: number, selectionActionElement: HTMLElement, fileContainer: HTMLElement, leadingWhitespaces: number | undefined, handleDomResize: () => void);
24
24
  render(containerElement: HTMLElement): void;
25
25
  cleanup(): void;
26
26
  }
27
27
  //#endregion
28
- export { QuickEditContext, QuickEditWidget };
29
- //# sourceMappingURL=quickEdit.d.ts.map
28
+ export { SelectionActionContext, SelectionActionWidget };
29
+ //# sourceMappingURL=selectionAction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"selectionAction.d.ts","names":["EditorSelection","TextDocument","TextEdit","SelectionActionContext","LAnnotation","SelectionActionWidget","HTMLElement","DocumentFragment"],"sources":["../../src/editor/selectionAction.d.ts"],"sourcesContent":["import type { EditorSelection } from './selection';\nimport type { TextDocument, TextEdit } from './textDocument';\nexport interface SelectionActionContext<LAnnotation> {\n /** The current selection. */\n selection: EditorSelection;\n /** The text document. */\n textDocument: TextDocument<LAnnotation>;\n /** Applies the edits to the text document. */\n applyEdits: (edits: TextEdit[]) => void;\n /** Gets the text of the current selection. */\n getSelectionText: () => string;\n /** Replaces the text of the current selection. */\n replaceSelectionText: (text: string) => void;\n /** Closes the selection action. */\n close: () => void;\n}\nexport declare class SelectionActionWidget {\n #private;\n line: number;\n static renderIcon(x: number, y: number, container: HTMLElement | DocumentFragment, onclick: () => void): HTMLElement;\n constructor(line: number, selectionActionElement: HTMLElement, fileContainer: HTMLElement, leadingWhitespaces: number | undefined, handleDomResize: () => void);\n render(containerElement: HTMLElement): void;\n cleanup(): void;\n}\n//# sourceMappingURL=selectionAction.d.ts.map"],"mappings":";;;;UAEiBG;;EAAAA,SAAAA,EAEFH,eAFwB;EAExBA;EAEgBI,YAAAA,EAAbH,YAAaG,CAAAA,WAAAA,CAAAA;EAAbH;EAEMC,UAAAA,EAAAA,CAAAA,KAAAA,EAAAA,QAAAA,EAAAA,EAAAA,GAAAA,IAAAA;EAAQ;EAQXG,gBAAAA,EAAAA,GAAAA,GAAqB,MAAA;EAGaC;EAAcC,oBAAAA,EAAAA,CAAAA,IAAAA,EAAAA,MAAAA,EAAAA,GAAAA,IAAAA;EAAwCD;EACvDA,KAAAA,EAAAA,GAAAA,GAAAA,IAAAA;;AACzBA,cALRD,qBAAAA,CAKQC;EAAW,CAAA,OAAA;;qDAFeA,cAAcC,wCAAwCD;oDACvDA,4BAA4BA;2BACrDA"}
@@ -1,43 +1,43 @@
1
- import { getEditorIconSvg } from "./sprite.js";
2
1
  import { h } from "./utils.js";
2
+ import { getEditorIconSvg } from "./sprite.js";
3
3
 
4
- //#region src/editor/quickEdit.ts
5
- var QuickEditWidget = class {
4
+ //#region src/editor/selectionAction.ts
5
+ var SelectionActionWidget = class {
6
6
  static renderIcon(x, y, container, onclick) {
7
7
  return h("div", {
8
8
  dataset: {
9
- quickEditIcon: "",
9
+ selectionActionIcon: "",
10
10
  visible: "false"
11
11
  },
12
- title: "Quick Edit",
12
+ title: "Selection Action",
13
13
  style: { transform: `translateY(${y}px) translateX(${x}px)` },
14
14
  innerHTML: getEditorIconSvg("quick"),
15
15
  onclick
16
16
  }, container);
17
17
  }
18
18
  #gutterBuffer;
19
- #quickEditContainer;
19
+ #selectionActionContainer;
20
20
  #slot;
21
21
  #observer;
22
22
  #handleDomResize;
23
- constructor(line, quickEditElement, fileContainer, leadingWhitespaces = 0, handleDomResize) {
23
+ constructor(line, selectionActionElement, fileContainer, leadingWhitespaces = 0, handleDomResize) {
24
24
  this.line = line;
25
- const slotName = "quick-edit-" + line;
25
+ const slotName = "selection-action-" + line;
26
26
  this.#slot = h("div", {
27
- dataset: "quickEditSlot",
27
+ dataset: "selectionActionSlot",
28
28
  slot: slotName,
29
29
  style: "white-space: normal",
30
- children: [quickEditElement]
30
+ children: [selectionActionElement]
31
31
  }, fileContainer);
32
32
  this.#gutterBuffer = h("div", {
33
33
  dataset: {
34
- gutterBuffer: "quickEdit",
34
+ gutterBuffer: "selectionAction",
35
35
  bufferSize: "1"
36
36
  },
37
37
  style: "grid-row: span 1"
38
38
  });
39
- this.#quickEditContainer = h("div", {
40
- dataset: { quickEdit: String(line) },
39
+ this.#selectionActionContainer = h("div", {
40
+ dataset: { selectionAction: String(line) },
41
41
  style: { paddingInlineStart: leadingWhitespaces + 1 + "ch" },
42
42
  contentEditable: "false",
43
43
  children: [h("slot", { name: slotName })]
@@ -53,7 +53,7 @@ var QuickEditWidget = class {
53
53
  const contentLineElement = containerElement.querySelector(`[data-line="${lineNumber}"]`);
54
54
  if (gutterElement != null && gutterLineElement != null && contentLineElement != null) {
55
55
  gutterLineElement.after(this.#gutterBuffer);
56
- contentLineElement.after(this.#quickEditContainer);
56
+ contentLineElement.after(this.#selectionActionContainer);
57
57
  gutterElement.style.gridRow = "span " + gutterElement.children.length;
58
58
  containerElement.style.gridRow = "span " + containerElement.children.length;
59
59
  this.#handleDomResize();
@@ -61,9 +61,9 @@ var QuickEditWidget = class {
61
61
  }
62
62
  cleanup() {
63
63
  const gutter = this.#gutterBuffer.parentElement;
64
- const content = this.#quickEditContainer.parentElement;
64
+ const content = this.#selectionActionContainer.parentElement;
65
65
  this.#gutterBuffer.remove();
66
- this.#quickEditContainer.remove();
66
+ this.#selectionActionContainer.remove();
67
67
  if (gutter != null && content != null) {
68
68
  gutter.style.gridRow = "span " + gutter.children.length;
69
69
  content.style.gridRow = "span " + content.children.length;
@@ -75,5 +75,5 @@ var QuickEditWidget = class {
75
75
  };
76
76
 
77
77
  //#endregion
78
- export { QuickEditWidget };
79
- //# sourceMappingURL=quickEdit.js.map
78
+ export { SelectionActionWidget };
79
+ //# sourceMappingURL=selectionAction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"selectionAction.js","names":["line: number","#slot","#gutterBuffer","#selectionActionContainer","#observer","#handleDomResize"],"sources":["../../src/editor/selectionAction.ts"],"sourcesContent":["import type { EditorSelection } from './selection';\nimport { getEditorIconSvg } from './sprite';\nimport type { TextDocument, TextEdit } from './textDocument';\nimport { h } from './utils';\n\nexport interface SelectionActionContext<LAnnotation> {\n /** The current selection. */\n selection: EditorSelection;\n /** The text document. */\n textDocument: TextDocument<LAnnotation>;\n /** Applies the edits to the text document. */\n applyEdits: (edits: TextEdit[]) => void;\n /** Gets the text of the current selection. */\n getSelectionText: () => string;\n /** Replaces the text of the current selection. */\n replaceSelectionText: (text: string) => void;\n /** Closes the selection action. */\n close: () => void;\n}\n\nexport class SelectionActionWidget {\n static renderIcon(\n x: number,\n y: number,\n container: HTMLElement | DocumentFragment,\n onclick: () => void\n ): HTMLElement {\n return h(\n 'div',\n {\n dataset: { selectionActionIcon: '', visible: 'false' },\n title: 'Selection Action',\n style: {\n transform: `translateY(${y}px) translateX(${x}px)`,\n },\n innerHTML: getEditorIconSvg('quick'),\n onclick,\n },\n container\n );\n }\n\n #gutterBuffer: HTMLElement;\n #selectionActionContainer: HTMLElement;\n #slot: HTMLElement;\n #observer: ResizeObserver;\n #handleDomResize: () => void;\n\n constructor(\n public line: number,\n selectionActionElement: HTMLElement,\n fileContainer: HTMLElement,\n leadingWhitespaces = 0,\n handleDomResize: () => void\n ) {\n const slotName = 'selection-action-' + line;\n this.#slot = h(\n 'div',\n {\n dataset: 'selectionActionSlot',\n slot: slotName,\n style: 'white-space: normal',\n children: [selectionActionElement],\n },\n fileContainer\n );\n this.#gutterBuffer = h('div', {\n dataset: { gutterBuffer: 'selectionAction', bufferSize: '1' },\n style: 'grid-row: span 1',\n });\n this.#selectionActionContainer = h('div', {\n dataset: { selectionAction: String(line) },\n style: {\n paddingInlineStart: leadingWhitespaces + 1 + 'ch', // +1 align css `padding-inline`\n },\n contentEditable: 'false',\n children: [h('slot', { name: slotName })],\n });\n this.#observer = new ResizeObserver(handleDomResize);\n this.#observer.observe(this.#slot);\n this.#handleDomResize = handleDomResize;\n }\n\n render(containerElement: HTMLElement): void {\n const gutterElement =\n containerElement.previousElementSibling as HTMLElement | null;\n const lineNumber = this.line + 1;\n const gutterLineElement = gutterElement?.querySelector<HTMLElement>(\n `[data-column-number=\"${lineNumber}\"]`\n );\n const contentLineElement = containerElement.querySelector<HTMLElement>(\n `[data-line=\"${lineNumber}\"]`\n );\n if (\n gutterElement != null &&\n gutterLineElement != null &&\n contentLineElement != null\n ) {\n gutterLineElement.after(this.#gutterBuffer);\n contentLineElement.after(this.#selectionActionContainer);\n gutterElement.style.gridRow = 'span ' + gutterElement.children.length;\n containerElement.style.gridRow =\n 'span ' + containerElement.children.length;\n this.#handleDomResize();\n }\n }\n\n cleanup(): void {\n const gutter = this.#gutterBuffer.parentElement;\n const content = this.#selectionActionContainer.parentElement;\n\n this.#gutterBuffer.remove();\n this.#selectionActionContainer.remove();\n\n if (gutter != null && content != null) {\n gutter.style.gridRow = 'span ' + gutter.children.length;\n content.style.gridRow = 'span ' + content.children.length;\n }\n this.#handleDomResize();\n\n this.#slot.remove();\n this.#observer.disconnect();\n }\n}\n"],"mappings":";;;;AAoBA,IAAa,wBAAb,MAAmC;CACjC,OAAO,WACL,GACA,GACA,WACA,SACa;AACb,SAAO,EACL,OACA;GACE,SAAS;IAAE,qBAAqB;IAAI,SAAS;IAAS;GACtD,OAAO;GACP,OAAO,EACL,WAAW,cAAc,EAAE,iBAAiB,EAAE,MAC/C;GACD,WAAW,iBAAiB,QAAQ;GACpC;GACD,EACD,UACD;;CAGH;CACA;CACA;CACA;CACA;CAEA,YACE,AAAOA,MACP,wBACA,eACA,qBAAqB,GACrB,iBACA;EALO;EAMP,MAAM,WAAW,sBAAsB;AACvC,QAAKC,OAAQ,EACX,OACA;GACE,SAAS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AAU,YAAY"}
@@ -1,7 +1,8 @@
1
1
  //#region src/editor/sprite.d.ts
2
2
  type SVGSpriteNames = 'arrow-down' | 'arrow-up' | 'case' | 'close' | 'quick' | 'regex' | 'search' | 'whole-word';
3
- declare const SVGSpriteSheet = "<svg data-editor-icon-sprite aria-hidden=\"true\" width=\"0\" height=\"0\">\n <symbol id=\"diffs-editor-icon-search\" viewBox=\"0 0 16 16\">\n <path fill=\"currentColor\" fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M10.7747 12.8961C9.68558 13.5948 8.39011 14 7 14C3.13401 14 0 10.866 0 7C0 3.13401 3.13401 0 7 0C10.866 0 14 3.13401 14 7C14 8.39011 13.5948 9.68558 12.8961 10.7747L15.5607 13.4393C16.1464 14.0251 16.1464 14.9749 15.5607 15.5607C14.9749 16.1464 14.0251 16.1464 13.4393 15.5607L10.7747 12.8961ZM7 1.5C10.0376 1.5 12.5 3.96243 12.5 7C12.5 10.0376 10.0376 12.5 7 12.5C3.96243 12.5 1.5 10.0376 1.5 7C1.5 3.96243 3.96243 1.5 7 1.5Z\"></path>\n </symbol>\n <symbol id=\"diffs-editor-icon-close\" viewBox=\"0 0 16 16\">\n <path fill=\"currentColor\" d=\"M3.21967 3.21967C3.51256 2.92678 3.98744 2.92678 4.28033 3.21967L8 6.93934L11.7197 3.21967C12.0126 2.92678 12.4874 2.92678 12.7803 3.21967C13.0732 3.51256 13.0732 3.98744 12.7803 4.28033L9.06066 8L12.7803 11.7197C13.0732 12.0126 13.0732 12.4874 12.7803 12.7803C12.4874 13.0732 12.0126 13.0732 11.7197 12.7803L8 9.06066L4.28033 12.7803C3.98744 13.0732 3.51256 13.0732 3.21967 12.7803C2.92678 12.4874 2.92678 12.0126 3.21967 11.7197L6.93934 8L3.21967 4.28033C2.92678 3.98744 2.92678 3.51256 3.21967 3.21967Z\"></path>\n </symbol>\n <symbol id=\"diffs-editor-icon-arrow-up\" viewBox=\"0 0 16 16\">\n <path fill=\"currentColor\" transform=\"rotate(-90 8 8)\" d=\"M8.46967 4.21967C8.17678 4.51256 8.17678 4.98744 8.46967 5.28033L10.4393 7.25H3.75C3.33579 7.25 3 7.58579 3 8C3 8.41421 3.33579 8.75 3.75 8.75H10.4393L8.46967 10.7197C8.17678 11.0126 8.17678 11.4874 8.46967 11.7803C8.76256 12.0732 9.23744 12.0732 9.53033 11.7803L12.7803 8.53033C13.0732 8.23744 13.0732 7.76256 12.7803 7.46967L9.53033 4.21967C9.23744 3.92678 8.76256 3.92678 8.46967 4.21967Z\"></path>\n </symbol>\n <symbol id=\"diffs-editor-icon-arrow-down\" viewBox=\"0 0 16 16\">\n <path fill=\"currentColor\" transform=\"rotate(90 8 8)\" d=\"M8.46967 4.21967C8.17678 4.51256 8.17678 4.98744 8.46967 5.28033L10.4393 7.25H3.75C3.33579 7.25 3 7.58579 3 8C3 8.41421 3.33579 8.75 3.75 8.75H10.4393L8.46967 10.7197C8.17678 11.0126 8.17678 11.4874 8.46967 11.7803C8.76256 12.0732 9.23744 12.0732 9.53033 11.7803L12.7803 8.53033C13.0732 8.23744 13.0732 7.76256 12.7803 7.46967L9.53033 4.21967C9.23744 3.92678 8.76256 3.92678 8.46967 4.21967Z\"></path>\n </symbol>\n <symbol id=\"diffs-editor-icon-case\" viewBox=\"0 0 16 16\">\n <path fill=\"currentColor\" d=\"M12.2969 12.9969C10.7109 12.9969 9.61719 12.0125 9.61719 10.5047C9.61719 9.06719 10.6172 8.16094 12.5 8.15312H14.6641V7.31719C14.6641 6.23906 14.0391 5.64531 12.9297 5.64531C11.875 5.64531 11.2734 6.18437 11.1953 7.00469H9.92969C10.0156 5.56719 10.9922 4.52031 12.9766 4.52031C14.7266 4.52031 16 5.47344 16 7.2V12.8641H14.7109V11.8406H14.6719C14.2578 12.5047 13.5078 12.9969 12.2969 12.9969ZM12.6562 11.8797C13.8047 11.8797 14.6641 11.1609 14.6641 10.1375V9.18437H12.6016C11.4766 9.18437 10.9922 9.71562 10.9922 10.4578C10.9922 11.4266 11.7969 11.8797 12.6562 11.8797Z\"></path>\n <path fill=\"currentColor\" d=\"M1.42188 12.8641H0L3.79688 2H5.1875L8.98438 12.8641H7.54688L6.46875 9.66094H2.5L1.42188 12.8641ZM4.50781 3.60938H4.46875L2.86719 8.55937H6.10156L4.50781 3.60938Z\"></path>\n </symbol>\n <symbol id=\"diffs-editor-icon-whole-word\" viewBox=\"0 0 16 16\">\n <path fill=\"currentColor\" d=\"M11.4089 9.99449C11.1417 9.99449 10.8961 9.95595 10.6722 9.87887C10.4519 9.80179 10.2605 9.69167 10.098 9.54852C9.93551 9.40537 9.81453 9.23469 9.73508 9.03648H9.67007V9.91191H8.5V2H9.70258V5.01721H9.76758C9.81092 4.86671 9.88314 4.7309 9.98426 4.60977C10.089 4.48497 10.2136 4.37853 10.358 4.29043C10.5025 4.19867 10.6668 4.13076 10.851 4.08672C11.0352 4.039 11.2302 4.01514 11.436 4.01514C11.8802 4.01514 12.2648 4.11792 12.5898 4.32347C12.9149 4.52535 13.164 4.81532 13.3374 5.19339C13.5107 5.57146 13.5974 6.02478 13.5974 6.55334V7.45079C13.5974 7.97568 13.5089 8.429 13.332 8.81074C13.1586 9.1888 12.9076 9.48061 12.579 9.68617C12.2504 9.89172 11.8604 9.99449 11.4089 9.99449ZM11.0785 8.99243C11.353 8.99243 11.5859 8.92636 11.7773 8.79422C11.9723 8.66208 12.1204 8.46937 12.2215 8.2161C12.3226 7.95916 12.3732 7.65267 12.3732 7.29663V6.73503C12.3732 6.37164 12.3208 6.06332 12.2161 5.81005C12.115 5.55311 11.9669 5.35673 11.7719 5.22092C11.5769 5.08511 11.3385 5.01721 11.0568 5.01721C10.7824 5.01721 10.5422 5.08328 10.3364 5.21542C10.1341 5.34389 9.97704 5.52925 9.86509 5.77151C9.75675 6.01009 9.70258 6.2964 9.70258 6.63042V7.47281C9.70258 7.77013 9.76036 8.03441 9.87592 8.26566C9.99509 8.49323 10.1576 8.67125 10.3635 8.79972C10.5729 8.92819 10.8113 8.99243 11.0785 8.99243Z\"></path>\n <path fill=\"currentColor\" d=\"M4.70482 9.99449C4.15229 9.99449 3.70087 9.83482 3.35057 9.51548C3.00388 9.19247 2.83054 8.75935 2.83054 8.2161C2.83054 7.70223 3.00207 7.28745 3.34515 6.97178C3.69184 6.65244 4.19562 6.49277 4.8565 6.49277H6.30284V5.94769C6.30284 5.61367 6.20533 5.36774 6.01032 5.20991C5.81531 5.04841 5.55349 4.96765 5.22485 4.96765C5.00817 4.96765 4.82941 4.99702 4.68857 5.05575C4.54773 5.11081 4.43758 5.18789 4.35813 5.28699C4.27868 5.38243 4.22271 5.49621 4.19021 5.62835H3.04722C3.06527 5.3861 3.12305 5.16586 3.22056 4.96765C3.32168 4.76577 3.46252 4.59326 3.64309 4.4501C3.82727 4.30328 4.05297 4.19133 4.32021 4.11425C4.59106 4.03716 4.90525 3.99862 5.26277 3.99862C5.67086 3.99862 6.04463 4.06286 6.38409 4.19133C6.72356 4.31613 6.99441 4.52168 7.19665 4.80798C7.39888 5.09429 7.5 5.4797 7.5 5.96421V9.9064H6.35701V9.1521H6.30284C6.21978 9.29892 6.10783 9.43657 5.96698 9.56504C5.82614 9.69351 5.65099 9.79812 5.44153 9.87887C5.23569 9.95595 4.99012 9.99449 4.70482 9.99449ZM5.07318 9.04749C5.3043 9.04749 5.51196 8.99977 5.69613 8.90434C5.88031 8.80523 6.02657 8.67309 6.13491 8.50791C6.24686 8.34274 6.30284 8.1537 6.30284 7.94081V7.31314H5.04609C4.69579 7.31314 4.43939 7.39206 4.27688 7.5499C4.11798 7.70773 4.03853 7.90961 4.03853 8.15554C4.03853 8.4602 4.14326 8.68594 4.35272 8.83276C4.56578 8.97591 4.80594 9.04749 5.07318 9.04749Z\"></path>\n <path fill=\"currentColor\" d=\"M2.5 12.5L13.5 12.5C14.3284 12.5 15 11.8284 15 11V9.5C15 9.22386 15.2239 9 15.5 9C15.7761 9 16 9.22386 16 9.5V11C16 12.3807 14.8807 13.5 13.5 13.5L2.5 13.5C1.11929 13.5 -7.56324e-07 12.3807 0 11L6.55675e-08 9.5C3.58362e-07 9.22386 0.223858 9 0.5 9C0.776142 9 1 9.22386 1 9.5L1 11C0.999999 11.8284 1.67157 12.5 2.5 12.5Z\"></path>\n </symbol>\n <symbol id=\"diffs-editor-icon-regex\" viewBox=\"0 0 16 16\">\n <path fill=\"currentColor\" d=\"M8.60788 6.59074C8.78227 6.46701 9.02141 6.60508 9.00146 6.81797L8.77564 9.22666C8.76189 9.37331 8.87726 9.5 9.02455 9.5H9.97548C10.1228 9.5 10.2381 9.37331 10.2244 9.22667L9.99858 6.81801C9.97862 6.60513 10.2178 6.46706 10.3922 6.59079L12.3652 7.99066C12.4853 8.07589 12.6527 8.03932 12.7264 7.91177L13.2018 7.08823C13.2755 6.96068 13.2234 6.79742 13.0896 6.73601L10.8907 5.72723C10.6963 5.63807 10.6963 5.36193 10.8907 5.27277L13.0896 4.264C13.2234 4.20258 13.2755 4.03932 13.2018 3.91177L12.7263 3.08824C12.6527 2.96068 12.4853 2.92411 12.3652 3.00934L10.3922 4.40921C10.2178 4.53294 9.97862 4.39486 9.99858 4.18198L10.2244 1.77334C10.2381 1.62669 10.1228 1.5 9.97548 1.5H9.02455C8.87726 1.5 8.76189 1.62669 8.77564 1.77334L9.00146 4.18203C9.02141 4.39491 8.78227 4.53298 8.60788 4.40926L6.63479 3.00934C6.51466 2.92411 6.34726 2.96068 6.27362 3.08823L5.79815 3.91177C5.72451 4.03932 5.77654 4.20258 5.91041 4.26399L8.10929 5.27277C8.30363 5.36193 8.30363 5.63807 8.10929 5.72723L5.91041 6.73601C5.77653 6.79742 5.7245 6.96068 5.79814 7.08824L6.27361 7.91177C6.34725 8.03932 6.51466 8.07589 6.63478 7.99066L8.60788 6.59074Z\"></path>\n <path fill=\"currentColor\" d=\"M4 11C3.44772 11 3 11.4477 3 12V13C3 13.5523 3.44772 14 4 14H5C5.55228 14 6 13.5523 6 13V12C6 11.4477 5.55228 11 5 11H4Z\"></path>\n </symbol>\n <symbol id=\"diffs-editor-icon-quick\" viewBox=\"0 0 20 20\">\n <polygon points=\"11 3 9 9 16 9 9 17 11 11 4 11 11 3\" fill=\"currentColor\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\"></polygon>\n </symbol>\n</svg>";
3
+ declare const SVGSpriteSheet = "<svg data-icon-sprite aria-hidden=\"true\" width=\"0\" height=\"0\">\n <symbol id=\"diffs-editor-icon-search\" viewBox=\"0 0 16 16\">\n <path fill=\"currentColor\" fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M10.7747 12.8961C9.68558 13.5948 8.39011 14 7 14C3.13401 14 0 10.866 0 7C0 3.13401 3.13401 0 7 0C10.866 0 14 3.13401 14 7C14 8.39011 13.5948 9.68558 12.8961 10.7747L15.5607 13.4393C16.1464 14.0251 16.1464 14.9749 15.5607 15.5607C14.9749 16.1464 14.0251 16.1464 13.4393 15.5607L10.7747 12.8961ZM7 1.5C10.0376 1.5 12.5 3.96243 12.5 7C12.5 10.0376 10.0376 12.5 7 12.5C3.96243 12.5 1.5 10.0376 1.5 7C1.5 3.96243 3.96243 1.5 7 1.5Z\"></path>\n </symbol>\n <symbol id=\"diffs-editor-icon-close\" viewBox=\"0 0 16 16\">\n <path fill=\"currentColor\" d=\"M3.21967 3.21967C3.51256 2.92678 3.98744 2.92678 4.28033 3.21967L8 6.93934L11.7197 3.21967C12.0126 2.92678 12.4874 2.92678 12.7803 3.21967C13.0732 3.51256 13.0732 3.98744 12.7803 4.28033L9.06066 8L12.7803 11.7197C13.0732 12.0126 13.0732 12.4874 12.7803 12.7803C12.4874 13.0732 12.0126 13.0732 11.7197 12.7803L8 9.06066L4.28033 12.7803C3.98744 13.0732 3.51256 13.0732 3.21967 12.7803C2.92678 12.4874 2.92678 12.0126 3.21967 11.7197L6.93934 8L3.21967 4.28033C2.92678 3.98744 2.92678 3.51256 3.21967 3.21967Z\"></path>\n </symbol>\n <symbol id=\"diffs-editor-icon-arrow-up\" viewBox=\"0 0 16 16\">\n <path fill=\"currentColor\" transform=\"rotate(-90 8 8)\" d=\"M8.46967 4.21967C8.17678 4.51256 8.17678 4.98744 8.46967 5.28033L10.4393 7.25H3.75C3.33579 7.25 3 7.58579 3 8C3 8.41421 3.33579 8.75 3.75 8.75H10.4393L8.46967 10.7197C8.17678 11.0126 8.17678 11.4874 8.46967 11.7803C8.76256 12.0732 9.23744 12.0732 9.53033 11.7803L12.7803 8.53033C13.0732 8.23744 13.0732 7.76256 12.7803 7.46967L9.53033 4.21967C9.23744 3.92678 8.76256 3.92678 8.46967 4.21967Z\"></path>\n </symbol>\n <symbol id=\"diffs-editor-icon-arrow-down\" viewBox=\"0 0 16 16\">\n <path fill=\"currentColor\" transform=\"rotate(90 8 8)\" d=\"M8.46967 4.21967C8.17678 4.51256 8.17678 4.98744 8.46967 5.28033L10.4393 7.25H3.75C3.33579 7.25 3 7.58579 3 8C3 8.41421 3.33579 8.75 3.75 8.75H10.4393L8.46967 10.7197C8.17678 11.0126 8.17678 11.4874 8.46967 11.7803C8.76256 12.0732 9.23744 12.0732 9.53033 11.7803L12.7803 8.53033C13.0732 8.23744 13.0732 7.76256 12.7803 7.46967L9.53033 4.21967C9.23744 3.92678 8.76256 3.92678 8.46967 4.21967Z\"></path>\n </symbol>\n <symbol id=\"diffs-editor-icon-case\" viewBox=\"0 0 16 16\">\n <path fill=\"currentColor\" d=\"M12.2969 12.9969C10.7109 12.9969 9.61719 12.0125 9.61719 10.5047C9.61719 9.06719 10.6172 8.16094 12.5 8.15312H14.6641V7.31719C14.6641 6.23906 14.0391 5.64531 12.9297 5.64531C11.875 5.64531 11.2734 6.18437 11.1953 7.00469H9.92969C10.0156 5.56719 10.9922 4.52031 12.9766 4.52031C14.7266 4.52031 16 5.47344 16 7.2V12.8641H14.7109V11.8406H14.6719C14.2578 12.5047 13.5078 12.9969 12.2969 12.9969ZM12.6562 11.8797C13.8047 11.8797 14.6641 11.1609 14.6641 10.1375V9.18437H12.6016C11.4766 9.18437 10.9922 9.71562 10.9922 10.4578C10.9922 11.4266 11.7969 11.8797 12.6562 11.8797Z\"></path>\n <path fill=\"currentColor\" d=\"M1.42188 12.8641H0L3.79688 2H5.1875L8.98438 12.8641H7.54688L6.46875 9.66094H2.5L1.42188 12.8641ZM4.50781 3.60938H4.46875L2.86719 8.55937H6.10156L4.50781 3.60938Z\"></path>\n </symbol>\n <symbol id=\"diffs-editor-icon-whole-word\" viewBox=\"0 0 16 16\">\n <path fill=\"currentColor\" d=\"M11.4089 9.99449C11.1417 9.99449 10.8961 9.95595 10.6722 9.87887C10.4519 9.80179 10.2605 9.69167 10.098 9.54852C9.93551 9.40537 9.81453 9.23469 9.73508 9.03648H9.67007V9.91191H8.5V2H9.70258V5.01721H9.76758C9.81092 4.86671 9.88314 4.7309 9.98426 4.60977C10.089 4.48497 10.2136 4.37853 10.358 4.29043C10.5025 4.19867 10.6668 4.13076 10.851 4.08672C11.0352 4.039 11.2302 4.01514 11.436 4.01514C11.8802 4.01514 12.2648 4.11792 12.5898 4.32347C12.9149 4.52535 13.164 4.81532 13.3374 5.19339C13.5107 5.57146 13.5974 6.02478 13.5974 6.55334V7.45079C13.5974 7.97568 13.5089 8.429 13.332 8.81074C13.1586 9.1888 12.9076 9.48061 12.579 9.68617C12.2504 9.89172 11.8604 9.99449 11.4089 9.99449ZM11.0785 8.99243C11.353 8.99243 11.5859 8.92636 11.7773 8.79422C11.9723 8.66208 12.1204 8.46937 12.2215 8.2161C12.3226 7.95916 12.3732 7.65267 12.3732 7.29663V6.73503C12.3732 6.37164 12.3208 6.06332 12.2161 5.81005C12.115 5.55311 11.9669 5.35673 11.7719 5.22092C11.5769 5.08511 11.3385 5.01721 11.0568 5.01721C10.7824 5.01721 10.5422 5.08328 10.3364 5.21542C10.1341 5.34389 9.97704 5.52925 9.86509 5.77151C9.75675 6.01009 9.70258 6.2964 9.70258 6.63042V7.47281C9.70258 7.77013 9.76036 8.03441 9.87592 8.26566C9.99509 8.49323 10.1576 8.67125 10.3635 8.79972C10.5729 8.92819 10.8113 8.99243 11.0785 8.99243Z\"></path>\n <path fill=\"currentColor\" d=\"M4.70482 9.99449C4.15229 9.99449 3.70087 9.83482 3.35057 9.51548C3.00388 9.19247 2.83054 8.75935 2.83054 8.2161C2.83054 7.70223 3.00207 7.28745 3.34515 6.97178C3.69184 6.65244 4.19562 6.49277 4.8565 6.49277H6.30284V5.94769C6.30284 5.61367 6.20533 5.36774 6.01032 5.20991C5.81531 5.04841 5.55349 4.96765 5.22485 4.96765C5.00817 4.96765 4.82941 4.99702 4.68857 5.05575C4.54773 5.11081 4.43758 5.18789 4.35813 5.28699C4.27868 5.38243 4.22271 5.49621 4.19021 5.62835H3.04722C3.06527 5.3861 3.12305 5.16586 3.22056 4.96765C3.32168 4.76577 3.46252 4.59326 3.64309 4.4501C3.82727 4.30328 4.05297 4.19133 4.32021 4.11425C4.59106 4.03716 4.90525 3.99862 5.26277 3.99862C5.67086 3.99862 6.04463 4.06286 6.38409 4.19133C6.72356 4.31613 6.99441 4.52168 7.19665 4.80798C7.39888 5.09429 7.5 5.4797 7.5 5.96421V9.9064H6.35701V9.1521H6.30284C6.21978 9.29892 6.10783 9.43657 5.96698 9.56504C5.82614 9.69351 5.65099 9.79812 5.44153 9.87887C5.23569 9.95595 4.99012 9.99449 4.70482 9.99449ZM5.07318 9.04749C5.3043 9.04749 5.51196 8.99977 5.69613 8.90434C5.88031 8.80523 6.02657 8.67309 6.13491 8.50791C6.24686 8.34274 6.30284 8.1537 6.30284 7.94081V7.31314H5.04609C4.69579 7.31314 4.43939 7.39206 4.27688 7.5499C4.11798 7.70773 4.03853 7.90961 4.03853 8.15554C4.03853 8.4602 4.14326 8.68594 4.35272 8.83276C4.56578 8.97591 4.80594 9.04749 5.07318 9.04749Z\"></path>\n <path fill=\"currentColor\" d=\"M2.5 12.5L13.5 12.5C14.3284 12.5 15 11.8284 15 11V9.5C15 9.22386 15.2239 9 15.5 9C15.7761 9 16 9.22386 16 9.5V11C16 12.3807 14.8807 13.5 13.5 13.5L2.5 13.5C1.11929 13.5 -7.56324e-07 12.3807 0 11L6.55675e-08 9.5C3.58362e-07 9.22386 0.223858 9 0.5 9C0.776142 9 1 9.22386 1 9.5L1 11C0.999999 11.8284 1.67157 12.5 2.5 12.5Z\"></path>\n </symbol>\n <symbol id=\"diffs-editor-icon-regex\" viewBox=\"0 0 16 16\">\n <path fill=\"currentColor\" d=\"M8.60788 6.59074C8.78227 6.46701 9.02141 6.60508 9.00146 6.81797L8.77564 9.22666C8.76189 9.37331 8.87726 9.5 9.02455 9.5H9.97548C10.1228 9.5 10.2381 9.37331 10.2244 9.22667L9.99858 6.81801C9.97862 6.60513 10.2178 6.46706 10.3922 6.59079L12.3652 7.99066C12.4853 8.07589 12.6527 8.03932 12.7264 7.91177L13.2018 7.08823C13.2755 6.96068 13.2234 6.79742 13.0896 6.73601L10.8907 5.72723C10.6963 5.63807 10.6963 5.36193 10.8907 5.27277L13.0896 4.264C13.2234 4.20258 13.2755 4.03932 13.2018 3.91177L12.7263 3.08824C12.6527 2.96068 12.4853 2.92411 12.3652 3.00934L10.3922 4.40921C10.2178 4.53294 9.97862 4.39486 9.99858 4.18198L10.2244 1.77334C10.2381 1.62669 10.1228 1.5 9.97548 1.5H9.02455C8.87726 1.5 8.76189 1.62669 8.77564 1.77334L9.00146 4.18203C9.02141 4.39491 8.78227 4.53298 8.60788 4.40926L6.63479 3.00934C6.51466 2.92411 6.34726 2.96068 6.27362 3.08823L5.79815 3.91177C5.72451 4.03932 5.77654 4.20258 5.91041 4.26399L8.10929 5.27277C8.30363 5.36193 8.30363 5.63807 8.10929 5.72723L5.91041 6.73601C5.77653 6.79742 5.7245 6.96068 5.79814 7.08824L6.27361 7.91177C6.34725 8.03932 6.51466 8.07589 6.63478 7.99066L8.60788 6.59074Z\"></path>\n <path fill=\"currentColor\" d=\"M4 11C3.44772 11 3 11.4477 3 12V13C3 13.5523 3.44772 14 4 14H5C5.55228 14 6 13.5523 6 13V12C6 11.4477 5.55228 11 5 11H4Z\"></path>\n </symbol>\n <symbol id=\"diffs-editor-icon-quick\" viewBox=\"0 0 20 20\">\n <polygon points=\"11 3 9 9 16 9 9 17 11 11 4 11 11 3\" fill=\"currentColor\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\"></polygon>\n </symbol>\n</svg>";
4
+ declare const createSpriteElement: () => SVGSVGElement;
4
5
  declare const getEditorIconSvg: (name: SVGSpriteNames, size?: number) => string;
5
6
  //#endregion
6
- export { SVGSpriteNames, SVGSpriteSheet, getEditorIconSvg };
7
+ export { SVGSpriteNames, SVGSpriteSheet, createSpriteElement, getEditorIconSvg };
7
8
  //# sourceMappingURL=sprite.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sprite.d.ts","names":["SVGSpriteNames","SVGSpriteSheet","getEditorIconSvg"],"sources":["../../src/editor/sprite.d.ts"],"sourcesContent":["export type SVGSpriteNames = 'arrow-down' | 'arrow-up' | 'case' | 'close' | 'quick' | 'regex' | 'search' | 'whole-word';\nexport declare const SVGSpriteSheet = \"<svg data-editor-icon-sprite aria-hidden=\\\"true\\\" width=\\\"0\\\" height=\\\"0\\\">\\n <symbol id=\\\"diffs-editor-icon-search\\\" viewBox=\\\"0 0 16 16\\\">\\n <path fill=\\\"currentColor\\\" fill-rule=\\\"evenodd\\\" clip-rule=\\\"evenodd\\\" d=\\\"M10.7747 12.8961C9.68558 13.5948 8.39011 14 7 14C3.13401 14 0 10.866 0 7C0 3.13401 3.13401 0 7 0C10.866 0 14 3.13401 14 7C14 8.39011 13.5948 9.68558 12.8961 10.7747L15.5607 13.4393C16.1464 14.0251 16.1464 14.9749 15.5607 15.5607C14.9749 16.1464 14.0251 16.1464 13.4393 15.5607L10.7747 12.8961ZM7 1.5C10.0376 1.5 12.5 3.96243 12.5 7C12.5 10.0376 10.0376 12.5 7 12.5C3.96243 12.5 1.5 10.0376 1.5 7C1.5 3.96243 3.96243 1.5 7 1.5Z\\\"></path>\\n </symbol>\\n <symbol id=\\\"diffs-editor-icon-close\\\" viewBox=\\\"0 0 16 16\\\">\\n <path fill=\\\"currentColor\\\" d=\\\"M3.21967 3.21967C3.51256 2.92678 3.98744 2.92678 4.28033 3.21967L8 6.93934L11.7197 3.21967C12.0126 2.92678 12.4874 2.92678 12.7803 3.21967C13.0732 3.51256 13.0732 3.98744 12.7803 4.28033L9.06066 8L12.7803 11.7197C13.0732 12.0126 13.0732 12.4874 12.7803 12.7803C12.4874 13.0732 12.0126 13.0732 11.7197 12.7803L8 9.06066L4.28033 12.7803C3.98744 13.0732 3.51256 13.0732 3.21967 12.7803C2.92678 12.4874 2.92678 12.0126 3.21967 11.7197L6.93934 8L3.21967 4.28033C2.92678 3.98744 2.92678 3.51256 3.21967 3.21967Z\\\"></path>\\n </symbol>\\n <symbol id=\\\"diffs-editor-icon-arrow-up\\\" viewBox=\\\"0 0 16 16\\\">\\n <path fill=\\\"currentColor\\\" transform=\\\"rotate(-90 8 8)\\\" d=\\\"M8.46967 4.21967C8.17678 4.51256 8.17678 4.98744 8.46967 5.28033L10.4393 7.25H3.75C3.33579 7.25 3 7.58579 3 8C3 8.41421 3.33579 8.75 3.75 8.75H10.4393L8.46967 10.7197C8.17678 11.0126 8.17678 11.4874 8.46967 11.7803C8.76256 12.0732 9.23744 12.0732 9.53033 11.7803L12.7803 8.53033C13.0732 8.23744 13.0732 7.76256 12.7803 7.46967L9.53033 4.21967C9.23744 3.92678 8.76256 3.92678 8.46967 4.21967Z\\\"></path>\\n </symbol>\\n <symbol id=\\\"diffs-editor-icon-arrow-down\\\" viewBox=\\\"0 0 16 16\\\">\\n <path fill=\\\"currentColor\\\" transform=\\\"rotate(90 8 8)\\\" d=\\\"M8.46967 4.21967C8.17678 4.51256 8.17678 4.98744 8.46967 5.28033L10.4393 7.25H3.75C3.33579 7.25 3 7.58579 3 8C3 8.41421 3.33579 8.75 3.75 8.75H10.4393L8.46967 10.7197C8.17678 11.0126 8.17678 11.4874 8.46967 11.7803C8.76256 12.0732 9.23744 12.0732 9.53033 11.7803L12.7803 8.53033C13.0732 8.23744 13.0732 7.76256 12.7803 7.46967L9.53033 4.21967C9.23744 3.92678 8.76256 3.92678 8.46967 4.21967Z\\\"></path>\\n </symbol>\\n <symbol id=\\\"diffs-editor-icon-case\\\" viewBox=\\\"0 0 16 16\\\">\\n <path fill=\\\"currentColor\\\" d=\\\"M12.2969 12.9969C10.7109 12.9969 9.61719 12.0125 9.61719 10.5047C9.61719 9.06719 10.6172 8.16094 12.5 8.15312H14.6641V7.31719C14.6641 6.23906 14.0391 5.64531 12.9297 5.64531C11.875 5.64531 11.2734 6.18437 11.1953 7.00469H9.92969C10.0156 5.56719 10.9922 4.52031 12.9766 4.52031C14.7266 4.52031 16 5.47344 16 7.2V12.8641H14.7109V11.8406H14.6719C14.2578 12.5047 13.5078 12.9969 12.2969 12.9969ZM12.6562 11.8797C13.8047 11.8797 14.6641 11.1609 14.6641 10.1375V9.18437H12.6016C11.4766 9.18437 10.9922 9.71562 10.9922 10.4578C10.9922 11.4266 11.7969 11.8797 12.6562 11.8797Z\\\"></path>\\n <path fill=\\\"currentColor\\\" d=\\\"M1.42188 12.8641H0L3.79688 2H5.1875L8.98438 12.8641H7.54688L6.46875 9.66094H2.5L1.42188 12.8641ZM4.50781 3.60938H4.46875L2.86719 8.55937H6.10156L4.50781 3.60938Z\\\"></path>\\n </symbol>\\n <symbol id=\\\"diffs-editor-icon-whole-word\\\" viewBox=\\\"0 0 16 16\\\">\\n <path fill=\\\"currentColor\\\" d=\\\"M11.4089 9.99449C11.1417 9.99449 10.8961 9.95595 10.6722 9.87887C10.4519 9.80179 10.2605 9.69167 10.098 9.54852C9.93551 9.40537 9.81453 9.23469 9.73508 9.03648H9.67007V9.91191H8.5V2H9.70258V5.01721H9.76758C9.81092 4.86671 9.88314 4.7309 9.98426 4.60977C10.089 4.48497 10.2136 4.37853 10.358 4.29043C10.5025 4.19867 10.6668 4.13076 10.851 4.08672C11.0352 4.039 11.2302 4.01514 11.436 4.01514C11.8802 4.01514 12.2648 4.11792 12.5898 4.32347C12.9149 4.52535 13.164 4.81532 13.3374 5.19339C13.5107 5.57146 13.5974 6.02478 13.5974 6.55334V7.45079C13.5974 7.97568 13.5089 8.429 13.332 8.81074C13.1586 9.1888 12.9076 9.48061 12.579 9.68617C12.2504 9.89172 11.8604 9.99449 11.4089 9.99449ZM11.0785 8.99243C11.353 8.99243 11.5859 8.92636 11.7773 8.79422C11.9723 8.66208 12.1204 8.46937 12.2215 8.2161C12.3226 7.95916 12.3732 7.65267 12.3732 7.29663V6.73503C12.3732 6.37164 12.3208 6.06332 12.2161 5.81005C12.115 5.55311 11.9669 5.35673 11.7719 5.22092C11.5769 5.08511 11.3385 5.01721 11.0568 5.01721C10.7824 5.01721 10.5422 5.08328 10.3364 5.21542C10.1341 5.34389 9.97704 5.52925 9.86509 5.77151C9.75675 6.01009 9.70258 6.2964 9.70258 6.63042V7.47281C9.70258 7.77013 9.76036 8.03441 9.87592 8.26566C9.99509 8.49323 10.1576 8.67125 10.3635 8.79972C10.5729 8.92819 10.8113 8.99243 11.0785 8.99243Z\\\"></path>\\n <path fill=\\\"currentColor\\\" d=\\\"M4.70482 9.99449C4.15229 9.99449 3.70087 9.83482 3.35057 9.51548C3.00388 9.19247 2.83054 8.75935 2.83054 8.2161C2.83054 7.70223 3.00207 7.28745 3.34515 6.97178C3.69184 6.65244 4.19562 6.49277 4.8565 6.49277H6.30284V5.94769C6.30284 5.61367 6.20533 5.36774 6.01032 5.20991C5.81531 5.04841 5.55349 4.96765 5.22485 4.96765C5.00817 4.96765 4.82941 4.99702 4.68857 5.05575C4.54773 5.11081 4.43758 5.18789 4.35813 5.28699C4.27868 5.38243 4.22271 5.49621 4.19021 5.62835H3.04722C3.06527 5.3861 3.12305 5.16586 3.22056 4.96765C3.32168 4.76577 3.46252 4.59326 3.64309 4.4501C3.82727 4.30328 4.05297 4.19133 4.32021 4.11425C4.59106 4.03716 4.90525 3.99862 5.26277 3.99862C5.67086 3.99862 6.04463 4.06286 6.38409 4.19133C6.72356 4.31613 6.99441 4.52168 7.19665 4.80798C7.39888 5.09429 7.5 5.4797 7.5 5.96421V9.9064H6.35701V9.1521H6.30284C6.21978 9.29892 6.10783 9.43657 5.96698 9.56504C5.82614 9.69351 5.65099 9.79812 5.44153 9.87887C5.23569 9.95595 4.99012 9.99449 4.70482 9.99449ZM5.07318 9.04749C5.3043 9.04749 5.51196 8.99977 5.69613 8.90434C5.88031 8.80523 6.02657 8.67309 6.13491 8.50791C6.24686 8.34274 6.30284 8.1537 6.30284 7.94081V7.31314H5.04609C4.69579 7.31314 4.43939 7.39206 4.27688 7.5499C4.11798 7.70773 4.03853 7.90961 4.03853 8.15554C4.03853 8.4602 4.14326 8.68594 4.35272 8.83276C4.56578 8.97591 4.80594 9.04749 5.07318 9.04749Z\\\"></path>\\n <path fill=\\\"currentColor\\\" d=\\\"M2.5 12.5L13.5 12.5C14.3284 12.5 15 11.8284 15 11V9.5C15 9.22386 15.2239 9 15.5 9C15.7761 9 16 9.22386 16 9.5V11C16 12.3807 14.8807 13.5 13.5 13.5L2.5 13.5C1.11929 13.5 -7.56324e-07 12.3807 0 11L6.55675e-08 9.5C3.58362e-07 9.22386 0.223858 9 0.5 9C0.776142 9 1 9.22386 1 9.5L1 11C0.999999 11.8284 1.67157 12.5 2.5 12.5Z\\\"></path>\\n </symbol>\\n <symbol id=\\\"diffs-editor-icon-regex\\\" viewBox=\\\"0 0 16 16\\\">\\n <path fill=\\\"currentColor\\\" d=\\\"M8.60788 6.59074C8.78227 6.46701 9.02141 6.60508 9.00146 6.81797L8.77564 9.22666C8.76189 9.37331 8.87726 9.5 9.02455 9.5H9.97548C10.1228 9.5 10.2381 9.37331 10.2244 9.22667L9.99858 6.81801C9.97862 6.60513 10.2178 6.46706 10.3922 6.59079L12.3652 7.99066C12.4853 8.07589 12.6527 8.03932 12.7264 7.91177L13.2018 7.08823C13.2755 6.96068 13.2234 6.79742 13.0896 6.73601L10.8907 5.72723C10.6963 5.63807 10.6963 5.36193 10.8907 5.27277L13.0896 4.264C13.2234 4.20258 13.2755 4.03932 13.2018 3.91177L12.7263 3.08824C12.6527 2.96068 12.4853 2.92411 12.3652 3.00934L10.3922 4.40921C10.2178 4.53294 9.97862 4.39486 9.99858 4.18198L10.2244 1.77334C10.2381 1.62669 10.1228 1.5 9.97548 1.5H9.02455C8.87726 1.5 8.76189 1.62669 8.77564 1.77334L9.00146 4.18203C9.02141 4.39491 8.78227 4.53298 8.60788 4.40926L6.63479 3.00934C6.51466 2.92411 6.34726 2.96068 6.27362 3.08823L5.79815 3.91177C5.72451 4.03932 5.77654 4.20258 5.91041 4.26399L8.10929 5.27277C8.30363 5.36193 8.30363 5.63807 8.10929 5.72723L5.91041 6.73601C5.77653 6.79742 5.7245 6.96068 5.79814 7.08824L6.27361 7.91177C6.34725 8.03932 6.51466 8.07589 6.63478 7.99066L8.60788 6.59074Z\\\"></path>\\n <path fill=\\\"currentColor\\\" d=\\\"M4 11C3.44772 11 3 11.4477 3 12V13C3 13.5523 3.44772 14 4 14H5C5.55228 14 6 13.5523 6 13V12C6 11.4477 5.55228 11 5 11H4Z\\\"></path>\\n </symbol>\\n <symbol id=\\\"diffs-editor-icon-quick\\\" viewBox=\\\"0 0 20 20\\\">\\n <polygon points=\\\"11 3 9 9 16 9 9 17 11 11 4 11 11 3\\\" fill=\\\"currentColor\\\" stroke=\\\"currentColor\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\" stroke-width=\\\"2\\\"></polygon>\\n </symbol>\\n</svg>\";\nexport declare const getEditorIconSvg: (name: SVGSpriteNames, size?: number) => string;\n//# sourceMappingURL=sprite.d.ts.map"],"mappings":";KAAYA,cAAAA;AAAAA,cACSC,cAAAA,GADK,w+PAAA;AACLA,cACAC,gBADc,EAAA,CAAA,IAAA,EACWF,cADX,EAAA,IAAA,CAAA,EAAA,MAAA,EAAA,GAAA,MAAA"}
1
+ {"version":3,"file":"sprite.d.ts","names":["SVGSpriteNames","SVGSpriteSheet","createSpriteElement","SVGSVGElement","getEditorIconSvg"],"sources":["../../src/editor/sprite.d.ts"],"sourcesContent":["export type SVGSpriteNames = 'arrow-down' | 'arrow-up' | 'case' | 'close' | 'quick' | 'regex' | 'search' | 'whole-word';\nexport declare const SVGSpriteSheet = \"<svg data-icon-sprite aria-hidden=\\\"true\\\" width=\\\"0\\\" height=\\\"0\\\">\\n <symbol id=\\\"diffs-editor-icon-search\\\" viewBox=\\\"0 0 16 16\\\">\\n <path fill=\\\"currentColor\\\" fill-rule=\\\"evenodd\\\" clip-rule=\\\"evenodd\\\" d=\\\"M10.7747 12.8961C9.68558 13.5948 8.39011 14 7 14C3.13401 14 0 10.866 0 7C0 3.13401 3.13401 0 7 0C10.866 0 14 3.13401 14 7C14 8.39011 13.5948 9.68558 12.8961 10.7747L15.5607 13.4393C16.1464 14.0251 16.1464 14.9749 15.5607 15.5607C14.9749 16.1464 14.0251 16.1464 13.4393 15.5607L10.7747 12.8961ZM7 1.5C10.0376 1.5 12.5 3.96243 12.5 7C12.5 10.0376 10.0376 12.5 7 12.5C3.96243 12.5 1.5 10.0376 1.5 7C1.5 3.96243 3.96243 1.5 7 1.5Z\\\"></path>\\n </symbol>\\n <symbol id=\\\"diffs-editor-icon-close\\\" viewBox=\\\"0 0 16 16\\\">\\n <path fill=\\\"currentColor\\\" d=\\\"M3.21967 3.21967C3.51256 2.92678 3.98744 2.92678 4.28033 3.21967L8 6.93934L11.7197 3.21967C12.0126 2.92678 12.4874 2.92678 12.7803 3.21967C13.0732 3.51256 13.0732 3.98744 12.7803 4.28033L9.06066 8L12.7803 11.7197C13.0732 12.0126 13.0732 12.4874 12.7803 12.7803C12.4874 13.0732 12.0126 13.0732 11.7197 12.7803L8 9.06066L4.28033 12.7803C3.98744 13.0732 3.51256 13.0732 3.21967 12.7803C2.92678 12.4874 2.92678 12.0126 3.21967 11.7197L6.93934 8L3.21967 4.28033C2.92678 3.98744 2.92678 3.51256 3.21967 3.21967Z\\\"></path>\\n </symbol>\\n <symbol id=\\\"diffs-editor-icon-arrow-up\\\" viewBox=\\\"0 0 16 16\\\">\\n <path fill=\\\"currentColor\\\" transform=\\\"rotate(-90 8 8)\\\" d=\\\"M8.46967 4.21967C8.17678 4.51256 8.17678 4.98744 8.46967 5.28033L10.4393 7.25H3.75C3.33579 7.25 3 7.58579 3 8C3 8.41421 3.33579 8.75 3.75 8.75H10.4393L8.46967 10.7197C8.17678 11.0126 8.17678 11.4874 8.46967 11.7803C8.76256 12.0732 9.23744 12.0732 9.53033 11.7803L12.7803 8.53033C13.0732 8.23744 13.0732 7.76256 12.7803 7.46967L9.53033 4.21967C9.23744 3.92678 8.76256 3.92678 8.46967 4.21967Z\\\"></path>\\n </symbol>\\n <symbol id=\\\"diffs-editor-icon-arrow-down\\\" viewBox=\\\"0 0 16 16\\\">\\n <path fill=\\\"currentColor\\\" transform=\\\"rotate(90 8 8)\\\" d=\\\"M8.46967 4.21967C8.17678 4.51256 8.17678 4.98744 8.46967 5.28033L10.4393 7.25H3.75C3.33579 7.25 3 7.58579 3 8C3 8.41421 3.33579 8.75 3.75 8.75H10.4393L8.46967 10.7197C8.17678 11.0126 8.17678 11.4874 8.46967 11.7803C8.76256 12.0732 9.23744 12.0732 9.53033 11.7803L12.7803 8.53033C13.0732 8.23744 13.0732 7.76256 12.7803 7.46967L9.53033 4.21967C9.23744 3.92678 8.76256 3.92678 8.46967 4.21967Z\\\"></path>\\n </symbol>\\n <symbol id=\\\"diffs-editor-icon-case\\\" viewBox=\\\"0 0 16 16\\\">\\n <path fill=\\\"currentColor\\\" d=\\\"M12.2969 12.9969C10.7109 12.9969 9.61719 12.0125 9.61719 10.5047C9.61719 9.06719 10.6172 8.16094 12.5 8.15312H14.6641V7.31719C14.6641 6.23906 14.0391 5.64531 12.9297 5.64531C11.875 5.64531 11.2734 6.18437 11.1953 7.00469H9.92969C10.0156 5.56719 10.9922 4.52031 12.9766 4.52031C14.7266 4.52031 16 5.47344 16 7.2V12.8641H14.7109V11.8406H14.6719C14.2578 12.5047 13.5078 12.9969 12.2969 12.9969ZM12.6562 11.8797C13.8047 11.8797 14.6641 11.1609 14.6641 10.1375V9.18437H12.6016C11.4766 9.18437 10.9922 9.71562 10.9922 10.4578C10.9922 11.4266 11.7969 11.8797 12.6562 11.8797Z\\\"></path>\\n <path fill=\\\"currentColor\\\" d=\\\"M1.42188 12.8641H0L3.79688 2H5.1875L8.98438 12.8641H7.54688L6.46875 9.66094H2.5L1.42188 12.8641ZM4.50781 3.60938H4.46875L2.86719 8.55937H6.10156L4.50781 3.60938Z\\\"></path>\\n </symbol>\\n <symbol id=\\\"diffs-editor-icon-whole-word\\\" viewBox=\\\"0 0 16 16\\\">\\n <path fill=\\\"currentColor\\\" d=\\\"M11.4089 9.99449C11.1417 9.99449 10.8961 9.95595 10.6722 9.87887C10.4519 9.80179 10.2605 9.69167 10.098 9.54852C9.93551 9.40537 9.81453 9.23469 9.73508 9.03648H9.67007V9.91191H8.5V2H9.70258V5.01721H9.76758C9.81092 4.86671 9.88314 4.7309 9.98426 4.60977C10.089 4.48497 10.2136 4.37853 10.358 4.29043C10.5025 4.19867 10.6668 4.13076 10.851 4.08672C11.0352 4.039 11.2302 4.01514 11.436 4.01514C11.8802 4.01514 12.2648 4.11792 12.5898 4.32347C12.9149 4.52535 13.164 4.81532 13.3374 5.19339C13.5107 5.57146 13.5974 6.02478 13.5974 6.55334V7.45079C13.5974 7.97568 13.5089 8.429 13.332 8.81074C13.1586 9.1888 12.9076 9.48061 12.579 9.68617C12.2504 9.89172 11.8604 9.99449 11.4089 9.99449ZM11.0785 8.99243C11.353 8.99243 11.5859 8.92636 11.7773 8.79422C11.9723 8.66208 12.1204 8.46937 12.2215 8.2161C12.3226 7.95916 12.3732 7.65267 12.3732 7.29663V6.73503C12.3732 6.37164 12.3208 6.06332 12.2161 5.81005C12.115 5.55311 11.9669 5.35673 11.7719 5.22092C11.5769 5.08511 11.3385 5.01721 11.0568 5.01721C10.7824 5.01721 10.5422 5.08328 10.3364 5.21542C10.1341 5.34389 9.97704 5.52925 9.86509 5.77151C9.75675 6.01009 9.70258 6.2964 9.70258 6.63042V7.47281C9.70258 7.77013 9.76036 8.03441 9.87592 8.26566C9.99509 8.49323 10.1576 8.67125 10.3635 8.79972C10.5729 8.92819 10.8113 8.99243 11.0785 8.99243Z\\\"></path>\\n <path fill=\\\"currentColor\\\" d=\\\"M4.70482 9.99449C4.15229 9.99449 3.70087 9.83482 3.35057 9.51548C3.00388 9.19247 2.83054 8.75935 2.83054 8.2161C2.83054 7.70223 3.00207 7.28745 3.34515 6.97178C3.69184 6.65244 4.19562 6.49277 4.8565 6.49277H6.30284V5.94769C6.30284 5.61367 6.20533 5.36774 6.01032 5.20991C5.81531 5.04841 5.55349 4.96765 5.22485 4.96765C5.00817 4.96765 4.82941 4.99702 4.68857 5.05575C4.54773 5.11081 4.43758 5.18789 4.35813 5.28699C4.27868 5.38243 4.22271 5.49621 4.19021 5.62835H3.04722C3.06527 5.3861 3.12305 5.16586 3.22056 4.96765C3.32168 4.76577 3.46252 4.59326 3.64309 4.4501C3.82727 4.30328 4.05297 4.19133 4.32021 4.11425C4.59106 4.03716 4.90525 3.99862 5.26277 3.99862C5.67086 3.99862 6.04463 4.06286 6.38409 4.19133C6.72356 4.31613 6.99441 4.52168 7.19665 4.80798C7.39888 5.09429 7.5 5.4797 7.5 5.96421V9.9064H6.35701V9.1521H6.30284C6.21978 9.29892 6.10783 9.43657 5.96698 9.56504C5.82614 9.69351 5.65099 9.79812 5.44153 9.87887C5.23569 9.95595 4.99012 9.99449 4.70482 9.99449ZM5.07318 9.04749C5.3043 9.04749 5.51196 8.99977 5.69613 8.90434C5.88031 8.80523 6.02657 8.67309 6.13491 8.50791C6.24686 8.34274 6.30284 8.1537 6.30284 7.94081V7.31314H5.04609C4.69579 7.31314 4.43939 7.39206 4.27688 7.5499C4.11798 7.70773 4.03853 7.90961 4.03853 8.15554C4.03853 8.4602 4.14326 8.68594 4.35272 8.83276C4.56578 8.97591 4.80594 9.04749 5.07318 9.04749Z\\\"></path>\\n <path fill=\\\"currentColor\\\" d=\\\"M2.5 12.5L13.5 12.5C14.3284 12.5 15 11.8284 15 11V9.5C15 9.22386 15.2239 9 15.5 9C15.7761 9 16 9.22386 16 9.5V11C16 12.3807 14.8807 13.5 13.5 13.5L2.5 13.5C1.11929 13.5 -7.56324e-07 12.3807 0 11L6.55675e-08 9.5C3.58362e-07 9.22386 0.223858 9 0.5 9C0.776142 9 1 9.22386 1 9.5L1 11C0.999999 11.8284 1.67157 12.5 2.5 12.5Z\\\"></path>\\n </symbol>\\n <symbol id=\\\"diffs-editor-icon-regex\\\" viewBox=\\\"0 0 16 16\\\">\\n <path fill=\\\"currentColor\\\" d=\\\"M8.60788 6.59074C8.78227 6.46701 9.02141 6.60508 9.00146 6.81797L8.77564 9.22666C8.76189 9.37331 8.87726 9.5 9.02455 9.5H9.97548C10.1228 9.5 10.2381 9.37331 10.2244 9.22667L9.99858 6.81801C9.97862 6.60513 10.2178 6.46706 10.3922 6.59079L12.3652 7.99066C12.4853 8.07589 12.6527 8.03932 12.7264 7.91177L13.2018 7.08823C13.2755 6.96068 13.2234 6.79742 13.0896 6.73601L10.8907 5.72723C10.6963 5.63807 10.6963 5.36193 10.8907 5.27277L13.0896 4.264C13.2234 4.20258 13.2755 4.03932 13.2018 3.91177L12.7263 3.08824C12.6527 2.96068 12.4853 2.92411 12.3652 3.00934L10.3922 4.40921C10.2178 4.53294 9.97862 4.39486 9.99858 4.18198L10.2244 1.77334C10.2381 1.62669 10.1228 1.5 9.97548 1.5H9.02455C8.87726 1.5 8.76189 1.62669 8.77564 1.77334L9.00146 4.18203C9.02141 4.39491 8.78227 4.53298 8.60788 4.40926L6.63479 3.00934C6.51466 2.92411 6.34726 2.96068 6.27362 3.08823L5.79815 3.91177C5.72451 4.03932 5.77654 4.20258 5.91041 4.26399L8.10929 5.27277C8.30363 5.36193 8.30363 5.63807 8.10929 5.72723L5.91041 6.73601C5.77653 6.79742 5.7245 6.96068 5.79814 7.08824L6.27361 7.91177C6.34725 8.03932 6.51466 8.07589 6.63478 7.99066L8.60788 6.59074Z\\\"></path>\\n <path fill=\\\"currentColor\\\" d=\\\"M4 11C3.44772 11 3 11.4477 3 12V13C3 13.5523 3.44772 14 4 14H5C5.55228 14 6 13.5523 6 13V12C6 11.4477 5.55228 11 5 11H4Z\\\"></path>\\n </symbol>\\n <symbol id=\\\"diffs-editor-icon-quick\\\" viewBox=\\\"0 0 20 20\\\">\\n <polygon points=\\\"11 3 9 9 16 9 9 17 11 11 4 11 11 3\\\" fill=\\\"currentColor\\\" stroke=\\\"currentColor\\\" stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\" stroke-width=\\\"2\\\"></polygon>\\n </symbol>\\n</svg>\";\nexport declare const createSpriteElement: () => SVGSVGElement;\nexport declare const getEditorIconSvg: (name: SVGSpriteNames, size?: number) => string;\n//# sourceMappingURL=sprite.d.ts.map"],"mappings":";KAAYA,cAAAA;AAAAA,cACSC,cAAAA,GADK,i+PAAA;AACLA,cACAC,mBADc,EAAA,GAAA,GACaC,aADb;AACdD,cACAE,gBADwC,EAAbD,CAAAA,IAAAA,EACFH,cADe,EAAA,IAAA,CAAA,EAAA,MAAA,EAAA,GAAA,MAAA"}
@@ -1,5 +1,5 @@
1
1
  //#region src/editor/sprite.ts
2
- const SVGSpriteSheet = `<svg data-editor-icon-sprite aria-hidden="true" width="0" height="0">
2
+ const SVGSpriteSheet = `<svg data-icon-sprite aria-hidden="true" width="0" height="0">
3
3
  <symbol id="diffs-editor-icon-search" viewBox="0 0 16 16">
4
4
  <path fill="currentColor" fill-rule="evenodd" clip-rule="evenodd" d="M10.7747 12.8961C9.68558 13.5948 8.39011 14 7 14C3.13401 14 0 10.866 0 7C0 3.13401 3.13401 0 7 0C10.866 0 14 3.13401 14 7C14 8.39011 13.5948 9.68558 12.8961 10.7747L15.5607 13.4393C16.1464 14.0251 16.1464 14.9749 15.5607 15.5607C14.9749 16.1464 14.0251 16.1464 13.4393 15.5607L10.7747 12.8961ZM7 1.5C10.0376 1.5 12.5 3.96243 12.5 7C12.5 10.0376 10.0376 12.5 7 12.5C3.96243 12.5 1.5 10.0376 1.5 7C1.5 3.96243 3.96243 1.5 7 1.5Z"></path>
5
5
  </symbol>
@@ -29,10 +29,17 @@ const SVGSpriteSheet = `<svg data-editor-icon-sprite aria-hidden="true" width="0
29
29
  <polygon points="11 3 9 9 16 9 9 17 11 11 4 11 11 3" fill="currentColor" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"></polygon>
30
30
  </symbol>
31
31
  </svg>`;
32
+ const createSpriteElement = () => {
33
+ const fragment = document.createElement("div");
34
+ fragment.innerHTML = SVGSpriteSheet;
35
+ const sprite = fragment.firstElementChild;
36
+ if (sprite === null || !(sprite instanceof SVGSVGElement)) throw new Error("Failed to create sprite element");
37
+ return sprite;
38
+ };
32
39
  const getEditorIconSvg = (name, size = 16) => `<svg width="${size}" height="${size}" aria-hidden="true" focusable="false">
33
40
  <use href="#diffs-editor-icon-${name}"></use>
34
41
  </svg>`;
35
42
 
36
43
  //#endregion
37
- export { SVGSpriteSheet, getEditorIconSvg };
44
+ export { SVGSpriteSheet, createSpriteElement, getEditorIconSvg };
38
45
  //# sourceMappingURL=sprite.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"sprite.js","names":[],"sources":["../../src/editor/sprite.ts"],"sourcesContent":["export type SVGSpriteNames =\n | 'arrow-down'\n | 'arrow-up'\n | 'case'\n | 'close'\n | 'quick'\n | 'regex'\n | 'search'\n | 'whole-word';\n\n// Icon artwork is sourced from `@pierre/icons` (IconSearch, IconX,\n// IconArrowRightShort, IconType, IconTypeWord, IconRegex) so the editor matches\n// the rest of the product. The arrow glyph is the short right arrow rotated to\n// point up/down for the search \"previous\"/\"next\" controls. `quick` is the only\n// hand-authored glyph and uses its own 0 0 20 20 viewBox; `getEditorIconSvg`\n// omits an outer viewBox so each symbol scales to fill the requested size\n// regardless of its intrinsic coordinate system.\nexport const SVGSpriteSheet = `<svg data-editor-icon-sprite aria-hidden=\"true\" width=\"0\" height=\"0\">\n <symbol id=\"diffs-editor-icon-search\" viewBox=\"0 0 16 16\">\n <path fill=\"currentColor\" fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M10.7747 12.8961C9.68558 13.5948 8.39011 14 7 14C3.13401 14 0 10.866 0 7C0 3.13401 3.13401 0 7 0C10.866 0 14 3.13401 14 7C14 8.39011 13.5948 9.68558 12.8961 10.7747L15.5607 13.4393C16.1464 14.0251 16.1464 14.9749 15.5607 15.5607C14.9749 16.1464 14.0251 16.1464 13.4393 15.5607L10.7747 12.8961ZM7 1.5C10.0376 1.5 12.5 3.96243 12.5 7C12.5 10.0376 10.0376 12.5 7 12.5C3.96243 12.5 1.5 10.0376 1.5 7C1.5 3.96243 3.96243 1.5 7 1.5Z\"></path>\n </symbol>\n <symbol id=\"diffs-editor-icon-close\" viewBox=\"0 0 16 16\">\n <path fill=\"currentColor\" d=\"M3.21967 3.21967C3.51256 2.92678 3.98744 2.92678 4.28033 3.21967L8 6.93934L11.7197 3.21967C12.0126 2.92678 12.4874 2.92678 12.7803 3.21967C13.0732 3.51256 13.0732 3.98744 12.7803 4.28033L9.06066 8L12.7803 11.7197C13.0732 12.0126 13.0732 12.4874 12.7803 12.7803C12.4874 13.0732 12.0126 13.0732 11.7197 12.7803L8 9.06066L4.28033 12.7803C3.98744 13.0732 3.51256 13.0732 3.21967 12.7803C2.92678 12.4874 2.92678 12.0126 3.21967 11.7197L6.93934 8L3.21967 4.28033C2.92678 3.98744 2.92678 3.51256 3.21967 3.21967Z\"></path>\n </symbol>\n <symbol id=\"diffs-editor-icon-arrow-up\" viewBox=\"0 0 16 16\">\n <path fill=\"currentColor\" transform=\"rotate(-90 8 8)\" d=\"M8.46967 4.21967C8.17678 4.51256 8.17678 4.98744 8.46967 5.28033L10.4393 7.25H3.75C3.33579 7.25 3 7.58579 3 8C3 8.41421 3.33579 8.75 3.75 8.75H10.4393L8.46967 10.7197C8.17678 11.0126 8.17678 11.4874 8.46967 11.7803C8.76256 12.0732 9.23744 12.0732 9.53033 11.7803L12.7803 8.53033C13.0732 8.23744 13.0732 7.76256 12.7803 7.46967L9.53033 4.21967C9.23744 3.92678 8.76256 3.92678 8.46967 4.21967Z\"></path>\n </symbol>\n <symbol id=\"diffs-editor-icon-arrow-down\" viewBox=\"0 0 16 16\">\n <path fill=\"currentColor\" transform=\"rotate(90 8 8)\" d=\"M8.46967 4.21967C8.17678 4.51256 8.17678 4.98744 8.46967 5.28033L10.4393 7.25H3.75C3.33579 7.25 3 7.58579 3 8C3 8.41421 3.33579 8.75 3.75 8.75H10.4393L8.46967 10.7197C8.17678 11.0126 8.17678 11.4874 8.46967 11.7803C8.76256 12.0732 9.23744 12.0732 9.53033 11.7803L12.7803 8.53033C13.0732 8.23744 13.0732 7.76256 12.7803 7.46967L9.53033 4.21967C9.23744 3.92678 8.76256 3.92678 8.46967 4.21967Z\"></path>\n </symbol>\n <symbol id=\"diffs-editor-icon-case\" viewBox=\"0 0 16 16\">\n <path fill=\"currentColor\" d=\"M12.2969 12.9969C10.7109 12.9969 9.61719 12.0125 9.61719 10.5047C9.61719 9.06719 10.6172 8.16094 12.5 8.15312H14.6641V7.31719C14.6641 6.23906 14.0391 5.64531 12.9297 5.64531C11.875 5.64531 11.2734 6.18437 11.1953 7.00469H9.92969C10.0156 5.56719 10.9922 4.52031 12.9766 4.52031C14.7266 4.52031 16 5.47344 16 7.2V12.8641H14.7109V11.8406H14.6719C14.2578 12.5047 13.5078 12.9969 12.2969 12.9969ZM12.6562 11.8797C13.8047 11.8797 14.6641 11.1609 14.6641 10.1375V9.18437H12.6016C11.4766 9.18437 10.9922 9.71562 10.9922 10.4578C10.9922 11.4266 11.7969 11.8797 12.6562 11.8797Z\"></path>\n <path fill=\"currentColor\" d=\"M1.42188 12.8641H0L3.79688 2H5.1875L8.98438 12.8641H7.54688L6.46875 9.66094H2.5L1.42188 12.8641ZM4.50781 3.60938H4.46875L2.86719 8.55937H6.10156L4.50781 3.60938Z\"></path>\n </symbol>\n <symbol id=\"diffs-editor-icon-whole-word\" viewBox=\"0 0 16 16\">\n <path fill=\"currentColor\" d=\"M11.4089 9.99449C11.1417 9.99449 10.8961 9.95595 10.6722 9.87887C10.4519 9.80179 10.2605 9.69167 10.098 9.54852C9.93551 9.40537 9.81453 9.23469 9.73508 9.03648H9.67007V9.91191H8.5V2H9.70258V5.01721H9.76758C9.81092 4.86671 9.88314 4.7309 9.98426 4.60977C10.089 4.48497 10.2136 4.37853 10.358 4.29043C10.5025 4.19867 10.6668 4.13076 10.851 4.08672C11.0352 4.039 11.2302 4.01514 11.436 4.01514C11.8802 4.01514 12.2648 4.11792 12.5898 4.32347C12.9149 4.52535 13.164 4.81532 13.3374 5.19339C13.5107 5.57146 13.5974 6.02478 13.5974 6.55334V7.45079C13.5974 7.97568 13.5089 8.429 13.332 8.81074C13.1586 9.1888 12.9076 9.48061 12.579 9.68617C12.2504 9.89172 11.8604 9.99449 11.4089 9.99449ZM11.0785 8.99243C11.353 8.99243 11.5859 8.92636 11.7773 8.79422C11.9723 8.66208 12.1204 8.46937 12.2215 8.2161C12.3226 7.95916 12.3732 7.65267 12.3732 7.29663V6.73503C12.3732 6.37164 12.3208 6.06332 12.2161 5.81005C12.115 5.55311 11.9669 5.35673 11.7719 5.22092C11.5769 5.08511 11.3385 5.01721 11.0568 5.01721C10.7824 5.01721 10.5422 5.08328 10.3364 5.21542C10.1341 5.34389 9.97704 5.52925 9.86509 5.77151C9.75675 6.01009 9.70258 6.2964 9.70258 6.63042V7.47281C9.70258 7.77013 9.76036 8.03441 9.87592 8.26566C9.99509 8.49323 10.1576 8.67125 10.3635 8.79972C10.5729 8.92819 10.8113 8.99243 11.0785 8.99243Z\"></path>\n <path fill=\"currentColor\" d=\"M4.70482 9.99449C4.15229 9.99449 3.70087 9.83482 3.35057 9.51548C3.00388 9.19247 2.83054 8.75935 2.83054 8.2161C2.83054 7.70223 3.00207 7.28745 3.34515 6.97178C3.69184 6.65244 4.19562 6.49277 4.8565 6.49277H6.30284V5.94769C6.30284 5.61367 6.20533 5.36774 6.01032 5.20991C5.81531 5.04841 5.55349 4.96765 5.22485 4.96765C5.00817 4.96765 4.82941 4.99702 4.68857 5.05575C4.54773 5.11081 4.43758 5.18789 4.35813 5.28699C4.27868 5.38243 4.22271 5.49621 4.19021 5.62835H3.04722C3.06527 5.3861 3.12305 5.16586 3.22056 4.96765C3.32168 4.76577 3.46252 4.59326 3.64309 4.4501C3.82727 4.30328 4.05297 4.19133 4.32021 4.11425C4.59106 4.03716 4.90525 3.99862 5.26277 3.99862C5.67086 3.99862 6.04463 4.06286 6.38409 4.19133C6.72356 4.31613 6.99441 4.52168 7.19665 4.80798C7.39888 5.09429 7.5 5.4797 7.5 5.96421V9.9064H6.35701V9.1521H6.30284C6.21978 9.29892 6.10783 9.43657 5.96698 9.56504C5.82614 9.69351 5.65099 9.79812 5.44153 9.87887C5.23569 9.95595 4.99012 9.99449 4.70482 9.99449ZM5.07318 9.04749C5.3043 9.04749 5.51196 8.99977 5.69613 8.90434C5.88031 8.80523 6.02657 8.67309 6.13491 8.50791C6.24686 8.34274 6.30284 8.1537 6.30284 7.94081V7.31314H5.04609C4.69579 7.31314 4.43939 7.39206 4.27688 7.5499C4.11798 7.70773 4.03853 7.90961 4.03853 8.15554C4.03853 8.4602 4.14326 8.68594 4.35272 8.83276C4.56578 8.97591 4.80594 9.04749 5.07318 9.04749Z\"></path>\n <path fill=\"currentColor\" d=\"M2.5 12.5L13.5 12.5C14.3284 12.5 15 11.8284 15 11V9.5C15 9.22386 15.2239 9 15.5 9C15.7761 9 16 9.22386 16 9.5V11C16 12.3807 14.8807 13.5 13.5 13.5L2.5 13.5C1.11929 13.5 -7.56324e-07 12.3807 0 11L6.55675e-08 9.5C3.58362e-07 9.22386 0.223858 9 0.5 9C0.776142 9 1 9.22386 1 9.5L1 11C0.999999 11.8284 1.67157 12.5 2.5 12.5Z\"></path>\n </symbol>\n <symbol id=\"diffs-editor-icon-regex\" viewBox=\"0 0 16 16\">\n <path fill=\"currentColor\" d=\"M8.60788 6.59074C8.78227 6.46701 9.02141 6.60508 9.00146 6.81797L8.77564 9.22666C8.76189 9.37331 8.87726 9.5 9.02455 9.5H9.97548C10.1228 9.5 10.2381 9.37331 10.2244 9.22667L9.99858 6.81801C9.97862 6.60513 10.2178 6.46706 10.3922 6.59079L12.3652 7.99066C12.4853 8.07589 12.6527 8.03932 12.7264 7.91177L13.2018 7.08823C13.2755 6.96068 13.2234 6.79742 13.0896 6.73601L10.8907 5.72723C10.6963 5.63807 10.6963 5.36193 10.8907 5.27277L13.0896 4.264C13.2234 4.20258 13.2755 4.03932 13.2018 3.91177L12.7263 3.08824C12.6527 2.96068 12.4853 2.92411 12.3652 3.00934L10.3922 4.40921C10.2178 4.53294 9.97862 4.39486 9.99858 4.18198L10.2244 1.77334C10.2381 1.62669 10.1228 1.5 9.97548 1.5H9.02455C8.87726 1.5 8.76189 1.62669 8.77564 1.77334L9.00146 4.18203C9.02141 4.39491 8.78227 4.53298 8.60788 4.40926L6.63479 3.00934C6.51466 2.92411 6.34726 2.96068 6.27362 3.08823L5.79815 3.91177C5.72451 4.03932 5.77654 4.20258 5.91041 4.26399L8.10929 5.27277C8.30363 5.36193 8.30363 5.63807 8.10929 5.72723L5.91041 6.73601C5.77653 6.79742 5.7245 6.96068 5.79814 7.08824L6.27361 7.91177C6.34725 8.03932 6.51466 8.07589 6.63478 7.99066L8.60788 6.59074Z\"></path>\n <path fill=\"currentColor\" d=\"M4 11C3.44772 11 3 11.4477 3 12V13C3 13.5523 3.44772 14 4 14H5C5.55228 14 6 13.5523 6 13V12C6 11.4477 5.55228 11 5 11H4Z\"></path>\n </symbol>\n <symbol id=\"diffs-editor-icon-quick\" viewBox=\"0 0 20 20\">\n <polygon points=\"11 3 9 9 16 9 9 17 11 11 4 11 11 3\" fill=\"currentColor\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\"></polygon>\n </symbol>\n</svg>`;\n\nexport const getEditorIconSvg = (name: SVGSpriteNames, size = 16): string =>\n `<svg width=\"${size}\" height=\"${size}\" aria-hidden=\"true\" focusable=\"false\">\n<use href=\"#diffs-editor-icon-${name}\"></use>\n</svg>`;\n"],"mappings":";AAiBA,MAAa,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+B9B,MAAa,oBAAoB,MAAsB,OAAO,OAC5D,eAAe,KAAK,YAAY,KAAK;gCACP,KAAK"}
1
+ {"version":3,"file":"sprite.js","names":[],"sources":["../../src/editor/sprite.ts"],"sourcesContent":["export type SVGSpriteNames =\n | 'arrow-down'\n | 'arrow-up'\n | 'case'\n | 'close'\n | 'quick'\n | 'regex'\n | 'search'\n | 'whole-word';\n\n// Icon artwork is sourced from `@pierre/icons` (IconSearch, IconX,\n// IconArrowRightShort, IconType, IconTypeWord, IconRegex) so the editor matches\n// the rest of the product. The arrow glyph is the short right arrow rotated to\n// point up/down for the search \"previous\"/\"next\" controls. `quick` is the only\n// hand-authored glyph and uses its own 0 0 20 20 viewBox; `getEditorIconSvg`\n// omits an outer viewBox so each symbol scales to fill the requested size\n// regardless of its intrinsic coordinate system.\nexport const SVGSpriteSheet = `<svg data-icon-sprite aria-hidden=\"true\" width=\"0\" height=\"0\">\n <symbol id=\"diffs-editor-icon-search\" viewBox=\"0 0 16 16\">\n <path fill=\"currentColor\" fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M10.7747 12.8961C9.68558 13.5948 8.39011 14 7 14C3.13401 14 0 10.866 0 7C0 3.13401 3.13401 0 7 0C10.866 0 14 3.13401 14 7C14 8.39011 13.5948 9.68558 12.8961 10.7747L15.5607 13.4393C16.1464 14.0251 16.1464 14.9749 15.5607 15.5607C14.9749 16.1464 14.0251 16.1464 13.4393 15.5607L10.7747 12.8961ZM7 1.5C10.0376 1.5 12.5 3.96243 12.5 7C12.5 10.0376 10.0376 12.5 7 12.5C3.96243 12.5 1.5 10.0376 1.5 7C1.5 3.96243 3.96243 1.5 7 1.5Z\"></path>\n </symbol>\n <symbol id=\"diffs-editor-icon-close\" viewBox=\"0 0 16 16\">\n <path fill=\"currentColor\" d=\"M3.21967 3.21967C3.51256 2.92678 3.98744 2.92678 4.28033 3.21967L8 6.93934L11.7197 3.21967C12.0126 2.92678 12.4874 2.92678 12.7803 3.21967C13.0732 3.51256 13.0732 3.98744 12.7803 4.28033L9.06066 8L12.7803 11.7197C13.0732 12.0126 13.0732 12.4874 12.7803 12.7803C12.4874 13.0732 12.0126 13.0732 11.7197 12.7803L8 9.06066L4.28033 12.7803C3.98744 13.0732 3.51256 13.0732 3.21967 12.7803C2.92678 12.4874 2.92678 12.0126 3.21967 11.7197L6.93934 8L3.21967 4.28033C2.92678 3.98744 2.92678 3.51256 3.21967 3.21967Z\"></path>\n </symbol>\n <symbol id=\"diffs-editor-icon-arrow-up\" viewBox=\"0 0 16 16\">\n <path fill=\"currentColor\" transform=\"rotate(-90 8 8)\" d=\"M8.46967 4.21967C8.17678 4.51256 8.17678 4.98744 8.46967 5.28033L10.4393 7.25H3.75C3.33579 7.25 3 7.58579 3 8C3 8.41421 3.33579 8.75 3.75 8.75H10.4393L8.46967 10.7197C8.17678 11.0126 8.17678 11.4874 8.46967 11.7803C8.76256 12.0732 9.23744 12.0732 9.53033 11.7803L12.7803 8.53033C13.0732 8.23744 13.0732 7.76256 12.7803 7.46967L9.53033 4.21967C9.23744 3.92678 8.76256 3.92678 8.46967 4.21967Z\"></path>\n </symbol>\n <symbol id=\"diffs-editor-icon-arrow-down\" viewBox=\"0 0 16 16\">\n <path fill=\"currentColor\" transform=\"rotate(90 8 8)\" d=\"M8.46967 4.21967C8.17678 4.51256 8.17678 4.98744 8.46967 5.28033L10.4393 7.25H3.75C3.33579 7.25 3 7.58579 3 8C3 8.41421 3.33579 8.75 3.75 8.75H10.4393L8.46967 10.7197C8.17678 11.0126 8.17678 11.4874 8.46967 11.7803C8.76256 12.0732 9.23744 12.0732 9.53033 11.7803L12.7803 8.53033C13.0732 8.23744 13.0732 7.76256 12.7803 7.46967L9.53033 4.21967C9.23744 3.92678 8.76256 3.92678 8.46967 4.21967Z\"></path>\n </symbol>\n <symbol id=\"diffs-editor-icon-case\" viewBox=\"0 0 16 16\">\n <path fill=\"currentColor\" d=\"M12.2969 12.9969C10.7109 12.9969 9.61719 12.0125 9.61719 10.5047C9.61719 9.06719 10.6172 8.16094 12.5 8.15312H14.6641V7.31719C14.6641 6.23906 14.0391 5.64531 12.9297 5.64531C11.875 5.64531 11.2734 6.18437 11.1953 7.00469H9.92969C10.0156 5.56719 10.9922 4.52031 12.9766 4.52031C14.7266 4.52031 16 5.47344 16 7.2V12.8641H14.7109V11.8406H14.6719C14.2578 12.5047 13.5078 12.9969 12.2969 12.9969ZM12.6562 11.8797C13.8047 11.8797 14.6641 11.1609 14.6641 10.1375V9.18437H12.6016C11.4766 9.18437 10.9922 9.71562 10.9922 10.4578C10.9922 11.4266 11.7969 11.8797 12.6562 11.8797Z\"></path>\n <path fill=\"currentColor\" d=\"M1.42188 12.8641H0L3.79688 2H5.1875L8.98438 12.8641H7.54688L6.46875 9.66094H2.5L1.42188 12.8641ZM4.50781 3.60938H4.46875L2.86719 8.55937H6.10156L4.50781 3.60938Z\"></path>\n </symbol>\n <symbol id=\"diffs-editor-icon-whole-word\" viewBox=\"0 0 16 16\">\n <path fill=\"currentColor\" d=\"M11.4089 9.99449C11.1417 9.99449 10.8961 9.95595 10.6722 9.87887C10.4519 9.80179 10.2605 9.69167 10.098 9.54852C9.93551 9.40537 9.81453 9.23469 9.73508 9.03648H9.67007V9.91191H8.5V2H9.70258V5.01721H9.76758C9.81092 4.86671 9.88314 4.7309 9.98426 4.60977C10.089 4.48497 10.2136 4.37853 10.358 4.29043C10.5025 4.19867 10.6668 4.13076 10.851 4.08672C11.0352 4.039 11.2302 4.01514 11.436 4.01514C11.8802 4.01514 12.2648 4.11792 12.5898 4.32347C12.9149 4.52535 13.164 4.81532 13.3374 5.19339C13.5107 5.57146 13.5974 6.02478 13.5974 6.55334V7.45079C13.5974 7.97568 13.5089 8.429 13.332 8.81074C13.1586 9.1888 12.9076 9.48061 12.579 9.68617C12.2504 9.89172 11.8604 9.99449 11.4089 9.99449ZM11.0785 8.99243C11.353 8.99243 11.5859 8.92636 11.7773 8.79422C11.9723 8.66208 12.1204 8.46937 12.2215 8.2161C12.3226 7.95916 12.3732 7.65267 12.3732 7.29663V6.73503C12.3732 6.37164 12.3208 6.06332 12.2161 5.81005C12.115 5.55311 11.9669 5.35673 11.7719 5.22092C11.5769 5.08511 11.3385 5.01721 11.0568 5.01721C10.7824 5.01721 10.5422 5.08328 10.3364 5.21542C10.1341 5.34389 9.97704 5.52925 9.86509 5.77151C9.75675 6.01009 9.70258 6.2964 9.70258 6.63042V7.47281C9.70258 7.77013 9.76036 8.03441 9.87592 8.26566C9.99509 8.49323 10.1576 8.67125 10.3635 8.79972C10.5729 8.92819 10.8113 8.99243 11.0785 8.99243Z\"></path>\n <path fill=\"currentColor\" d=\"M4.70482 9.99449C4.15229 9.99449 3.70087 9.83482 3.35057 9.51548C3.00388 9.19247 2.83054 8.75935 2.83054 8.2161C2.83054 7.70223 3.00207 7.28745 3.34515 6.97178C3.69184 6.65244 4.19562 6.49277 4.8565 6.49277H6.30284V5.94769C6.30284 5.61367 6.20533 5.36774 6.01032 5.20991C5.81531 5.04841 5.55349 4.96765 5.22485 4.96765C5.00817 4.96765 4.82941 4.99702 4.68857 5.05575C4.54773 5.11081 4.43758 5.18789 4.35813 5.28699C4.27868 5.38243 4.22271 5.49621 4.19021 5.62835H3.04722C3.06527 5.3861 3.12305 5.16586 3.22056 4.96765C3.32168 4.76577 3.46252 4.59326 3.64309 4.4501C3.82727 4.30328 4.05297 4.19133 4.32021 4.11425C4.59106 4.03716 4.90525 3.99862 5.26277 3.99862C5.67086 3.99862 6.04463 4.06286 6.38409 4.19133C6.72356 4.31613 6.99441 4.52168 7.19665 4.80798C7.39888 5.09429 7.5 5.4797 7.5 5.96421V9.9064H6.35701V9.1521H6.30284C6.21978 9.29892 6.10783 9.43657 5.96698 9.56504C5.82614 9.69351 5.65099 9.79812 5.44153 9.87887C5.23569 9.95595 4.99012 9.99449 4.70482 9.99449ZM5.07318 9.04749C5.3043 9.04749 5.51196 8.99977 5.69613 8.90434C5.88031 8.80523 6.02657 8.67309 6.13491 8.50791C6.24686 8.34274 6.30284 8.1537 6.30284 7.94081V7.31314H5.04609C4.69579 7.31314 4.43939 7.39206 4.27688 7.5499C4.11798 7.70773 4.03853 7.90961 4.03853 8.15554C4.03853 8.4602 4.14326 8.68594 4.35272 8.83276C4.56578 8.97591 4.80594 9.04749 5.07318 9.04749Z\"></path>\n <path fill=\"currentColor\" d=\"M2.5 12.5L13.5 12.5C14.3284 12.5 15 11.8284 15 11V9.5C15 9.22386 15.2239 9 15.5 9C15.7761 9 16 9.22386 16 9.5V11C16 12.3807 14.8807 13.5 13.5 13.5L2.5 13.5C1.11929 13.5 -7.56324e-07 12.3807 0 11L6.55675e-08 9.5C3.58362e-07 9.22386 0.223858 9 0.5 9C0.776142 9 1 9.22386 1 9.5L1 11C0.999999 11.8284 1.67157 12.5 2.5 12.5Z\"></path>\n </symbol>\n <symbol id=\"diffs-editor-icon-regex\" viewBox=\"0 0 16 16\">\n <path fill=\"currentColor\" d=\"M8.60788 6.59074C8.78227 6.46701 9.02141 6.60508 9.00146 6.81797L8.77564 9.22666C8.76189 9.37331 8.87726 9.5 9.02455 9.5H9.97548C10.1228 9.5 10.2381 9.37331 10.2244 9.22667L9.99858 6.81801C9.97862 6.60513 10.2178 6.46706 10.3922 6.59079L12.3652 7.99066C12.4853 8.07589 12.6527 8.03932 12.7264 7.91177L13.2018 7.08823C13.2755 6.96068 13.2234 6.79742 13.0896 6.73601L10.8907 5.72723C10.6963 5.63807 10.6963 5.36193 10.8907 5.27277L13.0896 4.264C13.2234 4.20258 13.2755 4.03932 13.2018 3.91177L12.7263 3.08824C12.6527 2.96068 12.4853 2.92411 12.3652 3.00934L10.3922 4.40921C10.2178 4.53294 9.97862 4.39486 9.99858 4.18198L10.2244 1.77334C10.2381 1.62669 10.1228 1.5 9.97548 1.5H9.02455C8.87726 1.5 8.76189 1.62669 8.77564 1.77334L9.00146 4.18203C9.02141 4.39491 8.78227 4.53298 8.60788 4.40926L6.63479 3.00934C6.51466 2.92411 6.34726 2.96068 6.27362 3.08823L5.79815 3.91177C5.72451 4.03932 5.77654 4.20258 5.91041 4.26399L8.10929 5.27277C8.30363 5.36193 8.30363 5.63807 8.10929 5.72723L5.91041 6.73601C5.77653 6.79742 5.7245 6.96068 5.79814 7.08824L6.27361 7.91177C6.34725 8.03932 6.51466 8.07589 6.63478 7.99066L8.60788 6.59074Z\"></path>\n <path fill=\"currentColor\" d=\"M4 11C3.44772 11 3 11.4477 3 12V13C3 13.5523 3.44772 14 4 14H5C5.55228 14 6 13.5523 6 13V12C6 11.4477 5.55228 11 5 11H4Z\"></path>\n </symbol>\n <symbol id=\"diffs-editor-icon-quick\" viewBox=\"0 0 20 20\">\n <polygon points=\"11 3 9 9 16 9 9 17 11 11 4 11 11 3\" fill=\"currentColor\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\"></polygon>\n </symbol>\n</svg>`;\n\nexport const createSpriteElement = (): SVGSVGElement => {\n const fragment = document.createElement('div');\n fragment.innerHTML = SVGSpriteSheet;\n const sprite = fragment.firstElementChild;\n if (sprite === null || !(sprite instanceof SVGSVGElement)) {\n throw new Error('Failed to create sprite element');\n }\n return sprite;\n};\n\nexport const getEditorIconSvg = (name: SVGSpriteNames, size = 16): string =>\n `<svg width=\"${size}\" height=\"${size}\" aria-hidden=\"true\" focusable=\"false\">\n<use href=\"#diffs-editor-icon-${name}\"></use>\n</svg>`;\n"],"mappings":";AAiBA,MAAa,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+B9B,MAAa,4BAA2C;CACtD,MAAM,WAAW,SAAS,cAAc,MAAM;AAC9C,UAAS,YAAY;CACrB,MAAM,SAAS,SAAS;AACxB,KAAI,WAAW,QAAQ,EAAE,kBAAkB,eACzC,OAAM,IAAI,MAAM,kCAAkC;AAEpD,QAAO;;AAGT,MAAa,oBAAoB,MAAsB,OAAO,OAC5D,eAAe,KAAK,YAAY,KAAK;gCACP,KAAK"}
@@ -1,7 +1,7 @@
1
1
  import { DiffLineAnnotation } from "../types.js";
2
+ import { EditorSelection } from "./selection.js";
2
3
  import { EditStack } from "./editStack.js";
3
4
  import { SearchParams } from "./searchPanel.js";
4
- import { EditorSelection } from "./selection.js";
5
5
 
6
6
  //#region src/editor/textDocument.d.ts
7
7
 
@@ -101,7 +101,7 @@ interface TextDocumentChange {
101
101
  /** Difference between the old and new line counts. */
102
102
  readonly lineDelta: number;
103
103
  /** Exact rendered line ranges touched by each edit after the edit was applied. */
104
- readonly changedLineRanges?: readonly [startLine: number, endLine: number][];
104
+ readonly changedLineRanges: readonly [startLine: number, endLine: number][];
105
105
  }
106
106
  /**
107
107
  * A vscode-languageserver-textdocument compatible text document.
@@ -118,9 +118,9 @@ declare class TextDocument<LAnnotation> {
118
118
  positionAt(offset: number): Position;
119
119
  positionsAt(offsets: readonly number[]): Position[];
120
120
  offsetAt(position: Position): number;
121
- offsetsAt(positions: readonly Position[]): number[];
122
121
  getText(range?: Range): string;
123
- getLineText(line: number, trimEOF?: boolean): string;
122
+ getLineText(line: number, includeLineBreak?: boolean): string;
123
+ getLineLength(line: number, includeLineBreak?: boolean): number;
124
124
  charAt(offset: number): string;
125
125
  charAt(position: Position): string;
126
126
  getTextSlice(start: number, end: number): string;
@@ -1 +1 @@
1
- {"version":3,"file":"textDocument.d.ts","names":["DiffLineAnnotation","EditStack","SearchParams","EditorSelection","Position","Range","TextEdit","ResolvedTextEdit","TextDocumentChange","TextDocument","LAnnotation"],"sources":["../../src/editor/textDocument.d.ts"],"sourcesContent":["import type { DiffLineAnnotation } from '../types';\nimport { EditStack } from './editStack';\nimport type { SearchParams } from './searchPanel';\nimport { type EditorSelection } from './selection';\n/**\n * Position in a text document expressed as zero-based line and character offset.\n * The offsets are based on a UTF-16 string representation. So a string of the form\n * `a𐐀b` the character offset of the character `a` is 0, the character offset of `𐐀`\n * is 1 and the character offset of b is 3 since `𐐀` is represented using two code\n * units in UTF-16.\n *\n * Positions are line end character agnostic. So you can not specify a position that\n * denotes `\\r|\\n` or `\\n|` where `|` represents the character offset.\n */\nexport interface Position {\n /**\n * Line position in a document (zero-based).\n *\n * If a line number is greater than the number of lines in a document, it\n * defaults back to the number of lines in the document.\n * If a line number is negative, it defaults to 0.\n *\n * The above two properties are implementation specific.\n */\n readonly line: number;\n /**\n * Character offset on a line in a document (zero-based).\n *\n * The meaning of this offset is determined by the negotiated\n * `PositionEncodingKind`.\n *\n * If the character value is greater than the line length it defaults back\n * to the line length. This property is implementation specific.\n */\n readonly character: number;\n}\n/**\n * A range in a text document expressed as (zero-based) start and end positions.\n *\n * If you want to specify a range that contains a line including the line ending\n * character(s) then use an end position denoting the start of the next line.\n * For example:\n * ```ts\n * {\n * start: { line: 5, character: 23 }\n * end : { line 6, character : 0 }\n * }\n * ```\n */\nexport interface Range {\n /**\n * The range's start position.\n */\n readonly start: Position;\n /**\n * The range's end position.\n */\n readonly end: Position;\n}\n/**\n * A text edit applicable to a text document.\n */\nexport interface TextEdit {\n /**\n * The range of the text document to be manipulated. To insert\n * text into a document create a range where start === end.\n */\n readonly range: Range;\n /**\n * The string to be inserted. For delete operations use an\n * empty string.\n */\n readonly newText: string;\n}\n/** Different with `TextEdit`, the range has been resolved to offsets. */\nexport interface ResolvedTextEdit {\n /** The start offset of the text change. */\n readonly start: number;\n /** The end offset of the text change. */\n readonly end: number;\n /**\n * The string to be inserted. For delete operations use an\n * empty string.\n */\n readonly text: string;\n}\nexport interface TextDocumentChange {\n /** First line whose rendered content or tokenizer state may have changed. */\n readonly startLine: number;\n /** Character on the first changed line where the edit began. */\n readonly startCharacter: number;\n /** Last line whose rendered content may have changed after the edit. */\n readonly endLine: number;\n /** Line count before the edit was applied. */\n readonly previousLineCount: number;\n /** Line count after the edit was applied. */\n readonly lineCount: number;\n /** Difference between the old and new line counts. */\n readonly lineDelta: number;\n /** Exact rendered line ranges touched by each edit after the edit was applied. */\n readonly changedLineRanges?: readonly [startLine: number, endLine: number][];\n}\n/**\n * A vscode-languageserver-textdocument compatible text document.\n */\nexport declare class TextDocument<LAnnotation> {\n #private;\n constructor(uri: string, text: string, languageId?: string, version?: number, editStack?: EditStack<LAnnotation>);\n get uri(): string;\n get languageId(): string;\n get version(): number;\n get lineCount(): number;\n get canUndo(): boolean;\n get canRedo(): boolean;\n positionAt(offset: number): Position;\n positionsAt(offsets: readonly number[]): Position[];\n offsetAt(position: Position): number;\n offsetsAt(positions: readonly Position[]): number[];\n getText(range?: Range): string;\n getLineText(line: number, trimEOF?: boolean): string;\n charAt(offset: number): string;\n charAt(position: Position): string;\n getTextSlice(start: number, end: number): string;\n findNextNonOverlappingSubstring(needle: string, occupied: readonly [start: number, end: number][]): number | undefined;\n search(searchParams: SearchParams): [start: number, end: number][];\n applyEdits(edits: TextEdit[], updateHistory?: boolean, selectionsBefore?: EditorSelection[], selectionsAfter?: EditorSelection[]): TextDocumentChange | undefined;\n applyResolvedEdits(edits: ResolvedTextEdit[], updateHistory?: boolean, selectionsBefore?: EditorSelection[], selectionsAfter?: EditorSelection[]): TextDocumentChange | undefined;\n setLastUndoSelectionsAfter(selections: EditorSelection[]): void;\n setLastUndoLineAnnotations(lineAnnotationsBefore: DiffLineAnnotation<LAnnotation>[], lineAnnotationsAfter: DiffLineAnnotation<LAnnotation>[]): void;\n undo(): [\n change: TextDocumentChange,\n selections?: EditorSelection[],\n lineAnnotations?: DiffLineAnnotation<LAnnotation>[]\n ] | undefined;\n redo(): [\n change: TextDocumentChange,\n selections?: EditorSelection[],\n lineAnnotations?: DiffLineAnnotation<LAnnotation>[]\n ] | undefined;\n normalizePosition(position: Position): Position;\n}\n//# sourceMappingURL=textDocument.d.ts.map"],"mappings":";;;;;;;;;AAcA;AAmCA;AAaA;AAaA;AAWA;AAmBA;;;AASgCI,UApGfA,QAAAA,CAoGeA;EACaA;;;;;;;;;EAU0FI,SAAAA,IAAAA,EAAAA,MAAAA;EACzGD;;;;;;;;;EAIdC,SAAAA,SAAAA,EAAAA,MAAAA;;;;;;;;;;;;;;;UAjFCH,KAAAA;;;;kBAIGD;;;;gBAIFA;;;;;UAKDE,QAAAA;;;;;kBAKGD;;;;;;;;UAQHE,gBAAAA;;;;;;;;;;;UAWAC,kBAAAA;;;;;;;;;;;;;;;;;;;cAmBIC;;4FAEyER,UAAUS;;;;;;;8BAOxEN;2CACaA;qBACtBA;gCACWA;kBACdC;;;mBAGCD;;;uBAGIF;oBACHI,wDAAwDH,qCAAqCA,oBAAoBK;4BACzGD,gEAAgEJ,qCAAqCA,oBAAoBK;yCAC5GL;oDACWH,mBAAmBU,sCAAsCV,mBAAmBU;mBAElHF,iCACKL,qCACKH,mBAAmBU;mBAG7BF,iCACKL,qCACKH,mBAAmBU;8BAEbN,WAAWA"}
1
+ {"version":3,"file":"textDocument.d.ts","names":["DiffLineAnnotation","EditStack","SearchParams","EditorSelection","Position","Range","TextEdit","ResolvedTextEdit","TextDocumentChange","TextDocument","LAnnotation"],"sources":["../../src/editor/textDocument.d.ts"],"sourcesContent":["import type { DiffLineAnnotation } from '../types';\nimport { EditStack } from './editStack';\nimport type { SearchParams } from './searchPanel';\nimport { type EditorSelection } from './selection';\n/**\n * Position in a text document expressed as zero-based line and character offset.\n * The offsets are based on a UTF-16 string representation. So a string of the form\n * `a𐐀b` the character offset of the character `a` is 0, the character offset of `𐐀`\n * is 1 and the character offset of b is 3 since `𐐀` is represented using two code\n * units in UTF-16.\n *\n * Positions are line end character agnostic. So you can not specify a position that\n * denotes `\\r|\\n` or `\\n|` where `|` represents the character offset.\n */\nexport interface Position {\n /**\n * Line position in a document (zero-based).\n *\n * If a line number is greater than the number of lines in a document, it\n * defaults back to the number of lines in the document.\n * If a line number is negative, it defaults to 0.\n *\n * The above two properties are implementation specific.\n */\n readonly line: number;\n /**\n * Character offset on a line in a document (zero-based).\n *\n * The meaning of this offset is determined by the negotiated\n * `PositionEncodingKind`.\n *\n * If the character value is greater than the line length it defaults back\n * to the line length. This property is implementation specific.\n */\n readonly character: number;\n}\n/**\n * A range in a text document expressed as (zero-based) start and end positions.\n *\n * If you want to specify a range that contains a line including the line ending\n * character(s) then use an end position denoting the start of the next line.\n * For example:\n * ```ts\n * {\n * start: { line: 5, character: 23 }\n * end : { line 6, character : 0 }\n * }\n * ```\n */\nexport interface Range {\n /**\n * The range's start position.\n */\n readonly start: Position;\n /**\n * The range's end position.\n */\n readonly end: Position;\n}\n/**\n * A text edit applicable to a text document.\n */\nexport interface TextEdit {\n /**\n * The range of the text document to be manipulated. To insert\n * text into a document create a range where start === end.\n */\n readonly range: Range;\n /**\n * The string to be inserted. For delete operations use an\n * empty string.\n */\n readonly newText: string;\n}\n/** Different with `TextEdit`, the range has been resolved to offsets. */\nexport interface ResolvedTextEdit {\n /** The start offset of the text change. */\n readonly start: number;\n /** The end offset of the text change. */\n readonly end: number;\n /**\n * The string to be inserted. For delete operations use an\n * empty string.\n */\n readonly text: string;\n}\nexport interface TextDocumentChange {\n /** First line whose rendered content or tokenizer state may have changed. */\n readonly startLine: number;\n /** Character on the first changed line where the edit began. */\n readonly startCharacter: number;\n /** Last line whose rendered content may have changed after the edit. */\n readonly endLine: number;\n /** Line count before the edit was applied. */\n readonly previousLineCount: number;\n /** Line count after the edit was applied. */\n readonly lineCount: number;\n /** Difference between the old and new line counts. */\n readonly lineDelta: number;\n /** Exact rendered line ranges touched by each edit after the edit was applied. */\n readonly changedLineRanges: readonly [startLine: number, endLine: number][];\n}\n/**\n * A vscode-languageserver-textdocument compatible text document.\n */\nexport declare class TextDocument<LAnnotation> {\n #private;\n constructor(uri: string, text: string, languageId?: string, version?: number, editStack?: EditStack<LAnnotation>);\n get uri(): string;\n get languageId(): string;\n get version(): number;\n get lineCount(): number;\n get canUndo(): boolean;\n get canRedo(): boolean;\n positionAt(offset: number): Position;\n positionsAt(offsets: readonly number[]): Position[];\n offsetAt(position: Position): number;\n getText(range?: Range): string;\n getLineText(line: number, includeLineBreak?: boolean): string;\n getLineLength(line: number, includeLineBreak?: boolean): number;\n charAt(offset: number): string;\n charAt(position: Position): string;\n getTextSlice(start: number, end: number): string;\n findNextNonOverlappingSubstring(needle: string, occupied: readonly [start: number, end: number][]): number | undefined;\n search(searchParams: SearchParams): [start: number, end: number][];\n applyEdits(edits: TextEdit[], updateHistory?: boolean, selectionsBefore?: EditorSelection[], selectionsAfter?: EditorSelection[]): TextDocumentChange | undefined;\n applyResolvedEdits(edits: ResolvedTextEdit[], updateHistory?: boolean, selectionsBefore?: EditorSelection[], selectionsAfter?: EditorSelection[]): TextDocumentChange | undefined;\n setLastUndoSelectionsAfter(selections: EditorSelection[]): void;\n setLastUndoLineAnnotations(lineAnnotationsBefore: DiffLineAnnotation<LAnnotation>[], lineAnnotationsAfter: DiffLineAnnotation<LAnnotation>[]): void;\n undo(): [\n change: TextDocumentChange,\n selections?: EditorSelection[],\n lineAnnotations?: DiffLineAnnotation<LAnnotation>[]\n ] | undefined;\n redo(): [\n change: TextDocumentChange,\n selections?: EditorSelection[],\n lineAnnotations?: DiffLineAnnotation<LAnnotation>[]\n ] | undefined;\n normalizePosition(position: Position): Position;\n}\n//# sourceMappingURL=textDocument.d.ts.map"],"mappings":";;;;;;;;;AAcA;AAmCA;AAaA;AAaA;AAWA;AAmBA;;;AASgCI,UApGfA,QAAAA,CAoGeA;EACaA;;;;;;;;;EAWfG,SAAAA,IAAAA,EAAAA,MAAAA;EAAgEJ;;;;;;;;;EAKzEA,SAAAA,SAAAA,EAAAA,MAAAA;;;;;;;;;;;;;;;UAlFJE,KAAAA;;;;kBAIGD;;;;gBAIFA;;;;;UAKDE,QAAAA;;;;;kBAKGD;;;;;;;;UAQHE,gBAAAA;;;;;;;;;;;UAWAC,kBAAAA;;;;;;;;;;;;;;;;;;;cAmBIC;;4FAEyER,UAAUS;;;;;;;8BAOxEN;2CACaA;qBACtBA;kBACHC;;;;mBAICD;;;uBAGIF;oBACHI,wDAAwDH,qCAAqCA,oBAAoBK;4BACzGD,gEAAgEJ,qCAAqCA,oBAAoBK;yCAC5GL;oDACWH,mBAAmBU,sCAAsCV,mBAAmBU;mBAElHF,iCACKL,qCACKH,mBAAmBU;mBAG7BF,iCACKL,qCACKH,mBAAmBU;8BAEbN,WAAWA"}
@@ -43,16 +43,16 @@ var TextDocument = class {
43
43
  return this.#pieceTable.positionsAt(offsets);
44
44
  }
45
45
  offsetAt(position) {
46
- return this.#pieceTable.offsetAt(position);
47
- }
48
- offsetsAt(positions) {
49
- return this.#pieceTable.offsetsAt(positions);
46
+ return this.#pieceTable.offsetAt(this.normalizePosition(position));
50
47
  }
51
48
  getText(range) {
52
49
  return this.#pieceTable.getText(range);
53
50
  }
54
- getLineText(line, trimEOF = true) {
55
- return this.#pieceTable.getLineText(line, trimEOF);
51
+ getLineText(line, includeLineBreak) {
52
+ return this.#pieceTable.getLineText(line, includeLineBreak);
53
+ }
54
+ getLineLength(line, includeLineBreak) {
55
+ return this.#pieceTable.getLineLength(line, includeLineBreak);
56
56
  }
57
57
  charAt(positionOrOffset) {
58
58
  if (typeof positionOrOffset === "number") return this.#pieceTable.charAt(positionOrOffset);
@@ -121,7 +121,7 @@ var TextDocument = class {
121
121
  const line = Math.max(0, Math.min(position.line, this.lineCount - 1));
122
122
  return {
123
123
  line,
124
- character: Math.max(0, Math.min(position.character, this.getLineText(line).length))
124
+ character: Math.max(0, Math.min(position.character, this.getLineLength(line)))
125
125
  };
126
126
  }
127
127
  #resolveEdit(edit) {
@@ -1 +1 @@
1
- {"version":3,"file":"textDocument.js","names":["#uri","#languageId","#version","#pieceTable","#editStack","#resolveEdit","#sortAndValidateResolvedEdits","change","#applyResolvedEditsToBuffer","#computeChangedLineRange","ranges: [number, number][]"],"sources":["../../src/editor/textDocument.ts"],"sourcesContent":["import type { DiffLineAnnotation } from '../types';\nimport {\n coalesceEditStackEntries,\n createEditStackEntry,\n EditStack,\n shouldCoalesceEditStackEntry,\n} from './editStack';\nimport { PieceTable } from './pieceTable';\nimport type { SearchParams } from './searchPanel';\nimport { type EditorSelection } from './selection';\n\n/**\n * Position in a text document expressed as zero-based line and character offset.\n * The offsets are based on a UTF-16 string representation. So a string of the form\n * `a𐐀b` the character offset of the character `a` is 0, the character offset of `𐐀`\n * is 1 and the character offset of b is 3 since `𐐀` is represented using two code\n * units in UTF-16.\n *\n * Positions are line end character agnostic. So you can not specify a position that\n * denotes `\\r|\\n` or `\\n|` where `|` represents the character offset.\n */\nexport interface Position {\n /**\n * Line position in a document (zero-based).\n *\n * If a line number is greater than the number of lines in a document, it\n * defaults back to the number of lines in the document.\n * If a line number is negative, it defaults to 0.\n *\n * The above two properties are implementation specific.\n */\n readonly line: number;\n /**\n * Character offset on a line in a document (zero-based).\n *\n * The meaning of this offset is determined by the negotiated\n * `PositionEncodingKind`.\n *\n * If the character value is greater than the line length it defaults back\n * to the line length. This property is implementation specific.\n */\n readonly character: number;\n}\n\n/**\n * A range in a text document expressed as (zero-based) start and end positions.\n *\n * If you want to specify a range that contains a line including the line ending\n * character(s) then use an end position denoting the start of the next line.\n * For example:\n * ```ts\n * {\n * start: { line: 5, character: 23 }\n * end : { line 6, character : 0 }\n * }\n * ```\n */\nexport interface Range {\n /**\n * The range's start position.\n */\n readonly start: Position;\n /**\n * The range's end position.\n */\n readonly end: Position;\n}\n\n/**\n * A text edit applicable to a text document.\n */\nexport interface TextEdit {\n /**\n * The range of the text document to be manipulated. To insert\n * text into a document create a range where start === end.\n */\n readonly range: Range;\n /**\n * The string to be inserted. For delete operations use an\n * empty string.\n */\n readonly newText: string;\n}\n\n/** Different with `TextEdit`, the range has been resolved to offsets. */\nexport interface ResolvedTextEdit {\n /** The start offset of the text change. */\n readonly start: number;\n /** The end offset of the text change. */\n readonly end: number;\n /**\n * The string to be inserted. For delete operations use an\n * empty string.\n */\n readonly text: string;\n}\n\nexport interface TextDocumentChange {\n /** First line whose rendered content or tokenizer state may have changed. */\n readonly startLine: number;\n /** Character on the first changed line where the edit began. */\n readonly startCharacter: number;\n /** Last line whose rendered content may have changed after the edit. */\n readonly endLine: number;\n /** Line count before the edit was applied. */\n readonly previousLineCount: number;\n /** Line count after the edit was applied. */\n readonly lineCount: number;\n /** Difference between the old and new line counts. */\n readonly lineDelta: number;\n /** Exact rendered line ranges touched by each edit after the edit was applied. */\n readonly changedLineRanges?: readonly [startLine: number, endLine: number][];\n}\n\n/**\n * A vscode-languageserver-textdocument compatible text document.\n */\nexport class TextDocument<LAnnotation> {\n #uri: string;\n #languageId: string;\n #version: number;\n #pieceTable: PieceTable;\n #editStack: EditStack<LAnnotation>;\n\n constructor(\n uri: string,\n text: string,\n languageId = 'plaintext',\n version = 0,\n editStack: EditStack<LAnnotation> = new EditStack()\n ) {\n this.#uri = new URL(uri, 'file://').toString();\n this.#languageId = languageId;\n this.#version = version;\n this.#pieceTable = new PieceTable(text);\n this.#editStack = editStack;\n }\n\n get uri(): string {\n return this.#uri;\n }\n\n get languageId(): string {\n return this.#languageId;\n }\n\n get version(): number {\n return this.#version;\n }\n\n get lineCount(): number {\n return this.#pieceTable.lineCount;\n }\n\n get canUndo(): boolean {\n return this.#editStack.canUndo;\n }\n\n get canRedo(): boolean {\n return this.#editStack.canRedo;\n }\n\n positionAt(offset: number): Position {\n return this.#pieceTable.positionAt(offset);\n }\n\n positionsAt(offsets: readonly number[]): Position[] {\n return this.#pieceTable.positionsAt(offsets);\n }\n\n offsetAt(position: Position): number {\n return this.#pieceTable.offsetAt(position);\n }\n\n offsetsAt(positions: readonly Position[]): number[] {\n return this.#pieceTable.offsetsAt(positions);\n }\n\n getText(range?: Range): string {\n return this.#pieceTable.getText(range);\n }\n\n getLineText(line: number, trimEOF = true): string {\n return this.#pieceTable.getLineText(line, trimEOF);\n }\n\n charAt(offset: number): string;\n charAt(position: Position): string;\n charAt(positionOrOffset: Position | number): string {\n if (typeof positionOrOffset === 'number') {\n return this.#pieceTable.charAt(positionOrOffset);\n }\n return this.#pieceTable.charAt(this.offsetAt(positionOrOffset));\n }\n\n getTextSlice(start: number, end: number): string {\n return this.#pieceTable.getTextSlice(start, end);\n }\n\n findNextNonOverlappingSubstring(\n needle: string,\n occupied: readonly [start: number, end: number][]\n ): number | undefined {\n return this.#pieceTable.findNextNonOverlappingSubstring(needle, occupied);\n }\n\n search(searchParams: SearchParams): [start: number, end: number][] {\n return this.#pieceTable.search(searchParams);\n }\n\n applyEdits(\n edits: TextEdit[],\n updateHistory = false,\n selectionsBefore?: EditorSelection[],\n selectionsAfter?: EditorSelection[]\n ): TextDocumentChange | undefined {\n if (edits.length === 0) {\n return;\n }\n return this.applyResolvedEdits(\n edits.map((edit) => this.#resolveEdit(edit)),\n updateHistory,\n selectionsBefore,\n selectionsAfter\n );\n }\n\n applyResolvedEdits(\n edits: ResolvedTextEdit[],\n updateHistory = false,\n selectionsBefore?: EditorSelection[],\n selectionsAfter?: EditorSelection[]\n ): TextDocumentChange | undefined {\n if (edits.length === 0) {\n return undefined;\n }\n const resolvedEdits = this.#sortAndValidateResolvedEdits(edits);\n if (updateHistory) {\n const entry = createEditStackEntry(\n this,\n resolvedEdits,\n this.#version,\n this.#version + 1,\n selectionsBefore,\n selectionsAfter\n );\n const previousEntry = this.#editStack.peekUndo();\n const change = this.#applyResolvedEditsToBuffer(resolvedEdits);\n this.#version++;\n if (\n change.lineDelta === 0 &&\n shouldCoalesceEditStackEntry(previousEntry, entry)\n ) {\n this.#editStack.replaceLastUndo(\n coalesceEditStackEntries(previousEntry!, entry)\n );\n } else {\n this.#editStack.push(entry);\n }\n return change;\n }\n const change = this.#applyResolvedEditsToBuffer(resolvedEdits);\n this.#version++;\n return change;\n }\n\n setLastUndoSelectionsAfter(selections: EditorSelection[]): void {\n this.#editStack.setLastUndoSelectionsAfter(selections);\n }\n\n setLastUndoLineAnnotations(\n lineAnnotationsBefore: DiffLineAnnotation<LAnnotation>[],\n lineAnnotationsAfter: DiffLineAnnotation<LAnnotation>[]\n ): void {\n this.#editStack.setLastUndoLineAnnotations(\n lineAnnotationsBefore,\n lineAnnotationsAfter\n );\n }\n\n undo():\n | [\n change: TextDocumentChange,\n selections?: EditorSelection[],\n lineAnnotations?: DiffLineAnnotation<LAnnotation>[],\n ]\n | undefined {\n const entry = this.#editStack.popUndoToRedo();\n if (entry === undefined) {\n return undefined;\n }\n const change = this.#applyResolvedEditsToBuffer(entry.inverseEdits);\n if (change === undefined) {\n return undefined;\n }\n this.#version = entry.versionBefore;\n return [\n change,\n entry.selectionsBefore?.slice(),\n entry.lineAnnotationsBefore?.slice(),\n ];\n }\n\n redo():\n | [\n change: TextDocumentChange,\n selections?: EditorSelection[],\n lineAnnotations?: DiffLineAnnotation<LAnnotation>[],\n ]\n | undefined {\n const entry = this.#editStack.popRedoToUndo();\n if (entry === undefined) {\n return undefined;\n }\n const change = this.#applyResolvedEditsToBuffer(entry.forwardEdits);\n if (change === undefined) {\n return undefined;\n }\n this.#version = entry.versionAfter;\n return [\n change,\n entry.selectionsAfter?.slice(),\n entry.lineAnnotationsAfter?.slice(),\n ];\n }\n\n normalizePosition(position: Position): Position {\n const line = Math.max(0, Math.min(position.line, this.lineCount - 1));\n return {\n line,\n character: Math.max(\n 0,\n Math.min(position.character, this.getLineText(line).length)\n ),\n };\n }\n\n #resolveEdit(edit: TextEdit): ResolvedTextEdit {\n let start = this.offsetAt(edit.range.start);\n let end = this.offsetAt(edit.range.end);\n if (start > end) {\n const t = start;\n start = end;\n end = t;\n }\n return { start, end, text: edit.newText };\n }\n\n #sortAndValidateResolvedEdits(edits: ResolvedTextEdit[]): ResolvedTextEdit[] {\n const sortedEdits = [...edits].sort((a, b) => a.start - b.start);\n for (let i = 0; i < sortedEdits.length - 1; i++) {\n if (sortedEdits[i].end > sortedEdits[i + 1].start) {\n throw new Error('Overlapping text edits are not supported');\n }\n }\n return sortedEdits;\n }\n\n #applyResolvedEditsToBuffer(edits: ResolvedTextEdit[]): TextDocumentChange {\n const previousLineCount = this.#pieceTable.lineCount;\n const editPositions = this.positionsAt(\n edits.flatMap((edit) => [edit.start, edit.end])\n );\n const changedLineRange = this.#computeChangedLineRange(\n edits,\n editPositions\n );\n const startPosition = editPositions[0];\n this.#pieceTable.applyEdits(edits);\n const lineCount = this.#pieceTable.lineCount;\n const change: TextDocumentChange = {\n startLine: changedLineRange.startLine,\n startCharacter: startPosition.character,\n endLine: Math.min(changedLineRange.endLine, Math.max(0, lineCount - 1)),\n previousLineCount,\n lineCount,\n lineDelta: lineCount - previousLineCount,\n changedLineRanges: changedLineRange.ranges,\n };\n return change;\n }\n\n #computeChangedLineRange(\n edits: ResolvedTextEdit[],\n editPositions: Position[]\n ): {\n startLine: number;\n endLine: number;\n ranges: [number, number][];\n } {\n let startLine = Infinity;\n let endLine = 0;\n let lineDeltaBeforeEdit = 0;\n const ranges: [number, number][] = [];\n for (let i = 0; i < edits.length; i++) {\n const edit = edits[i];\n const editStartLine = editPositions[i * 2].line;\n const editEndLine = editPositions[i * 2 + 1].line;\n const insertedLineSpan = lineFeedCount(edit.text);\n const changedStartLine = editStartLine + lineDeltaBeforeEdit;\n const changedEndLine = changedStartLine + insertedLineSpan;\n startLine = Math.min(startLine, editStartLine);\n endLine = Math.max(endLine, changedEndLine);\n const lastRange = ranges[ranges.length - 1];\n if (lastRange !== undefined && changedStartLine <= lastRange[1] + 1) {\n ranges[ranges.length - 1] = [\n lastRange[0],\n Math.max(lastRange[1], changedEndLine),\n ];\n } else {\n ranges.push([changedStartLine, changedEndLine]);\n }\n lineDeltaBeforeEdit += insertedLineSpan - (editEndLine - editStartLine);\n }\n if (startLine === Infinity) {\n return {\n startLine: 0,\n endLine: 0,\n ranges: [[0, 0]],\n };\n }\n return { startLine, endLine, ranges };\n }\n}\n\nfunction lineFeedCount(text: string): number {\n let count = 0;\n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AAgB,cAAc;GAC9B,SAAS,KAAK,IAAI,iBAAiB,SAAS,KAAK,IAAI,GAAG,YAAY,EAAE,CAAC;GACvE;GACA;GACA,WAAW,YAAY;GACvB,mBAAmB,iBAAiB;GACrC;;CAIH,yBACE,OACA,eAKA;EACA,IAAI,YAAY;EAChB,IAAI,UAAU;EACd,IAAI,sBAAsB;EAC1B,MAAMO,SAA6B,EAAE;AACrC,OAAK,IAAI,IAAI,GAAG,IAAI,MAAM,QAAQ,KAAK;GACrC,MAAM,OAAO,MAAM;GACnB,MAAM,gBAAgB,cAAc,IAAI,GAAG;GAC3C,MAAM,cAAc,cAAc,IAAI,IAAI,GAAG;GAC7C,MAAM,mBAAmB,cAAc,KAAK,KAAK;GACjD,MAAM,mBAAmB,gBAAgB;GACzC,MAAM,iBAAiB,mBAAmB;AAC1C,eAAY,KAAK,IAAI,WAAW,cAAc;AAC9C,aAAU,KAAK,IAAI,SAAS,eAAe;GAC3C,MAAM,YAAY,OAAO,OAAO,SAAS;AACzC,OAAI,cAAc,UAAa,oBAAoB,UAAU,KAAK,EAChE,QAAO,OAAO,SAAS,KAAK,CAC1B,UAAU,IACV,KAAK,IAAI,UAAU,IAAI,eAAe,CACvC;OAED,QAAO,KAAK,CAAC,kBAAkB,eAAe,CAAC;AAEjD,0BAAuB,oBAAoB,cAAc;;AAE3D,MAAI,cAAc,SAChB,QAAO;GACL,WAAW;GACX,SAAS;GACT,QAAQ,CAAC,CAAC,GAAG,EAAE,CAAC;GACjB;AAEH,SAAO;GAAE;GAAW;GAAS;GAAQ;;;AAIzC,SAAS,cAAc,MAAsB;CAC3C,IAAI,QAAQ;AACZ,MAAK,IAAI,IAAI,GAAG,IAAI,KAAK,QAAQ,IAC/B,KAAI,KAAK,WAAW,EAAE,KAAc,GAClC;AAGJ,QAAO"}
1
+ {"version":3,"file":"textDocument.js","names":["#uri","#languageId","#version","#pieceTable","#editStack","#resolveEdit","#sortAndValidateResolvedEdits","change","#applyResolvedEditsToBuffer","#computeChangedLineRange","ranges: [number, number][]"],"sources":["../../src/editor/textDocument.ts"],"sourcesContent":["import type { DiffLineAnnotation } from '../types';\nimport {\n coalesceEditStackEntries,\n createEditStackEntry,\n EditStack,\n shouldCoalesceEditStackEntry,\n} from './editStack';\nimport { PieceTable } from './pieceTable';\nimport type { SearchParams } from './searchPanel';\nimport { type EditorSelection } from './selection';\n\n/**\n * Position in a text document expressed as zero-based line and character offset.\n * The offsets are based on a UTF-16 string representation. So a string of the form\n * `a𐐀b` the character offset of the character `a` is 0, the character offset of `𐐀`\n * is 1 and the character offset of b is 3 since `𐐀` is represented using two code\n * units in UTF-16.\n *\n * Positions are line end character agnostic. So you can not specify a position that\n * denotes `\\r|\\n` or `\\n|` where `|` represents the character offset.\n */\nexport interface Position {\n /**\n * Line position in a document (zero-based).\n *\n * If a line number is greater than the number of lines in a document, it\n * defaults back to the number of lines in the document.\n * If a line number is negative, it defaults to 0.\n *\n * The above two properties are implementation specific.\n */\n readonly line: number;\n /**\n * Character offset on a line in a document (zero-based).\n *\n * The meaning of this offset is determined by the negotiated\n * `PositionEncodingKind`.\n *\n * If the character value is greater than the line length it defaults back\n * to the line length. This property is implementation specific.\n */\n readonly character: number;\n}\n\n/**\n * A range in a text document expressed as (zero-based) start and end positions.\n *\n * If you want to specify a range that contains a line including the line ending\n * character(s) then use an end position denoting the start of the next line.\n * For example:\n * ```ts\n * {\n * start: { line: 5, character: 23 }\n * end : { line 6, character : 0 }\n * }\n * ```\n */\nexport interface Range {\n /**\n * The range's start position.\n */\n readonly start: Position;\n /**\n * The range's end position.\n */\n readonly end: Position;\n}\n\n/**\n * A text edit applicable to a text document.\n */\nexport interface TextEdit {\n /**\n * The range of the text document to be manipulated. To insert\n * text into a document create a range where start === end.\n */\n readonly range: Range;\n /**\n * The string to be inserted. For delete operations use an\n * empty string.\n */\n readonly newText: string;\n}\n\n/** Different with `TextEdit`, the range has been resolved to offsets. */\nexport interface ResolvedTextEdit {\n /** The start offset of the text change. */\n readonly start: number;\n /** The end offset of the text change. */\n readonly end: number;\n /**\n * The string to be inserted. For delete operations use an\n * empty string.\n */\n readonly text: string;\n}\n\nexport interface TextDocumentChange {\n /** First line whose rendered content or tokenizer state may have changed. */\n readonly startLine: number;\n /** Character on the first changed line where the edit began. */\n readonly startCharacter: number;\n /** Last line whose rendered content may have changed after the edit. */\n readonly endLine: number;\n /** Line count before the edit was applied. */\n readonly previousLineCount: number;\n /** Line count after the edit was applied. */\n readonly lineCount: number;\n /** Difference between the old and new line counts. */\n readonly lineDelta: number;\n /** Exact rendered line ranges touched by each edit after the edit was applied. */\n readonly changedLineRanges: readonly [startLine: number, endLine: number][];\n}\n\n/**\n * A vscode-languageserver-textdocument compatible text document.\n */\nexport class TextDocument<LAnnotation> {\n #uri: string;\n #languageId: string;\n #version: number;\n #pieceTable: PieceTable;\n #editStack: EditStack<LAnnotation>;\n\n constructor(\n uri: string,\n text: string,\n languageId = 'plaintext',\n version = 0,\n editStack: EditStack<LAnnotation> = new EditStack()\n ) {\n this.#uri = new URL(uri, 'file://').toString();\n this.#languageId = languageId;\n this.#version = version;\n this.#pieceTable = new PieceTable(text);\n this.#editStack = editStack;\n }\n\n get uri(): string {\n return this.#uri;\n }\n\n get languageId(): string {\n return this.#languageId;\n }\n\n get version(): number {\n return this.#version;\n }\n\n get lineCount(): number {\n return this.#pieceTable.lineCount;\n }\n\n get canUndo(): boolean {\n return this.#editStack.canUndo;\n }\n\n get canRedo(): boolean {\n return this.#editStack.canRedo;\n }\n\n positionAt(offset: number): Position {\n return this.#pieceTable.positionAt(offset);\n }\n\n positionsAt(offsets: readonly number[]): Position[] {\n return this.#pieceTable.positionsAt(offsets);\n }\n\n offsetAt(position: Position): number {\n return this.#pieceTable.offsetAt(this.normalizePosition(position));\n }\n\n getText(range?: Range): string {\n return this.#pieceTable.getText(range);\n }\n\n getLineText(line: number, includeLineBreak?: boolean): string {\n return this.#pieceTable.getLineText(line, includeLineBreak);\n }\n\n getLineLength(line: number, includeLineBreak?: boolean): number {\n return this.#pieceTable.getLineLength(line, includeLineBreak);\n }\n\n charAt(offset: number): string;\n charAt(position: Position): string;\n charAt(positionOrOffset: Position | number): string {\n if (typeof positionOrOffset === 'number') {\n return this.#pieceTable.charAt(positionOrOffset);\n }\n return this.#pieceTable.charAt(this.offsetAt(positionOrOffset));\n }\n\n getTextSlice(start: number, end: number): string {\n return this.#pieceTable.getTextSlice(start, end);\n }\n\n findNextNonOverlappingSubstring(\n needle: string,\n occupied: readonly [start: number, end: number][]\n ): number | undefined {\n return this.#pieceTable.findNextNonOverlappingSubstring(needle, occupied);\n }\n\n search(searchParams: SearchParams): [start: number, end: number][] {\n return this.#pieceTable.search(searchParams);\n }\n\n applyEdits(\n edits: TextEdit[],\n updateHistory = false,\n selectionsBefore?: EditorSelection[],\n selectionsAfter?: EditorSelection[]\n ): TextDocumentChange | undefined {\n if (edits.length === 0) {\n return;\n }\n return this.applyResolvedEdits(\n edits.map((edit) => this.#resolveEdit(edit)),\n updateHistory,\n selectionsBefore,\n selectionsAfter\n );\n }\n\n applyResolvedEdits(\n edits: ResolvedTextEdit[],\n updateHistory = false,\n selectionsBefore?: EditorSelection[],\n selectionsAfter?: EditorSelection[]\n ): TextDocumentChange | undefined {\n if (edits.length === 0) {\n return undefined;\n }\n const resolvedEdits = this.#sortAndValidateResolvedEdits(edits);\n if (updateHistory) {\n const entry = createEditStackEntry(\n this,\n resolvedEdits,\n this.#version,\n this.#version + 1,\n selectionsBefore,\n selectionsAfter\n );\n const previousEntry = this.#editStack.peekUndo();\n const change = this.#applyResolvedEditsToBuffer(resolvedEdits);\n this.#version++;\n if (\n change.lineDelta === 0 &&\n shouldCoalesceEditStackEntry(previousEntry, entry)\n ) {\n this.#editStack.replaceLastUndo(\n coalesceEditStackEntries(previousEntry!, entry)\n );\n } else {\n this.#editStack.push(entry);\n }\n return change;\n }\n const change = this.#applyResolvedEditsToBuffer(resolvedEdits);\n this.#version++;\n return change;\n }\n\n setLastUndoSelectionsAfter(selections: EditorSelection[]): void {\n this.#editStack.setLastUndoSelectionsAfter(selections);\n }\n\n setLastUndoLineAnnotations(\n lineAnnotationsBefore: DiffLineAnnotation<LAnnotation>[],\n lineAnnotationsAfter: DiffLineAnnotation<LAnnotation>[]\n ): void {\n this.#editStack.setLastUndoLineAnnotations(\n lineAnnotationsBefore,\n lineAnnotationsAfter\n );\n }\n\n undo():\n | [\n change: TextDocumentChange,\n selections?: EditorSelection[],\n lineAnnotations?: DiffLineAnnotation<LAnnotation>[],\n ]\n | undefined {\n const entry = this.#editStack.popUndoToRedo();\n if (entry === undefined) {\n return undefined;\n }\n const change = this.#applyResolvedEditsToBuffer(entry.inverseEdits);\n if (change === undefined) {\n return undefined;\n }\n this.#version = entry.versionBefore;\n return [\n change,\n entry.selectionsBefore?.slice(),\n entry.lineAnnotationsBefore?.slice(),\n ];\n }\n\n redo():\n | [\n change: TextDocumentChange,\n selections?: EditorSelection[],\n lineAnnotations?: DiffLineAnnotation<LAnnotation>[],\n ]\n | undefined {\n const entry = this.#editStack.popRedoToUndo();\n if (entry === undefined) {\n return undefined;\n }\n const change = this.#applyResolvedEditsToBuffer(entry.forwardEdits);\n if (change === undefined) {\n return undefined;\n }\n this.#version = entry.versionAfter;\n return [\n change,\n entry.selectionsAfter?.slice(),\n entry.lineAnnotationsAfter?.slice(),\n ];\n }\n\n normalizePosition(position: Position): Position {\n const line = Math.max(0, Math.min(position.line, this.lineCount - 1));\n return {\n line,\n character: Math.max(\n 0,\n Math.min(position.character, this.getLineLength(line))\n ),\n };\n }\n\n #resolveEdit(edit: TextEdit): ResolvedTextEdit {\n let start = this.offsetAt(edit.range.start);\n let end = this.offsetAt(edit.range.end);\n if (start > end) {\n const t = start;\n start = end;\n end = t;\n }\n return { start, end, text: edit.newText };\n }\n\n #sortAndValidateResolvedEdits(edits: ResolvedTextEdit[]): ResolvedTextEdit[] {\n const sortedEdits = [...edits].sort((a, b) => a.start - b.start);\n for (let i = 0; i < sortedEdits.length - 1; i++) {\n if (sortedEdits[i].end > sortedEdits[i + 1].start) {\n throw new Error('Overlapping text edits are not supported');\n }\n }\n return sortedEdits;\n }\n\n #applyResolvedEditsToBuffer(edits: ResolvedTextEdit[]): TextDocumentChange {\n const previousLineCount = this.#pieceTable.lineCount;\n const editPositions = this.positionsAt(\n edits.flatMap((edit) => [edit.start, edit.end])\n );\n const changedLineRange = this.#computeChangedLineRange(\n edits,\n editPositions\n );\n const startPosition = editPositions[0];\n this.#pieceTable.applyEdits(edits);\n const lineCount = this.#pieceTable.lineCount;\n const change: TextDocumentChange = {\n startLine: changedLineRange.startLine,\n startCharacter: startPosition.character,\n endLine: Math.min(changedLineRange.endLine, Math.max(0, lineCount - 1)),\n previousLineCount,\n lineCount,\n lineDelta: lineCount - previousLineCount,\n changedLineRanges: changedLineRange.ranges,\n };\n return change;\n }\n\n #computeChangedLineRange(\n edits: ResolvedTextEdit[],\n editPositions: Position[]\n ): {\n startLine: number;\n endLine: number;\n ranges: [number, number][];\n } {\n let startLine = Infinity;\n let endLine = 0;\n let lineDeltaBeforeEdit = 0;\n const ranges: [number, number][] = [];\n for (let i = 0; i < edits.length; i++) {\n const edit = edits[i];\n const editStartLine = editPositions[i * 2].line;\n const editEndLine = editPositions[i * 2 + 1].line;\n const insertedLineSpan = lineFeedCount(edit.text);\n const changedStartLine = editStartLine + lineDeltaBeforeEdit;\n const changedEndLine = changedStartLine + insertedLineSpan;\n startLine = Math.min(startLine, editStartLine);\n endLine = Math.max(endLine, changedEndLine);\n const lastRange = ranges[ranges.length - 1];\n if (lastRange !== undefined && changedStartLine <= lastRange[1] + 1) {\n ranges[ranges.length - 1] = [\n lastRange[0],\n Math.max(lastRange[1], changedEndLine),\n ];\n } else {\n ranges.push([changedStartLine, changedEndLine]);\n }\n lineDeltaBeforeEdit += insertedLineSpan - (editEndLine - editStartLine);\n }\n if (startLine === Infinity) {\n return {\n startLine: 0,\n endLine: 0,\n ranges: [[0, 0]],\n };\n }\n return { startLine, endLine, ranges };\n }\n}\n\nfunction lineFeedCount(text: string): number {\n let count = 0;\n for (let i = 0; i < text.length; i++) {\n if (text.charCodeAt(i) === /* \\n */ 10) {\n count++;\n }\n }\n return count;\n}\n"],"mappings":";;;;;;;AAqHA,IAAa,eAAb,MAAuC;CACrC;CACA;CACA;CACA;CACA;CAEA,YACE,KACA,MACA,aAAa,aACb,UAAU,GACV,YAAoC,IAAI,WAAW,EACnD;AACA,QAAKA,MAAO,IAAI,IAAI,KAAK,UAAU,CAAC,UAAU;AAC9C,QAAKC,aAAc;AACnB,QAAKC,UAAW;AAChB,QAAKC,aAAc,IAAI,WAAW,KAAK;AACvC,QAAKC,YAAa;;CAGpB,IAAI,MAAc;AAChB,SAAO,MAAKJ;;CAGd,IAAI,aAAqB;AACvB,SAAO,MAAKC;;CAGd,IAAI,UAAkB;AACpB,SAAO,MAAKC;;CAGd,IAAI,YAAoB;AACtB,SAAO,MAAKC,WAAY;;CAG1B,IAAI,UAAmB;AACrB,SAAO,MAAKC,UAAW;;CAGzB,IAAI,UAAmB;AACrB,SAAO,MAAKA,UAAW;;CAGzB,WAAW,QAA0B;AACnC,SAAO,MAAKD,WAAY,WAAW,OAAO;;CAG5C,YAAY,SAAwC;AAClD,SAAO,MAAKA,WAAY,YAAY,QAAQ;;CAG9C,SAAS,UAA4B;AACnC,SAAO,MAAKA,WAAY,SAAS,KAAK,kBAAkB,SAAS,CAAC;;CAGpE,QAAQ,OAAuB;AAC7B,SAAO,MAAKA,WAAY,QAAQ,MAAM;;CAGxC,YAAY,MAAc,kBAAoC;AAC5D,SAAO,MAAKA,WAAY,YAAY,MAAM,iBAAiB;;CAG7D,cAAc,MAAc,kBAAoC;AAC9D,SAAO,MAAKA,WAAY,cAAc,MAAM,iBAAiB;;CAK/D,OAAO,kBAA6C;AAClD,MAAI,OAAO,qBAAqB,SAC9B,QAAO,MAAKA,WAAY,OAAO,iBAAiB;AAElD,SAAO,MAAKA,WAAY,OAAO,KAAK,SAAS,iBAAiB,CAAC;;CAGjE,aAAa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const cursorForeground = colors["editorCursor.foreground"];
90
90
  const findMatchBackground = colors["editor.findMatchBackground"];
91
91
  const findMatchHighlightBackground = colors["editor.findMatchHighlightBackground"];
92
+ const hintForeground = colors["editorHint.foreground"];
93
+ const infoForeground = colors["editorInfo.foreground"];
94
+ const warningForeground = colors["editorWarning.foreground"];
95
+ const errorForeground = colors["editorError.foreground"];
92
96
  this.#setStyle(`:host {
93
97
  --diffs-editor-selection-bg: ${selectionBackground ?? "var(--diffs-line-bg)"};
94
98
  --diffs-editor-line-highlight-bg: ${lineHighlightBackground ?? "var(--diffs-line-bg)"};
95
99
  --diffs-editor-line-number-fg: ${gutterForeground ?? "var(--diffs-fg-number)"};
96
100
  --diffs-editor-line-number-active-bg: ${lineHighlightBackground ?? "var(--diffs-line-bg, var(--diffs-bg))"};
97
101
  --diffs-editor-line-number-active-fg: ${gutterActiveForeground ?? "var(--diffs-selection-number-fg)"};
98
- ${cursorForeground !== void 0 ? `--diffs-editor-cursor-fg: ${cursorForeground};` : ""}
99
- ${findMatchBackground !== void 0 ? `--diffs-editor-match-bg: ${findMatchBackground};` : ""}
100
- ${findMatchHighlightBackground !== void 0 ? `--diffs-editor-match-highlight-bg: ${findMatchHighlightBackground};` : ""}
102
+ --diffs-editor-match-bg: ${findMatchBackground ?? "unset"};
103
+ --diffs-editor-match-highlight-bg: ${findMatchHighlightBackground ?? "unset"};
104
+ --diffs-editor-cursor-fg: ${cursorForeground ?? "unset"};
105
+ --diffs-editor-hint-fg: ${hintForeground ?? "unset"};
106
+ --diffs-editor-info-fg: ${infoForeground ?? "unset"};
107
+ --diffs-editor-warning-fg: ${warningForeground ?? "unset"};
108
+ --diffs-editor-error-fg: ${errorForeground ?? "unset"};
101
109
  }`);
102
110
  }
103
111
  cleanUp() {