@thi.ng/text-canvas 2.2.8 → 2.3.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/CHANGELOG.md +8 -1
- package/README.md +1 -1
- package/canvas.d.ts +2 -2
- package/canvas.js +10 -2
- package/package.json +24 -24
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
-
- **Last updated**: 2022-
|
|
3
|
+
- **Last updated**: 2022-04-07T14:17:30Z
|
|
4
4
|
- **Generator**: [thi.ng/monopub](https://thi.ng/monopub)
|
|
5
5
|
|
|
6
6
|
All notable changes to this project will be documented in this file.
|
|
@@ -9,6 +9,13 @@ See [Conventional Commits](https://conventionalcommits.org/) for commit guidelin
|
|
|
9
9
|
**Note:** Unlisted _patch_ versions only involve non-code or otherwise excluded changes
|
|
10
10
|
and/or version bumps of transitive dependencies.
|
|
11
11
|
|
|
12
|
+
## [2.3.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/text-canvas@2.3.0) (2022-04-07)
|
|
13
|
+
|
|
14
|
+
#### 🚀 Features
|
|
15
|
+
|
|
16
|
+
- update Canvas.setAt() ([7df033f](https://github.com/thi-ng/umbrella/commit/7df033f))
|
|
17
|
+
- allow pixel value to be number or string
|
|
18
|
+
|
|
12
19
|
## [2.2.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/text-canvas@2.2.0) (2021-11-17)
|
|
13
20
|
|
|
14
21
|
#### 🚀 Features
|
package/README.md
CHANGED
package/canvas.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Fn0, IGrid2D, NumOrString } from "@thi.ng/api";
|
|
2
2
|
import { ClipRect, StrokeStyle } from "./api.js";
|
|
3
3
|
export declare class Canvas implements IGrid2D<Uint32Array, number> {
|
|
4
4
|
data: Uint32Array;
|
|
@@ -19,7 +19,7 @@ export declare class Canvas implements IGrid2D<Uint32Array, number> {
|
|
|
19
19
|
indexAtUnsafe(d0: number, d1: number): number;
|
|
20
20
|
getAt(x: number, y: number): number;
|
|
21
21
|
getAtUnsafe(x: number, y: number): number;
|
|
22
|
-
setAt(x: number, y: number,
|
|
22
|
+
setAt(x: number, y: number, val: NumOrString): boolean;
|
|
23
23
|
setAtUnsafe(x: number, y: number, col: number): boolean;
|
|
24
24
|
}
|
|
25
25
|
export declare const canvas: (width: number, height: number, format?: number | undefined, style?: StrokeStyle | undefined) => Canvas;
|
package/canvas.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
|
+
import { nomixin } from "@thi.ng/api";
|
|
2
3
|
import { IGrid2DMixin } from "@thi.ng/api/mixins/igrid";
|
|
3
4
|
import { peek } from "@thi.ng/arrays/peek";
|
|
4
5
|
import { clamp } from "@thi.ng/math/interval";
|
|
@@ -40,11 +41,18 @@ let Canvas = class Canvas {
|
|
|
40
41
|
getAt(x, y) { }
|
|
41
42
|
// @ts-ignore mixin
|
|
42
43
|
getAtUnsafe(x, y) { }
|
|
43
|
-
|
|
44
|
-
|
|
44
|
+
setAt(x, y, val) {
|
|
45
|
+
return this.includes(x, y)
|
|
46
|
+
? ((this.data[this.indexAtUnsafe(x, y)] = charCode(val, this.format)),
|
|
47
|
+
true)
|
|
48
|
+
: false;
|
|
49
|
+
}
|
|
45
50
|
// @ts-ignore mixin
|
|
46
51
|
setAtUnsafe(x, y, col) { }
|
|
47
52
|
};
|
|
53
|
+
__decorate([
|
|
54
|
+
nomixin
|
|
55
|
+
], Canvas.prototype, "setAt", null);
|
|
48
56
|
Canvas = __decorate([
|
|
49
57
|
IGrid2DMixin
|
|
50
58
|
], Canvas);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/text-canvas",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"description": "Text based canvas, drawing, tables with arbitrary formatting (incl. ANSI/HTML)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -34,18 +34,18 @@
|
|
|
34
34
|
"test": "testament test"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@thi.ng/api": "^8.3.
|
|
38
|
-
"@thi.ng/arrays": "^2.2.
|
|
39
|
-
"@thi.ng/checks": "^3.1.
|
|
40
|
-
"@thi.ng/geom-clip-line": "^2.1.
|
|
41
|
-
"@thi.ng/math": "^5.3.
|
|
42
|
-
"@thi.ng/strings": "^3.3.
|
|
43
|
-
"@thi.ng/text-format": "^1.1.
|
|
44
|
-
"@thi.ng/transducers": "^8.3.
|
|
37
|
+
"@thi.ng/api": "^8.3.5",
|
|
38
|
+
"@thi.ng/arrays": "^2.2.1",
|
|
39
|
+
"@thi.ng/checks": "^3.1.5",
|
|
40
|
+
"@thi.ng/geom-clip-line": "^2.1.9",
|
|
41
|
+
"@thi.ng/math": "^5.3.1",
|
|
42
|
+
"@thi.ng/strings": "^3.3.3",
|
|
43
|
+
"@thi.ng/text-format": "^1.1.5",
|
|
44
|
+
"@thi.ng/transducers": "^8.3.1"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@microsoft/api-extractor": "^7.19.4",
|
|
48
|
-
"@thi.ng/testament": "^0.2.
|
|
48
|
+
"@thi.ng/testament": "^0.2.5",
|
|
49
49
|
"rimraf": "^3.0.2",
|
|
50
50
|
"tools": "^0.0.1",
|
|
51
51
|
"tslib": "^2.3.1",
|
|
@@ -93,43 +93,43 @@
|
|
|
93
93
|
],
|
|
94
94
|
"exports": {
|
|
95
95
|
".": {
|
|
96
|
-
"
|
|
96
|
+
"default": "./index.js"
|
|
97
97
|
},
|
|
98
98
|
"./api": {
|
|
99
|
-
"
|
|
99
|
+
"default": "./api.js"
|
|
100
100
|
},
|
|
101
101
|
"./bars": {
|
|
102
|
-
"
|
|
102
|
+
"default": "./bars.js"
|
|
103
103
|
},
|
|
104
104
|
"./canvas": {
|
|
105
|
-
"
|
|
105
|
+
"default": "./canvas.js"
|
|
106
106
|
},
|
|
107
107
|
"./circle": {
|
|
108
|
-
"
|
|
108
|
+
"default": "./circle.js"
|
|
109
109
|
},
|
|
110
110
|
"./format": {
|
|
111
|
-
"
|
|
111
|
+
"default": "./format.js"
|
|
112
112
|
},
|
|
113
113
|
"./hvline": {
|
|
114
|
-
"
|
|
114
|
+
"default": "./hvline.js"
|
|
115
115
|
},
|
|
116
116
|
"./image": {
|
|
117
|
-
"
|
|
117
|
+
"default": "./image.js"
|
|
118
118
|
},
|
|
119
119
|
"./line": {
|
|
120
|
-
"
|
|
120
|
+
"default": "./line.js"
|
|
121
121
|
},
|
|
122
122
|
"./rect": {
|
|
123
|
-
"
|
|
123
|
+
"default": "./rect.js"
|
|
124
124
|
},
|
|
125
125
|
"./style": {
|
|
126
|
-
"
|
|
126
|
+
"default": "./style.js"
|
|
127
127
|
},
|
|
128
128
|
"./table": {
|
|
129
|
-
"
|
|
129
|
+
"default": "./table.js"
|
|
130
130
|
},
|
|
131
131
|
"./text": {
|
|
132
|
-
"
|
|
132
|
+
"default": "./text.js"
|
|
133
133
|
}
|
|
134
134
|
},
|
|
135
135
|
"thi.ng": {
|
|
@@ -138,5 +138,5 @@
|
|
|
138
138
|
],
|
|
139
139
|
"year": 2020
|
|
140
140
|
},
|
|
141
|
-
"gitHead": "
|
|
141
|
+
"gitHead": "5ee1feb590dd935593b1dd4e7f38a3ed3ba64765\n"
|
|
142
142
|
}
|