Two more > 400 LOC modules split along responsibility seams. Zero
behavior change — public APIs re-export from the original file paths,
so every consumer import stays working.
| Original | Split into | LOC each |
|---------------------------------------|-------------------------------|----------|
| src/main/skills/import.ts (458) | import (orchestrator) / | 132 |
| | discovery (findSkillMdFiles, | 153 |
| | buildLocalInventory) | |
| | materialize | 24 |
| | import-local | 147 |
| | import-url | 85 |
| src/renderer/components/ui/ | primitives (barrel re-export) | 11 |
| primitives.tsx (419) | Card / Eyebrow / Badge / | 9–59 |
| | Spinner / Panel / Field / | each |
| | Input / Select / TextArea / | |
| | ActionButton / SectionButton | |
`createSkillImporter` still returns `{ importFromSource, importFromGitHub,
importFromLocal, importFromUrl, cleanupSkillFiles, parseGitHubUrl,
findSkillMdFiles, buildLocalInventory }` — every existing consumer
resolves unchanged.
`primitives.tsx` is now a pure barrel re-exporting the 11 primitives.
Consumers can migrate to direct imports (`../ui/Card`) opportunistically
but the barrel path keeps working.
45 lines
1.3 KiB
TypeScript
45 lines
1.3 KiB
TypeScript
export function TextArea({
|
|
value,
|
|
onChange,
|
|
placeholder,
|
|
rows = 4,
|
|
label,
|
|
hint,
|
|
readOnly = false,
|
|
disabled = false,
|
|
}: {
|
|
value: string;
|
|
onChange: (value: string) => void;
|
|
placeholder?: string;
|
|
rows?: number;
|
|
label?: string;
|
|
hint?: string;
|
|
readOnly?: boolean;
|
|
disabled?: boolean;
|
|
}) {
|
|
const textarea = (
|
|
<textarea
|
|
className="focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 w-full max-w-full rounded-lg border border-border bg-card px-3.5 py-2.5 text-[14px] text-foreground placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-60 break-words"
|
|
style={{ overflowWrap: "anywhere", wordBreak: "break-word", whiteSpace: "pre-wrap" }}
|
|
value={value}
|
|
rows={rows}
|
|
placeholder={placeholder}
|
|
readOnly={readOnly}
|
|
disabled={disabled}
|
|
onChange={(event) => onChange(event.target.value)}
|
|
/>
|
|
);
|
|
if (label) {
|
|
return (
|
|
<label className="block">
|
|
<div className="mb-1.5 flex items-center gap-1.5 text-[12px] font-medium text-muted-foreground">
|
|
{label}
|
|
{hint ? <span title={hint} className="cursor-help text-[10px] text-muted-foreground/60 hover:text-muted-foreground">(?)</span> : null}
|
|
</div>
|
|
{textarea}
|
|
</label>
|
|
);
|
|
}
|
|
return textarea;
|
|
}
|