@operato/scene-compass 0.0.11
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/@types/global/index.d.ts +1 -0
- package/CHANGELOG.md +12 -0
- package/LICENSE +21 -0
- package/README.md +11 -0
- package/assets/compass.png +0 -0
- package/demo/index.html +91 -0
- package/demo/things-scene-compass.html +5 -0
- package/dist/compass.d.ts +20 -0
- package/dist/compass.js +118 -0
- package/dist/compass.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -0
- package/helps/scene/component/compass.ko.md +4 -0
- package/helps/scene/component/compass.md +4 -0
- package/helps/scene/component/compass.zh.md +4 -0
- package/package.json +62 -0
- package/src/compass.ts +139 -0
- package/src/index.ts +4 -0
- package/test/basic-test.html +67 -0
- package/test/index.html +22 -0
- package/things-scene.config.js +27 -0
- package/tsconfig.json +23 -0
- package/tsconfig.tsbuildinfo +1 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
declare module '*.png'
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Change Log
|
|
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
|
+
### [0.0.11](https://github.com/things-scene/operato-scene/compare/v0.0.10...v0.0.11) (2021-12-06)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### :rocket: New Features
|
|
10
|
+
|
|
11
|
+
* add wheel-sorter, legend, timer and compass ([dc90f73](https://github.com/things-scene/operato-scene/commit/dc90f73054424c0867a1c4a28d51da6e7fab8b85))
|
|
12
|
+
* add wheel-sorter, legend, timer and compass ([518950c](https://github.com/things-scene/operato-scene/commit/518950cb5476048504a415a1dd0a1fd2d4359a77))
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021 Hearty, Oh
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# things-scene-compass
|
|
2
|
+
|
|
3
|
+
## build
|
|
4
|
+
|
|
5
|
+
`$ yarn build`
|
|
6
|
+
|
|
7
|
+
| type | filename | for | tested |
|
|
8
|
+
| ---- | -------------------------- | -------------- | ------ |
|
|
9
|
+
| UMD | things-scene-compass.js | modern browser | O |
|
|
10
|
+
| UMD | things-scene-compass-ie.js | ie 11 | O |
|
|
11
|
+
| ESM | things-scene-compass.mjs | modern browser | O |
|
|
Binary file
|
package/demo/index.html
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<!--
|
|
3
|
+
@license
|
|
4
|
+
Copyright © HatioLab Inc. All rights reserved.
|
|
5
|
+
-->
|
|
6
|
+
<html>
|
|
7
|
+
<head>
|
|
8
|
+
<meta charset="utf-8">
|
|
9
|
+
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes">
|
|
10
|
+
<title>things-scene-compass Demo</title>
|
|
11
|
+
<script src="../../webcomponentsjs/webcomponents-lite.min.js"></script>
|
|
12
|
+
|
|
13
|
+
<link rel="import" href="../../things-scene-viewer/things-scene-viewer.html">
|
|
14
|
+
<link rel="import" href="../../things-scene-viewer/things-scene-layer.html">
|
|
15
|
+
<link rel="import" href="../../things-scene-viewer/things-scene-handler.html">
|
|
16
|
+
|
|
17
|
+
<link rel="import" href="../../things-designer-elements/things-editor-color.html">
|
|
18
|
+
<link rel="import" href="../../things-designer-elements/things-editor-color-stops.html">
|
|
19
|
+
<link rel="import" href="../../things-scene-modeler/things-scene-properties.html">
|
|
20
|
+
|
|
21
|
+
<link rel="import" href="./things-scene-compass.html">
|
|
22
|
+
|
|
23
|
+
<style is="custom-style">
|
|
24
|
+
|
|
25
|
+
@font-face {
|
|
26
|
+
font-family: "Bitstream Vera Serif Bold";
|
|
27
|
+
src: url("fonts/VeraSeBd.ttf");
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
things-scene-viewer {
|
|
31
|
+
display: block;
|
|
32
|
+
width: 640px;
|
|
33
|
+
height: 480px;
|
|
34
|
+
}
|
|
35
|
+
</style>
|
|
36
|
+
</head>
|
|
37
|
+
<body unresolved>
|
|
38
|
+
|
|
39
|
+
<template is="dom-bind" id="app">
|
|
40
|
+
<p>An example of <code><things-scene-compass></code>:</p>
|
|
41
|
+
|
|
42
|
+
<things-scene-viewer id='scene'
|
|
43
|
+
scene='{{scene}}'
|
|
44
|
+
selected='{{selected}}'
|
|
45
|
+
model='[[model]]'
|
|
46
|
+
mode="1">
|
|
47
|
+
<things-scene-layer type="selection-layer"></things-scene-layer>
|
|
48
|
+
<things-scene-layer type="modeling-layer"></things-scene-layer>
|
|
49
|
+
<things-scene-handler type="text-editor"></things-scene-handler>
|
|
50
|
+
<things-scene-handler type="move-handler"></things-scene-handler>
|
|
51
|
+
</things-scene-viewer>
|
|
52
|
+
|
|
53
|
+
<things-scene-properties scene="[[scene]]"
|
|
54
|
+
selected="[[selected]]"
|
|
55
|
+
model="{{target}}"
|
|
56
|
+
bounds="{{bounds}}">
|
|
57
|
+
<fieldset>
|
|
58
|
+
<legend>compass style</legend>
|
|
59
|
+
<label>value</label>
|
|
60
|
+
<input type="number" value-as-number="{{target.value::change}}" min="0" max="100" step="1"/>
|
|
61
|
+
</fieldset>
|
|
62
|
+
</things-scene-properties>
|
|
63
|
+
|
|
64
|
+
</template>
|
|
65
|
+
|
|
66
|
+
<script>
|
|
67
|
+
window.addEventListener('WebComponentsReady', function(e) {
|
|
68
|
+
var app = document.querySelector('#app')
|
|
69
|
+
|
|
70
|
+
app.model = {
|
|
71
|
+
fillStyle: '#0EB22A',
|
|
72
|
+
width: 1500,
|
|
73
|
+
height: 1000,
|
|
74
|
+
components: [{
|
|
75
|
+
type: 'compass',
|
|
76
|
+
cx: 600,
|
|
77
|
+
cy: 400,
|
|
78
|
+
rx: 300,
|
|
79
|
+
ry: 300,
|
|
80
|
+
value: 0,
|
|
81
|
+
fontSize: 80,
|
|
82
|
+
fillStyle: '#F2F2F2',
|
|
83
|
+
strokeStyle: '#AAAAAA',
|
|
84
|
+
lineWidth: 10,
|
|
85
|
+
fontColor: '#ff0000',
|
|
86
|
+
}]
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
</script>
|
|
90
|
+
</body>
|
|
91
|
+
</html>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Ellipse, Properties } from '@hatiolab/things-scene';
|
|
2
|
+
export default class Compass extends Ellipse {
|
|
3
|
+
private _anim_alpha;
|
|
4
|
+
is3dish(): boolean;
|
|
5
|
+
_draw(context: CanvasRenderingContext2D): void;
|
|
6
|
+
_post_draw(context: CanvasRenderingContext2D): void;
|
|
7
|
+
onchange(after: Properties, before: Properties): void;
|
|
8
|
+
get nature(): {
|
|
9
|
+
mutable: boolean;
|
|
10
|
+
resizable: boolean;
|
|
11
|
+
rotatable: boolean;
|
|
12
|
+
properties: {
|
|
13
|
+
type: string;
|
|
14
|
+
label: string;
|
|
15
|
+
name: string;
|
|
16
|
+
property: string;
|
|
17
|
+
}[];
|
|
18
|
+
help: string;
|
|
19
|
+
};
|
|
20
|
+
}
|
package/dist/compass.js
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import { Component, Ellipse } from '@hatiolab/things-scene';
|
|
5
|
+
const NATURE = {
|
|
6
|
+
mutable: false,
|
|
7
|
+
resizable: true,
|
|
8
|
+
rotatable: true,
|
|
9
|
+
properties: [
|
|
10
|
+
{
|
|
11
|
+
type: 'number',
|
|
12
|
+
label: 'value',
|
|
13
|
+
name: 'value',
|
|
14
|
+
property: 'value'
|
|
15
|
+
}
|
|
16
|
+
],
|
|
17
|
+
help: 'scene/component/compass'
|
|
18
|
+
};
|
|
19
|
+
export default class Compass extends Ellipse {
|
|
20
|
+
constructor() {
|
|
21
|
+
super(...arguments);
|
|
22
|
+
this._anim_alpha = 0;
|
|
23
|
+
}
|
|
24
|
+
is3dish() {
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
_draw(context) {
|
|
28
|
+
var { value = 0, fillStyle, cx, cy, rx, ry } = this.model;
|
|
29
|
+
context.translate(cx, cy);
|
|
30
|
+
//// 메인 원 그리기 ////
|
|
31
|
+
context.beginPath();
|
|
32
|
+
context.ellipse(0, 0, Math.abs(rx), Math.abs(ry), 0, 0, 2 * Math.PI);
|
|
33
|
+
context.ellipse(0, 0, Math.abs(rx * 0.75), Math.abs(ry * 0.75), 0, 2 * Math.PI, 0, true); // 반대로 그리며 원을 지움.
|
|
34
|
+
this.drawStroke(context);
|
|
35
|
+
this.drawFill(context);
|
|
36
|
+
context.closePath();
|
|
37
|
+
//// 무늬 그리기 ////
|
|
38
|
+
context.beginPath();
|
|
39
|
+
context.moveTo(rx * 0.65, 0);
|
|
40
|
+
context.lineTo(0, ry * 0.09);
|
|
41
|
+
context.lineTo(-rx * 0.65, 0);
|
|
42
|
+
context.lineTo(0, -ry * 0.09);
|
|
43
|
+
context.moveTo(0, ry * 0.65);
|
|
44
|
+
context.lineTo(rx * 0.09, 0);
|
|
45
|
+
context.lineTo(0, -ry * 0.65);
|
|
46
|
+
context.lineTo(-rx * 0.09, 0);
|
|
47
|
+
context.fillStyle = fillStyle;
|
|
48
|
+
context.fill();
|
|
49
|
+
context.closePath();
|
|
50
|
+
//// 텍스트 그리기 ////
|
|
51
|
+
context.beginPath();
|
|
52
|
+
context.fillStyle = 'black';
|
|
53
|
+
context.font = (rx + ry) / 13 + 'px arial';
|
|
54
|
+
context.textBaseline = 'middle';
|
|
55
|
+
context.textAlign = 'center';
|
|
56
|
+
context.fillText('N', 0, -ry + ry * 0.125);
|
|
57
|
+
context.fillText('S', 0, ry - ry * 0.125);
|
|
58
|
+
context.fillText('W', -rx + rx * 0.125, 0);
|
|
59
|
+
context.fillText('E', rx - rx * 0.125, 0);
|
|
60
|
+
//// 바늘 그리기 ////
|
|
61
|
+
context.beginPath();
|
|
62
|
+
var ang = ((value + (this._anim_alpha || 0)) / 50) * Math.PI;
|
|
63
|
+
context.rotate(ang);
|
|
64
|
+
context.moveTo(0, -ry * 0.65);
|
|
65
|
+
context.lineTo(rx * 0.13, 0);
|
|
66
|
+
context.lineTo(-rx * 0.13, 0);
|
|
67
|
+
context.fillStyle = '#F53B3B';
|
|
68
|
+
context.fill();
|
|
69
|
+
context.beginPath();
|
|
70
|
+
context.moveTo(0, ry * 0.65);
|
|
71
|
+
context.lineTo(rx * 0.13, 0);
|
|
72
|
+
context.lineTo(-rx * 0.13, 0);
|
|
73
|
+
context.fillStyle = '#3DC0E8';
|
|
74
|
+
context.fill();
|
|
75
|
+
context.rotate(-ang);
|
|
76
|
+
//// 중앙 원 그리기 ////
|
|
77
|
+
context.beginPath();
|
|
78
|
+
context.ellipse(0, 0, Math.abs(rx * 0.15), Math.abs(ry * 0.15), 0, 0, 2 * Math.PI);
|
|
79
|
+
context.lineWidth = (rx + ry) * 0.013;
|
|
80
|
+
context.strokeStyle = '#FFFFFF';
|
|
81
|
+
context.fillStyle = '#3DC0E8';
|
|
82
|
+
context.fill();
|
|
83
|
+
context.stroke();
|
|
84
|
+
context.beginPath();
|
|
85
|
+
context.ellipse(0, 0, Math.abs(rx * 0.06), Math.abs(ry * 0.06), 0, 0, 2 * Math.PI);
|
|
86
|
+
context.fillStyle = '#FFFFFF';
|
|
87
|
+
context.fill();
|
|
88
|
+
context.closePath();
|
|
89
|
+
context.translate(-cx, -cy);
|
|
90
|
+
}
|
|
91
|
+
_post_draw(context) {
|
|
92
|
+
this.drawText(context);
|
|
93
|
+
}
|
|
94
|
+
onchange(after, before) {
|
|
95
|
+
if (!after.hasOwnProperty('value'))
|
|
96
|
+
return;
|
|
97
|
+
var self = this;
|
|
98
|
+
var diff = after.value - before.value;
|
|
99
|
+
this._anim_alpha = -diff;
|
|
100
|
+
this.animate({
|
|
101
|
+
step: function (delta) {
|
|
102
|
+
self._anim_alpha = diff * (delta - 1);
|
|
103
|
+
self.invalidate();
|
|
104
|
+
},
|
|
105
|
+
duration: 1000,
|
|
106
|
+
delta: 'elastic',
|
|
107
|
+
options: {
|
|
108
|
+
x: 2
|
|
109
|
+
},
|
|
110
|
+
ease: 'out'
|
|
111
|
+
}).start();
|
|
112
|
+
}
|
|
113
|
+
get nature() {
|
|
114
|
+
return NATURE;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
Component.register('compass', Compass);
|
|
118
|
+
//# sourceMappingURL=compass.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{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C,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC;YAAE,OAAM;QAE1C,IAAI,IAAI,GAAG,IAAI,CAAA;QACf,IAAI,IAAI,GAAG,KAAK,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAA;QAErC,IAAI,CAAC,WAAW,GAAG,CAAC,IAAI,CAAA;QAExB,IAAI,CAAC,OAAO,CAAC;YACX,IAAI,EAAE,UAAU,KAAa;gBAC3B,IAAI,CAAC,WAAW,GAAG,IAAI,GAAG,CAAC,KAAK,GAAG,CAAC,CAAC,CAAA;gBACrC,IAAI,CAAC,UAAU,EAAE,CAAA;YACnB,CAAC;YACD,QAAQ,EAAE,IAAI;YACd,KAAK,EAAE,SAAS;YAChB,OAAO,EAAE;gBACP,CAAC,EAAE,CAAC;aACL;YACD,IAAI,EAAE,KAAK;SACZ,CAAC,CAAC,KAAK,EAAE,CAAA;IACZ,CAAC;IAED,IAAI,MAAM;QACR,OAAO,MAAM,CAAA;IACf,CAAC;CACF;AAED,SAAS,CAAC,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC,CAAA","sourcesContent":["/*\n * Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport { Component, Ellipse, Properties } from '@hatiolab/things-scene'\n\nconst NATURE = {\n mutable: false,\n resizable: true,\n rotatable: true,\n properties: [\n {\n type: 'number',\n label: 'value',\n name: 'value',\n property: 'value'\n }\n ],\n help: 'scene/component/compass'\n}\n\nexport default class Compass extends Ellipse {\n private _anim_alpha: number = 0\n\n is3dish() {\n return false\n }\n\n _draw(context: CanvasRenderingContext2D) {\n var { value = 0, fillStyle, cx, cy, rx, ry } = this.model\n\n context.translate(cx, cy)\n\n //// 메인 원 그리기 ////\n context.beginPath()\n context.ellipse(0, 0, Math.abs(rx), Math.abs(ry), 0, 0, 2 * Math.PI)\n context.ellipse(0, 0, Math.abs(rx * 0.75), Math.abs(ry * 0.75), 0, 2 * Math.PI, 0, true) // 반대로 그리며 원을 지움.\n\n this.drawStroke(context)\n this.drawFill(context)\n context.closePath()\n\n //// 무늬 그리기 ////\n context.beginPath()\n context.moveTo(rx * 0.65, 0)\n context.lineTo(0, ry * 0.09)\n context.lineTo(-rx * 0.65, 0)\n context.lineTo(0, -ry * 0.09)\n\n context.moveTo(0, ry * 0.65)\n context.lineTo(rx * 0.09, 0)\n context.lineTo(0, -ry * 0.65)\n context.lineTo(-rx * 0.09, 0)\n\n context.fillStyle = fillStyle\n context.fill()\n context.closePath()\n\n //// 텍스트 그리기 ////\n context.beginPath()\n context.fillStyle = 'black'\n context.font = (rx + ry) / 13 + 'px arial'\n context.textBaseline = 'middle'\n context.textAlign = 'center'\n context.fillText('N', 0, -ry + ry * 0.125)\n context.fillText('S', 0, ry - ry * 0.125)\n context.fillText('W', -rx + rx * 0.125, 0)\n context.fillText('E', rx - rx * 0.125, 0)\n\n //// 바늘 그리기 ////\n context.beginPath()\n var ang = ((value + (this._anim_alpha || 0)) / 50) * Math.PI\n context.rotate(ang)\n\n context.moveTo(0, -ry * 0.65)\n context.lineTo(rx * 0.13, 0)\n context.lineTo(-rx * 0.13, 0)\n context.fillStyle = '#F53B3B'\n context.fill()\n\n context.beginPath()\n context.moveTo(0, ry * 0.65)\n context.lineTo(rx * 0.13, 0)\n context.lineTo(-rx * 0.13, 0)\n context.fillStyle = '#3DC0E8'\n context.fill()\n\n context.rotate(-ang)\n\n //// 중앙 원 그리기 ////\n context.beginPath()\n context.ellipse(0, 0, Math.abs(rx * 0.15), Math.abs(ry * 0.15), 0, 0, 2 * Math.PI)\n context.lineWidth = (rx + ry) * 0.013\n context.strokeStyle = '#FFFFFF'\n context.fillStyle = '#3DC0E8'\n context.fill()\n context.stroke()\n context.beginPath()\n\n context.ellipse(0, 0, Math.abs(rx * 0.06), Math.abs(ry * 0.06), 0, 0, 2 * Math.PI)\n context.fillStyle = '#FFFFFF'\n context.fill()\n context.closePath()\n\n context.translate(-cx, -cy)\n }\n\n _post_draw(context: CanvasRenderingContext2D) {\n this.drawText(context)\n }\n\n onchange(after: Properties, before: Properties) {\n if (!after.hasOwnProperty('value')) return\n\n var self = this\n var diff = after.value - before.value\n\n this._anim_alpha = -diff\n\n this.animate({\n step: function (delta: number) {\n self._anim_alpha = diff * (delta - 1)\n self.invalidate()\n },\n duration: 1000,\n delta: 'elastic',\n options: {\n x: 2\n },\n ease: 'out'\n }).start()\n }\n\n get nature() {\n return NATURE\n }\n}\n\nComponent.register('compass', Compass)\n"]}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Compass } from './compass';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACF,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,WAAW,CAAA","sourcesContent":["/*\n * Copyright © HatioLab Inc. All rights reserved.\n */\n export { default as Compass } from './compass'\n"]}
|
package/package.json
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@operato/scene-compass",
|
|
3
|
+
"description": "Compass Component for things-scene.",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"author": "heartyoh",
|
|
6
|
+
"version": "0.0.11",
|
|
7
|
+
"main": "dist/index.js",
|
|
8
|
+
"module": "dist/index.js",
|
|
9
|
+
"things-scene": true,
|
|
10
|
+
"publishConfig": {
|
|
11
|
+
"access": "public",
|
|
12
|
+
"@oprato:registry": "https://registry.npmjs.org"
|
|
13
|
+
},
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "git+https://github.com/things-scene/operato-scene.git",
|
|
17
|
+
"directory": "packages/compass"
|
|
18
|
+
},
|
|
19
|
+
"scripts": {
|
|
20
|
+
"serve": "tsc && things-factory-dev",
|
|
21
|
+
"start": "tsc && concurrently -k -r \"tsc --watch --preserveWatchOutput\" \"wds\"",
|
|
22
|
+
"build": "tsc",
|
|
23
|
+
"prepublish": "tsc",
|
|
24
|
+
"lint": "eslint --ext .ts,.html . --ignore-path .gitignore && prettier \"**/*.ts\" --check --ignore-path .gitignore",
|
|
25
|
+
"format": "eslint --ext .ts,.html . --fix --ignore-path .gitignore && prettier \"**/*.ts\" --write --ignore-path .gitignore",
|
|
26
|
+
"migration": "things-factory-migration"
|
|
27
|
+
},
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"@hatiolab/things-scene": "^2.7.23"
|
|
30
|
+
},
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"@hatiolab/prettier-config": "^1.0.0",
|
|
33
|
+
"@hatiolab/things-scene": "^2.7.23",
|
|
34
|
+
"@operato/board": "^0.2.35",
|
|
35
|
+
"@things-factory/builder": "^4.0.10",
|
|
36
|
+
"@things-factory/operato-board": "^4.0.10",
|
|
37
|
+
"@typescript-eslint/eslint-plugin": "^4.33.0",
|
|
38
|
+
"@typescript-eslint/parser": "^4.33.0",
|
|
39
|
+
"@web/dev-server": "^0.1.28",
|
|
40
|
+
"concurrently": "^5.3.0",
|
|
41
|
+
"eslint": "^7.32.0",
|
|
42
|
+
"eslint-config-prettier": "^8.3.0",
|
|
43
|
+
"husky": "^4.3.8",
|
|
44
|
+
"lint-staged": "^10.5.4",
|
|
45
|
+
"prettier": "^2.4.1",
|
|
46
|
+
"tslib": "^2.3.1",
|
|
47
|
+
"typescript": "^4.5.2"
|
|
48
|
+
},
|
|
49
|
+
"prettier": "@hatiolab/prettier-config",
|
|
50
|
+
"husky": {
|
|
51
|
+
"hooks": {
|
|
52
|
+
"pre-commit": "lint-staged"
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
"lint-staged": {
|
|
56
|
+
"*.ts": [
|
|
57
|
+
"eslint --fix",
|
|
58
|
+
"prettier --write"
|
|
59
|
+
]
|
|
60
|
+
},
|
|
61
|
+
"gitHead": "1421380ee3530169c280b01a21c81af8d1b9f9c4"
|
|
62
|
+
}
|
package/src/compass.ts
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { Component, Ellipse, Properties } from '@hatiolab/things-scene'
|
|
6
|
+
|
|
7
|
+
const NATURE = {
|
|
8
|
+
mutable: false,
|
|
9
|
+
resizable: true,
|
|
10
|
+
rotatable: true,
|
|
11
|
+
properties: [
|
|
12
|
+
{
|
|
13
|
+
type: 'number',
|
|
14
|
+
label: 'value',
|
|
15
|
+
name: 'value',
|
|
16
|
+
property: 'value'
|
|
17
|
+
}
|
|
18
|
+
],
|
|
19
|
+
help: 'scene/component/compass'
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export default class Compass extends Ellipse {
|
|
23
|
+
private _anim_alpha: number = 0
|
|
24
|
+
|
|
25
|
+
is3dish() {
|
|
26
|
+
return false
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
_draw(context: CanvasRenderingContext2D) {
|
|
30
|
+
var { value = 0, fillStyle, cx, cy, rx, ry } = this.model
|
|
31
|
+
|
|
32
|
+
context.translate(cx, cy)
|
|
33
|
+
|
|
34
|
+
//// 메인 원 그리기 ////
|
|
35
|
+
context.beginPath()
|
|
36
|
+
context.ellipse(0, 0, Math.abs(rx), Math.abs(ry), 0, 0, 2 * Math.PI)
|
|
37
|
+
context.ellipse(0, 0, Math.abs(rx * 0.75), Math.abs(ry * 0.75), 0, 2 * Math.PI, 0, true) // 반대로 그리며 원을 지움.
|
|
38
|
+
|
|
39
|
+
this.drawStroke(context)
|
|
40
|
+
this.drawFill(context)
|
|
41
|
+
context.closePath()
|
|
42
|
+
|
|
43
|
+
//// 무늬 그리기 ////
|
|
44
|
+
context.beginPath()
|
|
45
|
+
context.moveTo(rx * 0.65, 0)
|
|
46
|
+
context.lineTo(0, ry * 0.09)
|
|
47
|
+
context.lineTo(-rx * 0.65, 0)
|
|
48
|
+
context.lineTo(0, -ry * 0.09)
|
|
49
|
+
|
|
50
|
+
context.moveTo(0, ry * 0.65)
|
|
51
|
+
context.lineTo(rx * 0.09, 0)
|
|
52
|
+
context.lineTo(0, -ry * 0.65)
|
|
53
|
+
context.lineTo(-rx * 0.09, 0)
|
|
54
|
+
|
|
55
|
+
context.fillStyle = fillStyle
|
|
56
|
+
context.fill()
|
|
57
|
+
context.closePath()
|
|
58
|
+
|
|
59
|
+
//// 텍스트 그리기 ////
|
|
60
|
+
context.beginPath()
|
|
61
|
+
context.fillStyle = 'black'
|
|
62
|
+
context.font = (rx + ry) / 13 + 'px arial'
|
|
63
|
+
context.textBaseline = 'middle'
|
|
64
|
+
context.textAlign = 'center'
|
|
65
|
+
context.fillText('N', 0, -ry + ry * 0.125)
|
|
66
|
+
context.fillText('S', 0, ry - ry * 0.125)
|
|
67
|
+
context.fillText('W', -rx + rx * 0.125, 0)
|
|
68
|
+
context.fillText('E', rx - rx * 0.125, 0)
|
|
69
|
+
|
|
70
|
+
//// 바늘 그리기 ////
|
|
71
|
+
context.beginPath()
|
|
72
|
+
var ang = ((value + (this._anim_alpha || 0)) / 50) * Math.PI
|
|
73
|
+
context.rotate(ang)
|
|
74
|
+
|
|
75
|
+
context.moveTo(0, -ry * 0.65)
|
|
76
|
+
context.lineTo(rx * 0.13, 0)
|
|
77
|
+
context.lineTo(-rx * 0.13, 0)
|
|
78
|
+
context.fillStyle = '#F53B3B'
|
|
79
|
+
context.fill()
|
|
80
|
+
|
|
81
|
+
context.beginPath()
|
|
82
|
+
context.moveTo(0, ry * 0.65)
|
|
83
|
+
context.lineTo(rx * 0.13, 0)
|
|
84
|
+
context.lineTo(-rx * 0.13, 0)
|
|
85
|
+
context.fillStyle = '#3DC0E8'
|
|
86
|
+
context.fill()
|
|
87
|
+
|
|
88
|
+
context.rotate(-ang)
|
|
89
|
+
|
|
90
|
+
//// 중앙 원 그리기 ////
|
|
91
|
+
context.beginPath()
|
|
92
|
+
context.ellipse(0, 0, Math.abs(rx * 0.15), Math.abs(ry * 0.15), 0, 0, 2 * Math.PI)
|
|
93
|
+
context.lineWidth = (rx + ry) * 0.013
|
|
94
|
+
context.strokeStyle = '#FFFFFF'
|
|
95
|
+
context.fillStyle = '#3DC0E8'
|
|
96
|
+
context.fill()
|
|
97
|
+
context.stroke()
|
|
98
|
+
context.beginPath()
|
|
99
|
+
|
|
100
|
+
context.ellipse(0, 0, Math.abs(rx * 0.06), Math.abs(ry * 0.06), 0, 0, 2 * Math.PI)
|
|
101
|
+
context.fillStyle = '#FFFFFF'
|
|
102
|
+
context.fill()
|
|
103
|
+
context.closePath()
|
|
104
|
+
|
|
105
|
+
context.translate(-cx, -cy)
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
_post_draw(context: CanvasRenderingContext2D) {
|
|
109
|
+
this.drawText(context)
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
onchange(after: Properties, before: Properties) {
|
|
113
|
+
if (!after.hasOwnProperty('value')) return
|
|
114
|
+
|
|
115
|
+
var self = this
|
|
116
|
+
var diff = after.value - before.value
|
|
117
|
+
|
|
118
|
+
this._anim_alpha = -diff
|
|
119
|
+
|
|
120
|
+
this.animate({
|
|
121
|
+
step: function (delta: number) {
|
|
122
|
+
self._anim_alpha = diff * (delta - 1)
|
|
123
|
+
self.invalidate()
|
|
124
|
+
},
|
|
125
|
+
duration: 1000,
|
|
126
|
+
delta: 'elastic',
|
|
127
|
+
options: {
|
|
128
|
+
x: 2
|
|
129
|
+
},
|
|
130
|
+
ease: 'out'
|
|
131
|
+
}).start()
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
get nature() {
|
|
135
|
+
return NATURE
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
Component.register('compass', Compass)
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<!--
|
|
3
|
+
@license
|
|
4
|
+
Copyright © HatioLab Inc. All rights reserved.
|
|
5
|
+
-->
|
|
6
|
+
<html>
|
|
7
|
+
<head>
|
|
8
|
+
<meta charset="utf-8">
|
|
9
|
+
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes">
|
|
10
|
+
|
|
11
|
+
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
|
|
12
|
+
<script src="../../web-component-tester/browser.js"></script>
|
|
13
|
+
|
|
14
|
+
<!-- Step 1: import the element to test -->
|
|
15
|
+
<link rel="import" href="../things-scene-gauge.html">
|
|
16
|
+
</head>
|
|
17
|
+
<body>
|
|
18
|
+
|
|
19
|
+
<!-- You can use the document as a place to set up your fixtures. -->
|
|
20
|
+
<test-fixture id="things-scene-gauge-fixture">
|
|
21
|
+
<template>
|
|
22
|
+
<things-scene-gauge>
|
|
23
|
+
<h2>things-scene-gauge</h2>
|
|
24
|
+
</things-scene-gauge>
|
|
25
|
+
</template>
|
|
26
|
+
</test-fixture>
|
|
27
|
+
|
|
28
|
+
<script>
|
|
29
|
+
suite('<things-scene-gauge>', function() {
|
|
30
|
+
|
|
31
|
+
var myEl;
|
|
32
|
+
|
|
33
|
+
setup(function() {
|
|
34
|
+
myEl = fixture('things-scene-gauge-fixture');
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
test('defines the "author" property', function() {
|
|
38
|
+
assert.equal(myEl.author.name, 'Dimitri Glazkov');
|
|
39
|
+
assert.equal(myEl.author.image, 'http://addyosmani.com/blog/wp-content/uploads/2013/04/unicorn.jpg');
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
test('says hello', function() {
|
|
43
|
+
assert.equal(myEl.sayHello(), 'things-scene-gauge says, Hello World!');
|
|
44
|
+
|
|
45
|
+
var greetings = myEl.sayHello('greetings Earthlings');
|
|
46
|
+
assert.equal(greetings, 'things-scene-gauge says, greetings Earthlings');
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
test('fires lasers', function(done) {
|
|
50
|
+
myEl.addEventListener('things-scene-gauge-lasers', function(event) {
|
|
51
|
+
assert.equal(event.detail.sound, 'Pew pew!');
|
|
52
|
+
done();
|
|
53
|
+
});
|
|
54
|
+
myEl.fireLasers();
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
test('distributed children', function() {
|
|
58
|
+
var els = myEl.getContentChildren();
|
|
59
|
+
assert.equal(els.length, 1, 'one distributed node');
|
|
60
|
+
assert.equal(els[0], myEl.querySelector('h2'), 'content distributed correctly');
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
});
|
|
64
|
+
</script>
|
|
65
|
+
|
|
66
|
+
</body>
|
|
67
|
+
</html>
|
package/test/index.html
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<!--
|
|
3
|
+
@license
|
|
4
|
+
Copyright © HatioLab Inc. All rights reserved.
|
|
5
|
+
-->
|
|
6
|
+
<html><head>
|
|
7
|
+
<meta charset="utf-8">
|
|
8
|
+
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes">
|
|
9
|
+
|
|
10
|
+
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
|
|
11
|
+
<script src="../../web-component-tester/browser.js"></script>
|
|
12
|
+
</head>
|
|
13
|
+
<body>
|
|
14
|
+
<script>
|
|
15
|
+
// Load and run all tests (.html, .js):
|
|
16
|
+
WCT.loadSuites([
|
|
17
|
+
'basic-test.html',
|
|
18
|
+
'basic-test.html?dom=shadow'
|
|
19
|
+
]);
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
</body></html>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import icon from './assets/compass.png';
|
|
2
|
+
|
|
3
|
+
var templates = [{
|
|
4
|
+
type: 'compass',
|
|
5
|
+
description: 'compass',
|
|
6
|
+
group: 'etc', /* line|shape|textAndMedia|chartAndGauge|table|container|dataSource|IoT|3D|warehouse|form|etc */
|
|
7
|
+
icon,
|
|
8
|
+
model: {
|
|
9
|
+
type: 'compass',
|
|
10
|
+
cx: 150,
|
|
11
|
+
cy: 150,
|
|
12
|
+
rx: 50,
|
|
13
|
+
ry: 50,
|
|
14
|
+
value: 0,
|
|
15
|
+
fontSize: 20,
|
|
16
|
+
fontColoe: '#000',
|
|
17
|
+
fillStyle: '#F2F2F2',
|
|
18
|
+
strokeStyle: '#AAAAAA',
|
|
19
|
+
lineWidth: 10,
|
|
20
|
+
fontColor: '#ff0000',
|
|
21
|
+
alpha: 1
|
|
22
|
+
}
|
|
23
|
+
}];
|
|
24
|
+
|
|
25
|
+
export default {
|
|
26
|
+
templates
|
|
27
|
+
};
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "es2018",
|
|
4
|
+
"module": "esnext",
|
|
5
|
+
"moduleResolution": "node",
|
|
6
|
+
"noEmitOnError": true,
|
|
7
|
+
"lib": ["es2017", "dom"],
|
|
8
|
+
"strict": true,
|
|
9
|
+
"esModuleInterop": false,
|
|
10
|
+
"allowSyntheticDefaultImports": true,
|
|
11
|
+
"experimentalDecorators": true,
|
|
12
|
+
"importHelpers": true,
|
|
13
|
+
"outDir": "dist",
|
|
14
|
+
"sourceMap": true,
|
|
15
|
+
"inlineSources": true,
|
|
16
|
+
"rootDir": "src",
|
|
17
|
+
"declaration": true,
|
|
18
|
+
"incremental": true,
|
|
19
|
+
"typeRoots": ["./node_modules", "@types"],
|
|
20
|
+
"types": ["node"]
|
|
21
|
+
},
|
|
22
|
+
"include": ["**/*.ts", "*.d.ts"]
|
|
23
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"program":{"fileNames":["../../node_modules/typescript/lib/lib.es5.d.ts","../../node_modules/typescript/lib/lib.es2015.d.ts","../../node_modules/typescript/lib/lib.es2016.d.ts","../../node_modules/typescript/lib/lib.es2017.d.ts","../../node_modules/typescript/lib/lib.es2018.d.ts","../../node_modules/typescript/lib/lib.es2019.d.ts","../../node_modules/typescript/lib/lib.es2020.d.ts","../../node_modules/typescript/lib/lib.dom.d.ts","../../node_modules/typescript/lib/lib.es2015.core.d.ts","../../node_modules/typescript/lib/lib.es2015.collection.d.ts","../../node_modules/typescript/lib/lib.es2015.generator.d.ts","../../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../node_modules/typescript/lib/lib.es2015.promise.d.ts","../../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../node_modules/typescript/lib/lib.es2017.object.d.ts","../../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../node_modules/typescript/lib/lib.es2017.string.d.ts","../../node_modules/typescript/lib/lib.es2017.intl.d.ts","../../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../node_modules/typescript/lib/lib.es2018.intl.d.ts","../../node_modules/typescript/lib/lib.es2018.promise.d.ts","../../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../node_modules/typescript/lib/lib.es2019.array.d.ts","../../node_modules/typescript/lib/lib.es2019.object.d.ts","../../node_modules/typescript/lib/lib.es2019.string.d.ts","../../node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../node_modules/typescript/lib/lib.es2020.promise.d.ts","../../node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../node_modules/typescript/lib/lib.es2020.string.d.ts","../../node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../node_modules/typescript/lib/lib.es2020.intl.d.ts","../../node_modules/typescript/lib/lib.esnext.intl.d.ts","./@types/global/index.d.ts","../../node_modules/tslib/tslib.d.ts","../../node_modules/@hatiolab/things-scene/things-scene.d.ts","./src/compass.ts","./src/index.ts","../../node_modules/@types/node/assert.d.ts","../../node_modules/@types/node/assert/strict.d.ts","../../node_modules/@types/node/globals.d.ts","../../node_modules/@types/node/async_hooks.d.ts","../../node_modules/@types/node/buffer.d.ts","../../node_modules/@types/node/child_process.d.ts","../../node_modules/@types/node/cluster.d.ts","../../node_modules/@types/node/console.d.ts","../../node_modules/@types/node/constants.d.ts","../../node_modules/@types/node/crypto.d.ts","../../node_modules/@types/node/dgram.d.ts","../../node_modules/@types/node/diagnostics_channel.d.ts","../../node_modules/@types/node/dns.d.ts","../../node_modules/@types/node/dns/promises.d.ts","../../node_modules/@types/node/domain.d.ts","../../node_modules/@types/node/events.d.ts","../../node_modules/@types/node/fs.d.ts","../../node_modules/@types/node/fs/promises.d.ts","../../node_modules/@types/node/http.d.ts","../../node_modules/@types/node/http2.d.ts","../../node_modules/@types/node/https.d.ts","../../node_modules/@types/node/inspector.d.ts","../../node_modules/@types/node/module.d.ts","../../node_modules/@types/node/net.d.ts","../../node_modules/@types/node/os.d.ts","../../node_modules/@types/node/path.d.ts","../../node_modules/@types/node/perf_hooks.d.ts","../../node_modules/@types/node/process.d.ts","../../node_modules/@types/node/punycode.d.ts","../../node_modules/@types/node/querystring.d.ts","../../node_modules/@types/node/readline.d.ts","../../node_modules/@types/node/repl.d.ts","../../node_modules/@types/node/stream.d.ts","../../node_modules/@types/node/stream/promises.d.ts","../../node_modules/@types/node/stream/consumers.d.ts","../../node_modules/@types/node/stream/web.d.ts","../../node_modules/@types/node/string_decoder.d.ts","../../node_modules/@types/node/timers.d.ts","../../node_modules/@types/node/timers/promises.d.ts","../../node_modules/@types/node/tls.d.ts","../../node_modules/@types/node/trace_events.d.ts","../../node_modules/@types/node/tty.d.ts","../../node_modules/@types/node/url.d.ts","../../node_modules/@types/node/util.d.ts","../../node_modules/@types/node/v8.d.ts","../../node_modules/@types/node/vm.d.ts","../../node_modules/@types/node/wasi.d.ts","../../node_modules/@types/node/worker_threads.d.ts","../../node_modules/@types/node/zlib.d.ts","../../node_modules/@types/node/globals.global.d.ts","../../node_modules/@types/node/index.d.ts"],"fileInfos":[{"version":"6adbf5efd0e374ff5f427a4f26a5a413e9734eee5067a0e86da69aea41910b52","affectsGlobalScope":true},"dc47c4fa66b9b9890cf076304de2a9c5201e94b740cffdf09f87296d877d71f6","7a387c58583dfca701b6c85e0adaf43fb17d590fb16d5b2dc0a2fbd89f35c467","8a12173c586e95f4433e0c6dc446bc88346be73ffe9ca6eec7aa63c8f3dca7f9","5f4e733ced4e129482ae2186aae29fde948ab7182844c3a5a51dd346182c7b06","e6b724280c694a9f588847f754198fb96c43d805f065c3a5b28bbc9594541c84","e21c071ca3e1b4a815d5f04a7475adcaeea5d64367e840dd0154096d705c3940",{"version":"abba1071bfd89e55e88a054b0c851ea3e8a494c340d0f3fab19eb18f6afb0c9e","affectsGlobalScope":true},{"version":"d8996609230d17e90484a2dd58f22668f9a05a3bfe00bfb1d6271171e54a31fb","affectsGlobalScope":true},{"version":"43fb1d932e4966a39a41b464a12a81899d9ae5f2c829063f5571b6b87e6d2f9c","affectsGlobalScope":true},{"version":"cdccba9a388c2ee3fd6ad4018c640a471a6c060e96f1232062223063b0a5ac6a","affectsGlobalScope":true},{"version":"4378fc8122ec9d1a685b01eb66c46f62aba6b239ca7228bb6483bcf8259ee493","affectsGlobalScope":true},{"version":"0d5f52b3174bee6edb81260ebcd792692c32c81fd55499d69531496f3f2b25e7","affectsGlobalScope":true},{"version":"810627a82ac06fb5166da5ada4159c4ec11978dfbb0805fe804c86406dab8357","affectsGlobalScope":true},{"version":"62d80405c46c3f4c527ee657ae9d43fda65a0bf582292429aea1e69144a522a6","affectsGlobalScope":true},{"version":"3013574108c36fd3aaca79764002b3717da09725a36a6fc02eac386593110f93","affectsGlobalScope":true},{"version":"75ec0bdd727d887f1b79ed6619412ea72ba3c81d92d0787ccb64bab18d261f14","affectsGlobalScope":true},{"version":"3be5a1453daa63e031d266bf342f3943603873d890ab8b9ada95e22389389006","affectsGlobalScope":true},{"version":"17bb1fc99591b00515502d264fa55dc8370c45c5298f4a5c2083557dccba5a2a","affectsGlobalScope":true},{"version":"7ce9f0bde3307ca1f944119f6365f2d776d281a393b576a18a2f2893a2d75c98","affectsGlobalScope":true},{"version":"6a6b173e739a6a99629a8594bfb294cc7329bfb7b227f12e1f7c11bc163b8577","affectsGlobalScope":true},{"version":"12a310447c5d23c7d0d5ca2af606e3bd08afda69100166730ab92c62999ebb9d","affectsGlobalScope":true},{"version":"b0124885ef82641903d232172577f2ceb5d3e60aed4da1153bab4221e1f6dd4e","affectsGlobalScope":true},{"version":"0eb85d6c590b0d577919a79e0084fa1744c1beba6fd0d4e951432fa1ede5510a","affectsGlobalScope":true},{"version":"da233fc1c8a377ba9e0bed690a73c290d843c2c3d23a7bd7ec5cd3d7d73ba1e0","affectsGlobalScope":true},{"version":"d154ea5bb7f7f9001ed9153e876b2d5b8f5c2bb9ec02b3ae0d239ec769f1f2ae","affectsGlobalScope":true},{"version":"bb2d3fb05a1d2ffbca947cc7cbc95d23e1d053d6595391bd325deb265a18d36c","affectsGlobalScope":true},{"version":"c80df75850fea5caa2afe43b9949338ce4e2de086f91713e9af1a06f973872b8","affectsGlobalScope":true},{"version":"9d57b2b5d15838ed094aa9ff1299eecef40b190722eb619bac4616657a05f951","affectsGlobalScope":true},{"version":"6c51b5dd26a2c31dbf37f00cfc32b2aa6a92e19c995aefb5b97a3a64f1ac99de","affectsGlobalScope":true},{"version":"6e7997ef61de3132e4d4b2250e75343f487903ddf5370e7ce33cf1b9db9a63ed","affectsGlobalScope":true},{"version":"2ad234885a4240522efccd77de6c7d99eecf9b4de0914adb9a35c0c22433f993","affectsGlobalScope":true},{"version":"1b3fe904465430e030c93239a348f05e1be80640d91f2f004c3512c2c2c89f34","affectsGlobalScope":true},{"version":"3787b83e297de7c315d55d4a7c546ae28e5f6c0a361b7a1dcec1f1f50a54ef11","affectsGlobalScope":true},{"version":"e7e8e1d368290e9295ef18ca23f405cf40d5456fa9f20db6373a61ca45f75f40","affectsGlobalScope":true},{"version":"faf0221ae0465363c842ce6aa8a0cbda5d9296940a8e26c86e04cc4081eea21e","affectsGlobalScope":true},{"version":"06393d13ea207a1bfe08ec8d7be562549c5e2da8983f2ee074e00002629d1871","affectsGlobalScope":true},{"version":"d071129cba6a5f2700be09c86c07ad2791ab67d4e5ed1eb301d6746c62745ea4","affectsGlobalScope":true},{"version":"10bbdc1981b8d9310ee75bfac28ee0477bb2353e8529da8cff7cb26c409cb5e8","affectsGlobalScope":true},"c4f5f288a2b8dcfb6183e29612ec26b7a049314a6a10b7e6e700a8307077455a","12f4cfe2fe60b810c3174537bc2ddb20c1067b7768643d12cb1266fd183afb75","63442cdfb7730e572342d7e279d40752917dc952af0ae185a49d099a9d68496e","d5c7a0038df16ff176140da7cfef29f7a9c04ba3b98209493667eb3cf54df0b5","6e5066454143c1c33853dc24a581bf534aa2c0febf6e590bacb99e6976eecadd","0d5a2ee1fdfa82740e0103389b9efd6bfe145a20018a2da3c02b89666181f4d9","a69c09dbea52352f479d3e7ac949fde3d17b195abe90b045d619f747b38d6d1a",{"version":"92d63add669d18ebc349efbacd88966d6f2ccdddfb1b880b2db98ae3aa7bf7c4","affectsGlobalScope":true},"ccc94049a9841fe47abe5baef6be9a38fc6228807974ae675fb15dc22531b4be",{"version":"9acfe4d1ff027015151ce81d60797b04b52bffe97ad8310bb0ec2e8fd61e1303","affectsGlobalScope":true},"95843d5cfafced8f3f8a5ce57d2335f0bcd361b9483587d12a25e4bd403b8216","afc6e96061af46bcff47246158caee7e056f5288783f2d83d6858cd25be1c565",{"version":"34f5bcac12b36d70304b73de5f5aab3bb91bd9919f984be80579ebcad03a624e","affectsGlobalScope":true},"82408ed3e959ddc60d3e9904481b5a8dc16469928257af22a3f7d1a3bc7fd8c4","2f520601649a893e6a49a8851ebfcf4be8ce090dc1281c2a08a871cb04e8251f","f50c975ab7b50e25a69e3d8a3773894125b44e9698924105f23b812bf7488baf","2b8c764f856a1dd0a9a2bf23e5efddbff157de8138b0754010be561ae5fcaa90","76650408392bf49a8fbf3e2b6b302712a92d76af77b06e2da1cc8077359c4409","0af3121e68297b2247dd331c0d24dba599e50736a7517a5622d5591aae4a3122","6972fca26f6e9bd56197568d4379f99071a90766e06b4fcb5920a0130a9202be",{"version":"4a2628e95962c8ab756121faa3ac2ed348112ff7a87b5c286dd2cc3326546b4c","affectsGlobalScope":true},"80793b2277f31baa199234daed806fff0fb11491d1ebd3357e520c3558063f00","a049a59a02009fc023684fcfaf0ac526fe36c35dcc5d2b7d620c1750ba11b083","5533392c50c51b1a5c32b89f13145db929c574ef1c5949cf67a074a05ea107d9","b287b810b5035d5685f1df6e1e418f1ca452a3ed4f59fd5cc081dbf2045f0d9b","4b9a003b5c556c96784132945bb41c655ea11273b1917f5c8d0c154dd5fd20dd","a458dc78104cc80048ac24fdc02fe6dce254838094c2f25641b3f954d9721241",{"version":"e8b18c6385ff784228a6f369694fcf1a6b475355ba89090a88de13587a9391d5","affectsGlobalScope":true},"902cd98bf46e95caf4118a0733fb801e9e90eec3edaed6abdad77124afec9ca2","abc1c425b2ad6720433f40f1877abfa4223f0f3dd486c9c28c492179ca183cb6","cd4854d38f4eb5592afd98ab95ca17389a7dfe38013d9079e802d739bdbcc939","94eed4cc2f5f658d5e229ff1ccd38860bddf4233e347bf78edd2154dee1f2b99",{"version":"bd1a08e30569b0fb2f0b21035eb9b039871f68faa9b98accf847e9c878c5e0a9","affectsGlobalScope":true},"9f1069b9e2c051737b1f9b4f1baf50e4a63385a6a89c32235549ae87fc3d5492","ee18f2da7a037c6ceeb112a084e485aead9ea166980bf433474559eac1b46553","29c2706fa0cc49a2bd90c83234da33d08bb9554ecec675e91c1f85087f5a5324","0acbf26bf958f9e80c1ffa587b74749d2697b75b484062d36e103c137c562bc3","d7838022c7dab596357a9604b9c6adffe37dc34085ce0779c958ce9545bd7139","1b952304137851e45bc009785de89ada562d9376177c97e37702e39e60c2f1ff",{"version":"806ef4cac3b3d9fa4a48d849c8e084d7c72fcd7b16d76e06049a9ed742ff79c0","affectsGlobalScope":true},"a7971f9fb2a32ec7788ec6cda9d7a33c02023dfe9a62db2030ad1359649d8050","c33a6ea7147af60d8e98f1ac127047f4b0d4e2ce28b8f08ff3de07ca7cc00637",{"version":"b42b47e17b8ece2424ae8039feb944c2e3ba4b262986aebd582e51efbdca93dc","affectsGlobalScope":true},"664d8f2d59164f2e08c543981453893bc7e003e4dfd29651ce09db13e9457980","2408611d9b4146e35d1dbd1f443ccd8e187c74614a54b80300728277529dbf11","998a3de5237518c0b3ac00a11b3b4417affb008aa20aedee52f3fdae3cb86151","ad41008ffe077206e1811fc873f4d9005b5fd7f6ab52bb6118fef600815a5cb4","d88ecca73348e7c337541c4b8b60a50aca5e87384f6b8a422fc6603c637e4c21","badae0df9a8016ac36994b0a0e7b82ba6aaa3528e175a8c3cb161e4683eec03e","c3db860bcaaaeb3bbc23f353bbda1f8ab82756c8d5e973bebb3953cb09ea68f2","235a53595bd20b0b0eeb1a29cb2887c67c48375e92f03749b2488fbd46d0b1a0","bc09393cd4cd13f69cf1366d4236fbae5359bb550f0de4e15767e9a91d63dfb1","9c266243b01545e11d2733a55ad02b4c00ecdbda99c561cd1674f96e89cdc958","c71155c05fc76ff948a4759abc1cb9feec036509f500174bc18dad4c7827a60c",{"version":"ab9b9a36e5284fd8d3bf2f7d5fcbc60052f25f27e4d20954782099282c60d23e","affectsGlobalScope":true},"1cdb8f094b969dcc183745dc88404e2d8fcf2a858c6e7cc2441011476573238e"],"options":{"allowSyntheticDefaultImports":true,"declaration":true,"esModuleInterop":false,"experimentalDecorators":true,"importHelpers":true,"inlineSources":true,"module":99,"noEmitOnError":true,"outDir":"./dist","rootDir":"./src","sourceMap":true,"strict":true,"target":5},"fileIdsList":[[88],[45,88],[48,88],[49,54,88],[50,60,61,68,77,87,88],[50,51,60,68,88],[52,88],[53,54,61,69,88],[54,77,84,88],[55,57,60,68,88],[56,88],[57,58,88],[59,60,88],[60,88],[60,61,62,77,87,88],[60,61,62,77,88],[63,68,77,87,88],[60,61,63,64,68,77,84,87,88],[63,65,77,84,87,88],[45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94],[60,66,88],[67,87,88],[57,60,68,77,88],[69,88],[70,88],[48,71,88],[72,86,88,92],[73,88],[74,88],[60,75,88],[75,76,88,90],[60,77,78,79,88],[77,79,88],[77,78,88],[80,88],[81,88],[60,82,83,88],[82,83,88],[54,68,84,88],[85,88],[68,86,88],[49,63,74,87,88],[54,88],[77,88,89],[88,90],[88,91],[49,54,60,62,71,77,87,88,90,92],[77,88,93],[41,42,88],[41,43,88]],"referencedMap":[[42,1],[45,2],[46,2],[48,3],[49,4],[50,5],[51,6],[52,7],[53,8],[54,9],[55,10],[56,11],[57,12],[58,12],[59,13],[60,14],[61,15],[62,16],[47,1],[94,1],[63,17],[64,18],[65,19],[95,20],[66,21],[67,22],[68,23],[69,24],[70,25],[71,26],[72,27],[73,28],[74,29],[75,30],[76,31],[77,32],[79,33],[78,34],[80,35],[81,36],[82,37],[83,38],[84,39],[85,40],[86,41],[87,42],[88,43],[89,44],[90,45],[91,46],[92,47],[93,48],[41,1],[8,1],[10,1],[9,1],[2,1],[11,1],[12,1],[13,1],[14,1],[15,1],[16,1],[17,1],[18,1],[3,1],[4,1],[22,1],[19,1],[20,1],[21,1],[23,1],[24,1],[25,1],[5,1],[26,1],[27,1],[28,1],[29,1],[6,1],[30,1],[31,1],[32,1],[33,1],[7,1],[38,1],[34,1],[35,1],[36,1],[37,1],[1,1],[39,1],[40,1],[43,49],[44,50]],"exportedModulesMap":[[42,1],[45,2],[46,2],[48,3],[49,4],[50,5],[51,6],[52,7],[53,8],[54,9],[55,10],[56,11],[57,12],[58,12],[59,13],[60,14],[61,15],[62,16],[47,1],[94,1],[63,17],[64,18],[65,19],[95,20],[66,21],[67,22],[68,23],[69,24],[70,25],[71,26],[72,27],[73,28],[74,29],[75,30],[76,31],[77,32],[79,33],[78,34],[80,35],[81,36],[82,37],[83,38],[84,39],[85,40],[86,41],[87,42],[88,43],[89,44],[90,45],[91,46],[92,47],[93,48],[41,1],[8,1],[10,1],[9,1],[2,1],[11,1],[12,1],[13,1],[14,1],[15,1],[16,1],[17,1],[18,1],[3,1],[4,1],[22,1],[19,1],[20,1],[21,1],[23,1],[24,1],[25,1],[5,1],[26,1],[27,1],[28,1],[29,1],[6,1],[30,1],[31,1],[32,1],[33,1],[7,1],[38,1],[34,1],[35,1],[36,1],[37,1],[1,1],[39,1],[40,1],[43,49],[44,50]],"semanticDiagnosticsPerFile":[42,45,46,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,47,94,63,64,65,95,66,67,68,69,70,71,72,73,74,75,76,77,79,78,80,81,82,83,84,85,86,87,88,89,90,91,92,93,41,8,10,9,2,11,12,13,14,15,16,17,18,3,4,22,19,20,21,23,24,25,5,26,27,28,29,6,30,31,32,33,7,38,34,35,36,37,1,39,40,43,44]},"version":"4.5.2"}
|