@veltra/desktop 1.2.28 → 1.2.29

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 (39) hide show
  1. package/dist/components/action/action-group.vue.d.ts +2 -2
  2. package/dist/components/action/action.vue.d.ts +1 -1
  3. package/dist/components/batch-edit/batch-edit.vue.d.ts +2 -2
  4. package/dist/components/cascade/cascade.vue.d.ts +5 -5
  5. package/dist/components/checkbox-group/checkbox-group.vue.d.ts +2 -2
  6. package/dist/components/code-editor/code-editor.js +7 -2
  7. package/dist/components/code-editor/code-editor.js.map +1 -1
  8. package/dist/components/code-editor/lang-loaders.js +2 -1
  9. package/dist/components/code-editor/lang-loaders.js.map +1 -1
  10. package/dist/components/code-editor/langs/spel/completion.js +88 -0
  11. package/dist/components/code-editor/langs/spel/completion.js.map +1 -0
  12. package/dist/components/code-editor/langs/spel/index.js +12 -0
  13. package/dist/components/code-editor/langs/spel/index.js.map +1 -0
  14. package/dist/components/code-editor/langs/spel/language.js +177 -0
  15. package/dist/components/code-editor/langs/spel/language.js.map +1 -0
  16. package/dist/components/code-editor/style2.css +11 -0
  17. package/dist/components/file-picker/file-picker.vue.d.ts +1 -1
  18. package/dist/components/input/input.vue.d.ts +2 -2
  19. package/dist/components/multi-select/multi-select.vue.d.ts +3 -3
  20. package/dist/components/multi-tree-select/multi-tree-select.vue.d.ts +5 -5
  21. package/dist/components/number-input/number-input.vue.d.ts +2 -2
  22. package/dist/components/pop-confirm/pop-confirm.vue.d.ts +1 -1
  23. package/dist/components/radio-group/radio-group.vue.d.ts +2 -2
  24. package/dist/components/select/select.vue.d.ts +2 -2
  25. package/dist/components/steps/steps.vue.d.ts +1 -1
  26. package/dist/components/textarea/textarea.vue.d.ts +2 -2
  27. package/dist/components/tip/tip.vue.d.ts +2 -2
  28. package/dist/components/tree-select/tree-select.vue.d.ts +5 -5
  29. package/dist/node_modules/.bun/@codemirror_language@6.12.4/node_modules/@codemirror/language/dist/index.js +452 -2
  30. package/dist/node_modules/.bun/@codemirror_language@6.12.4/node_modules/@codemirror/language/dist/index.js.map +1 -1
  31. package/dist/types/code-editor.d.ts +3 -2
  32. package/package.json +6 -6
  33. package/src/components/code-editor/code-editor.vue +6 -0
  34. package/src/components/code-editor/lang-loaders.ts +2 -1
  35. package/src/components/code-editor/langs/spel/completion.ts +30 -0
  36. package/src/components/code-editor/langs/spel/index.ts +12 -0
  37. package/src/components/code-editor/langs/spel/language.ts +198 -0
  38. package/src/components/code-editor/style.scss +12 -0
  39. package/src/types/code-editor.ts +3 -2
@@ -12,8 +12,8 @@ declare const __VLS_base: import("vue").DefineComponent<PopConfirmProps, {}, {},
12
12
  onConfirm?: (() => any) | undefined;
13
13
  onCancel?: (() => any) | undefined;
14
14
  }>, {
15
- trigger: "hover" | "click";
16
15
  direction: TipDirection;
16
+ trigger: "hover" | "click";
17
17
  icon: import("vue").Component;
18
18
  iconColor: string;
19
19
  confirmText: string;
@@ -14,10 +14,10 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
14
14
  "onUpdate:modelValue"?: ((value: any) => any) | undefined;
15
15
  onChange?: ((item: Record<string, any>) => any) | undefined;
16
16
  }>, {
17
- labelKey: string;
18
- valueKey: string;
19
17
  disabled: boolean;
20
18
  readonly: boolean;
19
+ labelKey: string;
20
+ valueKey: string;
21
21
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
22
22
  declare const _default: typeof __VLS_export;
23
23
  //#endregion
@@ -24,10 +24,10 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {
24
24
  "onUpdate:text"?: ((value: any) => any) | undefined;
25
25
  "onUpdate:label"?: ((label?: string | undefined) => any) | undefined;
26
26
  }>, {
27
- labelKey: string;
28
- valueKey: string;
29
27
  disabled: boolean;
30
28
  readonly: boolean;
29
+ labelKey: string;
30
+ valueKey: string;
31
31
  placeholder: string;
32
32
  clearable: boolean;
33
33
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
@@ -12,8 +12,8 @@ declare const __VLS_base: import("vue").DefineComponent<StepsProps, {}, {}, {},
12
12
  "onItem-click"?: ((item: Record<string, any>, index: number) => any) | undefined;
13
13
  "onUpdate:current"?: ((value?: string | number | undefined) => any) | undefined;
14
14
  }>, {
15
- labelKey: string;
16
15
  direction: "horizontal" | "vertical";
16
+ labelKey: string;
17
17
  finishedStepType: import("@veltra/utils").ColorType;
18
18
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
19
19
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
@@ -9,15 +9,15 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
9
9
  "update:modelValue": (value: string | undefined) => any;
10
10
  } & {
11
11
  "update:modelValue": (value: string) => any;
12
+ clear: () => any;
12
13
  change: (value: string) => any;
13
14
  focus: () => any;
14
- clear: () => any;
15
15
  blur: () => any;
16
16
  }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
17
17
  "onUpdate:modelValue"?: ((value: string) => any) | undefined;
18
+ onClear?: (() => any) | undefined;
18
19
  onChange?: ((value: string) => any) | undefined;
19
20
  onFocus?: (() => any) | undefined;
20
- onClear?: (() => any) | undefined;
21
21
  onBlur?: (() => any) | undefined;
22
22
  }>, {
23
23
  disabled: boolean;
@@ -9,12 +9,12 @@ declare const __VLS_base: import("vue").DefineComponent<TipProps, {}, {}, {}, {}
9
9
  }, string, import("vue").PublicProps, Readonly<TipProps> & Readonly<{
10
10
  "onUpdate:visible"?: ((value: boolean) => any) | undefined;
11
11
  }>, {
12
+ direction: TipDirection;
12
13
  trigger: "hover" | "click";
13
14
  contentTag: string;
14
15
  visible: boolean;
15
- direction: TipDirection;
16
- alignment: TipAlign;
17
16
  content: string;
17
+ alignment: TipAlign;
18
18
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
19
19
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
20
20
  declare const _default: typeof __VLS_export;
@@ -15,24 +15,24 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {
15
15
  "update:modelValue": (value: string | number | undefined) => any;
16
16
  } & {
17
17
  "update:modelValue": (value?: string | number | undefined) => any;
18
- change: (selectedData?: Record<string, any> | undefined) => any;
19
18
  clear: () => any;
19
+ change: (selectedData?: Record<string, any> | undefined) => any;
20
20
  "update:text": (text?: string | undefined) => any;
21
21
  }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
22
22
  "onUpdate:modelValue"?: ((value?: string | number | undefined) => any) | undefined;
23
- onChange?: ((selectedData?: Record<string, any> | undefined) => any) | undefined;
24
23
  onClear?: (() => any) | undefined;
24
+ onChange?: ((selectedData?: Record<string, any> | undefined) => any) | undefined;
25
25
  "onUpdate:text"?: ((text?: string | undefined) => any) | undefined;
26
26
  }>, {
27
+ disabled: boolean;
28
+ readonly: boolean;
29
+ minWidth: string;
27
30
  expandAll: boolean;
28
31
  labelKey: string;
29
32
  valueKey: string;
30
- disabled: boolean;
31
- readonly: boolean;
32
33
  placeholder: string;
33
34
  clearable: boolean;
34
35
  filterable: boolean;
35
- minWidth: string;
36
36
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
37
37
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
38
38
  declare const _default: typeof __VLS_export;
@@ -1,7 +1,7 @@
1
1
  import { EditorState, Facet, Prec, RangeSet, RangeSetBuilder, StateEffect, StateField, combineConfig, countColumn } from "../../../../../@codemirror_state@6.7.0/node_modules/@codemirror/state/dist/index.js";
2
2
  import { StyleModule } from "../../../../../style-mod@4.1.3/node_modules/style-mod/src/style-mod.js";
3
3
  import { Decoration, Direction, EditorView, GutterMarker, ViewPlugin, WidgetType, gutter, logException } from "../../../../../@codemirror_view@6.43.4/node_modules/@codemirror/view/dist/index.js";
4
- import { IterMode, NodeProp, NodeType, Parser, Tree, TreeFragment } from "../../../../../@lezer_common@1.5.2/node_modules/@lezer/common/dist/index.js";
4
+ import { IterMode, NodeProp, NodeSet, NodeType, Parser, Tree, TreeFragment } from "../../../../../@lezer_common@1.5.2/node_modules/@lezer/common/dist/index.js";
5
5
  import { highlightTree, styleTags, tagHighlighter, tags } from "../../../../../@lezer_highlight@1.2.3/node_modules/@lezer/highlight/dist/index.js";
6
6
  //#region ../../node_modules/.bun/@codemirror+language@6.12.4/node_modules/@codemirror/language/dist/index.js
7
7
  var _a;
@@ -1710,8 +1710,438 @@ function matchPlainBrackets(state, pos, dir, tree, tokenType, maxScanDistance, b
1710
1710
  matched: false
1711
1711
  } : null;
1712
1712
  }
1713
+ function countCol(string, end, tabSize, startIndex = 0, startValue = 0) {
1714
+ if (end == null) {
1715
+ end = string.search(/[^\s\u00a0]/);
1716
+ if (end == -1) end = string.length;
1717
+ }
1718
+ let n = startValue;
1719
+ for (let i = startIndex; i < end; i++) if (string.charCodeAt(i) == 9) n += tabSize - n % tabSize;
1720
+ else n++;
1721
+ return n;
1722
+ }
1723
+ /**
1724
+ Encapsulates a single line of input. Given to stream syntax code,
1725
+ which uses it to tokenize the content.
1726
+ */
1727
+ var StringStream = class {
1728
+ /**
1729
+ Create a stream.
1730
+ */
1731
+ constructor(string, tabSize, indentUnit, overrideIndent) {
1732
+ this.string = string;
1733
+ this.tabSize = tabSize;
1734
+ this.indentUnit = indentUnit;
1735
+ this.overrideIndent = overrideIndent;
1736
+ /**
1737
+ The current position on the line.
1738
+ */
1739
+ this.pos = 0;
1740
+ /**
1741
+ The start position of the current token.
1742
+ */
1743
+ this.start = 0;
1744
+ this.lastColumnPos = 0;
1745
+ this.lastColumnValue = 0;
1746
+ }
1747
+ /**
1748
+ True if we are at the end of the line.
1749
+ */
1750
+ eol() {
1751
+ return this.pos >= this.string.length;
1752
+ }
1753
+ /**
1754
+ True if we are at the start of the line.
1755
+ */
1756
+ sol() {
1757
+ return this.pos == 0;
1758
+ }
1759
+ /**
1760
+ Get the next code unit after the current position, or undefined
1761
+ if we're at the end of the line.
1762
+ */
1763
+ peek() {
1764
+ return this.string.charAt(this.pos) || void 0;
1765
+ }
1766
+ /**
1767
+ Read the next code unit and advance `this.pos`.
1768
+ */
1769
+ next() {
1770
+ if (this.pos < this.string.length) return this.string.charAt(this.pos++);
1771
+ }
1772
+ /**
1773
+ Match the next character against the given string, regular
1774
+ expression, or predicate. Consume and return it if it matches.
1775
+ */
1776
+ eat(match) {
1777
+ let ch = this.string.charAt(this.pos);
1778
+ let ok;
1779
+ if (typeof match == "string") ok = ch == match;
1780
+ else ok = ch && (match instanceof RegExp ? match.test(ch) : match(ch));
1781
+ if (ok) {
1782
+ ++this.pos;
1783
+ return ch;
1784
+ }
1785
+ }
1786
+ /**
1787
+ Continue matching characters that match the given string,
1788
+ regular expression, or predicate function. Return true if any
1789
+ characters were consumed.
1790
+ */
1791
+ eatWhile(match) {
1792
+ let start = this.pos;
1793
+ while (this.eat(match));
1794
+ return this.pos > start;
1795
+ }
1796
+ /**
1797
+ Consume whitespace ahead of `this.pos`. Return true if any was
1798
+ found.
1799
+ */
1800
+ eatSpace() {
1801
+ let start = this.pos;
1802
+ while (/[\s\u00a0]/.test(this.string.charAt(this.pos))) ++this.pos;
1803
+ return this.pos > start;
1804
+ }
1805
+ /**
1806
+ Move to the end of the line.
1807
+ */
1808
+ skipToEnd() {
1809
+ this.pos = this.string.length;
1810
+ }
1811
+ /**
1812
+ Move to directly before the given character, if found on the
1813
+ current line.
1814
+ */
1815
+ skipTo(ch) {
1816
+ let found = this.string.indexOf(ch, this.pos);
1817
+ if (found > -1) {
1818
+ this.pos = found;
1819
+ return true;
1820
+ }
1821
+ }
1822
+ /**
1823
+ Move back `n` characters.
1824
+ */
1825
+ backUp(n) {
1826
+ this.pos -= n;
1827
+ }
1828
+ /**
1829
+ Get the column position at `this.pos`.
1830
+ */
1831
+ column() {
1832
+ if (this.lastColumnPos < this.start) {
1833
+ this.lastColumnValue = countCol(this.string, this.start, this.tabSize, this.lastColumnPos, this.lastColumnValue);
1834
+ this.lastColumnPos = this.start;
1835
+ }
1836
+ return this.lastColumnValue;
1837
+ }
1838
+ /**
1839
+ Get the indentation column of the current line.
1840
+ */
1841
+ indentation() {
1842
+ var _a;
1843
+ return (_a = this.overrideIndent) !== null && _a !== void 0 ? _a : countCol(this.string, null, this.tabSize);
1844
+ }
1845
+ /**
1846
+ Match the input against the given string or regular expression
1847
+ (which should start with a `^`). Return true or the regexp match
1848
+ if it matches.
1849
+
1850
+ Unless `consume` is set to `false`, this will move `this.pos`
1851
+ past the matched text.
1852
+
1853
+ When matching a string `caseInsensitive` can be set to true to
1854
+ make the match case-insensitive.
1855
+ */
1856
+ match(pattern, consume, caseInsensitive) {
1857
+ if (typeof pattern == "string") {
1858
+ let cased = (str) => caseInsensitive ? str.toLowerCase() : str;
1859
+ if (cased(this.string.substr(this.pos, pattern.length)) == cased(pattern)) {
1860
+ if (consume !== false) this.pos += pattern.length;
1861
+ return true;
1862
+ } else return null;
1863
+ } else {
1864
+ let match = this.string.slice(this.pos).match(pattern);
1865
+ if (match && match.index > 0) return null;
1866
+ if (match && consume !== false) this.pos += match[0].length;
1867
+ return match;
1868
+ }
1869
+ }
1870
+ /**
1871
+ Get the current token.
1872
+ */
1873
+ current() {
1874
+ return this.string.slice(this.start, this.pos);
1875
+ }
1876
+ };
1877
+ function fullParser(spec) {
1878
+ return {
1879
+ name: spec.name || "",
1880
+ token: spec.token,
1881
+ blankLine: spec.blankLine || (() => {}),
1882
+ startState: spec.startState || (() => true),
1883
+ copyState: spec.copyState || defaultCopyState,
1884
+ indent: spec.indent || (() => null),
1885
+ languageData: spec.languageData || {},
1886
+ tokenTable: spec.tokenTable || noTokens,
1887
+ mergeTokens: spec.mergeTokens !== false
1888
+ };
1889
+ }
1890
+ function defaultCopyState(state) {
1891
+ if (typeof state != "object") return state;
1892
+ let newState = {};
1893
+ for (let prop in state) {
1894
+ let val = state[prop];
1895
+ newState[prop] = val instanceof Array ? val.slice() : val;
1896
+ }
1897
+ return newState;
1898
+ }
1899
+ const IndentedFrom = /*@__PURE__*/ new WeakMap();
1900
+ /**
1901
+ A [language](https://codemirror.net/6/docs/ref/#language.Language) class based on a CodeMirror
1902
+ 5-style [streaming parser](https://codemirror.net/6/docs/ref/#language.StreamParser).
1903
+ */
1904
+ var StreamLanguage = class StreamLanguage extends Language {
1905
+ constructor(parser) {
1906
+ let data = defineLanguageFacet(parser.languageData);
1907
+ let p = fullParser(parser), self;
1908
+ let impl = new class extends Parser {
1909
+ createParse(input, fragments, ranges) {
1910
+ return new Parse(self, input, fragments, ranges);
1911
+ }
1912
+ }();
1913
+ super(data, impl, [], parser.name);
1914
+ this.topNode = docID(data, this);
1915
+ self = this;
1916
+ this.streamParser = p;
1917
+ this.stateAfter = new NodeProp({ perNode: true });
1918
+ this.tokenTable = parser.tokenTable ? new TokenTable(p.tokenTable) : defaultTokenTable;
1919
+ }
1920
+ /**
1921
+ Define a stream language.
1922
+ */
1923
+ static define(spec) {
1924
+ return new StreamLanguage(spec);
1925
+ }
1926
+ /**
1927
+ @internal
1928
+ */
1929
+ getIndent(cx) {
1930
+ let from = void 0;
1931
+ let { overrideIndentation } = cx.options;
1932
+ if (overrideIndentation) {
1933
+ from = IndentedFrom.get(cx.state);
1934
+ if (from != null && from < cx.pos - 1e4) from = void 0;
1935
+ }
1936
+ let start = findState(this, cx.node.tree, cx.node.from, cx.node.from, from !== null && from !== void 0 ? from : cx.pos), statePos, state;
1937
+ if (start) {
1938
+ state = start.state;
1939
+ statePos = start.pos + 1;
1940
+ } else {
1941
+ state = this.streamParser.startState(cx.unit);
1942
+ statePos = cx.node.from;
1943
+ }
1944
+ if (cx.pos - statePos > 1e4) return null;
1945
+ while (statePos < cx.pos) {
1946
+ let line = cx.state.doc.lineAt(statePos), end = Math.min(cx.pos, line.to);
1947
+ if (line.length) {
1948
+ let indentation = overrideIndentation ? overrideIndentation(line.from) : -1;
1949
+ let stream = new StringStream(line.text, cx.state.tabSize, cx.unit, indentation < 0 ? void 0 : indentation);
1950
+ while (stream.pos < end - line.from) readToken(this.streamParser.token, stream, state);
1951
+ } else this.streamParser.blankLine(state, cx.unit);
1952
+ if (end == cx.pos) break;
1953
+ statePos = line.to + 1;
1954
+ }
1955
+ let line = cx.lineAt(cx.pos);
1956
+ if (overrideIndentation && from == null) IndentedFrom.set(cx.state, line.from);
1957
+ return this.streamParser.indent(state, /^\s*(.*)/.exec(line.text)[1], cx);
1958
+ }
1959
+ get allowsNesting() {
1960
+ return false;
1961
+ }
1962
+ };
1963
+ function findState(lang, tree, off, startPos, before) {
1964
+ let state = off >= startPos && off + tree.length <= before && tree.prop(lang.stateAfter);
1965
+ if (state) return {
1966
+ state: lang.streamParser.copyState(state),
1967
+ pos: off + tree.length
1968
+ };
1969
+ for (let i = tree.children.length - 1; i >= 0; i--) {
1970
+ let child = tree.children[i], pos = off + tree.positions[i];
1971
+ let found = child instanceof Tree && pos < before && findState(lang, child, pos, startPos, before);
1972
+ if (found) return found;
1973
+ }
1974
+ return null;
1975
+ }
1976
+ function cutTree(lang, tree, from, to, inside) {
1977
+ if (inside && from <= 0 && to >= tree.length) return tree;
1978
+ if (!inside && from == 0 && tree.type == lang.topNode) inside = true;
1979
+ for (let i = tree.children.length - 1; i >= 0; i--) {
1980
+ let pos = tree.positions[i], child = tree.children[i], inner;
1981
+ if (pos < to && child instanceof Tree) {
1982
+ if (!(inner = cutTree(lang, child, from - pos, to - pos, inside))) break;
1983
+ return !inside ? inner : new Tree(tree.type, tree.children.slice(0, i).concat(inner), tree.positions.slice(0, i + 1), pos + inner.length);
1984
+ }
1985
+ }
1986
+ return null;
1987
+ }
1988
+ function findStartInFragments(lang, fragments, startPos, endPos, editorState) {
1989
+ for (let f of fragments) {
1990
+ let from = f.from + (f.openStart ? 25 : 0), to = f.to - (f.openEnd ? 25 : 0);
1991
+ let found = from <= startPos && to > startPos && findState(lang, f.tree, 0 - f.offset, startPos, to), tree;
1992
+ if (found && found.pos <= endPos && (tree = cutTree(lang, f.tree, startPos + f.offset, found.pos + f.offset, false))) return {
1993
+ state: found.state,
1994
+ tree
1995
+ };
1996
+ }
1997
+ return {
1998
+ state: lang.streamParser.startState(editorState ? getIndentUnit(editorState) : 4),
1999
+ tree: Tree.empty
2000
+ };
2001
+ }
2002
+ var Parse = class {
2003
+ constructor(lang, input, fragments, ranges) {
2004
+ this.lang = lang;
2005
+ this.input = input;
2006
+ this.fragments = fragments;
2007
+ this.ranges = ranges;
2008
+ this.stoppedAt = null;
2009
+ this.chunks = [];
2010
+ this.chunkPos = [];
2011
+ this.chunk = [];
2012
+ this.chunkReused = void 0;
2013
+ this.rangeIndex = 0;
2014
+ this.to = ranges[ranges.length - 1].to;
2015
+ let context = ParseContext.get(), from = ranges[0].from;
2016
+ let { state, tree } = findStartInFragments(lang, fragments, from, this.to, context === null || context === void 0 ? void 0 : context.state);
2017
+ this.state = state;
2018
+ this.parsedPos = this.chunkStart = from + tree.length;
2019
+ for (let i = 0; i < tree.children.length; i++) {
2020
+ this.chunks.push(tree.children[i]);
2021
+ this.chunkPos.push(tree.positions[i]);
2022
+ }
2023
+ if (context && this.parsedPos < context.viewport.from - 1e5 && ranges.some((r) => r.from <= context.viewport.from && r.to >= context.viewport.from)) {
2024
+ this.state = this.lang.streamParser.startState(getIndentUnit(context.state));
2025
+ context.skipUntilInView(this.parsedPos, context.viewport.from);
2026
+ this.parsedPos = context.viewport.from;
2027
+ }
2028
+ this.moveRangeIndex();
2029
+ }
2030
+ advance() {
2031
+ let context = ParseContext.get();
2032
+ let parseEnd = this.stoppedAt == null ? this.to : Math.min(this.to, this.stoppedAt);
2033
+ let end = Math.min(parseEnd, this.chunkStart + 512);
2034
+ if (context) end = Math.min(end, context.viewport.to);
2035
+ while (this.parsedPos < end) this.parseLine(context);
2036
+ if (this.chunkStart < this.parsedPos) this.finishChunk();
2037
+ if (this.parsedPos >= parseEnd) return this.finish();
2038
+ if (context && this.parsedPos >= context.viewport.to) {
2039
+ context.skipUntilInView(this.parsedPos, parseEnd);
2040
+ return this.finish();
2041
+ }
2042
+ return null;
2043
+ }
2044
+ stopAt(pos) {
2045
+ this.stoppedAt = pos;
2046
+ }
2047
+ lineAfter(pos) {
2048
+ let chunk = this.input.chunk(pos);
2049
+ if (!this.input.lineChunks) {
2050
+ let eol = chunk.indexOf("\n");
2051
+ if (eol > -1) chunk = chunk.slice(0, eol);
2052
+ } else if (chunk == "\n") chunk = "";
2053
+ return pos + chunk.length <= this.to ? chunk : chunk.slice(0, this.to - pos);
2054
+ }
2055
+ nextLine() {
2056
+ let from = this.parsedPos, line = this.lineAfter(from), end = from + line.length;
2057
+ for (let index = this.rangeIndex;;) {
2058
+ let rangeEnd = this.ranges[index].to;
2059
+ if (rangeEnd >= end) break;
2060
+ line = line.slice(0, rangeEnd - (end - line.length));
2061
+ index++;
2062
+ if (index == this.ranges.length) break;
2063
+ let rangeStart = this.ranges[index].from;
2064
+ let after = this.lineAfter(rangeStart);
2065
+ line += after;
2066
+ end = rangeStart + after.length;
2067
+ }
2068
+ return {
2069
+ line,
2070
+ end
2071
+ };
2072
+ }
2073
+ skipGapsTo(pos, offset, side) {
2074
+ for (;;) {
2075
+ let end = this.ranges[this.rangeIndex].to, offPos = pos + offset;
2076
+ if (side > 0 ? end > offPos : end >= offPos) break;
2077
+ let start = this.ranges[++this.rangeIndex].from;
2078
+ offset += start - end;
2079
+ }
2080
+ return offset;
2081
+ }
2082
+ moveRangeIndex() {
2083
+ while (this.ranges[this.rangeIndex].to < this.parsedPos) this.rangeIndex++;
2084
+ }
2085
+ emitToken(id, from, to, offset) {
2086
+ let size = 4;
2087
+ if (this.ranges.length > 1) {
2088
+ offset = this.skipGapsTo(from, offset, 1);
2089
+ from += offset;
2090
+ let len0 = this.chunk.length;
2091
+ offset = this.skipGapsTo(to, offset, -1);
2092
+ to += offset;
2093
+ size += this.chunk.length - len0;
2094
+ }
2095
+ let last = this.chunk.length - 4;
2096
+ if (this.lang.streamParser.mergeTokens && size == 4 && last >= 0 && this.chunk[last] == id && this.chunk[last + 2] == from) this.chunk[last + 2] = to;
2097
+ else this.chunk.push(id, from, to, size);
2098
+ return offset;
2099
+ }
2100
+ parseLine(context) {
2101
+ let { line, end } = this.nextLine(), offset = 0, { streamParser } = this.lang;
2102
+ let stream = new StringStream(line, context ? context.state.tabSize : 4, context ? getIndentUnit(context.state) : 2);
2103
+ if (stream.eol()) streamParser.blankLine(this.state, stream.indentUnit);
2104
+ else while (!stream.eol()) {
2105
+ let token = readToken(streamParser.token, stream, this.state);
2106
+ if (token) offset = this.emitToken(this.lang.tokenTable.resolve(token), this.parsedPos + stream.start, this.parsedPos + stream.pos, offset);
2107
+ if (stream.start > 1e4) break;
2108
+ }
2109
+ this.parsedPos = end;
2110
+ this.moveRangeIndex();
2111
+ if (this.parsedPos < this.to) this.parsedPos++;
2112
+ }
2113
+ finishChunk() {
2114
+ let tree = Tree.build({
2115
+ buffer: this.chunk,
2116
+ start: this.chunkStart,
2117
+ length: this.parsedPos - this.chunkStart,
2118
+ nodeSet,
2119
+ topID: 0,
2120
+ maxBufferLength: 512,
2121
+ reused: this.chunkReused
2122
+ });
2123
+ tree = new Tree(tree.type, tree.children, tree.positions, tree.length, [[this.lang.stateAfter, this.lang.streamParser.copyState(this.state)]]);
2124
+ this.chunks.push(tree);
2125
+ this.chunkPos.push(this.chunkStart - this.ranges[0].from);
2126
+ this.chunk = [];
2127
+ this.chunkReused = void 0;
2128
+ this.chunkStart = this.parsedPos;
2129
+ }
2130
+ finish() {
2131
+ return new Tree(this.lang.topNode, this.chunks, this.chunkPos, this.parsedPos - this.ranges[0].from).balance();
2132
+ }
2133
+ };
2134
+ function readToken(token, stream, state) {
2135
+ stream.start = stream.pos;
2136
+ for (let i = 0; i < 10; i++) {
2137
+ let result = token(stream, state);
2138
+ if (stream.pos > stream.start) return result;
2139
+ }
2140
+ throw new Error("Stream parser failed to advance stream.");
2141
+ }
1713
2142
  const noTokens = /*@__PURE__*/ Object.create(null);
1714
2143
  const typeArray = [NodeType.none];
2144
+ const nodeSet = /*@__PURE__*/ new NodeSet(typeArray);
1715
2145
  const warned = [];
1716
2146
  const byTag = /*@__PURE__*/ Object.create(null);
1717
2147
  const defaultTable = /*@__PURE__*/ Object.create(null);
@@ -1729,6 +2159,16 @@ for (let [legacyName, name] of [
1729
2159
  ["header", "heading"],
1730
2160
  ["property", "propertyName"]
1731
2161
  ]) defaultTable[legacyName] = /*@__PURE__*/ createTokenType(noTokens, name);
2162
+ var TokenTable = class {
2163
+ constructor(extra) {
2164
+ this.extra = extra;
2165
+ this.table = Object.assign(Object.create(null), defaultTable);
2166
+ }
2167
+ resolve(tag) {
2168
+ return !tag ? 0 : this.table[tag] || (this.table[tag] = createTokenType(this.extra, tag));
2169
+ }
2170
+ };
2171
+ const defaultTokenTable = /*@__PURE__*/ new TokenTable(noTokens);
1732
2172
  function warnForPart(part, msg) {
1733
2173
  if (warned.indexOf(part) > -1) return;
1734
2174
  warned.push(part);
@@ -1760,8 +2200,18 @@ function createTokenType(extra, tagStr) {
1760
2200
  typeArray.push(type);
1761
2201
  return type.id;
1762
2202
  }
2203
+ function docID(data, lang) {
2204
+ let type = NodeType.define({
2205
+ id: typeArray.length,
2206
+ name: "Document",
2207
+ props: [languageDataProp.add(() => data), indentNodeProp.add(() => (cx) => lang.getIndent(cx))],
2208
+ top: true
2209
+ });
2210
+ typeArray.push(type);
2211
+ return type;
2212
+ }
1763
2213
  Direction.RTL, Direction.LTR;
1764
2214
  //#endregion
1765
- export { HighlightStyle, IndentContext, LRLanguage, LanguageSupport, bracketMatching, continuedIndent, defaultHighlightStyle, defineLanguageFacet, delimitedIndent, flatIndent, foldGutter, foldInside, foldKeymap, foldNodeProp, getIndentUnit, getIndentation, indentNodeProp, indentOnInput, indentString, indentUnit, matchBrackets, sublanguageProp, syntaxHighlighting, syntaxTree };
2215
+ export { HighlightStyle, IndentContext, LRLanguage, LanguageSupport, StreamLanguage, bracketMatching, continuedIndent, defaultHighlightStyle, defineLanguageFacet, delimitedIndent, flatIndent, foldGutter, foldInside, foldKeymap, foldNodeProp, getIndentUnit, getIndentation, indentNodeProp, indentOnInput, indentString, indentUnit, matchBrackets, sublanguageProp, syntaxHighlighting, syntaxTree };
1766
2216
 
1767
2217
  //# sourceMappingURL=index.js.map