@umbraco-cms/backoffice 14.0.0--preview004-fb4b6c24 → 14.0.0--preview004-07058ebe

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.
@@ -1205,15 +1205,15 @@
1205
1205
  "properties": [
1206
1206
  {
1207
1207
  "name": "imageElement",
1208
- "type": "HTMLImageElement"
1208
+ "type": "HTMLImageElement | undefined"
1209
1209
  },
1210
1210
  {
1211
1211
  "name": "wrapperElement",
1212
- "type": "HTMLImageElement"
1212
+ "type": "HTMLImageElement | undefined"
1213
1213
  },
1214
1214
  {
1215
1215
  "name": "focalPointElement",
1216
- "type": "HTMLImageElement"
1216
+ "type": "HTMLImageElement | undefined"
1217
1217
  },
1218
1218
  {
1219
1219
  "name": "src",
@@ -2,9 +2,9 @@ import { UmbImageCropperFocalPoint } from './index.js';
2
2
  import { LitElement, PropertyValueMap, nothing } from '../../../../external/lit/index.js';
3
3
  export declare class UmbImageCropperFocusSetterElement extends LitElement {
4
4
  #private;
5
- imageElement: HTMLImageElement;
6
- wrapperElement: HTMLImageElement;
7
- focalPointElement: HTMLImageElement;
5
+ imageElement?: HTMLImageElement;
6
+ wrapperElement?: HTMLImageElement;
7
+ focalPointElement?: HTMLImageElement;
8
8
  src?: string;
9
9
  focalPoint: UmbImageCropperFocalPoint;
10
10
  connectedCallback(): void;
@@ -35,7 +35,7 @@ let UmbImageCropperFocusSetterElement = class UmbImageCropperFocusSetterElement
35
35
  }
36
36
  updated(_changedProperties) {
37
37
  super.updated(_changedProperties);
38
- if (_changedProperties.has('focalPoint')) {
38
+ if (_changedProperties.has('focalPoint') && this.focalPointElement) {
39
39
  this.focalPointElement.style.left = `calc(${this.focalPoint.left * 100}% - ${this.#DOT_RADIUS}px)`;
40
40
  this.focalPointElement.style.top = `calc(${this.focalPoint.top * 100}% - ${this.#DOT_RADIUS}px)`;
41
41
  }
@@ -43,21 +43,27 @@ let UmbImageCropperFocusSetterElement = class UmbImageCropperFocusSetterElement
43
43
  firstUpdated(_changedProperties) {
44
44
  super.firstUpdated(_changedProperties);
45
45
  this.style.setProperty('--dot-radius', `${this.#DOT_RADIUS}px`);
46
- this.focalPointElement.style.left = `calc(${this.focalPoint.left * 100}% - ${this.#DOT_RADIUS}px)`;
47
- this.focalPointElement.style.top = `calc(${this.focalPoint.top * 100}% - ${this.#DOT_RADIUS}px)`;
48
- this.imageElement.onload = () => {
49
- const imageAspectRatio = this.imageElement.naturalWidth / this.imageElement.naturalHeight;
50
- if (imageAspectRatio > 1) {
51
- this.imageElement.style.width = '100%';
52
- this.wrapperElement.style.width = '100%';
53
- }
54
- else {
55
- this.imageElement.style.height = '100%';
56
- this.wrapperElement.style.height = '100%';
57
- }
58
- this.imageElement.style.aspectRatio = `${imageAspectRatio}`;
59
- this.wrapperElement.style.aspectRatio = `${imageAspectRatio}`;
60
- };
46
+ if (this.focalPointElement) {
47
+ this.focalPointElement.style.left = `calc(${this.focalPoint.left * 100}% - ${this.#DOT_RADIUS}px)`;
48
+ this.focalPointElement.style.top = `calc(${this.focalPoint.top * 100}% - ${this.#DOT_RADIUS}px)`;
49
+ }
50
+ if (this.imageElement) {
51
+ this.imageElement.onload = () => {
52
+ if (!this.imageElement || !this.wrapperElement)
53
+ return;
54
+ const imageAspectRatio = this.imageElement.naturalWidth / this.imageElement.naturalHeight;
55
+ if (imageAspectRatio > 1) {
56
+ this.imageElement.style.width = '100%';
57
+ this.wrapperElement.style.width = '100%';
58
+ }
59
+ else {
60
+ this.imageElement.style.height = '100%';
61
+ this.wrapperElement.style.height = '100%';
62
+ }
63
+ this.imageElement.style.aspectRatio = `${imageAspectRatio}`;
64
+ this.wrapperElement.style.aspectRatio = `${imageAspectRatio}`;
65
+ };
66
+ }
61
67
  }
62
68
  async #addEventListeners() {
63
69
  await this.updateComplete; // Wait for the @query to be resolved
@@ -73,6 +79,8 @@ let UmbImageCropperFocusSetterElement = class UmbImageCropperFocusSetterElement
73
79
  #onDrag;
74
80
  #onSetFocalPoint(event) {
75
81
  event.preventDefault();
82
+ if (!this.focalPointElement || !this.imageElement)
83
+ return;
76
84
  const image = this.imageElement.getBoundingClientRect();
77
85
  const x = clamp(event.clientX - image.left, 0, image.width);
78
86
  const y = clamp(event.clientY - image.top, 0, image.height);
@@ -87,8 +87,8 @@ let UmbInputImageCropperElement = class UmbInputImageCropperElement extends LitE
87
87
  .focalPoint=${this.focalPoint}
88
88
  .src=${this.src}></umb-image-cropper-focus-setter>
89
89
  <div id="actions">
90
- <uui-button>Remove files (NOT IMPLEMENTED YET)</uui-button>
91
- <uui-button @click=${this.#onResetFocalPoint}>Reset focal point</uui-button>
90
+ <uui-button label="Remove files">Remove files (NOT IMPLEMENTED YET)</uui-button>
91
+ <uui-button label="Reset focal point" @click=${this.#onResetFocalPoint}>Reset focal point</uui-button>
92
92
  </div> `;
93
93
  }
94
94
  #renderSide() {
@@ -87,17 +87,17 @@ let UmbPropertyEditorUIImageCropsConfigurationElement = class UmbPropertyEditorU
87
87
  <form @submit=${this.#onSubmit}>
88
88
  <div class="input">
89
89
  <uui-label for="alias">Alias</uui-label>
90
- <uui-input id="alias" name="alias" type="text" autocomplete="false" value=""></uui-input>
90
+ <uui-input label="Alias" id="alias" name="alias" type="text" autocomplete="false" value=""></uui-input>
91
91
  </div>
92
92
  <div class="input">
93
93
  <uui-label for="width">Width</uui-label>
94
- <uui-input id="width" name="width" type="number" autocomplete="false" value="">
94
+ <uui-input label="Width" id="width" name="width" type="number" autocomplete="false" value="">
95
95
  <span class="append" slot="append">px</span>
96
96
  </uui-input>
97
97
  </div>
98
98
  <div class="input">
99
99
  <uui-label for="height">Height</uui-label>
100
- <uui-input id="height" name="height" type="number" autocomplete="false" value="">
100
+ <uui-input label="Height" id="height" name="height" type="number" autocomplete="false" value="">
101
101
  <span class="append" slot="append">px</span>
102
102
  </uui-input>
103
103
  </div>
@@ -111,8 +111,8 @@ let UmbPropertyEditorUIImageCropsConfigurationElement = class UmbPropertyEditorU
111
111
  <span class="crop-alias">${item.alias}</span>
112
112
  <span class="crop-size">(${item.width} x ${item.height}px)</span>
113
113
  <div class="crop-actions">
114
- <uui-button @click=${() => this.#onEdit(item)}>Edit</uui-button>
115
- <uui-button color="danger" @click=${() => this.#onRemove(item.alias)}>Remove</uui-button>
114
+ <uui-button label="Edit" @click=${() => this.#onEdit(item)}>Edit</uui-button>
115
+ <uui-button label="Remove" color="danger" @click=${() => this.#onRemove(item.alias)}>Remove</uui-button>
116
116
  </div>
117
117
  </div>
118
118
  `)}
@@ -16,7 +16,7 @@ let UmbPropertyEditorUITinyMceMaxImageSizeConfigurationElement = class UmbProper
16
16
  this.value = 0;
17
17
  }
18
18
  render() {
19
- return html `<uui-input type="number" placeholder="Max size" .value=${this.value}></uui-input>`;
19
+ return html `<uui-input label="Max size" type="number" placeholder="Max size" .value=${this.value}></uui-input>`;
20
20
  }
21
21
  static { this.styles = [UmbTextStyles]; }
22
22
  };