@operato/board 0.3.8 → 0.3.9

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 CHANGED
@@ -3,6 +3,15 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ### [0.3.9](https://github.com/hatiolab/operato/compare/v0.3.8...v0.3.9) (2022-01-15)
7
+
8
+
9
+ ### :bug: Bug Fix
10
+
11
+ * move @operato/board/utils to @operato/utils ([06ba865](https://github.com/hatiolab/operato/commit/06ba865ac70bd65166fd20b6d23cc5241d9fca17))
12
+
13
+
14
+
6
15
  ### [0.3.8](https://github.com/hatiolab/operato/compare/v0.3.7...v0.3.8) (2022-01-14)
7
16
 
8
17
  **Note:** Version bump only for package @operato/board
@@ -3185,221 +3185,6 @@
3185
3185
  }
3186
3186
  ]
3187
3187
  },
3188
- {
3189
- "kind": "javascript-module",
3190
- "path": "src/utils/fullscreen.ts",
3191
- "declarations": [
3192
- {
3193
- "kind": "function",
3194
- "name": "fullscreen",
3195
- "parameters": [
3196
- {
3197
- "name": "element",
3198
- "type": {
3199
- "text": "HTMLElement"
3200
- },
3201
- "description": "대상 엘리먼트"
3202
- },
3203
- {
3204
- "name": "afterfull",
3205
- "optional": true,
3206
- "type": {
3207
- "text": "FullscreenCallback"
3208
- },
3209
- "description": "풀스크린이 된 이후에 호출되는 콜백함수"
3210
- },
3211
- {
3212
- "name": "afterfinish",
3213
- "optional": true,
3214
- "type": {
3215
- "text": "FullscreenCallback"
3216
- },
3217
- "description": "풀스크린이 해제된 이후에 호출되는 콜백함수"
3218
- }
3219
- ],
3220
- "description": "엘리먼트를 풀스크린으로 표시되도록 한다."
3221
- },
3222
- {
3223
- "kind": "function",
3224
- "name": "exitfullscreen"
3225
- },
3226
- {
3227
- "kind": "function",
3228
- "name": "togglefullscreen",
3229
- "parameters": [
3230
- {
3231
- "name": "element",
3232
- "type": {
3233
- "text": "HTMLElement"
3234
- }
3235
- },
3236
- {
3237
- "name": "afterfull",
3238
- "optional": true,
3239
- "type": {
3240
- "text": "FullscreenCallback"
3241
- }
3242
- },
3243
- {
3244
- "name": "afterfinish",
3245
- "optional": true,
3246
- "type": {
3247
- "text": "FullscreenCallback"
3248
- }
3249
- }
3250
- ]
3251
- }
3252
- ],
3253
- "exports": [
3254
- {
3255
- "kind": "js",
3256
- "name": "fullscreen",
3257
- "declaration": {
3258
- "name": "fullscreen",
3259
- "module": "src/utils/fullscreen.ts"
3260
- }
3261
- },
3262
- {
3263
- "kind": "js",
3264
- "name": "exitfullscreen",
3265
- "declaration": {
3266
- "name": "exitfullscreen",
3267
- "module": "src/utils/fullscreen.ts"
3268
- }
3269
- },
3270
- {
3271
- "kind": "js",
3272
- "name": "togglefullscreen",
3273
- "declaration": {
3274
- "name": "togglefullscreen",
3275
- "module": "src/utils/fullscreen.ts"
3276
- }
3277
- }
3278
- ]
3279
- },
3280
- {
3281
- "kind": "javascript-module",
3282
- "path": "src/utils/os.ts",
3283
- "declarations": [
3284
- {
3285
- "kind": "function",
3286
- "name": "getOS",
3287
- "description": "method to get operating system of running browser",
3288
- "return": {
3289
- "type": {
3290
- "text": "string"
3291
- }
3292
- }
3293
- },
3294
- {
3295
- "kind": "function",
3296
- "name": "isMobileDevice",
3297
- "description": "method to tell if platform of running browser is kind of mobile device",
3298
- "return": {
3299
- "type": {
3300
- "text": "boolean"
3301
- }
3302
- }
3303
- },
3304
- {
3305
- "kind": "function",
3306
- "name": "isIOS",
3307
- "description": "method to tell if operating system of running browser is iOS",
3308
- "return": {
3309
- "type": {
3310
- "text": "boolean"
3311
- }
3312
- }
3313
- },
3314
- {
3315
- "kind": "function",
3316
- "name": "isMacOS",
3317
- "description": "method to tell if operating system of running browser is MacOS",
3318
- "return": {
3319
- "type": {
3320
- "text": "boolean"
3321
- }
3322
- }
3323
- }
3324
- ],
3325
- "exports": [
3326
- {
3327
- "kind": "js",
3328
- "name": "getOS",
3329
- "declaration": {
3330
- "name": "getOS",
3331
- "module": "src/utils/os.ts"
3332
- }
3333
- },
3334
- {
3335
- "kind": "js",
3336
- "name": "isMobileDevice",
3337
- "declaration": {
3338
- "name": "isMobileDevice",
3339
- "module": "src/utils/os.ts"
3340
- }
3341
- },
3342
- {
3343
- "kind": "js",
3344
- "name": "isIOS",
3345
- "declaration": {
3346
- "name": "isIOS",
3347
- "module": "src/utils/os.ts"
3348
- }
3349
- },
3350
- {
3351
- "kind": "js",
3352
- "name": "isMacOS",
3353
- "declaration": {
3354
- "name": "isMacOS",
3355
- "module": "src/utils/os.ts"
3356
- }
3357
- }
3358
- ]
3359
- },
3360
- {
3361
- "kind": "javascript-module",
3362
- "path": "src/utils/swipe-listener.ts",
3363
- "declarations": [
3364
- {
3365
- "kind": "function",
3366
- "name": "SwipeListener",
3367
- "parameters": [
3368
- {
3369
- "name": "element",
3370
- "type": {
3371
- "text": "DOMElement"
3372
- },
3373
- "description": "Element on which to listen for swipe gestures."
3374
- },
3375
- {
3376
- "name": "options",
3377
- "optional": true,
3378
- "type": {
3379
- "text": "Object"
3380
- },
3381
- "description": "Optional: Options."
3382
- }
3383
- ],
3384
- "description": "Starts monitoring swipes on the given element and\nemits `swipe` event when a swipe gesture is performed.",
3385
- "return": {
3386
- "type": {
3387
- "text": "Object"
3388
- }
3389
- }
3390
- }
3391
- ],
3392
- "exports": [
3393
- {
3394
- "kind": "js",
3395
- "name": "SwipeListener",
3396
- "declaration": {
3397
- "name": "SwipeListener",
3398
- "module": "src/utils/swipe-listener.ts"
3399
- }
3400
- }
3401
- ]
3402
- },
3403
3188
  {
3404
3189
  "kind": "javascript-module",
3405
3190
  "path": "src/modeller/component-toolbar/component-detail.ts",
@@ -11,7 +11,7 @@ import { css, html, LitElement } from 'lit';
11
11
  import { customElement, property, query } from 'lit/decorators.js';
12
12
  import { SCENE_MODE } from '@hatiolab/things-scene';
13
13
  import { OxPopup } from '@operato/popup';
14
- import { togglefullscreen } from './utils/fullscreen';
14
+ import { togglefullscreen } from '@operato/utils';
15
15
  const isMacOS = navigator.userAgent.indexOf('Mac') != -1;
16
16
  const ICON_PROPERTIES = new URL('../../icons/icon-properties.png', import.meta.url).href;
17
17
  const ICON_PROPERTIES_LINE_TYPE = new URL('../../icons/icon-properties-line-type.png', import.meta.url).href;
@@ -1 +1 @@
1
- {"version":3,"file":"ox-board-modeller.js","sourceRoot":"","sources":["../../src/ox-board-modeller.ts"],"names":[],"mappings":";AAAA,OAAO,mBAAmB,CAAA;AAC1B,OAAO,yCAAyC,CAAA;AAChD,OAAO,gDAAgD,CAAA;AACvD,OAAO,8CAA8C,CAAA;AACrD,OAAO,yBAAyB,CAAA;AAChC,OAAO,wBAAwB,CAAA;AAC/B,OAAO,mBAAmB,CAAA;AAE1B,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AACnC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAElE,OAAO,EAAS,UAAU,EAAE,MAAM,wBAAwB,CAAA;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AAIxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAErD,MAAM,OAAO,GAAG,SAAS,CAAC,SAAS,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAA;AAExD,MAAM,eAAe,GAAG,IAAI,GAAG,CAAC,iCAAiC,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAA;AACxF,MAAM,yBAAyB,GAAG,IAAI,GAAG,CAAC,2CAA2C,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAA;AAC5G,MAAM,0BAA0B,GAAG,IAAI,GAAG,CAAC,4CAA4C,EAAE,MAAM,C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;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4CAAkB;AACjB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8CAAqB;AACrB;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;+CAAqB;AACnB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;2CAAmC;AAClC;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;+CAAqB;AACnB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;mDAA8B;AAC9B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8CAAqB;AACpB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4CAAc;AACd;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;yDAA+B;AAC9B;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;4CAAkB;AACjB;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;qDAA2B;AAE9B;IAAtB,KAAK,CAAC,cAAc,CAAC;kDAAkC;AA5H7C,aAAa;IADzB,aAAa,CAAC,mBAAmB,CAAC;GACtB,aAAa,CA2UzB;SA3UY,aAAa","sourcesContent":["import '@material/mwc-fab'\nimport './modeller/scene-viewer/ox-scene-viewer'\nimport './modeller/component-toolbar/component-toolbar'\nimport './modeller/property-sidebar/property-sidebar'\nimport './modeller/edit-toolbar'\nimport '@hatiolab/things-scene'\nimport './ox-board-viewer'\n\nimport { saveAs } from 'file-saver'\nimport { css, html, LitElement } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\n\nimport { Scene, SCENE_MODE } from '@hatiolab/things-scene'\nimport { OxPopup } from '@operato/popup'\n\nimport { EditToolbar } from './modeller/edit-toolbar'\nimport { ComponentGroup, ComponentTemplate } from './types'\nimport { togglefullscreen } from './utils/fullscreen'\n\nconst isMacOS = navigator.userAgent.indexOf('Mac') != -1\n\nconst ICON_PROPERTIES = new URL('../../icons/icon-properties.png', import.meta.url).href\nconst ICON_PROPERTIES_LINE_TYPE = new URL('../../icons/icon-properties-line-type.png', import.meta.url).href\nconst ICON_PROPERTIES_ARROW_TYPE = new URL('../../icons/icon-properties-arrow-type.png', import.meta.url).href\nconst ICON_PROPERTIES_LABEL = new URL('../../icons/icon-properties-label.png', import.meta.url).href\nconst ICON_PROPERTIES_PADDING = new URL('../../icons/icon-properties-padding.png', import.meta.url).href\n\nconst ICON_HTOOLBAR = new URL('../../icons/icon-htoolbar.png', import.meta.url).href\nconst ICON_FULLSCREEN = new URL('../../icons/icon-fullscreen.png', import.meta.url).href\nconst ICON_COLLAPSE = new URL('../../icons/icon-collapse.png', import.meta.url).href\nconst ICON_COLLAPSE_ACTIVE = new URL('../../icons/icon-collapse-active.png', import.meta.url).href\n\nconst ICON_SHELL_INSPECTOR = new URL('../../icons/icon-shell-inspector.png', import.meta.url).href\n\nvar Registry: ComponentGroup[] = []\n\n@customElement('ox-board-modeller')\nexport class BoardModeller extends LitElement {\n static styles = [\n css`\n :host {\n display: grid;\n\n grid-template-rows: auto 1fr;\n grid-template-columns: auto 1fr auto;\n grid-template-areas: 'toolbar toolbar toolbar' 'palletbar scene propertybar';\n grid-gap: 0;\n\n height: 100%;\n overflow: hidden;\n }\n\n #toolbar {\n grid-area: toolbar;\n }\n\n edit-toolbar {\n grid-area: toolbar;\n }\n\n component-toolbar {\n grid-area: palletbar;\n }\n\n property-sidebar {\n grid-area: propertybar;\n overflow: hidden;\n }\n\n #scene-wrap {\n grid-area: scene;\n position: relative;\n\n display: flex;\n flex-direction: row;\n }\n\n ox-scene-viewer {\n flex: 1;\n width: 100%;\n height: 100%;\n }\n\n mwc-fab {\n position: absolute;\n right: 15px;\n bottom: 15px;\n }\n\n ox-popup {\n width: 90%;\n height: 90%;\n left: 50%;\n top: 50%;\n transform: translateX(-50%) translateY(-50%);\n background: var(--secondary-color, black);\n\n display: flex;\n justify-content: center;\n flex-direction: column;\n }\n\n ox-board-viewer {\n width: 98%;\n height: 98%;\n margin: auto;\n padding: 0;\n }\n `\n ]\n\n static registerGroup(group: ComponentGroup) {\n var found = Registry.find(inRegisterGroup => inRegisterGroup.name == group.name)\n\n if (found) {\n found = {\n ...found,\n ...group\n }\n } else {\n Registry.push(group)\n }\n }\n\n static registerTemplate(templates: ComponentTemplate[]): void {\n templates &&\n templates.forEach(template => {\n var group = Registry.find(group => group.name == template.group)\n\n if (!group) {\n console.warn('Invalid group', group, template)\n return\n }\n\n if (!group.templates.find(inGroupTemplate => inGroupTemplate.type == template.type)) {\n group.templates.push(template)\n }\n })\n }\n\n static get groups(): ComponentGroup[] {\n return Registry\n }\n\n static getGroup(name: string) {\n return Registry.find(group => group.name === name)\n }\n\n @property({ type: String }) boardName: string = ''\n @property({ type: Object }) model: any = null\n @property({ type: String }) baseUrl: string = ''\n @property({ type: Array }) selected: any[] = []\n @property({ type: Number }) mode: SCENE_MODE = SCENE_MODE.EDIT\n @property({ type: Object }) provider: any = null\n @property({ type: Boolean }) hideProperty: boolean = false\n @property({ type: String }) overlay: string = ''\n @property({ type: Object }) scene?: Scene\n @property({ type: Array }) componentGroupList: any[] = []\n @property({ type: Array }) fonts: any[] = []\n @property({ type: Array }) propertyEditor: any[] = []\n\n @query('edit-toolbar') private editToolbar!: EditToolbar\n\n private group: string = ''\n private shortcutHandler?: (e: KeyboardEvent) => void\n\n constructor() {\n super()\n\n document.addEventListener('get-all-scene-component-ids', (e: Event) => {\n var { component, callback } = (e as CustomEvent).detail\n\n if (!this.scene) return\n\n var ids\n if (component) {\n ids = this.scene.findAll(component).map(c => c.model.id)\n } else {\n // @ts-ignore\n ids = this.scene.ids.map(({ key }) => key)\n }\n\n ids = ids.filter(id => !!id).sort()\n callback(ids)\n })\n\n this.style.setProperty('--url-icon-properties', `url(${ICON_PROPERTIES})`)\n this.style.setProperty('--url-icon-properties-label', `url(${ICON_PROPERTIES_LABEL})`)\n this.style.setProperty('--url-icon-properties-padding', `url(${ICON_PROPERTIES_PADDING})`)\n this.style.setProperty('--url-icon-properties-line-type', `url(${ICON_PROPERTIES_LINE_TYPE})`)\n this.style.setProperty('--url-icon-properties-arrow-type', `url(${ICON_PROPERTIES_ARROW_TYPE})`)\n\n this.style.setProperty('--url-icon-htoolbar', `url(${ICON_HTOOLBAR})`)\n this.style.setProperty('--url-icon-fullscreen', `url(${ICON_FULLSCREEN})`)\n this.style.setProperty('--url-icon-collapse', `url(${ICON_COLLAPSE})`)\n this.style.setProperty('--url-icon-collapse-active', `url(${ICON_COLLAPSE_ACTIVE})`)\n\n this.style.setProperty('--url-icon-shell-inspector', `url(${ICON_SHELL_INSPECTOR})`)\n }\n\n render() {\n return html`\n <edit-toolbar\n id=\"edittoolbar\"\n .scene=${this.scene}\n .selected=${this.selected}\n @hide-property-changed=${(e: CustomEvent) => (this.hideProperty = e.detail.value)}\n @open-preview=${() => this.preview()}\n @download-model=${() => this.downloadModel()}\n @modeller-fullscreen=${() => togglefullscreen(this)}\n >\n ${this.renderBrandingZone()}\n </edit-toolbar>\n\n <component-toolbar\n .scene=${this.scene}\n .mode=${this.mode}\n @mode-changed=${(e: CustomEvent) => {\n this.mode = e.detail.value\n }}\n .componentGroupList=${this.componentGroupList}\n .group=${this.group}\n >\n </component-toolbar>\n\n <div id=\"scene-wrap\">\n <ox-scene-viewer\n id=\"scene\"\n .scene=${this.scene}\n @scene-changed=${(e: CustomEvent) => {\n this.scene = e.detail.value\n }}\n .model=${this.model}\n .selected=${this.selected}\n @selected-changed=${(e: CustomEvent) => {\n this.selected = e.detail.value\n }}\n .mode=${this.mode}\n @mode-changed=${(e: CustomEvent) => {\n this.mode = e.detail.value\n }}\n fit=\"ratio\"\n .baseUrl=${this.baseUrl}\n @contextmenu=${() => this.onContextMenu()}\n .provider=${this.provider}\n name=\"modeller\"\n >\n <ox-scene-layer type=\"selection-layer\"></ox-scene-layer>\n <ox-scene-layer type=\"modeling-layer\"></ox-scene-layer>\n <ox-scene-layer type=\"guide-layer\">\n <ox-scene-property name=\"ruler\" value=\"disabled\"></ox-scene-property>\n </ox-scene-layer>\n <ox-scene-layer type=\"shift-layer\">\n <ox-scene-property name=\"text\" value=\"${this.overlay}\"></ox-scene-property>\n <ox-scene-property name=\"alpha\" value=\"0.3\"></ox-scene-property>\n <ox-scene-property name=\"fontFamily\" value=\"arial\"></ox-scene-property>\n <ox-scene-property name=\"fontSize\" value=\"30\" type=\"number\"></ox-scene-property>\n <ox-scene-property name=\"fontColor\" value=\"navy\"></ox-scene-property>\n <ox-scene-property name=\"textBaseline\" value=\"top\"></ox-scene-property>\n <ox-scene-property name=\"textAlign\" value=\"left\"></ox-scene-property>\n <ox-scene-property name=\"paddingTop\" value=\"50\" type=\"number\"></ox-scene-property>\n <ox-scene-property name=\"paddingLeft\" value=\"50\" type=\"number\"></ox-scene-property>\n </ox-scene-layer>\n <ox-scene-layer type=\"tag-layer\"></ox-scene-layer>\n <ox-scene-handler type=\"text-editor\"></ox-scene-handler>\n <ox-scene-handler type=\"move-handler\"></ox-scene-handler>\n </ox-scene-viewer>\n\n <mwc-fab icon=\"save\" @click=${() => this.onTapSave()} title=\"save\"> </mwc-fab>\n </div>\n\n <property-sidebar\n .scene=${this.scene}\n .selected=${this.selected}\n .collapsed=${this.hideProperty}\n .fonts=${this.fonts}\n .propertyEditor=${this.propertyEditor}\n >\n </property-sidebar>\n `\n }\n\n connectedCallback(): void {\n super.connectedCallback()\n this.bindShortcutEvent()\n }\n\n disconnectedCallback(): void {\n super.disconnectedCallback()\n this.unbindShortcutEvent()\n }\n\n close() {\n this.model = null\n this.requestUpdate()\n }\n\n onShortcut(e: KeyboardEvent) {\n if (isMacOS) var ctrlKey = e.metaKey\n else var ctrlKey = e.ctrlKey\n\n switch (e.code) {\n case 'KeyS':\n if (ctrlKey) {\n this.onTapSave()\n e.preventDefault()\n }\n break\n }\n }\n\n preview() {\n const board = {\n id: 'preview',\n model: this.scene?.model ? JSON.parse(JSON.stringify(this.scene.model)) : null\n }\n\n OxPopup.open({\n template: html` <ox-board-viewer .provider=${this.provider} .board=${board}></ox-board-viewer> `,\n parent: this.renderRoot as Element\n })\n\n requestAnimationFrame(() => {\n dispatchEvent(new Event('resize'))\n })\n }\n\n downloadModel() {\n if (!this.scene) return\n\n var model = JSON.stringify(this.model, null, 2)\n var filename = (this.boardName || 'NONAME') + '-' + Date.now() + '.json'\n saveAs(new Blob([model], { type: 'application/octet-stream' }), filename)\n }\n\n renderBrandingZone() {\n return html``\n }\n\n onTapSave() {\n this.dispatchEvent(new CustomEvent('save-model', { bubbles: true, composed: true, detail: { model: this.model } }))\n }\n\n bindShortcutEvent() {\n // TODO: Global Hotkey에 대한 정의를 edit-toolbar에서 가져올 수 있도록 수정해야 함.\n const GLOBAL_HOTKEYS = ['Digit1', 'Digit2', 'F11', 'KeyD', 'KeyP', 'KeyS']\n\n this.shortcutHandler = (e: KeyboardEvent) => {\n const target = e.composedPath()[0] as HTMLElement\n var tagName = target.tagName\n var isInput = target.isContentEditable || tagName == 'INPUT' || tagName == 'SELECT' || tagName == 'TEXTAREA'\n var isGlobalHotkey = GLOBAL_HOTKEYS.includes(e.code)\n\n if (!isGlobalHotkey && isInput) return\n if (!this.editToolbar.onShortcut(e)) this.onShortcut(e)\n }\n\n document.addEventListener('keydown', this.shortcutHandler)\n }\n\n unbindShortcutEvent() {\n if (this.shortcutHandler) {\n document.removeEventListener('keydown', this.shortcutHandler)\n delete this.shortcutHandler\n }\n }\n\n onContextMenu() {}\n}\n"]}
1
+ {"version":3,"file":"ox-board-modeller.js","sourceRoot":"","sources":["../../src/ox-board-modeller.ts"],"names":[],"mappings":";AAAA,OAAO,mBAAmB,CAAA;AAC1B,OAAO,yCAAyC,CAAA;AAChD,OAAO,gDAAgD,CAAA;AACvD,OAAO,8CAA8C,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AE,CAAC;mDAA8B;AAC9B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8CAAqB;AACpB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4CAAc;AACd;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;yDAA+B;AAC9B;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;4CAAkB;AACjB;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;qDAA2B;AAE9B;IAAtB,KAAK,CAAC,cAAc,CAAC;kDAAkC;AA5H7C,aAAa;IADzB,aAAa,CAAC,mBAAmB,CAAC;GACtB,aAAa,CA2UzB;SA3UY,aAAa","sourcesContent":["import '@material/mwc-fab'\nimport './modeller/scene-viewer/ox-scene-viewer'\nimport './modeller/component-toolbar/component-toolbar'\nimport './modeller/property-sidebar/property-sidebar'\nimport './modeller/edit-toolbar'\nimport '@hatiolab/things-scene'\nimport './ox-board-viewer'\n\nimport { saveAs } from 'file-saver'\nimport { css, html, LitElement } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\n\nimport { Scene, SCENE_MODE } from '@hatiolab/things-scene'\nimport { OxPopup } from '@operato/popup'\nimport { togglefullscreen } from '@operato/utils'\n\nimport { EditToolbar } from './modeller/edit-toolbar'\nimport { ComponentGroup, ComponentTemplate } from './types'\n\nconst isMacOS = navigator.userAgent.indexOf('Mac') != -1\n\nconst ICON_PROPERTIES = new URL('../../icons/icon-properties.png', import.meta.url).href\nconst ICON_PROPERTIES_LINE_TYPE = new URL('../../icons/icon-properties-line-type.png', import.meta.url).href\nconst ICON_PROPERTIES_ARROW_TYPE = new URL('../../icons/icon-properties-arrow-type.png', import.meta.url).href\nconst ICON_PROPERTIES_LABEL = new URL('../../icons/icon-properties-label.png', import.meta.url).href\nconst ICON_PROPERTIES_PADDING = new URL('../../icons/icon-properties-padding.png', import.meta.url).href\n\nconst ICON_HTOOLBAR = new URL('../../icons/icon-htoolbar.png', import.meta.url).href\nconst ICON_FULLSCREEN = new URL('../../icons/icon-fullscreen.png', import.meta.url).href\nconst ICON_COLLAPSE = new URL('../../icons/icon-collapse.png', import.meta.url).href\nconst ICON_COLLAPSE_ACTIVE = new URL('../../icons/icon-collapse-active.png', import.meta.url).href\n\nconst ICON_SHELL_INSPECTOR = new URL('../../icons/icon-shell-inspector.png', import.meta.url).href\n\nvar Registry: ComponentGroup[] = []\n\n@customElement('ox-board-modeller')\nexport class BoardModeller extends LitElement {\n static styles = [\n css`\n :host {\n display: grid;\n\n grid-template-rows: auto 1fr;\n grid-template-columns: auto 1fr auto;\n grid-template-areas: 'toolbar toolbar toolbar' 'palletbar scene propertybar';\n grid-gap: 0;\n\n height: 100%;\n overflow: hidden;\n }\n\n #toolbar {\n grid-area: toolbar;\n }\n\n edit-toolbar {\n grid-area: toolbar;\n }\n\n component-toolbar {\n grid-area: palletbar;\n }\n\n property-sidebar {\n grid-area: propertybar;\n overflow: hidden;\n }\n\n #scene-wrap {\n grid-area: scene;\n position: relative;\n\n display: flex;\n flex-direction: row;\n }\n\n ox-scene-viewer {\n flex: 1;\n width: 100%;\n height: 100%;\n }\n\n mwc-fab {\n position: absolute;\n right: 15px;\n bottom: 15px;\n }\n\n ox-popup {\n width: 90%;\n height: 90%;\n left: 50%;\n top: 50%;\n transform: translateX(-50%) translateY(-50%);\n background: var(--secondary-color, black);\n\n display: flex;\n justify-content: center;\n flex-direction: column;\n }\n\n ox-board-viewer {\n width: 98%;\n height: 98%;\n margin: auto;\n padding: 0;\n }\n `\n ]\n\n static registerGroup(group: ComponentGroup) {\n var found = Registry.find(inRegisterGroup => inRegisterGroup.name == group.name)\n\n if (found) {\n found = {\n ...found,\n ...group\n }\n } else {\n Registry.push(group)\n }\n }\n\n static registerTemplate(templates: ComponentTemplate[]): void {\n templates &&\n templates.forEach(template => {\n var group = Registry.find(group => group.name == template.group)\n\n if (!group) {\n console.warn('Invalid group', group, template)\n return\n }\n\n if (!group.templates.find(inGroupTemplate => inGroupTemplate.type == template.type)) {\n group.templates.push(template)\n }\n })\n }\n\n static get groups(): ComponentGroup[] {\n return Registry\n }\n\n static getGroup(name: string) {\n return Registry.find(group => group.name === name)\n }\n\n @property({ type: String }) boardName: string = ''\n @property({ type: Object }) model: any = null\n @property({ type: String }) baseUrl: string = ''\n @property({ type: Array }) selected: any[] = []\n @property({ type: Number }) mode: SCENE_MODE = SCENE_MODE.EDIT\n @property({ type: Object }) provider: any = null\n @property({ type: Boolean }) hideProperty: boolean = false\n @property({ type: String }) overlay: string = ''\n @property({ type: Object }) scene?: Scene\n @property({ type: Array }) componentGroupList: any[] = []\n @property({ type: Array }) fonts: any[] = []\n @property({ type: Array }) propertyEditor: any[] = []\n\n @query('edit-toolbar') private editToolbar!: EditToolbar\n\n private group: string = ''\n private shortcutHandler?: (e: KeyboardEvent) => void\n\n constructor() {\n super()\n\n document.addEventListener('get-all-scene-component-ids', (e: Event) => {\n var { component, callback } = (e as CustomEvent).detail\n\n if (!this.scene) return\n\n var ids\n if (component) {\n ids = this.scene.findAll(component).map(c => c.model.id)\n } else {\n // @ts-ignore\n ids = this.scene.ids.map(({ key }) => key)\n }\n\n ids = ids.filter(id => !!id).sort()\n callback(ids)\n })\n\n this.style.setProperty('--url-icon-properties', `url(${ICON_PROPERTIES})`)\n this.style.setProperty('--url-icon-properties-label', `url(${ICON_PROPERTIES_LABEL})`)\n this.style.setProperty('--url-icon-properties-padding', `url(${ICON_PROPERTIES_PADDING})`)\n this.style.setProperty('--url-icon-properties-line-type', `url(${ICON_PROPERTIES_LINE_TYPE})`)\n this.style.setProperty('--url-icon-properties-arrow-type', `url(${ICON_PROPERTIES_ARROW_TYPE})`)\n\n this.style.setProperty('--url-icon-htoolbar', `url(${ICON_HTOOLBAR})`)\n this.style.setProperty('--url-icon-fullscreen', `url(${ICON_FULLSCREEN})`)\n this.style.setProperty('--url-icon-collapse', `url(${ICON_COLLAPSE})`)\n this.style.setProperty('--url-icon-collapse-active', `url(${ICON_COLLAPSE_ACTIVE})`)\n\n this.style.setProperty('--url-icon-shell-inspector', `url(${ICON_SHELL_INSPECTOR})`)\n }\n\n render() {\n return html`\n <edit-toolbar\n id=\"edittoolbar\"\n .scene=${this.scene}\n .selected=${this.selected}\n @hide-property-changed=${(e: CustomEvent) => (this.hideProperty = e.detail.value)}\n @open-preview=${() => this.preview()}\n @download-model=${() => this.downloadModel()}\n @modeller-fullscreen=${() => togglefullscreen(this)}\n >\n ${this.renderBrandingZone()}\n </edit-toolbar>\n\n <component-toolbar\n .scene=${this.scene}\n .mode=${this.mode}\n @mode-changed=${(e: CustomEvent) => {\n this.mode = e.detail.value\n }}\n .componentGroupList=${this.componentGroupList}\n .group=${this.group}\n >\n </component-toolbar>\n\n <div id=\"scene-wrap\">\n <ox-scene-viewer\n id=\"scene\"\n .scene=${this.scene}\n @scene-changed=${(e: CustomEvent) => {\n this.scene = e.detail.value\n }}\n .model=${this.model}\n .selected=${this.selected}\n @selected-changed=${(e: CustomEvent) => {\n this.selected = e.detail.value\n }}\n .mode=${this.mode}\n @mode-changed=${(e: CustomEvent) => {\n this.mode = e.detail.value\n }}\n fit=\"ratio\"\n .baseUrl=${this.baseUrl}\n @contextmenu=${() => this.onContextMenu()}\n .provider=${this.provider}\n name=\"modeller\"\n >\n <ox-scene-layer type=\"selection-layer\"></ox-scene-layer>\n <ox-scene-layer type=\"modeling-layer\"></ox-scene-layer>\n <ox-scene-layer type=\"guide-layer\">\n <ox-scene-property name=\"ruler\" value=\"disabled\"></ox-scene-property>\n </ox-scene-layer>\n <ox-scene-layer type=\"shift-layer\">\n <ox-scene-property name=\"text\" value=\"${this.overlay}\"></ox-scene-property>\n <ox-scene-property name=\"alpha\" value=\"0.3\"></ox-scene-property>\n <ox-scene-property name=\"fontFamily\" value=\"arial\"></ox-scene-property>\n <ox-scene-property name=\"fontSize\" value=\"30\" type=\"number\"></ox-scene-property>\n <ox-scene-property name=\"fontColor\" value=\"navy\"></ox-scene-property>\n <ox-scene-property name=\"textBaseline\" value=\"top\"></ox-scene-property>\n <ox-scene-property name=\"textAlign\" value=\"left\"></ox-scene-property>\n <ox-scene-property name=\"paddingTop\" value=\"50\" type=\"number\"></ox-scene-property>\n <ox-scene-property name=\"paddingLeft\" value=\"50\" type=\"number\"></ox-scene-property>\n </ox-scene-layer>\n <ox-scene-layer type=\"tag-layer\"></ox-scene-layer>\n <ox-scene-handler type=\"text-editor\"></ox-scene-handler>\n <ox-scene-handler type=\"move-handler\"></ox-scene-handler>\n </ox-scene-viewer>\n\n <mwc-fab icon=\"save\" @click=${() => this.onTapSave()} title=\"save\"> </mwc-fab>\n </div>\n\n <property-sidebar\n .scene=${this.scene}\n .selected=${this.selected}\n .collapsed=${this.hideProperty}\n .fonts=${this.fonts}\n .propertyEditor=${this.propertyEditor}\n >\n </property-sidebar>\n `\n }\n\n connectedCallback(): void {\n super.connectedCallback()\n this.bindShortcutEvent()\n }\n\n disconnectedCallback(): void {\n super.disconnectedCallback()\n this.unbindShortcutEvent()\n }\n\n close() {\n this.model = null\n this.requestUpdate()\n }\n\n onShortcut(e: KeyboardEvent) {\n if (isMacOS) var ctrlKey = e.metaKey\n else var ctrlKey = e.ctrlKey\n\n switch (e.code) {\n case 'KeyS':\n if (ctrlKey) {\n this.onTapSave()\n e.preventDefault()\n }\n break\n }\n }\n\n preview() {\n const board = {\n id: 'preview',\n model: this.scene?.model ? JSON.parse(JSON.stringify(this.scene.model)) : null\n }\n\n OxPopup.open({\n template: html` <ox-board-viewer .provider=${this.provider} .board=${board}></ox-board-viewer> `,\n parent: this.renderRoot as Element\n })\n\n requestAnimationFrame(() => {\n dispatchEvent(new Event('resize'))\n })\n }\n\n downloadModel() {\n if (!this.scene) return\n\n var model = JSON.stringify(this.model, null, 2)\n var filename = (this.boardName || 'NONAME') + '-' + Date.now() + '.json'\n saveAs(new Blob([model], { type: 'application/octet-stream' }), filename)\n }\n\n renderBrandingZone() {\n return html``\n }\n\n onTapSave() {\n this.dispatchEvent(new CustomEvent('save-model', { bubbles: true, composed: true, detail: { model: this.model } }))\n }\n\n bindShortcutEvent() {\n // TODO: Global Hotkey에 대한 정의를 edit-toolbar에서 가져올 수 있도록 수정해야 함.\n const GLOBAL_HOTKEYS = ['Digit1', 'Digit2', 'F11', 'KeyD', 'KeyP', 'KeyS']\n\n this.shortcutHandler = (e: KeyboardEvent) => {\n const target = e.composedPath()[0] as HTMLElement\n var tagName = target.tagName\n var isInput = target.isContentEditable || tagName == 'INPUT' || tagName == 'SELECT' || tagName == 'TEXTAREA'\n var isGlobalHotkey = GLOBAL_HOTKEYS.includes(e.code)\n\n if (!isGlobalHotkey && isInput) return\n if (!this.editToolbar.onShortcut(e)) this.onShortcut(e)\n }\n\n document.addEventListener('keydown', this.shortcutHandler)\n }\n\n unbindShortcutEvent() {\n if (this.shortcutHandler) {\n document.removeEventListener('keydown', this.shortcutHandler)\n delete this.shortcutHandler\n }\n }\n\n onContextMenu() {}\n}\n"]}
@@ -3,10 +3,9 @@ import '@material/mwc-fab';
3
3
  import '@material/mwc-icon';
4
4
  import './player/ox-board-wrapper';
5
5
  import './player/ox-board-player-carousel';
6
- import { LitElement, html } from 'lit';
6
+ import { html, LitElement } from 'lit';
7
7
  import { customElement, property, query, state } from 'lit/decorators.js';
8
- import { exitfullscreen, togglefullscreen } from './utils/fullscreen';
9
- import { SwipeListener } from './utils/swipe-listener';
8
+ import { exitfullscreen, SwipeListener, togglefullscreen } from '@operato/utils';
10
9
  import { style } from './ox-board-player-style';
11
10
  let BoardPlayer = class BoardPlayer extends LitElement {
12
11
  constructor() {
@@ -1 +1 @@
1
- {"version":3,"file":"ox-board-player.js","sourceRoot":"","sources":["../../src/ox-board-player.ts"],"names":[],"mappings":";AAAA,OAAO,mBAAmB,CAAA;AAC1B,OAAO,oBAAoB,CAAA;AAC3B,OAAO,2BAA2B,CAAA;AAClC,OAAO,mCAAmC,CAAA;AAE1C,OA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A;QACjD,IAAI,CAAC,OAAO,GAAG,KAAK,CAAA;QAEpB;;;WAGG;QACH,MAAM,IAAI,CAAC,cAAc,CAAA;IAC3B,CAAC;CACF,CAAA;AArRQ,kBAAM,GAAG,KAAK,CAAA;AAEM;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;2CAAwB;AACtB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;6CAAc;AACb;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4CAAY;AACX;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;yCAAS;AACP;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;4CAAgB;AACf;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;4CAAgB;AAChB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;6CAAc;AAEhC;IAAR,KAAK,EAAE;sDAA8B;AAC7B;IAAR,KAAK,EAAE;mDAAqB;AACpB;IAAR,KAAK,EAAE;mDAAqB;AACpB;IAAR,KAAK,EAAE;kDAAsB;AAEX;IAAlB,KAAK,CAAC,UAAU,CAAC;6CAAuB;AAhB9B,WAAW;IADvB,aAAa,CAAC,iBAAiB,CAAC;GACpB,WAAW,CAsRvB;SAtRY,WAAW","sourcesContent":["import '@material/mwc-fab'\nimport '@material/mwc-icon'\nimport './player/ox-board-wrapper'\nimport './player/ox-board-player-carousel'\n\nimport { LitElement, PropertyValues, html } from 'lit'\nimport { customElement, property, query, state } from 'lit/decorators.js'\nimport { exitfullscreen, togglefullscreen } from './utils/fullscreen'\n\nimport { SwipeListener } from './utils/swipe-listener'\nimport { style } from './ox-board-player-style'\n\n@customElement('ox-board-player')\nexport class BoardPlayer extends LitElement {\n static styles = style\n\n @property({ type: Array }) boards: Array<any> = []\n @property({ type: Number }) playtime = 30\n @property({ type: Number }) columns = 1\n @property({ type: Number }) rows = 1\n @property({ type: Boolean }) started = false\n @property({ type: Boolean }) playing = false\n @property({ type: Object }) provider: any\n\n @state() _controlAnimation?: Animation\n @state() _transferTimer?: any\n @state() _currentPlayer?: any\n @state() _fullscreened = false\n\n @query('#control') _control!: HTMLElement\n\n render() {\n return html`\n <slot @mousemove=${() => this.onMousemove()} @transform=${() => this.onTransform()} tabindex=\"-1\">\n ${this.started\n ? html`\n <ox-board-player-carousel axis=\"y\" .rows=${this.rows} .columns=${this.columns} player>\n ${this.boards.map(\n item =>\n html` <ox-board-wrapper page .sceneId=${item.id} .provider=${this.provider}> </ox-board-wrapper> `\n )}\n </ox-board-player-carousel>\n `\n : html``}\n </slot>\n\n <div id=\"control\" @mouseover=${() => this.onMouseoverControl()} hidden>\n <div id=\"joystick\">\n <mwc-icon id=\"up\" @click=${() => this.moveUp()}>keyboard_arrow_up</mwc-icon>\n <mwc-icon id=\"left\" @click=${() => this.moveLeft()}>keyboard_arrow_left</mwc-icon>\n <mwc-icon id=\"play\" @click=${() => this.play()} ?hidden=${this.playing}>play_arrow</mwc-icon>\n <mwc-icon id=\"pause\" @click=${() => this.pause()} ?hidden=${!this.playing}>pause</mwc-icon>\n <mwc-icon id=\"right\" @click=${() => this.moveRight()}>keyboard_arrow_right</mwc-icon>\n <mwc-icon id=\"down\" @click=${() => this.moveDown()}>keyboard_arrow_down</mwc-icon>\n </div>\n\n <div id=\"setting-container\">\n <div id=\"setting\">\n <label id=\"schedule-container\">\n <mwc-icon id=\"schedule\">schedule</mwc-icon>\n <input\n .value=${this.playtime}\n @change=${(e: Event) => (this.playtime = Number((e.target as HTMLInputElement).value))}\n />\n sec.\n </label>\n <div id=\"grid-setting-container\">\n <mwc-icon id=\"view_module\">view_module</mwc-icon>\n <select\n .value=${this.rows}\n @change=${(e: Event) => (this.rows = Number((e.target as HTMLInputElement).value))}\n >\n ${[1, 2, 3, 4, 5].map(row => html` <option>${row}</option> `)}\n </select>\n x\n <select\n .value=${this.columns}\n @change=${(e: Event) => (this.columns = Number((e.target as HTMLInputElement).value))}\n >\n ${[1, 2, 3, 4, 5].map(column => html` <option>${column}</option> `)}\n </select>\n </div>\n </div>\n\n <div id=\"etc\">\n <mwc-icon id=\"fullscreen\" @click=${() => this.onTapFullscreen()} ?hidden=${this._fullscreened}\n >fullscreen</mwc-icon\n >\n <mwc-icon id=\"fullscreen-exit\" @click=${() => this.onTapFullscreen()} ?hidden=${!this._fullscreened}\n >fullscreen_exit</mwc-icon\n >\n <mwc-icon id=\"close\" @click=${() => this.onTapClose()}>close</mwc-icon>\n </div>\n </div>\n </div>\n `\n }\n\n firstUpdated() {\n SwipeListener(this)\n\n this.addEventListener('swipe', (e: Event) => {\n var directions = (e as any).detail.directions\n\n if (directions.left) {\n this.moveRight()\n } else if (directions.right) {\n this.moveLeft()\n } else if (directions.top) {\n this.moveDown()\n } else if (directions.bottom) {\n this.moveUp()\n }\n })\n\n this.setAttribute('tabindex', '0')\n this.addEventListener('keydown', (e: KeyboardEvent) => {\n switch (e.key) {\n case 'Right': // for IE/Edge\n case 'ArrowRight':\n e.stopPropagation()\n this.moveRight()\n break\n\n case 'Left': // for IE/Edge\n case 'ArrowLeft':\n e.stopPropagation()\n this.moveLeft()\n break\n\n case 'Up': // for IE/Edge\n case 'ArrowUp':\n e.stopPropagation()\n this.moveUp()\n break\n\n case 'Down': // for IE/Edge\n case 'ArrowDown':\n e.stopPropagation()\n this.moveDown()\n break\n }\n })\n\n this.focus()\n }\n\n updated(changes: PropertyValues<this>) {\n if (changes.has('boards') || changes.has('columns') || changes.has('rows')) {\n this.boards && this.boards.length > 0 ? this.restart() : this.stop()\n } else if (changes.has('playtime') && this.playing) {\n this._resetTransformTimer()\n }\n }\n\n async _resetFadeTimer(stop?: boolean) {\n if (!this._controlAnimation) {\n this._controlAnimation = this._control.animate(\n [\n {\n opacity: 1,\n easing: 'ease-in'\n },\n { opacity: 0 }\n ],\n { delay: 1000, duration: 2000 }\n )\n }\n\n this._control.hidden = false\n\n this._controlAnimation.cancel()\n if (stop) return\n\n try {\n this._controlAnimation.play()\n await this._controlAnimation.finished\n this._control.hidden = true\n } catch (e) {\n /* cancelled */\n }\n }\n\n _resetTransformTimer() {\n clearTimeout(this._transferTimer)\n\n this.playing = true\n\n if (this._currentPlayer) {\n this._transferTimer = setTimeout(() => {\n if (this._transferTimer) this._currentPlayer.next()\n }, this.playtime * 1000)\n }\n }\n\n onMousemove() {\n this._resetFadeTimer()\n }\n\n onMouseoverControl() {\n this._resetFadeTimer(true)\n }\n\n onTapFullscreen() {\n togglefullscreen(\n this,\n () => {\n this._fullscreened = true\n this.focus()\n },\n () => {\n this._fullscreened = false\n this.focus()\n }\n )\n }\n\n onTransform() {\n requestAnimationFrame(() => this.started && this.playing && this._resetTransformTimer())\n }\n\n play() {\n this._resetTransformTimer()\n }\n\n pause() {\n clearTimeout(this._transferTimer)\n this.playing = false\n }\n\n moveLeft() {\n this._currentPlayer.axis = 'y'\n this._currentPlayer.previous()\n }\n\n moveRight() {\n this._currentPlayer.axis = 'y'\n this._currentPlayer.next()\n }\n\n moveUp() {\n this._currentPlayer.axis = 'x'\n this._currentPlayer.next()\n }\n\n moveDown() {\n this._currentPlayer.axis = 'x'\n this._currentPlayer.previous()\n }\n\n onTapClose() {\n if (this._fullscreened) {\n exitfullscreen()\n }\n\n window.history.back()\n }\n\n async restart() {\n await this.stop()\n await this.start()\n }\n\n async start() {\n if (!this.boards || this.boards.length == 0) return\n\n this.started = true\n this.playing = true\n\n await this.updateComplete\n\n this._currentPlayer = this.renderRoot.querySelector(':not([style*=\"display: none\"])[player]')\n\n this._resetTransformTimer()\n this._resetFadeTimer()\n\n this.focus()\n }\n\n async stop() {\n clearTimeout(this._transferTimer)\n\n this._currentPlayer && this._currentPlayer.stop()\n this.started = false\n\n /**\n * this.started = false 로 인한 update를 강제하기 위함임.\n * this.start() 가 바로 호출되어 this.started 의 변화가 render에 반영되지 않을 수 있으므로.\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tB,IAAI,CAAC,KAAK,EAAE,CAAA;IACd,CAAC;IAED,KAAK,CAAC,IAAI;QACR,YAAY,CAAC,IAAI,CAAC,cAAc,CAAC,CAAA;QAEjC,IAAI,CAAC,cAAc,IAAI,IAAI,CAAC,cAAc,CAAC,IAAI,EAAE,CAAA;QACjD,IAAI,CAAC,OAAO,GAAG,KAAK,CAAA;QAEpB;;;WAGG;QACH,MAAM,IAAI,CAAC,cAAc,CAAA;IAC3B,CAAC;CACF,CAAA;AArRQ,kBAAM,GAAG,KAAK,CAAA;AAEM;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;2CAAwB;AACtB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;6CAAc;AACb;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4CAAY;AACX;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;yCAAS;AACP;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;4CAAgB;AACf;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;4CAAgB;AAChB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;6CAAc;AAEhC;IAAR,KAAK,EAAE;sDAA8B;AAC7B;IAAR,KAAK,EAAE;mDAAqB;AACpB;IAAR,KAAK,EAAE;mDAAqB;AACpB;IAAR,KAAK,EAAE;kDAAsB;AAEX;IAAlB,KAAK,CAAC,UAAU,CAAC;6CAAuB;AAhB9B,WAAW;IADvB,aAAa,CAAC,iBAAiB,CAAC;GACpB,WAAW,CAsRvB;SAtRY,WAAW","sourcesContent":["import '@material/mwc-fab'\nimport '@material/mwc-icon'\nimport './player/ox-board-wrapper'\nimport './player/ox-board-player-carousel'\n\nimport { html, LitElement, PropertyValues } from 'lit'\nimport { customElement, property, query, state } from 'lit/decorators.js'\n\nimport { exitfullscreen, SwipeListener, togglefullscreen } from '@operato/utils'\n\nimport { style } from './ox-board-player-style'\n\n@customElement('ox-board-player')\nexport class BoardPlayer extends LitElement {\n static styles = style\n\n @property({ type: Array }) boards: Array<any> = []\n @property({ type: Number }) playtime = 30\n @property({ type: Number }) columns = 1\n @property({ type: Number }) rows = 1\n @property({ type: Boolean }) started = false\n @property({ type: Boolean }) playing = false\n @property({ type: Object }) provider: any\n\n @state() _controlAnimation?: Animation\n @state() _transferTimer?: any\n @state() _currentPlayer?: any\n @state() _fullscreened = false\n\n @query('#control') _control!: HTMLElement\n\n render() {\n return html`\n <slot @mousemove=${() => this.onMousemove()} @transform=${() => this.onTransform()} tabindex=\"-1\">\n ${this.started\n ? html`\n <ox-board-player-carousel axis=\"y\" .rows=${this.rows} .columns=${this.columns} player>\n ${this.boards.map(\n item =>\n html` <ox-board-wrapper page .sceneId=${item.id} .provider=${this.provider}> </ox-board-wrapper> `\n )}\n </ox-board-player-carousel>\n `\n : html``}\n </slot>\n\n <div id=\"control\" @mouseover=${() => this.onMouseoverControl()} hidden>\n <div id=\"joystick\">\n <mwc-icon id=\"up\" @click=${() => this.moveUp()}>keyboard_arrow_up</mwc-icon>\n <mwc-icon id=\"left\" @click=${() => this.moveLeft()}>keyboard_arrow_left</mwc-icon>\n <mwc-icon id=\"play\" @click=${() => this.play()} ?hidden=${this.playing}>play_arrow</mwc-icon>\n <mwc-icon id=\"pause\" @click=${() => this.pause()} ?hidden=${!this.playing}>pause</mwc-icon>\n <mwc-icon id=\"right\" @click=${() => this.moveRight()}>keyboard_arrow_right</mwc-icon>\n <mwc-icon id=\"down\" @click=${() => this.moveDown()}>keyboard_arrow_down</mwc-icon>\n </div>\n\n <div id=\"setting-container\">\n <div id=\"setting\">\n <label id=\"schedule-container\">\n <mwc-icon id=\"schedule\">schedule</mwc-icon>\n <input\n .value=${this.playtime}\n @change=${(e: Event) => (this.playtime = Number((e.target as HTMLInputElement).value))}\n />\n sec.\n </label>\n <div id=\"grid-setting-container\">\n <mwc-icon id=\"view_module\">view_module</mwc-icon>\n <select\n .value=${this.rows}\n @change=${(e: Event) => (this.rows = Number((e.target as HTMLInputElement).value))}\n >\n ${[1, 2, 3, 4, 5].map(row => html` <option>${row}</option> `)}\n </select>\n x\n <select\n .value=${this.columns}\n @change=${(e: Event) => (this.columns = Number((e.target as HTMLInputElement).value))}\n >\n ${[1, 2, 3, 4, 5].map(column => html` <option>${column}</option> `)}\n </select>\n </div>\n </div>\n\n <div id=\"etc\">\n <mwc-icon id=\"fullscreen\" @click=${() => this.onTapFullscreen()} ?hidden=${this._fullscreened}\n >fullscreen</mwc-icon\n >\n <mwc-icon id=\"fullscreen-exit\" @click=${() => this.onTapFullscreen()} ?hidden=${!this._fullscreened}\n >fullscreen_exit</mwc-icon\n >\n <mwc-icon id=\"close\" @click=${() => this.onTapClose()}>close</mwc-icon>\n </div>\n </div>\n </div>\n `\n }\n\n firstUpdated() {\n SwipeListener(this)\n\n this.addEventListener('swipe', (e: Event) => {\n var directions = (e as any).detail.directions\n\n if (directions.left) {\n this.moveRight()\n } else if (directions.right) {\n this.moveLeft()\n } else if (directions.top) {\n this.moveDown()\n } else if (directions.bottom) {\n this.moveUp()\n }\n })\n\n this.setAttribute('tabindex', '0')\n this.addEventListener('keydown', (e: KeyboardEvent) => {\n switch (e.key) {\n case 'Right': // for IE/Edge\n case 'ArrowRight':\n e.stopPropagation()\n this.moveRight()\n break\n\n case 'Left': // for IE/Edge\n case 'ArrowLeft':\n e.stopPropagation()\n this.moveLeft()\n break\n\n case 'Up': // for IE/Edge\n case 'ArrowUp':\n e.stopPropagation()\n this.moveUp()\n break\n\n case 'Down': // for IE/Edge\n case 'ArrowDown':\n e.stopPropagation()\n this.moveDown()\n break\n }\n })\n\n this.focus()\n }\n\n updated(changes: PropertyValues<this>) {\n if (changes.has('boards') || changes.has('columns') || changes.has('rows')) {\n this.boards && this.boards.length > 0 ? this.restart() : this.stop()\n } else if (changes.has('playtime') && this.playing) {\n this._resetTransformTimer()\n }\n }\n\n async _resetFadeTimer(stop?: boolean) {\n if (!this._controlAnimation) {\n this._controlAnimation = this._control.animate(\n [\n {\n opacity: 1,\n easing: 'ease-in'\n },\n { opacity: 0 }\n ],\n { delay: 1000, duration: 2000 }\n )\n }\n\n this._control.hidden = false\n\n this._controlAnimation.cancel()\n if (stop) return\n\n try {\n this._controlAnimation.play()\n await this._controlAnimation.finished\n this._control.hidden = true\n } catch (e) {\n /* cancelled */\n }\n }\n\n _resetTransformTimer() {\n clearTimeout(this._transferTimer)\n\n this.playing = true\n\n if (this._currentPlayer) {\n this._transferTimer = setTimeout(() => {\n if (this._transferTimer) this._currentPlayer.next()\n }, this.playtime * 1000)\n }\n }\n\n onMousemove() {\n this._resetFadeTimer()\n }\n\n onMouseoverControl() {\n this._resetFadeTimer(true)\n }\n\n onTapFullscreen() {\n togglefullscreen(\n this,\n () => {\n this._fullscreened = true\n this.focus()\n },\n () => {\n this._fullscreened = false\n this.focus()\n }\n )\n }\n\n onTransform() {\n requestAnimationFrame(() => this.started && this.playing && this._resetTransformTimer())\n }\n\n play() {\n this._resetTransformTimer()\n }\n\n pause() {\n clearTimeout(this._transferTimer)\n this.playing = false\n }\n\n moveLeft() {\n this._currentPlayer.axis = 'y'\n this._currentPlayer.previous()\n }\n\n moveRight() {\n this._currentPlayer.axis = 'y'\n this._currentPlayer.next()\n }\n\n moveUp() {\n this._currentPlayer.axis = 'x'\n this._currentPlayer.next()\n }\n\n moveDown() {\n this._currentPlayer.axis = 'x'\n this._currentPlayer.previous()\n }\n\n onTapClose() {\n if (this._fullscreened) {\n exitfullscreen()\n }\n\n window.history.back()\n }\n\n async restart() {\n await this.stop()\n await this.start()\n }\n\n async start() {\n if (!this.boards || this.boards.length == 0) return\n\n this.started = true\n this.playing = true\n\n await this.updateComplete\n\n this._currentPlayer = this.renderRoot.querySelector(':not([style*=\"display: none\"])[player]')\n\n this._resetTransformTimer()\n this._resetFadeTimer()\n\n this.focus()\n }\n\n async stop() {\n clearTimeout(this._transferTimer)\n\n this._currentPlayer && this._currentPlayer.stop()\n this.started = false\n\n /**\n * this.started = false 로 인한 update를 강제하기 위함임.\n * this.start() 가 바로 호출되어 this.started 의 변화가 render에 반영되지 않을 수 있으므로.\n */\n await this.updateComplete\n }\n}\n"]}
@@ -1,11 +1,10 @@
1
1
  import { __decorate } from "tslib";
2
2
  import '@material/mwc-fab';
3
3
  import '@material/mwc-icon';
4
- import { LitElement, css, html } from 'lit';
5
- import { SCENE_MODE, create } from '@hatiolab/things-scene';
4
+ import { css, html, LitElement } from 'lit';
6
5
  import { customElement, property, query, state } from 'lit/decorators.js';
7
- import { isIOS } from './utils/os';
8
- import { togglefullscreen } from './utils/fullscreen';
6
+ import { create, SCENE_MODE } from '@hatiolab/things-scene';
7
+ import { isIOS, togglefullscreen } from '@operato/utils';
9
8
  let BoardViewer = class BoardViewer extends LitElement {
10
9
  constructor() {
11
10
  super(...arguments);
@@ -1 +1 @@
1
- {"version":3,"file":"ox-board-viewer.js","sourceRoot":"","sources":["../../src/ox-board-viewer.ts"],"names":[],"mappings":";AAAA,OAAO,mBAAmB,CAAA;AAC1B,OAAO,oBAAoB,CAAA;AAE3B,OAAO,EAAE,UAAU,EAAkB,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAA;AAC3D,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAEzE,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAClC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAGrD,IAAa,WAAW,GAAxB,MAAa,WAAY,SAAQ,UAAU;IAA3C;;QAuF8B,YAAO,GAAW,EAAE,CAAA;QACpB,UAAK,GAAQ,EAAE,CAAA;QACf,aAAQ,GAAQ,IAAI,CAAA;QAG0B,m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;GAoFlB,CAAA;AAE2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4CAAqB;AACpB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;0CAAgB;AACf;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;6CAAqB;AACpB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;yCAAU;AAEqC;IAAzE,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,iBAAiB,EAAE,CAAC;mDAAuB;AACtB;IAAzE,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,iBAAiB,EAAE,CAAC;mDAAuB;AAEvF;IAAR,KAAK,EAAE;2CAAmB;AAClB;IAAR,KAAK,EAAE;6CAA0B;AACzB;IAAR,KAAK,EAAE;8CAA2B;AAE1B;IAAR,KAAK,EAAE;+CAAyB;AACxB;IAAR,KAAK,EAAE;qDAAoC;AAE1B;IAAjB,KAAK,CAAC,SAAS,CAAC;4CAAsB;AACvB;IAAf,KAAK,CAAC,OAAO,CAAC;0CAAoB;AACnB;IAAf,KAAK,CAAC,OAAO,CAAC;0CAAoB;AACb;IAArB,KAAK,CAAC,aAAa,CAAC;gDAA0B;AAzGpC,WAAW;IADvB,aAAa,CAAC,iBAAiB,CAAC;GACpB,WAAW,CAqfvB;SArfY,WAAW","sourcesContent":["import '@material/mwc-fab'\nimport '@material/mwc-icon'\n\nimport { LitElement, PropertyValues, css, html } from 'lit'\nimport { SCENE_MODE, create } from '@hatiolab/things-scene'\nimport { customElement, property, query, state } from 'lit/decorators.js'\n\nimport { isIOS } from './utils/os'\nimport { togglefullscreen } from './utils/fullscreen'\n\n@customElement('ox-board-viewer')\nexport class BoardViewer extends LitElement {\n static styles = css`\n :host {\n display: flex;\n flex-direction: column;\n\n position: relative;\n\n width: 100%; /* 전체화면보기를 위해서 필요함. */\n overflow: hidden;\n }\n\n #target {\n flex: 1;\n\n width: 100%; /* 전체화면보기를 위해서 필요함. */\n height: 100%;\n\n outline: 0;\n }\n\n /* navigation buttons */\n mwc-icon {\n z-index: 10;\n position: absolute;\n top: 45%;\n min-width: 50px;\n width: 50px;\n height: 50px;\n margin: 0;\n padding: 0;\n color: #fff;\n user-select: none;\n\n --mdc-icon-size: 3em;\n }\n\n mwc-icon[hidden] {\n display: none;\n }\n\n mwc-icon:hover {\n background-color: rgba(0, 0, 0, 0.2);\n border-radius: 50%;\n }\n\n #prev {\n left: 5px;\n }\n\n #next {\n right: 5px;\n }\n\n #fullscreen {\n position: absolute;\n bottom: 15px;\n right: 16px;\n }\n\n /* for scroller */\n ::-webkit-scrollbar {\n width: 5px;\n height: 5px;\n }\n ::-webkit-scrollbar-track {\n background-color: transparent;\n }\n ::-webkit-scrollbar-thumb {\n background-color: rgba(0, 0, 0, 0.2);\n }\n ::-webkit-scrollbar-thumb:hover {\n background-color: #aa866a;\n }\n\n [hidden] {\n display: none;\n }\n\n @media print {\n mwc-fab,\n mwc-icon {\n display: none;\n }\n }\n `\n\n @property({ type: String }) baseUrl: string = ''\n @property({ type: Object }) board: any = {}\n @property({ type: Object }) provider: any = null\n @property({ type: Object }) data: any\n\n @property({ type: Boolean, reflect: true, attribute: 'hide-fullscreen' }) hideFullscreen = false\n @property({ type: Boolean, reflect: true, attribute: 'hide-navigation' }) hideNavigation = false\n\n @state() _scene: any = null\n @state() _forward: Array<any> = []\n @state() _backward: Array<any> = []\n\n @state() _oldtarget?: HTMLElement\n @state() _fade_animations?: Array<Animation>\n\n @query('#target') _target!: HTMLElement\n @query('#prev') _prev!: HTMLElement\n @query('#next') _next!: HTMLElement\n @query('#fullscreen') _fullscreen!: HTMLElement\n\n render() {\n var fullscreen =\n !isIOS() && !this.hideFullscreen\n ? html`\n <mwc-fab\n id=\"fullscreen\"\n .icon=${document.fullscreenElement ? 'fullscreen_exit' : 'fullscreen'}\n @click=${(e: Event) => this.onTapFullscreen()}\n @mouseover=${(e: Event) => this.transientShowButtons(true)}\n @mouseout=${(e: Event) => this.transientShowButtons()}\n title=\"fullscreen\"\n ></mwc-fab>\n `\n : html``\n\n var prev = !this.hideNavigation\n ? html`\n <mwc-icon\n id=\"prev\"\n @click=${(e: Event) => this.onTapPrev()}\n @mouseover=${(e: Event) => this.transientShowButtons(true)}\n @mouseout=${(e: Event) => this.transientShowButtons()}\n hidden\n >keyboard_arrow_left</mwc-icon\n >\n `\n : html``\n\n var next = !this.hideNavigation\n ? html`\n <mwc-icon\n id=\"next\"\n @click=${(e: Event) => this.onTapNext()}\n @mouseover=${(e: Event) => this.transientShowButtons(true)}\n @mouseout=${(e: Event) => this.transientShowButtons()}\n hidden\n >keyboard_arrow_right</mwc-icon\n >\n `\n : html``\n\n return html`\n ${prev}\n\n <div\n id=\"target\"\n @touchstart=${(e: Event) => this.transientShowButtons()}\n @mousemove=${(e: Event) => this.transientShowButtons()}\n ></div>\n\n ${next} ${fullscreen}\n `\n }\n\n connectedCallback() {\n super.connectedCallback()\n\n window.addEventListener('resize', () => {\n this._scene && this._scene.fit()\n })\n\n this.renderRoot.addEventListener(\n 'close-scene',\n e => {\n e.preventDefault()\n this.onTapPrev()\n },\n false\n )\n }\n\n disconnectedCallback() {\n super.disconnectedCallback()\n\n this.closeScene()\n }\n\n updated(changes: PropertyValues<this>) {\n if (changes.has('board')) {\n this.closeScene()\n\n if (this.board && this.board.id) {\n this.initScene()\n }\n }\n\n if (changes.has('data') && this._scene && this.data) {\n this._scene.data = this.data\n }\n }\n\n initScene() {\n if (!this.board || !this.board.id) return\n\n this._scene = create({\n model: {\n ...this.board.model\n },\n mode: SCENE_MODE.VIEW,\n refProvider: this.provider\n })\n\n if (this.baseUrl) {\n this._scene.baseUrl = this.baseUrl\n }\n\n this.provider.add(this.board.id, this._scene)\n\n this.setupScene(this._scene)\n }\n\n closeScene() {\n if (this._scene) {\n this.unbindSceneEvents(this._scene)\n\n this._scene.target = null\n this._scene.release()\n\n this._scene = null\n }\n\n // delete queued scenes\n this._forward.forEach(scene => scene.release())\n this._forward = []\n\n this._backward.forEach(scene => scene.release())\n this._backward = []\n }\n\n releaseScene() {\n this.closeScene()\n this.transientShowButtons()\n }\n\n setupScene(scene: any) {\n this._scene = scene\n\n /* scene의 기존 target을 보관한다. */\n this._oldtarget = this._scene.target\n\n this._scene.fit(this.board.model.fitMode)\n this._scene.target = this._target\n\n if (this.data) {\n this._scene.data = this.data\n }\n\n this.bindSceneEvents()\n\n this.transientShowButtons()\n }\n\n async showScene(boardId: string, bindingData?: any) {\n if (!boardId) return\n\n try {\n var scene = await this.provider.get(boardId, true)\n\n if (scene === this._scene) {\n scene.release()\n return\n }\n\n if (this._scene) {\n /* old scene을 _backward에 보관한다. */\n this.unbindSceneEvents(this._scene)\n /* 원래의 target에 되돌린다. */\n this._scene.target = this._oldtarget\n this._backward.push(this._scene)\n }\n\n this._scene = scene\n\n this._forward.forEach(scene => scene.release())\n\n /* forward를 비운다. */\n this._forward = []\n\n this.setupScene(scene)\n\n if (bindingData) {\n scene.data = bindingData\n }\n } catch (e) {\n console.error(e)\n }\n }\n\n bindSceneEvents() {\n this._scene.on('goto', this.onLinkGoto, this)\n this._scene.on('link-open', this.onLinkOpen, this)\n this._scene.on('link-move', this.onLinkMove, this)\n this._scene.on('route-page', this.onRoutePage, this)\n }\n\n unbindSceneEvents(scene: any) {\n scene.off('goto', this.onLinkGoto, this)\n scene.off('link-open', this.onLinkOpen, this)\n scene.off('link-move', this.onLinkMove, this)\n scene.off('route-page', this.onRoutePage, this)\n }\n\n transientShowButtons(stop?: boolean) {\n var buttons = []\n !this.hideNavigation && buttons.push(this._next, this._prev)\n !this.hideFullscreen && buttons.push(this._fullscreen)\n\n if (buttons.length == 0) {\n return\n }\n\n if (!this._fade_animations) {\n this._fade_animations = buttons\n .filter(button => button)\n .map(button => {\n let animation = button.animate(\n [\n {\n opacity: 1,\n easing: 'ease-in'\n },\n { opacity: 0 }\n ],\n { delay: 1000, duration: 2000 }\n )\n\n animation.onfinish = () => {\n button.setAttribute('hidden', '')\n }\n\n return animation\n })\n }\n\n this._forward.length <= 0 ? this._next.setAttribute('hidden', '') : this._next.removeAttribute('hidden')\n this._backward.length <= 0 ? this._prev.setAttribute('hidden', '') : this._prev.removeAttribute('hidden')\n this._fullscreen && this._fullscreen.removeAttribute('hidden')\n\n this._fade_animations.forEach(animation => {\n animation.cancel()\n if (stop) return\n\n animation.play()\n })\n }\n\n /* event handlers */\n\n onTapNext() {\n var scene = this._forward.pop()\n if (!scene) return\n\n if (this._scene) {\n this._scene.target = null\n /* 원래의 target에 되돌린다. */\n this._scene.target = this._oldtarget\n this.unbindSceneEvents(this._scene)\n this._backward.push(this._scene)\n }\n\n this.setupScene(scene)\n }\n\n onTapPrev() {\n var scene = this._backward.pop()\n if (!scene) return\n\n if (this._scene) {\n this._scene.target = null\n /* 원래의 target에 되돌린다. */\n this._scene.target = this._oldtarget\n this.unbindSceneEvents(this._scene)\n this._forward.push(this._scene)\n }\n\n this.setupScene(scene)\n }\n\n onTapFullscreen() {\n togglefullscreen(\n this,\n () => this.requestUpdate(),\n () => this.requestUpdate()\n )\n }\n\n onLinkGoto(targetBoardId: string, value: any, fromComponent: any) {\n this.showScene(targetBoardId, fromComponent.data)\n }\n\n onLinkOpen(url: string, value: any, fromComponent: any) {\n if (!url) return\n\n try {\n window.open(url)\n } catch (ex) {\n document.dispatchEvent(\n new CustomEvent('notify', {\n detail: {\n level: 'error',\n message: ex,\n ex\n }\n })\n )\n }\n }\n\n onLinkMove(url: string, value: any, fromComponent: any) {\n if (!url) return\n\n location.href = url\n }\n\n onRoutePage(page: string) {\n if (!page) {\n return\n }\n\n history.pushState({}, '', page)\n window.dispatchEvent(new Event('popstate'))\n }\n\n async getSceneImageData(base64 = false) {\n if (!this._scene) {\n return\n }\n\n var { width, height } = this._scene.model\n var pixelRatio = window.devicePixelRatio\n\n // 1. Scene의 바운드에 근거하여, 오프스크린 캔바스를 만든다.\n var canvas = document.createElement('canvas')\n canvas.width = Number(width)\n canvas.height = Number(height)\n\n var root = this._scene.root\n // 2. 모델레이어의 원래 위치와 스케일을 저장한다.\n var translate = root.get('translate')\n var scale = root.get('scale')\n\n // 3. 위치와 스케일 기본 설정.\n root.set('translate', { x: 0, y: 0 })\n root.set('scale', { x: 1 / pixelRatio, y: 1 / pixelRatio })\n\n // 4. 오프스크린 캔바스의 Context2D를 구한뒤, 모델레이어를 그 위에 그린다.\n var context = canvas.getContext('2d')\n\n root.draw(context)\n\n root.set('translate', translate)\n root.set('scale', scale)\n\n var data = base64 ? canvas.toDataURL() : context!.getImageData(0, 0, width, height).data\n\n return {\n width,\n height,\n data\n }\n }\n\n async printTrick(image: string) {\n var viewTarget: HTMLElement | null = null\n var printTarget: HTMLImageElement | null = null\n\n if (!image) {\n image = (await this.getSceneImageData(true))?.data as string\n }\n\n printTarget = document.createElement('img')\n printTarget.id = 'target'\n printTarget.src = image\n printTarget.style.width = '100%'\n printTarget.style.height = '100%'\n\n const x = (mql: MediaQueryListEvent) => {\n if (mql.matches) {\n if (!viewTarget) {\n viewTarget = this.shadowRoot!.getElementById('target')\n this.renderRoot.replaceChild(printTarget!, viewTarget!)\n }\n } else {\n this.renderRoot.replaceChild(viewTarget!, printTarget!)\n printTarget!.remove()\n mediaQueryList.removeEventListener('change', x)\n }\n }\n\n if (window.matchMedia) {\n var mediaQueryList = window.matchMedia('print')\n mediaQueryList.addEventListener('change', x)\n }\n }\n}\n"]}
1
+ {"version":3,"file":"ox-board-viewer.js","sourceRoot":"","sources":["../../src/ox-board-viewer.ts"],"names":[],"mappings":";AAAA,OAAO,mBAAmB,CAAA;AAC1B,OAAO,oBAAoB,CAAA;AAE3B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAkB,MAAM,KAAK,CAAA;AAC3D,OAAO,EAAE,aAAa,EAAE,QAAQ,EAA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pC,WAAW;IADvB,aAAa,CAAC,iBAAiB,CAAC;GACpB,WAAW,CAqfvB;SArfY,WAAW","sourcesContent":["import '@material/mwc-fab'\nimport '@material/mwc-icon'\n\nimport { css, html, LitElement, PropertyValues } from 'lit'\nimport { customElement, property, query, state } from 'lit/decorators.js'\n\nimport { create, SCENE_MODE } from '@hatiolab/things-scene'\nimport { isIOS, togglefullscreen } from '@operato/utils'\n\n@customElement('ox-board-viewer')\nexport class BoardViewer extends LitElement {\n static styles = css`\n :host {\n display: flex;\n flex-direction: column;\n\n position: relative;\n\n width: 100%; /* 전체화면보기를 위해서 필요함. */\n overflow: hidden;\n }\n\n #target {\n flex: 1;\n\n width: 100%; /* 전체화면보기를 위해서 필요함. */\n height: 100%;\n\n outline: 0;\n }\n\n /* navigation buttons */\n mwc-icon {\n z-index: 10;\n position: absolute;\n top: 45%;\n min-width: 50px;\n width: 50px;\n height: 50px;\n margin: 0;\n padding: 0;\n color: #fff;\n user-select: none;\n\n --mdc-icon-size: 3em;\n }\n\n mwc-icon[hidden] {\n display: none;\n }\n\n mwc-icon:hover {\n background-color: rgba(0, 0, 0, 0.2);\n border-radius: 50%;\n }\n\n #prev {\n left: 5px;\n }\n\n #next {\n right: 5px;\n }\n\n #fullscreen {\n position: absolute;\n bottom: 15px;\n right: 16px;\n }\n\n /* for scroller */\n ::-webkit-scrollbar {\n width: 5px;\n height: 5px;\n }\n ::-webkit-scrollbar-track {\n background-color: transparent;\n }\n ::-webkit-scrollbar-thumb {\n background-color: rgba(0, 0, 0, 0.2);\n }\n ::-webkit-scrollbar-thumb:hover {\n background-color: #aa866a;\n }\n\n [hidden] {\n display: none;\n }\n\n @media print {\n mwc-fab,\n mwc-icon {\n display: none;\n }\n }\n `\n\n @property({ type: String }) baseUrl: string = ''\n @property({ type: Object }) board: any = {}\n @property({ type: Object }) provider: any = null\n @property({ type: Object }) data: any\n\n @property({ type: Boolean, reflect: true, attribute: 'hide-fullscreen' }) hideFullscreen = false\n @property({ type: Boolean, reflect: true, attribute: 'hide-navigation' }) hideNavigation = false\n\n @state() _scene: any = null\n @state() _forward: Array<any> = []\n @state() _backward: Array<any> = []\n\n @state() _oldtarget?: HTMLElement\n @state() _fade_animations?: Array<Animation>\n\n @query('#target') _target!: HTMLElement\n @query('#prev') _prev!: HTMLElement\n @query('#next') _next!: HTMLElement\n @query('#fullscreen') _fullscreen!: HTMLElement\n\n render() {\n var fullscreen =\n !isIOS() && !this.hideFullscreen\n ? html`\n <mwc-fab\n id=\"fullscreen\"\n .icon=${document.fullscreenElement ? 'fullscreen_exit' : 'fullscreen'}\n @click=${(e: Event) => this.onTapFullscreen()}\n @mouseover=${(e: Event) => this.transientShowButtons(true)}\n @mouseout=${(e: Event) => this.transientShowButtons()}\n title=\"fullscreen\"\n ></mwc-fab>\n `\n : html``\n\n var prev = !this.hideNavigation\n ? html`\n <mwc-icon\n id=\"prev\"\n @click=${(e: Event) => this.onTapPrev()}\n @mouseover=${(e: Event) => this.transientShowButtons(true)}\n @mouseout=${(e: Event) => this.transientShowButtons()}\n hidden\n >keyboard_arrow_left</mwc-icon\n >\n `\n : html``\n\n var next = !this.hideNavigation\n ? html`\n <mwc-icon\n id=\"next\"\n @click=${(e: Event) => this.onTapNext()}\n @mouseover=${(e: Event) => this.transientShowButtons(true)}\n @mouseout=${(e: Event) => this.transientShowButtons()}\n hidden\n >keyboard_arrow_right</mwc-icon\n >\n `\n : html``\n\n return html`\n ${prev}\n\n <div\n id=\"target\"\n @touchstart=${(e: Event) => this.transientShowButtons()}\n @mousemove=${(e: Event) => this.transientShowButtons()}\n ></div>\n\n ${next} ${fullscreen}\n `\n }\n\n connectedCallback() {\n super.connectedCallback()\n\n window.addEventListener('resize', () => {\n this._scene && this._scene.fit()\n })\n\n this.renderRoot.addEventListener(\n 'close-scene',\n e => {\n e.preventDefault()\n this.onTapPrev()\n },\n false\n )\n }\n\n disconnectedCallback() {\n super.disconnectedCallback()\n\n this.closeScene()\n }\n\n updated(changes: PropertyValues<this>) {\n if (changes.has('board')) {\n this.closeScene()\n\n if (this.board && this.board.id) {\n this.initScene()\n }\n }\n\n if (changes.has('data') && this._scene && this.data) {\n this._scene.data = this.data\n }\n }\n\n initScene() {\n if (!this.board || !this.board.id) return\n\n this._scene = create({\n model: {\n ...this.board.model\n },\n mode: SCENE_MODE.VIEW,\n refProvider: this.provider\n })\n\n if (this.baseUrl) {\n this._scene.baseUrl = this.baseUrl\n }\n\n this.provider.add(this.board.id, this._scene)\n\n this.setupScene(this._scene)\n }\n\n closeScene() {\n if (this._scene) {\n this.unbindSceneEvents(this._scene)\n\n this._scene.target = null\n this._scene.release()\n\n this._scene = null\n }\n\n // delete queued scenes\n this._forward.forEach(scene => scene.release())\n this._forward = []\n\n this._backward.forEach(scene => scene.release())\n this._backward = []\n }\n\n releaseScene() {\n this.closeScene()\n this.transientShowButtons()\n }\n\n setupScene(scene: any) {\n this._scene = scene\n\n /* scene의 기존 target을 보관한다. */\n this._oldtarget = this._scene.target\n\n this._scene.fit(this.board.model.fitMode)\n this._scene.target = this._target\n\n if (this.data) {\n this._scene.data = this.data\n }\n\n this.bindSceneEvents()\n\n this.transientShowButtons()\n }\n\n async showScene(boardId: string, bindingData?: any) {\n if (!boardId) return\n\n try {\n var scene = await this.provider.get(boardId, true)\n\n if (scene === this._scene) {\n scene.release()\n return\n }\n\n if (this._scene) {\n /* old scene을 _backward에 보관한다. */\n this.unbindSceneEvents(this._scene)\n /* 원래의 target에 되돌린다. */\n this._scene.target = this._oldtarget\n this._backward.push(this._scene)\n }\n\n this._scene = scene\n\n this._forward.forEach(scene => scene.release())\n\n /* forward를 비운다. */\n this._forward = []\n\n this.setupScene(scene)\n\n if (bindingData) {\n scene.data = bindingData\n }\n } catch (e) {\n console.error(e)\n }\n }\n\n bindSceneEvents() {\n this._scene.on('goto', this.onLinkGoto, this)\n this._scene.on('link-open', this.onLinkOpen, this)\n this._scene.on('link-move', this.onLinkMove, this)\n this._scene.on('route-page', this.onRoutePage, this)\n }\n\n unbindSceneEvents(scene: any) {\n scene.off('goto', this.onLinkGoto, this)\n scene.off('link-open', this.onLinkOpen, this)\n scene.off('link-move', this.onLinkMove, this)\n scene.off('route-page', this.onRoutePage, this)\n }\n\n transientShowButtons(stop?: boolean) {\n var buttons = []\n !this.hideNavigation && buttons.push(this._next, this._prev)\n !this.hideFullscreen && buttons.push(this._fullscreen)\n\n if (buttons.length == 0) {\n return\n }\n\n if (!this._fade_animations) {\n this._fade_animations = buttons\n .filter(button => button)\n .map(button => {\n let animation = button.animate(\n [\n {\n opacity: 1,\n easing: 'ease-in'\n },\n { opacity: 0 }\n ],\n { delay: 1000, duration: 2000 }\n )\n\n animation.onfinish = () => {\n button.setAttribute('hidden', '')\n }\n\n return animation\n })\n }\n\n this._forward.length <= 0 ? this._next.setAttribute('hidden', '') : this._next.removeAttribute('hidden')\n this._backward.length <= 0 ? this._prev.setAttribute('hidden', '') : this._prev.removeAttribute('hidden')\n this._fullscreen && this._fullscreen.removeAttribute('hidden')\n\n this._fade_animations.forEach(animation => {\n animation.cancel()\n if (stop) return\n\n animation.play()\n })\n }\n\n /* event handlers */\n\n onTapNext() {\n var scene = this._forward.pop()\n if (!scene) return\n\n if (this._scene) {\n this._scene.target = null\n /* 원래의 target에 되돌린다. */\n this._scene.target = this._oldtarget\n this.unbindSceneEvents(this._scene)\n this._backward.push(this._scene)\n }\n\n this.setupScene(scene)\n }\n\n onTapPrev() {\n var scene = this._backward.pop()\n if (!scene) return\n\n if (this._scene) {\n this._scene.target = null\n /* 원래의 target에 되돌린다. */\n this._scene.target = this._oldtarget\n this.unbindSceneEvents(this._scene)\n this._forward.push(this._scene)\n }\n\n this.setupScene(scene)\n }\n\n onTapFullscreen() {\n togglefullscreen(\n this,\n () => this.requestUpdate(),\n () => this.requestUpdate()\n )\n }\n\n onLinkGoto(targetBoardId: string, value: any, fromComponent: any) {\n this.showScene(targetBoardId, fromComponent.data)\n }\n\n onLinkOpen(url: string, value: any, fromComponent: any) {\n if (!url) return\n\n try {\n window.open(url)\n } catch (ex) {\n document.dispatchEvent(\n new CustomEvent('notify', {\n detail: {\n level: 'error',\n message: ex,\n ex\n }\n })\n )\n }\n }\n\n onLinkMove(url: string, value: any, fromComponent: any) {\n if (!url) return\n\n location.href = url\n }\n\n onRoutePage(page: string) {\n if (!page) {\n return\n }\n\n history.pushState({}, '', page)\n window.dispatchEvent(new Event('popstate'))\n }\n\n async getSceneImageData(base64 = false) {\n if (!this._scene) {\n return\n }\n\n var { width, height } = this._scene.model\n var pixelRatio = window.devicePixelRatio\n\n // 1. Scene의 바운드에 근거하여, 오프스크린 캔바스를 만든다.\n var canvas = document.createElement('canvas')\n canvas.width = Number(width)\n canvas.height = Number(height)\n\n var root = this._scene.root\n // 2. 모델레이어의 원래 위치와 스케일을 저장한다.\n var translate = root.get('translate')\n var scale = root.get('scale')\n\n // 3. 위치와 스케일 기본 설정.\n root.set('translate', { x: 0, y: 0 })\n root.set('scale', { x: 1 / pixelRatio, y: 1 / pixelRatio })\n\n // 4. 오프스크린 캔바스의 Context2D를 구한뒤, 모델레이어를 그 위에 그린다.\n var context = canvas.getContext('2d')\n\n root.draw(context)\n\n root.set('translate', translate)\n root.set('scale', scale)\n\n var data = base64 ? canvas.toDataURL() : context!.getImageData(0, 0, width, height).data\n\n return {\n width,\n height,\n data\n }\n }\n\n async printTrick(image: string) {\n var viewTarget: HTMLElement | null = null\n var printTarget: HTMLImageElement | null = null\n\n if (!image) {\n image = (await this.getSceneImageData(true))?.data as string\n }\n\n printTarget = document.createElement('img')\n printTarget.id = 'target'\n printTarget.src = image\n printTarget.style.width = '100%'\n printTarget.style.height = '100%'\n\n const x = (mql: MediaQueryListEvent) => {\n if (mql.matches) {\n if (!viewTarget) {\n viewTarget = this.shadowRoot!.getElementById('target')\n this.renderRoot.replaceChild(printTarget!, viewTarget!)\n }\n } else {\n this.renderRoot.replaceChild(viewTarget!, printTarget!)\n printTarget!.remove()\n mediaQueryList.removeEventListener('change', x)\n }\n }\n\n if (window.matchMedia) {\n var mediaQueryList = window.matchMedia('print')\n mediaQueryList.addEventListener('change', x)\n }\n }\n}\n"]}