@operato/scene-progressbar 0.0.4
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 +17 -0
- package/LICENSE +21 -0
- package/README.md +15 -0
- package/assets/progress-circle.png +0 -0
- package/assets/progress-horizontal.png +0 -0
- package/assets/progress-vertical.png +0 -0
- package/dist/src/index.d.ts +3 -0
- package/dist/src/index.js +7 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/progress-circle.d.ts +22 -0
- package/dist/src/progress-circle.js +82 -0
- package/dist/src/progress-circle.js.map +1 -0
- package/dist/src/progress-horizontal.d.ts +28 -0
- package/dist/src/progress-horizontal.js +69 -0
- package/dist/src/progress-horizontal.js.map +1 -0
- package/dist/src/progress-vertical.d.ts +28 -0
- package/dist/src/progress-vertical.js +58 -0
- package/dist/src/progress-vertical.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/helps/scene/component/progress-circle.ko.md +41 -0
- package/helps/scene/component/progress-circle.md +42 -0
- package/helps/scene/component/progress-circle.zh.md +39 -0
- package/helps/scene/component/progress-horizontal.ko.md +37 -0
- package/helps/scene/component/progress-horizontal.md +31 -0
- package/helps/scene/component/progress-horizontal.zh.md +31 -0
- package/helps/scene/component/progress-vertical.ko.md +23 -0
- package/helps/scene/component/progress-vertical.md +24 -0
- package/helps/scene/component/progress-vertical.zh.md +23 -0
- package/helps/scene/images/progress-circle-01.png +0 -0
- package/helps/scene/images/progress-circle-02.png +0 -0
- package/helps/scene/images/progress-circle-03.png +0 -0
- package/helps/scene/images/progress-circle-04.png +0 -0
- package/helps/scene/images/progress-circle-05.png +0 -0
- package/helps/scene/images/progress-horizontal-01.png +0 -0
- package/helps/scene/images/progress-horizontal-02.png +0 -0
- package/helps/scene/images/progress-horizontal-03.png +0 -0
- package/helps/scene/images/progress-horizontal-04.png +0 -0
- package/helps/scene/images/progress-vertical-01.png +0 -0
- package/helps/scene/images/progress-vertical-02.png +0 -0
- package/helps/scene/images/progress-vertical-03.png +0 -0
- package/package.json +63 -0
- package/src/index.ts +6 -0
- package/src/progress-circle.ts +125 -0
- package/src/progress-horizontal.ts +83 -0
- package/src/progress-vertical.ts +72 -0
- package/test/basic-test.html +67 -0
- package/test/index.html +22 -0
- package/things-scene.config.js +85 -0
- package/translations/en.json +4 -0
- package/translations/ko.json +4 -0
- package/translations/zh.json +4 -0
- package/tsconfig.json +22 -0
@@ -0,0 +1,31 @@
|
|
1
|
+
# progress-horizontal
|
2
|
+
|
3
|
+
The component which displays the progress with a horizontal bar.
|
4
|
+
|
5
|
+
## properties
|
6
|
+
1. Value(Number) - The progress value of progress bar.
|
7
|
+
<figure style="text-align: center;">
|
8
|
+
|
9
|
+
![Progress bar-Value application result][progress-horizontal-02]
|
10
|
+
<figurecaption>(value: 80)</figurecaption>
|
11
|
+
</figure>
|
12
|
+
|
13
|
+
2. BackgroundColor(Color) - The color in which progress is not filled.
|
14
|
+
<figure style="text-align: center;">
|
15
|
+
|
16
|
+
![Progress bar-BackgroundColor application result][progress-horizontal-03]
|
17
|
+
<figurecaption>(backgroundColor: #ec5324)</figurecaption>
|
18
|
+
</figure>
|
19
|
+
|
20
|
+
3. reverse - Fill the progress in reverse direction.
|
21
|
+
<figure style="text-align: center;">
|
22
|
+
|
23
|
+
![Progress bar-BackgroundColor application result][progress-horizontal-04]
|
24
|
+
<figurecaption>(backgroundColor: #ec5324)</figurecaption>
|
25
|
+
</figure>
|
26
|
+
|
27
|
+
|
28
|
+
[progress-horizontal-01]: ../images/progress-horizontal-01.png
|
29
|
+
[progress-horizontal-02]: ../images/progress-horizontal-02.png
|
30
|
+
[progress-horizontal-03]: ../images/progress-horizontal-03.png
|
31
|
+
[progress-horizontal-04]: ../images/progress-horizontal-04.png
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# progress-horizontal
|
2
|
+
用横条形状,显示进度的组件。
|
3
|
+
|
4
|
+
## properties
|
5
|
+
|
6
|
+
1. Value(Number) - 进度条的进度值。
|
7
|
+
<figure style="text-align: center;">
|
8
|
+
|
9
|
+
![进度条-Value适用结果][progress-horizontal-02]
|
10
|
+
<figurecaption>(value: 80)</figurecaption>
|
11
|
+
</figure>
|
12
|
+
|
13
|
+
2. BackgroundColor(Color) - 没有填充进度部分的颜色。
|
14
|
+
<figure style="text-align: center;">
|
15
|
+
|
16
|
+
![进度条-BackgroundColor适用结果][progress-horizontal-03]
|
17
|
+
<figurecaption>(backgroundColor: #ec5324)</figurecaption>
|
18
|
+
</figure>
|
19
|
+
|
20
|
+
3. reverse - 从反方向开始,填充进度。
|
21
|
+
<figure style="text-align: center;">
|
22
|
+
|
23
|
+
![进度条-BackgroundColor适用结果][progress-horizontal-04]
|
24
|
+
<figurecaption>(backgroundColor: #ec5324)</figurecaption>
|
25
|
+
</figure>
|
26
|
+
|
27
|
+
|
28
|
+
[progress-horizontal-01]: ../images/progress-horizontal-01.png
|
29
|
+
[progress-horizontal-02]: ../images/progress-horizontal-02.png
|
30
|
+
[progress-horizontal-03]: ../images/progress-horizontal-03.png
|
31
|
+
[progress-horizontal-04]: ../images/progress-horizontal-04.png
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# progress-vertical
|
2
|
+
|
3
|
+
진행률을 세로막대 형태로 표시해주는 컴포넌트
|
4
|
+
|
5
|
+
## properties
|
6
|
+
1. Value(Number) - 프로그레스바의 진행률 값
|
7
|
+
<figure style="text-align: center;">
|
8
|
+
|
9
|
+
![프로그레스바-Value적용결과][progress-vertical-02]
|
10
|
+
<figurecaption>(value: 80)</figurecaption>
|
11
|
+
</figure>
|
12
|
+
|
13
|
+
2. BackgroundColor(Color) - 진행률이 채워지지 않은 부분의 색
|
14
|
+
<figure style="text-align: center;">
|
15
|
+
|
16
|
+
![프로그레스바-Value적용결과][progress-vertical-03]
|
17
|
+
<figurecaption>(backgroundColor: #ec5324)</figurecaption>
|
18
|
+
</figure>
|
19
|
+
|
20
|
+
|
21
|
+
[progress-vertical-01]: ../images/progress-vertical-01.png
|
22
|
+
[progress-vertical-02]: ../images/progress-vertical-02.png
|
23
|
+
[progress-vertical-03]: ../images/progress-vertical-03.png
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# progress-vertical
|
2
|
+
The component which displays the progress with a vertical bar.
|
3
|
+
|
4
|
+
## properties
|
5
|
+
1. Value(Number) - The progress value of progress bar.
|
6
|
+
<figure style="text-align: center;">
|
7
|
+
|
8
|
+
![Progress bar-Value application result][progress-vertical-02]
|
9
|
+
<figurecaption>(value: 80)</figurecaption>
|
10
|
+
</figure>
|
11
|
+
|
12
|
+
2. BackgroundColor(Color) - The color in which progress is not filled.
|
13
|
+
<figure style="text-align: center;">
|
14
|
+
|
15
|
+
![Progress bar-BackgroundColor application result][progress-vertical-03]
|
16
|
+
<figurecaption>(backgroundColor: #ec5324)</figurecaption>
|
17
|
+
</figure>
|
18
|
+
|
19
|
+
|
20
|
+
[progress-vertical-01]: ../images/progress-vertical-01.png
|
21
|
+
|
22
|
+
[progress-vertical-02]: ../images/progress-vertical-02.png
|
23
|
+
|
24
|
+
[progress-vertical-03]: ../images/progress-vertical-03.png
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# progress-vertical
|
2
|
+
|
3
|
+
用竖条形状,显示进度的组件。
|
4
|
+
|
5
|
+
## properties
|
6
|
+
1. Value(Number) - 进度条的进度值。
|
7
|
+
<figure style="text-align: center;">
|
8
|
+
|
9
|
+
![进度条-Value适用结果][progress-vertical-02]
|
10
|
+
<figurecaption>(value: 80)</figurecaption>
|
11
|
+
</figure>
|
12
|
+
|
13
|
+
2. BackgroundColor(Color) - 没有填充进度部分的颜色。
|
14
|
+
<figure style="text-align: center;">
|
15
|
+
|
16
|
+
![进度条-BackgroundColor适用结果][progress-vertical-03]
|
17
|
+
<figurecaption>(backgroundColor: #ec5324)</figurecaption>
|
18
|
+
</figure>
|
19
|
+
|
20
|
+
|
21
|
+
[progress-vertical-01]: ../images/progress-vertical-01.png
|
22
|
+
[progress-vertical-02]: ../images/progress-vertical-02.png
|
23
|
+
[progress-vertical-03]: ../images/progress-vertical-03.png
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
package/package.json
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
{
|
2
|
+
"name": "@operato/scene-progressbar",
|
3
|
+
"description": "Progressbar component for things-scene",
|
4
|
+
"license": "MIT",
|
5
|
+
"author": "heartyoh",
|
6
|
+
"version": "0.0.4",
|
7
|
+
"main": "dist/src/index.js",
|
8
|
+
"module": "dist/src/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/hatiolab/things-factory.git",
|
17
|
+
"directory": "packages/scene-progressbar"
|
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
|
+
"lit": "^2.0.2"
|
30
|
+
},
|
31
|
+
"devDependencies": {
|
32
|
+
"@hatiolab/prettier-config": "^1.0.0",
|
33
|
+
"@hatiolab/things-scene": "^2.7.15",
|
34
|
+
"@operato/board": "^0.2.27",
|
35
|
+
"@things-factory/builder": "^4.0.6",
|
36
|
+
"@things-factory/operato-board": "^4.0.6",
|
37
|
+
"@types/chance": "^1.1.3",
|
38
|
+
"@typescript-eslint/eslint-plugin": "^4.33.0",
|
39
|
+
"@typescript-eslint/parser": "^4.33.0",
|
40
|
+
"@web/dev-server": "^0.1.28",
|
41
|
+
"concurrently": "^5.3.0",
|
42
|
+
"eslint": "^7.32.0",
|
43
|
+
"eslint-config-prettier": "^8.3.0",
|
44
|
+
"husky": "^4.3.8",
|
45
|
+
"lint-staged": "^10.5.4",
|
46
|
+
"prettier": "^2.4.1",
|
47
|
+
"tslib": "^2.3.1",
|
48
|
+
"typescript": "^4.5.2"
|
49
|
+
},
|
50
|
+
"prettier": "@hatiolab/prettier-config",
|
51
|
+
"husky": {
|
52
|
+
"hooks": {
|
53
|
+
"pre-commit": "lint-staged"
|
54
|
+
}
|
55
|
+
},
|
56
|
+
"lint-staged": {
|
57
|
+
"*.ts": [
|
58
|
+
"eslint --fix",
|
59
|
+
"prettier --write"
|
60
|
+
]
|
61
|
+
},
|
62
|
+
"gitHead": "853ccc00f65e96f0d4807400d792a76fe9ef62d1"
|
63
|
+
}
|
package/src/index.ts
ADDED
@@ -0,0 +1,125 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright © HatioLab Inc. All rights reserved.
|
3
|
+
*/
|
4
|
+
|
5
|
+
import { Component, Ellipse, ValueHolder } from '@hatiolab/things-scene'
|
6
|
+
|
7
|
+
const NATURE = {
|
8
|
+
mutable: false,
|
9
|
+
resizable: true,
|
10
|
+
rotatable: true,
|
11
|
+
properties: [
|
12
|
+
{
|
13
|
+
type: 'string',
|
14
|
+
label: 'value',
|
15
|
+
name: 'value'
|
16
|
+
},
|
17
|
+
{
|
18
|
+
type: 'number',
|
19
|
+
label: 'start-angle',
|
20
|
+
name: 'startAngle'
|
21
|
+
},
|
22
|
+
{
|
23
|
+
type: 'number',
|
24
|
+
label: 'end-angle',
|
25
|
+
name: 'endAngle'
|
26
|
+
},
|
27
|
+
{
|
28
|
+
type: 'color',
|
29
|
+
label: 'blank-stroke-style',
|
30
|
+
name: 'blankStrokeStyle'
|
31
|
+
},
|
32
|
+
{
|
33
|
+
type: 'checkbox',
|
34
|
+
label: 'packman-style',
|
35
|
+
name: 'packmanStyle'
|
36
|
+
},
|
37
|
+
{
|
38
|
+
type: 'checkbox',
|
39
|
+
label: 'anim-from-base',
|
40
|
+
name: 'animFromBase'
|
41
|
+
}
|
42
|
+
],
|
43
|
+
help: 'scene/component/progress-circle'
|
44
|
+
}
|
45
|
+
|
46
|
+
export default class ProgressCircle extends ValueHolder(Ellipse) {
|
47
|
+
_draw(context: CanvasRenderingContext2D) {
|
48
|
+
var {
|
49
|
+
startAngle = 0,
|
50
|
+
endAngle = 360,
|
51
|
+
lineWidth = 20,
|
52
|
+
blankStrokeStyle,
|
53
|
+
cx,
|
54
|
+
cy,
|
55
|
+
rx,
|
56
|
+
ry,
|
57
|
+
packmanStyle = false,
|
58
|
+
animFromBase = false
|
59
|
+
} = this.model
|
60
|
+
|
61
|
+
this.animOnValueChange(this.value, animFromBase, 0)
|
62
|
+
|
63
|
+
const RADIAN = 0.0174533 / Math.PI
|
64
|
+
|
65
|
+
context.beginPath()
|
66
|
+
this.drawStroke(context)
|
67
|
+
// Angle마다 '-90'와 '-0.5 * Math.PI'가 있는 이유는 0도를 시계의 12시 방향으로 맞추기 위함.
|
68
|
+
var startAngleToRadian = (startAngle - 90) * RADIAN * Math.PI
|
69
|
+
var endAngleToRadian = (endAngle - 90) * RADIAN * Math.PI
|
70
|
+
|
71
|
+
//// / 바깥쪽 원 그리기 ////
|
72
|
+
context.strokeStyle = blankStrokeStyle
|
73
|
+
context.ellipse(cx, cy, Math.abs(rx), Math.abs(ry), 0, startAngleToRadian, endAngleToRadian)
|
74
|
+
|
75
|
+
context.lineWidth = lineWidth
|
76
|
+
context.stroke()
|
77
|
+
|
78
|
+
var percent = Math.min(Math.max(this.animValue / 100, 0), 100)
|
79
|
+
|
80
|
+
context.beginPath()
|
81
|
+
if (packmanStyle) {
|
82
|
+
context.ellipse(
|
83
|
+
cx,
|
84
|
+
cy,
|
85
|
+
Math.abs(rx),
|
86
|
+
Math.abs(ry),
|
87
|
+
0,
|
88
|
+
startAngleToRadian,
|
89
|
+
startAngleToRadian + (endAngleToRadian - startAngleToRadian) * percent
|
90
|
+
)
|
91
|
+
context.lineTo(cx, cy)
|
92
|
+
} else {
|
93
|
+
context.ellipse(cx, cy, Math.abs(rx), Math.abs(ry), 0, startAngleToRadian, endAngleToRadian)
|
94
|
+
}
|
95
|
+
this.drawFill(context)
|
96
|
+
|
97
|
+
context.closePath()
|
98
|
+
|
99
|
+
context.beginPath()
|
100
|
+
|
101
|
+
//// 채워지는 원 그리기 ////
|
102
|
+
|
103
|
+
context.ellipse(
|
104
|
+
cx,
|
105
|
+
cy,
|
106
|
+
Math.abs(rx),
|
107
|
+
Math.abs(ry),
|
108
|
+
0,
|
109
|
+
startAngleToRadian,
|
110
|
+
startAngleToRadian + (endAngleToRadian - startAngleToRadian) * percent
|
111
|
+
)
|
112
|
+
|
113
|
+
this.drawStroke(context)
|
114
|
+
}
|
115
|
+
|
116
|
+
_post_draw(context: CanvasRenderingContext2D) {
|
117
|
+
this.drawText(context)
|
118
|
+
}
|
119
|
+
|
120
|
+
get nature() {
|
121
|
+
return NATURE
|
122
|
+
}
|
123
|
+
}
|
124
|
+
|
125
|
+
Component.register('progress-circle', ProgressCircle)
|
@@ -0,0 +1,83 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright © HatioLab Inc. All rights reserved.
|
3
|
+
*/
|
4
|
+
|
5
|
+
import { Component, RectPath, Shape, ValueHolder } from '@hatiolab/things-scene'
|
6
|
+
|
7
|
+
const NATURE = {
|
8
|
+
mutable: false,
|
9
|
+
resizable: true,
|
10
|
+
rotatable: true,
|
11
|
+
properties: [
|
12
|
+
{
|
13
|
+
type: 'string',
|
14
|
+
label: 'value',
|
15
|
+
name: 'value',
|
16
|
+
property: 'value'
|
17
|
+
},
|
18
|
+
{
|
19
|
+
type: 'color',
|
20
|
+
label: 'background-color',
|
21
|
+
name: 'backgroundColor',
|
22
|
+
property: 'backgroundColor'
|
23
|
+
},
|
24
|
+
{
|
25
|
+
type: 'checkbox',
|
26
|
+
label: 'reverse',
|
27
|
+
name: 'reverse',
|
28
|
+
property: 'reverse'
|
29
|
+
},
|
30
|
+
{
|
31
|
+
type: 'checkbox',
|
32
|
+
label: 'anim-from-base',
|
33
|
+
name: 'animFromBase'
|
34
|
+
}
|
35
|
+
],
|
36
|
+
help: 'scene/component/progress-horizontal'
|
37
|
+
}
|
38
|
+
|
39
|
+
export default class ProgressHorizontal extends ValueHolder(RectPath(Shape)) {
|
40
|
+
_draw(context: CanvasRenderingContext2D) {
|
41
|
+
var { top, left, height, width, backgroundColor = 'transparent', reverse, animFromBase = false } = this.model
|
42
|
+
|
43
|
+
this.animOnValueChange(this.value, animFromBase, 0)
|
44
|
+
|
45
|
+
// background의 색상
|
46
|
+
context.beginPath()
|
47
|
+
context.rect(left, top, width, height)
|
48
|
+
|
49
|
+
context.fillStyle = backgroundColor
|
50
|
+
context.fill()
|
51
|
+
|
52
|
+
// value의 색상
|
53
|
+
context.beginPath()
|
54
|
+
|
55
|
+
var drawValue = width - (width * Math.max(Math.min(this.animValue, 100), 0)) / 100
|
56
|
+
drawValue = Math.max(Math.min(drawValue, width), 0) // DrawValue도 높이보다 작거나 커지지 말아야 한다.
|
57
|
+
|
58
|
+
// 그리는 값의 방향을 지정
|
59
|
+
if (reverse) context.rect(left, top, width - drawValue, height)
|
60
|
+
else context.rect(left + drawValue, top, width - drawValue, height)
|
61
|
+
|
62
|
+
this.drawFill(context)
|
63
|
+
|
64
|
+
context.closePath()
|
65
|
+
|
66
|
+
context.beginPath()
|
67
|
+
|
68
|
+
context.rect(left, top, width, height)
|
69
|
+
}
|
70
|
+
|
71
|
+
_post_draw(context: CanvasRenderingContext2D) {
|
72
|
+
this.drawStroke(context)
|
73
|
+
this.drawText(context)
|
74
|
+
}
|
75
|
+
|
76
|
+
// get controls() {}
|
77
|
+
|
78
|
+
get nature() {
|
79
|
+
return NATURE
|
80
|
+
}
|
81
|
+
}
|
82
|
+
|
83
|
+
Component.register('progress-horizontal', ProgressHorizontal)
|
@@ -0,0 +1,72 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright © HatioLab Inc. All rights reserved.
|
3
|
+
*/
|
4
|
+
|
5
|
+
import { Component, RectPath, Shape, ValueHolder } from '@hatiolab/things-scene'
|
6
|
+
|
7
|
+
const NATURE = {
|
8
|
+
mutable: false,
|
9
|
+
resizable: true,
|
10
|
+
rotatable: true,
|
11
|
+
properties: [
|
12
|
+
{
|
13
|
+
type: 'string',
|
14
|
+
label: 'value',
|
15
|
+
name: 'value',
|
16
|
+
property: 'value'
|
17
|
+
},
|
18
|
+
{
|
19
|
+
type: 'color',
|
20
|
+
label: 'background-color',
|
21
|
+
name: 'backgroundColor',
|
22
|
+
property: 'backgroundColor'
|
23
|
+
},
|
24
|
+
{
|
25
|
+
type: 'checkbox',
|
26
|
+
label: 'anim-from-base',
|
27
|
+
name: 'animFromBase'
|
28
|
+
}
|
29
|
+
],
|
30
|
+
help: 'scene/component/progress-vertical'
|
31
|
+
}
|
32
|
+
|
33
|
+
export default class ProgressVertical extends ValueHolder(RectPath(Shape)) {
|
34
|
+
_draw(context: CanvasRenderingContext2D) {
|
35
|
+
var { top, left, height, width, backgroundColor = 'transparent', animFromBase = false } = this.model
|
36
|
+
|
37
|
+
this.animOnValueChange(this.value, animFromBase, 0)
|
38
|
+
|
39
|
+
// background의 색상
|
40
|
+
context.beginPath()
|
41
|
+
context.rect(left, top, width, height)
|
42
|
+
|
43
|
+
context.fillStyle = backgroundColor
|
44
|
+
context.fill()
|
45
|
+
|
46
|
+
// value의 색상
|
47
|
+
context.beginPath()
|
48
|
+
|
49
|
+
var drawValue = height - (height * Math.max(Math.min(this.animValue, 100), 0)) / 100
|
50
|
+
drawValue = Math.max(Math.min(drawValue, height), 0) // DrawValue도 높이보다 작거나 커지지 말아야 한다.
|
51
|
+
context.rect(left, top + drawValue, width, height - drawValue)
|
52
|
+
|
53
|
+
this.drawFill(context)
|
54
|
+
|
55
|
+
context.closePath()
|
56
|
+
|
57
|
+
context.beginPath()
|
58
|
+
|
59
|
+
context.rect(left, top, width, height)
|
60
|
+
}
|
61
|
+
|
62
|
+
_post_draw(context: CanvasRenderingContext2D) {
|
63
|
+
this.drawStroke(context)
|
64
|
+
this.drawText(context)
|
65
|
+
}
|
66
|
+
|
67
|
+
get nature() {
|
68
|
+
return NATURE
|
69
|
+
}
|
70
|
+
}
|
71
|
+
|
72
|
+
Component.register('progress-vertical', ProgressVertical)
|
@@ -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>
|