@thi.ng/text-canvas 3.0.2 → 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-22T11:59:16Z
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/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.2",
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",
@@ -39,11 +39,11 @@
39
39
  "@thi.ng/arrays": "^2.8.2",
40
40
  "@thi.ng/checks": "^3.5.0",
41
41
  "@thi.ng/errors": "^2.4.18",
42
- "@thi.ng/geom-clip-line": "^2.3.68",
42
+ "@thi.ng/geom-clip-line": "^2.3.69",
43
43
  "@thi.ng/math": "^5.10.2",
44
44
  "@thi.ng/strings": "^3.7.16",
45
45
  "@thi.ng/text-format": "^2.1.2",
46
- "@thi.ng/transducers": "^8.9.5"
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": "4513a1c703bdbf0f0867f03e547e47692e415fac\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);