@seed-ship/mcp-ui-solid 2.2.7 → 2.2.9
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/components/UIResourceRenderer.cjs +80 -73
- package/dist/components/UIResourceRenderer.cjs.map +1 -1
- package/dist/components/UIResourceRenderer.d.ts.map +1 -1
- package/dist/components/UIResourceRenderer.js +80 -73
- package/dist/components/UIResourceRenderer.js.map +1 -1
- package/package.json +1 -1
- package/src/components/ChartRenderer.test.tsx +43 -0
- package/src/components/UIResourceRenderer.tsx +52 -51
- package/src/components/renderCellValue.test.ts +24 -0
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -113,87 +113,94 @@ function ChartRenderer(props) {
|
|
|
113
113
|
setIframeUrl(url);
|
|
114
114
|
setIsLoading(false);
|
|
115
115
|
};
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
var
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
var _el$4 = getNextElement(_tmpl$8), _el$14 = _el$4.firstChild, [_el$15, _co$2] = getNextMarker(_el$14.nextSibling), _el$16 = _el$15.nextSibling, [_el$17, _co$3] = getNextMarker(_el$16.nextSibling), _el$18 = _el$17.nextSibling, [_el$19, _co$4] = getNextMarker(_el$18.nextSibling);
|
|
133
|
-
insert(_el$4, createComponent(Show, {
|
|
134
|
-
get when() {
|
|
135
|
-
return isLoading();
|
|
136
|
-
},
|
|
137
|
-
get children() {
|
|
138
|
-
return getNextElement(_tmpl$4);
|
|
139
|
-
}
|
|
140
|
-
}), _el$15, _co$2);
|
|
141
|
-
insert(_el$4, createComponent(Show, {
|
|
142
|
-
get when() {
|
|
143
|
-
return error();
|
|
144
|
-
},
|
|
145
|
-
get children() {
|
|
146
|
-
var _el$6 = getNextElement(_tmpl$5), _el$7 = _el$6.firstChild, _el$8 = _el$7.firstChild, _el$9 = _el$8.nextSibling;
|
|
147
|
-
insert(_el$9, error);
|
|
148
|
-
return _el$6;
|
|
149
|
-
}
|
|
150
|
-
}), _el$17, _co$3);
|
|
151
|
-
insert(_el$4, createComponent(Show, {
|
|
152
|
-
get when() {
|
|
153
|
-
return memo(() => !!iframeUrl())() && !error();
|
|
154
|
-
},
|
|
155
|
-
get children() {
|
|
156
|
-
var _el$0 = getNextElement(_tmpl$7), _el$12 = _el$0.firstChild, [_el$13, _co$] = getNextMarker(_el$12.nextSibling), _el$10 = _el$13.nextSibling, _el$11 = _el$10.firstChild;
|
|
157
|
-
insert(_el$0, createComponent(Show, {
|
|
116
|
+
return createComponent(Show, {
|
|
117
|
+
get when() {
|
|
118
|
+
return useNative();
|
|
119
|
+
},
|
|
120
|
+
get fallback() {
|
|
121
|
+
return (() => {
|
|
122
|
+
var _el$4 = getNextElement(_tmpl$8), _el$14 = _el$4.firstChild, [_el$15, _co$2] = getNextMarker(_el$14.nextSibling), _el$16 = _el$15.nextSibling, [_el$17, _co$3] = getNextMarker(_el$16.nextSibling), _el$18 = _el$17.nextSibling, [_el$19, _co$4] = getNextMarker(_el$18.nextSibling);
|
|
123
|
+
insert(_el$4, createComponent(Show, {
|
|
124
|
+
get when() {
|
|
125
|
+
return isLoading();
|
|
126
|
+
},
|
|
127
|
+
get children() {
|
|
128
|
+
return getNextElement(_tmpl$4);
|
|
129
|
+
}
|
|
130
|
+
}), _el$15, _co$2);
|
|
131
|
+
insert(_el$4, createComponent(Show, {
|
|
158
132
|
get when() {
|
|
159
|
-
|
|
160
|
-
return (_a = params()) == null ? void 0 : _a.title;
|
|
133
|
+
return error();
|
|
161
134
|
},
|
|
162
135
|
get children() {
|
|
163
|
-
var _el$
|
|
164
|
-
insert(_el$
|
|
136
|
+
var _el$6 = getNextElement(_tmpl$5), _el$7 = _el$6.firstChild, _el$8 = _el$7.firstChild, _el$9 = _el$8.nextSibling;
|
|
137
|
+
insert(_el$9, error);
|
|
138
|
+
return _el$6;
|
|
139
|
+
}
|
|
140
|
+
}), _el$17, _co$3);
|
|
141
|
+
insert(_el$4, createComponent(Show, {
|
|
142
|
+
get when() {
|
|
143
|
+
return memo(() => !!iframeUrl())() && !error();
|
|
144
|
+
},
|
|
145
|
+
get children() {
|
|
146
|
+
var _el$0 = getNextElement(_tmpl$7), _el$12 = _el$0.firstChild, [_el$13, _co$] = getNextMarker(_el$12.nextSibling), _el$10 = _el$13.nextSibling, _el$11 = _el$10.firstChild;
|
|
147
|
+
insert(_el$0, createComponent(Show, {
|
|
148
|
+
get when() {
|
|
149
|
+
var _a;
|
|
150
|
+
return (_a = params()) == null ? void 0 : _a.title;
|
|
151
|
+
},
|
|
152
|
+
get children() {
|
|
153
|
+
var _el$1 = getNextElement(_tmpl$6);
|
|
154
|
+
insert(_el$1, () => {
|
|
155
|
+
var _a;
|
|
156
|
+
return (_a = params()) == null ? void 0 : _a.title;
|
|
157
|
+
});
|
|
158
|
+
return _el$1;
|
|
159
|
+
}
|
|
160
|
+
}), _el$13, _co$);
|
|
161
|
+
_el$11.addEventListener("error", () => {
|
|
165
162
|
var _a;
|
|
166
|
-
|
|
163
|
+
setError("Failed to load chart");
|
|
164
|
+
(_a = props.onError) == null ? void 0 : _a.call(props, {
|
|
165
|
+
type: "render",
|
|
166
|
+
message: "Chart rendering failed",
|
|
167
|
+
componentId: props.component.id
|
|
168
|
+
});
|
|
169
|
+
});
|
|
170
|
+
effect((_p$) => {
|
|
171
|
+
var _a, _b, _c, _d;
|
|
172
|
+
var _v$3 = ((_a = params()) == null ? void 0 : _a.title) ? `Chart: ${(_b = params()) == null ? void 0 : _b.title}` : "Chart visualization", _v$4 = iframeUrl(), _v$5 = ((_c = params()) == null ? void 0 : _c.title) ? `Chart: ${(_d = params()) == null ? void 0 : _d.title}` : "Chart visualization";
|
|
173
|
+
_v$3 !== _p$.e && setAttribute(_el$10, "aria-label", _p$.e = _v$3);
|
|
174
|
+
_v$4 !== _p$.t && setAttribute(_el$11, "src", _p$.t = _v$4);
|
|
175
|
+
_v$5 !== _p$.a && setAttribute(_el$11, "alt", _p$.a = _v$5);
|
|
176
|
+
return _p$;
|
|
177
|
+
}, {
|
|
178
|
+
e: void 0,
|
|
179
|
+
t: void 0,
|
|
180
|
+
a: void 0
|
|
167
181
|
});
|
|
168
|
-
return _el$
|
|
182
|
+
return _el$0;
|
|
169
183
|
}
|
|
170
|
-
}), _el$
|
|
171
|
-
_el$
|
|
184
|
+
}), _el$19, _co$4);
|
|
185
|
+
return _el$4;
|
|
186
|
+
})();
|
|
187
|
+
},
|
|
188
|
+
get children() {
|
|
189
|
+
return createComponent(ChartJSRenderer, {
|
|
190
|
+
get component() {
|
|
191
|
+
return props.component;
|
|
192
|
+
},
|
|
193
|
+
onError: (err) => {
|
|
172
194
|
var _a;
|
|
173
|
-
|
|
174
|
-
(_a = props.onError) == null ? void 0 : _a.call(props, {
|
|
195
|
+
return (_a = props.onError) == null ? void 0 : _a.call(props, {
|
|
175
196
|
type: "render",
|
|
176
|
-
message:
|
|
197
|
+
message: err.message,
|
|
177
198
|
componentId: props.component.id
|
|
178
199
|
});
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
_v$3 !== _p$.e && setAttribute(_el$10, "aria-label", _p$.e = _v$3);
|
|
184
|
-
_v$4 !== _p$.t && setAttribute(_el$11, "src", _p$.t = _v$4);
|
|
185
|
-
_v$5 !== _p$.a && setAttribute(_el$11, "alt", _p$.a = _v$5);
|
|
186
|
-
return _p$;
|
|
187
|
-
}, {
|
|
188
|
-
e: void 0,
|
|
189
|
-
t: void 0,
|
|
190
|
-
a: void 0
|
|
191
|
-
});
|
|
192
|
-
return _el$0;
|
|
193
|
-
}
|
|
194
|
-
}), _el$19, _co$4);
|
|
195
|
-
return _el$4;
|
|
196
|
-
})();
|
|
200
|
+
}
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
});
|
|
197
204
|
}
|
|
198
205
|
function renderCellValue(value) {
|
|
199
206
|
if (value === null || value === void 0) {
|
|
@@ -234,8 +241,8 @@ function renderCellValue(value) {
|
|
|
234
241
|
const hasHtml = /<[a-z][\s\S]*>/i.test(strValue);
|
|
235
242
|
if (hasHtml) {
|
|
236
243
|
return purify.sanitize(strValue, {
|
|
237
|
-
ALLOWED_TAGS: ["a", "strong", "em", "b", "i", "code", "span", "br"],
|
|
238
|
-
ALLOWED_ATTR: ["href", "target", "rel", "class", "data-citation-page", "data-citation-source", "title"],
|
|
244
|
+
ALLOWED_TAGS: ["a", "strong", "em", "b", "i", "code", "span", "br", "button", "svg", "path"],
|
|
245
|
+
ALLOWED_ATTR: ["href", "target", "rel", "class", "data-citation-page", "data-citation-source", "data-citation-doc", "data-citation-verified", "title", "fill", "stroke", "viewBox", "stroke-linecap", "stroke-linejoin", "stroke-width", "d"],
|
|
239
246
|
ADD_ATTR: ["target", "rel"]
|
|
240
247
|
});
|
|
241
248
|
}
|