@operato/board 1.1.36 → 1.1.38

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@operato/board",
3
- "version": "1.1.36",
3
+ "version": "1.1.38",
4
4
  "description": "Webcomponent for board following open-wc recommendations",
5
5
  "author": "heartyoh",
6
6
  "main": "dist/src/index.js",
@@ -87,17 +87,17 @@
87
87
  },
88
88
  "dependencies": {
89
89
  "@open-wc/scoped-elements": "^2.0.0-next.6",
90
- "@operato/app": "^1.1.36",
91
- "@operato/data-grist": "^1.1.36",
92
- "@operato/font": "^1.1.36",
90
+ "@operato/app": "^1.1.37",
91
+ "@operato/data-grist": "^1.1.37",
92
+ "@operato/font": "^1.1.37",
93
93
  "@operato/graphql": "^1.1.13",
94
94
  "@operato/i18n": "^1.1.13",
95
- "@operato/input": "^1.1.36",
95
+ "@operato/input": "^1.1.37",
96
96
  "@operato/markdown": "^1.1.28",
97
97
  "@operato/popup": "^1.1.28",
98
- "@operato/property-editor": "^1.1.36",
98
+ "@operato/property-editor": "^1.1.37",
99
99
  "@operato/styles": "^1.1.28",
100
- "@operato/utils": "^1.1.15",
100
+ "@operato/utils": "^1.1.37",
101
101
  "@polymer/paper-dropdown-menu": "^3.2.0",
102
102
  "@types/file-saver": "^2.0.4",
103
103
  "@types/sortablejs": "^1.10.7",
@@ -146,5 +146,5 @@
146
146
  "prettier --write"
147
147
  ]
148
148
  },
149
- "gitHead": "115403ba66873bd4b8e59644095930653c49206b"
149
+ "gitHead": "58cc13eb2ebd26572d68a3fd0518dde66d72bb6c"
150
150
  }
@@ -97,12 +97,14 @@ export class BoardViewer extends LitElement {
97
97
  @property({ type: Boolean, reflect: true, attribute: 'hide-navigation' }) hideNavigation = false
98
98
 
99
99
  @state() _scene: any = null
100
- @state() _forward: Array<any> = []
101
- @state() _backward: Array<any> = []
100
+ @state() _forward: { id: string; scene: any }[] = []
101
+ @state() _backward: { id: string; scene: any }[] = []
102
102
 
103
103
  @state() _oldtarget?: HTMLElement
104
104
  @state() _fade_animations?: Array<Animation>
105
105
 
106
+ public currentBoardId?: string = this.board?.id
107
+
106
108
  @query('#target') _target!: HTMLElement
107
109
  @query('#prev') _prev!: HTMLElement
108
110
  @query('#next') _next!: HTMLElement
@@ -207,7 +209,7 @@ export class BoardViewer extends LitElement {
207
209
  if (!this.board || !this.board.id) return
208
210
 
209
211
  this._scene = await this.provider!.get(this.board.id, true)
210
- this.setupScene(this._scene)
212
+ this.setupScene({ id: this.board.id, scene: this._scene })
211
213
  }
212
214
 
213
215
  initScene() {
@@ -229,7 +231,7 @@ export class BoardViewer extends LitElement {
229
231
 
230
232
  this.provider!.add(this.board.id, this._scene)
231
233
 
232
- this.setupScene(this._scene)
234
+ this.setupScene({ id: this.board.id, scene: this._scene })
233
235
  }
234
236
 
235
237
  closeScene() {
@@ -243,10 +245,10 @@ export class BoardViewer extends LitElement {
243
245
  }
244
246
 
245
247
  // delete queued scenes
246
- this._forward.forEach(scene => scene.release && scene.release())
248
+ this._forward.forEach(({ scene }) => scene.release && scene.release())
247
249
  this._forward = []
248
250
 
249
- this._backward.forEach(scene => scene.release && scene.release())
251
+ this._backward.forEach(({ scene }) => scene.release && scene.release())
250
252
  this._backward = []
251
253
  }
252
254
 
@@ -255,7 +257,7 @@ export class BoardViewer extends LitElement {
255
257
  this.transientShowButtons()
256
258
  }
257
259
 
258
- setupScene(scene: any) {
260
+ setupScene({ id, scene }: { id: string; scene: any }) {
259
261
  this._scene = scene
260
262
 
261
263
  const backgroundColor = this._scene?.root.state.fillStyle
@@ -274,6 +276,7 @@ export class BoardViewer extends LitElement {
274
276
  if (this.data) {
275
277
  this._scene.data = this.data
276
278
  }
279
+ this.currentBoardId = id
277
280
 
278
281
  this.bindSceneEvents()
279
282
 
@@ -296,17 +299,17 @@ export class BoardViewer extends LitElement {
296
299
  this.unbindSceneEvents(this._scene)
297
300
  /* 원래의 target에 되돌린다. */
298
301
  this._scene.target = this._oldtarget
299
- this._backward.push(this._scene)
302
+ this._backward.push({ id: this.currentBoardId!, scene: this._scene })
300
303
  }
301
304
 
302
305
  this._scene = scene
303
306
 
304
- this._forward.forEach(scene => scene.release && scene.release())
307
+ this._forward.forEach(({ scene }) => scene.release && scene.release())
305
308
 
306
309
  /* forward를 비운다. */
307
310
  this._forward = []
308
311
 
309
- this.setupScene(scene)
312
+ this.setupScene({ id: boardId, scene })
310
313
 
311
314
  if (bindingData) {
312
315
  scene.data = bindingData
@@ -317,6 +320,7 @@ export class BoardViewer extends LitElement {
317
320
  }
318
321
 
319
322
  bindSceneEvents() {
323
+ this._scene.on('run', this.onRunBoard, this)
320
324
  this._scene.on('goto', this.onLinkGoto, this)
321
325
  this._scene.on('link-open', this.onLinkOpen, this)
322
326
  this._scene.on('link-move', this.onLinkMove, this)
@@ -326,6 +330,7 @@ export class BoardViewer extends LitElement {
326
330
  }
327
331
 
328
332
  unbindSceneEvents(scene: any) {
333
+ scene.off('run', this.onRunBoard, this)
329
334
  scene.off('goto', this.onLinkGoto, this)
330
335
  scene.off('link-open', this.onLinkOpen, this)
331
336
  scene.off('link-move', this.onLinkMove, this)
@@ -381,7 +386,7 @@ export class BoardViewer extends LitElement {
381
386
  /* event handlers */
382
387
 
383
388
  onTapNext() {
384
- var scene = this._forward.pop()
389
+ var { id, scene } = this._forward.pop() || {}
385
390
  if (!scene) return
386
391
 
387
392
  if (this._scene) {
@@ -389,14 +394,14 @@ export class BoardViewer extends LitElement {
389
394
  /* 원래의 target에 되돌린다. */
390
395
  this._scene.target = this._oldtarget
391
396
  this.unbindSceneEvents(this._scene)
392
- this._backward.push(this._scene)
397
+ this._backward.push({ id: id!, scene: this._scene })
393
398
  }
394
399
 
395
- this.setupScene(scene)
400
+ this.setupScene({ id: id!, scene })
396
401
  }
397
402
 
398
403
  onTapPrev() {
399
- var scene = this._backward.pop()
404
+ var { id, scene } = this._backward.pop() || {}
400
405
  if (!scene) return
401
406
 
402
407
  if (this._scene) {
@@ -404,10 +409,10 @@ export class BoardViewer extends LitElement {
404
409
  /* 원래의 target에 되돌린다. */
405
410
  this._scene.target = this._oldtarget
406
411
  this.unbindSceneEvents(this._scene)
407
- this._forward.push(this._scene)
412
+ this._forward.push({ id: id!, scene: this._scene })
408
413
  }
409
414
 
410
- this.setupScene(scene)
415
+ this.setupScene({ id: id!, scene })
411
416
  }
412
417
 
413
418
  onTapFullscreen() {
@@ -418,6 +423,10 @@ export class BoardViewer extends LitElement {
418
423
  )
419
424
  }
420
425
 
426
+ onRunBoard() {
427
+ this.dispatchEvent(new CustomEvent('run-board', { bubbles: true, composed: true, detail: this.board.id }))
428
+ }
429
+
421
430
  onLinkGoto(targetBoardId: string, options: any, fromComponent: any) {
422
431
  const { input, output } = options || { input: '(self)' }
423
432
  const data = input && fromComponent.root.findFirst(input, fromComponent)?.data
@@ -194,7 +194,6 @@ export class BoardSelector extends InfiniteScrollable(localize(i18next)(LitEleme
194
194
  `
195
195
  }
196
196
 
197
- //@ts-ignore
198
197
  get scrollTargetEl(): HTMLElement | null {
199
198
  return this.renderRoot.querySelector('#main') as HTMLElement
200
199
  }