@siemens/live-preview 51.4.0 → 51.5.0

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.
@@ -14,24 +14,24 @@
14
14
  "@angular/forms": "22.0.8",
15
15
  "@angular/platform-browser": "22.0.8",
16
16
  "@angular/router": "22.0.8",
17
- "@ngx-formly/bootstrap": "8.0.0",
18
- "@ngx-formly/core": "8.0.0",
17
+ "@ngx-formly/bootstrap": "10.0.1",
18
+ "@ngx-formly/core": "10.0.1",
19
19
  "@ngx-translate/core": "18.0.0",
20
- "@siemens/charts-ng": "51.3.0",
21
- "@siemens/dashboards-ng": "51.3.0",
22
- "@siemens/element-ng": "51.3.0",
23
- "@siemens/element-theme": "51.3.0",
24
- "@siemens/element-translate-ng": "51.3.0",
25
- "@siemens/live-preview": "51.3.0",
26
- "@siemens/maps-ng": "51.3.0",
20
+ "@siemens/charts-ng": "51.4.0",
21
+ "@siemens/dashboards-ng": "51.4.0",
22
+ "@siemens/element-ng": "51.4.0",
23
+ "@siemens/element-theme": "51.4.0",
24
+ "@siemens/element-translate-ng": "51.4.0",
25
+ "@siemens/live-preview": "51.4.0",
26
+ "@siemens/maps-ng": "51.4.0",
27
27
  "@siemens/ngx-datatable": "27.1.0",
28
28
  "ag-grid-angular": "^36.0.0",
29
29
  "ag-grid-community": "^36.0.0",
30
30
  "echarts": "6.1.0",
31
- "flag-icons": "7.5.0",
31
+ "flag-icons": "7.6.0",
32
32
  "google-libphonenumber": "3.2.47",
33
33
  "ngx-image-cropper": "9.1.7",
34
- "ol": "10.10.0",
34
+ "ol": "10.11.0",
35
35
  "ol-ext": "4.0.38",
36
36
  "rxjs": "7.8.2",
37
37
  "tslib": "2.8.1"
@@ -555,7 +555,11 @@ class SiLivePreviewIframeComponent {
555
555
  }));
556
556
  }
557
557
  onMessage(event) {
558
- if (event.data?.src !== 'renderer') {
558
+ const previewWindow = this.previewIframe()?.nativeElement.contentWindow;
559
+ if (!previewWindow ||
560
+ event.origin !== window.location.origin ||
561
+ event.source !== previewWindow ||
562
+ event.data?.src !== 'renderer') {
559
563
  return;
560
564
  }
561
565
  this.ngZone.run(() => this.onMessageInZone(event));
@@ -625,7 +629,7 @@ class SiLivePreviewIframeComponent {
625
629
  safeAreaBottom: viewport.safeAreaBottom,
626
630
  safeAreaLeft: viewport.safeAreaLeft,
627
631
  safeAreaRight: viewport.safeAreaRight
628
- }, '*');
632
+ }, window.location.origin);
629
633
  }
630
634
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SiLivePreviewIframeComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
631
635
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.8", type: SiLivePreviewIframeComponent, isStandalone: true, selector: "si-live-preview-iframe", inputs: { isFullscreen: { classPropertyName: "isFullscreen", publicName: "isFullscreen", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { templateFromComponent: "templateFromComponent" }, host: { properties: { "class.is-mobile": "isMobile" } }, ngImport: i0, template: "<section class=\"header-links\">\n <h1 class=\"example-text\">Example: {{ state.example() }}</h1>\n @if (!isMobile || !isFullscreen()) {\n <div class=\"ticket-links\">\n <a target=\"_blank\" [href]=\"ticketLinkBug()\">Report a bug</a> |\n <a target=\"_blank\" [href]=\"ticketLinkFeature()\">Request a feature</a>\n </div>\n }\n</section>\n\n@if (isMobile) {\n <si-live-preview-mobile-mode (iframeChange)=\"setPreviewIframe($event)\" />\n} @else {\n <si-live-preview-iframe-mode (iframeChange)=\"setPreviewIframe($event)\" />\n}\n", styles: ["a{color:var(--si-sys-color-text-accent)}a:after{display:none}a:hover{color:var(--si-sys-color-text-accent-hover)}:host{display:inline-flex;flex-direction:column}:host.is-mobile{margin-block-end:28px}:host:not(.is-mobile){flex:1}.header-links{block-size:32px;padding-block:9px;color:var(--si-sys-color-text-primary);font-size:11px;flex-shrink:0;display:flex;align-items:center}:host:not(.is-mobile) .header-links{padding-inline:10px}.header-links .ticket-links,.header-links .example-text{line-height:14px}.header-links .ticket-links{margin-inline-start:auto}.header-links .example-text{color:var(--si-sys-color-text-primary);display:inline;font-size:11px;font-weight:600;margin-block:0;margin-inline:0 8px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex:1 1 0;inline-size:0}\n"], dependencies: [{ kind: "component", type: SiLivePreviewIframeModeComponent, selector: "si-live-preview-iframe-mode", outputs: ["iframeChange"] }, { kind: "component", type: SiLivePreviewMobileModeComponent, selector: "si-live-preview-mobile-mode", outputs: ["iframeChange"] }], changeDetection: i0.ChangeDetectionStrategy.Eager });
@@ -2182,6 +2186,9 @@ class SiLivePreviewWrapperComponent {
2182
2186
  });
2183
2187
  this.initialUrl = window.location.toString();
2184
2188
  this.isMobile = this.internalConfig.isMobile;
2189
+ if (this.isMobile) {
2190
+ setDeviceMode(this.state.viewport().mode);
2191
+ }
2185
2192
  // send ready message only when locale/theme are communicated to avoid loops
2186
2193
  this.sendMessage('ready');
2187
2194
  this.ngZone.runOutsideAngular(() => fromEvent(window, 'message')
@@ -2192,7 +2199,10 @@ class SiLivePreviewWrapperComponent {
2192
2199
  }));
2193
2200
  }
2194
2201
  onMessage(event) {
2195
- if (event.data?.src !== 'editor') {
2202
+ // Render requests can contain executable templates, so the sender must be the same-origin editor.
2203
+ if (event.origin !== window.location.origin ||
2204
+ event.source !== window.parent ||
2205
+ event.data?.src !== 'editor') {
2196
2206
  return;
2197
2207
  }
2198
2208
  this.ngZone.run(() => this.onMessageInZone(event));
@@ -2246,12 +2256,12 @@ class SiLivePreviewWrapperComponent {
2246
2256
  const linkTarget = target.target;
2247
2257
  if (newUrl && !newUrl.startsWith(this.initialUrl) && filterTargets.includes(linkTarget)) {
2248
2258
  event.preventDefault();
2249
- window.open(newUrl, '_blank');
2259
+ window.open(newUrl, '_blank', 'noopener,noreferrer');
2250
2260
  }
2251
2261
  }
2252
2262
  }
2253
2263
  sendMessage(type, message) {
2254
- window.parent.postMessage({ src: 'renderer', type, message }, '*');
2264
+ window.parent.postMessage({ src: 'renderer', type, message }, window.location.origin);
2255
2265
  }
2256
2266
  setTheme(theme) {
2257
2267
  this.state.theme.set(theme);