@safe-engine/pixi 1.0.2 → 7.0.1

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.
Files changed (48) hide show
  1. package/.github/workflows/npm-publish.yml +35 -0
  2. package/README.md +4 -4
  3. package/dist/app.d.ts +3 -2
  4. package/dist/app.d.ts.map +1 -1
  5. package/dist/app.js +41 -81
  6. package/dist/components/GUIComponent.d.ts +15 -14
  7. package/dist/components/GUIComponent.d.ts.map +1 -1
  8. package/dist/components/GUIComponent.js +68 -138
  9. package/dist/components/NodeComp.d.ts +6 -5
  10. package/dist/components/NodeComp.d.ts.map +1 -1
  11. package/dist/components/NodeComp.js +223 -305
  12. package/dist/components/RenderComponent.d.ts +8 -7
  13. package/dist/components/RenderComponent.d.ts.map +1 -1
  14. package/dist/components/RenderComponent.js +25 -56
  15. package/dist/core/Color.js +1 -1
  16. package/dist/core/LoadingBar.d.ts +9 -1
  17. package/dist/core/LoadingBar.d.ts.map +1 -1
  18. package/dist/core/LoadingBar.js +50 -46
  19. package/dist/core/Size.js +3 -6
  20. package/dist/core/Vec2.d.ts +20 -0
  21. package/dist/core/Vec2.d.ts.map +1 -0
  22. package/dist/core/Vec2.js +70 -0
  23. package/dist/helper/html-text-parser.js +34 -34
  24. package/dist/helper/utils.d.ts +1 -1
  25. package/dist/helper/utils.d.ts.map +1 -1
  26. package/dist/helper/utils.js +20 -24
  27. package/dist/index.d.ts +4 -6
  28. package/dist/index.d.ts.map +1 -1
  29. package/dist/index.js +4 -18
  30. package/dist/systems/GUISystem.d.ts +2 -2
  31. package/dist/systems/GUISystem.d.ts.map +1 -1
  32. package/dist/systems/GUISystem.js +39 -40
  33. package/dist/systems/RenderSystem.d.ts +0 -1
  34. package/dist/systems/RenderSystem.d.ts.map +1 -1
  35. package/dist/systems/RenderSystem.js +24 -35
  36. package/package.json +4 -3
  37. package/src/app.ts +53 -0
  38. package/src/components/GUIComponent.ts +141 -0
  39. package/src/components/NodeComp.ts +416 -0
  40. package/src/components/RenderComponent.ts +66 -0
  41. package/src/core/Color.ts +3 -0
  42. package/src/core/LoadingBar.ts +63 -0
  43. package/src/core/Size.ts +21 -0
  44. package/src/helper/html-text-parser.ts +364 -0
  45. package/src/index.ts +7 -0
  46. package/src/systems/GUISystem.ts +80 -0
  47. package/src/systems/RenderSystem.ts +70 -0
  48. package/tsconfig.json +24 -0
@@ -0,0 +1,364 @@
1
+ /* eslint-disable no-var */
2
+ /* eslint-disable quotes */
3
+ /* eslint-disable no-useless-escape */
4
+ /****************************************************************************
5
+ Copyright (c) 2013-2016 Chukong Technologies Inc.
6
+ Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
7
+
8
+ https://www.cocos.com/
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated engine source code (the "Software"), a limited,
12
+ worldwide, royalty-free, non-assignable, revocable and non-exclusive license
13
+ to use Cocos Creator solely to develop games on your target platforms. You shall
14
+ not use Cocos Creator software for developing other software or tools that's
15
+ used for developing games. You are not granted to publish, distribute,
16
+ sublicense, and/or sell copies of Cocos Creator.
17
+
18
+ The software or tools in this License Agreement are licensed, not sold.
19
+ Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
20
+
21
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
27
+ THE SOFTWARE.
28
+ ****************************************************************************/
29
+
30
+ const eventRegx = /^(click)(\s)*=|(param)(\s)*=/
31
+ const imageAttrReg =
32
+ /(\s)*src(\s)*=|(\s)*height(\s)*=|(\s)*width(\s)*=|(\s)*align(\s)*=|(\s)*offset(\s)*=|(\s)*click(\s)*=|(\s)*param(\s)*=/
33
+ /**
34
+ * A utils class for parsing HTML texts. The parsed results will be an object array.
35
+ */
36
+ export const HtmlTextParser = function () {
37
+ this._parsedObject = {}
38
+ this._specialSymbolArray = []
39
+ this._specialSymbolArray.push([/&lt;/g, '<'])
40
+ this._specialSymbolArray.push([/&gt;/g, '>'])
41
+ this._specialSymbolArray.push([/&amp;/g, '&'])
42
+ this._specialSymbolArray.push([/&quot;/g, '"'])
43
+ this._specialSymbolArray.push([/&apos;/g, "'"])
44
+ this._specialSymbolArray.push([/&nbsp;/g, ' '])
45
+ }
46
+
47
+ HtmlTextParser.prototype = {
48
+ constructor: HtmlTextParser,
49
+ parse: function (htmlString) {
50
+ this._resultObjectArray = []
51
+ if (!htmlString) {
52
+ return this._resultObjectArray
53
+ }
54
+ this._stack = []
55
+
56
+ let startIndex = 0
57
+ const length = htmlString.length
58
+ while (startIndex < length) {
59
+ let tagEndIndex = htmlString.indexOf('>', startIndex)
60
+ let tagBeginIndex = -1
61
+ if (tagEndIndex >= 0) {
62
+ tagBeginIndex = htmlString.lastIndexOf('<', tagEndIndex)
63
+ const noTagBegin = tagBeginIndex < startIndex - 1
64
+
65
+ if (noTagBegin) {
66
+ tagBeginIndex = htmlString.indexOf('<', tagEndIndex + 1)
67
+ tagEndIndex = htmlString.indexOf('>', tagBeginIndex + 1)
68
+ }
69
+ }
70
+
71
+ if (tagBeginIndex < 0) {
72
+ this._stack.pop()
73
+ this._processResult(htmlString.substring(startIndex))
74
+ startIndex = length
75
+ } else {
76
+ let newStr = htmlString.substring(startIndex, tagBeginIndex)
77
+ const tagStr = htmlString.substring(tagBeginIndex + 1, tagEndIndex)
78
+ if (tagStr === '') newStr = htmlString.substring(startIndex, tagEndIndex + 1)
79
+ this._processResult(newStr)
80
+ if (tagEndIndex === -1) {
81
+ // cc.error('The HTML tag is invalid!');
82
+ tagEndIndex = tagBeginIndex
83
+ } else if (htmlString.charAt(tagBeginIndex + 1) === '/') {
84
+ this._stack.pop()
85
+ } else {
86
+ this._addToStack(tagStr)
87
+ }
88
+ startIndex = tagEndIndex + 1
89
+ }
90
+ }
91
+
92
+ return this._resultObjectArray
93
+ },
94
+
95
+ _attributeToObject: function (attribute) {
96
+ attribute = attribute.trim()
97
+
98
+ const obj: any = {}
99
+ let header = attribute.match(/^(color|size)(\s)*=/)
100
+ let tagName
101
+ let nextSpace
102
+ let eventObj
103
+ let eventHanlderString
104
+ if (header) {
105
+ tagName = header[0]
106
+ attribute = attribute.substring(tagName.length).trim()
107
+ if (attribute === '') return obj
108
+
109
+ //parse color
110
+ nextSpace = attribute.indexOf(' ')
111
+ switch (tagName[0]) {
112
+ case 'c':
113
+ if (nextSpace > -1) {
114
+ obj.color = attribute.substring(0, nextSpace).trim()
115
+ } else {
116
+ obj.color = attribute
117
+ }
118
+ break
119
+ case 's':
120
+ obj.size = parseInt(attribute)
121
+ break
122
+ }
123
+
124
+ //tag has event arguments
125
+ if (nextSpace > -1) {
126
+ eventHanlderString = attribute.substring(nextSpace + 1).trim()
127
+ eventObj = this._processEventHandler(eventHanlderString)
128
+ obj.event = eventObj
129
+ }
130
+ return obj
131
+ }
132
+
133
+ header = attribute.match(/^(br(\s)*\/)/)
134
+ if (header && header[0].length > 0) {
135
+ tagName = header[0].trim()
136
+ if (tagName.startsWith('br') && tagName[tagName.length - 1] === '/') {
137
+ obj.isNewLine = true
138
+ this._resultObjectArray.push({ text: '', style: { newline: true } })
139
+ return obj
140
+ }
141
+ }
142
+
143
+ header = attribute.match(/^(img(\s)*src(\s)*=[^>]+\/)/)
144
+ if (header && header[0].length > 0) {
145
+ tagName = header[0].trim()
146
+ if (tagName.startsWith('img') && tagName[tagName.length - 1] === '/') {
147
+ header = attribute.match(imageAttrReg)
148
+ var tagValue
149
+ var remainingArgument
150
+ let isValidImageTag = false
151
+ while (header) {
152
+ //skip the invalid tags at first
153
+ attribute = attribute.substring(attribute.indexOf(header[0]))
154
+ tagName = attribute.substr(0, header[0].length)
155
+ //remove space and = character
156
+ remainingArgument = attribute.substring(tagName.length).trim()
157
+ nextSpace = remainingArgument.indexOf(' ')
158
+
159
+ tagValue = nextSpace > -1 ? remainingArgument.substr(0, nextSpace) : remainingArgument
160
+ tagName = tagName.replace(/[^a-zA-Z]/g, '').trim()
161
+ tagName = tagName.toLocaleLowerCase()
162
+
163
+ attribute = remainingArgument.substring(nextSpace).trim()
164
+ if (tagValue.endsWith('/')) tagValue = tagValue.slice(0, -1)
165
+ if (tagName === 'src') {
166
+ switch (tagValue.charCodeAt(0)) {
167
+ case 34: // "
168
+ case 39: // '
169
+ isValidImageTag = true
170
+ tagValue = tagValue.slice(1, -1)
171
+ break
172
+ }
173
+ obj.isImage = true
174
+ obj.src = tagValue
175
+ } else if (tagName === 'height') {
176
+ obj.imageHeight = parseInt(tagValue)
177
+ } else if (tagName === 'width') {
178
+ obj.imageWidth = parseInt(tagValue)
179
+ } else if (tagName === 'align') {
180
+ switch (tagValue.charCodeAt(0)) {
181
+ case 34: // "
182
+ case 39: // '
183
+ tagValue = tagValue.slice(1, -1)
184
+ break
185
+ }
186
+ obj.imageAlign = tagValue.toLocaleLowerCase()
187
+ } else if (tagName === 'offset') {
188
+ obj.imageOffset = tagValue
189
+ } else if (tagName === 'click') {
190
+ obj.event = this._processEventHandler(`${tagName}=${tagValue}`)
191
+ }
192
+
193
+ if (obj.event && tagName === 'param') {
194
+ obj.event.param = tagValue.replace(/^\"|\"$/g, '')
195
+ }
196
+
197
+ header = attribute.match(imageAttrReg)
198
+ }
199
+
200
+ if (isValidImageTag && obj.isImage) {
201
+ this._resultObjectArray.push({ text: '', style: obj })
202
+ }
203
+
204
+ return {}
205
+ }
206
+ }
207
+
208
+ header = attribute.match(/^(outline(\s)*[^>]*)/)
209
+ if (header) {
210
+ attribute = header[0].substring('outline'.length).trim()
211
+ const defaultOutlineObject = { color: '#ffffff', width: 1 }
212
+ if (attribute) {
213
+ const outlineAttrReg = /(\s)*color(\s)*=|(\s)*width(\s)*=|(\s)*click(\s)*=|(\s)*param(\s)*=/
214
+ header = attribute.match(outlineAttrReg)
215
+ var tagValue
216
+ while (header) {
217
+ //skip the invalid tags at first
218
+ attribute = attribute.substring(attribute.indexOf(header[0]))
219
+ tagName = attribute.substr(0, header[0].length)
220
+ //remove space and = character
221
+ remainingArgument = attribute.substring(tagName.length).trim()
222
+ nextSpace = remainingArgument.indexOf(' ')
223
+ if (nextSpace > -1) {
224
+ tagValue = remainingArgument.substr(0, nextSpace)
225
+ } else {
226
+ tagValue = remainingArgument
227
+ }
228
+ tagName = tagName.replace(/[^a-zA-Z]/g, '').trim()
229
+ tagName = tagName.toLocaleLowerCase()
230
+
231
+ attribute = remainingArgument.substring(nextSpace).trim()
232
+ if (tagName === 'click') {
233
+ obj.event = this._processEventHandler(`${tagName}=${tagValue}`)
234
+ } else if (tagName === 'color') {
235
+ defaultOutlineObject.color = tagValue
236
+ } else if (tagName === 'width') {
237
+ defaultOutlineObject.width = parseInt(tagValue)
238
+ }
239
+
240
+ if (obj.event && tagName === 'param') {
241
+ obj.event.param = tagValue.replace(/^\"|\"$/g, '')
242
+ }
243
+
244
+ header = attribute.match(outlineAttrReg)
245
+ }
246
+ }
247
+ obj.outline = defaultOutlineObject
248
+ }
249
+
250
+ header = attribute.match(/^(on|u|b|i)(\s)*/)
251
+ if (header && header[0].length > 0) {
252
+ tagName = header[0]
253
+ attribute = attribute.substring(tagName.length).trim()
254
+ switch (tagName[0]) {
255
+ case 'u':
256
+ obj.underline = true
257
+ break
258
+ case 'i':
259
+ obj.italic = true
260
+ break
261
+ case 'b':
262
+ obj.bold = true
263
+ break
264
+ }
265
+ if (attribute === '') {
266
+ return obj
267
+ }
268
+ eventObj = this._processEventHandler(attribute)
269
+ obj.event = eventObj
270
+ }
271
+
272
+ return obj
273
+ },
274
+
275
+ _processEventHandler: function (eventString) {
276
+ let index = 0
277
+ const obj = {}
278
+ let eventNames = eventString.match(eventRegx)
279
+ let isValidTag = false
280
+ while (eventNames) {
281
+ let eventName = eventNames[0]
282
+ let eventValue = ''
283
+ isValidTag = false
284
+ eventString = eventString.substring(eventName.length).trim()
285
+ if (eventString.charAt(0) === '"') {
286
+ index = eventString.indexOf('"', 1)
287
+ if (index > -1) {
288
+ eventValue = eventString.substring(1, index).trim()
289
+ isValidTag = true
290
+ }
291
+ index++
292
+ } else if (eventString.charAt(0) === '\'') {
293
+ index = eventString.indexOf('\'', 1)
294
+ if (index > -1) {
295
+ eventValue = eventString.substring(1, index).trim()
296
+ isValidTag = true
297
+ }
298
+ index++
299
+ } else {
300
+ //skip the invalid attribute value
301
+ const match = eventString.match(/(\S)+/)
302
+ if (match) {
303
+ eventValue = match[0]
304
+ } else {
305
+ eventValue = ''
306
+ }
307
+ index = eventValue.length
308
+ }
309
+
310
+ if (isValidTag) {
311
+ eventName = eventName.substring(0, eventName.length - 1).trim()
312
+ obj[eventName] = eventValue
313
+ }
314
+
315
+ eventString = eventString.substring(index).trim()
316
+ eventNames = eventString.match(eventRegx)
317
+ }
318
+
319
+ return obj
320
+ },
321
+
322
+ _addToStack: function (attribute) {
323
+ const obj = this._attributeToObject(attribute)
324
+
325
+ if (this._stack.length === 0) {
326
+ this._stack.push(obj)
327
+ } else {
328
+ if (obj.isNewLine || obj.isImage) {
329
+ return
330
+ }
331
+ //for nested tags
332
+ const previousTagObj = this._stack[this._stack.length - 1]
333
+ for (const key in previousTagObj) {
334
+ if (!obj[key]) {
335
+ obj[key] = previousTagObj[key]
336
+ }
337
+ }
338
+ this._stack.push(obj)
339
+ }
340
+ },
341
+
342
+ _processResult: function (value) {
343
+ if (value === '') {
344
+ return
345
+ }
346
+
347
+ value = this._escapeSpecialSymbol(value)
348
+ if (this._stack.length > 0) {
349
+ this._resultObjectArray.push({ text: value, style: this._stack[this._stack.length - 1] })
350
+ } else {
351
+ this._resultObjectArray.push({ text: value })
352
+ }
353
+ },
354
+
355
+ _escapeSpecialSymbol: function (str) {
356
+ for (let i = 0; i < this._specialSymbolArray.length; ++i) {
357
+ const key = this._specialSymbolArray[i][0]
358
+ const value = this._specialSymbolArray[i][1]
359
+
360
+ str = str.replace(key, value)
361
+ }
362
+ return str
363
+ },
364
+ }
package/src/index.ts ADDED
@@ -0,0 +1,7 @@
1
+ export * from './app'
2
+ export * from './components/GUIComponent'
3
+ export * from './components/NodeComp'
4
+ export * from './components/RenderComponent'
5
+ export * from './core/Size'
6
+ export * from './systems/GUISystem'
7
+ export * from './systems/RenderSystem'
@@ -0,0 +1,80 @@
1
+ import { Button, ScrollBox } from '@pixi/ui'
2
+ import { GameWorld } from '@safe-engine/core'
3
+ import {
4
+ EventManager,
5
+ EventTypes,
6
+ System
7
+ } from 'entityx-ts'
8
+ import { Sprite, Text } from 'pixi.js'
9
+ import { CallFunc, EaseBackIn, ScaleTo, Sequence } from 'pixi-action-ease'
10
+
11
+ import { NodeComp, SpriteRender } from '..'
12
+ import { ButtonComp, LabelComp, ProgressBarComp, ProgressTimerComp, ScrollView } from '../components/GUIComponent'
13
+ import { LoadingBar, LoadingBarMode, ProgressTimer } from '../core/LoadingBar'
14
+
15
+ export class GUISystem implements System {
16
+ configure(event_manager: EventManager<GameWorld>) {
17
+ event_manager.subscribe(EventTypes.ComponentAdded, ButtonComp, ({ entity, component }) => {
18
+ const nodeComp = entity.getComponent(NodeComp)
19
+ // const { normalImage, selectedImage, disableImage, texType, zoomScale } = button
20
+ const node = new Button(nodeComp.instance)
21
+ // node.setZoomScale(zoomScale - 1)
22
+ component.node = nodeComp
23
+ // component.node = entity.assign(new NodeComp(node, entity))
24
+ node.onPress.connect(() => {
25
+ // console.log('onPress.connect')
26
+ const scale = ScaleTo.create(0.12, 1.2)
27
+ const scaleDown = ScaleTo.create(0.12, 1)
28
+ const seq = Sequence.create(
29
+ scale,
30
+ CallFunc.create(() => {
31
+ if (Object.prototype.hasOwnProperty.call(component, 'onPress')) {
32
+ component.onPress(component)
33
+ }
34
+ }),
35
+ scaleDown,
36
+ )
37
+ const ease = EaseBackIn.create(seq)
38
+ component.node.runAction(ease)
39
+ })
40
+ })
41
+ event_manager.subscribe(EventTypes.ComponentAdded, ProgressBarComp, ({ entity, component }) => {
42
+ const spriteComp = entity.getComponent(SpriteRender)
43
+ if (!spriteComp) throw Error('ProgressBarComp need SpriteRender')
44
+ const { progress, mode } = component
45
+ const node = new LoadingBar(mode, spriteComp.node.instance as Sprite)
46
+ spriteComp.node.instance.mask = node
47
+ component.node = entity.assign(new NodeComp(node, entity))
48
+ node.progress = progress
49
+ })
50
+ event_manager.subscribe(EventTypes.ComponentAdded, ProgressTimerComp, ({ entity, component }) => {
51
+ // console.log(component, '.progress')
52
+ const { spriteFrame, fillCenter } = component
53
+ const node = new ProgressTimer(LoadingBarMode.BAR, spriteFrame)
54
+ if (fillCenter) {
55
+ node.fillCenter = fillCenter
56
+ }
57
+ component.node = entity.assign(new NodeComp(node, entity))
58
+ })
59
+ event_manager.subscribe(EventTypes.ComponentAdded, ScrollView, ({ entity, component }) => {
60
+ const { width, height } = component
61
+ const view = new ScrollBox({ width, height })
62
+ component.node = entity.assign(new NodeComp(view, entity))
63
+ })
64
+ event_manager.subscribe(EventTypes.ComponentAdded, LabelComp, ({ entity, component }) => {
65
+ // console.log('ComponentAddedEvent LabelComp', component)
66
+ const node = new Text()
67
+ // node.texture.rotate = 8
68
+ node.style.fill = '#fff'
69
+ component.node = entity.assign(new NodeComp(node, entity))
70
+ const { string = '', font = '', size } = component
71
+ if (font) component.setFont(font)
72
+ component.setSize(size)
73
+ component.setString(string)
74
+ })
75
+ // event_manager.subscribe(EventTypes.ComponentAdded, BlockInputEventsComp), this);
76
+ }
77
+ // update() {
78
+ // throw new Error('Method not implemented.');
79
+ // }
80
+ }
@@ -0,0 +1,70 @@
1
+ import {
2
+ EventManager,
3
+ EventTypes,
4
+ System
5
+ } from 'entityx-ts'
6
+ import { Container, Graphics, Sprite } from 'pixi.js'
7
+
8
+ import { NodeComp } from '..'
9
+ import { GraphicsRender, MaskRender, NodeRender, SpriteRender } from '../components/RenderComponent'
10
+ import { LoadingBar } from '../core/LoadingBar'
11
+
12
+ export enum SpriteTypes {
13
+ SIMPLE,
14
+ SLICED,
15
+ TILED,
16
+ FILLED,
17
+ MESH,
18
+ ANIMATION,
19
+ }
20
+
21
+ export class RenderSystem implements System {
22
+ configure(event_manager: EventManager) {
23
+ event_manager.subscribe(EventTypes.ComponentAdded, NodeRender, ({ entity }) => {
24
+ const nodeRenderComp = entity.getComponent(NodeRender)
25
+ const node = new Container()
26
+ nodeRenderComp.node = entity.assign(new NodeComp(node, entity))
27
+ })
28
+ event_manager.subscribe(EventTypes.ComponentAdded, SpriteRender, ({ entity, component }) => {
29
+ const { spriteFrame, type, fillType, fillRange, fillCenter } = component
30
+ // console.log('SpriteRender', component)
31
+ const node = Sprite.from(spriteFrame)
32
+ if (type === SpriteTypes.FILLED) {
33
+ // console.log('fillType', fillType)
34
+ const loadingBar = new LoadingBar(fillType, node)
35
+ if (fillRange) loadingBar.progress = fillRange
36
+ if (fillCenter) loadingBar.fillCenter = fillCenter
37
+ component.loadingBar = loadingBar
38
+ // node.setMidpoint(fillCenter)
39
+ }
40
+ // node.texture.rotate = 8
41
+ component.node = entity.assign(new NodeComp(node, entity))
42
+ // component.node.anchorX = 0.5
43
+ // component.node.anchorY = 0.5
44
+ })
45
+ event_manager.subscribe(EventTypes.ComponentAdded, MaskRender, ({ component }) => {
46
+ console.log('MaskRender', component);
47
+ // const { type, segments, inverted } = maskComp
48
+ // const node = new cc.ClippingNode()
49
+ // node.setInverted(inverted)
50
+ // maskComp.node = ett.assign(new NodeComp(node, ett))
51
+ })
52
+ event_manager.subscribe(EventTypes.ComponentAdded, GraphicsRender, ({ entity, component }) => {
53
+ const { lineWidth, strokeColor, fillColor } = component
54
+ const node = new Graphics()
55
+ node.beginFill(fillColor)
56
+ node.lineStyle(lineWidth, strokeColor)
57
+ component.node = entity.assign(new NodeComp(node, entity))
58
+ // node.drawCircle(0, 0, 100)
59
+ })
60
+ event_manager.subscribe(EventTypes.ComponentRemoved, NodeComp, ({ component }) => {
61
+ if (component) {
62
+ component.instance.removeFromParent()
63
+ }
64
+ })
65
+ }
66
+
67
+ // update() {
68
+ // throw new Error('Method not implemented.');
69
+ // }
70
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,24 @@
1
+ {
2
+ "compilerOptions": {
3
+ "lib": [
4
+ "es2017",
5
+ "dom"
6
+ ],
7
+ "outDir": "dist",
8
+ "target": "ES6",
9
+ "declaration": true,
10
+ "declarationMap": true,
11
+ "skipLibCheck": true,
12
+ "esModuleInterop": true,
13
+ "allowSyntheticDefaultImports": true,
14
+ "strict": false,
15
+ "forceConsistentCasingInFileNames": true,
16
+ "module": "CommonJS",
17
+ "moduleResolution": "node",
18
+ "resolveJsonModule": true,
19
+ "isolatedModules": true,
20
+ "experimentalDecorators": true,
21
+ "emitDecoratorMetadata": true,
22
+ "noEmit": false
23
+ }
24
+ }