@elyracode/design-lookup 0.9.56 → 0.9.58
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/extensions/index.ts +18 -13
- package/package.json +1 -1
package/extensions/index.ts
CHANGED
|
@@ -200,9 +200,9 @@ const EXTRACTION_SCRIPT = `
|
|
|
200
200
|
function rgbToHex(rgb: string): string {
|
|
201
201
|
const match = rgb.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)/);
|
|
202
202
|
if (!match) return rgb;
|
|
203
|
-
const r = parseInt(match[1]);
|
|
204
|
-
const g = parseInt(match[2]);
|
|
205
|
-
const b = parseInt(match[3]);
|
|
203
|
+
const r = parseInt(match[1], 10);
|
|
204
|
+
const g = parseInt(match[2], 10);
|
|
205
|
+
const b = parseInt(match[3], 10);
|
|
206
206
|
return `#${((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1).toUpperCase()}`;
|
|
207
207
|
}
|
|
208
208
|
|
|
@@ -226,12 +226,15 @@ function formatDesignSystem(url: string, data: any): string {
|
|
|
226
226
|
// CSS Custom Properties (color-related)
|
|
227
227
|
if (data.cssVars && Object.keys(data.cssVars).length > 0) {
|
|
228
228
|
const colorVars = Object.entries(data.cssVars).filter(
|
|
229
|
-
([k, v]) =>
|
|
230
|
-
|
|
231
|
-
(v as string).startsWith("
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
229
|
+
([k, v]) =>
|
|
230
|
+
typeof v === "string" &&
|
|
231
|
+
((v as string).startsWith("#") ||
|
|
232
|
+
(v as string).startsWith("rgb") ||
|
|
233
|
+
(v as string).startsWith("hsl") ||
|
|
234
|
+
k.includes("color") ||
|
|
235
|
+
k.includes("bg") ||
|
|
236
|
+
k.includes("foreground") ||
|
|
237
|
+
k.includes("background")),
|
|
235
238
|
);
|
|
236
239
|
if (colorVars.length > 0) {
|
|
237
240
|
lines.push(``);
|
|
@@ -407,10 +410,12 @@ await browser.close();
|
|
|
407
410
|
const msg = error instanceof Error ? error.message : String(error);
|
|
408
411
|
if (msg.includes("puppeteer") || msg.includes("Cannot find module")) {
|
|
409
412
|
return {
|
|
410
|
-
content: [
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
413
|
+
content: [
|
|
414
|
+
{
|
|
415
|
+
type: "text",
|
|
416
|
+
text: "Puppeteer is required for design extraction.\n\nInstall: npm install -g puppeteer",
|
|
417
|
+
},
|
|
418
|
+
],
|
|
414
419
|
details: { url: params.url, outputPath },
|
|
415
420
|
};
|
|
416
421
|
}
|
package/package.json
CHANGED