tidepool 1.0.3 → 1.0.5
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/dist/objects/box.d.ts.map +1 -1
- package/dist/objects/box.js +21 -16
- package/dist/screen.d.ts.map +1 -1
- package/dist/screen.js +1 -0
- package/dist/util.d.ts.map +1 -1
- package/dist/util.js +1 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"box.d.ts","sourceRoot":"","sources":["../../src/objects/box.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAG3C,qBAAa,GAAI,YAAW,UAAU;IAClC,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,UAAU,EAAE,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;gBAEH,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,SAAU,EAAE,KAAK,SAAK,EAAE,MAAM,SAAI;IAWxG,UAAU,CAAC,OAAO,EAAE,UAAU;IAI9B,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE;
|
|
1
|
+
{"version":3,"file":"box.d.ts","sourceRoot":"","sources":["../../src/objects/box.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAG3C,qBAAa,GAAI,YAAW,UAAU;IAClC,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,UAAU,EAAE,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;gBAEH,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,SAAU,EAAE,KAAK,SAAK,EAAE,MAAM,SAAI;IAWxG,UAAU,CAAC,OAAO,EAAE,UAAU;IAI9B,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE;IAWxB,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE;IAyCvB,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM;CAI9B"}
|
package/dist/objects/box.js
CHANGED
|
@@ -17,40 +17,45 @@ class Box {
|
|
|
17
17
|
this.contents.push(content);
|
|
18
18
|
}
|
|
19
19
|
clear(screen) {
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
const maxY = Math.min(this.y + this.height, screen.length);
|
|
21
|
+
const maxX = Math.min(this.x + this.width, screen[0].length);
|
|
22
|
+
for (let i = this.y; i < maxY; i++) {
|
|
23
|
+
for (let j = this.x; j < maxX; j++) {
|
|
22
24
|
screen[i][j] = ' ';
|
|
23
25
|
}
|
|
24
26
|
}
|
|
25
27
|
}
|
|
26
28
|
draw(screen) {
|
|
29
|
+
const maxY = Math.min(this.y + this.height, screen.length);
|
|
30
|
+
const maxX = Math.min(this.x + this.width, screen[0].length);
|
|
31
|
+
if (this.x >= screen[0].length || this.y >= screen.length || maxY <= this.y || maxX <= this.x) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
27
34
|
this.clear(screen);
|
|
28
35
|
const colorCode = (0, util_1.getColorCode)(this.color);
|
|
29
36
|
const titleColorCode = (0, util_1.getColorCode)('magenta');
|
|
30
|
-
for (let i = this.x + 1; i <
|
|
37
|
+
for (let i = this.x + 1; i < maxX - 1; i++) {
|
|
31
38
|
screen[this.y][i] = `${colorCode}─\x1b[0m`;
|
|
32
39
|
}
|
|
33
|
-
for (let i = this.x + 1; i <
|
|
34
|
-
screen[
|
|
40
|
+
for (let i = this.x + 1; i < maxX - 1; i++) {
|
|
41
|
+
screen[maxY - 1][i] = `${colorCode}─\x1b[0m`;
|
|
35
42
|
}
|
|
36
|
-
for (let i = this.y + 1; i <
|
|
43
|
+
for (let i = this.y + 1; i < maxY - 1; i++) {
|
|
37
44
|
screen[i][this.x] = `${colorCode}│\x1b[0m`;
|
|
38
|
-
screen[i][
|
|
45
|
+
screen[i][maxX - 1] = `${colorCode}│\x1b[0m`;
|
|
39
46
|
}
|
|
40
47
|
screen[this.y][this.x] = `${colorCode}┌\x1b[0m`;
|
|
41
|
-
screen[this.y][
|
|
42
|
-
screen[
|
|
43
|
-
screen[
|
|
48
|
+
screen[this.y][maxX - 1] = `${colorCode}┐\x1b[0m`;
|
|
49
|
+
screen[maxY - 1][this.x] = `${colorCode}└\x1b[0m`;
|
|
50
|
+
screen[maxY - 1][maxX - 1] = `${colorCode}┘\x1b[0m`;
|
|
44
51
|
if (this.title) {
|
|
45
|
-
const titlePosition = Math.max(this.x + 2, Math.min(
|
|
46
|
-
for (let i = 0; i < this.title.length; i++) {
|
|
47
|
-
|
|
48
|
-
screen[this.y][titlePosition + i] = `${titleColorCode}${this.title[i]}\x1b[0m`;
|
|
49
|
-
}
|
|
52
|
+
const titlePosition = Math.max(this.x + 2, Math.min(maxX - 2 - this.title.length, this.x + 2));
|
|
53
|
+
for (let i = 0; i < this.title.length && titlePosition + i < maxX; i++) {
|
|
54
|
+
screen[this.y][titlePosition + i] = `${titleColorCode}${this.title[i]}\x1b[0m`;
|
|
50
55
|
}
|
|
51
56
|
}
|
|
52
57
|
for (const content of this.contents) {
|
|
53
|
-
content.draw(screen, this.x + 1, this.y + 1, this.
|
|
58
|
+
content.draw(screen, this.x + 1, this.y + 1, maxX - this.x - 2);
|
|
54
59
|
}
|
|
55
60
|
}
|
|
56
61
|
move(dx, dy) {
|
package/dist/screen.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"screen.d.ts","sourceRoot":"","sources":["../src/screen.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,qBAAa,UAAU;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,EAAE,EAAE,CAAC;IACnB,MAAM,EAAE,MAAM,EAAE,EAAE,CAAC;IACnB,UAAU,EAAE,UAAU,EAAE,CAAC;IACzB,GAAG,EAAE,MAAM,GAAG,IAAI,CAAQ;IAC1B,cAAc,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,IAAI,CAAQ;IAC3C,eAAe,EAAE,MAAM,CAAC;gBAEZ,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,eAAe,GAAE,MAAsB;IASlF,WAAW;IAIX,WAAW;IAIX,YAAY,CAAC,SAAS,EAAE,UAAU;IAIlC,OAAO,CAAC,sBAAsB;
|
|
1
|
+
{"version":3,"file":"screen.d.ts","sourceRoot":"","sources":["../src/screen.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,qBAAa,UAAU;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,EAAE,EAAE,CAAC;IACnB,MAAM,EAAE,MAAM,EAAE,EAAE,CAAC;IACnB,UAAU,EAAE,UAAU,EAAE,CAAC;IACzB,GAAG,EAAE,MAAM,GAAG,IAAI,CAAQ;IAC1B,cAAc,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,IAAI,CAAQ;IAC3C,eAAe,EAAE,MAAM,CAAC;gBAEZ,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,eAAe,GAAE,MAAsB;IASlF,WAAW;IAIX,WAAW;IAIX,YAAY,CAAC,SAAS,EAAE,UAAU;IAIlC,OAAO,CAAC,sBAAsB;IAiB9B,OAAO,CAAC,YAAY;IAMpB,oBAAoB;IAUpB,OAAO,CAAC,MAAM;IAOd,iBAAiB,CAAC,EAAE,EAAE,MAAM,IAAI;IAIhC,MAAM,CAAC,GAAG,EAAE,MAAM;IAIlB,SAAS;IAQT,WAAW;CAkBd"}
|
package/dist/screen.js
CHANGED
package/dist/util.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":"AAAA,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":"AAAA,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,UAezC;AAED,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,YAetD"}
|
package/dist/util.js
CHANGED