@siemens/live-preview 47.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -0
- package/component-loader.cjs +54 -0
- package/components/si-dummy.component.d.ts +8 -0
- package/components/si-example-overview/si-example-overview.component.d.ts +35 -0
- package/components/si-example-viewer/si-example-viewer.component.d.ts +40 -0
- package/components/si-live-preview/si-live-preview.component.d.ts +103 -0
- package/components/si-live-preview-iframe/devices.d.ts +25 -0
- package/components/si-live-preview-iframe/si-live-preview-iframe.component.d.ts +65 -0
- package/components/si-live-preview-qr/si-live-preview-qr.component.d.ts +20 -0
- package/components/si-live-preview-renderer/si-live-preview-renderer.component.d.ts +64 -0
- package/components/si-live-preview-renderer/webcomponent/si-live-webcomponent.service.d.ts +12 -0
- package/components/si-live-preview-wrapper/si-live-preview-wrapper.component.d.ts +41 -0
- package/esbuild-component-loader.mjs +64 -0
- package/fesm2022/siemens-live-preview-webcomponents.mjs +205 -0
- package/fesm2022/siemens-live-preview-webcomponents.mjs.map +1 -0
- package/fesm2022/siemens-live-preview.mjs +2027 -0
- package/fesm2022/siemens-live-preview.mjs.map +1 -0
- package/helpers/log-event.d.ts +6 -0
- package/helpers/utils.d.ts +9 -0
- package/index.d.ts +5 -0
- package/interfaces/live-preview-config.d.ts +28 -0
- package/interfaces/si-live-preview.api.d.ts +15 -0
- package/live-preview-routes.d.ts +9 -0
- package/package.json +74 -0
- package/public-api.d.ts +20 -0
- package/public-api.module.d.ts +19 -0
- package/services/landscape-support.service.d.ts +5 -0
- package/styles/_variables.scss +23 -0
- package/styles/components/_links.scss +14 -0
- package/styles/components/_tabs.scss +46 -0
- package/styles/live-preview.scss +16 -0
- package/webcomponents/components/si-live-preview-renderer/webcomponent/si-live-preview-web.component.d.ts +28 -0
- package/webcomponents/components/si-live-preview-renderer/webcomponent/si-live-webcomponent.service.d.ts +12 -0
- package/webcomponents/components/si-live-preview-renderer/webcomponent/si-webcomponent-render.service.d.ts +20 -0
- package/webcomponents/index.d.ts +5 -0
- package/webcomponents/interfaces/live-preview-config.d.ts +28 -0
- package/webcomponents/package.json +3 -0
- package/webcomponents/public-api.webcomponents.d.ts +6 -0
package/README.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Live Preview
|
|
2
|
+
|
|
3
|
+
The live preview supports the interactive demonstration and testing
|
|
4
|
+
of Element components within the documentation and during developing
|
|
5
|
+
components.
|
|
6
|
+
|
|
7
|
+
> The live preview components are internal components to support the development
|
|
8
|
+
> and documentation of Element. We do not guarantee their stability, i.e. there
|
|
9
|
+
> might be breaking changes outside of major versions.
|
|
10
|
+
|
|
11
|
+
## Components overview
|
|
12
|
+
|
|
13
|
+

|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
const glob = require('glob');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
|
|
4
|
+
// note: this can't be an arrow function!
|
|
5
|
+
exports.default = function () {
|
|
6
|
+
const args = this.getOptions();
|
|
7
|
+
|
|
8
|
+
let root = args.root;
|
|
9
|
+
const examples = args.examples;
|
|
10
|
+
const webcomponents = args.webcomponents;
|
|
11
|
+
if (!root || !examples) {
|
|
12
|
+
throw 'config error: need to pass "root" (path) and "examples" (glob)';
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
if (!root.endsWith('/')) {
|
|
16
|
+
root += '/';
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const baseDir = root + examples;
|
|
20
|
+
this.addDependency(path.resolve(baseDir));
|
|
21
|
+
|
|
22
|
+
if (webcomponents) {
|
|
23
|
+
this.addDependency(path.resolve(baseDir.replace('*.ts', '*.tsx')));
|
|
24
|
+
}
|
|
25
|
+
const files = glob.sync(baseDir, { posix: true });
|
|
26
|
+
if (webcomponents) {
|
|
27
|
+
files.push(...glob.sync(baseDir.replace('*.ts', '*.tsx')));
|
|
28
|
+
files.push(...glob.sync(baseDir.replace('*.ts', '*.vue')));
|
|
29
|
+
files.push(...glob.sync(baseDir.replace('*.ts', '*-js.html')));
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const tsRegex = new RegExp(`${root}(.+)\.(ts|vue|tsx|jsx|html)`);
|
|
33
|
+
const reactVueRegex = new RegExp(`${root}(.+)-(react|vue|js)\.(vue|tsx|jsx|html)`);
|
|
34
|
+
const list = [];
|
|
35
|
+
const webcomponentsList = [];
|
|
36
|
+
let code = 'export default { load: function (path) {';
|
|
37
|
+
for (const file of files) {
|
|
38
|
+
const match = tsRegex.exec(file);
|
|
39
|
+
if (match) {
|
|
40
|
+
if (!reactVueRegex.exec(file)) {
|
|
41
|
+
this.addDependency(path.resolve(file));
|
|
42
|
+
this.addDependency(path.resolve(path.dirname(file)));
|
|
43
|
+
code += `if (path == '${match[1]}') return import('${file}');`;
|
|
44
|
+
list.push(match[1]);
|
|
45
|
+
} else {
|
|
46
|
+
webcomponentsList.push(match[1]);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
code += `}, list: ${JSON.stringify(list)}, webcomponentsList: ${JSON.stringify(webcomponentsList)}}`;
|
|
52
|
+
|
|
53
|
+
return code;
|
|
54
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ActivatedRoute } from '@angular/router';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
export declare class SiDummyComponent {
|
|
4
|
+
path: string;
|
|
5
|
+
constructor(activeRoute: ActivatedRoute);
|
|
6
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SiDummyComponent, never>;
|
|
7
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<SiDummyComponent, "si-dummy", never, {}, {}, never, never, false, never>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Siemens 2016 - 2025.
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
import { OnInit } from '@angular/core';
|
|
6
|
+
import { UntypedFormControl } from '@angular/forms';
|
|
7
|
+
import { Observable } from 'rxjs';
|
|
8
|
+
import * as i0 from "@angular/core";
|
|
9
|
+
interface TreeItem {
|
|
10
|
+
label: string;
|
|
11
|
+
link?: string;
|
|
12
|
+
level: number;
|
|
13
|
+
}
|
|
14
|
+
export declare class SiExampleOverviewComponent implements OnInit {
|
|
15
|
+
private route;
|
|
16
|
+
private router;
|
|
17
|
+
private title;
|
|
18
|
+
private config;
|
|
19
|
+
private internalConfig;
|
|
20
|
+
private componentList;
|
|
21
|
+
protected activeExampleRoute: Observable<string>;
|
|
22
|
+
protected tree: TreeItem[];
|
|
23
|
+
protected baseUrl: string;
|
|
24
|
+
protected ticketBaseUrl: string;
|
|
25
|
+
protected isCollapsed: boolean;
|
|
26
|
+
protected showContent: boolean;
|
|
27
|
+
protected searchControl: UntypedFormControl;
|
|
28
|
+
ngOnInit(): void;
|
|
29
|
+
private makeTree;
|
|
30
|
+
toggleCollapse(): void;
|
|
31
|
+
resetSearchBar(): void;
|
|
32
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SiExampleOverviewComponent, never>;
|
|
33
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<SiExampleOverviewComponent, "si-example-overview", never, {}, {}, never, never, false, never>;
|
|
34
|
+
}
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { SiLivePreviewRendererComponent } from '../si-live-preview-renderer/si-live-preview-renderer.component';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
export declare class SiExampleViewerComponent {
|
|
4
|
+
private router;
|
|
5
|
+
private route;
|
|
6
|
+
private config;
|
|
7
|
+
private internalConfig;
|
|
8
|
+
private themeApi;
|
|
9
|
+
private localeApi;
|
|
10
|
+
readonly renderer: import("@angular/core").Signal<SiLivePreviewRendererComponent>;
|
|
11
|
+
get hasTabs(): boolean;
|
|
12
|
+
get hasTabsMobile(): boolean;
|
|
13
|
+
ticketBaseUrl: string;
|
|
14
|
+
baseUrl: string;
|
|
15
|
+
exampleUrl: string;
|
|
16
|
+
dataId: string;
|
|
17
|
+
mode: string;
|
|
18
|
+
theme: string;
|
|
19
|
+
locale?: string;
|
|
20
|
+
isRTL: boolean;
|
|
21
|
+
template: string;
|
|
22
|
+
reactTemplate: string;
|
|
23
|
+
vueTemplate: string;
|
|
24
|
+
jsTemplate: string;
|
|
25
|
+
tabs: {
|
|
26
|
+
heading: string;
|
|
27
|
+
base: string;
|
|
28
|
+
example: string;
|
|
29
|
+
}[];
|
|
30
|
+
activeTabIndex: number;
|
|
31
|
+
constructor();
|
|
32
|
+
private handleQueryParams;
|
|
33
|
+
private setUiTheme;
|
|
34
|
+
private setTheme;
|
|
35
|
+
private setRTL;
|
|
36
|
+
private setLocale;
|
|
37
|
+
activateTab(index: number): void;
|
|
38
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SiExampleViewerComponent, never>;
|
|
39
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<SiExampleViewerComponent, "si-example-viewer", never, {}, {}, never, never, false, never>;
|
|
40
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { AfterViewInit, ElementRef, OnChanges, OnInit, SimpleChanges } from '@angular/core';
|
|
2
|
+
import 'prismjs/components/prism-typescript';
|
|
3
|
+
import { SiLivePreviewLocaleApi } from '../../interfaces/si-live-preview.api';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
export declare class SiLivePreviewComponent implements OnInit, AfterViewInit, OnChanges {
|
|
6
|
+
private config;
|
|
7
|
+
private internalConfig;
|
|
8
|
+
private self;
|
|
9
|
+
private http;
|
|
10
|
+
private destroyRef;
|
|
11
|
+
localeApi: SiLivePreviewLocaleApi | null;
|
|
12
|
+
readonly templateElem: import("@angular/core").Signal<ElementRef<any>>;
|
|
13
|
+
readonly typescriptElem: import("@angular/core").Signal<ElementRef<any>>;
|
|
14
|
+
readonly reactVueElem: import("@angular/core").Signal<ElementRef<any>>;
|
|
15
|
+
readonly consoleElem: import("@angular/core").Signal<ElementRef<any>>;
|
|
16
|
+
baseUrl: string;
|
|
17
|
+
example?: string | null;
|
|
18
|
+
template: string;
|
|
19
|
+
theme: string;
|
|
20
|
+
locale?: string;
|
|
21
|
+
isRTL: boolean;
|
|
22
|
+
ticketBaseUrl: string;
|
|
23
|
+
templateReact: string;
|
|
24
|
+
templateVue: string;
|
|
25
|
+
templateJs: string;
|
|
26
|
+
isFullscreen: boolean;
|
|
27
|
+
isMobile: boolean;
|
|
28
|
+
templateTs: string;
|
|
29
|
+
renderingError: any;
|
|
30
|
+
logMessages: string[];
|
|
31
|
+
activeTab: string;
|
|
32
|
+
showCopied: boolean;
|
|
33
|
+
inProgress: boolean;
|
|
34
|
+
allowFullscreen: boolean;
|
|
35
|
+
exampleFullscreen: boolean;
|
|
36
|
+
allowCopy: boolean;
|
|
37
|
+
loadReact: boolean;
|
|
38
|
+
loadVue: boolean;
|
|
39
|
+
loadJs: boolean;
|
|
40
|
+
switcherEnabled: boolean | undefined;
|
|
41
|
+
rtlSwitcher: boolean | undefined;
|
|
42
|
+
webcomponents: boolean | undefined;
|
|
43
|
+
frameworks: Map<string, string>;
|
|
44
|
+
selectedFramework: string;
|
|
45
|
+
availableLocales: string[];
|
|
46
|
+
ticketLinkBug: string;
|
|
47
|
+
ticketLinkFeature: string;
|
|
48
|
+
editorCollapsed: boolean;
|
|
49
|
+
showEditor: boolean;
|
|
50
|
+
newMsgs: boolean;
|
|
51
|
+
private compileSubject;
|
|
52
|
+
private templateModified;
|
|
53
|
+
private skipInitialLoad;
|
|
54
|
+
private flaskTemplate;
|
|
55
|
+
private flaskTypescript;
|
|
56
|
+
private flaskReactVue;
|
|
57
|
+
private savedScrollPos;
|
|
58
|
+
private inProgressCounter;
|
|
59
|
+
private tsLoaded;
|
|
60
|
+
private reactLoaded;
|
|
61
|
+
private vueLoaded;
|
|
62
|
+
private jsLoaded;
|
|
63
|
+
private delayClearTimer;
|
|
64
|
+
private webcomponentsList;
|
|
65
|
+
constructor();
|
|
66
|
+
ngOnChanges(changes: SimpleChanges): void;
|
|
67
|
+
ngOnInit(): void;
|
|
68
|
+
ngAfterViewInit(): void;
|
|
69
|
+
activateTab(tab: string): void;
|
|
70
|
+
themeChange(theme: string): void;
|
|
71
|
+
private updateTemplate;
|
|
72
|
+
private updateTs;
|
|
73
|
+
private updateReact;
|
|
74
|
+
private updateVue;
|
|
75
|
+
private updateJs;
|
|
76
|
+
private loadFromUrl;
|
|
77
|
+
private loadTemplateFromUrl;
|
|
78
|
+
private loadTsFromUrl;
|
|
79
|
+
checkWebComponentsAvailable(): void;
|
|
80
|
+
changeFramework(framework: string): void;
|
|
81
|
+
templateFromComponent(template?: string): void;
|
|
82
|
+
handleInProgressEvent(inProgress: boolean): void;
|
|
83
|
+
logClear(delayed?: boolean): void;
|
|
84
|
+
private doLogClear;
|
|
85
|
+
logEvent(msg: string): void;
|
|
86
|
+
private showCopiedLabel;
|
|
87
|
+
toggleFullscreen(exampleOnly?: boolean): void;
|
|
88
|
+
toggleCollapse(): void;
|
|
89
|
+
toggleRTL(): void;
|
|
90
|
+
toggleTheme(): void;
|
|
91
|
+
localeSelectionChanged(target: EventTarget | null): void;
|
|
92
|
+
changeLocale(locale: string): void;
|
|
93
|
+
copyTemplate(): void;
|
|
94
|
+
copyCode(): void;
|
|
95
|
+
private clipboardCopy;
|
|
96
|
+
createLink(): void;
|
|
97
|
+
openTab(): void;
|
|
98
|
+
private createTemplateLink;
|
|
99
|
+
private createTicketLinks;
|
|
100
|
+
onFullscreenChange(): void;
|
|
101
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SiLivePreviewComponent, never>;
|
|
102
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<SiLivePreviewComponent, "si-live-preview", never, { "baseUrl": { "alias": "baseUrl"; "required": false; }; "example": { "alias": "example"; "required": false; }; "template": { "alias": "template"; "required": false; }; "theme": { "alias": "theme"; "required": false; }; "locale": { "alias": "locale"; "required": false; }; "isRTL": { "alias": "isRTL"; "required": false; }; "ticketBaseUrl": { "alias": "ticketBaseUrl"; "required": false; }; "templateReact": { "alias": "templateReact"; "required": false; }; "templateVue": { "alias": "templateVue"; "required": false; }; "templateJs": { "alias": "templateJs"; "required": false; }; }, {}, never, never, false, never>;
|
|
103
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Siemens 2016 - 2025.
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
export interface Device {
|
|
6
|
+
id: string;
|
|
7
|
+
mode: string;
|
|
8
|
+
name: string;
|
|
9
|
+
height: string;
|
|
10
|
+
width: string;
|
|
11
|
+
notch?: boolean;
|
|
12
|
+
safeAreaPortrait?: {
|
|
13
|
+
top?: number;
|
|
14
|
+
bottom?: number;
|
|
15
|
+
left?: number;
|
|
16
|
+
right?: number;
|
|
17
|
+
};
|
|
18
|
+
safeAreaLandscape?: {
|
|
19
|
+
top?: number;
|
|
20
|
+
bottom?: number;
|
|
21
|
+
left?: number;
|
|
22
|
+
right?: number;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
export declare const availableDevices: Device[];
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Siemens 2016 - 2025.
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
import { ElementRef, EventEmitter, OnChanges, OnInit, SimpleChanges } from '@angular/core';
|
|
6
|
+
import { Device } from './devices';
|
|
7
|
+
import * as i0 from "@angular/core";
|
|
8
|
+
export declare class SiLivePreviewIframeComponent implements OnInit, OnChanges {
|
|
9
|
+
readonly previewIframe: import("@angular/core").Signal<ElementRef<any> | undefined>;
|
|
10
|
+
baseUrl: string;
|
|
11
|
+
exampleUrl: string;
|
|
12
|
+
template: string;
|
|
13
|
+
ticketLinkBug: string;
|
|
14
|
+
ticketLinkFeature: string;
|
|
15
|
+
isFullscreen: boolean;
|
|
16
|
+
iFrameHeight?: string;
|
|
17
|
+
iFrameWidth?: string;
|
|
18
|
+
theme: string;
|
|
19
|
+
locale?: string;
|
|
20
|
+
isRTL?: boolean;
|
|
21
|
+
loadReact?: boolean;
|
|
22
|
+
loadVue?: boolean;
|
|
23
|
+
loadJs?: boolean;
|
|
24
|
+
reactVueTemplate?: string;
|
|
25
|
+
readonly templateFromComponent: EventEmitter<string | undefined>;
|
|
26
|
+
readonly logClear: EventEmitter<any>;
|
|
27
|
+
readonly logMessage: EventEmitter<string>;
|
|
28
|
+
readonly logRenderingError: EventEmitter<any>;
|
|
29
|
+
readonly inProgress: EventEmitter<boolean>;
|
|
30
|
+
readonly themeChange: EventEmitter<string>;
|
|
31
|
+
readonly localeChange: EventEmitter<string>;
|
|
32
|
+
private originalTemplate;
|
|
33
|
+
private templateModified;
|
|
34
|
+
private rendererInProgress;
|
|
35
|
+
private config;
|
|
36
|
+
private internalConfig;
|
|
37
|
+
private ngZone;
|
|
38
|
+
private destroyRef;
|
|
39
|
+
protected isMobile: boolean;
|
|
40
|
+
protected mode: string;
|
|
41
|
+
protected landscape: boolean;
|
|
42
|
+
protected switcherEnabled: boolean | undefined;
|
|
43
|
+
protected landscapeEnabled: boolean | undefined;
|
|
44
|
+
protected supportsLandscape: boolean;
|
|
45
|
+
protected availableDevices: Device[];
|
|
46
|
+
protected selectedDevice?: Device;
|
|
47
|
+
protected showNotch: boolean;
|
|
48
|
+
protected showQrMenu: boolean;
|
|
49
|
+
protected plainUrl: string;
|
|
50
|
+
protected plainUrlShort: string;
|
|
51
|
+
ngOnChanges(changes: SimpleChanges): void;
|
|
52
|
+
ngOnInit(): void;
|
|
53
|
+
deviceChanged(): void;
|
|
54
|
+
private onMessage;
|
|
55
|
+
private onMessageInZone;
|
|
56
|
+
toggleTheme(): void;
|
|
57
|
+
toggleLandscape(): void;
|
|
58
|
+
iframeLoaded(): void;
|
|
59
|
+
openQrMenu(): void;
|
|
60
|
+
private createTemplateLink;
|
|
61
|
+
private encode;
|
|
62
|
+
private sendMessage;
|
|
63
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SiLivePreviewIframeComponent, never>;
|
|
64
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<SiLivePreviewIframeComponent, "si-live-preview-iframe", never, { "baseUrl": { "alias": "baseUrl"; "required": false; }; "exampleUrl": { "alias": "exampleUrl"; "required": false; }; "template": { "alias": "template"; "required": false; }; "ticketLinkBug": { "alias": "ticketLinkBug"; "required": false; }; "ticketLinkFeature": { "alias": "ticketLinkFeature"; "required": false; }; "isFullscreen": { "alias": "isFullscreen"; "required": false; }; "iFrameHeight": { "alias": "iFrameHeight"; "required": false; }; "iFrameWidth": { "alias": "iFrameWidth"; "required": false; }; "theme": { "alias": "theme"; "required": false; }; "locale": { "alias": "locale"; "required": false; }; "isRTL": { "alias": "isRTL"; "required": false; }; "loadReact": { "alias": "loadReact"; "required": false; }; "loadVue": { "alias": "loadVue"; "required": false; }; "loadJs": { "alias": "loadJs"; "required": false; }; "reactVueTemplate": { "alias": "reactVueTemplate"; "required": false; }; }, { "templateFromComponent": "templateFromComponent"; "logClear": "logClear"; "logMessage": "logMessage"; "logRenderingError": "logRenderingError"; "inProgress": "inProgress"; "themeChange": "themeChange"; "localeChange": "localeChange"; }, never, never, false, never>;
|
|
65
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Siemens 2016 - 2025.
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
import { AfterViewInit, EventEmitter, OnChanges, OnDestroy, SimpleChanges } from '@angular/core';
|
|
6
|
+
import * as i0 from "@angular/core";
|
|
7
|
+
export declare class SiLivePreviewQrComponent implements AfterViewInit, OnDestroy, OnChanges {
|
|
8
|
+
url?: string;
|
|
9
|
+
urlShort?: string;
|
|
10
|
+
readonly closed: EventEmitter<void>;
|
|
11
|
+
qrImg: string;
|
|
12
|
+
qrShort: boolean;
|
|
13
|
+
private unlisten?;
|
|
14
|
+
ngOnChanges(changes: SimpleChanges): void;
|
|
15
|
+
ngAfterViewInit(): void;
|
|
16
|
+
ngOnDestroy(): void;
|
|
17
|
+
private generateQr;
|
|
18
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SiLivePreviewQrComponent, never>;
|
|
19
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<SiLivePreviewQrComponent, "si-live-preview-qr", never, { "url": { "alias": "url"; "required": false; }; "urlShort": { "alias": "urlShort"; "required": false; }; }, { "closed": "closed"; }, never, never, false, never>;
|
|
20
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Siemens 2016 - 2025.
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
import { ElementRef, EventEmitter, OnChanges, OnDestroy, SimpleChanges, ViewContainerRef } from '@angular/core';
|
|
6
|
+
import * as i0 from "@angular/core";
|
|
7
|
+
export declare class DummyAppSampleComponent {
|
|
8
|
+
}
|
|
9
|
+
export declare class SiLivePreviewRendererComponent implements OnChanges, OnDestroy {
|
|
10
|
+
readonly renderedExample: import("@angular/core").Signal<ViewContainerRef>;
|
|
11
|
+
readonly react: import("@angular/core").Signal<ElementRef<any>>;
|
|
12
|
+
renderingDone: boolean;
|
|
13
|
+
exampleUrl: string;
|
|
14
|
+
dataId: string;
|
|
15
|
+
template: string;
|
|
16
|
+
readonly templateFromComponent: EventEmitter<string | undefined>;
|
|
17
|
+
readonly logClear: EventEmitter<any>;
|
|
18
|
+
readonly logMessage: EventEmitter<string>;
|
|
19
|
+
readonly logRenderingError: EventEmitter<any>;
|
|
20
|
+
readonly inProgress: EventEmitter<boolean>;
|
|
21
|
+
readonly supportsLandscapeMode: EventEmitter<boolean>;
|
|
22
|
+
private componentRef?;
|
|
23
|
+
private moduleRef?;
|
|
24
|
+
private hasRenderingError;
|
|
25
|
+
private componentTs?;
|
|
26
|
+
private componentTsSampleComponent;
|
|
27
|
+
private dynamicComponent;
|
|
28
|
+
private dynamicComponentId?;
|
|
29
|
+
private componentTsFirstLoad;
|
|
30
|
+
private componentTsSampleModule;
|
|
31
|
+
private component;
|
|
32
|
+
private componentModule;
|
|
33
|
+
private compiledTemplate?;
|
|
34
|
+
private compiler;
|
|
35
|
+
private injector;
|
|
36
|
+
private envInjector;
|
|
37
|
+
private rendererFactory;
|
|
38
|
+
private config;
|
|
39
|
+
private internalConfig;
|
|
40
|
+
private activatedRouted;
|
|
41
|
+
private defaultRoutes;
|
|
42
|
+
ngOnChanges(changes: SimpleChanges): void;
|
|
43
|
+
ngOnDestroy(): void;
|
|
44
|
+
recompile(): void;
|
|
45
|
+
private logError;
|
|
46
|
+
private setRenderingError;
|
|
47
|
+
private loadFromUrl;
|
|
48
|
+
private setInProgress;
|
|
49
|
+
private compileWhenReady;
|
|
50
|
+
private doCompileTemplate;
|
|
51
|
+
private stringifyLog;
|
|
52
|
+
private cloneComponentWithoutIvyStuff;
|
|
53
|
+
private updateDynamicTemplate;
|
|
54
|
+
private getAnnotation;
|
|
55
|
+
private createAbstractComponentClass;
|
|
56
|
+
private createComponentClass;
|
|
57
|
+
private createModule;
|
|
58
|
+
private clear;
|
|
59
|
+
private removeComponentInstance;
|
|
60
|
+
private createComponent;
|
|
61
|
+
private createComponentInstance;
|
|
62
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SiLivePreviewRendererComponent, never>;
|
|
63
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<SiLivePreviewRendererComponent, "si-live-preview-renderer", never, { "exampleUrl": { "alias": "exampleUrl"; "required": false; }; "dataId": { "alias": "dataId"; "required": false; }; "template": { "alias": "template"; "required": false; }; }, { "templateFromComponent": "templateFromComponent"; "logClear": "logClear"; "logMessage": "logMessage"; "logRenderingError": "logRenderingError"; "inProgress": "inProgress"; "supportsLandscapeMode": "supportsLandscapeMode"; }, never, never, false, never>;
|
|
64
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Siemens 2016 - 2025.
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
import { ElementRef } from '@angular/core';
|
|
6
|
+
import * as i0 from "@angular/core";
|
|
7
|
+
export declare abstract class SiLivePreviewWebComponentService {
|
|
8
|
+
abstract injectComponent(element: ElementRef, inputs?: any, outputs?: any): any;
|
|
9
|
+
abstract destroyComponent(): void;
|
|
10
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SiLivePreviewWebComponentService, never>;
|
|
11
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<SiLivePreviewWebComponentService>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Siemens 2016 - 2025.
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
import { ElementRef } from '@angular/core';
|
|
6
|
+
import { SiLivePreviewRendererComponent } from '../si-live-preview-renderer/si-live-preview-renderer.component';
|
|
7
|
+
import * as i0 from "@angular/core";
|
|
8
|
+
export declare class SiLivePreviewWrapperComponent {
|
|
9
|
+
readonly renderer: import("@angular/core").Signal<SiLivePreviewRendererComponent>;
|
|
10
|
+
readonly webcomponentRenderer: import("@angular/core").Signal<ElementRef<any>>;
|
|
11
|
+
exampleUrl: string;
|
|
12
|
+
template: string;
|
|
13
|
+
loadReact: boolean;
|
|
14
|
+
loadVue: boolean;
|
|
15
|
+
loadJs: boolean;
|
|
16
|
+
webcomponentTemplateCode: string;
|
|
17
|
+
private isMobile;
|
|
18
|
+
private theme;
|
|
19
|
+
private isRTL;
|
|
20
|
+
private mode;
|
|
21
|
+
private locale?;
|
|
22
|
+
private initialUrl;
|
|
23
|
+
private config;
|
|
24
|
+
private themeApi;
|
|
25
|
+
private localeApi;
|
|
26
|
+
private internalConfig;
|
|
27
|
+
private ngZone;
|
|
28
|
+
private destroyRef;
|
|
29
|
+
private webcomponentService;
|
|
30
|
+
constructor();
|
|
31
|
+
private onMessage;
|
|
32
|
+
private onMessageInZone;
|
|
33
|
+
onClick(event: MouseEvent): void;
|
|
34
|
+
sendMessage(type: string, message?: any): void;
|
|
35
|
+
private setTheme;
|
|
36
|
+
private setRTL;
|
|
37
|
+
private setLocale;
|
|
38
|
+
private setSafeArea;
|
|
39
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SiLivePreviewWrapperComponent, never>;
|
|
40
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<SiLivePreviewWrapperComponent, "si-live-preview-wrapper", never, {}, {}, never, never, false, never>;
|
|
41
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import path from 'path';
|
|
2
|
+
import { globIterate } from 'glob';
|
|
3
|
+
|
|
4
|
+
const livePreviewComponentLoader = {
|
|
5
|
+
name: 'live-preview-component-loader',
|
|
6
|
+
setup: build => {
|
|
7
|
+
build.onResolve({ filter: /@siemens\/live-preview\/component-loader.*/ }, args => {
|
|
8
|
+
const [data] = args.path.split('!');
|
|
9
|
+
const url = new URL('fake:' + data);
|
|
10
|
+
const root = url.searchParams.get('root');
|
|
11
|
+
const examples = url.searchParams.get('examples');
|
|
12
|
+
const webcomponents = url.searchParams.get('webcomponents');
|
|
13
|
+
|
|
14
|
+
if (!root) {
|
|
15
|
+
throw 'config error: need to pass "root" (path)';
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return {
|
|
19
|
+
namespace: 'live-preview-component-loader',
|
|
20
|
+
path: args.path,
|
|
21
|
+
pluginData: { root, webcomponents, examples }
|
|
22
|
+
};
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
build.onLoad(
|
|
26
|
+
{
|
|
27
|
+
filter: /@siemens\/live-preview\/component-loader.*/,
|
|
28
|
+
namespace: 'live-preview-component-loader'
|
|
29
|
+
},
|
|
30
|
+
async ({ pluginData: { root, webcomponents, examples } }) => {
|
|
31
|
+
const watchDirs = [root];
|
|
32
|
+
|
|
33
|
+
let code = 'export default { load: function (path) { switch (path) {';
|
|
34
|
+
const files = [];
|
|
35
|
+
const webcomponentsFiles = [];
|
|
36
|
+
for await (const file of globIterate(
|
|
37
|
+
path.posix.join(root, examples.replace(/\.ts$/, '.{ts,tsx,vue,js}')),
|
|
38
|
+
{ posix: true } // needed for windows
|
|
39
|
+
)) {
|
|
40
|
+
if (file.endsWith('.ts')) {
|
|
41
|
+
const fileName = file.replace(new RegExp('^' + root + '/'), '').replace(/\.ts$/, '');
|
|
42
|
+
code += `case '${fileName}': return import('${file.replace(/\.ts$/, '')}');`;
|
|
43
|
+
files.push(fileName);
|
|
44
|
+
} else {
|
|
45
|
+
webcomponentsFiles.push(file.replace(root + '/', '').replace(/\.(tsx|vue|js)$/, ''));
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
files.sort();
|
|
49
|
+
webcomponentsFiles.sort();
|
|
50
|
+
|
|
51
|
+
code += `default: return undefined; } }, list: ${JSON.stringify(files)}`;
|
|
52
|
+
if (webcomponents) {
|
|
53
|
+
code += `, webcomponentsList: ${JSON.stringify(webcomponentsFiles)}`;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
code += '};';
|
|
57
|
+
|
|
58
|
+
return { watchDirs, contents: code, resolveDir: root, loader: 'js' };
|
|
59
|
+
}
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
export default livePreviewComponentLoader;
|