@zaly/tui 0.1.0 → 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/dist/{actions-DEIKF2ts.mjs → actions-AY6avfEV.mjs} +2 -3
- package/dist/{actions-DEIKF2ts.mjs.map → actions-AY6avfEV.mjs.map} +1 -1
- package/dist/{actions--ODlgCQ5.d.mts → actions-B0yyZ-Ww.d.mts} +4 -6
- package/dist/actions-B0yyZ-Ww.d.mts.map +1 -0
- package/dist/{ansi-CMv71xVr.mjs → ansi-CxgRPLA2.mjs} +3 -4
- package/dist/{ansi-CMv71xVr.mjs.map → ansi-CxgRPLA2.mjs.map} +1 -1
- package/dist/ansi.d.mts +1 -3
- package/dist/ansi.d.mts.map +1 -1
- package/dist/ansi.mjs +1 -1
- package/dist/{autocomplete-CD30kSe_.d.mts → autocomplete-wgceuhLr.d.mts} +5 -7
- package/dist/autocomplete-wgceuhLr.d.mts.map +1 -0
- package/dist/{box-C_N_7ChP.mjs → box-DbIjxh39.mjs} +8 -10
- package/dist/{box-C_N_7ChP.mjs.map → box-DbIjxh39.mjs.map} +1 -1
- package/dist/{builder-Chwtk0nQ.mjs → builder-BdYlK1Ew.mjs} +5 -6
- package/dist/{builder-Chwtk0nQ.mjs.map → builder-BdYlK1Ew.mjs.map} +1 -1
- package/dist/{callbacks-DLecWn7G.mjs → callbacks-UaBfDStQ.mjs} +8 -12
- package/dist/{callbacks-DLecWn7G.mjs.map → callbacks-UaBfDStQ.mjs.map} +1 -1
- package/dist/{client-D7qz4TZt.mjs → client-BWm6dNZF.mjs} +4 -5
- package/dist/{client-D7qz4TZt.mjs.map → client-BWm6dNZF.mjs.map} +1 -1
- 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-DBMQLv4Y.mjs → color-Cr1VoL49.mjs} +2 -3
- package/dist/{color-DBMQLv4Y.mjs.map → color-Cr1VoL49.mjs.map} +1 -1
- package/dist/ctx-CYEzzH-7.mjs +1 -0
- package/dist/{ctx-BaQ2hP5u.mjs → ctx-DBeFcZt6.mjs} +4 -5
- package/dist/{ctx-BaQ2hP5u.mjs.map → ctx-DBeFcZt6.mjs.map} +1 -1
- package/dist/{divider-BlNNN2OS.mjs → divider-BPmnQ0Eu.mjs} +3 -4
- package/dist/{divider-BlNNN2OS.mjs.map → divider-BPmnQ0Eu.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-B_5HDBPp.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-CyRwUQ3y.d.mts → github-DC0XemKa.d.mts} +3 -5
- package/dist/github-DC0XemKa.d.mts.map +1 -0
- package/dist/{image-BLls2F4t.d.mts → image-DdRDv7q6.d.mts} +2 -4
- package/dist/image-DdRDv7q6.d.mts.map +1 -0
- package/dist/{image-Cqtj3yRA.mjs → image-M--Bw4bs.mjs} +6 -7
- package/dist/{image-Cqtj3yRA.mjs.map → image-M--Bw4bs.mjs.map} +1 -1
- 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 +3 -15
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +11 -14
- package/dist/index.mjs.map +1 -1
- package/dist/{input-NuD8TH8N.d.mts → input-C3kfYoEJ.d.mts} +3 -5
- package/dist/input-C3kfYoEJ.d.mts.map +1 -0
- package/dist/{input-ET2YEMcl.mjs → input-CtGmVrKa.mjs} +6 -7
- package/dist/{input-ET2YEMcl.mjs.map → input-CtGmVrKa.mjs.map} +1 -1
- package/dist/{inspect-Cxzs-W0g.mjs → inspect-Cli1beu8.mjs} +3 -4
- package/dist/{inspect-Cxzs-W0g.mjs.map → inspect-Cli1beu8.mjs.map} +1 -1
- package/dist/{inspect-B1uXxdKC.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-B4djzy2m.mjs → log-D6gGicwQ.mjs} +6 -7
- package/dist/{log-B4djzy2m.mjs.map → log-D6gGicwQ.mjs.map} +1 -1
- package/dist/{logger-CvJCITzP.mjs → logger-C0WuIlAh.mjs} +5 -6
- package/dist/{logger-CvJCITzP.mjs.map → logger-C0WuIlAh.mjs.map} +1 -1
- package/dist/{markdown-D3ZtRn6C.mjs → markdown-DvDIPT5L.mjs} +11 -12
- package/dist/{markdown-D3ZtRn6C.mjs.map → markdown-DvDIPT5L.mjs.map} +1 -1
- 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-Dd7a1irv.mjs → math-VPuwFCid.mjs} +1 -2
- package/dist/{math-Dd7a1irv.mjs.map → math-VPuwFCid.mjs.map} +1 -1
- 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-Bsh5swbC.mjs → oklch-Boh4YHEc.mjs} +3 -4
- package/dist/{oklch-Bsh5swbC.mjs.map → oklch-Boh4YHEc.mjs.map} +1 -1
- package/dist/{overlay-LvOjG7kn.mjs → overlay-zDNpwKu0.mjs} +3 -4
- package/dist/{overlay-LvOjG7kn.mjs.map → overlay-zDNpwKu0.mjs.map} +1 -1
- package/dist/{picker-f6xjgACX.mjs → picker-DV_oxKEv.mjs} +11 -16
- package/dist/{picker-f6xjgACX.mjs.map → picker-DV_oxKEv.mjs.map} +1 -1
- package/dist/{picker-B-OxKKnD.d.mts → picker-DsB6--GN.d.mts} +6 -8
- package/dist/picker-DsB6--GN.d.mts.map +1 -0
- package/dist/{queries-BUkBxkuM.mjs → queries-BIniKnLL.mjs} +3 -5
- package/dist/{queries-BUkBxkuM.mjs.map → queries-BIniKnLL.mjs.map} +1 -1
- package/dist/{queries-C75-wG1B.d.mts → queries-Dmd3IjSd.d.mts} +3 -51
- 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-DUWpSPoo.mjs → registry-CQU0VwpM.mjs} +9 -14
- package/dist/{registry-DUWpSPoo.mjs.map → registry-CQU0VwpM.mjs.map} +1 -1
- package/dist/{render-B7LfNM5K.mjs → render-Bp2N2i6J.mjs} +4 -5
- package/dist/{render-B7LfNM5K.mjs.map → render-Bp2N2i6J.mjs.map} +1 -1
- package/dist/renderer-Dv5fIuIk.mjs +1 -0
- package/dist/{renderer-aAtkFgll.mjs → renderer-Ksfkfv5X.mjs} +3 -4
- package/dist/{renderer-aAtkFgll.mjs.map → renderer-Ksfkfv5X.mjs.map} +1 -1
- package/dist/{renderer-BLsd-wrG.mjs → renderer-OplFCBMq.mjs} +25 -38
- package/dist/{renderer-BLsd-wrG.mjs.map → renderer-OplFCBMq.mjs.map} +1 -1
- package/dist/{search-FvGnswRl.d.mts → search-DsHzamic.d.mts} +1 -9
- package/dist/search-DsHzamic.d.mts.map +1 -0
- package/dist/{select-BKE5LzdN.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 +6 -8
- package/dist/shiki/server.mjs.map +1 -1
- package/dist/{shiki-CJauRusM.mjs → shiki-BAf9PdIc.mjs} +4 -5
- package/dist/{shiki-CJauRusM.mjs.map → shiki-BAf9PdIc.mjs.map} +1 -1
- package/dist/{shiki-B4U0s8jT.mjs → shiki-DUUAIE6f.mjs} +4 -7
- package/dist/{shiki-B4U0s8jT.mjs.map → shiki-DUUAIE6f.mjs.map} +1 -1
- 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-DslRHzI4.mjs → style-Cw_EuszU.mjs} +5 -6
- package/dist/{style-DslRHzI4.mjs.map → style-Cw_EuszU.mjs.map} +1 -1
- package/dist/style.d.mts +2 -4
- package/dist/style.d.mts.map +1 -1
- package/dist/style.mjs +3 -3
- package/dist/{text-BoJdKXLU.mjs → text-BEuhhxr7.mjs} +4 -5
- package/dist/text-BEuhhxr7.mjs.map +1 -0
- package/dist/{text-CmxbA8lk.d.mts → text-DdkJXgoC.d.mts} +3 -5
- package/dist/text-DdkJXgoC.d.mts.map +1 -0
- package/dist/{text-DPrhma4x.mjs → text-H_2kzwaz.mjs} +5 -6
- package/dist/{text-DPrhma4x.mjs.map → text-H_2kzwaz.mjs.map} +1 -1
- package/dist/text.d.mts +1 -1
- package/dist/text.mjs +1 -1
- package/dist/{theme-C8LkcoaK.mjs → theme-B8hb1lPU.mjs} +3 -4
- package/dist/{theme-C8LkcoaK.mjs.map → theme-B8hb1lPU.mjs.map} +1 -1
- package/dist/{theme-DVX8dvGG.mjs → theme-BeSaXGNY.mjs} +3 -5
- package/dist/{theme-DVX8dvGG.mjs.map → theme-BeSaXGNY.mjs.map} +1 -1
- package/dist/themes.d.mts +1 -7
- package/dist/themes.d.mts.map +1 -1
- package/dist/themes.mjs +1 -1
- package/dist/{tree-CTvSpF9b.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-C9ceMsbJ.d.mts → types-ByMHEdCF.d.mts} +1 -7
- 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-DlF32PRp.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 +3 -5
- package/dist/widgets/code.d.mts.map +1 -1
- package/dist/widgets/code.mjs +10 -11
- 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 +9 -10
- 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 +5 -6
- 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 +3 -3
- package/dist/actions--ODlgCQ5.d.mts.map +0 -1
- package/dist/autocomplete-CD30kSe_.d.mts.map +0 -1
- package/dist/client-CNGt-dOt.mjs +0 -1
- package/dist/ctx-CndlTp1T.mjs +0 -1
- package/dist/files-B_5HDBPp.d.mts.map +0 -1
- package/dist/github-CyRwUQ3y.d.mts.map +0 -1
- package/dist/image-BLls2F4t.d.mts.map +0 -1
- package/dist/input-NuD8TH8N.d.mts.map +0 -1
- package/dist/inspect-B1uXxdKC.d.mts.map +0 -1
- package/dist/kitty-DKQYsQfH.mjs +0 -1
- package/dist/math-CU0wmC9N.mjs +0 -1
- package/dist/picker-B-OxKKnD.d.mts.map +0 -1
- package/dist/queries-C75-wG1B.d.mts.map +0 -1
- package/dist/renderer-YHbR7JZ4.mjs +0 -1
- package/dist/search-FvGnswRl.d.mts.map +0 -1
- package/dist/select-BKE5LzdN.d.mts.map +0 -1
- package/dist/text-BoJdKXLU.mjs.map +0 -1
- package/dist/text-CmxbA8lk.d.mts.map +0 -1
- package/dist/tree-CTvSpF9b.d.mts.map +0 -1
- package/dist/types-C9ceMsbJ.d.mts.map +0 -1
- package/dist/types-D3jk1rtk.d.mts.map +0 -1
- package/dist/widget-DlF32PRp.d.mts.map +0 -1
- package/dist/worker-C01jK2Ip.mjs +0 -1
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Simplify } from "@zaly/shared";
|
|
2
2
|
import { BundledLanguage, BundledTheme } from "shiki/types";
|
|
3
|
-
//#region src/shiki/types.d.ts
|
|
4
3
|
type ShikiTheme = BundledTheme;
|
|
5
4
|
type ShikiLanguage = BundledLanguage;
|
|
6
5
|
type ShikiSelection = "auto" | ShikiTheme;
|
|
@@ -40,8 +39,6 @@ type ShikiOpts = {
|
|
|
40
39
|
theme?: ShikiThemeInput;
|
|
41
40
|
signal?: AbortSignal;
|
|
42
41
|
};
|
|
43
|
-
//#endregion
|
|
44
|
-
//#region src/themes/types.d.ts
|
|
45
42
|
type ThemeStyle<Ansi extends boolean = true> = Simplify<Omit<AnsiStyle, "fg" | "bg"> & {
|
|
46
43
|
fg?: Color<Ansi>;
|
|
47
44
|
bg?: Color<Ansi>;
|
|
@@ -162,8 +159,6 @@ type Theme<Ansi extends boolean = true, T = ThemeValue<Ansi>> = {
|
|
|
162
159
|
diffDelNum: T;
|
|
163
160
|
diffContextNum: T;
|
|
164
161
|
};
|
|
165
|
-
//#endregion
|
|
166
|
-
//#region src/style/types.d.ts
|
|
167
162
|
type RGB = [r: number, g: number, b: number];
|
|
168
163
|
/** Alpha percentage for `/<alpha>` suffix on Color values. Any integer
|
|
169
164
|
* 0..100 is accepted at runtime; the template literal uses `${number}`
|
|
@@ -212,6 +207,5 @@ type Style<Ansi extends boolean = true> = Simplify<Omit<AnsiStyle, "fg" | "bg">
|
|
|
212
207
|
style?: AnyStyle<Ansi>;
|
|
213
208
|
}>;
|
|
214
209
|
type AnyStyle<Ansi extends boolean = false> = Style<Ansi> | Color<Ansi>;
|
|
215
|
-
//#endregion
|
|
216
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 };
|
|
217
|
-
//# sourceMappingURL=types-
|
|
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,OAA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Meta {
|
|
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 { h as Node } from "./queries-
|
|
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-DV_oxKEv.mjs";
|
|
4
|
+
import { t as Input } from "../input-CtGmVrKa.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 Box, H as Padding, U as box, V as BoxStyle } from "../queries-
|
|
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-DbIjxh39.mjs";
|
package/dist/widgets/code.d.mts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { i as AnyStyle } from "../types-
|
|
2
|
-
import { B as Box, Q as State, it as Reactive } from "../queries-
|
|
3
|
-
import { t as WrapMode } from "../text-
|
|
4
|
-
//#region src/widgets/code.d.ts
|
|
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";
|
|
5
4
|
export interface CodeState {
|
|
6
5
|
/** Source to render. Plain string or reactive accessor — pass a
|
|
7
6
|
* signal for streaming bash output / tool results. */
|
|
@@ -45,5 +44,4 @@ export interface CodeState {
|
|
|
45
44
|
* resolved highlight rather than the initial plain source.
|
|
46
45
|
*/
|
|
47
46
|
export declare const code: (props: State<CodeState>) => Box<{}>;
|
|
48
|
-
//#endregion
|
|
49
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,14 +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 shikiTheme } from "../theme-
|
|
8
|
-
import { t as widget } from "../widget-
|
|
9
|
-
import { t as show } from "../show-
|
|
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-DbIjxh39.mjs";
|
|
3
|
+
import { a as formatLines } from "../text-BEuhhxr7.mjs";
|
|
4
|
+
import { n as text } from "../text-H_2kzwaz.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";
|
|
10
10
|
import { extname } from "pathe";
|
|
11
|
-
|
|
11
|
+
// src/widgets/code.ts
|
|
12
12
|
/**
|
|
13
13
|
* Standalone code block: shiki-highlighted body inside a `code`-styled
|
|
14
14
|
* shrink-to-content backdrop, optionally titled.
|
|
@@ -54,7 +54,6 @@ const code = widget((props) => {
|
|
|
54
54
|
width: "fit"
|
|
55
55
|
}, show({ when: title }, () => text((ctx) => ctx.style.codeTitle(title() ?? ""), { wrap: "none" })), text(formatted, { wrap: props.wrap ?? "none" }));
|
|
56
56
|
});
|
|
57
|
-
//#endregion
|
|
58
57
|
export { code };
|
|
59
58
|
|
|
60
59
|
//# sourceMappingURL=code.mjs.map
|
|
@@ -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";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as ActionsSourceOptions, r as actionsSource, t as ActionCompletionItem } from "../../actions
|
|
2
|
-
import { n as filesSource, t as FilesSourceOptions } from "../../files-
|
|
3
|
-
import { a as githubSource, i as GithubState, n as GithubItem, r as GithubSourceOptions, t as GithubFetcher } from "../../github-
|
|
1
|
+
import { n as ActionsSourceOptions, r as actionsSource, t as ActionCompletionItem } from "../../actions-B0yyZ-Ww.mjs";
|
|
2
|
+
import { n as filesSource, t as FilesSourceOptions } from "../../files-CdiDnwA_.mjs";
|
|
3
|
+
import { a as githubSource, i as GithubState, n as GithubItem, r as GithubSourceOptions, t as GithubFetcher } from "../../github-DC0XemKa.mjs";
|
|
4
4
|
export { ActionCompletionItem, ActionsSourceOptions, FilesSourceOptions, GithubFetcher, GithubItem, GithubSourceOptions, GithubState, actionsSource, filesSource, githubSource };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as actionsSource } from "../../actions-
|
|
2
|
-
import { t as filesSource } from "../../files-
|
|
3
|
-
import { t as githubSource } from "../../github-
|
|
1
|
+
import { t as actionsSource } from "../../actions-AY6avfEV.mjs";
|
|
2
|
+
import { t as filesSource } from "../../files-C3ZnFpvq.mjs";
|
|
3
|
+
import { t as githubSource } from "../../github-CLveT9mq.mjs";
|
|
4
4
|
export { actionsSource, filesSource, githubSource };
|
package/dist/widgets/diff.d.mts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { I as RenderCtx, Q as State, X as Layout, h as Node, it as Reactive } from "../queries-
|
|
2
|
-
import { t as WrapMode } from "../text-
|
|
3
|
-
//#region src/widgets/diff.d.ts
|
|
1
|
+
import { I as RenderCtx, Q as State, X as Layout, h as Node, it as Reactive } from "../queries-Dmd3IjSd.mjs";
|
|
2
|
+
import { t as WrapMode } from "../text-DdkJXgoC.mjs";
|
|
4
3
|
export interface DiffState {
|
|
5
4
|
/** Pre-state file content. Plain string or reactive accessor —
|
|
6
5
|
* pass a signal to live-update the diff as either side changes. */
|
|
@@ -52,5 +51,4 @@ export declare class Diff extends Node<DiffState> {
|
|
|
52
51
|
* ```
|
|
53
52
|
*/
|
|
54
53
|
export declare function diff(state: State<DiffState>): Diff;
|
|
55
|
-
//#endregion
|
|
56
54
|
//# sourceMappingURL=diff.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diff.d.mts","names":[],"sources":["../../src/widgets/diff.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"diff.d.mts","names":[],"sources":["../../src/widgets/diff.ts"],"mappings":";;iBAgBiB;;;EAGf,UAAU;;;EAGV,UAAU;;;;EAIV,OAAO;;;EAGP;;EAEA;EACA,OAAO;;;;;;;;;;;;;qBA2BI,aAAa,KAAK;;EAI7B,YAAY,OAAO;MA+Bf;IAAW;IAAkB;;YAOjB,QAAQ,KAAK,YAAY;EAuBhC,UAAU;;;;;;;;;;;;;wBA+BL,KAAK,OAAO,MAAM,aAAa"}
|
package/dist/widgets/diff.mjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { S as unwrap, h as memo, r as createAsync, w as useContext } from "../reactive-
|
|
2
|
-
import { t as Node } from "../node-
|
|
3
|
-
import { t as calcLayout } from "../text-
|
|
4
|
-
import { t as RenderContext } from "../render-
|
|
5
|
-
import { t as codeToAnsi } from "../shiki-
|
|
6
|
-
import { t as shikiTheme } from "../theme-
|
|
1
|
+
import { S as unwrap, h as memo, r as createAsync, w as useContext } from "../reactive-DkP75TPk.mjs";
|
|
2
|
+
import { t as Node } from "../node-CXNobGaP.mjs";
|
|
3
|
+
import { i as expandTabs, t as calcLayout } from "../text-BEuhhxr7.mjs";
|
|
4
|
+
import { t as RenderContext } from "../render-Bp2N2i6J.mjs";
|
|
5
|
+
import { t as codeToAnsi } from "../shiki-BAf9PdIc.mjs";
|
|
6
|
+
import { t as shikiTheme } from "../theme-B8hb1lPU.mjs";
|
|
7
7
|
import { splitAnsi, stringWidth, wrapAnsi } from "@zaly/shared/ansi";
|
|
8
8
|
import { basename, extname } from "pathe";
|
|
9
|
-
|
|
9
|
+
// src/widgets/diff.ts
|
|
10
10
|
const NO_NEWLINE = String.raw``;
|
|
11
11
|
/**
|
|
12
12
|
* Show a unified diff between two file contents with syntax-highlighted
|
|
@@ -67,9 +67,9 @@ var Diff = class extends Node {
|
|
|
67
67
|
width
|
|
68
68
|
},
|
|
69
69
|
modified,
|
|
70
|
-
modifiedHi: splitAnsi(highlighted.modified).slice(0, modified.length),
|
|
70
|
+
modifiedHi: splitAnsi(expandTabs(highlighted.modified)).slice(0, modified.length),
|
|
71
71
|
original,
|
|
72
|
-
originalHi: splitAnsi(highlighted.original).slice(0, original.length)
|
|
72
|
+
originalHi: splitAnsi(expandTabs(highlighted.original)).slice(0, original.length)
|
|
73
73
|
};
|
|
74
74
|
this.state.wrap ??= "word";
|
|
75
75
|
return await buildDiffRows(opts);
|
|
@@ -216,7 +216,6 @@ function langFromPath(path) {
|
|
|
216
216
|
if (ext) return ext;
|
|
217
217
|
return basename(path).toLowerCase() || void 0;
|
|
218
218
|
}
|
|
219
|
-
//#endregion
|
|
220
219
|
export { Diff, diff };
|
|
221
220
|
|
|
222
221
|
//# sourceMappingURL=diff.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diff.mjs","names":[],"sources":["../../src/widgets/diff.ts"],"sourcesContent":["import type { RenderCtx } from \"../core/ctx.ts\"\nimport type { Accessor, Reactive } from \"../core/reactive.ts\"\nimport type { Layout, State } from \"../core/state.ts\"\nimport type { WrapMode } from \"../layout/text.ts\"\n\nimport { splitAnsi, stringWidth, wrapAnsi } from \"@zaly/shared/ansi\"\nimport { basename, extname } from \"pathe\"\n// oxlint-disable no-nested-ternary\n// oxlint-disable typescript/no-unnecessary-condition\nimport { Node } from \"../core/node.ts\"\nimport { createAsync, memo, unwrap, useContext } from \"../core/reactive.ts\"\nimport { RenderContext } from \"../core/render.ts\"\nimport { calcLayout } from \"../layout/text.ts\"\nimport { codeToAnsi } from \"../shiki/shiki.ts\"\nimport { shikiTheme } from \"../shiki/theme.ts\"\n\nexport interface DiffState {\n /** Pre-state file content. Plain string or reactive accessor —\n * pass a signal to live-update the diff as either side changes. */\n original: Reactive<string>\n /** Post-state file content. The widget runs `diffLines` between\n * `original` and `modified` and renders the resulting hunks. */\n modified: Reactive<string>\n /** Optional file path. Drives the default `lang` (extension or\n * basename — shiki recognises both `.ts` and `Dockerfile`-style\n * names) and `title` when those aren't set explicitly. */\n path?: Reactive<string>\n /** Language for syntax highlighting (any shiki-bundled name or\n * alias). Defaults from `path` when set. */\n lang?: string\n /** Lines of surrounding context per hunk. Default: 3. */\n context?: number\n wrap?: WrapMode\n}\n\nconst NO_NEWLINE = String.raw`\`\n\ntype DiffLine = { text: string; terminated: boolean }\n\ntype DiffOpts = {\n original: DiffLine[]\n originalHi: string[]\n modified: DiffLine[]\n modifiedHi: string[]\n context: number\n ctx: RenderCtx\n}\n\n/**\n * Show a unified diff between two file contents with syntax-highlighted\n * rows. Added rows carry a green backdrop and `+` prefix; removed rows\n * carry a red backdrop and `-` prefix; context rows show both line\n * numbers with a neutral gutter.\n *\n * Both sides are highlighted as complete files (via shiki) before the\n * diff is assembled, so context around an edit tokenizes the way it\n * would in the actual file — multi-line strings, block comments, etc.\n * don't get truncated by the hunk window.\n */\nexport class Diff extends Node<DiffState> {\n #lang: Accessor<string | undefined>\n #highlighted: Accessor<{ original: string; modified: string }>\n\n constructor(state: DiffState) {\n super({ wrap: \"word\", ...state })\n\n this.#lang = memo(() => {\n const path = unwrap(this.state.path)\n return this.state.lang ?? (path !== undefined ? langFromPath(path) : undefined)\n })\n\n const context = useContext(RenderContext)\n this.#highlighted = createAsync(\n async () => {\n const lang = this.#lang()\n const input = this.input\n if (!lang) return input\n const theme = context ? shikiTheme(context.style().theme) : undefined\n const [original, modified] = await Promise.all([\n codeToAnsi(input.original, lang, { theme }),\n codeToAnsi(input.modified, lang, { theme }),\n ])\n return { modified, original }\n },\n {\n initialValue: this.input,\n }\n )\n }\n\n #norm(s: string): string {\n return s.replaceAll(\"\\r\\n\", \"\\n\").replaceAll(\"\\r\", \"\")\n }\n\n get input(): { original: string; modified: string } {\n return {\n modified: this.#norm(unwrap(this.state.modified)),\n original: this.#norm(unwrap(this.state.original)),\n }\n }\n\n protected async _render(ctx: RenderCtx): Promise<string[]> {\n const highlighted = this.#highlighted()\n const input = this.input\n const layout = this.layout()\n const width = Math.min(ctx.width, layout.width)\n\n const original = splitLines(input.original)\n const modified = splitLines(input.modified)\n const opts: DiffOpts = {\n context: this.state.context ?? 3,\n ctx: { ...ctx, width },\n modified,\n modifiedHi: splitAnsi(highlighted.modified).slice(0, modified.length),\n original,\n originalHi: splitAnsi(highlighted.original).slice(0, original.length),\n }\n\n this.state.wrap ??= \"word\"\n return await buildDiffRows(opts)\n }\n\n override layout(): Layout {\n const input = this.input\n const original = calcLayout(input.original, { wrap: this.state.wrap })\n const modified = calcLayout(input.modified, { wrap: this.state.wrap })\n const numWidth = Math.max(\n 1,\n splitLines(input.original).length,\n splitLines(input.modified).length\n ).toString().length\n const markerWidth = [input.original, input.modified].some((s) => s !== \"\" && !s.endsWith(\"\\n\"))\n ? stringWidth(NO_NEWLINE)\n : 0\n const padding = numWidth * 2 + 4 + 4\n return {\n minWidth: Math.max(original.minWidth, modified.minWidth) + padding,\n width: Math.max(original.width, modified.width, markerWidth) + padding,\n }\n }\n}\n\n/**\n * Factory for `Diff`.\n *\n * ```ts\n * diff({\n * original: \"function foo() {}\\n\",\n * modified: \"function foo(x) {}\\n\",\n * path: \"foo.ts\",\n * })\n * ```\n */\nexport function diff(state: State<DiffState>): Diff {\n return new Diff(state)\n}\n\n// ---------- internals ----------\n\nfunction splitLines(text: string): DiffLine[] {\n if (text === \"\") return []\n const terminated = text.endsWith(\"\\n\")\n const lines = text.split(\"\\n\")\n if (terminated) lines.pop()\n return lines.map((line, i) => ({ terminated: i < lines.length - 1 || terminated, text: line }))\n}\n\ntype DiffRow = { terminated: boolean } & (\n | { type: \"context\"; origNum: number; newNum: number; content: string }\n | { type: \"remove\"; origNum: number; content: string }\n | { type: \"add\"; newNum: number; content: string }\n)\n\nasync function buildDiffRows(opts: DiffOpts): Promise<string[]> {\n const context = opts.context\n // Async-import keeps cold start snappy — only the diff widget pulls\n // in the library, and it lands at first render rather than at module\n // load.\n const { diffArrays } = await import(\"diff\")\n const segments = diffArrays(opts.original, opts.modified, {\n comparator: (a, b) => a.text === b.text && a.terminated === b.terminated,\n })\n const {\n original: origLines,\n modified: modLines,\n originalHi: origHi,\n modifiedHi: modHi,\n ctx,\n } = opts\n\n // Annotate each line in the diff with its kind + (orig, mod) indices.\n // The flattened list is the row-order the diff would print without\n // any hunking; we compute hunks (with surrounding context) on top.\n interface Annotated {\n kind: \"equal\" | \"remove\" | \"add\"\n origIdx?: number\n modIdx?: number\n }\n const ann: Annotated[] = []\n let oI = 0\n let mI = 0\n for (const seg of segments) {\n if (seg.added) {\n for (const _ of seg.value) ann.push({ kind: \"add\", modIdx: mI++ })\n } else if (seg.removed) {\n for (const _ of seg.value) ann.push({ kind: \"remove\", origIdx: oI++ })\n } else {\n for (const _ of seg.value) ann.push({ kind: \"equal\", modIdx: mI++, origIdx: oI++ })\n }\n }\n\n // Find hunks: ranges around each non-equal line, expanded by `context`,\n // merged when adjacent ranges touch.\n const ranges: { start: number; end: number }[] = []\n for (let i = 0; i < ann.length; i++) {\n if (ann[i].kind === \"equal\") continue\n const start = Math.max(0, i - context)\n const end = Math.min(ann.length - 1, i + context)\n const last = ranges.at(-1)\n if (last && start <= last.end + 1) last.end = Math.max(last.end, end)\n else ranges.push({ end, start })\n }\n if (ranges.length === 0) return [] // nothing changed\n\n // Emit rows for each hunk. (Between hunks we just skip the equal\n // lines — a `…` divider is a future polish.)\n const rows: DiffRow[] = []\n for (const r of ranges) {\n for (let i = r.start; i <= r.end; i++) {\n const a = ann[i]\n if (a.kind === \"equal\") {\n rows.push({\n content: modHi[a.modIdx!] ?? origHi[a.origIdx!] ?? \"\",\n newNum: a.modIdx! + 1,\n origNum: a.origIdx! + 1,\n terminated: modLines[a.modIdx!].terminated,\n type: \"context\",\n })\n } else if (a.kind === \"remove\") {\n rows.push({\n content: origHi[a.origIdx!] ?? \"\",\n origNum: a.origIdx! + 1,\n terminated: origLines[a.origIdx!].terminated,\n type: \"remove\",\n })\n } else {\n rows.push({\n content: modHi[a.modIdx!] ?? \"\",\n newNum: a.modIdx! + 1,\n terminated: modLines[a.modIdx!].terminated,\n type: \"add\",\n })\n }\n }\n }\n\n return renderRows(ctx, rows, origLines.length, modLines.length)\n}\n\nfunction renderRows(\n ctx: RenderCtx,\n rows: DiffRow[],\n origTotal: number,\n modTotal: number\n): string[] {\n const numWidth = Math.max(String(origTotal).length, String(modTotal).length, 1)\n const s = ctx.style\n\n // Two-column gutter: original line number | new line number | space.\n // - Context rows show both numbers.\n // - Remove rows show only the original number; new column blank.\n // - Add rows show only the new number; original column blank.\n // Wrapped continuation lines reuse the row style but emit a blank\n // gutter so the line number isn't repeated per visual row.\n const gutterWidth = numWidth * 2 + 4 // \"<orig> <new> \"\n const contentWidth = Math.max(0, ctx.width - gutterWidth)\n const blankGutter = \" \".repeat(gutterWidth - 2) + s.dim(\"↪ \")\n\n const styles = {\n add: \"diffAdd\",\n context: \"diffContext\",\n remove: \"diffDel\",\n } as const\n\n const out: string[] = []\n for (const r of rows) {\n const origStr = r.type === \"add\" ? \"\" : String(r.origNum)\n const newStr = r.type === \"remove\" ? \"\" : String(r.newNum)\n\n const gutterStyle = s[`${styles[r.type]}Num`] ?? ((x: string) => x)\n const gutter = gutterStyle(` ${pad(origStr, numWidth)} ${pad(newStr, numWidth)} `)\n\n const prefix = r.type === \"add\" ? \" + \" : r.type === \"remove\" ? \" - \" : \" \"\n const innerWidth = Math.max(0, contentWidth - stringWidth(prefix) - 1)\n\n // Hard-wrap the content. Char-wrap (vs. word-wrap) keeps code\n // diffs honest — splitting by word boundaries would shift columns\n // mid-line and make alignment confusing.\n const wrapped =\n innerWidth > 0 && stringWidth(r.content) > innerWidth\n ? splitAnsi(wrapAnsi(r.content, innerWidth, { mode: \"word\" }))\n : [r.content]\n\n const rowStyle = s.bg(styles[r.type])\n for (let i = 0; i < wrapped.length; i++) {\n const wline = wrapped[i]\n const pw = Math.max(0, innerWidth - stringWidth(wline) + 1)\n const bodyLine = (i === 0 ? prefix : \" \") + wline + \" \".repeat(pw)\n const styledBody = rowStyle?.(bodyLine) ?? bodyLine\n out.push((i === 0 ? gutter : gutterStyle(blankGutter)) + styledBody)\n }\n if (!r.terminated) {\n const marker = wrapAnsi(NO_NEWLINE, Math.max(1, contentWidth), { mode: \"word\" })\n for (const line of splitAnsi(marker)) out.push(\" \".repeat(gutterWidth) + s.dim(line))\n }\n }\n return out\n}\n\nfunction pad(s: string, width: number): string {\n return s.length >= width ? s : \" \".repeat(width - s.length) + s\n}\n\n/** Resolve a file path to a shiki language identifier. Falls back from\n * extension to basename — shiki natively recognises `dockerfile`,\n * `makefile`, `cmakelists.txt`, etc. */\nfunction langFromPath(path: string): string | undefined {\n const ext = extname(path).slice(1).toLowerCase()\n if (ext) return ext\n const base = basename(path).toLowerCase()\n return base || undefined\n}\n"],"mappings":";;;;;;;;;AAmCA,MAAM,aAAa,OAAO,GAAG;;;;;;;;;;;;AAwB7B,IAAa,OAAb,cAA0B,KAAgB;CACxC;CACA;CAEA,YAAY,OAAkB;EAC5B,MAAM;GAAE,MAAM;GAAQ,GAAG;EAAM,CAAC;EAEhC,KAAK,QAAQ,WAAW;GACtB,MAAM,OAAO,OAAO,KAAK,MAAM,IAAI;GACnC,OAAO,KAAK,MAAM,SAAS,SAAS,KAAA,IAAY,aAAa,IAAI,IAAI,KAAA;EACvE,CAAC;EAED,MAAM,UAAU,WAAW,aAAa;EACxC,KAAK,eAAe,YAClB,YAAY;GACV,MAAM,OAAO,KAAK,MAAM;GACxB,MAAM,QAAQ,KAAK;GACnB,IAAI,CAAC,MAAM,OAAO;GAClB,MAAM,QAAQ,UAAU,WAAW,QAAQ,MAAM,CAAC,CAAC,KAAK,IAAI,KAAA;GAC5D,MAAM,CAAC,UAAU,YAAY,MAAM,QAAQ,IAAI,CAC7C,WAAW,MAAM,UAAU,MAAM,EAAE,MAAM,CAAC,GAC1C,WAAW,MAAM,UAAU,MAAM,EAAE,MAAM,CAAC,CAC5C,CAAC;GACD,OAAO;IAAE;IAAU;GAAS;EAC9B,GACA,EACE,cAAc,KAAK,MACrB,CACF;CACF;CAEA,MAAM,GAAmB;EACvB,OAAO,EAAE,WAAW,QAAQ,IAAI,CAAC,CAAC,WAAW,MAAM,EAAE;CACvD;CAEA,IAAI,QAAgD;EAClD,OAAO;GACL,UAAU,KAAK,MAAM,OAAO,KAAK,MAAM,QAAQ,CAAC;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AAI,OAAO,WAAW,IAAI,EAAE,IAAI,IAAI,CAAC;EACtF;CACF;CACA,OAAO;AACT;AAEA,SAAS,IAAI,GAAW,OAAuB;CAC7C,OAAO,EAAE,UAAU,QAAQ,IAAI,IAAI,OAAO,QAAQ,EAAE,MAAM,IAAI;AAChE;;;;AAKA,SAAS,aAAa,MAAkC;CACtD,MAAM,MAAM,QAAQ,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,YAAY;CAC/C,IAAI,KAAK,OAAO;CAEhB,OADa,SAAS,IAAI,CAAC,CAAC,YAClB,KAAK,KAAA;AACjB"}
|
|
1
|
+
{"version":3,"file":"diff.mjs","names":[],"sources":["../../src/widgets/diff.ts"],"sourcesContent":["import type { RenderCtx } from \"../core/ctx.ts\"\nimport type { Accessor, Reactive } from \"../core/reactive.ts\"\nimport type { Layout, State } from \"../core/state.ts\"\nimport type { WrapMode } from \"../layout/text.ts\"\n\nimport { splitAnsi, stringWidth, wrapAnsi } from \"@zaly/shared/ansi\"\nimport { basename, extname } from \"pathe\"\n// oxlint-disable no-nested-ternary\n// oxlint-disable typescript/no-unnecessary-condition\nimport { Node } from \"../core/node.ts\"\nimport { createAsync, memo, unwrap, useContext } from \"../core/reactive.ts\"\nimport { RenderContext } from \"../core/render.ts\"\nimport { calcLayout, expandTabs } from \"../layout/text.ts\"\nimport { codeToAnsi } from \"../shiki/shiki.ts\"\nimport { shikiTheme } from \"../shiki/theme.ts\"\n\nexport interface DiffState {\n /** Pre-state file content. Plain string or reactive accessor —\n * pass a signal to live-update the diff as either side changes. */\n original: Reactive<string>\n /** Post-state file content. The widget runs `diffLines` between\n * `original` and `modified` and renders the resulting hunks. */\n modified: Reactive<string>\n /** Optional file path. Drives the default `lang` (extension or\n * basename — shiki recognises both `.ts` and `Dockerfile`-style\n * names) and `title` when those aren't set explicitly. */\n path?: Reactive<string>\n /** Language for syntax highlighting (any shiki-bundled name or\n * alias). Defaults from `path` when set. */\n lang?: string\n /** Lines of surrounding context per hunk. Default: 3. */\n context?: number\n wrap?: WrapMode\n}\n\nconst NO_NEWLINE = String.raw`\`\n\ntype DiffLine = { text: string; terminated: boolean }\n\ntype DiffOpts = {\n original: DiffLine[]\n originalHi: string[]\n modified: DiffLine[]\n modifiedHi: string[]\n context: number\n ctx: RenderCtx\n}\n\n/**\n * Show a unified diff between two file contents with syntax-highlighted\n * rows. Added rows carry a green backdrop and `+` prefix; removed rows\n * carry a red backdrop and `-` prefix; context rows show both line\n * numbers with a neutral gutter.\n *\n * Both sides are highlighted as complete files (via shiki) before the\n * diff is assembled, so context around an edit tokenizes the way it\n * would in the actual file — multi-line strings, block comments, etc.\n * don't get truncated by the hunk window.\n */\nexport class Diff extends Node<DiffState> {\n #lang: Accessor<string | undefined>\n #highlighted: Accessor<{ original: string; modified: string }>\n\n constructor(state: DiffState) {\n super({ wrap: \"word\", ...state })\n\n this.#lang = memo(() => {\n const path = unwrap(this.state.path)\n return this.state.lang ?? (path !== undefined ? langFromPath(path) : undefined)\n })\n\n const context = useContext(RenderContext)\n this.#highlighted = createAsync(\n async () => {\n const lang = this.#lang()\n const input = this.input\n if (!lang) return input\n const theme = context ? shikiTheme(context.style().theme) : undefined\n const [original, modified] = await Promise.all([\n codeToAnsi(input.original, lang, { theme }),\n codeToAnsi(input.modified, lang, { theme }),\n ])\n return { modified, original }\n },\n {\n initialValue: this.input,\n }\n )\n }\n\n #norm(s: string): string {\n return s.replaceAll(\"\\r\\n\", \"\\n\").replaceAll(\"\\r\", \"\")\n }\n\n get input(): { original: string; modified: string } {\n return {\n modified: this.#norm(unwrap(this.state.modified)),\n original: this.#norm(unwrap(this.state.original)),\n }\n }\n\n protected async _render(ctx: RenderCtx): Promise<string[]> {\n const highlighted = this.#highlighted()\n const input = this.input\n const layout = this.layout()\n const width = Math.min(ctx.width, layout.width)\n\n const original = splitLines(input.original)\n const modified = splitLines(input.modified)\n const opts: DiffOpts = {\n context: this.state.context ?? 3,\n ctx: { ...ctx, width },\n modified,\n // Expand display tabs before any cell-based splitting, wrapping, or padding.\n // Keep the original lines unchanged so whitespace-only edits remain visible.\n modifiedHi: splitAnsi(expandTabs(highlighted.modified)).slice(0, modified.length),\n original,\n originalHi: splitAnsi(expandTabs(highlighted.original)).slice(0, original.length),\n }\n\n this.state.wrap ??= \"word\"\n return await buildDiffRows(opts)\n }\n\n override layout(): Layout {\n const input = this.input\n const original = calcLayout(input.original, { wrap: this.state.wrap })\n const modified = calcLayout(input.modified, { wrap: this.state.wrap })\n const numWidth = Math.max(\n 1,\n splitLines(input.original).length,\n splitLines(input.modified).length\n ).toString().length\n const markerWidth = [input.original, input.modified].some((s) => s !== \"\" && !s.endsWith(\"\\n\"))\n ? stringWidth(NO_NEWLINE)\n : 0\n const padding = numWidth * 2 + 4 + 4\n return {\n minWidth: Math.max(original.minWidth, modified.minWidth) + padding,\n width: Math.max(original.width, modified.width, markerWidth) + padding,\n }\n }\n}\n\n/**\n * Factory for `Diff`.\n *\n * ```ts\n * diff({\n * original: \"function foo() {}\\n\",\n * modified: \"function foo(x) {}\\n\",\n * path: \"foo.ts\",\n * })\n * ```\n */\nexport function diff(state: State<DiffState>): Diff {\n return new Diff(state)\n}\n\n// ---------- internals ----------\n\nfunction splitLines(text: string): DiffLine[] {\n if (text === \"\") return []\n const terminated = text.endsWith(\"\\n\")\n const lines = text.split(\"\\n\")\n if (terminated) lines.pop()\n return lines.map((line, i) => ({ terminated: i < lines.length - 1 || terminated, text: line }))\n}\n\ntype DiffRow = { terminated: boolean } & (\n | { type: \"context\"; origNum: number; newNum: number; content: string }\n | { type: \"remove\"; origNum: number; content: string }\n | { type: \"add\"; newNum: number; content: string }\n)\n\nasync function buildDiffRows(opts: DiffOpts): Promise<string[]> {\n const context = opts.context\n // Async-import keeps cold start snappy — only the diff widget pulls\n // in the library, and it lands at first render rather than at module\n // load.\n const { diffArrays } = await import(\"diff\")\n const segments = diffArrays(opts.original, opts.modified, {\n comparator: (a, b) => a.text === b.text && a.terminated === b.terminated,\n })\n const {\n original: origLines,\n modified: modLines,\n originalHi: origHi,\n modifiedHi: modHi,\n ctx,\n } = opts\n\n // Annotate each line in the diff with its kind + (orig, mod) indices.\n // The flattened list is the row-order the diff would print without\n // any hunking; we compute hunks (with surrounding context) on top.\n interface Annotated {\n kind: \"equal\" | \"remove\" | \"add\"\n origIdx?: number\n modIdx?: number\n }\n const ann: Annotated[] = []\n let oI = 0\n let mI = 0\n for (const seg of segments) {\n if (seg.added) {\n for (const _ of seg.value) ann.push({ kind: \"add\", modIdx: mI++ })\n } else if (seg.removed) {\n for (const _ of seg.value) ann.push({ kind: \"remove\", origIdx: oI++ })\n } else {\n for (const _ of seg.value) ann.push({ kind: \"equal\", modIdx: mI++, origIdx: oI++ })\n }\n }\n\n // Find hunks: ranges around each non-equal line, expanded by `context`,\n // merged when adjacent ranges touch.\n const ranges: { start: number; end: number }[] = []\n for (let i = 0; i < ann.length; i++) {\n if (ann[i].kind === \"equal\") continue\n const start = Math.max(0, i - context)\n const end = Math.min(ann.length - 1, i + context)\n const last = ranges.at(-1)\n if (last && start <= last.end + 1) last.end = Math.max(last.end, end)\n else ranges.push({ end, start })\n }\n if (ranges.length === 0) return [] // nothing changed\n\n // Emit rows for each hunk. (Between hunks we just skip the equal\n // lines — a `…` divider is a future polish.)\n const rows: DiffRow[] = []\n for (const r of ranges) {\n for (let i = r.start; i <= r.end; i++) {\n const a = ann[i]\n if (a.kind === \"equal\") {\n rows.push({\n content: modHi[a.modIdx!] ?? origHi[a.origIdx!] ?? \"\",\n newNum: a.modIdx! + 1,\n origNum: a.origIdx! + 1,\n terminated: modLines[a.modIdx!].terminated,\n type: \"context\",\n })\n } else if (a.kind === \"remove\") {\n rows.push({\n content: origHi[a.origIdx!] ?? \"\",\n origNum: a.origIdx! + 1,\n terminated: origLines[a.origIdx!].terminated,\n type: \"remove\",\n })\n } else {\n rows.push({\n content: modHi[a.modIdx!] ?? \"\",\n newNum: a.modIdx! + 1,\n terminated: modLines[a.modIdx!].terminated,\n type: \"add\",\n })\n }\n }\n }\n\n return renderRows(ctx, rows, origLines.length, modLines.length)\n}\n\nfunction renderRows(\n ctx: RenderCtx,\n rows: DiffRow[],\n origTotal: number,\n modTotal: number\n): string[] {\n const numWidth = Math.max(String(origTotal).length, String(modTotal).length, 1)\n const s = ctx.style\n\n // Two-column gutter: original line number | new line number | space.\n // - Context rows show both numbers.\n // - Remove rows show only the original number; new column blank.\n // - Add rows show only the new number; original column blank.\n // Wrapped continuation lines reuse the row style but emit a blank\n // gutter so the line number isn't repeated per visual row.\n const gutterWidth = numWidth * 2 + 4 // \"<orig> <new> \"\n const contentWidth = Math.max(0, ctx.width - gutterWidth)\n const blankGutter = \" \".repeat(gutterWidth - 2) + s.dim(\"↪ \")\n\n const styles = {\n add: \"diffAdd\",\n context: \"diffContext\",\n remove: \"diffDel\",\n } as const\n\n const out: string[] = []\n for (const r of rows) {\n const origStr = r.type === \"add\" ? \"\" : String(r.origNum)\n const newStr = r.type === \"remove\" ? \"\" : String(r.newNum)\n\n const gutterStyle = s[`${styles[r.type]}Num`] ?? ((x: string) => x)\n const gutter = gutterStyle(` ${pad(origStr, numWidth)} ${pad(newStr, numWidth)} `)\n\n const prefix = r.type === \"add\" ? \" + \" : r.type === \"remove\" ? \" - \" : \" \"\n const innerWidth = Math.max(0, contentWidth - stringWidth(prefix) - 1)\n\n // Hard-wrap the content. Char-wrap (vs. word-wrap) keeps code\n // diffs honest — splitting by word boundaries would shift columns\n // mid-line and make alignment confusing.\n const wrapped =\n innerWidth > 0 && stringWidth(r.content) > innerWidth\n ? splitAnsi(wrapAnsi(r.content, innerWidth, { mode: \"word\" }))\n : [r.content]\n\n const rowStyle = s.bg(styles[r.type])\n for (let i = 0; i < wrapped.length; i++) {\n const wline = wrapped[i]\n const pw = Math.max(0, innerWidth - stringWidth(wline) + 1)\n const bodyLine = (i === 0 ? prefix : \" \") + wline + \" \".repeat(pw)\n const styledBody = rowStyle?.(bodyLine) ?? bodyLine\n out.push((i === 0 ? gutter : gutterStyle(blankGutter)) + styledBody)\n }\n if (!r.terminated) {\n const marker = wrapAnsi(NO_NEWLINE, Math.max(1, contentWidth), { mode: \"word\" })\n for (const line of splitAnsi(marker)) out.push(\" \".repeat(gutterWidth) + s.dim(line))\n }\n }\n return out\n}\n\nfunction pad(s: string, width: number): string {\n return s.length >= width ? s : \" \".repeat(width - s.length) + s\n}\n\n/** Resolve a file path to a shiki language identifier. Falls back from\n * extension to basename — shiki natively recognises `dockerfile`,\n * `makefile`, `cmakelists.txt`, etc. */\nfunction langFromPath(path: string): string | undefined {\n const ext = extname(path).slice(1).toLowerCase()\n if (ext) return ext\n const base = basename(path).toLowerCase()\n return base || undefined\n}\n"],"mappings":";;;;;;;;;AAmCA,MAAM,aAAa,OAAO,GAAG;;;;;;;;;;;;AAwB7B,IAAa,OAAb,cAA0B,KAAgB;CACxC;CACA;CAEA,YAAY,OAAkB;EAC5B,MAAM;GAAE,MAAM;GAAQ,GAAG;EAAM,CAAC;EAEhC,KAAK,QAAQ,WAAW;GACtB,MAAM,OAAO,OAAO,KAAK,MAAM,IAAI;GACnC,OAAO,KAAK,MAAM,SAAS,SAAS,KAAA,IAAY,aAAa,IAAI,IAAI,KAAA;EACvE,CAAC;EAED,MAAM,UAAU,WAAW,aAAa;EACxC,KAAK,eAAe,YAClB,YAAY;GACV,MAAM,OAAO,KAAK,MAAM;GACxB,MAAM,QAAQ,KAAK;GACnB,IAAI,CAAC,MAAM,OAAO;GAClB,MAAM,QAAQ,UAAU,WAAW,QAAQ,MAAM,CAAC,CAAC,KAAK,IAAI,KAAA;GAC5D,MAAM,CAAC,UAAU,YAAY,MAAM,QAAQ,IAAI,CAC7C,WAAW,MAAM,UAAU,MAAM,EAAE,MAAM,CAAC,GAC1C,WAAW,MAAM,UAAU,MAAM,EAAE,MAAM,CAAC,CAC5C,CAAC;GACD,OAAO;IAAE;IAAU;GAAS;EAC9B,GACA,EACE,cAAc,KAAK,MACrB,CACF;CACF;CAEA,MAAM,GAAmB;EACvB,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;EACrE;EACA,IAAI,CAAC,EAAE,YAAY;GACjB,MAAM,SAAS,SAAS,YAAY,KAAK,IAAI,GAAG,YAAY,GAAG,EAAE,MAAM,OAAO,CAAC;GAC/E,KAAK,MAAM,QAAQ,UAAU,MAAM,GAAG,IAAI,KAAK,IAAI,OAAO,WAAW,IAAI,EAAE,IAAI,IAAI,CAAC;EACtF;CACF;CACA,OAAO;AACT;AAEA,SAAS,IAAI,GAAW,OAAuB;CAC7C,OAAO,EAAE,UAAU,QAAQ,IAAI,IAAI,OAAO,QAAQ,EAAE,MAAM,IAAI;AAChE;;;;AAKA,SAAS,aAAa,MAAkC;CACtD,MAAM,MAAM,QAAQ,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,YAAY;CAC/C,IAAI,KAAK,OAAO;CAEhB,OADa,SAAS,IAAI,CAAC,CAAC,YAClB,KAAK,KAAA;AACjB"}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import { u as Style } from "../types-
|
|
2
|
-
import { W as Text } from "../queries-
|
|
3
|
-
//#region src/widgets/divider.d.ts
|
|
1
|
+
import { u as Style } from "../types-ByMHEdCF.mjs";
|
|
2
|
+
import { W as Text } from "../queries-Dmd3IjSd.mjs";
|
|
4
3
|
export type DividerState = Style<false> & {
|
|
5
4
|
char?: string;
|
|
6
5
|
length?: number;
|
|
7
6
|
};
|
|
8
7
|
export declare function divider(state?: DividerState): Text;
|
|
9
|
-
//#endregion
|
|
10
8
|
//# sourceMappingURL=divider.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"divider.d.mts","names":[],"sources":["../../src/widgets/divider.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"divider.d.mts","names":[],"sources":["../../src/widgets/divider.ts"],"mappings":";;YAKY,eAAe;EACzB;EACA;;wBAGc,QAAQ,QAAO,eAAsC"}
|
package/dist/widgets/divider.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as divider } from "../divider-
|
|
1
|
+
export { t as divider } from "../divider-BPmnQ0Eu.mjs";
|
package/dist/widgets/image.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as ImageState, r as image, t as Image } from "../image-
|
|
1
|
+
import { n as ImageState, r as image, t as Image } from "../image-DdRDv7q6.mjs";
|
|
2
2
|
export { Image, ImageState, image };
|
package/dist/widgets/image.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { S as unwrap, w as useContext } from "../reactive-
|
|
2
|
-
import { t as Node } from "../node-
|
|
3
|
-
import { t as RenderContext } from "../render-
|
|
4
|
-
import { s as loadKittyGraphics } from "../kitty-
|
|
1
|
+
import { S as unwrap, w as useContext } from "../reactive-DkP75TPk.mjs";
|
|
2
|
+
import { t as Node } from "../node-CXNobGaP.mjs";
|
|
3
|
+
import { t as RenderContext } from "../render-Bp2N2i6J.mjs";
|
|
4
|
+
import { s as loadKittyGraphics } from "../kitty-BH_eK6lz.mjs";
|
|
5
5
|
import { fileDetect } from "@zaly/shared/detect";
|
|
6
6
|
import { imageInfo } from "@zaly/shared/image";
|
|
7
|
-
|
|
7
|
+
// src/widgets/image.ts
|
|
8
8
|
var Image = class extends Node {
|
|
9
9
|
#delete;
|
|
10
10
|
#enabled;
|
|
@@ -71,7 +71,6 @@ function dims(state, meta, available) {
|
|
|
71
71
|
rows: rows ?? 1
|
|
72
72
|
};
|
|
73
73
|
}
|
|
74
|
-
//#endregion
|
|
75
74
|
export { Image, image };
|
|
76
75
|
|
|
77
76
|
//# sourceMappingURL=image.mjs.map
|
package/dist/widgets/input.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as InputValue, i as InputState, n as InputAttachment, o as input, r as InputEvents, t as Input } from "../input-
|
|
1
|
+
import { a as InputValue, i as InputState, n as InputAttachment, o as input, r as InputEvents, t as Input } from "../input-C3kfYoEJ.mjs";
|
|
2
2
|
export { Input, InputAttachment, InputEvents, InputState, InputValue, input };
|
package/dist/widgets/input.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as Input, n as input } from "../input-
|
|
1
|
+
export { t as Input, n as input } from "../input-CtGmVrKa.mjs";
|
package/dist/widgets/log.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { M as LogState, N as LogStyle, P as log } from "../queries-
|
|
1
|
+
import { M as LogState, N as LogStyle, P as log } from "../queries-Dmd3IjSd.mjs";
|
|
2
2
|
export { LogState, LogStyle, log };
|
package/dist/widgets/log.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as log } from "../log-
|
|
1
|
+
export { t as log } from "../log-D6gGicwQ.mjs";
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { i as AnyStyle } from "../types-
|
|
2
|
-
import { G as TextContent, I as RenderCtx, Q as State, X as Layout, h as Node } from "../queries-
|
|
3
|
-
import { t as WrapMode } from "../text-
|
|
4
|
-
import { n as MdOptions } from "../types-
|
|
5
|
-
import { t as Image } from "../image-
|
|
6
|
-
//#region src/widgets/markdown.d.ts
|
|
1
|
+
import { i as AnyStyle } from "../types-ByMHEdCF.mjs";
|
|
2
|
+
import { G as TextContent, I as RenderCtx, Q as State, X as Layout, h as Node } from "../queries-Dmd3IjSd.mjs";
|
|
3
|
+
import { t as WrapMode } from "../text-DdkJXgoC.mjs";
|
|
4
|
+
import { n as MdOptions } from "../types-CUVUJPz6.mjs";
|
|
5
|
+
import { t as Image } from "../image-DdRDv7q6.mjs";
|
|
7
6
|
export interface MarkdownState {
|
|
8
7
|
/** Markdown source. Accepts a plain string or a reactive accessor —
|
|
9
8
|
* pass `signal()` / `memo()` for streaming content that re-parses on
|
|
@@ -40,5 +39,4 @@ export declare class Markdown extends Node<MarkdownState> {
|
|
|
40
39
|
*/
|
|
41
40
|
export declare function markdown(content: TextContent, style?: Omit<State<MarkdownState>, "content">): Markdown;
|
|
42
41
|
export declare function markdown(state: State<MarkdownState>): Markdown;
|
|
43
|
-
//#endregion
|
|
44
42
|
//# sourceMappingURL=markdown.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markdown.d.mts","names":["_$___core_state_ts0.Layout"],"sources":["../../src/widgets/markdown.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"markdown.d.mts","names":["_$___core_state_ts0.Layout"],"sources":["../../src/widgets/markdown.ts"],"mappings":";;;;;iBAqBiB;;;;EAIf,SAAS;;EAET,UAAU;;;;;;;EAOV;EACA,OAAO;EACP,QAAQ;;qBAcG,iBAAiB,KAAK;;WAKxB,QAAM,YAAA;EASf,YAAY,OAAO,MAAM;YAwDT,QAAQ,KAAK,YAAY;EA0C1B,OAAO,KAAK,YAAS,QAATA;;;;;;;;;;;;wBAeb,SACd,SAAS,aACT,QAAQ,KAAK,MAAM,6BAClB;wBACa,SAAS,OAAO,MAAM,iBAAiB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as Markdown, n as markdown } from "../markdown-
|
|
1
|
+
export { t as Markdown, n as markdown } from "../markdown-DvDIPT5L.mjs";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { L as Overlay, R as OverlayState, z as overlay } from "../queries-
|
|
1
|
+
import { L as Overlay, R as OverlayState, z as overlay } from "../queries-Dmd3IjSd.mjs";
|
|
2
2
|
export { Overlay, OverlayState, overlay };
|
package/dist/widgets/overlay.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as overlay } from "../overlay-
|
|
1
|
+
export { t as overlay } from "../overlay-zDNpwKu0.mjs";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as picker, i as PickerTreeProps, n as PickerItem, r as PickerSelectProps, t as PickerActions } from "../picker-
|
|
1
|
+
import { a as picker, i as PickerTreeProps, n as PickerItem, r as PickerSelectProps, t as PickerActions } from "../picker-DsB6--GN.mjs";
|
|
2
2
|
export { PickerActions, PickerItem, PickerSelectProps, PickerTreeProps, picker };
|
package/dist/widgets/picker.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as picker } from "../picker-
|
|
1
|
+
export { t as picker } from "../picker-DV_oxKEv.mjs";
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { o as Color } from "../types-
|
|
2
|
-
import { Ft as Size, I as RenderCtx, Q as State, h as Node, it as Reactive } from "../queries-
|
|
3
|
-
//#region src/widgets/progress.d.ts
|
|
1
|
+
import { o as Color } from "../types-ByMHEdCF.mjs";
|
|
2
|
+
import { Ft as Size, I as RenderCtx, Q as State, h as Node, it as Reactive } from "../queries-Dmd3IjSd.mjs";
|
|
4
3
|
export interface ProgressState {
|
|
5
4
|
/** Current value. Clamped to `[0, total]`. Accepts a signal accessor
|
|
6
5
|
* so callers can drive the bar from reactive state without manual
|
|
@@ -43,5 +42,4 @@ export declare class Progress extends Node<ProgressState> {
|
|
|
43
42
|
* ```
|
|
44
43
|
*/
|
|
45
44
|
export declare function progress(state: State<ProgressState>): Progress;
|
|
46
|
-
//#endregion
|
|
47
45
|
//# sourceMappingURL=progress.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"progress.d.mts","names":[],"sources":["../../src/widgets/progress.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"progress.d.mts","names":[],"sources":["../../src/widgets/progress.ts"],"mappings":";;iBAWiB;;;;EAIf,OAAO;;EAEP,QAAQ;;;;;EAKR,QAAQ;;;;;;EAMR,mBAAmB,KAAK,WAAW;;EAEnC,QAAQ;;EAER,aAAa;;EAEb;;EAEA;;qBAGW,iBAAiB,KAAK;YACvB,QAAQ,KAAK;;;;;;;;;;;;;wBAwCT,SAAS,OAAO,MAAM,iBAAiB"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { S as unwrap } from "../reactive-
|
|
2
|
-
import { t as Node } from "../node-
|
|
3
|
-
import { n as resolveSize } from "../size-
|
|
1
|
+
import { S as unwrap } from "../reactive-DkP75TPk.mjs";
|
|
2
|
+
import { t as Node } from "../node-CXNobGaP.mjs";
|
|
3
|
+
import { n as resolveSize } from "../size-BHRJuRk9.mjs";
|
|
4
4
|
import { stringWidth } from "@zaly/shared/ansi";
|
|
5
|
-
|
|
5
|
+
// src/widgets/progress.ts
|
|
6
6
|
var Progress = class extends Node {
|
|
7
7
|
_render(ctx) {
|
|
8
8
|
const total = unwrap(this.state.total ?? 1);
|
|
@@ -42,7 +42,6 @@ function resolveLabel(label, ctx, fraction) {
|
|
|
42
42
|
if (label === "auto") return `${Math.round(fraction * 100)}%`;
|
|
43
43
|
return label;
|
|
44
44
|
}
|
|
45
|
-
//#endregion
|
|
46
45
|
export { Progress, progress };
|
|
47
46
|
|
|
48
47
|
//# sourceMappingURL=progress.mjs.map
|