@operato/scene-legend 8.0.0-beta.1 → 8.0.0-beta.2
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +2 -2
- package/CHANGELOG.md +0 -896
- package/attachments/3c2f6007-c06b-47ca-9508-9bcda9428fd0.svg +0 -425
- package/attachments/dcf0e8fe-6c3e-4b36-b3e9-a8e70b4ed590.svg +0 -425
- package/logs/.08636eb59927f12972f6774f5947c8507b3564c2-audit.json +0 -15
- package/logs/.5e5d741d8b7784a2fbad65eedc0fd46946aaf6f2-audit.json +0 -15
- package/logs/application-2023-07-13-20.log +0 -10
- package/logs/connections-2023-07-13-20.log +0 -80
- package/logs/system/.144ddb221a51f7e2afac3fe1fc3dcf306a8de9ef-audit.json +0 -15
- package/logs/system/.437ed478d36eef33cb9dfb565b13329b4464783e-audit.json +0 -20
- package/logs/system/.a16ac19e6e222b854c699e1f94ae757f5c8db307-audit.json +0 -15
- package/logs/system/scenario-/353/260/234/354/240/204/353/237/211 /354/230/210/354/270/241 /353/215/260/354/235/264/355/204/260-2023-05-09-11.log" +0 -16914
- package/logs/system/scenario-/353/260/234/354/240/204/353/237/211 /354/230/210/354/270/241 /353/215/260/354/235/264/355/204/260-2023-05-09-12.log" +0 -1382
- package/logs/system/scenario-/354/227/220/353/204/210/354/247/200 /353/240/210/354/235/264/354/226/264 /354/203/211/354/203/201-2023-07-13-20.log" +0 -510
- package/logs/system/scenario-/354/235/274/354/202/254/353/237/211 /354/230/210/354/270/241 /354/247/200/353/217/204-2023-05-09-12.log" +0 -30
- package/src/editors/editor-legend-status.ts +0 -337
- package/src/editors/index.ts +0 -17
- package/src/editors/property-editor-legend-status.ts +0 -13
- package/src/editors/property-editor-svg-info.ts +0 -77
- package/src/index.ts +0 -8
- package/src/legend-item.ts +0 -52
- package/src/legend.ts +0 -232
- package/src/svg.ts +0 -201
- package/src/templates/index.ts +0 -4
- package/src/templates/legend.ts +0 -19
- package/src/templates/svg.ts +0 -19
- package/test/basic-test.html +0 -67
- package/test/index.html +0 -24
- package/test/unit/test-legend.js +0 -33
- package/test/unit/util.js +0 -22
- package/tsconfig.json +0 -23
- package/tsconfig.tsbuildinfo +0 -1
package/src/legend.ts
DELETED
@@ -1,232 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* Copyright © HatioLab Inc. All rights reserved.
|
3
|
-
*/
|
4
|
-
import { Component, ComponentNature, Container, Model, POSITION, Properties, TableLayout } from '@hatiolab/things-scene'
|
5
|
-
|
6
|
-
const NATURE: ComponentNature = {
|
7
|
-
mutable: false,
|
8
|
-
resizable: true,
|
9
|
-
rotatable: true,
|
10
|
-
properties: [
|
11
|
-
{
|
12
|
-
type: 'number',
|
13
|
-
label: 'rows',
|
14
|
-
name: 'rows'
|
15
|
-
},
|
16
|
-
{
|
17
|
-
type: 'number',
|
18
|
-
label: 'columns',
|
19
|
-
name: 'columns'
|
20
|
-
},
|
21
|
-
{
|
22
|
-
type: 'select',
|
23
|
-
label: 'direction',
|
24
|
-
name: 'direction',
|
25
|
-
property: {
|
26
|
-
options: [
|
27
|
-
{
|
28
|
-
display: 'Horizontal',
|
29
|
-
value: 'horizontal'
|
30
|
-
},
|
31
|
-
{
|
32
|
-
display: 'Vertical',
|
33
|
-
value: 'vertical'
|
34
|
-
}
|
35
|
-
]
|
36
|
-
}
|
37
|
-
},
|
38
|
-
{
|
39
|
-
type: 'number',
|
40
|
-
label: 'round',
|
41
|
-
name: 'round'
|
42
|
-
},
|
43
|
-
{
|
44
|
-
type: 'legend-status',
|
45
|
-
label: '',
|
46
|
-
name: 'status'
|
47
|
-
}
|
48
|
-
],
|
49
|
-
help: 'scene/component/legend'
|
50
|
-
}
|
51
|
-
|
52
|
-
var controlHandler = {
|
53
|
-
ondragmove: function (point: POSITION, index: number, component: Component) {
|
54
|
-
var { left, top, width, height } = component.model
|
55
|
-
/*
|
56
|
-
* point의 좌표는 부모 레이어 기준의 x, y 값이다.
|
57
|
-
* 따라서, 도형의 회전을 감안한 좌표로의 변환이 필요하다.
|
58
|
-
* Transcoord시에는 point좌표가 부모까지 transcoord되어있는 상태이므로,
|
59
|
-
* 컴포넌트자신에 대한 transcoord만 필요하다.(마지막 파라미터를 false로).
|
60
|
-
*/
|
61
|
-
var transcoorded = component.transcoordP2S(point.x, point.y)
|
62
|
-
var round = ((transcoorded.x - left) / (width / 2)) * 100
|
63
|
-
|
64
|
-
round = roundSet(round, width, height)
|
65
|
-
|
66
|
-
component.set({ round })
|
67
|
-
}
|
68
|
-
}
|
69
|
-
|
70
|
-
function roundSet(round: number, width: number, height: number) {
|
71
|
-
var max = width > height ? (height / width) * 100 : 100
|
72
|
-
|
73
|
-
if (round >= max) round = max
|
74
|
-
else if (round <= 0) round = 0
|
75
|
-
|
76
|
-
return round
|
77
|
-
}
|
78
|
-
|
79
|
-
export default class Legend extends Container {
|
80
|
-
ready() {
|
81
|
-
this.rebuildLegendItems()
|
82
|
-
}
|
83
|
-
|
84
|
-
get showMoveHandle() {
|
85
|
-
return false
|
86
|
-
}
|
87
|
-
|
88
|
-
render(context: CanvasRenderingContext2D) {
|
89
|
-
var { round = 0 } = this.state
|
90
|
-
|
91
|
-
var { left, top, width, height } = this.bounds
|
92
|
-
|
93
|
-
// 박스 그리기
|
94
|
-
context.beginPath()
|
95
|
-
|
96
|
-
round = roundSet(round, width, height)
|
97
|
-
|
98
|
-
if (round > 0) {
|
99
|
-
var radius = (round / 100) * (width / 2)
|
100
|
-
|
101
|
-
context.moveTo(left + radius, top)
|
102
|
-
context.lineTo(left + width - radius, top)
|
103
|
-
context.quadraticCurveTo(left + width, top, left + width, top + radius)
|
104
|
-
context.lineTo(left + width, top + height - radius)
|
105
|
-
context.quadraticCurveTo(left + width, top + height, left + width - radius, top + height)
|
106
|
-
context.lineTo(left + radius, top + height)
|
107
|
-
context.quadraticCurveTo(left, top + height, left, top + height - radius)
|
108
|
-
context.lineTo(left, top + radius)
|
109
|
-
context.quadraticCurveTo(left, top, left + radius, top)
|
110
|
-
|
111
|
-
this.model.padding = {
|
112
|
-
top: round / 2,
|
113
|
-
left: round / 2,
|
114
|
-
right: round / 2,
|
115
|
-
bottom: round / 2
|
116
|
-
}
|
117
|
-
} else {
|
118
|
-
context.rect(left, top, width, height)
|
119
|
-
}
|
120
|
-
|
121
|
-
this.drawFill(context)
|
122
|
-
this.drawStroke(context)
|
123
|
-
}
|
124
|
-
|
125
|
-
get controls() {
|
126
|
-
var { left, top, width, round, height } = this.state
|
127
|
-
round = round == undefined ? 0 : roundSet(round, width, height)
|
128
|
-
|
129
|
-
return [
|
130
|
-
{
|
131
|
-
x: left + (width / 2) * (round / 100),
|
132
|
-
y: top,
|
133
|
-
handler: controlHandler
|
134
|
-
}
|
135
|
-
]
|
136
|
-
}
|
137
|
-
|
138
|
-
get layout() {
|
139
|
-
return TableLayout
|
140
|
-
}
|
141
|
-
|
142
|
-
get nature() {
|
143
|
-
return NATURE
|
144
|
-
}
|
145
|
-
|
146
|
-
rebuildLegendItems() {
|
147
|
-
if (this.components.length) {
|
148
|
-
this.components.slice().forEach(m => m.dispose())
|
149
|
-
}
|
150
|
-
|
151
|
-
var {
|
152
|
-
left,
|
153
|
-
top,
|
154
|
-
width,
|
155
|
-
height,
|
156
|
-
fillStyle,
|
157
|
-
strokeStyle,
|
158
|
-
fontColor,
|
159
|
-
fontFamily,
|
160
|
-
fontSize,
|
161
|
-
lineHeight,
|
162
|
-
textAlign = 'left',
|
163
|
-
round = 0,
|
164
|
-
italic,
|
165
|
-
bold,
|
166
|
-
lineWidth = 0,
|
167
|
-
rows,
|
168
|
-
columns,
|
169
|
-
status = {}
|
170
|
-
} = this.state
|
171
|
-
|
172
|
-
let statusRanges: {
|
173
|
-
min: string
|
174
|
-
max: string
|
175
|
-
description: string
|
176
|
-
color: string
|
177
|
-
}[] = status.ranges || []
|
178
|
-
|
179
|
-
var count = statusRanges.length
|
180
|
-
|
181
|
-
this.add(
|
182
|
-
statusRanges.map(range =>
|
183
|
-
Model.compile({
|
184
|
-
type: 'legend-item',
|
185
|
-
text: range.description || `${range.min || ''} ~ ${range.max || ''}`,
|
186
|
-
width: 1,
|
187
|
-
height: 1,
|
188
|
-
color: range.color,
|
189
|
-
fontColor,
|
190
|
-
fontFamily,
|
191
|
-
fontSize,
|
192
|
-
lineHeight,
|
193
|
-
italic,
|
194
|
-
bold,
|
195
|
-
textAlign
|
196
|
-
})
|
197
|
-
)
|
198
|
-
)
|
199
|
-
|
200
|
-
var rows, columns
|
201
|
-
|
202
|
-
if (!columns && !rows) {
|
203
|
-
rows = count
|
204
|
-
columns = 1
|
205
|
-
} else if (columns && !rows) {
|
206
|
-
rows = Math.ceil(count / Number(columns))
|
207
|
-
} else if (rows && !columns) {
|
208
|
-
columns = Math.ceil(count / Number(rows))
|
209
|
-
}
|
210
|
-
|
211
|
-
this.set({
|
212
|
-
layoutConfig: {
|
213
|
-
rows,
|
214
|
-
columns
|
215
|
-
}
|
216
|
-
})
|
217
|
-
}
|
218
|
-
|
219
|
-
get hasTextProperty() {
|
220
|
-
return true
|
221
|
-
}
|
222
|
-
|
223
|
-
get textHidden() {
|
224
|
-
return true
|
225
|
-
}
|
226
|
-
|
227
|
-
onchange(after: Properties, before: Properties) {
|
228
|
-
this.rebuildLegendItems()
|
229
|
-
}
|
230
|
-
}
|
231
|
-
|
232
|
-
Component.register('legend', Legend)
|
package/src/svg.ts
DELETED
@@ -1,201 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* Copyright © HatioLab Inc. All rights reserved.
|
3
|
-
*/
|
4
|
-
|
5
|
-
const NATURE: ComponentNature = {
|
6
|
-
mutable: false,
|
7
|
-
resizable: true,
|
8
|
-
rotatable: true,
|
9
|
-
properties: [
|
10
|
-
{
|
11
|
-
type: 'image-selector',
|
12
|
-
label: 'image-src',
|
13
|
-
name: 'src',
|
14
|
-
property: {
|
15
|
-
displayField: 'id',
|
16
|
-
displayFullUrl: true,
|
17
|
-
baseUrlAlias: '$base_url',
|
18
|
-
defaultStorage: 'scene-image',
|
19
|
-
storageFilters: {
|
20
|
-
type: Array,
|
21
|
-
value: [
|
22
|
-
{
|
23
|
-
name: 'category',
|
24
|
-
value: 'image'
|
25
|
-
}
|
26
|
-
]
|
27
|
-
},
|
28
|
-
useUpload: true
|
29
|
-
},
|
30
|
-
observe: function (this: HTMLElement, src: string) {
|
31
|
-
const info: any = this.parentNode!.querySelector('[name=svgInfo]')
|
32
|
-
info.src = src
|
33
|
-
}
|
34
|
-
},
|
35
|
-
{
|
36
|
-
type: 'svg-info',
|
37
|
-
label: 'svg-info',
|
38
|
-
name: 'svgInfo',
|
39
|
-
readonly: true,
|
40
|
-
editor: {
|
41
|
-
fullwidth: true
|
42
|
-
}
|
43
|
-
},
|
44
|
-
{
|
45
|
-
type: 'id-input',
|
46
|
-
label: 'legend-target',
|
47
|
-
name: 'legendTarget',
|
48
|
-
property: {
|
49
|
-
component: 'legend'
|
50
|
-
}
|
51
|
-
},
|
52
|
-
{
|
53
|
-
type: 'string',
|
54
|
-
label: 'id-field',
|
55
|
-
name: 'idField'
|
56
|
-
},
|
57
|
-
{
|
58
|
-
type: 'string',
|
59
|
-
label: 'value-field',
|
60
|
-
name: 'valueField'
|
61
|
-
}
|
62
|
-
]
|
63
|
-
}
|
64
|
-
|
65
|
-
import { Component, ComponentNature, HTMLOverlayElement, Properties } from '@hatiolab/things-scene'
|
66
|
-
import Legend from './legend'
|
67
|
-
|
68
|
-
export default class Svg extends HTMLOverlayElement {
|
69
|
-
static get nature() {
|
70
|
-
return NATURE
|
71
|
-
}
|
72
|
-
|
73
|
-
async oncreate_element(div: HTMLDivElement) {
|
74
|
-
await this.loadSVG(div)
|
75
|
-
}
|
76
|
-
|
77
|
-
private _value?: any
|
78
|
-
private _legendTarget?: Component
|
79
|
-
|
80
|
-
get legendTarget() {
|
81
|
-
var { legendTarget } = this.state
|
82
|
-
|
83
|
-
if (!this._legendTarget && legendTarget) {
|
84
|
-
this._legendTarget = this.root.findById(legendTarget)
|
85
|
-
this._legendTarget && this._legendTarget.on('change', this.onchangeData, this)
|
86
|
-
}
|
87
|
-
|
88
|
-
return this._legendTarget
|
89
|
-
}
|
90
|
-
|
91
|
-
async loadSVG(div: HTMLElement) {
|
92
|
-
try {
|
93
|
-
const parser = new DOMParser()
|
94
|
-
|
95
|
-
const response = await fetch(this.src)
|
96
|
-
|
97
|
-
div.innerHTML = ''
|
98
|
-
|
99
|
-
if (response.ok) {
|
100
|
-
const text = await response.text()
|
101
|
-
const doc = await parser.parseFromString(text, 'image/svg+xml')
|
102
|
-
const element = doc.querySelector('svg')
|
103
|
-
|
104
|
-
element && div.appendChild(element)
|
105
|
-
} else {
|
106
|
-
const error = await response.text()
|
107
|
-
console.error('load SVG error', error)
|
108
|
-
}
|
109
|
-
} catch (error) {
|
110
|
-
console.error(error)
|
111
|
-
}
|
112
|
-
}
|
113
|
-
|
114
|
-
async setElementProperties(div: HTMLDivElement) {}
|
115
|
-
|
116
|
-
get src() {
|
117
|
-
return this.getState('src')
|
118
|
-
}
|
119
|
-
|
120
|
-
set src(src) {
|
121
|
-
this.setState('src', src)
|
122
|
-
}
|
123
|
-
|
124
|
-
onchange(after: Properties, before: Properties) {
|
125
|
-
'src' in after && this.onchangeSrc(after.src)
|
126
|
-
'value' in after && this.onchangeValue(after.value)
|
127
|
-
}
|
128
|
-
|
129
|
-
onchangeSrc(src: string) {
|
130
|
-
this.loadSVG(this.element)
|
131
|
-
}
|
132
|
-
|
133
|
-
onchangeValue(value: any): void {
|
134
|
-
if (typeof this.value !== 'object' || !Array.isArray(this.value)) {
|
135
|
-
return
|
136
|
-
}
|
137
|
-
|
138
|
-
const { idField, valueField } = this.state
|
139
|
-
const legendTarget = this.legendTarget
|
140
|
-
|
141
|
-
if (!legendTarget) {
|
142
|
-
return
|
143
|
-
}
|
144
|
-
|
145
|
-
const {
|
146
|
-
field: statusField,
|
147
|
-
defaultColor,
|
148
|
-
ranges
|
149
|
-
} = legendTarget.getState('status') as {
|
150
|
-
field: string
|
151
|
-
defaultColor: string
|
152
|
-
ranges: { min: number; max: number; color: string }[]
|
153
|
-
}
|
154
|
-
|
155
|
-
if (!(statusField && ranges)) {
|
156
|
-
return
|
157
|
-
}
|
158
|
-
|
159
|
-
this.value.forEach(item => {
|
160
|
-
if (!(idField in item) || !(valueField in item)) {
|
161
|
-
return
|
162
|
-
}
|
163
|
-
|
164
|
-
var id = item[idField]
|
165
|
-
var status = Number(item[valueField])
|
166
|
-
|
167
|
-
var range = ranges.find((range, index) => {
|
168
|
-
let { min, max } = range
|
169
|
-
|
170
|
-
min = Number(min) || min
|
171
|
-
max = Number(max) || max
|
172
|
-
|
173
|
-
return max > status && (min === undefined || min <= status)
|
174
|
-
})
|
175
|
-
|
176
|
-
const paths = this.element.querySelectorAll(`path[id="${String(id)}"]`) as NodeListOf<SVGPathElement>
|
177
|
-
paths.forEach(path => {
|
178
|
-
path.style.fill = range?.color || defaultColor || 'transparent'
|
179
|
-
})
|
180
|
-
})
|
181
|
-
}
|
182
|
-
|
183
|
-
get tagName() {
|
184
|
-
return 'div'
|
185
|
-
}
|
186
|
-
|
187
|
-
get nature() {
|
188
|
-
return NATURE
|
189
|
-
}
|
190
|
-
|
191
|
-
get value() {
|
192
|
-
return this._value
|
193
|
-
}
|
194
|
-
|
195
|
-
set value(value) {
|
196
|
-
this._value = value
|
197
|
-
this.onchangeValue(value)
|
198
|
-
}
|
199
|
-
}
|
200
|
-
|
201
|
-
Component.register('svg', Svg)
|
package/src/templates/index.ts
DELETED
package/src/templates/legend.ts
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
const icon = new URL('../../icons/legend.png', import.meta.url).href
|
2
|
-
|
3
|
-
export default {
|
4
|
-
type: 'legend',
|
5
|
-
description: 'legend for visualizer',
|
6
|
-
group: 'warehouse' /* line|shape|textAndMedia|chartAndGauge|table|container|dataSource|IoT|3D|warehouse|form|etc */,
|
7
|
-
icon,
|
8
|
-
model: {
|
9
|
-
type: 'legend',
|
10
|
-
left: 100,
|
11
|
-
top: 100,
|
12
|
-
width: 200,
|
13
|
-
height: 150,
|
14
|
-
fillStyle: '#efefef',
|
15
|
-
direction: 'vertical',
|
16
|
-
strokeStyle: 'rgba(0, 0, 0, 0.3)',
|
17
|
-
lineWidth: 1
|
18
|
-
}
|
19
|
-
}
|
package/src/templates/svg.ts
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
const icon = new URL('../../icons/svg.png', import.meta.url).href
|
2
|
-
|
3
|
-
export default {
|
4
|
-
type: 'svg',
|
5
|
-
description: 'svg for visualizer',
|
6
|
-
group: 'warehouse' /* line|shape|textAndMedia|chartAndGauge|table|container|dataSource|IoT|3D|warehouse|form|etc */,
|
7
|
-
icon,
|
8
|
-
model: {
|
9
|
-
type: 'svg',
|
10
|
-
left: 100,
|
11
|
-
top: 100,
|
12
|
-
width: 400,
|
13
|
-
height: 300,
|
14
|
-
fillStyle: '#efefef',
|
15
|
-
direction: 'vertical',
|
16
|
-
strokeStyle: 'rgba(0, 0, 0, 0.3)',
|
17
|
-
lineWidth: 1
|
18
|
-
}
|
19
|
-
}
|
package/test/basic-test.html
DELETED
@@ -1,67 +0,0 @@
|
|
1
|
-
<!--
|
2
|
-
@license
|
3
|
-
Copyright © HatioLab Inc. All rights reserved.
|
4
|
-
-->
|
5
|
-
<!doctype html>
|
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-legend.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-legend-fixture">
|
21
|
-
<template>
|
22
|
-
<things-scene-legend>
|
23
|
-
<h2>things-scene-legend</h2>
|
24
|
-
</things-scene-legend>
|
25
|
-
</template>
|
26
|
-
</test-fixture>
|
27
|
-
|
28
|
-
<script>
|
29
|
-
suite('<things-scene-legend>', function() {
|
30
|
-
|
31
|
-
var myEl;
|
32
|
-
|
33
|
-
setup(function() {
|
34
|
-
myEl = fixture('things-scene-legend-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-legend says, Hello World!');
|
44
|
-
|
45
|
-
var greetings = myEl.sayHello('greetings Earthlings');
|
46
|
-
assert.equal(greetings, 'things-scene-legend says, greetings Earthlings');
|
47
|
-
});
|
48
|
-
|
49
|
-
test('fires lasers', function(done) {
|
50
|
-
myEl.addEventListener('things-scene-legend-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
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
<!--
|
2
|
-
@license
|
3
|
-
Copyright © HatioLab Inc. All rights reserved.
|
4
|
-
-->
|
5
|
-
<!DOCTYPE html>
|
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
|
-
</head>
|
14
|
-
<body>
|
15
|
-
<script>
|
16
|
-
// Load and run all tests (.html, .js):
|
17
|
-
WCT.loadSuites([
|
18
|
-
'basic-test.html',
|
19
|
-
'basic-test.html?dom=shadow'
|
20
|
-
]);
|
21
|
-
</script>
|
22
|
-
|
23
|
-
</body>
|
24
|
-
</html>
|
package/test/unit/test-legend.js
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* Copyright © HatioLab Inc. All rights reserved.
|
3
|
-
*/
|
4
|
-
|
5
|
-
import './util'
|
6
|
-
|
7
|
-
import { expect } from 'chai'
|
8
|
-
|
9
|
-
import '../../bower_components/things-scene-core/things-scene-min'
|
10
|
-
import { Legend } from '../../src/index'
|
11
|
-
|
12
|
-
describe('Legend', function () {
|
13
|
-
|
14
|
-
var board;
|
15
|
-
|
16
|
-
beforeEach(function () {
|
17
|
-
board = scene.create({
|
18
|
-
model: {
|
19
|
-
components: [{
|
20
|
-
id: 'legend',
|
21
|
-
type: 'legend'
|
22
|
-
}]
|
23
|
-
}
|
24
|
-
})
|
25
|
-
});
|
26
|
-
|
27
|
-
it('component should be found by its id.', function () {
|
28
|
-
|
29
|
-
var component = board.findById('legend')
|
30
|
-
|
31
|
-
expect(!!component).not.to.equal(false);
|
32
|
-
});
|
33
|
-
});
|
package/test/unit/util.js
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* Copyright © HatioLab Inc. All rights reserved.
|
3
|
-
*/
|
4
|
-
|
5
|
-
var noop = () => {}
|
6
|
-
|
7
|
-
global.Canvas = require('canvas');
|
8
|
-
|
9
|
-
Canvas.prototype.setAttribute = noop;
|
10
|
-
Canvas.prototype.style = {};
|
11
|
-
|
12
|
-
global.Image = Canvas.Image;
|
13
|
-
global.screen = {
|
14
|
-
width: 1280,
|
15
|
-
height: 800
|
16
|
-
};
|
17
|
-
|
18
|
-
global.window = global;
|
19
|
-
|
20
|
-
global.addEventListener = noop;
|
21
|
-
global.location = {};
|
22
|
-
global.getComputedStyle = noop;
|
package/tsconfig.json
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"compilerOptions": {
|
3
|
-
"target": "es2018",
|
4
|
-
"module": "esnext",
|
5
|
-
"moduleResolution": "node",
|
6
|
-
"noEmitOnError": true,
|
7
|
-
"lib": ["es2019", "dom"],
|
8
|
-
"strict": true,
|
9
|
-
"esModuleInterop": false,
|
10
|
-
"allowJs": true,
|
11
|
-
"allowSyntheticDefaultImports": true,
|
12
|
-
"experimentalDecorators": true,
|
13
|
-
"importHelpers": true,
|
14
|
-
"outDir": "dist",
|
15
|
-
"sourceMap": true,
|
16
|
-
"inlineSources": true,
|
17
|
-
"rootDir": "src",
|
18
|
-
"declaration": true,
|
19
|
-
"incremental": true,
|
20
|
-
"skipLibCheck": true
|
21
|
-
},
|
22
|
-
"include": ["**/*.ts", "*.d.ts"]
|
23
|
-
}
|