zard-cli 1.0.0-beta.98 → 1.0.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/README.md +92 -36
- package/commands/add/component-installer.d.ts +3 -0
- package/commands/add/component-installer.d.ts.map +1 -1
- package/commands/add/component-installer.js +10 -4
- package/commands/add/component-installer.js.map +1 -1
- package/commands/add/component-selector.d.ts +6 -0
- package/commands/add/component-selector.d.ts.map +1 -1
- package/commands/add/component-selector.js +9 -27
- package/commands/add/component-selector.js.map +1 -1
- package/commands/add/dark-mode-setup.d.ts.map +1 -1
- package/commands/add/dark-mode-setup.js +2 -11
- package/commands/add/dark-mode-setup.js.map +1 -1
- package/commands/add/dependency-resolver.d.ts +8 -1
- package/commands/add/dependency-resolver.d.ts.map +1 -1
- package/commands/add/dependency-resolver.js +87 -16
- package/commands/add/dependency-resolver.js.map +1 -1
- package/commands/add/index.d.ts.map +1 -1
- package/commands/add/index.js +128 -96
- package/commands/add/index.js.map +1 -1
- package/commands/add/stylesheet-setup.d.ts +3 -0
- package/commands/add/stylesheet-setup.d.ts.map +1 -0
- package/commands/add/stylesheet-setup.js +92 -0
- package/commands/add/stylesheet-setup.js.map +1 -0
- package/commands/add/wizard.d.ts +35 -0
- package/commands/add/wizard.d.ts.map +1 -0
- package/commands/add/wizard.js +299 -0
- package/commands/add/wizard.js.map +1 -0
- package/commands/init/config-prompter.d.ts +55 -3
- package/commands/init/config-prompter.d.ts.map +1 -1
- package/commands/init/config-prompter.js +92 -74
- package/commands/init/config-prompter.js.map +1 -1
- package/commands/init/dependencies.d.ts +1 -8
- package/commands/init/dependencies.d.ts.map +1 -1
- package/commands/init/dependencies.js +51 -25
- package/commands/init/dependencies.js.map +1 -1
- package/commands/init/index.d.ts.map +1 -1
- package/commands/init/index.js +147 -81
- package/commands/init/index.js.map +1 -1
- package/commands/init/project-kind.d.ts +82 -0
- package/commands/init/project-kind.d.ts.map +1 -0
- package/commands/init/project-kind.js +166 -0
- package/commands/init/project-kind.js.map +1 -0
- package/commands/init/steps.d.ts +15 -0
- package/commands/init/steps.d.ts.map +1 -0
- package/commands/init/steps.js +154 -0
- package/commands/init/steps.js.map +1 -0
- package/commands/init/tailwind-setup.d.ts +9 -2
- package/commands/init/tailwind-setup.d.ts.map +1 -1
- package/commands/init/tailwind-setup.js +33 -12
- package/commands/init/tailwind-setup.js.map +1 -1
- package/commands/init/tsconfig-updater.d.ts +8 -1
- package/commands/init/tsconfig-updater.d.ts.map +1 -1
- package/commands/init/tsconfig-updater.js +30 -11
- package/commands/init/tsconfig-updater.js.map +1 -1
- package/commands/init/update-angular-config.d.ts.map +1 -1
- package/commands/init/update-angular-config.js +28 -50
- package/commands/init/update-angular-config.js.map +1 -1
- package/commands/init/vite-setup.d.ts +11 -0
- package/commands/init/vite-setup.d.ts.map +1 -0
- package/commands/init/vite-setup.js +61 -0
- package/commands/init/vite-setup.js.map +1 -0
- package/commands/init/wizard.d.ts +30 -0
- package/commands/init/wizard.d.ts.map +1 -0
- package/commands/init/wizard.js +560 -0
- package/commands/init/wizard.js.map +1 -0
- package/constants/app.constants.d.ts +17 -0
- package/constants/app.constants.d.ts.map +1 -1
- package/constants/app.constants.js +39 -16
- package/constants/app.constants.js.map +1 -1
- package/core/icons/families.d.ts +38 -0
- package/core/icons/families.d.ts.map +1 -0
- package/core/icons/families.js +26 -0
- package/core/icons/families.js.map +1 -0
- package/core/icons/icon-map.d.ts +24 -0
- package/core/icons/icon-map.d.ts.map +1 -0
- package/core/icons/icon-map.js +141 -0
- package/core/icons/icon-map.js.map +1 -0
- package/core/icons/index.d.ts +107 -0
- package/core/icons/index.d.ts.map +1 -0
- package/core/icons/index.js +183 -0
- package/core/icons/index.js.map +1 -0
- package/core/registry/registry-data.d.ts.map +1 -1
- package/core/registry/registry-data.js +482 -37
- package/core/registry/registry-data.js.map +1 -1
- package/core/themes/theme-definitions.d.ts.map +1 -1
- package/core/themes/theme-definitions.js +61 -72
- package/core/themes/theme-definitions.js.map +1 -1
- package/index.js +6 -3
- package/index.js.map +1 -1
- package/package.json +6 -11
- package/ui/blocks.d.ts +71 -0
- package/ui/blocks.d.ts.map +1 -0
- package/ui/blocks.js +116 -0
- package/ui/blocks.js.map +1 -0
- package/ui/brand.d.ts +14 -0
- package/ui/brand.d.ts.map +1 -0
- package/ui/brand.js +35 -0
- package/ui/brand.js.map +1 -0
- package/ui/engine/animation/index.d.ts +38 -0
- package/ui/engine/animation/index.d.ts.map +1 -0
- package/ui/engine/animation/index.js +102 -0
- package/ui/engine/animation/index.js.map +1 -0
- package/ui/engine/ansi/index.d.ts +51 -0
- package/ui/engine/ansi/index.d.ts.map +1 -0
- package/ui/engine/ansi/index.js +116 -0
- package/ui/engine/ansi/index.js.map +1 -0
- package/ui/engine/components/index.d.ts +211 -0
- package/ui/engine/components/index.d.ts.map +1 -0
- package/ui/engine/components/index.js +109 -0
- package/ui/engine/components/index.js.map +1 -0
- package/ui/engine/cursor/index.d.ts +16 -0
- package/ui/engine/cursor/index.d.ts.map +1 -0
- package/ui/engine/cursor/index.js +40 -0
- package/ui/engine/cursor/index.js.map +1 -0
- package/ui/engine/diff/index.d.ts +26 -0
- package/ui/engine/diff/index.d.ts.map +1 -0
- package/ui/engine/diff/index.js +56 -0
- package/ui/engine/diff/index.js.map +1 -0
- package/ui/engine/events/index.d.ts +24 -0
- package/ui/engine/events/index.d.ts.map +1 -0
- package/ui/engine/events/index.js +60 -0
- package/ui/engine/events/index.js.map +1 -0
- package/ui/engine/focus/index.d.ts +25 -0
- package/ui/engine/focus/index.d.ts.map +1 -0
- package/ui/engine/focus/index.js +77 -0
- package/ui/engine/focus/index.js.map +1 -0
- package/ui/engine/frame/index.d.ts +48 -0
- package/ui/engine/frame/index.d.ts.map +1 -0
- package/ui/engine/frame/index.js +0 -0
- package/ui/engine/frame/index.js.map +1 -0
- package/ui/engine/index.d.ts +28 -0
- package/ui/engine/index.d.ts.map +1 -0
- package/ui/engine/index.js +28 -0
- package/ui/engine/index.js.map +1 -0
- package/ui/engine/input/index.d.ts +36 -0
- package/ui/engine/input/index.d.ts.map +1 -0
- package/ui/engine/input/index.js +224 -0
- package/ui/engine/input/index.js.map +1 -0
- package/ui/engine/layout/index.d.ts +42 -0
- package/ui/engine/layout/index.d.ts.map +1 -0
- package/ui/engine/layout/index.js +241 -0
- package/ui/engine/layout/index.js.map +1 -0
- package/ui/engine/renderer/index.d.ts +43 -0
- package/ui/engine/renderer/index.d.ts.map +1 -0
- package/ui/engine/renderer/index.js +619 -0
- package/ui/engine/renderer/index.js.map +1 -0
- package/ui/engine/scheduler/index.d.ts +22 -0
- package/ui/engine/scheduler/index.d.ts.map +1 -0
- package/ui/engine/scheduler/index.js +77 -0
- package/ui/engine/scheduler/index.js.map +1 -0
- package/ui/engine/screen/index.d.ts +39 -0
- package/ui/engine/screen/index.d.ts.map +1 -0
- package/ui/engine/screen/index.js +255 -0
- package/ui/engine/screen/index.js.map +1 -0
- package/ui/engine/terminal/index.d.ts +84 -0
- package/ui/engine/terminal/index.d.ts.map +1 -0
- package/ui/engine/terminal/index.js +235 -0
- package/ui/engine/terminal/index.js.map +1 -0
- package/ui/engine/testing/index.d.ts +27 -0
- package/ui/engine/testing/index.d.ts.map +1 -0
- package/ui/engine/testing/index.js +63 -0
- package/ui/engine/testing/index.js.map +1 -0
- package/ui/engine/theme/index.d.ts +26 -0
- package/ui/engine/theme/index.d.ts.map +1 -0
- package/ui/engine/theme/index.js +128 -0
- package/ui/engine/theme/index.js.map +1 -0
- package/ui/engine/utils/index.d.ts +12 -0
- package/ui/engine/utils/index.d.ts.map +1 -0
- package/ui/engine/utils/index.js +143 -0
- package/ui/engine/utils/index.js.map +1 -0
- package/ui/gate.d.ts +19 -0
- package/ui/gate.d.ts.map +1 -0
- package/ui/gate.js +36 -0
- package/ui/gate.js.map +1 -0
- package/ui/index.d.ts +18 -0
- package/ui/index.d.ts.map +1 -0
- package/ui/index.js +18 -0
- package/ui/index.js.map +1 -0
- package/ui/log-sink.d.ts +24 -0
- package/ui/log-sink.d.ts.map +1 -0
- package/ui/log-sink.js +35 -0
- package/ui/log-sink.js.map +1 -0
- package/ui/output.d.ts +14 -0
- package/ui/output.d.ts.map +1 -0
- package/ui/output.js +28 -0
- package/ui/output.js.map +1 -0
- package/ui/report.d.ts +30 -0
- package/ui/report.d.ts.map +1 -0
- package/ui/report.js +45 -0
- package/ui/report.js.map +1 -0
- package/ui/runner.d.ts +66 -0
- package/ui/runner.d.ts.map +1 -0
- package/ui/runner.js +135 -0
- package/ui/runner.js.map +1 -0
- package/ui/style.d.ts +24 -0
- package/ui/style.d.ts.map +1 -0
- package/ui/style.js +44 -0
- package/ui/style.js.map +1 -0
- package/ui/testing/fake-tty.d.ts +26 -0
- package/ui/testing/fake-tty.d.ts.map +1 -0
- package/ui/testing/fake-tty.js +61 -0
- package/ui/testing/fake-tty.js.map +1 -0
- package/ui/text-input.d.ts +31 -0
- package/ui/text-input.d.ts.map +1 -0
- package/ui/text-input.js +89 -0
- package/ui/text-input.js.map +1 -0
- package/ui/theme.d.ts +10 -0
- package/ui/theme.d.ts.map +1 -0
- package/ui/theme.js +20 -0
- package/ui/theme.js.map +1 -0
- package/utils/angular-compat.d.ts +21 -0
- package/utils/angular-compat.d.ts.map +1 -0
- package/utils/angular-compat.js +52 -0
- package/utils/angular-compat.js.map +1 -0
- package/utils/config.d.ts +29 -0
- package/utils/config.d.ts.map +1 -1
- package/utils/config.js +50 -4
- package/utils/config.js.map +1 -1
- package/utils/errors.d.ts +11 -0
- package/utils/errors.d.ts.map +1 -1
- package/utils/errors.js +14 -0
- package/utils/errors.js.map +1 -1
- package/utils/get-project-info.d.ts +29 -0
- package/utils/get-project-info.d.ts.map +1 -1
- package/utils/get-project-info.js +176 -1
- package/utils/get-project-info.js.map +1 -1
- package/utils/http-client.d.ts.map +1 -1
- package/utils/http-client.js +18 -3
- package/utils/http-client.js.map +1 -1
- package/utils/icon-catalog.d.ts +34 -0
- package/utils/icon-catalog.d.ts.map +1 -0
- package/utils/icon-catalog.js +63 -0
- package/utils/icon-catalog.js.map +1 -0
- package/utils/logger.d.ts +13 -1
- package/utils/logger.d.ts.map +1 -1
- package/utils/logger.js +95 -15
- package/utils/logger.js.map +1 -1
- package/utils/package-manager.d.ts +42 -1
- package/utils/package-manager.d.ts.map +1 -1
- package/utils/package-manager.js +204 -11
- package/utils/package-manager.js.map +1 -1
- package/utils/registry.d.ts +84 -2
- package/utils/registry.d.ts.map +1 -1
- package/utils/registry.js +121 -18
- package/utils/registry.js.map +1 -1
- package/utils/schema-version.d.ts +21 -0
- package/utils/schema-version.d.ts.map +1 -0
- package/utils/schema-version.js +28 -0
- package/utils/schema-version.js.map +1 -0
- package/utils/source-file.d.ts +40 -0
- package/utils/source-file.d.ts.map +1 -0
- package/utils/source-file.js +104 -0
- package/utils/source-file.js.map +1 -0
package/ui/blocks.js
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* View blocks shared by the wizards.
|
|
3
|
+
*
|
|
4
|
+
* `init` and `add` are different flows, but the user should recognise the same
|
|
5
|
+
* CLI in both: the transcript of answers, the shortcut bar in the footer and the
|
|
6
|
+
* result panels live here so they cannot diverge.
|
|
7
|
+
*/
|
|
8
|
+
import { column, panel, progressBar, row, spinner, text } from './engine/index.js';
|
|
9
|
+
/** The footer's shortcut bar: `↑/↓ navigate enter confirm`. */
|
|
10
|
+
export function controls(pairs) {
|
|
11
|
+
const segments = [];
|
|
12
|
+
pairs.forEach(([key, label], index) => {
|
|
13
|
+
segments.push(text(key, { color: 'foreground' }));
|
|
14
|
+
segments.push(text(` ${label}${index < pairs.length - 1 ? ' ' : ''}`, { color: 'muted' }));
|
|
15
|
+
});
|
|
16
|
+
return row({}, ...segments);
|
|
17
|
+
}
|
|
18
|
+
/** A transcript line: one question already answered. */
|
|
19
|
+
export function answeredLine(label, value) {
|
|
20
|
+
return row({ gap: 0 }, text('✔ ', { color: 'success' }), text(label, { color: 'muted' }), text(' … ', { color: 'muted', dim: true }), text(value, { color: 'foreground' }));
|
|
21
|
+
}
|
|
22
|
+
/** Enunciado do passo ativo. */
|
|
23
|
+
export function question(prompt) {
|
|
24
|
+
return row({ gap: 0 }, text('◆ ', { color: 'primary' }), text(prompt, { color: 'foreground', bold: true, wrap: true }));
|
|
25
|
+
}
|
|
26
|
+
/** Text field with a block cursor. */
|
|
27
|
+
/**
|
|
28
|
+
* Text field with the cursor where it actually is.
|
|
29
|
+
*
|
|
30
|
+
* Always drawing the cursor at the end hid the fact that it can move — and
|
|
31
|
+
* without seeing the position there is no editing the middle of a value with any
|
|
32
|
+
* confidence. The character under the cursor is inverted; at the end of the line
|
|
33
|
+
* that gives the same solid block as before.
|
|
34
|
+
*/
|
|
35
|
+
export function textField(value, caret = [...value].length) {
|
|
36
|
+
const chars = [...value];
|
|
37
|
+
const position = Math.max(0, Math.min(caret, chars.length));
|
|
38
|
+
return row({ gap: 0 }, text(' › ', { color: 'muted' }), text(chars.slice(0, position).join(''), { color: 'foreground' }), text(chars[position] ?? ' ', { color: 'foreground', inverse: true }), text(chars.slice(position + 1).join(''), { color: 'foreground' }));
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Single-choice list, with the active item marked by `❯`.
|
|
42
|
+
*
|
|
43
|
+
* A coloured item keeps its colour whether active or not: the colour is what
|
|
44
|
+
* identifies it. State stays legible through the marker and the weight — bold on
|
|
45
|
+
* the active one, dimmed on the rest.
|
|
46
|
+
*/
|
|
47
|
+
export function choiceList(choices, activeIndex) {
|
|
48
|
+
return choices.map((choice, index) => {
|
|
49
|
+
const active = index === activeIndex;
|
|
50
|
+
return row({ gap: 0 }, text(active ? ' ❯ ' : ' ', { color: 'primary', bold: active }), text(choice.label, {
|
|
51
|
+
color: choice.color ?? (active ? 'foreground' : 'muted'),
|
|
52
|
+
bold: active,
|
|
53
|
+
dim: !active,
|
|
54
|
+
}), ...(choice.hint ? [text(` ${choice.hint}`, { color: 'muted', dim: true })] : []));
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
/** Multiple-choice list, with a mark per item. */
|
|
58
|
+
export function checkList(choices, activeIndex, selected) {
|
|
59
|
+
return choices.map((choice, index) => {
|
|
60
|
+
const active = index === activeIndex;
|
|
61
|
+
const checked = selected.has(index);
|
|
62
|
+
return row({ gap: 0 }, text(active ? ' ❯ ' : ' ', { color: 'primary', bold: active }), text(checked ? '◼ ' : '◻ ', { color: checked ? 'success' : 'muted', dim: !checked }), text(choice.label, { color: active ? 'foreground' : checked ? 'foreground' : 'muted', bold: active }), ...(choice.hint ? [text(` ${choice.hint}`, { color: 'muted', dim: true })] : []));
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
/** Par Yes/No com o lado ativo destacado. */
|
|
66
|
+
export function confirmField(value) {
|
|
67
|
+
return row({ gap: 4 }, text(` ${value ? '❯ ' : ' '}Yes`, { color: value ? 'success' : 'muted', bold: value }), text(`${!value ? '❯ ' : ' '}No`, { color: !value ? 'danger' : 'muted', bold: !value }));
|
|
68
|
+
}
|
|
69
|
+
/** Explanation of the active step, in secondary text. */
|
|
70
|
+
export function hint(content) {
|
|
71
|
+
return text(` ${content}`, { color: 'muted', dim: true });
|
|
72
|
+
}
|
|
73
|
+
/** A highlighted warning — used when declining the step aborts the flow. */
|
|
74
|
+
export function warning(content) {
|
|
75
|
+
return text(` ⚠ ${content}`, { color: 'warning', bold: true });
|
|
76
|
+
}
|
|
77
|
+
/** Past this point the current step starts showing how long it has been running. */
|
|
78
|
+
const SLOW_TASK_MS = 3000;
|
|
79
|
+
/**
|
|
80
|
+
* The list of running tasks: done ones with ✔, the current one with a spinner and
|
|
81
|
+
* the pending ones dimmed — the same vocabulary as the transcript.
|
|
82
|
+
*
|
|
83
|
+
* `elapsedMs` is the current step's runtime: past a threshold, the counter shows
|
|
84
|
+
* next to it. Installing dependencies can take minutes, and without that signal a
|
|
85
|
+
* spinning spinner is indistinguishable from a hung process.
|
|
86
|
+
*/
|
|
87
|
+
export function taskList(tasks, doneCount, elapsedMs) {
|
|
88
|
+
const allDone = doneCount >= tasks.length;
|
|
89
|
+
return tasks.map((task, index) => {
|
|
90
|
+
const done = index < doneCount;
|
|
91
|
+
const current = index === doneCount && !allDone;
|
|
92
|
+
const mark = done
|
|
93
|
+
? text('✔', { color: 'success' })
|
|
94
|
+
: current
|
|
95
|
+
? spinner({ variant: 'dots', color: 'primary' })
|
|
96
|
+
: text('○', { color: 'muted', dim: true });
|
|
97
|
+
const showElapsed = current && elapsedMs !== undefined && elapsedMs >= SLOW_TASK_MS;
|
|
98
|
+
return row({ gap: 0 }, text(' '), mark, text(` ${task.label}`, { color: done || current ? 'foreground' : 'muted' }), ...(task.note ? [text(` — ${task.note}`, { color: 'muted', dim: true })] : []), ...(showElapsed ? [text(` ${Math.round(elapsedMs / 1000)}s`, { color: 'primary', dim: true })] : []));
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
/** Header for the execution phase, with a spinner while work is pending. */
|
|
102
|
+
export function taskHeader(label, allDone) {
|
|
103
|
+
return row({ gap: 0 }, allDone ? text('✔', { color: 'success' }) : spinner({ variant: 'dots', color: 'primary' }), text(` ${label}`, { color: 'foreground', bold: true }));
|
|
104
|
+
}
|
|
105
|
+
export function progress(done, total) {
|
|
106
|
+
return progressBar({ value: total ? done / total : 1, width: 44, color: 'success', showPercent: true });
|
|
107
|
+
}
|
|
108
|
+
/** Painel de desfecho — sucesso, cancelamento ou falha. */
|
|
109
|
+
export function resultPanel(kind, message) {
|
|
110
|
+
return panel({ border: 'round', borderColor: kind, padding: { top: 0, right: 1, bottom: 0, left: 1 } }, row({ gap: 0 }, text(kind === 'success' ? '✔ ' : '✖ ', { color: kind, bold: true }), text(message, { color: 'foreground', bold: true })));
|
|
111
|
+
}
|
|
112
|
+
/** A screen's standard frame: breathing room at the sides, content in a column. */
|
|
113
|
+
export function page(...children) {
|
|
114
|
+
return column({ flexGrow: 1, padding: { top: 1, right: 3, bottom: 1, left: 3 }, gap: 0 }, ...children);
|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I,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC;AAC1G,CAAC;AAED,2DAA2D;AAC3D,MAAM,UAAU,WAAW,CAAC,IAA0B,EAAE,OAAe;IACrE,OAAO,KAAK,CACV,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,EACzF,GAAG,CACD,EAAE,GAAG,EAAE,CAAC,EAAE,EACV,IAAI,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,EACrE,IAAI,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CACnD,CACF,CAAC;AACJ,CAAC;AAED,mFAAmF;AACnF,MAAM,UAAU,IAAI,CAAC,GAAG,QAAgB;IACtC,OAAO,MAAM,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,OAAO,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,GAAG,QAAQ,CAAC,CAAC;AACzG,CAAC"}
|
package/ui/brand.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The CLI's visual identity — the banner and the command headers.
|
|
3
|
+
*
|
|
4
|
+
* The banner only appears when there is height to spare: in short terminals it
|
|
5
|
+
* gives way to the content, which is what the user needs to see to answer.
|
|
6
|
+
*/
|
|
7
|
+
import { type Node } from './engine/index.js';
|
|
8
|
+
/** The brand name as it is written — the slash is part of it. */
|
|
9
|
+
export declare const BRAND = "zard/ui";
|
|
10
|
+
export declare const ZARDUI_BANNER: string[];
|
|
11
|
+
export declare function brandBanner(rows: number): Node[];
|
|
12
|
+
/** A command's compact header: `◇ zard/ui · initialize`. */
|
|
13
|
+
export declare function commandHeader(command: string, description?: string): Node;
|
|
14
|
+
//# sourceMappingURL=brand.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"brand.d.ts","sourceRoot":"","sources":["../../src/ui/brand.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAA6B,KAAK,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAEzE,iEAAiE;AACjE,eAAO,MAAM,KAAK,YAAY,CAAC;AAE/B,eAAO,MAAM,aAAa,UAOzB,CAAC;AAQF,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,EAAE,CAKhD;AAED,4DAA4D;AAC5D,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAUzE"}
|
package/ui/brand.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The CLI's visual identity — the banner and the command headers.
|
|
3
|
+
*
|
|
4
|
+
* The banner only appears when there is height to spare: in short terminals it
|
|
5
|
+
* gives way to the content, which is what the user needs to see to answer.
|
|
6
|
+
*/
|
|
7
|
+
import { banner, column, row, text } from './engine/index.js';
|
|
8
|
+
/** The brand name as it is written — the slash is part of it. */
|
|
9
|
+
export const BRAND = 'zard/ui';
|
|
10
|
+
export const ZARDUI_BANNER = [
|
|
11
|
+
'███████╗ █████╗ ██████╗ ██████╗ ██╗██╗ ██╗██╗',
|
|
12
|
+
'╚══███╔╝██╔══██╗██╔══██╗██╔══██╗ ██╔╝██║ ██║██║',
|
|
13
|
+
' ███╔╝ ███████║██████╔╝██║ ██║ ██╔╝ ██║ ██║██║',
|
|
14
|
+
' ███╔╝ ██╔══██║██╔══██╗██║ ██║ ██╔╝ ██║ ██║██║',
|
|
15
|
+
'███████╗██║ ██║██║ ██║██████╔╝██╔╝ ╚██████╔╝██║',
|
|
16
|
+
'╚══════╝╚═╝ ╚═╝╚═╝ ╚═╝╚═════╝ ╚═╝ ╚═════╝ ╚═╝',
|
|
17
|
+
];
|
|
18
|
+
const BANNER_COLOR = '#fafafa';
|
|
19
|
+
const TAGLINE = 'The Angular component toolkit · beautiful components in seconds';
|
|
20
|
+
/** Minimum height for the banner to fit without squeezing the questions. */
|
|
21
|
+
const BANNER_MIN_ROWS = 24;
|
|
22
|
+
export function brandBanner(rows) {
|
|
23
|
+
if (rows < BANNER_MIN_ROWS) {
|
|
24
|
+
return [row({ gap: 1 }, text('◇', { color: 'primary' }), text(BRAND, { color: 'foreground', bold: true }))];
|
|
25
|
+
}
|
|
26
|
+
return [banner({ lines: ZARDUI_BANNER, colors: [BANNER_COLOR] }), text(TAGLINE, { color: 'muted', dim: true })];
|
|
27
|
+
}
|
|
28
|
+
/** A command's compact header: `◇ zard/ui · initialize`. */
|
|
29
|
+
export function commandHeader(command, description) {
|
|
30
|
+
const head = row({ gap: 1 }, text('◇', { color: 'success' }), text(BRAND, { color: 'foreground', bold: true }), text(`· ${command}`, { color: 'muted' }));
|
|
31
|
+
if (!description)
|
|
32
|
+
return head;
|
|
33
|
+
return column({}, head, text(description, { color: 'muted', dim: true }));
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=brand.js.map
|
package/ui/brand.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"brand.js","sourceRoot":"","sources":["../../src/ui/brand.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAa,MAAM,mBAAmB,CAAC;AAEzE,iEAAiE;AACjE,MA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AI,CAAC,WAAW;QAAE,OAAO,IAAI,CAAC;IAC9B,OAAO,MAAM,CAAC,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,WAAW,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;AAC5E,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* animation — FPS-independent tweens (they use real dt), easing, and a keyed
|
|
3
|
+
* clock that survives a re-render. The basis of spinner/progress/fade/typing/pulse.
|
|
4
|
+
*/
|
|
5
|
+
export type Easing = (t: number) => number;
|
|
6
|
+
export declare const Easing: {
|
|
7
|
+
readonly linear: Easing;
|
|
8
|
+
readonly easeIn: Easing;
|
|
9
|
+
readonly easeOut: Easing;
|
|
10
|
+
readonly easeInOut: Easing;
|
|
11
|
+
readonly spring: Easing;
|
|
12
|
+
};
|
|
13
|
+
export interface TweenOptions {
|
|
14
|
+
readonly from: number;
|
|
15
|
+
readonly to: number;
|
|
16
|
+
readonly duration: number;
|
|
17
|
+
readonly easing?: Easing;
|
|
18
|
+
readonly loop?: boolean | 'pingpong';
|
|
19
|
+
}
|
|
20
|
+
export interface Tween {
|
|
21
|
+
readonly value: number;
|
|
22
|
+
readonly done: boolean;
|
|
23
|
+
update(dtMs: number): void;
|
|
24
|
+
reset(): void;
|
|
25
|
+
}
|
|
26
|
+
export declare function tween(options: TweenOptions): Tween;
|
|
27
|
+
export interface AnimationClock {
|
|
28
|
+
register(key: string, tween: Tween): void;
|
|
29
|
+
has(key: string): boolean;
|
|
30
|
+
phase(key: string): number;
|
|
31
|
+
remove(key: string): void;
|
|
32
|
+
tick(dtMs: number): void;
|
|
33
|
+
readonly active: boolean;
|
|
34
|
+
}
|
|
35
|
+
export declare function createAnimationClock(): AnimationClock;
|
|
36
|
+
/** Frames de spinner nomeados (dots, line, arc, bounce, pulse). */
|
|
37
|
+
export declare const spinnerFrames: Readonly<Record<string, readonly string[]>>;
|
|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MAAM,CAAC;IAC3B,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;CAC1B;AAED,wBAAgB,oBAAoB,IAAI,cAAc,CAuBrD;AAED,mEAAmE;AACnE,eAAO,MAAM,aAAa,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC,CAMrE,CAAC"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* animation — FPS-independent tweens (they use real dt), easing, and a keyed
|
|
3
|
+
* clock that survives a re-render. The basis of spinner/progress/fade/typing/pulse.
|
|
4
|
+
*/
|
|
5
|
+
const clamp01 = (t) => (t < 0 ? 0 : t > 1 ? 1 : t);
|
|
6
|
+
export const Easing = {
|
|
7
|
+
linear: t => clamp01(t),
|
|
8
|
+
easeIn: t => {
|
|
9
|
+
t = clamp01(t);
|
|
10
|
+
return t * t;
|
|
11
|
+
},
|
|
12
|
+
easeOut: t => {
|
|
13
|
+
t = clamp01(t);
|
|
14
|
+
return 1 - (1 - t) * (1 - t);
|
|
15
|
+
},
|
|
16
|
+
easeInOut: t => {
|
|
17
|
+
t = clamp01(t);
|
|
18
|
+
return t < 0.5 ? 2 * t * t : 1 - (-2 * t + 2) ** 2 / 2;
|
|
19
|
+
},
|
|
20
|
+
spring: t => {
|
|
21
|
+
t = clamp01(t);
|
|
22
|
+
return 1 - Math.cos(t * Math.PI * 1.5) * (1 - t);
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
export function tween(options) {
|
|
26
|
+
const easing = options.easing ?? Easing.linear;
|
|
27
|
+
const dur = Math.max(1, options.duration);
|
|
28
|
+
let elapsed = 0;
|
|
29
|
+
let dir = 1;
|
|
30
|
+
const compute = () => {
|
|
31
|
+
let t = elapsed / dur;
|
|
32
|
+
let done = false;
|
|
33
|
+
if (options.loop === 'pingpong') {
|
|
34
|
+
t = clamp01(t);
|
|
35
|
+
}
|
|
36
|
+
else if (options.loop) {
|
|
37
|
+
t = t % 1;
|
|
38
|
+
}
|
|
39
|
+
else if (t >= 1) {
|
|
40
|
+
t = 1;
|
|
41
|
+
done = true;
|
|
42
|
+
}
|
|
43
|
+
const eased = easing(t);
|
|
44
|
+
const value = options.from + (options.to - options.from) * (dir < 0 ? 1 - eased : eased);
|
|
45
|
+
return { value, done };
|
|
46
|
+
};
|
|
47
|
+
return {
|
|
48
|
+
get value() {
|
|
49
|
+
return compute().value;
|
|
50
|
+
},
|
|
51
|
+
get done() {
|
|
52
|
+
return compute().done;
|
|
53
|
+
},
|
|
54
|
+
update(dtMs) {
|
|
55
|
+
elapsed += dtMs;
|
|
56
|
+
if (options.loop === 'pingpong' && elapsed >= dur) {
|
|
57
|
+
elapsed = elapsed % dur;
|
|
58
|
+
dir *= -1;
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
reset() {
|
|
62
|
+
elapsed = 0;
|
|
63
|
+
dir = 1;
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
export function createAnimationClock() {
|
|
68
|
+
const tweens = new Map();
|
|
69
|
+
return {
|
|
70
|
+
register(key, t) {
|
|
71
|
+
tweens.set(key, t);
|
|
72
|
+
},
|
|
73
|
+
has(key) {
|
|
74
|
+
return tweens.has(key);
|
|
75
|
+
},
|
|
76
|
+
phase(key) {
|
|
77
|
+
return tweens.get(key)?.value ?? 0;
|
|
78
|
+
},
|
|
79
|
+
remove(key) {
|
|
80
|
+
tweens.delete(key);
|
|
81
|
+
},
|
|
82
|
+
tick(dtMs) {
|
|
83
|
+
for (const t of tweens.values())
|
|
84
|
+
t.update(dtMs);
|
|
85
|
+
},
|
|
86
|
+
get active() {
|
|
87
|
+
for (const t of tweens.values())
|
|
88
|
+
if (!t.done)
|
|
89
|
+
return true;
|
|
90
|
+
return false;
|
|
91
|
+
},
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
/** Frames de spinner nomeados (dots, line, arc, bounce, pulse). */
|
|
95
|
+
export const spinnerFrames = {
|
|
96
|
+
dots: ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'],
|
|
97
|
+
line: ['-', '\\', '|', '/'],
|
|
98
|
+
arc: ['◜', '◠', '◝', '◞', '◡', '◟'],
|
|
99
|
+
bounce: ['⠁', '⠂', '⠄', '⠂'],
|
|
100
|
+
pulse: ['•', '●', '◉', '●'],
|
|
101
|
+
};
|
|
102
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/ui/engine/animation/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,MAAM,OAAO,GAAG,CAAC,CAAS,EAAU,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAEnE,MAAM,CAAC,MAAM,MAAM,GAMf;IACF,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IACvB,MAAM,EAAE,CAAC,CAAC,EAAE;QACV,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;QACf,OAAO,CAAC,GAAG,CAAC,CAAC;IACf,CAAC;IACD,OAAO,EAAE,CAAC,CAAC,EAAE;QACX,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;QACf,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IAC/B,CAAC;IACD,SAAS,EAAE,CAAC,CAAC,EAAE;QACb,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;QACf,OAAO,CAA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AAK,MAAM,CAAC,IAAI,MAAM,CAAC,MAAM,EAAE;gBAAE,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAClD,CAAC;QACD,IAAI,MAAM;YACR,KAAK,MAAM,CAAC,IAAI,MAAM,CAAC,MAAM,EAAE;gBAAE,IAAI,CAAC,CAAC,CAAC,IAAI;oBAAE,OAAO,IAAI,CAAC;YAC1D,OAAO,KAAK,CAAC;QACf,CAAC;KACF,CAAC;AACJ,CAAC;AAED,mEAAmE;AACnE,MAAM,CAAC,MAAM,aAAa,GAAgD;IACxE,IAAI,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC;IACxD,IAAI,EAAE,CAAC,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,CAAC;IAC3B,GAAG,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC;IACnC,MAAM,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC;IAC5B,KAAK,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC;CAC5B,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ansi — generates escape sequences (CSI/SGR) and defines the colour vocabulary.
|
|
3
|
+
* The lowest level that "knows" the terminal protocol. No I/O.
|
|
4
|
+
*/
|
|
5
|
+
/** The colour depth the terminal supports (see TerminalCapabilities). */
|
|
6
|
+
export type ColorLevel = 'truecolor' | 'ansi256' | 'ansi16' | 'none';
|
|
7
|
+
/** A concrete colour already resolved for a depth — ready to become SGR bytes. */
|
|
8
|
+
export type AnsiColor = {
|
|
9
|
+
readonly kind: 'rgb';
|
|
10
|
+
readonly r: number;
|
|
11
|
+
readonly g: number;
|
|
12
|
+
readonly b: number;
|
|
13
|
+
} | {
|
|
14
|
+
readonly kind: 'ansi256';
|
|
15
|
+
readonly index: number;
|
|
16
|
+
} | {
|
|
17
|
+
readonly kind: 'ansi16';
|
|
18
|
+
readonly index: number;
|
|
19
|
+
} | {
|
|
20
|
+
readonly kind: 'default';
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Text attributes as a bitmask (comparable by value, cheap to diff).
|
|
24
|
+
* A const object, not a `const enum`, to stay compatible with `isolatedModules`.
|
|
25
|
+
*/
|
|
26
|
+
export declare const Attr: {
|
|
27
|
+
readonly None: 0;
|
|
28
|
+
readonly Bold: number;
|
|
29
|
+
readonly Dim: number;
|
|
30
|
+
readonly Italic: number;
|
|
31
|
+
readonly Underline: number;
|
|
32
|
+
readonly Inverse: number;
|
|
33
|
+
readonly Strike: number;
|
|
34
|
+
readonly Blink: number;
|
|
35
|
+
};
|
|
36
|
+
/** An attribute bitmask value (combinable with bitwise OR). */
|
|
37
|
+
export type Attr = number;
|
|
38
|
+
export declare const ESC = "\u001B";
|
|
39
|
+
/** Builds a CSI sequence (`ESC [ … `). e.g. csi("2J"), csi(`${y};${x}H`). */
|
|
40
|
+
export declare function csi(body: string): string;
|
|
41
|
+
/**
|
|
42
|
+
* Incremental SGR builder that emits ONLY the delta against the current state —
|
|
43
|
+
* the key to minimizing bytes in the encoder (ARCHITECTURE §17).
|
|
44
|
+
*/
|
|
45
|
+
export interface SgrBuilder {
|
|
46
|
+
transition(fg: AnsiColor, bg: AnsiColor, attrs: Attr): string;
|
|
47
|
+
reset(): string;
|
|
48
|
+
clear(): void;
|
|
49
|
+
}
|
|
50
|
+
export declare function createSgrBuilder(): SgrBuilder;
|
|
51
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/ui/engine/ansi/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,yEAAyE;AACzE,MAAM,MAAM,UAAU,GAAG,WAAW,GAAG,SAAS,GAAG,QAAQ,GAAG,MAAM,CAAC;AAErE,kFAAkF;AAClF,MAAM,MAAM,SAAS,GACjB;IAAE,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAA;CAAE,GACpF;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GACpD;IAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GACnD;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAA;CAAE,CAAC;AAEjC;;;GAGG;AACH,eAAO,MAAM,IAAI;;;;;;;;;CASP,CAAC;AACX,+DAA+D;AAC/D,MAAM,MAAM,IAAI,GAAG,MAAM,CAAC;AAE1B,eAAO,MAAM,GAAG,WAAS,CAAC;AAE1B,6EAA6E;AAC7E,wBAAgB,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAExC;AAsCD;;;GAGG;AACH,MAAM,WAAW,UAAU;IACzB,UAAU,CAAC,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,GAAG,MAAM,CAAC;IAC9D,KAAK,IAAI,MAAM,CAAC;IAChB,KAAK,IAAI,IAAI,CAAC;CACf;AAED,wBAAgB,gBAAgB,IAAI,UAAU,CA8C7C"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ansi — generates escape sequences (CSI/SGR) and defines the colour vocabulary.
|
|
3
|
+
* The lowest level that "knows" the terminal protocol. No I/O.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Text attributes as a bitmask (comparable by value, cheap to diff).
|
|
7
|
+
* A const object, not a `const enum`, to stay compatible with `isolatedModules`.
|
|
8
|
+
*/
|
|
9
|
+
export const Attr = {
|
|
10
|
+
None: 0,
|
|
11
|
+
Bold: 1 << 0,
|
|
12
|
+
Dim: 1 << 1,
|
|
13
|
+
Italic: 1 << 2,
|
|
14
|
+
Underline: 1 << 3,
|
|
15
|
+
Inverse: 1 << 4,
|
|
16
|
+
Strike: 1 << 5,
|
|
17
|
+
Blink: 1 << 6,
|
|
18
|
+
};
|
|
19
|
+
export const ESC = '\x1b';
|
|
20
|
+
/** Builds a CSI sequence (`ESC [ … `). e.g. csi("2J"), csi(`${y};${x}H`). */
|
|
21
|
+
export function csi(body) {
|
|
22
|
+
return ESC + '[' + body;
|
|
23
|
+
}
|
|
24
|
+
const DEFAULT_COLOR = { kind: 'default' };
|
|
25
|
+
function sameColor(a, b) {
|
|
26
|
+
if (a.kind !== b.kind)
|
|
27
|
+
return false;
|
|
28
|
+
if (a.kind === 'rgb' && b.kind === 'rgb')
|
|
29
|
+
return a.r === b.r && a.g === b.g && a.b === b.b;
|
|
30
|
+
if (a.kind === 'ansi256' && b.kind === 'ansi256')
|
|
31
|
+
return a.index === b.index;
|
|
32
|
+
if (a.kind === 'ansi16' && b.kind === 'ansi16')
|
|
33
|
+
return a.index === b.index;
|
|
34
|
+
return a.kind === b.kind; // default
|
|
35
|
+
}
|
|
36
|
+
function colorCodes(c, fg) {
|
|
37
|
+
const base = fg ? 38 : 48;
|
|
38
|
+
switch (c.kind) {
|
|
39
|
+
case 'rgb':
|
|
40
|
+
return [base, 2, c.r, c.g, c.b];
|
|
41
|
+
case 'ansi256':
|
|
42
|
+
return [base, 5, c.index];
|
|
43
|
+
case 'ansi16':
|
|
44
|
+
return c.index < 8 ? [(fg ? 30 : 40) + c.index] : [(fg ? 90 : 100) + (c.index - 8)];
|
|
45
|
+
case 'default':
|
|
46
|
+
return [fg ? 39 : 49];
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
function attrCodes(mask) {
|
|
50
|
+
const out = [];
|
|
51
|
+
if (mask & Attr.Bold)
|
|
52
|
+
out.push(1);
|
|
53
|
+
if (mask & Attr.Dim)
|
|
54
|
+
out.push(2);
|
|
55
|
+
if (mask & Attr.Italic)
|
|
56
|
+
out.push(3);
|
|
57
|
+
if (mask & Attr.Underline)
|
|
58
|
+
out.push(4);
|
|
59
|
+
if (mask & Attr.Blink)
|
|
60
|
+
out.push(5);
|
|
61
|
+
if (mask & Attr.Inverse)
|
|
62
|
+
out.push(7);
|
|
63
|
+
if (mask & Attr.Strike)
|
|
64
|
+
out.push(9);
|
|
65
|
+
return out;
|
|
66
|
+
}
|
|
67
|
+
export function createSgrBuilder() {
|
|
68
|
+
let curFg = DEFAULT_COLOR;
|
|
69
|
+
let curBg = DEFAULT_COLOR;
|
|
70
|
+
let curAttrs = 0;
|
|
71
|
+
return {
|
|
72
|
+
transition(fg, bg, attrs) {
|
|
73
|
+
const removingAttr = (curAttrs & ~attrs) !== 0;
|
|
74
|
+
const fgToDefault = fg.kind === 'default' && curFg.kind !== 'default';
|
|
75
|
+
const bgToDefault = bg.kind === 'default' && curBg.kind !== 'default';
|
|
76
|
+
if (removingAttr || fgToDefault || bgToDefault) {
|
|
77
|
+
// There is no cheap way to turn attributes off selectively → reset and rebuild.
|
|
78
|
+
const codes = [0, ...attrCodes(attrs)];
|
|
79
|
+
if (fg.kind !== 'default')
|
|
80
|
+
codes.push(...colorCodes(fg, true));
|
|
81
|
+
if (bg.kind !== 'default')
|
|
82
|
+
codes.push(...colorCodes(bg, false));
|
|
83
|
+
curFg = fg;
|
|
84
|
+
curBg = bg;
|
|
85
|
+
curAttrs = attrs;
|
|
86
|
+
return csi(codes.join(';') + 'm');
|
|
87
|
+
}
|
|
88
|
+
const codes = [];
|
|
89
|
+
const addedAttrs = attrs & ~curAttrs;
|
|
90
|
+
if (addedAttrs)
|
|
91
|
+
codes.push(...attrCodes(addedAttrs));
|
|
92
|
+
if (!sameColor(fg, curFg))
|
|
93
|
+
codes.push(...colorCodes(fg, true));
|
|
94
|
+
if (!sameColor(bg, curBg))
|
|
95
|
+
codes.push(...colorCodes(bg, false));
|
|
96
|
+
curFg = fg;
|
|
97
|
+
curBg = bg;
|
|
98
|
+
curAttrs = attrs;
|
|
99
|
+
if (codes.length === 0)
|
|
100
|
+
return '';
|
|
101
|
+
return csi(codes.join(';') + 'm');
|
|
102
|
+
},
|
|
103
|
+
reset() {
|
|
104
|
+
curFg = DEFAULT_COLOR;
|
|
105
|
+
curBg = DEFAULT_COLOR;
|
|
106
|
+
curAttrs = 0;
|
|
107
|
+
return csi('0m');
|
|
108
|
+
},
|
|
109
|
+
clear() {
|
|
110
|
+
curFg = DEFAULT_COLOR;
|
|
111
|
+
curBg = DEFAULT_COLOR;
|
|
112
|
+
curAttrs = 0;
|
|
113
|
+
},
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/ui/engine/ansi/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAYH;;;GAGG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG;IAClB,IAAI,EAAE,CAAC;IACP,IAAI,EAAE,CAAC,IAAI,CAAC;IACZ,GAAG,EAAE,CAAC,IAAI,CAAC;IACX,MAAM,EAAE,CAAC,IAAI,CAAC;IACd,SAAS,EAAE,CAAC,IAAI,CAAC;IACjB,OAAO,EAAE,CAAC,IAAI,CAAC;IACf,MAAM,EAAE,CAAC,IAAI,CAAC;IACd,KAAK,EAAE,CAAC,IAAI,CAAC;CACL,CAAC;AAIX,MAAM,CAAC,MAAM,GAAG,GAAG,MAAM,CAAC;AAE1B,6EAA6E;AAC7E,MAAM,UAAU,GAAG,CAAC,IAAY;IAC9B,OAAO,GAAG,GAAG,GAAG,GAAG,IAAI,CAAC;AAC1B,CAAC;AAED,MAAM,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