@fairyhunter13/opentui-core 0.1.91 → 0.1.94

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 (570) hide show
  1. package/3d/SpriteResourceManager.d.ts +74 -0
  2. package/3d/SpriteUtils.d.ts +13 -0
  3. package/3d/TextureUtils.d.ts +24 -0
  4. package/3d/ThreeRenderable.d.ts +40 -0
  5. package/3d/WGPURenderer.d.ts +61 -0
  6. package/3d/animation/ExplodingSpriteEffect.d.ts +71 -0
  7. package/3d/animation/PhysicsExplodingSpriteEffect.d.ts +76 -0
  8. package/3d/animation/SpriteAnimator.d.ts +124 -0
  9. package/3d/animation/SpriteParticleGenerator.d.ts +62 -0
  10. package/3d/canvas.d.ts +44 -0
  11. package/3d/index.d.ts +12 -0
  12. package/3d/physics/PlanckPhysicsAdapter.d.ts +19 -0
  13. package/3d/physics/RapierPhysicsAdapter.d.ts +19 -0
  14. package/3d/physics/physics-interface.d.ts +27 -0
  15. package/3d.d.ts +2 -0
  16. package/3d.js +34042 -0
  17. package/3d.js.map +155 -0
  18. package/LICENSE +21 -0
  19. package/NativeSpanFeed.d.ts +41 -0
  20. package/Renderable.d.ts +334 -0
  21. package/animation/Timeline.d.ts +126 -0
  22. package/ansi.d.ts +13 -0
  23. package/buffer.d.ts +107 -0
  24. package/console.d.ts +143 -0
  25. package/edit-buffer.d.ts +98 -0
  26. package/editor-view.d.ts +73 -0
  27. package/index-e6ec7apq.js +18415 -0
  28. package/index-e6ec7apq.js.map +64 -0
  29. package/index-h066zmrb.js +12619 -0
  30. package/index-h066zmrb.js.map +43 -0
  31. package/index-ynzawt3n.js +113 -0
  32. package/index-ynzawt3n.js.map +10 -0
  33. package/index.d.ts +21 -0
  34. package/index.js +430 -0
  35. package/index.js.map +9 -0
  36. package/lib/KeyHandler.d.ts +61 -0
  37. package/lib/RGBA.d.ts +25 -0
  38. package/lib/ascii.font.d.ts +508 -0
  39. package/lib/border.d.ts +49 -0
  40. package/lib/bunfs.d.ts +7 -0
  41. package/lib/clipboard.d.ts +17 -0
  42. package/lib/clock.d.ts +15 -0
  43. package/lib/data-paths.d.ts +26 -0
  44. package/lib/debounce.d.ts +42 -0
  45. package/lib/detect-links.d.ts +6 -0
  46. package/lib/env.d.ts +42 -0
  47. package/lib/extmarks-history.d.ts +17 -0
  48. package/lib/extmarks.d.ts +89 -0
  49. package/lib/hast-styled-text.d.ts +17 -0
  50. package/lib/index.d.ts +21 -0
  51. package/lib/keymapping.d.ts +25 -0
  52. package/lib/objects-in-viewport.d.ts +24 -0
  53. package/lib/output.capture.d.ts +24 -0
  54. package/lib/parse.keypress-kitty.d.ts +2 -0
  55. package/lib/parse.keypress.d.ts +26 -0
  56. package/lib/parse.mouse.d.ts +30 -0
  57. package/lib/paste.d.ts +7 -0
  58. package/lib/queue.d.ts +15 -0
  59. package/lib/renderable.validations.d.ts +12 -0
  60. package/lib/scroll-acceleration.d.ts +43 -0
  61. package/lib/selection.d.ts +63 -0
  62. package/lib/singleton.d.ts +7 -0
  63. package/lib/stdin-parser.d.ts +76 -0
  64. package/lib/styled-text.d.ts +63 -0
  65. package/lib/terminal-capability-detection.d.ts +30 -0
  66. package/lib/terminal-palette.d.ts +50 -0
  67. package/lib/tree-sitter/assets/update.d.ts +11 -0
  68. package/lib/tree-sitter/client.d.ts +47 -0
  69. package/lib/tree-sitter/default-parsers.d.ts +2 -0
  70. package/lib/tree-sitter/download-utils.d.ts +21 -0
  71. package/lib/tree-sitter/index.d.ts +8 -0
  72. package/lib/tree-sitter/parser.worker.d.ts +1 -0
  73. package/lib/tree-sitter/parsers-config.d.ts +38 -0
  74. package/lib/tree-sitter/resolve-ft.d.ts +2 -0
  75. package/lib/tree-sitter/types.d.ts +81 -0
  76. package/lib/tree-sitter-styled-text.d.ts +14 -0
  77. package/lib/validate-dir-name.d.ts +1 -0
  78. package/lib/yoga.options.d.ts +32 -0
  79. package/package.json +51 -63
  80. package/parser.worker.js +869 -0
  81. package/parser.worker.js.map +12 -0
  82. package/plugins/core-slot.d.ts +72 -0
  83. package/plugins/registry.d.ts +38 -0
  84. package/plugins/types.d.ts +34 -0
  85. package/post/filters.d.ts +105 -0
  86. package/renderables/ASCIIFont.d.ts +52 -0
  87. package/renderables/Box.d.ts +72 -0
  88. package/renderables/Code.d.ts +78 -0
  89. package/renderables/Diff.d.ts +142 -0
  90. package/renderables/EditBufferRenderable.d.ts +162 -0
  91. package/renderables/FrameBuffer.d.ts +16 -0
  92. package/renderables/Input.d.ts +67 -0
  93. package/renderables/LineNumberRenderable.d.ts +74 -0
  94. package/renderables/Markdown.d.ts +173 -0
  95. package/renderables/ScrollBar.d.ts +77 -0
  96. package/renderables/ScrollBox.d.ts +124 -0
  97. package/renderables/Select.d.ts +115 -0
  98. package/renderables/Slider.d.ts +44 -0
  99. package/renderables/TabSelect.d.ts +96 -0
  100. package/renderables/Text.d.ts +36 -0
  101. package/renderables/TextBufferRenderable.d.ts +105 -0
  102. package/renderables/TextNode.d.ts +91 -0
  103. package/renderables/TextTable.d.ts +140 -0
  104. package/renderables/Textarea.d.ts +114 -0
  105. package/renderables/TimeToFirstDraw.d.ts +24 -0
  106. package/renderables/__tests__/renderable-test-utils.d.ts +12 -0
  107. package/renderables/composition/VRenderable.d.ts +16 -0
  108. package/renderables/composition/constructs.d.ts +35 -0
  109. package/renderables/composition/vnode.d.ts +46 -0
  110. package/renderables/index.d.ts +22 -0
  111. package/renderables/markdown-parser.d.ts +10 -0
  112. package/renderer.d.ts +388 -0
  113. package/runtime-plugin-support.d.ts +3 -0
  114. package/runtime-plugin-support.js +29 -0
  115. package/runtime-plugin-support.js.map +10 -0
  116. package/runtime-plugin.d.ts +11 -0
  117. package/runtime-plugin.js +16 -0
  118. package/runtime-plugin.js.map +9 -0
  119. package/syntax-style.d.ts +54 -0
  120. package/testing/manual-clock.d.ts +16 -0
  121. package/testing/mock-keys.d.ts +81 -0
  122. package/testing/mock-mouse.d.ts +38 -0
  123. package/testing/mock-tree-sitter-client.d.ts +23 -0
  124. package/testing/spy.d.ts +7 -0
  125. package/testing/test-recorder.d.ts +61 -0
  126. package/testing/test-renderer.d.ts +23 -0
  127. package/testing.d.ts +6 -0
  128. package/testing.js +675 -0
  129. package/testing.js.map +15 -0
  130. package/text-buffer-view.d.ts +42 -0
  131. package/text-buffer.d.ts +67 -0
  132. package/types.d.ts +131 -0
  133. package/utils.d.ts +14 -0
  134. package/zig-structs.d.ts +155 -0
  135. package/zig.d.ts +351 -0
  136. package/dev/keypress-debug-renderer.ts +0 -148
  137. package/dev/keypress-debug.ts +0 -43
  138. package/dev/print-env-vars.ts +0 -32
  139. package/dev/test-tmux-graphics-334.sh +0 -68
  140. package/dev/thai-debug-test.ts +0 -68
  141. package/docs/development.md +0 -141
  142. package/docs/env-vars.md +0 -140
  143. package/docs/getting-started.md +0 -353
  144. package/docs/renderables-vs-constructs.md +0 -159
  145. package/docs/tree-sitter.md +0 -311
  146. package/scripts/build.ts +0 -400
  147. package/scripts/publish.ts +0 -60
  148. package/src/3d/SpriteResourceManager.ts +0 -286
  149. package/src/3d/SpriteUtils.ts +0 -71
  150. package/src/3d/TextureUtils.ts +0 -196
  151. package/src/3d/ThreeRenderable.ts +0 -197
  152. package/src/3d/WGPURenderer.ts +0 -294
  153. package/src/3d/animation/ExplodingSpriteEffect.ts +0 -513
  154. package/src/3d/animation/PhysicsExplodingSpriteEffect.ts +0 -429
  155. package/src/3d/animation/SpriteAnimator.ts +0 -633
  156. package/src/3d/animation/SpriteParticleGenerator.ts +0 -435
  157. package/src/3d/canvas.ts +0 -464
  158. package/src/3d/index.ts +0 -12
  159. package/src/3d/physics/PlanckPhysicsAdapter.ts +0 -72
  160. package/src/3d/physics/RapierPhysicsAdapter.ts +0 -66
  161. package/src/3d/physics/physics-interface.ts +0 -31
  162. package/src/3d/shaders/supersampling.wgsl +0 -201
  163. package/src/3d.ts +0 -3
  164. package/src/NativeSpanFeed.ts +0 -300
  165. package/src/Renderable.ts +0 -1698
  166. package/src/__snapshots__/buffer.test.ts.snap +0 -28
  167. package/src/animation/Timeline.test.ts +0 -2709
  168. package/src/animation/Timeline.ts +0 -598
  169. package/src/ansi.ts +0 -18
  170. package/src/benchmark/latest-all-bench-run.json +0 -707
  171. package/src/benchmark/latest-async-bench-run.json +0 -336
  172. package/src/benchmark/latest-default-bench-run.json +0 -657
  173. package/src/benchmark/latest-large-bench-run.json +0 -707
  174. package/src/benchmark/latest-quick-bench-run.json +0 -207
  175. package/src/benchmark/markdown-benchmark.ts +0 -1804
  176. package/src/benchmark/native-span-feed-async-benchmark.ts +0 -355
  177. package/src/benchmark/native-span-feed-benchmark.md +0 -56
  178. package/src/benchmark/native-span-feed-benchmark.ts +0 -596
  179. package/src/benchmark/native-span-feed-compare.ts +0 -280
  180. package/src/benchmark/renderer-benchmark.ts +0 -754
  181. package/src/benchmark/text-table-benchmark.ts +0 -947
  182. package/src/buffer.test.ts +0 -291
  183. package/src/buffer.ts +0 -519
  184. package/src/console.test.ts +0 -612
  185. package/src/console.ts +0 -1255
  186. package/src/edit-buffer.test.ts +0 -1769
  187. package/src/edit-buffer.ts +0 -411
  188. package/src/editor-view.test.ts +0 -1032
  189. package/src/editor-view.ts +0 -284
  190. package/src/examples/ascii-font-selection-demo.ts +0 -245
  191. package/src/examples/assets/Water_2_M_Normal.jpg +0 -0
  192. package/src/examples/assets/concrete.png +0 -0
  193. package/src/examples/assets/crate.png +0 -0
  194. package/src/examples/assets/crate_emissive.png +0 -0
  195. package/src/examples/assets/forrest_background.png +0 -0
  196. package/src/examples/assets/hast-example.json +0 -1018
  197. package/src/examples/assets/heart.png +0 -0
  198. package/src/examples/assets/main_char_heavy_attack.png +0 -0
  199. package/src/examples/assets/main_char_idle.png +0 -0
  200. package/src/examples/assets/main_char_jump_end.png +0 -0
  201. package/src/examples/assets/main_char_jump_landing.png +0 -0
  202. package/src/examples/assets/main_char_jump_start.png +0 -0
  203. package/src/examples/assets/main_char_run_loop.png +0 -0
  204. package/src/examples/assets/roughness_map.jpg +0 -0
  205. package/src/examples/build.ts +0 -115
  206. package/src/examples/code-demo.ts +0 -584
  207. package/src/examples/console-demo.ts +0 -358
  208. package/src/examples/core-plugin-slots-demo.ts +0 -759
  209. package/src/examples/diff-demo.ts +0 -699
  210. package/src/examples/draggable-three-demo.ts +0 -259
  211. package/src/examples/editor-demo.ts +0 -322
  212. package/src/examples/extmarks-demo.ts +0 -204
  213. package/src/examples/focus-restore-demo.ts +0 -310
  214. package/src/examples/fonts.ts +0 -245
  215. package/src/examples/fractal-shader-demo.ts +0 -268
  216. package/src/examples/framebuffer-demo.ts +0 -674
  217. package/src/examples/full-unicode-demo.ts +0 -181
  218. package/src/examples/golden-star-demo.ts +0 -933
  219. package/src/examples/grayscale-buffer-demo.ts +0 -249
  220. package/src/examples/hast-syntax-highlighting-demo.ts +0 -129
  221. package/src/examples/index.ts +0 -925
  222. package/src/examples/input-demo.ts +0 -377
  223. package/src/examples/input-select-layout-demo.ts +0 -425
  224. package/src/examples/install.sh +0 -143
  225. package/src/examples/keypress-debug-demo.ts +0 -452
  226. package/src/examples/lib/HexList.ts +0 -122
  227. package/src/examples/lib/PaletteGrid.ts +0 -125
  228. package/src/examples/lib/standalone-keys.ts +0 -25
  229. package/src/examples/lib/tab-controller.ts +0 -243
  230. package/src/examples/lights-phong-demo.ts +0 -290
  231. package/src/examples/link-demo.ts +0 -220
  232. package/src/examples/live-state-demo.ts +0 -480
  233. package/src/examples/markdown-demo.ts +0 -620
  234. package/src/examples/mouse-interaction-demo.ts +0 -428
  235. package/src/examples/nested-zindex-demo.ts +0 -357
  236. package/src/examples/opacity-example.ts +0 -235
  237. package/src/examples/opentui-demo.ts +0 -1057
  238. package/src/examples/physx-planck-2d-demo.ts +0 -507
  239. package/src/examples/physx-rapier-2d-demo.ts +0 -526
  240. package/src/examples/relative-positioning-demo.ts +0 -323
  241. package/src/examples/scroll-example.ts +0 -214
  242. package/src/examples/scrollbox-mouse-test.ts +0 -112
  243. package/src/examples/scrollbox-overlay-hit-test.ts +0 -206
  244. package/src/examples/select-demo.ts +0 -237
  245. package/src/examples/shader-cube-demo.ts +0 -772
  246. package/src/examples/simple-layout-example.ts +0 -591
  247. package/src/examples/slider-demo.ts +0 -617
  248. package/src/examples/split-mode-demo.ts +0 -445
  249. package/src/examples/sprite-animation-demo.ts +0 -443
  250. package/src/examples/sprite-particle-generator-demo.ts +0 -486
  251. package/src/examples/static-sprite-demo.ts +0 -193
  252. package/src/examples/sticky-scroll-example.ts +0 -308
  253. package/src/examples/styled-text-demo.ts +0 -282
  254. package/src/examples/tab-select-demo.ts +0 -219
  255. package/src/examples/terminal-title.ts +0 -29
  256. package/src/examples/terminal.ts +0 -305
  257. package/src/examples/text-node-demo.ts +0 -416
  258. package/src/examples/text-selection-demo.ts +0 -377
  259. package/src/examples/text-table-demo.ts +0 -503
  260. package/src/examples/text-truncation-demo.ts +0 -481
  261. package/src/examples/text-wrap.ts +0 -757
  262. package/src/examples/texture-loading-demo.ts +0 -259
  263. package/src/examples/timeline-example.ts +0 -670
  264. package/src/examples/transparency-demo.ts +0 -241
  265. package/src/examples/vnode-composition-demo.ts +0 -404
  266. package/src/index.ts +0 -22
  267. package/src/lib/KeyHandler.integration.test.ts +0 -292
  268. package/src/lib/KeyHandler.stopPropagation.test.ts +0 -289
  269. package/src/lib/KeyHandler.test.ts +0 -662
  270. package/src/lib/KeyHandler.ts +0 -222
  271. package/src/lib/RGBA.test.ts +0 -984
  272. package/src/lib/RGBA.ts +0 -204
  273. package/src/lib/ascii.font.ts +0 -330
  274. package/src/lib/border.test.ts +0 -83
  275. package/src/lib/border.ts +0 -168
  276. package/src/lib/bunfs.test.ts +0 -27
  277. package/src/lib/bunfs.ts +0 -18
  278. package/src/lib/clipboard.test.ts +0 -41
  279. package/src/lib/clipboard.ts +0 -47
  280. package/src/lib/clock.ts +0 -31
  281. package/src/lib/data-paths.test.ts +0 -133
  282. package/src/lib/data-paths.ts +0 -109
  283. package/src/lib/debounce.ts +0 -106
  284. package/src/lib/detect-links.test.ts +0 -98
  285. package/src/lib/detect-links.ts +0 -56
  286. package/src/lib/env.test.ts +0 -228
  287. package/src/lib/env.ts +0 -209
  288. package/src/lib/extmarks-history.ts +0 -51
  289. package/src/lib/extmarks-multiwidth.test.ts +0 -322
  290. package/src/lib/extmarks.test.ts +0 -3457
  291. package/src/lib/extmarks.ts +0 -843
  292. package/src/lib/fonts/block.json +0 -405
  293. package/src/lib/fonts/grid.json +0 -265
  294. package/src/lib/fonts/huge.json +0 -741
  295. package/src/lib/fonts/pallet.json +0 -314
  296. package/src/lib/fonts/shade.json +0 -591
  297. package/src/lib/fonts/slick.json +0 -321
  298. package/src/lib/fonts/tiny.json +0 -69
  299. package/src/lib/hast-styled-text.ts +0 -59
  300. package/src/lib/index.ts +0 -21
  301. package/src/lib/keymapping.test.ts +0 -280
  302. package/src/lib/keymapping.ts +0 -87
  303. package/src/lib/objects-in-viewport.test.ts +0 -787
  304. package/src/lib/objects-in-viewport.ts +0 -153
  305. package/src/lib/output.capture.ts +0 -58
  306. package/src/lib/parse.keypress-kitty.protocol.test.ts +0 -340
  307. package/src/lib/parse.keypress-kitty.test.ts +0 -663
  308. package/src/lib/parse.keypress-kitty.ts +0 -439
  309. package/src/lib/parse.keypress.test.ts +0 -1849
  310. package/src/lib/parse.keypress.ts +0 -397
  311. package/src/lib/parse.mouse.test.ts +0 -552
  312. package/src/lib/parse.mouse.ts +0 -232
  313. package/src/lib/paste.ts +0 -16
  314. package/src/lib/queue.ts +0 -65
  315. package/src/lib/renderable.validations.test.ts +0 -87
  316. package/src/lib/renderable.validations.ts +0 -83
  317. package/src/lib/scroll-acceleration.ts +0 -98
  318. package/src/lib/selection.ts +0 -240
  319. package/src/lib/singleton.ts +0 -28
  320. package/src/lib/stdin-parser.test.ts +0 -1676
  321. package/src/lib/stdin-parser.ts +0 -1248
  322. package/src/lib/styled-text.ts +0 -178
  323. package/src/lib/terminal-capability-detection.test.ts +0 -202
  324. package/src/lib/terminal-capability-detection.ts +0 -79
  325. package/src/lib/terminal-palette.test.ts +0 -878
  326. package/src/lib/terminal-palette.ts +0 -383
  327. package/src/lib/tree-sitter/assets/README.md +0 -118
  328. package/src/lib/tree-sitter/assets/update.ts +0 -331
  329. package/src/lib/tree-sitter/assets.d.ts +0 -9
  330. package/src/lib/tree-sitter/cache.test.ts +0 -270
  331. package/src/lib/tree-sitter/client.test.ts +0 -1061
  332. package/src/lib/tree-sitter/client.ts +0 -615
  333. package/src/lib/tree-sitter/default-parsers.ts +0 -80
  334. package/src/lib/tree-sitter/download-utils.ts +0 -148
  335. package/src/lib/tree-sitter/index.ts +0 -28
  336. package/src/lib/tree-sitter/parser.worker.ts +0 -1001
  337. package/src/lib/tree-sitter/parsers-config.ts +0 -75
  338. package/src/lib/tree-sitter/resolve-ft.ts +0 -62
  339. package/src/lib/tree-sitter/types.ts +0 -81
  340. package/src/lib/tree-sitter-styled-text.test.ts +0 -1253
  341. package/src/lib/tree-sitter-styled-text.ts +0 -306
  342. package/src/lib/validate-dir-name.ts +0 -55
  343. package/src/lib/yoga.options.test.ts +0 -628
  344. package/src/lib/yoga.options.ts +0 -346
  345. package/src/plugins/core-slot.ts +0 -579
  346. package/src/plugins/registry.ts +0 -377
  347. package/src/plugins/types.ts +0 -46
  348. package/src/post/filters.ts +0 -888
  349. package/src/renderables/ASCIIFont.ts +0 -219
  350. package/src/renderables/Box.test.ts +0 -160
  351. package/src/renderables/Box.ts +0 -295
  352. package/src/renderables/Code.test.ts +0 -2062
  353. package/src/renderables/Code.ts +0 -357
  354. package/src/renderables/Diff.regression.test.ts +0 -226
  355. package/src/renderables/Diff.test.ts +0 -3027
  356. package/src/renderables/Diff.ts +0 -1209
  357. package/src/renderables/EditBufferRenderable.ts +0 -764
  358. package/src/renderables/FrameBuffer.ts +0 -47
  359. package/src/renderables/Input.test.ts +0 -1228
  360. package/src/renderables/Input.ts +0 -245
  361. package/src/renderables/LineNumberRenderable.ts +0 -675
  362. package/src/renderables/Markdown.ts +0 -1106
  363. package/src/renderables/ScrollBar.ts +0 -422
  364. package/src/renderables/ScrollBox.ts +0 -883
  365. package/src/renderables/Select.test.ts +0 -1010
  366. package/src/renderables/Select.ts +0 -523
  367. package/src/renderables/Slider.test.ts +0 -456
  368. package/src/renderables/Slider.ts +0 -347
  369. package/src/renderables/TabSelect.test.ts +0 -197
  370. package/src/renderables/TabSelect.ts +0 -455
  371. package/src/renderables/Text.selection-buffer.test.ts +0 -123
  372. package/src/renderables/Text.test.ts +0 -2660
  373. package/src/renderables/Text.ts +0 -147
  374. package/src/renderables/TextBufferRenderable.ts +0 -518
  375. package/src/renderables/TextNode.test.ts +0 -1058
  376. package/src/renderables/TextNode.ts +0 -325
  377. package/src/renderables/TextTable.test.ts +0 -1421
  378. package/src/renderables/TextTable.ts +0 -1344
  379. package/src/renderables/Textarea.ts +0 -732
  380. package/src/renderables/TimeToFirstDraw.ts +0 -89
  381. package/src/renderables/__snapshots__/Code.test.ts.snap +0 -13
  382. package/src/renderables/__snapshots__/Diff.test.ts.snap +0 -785
  383. package/src/renderables/__snapshots__/Text.test.ts.snap +0 -421
  384. package/src/renderables/__snapshots__/TextTable.test.ts.snap +0 -215
  385. package/src/renderables/__tests__/LineNumberRenderable.scrollbox-simple.test.ts +0 -144
  386. package/src/renderables/__tests__/LineNumberRenderable.scrollbox.test.ts +0 -816
  387. package/src/renderables/__tests__/LineNumberRenderable.test.ts +0 -1787
  388. package/src/renderables/__tests__/LineNumberRenderable.wrapping.test.ts +0 -85
  389. package/src/renderables/__tests__/Markdown.test.ts +0 -2287
  390. package/src/renderables/__tests__/MultiRenderable.selection.test.ts +0 -87
  391. package/src/renderables/__tests__/Textarea.buffer.test.ts +0 -682
  392. package/src/renderables/__tests__/Textarea.destroyed-events.test.ts +0 -675
  393. package/src/renderables/__tests__/Textarea.editing.test.ts +0 -2041
  394. package/src/renderables/__tests__/Textarea.error-handling.test.ts +0 -35
  395. package/src/renderables/__tests__/Textarea.events.test.ts +0 -738
  396. package/src/renderables/__tests__/Textarea.highlights.test.ts +0 -590
  397. package/src/renderables/__tests__/Textarea.keybinding.test.ts +0 -3149
  398. package/src/renderables/__tests__/Textarea.paste.test.ts +0 -357
  399. package/src/renderables/__tests__/Textarea.rendering.test.ts +0 -1864
  400. package/src/renderables/__tests__/Textarea.scroll.test.ts +0 -733
  401. package/src/renderables/__tests__/Textarea.selection.test.ts +0 -1590
  402. package/src/renderables/__tests__/Textarea.stress.test.ts +0 -670
  403. package/src/renderables/__tests__/Textarea.undo-redo.test.ts +0 -383
  404. package/src/renderables/__tests__/Textarea.visual-lines.test.ts +0 -310
  405. package/src/renderables/__tests__/__snapshots__/LineNumberRenderable.code.test.ts.snap +0 -221
  406. package/src/renderables/__tests__/__snapshots__/LineNumberRenderable.scrollbox-simple.test.ts.snap +0 -89
  407. package/src/renderables/__tests__/__snapshots__/LineNumberRenderable.scrollbox.test.ts.snap +0 -457
  408. package/src/renderables/__tests__/__snapshots__/LineNumberRenderable.test.ts.snap +0 -158
  409. package/src/renderables/__tests__/__snapshots__/Textarea.rendering.test.ts.snap +0 -387
  410. package/src/renderables/__tests__/markdown-parser.test.ts +0 -217
  411. package/src/renderables/__tests__/renderable-test-utils.ts +0 -60
  412. package/src/renderables/composition/README.md +0 -8
  413. package/src/renderables/composition/VRenderable.ts +0 -32
  414. package/src/renderables/composition/constructs.ts +0 -127
  415. package/src/renderables/composition/vnode.ts +0 -289
  416. package/src/renderables/index.ts +0 -22
  417. package/src/renderables/markdown-parser.ts +0 -66
  418. package/src/renderer.ts +0 -2363
  419. package/src/runtime-plugin-support.ts +0 -39
  420. package/src/runtime-plugin.ts +0 -144
  421. package/src/syntax-style.test.ts +0 -841
  422. package/src/syntax-style.ts +0 -264
  423. package/src/testing/README.md +0 -210
  424. package/src/testing/capture-spans.test.ts +0 -194
  425. package/src/testing/integration.test.ts +0 -276
  426. package/src/testing/manual-clock.ts +0 -106
  427. package/src/testing/mock-keys.test.ts +0 -1356
  428. package/src/testing/mock-keys.ts +0 -449
  429. package/src/testing/mock-mouse.test.ts +0 -218
  430. package/src/testing/mock-mouse.ts +0 -247
  431. package/src/testing/mock-tree-sitter-client.ts +0 -73
  432. package/src/testing/spy.ts +0 -13
  433. package/src/testing/test-recorder.test.ts +0 -415
  434. package/src/testing/test-recorder.ts +0 -145
  435. package/src/testing/test-renderer.ts +0 -116
  436. package/src/testing.ts +0 -7
  437. package/src/tests/__snapshots__/absolute-positioning.snapshot.test.ts.snap +0 -481
  438. package/src/tests/__snapshots__/renderable.snapshot.test.ts.snap +0 -19
  439. package/src/tests/__snapshots__/scrollbox.test.ts.snap +0 -29
  440. package/src/tests/absolute-positioning.snapshot.test.ts +0 -638
  441. package/src/tests/allocator-stats.test.ts +0 -38
  442. package/src/tests/destroy-during-render.test.ts +0 -200
  443. package/src/tests/hover-cursor.test.ts +0 -98
  444. package/src/tests/native-span-feed-async.test.ts +0 -173
  445. package/src/tests/native-span-feed-close.test.ts +0 -120
  446. package/src/tests/native-span-feed-coverage.test.ts +0 -227
  447. package/src/tests/native-span-feed-edge-cases.test.ts +0 -352
  448. package/src/tests/native-span-feed-use-after-free.test.ts +0 -45
  449. package/src/tests/opacity.test.ts +0 -123
  450. package/src/tests/renderable.snapshot.test.ts +0 -524
  451. package/src/tests/renderable.test.ts +0 -1281
  452. package/src/tests/renderer.console-startup.test.ts +0 -65
  453. package/src/tests/renderer.control.test.ts +0 -364
  454. package/src/tests/renderer.core-slot-binding.test.ts +0 -952
  455. package/src/tests/renderer.cursor.test.ts +0 -26
  456. package/src/tests/renderer.destroy-during-render.test.ts +0 -110
  457. package/src/tests/renderer.focus-restore.test.ts +0 -228
  458. package/src/tests/renderer.focus.test.ts +0 -251
  459. package/src/tests/renderer.idle.test.ts +0 -219
  460. package/src/tests/renderer.input.test.ts +0 -2145
  461. package/src/tests/renderer.kitty-flags.test.ts +0 -195
  462. package/src/tests/renderer.mouse.test.ts +0 -1269
  463. package/src/tests/renderer.palette.test.ts +0 -629
  464. package/src/tests/renderer.selection.test.ts +0 -49
  465. package/src/tests/renderer.slot-registry.test.ts +0 -649
  466. package/src/tests/renderer.useMouse.test.ts +0 -50
  467. package/src/tests/runtime-plugin-support.fixture.ts +0 -11
  468. package/src/tests/runtime-plugin-support.test.ts +0 -28
  469. package/src/tests/runtime-plugin.fixture.ts +0 -40
  470. package/src/tests/runtime-plugin.test.ts +0 -190
  471. package/src/tests/scrollbox-culling-bug.test.ts +0 -114
  472. package/src/tests/scrollbox-hitgrid-resize.test.ts +0 -136
  473. package/src/tests/scrollbox-hitgrid.test.ts +0 -909
  474. package/src/tests/scrollbox.test.ts +0 -1530
  475. package/src/tests/wrap-resize-perf.test.ts +0 -229
  476. package/src/tests/yoga-setters.test.ts +0 -921
  477. package/src/text-buffer-view.test.ts +0 -705
  478. package/src/text-buffer-view.ts +0 -189
  479. package/src/text-buffer.test.ts +0 -347
  480. package/src/text-buffer.ts +0 -250
  481. package/src/types.ts +0 -152
  482. package/src/utils.ts +0 -88
  483. package/src/zig/ansi.zig +0 -268
  484. package/src/zig/bench/README.md +0 -50
  485. package/src/zig/bench/buffer-draw-text-buffer_bench.zig +0 -887
  486. package/src/zig/bench/edit-buffer_bench.zig +0 -476
  487. package/src/zig/bench/native-span-feed_bench.zig +0 -100
  488. package/src/zig/bench/rope-markers_bench.zig +0 -713
  489. package/src/zig/bench/rope_bench.zig +0 -514
  490. package/src/zig/bench/styled-text_bench.zig +0 -470
  491. package/src/zig/bench/text-buffer-coords_bench.zig +0 -362
  492. package/src/zig/bench/text-buffer-view_bench.zig +0 -459
  493. package/src/zig/bench/text-chunk-graphemes_bench.zig +0 -273
  494. package/src/zig/bench/utf8_bench.zig +0 -799
  495. package/src/zig/bench-utils.zig +0 -431
  496. package/src/zig/bench.zig +0 -217
  497. package/src/zig/buffer.zig +0 -2223
  498. package/src/zig/build.zig +0 -289
  499. package/src/zig/build.zig.zon +0 -16
  500. package/src/zig/edit-buffer.zig +0 -825
  501. package/src/zig/editor-view.zig +0 -802
  502. package/src/zig/event-bus.zig +0 -13
  503. package/src/zig/event-emitter.zig +0 -65
  504. package/src/zig/file-logger.zig +0 -92
  505. package/src/zig/grapheme.zig +0 -599
  506. package/src/zig/lib.zig +0 -1834
  507. package/src/zig/link.zig +0 -333
  508. package/src/zig/logger.zig +0 -43
  509. package/src/zig/mem-registry.zig +0 -125
  510. package/src/zig/native-span-feed-bench-lib.zig +0 -7
  511. package/src/zig/native-span-feed.zig +0 -708
  512. package/src/zig/renderer.zig +0 -1386
  513. package/src/zig/rope.zig +0 -1220
  514. package/src/zig/syntax-style.zig +0 -161
  515. package/src/zig/terminal.zig +0 -975
  516. package/src/zig/test.zig +0 -70
  517. package/src/zig/tests/README.md +0 -18
  518. package/src/zig/tests/buffer_test.zig +0 -2526
  519. package/src/zig/tests/edit-buffer-history_test.zig +0 -271
  520. package/src/zig/tests/edit-buffer_test.zig +0 -1689
  521. package/src/zig/tests/editor-view_test.zig +0 -3299
  522. package/src/zig/tests/event-emitter_test.zig +0 -249
  523. package/src/zig/tests/grapheme_test.zig +0 -1304
  524. package/src/zig/tests/link_test.zig +0 -190
  525. package/src/zig/tests/mem-registry_test.zig +0 -473
  526. package/src/zig/tests/memory_leak_regression_test.zig +0 -159
  527. package/src/zig/tests/native-span-feed_test.zig +0 -1264
  528. package/src/zig/tests/renderer_test.zig +0 -1010
  529. package/src/zig/tests/rope-nested_test.zig +0 -712
  530. package/src/zig/tests/rope_fuzz_test.zig +0 -238
  531. package/src/zig/tests/rope_test.zig +0 -2362
  532. package/src/zig/tests/segment-merge.test.zig +0 -148
  533. package/src/zig/tests/syntax-style_test.zig +0 -557
  534. package/src/zig/tests/terminal_test.zig +0 -719
  535. package/src/zig/tests/text-buffer-drawing_test.zig +0 -3237
  536. package/src/zig/tests/text-buffer-highlights_test.zig +0 -666
  537. package/src/zig/tests/text-buffer-iterators_test.zig +0 -776
  538. package/src/zig/tests/text-buffer-segment_test.zig +0 -320
  539. package/src/zig/tests/text-buffer-selection_test.zig +0 -1035
  540. package/src/zig/tests/text-buffer-selection_viewport_test.zig +0 -358
  541. package/src/zig/tests/text-buffer-view_test.zig +0 -3649
  542. package/src/zig/tests/text-buffer_test.zig +0 -2191
  543. package/src/zig/tests/unicode-width-map.zon +0 -3909
  544. package/src/zig/tests/utf8_no_zwj_test.zig +0 -260
  545. package/src/zig/tests/utf8_test.zig +0 -4057
  546. package/src/zig/tests/utf8_wcwidth_cursor_test.zig +0 -267
  547. package/src/zig/tests/utf8_wcwidth_test.zig +0 -357
  548. package/src/zig/tests/word-wrap-editing_test.zig +0 -498
  549. package/src/zig/tests/wrap-cache-perf_test.zig +0 -113
  550. package/src/zig/text-buffer-iterators.zig +0 -499
  551. package/src/zig/text-buffer-segment.zig +0 -404
  552. package/src/zig/text-buffer-view.zig +0 -1371
  553. package/src/zig/text-buffer.zig +0 -1180
  554. package/src/zig/utf8.zig +0 -1948
  555. package/src/zig/utils.zig +0 -9
  556. package/src/zig-structs.ts +0 -261
  557. package/src/zig.ts +0 -3843
  558. package/tsconfig.build.json +0 -22
  559. package/tsconfig.json +0 -28
  560. /package/{src/lib/tree-sitter/assets → assets}/javascript/highlights.scm +0 -0
  561. /package/{src/lib/tree-sitter/assets → assets}/javascript/tree-sitter-javascript.wasm +0 -0
  562. /package/{src/lib/tree-sitter/assets → assets}/markdown/highlights.scm +0 -0
  563. /package/{src/lib/tree-sitter/assets → assets}/markdown/injections.scm +0 -0
  564. /package/{src/lib/tree-sitter/assets → assets}/markdown/tree-sitter-markdown.wasm +0 -0
  565. /package/{src/lib/tree-sitter/assets → assets}/markdown_inline/highlights.scm +0 -0
  566. /package/{src/lib/tree-sitter/assets → assets}/markdown_inline/tree-sitter-markdown_inline.wasm +0 -0
  567. /package/{src/lib/tree-sitter/assets → assets}/typescript/highlights.scm +0 -0
  568. /package/{src/lib/tree-sitter/assets → assets}/typescript/tree-sitter-typescript.wasm +0 -0
  569. /package/{src/lib/tree-sitter/assets → assets}/zig/highlights.scm +0 -0
  570. /package/{src/lib/tree-sitter/assets → assets}/zig/tree-sitter-zig.wasm +0 -0
@@ -1,148 +0,0 @@
1
- const std = @import("std");
2
- const EditBuffer = @import("../edit-buffer.zig").EditBuffer;
3
- const gp = @import("../grapheme.zig");
4
- const link = @import("../link.zig");
5
-
6
- test "EditBuffer - sequential character insertion merges segments" {
7
- const pool = gp.initGlobalPool(std.testing.allocator);
8
- defer gp.deinitGlobalPool();
9
- const link_pool = link.initGlobalLinkPool(std.testing.allocator);
10
- defer link.deinitGlobalLinkPool();
11
-
12
- var eb = try EditBuffer.init(std.testing.allocator, pool, link_pool, .wcwidth);
13
- defer eb.deinit();
14
-
15
- try eb.insertText("h");
16
- try eb.insertText("e");
17
- try eb.insertText("l");
18
- try eb.insertText("l");
19
- try eb.insertText("o");
20
-
21
- const count = eb.tb.rope().count();
22
-
23
- var buffer: [1024]u8 = undefined;
24
- const len = eb.getText(&buffer);
25
- try std.testing.expectEqualStrings("hello", buffer[0..len]);
26
-
27
- try std.testing.expect(count <= 4);
28
- try std.testing.expect(count >= 2);
29
- }
30
-
31
- test "EditBuffer - merging preserves text correctness" {
32
- const pool = gp.initGlobalPool(std.testing.allocator);
33
- defer gp.deinitGlobalPool();
34
- const link_pool = link.initGlobalLinkPool(std.testing.allocator);
35
- defer link.deinitGlobalLinkPool();
36
-
37
- var eb = try EditBuffer.init(std.testing.allocator, pool, link_pool, .wcwidth);
38
- defer eb.deinit();
39
-
40
- const text = "The quick brown fox jumps over the lazy dog";
41
- for (text) |c| {
42
- var char_buf: [1]u8 = .{c};
43
- try eb.insertText(&char_buf);
44
- }
45
-
46
- var buffer: [1024]u8 = undefined;
47
- const len = eb.getText(&buffer);
48
- try std.testing.expectEqualStrings(text, buffer[0..len]);
49
- }
50
-
51
- test "EditBuffer - non-contiguous segments do not merge" {
52
- const pool = gp.initGlobalPool(std.testing.allocator);
53
- defer gp.deinitGlobalPool();
54
- const link_pool = link.initGlobalLinkPool(std.testing.allocator);
55
- defer link.deinitGlobalLinkPool();
56
-
57
- var eb = try EditBuffer.init(std.testing.allocator, pool, link_pool, .wcwidth);
58
- defer eb.deinit();
59
-
60
- try eb.insertText("abc");
61
- try eb.setCursor(0, 0);
62
- try eb.insertText("xyz");
63
-
64
- var buffer: [1024]u8 = undefined;
65
- const len = eb.getText(&buffer);
66
- try std.testing.expectEqualStrings("xyzabc", buffer[0..len]);
67
- }
68
-
69
- test "EditBuffer - merging works across newlines" {
70
- const pool = gp.initGlobalPool(std.testing.allocator);
71
- defer gp.deinitGlobalPool();
72
- const link_pool = link.initGlobalLinkPool(std.testing.allocator);
73
- defer link.deinitGlobalLinkPool();
74
-
75
- var eb = try EditBuffer.init(std.testing.allocator, pool, link_pool, .wcwidth);
76
- defer eb.deinit();
77
-
78
- try eb.insertText("a");
79
- try eb.insertText("b");
80
- try eb.insertText("c");
81
- try eb.insertText("\n");
82
- try eb.insertText("d");
83
- try eb.insertText("e");
84
- try eb.insertText("f");
85
-
86
- var buffer: [1024]u8 = undefined;
87
- const len = eb.getText(&buffer);
88
- try std.testing.expectEqualStrings("abc\ndef", buffer[0..len]);
89
-
90
- const line_count = eb.tb.lineCount();
91
- try std.testing.expectEqual(@as(u32, 2), line_count);
92
- }
93
-
94
- test "EditBuffer - merging with unicode characters" {
95
- const pool = gp.initGlobalPool(std.testing.allocator);
96
- defer gp.deinitGlobalPool();
97
- const link_pool = link.initGlobalLinkPool(std.testing.allocator);
98
- defer link.deinitGlobalLinkPool();
99
-
100
- var eb = try EditBuffer.init(std.testing.allocator, pool, link_pool, .wcwidth);
101
- defer eb.deinit();
102
-
103
- try eb.insertText("你");
104
- try eb.insertText("好");
105
- try eb.insertText("世");
106
- try eb.insertText("界");
107
-
108
- var buffer: [1024]u8 = undefined;
109
- const len = eb.getText(&buffer);
110
- try std.testing.expectEqualStrings("你好世界", buffer[0..len]);
111
- }
112
-
113
- test "EditBuffer - merging after delete and re-insert" {
114
- const pool = gp.initGlobalPool(std.testing.allocator);
115
- defer gp.deinitGlobalPool();
116
- const link_pool = link.initGlobalLinkPool(std.testing.allocator);
117
- defer link.deinitGlobalLinkPool();
118
-
119
- var eb = try EditBuffer.init(std.testing.allocator, pool, link_pool, .wcwidth);
120
- defer eb.deinit();
121
-
122
- try eb.insertText("hello");
123
- try eb.backspace();
124
- try eb.insertText("p");
125
-
126
- var buffer: [1024]u8 = undefined;
127
- const len = eb.getText(&buffer);
128
- try std.testing.expectEqualStrings("hellp", buffer[0..len]);
129
- }
130
-
131
- test "EditBuffer - empty buffer then type" {
132
- const pool = gp.initGlobalPool(std.testing.allocator);
133
- defer gp.deinitGlobalPool();
134
- const link_pool = link.initGlobalLinkPool(std.testing.allocator);
135
- defer link.deinitGlobalLinkPool();
136
-
137
- var eb = try EditBuffer.init(std.testing.allocator, pool, link_pool, .wcwidth);
138
- defer eb.deinit();
139
-
140
- try eb.insertText("t");
141
- try eb.insertText("e");
142
- try eb.insertText("s");
143
- try eb.insertText("t");
144
-
145
- var buffer: [1024]u8 = undefined;
146
- const len = eb.getText(&buffer);
147
- try std.testing.expectEqualStrings("test", buffer[0..len]);
148
- }
@@ -1,557 +0,0 @@
1
- const std = @import("std");
2
- const syntax_style = @import("../syntax-style.zig");
3
-
4
- const SyntaxStyle = syntax_style.SyntaxStyle;
5
- const StyleDefinition = syntax_style.StyleDefinition;
6
- const RGBA = syntax_style.RGBA;
7
-
8
- test "SyntaxStyle - init and deinit" {
9
- const style = try SyntaxStyle.init(std.testing.allocator);
10
- defer style.deinit();
11
-
12
- try std.testing.expectEqual(@as(usize, 0), style.getStyleCount());
13
- }
14
-
15
- test "SyntaxStyle - multiple independent instances" {
16
- const style1 = try SyntaxStyle.init(std.testing.allocator);
17
- defer style1.deinit();
18
-
19
- const style2 = try SyntaxStyle.init(std.testing.allocator);
20
- defer style2.deinit();
21
-
22
- const fg = RGBA{ 1.0, 0.0, 0.0, 1.0 };
23
- _ = try style1.registerStyle("test", fg, null, 0);
24
-
25
- try std.testing.expectEqual(@as(usize, 1), style1.getStyleCount());
26
- try std.testing.expectEqual(@as(usize, 0), style2.getStyleCount());
27
- }
28
-
29
- test "SyntaxStyle - register simple style" {
30
- const style = try SyntaxStyle.init(std.testing.allocator);
31
- defer style.deinit();
32
-
33
- const fg = RGBA{ 1.0, 0.0, 0.0, 1.0 };
34
- const id = try style.registerStyle("keyword", fg, null, 0);
35
-
36
- try std.testing.expect(id > 0);
37
- try std.testing.expectEqual(@as(usize, 1), style.getStyleCount());
38
- }
39
-
40
- test "SyntaxStyle - register style with fg and bg" {
41
- const style = try SyntaxStyle.init(std.testing.allocator);
42
- defer style.deinit();
43
-
44
- const fg = RGBA{ 1.0, 0.0, 0.0, 1.0 };
45
- const bg = RGBA{ 0.0, 0.0, 0.0, 1.0 };
46
- const id = try style.registerStyle("string", fg, bg, 0);
47
-
48
- try std.testing.expect(id > 0);
49
- try std.testing.expectEqual(@as(usize, 1), style.getStyleCount());
50
- }
51
-
52
- test "SyntaxStyle - register style with attributes" {
53
- const style = try SyntaxStyle.init(std.testing.allocator);
54
- defer style.deinit();
55
-
56
- const fg = RGBA{ 1.0, 0.0, 0.0, 1.0 };
57
- const attributes: u32 = 0b0001; // Bold
58
- const id = try style.registerStyle("bold-keyword", fg, null, attributes);
59
-
60
- try std.testing.expect(id > 0);
61
-
62
- const resolved = style.resolveById(id).?;
63
- try std.testing.expectEqual(attributes, resolved.attributes);
64
- }
65
-
66
- test "SyntaxStyle - register style with all attributes" {
67
- const style = try SyntaxStyle.init(std.testing.allocator);
68
- defer style.deinit();
69
-
70
- const fg = RGBA{ 1.0, 0.0, 0.0, 1.0 };
71
- const attributes: u32 = 0b1111; // Bold, italic, underline, dim
72
- const id = try style.registerStyle("all-attrs", fg, null, attributes);
73
-
74
- try std.testing.expect(id > 0);
75
-
76
- const resolved = style.resolveById(id).?;
77
- try std.testing.expectEqual(attributes, resolved.attributes);
78
- }
79
-
80
- test "SyntaxStyle - register style without colors" {
81
- const style = try SyntaxStyle.init(std.testing.allocator);
82
- defer style.deinit();
83
-
84
- const id = try style.registerStyle("plain", null, null, 0);
85
-
86
- try std.testing.expect(id > 0);
87
-
88
- const resolved = style.resolveById(id).?;
89
- try std.testing.expect(resolved.fg == null);
90
- try std.testing.expect(resolved.bg == null);
91
- }
92
-
93
- test "SyntaxStyle - register multiple styles" {
94
- const style = try SyntaxStyle.init(std.testing.allocator);
95
- defer style.deinit();
96
-
97
- const fg1 = RGBA{ 1.0, 0.0, 0.0, 1.0 };
98
- const fg2 = RGBA{ 0.0, 1.0, 0.0, 1.0 };
99
- const fg3 = RGBA{ 0.0, 0.0, 1.0, 1.0 };
100
-
101
- const id1 = try style.registerStyle("keyword", fg1, null, 0);
102
- const id2 = try style.registerStyle("string", fg2, null, 0);
103
- const id3 = try style.registerStyle("comment", fg3, null, 0);
104
-
105
- try std.testing.expect(id1 != id2);
106
- try std.testing.expect(id2 != id3);
107
- try std.testing.expect(id1 != id3);
108
- try std.testing.expectEqual(@as(usize, 3), style.getStyleCount());
109
- }
110
-
111
- test "SyntaxStyle - register same name returns same ID" {
112
- const style = try SyntaxStyle.init(std.testing.allocator);
113
- defer style.deinit();
114
-
115
- const fg1 = RGBA{ 1.0, 0.0, 0.0, 1.0 };
116
- const fg2 = RGBA{ 0.0, 1.0, 0.0, 1.0 };
117
-
118
- const id1 = try style.registerStyle("keyword", fg1, null, 0);
119
- const id2 = try style.registerStyle("keyword", fg2, null, 0);
120
-
121
- try std.testing.expectEqual(id1, id2);
122
- try std.testing.expectEqual(@as(usize, 1), style.getStyleCount());
123
-
124
- const resolved = style.resolveById(id2).?;
125
- try std.testing.expectEqual(fg2[0], resolved.fg.?[0]);
126
- try std.testing.expectEqual(fg2[1], resolved.fg.?[1]);
127
- }
128
-
129
- test "SyntaxStyle - register style with special characters" {
130
- const style = try SyntaxStyle.init(std.testing.allocator);
131
- defer style.deinit();
132
-
133
- const fg = RGBA{ 1.0, 0.0, 0.0, 1.0 };
134
-
135
- _ = try style.registerStyle("keyword.control", fg, null, 0);
136
- _ = try style.registerStyle("variable.parameter", fg, null, 0);
137
- _ = try style.registerStyle("meta.tag.xml", fg, null, 0);
138
-
139
- try std.testing.expectEqual(@as(usize, 3), style.getStyleCount());
140
- }
141
-
142
- test "SyntaxStyle - register many styles" {
143
- const style = try SyntaxStyle.init(std.testing.allocator);
144
- defer style.deinit();
145
-
146
- const count = 100;
147
- var ids: [count]u32 = undefined;
148
-
149
- for (0..count) |i| {
150
- var name_buffer: [32]u8 = undefined;
151
- const name = try std.fmt.bufPrint(&name_buffer, "style-{d}", .{i});
152
-
153
- const fg = RGBA{ @as(f32, @floatFromInt(i)) / 100.0, 0.0, 0.0, 1.0 };
154
- ids[i] = try style.registerStyle(name, fg, null, 0);
155
- }
156
-
157
- try std.testing.expectEqual(@as(usize, count), style.getStyleCount());
158
-
159
- for (ids, 0..count) |id1, i| {
160
- for (ids[i + 1 ..]) |id2| {
161
- try std.testing.expect(id1 != id2);
162
- }
163
- }
164
- }
165
-
166
- test "SyntaxStyle - resolveById returns correct style" {
167
- const style = try SyntaxStyle.init(std.testing.allocator);
168
- defer style.deinit();
169
-
170
- const fg = RGBA{ 1.0, 0.0, 0.0, 1.0 };
171
- const bg = RGBA{ 0.0, 0.0, 0.0, 1.0 };
172
- const attributes: u32 = 0b0011; // Bold + italic
173
-
174
- const id = try style.registerStyle("test", fg, bg, attributes);
175
- const resolved = style.resolveById(id).?;
176
-
177
- try std.testing.expectEqual(fg[0], resolved.fg.?[0]);
178
- try std.testing.expectEqual(bg[0], resolved.bg.?[0]);
179
- try std.testing.expectEqual(attributes, resolved.attributes);
180
- }
181
-
182
- test "SyntaxStyle - resolveById invalid ID returns null" {
183
- const style = try SyntaxStyle.init(std.testing.allocator);
184
- defer style.deinit();
185
-
186
- const resolved = style.resolveById(9999);
187
- try std.testing.expect(resolved == null);
188
- }
189
-
190
- test "SyntaxStyle - resolveById zero returns null" {
191
- const style = try SyntaxStyle.init(std.testing.allocator);
192
- defer style.deinit();
193
-
194
- const resolved = style.resolveById(0);
195
- try std.testing.expect(resolved == null);
196
- }
197
-
198
- test "SyntaxStyle - resolveByName returns correct ID" {
199
- const style = try SyntaxStyle.init(std.testing.allocator);
200
- defer style.deinit();
201
-
202
- const fg = RGBA{ 1.0, 0.0, 0.0, 1.0 };
203
- const registered_id = try style.registerStyle("keyword", fg, null, 0);
204
-
205
- const resolved_id = style.resolveByName("keyword").?;
206
- try std.testing.expectEqual(registered_id, resolved_id);
207
- }
208
-
209
- test "SyntaxStyle - resolveByName non-existent returns null" {
210
- const style = try SyntaxStyle.init(std.testing.allocator);
211
- defer style.deinit();
212
-
213
- const resolved = style.resolveByName("nonexistent");
214
- try std.testing.expect(resolved == null);
215
- }
216
-
217
- test "SyntaxStyle - resolveByName is case-sensitive" {
218
- const style = try SyntaxStyle.init(std.testing.allocator);
219
- defer style.deinit();
220
-
221
- const fg = RGBA{ 1.0, 0.0, 0.0, 1.0 };
222
- _ = try style.registerStyle("keyword", fg, null, 0);
223
-
224
- try std.testing.expect(style.resolveByName("keyword") != null);
225
- try std.testing.expect(style.resolveByName("Keyword") == null);
226
- try std.testing.expect(style.resolveByName("KEYWORD") == null);
227
- }
228
-
229
- test "SyntaxStyle - resolve multiple styles" {
230
- const style = try SyntaxStyle.init(std.testing.allocator);
231
- defer style.deinit();
232
-
233
- const fg1 = RGBA{ 1.0, 0.0, 0.0, 1.0 };
234
- const fg2 = RGBA{ 0.0, 1.0, 0.0, 1.0 };
235
-
236
- const id1 = try style.registerStyle("keyword", fg1, null, 0);
237
- const id2 = try style.registerStyle("string", fg2, null, 0);
238
-
239
- try std.testing.expectEqual(id1, style.resolveByName("keyword").?);
240
- try std.testing.expectEqual(id2, style.resolveByName("string").?);
241
- }
242
-
243
- test "SyntaxStyle - merge single style" {
244
- const style = try SyntaxStyle.init(std.testing.allocator);
245
- defer style.deinit();
246
-
247
- const fg = RGBA{ 1.0, 0.0, 0.0, 1.0 };
248
- const attributes: u32 = 0b0001;
249
-
250
- const id = try style.registerStyle("keyword", fg, null, attributes);
251
-
252
- const ids = [_]u32{id};
253
- const merged = try style.mergeStyles(&ids);
254
-
255
- try std.testing.expectEqual(fg[0], merged.fg.?[0]);
256
- try std.testing.expectEqual(attributes, merged.attributes);
257
- }
258
-
259
- test "SyntaxStyle - merge two styles" {
260
- const style = try SyntaxStyle.init(std.testing.allocator);
261
- defer style.deinit();
262
-
263
- const fg1 = RGBA{ 1.0, 0.0, 0.0, 1.0 };
264
- const fg2 = RGBA{ 0.0, 1.0, 0.0, 1.0 };
265
- const bg2 = RGBA{ 0.0, 0.0, 0.0, 1.0 };
266
-
267
- const id1 = try style.registerStyle("base", fg1, null, 0b0001); // Bold
268
- const id2 = try style.registerStyle("modifier", fg2, bg2, 0b0010); // Italic
269
-
270
- const ids = [_]u32{ id1, id2 };
271
- const merged = try style.mergeStyles(&ids);
272
-
273
- try std.testing.expectEqual(fg2[0], merged.fg.?[0]);
274
- try std.testing.expectEqual(bg2[0], merged.bg.?[0]);
275
- try std.testing.expectEqual(@as(u32, 0b0011), merged.attributes);
276
- }
277
-
278
- test "SyntaxStyle - merge three styles" {
279
- const style = try SyntaxStyle.init(std.testing.allocator);
280
- defer style.deinit();
281
-
282
- const fg1 = RGBA{ 1.0, 0.0, 0.0, 1.0 };
283
- const fg2 = RGBA{ 0.0, 1.0, 0.0, 1.0 };
284
- const fg3 = RGBA{ 0.0, 0.0, 1.0, 1.0 };
285
-
286
- const id1 = try style.registerStyle("s1", fg1, null, 0b0001); // Bold
287
- const id2 = try style.registerStyle("s2", fg2, null, 0b0010); // Italic
288
- const id3 = try style.registerStyle("s3", fg3, null, 0b0100); // Underline
289
-
290
- const ids = [_]u32{ id1, id2, id3 };
291
- const merged = try style.mergeStyles(&ids);
292
-
293
- try std.testing.expectEqual(fg3[0], merged.fg.?[0]);
294
- try std.testing.expectEqual(@as(u32, 0b0111), merged.attributes);
295
- }
296
-
297
- test "SyntaxStyle - merge empty array" {
298
- const style = try SyntaxStyle.init(std.testing.allocator);
299
- defer style.deinit();
300
-
301
- const ids: []const u32 = &[_]u32{};
302
- const merged = try style.mergeStyles(ids);
303
-
304
- try std.testing.expect(merged.fg == null);
305
- try std.testing.expect(merged.bg == null);
306
- try std.testing.expectEqual(@as(u32, 0), merged.attributes);
307
- }
308
-
309
- test "SyntaxStyle - merge with invalid ID skips it" {
310
- const style = try SyntaxStyle.init(std.testing.allocator);
311
- defer style.deinit();
312
-
313
- const fg = RGBA{ 1.0, 0.0, 0.0, 1.0 };
314
- const id1 = try style.registerStyle("valid", fg, null, 0b0001);
315
-
316
- const ids = [_]u32{ id1, 9999 }; // 9999 is invalid
317
- const merged = try style.mergeStyles(&ids);
318
-
319
- try std.testing.expectEqual(fg[0], merged.fg.?[0]);
320
- try std.testing.expectEqual(@as(u32, 0b0001), merged.attributes);
321
- }
322
-
323
- test "SyntaxStyle - merge caches results" {
324
- const style = try SyntaxStyle.init(std.testing.allocator);
325
- defer style.deinit();
326
-
327
- const fg1 = RGBA{ 1.0, 0.0, 0.0, 1.0 };
328
- const fg2 = RGBA{ 0.0, 1.0, 0.0, 1.0 };
329
-
330
- const id1 = try style.registerStyle("s1", fg1, null, 0);
331
- const id2 = try style.registerStyle("s2", fg2, null, 0);
332
-
333
- const ids = [_]u32{ id1, id2 };
334
-
335
- const merged1 = try style.mergeStyles(&ids);
336
- const merged2 = try style.mergeStyles(&ids);
337
-
338
- try std.testing.expectEqual(merged1.fg.?[0], merged2.fg.?[0]);
339
- try std.testing.expect(style.getCacheSize() > 0);
340
- }
341
-
342
- test "SyntaxStyle - merge different order produces different results" {
343
- const style = try SyntaxStyle.init(std.testing.allocator);
344
- defer style.deinit();
345
-
346
- const fg1 = RGBA{ 1.0, 0.0, 0.0, 1.0 };
347
- const fg2 = RGBA{ 0.0, 1.0, 0.0, 1.0 };
348
-
349
- const id1 = try style.registerStyle("s1", fg1, null, 0);
350
- const id2 = try style.registerStyle("s2", fg2, null, 0);
351
-
352
- const ids1 = [_]u32{ id1, id2 };
353
- const ids2 = [_]u32{ id2, id1 };
354
-
355
- const merged1 = try style.mergeStyles(&ids1);
356
- const merged2 = try style.mergeStyles(&ids2);
357
-
358
- try std.testing.expect(merged1.fg.?[0] != merged2.fg.?[0]);
359
- }
360
-
361
- test "SyntaxStyle - clearCache empties cache" {
362
- const style = try SyntaxStyle.init(std.testing.allocator);
363
- defer style.deinit();
364
-
365
- const fg1 = RGBA{ 1.0, 0.0, 0.0, 1.0 };
366
- const fg2 = RGBA{ 0.0, 1.0, 0.0, 1.0 };
367
-
368
- const id1 = try style.registerStyle("s1", fg1, null, 0);
369
- const id2 = try style.registerStyle("s2", fg2, null, 0);
370
-
371
- const ids = [_]u32{ id1, id2 };
372
- _ = try style.mergeStyles(&ids);
373
-
374
- try std.testing.expect(style.getCacheSize() > 0);
375
-
376
- style.clearCache();
377
-
378
- try std.testing.expectEqual(@as(usize, 0), style.getCacheSize());
379
- }
380
-
381
- test "SyntaxStyle - clearCache preserves styles" {
382
- const style = try SyntaxStyle.init(std.testing.allocator);
383
- defer style.deinit();
384
-
385
- const fg = RGBA{ 1.0, 0.0, 0.0, 1.0 };
386
- _ = try style.registerStyle("keyword", fg, null, 0);
387
- _ = try style.registerStyle("string", fg, null, 0);
388
-
389
- const count_before = style.getStyleCount();
390
- style.clearCache();
391
- const count_after = style.getStyleCount();
392
-
393
- try std.testing.expectEqual(count_before, count_after);
394
- }
395
-
396
- test "SyntaxStyle - getCacheSize returns correct count" {
397
- const style = try SyntaxStyle.init(std.testing.allocator);
398
- defer style.deinit();
399
-
400
- try std.testing.expectEqual(@as(usize, 0), style.getCacheSize());
401
-
402
- const fg = RGBA{ 1.0, 0.0, 0.0, 1.0 };
403
- const id1 = try style.registerStyle("s1", fg, null, 0);
404
- const id2 = try style.registerStyle("s2", fg, null, 0);
405
-
406
- const ids1 = [_]u32{id1};
407
- const ids2 = [_]u32{id2};
408
- const ids_both = [_]u32{ id1, id2 };
409
-
410
- _ = try style.mergeStyles(&ids1);
411
- try std.testing.expectEqual(@as(usize, 1), style.getCacheSize());
412
-
413
- _ = try style.mergeStyles(&ids2);
414
- try std.testing.expectEqual(@as(usize, 2), style.getCacheSize());
415
-
416
- _ = try style.mergeStyles(&ids_both);
417
- try std.testing.expectEqual(@as(usize, 3), style.getCacheSize());
418
- }
419
-
420
- test "SyntaxStyle - very long style name" {
421
- const style = try SyntaxStyle.init(std.testing.allocator);
422
- defer style.deinit();
423
-
424
- var long_name: [1000]u8 = undefined;
425
- @memset(&long_name, 'a');
426
-
427
- const fg = RGBA{ 1.0, 0.0, 0.0, 1.0 };
428
- const id = try style.registerStyle(&long_name, fg, null, 0);
429
-
430
- try std.testing.expect(id > 0);
431
- try std.testing.expectEqual(id, style.resolveByName(&long_name).?);
432
- }
433
-
434
- test "SyntaxStyle - empty string style name" {
435
- const style = try SyntaxStyle.init(std.testing.allocator);
436
- defer style.deinit();
437
-
438
- const fg = RGBA{ 1.0, 0.0, 0.0, 1.0 };
439
- const id = try style.registerStyle("", fg, null, 0);
440
-
441
- try std.testing.expect(id > 0);
442
- try std.testing.expectEqual(id, style.resolveByName("").?);
443
- }
444
-
445
- test "SyntaxStyle - unicode style names" {
446
- const style = try SyntaxStyle.init(std.testing.allocator);
447
- defer style.deinit();
448
-
449
- const fg = RGBA{ 1.0, 0.0, 0.0, 1.0 };
450
-
451
- const id1 = try style.registerStyle("关键字", fg, null, 0);
452
- const id2 = try style.registerStyle("キーワード", fg, null, 0);
453
- const id3 = try style.registerStyle("🔑", fg, null, 0);
454
-
455
- try std.testing.expectEqual(@as(usize, 3), style.getStyleCount());
456
- try std.testing.expect(id1 != id2);
457
- try std.testing.expect(id2 != id3);
458
- }
459
-
460
- test "SyntaxStyle - all color channels" {
461
- const style = try SyntaxStyle.init(std.testing.allocator);
462
- defer style.deinit();
463
-
464
- const fg = RGBA{ 0.1, 0.2, 0.3, 0.4 };
465
- const bg = RGBA{ 0.5, 0.6, 0.7, 0.8 };
466
-
467
- const id = try style.registerStyle("test", fg, bg, 0);
468
- const resolved = style.resolveById(id).?;
469
-
470
- try std.testing.expectEqual(fg[0], resolved.fg.?[0]);
471
- try std.testing.expectEqual(fg[1], resolved.fg.?[1]);
472
- try std.testing.expectEqual(fg[2], resolved.fg.?[2]);
473
- try std.testing.expectEqual(fg[3], resolved.fg.?[3]);
474
-
475
- try std.testing.expectEqual(bg[0], resolved.bg.?[0]);
476
- try std.testing.expectEqual(bg[1], resolved.bg.?[1]);
477
- try std.testing.expectEqual(bg[2], resolved.bg.?[2]);
478
- try std.testing.expectEqual(bg[3], resolved.bg.?[3]);
479
- }
480
-
481
- test "SyntaxStyle - stress test many registrations" {
482
- const style = try SyntaxStyle.init(std.testing.allocator);
483
- defer style.deinit();
484
-
485
- const count = 1000;
486
- for (0..count) |i| {
487
- var name_buffer: [32]u8 = undefined;
488
- const name = try std.fmt.bufPrint(&name_buffer, "style-{d}", .{i});
489
-
490
- const fg = RGBA{ @as(f32, @floatFromInt(i % 256)) / 255.0, 0.0, 0.0, 1.0 };
491
- _ = try style.registerStyle(name, fg, null, 0);
492
- }
493
-
494
- try std.testing.expectEqual(@as(usize, count), style.getStyleCount());
495
- }
496
-
497
- test "SyntaxStyle - stress test many merges" {
498
- const style = try SyntaxStyle.init(std.testing.allocator);
499
- defer style.deinit();
500
-
501
- const fg = RGBA{ 1.0, 0.0, 0.0, 1.0 };
502
- const id1 = try style.registerStyle("s1", fg, null, 0);
503
- const id2 = try style.registerStyle("s2", fg, null, 0);
504
- const id3 = try style.registerStyle("s3", fg, null, 0);
505
-
506
- for (0..100) |_| {
507
- const ids = [_]u32{ id1, id2, id3 };
508
- _ = try style.mergeStyles(&ids);
509
- }
510
-
511
- try std.testing.expectEqual(@as(usize, 1), style.getCacheSize());
512
- }
513
-
514
- test "SyntaxStyle - merge many styles at once" {
515
- const style = try SyntaxStyle.init(std.testing.allocator);
516
- defer style.deinit();
517
-
518
- const count = 50;
519
- var ids: [count]u32 = undefined;
520
-
521
- const fg = RGBA{ 1.0, 0.0, 0.0, 1.0 };
522
- for (0..count) |i| {
523
- var name_buffer: [32]u8 = undefined;
524
- const name = try std.fmt.bufPrint(&name_buffer, "s{d}", .{i});
525
- ids[i] = try style.registerStyle(name, fg, null, @as(u8, @intCast(i % 4)));
526
- }
527
-
528
- const merged = try style.mergeStyles(&ids);
529
-
530
- try std.testing.expect(merged.attributes != 0);
531
- }
532
-
533
- test "SyntaxStyle - multiple init/deinit cycles" {
534
- for (0..10) |_| {
535
- const style = try SyntaxStyle.init(std.testing.allocator);
536
- const fg = RGBA{ 1.0, 0.0, 0.0, 1.0 };
537
- _ = try style.registerStyle("test", fg, null, 0);
538
- style.deinit();
539
- }
540
- }
541
-
542
- test "SyntaxStyle - register and resolve after clear cache" {
543
- const style = try SyntaxStyle.init(std.testing.allocator);
544
- defer style.deinit();
545
-
546
- const fg = RGBA{ 1.0, 0.0, 0.0, 1.0 };
547
- const id = try style.registerStyle("keyword", fg, null, 0);
548
-
549
- const ids = [_]u32{id};
550
- _ = try style.mergeStyles(&ids);
551
-
552
- style.clearCache();
553
-
554
- try std.testing.expectEqual(id, style.resolveByName("keyword").?);
555
- const merged = try style.mergeStyles(&ids);
556
- try std.testing.expectEqual(fg[0], merged.fg.?[0]);
557
- }