kaabalah 6.9.0 → 6.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -162,12 +162,13 @@ function getArcheometerRenderModel(options = {}) {
162
162
  };
163
163
  const frameRadius = round(Math.max(0, Math.min(viewBox.width, viewBox.height) / 2 - padding));
164
164
  const outerRadius = round(Math.max(0, frameRadius - ARCHEOMETER_OUTER_CROWN_BLEED * scale));
165
- return {
165
+ const rings = buildRings(outerRadius, frameRadius);
166
+ const modelBase = {
166
167
  viewBox,
167
168
  center,
168
169
  outerRadius,
169
170
  scale,
170
- rings: buildRings(outerRadius, frameRadius),
171
+ rings,
171
172
  palette: resolvePalette(options.palette),
172
173
  rotationDegrees: options.rotationDegrees ?? 0,
173
174
  layers: { ...DEFAULT_LAYERS, ...options.layers ?? {} },
@@ -179,6 +180,10 @@ function getArcheometerRenderModel(options = {}) {
179
180
  zodiacSigns: options.zodiacSigns ?? DEFAULT_ARCHEOMETER_ZODIAC,
180
181
  planetaryPoints: options.planetaryPoints ?? DEFAULT_ARCHEOMETER_PLANETS
181
182
  };
183
+ return {
184
+ ...modelBase,
185
+ geometry: buildArcheometerGeometry(modelBase)
186
+ };
182
187
  }
183
188
  var DEFAULT_ARCHETYPE_UTTERANCE = DEFAULT_ARCHEOMETER_UTTERANCE;
184
189
  var DEFAULT_ARCHETYPE_TRIANGLES = DEFAULT_ARCHEOMETER_TRIANGLES;
@@ -294,7 +299,6 @@ function renderDegreeCrown(push, model) {
294
299
  function renderZodiacUtterance(push, model) {
295
300
  const { center, rings, palette, scale } = model;
296
301
  const ring = rings.zodiacUtterance;
297
- const sorted = sortedByDegree(model.utterance);
298
302
  push(`<g id="archeometer-zodiacal-utterance" aria-label="zodiacal crown of the utterance">`);
299
303
  for (let i = 0; i < 12; i++) {
300
304
  const degree = i * 30;
@@ -312,9 +316,9 @@ function renderZodiacUtterance(push, model) {
312
316
  )}" stroke-opacity="0.34" stroke-width="${fmt(0.7 * scale)}"/>`
313
317
  );
314
318
  }
315
- for (const point of sorted) {
316
- const a = angleOf(model, point.degree);
317
- const p = polarToXY(center, ring.r1 + (ring.r2 - ring.r1) * 0.58, a);
319
+ for (const geometry of model.geometry.utterancePoints) {
320
+ const point = geometry.data;
321
+ const p = geometry.anchor;
318
322
  const shieldR = (ring.r2 - ring.r1) * 0.22;
319
323
  const letterParts = point.letter.split(",").map((part) => part.trim()).filter(Boolean);
320
324
  const isStacked = letterParts.length > 1;
@@ -343,11 +347,11 @@ function renderPlanetaryUtterance(push, model) {
343
347
  const { center, rings, palette, scale } = model;
344
348
  const ring = rings.planetaryUtterance;
345
349
  const clipOuter = planetaryTriangleClipOuterRadius(rings);
346
- const vertexRadius = clipOuter;
347
350
  push(`<g id="archeometer-planetary-utterance" aria-label="four trigones of the planetary utterance">`);
348
351
  push(`<g clip-path="url(#archeometer-planetary-clip)">`);
349
- for (const triangle of model.triangles) {
350
- const vertices = triangle.vertices.map((degree) => polarToXY(center, vertexRadius, angleOf(model, degree)));
352
+ for (const triangleGeometry of model.geometry.triangles) {
353
+ const triangle = triangleGeometry.data;
354
+ const vertices = triangleGeometry.vertices;
351
355
  if (triangle.vertexFills) {
352
356
  const centroid = polygonCentroid(vertices);
353
357
  const midpoints = vertices.map((vertex, index) => midpoint(vertex, vertices[(index + 1) % vertices.length]));
@@ -356,17 +360,18 @@ function renderPlanetaryUtterance(push, model) {
356
360
  const nextMidpoint = midpoints[index];
357
361
  push(`<path class="archeometer-trigone-vertex-fill" data-triangle="${escapeAttr(triangle.id)}" data-degree="${fmt(normalizeDegrees(triangle.vertices[index]))}" d="${polygonPath([vertex, nextMidpoint, centroid, previousMidpoint])}" fill="${escapeAttr(triangle.vertexFills[index])}" fill-opacity="0.54" stroke="none"/>`);
358
362
  }
359
- push(`<path class="archeometer-trigone" data-triangle="${escapeAttr(triangle.id)}" d="${polygonPath(vertices)}" fill="none" stroke="${escapeAttr(palette.ink)}" stroke-opacity="0.82" stroke-width="${fmt(1.35 * scale)}"/>`);
363
+ push(`<path class="archeometer-trigone" data-triangle="${escapeAttr(triangle.id)}" d="${triangleGeometry.path}" fill="none" stroke="${escapeAttr(palette.ink)}" stroke-opacity="0.82" stroke-width="${fmt(1.35 * scale)}"/>`);
360
364
  } else {
361
- push(`<path class="archeometer-trigone" data-triangle="${escapeAttr(triangle.id)}" d="${polygonPath(vertices)}" fill="${escapeAttr(triangle.fill)}" fill-opacity="0.52" stroke="${escapeAttr(palette.ink)}" stroke-opacity="0.82" stroke-width="${fmt(1.35 * scale)}"/>`);
365
+ push(`<path class="archeometer-trigone" data-triangle="${escapeAttr(triangle.id)}" d="${triangleGeometry.path}" fill="${escapeAttr(triangle.fill)}" fill-opacity="0.52" stroke="${escapeAttr(palette.ink)}" stroke-opacity="0.82" stroke-width="${fmt(1.35 * scale)}"/>`);
362
366
  }
363
367
  }
364
368
  push(`</g>`);
365
- for (const label of sortedByDegree(model.triangleLabels)) {
369
+ for (const labelGeometry of model.geometry.triangleLabels) {
370
+ const label = labelGeometry.data;
366
371
  if (!label.label)
367
372
  continue;
368
373
  const a = angleOf(model, label.degree);
369
- const labelPoint = polarToXY(center, ring.r1 + (clipOuter - ring.r1) * 0.56, a);
374
+ const labelPoint = labelGeometry.anchor;
370
375
  push(textSvg(label.label, labelPoint, 12 * scale, palette.ink, 0, "middle", 700));
371
376
  if (label.number !== void 0) {
372
377
  const numberPoint = polarToXY(center, ring.r1 + (clipOuter - ring.r1) * 0.8, a);
@@ -396,10 +401,11 @@ function renderCosmologicalMusic(push, model) {
396
401
  push(`<path class="archeometer-music-staff-line" data-degree="${fmt(normalizeDegrees(note.degree))}" d="${arcSegmentPath(center, r, start, end)}" fill="none" stroke="${escapeAttr(palette.ink)}" stroke-opacity="0.58" stroke-width="${fmt(0.48 * scale)}" stroke-linecap="round"/>`);
397
402
  }
398
403
  }
399
- for (const note of notes) {
404
+ for (const noteGeometry of model.geometry.musicalNotes) {
405
+ const note = noteGeometry.data;
400
406
  if (!note.note)
401
407
  continue;
402
- const p = polarToXY(center, (ring.r1 + ring.r2) / 2, angleOf(model, note.degree));
408
+ const p = noteGeometry.anchor;
403
409
  push(textSvg(note.note, p, 11.8 * scale, palette.ink, tangentRotation(angleOf(model, note.degree)), "middle", 700));
404
410
  }
405
411
  push(`</g>`);
@@ -409,7 +415,8 @@ function renderAstralZodiac(push, model) {
409
415
  const ring = rings.astralZodiac;
410
416
  const ringWidth = ring.r2 - ring.r1;
411
417
  push(`<g id="archeometer-astral-zodiac" aria-label="astral zodiacal crown">`);
412
- for (const sign of sortedByDegree(model.zodiacSigns)) {
418
+ for (const signGeometry of model.geometry.zodiacSigns) {
419
+ const sign = signGeometry.data;
413
420
  const sector = annularSectorPath(
414
421
  center,
415
422
  ring.r1,
@@ -427,9 +434,10 @@ function renderAstralZodiac(push, model) {
427
434
  }
428
435
  const markerRadius = Math.min(ringWidth * 0.33, 13 * scale);
429
436
  const glyphSize = 17.5 * scale;
430
- for (const sign of sortedByDegree(model.zodiacSigns)) {
437
+ for (const signGeometry of model.geometry.zodiacSigns) {
438
+ const sign = signGeometry.data;
431
439
  const pointColor = triangleVertexFillForDegree(model, sign.degree) ?? sign.color ?? nearestUtterance(sign.degree, model.utterance)?.color ?? palette.ringFills.astralZodiac;
432
- const p = polarToXY(center, (ring.r1 + ring.r2) / 2, angleOf(model, sign.degree));
440
+ const p = signGeometry.anchor;
433
441
  push(
434
442
  `<g class="archeometer-zodiac-sign" data-sign="${escapeAttr(sign.name)}" data-degree="${fmt(
435
443
  normalizeDegrees(sign.degree)
@@ -450,7 +458,8 @@ function renderAstralPlanetary(push, model) {
450
458
  const ring = rings.astralPlanetary;
451
459
  const ringWidth = ring.r2 - ring.r1;
452
460
  push(`<g id="archeometer-astral-planetary" aria-label="astral planetary crown">`);
453
- for (const planet of sortedByDegree(model.planetaryPoints)) {
461
+ for (const planetGeometry of model.geometry.planetaryPoints) {
462
+ const planet = planetGeometry.data;
454
463
  const pointColor = triangleVertexFillForDegree(model, planet.degree) ?? planet.color ?? nearestUtterance(planet.degree, model.utterance)?.color ?? palette.ringFills.astralPlanetary;
455
464
  const sector = annularSectorPath(
456
465
  center,
@@ -471,8 +480,9 @@ function renderAstralPlanetary(push, model) {
471
480
  push(lineSvg(line, palette.ringStroke, 0.6 * scale, 0.42, "archeometer-astral-planetary-divider", ` data-degree="${fmt(degree)}"`));
472
481
  }
473
482
  const markerRadius = Math.min(ringWidth * 0.33, 13 * scale);
474
- for (const planet of sortedByDegree(model.planetaryPoints)) {
475
- const p = polarToXY(center, (ring.r1 + ring.r2) / 2, angleOf(model, planet.degree));
483
+ for (const planetGeometry of model.geometry.planetaryPoints) {
484
+ const planet = planetGeometry.data;
485
+ const p = planetGeometry.anchor;
476
486
  const color = triangleVertexFillForDegree(model, planet.degree) ?? planet.color ?? nearestUtterance(planet.degree, model.utterance)?.color ?? palette.ink;
477
487
  const glyphSize = (planet.name === "Moon" ? 17 : 18.5) * scale;
478
488
  push(
@@ -634,6 +644,84 @@ function renderFrame(push, model) {
634
644
  );
635
645
  push(`</g>`);
636
646
  }
647
+ function buildArcheometerGeometry(model) {
648
+ const { center, rings, scale } = model;
649
+ const utteranceRing = rings.zodiacUtterance;
650
+ const triangleLabelRing = rings.planetaryUtterance;
651
+ const musicRing = rings.cosmologicalMusic;
652
+ const zodiacRing = rings.astralZodiac;
653
+ const planetRing = rings.astralPlanetary;
654
+ const planetaryClipOuter = planetaryTriangleClipOuterRadius(rings);
655
+ const whiteRaySolarRadius = rings.solarCenter.r2;
656
+ const pointHitRadius = Math.max(11 * scale, 8);
657
+ const element = (layerId, idPrefix, item, radius, hitRadius = pointHitRadius) => {
658
+ const anchor = polarToXY(center, radius, angleOf(model, item.degree));
659
+ return {
660
+ id: `${idPrefix}-${slugForGeometry(item.id ?? item.name ?? item.note ?? item.label ?? item.degree)}`,
661
+ layerId,
662
+ data: item,
663
+ degree: normalizeDegrees(item.degree),
664
+ anchor,
665
+ hitTarget: { kind: "circle", cx: anchor.x, cy: anchor.y, r: hitRadius }
666
+ };
667
+ };
668
+ const triangles = model.triangles.map((triangle) => {
669
+ const vertices = triangle.vertices.map(
670
+ (degree) => polarToXY(center, planetaryClipOuter, angleOf(model, degree))
671
+ );
672
+ const centroid = polygonCentroid(vertices);
673
+ return {
674
+ id: `triangle-${slugForGeometry(triangle.id)}`,
675
+ layerId: "planetaryUtterance",
676
+ data: triangle,
677
+ vertices,
678
+ centroid,
679
+ path: polygonPath(vertices),
680
+ hitTarget: { kind: "polygon", points: vertices }
681
+ };
682
+ });
683
+ const degreeTicks = Array.from({ length: 12 }, (_, index) => {
684
+ const degree = index * 30;
685
+ const angle = angleOf(model, degree);
686
+ return {
687
+ id: `degree-${degree}`,
688
+ degree,
689
+ outerAnchor: polarToXY(center, (rings.degreeOuter.r1 + rings.degreeOuter.r2) / 2, angle),
690
+ innerAnchor: polarToXY(center, (rings.degreeInner.r1 + rings.degreeInner.r2) / 2, angle)
691
+ };
692
+ });
693
+ const rays = Array.from({ length: 12 }, (_, index) => index * 30).filter((degree) => degree !== 90 && degree !== 270).map((degree) => ({
694
+ id: `white-ray-${degree}`,
695
+ degree,
696
+ layerId: "whiteRays",
697
+ line: lineFromPolar(center, whiteRaySolarRadius, 3.3, angleOf(model, degree))
698
+ }));
699
+ return {
700
+ utterancePoints: sortedByDegree(model.utterance).map(
701
+ (point) => element("zodiacUtterance", "utterance", point, utteranceRing.r1 + (utteranceRing.r2 - utteranceRing.r1) * 0.58)
702
+ ),
703
+ triangles,
704
+ triangleLabels: sortedByDegree(model.triangleLabels).map(
705
+ (label) => element("triangleLabels", "triangle-label", label, triangleLabelRing.r1 + (planetaryClipOuter - triangleLabelRing.r1) * 0.56)
706
+ ),
707
+ musicalNotes: sortedByDegree(model.musicalNotes).map(
708
+ (note) => element("cosmologicalMusic", "music", note, (musicRing.r1 + musicRing.r2) / 2)
709
+ ),
710
+ zodiacSigns: sortedByDegree(model.zodiacSigns).map(
711
+ (sign) => element("astralZodiac", "zodiac", sign, (zodiacRing.r1 + zodiacRing.r2) / 2, Math.min((zodiacRing.r2 - zodiacRing.r1) * 0.33, 13 * scale))
712
+ ),
713
+ planetaryPoints: sortedByDegree(model.planetaryPoints).map(
714
+ (planet) => element("astralPlanetary", "planet", planet, (planetRing.r1 + planetRing.r2) / 2, Math.min((planetRing.r2 - planetRing.r1) * 0.33, 13 * scale))
715
+ ),
716
+ degreeTicks,
717
+ rays,
718
+ center: {
719
+ id: "solar-center",
720
+ anchor: center,
721
+ hitTarget: { kind: "circle", cx: center.x, cy: center.y, r: rings.solarCenter.r2 }
722
+ }
723
+ };
724
+ }
637
725
  function buildRings(contentRadius, frameRadius = contentRadius) {
638
726
  const ring = (id2, r1, r2, radius = contentRadius) => ({
639
727
  id: id2,
@@ -775,6 +863,9 @@ function polygonCentroid(points) {
775
863
  function sortedByDegree(items) {
776
864
  return [...items].sort((a, b) => normalizeDegrees(a.degree) - normalizeDegrees(b.degree));
777
865
  }
866
+ function slugForGeometry(value) {
867
+ return String(value).trim().toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "") || "item";
868
+ }
778
869
  function nearestUtterance(degree, utterance) {
779
870
  let best;
780
871
  let bestDelta = Number.POSITIVE_INFINITY;
@@ -1271,6 +1362,7 @@ function getAstroWheelRenderModel(chart, options = {}) {
1271
1362
  const rings = buildRings2(outerRadius, options.layout?.rings);
1272
1363
  const pointConnectorMode = options.layout?.pointConnectors ?? "auto";
1273
1364
  const maxPointDisplacementDegrees = options.layout?.maxPointDisplacementDegrees ?? DEFAULT_POINT_DISPLACEMENT_DEGREES;
1365
+ const railVisibility = resolveRailVisibility(options.layout?.rails);
1274
1366
  const resolvedPoints = resolvePointOptions(options.points);
1275
1367
  const resolvedHouses = resolveHouseOptions(options.houses);
1276
1368
  const resolvedAspects = resolveAspectOptions(options.aspects);
@@ -1308,7 +1400,8 @@ function getAstroWheelRenderModel(chart, options = {}) {
1308
1400
  palette,
1309
1401
  excludedBodies,
1310
1402
  pointConnectorMode,
1311
- maxDisplacementDegrees: maxPointDisplacementDegrees
1403
+ maxDisplacementDegrees: maxPointDisplacementDegrees,
1404
+ railVisibility
1312
1405
  });
1313
1406
  const extraPointLayers = (options.pointLayers ?? []).map(
1314
1407
  (layer) => buildPointLayer({
@@ -1320,7 +1413,8 @@ function getAstroWheelRenderModel(chart, options = {}) {
1320
1413
  palette,
1321
1414
  excludedBodies,
1322
1415
  pointConnectorMode,
1323
- maxDisplacementDegrees: maxPointDisplacementDegrees
1416
+ maxDisplacementDegrees: maxPointDisplacementDegrees,
1417
+ railVisibility
1324
1418
  })
1325
1419
  );
1326
1420
  const pointLayers = [
@@ -1362,6 +1456,8 @@ function getAstroWheelRenderModel(chart, options = {}) {
1362
1456
  ...extraAspectLayers
1363
1457
  ];
1364
1458
  const aspectLines = aspectLayers.flatMap((layer) => [...layer.aspectLines]);
1459
+ const positionRails = basePointLayer.rails;
1460
+ const boundaryNotches = pointLayers.flatMap((layer) => [...layer.notches]);
1365
1461
  return {
1366
1462
  viewBox,
1367
1463
  center,
@@ -1377,6 +1473,8 @@ function getAstroWheelRenderModel(chart, options = {}) {
1377
1473
  aspectLines,
1378
1474
  pointLayers,
1379
1475
  aspectLayers,
1476
+ positionRails,
1477
+ boundaryNotches,
1380
1478
  palette
1381
1479
  };
1382
1480
  }
@@ -1405,6 +1503,7 @@ function generateAstroWheelSvg(chart, options = {}) {
1405
1503
  `<rect x="${fmt2(viewBox.minX)}" y="${fmt2(viewBox.minY)}" width="${fmt2(viewBox.width)}" height="${fmt2(viewBox.height)}" fill="${escapeAttr2(background)}"/>`
1406
1504
  );
1407
1505
  }
1506
+ renderAspectBoundary(push, model);
1408
1507
  renderAspects(push, model);
1409
1508
  renderZodiac(push, model, zodiacOptions);
1410
1509
  renderHouses(push, model, houseOptions);
@@ -1438,15 +1537,7 @@ function renderAspects(push, model) {
1438
1537
  if (model.aspectLayers.length === 0) {
1439
1538
  return;
1440
1539
  }
1441
- const guideRadius = model.rings.aspects.r2 * 0.96;
1442
- const innerGuideRadius = guideRadius * 0.52;
1443
1540
  push(`<g id="astro-wheel-aspects" aria-label="aspects">`);
1444
- push(
1445
- `<circle cx="${fmt2(model.center.x)}" cy="${fmt2(model.center.y)}" r="${fmt2(guideRadius)}" fill="none" stroke="${escapeAttr2(model.palette.aspectGuide)}" stroke-opacity="0.9" stroke-width="${fmt2(1.25 * model.scale)}"/>`
1446
- );
1447
- push(
1448
- `<circle cx="${fmt2(model.center.x)}" cy="${fmt2(model.center.y)}" r="${fmt2(innerGuideRadius)}" fill="none" stroke="${escapeAttr2(model.palette.aspectGuide)}" stroke-opacity="0.28" stroke-width="${fmt2(model.scale)}"/>`
1449
- );
1450
1541
  for (const layer of model.aspectLayers) {
1451
1542
  push(`<g class="astro-wheel-aspect-layer" data-aspect-layer="${escapeAttr2(layer.id)}"${layer.label ? ` aria-label="${escapeAttr2(layer.label)}"` : ""}>`);
1452
1543
  for (const aspect of layer.aspectLines) {
@@ -1461,6 +1552,11 @@ function renderAspects(push, model) {
1461
1552
  );
1462
1553
  push(`</g>`);
1463
1554
  }
1555
+ function renderAspectBoundary(push, model) {
1556
+ push(
1557
+ `<circle id="astro-wheel-aspect-boundary" cx="${fmt2(model.center.x)}" cy="${fmt2(model.center.y)}" r="${fmt2(model.rings.aspects.r2)}" fill="none" stroke="${escapeAttr2(model.palette.aspectGuide)}" stroke-opacity="0.9" stroke-width="${fmt2(1.25 * model.scale)}"/>`
1558
+ );
1559
+ }
1464
1560
  function renderZodiac(push, model, options) {
1465
1561
  if (!options.segments && !options.glyphs && !options.ticks) {
1466
1562
  return;
@@ -1533,15 +1629,6 @@ function renderHouses(push, model, options) {
1533
1629
  );
1534
1630
  }
1535
1631
  }
1536
- if (options.angles) {
1537
- for (const marker of model.angleMarkers) {
1538
- push(`<g data-angle-marker="${marker.key}">`);
1539
- push(
1540
- `<line x1="${fmt2(marker.line.x1)}" y1="${fmt2(marker.line.y1)}" x2="${fmt2(marker.line.x2)}" y2="${fmt2(marker.line.y2)}" stroke="${escapeAttr2(model.palette.angleLine)}" stroke-width="${fmt2(2 * model.scale)}"/>`
1541
- );
1542
- push(`</g>`);
1543
- }
1544
- }
1545
1632
  push(`</g>`);
1546
1633
  }
1547
1634
  function renderPlanets(push, model) {
@@ -1552,6 +1639,11 @@ function renderPlanets(push, model) {
1552
1639
  for (const layer of model.pointLayers) {
1553
1640
  renderPointLayerGuide(push, layer, model);
1554
1641
  }
1642
+ for (const notch of model.boundaryNotches) {
1643
+ push(
1644
+ `<path class="astro-wheel-boundary-notch" data-point-layer="${escapeAttr2(notch.layerId)}" data-point-key="${escapeAttr2(notch.pointKey)}" data-house="${notch.house}" data-cusp-house="${notch.cuspHouse}" d="${escapeAttr2(notch.path)}" fill="none" stroke="${escapeAttr2(model.palette.houseLine)}" stroke-opacity="0.6" stroke-width="${fmt2(1.1 * model.scale)}" stroke-linejoin="round" stroke-linecap="round"/>`
1645
+ );
1646
+ }
1555
1647
  for (const layer of model.pointLayers) {
1556
1648
  push(`<g class="astro-wheel-point-layer" data-point-layer="${escapeAttr2(layer.id)}"${layer.label ? ` aria-label="${escapeAttr2(layer.label)}"` : ""}>`);
1557
1649
  for (const point of layer.points) {
@@ -1614,37 +1706,21 @@ function renderGlyphOverlay(push, model) {
1614
1706
  function renderAngleGlyph(push, marker, model) {
1615
1707
  const label = angleDisplayLabel(marker.key);
1616
1708
  const position = formatInlinePosition(marker.zodiacPosition);
1617
- const labelFontSize = marker.labelFontSize;
1618
- const positionFontSize = clamp(marker.labelFontSize * 0.52, 5.5 * model.scale, 9 * model.scale);
1619
- const signScale = positionFontSize * 0.88;
1620
- const gap = clamp(3.2 * model.scale, 2.5, 5);
1621
- const labelWidth = estimateTextWidth(label, labelFontSize);
1709
+ const positionFontSize = clamp(marker.labelFontSize * 0.62, 6 * model.scale, 10 * model.scale);
1710
+ const gap = clamp(3 * model.scale, 2, 5);
1622
1711
  const degreeWidth = estimateTextWidth(position.degreesText, positionFontSize);
1623
1712
  const minutesWidth = estimateTextWidth(position.minutesText, positionFontSize);
1624
- const totalWidth = labelWidth + gap + degreeWidth + gap + signScale + gap + minutesWidth;
1713
+ const totalWidth = degreeWidth + gap + minutesWidth;
1625
1714
  const startX = -totalWidth / 2;
1626
- const labelX = startX;
1627
- const degreeX = labelX + labelWidth + gap;
1628
- const signX = degreeX + degreeWidth + gap + signScale / 2;
1629
- const minutesX = signX + signScale / 2 + gap;
1715
+ const degreeX = startX;
1716
+ const minutesX = degreeX + degreeWidth + gap;
1630
1717
  push(
1631
1718
  `<g class="astro-wheel-angle-glyph-label" data-angle-marker="${marker.key}" data-longitude="${fmt2(marker.longitude)}" transform="translate(${fmt2(marker.labelPosition.x)} ${fmt2(marker.labelPosition.y)}) rotate(${fmt2(marker.labelRotation)})" filter="url(#${GLYPH_OUTLINE_FILTER_ID})">`
1632
1719
  );
1633
1720
  push(`<title>${escapeText2(`${label} ${position.degreesText} ${position.sign} ${position.minutesText}`)}</title>`);
1634
- push(
1635
- `<text class="astro-wheel-angle-label" x="${fmt2(labelX)}" y="0" font-family="${textFontFamily2()}" font-size="${fmt2(labelFontSize)}" text-anchor="start" dominant-baseline="middle" fill="${escapeAttr2(model.palette.angleLabel)}" font-weight="700">${escapeText2(label)}</text>`
1636
- );
1637
1721
  push(
1638
1722
  `<text class="astro-wheel-angle-degree" x="${fmt2(degreeX)}" y="0" font-family="${textFontFamily2()}" font-size="${fmt2(positionFontSize)}" text-anchor="start" dominant-baseline="middle" fill="${escapeAttr2(model.palette.angleLabel)}">${escapeText2(position.degreesText)}</text>`
1639
1723
  );
1640
- renderInlineSignGlyph(
1641
- push,
1642
- position.sign,
1643
- signX,
1644
- 0,
1645
- signScale,
1646
- model.palette.angleLabel
1647
- );
1648
1724
  push(
1649
1725
  `<text class="astro-wheel-angle-minutes" x="${fmt2(minutesX)}" y="0" font-family="${textFontFamily2()}" font-size="${fmt2(positionFontSize)}" text-anchor="start" dominant-baseline="middle" fill="${escapeAttr2(model.palette.angleLabel)}">${escapeText2(position.minutesText)}</text>`
1650
1726
  );
@@ -1658,24 +1734,29 @@ function angleDisplayLabel(key) {
1658
1734
  return key;
1659
1735
  }
1660
1736
  function renderPointLabelGroup(push, point, model) {
1661
- const layout = getPointLabelLayout(point, model.scale);
1662
- const boundsAttr = point.labelBounds ? ` data-label-bounds="${escapeAttr2(formatLabelBounds(point.labelBounds))}"` : "";
1663
1737
  push(
1664
- `<g class="astro-wheel-point-label" data-point-layer="${escapeAttr2(point.layerId)}" data-point-key="${escapeAttr2(point.key)}" data-point-name="${escapeAttr2(point.name)}" data-point-kind="${point.kind}" data-longitude="${fmt2(point.longitude)}"${boundsAttr} transform="translate(${fmt2(point.glyphPosition.x)} ${fmt2(point.glyphPosition.y)})" filter="url(#${GLYPH_OUTLINE_FILTER_ID})">`
1738
+ `<g class="astro-wheel-point-label" data-point-layer="${escapeAttr2(point.layerId)}" data-point-key="${escapeAttr2(point.key)}" data-point-name="${escapeAttr2(point.name)}" data-point-kind="${point.kind}" data-longitude="${fmt2(point.longitude)}" data-display-longitude="${fmt2(point.displayLongitude)}" data-house="${point.house ?? ""}" transform="translate(${fmt2(point.glyphPosition.x)} ${fmt2(point.glyphPosition.y)})" filter="url(#${GLYPH_OUTLINE_FILTER_ID})">`
1665
1739
  );
1666
1740
  push(`<title>${escapeText2(pointLabelTitle(point))}</title>`);
1667
- renderPointGlyph(push, point, layout.glyphX, layout.glyphY, layout.glyphScale, model.palette.glyphHalo);
1668
- if (point.retrograde) {
1669
- renderRetrogradeMarker(
1670
- push,
1671
- layout.retrogradeX,
1672
- layout.retrogradeY,
1673
- layout.retrogradeFontSize,
1674
- point.color
1741
+ renderPointGlyph(push, point, 0, 0, point.glyphScale, model.palette.glyphHalo);
1742
+ push(`</g>`);
1743
+ for (const label of point.railLabels) {
1744
+ if (!label.visible)
1745
+ continue;
1746
+ push(
1747
+ `<g class="astro-wheel-position-rail-label" data-point-layer="${escapeAttr2(point.layerId)}" data-point-key="${escapeAttr2(point.key)}" data-point-name="${escapeAttr2(point.name)}" data-position-rail="${label.railId}" transform="translate(${fmt2(label.position.x)} ${fmt2(label.position.y)})" filter="url(#${GLYPH_OUTLINE_FILTER_ID})">`
1675
1748
  );
1749
+ if (label.railId === "sign" && label.sign) {
1750
+ renderInlineSignGlyph(push, label.sign, 0, 0, label.glyphScale ?? label.fontSize, point.color);
1751
+ } else if (label.railId === "retrograde") {
1752
+ renderRetrogradeMarker(push, 0, 0, label.fontSize, point.color);
1753
+ } else {
1754
+ push(
1755
+ `<text class="astro-wheel-point-${label.railId}" x="0" y="0" font-family="${textFontFamily2()}" font-size="${fmt2(label.fontSize)}" text-anchor="middle" dominant-baseline="middle" fill="${escapeAttr2(point.color)}" fill-opacity="0.9">${escapeText2(label.text)}</text>`
1756
+ );
1757
+ }
1758
+ push(`</g>`);
1676
1759
  }
1677
- renderPointInlineDegreeLabel(push, point, layout);
1678
- push(`</g>`);
1679
1760
  }
1680
1761
  function renderPointGlyph(push, point, x, y, glyphScale, glyphFill) {
1681
1762
  const glyph = point.glyphKey ? getAstroGlyph(point.glyphKey) : resolvePointGlyph(point.name);
@@ -1708,18 +1789,6 @@ function renderRetrogradeMarker(push, x, y, fontSize, color) {
1708
1789
  `<text class="astro-wheel-point-retrograde" x="${fmt2(x)}" y="${fmt2(y)}" font-family="${textFontFamily2()}" font-size="${fmt2(fontSize)}" text-anchor="middle" dominant-baseline="middle" fill="${escapeAttr2(color)}" font-weight="700">R</text>`
1709
1790
  );
1710
1791
  }
1711
- function renderPointInlineDegreeLabel(push, point, layout) {
1712
- if (!layout.position) {
1713
- return;
1714
- }
1715
- push(
1716
- `<text class="astro-wheel-point-degree" x="${fmt2(layout.degreeX)}" y="${fmt2(layout.degreeY)}" font-family="${textFontFamily2()}" font-size="${fmt2(layout.fontSize)}" text-anchor="start" dominant-baseline="middle" fill="${escapeAttr2(point.color)}" fill-opacity="0.9">${escapeText2(layout.position.degreesText)}</text>`
1717
- );
1718
- renderInlineSignGlyph(push, layout.position.sign, layout.signX, layout.signY, layout.signScale, point.color);
1719
- push(
1720
- `<text class="astro-wheel-point-minutes" x="${fmt2(layout.minutesX)}" y="${fmt2(layout.minutesY)}" font-family="${textFontFamily2()}" font-size="${fmt2(layout.fontSize)}" text-anchor="start" dominant-baseline="middle" fill="${escapeAttr2(point.color)}" fill-opacity="0.9">${escapeText2(layout.position.minutesText)}</text>`
1721
- );
1722
- }
1723
1792
  function renderInlineSignGlyph(push, sign, x, y, glyphScale, color) {
1724
1793
  const glyph = ZODIAC_GLYPHS[sign];
1725
1794
  if (glyph) {
@@ -1735,89 +1804,6 @@ function renderInlineSignGlyph(push, sign, x, y, glyphScale, color) {
1735
1804
  `<text class="astro-wheel-point-sign-glyph" x="${fmt2(x)}" y="${fmt2(y)}" font-family="${symbolFontFamily()}" font-size="${fmt2(glyphScale)}" text-anchor="middle" dominant-baseline="middle" fill="${escapeAttr2(color)}">${escapeText2(sign.charAt(0).toUpperCase())}</text>`
1736
1805
  );
1737
1806
  }
1738
- function getPointLabelLayout(point, scale) {
1739
- const glyphScale = point.glyphFontSize * 0.66;
1740
- const fontSize = clamp(point.glyphFontSize * 0.31, 5.5 * scale, 9 * scale);
1741
- const signScale = fontSize * 0.82;
1742
- const gap = clamp(3.2 * scale, 2.4, 5);
1743
- const railGap = clamp(4.4 * scale, 3.2, 7);
1744
- const retrogradeFontSize = clamp(fontSize * 0.74, 4.4 * scale, 7.2 * scale);
1745
- const retrogradeTextWidth = point.retrograde ? estimateTextWidth("Rx", retrogradeFontSize) : 0;
1746
- const retrogradeGap = point.retrograde ? clamp(1.7 * scale, 1.2, 3) : 0;
1747
- const position = point.zodiacPosition ? formatInlinePosition(point.zodiacPosition) : null;
1748
- const degreeWidth = position ? estimateTextWidth(position.degreesText, fontSize) : 0;
1749
- const minutesWidth = position ? estimateTextWidth(position.minutesText, fontSize) : 0;
1750
- const positionWidth = position ? degreeWidth + gap + signScale + gap + minutesWidth : 0;
1751
- const positionHeight = position ? Math.max(fontSize, signScale) : 0;
1752
- const inwardX = -Math.cos(point.labelAngle);
1753
- const inwardY = -Math.sin(point.labelAngle);
1754
- const glyphHalf = glyphScale / 2;
1755
- const retrogradeCenterDistance = point.retrograde ? glyphHalf + retrogradeGap + retrogradeTextWidth / 2 : 0;
1756
- const retrogradeRailWidth = point.retrograde ? retrogradeGap + retrogradeTextWidth : 0;
1757
- const positionCenterDistance = position ? glyphHalf + retrogradeRailWidth + railGap + positionWidth / 2 : 0;
1758
- const positionCenterX = inwardX * positionCenterDistance;
1759
- const positionCenterY = inwardY * positionCenterDistance;
1760
- const positionLeftX = positionCenterX - positionWidth / 2;
1761
- const glyphX = 0;
1762
- const glyphY = 0;
1763
- const retrogradeX = inwardX * retrogradeCenterDistance;
1764
- const retrogradeY = inwardY * retrogradeCenterDistance;
1765
- const degreeX = positionLeftX;
1766
- const degreeY = positionCenterY;
1767
- const signX = degreeX + degreeWidth + gap + signScale / 2;
1768
- const signY = positionCenterY;
1769
- const minutesX = signX + signScale / 2 + gap;
1770
- const minutesY = positionCenterY;
1771
- const boxes = [
1772
- {
1773
- x: -glyphHalf,
1774
- y: -glyphHalf,
1775
- width: glyphScale,
1776
- height: glyphScale
1777
- }
1778
- ];
1779
- if (point.retrograde) {
1780
- boxes.push({
1781
- x: retrogradeX - retrogradeTextWidth / 2,
1782
- y: retrogradeY - retrogradeFontSize / 2,
1783
- width: retrogradeTextWidth,
1784
- height: retrogradeFontSize
1785
- });
1786
- }
1787
- if (position) {
1788
- boxes.push({
1789
- x: positionLeftX,
1790
- y: positionCenterY - positionHeight / 2,
1791
- width: positionWidth,
1792
- height: positionHeight
1793
- });
1794
- }
1795
- const boundsX = Math.min(...boxes.map((box) => box.x));
1796
- const boundsY = Math.min(...boxes.map((box) => box.y));
1797
- const boundsMaxX = Math.max(...boxes.map((box) => box.x + box.width));
1798
- const boundsMaxY = Math.max(...boxes.map((box) => box.y + box.height));
1799
- return {
1800
- glyphScale,
1801
- glyphX,
1802
- glyphY,
1803
- fontSize,
1804
- degreeX,
1805
- degreeY,
1806
- signX,
1807
- signScale,
1808
- signY,
1809
- minutesX,
1810
- minutesY,
1811
- retrogradeX,
1812
- retrogradeY,
1813
- retrogradeFontSize,
1814
- boundsX,
1815
- boundsY,
1816
- width: boundsMaxX - boundsX,
1817
- height: boundsMaxY - boundsY,
1818
- position
1819
- };
1820
- }
1821
1807
  function formatInlinePosition(position) {
1822
1808
  let degrees = Math.floor(position.decimalDegrees);
1823
1809
  let minutes = Math.round((position.decimalDegrees - degrees) * 60);
@@ -1842,70 +1828,6 @@ function pointLabelTitle(point) {
1842
1828
  function estimateTextWidth(value, fontSize) {
1843
1829
  return value.length * fontSize * 0.56;
1844
1830
  }
1845
- function labelBoundsFor(position, layout, padding) {
1846
- const width = layout.width + padding * 2;
1847
- const height = layout.height + padding * 2;
1848
- return {
1849
- x: round2(position.x + layout.boundsX - padding),
1850
- y: round2(position.y + layout.boundsY - padding),
1851
- width: round2(width),
1852
- height: round2(height)
1853
- };
1854
- }
1855
- function constrainLabelInsideCircle(params) {
1856
- const { center, layout, padding, maxRadius } = params;
1857
- if (!Number.isFinite(maxRadius)) {
1858
- return {
1859
- position: params.position,
1860
- bounds: labelBoundsFor(params.position, layout, padding),
1861
- moved: false
1862
- };
1863
- }
1864
- let position = params.position;
1865
- let moved = false;
1866
- for (let attempt = 0; attempt < 6; attempt++) {
1867
- const bounds = labelBoundsFor(position, layout, padding);
1868
- const overflow = labelBoundsCircleOverflow(center, bounds, maxRadius);
1869
- if (overflow <= 0) {
1870
- return { position, bounds, moved };
1871
- }
1872
- const dx = position.x - center.x;
1873
- const dy = position.y - center.y;
1874
- const distance = Math.max(Math.hypot(dx, dy), 1);
1875
- position = {
1876
- x: round2(position.x - dx / distance * (overflow + 0.75)),
1877
- y: round2(position.y - dy / distance * (overflow + 0.75))
1878
- };
1879
- moved = true;
1880
- }
1881
- return {
1882
- position,
1883
- bounds: labelBoundsFor(position, layout, padding),
1884
- moved
1885
- };
1886
- }
1887
- function labelBoundsCircleOverflow(center, bounds, maxRadius) {
1888
- const corners = [
1889
- { x: bounds.x, y: bounds.y },
1890
- { x: bounds.x + bounds.width, y: bounds.y },
1891
- { x: bounds.x, y: bounds.y + bounds.height },
1892
- { x: bounds.x + bounds.width, y: bounds.y + bounds.height }
1893
- ];
1894
- const farthestCorner = Math.max(
1895
- ...corners.map(
1896
- (corner) => Math.hypot(corner.x - center.x, corner.y - center.y)
1897
- )
1898
- );
1899
- return farthestCorner - maxRadius;
1900
- }
1901
- function formatLabelBounds(bounds) {
1902
- return `${fmt2(bounds.x)} ${fmt2(bounds.y)} ${fmt2(bounds.width)} ${fmt2(bounds.height)}`;
1903
- }
1904
- function projectedLabelWidthAlongTangent(angleRad, bounds) {
1905
- const tangentX = -Math.sin(angleRad);
1906
- const tangentY = Math.cos(angleRad);
1907
- return Math.abs(tangentX) * bounds.width + Math.abs(tangentY) * bounds.height;
1908
- }
1909
1831
  var POINT_GLYPH_ALIASES = {
1910
1832
  "mean node": "north node",
1911
1833
  "true node": "north node",
@@ -1988,7 +1910,7 @@ function buildHouseCusps(params) {
1988
1910
  const ring = rings.houses;
1989
1911
  const spokeInnerRadius = rings.aspects.r2;
1990
1912
  const spokeOuterRadius = ring.r2 + 4 * scale;
1991
- const labelRadius = ring.r2 + 12 * scale;
1913
+ const labelRadius = (ring.r1 + ring.r2) / 2;
1992
1914
  const labelFontSize = clamp((ring.r2 - ring.r1) * 0.48, 10 * scale, 19 * scale);
1993
1915
  return houses.map((house, index) => {
1994
1916
  const angle = angleOf2(house.longitude);
@@ -2009,10 +1931,7 @@ function buildAngleMarkers(params) {
2009
1931
  const { chart, center, angleOf: angleOf2, rings, scale } = params;
2010
1932
  const ring = rings.houses;
2011
1933
  const labelFontSize = clamp((ring.r2 - ring.r1) * 0.32, 8 * scale, 18 * scale);
2012
- const labelRadius = Math.min(
2013
- ring.r2 + 9 * scale,
2014
- ring.r2 - Math.max(10 * scale, labelFontSize * 0.6)
2015
- );
1934
+ const labelRadius = rings.zodiac.r1 + (rings.zodiac.r2 - rings.zodiac.r1) * 0.32;
2016
1935
  const markers = [
2017
1936
  { key: "ASC", position: chart.houses.ascendant },
2018
1937
  { key: "MC", position: chart.houses.mc },
@@ -2054,7 +1973,8 @@ function buildPointLayer(params) {
2054
1973
  palette,
2055
1974
  excludedBodies,
2056
1975
  pointConnectorMode,
2057
- maxDisplacementDegrees
1976
+ maxDisplacementDegrees,
1977
+ railVisibility
2058
1978
  } = params;
2059
1979
  const ring = rings.planets;
2060
1980
  const requestedRadius = resolvePointLayerRadius(layer, rings);
@@ -2069,6 +1989,19 @@ function buildPointLayer(params) {
2069
1989
  ) : requestedRadius;
2070
1990
  const isExternalLayer = radius > rings.houses.r2 + scale;
2071
1991
  const tickLength = Math.min(14 * scale, thickness * 0.34);
1992
+ const layerRailVisibility = resolveLayerRailVisibility({
1993
+ layer,
1994
+ fallback: railVisibility,
1995
+ external: isExternalLayer
1996
+ });
1997
+ const rails = buildPositionRails({
1998
+ ring,
1999
+ scale,
2000
+ visibility: layerRailVisibility,
2001
+ layerRadius: radius,
2002
+ external: isExternalLayer,
2003
+ glyphFontSize
2004
+ });
2072
2005
  const collisionPadding = Math.max(2 * scale, 1.5);
2073
2006
  const zodiacKeepOutGap = Math.max(5 * scale, 4);
2074
2007
  const labelMaxRadius = isExternalLayer ? Number.POSITIVE_INFINITY : rings.zodiac.r1 - zodiacKeepOutGap;
@@ -2077,6 +2010,7 @@ function buildPointLayer(params) {
2077
2010
  const tickColor = layer.tickColor ?? color;
2078
2011
  const pointIntents = seeds.map((seed) => {
2079
2012
  const tickAngle = angleOf2(seed.longitude);
2013
+ const trueAnchor = polarToXY2(center.x, center.y, rings.aspects.r2, tickAngle);
2080
2014
  const pointGlyphFontSize = seed.kind === "vertex" ? glyphFontSize * 0.82 : glyphFontSize;
2081
2015
  const rawGlyphRadius = radius;
2082
2016
  const glyphRadius = isExternalLayer ? rawGlyphRadius : clamp(
@@ -2085,37 +2019,43 @@ function buildPointLayer(params) {
2085
2019
  labelMaxRadius - pointGlyphFontSize * 0.5
2086
2020
  );
2087
2021
  const connectorRadius = glyphRadius;
2022
+ const glyphClearance = pointGlyphFontSize * 0.34;
2088
2023
  const tickLine = isExternalLayer ? lineFromPolar2(
2089
2024
  center,
2090
- rings.houses.r2 + 2 * scale,
2091
- connectorRadius,
2025
+ Math.max(rings.aspects.r1, rings.aspects.r2 - tickLength * 0.5),
2026
+ rings.aspects.r2 + tickLength * 0.5,
2092
2027
  tickAngle
2093
2028
  ) : lineFromPolar2(
2094
2029
  center,
2095
2030
  Math.min(ring.r2, connectorRadius + tickLength),
2096
- connectorRadius,
2031
+ Math.min(ring.r2, connectorRadius + glyphClearance),
2097
2032
  tickAngle
2098
2033
  );
2099
2034
  const idealPosition = polarToXY2(center.x, center.y, glyphRadius, tickAngle);
2100
- const point = makeAstroWheelPoint({
2035
+ makeAstroWheelPoint({
2101
2036
  layer,
2102
2037
  seed,
2103
2038
  tickLine,
2039
+ trueAngle: tickAngle,
2040
+ displayAngle: tickAngle,
2041
+ trueAnchor,
2104
2042
  labelAngle: tickAngle,
2105
2043
  glyphPosition: idealPosition,
2106
2044
  glyphFontSize: pointGlyphFontSize,
2045
+ rails,
2046
+ houses: layer.chart?.houses.houses,
2047
+ center,
2107
2048
  color,
2108
2049
  tickColor
2109
2050
  });
2110
- const layout = getPointLabelLayout(point, scale);
2111
- const labelBounds = labelBoundsFor(idealPosition, layout, collisionPadding);
2112
- const labelTangentDemandPx = projectedLabelWidthAlongTangent(tickAngle, labelBounds);
2051
+ const labelTangentDemandPx = pointGlyphFontSize * 0.72;
2113
2052
  const configuredTangentDemandPx = layer.collisionThresholdDegrees ? deg2rad2(clamp(layer.collisionThresholdDegrees, 0, 30)) * glyphRadius : 0;
2114
2053
  const tangentDemandPx = Math.max(labelTangentDemandPx, configuredTangentDemandPx);
2115
2054
  return {
2116
2055
  seed,
2117
2056
  tickAngle,
2118
2057
  tickLine,
2058
+ trueAnchor,
2119
2059
  connectorRadius,
2120
2060
  glyphRadius,
2121
2061
  pointGlyphFontSize,
@@ -2144,50 +2084,56 @@ function buildPointLayer(params) {
2144
2084
  layer,
2145
2085
  seed: intent.seed,
2146
2086
  tickLine: intent.tickLine,
2087
+ trueAngle: intent.tickAngle,
2088
+ displayAngle: visualAngle,
2089
+ trueAnchor: intent.trueAnchor,
2147
2090
  labelAngle: visualAngle,
2148
2091
  glyphPosition,
2149
2092
  glyphFontSize: intent.pointGlyphFontSize,
2093
+ rails,
2094
+ houses: layer.chart?.houses.houses,
2095
+ center,
2150
2096
  color,
2151
2097
  tickColor
2152
2098
  });
2153
- const layout = getPointLabelLayout(point, scale);
2154
- const constrainedLabel = constrainLabelInsideCircle({
2099
+ const leaderArc = buildPointConnector({
2155
2100
  center,
2156
- position: glyphPosition,
2157
- layout,
2158
- padding: collisionPadding,
2159
- maxRadius: labelMaxRadius
2101
+ tickAngle: intent.tickAngle,
2102
+ labelAngle: visualAngle,
2103
+ connectorRadius: intent.connectorRadius,
2104
+ glyphPosition,
2105
+ mode: pointConnectorMode
2106
+ });
2107
+ const connector = buildPointLineConnector({
2108
+ trueAnchor: point.trueAnchor,
2109
+ glyphPosition,
2110
+ mode: pointConnectorMode,
2111
+ tickAngle: intent.tickAngle,
2112
+ displayAngle: visualAngle
2160
2113
  });
2161
- if (constrainedLabel.moved) {
2162
- glyphPosition = constrainedLabel.position;
2163
- point = {
2164
- ...point,
2165
- glyphPosition,
2166
- leaderLine: void 0
2167
- };
2168
- }
2169
- point = {
2170
- ...point,
2171
- leaderArc: buildPointConnector({
2172
- center,
2173
- tickAngle: intent.tickAngle,
2174
- labelAngle: visualAngle,
2175
- connectorRadius: intent.connectorRadius,
2176
- glyphPosition,
2177
- mode: pointConnectorMode
2178
- })
2179
- };
2180
2114
  return {
2181
2115
  ...point,
2182
- labelBounds: constrainedLabel.bounds
2116
+ leaderArc,
2117
+ connector
2183
2118
  };
2184
2119
  });
2120
+ const notches = buildBoundaryNotches({
2121
+ layerId: layer.id,
2122
+ points,
2123
+ houses: layer.chart?.houses.houses ?? [],
2124
+ center,
2125
+ radius,
2126
+ ring,
2127
+ scale
2128
+ });
2185
2129
  return {
2186
2130
  id: layer.id,
2187
2131
  label: layer.label,
2188
2132
  color,
2189
2133
  tickColor,
2190
2134
  radius,
2135
+ rails,
2136
+ notches,
2191
2137
  points
2192
2138
  };
2193
2139
  }
@@ -2196,12 +2142,27 @@ function makeAstroWheelPoint(params) {
2196
2142
  layer,
2197
2143
  seed,
2198
2144
  tickLine,
2145
+ trueAngle,
2146
+ displayAngle,
2147
+ trueAnchor,
2199
2148
  labelAngle,
2200
2149
  glyphPosition,
2201
2150
  glyphFontSize,
2151
+ rails,
2152
+ houses,
2153
+ center,
2202
2154
  color,
2203
2155
  tickColor
2204
2156
  } = params;
2157
+ const houseContext = houses ? getHouseContext(seed.longitude, houses) : {};
2158
+ const railLabels = buildPointRailLabels({
2159
+ seed,
2160
+ rails,
2161
+ center,
2162
+ displayAngle,
2163
+ glyphFontSize
2164
+ });
2165
+ const glyphScale = glyphFontSize * 0.66;
2205
2166
  return {
2206
2167
  layerId: layer.id,
2207
2168
  key: seed.key,
@@ -2210,7 +2171,13 @@ function makeAstroWheelPoint(params) {
2210
2171
  glyph: seed.glyph,
2211
2172
  glyphKey: seed.glyphKey,
2212
2173
  longitude: normalizeAngle(seed.longitude),
2213
- displayLongitude: normalizeAngle(seed.longitude),
2174
+ displayLongitude: normalizeAngle(seed.longitude + rad2deg2(signedAngleDelta(displayAngle, trueAngle))),
2175
+ trueAnchor,
2176
+ trueAngle,
2177
+ displayAngle,
2178
+ house: houseContext.house,
2179
+ nearestCuspHouse: houseContext.nearestCuspHouse,
2180
+ nearestCuspDistanceDegrees: houseContext.nearestCuspDistanceDegrees,
2214
2181
  zodiacPosition: seed.zodiacPosition,
2215
2182
  tickLine,
2216
2183
  labelAngle,
@@ -2218,14 +2185,209 @@ function makeAstroWheelPoint(params) {
2218
2185
  leaderLine: void 0,
2219
2186
  glyphPosition,
2220
2187
  glyphFontSize,
2188
+ glyphScale,
2189
+ railLabels,
2190
+ hitTarget: {
2191
+ kind: "circle",
2192
+ cx: glyphPosition.x,
2193
+ cy: glyphPosition.y,
2194
+ r: round2(glyphScale * 0.72)
2195
+ },
2221
2196
  retrograde: seed.retrograde,
2222
2197
  color,
2223
2198
  tickColor
2224
2199
  };
2225
2200
  }
2201
+ function resolveRailVisibility(input) {
2202
+ if (input === "glyph-only") {
2203
+ return { degree: false, sign: false, minutes: false, retrograde: false };
2204
+ }
2205
+ if (input === "compact") {
2206
+ return { degree: true, sign: true, minutes: false, retrograde: true };
2207
+ }
2208
+ if (!input || input === "full") {
2209
+ return { degree: true, sign: true, minutes: true, retrograde: true };
2210
+ }
2211
+ return {
2212
+ degree: input.degree ?? true,
2213
+ sign: input.sign ?? true,
2214
+ minutes: input.minutes ?? true,
2215
+ retrograde: input.retrograde ?? true
2216
+ };
2217
+ }
2218
+ function resolveLayerRailVisibility(params) {
2219
+ if (params.layer.rails) {
2220
+ return resolveRailVisibility(params.layer.rails);
2221
+ }
2222
+ if (params.external) {
2223
+ return {
2224
+ degree: params.fallback.degree,
2225
+ sign: false,
2226
+ minutes: false,
2227
+ retrograde: false
2228
+ };
2229
+ }
2230
+ return params.fallback;
2231
+ }
2232
+ function buildPositionRails(params) {
2233
+ const { ring, scale, visibility, layerRadius, external, glyphFontSize } = params;
2234
+ if (external) {
2235
+ const gap = Math.max(2.4 * scale, 2);
2236
+ const step = Math.max(glyphFontSize * 0.22, 4.2 * scale);
2237
+ const firstRailRadius = layerRadius + glyphFontSize * 0.42 + gap;
2238
+ return [
2239
+ { id: "degree", label: "Degree", radius: round2(firstRailRadius), visible: visibility.degree },
2240
+ { id: "minutes", label: "Minutes", radius: round2(firstRailRadius + step * 2), visible: visibility.minutes },
2241
+ { id: "sign", label: "Sign", radius: round2(firstRailRadius + step), visible: visibility.sign },
2242
+ { id: "retrograde", label: "Retrograde", radius: round2(firstRailRadius + step * 3), visible: visibility.retrograde }
2243
+ ];
2244
+ }
2245
+ const thickness = ring.r2 - ring.r1;
2246
+ const inset = Math.max(2 * scale, 1.5);
2247
+ return [
2248
+ { id: "degree", label: "Degree", radius: round2(ring.r1 + thickness * 0.52 + inset), visible: visibility.degree },
2249
+ { id: "minutes", label: "Minutes", radius: round2(ring.r1 + thickness * 0.24 + inset), visible: visibility.minutes },
2250
+ { id: "sign", label: "Sign", radius: round2(ring.r1 + thickness * 0.38 + inset), visible: visibility.sign },
2251
+ { id: "retrograde", label: "Retrograde", radius: round2(ring.r1 + thickness * 0.1 + inset), visible: visibility.retrograde }
2252
+ ];
2253
+ }
2254
+ function buildPointRailLabels(params) {
2255
+ const position = params.seed.zodiacPosition ? formatInlinePosition(params.seed.zodiacPosition) : null;
2256
+ const fontSize = clamp(params.glyphFontSize * 0.25, 5, 8);
2257
+ return params.rails.flatMap((rail) => {
2258
+ let text = "";
2259
+ let sign;
2260
+ let glyphScale;
2261
+ if (rail.id === "degree")
2262
+ text = position?.degreesText ?? "";
2263
+ if (rail.id === "sign") {
2264
+ sign = position?.sign;
2265
+ text = sign ? ASTRO_WHEEL_ZODIAC_SIGNS.find((entry) => entry.sign === sign)?.glyph ?? sign : "";
2266
+ glyphScale = fontSize * 0.78;
2267
+ }
2268
+ if (rail.id === "minutes")
2269
+ text = position?.minutesText ?? "";
2270
+ if (rail.id === "retrograde")
2271
+ text = params.seed.retrograde ? "R" : "";
2272
+ if (!text)
2273
+ return [];
2274
+ return [{
2275
+ railId: rail.id,
2276
+ text,
2277
+ sign,
2278
+ position: polarToXY2(params.center.x, params.center.y, rail.radius, params.displayAngle),
2279
+ angle: params.displayAngle,
2280
+ fontSize,
2281
+ glyphScale,
2282
+ visible: rail.visible
2283
+ }];
2284
+ });
2285
+ }
2286
+ function getHouseContext(longitude, houses) {
2287
+ if (houses.length === 0) {
2288
+ return {};
2289
+ }
2290
+ const lon = normalizeAngle(longitude);
2291
+ let house = houses.length;
2292
+ let nearestCuspHouse = 1;
2293
+ let nearestCuspDistanceDegrees = Number.POSITIVE_INFINITY;
2294
+ for (let index = 0; index < houses.length; index++) {
2295
+ const cusp = normalizeAngle(houses[index].longitude);
2296
+ const next = normalizeAngle(houses[(index + 1) % houses.length].longitude);
2297
+ const span = clamp360(next - cusp);
2298
+ const offset = clamp360(lon - cusp);
2299
+ const distance = Math.abs(shortestLongitudeDistance(lon, cusp));
2300
+ if (offset < span || Math.abs(offset - span) < 1e-4) {
2301
+ house = index + 1;
2302
+ }
2303
+ if (distance < nearestCuspDistanceDegrees) {
2304
+ nearestCuspDistanceDegrees = distance;
2305
+ nearestCuspHouse = index + 1;
2306
+ }
2307
+ }
2308
+ return {
2309
+ house,
2310
+ nearestCuspHouse,
2311
+ nearestCuspDistanceDegrees: round2(nearestCuspDistanceDegrees)
2312
+ };
2313
+ }
2314
+ function buildPointLineConnector(params) {
2315
+ if (params.mode === "never")
2316
+ return void 0;
2317
+ if (params.mode === "auto" && circularAngleDistance(params.tickAngle, params.displayAngle) < deg2rad2(0.35)) {
2318
+ return void 0;
2319
+ }
2320
+ return {
2321
+ x1: params.trueAnchor.x,
2322
+ y1: params.trueAnchor.y,
2323
+ x2: params.glyphPosition.x,
2324
+ y2: params.glyphPosition.y
2325
+ };
2326
+ }
2327
+ function buildBoundaryNotches(params) {
2328
+ if (params.houses.length === 0)
2329
+ return [];
2330
+ const { center, ring, radius, scale } = params;
2331
+ return params.points.flatMap((point) => {
2332
+ if (!point.nearestCuspHouse || point.nearestCuspDistanceDegrees === void 0)
2333
+ return [];
2334
+ const displaced = circularAngleDistance(point.trueAngle, point.displayAngle) > deg2rad2(0.35);
2335
+ if (!displaced)
2336
+ return [];
2337
+ const cusp = params.houses[point.nearestCuspHouse - 1];
2338
+ const cuspAngle = point.trueAngle + deg2rad2(shortestLongitudeDistance(point.longitude, cusp.longitude));
2339
+ const trueDelta = signedAngleDelta(cuspAngle, point.trueAngle);
2340
+ const displayDelta = signedAngleDelta(cuspAngle, point.displayAngle);
2341
+ const crossed = Math.sign(trueDelta) !== Math.sign(displayDelta) && displayDelta !== 0;
2342
+ const crowds = point.nearestCuspDistanceDegrees <= 2;
2343
+ if (!crossed && !crowds)
2344
+ return [];
2345
+ const glyphHalfAngle = Math.max(point.glyphScale * 0.62, 4 * scale) / Math.max(radius, 1);
2346
+ const directed = displayDelta === 0 ? trueDelta : displayDelta;
2347
+ const direction = directed >= 0 ? 1 : -1;
2348
+ const endAngle = cuspAngle + directed + direction * glyphHalfAngle;
2349
+ const halfThickness = Math.max(point.glyphScale * 0.9, 7 * scale);
2350
+ const innerRadius = clamp(radius - halfThickness, ring.r1, ring.r2);
2351
+ const outerRadius = clamp(radius + halfThickness, ring.r1, ring.r2);
2352
+ return [{
2353
+ id: `${params.layerId}-${point.key}-notch`,
2354
+ layerId: params.layerId,
2355
+ pointKey: point.key,
2356
+ house: point.house ?? 0,
2357
+ cuspHouse: point.nearestCuspHouse,
2358
+ cuspLongitude: normalizeAngle(cusp.longitude),
2359
+ radius: outerRadius,
2360
+ innerRadius,
2361
+ outerRadius,
2362
+ startAngle: cuspAngle,
2363
+ endAngle,
2364
+ path: boundaryNotchPath(center, innerRadius, outerRadius, cuspAngle, endAngle)
2365
+ }];
2366
+ });
2367
+ }
2368
+ function boundaryNotchPath(center, innerRadius, outerRadius, cuspAngle, endAngle) {
2369
+ const outerCusp = polarToXY2(center.x, center.y, outerRadius, cuspAngle);
2370
+ const outerEnd = polarToXY2(center.x, center.y, outerRadius, endAngle);
2371
+ const innerEnd = polarToXY2(center.x, center.y, innerRadius, endAngle);
2372
+ const innerCusp = polarToXY2(center.x, center.y, innerRadius, cuspAngle);
2373
+ const delta = signedAngleDelta(cuspAngle, endAngle);
2374
+ const sweepOuter = delta >= 0 ? 1 : 0;
2375
+ const sweepInner = delta >= 0 ? 0 : 1;
2376
+ return [
2377
+ `M ${fmt2(outerCusp.x)} ${fmt2(outerCusp.y)}`,
2378
+ `A ${fmt2(outerRadius)} ${fmt2(outerRadius)} 0 0 ${sweepOuter} ${fmt2(outerEnd.x)} ${fmt2(outerEnd.y)}`,
2379
+ `L ${fmt2(innerEnd.x)} ${fmt2(innerEnd.y)}`,
2380
+ `A ${fmt2(innerRadius)} ${fmt2(innerRadius)} 0 0 ${sweepInner} ${fmt2(innerCusp.x)} ${fmt2(innerCusp.y)}`,
2381
+ "Z"
2382
+ ].join(" ");
2383
+ }
2226
2384
  function buildAspectLayer(params) {
2227
2385
  const { layer, chart, pointByKey, center, angleOf: angleOf2, rings, palette, excludedBodies } = params;
2228
- const sourceEdges = getSourceAspectEdges(chart, {
2386
+ const sourceEdges = layer.edges ? layer.edges : layer.chartB ? computeCrossAspectEdges(
2387
+ chart.planets,
2388
+ layer.chartB.planets,
2389
+ layer.aspectSpecs ?? ASTRO_WHEEL_DEFAULT_ASPECT_SPECS
2390
+ ) : getSourceAspectEdges(chart, {
2229
2391
  edges: layer.edges,
2230
2392
  aspectSpecs: layer.aspectSpecs
2231
2393
  });
@@ -2247,8 +2409,8 @@ function buildAspectLayer(params) {
2247
2409
  const spec = findAspectSpec(edge.aspect, layer.aspectSpecs);
2248
2410
  const maxOrb = spec?.orb ?? 8;
2249
2411
  const opacity = clamp((1 - edge.orb / Math.max(maxOrb, 1e-3)) * (layer.opacityScale ?? 1), 0.25, 0.92);
2250
- const a = polarToXY2(center.x, center.y, aspectRadius, angleOf2(planetA.longitude));
2251
- const b = polarToXY2(center.x, center.y, aspectRadius, angleOf2(planetB.longitude));
2412
+ const a = layer.radius || layer.radiusScale ? polarToXY2(center.x, center.y, aspectRadius, angleOf2(planetA.longitude)) : planetA.trueAnchor;
2413
+ const b = layer.radius || layer.radiusScale ? polarToXY2(center.x, center.y, aspectRadius, angleOf2(planetB.longitude)) : planetB.trueAnchor;
2252
2414
  return [{
2253
2415
  layerId: layer.id,
2254
2416
  planetA: planetA.name,
@@ -2458,6 +2620,9 @@ function circularAngleDistance(a, b) {
2458
2620
  const delta = Math.abs(clampRad(a) - clampRad(b));
2459
2621
  return Math.min(delta, TAU2 - delta);
2460
2622
  }
2623
+ function rad2deg2(radians) {
2624
+ return radians * (360 / TAU2);
2625
+ }
2461
2626
  function buildPointConnector(params) {
2462
2627
  const { center, tickAngle, labelAngle, connectorRadius, glyphPosition, mode } = params;
2463
2628
  const displacement = circularAngleDistance(tickAngle, labelAngle);
@@ -2512,6 +2677,32 @@ function computeAspectEdges(planets, specs) {
2512
2677
  }
2513
2678
  return edges;
2514
2679
  }
2680
+ function computeCrossAspectEdges(planetsA, planetsB, specs) {
2681
+ const keysA = Object.keys(planetsA);
2682
+ const keysB = Object.keys(planetsB);
2683
+ const edges = [];
2684
+ for (const keyA of keysA) {
2685
+ for (const keyB of keysB) {
2686
+ const planetA = planetsA[keyA];
2687
+ const planetB = planetsB[keyB];
2688
+ const match = getAspectMatch(planetA.longitude, planetB.longitude, specs);
2689
+ if (!match) {
2690
+ continue;
2691
+ }
2692
+ edges.push({
2693
+ planetA: keyA,
2694
+ planetB: keyB,
2695
+ longitudeA: normalizeAngle(planetA.longitude),
2696
+ longitudeB: normalizeAngle(planetB.longitude),
2697
+ aspect: match.spec.name,
2698
+ aspectAngle: match.spec.angle,
2699
+ delta: match.delta,
2700
+ orb: match.orb
2701
+ });
2702
+ }
2703
+ }
2704
+ return edges;
2705
+ }
2515
2706
  function getAspectMatch(lonA, lonB, specs) {
2516
2707
  const delta = Math.min(
2517
2708
  normalizeAngle(lonB - lonA),
@@ -2525,6 +2716,9 @@ function getAspectMatch(lonA, lonB, specs) {
2525
2716
  }
2526
2717
  return null;
2527
2718
  }
2719
+ function shortestLongitudeDistance(a, b) {
2720
+ return (normalizeAngle(a) - normalizeAngle(b) + 540) % 360 - 180;
2721
+ }
2528
2722
  function findAspectSpec(aspect, specs = ASTRO_WHEEL_DEFAULT_ASPECT_SPECS) {
2529
2723
  return specs.find((spec) => spec.name === aspect);
2530
2724
  }
@@ -3765,4 +3959,4 @@ function escapeAttr3(value) {
3765
3959
 
3766
3960
  export { ANGLE_GLYPHS, ANGLE_GLYPH_PRIMITIVES, ARCHEOMETER_DEFAULT_VIEWBOX, ASPECT_GLYPHS, ASPECT_GLYPH_PRIMITIVES, ASTRO_GLYPHS, ASTRO_WHEEL_DEFAULT_ASPECT_SPECS, ASTRO_WHEEL_DEFAULT_VIEWBOX, ASTRO_WHEEL_POINT_GLYPHS, ASTRO_WHEEL_ZODIAC_SIGNS, DEFAULT_ARCHEOMETER_MUSICAL_NOTES, DEFAULT_ARCHEOMETER_PLANETS, DEFAULT_ARCHEOMETER_SECTOR_CORRESPONDENCES, DEFAULT_ARCHEOMETER_TRIANGLES, DEFAULT_ARCHEOMETER_TRIANGLE_LABELS, DEFAULT_ARCHEOMETER_UTTERANCE, DEFAULT_ARCHEOMETER_ZODIAC, DEFAULT_ARCHETYPE_MUSICAL_NOTES, DEFAULT_ARCHETYPE_PLANETS, DEFAULT_ARCHETYPE_TRIANGLES, DEFAULT_ARCHETYPE_UTTERANCE, DEFAULT_ARCHETYPE_ZODIAC, PLANET_GLYPHS, PLANET_GLYPH_PRIMITIVES, TREE_PATH_IDS, TREE_SPHERE_IDS, TREE_SPHERE_NAMES, TREE_SVG_DEFAULT_VIEWBOX, ZODIAC_GLYPHS, ZODIAC_GLYPH_PRIMITIVES, generateArcheometerSvg, generateAstroGlyphSvg, generateAstroWheelSvg, generateGlyphSvg, generateTreeSvg, getArcheometerRenderModel, getAstroGlyph, getAstroWheelRenderModel, getRouteActivations, getTreeLayout, getTreeRenderModel, listAstroGlyphs };
3767
3961
  //# sourceMappingURL=out.js.map
3768
- //# sourceMappingURL=chunk-THD4XOYR.mjs.map
3962
+ //# sourceMappingURL=chunk-PPIKM3QA.mjs.map