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