@operato/contact 1.1.66 → 1.1.68

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,26 @@
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
+ ### [1.1.68](https://github.com/hatiolab/operato/compare/v1.1.67...v1.1.68) (2023-01-15)
7
+
8
+
9
+ ### :bug: Bug Fix
10
+
11
+ * ox-pfp button font-size ([f0c59aa](https://github.com/hatiolab/operato/commit/f0c59aa6ccc1b503bff54309acbeeba6c41a474b))
12
+ * ox-pfp type ([33e8218](https://github.com/hatiolab/operato/commit/33e82185a89001b544b6aa93001cc46d69074730))
13
+ * titles for ox-pfp-edit ([2d9ff25](https://github.com/hatiolab/operato/commit/2d9ff256d95018e3b0a4b196e4d11bf2f6312307))
14
+
15
+
16
+
17
+ ### [1.1.67](https://github.com/hatiolab/operato/compare/v1.1.66...v1.1.67) (2023-01-14)
18
+
19
+
20
+ ### :bug: Bug Fix
21
+
22
+ * contact ([dfff207](https://github.com/hatiolab/operato/commit/dfff2078554eb8704619e19e8f764a249d583fbf))
23
+
24
+
25
+
6
26
  ### [1.1.66](https://github.com/hatiolab/operato/compare/v1.1.65...v1.1.66) (2023-01-11)
7
27
 
8
28
  **Note:** Version bump only for package @operato/contact
package/demo/index.html CHANGED
@@ -21,13 +21,9 @@
21
21
  import '../dist/src/ox-contact.js'
22
22
 
23
23
  var contact = {
24
+ name: '남 상혁',
25
+ company: 'Hatiolab',
24
26
  items: [
25
- {
26
- id: '1',
27
- type: 'name',
28
- label: 'name',
29
- value: '남 상혁'
30
- },
31
27
  {
32
28
  id: '2',
33
29
  type: 'phone',
@@ -7,6 +7,8 @@ export declare class OxContactEdit extends LitElement {
7
7
  static styles: import("lit").CSSResult[];
8
8
  contact: Contact;
9
9
  private stageContact;
10
+ name: HTMLTextAreaElement;
11
+ company: HTMLTextAreaElement;
10
12
  note: HTMLTextAreaElement;
11
13
  pfp: OxPfp;
12
14
  fields: NodeListOf<HTMLDivElement>;
@@ -15,7 +17,7 @@ export declare class OxContactEdit extends LitElement {
15
17
  buildItems(): ContactItem[];
16
18
  buildStageContact(): void;
17
19
  onChangeItem(e: Event, item: ContactItem): void;
18
- onSave(): void;
19
- onCancel(): void;
20
- onReset(): void;
20
+ save(): void;
21
+ cancel(): void;
22
+ reset(): void;
21
23
  }
@@ -3,7 +3,6 @@ import '@material/mwc-icon-button';
3
3
  import './ox-pfp.js';
4
4
  import { html, css, LitElement } from 'lit';
5
5
  import { customElement, property, state, query, queryAll } from 'lit/decorators.js';
6
- import { ContactField } from './ox-contact';
7
6
  import { ScrollbarStyles } from '@operato/styles';
8
7
  let OxContactEdit = class OxContactEdit extends LitElement {
9
8
  constructor() {
@@ -12,8 +11,7 @@ let OxContactEdit = class OxContactEdit extends LitElement {
12
11
  this.stageContact = JSON.parse(JSON.stringify(this.contact));
13
12
  }
14
13
  render() {
15
- var _a;
16
- const { profile, items = [], note } = this.stageContact || {};
14
+ const { profile, items = [], name, company, note } = this.stageContact || {};
17
15
  var sorted = {};
18
16
  items.forEach(item => {
19
17
  if (!sorted[item.type]) {
@@ -23,25 +21,19 @@ let OxContactEdit = class OxContactEdit extends LitElement {
23
21
  sorted[item.type].push(item);
24
22
  }
25
23
  });
26
- const names = [...(sorted[ContactField.Name] || [{ type: ContactField.Name, label: 'name', value: '' }])];
27
- const companies = [
28
- ...(sorted[ContactField.Company] || [{ type: ContactField.Company, label: 'company', value: '' }])
29
- ];
30
24
  return html `
31
25
  <div name>
32
- <ox-pfp .profile=${profile} .name=${(_a = names[0]) === null || _a === void 0 ? void 0 : _a.value}></ox-pfp>
26
+ <ox-pfp .profile=${profile} .name=${name}></ox-pfp>
33
27
 
34
28
  <div name-content>
35
- ${names.map(item => html `<div @change=${(e) => this.onChangeItem(e, item)} .item=${item} field>
36
- <span>name</span>
37
- <input type="hidden" .value=${item.label} data-item="label" disabled />
38
- <input type="text" .value=${item.value} data-item="value" />
39
- </div>`)}
40
- ${companies.map(item => html `<div @change=${(e) => this.onChangeItem(e, item)} .item=${item} field>
41
- <span>company</span>
42
- <input type="hidden" .value=${item.label} data-item="label" disabled />
43
- <input type="text" .value=${item.value} data-item="value" />
44
- </div>`)}
29
+ <div @change=${(e) => this.buildStageContact()}>
30
+ <span>name</span>
31
+ <input type="text" id="name" .value=${name !== null && name !== void 0 ? name : ''} />
32
+ </div>
33
+ <div @change=${(e) => this.buildStageContact()}>
34
+ <span>company</span>
35
+ <input type="text" id="company" .value=${company !== null && company !== void 0 ? company : ''} />
36
+ </div>
45
37
  </div>
46
38
  </div>
47
39
  ${['email', 'phone', 'address'].map(type => {
@@ -49,7 +41,7 @@ let OxContactEdit = class OxContactEdit extends LitElement {
49
41
  return html `
50
42
  <div data-type=${type}>
51
43
  ${type}
52
- ${items.map(item => html `<div @change=${(e) => this.onChangeItem(e, item)} .item=${item} field>
44
+ ${items.map(item => html `<div @change=${(e) => this.onChangeItem(e, item)} .item=${item} item-field>
53
45
  ${item.value
54
46
  ? html `<mwc-icon-button
55
47
  icon="cancel"
@@ -71,12 +63,6 @@ let OxContactEdit = class OxContactEdit extends LitElement {
71
63
  note
72
64
  <textarea id="note" .value=${note || ''} @change=${() => this.buildStageContact()}></textarea>
73
65
  </div>
74
-
75
- <div buttons>
76
- <button value="Done" @click=${() => this.onSave()}>Done</button>
77
- <button value="Cancel" @click=${() => this.onCancel()}>Cancel</button>
78
- <button value="Reset" @click=${() => this.onReset()}>Reset</button>
79
- </div>
80
66
  `;
81
67
  }
82
68
  updated(changes) {
@@ -98,32 +84,34 @@ let OxContactEdit = class OxContactEdit extends LitElement {
98
84
  this.stageContact = {
99
85
  ...this.stageContact,
100
86
  profile: this.pfp.profile,
87
+ name: this.name.value,
88
+ company: this.company.value,
101
89
  note: this.note.value,
102
90
  items: this.buildItems()
103
91
  };
104
92
  }
105
93
  onChangeItem(e, item) {
106
94
  const target = e.currentTarget;
107
- const labelElement = target.querySelector('[data-item="label"');
108
- const valueElement = target.querySelector('[data-item="value"');
95
+ const labelElement = target.querySelector('[data-item="label"]');
96
+ const valueElement = target.querySelector('[data-item="value"]');
109
97
  item.label = labelElement.value;
110
98
  item.value = valueElement.value;
111
99
  if (e.target === valueElement || item.value) {
112
100
  this.buildStageContact();
113
101
  }
114
102
  }
115
- onSave() {
103
+ save() {
116
104
  this.buildStageContact();
117
105
  this.dispatchEvent(new CustomEvent('edit-done', {
118
106
  detail: this.stageContact
119
107
  }));
120
108
  }
121
- onCancel() {
109
+ cancel() {
122
110
  this.dispatchEvent(new CustomEvent('edit-cancel', {
123
111
  detail: this.stageContact
124
112
  }));
125
113
  }
126
- onReset() {
114
+ reset() {
127
115
  this.buildStageContact();
128
116
  this.stageContact = JSON.parse(JSON.stringify(this.contact));
129
117
  }
@@ -208,12 +196,6 @@ OxContactEdit.styles = [
208
196
  width: 100%;
209
197
  height: 100px;
210
198
  }
211
-
212
- div[buttons] {
213
- display: flex;
214
- flex-direction: row-reverse;
215
- gap: 10px;
216
- }
217
199
  `
218
200
  ];
219
201
  __decorate([
@@ -222,6 +204,12 @@ __decorate([
222
204
  __decorate([
223
205
  state()
224
206
  ], OxContactEdit.prototype, "stageContact", void 0);
207
+ __decorate([
208
+ query('#name')
209
+ ], OxContactEdit.prototype, "name", void 0);
210
+ __decorate([
211
+ query('#company')
212
+ ], OxContactEdit.prototype, "company", void 0);
225
213
  __decorate([
226
214
  query('#note')
227
215
  ], OxContactEdit.prototype, "note", void 0);
@@ -229,7 +217,7 @@ __decorate([
229
217
  query('ox-pfp')
230
218
  ], OxContactEdit.prototype, "pfp", void 0);
231
219
  __decorate([
232
- queryAll('[field]')
220
+ queryAll('[item-field]')
233
221
  ], OxContactEdit.prototype, "fields", void 0);
234
222
  OxContactEdit = __decorate([
235
223
  customElement('ox-contact-edit')
@@ -1 +1 @@
1
- {"version":3,"file":"ox-contact-edit.js","sourceRoot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C,OAAO,CAAC,CAAC,CAAA;IAC9D,CAAC;;AAhPM,oBAAM,GAAG;IACd,eAAe;IACf,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAoFF;CACF,CAAA;AAE2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8CAAsB;AAExC;IAAR,KAAK,EAAE;mDAAyE;AAEjE;IAAf,KAAK,CAAC,OAAO,CAAC;2CAA2B;AACzB;IAAhB,KAAK,CAAC,QAAQ,CAAC;0CAAY;AACP;IAApB,QAAQ,CAAC,SAAS,CAAC;6CAAoC;AAhG7C,aAAa;IADzB,aAAa,CAAC,iBAAiB,CAAC;GACpB,aAAa,CAkPzB;SAlPY,aAAa","sourcesContent":["import '@material/mwc-icon-button'\nimport './ox-pfp.js'\n\nimport { html, css, LitElement, PropertyValues } from 'lit'\nimport { customElement, property, state, query, queryAll } from 'lit/decorators.js'\nimport { Contact, ContactField, ContactItem } from './ox-contact'\nimport { ScrollbarStyles } from '@operato/styles'\nimport { OxPfp } from './ox-pfp.js'\n\n@customElement('ox-contact-edit')\nexport class OxContactEdit extends LitElement {\n static styles = [\n ScrollbarStyles,\n css`\n :host {\n display: block;\n padding: 25px;\n\n --mdc-icon-button-size: 16px;\n --mdc-icon-size: 16px;\n }\n\n :host > div {\n padding: 10px 0;\n display: block;\n border-bottom: 1px solid blue;\n }\n\n :host > div > div {\n padding: 4px 0;\n box-sizing: border-box;\n\n display: flex;\n flex-direction: row;\n gap: 10px;\n }\n\n :host > div > div:hover {\n position: relative;\n }\n\n [data-item='label'] {\n width: 100px;\n text-align: right;\n }\n\n [data-item='value'] {\n flex: 1;\n }\n\n :host > div[name] {\n display: flex;\n align-items: center;\n gap: 10px;\n font-weight: bold;\n font-size: 1.4em;\n }\n\n :host ox-pfp {\n display: inline-block;\n width: 100px;\n height: 100px;\n }\n\n :host > div[name] > div[name-content] {\n flex: 1;\n\n display: flex;\n flex-direction: column;\n }\n\n div[field] {\n display: flex;\n flex-direction: row;\n align-items: center;\n gap: 10px;\n }\n\n div[field] > span {\n width: 100px;\n text-align: right;\n }\n\n div[field] > input {\n flex: 1;\n }\n\n textarea {\n width: 100%;\n height: 100px;\n }\n\n div[buttons] {\n display: flex;\n flex-direction: row-reverse;\n gap: 10px;\n }\n `\n ]\n\n @property({ type: Object }) contact: Contact = {}\n\n @state() private stageContact: Contact = JSON.parse(JSON.stringify(this.contact))\n\n @query('#note') note!: HTMLTextAreaElement\n @query('ox-pfp') pfp!: OxPfp\n @queryAll('[field]') fields!: NodeListOf<HTMLDivElement>\n\n render() {\n const { profile, items = [], note } = this.stageContact || {}\n var sorted: { [type: string]: ContactItem[] } = {}\n\n items.forEach(item => {\n if (!sorted[item.type as string]) {\n sorted[item.type] = [item]\n } else {\n sorted[item.type as string].push(item)\n }\n })\n\n const names = [...(sorted[ContactField.Name] || [{ type: ContactField.Name, label: 'name', value: '' }])]\n const companies = [\n ...(sorted[ContactField.Company] || [{ type: ContactField.Company, label: 'company', value: '' }])\n ]\n\n return html`\n <div name>\n <ox-pfp .profile=${profile} .name=${names[0]?.value}></ox-pfp>\n\n <div name-content>\n ${names.map(\n item => html`<div @change=${(e: Event) => this.onChangeItem(e, item)} .item=${item} field>\n <span>name</span>\n <input type=\"hidden\" .value=${item.label} data-item=\"label\" disabled />\n <input type=\"text\" .value=${item.value} data-item=\"value\" />\n </div>`\n )}\n ${companies.map(\n item => html`<div @change=${(e: Event) => this.onChangeItem(e, item)} .item=${item} field>\n <span>company</span>\n <input type=\"hidden\" .value=${item.label} data-item=\"label\" disabled />\n <input type=\"text\" .value=${item.value} data-item=\"value\" />\n </div>`\n )}\n </div>\n </div>\n ${['email', 'phone', 'address'].map(type => {\n var items = [...(sorted[type] || []), { type: type as ContactField, label: 'work', value: '' }]\n\n return html`\n <div data-type=${type}>\n ${type}\n ${items.map(\n item =>\n html`<div @change=${(e: Event) => this.onChangeItem(e, item)} .item=${item} field>\n ${item.value\n ? html`<mwc-icon-button\n icon=\"cancel\"\n @click=${() => {\n item.value = ''\n this.buildStageContact()\n }}\n ></mwc-icon-button>`\n : html`<mwc-icon-button></mwc-icon-button>`}\n <select .value=${item.label} data-item=\"label\">\n ${['home', 'work', 'other', 'mobile'].map(\n option => html` <option value=${option} ?selected=${option === item.label}>${option}</option>`\n )}\n </select>\n <input type=\"text\" .value=${item.value} data-item=\"value\" />\n </div>`\n )}\n </div>\n `\n })}\n <div note>\n note\n <textarea id=\"note\" .value=${note || ''} @change=${() => this.buildStageContact()}></textarea>\n </div>\n\n <div buttons>\n <button value=\"Done\" @click=${() => this.onSave()}>Done</button>\n <button value=\"Cancel\" @click=${() => this.onCancel()}>Cancel</button>\n <button value=\"Reset\" @click=${() => this.onReset()}>Reset</button>\n </div>\n `\n }\n\n updated(changes: PropertyValues<this>) {\n if (changes.has('contact')) {\n this.stageContact = JSON.parse(JSON.stringify(this.contact))\n }\n }\n\n buildItems() {\n const items: ContactItem[] = []\n\n this.fields.forEach(fieldElement => {\n const item = (fieldElement as any).item\n if (item.value) {\n items.push(item)\n }\n })\n\n return items\n }\n\n buildStageContact() {\n this.stageContact = {\n ...this.stageContact,\n profile: this.pfp.profile,\n note: this.note.value,\n items: this.buildItems()\n }\n }\n\n onChangeItem(e: Event, item: ContactItem) {\n const target = e.currentTarget as HTMLElement\n const labelElement = target.querySelector('[data-item=\"label\"') as HTMLSelectElement\n const valueElement = target.querySelector('[data-item=\"value\"') as HTMLInputElement\n\n item.label = labelElement.value\n item.value = valueElement.value\n\n if (e.target === valueElement || item.value) {\n this.buildStageContact()\n }\n }\n\n onSave() {\n this.buildStageContact()\n\n this.dispatchEvent(\n new CustomEvent('edit-done', {\n detail: this.stageContact\n })\n )\n }\n\n onCancel() {\n this.dispatchEvent(\n new CustomEvent('edit-cancel', {\n detail: this.stageContact\n })\n )\n }\n\n onReset() {\n this.buildStageContact()\n\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nimport { html, css, LitElement, PropertyValues } from 'lit'\nimport { customElement, property, state, query, queryAll } from 'lit/decorators.js'\nimport { Contact, ContactField, ContactItem } from './ox-contact'\nimport { ScrollbarStyles } from '@operato/styles'\nimport { OxPfp } from './ox-pfp.js'\n\n@customElement('ox-contact-edit')\nexport class OxContactEdit extends LitElement {\n static styles = [\n ScrollbarStyles,\n css`\n :host {\n display: block;\n padding: 25px;\n\n --mdc-icon-button-size: 16px;\n --mdc-icon-size: 16px;\n }\n\n :host > div {\n padding: 10px 0;\n display: block;\n border-bottom: 1px solid blue;\n }\n\n :host > div > div {\n padding: 4px 0;\n box-sizing: border-box;\n\n display: flex;\n flex-direction: row;\n gap: 10px;\n }\n\n :host > div > div:hover {\n position: relative;\n }\n\n [data-item='label'] {\n width: 100px;\n text-align: right;\n }\n\n [data-item='value'] {\n flex: 1;\n }\n\n :host > div[name] {\n display: flex;\n align-items: center;\n gap: 10px;\n font-weight: bold;\n font-size: 1.4em;\n }\n\n :host ox-pfp {\n display: inline-block;\n width: 100px;\n height: 100px;\n }\n\n :host > div[name] > div[name-content] {\n flex: 1;\n\n display: flex;\n flex-direction: column;\n }\n\n div[field] {\n display: flex;\n flex-direction: row;\n align-items: center;\n gap: 10px;\n }\n\n div[field] > span {\n width: 100px;\n text-align: right;\n }\n\n div[field] > input {\n flex: 1;\n }\n\n textarea {\n width: 100%;\n height: 100px;\n }\n `\n ]\n\n @property({ type: Object }) contact: Contact = {}\n\n @state() private stageContact: Contact = JSON.parse(JSON.stringify(this.contact))\n\n @query('#name') name!: HTMLTextAreaElement\n @query('#company') company!: HTMLTextAreaElement\n @query('#note') note!: HTMLTextAreaElement\n @query('ox-pfp') pfp!: OxPfp\n @queryAll('[item-field]') fields!: NodeListOf<HTMLDivElement>\n\n render() {\n const { profile, items = [], name, company, note } = this.stageContact || {}\n var sorted: { [type: string]: ContactItem[] } = {}\n\n items.forEach(item => {\n if (!sorted[item.type as string]) {\n sorted[item.type] = [item]\n } else {\n sorted[item.type as string].push(item)\n }\n })\n\n return html`\n <div name>\n <ox-pfp .profile=${profile} .name=${name}></ox-pfp>\n\n <div name-content>\n <div @change=${(e: Event) => this.buildStageContact()}>\n <span>name</span>\n <input type=\"text\" id=\"name\" .value=${name ?? ''} />\n </div>\n <div @change=${(e: Event) => this.buildStageContact()}>\n <span>company</span>\n <input type=\"text\" id=\"company\" .value=${company ?? ''} />\n </div>\n </div>\n </div>\n ${['email', 'phone', 'address'].map(type => {\n var items = [...(sorted[type] || []), { type: type as ContactField, label: 'work', value: '' }]\n\n return html`\n <div data-type=${type}>\n ${type}\n ${items.map(\n item =>\n html`<div @change=${(e: Event) => this.onChangeItem(e, item)} .item=${item} item-field>\n ${item.value\n ? html`<mwc-icon-button\n icon=\"cancel\"\n @click=${() => {\n item.value = ''\n this.buildStageContact()\n }}\n ></mwc-icon-button>`\n : html`<mwc-icon-button></mwc-icon-button>`}\n <select .value=${item.label} data-item=\"label\">\n ${['home', 'work', 'other', 'mobile'].map(\n option => html` <option value=${option} ?selected=${option === item.label}>${option}</option>`\n )}\n </select>\n <input type=\"text\" .value=${item.value} data-item=\"value\" />\n </div>`\n )}\n </div>\n `\n })}\n <div note>\n note\n <textarea id=\"note\" .value=${note || ''} @change=${() => this.buildStageContact()}></textarea>\n </div>\n `\n }\n\n updated(changes: PropertyValues<this>) {\n if (changes.has('contact')) {\n this.stageContact = JSON.parse(JSON.stringify(this.contact))\n }\n }\n\n buildItems() {\n const items: ContactItem[] = []\n\n this.fields.forEach(fieldElement => {\n const item = (fieldElement as any).item\n if (item.value) {\n items.push(item)\n }\n })\n\n return items\n }\n\n buildStageContact() {\n this.stageContact = {\n ...this.stageContact,\n profile: this.pfp.profile,\n name: this.name.value,\n company: this.company.value,\n note: this.note.value,\n items: this.buildItems()\n }\n }\n\n onChangeItem(e: Event, item: ContactItem) {\n const target = e.currentTarget as HTMLElement\n const labelElement = target.querySelector('[data-item=\"label\"]') as HTMLSelectElement\n const valueElement = target.querySelector('[data-item=\"value\"]') as HTMLInputElement\n\n item.label = labelElement.value\n item.value = valueElement.value\n\n if (e.target === valueElement || item.value) {\n this.buildStageContact()\n }\n }\n\n save() {\n this.buildStageContact()\n\n this.dispatchEvent(\n new CustomEvent('edit-done', {\n detail: this.stageContact\n })\n )\n }\n\n cancel() {\n this.dispatchEvent(\n new CustomEvent('edit-cancel', {\n detail: this.stageContact\n })\n )\n }\n\n reset() {\n this.buildStageContact()\n\n this.stageContact = JSON.parse(JSON.stringify(this.contact))\n }\n}\n"]}
@@ -2,15 +2,13 @@ import { __decorate } from "tslib";
2
2
  import './ox-pfp-view.js';
3
3
  import { html, css, LitElement } from 'lit';
4
4
  import { customElement, property } from 'lit/decorators.js';
5
- import { ContactField } from './ox-contact';
6
5
  let OxContactView = class OxContactView extends LitElement {
7
6
  constructor() {
8
7
  super(...arguments);
9
8
  this.contact = {};
10
9
  }
11
10
  render() {
12
- var _a;
13
- const { profile, items = [], note } = this.contact || {};
11
+ const { profile, items = [], name, company, note } = this.contact || {};
14
12
  var sorted = {};
15
13
  items.forEach(item => {
16
14
  if (!sorted[item.type]) {
@@ -20,21 +18,20 @@ let OxContactView = class OxContactView extends LitElement {
20
18
  sorted[item.type].push(item);
21
19
  }
22
20
  });
23
- const names = sorted[ContactField.Name] || [];
24
- const companies = sorted[ContactField.Company] || [];
25
21
  return html `
26
22
  <div name>
27
- <ox-pfp-view .profile=${profile} .name=${(_a = names[0]) === null || _a === void 0 ? void 0 : _a.value}></ox-pfp-view>
23
+ <ox-pfp-view .profile=${profile} .name=${name}></ox-pfp-view>
28
24
 
29
25
  <div name-content>
30
- ${names.map(item => html `<div>
31
- <span data-item="value">${item.value}</span>
32
- </div>`)}
33
- ${companies.map(item => html `<div>
34
- <span data-item="value">${item.value}</span>
35
- </div>`)}
26
+ <div>
27
+ <span data-item="value">${name}</span>
28
+ </div>
29
+ <div>
30
+ <span data-item="value">${company}</span>
31
+ </div>
36
32
  </div>
37
33
  </div>
34
+
38
35
  ${['email', 'phone', 'address', 'company', 'etc']
39
36
  .map(type => sorted[type])
40
37
  .filter(items => items && items.length > 0)
@@ -1 +1 @@
1
- {"version":3,"file":"ox-contact-view.js","sourceRoot":"","sources":["../../src/ox-contact-view.ts"],"names":[],"mappings":";AAAA,OAAO,kBAAkB,CAAA;AAEzB,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAC3D,OAAO,EAAW,YAAY,EAAe,MAAM,cAAc,CAAA;AAG1D,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,UAAU;IAAtC;;QAuEuB,YAAO,GAAY,EAAE,CAAA;IAyDnD,CAAC;IAvDC,MAAM;;QACJ,MAAM,EAAE,OAAO,EAAE,KAAK,GAAG,EAAE,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC,OAAO,IAAI,EAAE,CAAA;QACxD,IAAI,MAAM,GAAsC,EAAE,CAAA;QAElD,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;YACnB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAc,CAAC,EAAE;gBAChC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;aAC3B;iBAAM;gBACL,MAAM,CAAC,IAAI,CAAC,IAAc,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;aACvC;QACH,CAAC,CAAC,CAAA;QAEF,MAAM,KAAK,GAAG,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,EAAE,CAAA;QAC7C,MAAM,SAAS,GAAG,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,IAAI,EAAE,CAAA;QAEpD,OAAO,IAAI,CAAA;;gCAEiB,OAAO,UAAU,MAAA,KAAK,CAAC,CAAC,CAAC,0CAAE,KAAK;;;YAGpD,KAAK,CAAC,GAAG,CACT,IAAI,CAAC,EAAE,CACL,IAAI,CAAA;0CACwB,IAAI,CAAC,KAAK;qBAC/B,CACV;YACC,SAAS,CAAC,GAAG,CACb,IAAI,CAAC,EAAE,CACL,IAAI,CAAA;0CACwB,IAAI,CAAC,KAAK;qBAC/B,CACV;;;QAGH,CAAC,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,CAAC;aAC9C,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;aACzB,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;aAC1C,GAAG,CACF,KAAK,CAAC,EAAE,CAAC,IAAI,CAAA,kBAAkB,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI;cACxC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI;cACb,KAAK,CAAC,GAAG,CACT,IAAI,CAAC,EAAE,CACL,IAAI,CAAA;6CACyB,IAAI,CAAC,KAAK;4CACX,IAAI,CAAC,KAAK;uBAC/B,CACV;iBACI,CACR;;;eAGM,IAAI,IAAI,EAAE;;KAEpB,CAAA;IACH,CAAC;;AA9HM,oBAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoElB,CAAA;AAE2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8CAAsB;AAvEtC,aAAa;IADzB,aAAa,CAAC,iBAAiB,CAAC;GACpB,aAAa,CAgIzB;SAhIY,aAAa","sourcesContent":["import './ox-pfp-view.js'\n\nimport { html, css, LitElement } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\nimport { Contact, ContactField, ContactItem } from './ox-contact'\n\n@customElement('ox-contact-view')\nexport class OxContactView extends LitElement {\n static styles = css`\n :host {\n display: block;\n }\n\n :host > div {\n padding: 10px 0;\n display: block;\n border-bottom: 1px solid blue;\n }\n\n :host > div > div {\n padding: 4px 0;\n box-sizing: border-box;\n\n display: flex;\n flex-direction: row;\n gap: 10px;\n }\n\n :host > div > div:hover {\n position: relative;\n }\n\n :host > div > div:hover::before {\n content: '';\n display: block;\n position: absolute;\n text-align: left;\n line-height: 24px;\n top: 0;\n right: 0;\n width: 100%;\n height: 100%;\n opacity: 0.3;\n background-image: linear-gradient(var(--primary-color, gray), var(--primary-color, gray));\n z-index: -1;\n }\n\n [data-item='label'] {\n width: 100px;\n text-align: right;\n }\n\n [data-item='value'] {\n flex: 1;\n }\n\n :host > div[name] {\n display: flex;\n align-items: center;\n gap: 10px;\n font-weight: bold;\n font-size: 1.4em;\n }\n\n :host ox-pfp-view {\n display: inline-block;\n width: 100px;\n height: 100px;\n }\n\n :host > div[name] > div[name-content] {\n flex: 1;\n\n display: flex;\n flex-direction: column;\n }\n `\n\n @property({ type: Object }) contact: Contact = {}\n\n render() {\n const { profile, items = [], note } = this.contact || {}\n var sorted: { [type: string]: ContactItem[] } = {}\n\n items.forEach(item => {\n if (!sorted[item.type as string]) {\n sorted[item.type] = [item]\n } else {\n sorted[item.type as string].push(item)\n }\n })\n\n const names = sorted[ContactField.Name] || []\n const companies = sorted[ContactField.Company] || []\n\n return html`\n <div name>\n <ox-pfp-view .profile=${profile} .name=${names[0]?.value}></ox-pfp-view>\n\n <div name-content>\n ${names.map(\n item =>\n html`<div>\n <span data-item=\"value\">${item.value}</span>\n </div>`\n )}\n ${companies.map(\n item =>\n html`<div>\n <span data-item=\"value\">${item.value}</span>\n </div>`\n )}\n </div>\n </div>\n ${['email', 'phone', 'address', 'company', 'etc']\n .map(type => sorted[type])\n .filter(items => items && items.length > 0)\n .map(\n items => html`<div data-type=${items[0].type}>\n ${items[0].type}\n ${items.map(\n item =>\n html`<div>\n <label data-item=\"label\">${item.label}</label>\n <span data-item=\"value\">${item.value}</span>\n </div>`\n )}\n </div>`\n )}\n <div note>\n note\n <div>${note || ''}</div>\n </div>\n `\n }\n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,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI;cACxC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI;cACb,KAAK,CAAC,GAAG,CACT,IAAI,CAAC,EAAE,CACL,IAAI,CAAA;6CACyB,IAAI,CAAC,KAAK;4CACX,IAAI,CAAC,KAAK;uBAC/B,CACV;iBACI,CACR;;;eAGM,IAAI,IAAI,EAAE;;KAEpB,CAAA;IACH,CAAC;;AAtHM,oBAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoElB,CAAA;AAE2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8CAAsB;AAvEtC,aAAa;IADzB,aAAa,CAAC,iBAAiB,CAAC;GACpB,aAAa,CAwHzB;SAxHY,aAAa","sourcesContent":["import './ox-pfp-view.js'\n\nimport { html, css, LitElement } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\nimport { Contact, ContactField, ContactItem } from './ox-contact'\n\n@customElement('ox-contact-view')\nexport class OxContactView extends LitElement {\n static styles = css`\n :host {\n display: block;\n }\n\n :host > div {\n padding: 10px 0;\n display: block;\n border-bottom: 1px solid blue;\n }\n\n :host > div > div {\n padding: 4px 0;\n box-sizing: border-box;\n\n display: flex;\n flex-direction: row;\n gap: 10px;\n }\n\n :host > div > div:hover {\n position: relative;\n }\n\n :host > div > div:hover::before {\n content: '';\n display: block;\n position: absolute;\n text-align: left;\n line-height: 24px;\n top: 0;\n right: 0;\n width: 100%;\n height: 100%;\n opacity: 0.3;\n background-image: linear-gradient(var(--primary-color, gray), var(--primary-color, gray));\n z-index: -1;\n }\n\n [data-item='label'] {\n width: 100px;\n text-align: right;\n }\n\n [data-item='value'] {\n flex: 1;\n }\n\n :host > div[name] {\n display: flex;\n align-items: center;\n gap: 10px;\n font-weight: bold;\n font-size: 1.4em;\n }\n\n :host ox-pfp-view {\n display: inline-block;\n width: 100px;\n height: 100px;\n }\n\n :host > div[name] > div[name-content] {\n flex: 1;\n\n display: flex;\n flex-direction: column;\n }\n `\n\n @property({ type: Object }) contact: Contact = {}\n\n render() {\n const { profile, items = [], name, company, note } = this.contact || {}\n var sorted: { [type: string]: ContactItem[] } = {}\n\n items.forEach(item => {\n if (!sorted[item.type as string]) {\n sorted[item.type] = [item]\n } else {\n sorted[item.type as string].push(item)\n }\n })\n\n return html`\n <div name>\n <ox-pfp-view .profile=${profile} .name=${name}></ox-pfp-view>\n\n <div name-content>\n <div>\n <span data-item=\"value\">${name}</span>\n </div>\n <div>\n <span data-item=\"value\">${company}</span>\n </div>\n </div>\n </div>\n\n ${['email', 'phone', 'address', 'company', 'etc']\n .map(type => sorted[type])\n .filter(items => items && items.length > 0)\n .map(\n items => html`<div data-type=${items[0].type}>\n ${items[0].type}\n ${items.map(\n item =>\n html`<div>\n <label data-item=\"label\">${item.label}</label>\n <span data-item=\"value\">${item.value}</span>\n </div>`\n )}\n </div>`\n )}\n <div note>\n note\n <div>${note || ''}</div>\n </div>\n `\n }\n}\n"]}
@@ -1,9 +1,9 @@
1
+ import './ox-contact-edit.js';
2
+ import './ox-contact-view.js';
1
3
  import { LitElement } from 'lit';
2
- import './ox-contact-edit';
3
- import './ox-contact-view';
4
+ import { OxContactEdit } from './ox-contact-edit.js';
4
5
  import { Profile } from './ox-pfp-view.js';
5
6
  export declare enum ContactField {
6
- Name = "name",
7
7
  JobTitle = "job-title",
8
8
  Phone = "phone",
9
9
  Address = "address",
@@ -12,7 +12,6 @@ export declare enum ContactField {
12
12
  Profile = "profile",
13
13
  Picture = "picture",
14
14
  Department = "department",
15
- Company = "company",
16
15
  Homepage = "homepage"
17
16
  }
18
17
  export declare enum ContactLabel {
@@ -28,13 +27,17 @@ export type ContactItem = {
28
27
  value: string;
29
28
  };
30
29
  export type Contact = {
30
+ id?: string;
31
31
  profile?: Profile;
32
+ name?: string;
33
+ company?: string;
32
34
  items?: ContactItem[];
33
35
  note?: string;
34
36
  };
35
37
  export declare class OxContact extends LitElement {
36
- static styles: import("lit").CSSResult;
38
+ static styles: import("lit").CSSResult[];
37
39
  contact: Contact;
38
40
  editMode?: boolean;
41
+ editor: OxContactEdit;
39
42
  render(): import("lit-html").TemplateResult<1>;
40
43
  }
@@ -1,11 +1,11 @@
1
1
  import { __decorate } from "tslib";
2
+ import './ox-contact-edit.js';
3
+ import './ox-contact-view.js';
2
4
  import { html, css, LitElement } from 'lit';
3
- import { customElement, property, state } from 'lit/decorators.js';
4
- import './ox-contact-edit';
5
- import './ox-contact-view';
5
+ import { customElement, property, query, state } from 'lit/decorators.js';
6
+ import { ButtonContainerStyles } from '@operato/styles';
6
7
  export var ContactField;
7
8
  (function (ContactField) {
8
- ContactField["Name"] = "name";
9
9
  ContactField["JobTitle"] = "job-title";
10
10
  ContactField["Phone"] = "phone";
11
11
  ContactField["Address"] = "address";
@@ -14,7 +14,6 @@ export var ContactField;
14
14
  ContactField["Profile"] = "profile";
15
15
  ContactField["Picture"] = "picture";
16
16
  ContactField["Department"] = "department";
17
- ContactField["Company"] = "company";
18
17
  ContactField["Homepage"] = "homepage";
19
18
  })(ContactField || (ContactField = {}));
20
19
  export var ContactLabel;
@@ -31,35 +30,57 @@ let OxContact = class OxContact extends LitElement {
31
30
  this.editMode = false;
32
31
  }
33
32
  render() {
34
- return html `${this.editMode
33
+ return html `
34
+ <div container>
35
+ ${this.editMode
35
36
  ? html `<ox-contact-edit
36
- .contact=${this.contact}
37
- @edit-cancel=${() => (this.editMode = false)}
38
- @edit-done=${(e) => {
37
+ .contact=${this.contact}
38
+ @edit-cancel=${() => (this.editMode = false)}
39
+ @edit-done=${(e) => {
39
40
  this.contact = e.detail;
40
41
  this.editMode = false;
41
42
  }}
42
- ></ox-contact-edit>`
43
- : html ` <ox-contact-view .contact=${this.contact}></ox-contact-view>
44
- <button value="Edit" @click=${() => (this.editMode = true)}>Edit</button>`} `;
43
+ ></ox-contact-edit>`
44
+ : html ` <ox-contact-view .contact=${this.contact}></ox-contact-view> `}
45
+ </div>
46
+
47
+ <div class="button-container">
48
+ ${this.editMode
49
+ ? html `
50
+ <button value="Done" @click=${() => this.editor.save()}>Done</button>
51
+ <button value="Cancel" @click=${() => this.editor.cancel()}>Cancel</button>
52
+ <button value="Reset" @click=${() => this.editor.reset()}>Reset</button>
53
+ `
54
+ : html ` <button value="Edit" @click=${() => (this.editMode = true)}>Edit</button> `}
55
+ </div>
56
+ </div>`;
45
57
  }
46
58
  };
47
- OxContact.styles = css `
48
- :host {
49
- display: block;
50
- }
59
+ OxContact.styles = [
60
+ ButtonContainerStyles,
61
+ css `
62
+ :host {
63
+ display: flex;
64
+ flex-direction: column;
65
+ background-color: var(--main-section-background-color);
66
+ }
51
67
 
52
- button {
53
- display: block;
54
- margin-left: auto;
55
- }
56
- `;
68
+ ox-contact-view,
69
+ ox-contact-edit {
70
+ padding: var(--pading-default);
71
+ flex: 1;
72
+ }
73
+ `
74
+ ];
57
75
  __decorate([
58
76
  property({ type: Object })
59
77
  ], OxContact.prototype, "contact", void 0);
60
78
  __decorate([
61
79
  state()
62
80
  ], OxContact.prototype, "editMode", void 0);
81
+ __decorate([
82
+ query('ox-contact-edit')
83
+ ], OxContact.prototype, "editor", void 0);
63
84
  OxContact = __decorate([
64
85
  customElement('ox-contact')
65
86
  ], OxContact);
@@ -1 +1 @@
1
- {"version":3,"file":"ox-contact.js","sourceRoot":"","sources":["../../src/ox-contact.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAClE,OAAO,mBAAmB,CAAA;AAC1B,OAAO,mBAAmB,CAAA;AAG1B,MAAM,CAAN,IAAY,YAYX;AAZD,WAAY,YAAY;IACtB,6BAAa,CAAA;IACb,sCAAsB,CAAA;IACtB,+BAAe,CAAA;IACf,mCA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{ html, css, LitElement } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\nimport './ox-contact-edit'\nimport './ox-contact-view'\nimport { Profile } from './ox-pfp-view.js'\n\nexport enum ContactField {\n Name = 'name',\n JobTitle = 'job-title',\n Phone = 'phone',\n Address = 'address',\n Email = 'email',\n Birthday = 'birthday',\n Profile = 'profile',\n Picture = 'picture',\n Department = 'department',\n Company = 'company',\n Homepage = 'homepage'\n}\n\nexport enum ContactLabel {\n home = 'home',\n work = 'work',\n other = 'other',\n mobile = 'mobile'\n}\n\nexport type ContactItem = {\n id?: string\n type: ContactField\n label: string\n value: string\n}\n\nexport type Contact = {\n profile?: Profile\n items?: ContactItem[]\n note?: string\n}\n\n@customElement('ox-contact')\nexport class OxContact extends LitElement {\n static styles = css`\n :host {\n display: block;\n }\n\n button {\n display: block;\n margin-left: auto;\n }\n `\n\n @property({ type: Object }) contact: Contact = {}\n\n @state() editMode?: boolean = false\n\n render() {\n return html`${this.editMode\n ? html`<ox-contact-edit\n .contact=${this.contact}\n @edit-cancel=${() => (this.editMode = false)}\n @edit-done=${(e: CustomEvent) => {\n this.contact = e.detail\n this.editMode = false\n }}\n ></ox-contact-edit>`\n : html` <ox-contact-view .contact=${this.contact}></ox-contact-view>\n <button value=\"Edit\" @click=${() => (this.editMode = true)}>Edit</button>`} `\n }\n}\n"]}
1
+ {"version":3,"file":"ox-contact.js","sourceRoot":"","sources":["../../src/ox-contact.ts"],"names":[],"mappings":";AAAA,OAAO,sBAAsB,CAAA;AAC7B,OAAO,sBAAsB,CAAA;AAE7B,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAEzE,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAA;AAKvD,MAAM,CAAN,IAAY,YAUX;AAVD,WAAY,YAAY;IACtB,s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AI,CAAC,QAAQ,GAAG,IAAI,CAAC,iBACtE;;WAEG,CAAA;IACT,CAAC;;AApDM,gBAAM,GAAG;IACd,qBAAqB;IACrB,GAAG,CAAA;;;;;;;;;;;;KAYF;CACF,CAAA;AAE2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;0CAAsB;AAExC;IAAR,KAAK,EAAE;2CAA2B;AAET;IAAzB,KAAK,CAAC,iBAAiB,CAAC;yCAAuB;AAtBrC,SAAS;IADrB,aAAa,CAAC,YAAY,CAAC;GACf,SAAS,CAsDrB;SAtDY,SAAS","sourcesContent":["import './ox-contact-edit.js'\nimport './ox-contact-view.js'\n\nimport { html, css, LitElement } from 'lit'\nimport { customElement, property, query, state } from 'lit/decorators.js'\n\nimport { ButtonContainerStyles } from '@operato/styles'\n\nimport { OxContactEdit } from './ox-contact-edit.js'\nimport { Profile } from './ox-pfp-view.js'\n\nexport enum ContactField {\n JobTitle = 'job-title',\n Phone = 'phone',\n Address = 'address',\n Email = 'email',\n Birthday = 'birthday',\n Profile = 'profile',\n Picture = 'picture',\n Department = 'department',\n Homepage = 'homepage'\n}\n\nexport enum ContactLabel {\n home = 'home',\n work = 'work',\n other = 'other',\n mobile = 'mobile'\n}\n\nexport type ContactItem = {\n id?: string\n type: ContactField\n label: string\n value: string\n}\n\nexport type Contact = {\n id?: string\n profile?: Profile\n name?: string\n company?: string\n items?: ContactItem[]\n note?: string\n}\n\n@customElement('ox-contact')\nexport class OxContact extends LitElement {\n static styles = [\n ButtonContainerStyles,\n css`\n :host {\n display: flex;\n flex-direction: column;\n background-color: var(--main-section-background-color);\n }\n\n ox-contact-view,\n ox-contact-edit {\n padding: var(--pading-default);\n flex: 1;\n }\n `\n ]\n\n @property({ type: Object }) contact: Contact = {}\n\n @state() editMode?: boolean = false\n\n @query('ox-contact-edit') editor!: OxContactEdit\n\n render() {\n return html` \n <div container>\n ${\n this.editMode\n ? html`<ox-contact-edit\n .contact=${this.contact}\n @edit-cancel=${() => (this.editMode = false)}\n @edit-done=${(e: CustomEvent) => {\n this.contact = e.detail\n this.editMode = false\n }}\n ></ox-contact-edit>`\n : html` <ox-contact-view .contact=${this.contact}></ox-contact-view> `\n }\n </div>\n \n <div class=\"button-container\">\n ${\n this.editMode\n ? html`\n <button value=\"Done\" @click=${() => this.editor.save()}>Done</button>\n <button value=\"Cancel\" @click=${() => this.editor.cancel()}>Cancel</button>\n <button value=\"Reset\" @click=${() => this.editor.reset()}>Reset</button>\n `\n : html` <button value=\"Edit\" @click=${() => (this.editMode = true)}>Edit</button> `\n }\n </div>\n </div>`\n }\n}\n"]}
@@ -75,7 +75,7 @@ let OxPfpEdit = class OxPfpEdit extends LitElement {
75
75
  capture="environment"
76
76
  @change=${(e) => this.onChangeFile(e)}
77
77
  />
78
- <mwc-icon>image_search</mwc-icon>
78
+ <mwc-icon title="select image">image_search</mwc-icon>
79
79
  </label>
80
80
  </div>
81
81
 
@@ -83,10 +83,10 @@ let OxPfpEdit = class OxPfpEdit extends LitElement {
83
83
  `;
84
84
  }
85
85
  updated(changes) {
86
- const { picture, zoom = 1, left = 0, top = 0 } = this.profile;
86
+ const { picture, zoom = 1, left = 0, top = 0 } = this.profile || {};
87
87
  if (picture) {
88
88
  const style = this.style;
89
- style.setProperty('--background-image', `url(${picture})`);
89
+ style.setProperty('--background-image', `url('${picture}')`);
90
90
  style.setProperty('--image-transform', `translate(${left}%, ${top}%) scale(${zoom}, ${zoom})`);
91
91
  }
92
92
  }
@@ -99,12 +99,13 @@ let OxPfpEdit = class OxPfpEdit extends LitElement {
99
99
  onWheelEvent(e) {
100
100
  e.preventDefault();
101
101
  var delta = Math.max(-1, Math.min(1, e.deltaY || -e.detail));
102
- const { top = 0, left = 0, zoom = 1, picture } = this.profile;
102
+ const { top = 0, left = 0, zoom = 1, picture, file } = this.profile || {};
103
103
  this.profile = {
104
104
  top,
105
105
  left,
106
106
  zoom: zoom * (1 - delta / 20),
107
- picture
107
+ picture,
108
+ file
108
109
  };
109
110
  this.dispatchEvent(new CustomEvent('change', {
110
111
  detail: this.profile
@@ -133,13 +134,14 @@ let OxPfpEdit = class OxPfpEdit extends LitElement {
133
134
  x -= this.dragStart.x;
134
135
  y -= this.dragStart.y;
135
136
  this.dragStart = dragStart;
136
- const { top = 0, left = 0, zoom = 1, picture } = this.profile;
137
+ const { top = 0, left = 0, zoom = 1, picture, file } = this.profile || {};
137
138
  const { offsetHeight, offsetWidth } = this;
138
139
  this.profile = {
139
140
  top: top + (y / offsetHeight) * 100,
140
141
  left: left + (x / offsetWidth) * 100,
141
142
  zoom,
142
- picture
143
+ picture,
144
+ file
143
145
  };
144
146
  this.dispatchEvent(new CustomEvent('change', {
145
147
  detail: this.profile
@@ -164,7 +166,8 @@ let OxPfpEdit = class OxPfpEdit extends LitElement {
164
166
  left: 0,
165
167
  top: 0,
166
168
  zoom: 1,
167
- picture
169
+ picture,
170
+ file: imageFile
168
171
  };
169
172
  }
170
173
  onChangeFile(e) {
@@ -178,7 +181,8 @@ let OxPfpEdit = class OxPfpEdit extends LitElement {
178
181
  left: 0,
179
182
  top: 0,
180
183
  zoom: 1,
181
- picture
184
+ picture,
185
+ file: imageFile
182
186
  };
183
187
  fileInput.files = null;
184
188
  }
@@ -234,7 +238,6 @@ OxPfpEdit.styles = css `
234
238
  right: 0;
235
239
  width: 100%;
236
240
  height: 100%;
237
- z-index: -1;
238
241
  background-repeat: no-repeat;
239
242
  background-image: var(
240
243
  --background-image,