buninu-linux 0.2.0
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/LICENSES/Bun-LICENSE.md +84 -0
- package/LICENSES/GCC-Runtime-Library-Exception-3.1.txt +73 -0
- package/LICENSES/GPL-2.0.txt +338 -0
- package/LICENSES/GPL-3.0.txt +674 -0
- package/LICENSES/LGPL-2.1.txt +501 -0
- package/LICENSES/Linux-syscall-note.txt +25 -0
- package/LICENSES/musl-COPYRIGHT.txt +193 -0
- package/NOTICE.md +184 -0
- package/README.md +537 -0
- package/build-image.sh +44 -0
- package/build-uki.sh +75 -0
- package/fetch-alpine.sh +80 -0
- package/fetch-bun.sh +41 -0
- package/fetch-plus-build.sh +11 -0
- package/hello/build-hello.sh +14 -0
- package/hello/hello.c +50 -0
- package/index.js +235 -0
- package/initramfs/bin/sh +3 -0
- package/initramfs/buninu/.bashrc +11 -0
- package/initramfs/buninu/ARCHITECTURE.md +452 -0
- package/initramfs/buninu/CHANGELOG.md +580 -0
- package/initramfs/buninu/LICENSE +21 -0
- package/initramfs/buninu/README.md +1161 -0
- package/initramfs/buninu/apps/bun/make-bunBin.sh +99 -0
- package/initramfs/buninu/apps/bunmsh/CHANGELOG.md +493 -0
- package/initramfs/buninu/apps/bunmsh/LICENSE +21 -0
- package/initramfs/buninu/apps/bunmsh/LICENSE-MICRO +58 -0
- package/initramfs/buninu/apps/bunmsh/LICENSE-MKSH +295 -0
- package/initramfs/buninu/apps/bunmsh/PORTING.md +192 -0
- package/initramfs/buninu/apps/bunmsh/README.md +1042 -0
- package/initramfs/buninu/apps/bunmsh/bunmsh +7 -0
- package/initramfs/buninu/apps/bunmsh/bunshell.md +61 -0
- package/initramfs/buninu/apps/bunmsh/help/README.md +2237 -0
- package/initramfs/buninu/apps/bunmsh/help/alias.md +22 -0
- package/initramfs/buninu/apps/bunmsh/help/basename.md +38 -0
- package/initramfs/buninu/apps/bunmsh/help/builtin.md +25 -0
- package/initramfs/buninu/apps/bunmsh/help/bun.md +27 -0
- package/initramfs/buninu/apps/bunmsh/help/bunmsh.md +47 -0
- package/initramfs/buninu/apps/bunmsh/help/cat.md +31 -0
- package/initramfs/buninu/apps/bunmsh/help/catfancy.md +35 -0
- package/initramfs/buninu/apps/bunmsh/help/cd.md +22 -0
- package/initramfs/buninu/apps/bunmsh/help/chmod.md +27 -0
- package/initramfs/buninu/apps/bunmsh/help/clear.md +21 -0
- package/initramfs/buninu/apps/bunmsh/help/colon.md +22 -0
- package/initramfs/buninu/apps/bunmsh/help/command.md +27 -0
- package/initramfs/buninu/apps/bunmsh/help/cp.md +28 -0
- package/initramfs/buninu/apps/bunmsh/help/curl.md +181 -0
- package/initramfs/buninu/apps/bunmsh/help/cut.md +25 -0
- package/initramfs/buninu/apps/bunmsh/help/date.md +25 -0
- package/initramfs/buninu/apps/bunmsh/help/dirname.md +25 -0
- package/initramfs/buninu/apps/bunmsh/help/echo.md +25 -0
- package/initramfs/buninu/apps/bunmsh/help/env.md +27 -0
- package/initramfs/buninu/apps/bunmsh/help/eval.md +22 -0
- package/initramfs/buninu/apps/bunmsh/help/exec.md +22 -0
- package/initramfs/buninu/apps/bunmsh/help/exit.md +21 -0
- package/initramfs/buninu/apps/bunmsh/help/export.md +22 -0
- package/initramfs/buninu/apps/bunmsh/help/false.md +22 -0
- package/initramfs/buninu/apps/bunmsh/help/find.md +33 -0
- package/initramfs/buninu/apps/bunmsh/help/getopts.md +28 -0
- package/initramfs/buninu/apps/bunmsh/help/grep.md +34 -0
- package/initramfs/buninu/apps/bunmsh/help/head.md +27 -0
- package/initramfs/buninu/apps/bunmsh/help/kill.md +43 -0
- package/initramfs/buninu/apps/bunmsh/help/ln.md +28 -0
- package/initramfs/buninu/apps/bunmsh/help/ls.md +37 -0
- package/initramfs/buninu/apps/bunmsh/help/lsbun.md +29 -0
- package/initramfs/buninu/apps/bunmsh/help/lsfancy.md +37 -0
- package/initramfs/buninu/apps/bunmsh/help/md5sum.md +21 -0
- package/initramfs/buninu/apps/bunmsh/help/mkdir.md +27 -0
- package/initramfs/buninu/apps/bunmsh/help/mktemp.md +26 -0
- package/initramfs/buninu/apps/bunmsh/help/mv.md +26 -0
- package/initramfs/buninu/apps/bunmsh/help/print.md +30 -0
- package/initramfs/buninu/apps/bunmsh/help/printf.md +25 -0
- package/initramfs/buninu/apps/bunmsh/help/pspa.md +38 -0
- package/initramfs/buninu/apps/bunmsh/help/pspac.md +57 -0
- package/initramfs/buninu/apps/bunmsh/help/pwd.md +21 -0
- package/initramfs/buninu/apps/bunmsh/help/read.md +27 -0
- package/initramfs/buninu/apps/bunmsh/help/readonly.md +27 -0
- package/initramfs/buninu/apps/bunmsh/help/realpath.md +21 -0
- package/initramfs/buninu/apps/bunmsh/help/rm.md +33 -0
- package/initramfs/buninu/apps/bunmsh/help/rmdir.md +27 -0
- package/initramfs/buninu/apps/bunmsh/help/sed.md +29 -0
- package/initramfs/buninu/apps/bunmsh/help/seq.md +29 -0
- package/initramfs/buninu/apps/bunmsh/help/serve.md +50 -0
- package/initramfs/buninu/apps/bunmsh/help/set.md +26 -0
- package/initramfs/buninu/apps/bunmsh/help/sha256sum.md +21 -0
- package/initramfs/buninu/apps/bunmsh/help/shift.md +23 -0
- package/initramfs/buninu/apps/bunmsh/help/sleep.md +25 -0
- package/initramfs/buninu/apps/bunmsh/help/sort.md +29 -0
- package/initramfs/buninu/apps/bunmsh/help/source.md +23 -0
- package/initramfs/buninu/apps/bunmsh/help/tab.md +30 -0
- package/initramfs/buninu/apps/bunmsh/help/tac.md +29 -0
- package/initramfs/buninu/apps/bunmsh/help/tail.md +27 -0
- package/initramfs/buninu/apps/bunmsh/help/tee.md +25 -0
- package/initramfs/buninu/apps/bunmsh/help/test.md +30 -0
- package/initramfs/buninu/apps/bunmsh/help/time.md +29 -0
- package/initramfs/buninu/apps/bunmsh/help/touch.md +26 -0
- package/initramfs/buninu/apps/bunmsh/help/tr.md +26 -0
- package/initramfs/buninu/apps/bunmsh/help/true.md +22 -0
- package/initramfs/buninu/apps/bunmsh/help/type.md +21 -0
- package/initramfs/buninu/apps/bunmsh/help/umask.md +22 -0
- package/initramfs/buninu/apps/bunmsh/help/unalias.md +28 -0
- package/initramfs/buninu/apps/bunmsh/help/uname.md +31 -0
- package/initramfs/buninu/apps/bunmsh/help/unset.md +28 -0
- package/initramfs/buninu/apps/bunmsh/help/wc.md +27 -0
- package/initramfs/buninu/apps/bunmsh/help/whence.md +26 -0
- package/initramfs/buninu/apps/bunmsh/help/which.md +41 -0
- package/initramfs/buninu/apps/bunmsh/help/yes.md +23 -0
- package/initramfs/buninu/apps/bunmsh/index.js +7 -0
- package/initramfs/buninu/apps/bunmsh/package.json +30 -0
- package/initramfs/buninu/apps/bunmsh/serve.js +468 -0
- package/initramfs/buninu/apps/bunmsh/single-exe/README.md +402 -0
- package/initramfs/buninu/apps/bunmsh/single-exe/assetsHelper.js +371 -0
- package/initramfs/buninu/apps/bunmsh/single-exe/assetsLoader.mjs +85 -0
- package/initramfs/buninu/apps/bunmsh/single-exe/assetsPacker.js +218 -0
- package/initramfs/buninu/apps/bunmsh/single-exe/compiled.js +527 -0
- package/initramfs/buninu/apps/bunmsh/single-exe/entry.mjs +17 -0
- package/initramfs/buninu/apps/bunmsh/src/cat-fancy.js +117 -0
- package/initramfs/buninu/apps/bunmsh/src/cat-operands.js +31 -0
- package/initramfs/buninu/apps/bunmsh/src/completion.js +363 -0
- package/initramfs/buninu/apps/bunmsh/src/curl.js +1191 -0
- package/initramfs/buninu/apps/bunmsh/src/environment.js +61 -0
- package/initramfs/buninu/apps/bunmsh/src/fancy-ls.js +186 -0
- package/initramfs/buninu/apps/bunmsh/src/find.js +119 -0
- package/initramfs/buninu/apps/bunmsh/src/history.js +198 -0
- package/initramfs/buninu/apps/bunmsh/src/main.js +850 -0
- package/initramfs/buninu/apps/bunmsh/src/mouse.js +103 -0
- package/initramfs/buninu/apps/bunmsh/src/shell.js +3932 -0
- package/initramfs/buninu/apps/bunmsh/test/catfancy.test.js +102 -0
- package/initramfs/buninu/apps/bunmsh/test/curl.test.js +335 -0
- package/initramfs/buninu/apps/bunmsh/test/reference-source.sh +1 -0
- package/initramfs/buninu/apps/bunmsh/test/reference.test.js +817 -0
- package/initramfs/buninu/apps/bunmsh/test/serve/README.md +3 -0
- package/initramfs/buninu/apps/bunmsh/test/serve/bad.json +1 -0
- package/initramfs/buninu/apps/bunmsh/test/serve/data.json +1 -0
- package/initramfs/buninu/apps/bunmsh/test/serve/data.json5 +1 -0
- package/initramfs/buninu/apps/bunmsh/test/serve/data.jsonc +2 -0
- package/initramfs/buninu/apps/bunmsh/test/serve/data.jsonl +2 -0
- package/initramfs/buninu/apps/bunmsh/test/serve/data.ndjson +1 -0
- package/initramfs/buninu/apps/bunmsh/test/serve/data.toml +3 -0
- package/initramfs/buninu/apps/bunmsh/test/serve/data.ts +15 -0
- package/initramfs/buninu/apps/bunmsh/test/serve/data.xml +1 -0
- package/initramfs/buninu/apps/bunmsh/test/serve/data.yaml +3 -0
- package/initramfs/buninu/apps/bunmsh/test/serve/data.yml +1 -0
- package/initramfs/buninu/apps/bunmsh/test/serve.test.js +241 -0
- package/initramfs/buninu/apps/bunmsh/test/shell.test.js +2092 -0
- package/initramfs/buninu/apps/bunmsh/test/shell1.test.js +1087 -0
- package/initramfs/buninu/apps/bunmsh/test/shell2.test.js +457 -0
- package/initramfs/buninu/apps/bunmsh/test/shell3.test.js +741 -0
- package/initramfs/buninu/apps/bunmsh/test/t.sh +12 -0
- package/initramfs/buninu/apps/bunx/bunx.js +172 -0
- package/initramfs/buninu/apps/cmdlist +48 -0
- package/initramfs/buninu/apps/jsgotty/LICENSE +23 -0
- package/initramfs/buninu/apps/jsgotty/LICENSES/Apache-2.0-zmodem.js.txt +201 -0
- package/initramfs/buninu/apps/jsgotty/NOTICE +21 -0
- package/initramfs/buninu/apps/jsgotty/README.en.md +294 -0
- package/initramfs/buninu/apps/jsgotty/README.md +296 -0
- package/initramfs/buninu/apps/jsgotty/client.mjs +700 -0
- package/initramfs/buninu/apps/jsgotty/env.sh +2 -0
- package/initramfs/buninu/apps/jsgotty/gotty.js +3334 -0
- package/initramfs/buninu/apps/jsgotty/node_modules/.package-lock.json +35 -0
- package/initramfs/buninu/apps/jsgotty/node_modules/node-addon-api/LICENSE.md +9 -0
- package/initramfs/buninu/apps/jsgotty/node_modules/node-addon-api/README.md +319 -0
- package/initramfs/buninu/apps/jsgotty/node_modules/node-addon-api/common.gypi +20 -0
- package/initramfs/buninu/apps/jsgotty/node_modules/node-addon-api/except.gypi +25 -0
- package/initramfs/buninu/apps/jsgotty/node_modules/node-addon-api/index.js +12 -0
- package/initramfs/buninu/apps/jsgotty/node_modules/node-addon-api/napi-inl.deprecated.h +186 -0
- package/initramfs/buninu/apps/jsgotty/node_modules/node-addon-api/napi-inl.h +6607 -0
- package/initramfs/buninu/apps/jsgotty/node_modules/node-addon-api/napi.h +3201 -0
- package/initramfs/buninu/apps/jsgotty/node_modules/node-addon-api/node_addon_api.gyp +32 -0
- package/initramfs/buninu/apps/jsgotty/node_modules/node-addon-api/node_api.gyp +9 -0
- package/initramfs/buninu/apps/jsgotty/node_modules/node-addon-api/noexcept.gypi +26 -0
- package/initramfs/buninu/apps/jsgotty/node_modules/node-addon-api/nothing.c +0 -0
- package/initramfs/buninu/apps/jsgotty/node_modules/node-addon-api/package-support.json +21 -0
- package/initramfs/buninu/apps/jsgotty/node_modules/node-addon-api/package.json +480 -0
- package/initramfs/buninu/apps/jsgotty/node_modules/node-addon-api/tools/README.md +73 -0
- package/initramfs/buninu/apps/jsgotty/node_modules/node-addon-api/tools/check-napi.js +99 -0
- package/initramfs/buninu/apps/jsgotty/node_modules/node-addon-api/tools/clang-format.js +71 -0
- package/initramfs/buninu/apps/jsgotty/node_modules/node-addon-api/tools/conversion.js +301 -0
- package/initramfs/buninu/apps/jsgotty/node_modules/node-addon-api/tools/eslint-format.js +79 -0
- package/initramfs/buninu/apps/jsgotty/node_modules/ws/LICENSE +20 -0
- package/initramfs/buninu/apps/jsgotty/node_modules/ws/README.md +548 -0
- package/initramfs/buninu/apps/jsgotty/node_modules/ws/browser.js +8 -0
- package/initramfs/buninu/apps/jsgotty/node_modules/ws/index.js +22 -0
- package/initramfs/buninu/apps/jsgotty/node_modules/ws/lib/buffer-util.js +131 -0
- package/initramfs/buninu/apps/jsgotty/node_modules/ws/lib/constants.js +19 -0
- package/initramfs/buninu/apps/jsgotty/node_modules/ws/lib/event-target.js +292 -0
- package/initramfs/buninu/apps/jsgotty/node_modules/ws/lib/extension.js +203 -0
- package/initramfs/buninu/apps/jsgotty/node_modules/ws/lib/limiter.js +55 -0
- package/initramfs/buninu/apps/jsgotty/node_modules/ws/lib/permessage-deflate.js +528 -0
- package/initramfs/buninu/apps/jsgotty/node_modules/ws/lib/receiver.js +760 -0
- package/initramfs/buninu/apps/jsgotty/node_modules/ws/lib/sender.js +607 -0
- package/initramfs/buninu/apps/jsgotty/node_modules/ws/lib/stream.js +161 -0
- package/initramfs/buninu/apps/jsgotty/node_modules/ws/lib/subprotocol.js +62 -0
- package/initramfs/buninu/apps/jsgotty/node_modules/ws/lib/validation.js +152 -0
- package/initramfs/buninu/apps/jsgotty/node_modules/ws/lib/websocket-server.js +562 -0
- package/initramfs/buninu/apps/jsgotty/node_modules/ws/lib/websocket.js +1407 -0
- package/initramfs/buninu/apps/jsgotty/node_modules/ws/package.json +70 -0
- package/initramfs/buninu/apps/jsgotty/node_modules/ws/wrapper.mjs +21 -0
- package/initramfs/buninu/apps/jsgotty/package-lock.json +46 -0
- package/initramfs/buninu/apps/jsgotty/package.json +19 -0
- package/initramfs/buninu/apps/jsgotty/patches/windowsPtyAgent.js +326 -0
- package/initramfs/buninu/apps/jsgotty/patches/windowsTerminal.js +204 -0
- package/initramfs/buninu/apps/jsgotty/rz.js +199 -0
- package/initramfs/buninu/apps/jsgotty/single-exe/README.md +384 -0
- package/initramfs/buninu/apps/jsgotty/single-exe/assetsHelper.js +371 -0
- package/initramfs/buninu/apps/jsgotty/single-exe/assetsLoader.mjs +85 -0
- package/initramfs/buninu/apps/jsgotty/single-exe/assetsPacker.js +218 -0
- package/initramfs/buninu/apps/jsgotty/single-exe/compiled.js +498 -0
- package/initramfs/buninu/apps/jsgotty/single-exe/entry.mjs +23 -0
- package/initramfs/buninu/apps/jsgotty/single-exe/packAssets.sh +7 -0
- package/initramfs/buninu/apps/jsgotty/static/css/index.css +13 -0
- package/initramfs/buninu/apps/jsgotty/static/css/kitty.css +61 -0
- package/initramfs/buninu/apps/jsgotty/static/css/xterm.css +218 -0
- package/initramfs/buninu/apps/jsgotty/static/css/xterm_customize.css +35 -0
- package/initramfs/buninu/apps/jsgotty/static/favicon.ico +0 -0
- package/initramfs/buninu/apps/jsgotty/static/help.md +125 -0
- package/initramfs/buninu/apps/jsgotty/static/icon.svg +66 -0
- package/initramfs/buninu/apps/jsgotty/static/icon_192.png +0 -0
- package/initramfs/buninu/apps/jsgotty/static/index.html +164 -0
- package/initramfs/buninu/apps/jsgotty/static/js/gotty.js +31537 -0
- package/initramfs/buninu/apps/jsgotty/static/js/gotty.js.LICENSE.txt +7 -0
- package/initramfs/buninu/apps/jsgotty/static/js/gotty.js.map +1 -0
- package/initramfs/buninu/apps/jsgotty/static/js/gotty.licenses.txt +650 -0
- package/initramfs/buninu/apps/jsgotty/static/js/kitty.js +1101 -0
- package/initramfs/buninu/apps/jsgotty/static/js/windows_bridge.js +194 -0
- package/initramfs/buninu/apps/jsgotty/static/js/xterm-addon-unicode11.js +2 -0
- package/initramfs/buninu/apps/jsgotty/static/js/zmodem.js +1 -0
- package/initramfs/buninu/apps/jsgotty/static/manifest.json +15 -0
- package/initramfs/buninu/apps/jsgotty/sz.js +273 -0
- package/initramfs/buninu/apps/jsgotty/tests/kitty-order.test.js +58 -0
- package/initramfs/buninu/apps/jsgotty/tests/websocket-origin.test.js +54 -0
- package/initramfs/buninu/apps/jsgotty/viu.mjs +422 -0
- package/initramfs/buninu/apps/jsgotty/wgotty +62 -0
- package/initramfs/buninu/apps/jsgotty/windows-bridge-node.js +60 -0
- package/initramfs/buninu/apps/jsgotty/zmodem-node.js +262 -0
- package/initramfs/buninu/apps/jsmdcui/CHANGELOG.md +1118 -0
- package/initramfs/buninu/apps/jsmdcui/LICENSE +22 -0
- package/initramfs/buninu/apps/jsmdcui/README.md +1283 -0
- package/initramfs/buninu/apps/jsmdcui/cdp-maze.js +141 -0
- package/initramfs/buninu/apps/jsmdcui/clean.sh +9 -0
- package/initramfs/buninu/apps/jsmdcui/demos/basic.jpg +0 -0
- package/initramfs/buninu/apps/jsmdcui/demos/chinese.md +32 -0
- package/initramfs/buninu/apps/jsmdcui/demos/event.md +170 -0
- package/initramfs/buninu/apps/jsmdcui/demos/good.jpg +0 -0
- package/initramfs/buninu/apps/jsmdcui/demos/image-processor.md +366 -0
- package/initramfs/buninu/apps/jsmdcui/demos/image-processor.zh-TW.md +366 -0
- package/initramfs/buninu/apps/jsmdcui/demos/img-change.md +73 -0
- package/initramfs/buninu/apps/jsmdcui/demos/imgtool-zh.md +298 -0
- package/initramfs/buninu/apps/jsmdcui/demos/imgtool.md +298 -0
- package/initramfs/buninu/apps/jsmdcui/demos/maze.md +149 -0
- package/initramfs/buninu/apps/jsmdcui/demos/reactive.md +40 -0
- package/initramfs/buninu/apps/jsmdcui/demos/reader.md +513 -0
- package/initramfs/buninu/apps/jsmdcui/demos/select.md +63 -0
- package/initramfs/buninu/apps/jsmdcui/demos/todo-zh.md +190 -0
- package/initramfs/buninu/apps/jsmdcui/demos/todo.md +191 -0
- package/initramfs/buninu/apps/jsmdcui/edit +9 -0
- package/initramfs/buninu/apps/jsmdcui/jsmdcui.sh +16 -0
- package/initramfs/buninu/apps/jsmdcui/llm-maze.txt +94 -0
- package/initramfs/buninu/apps/jsmdcui/package.json +29 -0
- package/initramfs/buninu/apps/jsmdcui/project_structure.txt +35 -0
- package/initramfs/buninu/apps/jsmdcui/runmd.mjs +1140 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/colorschemes/atom-dark.micro +33 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/colorschemes/bubblegum.micro +31 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/colorschemes/cmc-16.micro +47 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/colorschemes/cmc-tc.micro +43 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/colorschemes/darcula.micro +34 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/colorschemes/default.micro +1 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/colorschemes/dracula-tc.micro +49 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/colorschemes/dukedark-tc.micro +38 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/colorschemes/dukelight-tc.micro +38 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/colorschemes/dukeubuntu-tc.micro +38 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/colorschemes/geany.micro +29 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/colorschemes/gotham.micro +29 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/colorschemes/gruvbox-tc.micro +29 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/colorschemes/gruvbox.micro +26 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/colorschemes/material-tc.micro +36 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/colorschemes/monokai-dark.micro +28 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/colorschemes/monokai.micro +34 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/colorschemes/one-dark.micro +39 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/colorschemes/railscast.micro +37 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/colorschemes/simple.micro +33 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/colorschemes/solarized-tc.micro +31 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/colorschemes/solarized.micro +30 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/colorschemes/sunny-day.micro +29 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/colorschemes/twilight.micro +40 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/colorschemes/zenburn.micro +30 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/help/actions.md +161 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/help/cdp.md +130 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/help/colors.md +421 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/help/commands.md +161 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/help/copypaste.md +149 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/help/defaultkeys.md +148 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/help/help.md +1283 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/help/keybindings.md +355 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/help/linter.md +90 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/help/options.md +709 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/help/plugins.md +544 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/help/tutorial.md +112 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/jsplugins/cdp/cdp-server.js +1263 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/jsplugins/cdp/cdp.js +203 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/jsplugins/chapter/chapter.js +111 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/jsplugins/diff/diff.js +46 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/jsplugins/example/example.js +117 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/jsplugins/linter/linter.js +281 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/plugins/autoclose/autoclose.lua +75 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/plugins/ftoptions/ftoptions.lua +17 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/plugins/literate/README.md +5 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/plugins/literate/literate.lua +55 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/plugins/status/help/status.md +21 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/plugins/status/status.lua +62 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/LICENSE +22 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/PowerShell.yaml +128 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/README.md +63 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/ada.yaml +43 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/apacheconf.yaml +59 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/arduino.yaml +101 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/asciidoc.yaml +51 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/asm.yaml +123 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/ats.yaml +99 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/awk.yaml +44 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/b.yaml +87 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/bat.yaml +57 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/c.yaml +60 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/caddyfile.yaml +23 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/cake.yaml +7 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/clojure.yaml +38 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/cmake.yaml +42 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/coffeescript.yaml +56 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/colortest.yaml +19 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/conky.yaml +17 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/cpp.yaml +91 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/crontab.yaml +36 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/crystal.yaml +72 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/csharp.yaml +52 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/css.yaml +44 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/csx.yaml +8 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/cuda.yaml +68 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/cython.yaml +52 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/d.yaml +121 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/dart.yaml +46 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/default.yaml +10 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/dockerfile.yaml +36 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/dot.yaml +29 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/elixir.yaml +30 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/elm.yaml +38 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/erb.yaml +42 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/erlang.yaml +45 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/fish.yaml +48 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/forth.yaml +34 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/fortran.yaml +64 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/freebsd-kernel.yaml +14 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/fsharp.yaml +48 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/gdscript.yaml +61 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/gemini.yaml +19 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/gentoo-ebuild.yaml +48 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/gentoo-etc-portage.yaml +23 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/git-commit.yaml +35 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/git-config.yaml +14 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/git-rebase-todo.yaml +19 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/gleam.yaml +69 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/glsl.yaml +26 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/gnuplot.yaml +15 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/go.yaml +62 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/godoc.yaml +17 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/golo.yaml +73 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/gomod.yaml +31 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/graphql.yaml +47 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/groff.yaml +30 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/groovy.yaml +111 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/haml.yaml +16 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/hare.yaml +52 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/haskell.yaml +52 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/hc.yaml +52 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/html.yaml +70 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/html4.yaml +25 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/html5.yaml +25 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/ini.yaml +23 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/inputrc.yaml +14 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/java.yaml +37 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/javascript.yaml +124 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/jinja2.yaml +19 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/json.yaml +39 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/jsonnet.yaml +92 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/julia.yaml +57 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/justfile.yaml +40 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/keymap.yaml +27 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/kickstart.yaml +16 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/kotlin.yaml +66 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/kvlang.yaml +67 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/ledger.yaml +14 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/lfe.yaml +17 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/lilypond.yaml +26 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/lisp.yaml +17 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/log.yaml +92 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/lua.yaml +111 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/mail.yaml +25 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/makefile.yaml +38 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/man.yaml +12 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/markdown.yaml +65 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/mc.yaml +23 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/meson.yaml +51 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/micro.yaml +34 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/mpdconf.yaml +13 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/msbuild.yaml +6 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/nanorc.yaml +16 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/nftables.yaml +30 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/nginx.yaml +22 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/nim.yaml +27 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/nix.yaml +32 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/nu.yaml +114 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/objc.yaml +60 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/ocaml.yaml +43 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/octave.yaml +83 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/odin.yaml +64 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/pascal.yaml +45 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/patch.yaml +14 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/peg.yaml +16 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/perl.yaml +58 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/php.yaml +60 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/pkg-config.yaml +12 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/po.yaml +12 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/pony.yaml +37 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/pov.yaml +21 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/privoxy-action.yaml +14 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/privoxy-config.yaml +10 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/privoxy-filter.yaml +12 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/proto.yaml +40 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/prql.yaml +84 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/puppet.yaml +22 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/python2.yaml +60 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/python3.yaml +80 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/r.yaml +32 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/raku.yaml +42 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/reST.yaml +18 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/renpy.yaml +15 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/rpmspec.yaml +43 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/ruby.yaml +73 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/rust.yaml +78 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/sage.yaml +60 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/scad.yaml +53 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/scala.yaml +33 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/sed.yaml +13 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/sh.yaml +69 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/sls.yaml +15 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/smalltalk.yaml +55 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/solidity.yaml +41 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/sql.yaml +35 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/stata.yaml +67 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/svelte.yaml +27 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/swift.yaml +103 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/systemd.yaml +16 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/tcl.yaml +18 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/terraform.yaml +87 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/tex.yaml +32 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/toml.yaml +56 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/twig.yaml +55 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/typescript.yaml +49 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/v.yaml +80 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/vala.yaml +26 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/verilog.yaml +60 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/vhdl.yaml +37 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/vi.yaml +31 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/vue.yaml +64 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/xml.yaml +37 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/xresources.yaml +14 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/yaml.yaml +34 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/yum.yaml +12 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/zig.yaml +52 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/zscript.yaml +72 -0
- package/initramfs/buninu/apps/jsmdcui/runtime/syntax/zsh.yaml +52 -0
- package/initramfs/buninu/apps/jsmdcui/single-exe/README.md +396 -0
- package/initramfs/buninu/apps/jsmdcui/single-exe/assetsHelper.js +371 -0
- package/initramfs/buninu/apps/jsmdcui/single-exe/assetsLoader.mjs +85 -0
- package/initramfs/buninu/apps/jsmdcui/single-exe/assetsPacker.js +218 -0
- package/initramfs/buninu/apps/jsmdcui/single-exe/compiled.js +498 -0
- package/initramfs/buninu/apps/jsmdcui/single-exe/entry.mjs +17 -0
- package/initramfs/buninu/apps/jsmdcui/single-exe/packAssets.sh +7 -0
- package/initramfs/buninu/apps/jsmdcui/src/MDCUI_DEFAULT_EDIT +0 -0
- package/initramfs/buninu/apps/jsmdcui/src/buffer/backup.js +165 -0
- package/initramfs/buninu/apps/jsmdcui/src/buffer/buffer.js +126 -0
- package/initramfs/buninu/apps/jsmdcui/src/buffer/fixed3-codec.js +140 -0
- package/initramfs/buninu/apps/jsmdcui/src/buffer/loc.js +38 -0
- package/initramfs/buninu/apps/jsmdcui/src/buffer/message.js +29 -0
- package/initramfs/buninu/apps/jsmdcui/src/build-args.js +40 -0
- package/initramfs/buninu/apps/jsmdcui/src/config/clean.js +172 -0
- package/initramfs/buninu/apps/jsmdcui/src/config/colorscheme.js +99 -0
- package/initramfs/buninu/apps/jsmdcui/src/config/config.js +125 -0
- package/initramfs/buninu/apps/jsmdcui/src/config/defaults.js +109 -0
- package/initramfs/buninu/apps/jsmdcui/src/cui/fence-events.mjs +144 -0
- package/initramfs/buninu/apps/jsmdcui/src/cui/heading-ids.mjs +1568 -0
- package/initramfs/buninu/apps/jsmdcui/src/cui/id-collision.mjs +111 -0
- package/initramfs/buninu/apps/jsmdcui/src/cui/identity.mjs +26 -0
- package/initramfs/buninu/apps/jsmdcui/src/cui/kitty-debug.mjs +25 -0
- package/initramfs/buninu/apps/jsmdcui/src/cui/kitty-images.mjs +280 -0
- package/initramfs/buninu/apps/jsmdcui/src/cui/kitty-mode.mjs +6 -0
- package/initramfs/buninu/apps/jsmdcui/src/cui/rerender-queue.mjs +66 -0
- package/initramfs/buninu/apps/jsmdcui/src/cui/rpc.mjs +1554 -0
- package/initramfs/buninu/apps/jsmdcui/src/cui/server.mjs +128 -0
- package/initramfs/buninu/apps/jsmdcui/src/cui/table-render.mjs +286 -0
- package/initramfs/buninu/apps/jsmdcui/src/cui/table-row-edit.mjs +226 -0
- package/initramfs/buninu/apps/jsmdcui/src/cui/task-checkbox.mjs +60 -0
- package/initramfs/buninu/apps/jsmdcui/src/cui/template-components.mjs +253 -0
- package/initramfs/buninu/apps/jsmdcui/src/cui/text-block-resize.mjs +177 -0
- package/initramfs/buninu/apps/jsmdcui/src/cui/tui-links.mjs +560 -0
- package/initramfs/buninu/apps/jsmdcui/src/display/ansi-style.js +60 -0
- package/initramfs/buninu/apps/jsmdcui/src/highlight/highlighter.js +243 -0
- package/initramfs/buninu/apps/jsmdcui/src/highlight/parser.js +225 -0
- package/initramfs/buninu/apps/jsmdcui/src/index.js +9586 -0
- package/initramfs/buninu/apps/jsmdcui/src/lua/engine.js +68 -0
- package/initramfs/buninu/apps/jsmdcui/src/platform/archive.js +50 -0
- package/initramfs/buninu/apps/jsmdcui/src/platform/clipboard.js +278 -0
- package/initramfs/buninu/apps/jsmdcui/src/platform/commands.js +221 -0
- package/initramfs/buninu/apps/jsmdcui/src/platform/terminal.js +5 -0
- package/initramfs/buninu/apps/jsmdcui/src/plugins/js-bridge.js +3377 -0
- package/initramfs/buninu/apps/jsmdcui/src/plugins/manager.js +674 -0
- package/initramfs/buninu/apps/jsmdcui/src/runtime/encodings.js +10 -0
- package/initramfs/buninu/apps/jsmdcui/src/runtime/registry.js +134 -0
- package/initramfs/buninu/apps/jsmdcui/src/screen/cell-buffer.js +81 -0
- package/initramfs/buninu/apps/jsmdcui/src/screen/events.js +263 -0
- package/initramfs/buninu/apps/jsmdcui/src/screen/screen.js +249 -0
- package/initramfs/buninu/apps/jsmdcui/src/screen/vt100.js +571 -0
- package/initramfs/buninu/apps/jsmdcui/src/shell/shell.js +70 -0
- package/initramfs/buninu/apps/jsmdcui/testapp.md +78 -0
- package/initramfs/buninu/apps/jsmdcui/tests/assets-helper.test.js +150 -0
- package/initramfs/buninu/apps/jsmdcui/tests/backup.test.js +158 -0
- package/initramfs/buninu/apps/jsmdcui/tests/cat-markdown.test.js +139 -0
- package/initramfs/buninu/apps/jsmdcui/tests/cdp-security.test.js +32 -0
- package/initramfs/buninu/apps/jsmdcui/tests/cdp-websocket-test.html +46 -0
- package/initramfs/buninu/apps/jsmdcui/tests/cmphex3b64.js +95 -0
- package/initramfs/buninu/apps/jsmdcui/tests/compiled-runtime.test.js +139 -0
- package/initramfs/buninu/apps/jsmdcui/tests/config-settings.test.js +52 -0
- package/initramfs/buninu/apps/jsmdcui/tests/demo.test.js +448 -0
- package/initramfs/buninu/apps/jsmdcui/tests/docs-sync.test.js +14 -0
- package/initramfs/buninu/apps/jsmdcui/tests/fence-events.test.js +1293 -0
- package/initramfs/buninu/apps/jsmdcui/tests/heading-ids.test.js +559 -0
- package/initramfs/buninu/apps/jsmdcui/tests/heading-list-selector.test.js +2393 -0
- package/initramfs/buninu/apps/jsmdcui/tests/id-collision.test.js +514 -0
- package/initramfs/buninu/apps/jsmdcui/tests/jmigt.js +16 -0
- package/initramfs/buninu/apps/jsmdcui/tests/js-plugin-prompts.test.js +110 -0
- package/initramfs/buninu/apps/jsmdcui/tests/key-event.md +10 -0
- package/initramfs/buninu/apps/jsmdcui/tests/kitty-demo.md +184 -0
- package/initramfs/buninu/apps/jsmdcui/tests/kitty-images.test.js +288 -0
- package/initramfs/buninu/apps/jsmdcui/tests/kitty-mode.test.js +14 -0
- package/initramfs/buninu/apps/jsmdcui/tests/platform-commands.test.js +18 -0
- package/initramfs/buninu/apps/jsmdcui/tests/platform-terminal.test.js +8 -0
- package/initramfs/buninu/apps/jsmdcui/tests/pty-demo.js +492 -0
- package/initramfs/buninu/apps/jsmdcui/tests/rerender-queue.test.js +130 -0
- package/initramfs/buninu/apps/jsmdcui/tests/table-render.test.js +150 -0
- package/initramfs/buninu/apps/jsmdcui/tests/table-row-edit.test.js +138 -0
- package/initramfs/buninu/apps/jsmdcui/tests/task-checkbox.test.js +33 -0
- package/initramfs/buninu/apps/jsmdcui/tests/template-components.test.js +422 -0
- package/initramfs/buninu/apps/jsmdcui/tests/text-block-resize.test.js +222 -0
- package/initramfs/buninu/apps/jsmdcui/tests/textarea.md +8 -0
- package/initramfs/buninu/apps/jsmdcui/tests/tui-links.test.js +298 -0
- package/initramfs/buninu/apps/jsmdcui/tests/wui-responsive-images.test.js +60 -0
- package/initramfs/buninu/apps/jsmdcui/tests/wui.test.js +108 -0
- package/initramfs/buninu/apps/jsmdcui/tests/wv-client.js +96 -0
- package/initramfs/buninu/apps/jsmdcui/tui +7 -0
- package/initramfs/buninu/apps/jsmdcui/wui +9 -0
- package/initramfs/buninu/apps/musl-la/LICENSES/GPL-3.0.txt +674 -0
- package/initramfs/buninu/apps/musl-la/LICENSES/gcc_runtime_exception.txt +73 -0
- package/initramfs/buninu/apps/musl-la/LICENSE_musl.txt +193 -0
- package/initramfs/buninu/apps/musl-la/NOTICE +41 -0
- package/initramfs/buninu/apps/musl-la/ld-musl-aarch64.so.1 +0 -0
- package/initramfs/buninu/apps/musl-la/libgcc_s.so.1 +0 -0
- package/initramfs/buninu/apps/musl-la/libstdc++.so.6 +0 -0
- package/initramfs/buninu/apps/musl-la/musl-la.sh +36 -0
- package/initramfs/buninu/apps/native-bridge/native-bridge.js +199 -0
- package/initramfs/buninu/apps/native-bridge/package.json +8 -0
- package/initramfs/buninu/apps/tts/tts.js +214 -0
- package/initramfs/buninu/apps/xclip/xclip.js +121 -0
- package/initramfs/buninu/apps/xdg-open/xdg-open.js +151 -0
- package/initramfs/buninu/bin/bun.bat +37 -0
- package/initramfs/buninu/bin/bun.sh +57 -0
- package/initramfs/buninu/bin/buninu-help.bat +4 -0
- package/initramfs/buninu/bin/buninu-help.sh +7 -0
- package/initramfs/buninu/bin/bunmsh.bat +3 -0
- package/initramfs/buninu/bin/bunmsh.sh +5 -0
- package/initramfs/buninu/bin/bunx.bat +3 -0
- package/initramfs/buninu/bin/glow.bat +3 -0
- package/initramfs/buninu/bin/glow.sh +5 -0
- package/initramfs/buninu/bin/init.js +779 -0
- package/initramfs/buninu/bin/install.js +570 -0
- package/initramfs/buninu/bin/jmi.bat +3 -0
- package/initramfs/buninu/bin/jmi.sh +5 -0
- package/initramfs/buninu/bin/jsgotty.bat +3 -0
- package/initramfs/buninu/bin/jsgotty.sh +5 -0
- package/initramfs/buninu/bin/jsmdcui.bat +11 -0
- package/initramfs/buninu/bin/libsh-loader.c +135 -0
- package/initramfs/buninu/bin/libsh-loader.so +0 -0
- package/initramfs/buninu/bin/multicall.sh +103 -0
- package/initramfs/buninu/bin/native-bridge.bat +3 -0
- package/initramfs/buninu/bin/rz.bat +3 -0
- package/initramfs/buninu/bin/rz.sh +5 -0
- package/initramfs/buninu/bin/shc.js +5 -0
- package/initramfs/buninu/bin/showimg.bat +3 -0
- package/initramfs/buninu/bin/showimg.sh +5 -0
- package/initramfs/buninu/bin/switch_to_android.sh +9 -0
- package/initramfs/buninu/bin/switch_to_linux.sh +7 -0
- package/initramfs/buninu/bin/sz.bat +3 -0
- package/initramfs/buninu/bin/sz.sh +5 -0
- package/initramfs/buninu/bin/tts.bat +3 -0
- package/initramfs/buninu/bin/xclip.bat +3 -0
- package/initramfs/buninu/bin/xdg-open.bat +3 -0
- package/initramfs/buninu/demo-server.js +64 -0
- package/initramfs/buninu/icon.png +0 -0
- package/initramfs/buninu/package.json +59 -0
- package/initramfs/etc/resolv.conf +1 -0
- package/initramfs/init.js +339 -0
- package/initramfs/lib/ld-musl-x86_64.so.1 +0 -0
- package/initramfs/lib/libc.musl-x86_64.so.1 +0 -0
- package/initramfs/lib/libgcc_s.so.1 +0 -0
- package/initramfs/lib/libstdc++.so.6 +0 -0
- package/initramfs/usr/bin/env +7 -0
- package/package.json +42 -0
- package/run-qemu.sh +44 -0
- package/scripts/fetch.sh +26 -0
- package/scripts/pack-initramfs.sh +41 -0
- package/test/build-init-bootstrap.sh +23 -0
- package/test/init-bootstrap.c +55 -0
|
@@ -0,0 +1,1101 @@
|
|
|
1
|
+
(function () {
|
|
2
|
+
const MSG_OUTPUT = "1";
|
|
3
|
+
const MSG_KITTY = "7";
|
|
4
|
+
const DEFAULT_TOUCH_SCROLL_THRESHOLD = 24;
|
|
5
|
+
const overlay = document.getElementById("kitty-overlay");
|
|
6
|
+
const terminal = document.getElementById("terminal");
|
|
7
|
+
const KITTY_TRACE = Boolean(window.gotty_kitty_trace);
|
|
8
|
+
const state = {
|
|
9
|
+
cols: 80,
|
|
10
|
+
rows: 24,
|
|
11
|
+
placements: new Map(),
|
|
12
|
+
scrollBound: false,
|
|
13
|
+
renderBound: false,
|
|
14
|
+
renderDisposables: [],
|
|
15
|
+
relayoutFrame: 0,
|
|
16
|
+
outputTail: "",
|
|
17
|
+
recentCursorHome: false,
|
|
18
|
+
recentClearLineCount: 0,
|
|
19
|
+
touchBound: false,
|
|
20
|
+
touchScroll: null,
|
|
21
|
+
contextMenu: null,
|
|
22
|
+
imageContextBound: false,
|
|
23
|
+
socket: null,
|
|
24
|
+
// False until the client has sent its first resize. Until then cols/rows
|
|
25
|
+
// above are placeholders, not the PTY's real geometry.
|
|
26
|
+
sizeFromClient: false
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
// The PTY size only reaches us through the resize messages the client
|
|
30
|
+
// sends. A placement that arrives before the first of those would be laid
|
|
31
|
+
// out against 80x24 instead of the terminal the user is looking at, so
|
|
32
|
+
// borrow xterm's own geometry until the real size shows up.
|
|
33
|
+
function syncViewerSize() {
|
|
34
|
+
if (state.sizeFromClient) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
const xterm = terminal && terminal.__gottyXterm;
|
|
38
|
+
if (!xterm) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
if (Number.isFinite(xterm.cols) && xterm.cols > 0) {
|
|
42
|
+
state.cols = xterm.cols;
|
|
43
|
+
}
|
|
44
|
+
if (Number.isFinite(xterm.rows) && xterm.rows > 0) {
|
|
45
|
+
state.rows = xterm.rows;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function browserTerminalState() {
|
|
50
|
+
const xterm = terminal && terminal.__gottyXterm;
|
|
51
|
+
const active = xterm && xterm.buffer && xterm.buffer.active;
|
|
52
|
+
if (!active) {
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
const { screen, viewport } = xtermElements();
|
|
56
|
+
const terminalRect = terminal.getBoundingClientRect();
|
|
57
|
+
const screenRect = screen && screen.getBoundingClientRect();
|
|
58
|
+
const viewportRect = viewport && viewport.getBoundingClientRect();
|
|
59
|
+
return {
|
|
60
|
+
type: active.type || null,
|
|
61
|
+
baseY: active.baseY,
|
|
62
|
+
viewportY: active.viewportY,
|
|
63
|
+
cursorX: active.cursorX,
|
|
64
|
+
cursorY: active.cursorY,
|
|
65
|
+
cursorCol: active.cursorX + 1,
|
|
66
|
+
cursorRow: active.cursorY + 1,
|
|
67
|
+
absoluteCursorRow: active.baseY + active.cursorY + 1,
|
|
68
|
+
windowInnerWidth: window.innerWidth,
|
|
69
|
+
documentClientWidth: document.documentElement.clientWidth,
|
|
70
|
+
terminalWidth: terminalRect.width,
|
|
71
|
+
screenWidth: screenRect?.width ?? null,
|
|
72
|
+
viewportWidth: viewportRect?.width ?? null,
|
|
73
|
+
viewportClientWidth: viewport?.clientWidth ?? null,
|
|
74
|
+
viewportScrollWidth: viewport?.scrollWidth ?? null,
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function sendBrowserDebug(stage, details = {}) {
|
|
79
|
+
if (!KITTY_TRACE) {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
const socket = state.socket;
|
|
83
|
+
if (!socket || socket.readyState !== 1) {
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
try {
|
|
87
|
+
socket.send("K" + JSON.stringify({
|
|
88
|
+
stage,
|
|
89
|
+
terminal: browserTerminalState(),
|
|
90
|
+
...details,
|
|
91
|
+
}));
|
|
92
|
+
} catch (error) {}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function xtermElements() {
|
|
96
|
+
if (!terminal) {
|
|
97
|
+
return {};
|
|
98
|
+
}
|
|
99
|
+
return {
|
|
100
|
+
xterm: terminal.querySelector(".xterm"),
|
|
101
|
+
screen: terminal.querySelector(".xterm-screen"),
|
|
102
|
+
rows: terminal.querySelector(".xterm-rows"),
|
|
103
|
+
viewport: terminal.querySelector(".xterm-viewport"),
|
|
104
|
+
helper: terminal.querySelector(".xterm-helper-textarea")
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function ensureOverlayBounds() {
|
|
109
|
+
if (!overlay || !terminal) {
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
const { screen } = xtermElements();
|
|
113
|
+
const containerRect = terminal.getBoundingClientRect();
|
|
114
|
+
const rect = screen ? screen.getBoundingClientRect() : containerRect;
|
|
115
|
+
overlay.style.left = `${rect.left - containerRect.left}px`;
|
|
116
|
+
overlay.style.top = `${rect.top - containerRect.top}px`;
|
|
117
|
+
overlay.style.width = `${rect.width}px`;
|
|
118
|
+
overlay.style.height = `${rect.height}px`;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
function cellMetrics() {
|
|
122
|
+
ensureOverlayBounds();
|
|
123
|
+
const { screen, rows } = xtermElements();
|
|
124
|
+
const rect = (screen || terminal).getBoundingClientRect();
|
|
125
|
+
let cellWidth = rect.width / Math.max(1, state.cols);
|
|
126
|
+
let cellHeight = rect.height / Math.max(1, state.rows);
|
|
127
|
+
const xterm = terminal && terminal.__gottyXterm;
|
|
128
|
+
const rendererCell = xterm && xterm._core && xterm._core._renderService &&
|
|
129
|
+
xterm._core._renderService.dimensions &&
|
|
130
|
+
xterm._core._renderService.dimensions.css &&
|
|
131
|
+
xterm._core._renderService.dimensions.css.cell;
|
|
132
|
+
|
|
133
|
+
if (rendererCell) {
|
|
134
|
+
if (Number.isFinite(rendererCell.width) && rendererCell.width > 0) {
|
|
135
|
+
cellWidth = rendererCell.width;
|
|
136
|
+
}
|
|
137
|
+
if (Number.isFinite(rendererCell.height) && rendererCell.height > 0) {
|
|
138
|
+
cellHeight = rendererCell.height;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
if (rows) {
|
|
143
|
+
const firstRow = rows.firstElementChild;
|
|
144
|
+
if (firstRow) {
|
|
145
|
+
const rowRect = firstRow.getBoundingClientRect();
|
|
146
|
+
if (rowRect.height > 0) {
|
|
147
|
+
cellHeight = rowRect.height;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
return {
|
|
153
|
+
width: cellWidth,
|
|
154
|
+
height: cellHeight
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
function anchorOffset() {
|
|
159
|
+
return {
|
|
160
|
+
left: 0,
|
|
161
|
+
top: 0
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
function placementKey(message) {
|
|
166
|
+
const control = message.control || {};
|
|
167
|
+
const imageId = control.i || control.I || (message.image && message.image.id) || "anon";
|
|
168
|
+
return `${imageId}:${control.p || "0"}`;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
function currentViewportY() {
|
|
172
|
+
const xterm = terminal && terminal.__gottyXterm;
|
|
173
|
+
const active = xterm && xterm.buffer && xterm.buffer.active;
|
|
174
|
+
return active ? active.viewportY : 0;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
function createPlacementMarker(cursor) {
|
|
178
|
+
syncViewerSize();
|
|
179
|
+
const xterm = terminal && terminal.__gottyXterm;
|
|
180
|
+
if (!xterm || typeof xterm.registerMarker !== "function") {
|
|
181
|
+
return null;
|
|
182
|
+
}
|
|
183
|
+
try {
|
|
184
|
+
const active = xterm.buffer && xterm.buffer.active;
|
|
185
|
+
let offset = 0;
|
|
186
|
+
if (active && cursor && Number.isFinite(cursor.bufferRow)) {
|
|
187
|
+
const currentBufferRow = active.baseY + active.cursorY + 1;
|
|
188
|
+
offset = Math.trunc(cursor.bufferRow - currentBufferRow);
|
|
189
|
+
} else if (
|
|
190
|
+
active && cursor && Number.isFinite(cursor.row) &&
|
|
191
|
+
cursor.row >= 1 && cursor.row <= state.rows
|
|
192
|
+
) {
|
|
193
|
+
// Kitty's cursor row is 1-based within the live terminal screen.
|
|
194
|
+
// registerMarker() takes an offset from xterm's current 0-based row.
|
|
195
|
+
offset = Math.trunc(cursor.row - (active.cursorY + 1));
|
|
196
|
+
}
|
|
197
|
+
const marker = xterm.registerMarker(offset);
|
|
198
|
+
sendBrowserDebug("marker-created", {
|
|
199
|
+
protocolCursor: cursor,
|
|
200
|
+
offset,
|
|
201
|
+
markerLine: marker?.line ?? null,
|
|
202
|
+
});
|
|
203
|
+
return marker;
|
|
204
|
+
} catch (error) {
|
|
205
|
+
return null;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
function disposePlacementMarker(node) {
|
|
210
|
+
if (!node || !node.__kittyMarker) {
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
try {
|
|
214
|
+
node.__kittyMarker.dispose();
|
|
215
|
+
} catch (error) {
|
|
216
|
+
// The marker may already have been disposed by xterm buffer trimming.
|
|
217
|
+
}
|
|
218
|
+
node.__kittyMarker = null;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
function removePlacementNode(node) {
|
|
222
|
+
if (!node) {
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
disposePlacementMarker(node);
|
|
226
|
+
node.__kittyGeneration = (node.__kittyGeneration || 0) + 1;
|
|
227
|
+
revokeNodeUrl(node);
|
|
228
|
+
node.remove();
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
function decodeRawImage(image) {
|
|
232
|
+
const binary = atob(image.data);
|
|
233
|
+
const bytes = new Uint8ClampedArray(binary.length);
|
|
234
|
+
for (let i = 0; i < binary.length; i += 1) {
|
|
235
|
+
bytes[i] = binary.charCodeAt(i);
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
let rgba;
|
|
239
|
+
if (image.format === 32) {
|
|
240
|
+
rgba = bytes;
|
|
241
|
+
} else if (image.format === 24) {
|
|
242
|
+
rgba = new Uint8ClampedArray((bytes.length / 3) * 4);
|
|
243
|
+
for (let src = 0, dst = 0; src < bytes.length; src += 3, dst += 4) {
|
|
244
|
+
rgba[dst] = bytes[src];
|
|
245
|
+
rgba[dst + 1] = bytes[src + 1];
|
|
246
|
+
rgba[dst + 2] = bytes[src + 2];
|
|
247
|
+
rgba[dst + 3] = 255;
|
|
248
|
+
}
|
|
249
|
+
} else {
|
|
250
|
+
return null;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
const canvas = document.createElement("canvas");
|
|
254
|
+
canvas.width = image.width;
|
|
255
|
+
canvas.height = image.height;
|
|
256
|
+
const context = canvas.getContext("2d");
|
|
257
|
+
context.putImageData(new ImageData(rgba, image.width, image.height), 0, 0);
|
|
258
|
+
return canvas;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
function binaryFromBase64(base64) {
|
|
262
|
+
const binary = atob(base64);
|
|
263
|
+
const bytes = new Uint8Array(binary.length);
|
|
264
|
+
for (let i = 0; i < binary.length; i += 1) {
|
|
265
|
+
bytes[i] = binary.charCodeAt(i);
|
|
266
|
+
}
|
|
267
|
+
return bytes;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
function stringFromBase64(base64) {
|
|
271
|
+
return atob(base64);
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
function inferBlobMimeType(image, control) {
|
|
275
|
+
const explicit = control && (control.U || control.mime);
|
|
276
|
+
if (explicit) {
|
|
277
|
+
return explicit;
|
|
278
|
+
}
|
|
279
|
+
if (!image) {
|
|
280
|
+
return "application/octet-stream";
|
|
281
|
+
}
|
|
282
|
+
if (image.format === 100) {
|
|
283
|
+
return "image/png";
|
|
284
|
+
}
|
|
285
|
+
return "application/octet-stream";
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
function canvasToBlob(canvas) {
|
|
289
|
+
return new Promise((resolve, reject) => {
|
|
290
|
+
canvas.toBlob((blob) => {
|
|
291
|
+
if (blob) {
|
|
292
|
+
resolve(blob);
|
|
293
|
+
return;
|
|
294
|
+
}
|
|
295
|
+
reject(new Error("Failed to create blob from canvas"));
|
|
296
|
+
}, "image/png");
|
|
297
|
+
});
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
function sourceRectangle(width, height, control = {}) {
|
|
301
|
+
const sourceWidth = Math.max(1, Math.trunc(Number(width) || 1));
|
|
302
|
+
const sourceHeight = Math.max(1, Math.trunc(Number(height) || 1));
|
|
303
|
+
const requestedX = Math.max(0, Math.trunc(Number.parseInt(control.x || "0", 10) || 0));
|
|
304
|
+
const requestedY = Math.max(0, Math.trunc(Number.parseInt(control.y || "0", 10) || 0));
|
|
305
|
+
const requestedWidth = Math.max(0, Math.trunc(Number.parseInt(control.w || "0", 10) || 0));
|
|
306
|
+
const requestedHeight = Math.max(0, Math.trunc(Number.parseInt(control.h || "0", 10) || 0));
|
|
307
|
+
const right = requestedWidth > 0 ? requestedX + requestedWidth : sourceWidth;
|
|
308
|
+
const bottom = requestedHeight > 0 ? requestedY + requestedHeight : sourceHeight;
|
|
309
|
+
const x = Math.min(sourceWidth, requestedX);
|
|
310
|
+
const y = Math.min(sourceHeight, requestedY);
|
|
311
|
+
const clippedRight = Math.min(sourceWidth, Math.max(x, right));
|
|
312
|
+
const clippedBottom = Math.min(sourceHeight, Math.max(y, bottom));
|
|
313
|
+
const cropWidth = clippedRight - x;
|
|
314
|
+
const cropHeight = clippedBottom - y;
|
|
315
|
+
if (cropWidth < 1 || cropHeight < 1) {
|
|
316
|
+
return null;
|
|
317
|
+
}
|
|
318
|
+
return {
|
|
319
|
+
x,
|
|
320
|
+
y,
|
|
321
|
+
width: cropWidth,
|
|
322
|
+
height: cropHeight,
|
|
323
|
+
sourceWidth,
|
|
324
|
+
sourceHeight,
|
|
325
|
+
cropped: x !== 0 || y !== 0 || cropWidth !== sourceWidth || cropHeight !== sourceHeight,
|
|
326
|
+
};
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
async function blobDimensions(blob) {
|
|
330
|
+
if (typeof createImageBitmap === "function") {
|
|
331
|
+
const bitmap = await createImageBitmap(blob);
|
|
332
|
+
const dimensions = { width: bitmap.width, height: bitmap.height };
|
|
333
|
+
bitmap.close();
|
|
334
|
+
return dimensions;
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
return new Promise((resolve, reject) => {
|
|
338
|
+
const probe = new Image();
|
|
339
|
+
const url = URL.createObjectURL(blob);
|
|
340
|
+
probe.onload = () => {
|
|
341
|
+
const dimensions = {
|
|
342
|
+
width: probe.naturalWidth,
|
|
343
|
+
height: probe.naturalHeight
|
|
344
|
+
};
|
|
345
|
+
URL.revokeObjectURL(url);
|
|
346
|
+
resolve(dimensions);
|
|
347
|
+
};
|
|
348
|
+
probe.onerror = (error) => {
|
|
349
|
+
URL.revokeObjectURL(url);
|
|
350
|
+
reject(error);
|
|
351
|
+
};
|
|
352
|
+
probe.src = url;
|
|
353
|
+
});
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
async function resolveImageAsset(image, control = {}) {
|
|
357
|
+
if (!image) {
|
|
358
|
+
return null;
|
|
359
|
+
}
|
|
360
|
+
let blob;
|
|
361
|
+
let dimensions;
|
|
362
|
+
if (image.format === 100) {
|
|
363
|
+
blob = new Blob([binaryFromBase64(image.data)], {
|
|
364
|
+
type: inferBlobMimeType(image, image.control || {})
|
|
365
|
+
});
|
|
366
|
+
dimensions = await blobDimensions(blob);
|
|
367
|
+
} else {
|
|
368
|
+
const canvas = decodeRawImage(image);
|
|
369
|
+
if (!canvas) {
|
|
370
|
+
return null;
|
|
371
|
+
}
|
|
372
|
+
blob = await canvasToBlob(canvas);
|
|
373
|
+
dimensions = { width: canvas.width, height: canvas.height };
|
|
374
|
+
}
|
|
375
|
+
const sourceRect = sourceRectangle(dimensions.width, dimensions.height, control);
|
|
376
|
+
if (!sourceRect) {
|
|
377
|
+
return null;
|
|
378
|
+
}
|
|
379
|
+
return {
|
|
380
|
+
blob,
|
|
381
|
+
width: sourceRect.width,
|
|
382
|
+
height: sourceRect.height,
|
|
383
|
+
sourceRect,
|
|
384
|
+
};
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
function revokeNodeUrl(node) {
|
|
388
|
+
if (node && node.__kittyObjectUrl) {
|
|
389
|
+
URL.revokeObjectURL(node.__kittyObjectUrl);
|
|
390
|
+
node.__kittyObjectUrl = "";
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
function layoutNode(node) {
|
|
395
|
+
if (!node || !node.__kittyPlacement) {
|
|
396
|
+
return;
|
|
397
|
+
}
|
|
398
|
+
const { control, cursor, intrinsicWidth, intrinsicHeight, sourceRect } = node.__kittyPlacement;
|
|
399
|
+
syncViewerSize();
|
|
400
|
+
const metrics = cellMetrics();
|
|
401
|
+
const anchor = anchorOffset();
|
|
402
|
+
const controlCols = Math.max(0, Number.parseInt(control.c || "0", 10) || 0);
|
|
403
|
+
const controlRows = Math.max(0, Number.parseInt(control.r || "0", 10) || 0);
|
|
404
|
+
let requestedCols;
|
|
405
|
+
let requestedRows;
|
|
406
|
+
if (controlCols > 0 && controlRows > 0) {
|
|
407
|
+
requestedCols = controlCols;
|
|
408
|
+
requestedRows = controlRows;
|
|
409
|
+
} else if (controlCols > 0) {
|
|
410
|
+
requestedCols = controlCols;
|
|
411
|
+
requestedRows = Math.max(1, Math.round(
|
|
412
|
+
controlCols * metrics.width * intrinsicHeight / intrinsicWidth / metrics.height,
|
|
413
|
+
));
|
|
414
|
+
} else if (controlRows > 0) {
|
|
415
|
+
requestedRows = controlRows;
|
|
416
|
+
requestedCols = Math.max(1, Math.round(
|
|
417
|
+
controlRows * metrics.height * intrinsicWidth / intrinsicHeight / metrics.width,
|
|
418
|
+
));
|
|
419
|
+
} else {
|
|
420
|
+
requestedCols = Math.max(1, Math.round(intrinsicWidth / Math.max(1, metrics.width)));
|
|
421
|
+
requestedRows = Math.max(1, Math.round(intrinsicHeight / Math.max(1, metrics.height)));
|
|
422
|
+
}
|
|
423
|
+
const xterm = terminal && terminal.__gottyXterm;
|
|
424
|
+
const viewerCols = Math.max(1, Math.trunc(Number(xterm?.cols) || state.cols));
|
|
425
|
+
const viewerRows = Math.max(1, Math.trunc(Number(xterm?.rows) || state.rows));
|
|
426
|
+
const cursorCol = Math.max(1, Math.trunc(Number(cursor?.col) || 1));
|
|
427
|
+
// A fixed-width PTY may be wider than the browser's xterm instance. Match
|
|
428
|
+
// viu's final-column safety margin using the viewer's real column count,
|
|
429
|
+
// then scale both axes so the image is visible rather than merely clipped.
|
|
430
|
+
const availableViewerCols = Math.max(1, viewerCols - cursorCol);
|
|
431
|
+
const scale = Math.min(1, availableViewerCols / requestedCols);
|
|
432
|
+
const cols = Math.max(1, Math.min(requestedCols, availableViewerCols));
|
|
433
|
+
const rows = Math.max(1, Math.round(requestedRows * scale));
|
|
434
|
+
const marker = node.__kittyMarker;
|
|
435
|
+
const activeBuffer = xterm?.buffer?.active;
|
|
436
|
+
const useProtocolRow = activeBuffer?.type === "alternate" && cursor && Number.isFinite(cursor.row);
|
|
437
|
+
const row = useProtocolRow
|
|
438
|
+
? cursor.row
|
|
439
|
+
: marker && !marker.isDisposed && Number.isFinite(marker.line)
|
|
440
|
+
? marker.line - currentViewportY() + 1
|
|
441
|
+
: cursor && Number.isFinite(cursor.bufferRow)
|
|
442
|
+
? cursor.bufferRow - currentViewportY()
|
|
443
|
+
: (cursor && cursor.row) || 1;
|
|
444
|
+
// Fixed-size PTYs can have more rows than the browser-side xterm. Leave
|
|
445
|
+
// the viewer's final row for the TUI status line in that mismatch mode.
|
|
446
|
+
const viewerBottomRow = Math.max(1, viewerRows - (viewerRows < state.rows ? 1 : 0));
|
|
447
|
+
const visibleRows = Math.max(0, Math.min(rows, viewerBottomRow - row + 1));
|
|
448
|
+
node.style.display = visibleRows > 0 ? "block" : "none";
|
|
449
|
+
node.style.left = `${anchor.left + (Math.max(1, cursor.col) - 1) * metrics.width}px`;
|
|
450
|
+
node.style.top = `${anchor.top + (row - 1) * metrics.height}px`;
|
|
451
|
+
node.style.width = `${cols * metrics.width}px`;
|
|
452
|
+
node.style.height = `${visibleRows * metrics.height}px`;
|
|
453
|
+
node.style.zIndex = String(Number.parseInt(control.z || "0", 10) || 0);
|
|
454
|
+
const imageElement = node.__kittyImageElement;
|
|
455
|
+
if (imageElement && sourceRect) {
|
|
456
|
+
const targetWidth = cols * metrics.width;
|
|
457
|
+
const targetHeight = rows * metrics.height;
|
|
458
|
+
const sourceScaleX = targetWidth / sourceRect.width;
|
|
459
|
+
const sourceScaleY = targetHeight / sourceRect.height;
|
|
460
|
+
imageElement.style.left = `${-sourceRect.x * sourceScaleX}px`;
|
|
461
|
+
imageElement.style.top = `${-sourceRect.y * sourceScaleY}px`;
|
|
462
|
+
imageElement.style.width = `${sourceRect.sourceWidth * sourceScaleX}px`;
|
|
463
|
+
imageElement.style.height = `${sourceRect.sourceHeight * sourceScaleY}px`;
|
|
464
|
+
}
|
|
465
|
+
const { screen, viewport } = xtermElements();
|
|
466
|
+
const overlayRect = overlay.getBoundingClientRect();
|
|
467
|
+
const terminalRect = terminal.getBoundingClientRect();
|
|
468
|
+
const screenRect = screen && screen.getBoundingClientRect();
|
|
469
|
+
const viewportRect = viewport && viewport.getBoundingClientRect();
|
|
470
|
+
sendBrowserDebug("layout", {
|
|
471
|
+
imageId: control.i || control.I || null,
|
|
472
|
+
placementId: control.p || null,
|
|
473
|
+
requestedCols,
|
|
474
|
+
requestedRows,
|
|
475
|
+
viewerCols,
|
|
476
|
+
viewerRows,
|
|
477
|
+
viewerBottomRow,
|
|
478
|
+
terminalVisibleRows: visibleRows,
|
|
479
|
+
availableViewerCols,
|
|
480
|
+
viewerScale: scale,
|
|
481
|
+
positionSource: useProtocolRow ? "protocol" : "marker",
|
|
482
|
+
sourceRect: sourceRect || null,
|
|
483
|
+
protocolCursor: cursor,
|
|
484
|
+
markerLine: marker?.line ?? null,
|
|
485
|
+
markerDisposed: marker?.isDisposed ?? null,
|
|
486
|
+
currentViewportY: currentViewportY(),
|
|
487
|
+
selectedRow: row,
|
|
488
|
+
cssLeft: node.style.left,
|
|
489
|
+
cssTop: node.style.top,
|
|
490
|
+
cssWidth: node.style.width,
|
|
491
|
+
cssHeight: node.style.height,
|
|
492
|
+
cellWidth: metrics.width,
|
|
493
|
+
cellHeight: metrics.height,
|
|
494
|
+
geometry: {
|
|
495
|
+
windowInnerWidth: window.innerWidth,
|
|
496
|
+
documentClientWidth: document.documentElement.clientWidth,
|
|
497
|
+
terminalWidth: terminalRect.width,
|
|
498
|
+
screenWidth: screenRect?.width ?? null,
|
|
499
|
+
viewportWidth: viewportRect?.width ?? null,
|
|
500
|
+
viewportClientWidth: viewport?.clientWidth ?? null,
|
|
501
|
+
viewportScrollWidth: viewport?.scrollWidth ?? null,
|
|
502
|
+
overlayWidth: overlayRect.width,
|
|
503
|
+
overlayClientWidth: overlay.clientWidth,
|
|
504
|
+
overlayScrollWidth: overlay.scrollWidth,
|
|
505
|
+
overlayComputedWidth: getComputedStyle(overlay).width,
|
|
506
|
+
overlayOverflow: getComputedStyle(overlay).overflow,
|
|
507
|
+
},
|
|
508
|
+
});
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
function relayoutAll() {
|
|
512
|
+
ensureOverlayBounds();
|
|
513
|
+
for (const node of state.placements.values()) {
|
|
514
|
+
layoutNode(node);
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
function scheduleRelayout() {
|
|
519
|
+
if (state.relayoutFrame) {
|
|
520
|
+
return;
|
|
521
|
+
}
|
|
522
|
+
state.relayoutFrame = requestAnimationFrame(() => {
|
|
523
|
+
state.relayoutFrame = 0;
|
|
524
|
+
relayoutAll();
|
|
525
|
+
});
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
function bindViewportScroll() {
|
|
529
|
+
if (state.scrollBound) {
|
|
530
|
+
return;
|
|
531
|
+
}
|
|
532
|
+
const { viewport } = xtermElements();
|
|
533
|
+
if (!viewport) {
|
|
534
|
+
return;
|
|
535
|
+
}
|
|
536
|
+
viewport.addEventListener("scroll", () => {
|
|
537
|
+
sendBrowserDebug("viewport-scroll", { currentViewportY: currentViewportY() });
|
|
538
|
+
relayoutAll();
|
|
539
|
+
}, { passive: true });
|
|
540
|
+
state.scrollBound = true;
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
function bindTerminalRender() {
|
|
544
|
+
if (state.renderBound || !terminal) {
|
|
545
|
+
return;
|
|
546
|
+
}
|
|
547
|
+
const xterm = terminal.__gottyXterm;
|
|
548
|
+
if (!xterm) {
|
|
549
|
+
return;
|
|
550
|
+
}
|
|
551
|
+
if (typeof xterm.onRender === "function") {
|
|
552
|
+
state.renderDisposables.push(xterm.onRender(() => {
|
|
553
|
+
scheduleRelayout();
|
|
554
|
+
}));
|
|
555
|
+
}
|
|
556
|
+
if (typeof xterm.onWriteParsed === "function") {
|
|
557
|
+
state.renderDisposables.push(xterm.onWriteParsed(() => {
|
|
558
|
+
scheduleRelayout();
|
|
559
|
+
}));
|
|
560
|
+
}
|
|
561
|
+
state.renderBound = state.renderDisposables.length > 0;
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
function dispatchSyntheticWheel(target, touch, deltaX, deltaY) {
|
|
565
|
+
if (!target) {
|
|
566
|
+
return;
|
|
567
|
+
}
|
|
568
|
+
const event = new WheelEvent("wheel", {
|
|
569
|
+
bubbles: true,
|
|
570
|
+
cancelable: true,
|
|
571
|
+
deltaMode: WheelEvent.DOM_DELTA_LINE,
|
|
572
|
+
deltaX,
|
|
573
|
+
deltaY,
|
|
574
|
+
clientX: touch.clientX,
|
|
575
|
+
clientY: touch.clientY
|
|
576
|
+
});
|
|
577
|
+
target.dispatchEvent(event);
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
function touchScrollThreshold() {
|
|
581
|
+
const configured = Number(window.touchScrollThreshold);
|
|
582
|
+
if (Number.isFinite(configured) && configured > 0) {
|
|
583
|
+
return configured;
|
|
584
|
+
}
|
|
585
|
+
return DEFAULT_TOUCH_SCROLL_THRESHOLD;
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
function bindTouchScrolling() {
|
|
589
|
+
if (state.touchBound || !terminal) {
|
|
590
|
+
return;
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
const bindTarget = terminal;
|
|
594
|
+
const activeTouchId = () => state.touchScroll && state.touchScroll.identifier;
|
|
595
|
+
const wheelTarget = () => {
|
|
596
|
+
const { screen, viewport, xterm } = xtermElements();
|
|
597
|
+
return screen || viewport || xterm || terminal;
|
|
598
|
+
};
|
|
599
|
+
|
|
600
|
+
bindTarget.addEventListener("touchstart", (event) => {
|
|
601
|
+
if (event.touches.length !== 1) {
|
|
602
|
+
state.touchScroll = null;
|
|
603
|
+
return;
|
|
604
|
+
}
|
|
605
|
+
const touch = event.touches[0];
|
|
606
|
+
state.touchScroll = {
|
|
607
|
+
identifier: touch.identifier,
|
|
608
|
+
lastX: touch.clientX,
|
|
609
|
+
lastY: touch.clientY,
|
|
610
|
+
residualX: 0,
|
|
611
|
+
residualY: 0
|
|
612
|
+
};
|
|
613
|
+
}, { passive: true });
|
|
614
|
+
|
|
615
|
+
bindTarget.addEventListener("touchmove", (event) => {
|
|
616
|
+
if (!state.touchScroll) {
|
|
617
|
+
return;
|
|
618
|
+
}
|
|
619
|
+
const touch = Array.from(event.touches).find((entry) => entry.identifier === activeTouchId());
|
|
620
|
+
if (!touch) {
|
|
621
|
+
return;
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
const deltaX = state.touchScroll.lastX - touch.clientX;
|
|
625
|
+
const deltaY = state.touchScroll.lastY - touch.clientY;
|
|
626
|
+
state.touchScroll.lastX = touch.clientX;
|
|
627
|
+
state.touchScroll.lastY = touch.clientY;
|
|
628
|
+
state.touchScroll.residualX += deltaX;
|
|
629
|
+
state.touchScroll.residualY += deltaY;
|
|
630
|
+
|
|
631
|
+
const threshold = touchScrollThreshold();
|
|
632
|
+
const stepX = state.touchScroll.residualX >= 0 ? 1 : -1;
|
|
633
|
+
const stepY = state.touchScroll.residualY >= 0 ? 1 : -1;
|
|
634
|
+
const ticksX = Math.trunc(Math.abs(state.touchScroll.residualX) / threshold);
|
|
635
|
+
const ticksY = Math.trunc(Math.abs(state.touchScroll.residualY) / threshold);
|
|
636
|
+
|
|
637
|
+
if (ticksX === 0 && ticksY === 0) {
|
|
638
|
+
return;
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
event.preventDefault();
|
|
642
|
+
const target = wheelTarget();
|
|
643
|
+
const count = Math.max(ticksX, ticksY);
|
|
644
|
+
for (let i = 0; i < count; i += 1) {
|
|
645
|
+
dispatchSyntheticWheel(
|
|
646
|
+
target,
|
|
647
|
+
touch,
|
|
648
|
+
i < ticksX ? stepX : 0,
|
|
649
|
+
i < ticksY ? stepY : 0
|
|
650
|
+
);
|
|
651
|
+
}
|
|
652
|
+
state.touchScroll.residualX -= ticksX * threshold * stepX;
|
|
653
|
+
state.touchScroll.residualY -= ticksY * threshold * stepY;
|
|
654
|
+
}, { passive: false });
|
|
655
|
+
|
|
656
|
+
const clearTouchScroll = () => {
|
|
657
|
+
state.touchScroll = null;
|
|
658
|
+
};
|
|
659
|
+
bindTarget.addEventListener("touchend", clearTouchScroll, { passive: true });
|
|
660
|
+
bindTarget.addEventListener("touchcancel", clearTouchScroll, { passive: true });
|
|
661
|
+
state.touchBound = true;
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
function ensureContextMenu() {
|
|
665
|
+
if (state.contextMenu) {
|
|
666
|
+
return state.contextMenu;
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
const menu = document.createElement("div");
|
|
670
|
+
menu.className = "kitty-context-menu";
|
|
671
|
+
menu.hidden = true;
|
|
672
|
+
|
|
673
|
+
const removeButton = document.createElement("button");
|
|
674
|
+
removeButton.type = "button";
|
|
675
|
+
removeButton.className = "kitty-context-menu__item";
|
|
676
|
+
removeButton.textContent = "Remove image";
|
|
677
|
+
menu.appendChild(removeButton);
|
|
678
|
+
|
|
679
|
+
state.contextMenu = {
|
|
680
|
+
root: menu,
|
|
681
|
+
removeButton,
|
|
682
|
+
targetKey: null
|
|
683
|
+
};
|
|
684
|
+
|
|
685
|
+
document.body.appendChild(menu);
|
|
686
|
+
|
|
687
|
+
let remClick = (e) => {
|
|
688
|
+
|
|
689
|
+
e.preventDefault();
|
|
690
|
+
e.stopPropagation();
|
|
691
|
+
|
|
692
|
+
if (!state.contextMenu || !state.contextMenu.targetKey) {
|
|
693
|
+
return;
|
|
694
|
+
}
|
|
695
|
+
const node = state.placements.get(state.contextMenu.targetKey);
|
|
696
|
+
if (node) {
|
|
697
|
+
removePlacementNode(node);
|
|
698
|
+
state.placements.delete(state.contextMenu.targetKey);
|
|
699
|
+
}
|
|
700
|
+
hideContextMenu();
|
|
701
|
+
};
|
|
702
|
+
|
|
703
|
+
removeButton.addEventListener("click",remClick)
|
|
704
|
+
removeButton.addEventListener("contextmenu",remClick)
|
|
705
|
+
|
|
706
|
+
document.addEventListener("pointerdown", (event) => {
|
|
707
|
+
if (!state.contextMenu || state.contextMenu.root.hidden) {
|
|
708
|
+
return;
|
|
709
|
+
}
|
|
710
|
+
if (state.contextMenu.root.contains(event.target)) {
|
|
711
|
+
return;
|
|
712
|
+
}
|
|
713
|
+
hideContextMenu();
|
|
714
|
+
}, { passive: true });
|
|
715
|
+
|
|
716
|
+
//window.addEventListener("blur", hideContextMenu);
|
|
717
|
+
//window.addEventListener("resize", hideContextMenu);
|
|
718
|
+
|
|
719
|
+
return state.contextMenu;
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
function showContextMenu(x, y, key) {
|
|
723
|
+
const menu = ensureContextMenu();
|
|
724
|
+
menu.targetKey = key;
|
|
725
|
+
menu.root.hidden = false;
|
|
726
|
+
|
|
727
|
+
const margin = 10;
|
|
728
|
+
const rect = menu.root.getBoundingClientRect();
|
|
729
|
+
let left = x - rect.width - margin;
|
|
730
|
+
if (left < margin) {
|
|
731
|
+
left = Math.min(window.innerWidth - rect.width - margin, x + margin);
|
|
732
|
+
}
|
|
733
|
+
if (left < margin) {
|
|
734
|
+
left = margin;
|
|
735
|
+
}
|
|
736
|
+
|
|
737
|
+
let top = y - rect.height - margin;
|
|
738
|
+
if (top < margin) {
|
|
739
|
+
top = Math.min(window.innerHeight - rect.height - margin, y + margin);
|
|
740
|
+
}
|
|
741
|
+
if (top < margin) {
|
|
742
|
+
top = margin;
|
|
743
|
+
}
|
|
744
|
+
|
|
745
|
+
menu.root.style.left = `${left}px`;
|
|
746
|
+
menu.root.style.top = `${top}px`;
|
|
747
|
+
}
|
|
748
|
+
|
|
749
|
+
function hideContextMenu() {
|
|
750
|
+
if (!state.contextMenu) {
|
|
751
|
+
return;
|
|
752
|
+
}
|
|
753
|
+
state.contextMenu.targetKey = null;
|
|
754
|
+
state.contextMenu.root.hidden = true;
|
|
755
|
+
}
|
|
756
|
+
|
|
757
|
+
function placementAtPoint(clientX, clientY) {
|
|
758
|
+
let found = null;
|
|
759
|
+
let foundZ = -Infinity;
|
|
760
|
+
let foundIndex = -1;
|
|
761
|
+
let index = 0;
|
|
762
|
+
for (const [key, node] of state.placements.entries()) {
|
|
763
|
+
const rect = node.getBoundingClientRect();
|
|
764
|
+
if (
|
|
765
|
+
clientX >= rect.left &&
|
|
766
|
+
clientX <= rect.right &&
|
|
767
|
+
clientY >= rect.top &&
|
|
768
|
+
clientY <= rect.bottom
|
|
769
|
+
) {
|
|
770
|
+
const z = Number.parseInt(node.style.zIndex || "0", 10) || 0;
|
|
771
|
+
if (z > foundZ || (z === foundZ && index > foundIndex)) {
|
|
772
|
+
found = key;
|
|
773
|
+
foundZ = z;
|
|
774
|
+
foundIndex = index;
|
|
775
|
+
}
|
|
776
|
+
}
|
|
777
|
+
index += 1;
|
|
778
|
+
}
|
|
779
|
+
return found;
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
function bindImageContextMenu() {
|
|
783
|
+
if (state.imageContextBound || !terminal) {
|
|
784
|
+
return;
|
|
785
|
+
}
|
|
786
|
+
|
|
787
|
+
const handleRightClick = (event) => {
|
|
788
|
+
if (state.contextMenu && state.contextMenu.root.contains(event.target)) {
|
|
789
|
+
return;
|
|
790
|
+
}
|
|
791
|
+
if (event.target instanceof Element && event.target.closest(".xterm-overlay")) {
|
|
792
|
+
return;
|
|
793
|
+
}
|
|
794
|
+
const key = placementAtPoint(event.clientX, event.clientY);
|
|
795
|
+
if (!key) {
|
|
796
|
+
return;
|
|
797
|
+
}
|
|
798
|
+
event.preventDefault();
|
|
799
|
+
event.stopPropagation();
|
|
800
|
+
showContextMenu(event.clientX, event.clientY, key);
|
|
801
|
+
};
|
|
802
|
+
|
|
803
|
+
terminal.addEventListener("mousedown", (event) => {
|
|
804
|
+
if (event.button === 2) {
|
|
805
|
+
handleRightClick(event);
|
|
806
|
+
}
|
|
807
|
+
}, true);
|
|
808
|
+
|
|
809
|
+
terminal.addEventListener("contextmenu", handleRightClick, true);
|
|
810
|
+
state.imageContextBound = true;
|
|
811
|
+
}
|
|
812
|
+
|
|
813
|
+
async function placeImage(message) {
|
|
814
|
+
if (!overlay || !terminal || !message.image) {
|
|
815
|
+
return;
|
|
816
|
+
}
|
|
817
|
+
|
|
818
|
+
const key = placementKey(message);
|
|
819
|
+
const control = message.control || {};
|
|
820
|
+
const cursor = message.bufferCursor || message.cursor || { row: 1, col: 1 };
|
|
821
|
+
sendBrowserDebug("placement-start", {
|
|
822
|
+
key,
|
|
823
|
+
control,
|
|
824
|
+
protocolCursor: message.cursor || null,
|
|
825
|
+
selectedCursor: cursor,
|
|
826
|
+
});
|
|
827
|
+
if (message.image) {
|
|
828
|
+
message.image.control = control;
|
|
829
|
+
}
|
|
830
|
+
let node = state.placements.get(key);
|
|
831
|
+
if (!node) {
|
|
832
|
+
node = document.createElement("div");
|
|
833
|
+
node.className = "kitty-image";
|
|
834
|
+
const imageElement = document.createElement("img");
|
|
835
|
+
imageElement.className = "kitty-image__content";
|
|
836
|
+
imageElement.alt = "";
|
|
837
|
+
node.__kittyImageElement = imageElement;
|
|
838
|
+
node.appendChild(imageElement);
|
|
839
|
+
node.__kittyObjectUrl = "";
|
|
840
|
+
node.__kittyMarker = null;
|
|
841
|
+
node.addEventListener("contextmenu", (event) => {
|
|
842
|
+
showContextMenu(event.clientX, event.clientY, key);
|
|
843
|
+
});
|
|
844
|
+
state.placements.set(key, node);
|
|
845
|
+
overlay.appendChild(node);
|
|
846
|
+
}
|
|
847
|
+
|
|
848
|
+
disposePlacementMarker(node);
|
|
849
|
+
node.__kittyMarker = createPlacementMarker(cursor);
|
|
850
|
+
const generation = (node.__kittyGeneration || 0) + 1;
|
|
851
|
+
node.__kittyGeneration = generation;
|
|
852
|
+
|
|
853
|
+
// Bind before the decode, not after it. The server sends the placement
|
|
854
|
+
// ahead of the synthetic newlines that scroll room for the image, so the
|
|
855
|
+
// scroll this layout depends on can land while we are still decoding.
|
|
856
|
+
// Binding afterwards left the very first image of a session with no
|
|
857
|
+
// listener to correct it, which is why it could come out blank while
|
|
858
|
+
// every later image in the same session was fine.
|
|
859
|
+
bindViewportScroll();
|
|
860
|
+
bindTerminalRender();
|
|
861
|
+
bindTouchScrolling();
|
|
862
|
+
bindImageContextMenu();
|
|
863
|
+
|
|
864
|
+
const asset = await resolveImageAsset(message.image, control);
|
|
865
|
+
if (!asset || node.__kittyGeneration !== generation) {
|
|
866
|
+
return;
|
|
867
|
+
}
|
|
868
|
+
const objectUrl = URL.createObjectURL(asset.blob);
|
|
869
|
+
revokeNodeUrl(node);
|
|
870
|
+
node.__kittyObjectUrl = objectUrl;
|
|
871
|
+
node.__kittyPlacement = {
|
|
872
|
+
control,
|
|
873
|
+
cursor,
|
|
874
|
+
intrinsicWidth: asset.width,
|
|
875
|
+
intrinsicHeight: asset.height,
|
|
876
|
+
sourceRect: asset.sourceRect,
|
|
877
|
+
};
|
|
878
|
+
const imageElement = node.__kittyImageElement;
|
|
879
|
+
imageElement.onload = () => {
|
|
880
|
+
imageElement.onload = null;
|
|
881
|
+
if (node.__kittyGeneration === generation) {
|
|
882
|
+
layoutNode(node);
|
|
883
|
+
}
|
|
884
|
+
};
|
|
885
|
+
imageElement.src = objectUrl;
|
|
886
|
+
layoutNode(node);
|
|
887
|
+
}
|
|
888
|
+
|
|
889
|
+
function deleteImages(message) {
|
|
890
|
+
const info = message.delete || {};
|
|
891
|
+
sendBrowserDebug("delete", {
|
|
892
|
+
delete: info,
|
|
893
|
+
placementKeys: Array.from(state.placements.keys()),
|
|
894
|
+
});
|
|
895
|
+
if (info.scope === "a" || info.scope === "A") {
|
|
896
|
+
for (const node of state.placements.values()) {
|
|
897
|
+
removePlacementNode(node);
|
|
898
|
+
}
|
|
899
|
+
state.placements.clear();
|
|
900
|
+
return;
|
|
901
|
+
}
|
|
902
|
+
|
|
903
|
+
if (info.imageId) {
|
|
904
|
+
for (const [key, node] of state.placements.entries()) {
|
|
905
|
+
if (key.startsWith(`${info.imageId}:`)) {
|
|
906
|
+
removePlacementNode(node);
|
|
907
|
+
state.placements.delete(key);
|
|
908
|
+
}
|
|
909
|
+
}
|
|
910
|
+
}
|
|
911
|
+
}
|
|
912
|
+
|
|
913
|
+
function clearAllImages() {
|
|
914
|
+
deleteImages({ delete: { scope: "a" } });
|
|
915
|
+
}
|
|
916
|
+
|
|
917
|
+
function inspectTerminalOutput(data) {
|
|
918
|
+
if (typeof data !== "string" || data[0] !== MSG_OUTPUT || data.length <= 1) {
|
|
919
|
+
return;
|
|
920
|
+
}
|
|
921
|
+
|
|
922
|
+
let text;
|
|
923
|
+
try {
|
|
924
|
+
text = state.outputTail + stringFromBase64(data.slice(1));
|
|
925
|
+
} catch (error) {
|
|
926
|
+
state.outputTail = "";
|
|
927
|
+
return;
|
|
928
|
+
}
|
|
929
|
+
|
|
930
|
+
if (text.includes("\u001bc") || text.includes("\f")) {
|
|
931
|
+
clearAllImages();
|
|
932
|
+
}
|
|
933
|
+
|
|
934
|
+
const csiPattern = /\u001b\[([0-9;?]*)([A-Za-z])/g;
|
|
935
|
+
let match;
|
|
936
|
+
while ((match = csiPattern.exec(text)) !== null) {
|
|
937
|
+
const params = match[1];
|
|
938
|
+
const finalByte = match[2];
|
|
939
|
+
if (finalByte === "H" || finalByte === "f") {
|
|
940
|
+
const normalized = params === "" ? ["1"] : params.split(";");
|
|
941
|
+
const row = Number.parseInt(normalized[0] || "1", 10) || 1;
|
|
942
|
+
const col = Number.parseInt(normalized[1] || "1", 10) || 1;
|
|
943
|
+
state.recentCursorHome = row === 1 && col === 1;
|
|
944
|
+
if (state.recentCursorHome) {
|
|
945
|
+
state.recentClearLineCount = 0;
|
|
946
|
+
}
|
|
947
|
+
}
|
|
948
|
+
if (finalByte === "J") {
|
|
949
|
+
const mode = params === "" ? 0 : Number.parseInt(params.split(";").pop() || "0", 10) || 0;
|
|
950
|
+
if (mode === 2 || mode === 3 || (mode === 0 && state.recentCursorHome)) {
|
|
951
|
+
clearAllImages();
|
|
952
|
+
}
|
|
953
|
+
state.recentCursorHome = false;
|
|
954
|
+
state.recentClearLineCount = 0;
|
|
955
|
+
}
|
|
956
|
+
if (finalByte === "K") {
|
|
957
|
+
const mode = params === "" ? 0 : Number.parseInt(params.split(";").pop() || "0", 10) || 0;
|
|
958
|
+
if (state.recentCursorHome && mode === 0) {
|
|
959
|
+
state.recentClearLineCount += 1;
|
|
960
|
+
if (state.recentClearLineCount >= Math.max(4, Math.floor(state.rows / 3))) {
|
|
961
|
+
clearAllImages();
|
|
962
|
+
state.recentCursorHome = false;
|
|
963
|
+
state.recentClearLineCount = 0;
|
|
964
|
+
}
|
|
965
|
+
} else {
|
|
966
|
+
state.recentClearLineCount = 0;
|
|
967
|
+
}
|
|
968
|
+
}
|
|
969
|
+
if (finalByte === "h" || finalByte === "l") {
|
|
970
|
+
if (params === "?1049" || params === "?1047" || params === "?47") {
|
|
971
|
+
clearAllImages();
|
|
972
|
+
}
|
|
973
|
+
state.recentCursorHome = false;
|
|
974
|
+
state.recentClearLineCount = 0;
|
|
975
|
+
}
|
|
976
|
+
if (finalByte !== "H" && finalByte !== "f" && finalByte !== "K") {
|
|
977
|
+
state.recentCursorHome = false;
|
|
978
|
+
state.recentClearLineCount = 0;
|
|
979
|
+
}
|
|
980
|
+
}
|
|
981
|
+
|
|
982
|
+
state.outputTail = text.slice(-64);
|
|
983
|
+
}
|
|
984
|
+
|
|
985
|
+
function handleKittyMessage(payload) {
|
|
986
|
+
const message = JSON.parse(payload);
|
|
987
|
+
sendBrowserDebug("kitty-message", {
|
|
988
|
+
kind: message.kind,
|
|
989
|
+
control: message.control || null,
|
|
990
|
+
protocolCursor: message.cursor || message.delete?.cursor || null,
|
|
991
|
+
delete: message.delete || null,
|
|
992
|
+
});
|
|
993
|
+
if (message.kind === "placement") {
|
|
994
|
+
// The server records this cursor exactly where the Kitty APC occurred.
|
|
995
|
+
// Do not replace it with xterm's later cursor, which may already have
|
|
996
|
+
// moved because of redraw or scrolling output queued after the APC.
|
|
997
|
+
placeImage(message);
|
|
998
|
+
return true;
|
|
999
|
+
}
|
|
1000
|
+
if (message.kind === "delete") {
|
|
1001
|
+
deleteImages(message);
|
|
1002
|
+
return true;
|
|
1003
|
+
}
|
|
1004
|
+
return false;
|
|
1005
|
+
}
|
|
1006
|
+
|
|
1007
|
+
const nativeSend = WebSocket.prototype.send;
|
|
1008
|
+
const nativeOnOpen = WebSocket.prototype.addEventListener;
|
|
1009
|
+
WebSocket.prototype.addEventListener = function (type, listener, options) {
|
|
1010
|
+
if (type !== "message") {
|
|
1011
|
+
return nativeOnOpen.call(this, type, listener, options);
|
|
1012
|
+
}
|
|
1013
|
+
const wrapped = function (event) {
|
|
1014
|
+
state.socket = this;
|
|
1015
|
+
inspectTerminalOutput(event.data);
|
|
1016
|
+
if (typeof event.data === "string" && event.data[0] === MSG_KITTY) {
|
|
1017
|
+
if (handleKittyMessage(event.data.slice(1))) {
|
|
1018
|
+
return;
|
|
1019
|
+
}
|
|
1020
|
+
}
|
|
1021
|
+
const result = listener.call(this, event);
|
|
1022
|
+
scheduleRelayout();
|
|
1023
|
+
return result;
|
|
1024
|
+
};
|
|
1025
|
+
listener.__kittyWrapped = wrapped;
|
|
1026
|
+
return nativeOnOpen.call(this, type, wrapped, options);
|
|
1027
|
+
};
|
|
1028
|
+
|
|
1029
|
+
const nativeRemoveEventListener = WebSocket.prototype.removeEventListener;
|
|
1030
|
+
WebSocket.prototype.removeEventListener = function (type, listener, options) {
|
|
1031
|
+
if (type === "message" && listener && listener.__kittyWrapped) {
|
|
1032
|
+
return nativeRemoveEventListener.call(this, type, listener.__kittyWrapped, options);
|
|
1033
|
+
}
|
|
1034
|
+
return nativeRemoveEventListener.call(this, type, listener, options);
|
|
1035
|
+
};
|
|
1036
|
+
|
|
1037
|
+
// Walk the prototype chain to find the native onmessage descriptor.
|
|
1038
|
+
// Safari/WebKit defines it on a parent prototype (e.g. EventTarget),
|
|
1039
|
+
// not directly on WebSocket.prototype, so a single-level lookup fails.
|
|
1040
|
+
let descriptor = null;
|
|
1041
|
+
for (let proto = WebSocket.prototype; proto; proto = Object.getPrototypeOf(proto)) {
|
|
1042
|
+
descriptor = Object.getOwnPropertyDescriptor(proto, "onmessage");
|
|
1043
|
+
if (descriptor) break;
|
|
1044
|
+
}
|
|
1045
|
+
Object.defineProperty(WebSocket.prototype, "onmessage", {
|
|
1046
|
+
configurable: true,
|
|
1047
|
+
enumerable: descriptor ? descriptor.enumerable : true,
|
|
1048
|
+
get() {
|
|
1049
|
+
return this.__kittyOnMessage || null;
|
|
1050
|
+
},
|
|
1051
|
+
set(handler) {
|
|
1052
|
+
this.__kittyOnMessage = handler;
|
|
1053
|
+
if (typeof handler !== "function") {
|
|
1054
|
+
if (descriptor && descriptor.set) {
|
|
1055
|
+
descriptor.set.call(this, handler);
|
|
1056
|
+
}
|
|
1057
|
+
return;
|
|
1058
|
+
}
|
|
1059
|
+
const wrapped = function (event) {
|
|
1060
|
+
state.socket = this;
|
|
1061
|
+
inspectTerminalOutput(event.data);
|
|
1062
|
+
if (typeof event.data === "string" && event.data[0] === MSG_KITTY) {
|
|
1063
|
+
if (handleKittyMessage(event.data.slice(1))) {
|
|
1064
|
+
return;
|
|
1065
|
+
}
|
|
1066
|
+
}
|
|
1067
|
+
return handler.call(this, event);
|
|
1068
|
+
};
|
|
1069
|
+
if (descriptor && descriptor.set) {
|
|
1070
|
+
descriptor.set.call(this, wrapped);
|
|
1071
|
+
} else {
|
|
1072
|
+
// Fallback: use addEventListener when no native setter is available.
|
|
1073
|
+
this.addEventListener("message", wrapped);
|
|
1074
|
+
}
|
|
1075
|
+
}
|
|
1076
|
+
});
|
|
1077
|
+
|
|
1078
|
+
window.addEventListener("resize", relayoutAll);
|
|
1079
|
+
bindTouchScrolling();
|
|
1080
|
+
bindImageContextMenu();
|
|
1081
|
+
const originalNativeSend = nativeSend;
|
|
1082
|
+
WebSocket.prototype.send = function (data) {
|
|
1083
|
+
if (typeof data === "string" && data[0] === "3") {
|
|
1084
|
+
try {
|
|
1085
|
+
const resize = JSON.parse(data.slice(1));
|
|
1086
|
+
if (resize.columns) {
|
|
1087
|
+
state.cols = resize.columns;
|
|
1088
|
+
state.sizeFromClient = true;
|
|
1089
|
+
}
|
|
1090
|
+
if (resize.rows) {
|
|
1091
|
+
state.rows = resize.rows;
|
|
1092
|
+
state.sizeFromClient = true;
|
|
1093
|
+
}
|
|
1094
|
+
} catch (error) {
|
|
1095
|
+
// ignore
|
|
1096
|
+
}
|
|
1097
|
+
}
|
|
1098
|
+
return originalNativeSend.call(this, data);
|
|
1099
|
+
};
|
|
1100
|
+
relayoutAll();
|
|
1101
|
+
})();
|