@siemens/live-preview 51.1.0 → 51.3.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.
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject, ChangeDetectorRef, ChangeDetectionStrategy, Component, InjectionToken,
|
|
2
|
+
import { inject, ChangeDetectorRef, ChangeDetectionStrategy, Component, InjectionToken, computed, signal, effect, Service, viewChild, output, input, NgZone, DestroyRef, Directive, ElementRef, untracked, Injectable, ViewContainerRef, Compiler, Injector, afterNextRender, ɵcompileComponent as _compileComponent, ɵresetCompiledComponents as _resetCompiledComponents, inputBinding, NgModule, ErrorHandler, createComponent, makeEnvironmentProviders } from '@angular/core';
|
|
3
3
|
import * as i1$1 from '@angular/router';
|
|
4
|
-
import { ActivatedRoute, Router, RouterLink, RouterLinkActive, RouterModule } from '@angular/router';
|
|
5
|
-
import { KeyValuePipe, AsyncPipe } from '@angular/common';
|
|
4
|
+
import { ActivatedRoute, Router, RouterLink, RouterLinkActive, RouterModule, provideRouter, withDisabledInitialNavigation, withHashLocation } from '@angular/router';
|
|
6
5
|
import * as i1 from '@angular/forms';
|
|
7
6
|
import { FormsModule, UntypedFormControl, ReactiveFormsModule } from '@angular/forms';
|
|
8
|
-
import { Title, ɵDomRendererFactory2 as _DomRendererFactory2, REMOVE_STYLES_ON_COMPONENT_DESTROY } from '@angular/platform-browser';
|
|
9
|
-
import { throttleTime, timeout, retry,
|
|
7
|
+
import { Title, ɵDomRendererFactory2 as _DomRendererFactory2, createApplication, REMOVE_STYLES_ON_COMPONENT_DESTROY } from '@angular/platform-browser';
|
|
8
|
+
import { throttleTime, timeout, retry, debounceTime, distinctUntilChanged } from 'rxjs/operators';
|
|
9
|
+
import { KeyValuePipe, LocationStrategy, Location } from '@angular/common';
|
|
10
10
|
import { httpResource, HttpClient } from '@angular/common/http';
|
|
11
11
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
12
12
|
import CodeFlask from 'codeflask';
|
|
@@ -55,6 +55,214 @@ class SiLivePreviewThemeApi {
|
|
|
55
55
|
class SiLivePreviewLocaleApi {
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
+
/**
|
|
59
|
+
* Copyright (c) Siemens 2016 - 2026
|
|
60
|
+
* SPDX-License-Identifier: MIT
|
|
61
|
+
*/
|
|
62
|
+
class LivePreviewStateService {
|
|
63
|
+
router = inject(Router);
|
|
64
|
+
overviewExample = computed(() => {
|
|
65
|
+
this.router.lastSuccessfulNavigation();
|
|
66
|
+
const route = this.findOverviewRoute(this.router.routerState.root);
|
|
67
|
+
return this.getOverviewExample(route?.snapshot.url ?? []);
|
|
68
|
+
}, /* @ts-ignore */
|
|
69
|
+
...(ngDevMode ? [{ debugName: "overviewExample" }] : /* istanbul ignore next */ []));
|
|
70
|
+
delayedLogClearTimer;
|
|
71
|
+
example = signal('', /* @ts-ignore */
|
|
72
|
+
...(ngDevMode ? [{ debugName: "example" }] : /* istanbul ignore next */ []));
|
|
73
|
+
dataId = signal('', /* @ts-ignore */
|
|
74
|
+
...(ngDevMode ? [{ debugName: "dataId" }] : /* istanbul ignore next */ []));
|
|
75
|
+
template = signal('', /* @ts-ignore */
|
|
76
|
+
...(ngDevMode ? [{ debugName: "template" }] : /* istanbul ignore next */ []));
|
|
77
|
+
templateReact = signal('', /* @ts-ignore */
|
|
78
|
+
...(ngDevMode ? [{ debugName: "templateReact" }] : /* istanbul ignore next */ []));
|
|
79
|
+
templateVue = signal('', /* @ts-ignore */
|
|
80
|
+
...(ngDevMode ? [{ debugName: "templateVue" }] : /* istanbul ignore next */ []));
|
|
81
|
+
templateJs = signal('', /* @ts-ignore */
|
|
82
|
+
...(ngDevMode ? [{ debugName: "templateJs" }] : /* istanbul ignore next */ []));
|
|
83
|
+
originalTemplate = signal('', /* @ts-ignore */
|
|
84
|
+
...(ngDevMode ? [{ debugName: "originalTemplate" }] : /* istanbul ignore next */ []));
|
|
85
|
+
theme = signal('light', /* @ts-ignore */
|
|
86
|
+
...(ngDevMode ? [{ debugName: "theme" }] : /* istanbul ignore next */ []));
|
|
87
|
+
locale = signal(undefined, /* @ts-ignore */
|
|
88
|
+
...(ngDevMode ? [{ debugName: "locale" }] : /* istanbul ignore next */ []));
|
|
89
|
+
isRTL = signal(false, /* @ts-ignore */
|
|
90
|
+
...(ngDevMode ? [{ debugName: "isRTL" }] : /* istanbul ignore next */ []));
|
|
91
|
+
rootFontSize = signal(0, /* @ts-ignore */
|
|
92
|
+
...(ngDevMode ? [{ debugName: "rootFontSize" }] : /* istanbul ignore next */ []));
|
|
93
|
+
framework = signal('angular', /* @ts-ignore */
|
|
94
|
+
...(ngDevMode ? [{ debugName: "framework" }] : /* istanbul ignore next */ []));
|
|
95
|
+
loadReact = signal(false, /* @ts-ignore */
|
|
96
|
+
...(ngDevMode ? [{ debugName: "loadReact" }] : /* istanbul ignore next */ []));
|
|
97
|
+
loadVue = signal(false, /* @ts-ignore */
|
|
98
|
+
...(ngDevMode ? [{ debugName: "loadVue" }] : /* istanbul ignore next */ []));
|
|
99
|
+
loadJs = signal(false, /* @ts-ignore */
|
|
100
|
+
...(ngDevMode ? [{ debugName: "loadJs" }] : /* istanbul ignore next */ []));
|
|
101
|
+
supportsLandscape = signal(false, /* @ts-ignore */
|
|
102
|
+
...(ngDevMode ? [{ debugName: "supportsLandscape" }] : /* istanbul ignore next */ []));
|
|
103
|
+
viewport = signal({ mode: 'ios' }, /* @ts-ignore */
|
|
104
|
+
...(ngDevMode ? [{ debugName: "viewport" }] : /* istanbul ignore next */ []));
|
|
105
|
+
iFrameHeight = signal(undefined, /* @ts-ignore */
|
|
106
|
+
...(ngDevMode ? [{ debugName: "iFrameHeight" }] : /* istanbul ignore next */ []));
|
|
107
|
+
iFrameWidth = signal(undefined, /* @ts-ignore */
|
|
108
|
+
...(ngDevMode ? [{ debugName: "iFrameWidth" }] : /* istanbul ignore next */ []));
|
|
109
|
+
renderingError = signal(undefined, /* @ts-ignore */
|
|
110
|
+
...(ngDevMode ? [{ debugName: "renderingError" }] : /* istanbul ignore next */ []));
|
|
111
|
+
logMessages = signal([], /* @ts-ignore */
|
|
112
|
+
...(ngDevMode ? [{ debugName: "logMessages" }] : /* istanbul ignore next */ []));
|
|
113
|
+
newMessages = signal(false, /* @ts-ignore */
|
|
114
|
+
...(ngDevMode ? [{ debugName: "newMessages" }] : /* istanbul ignore next */ []));
|
|
115
|
+
pendingOperations = signal(0, /* @ts-ignore */
|
|
116
|
+
...(ngDevMode ? [{ debugName: "pendingOperations" }] : /* istanbul ignore next */ []));
|
|
117
|
+
inProgress = computed(() => this.pendingOperations() > 0, /* @ts-ignore */
|
|
118
|
+
...(ngDevMode ? [{ debugName: "inProgress" }] : /* istanbul ignore next */ []));
|
|
119
|
+
templateModified = computed(() => this.originalTemplate() !== this.template(), /* @ts-ignore */
|
|
120
|
+
...(ngDevMode ? [{ debugName: "templateModified" }] : /* istanbul ignore next */ []));
|
|
121
|
+
activeWebComponentTemplate = computed(() => {
|
|
122
|
+
switch (this.framework()) {
|
|
123
|
+
case 'react':
|
|
124
|
+
return this.templateReact();
|
|
125
|
+
case 'vue':
|
|
126
|
+
return this.templateVue();
|
|
127
|
+
case 'js':
|
|
128
|
+
return this.templateJs();
|
|
129
|
+
default:
|
|
130
|
+
return '';
|
|
131
|
+
}
|
|
132
|
+
}, /* @ts-ignore */
|
|
133
|
+
...(ngDevMode ? [{ debugName: "activeWebComponentTemplate" }] : /* istanbul ignore next */ []));
|
|
134
|
+
constructor() {
|
|
135
|
+
effect(() => {
|
|
136
|
+
const example = this.overviewExample();
|
|
137
|
+
if (example !== undefined) {
|
|
138
|
+
this.clearTemplates();
|
|
139
|
+
this.example.set(example);
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
findOverviewRoute(route) {
|
|
144
|
+
if (route.routeConfig?.path === 'overview') {
|
|
145
|
+
let activeRoute = route;
|
|
146
|
+
while (activeRoute.firstChild) {
|
|
147
|
+
activeRoute = activeRoute.firstChild;
|
|
148
|
+
}
|
|
149
|
+
return activeRoute;
|
|
150
|
+
}
|
|
151
|
+
for (const child of route.children) {
|
|
152
|
+
const overviewRoute = this.findOverviewRoute(child);
|
|
153
|
+
if (overviewRoute) {
|
|
154
|
+
return overviewRoute;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
return undefined;
|
|
158
|
+
}
|
|
159
|
+
getOverviewExample(segments) {
|
|
160
|
+
return segments.length ? segments.join('/') : undefined;
|
|
161
|
+
}
|
|
162
|
+
setFramework(framework) {
|
|
163
|
+
this.framework.set(framework);
|
|
164
|
+
this.loadReact.set(framework === 'react');
|
|
165
|
+
this.loadVue.set(framework === 'vue');
|
|
166
|
+
this.loadJs.set(framework === 'js');
|
|
167
|
+
}
|
|
168
|
+
applyRenderRequest(request) {
|
|
169
|
+
this.example.set(request.exampleUrl);
|
|
170
|
+
this.template.set(request.template);
|
|
171
|
+
this.loadReact.set(request.loadReact);
|
|
172
|
+
this.loadVue.set(request.loadVue);
|
|
173
|
+
this.loadJs.set(request.loadJs);
|
|
174
|
+
if (request.loadReact) {
|
|
175
|
+
this.framework.set('react');
|
|
176
|
+
this.templateReact.set(request.reactVueTemplate);
|
|
177
|
+
}
|
|
178
|
+
else if (request.loadVue) {
|
|
179
|
+
this.framework.set('vue');
|
|
180
|
+
this.templateVue.set(request.reactVueTemplate);
|
|
181
|
+
}
|
|
182
|
+
else if (request.loadJs) {
|
|
183
|
+
this.framework.set('js');
|
|
184
|
+
this.templateJs.set(request.reactVueTemplate);
|
|
185
|
+
}
|
|
186
|
+
else {
|
|
187
|
+
this.framework.set('angular');
|
|
188
|
+
}
|
|
189
|
+
this.viewport.set({
|
|
190
|
+
mode: request.mode,
|
|
191
|
+
safeAreaTop: request.safeAreaTop,
|
|
192
|
+
safeAreaBottom: request.safeAreaBottom,
|
|
193
|
+
safeAreaLeft: request.safeAreaLeft,
|
|
194
|
+
safeAreaRight: request.safeAreaRight
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
stopWebComponentLoading() {
|
|
198
|
+
this.loadReact.set(false);
|
|
199
|
+
this.loadVue.set(false);
|
|
200
|
+
this.loadJs.set(false);
|
|
201
|
+
}
|
|
202
|
+
clearTemplates() {
|
|
203
|
+
this.template.set('');
|
|
204
|
+
this.templateReact.set('');
|
|
205
|
+
this.templateVue.set('');
|
|
206
|
+
this.templateJs.set('');
|
|
207
|
+
this.originalTemplate.set('');
|
|
208
|
+
}
|
|
209
|
+
toggleTheme() {
|
|
210
|
+
this.theme.update(theme => (theme === 'dark' ? 'light' : 'dark'));
|
|
211
|
+
}
|
|
212
|
+
setRenderingProgress(inProgress) {
|
|
213
|
+
this.pendingOperations.update(count => Math.max(0, count + (inProgress ? 1 : -1)));
|
|
214
|
+
}
|
|
215
|
+
resetRenderingProgress() {
|
|
216
|
+
this.pendingOperations.set(0);
|
|
217
|
+
}
|
|
218
|
+
addLog(message) {
|
|
219
|
+
if (this.delayedLogClearTimer) {
|
|
220
|
+
clearTimeout(this.delayedLogClearTimer);
|
|
221
|
+
this.delayedLogClearTimer = undefined;
|
|
222
|
+
this.logMessages.set([]);
|
|
223
|
+
}
|
|
224
|
+
this.logMessages.update(messages => [...messages, message]);
|
|
225
|
+
this.newMessages.set(true);
|
|
226
|
+
}
|
|
227
|
+
clearLogs(delayed = false) {
|
|
228
|
+
if (delayed && this.logMessages().length) {
|
|
229
|
+
this.delayedLogClearTimer = setTimeout(() => {
|
|
230
|
+
this.delayedLogClearTimer = undefined;
|
|
231
|
+
this.logMessages.set([]);
|
|
232
|
+
}, 100);
|
|
233
|
+
return;
|
|
234
|
+
}
|
|
235
|
+
this.logMessages.set([]);
|
|
236
|
+
}
|
|
237
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: LivePreviewStateService, deps: [], target: i0.ɵɵFactoryTarget.Service });
|
|
238
|
+
static ɵprov = i0.ɵɵngDeclareService({ minVersion: "22.0.0", version: "22.0.8", ngImport: i0, type: LivePreviewStateService });
|
|
239
|
+
}
|
|
240
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: LivePreviewStateService, decorators: [{
|
|
241
|
+
type: Service
|
|
242
|
+
}], ctorParameters: () => [] });
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* Copyright (c) Siemens 2016 - 2026
|
|
246
|
+
* SPDX-License-Identifier: MIT
|
|
247
|
+
*/
|
|
248
|
+
class SiLivePreviewIframeModeComponent {
|
|
249
|
+
previewIframe = viewChild.required('previewIframe', /* @ts-ignore */
|
|
250
|
+
...(ngDevMode ? [{ debugName: "previewIframe" }] : /* istanbul ignore next */ []));
|
|
251
|
+
iframeChange = output();
|
|
252
|
+
ngAfterViewInit() {
|
|
253
|
+
this.iframeChange.emit(this.previewIframe());
|
|
254
|
+
}
|
|
255
|
+
ngOnDestroy() {
|
|
256
|
+
this.iframeChange.emit(undefined);
|
|
257
|
+
}
|
|
258
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SiLivePreviewIframeModeComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
259
|
+
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 src="#/iframe" title="Example view"></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"] });
|
|
260
|
+
}
|
|
261
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SiLivePreviewIframeModeComponent, decorators: [{
|
|
262
|
+
type: Component,
|
|
263
|
+
args: [{ selector: 'si-live-preview-iframe-mode', template: `<iframe #previewIframe src="#/iframe" title="Example view"></iframe>`, styles: [":host{display:block;flex:1;min-block-size:0}iframe{border:0;display:block;block-size:100%;inline-size:100%}\n"] }]
|
|
264
|
+
}], propDecorators: { previewIframe: [{ type: i0.ViewChild, args: ['previewIframe', { isSignal: true }] }], iframeChange: [{ type: i0.Output, args: ["iframeChange"] }] } });
|
|
265
|
+
|
|
58
266
|
/**
|
|
59
267
|
* Copyright (c) Siemens 2016 - 2026
|
|
60
268
|
* SPDX-License-Identifier: MIT
|
|
@@ -190,84 +398,149 @@ const availableDevices = [
|
|
|
190
398
|
* Copyright (c) Siemens 2016 - 2026
|
|
191
399
|
* SPDX-License-Identifier: MIT
|
|
192
400
|
*/
|
|
193
|
-
class
|
|
194
|
-
previewIframe = viewChild('previewIframe', /* @ts-ignore */
|
|
401
|
+
class SiLivePreviewMobileModeComponent {
|
|
402
|
+
previewIframe = viewChild.required('previewIframe', /* @ts-ignore */
|
|
195
403
|
...(ngDevMode ? [{ debugName: "previewIframe" }] : /* istanbul ignore next */ []));
|
|
196
|
-
baseUrl = input.required(/* @ts-ignore */
|
|
197
|
-
...(ngDevMode ? [{ debugName: "baseUrl" }] : /* istanbul ignore next */ []));
|
|
198
|
-
exampleUrl = input.required(/* @ts-ignore */
|
|
199
|
-
...(ngDevMode ? [{ debugName: "exampleUrl" }] : /* istanbul ignore next */ []));
|
|
200
|
-
template = input.required(/* @ts-ignore */
|
|
201
|
-
...(ngDevMode ? [{ debugName: "template" }] : /* istanbul ignore next */ []));
|
|
202
|
-
ticketLinkBug = input.required(/* @ts-ignore */
|
|
203
|
-
...(ngDevMode ? [{ debugName: "ticketLinkBug" }] : /* istanbul ignore next */ []));
|
|
204
|
-
ticketLinkFeature = input.required(/* @ts-ignore */
|
|
205
|
-
...(ngDevMode ? [{ debugName: "ticketLinkFeature" }] : /* istanbul ignore next */ []));
|
|
206
|
-
isFullscreen = input(false, /* @ts-ignore */
|
|
207
|
-
...(ngDevMode ? [{ debugName: "isFullscreen" }] : /* istanbul ignore next */ []));
|
|
208
|
-
iFrameHeight = input(/* @ts-ignore */
|
|
209
|
-
...(ngDevMode ? [undefined, { debugName: "iFrameHeight" }] : /* istanbul ignore next */ []));
|
|
210
|
-
iFrameWidth = input(/* @ts-ignore */
|
|
211
|
-
...(ngDevMode ? [undefined, { debugName: "iFrameWidth" }] : /* istanbul ignore next */ []));
|
|
212
|
-
theme = model('light', /* @ts-ignore */
|
|
213
|
-
...(ngDevMode ? [{ debugName: "theme" }] : /* istanbul ignore next */ []));
|
|
214
|
-
locale = model(/* @ts-ignore */
|
|
215
|
-
...(ngDevMode ? [undefined, { debugName: "locale" }] : /* istanbul ignore next */ []));
|
|
216
|
-
rootFontSize = input(0, /* @ts-ignore */
|
|
217
|
-
...(ngDevMode ? [{ debugName: "rootFontSize" }] : /* istanbul ignore next */ []));
|
|
218
|
-
isRTL = input(/* @ts-ignore */
|
|
219
|
-
...(ngDevMode ? [undefined, { debugName: "isRTL" }] : /* istanbul ignore next */ []));
|
|
220
|
-
loadReact = input(/* @ts-ignore */
|
|
221
|
-
...(ngDevMode ? [undefined, { debugName: "loadReact" }] : /* istanbul ignore next */ []));
|
|
222
|
-
loadVue = input(/* @ts-ignore */
|
|
223
|
-
...(ngDevMode ? [undefined, { debugName: "loadVue" }] : /* istanbul ignore next */ []));
|
|
224
|
-
loadJs = input(/* @ts-ignore */
|
|
225
|
-
...(ngDevMode ? [undefined, { debugName: "loadJs" }] : /* istanbul ignore next */ []));
|
|
226
|
-
reactVueTemplate = input(/* @ts-ignore */
|
|
227
|
-
...(ngDevMode ? [undefined, { debugName: "reactVueTemplate" }] : /* istanbul ignore next */ []));
|
|
228
|
-
templateFromComponent = output();
|
|
229
|
-
logClear = output();
|
|
230
|
-
logMessage = output();
|
|
231
|
-
logRenderingError = output();
|
|
232
|
-
inProgress = output();
|
|
233
|
-
originalTemplate = '';
|
|
234
|
-
templateModified = false;
|
|
235
|
-
rendererInProgress = false;
|
|
236
404
|
config = inject(SI_LIVE_PREVIEW_CONFIG);
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
destroyRef = inject(DestroyRef);
|
|
240
|
-
cdRef = inject(ChangeDetectorRef);
|
|
241
|
-
isMobile = this.internalConfig.isMobile;
|
|
242
|
-
/** iframe height, seeded from the {@link iFrameHeight} input and mutable in mobile mode. */
|
|
243
|
-
currentIFrameHeight = linkedSignal(() => this.iFrameHeight(), /* @ts-ignore */
|
|
244
|
-
...(ngDevMode ? [{ debugName: "currentIFrameHeight" }] : /* istanbul ignore next */ []));
|
|
245
|
-
/** iframe width, seeded from the {@link iFrameWidth} input and mutable in mobile mode. */
|
|
246
|
-
currentIFrameWidth = linkedSignal(() => this.iFrameWidth(), /* @ts-ignore */
|
|
247
|
-
...(ngDevMode ? [{ debugName: "currentIFrameWidth" }] : /* istanbul ignore next */ []));
|
|
248
|
-
mode = signal('ios', /* @ts-ignore */
|
|
249
|
-
...(ngDevMode ? [{ debugName: "mode" }] : /* istanbul ignore next */ []));
|
|
250
|
-
landscape = signal(false, /* @ts-ignore */
|
|
251
|
-
...(ngDevMode ? [{ debugName: "landscape" }] : /* istanbul ignore next */ []));
|
|
405
|
+
state = inject(LivePreviewStateService);
|
|
406
|
+
iframeChange = output();
|
|
252
407
|
switcherEnabled = this.config.themeSwitcher;
|
|
253
408
|
landscapeEnabled = this.config.landscapeToggle;
|
|
254
|
-
supportsLandscape = signal(false, /* @ts-ignore */
|
|
255
|
-
...(ngDevMode ? [{ debugName: "supportsLandscape" }] : /* istanbul ignore next */ []));
|
|
256
409
|
availableDevices = availableDevices;
|
|
257
410
|
selectedDevice = signal(undefined, /* @ts-ignore */
|
|
258
411
|
...(ngDevMode ? [{ debugName: "selectedDevice" }] : /* istanbul ignore next */ []));
|
|
259
|
-
|
|
260
|
-
...(ngDevMode ? [{ debugName: "
|
|
412
|
+
landscape = signal(false, /* @ts-ignore */
|
|
413
|
+
...(ngDevMode ? [{ debugName: "landscape" }] : /* istanbul ignore next */ []));
|
|
261
414
|
showQrMenu = signal(false, /* @ts-ignore */
|
|
262
415
|
...(ngDevMode ? [{ debugName: "showQrMenu" }] : /* istanbul ignore next */ []));
|
|
263
416
|
plainUrl = signal('', /* @ts-ignore */
|
|
264
417
|
...(ngDevMode ? [{ debugName: "plainUrl" }] : /* istanbul ignore next */ []));
|
|
265
418
|
plainUrlShort = signal('', /* @ts-ignore */
|
|
266
419
|
...(ngDevMode ? [{ debugName: "plainUrlShort" }] : /* istanbul ignore next */ []));
|
|
420
|
+
mode = computed(() => this.selectedDevice()?.mode ?? 'ios', /* @ts-ignore */
|
|
421
|
+
...(ngDevMode ? [{ debugName: "mode" }] : /* istanbul ignore next */ []));
|
|
422
|
+
showNotch = computed(() => this.selectedDevice()?.notch ?? false, /* @ts-ignore */
|
|
423
|
+
...(ngDevMode ? [{ debugName: "showNotch" }] : /* istanbul ignore next */ []));
|
|
424
|
+
currentIFrameHeight = computed(() => {
|
|
425
|
+
const device = this.selectedDevice();
|
|
426
|
+
return device ? (this.landscape() ? device.width : device.height) : this.state.iFrameHeight();
|
|
427
|
+
}, /* @ts-ignore */
|
|
428
|
+
...(ngDevMode ? [{ debugName: "currentIFrameHeight" }] : /* istanbul ignore next */ []));
|
|
429
|
+
currentIFrameWidth = computed(() => {
|
|
430
|
+
const device = this.selectedDevice();
|
|
431
|
+
return device ? (this.landscape() ? device.height : device.width) : this.state.iFrameWidth();
|
|
432
|
+
}, /* @ts-ignore */
|
|
433
|
+
...(ngDevMode ? [{ debugName: "currentIFrameWidth" }] : /* istanbul ignore next */ []));
|
|
434
|
+
constructor() {
|
|
435
|
+
effect(() => {
|
|
436
|
+
if (!this.state.supportsLandscape() && this.landscape()) {
|
|
437
|
+
this.landscape.set(false);
|
|
438
|
+
this.emitViewport();
|
|
439
|
+
}
|
|
440
|
+
});
|
|
441
|
+
}
|
|
442
|
+
ngOnInit() {
|
|
443
|
+
const deviceId = localStorage.getItem('si-live-preview-selected-device');
|
|
444
|
+
this.selectDevice(this.availableDevices.find(device => device.id === deviceId));
|
|
445
|
+
}
|
|
446
|
+
ngAfterViewInit() {
|
|
447
|
+
this.iframeChange.emit(this.previewIframe());
|
|
448
|
+
}
|
|
449
|
+
ngOnDestroy() {
|
|
450
|
+
this.iframeChange.emit(undefined);
|
|
451
|
+
}
|
|
452
|
+
selectDevice(device) {
|
|
453
|
+
const selectedDevice = device ?? this.availableDevices[0];
|
|
454
|
+
this.selectedDevice.set(selectedDevice);
|
|
455
|
+
localStorage.setItem('si-live-preview-selected-device', selectedDevice.id);
|
|
456
|
+
this.emitViewport();
|
|
457
|
+
}
|
|
458
|
+
deviceChanged() {
|
|
459
|
+
this.selectDevice(this.selectedDevice());
|
|
460
|
+
}
|
|
461
|
+
toggleLandscape() {
|
|
462
|
+
this.landscape.update(landscape => !landscape);
|
|
463
|
+
this.emitViewport();
|
|
464
|
+
}
|
|
465
|
+
openQrMenu() {
|
|
466
|
+
this.plainUrl.set(this.createTemplateLink(false));
|
|
467
|
+
this.plainUrlShort.set(this.createTemplateLink(true));
|
|
468
|
+
this.showQrMenu.set(true);
|
|
469
|
+
}
|
|
470
|
+
emitViewport() {
|
|
471
|
+
const device = this.selectedDevice();
|
|
472
|
+
const safeArea = this.landscape() ? device?.safeAreaLandscape : device?.safeAreaPortrait;
|
|
473
|
+
this.state.viewport.set({
|
|
474
|
+
mode: this.mode(),
|
|
475
|
+
safeAreaTop: safeArea?.top,
|
|
476
|
+
safeAreaBottom: safeArea?.bottom,
|
|
477
|
+
safeAreaLeft: safeArea?.left,
|
|
478
|
+
safeAreaRight: safeArea?.right
|
|
479
|
+
});
|
|
480
|
+
}
|
|
481
|
+
createTemplateLink(skipTemplate) {
|
|
482
|
+
let url = `${window.location.protocol}//${window.location.host}`;
|
|
483
|
+
url += window.location.pathname;
|
|
484
|
+
url += '#/viewer/plain?';
|
|
485
|
+
url += 'theme=' + this.state.theme();
|
|
486
|
+
url += '&mode=' + this.mode();
|
|
487
|
+
if (this.state.isRTL()) {
|
|
488
|
+
url += '&isRTL=true';
|
|
489
|
+
}
|
|
490
|
+
const locale = this.state.locale();
|
|
491
|
+
if (locale) {
|
|
492
|
+
url += '&locale=' + locale;
|
|
493
|
+
}
|
|
494
|
+
if (this.state.rootFontSize()) {
|
|
495
|
+
url += '&rfs=' + this.state.rootFontSize();
|
|
496
|
+
}
|
|
497
|
+
if (this.state.templateModified() && !skipTemplate) {
|
|
498
|
+
url += '&t=' + this.encode(this.state.template());
|
|
499
|
+
}
|
|
500
|
+
const exampleUrl = this.state.example();
|
|
501
|
+
if (exampleUrl) {
|
|
502
|
+
url += '&e=' + this.encode(exampleUrl);
|
|
503
|
+
}
|
|
504
|
+
return url;
|
|
505
|
+
}
|
|
506
|
+
encode(value) {
|
|
507
|
+
// Using `+` for spaces produces shorter QR code URLs than `%20`.
|
|
508
|
+
return encodeURIComponent(value).replace(/%20/g, '+');
|
|
509
|
+
}
|
|
510
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SiLivePreviewMobileModeComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
511
|
+
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 src=\"#/iframe\"\n title=\"Mobile example view\"\n [height]=\"currentIFrameHeight()\"\n [width]=\"currentIFrameWidth()\"\n ></iframe>\n </div>\n</div>\n", styles: ["*:focus-visible{outline:var(--element-button-focus-width) solid var(--si-sys-color-effects-focus);outline-offset:var(--element-button-focus-overlay-width)}: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"] }] });
|
|
512
|
+
}
|
|
513
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SiLivePreviewMobileModeComponent, decorators: [{
|
|
514
|
+
type: Component,
|
|
515
|
+
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 src=\"#/iframe\"\n title=\"Mobile example view\"\n [height]=\"currentIFrameHeight()\"\n [width]=\"currentIFrameWidth()\"\n ></iframe>\n </div>\n</div>\n", styles: ["*:focus-visible{outline:var(--element-button-focus-width) solid var(--si-sys-color-effects-focus);outline-offset:var(--element-button-focus-overlay-width)}: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"] }]
|
|
516
|
+
}], ctorParameters: () => [], propDecorators: { previewIframe: [{ type: i0.ViewChild, args: ['previewIframe', { isSignal: true }] }], iframeChange: [{ type: i0.Output, args: ["iframeChange"] }] } });
|
|
517
|
+
|
|
518
|
+
/**
|
|
519
|
+
* Copyright (c) Siemens 2016 - 2026
|
|
520
|
+
* SPDX-License-Identifier: MIT
|
|
521
|
+
*/
|
|
522
|
+
class SiLivePreviewIframeComponent {
|
|
523
|
+
isFullscreen = input(false, /* @ts-ignore */
|
|
524
|
+
...(ngDevMode ? [{ debugName: "isFullscreen" }] : /* istanbul ignore next */ []));
|
|
525
|
+
templateFromComponent = output();
|
|
526
|
+
state = inject(LivePreviewStateService);
|
|
527
|
+
rendererInProgress = false;
|
|
528
|
+
previewIframeRef = signal(undefined, /* @ts-ignore */
|
|
529
|
+
...(ngDevMode ? [{ debugName: "previewIframeRef" }] : /* istanbul ignore next */ []));
|
|
530
|
+
previewIframe = this.previewIframeRef.asReadonly();
|
|
531
|
+
internalConfig = inject(SI_LIVE_PREVIEW_INTERNALS);
|
|
532
|
+
config = inject(SI_LIVE_PREVIEW_CONFIG);
|
|
533
|
+
ngZone = inject(NgZone);
|
|
534
|
+
destroyRef = inject(DestroyRef);
|
|
535
|
+
cdRef = inject(ChangeDetectorRef);
|
|
536
|
+
isMobile = this.internalConfig.isMobile;
|
|
537
|
+
ticketLinkBug = computed(() => `${this.config.ticketBaseUrl}?issue%5Btitle%5D=%3C${this.state.example()}%3E:&issuable_template=Bug`, /* @ts-ignore */
|
|
538
|
+
...(ngDevMode ? [{ debugName: "ticketLinkBug" }] : /* istanbul ignore next */ []));
|
|
539
|
+
ticketLinkFeature = computed(() => `${this.config.ticketBaseUrl}?issue%5Btitle%5D=%3C${this.state.example()}%3E:&issuable_template=Feature Request`, /* @ts-ignore */
|
|
540
|
+
...(ngDevMode ? [{ debugName: "ticketLinkFeature" }] : /* istanbul ignore next */ []));
|
|
267
541
|
constructor() {
|
|
268
542
|
effect(() => {
|
|
269
543
|
// recompute on template changes and re-send whenever any rendered input changes
|
|
270
|
-
this.templateModified = this.originalTemplate !== this.template();
|
|
271
544
|
if (this.previewIframe()) {
|
|
272
545
|
this.sendMessage();
|
|
273
546
|
}
|
|
@@ -280,25 +553,6 @@ class SiLivePreviewIframeComponent {
|
|
|
280
553
|
this.onMessage(message);
|
|
281
554
|
this.cdRef.markForCheck();
|
|
282
555
|
}));
|
|
283
|
-
if (this.isMobile) {
|
|
284
|
-
const deviceId = localStorage.getItem('si-live-preview-selected-device');
|
|
285
|
-
this.selectedDevice.set(this.availableDevices.find(dev => dev.id === deviceId) ?? this.availableDevices[0]);
|
|
286
|
-
this.deviceChanged();
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
deviceChanged() {
|
|
290
|
-
let selectedDevice = this.selectedDevice();
|
|
291
|
-
if (!selectedDevice) {
|
|
292
|
-
selectedDevice = this.availableDevices[0];
|
|
293
|
-
this.selectedDevice.set(selectedDevice);
|
|
294
|
-
}
|
|
295
|
-
const landscape = this.landscape();
|
|
296
|
-
this.currentIFrameHeight.set(landscape ? selectedDevice.width : selectedDevice.height);
|
|
297
|
-
this.currentIFrameWidth.set(landscape ? selectedDevice.height : selectedDevice.width);
|
|
298
|
-
this.showNotch.set(selectedDevice.notch ?? false);
|
|
299
|
-
this.mode.set(selectedDevice.mode);
|
|
300
|
-
localStorage.setItem('si-live-preview-selected-device', selectedDevice.id);
|
|
301
|
-
this.sendMessage();
|
|
302
556
|
}
|
|
303
557
|
onMessage(event) {
|
|
304
558
|
if (event.data?.src !== 'renderer') {
|
|
@@ -312,20 +566,16 @@ class SiLivePreviewIframeComponent {
|
|
|
312
566
|
this.sendMessage();
|
|
313
567
|
break;
|
|
314
568
|
case 'landscapeMode':
|
|
315
|
-
this.supportsLandscape.set(event.data.message);
|
|
316
|
-
if (!this.supportsLandscape() && this.landscape()) {
|
|
317
|
-
this.landscape.set(false);
|
|
318
|
-
this.deviceChanged();
|
|
319
|
-
}
|
|
569
|
+
this.state.supportsLandscape.set(event.data.message);
|
|
320
570
|
break;
|
|
321
571
|
case 'clear':
|
|
322
|
-
this.
|
|
572
|
+
this.state.clearLogs(true);
|
|
323
573
|
break;
|
|
324
574
|
case 'log':
|
|
325
|
-
this.
|
|
575
|
+
this.state.addLog(event.data.message);
|
|
326
576
|
break;
|
|
327
577
|
case 'error':
|
|
328
|
-
this.
|
|
578
|
+
this.state.renderingError.set(event.data.message);
|
|
329
579
|
break;
|
|
330
580
|
case 'progress':
|
|
331
581
|
{
|
|
@@ -333,108 +583,59 @@ class SiLivePreviewIframeComponent {
|
|
|
333
583
|
if (progress !== this.rendererInProgress) {
|
|
334
584
|
// only emit changes since live-previewer does counting
|
|
335
585
|
this.rendererInProgress = progress;
|
|
336
|
-
this.
|
|
586
|
+
this.state.setRenderingProgress(progress);
|
|
337
587
|
}
|
|
338
588
|
}
|
|
339
589
|
break;
|
|
340
590
|
case 'templateFromComponent':
|
|
341
|
-
this.originalTemplate
|
|
342
|
-
this.templateModified = false;
|
|
591
|
+
this.state.originalTemplate.set(event.data.message ?? '');
|
|
343
592
|
this.templateFromComponent.emit(event.data.message);
|
|
344
593
|
break;
|
|
345
594
|
case 'theme':
|
|
346
|
-
this.theme.set(event.data.message);
|
|
595
|
+
this.state.theme.set(event.data.message);
|
|
347
596
|
break;
|
|
348
597
|
case 'locale':
|
|
349
|
-
this.locale.set(event.data.message);
|
|
598
|
+
this.state.locale.set(event.data.message);
|
|
350
599
|
break;
|
|
351
600
|
}
|
|
352
601
|
}
|
|
353
602
|
toggleTheme() {
|
|
354
|
-
this.
|
|
355
|
-
this.sendMessage();
|
|
356
|
-
}
|
|
357
|
-
toggleLandscape() {
|
|
358
|
-
const landscape = !this.landscape();
|
|
359
|
-
this.landscape.set(landscape);
|
|
360
|
-
const selectedDevice = this.selectedDevice();
|
|
361
|
-
this.currentIFrameHeight.set(landscape ? selectedDevice?.width : selectedDevice?.height);
|
|
362
|
-
this.currentIFrameWidth.set(landscape ? selectedDevice?.height : selectedDevice?.width);
|
|
603
|
+
this.state.toggleTheme();
|
|
363
604
|
this.sendMessage();
|
|
364
605
|
}
|
|
365
|
-
|
|
366
|
-
this.
|
|
367
|
-
this.plainUrlShort.set(this.createTemplateLink('plain', true));
|
|
368
|
-
this.showQrMenu.set(true);
|
|
369
|
-
}
|
|
370
|
-
createTemplateLink(mode, skipTemplate = false) {
|
|
371
|
-
let url = `${window.location.protocol}//${window.location.host}`;
|
|
372
|
-
url += window.location.pathname;
|
|
373
|
-
url += `#/viewer/${mode}?`;
|
|
374
|
-
url += 'theme=' + this.theme();
|
|
375
|
-
url += '&mode=' + this.mode();
|
|
376
|
-
if (this.isRTL()) {
|
|
377
|
-
url += '&isRTL=true';
|
|
378
|
-
}
|
|
379
|
-
const locale = this.locale();
|
|
380
|
-
if (locale) {
|
|
381
|
-
url += '&locale=' + locale;
|
|
382
|
-
}
|
|
383
|
-
if (this.rootFontSize()) {
|
|
384
|
-
url += '&rfs=' + this.rootFontSize();
|
|
385
|
-
}
|
|
386
|
-
if (this.templateModified && !skipTemplate) {
|
|
387
|
-
url += '&t=' + this.encode(this.template());
|
|
388
|
-
}
|
|
389
|
-
const exampleUrl = this.exampleUrl();
|
|
390
|
-
if (exampleUrl) {
|
|
391
|
-
url += '&e=' + this.encode(exampleUrl);
|
|
392
|
-
}
|
|
393
|
-
return url;
|
|
394
|
-
}
|
|
395
|
-
encode(value) {
|
|
396
|
-
// using `+` for space is shorter than `%20`
|
|
397
|
-
return encodeURIComponent(value).replace(/%20/g, '+');
|
|
606
|
+
setPreviewIframe(iframe) {
|
|
607
|
+
this.previewIframeRef.set(iframe);
|
|
398
608
|
}
|
|
399
609
|
sendMessage() {
|
|
400
|
-
const
|
|
401
|
-
const selectedDevice = this.selectedDevice();
|
|
610
|
+
const viewport = this.state.viewport();
|
|
402
611
|
this.previewIframe()?.nativeElement.contentWindow.postMessage({
|
|
403
612
|
src: 'editor',
|
|
404
|
-
exampleUrl: this.
|
|
405
|
-
template: this.template(),
|
|
406
|
-
loadReact: this.loadReact(),
|
|
407
|
-
loadVue: this.loadVue(),
|
|
408
|
-
loadJs: this.loadJs(),
|
|
409
|
-
reactVueTemplate: this.
|
|
410
|
-
theme: this.theme(),
|
|
411
|
-
locale: this.locale(),
|
|
412
|
-
rootFontSize: this.rootFontSize(),
|
|
413
|
-
isRTL: this.isRTL(),
|
|
414
|
-
mode:
|
|
415
|
-
safeAreaTop:
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
? selectedDevice?.safeAreaLandscape?.bottom
|
|
420
|
-
: selectedDevice?.safeAreaPortrait?.bottom,
|
|
421
|
-
safeAreaLeft: landscape
|
|
422
|
-
? selectedDevice?.safeAreaLandscape?.left
|
|
423
|
-
: selectedDevice?.safeAreaPortrait?.left,
|
|
424
|
-
safeAreaRight: landscape
|
|
425
|
-
? selectedDevice?.safeAreaLandscape?.right
|
|
426
|
-
: selectedDevice?.safeAreaPortrait?.right
|
|
613
|
+
exampleUrl: this.state.example(),
|
|
614
|
+
template: this.state.template(),
|
|
615
|
+
loadReact: this.state.loadReact(),
|
|
616
|
+
loadVue: this.state.loadVue(),
|
|
617
|
+
loadJs: this.state.loadJs(),
|
|
618
|
+
reactVueTemplate: this.state.activeWebComponentTemplate(),
|
|
619
|
+
theme: this.state.theme(),
|
|
620
|
+
locale: this.state.locale(),
|
|
621
|
+
rootFontSize: this.state.rootFontSize(),
|
|
622
|
+
isRTL: this.state.isRTL(),
|
|
623
|
+
mode: viewport.mode,
|
|
624
|
+
safeAreaTop: viewport.safeAreaTop,
|
|
625
|
+
safeAreaBottom: viewport.safeAreaBottom,
|
|
626
|
+
safeAreaLeft: viewport.safeAreaLeft,
|
|
627
|
+
safeAreaRight: viewport.safeAreaRight
|
|
427
628
|
}, '*');
|
|
428
629
|
}
|
|
429
630
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SiLivePreviewIframeComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
430
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.8", type: SiLivePreviewIframeComponent, isStandalone: true, selector: "si-live-preview-iframe", inputs: { baseUrl: { classPropertyName: "baseUrl", publicName: "baseUrl", isSignal: true, isRequired: true, transformFunction: null }, exampleUrl: { classPropertyName: "exampleUrl", publicName: "exampleUrl", isSignal: true, isRequired: true, transformFunction: null }, template: { classPropertyName: "template", publicName: "template", isSignal: true, isRequired: true, transformFunction: null }, ticketLinkBug: { classPropertyName: "ticketLinkBug", publicName: "ticketLinkBug", isSignal: true, isRequired: true, transformFunction: null }, ticketLinkFeature: { classPropertyName: "ticketLinkFeature", publicName: "ticketLinkFeature", isSignal: true, isRequired: true, transformFunction: null }, isFullscreen: { classPropertyName: "isFullscreen", publicName: "isFullscreen", isSignal: true, isRequired: false, transformFunction: null }, iFrameHeight: { classPropertyName: "iFrameHeight", publicName: "iFrameHeight", isSignal: true, isRequired: false, transformFunction: null }, iFrameWidth: { classPropertyName: "iFrameWidth", publicName: "iFrameWidth", isSignal: true, isRequired: false, transformFunction: null }, theme: { classPropertyName: "theme", publicName: "theme", isSignal: true, isRequired: false, transformFunction: null }, locale: { classPropertyName: "locale", publicName: "locale", isSignal: true, isRequired: false, transformFunction: null }, rootFontSize: { classPropertyName: "rootFontSize", publicName: "rootFontSize", isSignal: true, isRequired: false, transformFunction: null }, isRTL: { classPropertyName: "isRTL", publicName: "isRTL", isSignal: true, isRequired: false, transformFunction: null }, loadReact: { classPropertyName: "loadReact", publicName: "loadReact", isSignal: true, isRequired: false, transformFunction: null }, loadVue: { classPropertyName: "loadVue", publicName: "loadVue", isSignal: true, isRequired: false, transformFunction: null }, loadJs: { classPropertyName: "loadJs", publicName: "loadJs", isSignal: true, isRequired: false, transformFunction: null }, reactVueTemplate: { classPropertyName: "reactVueTemplate", publicName: "reactVueTemplate", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { theme: "themeChange", locale: "localeChange", templateFromComponent: "templateFromComponent", logClear: "logClear", logMessage: "logMessage", logRenderingError: "logRenderingError", inProgress: "inProgress" }, host: { properties: { "class.is-mobile": "isMobile" } }, viewQueries: [{ propertyName: "previewIframe", first: true, predicate: ["previewIframe"], descendants: true, isSignal: true }], ngImport: i0, template: "<section class=\"header-links\">\n <h1 class=\"example-text\">Example: {{ exampleUrl() }}</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 <section class=\"settings-selection\">\n <select class=\"device-selection\" [(ngModel)]=\"selectedDevice\" (ngModelChange)=\"deviceChanged()\">\n @for (device of availableDevices; track $index) {\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 [disabled]=\"!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\n 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 />\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 type=\"button\" title=\"Toggle theme\" (click)=\"toggleTheme()\">\n @if (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 type=\"button\" title=\"Show QR code\" class=\"qr-button\" (click)=\"openQrMenu()\">\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]=\"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]=\"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]=\"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 src=\"#/iframe\"\n [height]=\"currentIFrameHeight()\"\n [width]=\"currentIFrameWidth()\"\n ></iframe>\n </div>\n </div>\n} @else {\n <iframe #previewIframe src=\"#/iframe\" title=\"Example view\"></iframe>\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)}*:focus-visible{outline:var(--element-button-focus-width) solid var(--si-sys-color-effects-focus);outline-offset:var(--element-button-focus-overlay-width)}:host{display:inline-flex;flex-direction:column}:host.is-mobile{margin-block-end:28px}:host:not(.is-mobile){flex:1}iframe{border:0;display:block}:host:not(.is-mobile) iframe{block-size:100%}.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}.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"] }], changeDetection: i0.ChangeDetectionStrategy.Eager });
|
|
631
|
+
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 });
|
|
431
632
|
}
|
|
432
633
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SiLivePreviewIframeComponent, decorators: [{
|
|
433
634
|
type: Component,
|
|
434
|
-
args: [{ selector: 'si-live-preview-iframe', imports: [
|
|
635
|
+
args: [{ selector: 'si-live-preview-iframe', imports: [SiLivePreviewIframeModeComponent, SiLivePreviewMobileModeComponent], changeDetection: ChangeDetectionStrategy.Eager, host: {
|
|
435
636
|
'[class.is-mobile]': 'isMobile'
|
|
436
|
-
}, template: "<section class=\"header-links\">\n <h1 class=\"example-text\">Example: {{ exampleUrl() }}</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 <section class=\"settings-selection\">\n <select class=\"device-selection\" [(ngModel)]=\"selectedDevice\" (ngModelChange)=\"deviceChanged()\">\n @for (device of availableDevices; track $index) {\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 [disabled]=\"!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\n 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 />\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 type=\"button\" title=\"Toggle theme\" (click)=\"toggleTheme()\">\n @if (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 type=\"button\" title=\"Show QR code\" class=\"qr-button\" (click)=\"openQrMenu()\">\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]=\"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]=\"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]=\"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 src=\"#/iframe\"\n [height]=\"currentIFrameHeight()\"\n [width]=\"currentIFrameWidth()\"\n ></iframe>\n </div>\n </div>\n} @else {\n <iframe #previewIframe src=\"#/iframe\" title=\"Example view\"></iframe>\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)}*:focus-visible{outline:var(--element-button-focus-width) solid var(--si-sys-color-effects-focus);outline-offset:var(--element-button-focus-overlay-width)}:host{display:inline-flex;flex-direction:column}:host.is-mobile{margin-block-end:28px}:host:not(.is-mobile){flex:1}iframe{border:0;display:block}:host:not(.is-mobile) iframe{block-size:100%}.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}.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"] }]
|
|
437
|
-
}], ctorParameters: () => [], propDecorators: {
|
|
637
|
+
}, 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"] }]
|
|
638
|
+
}], ctorParameters: () => [], propDecorators: { isFullscreen: [{ type: i0.Input, args: [{ isSignal: true, alias: "isFullscreen", required: false }] }], templateFromComponent: [{ type: i0.Output, args: ["templateFromComponent"] }] } });
|
|
438
639
|
|
|
439
640
|
/**
|
|
440
641
|
* Copyright (c) Siemens 2016 - 2026
|
|
@@ -672,6 +873,7 @@ class SiLivePreviewComponent {
|
|
|
672
873
|
self = inject(ElementRef);
|
|
673
874
|
http = inject(HttpClient);
|
|
674
875
|
localeApi = inject(SiLivePreviewLocaleApi, { optional: true });
|
|
876
|
+
state = inject(LivePreviewStateService);
|
|
675
877
|
templateElem = viewChild.required('codeTemplate', /* @ts-ignore */
|
|
676
878
|
...(ngDevMode ? [{ debugName: "templateElem" }] : /* istanbul ignore next */ []));
|
|
677
879
|
typescriptElem = viewChild.required('codeTypescript', /* @ts-ignore */
|
|
@@ -680,67 +882,29 @@ class SiLivePreviewComponent {
|
|
|
680
882
|
...(ngDevMode ? [{ debugName: "reactVueElem" }] : /* istanbul ignore next */ []));
|
|
681
883
|
consoleElem = viewChild.required('consoleContainer', /* @ts-ignore */
|
|
682
884
|
...(ngDevMode ? [{ debugName: "consoleElem" }] : /* istanbul ignore next */ []));
|
|
683
|
-
baseUrl =
|
|
684
|
-
...(ngDevMode ? [{ debugName: "baseUrl" }] : /* istanbul ignore next */ []));
|
|
685
|
-
example = input(/* @ts-ignore */
|
|
686
|
-
...(ngDevMode ? [undefined, { debugName: "example" }] : /* istanbul ignore next */ []));
|
|
687
|
-
template = model('', /* @ts-ignore */
|
|
688
|
-
...(ngDevMode ? [{ debugName: "template" }] : /* istanbul ignore next */ []));
|
|
689
|
-
theme = model('light', /* @ts-ignore */
|
|
690
|
-
...(ngDevMode ? [{ debugName: "theme" }] : /* istanbul ignore next */ []));
|
|
691
|
-
locale = model(/* @ts-ignore */
|
|
692
|
-
...(ngDevMode ? [undefined, { debugName: "locale" }] : /* istanbul ignore next */ []));
|
|
693
|
-
isRTL = model(false, /* @ts-ignore */
|
|
694
|
-
...(ngDevMode ? [{ debugName: "isRTL" }] : /* istanbul ignore next */ []));
|
|
695
|
-
ticketBaseUrl = input('', /* @ts-ignore */
|
|
696
|
-
...(ngDevMode ? [{ debugName: "ticketBaseUrl" }] : /* istanbul ignore next */ []));
|
|
697
|
-
templateReact = model('', /* @ts-ignore */
|
|
698
|
-
...(ngDevMode ? [{ debugName: "templateReact" }] : /* istanbul ignore next */ []));
|
|
699
|
-
templateVue = model('', /* @ts-ignore */
|
|
700
|
-
...(ngDevMode ? [{ debugName: "templateVue" }] : /* istanbul ignore next */ []));
|
|
701
|
-
templateJs = model('', /* @ts-ignore */
|
|
702
|
-
...(ngDevMode ? [{ debugName: "templateJs" }] : /* istanbul ignore next */ []));
|
|
885
|
+
baseUrl = this.config.examplesBaseUrl;
|
|
703
886
|
isFullscreen = signal(false, /* @ts-ignore */
|
|
704
887
|
...(ngDevMode ? [{ debugName: "isFullscreen" }] : /* istanbul ignore next */ []));
|
|
705
888
|
isMobile = this.internalConfig.isMobile;
|
|
706
889
|
templateTs = '';
|
|
707
|
-
renderingError = signal(null, /* @ts-ignore */
|
|
708
|
-
...(ngDevMode ? [{ debugName: "renderingError" }] : /* istanbul ignore next */ []));
|
|
709
|
-
logMessages = signal([], /* @ts-ignore */
|
|
710
|
-
...(ngDevMode ? [{ debugName: "logMessages" }] : /* istanbul ignore next */ []));
|
|
711
890
|
activeTab = signal('template', /* @ts-ignore */
|
|
712
891
|
...(ngDevMode ? [{ debugName: "activeTab" }] : /* istanbul ignore next */ []));
|
|
713
892
|
showCopied = signal(false, /* @ts-ignore */
|
|
714
893
|
...(ngDevMode ? [{ debugName: "showCopied" }] : /* istanbul ignore next */ []));
|
|
715
|
-
inProgress = signal(false, /* @ts-ignore */
|
|
716
|
-
...(ngDevMode ? [{ debugName: "inProgress" }] : /* istanbul ignore next */ []));
|
|
717
894
|
allowFullscreen = !!document.fullscreenEnabled || !!document.webkitFullscreenEnabled;
|
|
718
895
|
exampleFullscreen = signal(false, /* @ts-ignore */
|
|
719
896
|
...(ngDevMode ? [{ debugName: "exampleFullscreen" }] : /* istanbul ignore next */ []));
|
|
720
897
|
allowCopy = !!navigator.clipboard;
|
|
721
|
-
loadReact = signal(false, /* @ts-ignore */
|
|
722
|
-
...(ngDevMode ? [{ debugName: "loadReact" }] : /* istanbul ignore next */ []));
|
|
723
|
-
loadVue = signal(false, /* @ts-ignore */
|
|
724
|
-
...(ngDevMode ? [{ debugName: "loadVue" }] : /* istanbul ignore next */ []));
|
|
725
|
-
loadJs = signal(false, /* @ts-ignore */
|
|
726
|
-
...(ngDevMode ? [{ debugName: "loadJs" }] : /* istanbul ignore next */ []));
|
|
727
898
|
switcherEnabled = this.config.themeSwitcher;
|
|
728
899
|
rtlSwitcher = this.config.rtlSwitcher;
|
|
729
900
|
rootFontSizes = this.config.rootFontSizes ?? [];
|
|
730
|
-
rootFontSize = signal(0, /* @ts-ignore */
|
|
731
|
-
...(ngDevMode ? [{ debugName: "rootFontSize" }] : /* istanbul ignore next */ []));
|
|
732
901
|
webcomponents = this.config.webcomponents;
|
|
733
902
|
frameworks = new Map([['Angular', 'angular']]);
|
|
734
|
-
selectedFramework = localStorage.getItem('si-live-preview-framework') ?? 'angular';
|
|
735
903
|
availableLocales = this.localeApi?.availableLocales() ?? [];
|
|
736
|
-
ticketLinkBug;
|
|
737
|
-
ticketLinkFeature;
|
|
738
904
|
editorCollapsed = signal(localStorage.getItem('si-live-preview-editor-collapsed') === 'true' && !this.isMobile, /* @ts-ignore */
|
|
739
905
|
...(ngDevMode ? [{ debugName: "editorCollapsed" }] : /* istanbul ignore next */ []));
|
|
740
906
|
showEditor = signal(!this.editorCollapsed(), /* @ts-ignore */
|
|
741
907
|
...(ngDevMode ? [{ debugName: "showEditor" }] : /* istanbul ignore next */ []));
|
|
742
|
-
newMsgs = signal(false, /* @ts-ignore */
|
|
743
|
-
...(ngDevMode ? [{ debugName: "newMsgs" }] : /* istanbul ignore next */ []));
|
|
744
908
|
compileSubject = new Subject();
|
|
745
909
|
templateModified = false;
|
|
746
910
|
skipInitialLoad = false;
|
|
@@ -748,56 +912,64 @@ class SiLivePreviewComponent {
|
|
|
748
912
|
flaskTypescript;
|
|
749
913
|
flaskReactVue;
|
|
750
914
|
savedScrollPos = { top: 0, left: 0 };
|
|
751
|
-
inProgressCounter = 0;
|
|
752
915
|
tsLoaded = false;
|
|
753
916
|
reactLoaded = false;
|
|
754
917
|
vueLoaded = false;
|
|
755
918
|
jsLoaded = false;
|
|
756
|
-
delayClearTimer;
|
|
757
919
|
webcomponentsList = [];
|
|
758
920
|
constructor() {
|
|
921
|
+
const storedFramework = localStorage.getItem('si-live-preview-framework');
|
|
922
|
+
if (storedFramework === 'react' || storedFramework === 'vue' || storedFramework === 'js') {
|
|
923
|
+
this.state.framework.set(storedFramework);
|
|
924
|
+
}
|
|
759
925
|
this.compileSubject
|
|
760
926
|
.pipe(throttleTime(500, undefined, { leading: true, trailing: true }))
|
|
761
927
|
.pipe(takeUntilDestroyed())
|
|
762
928
|
.subscribe(template => {
|
|
763
|
-
this.template.set(template);
|
|
929
|
+
this.state.template.set(template);
|
|
764
930
|
});
|
|
765
931
|
this.webcomponentsList = this.config.componentLoader.webcomponentsList;
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
this.templateModified = true;
|
|
772
|
-
this.templateReact.set('');
|
|
773
|
-
this.templateVue.set('');
|
|
774
|
-
this.templateJs.set('');
|
|
775
|
-
}
|
|
776
|
-
else {
|
|
777
|
-
this.skipInitialLoad = !!(changes.templateReact?.currentValue ??
|
|
778
|
-
changes.templateVue?.currentValue ??
|
|
779
|
-
changes.templateJs?.currentValue);
|
|
780
|
-
}
|
|
781
|
-
if (changes.example?.currentValue) {
|
|
782
|
-
this.loadFromUrl(changes.example.firstChange && this.skipInitialLoad);
|
|
783
|
-
if (this.webcomponents) {
|
|
784
|
-
this.checkWebComponentsAvailable();
|
|
932
|
+
let previousExample;
|
|
933
|
+
effect(() => {
|
|
934
|
+
const example = this.state.example();
|
|
935
|
+
if (!example || example === previousExample) {
|
|
936
|
+
return;
|
|
785
937
|
}
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
938
|
+
const firstLoad = previousExample === undefined;
|
|
939
|
+
previousExample = example;
|
|
940
|
+
untracked(() => {
|
|
941
|
+
this.activeTab.set(this.activeTab() !== 'typescript' ? 'template' : this.activeTab());
|
|
942
|
+
this.skipInitialLoad =
|
|
943
|
+
firstLoad &&
|
|
944
|
+
!!(this.state.template() ||
|
|
945
|
+
this.state.templateReact() ||
|
|
946
|
+
this.state.templateVue() ||
|
|
947
|
+
this.state.templateJs());
|
|
948
|
+
this.templateModified = !!this.state.template();
|
|
949
|
+
this.loadFromUrl(this.skipInitialLoad);
|
|
950
|
+
if (this.webcomponents) {
|
|
951
|
+
this.reactLoaded = false;
|
|
952
|
+
this.vueLoaded = false;
|
|
953
|
+
this.jsLoaded = false;
|
|
954
|
+
this.state.stopWebComponentLoading();
|
|
955
|
+
this.checkWebComponentsAvailable();
|
|
956
|
+
}
|
|
957
|
+
});
|
|
958
|
+
});
|
|
959
|
+
effect(() => localStorage.setItem('si-live-preview-theme', this.state.theme()));
|
|
960
|
+
effect(() => {
|
|
961
|
+
if (this.state.logMessages().length) {
|
|
962
|
+
setTimeout(() => {
|
|
963
|
+
this.consoleElem().nativeElement.scrollTop =
|
|
964
|
+
this.consoleElem().nativeElement.scrollHeight;
|
|
965
|
+
});
|
|
966
|
+
}
|
|
967
|
+
});
|
|
796
968
|
}
|
|
797
969
|
ngOnInit() {
|
|
798
|
-
this.theme.set(localStorage.getItem('si-live-preview-theme')
|
|
970
|
+
this.state.theme.set(localStorage.getItem('si-live-preview-theme') === 'dark' ? 'dark' : 'light');
|
|
799
971
|
const rfs = localStorage.getItem('si-live-preview-rfs') ?? '';
|
|
800
|
-
this.rootFontSize.set(rfs === 'initial' ? rfs : rfs ? parseInt(rfs, 10) : 0);
|
|
972
|
+
this.state.rootFontSize.set(rfs === 'initial' ? rfs : rfs ? parseInt(rfs, 10) : 0);
|
|
801
973
|
}
|
|
802
974
|
ngAfterViewInit() {
|
|
803
975
|
this.flaskTemplate = new CodeFlask(this.templateElem().nativeElement, {
|
|
@@ -825,41 +997,41 @@ class SiLivePreviewComponent {
|
|
|
825
997
|
areaId: 'reactVueEditor'
|
|
826
998
|
});
|
|
827
999
|
this.flaskTemplate.onUpdate((code) => {
|
|
828
|
-
if (code !== this.template()) {
|
|
1000
|
+
if (code !== this.state.template()) {
|
|
829
1001
|
this.templateModified = true;
|
|
830
1002
|
}
|
|
831
1003
|
this.compileSubject.next(code);
|
|
832
1004
|
});
|
|
833
1005
|
this.flaskReactVue.onUpdate((code) => {
|
|
834
1006
|
if (this.activeTab() === 'react') {
|
|
835
|
-
this.templateReact.set(code);
|
|
836
|
-
this.loadReact.set(true);
|
|
1007
|
+
this.state.templateReact.set(code);
|
|
1008
|
+
this.state.loadReact.set(true);
|
|
837
1009
|
}
|
|
838
1010
|
else if (this.activeTab() === 'vue') {
|
|
839
|
-
this.templateVue.set(code);
|
|
840
|
-
this.loadVue.set(true);
|
|
1011
|
+
this.state.templateVue.set(code);
|
|
1012
|
+
this.state.loadVue.set(true);
|
|
841
1013
|
}
|
|
842
1014
|
else if (this.activeTab() === 'js') {
|
|
843
|
-
this.templateJs.set(code);
|
|
844
|
-
this.loadJs.set(true);
|
|
1015
|
+
this.state.templateJs.set(code);
|
|
1016
|
+
this.state.loadJs.set(true);
|
|
845
1017
|
}
|
|
846
1018
|
});
|
|
847
1019
|
if (this.skipInitialLoad) {
|
|
848
|
-
if (this.templateReact()) {
|
|
1020
|
+
if (this.state.templateReact()) {
|
|
849
1021
|
this.reactLoaded = true;
|
|
850
1022
|
this.changeFramework('react');
|
|
851
1023
|
}
|
|
852
|
-
else if (this.templateVue()) {
|
|
1024
|
+
else if (this.state.templateVue()) {
|
|
853
1025
|
this.vueLoaded = true;
|
|
854
1026
|
this.changeFramework('vue');
|
|
855
1027
|
}
|
|
856
|
-
else if (this.templateJs()) {
|
|
1028
|
+
else if (this.state.templateJs()) {
|
|
857
1029
|
this.jsLoaded = true;
|
|
858
1030
|
this.changeFramework('js');
|
|
859
1031
|
}
|
|
860
1032
|
else {
|
|
861
|
-
this.flaskTemplate.updateCode(this.template());
|
|
862
|
-
this.compileSubject.next(this.template());
|
|
1033
|
+
this.flaskTemplate.updateCode(this.state.template());
|
|
1034
|
+
this.compileSubject.next(this.state.template());
|
|
863
1035
|
}
|
|
864
1036
|
this.skipInitialLoad = false;
|
|
865
1037
|
}
|
|
@@ -868,9 +1040,9 @@ class SiLivePreviewComponent {
|
|
|
868
1040
|
this.activeTab.set(tab);
|
|
869
1041
|
let saveScroll;
|
|
870
1042
|
let restoreScroll;
|
|
871
|
-
this.loadReact.set(false);
|
|
872
|
-
this.loadVue.set(false);
|
|
873
|
-
this.loadJs.set(false);
|
|
1043
|
+
this.state.loadReact.set(false);
|
|
1044
|
+
this.state.loadVue.set(false);
|
|
1045
|
+
this.state.loadJs.set(false);
|
|
874
1046
|
if (tab === 'template') {
|
|
875
1047
|
saveScroll = this.typescriptElem();
|
|
876
1048
|
restoreScroll = this.templateElem();
|
|
@@ -892,14 +1064,14 @@ class SiLivePreviewComponent {
|
|
|
892
1064
|
});
|
|
893
1065
|
}
|
|
894
1066
|
themeChange(theme) {
|
|
895
|
-
this.theme.set(theme);
|
|
896
|
-
localStorage.setItem('si-live-preview-theme', this.theme());
|
|
1067
|
+
this.state.theme.set(theme);
|
|
1068
|
+
localStorage.setItem('si-live-preview-theme', this.state.theme());
|
|
897
1069
|
}
|
|
898
1070
|
updateTemplate(template) {
|
|
899
1071
|
this.templateModified = false;
|
|
900
|
-
this.template.set(template);
|
|
1072
|
+
this.state.template.set(template);
|
|
901
1073
|
if (this.flaskTemplate) {
|
|
902
|
-
this.flaskTemplate.updateCode(this.template());
|
|
1074
|
+
this.flaskTemplate.updateCode(this.state.template());
|
|
903
1075
|
}
|
|
904
1076
|
}
|
|
905
1077
|
updateTs(ts) {
|
|
@@ -909,24 +1081,24 @@ class SiLivePreviewComponent {
|
|
|
909
1081
|
}
|
|
910
1082
|
}
|
|
911
1083
|
updateReact(ts) {
|
|
912
|
-
this.templateReact.set(ts);
|
|
1084
|
+
this.state.templateReact.set(ts);
|
|
913
1085
|
if (this.flaskReactVue) {
|
|
914
|
-
this.flaskReactVue.updateCode(this.templateReact());
|
|
915
|
-
this.loadReact.set(true);
|
|
1086
|
+
this.flaskReactVue.updateCode(this.state.templateReact());
|
|
1087
|
+
this.state.loadReact.set(true);
|
|
916
1088
|
}
|
|
917
1089
|
}
|
|
918
1090
|
updateVue(ts) {
|
|
919
|
-
this.templateVue.set(ts);
|
|
1091
|
+
this.state.templateVue.set(ts);
|
|
920
1092
|
if (this.flaskReactVue) {
|
|
921
|
-
this.flaskReactVue.updateCode(this.templateVue());
|
|
922
|
-
this.loadVue.set(true);
|
|
1093
|
+
this.flaskReactVue.updateCode(this.state.templateVue());
|
|
1094
|
+
this.state.loadVue.set(true);
|
|
923
1095
|
}
|
|
924
1096
|
}
|
|
925
1097
|
updateJs(js) {
|
|
926
|
-
this.templateJs.set(js);
|
|
1098
|
+
this.state.templateJs.set(js);
|
|
927
1099
|
if (this.flaskReactVue) {
|
|
928
|
-
this.flaskReactVue.updateCode(this.templateJs());
|
|
929
|
-
this.loadJs.set(true);
|
|
1100
|
+
this.flaskReactVue.updateCode(this.state.templateJs());
|
|
1101
|
+
this.state.loadJs.set(true);
|
|
930
1102
|
}
|
|
931
1103
|
}
|
|
932
1104
|
loadFromUrl(skipTemplate) {
|
|
@@ -935,21 +1107,20 @@ class SiLivePreviewComponent {
|
|
|
935
1107
|
}
|
|
936
1108
|
this.updateTs('');
|
|
937
1109
|
this.savedScrollPos = { top: 0, left: 0 };
|
|
938
|
-
this.
|
|
939
|
-
this.inProgress.set(false);
|
|
1110
|
+
this.state.resetRenderingProgress();
|
|
940
1111
|
this.tsLoaded = false;
|
|
941
1112
|
if (this.activeTab() === 'typescript') {
|
|
942
1113
|
this.loadTsFromUrl();
|
|
943
1114
|
}
|
|
944
1115
|
}
|
|
945
1116
|
loadTemplateFromUrl() {
|
|
946
|
-
const example = this.example();
|
|
1117
|
+
const example = this.state.example();
|
|
947
1118
|
if (!example) {
|
|
948
1119
|
return;
|
|
949
1120
|
}
|
|
950
1121
|
this.handleInProgressEvent(true);
|
|
951
1122
|
this.http
|
|
952
|
-
.get(this.baseUrl
|
|
1123
|
+
.get(this.baseUrl + example + '.html', { responseType: 'text' })
|
|
953
1124
|
.pipe(timeout(3000), retry(1))
|
|
954
1125
|
.subscribe({
|
|
955
1126
|
next: data => {
|
|
@@ -964,13 +1135,13 @@ class SiLivePreviewComponent {
|
|
|
964
1135
|
});
|
|
965
1136
|
}
|
|
966
1137
|
loadTsFromUrl() {
|
|
967
|
-
const example = this.example();
|
|
1138
|
+
const example = this.state.example();
|
|
968
1139
|
if (!example) {
|
|
969
1140
|
return;
|
|
970
1141
|
}
|
|
971
1142
|
this.handleInProgressEvent(true);
|
|
972
1143
|
this.http
|
|
973
|
-
.get(this.baseUrl
|
|
1144
|
+
.get(this.baseUrl + example + '.ts', { responseType: 'text' })
|
|
974
1145
|
.pipe(timeout(3000), retry(1))
|
|
975
1146
|
.subscribe({
|
|
976
1147
|
next: data => {
|
|
@@ -987,14 +1158,14 @@ class SiLivePreviewComponent {
|
|
|
987
1158
|
});
|
|
988
1159
|
}
|
|
989
1160
|
checkWebComponentsAvailable() {
|
|
990
|
-
const baseUrl = this.baseUrl
|
|
991
|
-
const example = this.example() ?? '';
|
|
1161
|
+
const baseUrl = this.baseUrl;
|
|
1162
|
+
const example = this.state.example() ?? '';
|
|
992
1163
|
if (this.webcomponentsList.includes(baseUrl + example + '-react')) {
|
|
993
1164
|
this.frameworks.set('React', 'react');
|
|
994
1165
|
}
|
|
995
1166
|
else {
|
|
996
|
-
if (this.
|
|
997
|
-
this.
|
|
1167
|
+
if (this.state.framework() === 'react') {
|
|
1168
|
+
this.state.framework.set('angular');
|
|
998
1169
|
}
|
|
999
1170
|
this.frameworks.delete('React');
|
|
1000
1171
|
}
|
|
@@ -1002,8 +1173,8 @@ class SiLivePreviewComponent {
|
|
|
1002
1173
|
this.frameworks.set('Vue', 'vue');
|
|
1003
1174
|
}
|
|
1004
1175
|
else {
|
|
1005
|
-
if (this.
|
|
1006
|
-
this.
|
|
1176
|
+
if (this.state.framework() === 'vue') {
|
|
1177
|
+
this.state.framework.set('angular');
|
|
1007
1178
|
}
|
|
1008
1179
|
this.frameworks.delete('Vue');
|
|
1009
1180
|
}
|
|
@@ -1011,19 +1182,20 @@ class SiLivePreviewComponent {
|
|
|
1011
1182
|
this.frameworks.set('Js', 'js');
|
|
1012
1183
|
}
|
|
1013
1184
|
else {
|
|
1014
|
-
if (this.
|
|
1015
|
-
this.
|
|
1185
|
+
if (this.state.framework() === 'js') {
|
|
1186
|
+
this.state.framework.set('angular');
|
|
1016
1187
|
}
|
|
1017
1188
|
this.frameworks.delete('Js');
|
|
1018
1189
|
}
|
|
1019
|
-
this.changeFramework(this.
|
|
1190
|
+
this.changeFramework(this.state.framework());
|
|
1020
1191
|
}
|
|
1021
1192
|
changeFramework(framework) {
|
|
1022
1193
|
this.activeTab.set(framework);
|
|
1194
|
+
this.state.framework.set(framework);
|
|
1023
1195
|
localStorage.setItem('si-live-preview-framework', framework);
|
|
1024
|
-
this.loadReact.set(false);
|
|
1025
|
-
this.loadVue.set(false);
|
|
1026
|
-
this.loadJs.set(false);
|
|
1196
|
+
this.state.loadReact.set(false);
|
|
1197
|
+
this.state.loadVue.set(false);
|
|
1198
|
+
this.state.loadJs.set(false);
|
|
1027
1199
|
let fileType = 'vue';
|
|
1028
1200
|
if (framework === 'angular') {
|
|
1029
1201
|
this.activeTab.set('template');
|
|
@@ -1032,41 +1204,41 @@ class SiLivePreviewComponent {
|
|
|
1032
1204
|
else if (framework === 'react') {
|
|
1033
1205
|
fileType = 'tsx';
|
|
1034
1206
|
if (this.reactLoaded) {
|
|
1035
|
-
this.updateReact(this.templateReact());
|
|
1207
|
+
this.updateReact(this.state.templateReact());
|
|
1036
1208
|
return;
|
|
1037
1209
|
}
|
|
1038
1210
|
}
|
|
1039
1211
|
else if (framework === 'vue' && this.vueLoaded) {
|
|
1040
|
-
this.updateVue(this.templateVue());
|
|
1212
|
+
this.updateVue(this.state.templateVue());
|
|
1041
1213
|
return;
|
|
1042
1214
|
}
|
|
1043
1215
|
else if (framework === 'js') {
|
|
1044
1216
|
fileType = 'html';
|
|
1045
1217
|
if (this.jsLoaded) {
|
|
1046
|
-
this.updateJs(this.templateJs());
|
|
1218
|
+
this.updateJs(this.state.templateJs());
|
|
1047
1219
|
return;
|
|
1048
1220
|
}
|
|
1049
1221
|
}
|
|
1050
1222
|
this.handleInProgressEvent(true);
|
|
1051
|
-
const baseUrl = this.baseUrl
|
|
1052
|
-
const example = this.example() ?? '';
|
|
1223
|
+
const baseUrl = this.baseUrl;
|
|
1224
|
+
const example = this.state.example() ?? '';
|
|
1053
1225
|
this.http
|
|
1054
1226
|
.get(`${baseUrl}${example}-${framework}.${fileType}`, { responseType: 'text' })
|
|
1055
1227
|
.subscribe({
|
|
1056
1228
|
next: (res) => {
|
|
1057
1229
|
if (framework === 'react') {
|
|
1058
1230
|
this.updateReact(res);
|
|
1059
|
-
this.templateReact.set(res);
|
|
1231
|
+
this.state.templateReact.set(res);
|
|
1060
1232
|
this.reactLoaded = true;
|
|
1061
1233
|
}
|
|
1062
1234
|
else if (framework === 'vue') {
|
|
1063
1235
|
this.updateVue(res);
|
|
1064
|
-
this.templateVue.set(res);
|
|
1236
|
+
this.state.templateVue.set(res);
|
|
1065
1237
|
this.vueLoaded = true;
|
|
1066
1238
|
}
|
|
1067
1239
|
else if (framework === 'js') {
|
|
1068
1240
|
this.updateJs(res);
|
|
1069
|
-
this.templateJs.set(res);
|
|
1241
|
+
this.state.templateJs.set(res);
|
|
1070
1242
|
this.jsLoaded = true;
|
|
1071
1243
|
}
|
|
1072
1244
|
setTimeout(() => {
|
|
@@ -1091,7 +1263,7 @@ class SiLivePreviewComponent {
|
|
|
1091
1263
|
});
|
|
1092
1264
|
}
|
|
1093
1265
|
templateFromComponent(template) {
|
|
1094
|
-
if (this.template()) {
|
|
1266
|
+
if (this.state.template()) {
|
|
1095
1267
|
return;
|
|
1096
1268
|
}
|
|
1097
1269
|
if (template === undefined) {
|
|
@@ -1104,43 +1276,18 @@ class SiLivePreviewComponent {
|
|
|
1104
1276
|
}
|
|
1105
1277
|
}
|
|
1106
1278
|
handleInProgressEvent(inProgress) {
|
|
1107
|
-
|
|
1108
|
-
this.inProgressCounter++;
|
|
1109
|
-
}
|
|
1110
|
-
else {
|
|
1111
|
-
this.inProgressCounter--;
|
|
1112
|
-
}
|
|
1113
|
-
this.inProgress.set(!!this.inProgressCounter);
|
|
1279
|
+
this.state.setRenderingProgress(inProgress);
|
|
1114
1280
|
}
|
|
1115
1281
|
logClear(delayed = false) {
|
|
1116
|
-
if (
|
|
1117
|
-
this.
|
|
1118
|
-
this.delayClearTimer = undefined;
|
|
1119
|
-
this.doLogClear();
|
|
1120
|
-
}, 100);
|
|
1121
|
-
return;
|
|
1122
|
-
}
|
|
1123
|
-
this.doLogClear();
|
|
1124
|
-
}
|
|
1125
|
-
doLogClear() {
|
|
1126
|
-
if (this.logMessages().length) {
|
|
1127
|
-
this.logMessages.set([]);
|
|
1282
|
+
if (this.state.logMessages().length) {
|
|
1283
|
+
this.state.clearLogs(delayed);
|
|
1128
1284
|
setTimeout(() => {
|
|
1129
1285
|
this.consoleElem().nativeElement.scrollTop = 0;
|
|
1130
|
-
});
|
|
1286
|
+
}, delayed ? 100 : 0);
|
|
1131
1287
|
}
|
|
1132
1288
|
}
|
|
1133
1289
|
logEvent(msg) {
|
|
1134
|
-
|
|
1135
|
-
this.logMessages.set([]);
|
|
1136
|
-
clearTimeout(this.delayClearTimer);
|
|
1137
|
-
this.delayClearTimer = undefined;
|
|
1138
|
-
}
|
|
1139
|
-
this.logMessages.set([...this.logMessages(), msg]);
|
|
1140
|
-
this.newMsgs.set(true);
|
|
1141
|
-
setTimeout(() => {
|
|
1142
|
-
this.consoleElem().nativeElement.scrollTop = this.consoleElem().nativeElement.scrollHeight;
|
|
1143
|
-
});
|
|
1290
|
+
this.state.addLog(msg);
|
|
1144
1291
|
}
|
|
1145
1292
|
showCopiedLabel() {
|
|
1146
1293
|
this.showCopied.set(true);
|
|
@@ -1177,40 +1324,43 @@ class SiLivePreviewComponent {
|
|
|
1177
1324
|
else {
|
|
1178
1325
|
setTimeout(() => {
|
|
1179
1326
|
this.showEditor.set(true);
|
|
1180
|
-
this.
|
|
1327
|
+
this.state.newMessages.set(false);
|
|
1181
1328
|
window.dispatchEvent(new Event('resize'));
|
|
1182
1329
|
}, 500);
|
|
1183
1330
|
}
|
|
1184
1331
|
}
|
|
1185
1332
|
toggleRTL() {
|
|
1186
|
-
this.isRTL.set(!this.isRTL());
|
|
1333
|
+
this.state.isRTL.set(!this.state.isRTL());
|
|
1187
1334
|
}
|
|
1188
1335
|
toggleTheme() {
|
|
1189
|
-
this.themeChange(this.theme() === 'dark' ? 'light' : 'dark');
|
|
1336
|
+
this.themeChange(this.state.theme() === 'dark' ? 'light' : 'dark');
|
|
1190
1337
|
}
|
|
1191
1338
|
localeSelectionChanged(target) {
|
|
1192
1339
|
const locale = target?.value;
|
|
1193
1340
|
this.changeLocale(locale);
|
|
1194
1341
|
}
|
|
1195
1342
|
rfsSelectionChanges(value) {
|
|
1196
|
-
this.rootFontSize.set(value === 'initial' ? value : parseInt(value, 10));
|
|
1197
|
-
localStorage.setItem('si-live-preview-rfs', this.rootFontSize().toString());
|
|
1343
|
+
this.state.rootFontSize.set(value === 'initial' ? value : parseInt(value, 10));
|
|
1344
|
+
localStorage.setItem('si-live-preview-rfs', this.state.rootFontSize().toString());
|
|
1198
1345
|
}
|
|
1199
1346
|
changeLocale(locale) {
|
|
1200
|
-
this.locale.set(locale);
|
|
1347
|
+
this.state.locale.set(locale ?? undefined);
|
|
1348
|
+
}
|
|
1349
|
+
renderingErrorMessage() {
|
|
1350
|
+
return String(this.state.renderingError());
|
|
1201
1351
|
}
|
|
1202
1352
|
copyTemplate() {
|
|
1203
|
-
this.clipboardCopy(this.template());
|
|
1353
|
+
this.clipboardCopy(this.state.template());
|
|
1204
1354
|
}
|
|
1205
1355
|
copyCode() {
|
|
1206
1356
|
if (this.activeTab() === 'react') {
|
|
1207
|
-
this.clipboardCopy(this.templateReact());
|
|
1357
|
+
this.clipboardCopy(this.state.templateReact());
|
|
1208
1358
|
}
|
|
1209
1359
|
else if (this.activeTab() === 'vue') {
|
|
1210
|
-
this.clipboardCopy(this.templateVue());
|
|
1360
|
+
this.clipboardCopy(this.state.templateVue());
|
|
1211
1361
|
}
|
|
1212
1362
|
else if (this.activeTab() === 'js') {
|
|
1213
|
-
this.clipboardCopy(this.templateJs());
|
|
1363
|
+
this.clipboardCopy(this.state.templateJs());
|
|
1214
1364
|
}
|
|
1215
1365
|
else {
|
|
1216
1366
|
this.clipboardCopy(this.templateTs);
|
|
@@ -1229,44 +1379,38 @@ class SiLivePreviewComponent {
|
|
|
1229
1379
|
window.open(url, '_blank');
|
|
1230
1380
|
}
|
|
1231
1381
|
createTemplateLink(mode) {
|
|
1232
|
-
const locale = this.locale();
|
|
1382
|
+
const locale = this.state.locale();
|
|
1233
1383
|
let url = `${window.location.protocol}//${window.location.host}`;
|
|
1234
1384
|
url += window.location.pathname;
|
|
1235
1385
|
url += `#/viewer/${mode}?`;
|
|
1236
|
-
url += 'theme=' + this.theme();
|
|
1237
|
-
if (this.isRTL()) {
|
|
1386
|
+
url += 'theme=' + this.state.theme();
|
|
1387
|
+
if (this.state.isRTL()) {
|
|
1238
1388
|
url += '&isRTL=true';
|
|
1239
1389
|
}
|
|
1240
1390
|
if (locale) {
|
|
1241
1391
|
url += '&locale=' + locale;
|
|
1242
1392
|
}
|
|
1243
|
-
if (this.rootFontSize()) {
|
|
1244
|
-
url += '&rfs=' + this.rootFontSize();
|
|
1393
|
+
if (this.state.rootFontSize()) {
|
|
1394
|
+
url += '&rfs=' + this.state.rootFontSize();
|
|
1245
1395
|
}
|
|
1246
1396
|
if (this.activeTab() === 'react') {
|
|
1247
|
-
url += '&t=' + encodeURIComponent(this.templateReact()) + '&framework=react';
|
|
1397
|
+
url += '&t=' + encodeURIComponent(this.state.templateReact()) + '&framework=react';
|
|
1248
1398
|
}
|
|
1249
1399
|
else if (this.activeTab() === 'vue') {
|
|
1250
|
-
url += '&t=' + encodeURIComponent(this.templateVue()) + '&framework=vue';
|
|
1400
|
+
url += '&t=' + encodeURIComponent(this.state.templateVue()) + '&framework=vue';
|
|
1251
1401
|
}
|
|
1252
1402
|
else if (this.activeTab() === 'js') {
|
|
1253
|
-
url += '&t=' + encodeURIComponent(this.templateJs()) + '&framework=js';
|
|
1403
|
+
url += '&t=' + encodeURIComponent(this.state.templateJs()) + '&framework=js';
|
|
1254
1404
|
}
|
|
1255
1405
|
else if (this.templateModified) {
|
|
1256
|
-
url += '&t=' + encodeURIComponent(this.template());
|
|
1406
|
+
url += '&t=' + encodeURIComponent(this.state.template());
|
|
1257
1407
|
}
|
|
1258
|
-
const example = this.example();
|
|
1408
|
+
const example = this.state.example();
|
|
1259
1409
|
if (example) {
|
|
1260
1410
|
url += '&e=' + encodeURIComponent(example);
|
|
1261
1411
|
}
|
|
1262
1412
|
return url;
|
|
1263
1413
|
}
|
|
1264
|
-
createTicketLinks() {
|
|
1265
|
-
const ticketBaseUrl = this.ticketBaseUrl();
|
|
1266
|
-
const example = this.example() ?? '';
|
|
1267
|
-
this.ticketLinkBug = `${ticketBaseUrl}?issue%5Btitle%5D=%3C${example}%3E:&issuable_template=Bug`;
|
|
1268
|
-
this.ticketLinkFeature = `${ticketBaseUrl}?issue%5Btitle%5D=%3C${example}%3E:&issuable_template=Feature Request`;
|
|
1269
|
-
}
|
|
1270
1414
|
onFullscreenChange() {
|
|
1271
1415
|
this.isFullscreen.set(!!document.fullscreenElement || !!document.webkitFullscreenElement);
|
|
1272
1416
|
if (!this.isFullscreen()) {
|
|
@@ -1274,7 +1418,7 @@ class SiLivePreviewComponent {
|
|
|
1274
1418
|
}
|
|
1275
1419
|
}
|
|
1276
1420
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SiLivePreviewComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1277
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.8", type: SiLivePreviewComponent, isStandalone: true, selector: "si-live-preview", inputs: { baseUrl: { classPropertyName: "baseUrl", publicName: "baseUrl", isSignal: true, isRequired: true, transformFunction: null }, example: { classPropertyName: "example", publicName: "example", isSignal: true, isRequired: false, transformFunction: null }, template: { classPropertyName: "template", publicName: "template", isSignal: true, isRequired: false, transformFunction: null }, theme: { classPropertyName: "theme", publicName: "theme", isSignal: true, isRequired: false, transformFunction: null }, locale: { classPropertyName: "locale", publicName: "locale", isSignal: true, isRequired: false, transformFunction: null }, isRTL: { classPropertyName: "isRTL", publicName: "isRTL", isSignal: true, isRequired: false, transformFunction: null }, ticketBaseUrl: { classPropertyName: "ticketBaseUrl", publicName: "ticketBaseUrl", isSignal: true, isRequired: false, transformFunction: null }, templateReact: { classPropertyName: "templateReact", publicName: "templateReact", isSignal: true, isRequired: false, transformFunction: null }, templateVue: { classPropertyName: "templateVue", publicName: "templateVue", isSignal: true, isRequired: false, transformFunction: null }, templateJs: { classPropertyName: "templateJs", publicName: "templateJs", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { template: "templateChange", theme: "themeChange", locale: "localeChange", isRTL: "isRTLChange", templateReact: "templateReactChange", templateVue: "templateVueChange", templateJs: "templateJsChange" }, 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 }], usesOnChanges: 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 [template]=\"template()\"\n [baseUrl]=\"baseUrl()\"\n [exampleUrl]=\"example() ?? ''\"\n [ticketLinkBug]=\"ticketLinkBug\"\n [ticketLinkFeature]=\"ticketLinkFeature\"\n [isFullscreen]=\"isFullscreen()\"\n [theme]=\"theme()\"\n [locale]=\"locale()\"\n [rootFontSize]=\"rootFontSize()\"\n [isRTL]=\"isRTL()\"\n [loadReact]=\"loadReact()\"\n [loadVue]=\"loadVue()\"\n [loadJs]=\"loadJs()\"\n [reactVueTemplate]=\"\n active === 'react' ? templateReact() : active === 'vue' ? templateVue() : templateJs()\n \"\n (templateFromComponent)=\"templateFromComponent($event)\"\n (logClear)=\"logClear(true)\"\n (logMessage)=\"logEvent($event)\"\n (logRenderingError)=\"renderingError.set($event)\"\n (inProgress)=\"handleInProgressEvent($event)\"\n (themeChange)=\"themeChange($event)\"\n (localeChange)=\"changeLocale($event)\"\n />\n @if (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)]=\"selectedFramework\"\n (ngModelChange)=\"changeFramework($event)\"\n >\n @for (aFramework of frameworks | keyvalue; track $index) {\n <option [value]=\"aFramework.value\" [selected]=\"selectedFramework === 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)]=\"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]=\"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]=\"isRTL() ? 'Right-to-left layout' : 'Left-to-right layout'\"\n [attr.aria-label]=\"isRTL() ? 'Right-to-left layout' : 'Left-to-right layout'\"\n (click)=\"toggleRTL()\"\n >\n {{ isRTL() ? 'RTL' : 'LTR' }}\n </button>\n }\n @if (\n !isMobile && !showEditor() && (renderingError() || (logMessages().length && newMsgs()))\n ) {\n <button\n type=\"button\"\n class=\"btn-command\"\n title=\"Show console\"\n aria-label=\"Show console\"\n [class.alert]=\"renderingError()\"\n [class.info]=\"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 (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]=\"selectedFramework\"\n [example]=\"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]=\"!renderingError() && !logMessages().length\">\n <div class=\"buttons\">\n @if (logMessages().length) {\n <button\n type=\"button\"\n class=\"btn-command btn-clear\"\n title=\"Clear log\"\n aria-label=\"Clear log\"\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 (renderingError()) {\n <pre\n class=\"alert-danger\"\n ><code class=\"bg-none\">{{ renderingError().toString() }}</code></pre>\n }\n @if (!renderingError() && logMessages().length) {\n <ul>\n @for (msg of 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(--element-button-focus-width))}.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(--element-button-focus-width) solid var(--si-sys-color-effects-focus);outline-offset:var(--element-button-focus-overlay-width)}: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.is-collapsed{max-block-size:41px;overflow:hidden;background-color:var(--si-sys-color-background-0);border-block-start:1px solid var(--si-sys-color-border-4)}.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:hover{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:100;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}.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(--element-base-4)}:host ::ng-deep .codeflask__lines{color:var(--element-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: ["baseUrl", "exampleUrl", "template", "ticketLinkBug", "ticketLinkFeature", "isFullscreen", "iFrameHeight", "iFrameWidth", "theme", "locale", "rootFontSize", "isRTL", "loadReact", "loadVue", "loadJs", "reactVueTemplate"], outputs: ["themeChange", "localeChange", "templateFromComponent", "logClear", "logMessage", "logRenderingError", "inProgress"] }, { kind: "directive", type: SiStackblitzButtonDirective, selector: "button[siStackblitz]", inputs: ["framework", "baseUrl", "example"] }, { kind: "pipe", type: KeyValuePipe, name: "keyvalue" }], changeDetection: i0.ChangeDetectionStrategy.Eager });
|
|
1421
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.8", type: SiLivePreviewComponent, isStandalone: true, selector: "si-live-preview", 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]=\"state.isRTL() ? 'Right-to-left layout' : 'Left-to-right layout'\"\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 (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(--element-button-focus-width))}.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(--element-button-focus-width) solid var(--si-sys-color-effects-focus);outline-offset:var(--element-button-focus-overlay-width)}: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.is-collapsed{max-block-size:41px;overflow:hidden;background-color:var(--si-sys-color-background-0);border-block-start:1px solid var(--si-sys-color-border-4)}.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:hover{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:100;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}.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(--element-base-4)}:host ::ng-deep .codeflask__lines{color:var(--element-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 });
|
|
1278
1422
|
}
|
|
1279
1423
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SiLivePreviewComponent, decorators: [{
|
|
1280
1424
|
type: Component,
|
|
@@ -1283,8 +1427,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImpor
|
|
|
1283
1427
|
'[class.is-mobile]': 'isMobile',
|
|
1284
1428
|
'(document:fullscreenchange)': 'onFullscreenChange()',
|
|
1285
1429
|
'(document:webkitfullscreenchange)': 'onFullscreenChange()'
|
|
1286
|
-
}, 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 [template]=\"template()\"\n [baseUrl]=\"baseUrl()\"\n [exampleUrl]=\"example() ?? ''\"\n [ticketLinkBug]=\"ticketLinkBug\"\n [ticketLinkFeature]=\"ticketLinkFeature\"\n [isFullscreen]=\"isFullscreen()\"\n [theme]=\"theme()\"\n [locale]=\"locale()\"\n [rootFontSize]=\"rootFontSize()\"\n [isRTL]=\"isRTL()\"\n [loadReact]=\"loadReact()\"\n [loadVue]=\"loadVue()\"\n [loadJs]=\"loadJs()\"\n [reactVueTemplate]=\"\n active === 'react' ? templateReact() : active === 'vue' ? templateVue() : templateJs()\n \"\n (templateFromComponent)=\"templateFromComponent($event)\"\n (logClear)=\"logClear(true)\"\n (logMessage)=\"logEvent($event)\"\n (logRenderingError)=\"renderingError.set($event)\"\n (inProgress)=\"handleInProgressEvent($event)\"\n (themeChange)=\"themeChange($event)\"\n (localeChange)=\"changeLocale($event)\"\n />\n @if (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)]=\"selectedFramework\"\n (ngModelChange)=\"changeFramework($event)\"\n >\n @for (aFramework of frameworks | keyvalue; track $index) {\n <option [value]=\"aFramework.value\" [selected]=\"selectedFramework === 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)]=\"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]=\"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]=\"isRTL() ? 'Right-to-left layout' : 'Left-to-right layout'\"\n [attr.aria-label]=\"isRTL() ? 'Right-to-left layout' : 'Left-to-right layout'\"\n (click)=\"toggleRTL()\"\n >\n {{ isRTL() ? 'RTL' : 'LTR' }}\n </button>\n }\n @if (\n !isMobile && !showEditor() && (renderingError() || (logMessages().length && newMsgs()))\n ) {\n <button\n type=\"button\"\n class=\"btn-command\"\n title=\"Show console\"\n aria-label=\"Show console\"\n [class.alert]=\"renderingError()\"\n [class.info]=\"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 (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]=\"selectedFramework\"\n [example]=\"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]=\"!renderingError() && !logMessages().length\">\n <div class=\"buttons\">\n @if (logMessages().length) {\n <button\n type=\"button\"\n class=\"btn-command btn-clear\"\n title=\"Clear log\"\n aria-label=\"Clear log\"\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 (renderingError()) {\n <pre\n class=\"alert-danger\"\n ><code class=\"bg-none\">{{ renderingError().toString() }}</code></pre>\n }\n @if (!renderingError() && logMessages().length) {\n <ul>\n @for (msg of 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(--element-button-focus-width))}.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(--element-button-focus-width) solid var(--si-sys-color-effects-focus);outline-offset:var(--element-button-focus-overlay-width)}: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.is-collapsed{max-block-size:41px;overflow:hidden;background-color:var(--si-sys-color-background-0);border-block-start:1px solid var(--si-sys-color-border-4)}.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:hover{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:100;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}.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(--element-base-4)}:host ::ng-deep .codeflask__lines{color:var(--element-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"] }]
|
|
1287
|
-
}], ctorParameters: () => [], propDecorators: { 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 }] }]
|
|
1430
|
+
}, 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]=\"state.isRTL() ? 'Right-to-left layout' : 'Left-to-right layout'\"\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 (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(--element-button-focus-width))}.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(--element-button-focus-width) solid var(--si-sys-color-effects-focus);outline-offset:var(--element-button-focus-overlay-width)}: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.is-collapsed{max-block-size:41px;overflow:hidden;background-color:var(--si-sys-color-background-0);border-block-start:1px solid var(--si-sys-color-border-4)}.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:hover{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:100;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}.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(--element-base-4)}:host ::ng-deep .codeflask__lines{color:var(--element-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"] }]
|
|
1431
|
+
}], ctorParameters: () => [], propDecorators: { 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 }] }] } });
|
|
1288
1432
|
|
|
1289
1433
|
/**
|
|
1290
1434
|
* Copyright (c) Siemens 2016 - 2026
|
|
@@ -1300,10 +1444,8 @@ class SiExampleOverviewComponent {
|
|
|
1300
1444
|
darkMediaQuery = window.matchMedia('(prefers-color-scheme: dark)');
|
|
1301
1445
|
mediaQueryListener = () => this.toggleDark(this.darkMediaQuery.matches);
|
|
1302
1446
|
cdRef = inject(ChangeDetectorRef);
|
|
1303
|
-
activeExampleRoute;
|
|
1304
1447
|
tree = [];
|
|
1305
1448
|
baseUrl = this.config.examplesBaseUrl;
|
|
1306
|
-
ticketBaseUrl = this.config.ticketBaseUrl;
|
|
1307
1449
|
isCollapsed = localStorage.getItem('si-live-preview-examples-collapsed') === 'true';
|
|
1308
1450
|
showContent = !this.isCollapsed;
|
|
1309
1451
|
searchControl = new UntypedFormControl();
|
|
@@ -1313,7 +1455,6 @@ class SiExampleOverviewComponent {
|
|
|
1313
1455
|
.sort()
|
|
1314
1456
|
.map(component => component.replace(this.baseUrl, ''));
|
|
1315
1457
|
this.makeTree();
|
|
1316
|
-
this.activeExampleRoute = this.route.url.pipe(filter(segments => !!segments.length), map(segments => segments.join('/')));
|
|
1317
1458
|
// Handle the filter query parameter
|
|
1318
1459
|
this.route.queryParams.subscribe(search => {
|
|
1319
1460
|
this.makeTree(search.q);
|
|
@@ -1377,11 +1518,11 @@ class SiExampleOverviewComponent {
|
|
|
1377
1518
|
this.searchControl.reset();
|
|
1378
1519
|
}
|
|
1379
1520
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SiExampleOverviewComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1380
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.8", type: SiExampleOverviewComponent, isStandalone: true, selector: "si-example-overview", ngImport: i0, template: "<nav class=\"component-list\" aria-label=\"Live preview\" [class.is-collapsed]=\"isCollapsed\">\n <div class=\"component-list-header\">\n @if (showContent) {\n <span>Examples</span>\n }\n <button\n type=\"button\"\n class=\"collapse-button\"\n [attr.title]=\"isCollapsed ? 'Expand' : 'Collapse'\"\n [attr.aria-label]=\"isCollapsed ? 'Expand' : 'Collapse'\"\n (click)=\"toggleCollapse()\"\n >\n <svg class=\"collapse-icon\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\">\n <path\n d=\"M234.77,248.93l1.44-1.72,110-110a12.43,12.43,0,0,1,19,15.86l-1.44,1.72L262.59,256l101.2,101.21a12.45,12.45,0,0,1,1.44,15.86l-1.44,1.72a12.45,12.45,0,0,1-15.86,1.44l-1.72-1.44-110-110A12.45,12.45,0,0,1,234.77,248.93Z\"\n />\n <path\n d=\"M146.77,248.93l1.44-1.72,88-88a12.43,12.43,0,0,1,19,15.86l-1.44,1.72L174.59,256l79.2,79.21a12.45,12.45,0,0,1,1.44,15.86l-1.44,1.72a12.45,12.45,0,0,1-15.86,1.44l-1.72-1.44-88-88A12.45,12.45,0,0,1,146.77,248.93Z\"\n />\n </svg>\n </button>\n </div>\n @if (showContent) {\n <div class=\"search-bar\" role=\"search\" aria-label=\"Live preview\">\n <svg class=\"search-bar-icon\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\">\n <path\n d=\"M420.49,403.51l-76.88-76.87A139.39,139.39,0,0,0,377,236c0-77.2-62.8-140-140-140S97,158.8,97,236s62.8,140,140,140a139.33,139.33,0,0,0,89.55-32.48l77,77a12,12,0,0,0,17-17ZM121,236A116,116,0,1,1,237,352,116.13,116.13,0,0,1,121,236Z\"\n />\n </svg>\n <input\n type=\"text\"\n placeholder=\"Filter examples\"\n autocorrect=\"off\"\n autocapitalize=\"none\"\n [formControl]=\"searchControl\"\n />\n @if (searchControl.value) {\n <button\n type=\"button\"\n class=\"cancel-button\"\n aria-label=\"clear search\"\n (click)=\"resetSearchBar()\"\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 }\n </div>\n }\n @if (showContent) {\n <div class=\"available-examples\">\n <ul>\n @for (item of tree; track $index) {\n <li [style.--level]=\"item.level\">\n @if (item.link) {\n <a\n routerLinkActive=\"example-active\"\n queryParamsHandling=\"merge\"\n [routerLink]=\"'/overview/' + item.link\"\n >\n {{ item.label }}\n </a>\n } @else {\n {{ item.label }}\n }\n </li>\n }\n </ul>\n </div>\n }\n @if (!showContent && isCollapsed) {\n <div class=\"component-list-text\">\n <span>Examples</span>\n </div>\n }\n</nav>\n<main aria-label=\"Live preview\">\n <si-live-preview
|
|
1521
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.8", type: SiExampleOverviewComponent, isStandalone: true, selector: "si-example-overview", ngImport: i0, template: "<nav class=\"component-list\" aria-label=\"Live preview\" [class.is-collapsed]=\"isCollapsed\">\n <div class=\"component-list-header\">\n @if (showContent) {\n <span>Examples</span>\n }\n <button\n type=\"button\"\n class=\"collapse-button\"\n [attr.title]=\"isCollapsed ? 'Expand' : 'Collapse'\"\n [attr.aria-label]=\"isCollapsed ? 'Expand' : 'Collapse'\"\n (click)=\"toggleCollapse()\"\n >\n <svg class=\"collapse-icon\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\">\n <path\n d=\"M234.77,248.93l1.44-1.72,110-110a12.43,12.43,0,0,1,19,15.86l-1.44,1.72L262.59,256l101.2,101.21a12.45,12.45,0,0,1,1.44,15.86l-1.44,1.72a12.45,12.45,0,0,1-15.86,1.44l-1.72-1.44-110-110A12.45,12.45,0,0,1,234.77,248.93Z\"\n />\n <path\n d=\"M146.77,248.93l1.44-1.72,88-88a12.43,12.43,0,0,1,19,15.86l-1.44,1.72L174.59,256l79.2,79.21a12.45,12.45,0,0,1,1.44,15.86l-1.44,1.72a12.45,12.45,0,0,1-15.86,1.44l-1.72-1.44-88-88A12.45,12.45,0,0,1,146.77,248.93Z\"\n />\n </svg>\n </button>\n </div>\n @if (showContent) {\n <div class=\"search-bar\" role=\"search\" aria-label=\"Live preview\">\n <svg class=\"search-bar-icon\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\">\n <path\n d=\"M420.49,403.51l-76.88-76.87A139.39,139.39,0,0,0,377,236c0-77.2-62.8-140-140-140S97,158.8,97,236s62.8,140,140,140a139.33,139.33,0,0,0,89.55-32.48l77,77a12,12,0,0,0,17-17ZM121,236A116,116,0,1,1,237,352,116.13,116.13,0,0,1,121,236Z\"\n />\n </svg>\n <input\n type=\"text\"\n placeholder=\"Filter examples\"\n autocorrect=\"off\"\n autocapitalize=\"none\"\n [formControl]=\"searchControl\"\n />\n @if (searchControl.value) {\n <button\n type=\"button\"\n class=\"cancel-button\"\n aria-label=\"clear search\"\n (click)=\"resetSearchBar()\"\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 }\n </div>\n }\n @if (showContent) {\n <div class=\"available-examples\">\n <ul>\n @for (item of tree; track $index) {\n <li [style.--level]=\"item.level\">\n @if (item.link) {\n <a\n routerLinkActive=\"example-active\"\n queryParamsHandling=\"merge\"\n [routerLink]=\"'/overview/' + item.link\"\n >\n {{ item.label }}\n </a>\n } @else {\n {{ item.label }}\n }\n </li>\n }\n </ul>\n </div>\n }\n @if (!showContent && isCollapsed) {\n <div class=\"component-list-text\">\n <span>Examples</span>\n </div>\n }\n</nav>\n<main aria-label=\"Live preview\">\n <si-live-preview />\n</main>\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(--element-button-focus-width) solid var(--si-sys-color-effects-focus);outline-offset:var(--element-button-focus-overlay-width)}:host{display:flex;flex-direction:row;background-color:var(--si-sys-color-background-0)}.component-list{border-inline-end:1px solid var(--si-sys-color-border-4);display:flex;flex:0 0 auto;inline-size:400px;flex-direction:column;transition:inline-size .5s;color:var(--si-sys-color-text-primary)}.component-list.is-collapsed{inline-size:40px;overflow:hidden;background-color:var(--si-sys-color-background-0)}.component-list.is-collapsed .component-list-text{transform:rotate(-90deg);margin-block:auto 2em;word-wrap:normal}.component-list.is-collapsed .collapse-icon{transform:rotate(180deg)}.component-list .component-list-header{display:flex;flex-direction:column;justify-content:center;padding-block:10px;padding-inline:8px;background-color:var(--si-sys-color-background-0);position:relative;block-size:36px}.component-list .component-list-header .collapse-button{background-color:transparent;border:0;padding:4px;position:absolute;inset-inline-end:2px;inset-block-start:4px;inline-size:32px;block-size:32px;cursor:pointer;color:var(--si-sys-color-text-primary)}.component-list .component-list-header .collapse-button>svg{block-size:20px;fill:currentColor}.component-list .component-list-header .collapse-button:hover{color:var(--si-sys-color-text-accent-hover)}.component-list .search-bar{display:flex;margin-block:10px;margin-inline:8px;position:relative;block-size:38px}.component-list .search-bar input{flex:1;padding-block:8px;padding-inline:28px 12px;border:1px solid var(--si-sys-color-border-4);font-size:14px;background:var(--si-sys-color-background-0);color:var(--si-sys-color-text-primary)}.component-list .search-bar .search-bar-icon{position:absolute;inset-block-start:8px;inset-inline-start:6px;fill:var(--si-sys-color-text-primary);block-size:20px}.component-list .search-bar .cancel-button{background-color:transparent;border:0;font-size:20px;line-height:20px;padding:0;pointer-events:auto;position:absolute;inset-inline-end:8px;inset-block-start:8px}.component-list .search-bar .cancel-button>svg{block-size:20px;fill:var(--si-sys-color-text-primary)}.component-list .available-examples{flex:1 1 0;min-block-size:0;overflow-y:auto;padding-block-start:10px;border-block-start:1px solid var(--si-sys-color-border-4)}.component-list .available-examples ul{margin-block:0 16px;margin-inline:0;padding-inline-start:16px;list-style:none}.component-list .available-examples li{margin-inline-start:calc(var(--level) * 16px);padding-block:4px}.example-active{font-weight:600}a{text-decoration:none}main{flex:1 1 auto;display:flex;overflow:hidden}@media(prefers-color-scheme:dark){si-example-overview{color-scheme:dark}}\n"], dependencies: [{ kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox]):not([ngNoCva])[formControlName],textarea:not([ngNoCva])[formControlName],input:not([type=checkbox]):not([ngNoCva])[formControl],textarea:not([ngNoCva])[formControl],input:not([type=checkbox]):not([ngNoCva])[ngModel],textarea:not([ngNoCva])[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "browserUrl", "routerLink"] }, { kind: "directive", type: RouterLinkActive, selector: "[routerLinkActive]", inputs: ["routerLinkActiveOptions", "ariaCurrentWhenActive", "routerLinkActive"], outputs: ["isActiveChange"], exportAs: ["routerLinkActive"] }, { kind: "component", type: SiLivePreviewComponent, selector: "si-live-preview" }], changeDetection: i0.ChangeDetectionStrategy.Eager });
|
|
1381
1522
|
}
|
|
1382
1523
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SiExampleOverviewComponent, decorators: [{
|
|
1383
1524
|
type: Component,
|
|
1384
|
-
args: [{ selector: 'si-example-overview', imports: [
|
|
1525
|
+
args: [{ selector: 'si-example-overview', imports: [ReactiveFormsModule, RouterLink, RouterLinkActive, SiLivePreviewComponent], changeDetection: ChangeDetectionStrategy.Eager, template: "<nav class=\"component-list\" aria-label=\"Live preview\" [class.is-collapsed]=\"isCollapsed\">\n <div class=\"component-list-header\">\n @if (showContent) {\n <span>Examples</span>\n }\n <button\n type=\"button\"\n class=\"collapse-button\"\n [attr.title]=\"isCollapsed ? 'Expand' : 'Collapse'\"\n [attr.aria-label]=\"isCollapsed ? 'Expand' : 'Collapse'\"\n (click)=\"toggleCollapse()\"\n >\n <svg class=\"collapse-icon\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\">\n <path\n d=\"M234.77,248.93l1.44-1.72,110-110a12.43,12.43,0,0,1,19,15.86l-1.44,1.72L262.59,256l101.2,101.21a12.45,12.45,0,0,1,1.44,15.86l-1.44,1.72a12.45,12.45,0,0,1-15.86,1.44l-1.72-1.44-110-110A12.45,12.45,0,0,1,234.77,248.93Z\"\n />\n <path\n d=\"M146.77,248.93l1.44-1.72,88-88a12.43,12.43,0,0,1,19,15.86l-1.44,1.72L174.59,256l79.2,79.21a12.45,12.45,0,0,1,1.44,15.86l-1.44,1.72a12.45,12.45,0,0,1-15.86,1.44l-1.72-1.44-88-88A12.45,12.45,0,0,1,146.77,248.93Z\"\n />\n </svg>\n </button>\n </div>\n @if (showContent) {\n <div class=\"search-bar\" role=\"search\" aria-label=\"Live preview\">\n <svg class=\"search-bar-icon\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\">\n <path\n d=\"M420.49,403.51l-76.88-76.87A139.39,139.39,0,0,0,377,236c0-77.2-62.8-140-140-140S97,158.8,97,236s62.8,140,140,140a139.33,139.33,0,0,0,89.55-32.48l77,77a12,12,0,0,0,17-17ZM121,236A116,116,0,1,1,237,352,116.13,116.13,0,0,1,121,236Z\"\n />\n </svg>\n <input\n type=\"text\"\n placeholder=\"Filter examples\"\n autocorrect=\"off\"\n autocapitalize=\"none\"\n [formControl]=\"searchControl\"\n />\n @if (searchControl.value) {\n <button\n type=\"button\"\n class=\"cancel-button\"\n aria-label=\"clear search\"\n (click)=\"resetSearchBar()\"\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 }\n </div>\n }\n @if (showContent) {\n <div class=\"available-examples\">\n <ul>\n @for (item of tree; track $index) {\n <li [style.--level]=\"item.level\">\n @if (item.link) {\n <a\n routerLinkActive=\"example-active\"\n queryParamsHandling=\"merge\"\n [routerLink]=\"'/overview/' + item.link\"\n >\n {{ item.label }}\n </a>\n } @else {\n {{ item.label }}\n }\n </li>\n }\n </ul>\n </div>\n }\n @if (!showContent && isCollapsed) {\n <div class=\"component-list-text\">\n <span>Examples</span>\n </div>\n }\n</nav>\n<main aria-label=\"Live preview\">\n <si-live-preview />\n</main>\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(--element-button-focus-width) solid var(--si-sys-color-effects-focus);outline-offset:var(--element-button-focus-overlay-width)}:host{display:flex;flex-direction:row;background-color:var(--si-sys-color-background-0)}.component-list{border-inline-end:1px solid var(--si-sys-color-border-4);display:flex;flex:0 0 auto;inline-size:400px;flex-direction:column;transition:inline-size .5s;color:var(--si-sys-color-text-primary)}.component-list.is-collapsed{inline-size:40px;overflow:hidden;background-color:var(--si-sys-color-background-0)}.component-list.is-collapsed .component-list-text{transform:rotate(-90deg);margin-block:auto 2em;word-wrap:normal}.component-list.is-collapsed .collapse-icon{transform:rotate(180deg)}.component-list .component-list-header{display:flex;flex-direction:column;justify-content:center;padding-block:10px;padding-inline:8px;background-color:var(--si-sys-color-background-0);position:relative;block-size:36px}.component-list .component-list-header .collapse-button{background-color:transparent;border:0;padding:4px;position:absolute;inset-inline-end:2px;inset-block-start:4px;inline-size:32px;block-size:32px;cursor:pointer;color:var(--si-sys-color-text-primary)}.component-list .component-list-header .collapse-button>svg{block-size:20px;fill:currentColor}.component-list .component-list-header .collapse-button:hover{color:var(--si-sys-color-text-accent-hover)}.component-list .search-bar{display:flex;margin-block:10px;margin-inline:8px;position:relative;block-size:38px}.component-list .search-bar input{flex:1;padding-block:8px;padding-inline:28px 12px;border:1px solid var(--si-sys-color-border-4);font-size:14px;background:var(--si-sys-color-background-0);color:var(--si-sys-color-text-primary)}.component-list .search-bar .search-bar-icon{position:absolute;inset-block-start:8px;inset-inline-start:6px;fill:var(--si-sys-color-text-primary);block-size:20px}.component-list .search-bar .cancel-button{background-color:transparent;border:0;font-size:20px;line-height:20px;padding:0;pointer-events:auto;position:absolute;inset-inline-end:8px;inset-block-start:8px}.component-list .search-bar .cancel-button>svg{block-size:20px;fill:var(--si-sys-color-text-primary)}.component-list .available-examples{flex:1 1 0;min-block-size:0;overflow-y:auto;padding-block-start:10px;border-block-start:1px solid var(--si-sys-color-border-4)}.component-list .available-examples ul{margin-block:0 16px;margin-inline:0;padding-inline-start:16px;list-style:none}.component-list .available-examples li{margin-inline-start:calc(var(--level) * 16px);padding-block:4px}.example-active{font-weight:600}a{text-decoration:none}main{flex:1 1 auto;display:flex;overflow:hidden}@media(prefers-color-scheme:dark){si-example-overview{color-scheme:dark}}\n"] }]
|
|
1385
1526
|
}] });
|
|
1386
1527
|
|
|
1387
1528
|
const setDeviceMode = (mode) => {
|
|
@@ -1538,12 +1679,23 @@ DummyAppSampleComponent = __decorate([
|
|
|
1538
1679
|
class SiLivePreviewRendererComponent {
|
|
1539
1680
|
renderedExample = viewChild.required('renderedExample', { ...(ngDevMode ? { debugName: "renderedExample" } : /* istanbul ignore next */ {}), read: ViewContainerRef });
|
|
1540
1681
|
react = viewChild.required('react', { ...(ngDevMode ? { debugName: "react" } : /* istanbul ignore next */ {}), read: ElementRef });
|
|
1541
|
-
|
|
1682
|
+
state = inject(LivePreviewStateService);
|
|
1683
|
+
config = inject(SI_LIVE_PREVIEW_CONFIG);
|
|
1684
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
1685
|
+
compiler = inject(Compiler);
|
|
1686
|
+
injector = Injector.create({
|
|
1687
|
+
parent: inject(Injector),
|
|
1688
|
+
providers: [
|
|
1689
|
+
{
|
|
1690
|
+
provide: LOG_EVENT,
|
|
1691
|
+
useValue: (...msg) => this.logMessage.emit(this.stringifyLog(msg))
|
|
1692
|
+
}
|
|
1693
|
+
]
|
|
1694
|
+
});
|
|
1695
|
+
rendererFactory = inject(_DomRendererFactory2);
|
|
1696
|
+
cdRef = inject(ChangeDetectorRef);
|
|
1697
|
+
exampleUrl = computed(() => this.config.examplesBaseUrl + this.state.example(), /* @ts-ignore */
|
|
1542
1698
|
...(ngDevMode ? [{ debugName: "exampleUrl" }] : /* istanbul ignore next */ []));
|
|
1543
|
-
dataId = input('', /* @ts-ignore */
|
|
1544
|
-
...(ngDevMode ? [{ debugName: "dataId" }] : /* istanbul ignore next */ []));
|
|
1545
|
-
template = input('', /* @ts-ignore */
|
|
1546
|
-
...(ngDevMode ? [{ debugName: "template" }] : /* istanbul ignore next */ []));
|
|
1547
1699
|
renderingDone = signal(false, /* @ts-ignore */
|
|
1548
1700
|
...(ngDevMode ? [{ debugName: "renderingDone" }] : /* istanbul ignore next */ []));
|
|
1549
1701
|
templateFromComponent = output();
|
|
@@ -1559,20 +1711,6 @@ class SiLivePreviewRendererComponent {
|
|
|
1559
1711
|
dynamicComponentId;
|
|
1560
1712
|
componentTsFirstLoad = true;
|
|
1561
1713
|
compiledTemplate;
|
|
1562
|
-
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
1563
|
-
compiler = inject(Compiler);
|
|
1564
|
-
injector = Injector.create({
|
|
1565
|
-
parent: inject(Injector),
|
|
1566
|
-
providers: [
|
|
1567
|
-
{
|
|
1568
|
-
provide: LOG_EVENT,
|
|
1569
|
-
useValue: (...msg) => this.logMessage.emit(this.stringifyLog(msg))
|
|
1570
|
-
}
|
|
1571
|
-
]
|
|
1572
|
-
});
|
|
1573
|
-
rendererFactory = inject(_DomRendererFactory2);
|
|
1574
|
-
config = inject(SI_LIVE_PREVIEW_CONFIG);
|
|
1575
|
-
cdRef = inject(ChangeDetectorRef);
|
|
1576
1714
|
constructor() {
|
|
1577
1715
|
effect(() => {
|
|
1578
1716
|
const url = this.exampleUrl();
|
|
@@ -1581,8 +1719,8 @@ class SiLivePreviewRendererComponent {
|
|
|
1581
1719
|
}
|
|
1582
1720
|
});
|
|
1583
1721
|
effect(() => {
|
|
1584
|
-
const template = this.template();
|
|
1585
|
-
// when the initial template is pushed from the renderer to the editor, this.template is
|
|
1722
|
+
const template = this.state.template();
|
|
1723
|
+
// when the initial template is pushed from the renderer to the editor, this.state.template is
|
|
1586
1724
|
// initially empty, but later changes to what the renderer has pushed out. In this case
|
|
1587
1725
|
// don't compile
|
|
1588
1726
|
if (template && template !== this.compiledTemplate) {
|
|
@@ -1635,7 +1773,7 @@ class SiLivePreviewRendererComponent {
|
|
|
1635
1773
|
this.componentTsSampleComponent = m.SampleComponent;
|
|
1636
1774
|
this.dynamicComponent = m.SampleComponent;
|
|
1637
1775
|
this.compileWhenReady();
|
|
1638
|
-
if (!this.componentTsSampleComponent && !this.template()) {
|
|
1776
|
+
if (!this.componentTsSampleComponent && !this.state.template()) {
|
|
1639
1777
|
afterNextRender(() => {
|
|
1640
1778
|
this.setInProgress(false);
|
|
1641
1779
|
this.cdRef.markForCheck();
|
|
@@ -1668,12 +1806,12 @@ class SiLivePreviewRendererComponent {
|
|
|
1668
1806
|
// TS, but code not yet loaded
|
|
1669
1807
|
return;
|
|
1670
1808
|
}
|
|
1671
|
-
if (!this.componentTsFirstLoad && !this.template()) {
|
|
1809
|
+
if (!this.componentTsFirstLoad && !this.state.template()) {
|
|
1672
1810
|
// TS, first load done, template not yet available
|
|
1673
1811
|
return;
|
|
1674
1812
|
}
|
|
1675
1813
|
}
|
|
1676
|
-
else if (!this.template()) {
|
|
1814
|
+
else if (!this.state.template()) {
|
|
1677
1815
|
// no TS, no template
|
|
1678
1816
|
return;
|
|
1679
1817
|
}
|
|
@@ -1714,17 +1852,17 @@ class SiLivePreviewRendererComponent {
|
|
|
1714
1852
|
if (ann) {
|
|
1715
1853
|
const supportsLandscape = ann.providers?.includes(LandscapeSupportService);
|
|
1716
1854
|
this.supportsLandscapeMode.emit(supportsLandscape);
|
|
1717
|
-
if (this.componentTsFirstLoad && !this.template()) {
|
|
1855
|
+
if (this.componentTsFirstLoad && !this.state.template()) {
|
|
1718
1856
|
// skipping compile on first load
|
|
1719
1857
|
this.compiledTemplate = ann.template;
|
|
1720
1858
|
this.templateFromComponent.emit(ann.template);
|
|
1721
1859
|
}
|
|
1722
|
-
else if (ann.template !== this.template()) {
|
|
1860
|
+
else if (ann.template !== this.state.template()) {
|
|
1723
1861
|
// recompile with new template
|
|
1724
1862
|
this.componentTsFirstLoad = false;
|
|
1725
1863
|
this.cloneComponentWithoutIvyStuff();
|
|
1726
|
-
ann.template = this.template();
|
|
1727
|
-
this.compiledTemplate = this.template();
|
|
1864
|
+
ann.template = this.state.template();
|
|
1865
|
+
this.compiledTemplate = this.state.template();
|
|
1728
1866
|
_compileComponent(this.dynamicComponent, ann);
|
|
1729
1867
|
this.reuseResolvedScopeOfOriginalComponent();
|
|
1730
1868
|
}
|
|
@@ -1828,7 +1966,7 @@ class SiLivePreviewRendererComponent {
|
|
|
1828
1966
|
});
|
|
1829
1967
|
}
|
|
1830
1968
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SiLivePreviewRendererComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1831
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.0.8", type: SiLivePreviewRendererComponent, isStandalone: true, selector: "si-live-preview-renderer",
|
|
1969
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.0.8", type: SiLivePreviewRendererComponent, isStandalone: true, selector: "si-live-preview-renderer", outputs: { templateFromComponent: "templateFromComponent", logClear: "logClear", logMessage: "logMessage", logRenderingError: "logRenderingError", inProgress: "inProgress", supportsLandscapeMode: "supportsLandscapeMode" }, host: { properties: { "class.live-preview-done": "renderingDone()", "attr.data-example": "exampleUrl()", "attr.data-id": "state.dataId()" } }, viewQueries: [{ propertyName: "renderedExample", first: true, predicate: ["renderedExample"], descendants: true, read: ViewContainerRef, isSignal: true }, { propertyName: "react", first: true, predicate: ["react"], descendants: true, read: ElementRef, isSignal: true }], ngImport: i0, template: '<div #renderedExample></div><div #react id="app"></div>', isInline: true, changeDetection: i0.ChangeDetectionStrategy.Eager });
|
|
1832
1970
|
}
|
|
1833
1971
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SiLivePreviewRendererComponent, decorators: [{
|
|
1834
1972
|
type: Component,
|
|
@@ -1839,10 +1977,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImpor
|
|
|
1839
1977
|
host: {
|
|
1840
1978
|
'[class.live-preview-done]': 'renderingDone()',
|
|
1841
1979
|
'[attr.data-example]': 'exampleUrl()',
|
|
1842
|
-
'[attr.data-id]': 'dataId()'
|
|
1980
|
+
'[attr.data-id]': 'state.dataId()'
|
|
1843
1981
|
}
|
|
1844
1982
|
}]
|
|
1845
|
-
}], ctorParameters: () => [], propDecorators: { renderedExample: [{ type: i0.ViewChild, args: ['renderedExample', { ...{ read: ViewContainerRef }, isSignal: true }] }], react: [{ type: i0.ViewChild, args: ['react', { ...{ read: ElementRef }, isSignal: true }] }],
|
|
1983
|
+
}], ctorParameters: () => [], propDecorators: { renderedExample: [{ type: i0.ViewChild, args: ['renderedExample', { ...{ read: ViewContainerRef }, isSignal: true }] }], react: [{ type: i0.ViewChild, args: ['react', { ...{ read: ElementRef }, isSignal: true }] }], templateFromComponent: [{ type: i0.Output, args: ["templateFromComponent"] }], logClear: [{ type: i0.Output, args: ["logClear"] }], logMessage: [{ type: i0.Output, args: ["logMessage"] }], logRenderingError: [{ type: i0.Output, args: ["logRenderingError"] }], inProgress: [{ type: i0.Output, args: ["inProgress"] }], supportsLandscapeMode: [{ type: i0.Output, args: ["supportsLandscapeMode"] }] } });
|
|
1846
1984
|
|
|
1847
1985
|
/**
|
|
1848
1986
|
* Copyright (c) Siemens 2016 - 2026
|
|
@@ -1851,34 +1989,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImpor
|
|
|
1851
1989
|
class SiExampleViewerComponent {
|
|
1852
1990
|
router = inject(Router);
|
|
1853
1991
|
route = inject(ActivatedRoute);
|
|
1854
|
-
config = inject(SI_LIVE_PREVIEW_CONFIG);
|
|
1855
1992
|
internalConfig = inject(SI_LIVE_PREVIEW_INTERNALS);
|
|
1856
1993
|
themeApi = inject(SiLivePreviewThemeApi, { optional: true });
|
|
1857
1994
|
localeApi = inject(SiLivePreviewLocaleApi, { optional: true });
|
|
1995
|
+
state = inject(LivePreviewStateService);
|
|
1858
1996
|
renderer = viewChild.required('renderer', /* @ts-ignore */
|
|
1859
1997
|
...(ngDevMode ? [{ debugName: "renderer" }] : /* istanbul ignore next */ []));
|
|
1860
|
-
ticketBaseUrl = this.config.ticketBaseUrl;
|
|
1861
|
-
baseUrl = this.config.examplesBaseUrl;
|
|
1862
|
-
exampleUrl = signal('', /* @ts-ignore */
|
|
1863
|
-
...(ngDevMode ? [{ debugName: "exampleUrl" }] : /* istanbul ignore next */ []));
|
|
1864
|
-
dataId = signal('', /* @ts-ignore */
|
|
1865
|
-
...(ngDevMode ? [{ debugName: "dataId" }] : /* istanbul ignore next */ []));
|
|
1866
1998
|
mode = signal('viewer', /* @ts-ignore */
|
|
1867
1999
|
...(ngDevMode ? [{ debugName: "mode" }] : /* istanbul ignore next */ []));
|
|
1868
|
-
theme = signal('light', /* @ts-ignore */
|
|
1869
|
-
...(ngDevMode ? [{ debugName: "theme" }] : /* istanbul ignore next */ []));
|
|
1870
|
-
locale = signal('', /* @ts-ignore */
|
|
1871
|
-
...(ngDevMode ? [{ debugName: "locale" }] : /* istanbul ignore next */ []));
|
|
1872
|
-
isRTL = signal(false, /* @ts-ignore */
|
|
1873
|
-
...(ngDevMode ? [{ debugName: "isRTL" }] : /* istanbul ignore next */ []));
|
|
1874
|
-
template = signal('', /* @ts-ignore */
|
|
1875
|
-
...(ngDevMode ? [{ debugName: "template" }] : /* istanbul ignore next */ []));
|
|
1876
|
-
reactTemplate = signal('', /* @ts-ignore */
|
|
1877
|
-
...(ngDevMode ? [{ debugName: "reactTemplate" }] : /* istanbul ignore next */ []));
|
|
1878
|
-
vueTemplate = signal('', /* @ts-ignore */
|
|
1879
|
-
...(ngDevMode ? [{ debugName: "vueTemplate" }] : /* istanbul ignore next */ []));
|
|
1880
|
-
jsTemplate = signal('', /* @ts-ignore */
|
|
1881
|
-
...(ngDevMode ? [{ debugName: "jsTemplate" }] : /* istanbul ignore next */ []));
|
|
1882
2000
|
tabs = signal([], /* @ts-ignore */
|
|
1883
2001
|
...(ngDevMode ? [{ debugName: "tabs" }] : /* istanbul ignore next */ []));
|
|
1884
2002
|
hasTabs = computed(() => this.tabs().length > 1, /* @ts-ignore */
|
|
@@ -1896,10 +2014,12 @@ class SiExampleViewerComponent {
|
|
|
1896
2014
|
let recompile = false;
|
|
1897
2015
|
const base = params.base ? params.base + '/' : '';
|
|
1898
2016
|
if (params.e) {
|
|
1899
|
-
const prevUrl = this.
|
|
2017
|
+
const prevUrl = this.state.example();
|
|
2018
|
+
const previousTemplate = this.state.template();
|
|
1900
2019
|
this.tabs.set([]);
|
|
1901
2020
|
this.activeTabIndex.set(0);
|
|
1902
|
-
this.
|
|
2021
|
+
this.state.example.set('');
|
|
2022
|
+
this.state.clearTemplates();
|
|
1903
2023
|
const examples = Array.isArray(params.e) ? params.e : [params.e];
|
|
1904
2024
|
examples.forEach(element => {
|
|
1905
2025
|
const parts = element.split(';');
|
|
@@ -1914,21 +2034,21 @@ class SiExampleViewerComponent {
|
|
|
1914
2034
|
});
|
|
1915
2035
|
if (this.tabs().length) {
|
|
1916
2036
|
this.activateTab(0);
|
|
1917
|
-
recompile = prevUrl === this.
|
|
2037
|
+
recompile = prevUrl === this.state.example();
|
|
1918
2038
|
}
|
|
1919
2039
|
if (this.tabs().length <= 1 && params.t) {
|
|
1920
2040
|
if (params.framework === 'react') {
|
|
1921
|
-
this.
|
|
2041
|
+
this.state.templateReact.set(params.t);
|
|
1922
2042
|
}
|
|
1923
2043
|
else if (params.framework === 'vue') {
|
|
1924
|
-
this.
|
|
2044
|
+
this.state.templateVue.set(params.t);
|
|
1925
2045
|
}
|
|
1926
2046
|
else if (params.framework === 'js') {
|
|
1927
|
-
this.
|
|
2047
|
+
this.state.templateJs.set(params.t);
|
|
1928
2048
|
}
|
|
1929
2049
|
else {
|
|
1930
|
-
recompile = recompile ||
|
|
1931
|
-
this.template.set(params.t);
|
|
2050
|
+
recompile = recompile || previousTemplate !== params.t;
|
|
2051
|
+
this.state.template.set(params.t);
|
|
1932
2052
|
}
|
|
1933
2053
|
}
|
|
1934
2054
|
handled = true;
|
|
@@ -1958,8 +2078,8 @@ class SiExampleViewerComponent {
|
|
|
1958
2078
|
this.router.navigate([], { queryParams: newParams });
|
|
1959
2079
|
}
|
|
1960
2080
|
if (params.id) {
|
|
1961
|
-
recompile = this.dataId() !== params.id;
|
|
1962
|
-
this.dataId.set(params.id);
|
|
2081
|
+
recompile = this.state.dataId() !== params.id;
|
|
2082
|
+
this.state.dataId.set(params.id);
|
|
1963
2083
|
}
|
|
1964
2084
|
if (recompile) {
|
|
1965
2085
|
this.renderer()?.recompile();
|
|
@@ -1971,7 +2091,7 @@ class SiExampleViewerComponent {
|
|
|
1971
2091
|
}
|
|
1972
2092
|
setTheme(theme) {
|
|
1973
2093
|
if (this.mode() === 'editor') {
|
|
1974
|
-
this.theme.set(theme);
|
|
2094
|
+
this.state.theme.set(theme);
|
|
1975
2095
|
}
|
|
1976
2096
|
if (this.themeApi) {
|
|
1977
2097
|
this.themeApi.setThemeFromPreviewer(theme);
|
|
@@ -1979,14 +2099,14 @@ class SiExampleViewerComponent {
|
|
|
1979
2099
|
this.setUiTheme(theme);
|
|
1980
2100
|
}
|
|
1981
2101
|
setRTL(rtl) {
|
|
1982
|
-
this.isRTL.set(rtl);
|
|
2102
|
+
this.state.isRTL.set(rtl);
|
|
1983
2103
|
if (this.mode() !== 'editor') {
|
|
1984
2104
|
setDirectionRtl(rtl);
|
|
1985
2105
|
}
|
|
1986
2106
|
}
|
|
1987
2107
|
setLocale(locale) {
|
|
1988
2108
|
if (this.mode() === 'editor') {
|
|
1989
|
-
this.locale.set(locale);
|
|
2109
|
+
this.state.locale.set(locale);
|
|
1990
2110
|
return;
|
|
1991
2111
|
}
|
|
1992
2112
|
if (this.localeApi) {
|
|
@@ -1996,17 +2116,17 @@ class SiExampleViewerComponent {
|
|
|
1996
2116
|
activateTab(index) {
|
|
1997
2117
|
const example = this.tabs()[index].example;
|
|
1998
2118
|
this.activeTabIndex.set(index);
|
|
1999
|
-
this.
|
|
2119
|
+
this.state.example.set(this.tabs()[index].base + example);
|
|
2000
2120
|
}
|
|
2001
2121
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SiExampleViewerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2002
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.8", type: SiExampleViewerComponent, isStandalone: true, selector: "si-example-viewer", host: { properties: { "class.has-tabs": "hasTabs()", "class.has-tabs-mobile": "hasTabsMobile()" } }, viewQueries: [{ propertyName: "renderer", first: true, predicate: ["renderer"], descendants: true, isSignal: true }], ngImport: i0, template: "<div class=\"wrapper\">\n @if (!
|
|
2122
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.8", type: SiExampleViewerComponent, isStandalone: true, selector: "si-example-viewer", host: { properties: { "class.has-tabs": "hasTabs()", "class.has-tabs-mobile": "hasTabsMobile()" } }, viewQueries: [{ propertyName: "renderer", first: true, predicate: ["renderer"], descendants: true, isSignal: true }], ngImport: i0, template: "<div class=\"wrapper\">\n @if (!state.example() && !state.template()) {\n <p class=\"text-information\" style=\"margin: 1em\">\n No example specified. Head to\n <strong><a href=\"#/overview\">/overview</a></strong>\n for a list of them.\n </p>\n }\n @if (\n (state.template() || state.templateReact() || state.templateVue() || state.templateJs()) &&\n mode() === 'editor'\n ) {\n <p class=\"text-information\" style=\"margin: 1em\">\n This is an adopted example built from the URL. Head to\n <strong><a href=\"#/overview\">/overview</a></strong> for a list of examples.\n </p>\n }\n @if (tabs().length > 1) {\n <div class=\"tab-wrapper\">\n <div role=\"tablist\" class=\"nav lp-tabs\">\n @for (tab of tabs(); track $index) {\n <button\n type=\"button\"\n role=\"tab\"\n class=\"tab-item tab-link focus-inside\"\n [class.tab-active]=\"activeTabIndex() === $index\"\n (click)=\"activateTab($index)\"\n (keydown.enter)=\"activateTab($index)\"\n >\n {{ tab.heading }}\n </button>\n }\n </div>\n </div>\n }\n</div>\n\n@if (mode() !== 'editor') {\n <si-live-preview-renderer #renderer />\n} @else {\n <si-live-preview />\n}\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(--element-button-focus-width))}.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(--element-button-focus-width) solid var(--si-sys-color-effects-focus);outline-offset:var(--element-button-focus-overlay-width)}.wrapper{background-color:var(--si-sys-color-background-0);color:var(--si-sys-color-text-primary)}.wrapper.has-tabs .tab-wrapper,.wrapper.has-tabs-mobile{background-color:var(--si-sys-color-background-0)}.tab-wrapper{margin-block-end:10px;border-block-end:1px solid var(--si-sys-color-border-4)}si-live-preview-renderer{flex:1;transform:translate(0)}\n"], dependencies: [{ kind: "component", type: SiLivePreviewComponent, selector: "si-live-preview" }, { kind: "component", type: SiLivePreviewRendererComponent, selector: "si-live-preview-renderer", outputs: ["templateFromComponent", "logClear", "logMessage", "logRenderingError", "inProgress", "supportsLandscapeMode"] }], changeDetection: i0.ChangeDetectionStrategy.Eager });
|
|
2003
2123
|
}
|
|
2004
2124
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SiExampleViewerComponent, decorators: [{
|
|
2005
2125
|
type: Component,
|
|
2006
2126
|
args: [{ selector: 'si-example-viewer', imports: [SiLivePreviewComponent, SiLivePreviewRendererComponent], changeDetection: ChangeDetectionStrategy.Eager, host: {
|
|
2007
2127
|
'[class.has-tabs]': 'hasTabs()',
|
|
2008
2128
|
'[class.has-tabs-mobile]': 'hasTabsMobile()'
|
|
2009
|
-
}, template: "<div class=\"wrapper\">\n @if (!
|
|
2129
|
+
}, template: "<div class=\"wrapper\">\n @if (!state.example() && !state.template()) {\n <p class=\"text-information\" style=\"margin: 1em\">\n No example specified. Head to\n <strong><a href=\"#/overview\">/overview</a></strong>\n for a list of them.\n </p>\n }\n @if (\n (state.template() || state.templateReact() || state.templateVue() || state.templateJs()) &&\n mode() === 'editor'\n ) {\n <p class=\"text-information\" style=\"margin: 1em\">\n This is an adopted example built from the URL. Head to\n <strong><a href=\"#/overview\">/overview</a></strong> for a list of examples.\n </p>\n }\n @if (tabs().length > 1) {\n <div class=\"tab-wrapper\">\n <div role=\"tablist\" class=\"nav lp-tabs\">\n @for (tab of tabs(); track $index) {\n <button\n type=\"button\"\n role=\"tab\"\n class=\"tab-item tab-link focus-inside\"\n [class.tab-active]=\"activeTabIndex() === $index\"\n (click)=\"activateTab($index)\"\n (keydown.enter)=\"activateTab($index)\"\n >\n {{ tab.heading }}\n </button>\n }\n </div>\n </div>\n }\n</div>\n\n@if (mode() !== 'editor') {\n <si-live-preview-renderer #renderer />\n} @else {\n <si-live-preview />\n}\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(--element-button-focus-width))}.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(--element-button-focus-width) solid var(--si-sys-color-effects-focus);outline-offset:var(--element-button-focus-overlay-width)}.wrapper{background-color:var(--si-sys-color-background-0);color:var(--si-sys-color-text-primary)}.wrapper.has-tabs .tab-wrapper,.wrapper.has-tabs-mobile{background-color:var(--si-sys-color-background-0)}.tab-wrapper{margin-block-end:10px;border-block-end:1px solid var(--si-sys-color-border-4)}si-live-preview-renderer{flex:1;transform:translate(0)}\n"] }]
|
|
2010
2130
|
}], ctorParameters: () => [], propDecorators: { renderer: [{ type: i0.ViewChild, args: ['renderer', { isSignal: true }] }] } });
|
|
2011
2131
|
|
|
2012
2132
|
/**
|
|
@@ -2031,25 +2151,7 @@ class SiLivePreviewWrapperComponent {
|
|
|
2031
2151
|
...(ngDevMode ? [{ debugName: "renderer" }] : /* istanbul ignore next */ []));
|
|
2032
2152
|
webcomponentRenderer = viewChild.required('webcomponentRenderer', /* @ts-ignore */
|
|
2033
2153
|
...(ngDevMode ? [{ debugName: "webcomponentRenderer" }] : /* istanbul ignore next */ []));
|
|
2034
|
-
|
|
2035
|
-
...(ngDevMode ? [{ debugName: "exampleUrl" }] : /* istanbul ignore next */ []));
|
|
2036
|
-
template = signal('', /* @ts-ignore */
|
|
2037
|
-
...(ngDevMode ? [{ debugName: "template" }] : /* istanbul ignore next */ []));
|
|
2038
|
-
loadReact = signal(false, /* @ts-ignore */
|
|
2039
|
-
...(ngDevMode ? [{ debugName: "loadReact" }] : /* istanbul ignore next */ []));
|
|
2040
|
-
loadVue = signal(false, /* @ts-ignore */
|
|
2041
|
-
...(ngDevMode ? [{ debugName: "loadVue" }] : /* istanbul ignore next */ []));
|
|
2042
|
-
loadJs = signal(false, /* @ts-ignore */
|
|
2043
|
-
...(ngDevMode ? [{ debugName: "loadJs" }] : /* istanbul ignore next */ []));
|
|
2044
|
-
webcomponentTemplateCode = signal('', /* @ts-ignore */
|
|
2045
|
-
...(ngDevMode ? [{ debugName: "webcomponentTemplateCode" }] : /* istanbul ignore next */ []));
|
|
2046
|
-
isMobile = false;
|
|
2047
|
-
theme;
|
|
2048
|
-
isRTL = false;
|
|
2049
|
-
mode;
|
|
2050
|
-
locale;
|
|
2051
|
-
rootFontSize;
|
|
2052
|
-
initialUrl;
|
|
2154
|
+
state = inject(LivePreviewStateService);
|
|
2053
2155
|
config = inject(SI_LIVE_PREVIEW_CONFIG);
|
|
2054
2156
|
themeApi = inject(SiLivePreviewThemeApi, { optional: true });
|
|
2055
2157
|
localeApi = inject(SiLivePreviewLocaleApi, { optional: true });
|
|
@@ -2059,21 +2161,23 @@ class SiLivePreviewWrapperComponent {
|
|
|
2059
2161
|
optional: true
|
|
2060
2162
|
});
|
|
2061
2163
|
cdRef = inject(ChangeDetectorRef);
|
|
2164
|
+
isMobile = false;
|
|
2165
|
+
initialUrl;
|
|
2062
2166
|
constructor() {
|
|
2063
2167
|
this.themeApi
|
|
2064
2168
|
?.getApplicationThemeObservable()
|
|
2065
2169
|
.pipe(takeUntilDestroyed())
|
|
2066
2170
|
.subscribe(theme => {
|
|
2067
|
-
this.theme
|
|
2068
|
-
this.sendMessage('theme',
|
|
2171
|
+
this.state.theme.set(theme);
|
|
2172
|
+
this.sendMessage('theme', theme);
|
|
2069
2173
|
});
|
|
2070
2174
|
this.localeApi
|
|
2071
2175
|
?.getLocale()
|
|
2072
2176
|
.pipe(takeUntilDestroyed())
|
|
2073
2177
|
.subscribe(locale => {
|
|
2074
|
-
if (this.locale !== locale) {
|
|
2075
|
-
this.locale
|
|
2076
|
-
this.sendMessage('locale',
|
|
2178
|
+
if (this.state.locale() !== locale) {
|
|
2179
|
+
this.state.locale.set(locale);
|
|
2180
|
+
this.sendMessage('locale', locale);
|
|
2077
2181
|
}
|
|
2078
2182
|
});
|
|
2079
2183
|
this.initialUrl = window.location.toString();
|
|
@@ -2094,41 +2198,37 @@ class SiLivePreviewWrapperComponent {
|
|
|
2094
2198
|
this.ngZone.run(() => this.onMessageInZone(event));
|
|
2095
2199
|
}
|
|
2096
2200
|
onMessageInZone(event) {
|
|
2097
|
-
this.
|
|
2098
|
-
this.
|
|
2099
|
-
this.
|
|
2100
|
-
this.loadVue.set(event.data.loadVue);
|
|
2101
|
-
this.loadJs.set(event.data.loadJs);
|
|
2102
|
-
this.webcomponentTemplateCode.set(event.data.reactVueTemplate);
|
|
2103
|
-
if (this.theme !== event.data.theme) {
|
|
2201
|
+
const modeChanged = this.state.viewport().mode !== event.data.mode;
|
|
2202
|
+
this.state.applyRenderRequest(event.data);
|
|
2203
|
+
if (this.state.theme() !== event.data.theme) {
|
|
2104
2204
|
this.setTheme(event.data.theme);
|
|
2105
2205
|
}
|
|
2106
|
-
if (this.locale !== event.data.locale) {
|
|
2206
|
+
if (this.state.locale() !== event.data.locale) {
|
|
2107
2207
|
this.setLocale(event.data.locale);
|
|
2108
2208
|
}
|
|
2109
|
-
if (this.rootFontSize !== event.data.rootFontSize) {
|
|
2110
|
-
this.rootFontSize
|
|
2209
|
+
if (this.state.rootFontSize() !== event.data.rootFontSize) {
|
|
2210
|
+
this.state.rootFontSize.set(event.data.rootFontSize);
|
|
2111
2211
|
setRootFontSize(event.data.rootFontSize);
|
|
2112
2212
|
}
|
|
2113
|
-
if (this.isRTL !== event.data.isRTL) {
|
|
2213
|
+
if (this.state.isRTL() !== event.data.isRTL) {
|
|
2114
2214
|
this.setRTL(event.data.isRTL);
|
|
2115
2215
|
}
|
|
2116
2216
|
if (this.isMobile) {
|
|
2117
2217
|
this.setSafeArea(event.data.safeAreaTop, event.data.safeAreaBottom, event.data.safeAreaLeft, event.data.safeAreaRight);
|
|
2118
2218
|
}
|
|
2119
|
-
if (
|
|
2120
|
-
|
|
2121
|
-
setDeviceMode(this.mode);
|
|
2219
|
+
if (modeChanged && this.isMobile) {
|
|
2220
|
+
setDeviceMode(event.data.mode);
|
|
2122
2221
|
this.renderer().recompile();
|
|
2123
2222
|
}
|
|
2124
2223
|
const webcomponentRenderer = this.webcomponentRenderer();
|
|
2125
|
-
if (webcomponentRenderer &&
|
|
2224
|
+
if (webcomponentRenderer &&
|
|
2225
|
+
(this.state.loadReact() || this.state.loadVue() || this.state.loadJs())) {
|
|
2126
2226
|
this.webcomponentService?.injectComponent(webcomponentRenderer, {
|
|
2127
|
-
exampleUrl: this.
|
|
2128
|
-
loadReact: this.loadReact(),
|
|
2129
|
-
loadJs: this.loadJs(),
|
|
2130
|
-
webcomponentTemplateCode: this.
|
|
2131
|
-
loadVue: this.loadVue(),
|
|
2227
|
+
exampleUrl: this.config.examplesBaseUrl + this.state.example(),
|
|
2228
|
+
loadReact: this.state.loadReact(),
|
|
2229
|
+
loadJs: this.state.loadJs(),
|
|
2230
|
+
webcomponentTemplateCode: this.state.activeWebComponentTemplate(),
|
|
2231
|
+
loadVue: this.state.loadVue(),
|
|
2132
2232
|
config: this.config
|
|
2133
2233
|
}, {
|
|
2134
2234
|
inProgress: this.sendMessage
|
|
@@ -2154,26 +2254,26 @@ class SiLivePreviewWrapperComponent {
|
|
|
2154
2254
|
window.parent.postMessage({ src: 'renderer', type, message }, '*');
|
|
2155
2255
|
}
|
|
2156
2256
|
setTheme(theme) {
|
|
2157
|
-
this.theme
|
|
2257
|
+
this.state.theme.set(theme);
|
|
2158
2258
|
if (this.themeApi) {
|
|
2159
|
-
this.themeApi.setThemeFromPreviewer(
|
|
2259
|
+
this.themeApi.setThemeFromPreviewer(theme);
|
|
2160
2260
|
}
|
|
2161
2261
|
else {
|
|
2162
|
-
document.documentElement.classList.toggle('app--dark',
|
|
2163
|
-
document.documentElement.classList.toggle('app--light',
|
|
2262
|
+
document.documentElement.classList.toggle('app--dark', theme === 'dark');
|
|
2263
|
+
document.documentElement.classList.toggle('app--light', theme === 'light');
|
|
2164
2264
|
}
|
|
2165
2265
|
}
|
|
2166
2266
|
setRTL(rtl) {
|
|
2167
|
-
this.isRTL
|
|
2267
|
+
this.state.isRTL.set(rtl);
|
|
2168
2268
|
setDirectionRtl(rtl);
|
|
2169
2269
|
}
|
|
2170
2270
|
setLocale(locale) {
|
|
2171
2271
|
if (!locale) {
|
|
2172
2272
|
return;
|
|
2173
2273
|
}
|
|
2174
|
-
this.locale
|
|
2274
|
+
this.state.locale.set(locale);
|
|
2175
2275
|
if (this.localeApi) {
|
|
2176
|
-
this.localeApi.setLocale(
|
|
2276
|
+
this.localeApi.setLocale(locale);
|
|
2177
2277
|
}
|
|
2178
2278
|
}
|
|
2179
2279
|
setSafeArea(top, bottom, left, right) {
|
|
@@ -2184,13 +2284,13 @@ class SiLivePreviewWrapperComponent {
|
|
|
2184
2284
|
htmlTag.style.setProperty('--ion-safe-area-right', (right ?? 0) + 'px');
|
|
2185
2285
|
}
|
|
2186
2286
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SiLivePreviewWrapperComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2187
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.0.8", type: SiLivePreviewWrapperComponent, isStandalone: true, selector: "si-live-preview-wrapper", host: { listeners: { "click": "onClick($event)" } }, viewQueries: [{ propertyName: "renderer", first: true, predicate: ["renderer"], descendants: true, isSignal: true }, { propertyName: "webcomponentRenderer", first: true, predicate: ["webcomponentRenderer"], descendants: true, isSignal: true }], ngImport: i0, template: "<si-live-preview-renderer\n #renderer\n [hidden]=\"loadReact() || loadVue() || loadJs()\"\n
|
|
2287
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.0.8", type: SiLivePreviewWrapperComponent, isStandalone: true, selector: "si-live-preview-wrapper", host: { listeners: { "click": "onClick($event)" } }, viewQueries: [{ propertyName: "renderer", first: true, predicate: ["renderer"], descendants: true, isSignal: true }, { propertyName: "webcomponentRenderer", first: true, predicate: ["webcomponentRenderer"], descendants: true, isSignal: true }], ngImport: i0, template: "<si-live-preview-renderer\n #renderer\n [hidden]=\"state.loadReact() || state.loadVue() || state.loadJs()\"\n (templateFromComponent)=\"sendMessage('templateFromComponent', $event)\"\n (logClear)=\"sendMessage('clear')\"\n (logMessage)=\"sendMessage('log', $event)\"\n (logRenderingError)=\"sendMessage('error', $event)\"\n (inProgress)=\"sendMessage('progress', $event)\"\n (supportsLandscapeMode)=\"sendMessage('landscapeMode', $event)\"\n/>\n\n<div #webcomponentRenderer></div>\n", styles: ["si-live-preview-renderer{flex:1}\n"], dependencies: [{ kind: "component", type: SiLivePreviewRendererComponent, selector: "si-live-preview-renderer", outputs: ["templateFromComponent", "logClear", "logMessage", "logRenderingError", "inProgress", "supportsLandscapeMode"] }], changeDetection: i0.ChangeDetectionStrategy.Eager });
|
|
2188
2288
|
}
|
|
2189
2289
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SiLivePreviewWrapperComponent, decorators: [{
|
|
2190
2290
|
type: Component,
|
|
2191
2291
|
args: [{ selector: 'si-live-preview-wrapper', imports: [SiLivePreviewRendererComponent], changeDetection: ChangeDetectionStrategy.Eager, host: {
|
|
2192
2292
|
'(click)': 'onClick($event)'
|
|
2193
|
-
}, template: "<si-live-preview-renderer\n #renderer\n [hidden]=\"loadReact() || loadVue() || loadJs()\"\n
|
|
2293
|
+
}, template: "<si-live-preview-renderer\n #renderer\n [hidden]=\"state.loadReact() || state.loadVue() || state.loadJs()\"\n (templateFromComponent)=\"sendMessage('templateFromComponent', $event)\"\n (logClear)=\"sendMessage('clear')\"\n (logMessage)=\"sendMessage('log', $event)\"\n (logRenderingError)=\"sendMessage('error', $event)\"\n (inProgress)=\"sendMessage('progress', $event)\"\n (supportsLandscapeMode)=\"sendMessage('landscapeMode', $event)\"\n/>\n\n<div #webcomponentRenderer></div>\n", styles: ["si-live-preview-renderer{flex:1}\n"] }]
|
|
2194
2294
|
}], ctorParameters: () => [], propDecorators: { renderer: [{ type: i0.ViewChild, args: ['renderer', { isSignal: true }] }], webcomponentRenderer: [{ type: i0.ViewChild, args: ['webcomponentRenderer', { isSignal: true }] }] } });
|
|
2195
2295
|
|
|
2196
2296
|
/**
|
|
@@ -2228,6 +2328,163 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImpor
|
|
|
2228
2328
|
}]
|
|
2229
2329
|
}] });
|
|
2230
2330
|
|
|
2331
|
+
/**
|
|
2332
|
+
* Copyright (c) Siemens 2016 - 2026
|
|
2333
|
+
* SPDX-License-Identifier: MIT
|
|
2334
|
+
*/
|
|
2335
|
+
/** A router location that is private to a rendered example application. */
|
|
2336
|
+
class ExampleLocationStrategy extends LocationStrategy {
|
|
2337
|
+
currentPath = '/';
|
|
2338
|
+
state = null;
|
|
2339
|
+
path() {
|
|
2340
|
+
return this.currentPath;
|
|
2341
|
+
}
|
|
2342
|
+
prepareExternalUrl(internal) {
|
|
2343
|
+
return internal;
|
|
2344
|
+
}
|
|
2345
|
+
getState() {
|
|
2346
|
+
return this.state;
|
|
2347
|
+
}
|
|
2348
|
+
pushState(state, _title, url, queryParams) {
|
|
2349
|
+
this.state = state;
|
|
2350
|
+
this.currentPath = url + queryParams;
|
|
2351
|
+
}
|
|
2352
|
+
replaceState(state, _title, url, queryParams) {
|
|
2353
|
+
this.state = state;
|
|
2354
|
+
this.currentPath = url + queryParams;
|
|
2355
|
+
}
|
|
2356
|
+
forward() { }
|
|
2357
|
+
back() { }
|
|
2358
|
+
onPopState(_fn) { }
|
|
2359
|
+
getBaseHref() {
|
|
2360
|
+
return '';
|
|
2361
|
+
}
|
|
2362
|
+
}
|
|
2363
|
+
|
|
2364
|
+
/**
|
|
2365
|
+
* Copyright (c) Siemens 2016 - 2026
|
|
2366
|
+
* SPDX-License-Identifier: MIT
|
|
2367
|
+
*/
|
|
2368
|
+
/**
|
|
2369
|
+
* Runtime shell that renders each example in an independent Angular application.
|
|
2370
|
+
* The example application owns its router and does not modify the live-preview router.
|
|
2371
|
+
*/
|
|
2372
|
+
class SiLivePreviewApplicationRuntimeComponent extends SiLivePreviewRuntimeComponent {
|
|
2373
|
+
applicationConfig = inject(SI_LIVE_PREVIEW_CONFIG);
|
|
2374
|
+
parentInjector = inject(Injector);
|
|
2375
|
+
exampleComponentRef;
|
|
2376
|
+
applicationRef;
|
|
2377
|
+
hostElement;
|
|
2378
|
+
destroyed = false;
|
|
2379
|
+
ngAfterViewInit() {
|
|
2380
|
+
this.createExampleApplication();
|
|
2381
|
+
}
|
|
2382
|
+
ngOnDestroy() {
|
|
2383
|
+
this.destroyed = true;
|
|
2384
|
+
this.exampleComponentRef?.destroy();
|
|
2385
|
+
this.exampleComponentRef = undefined;
|
|
2386
|
+
this.applicationRef?.destroy();
|
|
2387
|
+
this.hostElement?.remove();
|
|
2388
|
+
}
|
|
2389
|
+
async createExampleApplication() {
|
|
2390
|
+
try {
|
|
2391
|
+
const locationStrategy = new ExampleLocationStrategy();
|
|
2392
|
+
const configuredApplication = this.applicationConfig.exampleApplicationConfig;
|
|
2393
|
+
const exampleApplicationConfig = typeof configuredApplication === 'function'
|
|
2394
|
+
? configuredApplication(this.parentInjector)
|
|
2395
|
+
: configuredApplication;
|
|
2396
|
+
this.applicationRef = await createApplication({
|
|
2397
|
+
...exampleApplicationConfig,
|
|
2398
|
+
providers: [
|
|
2399
|
+
...(exampleApplicationConfig?.providers ?? []),
|
|
2400
|
+
provideRouter([], withDisabledInitialNavigation()),
|
|
2401
|
+
{ provide: LocationStrategy, useValue: locationStrategy },
|
|
2402
|
+
{
|
|
2403
|
+
provide: Location,
|
|
2404
|
+
useFactory: () => new Location(inject(LocationStrategy))
|
|
2405
|
+
},
|
|
2406
|
+
{
|
|
2407
|
+
provide: LOG_EVENT,
|
|
2408
|
+
useFactory: () => this.parentInjector.get(LOG_EVENT)
|
|
2409
|
+
},
|
|
2410
|
+
{
|
|
2411
|
+
provide: ErrorHandler,
|
|
2412
|
+
useValue: { handleError: (error) => this.handleError(error) }
|
|
2413
|
+
}
|
|
2414
|
+
]
|
|
2415
|
+
});
|
|
2416
|
+
if (this.destroyed) {
|
|
2417
|
+
this.applicationRef.destroy();
|
|
2418
|
+
return;
|
|
2419
|
+
}
|
|
2420
|
+
this.exampleComponentRef = createComponent(this.component(), {
|
|
2421
|
+
environmentInjector: this.applicationRef.injector
|
|
2422
|
+
});
|
|
2423
|
+
this.hostElement = this.exampleComponentRef.location.nativeElement;
|
|
2424
|
+
const anchor = this.container().element.nativeElement;
|
|
2425
|
+
anchor.parentNode?.insertBefore(this.hostElement, anchor);
|
|
2426
|
+
const exampleRoutes = this.exampleComponentRef.injector.get(SI_LIVE_PREVIEW_EXAMPLE_ROUTES, this.applicationConfig.defaultRoutes ?? [{ path: '**', component: SiDummyComponent }], { self: true });
|
|
2427
|
+
this.applicationRef.injector.get(Router).resetConfig(exampleRoutes);
|
|
2428
|
+
this.applicationRef.attachView(this.exampleComponentRef.hostView);
|
|
2429
|
+
this.applicationRef.tick();
|
|
2430
|
+
this.ready.emit();
|
|
2431
|
+
}
|
|
2432
|
+
catch (error) {
|
|
2433
|
+
this.handleError(error);
|
|
2434
|
+
}
|
|
2435
|
+
}
|
|
2436
|
+
handleError(error) {
|
|
2437
|
+
this.renderingError.emit(error instanceof Error ? error : new Error(String(error)));
|
|
2438
|
+
}
|
|
2439
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SiLivePreviewApplicationRuntimeComponent, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
2440
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.8", type: SiLivePreviewApplicationRuntimeComponent, isStandalone: true, usesInheritance: true, ngImport: i0 });
|
|
2441
|
+
}
|
|
2442
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SiLivePreviewApplicationRuntimeComponent, decorators: [{
|
|
2443
|
+
type: Directive
|
|
2444
|
+
}] });
|
|
2445
|
+
|
|
2446
|
+
/**
|
|
2447
|
+
* Copyright (c) Siemens 2016 - 2026
|
|
2448
|
+
* SPDX-License-Identifier: MIT
|
|
2449
|
+
*/
|
|
2450
|
+
/** Default shell that renders an example in an independent Angular application. */
|
|
2451
|
+
class SiDefaultLivePreviewApplicationRuntimeComponent extends SiLivePreviewApplicationRuntimeComponent {
|
|
2452
|
+
container = viewChild.required('container', { ...(ngDevMode ? { debugName: "container" } : /* istanbul ignore next */ {}), read: ViewContainerRef });
|
|
2453
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SiDefaultLivePreviewApplicationRuntimeComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
2454
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.0.8", type: SiDefaultLivePreviewApplicationRuntimeComponent, isStandalone: true, selector: "si-live-preview-application-runtime", viewQueries: [{ propertyName: "container", first: true, predicate: ["container"], descendants: true, read: ViewContainerRef, isSignal: true }], usesInheritance: true, ngImport: i0, template: '<ng-container #container />', isInline: true });
|
|
2455
|
+
}
|
|
2456
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SiDefaultLivePreviewApplicationRuntimeComponent, decorators: [{
|
|
2457
|
+
type: Component,
|
|
2458
|
+
args: [{
|
|
2459
|
+
selector: 'si-live-preview-application-runtime',
|
|
2460
|
+
template: '<ng-container #container />'
|
|
2461
|
+
}]
|
|
2462
|
+
}], propDecorators: { container: [{ type: i0.ViewChild, args: ['container', { ...{ read: ViewContainerRef }, isSignal: true }] }] } });
|
|
2463
|
+
|
|
2464
|
+
/**
|
|
2465
|
+
* Copyright (c) Siemens 2016 - 2026
|
|
2466
|
+
* SPDX-License-Identifier: MIT
|
|
2467
|
+
*/
|
|
2468
|
+
/**
|
|
2469
|
+
* Configures live preview with each example rendered in an independent Angular application.
|
|
2470
|
+
*/
|
|
2471
|
+
const provideLivePreview = (config, isMobile = false) => {
|
|
2472
|
+
return makeEnvironmentProviders([
|
|
2473
|
+
provideRouter(livePreviewRoutes, withHashLocation()),
|
|
2474
|
+
{
|
|
2475
|
+
provide: SI_LIVE_PREVIEW_CONFIG,
|
|
2476
|
+
useValue: {
|
|
2477
|
+
...config,
|
|
2478
|
+
runtimeComponent: config.runtimeComponent ?? SiDefaultLivePreviewApplicationRuntimeComponent
|
|
2479
|
+
}
|
|
2480
|
+
},
|
|
2481
|
+
{
|
|
2482
|
+
provide: SI_LIVE_PREVIEW_INTERNALS,
|
|
2483
|
+
useValue: { isMobile, titleBase: 'Overview - Live Preview' }
|
|
2484
|
+
}
|
|
2485
|
+
]);
|
|
2486
|
+
};
|
|
2487
|
+
|
|
2231
2488
|
/**
|
|
2232
2489
|
* Copyright (c) Siemens 2016 - 2026
|
|
2233
2490
|
* SPDX-License-Identifier: MIT
|
|
@@ -2246,15 +2503,13 @@ class SiLivePreviewModule {
|
|
|
2246
2503
|
};
|
|
2247
2504
|
}
|
|
2248
2505
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SiLivePreviewModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
2249
|
-
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "22.0.8", ngImport: i0, type: SiLivePreviewModule
|
|
2250
|
-
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SiLivePreviewModule, providers: [{ provide: REMOVE_STYLES_ON_COMPONENT_DESTROY, useValue: true }]
|
|
2506
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "22.0.8", ngImport: i0, type: SiLivePreviewModule });
|
|
2507
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SiLivePreviewModule, providers: [{ provide: REMOVE_STYLES_ON_COMPONENT_DESTROY, useValue: true }] });
|
|
2251
2508
|
}
|
|
2252
2509
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SiLivePreviewModule, decorators: [{
|
|
2253
2510
|
type: NgModule,
|
|
2254
2511
|
args: [{
|
|
2255
|
-
|
|
2256
|
-
providers: [{ provide: REMOVE_STYLES_ON_COMPONENT_DESTROY, useValue: true }],
|
|
2257
|
-
exports: [SiExampleOverviewComponent, SiExampleViewerComponent]
|
|
2512
|
+
providers: [{ provide: REMOVE_STYLES_ON_COMPONENT_DESTROY, useValue: true }]
|
|
2258
2513
|
}]
|
|
2259
2514
|
}] });
|
|
2260
2515
|
|
|
@@ -2268,5 +2523,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImpor
|
|
|
2268
2523
|
* Generated bundle index. Do not edit.
|
|
2269
2524
|
*/
|
|
2270
2525
|
|
|
2271
|
-
export {
|
|
2526
|
+
export { LOG_EVENT, LandscapeSupportService, SI_LIVE_PREVIEW_CONFIG, SI_LIVE_PREVIEW_EXAMPLE_ROUTES, SI_LIVE_PREVIEW_INTERNALS, SI_STACKBLITZ_CONFIG, SiDummyComponent, SiLivePreviewApplicationRuntimeComponent, SiLivePreviewLocaleApi, SiLivePreviewModule, SiLivePreviewRoutingModule, SiLivePreviewRuntimeComponent, SiLivePreviewThemeApi, SiLivePreviewWebComponentService, SiLivePreviewModule as SimplLivePreviewModule, SiLivePreviewRoutingModule as SimplLivePreviewRoutingModule, angularTemplateProject, livePreviewRoutes, provideExampleRoutes, provideLivePreview, provideStackblitzConfig };
|
|
2272
2527
|
//# sourceMappingURL=siemens-live-preview.mjs.map
|