@siemens/live-preview 51.0.0-rc.1 → 51.0.0-rc.10
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 +1 -1
- package/assets/angular/package.json +21 -21
- package/esbuild-component-loader.mjs +12 -8
- package/fesm2022/siemens-live-preview-webcomponents.mjs +34 -39
- package/fesm2022/siemens-live-preview-webcomponents.mjs.map +1 -1
- package/fesm2022/siemens-live-preview.mjs +630 -712
- package/fesm2022/siemens-live-preview.mjs.map +1 -1
- package/package.json +3 -3
- package/styles/_variables.scss +15 -15
- package/types/siemens-live-preview-webcomponents.d.ts +49 -18
- package/types/siemens-live-preview.d.ts +215 -198
- /package/{LICENSE.md → LICENSE} +0 -0
package/README.md
CHANGED
|
@@ -9,39 +9,39 @@
|
|
|
9
9
|
},
|
|
10
10
|
"private": true,
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@angular/common": "22.0.
|
|
13
|
-
"@angular/core": "22.0.
|
|
14
|
-
"@angular/forms": "22.0.
|
|
15
|
-
"@angular/platform-browser": "22.0.
|
|
16
|
-
"@angular/router": "22.0.
|
|
12
|
+
"@angular/common": "22.0.8",
|
|
13
|
+
"@angular/core": "22.0.8",
|
|
14
|
+
"@angular/forms": "22.0.8",
|
|
15
|
+
"@angular/platform-browser": "22.0.8",
|
|
16
|
+
"@angular/router": "22.0.8",
|
|
17
17
|
"@ngx-formly/bootstrap": "7.1.0",
|
|
18
18
|
"@ngx-formly/core": "7.1.0",
|
|
19
19
|
"@ngx-translate/core": "18.0.0",
|
|
20
|
-
"@siemens/charts-ng": "49.
|
|
21
|
-
"@siemens/dashboards-ng": "49.
|
|
22
|
-
"@siemens/element-ng": "49.
|
|
23
|
-
"@siemens/element-theme": "49.
|
|
24
|
-
"@siemens/element-translate-ng": "49.
|
|
25
|
-
"@siemens/live-preview": "49.
|
|
26
|
-
"@siemens/maps-ng": "49.
|
|
27
|
-
"@siemens/ngx-datatable": "
|
|
20
|
+
"@siemens/charts-ng": "49.16.1",
|
|
21
|
+
"@siemens/dashboards-ng": "49.16.1",
|
|
22
|
+
"@siemens/element-ng": "49.16.1",
|
|
23
|
+
"@siemens/element-theme": "49.16.1",
|
|
24
|
+
"@siemens/element-translate-ng": "49.16.1",
|
|
25
|
+
"@siemens/live-preview": "49.16.1",
|
|
26
|
+
"@siemens/maps-ng": "49.16.1",
|
|
27
|
+
"@siemens/ngx-datatable": "27.0.3",
|
|
28
28
|
"ag-grid-angular": "^36.0.0",
|
|
29
29
|
"ag-grid-community": "^36.0.0",
|
|
30
30
|
"echarts": "6.1.0",
|
|
31
31
|
"flag-icons": "7.5.0",
|
|
32
|
-
"google-libphonenumber": "3.2.
|
|
33
|
-
"ngx-image-cropper": "9.1.
|
|
34
|
-
"ol": "10.
|
|
32
|
+
"google-libphonenumber": "3.2.46",
|
|
33
|
+
"ngx-image-cropper": "9.1.7",
|
|
34
|
+
"ol": "10.10.0",
|
|
35
35
|
"ol-ext": "4.0.38",
|
|
36
36
|
"rxjs": "7.8.2",
|
|
37
37
|
"tslib": "2.8.1"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@angular/build": "22.0.
|
|
41
|
-
"@angular/cli": "22.0.
|
|
42
|
-
"@angular/compiler": "22.0.
|
|
43
|
-
"@angular/compiler-cli": "22.0.
|
|
44
|
-
"@angular/language-service": "22.0.
|
|
40
|
+
"@angular/build": "22.0.8",
|
|
41
|
+
"@angular/cli": "22.0.8",
|
|
42
|
+
"@angular/compiler": "22.0.8",
|
|
43
|
+
"@angular/compiler-cli": "22.0.8",
|
|
44
|
+
"@angular/language-service": "22.0.8",
|
|
45
45
|
"typescript": "6.0.3"
|
|
46
46
|
}
|
|
47
47
|
}
|
|
@@ -10,6 +10,7 @@ const livePreviewComponentLoader = {
|
|
|
10
10
|
const root = url.searchParams.get('root');
|
|
11
11
|
const examples = url.searchParams.get('examples');
|
|
12
12
|
const webcomponents = url.searchParams.get('webcomponents');
|
|
13
|
+
const rel = url.searchParams.get('rel');
|
|
13
14
|
|
|
14
15
|
if (!root) {
|
|
15
16
|
throw 'config error: need to pass "root" (path)';
|
|
@@ -18,7 +19,7 @@ const livePreviewComponentLoader = {
|
|
|
18
19
|
return {
|
|
19
20
|
namespace: 'live-preview-component-loader',
|
|
20
21
|
path: args.path,
|
|
21
|
-
pluginData: { root, webcomponents, examples }
|
|
22
|
+
pluginData: { root, webcomponents: webcomponents === 'true', examples, rel: rel === 'true' }
|
|
22
23
|
};
|
|
23
24
|
});
|
|
24
25
|
|
|
@@ -27,19 +28,22 @@ const livePreviewComponentLoader = {
|
|
|
27
28
|
filter: /(@siemens|@simpl)\/live-preview\/component-loader.*/,
|
|
28
29
|
namespace: 'live-preview-component-loader'
|
|
29
30
|
},
|
|
30
|
-
async ({ pluginData: { root, webcomponents, examples } }) => {
|
|
31
|
+
async ({ pluginData: { root, webcomponents, examples, rel } }) => {
|
|
31
32
|
const watchDirs = [root];
|
|
32
33
|
|
|
33
34
|
let code = 'export default { load: function (path) { switch (path) {';
|
|
34
35
|
const files = [];
|
|
35
36
|
const webcomponentsFiles = [];
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
)) {
|
|
37
|
+
const glob = path.posix.join(root, examples.replace(/\.ts$/, '.{ts,tsx,vue,js}'));
|
|
38
|
+
const rootNormalized = path.normalize(root);
|
|
39
|
+
// posix: true needed for windows
|
|
40
|
+
for await (const file of globIterate(glob, { posix: true })) {
|
|
40
41
|
if (file.endsWith('.ts')) {
|
|
41
|
-
const fileName = file
|
|
42
|
-
|
|
42
|
+
const fileName = file
|
|
43
|
+
.replace(new RegExp('^' + rootNormalized + '/'), '')
|
|
44
|
+
.replace(/\.ts$/, '');
|
|
45
|
+
let importFileName = rel ? `./${fileName}` : file.replace(/\.ts$/, '');
|
|
46
|
+
code += `case '${fileName}': return import('${importFileName}');`;
|
|
43
47
|
files.push(fileName);
|
|
44
48
|
} else {
|
|
45
49
|
webcomponentsFiles.push(file.replace(root + '/', '').replace(/\.(tsx|vue|js)$/, ''));
|
|
@@ -1,20 +1,27 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { viewChild, ElementRef,
|
|
2
|
+
import { viewChild, ElementRef, input, output, signal, ChangeDetectionStrategy, Component, Injectable, reflectComponentType, inject, ApplicationRef, Injector, EnvironmentInjector, createComponent } from '@angular/core';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Copyright (c) Siemens 2016 - 2026
|
|
6
6
|
* SPDX-License-Identifier: MIT
|
|
7
7
|
*/
|
|
8
8
|
class SiLivePreviewWebComponent {
|
|
9
|
-
root = viewChild.required('root', { read: ElementRef });
|
|
10
|
-
loadReact = false
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
9
|
+
root = viewChild.required('root', { ...(ngDevMode ? { debugName: "root" } : /* istanbul ignore next */ {}), read: ElementRef });
|
|
10
|
+
loadReact = input(false, /* @ts-ignore */
|
|
11
|
+
...(ngDevMode ? [{ debugName: "loadReact" }] : /* istanbul ignore next */ []));
|
|
12
|
+
loadVue = input(false, /* @ts-ignore */
|
|
13
|
+
...(ngDevMode ? [{ debugName: "loadVue" }] : /* istanbul ignore next */ []));
|
|
14
|
+
loadJs = input(false, /* @ts-ignore */
|
|
15
|
+
...(ngDevMode ? [{ debugName: "loadJs" }] : /* istanbul ignore next */ []));
|
|
16
|
+
webcomponentTemplateCode = input('', /* @ts-ignore */
|
|
17
|
+
...(ngDevMode ? [{ debugName: "webcomponentTemplateCode" }] : /* istanbul ignore next */ []));
|
|
18
|
+
exampleUrl = input('', /* @ts-ignore */
|
|
19
|
+
...(ngDevMode ? [{ debugName: "exampleUrl" }] : /* istanbul ignore next */ []));
|
|
20
|
+
config = input(/* @ts-ignore */
|
|
21
|
+
...(ngDevMode ? [undefined, { debugName: "config" }] : /* istanbul ignore next */ []));
|
|
16
22
|
inProgress = output();
|
|
17
|
-
renderingDone = false
|
|
23
|
+
renderingDone = signal(false, /* @ts-ignore */
|
|
24
|
+
...(ngDevMode ? [{ debugName: "renderingDone" }] : /* istanbul ignore next */ []));
|
|
18
25
|
reactRoot;
|
|
19
26
|
vueRoot;
|
|
20
27
|
ngOnChanges(changes) {
|
|
@@ -22,15 +29,15 @@ class SiLivePreviewWebComponent {
|
|
|
22
29
|
this.vueRoot?.unmount();
|
|
23
30
|
if (changes.loadReact?.currentValue &&
|
|
24
31
|
changes.loadReact?.currentValue !== changes.loadReact?.previousValue) {
|
|
25
|
-
this.loadReactFromCodeTemplate(this.webcomponentTemplateCode);
|
|
32
|
+
this.loadReactFromCodeTemplate(this.webcomponentTemplateCode());
|
|
26
33
|
}
|
|
27
34
|
if (changes.loadVue?.currentValue &&
|
|
28
35
|
changes.loadVue?.currentValue !== changes.loadVue?.previousValue) {
|
|
29
|
-
this.loadVueFromCodeTemplate(this.webcomponentTemplateCode);
|
|
36
|
+
this.loadVueFromCodeTemplate(this.webcomponentTemplateCode());
|
|
30
37
|
}
|
|
31
38
|
if (changes.loadJs?.currentValue &&
|
|
32
39
|
changes.loadJs?.currentValue !== changes.loadJs?.previousValue) {
|
|
33
|
-
this.loadHTMLFromCodeTemplate(this.webcomponentTemplateCode);
|
|
40
|
+
this.loadHTMLFromCodeTemplate(this.webcomponentTemplateCode());
|
|
34
41
|
}
|
|
35
42
|
}
|
|
36
43
|
loadReactFromCodeTemplate(code) {
|
|
@@ -98,7 +105,7 @@ class SiLivePreviewWebComponent {
|
|
|
98
105
|
this.setInProgress(false);
|
|
99
106
|
}
|
|
100
107
|
setInProgress(inProgress) {
|
|
101
|
-
this.renderingDone
|
|
108
|
+
this.renderingDone.set(!inProgress);
|
|
102
109
|
this.inProgress.emit(inProgress);
|
|
103
110
|
}
|
|
104
111
|
getDefault(module) {
|
|
@@ -107,42 +114,30 @@ class SiLivePreviewWebComponent {
|
|
|
107
114
|
}
|
|
108
115
|
return module;
|
|
109
116
|
}
|
|
110
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.
|
|
111
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.0.
|
|
117
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SiLivePreviewWebComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
118
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.0.8", type: SiLivePreviewWebComponent, isStandalone: true, selector: "si-live-preview-webcomponent", inputs: { 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 }, webcomponentTemplateCode: { classPropertyName: "webcomponentTemplateCode", publicName: "webcomponentTemplateCode", isSignal: true, isRequired: false, transformFunction: null }, exampleUrl: { classPropertyName: "exampleUrl", publicName: "exampleUrl", isSignal: true, isRequired: false, transformFunction: null }, config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { inProgress: "inProgress" }, host: { properties: { "class.live-preview-done": "renderingDone()" } }, viewQueries: [{ propertyName: "root", first: true, predicate: ["root"], descendants: true, read: ElementRef, isSignal: true }], usesOnChanges: true, ngImport: i0, template: '<div #root id="app"></div>', isInline: true, changeDetection: i0.ChangeDetectionStrategy.Eager });
|
|
112
119
|
}
|
|
113
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.
|
|
120
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SiLivePreviewWebComponent, decorators: [{
|
|
114
121
|
type: Component,
|
|
115
122
|
args: [{
|
|
116
123
|
selector: 'si-live-preview-webcomponent',
|
|
117
124
|
template: '<div #root id="app"></div>',
|
|
118
|
-
changeDetection: ChangeDetectionStrategy.Eager
|
|
125
|
+
changeDetection: ChangeDetectionStrategy.Eager,
|
|
126
|
+
host: {
|
|
127
|
+
'[class.live-preview-done]': 'renderingDone()'
|
|
128
|
+
}
|
|
119
129
|
}]
|
|
120
|
-
}], propDecorators: { root: [{ type: i0.ViewChild, args: ['root', { ...{ read: ElementRef }, isSignal: true }] }], loadReact: [{
|
|
121
|
-
type: Input
|
|
122
|
-
}], loadVue: [{
|
|
123
|
-
type: Input
|
|
124
|
-
}], loadJs: [{
|
|
125
|
-
type: Input
|
|
126
|
-
}], webcomponentTemplateCode: [{
|
|
127
|
-
type: Input
|
|
128
|
-
}], exampleUrl: [{
|
|
129
|
-
type: Input
|
|
130
|
-
}], config: [{
|
|
131
|
-
type: Input
|
|
132
|
-
}], inProgress: [{ type: i0.Output, args: ["inProgress"] }], renderingDone: [{
|
|
133
|
-
type: HostBinding,
|
|
134
|
-
args: ['class.live-preview-done']
|
|
135
|
-
}] } });
|
|
130
|
+
}], propDecorators: { root: [{ type: i0.ViewChild, args: ['root', { ...{ read: ElementRef }, isSignal: true }] }], loadReact: [{ type: i0.Input, args: [{ isSignal: true, alias: "loadReact", required: false }] }], loadVue: [{ type: i0.Input, args: [{ isSignal: true, alias: "loadVue", required: false }] }], loadJs: [{ type: i0.Input, args: [{ isSignal: true, alias: "loadJs", required: false }] }], webcomponentTemplateCode: [{ type: i0.Input, args: [{ isSignal: true, alias: "webcomponentTemplateCode", required: false }] }], exampleUrl: [{ type: i0.Input, args: [{ isSignal: true, alias: "exampleUrl", required: false }] }], config: [{ type: i0.Input, args: [{ isSignal: true, alias: "config", required: false }] }], inProgress: [{ type: i0.Output, args: ["inProgress"] }] } });
|
|
136
131
|
|
|
137
132
|
/**
|
|
138
133
|
* Copyright (c) Siemens 2016 - 2026
|
|
139
134
|
* SPDX-License-Identifier: MIT
|
|
140
135
|
*/
|
|
141
136
|
class SiLivePreviewWebComponentService {
|
|
142
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.
|
|
143
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.
|
|
137
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SiLivePreviewWebComponentService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
138
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SiLivePreviewWebComponentService });
|
|
144
139
|
}
|
|
145
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.
|
|
140
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SiLivePreviewWebComponentService, decorators: [{
|
|
146
141
|
type: Injectable
|
|
147
142
|
}] });
|
|
148
143
|
|
|
@@ -179,10 +174,10 @@ class SiWebComponentRenderService extends SiLivePreviewWebComponentService {
|
|
|
179
174
|
this.outputSubscription?.unsubscribe();
|
|
180
175
|
this.outputSubscription = null;
|
|
181
176
|
}
|
|
182
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.
|
|
183
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.
|
|
177
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SiWebComponentRenderService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
178
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SiWebComponentRenderService, providedIn: 'root' });
|
|
184
179
|
}
|
|
185
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.
|
|
180
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SiWebComponentRenderService, decorators: [{
|
|
186
181
|
type: Injectable,
|
|
187
182
|
args: [{ providedIn: 'root' }]
|
|
188
183
|
}] });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"siemens-live-preview-webcomponents.mjs","sources":["../../../../projects/live-preview/components/si-live-preview-renderer/webcomponent/si-live-preview-web.component.ts","../../../../projects/live-preview/components/si-live-preview-renderer/webcomponent/si-live-webcomponent.service.ts","../../../../projects/live-preview/components/si-live-preview-renderer/webcomponent/si-webcomponent-render.service.ts","../../../../projects/live-preview/public-api.webcomponents.ts","../../../../projects/live-preview/siemens-live-preview-webcomponents.ts"],"sourcesContent":["/**\n * Copyright (c) Siemens 2016 - 2026\n * SPDX-License-Identifier: MIT\n */\nimport {\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n HostBinding,\n Input,\n OnChanges,\n output,\n SimpleChanges,\n viewChild\n} from '@angular/core';\n\nimport { SiLivePreviewConfig } from '../../../interfaces/live-preview-config';\n\n@Component({\n selector: 'si-live-preview-webcomponent',\n template: '<div #root id=\"app\"></div>',\n changeDetection: ChangeDetectionStrategy.Eager\n})\nexport class SiLivePreviewWebComponent implements OnChanges {\n readonly root = viewChild.required('root', { read: ElementRef });\n @Input() loadReact = false;\n @Input() loadVue = false;\n @Input() loadJs = false;\n @Input() webcomponentTemplateCode = '';\n @Input() exampleUrl!: string;\n @Input() config!: SiLivePreviewConfig;\n readonly inProgress = output<boolean>();\n\n @HostBinding('class.live-preview-done') renderingDone = false;\n\n private reactRoot: any;\n private vueRoot: any;\n\n ngOnChanges(changes: SimpleChanges<this>): void {\n this.reactRoot?.unmount();\n this.vueRoot?.unmount();\n if (\n changes.loadReact?.currentValue &&\n changes.loadReact?.currentValue !== changes.loadReact?.previousValue\n ) {\n this.loadReactFromCodeTemplate(this.webcomponentTemplateCode);\n }\n if (\n changes.loadVue?.currentValue &&\n changes.loadVue?.currentValue !== changes.loadVue?.previousValue\n ) {\n this.loadVueFromCodeTemplate(this.webcomponentTemplateCode);\n }\n if (\n changes.loadJs?.currentValue &&\n changes.loadJs?.currentValue !== changes.loadJs?.previousValue\n ) {\n this.loadHTMLFromCodeTemplate(this.webcomponentTemplateCode);\n }\n }\n\n loadReactFromCodeTemplate(code: string): void {\n this.setInProgress(true);\n import('react-dom/client').then(reactDom => {\n this.reactRoot = this.getDefault(reactDom).createRoot(this.root().nativeElement);\n const moduleInput = code;\n import('@babel/standalone').then(babel => {\n const moduleOutput: any = this.getDefault(babel).transform(moduleInput, {\n presets: [\n // `modules: false` creates a module that can be imported\n ['env', { modules: false }],\n 'react',\n ['typescript', { isTSX: true, allExtensions: true }]\n ],\n filename: 'example.ts'\n }).code;\n\n import('react').then(react => {\n window.React = this.getDefault(react);\n const dataUrl = 'data:text/javascript;base64,' + btoa(moduleOutput);\n\n import(/* webpackIgnore: true */ /* @vite-ignore */ dataUrl).then(module => {\n this.reactRoot.render(this.getDefault(react).createElement(module.default));\n setTimeout(() => this.setInProgress(false));\n });\n });\n });\n });\n }\n\n loadVueFromCodeTemplate(code: string): void {\n this.setInProgress(true);\n\n import('vue/dist/vue.esm-bundler.js' as any).then(vue => {\n (globalThis as any).__VUE_OPTIONS_API__ = true;\n (globalThis as any).__VUE_PROD_DEVTOOLS__ = false;\n (globalThis as any).Vue = vue;\n\n import('vue3-sfc-loader' as any).then(sfcLoader => {\n const options = {\n moduleCache: {\n vue\n },\n getFile: (url: any) => {\n return url === '/example.vue' ? Promise.resolve(code) : undefined;\n },\n addStyle: () => {\n /* unused here */\n }\n };\n const { loadModule } = this.getDefault(sfcLoader);\n this.vueRoot?.unmount();\n this.vueRoot = vue.createApp(\n vue.defineAsyncComponent(() => loadModule('/example.vue', options))\n );\n\n const root = this.root();\n if (document.body.contains(root.nativeElement)) {\n const div = document.createElement('div');\n div.id = 'vue_app';\n root.nativeElement.replaceChildren(div);\n this.vueRoot.mount('#vue_app');\n }\n\n setTimeout(() => this.setInProgress(false));\n });\n });\n }\n\n loadHTMLFromCodeTemplate(code: string): void {\n this.setInProgress(true);\n const scriptEl = document.createRange().createContextualFragment(code);\n this.root().nativeElement.append(scriptEl);\n this.setInProgress(false);\n }\n\n private setInProgress(inProgress: boolean): void {\n this.renderingDone = !inProgress;\n this.inProgress.emit(inProgress);\n }\n\n private getDefault<T extends Record<string, any>>(module: T): T {\n if ('default' in module) {\n return module.default as T;\n }\n return module;\n }\n}\n","/**\n * Copyright (c) Siemens 2016 - 2026\n * SPDX-License-Identifier: MIT\n */\nimport { ElementRef, Injectable } from '@angular/core';\n\n@Injectable()\nexport abstract class SiLivePreviewWebComponentService {\n abstract injectComponent(element: ElementRef, inputs?: any, outputs?: any): any;\n abstract destroyComponent(): void;\n}\n","/**\n * Copyright (c) Siemens 2016 - 2026\n * SPDX-License-Identifier: MIT\n */\nimport {\n ApplicationRef,\n ComponentRef,\n createComponent,\n ElementRef,\n EnvironmentInjector,\n inject,\n Injectable,\n Injector,\n OnDestroy,\n OutputRefSubscription,\n reflectComponentType\n} from '@angular/core';\n\nimport { SiLivePreviewWebComponent } from './si-live-preview-web.component';\nimport { SiLivePreviewWebComponentService } from './si-live-webcomponent.service';\n\n@Injectable({ providedIn: 'root' })\nexport class SiWebComponentRenderService\n extends SiLivePreviewWebComponentService\n implements OnDestroy\n{\n private componentRef!: ComponentRef<SiLivePreviewWebComponent>;\n private componentMirror = reflectComponentType(SiLivePreviewWebComponent);\n private appRef = inject(ApplicationRef);\n private injector = inject(Injector);\n private environmentInjector = inject(EnvironmentInjector);\n private outputSubscription: OutputRefSubscription | null = null;\n\n injectComponent(element: ElementRef, inputs: any, outputs: any): void {\n this.destroyComponent();\n this.componentRef = createComponent(SiLivePreviewWebComponent, {\n environmentInjector: this.environmentInjector,\n elementInjector: this.injector\n });\n\n this.componentMirror?.inputs.forEach(value => {\n this.componentRef.setInput(value.propName, inputs[value.propName]);\n });\n\n this.outputSubscription = this.componentRef.instance.inProgress.subscribe(event => {\n outputs.inProgress('progress', event);\n });\n\n this.appRef.attachView(this.componentRef.hostView);\n element.nativeElement.appendChild(this.componentRef.location.nativeElement);\n }\n\n destroyComponent(): void {\n this.componentRef?.destroy();\n }\n\n ngOnDestroy(): void {\n this.outputSubscription?.unsubscribe();\n this.outputSubscription = null;\n }\n}\n","/**\n * Copyright (c) Siemens 2016 - 2026\n * SPDX-License-Identifier: MIT\n */\nexport * from './components/si-live-preview-renderer/webcomponent/si-live-preview-web.component';\nexport * from './components/si-live-preview-renderer/webcomponent/si-webcomponent-render.service';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api.webcomponents';\n"],"names":[],"mappings":";;;AAAA;;;AAGG;MAoBU,yBAAyB,CAAA;AAC3B,IAAA,IAAI,GAAG,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC;IACvD,SAAS,GAAG,KAAK;IACjB,OAAO,GAAG,KAAK;IACf,MAAM,GAAG,KAAK;IACd,wBAAwB,GAAG,EAAE;AAC7B,IAAA,UAAU;AACV,IAAA,MAAM;IACN,UAAU,GAAG,MAAM,EAAW;IAEC,aAAa,GAAG,KAAK;AAErD,IAAA,SAAS;AACT,IAAA,OAAO;AAEf,IAAA,WAAW,CAAC,OAA4B,EAAA;AACtC,QAAA,IAAI,CAAC,SAAS,EAAE,OAAO,EAAE;AACzB,QAAA,IAAI,CAAC,OAAO,EAAE,OAAO,EAAE;AACvB,QAAA,IACE,OAAO,CAAC,SAAS,EAAE,YAAY;YAC/B,OAAO,CAAC,SAAS,EAAE,YAAY,KAAK,OAAO,CAAC,SAAS,EAAE,aAAa,EACpE;AACA,YAAA,IAAI,CAAC,yBAAyB,CAAC,IAAI,CAAC,wBAAwB,CAAC;QAC/D;AACA,QAAA,IACE,OAAO,CAAC,OAAO,EAAE,YAAY;YAC7B,OAAO,CAAC,OAAO,EAAE,YAAY,KAAK,OAAO,CAAC,OAAO,EAAE,aAAa,EAChE;AACA,YAAA,IAAI,CAAC,uBAAuB,CAAC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;IAC7E;IAEA,gBAAgB,GAAA;AACd,QAAA,IAAI,CAAC,YAAY,EAAE,OAAO,EAAE;IAC9B;IAEA,WAAW,GAAA;AACT,QAAA,IAAI,CAAC,kBAAkB,EAAE,WAAW,EAAE;AACtC,QAAA,IAAI,CAAC,kBAAkB,GAAG,IAAI;IAChC;uGArCW,2BAA2B,EAAA,IAAA,EAAA,IAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;AAA3B,IAAA,OAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,2BAA2B,cADd,MAAM,EAAA,CAAA;;2FACnB,2BAA2B,EAAA,UAAA,EAAA,CAAA;kBADvC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;ACrBlC;;;AAGG;;ACHH;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"siemens-live-preview-webcomponents.mjs","sources":["../../../../projects/live-preview/components/si-live-preview-renderer/webcomponent/si-live-preview-web.component.ts","../../../../projects/live-preview/components/si-live-preview-renderer/webcomponent/si-live-webcomponent.service.ts","../../../../projects/live-preview/components/si-live-preview-renderer/webcomponent/si-webcomponent-render.service.ts","../../../../projects/live-preview/public-api.webcomponents.ts","../../../../projects/live-preview/siemens-live-preview-webcomponents.ts"],"sourcesContent":["/**\n * Copyright (c) Siemens 2016 - 2026\n * SPDX-License-Identifier: MIT\n */\nimport {\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n input,\n OnChanges,\n output,\n signal,\n SimpleChanges,\n viewChild\n} from '@angular/core';\n\nimport { SiLivePreviewConfig } from '../../../interfaces/live-preview-config';\n\n@Component({\n selector: 'si-live-preview-webcomponent',\n template: '<div #root id=\"app\"></div>',\n changeDetection: ChangeDetectionStrategy.Eager,\n host: {\n '[class.live-preview-done]': 'renderingDone()'\n }\n})\nexport class SiLivePreviewWebComponent implements OnChanges {\n readonly root = viewChild.required('root', { read: ElementRef });\n readonly loadReact = input(false);\n readonly loadVue = input(false);\n readonly loadJs = input(false);\n readonly webcomponentTemplateCode = input('');\n readonly exampleUrl = input('');\n readonly config = input<SiLivePreviewConfig>();\n readonly inProgress = output<boolean>();\n\n protected readonly renderingDone = signal(false);\n\n private reactRoot: any;\n private vueRoot: any;\n\n ngOnChanges(changes: SimpleChanges<this>): void {\n this.reactRoot?.unmount();\n this.vueRoot?.unmount();\n if (\n changes.loadReact?.currentValue &&\n changes.loadReact?.currentValue !== changes.loadReact?.previousValue\n ) {\n this.loadReactFromCodeTemplate(this.webcomponentTemplateCode());\n }\n if (\n changes.loadVue?.currentValue &&\n changes.loadVue?.currentValue !== changes.loadVue?.previousValue\n ) {\n this.loadVueFromCodeTemplate(this.webcomponentTemplateCode());\n }\n if (\n changes.loadJs?.currentValue &&\n changes.loadJs?.currentValue !== changes.loadJs?.previousValue\n ) {\n this.loadHTMLFromCodeTemplate(this.webcomponentTemplateCode());\n }\n }\n\n loadReactFromCodeTemplate(code: string): void {\n this.setInProgress(true);\n import('react-dom/client').then(reactDom => {\n this.reactRoot = this.getDefault(reactDom).createRoot(this.root().nativeElement);\n const moduleInput = code;\n import('@babel/standalone').then(babel => {\n const moduleOutput: any = this.getDefault(babel).transform(moduleInput, {\n presets: [\n // `modules: false` creates a module that can be imported\n ['env', { modules: false }],\n 'react',\n ['typescript', { isTSX: true, allExtensions: true }]\n ],\n filename: 'example.ts'\n }).code;\n\n import('react').then(react => {\n window.React = this.getDefault(react);\n const dataUrl = 'data:text/javascript;base64,' + btoa(moduleOutput);\n\n import(/* webpackIgnore: true */ /* @vite-ignore */ dataUrl).then(module => {\n this.reactRoot.render(this.getDefault(react).createElement(module.default));\n setTimeout(() => this.setInProgress(false));\n });\n });\n });\n });\n }\n\n loadVueFromCodeTemplate(code: string): void {\n this.setInProgress(true);\n\n import('vue/dist/vue.esm-bundler.js' as any).then(vue => {\n (globalThis as any).__VUE_OPTIONS_API__ = true;\n (globalThis as any).__VUE_PROD_DEVTOOLS__ = false;\n (globalThis as any).Vue = vue;\n\n import('vue3-sfc-loader' as any).then(sfcLoader => {\n const options = {\n moduleCache: {\n vue\n },\n getFile: (url: any) => {\n return url === '/example.vue' ? Promise.resolve(code) : undefined;\n },\n addStyle: () => {\n /* unused here */\n }\n };\n const { loadModule } = this.getDefault(sfcLoader);\n this.vueRoot?.unmount();\n this.vueRoot = vue.createApp(\n vue.defineAsyncComponent(() => loadModule('/example.vue', options))\n );\n\n const root = this.root();\n if (document.body.contains(root.nativeElement)) {\n const div = document.createElement('div');\n div.id = 'vue_app';\n root.nativeElement.replaceChildren(div);\n this.vueRoot.mount('#vue_app');\n }\n\n setTimeout(() => this.setInProgress(false));\n });\n });\n }\n\n loadHTMLFromCodeTemplate(code: string): void {\n this.setInProgress(true);\n const scriptEl = document.createRange().createContextualFragment(code);\n this.root().nativeElement.append(scriptEl);\n this.setInProgress(false);\n }\n\n private setInProgress(inProgress: boolean): void {\n this.renderingDone.set(!inProgress);\n this.inProgress.emit(inProgress);\n }\n\n private getDefault<T extends Record<string, any>>(module: T): T {\n if ('default' in module) {\n return module.default as T;\n }\n return module;\n }\n}\n","/**\n * Copyright (c) Siemens 2016 - 2026\n * SPDX-License-Identifier: MIT\n */\nimport { ElementRef, Injectable } from '@angular/core';\n\n@Injectable()\nexport abstract class SiLivePreviewWebComponentService {\n abstract injectComponent(element: ElementRef, inputs?: any, outputs?: any): any;\n abstract destroyComponent(): void;\n}\n","/**\n * Copyright (c) Siemens 2016 - 2026\n * SPDX-License-Identifier: MIT\n */\nimport {\n ApplicationRef,\n ComponentRef,\n createComponent,\n ElementRef,\n EnvironmentInjector,\n inject,\n Injectable,\n Injector,\n OnDestroy,\n OutputRefSubscription,\n reflectComponentType\n} from '@angular/core';\n\nimport { SiLivePreviewWebComponent } from './si-live-preview-web.component';\nimport { SiLivePreviewWebComponentService } from './si-live-webcomponent.service';\n\n@Injectable({ providedIn: 'root' })\nexport class SiWebComponentRenderService\n extends SiLivePreviewWebComponentService\n implements OnDestroy\n{\n private componentRef!: ComponentRef<SiLivePreviewWebComponent>;\n private componentMirror = reflectComponentType(SiLivePreviewWebComponent);\n private appRef = inject(ApplicationRef);\n private injector = inject(Injector);\n private environmentInjector = inject(EnvironmentInjector);\n private outputSubscription: OutputRefSubscription | null = null;\n\n injectComponent(element: ElementRef, inputs: any, outputs: any): void {\n this.destroyComponent();\n this.componentRef = createComponent(SiLivePreviewWebComponent, {\n environmentInjector: this.environmentInjector,\n elementInjector: this.injector\n });\n\n this.componentMirror?.inputs.forEach(value => {\n this.componentRef.setInput(value.propName, inputs[value.propName]);\n });\n\n this.outputSubscription = this.componentRef.instance.inProgress.subscribe(event => {\n outputs.inProgress('progress', event);\n });\n\n this.appRef.attachView(this.componentRef.hostView);\n element.nativeElement.appendChild(this.componentRef.location.nativeElement);\n }\n\n destroyComponent(): void {\n this.componentRef?.destroy();\n }\n\n ngOnDestroy(): void {\n this.outputSubscription?.unsubscribe();\n this.outputSubscription = null;\n }\n}\n","/**\n * Copyright (c) Siemens 2016 - 2026\n * SPDX-License-Identifier: MIT\n */\nexport * from './components/si-live-preview-renderer/webcomponent/si-live-preview-web.component';\nexport * from './components/si-live-preview-renderer/webcomponent/si-webcomponent-render.service';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api.webcomponents';\n"],"names":[],"mappings":";;;AAAA;;;AAGG;MAuBU,yBAAyB,CAAA;IAC3B,IAAI,GAAG,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAA,EAAA,IAAA,SAAA,GAAA,EAAA,SAAA,EAAA,MAAA,EAAA,8BAAA,EAAA,CAAA,EAAI,IAAI,EAAE,UAAU,EAAA,CAAG;IACvD,SAAS,GAAG,KAAK,CAAC,KAAK;kFAAC;IACxB,OAAO,GAAG,KAAK,CAAC,KAAK;gFAAC;IACtB,MAAM,GAAG,KAAK,CAAC,KAAK;+EAAC;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