@operato/layout 1.0.0-beta.5 → 1.0.0-beta.50

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
@@ -3,7 +3,7 @@
3
3
  "description": "Webcomponent layout following open-wc recommendations",
4
4
  "license": "MIT",
5
5
  "author": "heartyoh",
6
- "version": "1.0.0-beta.5",
6
+ "version": "1.0.0-beta.50",
7
7
  "main": "dist/src/index.js",
8
8
  "module": "dist/src/index.js",
9
9
  "exports": {
@@ -36,13 +36,13 @@
36
36
  "storybook:build": "tsc && npm run analyze -- --exclude dist && build-storybook"
37
37
  },
38
38
  "dependencies": {
39
- "@material/mwc-button": "^0.25.3",
40
- "@material/mwc-icon": "^0.25.3",
41
- "@operato/popup": "^1.0.0-beta.5",
42
- "@operato/shell": "^1.0.0-beta.5",
43
- "@operato/styles": "^1.0.0-beta.5",
44
- "@operato/utils": "^1.0.0-beta.5",
45
- "lit": "^2.2.1",
39
+ "@material/mwc-button": "^0.26.1",
40
+ "@material/mwc-icon": "^0.26.1",
41
+ "@operato/popup": "^1.0.0-beta.50",
42
+ "@operato/shell": "^1.0.0-beta.50",
43
+ "@operato/styles": "^1.0.0-beta.50",
44
+ "@operato/utils": "^1.0.0-beta.50",
45
+ "lit": "^2.2.7",
46
46
  "pwa-helpers": "^0.9.1"
47
47
  },
48
48
  "devDependencies": {
@@ -53,12 +53,12 @@
53
53
  "@typescript-eslint/eslint-plugin": "^4.33.0",
54
54
  "@typescript-eslint/parser": "^4.33.0",
55
55
  "@web/dev-server": "^0.1.29",
56
- "@web/dev-server-storybook": "next",
56
+ "@web/dev-server-storybook": "^0.5.0",
57
57
  "@web/test-runner": "next",
58
58
  "concurrently": "^5.3.0",
59
59
  "eslint": "^7.32.0",
60
60
  "eslint-config-prettier": "^8.3.0",
61
- "husky": "^4.3.8",
61
+ "husky": "^7.0.2",
62
62
  "lint-staged": "^10.5.4",
63
63
  "prettier": "^2.4.1",
64
64
  "tslib": "^2.3.1",
@@ -77,5 +77,5 @@
77
77
  "prettier --write"
78
78
  ]
79
79
  },
80
- "gitHead": "23c51cd9e53b2b9222855ef090db06fd7b23ed98"
80
+ "gitHead": "9b3a8e88bfb7b868f30c7c049447d3c65e32f7df"
81
81
  }
@@ -1,5 +1,6 @@
1
- import { OxPopup } from '@operato/popup'
2
1
  import { TemplateResult } from 'lit'
2
+
3
+ import { PopupHandle, PopupOptions, setOpenPopupImplementation } from '@operato/popup'
3
4
  import { store } from '@operato/shell'
4
5
 
5
6
  export type Viewpart = {
@@ -158,43 +159,6 @@ export const toggleOverlay = (name: string, options: any) => {
158
159
  */
159
160
  var popupSequence = 0
160
161
 
161
- /**
162
- * Options for popup
163
- *
164
- * @typedef {Object} PopupOptions
165
- * @property {String} [title] - popup title
166
- * @property {'center' | 'next' | 'edge'} [hovering] - hovering position (default: 'center'). 'edge' : edge of the HEADERBAR, 'next' : next of the clicked position.
167
- * @property {'large' | 'medium' | small'} [size] - popup size
168
- * @property {Boolean} [closable] - set whether the close 'X' button is shown on top-right most position (default true)
169
- * @property {Boolean} [escapable] - set whether the close popup with 'ESC' key (default true)
170
- * @property {Boolean} [backdrop] - set whether to do background masking around the pop-up. If true, it becomes modal (default true)
171
- */
172
- export type PopupOptions = {
173
- title?: string
174
- hovering?: 'center' | 'next' | 'edge'
175
- size?: 'large' | 'medium' | 'small'
176
- closable?: boolean
177
- escapable?: boolean
178
- backdrop?: boolean
179
- help?: string
180
- }
181
-
182
- /**
183
- * Popup handle object that will be returned openPopup
184
- *
185
- * @typedef {Object} PopupHandle
186
- * @property {String} [name] - popup instance name
187
- * @property {Function} [close] - call this function to close the popup.
188
- * @property {Boolean} [closed] - state telling whether the popup is closed or not.
189
- * @property {Function} [onclosed] - set callback function on close. It will be called when the popup about to close.
190
- */
191
- export type PopupHandle = {
192
- name: string
193
- close: () => void
194
- closed: boolean
195
- onclosed?: () => void
196
- }
197
-
198
162
  /**
199
163
  * open popup in operato application environment
200
164
  *
@@ -202,7 +166,7 @@ export type PopupHandle = {
202
166
  * @param {PopupOptions} options
203
167
  * @returns popup handle object. This object is used to close the popup.
204
168
  */
205
- export const layoutOpenPopup = (template: TemplateResult, options: PopupOptions = {}): PopupHandle => {
169
+ export const openPopup = (template: TemplateResult, options: PopupOptions = {}): PopupHandle => {
206
170
  var name = `$popup-${popupSequence++}`
207
171
 
208
172
  appendViewpart({
@@ -244,36 +208,4 @@ export const layoutOpenPopup = (template: TemplateResult, options: PopupOptions
244
208
  return popup
245
209
  }
246
210
 
247
- /**
248
- * open popup out of operato application environment
249
- *
250
- * @param {*} template html template to be rendered inside the popup
251
- * @param {PopupOptions} options
252
- * @returns popup handle object. This object is used to close the popup.
253
- */
254
- const liteOpenPopup = (template: TemplateResult, options: PopupOptions = {}): PopupHandle => {
255
- history.pushState({}, '', location.href)
256
-
257
- const popup = OxPopup.open({
258
- template,
259
- width: '90%',
260
- height: '90%'
261
- })
262
-
263
- popup.style.setProperty('--overlay-center-normal-width', '100%')
264
- popup.style.setProperty('--overlay-center-normal-height', '100%')
265
-
266
- requestAnimationFrame(() => {
267
- dispatchEvent(new Event('resize'))
268
- })
269
-
270
- return {
271
- close: () => {
272
- popup.close()
273
- history.back()
274
- }
275
- } as PopupHandle
276
- }
277
-
278
- export const openPopup: (template: TemplateResult, options: PopupOptions) => PopupHandle =
279
- 'operato' in window ? liteOpenPopup : layoutOpenPopup
211
+ setOpenPopupImplementation(openPopup)
package/src/index.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  import './initializer'
2
2
 
3
+ export { PopupHandle, PopupOptions } from '@operato/popup'
4
+
3
5
  export * from './layouts/ox-snack-bar.js'
4
6
  export * from './layouts/ox-header-bar.js'
5
7
  export * from './layouts/ox-nav-bar.js'
@@ -1,4 +1,4 @@
1
- import '../components/ox-floating-overlay.js'
1
+ import '@operato/popup/ox-floating-overlay.js'
2
2
  import '../components/ox-resize-splitter.js'
3
3
 
4
4
  import { css, html, LitElement } from 'lit'
@@ -68,6 +68,7 @@ class AsideBar extends connect(store)(LitElement) {
68
68
  .help=${asidebar.help}
69
69
  .closable=${asidebar.closable}
70
70
  .templateProperties=${asidebar.templateProperties}
71
+ .historical=${true}
71
72
  >${asidebar.template}</ox-floating-overlay
72
73
  >
73
74
  `
@@ -1,4 +1,4 @@
1
- import '../components/ox-floating-overlay.js'
1
+ import '@operato/popup/ox-floating-overlay.js'
2
2
  import '../components/ox-resize-splitter.js'
3
3
 
4
4
  import { css, html, LitElement } from 'lit'
@@ -69,6 +69,7 @@ class FooterBar extends connect(store)(LitElement) {
69
69
  .size=${footerbar.size}
70
70
  .closable=${footerbar.closable}
71
71
  .templateProperties=${footerbar.templateProperties}
72
+ .historical=${true}
72
73
  >${footerbar.template}</ox-floating-overlay
73
74
  >
74
75
  `
@@ -1,4 +1,4 @@
1
- import '../components/ox-floating-overlay.js'
1
+ import '@operato/popup/ox-floating-overlay.js'
2
2
  import '../components/ox-resize-splitter.js'
3
3
 
4
4
  import { css, html, LitElement } from 'lit'
@@ -66,6 +66,7 @@ class HeaderBar extends connect(store)(LitElement) {
66
66
  .size=${headerbar.size}
67
67
  .closable=${headerbar.closable}
68
68
  .templateProperties=${headerbar.templateProperties}
69
+ .historical=${true}
69
70
  >${headerbar.template}</ox-floating-overlay
70
71
  >
71
72
  `
@@ -1,4 +1,4 @@
1
- import '../components/ox-floating-overlay.js'
1
+ import '@operato/popup/ox-floating-overlay.js'
2
2
  import '../components/ox-resize-splitter.js'
3
3
 
4
4
  import { css, html, LitElement } from 'lit'
@@ -70,6 +70,7 @@ class NavBar extends connect(store)(LitElement) {
70
70
  .size=${navbar.size}
71
71
  .closable=${navbar.closable}
72
72
  .templateProperties=${navbar.templateProperties}
73
+ .historical=${true}
73
74
  >${navbar.template}</ox-floating-overlay
74
75
  >
75
76
  `
@@ -1,2 +0,0 @@
1
- import '@operato/help/ox-help-icon.js';
2
- import '@material/mwc-icon';
@@ -1,333 +0,0 @@
1
- import { __decorate } from "tslib";
2
- import '@operato/help/ox-help-icon.js';
3
- import '@material/mwc-icon';
4
- import { css, html, LitElement } from 'lit';
5
- import { customElement, property } from 'lit/decorators.js';
6
- import { ScrollbarStyles } from '@operato/styles';
7
- let FloatingOverlay = class FloatingOverlay extends LitElement {
8
- constructor() {
9
- super(...arguments);
10
- this.backdrop = false;
11
- this.title = '';
12
- this.closable = false;
13
- }
14
- render() {
15
- var direction = this.hovering == 'center' ? false : this.direction;
16
- return html `
17
- ${Boolean(this.backdrop)
18
- ? html ` <div id="backdrop" ?hidden=${!this.backdrop} @click=${() => this.onClose(true)}></div> `
19
- : html ``}
20
-
21
- <div
22
- overlayed
23
- hovering=${this.hovering || 'center'}
24
- direction=${direction}
25
- size=${this.size || 'normal'}
26
- @close-overlay=${() => this.onClose()}
27
- @transitionstart=${(e) => {
28
- /* to hide scrollbar during transition */
29
- ;
30
- e.target.removeAttribute('settled');
31
- }}
32
- @transitionend=${(e) => {
33
- ;
34
- e.target.setAttribute('settled', '');
35
- }}
36
- >
37
- <div header>
38
- <mwc-icon @click=${() => this.onClose()} ?closable=${this.closable} historyback>arrow_back</mwc-icon>
39
- <slot name="header">
40
- ${this.title || this.closable
41
- ? html `
42
- <h1>
43
- ${this.title || ''}&nbsp;${this.help
44
- ? html ` <ox-help-icon .topic=${this.help}></ox-help-icon>`
45
- : html ``}
46
- </h1>
47
- `
48
- : html ``}</slot
49
- >
50
- <mwc-icon @click=${() => this.onClose()} ?closable=${this.closable} close>close</mwc-icon>
51
- </div>
52
-
53
- <div content>
54
- <slot> </slot>
55
- </div>
56
- </div>
57
- `;
58
- }
59
- updated(changes) {
60
- if (changes.has('templateProperties') && this.templateProperties) {
61
- var template = this.firstElementChild;
62
- if (template) {
63
- for (let prop in this.templateProperties) {
64
- //@ts-ignore
65
- template[prop] = this.templateProperties[prop];
66
- }
67
- }
68
- }
69
- }
70
- firstUpdated() {
71
- requestAnimationFrame(() => {
72
- var _a;
73
- /* transition(animation) 효과를 위해 'opened' 속성을 변화시킨다. */
74
- (_a = this.renderRoot.querySelector('[overlayed]')) === null || _a === void 0 ? void 0 : _a.setAttribute('opened', 'true');
75
- });
76
- }
77
- disconnectedCallback() {
78
- document.dispatchEvent(new CustomEvent('overlay-closed', {
79
- detail: this.name
80
- }));
81
- super.disconnectedCallback();
82
- }
83
- onClose(escape) {
84
- /* 현재 overlay state를 확인해서, 자신이 포함하고 있는 템플릿인 경우에 history.back() 한다. */
85
- var state = history.state;
86
- var overlay = (state || {}).overlay;
87
- if (!overlay || overlay.name !== this.name) {
88
- return;
89
- }
90
- /* Backdrop click 경우는 escape 시도라고 정의한다. overlay 속성이 escapable이 아닌 경우에는 동작하지 않는다. */
91
- if (escape && !overlay.escapable) {
92
- return true;
93
- }
94
- history.back();
95
- }
96
- };
97
- FloatingOverlay.styles = [
98
- ScrollbarStyles,
99
- css `
100
- /* for layout style */
101
- :host {
102
- position: relative;
103
- z-index: 1;
104
- }
105
-
106
- :host([hovering='edge']) {
107
- /* edge hovering 인 경우에는 상위 relative position 크기와 위치를 반영한다. */
108
- position: initial;
109
- }
110
-
111
- #backdrop {
112
- position: fixed;
113
- left: 0;
114
- top: 0;
115
-
116
- width: 100vw;
117
- height: 100vh;
118
-
119
- background-color: var(--overlay-background-color);
120
- }
121
-
122
- [overlayed] {
123
- position: absolute;
124
-
125
- display: flex;
126
- flex-direction: column;
127
- overflow: hidden;
128
- background: transparent;
129
- pointer-events: none;
130
- }
131
-
132
- [overlayed][hovering='center'] {
133
- position: fixed;
134
-
135
- left: 50%;
136
- top: 50%;
137
- transform: translate(-50%, -50%);
138
-
139
- opacity: 0;
140
- }
141
-
142
- [overlayed][hovering='center'][opened] {
143
- opacity: 1;
144
- transition: opacity 0.3s ease-in;
145
- }
146
-
147
- [hovering='center'] {
148
- width: var(--overlay-center-normal-width, 60%);
149
- height: var(--overlay-center-normal-height, 60%);
150
- }
151
-
152
- [hovering='center'][size='small'] {
153
- width: var(--overlay-center-small-width, 40%);
154
- height: var(--overlay-center-small-height, 40%);
155
- }
156
-
157
- [hovering='center'][size='large'] {
158
- width: var(--overlay-center-large-width, 100%);
159
- height: var(--overlay-center-large-height, 100%);
160
- }
161
-
162
- [header] {
163
- --help-icon-color: #fff;
164
- --help-icon-hover-color: #fff;
165
-
166
- pointer-events: initial;
167
- }
168
-
169
- [content] {
170
- flex: 1;
171
-
172
- overflow: hidden;
173
- }
174
-
175
- ::slotted(*) {
176
- box-sizing: border-box;
177
- pointer-events: initial;
178
- }
179
-
180
- [hovering='center'] [content] ::slotted(*) {
181
- width: 100%;
182
- height: 100%;
183
- }
184
- [direction='up'],
185
- [direction='down'] {
186
- width: 100%;
187
-
188
- max-height: 0;
189
- transition: max-height 0.7s ease-in;
190
- }
191
- [direction='up'] {
192
- bottom: 0;
193
- }
194
- [direction='down'] {
195
- top: 0;
196
- }
197
-
198
- [direction='up'][opened],
199
- [direction='down'][opened] {
200
- max-height: 100vh;
201
- }
202
-
203
- [settled][direction='down'] [content],
204
- [settled][direction='up'] [content] {
205
- overflow-y: auto;
206
- }
207
-
208
- [direction='left'],
209
- [direction='right'] {
210
- height: 100%;
211
-
212
- max-width: 0;
213
- transition: max-width 0.5s ease-in;
214
- }
215
- [direction='left'] {
216
- right: 0;
217
- }
218
- [direction='right'] {
219
- left: 0;
220
- }
221
-
222
- [direction='left'][opened],
223
- [direction='right'][opened] {
224
- max-width: 100vw;
225
- }
226
-
227
- [settled][direction='left'] [content],
228
- [settled][direction='right'] [content] {
229
- overflow-x: auto;
230
- }
231
-
232
- @media screen and (max-width: 460px) {
233
- [direction='up'],
234
- [direction='down'] {
235
- max-height: 100vh;
236
- }
237
-
238
- [direction='left'],
239
- [direction='right'] {
240
- max-width: 100vw;
241
- }
242
- }
243
- `,
244
- css `
245
- /* for header style */
246
- [header] {
247
- display: flex;
248
- flex-direction: row;
249
- align-items: center;
250
-
251
- background-color: var(--overlay-header-background-color);
252
- color: var(--overlay-header-color);
253
- }
254
-
255
- slot[name='header'] {
256
- flex: 1;
257
-
258
- display: flex;
259
- flex-direction: row;
260
- align-items: center;
261
- justify-content: center;
262
- }
263
-
264
- [name='header']::slotted(*) {
265
- margin: 0 auto;
266
- }
267
-
268
- [name='header'] > h1 {
269
- text-transform: capitalize;
270
- font: var(--overlay-header-font);
271
- }
272
-
273
- [historyback] {
274
- margin-left: 10px;
275
- margin-right: auto;
276
- }
277
-
278
- [close] {
279
- margin-left: auto;
280
- margin-right: 10px;
281
- }
282
-
283
- [historyback],
284
- [close] {
285
- display: none;
286
- }
287
-
288
- [closable][close] {
289
- display: block;
290
- }
291
-
292
- @media screen and (max-width: 460px) {
293
- [closable][historyback] {
294
- display: block;
295
- }
296
-
297
- [closable][close] {
298
- display: none;
299
- }
300
- }
301
- `
302
- ];
303
- __decorate([
304
- property({ type: Boolean })
305
- ], FloatingOverlay.prototype, "backdrop", void 0);
306
- __decorate([
307
- property({ type: String })
308
- ], FloatingOverlay.prototype, "direction", void 0);
309
- __decorate([
310
- property({ type: String, reflect: true })
311
- ], FloatingOverlay.prototype, "hovering", void 0);
312
- __decorate([
313
- property({ type: String })
314
- ], FloatingOverlay.prototype, "size", void 0);
315
- __decorate([
316
- property({ type: String })
317
- ], FloatingOverlay.prototype, "name", void 0);
318
- __decorate([
319
- property({ type: String })
320
- ], FloatingOverlay.prototype, "title", void 0);
321
- __decorate([
322
- property({ type: Boolean })
323
- ], FloatingOverlay.prototype, "closable", void 0);
324
- __decorate([
325
- property({ type: Object })
326
- ], FloatingOverlay.prototype, "templateProperties", void 0);
327
- __decorate([
328
- property({ type: Object })
329
- ], FloatingOverlay.prototype, "help", void 0);
330
- FloatingOverlay = __decorate([
331
- customElement('ox-floating-overlay')
332
- ], FloatingOverlay);
333
- //# sourceMappingURL=ox-floating-overlay.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ox-floating-overlay.js","sourceRoot":"","sources":["../../../src/components/ox-floating-overlay.ts"],"names":[],"mappings":";AAAA,OAAO,+BAA+B,CAAA;AACtC,OAAO,oBAAoB,CAAA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,CAAC;2DAAwB;AACvB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;6CAAU;AAxNjC,eAAe;IADpB,aAAa,CAAC,qBAAqB,CAAC;GAC/B,eAAe,CAqTpB","sourcesContent":["import '@operato/help/ox-help-icon.js'\nimport '@material/mwc-icon'\n\nimport { css, html, LitElement, PropertyValues } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\n\nimport { ScrollbarStyles } from '@operato/styles'\n\n@customElement('ox-floating-overlay')\nclass FloatingOverlay extends LitElement {\n static styles = [\n ScrollbarStyles,\n css`\n /* for layout style */\n :host {\n position: relative;\n z-index: 1;\n }\n\n :host([hovering='edge']) {\n /* edge hovering 인 경우에는 상위 relative position 크기와 위치를 반영한다. */\n position: initial;\n }\n\n #backdrop {\n position: fixed;\n left: 0;\n top: 0;\n\n width: 100vw;\n height: 100vh;\n\n background-color: var(--overlay-background-color);\n }\n\n [overlayed] {\n position: absolute;\n\n display: flex;\n flex-direction: column;\n overflow: hidden;\n background: transparent;\n pointer-events: none;\n }\n\n [overlayed][hovering='center'] {\n position: fixed;\n\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n\n opacity: 0;\n }\n\n [overlayed][hovering='center'][opened] {\n opacity: 1;\n transition: opacity 0.3s ease-in;\n }\n\n [hovering='center'] {\n width: var(--overlay-center-normal-width, 60%);\n height: var(--overlay-center-normal-height, 60%);\n }\n\n [hovering='center'][size='small'] {\n width: var(--overlay-center-small-width, 40%);\n height: var(--overlay-center-small-height, 40%);\n }\n\n [hovering='center'][size='large'] {\n width: var(--overlay-center-large-width, 100%);\n height: var(--overlay-center-large-height, 100%);\n }\n\n [header] {\n --help-icon-color: #fff;\n --help-icon-hover-color: #fff;\n\n pointer-events: initial;\n }\n\n [content] {\n flex: 1;\n\n overflow: hidden;\n }\n\n ::slotted(*) {\n box-sizing: border-box;\n pointer-events: initial;\n }\n\n [hovering='center'] [content] ::slotted(*) {\n width: 100%;\n height: 100%;\n }\n [direction='up'],\n [direction='down'] {\n width: 100%;\n\n max-height: 0;\n transition: max-height 0.7s ease-in;\n }\n [direction='up'] {\n bottom: 0;\n }\n [direction='down'] {\n top: 0;\n }\n\n [direction='up'][opened],\n [direction='down'][opened] {\n max-height: 100vh;\n }\n\n [settled][direction='down'] [content],\n [settled][direction='up'] [content] {\n overflow-y: auto;\n }\n\n [direction='left'],\n [direction='right'] {\n height: 100%;\n\n max-width: 0;\n transition: max-width 0.5s ease-in;\n }\n [direction='left'] {\n right: 0;\n }\n [direction='right'] {\n left: 0;\n }\n\n [direction='left'][opened],\n [direction='right'][opened] {\n max-width: 100vw;\n }\n\n [settled][direction='left'] [content],\n [settled][direction='right'] [content] {\n overflow-x: auto;\n }\n\n @media screen and (max-width: 460px) {\n [direction='up'],\n [direction='down'] {\n max-height: 100vh;\n }\n\n [direction='left'],\n [direction='right'] {\n max-width: 100vw;\n }\n }\n `,\n css`\n /* for header style */\n [header] {\n display: flex;\n flex-direction: row;\n align-items: center;\n\n background-color: var(--overlay-header-background-color);\n color: var(--overlay-header-color);\n }\n\n slot[name='header'] {\n flex: 1;\n\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: center;\n }\n\n [name='header']::slotted(*) {\n margin: 0 auto;\n }\n\n [name='header'] > h1 {\n text-transform: capitalize;\n font: var(--overlay-header-font);\n }\n\n [historyback] {\n margin-left: 10px;\n margin-right: auto;\n }\n\n [close] {\n margin-left: auto;\n margin-right: 10px;\n }\n\n [historyback],\n [close] {\n display: none;\n }\n\n [closable][close] {\n display: block;\n }\n\n @media screen and (max-width: 460px) {\n [closable][historyback] {\n display: block;\n }\n\n [closable][close] {\n display: none;\n }\n }\n `\n ]\n\n @property({ type: Boolean }) backdrop: boolean = false\n @property({ type: String }) direction?: 'up' | 'down' | 'left' | 'right'\n @property({ type: String, reflect: true }) hovering?: 'center' | 'edge'\n @property({ type: String }) size?: 'small' | 'normal' | 'large'\n @property({ type: String }) name?: string\n @property({ type: String }) title: string = ''\n @property({ type: Boolean }) closable: boolean = false\n @property({ type: Object }) templateProperties: any\n @property({ type: Object }) help: any\n\n render() {\n var direction = this.hovering == 'center' ? false : this.direction\n\n return html`\n ${Boolean(this.backdrop)\n ? html` <div id=\"backdrop\" ?hidden=${!this.backdrop} @click=${() => this.onClose(true)}></div> `\n : html``}\n\n <div\n overlayed\n hovering=${this.hovering || 'center'}\n direction=${direction}\n size=${this.size || 'normal'}\n @close-overlay=${() => this.onClose()}\n @transitionstart=${(e: Event) => {\n /* to hide scrollbar during transition */\n ;(e.target as HTMLElement).removeAttribute('settled')\n }}\n @transitionend=${(e: Event) => {\n ;(e.target as HTMLElement).setAttribute('settled', '')\n }}\n >\n <div header>\n <mwc-icon @click=${() => this.onClose()} ?closable=${this.closable} historyback>arrow_back</mwc-icon>\n <slot name=\"header\">\n ${this.title || this.closable\n ? html`\n <h1>\n ${this.title || ''}&nbsp;${this.help\n ? html` <ox-help-icon .topic=${this.help}></ox-help-icon>`\n : html``}\n </h1>\n `\n : html``}</slot\n >\n <mwc-icon @click=${() => this.onClose()} ?closable=${this.closable} close>close</mwc-icon>\n </div>\n\n <div content>\n <slot> </slot>\n </div>\n </div>\n `\n }\n\n updated(changes: PropertyValues<this>) {\n if (changes.has('templateProperties') && this.templateProperties) {\n var template = this.firstElementChild\n if (template) {\n for (let prop in this.templateProperties) {\n //@ts-ignore\n template[prop] = this.templateProperties[prop]\n }\n }\n }\n }\n\n firstUpdated() {\n requestAnimationFrame(() => {\n /* transition(animation) 효과를 위해 'opened' 속성을 변화시킨다. */\n this.renderRoot.querySelector('[overlayed]')?.setAttribute('opened', 'true')\n })\n }\n\n disconnectedCallback() {\n document.dispatchEvent(\n new CustomEvent('overlay-closed', {\n detail: this.name\n })\n )\n\n super.disconnectedCallback()\n }\n\n onClose(escape?: boolean) {\n /* 현재 overlay state를 확인해서, 자신이 포함하고 있는 템플릿인 경우에 history.back() 한다. */\n\n var state = history.state\n var overlay = (state || {}).overlay\n\n if (!overlay || overlay.name !== this.name) {\n return\n }\n\n /* Backdrop click 경우는 escape 시도라고 정의한다. overlay 속성이 escapable이 아닌 경우에는 동작하지 않는다. */\n if (escape && !overlay.escapable) {\n return true\n }\n\n history.back()\n }\n}\n"]}