the-grid-cc 1.7.1 → 1.7.3

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 (49) hide show
  1. package/01-SUMMARY.md +95 -0
  2. package/README.md +31 -13
  3. package/assets/terminal.svg +120 -0
  4. package/commands/grid/VERSION +1 -1
  5. package/commands/grid/help.md +7 -0
  6. package/commands/grid/mc.md +31 -3
  7. package/commands/grid/model.md +188 -0
  8. package/commands/grid/refine.md +4 -4
  9. package/package.json +1 -1
  10. package/tools/grid-viz/PLAN.md +235 -0
  11. package/tools/grid-viz/README.md +84 -0
  12. package/tools/grid-viz/VERIFICATION.md +197 -0
  13. package/tools/grid-viz/grid-viz.js +248 -0
  14. package/tools/grid-viz/node_modules/.package-lock.json +78 -0
  15. package/tools/grid-viz/node_modules/ansi-styles/index.d.ts +345 -0
  16. package/tools/grid-viz/node_modules/ansi-styles/index.js +163 -0
  17. package/tools/grid-viz/node_modules/ansi-styles/license +9 -0
  18. package/tools/grid-viz/node_modules/ansi-styles/package.json +56 -0
  19. package/tools/grid-viz/node_modules/ansi-styles/readme.md +152 -0
  20. package/tools/grid-viz/node_modules/chalk/index.d.ts +415 -0
  21. package/tools/grid-viz/node_modules/chalk/license +9 -0
  22. package/tools/grid-viz/node_modules/chalk/package.json +68 -0
  23. package/tools/grid-viz/node_modules/chalk/readme.md +341 -0
  24. package/tools/grid-viz/node_modules/chalk/source/index.js +229 -0
  25. package/tools/grid-viz/node_modules/chalk/source/templates.js +134 -0
  26. package/tools/grid-viz/node_modules/chalk/source/util.js +39 -0
  27. package/tools/grid-viz/node_modules/color-convert/CHANGELOG.md +54 -0
  28. package/tools/grid-viz/node_modules/color-convert/LICENSE +21 -0
  29. package/tools/grid-viz/node_modules/color-convert/README.md +68 -0
  30. package/tools/grid-viz/node_modules/color-convert/conversions.js +839 -0
  31. package/tools/grid-viz/node_modules/color-convert/index.js +81 -0
  32. package/tools/grid-viz/node_modules/color-convert/package.json +48 -0
  33. package/tools/grid-viz/node_modules/color-convert/route.js +97 -0
  34. package/tools/grid-viz/node_modules/color-name/LICENSE +8 -0
  35. package/tools/grid-viz/node_modules/color-name/README.md +11 -0
  36. package/tools/grid-viz/node_modules/color-name/index.js +152 -0
  37. package/tools/grid-viz/node_modules/color-name/package.json +28 -0
  38. package/tools/grid-viz/node_modules/has-flag/index.d.ts +39 -0
  39. package/tools/grid-viz/node_modules/has-flag/index.js +8 -0
  40. package/tools/grid-viz/node_modules/has-flag/license +9 -0
  41. package/tools/grid-viz/node_modules/has-flag/package.json +46 -0
  42. package/tools/grid-viz/node_modules/has-flag/readme.md +89 -0
  43. package/tools/grid-viz/node_modules/supports-color/browser.js +5 -0
  44. package/tools/grid-viz/node_modules/supports-color/index.js +135 -0
  45. package/tools/grid-viz/node_modules/supports-color/license +9 -0
  46. package/tools/grid-viz/node_modules/supports-color/package.json +53 -0
  47. package/tools/grid-viz/node_modules/supports-color/readme.md +76 -0
  48. package/tools/grid-viz/package-lock.json +89 -0
  49. package/tools/grid-viz/package.json +23 -0
@@ -0,0 +1,163 @@
1
+ 'use strict';
2
+
3
+ const wrapAnsi16 = (fn, offset) => (...args) => {
4
+ const code = fn(...args);
5
+ return `\u001B[${code + offset}m`;
6
+ };
7
+
8
+ const wrapAnsi256 = (fn, offset) => (...args) => {
9
+ const code = fn(...args);
10
+ return `\u001B[${38 + offset};5;${code}m`;
11
+ };
12
+
13
+ const wrapAnsi16m = (fn, offset) => (...args) => {
14
+ const rgb = fn(...args);
15
+ return `\u001B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`;
16
+ };
17
+
18
+ const ansi2ansi = n => n;
19
+ const rgb2rgb = (r, g, b) => [r, g, b];
20
+
21
+ const setLazyProperty = (object, property, get) => {
22
+ Object.defineProperty(object, property, {
23
+ get: () => {
24
+ const value = get();
25
+
26
+ Object.defineProperty(object, property, {
27
+ value,
28
+ enumerable: true,
29
+ configurable: true
30
+ });
31
+
32
+ return value;
33
+ },
34
+ enumerable: true,
35
+ configurable: true
36
+ });
37
+ };
38
+
39
+ /** @type {typeof import('color-convert')} */
40
+ let colorConvert;
41
+ const makeDynamicStyles = (wrap, targetSpace, identity, isBackground) => {
42
+ if (colorConvert === undefined) {
43
+ colorConvert = require('color-convert');
44
+ }
45
+
46
+ const offset = isBackground ? 10 : 0;
47
+ const styles = {};
48
+
49
+ for (const [sourceSpace, suite] of Object.entries(colorConvert)) {
50
+ const name = sourceSpace === 'ansi16' ? 'ansi' : sourceSpace;
51
+ if (sourceSpace === targetSpace) {
52
+ styles[name] = wrap(identity, offset);
53
+ } else if (typeof suite === 'object') {
54
+ styles[name] = wrap(suite[targetSpace], offset);
55
+ }
56
+ }
57
+
58
+ return styles;
59
+ };
60
+
61
+ function assembleStyles() {
62
+ const codes = new Map();
63
+ const styles = {
64
+ modifier: {
65
+ reset: [0, 0],
66
+ // 21 isn't widely supported and 22 does the same thing
67
+ bold: [1, 22],
68
+ dim: [2, 22],
69
+ italic: [3, 23],
70
+ underline: [4, 24],
71
+ inverse: [7, 27],
72
+ hidden: [8, 28],
73
+ strikethrough: [9, 29]
74
+ },
75
+ color: {
76
+ black: [30, 39],
77
+ red: [31, 39],
78
+ green: [32, 39],
79
+ yellow: [33, 39],
80
+ blue: [34, 39],
81
+ magenta: [35, 39],
82
+ cyan: [36, 39],
83
+ white: [37, 39],
84
+
85
+ // Bright color
86
+ blackBright: [90, 39],
87
+ redBright: [91, 39],
88
+ greenBright: [92, 39],
89
+ yellowBright: [93, 39],
90
+ blueBright: [94, 39],
91
+ magentaBright: [95, 39],
92
+ cyanBright: [96, 39],
93
+ whiteBright: [97, 39]
94
+ },
95
+ bgColor: {
96
+ bgBlack: [40, 49],
97
+ bgRed: [41, 49],
98
+ bgGreen: [42, 49],
99
+ bgYellow: [43, 49],
100
+ bgBlue: [44, 49],
101
+ bgMagenta: [45, 49],
102
+ bgCyan: [46, 49],
103
+ bgWhite: [47, 49],
104
+
105
+ // Bright color
106
+ bgBlackBright: [100, 49],
107
+ bgRedBright: [101, 49],
108
+ bgGreenBright: [102, 49],
109
+ bgYellowBright: [103, 49],
110
+ bgBlueBright: [104, 49],
111
+ bgMagentaBright: [105, 49],
112
+ bgCyanBright: [106, 49],
113
+ bgWhiteBright: [107, 49]
114
+ }
115
+ };
116
+
117
+ // Alias bright black as gray (and grey)
118
+ styles.color.gray = styles.color.blackBright;
119
+ styles.bgColor.bgGray = styles.bgColor.bgBlackBright;
120
+ styles.color.grey = styles.color.blackBright;
121
+ styles.bgColor.bgGrey = styles.bgColor.bgBlackBright;
122
+
123
+ for (const [groupName, group] of Object.entries(styles)) {
124
+ for (const [styleName, style] of Object.entries(group)) {
125
+ styles[styleName] = {
126
+ open: `\u001B[${style[0]}m`,
127
+ close: `\u001B[${style[1]}m`
128
+ };
129
+
130
+ group[styleName] = styles[styleName];
131
+
132
+ codes.set(style[0], style[1]);
133
+ }
134
+
135
+ Object.defineProperty(styles, groupName, {
136
+ value: group,
137
+ enumerable: false
138
+ });
139
+ }
140
+
141
+ Object.defineProperty(styles, 'codes', {
142
+ value: codes,
143
+ enumerable: false
144
+ });
145
+
146
+ styles.color.close = '\u001B[39m';
147
+ styles.bgColor.close = '\u001B[49m';
148
+
149
+ setLazyProperty(styles.color, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, false));
150
+ setLazyProperty(styles.color, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, false));
151
+ setLazyProperty(styles.color, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, false));
152
+ setLazyProperty(styles.bgColor, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, true));
153
+ setLazyProperty(styles.bgColor, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, true));
154
+ setLazyProperty(styles.bgColor, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, true));
155
+
156
+ return styles;
157
+ }
158
+
159
+ // Make the export immutable
160
+ Object.defineProperty(module, 'exports', {
161
+ enumerable: true,
162
+ get: assembleStyles
163
+ });
@@ -0,0 +1,9 @@
1
+ MIT License
2
+
3
+ Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,56 @@
1
+ {
2
+ "name": "ansi-styles",
3
+ "version": "4.3.0",
4
+ "description": "ANSI escape codes for styling strings in the terminal",
5
+ "license": "MIT",
6
+ "repository": "chalk/ansi-styles",
7
+ "funding": "https://github.com/chalk/ansi-styles?sponsor=1",
8
+ "author": {
9
+ "name": "Sindre Sorhus",
10
+ "email": "sindresorhus@gmail.com",
11
+ "url": "sindresorhus.com"
12
+ },
13
+ "engines": {
14
+ "node": ">=8"
15
+ },
16
+ "scripts": {
17
+ "test": "xo && ava && tsd",
18
+ "screenshot": "svg-term --command='node screenshot' --out=screenshot.svg --padding=3 --width=55 --height=3 --at=1000 --no-cursor"
19
+ },
20
+ "files": [
21
+ "index.js",
22
+ "index.d.ts"
23
+ ],
24
+ "keywords": [
25
+ "ansi",
26
+ "styles",
27
+ "color",
28
+ "colour",
29
+ "colors",
30
+ "terminal",
31
+ "console",
32
+ "cli",
33
+ "string",
34
+ "tty",
35
+ "escape",
36
+ "formatting",
37
+ "rgb",
38
+ "256",
39
+ "shell",
40
+ "xterm",
41
+ "log",
42
+ "logging",
43
+ "command-line",
44
+ "text"
45
+ ],
46
+ "dependencies": {
47
+ "color-convert": "^2.0.1"
48
+ },
49
+ "devDependencies": {
50
+ "@types/color-convert": "^1.9.0",
51
+ "ava": "^2.3.0",
52
+ "svg-term-cli": "^2.1.1",
53
+ "tsd": "^0.11.0",
54
+ "xo": "^0.25.3"
55
+ }
56
+ }
@@ -0,0 +1,152 @@
1
+ # ansi-styles [![Build Status](https://travis-ci.org/chalk/ansi-styles.svg?branch=master)](https://travis-ci.org/chalk/ansi-styles)
2
+
3
+ > [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code#Colors_and_Styles) for styling strings in the terminal
4
+
5
+ You probably want the higher-level [chalk](https://github.com/chalk/chalk) module for styling your strings.
6
+
7
+ <img src="screenshot.svg" width="900">
8
+
9
+ ## Install
10
+
11
+ ```
12
+ $ npm install ansi-styles
13
+ ```
14
+
15
+ ## Usage
16
+
17
+ ```js
18
+ const style = require('ansi-styles');
19
+
20
+ console.log(`${style.green.open}Hello world!${style.green.close}`);
21
+
22
+
23
+ // Color conversion between 16/256/truecolor
24
+ // NOTE: If conversion goes to 16 colors or 256 colors, the original color
25
+ // may be degraded to fit that color palette. This means terminals
26
+ // that do not support 16 million colors will best-match the
27
+ // original color.
28
+ console.log(style.bgColor.ansi.hsl(120, 80, 72) + 'Hello world!' + style.bgColor.close);
29
+ console.log(style.color.ansi256.rgb(199, 20, 250) + 'Hello world!' + style.color.close);
30
+ console.log(style.color.ansi16m.hex('#abcdef') + 'Hello world!' + style.color.close);
31
+ ```
32
+
33
+ ## API
34
+
35
+ Each style has an `open` and `close` property.
36
+
37
+ ## Styles
38
+
39
+ ### Modifiers
40
+
41
+ - `reset`
42
+ - `bold`
43
+ - `dim`
44
+ - `italic` *(Not widely supported)*
45
+ - `underline`
46
+ - `inverse`
47
+ - `hidden`
48
+ - `strikethrough` *(Not widely supported)*
49
+
50
+ ### Colors
51
+
52
+ - `black`
53
+ - `red`
54
+ - `green`
55
+ - `yellow`
56
+ - `blue`
57
+ - `magenta`
58
+ - `cyan`
59
+ - `white`
60
+ - `blackBright` (alias: `gray`, `grey`)
61
+ - `redBright`
62
+ - `greenBright`
63
+ - `yellowBright`
64
+ - `blueBright`
65
+ - `magentaBright`
66
+ - `cyanBright`
67
+ - `whiteBright`
68
+
69
+ ### Background colors
70
+
71
+ - `bgBlack`
72
+ - `bgRed`
73
+ - `bgGreen`
74
+ - `bgYellow`
75
+ - `bgBlue`
76
+ - `bgMagenta`
77
+ - `bgCyan`
78
+ - `bgWhite`
79
+ - `bgBlackBright` (alias: `bgGray`, `bgGrey`)
80
+ - `bgRedBright`
81
+ - `bgGreenBright`
82
+ - `bgYellowBright`
83
+ - `bgBlueBright`
84
+ - `bgMagentaBright`
85
+ - `bgCyanBright`
86
+ - `bgWhiteBright`
87
+
88
+ ## Advanced usage
89
+
90
+ By default, you get a map of styles, but the styles are also available as groups. They are non-enumerable so they don't show up unless you access them explicitly. This makes it easier to expose only a subset in a higher-level module.
91
+
92
+ - `style.modifier`
93
+ - `style.color`
94
+ - `style.bgColor`
95
+
96
+ ###### Example
97
+
98
+ ```js
99
+ console.log(style.color.green.open);
100
+ ```
101
+
102
+ Raw escape codes (i.e. without the CSI escape prefix `\u001B[` and render mode postfix `m`) are available under `style.codes`, which returns a `Map` with the open codes as keys and close codes as values.
103
+
104
+ ###### Example
105
+
106
+ ```js
107
+ console.log(style.codes.get(36));
108
+ //=> 39
109
+ ```
110
+
111
+ ## [256 / 16 million (TrueColor) support](https://gist.github.com/XVilka/8346728)
112
+
113
+ `ansi-styles` uses the [`color-convert`](https://github.com/Qix-/color-convert) package to allow for converting between various colors and ANSI escapes, with support for 256 and 16 million colors.
114
+
115
+ The following color spaces from `color-convert` are supported:
116
+
117
+ - `rgb`
118
+ - `hex`
119
+ - `keyword`
120
+ - `hsl`
121
+ - `hsv`
122
+ - `hwb`
123
+ - `ansi`
124
+ - `ansi256`
125
+
126
+ To use these, call the associated conversion function with the intended output, for example:
127
+
128
+ ```js
129
+ style.color.ansi.rgb(100, 200, 15); // RGB to 16 color ansi foreground code
130
+ style.bgColor.ansi.rgb(100, 200, 15); // RGB to 16 color ansi background code
131
+
132
+ style.color.ansi256.hsl(120, 100, 60); // HSL to 256 color ansi foreground code
133
+ style.bgColor.ansi256.hsl(120, 100, 60); // HSL to 256 color ansi foreground code
134
+
135
+ style.color.ansi16m.hex('#C0FFEE'); // Hex (RGB) to 16 million color foreground code
136
+ style.bgColor.ansi16m.hex('#C0FFEE'); // Hex (RGB) to 16 million color background code
137
+ ```
138
+
139
+ ## Related
140
+
141
+ - [ansi-escapes](https://github.com/sindresorhus/ansi-escapes) - ANSI escape codes for manipulating the terminal
142
+
143
+ ## Maintainers
144
+
145
+ - [Sindre Sorhus](https://github.com/sindresorhus)
146
+ - [Josh Junon](https://github.com/qix-)
147
+
148
+ ## For enterprise
149
+
150
+ Available as part of the Tidelift Subscription.
151
+
152
+ The maintainers of `ansi-styles` and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-ansi-styles?utm_source=npm-ansi-styles&utm_medium=referral&utm_campaign=enterprise&utm_term=repo)