Spot it. Save it. Free, local-first Chrome extension for images, videos and prompts. Explore 2,000+ curated cases and connect your library to AI Agents via MCP. 提示词导演
JavaScript ai-artai-videochrome-extensionclaude-codecodexhiggsfieldjimenglocal-firstmcpmidjourneymoodboardprompt-engineeringprompt-libraryprompt-managerreference-libraryseedancevisual-bookmarksweb-clipper
import { mkdir, readFile, writeFile } from "node:fs/promises";
import { join } from "node:path";
import { fileURLToPath } from "node:url";
const projectRoot = fileURLToPath(new URL("../", import.meta.url));
const sourcePath = join(projectRoot, "node_modules", "lucide-static", "icon-nodes.json");
const outputPath = join(projectRoot, "extension", "assets", "ui-icons.svg");
const iconNames = [
"arrow-down", "arrow-left", "arrow-up", "check", "chevron-down", "chevron-left", "chevron-right", "circle-check-big", "clipboard", "copy",
"download", "ellipsis", "external-link", "file-text", "audio-lines", "file-box", "folder", "image", "library", "clapperboard",
"list-checks", "fullscreen", "exit-fullscreen", "maximize-2", "minimize-2", "menu", "moon", "panel-left", "panel-left-close", "grip-vertical", "layers", "paperclip", "pencil", "play", "plus",
"refresh-cw", "repeat-2", "mark-in", "mark-out", "camera", "brackets", "eraser", "images", "message-square", "pause", "volume-2", "volume-x", "keyboard", "save", "search", "send", "settings", "sliders-horizontal", "sparkles", "square-check-big",
"square", "step-back", "step-forward", "sun", "tag", "trash-2", "undo-2", "upload", "video", "wand-sparkles", "x"
];
const iconNodes = JSON.parse(await readFile(sourcePath, "utf8"));
// Product editing marks: [> opens the range; <] closes it.
iconNodes['mark-in'] = [['path', { d: 'M7 4H3v16h4' }], ['path', { d: 'm11 7 7 5-7 5' }]];
iconNodes['mark-out'] = [['path', { d: 'M17 4h4v16h-4' }], ['path', { d: 'm13 7-7 5 7 5' }]];
// Product review controls: four corners enter review; inward corners leave it.
iconNodes['fullscreen'] = [['path', { d: 'M8 3H3v5M16 3h5v5M21 16v5h-5M8 21H3v-5' }]];
iconNodes['exit-fullscreen'] = [['path', { d: 'M3 8h5V3M16 3v5h5M21 16h-5v5M8 21v-5H3' }]];
const symbols = iconNames.map((name) => {
const nodes = iconNodes[name];
if (!nodes) throw new Error(`Lucide 图标不存在:${name}`);
return ` <symbol id="icon-${name}" viewBox="0 0 24 24">\n${nodes.map(renderNode).join("\n")}\n </symbol>`;
});
const sprite = [
"<!-- Generated from lucide-static (ISC; THIRD_PARTY_NOTICES.md) and PromptDirector editing marks and review controls. -->",
'<svg xmlns="http://www.w3.org/2000/svg" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2">',
...symbols,
"</svg>",
""
].join("\n");
await mkdir(join(projectRoot, "extension", "assets"), { recursive: true });
await writeFile(outputPath, sprite);
process.stdout.write(`${outputPath}\n${iconNames.length} 个本地图标\n`);
function renderNode([tag, attributes]) {
const props = Object.entries(attributes)
.map(([key, value]) => `${key}="${escapeXml(value)}"`)
.join(" ");
return ` <${tag}${props ? ` ${props}` : ""} />`;
}
function escapeXml(value) {
return String(value)
.replaceAll("&", "&")
.replaceAll('"', """)
.replaceAll("<", "<")
.replaceAll(">", ">");
}