@fc3/wireframe-renderer 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +47 -5
- package/bin/bootstrap/terminal-demo +7 -0
- package/dist/.last-compile-time +1 -1
- package/dist/.last-publish-time +1 -1
- package/dist/src/bootstrap/terminal-demo.d.ts +1 -0
- package/dist/src/bootstrap/terminal-demo.js +14 -0
- package/dist/src/bootstrap/terminal-demo.js.map +1 -0
- package/dist/src/canvas-renderer.d.ts +2 -4
- package/dist/src/canvas-renderer.js +26 -72
- package/dist/src/canvas-renderer.js.map +1 -1
- package/dist/src/constant/default-render-options.d.ts +3 -0
- package/dist/src/constant/default-render-options.js +8 -0
- package/dist/src/constant/default-render-options.js.map +1 -0
- package/dist/src/terminal/braille-canvas.d.ts +17 -0
- package/dist/src/terminal/braille-canvas.js +137 -0
- package/dist/src/terminal/braille-canvas.js.map +1 -0
- package/dist/src/terminal/constant/terminal-key-rates.d.ts +6 -0
- package/dist/src/terminal/constant/terminal-key-rates.js +9 -0
- package/dist/src/terminal/constant/terminal-key-rates.js.map +1 -0
- package/dist/src/terminal/constant/view-preset-keys.d.ts +3 -0
- package/dist/src/terminal/constant/view-preset-keys.js +17 -0
- package/dist/src/terminal/constant/view-preset-keys.js.map +1 -0
- package/dist/src/terminal/enum/terminal-focus.d.ts +5 -0
- package/dist/src/terminal/enum/terminal-focus.js +9 -0
- package/dist/src/terminal/enum/terminal-focus.js.map +1 -0
- package/dist/src/terminal/index.d.ts +3 -0
- package/dist/src/terminal/index.js +11 -0
- package/dist/src/terminal/index.js.map +1 -0
- package/dist/src/terminal/render-frame.d.ts +6 -0
- package/dist/src/terminal/render-frame.js +46 -0
- package/dist/src/terminal/render-frame.js.map +1 -0
- package/dist/src/terminal/terminal-viewer.d.ts +38 -0
- package/dist/src/terminal/terminal-viewer.js +290 -0
- package/dist/src/terminal/terminal-viewer.js.map +1 -0
- package/dist/src/terminal/type/rgb-color.d.ts +6 -0
- package/dist/src/terminal/type/rgb-color.js +3 -0
- package/dist/src/terminal/type/rgb-color.js.map +1 -0
- package/dist/src/terminal/utility/blend-color.d.ts +3 -0
- package/dist/src/terminal/utility/blend-color.js +19 -0
- package/dist/src/terminal/utility/blend-color.js.map +1 -0
- package/dist/src/terminal/utility/clip-segment.d.ts +5 -0
- package/dist/src/terminal/utility/clip-segment.js +38 -0
- package/dist/src/terminal/utility/clip-segment.js.map +1 -0
- package/dist/src/terminal/utility/escape-tags.d.ts +2 -0
- package/dist/src/terminal/utility/escape-tags.js +14 -0
- package/dist/src/terminal/utility/escape-tags.js.map +1 -0
- package/dist/src/terminal/utility/format-component-row.d.ts +3 -0
- package/dist/src/terminal/utility/format-component-row.js +32 -0
- package/dist/src/terminal/utility/format-component-row.js.map +1 -0
- package/dist/src/terminal/utility/format-hex-color.d.ts +3 -0
- package/dist/src/terminal/utility/format-hex-color.js +14 -0
- package/dist/src/terminal/utility/format-hex-color.js.map +1 -0
- package/dist/src/terminal/utility/format-status-line.d.ts +3 -0
- package/dist/src/terminal/utility/format-status-line.js +24 -0
- package/dist/src/terminal/utility/format-status-line.js.map +1 -0
- package/dist/src/terminal/utility/parse-color.d.ts +3 -0
- package/dist/src/terminal/utility/parse-color.js +45 -0
- package/dist/src/terminal/utility/parse-color.js.map +1 -0
- package/dist/src/terminal/utility/resolve-terminal-color.d.ts +2 -0
- package/dist/src/terminal/utility/resolve-terminal-color.js +20 -0
- package/dist/src/terminal/utility/resolve-terminal-color.js.map +1 -0
- package/dist/src/type/frame-dot.d.ts +6 -0
- package/dist/src/type/frame-dot.js +3 -0
- package/dist/src/type/frame-dot.js.map +1 -0
- package/dist/src/type/frame-label.d.ts +7 -0
- package/dist/src/type/frame-label.js +3 -0
- package/dist/src/type/frame-label.js.map +1 -0
- package/dist/src/type/frame-path.d.ts +8 -0
- package/dist/src/type/frame-path.js +3 -0
- package/dist/src/type/frame-path.js.map +1 -0
- package/dist/src/type/frame.d.ts +9 -0
- package/dist/src/type/frame.js +3 -0
- package/dist/src/type/frame.js.map +1 -0
- package/dist/src/type/viewer-state.d.ts +11 -0
- package/dist/src/type/viewer-state.js +3 -0
- package/dist/src/type/viewer-state.js.map +1 -0
- package/dist/src/utility/build-frame.d.ts +8 -0
- package/dist/src/utility/build-frame.js +75 -0
- package/dist/src/utility/build-frame.js.map +1 -0
- package/dist/src/utility/create-viewer-state.d.ts +4 -0
- package/dist/src/utility/create-viewer-state.js +29 -0
- package/dist/src/utility/create-viewer-state.js.map +1 -0
- package/dist/src/utility/project-polyline.d.ts +5 -0
- package/dist/src/utility/project-polyline.js +22 -0
- package/dist/src/utility/project-polyline.js.map +1 -0
- package/dist/src/wireframe-viewer.js +4 -20
- package/dist/src/wireframe-viewer.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +23 -3
package/README.md
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
# @fc3/wireframe-renderer
|
|
2
2
|
|
|
3
|
-
A dependency-light 3D wireframe viewer for the browser
|
|
4
|
-
scene object describing nested components built from a
|
|
5
|
-
primitives, and renders them
|
|
6
|
-
|
|
3
|
+
A dependency-light 3D wireframe viewer for the browser and the terminal. It
|
|
4
|
+
takes a typed scene object describing nested components built from a
|
|
5
|
+
handful of primitives, and renders them with an orbit camera and a list of
|
|
6
|
+
components that can each be toggled on and off: to a 2D canvas with a
|
|
7
|
+
sidebar in the browser, or in braille characters in a terminal.
|
|
7
8
|
|
|
8
9
|
The renderer knows nothing about what it is drawing. Grouping, colors,
|
|
9
10
|
labels, and default visibility all come from the scene you hand it.
|
|
@@ -36,6 +37,46 @@ camera for scripted views.
|
|
|
36
37
|
This package ships CommonJS output under `dist/`. Bundling for the browser is
|
|
37
38
|
left to the consuming project.
|
|
38
39
|
|
|
40
|
+
## Terminal
|
|
41
|
+
|
|
42
|
+
The terminal viewer lives under its own entry point, so browser bundles never
|
|
43
|
+
pull in its terminal dependency:
|
|
44
|
+
|
|
45
|
+
```ts
|
|
46
|
+
import {HOUSE_COMPUTER_SCENE} from '@fc3/wireframe-renderer';
|
|
47
|
+
import {TerminalViewer} from '@fc3/wireframe-renderer/terminal';
|
|
48
|
+
|
|
49
|
+
const viewer = new TerminalViewer(HOUSE_COMPUTER_SCENE, {
|
|
50
|
+
onExit: () => process.exit(0)
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
viewer.mount();
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
It takes the same scene as the browser viewer and draws it with braille
|
|
57
|
+
characters, two dots wide and four tall per cell, which keeps proportions
|
|
58
|
+
square in a typical terminal font. Colors are matched to the nearest of the
|
|
59
|
+
terminal's 256 colors; translucent components are faded toward the
|
|
60
|
+
background, since a terminal cannot blend.
|
|
61
|
+
|
|
62
|
+
| key | action |
|
|
63
|
+
| ------------------ | ----------------------------------------------- |
|
|
64
|
+
| arrows | orbit (while the scene has focus) |
|
|
65
|
+
| `w` `a` `s` `d` | pan |
|
|
66
|
+
| `+` / `-` | zoom in / out |
|
|
67
|
+
| `1`–`7` | front, back, left, right, top, under, isometric |
|
|
68
|
+
| `p` / `t` / `g` | perspective, labels, ground reference |
|
|
69
|
+
| tab | move focus between the scene and the components |
|
|
70
|
+
| space / enter | show or hide the selected component |
|
|
71
|
+
| `q` / ctrl-c | quit |
|
|
72
|
+
|
|
73
|
+
`input` and `output` options accept streams other than the process's own,
|
|
74
|
+
`setComponentVisible(id, visible)` and `getCamera()` work as in the browser
|
|
75
|
+
viewer, and `unmount()` restores the terminal. `renderFrame(frame, columns,
|
|
76
|
+
rows)` is also exported for drawing a single frame to tagged text.
|
|
77
|
+
|
|
78
|
+
Try it with `./bin/bootstrap/terminal-demo`.
|
|
79
|
+
|
|
39
80
|
## Scene shape
|
|
40
81
|
|
|
41
82
|
```ts
|
|
@@ -121,4 +162,5 @@ npm install
|
|
|
121
162
|
```
|
|
122
163
|
|
|
123
164
|
Unit tests live under `test/unit/` mirroring `src/`. The canvas and DOM
|
|
124
|
-
classes are not unit tested; everything beneath them is
|
|
165
|
+
classes are not unit tested; everything beneath them is, including the
|
|
166
|
+
terminal viewer, which runs against in-memory streams.
|
package/dist/.last-compile-time
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
1795107207
|
package/dist/.last-publish-time
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
1795107952
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
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
|
+
const terminal_viewer_1 = __importDefault(require("./../terminal/terminal-viewer.js"));
|
|
7
|
+
const house_computer_1 = __importDefault(require("./../example/house-computer.js"));
|
|
8
|
+
const viewer = new terminal_viewer_1.default(house_computer_1.default, {
|
|
9
|
+
onExit: () => {
|
|
10
|
+
process.exit(0);
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
viewer.mount();
|
|
14
|
+
//# sourceMappingURL=terminal-demo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"terminal-demo.js","sourceRoot":"","sources":["../../../src/bootstrap/terminal-demo.ts"],"names":[],"mappings":";;;;;AAAA,+EAAsD;AACtD,4EAA0D;AAE1D,MAAM,MAAM,GAAG,IAAI,yBAAc,CAAC,wBAAoB,EAAE;IACvD,MAAM,EAAE,GAAG,EAAE;QACZ,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACjB,CAAC;CACD,CAAC,CAAC;AAEH,MAAM,CAAC,KAAK,EAAE,CAAC"}
|
|
@@ -11,12 +11,10 @@ declare class CanvasRenderer {
|
|
|
11
11
|
render(components: DisplayComponent[], visibility: VisibilityMap, options: RenderOptions, bounding_box: BoundingBox): void;
|
|
12
12
|
private resizeToDisplaySize;
|
|
13
13
|
private clear;
|
|
14
|
-
private drawGround;
|
|
15
|
-
private drawComponent;
|
|
16
14
|
private drawLabel;
|
|
17
15
|
private drawDot;
|
|
18
|
-
private
|
|
19
|
-
private
|
|
16
|
+
private strokePath;
|
|
17
|
+
private traceRun;
|
|
20
18
|
private drawAxisTriad;
|
|
21
19
|
}
|
|
22
20
|
export default CanvasRenderer;
|
|
@@ -6,12 +6,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const errors_1 = require("@fc3/errors");
|
|
7
7
|
const axis_1 = __importDefault(require("./enum/axis.js"));
|
|
8
8
|
const theme_1 = __importDefault(require("./constant/theme.js"));
|
|
9
|
+
const build_frame_1 = __importDefault(require("./utility/build-frame.js"));
|
|
9
10
|
const axis_colors_1 = __importDefault(require("./constant/axis-colors.js"));
|
|
10
|
-
const is_component_shown_1 = __importDefault(require("./utility/is-component-shown.js"));
|
|
11
11
|
const rendering_defaults_1 = __importDefault(require("./constant/rendering-defaults.js"));
|
|
12
|
-
const get_bounding_box_size_1 = __importDefault(require("./utility/get-bounding-box-size.js"));
|
|
13
|
-
const get_bounding_box_center_1 = __importDefault(require("./utility/get-bounding-box-center.js"));
|
|
14
|
-
const build_rectangle_outline_1 = __importDefault(require("./utility/build-rectangle-outline.js"));
|
|
15
12
|
const AXIS_DIRECTIONS = {
|
|
16
13
|
[axis_1.default.X]: { x: 1, y: 0, z: 0 },
|
|
17
14
|
[axis_1.default.Y]: { x: 0, y: 1, z: 0 },
|
|
@@ -34,20 +31,16 @@ class CanvasRenderer {
|
|
|
34
31
|
render(components, visibility, options, bounding_box) {
|
|
35
32
|
this.resizeToDisplaySize();
|
|
36
33
|
this.clear();
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
const shown_components = components.filter((component) => {
|
|
41
|
-
return (0, is_component_shown_1.default)(component, visibility);
|
|
34
|
+
const frame = (0, build_frame_1.default)(this.camera, components, visibility, options, bounding_box);
|
|
35
|
+
frame.paths.forEach((path) => {
|
|
36
|
+
this.strokePath(path);
|
|
42
37
|
});
|
|
43
|
-
|
|
44
|
-
this.
|
|
38
|
+
frame.dots.forEach((dot) => {
|
|
39
|
+
this.drawDot(dot);
|
|
40
|
+
});
|
|
41
|
+
frame.labels.forEach((label) => {
|
|
42
|
+
this.drawLabel(label);
|
|
45
43
|
});
|
|
46
|
-
if (options.show_labels) {
|
|
47
|
-
shown_components.forEach((component) => {
|
|
48
|
-
this.drawLabel(component);
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
44
|
this.drawAxisTriad();
|
|
52
45
|
}
|
|
53
46
|
resizeToDisplaySize() {
|
|
@@ -68,89 +61,50 @@ class CanvasRenderer {
|
|
|
68
61
|
const { width, height } = this.camera.getViewport();
|
|
69
62
|
this.context.clearRect(0, 0, width, height);
|
|
70
63
|
}
|
|
71
|
-
|
|
72
|
-
const center = (0, get_bounding_box_center_1.default)(bounding_box);
|
|
73
|
-
const size = (0, get_bounding_box_size_1.default)(bounding_box);
|
|
74
|
-
const ground_center = { ...center, y: bounding_box.minimum.y };
|
|
75
|
-
const margin = rendering_defaults_1.default.GROUND_MARGIN_FACTOR;
|
|
76
|
-
const outline = (0, build_rectangle_outline_1.default)(ground_center, axis_1.default.X, axis_1.default.Z, size.x * margin, size.z * margin);
|
|
77
|
-
this.strokePolylines([outline], theme_1.default.LINE, 1, 1);
|
|
78
|
-
}
|
|
79
|
-
drawComponent(component) {
|
|
80
|
-
const { outlines, strokes, color, alpha, line_width } = component;
|
|
81
|
-
this.strokePolylines(outlines, color, alpha, line_width);
|
|
82
|
-
strokes.forEach((stroke) => {
|
|
83
|
-
const stroke_alpha = Math.min(1, alpha);
|
|
84
|
-
const first_point = stroke.points[0];
|
|
85
|
-
const last_point = stroke.points[stroke.points.length - 1];
|
|
86
|
-
this.strokePolylines([stroke.points], color, stroke_alpha, stroke.width);
|
|
87
|
-
this.drawDot(first_point, color);
|
|
88
|
-
this.drawDot(last_point, color);
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
drawLabel(component) {
|
|
92
|
-
const screen_point = this.camera.project(component.centroid);
|
|
93
|
-
if (screen_point === null) {
|
|
94
|
-
return;
|
|
95
|
-
}
|
|
64
|
+
drawLabel(label) {
|
|
96
65
|
const { context } = this;
|
|
66
|
+
const { point, text, color } = label;
|
|
97
67
|
const font_size = rendering_defaults_1.default.LABEL_FONT_SIZE;
|
|
98
|
-
const text = component.label;
|
|
99
68
|
context.font = `${font_size}px ${theme_1.default.FONT_FAMILY}`;
|
|
100
69
|
context.textBaseline = 'middle';
|
|
101
70
|
const text_width = context.measureText(text).width;
|
|
102
71
|
context.fillStyle = theme_1.default.BACKGROUND;
|
|
103
72
|
context.globalAlpha = LABEL_BACKGROUND_ALPHA;
|
|
104
|
-
context.fillRect(
|
|
73
|
+
context.fillRect(point.x + 5, point.y - font_size * 0.7, text_width + 6, font_size * 1.4);
|
|
105
74
|
context.globalAlpha = 1;
|
|
106
|
-
context.fillStyle =
|
|
107
|
-
context.fillText(text,
|
|
75
|
+
context.fillStyle = color;
|
|
76
|
+
context.fillText(text, point.x + 8, point.y);
|
|
108
77
|
}
|
|
109
|
-
drawDot(
|
|
110
|
-
if (point === undefined) {
|
|
111
|
-
return;
|
|
112
|
-
}
|
|
113
|
-
const screen_point = this.camera.project(point);
|
|
114
|
-
if (screen_point === null) {
|
|
115
|
-
return;
|
|
116
|
-
}
|
|
78
|
+
drawDot(dot) {
|
|
117
79
|
const { context } = this;
|
|
80
|
+
const { point, color } = dot;
|
|
118
81
|
const radius = rendering_defaults_1.default.STROKE_ENDPOINT_RADIUS;
|
|
119
82
|
context.fillStyle = color;
|
|
120
83
|
context.beginPath();
|
|
121
|
-
context.arc(
|
|
84
|
+
context.arc(point.x, point.y, radius, 0, Math.PI * 2);
|
|
122
85
|
context.fill();
|
|
123
86
|
}
|
|
124
|
-
|
|
87
|
+
strokePath(path) {
|
|
125
88
|
const { context } = this;
|
|
89
|
+
const { runs, color, alpha, width } = path;
|
|
126
90
|
context.globalAlpha = alpha;
|
|
127
91
|
context.strokeStyle = color;
|
|
128
92
|
context.lineWidth = width;
|
|
129
93
|
context.lineJoin = 'round';
|
|
130
94
|
context.lineCap = 'round';
|
|
131
95
|
context.beginPath();
|
|
132
|
-
|
|
133
|
-
this.
|
|
96
|
+
runs.forEach((run) => {
|
|
97
|
+
this.traceRun(run);
|
|
134
98
|
});
|
|
135
99
|
context.stroke();
|
|
136
100
|
context.globalAlpha = 1;
|
|
137
101
|
}
|
|
138
|
-
|
|
102
|
+
traceRun(run) {
|
|
139
103
|
const { context } = this;
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
pen_down = false;
|
|
145
|
-
return;
|
|
146
|
-
}
|
|
147
|
-
if (pen_down) {
|
|
148
|
-
context.lineTo(screen_point.x, screen_point.y);
|
|
149
|
-
}
|
|
150
|
-
else {
|
|
151
|
-
context.moveTo(screen_point.x, screen_point.y);
|
|
152
|
-
pen_down = true;
|
|
153
|
-
}
|
|
104
|
+
const [first_point, ...remaining_points] = run;
|
|
105
|
+
context.moveTo(first_point.x, first_point.y);
|
|
106
|
+
remaining_points.forEach((point) => {
|
|
107
|
+
context.lineTo(point.x, point.y);
|
|
154
108
|
});
|
|
155
109
|
}
|
|
156
110
|
drawAxisTriad() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"canvas-renderer.js","sourceRoot":"","sources":["../../src/canvas-renderer.ts"],"names":[],"mappings":";;;;;AAAA,wCAA+C;AAE/C,qDAA6B;AAC7B,2DAAmC;
|
|
1
|
+
{"version":3,"file":"canvas-renderer.js","sourceRoot":"","sources":["../../src/canvas-renderer.ts"],"names":[],"mappings":";;;;;AAAA,wCAA+C;AAE/C,qDAA6B;AAC7B,2DAAmC;AAMnC,sEAA6C;AAG7C,uEAA+C;AAI/C,qFAA6D;AAE7D,MAAM,eAAe,GAA0B;IAC9C,CAAC,cAAI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,EAAE,QAAQ,CAAC,CAAC;YACnC,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;YAC7B,OAAO,CAAC,MAAM,EAAE,CAAC;YACjB,OAAO,CAAC,QAAQ,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;QAC1C,CAAC,CAAC,CAAC;IACJ,CAAC;CACD;AAED,kBAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"default-render-options.js","sourceRoot":"","sources":["../../../src/constant/default-render-options.ts"],"names":[],"mappings":";;AAEA,MAAM,sBAAsB,GAAkB;IAC7C,WAAW,EAAE,KAAK;IAClB,WAAW,EAAE,IAAI;CACjB,CAAC;AAEF,kBAAe,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import ScreenPoint from './../type/screen-point';
|
|
2
|
+
declare class BrailleCanvas {
|
|
3
|
+
private columns;
|
|
4
|
+
private rows;
|
|
5
|
+
private cells;
|
|
6
|
+
constructor(columns: number, rows: number);
|
|
7
|
+
getDotWidth(): number;
|
|
8
|
+
getDotHeight(): number;
|
|
9
|
+
plot(x: number, y: number, color: string): void;
|
|
10
|
+
drawLine(from: ScreenPoint, to: ScreenPoint, color: string): void;
|
|
11
|
+
drawDot(point: ScreenPoint, color: string): void;
|
|
12
|
+
writeText(column: number, row: number, text: string, color: string): void;
|
|
13
|
+
toTaggedContent(): string;
|
|
14
|
+
private getGlyph;
|
|
15
|
+
private serializeGlyphs;
|
|
16
|
+
}
|
|
17
|
+
export default BrailleCanvas;
|
|
@@ -0,0 +1,137 @@
|
|
|
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
|
+
const escape_tags_1 = __importDefault(require("./utility/escape-tags.js"));
|
|
7
|
+
const DOTS_PER_COLUMN = 2;
|
|
8
|
+
const DOTS_PER_ROW = 4;
|
|
9
|
+
const BRAILLE_BASE = 0x2800;
|
|
10
|
+
const BLANK = ' ';
|
|
11
|
+
const DOT_BITS = [
|
|
12
|
+
[0x01, 0x02, 0x04, 0x40],
|
|
13
|
+
[0x08, 0x10, 0x20, 0x80]
|
|
14
|
+
];
|
|
15
|
+
function createCell() {
|
|
16
|
+
return { bits: 0, dot_color: null, text: null, text_color: null };
|
|
17
|
+
}
|
|
18
|
+
class BrailleCanvas {
|
|
19
|
+
constructor(columns, rows) {
|
|
20
|
+
this.columns = Math.max(0, Math.floor(columns));
|
|
21
|
+
this.rows = Math.max(0, Math.floor(rows));
|
|
22
|
+
this.cells = Array.from({ length: this.columns * this.rows }, createCell);
|
|
23
|
+
}
|
|
24
|
+
getDotWidth() {
|
|
25
|
+
return this.columns * DOTS_PER_COLUMN;
|
|
26
|
+
}
|
|
27
|
+
getDotHeight() {
|
|
28
|
+
return this.rows * DOTS_PER_ROW;
|
|
29
|
+
}
|
|
30
|
+
plot(x, y, color) {
|
|
31
|
+
const dot_x = Math.round(x);
|
|
32
|
+
const dot_y = Math.round(y);
|
|
33
|
+
if (dot_x < 0 || dot_y < 0) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
if (dot_x >= this.getDotWidth() || dot_y >= this.getDotHeight()) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
const column = Math.floor(dot_x / DOTS_PER_COLUMN);
|
|
40
|
+
const row = Math.floor(dot_y / DOTS_PER_ROW);
|
|
41
|
+
const cell = this.cells[row * this.columns + column];
|
|
42
|
+
const bit = DOT_BITS[dot_x % DOTS_PER_COLUMN][dot_y % DOTS_PER_ROW];
|
|
43
|
+
cell.bits = cell.bits | bit;
|
|
44
|
+
cell.dot_color = color;
|
|
45
|
+
}
|
|
46
|
+
drawLine(from, to, color) {
|
|
47
|
+
const start_x = Math.round(from.x);
|
|
48
|
+
const start_y = Math.round(from.y);
|
|
49
|
+
const end_x = Math.round(to.x);
|
|
50
|
+
const end_y = Math.round(to.y);
|
|
51
|
+
const steps = Math.max(Math.abs(end_x - start_x), Math.abs(end_y - start_y));
|
|
52
|
+
if (steps === 0) {
|
|
53
|
+
this.plot(start_x, start_y, color);
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
for (let step = 0; step <= steps; step++) {
|
|
57
|
+
const progress = step / steps;
|
|
58
|
+
const x = start_x + (end_x - start_x) * progress;
|
|
59
|
+
const y = start_y + (end_y - start_y) * progress;
|
|
60
|
+
this.plot(x, y, color);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
drawDot(point, color) {
|
|
64
|
+
const x = Math.round(point.x);
|
|
65
|
+
const y = Math.round(point.y);
|
|
66
|
+
this.plot(x, y, color);
|
|
67
|
+
this.plot(x + 1, y, color);
|
|
68
|
+
this.plot(x, y + 1, color);
|
|
69
|
+
this.plot(x + 1, y + 1, color);
|
|
70
|
+
}
|
|
71
|
+
writeText(column, row, text, color) {
|
|
72
|
+
const start_column = Math.floor(column);
|
|
73
|
+
const text_row = Math.floor(row);
|
|
74
|
+
if (text_row < 0 || text_row >= this.rows) {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
Array.from(text).forEach((character, offset) => {
|
|
78
|
+
const text_column = start_column + offset;
|
|
79
|
+
if (text_column < 0 || text_column >= this.columns) {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
const cell = this.cells[text_row * this.columns + text_column];
|
|
83
|
+
cell.text = character;
|
|
84
|
+
cell.text_color = color;
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
toTaggedContent() {
|
|
88
|
+
const lines = [];
|
|
89
|
+
for (let row = 0; row < this.rows; row++) {
|
|
90
|
+
const start = row * this.columns;
|
|
91
|
+
const row_cells = this.cells.slice(start, start + this.columns);
|
|
92
|
+
const glyphs = row_cells.map((cell) => {
|
|
93
|
+
return this.getGlyph(cell);
|
|
94
|
+
});
|
|
95
|
+
lines.push(this.serializeGlyphs(glyphs));
|
|
96
|
+
}
|
|
97
|
+
return lines.join('\n');
|
|
98
|
+
}
|
|
99
|
+
getGlyph(cell) {
|
|
100
|
+
if (cell.text !== null) {
|
|
101
|
+
return { character: cell.text, color: cell.text_color };
|
|
102
|
+
}
|
|
103
|
+
if (cell.bits === 0) {
|
|
104
|
+
return { character: BLANK, color: null };
|
|
105
|
+
}
|
|
106
|
+
const character = String.fromCharCode(BRAILLE_BASE + cell.bits);
|
|
107
|
+
return { character, color: cell.dot_color };
|
|
108
|
+
}
|
|
109
|
+
serializeGlyphs(glyphs) {
|
|
110
|
+
let result = '';
|
|
111
|
+
let run_color = null;
|
|
112
|
+
let run_text = '';
|
|
113
|
+
const flush_run = () => {
|
|
114
|
+
const escaped_text = (0, escape_tags_1.default)(run_text);
|
|
115
|
+
if (run_color === null) {
|
|
116
|
+
result += escaped_text;
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
result += `{${run_color}-fg}${escaped_text}{/}`;
|
|
120
|
+
}
|
|
121
|
+
run_text = '';
|
|
122
|
+
};
|
|
123
|
+
glyphs.forEach((glyph) => {
|
|
124
|
+
if (glyph.color !== run_color && run_text !== '') {
|
|
125
|
+
flush_run();
|
|
126
|
+
}
|
|
127
|
+
run_color = glyph.color;
|
|
128
|
+
run_text += glyph.character;
|
|
129
|
+
});
|
|
130
|
+
if (run_text !== '') {
|
|
131
|
+
flush_run();
|
|
132
|
+
}
|
|
133
|
+
return result;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
exports.default = BrailleCanvas;
|
|
137
|
+
//# sourceMappingURL=braille-canvas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"braille-canvas.js","sourceRoot":"","sources":["../../../src/terminal/braille-canvas.ts"],"names":[],"mappings":";;;;;AAAA,+EAAsD;AAGtD,MAAM,eAAe,GAAG,CAAC,CAAC;AAC1B,MAAM,YA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YACrB,SAAS,EAAE,CAAC;QACb,CAAC;QAED,OAAO,MAAM,CAAC;IACf,CAAC;CACD;AAED,kBAAe,aAAa,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const TERMINAL_KEY_RATES = {
|
|
4
|
+
ORBIT_PIXELS_PER_PRESS: 12,
|
|
5
|
+
PAN_DOTS_PER_PRESS: 6,
|
|
6
|
+
ZOOM_FACTOR_PER_PRESS: 1.15
|
|
7
|
+
};
|
|
8
|
+
exports.default = TERMINAL_KEY_RATES;
|
|
9
|
+
//# sourceMappingURL=terminal-key-rates.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"terminal-key-rates.js","sourceRoot":"","sources":["../../../../src/terminal/constant/terminal-key-rates.ts"],"names":[],"mappings":";;AAAA,MAAM,kBAAkB,GAAG;IAC1B,sBAAsB,EAAE,EAAE;IAC1B,kBAAkB,EAAE,CAAC;IACrB,qBAAqB,EAAE,IAAI;CAC3B,CAAC;AAEF,kBAAe,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
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
|
+
const view_preset_1 = __importDefault(require("./../../enum/view-preset.js"));
|
|
7
|
+
const VIEW_PRESET_KEYS = {
|
|
8
|
+
'1': view_preset_1.default.FRONT,
|
|
9
|
+
'2': view_preset_1.default.BACK,
|
|
10
|
+
'3': view_preset_1.default.LEFT,
|
|
11
|
+
'4': view_preset_1.default.RIGHT,
|
|
12
|
+
'5': view_preset_1.default.TOP,
|
|
13
|
+
'6': view_preset_1.default.UNDER,
|
|
14
|
+
'7': view_preset_1.default.ISOMETRIC
|
|
15
|
+
};
|
|
16
|
+
exports.default = VIEW_PRESET_KEYS;
|
|
17
|
+
//# sourceMappingURL=view-preset-keys.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"view-preset-keys.js","sourceRoot":"","sources":["../../../../src/terminal/constant/view-preset-keys.ts"],"names":[],"mappings":";;;;;AAAA,mEAA0C;AAE1C,MAAM,gBAAgB,GAA+B;IACpD,GAAG,EAAE,qBAAU,CAAC,KAAK;IACrB,GAAG,EAAE,qBAAU,CAAC,IAAI;IACpB,GAAG,EAAE,qBAAU,CAAC,IAAI;IACpB,GAAG,EAAE,qBAAU,CAAC,KAAK;IACrB,GAAG,EAAE,qBAAU,CAAC,GAAG;IACnB,GAAG,EAAE,qBAAU,CAAC,KAAK;IACrB,GAAG,EAAE,qBAAU,CAAC,SAAS;CACzB,CAAC;AAEF,kBAAe,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var TerminalFocus;
|
|
4
|
+
(function (TerminalFocus) {
|
|
5
|
+
TerminalFocus["SCENE"] = "scene";
|
|
6
|
+
TerminalFocus["COMPONENTS"] = "components";
|
|
7
|
+
})(TerminalFocus || (TerminalFocus = {}));
|
|
8
|
+
exports.default = TerminalFocus;
|
|
9
|
+
//# sourceMappingURL=terminal-focus.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"terminal-focus.js","sourceRoot":"","sources":["../../../../src/terminal/enum/terminal-focus.ts"],"names":[],"mappings":";;AAAA,IAAK,aAGJ;AAHD,WAAK,aAAa;IACjB,gCAAe,CAAA;IACf,0CAAyB,CAAA;AAC1B,CAAC,EAHI,aAAa,KAAb,aAAa,QAGjB;AAED,kBAAe,aAAa,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
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.renderFrame = exports.TerminalViewer = void 0;
|
|
7
|
+
var terminal_viewer_1 = require("./terminal-viewer.js");
|
|
8
|
+
Object.defineProperty(exports, "TerminalViewer", { enumerable: true, get: function () { return __importDefault(terminal_viewer_1).default; } });
|
|
9
|
+
var render_frame_1 = require("./render-frame.js");
|
|
10
|
+
Object.defineProperty(exports, "renderFrame", { enumerable: true, get: function () { return __importDefault(render_frame_1).default; } });
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/terminal/index.ts"],"names":[],"mappings":";;;;;;AAAA,4DAAmE;AAA3D,kIAAA,OAAO,OAAkB;AAEjC,sDAA6D;AAArD,4HAAA,OAAO,OAAe"}
|