@xincli/opentui-core 0.4.6 → 0.4.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/NativeSpanFeed.d.ts +52 -0
- package/README.md +0 -0
- package/Renderable.d.ts +346 -0
- package/animation/Timeline.d.ts +126 -0
- package/ansi.d.ts +17 -0
- package/audio.d.ts +89 -0
- package/buffer.d.ts +113 -0
- package/console.d.ts +146 -0
- package/edit-buffer.d.ts +97 -0
- package/editor-view.d.ts +72 -0
- package/index-m1y9e40w.js +10045 -0
- package/index-m1y9e40w.js.map +32 -0
- package/index-sqk4ajdf.js +16121 -0
- package/index-sqk4ajdf.js.map +58 -0
- package/index.d.ts +24 -0
- package/index.js +11709 -0
- package/index.js.map +35 -0
- package/lib/KeyHandler.d.ts +61 -0
- package/lib/RGBA.d.ts +42 -0
- package/lib/ascii.font.d.ts +508 -0
- package/lib/border.d.ts +51 -0
- package/lib/bunfs.d.ts +7 -0
- package/lib/clipboard.d.ts +15 -0
- package/lib/clock.d.ts +15 -0
- package/lib/data-paths.d.ts +26 -0
- package/lib/debounce.d.ts +42 -0
- package/lib/detect-links.d.ts +6 -0
- package/lib/env.d.ts +42 -0
- package/lib/extmarks-history.d.ts +17 -0
- package/lib/extmarks.d.ts +90 -0
- package/lib/hast-styled-text.d.ts +17 -0
- package/lib/index.d.ts +22 -0
- package/lib/keybinding.internal.d.ts +33 -0
- package/lib/objects-in-viewport.d.ts +24 -0
- package/lib/output.capture.d.ts +24 -0
- package/lib/parse.keypress-kitty.d.ts +3 -0
- package/lib/parse.keypress.d.ts +27 -0
- package/lib/parse.mouse.d.ts +30 -0
- package/lib/paste.d.ts +7 -0
- package/lib/queue.d.ts +15 -0
- package/lib/render-geometry.d.ts +8 -0
- package/lib/renderable.validations.d.ts +12 -0
- package/lib/scroll-acceleration.d.ts +43 -0
- package/lib/selection.d.ts +64 -0
- package/lib/singleton.d.ts +8 -0
- package/lib/stdin-parser.d.ts +90 -0
- package/lib/styled-text.d.ts +63 -0
- package/lib/terminal-capability-detection.d.ts +32 -0
- package/lib/terminal-palette.d.ts +65 -0
- package/lib/tree-sitter/assets/update.d.ts +12 -0
- package/lib/tree-sitter/client.d.ts +65 -0
- package/lib/tree-sitter/default-parsers.d.ts +2 -0
- package/lib/tree-sitter/download-utils.d.ts +21 -0
- package/lib/tree-sitter/index.d.ts +7 -0
- package/lib/tree-sitter/parser.worker.d.ts +1 -0
- package/lib/tree-sitter/parsers-config.d.ts +53 -0
- package/lib/tree-sitter/resolve-ft.d.ts +5 -0
- package/lib/tree-sitter/types.d.ts +185 -0
- package/lib/tree-sitter/update-assets.d.ts +3 -0
- package/lib/tree-sitter/update-assets.js +379 -0
- package/lib/tree-sitter/update-assets.js.map +12 -0
- package/lib/tree-sitter-styled-text.d.ts +16 -0
- package/lib/validate-dir-name.d.ts +1 -0
- package/lib/yoga.options.d.ts +32 -0
- package/native-event-worker-repro.worker.d.ts +1 -0
- package/package.json +52 -74
- package/parser.worker.js +1399 -0
- package/parser.worker.js.map +20 -0
- package/platform/ffi.d.ts +129 -0
- package/platform/runtime.d.ts +14 -0
- package/platform/test.d.ts +12 -0
- package/platform/worker.d.ts +26 -0
- package/platform/worker.node-test.d.ts +1 -0
- package/plugins/core-slot.d.ts +72 -0
- package/plugins/registry.d.ts +42 -0
- package/plugins/types.d.ts +34 -0
- package/post/effects.d.ts +147 -0
- package/post/filters.d.ts +65 -0
- package/post/matrices.d.ts +20 -0
- package/renderables/ASCIIFont.d.ts +52 -0
- package/renderables/Box.d.ts +85 -0
- package/renderables/Code.d.ts +97 -0
- package/renderables/Diff.d.ts +147 -0
- package/renderables/EditBufferRenderable.d.ts +238 -0
- package/renderables/FrameBuffer.d.ts +16 -0
- package/renderables/Input.d.ts +72 -0
- package/renderables/LineNumberRenderable.d.ts +78 -0
- package/renderables/Markdown.d.ts +255 -0
- package/renderables/ScrollBar.d.ts +77 -0
- package/renderables/ScrollBox.d.ts +128 -0
- package/renderables/Select.d.ts +122 -0
- package/renderables/Slider.d.ts +47 -0
- package/renderables/TabSelect.d.ts +98 -0
- package/renderables/Text.d.ts +36 -0
- package/renderables/TextBufferRenderable.d.ts +107 -0
- package/renderables/TextNode.d.ts +92 -0
- package/renderables/TextTable.d.ts +154 -0
- package/renderables/Textarea.d.ts +65 -0
- package/renderables/TimeToFirstDraw.d.ts +24 -0
- package/renderables/__tests__/renderable-test-utils.d.ts +12 -0
- package/renderables/composition/VRenderable.d.ts +16 -0
- package/renderables/composition/constructs.d.ts +35 -0
- package/renderables/composition/vnode.d.ts +46 -0
- package/renderables/index.d.ts +23 -0
- package/renderables/markdown-parser.d.ts +11 -0
- package/renderer-theme-mode.d.ts +29 -0
- package/renderer.d.ts +601 -0
- package/runtime-plugin-support-configure.d.ts +4 -0
- package/runtime-plugin-support-configure.js +36 -0
- package/runtime-plugin-support-configure.js.map +1 -0
- package/runtime-plugin-support-configure.node.js +15 -0
- package/runtime-plugin-support.d.ts +3 -0
- package/runtime-plugin-support.js +5 -0
- package/runtime-plugin-support.js.map +1 -0
- package/runtime-plugin-support.node.js +15 -0
- package/runtime-plugin.d.ts +16 -0
- package/runtime-plugin.js +473 -0
- package/runtime-plugin.js.map +1 -0
- package/runtime-plugin.node.js +15 -0
- package/syntax-style.d.ts +61 -0
- package/testing/bun-test-node.d.ts +87 -0
- package/testing/manual-clock.d.ts +17 -0
- package/testing/mock-keys.d.ts +81 -0
- package/testing/mock-mouse.d.ts +38 -0
- package/testing/mock-tree-sitter-client.d.ts +27 -0
- package/testing/spy.d.ts +7 -0
- package/testing/terminal-capabilities.d.ts +7 -0
- package/testing/test-recorder.d.ts +61 -0
- package/testing/test-renderer.d.ts +54 -0
- package/testing/test-streams.d.ts +12 -0
- package/testing.d.ts +8 -0
- package/testing.js +1004 -0
- package/testing.js.map +18 -0
- package/tests/yoga-upstream/tools/MeasureCounter.d.ts +16 -0
- package/tests/yoga-upstream/tools/utils.d.ts +11 -0
- package/text-buffer-view.d.ts +42 -0
- package/text-buffer.d.ts +66 -0
- package/types.d.ts +175 -0
- package/utils.d.ts +14 -0
- package/yoga.d.ts +437 -0
- package/yoga.js +193 -0
- package/yoga.js.map +9 -0
- package/zig-structs.d.ts +256 -0
- package/zig.d.ts +496 -0
- package/dev/keypress-debug-renderer.ts +0 -148
- package/dev/keypress-debug.ts +0 -43
- package/dev/print-env-vars.ts +0 -32
- package/dev/test-tmux-graphics-334.sh +0 -68
- package/dev/test-tmux-theme-queries.sh +0 -151
- package/dev/thai-debug-test.ts +0 -68
- package/dev/theme-mode.ts +0 -290
- package/docs/development.md +0 -144
- package/prebuilt/aarch64-android/libopentui.so +0 -0
- package/scripts/build-android.ts +0 -226
- package/scripts/build-native-termux.sh +0 -525
- package/scripts/build.ts +0 -530
- package/scripts/dist-test.ts +0 -312
- package/scripts/package-prebuilt.ts +0 -110
- package/scripts/publish.ts +0 -60
- package/scripts/test-node-hook.mjs +0 -16
- package/scripts/test-node.ts +0 -241
- package/scripts/vendor-deps.sh +0 -73
- package/src/NativeSpanFeed.ts +0 -375
- package/src/Renderable.ts +0 -1878
- package/src/__snapshots__/buffer.test.ts.snap +0 -28
- package/src/animation/Timeline.test.ts +0 -2709
- package/src/animation/Timeline.ts +0 -598
- package/src/ansi.ts +0 -22
- package/src/audio.ts +0 -479
- package/src/benchmark/attenuation-benchmark.ts +0 -81
- package/src/benchmark/audio-playback-benchmark.ts +0 -344
- package/src/benchmark/box-draw-benchmark.ts +0 -1042
- package/src/benchmark/colormatrix-benchmark.ts +0 -123
- package/src/benchmark/gain-benchmark.ts +0 -80
- package/src/benchmark/latest-all-bench-run.json +0 -707
- package/src/benchmark/latest-async-bench-run.json +0 -336
- package/src/benchmark/latest-default-bench-run.json +0 -657
- package/src/benchmark/latest-large-bench-run.json +0 -707
- package/src/benchmark/latest-quick-bench-run.json +0 -207
- package/src/benchmark/layout-benchmark.ts +0 -2547
- package/src/benchmark/markdown-benchmark.ts +0 -1796
- package/src/benchmark/native-span-feed-async-benchmark.ts +0 -355
- package/src/benchmark/native-span-feed-benchmark.md +0 -56
- package/src/benchmark/native-span-feed-benchmark.ts +0 -596
- package/src/benchmark/native-span-feed-compare.ts +0 -280
- package/src/benchmark/render-traversal-benchmark.ts +0 -928
- package/src/benchmark/text-buffer-render-benchmark.ts +0 -874
- package/src/benchmark/text-table-benchmark.ts +0 -948
- package/src/buffer.test.ts +0 -292
- package/src/buffer.ts +0 -564
- package/src/console.test.ts +0 -629
- package/src/console.ts +0 -1253
- package/src/edit-buffer.test.ts +0 -1852
- package/src/edit-buffer.ts +0 -417
- package/src/editor-view.test.ts +0 -1056
- package/src/editor-view.ts +0 -290
- package/src/index.ts +0 -25
- package/src/lib/KeyHandler.integration.test.ts +0 -292
- package/src/lib/KeyHandler.stopPropagation.test.ts +0 -289
- package/src/lib/KeyHandler.test.ts +0 -662
- package/src/lib/KeyHandler.ts +0 -222
- package/src/lib/RGBA.test.ts +0 -60
- package/src/lib/RGBA.ts +0 -343
- package/src/lib/ascii.font.ts +0 -330
- package/src/lib/border.test.ts +0 -83
- package/src/lib/border.ts +0 -170
- package/src/lib/bunfs.test.ts +0 -27
- package/src/lib/bunfs.ts +0 -18
- package/src/lib/clipboard.test.ts +0 -63
- package/src/lib/clipboard.ts +0 -41
- package/src/lib/clock.ts +0 -35
- package/src/lib/data-paths.test.ts +0 -133
- package/src/lib/data-paths.ts +0 -109
- package/src/lib/debounce.ts +0 -106
- package/src/lib/detect-links.test.ts +0 -98
- package/src/lib/detect-links.ts +0 -56
- package/src/lib/env.test.ts +0 -228
- package/src/lib/env.ts +0 -209
- package/src/lib/extmarks-history.ts +0 -51
- package/src/lib/extmarks-multiwidth.test.ts +0 -324
- package/src/lib/extmarks.test.ts +0 -3547
- package/src/lib/extmarks.ts +0 -861
- package/src/lib/fonts/block.json +0 -405
- package/src/lib/fonts/grid.json +0 -265
- package/src/lib/fonts/huge.json +0 -741
- package/src/lib/fonts/pallet.json +0 -314
- package/src/lib/fonts/shade.json +0 -591
- package/src/lib/fonts/slick.json +0 -321
- package/src/lib/fonts/tiny.json +0 -69
- package/src/lib/hast-styled-text.ts +0 -59
- package/src/lib/index.ts +0 -22
- package/src/lib/keybinding.internal.test.ts +0 -342
- package/src/lib/keybinding.internal.ts +0 -182
- package/src/lib/objects-in-viewport.test.ts +0 -789
- package/src/lib/objects-in-viewport.ts +0 -153
- package/src/lib/output.capture.ts +0 -58
- package/src/lib/parse.keypress-kitty.protocol.test.ts +0 -347
- package/src/lib/parse.keypress-kitty.test.ts +0 -712
- package/src/lib/parse.keypress-kitty.ts +0 -470
- package/src/lib/parse.keypress.test.ts +0 -2020
- package/src/lib/parse.keypress.ts +0 -480
- package/src/lib/parse.mouse.test.ts +0 -552
- package/src/lib/parse.mouse.ts +0 -232
- package/src/lib/paste.ts +0 -18
- package/src/lib/queue.ts +0 -65
- package/src/lib/render-geometry.ts +0 -36
- package/src/lib/renderable.validations.test.ts +0 -87
- package/src/lib/renderable.validations.ts +0 -83
- package/src/lib/scroll-acceleration.ts +0 -98
- package/src/lib/selection.ts +0 -261
- package/src/lib/singleton.ts +0 -34
- package/src/lib/stdin-parser.test.ts +0 -2439
- package/src/lib/stdin-parser.ts +0 -2007
- package/src/lib/styled-text.ts +0 -178
- package/src/lib/terminal-capability-detection.test.ts +0 -226
- package/src/lib/terminal-capability-detection.ts +0 -98
- package/src/lib/terminal-palette.test.ts +0 -954
- package/src/lib/terminal-palette.ts +0 -441
- package/src/lib/tree-sitter/assets/README.md +0 -119
- package/src/lib/tree-sitter/assets/update.ts +0 -360
- package/src/lib/tree-sitter/assets.d.ts +0 -9
- package/src/lib/tree-sitter/cache.test.ts +0 -291
- package/src/lib/tree-sitter/client.test.ts +0 -1434
- package/src/lib/tree-sitter/client.ts +0 -847
- package/src/lib/tree-sitter/default-parsers.ts +0 -133
- package/src/lib/tree-sitter/download-utils.ts +0 -148
- package/src/lib/tree-sitter/index.ts +0 -75
- package/src/lib/tree-sitter/parser.worker.ts +0 -1098
- package/src/lib/tree-sitter/parsers-config.ts +0 -81
- package/src/lib/tree-sitter/resolve-ft.test.ts +0 -55
- package/src/lib/tree-sitter/resolve-ft.ts +0 -189
- package/src/lib/tree-sitter/types.ts +0 -132
- package/src/lib/tree-sitter/update-assets.ts +0 -10
- package/src/lib/tree-sitter-styled-text.test.ts +0 -1253
- package/src/lib/tree-sitter-styled-text.ts +0 -314
- package/src/lib/validate-dir-name.ts +0 -55
- package/src/lib/yoga.options.test.ts +0 -628
- package/src/lib/yoga.options.ts +0 -346
- package/src/native-event-worker-repro.test.ts +0 -48
- package/src/native-event-worker-repro.worker.ts +0 -9
- package/src/native-handle.test.ts +0 -221
- package/src/platform/ffi.test.ts +0 -516
- package/src/platform/ffi.ts +0 -653
- package/src/platform/runtime.test.ts +0 -52
- package/src/platform/runtime.ts +0 -121
- package/src/platform/test.ts +0 -45
- package/src/platform/worker-handler-cleanup.fixture.ts +0 -12
- package/src/platform/worker-onmessage-startup.fixture.ts +0 -10
- package/src/platform/worker-startup.fixture.ts +0 -9
- package/src/platform/worker.node-test.ts +0 -153
- package/src/platform/worker.ts +0 -425
- package/src/plugins/core-slot.ts +0 -579
- package/src/plugins/registry.ts +0 -402
- package/src/plugins/types.ts +0 -46
- package/src/post/effects.ts +0 -948
- package/src/post/filters.ts +0 -512
- package/src/post/matrices.ts +0 -288
- package/src/renderables/ASCIIFont.ts +0 -219
- package/src/renderables/Box.test.ts +0 -474
- package/src/renderables/Box.ts +0 -353
- package/src/renderables/Code.test.ts +0 -2388
- package/src/renderables/Code.ts +0 -555
- package/src/renderables/Diff.regression.test.ts +0 -381
- package/src/renderables/Diff.test.ts +0 -3212
- package/src/renderables/Diff.ts +0 -1278
- package/src/renderables/EditBufferRenderable.test.ts +0 -288
- package/src/renderables/EditBufferRenderable.ts +0 -1152
- package/src/renderables/FrameBuffer.ts +0 -47
- package/src/renderables/Input.test.ts +0 -1310
- package/src/renderables/Input.ts +0 -273
- package/src/renderables/LineNumberRenderable.ts +0 -725
- package/src/renderables/Markdown.ts +0 -2144
- package/src/renderables/ScrollBar.ts +0 -423
- package/src/renderables/ScrollBox.ts +0 -903
- package/src/renderables/Select.test.ts +0 -1134
- package/src/renderables/Select.ts +0 -535
- package/src/renderables/Slider.test.ts +0 -456
- package/src/renderables/Slider.ts +0 -342
- package/src/renderables/TabSelect.test.ts +0 -238
- package/src/renderables/TabSelect.ts +0 -447
- package/src/renderables/Text.selection-buffer.test.ts +0 -118
- package/src/renderables/Text.test.ts +0 -2662
- package/src/renderables/Text.ts +0 -147
- package/src/renderables/TextBufferRenderable.ts +0 -504
- package/src/renderables/TextNode.test.ts +0 -1137
- package/src/renderables/TextNode.ts +0 -379
- package/src/renderables/TextTable.test.ts +0 -1411
- package/src/renderables/TextTable.ts +0 -1434
- package/src/renderables/Textarea.ts +0 -425
- package/src/renderables/TimeToFirstDraw.ts +0 -89
- package/src/renderables/__snapshots__/Code.test.ts.snap +0 -13
- package/src/renderables/__snapshots__/Diff.test.ts.snap +0 -785
- package/src/renderables/__snapshots__/Text.test.ts.snap +0 -421
- package/src/renderables/__snapshots__/TextTable.test.ts.snap +0 -215
- package/src/renderables/__tests__/Code.test.ts +0 -55
- package/src/renderables/__tests__/LineNumberRenderable.scrollbox-simple.test.ts +0 -144
- package/src/renderables/__tests__/LineNumberRenderable.scrollbox.test.ts +0 -827
- package/src/renderables/__tests__/LineNumberRenderable.test.ts +0 -1906
- package/src/renderables/__tests__/LineNumberRenderable.wrapping.test.ts +0 -85
- package/src/renderables/__tests__/Markdown.code-colors.test.ts +0 -288
- package/src/renderables/__tests__/Markdown.test.ts +0 -4175
- package/src/renderables/__tests__/MultiRenderable.selection.test.ts +0 -87
- package/src/renderables/__tests__/Textarea.buffer.test.ts +0 -683
- package/src/renderables/__tests__/Textarea.destroyed-events.test.ts +0 -675
- package/src/renderables/__tests__/Textarea.editing.test.ts +0 -2120
- package/src/renderables/__tests__/Textarea.error-handling.test.ts +0 -35
- package/src/renderables/__tests__/Textarea.events.test.ts +0 -738
- package/src/renderables/__tests__/Textarea.highlights.test.ts +0 -590
- package/src/renderables/__tests__/Textarea.keybinding.test.ts +0 -3275
- package/src/renderables/__tests__/Textarea.paste.test.ts +0 -357
- package/src/renderables/__tests__/Textarea.rendering.test.ts +0 -1927
- package/src/renderables/__tests__/Textarea.scroll.test.ts +0 -733
- package/src/renderables/__tests__/Textarea.selection.test.ts +0 -1589
- package/src/renderables/__tests__/Textarea.stress.test.ts +0 -670
- package/src/renderables/__tests__/Textarea.undo-redo.test.ts +0 -383
- package/src/renderables/__tests__/Textarea.visual-lines.test.ts +0 -310
- package/src/renderables/__tests__/__snapshots__/LineNumberRenderable.code.test.ts.snap +0 -221
- package/src/renderables/__tests__/__snapshots__/LineNumberRenderable.scrollbox-simple.test.ts.snap +0 -89
- package/src/renderables/__tests__/__snapshots__/LineNumberRenderable.scrollbox.test.ts.snap +0 -457
- package/src/renderables/__tests__/__snapshots__/LineNumberRenderable.test.ts.snap +0 -158
- package/src/renderables/__tests__/__snapshots__/Textarea.rendering.test.ts.snap +0 -387
- package/src/renderables/__tests__/markdown-parser.test.ts +0 -241
- package/src/renderables/__tests__/renderable-test-utils.ts +0 -60
- package/src/renderables/composition/README.md +0 -8
- package/src/renderables/composition/VRenderable.ts +0 -32
- package/src/renderables/composition/constructs.ts +0 -127
- package/src/renderables/composition/vnode.ts +0 -277
- package/src/renderables/index.ts +0 -23
- package/src/renderables/markdown-parser.ts +0 -79
- package/src/renderer-theme-mode.ts +0 -199
- package/src/renderer.ts +0 -4975
- package/src/runtime-plugin-support-configure.ts +0 -63
- package/src/runtime-plugin-support.ts +0 -13
- package/src/runtime-plugin.ts +0 -626
- package/src/specs/terminal-startup.md +0 -64
- package/src/syntax-style.test.ts +0 -841
- package/src/syntax-style.ts +0 -274
- package/src/testing/README.md +0 -219
- package/src/testing/bun-test-node.ts +0 -880
- package/src/testing/capture-spans.test.ts +0 -216
- package/src/testing/integration.test.ts +0 -276
- package/src/testing/manual-clock.ts +0 -117
- package/src/testing/mock-keys.test.ts +0 -1378
- package/src/testing/mock-keys.ts +0 -457
- package/src/testing/mock-mouse.test.ts +0 -218
- package/src/testing/mock-mouse.ts +0 -247
- package/src/testing/mock-tree-sitter-client.ts +0 -81
- package/src/testing/spy.ts +0 -13
- package/src/testing/terminal-capabilities.ts +0 -47
- package/src/testing/test-recorder.test.ts +0 -410
- package/src/testing/test-recorder.ts +0 -133
- package/src/testing/test-renderer.ts +0 -375
- package/src/testing/test-renderer.wait.test.ts +0 -278
- package/src/testing/test-streams.ts +0 -31
- package/src/testing.ts +0 -9
- package/src/tests/__snapshots__/absolute-positioning.snapshot.test.ts.snap +0 -481
- package/src/tests/__snapshots__/renderable.snapshot.test.ts.snap +0 -19
- package/src/tests/__snapshots__/scrollbox.test.ts.snap +0 -29
- package/src/tests/absolute-positioning.snapshot.test.ts +0 -638
- package/src/tests/allocator-stats.test.ts +0 -53
- package/src/tests/audio.test.ts +0 -303
- package/src/tests/destroy-during-render.test.ts +0 -200
- package/src/tests/destroy-on-exit.fixture.ts +0 -36
- package/src/tests/destroy-on-exit.test.ts +0 -62
- package/src/tests/ffi-borrowed-pointer-callsites.test.ts +0 -153
- package/src/tests/hover-cursor.test.ts +0 -98
- package/src/tests/native-backed-measurement-lifecycle.test.ts +0 -133
- package/src/tests/native-backed-measurement-parity.test.ts +0 -322
- package/src/tests/native-span-feed-async.test.ts +0 -173
- package/src/tests/native-span-feed-close.test.ts +0 -120
- package/src/tests/native-span-feed-coverage.test.ts +0 -227
- package/src/tests/native-span-feed-edge-cases.test.ts +0 -384
- package/src/tests/native-span-feed-use-after-free.test.ts +0 -45
- package/src/tests/opacity.test.ts +0 -123
- package/src/tests/renderable.snapshot.test.ts +0 -524
- package/src/tests/renderable.test.ts +0 -1851
- package/src/tests/renderer.clock.test.ts +0 -270
- package/src/tests/renderer.console-startup.test.ts +0 -2151
- package/src/tests/renderer.control.test.ts +0 -458
- package/src/tests/renderer.core-slot-binding.test.ts +0 -962
- package/src/tests/renderer.cursor.test.ts +0 -26
- package/src/tests/renderer.custom-stdout.test.ts +0 -1112
- package/src/tests/renderer.destroy-during-render.test.ts +0 -147
- package/src/tests/renderer.focus-restore.test.ts +0 -257
- package/src/tests/renderer.focus.test.ts +0 -329
- package/src/tests/renderer.idle.test.ts +0 -219
- package/src/tests/renderer.input.test.ts +0 -2615
- package/src/tests/renderer.kitty-flags.test.ts +0 -195
- package/src/tests/renderer.lifecycle.test.ts +0 -34
- package/src/tests/renderer.mouse.test.ts +0 -1315
- package/src/tests/renderer.notifications.test.ts +0 -27
- package/src/tests/renderer.palette.test.ts +0 -1199
- package/src/tests/renderer.remote.test.ts +0 -247
- package/src/tests/renderer.render-stats.test.ts +0 -146
- package/src/tests/renderer.scrollback-surface.test.ts +0 -474
- package/src/tests/renderer.selection.test.ts +0 -138
- package/src/tests/renderer.slot-registry.test.ts +0 -684
- package/src/tests/renderer.tracker.test.ts +0 -202
- package/src/tests/renderer.useMouse.test.ts +0 -83
- package/src/tests/runtime-plugin-node-modules-cycle.fixture.ts +0 -76
- package/src/tests/runtime-plugin-node-modules-import-like-string.fixture.ts +0 -48
- package/src/tests/runtime-plugin-node-modules-mjs.fixture.ts +0 -43
- package/src/tests/runtime-plugin-node-modules-no-bare-rewrite.fixture.ts +0 -67
- package/src/tests/runtime-plugin-node-modules-package-type-cache.fixture.ts +0 -72
- package/src/tests/runtime-plugin-node-modules-runtime-specifier.fixture.ts +0 -44
- package/src/tests/runtime-plugin-node-modules-scoped-package-bare-rewrite.fixture.ts +0 -85
- package/src/tests/runtime-plugin-path-alias.fixture.ts +0 -43
- package/src/tests/runtime-plugin-resolve-roots.fixture.ts +0 -65
- package/src/tests/runtime-plugin-support-configure.fixture.ts +0 -31
- package/src/tests/runtime-plugin-support-late-addition.fixture.ts +0 -17
- package/src/tests/runtime-plugin-support.fixture.ts +0 -11
- package/src/tests/runtime-plugin-support.test.ts +0 -54
- package/src/tests/runtime-plugin-windows-file-url.fixture.ts +0 -30
- package/src/tests/runtime-plugin.fixture.ts +0 -40
- package/src/tests/runtime-plugin.test.ts +0 -369
- package/src/tests/scrollbox-culling-bug.test.ts +0 -114
- package/src/tests/scrollbox-hitgrid-resize.test.ts +0 -136
- package/src/tests/scrollbox-hitgrid.test.ts +0 -909
- package/src/tests/scrollbox.test.ts +0 -1895
- package/src/tests/wrap-resize-perf.test.ts +0 -276
- package/src/tests/yoga-api-coverage.test.ts +0 -409
- package/src/tests/yoga-callback-stress.test.ts +0 -122
- package/src/tests/yoga-ffi.test.ts +0 -117
- package/src/tests/yoga-setters.test.ts +0 -921
- package/src/tests/yoga-upstream/YGAlignBaselineTest.test.ts +0 -124
- package/src/tests/yoga-upstream/YGComputedBorderTest.test.ts +0 -27
- package/src/tests/yoga-upstream/YGComputedMarginTest.test.ts +0 -27
- package/src/tests/yoga-upstream/YGComputedPaddingTest.test.ts +0 -27
- package/src/tests/yoga-upstream/YGDirtiedTest.test.ts +0 -157
- package/src/tests/yoga-upstream/YGErrataTest.test.ts +0 -40
- package/src/tests/yoga-upstream/YGFlexBasisAuto.test.ts +0 -23
- package/src/tests/yoga-upstream/YGHasNewLayout.test.ts +0 -81
- package/src/tests/yoga-upstream/YGMeasureCacheTest.test.ts +0 -31
- package/src/tests/yoga-upstream/YGMeasureTest.test.ts +0 -70
- package/src/tests/yoga-upstream/generated/YGAbsolutePositionTest.test.ts +0 -1864
- package/src/tests/yoga-upstream/generated/YGAlignContentTest.test.ts +0 -5829
- package/src/tests/yoga-upstream/generated/YGAlignItemsTest.test.ts +0 -2444
- package/src/tests/yoga-upstream/generated/YGAlignSelfTest.test.ts +0 -293
- package/src/tests/yoga-upstream/generated/YGAndroidNewsFeed.test.ts +0 -315
- package/src/tests/yoga-upstream/generated/YGAspectRatioTest.test.ts +0 -231
- package/src/tests/yoga-upstream/generated/YGAutoTest.test.ts +0 -347
- package/src/tests/yoga-upstream/generated/YGBorderTest.test.ts +0 -256
- package/src/tests/yoga-upstream/generated/YGBoxSizingTest.test.ts +0 -2747
- package/src/tests/yoga-upstream/generated/YGDimensionTest.test.ts +0 -129
- package/src/tests/yoga-upstream/generated/YGDisplayContentsTest.test.ts +0 -109
- package/src/tests/yoga-upstream/generated/YGDisplayTest.test.ts +0 -1097
- package/src/tests/yoga-upstream/generated/YGFlexDirectionTest.test.ts +0 -4562
- package/src/tests/yoga-upstream/generated/YGFlexTest.test.ts +0 -677
- package/src/tests/yoga-upstream/generated/YGFlexWrapTest.test.ts +0 -2071
- package/src/tests/yoga-upstream/generated/YGGapTest.test.ts +0 -3303
- package/src/tests/yoga-upstream/generated/YGIntrinsicSizeTest.test.ts +0 -582
- package/src/tests/yoga-upstream/generated/YGJustifyContentTest.test.ts +0 -2150
- package/src/tests/yoga-upstream/generated/YGMarginTest.test.ts +0 -1963
- package/src/tests/yoga-upstream/generated/YGMinMaxDimensionTest.test.ts +0 -1446
- package/src/tests/yoga-upstream/generated/YGPaddingTest.test.ts +0 -354
- package/src/tests/yoga-upstream/generated/YGPercentageTest.test.ts +0 -1760
- package/src/tests/yoga-upstream/generated/YGRoundingTest.test.ts +0 -1161
- package/src/tests/yoga-upstream/generated/YGSizeOverflowTest.test.ts +0 -207
- package/src/tests/yoga-upstream/generated/YGStaticPositionTest.test.ts +0 -6338
- package/src/tests/yoga-upstream/tools/MeasureCounter.ts +0 -54
- package/src/tests/yoga-upstream/tools/utils.ts +0 -81
- package/src/text-buffer-view.test.ts +0 -722
- package/src/text-buffer-view.ts +0 -193
- package/src/text-buffer.test.ts +0 -512
- package/src/text-buffer.ts +0 -250
- package/src/types.ts +0 -199
- package/src/utils.ts +0 -88
- package/src/yoga.ts +0 -1146
- package/src/zig/ansi.zig +0 -502
- package/src/zig/audio.zig +0 -1206
- package/src/zig/bench/README.md +0 -50
- package/src/zig/bench/buffer-color-blending_bench.zig +0 -350
- package/src/zig/bench/buffer-draw-box_bench.zig +0 -786
- package/src/zig/bench/buffer-draw-text-buffer_bench.zig +0 -894
- package/src/zig/bench/edit-buffer_bench.zig +0 -476
- package/src/zig/bench/editor-view_bench.zig +0 -169
- package/src/zig/bench/native-span-feed_bench.zig +0 -107
- package/src/zig/bench/rope-markers_bench.zig +0 -713
- package/src/zig/bench/rope_bench.zig +0 -514
- package/src/zig/bench/styled-text_bench.zig +0 -476
- package/src/zig/bench/text-buffer-coords_bench.zig +0 -362
- package/src/zig/bench/text-buffer-view_bench.zig +0 -459
- package/src/zig/bench/text-chunk-graphemes_bench.zig +0 -272
- package/src/zig/bench/utf8_bench.zig +0 -799
- package/src/zig/bench-utils.zig +0 -431
- package/src/zig/bench.zig +0 -223
- package/src/zig/buffer-methods.zig +0 -215
- package/src/zig/buffer.zig +0 -2515
- package/src/zig/build.zig +0 -700
- package/src/zig/build.zig.zon +0 -19
- package/src/zig/edit-buffer.zig +0 -900
- package/src/zig/editor-view.zig +0 -812
- package/src/zig/event-bus.zig +0 -28
- package/src/zig/event-emitter.zig +0 -65
- package/src/zig/file-logger.zig +0 -92
- package/src/zig/grapheme.zig +0 -838
- package/src/zig/handles.zig +0 -267
- package/src/zig/lib.zig +0 -2813
- package/src/zig/link.zig +0 -349
- package/src/zig/logger.zig +0 -43
- package/src/zig/mem-registry.zig +0 -126
- package/src/zig/miniaudio_shim.c +0 -21
- package/src/zig/native-renderable.zig +0 -112
- package/src/zig/native-span-feed-bench-lib.zig +0 -7
- package/src/zig/native-span-feed.zig +0 -747
- package/src/zig/renderer-output.zig +0 -677
- package/src/zig/renderer.zig +0 -2106
- package/src/zig/rope.zig +0 -1220
- package/src/zig/split-scrollback.zig +0 -88
- package/src/zig/syntax-style.zig +0 -174
- package/src/zig/terminal.zig +0 -1652
- package/src/zig/test.zig +0 -82
- package/src/zig/tests/README.md +0 -18
- package/src/zig/tests/ansi_test.zig +0 -18
- package/src/zig/tests/audio_test.zig +0 -439
- package/src/zig/tests/buffer-methods_test.zig +0 -1111
- package/src/zig/tests/buffer_test.zig +0 -2926
- package/src/zig/tests/edit-buffer-history_test.zig +0 -299
- package/src/zig/tests/edit-buffer_test.zig +0 -1688
- package/src/zig/tests/editor-view_test.zig +0 -3454
- package/src/zig/tests/event-emitter_test.zig +0 -249
- package/src/zig/tests/grapheme_test.zig +0 -1329
- package/src/zig/tests/handles_test.zig +0 -123
- package/src/zig/tests/link_test.zig +0 -220
- package/src/zig/tests/mem-registry_test.zig +0 -473
- package/src/zig/tests/memory_leak_regression_test.zig +0 -234
- package/src/zig/tests/native-renderable_test.zig +0 -16
- package/src/zig/tests/native-span-feed_test.zig +0 -1266
- package/src/zig/tests/renderer_test.zig +0 -2604
- package/src/zig/tests/rope-nested_test.zig +0 -712
- package/src/zig/tests/rope_fuzz_test.zig +0 -238
- package/src/zig/tests/rope_test.zig +0 -2362
- package/src/zig/tests/segment-merge.test.zig +0 -148
- package/src/zig/tests/split-scrollback_test.zig +0 -70
- package/src/zig/tests/syntax-style_test.zig +0 -558
- package/src/zig/tests/terminal_test.zig +0 -1489
- package/src/zig/tests/test-renderer.zig +0 -126
- package/src/zig/tests/text-buffer-drawing_test.zig +0 -3291
- package/src/zig/tests/text-buffer-highlights_test.zig +0 -706
- package/src/zig/tests/text-buffer-iterators_test.zig +0 -776
- package/src/zig/tests/text-buffer-segment_test.zig +0 -320
- package/src/zig/tests/text-buffer-selection_test.zig +0 -1056
- package/src/zig/tests/text-buffer-selection_viewport_test.zig +0 -358
- package/src/zig/tests/text-buffer-view_test.zig +0 -3672
- package/src/zig/tests/text-buffer_test.zig +0 -2191
- package/src/zig/tests/unicode-width-map.zon +0 -3909
- package/src/zig/tests/utf8_no_zwj_test.zig +0 -260
- package/src/zig/tests/utf8_test.zig +0 -4060
- package/src/zig/tests/utf8_wcwidth_cursor_test.zig +0 -267
- package/src/zig/tests/utf8_wcwidth_test.zig +0 -357
- package/src/zig/tests/word-wrap-editing_test.zig +0 -498
- package/src/zig/tests/wrap-cache-perf_test.zig +0 -113
- package/src/zig/tests/yoga_test.zig +0 -65
- package/src/zig/text-buffer-iterators.zig +0 -496
- package/src/zig/text-buffer-segment.zig +0 -403
- package/src/zig/text-buffer-view.zig +0 -1428
- package/src/zig/text-buffer.zig +0 -1272
- package/src/zig/utf8.zig +0 -1954
- package/src/zig/utils.zig +0 -12
- package/src/zig/uucode-stub.zig +0 -76
- package/src/zig/vendor/miniaudio/miniaudio.h +0 -93468
- package/src/zig/yoga.zig +0 -658
- package/src/zig-structs.ts +0 -381
- package/src/zig.ts +0 -5260
- package/tsconfig.build.json +0 -17
- package/tsconfig.json +0 -27
- package/tsconfig.node-test.json +0 -138
- /package/{src/lib/tree-sitter/assets → assets}/javascript/highlights.scm +0 -0
- /package/{src/lib/tree-sitter/assets → assets}/javascript/tree-sitter-javascript.wasm +0 -0
- /package/{src/lib/tree-sitter/assets → assets}/markdown/highlights.scm +0 -0
- /package/{src/lib/tree-sitter/assets → assets}/markdown/injections.scm +0 -0
- /package/{src/lib/tree-sitter/assets → assets}/markdown/tree-sitter-markdown.wasm +0 -0
- /package/{src/lib/tree-sitter/assets → assets}/markdown_inline/highlights.scm +0 -0
- /package/{src/lib/tree-sitter/assets → assets}/markdown_inline/tree-sitter-markdown_inline.wasm +0 -0
- /package/{src/lib/tree-sitter/assets → assets}/typescript/highlights.scm +0 -0
- /package/{src/lib/tree-sitter/assets → assets}/typescript/tree-sitter-typescript.wasm +0 -0
- /package/{src/lib/tree-sitter/assets → assets}/zig/highlights.scm +0 -0
- /package/{src/lib/tree-sitter/assets → assets}/zig/tree-sitter-zig.wasm +0 -0
package/docs/development.md
DELETED
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
# Development Guide
|
|
2
|
-
|
|
3
|
-
## Prerequisites
|
|
4
|
-
|
|
5
|
-
- [Bun](https://bun.sh) - JavaScript runtime and package manager
|
|
6
|
-
- [Zig](https://ziglang.org/learn/getting-started/) - Required for building native modules
|
|
7
|
-
|
|
8
|
-
## Setup
|
|
9
|
-
|
|
10
|
-
```bash
|
|
11
|
-
git clone https://github.com/anomalyco/opentui.git
|
|
12
|
-
cd opentui
|
|
13
|
-
bun install
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
## Building
|
|
17
|
-
|
|
18
|
-
```bash
|
|
19
|
-
bun run build
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
**Note:** Only needed when changing native Zig code. TypeScript changes don't require rebuilding.
|
|
23
|
-
|
|
24
|
-
## Running Examples
|
|
25
|
-
|
|
26
|
-
```bash
|
|
27
|
-
cd packages/examples
|
|
28
|
-
bun run dev
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
## Testing
|
|
32
|
-
|
|
33
|
-
```bash
|
|
34
|
-
# Build native dependencies first
|
|
35
|
-
bun run build
|
|
36
|
-
|
|
37
|
-
# TypeScript tests
|
|
38
|
-
cd packages/core
|
|
39
|
-
bun test
|
|
40
|
-
|
|
41
|
-
# Native tests
|
|
42
|
-
bun run test:native
|
|
43
|
-
|
|
44
|
-
# Filter native tests
|
|
45
|
-
bun run test:native -Dtest-filter="test name"
|
|
46
|
-
|
|
47
|
-
# Benchmarks
|
|
48
|
-
bun run bench:native
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
## Local Development Linking
|
|
52
|
-
|
|
53
|
-
Link your local OpenTUI to another project:
|
|
54
|
-
|
|
55
|
-
```bash
|
|
56
|
-
./scripts/link-opentui-dev.sh /path/to/your/project
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
**Options:**
|
|
60
|
-
|
|
61
|
-
- `--react` - Also link `@opentui/react` and React dependencies
|
|
62
|
-
- `--solid` - Also link `@opentui/solid` and SolidJS dependencies
|
|
63
|
-
- `--dist` - Link built `dist` directories instead of source
|
|
64
|
-
- `--copy` - Copy instead of symlink (requires `--dist`)
|
|
65
|
-
- `--subdeps` - Find and link packages that depend on opentui (e.g., `opentui-spinner`)
|
|
66
|
-
|
|
67
|
-
**Examples:**
|
|
68
|
-
|
|
69
|
-
```bash
|
|
70
|
-
# Link core only
|
|
71
|
-
./scripts/link-opentui-dev.sh /path/to/your/project
|
|
72
|
-
|
|
73
|
-
# Link core and solid with subdependency discovery
|
|
74
|
-
./scripts/link-opentui-dev.sh /path/to/your/project --solid --subdeps
|
|
75
|
-
|
|
76
|
-
# Link built artifacts
|
|
77
|
-
./scripts/link-opentui-dev.sh /path/to/your/project --react --dist
|
|
78
|
-
|
|
79
|
-
# Copy for Docker/Windows
|
|
80
|
-
./scripts/link-opentui-dev.sh /path/to/your/project --dist --copy
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
The script automatically links:
|
|
84
|
-
|
|
85
|
-
- Main packages: `@opentui/core`, `@opentui/solid`, `@opentui/react`
|
|
86
|
-
- Peer dependencies: `solid-js`, `react`, `react-dom`, `react-reconciler`
|
|
87
|
-
- Subdependencies (with `--subdeps`): Packages like `opentui-spinner` that depend on opentui
|
|
88
|
-
|
|
89
|
-
**Requirements:** Target project must have `node_modules` (run `bun install` first).
|
|
90
|
-
|
|
91
|
-
## Debugging
|
|
92
|
-
|
|
93
|
-
OpenTUI captures `console.log` output. Toggle the built-in console with backtick or use [Environment Variables](./env-vars.md) for debugging.
|
|
94
|
-
|
|
95
|
-
## Terminal Compatibility
|
|
96
|
-
|
|
97
|
-
### OSC 66 Artifacts on Older Terminals
|
|
98
|
-
|
|
99
|
-
**Problem:** If you see weird artifacts containing "66" in your terminal when running OpenTUI applications, your terminal emulator doesn't support OSC 66 escape sequences (used for explicit character width detection).
|
|
100
|
-
|
|
101
|
-
**Affected Terminals:**
|
|
102
|
-
|
|
103
|
-
- GNOME Terminal
|
|
104
|
-
- Konsole (older versions)
|
|
105
|
-
- xterm (older versions)
|
|
106
|
-
- Many VT100/VT220 emulators
|
|
107
|
-
|
|
108
|
-
**Solution:** Disable OSC 66 queries by setting an environment variable:
|
|
109
|
-
|
|
110
|
-
```bash
|
|
111
|
-
export OPENTUI_FORCE_EXPLICIT_WIDTH=false
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
Or run your application with:
|
|
115
|
-
|
|
116
|
-
```bash
|
|
117
|
-
OPENTUI_FORCE_EXPLICIT_WIDTH=false your-app
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
**For Application Developers:**
|
|
121
|
-
|
|
122
|
-
Set it in your code before creating the renderer:
|
|
123
|
-
|
|
124
|
-
```typescript
|
|
125
|
-
process.env.OPENTUI_FORCE_EXPLICIT_WIDTH = "false"
|
|
126
|
-
|
|
127
|
-
const renderer = new CliRenderer()
|
|
128
|
-
// ... rest of your app
|
|
129
|
-
```
|
|
130
|
-
|
|
131
|
-
Or add to your `.env` file:
|
|
132
|
-
|
|
133
|
-
```bash
|
|
134
|
-
OPENTUI_FORCE_EXPLICIT_WIDTH=false
|
|
135
|
-
```
|
|
136
|
-
|
|
137
|
-
**What This Does:**
|
|
138
|
-
|
|
139
|
-
- Prevents OSC 66 detection queries from being sent
|
|
140
|
-
- Disables the explicit width feature
|
|
141
|
-
- Falls back to standard width calculation
|
|
142
|
-
- No visual artifacts on unsupported terminals
|
|
143
|
-
|
|
144
|
-
**Modern Terminals:** If your terminal supports OSC 66 (Kitty, Ghostty, WezTerm, Alacritty, iTerm2), you don't need this setting - they work correctly by default.
|
|
Binary file
|
package/scripts/build-android.ts
DELETED
|
@@ -1,226 +0,0 @@
|
|
|
1
|
-
// build-android.ts — Cross-compile opentui native core for Android/Termux.
|
|
2
|
-
//
|
|
3
|
-
// Invokes Zig with the Android NDK sysroot so the resulting .so links
|
|
4
|
-
// against Bionic libc (not glibc/musl). The NDK must be installed and
|
|
5
|
-
// ANDROID_NDK_HOME must point at it.
|
|
6
|
-
//
|
|
7
|
-
// Produces three .so files:
|
|
8
|
-
// aarch64-android/libopentui.so → @xincli/opentui-core-android-arm64
|
|
9
|
-
// arm-android/libopentui.so → @xincli/opentui-core-android-arm
|
|
10
|
-
// x86_64-android/libopentui.so → @xincli/opentui-core-android-x64
|
|
11
|
-
//
|
|
12
|
-
// Each gets packaged into its own npm subdirectory under dist-android/.
|
|
13
|
-
|
|
14
|
-
import { spawnSync, type SpawnSyncReturns } from "node:child_process"
|
|
15
|
-
import { copyFileSync, existsSync, mkdirSync, readFileSync, writeFileSync } from "fs"
|
|
16
|
-
import { dirname, join, resolve } from "path"
|
|
17
|
-
import { fileURLToPath } from "url"
|
|
18
|
-
|
|
19
|
-
const __filename = fileURLToPath(import.meta.url)
|
|
20
|
-
const __dirname = dirname(__filename)
|
|
21
|
-
const rootDir = resolve(__dirname, "..")
|
|
22
|
-
|
|
23
|
-
const NDK_HOME = process.env.ANDROID_NDK_HOME ?? process.env.ANDROID_NDK_ROOT
|
|
24
|
-
if (!NDK_HOME) {
|
|
25
|
-
console.error("Error: ANDROID_NDK_HOME (or ANDROID_NDK_ROOT) must be set")
|
|
26
|
-
console.error("Install the NDK and export ANDROID_NDK_HOME=/path/to/ndk")
|
|
27
|
-
process.exit(1)
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
const ZIG_VERSION = "0.15.2"
|
|
31
|
-
const NDK_API_LEVEL = process.env.ANDROID_API_LEVEL ?? "24" // Android 7.0+ — covers 99% of Termux users
|
|
32
|
-
|
|
33
|
-
type AndroidArch = {
|
|
34
|
-
zigArch: string
|
|
35
|
-
ndkTriple: string
|
|
36
|
-
outputName: string
|
|
37
|
-
packageName: string
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
const ANDROID_ARCHES: AndroidArch[] = [
|
|
41
|
-
{
|
|
42
|
-
zigArch: "aarch64",
|
|
43
|
-
ndkTriple: "aarch64-linux-android",
|
|
44
|
-
outputName: "aarch64-android",
|
|
45
|
-
packageName: "@xincli/opentui-core-android-arm64",
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
zigArch: "arm",
|
|
49
|
-
ndkTriple: "armv7a-linux-androideabi",
|
|
50
|
-
outputName: "arm-android",
|
|
51
|
-
packageName: "@xincli/opentui-core-android-arm",
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
zigArch: "x86_64",
|
|
55
|
-
ndkTriple: "x86_64-linux-android",
|
|
56
|
-
outputName: "x86_64-android",
|
|
57
|
-
packageName: "@xincli/opentui-core-android-x64",
|
|
58
|
-
},
|
|
59
|
-
]
|
|
60
|
-
|
|
61
|
-
function run(cmd: string, args: string[], cwd: string, label: string): void {
|
|
62
|
-
console.log(`▶ ${label}`)
|
|
63
|
-
console.log(` ${cmd} ${args.join(" ")}`)
|
|
64
|
-
const result: SpawnSyncReturns<Buffer> = spawnSync(cmd, args, { cwd, stdio: "inherit" })
|
|
65
|
-
if (result.error || result.status !== 0) {
|
|
66
|
-
console.error(`✗ ${label} failed`)
|
|
67
|
-
process.exit(1)
|
|
68
|
-
}
|
|
69
|
-
console.log(`✓ ${label}`)
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
function buildSysrootPath(arch: AndroidArch): string {
|
|
73
|
-
// NDK sysroot layout: $NDK_HOME/toolchains/llvm/prebuilt/<host>/sysroot/usr/lib/<triple>/<api>/
|
|
74
|
-
// The host prebuilt dir varies by runner OS — we glob for it.
|
|
75
|
-
const fs = require("fs") as typeof import("fs")
|
|
76
|
-
const prebuiltDir = join(NDK_HOME, "toolchains", "llvm", "prebuilt")
|
|
77
|
-
const hosts = fs.readdirSync(prebuiltDir)
|
|
78
|
-
if (hosts.length === 0) {
|
|
79
|
-
console.error(`Error: no prebuilt dir found in ${prebuiltDir}`)
|
|
80
|
-
process.exit(1)
|
|
81
|
-
}
|
|
82
|
-
const host = hosts[0]!
|
|
83
|
-
return join(prebuiltDir, host, "sysroot")
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
function buildOneArch(arch: AndroidArch): void {
|
|
87
|
-
console.log(`\n═══ Building ${arch.packageName} ═══`)
|
|
88
|
-
const sysroot = buildSysrootPath(arch)
|
|
89
|
-
const zigTarget = `${arch.zigArch}-linux-android`
|
|
90
|
-
|
|
91
|
-
// Zig's build system: -Dtarget sets the target, -Doptimize sets the
|
|
92
|
-
// optimization mode. The NDK sysroot is passed via ZIG_* env vars that
|
|
93
|
-
// Zig's build system respects for cross-compilation. We can't pass
|
|
94
|
-
// --sysroot directly to `zig build` — it's a compiler flag, not a
|
|
95
|
-
// build-system flag. Instead we set CFLAGS/LDFLAGS that Zig's
|
|
96
|
-
// linkSystemLibrary picks up, AND set the NDK toolchain in PATH so Zig
|
|
97
|
-
// can find the android linker (ld.lld from the NDK).
|
|
98
|
-
const prebuiltDir = join(NDK_HOME, "toolchains", "llvm", "prebuilt")
|
|
99
|
-
const fs = require("fs") as typeof import("fs")
|
|
100
|
-
const hosts = fs.readdirSync(prebuiltDir)
|
|
101
|
-
const host = hosts[0]!
|
|
102
|
-
const ndkToolchainBin = join(prebuiltDir, host, "bin")
|
|
103
|
-
|
|
104
|
-
// ── Zig + Android NDK cross-compilation ────────────────────────────
|
|
105
|
-
//
|
|
106
|
-
// The core challenge: Zig doesn't bundle Android's Bionic libc. So we
|
|
107
|
-
// MUST tell Zig to use the NDK's libc instead. There are two pieces:
|
|
108
|
-
//
|
|
109
|
-
// 1. Pass --sysroot=<NDK sysroot> to EVERY Zig compiler/linker invocation.
|
|
110
|
-
// We do this via ZIG_GLOBAL_ARGS env var (Zig 0.15 reads this).
|
|
111
|
-
//
|
|
112
|
-
// 2. Add the NDK's lib paths so linkSystemLibrary("OpenSLES") works.
|
|
113
|
-
// We do this via XINCLI_ANDROID_LIB_PATH env var (read by build.zig).
|
|
114
|
-
//
|
|
115
|
-
// 3. Set CC/CXX to the NDK's clang wrappers so any C compilation (yoga,
|
|
116
|
-
// miniaudio_shim) uses NDK headers + libs.
|
|
117
|
-
const sysrootLibApiSpecific = join(sysroot, "usr", "lib", arch.ndkTriple, NDK_API_LEVEL)
|
|
118
|
-
const sysrootLibGeneric = join(sysroot, "usr", "lib", arch.ndkTriple)
|
|
119
|
-
const sysrootInclude = join(sysroot, "usr", "include")
|
|
120
|
-
// Arch-specific include dir — the NDK puts <asm/> headers here, and
|
|
121
|
-
// <linux/types.h> does #include <asm/types.h>. Without this path, Zig's
|
|
122
|
-
// C import fails with 'asm/types.h' file not found.
|
|
123
|
-
const sysrootIncludeArch = join(sysroot, "usr", "include", arch.ndkTriple)
|
|
124
|
-
|
|
125
|
-
// ── Zig libc file ───────────────────────────────────────────────────
|
|
126
|
-
// Zig 0.15 needs an explicit libc file to cross-compile against a
|
|
127
|
-
// non-bundled libc like Android's Bionic. The file tells Zig where to
|
|
128
|
-
// find include dirs, crt objects, and the libc.so. Without this, Zig
|
|
129
|
-
// fails with 'unable to provide libc for target aarch64-linux-android'.
|
|
130
|
-
const libcFileContent = [
|
|
131
|
-
`include_dir=${sysrootInclude}`,
|
|
132
|
-
// sys_include_dir MUST be the arch-specific path so @cImport can find
|
|
133
|
-
// <asm/types.h> when <linux/types.h> includes it. Zig's C import
|
|
134
|
-
// doesn't respect CFLAGS — it only uses paths from the libc file.
|
|
135
|
-
`sys_include_dir=${sysrootIncludeArch}`,
|
|
136
|
-
`crt_dir=${sysrootLibApiSpecific}`,
|
|
137
|
-
`msvc_lib_dir=`,
|
|
138
|
-
`kernel32_lib_dir=`,
|
|
139
|
-
`gcc_dir=`,
|
|
140
|
-
].join('\n')
|
|
141
|
-
const libcFilePath = join(rootDir, `libc-${arch.zigArch}-android.txt`)
|
|
142
|
-
writeFileSync(libcFilePath, libcFileContent, { encoding: 'utf-8' })
|
|
143
|
-
|
|
144
|
-
const env = {
|
|
145
|
-
...process.env,
|
|
146
|
-
ANDROID_NDK_HOME: NDK_HOME,
|
|
147
|
-
ANDROID_NDK_ROOT: NDK_HOME,
|
|
148
|
-
XINCLI_ANDROID_LIB_PATH: sysrootLibApiSpecific,
|
|
149
|
-
CC: join(ndkToolchainBin, `${arch.ndkTriple}${NDK_API_LEVEL}-clang`),
|
|
150
|
-
CXX: join(ndkToolchainBin, `${arch.ndkTriple}${NDK_API_LEVEL}-clang++`),
|
|
151
|
-
// CFLAGS: --sysroot + arch-specific -I for <asm/> headers that
|
|
152
|
-
// <linux/types.h> includes. Without -I<sysroot>/usr/include/<triple>,
|
|
153
|
-
// Zig's C import fails with 'asm/types.h' file not found.
|
|
154
|
-
CFLAGS: `--sysroot=${sysroot} -I${sysrootIncludeArch}`,
|
|
155
|
-
CXXFLAGS: `--sysroot=${sysroot} -I${sysrootIncludeArch}`,
|
|
156
|
-
LDFLAGS: `--sysroot=${sysroot} -L${sysrootLibApiSpecific} -L${sysrootLibGeneric}`,
|
|
157
|
-
LIBRARY_PATH: `${sysrootLibApiSpecific}:${sysrootLibGeneric}`,
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
// Pass the libc file via -Dtarget and --sysroot. The libc file is
|
|
161
|
-
// passed via the ZIG_LIBC env var (Zig 0.15 reads this).
|
|
162
|
-
const zigArgs = [
|
|
163
|
-
"build",
|
|
164
|
-
`-Dtarget=${zigTarget}`,
|
|
165
|
-
`-Doptimize=ReleaseFast`,
|
|
166
|
-
`--sysroot`,
|
|
167
|
-
sysroot,
|
|
168
|
-
]
|
|
169
|
-
// Set ZIG_LIBC to point at our generated libc file
|
|
170
|
-
env.ZIG_LIBC = libcFilePath
|
|
171
|
-
|
|
172
|
-
console.log(` zig ${zigArgs.join(" ")}`)
|
|
173
|
-
console.log(` CC=${env.CC}`)
|
|
174
|
-
console.log(` sysroot=${sysroot}`)
|
|
175
|
-
const result = spawnSync("zig", zigArgs, {
|
|
176
|
-
cwd: join(rootDir, "src", "zig"),
|
|
177
|
-
stdio: "inherit",
|
|
178
|
-
env,
|
|
179
|
-
})
|
|
180
|
-
if (result.error || result.status !== 0) {
|
|
181
|
-
console.error(`✗ Zig build ${zigTarget} failed`)
|
|
182
|
-
process.exit(1)
|
|
183
|
-
}
|
|
184
|
-
console.log(`✓ Zig build ${zigTarget}`)
|
|
185
|
-
|
|
186
|
-
// Locate the produced .so — Zig puts it under zig-out/lib/
|
|
187
|
-
const srcSo = join(rootDir, "src", "zig", "zig-out", "lib", "libopentui.so")
|
|
188
|
-
if (!existsSync(srcSo)) {
|
|
189
|
-
console.error(`✗ libopentui.so not found at ${srcSo}`)
|
|
190
|
-
console.error(" Check zig-out/ for the actual output location:")
|
|
191
|
-
run("find", [join(rootDir, "src", "zig", "zig-out"), "-name", "libopentui.so"], rootDir, "search for .so")
|
|
192
|
-
process.exit(1)
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
// Create the npm package structure
|
|
196
|
-
const pkgDir = join(rootDir, "dist-android", arch.packageName)
|
|
197
|
-
mkdirSync(pkgDir, { recursive: true })
|
|
198
|
-
copyFileSync(srcSo, join(pkgDir, "libopentui.so"))
|
|
199
|
-
|
|
200
|
-
// Write package.json for this variant
|
|
201
|
-
const pkgJson = {
|
|
202
|
-
name: arch.packageName,
|
|
203
|
-
version: "0.4.3",
|
|
204
|
-
description: `OpenTUI native core for Android ${arch.zigArch} (Termux). Cross-compiled by XINCLI.`,
|
|
205
|
-
repository: {
|
|
206
|
-
type: "git",
|
|
207
|
-
url: "git+https://github.com/bd-loser/opentui.git",
|
|
208
|
-
},
|
|
209
|
-
license: "MIT",
|
|
210
|
-
main: "libopentui.so",
|
|
211
|
-
files: ["libopentui.so"],
|
|
212
|
-
}
|
|
213
|
-
writeFileSync(join(pkgDir, "package.json"), JSON.stringify(pkgJson, null, 2))
|
|
214
|
-
|
|
215
|
-
console.log(`✓ Packaged ${arch.packageName} → ${pkgDir}`)
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
// Build all three arches
|
|
219
|
-
for (const arch of ANDROID_ARCHES) {
|
|
220
|
-
buildOneArch(arch)
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
console.log("\n✅ All Android variants built successfully")
|
|
224
|
-
console.log(" dist-android/@xincli/opentui-core-android-arm64/libopentui.so")
|
|
225
|
-
console.log(" dist-android/@xincli/opentui-core-android-arm/libopentui.so")
|
|
226
|
-
console.log(" dist-android/@xincli/opentui-core-android-x64/libopentui.so")
|