Expand description
Declarative document — one render entry for every spec.
Wire types live in [spec] (opts cascade + DepictSpec collocated).
Product path: CoordGen layout, mol-spec paint (chem + annotations +
caption), then pack cells (reaction schemes compose). Annotations are
fields on MolNode, not a parallel paint API.
Structs§
- Align
ToSpec - Object form of document
align_to(template ref + EdgePlan-style opts). - Atom
Label Detailed - Expanded atom-label bag with optional shared scale/color/z.
- Atom
Number Policy - Expanded atom-number policy.
- Callout
Spec - Callout annotation (arrow / freer placement).
- Circle
Spec - Atom, bond, or ring highlight.
- Common
Opts - Universal cascading keys (any node kind).
- Depict
Rendered - One painted molecule ready for hosts (parity with JS / Python
Rendered). - DocPaint
- One painted molecule from
render_doc/depict. - Edge
Node - Edge node — a reaction / network link between mol ids.
- Fill
Spec - Fill ink for region / circle.
- ForTypes
Patch - Multi-kind patch:
{ "for_types": ["mol","group"], …mol opts }. - Label
Lanes - Lane bag:
{ "above": [...], "below": [...], "left": [...], "right": [...] }. - Label
Placement - Placed label:
{ "id": "adh", "pos": "below" }(posoptional → above). - Layout
Opts - Layout for
DepictSpec::ReactionScheme. - Layout
World - Layout world rooted at an arbitrary document node.
- MolNode
- Mol node —
MolOptsfields + non-cascading identity / scores / align. - MolOpts
- Mol cascading paint opts — what a mol leaf consumes from the cascade.
- MolOverlay
Fields - Overlay fields extracted from / applied to a mol (excludes privileged
name). - MolText
Spec - Expanded text content for mol name, region labels, callouts, atom labels.
- Region
Spec - One region highlight on a mol.
- Shade
Spec - Per-atom / per-bond colormap scores (+ legacy window fields on the mol).
- Shade
Style - Cascading shade window / LUT (not per-atom scores).
- Solve
Opts - Solver options (pose-drift termination + augmented Lagrangian).
- Solve
Result - Stroke
Spec - Stroke ink for region / circle.
- SvgAtom
- Atom position in SCALE / SVG space (host
Rendered.coords). - SvgBond
- Bond endpoints in layout order.
- Text
Node - Text node — caption / chrome referenced by mols and edges via id.
Enums§
- AlignTo
- Document align target: id string or
{ "ref", "atom_map"?, "min_atoms"?, "mode"?, "timeout_ms"? }. - Annotation
- Internal overlay unit for paint / occupancy.
- Atom
Label Spec - Per-atom arbitrary text. Bare map
{ "0": "α" }or{ "labels": {…}, "scale"? }. - Atom
Number By - How to generate atom index / map-number labels.
- Atom
Number Spec - Atom numbering policy (singular wire field
atom_number). - Callout
Field - Circle
Field - Constraint
- Soft constraint forms emitted by type kits.
- Depict
Spec - Declarative document (
mol,group,reaction_scheme, orgridroot). - Edge
Arrow - Arrow head / shaft style for diagram edges.
- Edge
Node Kind - Discriminator for edge nodes (
"type": "edge"). - Edge
Routing - How edge shafts are drawn between nodes.
- Hard
Constraint - Inequality constraints
g(x) ≤ 0enforced via augmented Lagrangian. - Label
- Unified label: string id, list, placed object, or lane object.
- Label
Item - One entry in a label list: bare id or
{ id, pos? }. - Label
Pos - Side of an edge shaft (or mol caption) for a label placement.
- Label
Role - Label role on the atom tracks.
- Layout
Algorithm - Placement algorithm for scheme layout.
- Layout
Direction - Flow axis for scheme layout.
- MolIds
- One or more mol ids (reactants / products).
- MolNode
Kind - Discriminator for mol nodes (
"type": "mol"). - MolText
- Caption / label content: bare string or styled object.
- Node
- Document node: mol, edge, or text.
- Node
Type - Document node kinds opts may target (matches wire
"type"discriminants). - Object
Type - Object kind → which kit installed it (debug / filtering).
- Opts
- Cascade bag: singleton patch or list of patches.
- Opts
Patch - One cascade rule. Untagged order: typed → for_types → universal.
- Region
Field - One-or-many regions on the wire.
- Region
Style - Region hull style (not wire
circlehighlights). - Region
Text Place - Where a region caption sits relative to the region geometry.
- Shape
- Geometry used for contain / clash / opt_dist (edge-based, not center-to-center).
- Text
Node Kind - Discriminator for text nodes (
"type": "text"). - Typed
Opts Patch - Discriminated opts patch:
{ "type": "mol"|"group"|"reaction_scheme"|"edge"|"text", …opts }.
Constants§
- VIEWPORT_
MARGIN_ DEFAULT - Default gap (px) between content AABB and SVG viewBox edge (small house pad).
- Z_ATOMS
- Alias of
Z_BONDS— atom centers share the skeleton band. - Z_
ATOM_ LABEL - Chem glyphs,
atom_number,atom_label. - Z_
BACKGROUND - Scene / page background (behind regions).
- Z_BONDS
- Backbone bonds and atom element ink (origin for relative placement).
- Z_
CALLOUT - Callouts and other free annotations.
- Z_
CIRCLE - Highlight / aromatic circles (just in front of skeleton).
- Z_HALO
- Bond / label halos.
- Z_NAME
- Mol
name/ figure labels on top. - Z_
REGION - Region fill/stroke (base underlay under shade).
- Z_SHADE
- Colormap wash.
Functions§
- annotations_
from_ overlay - A→B: expand wire overlay fields into a sorted annotation list.
- apply_
star_ labels - Apply
star_labelsonto*atoms in layout encounter order. - assign_
mol_ ids - Assign stable unique ids (
user idorm_<i>) in document order. - atom_
number_ kit - bezier_
path_ from_ proxy - Closed centripetal Catmull–Rom through proxy vertices → SVG cubics.
- callout_
kit - Callout two-point kit: movable label AABB + tip point; optional route points.
- canonicalize_
overlay - Canonicalize overlay by A→B→A (stable for round-trip tests).
- caption_
kit - Caption kit (solver bench / unit tests only).
- compose_
scheme - Compose a
DepictSpec::ReactionSchemefrom per-molDocPaintrows. - depict
- Alias of
render. - edge_
signed_ distance - Signed edge distance: positive = separated, negative = penetration depth.
- energy
- Evaluate soft energy for the current world poses.
- fit_
scene - Recompute the SVG viewBox from painted ink after layout.
- hard_g
- Signed hard residual
g(x). Feasible wheng ≤ 0. - hull_
proxy - Build a concave hull proxy through include points, pad for exclude.
- install_
chem - Install fixed chem group: bonds as lines, atoms as disks (~0.3 CC-bond), optional shade circles.
- install_
chem_ under - Install chem ink under
parent({parent}/chem/…). - max_
hard_ violation - Max of
max(0, g_i)over hard constraints. - overlay_
from_ annotations - B→A: rebuild wire overlay fields from annotations (canonical form).
- overlay_
from_ mol - Read overlay chrome from a mol node (wire A → bag).
- plan_
edge - Pass 1: build an
EdgePlanfor every mol that needs coord gen. - process_
edge_ plan - Process
EdgePlanwith Chematic + CoordGen (parity with JS host). - process_
edge_ plan_ with_ frames - Like
process_edge_plan, plus pose frames keyed by mol id. - push_
clear_ leaves - Hard
HardConstraint::Outsidevs every primitive leaf underunder. - refine_
atom_ number - Refine atom number / custom atom label after a PreferPose seed.
- refine_
callout - Refine callout label + tip; returns
(label_dxy, tip_dxy, route_xy_world). - refine_
caption - Refine a seeded label AABB translation with caption kit + simplex.
- refine_
region_ text - Refine region text after greedy edge place.
- region_
text_ kit - Box / hull region text kit.
- render
- Product entry: layout + mol-spec paint + pack cells (schemes compose).
- render_
doc - Pass 2: stitch host
EdgeResultcoords onto the document and paint. - resolve_
mol_ opts - Apply a chain of opts bags (ancestor → … → leaf) for a mol.
- resolve_
viewport_ margin - Resolve a viewport margin: finite ≥ 0, else house default.
- solve
- Minimize soft energy (+ AL hard terms) with Nelder–Mead; stop on pose drift.
- suggest_
route_ points - Suggest up to
max_kroute points between label center and tip along a soft arc away from bond midpoints (adaptive routing seed). - validate_
edges - Ensure edge endpoints and label refs resolve to the right node kinds.
- validate_
shade_ colormap - Reject colormap names that paint would ignore (no silent no-op).