Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Tw9fjV2UVj2u3F3mbnYrQW
10 lines
630 B
JavaScript
10 lines
630 B
JavaScript
// A collapsible group for the Properties panel. The panel redraws on most edits, so whether a group is open is
|
|
// remembered here and a redraw does not close what the person just opened.
|
|
import { composer as c } from "../../composer/composer.js";
|
|
|
|
const opened = new Map();
|
|
|
|
/** `id`: a stable name for the group. `hint`: one short line shown beside the label while it is closed. */
|
|
export const fold = (id, label, children, hint) => c.collapsible.default({ label, hint, open: opened.get(id) === true,
|
|
onToggle: (open) => opened.set(id, open), body: c.region.stack({ gap: "sm", children: children.flat().filter(Boolean) }) });
|