Skip to main content

Module doc

Module doc 

Source
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§

AlignToSpec
Object form of document align_to (template ref + EdgePlan-style opts).
AtomLabelDetailed
Expanded atom-label bag with optional shared scale/color/z.
AtomNumberPolicy
Expanded atom-number policy.
CalloutSpec
Callout annotation (arrow / freer placement).
CircleSpec
Atom, bond, or ring highlight.
CommonOpts
Universal cascading keys (any node kind).
DepictRendered
One painted molecule ready for hosts (parity with JS / Python Rendered).
DocPaint
One painted molecule from render_doc / depict.
EdgeNode
Edge node — a reaction / network link between mol ids.
FillSpec
Fill ink for region / circle.
ForTypesPatch
Multi-kind patch: { "for_types": ["mol","group"], …mol opts }.
LabelLanes
Lane bag: { "above": [...], "below": [...], "left": [...], "right": [...] }.
LabelPlacement
Placed label: { "id": "adh", "pos": "below" } (pos optional → above).
LayoutOpts
Layout for DepictSpec::ReactionScheme.
LayoutWorld
Layout world rooted at an arbitrary document node.
MolNode
Mol node — MolOpts fields + non-cascading identity / scores / align.
MolOpts
Mol cascading paint opts — what a mol leaf consumes from the cascade.
MolOverlayFields
Overlay fields extracted from / applied to a mol (excludes privileged name).
MolTextSpec
Expanded text content for mol name, region labels, callouts, atom labels.
RegionSpec
One region highlight on a mol.
ShadeSpec
Per-atom / per-bond colormap scores (+ legacy window fields on the mol).
ShadeStyle
Cascading shade window / LUT (not per-atom scores).
SolveOpts
Solver options (pose-drift termination + augmented Lagrangian).
SolveResult
StrokeSpec
Stroke ink for region / circle.
SvgAtom
Atom position in SCALE / SVG space (host Rendered.coords).
SvgBond
Bond endpoints in layout order.
TextNode
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.
AtomLabelSpec
Per-atom arbitrary text. Bare map { "0": "α" } or { "labels": {…}, "scale"? }.
AtomNumberBy
How to generate atom index / map-number labels.
AtomNumberSpec
Atom numbering policy (singular wire field atom_number).
CalloutField
CircleField
Constraint
Soft constraint forms emitted by type kits.
DepictSpec
Declarative document (mol, group, reaction_scheme, or grid root).
EdgeArrow
Arrow head / shaft style for diagram edges.
EdgeNodeKind
Discriminator for edge nodes ("type": "edge").
EdgeRouting
How edge shafts are drawn between nodes.
HardConstraint
Inequality constraints g(x) ≤ 0 enforced via augmented Lagrangian.
Label
Unified label: string id, list, placed object, or lane object.
LabelItem
One entry in a label list: bare id or { id, pos? }.
LabelPos
Side of an edge shaft (or mol caption) for a label placement.
LabelRole
Label role on the atom tracks.
LayoutAlgorithm
Placement algorithm for scheme layout.
LayoutDirection
Flow axis for scheme layout.
MolIds
One or more mol ids (reactants / products).
MolNodeKind
Discriminator for mol nodes ("type": "mol").
MolText
Caption / label content: bare string or styled object.
Node
Document node: mol, edge, or text.
NodeType
Document node kinds opts may target (matches wire "type" discriminants).
ObjectType
Object kind → which kit installed it (debug / filtering).
Opts
Cascade bag: singleton patch or list of patches.
OptsPatch
One cascade rule. Untagged order: typed → for_types → universal.
RegionField
One-or-many regions on the wire.
RegionStyle
Region hull style (not wire circle highlights).
RegionTextPlace
Where a region caption sits relative to the region geometry.
Shape
Geometry used for contain / clash / opt_dist (edge-based, not center-to-center).
TextNodeKind
Discriminator for text nodes ("type": "text").
TypedOptsPatch
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_labels onto * atoms in layout encounter order.
assign_mol_ids
Assign stable unique ids (user id or m_<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::ReactionScheme from per-mol DocPaint rows.
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 when g ≤ 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 EdgePlan for every mol that needs coord gen.
process_edge_plan
Process EdgePlan with 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::Outside vs every primitive leaf under under.
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 EdgeResult coords 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_k route 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).