@zaly/tui 0.0.10 → 0.0.12
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/theme.schema.json +351 -36
- package/assets/themes/ayu-dark.json +2 -21
- package/assets/themes/catppuccin-frappe.json +2 -21
- package/assets/themes/catppuccin-latte.json +2 -21
- package/assets/themes/catppuccin-macchiato.json +2 -21
- package/assets/themes/catppuccin-mocha.json +2 -21
- package/assets/themes/dracula-soft.json +2 -21
- package/assets/themes/dracula.json +2 -21
- package/assets/themes/everforest-dark.json +2 -21
- package/assets/themes/everforest-light.json +2 -21
- package/assets/themes/github-dark.json +2 -21
- package/assets/themes/github-light.json +2 -21
- package/assets/themes/gruvbox-dark-medium.json +2 -21
- package/assets/themes/kanagawa-dragon.json +2 -21
- package/assets/themes/kanagawa-wave.json +2 -21
- package/assets/themes/material-theme-palenight.json +2 -21
- package/assets/themes/min-dark.json +2 -18
- package/assets/themes/min-light.json +2 -18
- package/assets/themes/monokai.json +2 -21
- package/assets/themes/night-owl.json +2 -21
- package/assets/themes/nord.json +2 -18
- package/assets/themes/one-dark-pro.json +2 -21
- package/assets/themes/one-light.json +2 -20
- package/assets/themes/poimandres.json +2 -21
- package/assets/themes/rose-pine.json +2 -18
- package/assets/themes/solarized-dark.json +2 -21
- package/assets/themes/solarized-light.json +2 -21
- package/assets/themes/synthwave-84.json +2 -21
- package/assets/themes/tokyonight-day.json +4 -5
- package/assets/themes/tokyonight-moon.json +3 -4
- package/assets/themes/tokyonight-night.json +3 -4
- package/assets/themes/tokyonight-storm.json +3 -4
- package/assets/themes/vesper.json +2 -17
- package/assets/themes/vitesse-dark.json +2 -21
- package/assets/themes/vitesse-light.json +2 -21
- package/dist/{actions-DFboj3g5.d.mts → actions-Dc4D4uSf.d.mts} +4 -4
- package/dist/{actions-DFboj3g5.d.mts.map → actions-Dc4D4uSf.d.mts.map} +1 -1
- package/dist/{ansi-Clq0ozyA.mjs → ansi-DZlXaItJ.mjs} +37 -2
- package/dist/ansi-DZlXaItJ.mjs.map +1 -0
- package/dist/ansi.d.mts +3 -1
- package/dist/ansi.d.mts.map +1 -1
- package/dist/ansi.mjs +1 -1
- package/dist/{autocomplete-CxzetPOo.d.mts → autocomplete-StW1QJZJ.d.mts} +4 -4
- package/dist/{autocomplete-CxzetPOo.d.mts.map → autocomplete-StW1QJZJ.d.mts.map} +1 -1
- package/dist/{box-DLEcEvDH.mjs → box-BkP4MF82.mjs} +2 -2
- package/dist/box-BkP4MF82.mjs.map +1 -0
- package/dist/{builder-DC9byAmK.mjs → builder-1z5ewEWK.mjs} +4 -4
- package/dist/builder-1z5ewEWK.mjs.map +1 -0
- package/dist/{callbacks-D132G8dy.mjs → callbacks-BwWTCqPJ.mjs} +3 -3
- package/dist/{callbacks-D132G8dy.mjs.map → callbacks-BwWTCqPJ.mjs.map} +1 -1
- package/dist/{ctx-8Nuf5BrN.mjs → ctx-B7BmPUCD.mjs} +3 -3
- package/dist/{ctx-8Nuf5BrN.mjs.map → ctx-B7BmPUCD.mjs.map} +1 -1
- package/dist/ctx-D_JgJ8Eo.mjs +1 -0
- package/dist/{divider-l0-JPEIm.mjs → divider-TSx9NhI_.mjs} +2 -2
- package/dist/divider-TSx9NhI_.mjs.map +1 -0
- package/dist/{files-BUsa-RVl.d.mts → files-7DUYSeNc.d.mts} +3 -3
- package/dist/{files-BUsa-RVl.d.mts.map → files-7DUYSeNc.d.mts.map} +1 -1
- package/dist/{github-D89A3F9U.d.mts → github-C1KfXk98.d.mts} +3 -3
- package/dist/{github-D89A3F9U.d.mts.map → github-C1KfXk98.d.mts.map} +1 -1
- package/dist/github-Cy2hfWJ7.mjs.map +1 -1
- package/dist/{image-34bU73bW.d.mts → image-VaT7AN-S.d.mts} +2 -2
- package/dist/{image-34bU73bW.d.mts.map → image-VaT7AN-S.d.mts.map} +1 -1
- package/dist/image.d.mts +1 -1
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +4 -4
- package/dist/{input-Dylds_sI.d.mts → input-BAYux7qo.d.mts} +3 -3
- package/dist/{input-Dylds_sI.d.mts.map → input-BAYux7qo.d.mts.map} +1 -1
- package/dist/{input-D7fQEUdt.mjs → input-BGTTujDN.mjs} +16 -11
- package/dist/input-BGTTujDN.mjs.map +1 -0
- package/dist/{inspect-DPLRum7L.d.mts → inspect-CfNydMgO.d.mts} +11 -15
- package/dist/inspect-CfNydMgO.d.mts.map +1 -0
- package/dist/{inspect-CcgiZ_F9.mjs → inspect-jG_W4njH.mjs} +2 -2
- package/dist/{inspect-CcgiZ_F9.mjs.map → inspect-jG_W4njH.mjs.map} +1 -1
- package/dist/{log-Dy_QnPZF.mjs → log-ByKlM4iI.mjs} +5 -5
- package/dist/log-ByKlM4iI.mjs.map +1 -0
- package/dist/{logger-DvuX9DPS.mjs → logger-DSQb0sLP.mjs} +3 -3
- package/dist/{logger-DvuX9DPS.mjs.map → logger-DSQb0sLP.mjs.map} +1 -1
- package/dist/{markdown-BGPa7UzD.mjs → markdown-CwRmWuU6.mjs} +5 -5
- package/dist/{markdown-BGPa7UzD.mjs.map → markdown-CwRmWuU6.mjs.map} +1 -1
- package/dist/markdown.d.mts +1 -1
- package/dist/markdown.mjs +1 -1
- package/dist/{overlay-9WXYiGgW.mjs → overlay-BnvOKtGT.mjs} +2 -2
- package/dist/{overlay-9WXYiGgW.mjs.map → overlay-BnvOKtGT.mjs.map} +1 -1
- package/dist/{picker-JL8lZfRH.d.mts → picker-DQs_IW77.d.mts} +5 -5
- package/dist/{picker-JL8lZfRH.d.mts.map → picker-DQs_IW77.d.mts.map} +1 -1
- package/dist/{picker-BqHINl_a.mjs → picker-Dh5IUrTk.mjs} +2 -2
- package/dist/{picker-BqHINl_a.mjs.map → picker-Dh5IUrTk.mjs.map} +1 -1
- package/dist/{queries-Cvalgu6P.d.mts → queries-BDX8mcl5.d.mts} +26 -10
- package/dist/queries-BDX8mcl5.d.mts.map +1 -0
- package/dist/{registry-3hLzS4ks.mjs → registry-D-suU3g0.mjs} +15 -20
- package/dist/registry-D-suU3g0.mjs.map +1 -0
- package/dist/{render-f7M2856V.mjs → render-DEIUNLkh.mjs} +2 -2
- package/dist/{render-f7M2856V.mjs.map → render-DEIUNLkh.mjs.map} +1 -1
- package/dist/renderer-DhqbEVVR.mjs +1 -0
- package/dist/{renderer-DesbRwjQ.mjs → renderer-MQue4Da5.mjs} +2 -2
- package/dist/{renderer-DesbRwjQ.mjs.map → renderer-MQue4Da5.mjs.map} +1 -1
- package/dist/{renderer-V6AGjbyf.mjs → renderer-zDNlAovy.mjs} +66 -15
- package/dist/renderer-zDNlAovy.mjs.map +1 -0
- package/dist/{select-zGd5pbiB.d.mts → select-J2KtwxyK.d.mts} +3 -3
- package/dist/{select-zGd5pbiB.d.mts.map → select-J2KtwxyK.d.mts.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 -1
- package/dist/services/notifier.mjs +2 -2
- package/dist/services/picker.d.mts +5 -5
- package/dist/services/picker.mjs +6 -6
- package/dist/services/prompt.d.mts +4 -4
- package/dist/services/prompt.mjs +5 -5
- package/dist/shiki/server.mjs +1 -1
- package/dist/style.d.mts +2 -2
- package/dist/style.mjs +3 -3
- package/dist/{text-BefiXAFW.d.mts → text-CCYs9RB2.d.mts} +3 -3
- package/dist/{text-BefiXAFW.d.mts.map → text-CCYs9RB2.d.mts.map} +1 -1
- package/dist/{text-CRZD9KTN.mjs → text-CkQ7Irmt.mjs} +2 -2
- package/dist/{text-CRZD9KTN.mjs.map → text-CkQ7Irmt.mjs.map} +1 -1
- package/dist/{text-BLz1tRoC.mjs → text-XvPfweeg.mjs} +2 -2
- package/dist/text-XvPfweeg.mjs.map +1 -0
- package/dist/text.d.mts +1 -1
- package/dist/text.mjs +1 -1
- package/dist/{theme.config-BKXX_noZ.mjs → theme.config-B3Yx--C2.mjs} +12 -20
- package/dist/theme.config-B3Yx--C2.mjs.map +1 -0
- package/dist/themes.d.mts +1 -1
- package/dist/themes.mjs +1 -1
- package/dist/{tree-CArtDRec.d.mts → tree-DJl5W_B7.d.mts} +3 -3
- package/dist/{tree-CArtDRec.d.mts.map → tree-DJl5W_B7.d.mts.map} +1 -1
- package/dist/{types-C0EOLZDc.d.mts → types-D2EYlzmK.d.mts} +10 -18
- package/dist/types-D2EYlzmK.d.mts.map +1 -0
- package/dist/{widget-DtJU2-BJ.d.mts → widget-DPqBbB57.d.mts} +2 -2
- package/dist/{widget-DtJU2-BJ.d.mts.map → widget-DPqBbB57.d.mts.map} +1 -1
- package/dist/widgets/autocomplete.d.mts +1 -1
- package/dist/widgets/autocomplete.mjs +2 -2
- package/dist/widgets/box.d.mts +1 -1
- package/dist/widgets/box.mjs +1 -1
- package/dist/widgets/code.d.mts +2 -2
- package/dist/widgets/code.mjs +4 -4
- package/dist/widgets/completions/actions.d.mts +1 -1
- package/dist/widgets/completions/files.d.mts +1 -1
- package/dist/widgets/completions/github.d.mts +1 -1
- package/dist/widgets/completions/index.d.mts +3 -3
- package/dist/widgets/diff.d.mts +2 -2
- package/dist/widgets/diff.mjs +2 -2
- package/dist/widgets/divider.d.mts +3 -3
- package/dist/widgets/divider.mjs +1 -1
- package/dist/widgets/image.d.mts +1 -1
- package/dist/widgets/image.mjs +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 +4 -4
- 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 +4 -4
- package/dist/widgets/progress.mjs.map +1 -1
- package/dist/widgets/select.d.mts +1 -1
- package/dist/widgets/show.d.mts +1 -1
- package/dist/widgets/spinner.d.mts +2 -2
- 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/widget.d.mts +1 -1
- package/package.json +2 -2
- package/dist/ansi-Clq0ozyA.mjs.map +0 -1
- package/dist/box-DLEcEvDH.mjs.map +0 -1
- package/dist/builder-DC9byAmK.mjs.map +0 -1
- package/dist/ctx-k0wTqeql.mjs +0 -1
- package/dist/divider-l0-JPEIm.mjs.map +0 -1
- package/dist/input-D7fQEUdt.mjs.map +0 -1
- package/dist/inspect-DPLRum7L.d.mts.map +0 -1
- package/dist/log-Dy_QnPZF.mjs.map +0 -1
- package/dist/queries-Cvalgu6P.d.mts.map +0 -1
- package/dist/registry-3hLzS4ks.mjs.map +0 -1
- package/dist/renderer-BSMOuiLM.mjs +0 -1
- package/dist/renderer-V6AGjbyf.mjs.map +0 -1
- package/dist/text-BLz1tRoC.mjs.map +0 -1
- package/dist/theme.config-BKXX_noZ.mjs.map +0 -1
- package/dist/types-C0EOLZDc.d.mts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"github-
|
|
1
|
+
{"version":3,"file":"github-C1KfXk98.d.mts","names":[],"sources":["../src/widgets/completions/github.ts"],"mappings":";;;;;;KAWY,aAAa;EACvB;EACA;;;EAGA;EACA;EACA;EACA;IAAW;;;KAGD;KAEA,iBAAiB,aAAa,OAAO,gBAAgB,QAAQ;UAExD;;;EAGf;;;EAGA,UAAU;;;EAGV;;EAEA,QAAQ;;EAER;;;;EAIA,UAAU;;;;;;;;;;;;;;;;;;;;;;;iBAwBI,aAAa,OAAM,sBAA2B,iBAAiB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"github-Cy2hfWJ7.mjs","names":[],"sources":["../src/widgets/completions/github.ts"],"sourcesContent":["import type { ScoredItem } from \"../../search/matcher.ts\"\nimport type { CompletionSource } from \"../autocomplete.ts\"\nimport type { PickerItem } from \"../picker.ts\"\nimport type { OptionRender } from \"../select.ts\"\n\nimport { stringWidth } from \"@zaly/shared/ansi\"\nimport { spawn } from \"node:child_process\"\n\n/** A GitHub issue or pull request returned by `githubSource`. Shape\n * mirrors the `gh` CLI's `--json number,title,state,author,url`\n * output, with `type` added to distinguish issues from PRs. */\nexport type GithubItem = PickerItem & {\n number: number\n title: string\n /** `\"open\"` / `\"closed\"` for issues; `\"open\"` / `\"closed\"` / `\"merged\"`\n * for PRs. Kept as a string so we don't trip if gh evolves. */\n state: string\n type: \"issue\" | \"pr\"\n url: string\n author?: { login?: string }\n}\n\nexport type GithubState = \"open\" | \"closed\" | \"all\"\n\nexport type GithubFetcher = (cwd: string, state: GithubState) => Promise<GithubItem[]>\n\nexport interface GithubSourceOptions {\n /** Working directory used to locate the repo. `gh` resolves the repo\n * from the git remote of this dir. Default: `process.cwd()`. */\n cwd?: string\n /** Trigger regex. Default: `/(?<=^|\\s)#/` — `#` preceded by start-of-\n * string or whitespace (same lookbehind trick as `filesSource`). */\n trigger?: RegExp\n /** Prepended to the accepted value so the trigger character stays in\n * the input. Default: `\"#\"`. */\n prefix?: string\n /** Which issues / PRs to include. Default: `\"open\"`. */\n state?: GithubState\n /** Per-kind cap passed to `gh`. Default: `50`. */\n limit?: number\n /** Override the fetch implementation. Mainly useful for tests — the\n * default shells out to `gh`. The fetcher is called at most once per\n * `githubSource` instance; results are cached thereafter. */\n fetcher?: GithubFetcher\n}\n\n/**\n * Completion source for GitHub issues and pull requests from the repo\n * at `cwd`. Shells out to the `gh` CLI on first use, caches the result,\n * and fuzzy-filters locally on subsequent calls so typing stays snappy.\n *\n * Accepts insert `#123 ` into the input — ready for a markdown-style\n * reference in a chat message or commit subject.\n *\n * ```ts\n * autocomplete({\n * input: \"chat-input\",\n * sources: {\n * gh: githubSource(),\n * },\n * })\n * ```\n *\n * Silently returns no items when `gh` isn't installed, the user isn't\n * authenticated, or the directory isn't a GitHub repo — so it's safe\n * to wire up unconditionally.\n */\nexport function githubSource(opts: GithubSourceOptions = {}): CompletionSource<GithubItem> {\n const cwd = opts.cwd ?? process.cwd()\n const trigger = opts.trigger ?? /(?<=^|\\s)#/\n const prefix = opts.prefix ?? \"#\"\n const state: GithubState = opts.state ?? \"open\"\n const limit = opts.limit ?? 50\n const fetcher = opts.fetcher ?? defaultFetcher(limit)\n\n // Lazy, single-fetch cache. The Promise is reused by concurrent\n // callers so rapid keystrokes while the first fetch is in flight\n // don't spawn duplicate `gh` processes.\n let cache: Promise<GithubItem[]> | undefined\n\n return {\n accept: (item) => `${prefix}${item.number} `,\n async complete(_query: string, match): Promise<ScoredItem<GithubItem>[]> {\n cache ??= fetcher(cwd, state).catch(() => [])\n const items = await cache\n const out: ScoredItem<GithubItem>[] = []\n for (const item of items) {\n // Match on \"#<num> <title>\" so users can type either digits or\n // words and both hit. Keeps ranking implicit — source order\n // (freshest first from gh) wins when scores tie.\n const target = `#${item.number} ${item.title}`\n const score = match(target)\n if (!score) continue\n out.push({ ...item, score })\n }\n return out\n },\n render: defaultRender,\n triggers: [trigger],\n }\n}\n\nconst defaultRender: OptionRender<GithubItem> = (item, ctx) => {\n const { style } = ctx\n const num = `#${item.number}`\n const stateSlot = stateStyleSlot(item.state)\n const typeLabel = item.type === \"pr\" ? \"pr\" : \"issue\"\n const author = item.author?.login ? `@${item.author.login}` : \"\"\n\n // Layout: [#num] [state/type] title ............. @author\n // All chrome is left-aligned; author is the right-column hint.\n const lead = `${style.add(\"optionName\")(num)} ${style.add(stateSlot)(`${item.state}·${typeLabel}`)} ${item.title}`\n\n if (author === \"\") return lead\n const gap = 2\n const leadW = stringWidth(lead)\n const hintW = stringWidth(author)\n const padded = ctx.width - leadW - hintW - gap\n if (padded < 1) return lead\n return lead + \" \".repeat(padded + gap) + style.add(\"optionDesc\")(author)\n}\n\nfunction stateStyleSlot(state: string)
|
|
1
|
+
{"version":3,"file":"github-Cy2hfWJ7.mjs","names":[],"sources":["../src/widgets/completions/github.ts"],"sourcesContent":["import type { ScoredItem } from \"../../search/matcher.ts\"\nimport type { CompletionSource } from \"../autocomplete.ts\"\nimport type { PickerItem } from \"../picker.ts\"\nimport type { OptionRender } from \"../select.ts\"\n\nimport { stringWidth } from \"@zaly/shared/ansi\"\nimport { spawn } from \"node:child_process\"\n\n/** A GitHub issue or pull request returned by `githubSource`. Shape\n * mirrors the `gh` CLI's `--json number,title,state,author,url`\n * output, with `type` added to distinguish issues from PRs. */\nexport type GithubItem = PickerItem & {\n number: number\n title: string\n /** `\"open\"` / `\"closed\"` for issues; `\"open\"` / `\"closed\"` / `\"merged\"`\n * for PRs. Kept as a string so we don't trip if gh evolves. */\n state: string\n type: \"issue\" | \"pr\"\n url: string\n author?: { login?: string }\n}\n\nexport type GithubState = \"open\" | \"closed\" | \"all\"\n\nexport type GithubFetcher = (cwd: string, state: GithubState) => Promise<GithubItem[]>\n\nexport interface GithubSourceOptions {\n /** Working directory used to locate the repo. `gh` resolves the repo\n * from the git remote of this dir. Default: `process.cwd()`. */\n cwd?: string\n /** Trigger regex. Default: `/(?<=^|\\s)#/` — `#` preceded by start-of-\n * string or whitespace (same lookbehind trick as `filesSource`). */\n trigger?: RegExp\n /** Prepended to the accepted value so the trigger character stays in\n * the input. Default: `\"#\"`. */\n prefix?: string\n /** Which issues / PRs to include. Default: `\"open\"`. */\n state?: GithubState\n /** Per-kind cap passed to `gh`. Default: `50`. */\n limit?: number\n /** Override the fetch implementation. Mainly useful for tests — the\n * default shells out to `gh`. The fetcher is called at most once per\n * `githubSource` instance; results are cached thereafter. */\n fetcher?: GithubFetcher\n}\n\n/**\n * Completion source for GitHub issues and pull requests from the repo\n * at `cwd`. Shells out to the `gh` CLI on first use, caches the result,\n * and fuzzy-filters locally on subsequent calls so typing stays snappy.\n *\n * Accepts insert `#123 ` into the input — ready for a markdown-style\n * reference in a chat message or commit subject.\n *\n * ```ts\n * autocomplete({\n * input: \"chat-input\",\n * sources: {\n * gh: githubSource(),\n * },\n * })\n * ```\n *\n * Silently returns no items when `gh` isn't installed, the user isn't\n * authenticated, or the directory isn't a GitHub repo — so it's safe\n * to wire up unconditionally.\n */\nexport function githubSource(opts: GithubSourceOptions = {}): CompletionSource<GithubItem> {\n const cwd = opts.cwd ?? process.cwd()\n const trigger = opts.trigger ?? /(?<=^|\\s)#/\n const prefix = opts.prefix ?? \"#\"\n const state: GithubState = opts.state ?? \"open\"\n const limit = opts.limit ?? 50\n const fetcher = opts.fetcher ?? defaultFetcher(limit)\n\n // Lazy, single-fetch cache. The Promise is reused by concurrent\n // callers so rapid keystrokes while the first fetch is in flight\n // don't spawn duplicate `gh` processes.\n let cache: Promise<GithubItem[]> | undefined\n\n return {\n accept: (item) => `${prefix}${item.number} `,\n async complete(_query: string, match): Promise<ScoredItem<GithubItem>[]> {\n cache ??= fetcher(cwd, state).catch(() => [])\n const items = await cache\n const out: ScoredItem<GithubItem>[] = []\n for (const item of items) {\n // Match on \"#<num> <title>\" so users can type either digits or\n // words and both hit. Keeps ranking implicit — source order\n // (freshest first from gh) wins when scores tie.\n const target = `#${item.number} ${item.title}`\n const score = match(target)\n if (!score) continue\n out.push({ ...item, score })\n }\n return out\n },\n render: defaultRender,\n triggers: [trigger],\n }\n}\n\nconst defaultRender: OptionRender<GithubItem> = (item, ctx) => {\n const { style } = ctx\n const num = `#${item.number}`\n const stateSlot = stateStyleSlot(item.state)\n const typeLabel = item.type === \"pr\" ? \"pr\" : \"issue\"\n const author = item.author?.login ? `@${item.author.login}` : \"\"\n\n // Layout: [#num] [state/type] title ............. @author\n // All chrome is left-aligned; author is the right-column hint.\n const lead = `${style.add(\"optionName\")(num)} ${style.add(stateSlot)(`${item.state}·${typeLabel}`)} ${item.title}`\n\n if (author === \"\") return lead\n const gap = 2\n const leadW = stringWidth(lead)\n const hintW = stringWidth(author)\n const padded = ctx.width - leadW - hintW - gap\n if (padded < 1) return lead\n return lead + \" \".repeat(padded + gap) + style.add(\"optionDesc\")(author)\n}\n\nfunction stateStyleSlot(state: string) {\n if (state === \"open\") return \"success\"\n if (state === \"merged\") return \"accent\"\n // \"closed\" and anything unknown → dim.\n return \"muted\"\n}\n\n/** Default fetcher — shells out to `gh issue list` + `gh pr list` in\n * parallel. Either failing is swallowed so a repo with only issues\n * (or only PRs) still works. */\nfunction defaultFetcher(limit: number): GithubFetcher {\n const fields = \"number,title,state,author,url\"\n return async (cwd, state) => {\n const [issues, prs] = await Promise.all([\n runGh(cwd, [\"issue\", \"list\", \"--state\", state, \"--json\", fields, \"--limit\", String(limit)]),\n runGh(cwd, [\"pr\", \"list\", \"--state\", state, \"--json\", fields, \"--limit\", String(limit)]),\n ])\n return [\n ...parse(issues).map((x) => Object.assign(x, { type: \"issue\" as const })),\n ...parse(prs).map((x) => Object.assign(x, { type: \"pr\" as const })),\n ].map((item) => Object.assign(item, { text: `#${item.number} ${item.title}` }))\n }\n}\n\nfunction parse(out: string): Omit<GithubItem, \"type\">[] {\n try {\n return JSON.parse(out) as Omit<GithubItem, \"type\">[]\n } catch {\n return []\n }\n}\n\nfunction runGh(cwd: string, args: string[]): Promise<string> {\n return new Promise((resolve) => {\n try {\n const child = spawn(\"gh\", args, { cwd, stdio: [\"ignore\", \"pipe\", \"ignore\"] })\n let stdout = \"\"\n child.stdout.on(\"data\", (chunk: Buffer) => {\n stdout += chunk.toString(\"utf8\")\n })\n child.on(\"close\", (code) => {\n resolve(code === 0 ? stdout : \"\")\n })\n child.on(\"error\", () => {\n resolve(\"\")\n })\n } catch {\n resolve(\"\")\n }\n })\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAmEA,SAAgB,aAAa,OAA4B,CAAC,GAAiC;CACzF,MAAM,MAAM,KAAK,OAAO,QAAQ,IAAI;CACpC,MAAM,UAAU,KAAK,WAAW;CAChC,MAAM,SAAS,KAAK,UAAU;CAC9B,MAAM,QAAqB,KAAK,SAAS;CACzC,MAAM,QAAQ,KAAK,SAAS;CAC5B,MAAM,UAAU,KAAK,WAAW,eAAe,KAAK;CAKpD,IAAI;CAEJ,OAAO;EACL,SAAS,SAAS,GAAG,SAAS,KAAK,OAAO;EAC1C,MA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./queries-BDX8mcl5.mjs";
|
|
2
2
|
//#region src/widgets/image.d.ts
|
|
3
3
|
interface ImageState {
|
|
4
4
|
/**
|
|
@@ -34,4 +34,4 @@ declare function image(src: string, style?: Omit<ImageState, "src">): Image;
|
|
|
34
34
|
declare function image(state: ImageState): Image;
|
|
35
35
|
//#endregion
|
|
36
36
|
export { ImageState as n, image as r, Image as t };
|
|
37
|
-
//# sourceMappingURL=image-
|
|
37
|
+
//# sourceMappingURL=image-VaT7AN-S.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image-
|
|
1
|
+
{"version":3,"file":"image-VaT7AN-S.d.mts","names":[],"sources":["../src/widgets/image.ts"],"mappings":";;UAWiB;;;;;;;EAOf;;EAEA;;;;;EAKA;;EAEA;;;;;EAKA;;cAGW,cAAc,KAAK;;EAI9B,YAAY,OAAO;MAOf;EAIK,UAAU;YAIH,QAAQ,KAAK,YAAY;;iBAuC3B,MAAM,aAAa,QAAQ,KAAK,qBAAqB;iBACrD,MAAM,OAAO,aAAa"}
|
package/dist/image.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as TerminalQuery, t as TerminalQueries } from "./queries-
|
|
1
|
+
import { n as TerminalQuery, t as TerminalQueries } from "./queries-BDX8mcl5.mjs";
|
|
2
2
|
import { MaybePromise } from "@zaly/shared";
|
|
3
3
|
import { ImageInfo } from "@zaly/shared/image";
|
|
4
4
|
//#region src/image/kitty.d.ts
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { $ as Context, At as useContext, Bt as Actions, C as OverlaySurface, Ct as peek, Dt as untrack, Et as toAccessor, Ft as ActionCtx, Gt as KeyModifier, Ht as NodeAction, It as ActionDef, J as Layout, Jt as SpecialKeyName, Kt as KeyPattern, Lt as ActionFilter, Mt as withOwner, N as MountCtx, Ot as unwrap, P as RenderCtx, Pt as Action, Q as Accessor, Rt as ActionFn, S as Stream, St as onCleanup, Tt as signal, Ut as NodeActionMap, Vt as KeyBinding, Wt as KeyEvent, X as State, Xt as isKeyPattern, Y as LayoutState, Yt as canonical, Z as StyleState, Zt as keyMatches, _ as RenderStats, _t as createSuspenseBoundary, a as InputRouter, at as Signal, b as SurfaceType, bt as isAccessor, c as KeyPatterns, ct as SuspenseContext, d as RoutedPaste, dt as createIterable, et as Owner, f as BaseEvents, ft as createNode, g as RenderEvents, gt as createStore, h as NodeVisitor, ht as createRoot, i as parseAttrs, it as Setter, jt as withActiveNode, kt as useActiveOwner, l as KeymapEntry, lt as createAsync, m as isNode, mt as createRef, n as TerminalQuery, nt as Reactive, o as InputRouterEvents, ot as SignalStore, p as Node, pt as createProgressive, q as FlexState, qt as KeyPatternError, r as TerminalQueryOpts, rt as Ref, s as KeyHandler, st as SuspenseBoundary, t as TerminalQueries, tt as Progressive, u as RoutedKey, ut as createContext, v as Renderer, vt as effect, w as Terminal, wt as provideContext, x as UI, xt as memo, y as RendererOptions, yt as inRenderContextOf, zt as ActionMap } from "./queries-
|
|
2
|
-
import { _ as ShikiRequest, a as AnsiStyle, b as ShikiWorkerMessage, c as Color, d as RGB, f as Style, g as ShikiOpts, h as ShikiLanguage, i as AnsiColorName, l as ColorLightness, m as ShikiJob, n as ThemeValue, o as AnyStyle, p as ThemeKey, r as AnsiColor, s as BrightAnsiColorName, t as Theme, u as HexColor, v as ShikiResult, x as ShikiWorkerRequest, y as ShikiTheme } from "./types-
|
|
3
|
-
import { a as StyleBuilder, i as isMarkdown, n as inspect, r as inspectFormat, t as InspectOpts } from "./inspect-
|
|
1
|
+
import { $ as Context, At as useContext, Bt as Actions, C as OverlaySurface, Ct as peek, Dt as untrack, Et as toAccessor, Ft as ActionCtx, Gt as KeyModifier, Ht as NodeAction, It as ActionDef, J as Layout, Jt as SpecialKeyName, Kt as KeyPattern, Lt as ActionFilter, Mt as withOwner, N as MountCtx, Ot as unwrap, P as RenderCtx, Pt as Action, Q as Accessor, Rt as ActionFn, S as Stream, St as onCleanup, Tt as signal, Ut as NodeActionMap, Vt as KeyBinding, Wt as KeyEvent, X as State, Xt as isKeyPattern, Y as LayoutState, Yt as canonical, Z as StyleState, Zt as keyMatches, _ as RenderStats, _t as createSuspenseBoundary, a as InputRouter, at as Signal, b as SurfaceType, bt as isAccessor, c as KeyPatterns, ct as SuspenseContext, d as RoutedPaste, dt as createIterable, et as Owner, f as BaseEvents, ft as createNode, g as RenderEvents, gt as createStore, h as NodeVisitor, ht as createRoot, i as parseAttrs, it as Setter, jt as withActiveNode, kt as useActiveOwner, l as KeymapEntry, lt as createAsync, m as isNode, mt as createRef, n as TerminalQuery, nt as Reactive, o as InputRouterEvents, ot as SignalStore, p as Node, pt as createProgressive, q as FlexState, qt as KeyPatternError, r as TerminalQueryOpts, rt as Ref, s as KeyHandler, st as SuspenseBoundary, t as TerminalQueries, tt as Progressive, u as RoutedKey, ut as createContext, v as Renderer, vt as effect, w as Terminal, wt as provideContext, x as UI, xt as memo, y as RendererOptions, yt as inRenderContextOf, zt as ActionMap } from "./queries-BDX8mcl5.mjs";
|
|
2
|
+
import { _ as ShikiRequest, a as AnsiStyle, b as ShikiWorkerMessage, c as Color, d as RGB, f as Style, g as ShikiOpts, h as ShikiLanguage, i as AnsiColorName, l as ColorLightness, m as ShikiJob, n as ThemeValue, o as AnyStyle, p as ThemeKey, r as AnsiColor, s as BrightAnsiColorName, t as Theme, u as HexColor, v as ShikiResult, x as ShikiWorkerRequest, y as ShikiTheme } from "./types-D2EYlzmK.mjs";
|
|
3
|
+
import { a as StyleBuilder, i as isMarkdown, n as inspect, r as inspectFormat, t as InspectOpts } from "./inspect-CfNydMgO.mjs";
|
|
4
4
|
import { ArgsOpts } from "@zaly/shared/args";
|
|
5
5
|
//#region src/input/index.d.ts
|
|
6
6
|
export declare function defineAction<T extends ArgsOpts = ArgsOpts>(action: ActionDef<T>): ActionDef<T>;
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { C as useActiveOwner, E as withOwner, S as unwrap, T as withActiveNode, _ as peek, a as createIterable, b as toAccessor, c as createRef, d as createSuspenseBoundary, f as effect, g as onCleanup, h as memo, i as createContext, l as createRoot, m as isAccessor, n as SuspenseContext, o as createNode, p as inRenderContextOf, r as createAsync, s as createProgressive, t as Owner, u as createStore, v as provideContext, w as useContext, x as untrack, y as signal } from "./reactive-f7NpAi69.mjs";
|
|
2
|
-
import { n as inspectFormat, r as isMarkdown, t as inspect } from "./inspect-
|
|
3
|
-
import { n as createRender, t as RenderContext } from "./render-
|
|
2
|
+
import { n as inspectFormat, r as isMarkdown, t as inspect } from "./inspect-jG_W4njH.mjs";
|
|
3
|
+
import { n as createRender, t as RenderContext } from "./render-DEIUNLkh.mjs";
|
|
4
4
|
import { t as codeToAnsi } from "./shiki--ASSYv4_.mjs";
|
|
5
5
|
import { a as isKeyPattern, i as canonical, n as parseAttrs, o as keyMatches, r as KeyPatternError, t as TerminalQueries } from "./queries-B_lOwEiE.mjs";
|
|
6
6
|
//#region src/input/index.ts
|
|
@@ -10,14 +10,14 @@ function defineAction(action) {
|
|
|
10
10
|
//#endregion
|
|
11
11
|
//#region src/core/index.ts
|
|
12
12
|
async function createCtx(opts = {}) {
|
|
13
|
-
const { createCtx: create } = await import("./ctx-
|
|
13
|
+
const { createCtx: create } = await import("./ctx-D_JgJ8Eo.mjs");
|
|
14
14
|
return create(opts);
|
|
15
15
|
}
|
|
16
16
|
//#endregion
|
|
17
17
|
//#region src/renderer/index.ts
|
|
18
18
|
/** Factory shorthand for `new Renderer(opts)`. */
|
|
19
19
|
async function createRenderer(opts = {}) {
|
|
20
|
-
const { Renderer } = await import("./renderer-
|
|
20
|
+
const { Renderer } = await import("./renderer-zDNlAovy.mjs");
|
|
21
21
|
return new Renderer(opts);
|
|
22
22
|
}
|
|
23
23
|
//#endregion
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Nt as Size, P as RenderCtx, Z as StyleState, f as BaseEvents, nt as Reactive, p as Node } from "./queries-
|
|
2
|
-
import { a as StyleBuilder } from "./inspect-
|
|
1
|
+
import { Nt as Size, P as RenderCtx, Z as StyleState, f as BaseEvents, nt as Reactive, p as Node } from "./queries-BDX8mcl5.mjs";
|
|
2
|
+
import { a as StyleBuilder } from "./inspect-CfNydMgO.mjs";
|
|
3
3
|
import { MaybePromise } from "@zaly/shared";
|
|
4
4
|
import { DetectedFile } from "@zaly/shared/detect";
|
|
5
5
|
//#region src/widgets/input.d.ts
|
|
@@ -138,4 +138,4 @@ declare class Input extends Node<InputState, InputEvents> {
|
|
|
138
138
|
declare function input(state?: InputState): Input;
|
|
139
139
|
//#endregion
|
|
140
140
|
export { InputValue as a, InputState as i, InputAttachment as n, input as o, InputEvents as r, Input as t };
|
|
141
|
-
//# sourceMappingURL=input-
|
|
141
|
+
//# sourceMappingURL=input-BAYux7qo.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input-
|
|
1
|
+
{"version":3,"file":"input-BAYux7qo.d.mts","names":[],"sources":["../src/widgets/input.ts"],"mappings":";;;;;UAoBiB,mBAAmB;;EAElC;;EAEA,cAAc;;EAEd;;EAEA,QAAQ;;EAER;;EAEA;EACA;EACA,aAAa,MAAM;EACnB,UAAU,eAAe;IAAO,OAAO;QAAmB;EAC1D,YAAY;;KAGF;EAAe;EAAe,aAAa;;;KAOlD;EAAU;EAAe;;;KAGlB,kBAAkB;EAAiB;;KAEnC,cAAc;;EAExB;IAAW;IAAmB;;;EAE9B;IAAU;IAAe,aAAa;;;;;;;;;;EAStC;IAAU,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA+BX,cAAc,KAAK,YAAY;;;kBAE1B;WAEE;;;;;;;EAgBT;IACiB;IAUA;IAKG;IAKE;IAMJ;IAMH;IAUM;IAUG;IAUH;IAWD;IAsBJ;IAqBJ;IA2BC;;EAStB,YAAY,UAAS;MA2BjB;MAIA,QAAQ;EAKZ,OAAO,KAAK,kBAAkB;EAqB9B,MAAM;EASN,OAAO;EAWP,QAAQ;;;;EAQR,WAAW;EA2BX,WAAW;YAqHK,QAAQ,KAAK,YAAY;;;;;;;;;;;;iBAyD3B,MAAM,QAAO,aAAkB"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { S as unwrap, x as untrack } from "./reactive-f7NpAi69.mjs";
|
|
2
2
|
import { t as Node } from "./node-BZ7f6HzU.mjs";
|
|
3
|
-
import { o as formatText } from "./text-
|
|
3
|
+
import { o as formatText } from "./text-CkQ7Irmt.mjs";
|
|
4
4
|
import { t as clipboard } from "./clipboard-CNPBTX7j.mjs";
|
|
5
5
|
import { hash, isPromiseLike } from "@zaly/shared";
|
|
6
6
|
import { sliceAnsi, splitAnsi, stringWidth } from "@zaly/shared/ansi";
|
|
@@ -9,6 +9,7 @@ import { fileDetect } from "@zaly/shared/detect";
|
|
|
9
9
|
//#region src/widgets/input.ts
|
|
10
10
|
const PASTE_MAX_LINES = 5;
|
|
11
11
|
const PASTE_MAX_CHARS = 1e3;
|
|
12
|
+
const graphemes = new Intl.Segmenter(void 0, { granularity: "grapheme" });
|
|
12
13
|
/**
|
|
13
14
|
* Multi-line text input with auto-grow.
|
|
14
15
|
*
|
|
@@ -463,15 +464,11 @@ function isWhitespace(ch) {
|
|
|
463
464
|
return ch !== void 0 && (ch === " " || ch === " " || ch === "\n");
|
|
464
465
|
}
|
|
465
466
|
function posToLineCol(value, cursor) {
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
for (let i = 0; i < cursor; i++) if (value[i] === "\n") {
|
|
469
|
-
line++;
|
|
470
|
-
col = 0;
|
|
471
|
-
} else col++;
|
|
467
|
+
const prefix = value.slice(0, cursor);
|
|
468
|
+
const lineStart = prefix.lastIndexOf("\n") + 1;
|
|
472
469
|
return {
|
|
473
|
-
col,
|
|
474
|
-
line
|
|
470
|
+
col: stringWidth(prefix.slice(lineStart)),
|
|
471
|
+
line: prefix.split("\n").length - 1
|
|
475
472
|
};
|
|
476
473
|
}
|
|
477
474
|
function lineColToPos(value, line, col) {
|
|
@@ -479,7 +476,15 @@ function lineColToPos(value, line, col) {
|
|
|
479
476
|
const clampLine = Math.max(0, Math.min(line, lines.length - 1));
|
|
480
477
|
let abs = 0;
|
|
481
478
|
for (let i = 0; i < clampLine; i++) abs += lines[i].length + 1;
|
|
482
|
-
|
|
479
|
+
let cells = 0;
|
|
480
|
+
let offset = 0;
|
|
481
|
+
for (const { segment } of graphemes.segment(lines[clampLine])) {
|
|
482
|
+
const width = stringWidth(segment);
|
|
483
|
+
if (cells + width > col) break;
|
|
484
|
+
cells += width;
|
|
485
|
+
offset += segment.length;
|
|
486
|
+
}
|
|
487
|
+
return abs + offset;
|
|
483
488
|
}
|
|
484
489
|
function lineEndPos(value, cursor) {
|
|
485
490
|
let i = cursor;
|
|
@@ -494,4 +499,4 @@ function countLines(value) {
|
|
|
494
499
|
//#endregion
|
|
495
500
|
export { input as n, Input as t };
|
|
496
501
|
|
|
497
|
-
//# sourceMappingURL=input-
|
|
502
|
+
//# sourceMappingURL=input-BGTTujDN.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input-BGTTujDN.mjs","names":[],"sources":["../src/widgets/input.ts"],"sourcesContent":["import type { MaybePromise } from \"@zaly/shared\"\nimport type { DetectedFile } from \"@zaly/shared/detect\"\nimport type { RenderCtx } from \"../core/ctx.ts\"\nimport type { BaseEvents } from \"../core/node.ts\"\nimport type { Reactive } from \"../core/reactive.ts\"\nimport type { StyleState } from \"../core/state.ts\"\nimport type { NodeActionMap } from \"../input/actions.ts\"\nimport type { RoutedKey } from \"../input/router.ts\"\nimport type { Size } from \"../layout/size.ts\"\nimport type { StyleBuilder } from \"../style/builder.ts\"\n\nimport { hash, isPromiseLike } from \"@zaly/shared\"\nimport { sliceAnsi, splitAnsi, stringWidth } from \"@zaly/shared/ansi\"\nimport { fileDetect } from \"@zaly/shared/detect\"\nimport { basename } from \"pathe\"\nimport { Node } from \"../core/node.ts\"\nimport { untrack, unwrap } from \"../core/reactive.ts\"\nimport { clipboard } from \"../input/clipboard.ts\"\nimport { formatText } from \"../layout/text.ts\"\n\nexport interface InputState extends StyleState {\n /** Current text content. May include `\\n` for multi-line input. */\n value?: string\n /** Shown dim when `value` is empty. */\n placeholder?: Reactive<string | undefined>\n /** Cursor position as a char index in `value`. Clamped to `[0, value.length]`. */\n cursor?: number\n /** Render width. Defaults to `fill`. */\n width?: Size\n /** Submitted input history, newest last. */\n history?: readonly string[]\n /** Threshold for showing pasted content as an attachment rather than raw text */\n pasteMaxLines?: number\n pasteMaxChars?: number\n canAttach?: (file: InputAttachment) => boolean\n format?: (value: string, ctx: { style: StyleBuilder }) => MaybePromise<string>\n validate?: (value: string) => boolean\n}\n\nexport type InputValue = { value: string; attachments: InputAttachment[] }\n\nconst PASTE_MAX_LINES = 5\nconst PASTE_MAX_CHARS = 1000\nconst graphemes = new Intl.Segmenter(undefined, { granularity: \"grapheme\" })\n\n/** A clipboard or bracketed paste that exceeds the `pasteMax*` thresholds. **/\ntype Paste = { type: \"paste\"; text: string }\n\n/** A file or image attachment detected from the clipboard. */\nexport type InputAttachment = DetectedFile & { path: string }\n\nexport type InputEvents = BaseEvents & {\n /** Fired when the submitted history changes. */\n history: { history: string[]; added: string }\n /** Fired when plain Enter is pressed. Payload is the current value. */\n submit: { value: string; attachments: InputAttachment[] }\n /** Fired when the user pastes a non-text resource via the\n * `input.paste` action. Images and file references both land here,\n * discriminated by `attachment.kind`. One event fires per image\n * paste; one per file in a multi-file paste.\n *\n * Wrapped under `attachment` because `InputAttachment` carries its\n * own `type` field (MIME) that would shadow the envelope's `type`\n * discriminator if spread directly. */\n attach: { attachment: InputAttachment }\n}\n\ntype FormatEntry = { promise?: Promise<void>; result?: string; input: string }\n\n/**\n * Multi-line text input with auto-grow.\n *\n * Editing commands (`cursorLeft`, `deleteWordBack`, `submit`, …) live on\n * `this.actions` as zero-arg methods. The input router maps keymap\n * bindings like `\"input.cursorLeft\"` onto those methods — users bind\n * different keys by configuring the keymap, not by patching the class.\n * The methods are also callable directly (`input.actions.submit()`),\n * which is handy in tests or for higher-level macros.\n *\n * What this class *still* handles via its `key` event listener:\n * - **Printable character insertion.** An unbound keystroke whose\n * `text` is set and has no ctrl/alt/meta modifier becomes a literal\n * insert at the cursor. There's no action for every printable char\n * in the keymap; the raw-key fallback handles them.\n * - **Paste events.** Whole payload inserted at cursor; always.\n *\n * Everything else (navigation, editing, submit/newline) goes through\n * the router → actions pipeline. Unbound non-printable keys fall back\n * to `emit(\"key\", …)` and bubble to the parent chain.\n *\n * Rendering word-wraps each logical line to `ctx.width`, so long\n * messages naturally grow vertically. The UI surface resizes its\n * reserved footer when the Input's row count changes, so the stream\n * above shifts accordingly.\n */\nexport class Input extends Node<InputState, InputEvents> {\n /** Class-level scope tag used by the input router to bind keymaps. */\n static readonly type = \"input\"\n\n override readonly type = Input.type\n #focused = false\n #history: string[] = []\n #historyDraft = \"\"\n #historyIndex: number | undefined\n #preferredCol: number | undefined\n #staged: ((InputAttachment | Paste) & { id: number; marker: string })[] = []\n #formatCache: Map<string, FormatEntry> & { version?: number } = new Map<string, FormatEntry>()\n #formatGen = 0\n\n /**\n * Editing actions. Parameterless — they close over `this` — so both\n * the router (via keymap dispatch) and application code can invoke\n * them. Add to the keymap in `src/input/actions.ts` to give them\n * default key bindings.\n */\n override actions = {\n \"input.cursorDown\": (): void => {\n const v = this.state.value ?? \"\"\n const { col, line } = posToLineCol(v, this.#cursor())\n if (line >= countLines(v) - 1) {\n this.#historyNext()\n return\n }\n this.#preferredCol ??= col\n this.state.cursor = lineColToPos(v, line + 1, this.#preferredCol)\n },\n \"input.cursorLeft\": (): void => {\n const c = this.#cursor()\n this.#preferredCol = undefined\n this.state.cursor = c > 0 ? c - 1 : c\n },\n \"input.cursorLineEnd\": (): void => {\n const v = this.state.value ?? \"\"\n this.#preferredCol = undefined\n this.state.cursor = lineEndPos(v, this.#cursor())\n },\n \"input.cursorLineStart\": (): void => {\n const v = this.state.value ?? \"\"\n const { line } = posToLineCol(v, this.#cursor())\n this.#preferredCol = undefined\n this.state.cursor = lineColToPos(v, line, 0)\n },\n \"input.cursorRight\": (): void => {\n const v = this.state.value ?? \"\"\n const c = this.#cursor()\n this.#preferredCol = undefined\n this.state.cursor = c < v.length ? c + 1 : c\n },\n \"input.cursorUp\": (): void => {\n const v = this.state.value ?? \"\"\n const { col, line } = posToLineCol(v, this.#cursor())\n if (line === 0) {\n this.#historyPrev()\n return\n }\n this.#preferredCol ??= col\n this.state.cursor = lineColToPos(v, line - 1, this.#preferredCol)\n },\n \"input.deleteCharBack\": (): void => {\n const v = this.state.value ?? \"\"\n const c = this.#cursor()\n this.#preferredCol = undefined\n if (c === 0) return\n this.#historyEdit()\n const marker = this.#markerRange(c, \"back\")\n if (marker) return this.#deleteRange(marker.start, marker.end)\n this.state.set({ cursor: c - 1, value: v.slice(0, c - 1) + v.slice(c) })\n },\n \"input.deleteCharForward\": (): void => {\n const v = this.state.value ?? \"\"\n const c = this.#cursor()\n this.#preferredCol = undefined\n if (c >= v.length) return\n this.#historyEdit()\n const marker = this.#markerRange(c, \"forward\")\n if (marker) return this.#deleteRange(marker.start, marker.end)\n this.state.value = v.slice(0, c) + v.slice(c + 1)\n },\n \"input.deleteWordBack\": (): void => {\n const v = this.state.value ?? \"\"\n const c = this.#cursor()\n this.#preferredCol = undefined\n let i = c\n while (i > 0 && isWhitespace(v[i - 1])) i--\n while (i > 0 && !isWhitespace(v[i - 1])) i--\n if (i === c) return\n this.#historyEdit()\n this.state.set({ cursor: i, value: v.slice(0, i) + v.slice(c) })\n },\n \"input.insertNewline\": (): void => {\n // Smart indent: copy the leading whitespace of the current\n // logical line onto the new line so continuations stay aligned\n // with the bullet / quote / prefix the user typed.\n const v = this.state.value ?? \"\"\n const c = this.#cursor()\n this.#preferredCol = undefined\n let lineStart = c\n while (lineStart > 0 && v[lineStart - 1] !== \"\\n\") lineStart--\n let indent = \"\"\n for (let i = lineStart; i < c; i++) {\n const ch = v[i]\n if (ch === \" \" || ch === \"\\t\") indent += ch\n else break\n }\n const insert = `\\n${indent}`\n this.#historyEdit()\n this.state.set({\n cursor: c + insert.length,\n value: v.slice(0, c) + insert + v.slice(c),\n })\n },\n \"input.insertTab\": (): void => {\n // Two spaces rather than `\\t` — terminal tab stops are\n // unpredictable (often 8 cells) and play badly with our per-row\n // layout. Soft tabs are the safer default; users wanting real\n // tabs can override the action.\n const v = this.state.value ?? \"\"\n const c = this.#cursor()\n this.#preferredCol = undefined\n const tab = \" \"\n this.#historyEdit()\n this.state.set({ cursor: c + tab.length, value: v.slice(0, c) + tab + v.slice(c) })\n },\n // `ctrl-v` queries the OS clipboard (via xclip / wl-paste / pbpaste /\n // PowerShell depending on platform). The richest content wins:\n //\n // - **image bytes** → one `attach` event with a temp PNG path.\n // - **file references** → one `attach` event per file.\n // - **plain text** → inserted at the cursor like a regular paste.\n //\n // Fire-and-forget async — we await the probe and commit the\n // result in a microtask.\n \"input.paste\": (): void => {\n void (async (): Promise<void> => {\n const content = await clipboard.read()\n if (!content) return\n\n // Route through the regular paste handler\n if (content.kind === \"text\") {\n void this.emit(\"paste\", {\n paste: {\n stop: () => void 0,\n stopped: false,\n text: content.text,\n },\n })\n return\n }\n\n const paths: string[] = content.kind === \"image\" ? [content.path] : content.paths\n const files = await Promise.all(paths.map((path) => fileDetect({ path })))\n for (let i = 0; i < paths.length; i++) {\n const path = paths[i]\n const file = files[i]\n if (!file) continue\n this.attach({ ...file, path })\n }\n })()\n },\n \"input.submit\": (): void => {\n const value = this.state.value ?? \"\"\n if (this.state.validate?.(value) === false) return\n const ret = this.consume()\n this.#historyAdd(ret.value)\n void this.emit(\"submit\", ret)\n },\n } satisfies NodeActionMap\n\n constructor(initial: InputState = {}) {\n const value = initial.value ?? \"\"\n super({ cursor: value.length, value, ...initial })\n this.#history = [...(initial.history ?? [])]\n this.on(\"key\", ({ key }) => {\n this.#handleKey(key)\n })\n this.on(\"paste\", ({ paste }) => {\n this.paste(paste.text)\n paste.stop()\n })\n this.on(\"focus\", () => {\n this.#focused = true\n this.invalidate()\n })\n this.on(\"blur\", () => {\n this.#focused = false\n this.invalidate()\n })\n\n this.on(\"mount\", () => {\n this.ctx?.input.events.on(\"terminal-focus\", () => this.invalidate(), {\n signal: this.mountSignal,\n })\n })\n }\n\n get history(): readonly string[] {\n return this.#history\n }\n\n set history(v: readonly string[]) {\n this.#history = [...v]\n this.#historyIndex = undefined\n }\n\n attach(att: InputAttachment | Paste): void {\n if (att.type !== \"paste\" && this.state.canAttach?.(att) === false) {\n // Caller doesn't want this attachment (e.g. model doesn't support it) — fall\n // back to pasting the path as plain text\n return this.insert(att.path)\n }\n\n const id = this.#staged.length + 1\n let prefix = att.type[0].toUpperCase() + att.type.slice(1)\n let suffix = \"\"\n if (att.type === \"paste\") {\n prefix = \"Pasted text\"\n suffix = ` +${countLines(att.text)} lines`\n } else if (![\"image\", \"pdf\"].includes(att.type)) suffix = ` ${basename(att.path)}`\n const marker = `[${prefix} #${id}${suffix}]`\n this.#staged.push({ ...att, id, marker })\n this.insert(marker)\n\n if (att.type !== \"paste\") void this.emit(\"attach\", { attachment: att })\n }\n\n paste(text: string): void {\n if (\n countLines(text) > (this.state.pasteMaxLines ?? PASTE_MAX_LINES) ||\n stringWidth(text) > (this.state.pasteMaxChars ?? PASTE_MAX_CHARS)\n )\n return this.attach({ text, type: \"paste\" })\n this.insert(text)\n }\n\n insert(text: string): void {\n const v = this.state.value ?? \"\"\n const c = this.#cursor()\n this.#historyEdit()\n this.#preferredCol = undefined\n this.state.set({\n cursor: c + text.length,\n value: v.slice(0, c) + text + v.slice(c),\n })\n }\n\n replace(text: string): void {\n this.state.value = \"\"\n this.insert(text)\n }\n\n /** Consume the input's current value and attachments.\n * Pastes are replaced inline with their text; file/image\n * attachments are returned in the `attachments` array and removed from the value. */\n consume(): InputValue {\n let value = this.state.value ?? \"\"\n const atts: InputAttachment[] = []\n for (const att of this.#staged) {\n if (!value.includes(att.marker)) continue\n if (att.type === \"paste\") {\n value = value.replace(att.marker, att.text)\n } else atts.push(att)\n }\n this.#staged = []\n this.#preferredCol = undefined\n this.state.set({ cursor: 0, value: \"\" })\n return { attachments: atts, value }\n }\n\n #cursor(): number {\n const v = this.state.value ?? \"\"\n return Math.max(0, Math.min(v.length, this.state.cursor ?? 0))\n }\n\n #deleteRange(start: number, end: number): void {\n const v = this.state.value ?? \"\"\n this.#historyEdit()\n this.#preferredCol = undefined\n this.state.set({ cursor: start, value: v.slice(0, start) + v.slice(end) })\n }\n\n historyAdd(value: string): void {\n this.#historyAdd(value)\n }\n\n #historyAdd(value: string): void {\n if (value.trim() === \"\") return\n if (this.#history.at(-1) !== value) {\n this.#history.push(value)\n void this.emit(\"history\", { added: value, history: [...this.#history] })\n }\n this.#historyDraft = \"\"\n this.#historyIndex = undefined\n }\n\n #historyEdit(): void {\n this.#historyDraft = \"\"\n this.#historyIndex = undefined\n }\n\n #historyNext(): void {\n if (this.#historyIndex === undefined) return\n const next = this.#historyIndex + 1\n if (next >= this.#history.length) {\n this.#historySet(this.#historyDraft)\n this.#historyDraft = \"\"\n this.#historyIndex = undefined\n return\n }\n this.#historyIndex = next\n this.#historySet(this.#history[next])\n }\n\n #historyPrev(): void {\n if (this.#history.length === 0) return\n if (this.#historyIndex === undefined) {\n this.#historyDraft = this.state.value ?? \"\"\n this.#historyIndex = this.#history.length - 1\n } else if (this.#historyIndex > 0) this.#historyIndex--\n this.#historySet(this.#history[this.#historyIndex])\n }\n\n #historySet(value: string): void {\n this.#preferredCol = undefined\n this.state.set({ cursor: value.length, value })\n }\n\n #markerRange(pos: number, dir: \"back\" | \"forward\"): { start: number; end: number } | undefined {\n const value = this.state.value ?? \"\"\n for (const att of this.#staged) {\n const start = value.indexOf(att.marker)\n if (start === -1) continue\n const end = start + att.marker.length\n if (dir === \"back\" && pos > start && pos <= end) return { end, start }\n if (dir === \"forward\" && pos >= start && pos < end) return { end, start }\n }\n }\n\n // Fallback path for anything the router couldn't resolve to a named\n // action: printable characters go straight into the value. Any other\n // unbound key (f7, unclaimed ctrl-combos, etc.) bubbles untouched.\n #handleKey(ev: RoutedKey): void {\n if (ev.text === undefined || ev.ctrl || ev.alt || ev.meta) return\n this.insert(ev.text)\n ev.stop()\n }\n\n #format(value: string, ctx: RenderCtx): string {\n const format = this.state.format\n if (!format) return value\n\n if (ctx.version !== this.#formatCache.version) {\n this.#formatCache.clear()\n this.#formatCache.version = ctx.version\n }\n\n const key = hash(value)\n const cached = this.#formatCache.get(key)\n if (cached?.result !== undefined) return cached.result\n const streaming = this.#streamingFormat(value)\n if (cached?.promise) return streaming ?? value\n\n const ret = format(value, { style: ctx.style })\n if (!isPromiseLike(ret)) return ret\n\n const gen = ++this.#formatGen\n const entry: FormatEntry = { input: value }\n entry.promise = ret.then(\n (result) => {\n if (this.#formatCache.get(key) !== entry) return\n entry.result = result\n entry.promise = undefined\n if (this.#formatGen === gen && result !== value) untrack(() => this.invalidate())\n },\n () => {\n if (this.#formatCache.get(key) === entry) this.#formatCache.delete(key)\n }\n )\n this.#formatCache.set(key, entry)\n while (this.#formatCache.size > 100)\n this.#formatCache.delete(this.#formatCache.keys().next().value!)\n return streaming ?? value\n }\n\n /** Reuse a highlighted prefix while async formatting catches up. */\n #streamingFormat(value: string): string | undefined {\n let ret: [string, FormatEntry] | undefined\n for (const [key, cached] of this.#formatCache) {\n if (cached.result === undefined) continue\n if (value.startsWith(cached.input) && cached.input.length > (ret?.[1].input.length ?? 0))\n ret = [key, cached]\n }\n if (ret === undefined) return\n this.#formatCache.delete(ret[0])\n this.#formatCache.set(ret[0], ret[1]) // bump to end of LRU\n return ret[1].result + value.slice(ret[1].input.length)\n }\n\n protected async _render(ctx: RenderCtx): Promise<string[]> {\n const value = this.state.value ?? \"\"\n const placeholder = this.state.placeholder ?? \"\"\n const cursor = this.#cursor()\n const focused = this.#focused\n\n // Build the styled content string. Layout (word-wrap, split into\n // rows, pad to width) is delegated to `Text` below — wrap-ansi knows\n // how to close+reopen SGR across line breaks, so the inverse-cursor\n // span survives wrapping.\n let content: string\n if (value === \"\") {\n const ph = unwrap(placeholder)\n content = ph ? ` ${ctx.style.quiet(ph)}` : \"\"\n } else {\n content = value\n for (const att of this.#staged) {\n if (!content.includes(att.marker)) continue\n content = content.replace(att.marker, ctx.style.accent(att.marker))\n }\n content = this.#format(content, ctx)\n }\n\n // Fake cursor. `cursor` is an absolute index in the raw value, while\n // rendering is line-oriented: newlines consume string indices but not\n // cells in any rendered row. Project the cursor to line/column before\n // slicing the formatted line.\n if (focused && this.ctx?.input.terminalFocus) {\n const { col, line } = posToLineCol(value, cursor)\n const lines = splitAnsi(content)\n const target = Math.max(0, Math.min(line, lines.length - 1))\n const row = lines[target] ?? \"\"\n const head = sliceAnsi(row, 0, col)\n const at = sliceAnsi(row, col, col + 1) || \" \"\n const tail = sliceAnsi(row, col + 1)\n lines[target] = head + ctx.style.inverse(at) + tail\n content = lines.join(\"\\n\")\n }\n\n return formatText(content, {\n style: ctx.style.add(this.state),\n width: ctx.width,\n wrap: \"word\",\n })\n }\n}\n\n/**\n * Factory for `Input`. All fields optional; default is an empty,\n * focusable input that fills `ctx.width` and has no placeholder.\n *\n * ```ts\n * input({ placeholder: \"type a message…\" })\n * const i = input({ value: \"draft\" })\n * i.on(\"submit\", (text) => console.log(\"user typed\", text))\n * ```\n */\nexport function input(state: InputState = {}): Input {\n return new Input(state)\n}\n\n// ---------- helpers ----------\n\nfunction isWhitespace(ch: string | undefined): boolean {\n return ch !== undefined && (ch === \" \" || ch === \"\\t\" || ch === \"\\n\")\n}\n\nfunction posToLineCol(value: string, cursor: number): { line: number; col: number } {\n const prefix = value.slice(0, cursor)\n const lineStart = prefix.lastIndexOf(\"\\n\") + 1\n return {\n col: stringWidth(prefix.slice(lineStart)),\n line: prefix.split(\"\\n\").length - 1,\n }\n}\n\nfunction lineColToPos(value: string, line: number, col: number): number {\n const lines = value.split(\"\\n\")\n const clampLine = Math.max(0, Math.min(line, lines.length - 1))\n let abs = 0\n for (let i = 0; i < clampLine; i++) abs += lines[i].length + 1\n\n let cells = 0\n let offset = 0\n for (const { segment } of graphemes.segment(lines[clampLine])) {\n const width = stringWidth(segment)\n if (cells + width > col) break\n cells += width\n offset += segment.length\n }\n return abs + offset\n}\n\nfunction lineEndPos(value: string, cursor: number): number {\n let i = cursor\n while (i < value.length && value[i] !== \"\\n\") i++\n return i\n}\n\nfunction countLines(value: string): number {\n let n = 1\n for (const ch of value) if (ch === \"\\n\") n++\n return n\n}\n"],"mappings":";;;;;;;;;AAyCA,MAAM,kBAAkB;AACxB,MAAM,kBAAkB;AACxB,MAAM,YAAY,IAAI,KAAK,UAAU,KAAA,GAAW,EAAE,aAAa,WAAW,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoD3E,IAAa,QAAb,MAAa,cAAc,KAA8B;;CAEvD,OAAgB,OAAO;CAEvB,OAAyB,MAAM;CAC/B,WAAW;CACX,WAAqB,CAAC;CACtB,gBAAgB;CAChB;CACA;CACA,UAA0E,CAAC;CAC3E,+BAAgE,IAAI,IAAyB;CAC7F,aAAa;;;;;;;CAQb,UAAmB;EACjB,0BAAgC;GAC9B,MAAM,IAAI,KAAK,MAAM,SAAS;GAC9B,MAAM,EAAE,KAAK,SAAS,aAAa,GAAG,KAAK,QAAQ,CAAC;GACpD,IAAI,QAAQ,WAAW,CAAC,IAAI,GAAG;IAC7B,KAAK,aAAa;IAClB;GACF;GACA,KAAK,kBAAkB;GACvB,KAAK,MAAM,SAAS,aAAa,GAAG,OAAO,GAAG,KAAK,aAAa;EAClE;EACA,0BAAgC;GAC9B,MAAM,IAAI,KAAK,QAAQ;GACvB,KAAK,gBAAgB,KAAA;GACrB,KAAK,MAAM,SAAS,IAAI,IAAI,IAAI,IAAI;EACtC;EACA,6BAAmC;GACjC,MAAM,IAAI,KAAK,MAAM,SAAS;GAC9B,KAAK,gBAAgB,KAAA;GACrB,KAAK,MAAM,SAAS,WAAW,GAAG,KAAK,QAAQ,CAAC;EAClD;EACA,+BAAqC;GACnC,M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IAAI,IAAI;CACR,OAAO,IAAI,MAAM,UAAU,MAAM,OAAO,MAAM;CAC9C,OAAO;AACT;AAEA,SAAS,WAAW,OAAuB;CACzC,IAAI,IAAI;CACR,KAAK,MAAM,MAAM,OAAO,IAAI,OAAO,MAAM;CACzC,OAAO;AACT"}
|
|
@@ -1,20 +1,16 @@
|
|
|
1
|
-
import { c as Color,
|
|
1
|
+
import { c as Color, i as AnsiColorName, o as AnyStyle, p as ThemeKey, s as BrightAnsiColorName, t as Theme } from "./types-D2EYlzmK.mjs";
|
|
2
2
|
//#region src/style/builder.d.ts
|
|
3
3
|
type AttrName = "bold" | "dim" | "italic" | "underline" | "inverse" | "strikethrough";
|
|
4
|
-
type
|
|
5
|
-
type
|
|
6
|
-
type FgChainKey = AnsiColorName | BrightAnsiColorName | ChainSlot;
|
|
7
|
-
type BgChainKey = `bg${Capitalize<FgChainKey>}`;
|
|
8
|
-
type FgExtractKey = `fg${Capitalize<FgChainKey>}`;
|
|
9
|
-
type StyleBuilder = {
|
|
4
|
+
type ChainSlot<Ansi extends boolean = true> = Exclude<ThemeKey, "fg" | "bg" | AttrName> | (Ansi extends true ? AnsiColorName : never) | (Ansi extends true ? BrightAnsiColorName : never);
|
|
5
|
+
type StyleBuilder<Ansi extends boolean = false> = {
|
|
10
6
|
theme: Theme;
|
|
11
7
|
(text: string): string;
|
|
12
|
-
fg: (color: Color) => StyleBuilder
|
|
13
|
-
bg: (color: Color) => StyleBuilder
|
|
14
|
-
add: (slot?:
|
|
15
|
-
lighten: (n: number) => StyleBuilder
|
|
16
|
-
darken: (n: number) => StyleBuilder
|
|
17
|
-
} & { readonly [K in AttrName |
|
|
8
|
+
fg: (color: Color<Ansi>) => StyleBuilder<Ansi>;
|
|
9
|
+
bg: (color: Color<Ansi>) => StyleBuilder<Ansi>;
|
|
10
|
+
add: (slot?: ThemeKey | AnyStyle) => StyleBuilder<Ansi>;
|
|
11
|
+
lighten: (n: number) => StyleBuilder<Ansi>;
|
|
12
|
+
darken: (n: number) => StyleBuilder<Ansi>;
|
|
13
|
+
} & { readonly [K in AttrName | ChainSlot<Ansi> | `bg${Capitalize<ChainSlot<Ansi>>}` | `fg${Capitalize<ChainSlot<Ansi>>}`]: StyleBuilder<Ansi>; };
|
|
18
14
|
/**
|
|
19
15
|
* Build styled strings via chainable property access.
|
|
20
16
|
*
|
|
@@ -37,7 +33,7 @@ type StyleBuilder = {
|
|
|
37
33
|
*
|
|
38
34
|
* Calling an empty builder is a no-op: `styleBuilder()("x")` returns `"x"` unchanged.
|
|
39
35
|
*/
|
|
40
|
-
declare function styleBuilder(theme?: Theme | false): StyleBuilder
|
|
36
|
+
declare function styleBuilder<Ansi extends boolean = false>(theme?: Theme | false): StyleBuilder<Ansi>;
|
|
41
37
|
//#endregion
|
|
42
38
|
//#region src/style/inspect.d.ts
|
|
43
39
|
interface InspectOpts {
|
|
@@ -64,4 +60,4 @@ declare function inspectFormat(msg: unknown[], opts?: InspectOpts): string;
|
|
|
64
60
|
declare function inspect(value: unknown, opts?: InspectOpts): string;
|
|
65
61
|
//#endregion
|
|
66
62
|
export { StyleBuilder as a, isMarkdown as i, inspect as n, styleBuilder as o, inspectFormat as r, InspectOpts as t };
|
|
67
|
-
//# sourceMappingURL=inspect-
|
|
63
|
+
//# sourceMappingURL=inspect-CfNydMgO.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inspect-CfNydMgO.d.mts","names":[],"sources":["../src/style/builder.ts","../src/style/inspect.ts"],"mappings":";;KAcK;KAKA,UAAU,+BACX,QAAQ,wBAAwB,aAC/B,oBAAoB,0BACpB,oBAAoB;KAEb,aAAa;EACvB,OAAO;GACN;EACD,KAAK,OAAO,MAAM,UAAU,aAAa;EACzC,KAAK,OAAO,MAAM,UAAU,aAAa;EACzC,MAAM,OAAO,WAAW,aAAa,aAAa;EAClD,UAAU,cAAc,aAAa;EACrC,SAAS,cAAc,aAAa;gBAIlC,KACI,WACA,UAAU,aACL,WAAW,UAAU,gBACrB,WAAW,UAAU,WAC7B,aAAa;;;;;;;;;;;;;;;;;;;;;;;iBAyBF,aAAa,8BAC3B,QAAO,gBACN,aAAa;;;UC5DC;EACf,QAAQ;EACR;EACA;EACA;;;EAGA;EACA;;;;;iBAac,WAAW;;;;;;;iBAaX,cAAc,gBAAgB,OAAM;iBA8BpC,QAAQ,gBAAgB,OAAM"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as styleBuilder } from "./builder-
|
|
1
|
+
import { t as styleBuilder } from "./builder-1z5ewEWK.mjs";
|
|
2
2
|
import { hasAnsi } from "@zaly/shared/ansi";
|
|
3
3
|
import { hasColors } from "@zaly/shared/env";
|
|
4
4
|
import { formatWithOptions, inspect } from "node:util";
|
|
@@ -98,4 +98,4 @@ function inspect$1(value, opts = {}) {
|
|
|
98
98
|
//#endregion
|
|
99
99
|
export { inspectFormat as n, isMarkdown as r, inspect$1 as t };
|
|
100
100
|
|
|
101
|
-
//# sourceMappingURL=inspect-
|
|
101
|
+
//# sourceMappingURL=inspect-jG_W4njH.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inspect-
|
|
1
|
+
{"version":3,"file":"inspect-jG_W4njH.mjs","names":["inspect","nodeInspect"],"sources":["../src/style/inspect.ts"],"sourcesContent":["import type { StyleBuilder } from \"./builder.ts\"\n\nimport { hasAnsi } from \"@zaly/shared/ansi\"\nimport { hasColors } from \"@zaly/shared/env\"\nimport { formatWithOptions, inspect as nodeInspect } from \"node:util\"\nimport { styleBuilder } from \"./builder.ts\"\n\nexport interface InspectOpts {\n style?: StyleBuilder\n indent?: number\n undefined?: boolean\n null?: boolean\n /** When `true`, preserve Error stack traces. Default: `false` — Error\n * values are reduced to their `.message` so logs stay compact. */\n stacktrace?: boolean\n colors?: boolean\n}\n\n// Markdown-ish characters. Matches rekal's skip regex.\nconst MD_RE = /[`*_#[\\]\\->~|]/\nconst JSON_RE = /^\\s*[{[]/\n\n// `util.format` placeholder tokens (`%s`, `%d`, …).\nconst FORMAT_RE = /%[sdifjoOc%]/\n\n/** True when `s` looks like markdown we should render — contains MD\n * markers and isn't already ANSI-styled. Mirrors rekal's `Formatter.markdown`\n * skip test so we avoid double-rendering pre-styled strings. */\nexport function isMarkdown(s: string): boolean {\n return MD_RE.test(s) && !hasAnsi(s) && !JSON_RE.test(s)\n}\n\nconst isFormatString = (v: unknown): v is string =>\n typeof v === \"string\" && FORMAT_RE.test(v) && !hasAnsi(v)\n\n/**\n * Inspect a list of args the way `console.log` does, returning a single\n * string. Collapses `util.format` placeholders right-to-left, unwraps\n * `Error` values to their message (unless `stacktrace: true`), and falls\n * back to `util.formatWithOptions` for mixed values.\n */\nexport function inspectFormat(msg: unknown[], opts: InspectOpts = {}): string {\n const data = opts.stacktrace ? msg : msg.map((v) => (v instanceof Error ? v.message : v))\n opts = { colors: hasColors, ...opts }\n\n let ret: unknown[] = []\n // oxlint-disable-next-line oxc/no-accumulating-spread\n for (let i = data.length - 1; i >= 0; i--) {\n const item = data[i]\n if (isFormatString(item)) ret = [formatWithOptions(opts, item, ...ret)]\n else ret.unshift(item)\n }\n\n if (ret.length > 1 && isFormatString(ret[0])) return formatWithOptions(opts, ...ret)\n return ret.map((v) => (typeof v === \"string\" ? v : inspect(v, opts))).join(\" \")\n}\n\nfunction inspectNumber(value: number): string {\n return new Intl.NumberFormat(\"en-US\", {\n notation: \"standard\",\n useGrouping: true,\n })\n .format(value)\n .replace(/,/g, \"_\")\n}\n\nfunction inspectField(key: string, s: StyleBuilder): string {\n if (/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(key)) return s.syntaxField(key)\n return s.syntaxString(JSON.stringify(key))\n}\n\nexport function inspect(value: unknown, opts: InspectOpts = {}): string {\n opts = { colors: hasColors, null: true, undefined: true, ...opts }\n const indent = opts.indent ?? 2\n const s = opts.colors ? (opts.style ?? styleBuilder()) : styleBuilder(false)\n const sym = {\n \",\": s.syntaxDelimiter(\",\"),\n \":\": s.syntaxDelimiter(\":\"),\n \"[\": s.syntaxBracket(\"[\"),\n \"]\": s.syntaxBracket(\"]\"),\n \"{\": s.syntaxBracket(\"{\"),\n \"}\": s.syntaxBracket(\"}\"),\n }\n const seen = new Set()\n\n const $inspect = (v: unknown, depth: number): string => {\n if (seen.has(v)) return s.bold(\"[Circular]\")\n if (typeof v === \"object\" && v !== null) seen.add(v)\n if (v === null) return s.syntaxConstant(\"null\")\n switch (typeof v) {\n case \"boolean\": {\n return s.syntaxBoolean(String(v))\n }\n case \"bigint\": {\n return s.syntaxNumber(`${v}n`)\n }\n case \"number\": {\n return s.syntaxNumber(inspectNumber(v))\n }\n case \"string\": {\n return s.syntaxString(JSON.stringify(v))\n }\n case \"symbol\": {\n return s.syntaxSpecial(String(v))\n }\n case \"function\": {\n return s.syntaxFunction(`[Function${v.name ? `: ${v.name}` : \"\"}]`)\n }\n case \"undefined\": {\n return s.syntaxConstant(\"undefined\")\n }\n case \"object\": {\n if (Array.isArray(v)) {\n const items = v.map((item) => $inspect(item, depth + 1))\n return `${sym[\"[\"]} ${items.join(`${sym[\",\"]} `)} ${sym[\"]\"]}`\n }\n const isPlainObject = Object.getPrototypeOf(v) === Object.prototype\n if (!isPlainObject) break\n const entries = Object.entries(v)\n .filter(\n ([, val]) => !((val === undefined && !opts.undefined) || (val === null && !opts.null))\n )\n .map(([key, val]) => `${inspectField(key, s)}: ${$inspect(val, depth + 1)}`)\n if (indent) {\n const padding = \" \".repeat(indent * depth)\n return `${sym[\"{\"]}\\n${padding}${entries.join(`${sym[\",\"]}\\n${padding}`)}\\n${\" \".repeat(indent * (depth - 1))}${sym[\"}\"]}`\n }\n return `${sym[\"{\"]} ${entries.join(`${sym[\",\"]} `)} ${sym[\"}\"]}`\n }\n }\n return nodeInspect(v, { colors: true, compact: true })\n }\n return $inspect(value, 1)\n}\n"],"mappings":";;;;;AAmBA,MAAM,QAAQ;AACd,MAAM,UAAU;AAGhB,MAAM,YAAY;;;;AAKlB,SAAgB,WAAW,GAAo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AAU,OAAO,QAAQ,CAAC,CAAC,CAC9B,QACE,GAAG,SAAS,EAAG,QAAQ,KAAA,KAAa,CAAC,KAAK,aAAe,QAAQ,QAAQ,CAAC,KAAK,KAClF,CAAC,CACA,KAAK,CAAC,KAAK,SAAS,GAAG,aAAa,KAAK,CAAC,EAAE,IAAI,SAAS,KAAK,QAAQ,CAAC,GAAG;IAC7E,IAAI,QAAQ;KACV,MAAM,UAAU,IAAI,OAAO,SAAS,KAAK;KACzC,OAAO,GAAG,IAAI,KAAK,IAAI,UAAU,QAAQ,KAAK,GAAG,IAAI,KAAK,IAAI,SAAS,EAAE,IAAI,IAAI,OAAO,UAAU,QAAQ,EAAE,IAAI,IAAI;IACtH;IACA,OAAO,GAAG,IAAI,KAAK,GAAG,QAAQ,KAAK,GAAG,IAAI,KAAK,EAAE,EAAE,GAAG,IAAI;GAC5D;EACF;EACA,OAAOC,QAAY,GAAG;GAAE,QAAQ;GAAM,SAAS;EAAK,CAAC;CACvD;CACA,OAAO,SAAS,OAAO,CAAC;AAC1B"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { n as box } from "./box-
|
|
2
|
-
import { n as text } from "./text-
|
|
3
|
-
import { n as markdown } from "./markdown-
|
|
1
|
+
import { n as box } from "./box-BkP4MF82.mjs";
|
|
2
|
+
import { n as text } from "./text-XvPfweeg.mjs";
|
|
3
|
+
import { n as markdown } from "./markdown-CwRmWuU6.mjs";
|
|
4
4
|
import { t as widget } from "./widget-BkMwhY2p.mjs";
|
|
5
5
|
import { stringWidth } from "@zaly/shared/ansi";
|
|
6
6
|
import { hasColors } from "@zaly/shared/env";
|
|
@@ -74,7 +74,7 @@ function renderPrefix(s, ctx) {
|
|
|
74
74
|
icon = icon === "" ? "" : `${icon}${" ".repeat(2 - stringWidth(icon))}`;
|
|
75
75
|
const color = s.color ?? base.color ?? "inherit";
|
|
76
76
|
let styledPrefix = "";
|
|
77
|
-
if (ls === "badge") styledPrefix = style.bg(color).
|
|
77
|
+
if (ls === "badge") styledPrefix = style.bg(color).bold(` ${s.level} `);
|
|
78
78
|
else if (ls === "icon") styledPrefix = style.fg(color)(icon);
|
|
79
79
|
else if (ls === "prompt") styledPrefix = style.fg(color).bold(`${icon} ${s.level}`);
|
|
80
80
|
else if (ls === "title") styledPrefix = style.fg(color).bold(`${s.level}:`);
|
|
@@ -127,4 +127,4 @@ const log = widget((state, ...children) => {
|
|
|
127
127
|
//#endregion
|
|
128
128
|
export { log as t };
|
|
129
129
|
|
|
130
|
-
//# sourceMappingURL=log-
|
|
130
|
+
//# sourceMappingURL=log-ByKlM4iI.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"log-ByKlM4iI.mjs","names":[],"sources":["../src/widgets/log.ts"],"sourcesContent":["import type { LogLevel } from \"@zaly/shared/logger\"\nimport type { RenderCtx } from \"../core/ctx.ts\"\nimport type { Node } from \"../core/node.ts\"\nimport type { State } from \"../core/state.ts\"\nimport type { Color } from \"../style/types.ts\"\nimport type { TextContent } from \"./text.ts\"\n\nimport { stringWidth } from \"@zaly/shared/ansi\"\nimport { hasColors } from \"@zaly/shared/env\"\nimport { box } from \"./box.ts\"\nimport { markdown } from \"./markdown.ts\"\nimport { text } from \"./text.ts\"\nimport { widget } from \"./widget.ts\"\n\nexport type LogStyle = \"badge\" | \"icon\" | \"prompt\" | \"title\" | \"text\" | \"notif\"\n\nexport interface LogState {\n level: LogLevel\n content: TextContent\n title?: string\n /** Rendering of the per-level prefix chunk. Defaults by level. */\n style?: LogStyle\n /** Single-glyph icon for `icon` / `prompt` styles. */\n icon?: string\n /** Theme slot or color name used to tint the prefix. */\n color?: Color<false>\n /** Extra plain text prepended to the auto prefix (unstyled). */\n prefix?: string\n /** Theme slot or color name for the body text. Defaults by level, except */\n textColor?: Color<false>\n markdown?: boolean\n}\n\ninterface LevelDefaults {\n style: LogStyle\n icon?: string\n color?: Color<false>\n textColor?: Color<false>\n}\n\n/** Per-level default prefix style + icon + color. Matches rekal's\n * `defaultStyles` table, adapted to zaly's theme slots. */\nconst defaultLogStyles: Record<LogLevel, LevelDefaults> = {\n cancel: { color: \"warn\", icon: \"✖ \", style: \"icon\" },\n debug: { color: \"info\", icon: \"⚙ \", style: \"prompt\" },\n error: { color: \"error\", icon: \"✖ \", style: \"badge\", textColor: \"error\" },\n fatal: { color: \"error\", icon: \"☢ \", style: \"badge\" },\n info: { color: \"info\", icon: \"ℹ \", style: \"icon\" },\n log: { color: \"muted\", icon: \"●\", style: \"icon\" },\n success: { color: \"success\", icon: \"✔ \", style: \"icon\" },\n trace: { color: \"muted\", icon: \"⠿\", style: \"icon\", textColor: \"muted\" },\n warn: { color: \"warn\", icon: \"⚠\", style: \"badge\", textColor: \"warn\" },\n}\n\nconst noColorStyles: Record<LogStyle, LogStyle> = {\n badge: \"title\",\n icon: \"text\",\n notif: \"text\",\n prompt: \"text\",\n text: \"text\",\n title: \"text\",\n}\n\nfunction renderPrefix(s: LogState, ctx: RenderCtx): string {\n const style = ctx.style\n\n const base = defaultLogStyles[s.level]\n let ls: LogStyle = s.style ?? base.style\n if (!hasColors) ls = noColorStyles[ls]\n\n let icon = s.icon ?? base.icon ?? \"\"\n icon = icon === \"\" ? \"\" : `${icon}${\" \".repeat(2 - stringWidth(icon))}`\n const color: Color<false> = s.color ?? base.color ?? \"inherit\"\n\n // text doesn't get a prefix\n let styledPrefix = \"\"\n if (ls === \"badge\") {\n styledPrefix = style.bg(color).bold(` ${s.level} `)\n } else if (ls === \"icon\") {\n styledPrefix = style.fg(color)(icon)\n } else if (ls === \"prompt\") {\n styledPrefix = style.fg(color).bold(`${icon} ${s.level}`)\n } else if (ls === \"title\") {\n styledPrefix = style.fg(color).bold(`${s.level}:`)\n } else if (ls === \"notif\") {\n styledPrefix = style.fg(color).bold(`${icon} ${s.title ?? s.level}`)\n }\n\n if (s.prefix) styledPrefix = s.prefix + styledPrefix\n if (s.title && ls !== \"notif\") styledPrefix += style.bold(` ${s.title}`)\n return styledPrefix\n}\n\n/**\n * A single log entry — level-styled prefix (icon / badge / prompt / title /\n * plain text) followed by the body content. The body can be any Node, so\n * callers can stack markdown, code, images, etc. inside a log line.\n *\n * ```ts\n * log({ level: \"info\", content: \"hello\" })\n * log({ level: \"error\", content: markdown(\"**boom**\") })\n * ```\n */\nexport const log = widget((state: State<LogState>, ...children: Node[]) => {\n const base = defaultLogStyles[state.level]\n const color: Color = state.color ?? base.color ?? \"inherit\"\n const s = state\n const textColor = state.textColor ?? (s.style === \"notif\" ? \"inherit\" : base.textColor)\n const style = {\n style: textColor\n ? {\n fg: textColor,\n }\n : undefined,\n width: \"fill\",\n } as const\n if (state.content !== \"\") {\n children = [\n (state.markdown ?? true) ? markdown(state.content, style) : text(state.content, style),\n ...children,\n ]\n }\n return box(\n {\n ...(s.style === \"notif\"\n ? {\n border: \"single\",\n borderStyle: { fg: color },\n borderTitle: (ctx) => renderPrefix(state, ctx),\n borderTitleAlign: \"center\",\n padding: [0, 1],\n //style: \"overlay\",\n width: \"fill\",\n }\n : undefined),\n flexDirection: \"row\",\n gap: 1,\n visible: state.visible,\n },\n s.style === \"notif\"\n ? undefined\n : text((ctx) => renderPrefix(state, ctx), { flexShrink: 0, wrap: \"none\" }),\n box({ flexDirection: \"column\", flexGrow: 1, gap: 1 }, ...children)\n )\n})\n"],"mappings":";;;;;;;;;AA0CA,MAAM,mBAAoD;CACxD,QAAQ;EAAE,OAAO;EAAQ,MAAM;EAAM,OAAO;CAAO;CACnD,OAAO;EAAE,OAAO;EAAQ,MAAM;EAAM,OAAO;CAAS;CACpD,OAAO;EAAE,OAAO;EAAS,MAAM;EAAM,OAAO;EAAS,WAAW;CAAQ;CACxE,OAAO;EAAE,OAAO;EAAS,MAAM;EAAM,OAAO;CAAQ;CACpD,MAAM;EAAE,OAAO;EAAQ,MAAM;EAAM,OAAO;CAAO;CACjD,KAAK;EAAE,OAAO;EAAS,MAAM;EAAK,OAAO;CAAO;CAChD,SAAS;EAAE,OAAO;EAAW,MAAM;EAAM,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G,aAAqB;CACzE,MAAM,OAAO,iBAAiB,MAAM;CACpC,MAAM,QAAe,MAAM,SAAS,KAAK,SAAS;CAClD,MAAM,IAAI;CACV,MAAM,YAAY,MAAM,cAAc,EAAE,UAAU,UAAU,YAAY,KAAK;CAC7E,MAAM,QAAQ;EACZ,OAAO,YACH,EACE,IAAI,UACN,IACA,KAAA;EACJ,OAAO;CACT;CACA,IAAI,MAAM,YAAY,IACpB,WAAW,CACR,MAAM,YAAY,OAAQ,SAAS,MAAM,SAAS,KAAK,IAAI,KAAK,MAAM,SAAS,KAAK,GACrF,GAAG,QACL;CAEF,OAAO,IACL;EACE,GAAI,EAAE,UAAU,UACZ;GACE,QAAQ;GACR,aAAa,EAAE,IAAI,MAAM;GACzB,cAAc,QAAQ,aAAa,OAAO,GAAG;GAC7C,kBAAkB;GAClB,SAAS,CAAC,GAAG,CAAC;GAEd,OAAO;EACT,IACA,KAAA;EACJ,eAAe;EACf,KAAK;EACL,SAAS,MAAM;CACjB,GACA,EAAE,UAAU,UACR,KAAA,IACA,MAAM,QAAQ,aAAa,OAAO,GAAG,GAAG;EAAE,YAAY;EAAG,MAAM;CAAO,CAAC,GAC3E,IAAI;EAAE,eAAe;EAAU,UAAU;EAAG,KAAK;CAAE,GAAG,GAAG,QAAQ,CACnE;AACF,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as Node } from "./node-BZ7f6HzU.mjs";
|
|
2
|
-
import { n as inspectFormat, r as isMarkdown } from "./inspect-
|
|
3
|
-
import { t as log } from "./log-
|
|
2
|
+
import { n as inspectFormat, r as isMarkdown } from "./inspect-jG_W4njH.mjs";
|
|
3
|
+
import { t as log } from "./log-ByKlM4iI.mjs";
|
|
4
4
|
//#region src/services/logger.ts
|
|
5
5
|
const ERR_LEVELS = /* @__PURE__ */ new Set([
|
|
6
6
|
"error",
|
|
@@ -68,4 +68,4 @@ var TuiReporter = class {
|
|
|
68
68
|
//#endregion
|
|
69
69
|
export { TuiReporter as t };
|
|
70
70
|
|
|
71
|
-
//# sourceMappingURL=logger-
|
|
71
|
+
//# sourceMappingURL=logger-DSQb0sLP.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger-
|
|
1
|
+
{"version":3,"file":"logger-DSQb0sLP.mjs","names":[],"sources":["../src/services/logger.ts"],"sourcesContent":["import type { LogEntry, LogLevel, LogReporter } from \"@zaly/shared/logger\"\nimport type { InspectOpts } from \"../style/inspect.ts\"\nimport type { LogState } from \"../widgets/log.ts\"\n\nimport { Node } from \"../core/node.ts\"\nimport { inspectFormat, isMarkdown } from \"../style/inspect.ts\"\nimport { log } from \"../widgets/log.ts\"\n\n/** Minimal stream surface the logger needs. Stream satisfies this. */\nexport interface LoggerStream {\n append: (node: () => Node) => unknown\n}\n\nexport type LogEntryFactory = (level: LogLevel, msg: unknown[]) => Node\n\nexport type LogStyleOverride = Omit<LogState, \"level\" | \"content\">\n\nexport interface TuiReporterOpts extends InspectOpts {\n /** Render string messages as markdown when they look like it.\n * Default: `true`. */\n markdown?: boolean\n /** Per-level overrides for the default `log()` widget style fields. */\n styles?: Partial<Record<LogLevel, LogStyleOverride>>\n /** Override the node produced per entry. Default uses `log()`. */\n factory?: LogEntryFactory\n wrap?: (node: Node) => Node\n /** Fallback writer for when no stream is attached. Defaults to\n * `process.stdout/stderr`. Injectable for tests. */\n write?: (text: string, kind: \"stdout\" | \"stderr\") => void\n}\n\nconst ERR_LEVELS = new Set<LogLevel>([\"error\", \"fatal\", \"warn\"])\n\nfunction defaultWrite(text: string, kind: \"stdout\" | \"stderr\"): void {\n if (typeof process === \"undefined\") return\n const stream = kind === \"stderr\" ? process.stderr : process.stdout\n stream.write(text)\n}\n\nexport class TuiReporter implements LogReporter {\n #stream?: LoggerStream\n #opts: TuiReporterOpts\n #factory: LogEntryFactory\n\n constructor(opts: TuiReporterOpts = {}) {\n this.#opts = opts\n this.#factory = opts.factory ?? ((level, msg) => this.#defaultFactory(level, msg))\n }\n\n attach(stream: LoggerStream): this {\n this.#stream = stream\n return this\n }\n\n detach(): this {\n this.#stream = undefined\n return this\n }\n\n $log({ level, msg }: LogEntry): void {\n if (this.#stream) {\n this.#stream.append(() => {\n const node = this.#factory(level, msg)\n return this.#opts.wrap?.(node) ?? node\n })\n return\n }\n this.#writeFallback(level, msg)\n }\n\n #defaultFactory(level: LogLevel, msg: unknown[]): Node {\n const nodes = msg.filter((m): m is Node => m instanceof Node)\n msg = msg.filter((m) => !(m instanceof Node))\n\n // Convert Error objects to their message unless stacktrace is requested.\n msg = this.#opts.stacktrace ? msg : msg.map((v) => (v instanceof Error ? v.message : v))\n\n // If all remaining messages are strings, join them into one string for the log content.\n if (msg.length && msg.every((m) => typeof m === \"string\")) msg = [msg.join(\" \")]\n\n // If there's exactly one string message, use it as the log content;\n // otherwise, leave it undefined to be formatted with `inspect()`.\n // Text allow markdown if the message looks like markdown and the option is enabled.\n let text = msg.length === 1 && typeof msg[0] === \"string\" ? msg[0] : undefined\n if (msg.length === 0) text = \"\"\n const markdown = (this.#opts.markdown ?? true) && text !== undefined && isMarkdown(text)\n const overrides = this.#opts.styles?.[level] ?? {}\n return log(\n {\n content: text ?? ((ctx) => inspectFormat(msg, { ...this.#opts, style: ctx.style })),\n level,\n markdown,\n ...overrides,\n },\n ...nodes\n )\n }\n\n /** String path for the no-stream fallback — builds a plain inspected\n * line (no prefix chrome) and writes it to stdout/stderr. Keeps the\n * fallback synchronous and ordered. */\n #writeFallback(level: LogLevel, msg: unknown[]): void {\n const str = inspectFormat(msg, this.#opts)\n const kind: \"stdout\" | \"stderr\" = ERR_LEVELS.has(level) ? \"stderr\" : \"stdout\"\n const write = this.#opts.write ?? defaultWrite\n write(`${str}\\n`, kind)\n }\n}\n"],"mappings":";;;;AA+BA,MAAM,6BAAa,IAAI,IAAc;CAAC;CAAS;CAAS;AAAM,CAAC;AAE/D,SAAS,aAAa,MAAc,MAAiC;CACnE,IAAI,OAAO,YAAY,aAAa;CAEpC,CADe,SAAS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EACL,GACA,GAAG,KACL;CACF;;;;CAKA,eAAe,OAAiB,KAAsB;EACpD,MAAM,MAAM,cAAc,KAAK,KAAK,KAAK;EACzC,MAAM,OAA4B,WAAW,IAAI,KAAK,IAAI,WAAW;EAErE,CADc,KAAK,MAAM,SAAS,aAAA,CAC5B,GAAG,IAAI,KAAK,IAAI;CACxB;AACF"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { S as unwrap, r as createAsync, w as useContext, y as signal } from "./reactive-f7NpAi69.mjs";
|
|
2
2
|
import { t as Node } from "./node-BZ7f6HzU.mjs";
|
|
3
|
-
import { i as expandTabs, o as formatText, t as calcLayout } from "./text-
|
|
4
|
-
import { r as textContent } from "./text-
|
|
5
|
-
import { t as RenderContext } from "./render-
|
|
3
|
+
import { i as expandTabs, o as formatText, t as calcLayout } from "./text-CkQ7Irmt.mjs";
|
|
4
|
+
import { r as textContent } from "./text-XvPfweeg.mjs";
|
|
5
|
+
import { t as RenderContext } from "./render-DEIUNLkh.mjs";
|
|
6
6
|
import { n as shikiWorker } from "./client-C2GXKfJ1.mjs";
|
|
7
7
|
import { t as codeToAnsi } from "./shiki--ASSYv4_.mjs";
|
|
8
8
|
import { hasColors } from "@zaly/shared/env";
|
|
@@ -73,7 +73,7 @@ var Markdown = class extends Node {
|
|
|
73
73
|
}
|
|
74
74
|
async _render(ctx) {
|
|
75
75
|
if (!this.#renderer) {
|
|
76
|
-
const { MarkdownRenderer } = await import("./renderer-
|
|
76
|
+
const { MarkdownRenderer } = await import("./renderer-DhqbEVVR.mjs");
|
|
77
77
|
this.#renderer = new MarkdownRenderer({
|
|
78
78
|
...this.state.options,
|
|
79
79
|
parent: this
|
|
@@ -121,4 +121,4 @@ function markdown(first, style) {
|
|
|
121
121
|
//#endregion
|
|
122
122
|
export { markdown as n, Markdown as t };
|
|
123
123
|
|
|
124
|
-
//# sourceMappingURL=markdown-
|
|
124
|
+
//# sourceMappingURL=markdown-CwRmWuU6.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markdown-
|
|
1
|
+
{"version":3,"file":"markdown-CwRmWuU6.mjs","names":[],"sources":["../src/widgets/markdown.ts"],"sourcesContent":["import type { RenderCtx } from \"../core/ctx.ts\"\nimport type { Accessor } from \"../core/reactive.ts\"\nimport type { State } from \"../core/state.ts\"\nimport type { WrapMode } from \"../layout/text.ts\"\nimport type { MarkdownRenderer } from \"../markdown/renderer.ts\"\nimport type { MdOptions } from \"../markdown/types.ts\"\nimport type { ShikiTheme } from \"../shiki/types.ts\"\nimport type { AnyStyle } from \"../style/types.ts\"\nimport type { Image } from \"./image.ts\"\nimport type { TextContent } from \"./text.ts\"\n\nimport { hasColors } from \"@zaly/shared/env\"\nimport { Node } from \"../core/node.ts\"\nimport { createAsync, signal, unwrap, useContext } from \"../core/reactive.ts\"\nimport { RenderContext } from \"../core/render.ts\"\nimport { calcLayout, expandTabs, formatText } from \"../layout/text.ts\"\nimport { shikiWorker } from \"../shiki/client.ts\"\nimport { codeToAnsi } from \"../shiki/shiki.ts\"\nimport { textContent } from \"./text.ts\"\n\nexport interface MarkdownState {\n /** Markdown source. Accepts a plain string or a reactive accessor —\n * pass `signal()` / `memo()` for streaming content that re-parses on\n * each render and subscribes the node to the signal. */\n content: TextContent\n /** Options forwarded to `renderMarkdown`. */\n options?: MdOptions\n /**\n * Enable shiki-backed syntax highlighting for fenced code blocks. Defaults\n * to `true` — code blocks get per-token colors from the shiki theme, with\n * `mdCodeBlock`'s bg applied as a backdrop. Unknown languages fall through\n * as plain text.\n */\n syntax?: boolean\n wrap?: WrapMode\n style?: AnyStyle\n}\n\ntype ShikiCode = {\n key: string\n code: string\n lang: string\n theme?: ShikiTheme\n inflight?: Promise<string>\n ac?: AbortController\n result?: string\n gen: number\n}\n\nexport class Markdown extends Node<MarkdownState> {\n // Image nodes cached per-src per-Markdown-instance. Re-rendering the\n // same markdown (streaming updates) reuses the same `Image` — same\n // `placementId`, which the KGP spec guarantees is a flicker-free\n // move/resize of the existing placement.\n readonly images = new Map<string, Image>()\n\n #renderer?: MarkdownRenderer\n #code = new Map<string, ShikiCode>()\n #update = signal(0)\n #gen = 0\n #worker: Accessor<number>\n #images?: Accessor<boolean>\n\n constructor(state: State<MarkdownState>) {\n super(state)\n\n const context = useContext(RenderContext)\n this.#images = context?.images\n\n this.#worker = createAsync(\n async () => {\n const update = this.#update.get() // track\n const todo = [...this.#code.values()].filter((c) => c.gen === this.#gen && !c.result)\n if (!todo.length) return update // nothing to do, skip\n await Promise.all(\n todo.map(async (req) => {\n req.ac ??= new AbortController()\n req.inflight ??= codeToAnsi(req.code, req.lang, {\n signal: req.ac.signal,\n theme: req.theme,\n })\n try {\n req.result = await req.inflight\n } catch (error) {\n if (req.ac.signal.aborted) {\n if (this.#code.get(req.key) === req) this.#code.delete(req.key)\n } else throw error\n }\n })\n )\n return update + 1\n },\n { initialValue: 0 }\n )\n }\n\n /** Find a highlighted result for a prefix of `code` in the cache. This\n * handles streaming updates where the full code block isn't available yet\n * and prevents flashing un-highlighted text on each update. */\n #streamingHighlight(code: string, lang: string, theme?: ShikiTheme) {\n let ret: ShikiCode | undefined\n for (const c of this.#code.values()) {\n if (!c.result || c.lang !== lang || c.theme !== theme) continue\n if (code.startsWith(c.code) && c.code.length > (ret?.code.length ?? 0)) ret = c\n }\n if (ret) ret.gen = this.#gen // bump gen to keep it alive in cache\n return ret?.result ? ret.result + code.slice(ret.code.length) : code\n }\n\n #highlight(code: string, lang?: string, theme?: ShikiTheme): string {\n if (!lang) return code\n const key = shikiWorker.key({ code, lang, theme })\n const ret = this.#code.get(key)\n if (ret) ret.gen = this.#gen // bump gen to keep it alive in cache\n if (ret?.result) return ret.result\n else if (!ret) this.#code.set(key, { code, gen: this.#gen, key, lang, theme })\n return this.#streamingHighlight(code, lang, theme)\n }\n\n protected async _render(ctx: RenderCtx): Promise<string[]> {\n if (!this.#renderer) {\n const { MarkdownRenderer } = await import(\"../markdown/renderer.ts\")\n this.#renderer = new MarkdownRenderer({ ...this.state.options, parent: this })\n }\n let source = await textContent(this.state.content, ctx)\n source = expandTabs(source)\n let formatted: string\n\n if (!hasColors) formatted = this.#renderer.normalizeEol(source, source)\n else {\n this.#gen++ // bump generation to track what is still used\n\n formatted = await this.#renderer.render(source, {\n ...ctx,\n highlight: (code, lang) => this.#highlight(code, lang, ctx.style.theme.shiki),\n images: unwrap(this.#images) ?? true,\n })\n\n // prune old entries\n for (const [k, c] of this.#code.entries())\n if (c.gen !== this.#gen) {\n c.ac?.abort()\n if (c.result !== undefined) this.#code.delete(k)\n }\n\n // Trigger the worker if needed\n if (this.#code.values().some((c) => !c.inflight)) {\n this.#update.set(this.#gen) // trigger worker\n this.#worker() // tracked\n }\n }\n\n return formatText(formatted, {\n indent: true,\n style: this.state.style ? ctx.style.add(this.state.style) : undefined,\n width: ctx.width,\n wrap: this.state.wrap,\n wrapBg: true,\n })\n }\n\n override async layout(ctx: RenderCtx) {\n return calcLayout(await textContent(this.state.content, ctx))\n }\n}\n\n/**\n * Render a markdown string as a TUI node. Produces ANSI-styled text that\n * resolves per-element styling through theme slots (`mdHeading1`, `mdCode`,\n * `mdLink`, …). Links become clickable in terminals that support OSC 8.\n *\n * ```ts\n * markdown(\"# Hello\\n\\nThis is **bold** and *italic*.\")\n * markdown({ content, wrap: \"word\", fg: \"fg\" })\n * ```\n */\nexport function markdown(\n content: TextContent,\n style?: Omit<State<MarkdownState>, \"content\">\n): Markdown\nexport function markdown(state: State<MarkdownState>): Markdown\nexport function markdown(\n first: TextContent | MarkdownState,\n style?: Omit<State<MarkdownState>, \"content\">\n): Markdown {\n // Plain strings and accessor functions go through the content path;\n // a non-function object is the full state form.\n if (typeof first === \"string\" || typeof first === \"function\") {\n return new Markdown({ content: first, ...style })\n }\n return new Markdown(first)\n}\n"],"mappings":";;;;;;;;;AAiDA,IAAa,WAAb,cAA8B,KAAoB;CAKhD,yBAAkB,IAAI,IAAmB;CAEzC;CACA,wBAAQ,IAAI,IAAuB;CACnC,UAA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3B,QAAQ;GACR,OAAO,KAAK,MAAM,QAAQ,IAAI,MAAM,IAAI,KAAK,MAAM,KAAK,IAAI,KAAA;GAC5D,OAAO,IAAI;GACX,MAAM,KAAK,MAAM;GACjB,QAAQ;EACV,CAAC;CACH;CAEA,MAAe,OAAO,KAAgB;EACpC,OAAO,WAAW,MAAM,YAAY,KAAK,MAAM,SAAS,GAAG,CAAC;CAC9D;AACF;AAiBA,SAAgB,SACd,OACA,OACU;CAGV,IAAI,OAAO,UAAU,YAAY,OAAO,UAAU,YAChD,OAAO,IAAI,SAAS;EAAE,SAAS;EAAO,GAAG;CAAM,CAAC;CAElD,OAAO,IAAI,SAAS,KAAK;AAC3B"}
|
package/dist/markdown.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { P as RenderCtx, p as Node } from "./queries-
|
|
1
|
+
import { P as RenderCtx, p as Node } from "./queries-BDX8mcl5.mjs";
|
|
2
2
|
import { n as MdOptions, r as RenderMarkdown } from "./types-D3jk1rtk.mjs";
|
|
3
3
|
//#region src/markdown/renderer.d.ts
|
|
4
4
|
export type MarkdownOptions = MdOptions & {
|
package/dist/markdown.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as MarkdownRenderer } from "./renderer-
|
|
1
|
+
export { t as MarkdownRenderer } from "./renderer-MQue4Da5.mjs";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as box } from "./box-
|
|
1
|
+
import { n as box } from "./box-BkP4MF82.mjs";
|
|
2
2
|
//#region src/widgets/overlay.ts
|
|
3
3
|
function overlay(state, ...children) {
|
|
4
4
|
const node = box({
|
|
@@ -15,4 +15,4 @@ function overlay(state, ...children) {
|
|
|
15
15
|
//#endregion
|
|
16
16
|
export { overlay as t };
|
|
17
17
|
|
|
18
|
-
//# sourceMappingURL=overlay-
|
|
18
|
+
//# sourceMappingURL=overlay-BnvOKtGT.mjs.map
|