@aui.io/apollo 0.1.11 → 0.1.13

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 (160) hide show
  1. package/node_modules/@aui.io/apollo-cli/package.json +3 -3
  2. package/node_modules/@aui.io/apollo-core/package.json +1 -1
  3. package/node_modules/@aui.io/apollo-tui/dist/src/actions/ActionPalette.d.ts +3 -1
  4. package/node_modules/@aui.io/apollo-tui/dist/src/actions/ActionPalette.js +7 -2
  5. package/node_modules/@aui.io/apollo-tui/dist/src/actions/ActionPalette.js.map +1 -1
  6. package/node_modules/@aui.io/apollo-tui/dist/src/activity/ActivityDrawer.d.ts +3 -1
  7. package/node_modules/@aui.io/apollo-tui/dist/src/activity/ActivityDrawer.js +8 -3
  8. package/node_modules/@aui.io/apollo-tui/dist/src/activity/ActivityDrawer.js.map +1 -1
  9. package/node_modules/@aui.io/apollo-tui/dist/src/activity/ActivitySummary.js.map +1 -1
  10. package/node_modules/@aui.io/apollo-tui/dist/src/activity/operationStore.js +4 -3
  11. package/node_modules/@aui.io/apollo-tui/dist/src/activity/operationStore.js.map +1 -1
  12. package/node_modules/@aui.io/apollo-tui/dist/src/author/AuthorHome.d.ts +12 -4
  13. package/node_modules/@aui.io/apollo-tui/dist/src/author/AuthorHome.js +67 -9
  14. package/node_modules/@aui.io/apollo-tui/dist/src/author/AuthorHome.js.map +1 -1
  15. package/node_modules/@aui.io/apollo-tui/dist/src/author/DiffView.d.ts +7 -1
  16. package/node_modules/@aui.io/apollo-tui/dist/src/author/DiffView.js +35 -8
  17. package/node_modules/@aui.io/apollo-tui/dist/src/author/DiffView.js.map +1 -1
  18. package/node_modules/@aui.io/apollo-tui/dist/src/author/SessionPane.d.ts +9 -2
  19. package/node_modules/@aui.io/apollo-tui/dist/src/author/SessionPane.js +24 -5
  20. package/node_modules/@aui.io/apollo-tui/dist/src/author/SessionPane.js.map +1 -1
  21. package/node_modules/@aui.io/apollo-tui/dist/src/author/ValidationView.js +2 -1
  22. package/node_modules/@aui.io/apollo-tui/dist/src/author/ValidationView.js.map +1 -1
  23. package/node_modules/@aui.io/apollo-tui/dist/src/author/VersionsView.js +4 -3
  24. package/node_modules/@aui.io/apollo-tui/dist/src/author/VersionsView.js.map +1 -1
  25. package/node_modules/@aui.io/apollo-tui/dist/src/author/data.d.ts +9 -0
  26. package/node_modules/@aui.io/apollo-tui/dist/src/author/data.js +31 -1
  27. package/node_modules/@aui.io/apollo-tui/dist/src/author/data.js.map +1 -1
  28. package/node_modules/@aui.io/apollo-tui/dist/src/author/session.d.ts +10 -1
  29. package/node_modules/@aui.io/apollo-tui/dist/src/author/session.js +19 -6
  30. package/node_modules/@aui.io/apollo-tui/dist/src/author/session.js.map +1 -1
  31. package/node_modules/@aui.io/apollo-tui/dist/src/context/ContextSwitcher.d.ts +3 -1
  32. package/node_modules/@aui.io/apollo-tui/dist/src/context/ContextSwitcher.js +7 -2
  33. package/node_modules/@aui.io/apollo-tui/dist/src/context/ContextSwitcher.js.map +1 -1
  34. package/node_modules/@aui.io/apollo-tui/dist/src/index.d.ts +4 -3
  35. package/node_modules/@aui.io/apollo-tui/dist/src/index.js +4 -3
  36. package/node_modules/@aui.io/apollo-tui/dist/src/index.js.map +1 -1
  37. package/node_modules/@aui.io/apollo-tui/dist/src/lib/actions.d.ts +3 -0
  38. package/node_modules/@aui.io/apollo-tui/dist/src/lib/actions.js +3 -0
  39. package/node_modules/@aui.io/apollo-tui/dist/src/lib/actions.js.map +1 -1
  40. package/node_modules/@aui.io/apollo-tui/dist/src/lib/jsonview.d.ts +31 -0
  41. package/node_modules/@aui.io/apollo-tui/dist/src/lib/jsonview.js +114 -0
  42. package/node_modules/@aui.io/apollo-tui/dist/src/lib/jsonview.js.map +1 -0
  43. package/node_modules/@aui.io/apollo-tui/dist/src/lib/sheet.js +10 -7
  44. package/node_modules/@aui.io/apollo-tui/dist/src/lib/sheet.js.map +1 -1
  45. package/node_modules/@aui.io/apollo-tui/dist/src/opentui-app.js +200 -90
  46. package/node_modules/@aui.io/apollo-tui/dist/src/opentui-app.js.map +1 -1
  47. package/node_modules/@aui.io/apollo-tui/dist/src/shell/Breadcrumb.d.ts +5 -2
  48. package/node_modules/@aui.io/apollo-tui/dist/src/shell/Breadcrumb.js +10 -4
  49. package/node_modules/@aui.io/apollo-tui/dist/src/shell/Breadcrumb.js.map +1 -1
  50. package/node_modules/@aui.io/apollo-tui/dist/src/shell/FooterHints.js +3 -2
  51. package/node_modules/@aui.io/apollo-tui/dist/src/shell/FooterHints.js.map +1 -1
  52. package/node_modules/@aui.io/apollo-tui/dist/src/shell/ModeNav.d.ts +2 -1
  53. package/node_modules/@aui.io/apollo-tui/dist/src/shell/ModeNav.js +29 -3
  54. package/node_modules/@aui.io/apollo-tui/dist/src/shell/ModeNav.js.map +1 -1
  55. package/node_modules/@aui.io/apollo-tui/dist/src/talk/Composer.d.ts +3 -1
  56. package/node_modules/@aui.io/apollo-tui/dist/src/talk/Composer.js +4 -3
  57. package/node_modules/@aui.io/apollo-tui/dist/src/talk/Composer.js.map +1 -1
  58. package/node_modules/@aui.io/apollo-tui/dist/src/talk/InspectorPane.d.ts +8 -3
  59. package/node_modules/@aui.io/apollo-tui/dist/src/talk/InspectorPane.js +7 -5
  60. package/node_modules/@aui.io/apollo-tui/dist/src/talk/InspectorPane.js.map +1 -1
  61. package/node_modules/@aui.io/apollo-tui/dist/src/talk/TalkView.d.ts +15 -2
  62. package/node_modules/@aui.io/apollo-tui/dist/src/talk/TalkView.js +22 -5
  63. package/node_modules/@aui.io/apollo-tui/dist/src/talk/TalkView.js.map +1 -1
  64. package/node_modules/@aui.io/apollo-tui/dist/src/talk/ThreadsPane.d.ts +5 -2
  65. package/node_modules/@aui.io/apollo-tui/dist/src/talk/ThreadsPane.js +10 -4
  66. package/node_modules/@aui.io/apollo-tui/dist/src/talk/ThreadsPane.js.map +1 -1
  67. package/node_modules/@aui.io/apollo-tui/dist/src/talk/data.d.ts +14 -3
  68. package/node_modules/@aui.io/apollo-tui/dist/src/talk/data.js +12 -2
  69. package/node_modules/@aui.io/apollo-tui/dist/src/talk/data.js.map +1 -1
  70. package/node_modules/@aui.io/apollo-tui/dist/src/theme/glyphs.d.ts +52 -0
  71. package/node_modules/@aui.io/apollo-tui/dist/src/theme/glyphs.js +76 -0
  72. package/node_modules/@aui.io/apollo-tui/dist/src/theme/glyphs.js.map +1 -0
  73. package/node_modules/@aui.io/apollo-tui/dist/src/theme/syntax.d.ts +20 -0
  74. package/node_modules/@aui.io/apollo-tui/dist/src/theme/syntax.js +54 -0
  75. package/node_modules/@aui.io/apollo-tui/dist/src/theme/syntax.js.map +1 -0
  76. package/node_modules/@aui.io/apollo-tui/dist/src/theme/tokens.d.ts +26 -8
  77. package/node_modules/@aui.io/apollo-tui/dist/src/theme/tokens.js +46 -8
  78. package/node_modules/@aui.io/apollo-tui/dist/src/theme/tokens.js.map +1 -1
  79. package/node_modules/@aui.io/apollo-tui/dist/src/ui/JsonPane.d.ts +12 -0
  80. package/node_modules/@aui.io/apollo-tui/dist/src/ui/JsonPane.js +22 -0
  81. package/node_modules/@aui.io/apollo-tui/dist/src/ui/JsonPane.js.map +1 -0
  82. package/node_modules/@aui.io/apollo-tui/dist/src/ui/PickerPane.d.ts +3 -1
  83. package/node_modules/@aui.io/apollo-tui/dist/src/ui/PickerPane.js +8 -3
  84. package/node_modules/@aui.io/apollo-tui/dist/src/ui/PickerPane.js.map +1 -1
  85. package/node_modules/@aui.io/apollo-tui/dist/src/ui/SheetPane.js +3 -2
  86. package/node_modules/@aui.io/apollo-tui/dist/src/ui/SheetPane.js.map +1 -1
  87. package/node_modules/@aui.io/apollo-tui/node_modules/web-tree-sitter/LICENSE +21 -0
  88. package/node_modules/@aui.io/apollo-tui/node_modules/web-tree-sitter/README.md +269 -0
  89. package/node_modules/@aui.io/apollo-tui/node_modules/web-tree-sitter/debug/tree-sitter.cjs +4558 -0
  90. package/node_modules/@aui.io/apollo-tui/node_modules/web-tree-sitter/debug/tree-sitter.cjs.map +7 -0
  91. package/node_modules/@aui.io/apollo-tui/node_modules/web-tree-sitter/debug/tree-sitter.js +4516 -0
  92. package/node_modules/@aui.io/apollo-tui/node_modules/web-tree-sitter/debug/tree-sitter.js.map +7 -0
  93. package/node_modules/@aui.io/apollo-tui/node_modules/web-tree-sitter/debug/tree-sitter.wasm +0 -0
  94. package/node_modules/@aui.io/apollo-tui/node_modules/web-tree-sitter/debug/tree-sitter.wasm.map +31 -0
  95. package/node_modules/@aui.io/apollo-tui/node_modules/web-tree-sitter/lib/alloc.c +48 -0
  96. package/node_modules/@aui.io/apollo-tui/node_modules/web-tree-sitter/lib/alloc.h +41 -0
  97. package/node_modules/@aui.io/apollo-tui/node_modules/web-tree-sitter/lib/array.h +291 -0
  98. package/node_modules/@aui.io/apollo-tui/node_modules/web-tree-sitter/lib/atomic.h +68 -0
  99. package/node_modules/@aui.io/apollo-tui/node_modules/web-tree-sitter/lib/clock.h +146 -0
  100. package/node_modules/@aui.io/apollo-tui/node_modules/web-tree-sitter/lib/error_costs.h +11 -0
  101. package/node_modules/@aui.io/apollo-tui/node_modules/web-tree-sitter/lib/get_changed_ranges.c +523 -0
  102. package/node_modules/@aui.io/apollo-tui/node_modules/web-tree-sitter/lib/get_changed_ranges.h +36 -0
  103. package/node_modules/@aui.io/apollo-tui/node_modules/web-tree-sitter/lib/host.h +21 -0
  104. package/node_modules/@aui.io/apollo-tui/node_modules/web-tree-sitter/lib/language.c +293 -0
  105. package/node_modules/@aui.io/apollo-tui/node_modules/web-tree-sitter/lib/language.h +293 -0
  106. package/node_modules/@aui.io/apollo-tui/node_modules/web-tree-sitter/lib/length.h +52 -0
  107. package/node_modules/@aui.io/apollo-tui/node_modules/web-tree-sitter/lib/lexer.c +483 -0
  108. package/node_modules/@aui.io/apollo-tui/node_modules/web-tree-sitter/lib/lexer.h +54 -0
  109. package/node_modules/@aui.io/apollo-tui/node_modules/web-tree-sitter/lib/lib.c +12 -0
  110. package/node_modules/@aui.io/apollo-tui/node_modules/web-tree-sitter/lib/node.c +875 -0
  111. package/node_modules/@aui.io/apollo-tui/node_modules/web-tree-sitter/lib/parser.c +2297 -0
  112. package/node_modules/@aui.io/apollo-tui/node_modules/web-tree-sitter/lib/parser.h +286 -0
  113. package/node_modules/@aui.io/apollo-tui/node_modules/web-tree-sitter/lib/point.h +48 -0
  114. package/node_modules/@aui.io/apollo-tui/node_modules/web-tree-sitter/lib/query.c +4347 -0
  115. package/node_modules/@aui.io/apollo-tui/node_modules/web-tree-sitter/lib/reduce_action.h +34 -0
  116. package/node_modules/@aui.io/apollo-tui/node_modules/web-tree-sitter/lib/reusable_node.h +95 -0
  117. package/node_modules/@aui.io/apollo-tui/node_modules/web-tree-sitter/lib/stack.c +912 -0
  118. package/node_modules/@aui.io/apollo-tui/node_modules/web-tree-sitter/lib/stack.h +133 -0
  119. package/node_modules/@aui.io/apollo-tui/node_modules/web-tree-sitter/lib/subtree.c +1034 -0
  120. package/node_modules/@aui.io/apollo-tui/node_modules/web-tree-sitter/lib/subtree.h +399 -0
  121. package/node_modules/@aui.io/apollo-tui/node_modules/web-tree-sitter/lib/tree-sitter.c +987 -0
  122. package/node_modules/@aui.io/apollo-tui/node_modules/web-tree-sitter/lib/tree-sitter.cjs +2988 -0
  123. package/node_modules/@aui.io/apollo-tui/node_modules/web-tree-sitter/lib/tree-sitter.wasm +0 -0
  124. package/node_modules/@aui.io/apollo-tui/node_modules/web-tree-sitter/lib/tree-sitter.wasm.map +1 -0
  125. package/node_modules/@aui.io/apollo-tui/node_modules/web-tree-sitter/lib/tree.c +170 -0
  126. package/node_modules/@aui.io/apollo-tui/node_modules/web-tree-sitter/lib/tree.h +31 -0
  127. package/node_modules/@aui.io/apollo-tui/node_modules/web-tree-sitter/lib/tree_cursor.c +716 -0
  128. package/node_modules/@aui.io/apollo-tui/node_modules/web-tree-sitter/lib/tree_cursor.h +48 -0
  129. package/node_modules/@aui.io/apollo-tui/node_modules/web-tree-sitter/lib/ts_assert.h +11 -0
  130. package/node_modules/@aui.io/apollo-tui/node_modules/web-tree-sitter/lib/unicode.h +75 -0
  131. package/node_modules/@aui.io/apollo-tui/node_modules/web-tree-sitter/lib/wasm_store.c +1937 -0
  132. package/node_modules/@aui.io/apollo-tui/node_modules/web-tree-sitter/lib/wasm_store.h +31 -0
  133. package/node_modules/@aui.io/apollo-tui/node_modules/web-tree-sitter/package.json +98 -0
  134. package/node_modules/@aui.io/apollo-tui/node_modules/web-tree-sitter/src/bindings.ts +26 -0
  135. package/node_modules/@aui.io/apollo-tui/node_modules/web-tree-sitter/src/constants.ts +133 -0
  136. package/node_modules/@aui.io/apollo-tui/node_modules/web-tree-sitter/src/index.ts +31 -0
  137. package/node_modules/@aui.io/apollo-tui/node_modules/web-tree-sitter/src/language.ts +291 -0
  138. package/node_modules/@aui.io/apollo-tui/node_modules/web-tree-sitter/src/lookahead_iterator.ts +75 -0
  139. package/node_modules/@aui.io/apollo-tui/node_modules/web-tree-sitter/src/marshal.ts +176 -0
  140. package/node_modules/@aui.io/apollo-tui/node_modules/web-tree-sitter/src/node.ts +646 -0
  141. package/node_modules/@aui.io/apollo-tui/node_modules/web-tree-sitter/src/parser.ts +325 -0
  142. package/node_modules/@aui.io/apollo-tui/node_modules/web-tree-sitter/src/query.ts +973 -0
  143. package/node_modules/@aui.io/apollo-tui/node_modules/web-tree-sitter/src/tree.ts +145 -0
  144. package/node_modules/@aui.io/apollo-tui/node_modules/web-tree-sitter/src/tree_cursor.ts +318 -0
  145. package/node_modules/@aui.io/apollo-tui/node_modules/web-tree-sitter/tree-sitter.cjs +4031 -0
  146. package/node_modules/@aui.io/apollo-tui/node_modules/web-tree-sitter/tree-sitter.cjs.map +7 -0
  147. package/node_modules/@aui.io/apollo-tui/node_modules/web-tree-sitter/tree-sitter.js +3980 -0
  148. package/node_modules/@aui.io/apollo-tui/node_modules/web-tree-sitter/tree-sitter.js.map +7 -0
  149. package/node_modules/@aui.io/apollo-tui/node_modules/web-tree-sitter/tree-sitter.wasm +0 -0
  150. package/node_modules/@aui.io/apollo-tui/node_modules/web-tree-sitter/tree-sitter.wasm.map +30 -0
  151. package/node_modules/@aui.io/apollo-tui/node_modules/web-tree-sitter/web-tree-sitter.d.ts +1030 -0
  152. package/node_modules/@aui.io/apollo-tui/node_modules/web-tree-sitter/web-tree-sitter.d.ts.map +56 -0
  153. package/node_modules/@aui.io/apollo-tui/package.json +6 -3
  154. package/package.json +7 -5
  155. package/node_modules/@aui.io/apollo-tui/dist/src/components/glyph.d.ts +0 -19
  156. package/node_modules/@aui.io/apollo-tui/dist/src/components/glyph.js +0 -41
  157. package/node_modules/@aui.io/apollo-tui/dist/src/components/glyph.js.map +0 -1
  158. package/node_modules/@aui.io/apollo-tui/dist/src/lib/attractor.d.ts +0 -82
  159. package/node_modules/@aui.io/apollo-tui/dist/src/lib/attractor.js +0 -231
  160. package/node_modules/@aui.io/apollo-tui/dist/src/lib/attractor.js.map +0 -1
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Shared SyntaxStyle + tree-sitter client for OpenTUI's rich renderables
3
+ * (`<markdown>`, `<code>`, `<diff>`). One style instance for the whole app —
4
+ * SyntaxStyle allocates native state, and the renderables cache resolved
5
+ * style ids by name.
6
+ *
7
+ * Bun-only module (SyntaxStyle rides bun:ffi): components import it, the
8
+ * vitest-covered data layer must not. Rich rendering is gated on `RICH`
9
+ * (tokens.ts) — under NO_COLOR the plain text paths render instead, so this
10
+ * module is never touched in monochrome runs.
11
+ *
12
+ * Scope names come from OpenTUI's markdown renderer (`markup.*`, `conceal`,
13
+ * `default`) plus common tree-sitter capture names for code. `default` MUST
14
+ * carry an explicit fg: an empty style resolves to transparent and the text
15
+ * becomes invisible.
16
+ */
17
+ import { getTreeSitterClient, SyntaxStyle, } from "@opentui/core";
18
+ import { AMBER, DIM, FAINT, FG, TEAL, TEAL_DIM } from "./tokens.js";
19
+ let style;
20
+ export function getSyntaxStyle() {
21
+ style ??= SyntaxStyle.fromStyles({
22
+ default: { fg: FG ?? "#D8D8D8" },
23
+ conceal: { fg: FAINT },
24
+ // Markdown (markup.* scopes).
25
+ "markup.heading": { fg: TEAL, bold: true },
26
+ "markup.strong": { fg: FG, bold: true },
27
+ "markup.italic": { fg: FG, italic: true },
28
+ "markup.strikethrough": { fg: DIM, dim: true },
29
+ "markup.raw": { fg: AMBER },
30
+ "markup.raw.block": { fg: FG },
31
+ "markup.link": { fg: TEAL, underline: true },
32
+ "markup.link.label": { fg: TEAL },
33
+ "markup.link.url": { fg: TEAL_DIM, underline: true },
34
+ "markup.list": { fg: TEAL },
35
+ "markup.quote": { fg: DIM, italic: true },
36
+ // Code (tree-sitter capture names; parsers bundled for ts/js/md/zig).
37
+ comment: { fg: FAINT, italic: true },
38
+ string: { fg: TEAL_DIM },
39
+ number: { fg: AMBER },
40
+ keyword: { fg: TEAL },
41
+ function: { fg: FG, bold: true },
42
+ type: { fg: TEAL },
43
+ constant: { fg: AMBER },
44
+ variable: { fg: FG },
45
+ operator: { fg: DIM },
46
+ punctuation: { fg: DIM },
47
+ });
48
+ return style;
49
+ }
50
+ /** Singleton worker-backed client; parsers load lazily per filetype. */
51
+ export function getTreeSitter() {
52
+ return getTreeSitterClient();
53
+ }
54
+ //# sourceMappingURL=syntax.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"syntax.js","sourceRoot":"","sources":["../../../src/theme/syntax.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EACL,mBAAmB,EACnB,WAAW,GAEZ,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEpE,IAAI,KAA8B,CAAC;AAEnC,MAAM,UAAU,cAAc;IAC5B,KAAK,KAAK,WAAW,CAAC,UAAU,CAAC;QAC/B,OAAO,EAAE,EAAE,EAAE,EAAE,EAAE,IAAI,SAAS,EAAE;QAChC,OAAO,EAA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EAAE,EAAE,EAAE,EAAE,GAAG,EAAE;QACrB,WAAW,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE;KACzB,CAAC,CAAC;IACH,OAAO,KAAK,CAAC;AACf,CAAC;AAED,wEAAwE;AACxE,MAAM,UAAU,aAAa;IAC3B,OAAO,mBAAmB,EAAE,CAAC;AAC/B,CAAC"}
@@ -1,8 +1,26 @@
1
- /** Apollo TUI theme tokens — single source for colors used across chrome. */
2
- export declare const TEAL = "#4FB8B0";
3
- export declare const TEAL_DIM = "#2E6B66";
4
- export declare const AMBER = "#E6A23C";
5
- export declare const RED = "#D46A6A";
6
- export declare const DIM = "#8A8A8A";
7
- export declare const FAINT = "#5C5C5C";
8
- export declare const FG = "#D8D8D8";
1
+ /**
2
+ * Apollo TUI theme tokens — single source for colors used across chrome.
3
+ *
4
+ * Monochrome-first: with NO_COLOR set (https://no-color.org — any non-empty
5
+ * value) every token resolves to `undefined`, which OpenTUI renders as the
6
+ * terminal's default foreground. Meaning never rides on color alone — status
7
+ * glyphs, labels, and position carry it — so the UI stays fully legible.
8
+ */
9
+ /** A theme color, or terminal default when running monochrome. */
10
+ export type Token = string | undefined;
11
+ export declare const MONO: boolean;
12
+ /**
13
+ * Rich renderables (markdown/code/diff) draw through SyntaxStyle, whose
14
+ * styles carry explicit colors — under NO_COLOR the TUI stays on the plain
15
+ * text paths instead, so the no-color guarantee holds end to end.
16
+ */
17
+ export declare const RICH: boolean;
18
+ /** Pure selector, unit-testable; the constants below are ambient bindings. */
19
+ export declare function palette(mono: boolean): Record<"TEAL" | "TEAL_DIM" | "AMBER" | "RED" | "DIM" | "FAINT" | "FG", Token>;
20
+ export declare const TEAL: Token;
21
+ export declare const TEAL_DIM: Token;
22
+ export declare const AMBER: Token;
23
+ export declare const RED: Token;
24
+ export declare const DIM: Token;
25
+ export declare const FAINT: Token;
26
+ export declare const FG: Token;
@@ -1,9 +1,47 @@
1
- /** Apollo TUI theme tokens — single source for colors used across chrome. */
2
- export const TEAL = "#4FB8B0";
3
- export const TEAL_DIM = "#2E6B66";
4
- export const AMBER = "#E6A23C";
5
- export const RED = "#D46A6A";
6
- export const DIM = "#8A8A8A";
7
- export const FAINT = "#5C5C5C";
8
- export const FG = "#D8D8D8";
1
+ /**
2
+ * Apollo TUI theme tokens — single source for colors used across chrome.
3
+ *
4
+ * Monochrome-first: with NO_COLOR set (https://no-color.org — any non-empty
5
+ * value) every token resolves to `undefined`, which OpenTUI renders as the
6
+ * terminal's default foreground. Meaning never rides on color alone — status
7
+ * glyphs, labels, and position carry it — so the UI stays fully legible.
8
+ */
9
+ export const MONO = Boolean(process.env.NO_COLOR && process.env.NO_COLOR !== "");
10
+ /**
11
+ * Rich renderables (markdown/code/diff) draw through SyntaxStyle, whose
12
+ * styles carry explicit colors — under NO_COLOR the TUI stays on the plain
13
+ * text paths instead, so the no-color guarantee holds end to end.
14
+ */
15
+ export const RICH = !MONO;
16
+ /** Pure selector, unit-testable; the constants below are ambient bindings. */
17
+ export function palette(mono) {
18
+ if (mono) {
19
+ return {
20
+ TEAL: undefined,
21
+ TEAL_DIM: undefined,
22
+ AMBER: undefined,
23
+ RED: undefined,
24
+ DIM: undefined,
25
+ FAINT: undefined,
26
+ FG: undefined,
27
+ };
28
+ }
29
+ return {
30
+ TEAL: "#4FB8B0",
31
+ TEAL_DIM: "#2E6B66",
32
+ AMBER: "#E6A23C",
33
+ RED: "#D46A6A",
34
+ DIM: "#8A8A8A",
35
+ FAINT: "#5C5C5C",
36
+ FG: "#D8D8D8",
37
+ };
38
+ }
39
+ const P = palette(MONO);
40
+ export const TEAL = P.TEAL;
41
+ export const TEAL_DIM = P.TEAL_DIM;
42
+ export const AMBER = P.AMBER;
43
+ export const RED = P.RED;
44
+ export const DIM = P.DIM;
45
+ export const FAINT = P.FAINT;
46
+ export const FG = P.FG;
9
47
  //# sourceMappingURL=tokens.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"tokens.js","sourceRoot":"","sources":["../../../src/theme/tokens.ts"],"names":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AAI,GAAU,CAAC,CAAC,IAAI,CAAC;AAClC,MAAM,CAAC,MAAM,QAAQ,GAAU,CAAC,CAAC,QAAQ,CAAC;AAC1C,MAAM,CAAC,MAAM,KAAK,GAAU,CAAC,CAAC,KAAK,CAAC;AACpC,MAAM,CAAC,MAAM,GAAG,GAAU,CAAC,CAAC,GAAG,CAAC;AAChC,MAAM,CAAC,MAAM,GAAG,GAAU,CAAC,CAAC,GAAG,CAAC;AAChC,MAAM,CAAC,MAAM,KAAK,GAAU,CAAC,CAAC,KAAK,CAAC;AACpC,MAAM,CAAC,MAAM,EAAE,GAAU,CAAC,CAAC,EAAE,CAAC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * JSON tree pane — renders jsonview rows with type-coded colors and
3
+ * expand/collapse markers. Mouse-first: click a container row to toggle it
4
+ * (the wheel scrolls the surrounding scrollbox); the keyboard stays wherever
5
+ * it was, matching the inspector's contract.
6
+ */
7
+ import type { JsonRow } from "../lib/jsonview.js";
8
+ export declare function JsonRows({ rows, onToggle, }: {
9
+ rows: JsonRow[];
10
+ /** Click on an expandable row toggles it. */
11
+ onToggle?: ((row: JsonRow) => void) | undefined;
12
+ }): import("react").ReactNode;
@@ -0,0 +1,22 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "@opentui/react/jsx-runtime";
2
+ import { G } from "../theme/glyphs.js";
3
+ import { AMBER, DIM, FAINT, FG, TEAL, TEAL_DIM } from "../theme/tokens.js";
4
+ const VALUE_COLOR = {
5
+ object: FAINT,
6
+ array: FAINT,
7
+ string: FG,
8
+ number: AMBER,
9
+ boolean: AMBER,
10
+ null: DIM,
11
+ };
12
+ export function JsonRows({ rows, onToggle, }) {
13
+ return (_jsx(_Fragment, { children: rows.map((row) => {
14
+ const marker = row.expandable ? (row.expanded ? G.expanded : G.collapsed) : " ";
15
+ return (_jsxs("text", { wrapMode: "word", onMouseDown: row.expandable && onToggle
16
+ ? () => {
17
+ onToggle(row);
18
+ }
19
+ : undefined, children: [_jsx("span", { fg: FAINT, children: " ".repeat(row.depth) }), _jsxs("span", { fg: row.expandable ? TEAL_DIM : FAINT, children: [marker, " "] }), row.key !== undefined ? (_jsx("span", { fg: TEAL, children: row.key })) : (_jsx("span", { fg: TEAL_DIM, children: row.kind === "array" ? "array" : "object" })), _jsx("span", { fg: DIM, children: ": " }), _jsx("span", { fg: VALUE_COLOR[row.kind], children: row.value })] }, row.path));
20
+ }) }));
21
+ }
22
+ //# sourceMappingURL=JsonPane.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"JsonPane.js","sourceRoot":"","sources":["../../../src/ui/JsonPane.tsx"],"names":[],"mappings":";AAOA,OAAO,EAAE,CAAC,EAAE,MAAM,oBAAoB,CAAC;AACvC,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAc,MAAM,oBAAoB,CAAC;AAEvF,MAAM,WAAW,GAAmC;IAClD,MAAM,EAAE,KAAK;IACb,KAAK,EAAE,KAAK;IACZ,MAAM,EAAE,EAAE;IACV,MAAM,EAAE,KAAK;IACb,OAAO,EAAE,KAAK;IACd,IAAI,EAAE,GAAG;CACV,CAAC;AAEF,MAAM,UAAU,QAAQ,CAAC,EACvB,IAAI,EACJ,QAAQ,GAKT;IACC,OAAO,CACL,4BACG,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;YAChB,MAAM,MAAM,GAAG,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;YAChF,OAAO,CACL,gBAEE,QAAQ,EAAC,MAAM,EACf,WAAW,EACT,GAAG,CAAC,UAAU,IAAI,QAAQ;oBACxB,CAAC,CAAC,GAAG,EAAE;wBACH,QAAQ,CAAC,GAAG,CAAC,CAAC;oBAChB,CAAC;oBACH,CAAC,CAAC,SAAS,aAGf,eAAM,EAAE,EAAE,KAAK,YAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,GAAQ,EAChD,gBAAM,EAAE,EAAE,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,aAAG,MAAM,SAAS,EAC5D,GAAG,CAAC,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,CACvB,eAAM,EAAE,EAAE,IAAI,YAAG,GAAG,CAAC,GAAG,GAAQ,CACjC,CAAC,CAAC,CAAC,CACF,eAAM,EAAE,EAAE,QAAQ,YAAG,GAAG,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,GAAQ,CACvE,EACD,eAAM,EAAE,EAAE,GAAG,YAAG,IAAI,GAAQ,EAC5B,eAAM,EAAE,EAAE,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,YAAG,GAAG,CAAC,KAAK,GAAQ,KAlB9C,GAAG,CAAC,IAAI,CAmBR,CACR,CAAC;QACJ,CAAC,CAAC,GACD,CACJ,CAAC;AACJ,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { type PickerItem } from "../lib/picker.js";
2
- export declare function PickerPane({ items, cursor, windowStart, total, title, filter, dismissHint, }: {
2
+ export declare function PickerPane({ items, cursor, windowStart, total, title, filter, dismissHint, onPick, }: {
3
3
  items: PickerItem[];
4
4
  cursor: number;
5
5
  windowStart: number;
@@ -7,4 +7,6 @@ export declare function PickerPane({ items, cursor, windowStart, total, title, f
7
7
  title: string;
8
8
  filter?: string | undefined;
9
9
  dismissHint?: string | undefined;
10
+ /** Mouse: click a row to select it (item from the visible window). */
11
+ onPick?: ((item: PickerItem) => void) | undefined;
10
12
  }): import("react").ReactNode;
@@ -1,7 +1,8 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "@opentui/react/jsx-runtime";
2
2
  import { pickerColumnWidths, truncatePickerText, } from "../lib/picker.js";
3
+ import { G } from "../theme/glyphs.js";
3
4
  import { AMBER, FAINT, FG, TEAL, TEAL_DIM } from "../theme/tokens.js";
4
- export function PickerPane({ items, cursor, windowStart, total, title, filter, dismissHint, }) {
5
+ export function PickerPane({ items, cursor, windowStart, total, title, filter, dismissHint, onPick, }) {
5
6
  const { nameWidth, idWidth } = pickerColumnWidths();
6
7
  return (_jsxs("box", { title: ` pick ${title}${filter ? ` · “${filter}”` : ""} `, style: {
7
8
  border: true,
@@ -15,13 +16,17 @@ export function PickerPane({ items, cursor, windowStart, total, title, filter, d
15
16
  }, children: [items.length === 0 ? (_jsx("text", { fg: AMBER, children: " No matches" })) : (items.map((item, offset) => {
16
17
  const index = windowStart + offset;
17
18
  const active = index === cursor;
18
- const marker = active ? "›" : " ";
19
+ const marker = active ? G.pointer : " ";
19
20
  const number = String(index + 1).padStart(2);
20
21
  const name = truncatePickerText(item.label, nameWidth).padEnd(nameWidth);
21
22
  const secondary = item.detail && item.detail !== item.label
22
23
  ? truncatePickerText(item.detail, idWidth)
23
24
  : "";
24
- return (_jsxs("text", { fg: active ? TEAL : FG, children: [`${marker} ${number} ${name}`, secondary ? (_jsx("span", { fg: FAINT, children: ` ${secondary}` })) : null] }, `${item.id}-${index}`));
25
+ return (_jsxs("text", { fg: active ? TEAL : FG, onMouseDown: onPick
26
+ ? () => {
27
+ onPick(item);
28
+ }
29
+ : undefined, children: [`${marker} ${number} ${name}`, secondary ? (_jsx("span", { fg: FAINT, children: ` ${secondary}` })) : null] }, `${item.id}-${index}`));
25
30
  })), _jsxs("text", { fg: FAINT, children: [total > items.length
26
31
  ? ` ${cursor + 1}/${total} · ↑↓ move · type to filter · Enter`
27
32
  : ` ↑↓ move · type to filter · Enter select`, dismissHint ? ` · ${dismissHint}` : ""] })] }));
@@ -1 +1 @@
1
- {"version":3,"file":"PickerPane.js","sourceRoot":"","sources":["../../../src/ui/PickerPane.tsx"],"names":[],"mappings":";AAAA,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CACL,gBAEE,EAAE,EAAE,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EACtB,WAAW,EACT,MAAM;wBACJ,CAAC,CAAC,GAAG,EAAE;4BACH,MAAM,CAAC,IAAI,CAAC,CAAC;wBACf,CAAC;wBACH,CAAC,CAAC,SAAS,aAGd,GAAG,MAAM,IAAI,MAAM,KAAK,IAAI,EAAE,EAC9B,SAAS,CAAC,CAAC,CAAC,CACX,eAAM,EAAE,EAAE,KAAK,YAAG,KAAK,SAAS,EAAE,GAAQ,CAC3C,CAAC,CAAC,CAAC,IAAI,KAbH,GAAG,IAAI,CAAC,EAAE,IAAI,KAAK,EAAE,CAcrB,CACR,CAAC;YACJ,CAAC,CAAC,CACH,EACD,gBAAM,EAAE,EAAE,KAAK,aACZ,KAAK,GAAG,KAAK,CAAC,MAAM;wBACnB,CAAC,CAAC,IAAI,MAAM,GAAG,CAAC,IAAI,KAAK,qCAAqC;wBAC9D,CAAC,CAAC,0CAA0C,EAC7C,WAAW,CAAC,CAAC,CAAC,MAAM,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,IAClC,IACH,CACP,CAAC;AACJ,CAAC"}
@@ -1,5 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "@opentui/react/jsx-runtime";
2
2
  import { visibleFields } from "../lib/sheet.js";
3
+ import { G } from "../theme/glyphs.js";
3
4
  import { AMBER, DIM, FAINT, FG, RED, TEAL_DIM } from "../theme/tokens.js";
4
5
  export function SheetPane({ sheet }) {
5
6
  const fields = visibleFields(sheet);
@@ -16,7 +17,7 @@ export function SheetPane({ sheet }) {
16
17
  const raw = sheet.values[field.name];
17
18
  const display = field.control === "toggle" ? (raw ? "[x]" : "[ ]") : String(raw ?? "");
18
19
  const active = i === sheet.focused;
19
- return (_jsxs("text", { fg: active ? FG : DIM, children: [active ? "› " : " ", field.label.padEnd(18), " ", display, field.control === "picker" ? _jsx("span", { fg: FAINT, children: " (picker)" }) : null, field.required && !display ? _jsx("span", { fg: FAINT, children: " (required)" }) : null] }, field.name));
20
- }), sheet.fields.some((f) => f.advanced) && (_jsxs("text", { fg: FAINT, children: [" ", sheet.advancedOpen ? "▾" : "▸", " advanced (+ to toggle)"] })), sheet.error && _jsxs("text", { fg: RED, children: ["! ", sheet.error] }), _jsx("text", { fg: FAINT, children: "type value + Enter \u00B7 Enter skip \u00B7 Tab move \u00B7 Esc cancel" })] }));
20
+ return (_jsxs("text", { fg: active ? FG : DIM, children: [active ? `${G.pointer} ` : " ", field.label.padEnd(18), " ", display, field.control === "picker" ? _jsx("span", { fg: FAINT, children: " (picker)" }) : null, field.required && !display ? _jsx("span", { fg: FAINT, children: " (required)" }) : null] }, field.name));
21
+ }), sheet.fields.some((f) => f.advanced) && (_jsxs("text", { fg: FAINT, children: [" ", sheet.advancedOpen ? G.expanded : G.collapsed, " advanced (+ to toggle)"] })), sheet.error && _jsxs("text", { fg: RED, children: ["! ", sheet.error] }), _jsx("text", { fg: FAINT, children: "type value + Enter \u00B7 Enter skip \u00B7 Tab move \u00B7 Esc cancel" })] }));
21
22
  }
22
23
  //# sourceMappingURL=SheetPane.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SheetPane.js","sourceRoot":"","sources":["../../../src/ui/SheetPane.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAA0B,MAAM,iBAAiB,CAAC;AACxE,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAE1E,MAAM,UAAU,SAAS,CAAC,EAAE,KAAK,EAAgC;IAC/D,MAAM,MAAM,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC;IACpC,OAAO,CACL,eACE,KAAK,EAAE,IAAI,KAAK,CAAC,KAAK,GAAG,EACzB,KAAK,EAAE;YACL,MAAM,EAAE,IAAI;YACZ,WAAW,EAAE,SAAS;YACtB,WAAW,EAAE,QAAQ;YACr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M,EAAE,EAAE,KAAK,0BAAkB,CAAC,CAAC,CAAC,IAAI,EACrE,KAAK,CAAC,QAAQ,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,eAAM,EAAE,EAAE,KAAK,4BAAoB,CAAC,CAAC,CAAC,IAAI,KAJ/D,KAAK,CAAC,IAAI,CAKd,CACR,CAAC;YACJ,CAAC,CAAC,EACD,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CACvC,gBAAM,EAAE,EAAE,KAAK,aACZ,GAAG,EACH,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,+BACzC,CACR,EACA,KAAK,CAAC,KAAK,IAAI,gBAAM,EAAE,EAAE,GAAG,mBAAK,KAAK,CAAC,KAAK,IAAQ,EACrD,eAAM,EAAE,EAAE,KAAK,uFAAgE,IAC3E,CACP,CAAC;AACJ,CAAC"}
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2018-2024 Max Brunsfeld
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,269 @@
1
+ # Web Tree-sitter
2
+
3
+ [![npmjs.com badge]][npmjs.com]
4
+
5
+ [npmjs.com]: https://www.npmjs.org/package/web-tree-sitter
6
+ [npmjs.com badge]: https://img.shields.io/npm/v/web-tree-sitter.svg?color=%23BF4A4A
7
+
8
+ WebAssembly bindings to the [Tree-sitter](https://github.com/tree-sitter/tree-sitter) parsing library.
9
+
10
+ ## Setup
11
+
12
+ You can download the `tree-sitter.js` and `tree-sitter.wasm` files from [the latest GitHub release][gh release] and load
13
+ them using a standalone script:
14
+
15
+ ```html
16
+ <script src="/the/path/to/tree-sitter.js"></script>
17
+
18
+ <script>
19
+ const { Parser } = window.TreeSitter;
20
+ Parser.init().then(() => { /* the library is ready */ });
21
+ </script>
22
+ ```
23
+
24
+ You can also install [the `web-tree-sitter` module][npm module] from NPM and load it using a system like Webpack:
25
+
26
+ ```js
27
+ const { Parser } = require('web-tree-sitter');
28
+ Parser.init().then(() => { /* the library is ready */ });
29
+ ```
30
+
31
+ or Vite:
32
+
33
+ ```js
34
+ import { Parser } from 'web-tree-sitter';
35
+ Parser.init().then(() => { /* the library is ready */ });
36
+ ```
37
+
38
+ With Vite, you also need to make sure your server provides the `tree-sitter.wasm`
39
+ file to your `public` directory. You can do this automatically with a `postinstall`
40
+ [script](https://docs.npmjs.com/cli/v10/using-npm/scripts) in your `package.json`:
41
+
42
+ ```js
43
+ "postinstall": "cp node_modules/web-tree-sitter/tree-sitter.wasm public"
44
+ ```
45
+
46
+ You can also use this module with [deno](https://deno.land/):
47
+
48
+ ```js
49
+ import Parser from "npm:web-tree-sitter";
50
+ await Parser.init();
51
+ // the library is ready
52
+ ```
53
+
54
+ To use the debug version of the library, replace your import of `web-tree-sitter` with `web-tree-sitter/debug`:
55
+
56
+ ```js
57
+ import { Parser } from 'web-tree-sitter/debug'; // or require('web-tree-sitter/debug')
58
+
59
+ Parser.init().then(() => { /* the library is ready */ });
60
+ ```
61
+
62
+ This will load the debug version of the `.js` and `.wasm` file, which includes debug symbols and assertions.
63
+
64
+ > [!NOTE]
65
+ > The `tree-sitter.js` file on GH releases is an ES6 module. If you are interested in using a pure CommonJS library, such
66
+ > as for Electron, you should note that on our NPM package, we use [conditional exports][cond export] to provide both the
67
+ > ES6 and CommonJS modules. If you've set up your project correctly, and need to use CommonJS, your package manager will
68
+ > automatically handle this for you. As of writing, we do not host a CommonJS version of the library on GH releases, and
69
+ > if you do not use the NPM registry, you'll have to build the library yourself.
70
+
71
+ ### Basic Usage
72
+
73
+ First, create a parser:
74
+
75
+ ```js
76
+ const parser = new Parser();
77
+ ```
78
+
79
+ Then assign a language to the parser. Tree-sitter languages are packaged as individual `.wasm` files (more on this below):
80
+
81
+ ```js
82
+ const { Language } = require('web-tree-sitter');
83
+ const JavaScript = await Language.load('/path/to/tree-sitter-javascript.wasm');
84
+ parser.setLanguage(JavaScript);
85
+ ```
86
+
87
+ Now you can parse source code:
88
+
89
+ ```js
90
+ const sourceCode = 'let x = 1; console.log(x);';
91
+ const tree = parser.parse(sourceCode);
92
+ ```
93
+
94
+ and inspect the syntax tree.
95
+
96
+ ```javascript
97
+ console.log(tree.rootNode.toString());
98
+
99
+ // (program
100
+ // (lexical_declaration
101
+ // (variable_declarator (identifier) (number)))
102
+ // (expression_statement
103
+ // (call_expression
104
+ // (member_expression (identifier) (property_identifier))
105
+ // (arguments (identifier)))))
106
+
107
+ const callExpression = tree.rootNode.child(1).firstChild;
108
+ console.log(callExpression);
109
+
110
+ // { type: 'call_expression',
111
+ // startPosition: {row: 0, column: 16},
112
+ // endPosition: {row: 0, column: 30},
113
+ // startIndex: 0,
114
+ // endIndex: 30 }
115
+ ```
116
+
117
+ ### Editing
118
+
119
+ If your source code *changes*, you can update the syntax tree. This will take less time than the first parse.
120
+
121
+ ```javascript
122
+ // Replace 'let' with 'const'
123
+ const newSourceCode = 'const x = 1; console.log(x);';
124
+
125
+ tree.edit({
126
+ startIndex: 0,
127
+ oldEndIndex: 3,
128
+ newEndIndex: 5,
129
+ startPosition: {row: 0, column: 0},
130
+ oldEndPosition: {row: 0, column: 3},
131
+ newEndPosition: {row: 0, column: 5},
132
+ });
133
+
134
+ const newTree = parser.parse(newSourceCode, tree);
135
+ ```
136
+
137
+ ### Parsing Text From a Custom Data Structure
138
+
139
+ If your text is stored in a data structure other than a single string, you can parse it by supplying a callback to `parse`
140
+ instead of a string:
141
+
142
+ ```javascript
143
+ const sourceLines = [
144
+ 'let x = 1;',
145
+ 'console.log(x);'
146
+ ];
147
+
148
+ const tree = parser.parse((index, position) => {
149
+ let line = sourceLines[position.row];
150
+ if (line) return line.slice(position.column);
151
+ });
152
+ ```
153
+
154
+ ### Getting the `.wasm` language files
155
+
156
+ There are several options on how to get the `.wasm` files for the languages you want to parse.
157
+
158
+ #### From npmjs.com
159
+
160
+ The recommended way is to just install the package from npm. For example, to parse JavaScript, you can install the `tree-sitter-javascript`
161
+ package:
162
+
163
+ ```sh
164
+ npm install tree-sitter-javascript
165
+ ```
166
+
167
+ Then you can find the `.wasm` file in the `node_modules/tree-sitter-javascript` directory.
168
+
169
+ #### From GitHub
170
+
171
+ You can also download the `.wasm` files from GitHub releases, so long as the repository uses our reusable workflow to publish
172
+ them.
173
+ For example, you can download the JavaScript `.wasm` file from the tree-sitter-javascript [releases page][gh release js].
174
+
175
+ #### Generating `.wasm` files
176
+
177
+ You can also generate the `.wasm` file for your desired grammar. Shown below is an example of how to generate the `.wasm`
178
+ file for the JavaScript grammar.
179
+
180
+ **IMPORTANT**: [Emscripten][emscripten], [Docker][docker], or [Podman][podman] need to be installed.
181
+
182
+ First install `tree-sitter-cli`, and the tree-sitter language for which to generate `.wasm`
183
+ (`tree-sitter-javascript` in this example):
184
+
185
+ ```sh
186
+ npm install --save-dev tree-sitter-cli tree-sitter-javascript
187
+ ```
188
+
189
+ Then just use tree-sitter cli tool to generate the `.wasm`.
190
+
191
+ ```sh
192
+ npx tree-sitter build --wasm node_modules/tree-sitter-javascript
193
+ ```
194
+
195
+ If everything is fine, file `tree-sitter-javascript.wasm` should be generated in current directory.
196
+
197
+ ### Running .wasm in Node.js
198
+
199
+ Notice that executing `.wasm` files in Node.js is considerably slower than running [Node.js bindings][node bindings].
200
+ However, this could be useful for testing purposes:
201
+
202
+ ```javascript
203
+ const Parser = require('web-tree-sitter');
204
+
205
+ (async () => {
206
+ await Parser.init();
207
+ const parser = new Parser();
208
+ const Lang = await Parser.Language.load('tree-sitter-javascript.wasm');
209
+ parser.setLanguage(Lang);
210
+ const tree = parser.parse('let x = 1;');
211
+ console.log(tree.rootNode.toString());
212
+ })();
213
+ ```
214
+
215
+ ### Running .wasm in browser
216
+
217
+ `web-tree-sitter` can run in the browser, but there are some common pitfalls.
218
+
219
+ #### Loading the .wasm file
220
+
221
+ `web-tree-sitter` needs to load the `tree-sitter.wasm` file. By default, it assumes that this file is available in the
222
+ same path as the JavaScript code. Therefore, if the code is being served from `http://localhost:3000/bundle.js`, then
223
+ the wasm file should be at `http://localhost:3000/tree-sitter.wasm`.
224
+
225
+ For server side frameworks like NextJS, this can be tricky as pages are often served from a path such as
226
+ `http://localhost:3000/_next/static/chunks/pages/index.js`. The loader will therefore look for the wasm file at
227
+ `http://localhost:3000/_next/static/chunks/pages/tree-sitter.wasm`. The solution is to pass a `locateFile` function in
228
+ the `moduleOptions` argument to `Parser.init()`:
229
+
230
+ ```javascript
231
+ await Parser.init({
232
+ locateFile(scriptName: string, scriptDirectory: string) {
233
+ return scriptName;
234
+ },
235
+ });
236
+ ```
237
+
238
+ `locateFile` takes in two parameters, `scriptName`, i.e. the wasm file name, and `scriptDirectory`, i.e. the directory
239
+ where the loader expects the script to be. It returns the path where the loader will look for the wasm file. In the NextJS
240
+ case, we want to return just the `scriptName` so that the loader will look at `http://localhost:3000/tree-sitter.wasm`
241
+ and not `http://localhost:3000/_next/static/chunks/pages/tree-sitter.wasm`.
242
+
243
+ For more information on the module options you can pass in, see the [emscripten documentation][emscripten-module-options].
244
+
245
+ #### "Can't resolve 'fs' in 'node_modules/web-tree-sitter"
246
+
247
+ Most bundlers will notice that the `tree-sitter.js` file is attempting to import `fs`, i.e. node's file system library.
248
+ Since this doesn't exist in the browser, the bundlers will get confused. For Webpack, you can fix this by adding the
249
+ following to your webpack config:
250
+
251
+ ```javascript
252
+ {
253
+ resolve: {
254
+ fallback: {
255
+ fs: false
256
+ }
257
+ }
258
+ }
259
+ ```
260
+
261
+ [cond export]: https://nodejs.org/api/packages.html#conditional-exports
262
+ [docker]: https://www.docker.com
263
+ [emscripten]: https://emscripten.org
264
+ [emscripten-module-options]: https://emscripten.org/docs/api_reference/module.html#affecting-execution
265
+ [gh release]: https://github.com/tree-sitter/tree-sitter/releases/latest
266
+ [gh release js]: https://github.com/tree-sitter/tree-sitter-javascript/releases/latest
267
+ [node bindings]: https://github.com/tree-sitter/node-tree-sitter
268
+ [npm module]: https://www.npmjs.com/package/web-tree-sitter
269
+ [podman]: https://podman.io