@memberjunction/ng-artifacts 2.108.0 → 2.110.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 +2 -1
- package/dist/lib/artifacts.module.d.ts.map +1 -1
- package/dist/lib/artifacts.module.js +7 -3
- package/dist/lib/artifacts.module.js.map +1 -1
- package/dist/lib/components/artifact-viewer-panel.component.d.ts +28 -3
- package/dist/lib/components/artifact-viewer-panel.component.d.ts.map +1 -1
- package/dist/lib/components/artifact-viewer-panel.component.js +362 -214
- package/dist/lib/components/artifact-viewer-panel.component.js.map +1 -1
- package/dist/lib/components/base-artifact-viewer.component.d.ts +28 -0
- package/dist/lib/components/base-artifact-viewer.component.d.ts.map +1 -1
- package/dist/lib/components/base-artifact-viewer.component.js +1 -1
- package/dist/lib/components/base-artifact-viewer.component.js.map +1 -1
- package/dist/lib/components/plugins/component-artifact-viewer.component.d.ts +19 -16
- package/dist/lib/components/plugins/component-artifact-viewer.component.d.ts.map +1 -1
- package/dist/lib/components/plugins/component-artifact-viewer.component.js +131 -182
- package/dist/lib/components/plugins/component-artifact-viewer.component.js.map +1 -1
- package/package.json +6 -6
|
@@ -4,25 +4,15 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
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
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import { Component, ViewChild } from '@angular/core';
|
|
7
|
+
import { Component, ViewChild, Output, EventEmitter } from '@angular/core';
|
|
8
8
|
import { RegisterClass, SafeJSONParse } from '@memberjunction/global';
|
|
9
9
|
import { BaseArtifactViewerPluginComponent } from '../base-artifact-viewer.component';
|
|
10
10
|
import { BuildComponentCompleteCode } from '@memberjunction/interactive-component-types';
|
|
11
11
|
import * as i0 from "@angular/core";
|
|
12
12
|
import * as i1 from "@memberjunction/ng-react";
|
|
13
13
|
import * as i2 from "@angular/common";
|
|
14
|
-
import * as i3 from "@angular/forms";
|
|
15
|
-
import * as i4 from "@memberjunction/ng-code-editor";
|
|
16
14
|
const _c0 = ["reactComponent"];
|
|
17
|
-
function
|
|
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) {
|
|
15
|
+
function ComponentArtifactViewerComponent_Conditional_2_Conditional_6_Template(rf, ctx) { if (rf & 1) {
|
|
26
16
|
i0.ɵɵelementStart(0, "details")(1, "summary");
|
|
27
17
|
i0.ɵɵtext(2, "Technical Details");
|
|
28
18
|
i0.ɵɵelementEnd();
|
|
@@ -30,40 +20,40 @@ function ComponentArtifactViewerComponent_Conditional_10_Conditional_1_Condition
|
|
|
30
20
|
i0.ɵɵtext(4);
|
|
31
21
|
i0.ɵɵelementEnd()();
|
|
32
22
|
} if (rf & 2) {
|
|
33
|
-
const
|
|
23
|
+
const ctx_r0 = i0.ɵɵnextContext(2);
|
|
34
24
|
i0.ɵɵadvance(4);
|
|
35
|
-
i0.ɵɵtextInterpolate(
|
|
25
|
+
i0.ɵɵtextInterpolate(ctx_r0.errorDetails);
|
|
36
26
|
} }
|
|
37
|
-
function
|
|
38
|
-
i0.ɵɵelementStart(0, "div",
|
|
39
|
-
i0.ɵɵelement(1, "i",
|
|
27
|
+
function ComponentArtifactViewerComponent_Conditional_2_Template(rf, ctx) { if (rf & 1) {
|
|
28
|
+
i0.ɵɵelementStart(0, "div", 3);
|
|
29
|
+
i0.ɵɵelement(1, "i", 4);
|
|
40
30
|
i0.ɵɵelementStart(2, "h3");
|
|
41
31
|
i0.ɵɵtext(3, "Component Error");
|
|
42
32
|
i0.ɵɵelementEnd();
|
|
43
33
|
i0.ɵɵelementStart(4, "p");
|
|
44
34
|
i0.ɵɵtext(5);
|
|
45
35
|
i0.ɵɵelementEnd();
|
|
46
|
-
i0.ɵɵtemplate(6,
|
|
36
|
+
i0.ɵɵtemplate(6, ComponentArtifactViewerComponent_Conditional_2_Conditional_6_Template, 5, 1, "details");
|
|
47
37
|
i0.ɵɵelementEnd();
|
|
48
38
|
} if (rf & 2) {
|
|
49
|
-
const
|
|
39
|
+
const ctx_r0 = i0.ɵɵnextContext();
|
|
50
40
|
i0.ɵɵadvance(5);
|
|
51
|
-
i0.ɵɵtextInterpolate(
|
|
41
|
+
i0.ɵɵtextInterpolate(ctx_r0.errorMessage);
|
|
52
42
|
i0.ɵɵadvance();
|
|
53
|
-
i0.ɵɵconditional(
|
|
43
|
+
i0.ɵɵconditional(ctx_r0.errorDetails ? 6 : -1);
|
|
54
44
|
} }
|
|
55
|
-
function
|
|
56
|
-
const
|
|
57
|
-
i0.ɵɵelementStart(0, "mj-react-component",
|
|
58
|
-
i0.ɵɵlistener("componentEvent", function
|
|
45
|
+
function ComponentArtifactViewerComponent_Conditional_3_Conditional_0_Template(rf, ctx) { if (rf & 1) {
|
|
46
|
+
const _r2 = i0.ɵɵgetCurrentView();
|
|
47
|
+
i0.ɵɵelementStart(0, "mj-react-component", 6, 0);
|
|
48
|
+
i0.ɵɵlistener("componentEvent", function ComponentArtifactViewerComponent_Conditional_3_Conditional_0_Template_mj_react_component_componentEvent_0_listener($event) { i0.ɵɵrestoreView(_r2); const ctx_r0 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r0.onComponentEvent($event)); });
|
|
59
49
|
i0.ɵɵelementEnd();
|
|
60
50
|
} if (rf & 2) {
|
|
61
|
-
const
|
|
62
|
-
i0.ɵɵproperty("component",
|
|
51
|
+
const ctx_r0 = i0.ɵɵnextContext(2);
|
|
52
|
+
i0.ɵɵproperty("component", ctx_r0.component);
|
|
63
53
|
} }
|
|
64
|
-
function
|
|
65
|
-
i0.ɵɵelementStart(0, "div",
|
|
66
|
-
i0.ɵɵelement(1, "i",
|
|
54
|
+
function ComponentArtifactViewerComponent_Conditional_3_Conditional_1_Template(rf, ctx) { if (rf & 1) {
|
|
55
|
+
i0.ɵɵelementStart(0, "div", 3);
|
|
56
|
+
i0.ɵɵelement(1, "i", 7);
|
|
67
57
|
i0.ɵɵelementStart(2, "h3");
|
|
68
58
|
i0.ɵɵtext(3, "No Component Loaded");
|
|
69
59
|
i0.ɵɵelementEnd();
|
|
@@ -71,41 +61,32 @@ function ComponentArtifactViewerComponent_Conditional_10_Conditional_2_Condition
|
|
|
71
61
|
i0.ɵɵtext(5, "The component data is missing or invalid.");
|
|
72
62
|
i0.ɵɵelementEnd()();
|
|
73
63
|
} }
|
|
74
|
-
function
|
|
75
|
-
i0.ɵɵtemplate(0,
|
|
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();
|
|
64
|
+
function ComponentArtifactViewerComponent_Conditional_3_Template(rf, ctx) { if (rf & 1) {
|
|
65
|
+
i0.ɵɵtemplate(0, ComponentArtifactViewerComponent_Conditional_3_Conditional_0_Template, 2, 1, "mj-react-component", 5)(1, ComponentArtifactViewerComponent_Conditional_3_Conditional_1_Template, 6, 0, "div", 3);
|
|
94
66
|
} if (rf & 2) {
|
|
95
|
-
const
|
|
96
|
-
i0.ɵɵ
|
|
97
|
-
i0.ɵɵproperty("language", "typescript")("readonly", ctx_r1.readonly);
|
|
67
|
+
const ctx_r0 = i0.ɵɵnextContext();
|
|
68
|
+
i0.ɵɵconditional(ctx_r0.component ? 0 : 1);
|
|
98
69
|
} }
|
|
99
70
|
/**
|
|
100
71
|
* Viewer component for interactive Component artifacts (React-based UI components)
|
|
72
|
+
*
|
|
73
|
+
* Features:
|
|
74
|
+
* - Live component preview with React rendering
|
|
75
|
+
* - Dynamic tabs for component metadata (via GetAdditionalTabs)
|
|
76
|
+
* - Provides tabs for: Code, Functional Requirements, Technical Design, Data Requirements
|
|
101
77
|
*/
|
|
102
78
|
let ComponentArtifactViewerComponent = class ComponentArtifactViewerComponent extends BaseArtifactViewerPluginComponent {
|
|
103
79
|
adapter;
|
|
104
80
|
reactComponent;
|
|
81
|
+
tabsChanged = new EventEmitter();
|
|
82
|
+
// Component data
|
|
105
83
|
component = null;
|
|
106
84
|
componentCode = "";
|
|
107
85
|
componentName = '';
|
|
108
|
-
|
|
86
|
+
get resolvedComponentSpec() {
|
|
87
|
+
return this.reactComponent?.resolvedComponentSpec || this.component;
|
|
88
|
+
}
|
|
89
|
+
// Error state
|
|
109
90
|
hasError = false;
|
|
110
91
|
errorMessage = '';
|
|
111
92
|
errorDetails = '';
|
|
@@ -113,15 +94,34 @@ let ComponentArtifactViewerComponent = class ComponentArtifactViewerComponent ex
|
|
|
113
94
|
super();
|
|
114
95
|
this.adapter = adapter;
|
|
115
96
|
}
|
|
116
|
-
async
|
|
117
|
-
//
|
|
118
|
-
if (
|
|
119
|
-
this.
|
|
97
|
+
async ngOnChanges(changes) {
|
|
98
|
+
// When artifactVersion input changes, reload the component spec
|
|
99
|
+
if (changes['artifactVersion'] && !changes['artifactVersion'].firstChange) {
|
|
100
|
+
await this.loadComponentSpec();
|
|
101
|
+
// Notify parent that tabs may have changed
|
|
102
|
+
this.tabsChanged.emit();
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
async loadComponentSpec() {
|
|
106
|
+
try {
|
|
107
|
+
if (this.artifactVersion.Content) {
|
|
108
|
+
this.component = SafeJSONParse(this.artifactVersion.Content);
|
|
109
|
+
this.extractComponentParts();
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
throw new Error('Artifact content is empty');
|
|
113
|
+
}
|
|
120
114
|
}
|
|
121
|
-
|
|
122
|
-
|
|
115
|
+
catch (error) {
|
|
116
|
+
console.error('Failed to load component spec:', error);
|
|
117
|
+
this.hasError = true;
|
|
118
|
+
this.errorMessage = 'Failed to load component';
|
|
119
|
+
this.errorDetails = error instanceof Error ? error.message : String(error);
|
|
123
120
|
}
|
|
124
|
-
|
|
121
|
+
}
|
|
122
|
+
async ngOnInit() {
|
|
123
|
+
// Load initial component spec
|
|
124
|
+
await this.loadComponentSpec();
|
|
125
125
|
// Initialize Angular adapter for React components
|
|
126
126
|
try {
|
|
127
127
|
await this.adapter.initialize();
|
|
@@ -137,53 +137,77 @@ let ComponentArtifactViewerComponent = class ComponentArtifactViewerComponent ex
|
|
|
137
137
|
// Component initialization happens automatically via mj-react-component
|
|
138
138
|
}
|
|
139
139
|
/**
|
|
140
|
-
*
|
|
140
|
+
* Provide additional tabs for viewing component metadata
|
|
141
141
|
*/
|
|
142
|
-
|
|
143
|
-
|
|
142
|
+
GetAdditionalTabs() {
|
|
143
|
+
const tabs = [];
|
|
144
|
+
const resolvedComponent = this.resolvedComponentSpec;
|
|
145
|
+
if (!resolvedComponent) {
|
|
146
|
+
return tabs;
|
|
147
|
+
}
|
|
148
|
+
// Functional Requirements tab
|
|
149
|
+
if (resolvedComponent.functionalRequirements) {
|
|
150
|
+
tabs.push({
|
|
151
|
+
label: 'Functional',
|
|
152
|
+
icon: 'fa-clipboard-list',
|
|
153
|
+
contentType: 'markdown',
|
|
154
|
+
content: resolvedComponent.functionalRequirements
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
// Technical Design tab
|
|
158
|
+
if (resolvedComponent.technicalDesign) {
|
|
159
|
+
tabs.push({
|
|
160
|
+
label: 'Technical',
|
|
161
|
+
icon: 'fa-wrench',
|
|
162
|
+
contentType: 'markdown',
|
|
163
|
+
content: resolvedComponent.technicalDesign
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
// Data Requirements tab
|
|
167
|
+
if (resolvedComponent.dataRequirements) {
|
|
168
|
+
tabs.push({
|
|
169
|
+
label: 'Data',
|
|
170
|
+
icon: 'fa-database',
|
|
171
|
+
contentType: 'json',
|
|
172
|
+
content: JSON.stringify(resolvedComponent.dataRequirements, null, 2),
|
|
173
|
+
language: 'json'
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
// Code tab (lazy-loaded)
|
|
177
|
+
tabs.push({
|
|
178
|
+
label: 'Code',
|
|
179
|
+
icon: 'fa-code',
|
|
180
|
+
contentType: 'code',
|
|
181
|
+
language: 'typescript',
|
|
182
|
+
content: () => BuildComponentCompleteCode(resolvedComponent)
|
|
183
|
+
});
|
|
184
|
+
// Spec tab - Shows fully resolved component spec in JSON format (rightmost)
|
|
185
|
+
tabs.push({
|
|
186
|
+
label: 'Spec',
|
|
187
|
+
icon: 'fa-file-code',
|
|
188
|
+
contentType: 'json',
|
|
189
|
+
content: () => JSON.stringify(resolvedComponent, null, 2),
|
|
190
|
+
language: 'json'
|
|
191
|
+
});
|
|
192
|
+
return tabs;
|
|
144
193
|
}
|
|
145
194
|
/**
|
|
146
|
-
*
|
|
195
|
+
* Remove standard JSON tab since we provide "Resolved JSON" custom tab
|
|
196
|
+
* The custom tab shows the fully resolved component spec instead of raw artifact JSON
|
|
147
197
|
*/
|
|
148
|
-
|
|
149
|
-
return
|
|
198
|
+
GetStandardTabRemovals() {
|
|
199
|
+
return ['JSON'];
|
|
150
200
|
}
|
|
151
201
|
extractComponentParts() {
|
|
152
|
-
if (this.
|
|
153
|
-
this.componentName = this.
|
|
202
|
+
if (this.resolvedComponentSpec?.name) {
|
|
203
|
+
this.componentName = this.resolvedComponentSpec.name;
|
|
154
204
|
}
|
|
155
|
-
if (this.
|
|
156
|
-
this.componentCode = BuildComponentCompleteCode(this.
|
|
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
|
-
});
|
|
205
|
+
if (this.resolvedComponentSpec?.code) {
|
|
206
|
+
this.componentCode = BuildComponentCompleteCode(this.resolvedComponentSpec);
|
|
166
207
|
}
|
|
167
208
|
}
|
|
168
209
|
onComponentEvent(event) {
|
|
169
|
-
|
|
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
|
|
210
|
+
console.log('Component event:', event);
|
|
187
211
|
}
|
|
188
212
|
static ɵfac = function ComponentArtifactViewerComponent_Factory(t) { return new (t || ComponentArtifactViewerComponent)(i0.ɵɵdirectiveInject(i1.AngularAdapterService)); };
|
|
189
213
|
static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: ComponentArtifactViewerComponent, selectors: [["mj-component-artifact-viewer"]], viewQuery: function ComponentArtifactViewerComponent_Query(rf, ctx) { if (rf & 1) {
|
|
@@ -191,32 +215,15 @@ let ComponentArtifactViewerComponent = class ComponentArtifactViewerComponent ex
|
|
|
191
215
|
} if (rf & 2) {
|
|
192
216
|
let _t;
|
|
193
217
|
i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.reactComponent = _t.first);
|
|
194
|
-
} }, features: [i0.ɵɵInheritDefinitionFeature], decls:
|
|
195
|
-
i0.ɵɵelementStart(0, "div", 1)(1, "div", 2)
|
|
196
|
-
i0.ɵɵ
|
|
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);
|
|
218
|
+
} }, outputs: { tabsChanged: "tabsChanged" }, features: [i0.ɵɵInheritDefinitionFeature, i0.ɵɵNgOnChangesFeature], decls: 4, vars: 2, consts: [["reactComponent", ""], [1, "component-artifact-viewer", 3, "ngClass"], [1, "component-preview"], [1, "error-state"], [1, "fa-solid", "fa-exclamation-triangle"], [3, "component"], [3, "componentEvent", "component"], [1, "fa-solid", "fa-exclamation-circle"]], template: function ComponentArtifactViewerComponent_Template(rf, ctx) { if (rf & 1) {
|
|
219
|
+
i0.ɵɵelementStart(0, "div", 1)(1, "div", 2);
|
|
220
|
+
i0.ɵɵtemplate(2, ComponentArtifactViewerComponent_Conditional_2_Template, 7, 2, "div", 3)(3, ComponentArtifactViewerComponent_Conditional_3_Template, 2, 1);
|
|
208
221
|
i0.ɵɵelementEnd()();
|
|
209
222
|
} if (rf & 2) {
|
|
210
223
|
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
224
|
i0.ɵɵadvance(2);
|
|
218
|
-
i0.ɵɵconditional(ctx.
|
|
219
|
-
} }, dependencies: [i2.NgClass,
|
|
225
|
+
i0.ɵɵconditional(ctx.hasError ? 2 : 3);
|
|
226
|
+
} }, dependencies: [i2.NgClass, i1.MJReactComponent], styles: [".component-artifact-viewer[_ngcontent-%COMP%] {\n display: flex;\n flex-direction: column;\n height: 100%;\n width: 100%;\n background: white;\n}\n\n.component-preview[_ngcontent-%COMP%] {\n flex: 1;\n padding: 15px;\n overflow: auto;\n display: flex;\n flex-direction: column;\n}\n\n.error-state[_ngcontent-%COMP%] {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n padding: 40px;\n text-align: center;\n color: #dc3545;\n\n i {\n font-size: 48px;\n margin-bottom: 16px;\n }\n\n h3 {\n margin: 0 0 8px 0;\n font-size: 20px;\n }\n\n p {\n margin: 0 0 12px 0;\n color: #6c757d;\n }\n\n details {\n margin-top: 16px;\n text-align: left;\n max-width: 600px;\n\n summary {\n cursor: pointer;\n color: #495057;\n font-weight: 500;\n margin-bottom: 8px;\n\n &:hover {\n color: #212529;\n }\n }\n\n pre {\n background: #f8f9fa;\n padding: 12px;\n border-radius: 4px;\n overflow-x: auto;\n font-size: 12px;\n color: #495057;\n margin: 0;\n }\n }\n}"] });
|
|
220
227
|
};
|
|
221
228
|
ComponentArtifactViewerComponent = __decorate([
|
|
222
229
|
RegisterClass(BaseArtifactViewerPluginComponent, 'ComponentArtifactViewerPlugin')
|
|
@@ -224,70 +231,12 @@ ComponentArtifactViewerComponent = __decorate([
|
|
|
224
231
|
export { ComponentArtifactViewerComponent };
|
|
225
232
|
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ComponentArtifactViewerComponent, [{
|
|
226
233
|
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 "] }]
|
|
234
|
+
args: [{ selector: 'mj-component-artifact-viewer', template: "<div class=\"component-artifact-viewer\" [ngClass]=\"cssClass\">\n <!-- Component Preview (full screen) -->\n <div class=\"component-preview\">\n @if (hasError) {\n <div class=\"error-state\">\n <i class=\"fa-solid fa-exclamation-triangle\"></i>\n <h3>Component Error</h3>\n <p>{{ errorMessage }}</p>\n @if (errorDetails) {\n <details>\n <summary>Technical Details</summary>\n <pre>{{ errorDetails }}</pre>\n </details>\n }\n </div>\n } @else {\n @if (component) {\n <mj-react-component\n #reactComponent\n [component]=\"component\"\n (componentEvent)=\"onComponentEvent($event)\">\n </mj-react-component>\n } @else {\n <div class=\"error-state\">\n <i class=\"fa-solid fa-exclamation-circle\"></i>\n <h3>No Component Loaded</h3>\n <p>The component data is missing or invalid.</p>\n </div>\n }\n }\n </div>\n</div>\n\n", styles: [".component-artifact-viewer {\n display: flex;\n flex-direction: column;\n height: 100%;\n width: 100%;\n background: white;\n}\n\n.component-preview {\n flex: 1;\n padding: 15px;\n overflow: auto;\n display: flex;\n flex-direction: column;\n}\n\n.error-state {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n padding: 40px;\n text-align: center;\n color: #dc3545;\n\n i {\n font-size: 48px;\n margin-bottom: 16px;\n }\n\n h3 {\n margin: 0 0 8px 0;\n font-size: 20px;\n }\n\n p {\n margin: 0 0 12px 0;\n color: #6c757d;\n }\n\n details {\n margin-top: 16px;\n text-align: left;\n max-width: 600px;\n\n summary {\n cursor: pointer;\n color: #495057;\n font-weight: 500;\n margin-bottom: 8px;\n\n &:hover {\n color: #212529;\n }\n }\n\n pre {\n background: #f8f9fa;\n padding: 12px;\n border-radius: 4px;\n overflow-x: auto;\n font-size: 12px;\n color: #495057;\n margin: 0;\n }\n }\n}\n"] }]
|
|
288
235
|
}], () => [{ type: i1.AngularAdapterService }], { reactComponent: [{
|
|
289
236
|
type: ViewChild,
|
|
290
237
|
args: ['reactComponent']
|
|
238
|
+
}], tabsChanged: [{
|
|
239
|
+
type: Output
|
|
291
240
|
}] }); })();
|
|
292
|
-
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(ComponentArtifactViewerComponent, { className: "ComponentArtifactViewerComponent", filePath: "src/lib/components/plugins/component-artifact-viewer.component.ts", lineNumber:
|
|
241
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(ComponentArtifactViewerComponent, { className: "ComponentArtifactViewerComponent", filePath: "src/lib/components/plugins/component-artifact-viewer.component.ts", lineNumber: 21 }); })();
|
|
293
242
|
//# sourceMappingURL=component-artifact-viewer.component.js.map
|
|
@@ -1 +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,
|
|
1
|
+
{"version":3,"file":"component-artifact-viewer.component.js","sourceRoot":"","sources":["../../../../src/lib/components/plugins/component-artifact-viewer.component.ts","../../../../src/lib/components/plugins/component-artifact-viewer.component.html"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAmD,MAAM,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC5H,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACtE,OAAO,EAAE,iCAAiC,EAAqB,MAAM,mCAAmC,CAAC;AAEzG,OAAO,EAAE,0BAA0B,EAAiB,MAAM,6CAA6C,CAAC;;;;;;ICM5F,AADF,+BAAS,cACE;IAAA,iCAAiB;IAAA,iBAAU;IACpC,2BAAK;IAAA,YAAkB;IACzB,AADyB,iBAAM,EACrB;;;IADH,eAAkB;IAAlB,yCAAkB;;;IAP7B,8BAAyB;IACvB,uBAAgD;IAChD,0BAAI;IAAA,+BAAe;IAAA,iBAAK;IACxB,yBAAG;IAAA,YAAkB;IAAA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0",
|
|
4
4
|
"description": "MemberJunction: Artifact viewer plugin system for rendering different artifact types (JSON, Code, Markdown, HTML, SVG, Components)",
|
|
5
5
|
"main": "./dist/public-api.js",
|
|
6
6
|
"typings": "./dist/public-api.d.ts",
|
|
@@ -26,11 +26,11 @@
|
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@memberjunction/core": "2.100.3",
|
|
28
28
|
"@memberjunction/global": "2.100.3",
|
|
29
|
-
"@memberjunction/core-entities": "2.
|
|
30
|
-
"@memberjunction/ng-base-types": "2.
|
|
31
|
-
"@memberjunction/ng-code-editor": "2.
|
|
32
|
-
"@memberjunction/ng-react": "2.
|
|
33
|
-
"@memberjunction/ng-notifications": "2.
|
|
29
|
+
"@memberjunction/core-entities": "2.110.0",
|
|
30
|
+
"@memberjunction/ng-base-types": "2.110.0",
|
|
31
|
+
"@memberjunction/ng-code-editor": "2.110.0",
|
|
32
|
+
"@memberjunction/ng-react": "2.110.0",
|
|
33
|
+
"@memberjunction/ng-notifications": "2.110.0",
|
|
34
34
|
"@angular/cdk": "18.0.2",
|
|
35
35
|
"tslib": "^2.3.0",
|
|
36
36
|
"rxjs": "^7.8.1",
|