@siemens/live-preview 51.7.0 → 51.8.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.
- package/fesm2022/siemens-live-preview-si-example-editor.component-DSxapfeC.mjs +28 -0
- package/fesm2022/siemens-live-preview-si-example-editor.component-DSxapfeC.mjs.map +1 -0
- package/fesm2022/siemens-live-preview-si-example-overview.component-Co4tIhL5.mjs +107 -0
- package/fesm2022/siemens-live-preview-si-example-overview.component-Co4tIhL5.mjs.map +1 -0
- package/fesm2022/siemens-live-preview-si-live-preview.component-BkiFwumB.mjs +1123 -0
- package/fesm2022/siemens-live-preview-si-live-preview.component-BkiFwumB.mjs.map +1 -0
- package/fesm2022/siemens-live-preview-siemens-live-preview-BU--ZYJz.mjs +1579 -0
- package/fesm2022/siemens-live-preview-siemens-live-preview-BU--ZYJz.mjs.map +1 -0
- package/fesm2022/siemens-live-preview.mjs +1 -2680
- package/fesm2022/siemens-live-preview.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,1123 @@
|
|
|
1
|
+
import { KeyValuePipe } from '@angular/common';
|
|
2
|
+
import { httpResource, HttpClient } from '@angular/common/http';
|
|
3
|
+
import * as i0 from '@angular/core';
|
|
4
|
+
import { inject, viewChild, output, Component, input, computed, ChangeDetectionStrategy, signal, effect, NgZone, DestroyRef, ChangeDetectorRef, Directive, ElementRef, untracked } from '@angular/core';
|
|
5
|
+
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
6
|
+
import * as i1 from '@angular/forms';
|
|
7
|
+
import { FormsModule } from '@angular/forms';
|
|
8
|
+
import CodeFlask from 'codeflask';
|
|
9
|
+
import { fromEvent, Subject } from 'rxjs';
|
|
10
|
+
import { throttleTime, timeout, retry } from 'rxjs/operators';
|
|
11
|
+
import { c as LivePreviewUrlService, S as SI_LIVE_PREVIEW_CONFIG, L as LivePreviewStateService, a as SI_LIVE_PREVIEW_INTERNALS, d as SI_STACKBLITZ_CONFIG, e as SiLivePreviewLocaleApi } from './siemens-live-preview-siemens-live-preview-BU--ZYJz.mjs';
|
|
12
|
+
import 'prismjs/components/prism-typescript';
|
|
13
|
+
import { DomSanitizer } from '@angular/platform-browser';
|
|
14
|
+
import qrcode from 'qrcode-generator';
|
|
15
|
+
import sdk from '@stackblitz/sdk';
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Copyright (c) Siemens 2016 - 2026
|
|
19
|
+
* SPDX-License-Identifier: MIT
|
|
20
|
+
*/
|
|
21
|
+
class SiLivePreviewIframeModeComponent {
|
|
22
|
+
previewUrl = inject(DomSanitizer).bypassSecurityTrustResourceUrl(inject(LivePreviewUrlService).iframeUrl);
|
|
23
|
+
previewIframe = viewChild.required('previewIframe', /* @ts-ignore */
|
|
24
|
+
...(ngDevMode ? [{ debugName: "previewIframe" }] : /* istanbul ignore next */ []));
|
|
25
|
+
iframeChange = output();
|
|
26
|
+
ngAfterViewInit() {
|
|
27
|
+
this.iframeChange.emit(this.previewIframe());
|
|
28
|
+
}
|
|
29
|
+
ngOnDestroy() {
|
|
30
|
+
this.iframeChange.emit(undefined);
|
|
31
|
+
}
|
|
32
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SiLivePreviewIframeModeComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
33
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.0.8", type: SiLivePreviewIframeModeComponent, isStandalone: true, selector: "si-live-preview-iframe-mode", outputs: { iframeChange: "iframeChange" }, viewQueries: [{ propertyName: "previewIframe", first: true, predicate: ["previewIframe"], descendants: true, isSignal: true }], ngImport: i0, template: `<iframe #previewIframe title="Example view" [src]="previewUrl"></iframe>`, isInline: true, styles: [":host{display:block;flex:1;min-block-size:0}iframe{border:0;display:block;block-size:100%;inline-size:100%}\n"] });
|
|
34
|
+
}
|
|
35
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SiLivePreviewIframeModeComponent, decorators: [{
|
|
36
|
+
type: Component,
|
|
37
|
+
args: [{ selector: 'si-live-preview-iframe-mode', template: `<iframe #previewIframe title="Example view" [src]="previewUrl"></iframe>`, styles: [":host{display:block;flex:1;min-block-size:0}iframe{border:0;display:block;block-size:100%;inline-size:100%}\n"] }]
|
|
38
|
+
}], propDecorators: { previewIframe: [{ type: i0.ViewChild, args: ['previewIframe', { isSignal: true }] }], iframeChange: [{ type: i0.Output, args: ["iframeChange"] }] } });
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Copyright (c) Siemens 2016 - 2026
|
|
42
|
+
* SPDX-License-Identifier: MIT
|
|
43
|
+
*/
|
|
44
|
+
class SiLivePreviewQrComponent {
|
|
45
|
+
url = input(/* @ts-ignore */
|
|
46
|
+
...(ngDevMode ? [undefined, { debugName: "url" }] : /* istanbul ignore next */ []));
|
|
47
|
+
urlShort = input(/* @ts-ignore */
|
|
48
|
+
...(ngDevMode ? [undefined, { debugName: "urlShort" }] : /* istanbul ignore next */ []));
|
|
49
|
+
closed = output();
|
|
50
|
+
qrImg = computed(() => {
|
|
51
|
+
const url = this.url();
|
|
52
|
+
const urlShort = this.urlShort();
|
|
53
|
+
if (!url || !urlShort) {
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
const qr = qrcode(0, 'L');
|
|
57
|
+
qr.addData(this.qrShort() ? urlShort : url);
|
|
58
|
+
qr.make();
|
|
59
|
+
return qr.createImgTag(2);
|
|
60
|
+
}, /* @ts-ignore */
|
|
61
|
+
...(ngDevMode ? [{ debugName: "qrImg" }] : /* istanbul ignore next */ []));
|
|
62
|
+
qrShort = computed(() => (this.url()?.length ?? 0) > 2953, /* @ts-ignore */
|
|
63
|
+
...(ngDevMode ? [{ debugName: "qrShort" }] : /* istanbul ignore next */ []));
|
|
64
|
+
unlisten;
|
|
65
|
+
ngAfterViewInit() {
|
|
66
|
+
const listener = () => this.closed.emit();
|
|
67
|
+
setTimeout(() => window.addEventListener('click', listener));
|
|
68
|
+
this.unlisten = () => window.removeEventListener('click', listener);
|
|
69
|
+
}
|
|
70
|
+
ngOnDestroy() {
|
|
71
|
+
if (this.unlisten) {
|
|
72
|
+
this.unlisten();
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SiLivePreviewQrComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
76
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.8", type: SiLivePreviewQrComponent, isStandalone: true, selector: "si-live-preview-qr", inputs: { url: { classPropertyName: "url", publicName: "url", isSignal: true, isRequired: false, transformFunction: null }, urlShort: { classPropertyName: "urlShort", publicName: "urlShort", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { closed: "closed" }, ngImport: i0, template: "<div class=\"qr\" [innerHTML]=\"qrImg()\"></div>\n@if (qrShort()) {\n <span>\n <b>Note</b>: not using template, too long for QR\n <span class=\"url-len\">({{ url()?.length }})</span>\n </span>\n}\n<hr />\n<a target=\"_blank\" [href]=\"url()\">Open in new tab</a>\n", styles: ["a{color:var(--si-sys-color-text-accent)}a:after{display:none}a:hover{color:var(--si-sys-color-text-accent-hover)}*:focus-visible{outline:var(--si-sys-sizing-focus-ring-width, 2px) solid var(--si-sys-color-effects-focus);outline-offset:var(--si-sys-sizing-focus-ring-offset, 1px)}:host{position:absolute;z-index:1000;inset-block-start:100%;inset-inline-end:0;min-inline-size:150px;min-block-size:150px;padding:16px;margin-block-start:4px;border-radius:8px;box-shadow:0 0 8px #00000029,0 8px 8px #00000014;background:var(--si-sys-color-background-0)}.qr ::ng-deep img{max-inline-size:unset}hr{margin-block:12px;border:0;border-block-start:1px solid var(--si-sys-color-border-4)}.url-length{display:none}\n"], changeDetection: i0.ChangeDetectionStrategy.Eager });
|
|
77
|
+
}
|
|
78
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SiLivePreviewQrComponent, decorators: [{
|
|
79
|
+
type: Component,
|
|
80
|
+
args: [{ selector: 'si-live-preview-qr', changeDetection: ChangeDetectionStrategy.Eager, template: "<div class=\"qr\" [innerHTML]=\"qrImg()\"></div>\n@if (qrShort()) {\n <span>\n <b>Note</b>: not using template, too long for QR\n <span class=\"url-len\">({{ url()?.length }})</span>\n </span>\n}\n<hr />\n<a target=\"_blank\" [href]=\"url()\">Open in new tab</a>\n", styles: ["a{color:var(--si-sys-color-text-accent)}a:after{display:none}a:hover{color:var(--si-sys-color-text-accent-hover)}*:focus-visible{outline:var(--si-sys-sizing-focus-ring-width, 2px) solid var(--si-sys-color-effects-focus);outline-offset:var(--si-sys-sizing-focus-ring-offset, 1px)}:host{position:absolute;z-index:1000;inset-block-start:100%;inset-inline-end:0;min-inline-size:150px;min-block-size:150px;padding:16px;margin-block-start:4px;border-radius:8px;box-shadow:0 0 8px #00000029,0 8px 8px #00000014;background:var(--si-sys-color-background-0)}.qr ::ng-deep img{max-inline-size:unset}hr{margin-block:12px;border:0;border-block-start:1px solid var(--si-sys-color-border-4)}.url-length{display:none}\n"] }]
|
|
81
|
+
}], propDecorators: { url: [{ type: i0.Input, args: [{ isSignal: true, alias: "url", required: false }] }], urlShort: [{ type: i0.Input, args: [{ isSignal: true, alias: "urlShort", required: false }] }], closed: [{ type: i0.Output, args: ["closed"] }] } });
|
|
82
|
+
|
|
83
|
+
const availableDevices = [
|
|
84
|
+
{
|
|
85
|
+
id: 'iphone-12-pro',
|
|
86
|
+
mode: 'ios',
|
|
87
|
+
name: 'iPhone 12 / 12 Pro',
|
|
88
|
+
height: '844',
|
|
89
|
+
width: '390',
|
|
90
|
+
notch: true,
|
|
91
|
+
safeAreaPortrait: { top: 44, bottom: 34, left: 0, right: 0 },
|
|
92
|
+
safeAreaLandscape: { top: 0, bottom: 21, left: 44, right: 44 }
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
id: 'iphone-11-pro',
|
|
96
|
+
mode: 'ios',
|
|
97
|
+
name: 'iPhone 11 Pro',
|
|
98
|
+
height: '812',
|
|
99
|
+
width: '375',
|
|
100
|
+
notch: true,
|
|
101
|
+
safeAreaPortrait: { top: 44, bottom: 34, left: 0, right: 0 },
|
|
102
|
+
safeAreaLandscape: { top: 0, bottom: 21, left: 44, right: 44 }
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
id: 'iphone-11',
|
|
106
|
+
mode: 'ios',
|
|
107
|
+
name: 'iPhone 11',
|
|
108
|
+
height: '896',
|
|
109
|
+
width: '414',
|
|
110
|
+
notch: true,
|
|
111
|
+
safeAreaPortrait: { top: 44, bottom: 34, left: 0, right: 0 },
|
|
112
|
+
safeAreaLandscape: { top: 0, bottom: 21, left: 44, right: 44 }
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
id: 'iphone-x',
|
|
116
|
+
mode: 'ios',
|
|
117
|
+
name: 'iPhone X / XS',
|
|
118
|
+
height: '812',
|
|
119
|
+
width: '375',
|
|
120
|
+
notch: true,
|
|
121
|
+
safeAreaPortrait: { top: 44, bottom: 34, left: 0, right: 0 },
|
|
122
|
+
safeAreaLandscape: { top: 0, bottom: 21, left: 44, right: 44 }
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
id: 'iphone-8',
|
|
126
|
+
mode: 'ios',
|
|
127
|
+
name: 'iPhone 8',
|
|
128
|
+
height: '667',
|
|
129
|
+
width: '375',
|
|
130
|
+
safeAreaPortrait: { top: 20, bottom: 0, left: 0, right: 0 },
|
|
131
|
+
safeAreaLandscape: { top: 0, bottom: 0, left: 0, right: 0 }
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
id: 'samsung-gal-s20',
|
|
135
|
+
mode: 'md',
|
|
136
|
+
name: 'Samsung Galaxy S20',
|
|
137
|
+
height: '800',
|
|
138
|
+
width: '360',
|
|
139
|
+
safeAreaPortrait: { top: 20, bottom: 10, left: 0, right: 0 },
|
|
140
|
+
safeAreaLandscape: { top: 20, bottom: 10, left: 0, right: 0 }
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
id: 'samsung-gal-s10',
|
|
144
|
+
mode: 'md',
|
|
145
|
+
name: 'Samsung Galaxy S10',
|
|
146
|
+
height: '760',
|
|
147
|
+
width: '360',
|
|
148
|
+
safeAreaPortrait: { top: 20, bottom: 10, left: 0, right: 0 },
|
|
149
|
+
safeAreaLandscape: { top: 20, bottom: 10, left: 0, right: 0 }
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
id: 'samsung-gal-s9',
|
|
153
|
+
mode: 'md',
|
|
154
|
+
name: 'Samsung Galaxy S9',
|
|
155
|
+
height: '740',
|
|
156
|
+
width: '360',
|
|
157
|
+
safeAreaPortrait: { top: 20, bottom: 10, left: 0, right: 0 },
|
|
158
|
+
safeAreaLandscape: { top: 20, bottom: 10, left: 0, right: 0 }
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
id: 'samsung-gal-note10',
|
|
162
|
+
mode: 'md',
|
|
163
|
+
name: 'Samsung Galaxy Note 10',
|
|
164
|
+
height: '869',
|
|
165
|
+
width: '412',
|
|
166
|
+
safeAreaPortrait: { top: 20, bottom: 10, left: 0, right: 0 },
|
|
167
|
+
safeAreaLandscape: { top: 20, bottom: 10, left: 0, right: 0 }
|
|
168
|
+
}
|
|
169
|
+
];
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Copyright (c) Siemens 2016 - 2026
|
|
173
|
+
* SPDX-License-Identifier: MIT
|
|
174
|
+
*/
|
|
175
|
+
class SiLivePreviewMobileModeComponent {
|
|
176
|
+
previewIframe = viewChild.required('previewIframe', /* @ts-ignore */
|
|
177
|
+
...(ngDevMode ? [{ debugName: "previewIframe" }] : /* istanbul ignore next */ []));
|
|
178
|
+
config = inject(SI_LIVE_PREVIEW_CONFIG);
|
|
179
|
+
urls = inject(LivePreviewUrlService);
|
|
180
|
+
previewUrl = inject(DomSanitizer).bypassSecurityTrustResourceUrl(this.urls.iframeUrl);
|
|
181
|
+
state = inject(LivePreviewStateService);
|
|
182
|
+
iframeChange = output();
|
|
183
|
+
switcherEnabled = this.config.themeSwitcher;
|
|
184
|
+
landscapeEnabled = this.config.landscapeToggle;
|
|
185
|
+
availableDevices = availableDevices;
|
|
186
|
+
selectedDevice = signal(undefined, /* @ts-ignore */
|
|
187
|
+
...(ngDevMode ? [{ debugName: "selectedDevice" }] : /* istanbul ignore next */ []));
|
|
188
|
+
landscape = signal(false, /* @ts-ignore */
|
|
189
|
+
...(ngDevMode ? [{ debugName: "landscape" }] : /* istanbul ignore next */ []));
|
|
190
|
+
showQrMenu = signal(false, /* @ts-ignore */
|
|
191
|
+
...(ngDevMode ? [{ debugName: "showQrMenu" }] : /* istanbul ignore next */ []));
|
|
192
|
+
plainUrl = signal('', /* @ts-ignore */
|
|
193
|
+
...(ngDevMode ? [{ debugName: "plainUrl" }] : /* istanbul ignore next */ []));
|
|
194
|
+
plainUrlShort = signal('', /* @ts-ignore */
|
|
195
|
+
...(ngDevMode ? [{ debugName: "plainUrlShort" }] : /* istanbul ignore next */ []));
|
|
196
|
+
mode = computed(() => this.selectedDevice()?.mode ?? 'ios', /* @ts-ignore */
|
|
197
|
+
...(ngDevMode ? [{ debugName: "mode" }] : /* istanbul ignore next */ []));
|
|
198
|
+
showNotch = computed(() => this.selectedDevice()?.notch ?? false, /* @ts-ignore */
|
|
199
|
+
...(ngDevMode ? [{ debugName: "showNotch" }] : /* istanbul ignore next */ []));
|
|
200
|
+
currentIFrameHeight = computed(() => {
|
|
201
|
+
const device = this.selectedDevice();
|
|
202
|
+
return device ? (this.landscape() ? device.width : device.height) : this.state.iFrameHeight();
|
|
203
|
+
}, /* @ts-ignore */
|
|
204
|
+
...(ngDevMode ? [{ debugName: "currentIFrameHeight" }] : /* istanbul ignore next */ []));
|
|
205
|
+
currentIFrameWidth = computed(() => {
|
|
206
|
+
const device = this.selectedDevice();
|
|
207
|
+
return device ? (this.landscape() ? device.height : device.width) : this.state.iFrameWidth();
|
|
208
|
+
}, /* @ts-ignore */
|
|
209
|
+
...(ngDevMode ? [{ debugName: "currentIFrameWidth" }] : /* istanbul ignore next */ []));
|
|
210
|
+
constructor() {
|
|
211
|
+
effect(() => {
|
|
212
|
+
if (!this.state.supportsLandscape() && this.landscape()) {
|
|
213
|
+
this.landscape.set(false);
|
|
214
|
+
this.emitViewport();
|
|
215
|
+
}
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
ngOnInit() {
|
|
219
|
+
const deviceId = localStorage.getItem('si-live-preview-selected-device');
|
|
220
|
+
this.selectDevice(this.availableDevices.find(device => device.id === deviceId));
|
|
221
|
+
}
|
|
222
|
+
ngAfterViewInit() {
|
|
223
|
+
this.iframeChange.emit(this.previewIframe());
|
|
224
|
+
}
|
|
225
|
+
ngOnDestroy() {
|
|
226
|
+
this.iframeChange.emit(undefined);
|
|
227
|
+
}
|
|
228
|
+
selectDevice(device) {
|
|
229
|
+
const selectedDevice = device ?? this.availableDevices[0];
|
|
230
|
+
this.selectedDevice.set(selectedDevice);
|
|
231
|
+
localStorage.setItem('si-live-preview-selected-device', selectedDevice.id);
|
|
232
|
+
this.emitViewport();
|
|
233
|
+
}
|
|
234
|
+
deviceChanged() {
|
|
235
|
+
this.selectDevice(this.selectedDevice());
|
|
236
|
+
}
|
|
237
|
+
toggleLandscape() {
|
|
238
|
+
this.landscape.update(landscape => !landscape);
|
|
239
|
+
this.emitViewport();
|
|
240
|
+
}
|
|
241
|
+
openQrMenu() {
|
|
242
|
+
this.plainUrl.set(this.urls.viewerUrl('plain', { deviceMode: this.mode() }));
|
|
243
|
+
this.plainUrlShort.set(this.urls.viewerUrl('plain', { deviceMode: this.mode(), skipTemplate: true }));
|
|
244
|
+
this.showQrMenu.set(true);
|
|
245
|
+
}
|
|
246
|
+
emitViewport() {
|
|
247
|
+
const device = this.selectedDevice();
|
|
248
|
+
const safeArea = this.landscape() ? device?.safeAreaLandscape : device?.safeAreaPortrait;
|
|
249
|
+
this.state.viewport.set({
|
|
250
|
+
mode: this.mode(),
|
|
251
|
+
safeAreaTop: safeArea?.top,
|
|
252
|
+
safeAreaBottom: safeArea?.bottom,
|
|
253
|
+
safeAreaLeft: safeArea?.left,
|
|
254
|
+
safeAreaRight: safeArea?.right
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SiLivePreviewMobileModeComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
258
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.8", type: SiLivePreviewMobileModeComponent, isStandalone: true, selector: "si-live-preview-mobile-mode", outputs: { iframeChange: "iframeChange" }, viewQueries: [{ propertyName: "previewIframe", first: true, predicate: ["previewIframe"], descendants: true, isSignal: true }], ngImport: i0, template: "<section class=\"settings-selection\">\n <select\n class=\"device-selection\"\n aria-label=\"Select preview device\"\n [ngModel]=\"selectedDevice()\"\n (ngModelChange)=\"selectDevice($event)\"\n >\n @for (device of availableDevices; track device.id) {\n <option [ngValue]=\"device\">\n {{ device.name }}\n </option>\n }\n </select>\n <div class=\"toggle-wrapper\">\n @if (landscapeEnabled) {\n <button\n type=\"button\"\n title=\"Rotate phone\"\n aria-label=\"Rotate phone\"\n [disabled]=\"!state.supportsLandscape()\"\n (click)=\"toggleLandscape()\"\n >\n @if (!landscape()) {\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\">\n <path\n d=\"M105.34,240.51c.27.27.56.53.85.77s.29.22.44.33.33.25.51.37l.52.32.48.28c.18.1.37.18.55.27l.52.24.54.19c.19.07.37.14.57.2a5.36,5.36,0,0,0,.54.14c.2,0,.39.11.6.15s.42.06.63.09l.53.08a11.63,11.63,0,0,0,2.36,0l.53-.08c.21,0,.43-.05.63-.09l.6-.15a5.36,5.36,0,0,0,.54-.14c.2-.06.38-.13.57-.2l.54-.19.52-.24c.18-.09.37-.17.55-.27l.48-.28.52-.32c.18-.12.34-.25.51-.37l.44-.33c.29-.24.58-.5.85-.77l0,0,41.87-41.88a12,12,0,1,0-17-17L125.8,203V131.5A21.52,21.52,0,0,1,147.3,110h58.62a12,12,0,0,0,0-24H147.3a45.55,45.55,0,0,0-45.5,45.5V203L80.41,181.64a12,12,0,0,0-17,17l41.87,41.88Z\"\n />\n <path d=\"M100.8,400a12,12,0,1,0,0,24h100a12,12,0,0,0,0-24Z\" />\n <path d=\"M336.11,348h-.22a16,16,0,0,0,0,32h.22a16,16,0,0,0,0-32Z\" />\n <path\n d=\"M407.43,88H264.57C242.2,88,224,107.38,224,131.2V380.8c0,23.82,18.2,43.2,40.57,43.2H407.43C429.8,424,448,404.62,448,380.8V131.2C448,107.38,429.8,88,407.43,88ZM424,380.8c0,10.59-7.43,19.2-16.57,19.2H264.57c-9.14,0-16.57-8.61-16.57-19.2V131.2c0-10.59,7.43-19.2,16.57-19.2H274a12,12,0,0,0,12,12H386a12,12,0,0,0,12-12h9.43c9.14,0,16.57,8.61,16.57,19.2Z\"\n />\n </svg>\n } @else {\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\">\n <path\n d=\"M86,147.3v58.62a12,12,0,0,0,24,0V147.3a21.52,21.52,0,0,1,21.5-21.5H203l-21.39,21.39a12,12,0,0,0,17,17l41.88-41.87,0,0c.27-.27.53-.56.77-.85l.32-.43c.13-.17.26-.34.38-.52s.21-.34.31-.52.2-.32.29-.48.18-.36.26-.54.17-.35.25-.53.13-.35.19-.53.14-.38.2-.58a4.58,4.58,0,0,0,.14-.53c0-.2.11-.4.15-.61s.06-.41.09-.61.06-.36.08-.55a10.88,10.88,0,0,0,.06-1.14v-.08a10.88,10.88,0,0,0-.06-1.14c0-.19-.05-.37-.08-.55s-.05-.41-.09-.61-.1-.41-.15-.61a4.58,4.58,0,0,0-.14-.53c-.06-.2-.13-.39-.2-.58s-.12-.36-.19-.53-.16-.35-.25-.53-.16-.36-.26-.54-.19-.32-.29-.48-.2-.35-.31-.52-.25-.35-.38-.52l-.32-.43c-.24-.29-.5-.58-.77-.85l0,0L198.61,63.44a12,12,0,0,0-17,17L203,101.8H131.5A45.55,45.55,0,0,0,86,147.3Z\"\n />\n <path d=\"M412,88.8a12,12,0,0,0-12,12v100a12,12,0,0,0,24,0v-100A12,12,0,0,0,412,88.8Z\" />\n <path d=\"M362.11,320h-.22a16,16,0,0,0,0,32h.22a16,16,0,0,0,0-32Z\" />\n <path\n d=\"M380.8,224H131.2C107.38,224,88,242.2,88,264.57V407.43C88,429.8,107.38,448,131.2,448H380.8c23.82,0,43.2-18.2,43.2-40.57V264.57C424,242.2,404.62,224,380.8,224ZM400,407.43c0,9.14-8.61,16.57-19.2,16.57H131.2c-10.59,0-19.2-7.43-19.2-16.57V398a12,12,0,0,0,12-12V286a12,12,0,0,0-12-12v-9.43c0-9.14,8.61-16.57,19.2-16.57H380.8c10.59,0,19.2,7.43,19.2,16.57Z\"\n />\n </svg>\n }\n </button>\n }\n @if (switcherEnabled) {\n <button\n type=\"button\"\n title=\"Toggle theme\"\n aria-label=\"Toggle theme\"\n (click)=\"state.toggleTheme()\"\n >\n @if (state.theme() === 'dark') {\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\">\n <path\n d=\"M256,349.82A93.82,93.82,0,1,0,162.18,256,93.93,93.93,0,0,0,256,349.82Zm0-163.64A69.82,69.82,0,1,1,186.18,256,69.9,69.9,0,0,1,256,186.18Z\"\n />\n <path\n d=\"M256,120.73a12,12,0,0,0,12-12V76a12,12,0,0,0-24,0v32.73A12,12,0,0,0,256,120.73Z\"\n />\n <path d=\"M268,436V403.27a12,12,0,0,0-24,0V436a12,12,0,0,0,24,0Z\" />\n <path d=\"M143.44,160.41a12,12,0,1,0,17-17l-23.23-23.23a12,12,0,1,0-17,17Z\" />\n <path\n d=\"M351.59,351.59a12,12,0,0,0,0,17l23.23,23.23a12,12,0,0,0,17-17l-23.23-23.23A12,12,0,0,0,351.59,351.59Z\"\n />\n <path\n d=\"M120.73,256a12,12,0,0,0-12-12H76a12,12,0,0,0,0,24h32.73A12,12,0,0,0,120.73,256Z\"\n />\n <path d=\"M436,244H403.27a12,12,0,0,0,0,24H436a12,12,0,0,0,0-24Z\" />\n <path\n d=\"M137.18,391.79l23.23-23.23a12,12,0,1,0-17-17l-23.23,23.23a12,12,0,1,0,17,17Z\"\n />\n <path\n d=\"M360.07,163.93a12,12,0,0,0,8.49-3.52l23.23-23.23a12,12,0,1,0-17-17l-23.23,23.23a12,12,0,0,0,8.48,20.49Z\"\n />\n </svg>\n } @else {\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\">\n <path\n d=\"M360.07,147.88a12,12,0,0,0,5.89-21.1,168.05,168.05,0,0,0-214.71,0C80,186,70.19,292.1,129.38,363.35a166.9,166.9,0,0,0,113.77,59.93q7.9.74,15.75.73A166.74,166.74,0,0,0,366,385.22a12,12,0,0,0-5.89-21.1,109.33,109.33,0,0,1,0-216.24ZM244.43,275.77A133.48,133.48,0,0,0,330,381.08,144.11,144.11,0,0,1,147.84,348C97.1,287,105.51,196,166.58,145.24A144.08,144.08,0,0,1,330,130.94C272,152.38,234.91,212.29,244.43,275.77Z\"\n />\n </svg>\n }\n </button>\n }\n <button\n type=\"button\"\n title=\"Show QR code\"\n aria-label=\"Show QR code\"\n class=\"qr-button\"\n (click)=\"openQrMenu()\"\n >\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\">\n <path\n d=\"M100 180a12 12 0 01-12-12v-56a24 24 0 0124-24h56a12 12 0 010 24h-56v56a12 12 0 01-12 12zM412 180a12 12 0 01-12-12v-56h-56a12 12 0 010-24h56a24 24 0 0124 24v56a12 12 0 01-12 12zM168 424h-56a24 24 0 01-24-24v-56a12 12 0 0124 0v56h56a12 12 0 010 24zM400 424h-56a12 12 0 010-24h56v-56a12 12 0 0124 0v56a24 24 0 01-24 24zM176.11 172.11h27.79v27.79h-27.79zM424 304H88a12 12 0 010-24h336a12 12 0 010 24z\"\n />\n <path\n d=\"M244.37 377.69H137.4V318h24v35.69h82.97v24zM374.36 193.69h-24V158h-49.87v-24h73.87v59.69z\"\n />\n <path\n d=\"M189.34 318h48.05v24h-48.05zM350.37 318v35.69H333.1V318h-67.54v24h43.54v11.69h-23.86v24h89.13V318h-24zM242 238H138V134h104zm-80-24h56v-56h-56zM261.33 134h24v44.54h-24zM350.36 225.06h24v44.54h-24zM301.77 169h30.29v24h-30.29zM328.18 267h-64v-64h64zm-40-24h16v-16h-16z\"\n />\n </svg>\n @if (showQrMenu()) {\n <si-live-preview-qr\n title=\"\"\n [url]=\"plainUrl()\"\n [urlShort]=\"plainUrlShort()\"\n (closed)=\"showQrMenu.set(false)\"\n />\n }\n </button>\n </div>\n</section>\n\n<div\n class=\"device\"\n [class.md]=\"mode() !== 'ios'\"\n [class.ios]=\"mode() === 'ios' && !showNotch()\"\n [class.ios-with-notch]=\"mode() === 'ios' && showNotch()\"\n [class.dark]=\"state.theme() === 'dark'\"\n [class.landscape]=\"landscape()\"\n>\n @if (mode() !== 'ios') {\n <div class=\"wrapper\">\n <svg class=\"md-bar\" viewBox=\"0 0 130 40.3\" [class.dark]=\"state.theme() === 'dark'\">\n <path\n d=\"m 16,4.2 h 64 c 8.8,0 16,7.2 16,16 0,8.8 -7.2,16 -16,16 H 16 C 7.2,36.2 0,29 0,20.2 0,11.4 7.2,4.2 16,4.2 Z\"\n />\n </svg>\n <svg class=\"md-bar\" viewBox=\"0 0 199.99999 40.3\" [class.dark]=\"state.theme() === 'dark'\">\n <path\n d=\"M 155,5.0124996 173.8,37.3125 c 0.8,1.3 2.7,1.3 3.5,0 L 196,5.0124996 c 0.8,-1.3 -0.2,-3 -1.7,-3 h -37.6 c -1.5,0 -2.5,1.7 -1.7,3 z\"\n />\n <circle r=\"20\" cy=\"20.15\" cx=\"111\" class=\"st0\" />\n <path\n d=\"m 25,1.1499996 h 30 c 2.2,0 4,1.8 4,4 V 35.15 c 0,2.2 -1.8,4 -4,4 H 25 c -2.2,0 -4,-1.8 -4,-4 V 5.1499996 c 0,-2.3 1.8,-4 4,-4 z\"\n />\n </svg>\n </div>\n } @else {\n @if (showNotch()) {\n <!-- iOS devices with notch -->\n <div class=\"notch\">\n <div class=\"camera\"></div>\n <div class=\"speaker\"></div>\n </div>\n <div class=\"sleep\"></div>\n <div class=\"volume\"></div>\n } @else {\n <!-- iOS devices without notch -->\n <div class=\"camera\"></div>\n <div class=\"speaker\"></div>\n <div class=\"sensor\"></div>\n <div class=\"sleep\"></div>\n <div class=\"volume\"></div>\n <div class=\"home\"></div>\n }\n }\n\n <div class=\"screen\">\n <iframe\n #previewIframe\n title=\"Mobile example view\"\n [src]=\"previewUrl\"\n [height]=\"currentIFrameHeight()\"\n [width]=\"currentIFrameWidth()\"\n ></iframe>\n </div>\n</div>\n", styles: ["*:focus-visible{outline:var(--si-sys-sizing-focus-ring-width, 2px) solid var(--si-sys-color-effects-focus);outline-offset:var(--si-sys-sizing-focus-ring-offset, 1px)}:host{display:block}iframe{border:0;display:block}.settings-selection{display:flex;align-items:center;justify-content:space-between;margin-block:10px 20px;margin-inline:0}.settings-selection .toggle-wrapper{display:flex}.settings-selection .toggle-wrapper button{background:var(--si-sys-color-background-accent-secondary);display:flex;align-items:center;justify-content:center;block-size:40px;inline-size:40px;border:1px solid var(--si-sys-color-border-4);border-radius:50%;margin-inline-start:10px;position:relative}.settings-selection .toggle-wrapper button>svg{block-size:24px;fill:var(--si-sys-color-text-primary)}.settings-selection .toggle-wrapper button>svg:hover{fill:var(--si-sys-color-text-accent-hover)}.settings-selection .toggle-wrapper button:disabled>svg{fill:var(--si-sys-color-text-primary)}.device-selection{appearance:none;background-color:var(--si-sys-color-background-0);background-image:url(\"data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'><path d='M352.79 203.21a12.45 12.45 0 011.44 15.86l-1.44 1.72-88 88a12.45 12.45 0 01-15.86 1.44l-1.72-1.44-88-88a12.43 12.43 0 0115.86-19l1.72 1.44L256 282.42l79.21-79.21a12.45 12.45 0 0115.86-1.44z'/></svg>\");background-repeat:no-repeat;background-position:right 2px top 50%;color:var(--si-sys-color-text-primary);block-size:35px;min-inline-size:200px;border-radius:2px;border:1px solid var(--si-sys-color-border-4);padding:6px;margin-block:0;display:flex;flex:1}.device{position:relative;box-sizing:content-box}.device .screen{background:var(--si-sys-color-background-0);box-shadow:0 0 0 3px #111;border-radius:1px;block-size:100%;inline-size:100%;position:relative;overflow:hidden;display:block}.device.md{margin-top:20px;box-shadow:0 0 0 14px #090a0d,0 0 0 17px #9fa3a8,0 0 34px 17px #0003;overflow:hidden;border-radius:20px}.device.md .wrapper{margin:0 auto;position:absolute;top:0;left:0;right:0;z-index:4;display:flex;height:25px;justify-content:space-between}.device.md .wrapper .md-bar{fill:#090a0d;opacity:.2;padding:7px 11px}.device.md .wrapper .md-bar.dark{fill:#fff;opacity:.5}.device.ios-with-notch{padding:26px;background:#fdfdfd;box-shadow:inset 0 0 11px #000;border-radius:66px}.device.ios-with-notch:before{background:#000;border-radius:61px;height:calc(100% - 10px);width:calc(100% - 10px);position:absolute;top:5px;left:5px;content:\"\"}.device.ios-with-notch:after{background:#00000080;border-radius:2px;height:4px;width:130px;position:absolute;right:0;bottom:32px;left:0;content:\"\";margin:0 auto}.device.ios-with-notch.dark:after{background:#fff;opacity:.5}.device.ios-with-notch .screen{border-radius:40px}.device.ios-with-notch .volume,.device.ios-with-notch .volume:before,.device.ios-with-notch .volume:after,.device.ios-with-notch .sleep{background:#b5b5b5;width:3px;position:absolute}.device.ios-with-notch .volume{height:32px;top:116px;left:-3px}.device.ios-with-notch .volume:before{height:62px;top:62px;left:0;content:\"\"}.device.ios-with-notch .volume:after{height:62px;top:140px;left:0;content:\"\"}.device.ios-with-notch .sleep{height:96px;top:200px;right:-3px}.device.ios-with-notch .camera{background:#0d4d71;border-radius:100%;height:6px;width:6px;position:absolute;top:9px;left:154px}.device.ios-with-notch .speaker{background:#171818;border-radius:6px;height:6px;width:60px;position:absolute;top:9px;left:50%;margin-left:-30px}.device.ios-with-notch .notch{background:#000;border-bottom-left-radius:24px;border-bottom-right-radius:24px;height:30px;width:210px;position:absolute;top:26px;left:50%;margin-left:-105px;z-index:4}.device.ios-with-notch .notch:before,.device.ios-with-notch .notch:after{height:8px;width:8px;position:absolute;top:0;content:\"\"}.device.ios-with-notch .notch:after{background:radial-gradient(circle at bottom left,transparent 0,transparent 70%,#000 70%,#000 100%);left:-8px}.device.ios-with-notch .notch:before{background:radial-gradient(circle at bottom right,transparent 0,transparent 70%,#000 70%,#000 100%);right:-8px}.device.ios-with-notch.landscape .volume,.device.ios-with-notch.landscape .volume:before,.device.ios-with-notch.landscape .volume:after,.device.ios-with-notch.landscape .sleep{height:3px}.device.ios-with-notch.landscape .volume{width:32px;top:auto;left:116px;bottom:-3px}.device.ios-with-notch.landscape .volume:before{width:62px;top:0;left:62px}.device.ios-with-notch.landscape .volume:after{width:62px;top:0;left:140px}.device.ios-with-notch.landscape .sleep{width:96px;top:-3px;right:auto;left:200px}.device.ios-with-notch.landscape .camera{top:auto;bottom:154px;left:9px}.device.ios-with-notch.landscape .speaker{height:60px;width:6px;top:50%;left:9px;margin-top:-30px;margin-left:0}.device.ios-with-notch.landscape .notch{border-top-right-radius:24px;border-bottom-right-radius:24px;border-bottom-left-radius:0;height:210px;width:30px;top:50%;margin-top:-105px;margin-left:unset;left:unset}.device.ios-with-notch.landscape .notch:before,.device.ios-with-notch.landscape .notch:after{left:0}.device.ios-with-notch.landscape .notch:after{background:radial-gradient(circle at bottom right,transparent 0,transparent 70%,#000 70%,#000 100%);top:auto;bottom:-8px}.device.ios-with-notch.landscape .notch:before{background:radial-gradient(circle at top right,transparent 0,transparent 70%,#000 70%,#000 100%);top:-8px}.device.ios{background:#464646;box-shadow:inset 0 0 3px #000000b3;border-radius:56px;padding:105px 24px}.device.ios:before{background:#080808;border-radius:50px;height:calc(100% - 12px);width:calc(100% - 12px);position:absolute;top:6px;left:6px;content:\"\"}.device.ios .home{background:linear-gradient(135deg,#080808,#464646,#080808);border-radius:100%;height:68px;width:68px;position:absolute;bottom:22px;left:50%;margin-left:-34px}.device.ios .home:before{background:#080808;border-radius:100%;height:calc(100% - 8px);width:calc(100% - 8px);position:absolute;top:4px;left:4px;content:\"\"}.device.ios .sleep{background:#464646;border-radius:0 2px 2px 0;height:66px;width:4px;position:absolute;top:190px;right:-4px}.device.ios .volume{background:#464646;border-radius:2px 0 0 2px;height:66px;width:4px;position:absolute;top:188px;left:-4px}.device.ios .volume:before{background:inherit;border-radius:2px 0 0 2px;height:40px;width:2px;position:absolute;top:-78px;left:2px;content:\"\"}.device.ios .volume:after{background:inherit;border-radius:2px 0 0 2px;height:66px;width:4px;position:absolute;top:82px;left:0;content:\"\"}.device.ios .camera{background:#080808;border-radius:100%;height:12px;width:12px;position:absolute;top:24px;left:50%;margin-left:-6px}.device.ios .sensor{background:#3c3d3d;border-radius:100%;height:16px;width:16px;position:absolute;top:49px;left:134px}.device.ios .speaker{background:#292728;border-radius:6px;height:6px;width:70px;position:absolute;top:54px;left:50%;margin-left:-35px}.device.ios.landscape{padding:24px 105px}.device.ios.landscape .sleep{border-radius:2px 2px 0 0;height:4px;width:66px;top:unset;bottom:100%;left:190px}.device.ios.landscape .volume{border-radius:0 0 2px 2px;height:4px;width:66px;bottom:-4px;top:unset;right:calc(100% - 254px);left:unset}.device.ios.landscape .volume:before{border-radius:0 0 2px 2px;height:2px;width:40px;top:unset;bottom:2px;left:-78px;right:auto}.device.ios.landscape .volume:after{border-radius:0 0 2px 2px;height:4px;width:66px;top:unset;bottom:0;right:-82px;left:unset}.device.ios.landscape .home{top:50%;right:22px;left:unset;margin-top:-34px;margin-left:unset}.device.ios.landscape .sensor{top:134px;right:calc(100% - 65px);left:unset}.device.ios.landscape .speaker{height:70px;width:6px;top:50%;right:calc(100% - 60px);left:unset;margin-top:-35px;margin-left:unset}.device.ios.landscape .camera{top:50%;right:calc(100% - 32px);left:unset;margin-top:-6px;margin-left:unset}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i1.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i1.SelectControlValueAccessor, selector: "select:not([multiple]):not([ngNoCva])[formControlName],select:not([multiple]):not([ngNoCva])[formControl],select:not([multiple]):not([ngNoCva])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: SiLivePreviewQrComponent, selector: "si-live-preview-qr", inputs: ["url", "urlShort"], outputs: ["closed"] }] });
|
|
259
|
+
}
|
|
260
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SiLivePreviewMobileModeComponent, decorators: [{
|
|
261
|
+
type: Component,
|
|
262
|
+
args: [{ selector: 'si-live-preview-mobile-mode', imports: [FormsModule, SiLivePreviewQrComponent], template: "<section class=\"settings-selection\">\n <select\n class=\"device-selection\"\n aria-label=\"Select preview device\"\n [ngModel]=\"selectedDevice()\"\n (ngModelChange)=\"selectDevice($event)\"\n >\n @for (device of availableDevices; track device.id) {\n <option [ngValue]=\"device\">\n {{ device.name }}\n </option>\n }\n </select>\n <div class=\"toggle-wrapper\">\n @if (landscapeEnabled) {\n <button\n type=\"button\"\n title=\"Rotate phone\"\n aria-label=\"Rotate phone\"\n [disabled]=\"!state.supportsLandscape()\"\n (click)=\"toggleLandscape()\"\n >\n @if (!landscape()) {\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\">\n <path\n d=\"M105.34,240.51c.27.27.56.53.85.77s.29.22.44.33.33.25.51.37l.52.32.48.28c.18.1.37.18.55.27l.52.24.54.19c.19.07.37.14.57.2a5.36,5.36,0,0,0,.54.14c.2,0,.39.11.6.15s.42.06.63.09l.53.08a11.63,11.63,0,0,0,2.36,0l.53-.08c.21,0,.43-.05.63-.09l.6-.15a5.36,5.36,0,0,0,.54-.14c.2-.06.38-.13.57-.2l.54-.19.52-.24c.18-.09.37-.17.55-.27l.48-.28.52-.32c.18-.12.34-.25.51-.37l.44-.33c.29-.24.58-.5.85-.77l0,0,41.87-41.88a12,12,0,1,0-17-17L125.8,203V131.5A21.52,21.52,0,0,1,147.3,110h58.62a12,12,0,0,0,0-24H147.3a45.55,45.55,0,0,0-45.5,45.5V203L80.41,181.64a12,12,0,0,0-17,17l41.87,41.88Z\"\n />\n <path d=\"M100.8,400a12,12,0,1,0,0,24h100a12,12,0,0,0,0-24Z\" />\n <path d=\"M336.11,348h-.22a16,16,0,0,0,0,32h.22a16,16,0,0,0,0-32Z\" />\n <path\n d=\"M407.43,88H264.57C242.2,88,224,107.38,224,131.2V380.8c0,23.82,18.2,43.2,40.57,43.2H407.43C429.8,424,448,404.62,448,380.8V131.2C448,107.38,429.8,88,407.43,88ZM424,380.8c0,10.59-7.43,19.2-16.57,19.2H264.57c-9.14,0-16.57-8.61-16.57-19.2V131.2c0-10.59,7.43-19.2,16.57-19.2H274a12,12,0,0,0,12,12H386a12,12,0,0,0,12-12h9.43c9.14,0,16.57,8.61,16.57,19.2Z\"\n />\n </svg>\n } @else {\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\">\n <path\n d=\"M86,147.3v58.62a12,12,0,0,0,24,0V147.3a21.52,21.52,0,0,1,21.5-21.5H203l-21.39,21.39a12,12,0,0,0,17,17l41.88-41.87,0,0c.27-.27.53-.56.77-.85l.32-.43c.13-.17.26-.34.38-.52s.21-.34.31-.52.2-.32.29-.48.18-.36.26-.54.17-.35.25-.53.13-.35.19-.53.14-.38.2-.58a4.58,4.58,0,0,0,.14-.53c0-.2.11-.4.15-.61s.06-.41.09-.61.06-.36.08-.55a10.88,10.88,0,0,0,.06-1.14v-.08a10.88,10.88,0,0,0-.06-1.14c0-.19-.05-.37-.08-.55s-.05-.41-.09-.61-.1-.41-.15-.61a4.58,4.58,0,0,0-.14-.53c-.06-.2-.13-.39-.2-.58s-.12-.36-.19-.53-.16-.35-.25-.53-.16-.36-.26-.54-.19-.32-.29-.48-.2-.35-.31-.52-.25-.35-.38-.52l-.32-.43c-.24-.29-.5-.58-.77-.85l0,0L198.61,63.44a12,12,0,0,0-17,17L203,101.8H131.5A45.55,45.55,0,0,0,86,147.3Z\"\n />\n <path d=\"M412,88.8a12,12,0,0,0-12,12v100a12,12,0,0,0,24,0v-100A12,12,0,0,0,412,88.8Z\" />\n <path d=\"M362.11,320h-.22a16,16,0,0,0,0,32h.22a16,16,0,0,0,0-32Z\" />\n <path\n d=\"M380.8,224H131.2C107.38,224,88,242.2,88,264.57V407.43C88,429.8,107.38,448,131.2,448H380.8c23.82,0,43.2-18.2,43.2-40.57V264.57C424,242.2,404.62,224,380.8,224ZM400,407.43c0,9.14-8.61,16.57-19.2,16.57H131.2c-10.59,0-19.2-7.43-19.2-16.57V398a12,12,0,0,0,12-12V286a12,12,0,0,0-12-12v-9.43c0-9.14,8.61-16.57,19.2-16.57H380.8c10.59,0,19.2,7.43,19.2,16.57Z\"\n />\n </svg>\n }\n </button>\n }\n @if (switcherEnabled) {\n <button\n type=\"button\"\n title=\"Toggle theme\"\n aria-label=\"Toggle theme\"\n (click)=\"state.toggleTheme()\"\n >\n @if (state.theme() === 'dark') {\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\">\n <path\n d=\"M256,349.82A93.82,93.82,0,1,0,162.18,256,93.93,93.93,0,0,0,256,349.82Zm0-163.64A69.82,69.82,0,1,1,186.18,256,69.9,69.9,0,0,1,256,186.18Z\"\n />\n <path\n d=\"M256,120.73a12,12,0,0,0,12-12V76a12,12,0,0,0-24,0v32.73A12,12,0,0,0,256,120.73Z\"\n />\n <path d=\"M268,436V403.27a12,12,0,0,0-24,0V436a12,12,0,0,0,24,0Z\" />\n <path d=\"M143.44,160.41a12,12,0,1,0,17-17l-23.23-23.23a12,12,0,1,0-17,17Z\" />\n <path\n d=\"M351.59,351.59a12,12,0,0,0,0,17l23.23,23.23a12,12,0,0,0,17-17l-23.23-23.23A12,12,0,0,0,351.59,351.59Z\"\n />\n <path\n d=\"M120.73,256a12,12,0,0,0-12-12H76a12,12,0,0,0,0,24h32.73A12,12,0,0,0,120.73,256Z\"\n />\n <path d=\"M436,244H403.27a12,12,0,0,0,0,24H436a12,12,0,0,0,0-24Z\" />\n <path\n d=\"M137.18,391.79l23.23-23.23a12,12,0,1,0-17-17l-23.23,23.23a12,12,0,1,0,17,17Z\"\n />\n <path\n d=\"M360.07,163.93a12,12,0,0,0,8.49-3.52l23.23-23.23a12,12,0,1,0-17-17l-23.23,23.23a12,12,0,0,0,8.48,20.49Z\"\n />\n </svg>\n } @else {\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\">\n <path\n d=\"M360.07,147.88a12,12,0,0,0,5.89-21.1,168.05,168.05,0,0,0-214.71,0C80,186,70.19,292.1,129.38,363.35a166.9,166.9,0,0,0,113.77,59.93q7.9.74,15.75.73A166.74,166.74,0,0,0,366,385.22a12,12,0,0,0-5.89-21.1,109.33,109.33,0,0,1,0-216.24ZM244.43,275.77A133.48,133.48,0,0,0,330,381.08,144.11,144.11,0,0,1,147.84,348C97.1,287,105.51,196,166.58,145.24A144.08,144.08,0,0,1,330,130.94C272,152.38,234.91,212.29,244.43,275.77Z\"\n />\n </svg>\n }\n </button>\n }\n <button\n type=\"button\"\n title=\"Show QR code\"\n aria-label=\"Show QR code\"\n class=\"qr-button\"\n (click)=\"openQrMenu()\"\n >\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\">\n <path\n d=\"M100 180a12 12 0 01-12-12v-56a24 24 0 0124-24h56a12 12 0 010 24h-56v56a12 12 0 01-12 12zM412 180a12 12 0 01-12-12v-56h-56a12 12 0 010-24h56a24 24 0 0124 24v56a12 12 0 01-12 12zM168 424h-56a24 24 0 01-24-24v-56a12 12 0 0124 0v56h56a12 12 0 010 24zM400 424h-56a12 12 0 010-24h56v-56a12 12 0 0124 0v56a24 24 0 01-24 24zM176.11 172.11h27.79v27.79h-27.79zM424 304H88a12 12 0 010-24h336a12 12 0 010 24z\"\n />\n <path\n d=\"M244.37 377.69H137.4V318h24v35.69h82.97v24zM374.36 193.69h-24V158h-49.87v-24h73.87v59.69z\"\n />\n <path\n d=\"M189.34 318h48.05v24h-48.05zM350.37 318v35.69H333.1V318h-67.54v24h43.54v11.69h-23.86v24h89.13V318h-24zM242 238H138V134h104zm-80-24h56v-56h-56zM261.33 134h24v44.54h-24zM350.36 225.06h24v44.54h-24zM301.77 169h30.29v24h-30.29zM328.18 267h-64v-64h64zm-40-24h16v-16h-16z\"\n />\n </svg>\n @if (showQrMenu()) {\n <si-live-preview-qr\n title=\"\"\n [url]=\"plainUrl()\"\n [urlShort]=\"plainUrlShort()\"\n (closed)=\"showQrMenu.set(false)\"\n />\n }\n </button>\n </div>\n</section>\n\n<div\n class=\"device\"\n [class.md]=\"mode() !== 'ios'\"\n [class.ios]=\"mode() === 'ios' && !showNotch()\"\n [class.ios-with-notch]=\"mode() === 'ios' && showNotch()\"\n [class.dark]=\"state.theme() === 'dark'\"\n [class.landscape]=\"landscape()\"\n>\n @if (mode() !== 'ios') {\n <div class=\"wrapper\">\n <svg class=\"md-bar\" viewBox=\"0 0 130 40.3\" [class.dark]=\"state.theme() === 'dark'\">\n <path\n d=\"m 16,4.2 h 64 c 8.8,0 16,7.2 16,16 0,8.8 -7.2,16 -16,16 H 16 C 7.2,36.2 0,29 0,20.2 0,11.4 7.2,4.2 16,4.2 Z\"\n />\n </svg>\n <svg class=\"md-bar\" viewBox=\"0 0 199.99999 40.3\" [class.dark]=\"state.theme() === 'dark'\">\n <path\n d=\"M 155,5.0124996 173.8,37.3125 c 0.8,1.3 2.7,1.3 3.5,0 L 196,5.0124996 c 0.8,-1.3 -0.2,-3 -1.7,-3 h -37.6 c -1.5,0 -2.5,1.7 -1.7,3 z\"\n />\n <circle r=\"20\" cy=\"20.15\" cx=\"111\" class=\"st0\" />\n <path\n d=\"m 25,1.1499996 h 30 c 2.2,0 4,1.8 4,4 V 35.15 c 0,2.2 -1.8,4 -4,4 H 25 c -2.2,0 -4,-1.8 -4,-4 V 5.1499996 c 0,-2.3 1.8,-4 4,-4 z\"\n />\n </svg>\n </div>\n } @else {\n @if (showNotch()) {\n <!-- iOS devices with notch -->\n <div class=\"notch\">\n <div class=\"camera\"></div>\n <div class=\"speaker\"></div>\n </div>\n <div class=\"sleep\"></div>\n <div class=\"volume\"></div>\n } @else {\n <!-- iOS devices without notch -->\n <div class=\"camera\"></div>\n <div class=\"speaker\"></div>\n <div class=\"sensor\"></div>\n <div class=\"sleep\"></div>\n <div class=\"volume\"></div>\n <div class=\"home\"></div>\n }\n }\n\n <div class=\"screen\">\n <iframe\n #previewIframe\n title=\"Mobile example view\"\n [src]=\"previewUrl\"\n [height]=\"currentIFrameHeight()\"\n [width]=\"currentIFrameWidth()\"\n ></iframe>\n </div>\n</div>\n", styles: ["*:focus-visible{outline:var(--si-sys-sizing-focus-ring-width, 2px) solid var(--si-sys-color-effects-focus);outline-offset:var(--si-sys-sizing-focus-ring-offset, 1px)}:host{display:block}iframe{border:0;display:block}.settings-selection{display:flex;align-items:center;justify-content:space-between;margin-block:10px 20px;margin-inline:0}.settings-selection .toggle-wrapper{display:flex}.settings-selection .toggle-wrapper button{background:var(--si-sys-color-background-accent-secondary);display:flex;align-items:center;justify-content:center;block-size:40px;inline-size:40px;border:1px solid var(--si-sys-color-border-4);border-radius:50%;margin-inline-start:10px;position:relative}.settings-selection .toggle-wrapper button>svg{block-size:24px;fill:var(--si-sys-color-text-primary)}.settings-selection .toggle-wrapper button>svg:hover{fill:var(--si-sys-color-text-accent-hover)}.settings-selection .toggle-wrapper button:disabled>svg{fill:var(--si-sys-color-text-primary)}.device-selection{appearance:none;background-color:var(--si-sys-color-background-0);background-image:url(\"data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'><path d='M352.79 203.21a12.45 12.45 0 011.44 15.86l-1.44 1.72-88 88a12.45 12.45 0 01-15.86 1.44l-1.72-1.44-88-88a12.43 12.43 0 0115.86-19l1.72 1.44L256 282.42l79.21-79.21a12.45 12.45 0 0115.86-1.44z'/></svg>\");background-repeat:no-repeat;background-position:right 2px top 50%;color:var(--si-sys-color-text-primary);block-size:35px;min-inline-size:200px;border-radius:2px;border:1px solid var(--si-sys-color-border-4);padding:6px;margin-block:0;display:flex;flex:1}.device{position:relative;box-sizing:content-box}.device .screen{background:var(--si-sys-color-background-0);box-shadow:0 0 0 3px #111;border-radius:1px;block-size:100%;inline-size:100%;position:relative;overflow:hidden;display:block}.device.md{margin-top:20px;box-shadow:0 0 0 14px #090a0d,0 0 0 17px #9fa3a8,0 0 34px 17px #0003;overflow:hidden;border-radius:20px}.device.md .wrapper{margin:0 auto;position:absolute;top:0;left:0;right:0;z-index:4;display:flex;height:25px;justify-content:space-between}.device.md .wrapper .md-bar{fill:#090a0d;opacity:.2;padding:7px 11px}.device.md .wrapper .md-bar.dark{fill:#fff;opacity:.5}.device.ios-with-notch{padding:26px;background:#fdfdfd;box-shadow:inset 0 0 11px #000;border-radius:66px}.device.ios-with-notch:before{background:#000;border-radius:61px;height:calc(100% - 10px);width:calc(100% - 10px);position:absolute;top:5px;left:5px;content:\"\"}.device.ios-with-notch:after{background:#00000080;border-radius:2px;height:4px;width:130px;position:absolute;right:0;bottom:32px;left:0;content:\"\";margin:0 auto}.device.ios-with-notch.dark:after{background:#fff;opacity:.5}.device.ios-with-notch .screen{border-radius:40px}.device.ios-with-notch .volume,.device.ios-with-notch .volume:before,.device.ios-with-notch .volume:after,.device.ios-with-notch .sleep{background:#b5b5b5;width:3px;position:absolute}.device.ios-with-notch .volume{height:32px;top:116px;left:-3px}.device.ios-with-notch .volume:before{height:62px;top:62px;left:0;content:\"\"}.device.ios-with-notch .volume:after{height:62px;top:140px;left:0;content:\"\"}.device.ios-with-notch .sleep{height:96px;top:200px;right:-3px}.device.ios-with-notch .camera{background:#0d4d71;border-radius:100%;height:6px;width:6px;position:absolute;top:9px;left:154px}.device.ios-with-notch .speaker{background:#171818;border-radius:6px;height:6px;width:60px;position:absolute;top:9px;left:50%;margin-left:-30px}.device.ios-with-notch .notch{background:#000;border-bottom-left-radius:24px;border-bottom-right-radius:24px;height:30px;width:210px;position:absolute;top:26px;left:50%;margin-left:-105px;z-index:4}.device.ios-with-notch .notch:before,.device.ios-with-notch .notch:after{height:8px;width:8px;position:absolute;top:0;content:\"\"}.device.ios-with-notch .notch:after{background:radial-gradient(circle at bottom left,transparent 0,transparent 70%,#000 70%,#000 100%);left:-8px}.device.ios-with-notch .notch:before{background:radial-gradient(circle at bottom right,transparent 0,transparent 70%,#000 70%,#000 100%);right:-8px}.device.ios-with-notch.landscape .volume,.device.ios-with-notch.landscape .volume:before,.device.ios-with-notch.landscape .volume:after,.device.ios-with-notch.landscape .sleep{height:3px}.device.ios-with-notch.landscape .volume{width:32px;top:auto;left:116px;bottom:-3px}.device.ios-with-notch.landscape .volume:before{width:62px;top:0;left:62px}.device.ios-with-notch.landscape .volume:after{width:62px;top:0;left:140px}.device.ios-with-notch.landscape .sleep{width:96px;top:-3px;right:auto;left:200px}.device.ios-with-notch.landscape .camera{top:auto;bottom:154px;left:9px}.device.ios-with-notch.landscape .speaker{height:60px;width:6px;top:50%;left:9px;margin-top:-30px;margin-left:0}.device.ios-with-notch.landscape .notch{border-top-right-radius:24px;border-bottom-right-radius:24px;border-bottom-left-radius:0;height:210px;width:30px;top:50%;margin-top:-105px;margin-left:unset;left:unset}.device.ios-with-notch.landscape .notch:before,.device.ios-with-notch.landscape .notch:after{left:0}.device.ios-with-notch.landscape .notch:after{background:radial-gradient(circle at bottom right,transparent 0,transparent 70%,#000 70%,#000 100%);top:auto;bottom:-8px}.device.ios-with-notch.landscape .notch:before{background:radial-gradient(circle at top right,transparent 0,transparent 70%,#000 70%,#000 100%);top:-8px}.device.ios{background:#464646;box-shadow:inset 0 0 3px #000000b3;border-radius:56px;padding:105px 24px}.device.ios:before{background:#080808;border-radius:50px;height:calc(100% - 12px);width:calc(100% - 12px);position:absolute;top:6px;left:6px;content:\"\"}.device.ios .home{background:linear-gradient(135deg,#080808,#464646,#080808);border-radius:100%;height:68px;width:68px;position:absolute;bottom:22px;left:50%;margin-left:-34px}.device.ios .home:before{background:#080808;border-radius:100%;height:calc(100% - 8px);width:calc(100% - 8px);position:absolute;top:4px;left:4px;content:\"\"}.device.ios .sleep{background:#464646;border-radius:0 2px 2px 0;height:66px;width:4px;position:absolute;top:190px;right:-4px}.device.ios .volume{background:#464646;border-radius:2px 0 0 2px;height:66px;width:4px;position:absolute;top:188px;left:-4px}.device.ios .volume:before{background:inherit;border-radius:2px 0 0 2px;height:40px;width:2px;position:absolute;top:-78px;left:2px;content:\"\"}.device.ios .volume:after{background:inherit;border-radius:2px 0 0 2px;height:66px;width:4px;position:absolute;top:82px;left:0;content:\"\"}.device.ios .camera{background:#080808;border-radius:100%;height:12px;width:12px;position:absolute;top:24px;left:50%;margin-left:-6px}.device.ios .sensor{background:#3c3d3d;border-radius:100%;height:16px;width:16px;position:absolute;top:49px;left:134px}.device.ios .speaker{background:#292728;border-radius:6px;height:6px;width:70px;position:absolute;top:54px;left:50%;margin-left:-35px}.device.ios.landscape{padding:24px 105px}.device.ios.landscape .sleep{border-radius:2px 2px 0 0;height:4px;width:66px;top:unset;bottom:100%;left:190px}.device.ios.landscape .volume{border-radius:0 0 2px 2px;height:4px;width:66px;bottom:-4px;top:unset;right:calc(100% - 254px);left:unset}.device.ios.landscape .volume:before{border-radius:0 0 2px 2px;height:2px;width:40px;top:unset;bottom:2px;left:-78px;right:auto}.device.ios.landscape .volume:after{border-radius:0 0 2px 2px;height:4px;width:66px;top:unset;bottom:0;right:-82px;left:unset}.device.ios.landscape .home{top:50%;right:22px;left:unset;margin-top:-34px;margin-left:unset}.device.ios.landscape .sensor{top:134px;right:calc(100% - 65px);left:unset}.device.ios.landscape .speaker{height:70px;width:6px;top:50%;right:calc(100% - 60px);left:unset;margin-top:-35px;margin-left:unset}.device.ios.landscape .camera{top:50%;right:calc(100% - 32px);left:unset;margin-top:-6px;margin-left:unset}\n"] }]
|
|
263
|
+
}], ctorParameters: () => [], propDecorators: { previewIframe: [{ type: i0.ViewChild, args: ['previewIframe', { isSignal: true }] }], iframeChange: [{ type: i0.Output, args: ["iframeChange"] }] } });
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* Copyright (c) Siemens 2016 - 2026
|
|
267
|
+
* SPDX-License-Identifier: MIT
|
|
268
|
+
*/
|
|
269
|
+
class SiLivePreviewIframeComponent {
|
|
270
|
+
isFullscreen = input(false, /* @ts-ignore */
|
|
271
|
+
...(ngDevMode ? [{ debugName: "isFullscreen" }] : /* istanbul ignore next */ []));
|
|
272
|
+
templateFromComponent = output();
|
|
273
|
+
state = inject(LivePreviewStateService);
|
|
274
|
+
rendererInProgress = false;
|
|
275
|
+
previewIframeRef = signal(undefined, /* @ts-ignore */
|
|
276
|
+
...(ngDevMode ? [{ debugName: "previewIframeRef" }] : /* istanbul ignore next */ []));
|
|
277
|
+
rendererReady = signal(false, /* @ts-ignore */
|
|
278
|
+
...(ngDevMode ? [{ debugName: "rendererReady" }] : /* istanbul ignore next */ []));
|
|
279
|
+
previewIframe = this.previewIframeRef.asReadonly();
|
|
280
|
+
internalConfig = inject(SI_LIVE_PREVIEW_INTERNALS);
|
|
281
|
+
urls = inject(LivePreviewUrlService);
|
|
282
|
+
ngZone = inject(NgZone);
|
|
283
|
+
destroyRef = inject(DestroyRef);
|
|
284
|
+
cdRef = inject(ChangeDetectorRef);
|
|
285
|
+
isMobile = this.internalConfig.isMobile;
|
|
286
|
+
ticketLinkBug = computed(() => this.urls.issueUrl('Bug'), /* @ts-ignore */
|
|
287
|
+
...(ngDevMode ? [{ debugName: "ticketLinkBug" }] : /* istanbul ignore next */ []));
|
|
288
|
+
ticketLinkFeature = computed(() => this.urls.issueUrl('Feature Request'), /* @ts-ignore */
|
|
289
|
+
...(ngDevMode ? [{ debugName: "ticketLinkFeature" }] : /* istanbul ignore next */ []));
|
|
290
|
+
constructor() {
|
|
291
|
+
effect(() => {
|
|
292
|
+
// recompute on template changes and re-send whenever any rendered input changes
|
|
293
|
+
if (this.previewIframe()) {
|
|
294
|
+
this.sendMessage();
|
|
295
|
+
}
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
ngOnInit() {
|
|
299
|
+
this.ngZone.runOutsideAngular(() => fromEvent(window, 'message')
|
|
300
|
+
.pipe(takeUntilDestroyed(this.destroyRef))
|
|
301
|
+
.subscribe(message => {
|
|
302
|
+
this.onMessage(message);
|
|
303
|
+
this.cdRef.markForCheck();
|
|
304
|
+
}));
|
|
305
|
+
}
|
|
306
|
+
onMessage(event) {
|
|
307
|
+
const previewWindow = this.previewIframe()?.nativeElement.contentWindow;
|
|
308
|
+
if (!previewWindow ||
|
|
309
|
+
event.origin !== this.urls.origin ||
|
|
310
|
+
event.source !== previewWindow ||
|
|
311
|
+
event.data?.src !== 'renderer') {
|
|
312
|
+
return;
|
|
313
|
+
}
|
|
314
|
+
this.ngZone.run(() => this.onMessageInZone(event));
|
|
315
|
+
}
|
|
316
|
+
onMessageInZone(event) {
|
|
317
|
+
switch (event.data.type) {
|
|
318
|
+
case 'ready':
|
|
319
|
+
this.rendererReady.set(true);
|
|
320
|
+
this.sendMessage();
|
|
321
|
+
break;
|
|
322
|
+
case 'landscapeMode':
|
|
323
|
+
this.state.supportsLandscape.set(event.data.message);
|
|
324
|
+
break;
|
|
325
|
+
case 'clear':
|
|
326
|
+
this.state.clearLogs(true);
|
|
327
|
+
break;
|
|
328
|
+
case 'log':
|
|
329
|
+
this.state.addLog(event.data.message);
|
|
330
|
+
break;
|
|
331
|
+
case 'error':
|
|
332
|
+
this.state.renderingError.set(event.data.message);
|
|
333
|
+
break;
|
|
334
|
+
case 'progress':
|
|
335
|
+
{
|
|
336
|
+
const progress = event.data.message;
|
|
337
|
+
if (progress !== this.rendererInProgress) {
|
|
338
|
+
// only emit changes since live-previewer does counting
|
|
339
|
+
this.rendererInProgress = progress;
|
|
340
|
+
this.state.setRenderingProgress(progress);
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
break;
|
|
344
|
+
case 'templateFromComponent':
|
|
345
|
+
this.state.originalTemplate.set(event.data.message ?? '');
|
|
346
|
+
this.templateFromComponent.emit(event.data.message);
|
|
347
|
+
break;
|
|
348
|
+
case 'theme':
|
|
349
|
+
this.state.theme.set(event.data.message);
|
|
350
|
+
break;
|
|
351
|
+
case 'locale':
|
|
352
|
+
this.state.locale.set(event.data.message);
|
|
353
|
+
break;
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
toggleTheme() {
|
|
357
|
+
this.state.toggleTheme();
|
|
358
|
+
this.sendMessage();
|
|
359
|
+
}
|
|
360
|
+
setPreviewIframe(iframe) {
|
|
361
|
+
this.rendererReady.set(false);
|
|
362
|
+
this.previewIframeRef.set(iframe);
|
|
363
|
+
}
|
|
364
|
+
sendMessage() {
|
|
365
|
+
if (!this.rendererReady()) {
|
|
366
|
+
return;
|
|
367
|
+
}
|
|
368
|
+
const viewport = this.state.viewport();
|
|
369
|
+
this.previewIframe()?.nativeElement.contentWindow.postMessage({
|
|
370
|
+
src: 'editor',
|
|
371
|
+
exampleUrl: this.state.example(),
|
|
372
|
+
template: this.state.template(),
|
|
373
|
+
loadReact: this.state.loadReact(),
|
|
374
|
+
loadVue: this.state.loadVue(),
|
|
375
|
+
loadJs: this.state.loadJs(),
|
|
376
|
+
reactVueTemplate: this.state.activeWebComponentTemplate(),
|
|
377
|
+
theme: this.state.theme(),
|
|
378
|
+
locale: this.state.locale(),
|
|
379
|
+
rootFontSize: this.state.rootFontSize(),
|
|
380
|
+
isRTL: this.state.isRTL(),
|
|
381
|
+
mode: viewport.mode,
|
|
382
|
+
safeAreaTop: viewport.safeAreaTop,
|
|
383
|
+
safeAreaBottom: viewport.safeAreaBottom,
|
|
384
|
+
safeAreaLeft: viewport.safeAreaLeft,
|
|
385
|
+
safeAreaRight: viewport.safeAreaRight
|
|
386
|
+
}, this.urls.origin);
|
|
387
|
+
}
|
|
388
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SiLivePreviewIframeComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
389
|
+
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 });
|
|
390
|
+
}
|
|
391
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SiLivePreviewIframeComponent, decorators: [{
|
|
392
|
+
type: Component,
|
|
393
|
+
args: [{ selector: 'si-live-preview-iframe', imports: [SiLivePreviewIframeModeComponent, SiLivePreviewMobileModeComponent], changeDetection: ChangeDetectionStrategy.Eager, host: {
|
|
394
|
+
'[class.is-mobile]': 'isMobile'
|
|
395
|
+
}, 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"] }]
|
|
396
|
+
}], ctorParameters: () => [], propDecorators: { isFullscreen: [{ type: i0.Input, args: [{ isSignal: true, alias: "isFullscreen", required: false }] }], templateFromComponent: [{ type: i0.Output, args: ["templateFromComponent"] }] } });
|
|
397
|
+
|
|
398
|
+
/**
|
|
399
|
+
* Copyright (c) Siemens 2016 - 2026
|
|
400
|
+
* SPDX-License-Identifier: MIT
|
|
401
|
+
*/
|
|
402
|
+
const isProject = (item) => {
|
|
403
|
+
return !Array.isArray(item.files);
|
|
404
|
+
};
|
|
405
|
+
const isAssetProject = (item) => {
|
|
406
|
+
return 'assetUrl' in item;
|
|
407
|
+
};
|
|
408
|
+
const folder = (path) => path.substring(0, path.lastIndexOf('/') + 1);
|
|
409
|
+
const absolute = (base, relative) => {
|
|
410
|
+
if (relative.startsWith('./')) {
|
|
411
|
+
return `${base}${relative.substring(2)}`;
|
|
412
|
+
}
|
|
413
|
+
while (relative.startsWith('../')) {
|
|
414
|
+
base = base.split('/').slice(0, -2).join('/') + '/';
|
|
415
|
+
relative = relative.substring(3);
|
|
416
|
+
}
|
|
417
|
+
return `${base}${relative}`;
|
|
418
|
+
};
|
|
419
|
+
const fileName = (path) => path.substring(path.lastIndexOf('/') + 1);
|
|
420
|
+
/** Get the base folder for the example files */
|
|
421
|
+
const getBaseFolder = (files) => {
|
|
422
|
+
for (const path of Object.keys(files)) {
|
|
423
|
+
const file = path.split('/').at(-1);
|
|
424
|
+
if (file?.includes('example')) {
|
|
425
|
+
return folder(path);
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
return '';
|
|
429
|
+
};
|
|
430
|
+
const updateExampleImport = (files, example) => {
|
|
431
|
+
const templateExamplePath = Object.keys(files).find(path => path.split('/').at(-1)?.includes('example'));
|
|
432
|
+
delete files[templateExamplePath];
|
|
433
|
+
const file = fileName(templateExamplePath);
|
|
434
|
+
const toReplace = file.substring(0, file.length - 3);
|
|
435
|
+
for (const path of Object.keys(files)) {
|
|
436
|
+
files[path] = files[path].replace(toReplace, example);
|
|
437
|
+
}
|
|
438
|
+
return '';
|
|
439
|
+
};
|
|
440
|
+
const getRelativeImports = (ts) => {
|
|
441
|
+
const imports = [];
|
|
442
|
+
// Regex to match relative import statements
|
|
443
|
+
const relativeImportRegex = /^import\s+[^'"]*\s+from\s+['"](\.\/|\.\.\/)[^'"]+['"];?/gm;
|
|
444
|
+
let match;
|
|
445
|
+
while ((match = relativeImportRegex.exec(ts)) !== null) {
|
|
446
|
+
const importPath = match[0].match(/from\s+['"]([^'"]+)['"]/);
|
|
447
|
+
if (importPath?.[1]) {
|
|
448
|
+
imports.push(importPath[1]);
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
return imports;
|
|
452
|
+
};
|
|
453
|
+
const getStyleUrls = (ts) => {
|
|
454
|
+
const styleUrls = [];
|
|
455
|
+
const singleMatch = ts.match(/styleUrl:\s*['"]([^'"]+)['"]/);
|
|
456
|
+
if (singleMatch?.[1]) {
|
|
457
|
+
styleUrls.push(singleMatch[1]);
|
|
458
|
+
}
|
|
459
|
+
const pluralMatch = ts.match(/styleUrls:\s*\[([^\]]+)\]/);
|
|
460
|
+
if (pluralMatch?.[1]) {
|
|
461
|
+
const urls = pluralMatch[1].matchAll(/['"]([^'"]+)['"]/g);
|
|
462
|
+
for (const url of urls) {
|
|
463
|
+
if (url[1] && !styleUrls.includes(url[1])) {
|
|
464
|
+
styleUrls.push(url[1]);
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
return styleUrls;
|
|
469
|
+
};
|
|
470
|
+
const addRelativeImports = async (files, baseUrl, baseFolder, path) => {
|
|
471
|
+
const ts = files[path];
|
|
472
|
+
for (const item of getRelativeImports(ts)) {
|
|
473
|
+
const response = await fetch(`${baseUrl}${item}.ts`);
|
|
474
|
+
files[absolute(baseFolder, `${item}.ts`)] = await response.text();
|
|
475
|
+
}
|
|
476
|
+
};
|
|
477
|
+
const openStackblitz = async (options) => {
|
|
478
|
+
const { framework, templates, example, baseUrl } = options;
|
|
479
|
+
const template = templates.find(item => item.name === framework);
|
|
480
|
+
if (!template) {
|
|
481
|
+
return;
|
|
482
|
+
}
|
|
483
|
+
// Get template project files
|
|
484
|
+
let files = {};
|
|
485
|
+
if (isAssetProject(template)) {
|
|
486
|
+
for (const file of template.files) {
|
|
487
|
+
const response = await fetch(`${template.assetUrl}/${file}`);
|
|
488
|
+
files[file] = await response.text();
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
else if (isProject(template)) {
|
|
492
|
+
files = { ...template.files };
|
|
493
|
+
}
|
|
494
|
+
const baseFolder = getBaseFolder(files);
|
|
495
|
+
const exampleFolder = folder(example);
|
|
496
|
+
updateExampleImport(files, example);
|
|
497
|
+
// Add example HTML file
|
|
498
|
+
const html = await (await fetch(`${baseUrl}${example}.html`)).text();
|
|
499
|
+
files[`${baseFolder}${example}.html`] = html;
|
|
500
|
+
// Add example TS file
|
|
501
|
+
const ts = await (await fetch(`${baseUrl}${example}.ts`)).text();
|
|
502
|
+
const tsPath = `${baseFolder}${example}.ts`;
|
|
503
|
+
files[tsPath] = ts;
|
|
504
|
+
// Add example style files
|
|
505
|
+
for (const styleUrl of getStyleUrls(ts)) {
|
|
506
|
+
const response = await fetch(absolute(`${baseUrl}${exampleFolder}`, styleUrl));
|
|
507
|
+
if (response.ok) {
|
|
508
|
+
const stylePath = absolute(`${baseFolder}${exampleFolder}`, styleUrl);
|
|
509
|
+
files[stylePath] = await response.text();
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
// Get relative imports files
|
|
513
|
+
await addRelativeImports(files, `${baseUrl}${exampleFolder}`, `${baseFolder}${exampleFolder}`, tsPath);
|
|
514
|
+
sdk.openProject({
|
|
515
|
+
title: `Element ${framework} ${example} example`,
|
|
516
|
+
template: 'node',
|
|
517
|
+
description: 'Blank starter project for building ES6 apps.',
|
|
518
|
+
files: { ...files }
|
|
519
|
+
}, {
|
|
520
|
+
openFile: tsPath
|
|
521
|
+
});
|
|
522
|
+
};
|
|
523
|
+
|
|
524
|
+
/**
|
|
525
|
+
* Copyright (c) Siemens 2016 - 2026
|
|
526
|
+
* SPDX-License-Identifier: MIT
|
|
527
|
+
*/
|
|
528
|
+
class SiStackblitzButtonDirective {
|
|
529
|
+
config = inject(SI_STACKBLITZ_CONFIG, { optional: true });
|
|
530
|
+
exampleTs = httpResource.text(() => this.example() ? `${this.baseUrl()}${this.example()}.ts` : undefined, /* @ts-ignore */
|
|
531
|
+
...(ngDevMode ? [{ debugName: "exampleTs" }] : /* istanbul ignore next */ []));
|
|
532
|
+
isExample = computed(() => {
|
|
533
|
+
if (this.exampleTs.hasValue()) {
|
|
534
|
+
const content = this.exampleTs.value();
|
|
535
|
+
return /selector: 'app-sample'/gm.test(content);
|
|
536
|
+
}
|
|
537
|
+
return false;
|
|
538
|
+
}, /* @ts-ignore */
|
|
539
|
+
...(ngDevMode ? [{ debugName: "isExample" }] : /* istanbul ignore next */ []));
|
|
540
|
+
/** Framework to use for the Stackblitz project. */
|
|
541
|
+
framework = input.required(/* @ts-ignore */
|
|
542
|
+
...(ngDevMode ? [{ debugName: "framework" }] : /* istanbul ignore next */ []));
|
|
543
|
+
/** The example base URL. */
|
|
544
|
+
baseUrl = input.required(/* @ts-ignore */
|
|
545
|
+
...(ngDevMode ? [{ debugName: "baseUrl" }] : /* istanbul ignore next */ []));
|
|
546
|
+
/** The example name. */
|
|
547
|
+
example = input(/* @ts-ignore */
|
|
548
|
+
...(ngDevMode ? [undefined, { debugName: "example" }] : /* istanbul ignore next */ []));
|
|
549
|
+
/** Indicate whether a stackblitz isn't available. */
|
|
550
|
+
disabled = computed(() => !this.config?.templates.find(item => item.name === this.framework()) ||
|
|
551
|
+
!this.example() ||
|
|
552
|
+
!this.isExample(), /* @ts-ignore */
|
|
553
|
+
...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
554
|
+
/** Open the Stackblitz editor with the specified configuration. */
|
|
555
|
+
async openStackblitz() {
|
|
556
|
+
await openStackblitz({
|
|
557
|
+
framework: this.framework(),
|
|
558
|
+
example: this.example(),
|
|
559
|
+
templates: this.config.templates,
|
|
560
|
+
baseUrl: this.baseUrl()
|
|
561
|
+
});
|
|
562
|
+
}
|
|
563
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SiStackblitzButtonDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
564
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.8", type: SiStackblitzButtonDirective, isStandalone: true, selector: "button[siStackblitz]", inputs: { framework: { classPropertyName: "framework", publicName: "framework", isSignal: true, isRequired: true, transformFunction: null }, baseUrl: { classPropertyName: "baseUrl", publicName: "baseUrl", isSignal: true, isRequired: true, transformFunction: null }, example: { classPropertyName: "example", publicName: "example", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "title": "Open Stackblitz", "attr.aria-label": "Open in Stackblitz" }, listeners: { "click": "openStackblitz()" }, properties: { "style.display": "!config ? \"none\" : null", "disabled": "disabled()" } }, ngImport: i0 });
|
|
565
|
+
}
|
|
566
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SiStackblitzButtonDirective, decorators: [{
|
|
567
|
+
type: Directive,
|
|
568
|
+
args: [{
|
|
569
|
+
selector: 'button[siStackblitz]',
|
|
570
|
+
host: {
|
|
571
|
+
'title': 'Open Stackblitz',
|
|
572
|
+
'attr.aria-label': 'Open in Stackblitz',
|
|
573
|
+
'[style.display]': '!config ? "none" : null',
|
|
574
|
+
'[disabled]': 'disabled()',
|
|
575
|
+
'(click)': 'openStackblitz()'
|
|
576
|
+
}
|
|
577
|
+
}]
|
|
578
|
+
}], propDecorators: { framework: [{ type: i0.Input, args: [{ isSignal: true, alias: "framework", required: true }] }], baseUrl: [{ type: i0.Input, args: [{ isSignal: true, alias: "baseUrl", required: true }] }], example: [{ type: i0.Input, args: [{ isSignal: true, alias: "example", required: false }] }] } });
|
|
579
|
+
|
|
580
|
+
/**
|
|
581
|
+
* Copyright (c) Siemens 2016 - 2026
|
|
582
|
+
* SPDX-License-Identifier: MIT
|
|
583
|
+
*/
|
|
584
|
+
class SiLivePreviewComponent {
|
|
585
|
+
initialTheme = input(/* @ts-ignore */
|
|
586
|
+
...(ngDevMode ? [undefined, { debugName: "initialTheme" }] : /* istanbul ignore next */ []));
|
|
587
|
+
config = inject(SI_LIVE_PREVIEW_CONFIG);
|
|
588
|
+
internalConfig = inject(SI_LIVE_PREVIEW_INTERNALS);
|
|
589
|
+
self = inject(ElementRef);
|
|
590
|
+
http = inject(HttpClient);
|
|
591
|
+
urls = inject(LivePreviewUrlService);
|
|
592
|
+
localeApi = inject(SiLivePreviewLocaleApi, { optional: true });
|
|
593
|
+
state = inject(LivePreviewStateService);
|
|
594
|
+
templateElem = viewChild.required('codeTemplate', /* @ts-ignore */
|
|
595
|
+
...(ngDevMode ? [{ debugName: "templateElem" }] : /* istanbul ignore next */ []));
|
|
596
|
+
typescriptElem = viewChild.required('codeTypescript', /* @ts-ignore */
|
|
597
|
+
...(ngDevMode ? [{ debugName: "typescriptElem" }] : /* istanbul ignore next */ []));
|
|
598
|
+
reactVueElem = viewChild.required('codeReactVue', /* @ts-ignore */
|
|
599
|
+
...(ngDevMode ? [{ debugName: "reactVueElem" }] : /* istanbul ignore next */ []));
|
|
600
|
+
consoleElem = viewChild.required('consoleContainer', /* @ts-ignore */
|
|
601
|
+
...(ngDevMode ? [{ debugName: "consoleElem" }] : /* istanbul ignore next */ []));
|
|
602
|
+
baseUrl = this.urls.examplesBaseUrl;
|
|
603
|
+
isFullscreen = signal(false, /* @ts-ignore */
|
|
604
|
+
...(ngDevMode ? [{ debugName: "isFullscreen" }] : /* istanbul ignore next */ []));
|
|
605
|
+
isMobile = this.internalConfig.isMobile;
|
|
606
|
+
templateTs = '';
|
|
607
|
+
activeTab = signal('template', /* @ts-ignore */
|
|
608
|
+
...(ngDevMode ? [{ debugName: "activeTab" }] : /* istanbul ignore next */ []));
|
|
609
|
+
showCopied = signal(false, /* @ts-ignore */
|
|
610
|
+
...(ngDevMode ? [{ debugName: "showCopied" }] : /* istanbul ignore next */ []));
|
|
611
|
+
allowFullscreen = !!document.fullscreenEnabled || !!document.webkitFullscreenEnabled;
|
|
612
|
+
exampleFullscreen = signal(false, /* @ts-ignore */
|
|
613
|
+
...(ngDevMode ? [{ debugName: "exampleFullscreen" }] : /* istanbul ignore next */ []));
|
|
614
|
+
allowCopy = !!navigator.clipboard;
|
|
615
|
+
switcherEnabled = this.config.themeSwitcher;
|
|
616
|
+
rtlSwitcher = this.config.rtlSwitcher;
|
|
617
|
+
rootFontSizes = this.config.rootFontSizes ?? [];
|
|
618
|
+
webcomponents = this.config.webcomponents;
|
|
619
|
+
frameworks = new Map([['Angular', 'angular']]);
|
|
620
|
+
availableLocales = this.localeApi?.availableLocales() ?? [];
|
|
621
|
+
editorCollapsed = signal(localStorage.getItem('si-live-preview-editor-collapsed') === 'true' && !this.isMobile, /* @ts-ignore */
|
|
622
|
+
...(ngDevMode ? [{ debugName: "editorCollapsed" }] : /* istanbul ignore next */ []));
|
|
623
|
+
showEditor = signal(!this.editorCollapsed(), /* @ts-ignore */
|
|
624
|
+
...(ngDevMode ? [{ debugName: "showEditor" }] : /* istanbul ignore next */ []));
|
|
625
|
+
compileSubject = new Subject();
|
|
626
|
+
skipInitialLoad = false;
|
|
627
|
+
flaskTemplate;
|
|
628
|
+
flaskTypescript;
|
|
629
|
+
flaskReactVue;
|
|
630
|
+
savedScrollPos = { top: 0, left: 0 };
|
|
631
|
+
tsLoaded = false;
|
|
632
|
+
reactLoaded = false;
|
|
633
|
+
vueLoaded = false;
|
|
634
|
+
jsLoaded = false;
|
|
635
|
+
webcomponentsList = [];
|
|
636
|
+
constructor() {
|
|
637
|
+
const storedFramework = localStorage.getItem('si-live-preview-framework');
|
|
638
|
+
if (storedFramework === 'react' || storedFramework === 'vue' || storedFramework === 'js') {
|
|
639
|
+
this.state.framework.set(storedFramework);
|
|
640
|
+
}
|
|
641
|
+
this.compileSubject
|
|
642
|
+
.pipe(throttleTime(500, undefined, { leading: true, trailing: true }))
|
|
643
|
+
.pipe(takeUntilDestroyed())
|
|
644
|
+
.subscribe(template => {
|
|
645
|
+
this.state.template.set(template);
|
|
646
|
+
});
|
|
647
|
+
this.webcomponentsList = this.config.componentLoader.webcomponentsList;
|
|
648
|
+
let previousExample;
|
|
649
|
+
effect(() => {
|
|
650
|
+
const example = this.state.example();
|
|
651
|
+
if (!example || example === previousExample) {
|
|
652
|
+
return;
|
|
653
|
+
}
|
|
654
|
+
const firstLoad = previousExample === undefined;
|
|
655
|
+
previousExample = example;
|
|
656
|
+
untracked(() => {
|
|
657
|
+
this.activeTab.set(this.activeTab() !== 'typescript' ? 'template' : this.activeTab());
|
|
658
|
+
this.skipInitialLoad =
|
|
659
|
+
firstLoad &&
|
|
660
|
+
!!(this.state.template() ||
|
|
661
|
+
this.state.templateReact() ||
|
|
662
|
+
this.state.templateVue() ||
|
|
663
|
+
this.state.templateJs());
|
|
664
|
+
this.loadFromUrl(this.skipInitialLoad);
|
|
665
|
+
if (this.webcomponents) {
|
|
666
|
+
this.reactLoaded = false;
|
|
667
|
+
this.vueLoaded = false;
|
|
668
|
+
this.jsLoaded = false;
|
|
669
|
+
this.state.stopWebComponentLoading();
|
|
670
|
+
this.checkWebComponentsAvailable();
|
|
671
|
+
}
|
|
672
|
+
});
|
|
673
|
+
});
|
|
674
|
+
effect(() => localStorage.setItem('si-live-preview-theme', this.state.theme()));
|
|
675
|
+
effect(() => {
|
|
676
|
+
if (this.state.logMessages().length) {
|
|
677
|
+
setTimeout(() => {
|
|
678
|
+
this.consoleElem().nativeElement.scrollTop =
|
|
679
|
+
this.consoleElem().nativeElement.scrollHeight;
|
|
680
|
+
});
|
|
681
|
+
}
|
|
682
|
+
});
|
|
683
|
+
}
|
|
684
|
+
ngOnInit() {
|
|
685
|
+
this.state.theme.set(this.initialTheme() ??
|
|
686
|
+
(localStorage.getItem('si-live-preview-theme') === 'dark' ? 'dark' : 'light'));
|
|
687
|
+
const rfs = localStorage.getItem('si-live-preview-rfs') ?? '';
|
|
688
|
+
this.state.rootFontSize.set(rfs === 'initial' ? rfs : rfs ? parseInt(rfs, 10) : 0);
|
|
689
|
+
}
|
|
690
|
+
ngAfterViewInit() {
|
|
691
|
+
const root = this.self.nativeElement.getRootNode();
|
|
692
|
+
const styleParent = root instanceof ShadowRoot ? root : undefined;
|
|
693
|
+
this.flaskTemplate = new CodeFlask(this.templateElem().nativeElement, {
|
|
694
|
+
styleParent,
|
|
695
|
+
lineNumbers: true,
|
|
696
|
+
language: 'html',
|
|
697
|
+
defaultTheme: false,
|
|
698
|
+
handleSelfClosingCharacters: false,
|
|
699
|
+
handleTabs: false,
|
|
700
|
+
ariaLabelledby: 'templateEditorTab'
|
|
701
|
+
});
|
|
702
|
+
this.flaskTypescript = new CodeFlask(this.typescriptElem().nativeElement, {
|
|
703
|
+
styleParent,
|
|
704
|
+
lineNumbers: true,
|
|
705
|
+
language: 'typescript',
|
|
706
|
+
readonly: true,
|
|
707
|
+
defaultTheme: false,
|
|
708
|
+
handleTabs: false,
|
|
709
|
+
ariaLabelledby: 'typescriptEditorTab'
|
|
710
|
+
});
|
|
711
|
+
this.flaskReactVue = new CodeFlask(this.reactVueElem().nativeElement, {
|
|
712
|
+
styleParent,
|
|
713
|
+
lineNumbers: true,
|
|
714
|
+
language: 'typescript',
|
|
715
|
+
readonly: false,
|
|
716
|
+
defaultTheme: false,
|
|
717
|
+
handleTabs: false,
|
|
718
|
+
areaId: 'reactVueEditor'
|
|
719
|
+
});
|
|
720
|
+
this.flaskTemplate.onUpdate((code) => {
|
|
721
|
+
this.compileSubject.next(code);
|
|
722
|
+
});
|
|
723
|
+
this.flaskReactVue.onUpdate((code) => {
|
|
724
|
+
if (this.activeTab() === 'react') {
|
|
725
|
+
this.state.templateReact.set(code);
|
|
726
|
+
this.state.loadReact.set(true);
|
|
727
|
+
}
|
|
728
|
+
else if (this.activeTab() === 'vue') {
|
|
729
|
+
this.state.templateVue.set(code);
|
|
730
|
+
this.state.loadVue.set(true);
|
|
731
|
+
}
|
|
732
|
+
else if (this.activeTab() === 'js') {
|
|
733
|
+
this.state.templateJs.set(code);
|
|
734
|
+
this.state.loadJs.set(true);
|
|
735
|
+
}
|
|
736
|
+
});
|
|
737
|
+
if (this.skipInitialLoad) {
|
|
738
|
+
if (this.state.templateReact()) {
|
|
739
|
+
this.reactLoaded = true;
|
|
740
|
+
this.changeFramework('react');
|
|
741
|
+
}
|
|
742
|
+
else if (this.state.templateVue()) {
|
|
743
|
+
this.vueLoaded = true;
|
|
744
|
+
this.changeFramework('vue');
|
|
745
|
+
}
|
|
746
|
+
else if (this.state.templateJs()) {
|
|
747
|
+
this.jsLoaded = true;
|
|
748
|
+
this.changeFramework('js');
|
|
749
|
+
}
|
|
750
|
+
else {
|
|
751
|
+
this.flaskTemplate.updateCode(this.state.template());
|
|
752
|
+
this.compileSubject.next(this.state.template());
|
|
753
|
+
}
|
|
754
|
+
this.skipInitialLoad = false;
|
|
755
|
+
}
|
|
756
|
+
}
|
|
757
|
+
activateTab(tab) {
|
|
758
|
+
this.activeTab.set(tab);
|
|
759
|
+
let saveScroll;
|
|
760
|
+
let restoreScroll;
|
|
761
|
+
this.state.loadReact.set(false);
|
|
762
|
+
this.state.loadVue.set(false);
|
|
763
|
+
this.state.loadJs.set(false);
|
|
764
|
+
if (tab === 'template') {
|
|
765
|
+
saveScroll = this.typescriptElem();
|
|
766
|
+
restoreScroll = this.templateElem();
|
|
767
|
+
}
|
|
768
|
+
else {
|
|
769
|
+
if (!this.tsLoaded) {
|
|
770
|
+
this.loadTsFromUrl();
|
|
771
|
+
}
|
|
772
|
+
saveScroll = this.templateElem();
|
|
773
|
+
restoreScroll = this.typescriptElem();
|
|
774
|
+
}
|
|
775
|
+
const areaSave = saveScroll.nativeElement.querySelector('textarea');
|
|
776
|
+
const areaRestore = restoreScroll.nativeElement.querySelector('textarea');
|
|
777
|
+
const scrollPos = this.savedScrollPos;
|
|
778
|
+
this.savedScrollPos = { left: areaSave.scrollLeft, top: areaSave.scrollTop };
|
|
779
|
+
setTimeout(() => {
|
|
780
|
+
areaRestore.scrollTop = scrollPos.top;
|
|
781
|
+
areaRestore.scrollLeft = scrollPos.left;
|
|
782
|
+
});
|
|
783
|
+
}
|
|
784
|
+
themeChange(theme) {
|
|
785
|
+
this.state.theme.set(theme);
|
|
786
|
+
localStorage.setItem('si-live-preview-theme', this.state.theme());
|
|
787
|
+
}
|
|
788
|
+
updateTemplate(template) {
|
|
789
|
+
this.state.template.set(template);
|
|
790
|
+
if (this.flaskTemplate) {
|
|
791
|
+
this.flaskTemplate.updateCode(this.state.template());
|
|
792
|
+
}
|
|
793
|
+
}
|
|
794
|
+
updateTs(ts) {
|
|
795
|
+
this.templateTs = ts;
|
|
796
|
+
if (this.flaskTypescript) {
|
|
797
|
+
this.flaskTypescript.updateCode(this.templateTs);
|
|
798
|
+
}
|
|
799
|
+
}
|
|
800
|
+
updateReact(ts) {
|
|
801
|
+
this.state.templateReact.set(ts);
|
|
802
|
+
if (this.flaskReactVue) {
|
|
803
|
+
this.flaskReactVue.updateCode(this.state.templateReact());
|
|
804
|
+
this.state.loadReact.set(true);
|
|
805
|
+
}
|
|
806
|
+
}
|
|
807
|
+
updateVue(ts) {
|
|
808
|
+
this.state.templateVue.set(ts);
|
|
809
|
+
if (this.flaskReactVue) {
|
|
810
|
+
this.flaskReactVue.updateCode(this.state.templateVue());
|
|
811
|
+
this.state.loadVue.set(true);
|
|
812
|
+
}
|
|
813
|
+
}
|
|
814
|
+
updateJs(js) {
|
|
815
|
+
this.state.templateJs.set(js);
|
|
816
|
+
if (this.flaskReactVue) {
|
|
817
|
+
this.flaskReactVue.updateCode(this.state.templateJs());
|
|
818
|
+
this.state.loadJs.set(true);
|
|
819
|
+
}
|
|
820
|
+
}
|
|
821
|
+
loadFromUrl(skipTemplate) {
|
|
822
|
+
if (!skipTemplate) {
|
|
823
|
+
this.updateTemplate('');
|
|
824
|
+
}
|
|
825
|
+
this.updateTs('');
|
|
826
|
+
this.savedScrollPos = { top: 0, left: 0 };
|
|
827
|
+
this.state.resetRenderingProgress();
|
|
828
|
+
this.tsLoaded = false;
|
|
829
|
+
if (this.activeTab() === 'typescript') {
|
|
830
|
+
this.loadTsFromUrl();
|
|
831
|
+
}
|
|
832
|
+
}
|
|
833
|
+
loadTemplateFromUrl() {
|
|
834
|
+
const example = this.state.example();
|
|
835
|
+
if (!example) {
|
|
836
|
+
return;
|
|
837
|
+
}
|
|
838
|
+
this.handleInProgressEvent(true);
|
|
839
|
+
this.http
|
|
840
|
+
.get(this.urls.sourceUrl(example + '.html'), { responseType: 'text' })
|
|
841
|
+
.pipe(timeout(3000), retry(1))
|
|
842
|
+
.subscribe({
|
|
843
|
+
next: data => {
|
|
844
|
+
this.state.originalTemplate.set(data);
|
|
845
|
+
this.updateTemplate(data);
|
|
846
|
+
setTimeout(() => {
|
|
847
|
+
this.handleInProgressEvent(false);
|
|
848
|
+
});
|
|
849
|
+
},
|
|
850
|
+
error: () => {
|
|
851
|
+
this.handleInProgressEvent(false);
|
|
852
|
+
}
|
|
853
|
+
});
|
|
854
|
+
}
|
|
855
|
+
loadTsFromUrl() {
|
|
856
|
+
const example = this.state.example();
|
|
857
|
+
if (!example) {
|
|
858
|
+
return;
|
|
859
|
+
}
|
|
860
|
+
this.handleInProgressEvent(true);
|
|
861
|
+
this.http
|
|
862
|
+
.get(this.urls.sourceUrl(example + '.ts'), { responseType: 'text' })
|
|
863
|
+
.pipe(timeout(3000), retry(1))
|
|
864
|
+
.subscribe({
|
|
865
|
+
next: data => {
|
|
866
|
+
this.updateTs(data);
|
|
867
|
+
this.tsLoaded = true;
|
|
868
|
+
setTimeout(() => {
|
|
869
|
+
this.handleInProgressEvent(false);
|
|
870
|
+
});
|
|
871
|
+
},
|
|
872
|
+
error: () => {
|
|
873
|
+
this.tsLoaded = true;
|
|
874
|
+
this.handleInProgressEvent(false);
|
|
875
|
+
}
|
|
876
|
+
});
|
|
877
|
+
}
|
|
878
|
+
checkWebComponentsAvailable() {
|
|
879
|
+
const baseUrl = this.config.examplesBaseUrl;
|
|
880
|
+
const example = this.state.example() ?? '';
|
|
881
|
+
if (this.webcomponentsList.includes(baseUrl + example + '-react')) {
|
|
882
|
+
this.frameworks.set('React', 'react');
|
|
883
|
+
}
|
|
884
|
+
else {
|
|
885
|
+
if (this.state.framework() === 'react') {
|
|
886
|
+
this.state.framework.set('angular');
|
|
887
|
+
}
|
|
888
|
+
this.frameworks.delete('React');
|
|
889
|
+
}
|
|
890
|
+
if (this.webcomponentsList.includes(baseUrl + example + '-vue')) {
|
|
891
|
+
this.frameworks.set('Vue', 'vue');
|
|
892
|
+
}
|
|
893
|
+
else {
|
|
894
|
+
if (this.state.framework() === 'vue') {
|
|
895
|
+
this.state.framework.set('angular');
|
|
896
|
+
}
|
|
897
|
+
this.frameworks.delete('Vue');
|
|
898
|
+
}
|
|
899
|
+
if (this.webcomponentsList.includes(baseUrl + example + '-js')) {
|
|
900
|
+
this.frameworks.set('Js', 'js');
|
|
901
|
+
}
|
|
902
|
+
else {
|
|
903
|
+
if (this.state.framework() === 'js') {
|
|
904
|
+
this.state.framework.set('angular');
|
|
905
|
+
}
|
|
906
|
+
this.frameworks.delete('Js');
|
|
907
|
+
}
|
|
908
|
+
this.changeFramework(this.state.framework());
|
|
909
|
+
}
|
|
910
|
+
changeFramework(framework) {
|
|
911
|
+
this.activeTab.set(framework);
|
|
912
|
+
this.state.framework.set(framework);
|
|
913
|
+
localStorage.setItem('si-live-preview-framework', framework);
|
|
914
|
+
this.state.loadReact.set(false);
|
|
915
|
+
this.state.loadVue.set(false);
|
|
916
|
+
this.state.loadJs.set(false);
|
|
917
|
+
let fileType = 'vue';
|
|
918
|
+
if (framework === 'angular') {
|
|
919
|
+
this.activeTab.set('template');
|
|
920
|
+
return;
|
|
921
|
+
}
|
|
922
|
+
else if (framework === 'react') {
|
|
923
|
+
fileType = 'tsx';
|
|
924
|
+
if (this.reactLoaded) {
|
|
925
|
+
this.updateReact(this.state.templateReact());
|
|
926
|
+
return;
|
|
927
|
+
}
|
|
928
|
+
}
|
|
929
|
+
else if (framework === 'vue' && this.vueLoaded) {
|
|
930
|
+
this.updateVue(this.state.templateVue());
|
|
931
|
+
return;
|
|
932
|
+
}
|
|
933
|
+
else if (framework === 'js') {
|
|
934
|
+
fileType = 'html';
|
|
935
|
+
if (this.jsLoaded) {
|
|
936
|
+
this.updateJs(this.state.templateJs());
|
|
937
|
+
return;
|
|
938
|
+
}
|
|
939
|
+
}
|
|
940
|
+
this.handleInProgressEvent(true);
|
|
941
|
+
const example = this.state.example() ?? '';
|
|
942
|
+
this.http
|
|
943
|
+
.get(this.urls.sourceUrl(`${example}-${framework}.${fileType}`), { responseType: 'text' })
|
|
944
|
+
.subscribe({
|
|
945
|
+
next: (res) => {
|
|
946
|
+
if (framework === 'react') {
|
|
947
|
+
this.updateReact(res);
|
|
948
|
+
this.state.templateReact.set(res);
|
|
949
|
+
this.reactLoaded = true;
|
|
950
|
+
}
|
|
951
|
+
else if (framework === 'vue') {
|
|
952
|
+
this.updateVue(res);
|
|
953
|
+
this.state.templateVue.set(res);
|
|
954
|
+
this.vueLoaded = true;
|
|
955
|
+
}
|
|
956
|
+
else if (framework === 'js') {
|
|
957
|
+
this.updateJs(res);
|
|
958
|
+
this.state.templateJs.set(res);
|
|
959
|
+
this.jsLoaded = true;
|
|
960
|
+
}
|
|
961
|
+
setTimeout(() => {
|
|
962
|
+
this.handleInProgressEvent(false);
|
|
963
|
+
});
|
|
964
|
+
},
|
|
965
|
+
error: (err) => {
|
|
966
|
+
if (framework === 'react') {
|
|
967
|
+
this.updateReact('');
|
|
968
|
+
this.reactLoaded = true;
|
|
969
|
+
}
|
|
970
|
+
else if (framework === 'vue') {
|
|
971
|
+
this.updateVue('');
|
|
972
|
+
this.vueLoaded = true;
|
|
973
|
+
}
|
|
974
|
+
else if (framework === 'js') {
|
|
975
|
+
this.updateJs('');
|
|
976
|
+
this.jsLoaded = true;
|
|
977
|
+
}
|
|
978
|
+
this.handleInProgressEvent(false);
|
|
979
|
+
}
|
|
980
|
+
});
|
|
981
|
+
}
|
|
982
|
+
templateFromComponent(template) {
|
|
983
|
+
if (this.state.template()) {
|
|
984
|
+
return;
|
|
985
|
+
}
|
|
986
|
+
if (template === undefined) {
|
|
987
|
+
// there's no component loaded in the renderer, load template from url
|
|
988
|
+
this.loadTemplateFromUrl();
|
|
989
|
+
}
|
|
990
|
+
else {
|
|
991
|
+
// using template from component
|
|
992
|
+
this.updateTemplate(template);
|
|
993
|
+
}
|
|
994
|
+
}
|
|
995
|
+
handleInProgressEvent(inProgress) {
|
|
996
|
+
this.state.setRenderingProgress(inProgress);
|
|
997
|
+
}
|
|
998
|
+
logClear(delayed = false) {
|
|
999
|
+
if (this.state.logMessages().length) {
|
|
1000
|
+
this.state.clearLogs(delayed);
|
|
1001
|
+
setTimeout(() => {
|
|
1002
|
+
this.consoleElem().nativeElement.scrollTop = 0;
|
|
1003
|
+
}, delayed ? 100 : 0);
|
|
1004
|
+
}
|
|
1005
|
+
}
|
|
1006
|
+
logEvent(msg) {
|
|
1007
|
+
this.state.addLog(msg);
|
|
1008
|
+
}
|
|
1009
|
+
showCopiedLabel() {
|
|
1010
|
+
this.showCopied.set(true);
|
|
1011
|
+
setTimeout(() => {
|
|
1012
|
+
this.showCopied.set(false);
|
|
1013
|
+
}, 1500);
|
|
1014
|
+
}
|
|
1015
|
+
toggleFullscreen(exampleOnly = false) {
|
|
1016
|
+
const fullscreenElement = this.getFullscreenElement();
|
|
1017
|
+
if (fullscreenElement) {
|
|
1018
|
+
const exitFunction = document.exitFullscreen ?? document.webkitExitFullscreen;
|
|
1019
|
+
if (exitFunction) {
|
|
1020
|
+
exitFunction.call(document);
|
|
1021
|
+
}
|
|
1022
|
+
}
|
|
1023
|
+
else {
|
|
1024
|
+
const elem = exampleOnly
|
|
1025
|
+
? this.self.nativeElement.querySelector(':scope > .example')
|
|
1026
|
+
: this.self.nativeElement;
|
|
1027
|
+
this.exampleFullscreen.set(exampleOnly);
|
|
1028
|
+
const requestFunction = elem.requestFullscreen ?? elem.webkitRequestFullScreen;
|
|
1029
|
+
if (requestFunction) {
|
|
1030
|
+
requestFunction.call(elem);
|
|
1031
|
+
}
|
|
1032
|
+
}
|
|
1033
|
+
}
|
|
1034
|
+
toggleCollapse() {
|
|
1035
|
+
this.editorCollapsed.set(!this.editorCollapsed());
|
|
1036
|
+
localStorage.setItem('si-live-preview-editor-collapsed', this.editorCollapsed().toString());
|
|
1037
|
+
if (this.editorCollapsed()) {
|
|
1038
|
+
this.showEditor.set(false);
|
|
1039
|
+
setTimeout(() => window.dispatchEvent(new Event('resize')), 500);
|
|
1040
|
+
}
|
|
1041
|
+
else {
|
|
1042
|
+
setTimeout(() => {
|
|
1043
|
+
this.showEditor.set(true);
|
|
1044
|
+
this.state.newMessages.set(false);
|
|
1045
|
+
window.dispatchEvent(new Event('resize'));
|
|
1046
|
+
}, 500);
|
|
1047
|
+
}
|
|
1048
|
+
}
|
|
1049
|
+
toggleRTL() {
|
|
1050
|
+
this.state.isRTL.set(!this.state.isRTL());
|
|
1051
|
+
}
|
|
1052
|
+
toggleTheme() {
|
|
1053
|
+
this.themeChange(this.state.theme() === 'dark' ? 'light' : 'dark');
|
|
1054
|
+
}
|
|
1055
|
+
localeSelectionChanged(target) {
|
|
1056
|
+
const locale = target?.value;
|
|
1057
|
+
this.changeLocale(locale);
|
|
1058
|
+
}
|
|
1059
|
+
rfsSelectionChanges(value) {
|
|
1060
|
+
this.state.rootFontSize.set(value === 'initial' ? value : parseInt(value, 10));
|
|
1061
|
+
localStorage.setItem('si-live-preview-rfs', this.state.rootFontSize().toString());
|
|
1062
|
+
}
|
|
1063
|
+
changeLocale(locale) {
|
|
1064
|
+
this.state.locale.set(locale ?? undefined);
|
|
1065
|
+
}
|
|
1066
|
+
renderingErrorMessage() {
|
|
1067
|
+
return String(this.state.renderingError());
|
|
1068
|
+
}
|
|
1069
|
+
copyTemplate() {
|
|
1070
|
+
this.clipboardCopy(this.state.template());
|
|
1071
|
+
}
|
|
1072
|
+
copyCode() {
|
|
1073
|
+
if (this.activeTab() === 'react') {
|
|
1074
|
+
this.clipboardCopy(this.state.templateReact());
|
|
1075
|
+
}
|
|
1076
|
+
else if (this.activeTab() === 'vue') {
|
|
1077
|
+
this.clipboardCopy(this.state.templateVue());
|
|
1078
|
+
}
|
|
1079
|
+
else if (this.activeTab() === 'js') {
|
|
1080
|
+
this.clipboardCopy(this.state.templateJs());
|
|
1081
|
+
}
|
|
1082
|
+
else {
|
|
1083
|
+
this.clipboardCopy(this.templateTs);
|
|
1084
|
+
}
|
|
1085
|
+
}
|
|
1086
|
+
clipboardCopy(text) {
|
|
1087
|
+
navigator.clipboard.writeText(text);
|
|
1088
|
+
this.showCopiedLabel();
|
|
1089
|
+
}
|
|
1090
|
+
createLink() {
|
|
1091
|
+
this.clipboardCopy(this.urls.viewerUrl('editor'));
|
|
1092
|
+
}
|
|
1093
|
+
openTab() {
|
|
1094
|
+
window.open(this.urls.viewerUrl('viewer'), '_blank');
|
|
1095
|
+
}
|
|
1096
|
+
onFullscreenChange() {
|
|
1097
|
+
const fullscreenElement = this.getFullscreenElement();
|
|
1098
|
+
this.isFullscreen.set(!!fullscreenElement && this.self.nativeElement.contains(fullscreenElement));
|
|
1099
|
+
if (!this.isFullscreen()) {
|
|
1100
|
+
this.exampleFullscreen.set(false);
|
|
1101
|
+
}
|
|
1102
|
+
}
|
|
1103
|
+
getFullscreenElement() {
|
|
1104
|
+
const root = this.self.nativeElement.getRootNode();
|
|
1105
|
+
return (root.fullscreenElement ??
|
|
1106
|
+
document.webkitFullscreenElement ??
|
|
1107
|
+
null);
|
|
1108
|
+
}
|
|
1109
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SiLivePreviewComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1110
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.8", type: SiLivePreviewComponent, isStandalone: true, selector: "si-live-preview", inputs: { initialTheme: { classPropertyName: "initialTheme", publicName: "initialTheme", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "document:fullscreenchange": "onFullscreenChange()", "document:webkitfullscreenchange": "onFullscreenChange()" }, properties: { "class.editor-fullscreen": "isFullscreen()", "class.is-mobile": "isMobile" } }, viewQueries: [{ propertyName: "templateElem", first: true, predicate: ["codeTemplate"], descendants: true, isSignal: true }, { propertyName: "typescriptElem", first: true, predicate: ["codeTypescript"], descendants: true, isSignal: true }, { propertyName: "reactVueElem", first: true, predicate: ["codeReactVue"], descendants: true, isSignal: true }, { propertyName: "consoleElem", first: true, predicate: ["consoleContainer"], descendants: true, isSignal: true }], ngImport: i0, template: "@let active = activeTab();\n<div class=\"example\" [class.fullscreen]=\"exampleFullscreen()\" [class.is-mobile]=\"isMobile\">\n <div class=\"preview-iframe\" [class.is-mobile]=\"isMobile\">\n <si-live-preview-iframe\n [isFullscreen]=\"isFullscreen()\"\n (templateFromComponent)=\"templateFromComponent($event)\"\n />\n @if (state.inProgress()) {\n <div class=\"progress-container\">\n <div class=\"progress-inner\">\n <div class=\"progress-dots\"></div>\n </div>\n </div>\n }\n @if (isFullscreen()) {\n <div class=\"buttons\">\n <button\n type=\"button\"\n class=\"btn-command fullscreen\"\n title=\"Close fullscreen\"\n aria-label=\"Close fullscreen\"\n (click)=\"toggleFullscreen(true)\"\n >\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\">\n <path\n d=\"M273,256l87.52-87.51a12,12,0,0,0-17-17L256,239l-87.51-87.52a12,12,0,0,0-17,17L239,256l-87.52,87.51a12,12,0,0,0,17,17L256,273l87.51,87.52a12,12,0,0,0,17-17Z\"\n />\n </svg>\n </button>\n </div>\n }\n </div>\n</div>\n\n<div class=\"code\" [class.is-mobile]=\"isMobile\" [class.is-collapsed]=\"editorCollapsed()\">\n <div class=\"collapse-wrapper\">\n <div role=\"tablist\" class=\"nav lp-tabs\">\n @if (showEditor() && (active === 'template' || active === 'typescript')) {\n <button\n type=\"button\"\n role=\"tab\"\n class=\"tab-item tab-link focus-inside\"\n id=\"templateEditorTab\"\n [class.tab-active]=\"active === 'template'\"\n (click)=\"activateTab('template')\"\n >\n Template\n </button>\n <button\n type=\"button\"\n role=\"tab\"\n class=\"tab-item tab-link focus-inside\"\n id=\"typescriptEditorTab\"\n [class.tab-active]=\"active === 'typescript'\"\n (click)=\"activateTab('typescript')\"\n >\n Typescript\n </button>\n }\n </div>\n @if (!isMobile) {\n <div class=\"collapse-button\" [class.is-collapsed]=\"editorCollapsed()\">\n <button\n type=\"button\"\n [attr.title]=\"editorCollapsed() ? 'Show editor' : 'Hide editor'\"\n [attr.aria-label]=\"editorCollapsed() ? 'Show editor' : 'Hide editor'\"\n (click)=\"toggleCollapse()\"\n >\n <svg class=\"collapse-icon\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\">\n <path\n class=\"cls-1\"\n d=\"M248.93,277.23l-1.72-1.44-110-110a12.43,12.43,0,0,1,15.86-19l1.72,1.44L256,249.41l101.21-101.2a12.45,12.45,0,0,1,15.86-1.44l1.72,1.44a12.45,12.45,0,0,1,1.44,15.86l-1.44,1.72-110,110A12.45,12.45,0,0,1,248.93,277.23Z\"\n />\n <path\n class=\"cls-1\"\n d=\"M248.93,365.23l-1.72-1.44-88-88a12.43,12.43,0,0,1,15.86-19l1.72,1.44L256,337.41l79.21-79.2a12.45,12.45,0,0,1,15.86-1.44l1.72,1.44a12.45,12.45,0,0,1,1.44,15.86l-1.44,1.72-88,88A12.45,12.45,0,0,1,248.93,365.23Z\"\n />\n </svg>\n </button>\n </div>\n }\n </div>\n\n @if (allowFullscreen && !isFullscreen()) {\n <div class=\"buttons\">\n @if (webcomponents && showEditor() && frameworks.size > 1) {\n <select\n aria-label=\"Select framework\"\n class=\"btn-command locale-selection\"\n [ngModel]=\"state.framework()\"\n (ngModelChange)=\"changeFramework($event)\"\n >\n @for (aFramework of frameworks | keyvalue; track $index) {\n <option [value]=\"aFramework.value\" [selected]=\"state.framework() === aFramework.value\">\n {{ aFramework.key }}\n </option>\n }\n </select>\n }\n @if (rootFontSizes.length) {\n <select\n name=\"selectRfs\"\n aria-label=\"Root font size\"\n title=\"Root font size\"\n class=\"btn-command rfs-selection\"\n [ngModel]=\"state.rootFontSize()\"\n (ngModelChange)=\"rfsSelectionChanges($event)\"\n >\n <option value=\"0\">none</option>\n <option value=\"initial\">initial</option>\n @for (rfs of rootFontSizes; track rfs) {\n <option [value]=\"rfs\">{{ rfs }}px</option>\n }\n </select>\n }\n @if (!!localeApi && showEditor()) {\n <select\n name=\"selectLocale\"\n aria-label=\"Select locale\"\n title=\"Locale\"\n class=\"btn-command locale-selection\"\n (change)=\"localeSelectionChanged($event.target)\"\n >\n @for (aLocale of availableLocales; track $index) {\n <option [value]=\"aLocale\" [selected]=\"state.locale() === aLocale\">\n {{ aLocale }}\n </option>\n }\n </select>\n }\n @if (rtlSwitcher) {\n <button\n type=\"button\"\n class=\"btn-command rtl-selection\"\n [title]=\"state.isRTL() ? 'Right-to-left layout' : 'Left-to-right layout'\"\n [attr.aria-label]=\"\n state.isRTL() ? 'RTL (right-to-left layout)' : 'LTR (left-to-right layout)'\n \"\n (click)=\"toggleRTL()\"\n >\n {{ state.isRTL() ? 'RTL' : 'LTR' }}\n </button>\n }\n @if (\n !isMobile &&\n !showEditor() &&\n (state.renderingError() || (state.logMessages().length && state.newMessages()))\n ) {\n <button\n type=\"button\"\n class=\"btn-command\"\n title=\"Show console\"\n aria-label=\"Show console\"\n [class.alert]=\"state.renderingError()\"\n [class.info]=\"state.logMessages().length\"\n (click)=\"toggleCollapse()\"\n >\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\">\n <path\n d=\"M255.84,296a12,12,0,0,1-12-12V124a12,12,0,1,1,24,0V284A12,12,0,0,1,255.84,296Z\"\n />\n <path d=\"M256.12,387.81h-.24a16,16,0,0,1,0-32h.24a16,16,0,0,1,0,32Z\" />\n </svg>\n </button>\n }\n @if (switcherEnabled && !isMobile) {\n <button\n type=\"button\"\n class=\"btn-command\"\n title=\"Toggle theme\"\n aria-label=\"Toggle theme\"\n (click)=\"toggleTheme()\"\n >\n @if (state.theme() === 'dark') {\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\">\n <path\n d=\"M256,349.82A93.82,93.82,0,1,0,162.18,256,93.93,93.93,0,0,0,256,349.82Zm0-163.64A69.82,69.82,0,1,1,186.18,256,69.9,69.9,0,0,1,256,186.18Z\"\n />\n <path\n d=\"M256,120.73a12,12,0,0,0,12-12V76a12,12,0,0,0-24,0v32.73A12,12,0,0,0,256,120.73Z\"\n />\n <path d=\"M268,436V403.27a12,12,0,0,0-24,0V436a12,12,0,0,0,24,0Z\" />\n <path d=\"M143.44,160.41a12,12,0,1,0,17-17l-23.23-23.23a12,12,0,1,0-17,17Z\" />\n <path\n d=\"M351.59,351.59a12,12,0,0,0,0,17l23.23,23.23a12,12,0,0,0,17-17l-23.23-23.23A12,12,0,0,0,351.59,351.59Z\"\n />\n <path\n d=\"M120.73,256a12,12,0,0,0-12-12H76a12,12,0,0,0,0,24h32.73A12,12,0,0,0,120.73,256Z\"\n />\n <path d=\"M436,244H403.27a12,12,0,0,0,0,24H436a12,12,0,0,0,0-24Z\" />\n <path\n d=\"M137.18,391.79l23.23-23.23a12,12,0,1,0-17-17l-23.23,23.23a12,12,0,1,0,17,17Z\"\n />\n <path\n d=\"M360.07,163.93a12,12,0,0,0,8.49-3.52l23.23-23.23a12,12,0,1,0-17-17l-23.23,23.23a12,12,0,0,0,8.48,20.49Z\"\n />\n </svg>\n } @else {\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\">\n <path\n d=\"M360.07,147.88a12,12,0,0,0,5.89-21.1,168.05,168.05,0,0,0-214.71,0C80,186,70.19,292.1,129.38,363.35a166.9,166.9,0,0,0,113.77,59.93q7.9.74,15.75.73A166.74,166.74,0,0,0,366,385.22a12,12,0,0,0-5.89-21.1,109.33,109.33,0,0,1,0-216.24ZM244.43,275.77A133.48,133.48,0,0,0,330,381.08,144.11,144.11,0,0,1,147.84,348C97.1,287,105.51,196,166.58,145.24A144.08,144.08,0,0,1,330,130.94C272,152.38,234.91,212.29,244.43,275.77Z\"\n />\n </svg>\n }\n </button>\n }\n @if (!isMobile && showEditor()) {\n <button\n type=\"button\"\n class=\"btn-command\"\n title=\"Example fullscreen\"\n aria-label=\"Example fullscreen\"\n (click)=\"toggleFullscreen(true)\"\n >\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\">\n <path\n d=\"M406,112H106a42,42,0,0,0-42,42V358a42,42,0,0,0,42,42H406a42,42,0,0,0,42-42V154A42,42,0,0,0,406,112Zm18,246a18,18,0,0,1-18,18H106a18,18,0,0,1-18-18V154a18,18,0,0,1,18-18H406a18,18,0,0,1,18,18Z\"\n />\n </svg>\n </button>\n }\n @if (showEditor()) {\n <button\n type=\"button\"\n class=\"btn-command\"\n title=\"Editor + Example fullscreen\"\n aria-label=\"Editor + Example fullscreen\"\n (click)=\"toggleFullscreen()\"\n >\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\">\n <path\n d=\"M406,112H106a42,42,0,0,0-42,42V358a42,42,0,0,0,42,42H406a42,42,0,0,0,42-42V154A42,42,0,0,0,406,112Zm18,42V313.44H199.35V136H406A18,18,0,0,1,424,154ZM88,358V154a18,18,0,0,1,18-18h69.35V376H106A18,18,0,0,1,88,358Zm318,18H199.35V337.44H424V358A18,18,0,0,1,406,376Z\"\n />\n </svg>\n </button>\n }\n <button\n siStackblitz\n class=\"btn-command\"\n type=\"button\"\n [baseUrl]=\"baseUrl\"\n [framework]=\"state.framework()\"\n [example]=\"state.example()\"\n >\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\">\n <path\n d=\"M182.32 480.02c-3.65 0-7.34-1.01-10.68-3.09-8.61-5.36-11.86-15.98-7.72-25.24s65.44-146.6 65.44-146.6c.58-1.29.19-2.34-.23-3-.42-.65-1.23-1.43-2.64-1.43h-54.96c-13.79 0-25.98-7.76-31.83-20.24s-4-26.82 4.83-37.41L314.3 39.26c6.5-7.79 17.46-9.55 26.06-4.19 8.61 5.36 11.85 15.98 7.72 25.24l-65.44 146.6c-.58 1.29-.19 2.34.23 3 .42.65 1.23 1.43 2.64 1.43h54.96c13.79 0 25.98 7.76 31.83 20.24s4 26.82-4.83 37.41L197.69 472.73c-3.97 4.77-9.62 7.28-15.38 7.28Zm101.45-354.13L169.1 263.49c-.85 1.02-1 2.15-.43 3.35.56 1.2 1.52 1.81 2.85 1.81h54.96c11.96 0 22.98 5.99 29.49 16.02s7.48 22.54 2.61 33.46l-30.35 67.98 114.67-137.6c.85-1.02 1-2.15.43-3.35s-1.52-1.81-2.85-1.81h-54.96c-11.96 0-22.98-5.99-29.49-16.02s-7.48-22.54-2.61-33.46l30.35-67.99Z\"\n />\n </svg>\n </button>\n </div>\n }\n <div class=\"tab-content\" [class.is-mobile]=\"isMobile\">\n <fieldset\n class=\"tab-pane\"\n [class.tab-active]=\"active === 'template'\"\n [class.is-mobile]=\"isMobile\"\n [disabled]=\"editorCollapsed()\"\n >\n <div class=\"buttons\" [class.show-copied]=\"showCopied()\">\n @if (!isMobile) {\n <button\n type=\"button\"\n class=\"btn-command\"\n title=\"Open in new tab\"\n aria-label=\"Open in new tab\"\n (click)=\"openTab()\"\n >\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\">\n <path\n d=\"M344.94 150.78l46.12 38L345 226.94v-25.38l-24.19.19c-19.93.16-43.45 1.35-66.84 9a132.91 132.91 0 00-20.6 8.6c1.13-1.56 2.32-3.11 3.57-4.63 13.37-16.27 39-36.14 85.18-38.4l22.83-1.11v-24.43M329.09 109a8.33 8.33 0 00-3.48.77 8.14 8.14 0 00-4.67 7.38v35.15c-54.9 2.69-86 27-102.55 47.14-21.1 25.69-28.56 55.84-28.51 75.48a8.1 8.1 0 006 7.83 7.68 7.68 0 002.1.28 8.13 8.13 0 007.1-4.13c12.67-22.33 31.08-37.18 56.29-45.38 19.82-6.45 40.3-7.62 59.61-7.78v34.91a8 8 0 004.66 7.37 7.84 7.84 0 003.46.79 8.26 8.26 0 005.16-1.85l86.92-72a8.06 8.06 0 002.93-6.26 8.17 8.17 0 00-3-6.25l-86.9-71.66a8.11 8.11 0 00-5.15-1.84z\"\n />\n <path\n d=\"M397.23 399.39H114.94a26.89 26.89 0 01-26.86-26.86V204.26a26.89 26.89 0 0126.86-26.86h70.49a12 12 0 010 24h-70.49a2.9 2.9 0 00-2.86 2.86v168.27a2.9 2.9 0 002.86 2.86h282.29a2.9 2.9 0 002.85-2.86V253.67a12 12 0 0124 0v118.86a26.88 26.88 0 01-26.85 26.86z\"\n />\n </svg>\n </button>\n }\n @if (allowCopy) {\n <button\n type=\"button\"\n class=\"btn-command\"\n title=\"Copy template as URL\"\n aria-label=\"Copy template as URL\"\n (click)=\"createLink()\"\n >\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\">\n <path\n d=\"M333.56,88.16a90,90,0,0,0-62.83,25.39l-.13.12-27,26.82a12,12,0,0,0,16.92,17l26.92-26.76a66.44,66.44,0,0,1,94,93.94l-47,47a67.6,67.6,0,0,1-7.19,6.23,66.44,66.44,0,0,1-93-13.41A12,12,0,0,0,215,278.88a89.88,89.88,0,0,0,59.52,35.34,91.93,91.93,0,0,0,13.1.94,89.77,89.77,0,0,0,54-18,90.87,90.87,0,0,0,9.79-8.48l47.07-47.07.14-.15A90.44,90.44,0,0,0,333.56,88.16Z\"\n />\n <path\n d=\"M251.28,354.51l-26.75,26.75a66.44,66.44,0,0,1-93.95-93.95l47-47a68.76,68.76,0,0,1,7.19-6.23,66.53,66.53,0,0,1,93,13.41A12,12,0,0,0,297,233.12a90.5,90.5,0,0,0-136.39-9.77l-47.06,47.07-.15.15A90.44,90.44,0,0,0,241.28,398.45a.93.93,0,0,0,.14-.14l26.83-26.83a12,12,0,0,0-17-17Z\"\n />\n </svg>\n </button>\n }\n @if (allowCopy) {\n <button\n type=\"button\"\n class=\"btn-command\"\n title=\"Copy template\"\n aria-label=\"Copy template\"\n (click)=\"copyTemplate()\"\n >\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\">\n <path\n d=\"M380.8,197.2H240.4a43.25,43.25,0,0,0-43.2,43.2V380.8A43.25,43.25,0,0,0,240.4,424H380.8A43.25,43.25,0,0,0,424,380.8V240.4A43.25,43.25,0,0,0,380.8,197.2ZM400,380.8A19.22,19.22,0,0,1,380.8,400H240.4a19.22,19.22,0,0,1-19.2-19.2V240.4a19.22,19.22,0,0,1,19.2-19.2H380.8A19.22,19.22,0,0,1,400,240.4Z\"\n />\n <path\n d=\"M146.8,290.8H131.2A19.22,19.22,0,0,1,112,271.6V131.2A19.22,19.22,0,0,1,131.2,112H271.6a19.22,19.22,0,0,1,19.2,19.2v15.6a12,12,0,0,0,24,0V131.2A43.25,43.25,0,0,0,271.6,88H131.2A43.25,43.25,0,0,0,88,131.2V271.6a43.25,43.25,0,0,0,43.2,43.2h15.6a12,12,0,0,0,0-24Z\"\n />\n </svg>\n </button>\n }\n <div class=\"copied\" role=\"tooltip\">copied</div>\n </div>\n <div #codeTemplate class=\"codeflask-editor\"></div>\n </fieldset>\n <fieldset\n class=\"tab-pane\"\n [class.tab-active]=\"active === 'typescript'\"\n [class.is-mobile]=\"isMobile\"\n [disabled]=\"editorCollapsed()\"\n >\n <div class=\"buttons\" [class.show-copied]=\"showCopied()\">\n <span class=\"readonly-label\">read-only</span>\n @if (allowCopy) {\n <button\n type=\"button\"\n class=\"btn-command\"\n title=\"Copy code\"\n aria-label=\"Copy code\"\n (click)=\"copyCode()\"\n >\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\">\n <path\n d=\"M380.8,197.2H240.4a43.25,43.25,0,0,0-43.2,43.2V380.8A43.25,43.25,0,0,0,240.4,424H380.8A43.25,43.25,0,0,0,424,380.8V240.4A43.25,43.25,0,0,0,380.8,197.2ZM400,380.8A19.22,19.22,0,0,1,380.8,400H240.4a19.22,19.22,0,0,1-19.2-19.2V240.4a19.22,19.22,0,0,1,19.2-19.2H380.8A19.22,19.22,0,0,1,400,240.4Z\"\n />\n <path\n d=\"M146.8,290.8H131.2A19.22,19.22,0,0,1,112,271.6V131.2A19.22,19.22,0,0,1,131.2,112H271.6a19.22,19.22,0,0,1,19.2,19.2v15.6a12,12,0,0,0,24,0V131.2A43.25,43.25,0,0,0,271.6,88H131.2A43.25,43.25,0,0,0,88,131.2V271.6a43.25,43.25,0,0,0,43.2,43.2h15.6a12,12,0,0,0,0-24Z\"\n />\n </svg>\n </button>\n }\n <div class=\"copied\" role=\"tooltip\">copied</div>\n </div>\n <fieldset #codeTypescript class=\"codeflask-editor readonly\"></fieldset>\n </fieldset>\n <fieldset\n class=\"tab-pane\"\n [class.tab-active]=\"active === 'react' || active === 'vue' || active === 'js'\"\n [class.is-mobile]=\"isMobile\"\n [disabled]=\"editorCollapsed()\"\n >\n <div class=\"buttons\" [class.show-copied]=\"showCopied()\">\n @if (allowCopy) {\n <button\n type=\"button\"\n class=\"btn-command\"\n title=\"Copy template as URL\"\n aria-label=\"Copy template as URL\"\n (click)=\"createLink()\"\n >\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\">\n <path\n d=\"M333.56,88.16a90,90,0,0,0-62.83,25.39l-.13.12-27,26.82a12,12,0,0,0,16.92,17l26.92-26.76a66.44,66.44,0,0,1,94,93.94l-47,47a67.6,67.6,0,0,1-7.19,6.23,66.44,66.44,0,0,1-93-13.41A12,12,0,0,0,215,278.88a89.88,89.88,0,0,0,59.52,35.34,91.93,91.93,0,0,0,13.1.94,89.77,89.77,0,0,0,54-18,90.87,90.87,0,0,0,9.79-8.48l47.07-47.07.14-.15A90.44,90.44,0,0,0,333.56,88.16Z\"\n />\n <path\n d=\"M251.28,354.51l-26.75,26.75a66.44,66.44,0,0,1-93.95-93.95l47-47a68.76,68.76,0,0,1,7.19-6.23,66.53,66.53,0,0,1,93,13.41A12,12,0,0,0,297,233.12a90.5,90.5,0,0,0-136.39-9.77l-47.06,47.07-.15.15A90.44,90.44,0,0,0,241.28,398.45a.93.93,0,0,0,.14-.14l26.83-26.83a12,12,0,0,0-17-17Z\"\n />\n </svg>\n </button>\n }\n @if (allowCopy) {\n <button\n type=\"button\"\n class=\"btn-command\"\n title=\"Copy code\"\n aria-label=\"Copy code\"\n (click)=\"copyCode()\"\n >\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\">\n <path\n d=\"M380.8,197.2H240.4a43.25,43.25,0,0,0-43.2,43.2V380.8A43.25,43.25,0,0,0,240.4,424H380.8A43.25,43.25,0,0,0,424,380.8V240.4A43.25,43.25,0,0,0,380.8,197.2ZM400,380.8A19.22,19.22,0,0,1,380.8,400H240.4a19.22,19.22,0,0,1-19.2-19.2V240.4a19.22,19.22,0,0,1,19.2-19.2H380.8A19.22,19.22,0,0,1,400,240.4Z\"\n />\n <path\n d=\"M146.8,290.8H131.2A19.22,19.22,0,0,1,112,271.6V131.2A19.22,19.22,0,0,1,131.2,112H271.6a19.22,19.22,0,0,1,19.2,19.2v15.6a12,12,0,0,0,24,0V131.2A43.25,43.25,0,0,0,271.6,88H131.2A43.25,43.25,0,0,0,88,131.2V271.6a43.25,43.25,0,0,0,43.2,43.2h15.6a12,12,0,0,0,0-24Z\"\n />\n </svg>\n </button>\n }\n <div class=\"copied\" role=\"tooltip\">copied</div>\n </div>\n <label for=\"reactVueEditor\">React and Vue code editor</label>\n <fieldset #codeReactVue class=\"codeflask-editor\"></fieldset>\n </fieldset>\n <div class=\"console\" [hidden]=\"!state.renderingError() && !state.logMessages().length\">\n <div class=\"buttons\">\n @if (state.logMessages().length) {\n <button\n type=\"button\"\n class=\"btn-command btn-clear\"\n title=\"Clear log\"\n aria-label=\"Clear log\"\n [class.on-danger]=\"state.renderingError()\"\n (click)=\"logClear()\"\n >\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\">\n <path\n d=\"M400,144H328V132a44.05,44.05,0,0,0-44-44H228a44.05,44.05,0,0,0-44,44v12H112a12,12,0,0,0,0,24h20V380a44.05,44.05,0,0,0,44,44H336a44.05,44.05,0,0,0,44-44V168h20a12,12,0,0,0,0-24ZM208,132a20,20,0,0,1,20-20h56a20,20,0,0,1,20,20v12H208ZM356,380a20,20,0,0,1-20,20H176a20,20,0,0,1-20-20V168H356Z\"\n />\n <path d=\"M224,344a12,12,0,0,0,12-12V236a12,12,0,0,0-24,0v96A12,12,0,0,0,224,344Z\" />\n <path d=\"M288,344a12,12,0,0,0,12-12V236a12,12,0,0,0-24,0v96A12,12,0,0,0,288,344Z\" />\n </svg>\n </button>\n }\n </div>\n <div #consoleContainer class=\"scroller\">\n @if (state.renderingError()) {\n <pre class=\"alert-danger\"><code class=\"bg-none\">{{ renderingErrorMessage() }}</code></pre>\n }\n @if (!state.renderingError() && state.logMessages().length) {\n <ul>\n @for (msg of state.logMessages(); track $index) {\n <li>{{ msg }}</li>\n }\n </ul>\n }\n </div>\n </div>\n </div>\n</div>\n", styles: [".lp-tabs{display:flex;flex-wrap:wrap;padding-inline-start:0;margin:0;list-style:none;background:none;inline-size:inherit;font-weight:700}.lp-tabs .tab-item:focus-visible{outline-offset:calc(-1 * var(--si-sys-sizing-focus-ring-width, 2px))}.lp-tabs .tab-item.tab-active.tab-link{color:var(--si-sys-color-text-accent);border-block-end-color:var(--si-sys-color-text-accent)!important}.lp-tabs .tab-item.tab-active.tab-link:hover{color:var(--si-sys-color-text-accent-hover)}.lp-tabs .tab-item.tab-link{font:inherit;background:none;min-inline-size:150px;display:block;padding-block:8px;padding-inline:15px;cursor:pointer;text-align:start;line-height:20px;color:var(--si-sys-color-text-primary);border:0;border-block-end:4px solid transparent}.lp-tabs .tab-item.tab-link:hover{text-decoration:none;color:var(--si-sys-color-text-accent-hover);border-block-end-color:var(--si-sys-color-border-4)}*:focus-visible{outline:var(--si-sys-sizing-focus-ring-width, 2px) solid var(--si-sys-color-effects-focus);outline-offset:var(--si-sys-sizing-focus-ring-offset, 1px)}:host{flex:1 1 auto;display:flex;flex-direction:column;overflow:hidden}:host.is-mobile{flex-direction:row}:host.editor-fullscreen{inline-size:100%}:host.editor-fullscreen ::ng-deep .ticket-links{position:absolute;inset-inline-end:48px;inset-block-start:13px}[hidden]{display:none!important}.example{flex:1 1 auto;background:var(--si-sys-color-background-0);margin:0;position:relative;display:flex;flex-direction:column}.example.is-mobile{order:2;flex:unset}.example.fullscreen{padding:0;block-size:100%;inline-size:100%}.example.fullscreen:after{content:unset}.example .btn-command{padding-block:4px;padding-inline:10px}.example .buttons{inset-inline-end:0}.preview-iframe{display:flex;flex:1}.preview-iframe.is-mobile{flex:1 0 0;min-block-size:0;overflow-y:auto;overflow-x:hidden;padding-block:0;padding-inline:30px;flex-direction:column}.collapse-wrapper{display:flex;min-block-size:40px}.lp-tabs{justify-content:flex-start;inline-size:100%;border-block-end:0}.collapse-button{display:flex;justify-content:flex-start;align-items:center;inline-size:100%}.collapse-button button{background-color:transparent;border:0;padding:6px;margin-inline-start:-16px;block-size:34px}.collapse-button button>svg{block-size:20px;fill:var(--si-sys-color-text-primary)}.collapse-button button:hover,.collapse-button button:focus,.collapse-button button:active{color:var(--si-sys-color-text-accent-hover)}.collapse-button button:hover>svg,.collapse-button button:focus>svg,.collapse-button button:active>svg{fill:currentColor}.code{position:relative;background-color:var(--si-sys-color-background-0);max-block-size:414px;transition:max-block-size .5s}.code:not(.is-mobile){border-block-start:1px solid var(--si-sys-color-border-4)}.code.is-collapsed{max-block-size:41px;overflow:hidden;background-color:var(--si-sys-color-background-0)}.code.is-collapsed .collapse-icon{transform:rotate(180deg)}.code .console{block-size:68px;position:relative;border-block-start:1px solid var(--si-sys-color-border-4);color:var(--si-sys-color-text-primary)}.code .console .scroller{block-size:100%;overflow:auto;position:absolute;inset:0}.code .console pre{block-size:100%;border:0;margin:0;overflow:auto}.code .console pre.alert-danger{color:var(--si-sys-color-text-on-danger);background-color:var(--si-sys-color-background-danger)}.code .console code.bg-none{background:none}.code .console ul{list-style:none;margin:0;padding:5px;font-family:Menlo,Ubuntu Mono,Liberation Mono,Consolas,Courier,monospace}.code .console .btn-clear.on-danger,.code .console .btn-clear.on-danger:hover,.code .console .btn-clear.on-danger:focus,.code .console .btn-clear.on-danger:active{color:var(--si-sys-color-text-on-danger)}.code.is-mobile{order:1;flex:1;display:flex;flex-direction:column;max-block-size:unset;transition:unset}.code.is-mobile .console{border-inline-end:1px solid var(--si-sys-color-border-4)}pre{border-radius:0}.tab-content{display:flex;flex-direction:column}.tab-content.is-mobile{border-inline-end:1px solid var(--si-sys-color-border-4);flex:1}.tab-content:not(.is-mobile){block-size:305px}.tab-pane{flex:1;display:none;position:relative}.tab-pane.tab-active{display:flex;flex-direction:column}fieldset{padding:0;margin:0;border:0}.buttons{position:absolute;z-index:2;inset-inline-end:16px;display:flex;align-items:center;inset-block-start:0;block-size:40px}.is-mobile .buttons{inset-inline-end:0}.btn-command{background-color:transparent;border:0;color:var(--si-sys-color-text-primary);padding:8px;font-size:20px;line-height:1;block-size:34px}.btn-command>svg{block-size:20px;fill:currentColor;vertical-align:unset!important}.btn-command:hover,.btn-command:focus,.btn-command:active{color:var(--si-sys-color-text-accent-hover)}.btn-command.fullscreen{font-size:30px;padding:4px}.btn-command.alert svg,.btn-command.info svg{border-radius:50%;fill:currentColor}.btn-command.alert svg{background-color:var(--si-sys-color-background-danger);color:var(--si-sys-color-text-on-danger)}.btn-command.info svg{background-color:var(--si-sys-color-background-accent-secondary);color:var(--si-sys-color-text-accent)}.rtl-selection,.rfs-selection,.locale-selection{font-size:14px}.copied,.readonly-label{font-size:12px;padding-block:2px;padding-inline:5px;border-radius:3px}.copied{display:none;color:var(--si-sys-color-background-0);background:var(--si-sys-color-text-primary);margin-inline-end:10px;margin-block-start:12px}.show-copied .copied{display:block!important}.readonly-label{color:var(--si-sys-color-text-primary);border:1px solid var(--si-sys-color-text-primary)}.show-copied>*{display:none}.codeflask-editor{flex:1;position:relative;border-block-start:1px solid var(--si-sys-color-border-4)}.codeflask-editor ::ng-deep textarea{box-shadow:none}:host(.embedded:not(.editor-fullscreen):not(.is-mobile)) .example{flex:0 0 var(--preview-height, 204px);min-block-size:0;overflow:hidden}.progress-container{position:absolute;inset:0;pointer-events:none}.progress-container,.progress-container .progress-inner{display:flex;justify-content:center;align-items:center}.progress-container .progress-inner{inline-size:64px;block-size:40px;background:#fffc;border:1px solid #ddd;border-radius:12px}.progress-dots:before,.progress-dots:after,.progress-dots{inline-size:10px;block-size:10px;border-radius:50%;background-color:#ddd;animation:dot-flashing .6s infinite linear alternate}.progress-dots{position:relative;animation-delay:.3s}.progress-dots:before,.progress-dots:after{content:\"\";display:inline-block;position:absolute;inset-block-start:0}.progress-dots:before{inset-inline-start:-15px;animation-delay:0s}.progress-dots:after{inset-inline-start:15px;animation-delay:.6s}@keyframes dot-flashing{0%{background-color:#333}50%,to{background-color:#ddd}}\n", ":host ::ng-deep .readonly .codeflask{background-color:var(--si-sys-color-background-1)}:host ::ng-deep .codeflask{background-color:var(--si-sys-color-background-1)}:host ::ng-deep .codeflask pre,:host ::ng-deep .codeflask code{color:var(--si-sys-color-code-1);background:none;border:0;border-radius:0;text-align:start;white-space:pre;word-spacing:normal;word-break:normal;word-wrap:normal;tab-size:2;hyphens:none}:host ::ng-deep .codeflask code{padding:0}:host ::ng-deep .codeflask .codeflask__flatten,:host ::ng-deep .codeflask .codeflask__code{font-family:Menlo,Ubuntu Mono,Liberation Mono,Consolas,Courier,monospace;line-height:20px}:host ::ng-deep .codeflask .codeflask__flatten{min-inline-size:calc(100% - 40px);inline-size:auto}:host ::ng-deep .codeflask .codeflask__pre{z-index:0}:host ::ng-deep .codeflask .codeflask__textarea{z-index:1;color:transparent;caret-color:var(--si-sys-color-code-1)}:host ::ng-deep .codeflask.codeflask--has-line-numbers:before{background:var(--si-sys-color-background-0)}:host ::ng-deep .codeflask__lines{color:var(--si-sys-color-text-disabled)}:host ::ng-deep .namespace{opacity:.7}:host ::ng-deep .token.comment,:host ::ng-deep .token.prolog,:host ::ng-deep .token.doctype,:host ::ng-deep .token.cdata{color:var(--si-sys-color-code-8);font-style:italic}:host ::ng-deep .token.punctuation{color:var(--si-sys-color-code-9)}:host ::ng-deep .token.keyword,:host ::ng-deep .token.operator,:host ::ng-deep .token.boolean,:host ::ng-deep .token.symbol{color:var(--si-sys-color-code-2)}:host ::ng-deep .token.constant{color:var(--si-sys-color-code-3)}:host ::ng-deep .token.builtin{color:var(--si-sys-color-code-5)}:host ::ng-deep .token.property{color:var(--si-sys-color-code-4)}:host ::ng-deep .token.tag,:host ::ng-deep .token.selector{color:var(--si-sys-color-code-10)}:host ::ng-deep .token.number{color:var(--si-sys-color-code-7)}:host ::ng-deep .token.attr-name{color:var(--si-sys-color-code-3)}:host ::ng-deep .token.attr-value{color:var(--si-sys-color-code-6)}:host ::ng-deep .token.string,:host ::ng-deep .token.char{color:var(--si-sys-color-code-6)}:host ::ng-deep .token.function{color:var(--si-sys-color-code-5)}:host ::ng-deep .token.class-name{color:var(--si-sys-color-code-11)}:host ::ng-deep .token.important,:host ::ng-deep .token.variable{color:var(--si-sys-color-code-4)}:host ::ng-deep .token.regex{color:var(--si-sys-color-code-6)}:host ::ng-deep .token.important,:host ::ng-deep .token.bold{font-weight:600}:host ::ng-deep .token.italic{font-style:italic}:host ::ng-deep .token.entity{cursor:help}:host ::ng-deep .token.inserted{color:var(--si-sys-color-code-12)}:host ::ng-deep .token.deleted{color:var(--si-sys-color-code-11)}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i1.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i1.SelectControlValueAccessor, selector: "select:not([multiple]):not([ngNoCva])[formControlName],select:not([multiple]):not([ngNoCva])[formControl],select:not([multiple]):not([ngNoCva])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: SiLivePreviewIframeComponent, selector: "si-live-preview-iframe", inputs: ["isFullscreen"], outputs: ["templateFromComponent"] }, { kind: "directive", type: SiStackblitzButtonDirective, selector: "button[siStackblitz]", inputs: ["framework", "baseUrl", "example"] }, { kind: "pipe", type: KeyValuePipe, name: "keyvalue" }], changeDetection: i0.ChangeDetectionStrategy.Eager });
|
|
1111
|
+
}
|
|
1112
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SiLivePreviewComponent, decorators: [{
|
|
1113
|
+
type: Component,
|
|
1114
|
+
args: [{ selector: 'si-live-preview', imports: [KeyValuePipe, FormsModule, SiLivePreviewIframeComponent, SiStackblitzButtonDirective], changeDetection: ChangeDetectionStrategy.Eager, host: {
|
|
1115
|
+
'[class.editor-fullscreen]': 'isFullscreen()',
|
|
1116
|
+
'[class.is-mobile]': 'isMobile',
|
|
1117
|
+
'(document:fullscreenchange)': 'onFullscreenChange()',
|
|
1118
|
+
'(document:webkitfullscreenchange)': 'onFullscreenChange()'
|
|
1119
|
+
}, template: "@let active = activeTab();\n<div class=\"example\" [class.fullscreen]=\"exampleFullscreen()\" [class.is-mobile]=\"isMobile\">\n <div class=\"preview-iframe\" [class.is-mobile]=\"isMobile\">\n <si-live-preview-iframe\n [isFullscreen]=\"isFullscreen()\"\n (templateFromComponent)=\"templateFromComponent($event)\"\n />\n @if (state.inProgress()) {\n <div class=\"progress-container\">\n <div class=\"progress-inner\">\n <div class=\"progress-dots\"></div>\n </div>\n </div>\n }\n @if (isFullscreen()) {\n <div class=\"buttons\">\n <button\n type=\"button\"\n class=\"btn-command fullscreen\"\n title=\"Close fullscreen\"\n aria-label=\"Close fullscreen\"\n (click)=\"toggleFullscreen(true)\"\n >\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\">\n <path\n d=\"M273,256l87.52-87.51a12,12,0,0,0-17-17L256,239l-87.51-87.52a12,12,0,0,0-17,17L239,256l-87.52,87.51a12,12,0,0,0,17,17L256,273l87.51,87.52a12,12,0,0,0,17-17Z\"\n />\n </svg>\n </button>\n </div>\n }\n </div>\n</div>\n\n<div class=\"code\" [class.is-mobile]=\"isMobile\" [class.is-collapsed]=\"editorCollapsed()\">\n <div class=\"collapse-wrapper\">\n <div role=\"tablist\" class=\"nav lp-tabs\">\n @if (showEditor() && (active === 'template' || active === 'typescript')) {\n <button\n type=\"button\"\n role=\"tab\"\n class=\"tab-item tab-link focus-inside\"\n id=\"templateEditorTab\"\n [class.tab-active]=\"active === 'template'\"\n (click)=\"activateTab('template')\"\n >\n Template\n </button>\n <button\n type=\"button\"\n role=\"tab\"\n class=\"tab-item tab-link focus-inside\"\n id=\"typescriptEditorTab\"\n [class.tab-active]=\"active === 'typescript'\"\n (click)=\"activateTab('typescript')\"\n >\n Typescript\n </button>\n }\n </div>\n @if (!isMobile) {\n <div class=\"collapse-button\" [class.is-collapsed]=\"editorCollapsed()\">\n <button\n type=\"button\"\n [attr.title]=\"editorCollapsed() ? 'Show editor' : 'Hide editor'\"\n [attr.aria-label]=\"editorCollapsed() ? 'Show editor' : 'Hide editor'\"\n (click)=\"toggleCollapse()\"\n >\n <svg class=\"collapse-icon\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\">\n <path\n class=\"cls-1\"\n d=\"M248.93,277.23l-1.72-1.44-110-110a12.43,12.43,0,0,1,15.86-19l1.72,1.44L256,249.41l101.21-101.2a12.45,12.45,0,0,1,15.86-1.44l1.72,1.44a12.45,12.45,0,0,1,1.44,15.86l-1.44,1.72-110,110A12.45,12.45,0,0,1,248.93,277.23Z\"\n />\n <path\n class=\"cls-1\"\n d=\"M248.93,365.23l-1.72-1.44-88-88a12.43,12.43,0,0,1,15.86-19l1.72,1.44L256,337.41l79.21-79.2a12.45,12.45,0,0,1,15.86-1.44l1.72,1.44a12.45,12.45,0,0,1,1.44,15.86l-1.44,1.72-88,88A12.45,12.45,0,0,1,248.93,365.23Z\"\n />\n </svg>\n </button>\n </div>\n }\n </div>\n\n @if (allowFullscreen && !isFullscreen()) {\n <div class=\"buttons\">\n @if (webcomponents && showEditor() && frameworks.size > 1) {\n <select\n aria-label=\"Select framework\"\n class=\"btn-command locale-selection\"\n [ngModel]=\"state.framework()\"\n (ngModelChange)=\"changeFramework($event)\"\n >\n @for (aFramework of frameworks | keyvalue; track $index) {\n <option [value]=\"aFramework.value\" [selected]=\"state.framework() === aFramework.value\">\n {{ aFramework.key }}\n </option>\n }\n </select>\n }\n @if (rootFontSizes.length) {\n <select\n name=\"selectRfs\"\n aria-label=\"Root font size\"\n title=\"Root font size\"\n class=\"btn-command rfs-selection\"\n [ngModel]=\"state.rootFontSize()\"\n (ngModelChange)=\"rfsSelectionChanges($event)\"\n >\n <option value=\"0\">none</option>\n <option value=\"initial\">initial</option>\n @for (rfs of rootFontSizes; track rfs) {\n <option [value]=\"rfs\">{{ rfs }}px</option>\n }\n </select>\n }\n @if (!!localeApi && showEditor()) {\n <select\n name=\"selectLocale\"\n aria-label=\"Select locale\"\n title=\"Locale\"\n class=\"btn-command locale-selection\"\n (change)=\"localeSelectionChanged($event.target)\"\n >\n @for (aLocale of availableLocales; track $index) {\n <option [value]=\"aLocale\" [selected]=\"state.locale() === aLocale\">\n {{ aLocale }}\n </option>\n }\n </select>\n }\n @if (rtlSwitcher) {\n <button\n type=\"button\"\n class=\"btn-command rtl-selection\"\n [title]=\"state.isRTL() ? 'Right-to-left layout' : 'Left-to-right layout'\"\n [attr.aria-label]=\"\n state.isRTL() ? 'RTL (right-to-left layout)' : 'LTR (left-to-right layout)'\n \"\n (click)=\"toggleRTL()\"\n >\n {{ state.isRTL() ? 'RTL' : 'LTR' }}\n </button>\n }\n @if (\n !isMobile &&\n !showEditor() &&\n (state.renderingError() || (state.logMessages().length && state.newMessages()))\n ) {\n <button\n type=\"button\"\n class=\"btn-command\"\n title=\"Show console\"\n aria-label=\"Show console\"\n [class.alert]=\"state.renderingError()\"\n [class.info]=\"state.logMessages().length\"\n (click)=\"toggleCollapse()\"\n >\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\">\n <path\n d=\"M255.84,296a12,12,0,0,1-12-12V124a12,12,0,1,1,24,0V284A12,12,0,0,1,255.84,296Z\"\n />\n <path d=\"M256.12,387.81h-.24a16,16,0,0,1,0-32h.24a16,16,0,0,1,0,32Z\" />\n </svg>\n </button>\n }\n @if (switcherEnabled && !isMobile) {\n <button\n type=\"button\"\n class=\"btn-command\"\n title=\"Toggle theme\"\n aria-label=\"Toggle theme\"\n (click)=\"toggleTheme()\"\n >\n @if (state.theme() === 'dark') {\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\">\n <path\n d=\"M256,349.82A93.82,93.82,0,1,0,162.18,256,93.93,93.93,0,0,0,256,349.82Zm0-163.64A69.82,69.82,0,1,1,186.18,256,69.9,69.9,0,0,1,256,186.18Z\"\n />\n <path\n d=\"M256,120.73a12,12,0,0,0,12-12V76a12,12,0,0,0-24,0v32.73A12,12,0,0,0,256,120.73Z\"\n />\n <path d=\"M268,436V403.27a12,12,0,0,0-24,0V436a12,12,0,0,0,24,0Z\" />\n <path d=\"M143.44,160.41a12,12,0,1,0,17-17l-23.23-23.23a12,12,0,1,0-17,17Z\" />\n <path\n d=\"M351.59,351.59a12,12,0,0,0,0,17l23.23,23.23a12,12,0,0,0,17-17l-23.23-23.23A12,12,0,0,0,351.59,351.59Z\"\n />\n <path\n d=\"M120.73,256a12,12,0,0,0-12-12H76a12,12,0,0,0,0,24h32.73A12,12,0,0,0,120.73,256Z\"\n />\n <path d=\"M436,244H403.27a12,12,0,0,0,0,24H436a12,12,0,0,0,0-24Z\" />\n <path\n d=\"M137.18,391.79l23.23-23.23a12,12,0,1,0-17-17l-23.23,23.23a12,12,0,1,0,17,17Z\"\n />\n <path\n d=\"M360.07,163.93a12,12,0,0,0,8.49-3.52l23.23-23.23a12,12,0,1,0-17-17l-23.23,23.23a12,12,0,0,0,8.48,20.49Z\"\n />\n </svg>\n } @else {\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\">\n <path\n d=\"M360.07,147.88a12,12,0,0,0,5.89-21.1,168.05,168.05,0,0,0-214.71,0C80,186,70.19,292.1,129.38,363.35a166.9,166.9,0,0,0,113.77,59.93q7.9.74,15.75.73A166.74,166.74,0,0,0,366,385.22a12,12,0,0,0-5.89-21.1,109.33,109.33,0,0,1,0-216.24ZM244.43,275.77A133.48,133.48,0,0,0,330,381.08,144.11,144.11,0,0,1,147.84,348C97.1,287,105.51,196,166.58,145.24A144.08,144.08,0,0,1,330,130.94C272,152.38,234.91,212.29,244.43,275.77Z\"\n />\n </svg>\n }\n </button>\n }\n @if (!isMobile && showEditor()) {\n <button\n type=\"button\"\n class=\"btn-command\"\n title=\"Example fullscreen\"\n aria-label=\"Example fullscreen\"\n (click)=\"toggleFullscreen(true)\"\n >\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\">\n <path\n d=\"M406,112H106a42,42,0,0,0-42,42V358a42,42,0,0,0,42,42H406a42,42,0,0,0,42-42V154A42,42,0,0,0,406,112Zm18,246a18,18,0,0,1-18,18H106a18,18,0,0,1-18-18V154a18,18,0,0,1,18-18H406a18,18,0,0,1,18,18Z\"\n />\n </svg>\n </button>\n }\n @if (showEditor()) {\n <button\n type=\"button\"\n class=\"btn-command\"\n title=\"Editor + Example fullscreen\"\n aria-label=\"Editor + Example fullscreen\"\n (click)=\"toggleFullscreen()\"\n >\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\">\n <path\n d=\"M406,112H106a42,42,0,0,0-42,42V358a42,42,0,0,0,42,42H406a42,42,0,0,0,42-42V154A42,42,0,0,0,406,112Zm18,42V313.44H199.35V136H406A18,18,0,0,1,424,154ZM88,358V154a18,18,0,0,1,18-18h69.35V376H106A18,18,0,0,1,88,358Zm318,18H199.35V337.44H424V358A18,18,0,0,1,406,376Z\"\n />\n </svg>\n </button>\n }\n <button\n siStackblitz\n class=\"btn-command\"\n type=\"button\"\n [baseUrl]=\"baseUrl\"\n [framework]=\"state.framework()\"\n [example]=\"state.example()\"\n >\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\">\n <path\n d=\"M182.32 480.02c-3.65 0-7.34-1.01-10.68-3.09-8.61-5.36-11.86-15.98-7.72-25.24s65.44-146.6 65.44-146.6c.58-1.29.19-2.34-.23-3-.42-.65-1.23-1.43-2.64-1.43h-54.96c-13.79 0-25.98-7.76-31.83-20.24s-4-26.82 4.83-37.41L314.3 39.26c6.5-7.79 17.46-9.55 26.06-4.19 8.61 5.36 11.85 15.98 7.72 25.24l-65.44 146.6c-.58 1.29-.19 2.34.23 3 .42.65 1.23 1.43 2.64 1.43h54.96c13.79 0 25.98 7.76 31.83 20.24s4 26.82-4.83 37.41L197.69 472.73c-3.97 4.77-9.62 7.28-15.38 7.28Zm101.45-354.13L169.1 263.49c-.85 1.02-1 2.15-.43 3.35.56 1.2 1.52 1.81 2.85 1.81h54.96c11.96 0 22.98 5.99 29.49 16.02s7.48 22.54 2.61 33.46l-30.35 67.98 114.67-137.6c.85-1.02 1-2.15.43-3.35s-1.52-1.81-2.85-1.81h-54.96c-11.96 0-22.98-5.99-29.49-16.02s-7.48-22.54-2.61-33.46l30.35-67.99Z\"\n />\n </svg>\n </button>\n </div>\n }\n <div class=\"tab-content\" [class.is-mobile]=\"isMobile\">\n <fieldset\n class=\"tab-pane\"\n [class.tab-active]=\"active === 'template'\"\n [class.is-mobile]=\"isMobile\"\n [disabled]=\"editorCollapsed()\"\n >\n <div class=\"buttons\" [class.show-copied]=\"showCopied()\">\n @if (!isMobile) {\n <button\n type=\"button\"\n class=\"btn-command\"\n title=\"Open in new tab\"\n aria-label=\"Open in new tab\"\n (click)=\"openTab()\"\n >\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\">\n <path\n d=\"M344.94 150.78l46.12 38L345 226.94v-25.38l-24.19.19c-19.93.16-43.45 1.35-66.84 9a132.91 132.91 0 00-20.6 8.6c1.13-1.56 2.32-3.11 3.57-4.63 13.37-16.27 39-36.14 85.18-38.4l22.83-1.11v-24.43M329.09 109a8.33 8.33 0 00-3.48.77 8.14 8.14 0 00-4.67 7.38v35.15c-54.9 2.69-86 27-102.55 47.14-21.1 25.69-28.56 55.84-28.51 75.48a8.1 8.1 0 006 7.83 7.68 7.68 0 002.1.28 8.13 8.13 0 007.1-4.13c12.67-22.33 31.08-37.18 56.29-45.38 19.82-6.45 40.3-7.62 59.61-7.78v34.91a8 8 0 004.66 7.37 7.84 7.84 0 003.46.79 8.26 8.26 0 005.16-1.85l86.92-72a8.06 8.06 0 002.93-6.26 8.17 8.17 0 00-3-6.25l-86.9-71.66a8.11 8.11 0 00-5.15-1.84z\"\n />\n <path\n d=\"M397.23 399.39H114.94a26.89 26.89 0 01-26.86-26.86V204.26a26.89 26.89 0 0126.86-26.86h70.49a12 12 0 010 24h-70.49a2.9 2.9 0 00-2.86 2.86v168.27a2.9 2.9 0 002.86 2.86h282.29a2.9 2.9 0 002.85-2.86V253.67a12 12 0 0124 0v118.86a26.88 26.88 0 01-26.85 26.86z\"\n />\n </svg>\n </button>\n }\n @if (allowCopy) {\n <button\n type=\"button\"\n class=\"btn-command\"\n title=\"Copy template as URL\"\n aria-label=\"Copy template as URL\"\n (click)=\"createLink()\"\n >\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\">\n <path\n d=\"M333.56,88.16a90,90,0,0,0-62.83,25.39l-.13.12-27,26.82a12,12,0,0,0,16.92,17l26.92-26.76a66.44,66.44,0,0,1,94,93.94l-47,47a67.6,67.6,0,0,1-7.19,6.23,66.44,66.44,0,0,1-93-13.41A12,12,0,0,0,215,278.88a89.88,89.88,0,0,0,59.52,35.34,91.93,91.93,0,0,0,13.1.94,89.77,89.77,0,0,0,54-18,90.87,90.87,0,0,0,9.79-8.48l47.07-47.07.14-.15A90.44,90.44,0,0,0,333.56,88.16Z\"\n />\n <path\n d=\"M251.28,354.51l-26.75,26.75a66.44,66.44,0,0,1-93.95-93.95l47-47a68.76,68.76,0,0,1,7.19-6.23,66.53,66.53,0,0,1,93,13.41A12,12,0,0,0,297,233.12a90.5,90.5,0,0,0-136.39-9.77l-47.06,47.07-.15.15A90.44,90.44,0,0,0,241.28,398.45a.93.93,0,0,0,.14-.14l26.83-26.83a12,12,0,0,0-17-17Z\"\n />\n </svg>\n </button>\n }\n @if (allowCopy) {\n <button\n type=\"button\"\n class=\"btn-command\"\n title=\"Copy template\"\n aria-label=\"Copy template\"\n (click)=\"copyTemplate()\"\n >\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\">\n <path\n d=\"M380.8,197.2H240.4a43.25,43.25,0,0,0-43.2,43.2V380.8A43.25,43.25,0,0,0,240.4,424H380.8A43.25,43.25,0,0,0,424,380.8V240.4A43.25,43.25,0,0,0,380.8,197.2ZM400,380.8A19.22,19.22,0,0,1,380.8,400H240.4a19.22,19.22,0,0,1-19.2-19.2V240.4a19.22,19.22,0,0,1,19.2-19.2H380.8A19.22,19.22,0,0,1,400,240.4Z\"\n />\n <path\n d=\"M146.8,290.8H131.2A19.22,19.22,0,0,1,112,271.6V131.2A19.22,19.22,0,0,1,131.2,112H271.6a19.22,19.22,0,0,1,19.2,19.2v15.6a12,12,0,0,0,24,0V131.2A43.25,43.25,0,0,0,271.6,88H131.2A43.25,43.25,0,0,0,88,131.2V271.6a43.25,43.25,0,0,0,43.2,43.2h15.6a12,12,0,0,0,0-24Z\"\n />\n </svg>\n </button>\n }\n <div class=\"copied\" role=\"tooltip\">copied</div>\n </div>\n <div #codeTemplate class=\"codeflask-editor\"></div>\n </fieldset>\n <fieldset\n class=\"tab-pane\"\n [class.tab-active]=\"active === 'typescript'\"\n [class.is-mobile]=\"isMobile\"\n [disabled]=\"editorCollapsed()\"\n >\n <div class=\"buttons\" [class.show-copied]=\"showCopied()\">\n <span class=\"readonly-label\">read-only</span>\n @if (allowCopy) {\n <button\n type=\"button\"\n class=\"btn-command\"\n title=\"Copy code\"\n aria-label=\"Copy code\"\n (click)=\"copyCode()\"\n >\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\">\n <path\n d=\"M380.8,197.2H240.4a43.25,43.25,0,0,0-43.2,43.2V380.8A43.25,43.25,0,0,0,240.4,424H380.8A43.25,43.25,0,0,0,424,380.8V240.4A43.25,43.25,0,0,0,380.8,197.2ZM400,380.8A19.22,19.22,0,0,1,380.8,400H240.4a19.22,19.22,0,0,1-19.2-19.2V240.4a19.22,19.22,0,0,1,19.2-19.2H380.8A19.22,19.22,0,0,1,400,240.4Z\"\n />\n <path\n d=\"M146.8,290.8H131.2A19.22,19.22,0,0,1,112,271.6V131.2A19.22,19.22,0,0,1,131.2,112H271.6a19.22,19.22,0,0,1,19.2,19.2v15.6a12,12,0,0,0,24,0V131.2A43.25,43.25,0,0,0,271.6,88H131.2A43.25,43.25,0,0,0,88,131.2V271.6a43.25,43.25,0,0,0,43.2,43.2h15.6a12,12,0,0,0,0-24Z\"\n />\n </svg>\n </button>\n }\n <div class=\"copied\" role=\"tooltip\">copied</div>\n </div>\n <fieldset #codeTypescript class=\"codeflask-editor readonly\"></fieldset>\n </fieldset>\n <fieldset\n class=\"tab-pane\"\n [class.tab-active]=\"active === 'react' || active === 'vue' || active === 'js'\"\n [class.is-mobile]=\"isMobile\"\n [disabled]=\"editorCollapsed()\"\n >\n <div class=\"buttons\" [class.show-copied]=\"showCopied()\">\n @if (allowCopy) {\n <button\n type=\"button\"\n class=\"btn-command\"\n title=\"Copy template as URL\"\n aria-label=\"Copy template as URL\"\n (click)=\"createLink()\"\n >\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\">\n <path\n d=\"M333.56,88.16a90,90,0,0,0-62.83,25.39l-.13.12-27,26.82a12,12,0,0,0,16.92,17l26.92-26.76a66.44,66.44,0,0,1,94,93.94l-47,47a67.6,67.6,0,0,1-7.19,6.23,66.44,66.44,0,0,1-93-13.41A12,12,0,0,0,215,278.88a89.88,89.88,0,0,0,59.52,35.34,91.93,91.93,0,0,0,13.1.94,89.77,89.77,0,0,0,54-18,90.87,90.87,0,0,0,9.79-8.48l47.07-47.07.14-.15A90.44,90.44,0,0,0,333.56,88.16Z\"\n />\n <path\n d=\"M251.28,354.51l-26.75,26.75a66.44,66.44,0,0,1-93.95-93.95l47-47a68.76,68.76,0,0,1,7.19-6.23,66.53,66.53,0,0,1,93,13.41A12,12,0,0,0,297,233.12a90.5,90.5,0,0,0-136.39-9.77l-47.06,47.07-.15.15A90.44,90.44,0,0,0,241.28,398.45a.93.93,0,0,0,.14-.14l26.83-26.83a12,12,0,0,0-17-17Z\"\n />\n </svg>\n </button>\n }\n @if (allowCopy) {\n <button\n type=\"button\"\n class=\"btn-command\"\n title=\"Copy code\"\n aria-label=\"Copy code\"\n (click)=\"copyCode()\"\n >\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\">\n <path\n d=\"M380.8,197.2H240.4a43.25,43.25,0,0,0-43.2,43.2V380.8A43.25,43.25,0,0,0,240.4,424H380.8A43.25,43.25,0,0,0,424,380.8V240.4A43.25,43.25,0,0,0,380.8,197.2ZM400,380.8A19.22,19.22,0,0,1,380.8,400H240.4a19.22,19.22,0,0,1-19.2-19.2V240.4a19.22,19.22,0,0,1,19.2-19.2H380.8A19.22,19.22,0,0,1,400,240.4Z\"\n />\n <path\n d=\"M146.8,290.8H131.2A19.22,19.22,0,0,1,112,271.6V131.2A19.22,19.22,0,0,1,131.2,112H271.6a19.22,19.22,0,0,1,19.2,19.2v15.6a12,12,0,0,0,24,0V131.2A43.25,43.25,0,0,0,271.6,88H131.2A43.25,43.25,0,0,0,88,131.2V271.6a43.25,43.25,0,0,0,43.2,43.2h15.6a12,12,0,0,0,0-24Z\"\n />\n </svg>\n </button>\n }\n <div class=\"copied\" role=\"tooltip\">copied</div>\n </div>\n <label for=\"reactVueEditor\">React and Vue code editor</label>\n <fieldset #codeReactVue class=\"codeflask-editor\"></fieldset>\n </fieldset>\n <div class=\"console\" [hidden]=\"!state.renderingError() && !state.logMessages().length\">\n <div class=\"buttons\">\n @if (state.logMessages().length) {\n <button\n type=\"button\"\n class=\"btn-command btn-clear\"\n title=\"Clear log\"\n aria-label=\"Clear log\"\n [class.on-danger]=\"state.renderingError()\"\n (click)=\"logClear()\"\n >\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\">\n <path\n d=\"M400,144H328V132a44.05,44.05,0,0,0-44-44H228a44.05,44.05,0,0,0-44,44v12H112a12,12,0,0,0,0,24h20V380a44.05,44.05,0,0,0,44,44H336a44.05,44.05,0,0,0,44-44V168h20a12,12,0,0,0,0-24ZM208,132a20,20,0,0,1,20-20h56a20,20,0,0,1,20,20v12H208ZM356,380a20,20,0,0,1-20,20H176a20,20,0,0,1-20-20V168H356Z\"\n />\n <path d=\"M224,344a12,12,0,0,0,12-12V236a12,12,0,0,0-24,0v96A12,12,0,0,0,224,344Z\" />\n <path d=\"M288,344a12,12,0,0,0,12-12V236a12,12,0,0,0-24,0v96A12,12,0,0,0,288,344Z\" />\n </svg>\n </button>\n }\n </div>\n <div #consoleContainer class=\"scroller\">\n @if (state.renderingError()) {\n <pre class=\"alert-danger\"><code class=\"bg-none\">{{ renderingErrorMessage() }}</code></pre>\n }\n @if (!state.renderingError() && state.logMessages().length) {\n <ul>\n @for (msg of state.logMessages(); track $index) {\n <li>{{ msg }}</li>\n }\n </ul>\n }\n </div>\n </div>\n </div>\n</div>\n", styles: [".lp-tabs{display:flex;flex-wrap:wrap;padding-inline-start:0;margin:0;list-style:none;background:none;inline-size:inherit;font-weight:700}.lp-tabs .tab-item:focus-visible{outline-offset:calc(-1 * var(--si-sys-sizing-focus-ring-width, 2px))}.lp-tabs .tab-item.tab-active.tab-link{color:var(--si-sys-color-text-accent);border-block-end-color:var(--si-sys-color-text-accent)!important}.lp-tabs .tab-item.tab-active.tab-link:hover{color:var(--si-sys-color-text-accent-hover)}.lp-tabs .tab-item.tab-link{font:inherit;background:none;min-inline-size:150px;display:block;padding-block:8px;padding-inline:15px;cursor:pointer;text-align:start;line-height:20px;color:var(--si-sys-color-text-primary);border:0;border-block-end:4px solid transparent}.lp-tabs .tab-item.tab-link:hover{text-decoration:none;color:var(--si-sys-color-text-accent-hover);border-block-end-color:var(--si-sys-color-border-4)}*:focus-visible{outline:var(--si-sys-sizing-focus-ring-width, 2px) solid var(--si-sys-color-effects-focus);outline-offset:var(--si-sys-sizing-focus-ring-offset, 1px)}:host{flex:1 1 auto;display:flex;flex-direction:column;overflow:hidden}:host.is-mobile{flex-direction:row}:host.editor-fullscreen{inline-size:100%}:host.editor-fullscreen ::ng-deep .ticket-links{position:absolute;inset-inline-end:48px;inset-block-start:13px}[hidden]{display:none!important}.example{flex:1 1 auto;background:var(--si-sys-color-background-0);margin:0;position:relative;display:flex;flex-direction:column}.example.is-mobile{order:2;flex:unset}.example.fullscreen{padding:0;block-size:100%;inline-size:100%}.example.fullscreen:after{content:unset}.example .btn-command{padding-block:4px;padding-inline:10px}.example .buttons{inset-inline-end:0}.preview-iframe{display:flex;flex:1}.preview-iframe.is-mobile{flex:1 0 0;min-block-size:0;overflow-y:auto;overflow-x:hidden;padding-block:0;padding-inline:30px;flex-direction:column}.collapse-wrapper{display:flex;min-block-size:40px}.lp-tabs{justify-content:flex-start;inline-size:100%;border-block-end:0}.collapse-button{display:flex;justify-content:flex-start;align-items:center;inline-size:100%}.collapse-button button{background-color:transparent;border:0;padding:6px;margin-inline-start:-16px;block-size:34px}.collapse-button button>svg{block-size:20px;fill:var(--si-sys-color-text-primary)}.collapse-button button:hover,.collapse-button button:focus,.collapse-button button:active{color:var(--si-sys-color-text-accent-hover)}.collapse-button button:hover>svg,.collapse-button button:focus>svg,.collapse-button button:active>svg{fill:currentColor}.code{position:relative;background-color:var(--si-sys-color-background-0);max-block-size:414px;transition:max-block-size .5s}.code:not(.is-mobile){border-block-start:1px solid var(--si-sys-color-border-4)}.code.is-collapsed{max-block-size:41px;overflow:hidden;background-color:var(--si-sys-color-background-0)}.code.is-collapsed .collapse-icon{transform:rotate(180deg)}.code .console{block-size:68px;position:relative;border-block-start:1px solid var(--si-sys-color-border-4);color:var(--si-sys-color-text-primary)}.code .console .scroller{block-size:100%;overflow:auto;position:absolute;inset:0}.code .console pre{block-size:100%;border:0;margin:0;overflow:auto}.code .console pre.alert-danger{color:var(--si-sys-color-text-on-danger);background-color:var(--si-sys-color-background-danger)}.code .console code.bg-none{background:none}.code .console ul{list-style:none;margin:0;padding:5px;font-family:Menlo,Ubuntu Mono,Liberation Mono,Consolas,Courier,monospace}.code .console .btn-clear.on-danger,.code .console .btn-clear.on-danger:hover,.code .console .btn-clear.on-danger:focus,.code .console .btn-clear.on-danger:active{color:var(--si-sys-color-text-on-danger)}.code.is-mobile{order:1;flex:1;display:flex;flex-direction:column;max-block-size:unset;transition:unset}.code.is-mobile .console{border-inline-end:1px solid var(--si-sys-color-border-4)}pre{border-radius:0}.tab-content{display:flex;flex-direction:column}.tab-content.is-mobile{border-inline-end:1px solid var(--si-sys-color-border-4);flex:1}.tab-content:not(.is-mobile){block-size:305px}.tab-pane{flex:1;display:none;position:relative}.tab-pane.tab-active{display:flex;flex-direction:column}fieldset{padding:0;margin:0;border:0}.buttons{position:absolute;z-index:2;inset-inline-end:16px;display:flex;align-items:center;inset-block-start:0;block-size:40px}.is-mobile .buttons{inset-inline-end:0}.btn-command{background-color:transparent;border:0;color:var(--si-sys-color-text-primary);padding:8px;font-size:20px;line-height:1;block-size:34px}.btn-command>svg{block-size:20px;fill:currentColor;vertical-align:unset!important}.btn-command:hover,.btn-command:focus,.btn-command:active{color:var(--si-sys-color-text-accent-hover)}.btn-command.fullscreen{font-size:30px;padding:4px}.btn-command.alert svg,.btn-command.info svg{border-radius:50%;fill:currentColor}.btn-command.alert svg{background-color:var(--si-sys-color-background-danger);color:var(--si-sys-color-text-on-danger)}.btn-command.info svg{background-color:var(--si-sys-color-background-accent-secondary);color:var(--si-sys-color-text-accent)}.rtl-selection,.rfs-selection,.locale-selection{font-size:14px}.copied,.readonly-label{font-size:12px;padding-block:2px;padding-inline:5px;border-radius:3px}.copied{display:none;color:var(--si-sys-color-background-0);background:var(--si-sys-color-text-primary);margin-inline-end:10px;margin-block-start:12px}.show-copied .copied{display:block!important}.readonly-label{color:var(--si-sys-color-text-primary);border:1px solid var(--si-sys-color-text-primary)}.show-copied>*{display:none}.codeflask-editor{flex:1;position:relative;border-block-start:1px solid var(--si-sys-color-border-4)}.codeflask-editor ::ng-deep textarea{box-shadow:none}:host(.embedded:not(.editor-fullscreen):not(.is-mobile)) .example{flex:0 0 var(--preview-height, 204px);min-block-size:0;overflow:hidden}.progress-container{position:absolute;inset:0;pointer-events:none}.progress-container,.progress-container .progress-inner{display:flex;justify-content:center;align-items:center}.progress-container .progress-inner{inline-size:64px;block-size:40px;background:#fffc;border:1px solid #ddd;border-radius:12px}.progress-dots:before,.progress-dots:after,.progress-dots{inline-size:10px;block-size:10px;border-radius:50%;background-color:#ddd;animation:dot-flashing .6s infinite linear alternate}.progress-dots{position:relative;animation-delay:.3s}.progress-dots:before,.progress-dots:after{content:\"\";display:inline-block;position:absolute;inset-block-start:0}.progress-dots:before{inset-inline-start:-15px;animation-delay:0s}.progress-dots:after{inset-inline-start:15px;animation-delay:.6s}@keyframes dot-flashing{0%{background-color:#333}50%,to{background-color:#ddd}}\n", ":host ::ng-deep .readonly .codeflask{background-color:var(--si-sys-color-background-1)}:host ::ng-deep .codeflask{background-color:var(--si-sys-color-background-1)}:host ::ng-deep .codeflask pre,:host ::ng-deep .codeflask code{color:var(--si-sys-color-code-1);background:none;border:0;border-radius:0;text-align:start;white-space:pre;word-spacing:normal;word-break:normal;word-wrap:normal;tab-size:2;hyphens:none}:host ::ng-deep .codeflask code{padding:0}:host ::ng-deep .codeflask .codeflask__flatten,:host ::ng-deep .codeflask .codeflask__code{font-family:Menlo,Ubuntu Mono,Liberation Mono,Consolas,Courier,monospace;line-height:20px}:host ::ng-deep .codeflask .codeflask__flatten{min-inline-size:calc(100% - 40px);inline-size:auto}:host ::ng-deep .codeflask .codeflask__pre{z-index:0}:host ::ng-deep .codeflask .codeflask__textarea{z-index:1;color:transparent;caret-color:var(--si-sys-color-code-1)}:host ::ng-deep .codeflask.codeflask--has-line-numbers:before{background:var(--si-sys-color-background-0)}:host ::ng-deep .codeflask__lines{color:var(--si-sys-color-text-disabled)}:host ::ng-deep .namespace{opacity:.7}:host ::ng-deep .token.comment,:host ::ng-deep .token.prolog,:host ::ng-deep .token.doctype,:host ::ng-deep .token.cdata{color:var(--si-sys-color-code-8);font-style:italic}:host ::ng-deep .token.punctuation{color:var(--si-sys-color-code-9)}:host ::ng-deep .token.keyword,:host ::ng-deep .token.operator,:host ::ng-deep .token.boolean,:host ::ng-deep .token.symbol{color:var(--si-sys-color-code-2)}:host ::ng-deep .token.constant{color:var(--si-sys-color-code-3)}:host ::ng-deep .token.builtin{color:var(--si-sys-color-code-5)}:host ::ng-deep .token.property{color:var(--si-sys-color-code-4)}:host ::ng-deep .token.tag,:host ::ng-deep .token.selector{color:var(--si-sys-color-code-10)}:host ::ng-deep .token.number{color:var(--si-sys-color-code-7)}:host ::ng-deep .token.attr-name{color:var(--si-sys-color-code-3)}:host ::ng-deep .token.attr-value{color:var(--si-sys-color-code-6)}:host ::ng-deep .token.string,:host ::ng-deep .token.char{color:var(--si-sys-color-code-6)}:host ::ng-deep .token.function{color:var(--si-sys-color-code-5)}:host ::ng-deep .token.class-name{color:var(--si-sys-color-code-11)}:host ::ng-deep .token.important,:host ::ng-deep .token.variable{color:var(--si-sys-color-code-4)}:host ::ng-deep .token.regex{color:var(--si-sys-color-code-6)}:host ::ng-deep .token.important,:host ::ng-deep .token.bold{font-weight:600}:host ::ng-deep .token.italic{font-style:italic}:host ::ng-deep .token.entity{cursor:help}:host ::ng-deep .token.inserted{color:var(--si-sys-color-code-12)}:host ::ng-deep .token.deleted{color:var(--si-sys-color-code-11)}\n"] }]
|
|
1120
|
+
}], ctorParameters: () => [], propDecorators: { initialTheme: [{ type: i0.Input, args: [{ isSignal: true, alias: "initialTheme", required: false }] }], templateElem: [{ type: i0.ViewChild, args: ['codeTemplate', { isSignal: true }] }], typescriptElem: [{ type: i0.ViewChild, args: ['codeTypescript', { isSignal: true }] }], reactVueElem: [{ type: i0.ViewChild, args: ['codeReactVue', { isSignal: true }] }], consoleElem: [{ type: i0.ViewChild, args: ['consoleContainer', { isSignal: true }] }] } });
|
|
1121
|
+
|
|
1122
|
+
export { SiLivePreviewComponent };
|
|
1123
|
+
//# sourceMappingURL=siemens-live-preview-si-live-preview.component-BkiFwumB.mjs.map
|