talented-args 0.2.5-beta → 0.3.1-beta

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.
Files changed (70) hide show
  1. package/README.md +506 -14
  2. package/dist/clipboard.d.ts +10 -0
  3. package/dist/clipboard.js +79 -0
  4. package/dist/clipboard.js.map +1 -0
  5. package/dist/compile.d.ts +67 -0
  6. package/dist/compile.js +188 -0
  7. package/dist/compile.js.map +1 -0
  8. package/dist/descriptors.d.ts +322 -0
  9. package/dist/descriptors.js +362 -0
  10. package/dist/descriptors.js.map +1 -0
  11. package/dist/display.d.ts +43 -0
  12. package/dist/display.js +251 -0
  13. package/dist/display.js.map +1 -0
  14. package/dist/errors.d.ts +34 -17
  15. package/dist/errors.js +61 -75
  16. package/dist/errors.js.map +1 -1
  17. package/dist/index.d.ts +10 -6
  18. package/dist/index.js +8 -9
  19. package/dist/index.js.map +1 -1
  20. package/dist/options.d.ts +69 -41
  21. package/dist/options.js +198 -31
  22. package/dist/options.js.map +1 -1
  23. package/dist/parse.d.ts +70 -0
  24. package/dist/parse.js +551 -0
  25. package/dist/parse.js.map +1 -0
  26. package/dist/program.d.ts +125 -0
  27. package/dist/program.js +337 -0
  28. package/dist/program.js.map +1 -0
  29. package/dist/remember.d.ts +71 -0
  30. package/dist/remember.js +216 -0
  31. package/dist/remember.js.map +1 -0
  32. package/dist/styling.d.ts +38 -9
  33. package/dist/styling.js +155 -75
  34. package/dist/styling.js.map +1 -1
  35. package/dist/terminal.d.ts +205 -0
  36. package/dist/terminal.js +152 -0
  37. package/dist/terminal.js.map +1 -0
  38. package/dist/tools.d.ts +35 -31
  39. package/dist/tools.js +68 -140
  40. package/dist/tools.js.map +1 -1
  41. package/dist/tui.d.ts +96 -0
  42. package/dist/tui.js +397 -0
  43. package/dist/tui.js.map +1 -0
  44. package/dist/tui_layout.d.ts +151 -0
  45. package/dist/tui_layout.js +582 -0
  46. package/dist/tui_layout.js.map +1 -0
  47. package/dist/tui_model.d.ts +153 -0
  48. package/dist/tui_model.js +673 -0
  49. package/dist/tui_model.js.map +1 -0
  50. package/package.json +18 -14
  51. package/.eslintrc.js +0 -24
  52. package/.idea/codeStyles/Project.xml +0 -364
  53. package/.idea/codeStyles/codeStyleConfig.xml +0 -5
  54. package/.idea/compiler.xml +0 -7
  55. package/.idea/encodings.xml +0 -6
  56. package/.idea/inspectionProfiles/Project_Default.xml +0 -12
  57. package/.idea/jsLibraryMappings.xml +0 -6
  58. package/.idea/modules.xml +0 -8
  59. package/.idea/prettier.xml +0 -8
  60. package/.idea/talented-args.iml +0 -11
  61. package/.idea/vcs.xml +0 -6
  62. package/.prettierrc.yaml +0 -4
  63. package/dist/definitions.d.ts +0 -70
  64. package/dist/definitions.js +0 -38
  65. package/dist/definitions.js.map +0 -1
  66. package/dist/main.d.ts +0 -33
  67. package/dist/main.js +0 -313
  68. package/dist/main.js.map +0 -1
  69. package/jest.config.js +0 -4
  70. package/tsconfig.json +0 -18
@@ -0,0 +1,216 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.isRememberStore = isRememberStore;
7
+ exports.sanitizeRemembered = sanitizeRemembered;
8
+ exports.recall = recall;
9
+ exports.rememberRun = rememberRun;
10
+ exports.fileNameOf = fileNameOf;
11
+ exports.defaultRememberPath = defaultRememberPath;
12
+ exports.createFileStore = createFileStore;
13
+ const promises_1 = __importDefault(require("node:fs/promises"));
14
+ const node_os_1 = __importDefault(require("node:os"));
15
+ const node_path_1 = __importDefault(require("node:path"));
16
+ const descriptors_1 = require("./descriptors");
17
+ const tools_1 = require("./tools");
18
+ function isRememberStore(value) {
19
+ return (typeof value === 'object' &&
20
+ value !== null &&
21
+ 'load' in value &&
22
+ typeof value.load === 'function' &&
23
+ (!('save' in value) || typeof value.save === 'function'));
24
+ }
25
+ // *********************************************************************************************************************
26
+ function isList(value) {
27
+ return (Array.isArray(value) &&
28
+ value.every(item => typeof item === 'string' || typeof item === 'number'));
29
+ }
30
+ function isRememberedValue(value) {
31
+ return (typeof value === 'string' ||
32
+ typeof value === 'boolean' ||
33
+ (typeof value === 'number' && Number.isFinite(value)) ||
34
+ isList(value));
35
+ }
36
+ function sanitizeValues(loaded) {
37
+ const values = {};
38
+ if ((0, tools_1.isPlainObject)(loaded)) {
39
+ for (const [name, value] of Object.entries(loaded)) {
40
+ // Exclude __proto__ because assigning it would replace the object's prototype.
41
+ if (name !== '__proto__' && isRememberedValue(value)) {
42
+ values[name] = value;
43
+ }
44
+ }
45
+ }
46
+ return values;
47
+ }
48
+ /** Validate the structure of loaded state and discard unsupported fields or value types. */
49
+ function sanitizeRemembered(loaded) {
50
+ if (!(0, tools_1.isPlainObject)(loaded)) {
51
+ return {};
52
+ }
53
+ const { command, common, commands } = loaded;
54
+ const result = {};
55
+ if (typeof command === 'string' || command === null) {
56
+ result.command = command;
57
+ }
58
+ if (common !== undefined) {
59
+ result.common = sanitizeValues(common);
60
+ }
61
+ if ((0, tools_1.isPlainObject)(commands)) {
62
+ const sanitized = {};
63
+ for (const [token, values] of Object.entries(commands)) {
64
+ if (token !== '__proto__') {
65
+ sanitized[token] = sanitizeValues(values);
66
+ }
67
+ }
68
+ result.commands = sanitized;
69
+ }
70
+ return result;
71
+ }
72
+ /** Convert a saved value to raw parser values. Return `null` if it is incompatible with the input. */
73
+ function rawValuesOf(input, value) {
74
+ if (input.kind === 'flag') {
75
+ return value === true || (value === false && input.negatable) ? [value] : null;
76
+ }
77
+ if (typeof value === 'boolean') {
78
+ return null;
79
+ }
80
+ const items = isList(value) ? value : [value];
81
+ if (!items.length || (!input.multiple && items.length > 1)) {
82
+ return null;
83
+ }
84
+ return items.map(String);
85
+ }
86
+ function recallValues(inputs, values) {
87
+ const recalled = new Map();
88
+ for (const [name, value] of Object.entries(values ?? {})) {
89
+ // Accept every option name so saved values survive a rename that retains an old alias.
90
+ const input = inputs.find(candidate => (0, descriptors_1.inputSpellings)(candidate).includes(name));
91
+ const raws = input ? rawValuesOf(input, value) : null;
92
+ if (input && raws) {
93
+ recalled.set(input, raws);
94
+ }
95
+ }
96
+ return recalled;
97
+ }
98
+ /**
99
+ * Match saved state to the current definition. Ignore removed commands and options,
100
+ * and values with incompatible types or list lengths.
101
+ * Keep values that fail conversion so the editor can show their validation errors.
102
+ */
103
+ function recall(schema, remembered) {
104
+ const rootInputs = schema.root.inputs;
105
+ const commands = new Map();
106
+ for (const command of schema.commands) {
107
+ const values = remembered.commands?.[command.token];
108
+ if (values) {
109
+ // Store inputs shared with the root among common values, regardless of their command placement.
110
+ const own = command.scope.inputs.filter(input => !rootInputs.includes(input));
111
+ commands.set(command, recallValues(own, values));
112
+ }
113
+ }
114
+ let command = undefined;
115
+ if (remembered.command === null) {
116
+ command = schema.rootRunnable ? null : undefined;
117
+ }
118
+ else if (remembered.command !== undefined) {
119
+ command = schema.commandsByToken.get(remembered.command);
120
+ }
121
+ return { command, common: recallValues(rootInputs, remembered.common), commands };
122
+ }
123
+ /** Saved form of an input's raw values. Returns `undefined` when no value was supplied. */
124
+ function rememberedValueOf(input, raws) {
125
+ const last = raws[raws.length - 1];
126
+ if (last === undefined || typeof last === 'boolean') {
127
+ return last;
128
+ }
129
+ const texts = raws.filter((raw) => typeof raw === 'string');
130
+ return input.multiple ? texts : last;
131
+ }
132
+ /**
133
+ * Build saved state for a submitted or copied command.
134
+ * Replace common values and the selected command's values so cleared fields stay empty.
135
+ * Preserve other commands' values. Exclude sensitive inputs.
136
+ */
137
+ function rememberRun(schema, previous, binding) {
138
+ const common = {};
139
+ const own = {};
140
+ for (const [input, raws] of binding.given) {
141
+ const value = input.sensitive ? undefined : rememberedValueOf(input, raws);
142
+ if (value === undefined) {
143
+ continue;
144
+ }
145
+ const target = schema.root.inputs.includes(input) ? common : own;
146
+ target[(0, descriptors_1.inputDisplayName)(input)] = value;
147
+ }
148
+ const commands = { ...previous.commands };
149
+ if (binding.command) {
150
+ commands[binding.command.token] = own;
151
+ }
152
+ return { command: binding.command?.token ?? null, common, commands };
153
+ }
154
+ // *********************************************************************************************************************
155
+ /** Normalize a program name for a state directory: `@acme/My Tool` becomes `acme-my-tool`. */
156
+ function fileNameOf(name) {
157
+ return name
158
+ .toLowerCase()
159
+ .replace(/[^\p{L}\p{N}._]+/gu, '-')
160
+ .replace(/^[-.]+|-+$/g, '');
161
+ }
162
+ /**
163
+ * Default path for interactive state.
164
+ * An absolute `XDG_STATE_HOME` overrides the base directory on any platform.
165
+ * Otherwise use `~/.local/state` on Linux, Application Support on macOS, or LocalAppData on Windows.
166
+ */
167
+ function defaultRememberPath(name, env, platform) {
168
+ const path = platform === 'win32' ? node_path_1.default.win32 : node_path_1.default.posix;
169
+ const home = env['HOME'] || node_os_1.default.homedir();
170
+ const xdgStateHome = env['XDG_STATE_HOME'];
171
+ let base;
172
+ if (xdgStateHome && path.isAbsolute(xdgStateHome)) {
173
+ base = xdgStateHome;
174
+ }
175
+ else if (platform === 'win32') {
176
+ base = env['LOCALAPPDATA'] || path.join(home, 'AppData', 'Local');
177
+ }
178
+ else if (platform === 'darwin') {
179
+ base = path.join(home, 'Library', 'Application Support');
180
+ }
181
+ else {
182
+ base = path.join(home, '.local', 'state');
183
+ }
184
+ return path.join(base, fileNameOf(name), 'interactive.json');
185
+ }
186
+ /**
187
+ * Store interactive state in a JSON file.
188
+ * Treat missing, unreadable, or invalid files as empty state. Ignore failed writes.
189
+ */
190
+ function createFileStore(path) {
191
+ return {
192
+ load: async () => {
193
+ try {
194
+ return sanitizeRemembered(JSON.parse(await promises_1.default.readFile(path, 'utf8')));
195
+ }
196
+ catch {
197
+ return null;
198
+ }
199
+ },
200
+ save: async (remembered) => {
201
+ // Write to a sibling temporary file, then rename it to avoid exposing partially written JSON.
202
+ const temporary = `${path}.${process.pid}.tmp`;
203
+ try {
204
+ await promises_1.default.mkdir(node_path_1.default.dirname(path), { recursive: true });
205
+ await promises_1.default.writeFile(temporary, JSON.stringify(remembered, null, 2) + '\n', {
206
+ mode: 0o600,
207
+ });
208
+ await promises_1.default.rename(temporary, path);
209
+ }
210
+ catch {
211
+ await promises_1.default.rm(temporary, { force: true }).catch(() => undefined);
212
+ }
213
+ },
214
+ };
215
+ }
216
+ //# sourceMappingURL=remember.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remember.js","sourceRoot":"","sources":["../src/remember.ts"],"names":[],"mappings":";;;;;AA8CA,0CAQC;AAkCD,gDAuBC;AAoDD,wBAqBC;AAoBD,kCAqBC;AAKD,gCAKC;AAOD,kDAoBC;AAMD,0CAuBC;AAnSD,gEAAqC;AACrC,sDAA4B;AAC5B,0DAAgC;AAGhC,+CAA6E;AAE7E,mCAAwC;AAuCxC,SAAgB,eAAe,CAAC,KAAc;IAC5C,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,MAAM,IAAI,KAAK;QACf,OAAO,KAAK,CAAC,IAAI,KAAK,UAAU;QAChC,CAAC,CAAC,CAAC,MAAM,IAAI,KAAK,CAAC,IAAI,OAAO,KAAK,CAAC,IAAI,KAAK,UAAU,CAAC,CACzD,CAAC;AACJ,CAAC;AAED,wHAAwH;AAExH,SAAS,MAAM,CAAC,KAAc;IAC5B,OAAO,CACL,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QACpB,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,IAAI,KAAK,QAAQ,IAAI,OAAO,IAAI,KAAK,QAAQ,CAAC,CAC1E,CAAC;AACJ,CAAC;AAED,SAAS,iBAAiB,CAAC,KAAc;IACvC,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,OAAO,KAAK,KAAK,SAAS;QAC1B,CAAC,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QACrD,MAAM,CAAC,KAAK,CAAC,CACd,CAAC;AACJ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,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;YACpE,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC"}
package/dist/styling.d.ts CHANGED
@@ -1,13 +1,42 @@
1
1
  export declare const CONSOLE_COLORS: readonly ["bold", "dim", "italic", "underline", "inverse", "hidden", "strikethrough", "black", "red", "green", "yellow", "blue", "magenta", "cyan", "white", "gray", "bgBlack", "bgRed", "bgGreen", "bgYellow", "bgBlue", "bgMagenta", "bgCyan", "bgWhite", "blackBright", "redBright", "greenBright", "yellowBright", "blueBright", "magentaBright", "cyanBright", "whiteBright", "bgBlackBright", "bgRedBright", "bgGreenBright", "bgYellowBright", "bgBlueBright", "bgMagentaBright", "bgCyanBright", "bgWhiteBright"];
2
- declare type IConsoleColor = typeof CONSOLE_COLORS[number];
3
- export declare type IConsoleStyle = undefined | null | IConsoleColor | Array<IConsoleColor>;
4
- declare const STYLE_SPEC_KEYS: readonly ["command_name", "command_summary", "banner_title", "banner_description", "banner_logo", "banner_footer"];
5
- export declare type IStyleSpecKey = typeof STYLE_SPEC_KEYS[number];
6
- export declare type IStyleSpec = {
7
- [key in IStyleSpecKey]?: IConsoleStyle;
2
+ export type IConsoleColor = (typeof CONSOLE_COLORS)[number];
3
+ export type IConsoleStyle = undefined | null | IConsoleColor | readonly IConsoleColor[];
4
+ declare const STYLE_SPEC_KEYS: readonly ["command_name", "command_summary", "banner_title", "banner_description", "banner_logo", "banner_footer", "section_title", "option_name", "option_label", "accent", "error"];
5
+ export type IStyleSpecKey = (typeof STYLE_SPEC_KEYS)[number];
6
+ export type IStyleSpec = {
7
+ readonly [key in IStyleSpecKey]?: IConsoleStyle;
8
8
  };
9
- export declare type IStyleSpecPainter = {
10
- [key in IStyleSpecKey]: (rawText: string) => string;
9
+ /** Supported terminal colors. `default` preserves the user's configured foreground or background. */
10
+ export declare const ATTR_COLORS: readonly ["default", "black", "red", "green", "yellow", "blue", "magenta", "cyan", "white", "brightBlack", "brightRed", "brightGreen", "brightYellow", "brightBlue", "brightMagenta", "brightCyan", "brightWhite"];
11
+ export type IAttrColor = (typeof ATTR_COLORS)[number];
12
+ declare const ATTR_FLAGS: readonly ["bold", "dim", "italic", "underline", "inverse", "hidden", "strike"];
13
+ export type IAttrFlag = (typeof ATTR_FLAGS)[number];
14
+ /**
15
+ * Complete text attributes, including foreground, background, and every style flag.
16
+ * Explicit defaults prevent the terminal library from choosing colors that conflict with the user's theme.
17
+ */
18
+ export type ITextAttr = {
19
+ readonly color: IAttrColor;
20
+ readonly bgColor: IAttrColor;
21
+ } & {
22
+ readonly [flag in IAttrFlag]: boolean;
11
23
  };
12
- export declare function createStyleSpecPainter(styleSpec: IStyleSpec): IStyleSpecPainter;
24
+ export declare const PLAIN_ATTR: ITextAttr;
25
+ export declare function isPlainAttr(attr: ITextAttr): boolean;
26
+ export declare function attrFlags(attr: ITextAttr): IAttrFlag[];
27
+ export type IResolvedStyles = {
28
+ readonly [key in IStyleSpecKey]: ITextAttr;
29
+ };
30
+ /**
31
+ * Validate configured styles and merge them with defaults.
32
+ * `null` disables all default styles. A `null` entry disables only that style.
33
+ */
34
+ export declare function resolveStyles(styleSpec: IStyleSpec | null | undefined): IResolvedStyles;
35
+ /** Apply terminal styling to text. A plain painter returns the text unchanged. */
36
+ export type IPaint = (rawText: string, attr: ITextAttr) => string;
37
+ export declare const paintNothing: IPaint;
38
+ export type IStyleSpecPainter = {
39
+ readonly [key in IStyleSpecKey]: (rawText: string) => string;
40
+ };
41
+ export declare function createStyleSpecPainter(styles: IResolvedStyles, paint: IPaint): IStyleSpecPainter;
13
42
  export {};
package/dist/styling.js CHANGED
@@ -1,31 +1,12 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
2
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.createStyleSpecPainter = exports.CONSOLE_COLORS = void 0;
27
- var colorette = __importStar(require("colorette"));
28
- var errors_1 = require("./errors");
3
+ exports.paintNothing = exports.PLAIN_ATTR = exports.ATTR_COLORS = exports.CONSOLE_COLORS = void 0;
4
+ exports.isPlainAttr = isPlainAttr;
5
+ exports.attrFlags = attrFlags;
6
+ exports.resolveStyles = resolveStyles;
7
+ exports.createStyleSpecPainter = createStyleSpecPainter;
8
+ const errors_1 = require("./errors");
9
+ const tools_1 = require("./tools");
29
10
  exports.CONSOLE_COLORS = [
30
11
  'bold',
31
12
  'dim',
@@ -68,68 +49,167 @@ exports.CONSOLE_COLORS = [
68
49
  'bgCyanBright',
69
50
  'bgWhiteBright',
70
51
  ];
71
- var STYLE_SPEC_KEYS = [
52
+ const STYLE_SPEC_KEYS = [
72
53
  'command_name',
73
54
  'command_summary',
74
55
  'banner_title',
75
56
  'banner_description',
76
57
  'banner_logo',
77
58
  'banner_footer',
59
+ 'section_title',
60
+ 'option_name',
61
+ 'option_label',
62
+ 'accent',
63
+ 'error',
78
64
  ];
79
- function createStyleSpecPainter(styleSpec) {
80
- styleSpec = styleSpec || {};
81
- var result = {};
82
- var _loop_1 = function (key) {
83
- var style = void 0;
84
- if (!styleSpec[key]) {
85
- style = [];
86
- }
87
- else if (typeof styleSpec[key] === 'string') {
88
- style = [styleSpec[key]];
65
+ const DEFAULT_STYLE_SPEC = {
66
+ command_name: 'bold',
67
+ banner_footer: 'italic',
68
+ banner_logo: 'cyan',
69
+ banner_title: ['bold', 'underline'],
70
+ section_title: ['bold', 'underline'],
71
+ option_name: 'bold',
72
+ option_label: 'underline',
73
+ error: ['red', 'bold'],
74
+ };
75
+ // *********************************************************************************************************************
76
+ /** Supported terminal colors. `default` preserves the user's configured foreground or background. */
77
+ exports.ATTR_COLORS = [
78
+ 'default',
79
+ 'black',
80
+ 'red',
81
+ 'green',
82
+ 'yellow',
83
+ 'blue',
84
+ 'magenta',
85
+ 'cyan',
86
+ 'white',
87
+ 'brightBlack',
88
+ 'brightRed',
89
+ 'brightGreen',
90
+ 'brightYellow',
91
+ 'brightBlue',
92
+ 'brightMagenta',
93
+ 'brightCyan',
94
+ 'brightWhite',
95
+ ];
96
+ const ATTR_FLAGS = ['bold', 'dim', 'italic', 'underline', 'inverse', 'hidden', 'strike'];
97
+ exports.PLAIN_ATTR = Object.freeze({
98
+ color: 'default',
99
+ bgColor: 'default',
100
+ bold: false,
101
+ dim: false,
102
+ italic: false,
103
+ underline: false,
104
+ inverse: false,
105
+ hidden: false,
106
+ strike: false,
107
+ });
108
+ function isPlainAttr(attr) {
109
+ return (attr.color === 'default' && attr.bgColor === 'default' && ATTR_FLAGS.every(flag => !attr[flag]));
110
+ }
111
+ function attrFlags(attr) {
112
+ return ATTR_FLAGS.filter(flag => attr[flag]);
113
+ }
114
+ /** Text attribute changes associated with each public style name. */
115
+ const CONSOLE_COLOR_EFFECTS = {
116
+ bold: { bold: true },
117
+ dim: { dim: true },
118
+ italic: { italic: true },
119
+ underline: { underline: true },
120
+ inverse: { inverse: true },
121
+ hidden: { hidden: true },
122
+ strikethrough: { strike: true },
123
+ black: { color: 'black' },
124
+ red: { color: 'red' },
125
+ green: { color: 'green' },
126
+ yellow: { color: 'yellow' },
127
+ blue: { color: 'blue' },
128
+ magenta: { color: 'magenta' },
129
+ cyan: { color: 'cyan' },
130
+ white: { color: 'white' },
131
+ gray: { color: 'brightBlack' },
132
+ bgBlack: { bgColor: 'black' },
133
+ bgRed: { bgColor: 'red' },
134
+ bgGreen: { bgColor: 'green' },
135
+ bgYellow: { bgColor: 'yellow' },
136
+ bgBlue: { bgColor: 'blue' },
137
+ bgMagenta: { bgColor: 'magenta' },
138
+ bgCyan: { bgColor: 'cyan' },
139
+ bgWhite: { bgColor: 'white' },
140
+ blackBright: { color: 'brightBlack' },
141
+ redBright: { color: 'brightRed' },
142
+ greenBright: { color: 'brightGreen' },
143
+ yellowBright: { color: 'brightYellow' },
144
+ blueBright: { color: 'brightBlue' },
145
+ magentaBright: { color: 'brightMagenta' },
146
+ cyanBright: { color: 'brightCyan' },
147
+ whiteBright: { color: 'brightWhite' },
148
+ bgBlackBright: { bgColor: 'brightBlack' },
149
+ bgRedBright: { bgColor: 'brightRed' },
150
+ bgGreenBright: { bgColor: 'brightGreen' },
151
+ bgYellowBright: { bgColor: 'brightYellow' },
152
+ bgBlueBright: { bgColor: 'brightBlue' },
153
+ bgMagentaBright: { bgColor: 'brightMagenta' },
154
+ bgCyanBright: { bgColor: 'brightCyan' },
155
+ bgWhiteBright: { bgColor: 'brightWhite' },
156
+ };
157
+ function isConsoleColor(value) {
158
+ return (typeof value === 'string' && Object.prototype.hasOwnProperty.call(CONSOLE_COLOR_EFFECTS, value));
159
+ }
160
+ function styleToAttr(key, style) {
161
+ if (style === undefined || style === null) {
162
+ return exports.PLAIN_ATTR;
163
+ }
164
+ const names = Array.isArray(style) ? style : [style];
165
+ let attr = exports.PLAIN_ATTR;
166
+ for (const name of names) {
167
+ if (!isConsoleColor(name)) {
168
+ // Reject unknown style names during program definition.
169
+ throw new errors_1.DefinitionError(`invalid value for a console color style "${key}": "${String(name)}". These are the supported values: ${exports.CONSOLE_COLORS.join(', ')}`);
89
170
  }
90
- else {
91
- style = styleSpec[key];
171
+ attr = { ...attr, ...CONSOLE_COLOR_EFFECTS[name] };
172
+ }
173
+ return attr;
174
+ }
175
+ /**
176
+ * Validate configured styles and merge them with defaults.
177
+ * `null` disables all default styles. A `null` entry disables only that style.
178
+ */
179
+ function resolveStyles(styleSpec) {
180
+ if (styleSpec !== undefined && styleSpec !== null && !(0, tools_1.isPlainObject)(styleSpec)) {
181
+ throw new errors_1.DefinitionError(`"styles" must be given as an object lookup of style names`);
182
+ }
183
+ const given = styleSpec || {};
184
+ for (const key of Object.keys(given)) {
185
+ if (!STYLE_SPEC_KEYS.some(known => known === key)) {
186
+ throw new errors_1.DefinitionError(`unknown style "${key}". These are the supported styles: ${STYLE_SPEC_KEYS.join(', ')}`);
92
187
  }
93
- var methods = style.map(function (methodName) {
94
- var method = colorette[methodName];
95
- if (!method) {
96
- // NOTE: If user somehow supplies a bad style, throw the error right away, instead of waiting.
97
- throw new errors_1.InvalidConsoleColorError(methodName, exports.CONSOLE_COLORS.slice());
98
- }
99
- return method;
100
- });
101
- result[key] = function (str) {
102
- if (!str || !methods.length) {
188
+ }
189
+ const defaults = styleSpec === null ? {} : DEFAULT_STYLE_SPEC;
190
+ const resolved = (0, tools_1.fromKeys)(STYLE_SPEC_KEYS, key => styleToAttr(key, given[key] !== undefined ? given[key] : defaults[key]));
191
+ if (given['accent'] === undefined && styleSpec !== null) {
192
+ // Default the interactive accent to the logo's foreground color.
193
+ return { ...resolved, accent: { ...exports.PLAIN_ATTR, color: resolved.banner_logo.color } };
194
+ }
195
+ return resolved;
196
+ }
197
+ const paintNothing = rawText => rawText;
198
+ exports.paintNothing = paintNothing;
199
+ function createStyleSpecPainter(styles, paint) {
200
+ return (0, tools_1.fromKeys)(STYLE_SPEC_KEYS, key => {
201
+ const attr = styles[key];
202
+ return (rawText) => {
203
+ if (!rawText || isPlainAttr(attr)) {
103
204
  // Fast pass
104
- return str || '';
205
+ return rawText || '';
105
206
  }
106
- if (str.indexOf('\n') < 0) {
107
- // Simple case
108
- for (var _i = 0, methods_1 = methods; _i < methods_1.length; _i++) {
109
- var method = methods_1[_i];
110
- str = method(str);
111
- }
112
- return str;
113
- }
114
- // Multiline strings can be a bit finicky when processed into tables.
115
- // We need to do a dance where we style each line individually.
116
- return str
207
+ // Style each line separately so escape sequences do not affect adjacent columns.
208
+ return rawText
117
209
  .split('\n')
118
- .map(function (line) {
119
- for (var _i = 0, methods_2 = methods; _i < methods_2.length; _i++) {
120
- var method = methods_2[_i];
121
- line = method(line);
122
- }
123
- return colorette.reset('') + line + colorette.reset('');
124
- })
210
+ .map(line => (line ? paint(line, attr) : line))
125
211
  .join('\n');
126
212
  };
127
- };
128
- for (var _i = 0, STYLE_SPEC_KEYS_1 = STYLE_SPEC_KEYS; _i < STYLE_SPEC_KEYS_1.length; _i++) {
129
- var key = STYLE_SPEC_KEYS_1[_i];
130
- _loop_1(key);
131
- }
132
- return result;
213
+ });
133
214
  }
134
- exports.createStyleSpecPainter = createStyleSpecPainter;
135
215
  //# sourceMappingURL=styling.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"styling.js","sourceRoot":"","sources":["../src/styling.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mDAAuC;AAEvC,mCAAoD;AAEvC,QAAA,cAAc,GAAG;IAC5B,MAAM;IACN,KAAK;IACL,QAAQ;IACR,WAAW;IACX,SAAS;IACT,QAAQ;IACR,eAAe;IACf,OAAO;IACP,KAAK;IACL,OAAO;IACP,QAAQ;IACR,MAAM;IACN,SAAS;IACT,MAAM;IACN,OAAO;IACP,MAAM;IACN,SAAS;IACT,OAAO;IACP,SAAS;IACT,UAAU;IACV,QAAQ;IACR,WAAW;IACX,QAAQ;IACR,SAAS;IACT,aAAa;IACb,WAAW;IACX,aAAa;IACb,cAAc;IACd,YAAY;IACZ,eAAe;IACf,YAAY;IACZ,aAAa;IACb,eAAe;IACf,aAAa;IACb,eAAe;IACf,gBAAgB;IA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