@thi.ng/rdom-canvas 0.1.57 → 0.2.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 +23 -75
- package/README.md +14 -6
- package/index.d.ts +3 -2
- package/index.js +12 -5
- package/package.json +30 -27
- package/lib/index.js +0 -58
- package/lib/index.js.map +0 -1
- package/lib/index.umd.js +0 -1
- package/lib/index.umd.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,100 +3,48 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
**Note:** Version bump only for package @thi.ng/rdom-canvas
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
## [0.1.56](https://github.com/thi-ng/umbrella/compare/@thi.ng/rdom-canvas@0.1.55...@thi.ng/rdom-canvas@0.1.56) (2021-08-17)
|
|
15
|
-
|
|
16
|
-
**Note:** Version bump only for package @thi.ng/rdom-canvas
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
## [0.1.55](https://github.com/thi-ng/umbrella/compare/@thi.ng/rdom-canvas@0.1.54...@thi.ng/rdom-canvas@0.1.55) (2021-08-08)
|
|
23
|
-
|
|
24
|
-
**Note:** Version bump only for package @thi.ng/rdom-canvas
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
## [0.1.54](https://github.com/thi-ng/umbrella/compare/@thi.ng/rdom-canvas@0.1.53...@thi.ng/rdom-canvas@0.1.54) (2021-08-08)
|
|
31
|
-
|
|
32
|
-
**Note:** Version bump only for package @thi.ng/rdom-canvas
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
## [0.1.53](https://github.com/thi-ng/umbrella/compare/@thi.ng/rdom-canvas@0.1.52...@thi.ng/rdom-canvas@0.1.53) (2021-08-08)
|
|
39
|
-
|
|
40
|
-
**Note:** Version bump only for package @thi.ng/rdom-canvas
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
## [0.1.52](https://github.com/thi-ng/umbrella/compare/@thi.ng/rdom-canvas@0.1.51...@thi.ng/rdom-canvas@0.1.52) (2021-08-04)
|
|
47
|
-
|
|
48
|
-
**Note:** Version bump only for package @thi.ng/rdom-canvas
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
## [0.1.51](https://github.com/thi-ng/umbrella/compare/@thi.ng/rdom-canvas@0.1.50...@thi.ng/rdom-canvas@0.1.51) (2021-08-04)
|
|
55
|
-
|
|
56
|
-
**Note:** Version bump only for package @thi.ng/rdom-canvas
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
## [0.1.50](https://github.com/thi-ng/umbrella/compare/@thi.ng/rdom-canvas@0.1.49...@thi.ng/rdom-canvas@0.1.50) (2021-07-27)
|
|
63
|
-
|
|
64
|
-
**Note:** Version bump only for package @thi.ng/rdom-canvas
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
## [0.1.49](https://github.com/thi-ng/umbrella/compare/@thi.ng/rdom-canvas@0.1.48...@thi.ng/rdom-canvas@0.1.49) (2021-07-01)
|
|
71
|
-
|
|
72
|
-
**Note:** Version bump only for package @thi.ng/rdom-canvas
|
|
6
|
+
# [0.2.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/rdom-canvas@0.1.60...@thi.ng/rdom-canvas@0.2.0) (2021-10-12)
|
|
73
7
|
|
|
74
8
|
|
|
9
|
+
### Bug Fixes
|
|
75
10
|
|
|
11
|
+
* minor updates (TS4.4) ([7e91cc2](https://github.com/thi-ng/umbrella/commit/7e91cc2b20371d6969f29ec40393d64efb3d9375))
|
|
76
12
|
|
|
77
13
|
|
|
78
|
-
|
|
14
|
+
### Build System
|
|
79
15
|
|
|
80
|
-
|
|
16
|
+
* major update of ALL pkgs (export maps, ESM only) ([0d1d6ea](https://github.com/thi-ng/umbrella/commit/0d1d6ea9fab2a645d6c5f2bf2591459b939c09b6))
|
|
81
17
|
|
|
82
18
|
|
|
19
|
+
### BREAKING CHANGES
|
|
83
20
|
|
|
21
|
+
* discontinue CommonJS & UMD versions
|
|
84
22
|
|
|
23
|
+
- only ESM modules will be published from now on
|
|
24
|
+
- CJS obsolete due to ESM support in recent versions of node:
|
|
25
|
+
- i.e. launch NodeJS via:
|
|
26
|
+
- `node --experimental-specifier-resolution=node --experimental-repl-await`
|
|
27
|
+
- in the node REPL use `await import(...)` instead of `require()`
|
|
28
|
+
- UMD obsolete due to widespread browser support for ESM
|
|
85
29
|
|
|
86
|
-
|
|
30
|
+
Also:
|
|
31
|
+
- normalize/restructure/reorg all package.json files
|
|
32
|
+
- cleanup all build scripts, remove obsolete
|
|
33
|
+
- switch from mocha to @thi.ng/testament for all tests
|
|
87
34
|
|
|
88
35
|
|
|
89
|
-
### Bug Fixes
|
|
90
36
|
|
|
91
|
-
* **rdom-canvas:** static canvas size handling ([1a03c70](https://github.com/thi-ng/umbrella/commit/1a03c70e3e9fe6c8b096f78084dc590102d96893))
|
|
92
37
|
|
|
93
38
|
|
|
94
39
|
|
|
40
|
+
## [0.1.9](https://github.com/thi-ng/umbrella/compare/@thi.ng/rdom-canvas@0.1.8...@thi.ng/rdom-canvas@0.1.9) (2020-07-28)
|
|
95
41
|
|
|
42
|
+
### Bug Fixes
|
|
96
43
|
|
|
97
|
-
|
|
44
|
+
- **rdom-canvas:** static canvas size handling ([1a03c70](https://github.com/thi-ng/umbrella/commit/1a03c70e3e9fe6c8b096f78084dc590102d96893))
|
|
98
45
|
|
|
46
|
+
# 0.1.0 (2020-07-02)
|
|
99
47
|
|
|
100
|
-
###
|
|
48
|
+
### Features
|
|
101
49
|
|
|
102
|
-
|
|
50
|
+
- **rdom-canvas:** import as new pkg ([369d4de](https://github.com/thi-ng/umbrella/commit/369d4de29c0b0c1ff3092126902f1835ac61870e))
|
package/README.md
CHANGED
|
@@ -42,15 +42,23 @@ This project is part of the
|
|
|
42
42
|
yarn add @thi.ng/rdom-canvas
|
|
43
43
|
```
|
|
44
44
|
|
|
45
|
+
ES module import:
|
|
46
|
+
|
|
45
47
|
```html
|
|
46
|
-
|
|
47
|
-
|
|
48
|
+
<script type="module" src="https://cdn.skypack.dev/@thi.ng/rdom-canvas"></script>
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
[Skypack documentation](https://docs.skypack.dev/)
|
|
52
|
+
|
|
53
|
+
For NodeJS (v14.6+):
|
|
54
|
+
|
|
55
|
+
```text
|
|
56
|
+
node --experimental-specifier-resolution=node --experimental-repl-await
|
|
48
57
|
|
|
49
|
-
|
|
50
|
-
<script src="https://unpkg.com/@thi.ng/rdom-canvas/lib/index.umd.js" crossorigin></script>
|
|
58
|
+
> const rdomCanvas = await import("@thi.ng/rdom-canvas");
|
|
51
59
|
```
|
|
52
60
|
|
|
53
|
-
Package sizes (gzipped, pre-treeshake): ESM:
|
|
61
|
+
Package sizes (gzipped, pre-treeshake): ESM: 601 bytes
|
|
54
62
|
|
|
55
63
|
## Dependencies
|
|
56
64
|
|
|
@@ -71,7 +79,7 @@ directory are using this package.
|
|
|
71
79
|
A selection:
|
|
72
80
|
|
|
73
81
|
| Screenshot | Description | Live demo | Source |
|
|
74
|
-
|
|
82
|
+
|:-------------------------------------------------------------------------------------------------------------------------|:--------------------------------------------------------|:--------------------------------------------------------|:-------------------------------------------------------------------------------------|
|
|
75
83
|
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/ellipse-proximity.png" width="240"/> | Interactive visualization of closest points on ellipses | [Demo](https://demo.thi.ng/umbrella/ellipse-proximity/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/ellipse-proximity) |
|
|
76
84
|
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/rdom-lissajous.png" width="240"/> | rdom & hiccup-canvas interop test | [Demo](https://demo.thi.ng/umbrella/rdom-lissajous/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/rdom-lissajous) |
|
|
77
85
|
|
package/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { IToHiccup } from "@thi.ng/api";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import type { IComponent, IMountWithState, NumOrElement } from "@thi.ng/rdom";
|
|
3
|
+
import { Component } from "@thi.ng/rdom/component";
|
|
4
|
+
import type { ISubscription } from "@thi.ng/rstream";
|
|
4
5
|
/**
|
|
5
6
|
* Reactive {@link @thi.ng/hiccup-canvas} component wrapper. Returns a
|
|
6
7
|
* canvas component wrapped in a {@link $sub} and updates/re-renders
|
package/index.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { adaptDPI } from "@thi.ng/adapt-dpi";
|
|
2
|
-
import { implementsFunction } from "@thi.ng/checks";
|
|
3
|
-
import { draw } from "@thi.ng/hiccup-canvas";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
2
|
+
import { implementsFunction } from "@thi.ng/checks/implements-function";
|
|
3
|
+
import { draw } from "@thi.ng/hiccup-canvas/draw";
|
|
4
|
+
import { Component } from "@thi.ng/rdom/component";
|
|
5
|
+
import { $sub } from "@thi.ng/rdom/sub";
|
|
6
|
+
import { isSubscribable } from "@thi.ng/rstream/checks";
|
|
7
|
+
import { reactive } from "@thi.ng/rstream/stream";
|
|
8
|
+
import { sideEffect } from "@thi.ng/transducers/side-effect";
|
|
7
9
|
/**
|
|
8
10
|
* Reactive {@link @thi.ng/hiccup-canvas} component wrapper. Returns a
|
|
9
11
|
* canvas component wrapped in a {@link $sub} and updates/re-renders
|
|
@@ -17,6 +19,11 @@ import { sideEffect } from "@thi.ng/transducers";
|
|
|
17
19
|
*/
|
|
18
20
|
export const $canvas = (body, size, attribs) => $sub(body, new $Canvas(size, attribs));
|
|
19
21
|
export class $Canvas extends Component {
|
|
22
|
+
attribs;
|
|
23
|
+
ctx;
|
|
24
|
+
inner;
|
|
25
|
+
size;
|
|
26
|
+
sizeSub;
|
|
20
27
|
constructor(size, attribs = {}) {
|
|
21
28
|
super();
|
|
22
29
|
this.attribs = attribs;
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/rdom-canvas",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "@thi.ng/rdom component wrapper for @thi.ng/hiccup-canvas and declarative canvas drawing",
|
|
5
|
+
"type": "module",
|
|
5
6
|
"module": "./index.js",
|
|
6
|
-
"main": "./lib/index.js",
|
|
7
|
-
"umd:main": "./lib/index.umd.js",
|
|
8
7
|
"typings": "./index.d.ts",
|
|
8
|
+
"sideEffects": false,
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
11
11
|
"url": "https://github.com/thi-ng/umbrella.git"
|
|
@@ -24,32 +24,27 @@
|
|
|
24
24
|
"author": "Karsten Schmidt <k+npm@thi.ng>",
|
|
25
25
|
"license": "Apache-2.0",
|
|
26
26
|
"scripts": {
|
|
27
|
-
"build": "yarn clean &&
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"build:test": "rimraf build && tsc -p test/tsconfig.json",
|
|
31
|
-
"test": "mocha test",
|
|
32
|
-
"cover": "nyc mocha test && nyc report --reporter=lcov",
|
|
33
|
-
"clean": "rimraf *.js *.d.ts *.map .nyc_output build coverage doc lib",
|
|
34
|
-
"doc:readme": "ts-node -P ../../tools/tsconfig.json ../../tools/src/readme.ts",
|
|
27
|
+
"build": "yarn clean && tsc --declaration",
|
|
28
|
+
"clean": "rimraf *.js *.d.ts *.map doc",
|
|
29
|
+
"doc": "typedoc --excludePrivate --excludeInternal --out doc src/index.ts",
|
|
35
30
|
"doc:ae": "mkdir -p .ae/doc .ae/temp && node_modules/.bin/api-extractor run --local --verbose",
|
|
36
|
-
"doc": "
|
|
37
|
-
"
|
|
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"
|
|
38
35
|
},
|
|
39
36
|
"dependencies": {
|
|
40
|
-
"@thi.ng/adapt-dpi": "^
|
|
41
|
-
"@thi.ng/api": "^
|
|
42
|
-
"@thi.ng/checks": "^
|
|
43
|
-
"@thi.ng/hiccup-canvas": "^
|
|
44
|
-
"@thi.ng/rdom": "^0.
|
|
45
|
-
"@thi.ng/rstream": "^
|
|
46
|
-
"@thi.ng/transducers": "^
|
|
37
|
+
"@thi.ng/adapt-dpi": "^2.0.0",
|
|
38
|
+
"@thi.ng/api": "^8.0.0",
|
|
39
|
+
"@thi.ng/checks": "^3.0.0",
|
|
40
|
+
"@thi.ng/hiccup-canvas": "^2.0.0",
|
|
41
|
+
"@thi.ng/rdom": "^0.7.0",
|
|
42
|
+
"@thi.ng/rstream": "^7.0.0",
|
|
43
|
+
"@thi.ng/transducers": "^8.0.0"
|
|
44
|
+
},
|
|
45
|
+
"devDependencies": {
|
|
46
|
+
"@thi.ng/testament": "^0.1.0"
|
|
47
47
|
},
|
|
48
|
-
"files": [
|
|
49
|
-
"*.js",
|
|
50
|
-
"*.d.ts",
|
|
51
|
-
"lib"
|
|
52
|
-
],
|
|
53
48
|
"keywords": [
|
|
54
49
|
"animation",
|
|
55
50
|
"browser",
|
|
@@ -66,7 +61,15 @@
|
|
|
66
61
|
"publishConfig": {
|
|
67
62
|
"access": "public"
|
|
68
63
|
},
|
|
69
|
-
"
|
|
64
|
+
"files": [
|
|
65
|
+
"*.js",
|
|
66
|
+
"*.d.ts"
|
|
67
|
+
],
|
|
68
|
+
"exports": {
|
|
69
|
+
".": {
|
|
70
|
+
"import": "./index.js"
|
|
71
|
+
}
|
|
72
|
+
},
|
|
70
73
|
"thi.ng": {
|
|
71
74
|
"parent": "@thi.ng/rdom",
|
|
72
75
|
"related": [
|
|
@@ -78,5 +81,5 @@
|
|
|
78
81
|
"status": "alpha",
|
|
79
82
|
"year": 2020
|
|
80
83
|
},
|
|
81
|
-
"gitHead": "
|
|
84
|
+
"gitHead": "9ac1344b38b565eb894306fbf72233b6c0b2d115"
|
|
82
85
|
}
|
package/lib/index.js
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var adaptDpi = require('@thi.ng/adapt-dpi');
|
|
6
|
-
var checks = require('@thi.ng/checks');
|
|
7
|
-
var hiccupCanvas = require('@thi.ng/hiccup-canvas');
|
|
8
|
-
var rdom = require('@thi.ng/rdom');
|
|
9
|
-
var rstream = require('@thi.ng/rstream');
|
|
10
|
-
var transducers = require('@thi.ng/transducers');
|
|
11
|
-
|
|
12
|
-
const $canvas = (body, size, attribs) => rdom.$sub(body, new $Canvas(size, attribs));
|
|
13
|
-
class $Canvas extends rdom.Component {
|
|
14
|
-
constructor(size, attribs = {}) {
|
|
15
|
-
super();
|
|
16
|
-
this.attribs = attribs;
|
|
17
|
-
this.size = rdom.isSubscribable(size)
|
|
18
|
-
? size
|
|
19
|
-
: rstream.reactive(size);
|
|
20
|
-
this.sizeSub = this.size.transform(transducers.sideEffect((size) => this.resize(size)));
|
|
21
|
-
}
|
|
22
|
-
async mount(parent, index, shapes) {
|
|
23
|
-
this.inner = this.$compile(["canvas", this.attribs]);
|
|
24
|
-
this.el = await this.inner.mount(parent, index);
|
|
25
|
-
this.ctx = this.el.getContext("2d");
|
|
26
|
-
this.resize(this.size.deref());
|
|
27
|
-
this.update(shapes);
|
|
28
|
-
return this.el;
|
|
29
|
-
}
|
|
30
|
-
async unmount() {
|
|
31
|
-
this.inner.unmount();
|
|
32
|
-
this.sizeSub.unsubscribe();
|
|
33
|
-
this.inner = undefined;
|
|
34
|
-
this.el = undefined;
|
|
35
|
-
this.ctx = undefined;
|
|
36
|
-
}
|
|
37
|
-
resize(size) {
|
|
38
|
-
if (this.el) {
|
|
39
|
-
adaptDpi.adaptDPI(this.el, size[0], size[1]);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
update(tree) {
|
|
43
|
-
if (tree == null)
|
|
44
|
-
return;
|
|
45
|
-
const shapes = checks.implementsFunction(tree, "toHiccup")
|
|
46
|
-
? tree.toHiccup()
|
|
47
|
-
: tree;
|
|
48
|
-
shapes[1].__clear !== false &&
|
|
49
|
-
this.ctx.clearRect(0, 0, this.el.width, this.el.height);
|
|
50
|
-
const scale = window.devicePixelRatio || 1;
|
|
51
|
-
this.ctx.resetTransform();
|
|
52
|
-
this.ctx.scale(scale, scale);
|
|
53
|
-
hiccupCanvas.draw(this.ctx, shapes);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
exports.$Canvas = $Canvas;
|
|
58
|
-
exports.$canvas = $canvas;
|
package/lib/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../index.js"],"sourcesContent":null,"names":["$sub","Component","isSubscribable","reactive","sideEffect","adaptDPI","implementsFunction","draw"],"mappings":";;;;;;;;;;;AAiBY,MAAC,OAAO,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,KAAKA,SAAI,CAAC,IAAI,EAAE,IAAI,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,EAAE;AAChF,MAAM,OAAO,SAASC,cAAS,CAAC;AACvC,IAAI,WAAW,CAAC,IAAI,EAAE,OAAO,GAAG,EAAE,EAAE;AACpC,QAAQ,KAAK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CAAC;AAC7B,KAAK;AACL,IAAI,MAAM,CAAC,IAAI,EAAE;AACjB,QAAQ,IAAI,IAAI,CAAC,EAAE,EAAE;AACrB,YAAYC,iBAAQ,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;AAChD,SAAS;AACT,KAAK;AACL,IAAI,MAAM,CAAC,IAAI,EAAE;AACjB,QAAQ,IAAI,IAAI,IAAI,IAAI;AACxB,YAAY,OAAO;AACnB,QAAQ,MAAM,MAAM,GAAGC,yBAAkB,CAAC,IAAI,EAAE,UAAU,CAAC;AAC3D,cAAc,IAAI,CAAC,QAAQ,EAAE;AAC7B,cAAc,IAAI,CAAC;AACnB,QAAQ,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,KAAK,KAAK;AACnC,YAAY,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,EAAE,CAAC,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC;AACpE,QAAQ,MAAM,KAAK,GAAG,MAAM,CAAC,gBAAgB,IAAI,CAAC,CAAC;AACnD,QAAQ,IAAI,CAAC,GAAG,CAAC,cAAc,EAAE,CAAC;AAClC,QAAQ,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;AACrC,QAAQC,iBAAI,CAAC,IAAI,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;AAC/B,KAAK;AACL;;;;;"}
|
package/lib/index.umd.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
!function(t,i){"object"==typeof exports&&"undefined"!=typeof module?i(exports,require("@thi.ng/adapt-dpi"),require("@thi.ng/checks"),require("@thi.ng/hiccup-canvas"),require("@thi.ng/rdom"),require("@thi.ng/rstream"),require("@thi.ng/transducers")):"function"==typeof define&&define.amd?define(["exports","@thi.ng/adapt-dpi","@thi.ng/checks","@thi.ng/hiccup-canvas","@thi.ng/rdom","@thi.ng/rstream","@thi.ng/transducers"],i):i(((t="undefined"!=typeof globalThis?globalThis:t||self).thi=t.thi||{},t.thi.ng=t.thi.ng||{},t.thi.ng.rdomCanvas={}),t.thi.ng.adaptDpi,t.thi.ng.checks,t.thi.ng.hiccupCanvas,t.thi.ng.rdom,t.thi.ng.rstream,t.thi.ng.transducers)}(this,(function(t,i,e,s,n,h,r){"use strict";class c extends n.Component{constructor(t,i={}){super(),this.attribs=i,this.size=n.isSubscribable(t)?t:h.reactive(t),this.sizeSub=this.size.transform(r.sideEffect((t=>this.resize(t))))}async mount(t,i,e){return this.inner=this.$compile(["canvas",this.attribs]),this.el=await this.inner.mount(t,i),this.ctx=this.el.getContext("2d"),this.resize(this.size.deref()),this.update(e),this.el}async unmount(){this.inner.unmount(),this.sizeSub.unsubscribe(),this.inner=void 0,this.el=void 0,this.ctx=void 0}resize(t){this.el&&i.adaptDPI(this.el,t[0],t[1])}update(t){if(null==t)return;const i=e.implementsFunction(t,"toHiccup")?t.toHiccup():t;!1!==i[1].__clear&&this.ctx.clearRect(0,0,this.el.width,this.el.height);const n=window.devicePixelRatio||1;this.ctx.resetTransform(),this.ctx.scale(n,n),s.draw(this.ctx,i)}}t.$Canvas=c,t.$canvas=(t,i,e)=>n.$sub(t,new c(i,e)),Object.defineProperty(t,"__esModule",{value:!0})}));
|
package/lib/index.umd.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.umd.js","sources":["../index.js"],"sourcesContent":null,"names":["$sub","Component","isSubscribable","reactive","sideEffect","adaptDPI","implementsFunction","draw"],"mappings":";;;;;;AAiBY,UAAC,OAAO,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,KAAKA,SAAI,CAAC,IAAI,EAAE,IAAI,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,EAAE;IAChF,MAAM,OAAO,SAASC,cAAS,CAAC;IACvC,IAAI,WAAW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