@memberjunction/ng-artifacts 2.105.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/dist/lib/artifacts.module.d.ts +30 -0
- package/dist/lib/artifacts.module.d.ts.map +1 -0
- package/dist/lib/artifacts.module.js +124 -0
- package/dist/lib/artifacts.module.js.map +1 -0
- package/dist/lib/components/artifact-message-card.component.d.ts +47 -0
- package/dist/lib/components/artifact-message-card.component.d.ts.map +1 -0
- package/dist/lib/components/artifact-message-card.component.js +270 -0
- package/dist/lib/components/artifact-message-card.component.js.map +1 -0
- package/dist/lib/components/artifact-type-plugin-viewer.component.d.ts +42 -0
- package/dist/lib/components/artifact-type-plugin-viewer.component.d.ts.map +1 -0
- package/dist/lib/components/artifact-type-plugin-viewer.component.js +213 -0
- package/dist/lib/components/artifact-type-plugin-viewer.component.js.map +1 -0
- package/dist/lib/components/artifact-version-history.component.d.ts +28 -0
- package/dist/lib/components/artifact-version-history.component.d.ts.map +1 -0
- package/dist/lib/components/artifact-version-history.component.js +280 -0
- package/dist/lib/components/artifact-version-history.component.js.map +1 -0
- package/dist/lib/components/artifact-viewer-panel.component.d.ts +73 -0
- package/dist/lib/components/artifact-viewer-panel.component.d.ts.map +1 -0
- package/dist/lib/components/artifact-viewer-panel.component.js +942 -0
- package/dist/lib/components/artifact-viewer-panel.component.js.map +1 -0
- package/dist/lib/components/base-artifact-viewer.component.d.ts +70 -0
- package/dist/lib/components/base-artifact-viewer.component.d.ts.map +1 -0
- package/dist/lib/components/base-artifact-viewer.component.js +110 -0
- package/dist/lib/components/base-artifact-viewer.component.js.map +1 -0
- package/dist/lib/components/plugins/code-artifact-viewer.component.d.ts +17 -0
- package/dist/lib/components/plugins/code-artifact-viewer.component.d.ts.map +1 -0
- package/dist/lib/components/plugins/code-artifact-viewer.component.js +125 -0
- package/dist/lib/components/plugins/code-artifact-viewer.component.js.map +1 -0
- package/dist/lib/components/plugins/component-artifact-viewer.component.d.ts +41 -0
- package/dist/lib/components/plugins/component-artifact-viewer.component.d.ts.map +1 -0
- package/dist/lib/components/plugins/component-artifact-viewer.component.js +293 -0
- package/dist/lib/components/plugins/component-artifact-viewer.component.js.map +1 -0
- package/dist/lib/components/plugins/html-artifact-viewer.component.d.ts +18 -0
- package/dist/lib/components/plugins/html-artifact-viewer.component.d.ts.map +1 -0
- package/dist/lib/components/plugins/html-artifact-viewer.component.js +128 -0
- package/dist/lib/components/plugins/html-artifact-viewer.component.js.map +1 -0
- package/dist/lib/components/plugins/json-artifact-viewer.component.d.ts +37 -0
- package/dist/lib/components/plugins/json-artifact-viewer.component.d.ts.map +1 -0
- package/dist/lib/components/plugins/json-artifact-viewer.component.js +208 -0
- package/dist/lib/components/plugins/json-artifact-viewer.component.js.map +1 -0
- package/dist/lib/components/plugins/markdown-artifact-viewer.component.d.ts +14 -0
- package/dist/lib/components/plugins/markdown-artifact-viewer.component.d.ts.map +1 -0
- package/dist/lib/components/plugins/markdown-artifact-viewer.component.js +121 -0
- package/dist/lib/components/plugins/markdown-artifact-viewer.component.js.map +1 -0
- package/dist/lib/components/plugins/svg-artifact-viewer.component.d.ts +18 -0
- package/dist/lib/components/plugins/svg-artifact-viewer.component.d.ts.map +1 -0
- package/dist/lib/components/plugins/svg-artifact-viewer.component.js +129 -0
- package/dist/lib/components/plugins/svg-artifact-viewer.component.js.map +1 -0
- package/dist/lib/interfaces/artifact-viewer-plugin.interface.d.ts +44 -0
- package/dist/lib/interfaces/artifact-viewer-plugin.interface.d.ts.map +1 -0
- package/dist/lib/interfaces/artifact-viewer-plugin.interface.js +2 -0
- package/dist/lib/interfaces/artifact-viewer-plugin.interface.js.map +1 -0
- package/dist/public-api.d.ts +14 -0
- package/dist/public-api.d.ts.map +1 -0
- package/dist/public-api.js +23 -0
- package/dist/public-api.js.map +1 -0
- package/package.json +41 -0
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { Component, ViewChild } from '@angular/core';
|
|
8
|
+
import { RegisterClass, SafeJSONParse } from '@memberjunction/global';
|
|
9
|
+
import { BaseArtifactViewerPluginComponent } from '../base-artifact-viewer.component';
|
|
10
|
+
import { BuildComponentCompleteCode } from '@memberjunction/interactive-component-types';
|
|
11
|
+
import * as i0 from "@angular/core";
|
|
12
|
+
import * as i1 from "@memberjunction/ng-react";
|
|
13
|
+
import * as i2 from "@angular/common";
|
|
14
|
+
import * as i3 from "@angular/forms";
|
|
15
|
+
import * as i4 from "@memberjunction/ng-code-editor";
|
|
16
|
+
const _c0 = ["reactComponent"];
|
|
17
|
+
function ComponentArtifactViewerComponent_Conditional_8_Template(rf, ctx) { if (rf & 1) {
|
|
18
|
+
const _r1 = i0.ɵɵgetCurrentView();
|
|
19
|
+
i0.ɵɵelementStart(0, "button", 10);
|
|
20
|
+
i0.ɵɵlistener("click", function ComponentArtifactViewerComponent_Conditional_8_Template_button_click_0_listener() { i0.ɵɵrestoreView(_r1); const ctx_r1 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r1.onCopy()); });
|
|
21
|
+
i0.ɵɵelement(1, "i", 11);
|
|
22
|
+
i0.ɵɵtext(2, " Copy ");
|
|
23
|
+
i0.ɵɵelementEnd();
|
|
24
|
+
} }
|
|
25
|
+
function ComponentArtifactViewerComponent_Conditional_10_Conditional_1_Conditional_6_Template(rf, ctx) { if (rf & 1) {
|
|
26
|
+
i0.ɵɵelementStart(0, "details")(1, "summary");
|
|
27
|
+
i0.ɵɵtext(2, "Technical Details");
|
|
28
|
+
i0.ɵɵelementEnd();
|
|
29
|
+
i0.ɵɵelementStart(3, "pre");
|
|
30
|
+
i0.ɵɵtext(4);
|
|
31
|
+
i0.ɵɵelementEnd()();
|
|
32
|
+
} if (rf & 2) {
|
|
33
|
+
const ctx_r1 = i0.ɵɵnextContext(3);
|
|
34
|
+
i0.ɵɵadvance(4);
|
|
35
|
+
i0.ɵɵtextInterpolate(ctx_r1.errorDetails);
|
|
36
|
+
} }
|
|
37
|
+
function ComponentArtifactViewerComponent_Conditional_10_Conditional_1_Template(rf, ctx) { if (rf & 1) {
|
|
38
|
+
i0.ɵɵelementStart(0, "div", 12);
|
|
39
|
+
i0.ɵɵelement(1, "i", 13);
|
|
40
|
+
i0.ɵɵelementStart(2, "h3");
|
|
41
|
+
i0.ɵɵtext(3, "Component Error");
|
|
42
|
+
i0.ɵɵelementEnd();
|
|
43
|
+
i0.ɵɵelementStart(4, "p");
|
|
44
|
+
i0.ɵɵtext(5);
|
|
45
|
+
i0.ɵɵelementEnd();
|
|
46
|
+
i0.ɵɵtemplate(6, ComponentArtifactViewerComponent_Conditional_10_Conditional_1_Conditional_6_Template, 5, 1, "details");
|
|
47
|
+
i0.ɵɵelementEnd();
|
|
48
|
+
} if (rf & 2) {
|
|
49
|
+
const ctx_r1 = i0.ɵɵnextContext(2);
|
|
50
|
+
i0.ɵɵadvance(5);
|
|
51
|
+
i0.ɵɵtextInterpolate(ctx_r1.errorMessage);
|
|
52
|
+
i0.ɵɵadvance();
|
|
53
|
+
i0.ɵɵconditional(ctx_r1.errorDetails ? 6 : -1);
|
|
54
|
+
} }
|
|
55
|
+
function ComponentArtifactViewerComponent_Conditional_10_Conditional_2_Conditional_0_Template(rf, ctx) { if (rf & 1) {
|
|
56
|
+
const _r3 = i0.ɵɵgetCurrentView();
|
|
57
|
+
i0.ɵɵelementStart(0, "mj-react-component", 15, 0);
|
|
58
|
+
i0.ɵɵlistener("componentEvent", function ComponentArtifactViewerComponent_Conditional_10_Conditional_2_Conditional_0_Template_mj_react_component_componentEvent_0_listener($event) { i0.ɵɵrestoreView(_r3); const ctx_r1 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r1.onComponentEvent($event)); })("stateChange", function ComponentArtifactViewerComponent_Conditional_10_Conditional_2_Conditional_0_Template_mj_react_component_stateChange_0_listener($event) { i0.ɵɵrestoreView(_r3); const ctx_r1 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r1.onStateChange($event)); })("openEntityRecord", function ComponentArtifactViewerComponent_Conditional_10_Conditional_2_Conditional_0_Template_mj_react_component_openEntityRecord_0_listener($event) { i0.ɵɵrestoreView(_r3); const ctx_r1 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r1.onOpenEntityRecord($event)); });
|
|
59
|
+
i0.ɵɵelementEnd();
|
|
60
|
+
} if (rf & 2) {
|
|
61
|
+
const ctx_r1 = i0.ɵɵnextContext(3);
|
|
62
|
+
i0.ɵɵproperty("component", ctx_r1.component);
|
|
63
|
+
} }
|
|
64
|
+
function ComponentArtifactViewerComponent_Conditional_10_Conditional_2_Conditional_1_Template(rf, ctx) { if (rf & 1) {
|
|
65
|
+
i0.ɵɵelementStart(0, "div", 12);
|
|
66
|
+
i0.ɵɵelement(1, "i", 16);
|
|
67
|
+
i0.ɵɵelementStart(2, "h3");
|
|
68
|
+
i0.ɵɵtext(3, "No Component Loaded");
|
|
69
|
+
i0.ɵɵelementEnd();
|
|
70
|
+
i0.ɵɵelementStart(4, "p");
|
|
71
|
+
i0.ɵɵtext(5, "The component data is missing or invalid.");
|
|
72
|
+
i0.ɵɵelementEnd()();
|
|
73
|
+
} }
|
|
74
|
+
function ComponentArtifactViewerComponent_Conditional_10_Conditional_2_Template(rf, ctx) { if (rf & 1) {
|
|
75
|
+
i0.ɵɵtemplate(0, ComponentArtifactViewerComponent_Conditional_10_Conditional_2_Conditional_0_Template, 2, 1, "mj-react-component", 14)(1, ComponentArtifactViewerComponent_Conditional_10_Conditional_2_Conditional_1_Template, 6, 0, "div", 12);
|
|
76
|
+
} if (rf & 2) {
|
|
77
|
+
const ctx_r1 = i0.ɵɵnextContext(2);
|
|
78
|
+
i0.ɵɵconditional(ctx_r1.component ? 0 : 1);
|
|
79
|
+
} }
|
|
80
|
+
function ComponentArtifactViewerComponent_Conditional_10_Template(rf, ctx) { if (rf & 1) {
|
|
81
|
+
i0.ɵɵelementStart(0, "div", 8);
|
|
82
|
+
i0.ɵɵtemplate(1, ComponentArtifactViewerComponent_Conditional_10_Conditional_1_Template, 7, 2, "div", 12)(2, ComponentArtifactViewerComponent_Conditional_10_Conditional_2_Template, 2, 1);
|
|
83
|
+
i0.ɵɵelementEnd();
|
|
84
|
+
} if (rf & 2) {
|
|
85
|
+
const ctx_r1 = i0.ɵɵnextContext();
|
|
86
|
+
i0.ɵɵadvance();
|
|
87
|
+
i0.ɵɵconditional(ctx_r1.hasError ? 1 : 2);
|
|
88
|
+
} }
|
|
89
|
+
function ComponentArtifactViewerComponent_Conditional_11_Template(rf, ctx) { if (rf & 1) {
|
|
90
|
+
const _r4 = i0.ɵɵgetCurrentView();
|
|
91
|
+
i0.ɵɵelementStart(0, "mj-code-editor", 17);
|
|
92
|
+
i0.ɵɵtwoWayListener("ngModelChange", function ComponentArtifactViewerComponent_Conditional_11_Template_mj_code_editor_ngModelChange_0_listener($event) { i0.ɵɵrestoreView(_r4); const ctx_r1 = i0.ɵɵnextContext(); i0.ɵɵtwoWayBindingSet(ctx_r1.componentCode, $event) || (ctx_r1.componentCode = $event); return i0.ɵɵresetView($event); });
|
|
93
|
+
i0.ɵɵelementEnd();
|
|
94
|
+
} if (rf & 2) {
|
|
95
|
+
const ctx_r1 = i0.ɵɵnextContext();
|
|
96
|
+
i0.ɵɵtwoWayProperty("ngModel", ctx_r1.componentCode);
|
|
97
|
+
i0.ɵɵproperty("language", "typescript")("readonly", ctx_r1.readonly);
|
|
98
|
+
} }
|
|
99
|
+
/**
|
|
100
|
+
* Viewer component for interactive Component artifacts (React-based UI components)
|
|
101
|
+
*/
|
|
102
|
+
let ComponentArtifactViewerComponent = class ComponentArtifactViewerComponent extends BaseArtifactViewerPluginComponent {
|
|
103
|
+
adapter;
|
|
104
|
+
reactComponent;
|
|
105
|
+
component = null;
|
|
106
|
+
componentCode = "";
|
|
107
|
+
componentName = '';
|
|
108
|
+
viewMode = 'preview';
|
|
109
|
+
hasError = false;
|
|
110
|
+
errorMessage = '';
|
|
111
|
+
errorDetails = '';
|
|
112
|
+
constructor(adapter) {
|
|
113
|
+
super();
|
|
114
|
+
this.adapter = adapter;
|
|
115
|
+
}
|
|
116
|
+
async ngOnInit() {
|
|
117
|
+
// Extract component name from the code
|
|
118
|
+
if (this.artifactVersion.Content) {
|
|
119
|
+
this.component = SafeJSONParse(this.artifactVersion.Content);
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
throw new Error('Artifact content is empty');
|
|
123
|
+
}
|
|
124
|
+
this.extractComponentParts();
|
|
125
|
+
// Initialize Angular adapter for React components
|
|
126
|
+
try {
|
|
127
|
+
await this.adapter.initialize();
|
|
128
|
+
}
|
|
129
|
+
catch (error) {
|
|
130
|
+
console.error('Failed to initialize Angular adapter:', error);
|
|
131
|
+
this.hasError = true;
|
|
132
|
+
this.errorMessage = 'Failed to initialize component runtime';
|
|
133
|
+
this.errorDetails = error instanceof Error ? error.message : String(error);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
async ngAfterViewInit() {
|
|
137
|
+
// Component initialization happens automatically via mj-react-component
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Component plugin always shows elevated display (interactive React component).
|
|
141
|
+
*/
|
|
142
|
+
get isShowingElevatedDisplay() {
|
|
143
|
+
return true;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Component plugin should tell parent to show JSON tab so users can view the component spec source.
|
|
147
|
+
*/
|
|
148
|
+
get parentShouldShowRawContent() {
|
|
149
|
+
return true;
|
|
150
|
+
}
|
|
151
|
+
extractComponentParts() {
|
|
152
|
+
if (this.component?.name) {
|
|
153
|
+
this.componentName = this.component?.name;
|
|
154
|
+
}
|
|
155
|
+
if (this.component?.code) {
|
|
156
|
+
this.componentCode = BuildComponentCompleteCode(this.component);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
onCopy() {
|
|
160
|
+
if (this.componentCode) {
|
|
161
|
+
navigator.clipboard.writeText(this.componentCode).then(() => {
|
|
162
|
+
console.log('✅ Copied component code to clipboard');
|
|
163
|
+
}).catch(err => {
|
|
164
|
+
console.error('Failed to copy to clipboard:', err);
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
onComponentEvent(event) {
|
|
169
|
+
if (event.type === 'error') {
|
|
170
|
+
this.hasError = true;
|
|
171
|
+
this.errorMessage = event.payload?.error || 'An unknown error occurred';
|
|
172
|
+
this.errorDetails = event.payload?.errorInfo || event.payload?.stackTrace || '';
|
|
173
|
+
console.error('Component error:', event.payload);
|
|
174
|
+
}
|
|
175
|
+
else {
|
|
176
|
+
console.log('Component event:', event.type, event.payload);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
onStateChange(event) {
|
|
180
|
+
console.log('Component state change:', event);
|
|
181
|
+
// Could update componentContext here if needed for persistence
|
|
182
|
+
}
|
|
183
|
+
onOpenEntityRecord(event) {
|
|
184
|
+
console.log('Open entity record requested:', event);
|
|
185
|
+
// This would typically be handled by a parent component to open entity forms
|
|
186
|
+
// For now just log it
|
|
187
|
+
}
|
|
188
|
+
static ɵfac = function ComponentArtifactViewerComponent_Factory(t) { return new (t || ComponentArtifactViewerComponent)(i0.ɵɵdirectiveInject(i1.AngularAdapterService)); };
|
|
189
|
+
static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: ComponentArtifactViewerComponent, selectors: [["mj-component-artifact-viewer"]], viewQuery: function ComponentArtifactViewerComponent_Query(rf, ctx) { if (rf & 1) {
|
|
190
|
+
i0.ɵɵviewQuery(_c0, 5);
|
|
191
|
+
} if (rf & 2) {
|
|
192
|
+
let _t;
|
|
193
|
+
i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.reactComponent = _t.first);
|
|
194
|
+
} }, features: [i0.ɵɵInheritDefinitionFeature], decls: 12, vars: 6, consts: [["reactComponent", ""], [1, "component-artifact-viewer", 3, "ngClass"], [1, "component-toolbar"], [1, "component-badge"], [1, "fas", "fa-cube"], ["title", "View Source Code", 1, "btn-icon", 3, "click"], ["title", "Copy Code", 1, "btn-icon"], [1, "component-content-container"], [1, "component-preview"], [2, "width", "100%", "height", "100%", 3, "ngModel", "language", "readonly"], ["title", "Copy Code", 1, "btn-icon", 3, "click"], [1, "fas", "fa-copy"], [1, "error-state"], [1, "fas", "fa-exclamation-triangle"], [3, "component"], [3, "componentEvent", "stateChange", "openEntityRecord", "component"], [1, "fas", "fa-exclamation-circle"], [2, "width", "100%", "height", "100%", 3, "ngModelChange", "ngModel", "language", "readonly"]], template: function ComponentArtifactViewerComponent_Template(rf, ctx) { if (rf & 1) {
|
|
195
|
+
i0.ɵɵelementStart(0, "div", 1)(1, "div", 2)(2, "div", 3);
|
|
196
|
+
i0.ɵɵelement(3, "i", 4);
|
|
197
|
+
i0.ɵɵtext(4, " Interactive Component ");
|
|
198
|
+
i0.ɵɵelementEnd();
|
|
199
|
+
i0.ɵɵelementStart(5, "button", 5);
|
|
200
|
+
i0.ɵɵlistener("click", function ComponentArtifactViewerComponent_Template_button_click_5_listener() { return ctx.viewMode = ctx.viewMode === "preview" ? "source" : "preview"; });
|
|
201
|
+
i0.ɵɵelement(6, "i");
|
|
202
|
+
i0.ɵɵtext(7);
|
|
203
|
+
i0.ɵɵelementEnd();
|
|
204
|
+
i0.ɵɵtemplate(8, ComponentArtifactViewerComponent_Conditional_8_Template, 3, 0, "button", 6);
|
|
205
|
+
i0.ɵɵelementEnd();
|
|
206
|
+
i0.ɵɵelementStart(9, "div", 7);
|
|
207
|
+
i0.ɵɵtemplate(10, ComponentArtifactViewerComponent_Conditional_10_Template, 3, 1, "div", 8)(11, ComponentArtifactViewerComponent_Conditional_11_Template, 1, 3, "mj-code-editor", 9);
|
|
208
|
+
i0.ɵɵelementEnd()();
|
|
209
|
+
} if (rf & 2) {
|
|
210
|
+
i0.ɵɵproperty("ngClass", ctx.cssClass);
|
|
211
|
+
i0.ɵɵadvance(6);
|
|
212
|
+
i0.ɵɵclassMap(ctx.viewMode === "preview" ? "fas fa-code" : "fas fa-eye");
|
|
213
|
+
i0.ɵɵadvance();
|
|
214
|
+
i0.ɵɵtextInterpolate1(" ", ctx.viewMode === "preview" ? "Source" : "Preview", " ");
|
|
215
|
+
i0.ɵɵadvance();
|
|
216
|
+
i0.ɵɵconditional(ctx.viewMode === "source" ? 8 : -1);
|
|
217
|
+
i0.ɵɵadvance(2);
|
|
218
|
+
i0.ɵɵconditional(ctx.viewMode === "preview" ? 10 : 11);
|
|
219
|
+
} }, dependencies: [i2.NgClass, i3.NgControlStatus, i3.NgModel, i4.CodeEditorComponent, i1.MJReactComponent], styles: [".component-artifact-viewer[_ngcontent-%COMP%] {\n display: flex;\n flex-direction: column;\n height: 100%;\n }\n\n .component-toolbar[_ngcontent-%COMP%] {\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 8px;\n background: #f5f5f5;\n border-bottom: 1px solid #ddd;\n gap: 8px;\n }\n\n .component-badge[_ngcontent-%COMP%] {\n padding: 6px 12px;\n background: #28a745;\n color: white;\n border-radius: 12px;\n font-size: 11px;\n font-weight: 600;\n display: flex;\n align-items: center;\n gap: 6px;\n }\n\n .btn-icon[_ngcontent-%COMP%] {\n padding: 6px 12px;\n background: white;\n border: 1px solid #ccc;\n border-radius: 4px;\n cursor: pointer;\n font-size: 12px;\n display: flex;\n align-items: center;\n gap: 6px;\n }\n\n .btn-icon[_ngcontent-%COMP%]:hover {\n background: #e9ecef;\n border-color: #999;\n }\n\n .component-content-container[_ngcontent-%COMP%] {\n flex: 1;\n overflow: auto;\n }\n\n .component-preview[_ngcontent-%COMP%] {\n padding: 20px;\n background: white;\n height: 100%;\n overflow: auto;\n }\n\n .error-state[_ngcontent-%COMP%] {\n padding: 20px;\n text-align: center;\n color: #dc3545;\n }\n\n .error-state[_ngcontent-%COMP%] i[_ngcontent-%COMP%] {\n font-size: 48px;\n margin-bottom: 16px;\n }\n\n .error-state[_ngcontent-%COMP%] h3[_ngcontent-%COMP%] {\n margin: 0 0 12px;\n font-size: 20px;\n font-weight: 600;\n }\n\n .error-state[_ngcontent-%COMP%] p[_ngcontent-%COMP%] {\n margin: 0 0 12px;\n color: #6c757d;\n }\n\n .error-state[_ngcontent-%COMP%] details[_ngcontent-%COMP%] {\n margin-top: 16px;\n text-align: left;\n background: #f8f9fa;\n padding: 12px;\n border-radius: 4px;\n }\n\n .error-state[_ngcontent-%COMP%] summary[_ngcontent-%COMP%] {\n cursor: pointer;\n font-weight: 600;\n color: #495057;\n }\n\n .error-state[_ngcontent-%COMP%] pre[_ngcontent-%COMP%] {\n margin-top: 8px;\n white-space: pre-wrap;\n word-wrap: break-word;\n font-size: 12px;\n color: #212529;\n }"] });
|
|
220
|
+
};
|
|
221
|
+
ComponentArtifactViewerComponent = __decorate([
|
|
222
|
+
RegisterClass(BaseArtifactViewerPluginComponent, 'ComponentArtifactViewerPlugin')
|
|
223
|
+
], ComponentArtifactViewerComponent);
|
|
224
|
+
export { ComponentArtifactViewerComponent };
|
|
225
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ComponentArtifactViewerComponent, [{
|
|
226
|
+
type: Component,
|
|
227
|
+
args: [{ selector: 'mj-component-artifact-viewer', template: `
|
|
228
|
+
<div class="component-artifact-viewer" [ngClass]="cssClass">
|
|
229
|
+
<div class="component-toolbar">
|
|
230
|
+
<div class="component-badge">
|
|
231
|
+
<i class="fas fa-cube"></i> Interactive Component
|
|
232
|
+
</div>
|
|
233
|
+
<button class="btn-icon" title="View Source Code" (click)="viewMode = viewMode === 'preview' ? 'source' : 'preview'">
|
|
234
|
+
<i [class]="viewMode === 'preview' ? 'fas fa-code' : 'fas fa-eye'"></i>
|
|
235
|
+
{{ viewMode === 'preview' ? 'Source' : 'Preview' }}
|
|
236
|
+
</button>
|
|
237
|
+
@if (viewMode === 'source') {
|
|
238
|
+
<button class="btn-icon" title="Copy Code" (click)="onCopy()">
|
|
239
|
+
<i class="fas fa-copy"></i> Copy
|
|
240
|
+
</button>
|
|
241
|
+
}
|
|
242
|
+
</div>
|
|
243
|
+
<div class="component-content-container">
|
|
244
|
+
@if (viewMode === 'preview') {
|
|
245
|
+
<div class="component-preview">
|
|
246
|
+
@if (hasError) {
|
|
247
|
+
<div class="error-state">
|
|
248
|
+
<i class="fas fa-exclamation-triangle"></i>
|
|
249
|
+
<h3>Component Error</h3>
|
|
250
|
+
<p>{{ errorMessage }}</p>
|
|
251
|
+
@if (errorDetails) {
|
|
252
|
+
<details>
|
|
253
|
+
<summary>Technical Details</summary>
|
|
254
|
+
<pre>{{ errorDetails }}</pre>
|
|
255
|
+
</details>
|
|
256
|
+
}
|
|
257
|
+
</div>
|
|
258
|
+
} @else {
|
|
259
|
+
@if (component) {
|
|
260
|
+
<mj-react-component
|
|
261
|
+
#reactComponent
|
|
262
|
+
[component]="component"
|
|
263
|
+
(componentEvent)="onComponentEvent($event)"
|
|
264
|
+
(stateChange)="onStateChange($event)"
|
|
265
|
+
(openEntityRecord)="onOpenEntityRecord($event)">
|
|
266
|
+
</mj-react-component>
|
|
267
|
+
}
|
|
268
|
+
@else {
|
|
269
|
+
<div class="error-state">
|
|
270
|
+
<i class="fas fa-exclamation-circle"></i>
|
|
271
|
+
<h3>No Component Loaded</h3>
|
|
272
|
+
<p>The component data is missing or invalid.</p>
|
|
273
|
+
</div>
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
</div>
|
|
277
|
+
} @else {
|
|
278
|
+
<mj-code-editor
|
|
279
|
+
[(ngModel)]="componentCode"
|
|
280
|
+
[language]="'typescript'"
|
|
281
|
+
[readonly]="readonly"
|
|
282
|
+
style="width: 100%; height: 100%;">
|
|
283
|
+
</mj-code-editor>
|
|
284
|
+
}
|
|
285
|
+
</div>
|
|
286
|
+
</div>
|
|
287
|
+
`, styles: ["\n .component-artifact-viewer {\n display: flex;\n flex-direction: column;\n height: 100%;\n }\n\n .component-toolbar {\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 8px;\n background: #f5f5f5;\n border-bottom: 1px solid #ddd;\n gap: 8px;\n }\n\n .component-badge {\n padding: 6px 12px;\n background: #28a745;\n color: white;\n border-radius: 12px;\n font-size: 11px;\n font-weight: 600;\n display: flex;\n align-items: center;\n gap: 6px;\n }\n\n .btn-icon {\n padding: 6px 12px;\n background: white;\n border: 1px solid #ccc;\n border-radius: 4px;\n cursor: pointer;\n font-size: 12px;\n display: flex;\n align-items: center;\n gap: 6px;\n }\n\n .btn-icon:hover {\n background: #e9ecef;\n border-color: #999;\n }\n\n .component-content-container {\n flex: 1;\n overflow: auto;\n }\n\n .component-preview {\n padding: 20px;\n background: white;\n height: 100%;\n overflow: auto;\n }\n\n .error-state {\n padding: 20px;\n text-align: center;\n color: #dc3545;\n }\n\n .error-state i {\n font-size: 48px;\n margin-bottom: 16px;\n }\n\n .error-state h3 {\n margin: 0 0 12px;\n font-size: 20px;\n font-weight: 600;\n }\n\n .error-state p {\n margin: 0 0 12px;\n color: #6c757d;\n }\n\n .error-state details {\n margin-top: 16px;\n text-align: left;\n background: #f8f9fa;\n padding: 12px;\n border-radius: 4px;\n }\n\n .error-state summary {\n cursor: pointer;\n font-weight: 600;\n color: #495057;\n }\n\n .error-state pre {\n margin-top: 8px;\n white-space: pre-wrap;\n word-wrap: break-word;\n font-size: 12px;\n color: #212529;\n }\n "] }]
|
|
288
|
+
}], () => [{ type: i1.AngularAdapterService }], { reactComponent: [{
|
|
289
|
+
type: ViewChild,
|
|
290
|
+
args: ['reactComponent']
|
|
291
|
+
}] }); })();
|
|
292
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(ComponentArtifactViewerComponent, { className: "ComponentArtifactViewerComponent", filePath: "src/lib/components/plugins/component-artifact-viewer.component.ts", lineNumber: 177 }); })();
|
|
293
|
+
//# sourceMappingURL=component-artifact-viewer.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component-artifact-viewer.component.js","sourceRoot":"","sources":["../../../../src/lib/components/plugins/component-artifact-viewer.component.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAiB,MAAM,eAAe,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACtE,OAAO,EAAE,iCAAiC,EAAE,MAAM,mCAAmC,CAAC;AAEtF,OAAO,EAAE,0BAA0B,EAAiB,MAAM,6CAA6C,CAAC;;;;;;;;;IAkB9F,kCAA8D;IAAnB,oMAAS,eAAQ,KAAC;IAC3D,wBAA2B;IAAC,sBAC9B;IAAA,iBAAS;;;IAaC,AADF,+BAAS,cACE;IAAA,iCAAiB;IAAA,iBAAU;IACpC,2BAAK;IAAA,YAAkB;IACzB,AADyB,iBAAM,EACrB;;;IADH,eAAkB;IAAlB,yCAAkB;;;IAP7B,+BAAyB;IACvB,wBAA2C;IAC3C,0BAAI;IAAA,+BAAe;IAAA,iBAAK;IACxB,yBAAG;IAAA,YAAkB;IAAA,iBAAI;IACzB,uHAAoB;IAMtB,iBAAM;;;IAPD,eAAkB;IAAlB,yCAAkB;IACrB,cAKC;IALD,8CAKC;;;;IAID,iDAKkD;IAAhD,AADA,AADA,sQAAkB,+BAAwB,KAAC,mPAC5B,4BAAqB,KAAC,6PACjB,iCAA0B,KAAC;IACjD,iBAAqB;;;IAJnB,4CAAuB;;;IAOzB,+BAAyB;IACvB,wBAAyC;IACzC,0BAAI;IAAA,mCAAmB;IAAA,iBAAK;IAC5B,yBAAG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;;;;;;;;;;;;;;;;;GA4DT;sDA0G4B,cAAc;kBAA1C,SAAS;mBAAC,gBAAgB;;kFADhB,gCAAgC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { DomSanitizer, SafeHtml } from '@angular/platform-browser';
|
|
2
|
+
import { BaseArtifactViewerPluginComponent } from '../base-artifact-viewer.component';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
/**
|
|
5
|
+
* Viewer component for HTML artifacts
|
|
6
|
+
*/
|
|
7
|
+
export declare class HtmlArtifactViewerComponent extends BaseArtifactViewerPluginComponent {
|
|
8
|
+
private sanitizer;
|
|
9
|
+
htmlContent: string;
|
|
10
|
+
safeHtmlContent: SafeHtml;
|
|
11
|
+
viewMode: 'preview' | 'source';
|
|
12
|
+
constructor(sanitizer: DomSanitizer);
|
|
13
|
+
ngOnInit(): void;
|
|
14
|
+
onCopy(): void;
|
|
15
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<HtmlArtifactViewerComponent, never>;
|
|
16
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<HtmlArtifactViewerComponent, "mj-html-artifact-viewer", never, {}, {}, never, never, false, never>;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=html-artifact-viewer.component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"html-artifact-viewer.component.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/plugins/html-artifact-viewer.component.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAEnE,OAAO,EAAE,iCAAiC,EAAE,MAAM,mCAAmC,CAAC;;AAEtF;;GAEG;AACH,qBAuFa,2BAA4B,SAAQ,iCAAiC;IAKpE,OAAO,CAAC,SAAS;IAJtB,WAAW,SAAM;IACjB,eAAe,EAAE,QAAQ,CAAM;IAC/B,QAAQ,EAAE,SAAS,GAAG,QAAQ,CAAa;gBAE9B,SAAS,EAAE,YAAY;IAI3C,QAAQ,IAAI,IAAI;IAKhB,MAAM,IAAI,IAAI;yCAdH,2BAA2B;2CAA3B,2BAA2B;CAuBvC"}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { Component } from '@angular/core';
|
|
8
|
+
import { RegisterClass } from '@memberjunction/global';
|
|
9
|
+
import { BaseArtifactViewerPluginComponent } from '../base-artifact-viewer.component';
|
|
10
|
+
import * as i0 from "@angular/core";
|
|
11
|
+
import * as i1 from "@angular/platform-browser";
|
|
12
|
+
import * as i2 from "@angular/common";
|
|
13
|
+
import * as i3 from "@angular/forms";
|
|
14
|
+
import * as i4 from "@memberjunction/ng-code-editor";
|
|
15
|
+
function HtmlArtifactViewerComponent_Conditional_12_Template(rf, ctx) { if (rf & 1) {
|
|
16
|
+
i0.ɵɵelementStart(0, "div", 9);
|
|
17
|
+
i0.ɵɵelement(1, "div", 11);
|
|
18
|
+
i0.ɵɵelementEnd();
|
|
19
|
+
} if (rf & 2) {
|
|
20
|
+
const ctx_r0 = i0.ɵɵnextContext();
|
|
21
|
+
i0.ɵɵadvance();
|
|
22
|
+
i0.ɵɵproperty("innerHTML", ctx_r0.safeHtmlContent, i0.ɵɵsanitizeHtml);
|
|
23
|
+
} }
|
|
24
|
+
function HtmlArtifactViewerComponent_Conditional_13_Template(rf, ctx) { if (rf & 1) {
|
|
25
|
+
const _r2 = i0.ɵɵgetCurrentView();
|
|
26
|
+
i0.ɵɵelementStart(0, "mj-code-editor", 12);
|
|
27
|
+
i0.ɵɵtwoWayListener("ngModelChange", function HtmlArtifactViewerComponent_Conditional_13_Template_mj_code_editor_ngModelChange_0_listener($event) { i0.ɵɵrestoreView(_r2); const ctx_r0 = i0.ɵɵnextContext(); i0.ɵɵtwoWayBindingSet(ctx_r0.htmlContent, $event) || (ctx_r0.htmlContent = $event); return i0.ɵɵresetView($event); });
|
|
28
|
+
i0.ɵɵelementEnd();
|
|
29
|
+
} if (rf & 2) {
|
|
30
|
+
const ctx_r0 = i0.ɵɵnextContext();
|
|
31
|
+
i0.ɵɵtwoWayProperty("ngModel", ctx_r0.htmlContent);
|
|
32
|
+
i0.ɵɵproperty("language", "html")("readonly", ctx_r0.readonly);
|
|
33
|
+
} }
|
|
34
|
+
/**
|
|
35
|
+
* Viewer component for HTML artifacts
|
|
36
|
+
*/
|
|
37
|
+
let HtmlArtifactViewerComponent = class HtmlArtifactViewerComponent extends BaseArtifactViewerPluginComponent {
|
|
38
|
+
sanitizer;
|
|
39
|
+
htmlContent = '';
|
|
40
|
+
safeHtmlContent = '';
|
|
41
|
+
viewMode = 'preview';
|
|
42
|
+
constructor(sanitizer) {
|
|
43
|
+
super();
|
|
44
|
+
this.sanitizer = sanitizer;
|
|
45
|
+
}
|
|
46
|
+
ngOnInit() {
|
|
47
|
+
this.htmlContent = this.getContent();
|
|
48
|
+
this.safeHtmlContent = this.sanitizer.sanitize(1, this.htmlContent) || '';
|
|
49
|
+
}
|
|
50
|
+
onCopy() {
|
|
51
|
+
if (this.htmlContent) {
|
|
52
|
+
navigator.clipboard.writeText(this.htmlContent).then(() => {
|
|
53
|
+
console.log('✅ Copied HTML to clipboard');
|
|
54
|
+
}).catch(err => {
|
|
55
|
+
console.error('Failed to copy to clipboard:', err);
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
static ɵfac = function HtmlArtifactViewerComponent_Factory(t) { return new (t || HtmlArtifactViewerComponent)(i0.ɵɵdirectiveInject(i1.DomSanitizer)); };
|
|
60
|
+
static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: HtmlArtifactViewerComponent, selectors: [["mj-html-artifact-viewer"]], features: [i0.ɵɵInheritDefinitionFeature], decls: 14, vars: 6, consts: [[1, "html-artifact-viewer", 3, "ngClass"], [1, "html-toolbar"], ["title", "Preview", 1, "btn-icon", 3, "click"], [1, "fas", "fa-eye"], ["title", "Source", 1, "btn-icon", 3, "click"], [1, "fas", "fa-code"], ["title", "Copy HTML", 1, "btn-icon", 3, "click"], [1, "fas", "fa-copy"], [1, "html-content-container"], [1, "html-preview"], [2, "width", "100%", "height", "100%", 3, "ngModel", "language", "readonly"], [3, "innerHTML"], [2, "width", "100%", "height", "100%", 3, "ngModelChange", "ngModel", "language", "readonly"]], template: function HtmlArtifactViewerComponent_Template(rf, ctx) { if (rf & 1) {
|
|
61
|
+
i0.ɵɵelementStart(0, "div", 0)(1, "div", 1)(2, "button", 2);
|
|
62
|
+
i0.ɵɵlistener("click", function HtmlArtifactViewerComponent_Template_button_click_2_listener() { return ctx.viewMode = "preview"; });
|
|
63
|
+
i0.ɵɵelement(3, "i", 3);
|
|
64
|
+
i0.ɵɵtext(4, " Preview ");
|
|
65
|
+
i0.ɵɵelementEnd();
|
|
66
|
+
i0.ɵɵelementStart(5, "button", 4);
|
|
67
|
+
i0.ɵɵlistener("click", function HtmlArtifactViewerComponent_Template_button_click_5_listener() { return ctx.viewMode = "source"; });
|
|
68
|
+
i0.ɵɵelement(6, "i", 5);
|
|
69
|
+
i0.ɵɵtext(7, " Source ");
|
|
70
|
+
i0.ɵɵelementEnd();
|
|
71
|
+
i0.ɵɵelementStart(8, "button", 6);
|
|
72
|
+
i0.ɵɵlistener("click", function HtmlArtifactViewerComponent_Template_button_click_8_listener() { return ctx.onCopy(); });
|
|
73
|
+
i0.ɵɵelement(9, "i", 7);
|
|
74
|
+
i0.ɵɵtext(10, " Copy ");
|
|
75
|
+
i0.ɵɵelementEnd()();
|
|
76
|
+
i0.ɵɵelementStart(11, "div", 8);
|
|
77
|
+
i0.ɵɵtemplate(12, HtmlArtifactViewerComponent_Conditional_12_Template, 2, 1, "div", 9)(13, HtmlArtifactViewerComponent_Conditional_13_Template, 1, 3, "mj-code-editor", 10);
|
|
78
|
+
i0.ɵɵelementEnd()();
|
|
79
|
+
} if (rf & 2) {
|
|
80
|
+
i0.ɵɵproperty("ngClass", ctx.cssClass);
|
|
81
|
+
i0.ɵɵadvance(2);
|
|
82
|
+
i0.ɵɵclassProp("active", ctx.viewMode === "preview");
|
|
83
|
+
i0.ɵɵadvance(3);
|
|
84
|
+
i0.ɵɵclassProp("active", ctx.viewMode === "source");
|
|
85
|
+
i0.ɵɵadvance(7);
|
|
86
|
+
i0.ɵɵconditional(ctx.viewMode === "preview" ? 12 : 13);
|
|
87
|
+
} }, dependencies: [i2.NgClass, i3.NgControlStatus, i3.NgModel, i4.CodeEditorComponent], styles: [".html-artifact-viewer[_ngcontent-%COMP%] {\n display: flex;\n flex-direction: column;\n height: 100%;\n }\n\n .html-toolbar[_ngcontent-%COMP%] {\n display: flex;\n justify-content: flex-end;\n align-items: center;\n gap: 8px;\n padding: 8px;\n background: #f5f5f5;\n border-bottom: 1px solid #ddd;\n }\n\n .btn-icon[_ngcontent-%COMP%] {\n padding: 6px 12px;\n background: white;\n border: 1px solid #ccc;\n border-radius: 4px;\n cursor: pointer;\n font-size: 12px;\n display: flex;\n align-items: center;\n gap: 6px;\n }\n\n .btn-icon[_ngcontent-%COMP%]:hover {\n background: #e9ecef;\n border-color: #999;\n }\n\n .btn-icon.active[_ngcontent-%COMP%] {\n background: #007acc;\n color: white;\n border-color: #007acc;\n }\n\n .html-content-container[_ngcontent-%COMP%] {\n flex: 1;\n overflow: auto;\n }\n\n .html-preview[_ngcontent-%COMP%] {\n padding: 20px;\n background: white;\n height: 100%;\n overflow: auto;\n }"] });
|
|
88
|
+
};
|
|
89
|
+
HtmlArtifactViewerComponent = __decorate([
|
|
90
|
+
RegisterClass(BaseArtifactViewerPluginComponent, 'HtmlArtifactViewerPlugin')
|
|
91
|
+
], HtmlArtifactViewerComponent);
|
|
92
|
+
export { HtmlArtifactViewerComponent };
|
|
93
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(HtmlArtifactViewerComponent, [{
|
|
94
|
+
type: Component,
|
|
95
|
+
args: [{ selector: 'mj-html-artifact-viewer', template: `
|
|
96
|
+
<div class="html-artifact-viewer" [ngClass]="cssClass">
|
|
97
|
+
<div class="html-toolbar">
|
|
98
|
+
<button class="btn-icon" [class.active]="viewMode === 'preview'"
|
|
99
|
+
title="Preview" (click)="viewMode = 'preview'">
|
|
100
|
+
<i class="fas fa-eye"></i> Preview
|
|
101
|
+
</button>
|
|
102
|
+
<button class="btn-icon" [class.active]="viewMode === 'source'"
|
|
103
|
+
title="Source" (click)="viewMode = 'source'">
|
|
104
|
+
<i class="fas fa-code"></i> Source
|
|
105
|
+
</button>
|
|
106
|
+
<button class="btn-icon" title="Copy HTML" (click)="onCopy()">
|
|
107
|
+
<i class="fas fa-copy"></i> Copy
|
|
108
|
+
</button>
|
|
109
|
+
</div>
|
|
110
|
+
<div class="html-content-container">
|
|
111
|
+
@if (viewMode === 'preview') {
|
|
112
|
+
<div class="html-preview">
|
|
113
|
+
<div [innerHTML]="safeHtmlContent"></div>
|
|
114
|
+
</div>
|
|
115
|
+
} @else {
|
|
116
|
+
<mj-code-editor
|
|
117
|
+
[(ngModel)]="htmlContent"
|
|
118
|
+
[language]="'html'"
|
|
119
|
+
[readonly]="readonly"
|
|
120
|
+
style="width: 100%; height: 100%;">
|
|
121
|
+
</mj-code-editor>
|
|
122
|
+
}
|
|
123
|
+
</div>
|
|
124
|
+
</div>
|
|
125
|
+
`, styles: ["\n .html-artifact-viewer {\n display: flex;\n flex-direction: column;\n height: 100%;\n }\n\n .html-toolbar {\n display: flex;\n justify-content: flex-end;\n align-items: center;\n gap: 8px;\n padding: 8px;\n background: #f5f5f5;\n border-bottom: 1px solid #ddd;\n }\n\n .btn-icon {\n padding: 6px 12px;\n background: white;\n border: 1px solid #ccc;\n border-radius: 4px;\n cursor: pointer;\n font-size: 12px;\n display: flex;\n align-items: center;\n gap: 6px;\n }\n\n .btn-icon:hover {\n background: #e9ecef;\n border-color: #999;\n }\n\n .btn-icon.active {\n background: #007acc;\n color: white;\n border-color: #007acc;\n }\n\n .html-content-container {\n flex: 1;\n overflow: auto;\n }\n\n .html-preview {\n padding: 20px;\n background: white;\n height: 100%;\n overflow: auto;\n }\n "] }]
|
|
126
|
+
}], () => [{ type: i1.DomSanitizer }], null); })();
|
|
127
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(HtmlArtifactViewerComponent, { className: "HtmlArtifactViewerComponent", filePath: "src/lib/components/plugins/html-artifact-viewer.component.ts", lineNumber: 96 }); })();
|
|
128
|
+
//# sourceMappingURL=html-artifact-viewer.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"html-artifact-viewer.component.js","sourceRoot":"","sources":["../../../../src/lib/components/plugins/html-artifact-viewer.component.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,iCAAiC,EAAE,MAAM,mCAAmC,CAAC;;;;;;;IAwB5E,8BAA0B;IACxB,0BAAyC;IAC3C,iBAAM;;;IADC,cAA6B;IAA7B,qEAA6B;;;;IAGpC,0CAIqC;IAHnC,mUAAyB;IAI3B,iBAAiB;;;IAJf,kDAAyB;IAEzB,AADA,iCAAmB,6BACE;;AA7BjC;;GAEG;AAwFI,IAAM,2BAA2B,GAAjC,MAAM,2BAA4B,SAAQ,iCAAiC;IAK5D;IAJb,WAAW,GAAG,EAAE,CAAC;IACjB,eAAe,GAAa,EA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iC,EAAE,0BAA0B,CAAC;GAChE,2BAA2B,CAuBvC;;iFAvBY,2BAA2B;cAvFvC,SAAS;2BACE,yBAAyB,YACzB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BT;;kFAuDU,2BAA2B"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { OnInit, ChangeDetectorRef } from '@angular/core';
|
|
2
|
+
import { DomSanitizer, SafeHtml } from '@angular/platform-browser';
|
|
3
|
+
import { BaseArtifactViewerPluginComponent } from '../base-artifact-viewer.component';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
/**
|
|
6
|
+
* Viewer component for JSON artifacts.
|
|
7
|
+
* Supports extract rules - shows displayMarkdown, displayHtml, or raw JSON editor (in that priority order).
|
|
8
|
+
* All content is displayed in the parent's Display tab.
|
|
9
|
+
*/
|
|
10
|
+
export declare class JsonArtifactViewerComponent extends BaseArtifactViewerPluginComponent implements OnInit {
|
|
11
|
+
private cdr;
|
|
12
|
+
private sanitizer;
|
|
13
|
+
jsonContent: string;
|
|
14
|
+
displayMarkdown: string | null;
|
|
15
|
+
displayHtml: string | null;
|
|
16
|
+
renderedMarkdown: SafeHtml | null;
|
|
17
|
+
private versionAttributes;
|
|
18
|
+
constructor(cdr: ChangeDetectorRef, sanitizer: DomSanitizer);
|
|
19
|
+
ngOnInit(): Promise<void>;
|
|
20
|
+
/**
|
|
21
|
+
* Override to return true when showing extracted displayMarkdown or displayHtml.
|
|
22
|
+
* Returns false when showing raw JSON editor (no extract rules available).
|
|
23
|
+
*/
|
|
24
|
+
get isShowingElevatedDisplay(): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Override to tell parent whether to show raw JSON tab.
|
|
27
|
+
* When showing elevated display (markdown/HTML), return true so parent shows JSON tab.
|
|
28
|
+
* When showing raw JSON editor, return false (no need for duplicate JSON tab).
|
|
29
|
+
*/
|
|
30
|
+
get parentShouldShowRawContent(): boolean;
|
|
31
|
+
private loadVersionAttributes;
|
|
32
|
+
private parseAttributeValue;
|
|
33
|
+
onCopy(): void;
|
|
34
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<JsonArtifactViewerComponent, never>;
|
|
35
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<JsonArtifactViewerComponent, "mj-json-artifact-viewer", never, {}, {}, never, never, false, never>;
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=json-artifact-viewer.component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json-artifact-viewer.component.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/plugins/json-artifact-viewer.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,MAAM,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AACrE,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAEnE,OAAO,EAAE,iCAAiC,EAAE,MAAM,mCAAmC,CAAC;;AAKtF;;;;GAIG;AACH,qBAuFa,2BAA4B,SAAQ,iCAAkC,YAAW,MAAM;IAQhG,OAAO,CAAC,GAAG;IACX,OAAO,CAAC,SAAS;IARZ,WAAW,SAAM;IACjB,eAAe,EAAE,MAAM,GAAG,IAAI,CAAQ;IACtC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAQ;IAClC,gBAAgB,EAAE,QAAQ,GAAG,IAAI,CAAQ;IAChD,OAAO,CAAC,iBAAiB,CAAwC;gBAGvD,GAAG,EAAE,iBAAiB,EACtB,SAAS,EAAE,YAAY;IAK3B,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAU/B;;;OAGG;IACH,IAAoB,wBAAwB,IAAI,OAAO,CAEtD;IAED;;;;OAIG;IACH,IAAoB,0BAA0B,IAAI,OAAO,CAExD;YAEa,qBAAqB;IAyDnC,OAAO,CAAC,mBAAmB;IAgB3B,MAAM,IAAI,IAAI;yCAlHH,2BAA2B;2CAA3B,2BAA2B;CA6HvC"}
|