From 035ce54596832ecbe56e4870200337effe267a6a Mon Sep 17 00:00:00 2001 From: QQ Date: Wed, 11 Nov 2026 22:27:58 +0800 Subject: [PATCH] Import lib/types/client/group-icons-science.d.ts --- lib/types/client/group-icons-science.d.ts | 79 +++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 lib/types/client/group-icons-science.d.ts diff --git a/lib/types/client/group-icons-science.d.ts b/lib/types/client/group-icons-science.d.ts new file mode 100644 index 0000000..cf7d4b6 --- /dev/null +++ b/lib/types/client/group-icons-science.d.ts @@ -0,0 +1,79 @@ +/** + * Self-drawn monochrome artwork for the "Materials & Lab" icon family. + * + * The Host primitive package only ships product/generic glyphs, so the 28 + * research icons are drawn here in the exact same visual language as the Host + * ones: a 16x16 viewBox, `currentColor` stroke, 1.3 stroke width (Host + * `ICON_MEDIUM_STROKE`), round caps/joins and no fill. Keeping the artwork as + * primitive data (instead of one opaque `` per icon) lets the icon test + * assert every coordinate stays inside the viewBox and that each id has + * artwork — a hand-tuned path string could silently drift out of frame. + */ +import type { ReactElement } from 'react'; +/** One drawable primitive of a 16x16 icon; coordinates are in viewBox units. */ +export type SciencePrimitive = { + readonly kind: 'line'; + readonly x1: number; + readonly y1: number; + readonly x2: number; + readonly y2: number; +} | { + readonly kind: 'rect'; + readonly x: number; + readonly y: number; + readonly width: number; + readonly height: number; + readonly radius?: number; +} | { + readonly kind: 'circle'; + readonly cx: number; + readonly cy: number; + readonly radius: number; + readonly filled?: boolean; +} | { + readonly kind: 'ellipse'; + readonly cx: number; + readonly cy: number; + readonly rx: number; + readonly ry: number; + /** Rotation around the icon centre (8,8), in degrees. */ + readonly rotate?: number; +} | { + readonly kind: 'path'; + readonly d: string; +}; +/** Ids appended to the shared registry; order is the picker's section order. */ +export declare const SCIENCE_ICON_IDS: readonly ["test-tube", "flask", "pipette", "dropper", "stirrer", "hotplate", "centrifuge", "balance", "atom", "molecule", "lattice", "layered", "framework", "thin-film", "fiber", "hydrogel", "microscope", "xrd", "spectrum", "tensile", "electrode", "iv-curve", "illumination", "temperature", "humidity", "actuator", "flex-sensor", "battery"]; +/** Union of the research icon ids (a subset of the shared `GroupIconId`). */ +export type ScienceIconId = (typeof SCIENCE_ICON_IDS)[number]; +/** The picker's section split of the research family. */ +export declare const SCIENCE_ICON_SECTIONS: readonly [{ + readonly key: "lab"; + readonly ids: readonly ["test-tube", "flask", "pipette", "dropper", "stirrer", "hotplate", "centrifuge", "balance"]; +}, { + readonly key: "materials"; + readonly ids: readonly ["atom", "molecule", "lattice", "layered", "framework", "thin-film", "fiber", "hydrogel"]; +}, { + readonly key: "characterization"; + readonly ids: readonly ["microscope", "xrd", "spectrum", "tensile", "electrode", "iv-curve"]; +}, { + readonly key: "devices"; + readonly ids: readonly ["illumination", "temperature", "humidity", "actuator", "flex-sensor", "battery"]; +}]; +/** Primitive artwork per research icon. */ +export declare const SCIENCE_ICON_ART: Record; +/** Research icon id → picker section key. */ +export declare const SCIENCE_ICON_SECTION_OF: Record; +/** + * Render one research icon in the Host glyph's visual language: 16x16, + * `currentColor` stroke, 1.3px, round joins, decorative for screen readers (the + * row/picker button already carries the bilingual name). + * @param props.icon - research icon id. + * @param props.size - rendered square size in CSS pixels (default 16, like Host glyphs). + */ +export declare function ScienceGlyph({ icon, size }: { + icon: ScienceIconId; + size?: number; +}): ReactElement; +/** Research icon id → rendered node, merged into the row icon registry. */ +export declare function scienceIconNodes(): Record;