@things-factory/notification 10.1.6 → 10.1.8

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.
@@ -5,12 +5,7 @@ export declare class NotificationItem extends LitElement {
5
5
  type?: string;
6
6
  notification: any;
7
7
  target?: string;
8
- detail?: {
9
- message: string;
10
- [key: string]: any;
11
- };
12
8
  newbie?: boolean;
13
9
  render(): import("lit-html").TemplateResult<1>;
14
10
  updated(changed: any): void;
15
- decipherErrorCode(): Promise<void>;
16
11
  }
@@ -1,9 +1,8 @@
1
1
  import { __decorate, __metadata } from "tslib";
2
2
  import '@material/web/icon/icon.js';
3
- import gql from 'graphql-tag';
4
3
  import { LitElement, html, css } from 'lit';
5
4
  import { customElement, property } from 'lit/decorators.js';
6
- import { client } from '@operato/graphql';
5
+ import { i18next } from '@operato/i18n';
7
6
  function isOriginSameAsLocation(url) {
8
7
  function defaultPort(protocol) {
9
8
  return { 'http:': 80, 'https:': 443 }[protocol];
@@ -29,38 +28,37 @@ let NotificationItem = class NotificationItem extends LitElement {
29
28
  static { this.styles = [
30
29
  css `
31
30
  :host {
31
+ display: block;
32
32
  position: relative;
33
- background-color: var(--md-sys-color-surface);
34
- padding: var(--spacing-medium);
35
- border-left: 0 solid transparent;
36
- border-bottom: 1px solid var(--md-sys-color-outline-variant) !important;
37
- transition:
38
- border-left 200ms ease-in-out,
39
- padding-left 200ms ease-in-out;
33
+ padding: 12px var(--spacing-medium);
34
+ border-bottom: 1px solid var(--md-sys-color-outline-variant);
35
+ transition: background-color 120ms ease;
40
36
  color: var(--md-sys-color-on-surface);
41
37
 
42
- --type-dot-size: 9px;
38
+ --type-dot-size: 8px;
43
39
  }
44
40
 
45
41
  :host([newbie]) {
46
- background-color: var(--md-sys-color-surface-variant);
42
+ background-color: var(--md-sys-color-surface-container-low, var(--md-sys-color-surface-variant));
47
43
  }
48
44
 
49
45
  :host(:hover) {
50
- padding-left: 0.5rem;
51
- border-left: 0.2rem solid var(--status-info-color);
46
+ background-color: var(--md-sys-color-surface-container-high, var(--md-sys-color-surface-variant));
52
47
  }
53
48
 
54
49
  [titler] {
55
50
  white-space: normal;
56
51
  overflow: hidden;
57
52
  text-overflow: ellipsis;
58
- font-size: var(--fontsize-large);
59
- font-weight: bold;
60
- color: var(--md-sys-color-secondary);
53
+ padding-right: 24px;
54
+ font-family: var(--md-sys-typescale-label-large-font, var(--theme-font, inherit));
55
+ font-size: var(--md-sys-typescale-label-large-size, 0.875rem);
56
+ line-height: var(--md-sys-typescale-label-large-line-height, 1.25rem);
57
+ font-weight: var(--md-sys-typescale-label-large-weight, 600);
58
+ color: var(--md-sys-color-on-surface);
61
59
  }
62
60
 
63
- [titler] span {
61
+ [titler] > span {
64
62
  display: inline-block;
65
63
  width: var(--type-dot-size);
66
64
  height: var(--type-dot-size);
@@ -74,62 +72,50 @@ let NotificationItem = class NotificationItem extends LitElement {
74
72
 
75
73
  [close] {
76
74
  position: absolute;
77
- top: 13px;
78
- right: 0;
79
- font-size: var(--fontsize-large);
75
+ top: 12px;
76
+ right: 12px;
77
+ --md-icon-size: 18px;
80
78
  opacity: 0.5;
81
79
  cursor: pointer;
82
80
  }
83
81
  [close]:hover {
84
82
  opacity: 1;
85
83
  }
86
- [detail] {
87
- padding: var(--spacing-small) var(--spacing-medium);
88
- border-radius: var(--border-radius);
89
- font-size: 0.85em;
90
- }
91
- span.more {
92
- margin-left: 16px;
93
- float: right;
94
- padding: 0px var(--spacing-small) 2px var(--spacing-small);
95
- border-radius: var(--border-radius);
96
- font-size: 0.8em;
97
- color: var(--md-sys-color-on-primary);
98
- --md-icon-size: 14px;
99
- }
100
- span.more * {
101
- vertical-align: middle;
102
- }
103
-
104
- :host([type='ERROR']) span {
105
- background-color: var(--status-danger-color);
84
+ [technical] {
85
+ margin-top: var(--spacing-small);
86
+ color: var(--md-sys-color-on-surface-variant);
87
+ font-family: var(--md-sys-typescale-label-small-font, var(--theme-font, inherit));
88
+ font-size: var(--md-sys-typescale-label-small-size, 0.75rem);
89
+ line-height: var(--md-sys-typescale-label-small-line-height, 1rem);
90
+ font-weight: var(--md-sys-typescale-label-small-weight, 400);
106
91
  }
107
- :host([type='ERROR']) {
108
- border-color: var(--status-danger-color);
92
+ [technical] summary {
93
+ cursor: pointer;
109
94
  }
110
- :host([type='ERROR']) [detail] {
111
- border: 1px solid rgba(241, 53, 63, 0.5);
112
- background-color: rgba(241, 53, 63, 0.1);
95
+ [technical] pre {
96
+ margin: var(--spacing-small) 0 0;
97
+ padding: var(--spacing-small);
98
+ max-height: 160px;
99
+ overflow: auto;
100
+ border-radius: var(--md-sys-shape-corner-small, 4px);
101
+ background: var(--md-sys-color-surface-container-high, var(--md-sys-color-surface-variant));
102
+ font: inherit;
103
+ white-space: pre-wrap;
104
+ overflow-wrap: anywhere;
105
+ }
106
+ :host([type='ERROR']) [titler] > span {
107
+ background-color: var(--status-danger-color);
113
108
  }
114
- :host([type='WARN']) span {
109
+ :host([type='WARN']) [titler] > span {
115
110
  background-color: var(--status-warning-color);
116
111
  }
117
- :host([type='WARN']) {
118
- border-color: var(--status-warning-color);
119
- }
120
- :host([type='SUCCESS']) span {
112
+ :host([type='SUCCESS']) [titler] > span {
121
113
  background-color: var(--status-success-color);
122
114
  }
123
- :host([type='SUCCESS']) {
124
- border-color: var(--status-success-color);
125
- }
126
- :host([type='INFO']) span,
127
- :host span {
115
+ :host([type='INFO']) [titler] > span,
116
+ [titler] > span {
128
117
  background-color: var(--status-info-color);
129
118
  }
130
- :host([type='INFO']) {
131
- border-color: var(--status-info-color);
132
- }
133
119
 
134
120
  img {
135
121
  display: block;
@@ -138,22 +124,29 @@ let NotificationItem = class NotificationItem extends LitElement {
138
124
  }
139
125
 
140
126
  [message] {
141
- font-size: var(--fontsize-default);
142
- color: var(--md-sys-color-secondary);
127
+ margin-top: var(--spacing-small);
128
+ font-family: var(--md-sys-typescale-body-medium-font, var(--theme-font, inherit));
129
+ font-size: var(--md-sys-typescale-body-medium-size, 0.875rem);
130
+ line-height: var(--md-sys-typescale-body-medium-line-height, 1.25rem);
131
+ font-weight: var(--md-sys-typescale-body-medium-weight, 400);
132
+ color: var(--md-sys-color-on-surface-variant);
143
133
  }
144
134
 
145
135
  [timestamp] {
136
+ margin-top: var(--spacing-small);
146
137
  white-space: nowrap;
147
- font-size: var(--fontsize-small);
138
+ font-family: var(--md-sys-typescale-label-small-font, var(--theme-font, inherit));
139
+ font-size: var(--md-sys-typescale-label-small-size, 0.75rem);
140
+ line-height: var(--md-sys-typescale-label-small-line-height, 1rem);
141
+ font-weight: var(--md-sys-typescale-label-small-weight, 400);
148
142
  color: var(--md-sys-color-on-surface-variant);
149
143
  }
150
144
  `
151
145
  ]; }
152
146
  render() {
153
- const { title, url, image, timestamp, body } = this.notification;
147
+ const { title, url, image, timestamp, body, ex } = this.notification;
154
148
  const target = this.target;
155
- const detail = this.detail;
156
- const type = this.type;
149
+ const technical = typeof ex === 'string' ? ex : '';
157
150
  return html `
158
151
  <div titler>
159
152
  <span></span>
@@ -173,16 +166,12 @@ let NotificationItem = class NotificationItem extends LitElement {
173
166
  : html `<img src=${image} />`
174
167
  : html ``}
175
168
  <div message>${body}</div>
176
- ${type == 'ERROR'
177
- ? html `<div
178
- @click=${() => {
179
- this.decipherErrorCode();
180
- }}
181
- >
182
- <span class="more"><md-icon>expand_circle_down</md-icon> more</span>
183
- </div>`
169
+ ${technical
170
+ ? html `<details technical>
171
+ <summary>${i18next.t('text.technical detail', { defaultValue: 'Technical details' })}</summary>
172
+ <pre>${technical}</pre>
173
+ </details>`
184
174
  : html ``}
185
- ${detail ? html `<div detail>${detail.message}</div>` : html ``}
186
175
 
187
176
  <div timestamp>${new Date(Number(timestamp)).toLocaleString()}</div>
188
177
  `;
@@ -197,32 +186,6 @@ let NotificationItem = class NotificationItem extends LitElement {
197
186
  const url = this.notification?.url;
198
187
  this.target = url && !isOriginSameAsLocation(url) && '_blank';
199
188
  }
200
- async decipherErrorCode() {
201
- if (this.type != 'ERROR' || !this.notification) {
202
- return;
203
- }
204
- const { title, body } = this.notification;
205
- var code = `${title}`;
206
- if (body) {
207
- code += `: ${body}`;
208
- }
209
- const response = await client.query({
210
- query: gql `
211
- query ($input: CodeDecipherInput!) {
212
- decipherErrorCode(input: $input) {
213
- message
214
- }
215
- }
216
- `,
217
- variables: {
218
- input: {
219
- code,
220
- system: ''
221
- }
222
- }
223
- });
224
- this.detail = response.data.decipherErrorCode;
225
- }
226
189
  };
227
190
  __decorate([
228
191
  property({ type: String, reflect: true }),
@@ -236,10 +199,6 @@ __decorate([
236
199
  property({ type: String }),
237
200
  __metadata("design:type", String)
238
201
  ], NotificationItem.prototype, "target", void 0);
239
- __decorate([
240
- property({ type: Object }),
241
- __metadata("design:type", Object)
242
- ], NotificationItem.prototype, "detail", void 0);
243
202
  __decorate([
244
203
  property({ type: Boolean }),
245
204
  __metadata("design:type", Boolean)
@@ -1 +1 @@
1
- {"version":3,"file":"notification-item.js","sourceRoot":"","sources":["../../client/viewparts/notification-item.ts"],"names":[],"mappings":";AAAA,OAAO,4BAA4B,CAAA;AAEnC,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AAEzC,SAAS,sBAAsB,CAAC,GAAG;IACjC,SAAS,WAAW,CAAC,QAAQ;QAC3B,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,CAAA;IACjD,CAAC;IAED,SAAS,MAAM,CAAC,QAAQ;QACtB,OAAO,QAAQ,CAAC,IAAI,IAAI,WAAW,CAAC,QAAQ,CAAC,QAAQ,IAAI,YAAY,CAAC,QAAQ,CAAC,CAAA;IACjF,CAAC;IAED,IAAI,CAAC;QACH,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AI,IAAI,CAAC,IAAI,IAAI,OAAO,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC;YAC/C,OAAM;QACR,CAAC;QAED,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC,YAAY,CAAA;QACzC,IAAI,IAAI,GAAG,GAAG,KAAK,EAAE,CAAA;QACrB,IAAI,IAAI,EAAE,CAAC;YACT,IAAI,IAAI,KAAK,IAAI,EAAE,CAAA;QACrB,CAAC;QAED,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC;YAClC,KAAK,EAAE,GAAG,CAAA;;;;;;OAMT;YACD,SAAS,EAAE;gBACT,KAAK,EAAE;oBACL,IAAI;oBACJ,MAAM,EAAE,EAAE;iBACX;aACF;SACF,CAAC,CAAA;QAEF,IAAI,CAAC,MAAM,GAAG,QAAQ,CAAC,IAAI,CAAC,iBAAiB,CAAA;IAC/C,CAAC;;AArF0C;IAA1C,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;8CAAc;AAC5B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;sDAAkB;AACjB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;gDAAgB;AACf;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;gDAAiD;AAC/C;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;;gDAAiB;AAjIlC,gBAAgB;IAD5B,aAAa,CAAC,mBAAmB,CAAC;GACtB,gBAAgB,CAmN5B","sourcesContent":["import '@material/web/icon/icon.js'\n\nimport gql from 'graphql-tag'\nimport { LitElement, html, css } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\nimport { client } from '@operato/graphql'\n\nfunction isOriginSameAsLocation(url) {\n function defaultPort(protocol) {\n return { 'http:': 80, 'https:': 443 }[protocol]\n }\n\n function portOf(location) {\n return location.port || defaultPort(location.protocol || pageLocation.protocol)\n }\n\n try {\n var pageLocation = window.location\n var urlparts = new URL(url, pageLocation.href)\n\n return !!(\n urlparts.protocol &&\n urlparts.protocol == pageLocation.protocol &&\n urlparts.host &&\n urlparts.host == pageLocation.host &&\n urlparts.host &&\n portOf(urlparts) == portOf(pageLocation)\n )\n } catch (err) {\n console.warn(err, url)\n }\n}\n\n@customElement('notification-item')\nexport class NotificationItem extends LitElement {\n static styles = [\n css`\n :host {\n position: relative;\n background-color: var(--md-sys-color-surface);\n padding: var(--spacing-medium);\n border-left: 0 solid transparent;\n border-bottom: 1px solid var(--md-sys-color-outline-variant) !important;\n transition:\n border-left 200ms ease-in-out,\n padding-left 200ms ease-in-out;\n color: var(--md-sys-color-on-surface);\n\n --type-dot-size: 9px;\n }\n\n :host([newbie]) {\n background-color: var(--md-sys-color-surface-variant);\n }\n\n :host(:hover) {\n padding-left: 0.5rem;\n border-left: 0.2rem solid var(--status-info-color);\n }\n\n [titler] {\n white-space: normal;\n overflow: hidden;\n text-overflow: ellipsis;\n font-size: var(--fontsize-large);\n font-weight: bold;\n color: var(--md-sys-color-secondary);\n }\n\n [titler] span {\n display: inline-block;\n width: var(--type-dot-size);\n height: var(--type-dot-size);\n border-radius: 50%;\n margin-right: var(--spacing-small);\n margin-bottom: var(--spacing-tiny);\n }\n [titler] * {\n vertical-align: middle;\n }\n\n [close] {\n position: absolute;\n top: 13px;\n right: 0;\n font-size: var(--fontsize-large);\n opacity: 0.5;\n cursor: pointer;\n }\n [close]:hover {\n opacity: 1;\n }\n [detail] {\n padding: var(--spacing-small) var(--spacing-medium);\n border-radius: var(--border-radius);\n font-size: 0.85em;\n }\n span.more {\n margin-left: 16px;\n float: right;\n padding: 0px var(--spacing-small) 2px var(--spacing-small);\n border-radius: var(--border-radius);\n font-size: 0.8em;\n color: var(--md-sys-color-on-primary);\n --md-icon-size: 14px;\n }\n span.more * {\n vertical-align: middle;\n }\n\n :host([type='ERROR']) span {\n background-color: var(--status-danger-color);\n }\n :host([type='ERROR']) {\n border-color: var(--status-danger-color);\n }\n :host([type='ERROR']) [detail] {\n border: 1px solid rgba(241, 53, 63, 0.5);\n background-color: rgba(241, 53, 63, 0.1);\n }\n :host([type='WARN']) span {\n background-color: var(--status-warning-color);\n }\n :host([type='WARN']) {\n border-color: var(--status-warning-color);\n }\n :host([type='SUCCESS']) span {\n background-color: var(--status-success-color);\n }\n :host([type='SUCCESS']) {\n border-color: var(--status-success-color);\n }\n :host([type='INFO']) span,\n :host span {\n background-color: var(--status-info-color);\n }\n :host([type='INFO']) {\n border-color: var(--status-info-color);\n }\n\n img {\n display: block;\n max-width: 100%;\n margin: auto;\n }\n\n [message] {\n font-size: var(--fontsize-default);\n color: var(--md-sys-color-secondary);\n }\n\n [timestamp] {\n white-space: nowrap;\n font-size: var(--fontsize-small);\n color: var(--md-sys-color-on-surface-variant);\n }\n `\n ]\n\n @property({ type: String, reflect: true }) type?: string\n @property({ type: Object }) notification: any\n @property({ type: String }) target?: string\n @property({ type: Object }) detail?: { message: string; [key: string]: any }\n @property({ type: Boolean }) newbie?: boolean\n\n render() {\n const { title, url, image, timestamp, body } = this.notification\n const target = this.target\n const detail = this.detail\n const type = this.type\n\n return html`\n <div titler>\n <span></span>\n ${url\n ? target\n ? html`<a href=${url} target=${target}>${title}</a>`\n : html`<a href=${url}>${title}</a>`\n : title}\n </div>\n <md-icon close @click=${e => this.dispatchEvent(new CustomEvent('close'))}>close</md-icon>\n\n ${image\n ? url\n ? target\n ? html`<a href=${url} target=${target}><img src=${image} /></a>`\n : html`<a href=${url}><img src=${image} /></a>`\n : html`<img src=${image} />`\n : html``}\n <div message>${body}</div>\n ${type == 'ERROR'\n ? html`<div\n @click=${() => {\n this.decipherErrorCode()\n }}\n >\n <span class=\"more\"><md-icon>expand_circle_down</md-icon> more</span>\n </div>`\n : html``}\n ${detail ? html`<div detail>${detail.message}</div>` : html``}\n\n <div timestamp>${new Date(Number(timestamp)).toLocaleString()}</div>\n `\n }\n\n updated(changed) {\n if (!this.notification?.confirmed) {\n this.setAttribute('newbie', '')\n } else {\n this.removeAttribute('newbie')\n }\n\n const url = this.notification?.url\n this.target = url && !isOriginSameAsLocation(url) && '_blank'\n }\n\n async decipherErrorCode() {\n if (this.type != 'ERROR' || !this.notification) {\n return\n }\n\n const { title, body } = this.notification\n var code = `${title}`\n if (body) {\n code += `: ${body}`\n }\n\n const response = await client.query({\n query: gql`\n query ($input: CodeDecipherInput!) {\n decipherErrorCode(input: $input) {\n message\n }\n }\n `,\n variables: {\n input: {\n code,\n system: ''\n }\n }\n })\n\n this.detail = response.data.decipherErrorCode\n }\n}\n"]}
1
+ {"version":3,"file":"notification-item.js","sourceRoot":"","sources":["../../client/viewparts/notification-item.ts"],"names":[],"mappings":";AAAA,OAAO,4BAA4B,CAAA;AAEnC,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAC3D,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAEvC,SAAS,sBAAsB,CAAC,GAAG;IACjC,SAAS,WAAW,CAAC,QAAQ;QAC3B,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,CAAA;IACjD,CAAC;IAED,SAAS,MAAM,CAAC,QAAQ;QACtB,OAAO,QAAQ,CAAC,IAAI,IAAI,WAAW,CAAC,QAAQ,CAAC,QAAQ,IAAI,YAAY,CAAC,QAAQ,CAAC,CAAA;IACjF,CAAC;IAED,IAAI,CAAC;QACH,IAAI,YAAY,GAAG,MAAM,CAAC,QAAQ,CAAA;QAClC,IAAI,QAAQ,GAAG,IAAI,GAAG,CAAC,GAAG,EAAE,YAAY,CAAC,IAAI,CAAC,CAAA;QAE9C,OAAO,CAAC,CAAC,CACP,QAAQ,CA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O,EAAE,CAAC;;gDAAiB;AA3HlC,gBAAgB;IAD5B,aAAa,CAAC,mBAAmB,CAAC;GACtB,gBAAgB,CA2K5B","sourcesContent":["import '@material/web/icon/icon.js'\n\nimport { LitElement, html, css } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\nimport { i18next } from '@operato/i18n'\n\nfunction isOriginSameAsLocation(url) {\n function defaultPort(protocol) {\n return { 'http:': 80, 'https:': 443 }[protocol]\n }\n\n function portOf(location) {\n return location.port || defaultPort(location.protocol || pageLocation.protocol)\n }\n\n try {\n var pageLocation = window.location\n var urlparts = new URL(url, pageLocation.href)\n\n return !!(\n urlparts.protocol &&\n urlparts.protocol == pageLocation.protocol &&\n urlparts.host &&\n urlparts.host == pageLocation.host &&\n urlparts.host &&\n portOf(urlparts) == portOf(pageLocation)\n )\n } catch (err) {\n console.warn(err, url)\n }\n}\n\n@customElement('notification-item')\nexport class NotificationItem extends LitElement {\n static styles = [\n css`\n :host {\n display: block;\n position: relative;\n padding: 12px var(--spacing-medium);\n border-bottom: 1px solid var(--md-sys-color-outline-variant);\n transition: background-color 120ms ease;\n color: var(--md-sys-color-on-surface);\n\n --type-dot-size: 8px;\n }\n\n :host([newbie]) {\n background-color: var(--md-sys-color-surface-container-low, var(--md-sys-color-surface-variant));\n }\n\n :host(:hover) {\n background-color: var(--md-sys-color-surface-container-high, var(--md-sys-color-surface-variant));\n }\n\n [titler] {\n white-space: normal;\n overflow: hidden;\n text-overflow: ellipsis;\n padding-right: 24px;\n font-family: var(--md-sys-typescale-label-large-font, var(--theme-font, inherit));\n font-size: var(--md-sys-typescale-label-large-size, 0.875rem);\n line-height: var(--md-sys-typescale-label-large-line-height, 1.25rem);\n font-weight: var(--md-sys-typescale-label-large-weight, 600);\n color: var(--md-sys-color-on-surface);\n }\n\n [titler] > span {\n display: inline-block;\n width: var(--type-dot-size);\n height: var(--type-dot-size);\n border-radius: 50%;\n margin-right: var(--spacing-small);\n margin-bottom: var(--spacing-tiny);\n }\n [titler] * {\n vertical-align: middle;\n }\n\n [close] {\n position: absolute;\n top: 12px;\n right: 12px;\n --md-icon-size: 18px;\n opacity: 0.5;\n cursor: pointer;\n }\n [close]:hover {\n opacity: 1;\n }\n [technical] {\n margin-top: var(--spacing-small);\n color: var(--md-sys-color-on-surface-variant);\n font-family: var(--md-sys-typescale-label-small-font, var(--theme-font, inherit));\n font-size: var(--md-sys-typescale-label-small-size, 0.75rem);\n line-height: var(--md-sys-typescale-label-small-line-height, 1rem);\n font-weight: var(--md-sys-typescale-label-small-weight, 400);\n }\n [technical] summary {\n cursor: pointer;\n }\n [technical] pre {\n margin: var(--spacing-small) 0 0;\n padding: var(--spacing-small);\n max-height: 160px;\n overflow: auto;\n border-radius: var(--md-sys-shape-corner-small, 4px);\n background: var(--md-sys-color-surface-container-high, var(--md-sys-color-surface-variant));\n font: inherit;\n white-space: pre-wrap;\n overflow-wrap: anywhere;\n }\n :host([type='ERROR']) [titler] > span {\n background-color: var(--status-danger-color);\n }\n :host([type='WARN']) [titler] > span {\n background-color: var(--status-warning-color);\n }\n :host([type='SUCCESS']) [titler] > span {\n background-color: var(--status-success-color);\n }\n :host([type='INFO']) [titler] > span,\n [titler] > span {\n background-color: var(--status-info-color);\n }\n\n img {\n display: block;\n max-width: 100%;\n margin: auto;\n }\n\n [message] {\n margin-top: var(--spacing-small);\n font-family: var(--md-sys-typescale-body-medium-font, var(--theme-font, inherit));\n font-size: var(--md-sys-typescale-body-medium-size, 0.875rem);\n line-height: var(--md-sys-typescale-body-medium-line-height, 1.25rem);\n font-weight: var(--md-sys-typescale-body-medium-weight, 400);\n color: var(--md-sys-color-on-surface-variant);\n }\n\n [timestamp] {\n margin-top: var(--spacing-small);\n white-space: nowrap;\n font-family: var(--md-sys-typescale-label-small-font, var(--theme-font, inherit));\n font-size: var(--md-sys-typescale-label-small-size, 0.75rem);\n line-height: var(--md-sys-typescale-label-small-line-height, 1rem);\n font-weight: var(--md-sys-typescale-label-small-weight, 400);\n color: var(--md-sys-color-on-surface-variant);\n }\n `\n ]\n\n @property({ type: String, reflect: true }) type?: string\n @property({ type: Object }) notification: any\n @property({ type: String }) target?: string\n @property({ type: Boolean }) newbie?: boolean\n\n render() {\n const { title, url, image, timestamp, body, ex } = this.notification\n const target = this.target\n const technical = typeof ex === 'string' ? ex : ''\n\n return html`\n <div titler>\n <span></span>\n ${url\n ? target\n ? html`<a href=${url} target=${target}>${title}</a>`\n : html`<a href=${url}>${title}</a>`\n : title}\n </div>\n <md-icon close @click=${e => this.dispatchEvent(new CustomEvent('close'))}>close</md-icon>\n\n ${image\n ? url\n ? target\n ? html`<a href=${url} target=${target}><img src=${image} /></a>`\n : html`<a href=${url}><img src=${image} /></a>`\n : html`<img src=${image} />`\n : html``}\n <div message>${body}</div>\n ${technical\n ? html`<details technical>\n <summary>${i18next.t('text.technical detail', { defaultValue: 'Technical details' })}</summary>\n <pre>${technical}</pre>\n </details>`\n : html``}\n\n <div timestamp>${new Date(Number(timestamp)).toLocaleString()}</div>\n `\n }\n\n updated(changed) {\n if (!this.notification?.confirmed) {\n this.setAttribute('newbie', '')\n } else {\n this.removeAttribute('newbie')\n }\n\n const url = this.notification?.url\n this.target = url && !isOriginSameAsLocation(url) && '_blank'\n }\n\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  import '@material/web/icon/icon.js';
2
- import '@material/web/button/elevated-button.js';
2
+ import '@material/web/button/text-button.js';
3
3
  import './notification-item';
4
4
  import { LitElement } from 'lit';
5
5
  declare const NotificationList_base: (new (...args: any[]) => LitElement) & typeof LitElement;
@@ -1,6 +1,6 @@
1
1
  import { __decorate, __metadata } from "tslib";
2
2
  import '@material/web/icon/icon.js';
3
- import '@material/web/button/elevated-button.js';
3
+ import '@material/web/button/text-button.js';
4
4
  import './notification-item';
5
5
  import { LitElement, html, css } from 'lit';
6
6
  import { customElement, property } from 'lit/decorators.js';
@@ -16,13 +16,10 @@ let NotificationList = class NotificationList extends localize(i18next)(LitEleme
16
16
  css `
17
17
  :host {
18
18
  display: block;
19
- background-color: var(--md-sys-color-surface);
20
- box-shadow: var(--box-shadow);
21
- margin-right: var(--spacing-large);
22
- padding: var(--spacing-medium);
23
19
  max-height: 100%;
24
20
  overflow-x: hidden;
25
21
  overflow-y: auto;
22
+ color: var(--md-sys-color-on-surface);
26
23
  }
27
24
 
28
25
  [notifications-wrap] {
@@ -30,20 +27,24 @@ let NotificationList = class NotificationList extends localize(i18next)(LitEleme
30
27
  flex-direction: column;
31
28
  justify-content: flex-start;
32
29
  }
33
- [notifications-wrap] div {
34
- align-items: stretch;
35
- border-bottom: 1px solid var(--md-sys-color-primary);
30
+ [header] {
31
+ display: flex;
32
+ align-items: center;
33
+ justify-content: space-between;
34
+ min-height: 48px;
35
+ padding: 0 var(--spacing-medium);
36
+ border-bottom: 1px solid var(--md-sys-color-outline-variant);
36
37
  }
37
- [notifications-wrap] strong {
38
- color: var(--md-sys-color-primary);
39
- text-transform: capitalize;
40
- line-height: 2;
38
+ [header] strong {
39
+ font-family: var(--md-sys-typescale-title-small-font, var(--theme-font, inherit));
40
+ font-size: var(--md-sys-typescale-title-small-size, 0.875rem);
41
+ line-height: var(--md-sys-typescale-title-small-line-height, 1.25rem);
42
+ font-weight: var(--md-sys-typescale-title-small-weight, 600);
43
+ color: var(--md-sys-color-on-surface);
41
44
  }
42
- [notifications-wrap] md-elevated-button {
43
- --md-elevated-button-container-height: 24px;
44
- float: right;
45
- padding-inline-start: 6px;
46
- padding-inline-end: 12px;
45
+ [header] md-text-button {
46
+ --md-text-button-container-height: 32px;
47
+ --md-text-button-label-text-size: 0.8125rem;
47
48
  }
48
49
  [no-notifications] {
49
50
  margin: 0;
@@ -53,7 +54,7 @@ let NotificationList = class NotificationList extends localize(i18next)(LitEleme
53
54
  font-weight: bold;
54
55
  color: var(--md-sys-color-secondary);
55
56
  }
56
- div md-icon {
57
+ [no-notifications] md-icon {
57
58
  display: block;
58
59
  opacity: 0.3;
59
60
  }
@@ -66,14 +67,15 @@ let NotificationList = class NotificationList extends localize(i18next)(LitEleme
66
67
  `
67
68
  ]; }
68
69
  render() {
69
- var history = this.history.reverse();
70
+ /* reverse()는 store에서 받은 배열 자체를 뒤집는다. 렌더링만 최신순으로 보인다. */
71
+ const history = [...this.history].reverse();
70
72
  return history.length > 0
71
73
  ? html `
72
74
  <div notifications-wrap>
73
- <div>
75
+ <div header>
74
76
  <strong>${i18next.t('label.notification list')}</strong>
75
- <md-elevated-button outlined dense @click=${e => this.onclearall()}
76
- ><md-icon slot="icon">delete_outline</md-icon>${String(i18next.t('label.clear all'))}</md-elevated-button
77
+ <md-text-button @click=${e => this.onclearall()}
78
+ ><md-icon slot="icon">delete_outline</md-icon>${String(i18next.t('label.clear all'))}</md-text-button
77
79
  >
78
80
  </div>
79
81
  ${history.map(notification => html `
@@ -1 +1 @@
1
- {"version":3,"file":"notification-list.js","sourceRoot":"","sources":["../../client/viewparts/notification-list.ts"],"names":[],"mappings":";AAAA,OAAO,4BAA4B,CAAA;AACnC,OAAO,yCAAyC,CAAA;AAChD,OAAO,qBAAqB,CAAA;AAE5B,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAC3D,OAAO,EAAE,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AACzD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAA;AAG1D,IAAM,gBAAgB,GAAtB,MAAM,gBAAiB,SAAQ,QAAQ,CAAC,OAAO,CAAC,CAAC,UAAU,CAAC;IAA5D;;QAuDsB,YAAO,GAAU,EAAE,CAAA;IAiHhD,CAAC;aAvKQ,WAAM,GAAG;QACd,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAkDF;KACF,AApD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,OAAO,EAAE,CAAC,GAAG,OAAO,CAAC;aACtB,CAAC,CAAA;QACJ,CAAC,CAAQ,CAAC,CAAA;IACZ,CAAC;;AAhH0B;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;;iDAAoB;AAvDnC,gBAAgB;IAD5B,aAAa,CAAC,mBAAmB,CAAC;GACtB,gBAAgB,CAwK5B","sourcesContent":["import '@material/web/icon/icon.js'\nimport '@material/web/button/elevated-button.js'\nimport './notification-item'\n\nimport { LitElement, html, css } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\nimport { store, notificationStore } from '@operato/shell'\nimport { i18next, localize } from '@operato/i18n'\nimport { UPDATE_NOTIFICATION } from '../actions/notification-fcm'\n\n@customElement('notification-list')\nexport class NotificationList extends localize(i18next)(LitElement) {\n static styles = [\n css`\n :host {\n display: block;\n background-color: var(--md-sys-color-surface);\n box-shadow: var(--box-shadow);\n margin-right: var(--spacing-large);\n padding: var(--spacing-medium);\n max-height: 100%;\n overflow-x: hidden;\n overflow-y: auto;\n }\n\n [notifications-wrap] {\n display: flex;\n flex-direction: column;\n justify-content: flex-start;\n }\n [notifications-wrap] div {\n align-items: stretch;\n border-bottom: 1px solid var(--md-sys-color-primary);\n }\n [notifications-wrap] strong {\n color: var(--md-sys-color-primary);\n text-transform: capitalize;\n line-height: 2;\n }\n [notifications-wrap] md-elevated-button {\n --md-elevated-button-container-height: 24px;\n float: right;\n padding-inline-start: 6px;\n padding-inline-end: 12px;\n }\n [no-notifications] {\n margin: 0;\n padding: var(--spacing-large);\n text-align: center;\n font-size: var(--fontsize-default);\n font-weight: bold;\n color: var(--md-sys-color-secondary);\n }\n div md-icon {\n display: block;\n opacity: 0.3;\n }\n @media screen and (max-width: 480px) {\n :host {\n height: 100%;\n width: 100vw;\n }\n }\n `\n ]\n\n @property({ type: Array }) history: any[] = []\n\n render() {\n var history = this.history.reverse()\n\n return history.length > 0\n ? html`\n <div notifications-wrap>\n <div>\n <strong>${i18next.t('label.notification list')}</strong>\n <md-elevated-button outlined dense @click=${e => this.onclearall()}\n ><md-icon slot=\"icon\">delete_outline</md-icon>${String(\n i18next.t('label.clear all')\n )}</md-elevated-button\n >\n </div>\n ${history.map(\n notification => html`\n <notification-item\n @close=${e => {\n this.onClose(notification)\n }}\n .type=${notification.type}\n .notification=${notification}\n ></notification-item>\n `\n )}\n </div>\n `\n : html`\n <div no-notifications @click=${e => window.history.back()}>\n <md-icon>notifications_off</md-icon>${i18next.t('text.no notification available')}\n </div>\n `\n }\n\n onClose(notification) {\n const { id } = notification\n\n store.dispatch((async dispatch => {\n if (notification) {\n await notificationStore.delete(id)\n }\n\n const history = await notificationStore.getAll()\n\n dispatch({\n type: UPDATE_NOTIFICATION,\n history: [...history]\n })\n }) as any)\n }\n\n onclearall() {\n store.dispatch((async dispatch => {\n await notificationStore.clear()\n const history = await notificationStore.getAll()\n\n dispatch({\n type: UPDATE_NOTIFICATION,\n history: [...history]\n })\n }) as any)\n }\n\n private _unsubscribe?: () => void\n\n\n private _applyState() {\n\n const __state__ = store.getState() as any\n this.history = __state__.notification.history\n\n }\n\n\n connectedCallback() {\n\n super.connectedCallback()\n\n this._applyState()\n\n this._unsubscribe = store.subscribe(() => this._applyState())\n\n }\n\n\n async disconnectedCallback() {\n\n super.disconnectedCallback()\n\n this._unsubscribe?.()\n\n await Promise.all(\n this.history\n .filter(notification => !notification.confirmed)\n .map(async notification => {\n return await notificationStore.put({\n ...notification,\n confirmed: true\n })\n })\n )\n\n store.dispatch((async dispatch => {\n const history = await notificationStore.getAll()\n\n dispatch({\n type: UPDATE_NOTIFICATION,\n history: [...history]\n })\n }) as any)\n }\n}\n"]}
1
+ {"version":3,"file":"notification-list.js","sourceRoot":"","sources":["../../client/viewparts/notification-list.ts"],"names":[],"mappings":";AAAA,OAAO,4BAA4B,CAAA;AACnC,OAAO,qCAAqC,CAAA;AAC5C,OAAO,qBAAqB,CAAA;AAE5B,OAAO,EAAE,UAAU,EAAE,IAAI,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B;QAExB,KAAK,CAAC,oBAAoB,EAAE,CAAA;QAE5B,IAAI,CAAC,YAAY,EAAE,EAAE,CAAA;QAErB,MAAM,OAAO,CAAC,GAAG,CACf,IAAI,CAAC,OAAO;aACT,MAAM,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC,YAAY,CAAC,SAAS,CAAC;aAC/C,GAAG,CAAC,KAAK,EAAC,YAAY,EAAC,EAAE;YACxB,OAAO,MAAM,iBAAiB,CAAC,GAAG,CAAC;gBACjC,GAAG,YAAY;gBACf,SAAS,EAAE,IAAI;aAChB,CAAC,CAAA;QACJ,CAAC,CAAC,CACL,CAAA;QAED,KAAK,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAC,QAAQ,EAAC,EAAE;YAC/B,MAAM,OAAO,GAAG,MAAM,iBAAiB,CAAC,MAAM,EAAE,CAAA;YAEhD,QAAQ,CAAC;gBACP,IAAI,EAAE,mBAAmB;gBACzB,OAAO,EAAE,CAAC,GAAG,OAAO,CAAC;aACtB,CAAC,CAAA;QACJ,CAAC,CAAQ,CAAC,CAAA;IACZ,CAAC;;AAjH0B;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;;iDAAoB;AAxDnC,gBAAgB;IAD5B,aAAa,CAAC,mBAAmB,CAAC;GACtB,gBAAgB,CA0K5B","sourcesContent":["import '@material/web/icon/icon.js'\nimport '@material/web/button/text-button.js'\nimport './notification-item'\n\nimport { LitElement, html, css } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\nimport { store, notificationStore } from '@operato/shell'\nimport { i18next, localize } from '@operato/i18n'\nimport { UPDATE_NOTIFICATION } from '../actions/notification-fcm'\n\n@customElement('notification-list')\nexport class NotificationList extends localize(i18next)(LitElement) {\n static styles = [\n css`\n :host {\n display: block;\n max-height: 100%;\n overflow-x: hidden;\n overflow-y: auto;\n color: var(--md-sys-color-on-surface);\n }\n\n [notifications-wrap] {\n display: flex;\n flex-direction: column;\n justify-content: flex-start;\n }\n [header] {\n display: flex;\n align-items: center;\n justify-content: space-between;\n min-height: 48px;\n padding: 0 var(--spacing-medium);\n border-bottom: 1px solid var(--md-sys-color-outline-variant);\n }\n [header] strong {\n font-family: var(--md-sys-typescale-title-small-font, var(--theme-font, inherit));\n font-size: var(--md-sys-typescale-title-small-size, 0.875rem);\n line-height: var(--md-sys-typescale-title-small-line-height, 1.25rem);\n font-weight: var(--md-sys-typescale-title-small-weight, 600);\n color: var(--md-sys-color-on-surface);\n }\n [header] md-text-button {\n --md-text-button-container-height: 32px;\n --md-text-button-label-text-size: 0.8125rem;\n }\n [no-notifications] {\n margin: 0;\n padding: var(--spacing-large);\n text-align: center;\n font-size: var(--fontsize-default);\n font-weight: bold;\n color: var(--md-sys-color-secondary);\n }\n [no-notifications] md-icon {\n display: block;\n opacity: 0.3;\n }\n @media screen and (max-width: 480px) {\n :host {\n height: 100%;\n width: 100vw;\n }\n }\n `\n ]\n\n @property({ type: Array }) history: any[] = []\n\n render() {\n /* reverse()는 store에서 받은 배열 자체를 뒤집는다. 렌더링만 최신순으로 보인다. */\n const history = [...this.history].reverse()\n\n return history.length > 0\n ? html`\n <div notifications-wrap>\n <div header>\n <strong>${i18next.t('label.notification list')}</strong>\n <md-text-button @click=${e => this.onclearall()}\n ><md-icon slot=\"icon\">delete_outline</md-icon>${String(\n i18next.t('label.clear all')\n )}</md-text-button\n >\n </div>\n ${history.map(\n notification => html`\n <notification-item\n @close=${e => {\n this.onClose(notification)\n }}\n .type=${notification.type}\n .notification=${notification}\n ></notification-item>\n `\n )}\n </div>\n `\n : html`\n <div no-notifications @click=${e => window.history.back()}>\n <md-icon>notifications_off</md-icon>${i18next.t('text.no notification available')}\n </div>\n `\n }\n\n onClose(notification) {\n const { id } = notification\n\n store.dispatch((async dispatch => {\n if (notification) {\n await notificationStore.delete(id)\n }\n\n const history = await notificationStore.getAll()\n\n dispatch({\n type: UPDATE_NOTIFICATION,\n history: [...history]\n })\n }) as any)\n }\n\n onclearall() {\n store.dispatch((async dispatch => {\n await notificationStore.clear()\n const history = await notificationStore.getAll()\n\n dispatch({\n type: UPDATE_NOTIFICATION,\n history: [...history]\n })\n }) as any)\n }\n\n private _unsubscribe?: () => void\n\n\n private _applyState() {\n\n const __state__ = store.getState() as any\n this.history = __state__.notification.history\n\n }\n\n\n connectedCallback() {\n\n super.connectedCallback()\n\n this._applyState()\n\n this._unsubscribe = store.subscribe(() => this._applyState())\n\n }\n\n\n async disconnectedCallback() {\n\n super.disconnectedCallback()\n\n this._unsubscribe?.()\n\n await Promise.all(\n this.history\n .filter(notification => !notification.confirmed)\n .map(async notification => {\n return await notificationStore.put({\n ...notification,\n confirmed: true\n })\n })\n )\n\n store.dispatch((async dispatch => {\n const history = await notificationStore.getAll()\n\n dispatch({\n type: UPDATE_NOTIFICATION,\n history: [...history]\n })\n }) as any)\n }\n}\n"]}