@zaly/tui 0.0.12 → 0.1.1
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/assets/schemas/shiki-language.schema.json +352 -0
- package/assets/schemas/shiki-theme.schema.json +71 -0
- package/assets/schemas/theme.schema.json +226 -1046
- package/assets/themes/andromeeda.json +97 -0
- package/assets/themes/ayu-dark.json +31 -25
- package/assets/themes/ayu-light.json +106 -0
- package/assets/themes/ayu-mirage.json +106 -0
- package/assets/themes/catppuccin-frappe.json +43 -40
- package/assets/themes/catppuccin-latte.json +43 -40
- package/assets/themes/catppuccin-macchiato.json +43 -40
- package/assets/themes/catppuccin-mocha.json +43 -40
- package/assets/themes/dark-plus.json +99 -0
- package/assets/themes/dracula.json +47 -47
- package/assets/themes/everforest-dark.json +28 -26
- package/assets/themes/everforest-light.json +28 -26
- package/assets/themes/github-dark-default.json +107 -0
- package/assets/themes/github-dark-dimmed.json +107 -0
- package/assets/themes/github-light-default.json +107 -0
- package/assets/themes/gruvbox-dark-hard.json +98 -0
- package/assets/themes/gruvbox-dark-medium.json +34 -29
- package/assets/themes/gruvbox-light-medium.json +98 -0
- package/assets/themes/horizon-bright.json +101 -0
- package/assets/themes/horizon.json +101 -0
- package/assets/themes/iterm2/LICENSE +25 -0
- package/assets/themes/iterm2/README.md +28 -0
- package/assets/themes/iterm2/catppuccin-latte.json +140 -0
- package/assets/themes/iterm2/catppuccin-mocha.json +140 -0
- package/assets/themes/iterm2/github-dark.json +140 -0
- package/assets/themes/iterm2/github.json +140 -0
- package/assets/themes/iterm2/gruvbox-dark.json +140 -0
- package/assets/themes/iterm2/gruvbox-light.json +140 -0
- package/assets/themes/iterm2/nord.json +140 -0
- package/assets/themes/iterm2/tokyonight-day.json +140 -0
- package/assets/themes/iterm2/tokyonight-moon.json +140 -0
- package/assets/themes/kanagawa-dragon.json +55 -49
- package/assets/themes/kanagawa-lotus.json +105 -0
- package/assets/themes/kanagawa-wave.json +56 -50
- package/assets/themes/light-plus.json +99 -0
- package/assets/themes/material-theme-lighter.json +102 -0
- package/assets/themes/material-theme-palenight.json +52 -45
- package/assets/themes/material-theme.json +102 -0
- package/assets/themes/min-dark.json +69 -14
- package/assets/themes/min-light.json +68 -17
- package/assets/themes/monokai.json +54 -47
- package/assets/themes/night-owl-light.json +105 -0
- package/assets/themes/night-owl.json +57 -49
- package/assets/themes/nord.json +53 -39
- package/assets/themes/one-dark-pro.json +46 -38
- package/assets/themes/one-light.json +52 -41
- package/assets/themes/poimandres.json +51 -49
- package/assets/themes/rose-pine-dawn.json +99 -0
- package/assets/themes/rose-pine-moon.json +99 -0
- package/assets/themes/rose-pine.json +50 -33
- package/assets/themes/solarized-dark.json +38 -31
- package/assets/themes/solarized-light.json +40 -33
- package/assets/themes/synthwave-84.json +47 -30
- package/assets/themes/tokyonight-day.json +3 -3
- package/assets/themes/tokyonight-moon.json +3 -2
- package/assets/themes/tokyonight-night.json +3 -2
- package/assets/themes/tokyonight-storm.json +3 -2
- package/assets/themes/vesper.json +50 -42
- package/assets/themes/vitesse-black.json +103 -0
- package/assets/themes/vitesse-dark.json +26 -30
- package/assets/themes/vitesse-light.json +26 -30
- package/dist/{actions-DEIKF2ts.mjs → actions-AY6avfEV.mjs} +2 -3
- package/dist/{actions-DEIKF2ts.mjs.map → actions-AY6avfEV.mjs.map} +1 -1
- package/dist/{actions-Dc4D4uSf.d.mts → actions-B0yyZ-Ww.d.mts} +4 -6
- package/dist/actions-B0yyZ-Ww.d.mts.map +1 -0
- package/dist/{ansi-DZlXaItJ.mjs → ansi-CxgRPLA2.mjs} +4 -33
- package/dist/ansi-CxgRPLA2.mjs.map +1 -0
- package/dist/ansi.d.mts +1 -3
- package/dist/ansi.d.mts.map +1 -1
- package/dist/ansi.mjs +1 -1
- package/dist/{autocomplete-StW1QJZJ.d.mts → autocomplete-wgceuhLr.d.mts} +5 -7
- package/dist/autocomplete-wgceuhLr.d.mts.map +1 -0
- package/dist/{box-BkP4MF82.mjs → box-DToDoXlU.mjs} +8 -10
- package/dist/{box-BkP4MF82.mjs.map → box-DToDoXlU.mjs.map} +1 -1
- package/dist/builder-BdYlK1Ew.mjs +195 -0
- package/dist/builder-BdYlK1Ew.mjs.map +1 -0
- package/dist/{callbacks-BwWTCqPJ.mjs → callbacks-DW8XKYKy.mjs} +9 -13
- package/dist/{callbacks-BwWTCqPJ.mjs.map → callbacks-DW8XKYKy.mjs.map} +1 -1
- package/dist/{client-C2GXKfJ1.mjs → client-BWm6dNZF.mjs} +9 -6
- package/dist/client-BWm6dNZF.mjs.map +1 -0
- package/dist/client-C69qWhMG.mjs +1 -0
- package/dist/{clipboard-CNPBTX7j.mjs → clipboard-UEoX9sup.mjs} +2 -3
- package/dist/{clipboard-CNPBTX7j.mjs.map → clipboard-UEoX9sup.mjs.map} +1 -1
- package/dist/clipboard.d.mts +0 -2
- package/dist/clipboard.d.mts.map +1 -1
- package/dist/clipboard.mjs +1 -1
- package/dist/color-Cr1VoL49.mjs +36 -0
- package/dist/color-Cr1VoL49.mjs.map +1 -0
- package/dist/ctx-CYEzzH-7.mjs +1 -0
- package/dist/{ctx-B7BmPUCD.mjs → ctx-DBeFcZt6.mjs} +4 -5
- package/dist/{ctx-B7BmPUCD.mjs.map → ctx-DBeFcZt6.mjs.map} +1 -1
- package/dist/{divider-TSx9NhI_.mjs → divider-qEj5prKE.mjs} +3 -4
- package/dist/{divider-TSx9NhI_.mjs.map → divider-qEj5prKE.mjs.map} +1 -1
- package/dist/{files-BvThQpOf.mjs → files-C3ZnFpvq.mjs} +3 -4
- package/dist/{files-BvThQpOf.mjs.map → files-C3ZnFpvq.mjs.map} +1 -1
- package/dist/{files-7DUYSeNc.d.mts → files-CdiDnwA_.d.mts} +3 -5
- package/dist/files-CdiDnwA_.d.mts.map +1 -0
- package/dist/{flex-Bguo-fUe.mjs → flex-CYp4etqn.mjs} +3 -4
- package/dist/{flex-Bguo-fUe.mjs.map → flex-CYp4etqn.mjs.map} +1 -1
- package/dist/{github-Cy2hfWJ7.mjs → github-CLveT9mq.mjs} +2 -3
- package/dist/{github-Cy2hfWJ7.mjs.map → github-CLveT9mq.mjs.map} +1 -1
- package/dist/{github-C1KfXk98.d.mts → github-DC0XemKa.d.mts} +3 -5
- package/dist/github-DC0XemKa.d.mts.map +1 -0
- package/dist/{image-VaT7AN-S.d.mts → image-DdRDv7q6.d.mts} +2 -4
- package/dist/image-DdRDv7q6.d.mts.map +1 -0
- package/dist/image-M--Bw4bs.mjs +177 -0
- package/dist/image-M--Bw4bs.mjs.map +1 -0
- package/dist/image.d.mts +1 -3
- package/dist/image.d.mts.map +1 -1
- package/dist/image.mjs +1 -1
- package/dist/index.d.mts +11 -14
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +12 -14
- package/dist/index.mjs.map +1 -1
- package/dist/{input-BGTTujDN.mjs → input-BkE4EpBw.mjs} +6 -7
- package/dist/{input-BGTTujDN.mjs.map → input-BkE4EpBw.mjs.map} +1 -1
- package/dist/{input-BAYux7qo.d.mts → input-C3kfYoEJ.d.mts} +3 -5
- package/dist/input-C3kfYoEJ.d.mts.map +1 -0
- package/dist/{inspect-jG_W4njH.mjs → inspect-Cli1beu8.mjs} +3 -4
- package/dist/{inspect-jG_W4njH.mjs.map → inspect-Cli1beu8.mjs.map} +1 -1
- package/dist/{inspect-CfNydMgO.d.mts → inspect-hSl3U2BD.d.mts} +2 -6
- package/dist/inspect-hSl3U2BD.d.mts.map +1 -0
- package/dist/kitty-0sJ8axU_.mjs +1 -0
- package/dist/{kitty-JbCJC0iQ.mjs → kitty-BH_eK6lz.mjs} +2 -3
- package/dist/{kitty-JbCJC0iQ.mjs.map → kitty-BH_eK6lz.mjs.map} +1 -1
- package/dist/{log-ByKlM4iI.mjs → log-96b1_J6G.mjs} +6 -7
- package/dist/{log-ByKlM4iI.mjs.map → log-96b1_J6G.mjs.map} +1 -1
- package/dist/{logger-DSQb0sLP.mjs → logger-DwfXp8LF.mjs} +5 -6
- package/dist/{logger-DSQb0sLP.mjs.map → logger-DwfXp8LF.mjs.map} +1 -1
- package/dist/{markdown-CwRmWuU6.mjs → markdown-CgRZBhIX.mjs} +12 -12
- package/dist/markdown-CgRZBhIX.mjs.map +1 -0
- package/dist/markdown.d.mts +2 -4
- package/dist/markdown.d.mts.map +1 -1
- package/dist/markdown.mjs +1 -1
- package/dist/math-Dk8hxbmz.mjs +1 -0
- package/dist/math-VPuwFCid.mjs +205 -0
- package/dist/math-VPuwFCid.mjs.map +1 -0
- package/dist/md.bun.d.mts +1 -3
- package/dist/md.bun.d.mts.map +1 -1
- package/dist/md.bun.mjs +2 -3
- package/dist/md.node.d.mts +1 -3
- package/dist/md.node.d.mts.map +1 -1
- package/dist/md.node.mjs +2 -3
- package/dist/{node-BZ7f6HzU.mjs → node-CXNobGaP.mjs} +3 -4
- package/dist/{node-BZ7f6HzU.mjs.map → node-CXNobGaP.mjs.map} +1 -1
- package/dist/oklch-Boh4YHEc.mjs +98 -0
- package/dist/oklch-Boh4YHEc.mjs.map +1 -0
- package/dist/{overlay-BnvOKtGT.mjs → overlay-CevDWgSF.mjs} +3 -4
- package/dist/{overlay-BnvOKtGT.mjs.map → overlay-CevDWgSF.mjs.map} +1 -1
- package/dist/{picker-Dh5IUrTk.mjs → picker-D9WrE3zF.mjs} +11 -16
- package/dist/{picker-Dh5IUrTk.mjs.map → picker-D9WrE3zF.mjs.map} +1 -1
- package/dist/{picker-DQs_IW77.d.mts → picker-DsB6--GN.d.mts} +6 -8
- package/dist/picker-DsB6--GN.d.mts.map +1 -0
- package/dist/{queries-B_lOwEiE.mjs → queries-BIniKnLL.mjs} +68 -7
- package/dist/queries-BIniKnLL.mjs.map +1 -0
- package/dist/{queries-BDX8mcl5.d.mts → queries-Dmd3IjSd.d.mts} +19 -52
- package/dist/queries-Dmd3IjSd.d.mts.map +1 -0
- package/dist/{reactive-f7NpAi69.mjs → reactive-DkP75TPk.mjs} +2 -3
- package/dist/{reactive-f7NpAi69.mjs.map → reactive-DkP75TPk.mjs.map} +1 -1
- package/dist/{registry-D-suU3g0.mjs → registry-CQU0VwpM.mjs} +205 -65
- package/dist/registry-CQU0VwpM.mjs.map +1 -0
- package/dist/{render-DEIUNLkh.mjs → render-Bp2N2i6J.mjs} +4 -5
- package/dist/{render-DEIUNLkh.mjs.map → render-Bp2N2i6J.mjs.map} +1 -1
- package/dist/{renderer-zDNlAovy.mjs → renderer-B9sAMA10.mjs} +123 -40
- package/dist/renderer-B9sAMA10.mjs.map +1 -0
- package/dist/{renderer-MQue4Da5.mjs → renderer-BYl2pbdx.mjs} +9 -9
- package/dist/renderer-BYl2pbdx.mjs.map +1 -0
- package/dist/renderer-Ctz0hv5o.mjs +1 -0
- package/dist/{search-FvGnswRl.d.mts → search-DsHzamic.d.mts} +1 -9
- package/dist/search-DsHzamic.d.mts.map +1 -0
- package/dist/{select-J2KtwxyK.d.mts → select-BZCFXdjp.d.mts} +3 -5
- package/dist/select-BZCFXdjp.d.mts.map +1 -0
- package/dist/{select-m7NE6Rwa.mjs → select-CUmAFKJh.mjs} +5 -6
- package/dist/{select-m7NE6Rwa.mjs.map → select-CUmAFKJh.mjs.map} +1 -1
- package/dist/services/logger.d.mts +1 -1
- package/dist/services/logger.mjs +1 -1
- package/dist/services/notifier.d.mts +1 -3
- package/dist/services/notifier.d.mts.map +1 -1
- package/dist/services/notifier.mjs +3 -4
- package/dist/services/picker.d.mts +5 -7
- package/dist/services/picker.d.mts.map +1 -1
- package/dist/services/picker.mjs +8 -9
- package/dist/services/prompt.d.mts +4 -6
- package/dist/services/prompt.d.mts.map +1 -1
- package/dist/services/prompt.mjs +7 -8
- package/dist/shiki/server.mjs +40 -19
- package/dist/shiki/server.mjs.map +1 -1
- package/dist/shiki-BAf9PdIc.mjs +19 -0
- package/dist/shiki-BAf9PdIc.mjs.map +1 -0
- package/dist/shiki-DUUAIE6f.mjs +632 -0
- package/dist/shiki-DUUAIE6f.mjs.map +1 -0
- package/dist/{show-DR2x1YFc.mjs → show-D5XNXgZf.mjs} +4 -5
- package/dist/{show-DR2x1YFc.mjs.map → show-D5XNXgZf.mjs.map} +1 -1
- package/dist/{size-D8JogYLy.mjs → size-BHRJuRk9.mjs} +2 -3
- package/dist/{size-D8JogYLy.mjs.map → size-BHRJuRk9.mjs.map} +1 -1
- package/dist/style-Cw_EuszU.mjs +108 -0
- package/dist/style-Cw_EuszU.mjs.map +1 -0
- package/dist/style.d.mts +4 -5
- package/dist/style.d.mts.map +1 -1
- package/dist/style.mjs +4 -4
- package/dist/{text-CkQ7Irmt.mjs → text-4arC3odI.mjs} +3 -4
- package/dist/{text-CkQ7Irmt.mjs.map → text-4arC3odI.mjs.map} +1 -1
- package/dist/{text-XvPfweeg.mjs → text-BArwVVkg.mjs} +5 -6
- package/dist/{text-XvPfweeg.mjs.map → text-BArwVVkg.mjs.map} +1 -1
- package/dist/{text-CCYs9RB2.d.mts → text-DdkJXgoC.d.mts} +3 -5
- package/dist/text-DdkJXgoC.d.mts.map +1 -0
- package/dist/text.d.mts +1 -1
- package/dist/text.mjs +1 -1
- package/dist/theme-B8hb1lPU.mjs +60 -0
- package/dist/theme-B8hb1lPU.mjs.map +1 -0
- package/dist/theme-BeSaXGNY.mjs +1792 -0
- package/dist/theme-BeSaXGNY.mjs.map +1 -0
- package/dist/themes.d.mts +211 -77
- package/dist/themes.d.mts.map +1 -1
- package/dist/themes.mjs +1 -1
- package/dist/{tree-DJl5W_B7.d.mts → tree-Berzv8Rz.d.mts} +3 -5
- package/dist/tree-Berzv8Rz.d.mts.map +1 -0
- package/dist/{tree-Bo1afYhe.mjs → tree-D6NvMQx8.mjs} +5 -6
- package/dist/{tree-Bo1afYhe.mjs.map → tree-D6NvMQx8.mjs.map} +1 -1
- package/dist/{types-D2EYlzmK.d.mts → types-ByMHEdCF.d.mts} +133 -131
- package/dist/types-ByMHEdCF.d.mts.map +1 -0
- package/dist/{types-D3jk1rtk.d.mts → types-CUVUJPz6.d.mts} +1 -3
- package/dist/types-CUVUJPz6.d.mts.map +1 -0
- package/dist/{utils-3M4D_AXZ.mjs → utils-DHXAegVW.mjs} +1 -2
- package/dist/{utils-3M4D_AXZ.mjs.map → utils-DHXAegVW.mjs.map} +1 -1
- package/dist/{widget-BkMwhY2p.mjs → widget-sFveyrZE.mjs} +3 -4
- package/dist/{widget-BkMwhY2p.mjs.map → widget-sFveyrZE.mjs.map} +1 -1
- package/dist/{widget-DPqBbB57.d.mts → widget-sPJaKVU2.d.mts} +2 -4
- package/dist/widget-sPJaKVU2.d.mts.map +1 -0
- package/dist/widgets/autocomplete.d.mts +1 -1
- package/dist/widgets/autocomplete.mjs +5 -6
- package/dist/widgets/box.d.mts +1 -1
- package/dist/widgets/box.mjs +1 -1
- package/dist/widgets/code.d.mts +4 -4
- package/dist/widgets/code.d.mts.map +1 -1
- package/dist/widgets/code.mjs +12 -12
- package/dist/widgets/code.mjs.map +1 -1
- package/dist/widgets/completions/actions.d.mts +1 -1
- package/dist/widgets/completions/actions.mjs +1 -1
- package/dist/widgets/completions/files.d.mts +1 -1
- package/dist/widgets/completions/files.mjs +1 -1
- package/dist/widgets/completions/github.d.mts +1 -1
- package/dist/widgets/completions/github.mjs +1 -1
- package/dist/widgets/completions/index.d.mts +3 -3
- package/dist/widgets/completions/index.mjs +3 -3
- package/dist/widgets/diff.d.mts +2 -4
- package/dist/widgets/diff.d.mts.map +1 -1
- package/dist/widgets/diff.mjs +38 -16
- package/dist/widgets/diff.mjs.map +1 -1
- package/dist/widgets/divider.d.mts +2 -4
- package/dist/widgets/divider.d.mts.map +1 -1
- package/dist/widgets/divider.mjs +1 -1
- package/dist/widgets/image.d.mts +1 -1
- package/dist/widgets/image.mjs +8 -9
- package/dist/widgets/image.mjs.map +1 -1
- package/dist/widgets/input.d.mts +1 -1
- package/dist/widgets/input.mjs +1 -1
- package/dist/widgets/log.d.mts +1 -1
- package/dist/widgets/log.mjs +1 -1
- package/dist/widgets/markdown.d.mts +5 -7
- package/dist/widgets/markdown.d.mts.map +1 -1
- package/dist/widgets/markdown.mjs +1 -1
- package/dist/widgets/overlay.d.mts +1 -1
- package/dist/widgets/overlay.mjs +1 -1
- package/dist/widgets/picker.d.mts +1 -1
- package/dist/widgets/picker.mjs +1 -1
- package/dist/widgets/progress.d.mts +2 -4
- package/dist/widgets/progress.d.mts.map +1 -1
- package/dist/widgets/progress.mjs +4 -5
- package/dist/widgets/select.d.mts +1 -1
- package/dist/widgets/select.mjs +1 -1
- package/dist/widgets/show.d.mts +1 -3
- package/dist/widgets/show.d.mts.map +1 -1
- package/dist/widgets/show.mjs +1 -1
- package/dist/widgets/spinner.d.mts +2 -4
- package/dist/widgets/spinner.d.mts.map +1 -1
- package/dist/widgets/spinner.mjs +3 -4
- package/dist/widgets/text.d.mts +1 -1
- package/dist/widgets/text.mjs +1 -1
- package/dist/widgets/tree.d.mts +1 -1
- package/dist/widgets/tree.mjs +1 -1
- package/dist/widgets/widget.d.mts +1 -1
- package/dist/widgets/widget.mjs +1 -1
- package/dist/{worker-T6SdPzUH.mjs → worker-CtEowucz.mjs} +2 -3
- package/dist/{worker-T6SdPzUH.mjs.map → worker-CtEowucz.mjs.map} +1 -1
- package/dist/worker-Mqi380Et.mjs +1 -0
- package/package.json +5 -7
- package/assets/themes/dracula-soft.json +0 -100
- package/assets/themes/github-dark.json +0 -104
- package/assets/themes/github-light.json +0 -104
- package/dist/actions-Dc4D4uSf.d.mts.map +0 -1
- package/dist/ansi-DZlXaItJ.mjs.map +0 -1
- package/dist/autocomplete-StW1QJZJ.d.mts.map +0 -1
- package/dist/builder-1z5ewEWK.mjs +0 -386
- package/dist/builder-1z5ewEWK.mjs.map +0 -1
- package/dist/client-C2GXKfJ1.mjs.map +0 -1
- package/dist/client-bzdHIDL2.mjs +0 -1
- package/dist/ctx-D_JgJ8Eo.mjs +0 -1
- package/dist/files-7DUYSeNc.d.mts.map +0 -1
- package/dist/github-C1KfXk98.d.mts.map +0 -1
- package/dist/image-Cm5T-uw-.mjs +0 -108
- package/dist/image-Cm5T-uw-.mjs.map +0 -1
- package/dist/image-VaT7AN-S.d.mts.map +0 -1
- package/dist/input-BAYux7qo.d.mts.map +0 -1
- package/dist/inspect-CfNydMgO.d.mts.map +0 -1
- package/dist/markdown-CwRmWuU6.mjs.map +0 -1
- package/dist/picker-DQs_IW77.d.mts.map +0 -1
- package/dist/queries-BDX8mcl5.d.mts.map +0 -1
- package/dist/queries-B_lOwEiE.mjs.map +0 -1
- package/dist/registry-D-suU3g0.mjs.map +0 -1
- package/dist/renderer-DhqbEVVR.mjs +0 -1
- package/dist/renderer-MQue4Da5.mjs.map +0 -1
- package/dist/renderer-zDNlAovy.mjs.map +0 -1
- package/dist/search-FvGnswRl.d.mts.map +0 -1
- package/dist/select-J2KtwxyK.d.mts.map +0 -1
- package/dist/shiki--ASSYv4_.mjs +0 -12
- package/dist/shiki--ASSYv4_.mjs.map +0 -1
- package/dist/shiki-D7l5--zz.mjs +0 -432
- package/dist/shiki-D7l5--zz.mjs.map +0 -1
- package/dist/text-CCYs9RB2.d.mts.map +0 -1
- package/dist/theme.config-B3Yx--C2.mjs +0 -855
- package/dist/theme.config-B3Yx--C2.mjs.map +0 -1
- package/dist/tree-DJl5W_B7.d.mts.map +0 -1
- package/dist/types-D2EYlzmK.d.mts.map +0 -1
- package/dist/types-D3jk1rtk.d.mts.map +0 -1
- package/dist/widget-DPqBbB57.d.mts.map +0 -1
- package/dist/worker-C01jK2Ip.mjs +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tree-
|
|
1
|
+
{"version":3,"file":"tree-D6NvMQx8.mjs","names":[],"sources":["../src/widgets/tree.ts"],"sourcesContent":["import type { Reactive } from \"../core/reactive.ts\"\nimport type { Option, Select, SelectState } from \"./select.ts\"\n\nimport { stringWidth } from \"@zaly/shared/ansi\"\nimport { memo, unwrap } from \"../core/reactive.ts\"\nimport { select } from \"./select.ts\"\nimport { widget } from \"./widget.ts\"\n\nexport type TreeItem<T extends Option = Option> = T & {\n children?: TreeItem<T>[]\n icon?: string\n}\n\nexport type TreeProps<T extends TreeItem = TreeItem> = Omit<SelectState<T>, \"items\" | \"active\"> & {\n tree: Reactive<T>\n /** If true, the root node will be rendered and selectable. Defaults to false. */\n root?: boolean\n active?: T | ((item: T) => boolean)\n}\n\nconst icons = {\n // last: \"└─\",\n last: \"╰─\",\n middle: \"├─\",\n vertical: \"│ \",\n}\n\nexport type TreeNode<T extends TreeItem> = {\n last?: boolean\n parent?: T\n}\n\nclass Tree<T extends TreeItem> {\n nodes = new Map<T, TreeNode<T>>()\n items: T[] = []\n\n constructor(public root: T) {\n this.#build(root, undefined, true)\n }\n\n #build(item: T, parent?: T, last?: boolean) {\n this.nodes.set(item, { last, parent })\n this.items.push(item)\n const children = item.children ?? []\n for (let c = 0; c < children.length; c++) {\n const child = children[c] as T\n this.#build(child, item, c === children.length - 1)\n }\n }\n\n node(item: T) {\n return this.nodes.get(item)\n }\n}\n\nexport const tree = widget(\n <T extends TreeItem>(props: TreeProps<T>): Select<T> & { items: Reactive<T[]> } => {\n const builder = memo(() => new Tree(unwrap(props.tree)))\n const items = memo(() => (props.root === true ? builder().items : builder().items.slice(1)))\n\n const activeFn =\n typeof props.active === \"function\" ? props.active : (i: T) => i === props.active\n const active = props.active ? items().findIndex((i) => activeFn(i)) : -1\n\n const ret = select({ ...props, active: active === -1 ? 0 : active, items })\n\n ret.extendRenderer((prev) => (item, ctx) => {\n const t = builder()\n const path: string[] = []\n const s = ctx.style\n const itemNode = t.node(item)\n let n = t.node(item)\n while (n?.parent) {\n if (props.root !== true && n.parent === props.tree) break\n let icon = \"\"\n if (n !== itemNode) icon = n.last ? \" \" : icons.vertical\n else icon = n.last ? icons.last : icons.middle\n path.unshift(icon)\n n = t.node(n.parent)\n }\n const prefix = path.join(\"\")\n const prefixWidth = stringWidth(prefix)\n const text = prev(item, { ...ctx, prefixWidth, width: ctx.width - prefixWidth }).replace(\n /\\s/g,\n \" \"\n )\n return `${s.gutter(prefix)}${text}`\n })\n\n return Object.assign(ret, { items })\n }\n)\n"],"mappings":";;;;;AAoBA,MAAM,QAAQ;CAEZ,MAAM;CACN,QAAQ;CACR,UAAU;AACZ;AAOA,IAAM,OAAN,MAA+B;CAIV;CAHnB,wBAAQ,IAAI,IAAoB;CAChC,QAAa,CAAC;CAEd,YAAY,MAAgB;EAAT,KAAA,OAAA;EACjB,KAAK,OAAO,MAAM,KAAA,GAAW,IAAI;CACnC;CAEA,OAAO,MAAS,QAAY,MAAgB;EAC1C,KAAK,MAAM,IAAI,MAAM;GAAE;GAAM;EAAO,CAAC;EACrC,KAAK,MAAM,KAAK,IAAI;EACpB,MAAM,WAAW,KAAK,YAAY,CAAC;EACnC,KAAK,IAAI,IAAI,GAAG,IAAI,SAAS,QAAQ,KAAK;GACxC,MAAM,QAAQ,SAAS;GACvB,KAAK,OAAO,OAAO,MAAM,MAAM,SAAS,SAAS,CAAC;EACpD;CACF;CAEA,KAAK,MAAS;EACZ,OAAO,KAAK,MAAM,IAAI,IAAI;CAC5B;AACF;AAEA,MAAa,OAAO,QACG,UAA8D;CACjF,MAAM,UAAU,WAAW,IAAI,KAAK,OAAO,MAAM,IAAI,CAAC,CAAC;CACvD,MAAM,QAAQ,WAAY,MAAM,SAAS,OAAO,QAAQ,CAAC,CAAC,QAAQ,QAAQ,CAAC,CAAC,MAAM,MAAM,CAAC,CAAE;CAE3F,MAAM,WACJ,OAAO,MAAM,WAAW,aAAa,MAAM,UAAU,MAAS,MAAM,MAAM;CAC5E,MAAM,SAAS,MAAM,SAAS,MAAM,CAAC,CAAC,WAAW,MAAM,SAAS,CAAC,CAAC,IAAI;CAEtE,MAAM,MAAM,OAAO;EAAE,GAAG;EAAO,QAAQ,WAAW,KAAK,IAAI;EAAQ;CAAM,CAAC;CAE1E,IAAI,gBAAgB,UAAU,MAAM,QAAQ;EAC1C,MAAM,IAAI,QAAQ;EAClB,MAAM,OAAiB,CAAC;EACxB,MAAM,IAAI,IAAI;EACd,MAAM,WAAW,EAAE,KAAK,IAAI;EAC5B,IAAI,IAAI,EAAE,KAAK,IAAI;EACnB,OAAO,GAAG,QAAQ;GAChB,IAAI,MAAM,SAAS,QAAQ,EAAE,WAAW,MAAM,MAAM;GACpD,IAAI,OAAO;GACX,IAAI,MAAM,UAAU,OAAO,EAAE,OAAO,OAAO,MAAM;QAC5C,OAAO,EAAE,OAAO,MAAM,OAAO,MAAM;GACxC,KAAK,QAAQ,IAAI;GACjB,IAAI,EAAE,KAAK,EAAE,MAAM;EACrB;EACA,MAAM,SAAS,KAAK,KAAK,EAAE;EAC3B,MAAM,cAAc,YAAY,MAAM;EACtC,MAAM,OAAO,KAAK,MAAM;GAAE,GAAG;GAAK;GAAa,OAAO,IAAI,QAAQ;EAAY,CAAC,CAAC,CAAC,QAC/E,OACA,GACF;EACA,OAAO,GAAG,EAAE,OAAO,MAAM,IAAI;CAC/B,CAAC;CAED,OAAO,OAAO,OAAO,KAAK,EAAE,MAAM,CAAC;AACrC,CACF"}
|
|
@@ -1,12 +1,19 @@
|
|
|
1
|
+
import { Simplify } from "@zaly/shared";
|
|
1
2
|
import { BundledLanguage, BundledTheme } from "shiki/types";
|
|
2
|
-
//#region src/shiki/types.d.ts
|
|
3
3
|
type ShikiTheme = BundledTheme;
|
|
4
4
|
type ShikiLanguage = BundledLanguage;
|
|
5
|
+
type ShikiSelection = "auto" | ShikiTheme;
|
|
6
|
+
type GeneratedShikiTheme = {
|
|
7
|
+
name: string;
|
|
8
|
+
appearance: "dark" | "light";
|
|
9
|
+
styles: AnsiStyle[];
|
|
10
|
+
};
|
|
11
|
+
type ShikiThemeInput = ShikiTheme | GeneratedShikiTheme;
|
|
5
12
|
type ShikiRequest = {
|
|
6
13
|
key?: string;
|
|
7
14
|
code: string;
|
|
8
15
|
lang: string;
|
|
9
|
-
theme?:
|
|
16
|
+
theme?: ShikiThemeInput;
|
|
10
17
|
signal?: AbortSignal;
|
|
11
18
|
};
|
|
12
19
|
type ShikiWorkerRequest = Omit<ShikiRequest, "lang" | "key"> & {
|
|
@@ -29,68 +36,14 @@ type ShikiWorkerMessage = {
|
|
|
29
36
|
type: "result";
|
|
30
37
|
});
|
|
31
38
|
type ShikiOpts = {
|
|
32
|
-
theme?:
|
|
39
|
+
theme?: ShikiThemeInput;
|
|
33
40
|
signal?: AbortSignal;
|
|
34
41
|
};
|
|
35
|
-
|
|
36
|
-
//#region src/style/types.d.ts
|
|
37
|
-
type RGB = [r: number, g: number, b: number];
|
|
38
|
-
/** Alpha percentage for `/<alpha>` suffix on Color values. Any integer
|
|
39
|
-
* 0..100 is accepted at runtime; the template literal uses `${number}`
|
|
40
|
-
* so odd values like `/98` typecheck without a cast. */
|
|
41
|
-
type ColorLightness = `${number}`;
|
|
42
|
-
/** Standard ANSI color names. */
|
|
43
|
-
type AnsiColorName = "black" | "red" | "green" | "yellow" | "blue" | "magenta" | "cyan" | "white" | "gray" | "grey";
|
|
44
|
-
/** Bright ANSI variants — `brightRed`, `brightBlue`, etc. */
|
|
45
|
-
type BrightAnsiColorName = `bright${Capitalize<AnsiColorName>}`;
|
|
46
|
-
type AnsiColor = AnsiColorName | BrightAnsiColorName | HexColor | "inherit";
|
|
47
|
-
/** Hex color string. Matches `#rgb` / `#rgba` / `#rrggbb` / `#rrggbbaa`
|
|
48
|
-
* (any case; runtime validates). Alpha is native to the hex form, so
|
|
49
|
-
* there is no separate `/<alpha>` suffix for hex. */
|
|
50
|
-
type HexColor = `#${string}`;
|
|
51
|
-
type ThemeKey = Exclude<keyof Theme, "shiki" | "$schema" | "id">;
|
|
52
|
-
/**
|
|
53
|
-
* A color value. Accepted forms:
|
|
54
|
-
* - `#rgb` / `#rrggbb` hex
|
|
55
|
-
* - ANSI color names (`red`, `cyan`, `gray`, …)
|
|
56
|
-
* - Bright ANSI variants (`brightRed`, `brightBlue`, …)
|
|
57
|
-
* - Theme slot keys from `keyof Theme` (`primary`, `muted`, …)
|
|
58
|
-
* - `'inherit'` — use the parent's color (renders as no escape).
|
|
59
|
-
* - Variant suffix `-<step>` on hex or theme slots — e.g. `primary-300`,
|
|
60
|
-
* `#82aaff-900`. The base color gets resolved through the theme
|
|
61
|
-
* (extracting the channel when needed), then `variant(base, step)`
|
|
62
|
-
* shifts it along the OKLCH tonal scale.
|
|
63
|
-
*/
|
|
64
|
-
type Color<Ansi extends boolean = true> = HexColor | (Ansi extends true ? AnsiColorName : never) | (Ansi extends true ? BrightAnsiColorName : never) | ThemeKey | "inherit" | `${HexColor | ThemeKey}-${ColorLightness}` | `${HexColor | ThemeKey}+${ColorLightness}`;
|
|
65
|
-
interface AnsiStyle {
|
|
66
|
-
fg?: AnsiColor;
|
|
67
|
-
bg?: AnsiColor;
|
|
68
|
-
bold?: boolean;
|
|
69
|
-
dim?: boolean;
|
|
70
|
-
italic?: boolean;
|
|
71
|
-
underline?: boolean;
|
|
72
|
-
inverse?: boolean;
|
|
73
|
-
strikethrough?: boolean;
|
|
74
|
-
}
|
|
75
|
-
/** Base style shared by every node type. Box/Text/etc. extend this.
|
|
76
|
-
* Pure styling — no layout or lifecycle fields. Widget state interfaces
|
|
77
|
-
* extend `StyleState` to pick up the `visible` base-state bits alongside
|
|
78
|
-
* these style fields. */
|
|
79
|
-
type Style<Ansi extends boolean = true> = Omit<AnsiStyle, "fg" | "bg"> & {
|
|
42
|
+
type ThemeStyle<Ansi extends boolean = true> = Simplify<Omit<AnsiStyle, "fg" | "bg"> & {
|
|
80
43
|
fg?: Color<Ansi>;
|
|
81
44
|
bg?: Color<Ansi>;
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
type AnyStyle<Ansi extends boolean = false> = Style<Ansi> | Color<Ansi>;
|
|
85
|
-
//#endregion
|
|
86
|
-
//#region src/themes/types.d.ts
|
|
87
|
-
/**
|
|
88
|
-
* A theme slot value. Color shortcuts expand to `{ fg: <color> }` at resolve
|
|
89
|
-
* time; Style objects are used as-is and may carry attrs (`bold`, `underline`,
|
|
90
|
-
* etc.) and a `bg`. Use Color for simple fg-only slots; escalate to Style when
|
|
91
|
-
* the part needs more than just a foreground color.
|
|
92
|
-
*/
|
|
93
|
-
type ThemeValue = Color | Style;
|
|
45
|
+
}>;
|
|
46
|
+
type ThemeValue<Ansi extends boolean = true> = ThemeStyle<Ansi> | Color<Ansi>;
|
|
94
47
|
/**
|
|
95
48
|
* A theme is a flat record mapping semantic slots to `ThemeValue`s. Callers
|
|
96
49
|
* reference slots by key (`fg: "primary"` for colors, `borderStyle: "border"`
|
|
@@ -107,103 +60,152 @@ type ThemeValue = Color | Style;
|
|
|
107
60
|
* **Surface tiers**: `ui` → `subtle` → `overlay` (bottom → top).
|
|
108
61
|
* `highlight` is orthogonal — a tinted accent surface, not a tier.
|
|
109
62
|
*/
|
|
110
|
-
type Theme = {
|
|
63
|
+
type Theme<Ansi extends boolean = true, T = ThemeValue<Ansi>> = {
|
|
111
64
|
id: string;
|
|
65
|
+
/** Dark/light appearance, inferred from bg when omitted in a theme file. */
|
|
66
|
+
appearance: "dark" | "light";
|
|
112
67
|
name?: string;
|
|
113
|
-
/**
|
|
114
|
-
*
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
fg: Color;
|
|
119
|
-
bg: Color;
|
|
68
|
+
/** Matching bundled Shiki theme. Unset or "auto" generates highlighting
|
|
69
|
+
* from the syntax slots. */
|
|
70
|
+
shiki?: ShikiSelection;
|
|
71
|
+
fg: Color<Ansi, Ansi>;
|
|
72
|
+
bg: Color<Ansi, Ansi>;
|
|
120
73
|
/** Brand / primary accent. */
|
|
121
|
-
primary: Color
|
|
74
|
+
primary: Color<Ansi>;
|
|
122
75
|
/** Secondary accent — distinct hue from `primary`. */
|
|
123
|
-
accent: Color
|
|
76
|
+
accent: Color<Ansi>;
|
|
124
77
|
/** Secondary text — first tier of the quietness ladder
|
|
125
78
|
* (`muted` → `quiet` → `comment`). Slightly faded but readable;
|
|
126
79
|
* good for timestamps, captions, less-prominent labels. */
|
|
127
|
-
muted:
|
|
80
|
+
muted: T;
|
|
128
81
|
/** De-emphasized but still readable. Reasoning / thinking text,
|
|
129
82
|
* secondary annotations, hints. */
|
|
130
|
-
quiet:
|
|
83
|
+
quiet: T;
|
|
131
84
|
/** Editor-comment tier — soft, often tinted. Used for code
|
|
132
85
|
* annotations, line-number labels, italic quotes. */
|
|
133
|
-
comment:
|
|
86
|
+
comment: T;
|
|
134
87
|
/** Section / panel titles. Typically `bold` + a fg color. */
|
|
135
|
-
title:
|
|
88
|
+
title: T;
|
|
136
89
|
/** Structural separators — borders, dividers, gutter lines. */
|
|
137
|
-
delim:
|
|
90
|
+
delim: T;
|
|
138
91
|
/** Default UI surface. Bottom of the stack. */
|
|
139
|
-
ui:
|
|
92
|
+
ui: T;
|
|
140
93
|
/** Popup / modal surface. One tier above `ui`. */
|
|
141
|
-
overlay:
|
|
94
|
+
overlay: T;
|
|
142
95
|
/** Tinted region for emphasized content within the stream — user
|
|
143
96
|
* bubble bg, focused row, callout. Distinct from `code`, which is
|
|
144
97
|
* reserved for code-block bg. */
|
|
145
|
-
highlight:
|
|
98
|
+
highlight: T;
|
|
146
99
|
/** Separators between messages or sections. */
|
|
147
|
-
divider:
|
|
100
|
+
divider: T;
|
|
148
101
|
/** Highlighted text in inputs, lists, autocomplete. */
|
|
149
|
-
selection:
|
|
102
|
+
selection: T;
|
|
150
103
|
/** Line-number column, diff markers. */
|
|
151
|
-
gutter:
|
|
104
|
+
gutter: T;
|
|
152
105
|
/** Main input-prompt styling. */
|
|
153
|
-
prompt:
|
|
106
|
+
prompt: T;
|
|
154
107
|
/** Structural border around panels, boxes, tables. */
|
|
155
|
-
border:
|
|
108
|
+
border: T;
|
|
156
109
|
/** Title text inside a bordered region (slightly stronger than
|
|
157
110
|
* `border`). */
|
|
158
|
-
borderTitle:
|
|
111
|
+
borderTitle: T;
|
|
159
112
|
/** Code-block surface (bg + optional fg). Default for `mdCodeBlock`. */
|
|
160
|
-
code:
|
|
113
|
+
code: T;
|
|
161
114
|
/** Title above a code block (e.g. file path). */
|
|
162
|
-
codeTitle:
|
|
163
|
-
success: Color
|
|
164
|
-
info: Color
|
|
165
|
-
warn: Color
|
|
166
|
-
error: Color
|
|
167
|
-
syntaxBoolean:
|
|
168
|
-
syntaxBracket:
|
|
169
|
-
syntaxConstant:
|
|
170
|
-
syntaxDelimiter:
|
|
171
|
-
syntaxField:
|
|
172
|
-
syntaxFunction:
|
|
173
|
-
syntaxNumber:
|
|
174
|
-
syntaxSpecial:
|
|
175
|
-
syntaxString:
|
|
176
|
-
mdBold:
|
|
177
|
-
mdCode:
|
|
178
|
-
mdCodeBlock:
|
|
179
|
-
mdCodeBlockTitle:
|
|
180
|
-
mdHeading1:
|
|
181
|
-
mdHeading2:
|
|
182
|
-
mdHeading3:
|
|
183
|
-
mdHeading4:
|
|
184
|
-
mdHeading5:
|
|
185
|
-
mdHeading6:
|
|
186
|
-
mdHeading:
|
|
187
|
-
mdHr:
|
|
188
|
-
mdItalic:
|
|
189
|
-
mdLink:
|
|
190
|
-
mdListBullet:
|
|
191
|
-
mdListChecked:
|
|
192
|
-
mdListUnchecked:
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
115
|
+
codeTitle: T;
|
|
116
|
+
success: Color<Ansi>;
|
|
117
|
+
info: Color<Ansi>;
|
|
118
|
+
warn: Color<Ansi>;
|
|
119
|
+
error: Color<Ansi>;
|
|
120
|
+
syntaxBoolean: T;
|
|
121
|
+
syntaxBracket: T;
|
|
122
|
+
syntaxConstant: T;
|
|
123
|
+
syntaxDelimiter: T;
|
|
124
|
+
syntaxField: T;
|
|
125
|
+
syntaxFunction: T;
|
|
126
|
+
syntaxNumber: T;
|
|
127
|
+
syntaxSpecial: T;
|
|
128
|
+
syntaxString: T;
|
|
129
|
+
mdBold: T;
|
|
130
|
+
mdCode: T;
|
|
131
|
+
mdCodeBlock: T;
|
|
132
|
+
mdCodeBlockTitle: T;
|
|
133
|
+
mdHeading1: T;
|
|
134
|
+
mdHeading2: T;
|
|
135
|
+
mdHeading3: T;
|
|
136
|
+
mdHeading4: T;
|
|
137
|
+
mdHeading5: T;
|
|
138
|
+
mdHeading6: T;
|
|
139
|
+
mdHeading: T;
|
|
140
|
+
mdHr: T;
|
|
141
|
+
mdItalic: T;
|
|
142
|
+
mdLink: T;
|
|
143
|
+
mdListBullet: T;
|
|
144
|
+
mdListChecked: T;
|
|
145
|
+
mdListUnchecked: T;
|
|
146
|
+
mdMath: T;
|
|
147
|
+
mdQuote: T;
|
|
148
|
+
mdStrikethrough: T;
|
|
149
|
+
mdTable: T;
|
|
150
|
+
mdTableHeader: T;
|
|
151
|
+
optionName: T;
|
|
152
|
+
optionDesc: T;
|
|
199
153
|
/** Currently-highlighted entry. */
|
|
200
|
-
optionActive:
|
|
201
|
-
diffAdd:
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
154
|
+
optionActive: T;
|
|
155
|
+
diffAdd: T;
|
|
156
|
+
diffDel: T;
|
|
157
|
+
diffContext: T;
|
|
158
|
+
diffAddNum: T;
|
|
159
|
+
diffDelNum: T;
|
|
160
|
+
diffContextNum: T;
|
|
206
161
|
};
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
162
|
+
type RGB = [r: number, g: number, b: number];
|
|
163
|
+
/** Alpha percentage for `/<alpha>` suffix on Color values. Any integer
|
|
164
|
+
* 0..100 is accepted at runtime; the template literal uses `${number}`
|
|
165
|
+
* so odd values like `/98` typecheck without a cast. */
|
|
166
|
+
type ColorLightness = `${number}`;
|
|
167
|
+
/** Standard ANSI color names. */
|
|
168
|
+
type AnsiColorName = "black" | "red" | "green" | "yellow" | "blue" | "magenta" | "cyan" | "white" | "gray" | "grey";
|
|
169
|
+
/** Bright ANSI variants — `brightRed`, `brightBlue`, etc. */
|
|
170
|
+
type BrightAnsiColorName = `bright${Capitalize<AnsiColorName>}`;
|
|
171
|
+
type AnsiColor = AnsiColorName | BrightAnsiColorName | HexColor | "inherit";
|
|
172
|
+
/** Hex color string. Matches `#rgb` / `#rgba` / `#rrggbb` / `#rrggbbaa`
|
|
173
|
+
* (any case; runtime validates). Alpha is native to the hex form, so
|
|
174
|
+
* there is no separate `/<alpha>` suffix for hex. */
|
|
175
|
+
type HexColor = `#${string}`;
|
|
176
|
+
type ThemeKey = Exclude<keyof Theme<false, unknown>, "shiki" | "$schema" | "id" | "name" | "appearance">;
|
|
177
|
+
/**
|
|
178
|
+
* A color value. Accepted forms:
|
|
179
|
+
* - `#rgb` / `#rrggbb` hex
|
|
180
|
+
* - ANSI color names (`red`, `cyan`, `gray`, …)
|
|
181
|
+
* - Bright ANSI variants (`brightRed`, `brightBlue`, …)
|
|
182
|
+
* - Theme slot keys from `keyof Theme` (`primary`, `muted`, …)
|
|
183
|
+
* - `'inherit'` — use the parent's color (renders as no escape).
|
|
184
|
+
* - Variant suffix `-<step>` on hex or theme slots — e.g. `primary-300`,
|
|
185
|
+
* `#82aaff-900`. The base color gets resolved through the theme
|
|
186
|
+
* (extracting the channel when needed), then `variant(base, step)`
|
|
187
|
+
* shifts it along the OKLCH tonal scale.
|
|
188
|
+
*/
|
|
189
|
+
type Color<Ansi extends boolean = true, I = true> = HexColor | (Ansi extends true ? AnsiColorName : never) | (Ansi extends true ? BrightAnsiColorName : never) | ThemeKey | (I extends true ? "inherit" : never) | `${HexColor | ThemeKey}-${ColorLightness}` | `${HexColor | ThemeKey}+${ColorLightness}`;
|
|
190
|
+
interface AnsiStyle {
|
|
191
|
+
fg?: AnsiColor;
|
|
192
|
+
bg?: AnsiColor;
|
|
193
|
+
bold?: boolean;
|
|
194
|
+
dim?: boolean;
|
|
195
|
+
italic?: boolean;
|
|
196
|
+
underline?: boolean;
|
|
197
|
+
inverse?: boolean;
|
|
198
|
+
strikethrough?: boolean;
|
|
199
|
+
}
|
|
200
|
+
/** Base style shared by every node type. Box/Text/etc. extend this.
|
|
201
|
+
* Pure styling — no layout or lifecycle fields. Widget state interfaces
|
|
202
|
+
* extend `StyleState` to pick up the `visible` base-state bits alongside
|
|
203
|
+
* these style fields. */
|
|
204
|
+
type Style<Ansi extends boolean = true> = Simplify<Omit<AnsiStyle, "fg" | "bg"> & {
|
|
205
|
+
fg?: Color<Ansi>;
|
|
206
|
+
bg?: Color<Ansi>;
|
|
207
|
+
style?: AnyStyle<Ansi>;
|
|
208
|
+
}>;
|
|
209
|
+
type AnyStyle<Ansi extends boolean = false> = Style<Ansi> | Color<Ansi>;
|
|
210
|
+
export { ShikiThemeInput as C, ShikiTheme as S, ShikiWorkerRequest as T, ShikiLanguage as _, BrightAnsiColorName as a, ShikiResult as b, HexColor as c, ThemeKey as d, Theme as f, ShikiJob as g, GeneratedShikiTheme as h, AnyStyle as i, RGB as l, ThemeValue as m, AnsiColorName as n, Color as o, ThemeStyle as p, AnsiStyle as r, ColorLightness as s, AnsiColor as t, Style as u, ShikiOpts as v, ShikiWorkerMessage as w, ShikiSelection as x, ShikiRequest as y };
|
|
211
|
+
//# sourceMappingURL=types-ByMHEdCF.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types-ByMHEdCF.d.mts","names":[],"sources":["../src/shiki/types.ts","../src/themes/types.ts","../src/style/types.ts"],"mappings":";;KAGY,aAAa;KACb,gBAAgB;KAChB,0BAA0B;KAC1B;EACV;EACA;EACA,QAAQ;;KAEE,kBAAkB,aAAa;KAE/B;EACV;EACA;EACA;EACA,QAAQ;EACR,SAAS;;KAGC,qBAAqB,KAAK;EACpC;EACA,MAAM;EACN;;KAGU,WAAW,qBACrB,kBAAkB,QAAQ,cAAc;EACtC;;KAGQ;EACV;EACA;EACA;EACA;;KAGU;EAAuB;KAAmB;EAAgB;;KAE1D;EACV,QAAQ;EACR,SAAS;;KCvCC,WAAW,+BAA+B,SACpD,KAAK;EACH,KAAK,MAAM;EACX,KAAK,MAAM;;KAGH,WAAW,+BAA+B,WAAW,QAAQ,MAAM;;;;;;;;;;;;;;;;;KAkBnE,MAAM,6BAA6B,IAAI,WAAW;EAC5D;;EAEA;EACA;;;EAGA,QAAQ;EAIR,IAAI,MAAM,MAAM;EAChB,IAAI,MAAM,MAAM;;EAEhB,SAAS,MAAM;;EAEf,QAAQ,MAAM;;;;EAOd,OAAO;;;EAGP,OAAO;;;EAGP,SAAS;;EAET,OAAO;;EAEP,OAAO;;EAKP,IAAI;;EAEJ,SAAS;;;;EAIT,WAAW;;EAKX,SAAS;;EAET,WAAW;;EAEX,QAAQ;;EAER,QAAQ;;EAER,QAAQ;;;EAGR,aAAa;;EAKb,MAAM;;EAEN,WAAW;EAIX,SAAS,MAAM;EACf,MAAM,MAAM;EACZ,MAAM,MAAM;EACZ,OAAO,MAAM;EAGb,eAAe;EACf,eAAe;EACf,gBAAgB;EAChB,iBAAiB;EACjB,aAAa;EACb,gBAAgB;EAChB,cAAc;EACd,eAAe;EACf,cAAc;EAId,QAAQ;EACR,QAAQ;EACR,aAAa;EACb,kBAAkB;EAClB,YAAY;EACZ,YAAY;EACZ,YAAY;EACZ,YAAY;EACZ,YAAY;EACZ,YAAY;EACZ,WAAW;EACX,MAAM;EACN,UAAU;EACV,QAAQ;EACR,cAAc;EACd,eAAe;EACf,iBAAiB;EACjB,QAAQ;EACR,SAAS;EACT,iBAAiB;EACjB,SAAS;EACT,eAAe;EAIf,YAAY;EACZ,YAAY;;EAEZ,cAAc;EAGd,SAAS;EACT,SAAS;EACT,aAAa;EACb,YAAY;EACZ,YAAY;EACZ,gBAAgB;;KCtJN,OAAO,WAAW,WAAW;;;;KAK7B;;KAGA;;KAaA,+BAA+B,WAAW;KAE1C,YAAY,gBAAgB,sBAAsB;;;;KAKlD;KACA,WAAW,cACf;;;;;;;;;;;;;KAgBI,MAAM,6BAA6B,YAC3C,YACC,oBAAoB,0BACpB,oBAAoB,+BACrB,YACC,yCACE,WAAW,YAAY,sBACvB,WAAW,YAAY;UAEb;EACf,KAAK;EACL,KAAK;EACL;EACA;EACA;EACA;EACA;EACA;;;;;;KAOU,MAAM,+BAA+B,SAC/C,KAAK;EACH,KAAK,MAAM;EACX,KAAK,MAAM;EACX,QAAQ,SAAS;;KAIT,SAAS,gCAAgC,MAAM,QAAQ,MAAM"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/markdown/types.d.ts
|
|
2
1
|
interface MdHeadingMeta {
|
|
3
2
|
/** Heading level (1–6). */
|
|
4
3
|
level: number;
|
|
@@ -135,6 +134,5 @@ interface MdOptions {
|
|
|
135
134
|
*/
|
|
136
135
|
render?: RenderMarkdown;
|
|
137
136
|
}
|
|
138
|
-
//#endregion
|
|
139
137
|
export { MdOptions as n, RenderMarkdown as r, MdCallbacks as t };
|
|
140
|
-
//# sourceMappingURL=types-
|
|
138
|
+
//# sourceMappingURL=types-CUVUJPz6.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types-CUVUJPz6.d.mts","names":[],"sources":["../src/markdown/types.ts"],"mappings":"A,UAEiB;;EAEf;;EAEA;;UAGe;;EAEf;;EAEA;;EAEA;;UAGe;;EAEf;;EAEA;;EAEA;;EAEA;;EAEA;;UAGe;;EAEf;;UAGe;;EAEf;;EAEA;;UAGe;;EAEf;;EAEA;;KAGU,YAAY;KACZ,OAAO,MAAM,kBAAkB,MAAM;UAEhC;;EAEf;;EAEA;;;;;;;;UASe;EACf,UAAU,OAAO;EACjB,YAAY;EACZ,aAAa;EACb,QAAQ,kBAAkB,OAAO;EACjC,OAAO,OAAO;EACd,WAAW,OAAO;EAClB,KAAK;EACL,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,KAAK;EACL,MAAM,kBAAkB,OAAO;EAC/B,MAAM,kBAAkB,OAAO;EAC/B,OAAO;EACP,SAAS;EACT,WAAW;EACX,OAAO,OAAO;EACd,QAAQ,OAAO;EACf,WAAW;EACX,gBAAgB;EAChB,QAAQ;;;;;;;KAQE,kBAAkB,eAAe,WAAW,aAAa,OAAO;;;;;UAM3D;;EAEf;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;IAAwB;IAAe;IAAe;;;EAEtD;IAAuB;IAAe;;;;;;;;;EAQtC,SAAS"}
|
|
@@ -34,7 +34,6 @@ function parseCodeInfoString(info) {
|
|
|
34
34
|
if (title !== void 0) meta.title = title;
|
|
35
35
|
return meta;
|
|
36
36
|
}
|
|
37
|
-
//#endregion
|
|
38
37
|
export { parseCodeInfoString as n, encodeFenceInfoStrings as t };
|
|
39
38
|
|
|
40
|
-
//# sourceMappingURL=utils-
|
|
39
|
+
//# sourceMappingURL=utils-DHXAegVW.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils-
|
|
1
|
+
{"version":3,"file":"utils-DHXAegVW.mjs","names":[],"sources":["../src/markdown/utils.ts"],"sourcesContent":["// Lightweight string-level utilities for the markdown pipeline. Lives in\n// its own file so Bun callers can use them without pulling in `marked`\n// (which is the heavy dep in `src/md.ts`).\n\nimport type { MdCodeBlockMeta } from \"./types.ts\"\n\n/** Sentinel stitched into fence info-strings in place of spaces. */\nexport const FENCE_MARKER = \"\\u0000\"\n\n/**\n * Replace spaces inside every fenced-block info-string with `FENCE_MARKER`\n * so renderers that truncate after the first token (Bun) still surface the\n * full info-string as the first token. Inverse of the decode step done by\n * `parseCodeInfoString`.\n *\n * Closing fences (just ``` with optional trailing whitespace) are left\n * untouched — rewriting their spaces into markers would prevent the\n * parser from recognizing the closer, swallowing the rest of the document\n * as code.\n */\nexport function encodeFenceInfoStrings(md: string): string {\n return md.replaceAll(/^( {0,3}`{3,})([^\\n]*)$/gm, (match, fence: string, info: string) =>\n info.trim() === \"\" ? match : fence + info.replaceAll(\" \", FENCE_MARKER)\n )\n}\n\n/**\n * Parse a fenced code-block info-string like `jsx title=\"src/Hello.js\"`.\n * First token → language; `title=\"...\"` / `title='...'` → title. Unknown\n * attrs after the language are ignored.\n *\n * Input may carry `FENCE_MARKER` in place of spaces (from\n * `encodeFenceInfoStrings`); those are decoded before parsing.\n */\nexport function parseCodeInfoString(info: string | undefined): MdCodeBlockMeta | undefined {\n if (!info) return undefined\n const decoded = info.includes(FENCE_MARKER) ? info.replaceAll(FENCE_MARKER, \" \") : info\n const firstSpace = decoded.search(/\\s/)\n if (firstSpace === -1) return { language: decoded }\n const language = decoded.slice(0, firstSpace)\n const rest = decoded.slice(firstSpace + 1)\n const titleMatch = /title=(?:\"([^\"]*)\"|'([^']*)')/.exec(rest) as\n | [string, string | undefined, string | undefined]\n | null\n const title = titleMatch === null ? undefined : (titleMatch[1] ?? titleMatch[2])\n const meta: MdCodeBlockMeta = {}\n if (language !== \"\") meta.language = language\n if (title !== undefined) meta.title = title\n return meta\n}\n"],"mappings":";;;;;;;;;;;AAoBA,SAAgB,uBAAuB,IAAoB;CACzD,OAAO,GAAG,WAAW,8BAA8B,OAAO,OAAe,SACvE,KAAK,KAAK,MAAM,KAAK,QAAQ,QAAQ,KAAK,WAAW,KAAA,IAAiB,CACxE;AACF;;;;;;;;;AAUA,SAAgB,oBAAoB,MAAuD;CACzF,IAAI,CAAC,MAAM,OAAO,KAAA;CAClB,MAAM,UAAU,KAAK,SAAA,IAAqB,IAAI,KAAK,WAAA,MAAyB,GAAG,IAAI;CACnF,MAAM,aAAa,QAAQ,OAAO,IAAI;CACtC,IAAI,eAAe,IAAI,OAAO,EAAE,UAAU,QAAQ;CAClD,MAAM,WAAW,QAAQ,MAAM,GAAG,UAAU;CAC5C,MAAM,OAAO,QAAQ,MAAM,aAAa,CAAC;CACzC,MAAM,aAAa,gCAAgC,KAAK,IAAI;CAG5D,MAAM,QAAQ,eAAe,OAAO,KAAA,IAAa,WAAW,MAAM,WAAW;CAC7E,MAAM,OAAwB,CAAC;CAC/B,IAAI,aAAa,IAAI,KAAK,WAAW;CACrC,IAAI,UAAU,KAAA,GAAW,KAAK,QAAQ;CACtC,OAAO;AACT"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { o as createNode } from "./reactive-
|
|
2
|
-
|
|
1
|
+
import { o as createNode } from "./reactive-DkP75TPk.mjs";
|
|
2
|
+
// src/widgets/widget.ts
|
|
3
3
|
/**
|
|
4
4
|
* Type helper for declaring widgets — runtime identity, just `return fn`.
|
|
5
5
|
*
|
|
@@ -34,7 +34,6 @@ import { o as createNode } from "./reactive-f7NpAi69.mjs";
|
|
|
34
34
|
function widget(fn) {
|
|
35
35
|
return ((...args) => createNode(() => fn(...args)));
|
|
36
36
|
}
|
|
37
|
-
//#endregion
|
|
38
37
|
export { widget as t };
|
|
39
38
|
|
|
40
|
-
//# sourceMappingURL=widget-
|
|
39
|
+
//# sourceMappingURL=widget-sFveyrZE.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"widget-
|
|
1
|
+
{"version":3,"file":"widget-sFveyrZE.mjs","names":[],"sources":["../src/widgets/widget.ts"],"sourcesContent":["import type { Node } from \"../core/node.ts\"\n\nimport { createNode } from \"../core/reactive.ts\"\n\nexport type Props = Record<string, unknown>\n\n/**\n * A widget factory: takes some args, returns a `Node`.\n *\n * The default `A = never[]` makes the *bare* `Widget` the universal\n * \"any widget\" type — the `(...args: never[]) => Node` idiom. Every\n * concrete factory (zero-arg, `state + ...children`, single-props) is\n * assignable to it, so it works both as the `widget()` constraint and\n * as a stored value type (`details?: Widget`, invoked zero-arg). Supply\n * `A` explicitly for a precise signature: `Widget<[State<LogState>]>`.\n */\nexport type Widget<A extends unknown[] = never[], N extends Node = Node> = (...args: A) => N\n\n/**\n * Type helper for declaring widgets — runtime identity, just `return fn`.\n *\n * Three things it earns:\n * 1. Inference at the declaration site: TS infers `S` from the function\n * parameter and enforces it on every call site.\n * 2. A consistent grep target: every component reads as\n * `export const foo = widget((props) => …)`.\n * 3. A future seam for instrumentation, lifecycle wrappers, devtools.\n *\n * The factory body runs **once** at construction. Reactive content lives\n * in leaf thunks (`text(({ style }) => …)`), not by re-running the body\n * — this is the Solid model, not React's. `ctx` is therefore unavailable\n * inside the factory; reach for it inside leaf thunks where it belongs.\n *\n * ```ts\n * const status = widget((props: { level: \"ok\" | \"warn\"; msg: string }) =>\n * text(({ style }) => `${style.bold[props.level](\"●\")} ${style.dim(props.msg)}`),\n * )\n *\n * status({ level: \"ok\", msg: \"all systems nominal\" })\n * ```\n */\n/**\n * Call-site args derived from `S`:\n * - If `S` declares `children`, `children` is injected from rest args;\n * state at the call site has `children` omitted, then `...children`.\n * - Otherwise, no rest is allowed.\n * - Either way, the state arg is optional when every field of the\n * resolved state is optional (so bare `widget()` works).\n */\n\nexport function widget<T extends Widget>(fn: T): T {\n return ((...args: Parameters<T>) => createNode(() => fn(...args))) as T\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkDA,SAAgB,OAAyB,IAAU;CACjD,SAAS,GAAG,SAAwB,iBAAiB,GAAG,GAAG,IAAI,CAAC;AAClE"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
//#region src/widgets/widget.d.ts
|
|
1
|
+
import { h as Node } from "./queries-Dmd3IjSd.mjs";
|
|
3
2
|
type Props = Record<string, unknown>;
|
|
4
3
|
/**
|
|
5
4
|
* A widget factory: takes some args, returns a `Node`.
|
|
@@ -44,6 +43,5 @@ type Widget<A extends unknown[] = never[], N extends Node = Node> = (...args: A)
|
|
|
44
43
|
* resolved state is optional (so bare `widget()` works).
|
|
45
44
|
*/
|
|
46
45
|
declare function widget<T extends Widget>(fn: T): T;
|
|
47
|
-
//#endregion
|
|
48
46
|
export { Widget as n, widget as r, Props as t };
|
|
49
|
-
//# sourceMappingURL=widget-
|
|
47
|
+
//# sourceMappingURL=widget-sPJaKVU2.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"widget-sPJaKVU2.d.mts","names":[],"sources":["../src/widgets/widget.ts"],"mappings":";KAIY,QAAQ;;;;;;;;;;;KAYR,OAAO,+BAA+B,UAAU,OAAO,YAAY,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAkC3E,OAAO,UAAU,QAAQ,IAAI,IAAI"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as AutocompleteState, i as AutocompleteOptions, n as Autocomplete, o as CompletionSource, r as AutocompleteEvents, s as autocomplete, t as AcceptFn } from "../autocomplete-
|
|
1
|
+
import { a as AutocompleteState, i as AutocompleteOptions, n as Autocomplete, o as CompletionSource, r as AutocompleteEvents, s as autocomplete, t as AcceptFn } from "../autocomplete-wgceuhLr.mjs";
|
|
2
2
|
export { AcceptFn, Autocomplete, AutocompleteEvents, AutocompleteOptions, AutocompleteState, CompletionSource, autocomplete };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { S as unwrap, f as effect, h as memo, y as signal } from "../reactive-
|
|
2
|
-
import { t as Node } from "../node-
|
|
3
|
-
import { t as picker } from "../picker-
|
|
4
|
-
import { t as Input } from "../input-
|
|
5
|
-
|
|
1
|
+
import { S as unwrap, f as effect, h as memo, y as signal } from "../reactive-DkP75TPk.mjs";
|
|
2
|
+
import { t as Node } from "../node-CXNobGaP.mjs";
|
|
3
|
+
import { t as picker } from "../picker-D9WrE3zF.mjs";
|
|
4
|
+
import { t as Input } from "../input-BkE4EpBw.mjs";
|
|
5
|
+
// src/widgets/autocomplete.ts
|
|
6
6
|
/**
|
|
7
7
|
* Autocomplete popup bound to an `Input`. Watches the input's value and
|
|
8
8
|
* cursor; when one of the configured sources' trigger regexes matches
|
|
@@ -159,7 +159,6 @@ function defaultAccept(item) {
|
|
|
159
159
|
function autocomplete(opts) {
|
|
160
160
|
return new Autocomplete(opts);
|
|
161
161
|
}
|
|
162
|
-
//#endregion
|
|
163
162
|
export { Autocomplete, autocomplete };
|
|
164
163
|
|
|
165
164
|
//# sourceMappingURL=autocomplete.mjs.map
|
package/dist/widgets/box.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { B as
|
|
1
|
+
import { B as Box, H as Padding, U as box, V as BoxStyle } from "../queries-Dmd3IjSd.mjs";
|
|
2
2
|
export { Box, BoxStyle, Padding, box };
|
package/dist/widgets/box.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as Box, n as box } from "../box-
|
|
1
|
+
export { t as Box, n as box } from "../box-DToDoXlU.mjs";
|
package/dist/widgets/code.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { i as AnyStyle } from "../types-ByMHEdCF.mjs";
|
|
2
|
+
import { B as Box, Q as State, it as Reactive } from "../queries-Dmd3IjSd.mjs";
|
|
3
|
+
import { t as WrapMode } from "../text-DdkJXgoC.mjs";
|
|
4
4
|
export interface CodeState {
|
|
5
5
|
/** Source to render. Plain string or reactive accessor — pass a
|
|
6
6
|
* signal for streaming bash output / tool results. */
|
|
@@ -23,6 +23,7 @@ export interface CodeState {
|
|
|
23
23
|
offset?: Reactive<number | undefined>;
|
|
24
24
|
limit?: Reactive<number | undefined>;
|
|
25
25
|
more?: (more: number, msg: string) => string;
|
|
26
|
+
wrap?: WrapMode;
|
|
26
27
|
}
|
|
27
28
|
/**
|
|
28
29
|
* Standalone code block: shiki-highlighted body inside a `code`-styled
|
|
@@ -43,5 +44,4 @@ export interface CodeState {
|
|
|
43
44
|
* resolved highlight rather than the initial plain source.
|
|
44
45
|
*/
|
|
45
46
|
export declare const code: (props: State<CodeState>) => Box<{}>;
|
|
46
|
-
//#endregion
|
|
47
47
|
//# sourceMappingURL=code.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code.d.mts","names":["_$__box_ts0.Box"],"sources":["../../src/widgets/code.ts"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"code.d.mts","names":["_$__box_ts0.Box"],"sources":["../../src/widgets/code.ts"],"mappings":";;;iBAgBiB;;;EAGf,MAAM;;;EAGN,OAAO;;;;EAIP;;;EAGA,QAAQ;;EAER;EACA,QAAQ;EACR;EACA,eAAe;EACf,SAAS;EACT,QAAQ;EACR,QAAQ,cAAc;EACtB,OAAO;;;;;;;;;;;;;;;;;;;;qBAqBI,OAAI,OAAkB,MAAM,eAANA"}
|
package/dist/widgets/code.mjs
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { S as unwrap, h as memo, r as createAsync, w as useContext } from "../reactive-
|
|
2
|
-
import { n as box } from "../box-
|
|
3
|
-
import { a as formatLines } from "../text-
|
|
4
|
-
import { n as text } from "../text-
|
|
5
|
-
import { t as RenderContext } from "../render-
|
|
6
|
-
import { t as codeToAnsi } from "../shiki
|
|
7
|
-
import { t as
|
|
8
|
-
import { t as
|
|
1
|
+
import { S as unwrap, h as memo, r as createAsync, w as useContext } from "../reactive-DkP75TPk.mjs";
|
|
2
|
+
import { n as box } from "../box-DToDoXlU.mjs";
|
|
3
|
+
import { a as formatLines } from "../text-4arC3odI.mjs";
|
|
4
|
+
import { n as text } from "../text-BArwVVkg.mjs";
|
|
5
|
+
import { t as RenderContext } from "../render-Bp2N2i6J.mjs";
|
|
6
|
+
import { t as codeToAnsi } from "../shiki-BAf9PdIc.mjs";
|
|
7
|
+
import { t as shikiTheme } from "../theme-B8hb1lPU.mjs";
|
|
8
|
+
import { t as widget } from "../widget-sFveyrZE.mjs";
|
|
9
|
+
import { t as show } from "../show-D5XNXgZf.mjs";
|
|
9
10
|
import { extname } from "pathe";
|
|
10
|
-
|
|
11
|
+
// src/widgets/code.ts
|
|
11
12
|
/**
|
|
12
13
|
* Standalone code block: shiki-highlighted body inside a `code`-styled
|
|
13
14
|
* shrink-to-content backdrop, optionally titled.
|
|
@@ -36,7 +37,7 @@ const code = widget((props) => {
|
|
|
36
37
|
const body = createAsync(async () => {
|
|
37
38
|
const source = plain();
|
|
38
39
|
if (!lang || !syntax) return source;
|
|
39
|
-
return await codeToAnsi(source, lang, { theme: context
|
|
40
|
+
return await codeToAnsi(source, lang, { theme: context ? shikiTheme(context.style().theme) : void 0 });
|
|
40
41
|
}, { initialValue: plain() });
|
|
41
42
|
const formatted = memo(() => formatLines(body().split("\n"), {
|
|
42
43
|
limit: unwrap(props.limit),
|
|
@@ -51,9 +52,8 @@ const code = widget((props) => {
|
|
|
51
52
|
padding: props.style === false ? void 0 : [0, 1],
|
|
52
53
|
style: props.style === false ? void 0 : props.style ?? "code",
|
|
53
54
|
width: "fit"
|
|
54
|
-
}, show({ when: title }, () => text((ctx) => ctx.style.codeTitle(title() ?? ""), { wrap: "none" })), text(formatted, { wrap: "none" }));
|
|
55
|
+
}, show({ when: title }, () => text((ctx) => ctx.style.codeTitle(title() ?? ""), { wrap: "none" })), text(formatted, { wrap: props.wrap ?? "none" }));
|
|
55
56
|
});
|
|
56
|
-
//#endregion
|
|
57
57
|
export { code };
|
|
58
58
|
|
|
59
59
|
//# sourceMappingURL=code.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code.mjs","names":[],"sources":["../../src/widgets/code.ts"],"sourcesContent":["import type { Reactive } from \"../core/reactive.ts\"\nimport type { State } from \"../core/state.ts\"\nimport type { AnyStyle } from \"../style/types.ts\"\n\nimport { extname } from \"pathe\"\nimport { createAsync, memo, unwrap, useContext } from \"../core/reactive.ts\"\nimport { RenderContext } from \"../core/render.ts\"\nimport { formatLines } from \"../layout/text.ts\"\nimport { codeToAnsi } from \"../shiki/shiki.ts\"\nimport { box } from \"./box.ts\"\nimport { show } from \"./show.ts\"\nimport { text } from \"./text.ts\"\nimport { widget } from \"./widget.ts\"\n\nexport interface CodeState {\n /** Source to render. Plain string or reactive accessor — pass a\n * signal for streaming bash output / tool results. */\n code: Reactive<string>\n /** Optional file path. Drives the default `lang` (extension) and\n * `title` (path) when those aren't set explicitly. */\n path?: Reactive<string>\n /** Language for syntax highlighting (any shiki-bundled name or\n * alias). Defaults to `extname(path).slice(1)` when `path` is set.\n * Unknown langs fall through to plain rendering. */\n lang?: string\n /** Title line shown above the block. May contain ANSI. Defaults to\n * `path` when set. */\n title?: Reactive<string>\n /** Disable syntax highlighting even if `lang` is set. Default: `true`. */\n syntax?: boolean\n style?: AnyStyle | false\n numbered?: boolean\n numberOffset?: Reactive<number | undefined>\n offset?: Reactive<number | undefined>\n limit?: Reactive<number | undefined>\n more?: (more: number, msg: string) => string\n}\n\n/**\n * Standalone code block: shiki-highlighted body inside a `code`-styled\n * shrink-to-content backdrop, optionally titled.\n *\n * Composition over custom layout — the backdrop is `box({ bg: \"code\",\n * width: \"fit\" })`, the body is plain `text(...)`. Ambient theme/style\n * arrive via `useContext(RenderContext)`; the async closure reads\n * `style()?.theme` so it stays correct across theme swaps.\n *\n * Async highlighting flows through `createAsync`: signal reads inside\n * the async closure auto-track, so `props.code` (or any other reactive\n * source) drives a re-fire. The accessor returns `initialValue` (the\n * plain source) until shiki resolves, then swaps to the highlighted\n * version. When called inside a Stream surface's `append`, the surface\n * installs a `SuspenseContext` boundary; Stream awaits it before\n * painting, so rows committed to scrollback always reflect the\n * resolved highlight rather than the initial plain source.\n */\nexport const code = widget((props: State<CodeState>) => {\n const path = unwrap(props.path)\n const lang = props.lang ?? (path !== undefined ? extname(path).slice(1).toLowerCase() : undefined)\n const syntax = props.syntax ?? true\n\n // Theme is sourced from a render-time hook since the async closure\n // runs outside the render phase.\n\n const context = useContext(RenderContext)\n\n const title = memo(() => unwrap(props.title) ?? path)\n\n const plain = () => unwrap(props.code).replace(/\\n+$/, \"\")\n\n const body = createAsync(\n async () => {\n const source = plain()\n if (!lang || !syntax) return source\n return await codeToAnsi(source, lang, {
|
|
1
|
+
{"version":3,"file":"code.mjs","names":[],"sources":["../../src/widgets/code.ts"],"sourcesContent":["import type { Reactive } from \"../core/reactive.ts\"\nimport type { State } from \"../core/state.ts\"\nimport type { WrapMode } from \"../layout/text.ts\"\nimport type { AnyStyle } from \"../style/types.ts\"\n\nimport { extname } from \"pathe\"\nimport { createAsync, memo, unwrap, useContext } from \"../core/reactive.ts\"\nimport { RenderContext } from \"../core/render.ts\"\nimport { formatLines } from \"../layout/text.ts\"\nimport { codeToAnsi } from \"../shiki/shiki.ts\"\nimport { shikiTheme } from \"../shiki/theme.ts\"\nimport { box } from \"./box.ts\"\nimport { show } from \"./show.ts\"\nimport { text } from \"./text.ts\"\nimport { widget } from \"./widget.ts\"\n\nexport interface CodeState {\n /** Source to render. Plain string or reactive accessor — pass a\n * signal for streaming bash output / tool results. */\n code: Reactive<string>\n /** Optional file path. Drives the default `lang` (extension) and\n * `title` (path) when those aren't set explicitly. */\n path?: Reactive<string>\n /** Language for syntax highlighting (any shiki-bundled name or\n * alias). Defaults to `extname(path).slice(1)` when `path` is set.\n * Unknown langs fall through to plain rendering. */\n lang?: string\n /** Title line shown above the block. May contain ANSI. Defaults to\n * `path` when set. */\n title?: Reactive<string>\n /** Disable syntax highlighting even if `lang` is set. Default: `true`. */\n syntax?: boolean\n style?: AnyStyle | false\n numbered?: boolean\n numberOffset?: Reactive<number | undefined>\n offset?: Reactive<number | undefined>\n limit?: Reactive<number | undefined>\n more?: (more: number, msg: string) => string\n wrap?: WrapMode\n}\n\n/**\n * Standalone code block: shiki-highlighted body inside a `code`-styled\n * shrink-to-content backdrop, optionally titled.\n *\n * Composition over custom layout — the backdrop is `box({ bg: \"code\",\n * width: \"fit\" })`, the body is plain `text(...)`. Ambient theme/style\n * arrive via `useContext(RenderContext)`; the async closure reads\n * `style()?.theme` so it stays correct across theme swaps.\n *\n * Async highlighting flows through `createAsync`: signal reads inside\n * the async closure auto-track, so `props.code` (or any other reactive\n * source) drives a re-fire. The accessor returns `initialValue` (the\n * plain source) until shiki resolves, then swaps to the highlighted\n * version. When called inside a Stream surface's `append`, the surface\n * installs a `SuspenseContext` boundary; Stream awaits it before\n * painting, so rows committed to scrollback always reflect the\n * resolved highlight rather than the initial plain source.\n */\nexport const code = widget((props: State<CodeState>) => {\n const path = unwrap(props.path)\n const lang = props.lang ?? (path !== undefined ? extname(path).slice(1).toLowerCase() : undefined)\n const syntax = props.syntax ?? true\n\n // Theme is sourced from a render-time hook since the async closure\n // runs outside the render phase.\n\n const context = useContext(RenderContext)\n\n const title = memo(() => unwrap(props.title) ?? path)\n\n const plain = () => unwrap(props.code).replace(/\\n+$/, \"\")\n\n const body = createAsync(\n async () => {\n const source = plain()\n if (!lang || !syntax) return source\n return await codeToAnsi(source, lang, {\n theme: context ? shikiTheme(context.style().theme) : undefined,\n })\n },\n { initialValue: plain() }\n )\n\n const formatted = memo(() =>\n formatLines(body().split(\"\\n\"), {\n limit: unwrap(props.limit),\n more: props.more,\n numberOffset: unwrap(props.numberOffset),\n numbered: props.numbered,\n offset: unwrap(props.offset),\n style: context?.style().gutter,\n }).join(\"\\n\")\n )\n\n return box(\n {\n flexDirection: \"column\",\n padding: props.style === false ? undefined : [0, 1],\n style: props.style === false ? undefined : (props.style ?? \"code\"),\n width: \"fit\",\n },\n show({ when: title }, () =>\n text((ctx) => ctx.style.codeTitle(title() ?? \"\"), { wrap: \"none\" })\n ),\n text(formatted, { wrap: props.wrap ?? \"none\" })\n )\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2DA,MAAa,OAAO,QAAQ,UAA4B;CACtD,MAAM,OAAO,OAAO,MAAM,IAAI;CAC9B,MAAM,OAAO,MAAM,SAAS,SAAS,KAAA,IAAY,QAAQ,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,YAAY,IAAI,KAAA;CACxF,MAAM,SAAS,MAAM,UAAU;CAK/B,MAAM,UAAU,WAAW,aAAa;CAExC,MAAM,QAAQ,WAAW,OAAO,MAAM,KAAK,KAAK,IAAI;CAEpD,MAAM,cAAc,OAAO,MAAM,IAAI,CAAC,CAAC,QAAQ,QAAQ,EAAE;CAEzD,MAAM,OAAO,YACX,YAAY;EACV,MAAM,SAAS,MAAM;EACrB,IAAI,CAAC,QAAQ,CAAC,QAAQ,OAAO;EAC7B,OAAO,MAAM,WAAW,QAAQ,MAAM,EACpC,OAAO,UAAU,WAAW,QAAQ,MAAM,CAAC,CAAC,KAAK,IAAI,KAAA,EACvD,CAAC;CACH,GACA,EAAE,cAAc,MAAM,EAAE,CAC1B;CAEA,MAAM,YAAY,WAChB,YAAY,KAAK,CAAC,CAAC,MAAM,IAAI,GAAG;EAC9B,OAAO,OAAO,MAAM,KAAK;EACzB,MAAM,MAAM;EACZ,cAAc,OAAO,MAAM,YAAY;EACvC,UAAU,MAAM;EAChB,QAAQ,OAAO,MAAM,MAAM;EAC3B,OAAO,SAAS,MAAM,CAAC,CAAC;CAC1B,CAAC,CAAC,CAAC,KAAK,IAAI,CACd;CAEA,OAAO,IACL;EACE,eAAe;EACf,SAAS,MAAM,UAAU,QAAQ,KAAA,IAAY,CAAC,GAAG,CAAC;EAClD,OAAO,MAAM,UAAU,QAAQ,KAAA,IAAa,MAAM,SAAS;EAC3D,OAAO;CACT,GACA,KAAK,EAAE,MAAM,MAAM,SACjB,MAAM,QAAQ,IAAI,MAAM,UAAU,MAAM,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC,CACpE,GACA,KAAK,WAAW,EAAE,MAAM,MAAM,QAAQ,OAAO,CAAC,CAChD;AACF,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as ActionsSourceOptions, r as actionsSource, t as ActionCompletionItem } from "../../actions-
|
|
1
|
+
import { n as ActionsSourceOptions, r as actionsSource, t as ActionCompletionItem } from "../../actions-B0yyZ-Ww.mjs";
|
|
2
2
|
export { ActionCompletionItem, ActionsSourceOptions, actionsSource };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as actionsSource } from "../../actions-
|
|
1
|
+
export { t as actionsSource } from "../../actions-AY6avfEV.mjs";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as filesSource, t as FilesSourceOptions } from "../../files-
|
|
1
|
+
import { n as filesSource, t as FilesSourceOptions } from "../../files-CdiDnwA_.mjs";
|
|
2
2
|
export { FilesSourceOptions, filesSource };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as filesSource } from "../../files-
|
|
1
|
+
export { t as filesSource } from "../../files-C3ZnFpvq.mjs";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as githubSource, i as GithubState, n as GithubItem, r as GithubSourceOptions, t as GithubFetcher } from "../../github-
|
|
1
|
+
import { a as githubSource, i as GithubState, n as GithubItem, r as GithubSourceOptions, t as GithubFetcher } from "../../github-DC0XemKa.mjs";
|
|
2
2
|
export { GithubFetcher, GithubItem, GithubSourceOptions, GithubState, githubSource };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as githubSource } from "../../github-
|
|
1
|
+
export { t as githubSource } from "../../github-CLveT9mq.mjs";
|