fix: polish workspace files and editor shell

This commit is contained in:
2026-06-19 23:37:10 +08:00
parent a6412fa070
commit 5c979174f1
23 changed files with 497 additions and 249 deletions
+50 -16
View File
@@ -1,6 +1,6 @@
<script>
/**
* Icon.svelte — Renders inline SVG icons.
* Icon.svelte — Renders bundled Lucide SVG icons.
*
* Usage:
* <Icon name="puzzle" size={18} />
@@ -8,26 +8,60 @@
*
* Rules:
* - NO emoji, NO unicode pictographic symbols
* - ALL icons must be SVG registered in ../ui/icons.js
* - If name is not found, renders a default dot icon
* - NO dependency on system icon fonts
* - If name is not found, renders a default circle icon
*/
import { iconPaths } from './icons.js';
import Briefcase from 'lucide-svelte/icons/briefcase';
import ChevronDown from 'lucide-svelte/icons/chevron-down';
import ChevronRight from 'lucide-svelte/icons/chevron-right';
import Circle from 'lucide-svelte/icons/circle';
import FlaskConical from 'lucide-svelte/icons/flask-conical';
import Folder from 'lucide-svelte/icons/folder';
import LayoutGrid from 'lucide-svelte/icons/layout-grid';
import PanelsTopLeft from 'lucide-svelte/icons/panels-top-left';
import Pencil from 'lucide-svelte/icons/pencil';
import Plug from 'lucide-svelte/icons/plug';
import Puzzle from 'lucide-svelte/icons/puzzle';
import Settings from 'lucide-svelte/icons/settings';
import Shield from 'lucide-svelte/icons/shield';
import TriangleAlert from 'lucide-svelte/icons/triangle-alert';
export let name = 'dot';
export let size = 16;
export let className = '';
$: icon = iconPaths[name] || iconPaths.dot;
const icons = {
case: Briefcase,
chevronDown: ChevronDown,
chevronRight: ChevronRight,
dot: Circle,
edit: Pencil,
flask: FlaskConical,
folder: Folder,
gear: Settings,
logo: PanelsTopLeft,
plugin: Plug,
puzzle: Puzzle,
space: LayoutGrid,
vault: Shield,
warning: TriangleAlert,
};
const aliases = {
'🧪': 'flask',
danger: 'warning',
settings: 'gear',
};
$: iconKey = aliases[name] || name || 'dot';
$: IconComponent = icons[iconKey] || icons.dot;
$: iconClass = [className, $$restProps.class].filter(Boolean).join(' ');
</script>
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox={icon.viewBox}
width={size}
height={size}
class={className}
>
{#each icon.paths as p}
<path d={p.d} {...p.attrs} />
{/each}
</svg>
<svelte:component
this={IconComponent}
size={size}
{...$$restProps}
class={iconClass}
aria-hidden="true"
/>