@thi.ng/text-canvas 3.0.1 → 3.0.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.
package/CHANGELOG.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Change Log
2
2
 
3
- - **Last updated**: 2024-02-19T16:07:07Z
3
+ - **Last updated**: 2024-02-22T23:15:26Z
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,12 @@ 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
+ ### [3.0.3](https://github.com/thi-ng/umbrella/tree/@thi.ng/text-canvas@3.0.3) (2024-02-22)
13
+
14
+ #### ♻️ Refactoring
15
+
16
+ - update object destructuring in all pkgs & examples ([f36aeb0](https://github.com/thi-ng/umbrella/commit/f36aeb0))
17
+
12
18
  # [3.0.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/text-canvas@3.0.0) (2024-02-19)
13
19
 
14
20
  #### 🛑 Breaking changes
package/README.md CHANGED
@@ -18,7 +18,7 @@
18
18
  [![Mastodon Follow](https://img.shields.io/mastodon/follow/109331703950160316?domain=https%3A%2F%2Fmastodon.thi.ng&style=social)](https://mastodon.thi.ng/@toxi)
19
19
 
20
20
  > [!NOTE]
21
- > This is one of 189 standalone projects, maintained as part
21
+ > This is one of 190 standalone projects, maintained as part
22
22
  > of the [@thi.ng/umbrella](https://github.com/thi-ng/umbrella/) monorepo
23
23
  > and anti-framework.
24
24
  >
@@ -406,7 +406,7 @@ const W = 64;
406
406
  const H = 32;
407
407
 
408
408
  // create text canvas
409
- const canvas = new tc.Canvas(W, H, tf.BG_BLACK, tf.STYLE_THIN);
409
+ const canvas = new tc.Canvas(W, H, tf.BG_BLACK, tc.STYLE_THIN);
410
410
 
411
411
  // cube corner vertices
412
412
  const cube = geom.vertices(geom.center(geom.aabb(1))!);
package/image.js CHANGED
@@ -287,7 +287,7 @@ const scrollV = (canvas2, dy, clear = 32) => {
287
287
  data.fill(ch, -dy);
288
288
  }
289
289
  };
290
- const image = (canvas2, x, y, w, h, pixels, opts) => {
290
+ const image = (canvas2, x, y, w, h, pixels, opts = {}) => {
291
291
  x |= 0;
292
292
  y |= 0;
293
293
  w |= 0;
@@ -305,14 +305,13 @@ const image = (canvas2, x, y, w, h, pixels, opts) => {
305
305
  } = imgRect(canvas2, x, y, w, h);
306
306
  if (!iw || !ih)
307
307
  return;
308
- const { chars, format, gamma, invert, bits } = {
309
- chars: SHADES_BLOCK,
310
- format: canvas2.format,
311
- gamma: 1,
312
- invert: false,
313
- bits: 8,
314
- ...opts
315
- };
308
+ const {
309
+ chars = SHADES_BLOCK,
310
+ format = canvas2.format,
311
+ gamma = 1,
312
+ invert = false,
313
+ bits = 8
314
+ } = opts;
316
315
  const fmt = isNumber(format) ? () => format : format;
317
316
  const max = (1 << bits) - 1;
318
317
  const mask = invert ? max : 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thi.ng/text-canvas",
3
- "version": "3.0.1",
3
+ "version": "3.0.3",
4
4
  "description": "Text based canvas, drawing, plotting, tables with arbitrary formatting (incl. ANSI/HTML)",
5
5
  "type": "module",
6
6
  "module": "./index.js",
@@ -35,15 +35,15 @@
35
35
  "test": "bun test"
36
36
  },
37
37
  "dependencies": {
38
- "@thi.ng/api": "^8.9.24",
39
- "@thi.ng/arrays": "^2.8.1",
40
- "@thi.ng/checks": "^3.4.24",
41
- "@thi.ng/errors": "^2.4.17",
42
- "@thi.ng/geom-clip-line": "^2.3.67",
43
- "@thi.ng/math": "^5.10.1",
44
- "@thi.ng/strings": "^3.7.15",
45
- "@thi.ng/text-format": "^2.1.1",
46
- "@thi.ng/transducers": "^8.9.4"
38
+ "@thi.ng/api": "^8.9.25",
39
+ "@thi.ng/arrays": "^2.8.2",
40
+ "@thi.ng/checks": "^3.5.0",
41
+ "@thi.ng/errors": "^2.4.18",
42
+ "@thi.ng/geom-clip-line": "^2.3.69",
43
+ "@thi.ng/math": "^5.10.2",
44
+ "@thi.ng/strings": "^3.7.16",
45
+ "@thi.ng/text-format": "^2.1.2",
46
+ "@thi.ng/transducers": "^8.9.6"
47
47
  },
48
48
  "devDependencies": {
49
49
  "@microsoft/api-extractor": "^7.40.1",
@@ -147,5 +147,5 @@
147
147
  ],
148
148
  "year": 2020
149
149
  },
150
- "gitHead": "2724c87ca41810f2112f9d8c3d6b90dfaeea876b\n"
150
+ "gitHead": "16f2b92b5410bd35dcde6c2971c8e62783ebc472\n"
151
151
  }
package/text.js CHANGED
@@ -46,18 +46,13 @@ const textColumn = (canvas, x, y, width, txt, format = canvas.format, hard = fal
46
46
  }
47
47
  return y;
48
48
  };
49
- const textBox = (canvas, x, y, width, height, txt, opts) => {
49
+ const textBox = (canvas, x, y, width, height, txt, opts = {}) => {
50
50
  const {
51
- format,
52
- style,
53
- padding: [padX, padY],
54
- hard
55
- } = {
56
- format: canvas.format,
57
- padding: [0, 0],
58
- hard: false,
59
- ...opts
60
- };
51
+ format = canvas.format,
52
+ hard = false,
53
+ padding: [padX, padY] = [0, 0],
54
+ style
55
+ } = opts;
61
56
  const currFmt = canvas.format;
62
57
  canvas.format = format;
63
58
  style && beginStyle(canvas, style);