@thi.ng/hiccup-canvas 2.0.9 → 2.1.2

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,75 +1,101 @@
1
1
  # Change Log
2
2
 
3
- All notable changes to this project will be documented in this file.
4
- See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
-
6
- ## [2.0.9](https://github.com/thi-ng/umbrella/compare/@thi.ng/hiccup-canvas@2.0.8...@thi.ng/hiccup-canvas@2.0.9) (2021-11-04)
7
-
8
- **Note:** Version bump only for package @thi.ng/hiccup-canvas
9
-
10
-
11
-
3
+ - **Last updated**: 2021-11-21T17:09:28Z
4
+ - **Generator**: [thi.ng/monopub](https://thi.ng/monopub)
12
5
 
6
+ All notable changes to this project will be documented in this file.
7
+ See [Conventional Commits](https://conventionalcommits.org/) for commit guidelines.
13
8
 
14
- ## [2.0.8](https://github.com/thi-ng/umbrella/compare/@thi.ng/hiccup-canvas@2.0.7...@thi.ng/hiccup-canvas@2.0.8) (2021-11-03)
9
+ **Note:** Unlisted _patch_ versions only involve non-code or otherwise excluded changes
10
+ and/or version bumps of transitive dependencies.
15
11
 
16
- **Note:** Version bump only for package @thi.ng/hiccup-canvas
12
+ ## [2.1.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/hiccup-canvas@2.1.0) (2021-11-17)
17
13
 
14
+ #### 🚀 Features
18
15
 
16
+ - Using workspaces for local tools ([bf7a404](https://github.com/thi-ng/umbrella/commit/bf7a404))
17
+ Improving the overall build ergonomics
18
+ - introduced a tools workspaces
19
+ - imported it in all needed packages/examples
20
+ - inclusive project root
19
21
 
22
+ #### ♻️ Refactoring
20
23
 
24
+ - testrunner to binary ([4ebbbb2](https://github.com/thi-ng/umbrella/commit/4ebbbb2))
25
+ this commit reverts (partly) changes made in:
26
+ ef346d7a8753590dc9094108a3d861a8dbd5dd2c
27
+ overall purpose is better testament ergonomics:
28
+ instead of having to pass NODE_OPTIONS with every invocation
29
+ having a binary to handle this for us.
21
30
 
22
- # [2.0.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/hiccup-canvas@1.2.15...@thi.ng/hiccup-canvas@2.0.0) (2021-10-12)
31
+ ### [2.0.10](https://github.com/thi-ng/umbrella/tree/@thi.ng/hiccup-canvas@2.0.10) (2021-11-10)
23
32
 
33
+ #### ♻️ Refactoring
24
34
 
25
- ### Build System
35
+ - update all countdown loops ([a5f374b](https://github.com/thi-ng/umbrella/commit/a5f374b))
26
36
 
27
- * major update of ALL pkgs (export maps, ESM only) ([0d1d6ea](https://github.com/thi-ng/umbrella/commit/0d1d6ea9fab2a645d6c5f2bf2591459b939c09b6))
37
+ ### [2.0.1](https://github.com/thi-ng/umbrella/tree/@thi.ng/hiccup-canvas@2.0.1) (2021-10-13)
28
38
 
39
+ #### ♻️ Refactoring
29
40
 
30
- ### BREAKING CHANGES
41
+ - update imports in all tests/pkgs ([effd591](https://github.com/thi-ng/umbrella/commit/effd591))
42
+ - update imports in all pkgs ([5fa2b6f](https://github.com/thi-ng/umbrella/commit/5fa2b6f))
43
+ - add .js suffix for all relative imports
31
44
 
32
- * discontinue CommonJS & UMD versions
45
+ # [2.0.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/hiccup-canvas@2.0.0) (2021-10-12)
33
46
 
34
- - only ESM modules will be published from now on
35
- - CJS obsolete due to ESM support in recent versions of node:
36
- - i.e. launch NodeJS via:
37
- - `node --experimental-specifier-resolution=node --experimental-repl-await`
38
- - in the node REPL use `await import(...)` instead of `require()`
39
- - UMD obsolete due to widespread browser support for ESM
47
+ #### 🛑 Breaking changes
40
48
 
41
- Also:
42
- - normalize/restructure/reorg all package.json files
43
- - cleanup all build scripts, remove obsolete
44
- - switch from mocha to @thi.ng/testament for all tests
49
+ - major update of ALL pkgs (export maps, ESM only) ([0d1d6ea](https://github.com/thi-ng/umbrella/commit/0d1d6ea))
50
+ - BREAKING CHANGE: discontinue CommonJS & UMD versions
51
+ - only ESM modules will be published from now on
52
+ - CJS obsolete due to ESM support in recent versions of node:
53
+ - i.e. launch NodeJS via:
54
+ - `node --experimental-specifier-resolution=node --experimental-repl-await`
55
+ - in the node REPL use `await import(...)` instead of `require()`
56
+ - UMD obsolete due to widespread browser support for ESM
57
+ Also:
58
+ - normalize/restructure/reorg all package.json files
59
+ - cleanup all build scripts, remove obsolete
60
+ - switch from mocha to [@thi.ng/testament](https://github.com/thi-ng/umbrella/tree/main/packages/testament) for all tests
45
61
 
62
+ #### ♻️ Refactoring
46
63
 
64
+ - rename internals ([043e3eb](https://github.com/thi-ng/umbrella/commit/043e3eb))
65
+ - minor pkg restructure ([459596c](https://github.com/thi-ng/umbrella/commit/459596c))
66
+ - update imports ([138571a](https://github.com/thi-ng/umbrella/commit/138571a))
67
+ - update all test stubs ([f2d6d53](https://github.com/thi-ng/umbrella/commit/f2d6d53))
68
+ - update all tests in _all_ pkgs ([8b582bc](https://github.com/thi-ng/umbrella/commit/8b582bc))
69
+ - update all to use [@thi.ng/testament](https://github.com/thi-ng/umbrella/tree/main/packages/testament)
47
70
 
71
+ ## [1.2.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/hiccup-canvas@1.2.0) (2021-04-03)
48
72
 
73
+ #### 🚀 Features
49
74
 
75
+ - add IToImageData support ([7cc4709](https://github.com/thi-ng/umbrella/commit/7cc4709))
76
+ - update image() to accept ImageData & IToImageData
77
+ - add [@thi.ng/pixel](https://github.com/thi-ng/umbrella/tree/main/packages/pixel) as dev dependency
50
78
 
51
- # [1.2.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/hiccup-canvas@1.1.34...@thi.ng/hiccup-canvas@1.2.0) (2021-04-03)
79
+ ### [1.1.21](https://github.com/thi-ng/umbrella/tree/@thi.ng/hiccup-canvas@1.1.21) (2021-02-20)
52
80
 
53
- ### Features
81
+ #### ♻️ Refactoring
54
82
 
55
- - **hiccup-canvas:** add IToImageData support ([7cc4709](https://github.com/thi-ng/umbrella/commit/7cc4709386c99337702d5788b04d14d13618e56b))
83
+ - update color attrib resolution/conversion ([a9ca280](https://github.com/thi-ng/umbrella/commit/a9ca280))
84
+ - update resolveColor() ([66e9a40](https://github.com/thi-ng/umbrella/commit/66e9a40))
56
85
 
57
- # [1.1.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/hiccup-canvas@1.0.6...@thi.ng/hiccup-canvas@1.1.0) (2020-07-17)
86
+ ## [1.1.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/hiccup-canvas@1.1.0) (2020-07-17)
58
87
 
59
- ### Features
88
+ #### 🚀 Features
60
89
 
61
- - **hiccup-canvas:** add lines() ([817b54d](https://github.com/thi-ng/umbrella/commit/817b54d6758cf8c74e5d1b450be7d9f8dc2356fc))
90
+ - add lines() ([817b54d](https://github.com/thi-ng/umbrella/commit/817b54d))
62
91
 
63
- # 1.0.0 (2020-06-05)
92
+ # [1.0.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/hiccup-canvas@1.0.0) (2020-06-05)
64
93
 
65
- ### Features
94
+ #### 🛑 Breaking changes
66
95
 
67
- - **hdom-canvas:** rename package, add text support, refactor ([f41014e](https://github.com/thi-ng/umbrella/commit/f41014ebffa8d4051fccbf04080d814fd62a474b))
68
- - **hiccup-canvas:** add canvas comp, createTree impl, update deps ([60f12c5](https://github.com/thi-ng/umbrella/commit/60f12c5da7a7803e00846da6c316f65952097067))
69
- - **hiccup-canvas:** add hiccup-canvas package ([eb284f0](https://github.com/thi-ng/umbrella/commit/eb284f0129118e5ef180383a3cd4a31915a5d82a))
70
- - **hiccup-canvas:** add IToHiccup support in draw ([a59bb09](https://github.com/thi-ng/umbrella/commit/a59bb0923f37677d6579aede0dbe9958b0150d81))
71
- - **hiccup-canvas:** extract as new package ([4b3c516](https://github.com/thi-ng/umbrella/commit/4b3c516573dc9cb247dedc211210151575709925))
96
+ - extract as new package ([4b3c516](https://github.com/thi-ng/umbrella/commit/4b3c516))
97
+ - BREAKING CHANGE: extract as new package from former [@thi.ng/hdom-canvas](https://github.com/thi-ng/umbrella/tree/main/packages/hdom-canvas)
72
98
 
73
- ### BREAKING CHANGES
99
+ #### 🚀 Features
74
100
 
75
- - **hiccup-canvas:** extract as new package from former @thi.ng/hdom-canvas
101
+ - add IToHiccup support in draw ([a59bb09](https://github.com/thi-ng/umbrella/commit/a59bb09))
package/README.md CHANGED
@@ -95,7 +95,7 @@ node --experimental-repl-await
95
95
  > const hiccupCanvas = await import("@thi.ng/hiccup-canvas");
96
96
  ```
97
97
 
98
- Package sizes (gzipped, pre-treeshake): ESM: 2.59 KB
98
+ Package sizes (gzipped, pre-treeshake): ESM: 2.57 KB
99
99
 
100
100
  ## Dependencies
101
101
 
package/internal/state.js CHANGED
@@ -82,7 +82,7 @@ export const __restoreState = (ctx, prev, curr) => {
82
82
  }
83
83
  const edits = curr.edits;
84
84
  const attribs = prev.attribs;
85
- for (let i = edits.length; --i >= 0;) {
85
+ for (let i = edits.length; i-- > 0;) {
86
86
  const id = edits[i];
87
87
  const v = attribs[id];
88
88
  setAttrib(ctx, prev, id, CTX_ATTRIBS[id], v != null ? v : DEFAULTS[id]);
package/package.json CHANGED
@@ -1,130 +1,134 @@
1
1
  {
2
- "name": "@thi.ng/hiccup-canvas",
3
- "version": "2.0.9",
4
- "description": "Hiccup shape tree renderer for vanilla Canvas 2D contexts",
5
- "type": "module",
6
- "module": "./index.js",
7
- "typings": "./index.d.ts",
8
- "sideEffects": false,
9
- "repository": {
10
- "type": "git",
11
- "url": "https://github.com/thi-ng/umbrella.git"
2
+ "name": "@thi.ng/hiccup-canvas",
3
+ "version": "2.1.2",
4
+ "description": "Hiccup shape tree renderer for vanilla Canvas 2D contexts",
5
+ "type": "module",
6
+ "module": "./index.js",
7
+ "typings": "./index.d.ts",
8
+ "sideEffects": false,
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "https://github.com/thi-ng/umbrella.git"
12
+ },
13
+ "homepage": "https://github.com/thi-ng/umbrella/tree/master/packages/hiccup-canvas#readme",
14
+ "funding": [
15
+ {
16
+ "type": "github",
17
+ "url": "https://github.com/sponsors/postspectacular"
12
18
  },
13
- "homepage": "https://github.com/thi-ng/umbrella/tree/master/packages/hiccup-canvas#readme",
14
- "funding": [
15
- {
16
- "type": "github",
17
- "url": "https://github.com/sponsors/postspectacular"
18
- },
19
- {
20
- "type": "patreon",
21
- "url": "https://patreon.com/thing_umbrella"
22
- }
23
- ],
24
- "author": "Karsten Schmidt <k+npm@thi.ng>",
25
- "license": "Apache-2.0",
26
- "scripts": {
27
- "build": "yarn clean && tsc --declaration",
28
- "clean": "rimraf *.js *.d.ts *.map doc",
29
- "doc": "typedoc --excludePrivate --excludeInternal --out doc src/index.ts",
30
- "doc:ae": "mkdir -p .ae/doc .ae/temp && node_modules/.bin/api-extractor run --local --verbose",
31
- "doc:readme": "yarn doc:stats && ../../scripts/node-esm ../../tools/src/readme.ts",
32
- "doc:stats": "../../scripts/node-esm ../../tools/src/module-stats.ts",
33
- "pub": "yarn build && yarn publish --access public",
34
- "test": "testament test"
19
+ {
20
+ "type": "patreon",
21
+ "url": "https://patreon.com/thing_umbrella"
22
+ }
23
+ ],
24
+ "author": "Karsten Schmidt <k+npm@thi.ng>",
25
+ "license": "Apache-2.0",
26
+ "scripts": {
27
+ "build": "yarn clean && tsc --declaration",
28
+ "clean": "rimraf '*.js' '*.d.ts' '*.map' doc",
29
+ "doc": "typedoc --excludePrivate --excludeInternal --out doc src/index.ts",
30
+ "doc:ae": "mkdir -p .ae/doc .ae/temp && api-extractor run --local --verbose",
31
+ "doc:readme": "yarn doc:stats && tools:readme",
32
+ "doc:stats": "tools:module-stats",
33
+ "pub": "yarn npm publish --access public",
34
+ "test": "testament test"
35
+ },
36
+ "dependencies": {
37
+ "@thi.ng/api": "^8.3.2",
38
+ "@thi.ng/checks": "^3.1.2",
39
+ "@thi.ng/color": "^4.1.2",
40
+ "@thi.ng/math": "^5.1.2",
41
+ "@thi.ng/pixel": "^3.2.2",
42
+ "@thi.ng/vectors": "^7.2.2"
43
+ },
44
+ "devDependencies": {
45
+ "@microsoft/api-extractor": "^7.18.19",
46
+ "@thi.ng/testament": "^0.2.2",
47
+ "rimraf": "^3.0.2",
48
+ "tools": "^0.0.1",
49
+ "typedoc": "^0.22.9",
50
+ "typescript": "^4.5.2"
51
+ },
52
+ "keywords": [
53
+ "2d",
54
+ "arc",
55
+ "array",
56
+ "bezier",
57
+ "blend",
58
+ "canvas",
59
+ "circle",
60
+ "declarative",
61
+ "draw",
62
+ "gradient",
63
+ "graphics",
64
+ "hiccup",
65
+ "scenegraph",
66
+ "svg",
67
+ "tree",
68
+ "typescript"
69
+ ],
70
+ "publishConfig": {
71
+ "access": "public"
72
+ },
73
+ "engines": {
74
+ "node": ">=12.7"
75
+ },
76
+ "files": [
77
+ "*.js",
78
+ "*.d.ts",
79
+ "internal"
80
+ ],
81
+ "exports": {
82
+ ".": {
83
+ "import": "./index.js"
35
84
  },
36
- "dependencies": {
37
- "@thi.ng/api": "^8.1.0",
38
- "@thi.ng/checks": "^3.0.6",
39
- "@thi.ng/color": "^4.0.8",
40
- "@thi.ng/math": "^5.0.7",
41
- "@thi.ng/pixel": "^3.0.0",
42
- "@thi.ng/vectors": "^7.1.0"
85
+ "./api": {
86
+ "import": "./api.js"
43
87
  },
44
- "devDependencies": {
45
- "@thi.ng/pixel": "^1.0.0",
46
- "@thi.ng/testament": "^0.1.6"
88
+ "./arc": {
89
+ "import": "./arc.js"
47
90
  },
48
- "keywords": [
49
- "2d",
50
- "arc",
51
- "array",
52
- "bezier",
53
- "blend",
54
- "canvas",
55
- "circle",
56
- "declarative",
57
- "draw",
58
- "gradient",
59
- "graphics",
60
- "hiccup",
61
- "scenegraph",
62
- "svg",
63
- "tree",
64
- "typescript"
65
- ],
66
- "publishConfig": {
67
- "access": "public"
91
+ "./color": {
92
+ "import": "./color.js"
68
93
  },
69
- "engines": {
70
- "node": ">=12.7"
94
+ "./draw": {
95
+ "import": "./draw.js"
71
96
  },
72
- "files": [
73
- "*.js",
74
- "*.d.ts",
75
- "internal"
76
- ],
77
- "exports": {
78
- ".": {
79
- "import": "./index.js"
80
- },
81
- "./api": {
82
- "import": "./api.js"
83
- },
84
- "./arc": {
85
- "import": "./arc.js"
86
- },
87
- "./color": {
88
- "import": "./color.js"
89
- },
90
- "./draw": {
91
- "import": "./draw.js"
92
- },
93
- "./image": {
94
- "import": "./image.js"
95
- },
96
- "./line": {
97
- "import": "./line.js"
98
- },
99
- "./packed-points": {
100
- "import": "./packed-points.js"
101
- },
102
- "./path": {
103
- "import": "./path.js"
104
- },
105
- "./points": {
106
- "import": "./points.js"
107
- },
108
- "./polygon": {
109
- "import": "./polygon.js"
110
- },
111
- "./polyline": {
112
- "import": "./polyline.js"
113
- },
114
- "./rect": {
115
- "import": "./rect.js"
116
- },
117
- "./text": {
118
- "import": "./text.js"
119
- }
97
+ "./image": {
98
+ "import": "./image.js"
99
+ },
100
+ "./line": {
101
+ "import": "./line.js"
102
+ },
103
+ "./packed-points": {
104
+ "import": "./packed-points.js"
120
105
  },
121
- "thi.ng": {
122
- "parent": "@thi.ng/hiccup",
123
- "related": [
124
- "hdom-canvas",
125
- "hiccup"
126
- ],
127
- "year": 2018
106
+ "./path": {
107
+ "import": "./path.js"
128
108
  },
129
- "gitHead": "d6aca4b4edb697613ed6635b1c0b12f0bf27b1f0"
130
- }
109
+ "./points": {
110
+ "import": "./points.js"
111
+ },
112
+ "./polygon": {
113
+ "import": "./polygon.js"
114
+ },
115
+ "./polyline": {
116
+ "import": "./polyline.js"
117
+ },
118
+ "./rect": {
119
+ "import": "./rect.js"
120
+ },
121
+ "./text": {
122
+ "import": "./text.js"
123
+ }
124
+ },
125
+ "thi.ng": {
126
+ "parent": "@thi.ng/hiccup",
127
+ "related": [
128
+ "hdom-canvas",
129
+ "hiccup"
130
+ ],
131
+ "year": 2018
132
+ },
133
+ "gitHead": "e8a7c2a40191b391cef182c2978e5a6c85987a87\n"
134
+ }
package/packed-points.js CHANGED
@@ -20,7 +20,7 @@ const __drawPoints = (ctx, opts, pts, cmd, cmdR) => {
20
20
  ? opts.num
21
21
  : ((pts.length - start) / estride) | 0;
22
22
  if (opts.shape === "circle") {
23
- for (let i = start; --num >= 0; i += estride) {
23
+ for (let i = start; num-- > 0; i += estride) {
24
24
  ctx.beginPath();
25
25
  ctx.arc(pts[i], pts[i + cstride], size, 0, TAU);
26
26
  ctx[cmd]();
@@ -28,7 +28,7 @@ const __drawPoints = (ctx, opts, pts, cmd, cmdR) => {
28
28
  }
29
29
  else {
30
30
  const r = size / 2;
31
- for (let i = start; --num >= 0; i += estride) {
31
+ for (let i = start; num-- > 0; i += estride) {
32
32
  ctx[cmdR](pts[i] - r, pts[i + cstride] - r, size, size);
33
33
  }
34
34
  }