llmasaservice-ui 0.7.25 → 0.7.26
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/index.js +37 -6
- package/dist/index.mjs +37 -6
- package/package.json +1 -1
- package/src/ChatPanel.tsx +35 -6
package/dist/index.js
CHANGED
|
@@ -259,13 +259,44 @@ var ChatPanel = ({
|
|
|
259
259
|
};
|
|
260
260
|
}, []);
|
|
261
261
|
(0, import_react3.useEffect)(() => {
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
link.
|
|
266
|
-
|
|
267
|
-
|
|
262
|
+
const existingLinks = document.querySelectorAll('link[data-source="llmasaservice-ui"]');
|
|
263
|
+
existingLinks.forEach((link) => {
|
|
264
|
+
var _a;
|
|
265
|
+
return (_a = link.parentNode) == null ? void 0 : _a.removeChild(link);
|
|
266
|
+
});
|
|
267
|
+
const existingStyles = document.querySelectorAll('style[data-source="llmasaservice-ui"]');
|
|
268
|
+
existingStyles.forEach((style) => {
|
|
269
|
+
var _a;
|
|
270
|
+
return (_a = style.parentNode) == null ? void 0 : _a.removeChild(style);
|
|
271
|
+
});
|
|
272
|
+
if (cssUrl) {
|
|
273
|
+
if (cssUrl.startsWith("http://") || cssUrl.startsWith("https://") || cssUrl.startsWith("/")) {
|
|
274
|
+
const link = document.createElement("link");
|
|
275
|
+
link.href = cssUrl;
|
|
276
|
+
link.rel = "stylesheet";
|
|
277
|
+
link.setAttribute("data-source", "llmasaservice-ui");
|
|
278
|
+
document.head.appendChild(link);
|
|
279
|
+
console.log("Added CSS link", link);
|
|
280
|
+
} else {
|
|
281
|
+
const style = document.createElement("style");
|
|
282
|
+
style.textContent = cssUrl;
|
|
283
|
+
style.setAttribute("data-source", "llmasaservice-ui");
|
|
284
|
+
document.head.appendChild(style);
|
|
285
|
+
console.log("Added inline CSS", style);
|
|
286
|
+
}
|
|
268
287
|
}
|
|
288
|
+
return () => {
|
|
289
|
+
const links = document.querySelectorAll('link[data-source="llmasaservice-ui"]');
|
|
290
|
+
links.forEach((link) => {
|
|
291
|
+
var _a;
|
|
292
|
+
return (_a = link.parentNode) == null ? void 0 : _a.removeChild(link);
|
|
293
|
+
});
|
|
294
|
+
const styles = document.querySelectorAll('style[data-source="llmasaservice-ui"]');
|
|
295
|
+
styles.forEach((style) => {
|
|
296
|
+
var _a;
|
|
297
|
+
return (_a = style.parentNode) == null ? void 0 : _a.removeChild(style);
|
|
298
|
+
});
|
|
299
|
+
};
|
|
269
300
|
}, [cssUrl]);
|
|
270
301
|
(0, import_react3.useEffect)(() => {
|
|
271
302
|
if (response && response.length > 0) {
|
package/dist/index.mjs
CHANGED
|
@@ -225,13 +225,44 @@ var ChatPanel = ({
|
|
|
225
225
|
};
|
|
226
226
|
}, []);
|
|
227
227
|
useEffect(() => {
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
link.
|
|
232
|
-
|
|
233
|
-
|
|
228
|
+
const existingLinks = document.querySelectorAll('link[data-source="llmasaservice-ui"]');
|
|
229
|
+
existingLinks.forEach((link) => {
|
|
230
|
+
var _a;
|
|
231
|
+
return (_a = link.parentNode) == null ? void 0 : _a.removeChild(link);
|
|
232
|
+
});
|
|
233
|
+
const existingStyles = document.querySelectorAll('style[data-source="llmasaservice-ui"]');
|
|
234
|
+
existingStyles.forEach((style) => {
|
|
235
|
+
var _a;
|
|
236
|
+
return (_a = style.parentNode) == null ? void 0 : _a.removeChild(style);
|
|
237
|
+
});
|
|
238
|
+
if (cssUrl) {
|
|
239
|
+
if (cssUrl.startsWith("http://") || cssUrl.startsWith("https://") || cssUrl.startsWith("/")) {
|
|
240
|
+
const link = document.createElement("link");
|
|
241
|
+
link.href = cssUrl;
|
|
242
|
+
link.rel = "stylesheet";
|
|
243
|
+
link.setAttribute("data-source", "llmasaservice-ui");
|
|
244
|
+
document.head.appendChild(link);
|
|
245
|
+
console.log("Added CSS link", link);
|
|
246
|
+
} else {
|
|
247
|
+
const style = document.createElement("style");
|
|
248
|
+
style.textContent = cssUrl;
|
|
249
|
+
style.setAttribute("data-source", "llmasaservice-ui");
|
|
250
|
+
document.head.appendChild(style);
|
|
251
|
+
console.log("Added inline CSS", style);
|
|
252
|
+
}
|
|
234
253
|
}
|
|
254
|
+
return () => {
|
|
255
|
+
const links = document.querySelectorAll('link[data-source="llmasaservice-ui"]');
|
|
256
|
+
links.forEach((link) => {
|
|
257
|
+
var _a;
|
|
258
|
+
return (_a = link.parentNode) == null ? void 0 : _a.removeChild(link);
|
|
259
|
+
});
|
|
260
|
+
const styles = document.querySelectorAll('style[data-source="llmasaservice-ui"]');
|
|
261
|
+
styles.forEach((style) => {
|
|
262
|
+
var _a;
|
|
263
|
+
return (_a = style.parentNode) == null ? void 0 : _a.removeChild(style);
|
|
264
|
+
});
|
|
265
|
+
};
|
|
235
266
|
}, [cssUrl]);
|
|
236
267
|
useEffect(() => {
|
|
237
268
|
if (response && response.length > 0) {
|
package/package.json
CHANGED
package/src/ChatPanel.tsx
CHANGED
|
@@ -192,13 +192,42 @@ const ChatPanel: React.FC<ChatPanelProps & ExtraProps> = ({
|
|
|
192
192
|
}, []);
|
|
193
193
|
|
|
194
194
|
useEffect(() => {
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
195
|
+
// Clean up any previously added CSS from this component
|
|
196
|
+
const existingLinks = document.querySelectorAll('link[data-source="llmasaservice-ui"]');
|
|
197
|
+
existingLinks.forEach(link => link.parentNode?.removeChild(link));
|
|
198
|
+
|
|
199
|
+
const existingStyles = document.querySelectorAll('style[data-source="llmasaservice-ui"]');
|
|
200
|
+
existingStyles.forEach(style => style.parentNode?.removeChild(style));
|
|
201
|
+
|
|
202
|
+
if (cssUrl) {
|
|
203
|
+
if (cssUrl.startsWith('http://') || cssUrl.startsWith('https://') || cssUrl.startsWith('/')) {
|
|
204
|
+
// If it's a URL, create a link element
|
|
205
|
+
const link = document.createElement("link");
|
|
206
|
+
link.href = cssUrl;
|
|
207
|
+
link.rel = "stylesheet";
|
|
208
|
+
// Add a data attribute to identify and remove this link later if needed
|
|
209
|
+
link.setAttribute('data-source', 'llmasaservice-ui');
|
|
210
|
+
document.head.appendChild(link);
|
|
211
|
+
console.log("Added CSS link", link);
|
|
212
|
+
} else {
|
|
213
|
+
// If it's a CSS string, create a style element
|
|
214
|
+
const style = document.createElement("style");
|
|
215
|
+
style.textContent = cssUrl;
|
|
216
|
+
// Add a data attribute to identify and remove this style later if needed
|
|
217
|
+
style.setAttribute('data-source', 'llmasaservice-ui');
|
|
218
|
+
document.head.appendChild(style);
|
|
219
|
+
console.log("Added inline CSS", style);
|
|
220
|
+
}
|
|
201
221
|
}
|
|
222
|
+
|
|
223
|
+
// Clean up when component unmounts
|
|
224
|
+
return () => {
|
|
225
|
+
const links = document.querySelectorAll('link[data-source="llmasaservice-ui"]');
|
|
226
|
+
links.forEach(link => link.parentNode?.removeChild(link));
|
|
227
|
+
|
|
228
|
+
const styles = document.querySelectorAll('style[data-source="llmasaservice-ui"]');
|
|
229
|
+
styles.forEach(style => style.parentNode?.removeChild(style));
|
|
230
|
+
};
|
|
202
231
|
}, [cssUrl]);
|
|
203
232
|
|
|
204
233
|
// response change. Update the history
|