@latimer-woods-tech/bodygraph
v0.2.0
Published
The **canonical Energy Blueprint body-graph engine** — a single, themeable, runtime-agnostic renderer that returns an **SVG string**. Pure TypeScript, zero runtime dependencies.
Readme
@latimer-woods-tech/bodygraph
The canonical Energy Blueprint body-graph engine — a single, themeable, runtime-agnostic renderer that returns an SVG string. Pure TypeScript, zero runtime dependencies.
This package unifies the three divergent body-graph renderers (film, web, PDF) onto one engine so a chart looks identical everywhere.
As of 0.2.0 it also carries the chart-compute engine: birth data (UTC) → the complete chart (type, authority, profile, definition, cross, channels, centers, per-body gate/line maps) — so API consumers can go from birth data to a rendered body-graph with one dependency and one call.
Compute usage
import { computeChart, computeAndRenderBodyGraph } from '@latimer-woods-tech/bodygraph';
// Birth instant in UTC (convert local time + timezone before calling).
const birth = { year: 1979, month: 8, day: 5, hour: 22, minute: 51 };
// Compute only:
const { chart, personalityGates, designGates } = computeChart(birth);
chart.type; // 'Projector'
chart.authority; // 'Emotional - Solar Plexus'
chart.profile; // '6/2'
chart.cross.name; // 'Left Angle Cross of Refinement'
// Or compute + render in one call:
const { svg, computation } = computeAndRenderBodyGraph(birth, /* theme? */ undefined, { glow: true });Invalid birth input throws a tagged error (code: INVALID_BIRTH_INPUT,
status: 400, human-readable userFacing) — classify with
isBirthInputError(err) and map to HTTP 400. Latitude/longitude are not
needed: the body-graph is location-independent (location only affects
astrology houses, which live outside this package).
Provenance & the shape contract
The computation is the canonical HumanDesign engine vendored VERBATIM
(src/compute/vendor/*.js, provenance headers name the upstream repo, file,
and commit). Do not edit the vendored files here — upstream fixes land in
HumanDesign first, then re-vendor. They are excluded from this package's ESLint
run for exactly that reason (they are linted upstream; local style edits would
break the verbatim contract). The only departure is documented at the top of
vendor/chart.js: the incarnation-cross name table is bundled statically
instead of loaded via Node fs / Workers KV.
Shape contract (never re-derive; see HD workers/src/lib/chart-shape.js):
chart.gateActivations is an object keyed by gate number (not an array);
personalityGates/designGates are objects keyed by body whose values are
{ gate, line, nearBoundary } objects (never bare numbers). Use
chartToBodyGraphInput(chart) to feed the renderer — don't hand-pick fields.
Golden-output tests (src/compute/compute.test.ts) pin the package to the
upstream engine's exact output for the canonical AP vector (all 26 placements)
plus six diverse full-chart fixtures. Never relax them to make a port pass.
Render usage
import { renderBodyGraph } from '@latimer-woods-tech/bodygraph';
const svg = renderBodyGraph(
{
definedCenters: ['G', 'Throat', 'Ajna'],
// Precise activations drive badge colors...
gateActivations: { 20: { personality: true, design: true } },
// ...or fall back to signatureGates (marked as "both") when absent:
signatureGates: [20, 57],
transitGates: [16],
},
// Optional partial theme (merged over the premium-clean default).
{ accent: '#7aa2ff', glow: '#7aa2ff' },
// Optional render flags.
{ showGateBadges: true, glow: true, interactiveAttrs: false, idSuffix: '-hero' },
);Design contract
- Crisp always. Center shapes, gate badges, and gate numbers are razor-sharp.
- Soft halo behind, never on. The glow for a defined center is a separate blurred layer rendered under the crisp shape, so the halo never softens the number or the edge.
- Defined channels lit. A channel whose two ends are both defined glows in the accent (thicker, brighter); undefined channels stay quiet.
- Open centers get a quiet, clean outline.
API
renderBodyGraph(input, theme?, options?) => string— SVG markup.DEFAULT_THEME,resolveTheme(input?)— the themeable design system.- Geometry exports (
CENTER_POS,CHANNEL_LINES,CENTER_GATES,GATE_TO_CENTER,GATE_OFFSETS,centerShapePoints, …) so consumers can place motion / overlays.
input
| field | type | notes |
| --- | --- | --- |
| definedCenters | string[] | PascalCase keys (G, Throat, SolarPlexus). |
| gateActivations? | Record<number, { personality?, design? }> | precise badge colors. |
| signatureGates? | number[] | fallback when gateActivations absent → "both". |
| transitGates? | number[] | colored with the transit badge. |
options
| flag | default | notes |
| --- | --- | --- |
| showGateBadges | true | draw gate-number badges. |
| glow | true | soft halo behind defined centers (film). |
| interactiveAttrs | false | emit data-* hooks (web). |
| idSuffix | '' | namespaces gradient/filter ids for multiple SVGs per page. |
Coordinate system
A 300×420 viewBox, ported verbatim from the canonical selfprime web generator. The geometry/data is copied into this package so it is fully self-contained (no selfprime import).
